@ape.swap/bonds-sdk 4.0.1-test.1 → 4.0.1-test.11

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/dist/main.js CHANGED
@@ -2132,7 +2132,7 @@ function memoize$2(fn) {
2132
2132
  };
2133
2133
  }
2134
2134
 
2135
- var isBrowser$5 = typeof document !== 'undefined';
2135
+ var isBrowser$4 = typeof document !== 'undefined';
2136
2136
 
2137
2137
  var identifierWithPointTracking = function identifierWithPointTracking(begin, points, index) {
2138
2138
  var previous = 0;
@@ -2471,7 +2471,7 @@ var prefixer = function prefixer(element, index, children, callback) {
2471
2471
  }
2472
2472
  };
2473
2473
 
2474
- var getServerStylisCache = isBrowser$5 ? undefined : weakMemoize(function () {
2474
+ var getServerStylisCache = isBrowser$4 ? undefined : weakMemoize(function () {
2475
2475
  return memoize$2(function () {
2476
2476
  return {};
2477
2477
  });
@@ -2481,7 +2481,7 @@ var defaultStylisPlugins = [prefixer];
2481
2481
  var createCache = function createCache(options) {
2482
2482
  var key = options.key;
2483
2483
 
2484
- if (isBrowser$5 && key === 'css') {
2484
+ if (isBrowser$4 && key === 'css') {
2485
2485
  var ssrStyles = document.querySelectorAll("style[data-emotion]:not([data-s])"); // get SSRed styles out of the way of React's hydration
2486
2486
  // document.head is a safe place to move them to(though note document.head is not necessarily the last place they will be)
2487
2487
  // note this very very intentionally targets all style elements regardless of the key to ensure
@@ -2511,7 +2511,7 @@ var createCache = function createCache(options) {
2511
2511
  var container;
2512
2512
  var nodesToHydrate = [];
2513
2513
 
2514
- if (isBrowser$5) {
2514
+ if (isBrowser$4) {
2515
2515
  container = options.container || document.head;
2516
2516
  Array.prototype.forEach.call( // this means we will ignore elements which don't have a space in them which
2517
2517
  // means that the style elements we're looking at are only Emotion 11 server-rendered style elements
@@ -2864,7 +2864,7 @@ var TYPE_STATICS = {};
2864
2864
  TYPE_STATICS[reactIs.ForwardRef] = FORWARD_REF_STATICS;
2865
2865
  TYPE_STATICS[reactIs.Memo] = MEMO_STATICS;
2866
2866
 
2867
- var isBrowser$4 = typeof document !== 'undefined';
2867
+ var isBrowser$3 = typeof document !== 'undefined';
2868
2868
 
2869
2869
  function getRegisteredStyles(registered, registeredStyles, classNames) {
2870
2870
  var rawClassName = '';
@@ -2889,7 +2889,7 @@ var registerStyles = function registerStyles(cache, serialized, isStringTag) {
2889
2889
  // in node since emotion-server relies on whether a style is in
2890
2890
  // the registered cache to know whether a style is global or not
2891
2891
  // also, note that this check will be dead code eliminated in the browser
2892
- isBrowser$4 === false && cache.compat !== undefined) && cache.registered[className] === undefined) {
2892
+ isBrowser$3 === false && cache.compat !== undefined) && cache.registered[className] === undefined) {
2893
2893
  cache.registered[className] = serialized.styles;
2894
2894
  }
2895
2895
  };
@@ -2904,14 +2904,14 @@ var insertStyles = function insertStyles(cache, serialized, isStringTag) {
2904
2904
  do {
2905
2905
  var maybeStyles = cache.insert(serialized === current ? "." + className : '', current, cache.sheet, true);
2906
2906
 
2907
- if (!isBrowser$4 && maybeStyles !== undefined) {
2907
+ if (!isBrowser$3 && maybeStyles !== undefined) {
2908
2908
  stylesForSSR += maybeStyles;
2909
2909
  }
2910
2910
 
2911
2911
  current = current.next;
2912
2912
  } while (current !== undefined);
2913
2913
 
2914
- if (!isBrowser$4 && stylesForSSR.length !== 0) {
2914
+ if (!isBrowser$3 && stylesForSSR.length !== 0) {
2915
2915
  return stylesForSSR;
2916
2916
  }
2917
2917
  }
@@ -3134,12 +3134,9 @@ function handleInterpolation(mergedProps, registered, interpolation) {
3134
3134
 
3135
3135
  var asString = interpolation;
3136
3136
 
3137
- if (registered == null) {
3137
+ {
3138
3138
  return asString;
3139
3139
  }
3140
-
3141
- var cached = registered[asString];
3142
- return cached !== undefined ? cached : asString;
3143
3140
  }
3144
3141
 
3145
3142
  function createStringFromObject(mergedProps, registered, obj) {
@@ -3156,14 +3153,12 @@ function createStringFromObject(mergedProps, registered, obj) {
3156
3153
  if (typeof value !== 'object') {
3157
3154
  var asString = value;
3158
3155
 
3159
- if (registered != null && registered[asString] !== undefined) {
3160
- string += key + "{" + registered[asString] + "}";
3161
- } else if (isProcessableValue(asString)) {
3156
+ if (isProcessableValue(asString)) {
3162
3157
  string += processStyleName(key) + ":" + processStyleValue(key, asString) + ";";
3163
3158
  }
3164
3159
  } else {
3165
3160
 
3166
- if (Array.isArray(value) && typeof value[0] === 'string' && (registered == null || registered[value[0]] === undefined)) {
3161
+ if (Array.isArray(value) && typeof value[0] === 'string' && (registered == null)) {
3167
3162
  for (var _i = 0; _i < value.length; _i++) {
3168
3163
  if (isProcessableValue(value[_i])) {
3169
3164
  string += processStyleName(key) + ":" + processStyleValue(key, value[_i]) + ";";
@@ -3246,18 +3241,17 @@ function serializeStyles(args, registered, mergedProps) {
3246
3241
  };
3247
3242
  }
3248
3243
 
3249
- var isBrowser$3 = typeof document !== 'undefined';
3244
+ var isBrowser$2 = typeof document !== 'undefined';
3250
3245
 
3251
3246
  var syncFallback = function syncFallback(create) {
3252
3247
  return create();
3253
3248
  };
3254
3249
 
3255
3250
  var useInsertionEffect = React['useInsertion' + 'Effect'] ? React['useInsertion' + 'Effect'] : false;
3256
- var useInsertionEffectAlwaysWithSyncFallback = !isBrowser$3 ? syncFallback : useInsertionEffect || syncFallback;
3251
+ var useInsertionEffectAlwaysWithSyncFallback = !isBrowser$2 ? syncFallback : useInsertionEffect || syncFallback;
3257
3252
  var useInsertionEffectWithLayoutFallback = useInsertionEffect || React.useLayoutEffect;
3258
3253
 
3259
- var isBrowser$2 = typeof document !== 'undefined';
3260
- var hasOwn = {}.hasOwnProperty;
3254
+ var isBrowser$1 = typeof document !== 'undefined';
3261
3255
 
3262
3256
  var EmotionCacheContext = /* #__PURE__ */React.createContext( // we're doing this to avoid preconstruct's dead code elimination in this one case
3263
3257
  // because this module is primarily intended for the browser and node
@@ -3269,14 +3263,9 @@ typeof HTMLElement !== 'undefined' ? /* #__PURE__ */createCache({
3269
3263
  key: 'css'
3270
3264
  }) : null);
3271
3265
 
3272
- if (process.env.NODE_ENV !== 'production') {
3273
- EmotionCacheContext.displayName = 'EmotionCacheContext';
3274
- }
3275
-
3276
3266
  EmotionCacheContext.Provider;
3277
3267
 
3278
3268
  var withEmotionCache = function withEmotionCache(func) {
3279
- // $FlowFixMe
3280
3269
  return /*#__PURE__*/forwardRef(function (props, ref) {
3281
3270
  // the cache will never be null in the browser
3282
3271
  var cache = useContext(EmotionCacheContext);
@@ -3284,7 +3273,7 @@ var withEmotionCache = function withEmotionCache(func) {
3284
3273
  });
3285
3274
  };
3286
3275
 
3287
- if (!isBrowser$2) {
3276
+ if (!isBrowser$1) {
3288
3277
  withEmotionCache = function withEmotionCache(func) {
3289
3278
  return function (props) {
3290
3279
  var cache = useContext(EmotionCacheContext);
@@ -3310,85 +3299,29 @@ if (!isBrowser$2) {
3310
3299
 
3311
3300
  var ThemeContext = /* #__PURE__ */React.createContext({});
3312
3301
 
3313
- if (process.env.NODE_ENV !== 'production') {
3314
- ThemeContext.displayName = 'EmotionThemeContext';
3315
- }
3316
-
3317
3302
  var useTheme = function useTheme() {
3318
3303
  return React.useContext(ThemeContext);
3319
3304
  };
3320
3305
 
3321
- var getLastPart = function getLastPart(functionName) {
3322
- // The match may be something like 'Object.createEmotionProps' or
3323
- // 'Loader.prototype.render'
3324
- var parts = functionName.split('.');
3325
- return parts[parts.length - 1];
3326
- };
3327
-
3328
- var getFunctionNameFromStackTraceLine = function getFunctionNameFromStackTraceLine(line) {
3329
- // V8
3330
- var match = /^\s+at\s+([A-Za-z0-9$.]+)\s/.exec(line);
3331
- if (match) return getLastPart(match[1]); // Safari / Firefox
3332
-
3333
- match = /^([A-Za-z0-9$.]+)@/.exec(line);
3334
- if (match) return getLastPart(match[1]);
3335
- return undefined;
3336
- };
3337
-
3338
- var internalReactFunctionNames = /* #__PURE__ */new Set(['renderWithHooks', 'processChild', 'finishClassComponent', 'renderToString']); // These identifiers come from error stacks, so they have to be valid JS
3339
- // identifiers, thus we only need to replace what is a valid character for JS,
3340
- // but not for CSS.
3341
-
3342
- var sanitizeIdentifier = function sanitizeIdentifier(identifier) {
3343
- return identifier.replace(/\$/g, '-');
3344
- };
3345
-
3346
- var getLabelFromStackTrace = function getLabelFromStackTrace(stackTrace) {
3347
- if (!stackTrace) return undefined;
3348
- var lines = stackTrace.split('\n');
3349
-
3350
- for (var i = 0; i < lines.length; i++) {
3351
- var functionName = getFunctionNameFromStackTraceLine(lines[i]); // The first line of V8 stack traces is just "Error"
3352
-
3353
- if (!functionName) continue; // If we reach one of these, we have gone too far and should quit
3354
-
3355
- if (internalReactFunctionNames.has(functionName)) break; // The component name is the first function in the stack that starts with an
3356
- // uppercase letter
3357
-
3358
- if (/^[A-Z]/.test(functionName)) return sanitizeIdentifier(functionName);
3359
- }
3360
-
3361
- return undefined;
3362
- };
3306
+ var hasOwn = {}.hasOwnProperty;
3363
3307
 
3364
3308
  var typePropName = '__EMOTION_TYPE_PLEASE_DO_NOT_USE__';
3365
- var labelPropName = '__EMOTION_LABEL_PLEASE_DO_NOT_USE__';
3366
3309
  var createEmotionProps = function createEmotionProps(type, props) {
3367
- if (process.env.NODE_ENV !== 'production' && typeof props.css === 'string' && // check if there is a css declaration
3368
- props.css.indexOf(':') !== -1) {
3369
- throw new Error("Strings are not allowed as css prop values, please wrap it in a css template literal from '@emotion/react' like this: css`" + props.css + "`");
3370
- }
3371
3310
 
3372
3311
  var newProps = {};
3373
3312
 
3374
- for (var key in props) {
3375
- if (hasOwn.call(props, key)) {
3376
- newProps[key] = props[key];
3313
+ for (var _key in props) {
3314
+ if (hasOwn.call(props, _key)) {
3315
+ newProps[_key] = props[_key];
3377
3316
  }
3378
3317
  }
3379
3318
 
3380
- newProps[typePropName] = type; // For performance, only call getLabelFromStackTrace in development and when
3381
- // the label hasn't already been computed
3382
-
3383
- if (process.env.NODE_ENV !== 'production' && !!props.css && (typeof props.css !== 'object' || typeof props.css.name !== 'string' || props.css.name.indexOf('-') === -1)) {
3384
- var label = getLabelFromStackTrace(new Error().stack);
3385
- if (label) newProps[labelPropName] = label;
3386
- }
3319
+ newProps[typePropName] = type; // Runtime labeling is an opt-in feature because:
3387
3320
 
3388
3321
  return newProps;
3389
3322
  };
3390
3323
 
3391
- var Insertion$1 = function Insertion(_ref) {
3324
+ var Insertion = function Insertion(_ref) {
3392
3325
  var cache = _ref.cache,
3393
3326
  serialized = _ref.serialized,
3394
3327
  isStringTag = _ref.isStringTag;
@@ -3397,7 +3330,7 @@ var Insertion$1 = function Insertion(_ref) {
3397
3330
  return insertStyles(cache, serialized, isStringTag);
3398
3331
  });
3399
3332
 
3400
- if (!isBrowser$2 && rules !== undefined) {
3333
+ if (!isBrowser$1 && rules !== undefined) {
3401
3334
  var _ref2;
3402
3335
 
3403
3336
  var serializedNames = serialized.name;
@@ -3437,52 +3370,44 @@ var Emotion = /* #__PURE__ */withEmotionCache(function (props, cache, ref) {
3437
3370
 
3438
3371
  var serialized = serializeStyles(registeredStyles, undefined, React.useContext(ThemeContext));
3439
3372
 
3440
- if (process.env.NODE_ENV !== 'production' && serialized.name.indexOf('-') === -1) {
3441
- var labelFromStack = props[labelPropName];
3442
-
3443
- if (labelFromStack) {
3444
- serialized = serializeStyles([serialized, 'label:' + labelFromStack + ';']);
3445
- }
3446
- }
3447
-
3448
3373
  className += cache.key + "-" + serialized.name;
3449
3374
  var newProps = {};
3450
3375
 
3451
- for (var key in props) {
3452
- if (hasOwn.call(props, key) && key !== 'css' && key !== typePropName && (process.env.NODE_ENV === 'production' || key !== labelPropName)) {
3453
- newProps[key] = props[key];
3376
+ for (var _key2 in props) {
3377
+ if (hasOwn.call(props, _key2) && _key2 !== 'css' && _key2 !== typePropName && (true )) {
3378
+ newProps[_key2] = props[_key2];
3454
3379
  }
3455
3380
  }
3456
3381
 
3457
- newProps.ref = ref;
3458
3382
  newProps.className = className;
3459
- return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Insertion$1, {
3383
+
3384
+ if (ref) {
3385
+ newProps.ref = ref;
3386
+ }
3387
+
3388
+ return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Insertion, {
3460
3389
  cache: cache,
3461
3390
  serialized: serialized,
3462
3391
  isStringTag: typeof WrappedComponent === 'string'
3463
3392
  }), /*#__PURE__*/React.createElement(WrappedComponent, newProps));
3464
3393
  });
3465
3394
 
3466
- if (process.env.NODE_ENV !== 'production') {
3467
- Emotion.displayName = 'EmotionCssPropInternal';
3468
- }
3469
-
3470
3395
  var Emotion$1 = Emotion;
3471
3396
 
3472
- function jsx$3(type, props, key) {
3397
+ var jsx$3 = function jsx(type, props, key) {
3473
3398
  if (!hasOwn.call(props, 'css')) {
3474
3399
  return jsxRuntimeExports.jsx(type, props, key);
3475
3400
  }
3476
3401
 
3477
3402
  return jsxRuntimeExports.jsx(Emotion$1, createEmotionProps(type, props), key);
3478
- }
3479
- function jsxs$1(type, props, key) {
3403
+ };
3404
+ var jsxs$1 = function jsxs(type, props, key) {
3480
3405
  if (!hasOwn.call(props, 'css')) {
3481
3406
  return jsxRuntimeExports.jsxs(type, props, key);
3482
3407
  }
3483
3408
 
3484
3409
  return jsxRuntimeExports.jsxs(Emotion$1, createEmotionProps(type, props), key);
3485
- }
3410
+ };
3486
3411
 
3487
3412
  /**
3488
3413
  * Allows for nested scales with shorthand values
@@ -5026,14 +4951,11 @@ const GreenShield = ({ width }) => {
5026
4951
  return (jsx$2("svg", { width: width || '10', height: "12", viewBox: "0 0 10 12", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: jsx$2("path", { d: "M4.0625 6.6H2.5V4.8H4.0625V3.3H5.9375V4.8H7.5V6.6H5.9375V8.1H4.0625V6.6ZM5 0L0 1.8V5.454C0 8.484 2.13125 11.31 5 12C7.86875 11.31 10 8.484 10 5.454V1.8L5 0Z", fill: "#38A611" }) }));
5027
4952
  };
5028
4953
 
5029
- var pkg = {
5030
- version: "11.11.4"};
5031
-
5032
4954
  var jsx$1 = function jsx(type, props) {
4955
+ // eslint-disable-next-line prefer-rest-params
5033
4956
  var args = arguments;
5034
4957
 
5035
4958
  if (props == null || !hasOwn.call(props, 'css')) {
5036
- // $FlowFixMe
5037
4959
  return React.createElement.apply(undefined, args);
5038
4960
  }
5039
4961
 
@@ -5044,30 +4966,26 @@ var jsx$1 = function jsx(type, props) {
5044
4966
 
5045
4967
  for (var i = 2; i < argsLength; i++) {
5046
4968
  createElementArgArray[i] = args[i];
5047
- } // $FlowFixMe
5048
-
4969
+ }
5049
4970
 
5050
4971
  return React.createElement.apply(null, createElementArgArray);
5051
4972
  };
5052
4973
 
5053
- var warnedAboutCssPropForGlobal = false; // maintain place over rerenders.
4974
+ (function (_jsx) {
4975
+ var JSX;
4976
+
4977
+ (function (_JSX) {})(JSX || (JSX = _jsx.JSX || (_jsx.JSX = {})));
4978
+ })(jsx$1 || (jsx$1 = {}));
4979
+
5054
4980
  // initial render from browser, insertBefore context.sheet.tags[0] or if a style hasn't been inserted there yet, appendChild
5055
4981
  // initial client-side render from SSR, use place of hydrating tag
5056
4982
 
5057
4983
  var Global = /* #__PURE__ */withEmotionCache(function (props, cache) {
5058
- if (process.env.NODE_ENV !== 'production' && !warnedAboutCssPropForGlobal && ( // check for className as well since the user is
5059
- // probably using the custom createElement which
5060
- // means it will be turned into a className prop
5061
- // $FlowFixMe I don't really want to add it to the type since it shouldn't be used
5062
- props.className || props.css)) {
5063
- console.error("It looks like you're using the css prop on Global, did you mean to use the styles prop instead?");
5064
- warnedAboutCssPropForGlobal = true;
5065
- }
5066
4984
 
5067
4985
  var styles = props.styles;
5068
4986
  var serialized = serializeStyles([styles], undefined, React.useContext(ThemeContext));
5069
4987
 
5070
- if (!isBrowser$2) {
4988
+ if (!isBrowser$1) {
5071
4989
  var _ref;
5072
4990
 
5073
4991
  var serializedNames = serialized.name;
@@ -5109,8 +5027,7 @@ var Global = /* #__PURE__ */withEmotionCache(function (props, cache) {
5109
5027
  container: cache.sheet.container,
5110
5028
  speedy: cache.sheet.isSpeedy
5111
5029
  });
5112
- var rehydrating = false; // $FlowFixMe
5113
-
5030
+ var rehydrating = false;
5114
5031
  var node = document.querySelector("style[data-emotion=\"" + key + " " + serialized.name + "\"]");
5115
5032
 
5116
5033
  if (cache.sheet.tags.length) {
@@ -5156,10 +5073,6 @@ var Global = /* #__PURE__ */withEmotionCache(function (props, cache) {
5156
5073
  return null;
5157
5074
  });
5158
5075
 
5159
- if (process.env.NODE_ENV !== 'production') {
5160
- Global.displayName = 'EmotionGlobal';
5161
- }
5162
-
5163
5076
  function css$1() {
5164
5077
  for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
5165
5078
  args[_key] = arguments[_key];
@@ -5168,10 +5081,9 @@ function css$1() {
5168
5081
  return serializeStyles(args);
5169
5082
  }
5170
5083
 
5171
- var keyframes$1 = function keyframes() {
5084
+ function keyframes$1() {
5172
5085
  var insertable = css$1.apply(void 0, arguments);
5173
- var name = "animation-" + insertable.name; // $FlowFixMe
5174
-
5086
+ var name = "animation-" + insertable.name;
5175
5087
  return {
5176
5088
  name: name,
5177
5089
  styles: "@keyframes " + name + "{" + insertable.styles + "}",
@@ -5180,169 +5092,6 @@ var keyframes$1 = function keyframes() {
5180
5092
  return "_EMO_" + this.name + "_" + this.styles + "_EMO_";
5181
5093
  }
5182
5094
  };
5183
- };
5184
-
5185
- var classnames = function classnames(args) {
5186
- var len = args.length;
5187
- var i = 0;
5188
- var cls = '';
5189
-
5190
- for (; i < len; i++) {
5191
- var arg = args[i];
5192
- if (arg == null) continue;
5193
- var toAdd = void 0;
5194
-
5195
- switch (typeof arg) {
5196
- case 'boolean':
5197
- break;
5198
-
5199
- case 'object':
5200
- {
5201
- if (Array.isArray(arg)) {
5202
- toAdd = classnames(arg);
5203
- } else {
5204
- if (process.env.NODE_ENV !== 'production' && arg.styles !== undefined && arg.name !== undefined) {
5205
- console.error('You have passed styles created with `css` from `@emotion/react` package to the `cx`.\n' + '`cx` is meant to compose class names (strings) so you should convert those styles to a class name by passing them to the `css` received from <ClassNames/> component.');
5206
- }
5207
-
5208
- toAdd = '';
5209
-
5210
- for (var k in arg) {
5211
- if (arg[k] && k) {
5212
- toAdd && (toAdd += ' ');
5213
- toAdd += k;
5214
- }
5215
- }
5216
- }
5217
-
5218
- break;
5219
- }
5220
-
5221
- default:
5222
- {
5223
- toAdd = arg;
5224
- }
5225
- }
5226
-
5227
- if (toAdd) {
5228
- cls && (cls += ' ');
5229
- cls += toAdd;
5230
- }
5231
- }
5232
-
5233
- return cls;
5234
- };
5235
-
5236
- function merge$2(registered, css, className) {
5237
- var registeredStyles = [];
5238
- var rawClassName = getRegisteredStyles(registered, registeredStyles, className);
5239
-
5240
- if (registeredStyles.length < 2) {
5241
- return className;
5242
- }
5243
-
5244
- return rawClassName + css(registeredStyles);
5245
- }
5246
-
5247
- var Insertion = function Insertion(_ref) {
5248
- var cache = _ref.cache,
5249
- serializedArr = _ref.serializedArr;
5250
- var rules = useInsertionEffectAlwaysWithSyncFallback(function () {
5251
- var rules = '';
5252
-
5253
- for (var i = 0; i < serializedArr.length; i++) {
5254
- var res = insertStyles(cache, serializedArr[i], false);
5255
-
5256
- if (!isBrowser$2 && res !== undefined) {
5257
- rules += res;
5258
- }
5259
- }
5260
-
5261
- if (!isBrowser$2) {
5262
- return rules;
5263
- }
5264
- });
5265
-
5266
- if (!isBrowser$2 && rules.length !== 0) {
5267
- var _ref2;
5268
-
5269
- return /*#__PURE__*/React.createElement("style", (_ref2 = {}, _ref2["data-emotion"] = cache.key + " " + serializedArr.map(function (serialized) {
5270
- return serialized.name;
5271
- }).join(' '), _ref2.dangerouslySetInnerHTML = {
5272
- __html: rules
5273
- }, _ref2.nonce = cache.sheet.nonce, _ref2));
5274
- }
5275
-
5276
- return null;
5277
- };
5278
-
5279
- var ClassNames = /* #__PURE__ */withEmotionCache(function (props, cache) {
5280
- var hasRendered = false;
5281
- var serializedArr = [];
5282
-
5283
- var css = function css() {
5284
- if (hasRendered && process.env.NODE_ENV !== 'production') {
5285
- throw new Error('css can only be used during render');
5286
- }
5287
-
5288
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
5289
- args[_key] = arguments[_key];
5290
- }
5291
-
5292
- var serialized = serializeStyles(args, cache.registered);
5293
- serializedArr.push(serialized); // registration has to happen here as the result of this might get consumed by `cx`
5294
-
5295
- registerStyles(cache, serialized, false);
5296
- return cache.key + "-" + serialized.name;
5297
- };
5298
-
5299
- var cx = function cx() {
5300
- if (hasRendered && process.env.NODE_ENV !== 'production') {
5301
- throw new Error('cx can only be used during render');
5302
- }
5303
-
5304
- for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
5305
- args[_key2] = arguments[_key2];
5306
- }
5307
-
5308
- return merge$2(cache.registered, css, classnames(args));
5309
- };
5310
-
5311
- var content = {
5312
- css: css,
5313
- cx: cx,
5314
- theme: React.useContext(ThemeContext)
5315
- };
5316
- var ele = props.children(content);
5317
- hasRendered = true;
5318
- return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Insertion, {
5319
- cache: cache,
5320
- serializedArr: serializedArr
5321
- }), ele);
5322
- });
5323
-
5324
- if (process.env.NODE_ENV !== 'production') {
5325
- ClassNames.displayName = 'EmotionClassNames';
5326
- }
5327
-
5328
- if (process.env.NODE_ENV !== 'production') {
5329
- var isBrowser$1 = typeof document !== 'undefined'; // #1727, #2905 for some reason Jest and Vitest evaluate modules twice if some consuming module gets mocked
5330
-
5331
- var isTestEnv = typeof jest !== 'undefined' || typeof vi !== 'undefined';
5332
-
5333
- if (isBrowser$1 && !isTestEnv) {
5334
- // globalThis has wide browser support - https://caniuse.com/?search=globalThis, Node.js 12 and later
5335
- var globalContext = // $FlowIgnore
5336
- typeof globalThis !== 'undefined' ? globalThis // eslint-disable-line no-undef
5337
- : isBrowser$1 ? window : global;
5338
- var globalKey = "__EMOTION_REACT_" + pkg.version.split('.')[0] + "__";
5339
-
5340
- if (globalContext[globalKey]) {
5341
- console.warn('You are loading @emotion/react when it is already loaded. Running ' + 'multiple instances may cause problems. This can happen if multiple ' + 'versions are used, or if multiple builds of the same version are ' + 'used.');
5342
- }
5343
-
5344
- globalContext[globalKey] = true;
5345
- }
5346
5095
  }
5347
5096
 
5348
5097
  var isMergeableObject = function isMergeableObject(value) {
@@ -5479,7 +5228,7 @@ var cjs = deepmerge_1;
5479
5228
 
5480
5229
  var deepmerge$1 = /*@__PURE__*/getDefaultExportFromCjs(cjs);
5481
5230
 
5482
- var version$k = "11.11.4";
5231
+ var version$k = "11.14.0";
5483
5232
  var packageInfo = {
5484
5233
  version: version$k};
5485
5234
 
@@ -63364,7 +63113,20 @@ const PUBLIC_RPC_URLS = {
63364
63113
  ], // mainnet
63365
63114
  // [ChainId.SOL]: ['https://devnet.helius-rpc.com/?api-key=095f6fc7-1be0-4d94-a737-4a5ee0d82ea5'], // devnet
63366
63115
  };
63367
- const HELIUS_SOL_RPC = 'https://mainnet.helius-rpc.com/?api-key=d80b11e0-692f-4da0-91d6-830799c8c385';
63116
+ // Multiple Helius SOL RPC endpoints for rotation
63117
+ const HELIUS_SOL_RPC_ENDPOINTS = [
63118
+ 'https://mainnet.helius-rpc.com/?api-key=d80b11e0-692f-4da0-91d6-830799c8c385', // apefede09@gmail.com
63119
+ 'https://mainnet.helius-rpc.com/?api-key=8631ce42-9000-490d-9ac3-f3a81de508b2', // apebond.design@gmail.com
63120
+ 'https://mainnet.helius-rpc.com/?api-key=c097651d-ae13-4ab4-ae4c-fef7e48d4561', // n0mbr3al3at0r10@gmail.com
63121
+ 'https://mainnet.helius-rpc.com/?api-key=a5c4ea36-fa6b-4bcc-a7a4-e10012b9ea7e', // RandomApe personal mail
63122
+ ];
63123
+ // Function to get a random Helius SOL RPC endpoint
63124
+ const getRandomHeliusRPC = () => {
63125
+ const randomIndex = Math.floor(Math.random() * HELIUS_SOL_RPC_ENDPOINTS.length);
63126
+ return HELIUS_SOL_RPC_ENDPOINTS[randomIndex];
63127
+ };
63128
+ // Keep the current export for backward compatibility
63129
+ const HELIUS_SOL_RPC = getRandomHeliusRPC();
63368
63130
  const getRPC = (chain) => {
63369
63131
  var _a;
63370
63132
  return (_a = PUBLIC_RPC_URLS === null || PUBLIC_RPC_URLS === void 0 ? void 0 : PUBLIC_RPC_URLS[chain]) === null || _a === void 0 ? void 0 : _a[0];
@@ -67451,6 +67213,23 @@ function fetchUserOwnedSolanaBonds(user, bondData, tokenPrices) {
67451
67213
  const results = [];
67452
67214
  const userBase58 = new PublicKey(user).toBase58();
67453
67215
  const connection = new Connection(getRPC(types$1.ChainId.SOL), 'confirmed');
67216
+ const collections = bondData.map((bond) => bond.billNnftAddress[types$1.ChainId.SOL]);
67217
+ const allOptions = {
67218
+ method: 'POST',
67219
+ headers: { 'Content-Type': 'application/json' },
67220
+ body: JSON.stringify({
67221
+ jsonrpc: '2.0',
67222
+ id: '1',
67223
+ method: 'searchAssets',
67224
+ params: {
67225
+ ownerAddress: userBase58,
67226
+ collections,
67227
+ },
67228
+ }),
67229
+ };
67230
+ const allResponse = yield fetch(HELIUS_SOL_RPC, allOptions);
67231
+ const allData = yield allResponse.json();
67232
+ const allUserAssets = allData.result.items;
67454
67233
  for (const bond of bondData) {
67455
67234
  if (bond.chainId !== types$1.ChainId.SOL || !bond.contractAddress[types$1.ChainId.SOL])
67456
67235
  continue;
@@ -67458,21 +67237,9 @@ function fetchUserOwnedSolanaBonds(user, bondData, tokenPrices) {
67458
67237
  const userBills = [];
67459
67238
  const collection = bond.billNnftAddress[types$1.ChainId.SOL];
67460
67239
  const payoutTokenPrice = (_d = (_c = (_b = (_a = tokenPrices === null || tokenPrices === void 0 ? void 0 : tokenPrices.find) === null || _a === void 0 ? void 0 : _a.call(tokenPrices, (t) => { var _a, _b, _c, _d; return ((_a = t === null || t === void 0 ? void 0 : t.address) === null || _a === void 0 ? void 0 : _a.toLowerCase()) === ((_d = (_c = (_b = bond === null || bond === void 0 ? void 0 : bond.earnToken) === null || _b === void 0 ? void 0 : _b.address) === null || _c === void 0 ? void 0 : _c[types$1.ChainId.SOL]) === null || _d === void 0 ? void 0 : _d.toLowerCase()); })) === null || _b === void 0 ? void 0 : _b.price) === null || _c === void 0 ? void 0 : _c.toString()) !== null && _d !== void 0 ? _d : '69';
67461
- const options = {
67462
- method: 'POST',
67463
- headers: { 'Content-Type': 'application/json' },
67464
- body: JSON.stringify({
67465
- jsonrpc: '2.0',
67466
- id: '1',
67467
- method: 'getAssetsByGroup',
67468
- params: { groupKey: 'collection', groupValue: collection },
67469
- }),
67470
- };
67471
- const response = yield fetch(HELIUS_SOL_RPC, options);
67472
- const data = yield response.json();
67473
- const userOwnedAssets = data.result.items;
67474
- const userAssets = userOwnedAssets.filter((asset) => {
67475
- return asset.ownership.owner === userBase58;
67240
+ const userAssets = allUserAssets.filter((asset) => {
67241
+ var _a;
67242
+ return asset.authorities[0].address.toLowerCase() === ((_a = bond.contractAddress[types$1.ChainId.SOL]) === null || _a === void 0 ? void 0 : _a.toLowerCase());
67476
67243
  });
67477
67244
  for (const asset of userAssets) {
67478
67245
  const nftMint = new PublicKey(asset.id);
@@ -67485,7 +67252,7 @@ function fetchUserOwnedSolanaBonds(user, bondData, tokenPrices) {
67485
67252
  const [bondTermPda] = PublicKey.findProgramAddressSync([new TextEncoder().encode('bond_term'), bondIssuancePda.toBuffer()], PROGRAM_ID);
67486
67253
  const [bondAccounts, pendingRewards] = yield Promise.all([
67487
67254
  getBondAccountSolana([bondPda.toBase58()]),
67488
- calculatePendingRewards(connection, user, bondPda, bondTermPda, bondIssuancePda, nftMint),
67255
+ calculatePendingRewards(connection, bondPda, bondTermPda, bondIssuancePda, nftMint),
67489
67256
  ]);
67490
67257
  if (!(bondAccounts === null || bondAccounts === void 0 ? void 0 : bondAccounts.length)) {
67491
67258
  console.error(`Could not fetch bond account for mint ${nftMint.toBase58()}`);
@@ -67528,7 +67295,7 @@ function fetchUserOwnedSolanaBonds(user, bondData, tokenPrices) {
67528
67295
  }
67529
67296
  });
67530
67297
  }
67531
- function calculatePendingRewards(connection, user, bondPda, bondTermPda, bondIssuancePda, nftMint) {
67298
+ function calculatePendingRewards(connection, bondPda, bondTermPda, bondIssuancePda, nftMint) {
67532
67299
  return __awaiter$9(this, void 0, void 0, function* () {
67533
67300
  try {
67534
67301
  const u64Codec = getU64Codec();
@@ -67552,7 +67319,7 @@ function calculatePendingRewards(connection, user, bondPda, bondTermPda, bondIss
67552
67319
  });
67553
67320
  // Transaction
67554
67321
  const transaction = new Transaction();
67555
- const userPublicKey = new PublicKey(user);
67322
+ const userPublicKey = new PublicKey('11111111111111111111111111111112'); // Dummy public key for fee payer
67556
67323
  transaction.feePayer = userPublicKey;
67557
67324
  transaction.add(instruction);
67558
67325
  // Simulate
@@ -67954,7 +67721,7 @@ const MAINNET_CHAINS = [
67954
67721
  types$1.ChainId.UNICHAIN,
67955
67722
  types$1.ChainId.MEGAETH_TESTNET,
67956
67723
  ];
67957
- const TESTNET_CHAINS = [types$1.ChainId.MONAD_TESTNET];
67724
+ const TESTNET_CHAINS = [types$1.ChainId.MONAD_TESTNET, types$1.ChainId.MEGAETH_TESTNET];
67958
67725
  // Network Icons
67959
67726
  const NETWORK_ICONS = {
67960
67727
  [types$1.ChainId.BSC]: icons.BNB_TOKEN,
@@ -68005,7 +67772,7 @@ const NETWORK_LABEL = {
68005
67772
  [types$1.ChainId.SOL]: 'Solana',
68006
67773
  [types$1.ChainId.KATANA]: 'Katana',
68007
67774
  [types$1.ChainId.UNICHAIN]: 'Unichain',
68008
- [types$1.ChainId.MEGAETH_TESTNET]: 'MEGAETH',
67775
+ [types$1.ChainId.MEGAETH_TESTNET]: 'MegaETH Testnet',
68009
67776
  };
68010
67777
  // Network block explorers
68011
67778
  const BLOCK_EXPLORER = {
@@ -68099,7 +67866,7 @@ const NetworkFilter = ({ chainFilterOption, setChainFilterOption, }) => {
68099
67866
  position: 'absolute',
68100
67867
  top: '45px',
68101
67868
  right: '0px',
68102
- width: '220px',
67869
+ width: '235px',
68103
67870
  maxHeight: ['300px', '300px', '350px'],
68104
67871
  overflowY: 'scroll',
68105
67872
  borderRadius: 'normal',
@@ -77366,7 +77133,6 @@ const YourBondsModalSolana = ({ onDismiss, userBill }) => {
77366
77133
  var _a, _b, _c, _d, _e, _f;
77367
77134
  return getBalanceNumber(new BigNumber$1((_a = userBill === null || userBill === void 0 ? void 0 : userBill.payout) !== null && _a !== void 0 ? _a : 0), (_f = (_d = (_c = (_b = userBill === null || userBill === void 0 ? void 0 : userBill.bond) === null || _b === void 0 ? void 0 : _b.earnToken) === null || _c === void 0 ? void 0 : _c.decimals) === null || _d === void 0 ? void 0 : _d[(_e = userBill === null || userBill === void 0 ? void 0 : userBill.bond) === null || _e === void 0 ? void 0 : _e.chainId]) !== null && _f !== void 0 ? _f : 18);
77368
77135
  };
77369
- console.log(totalPending(userBill));
77370
77136
  const claimable = (userBill) => {
77371
77137
  var _a, _b, _c, _d, _e, _f;
77372
77138
  return getBalanceNumber(new BigNumber$1((_a = userBill === null || userBill === void 0 ? void 0 : userBill.pendingRewards) !== null && _a !== void 0 ? _a : '0'), (_f = (_d = (_c = (_b = userBill === null || userBill === void 0 ? void 0 : userBill.bond) === null || _b === void 0 ? void 0 : _b.earnToken) === null || _c === void 0 ? void 0 : _c.decimals) === null || _d === void 0 ? void 0 : _d[(_e = userBill === null || userBill === void 0 ? void 0 : userBill.bond) === null || _e === void 0 ? void 0 : _e.chainId]) !== null && _f !== void 0 ? _f : 18);
@@ -85616,7 +85382,6 @@ const Estimations = ({ depositAmount, bondData, youSpendString, isZap, fetchingZ
85616
85382
  const estimatedOutputUSD = estimatedOutputAmount * parseFloat((_b = bondData === null || bondData === void 0 ? void 0 : bondData.payoutTokenPrice) !== null && _b !== void 0 ? _b : '0');
85617
85383
  const noTierAmount = getRawBonus$1(bondData, depositAmount, '0');
85618
85384
  const boostAmount = parseFloat(bonusString) - parseFloat(noTierAmount);
85619
- console.log(estimatedOutputAmount);
85620
85385
  return (jsxs(Flex, { className: "modaltable-container text-container", children: [jsxs(Flex, { className: "text-container row", children: [jsx$2(Flex, { className: "row-container spend", children: "You Spend:" }), jsx$2(Flex, { className: "row-container spend-val", children: youSpendString })] }), jsxs(Flex, { className: "text-container row", children: [jsxs(Flex, { className: "row-container premium", children: ["Bonus:", jsx$2(TooltipBubble, { className: "tooltip-bubble", body: jsx$2(Flex, { children: TooltipText.Premium }), width: "230px", placement: "bottomLeft", transformTip: "translate(-5%, 0%)", children: jsx$2(Flex, { className: "row-container premium-icon", children: jsx$2(Svg, { icon: "questionCircle", width: "12px" }) }) })] }), isZap && fetchingZapQuote ? (jsx$2(Dots, {})) : isZap && zapError ? ('-') : (jsxs(Flex, { className: `row-container premium-val ${getBonusColor(bonusString)}`, children: ["$ ", formatNumberSI(bonusString)] }))] }), (trueBondPrice === null || trueBondPrice === void 0 ? void 0 : trueBondPrice.points) !== '0' && userTier !== undefined && userPoints && SDKConfig.useTiers && (jsxs(Flex, { className: "text-container row", sx: {
85621
85386
  border: '1px solid var(--theme-ui-colors-primaryButton)',
85622
85387
  borderRadius: 'normal',
@@ -86722,8 +86487,22 @@ const styles$8 = {
86722
86487
  },
86723
86488
  };
86724
86489
 
86490
+ function formatUTCDate(date, short = false) {
86491
+ const pad = (num) => num.toString().padStart(2, '0');
86492
+ // Array of month abbreviations
86493
+ const monthAbbreviations = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];
86494
+ const year = date.getUTCFullYear();
86495
+ const month = monthAbbreviations[date.getUTCMonth()]; // Use the month array for abbreviation
86496
+ const day = pad(date.getUTCDate());
86497
+ const hours = pad(date.getUTCHours());
86498
+ const minutes = pad(date.getUTCMinutes());
86499
+ return short === true
86500
+ ? `${day}-${month}-${year.toString().substr(-2)}`
86501
+ : `${month} ${day}, ${year} ${hours}:${minutes}`;
86502
+ }
86503
+
86725
86504
  const BondCardsPreTGE = ({ bond }) => {
86726
- var _a, _b, _c, _d, _e, _f, _g;
86505
+ var _a, _b, _c, _d, _e, _f, _g, _h;
86727
86506
  const isMobile = useIsMobile();
86728
86507
  const bonus = (_b = (_a = bond === null || bond === void 0 ? void 0 : bond.trueBondPrices) === null || _a === void 0 ? void 0 : _a[0].bonus) !== null && _b !== void 0 ? _b : 0;
86729
86508
  const airdropBonus = (_c = bond.airdropBonus) !== null && _c !== void 0 ? _c : 0;
@@ -86770,7 +86549,7 @@ const BondCardsPreTGE = ({ bond }) => {
86770
86549
  borderBottomRightRadius: 'normal',
86771
86550
  borderBottomLeftRadius: 'normal',
86772
86551
  },
86773
- }, children: [jsxs("div", { className: "bond-card-title", children: ["Vesting Terms", initialRelease !== 100 && (jsx$2(TooltipBubble, { className: "tooltip-bubble", body: jsxs(Flex, { children: ["Remaining tokens will vest linearly over ", getTimePeriods((_e = bond === null || bond === void 0 ? void 0 : bond.vestingTerm) !== null && _e !== void 0 ? _e : 0).months, " months after claiming the initial release."] }), width: "230px", placement: "bottomLeft", transformTip: "translate(-5%, -5%)", children: jsx$2("div", { className: "bond-card-tooltip", children: jsx$2(Svg, { icon: "questionCircle", width: "12px" }) }) }))] }), initialRelease === 100 ? `0 D` : `${(_g = getTimePeriods((_f = bond === null || bond === void 0 ? void 0 : bond.vestingTerm) !== null && _f !== void 0 ? _f : 0)) === null || _g === void 0 ? void 0 : _g.months} Mo`] })] }));
86552
+ }, children: [jsxs("div", { className: "bond-card-title", children: ["Vesting Terms", initialRelease !== 100 && (jsx$2(TooltipBubble, { className: "tooltip-bubble", body: jsxs(Flex, { children: ["Remaining tokens will vest linearly over ", getTimePeriods((_e = bond === null || bond === void 0 ? void 0 : bond.vestingTerm) !== null && _e !== void 0 ? _e : 0).months, " months after", ' ', formatUTCDate(new Date(parseInt((_f = bond.startVestingTimestamp) !== null && _f !== void 0 ? _f : '0') * 1000)), " UTC."] }), width: "230px", placement: "bottomLeft", transformTip: "translate(-5%, -5%)", children: jsx$2("div", { className: "bond-card-tooltip", children: jsx$2(Svg, { icon: "questionCircle", width: "12px" }) }) }))] }), initialRelease === 100 ? `0 D` : `${(_h = getTimePeriods((_g = bond === null || bond === void 0 ? void 0 : bond.vestingTerm) !== null && _g !== void 0 ? _g : 0)) === null || _h === void 0 ? void 0 : _h.months} Mo`] })] }));
86774
86553
  };
86775
86554
 
86776
86555
  const BuyComponentPreTGE = ({ bondAddress, bondChain, onDismiss, handlePurchasedBond, }) => {
@@ -103213,20 +102992,6 @@ const styles$1 = {
103213
102992
  },
103214
102993
  };
103215
102994
 
103216
- function formatUTCDate(date, short = false) {
103217
- const pad = (num) => num.toString().padStart(2, '0');
103218
- // Array of month abbreviations
103219
- const monthAbbreviations = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];
103220
- const year = date.getUTCFullYear();
103221
- const month = monthAbbreviations[date.getUTCMonth()]; // Use the month array for abbreviation
103222
- const day = pad(date.getUTCDate());
103223
- const hours = pad(date.getUTCHours());
103224
- const minutes = pad(date.getUTCMinutes());
103225
- return short === true
103226
- ? `${day}-${month}-${year.toString().substr(-2)}`
103227
- : `${day} ${month} ${year} ${hours}:${minutes}`;
103228
- }
103229
-
103230
102995
  const TopSaleCard = ({ sale, position }) => {
103231
102996
  var _a, _b, _c, _d;
103232
102997
  const { address: account } = useEVMAccount();
@@ -103712,7 +103477,7 @@ function tryCreateCanvasRenderingTarget2D(binding, contextOptions) {
103712
103477
  * Copyright (c) 2024 TradingView, Inc.
103713
103478
  * Licensed under Apache License 2.0 https://www.apache.org/licenses/LICENSE-2.0
103714
103479
  */
103715
- const e={upColor:"#26a69a",downColor:"#ef5350",wickVisible:true,borderVisible:true,borderColor:"#378658",borderUpColor:"#26a69a",borderDownColor:"#ef5350",wickColor:"#737375",wickUpColor:"#26a69a",wickDownColor:"#ef5350"},r={upColor:"#26a69a",downColor:"#ef5350",openVisible:true,thinBars:true},h={color:"#2196f3",lineStyle:0,lineWidth:3,lineType:0,lineVisible:true,crosshairMarkerVisible:true,crosshairMarkerRadius:4,crosshairMarkerBorderColor:"",crosshairMarkerBorderWidth:2,crosshairMarkerBackgroundColor:"",lastPriceAnimation:0,pointMarkersVisible:false},l={topColor:"rgba( 46, 220, 135, 0.4)",bottomColor:"rgba( 40, 221, 100, 0)",invertFilledArea:false,lineColor:"#33D778",lineStyle:0,lineWidth:3,lineType:0,lineVisible:true,crosshairMarkerVisible:true,crosshairMarkerRadius:4,crosshairMarkerBorderColor:"",crosshairMarkerBorderWidth:2,crosshairMarkerBackgroundColor:"",lastPriceAnimation:0,pointMarkersVisible:false},a={baseValue:{type:"price",price:0},topFillColor1:"rgba(38, 166, 154, 0.28)",topFillColor2:"rgba(38, 166, 154, 0.05)",topLineColor:"rgba(38, 166, 154, 1)",bottomFillColor1:"rgba(239, 83, 80, 0.05)",bottomFillColor2:"rgba(239, 83, 80, 0.28)",bottomLineColor:"rgba(239, 83, 80, 1)",lineWidth:3,lineStyle:0,lineType:0,lineVisible:true,crosshairMarkerVisible:true,crosshairMarkerRadius:4,crosshairMarkerBorderColor:"",crosshairMarkerBorderWidth:2,crosshairMarkerBackgroundColor:"",lastPriceAnimation:0,pointMarkersVisible:false},o={color:"#26a69a",base:0},_={color:"#2196f3"},u={title:"",visible:true,lastValueVisible:true,priceLineVisible:true,priceLineSource:0,priceLineWidth:1,priceLineColor:"",priceLineStyle:2,baseLineVisible:true,baseLineWidth:1,baseLineColor:"#B2B5BE",baseLineStyle:0,priceFormat:{type:"price",precision:2,minMove:.01}};var c,d;function f(t,i){const n={0:[],1:[t.lineWidth,t.lineWidth],2:[2*t.lineWidth,2*t.lineWidth],3:[6*t.lineWidth,6*t.lineWidth],4:[t.lineWidth,4*t.lineWidth]}[i];t.setLineDash(n);}function v(t,i,n,s){t.beginPath();const e=t.lineWidth%2?.5:0;t.moveTo(n,i+e),t.lineTo(s,i+e),t.stroke();}function p(t,i){if(!t)throw new Error("Assertion failed"+(i?": "+i:""))}function m(t){if(void 0===t)throw new Error("Value is undefined");return t}function b(t){if(null===t)throw new Error("Value is null");return t}function w(t){return b(m(t))}!function(t){t[t.Simple=0]="Simple",t[t.WithSteps=1]="WithSteps",t[t.Curved=2]="Curved";}(c||(c={})),function(t){t[t.Solid=0]="Solid",t[t.Dotted=1]="Dotted",t[t.Dashed=2]="Dashed",t[t.LargeDashed=3]="LargeDashed",t[t.SparseDotted=4]="SparseDotted";}(d||(d={}));const g={khaki:"#f0e68c",azure:"#f0ffff",aliceblue:"#f0f8ff",ghostwhite:"#f8f8ff",gold:"#ffd700",goldenrod:"#daa520",gainsboro:"#dcdcdc",gray:"#808080",green:"#008000",honeydew:"#f0fff0",floralwhite:"#fffaf0",lightblue:"#add8e6",lightcoral:"#f08080",lemonchiffon:"#fffacd",hotpink:"#ff69b4",lightyellow:"#ffffe0",greenyellow:"#adff2f",lightgoldenrodyellow:"#fafad2",limegreen:"#32cd32",linen:"#faf0e6",lightcyan:"#e0ffff",magenta:"#f0f",maroon:"#800000",olive:"#808000",orange:"#ffa500",oldlace:"#fdf5e6",mediumblue:"#0000cd",transparent:"#0000",lime:"#0f0",lightpink:"#ffb6c1",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",midnightblue:"#191970",orchid:"#da70d6",mediumorchid:"#ba55d3",mediumturquoise:"#48d1cc",orangered:"#ff4500",royalblue:"#4169e1",powderblue:"#b0e0e6",red:"#f00",coral:"#ff7f50",turquoise:"#40e0d0",white:"#fff",whitesmoke:"#f5f5f5",wheat:"#f5deb3",teal:"#008080",steelblue:"#4682b4",bisque:"#ffe4c4",aquamarine:"#7fffd4",aqua:"#0ff",sienna:"#a0522d",silver:"#c0c0c0",springgreen:"#00ff7f",antiquewhite:"#faebd7",burlywood:"#deb887",brown:"#a52a2a",beige:"#f5f5dc",chocolate:"#d2691e",chartreuse:"#7fff00",cornflowerblue:"#6495ed",cornsilk:"#fff8dc",crimson:"#dc143c",cadetblue:"#5f9ea0",tomato:"#ff6347",fuchsia:"#f0f",blue:"#00f",salmon:"#fa8072",blanchedalmond:"#ffebcd",slateblue:"#6a5acd",slategray:"#708090",thistle:"#d8bfd8",tan:"#d2b48c",cyan:"#0ff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkgray:"#a9a9a9",blueviolet:"#8a2be2",black:"#000",darkmagenta:"#8b008b",darkslateblue:"#483d8b",darkkhaki:"#bdb76b",darkorchid:"#9932cc",darkorange:"#ff8c00",darkgreen:"#006400",darkred:"#8b0000",dodgerblue:"#1e90ff",darkslategray:"#2f4f4f",dimgray:"#696969",deepskyblue:"#00bfff",firebrick:"#b22222",forestgreen:"#228b22",indigo:"#4b0082",ivory:"#fffff0",lavenderblush:"#fff0f5",feldspar:"#d19275",indianred:"#cd5c5c",lightgreen:"#90ee90",lightgrey:"#d3d3d3",lightskyblue:"#87cefa",lightslategray:"#789",lightslateblue:"#8470ff",snow:"#fffafa",lightseagreen:"#20b2aa",lightsalmon:"#ffa07a",darksalmon:"#e9967a",darkviolet:"#9400d3",mediumpurple:"#9370d8",mediumaquamarine:"#66cdaa",skyblue:"#87ceeb",lavender:"#e6e6fa",lightsteelblue:"#b0c4de",mediumvioletred:"#c71585",mintcream:"#f5fffa",navajowhite:"#ffdead",navy:"#000080",olivedrab:"#6b8e23",palevioletred:"#d87093",violetred:"#d02090",yellow:"#ff0",yellowgreen:"#9acd32",lawngreen:"#7cfc00",pink:"#ffc0cb",paleturquoise:"#afeeee",palegoldenrod:"#eee8aa",darkolivegreen:"#556b2f",darkseagreen:"#8fbc8f",darkturquoise:"#00ced1",peachpuff:"#ffdab9",deeppink:"#ff1493",violet:"#ee82ee",palegreen:"#98fb98",mediumseagreen:"#3cb371",peru:"#cd853f",saddlebrown:"#8b4513",sandybrown:"#f4a460",rosybrown:"#bc8f8f",purple:"#800080",seagreen:"#2e8b57",seashell:"#fff5ee",papayawhip:"#ffefd5",mediumslateblue:"#7b68ee",plum:"#dda0dd",mediumspringgreen:"#00fa9a"};function M(t){return t<0?0:t>255?255:Math.round(t)||0}function x(t){return t<=0||t>1?Math.min(Math.max(t,0),1):Math.round(1e4*t)/1e4}const S=/^#([0-9a-f])([0-9a-f])([0-9a-f])([0-9a-f])?$/i,k=/^#([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})?$/i,y=/^rgb\(\s*(-?\d{1,10})\s*,\s*(-?\d{1,10})\s*,\s*(-?\d{1,10})\s*\)$/,C=/^rgba\(\s*(-?\d{1,10})\s*,\s*(-?\d{1,10})\s*,\s*(-?\d{1,10})\s*,\s*(-?\d*\.?\d+)\s*\)$/;function T(t){(t=t.toLowerCase())in g&&(t=g[t]);{const i=C.exec(t)||y.exec(t);if(i)return [M(parseInt(i[1],10)),M(parseInt(i[2],10)),M(parseInt(i[3],10)),x(i.length<5?1:parseFloat(i[4]))]}{const i=k.exec(t);if(i)return [M(parseInt(i[1],16)),M(parseInt(i[2],16)),M(parseInt(i[3],16)),1]}{const i=S.exec(t);if(i)return [M(17*parseInt(i[1],16)),M(17*parseInt(i[2],16)),M(17*parseInt(i[3],16)),1]}throw new Error(`Cannot parse color: ${t}`)}function P(t){const i=T(t);return {t:`rgb(${i[0]}, ${i[1]}, ${i[2]})`,i:(n=i,.199*n[0]+.687*n[1]+.114*n[2]>160?"black":"white")};var n;}class R{constructor(){this.h=[];}l(t,i,n){const s={o:t,_:i,u:true===n};this.h.push(s);}v(t){const i=this.h.findIndex((i=>t===i.o));i>-1&&this.h.splice(i,1);}p(t){this.h=this.h.filter((i=>i._!==t));}m(t,i,n){const s=[...this.h];this.h=this.h.filter((t=>!t.u)),s.forEach((s=>s.o(t,i,n)));}M(){return this.h.length>0}S(){this.h=[];}}function D(t,...i){for(const n of i)for(const i in n) void 0!==n[i]&&("object"!=typeof n[i]||void 0===t[i]||Array.isArray(n[i])?t[i]=n[i]:D(t[i],n[i]));return t}function O(t){return "number"==typeof t&&isFinite(t)}function A(t){return "number"==typeof t&&t%1==0}function B(t){return "string"==typeof t}function V(t){return "boolean"==typeof t}function I(t){const i=t;if(!i||"object"!=typeof i)return i;let n,s,e;for(s in n=Array.isArray(i)?[]:{},i)i.hasOwnProperty(s)&&(e=i[s],n[s]=e&&"object"==typeof e?I(e):e);return n}function z(t){return null!==t}function L(t){return null===t?void 0:t}const E="-apple-system, BlinkMacSystemFont, 'Trebuchet MS', Roboto, Ubuntu, sans-serif";function N(t,i,n){return void 0===i&&(i=E),`${n=void 0!==n?`${n} `:""}${t}px ${i}`}class F{constructor(t){this.k={C:1,T:5,P:NaN,R:"",D:"",O:"",A:"",B:0,V:0,I:0,L:0,N:0},this.F=t;}W(){const t=this.k,i=this.j(),n=this.H();return t.P===i&&t.D===n||(t.P=i,t.D=n,t.R=N(i,n),t.L=2.5/12*i,t.B=t.L,t.V=i/12*t.T,t.I=i/12*t.T,t.N=0),t.O=this.$(),t.A=this.U(),this.k}$(){return this.F.W().layout.textColor}U(){return this.F.q()}j(){return this.F.W().layout.fontSize}H(){return this.F.W().layout.fontFamily}}class W{constructor(){this.Y=[];}X(t){this.Y=t;}K(t,i,n){this.Y.forEach((s=>{s.K(t,i,n);}));}}class j{K(t,i,n){t.useBitmapCoordinateSpace((t=>this.Z(t,i,n)));}}class H extends j{constructor(){super(...arguments),this.G=null;}J(t){this.G=t;}Z({context:t,horizontalPixelRatio:i,verticalPixelRatio:n}){if(null===this.G||null===this.G.tt)return;const s=this.G.tt,e=this.G,r=Math.max(1,Math.floor(i))%2/2,h=h=>{t.beginPath();for(let l=s.to-1;l>=s.from;--l){const s=e.it[l],a=Math.round(s.nt*i)+r,o=s.st*n,_=h*n+r;t.moveTo(a,o),t.arc(a,o,_,0,2*Math.PI);}t.fill();};e.et>0&&(t.fillStyle=e.rt,h(e.ht+e.et)),t.fillStyle=e.lt,h(e.ht);}}function $(){return {it:[{nt:0,st:0,ot:0,_t:0}],lt:"",rt:"",ht:0,et:0,tt:null}}const U={from:0,to:1};class q{constructor(t,i){this.ut=new W,this.ct=[],this.dt=[],this.ft=true,this.F=t,this.vt=i,this.ut.X(this.ct);}bt(t){const i=this.F.wt();i.length!==this.ct.length&&(this.dt=i.map($),this.ct=this.dt.map((t=>{const i=new H;return i.J(t),i})),this.ut.X(this.ct)),this.ft=true;}gt(){return this.ft&&(this.Mt(),this.ft=false),this.ut}Mt(){const t=2===this.vt.W().mode,i=this.F.wt(),n=this.vt.xt(),s=this.F.St();i.forEach(((i,e)=>{var r;const h=this.dt[e],l=i.kt(n);if(t||null===l||!i.yt())return void(h.tt=null);const a=b(i.Ct());h.lt=l.Tt,h.ht=l.ht,h.et=l.Pt,h.it[0]._t=l._t,h.it[0].st=i.Dt().Rt(l._t,a.Ot),h.rt=null!==(r=l.At)&&void 0!==r?r:this.F.Bt(h.it[0].st/i.Dt().Vt()),h.it[0].ot=n,h.it[0].nt=s.It(n),h.tt=U;}));}}class Y extends j{constructor(t){super(),this.zt=t;}Z({context:t,bitmapSize:i,horizontalPixelRatio:n,verticalPixelRatio:s}){if(null===this.zt)return;const e=this.zt.Lt.yt,r=this.zt.Et.yt;if(!e&&!r)return;const h=Math.round(this.zt.nt*n),l=Math.round(this.zt.st*s);t.lineCap="butt",e&&h>=0&&(t.lineWidth=Math.floor(this.zt.Lt.et*n),t.strokeStyle=this.zt.Lt.O,t.fillStyle=this.zt.Lt.O,f(t,this.zt.Lt.Nt),function(t,i,n,s){t.beginPath();const e=t.lineWidth%2?.5:0;t.moveTo(i+e,n),t.lineTo(i+e,s),t.stroke();}(t,h,0,i.height)),r&&l>=0&&(t.lineWidth=Math.floor(this.zt.Et.et*s),t.strokeStyle=this.zt.Et.O,t.fillStyle=this.zt.Et.O,f(t,this.zt.Et.Nt),v(t,l,0,i.width));}}class X{constructor(t){this.ft=true,this.Ft={Lt:{et:1,Nt:0,O:"",yt:false},Et:{et:1,Nt:0,O:"",yt:false},nt:0,st:0},this.Wt=new Y(this.Ft),this.jt=t;}bt(){this.ft=true;}gt(){return this.ft&&(this.Mt(),this.ft=false),this.Wt}Mt(){const t=this.jt.yt(),i=b(this.jt.Ht()),n=i.$t().W().crosshair,s=this.Ft;if(2===n.mode)return s.Et.yt=false,void(s.Lt.yt=false);s.Et.yt=t&&this.jt.Ut(i),s.Lt.yt=t&&this.jt.qt(),s.Et.et=n.horzLine.width,s.Et.Nt=n.horzLine.style,s.Et.O=n.horzLine.color,s.Lt.et=n.vertLine.width,s.Lt.Nt=n.vertLine.style,s.Lt.O=n.vertLine.color,s.nt=this.jt.Yt(),s.st=this.jt.Xt();}}function K(t,i,n,s,e,r){t.fillRect(i+r,n,s-2*r,r),t.fillRect(i+r,n+e-r,s-2*r,r),t.fillRect(i,n,r,e),t.fillRect(i+s-r,n,r,e);}function Z(t,i,n,s,e,r){t.save(),t.globalCompositeOperation="copy",t.fillStyle=r,t.fillRect(i,n,s,e),t.restore();}function G(t,i,n,s,e,r){t.beginPath(),t.roundRect?t.roundRect(i,n,s,e,r):(t.lineTo(i+s-r[1],n),0!==r[1]&&t.arcTo(i+s,n,i+s,n+r[1],r[1]),t.lineTo(i+s,n+e-r[2]),0!==r[2]&&t.arcTo(i+s,n+e,i+s-r[2],n+e,r[2]),t.lineTo(i+r[3],n+e),0!==r[3]&&t.arcTo(i,n+e,i,n+e-r[3],r[3]),t.lineTo(i,n+r[0]),0!==r[0]&&t.arcTo(i,n,i+r[0],n,r[0]));}function J(t,i,n,s,e,r,h=0,l=[0,0,0,0],a=""){if(t.save(),!h||!a||a===r)return G(t,i,n,s,e,l),t.fillStyle=r,t.fill(),void t.restore();const o=h/2;var _;G(t,i+o,n+o,s-h,e-h,(_=-o,l.map((t=>0===t?t:t+_)))),"transparent"!==r&&(t.fillStyle=r,t.fill()),"transparent"!==a&&(t.lineWidth=h,t.strokeStyle=a,t.closePath(),t.stroke()),t.restore();}function Q(t,i,n,s,e,r,h){t.save(),t.globalCompositeOperation="copy";const l=t.createLinearGradient(0,0,0,e);l.addColorStop(0,r),l.addColorStop(1,h),t.fillStyle=l,t.fillRect(i,n,s,e),t.restore();}class tt{constructor(t,i){this.J(t,i);}J(t,i){this.zt=t,this.Kt=i;}Vt(t,i){return this.zt.yt?t.P+t.L+t.B:0}K(t,i,n,s){if(!this.zt.yt||0===this.zt.Zt.length)return;const e=this.zt.O,r=this.Kt.t,h=t.useBitmapCoordinateSpace((t=>{const h=t.context;h.font=i.R;const l=this.Gt(t,i,n,s),a=l.Jt,o=(t,i)=>{l.Qt?J(h,a.ti,a.ii,a.ni,a.si,t,a.ei,[a.ht,0,0,a.ht],i):J(h,a.ri,a.ii,a.ni,a.si,t,a.ei,[0,a.ht,a.ht,0],i);};return o(r,"transparent"),this.zt.hi&&(h.fillStyle=e,h.fillRect(a.ri,a.li,a.ai-a.ri,a.oi)),o("transparent",r),this.zt._i&&(h.fillStyle=i.A,h.fillRect(l.Qt?a.ui-a.ei:0,a.ii,a.ei,a.ci-a.ii)),l}));t.useMediaCoordinateSpace((({context:t})=>{const n=h.di;t.font=i.R,t.textAlign=h.Qt?"right":"left",t.textBaseline="middle",t.fillStyle=e,t.fillText(this.zt.Zt,n.fi,(n.ii+n.ci)/2+n.pi);}));}Gt(t,i,n,s){var e;const{context:r,bitmapSize:h,mediaSize:l,horizontalPixelRatio:a,verticalPixelRatio:o}=t,_=this.zt.hi||!this.zt.mi?i.T:0,u=this.zt.bi?i.C:0,c=i.L+this.Kt.wi,d=i.B+this.Kt.gi,f=i.V,v=i.I,p=this.zt.Zt,m=i.P,b=n.Mi(r,p),w=Math.ceil(n.xi(r,p)),g=m+c+d,M=i.C+f+v+w+_,x=Math.max(1,Math.floor(o));let S=Math.round(g*o);S%2!=x%2&&(S+=1);const k=u>0?Math.max(1,Math.floor(u*a)):0,y=Math.round(M*a),C=Math.round(_*a),T=null!==(e=this.Kt.Si)&&void 0!==e?e:this.Kt.ki,P=Math.round(T*o)-Math.floor(.5*o),R=Math.floor(P+x/2-S/2),D=R+S,O="right"===s,A=O?l.width-u:u,B=O?h.width-k:k;let V,I,z;return O?(V=B-y,I=B-C,z=A-_-f-u):(V=B+y,I=B+C,z=A+_+f),{Qt:O,Jt:{ii:R,li:P,ci:D,ni:y,si:S,ht:2*a,ei:k,ti:V,ri:B,ai:I,oi:x,ui:h.width},di:{ii:R/o,ci:D/o,fi:z,pi:b}}}}class it{constructor(t){this.yi={ki:0,t:"#000",gi:0,wi:0},this.Ci={Zt:"",yt:false,hi:true,mi:false,At:"",O:"#FFF",_i:false,bi:false},this.Ti={Zt:"",yt:false,hi:false,mi:true,At:"",O:"#FFF",_i:true,bi:true},this.ft=true,this.Pi=new(t||tt)(this.Ci,this.yi),this.Ri=new(t||tt)(this.Ti,this.yi);}Zt(){return this.Di(),this.Ci.Zt}ki(){return this.Di(),this.yi.ki}bt(){this.ft=true;}Vt(t,i=false){return Math.max(this.Pi.Vt(t,i),this.Ri.Vt(t,i))}Oi(){return this.yi.Si||0}Ai(t){this.yi.Si=t;}Bi(){return this.Di(),this.Ci.yt||this.Ti.yt}Vi(){return this.Di(),this.Ci.yt}gt(t){return this.Di(),this.Ci.hi=this.Ci.hi&&t.W().ticksVisible,this.Ti.hi=this.Ti.hi&&t.W().ticksVisible,this.Pi.J(this.Ci,this.yi),this.Ri.J(this.Ti,this.yi),this.Pi}Ii(){return this.Di(),this.Pi.J(this.Ci,this.yi),this.Ri.J(this.Ti,this.yi),this.Ri}Di(){this.ft&&(this.Ci.hi=true,this.Ti.hi=false,this.zi(this.Ci,this.Ti,this.yi));}}class nt extends it{constructor(t,i,n){super(),this.jt=t,this.Li=i,this.Ei=n;}zi(t,i,n){if(t.yt=false,2===this.jt.W().mode)return;const s=this.jt.W().horzLine;if(!s.labelVisible)return;const e=this.Li.Ct();if(!this.jt.yt()||this.Li.Ni()||null===e)return;const r=P(s.labelBackgroundColor);n.t=r.t,t.O=r.i;const h=2/12*this.Li.P();n.wi=h,n.gi=h;const l=this.Ei(this.Li);n.ki=l.ki,t.Zt=this.Li.Fi(l._t,e),t.yt=true;}}const st=/[1-9]/g;class et{constructor(){this.zt=null;}J(t){this.zt=t;}K(t,i){if(null===this.zt||false===this.zt.yt||0===this.zt.Zt.length)return;const n=t.useMediaCoordinateSpace((({context:t})=>(t.font=i.R,Math.round(i.Wi.xi(t,b(this.zt).Zt,st)))));if(n<=0)return;const s=i.ji,e=n+2*s,r=e/2,h=this.zt.Hi;let l=this.zt.ki,a=Math.floor(l-r)+.5;a<0?(l+=Math.abs(0-a),a=Math.floor(l-r)+.5):a+e>h&&(l-=Math.abs(h-(a+e)),a=Math.floor(l-r)+.5);const o=a+e,_=Math.ceil(0+i.C+i.T+i.L+i.P+i.B);t.useBitmapCoordinateSpace((({context:t,horizontalPixelRatio:n,verticalPixelRatio:s})=>{const e=b(this.zt);t.fillStyle=e.t;const r=Math.round(a*n),h=Math.round(0*s),l=Math.round(o*n),u=Math.round(_*s),c=Math.round(2*n);if(t.beginPath(),t.moveTo(r,h),t.lineTo(r,u-c),t.arcTo(r,u,r+c,u,c),t.lineTo(l-c,u),t.arcTo(l,u,l,u-c,c),t.lineTo(l,h),t.fill(),e.hi){const r=Math.round(e.ki*n),l=h,a=Math.round((l+i.T)*s);t.fillStyle=e.O;const o=Math.max(1,Math.floor(n)),_=Math.floor(.5*n);t.fillRect(r-_,l,o,a-l);}})),t.useMediaCoordinateSpace((({context:t})=>{const n=b(this.zt),e=0+i.C+i.T+i.L+i.P/2;t.font=i.R,t.textAlign="left",t.textBaseline="middle",t.fillStyle=n.O;const r=i.Wi.Mi(t,"Apr0");t.translate(a+s,e+r),t.fillText(n.Zt,0,0);}));}}class rt{constructor(t,i,n){this.ft=true,this.Wt=new et,this.Ft={yt:false,t:"#4c525e",O:"white",Zt:"",Hi:0,ki:NaN,hi:true},this.vt=t,this.$i=i,this.Ei=n;}bt(){this.ft=true;}gt(){return this.ft&&(this.Mt(),this.ft=false),this.Wt.J(this.Ft),this.Wt}Mt(){const t=this.Ft;if(t.yt=false,2===this.vt.W().mode)return;const i=this.vt.W().vertLine;if(!i.labelVisible)return;const n=this.$i.St();if(n.Ni())return;t.Hi=n.Hi();const s=this.Ei();if(null===s)return;t.ki=s.ki;const e=n.Ui(this.vt.xt());t.Zt=n.qi(b(e)),t.yt=true;const r=P(i.labelBackgroundColor);t.t=r.t,t.O=r.i,t.hi=n.W().ticksVisible;}}class ht{constructor(){this.Yi=null,this.Xi=0;}Ki(){return this.Xi}Zi(t){this.Xi=t;}Dt(){return this.Yi}Gi(t){this.Yi=t;}Ji(t){return []}Qi(){return []}yt(){return true}}var lt;!function(t){t[t.Normal=0]="Normal",t[t.Magnet=1]="Magnet",t[t.Hidden=2]="Hidden";}(lt||(lt={}));class at extends ht{constructor(t,i){super(),this.tn=null,this.nn=NaN,this.sn=0,this.en=true,this.rn=new Map,this.hn=false,this.ln=NaN,this.an=NaN,this._n=NaN,this.un=NaN,this.$i=t,this.cn=i,this.dn=new q(t,this);this.fn=((t,i)=>n=>{const s=i(),e=t();if(n===b(this.tn).vn())return {_t:e,ki:s};{const t=b(n.Ct());return {_t:n.pn(s,t),ki:s}}})((()=>this.nn),(()=>this.an));const n=((t,i)=>()=>{const n=this.$i.St().mn(t()),s=i();return n&&Number.isFinite(s)?{ot:n,ki:s}:null})((()=>this.sn),(()=>this.Yt()));this.bn=new rt(this,t,n),this.wn=new X(this);}W(){return this.cn}gn(t,i){this._n=t,this.un=i;}Mn(){this._n=NaN,this.un=NaN;}xn(){return this._n}Sn(){return this.un}kn(t,i,n){this.hn||(this.hn=true),this.en=true,this.yn(t,i,n);}xt(){return this.sn}Yt(){return this.ln}Xt(){return this.an}yt(){return this.en}Cn(){this.en=false,this.Tn(),this.nn=NaN,this.ln=NaN,this.an=NaN,this.tn=null,this.Mn();}Pn(t){return null!==this.tn?[this.wn,this.dn]:[]}Ut(t){return t===this.tn&&this.cn.horzLine.visible}qt(){return this.cn.vertLine.visible}Rn(t,i){this.en&&this.tn===t||this.rn.clear();const n=[];return this.tn===t&&n.push(this.Dn(this.rn,i,this.fn)),n}Qi(){return this.en?[this.bn]:[]}Ht(){return this.tn}On(){this.wn.bt(),this.rn.forEach((t=>t.bt())),this.bn.bt(),this.dn.bt();}An(t){return t&&!t.vn().Ni()?t.vn():null}yn(t,i,n){this.Bn(t,i,n)&&this.On();}Bn(t,i,n){const s=this.ln,e=this.an,r=this.nn,h=this.sn,l=this.tn,a=this.An(n);this.sn=t,this.ln=isNaN(t)?NaN:this.$i.St().It(t),this.tn=n;const o=null!==a?a.Ct():null;return null!==a&&null!==o?(this.nn=i,this.an=a.Rt(i,o)):(this.nn=NaN,this.an=NaN),s!==this.ln||e!==this.an||h!==this.sn||r!==this.nn||l!==this.tn}Tn(){const t=this.$i.wt().map((t=>t.In().Vn())).filter(z),i=0===t.length?null:Math.max(...t);this.sn=null!==i?i:NaN;}Dn(t,i,n){let s=t.get(i);return void 0===s&&(s=new nt(this,i,n),t.set(i,s)),s}}function ot(t){return "left"===t||"right"===t}class _t{constructor(t){this.zn=new Map,this.Ln=[],this.En=t;}Nn(t,i){const n=function(t,i){return void 0===t?i:{Fn:Math.max(t.Fn,i.Fn),Wn:t.Wn||i.Wn}}(this.zn.get(t),i);this.zn.set(t,n);}jn(){return this.En}Hn(t){const i=this.zn.get(t);return void 0===i?{Fn:this.En}:{Fn:Math.max(this.En,i.Fn),Wn:i.Wn}}$n(){this.Un(),this.Ln=[{qn:0}];}Yn(t){this.Un(),this.Ln=[{qn:1,Ot:t}];}Xn(t){this.Kn(),this.Ln.push({qn:5,Ot:t});}Un(){this.Kn(),this.Ln.push({qn:6});}Zn(){this.Un(),this.Ln=[{qn:4}];}Gn(t){this.Un(),this.Ln.push({qn:2,Ot:t});}Jn(t){this.Un(),this.Ln.push({qn:3,Ot:t});}Qn(){return this.Ln}ts(t){for(const i of t.Ln)this.ns(i);this.En=Math.max(this.En,t.En),t.zn.forEach(((t,i)=>{this.Nn(i,t);}));}static ss(){return new _t(2)}static es(){return new _t(3)}ns(t){switch(t.qn){case 0:this.$n();break;case 1:this.Yn(t.Ot);break;case 2:this.Gn(t.Ot);break;case 3:this.Jn(t.Ot);break;case 4:this.Zn();break;case 5:this.Xn(t.Ot);break;case 6:this.Kn();}}Kn(){const t=this.Ln.findIndex((t=>5===t.qn));-1!==t&&this.Ln.splice(t,1);}}const ut=".";function ct(t,i){if(!O(t))return "n/a";if(!A(i))throw new TypeError("invalid length");if(i<0||i>16)throw new TypeError("invalid length");if(0===i)return t.toString();return ("0000000000000000"+t.toString()).slice(-i)}class dt{constructor(t,i){if(i||(i=1),O(t)&&A(t)||(t=100),t<0)throw new TypeError("invalid base");this.Li=t,this.rs=i,this.hs();}format(t){const i=t<0?"−":"";return t=Math.abs(t),i+this.ls(t)}hs(){if(this.os=0,this.Li>0&&this.rs>0){let t=this.Li;for(;t>1;)t/=10,this.os++;}}ls(t){const i=this.Li/this.rs;let n=Math.floor(t),s="";const e=void 0!==this.os?this.os:NaN;if(i>1){let r=+(Math.round(t*i)-n*i).toFixed(this.os);r>=i&&(r-=i,n+=1),s=ut+ct(+r.toFixed(this.os)*this.rs,e);}else n=Math.round(n*i)/i,e>0&&(s=ut+ct(0,e));return n.toFixed(0)+s}}class ft extends dt{constructor(t=100){super(t);}format(t){return `${super.format(t)}%`}}class vt{constructor(t){this._s=t;}format(t){let i="";return t<0&&(i="-",t=-t),t<995?i+this.us(t):t<999995?i+this.us(t/1e3)+"K":t<999999995?(t=1e3*Math.round(t/1e3),i+this.us(t/1e6)+"M"):(t=1e6*Math.round(t/1e6),i+this.us(t/1e9)+"B")}us(t){let i;const n=Math.pow(10,this._s);return i=(t=Math.round(t*n)/n)>=1e-15&&t<1?t.toFixed(this._s).replace(/\.?0+$/,""):String(t),i.replace(/(\.[1-9]*)0+$/,((t,i)=>i))}}function pt(t,i,n,s,e,r,h){if(0===i.length||s.from>=i.length||s.to<=0)return;const{context:l,horizontalPixelRatio:a,verticalPixelRatio:o}=t,_=i[s.from];let u=r(t,_),c=_;if(s.to-s.from<2){const i=e/2;l.beginPath();const n={nt:_.nt-i,st:_.st},s={nt:_.nt+i,st:_.st};l.moveTo(n.nt*a,n.st*o),l.lineTo(s.nt*a,s.st*o),h(t,u,n,s);}else {const e=(i,n)=>{h(t,u,c,n),l.beginPath(),u=i,c=n;};let d=c;l.beginPath(),l.moveTo(_.nt*a,_.st*o);for(let h=s.from+1;h<s.to;++h){d=i[h];const s=r(t,d);switch(n){case 0:l.lineTo(d.nt*a,d.st*o);break;case 1:l.lineTo(d.nt*a,i[h-1].st*o),s!==u&&(e(s,d),l.lineTo(d.nt*a,i[h-1].st*o)),l.lineTo(d.nt*a,d.st*o);break;case 2:{const[t,n]=gt(i,h-1,h);l.bezierCurveTo(t.nt*a,t.st*o,n.nt*a,n.st*o,d.nt*a,d.st*o);break}}1!==n&&s!==u&&(e(s,d),l.moveTo(d.nt*a,d.st*o));}(c!==d||c===d&&1===n)&&h(t,u,c,d);}}const mt=6;function bt(t,i){return {nt:t.nt-i.nt,st:t.st-i.st}}function wt(t,i){return {nt:t.nt/i,st:t.st/i}}function gt(t,i,n){const s=Math.max(0,i-1),e=Math.min(t.length-1,n+1);var r,h;return [(r=t[i],h=wt(bt(t[n],t[s]),mt),{nt:r.nt+h.nt,st:r.st+h.st}),bt(t[n],wt(bt(t[e],t[i]),mt))]}function Mt(t,i,n,s,e){const{context:r,horizontalPixelRatio:h,verticalPixelRatio:l}=i;r.lineTo(e.nt*h,t*l),r.lineTo(s.nt*h,t*l),r.closePath(),r.fillStyle=n,r.fill();}class xt extends j{constructor(){super(...arguments),this.G=null;}J(t){this.G=t;}Z(t){var i;if(null===this.G)return;const{it:n,tt:s,cs:e,et:r,Nt:h,ds:l}=this.G,a=null!==(i=this.G.fs)&&void 0!==i?i:this.G.vs?0:t.mediaSize.height;if(null===s)return;const o=t.context;o.lineCap="butt",o.lineJoin="round",o.lineWidth=r,f(o,h),o.lineWidth=1,pt(t,n,l,s,e,this.ps.bind(this),Mt.bind(null,a));}}function St(t,i,n){return Math.min(Math.max(t,i),n)}function kt(t,i,n){return i-t<=n}function yt(t){const i=Math.ceil(t);return i%2==0?i-1:i}class Ct{bs(t,i){const n=this.ws,{gs:s,Ms:e,xs:r,Ss:h,ks:l,fs:a}=i;if(void 0===this.ys||void 0===n||n.gs!==s||n.Ms!==e||n.xs!==r||n.Ss!==h||n.fs!==a||n.ks!==l){const n=t.context.createLinearGradient(0,0,0,l);if(n.addColorStop(0,s),null!=a){const i=St(a*t.verticalPixelRatio/l,0,1);n.addColorStop(i,e),n.addColorStop(i,r);}n.addColorStop(1,h),this.ys=n,this.ws=i;}return this.ys}}class Tt extends xt{constructor(){super(...arguments),this.Cs=new Ct;}ps(t,i){return this.Cs.bs(t,{gs:i.Ts,Ms:"",xs:"",Ss:i.Ps,ks:t.bitmapSize.height})}}function Pt(t,i){const n=t.context;n.strokeStyle=i,n.stroke();}class Rt extends j{constructor(){super(...arguments),this.G=null;}J(t){this.G=t;}Z(t){if(null===this.G)return;const{it:i,tt:n,cs:s,ds:e,et:r,Nt:h,Rs:l}=this.G;if(null===n)return;const a=t.context;a.lineCap="butt",a.lineWidth=r*t.verticalPixelRatio,f(a,h),a.lineJoin="round";const o=this.Ds.bind(this);void 0!==e&&pt(t,i,e,n,s,o,Pt),l&&function(t,i,n,s,e){const{horizontalPixelRatio:r,verticalPixelRatio:h,context:l}=t;let a=null;const o=Math.max(1,Math.floor(r))%2/2,_=n*h+o;for(let n=s.to-1;n>=s.from;--n){const s=i[n];if(s){const i=e(t,s);i!==a&&(l.beginPath(),null!==a&&l.fill(),l.fillStyle=i,a=i);const n=Math.round(s.nt*r)+o,u=s.st*h;l.moveTo(n,u),l.arc(n,u,_,0,2*Math.PI);}}l.fill();}(t,i,l,n,o);}}class Dt extends Rt{Ds(t,i){return i.lt}}function Ot(t,i,n,s,e=0,r=i.length){let h=r-e;for(;0<h;){const r=h>>1,l=e+r;s(i[l],n)===t?(e=l+1,h-=r+1):h=r;}return e}const At=Ot.bind(null,true),Bt=Ot.bind(null,false);function Vt(t,i){return t.ot<i}function It(t,i){return i<t.ot}function zt(t,i,n){const s=i.Os(),e=i.ui(),r=At(t,s,Vt),h=Bt(t,e,It);if(!n)return {from:r,to:h};let l=r,a=h;return r>0&&r<t.length&&t[r].ot>=s&&(l=r-1),h>0&&h<t.length&&t[h-1].ot<=e&&(a=h+1),{from:l,to:a}}class Lt{constructor(t,i,n){this.As=true,this.Bs=true,this.Vs=true,this.Is=[],this.zs=null,this.Ls=t,this.Es=i,this.Ns=n;}bt(t){this.As=true,"data"===t&&(this.Bs=true),"options"===t&&(this.Vs=true);}gt(){return this.Ls.yt()?(this.Fs(),null===this.zs?null:this.Ws):null}js(){this.Is=this.Is.map((t=>Object.assign(Object.assign({},t),this.Ls.$s().Hs(t.ot))));}Us(){this.zs=null;}Fs(){this.Bs&&(this.qs(),this.Bs=false),this.Vs&&(this.js(),this.Vs=false),this.As&&(this.Ys(),this.As=false);}Ys(){const t=this.Ls.Dt(),i=this.Es.St();if(this.Us(),i.Ni()||t.Ni())return;const n=i.Xs();if(null===n)return;if(0===this.Ls.In().Ks())return;const s=this.Ls.Ct();null!==s&&(this.zs=zt(this.Is,n,this.Ns),this.Zs(t,i,s.Ot),this.Gs());}}class Et extends Lt{constructor(t,i){super(t,i,true);}Zs(t,i,n){i.Js(this.Is,L(this.zs)),t.Qs(this.Is,n,L(this.zs));}te(t,i){return {ot:t,_t:i,nt:NaN,st:NaN}}qs(){const t=this.Ls.$s();this.Is=this.Ls.In().ie().map((i=>{const n=i.Ot[3];return this.ne(i.se,n,t)}));}}class Nt extends Et{constructor(t,i){super(t,i),this.Ws=new W,this.ee=new Tt,this.re=new Dt,this.Ws.X([this.ee,this.re]);}ne(t,i,n){return Object.assign(Object.assign({},this.te(t,i)),n.Hs(t))}Gs(){const t=this.Ls.W();this.ee.J({ds:t.lineType,it:this.Is,Nt:t.lineStyle,et:t.lineWidth,fs:null,vs:t.invertFilledArea,tt:this.zs,cs:this.Es.St().he()}),this.re.J({ds:t.lineVisible?t.lineType:void 0,it:this.Is,Nt:t.lineStyle,et:t.lineWidth,tt:this.zs,cs:this.Es.St().he(),Rs:t.pointMarkersVisible?t.pointMarkersRadius||t.lineWidth/2+2:void 0});}}class Ft extends j{constructor(){super(...arguments),this.zt=null,this.le=0,this.ae=0;}J(t){this.zt=t;}Z({context:t,horizontalPixelRatio:i,verticalPixelRatio:n}){if(null===this.zt||0===this.zt.In.length||null===this.zt.tt)return;if(this.le=this.oe(i),this.le>=2){Math.max(1,Math.floor(i))%2!=this.le%2&&this.le--;}this.ae=this.zt._e?Math.min(this.le,Math.floor(i)):this.le;let s=null;const e=this.ae<=this.le&&this.zt.he>=Math.floor(1.5*i);for(let r=this.zt.tt.from;r<this.zt.tt.to;++r){const h=this.zt.In[r];s!==h.ue&&(t.fillStyle=h.ue,s=h.ue);const l=Math.floor(.5*this.ae),a=Math.round(h.nt*i),o=a-l,_=this.ae,u=o+_-1,c=Math.min(h.ce,h.de),d=Math.max(h.ce,h.de),f=Math.round(c*n)-l,v=Math.round(d*n)+l,p=Math.max(v-f,this.ae);t.fillRect(o,f,_,p);const m=Math.ceil(1.5*this.le);if(e){if(this.zt.fe){const i=a-m;let s=Math.max(f,Math.round(h.ve*n)-l),e=s+_-1;e>f+p-1&&(e=f+p-1,s=e-_+1),t.fillRect(i,s,o-i,e-s+1);}const i=a+m;let s=Math.max(f,Math.round(h.pe*n)-l),e=s+_-1;e>f+p-1&&(e=f+p-1,s=e-_+1),t.fillRect(u+1,s,i-u,e-s+1);}}}oe(t){const i=Math.floor(t);return Math.max(i,Math.floor(function(t,i){return Math.floor(.3*t*i)}(b(this.zt).he,t)))}}class Wt extends Lt{constructor(t,i){super(t,i,false);}Zs(t,i,n){i.Js(this.Is,L(this.zs)),t.me(this.Is,n,L(this.zs));}be(t,i,n){return {ot:t,we:i.Ot[0],ge:i.Ot[1],Me:i.Ot[2],xe:i.Ot[3],nt:NaN,ve:NaN,ce:NaN,de:NaN,pe:NaN}}qs(){const t=this.Ls.$s();this.Is=this.Ls.In().ie().map((i=>this.ne(i.se,i,t)));}}class jt extends Wt{constructor(){super(...arguments),this.Ws=new Ft;}ne(t,i,n){return Object.assign(Object.assign({},this.be(t,i,n)),n.Hs(t))}Gs(){const t=this.Ls.W();this.Ws.J({In:this.Is,he:this.Es.St().he(),fe:t.openVisible,_e:t.thinBars,tt:this.zs});}}class Ht extends xt{constructor(){super(...arguments),this.Cs=new Ct;}ps(t,i){const n=this.G;return this.Cs.bs(t,{gs:i.Se,Ms:i.ke,xs:i.ye,Ss:i.Ce,ks:t.bitmapSize.height,fs:n.fs})}}class $t extends Rt{constructor(){super(...arguments),this.Te=new Ct;}Ds(t,i){const n=this.G;return this.Te.bs(t,{gs:i.Pe,Ms:i.Pe,xs:i.Re,Ss:i.Re,ks:t.bitmapSize.height,fs:n.fs})}}class Ut extends Et{constructor(t,i){super(t,i),this.Ws=new W,this.De=new Ht,this.Oe=new $t,this.Ws.X([this.De,this.Oe]);}ne(t,i,n){return Object.assign(Object.assign({},this.te(t,i)),n.Hs(t))}Gs(){const t=this.Ls.Ct();if(null===t)return;const i=this.Ls.W(),n=this.Ls.Dt().Rt(i.baseValue.price,t.Ot),s=this.Es.St().he();this.De.J({it:this.Is,et:i.lineWidth,Nt:i.lineStyle,ds:i.lineType,fs:n,vs:false,tt:this.zs,cs:s}),this.Oe.J({it:this.Is,et:i.lineWidth,Nt:i.lineStyle,ds:i.lineVisible?i.lineType:void 0,Rs:i.pointMarkersVisible?i.pointMarkersRadius||i.lineWidth/2+2:void 0,fs:n,tt:this.zs,cs:s});}}class qt extends j{constructor(){super(...arguments),this.zt=null,this.le=0;}J(t){this.zt=t;}Z(t){if(null===this.zt||0===this.zt.In.length||null===this.zt.tt)return;const{horizontalPixelRatio:i}=t;if(this.le=function(t,i){if(t>=2.5&&t<=4)return Math.floor(3*i);const n=1-.2*Math.atan(Math.max(4,t)-4)/(.5*Math.PI),s=Math.floor(t*n*i),e=Math.floor(t*i),r=Math.min(s,e);return Math.max(Math.floor(i),r)}(this.zt.he,i),this.le>=2){Math.floor(i)%2!=this.le%2&&this.le--;}const n=this.zt.In;this.zt.Ae&&this.Be(t,n,this.zt.tt),this.zt._i&&this.Ve(t,n,this.zt.tt);const s=this.Ie(i);(!this.zt._i||this.le>2*s)&&this.ze(t,n,this.zt.tt);}Be(t,i,n){if(null===this.zt)return;const{context:s,horizontalPixelRatio:e,verticalPixelRatio:r}=t;let h="",l=Math.min(Math.floor(e),Math.floor(this.zt.he*e));l=Math.max(Math.floor(e),Math.min(l,this.le));const a=Math.floor(.5*l);let o=null;for(let t=n.from;t<n.to;t++){const n=i[t];n.Le!==h&&(s.fillStyle=n.Le,h=n.Le);const _=Math.round(Math.min(n.ve,n.pe)*r),u=Math.round(Math.max(n.ve,n.pe)*r),c=Math.round(n.ce*r),d=Math.round(n.de*r);let f=Math.round(e*n.nt)-a;const v=f+l-1;null!==o&&(f=Math.max(o+1,f),f=Math.min(f,v));const p=v-f+1;s.fillRect(f,c,p,_-c),s.fillRect(f,u+1,p,d-u),o=v;}}Ie(t){let i=Math.floor(1*t);this.le<=2*i&&(i=Math.floor(.5*(this.le-1)));const n=Math.max(Math.floor(t),i);return this.le<=2*n?Math.max(Math.floor(t),Math.floor(1*t)):n}Ve(t,i,n){if(null===this.zt)return;const{context:s,horizontalPixelRatio:e,verticalPixelRatio:r}=t;let h="";const l=this.Ie(e);let a=null;for(let t=n.from;t<n.to;t++){const n=i[t];n.Ee!==h&&(s.fillStyle=n.Ee,h=n.Ee);let o=Math.round(n.nt*e)-Math.floor(.5*this.le);const _=o+this.le-1,u=Math.round(Math.min(n.ve,n.pe)*r),c=Math.round(Math.max(n.ve,n.pe)*r);if(null!==a&&(o=Math.max(a+1,o),o=Math.min(o,_)),this.zt.he*e>2*l)K(s,o,u,_-o+1,c-u+1,l);else {const t=_-o+1;s.fillRect(o,u,t,c-u+1);}a=_;}}ze(t,i,n){if(null===this.zt)return;const{context:s,horizontalPixelRatio:e,verticalPixelRatio:r}=t;let h="";const l=this.Ie(e);for(let t=n.from;t<n.to;t++){const n=i[t];let a=Math.round(Math.min(n.ve,n.pe)*r),o=Math.round(Math.max(n.ve,n.pe)*r),_=Math.round(n.nt*e)-Math.floor(.5*this.le),u=_+this.le-1;if(n.ue!==h){const t=n.ue;s.fillStyle=t,h=t;}this.zt._i&&(_+=l,a+=l,u-=l,o-=l),a>o||s.fillRect(_,a,u-_+1,o-a+1);}}}class Yt extends Wt{constructor(){super(...arguments),this.Ws=new qt;}ne(t,i,n){return Object.assign(Object.assign({},this.be(t,i,n)),n.Hs(t))}Gs(){const t=this.Ls.W();this.Ws.J({In:this.Is,he:this.Es.St().he(),Ae:t.wickVisible,_i:t.borderVisible,tt:this.zs});}}class Xt{constructor(t,i){this.Ne=t,this.Li=i;}K(t,i,n){this.Ne.draw(t,this.Li,i,n);}}class Kt extends Lt{constructor(t,i,n){super(t,i,false),this.wn=n,this.Ws=new Xt(this.wn.renderer(),(i=>{const n=t.Ct();return null===n?null:t.Dt().Rt(i,n.Ot)}));}Fe(t){return this.wn.priceValueBuilder(t)}We(t){return this.wn.isWhitespace(t)}qs(){const t=this.Ls.$s();this.Is=this.Ls.In().ie().map((i=>Object.assign(Object.assign({ot:i.se,nt:NaN},t.Hs(i.se)),{je:i.He})));}Zs(t,i){i.Js(this.Is,L(this.zs));}Gs(){this.wn.update({bars:this.Is.map(Zt),barSpacing:this.Es.St().he(),visibleRange:this.zs},this.Ls.W());}}function Zt(t){return {x:t.nt,time:t.ot,originalData:t.je,barColor:t.ue}}class Gt extends j{constructor(){super(...arguments),this.zt=null,this.$e=[];}J(t){this.zt=t,this.$e=[];}Z({context:t,horizontalPixelRatio:i,verticalPixelRatio:n}){if(null===this.zt||0===this.zt.it.length||null===this.zt.tt)return;this.$e.length||this.Ue(i);const s=Math.max(1,Math.floor(n)),e=Math.round(this.zt.qe*n)-Math.floor(s/2),r=e+s;for(let i=this.zt.tt.from;i<this.zt.tt.to;i++){const h=this.zt.it[i],l=this.$e[i-this.zt.tt.from],a=Math.round(h.st*n);let o,_;t.fillStyle=h.ue,a<=e?(o=a,_=r):(o=e,_=a-Math.floor(s/2)+s),t.fillRect(l.Os,o,l.ui-l.Os+1,_-o);}}Ue(t){if(null===this.zt||0===this.zt.it.length||null===this.zt.tt)return void(this.$e=[]);const i=Math.ceil(this.zt.he*t)<=1?0:Math.max(1,Math.floor(t)),n=Math.round(this.zt.he*t)-i;this.$e=new Array(this.zt.tt.to-this.zt.tt.from);for(let i=this.zt.tt.from;i<this.zt.tt.to;i++){const s=this.zt.it[i],e=Math.round(s.nt*t);let r,h;if(n%2){const t=(n-1)/2;r=e-t,h=e+t;}else {const t=n/2;r=e-t,h=e+t-1;}this.$e[i-this.zt.tt.from]={Os:r,ui:h,Ye:e,Xe:s.nt*t,ot:s.ot};}for(let t=this.zt.tt.from+1;t<this.zt.tt.to;t++){const n=this.$e[t-this.zt.tt.from],s=this.$e[t-this.zt.tt.from-1];n.ot===s.ot+1&&(n.Os-s.ui!==i+1&&(s.Ye>s.Xe?s.ui=n.Os-i-1:n.Os=s.ui+i+1));}let s=Math.ceil(this.zt.he*t);for(let t=this.zt.tt.from;t<this.zt.tt.to;t++){const i=this.$e[t-this.zt.tt.from];i.ui<i.Os&&(i.ui=i.Os);const n=i.ui-i.Os+1;s=Math.min(n,s);}if(i>0&&s<4)for(let t=this.zt.tt.from;t<this.zt.tt.to;t++){const i=this.$e[t-this.zt.tt.from];i.ui-i.Os+1>s&&(i.Ye>i.Xe?i.ui-=1:i.Os+=1);}}}class Jt extends Et{constructor(){super(...arguments),this.Ws=new Gt;}ne(t,i,n){return Object.assign(Object.assign({},this.te(t,i)),n.Hs(t))}Gs(){const t={it:this.Is,he:this.Es.St().he(),tt:this.zs,qe:this.Ls.Dt().Rt(this.Ls.W().base,b(this.Ls.Ct()).Ot)};this.Ws.J(t);}}class Qt extends Et{constructor(){super(...arguments),this.Ws=new Dt;}ne(t,i,n){return Object.assign(Object.assign({},this.te(t,i)),n.Hs(t))}Gs(){const t=this.Ls.W(),i={it:this.Is,Nt:t.lineStyle,ds:t.lineVisible?t.lineType:void 0,et:t.lineWidth,Rs:t.pointMarkersVisible?t.pointMarkersRadius||t.lineWidth/2+2:void 0,tt:this.zs,cs:this.Es.St().he()};this.Ws.J(i);}}const ti=/[2-9]/g;class ii{constructor(t=50){this.Ke=0,this.Ze=1,this.Ge=1,this.Je={},this.Qe=new Map,this.tr=t;}ir(){this.Ke=0,this.Qe.clear(),this.Ze=1,this.Ge=1,this.Je={};}xi(t,i,n){return this.nr(t,i,n).width}Mi(t,i,n){const s=this.nr(t,i,n);return ((s.actualBoundingBoxAscent||0)-(s.actualBoundingBoxDescent||0))/2}nr(t,i,n){const s=n||ti,e=String(i).replace(s,"0");if(this.Qe.has(e))return m(this.Qe.get(e)).sr;if(this.Ke===this.tr){const t=this.Je[this.Ge];delete this.Je[this.Ge],this.Qe.delete(t),this.Ge++,this.Ke--;}t.save(),t.textBaseline="middle";const r=t.measureText(e);return t.restore(),0===r.width&&i.length||(this.Qe.set(e,{sr:r,er:this.Ze}),this.Je[this.Ze]=e,this.Ke++,this.Ze++),r}}class ni{constructor(t){this.rr=null,this.k=null,this.hr="right",this.lr=t;}ar(t,i,n){this.rr=t,this.k=i,this.hr=n;}K(t){null!==this.k&&null!==this.rr&&this.rr.K(t,this.k,this.lr,this.hr);}}class si{constructor(t,i,n){this._r=t,this.lr=new ii(50),this.ur=i,this.F=n,this.j=-1,this.Wt=new ni(this.lr);}gt(){const t=this.F.cr(this.ur);if(null===t)return null;const i=t.dr(this.ur)?t.vr():this.ur.Dt();if(null===i)return null;const n=t.pr(i);if("overlay"===n)return null;const s=this.F.mr();return s.P!==this.j&&(this.j=s.P,this.lr.ir()),this.Wt.ar(this._r.Ii(),s,n),this.Wt}}class ei extends j{constructor(){super(...arguments),this.zt=null;}J(t){this.zt=t;}br(t,i){var n;if(!(null===(n=this.zt)||void 0===n?void 0:n.yt))return null;const{st:s,et:e,wr:r}=this.zt;return i>=s-e-7&&i<=s+e+7?{gr:this.zt,wr:r}:null}Z({context:t,bitmapSize:i,horizontalPixelRatio:n,verticalPixelRatio:s}){if(null===this.zt)return;if(false===this.zt.yt)return;const e=Math.round(this.zt.st*s);e<0||e>i.height||(t.lineCap="butt",t.strokeStyle=this.zt.O,t.lineWidth=Math.floor(this.zt.et*n),f(t,this.zt.Nt),v(t,e,0,i.width));}}class ri{constructor(t){this.Mr={st:0,O:"rgba(0, 0, 0, 0)",et:1,Nt:0,yt:false},this.Sr=new ei,this.ft=true,this.Ls=t,this.Es=t.$t(),this.Sr.J(this.Mr);}bt(){this.ft=true;}gt(){return this.Ls.yt()?(this.ft&&(this.kr(),this.ft=false),this.Sr):null}}class hi extends ri{constructor(t){super(t);}kr(){this.Mr.yt=false;const t=this.Ls.Dt(),i=t.yr().yr;if(2!==i&&3!==i)return;const n=this.Ls.W();if(!n.baseLineVisible||!this.Ls.yt())return;const s=this.Ls.Ct();null!==s&&(this.Mr.yt=true,this.Mr.st=t.Rt(s.Ot,s.Ot),this.Mr.O=n.baseLineColor,this.Mr.et=n.baseLineWidth,this.Mr.Nt=n.baseLineStyle);}}class li extends j{constructor(){super(...arguments),this.zt=null;}J(t){this.zt=t;}He(){return this.zt}Z({context:t,horizontalPixelRatio:i,verticalPixelRatio:n}){const s=this.zt;if(null===s)return;const e=Math.max(1,Math.floor(i)),r=e%2/2,h=Math.round(s.Xe.x*i)+r,l=s.Xe.y*n;t.fillStyle=s.Cr,t.beginPath();const a=Math.max(2,1.5*s.Tr)*i;t.arc(h,l,a,0,2*Math.PI,false),t.fill(),t.fillStyle=s.Pr,t.beginPath(),t.arc(h,l,s.ht*i,0,2*Math.PI,false),t.fill(),t.lineWidth=e,t.strokeStyle=s.Rr,t.beginPath(),t.arc(h,l,s.ht*i+e/2,0,2*Math.PI,false),t.stroke();}}const ai=[{Dr:0,Or:.25,Ar:4,Br:10,Vr:.25,Ir:0,zr:.4,Lr:.8},{Dr:.25,Or:.525,Ar:10,Br:14,Vr:0,Ir:0,zr:.8,Lr:0},{Dr:.525,Or:1,Ar:14,Br:14,Vr:0,Ir:0,zr:0,Lr:0}];function oi(t,i,n,s){return function(t,i){if("transparent"===t)return t;const n=T(t),s=n[3];return `rgba(${n[0]}, ${n[1]}, ${n[2]}, ${i*s})`}(t,n+(s-n)*i)}function _i(t,i){const n=t%2600/2600;let s;for(const t of ai)if(n>=t.Dr&&n<=t.Or){s=t;break}p(void 0!==s,"Last price animation internal logic error");const e=(n-s.Dr)/(s.Or-s.Dr);return {Pr:oi(i,e,s.Vr,s.Ir),Rr:oi(i,e,s.zr,s.Lr),ht:(r=e,h=s.Ar,l=s.Br,h+(l-h)*r)};var r,h,l;}class ui{constructor(t){this.Wt=new li,this.ft=true,this.Er=true,this.Nr=performance.now(),this.Fr=this.Nr-1,this.Wr=t;}jr(){this.Fr=this.Nr-1,this.bt();}Hr(){if(this.bt(),2===this.Wr.W().lastPriceAnimation){const t=performance.now(),i=this.Fr-t;if(i>0)return void(i<650&&(this.Fr+=2600));this.Nr=t,this.Fr=t+2600;}}bt(){this.ft=true;}$r(){this.Er=true;}yt(){return 0!==this.Wr.W().lastPriceAnimation}Ur(){switch(this.Wr.W().lastPriceAnimation){case 0:return false;case 1:return true;case 2:return performance.now()<=this.Fr}}gt(){return this.ft?(this.Mt(),this.ft=false,this.Er=false):this.Er&&(this.qr(),this.Er=false),this.Wt}Mt(){this.Wt.J(null);const t=this.Wr.$t().St(),i=t.Xs(),n=this.Wr.Ct();if(null===i||null===n)return;const s=this.Wr.Yr(true);if(s.Xr||!i.Kr(s.se))return;const e={x:t.It(s.se),y:this.Wr.Dt().Rt(s._t,n.Ot)},r=s.O,h=this.Wr.W().lineWidth,l=_i(this.Zr(),r);this.Wt.J({Cr:r,Tr:h,Pr:l.Pr,Rr:l.Rr,ht:l.ht,Xe:e});}qr(){const t=this.Wt.He();if(null!==t){const i=_i(this.Zr(),t.Cr);t.Pr=i.Pr,t.Rr=i.Rr,t.ht=i.ht;}}Zr(){return this.Ur()?performance.now()-this.Nr:2599}}function ci(t,i){return yt(Math.min(Math.max(t,12),30)*i)}function di(t,i){switch(t){case "arrowDown":case "arrowUp":return ci(i,1);case "circle":return ci(i,.8);case "square":return ci(i,.7)}}function fi(t){return function(t){const i=Math.ceil(t);return i%2!=0?i-1:i}(ci(t,1))}function vi$1(t){return Math.max(ci(t,.1),3)}function pi(t,i,n){return i?t:n?Math.ceil(t/2):0}function mi(t,i,n,s,e){const r=di("square",n),h=(r-1)/2,l=t-h,a=i-h;return s>=l&&s<=l+r&&e>=a&&e<=a+r}function bi(t,i,n,s){const e=(di("arrowUp",s)-1)/2*n.Gr,r=(yt(s/2)-1)/2*n.Gr;i.beginPath(),t?(i.moveTo(n.nt-e,n.st),i.lineTo(n.nt,n.st-e),i.lineTo(n.nt+e,n.st),i.lineTo(n.nt+r,n.st),i.lineTo(n.nt+r,n.st+e),i.lineTo(n.nt-r,n.st+e),i.lineTo(n.nt-r,n.st)):(i.moveTo(n.nt-e,n.st),i.lineTo(n.nt,n.st+e),i.lineTo(n.nt+e,n.st),i.lineTo(n.nt+r,n.st),i.lineTo(n.nt+r,n.st-e),i.lineTo(n.nt-r,n.st-e),i.lineTo(n.nt-r,n.st)),i.fill();}function wi(t,i,n,s,e,r){return mi(i,n,s,e,r)}class gi extends j{constructor(){super(...arguments),this.zt=null,this.lr=new ii,this.j=-1,this.H="",this.Jr="";}J(t){this.zt=t;}ar(t,i){this.j===t&&this.H===i||(this.j=t,this.H=i,this.Jr=N(t,i),this.lr.ir());}br(t,i){if(null===this.zt||null===this.zt.tt)return null;for(let n=this.zt.tt.from;n<this.zt.tt.to;n++){const s=this.zt.it[n];if(xi(s,t,i))return {gr:s.Qr,wr:s.wr}}return null}Z({context:t,horizontalPixelRatio:i,verticalPixelRatio:n},s,e){if(null!==this.zt&&null!==this.zt.tt){t.textBaseline="middle",t.font=this.Jr;for(let s=this.zt.tt.from;s<this.zt.tt.to;s++){const e=this.zt.it[s];void 0!==e.Zt&&(e.Zt.Hi=this.lr.xi(t,e.Zt.th),e.Zt.Vt=this.j,e.Zt.nt=e.nt-e.Zt.Hi/2),Mi(e,t,i,n);}}}}function Mi(t,i,n,s){i.fillStyle=t.O,void 0!==t.Zt&&function(t,i,n,s,e,r){t.save(),t.scale(e,r),t.fillText(i,n,s),t.restore();}(i,t.Zt.th,t.Zt.nt,t.Zt.st,n,s),function(t,i,n){if(0===t.Ks)return;switch(t.ih){case "arrowDown":return void bi(false,i,n,t.Ks);case "arrowUp":return void bi(true,i,n,t.Ks);case "circle":return void function(t,i,n){const s=(di("circle",n)-1)/2;t.beginPath(),t.arc(i.nt,i.st,s*i.Gr,0,2*Math.PI,false),t.fill();}(i,n,t.Ks);case "square":return void function(t,i,n){const s=di("square",n),e=(s-1)*i.Gr/2,r=i.nt-e,h=i.st-e;t.fillRect(r,h,s*i.Gr,s*i.Gr);}(i,n,t.Ks)}t.ih;}(t,i,function(t,i,n){const s=Math.max(1,Math.floor(i))%2/2;return {nt:Math.round(t.nt*i)+s,st:t.st*n,Gr:i}}(t,n,s));}function xi(t,i,n){return !(void 0===t.Zt||!function(t,i,n,s,e,r){const h=s/2;return e>=t&&e<=t+n&&r>=i-h&&r<=i+h}(t.Zt.nt,t.Zt.st,t.Zt.Hi,t.Zt.Vt,i,n))||function(t,i,n){if(0===t.Ks)return false;switch(t.ih){case "arrowDown":case "arrowUp":return wi(0,t.nt,t.st,t.Ks,i,n);case "circle":return function(t,i,n,s,e){const r=2+di("circle",n)/2,h=t-s,l=i-e;return Math.sqrt(h*h+l*l)<=r}(t.nt,t.st,t.Ks,i,n);case "square":return mi(t.nt,t.st,t.Ks,i,n)}}(t,i,n)}function Si(t,i,n,s,e,r,h,l,a){const o=O(n)?n:n.xe,_=O(n)?n:n.ge,u=O(n)?n:n.Me,c=O(i.size)?Math.max(i.size,0):1,d=fi(l.he())*c,f=d/2;switch(t.Ks=d,i.position){case "inBar":return t.st=h.Rt(o,a),void(void 0!==t.Zt&&(t.Zt.st=t.st+f+r+.6*e));case "aboveBar":return t.st=h.Rt(_,a)-f-s.nh,void 0!==t.Zt&&(t.Zt.st=t.st-f-.6*e,s.nh+=1.2*e),void(s.nh+=d+r);case "belowBar":return t.st=h.Rt(u,a)+f+s.sh,void 0!==t.Zt&&(t.Zt.st=t.st+f+r+.6*e,s.sh+=1.2*e),void(s.sh+=d+r)}i.position;}class ki{constructor(t,i){this.ft=true,this.eh=true,this.rh=true,this.hh=null,this.ah=null,this.Wt=new gi,this.Wr=t,this.$i=i,this.zt={it:[],tt:null};}bt(t){this.ft=true,this.rh=true,"data"===t&&(this.eh=true,this.ah=null);}gt(t){if(!this.Wr.yt())return null;this.ft&&this.oh();const i=this.$i.W().layout;return this.Wt.ar(i.fontSize,i.fontFamily),this.Wt.J(this.zt),this.Wt}_h(){if(this.rh){if(this.Wr.uh().length>0){const t=this.$i.St().he(),i=vi$1(t),n=1.5*fi(t)+2*i,s=this.dh();this.hh={above:pi(n,s.aboveBar,s.inBar),below:pi(n,s.belowBar,s.inBar)};}else this.hh=null;this.rh=false;}return this.hh}dh(){return null===this.ah&&(this.ah=this.Wr.uh().reduce(((t,i)=>(t[i.position]||(t[i.position]=true),t)),{inBar:false,aboveBar:false,belowBar:false})),this.ah}oh(){const t=this.Wr.Dt(),i=this.$i.St(),n=this.Wr.uh();this.eh&&(this.zt.it=n.map((t=>({ot:t.time,nt:0,st:0,Ks:0,ih:t.shape,O:t.color,Qr:t.Qr,wr:t.id,Zt:void 0}))),this.eh=false);const s=this.$i.W().layout;this.zt.tt=null;const e=i.Xs();if(null===e)return;const r=this.Wr.Ct();if(null===r)return;if(0===this.zt.it.length)return;let h=NaN;const l=vi$1(i.he()),a={nh:l,sh:l};this.zt.tt=zt(this.zt.it,e,true);for(let e=this.zt.tt.from;e<this.zt.tt.to;e++){const o=n[e];o.time!==h&&(a.nh=l,a.sh=l,h=o.time);const _=this.zt.it[e];_.nt=i.It(o.time),void 0!==o.text&&o.text.length>0&&(_.Zt={th:o.text,nt:0,st:0,Hi:0,Vt:0});const u=this.Wr.fh(o.time);null!==u&&Si(_,o,u,a,s.fontSize,l,t,i,r.Ot);}this.ft=false;}}class yi extends ri{constructor(t){super(t);}kr(){const t=this.Mr;t.yt=false;const i=this.Ls.W();if(!i.priceLineVisible||!this.Ls.yt())return;const n=this.Ls.Yr(0===i.priceLineSource);n.Xr||(t.yt=true,t.st=n.ki,t.O=this.Ls.ph(n.O),t.et=i.priceLineWidth,t.Nt=i.priceLineStyle);}}class Ci extends it{constructor(t){super(),this.jt=t;}zi(t,i,n){t.yt=false,i.yt=false;const s=this.jt;if(!s.yt())return;const e=s.W(),r=e.lastValueVisible,h=""!==s.mh(),l=0===e.seriesLastValueMode,a=s.Yr(false);if(a.Xr)return;r&&(t.Zt=this.bh(a,r,l),t.yt=0!==t.Zt.length),(h||l)&&(i.Zt=this.wh(a,r,h,l),i.yt=i.Zt.length>0);const o=s.ph(a.O),_=P(o);n.t=_.t,n.ki=a.ki,i.At=s.$t().Bt(a.ki/s.Dt().Vt()),t.At=o,t.O=_.i,i.O=_.i;}wh(t,i,n,s){let e="";const r=this.jt.mh();return n&&0!==r.length&&(e+=`${r} `),i&&s&&(e+=this.jt.Dt().gh()?t.Mh:t.xh),e.trim()}bh(t,i,n){return i?n?this.jt.Dt().gh()?t.xh:t.Mh:t.Zt:""}}function Ti(t,i,n,s){const e=Number.isFinite(i),r=Number.isFinite(n);return e&&r?t(i,n):e||r?e?i:n:s}class Pi{constructor(t,i){this.Sh=t,this.kh=i;}yh(t){return null!==t&&(this.Sh===t.Sh&&this.kh===t.kh)}Ch(){return new Pi(this.Sh,this.kh)}Th(){return this.Sh}Ph(){return this.kh}Rh(){return this.kh-this.Sh}Ni(){return this.kh===this.Sh||Number.isNaN(this.kh)||Number.isNaN(this.Sh)}ts(t){return null===t?this:new Pi(Ti(Math.min,this.Th(),t.Th(),-1/0),Ti(Math.max,this.Ph(),t.Ph(),1/0))}Dh(t){if(!O(t))return;if(0===this.kh-this.Sh)return;const i=.5*(this.kh+this.Sh);let n=this.kh-i,s=this.Sh-i;n*=t,s*=t,this.kh=i+n,this.Sh=i+s;}Oh(t){O(t)&&(this.kh+=t,this.Sh+=t);}Ah(){return {minValue:this.Sh,maxValue:this.kh}}static Bh(t){return null===t?null:new Pi(t.minValue,t.maxValue)}}class Ri{constructor(t,i){this.Vh=t,this.Ih=i||null;}zh(){return this.Vh}Lh(){return this.Ih}Ah(){return null===this.Vh?null:{priceRange:this.Vh.Ah(),margins:this.Ih||void 0}}static Bh(t){return null===t?null:new Ri(Pi.Bh(t.priceRange),t.margins)}}class Di extends ri{constructor(t,i){super(t),this.Eh=i;}kr(){const t=this.Mr;t.yt=false;const i=this.Eh.W();if(!this.Ls.yt()||!i.lineVisible)return;const n=this.Eh.Nh();null!==n&&(t.yt=true,t.st=n,t.O=i.color,t.et=i.lineWidth,t.Nt=i.lineStyle,t.wr=this.Eh.W().id);}}class Oi extends it{constructor(t,i){super(),this.Wr=t,this.Eh=i;}zi(t,i,n){t.yt=false,i.yt=false;const s=this.Eh.W(),e=s.axisLabelVisible,r=""!==s.title,h=this.Wr;if(!e||!h.yt())return;const l=this.Eh.Nh();if(null===l)return;r&&(i.Zt=s.title,i.yt=true),i.At=h.$t().Bt(l/h.Dt().Vt()),t.Zt=this.Fh(s.price),t.yt=true;const a=P(s.axisLabelColor||s.color);n.t=a.t;const o=s.axisLabelTextColor||a.i;t.O=o,i.O=o,n.ki=l;}Fh(t){const i=this.Wr.Ct();return null===i?"":this.Wr.Dt().Fi(t,i.Ot)}}class Ai{constructor(t,i){this.Wr=t,this.cn=i,this.Wh=new Di(t,this),this._r=new Oi(t,this),this.jh=new si(this._r,t,t.$t());}Hh(t){D(this.cn,t),this.bt(),this.Wr.$t().$h();}W(){return this.cn}Uh(){return this.Wh}qh(){return this.jh}Yh(){return this._r}bt(){this.Wh.bt(),this._r.bt();}Nh(){const t=this.Wr,i=t.Dt();if(t.$t().St().Ni()||i.Ni())return null;const n=t.Ct();return null===n?null:i.Rt(this.cn.price,n.Ot)}}class Bi extends ht{constructor(t){super(),this.$i=t;}$t(){return this.$i}}const Vi={Bar:(t,i,n,s)=>{var e;const r=i.upColor,h=i.downColor,l=b(t(n,s)),a=w(l.Ot[0])<=w(l.Ot[3]);return {ue:null!==(e=l.O)&&void 0!==e?e:a?r:h}},Candlestick:(t,i,n,s)=>{var e,r,h;const l=i.upColor,a=i.downColor,o=i.borderUpColor,_=i.borderDownColor,u=i.wickUpColor,c=i.wickDownColor,d=b(t(n,s)),f=w(d.Ot[0])<=w(d.Ot[3]);return {ue:null!==(e=d.O)&&void 0!==e?e:f?l:a,Ee:null!==(r=d.At)&&void 0!==r?r:f?o:_,Le:null!==(h=d.Xh)&&void 0!==h?h:f?u:c}},Custom:(t,i,n,s)=>{var e;return {ue:null!==(e=b(t(n,s)).O)&&void 0!==e?e:i.color}},Area:(t,i,n,s)=>{var e,r,h,l;const a=b(t(n,s));return {ue:null!==(e=a.lt)&&void 0!==e?e:i.lineColor,lt:null!==(r=a.lt)&&void 0!==r?r:i.lineColor,Ts:null!==(h=a.Ts)&&void 0!==h?h:i.topColor,Ps:null!==(l=a.Ps)&&void 0!==l?l:i.bottomColor}},Baseline:(t,i,n,s)=>{var e,r,h,l,a,o;const _=b(t(n,s));return {ue:_.Ot[3]>=i.baseValue.price?i.topLineColor:i.bottomLineColor,Pe:null!==(e=_.Pe)&&void 0!==e?e:i.topLineColor,Re:null!==(r=_.Re)&&void 0!==r?r:i.bottomLineColor,Se:null!==(h=_.Se)&&void 0!==h?h:i.topFillColor1,ke:null!==(l=_.ke)&&void 0!==l?l:i.topFillColor2,ye:null!==(a=_.ye)&&void 0!==a?a:i.bottomFillColor1,Ce:null!==(o=_.Ce)&&void 0!==o?o:i.bottomFillColor2}},Line:(t,i,n,s)=>{var e,r;const h=b(t(n,s));return {ue:null!==(e=h.O)&&void 0!==e?e:i.color,lt:null!==(r=h.O)&&void 0!==r?r:i.color}},Histogram:(t,i,n,s)=>{var e;return {ue:null!==(e=b(t(n,s)).O)&&void 0!==e?e:i.color}}};class Ii{constructor(t){this.Kh=(t,i)=>void 0!==i?i.Ot:this.Wr.In().Zh(t),this.Wr=t,this.Gh=Vi[t.Jh()];}Hs(t,i){return this.Gh(this.Kh,this.Wr.W(),t,i)}}var zi;!function(t){t[t.NearestLeft=-1]="NearestLeft",t[t.None=0]="None",t[t.NearestRight=1]="NearestRight";}(zi||(zi={}));const Li=30;class Ei{constructor(){this.Qh=[],this.tl=new Map,this.il=new Map;}nl(){return this.Ks()>0?this.Qh[this.Qh.length-1]:null}sl(){return this.Ks()>0?this.el(0):null}Vn(){return this.Ks()>0?this.el(this.Qh.length-1):null}Ks(){return this.Qh.length}Ni(){return 0===this.Ks()}Kr(t){return null!==this.rl(t,0)}Zh(t){return this.hl(t)}hl(t,i=0){const n=this.rl(t,i);return null===n?null:Object.assign(Object.assign({},this.ll(n)),{se:this.el(n)})}ie(){return this.Qh}al(t,i,n){if(this.Ni())return null;let s=null;for(const e of n){s=Ni(s,this.ol(t,i,e));}return s}J(t){this.il.clear(),this.tl.clear(),this.Qh=t;}el(t){return this.Qh[t].se}ll(t){return this.Qh[t]}rl(t,i){const n=this._l(t);if(null===n&&0!==i)switch(i){case -1:return this.ul(t);case 1:return this.cl(t);default:throw new TypeError("Unknown search mode")}return n}ul(t){let i=this.dl(t);return i>0&&(i-=1),i!==this.Qh.length&&this.el(i)<t?i:null}cl(t){const i=this.fl(t);return i!==this.Qh.length&&t<this.el(i)?i:null}_l(t){const i=this.dl(t);return i===this.Qh.length||t<this.Qh[i].se?null:i}dl(t){return At(this.Qh,t,((t,i)=>t.se<i))}fl(t){return Bt(this.Qh,t,((t,i)=>t.se>i))}vl(t,i,n){let s=null;for(let e=t;e<i;e++){const t=this.Qh[e].Ot[n];Number.isNaN(t)||(null===s?s={pl:t,ml:t}:(t<s.pl&&(s.pl=t),t>s.ml&&(s.ml=t)));}return s}ol(t,i,n){if(this.Ni())return null;let s=null;const e=b(this.sl()),r=b(this.Vn()),h=Math.max(t,e),l=Math.min(i,r),a=Math.ceil(h/Li)*Li,o=Math.max(a,Math.floor(l/Li)*Li);{const t=this.dl(h),e=this.fl(Math.min(l,a,i));s=Ni(s,this.vl(t,e,n));}let _=this.tl.get(n);void 0===_&&(_=new Map,this.tl.set(n,_));for(let t=Math.max(a+1,h);t<o;t+=Li){const i=Math.floor(t/Li);let e=_.get(i);if(void 0===e){const t=this.dl(i*Li),s=this.fl((i+1)*Li-1);e=this.vl(t,s,n),_.set(i,e);}s=Ni(s,e);}{const t=this.dl(o),i=this.fl(l);s=Ni(s,this.vl(t,i,n));}return s}}function Ni(t,i){if(null===t)return i;if(null===i)return t;return {pl:Math.min(t.pl,i.pl),ml:Math.max(t.ml,i.ml)}}class Fi{constructor(t){this.bl=t;}K(t,i,n){this.bl.draw(t);}wl(t,i,n){var s,e;null===(e=(s=this.bl).drawBackground)||void 0===e||e.call(s,t);}}class Wi{constructor(t){this.Qe=null,this.wn=t;}gt(){var t;const i=this.wn.renderer();if(null===i)return null;if((null===(t=this.Qe)||void 0===t?void 0:t.gl)===i)return this.Qe.Ml;const n=new Fi(i);return this.Qe={gl:i,Ml:n},n}xl(){var t,i,n;return null!==(n=null===(i=(t=this.wn).zOrder)||void 0===i?void 0:i.call(t))&&void 0!==n?n:"normal"}}function ji(t){var i,n,s,e,r;return {Zt:t.text(),ki:t.coordinate(),Si:null===(i=t.fixedCoordinate)||void 0===i?void 0:i.call(t),O:t.textColor(),t:t.backColor(),yt:null===(s=null===(n=t.visible)||void 0===n?void 0:n.call(t))||void 0===s||s,hi:null===(r=null===(e=t.tickVisible)||void 0===e?void 0:e.call(t))||void 0===r||r}}class Hi{constructor(t,i){this.Wt=new et,this.Sl=t,this.kl=i;}gt(){return this.Wt.J(Object.assign({Hi:this.kl.Hi()},ji(this.Sl))),this.Wt}}class $i extends it{constructor(t,i){super(),this.Sl=t,this.Li=i;}zi(t,i,n){const s=ji(this.Sl);n.t=s.t,t.O=s.O;const e=2/12*this.Li.P();n.wi=e,n.gi=e,n.ki=s.ki,n.Si=s.Si,t.Zt=s.Zt,t.yt=s.yt,t.hi=s.hi;}}class Ui{constructor(t,i){this.yl=null,this.Cl=null,this.Tl=null,this.Pl=null,this.Rl=null,this.Dl=t,this.Wr=i;}Ol(){return this.Dl}On(){var t,i;null===(i=(t=this.Dl).updateAllViews)||void 0===i||i.call(t);}Pn(){var t,i,n,s;const e=null!==(n=null===(i=(t=this.Dl).paneViews)||void 0===i?void 0:i.call(t))&&void 0!==n?n:[];if((null===(s=this.yl)||void 0===s?void 0:s.gl)===e)return this.yl.Ml;const r=e.map((t=>new Wi(t)));return this.yl={gl:e,Ml:r},r}Qi(){var t,i,n,s;const e=null!==(n=null===(i=(t=this.Dl).timeAxisViews)||void 0===i?void 0:i.call(t))&&void 0!==n?n:[];if((null===(s=this.Cl)||void 0===s?void 0:s.gl)===e)return this.Cl.Ml;const r=this.Wr.$t().St(),h=e.map((t=>new Hi(t,r)));return this.Cl={gl:e,Ml:h},h}Rn(){var t,i,n,s;const e=null!==(n=null===(i=(t=this.Dl).priceAxisViews)||void 0===i?void 0:i.call(t))&&void 0!==n?n:[];if((null===(s=this.Tl)||void 0===s?void 0:s.gl)===e)return this.Tl.Ml;const r=this.Wr.Dt(),h=e.map((t=>new $i(t,r)));return this.Tl={gl:e,Ml:h},h}Al(){var t,i,n,s;const e=null!==(n=null===(i=(t=this.Dl).priceAxisPaneViews)||void 0===i?void 0:i.call(t))&&void 0!==n?n:[];if((null===(s=this.Pl)||void 0===s?void 0:s.gl)===e)return this.Pl.Ml;const r=e.map((t=>new Wi(t)));return this.Pl={gl:e,Ml:r},r}Bl(){var t,i,n,s;const e=null!==(n=null===(i=(t=this.Dl).timeAxisPaneViews)||void 0===i?void 0:i.call(t))&&void 0!==n?n:[];if((null===(s=this.Rl)||void 0===s?void 0:s.gl)===e)return this.Rl.Ml;const r=e.map((t=>new Wi(t)));return this.Rl={gl:e,Ml:r},r}Vl(t,i){var n,s,e;return null!==(e=null===(s=(n=this.Dl).autoscaleInfo)||void 0===s?void 0:s.call(n,t,i))&&void 0!==e?e:null}br(t,i){var n,s,e;return null!==(e=null===(s=(n=this.Dl).hitTest)||void 0===s?void 0:s.call(n,t,i))&&void 0!==e?e:null}}function qi(t,i,n,s){t.forEach((t=>{i(t).forEach((t=>{t.xl()===n&&s.push(t);}));}));}function Yi(t){return t.Pn()}function Xi(t){return t.Al()}function Ki(t){return t.Bl()}class Zi extends Bi{constructor(t,i,n,s,e){super(t),this.zt=new Ei,this.Wh=new yi(this),this.Il=[],this.zl=new hi(this),this.Ll=null,this.El=null,this.Nl=[],this.Fl=[],this.Wl=null,this.jl=[],this.cn=i,this.Hl=n;const r=new Ci(this);this.rn=[r],this.jh=new si(r,this,t),"Area"!==n&&"Line"!==n&&"Baseline"!==n||(this.Ll=new ui(this)),this.$l(),this.Ul(e);}S(){null!==this.Wl&&clearTimeout(this.Wl);}ph(t){return this.cn.priceLineColor||t}Yr(t){const i={Xr:true},n=this.Dt();if(this.$t().St().Ni()||n.Ni()||this.zt.Ni())return i;const s=this.$t().St().Xs(),e=this.Ct();if(null===s||null===e)return i;let r,h;if(t){const t=this.zt.nl();if(null===t)return i;r=t,h=t.se;}else {const t=this.zt.hl(s.ui(),-1);if(null===t)return i;if(r=this.zt.Zh(t.se),null===r)return i;h=t.se;}const l=r.Ot[3],a=this.$s().Hs(h,{Ot:r}),o=n.Rt(l,e.Ot);return {Xr:false,_t:l,Zt:n.Fi(l,e.Ot),Mh:n.ql(l),xh:n.Yl(l,e.Ot),O:a.ue,ki:o,se:h}}$s(){return null!==this.El||(this.El=new Ii(this)),this.El}W(){return this.cn}Hh(t){const i=t.priceScaleId;void 0!==i&&i!==this.cn.priceScaleId&&this.$t().Xl(this,i),D(this.cn,t),void 0!==t.priceFormat&&(this.$l(),this.$t().Kl()),this.$t().Zl(this),this.$t().Gl(),this.wn.bt("options");}J(t,i){this.zt.J(t),this.Jl(),this.wn.bt("data"),this.dn.bt("data"),null!==this.Ll&&(i&&i.Ql?this.Ll.Hr():0===t.length&&this.Ll.jr());const n=this.$t().cr(this);this.$t().ta(n),this.$t().Zl(this),this.$t().Gl(),this.$t().$h();}ia(t){this.Nl=t,this.Jl();const i=this.$t().cr(this);this.dn.bt("data"),this.$t().ta(i),this.$t().Zl(this),this.$t().Gl(),this.$t().$h();}na(){return this.Nl}uh(){return this.Fl}sa(t){const i=new Ai(this,t);return this.Il.push(i),this.$t().Zl(this),i}ea(t){const i=this.Il.indexOf(t);-1!==i&&this.Il.splice(i,1),this.$t().Zl(this);}Jh(){return this.Hl}Ct(){const t=this.ra();return null===t?null:{Ot:t.Ot[3],ha:t.ot}}ra(){const t=this.$t().St().Xs();if(null===t)return null;const i=t.Os();return this.zt.hl(i,1)}In(){return this.zt}fh(t){const i=this.zt.Zh(t);return null===i?null:"Bar"===this.Hl||"Candlestick"===this.Hl||"Custom"===this.Hl?{we:i.Ot[0],ge:i.Ot[1],Me:i.Ot[2],xe:i.Ot[3]}:i.Ot[3]}la(t){const i=[];qi(this.jl,Yi,"top",i);const n=this.Ll;return null!==n&&n.yt()?(null===this.Wl&&n.Ur()&&(this.Wl=setTimeout((()=>{this.Wl=null,this.$t().aa();}),0)),n.$r(),i.unshift(n),i):i}Pn(){const t=[];this.oa()||t.push(this.zl),t.push(this.wn,this.Wh,this.dn);const i=this.Il.map((t=>t.Uh()));return t.push(...i),qi(this.jl,Yi,"normal",t),t}_a(){return this.ua(Yi,"bottom")}ca(t){return this.ua(Xi,t)}da(t){return this.ua(Ki,t)}fa(t,i){return this.jl.map((n=>n.br(t,i))).filter((t=>null!==t))}Ji(t){return [this.jh,...this.Il.map((t=>t.qh()))]}Rn(t,i){if(i!==this.Yi&&!this.oa())return [];const n=[...this.rn];for(const t of this.Il)n.push(t.Yh());return this.jl.forEach((t=>{n.push(...t.Rn());})),n}Qi(){const t=[];return this.jl.forEach((i=>{t.push(...i.Qi());})),t}Vl(t,i){if(void 0!==this.cn.autoscaleInfoProvider){const n=this.cn.autoscaleInfoProvider((()=>{const n=this.va(t,i);return null===n?null:n.Ah()}));return Ri.Bh(n)}return this.va(t,i)}pa(){return this.cn.priceFormat.minMove}ma(){return this.ba}On(){var t;this.wn.bt(),this.dn.bt();for(const t of this.rn)t.bt();for(const t of this.Il)t.bt();this.Wh.bt(),this.zl.bt(),null===(t=this.Ll)||void 0===t||t.bt(),this.jl.forEach((t=>t.On()));}Dt(){return b(super.Dt())}kt(t){if(!(("Line"===this.Hl||"Area"===this.Hl||"Baseline"===this.Hl)&&this.cn.crosshairMarkerVisible))return null;const i=this.zt.Zh(t);if(null===i)return null;return {_t:i.Ot[3],ht:this.wa(),At:this.ga(),Pt:this.Ma(),Tt:this.xa(t)}}mh(){return this.cn.title}yt(){return this.cn.visible}Sa(t){this.jl.push(new Ui(t,this));}ka(t){this.jl=this.jl.filter((i=>i.Ol()!==t));}ya(){if(this.wn instanceof Kt!=false)return t=>this.wn.Fe(t)}Ca(){if(this.wn instanceof Kt!=false)return t=>this.wn.We(t)}oa(){return !ot(this.Dt().Ta())}va(t,i){if(!A(t)||!A(i)||this.zt.Ni())return null;const n="Line"===this.Hl||"Area"===this.Hl||"Baseline"===this.Hl||"Histogram"===this.Hl?[3]:[2,1],s=this.zt.al(t,i,n);let e=null!==s?new Pi(s.pl,s.ml):null;if("Histogram"===this.Jh()){const t=this.cn.base,i=new Pi(t,t);e=null!==e?e.ts(i):i;}let r=this.dn._h();return this.jl.forEach((n=>{const s=n.Vl(t,i);if(null==s?void 0:s.priceRange){const t=new Pi(s.priceRange.minValue,s.priceRange.maxValue);e=null!==e?e.ts(t):t;}var h,l,a,o;(null==s?void 0:s.margins)&&(h=r,l=s.margins,r={above:Math.max(null!==(a=null==h?void 0:h.above)&&void 0!==a?a:0,l.above),below:Math.max(null!==(o=null==h?void 0:h.below)&&void 0!==o?o:0,l.below)});})),new Ri(e,r)}wa(){switch(this.Hl){case "Line":case "Area":case "Baseline":return this.cn.crosshairMarkerRadius}return 0}ga(){switch(this.Hl){case "Line":case "Area":case "Baseline":{const t=this.cn.crosshairMarkerBorderColor;if(0!==t.length)return t}}return null}Ma(){switch(this.Hl){case "Line":case "Area":case "Baseline":return this.cn.crosshairMarkerBorderWidth}return 0}xa(t){switch(this.Hl){case "Line":case "Area":case "Baseline":{const t=this.cn.crosshairMarkerBackgroundColor;if(0!==t.length)return t}}return this.$s().Hs(t).ue}$l(){switch(this.cn.priceFormat.type){case "custom":this.ba={format:this.cn.priceFormat.formatter};break;case "volume":this.ba=new vt(this.cn.priceFormat.precision);break;case "percent":this.ba=new ft(this.cn.priceFormat.precision);break;default:{const t=Math.pow(10,this.cn.priceFormat.precision);this.ba=new dt(t,this.cn.priceFormat.minMove*t);}}null!==this.Yi&&this.Yi.Pa();}Jl(){const t=this.$t().St();if(!t.Ra()||this.zt.Ni())return void(this.Fl=[]);const i=b(this.zt.sl());this.Fl=this.Nl.map(((n,s)=>{const e=b(t.Da(n.time,true)),r=e<i?1:-1;return {time:b(this.zt.hl(e,r)).se,position:n.position,shape:n.shape,color:n.color,id:n.id,Qr:s,text:n.text,size:n.size,originalTime:n.originalTime}}));}Ul(t){switch(this.dn=new ki(this,this.$t()),this.Hl){case "Bar":this.wn=new jt(this,this.$t());break;case "Candlestick":this.wn=new Yt(this,this.$t());break;case "Line":this.wn=new Qt(this,this.$t());break;case "Custom":this.wn=new Kt(this,this.$t(),m(t));break;case "Area":this.wn=new Nt(this,this.$t());break;case "Baseline":this.wn=new Ut(this,this.$t());break;case "Histogram":this.wn=new Jt(this,this.$t());break;default:throw Error("Unknown chart style assigned: "+this.Hl)}}ua(t,i){const n=[];return qi(this.jl,t,i,n),n}}class Gi{constructor(t){this.cn=t;}Oa(t,i,n){let s=t;if(0===this.cn.mode)return s;const e=n.vn(),r=e.Ct();if(null===r)return s;const h=e.Rt(t,r),l=n.Aa().filter((t=>t instanceof Zi)).reduce(((t,s)=>{if(n.dr(s)||!s.yt())return t;const e=s.Dt(),r=s.In();if(e.Ni()||!r.Kr(i))return t;const h=r.Zh(i);if(null===h)return t;const l=w(s.Ct());return t.concat([e.Rt(h.Ot[3],l.Ot)])}),[]);if(0===l.length)return s;l.sort(((t,i)=>Math.abs(t-h)-Math.abs(i-h)));const a=l[0];return s=e.pn(a,r),s}}class Ji extends j{constructor(){super(...arguments),this.zt=null;}J(t){this.zt=t;}Z({context:t,bitmapSize:i,horizontalPixelRatio:n,verticalPixelRatio:s}){if(null===this.zt)return;const e=Math.max(1,Math.floor(n));t.lineWidth=e,function(t,i){t.save(),t.lineWidth%2&&t.translate(.5,.5),i(),t.restore();}(t,(()=>{const r=b(this.zt);if(r.Ba){t.strokeStyle=r.Va,f(t,r.Ia),t.beginPath();for(const s of r.za){const r=Math.round(s.La*n);t.moveTo(r,-e),t.lineTo(r,i.height+e);}t.stroke();}if(r.Ea){t.strokeStyle=r.Na,f(t,r.Fa),t.beginPath();for(const n of r.Wa){const r=Math.round(n.La*s);t.moveTo(-e,r),t.lineTo(i.width+e,r);}t.stroke();}}));}}class Qi{constructor(t){this.Wt=new Ji,this.ft=true,this.tn=t;}bt(){this.ft=true;}gt(){if(this.ft){const t=this.tn.$t().W().grid,i={Ea:t.horzLines.visible,Ba:t.vertLines.visible,Na:t.horzLines.color,Va:t.vertLines.color,Fa:t.horzLines.style,Ia:t.vertLines.style,Wa:this.tn.vn().ja(),za:(this.tn.$t().St().ja()||[]).map((t=>({La:t.coord})))};this.Wt.J(i),this.ft=false;}return this.Wt}}class tn{constructor(t){this.wn=new Qi(t);}Uh(){return this.wn}}const nn={Ha:4,$a:1e-4};function sn(t,i){const n=100*(t-i)/i;return i<0?-n:n}function en(t,i){const n=sn(t.Th(),i),s=sn(t.Ph(),i);return new Pi(n,s)}function rn(t,i){const n=100*(t-i)/i+100;return i<0?-n:n}function hn(t,i){const n=rn(t.Th(),i),s=rn(t.Ph(),i);return new Pi(n,s)}function ln(t,i){const n=Math.abs(t);if(n<1e-15)return 0;const s=Math.log10(n+i.$a)+i.Ha;return t<0?-s:s}function an(t,i){const n=Math.abs(t);if(n<1e-15)return 0;const s=Math.pow(10,n-i.Ha)-i.$a;return t<0?-s:s}function on(t,i){if(null===t)return null;const n=ln(t.Th(),i),s=ln(t.Ph(),i);return new Pi(n,s)}function _n(t,i){if(null===t)return null;const n=an(t.Th(),i),s=an(t.Ph(),i);return new Pi(n,s)}function un(t){if(null===t)return nn;const i=Math.abs(t.Ph()-t.Th());if(i>=1||i<1e-15)return nn;const n=Math.ceil(Math.abs(Math.log10(i))),s=nn.Ha+n;return {Ha:s,$a:1/Math.pow(10,s)}}class cn{constructor(t,i){if(this.Ua=t,this.qa=i,function(t){if(t<0)return false;for(let i=t;i>1;i/=10)if(i%10!=0)return false;return true}(this.Ua))this.Ya=[2,2.5,2];else {this.Ya=[];for(let t=this.Ua;1!==t;){if(t%2==0)this.Ya.push(2),t/=2;else {if(t%5!=0)throw new Error("unexpected base");this.Ya.push(2,2.5),t/=5;}if(this.Ya.length>100)throw new Error("something wrong with base")}}}Xa(t,i,n){const s=0===this.Ua?0:1/this.Ua;let e=Math.pow(10,Math.max(0,Math.ceil(Math.log10(t-i)))),r=0,h=this.qa[0];for(;;){const t=kt(e,s,1e-14)&&e>s+1e-14,i=kt(e,n*h,1e-14),l=kt(e,1,1e-14);if(!(t&&i&&l))break;e/=h,h=this.qa[++r%this.qa.length];}if(e<=s+1e-14&&(e=s),e=Math.max(1,e),this.Ya.length>0&&(l=e,a=1,o=1e-14,Math.abs(l-a)<o))for(r=0,h=this.Ya[0];kt(e,n*h,1e-14)&&e>s+1e-14;)e/=h,h=this.Ya[++r%this.Ya.length];var l,a,o;return e}}class dn{constructor(t,i,n,s){this.Ka=[],this.Li=t,this.Ua=i,this.Za=n,this.Ga=s;}Xa(t,i){if(t<i)throw new Error("high < low");const n=this.Li.Vt(),s=(t-i)*this.Ja()/n,e=new cn(this.Ua,[2,2.5,2]),r=new cn(this.Ua,[2,2,2.5]),h=new cn(this.Ua,[2.5,2,2]),l=[];return l.push(e.Xa(t,i,s),r.Xa(t,i,s),h.Xa(t,i,s)),function(t){if(t.length<1)throw Error("array is empty");let i=t[0];for(let n=1;n<t.length;++n)t[n]<i&&(i=t[n]);return i}(l)}Qa(){const t=this.Li,i=t.Ct();if(null===i)return void(this.Ka=[]);const n=t.Vt(),s=this.Za(n-1,i),e=this.Za(0,i),r=this.Li.W().entireTextOnly?this.io()/2:0,h=r,l=n-1-r,a=Math.max(s,e),o=Math.min(s,e);if(a===o)return void(this.Ka=[]);let _=this.Xa(a,o),u=a%_;u+=u<0?_:0;const c=a>=o?1:-1;let d=null,f=0;for(let n=a-u;n>o;n-=_){const s=this.Ga(n,i,true);null!==d&&Math.abs(s-d)<this.Ja()||(s<h||s>l||(f<this.Ka.length?(this.Ka[f].La=s,this.Ka[f].no=t.so(n)):this.Ka.push({La:s,no:t.so(n)}),f++,d=s,t.eo()&&(_=this.Xa(n*c,o))));}this.Ka.length=f;}ja(){return this.Ka}io(){return this.Li.P()}Ja(){return Math.ceil(2.5*this.io())}}function fn(t){return t.slice().sort(((t,i)=>b(t.Ki())-b(i.Ki())))}var vn;!function(t){t[t.Normal=0]="Normal",t[t.Logarithmic=1]="Logarithmic",t[t.Percentage=2]="Percentage",t[t.IndexedTo100=3]="IndexedTo100";}(vn||(vn={}));const pn=new ft,mn=new dt(100,1);class bn{constructor(t,i,n,s){this.ro=0,this.ho=null,this.Vh=null,this.lo=null,this.ao={oo:false,_o:null},this.uo=0,this.co=0,this.do=new R,this.fo=new R,this.vo=[],this.po=null,this.mo=null,this.bo=null,this.wo=null,this.ba=mn,this.Mo=un(null),this.xo=t,this.cn=i,this.So=n,this.ko=s,this.yo=new dn(this,100,this.Co.bind(this),this.To.bind(this));}Ta(){return this.xo}W(){return this.cn}Hh(t){if(D(this.cn,t),this.Pa(),void 0!==t.mode&&this.Po({yr:t.mode}),void 0!==t.scaleMargins){const i=m(t.scaleMargins.top),n=m(t.scaleMargins.bottom);if(i<0||i>1)throw new Error(`Invalid top margin - expect value between 0 and 1, given=${i}`);if(n<0||n>1)throw new Error(`Invalid bottom margin - expect value between 0 and 1, given=${n}`);if(i+n>1)throw new Error(`Invalid margins - sum of margins must be less than 1, given=${i+n}`);this.Ro(),this.mo=null;}}Do(){return this.cn.autoScale}eo(){return 1===this.cn.mode}gh(){return 2===this.cn.mode}Oo(){return 3===this.cn.mode}yr(){return {Wn:this.cn.autoScale,Ao:this.cn.invertScale,yr:this.cn.mode}}Po(t){const i=this.yr();let n=null;void 0!==t.Wn&&(this.cn.autoScale=t.Wn),void 0!==t.yr&&(this.cn.mode=t.yr,2!==t.yr&&3!==t.yr||(this.cn.autoScale=true),this.ao.oo=false),1===i.yr&&t.yr!==i.yr&&(!function(t,i){if(null===t)return false;const n=an(t.Th(),i),s=an(t.Ph(),i);return isFinite(n)&&isFinite(s)}(this.Vh,this.Mo)?this.cn.autoScale=true:(n=_n(this.Vh,this.Mo),null!==n&&this.Bo(n))),1===t.yr&&t.yr!==i.yr&&(n=on(this.Vh,this.Mo),null!==n&&this.Bo(n));const s=i.yr!==this.cn.mode;s&&(2===i.yr||this.gh())&&this.Pa(),s&&(3===i.yr||this.Oo())&&this.Pa(),void 0!==t.Ao&&i.Ao!==t.Ao&&(this.cn.invertScale=t.Ao,this.Vo()),this.fo.m(i,this.yr());}Io(){return this.fo}P(){return this.So.fontSize}Vt(){return this.ro}zo(t){this.ro!==t&&(this.ro=t,this.Ro(),this.mo=null);}Lo(){if(this.ho)return this.ho;const t=this.Vt()-this.Eo()-this.No();return this.ho=t,t}zh(){return this.Fo(),this.Vh}Bo(t,i){const n=this.Vh;(i||null===n&&null!==t||null!==n&&!n.yh(t))&&(this.mo=null,this.Vh=t);}Ni(){return this.Fo(),0===this.ro||!this.Vh||this.Vh.Ni()}Wo(t){return this.Ao()?t:this.Vt()-1-t}Rt(t,i){return this.gh()?t=sn(t,i):this.Oo()&&(t=rn(t,i)),this.To(t,i)}Qs(t,i,n){this.Fo();const s=this.No(),e=b(this.zh()),r=e.Th(),h=e.Ph(),l=this.Lo()-1,a=this.Ao(),o=l/(h-r),_=void 0===n?0:n.from,u=void 0===n?t.length:n.to,c=this.jo();for(let n=_;n<u;n++){const e=t[n],h=e._t;if(isNaN(h))continue;let l=h;null!==c&&(l=c(e._t,i));const _=s+o*(l-r),u=a?_:this.ro-1-_;e.st=u;}}me(t,i,n){this.Fo();const s=this.No(),e=b(this.zh()),r=e.Th(),h=e.Ph(),l=this.Lo()-1,a=this.Ao(),o=l/(h-r),_=void 0===n?0:n.from,u=void 0===n?t.length:n.to,c=this.jo();for(let n=_;n<u;n++){const e=t[n];let h=e.we,l=e.ge,_=e.Me,u=e.xe;null!==c&&(h=c(e.we,i),l=c(e.ge,i),_=c(e.Me,i),u=c(e.xe,i));let d=s+o*(h-r),f=a?d:this.ro-1-d;e.ve=f,d=s+o*(l-r),f=a?d:this.ro-1-d,e.ce=f,d=s+o*(_-r),f=a?d:this.ro-1-d,e.de=f,d=s+o*(u-r),f=a?d:this.ro-1-d,e.pe=f;}}pn(t,i){const n=this.Co(t,i);return this.Ho(n,i)}Ho(t,i){let n=t;return this.gh()?n=function(t,i){return i<0&&(t=-t),t/100*i+i}(n,i):this.Oo()&&(n=function(t,i){return t-=100,i<0&&(t=-t),t/100*i+i}(n,i)),n}Aa(){return this.vo}$o(){if(this.po)return this.po;let t=[];for(let i=0;i<this.vo.length;i++){const n=this.vo[i];null===n.Ki()&&n.Zi(i+1),t.push(n);}return t=fn(t),this.po=t,this.po}Uo(t){ -1===this.vo.indexOf(t)&&(this.vo.push(t),this.Pa(),this.qo());}Yo(t){const i=this.vo.indexOf(t);if(-1===i)throw new Error("source is not attached to scale");this.vo.splice(i,1),0===this.vo.length&&(this.Po({Wn:true}),this.Bo(null)),this.Pa(),this.qo();}Ct(){let t=null;for(const i of this.vo){const n=i.Ct();null!==n&&((null===t||n.ha<t.ha)&&(t=n));}return null===t?null:t.Ot}Ao(){return this.cn.invertScale}ja(){const t=null===this.Ct();if(null!==this.mo&&(t||this.mo.Xo===t))return this.mo.ja;this.yo.Qa();const i=this.yo.ja();return this.mo={ja:i,Xo:t},this.do.m(),i}Ko(){return this.do}Zo(t){this.gh()||this.Oo()||null===this.bo&&null===this.lo&&(this.Ni()||(this.bo=this.ro-t,this.lo=b(this.zh()).Ch()));}Go(t){if(this.gh()||this.Oo())return;if(null===this.bo)return;this.Po({Wn:false}),(t=this.ro-t)<0&&(t=0);let i=(this.bo+.2*(this.ro-1))/(t+.2*(this.ro-1));const n=b(this.lo).Ch();i=Math.max(i,.1),n.Dh(i),this.Bo(n);}Jo(){this.gh()||this.Oo()||(this.bo=null,this.lo=null);}Qo(t){this.Do()||null===this.wo&&null===this.lo&&(this.Ni()||(this.wo=t,this.lo=b(this.zh()).Ch()));}t_(t){if(this.Do())return;if(null===this.wo)return;const i=b(this.zh()).Rh()/(this.Lo()-1);let n=t-this.wo;this.Ao()&&(n*=-1);const s=n*i,e=b(this.lo).Ch();e.Oh(s),this.Bo(e,true),this.mo=null;}i_(){this.Do()||null!==this.wo&&(this.wo=null,this.lo=null);}ma(){return this.ba||this.Pa(),this.ba}Fi(t,i){switch(this.cn.mode){case 2:return this.n_(sn(t,i));case 3:return this.ma().format(rn(t,i));default:return this.Fh(t)}}so(t){switch(this.cn.mode){case 2:return this.n_(t);case 3:return this.ma().format(t);default:return this.Fh(t)}}ql(t){return this.Fh(t,b(this.s_()).ma())}Yl(t,i){return t=sn(t,i),this.n_(t,pn)}e_(){return this.vo}r_(t){this.ao={_o:t,oo:false};}On(){this.vo.forEach((t=>t.On()));}Pa(){this.mo=null;const t=this.s_();let i=100;null!==t&&(i=Math.round(1/t.pa())),this.ba=mn,this.gh()?(this.ba=pn,i=100):this.Oo()?(this.ba=new dt(100,1),i=100):null!==t&&(this.ba=t.ma()),this.yo=new dn(this,i,this.Co.bind(this),this.To.bind(this)),this.yo.Qa();}qo(){this.po=null;}s_(){return this.vo[0]||null}Eo(){return this.Ao()?this.cn.scaleMargins.bottom*this.Vt()+this.co:this.cn.scaleMargins.top*this.Vt()+this.uo}No(){return this.Ao()?this.cn.scaleMargins.top*this.Vt()+this.uo:this.cn.scaleMargins.bottom*this.Vt()+this.co}Fo(){this.ao.oo||(this.ao.oo=true,this.h_());}Ro(){this.ho=null;}To(t,i){if(this.Fo(),this.Ni())return 0;t=this.eo()&&t?ln(t,this.Mo):t;const n=b(this.zh()),s=this.No()+(this.Lo()-1)*(t-n.Th())/n.Rh();return this.Wo(s)}Co(t,i){if(this.Fo(),this.Ni())return 0;const n=this.Wo(t),s=b(this.zh()),e=s.Th()+s.Rh()*((n-this.No())/(this.Lo()-1));return this.eo()?an(e,this.Mo):e}Vo(){this.mo=null,this.yo.Qa();}h_(){const t=this.ao._o;if(null===t)return;let i=null;const n=this.e_();let s=0,e=0;for(const r of n){if(!r.yt())continue;const n=r.Ct();if(null===n)continue;const h=r.Vl(t.Os(),t.ui());let l=h&&h.zh();if(null!==l){switch(this.cn.mode){case 1:l=on(l,this.Mo);break;case 2:l=en(l,n.Ot);break;case 3:l=hn(l,n.Ot);}if(i=null===i?l:i.ts(b(l)),null!==h){const t=h.Lh();null!==t&&(s=Math.max(s,t.above),e=Math.max(e,t.below));}}}if(s===this.uo&&e===this.co||(this.uo=s,this.co=e,this.mo=null,this.Ro()),null!==i){if(i.Th()===i.Ph()){const t=this.s_(),n=5*(null===t||this.gh()||this.Oo()?1:t.pa());this.eo()&&(i=_n(i,this.Mo)),i=new Pi(i.Th()-n,i.Ph()+n),this.eo()&&(i=on(i,this.Mo));}if(this.eo()){const t=_n(i,this.Mo),n=un(t);if(r=n,h=this.Mo,r.Ha!==h.Ha||r.$a!==h.$a){const s=null!==this.lo?_n(this.lo,this.Mo):null;this.Mo=n,i=on(t,n),null!==s&&(this.lo=on(s,n));}}this.Bo(i);}else null===this.Vh&&(this.Bo(new Pi(-0.5,.5)),this.Mo=un(null));var r,h;this.ao.oo=true;}jo(){return this.gh()?sn:this.Oo()?rn:this.eo()?t=>ln(t,this.Mo):null}l_(t,i,n){return void 0===i?(void 0===n&&(n=this.ma()),n.format(t)):i(t)}Fh(t,i){return this.l_(t,this.ko.priceFormatter,i)}n_(t,i){return this.l_(t,this.ko.percentageFormatter,i)}}class wn{constructor(t,i){this.vo=[],this.a_=new Map,this.ro=0,this.o_=0,this.__=1e3,this.po=null,this.u_=new R,this.kl=t,this.$i=i,this.c_=new tn(this);const n=i.W();this.d_=this.f_("left",n.leftPriceScale),this.v_=this.f_("right",n.rightPriceScale),this.d_.Io().l(this.p_.bind(this,this.d_),this),this.v_.Io().l(this.p_.bind(this,this.v_),this),this.m_(n);}m_(t){if(t.leftPriceScale&&this.d_.Hh(t.leftPriceScale),t.rightPriceScale&&this.v_.Hh(t.rightPriceScale),t.localization&&(this.d_.Pa(),this.v_.Pa()),t.overlayPriceScales){const i=Array.from(this.a_.values());for(const n of i){const i=b(n[0].Dt());i.Hh(t.overlayPriceScales),t.localization&&i.Pa();}}}b_(t){switch(t){case "left":return this.d_;case "right":return this.v_}return this.a_.has(t)?m(this.a_.get(t))[0].Dt():null}S(){this.$t().w_().p(this),this.d_.Io().p(this),this.v_.Io().p(this),this.vo.forEach((t=>{t.S&&t.S();})),this.u_.m();}g_(){return this.__}M_(t){this.__=t;}$t(){return this.$i}Hi(){return this.o_}Vt(){return this.ro}x_(t){this.o_=t,this.S_();}zo(t){this.ro=t,this.d_.zo(t),this.v_.zo(t),this.vo.forEach((i=>{if(this.dr(i)){const n=i.Dt();null!==n&&n.zo(t);}})),this.S_();}Aa(){return this.vo}dr(t){const i=t.Dt();return null===i||this.d_!==i&&this.v_!==i}Uo(t,i,n){const s=void 0!==n?n:this.y_().k_+1;this.C_(t,i,s);}Yo(t){const i=this.vo.indexOf(t);p(-1!==i,"removeDataSource: invalid data source"),this.vo.splice(i,1);const n=b(t.Dt()).Ta();if(this.a_.has(n)){const i=m(this.a_.get(n)),s=i.indexOf(t);-1!==s&&(i.splice(s,1),0===i.length&&this.a_.delete(n));}const s=t.Dt();s&&s.Aa().indexOf(t)>=0&&s.Yo(t),null!==s&&(s.qo(),this.T_(s)),this.po=null;}pr(t){return t===this.d_?"left":t===this.v_?"right":"overlay"}P_(){return this.d_}R_(){return this.v_}D_(t,i){t.Zo(i);}O_(t,i){t.Go(i),this.S_();}A_(t){t.Jo();}B_(t,i){t.Qo(i);}V_(t,i){t.t_(i),this.S_();}I_(t){t.i_();}S_(){this.vo.forEach((t=>{t.On();}));}vn(){let t=null;return this.$i.W().rightPriceScale.visible&&0!==this.v_.Aa().length?t=this.v_:this.$i.W().leftPriceScale.visible&&0!==this.d_.Aa().length?t=this.d_:0!==this.vo.length&&(t=this.vo[0].Dt()),null===t&&(t=this.v_),t}vr(){let t=null;return this.$i.W().rightPriceScale.visible?t=this.v_:this.$i.W().leftPriceScale.visible&&(t=this.d_),t}T_(t){null!==t&&t.Do()&&this.z_(t);}L_(t){const i=this.kl.Xs();t.Po({Wn:true}),null!==i&&t.r_(i),this.S_();}E_(){this.z_(this.d_),this.z_(this.v_);}N_(){this.T_(this.d_),this.T_(this.v_),this.vo.forEach((t=>{this.dr(t)&&this.T_(t.Dt());})),this.S_(),this.$i.$h();}$o(){return null===this.po&&(this.po=fn(this.vo)),this.po}F_(){return this.u_}W_(){return this.c_}z_(t){const i=t.e_();if(i&&i.length>0&&!this.kl.Ni()){const i=this.kl.Xs();null!==i&&t.r_(i);}t.On();}y_(){const t=this.$o();if(0===t.length)return {j_:0,k_:0};let i=0,n=0;for(let s=0;s<t.length;s++){const e=t[s].Ki();null!==e&&(e<i&&(i=e),e>n&&(n=e));}return {j_:i,k_:n}}C_(t,i,n){let s=this.b_(i);if(null===s&&(s=this.f_(i,this.$i.W().overlayPriceScales)),this.vo.push(t),!ot(i)){const n=this.a_.get(i)||[];n.push(t),this.a_.set(i,n);}s.Uo(t),t.Gi(s),t.Zi(n),this.T_(s),this.po=null;}p_(t,i,n){i.yr!==n.yr&&this.z_(t);}f_(t,i){const n=Object.assign({visible:true,autoScale:true},I(i)),s=new bn(t,n,this.$i.W().layout,this.$i.W().localization);return s.zo(this.Vt()),s}}class gn{constructor(t,i,n=50){this.Ke=0,this.Ze=1,this.Ge=1,this.Qe=new Map,this.Je=new Map,this.H_=t,this.U_=i,this.tr=n;}q_(t){const i=t.time,n=this.U_.cacheKey(i),s=this.Qe.get(n);if(void 0!==s)return s.Y_;if(this.Ke===this.tr){const t=this.Je.get(this.Ge);this.Je.delete(this.Ge),this.Qe.delete(m(t)),this.Ge++,this.Ke--;}const e=this.H_(t);return this.Qe.set(n,{Y_:e,er:this.Ze}),this.Je.set(this.Ze,n),this.Ke++,this.Ze++,e}}class Mn{constructor(t,i){p(t<=i,"right should be >= left"),this.X_=t,this.K_=i;}Os(){return this.X_}ui(){return this.K_}Z_(){return this.K_-this.X_+1}Kr(t){return this.X_<=t&&t<=this.K_}yh(t){return this.X_===t.Os()&&this.K_===t.ui()}}function xn(t,i){return null===t||null===i?t===i:t.yh(i)}class Sn{constructor(){this.G_=new Map,this.Qe=null,this.J_=false;}Q_(t){this.J_=t,this.Qe=null;}tu(t,i){this.iu(i),this.Qe=null;for(let n=i;n<t.length;++n){const i=t[n];let s=this.G_.get(i.timeWeight);void 0===s&&(s=[],this.G_.set(i.timeWeight,s)),s.push({index:n,time:i.time,weight:i.timeWeight,originalTime:i.originalTime});}}nu(t,i){const n=Math.ceil(i/t);return null!==this.Qe&&this.Qe.su===n||(this.Qe={ja:this.eu(n),su:n}),this.Qe.ja}iu(t){if(0===t)return void this.G_.clear();const i=[];this.G_.forEach(((n,s)=>{t<=n[0].index?i.push(s):n.splice(At(n,t,(i=>i.index<t)),1/0);}));for(const t of i)this.G_.delete(t);}eu(t){let i=[];for(const n of Array.from(this.G_.keys()).sort(((t,i)=>i-t))){if(!this.G_.get(n))continue;const s=i;i=[];const e=s.length;let r=0;const h=m(this.G_.get(n)),l=h.length;let a=1/0,o=-1/0;for(let n=0;n<l;n++){const l=h[n],_=l.index;for(;r<e;){const t=s[r],n=t.index;if(!(n<_)){a=n;break}r++,i.push(t),o=n,a=1/0;}if(a-_>=t&&_-o>=t)i.push(l),o=_;else if(this.J_)return s}for(;r<e;r++)i.push(s[r]);}return i}}class kn{constructor(t){this.ru=t;}hu(){return null===this.ru?null:new Mn(Math.floor(this.ru.Os()),Math.ceil(this.ru.ui()))}lu(){return this.ru}static au(){return new kn(null)}}function yn(t,i){return t.weight>i.weight?t:i}class Cn{constructor(t,i,n,s){this.o_=0,this.ou=null,this._u=[],this.wo=null,this.bo=null,this.uu=new Sn,this.cu=new Map,this.du=kn.au(),this.fu=true,this.vu=new R,this.pu=new R,this.mu=new R,this.bu=null,this.wu=null,this.gu=[],this.cn=i,this.ko=n,this.Mu=i.rightOffset,this.xu=i.barSpacing,this.$i=t,this.U_=s,this.Su(),this.uu.Q_(i.uniformDistribution);}W(){return this.cn}ku(t){D(this.ko,t),this.yu(),this.Su();}Hh(t,i){var n;D(this.cn,t),this.cn.fixLeftEdge&&this.Cu(),this.cn.fixRightEdge&&this.Tu(),void 0!==t.barSpacing&&this.$i.Gn(t.barSpacing),void 0!==t.rightOffset&&this.$i.Jn(t.rightOffset),void 0!==t.minBarSpacing&&this.$i.Gn(null!==(n=t.barSpacing)&&void 0!==n?n:this.xu),this.yu(),this.Su(),this.mu.m();}mn(t){var i,n;return null!==(n=null===(i=this._u[t])||void 0===i?void 0:i.time)&&void 0!==n?n:null}Ui(t){var i;return null!==(i=this._u[t])&&void 0!==i?i:null}Da(t,i){if(this._u.length<1)return null;if(this.U_.key(t)>this.U_.key(this._u[this._u.length-1].time))return i?this._u.length-1:null;const n=At(this._u,this.U_.key(t),((t,i)=>this.U_.key(t.time)<i));return this.U_.key(t)<this.U_.key(this._u[n].time)?i?n:null:n}Ni(){return 0===this.o_||0===this._u.length||null===this.ou}Ra(){return this._u.length>0}Xs(){return this.Pu(),this.du.hu()}Ru(){return this.Pu(),this.du.lu()}Du(){const t=this.Xs();if(null===t)return null;const i={from:t.Os(),to:t.ui()};return this.Ou(i)}Ou(t){const i=Math.round(t.from),n=Math.round(t.to),s=b(this.Au()),e=b(this.Bu());return {from:b(this.Ui(Math.max(s,i))),to:b(this.Ui(Math.min(e,n)))}}Vu(t){return {from:b(this.Da(t.from,true)),to:b(this.Da(t.to,true))}}Hi(){return this.o_}x_(t){if(!isFinite(t)||t<=0)return;if(this.o_===t)return;const i=this.Ru(),n=this.o_;if(this.o_=t,this.fu=true,this.cn.lockVisibleTimeRangeOnResize&&0!==n){const i=this.xu*t/n;this.xu=i;}if(this.cn.fixLeftEdge&&null!==i&&i.Os()<=0){const i=n-t;this.Mu-=Math.round(i/this.xu)+1,this.fu=true;}this.Iu(),this.zu();}It(t){if(this.Ni()||!A(t))return 0;const i=this.Lu()+this.Mu-t;return this.o_-(i+.5)*this.xu-1}Js(t,i){const n=this.Lu(),s=void 0===i?0:i.from,e=void 0===i?t.length:i.to;for(let i=s;i<e;i++){const s=t[i].ot,e=n+this.Mu-s,r=this.o_-(e+.5)*this.xu-1;t[i].nt=r;}}Eu(t){return Math.ceil(this.Nu(t))}Jn(t){this.fu=true,this.Mu=t,this.zu(),this.$i.Fu(),this.$i.$h();}he(){return this.xu}Gn(t){this.Wu(t),this.zu(),this.$i.Fu(),this.$i.$h();}ju(){return this.Mu}ja(){if(this.Ni())return null;if(null!==this.wu)return this.wu;const t=this.xu,i=5*(this.$i.W().layout.fontSize+4)/8*(this.cn.tickMarkMaxCharacterLength||8),n=Math.round(i/t),s=b(this.Xs()),e=Math.max(s.Os(),s.Os()-n),r=Math.max(s.ui(),s.ui()-n),h=this.uu.nu(t,i),l=this.Au()+n,a=this.Bu()-n,o=this.Hu(),_=this.cn.fixLeftEdge||o,u=this.cn.fixRightEdge||o;let c=0;for(const t of h){if(!(e<=t.index&&t.index<=r))continue;let n;c<this.gu.length?(n=this.gu[c],n.coord=this.It(t.index),n.label=this.$u(t),n.weight=t.weight):(n={needAlignCoordinate:false,coord:this.It(t.index),label:this.$u(t),weight:t.weight},this.gu.push(n)),this.xu>i/2&&!o?n.needAlignCoordinate=false:n.needAlignCoordinate=_&&t.index<=l||u&&t.index>=a,c++;}return this.gu.length=c,this.wu=this.gu,this.gu}Uu(){this.fu=true,this.Gn(this.cn.barSpacing),this.Jn(this.cn.rightOffset);}qu(t){this.fu=true,this.ou=t,this.zu(),this.Cu();}Yu(t,i){const n=this.Nu(t),s=this.he(),e=s+i*(s/10);this.Gn(e),this.cn.rightBarStaysOnScroll||this.Jn(this.ju()+(n-this.Nu(t)));}Zo(t){this.wo&&this.i_(),null===this.bo&&null===this.bu&&(this.Ni()||(this.bo=t,this.Xu()));}Go(t){if(null===this.bu)return;const i=St(this.o_-t,0,this.o_),n=St(this.o_-b(this.bo),0,this.o_);0!==i&&0!==n&&this.Gn(this.bu.he*i/n);}Jo(){null!==this.bo&&(this.bo=null,this.Ku());}Qo(t){null===this.wo&&null===this.bu&&(this.Ni()||(this.wo=t,this.Xu()));}t_(t){if(null===this.wo)return;const i=(this.wo-t)/this.he();this.Mu=b(this.bu).ju+i,this.fu=true,this.zu();}i_(){null!==this.wo&&(this.wo=null,this.Ku());}Zu(){this.Gu(this.cn.rightOffset);}Gu(t,i=400){if(!isFinite(t))throw new RangeError("offset is required and must be finite number");if(!isFinite(i)||i<=0)throw new RangeError("animationDuration (optional) must be finite positive number");const n=this.Mu,s=performance.now();this.$i.Xn({Ju:t=>(t-s)/i>=1,Qu:e=>{const r=(e-s)/i;return r>=1?t:n+(t-n)*r}});}bt(t,i){this.fu=true,this._u=t,this.uu.tu(t,i),this.zu();}tc(){return this.vu}nc(){return this.pu}sc(){return this.mu}Lu(){return this.ou||0}ec(t){const i=t.Z_();this.Wu(this.o_/i),this.Mu=t.ui()-this.Lu(),this.zu(),this.fu=true,this.$i.Fu(),this.$i.$h();}rc(){const t=this.Au(),i=this.Bu();null!==t&&null!==i&&this.ec(new Mn(t,i+this.cn.rightOffset));}hc(t){const i=new Mn(t.from,t.to);this.ec(i);}qi(t){return void 0!==this.ko.timeFormatter?this.ko.timeFormatter(t.originalTime):this.U_.formatHorzItem(t.time)}Hu(){const{handleScroll:t,handleScale:i}=this.$i.W();return !(t.horzTouchDrag||t.mouseWheel||t.pressedMouseMove||t.vertTouchDrag||i.axisDoubleClickReset.time||i.axisPressedMouseMove.time||i.mouseWheel||i.pinch)}Au(){return 0===this._u.length?null:0}Bu(){return 0===this._u.length?null:this._u.length-1}lc(t){return (this.o_-1-t)/this.xu}Nu(t){const i=this.lc(t),n=this.Lu()+this.Mu-i;return Math.round(1e6*n)/1e6}Wu(t){const i=this.xu;this.xu=t,this.Iu(),i!==this.xu&&(this.fu=true,this.ac());}Pu(){if(!this.fu)return;if(this.fu=false,this.Ni())return void this.oc(kn.au());const t=this.Lu(),i=this.o_/this.xu,n=this.Mu+t,s=new Mn(n-i+1,n);this.oc(new kn(s));}Iu(){const t=this._c();if(this.xu<t&&(this.xu=t,this.fu=true),0!==this.o_){const t=.5*this.o_;this.xu>t&&(this.xu=t,this.fu=true);}}_c(){return this.cn.fixLeftEdge&&this.cn.fixRightEdge&&0!==this._u.length?this.o_/this._u.length:this.cn.minBarSpacing}zu(){const t=this.uc();this.Mu>t&&(this.Mu=t,this.fu=true);const i=this.cc();null!==i&&this.Mu<i&&(this.Mu=i,this.fu=true);}cc(){const t=this.Au(),i=this.ou;if(null===t||null===i)return null;return t-i-1+(this.cn.fixLeftEdge?this.o_/this.xu:Math.min(2,this._u.length))}uc(){return this.cn.fixRightEdge?0:this.o_/this.xu-Math.min(2,this._u.length)}Xu(){this.bu={he:this.he(),ju:this.ju()};}Ku(){this.bu=null;}$u(t){let i=this.cu.get(t.weight);return void 0===i&&(i=new gn((t=>this.dc(t)),this.U_),this.cu.set(t.weight,i)),i.q_(t)}dc(t){return this.U_.formatTickmark(t,this.ko)}oc(t){const i=this.du;this.du=t,xn(i.hu(),this.du.hu())||this.vu.m(),xn(i.lu(),this.du.lu())||this.pu.m(),this.ac();}ac(){this.wu=null;}yu(){this.ac(),this.cu.clear();}Su(){this.U_.updateFormatter(this.ko);}Cu(){if(!this.cn.fixLeftEdge)return;const t=this.Au();if(null===t)return;const i=this.Xs();if(null===i)return;const n=i.Os()-t;if(n<0){const t=this.Mu-n-1;this.Jn(t);}this.Iu();}Tu(){this.zu(),this.Iu();}}class Tn{K(t,i,n){t.useMediaCoordinateSpace((t=>this.Z(t,i,n)));}wl(t,i,n){t.useMediaCoordinateSpace((t=>this.fc(t,i,n)));}fc(t,i,n){}}class Pn extends Tn{constructor(t){super(),this.vc=new Map,this.zt=t;}Z(t){}fc(t){if(!this.zt.yt)return;const{context:i,mediaSize:n}=t;let s=0;for(const t of this.zt.mc){if(0===t.Zt.length)continue;i.font=t.R;const e=this.bc(i,t.Zt);e>n.width?t.Yu=n.width/e:t.Yu=1,s+=t.wc*t.Yu;}let e=0;switch(this.zt.gc){case "top":e=0;break;case "center":e=Math.max((n.height-s)/2,0);break;case "bottom":e=Math.max(n.height-s,0);}i.fillStyle=this.zt.O;for(const t of this.zt.mc){i.save();let s=0;switch(this.zt.Mc){case "left":i.textAlign="left",s=t.wc/2;break;case "center":i.textAlign="center",s=n.width/2;break;case "right":i.textAlign="right",s=n.width-1-t.wc/2;}i.translate(s,e),i.textBaseline="top",i.font=t.R,i.scale(t.Yu,t.Yu),i.fillText(t.Zt,0,t.xc),i.restore(),e+=t.wc*t.Yu;}}bc(t,i){const n=this.Sc(t.font);let s=n.get(i);return void 0===s&&(s=t.measureText(i).width,n.set(i,s)),s}Sc(t){let i=this.vc.get(t);return void 0===i&&(i=new Map,this.vc.set(t,i)),i}}class Rn{constructor(t){this.ft=true,this.Ft={yt:false,O:"",mc:[],gc:"center",Mc:"center"},this.Wt=new Pn(this.Ft),this.jt=t;}bt(){this.ft=true;}gt(){return this.ft&&(this.Mt(),this.ft=false),this.Wt}Mt(){const t=this.jt.W(),i=this.Ft;i.yt=t.visible,i.yt&&(i.O=t.color,i.Mc=t.horzAlign,i.gc=t.vertAlign,i.mc=[{Zt:t.text,R:N(t.fontSize,t.fontFamily,t.fontStyle),wc:1.2*t.fontSize,xc:0,Yu:0}]);}}class Dn extends ht{constructor(t,i){super(),this.cn=i,this.wn=new Rn(this);}Rn(){return []}Pn(){return [this.wn]}W(){return this.cn}On(){this.wn.bt();}}var On,An,Bn,Vn,In;!function(t){t[t.OnTouchEnd=0]="OnTouchEnd",t[t.OnNextTap=1]="OnNextTap";}(On||(On={}));class zn{constructor(t,i,n){this.kc=[],this.yc=[],this.o_=0,this.Cc=null,this.Tc=new R,this.Pc=new R,this.Rc=null,this.Dc=t,this.cn=i,this.U_=n,this.Oc=new F(this),this.kl=new Cn(this,i.timeScale,this.cn.localization,n),this.vt=new at(this,i.crosshair),this.Ac=new Gi(i.crosshair),this.Bc=new Dn(this,i.watermark),this.Vc(),this.kc[0].M_(2e3),this.Ic=this.zc(0),this.Lc=this.zc(1);}Kl(){this.Ec(_t.es());}$h(){this.Ec(_t.ss());}aa(){this.Ec(new _t(1));}Zl(t){const i=this.Nc(t);this.Ec(i);}Fc(){return this.Cc}Wc(t){const i=this.Cc;this.Cc=t,null!==i&&this.Zl(i.jc),null!==t&&this.Zl(t.jc);}W(){return this.cn}Hh(t){D(this.cn,t),this.kc.forEach((i=>i.m_(t))),void 0!==t.timeScale&&this.kl.Hh(t.timeScale),void 0!==t.localization&&this.kl.ku(t.localization),(t.leftPriceScale||t.rightPriceScale)&&this.Tc.m(),this.Ic=this.zc(0),this.Lc=this.zc(1),this.Kl();}Hc(t,i){if("left"===t)return void this.Hh({leftPriceScale:i});if("right"===t)return void this.Hh({rightPriceScale:i});const n=this.$c(t);null!==n&&(n.Dt.Hh(i),this.Tc.m());}$c(t){for(const i of this.kc){const n=i.b_(t);if(null!==n)return {Ht:i,Dt:n}}return null}St(){return this.kl}Uc(){return this.kc}qc(){return this.Bc}Yc(){return this.vt}Xc(){return this.Pc}Kc(t,i){t.zo(i),this.Fu();}x_(t){this.o_=t,this.kl.x_(this.o_),this.kc.forEach((i=>i.x_(t))),this.Fu();}Vc(t){const i=new wn(this.kl,this);void 0!==t?this.kc.splice(t,0,i):this.kc.push(i);const n=void 0===t?this.kc.length-1:t,s=_t.es();return s.Nn(n,{Fn:0,Wn:true}),this.Ec(s),i}D_(t,i,n){t.D_(i,n);}O_(t,i,n){t.O_(i,n),this.Gl(),this.Ec(this.Zc(t,2));}A_(t,i){t.A_(i),this.Ec(this.Zc(t,2));}B_(t,i,n){i.Do()||t.B_(i,n);}V_(t,i,n){i.Do()||(t.V_(i,n),this.Gl(),this.Ec(this.Zc(t,2)));}I_(t,i){i.Do()||(t.I_(i),this.Ec(this.Zc(t,2)));}L_(t,i){t.L_(i),this.Ec(this.Zc(t,2));}Gc(t){this.kl.Zo(t);}Jc(t,i){const n=this.St();if(n.Ni()||0===i)return;const s=n.Hi();t=Math.max(1,Math.min(t,s)),n.Yu(t,i),this.Fu();}Qc(t){this.td(0),this.nd(t),this.sd();}ed(t){this.kl.Go(t),this.Fu();}rd(){this.kl.Jo(),this.$h();}td(t){this.kl.Qo(t);}nd(t){this.kl.t_(t),this.Fu();}sd(){this.kl.i_(),this.$h();}wt(){return this.yc}hd(t,i,n,s,e){this.vt.gn(t,i);let r=NaN,h=this.kl.Eu(t);const l=this.kl.Xs();null!==l&&(h=Math.min(Math.max(l.Os(),h),l.ui()));const a=s.vn(),o=a.Ct();null!==o&&(r=a.pn(i,o)),r=this.Ac.Oa(r,h,s),this.vt.kn(h,r,s),this.aa(),e||this.Pc.m(this.vt.xt(),{x:t,y:i},n);}ld(t,i,n){const s=n.vn(),e=s.Ct(),r=s.Rt(t,b(e)),h=this.kl.Da(i,true),l=this.kl.It(b(h));this.hd(l,r,null,n,true);}ad(t){this.Yc().Cn(),this.aa(),t||this.Pc.m(null,null,null);}Gl(){const t=this.vt.Ht();if(null!==t){const i=this.vt.xn(),n=this.vt.Sn();this.hd(i,n,null,t);}this.vt.On();}od(t,i,n){const s=this.kl.mn(0);void 0!==i&&void 0!==n&&this.kl.bt(i,n);const e=this.kl.mn(0),r=this.kl.Lu(),h=this.kl.Xs();if(null!==h&&null!==s&&null!==e){const i=h.Kr(r),l=this.U_.key(s)>this.U_.key(e),a=null!==t&&t>r&&!l,o=this.kl.W().allowShiftVisibleRangeOnWhitespaceReplacement,_=i&&(!(void 0===n)||o)&&this.kl.W().shiftVisibleRangeOnNewBar;if(a&&!_){const i=t-r;this.kl.Jn(this.kl.ju()-i);}}this.kl.qu(t);}ta(t){null!==t&&t.N_();}cr(t){const i=this.kc.find((i=>i.$o().includes(t)));return void 0===i?null:i}Fu(){this.Bc.On(),this.kc.forEach((t=>t.N_())),this.Gl();}S(){this.kc.forEach((t=>t.S())),this.kc.length=0,this.cn.localization.priceFormatter=void 0,this.cn.localization.percentageFormatter=void 0,this.cn.localization.timeFormatter=void 0;}_d(){return this.Oc}mr(){return this.Oc.W()}w_(){return this.Tc}ud(t,i,n){const s=this.kc[0],e=this.dd(i,t,s,n);return this.yc.push(e),1===this.yc.length?this.Kl():this.$h(),e}fd(t){const i=this.cr(t),n=this.yc.indexOf(t);p(-1!==n,"Series not found"),this.yc.splice(n,1),b(i).Yo(t),t.S&&t.S();}Xl(t,i){const n=b(this.cr(t));n.Yo(t);const s=this.$c(i);if(null===s){const s=t.Ki();n.Uo(t,i,s);}else {const e=s.Ht===n?t.Ki():void 0;s.Ht.Uo(t,i,e);}}rc(){const t=_t.ss();t.$n(),this.Ec(t);}vd(t){const i=_t.ss();i.Yn(t),this.Ec(i);}Zn(){const t=_t.ss();t.Zn(),this.Ec(t);}Gn(t){const i=_t.ss();i.Gn(t),this.Ec(i);}Jn(t){const i=_t.ss();i.Jn(t),this.Ec(i);}Xn(t){const i=_t.ss();i.Xn(t),this.Ec(i);}Un(){const t=_t.ss();t.Un(),this.Ec(t);}pd(){return this.cn.rightPriceScale.visible?"right":"left"}md(){return this.Lc}q(){return this.Ic}Bt(t){const i=this.Lc,n=this.Ic;if(i===n)return i;if(t=Math.max(0,Math.min(100,Math.round(100*t))),null===this.Rc||this.Rc.Ts!==n||this.Rc.Ps!==i)this.Rc={Ts:n,Ps:i,bd:new Map};else {const i=this.Rc.bd.get(t);if(void 0!==i)return i}const s=function(t,i,n){const[s,e,r,h]=T(t),[l,a,o,_]=T(i),u=[M(s+n*(l-s)),M(e+n*(a-e)),M(r+n*(o-r)),x(h+n*(_-h))];return `rgba(${u[0]}, ${u[1]}, ${u[2]}, ${u[3]})`}(n,i,t/100);return this.Rc.bd.set(t,s),s}Zc(t,i){const n=new _t(i);if(null!==t){const s=this.kc.indexOf(t);n.Nn(s,{Fn:i});}return n}Nc(t,i){return void 0===i&&(i=2),this.Zc(this.cr(t),i)}Ec(t){this.Dc&&this.Dc(t),this.kc.forEach((t=>t.W_().Uh().bt()));}dd(t,i,n,s){const e=new Zi(this,t,i,n,s),r=void 0!==t.priceScaleId?t.priceScaleId:this.pd();return n.Uo(e,r),ot(r)||e.Hh(t),e}zc(t){const i=this.cn.layout;return "gradient"===i.background.type?0===t?i.background.topColor:i.background.bottomColor:i.background.color}}function Ln(t){return !O(t)&&!B(t)}function En(t){return O(t)}!function(t){t[t.Disabled=0]="Disabled",t[t.Continuous=1]="Continuous",t[t.OnDataUpdate=2]="OnDataUpdate";}(An||(An={})),function(t){t[t.LastBar=0]="LastBar",t[t.LastVisible=1]="LastVisible";}(Bn||(Bn={})),function(t){t.Solid="solid",t.VerticalGradient="gradient";}(Vn||(Vn={})),function(t){t[t.Year=0]="Year",t[t.Month=1]="Month",t[t.DayOfMonth=2]="DayOfMonth",t[t.Time=3]="Time",t[t.TimeWithSeconds=4]="TimeWithSeconds";}(In||(In={}));const Nn=t=>t.getUTCFullYear();function Fn(t,i,n){return i.replace(/yyyy/g,(t=>ct(Nn(t),4))(t)).replace(/yy/g,(t=>ct(Nn(t)%100,2))(t)).replace(/MMMM/g,((t,i)=>new Date(t.getUTCFullYear(),t.getUTCMonth(),1).toLocaleString(i,{month:"long"}))(t,n)).replace(/MMM/g,((t,i)=>new Date(t.getUTCFullYear(),t.getUTCMonth(),1).toLocaleString(i,{month:"short"}))(t,n)).replace(/MM/g,(t=>ct((t=>t.getUTCMonth()+1)(t),2))(t)).replace(/dd/g,(t=>ct((t=>t.getUTCDate())(t),2))(t))}class Wn{constructor(t="yyyy-MM-dd",i="default"){this.wd=t,this.gd=i;}q_(t){return Fn(t,this.wd,this.gd)}}class jn{constructor(t){this.Md=t||"%h:%m:%s";}q_(t){return this.Md.replace("%h",ct(t.getUTCHours(),2)).replace("%m",ct(t.getUTCMinutes(),2)).replace("%s",ct(t.getUTCSeconds(),2))}}const Hn={xd:"yyyy-MM-dd",Sd:"%h:%m:%s",kd:" ",yd:"default"};class $n{constructor(t={}){const i=Object.assign(Object.assign({},Hn),t);this.Cd=new Wn(i.xd,i.yd),this.Td=new jn(i.Sd),this.Pd=i.kd;}q_(t){return `${this.Cd.q_(t)}${this.Pd}${this.Td.q_(t)}`}}function Un(t){return 60*t*60*1e3}function qn(t){return 60*t*1e3}const Yn=[{Rd:(Xn=1,1e3*Xn),Dd:10},{Rd:qn(1),Dd:20},{Rd:qn(5),Dd:21},{Rd:qn(30),Dd:22},{Rd:Un(1),Dd:30},{Rd:Un(3),Dd:31},{Rd:Un(6),Dd:32},{Rd:Un(12),Dd:33}];var Xn;function Kn(t,i){if(t.getUTCFullYear()!==i.getUTCFullYear())return 70;if(t.getUTCMonth()!==i.getUTCMonth())return 60;if(t.getUTCDate()!==i.getUTCDate())return 50;for(let n=Yn.length-1;n>=0;--n)if(Math.floor(i.getTime()/Yn[n].Rd)!==Math.floor(t.getTime()/Yn[n].Rd))return Yn[n].Dd;return 0}function Zn(t){let i=t;if(B(t)&&(i=Jn(t)),!Ln(i))throw new Error("time must be of type BusinessDay");const n=new Date(Date.UTC(i.year,i.month-1,i.day,0,0,0,0));return {Od:Math.round(n.getTime()/1e3),Ad:i}}function Gn(t){if(!En(t))throw new Error("time must be of type isUTCTimestamp");return {Od:t}}function Jn(t){const i=new Date(t);if(isNaN(i.getTime()))throw new Error(`Invalid date string=${t}, expected format=yyyy-mm-dd`);return {day:i.getUTCDate(),month:i.getUTCMonth()+1,year:i.getUTCFullYear()}}function Qn(t){B(t.time)&&(t.time=Jn(t.time));}class ts{options(){return this.cn}setOptions(t){this.cn=t,this.updateFormatter(t.localization);}preprocessData(t){Array.isArray(t)?function(t){t.forEach(Qn);}(t):Qn(t);}createConverterToInternalObj(t){return b(function(t){return 0===t.length?null:Ln(t[0].time)||B(t[0].time)?Zn:Gn}(t))}key(t){return "object"==typeof t&&"Od"in t?t.Od:this.key(this.convertHorzItemToInternal(t))}cacheKey(t){const i=t;return void 0===i.Ad?new Date(1e3*i.Od).getTime():new Date(Date.UTC(i.Ad.year,i.Ad.month-1,i.Ad.day)).getTime()}convertHorzItemToInternal(t){return En(i=t)?Gn(i):Ln(i)?Zn(i):Zn(Jn(i));var i;}updateFormatter(t){if(!this.cn)return;const i=t.dateFormat;this.cn.timeScale.timeVisible?this.Bd=new $n({xd:i,Sd:this.cn.timeScale.secondsVisible?"%h:%m:%s":"%h:%m",kd:" ",yd:t.locale}):this.Bd=new Wn(i,t.locale);}formatHorzItem(t){const i=t;return this.Bd.q_(new Date(1e3*i.Od))}formatTickmark(t,i){const n=function(t,i,n){switch(t){case 0:case 10:return i?n?4:3:2;case 20:case 21:case 22:case 30:case 31:case 32:case 33:return i?3:2;case 50:return 2;case 60:return 1;case 70:return 0}}(t.weight,this.cn.timeScale.timeVisible,this.cn.timeScale.secondsVisible),s=this.cn.timeScale;if(void 0!==s.tickMarkFormatter){const e=s.tickMarkFormatter(t.originalTime,n,i.locale);if(null!==e)return e}return function(t,i,n){const s={};switch(i){case 0:s.year="numeric";break;case 1:s.month="short";break;case 2:s.day="numeric";break;case 3:s.hour12=false,s.hour="2-digit",s.minute="2-digit";break;case 4:s.hour12=false,s.hour="2-digit",s.minute="2-digit",s.second="2-digit";}const e=void 0===t.Ad?new Date(1e3*t.Od):new Date(Date.UTC(t.Ad.year,t.Ad.month-1,t.Ad.day));return new Date(e.getUTCFullYear(),e.getUTCMonth(),e.getUTCDate(),e.getUTCHours(),e.getUTCMinutes(),e.getUTCSeconds(),e.getUTCMilliseconds()).toLocaleString(n,s)}(t.time,n,i.locale)}maxTickMarkWeight(t){let i=t.reduce(yn,t[0]).weight;return i>30&&i<50&&(i=30),i}fillWeightsForPoints(t,i){!function(t,i=0){if(0===t.length)return;let n=0===i?null:t[i-1].time.Od,s=null!==n?new Date(1e3*n):null,e=0;for(let r=i;r<t.length;++r){const i=t[r],h=new Date(1e3*i.time.Od);null!==s&&(i.timeWeight=Kn(h,s)),e+=i.time.Od-(n||i.time.Od),n=i.time.Od,s=h;}if(0===i&&t.length>1){const i=Math.ceil(e/(t.length-1)),n=new Date(1e3*(t[0].time.Od-i));t[0].timeWeight=Kn(new Date(1e3*t[0].time.Od),n);}}(t,i);}static Vd(t){return D({localization:{dateFormat:"dd MMM 'yy"}},null!=t?t:{})}}const is="undefined"!=typeof window;function ns(){return !!is&&window.navigator.userAgent.toLowerCase().indexOf("firefox")>-1}function ss(){return !!is&&/iPhone|iPad|iPod/.test(window.navigator.platform)}function es(t){return t+t%2}function rs(t,i){return t.Id-i.Id}function hs(t,i,n){const s=(t.Id-i.Id)/(t.ot-i.ot);return Math.sign(s)*Math.min(Math.abs(s),n)}class ls{constructor(t,i,n,s){this.zd=null,this.Ld=null,this.Ed=null,this.Nd=null,this.Fd=null,this.Wd=0,this.jd=0,this.Hd=t,this.$d=i,this.Ud=n,this.rs=s;}qd(t,i){if(null!==this.zd){if(this.zd.ot===i)return void(this.zd.Id=t);if(Math.abs(this.zd.Id-t)<this.rs)return}this.Nd=this.Ed,this.Ed=this.Ld,this.Ld=this.zd,this.zd={ot:i,Id:t};}Dr(t,i){if(null===this.zd||null===this.Ld)return;if(i-this.zd.ot>50)return;let n=0;const s=hs(this.zd,this.Ld,this.$d),e=rs(this.zd,this.Ld),r=[s],h=[e];if(n+=e,null!==this.Ed){const t=hs(this.Ld,this.Ed,this.$d);if(Math.sign(t)===Math.sign(s)){const i=rs(this.Ld,this.Ed);if(r.push(t),h.push(i),n+=i,null!==this.Nd){const t=hs(this.Ed,this.Nd,this.$d);if(Math.sign(t)===Math.sign(s)){const i=rs(this.Ed,this.Nd);r.push(t),h.push(i),n+=i;}}}}let l=0;for(let t=0;t<r.length;++t)l+=h[t]/n*r[t];Math.abs(l)<this.Hd||(this.Fd={Id:t,ot:i},this.jd=l,this.Wd=function(t,i){const n=Math.log(i);return Math.log(1*n/-t)/n}(Math.abs(l),this.Ud));}Qu(t){const i=b(this.Fd),n=t-i.ot;return i.Id+this.jd*(Math.pow(this.Ud,n)-1)/Math.log(this.Ud)}Ju(t){return null===this.Fd||this.Yd(t)===this.Wd}Yd(t){const i=t-b(this.Fd).ot;return Math.min(i,this.Wd)}}function as(t,n){const s=b(t.ownerDocument).createElement("canvas");t.appendChild(s);const e=bindTo(s,{options:{allowResizeObserver:false},transform:(t,i)=>({width:Math.max(t.width,i.width),height:Math.max(t.height,i.height)})});return e.resizeCanvasElement(n),e}function os(t){var i;t.width=1,t.height=1,null===(i=t.getContext("2d"))||void 0===i||i.clearRect(0,0,1,1);}function _s(t,i,n,s){t.wl&&t.wl(i,n,s);}function us(t,i,n,s){t.K(i,n,s);}function cs(t,i,n,s){const e=t(n,s);for(const t of e){const n=t.gt();null!==n&&i(n);}}function ds(t){is&&void 0!==window.chrome&&t.addEventListener("mousedown",(t=>{if(1===t.button)return t.preventDefault(),false}));}class fs{constructor(t,i,n){this.Xd=0,this.Kd=null,this.Zd={nt:Number.NEGATIVE_INFINITY,st:Number.POSITIVE_INFINITY},this.Gd=0,this.Jd=null,this.Qd={nt:Number.NEGATIVE_INFINITY,st:Number.POSITIVE_INFINITY},this.tf=null,this.if=false,this.nf=null,this.sf=null,this.ef=false,this.rf=false,this.hf=false,this.lf=null,this.af=null,this._f=null,this.uf=null,this.cf=null,this.df=null,this.ff=null,this.vf=0,this.pf=false,this.mf=false,this.bf=false,this.wf=0,this.gf=null,this.Mf=!ss(),this.xf=t=>{this.Sf(t);},this.kf=t=>{if(this.yf(t)){const i=this.Cf(t);if(++this.Gd,this.Jd&&this.Gd>1){const{Tf:n}=this.Pf(ms(t),this.Qd);n<30&&!this.hf&&this.Rf(i,this.Of.Df),this.Af();}}else {const i=this.Cf(t);if(++this.Xd,this.Kd&&this.Xd>1){const{Tf:n}=this.Pf(ms(t),this.Zd);n<5&&!this.rf&&this.Bf(i,this.Of.Vf),this.If();}}},this.zf=t,this.Of=i,this.cn=n,this.Lf();}S(){null!==this.lf&&(this.lf(),this.lf=null),null!==this.af&&(this.af(),this.af=null),null!==this.uf&&(this.uf(),this.uf=null),null!==this.cf&&(this.cf(),this.cf=null),null!==this.df&&(this.df(),this.df=null),null!==this._f&&(this._f(),this._f=null),this.Ef(),this.If();}Nf(t){this.uf&&this.uf();const i=this.Ff.bind(this);if(this.uf=()=>{this.zf.removeEventListener("mousemove",i);},this.zf.addEventListener("mousemove",i),this.yf(t))return;const n=this.Cf(t);this.Bf(n,this.Of.Wf),this.Mf=true;}If(){null!==this.Kd&&clearTimeout(this.Kd),this.Xd=0,this.Kd=null,this.Zd={nt:Number.NEGATIVE_INFINITY,st:Number.POSITIVE_INFINITY};}Af(){null!==this.Jd&&clearTimeout(this.Jd),this.Gd=0,this.Jd=null,this.Qd={nt:Number.NEGATIVE_INFINITY,st:Number.POSITIVE_INFINITY};}Ff(t){if(this.bf||null!==this.sf)return;if(this.yf(t))return;const i=this.Cf(t);this.Bf(i,this.Of.jf),this.Mf=true;}Hf(t){const i=ws(t.changedTouches,b(this.gf));if(null===i)return;if(this.wf=bs(t),null!==this.ff)return;if(this.mf)return;this.pf=true;const n=this.Pf(ms(i),b(this.sf)),{$f:s,Uf:e,Tf:r}=n;if(this.ef||!(r<5)){if(!this.ef){const t=.5*s,i=e>=t&&!this.cn.qf(),n=t>e&&!this.cn.Yf();i||n||(this.mf=true),this.ef=true,this.hf=true,this.Ef(),this.Af();}if(!this.mf){const n=this.Cf(t,i);this.Rf(n,this.Of.Xf),ps(t);}}}Kf(t){if(0!==t.button)return;const i=this.Pf(ms(t),b(this.nf)),{Tf:n}=i;if(n>=5&&(this.rf=true,this.If()),this.rf){const i=this.Cf(t);this.Bf(i,this.Of.Zf);}}Pf(t,i){const n=Math.abs(i.nt-t.nt),s=Math.abs(i.st-t.st);return {$f:n,Uf:s,Tf:n+s}}Gf(t){let i=ws(t.changedTouches,b(this.gf));if(null===i&&0===t.touches.length&&(i=t.changedTouches[0]),null===i)return;this.gf=null,this.wf=bs(t),this.Ef(),this.sf=null,this.df&&(this.df(),this.df=null);const n=this.Cf(t,i);if(this.Rf(n,this.Of.Jf),++this.Gd,this.Jd&&this.Gd>1){const{Tf:t}=this.Pf(ms(i),this.Qd);t<30&&!this.hf&&this.Rf(n,this.Of.Df),this.Af();}else this.hf||(this.Rf(n,this.Of.Qf),this.Of.Qf&&ps(t));0===this.Gd&&ps(t),0===t.touches.length&&this.if&&(this.if=false,ps(t));}Sf(t){if(0!==t.button)return;const i=this.Cf(t);if(this.nf=null,this.bf=false,this.cf&&(this.cf(),this.cf=null),ns()){this.zf.ownerDocument.documentElement.removeEventListener("mouseleave",this.xf);}if(!this.yf(t))if(this.Bf(i,this.Of.tv),++this.Xd,this.Kd&&this.Xd>1){const{Tf:n}=this.Pf(ms(t),this.Zd);n<5&&!this.rf&&this.Bf(i,this.Of.Vf),this.If();}else this.rf||this.Bf(i,this.Of.iv);}Ef(){null!==this.tf&&(clearTimeout(this.tf),this.tf=null);}nv(t){if(null!==this.gf)return;const i=t.changedTouches[0];this.gf=i.identifier,this.wf=bs(t);const n=this.zf.ownerDocument.documentElement;this.hf=false,this.ef=false,this.mf=false,this.sf=ms(i),this.df&&(this.df(),this.df=null);{const i=this.Hf.bind(this),s=this.Gf.bind(this);this.df=()=>{n.removeEventListener("touchmove",i),n.removeEventListener("touchend",s);},n.addEventListener("touchmove",i,{passive:false}),n.addEventListener("touchend",s,{passive:false}),this.Ef(),this.tf=setTimeout(this.sv.bind(this,t),240);}const s=this.Cf(t,i);this.Rf(s,this.Of.ev),this.Jd||(this.Gd=0,this.Jd=setTimeout(this.Af.bind(this),500),this.Qd=ms(i));}rv(t){if(0!==t.button)return;const i=this.zf.ownerDocument.documentElement;ns()&&i.addEventListener("mouseleave",this.xf),this.rf=false,this.nf=ms(t),this.cf&&(this.cf(),this.cf=null);{const t=this.Kf.bind(this),n=this.Sf.bind(this);this.cf=()=>{i.removeEventListener("mousemove",t),i.removeEventListener("mouseup",n);},i.addEventListener("mousemove",t),i.addEventListener("mouseup",n);}if(this.bf=true,this.yf(t))return;const n=this.Cf(t);this.Bf(n,this.Of.hv),this.Kd||(this.Xd=0,this.Kd=setTimeout(this.If.bind(this),500),this.Zd=ms(t));}Lf(){this.zf.addEventListener("mouseenter",this.Nf.bind(this)),this.zf.addEventListener("touchcancel",this.Ef.bind(this));{const t=this.zf.ownerDocument,i=t=>{this.Of.lv&&(t.composed&&this.zf.contains(t.composedPath()[0])||t.target&&this.zf.contains(t.target)||this.Of.lv());};this.af=()=>{t.removeEventListener("touchstart",i);},this.lf=()=>{t.removeEventListener("mousedown",i);},t.addEventListener("mousedown",i),t.addEventListener("touchstart",i,{passive:true});}ss()&&(this._f=()=>{this.zf.removeEventListener("dblclick",this.kf);},this.zf.addEventListener("dblclick",this.kf)),this.zf.addEventListener("mouseleave",this.av.bind(this)),this.zf.addEventListener("touchstart",this.nv.bind(this),{passive:true}),ds(this.zf),this.zf.addEventListener("mousedown",this.rv.bind(this)),this.ov(),this.zf.addEventListener("touchmove",(()=>{}),{passive:false});}ov(){ void 0===this.Of._v&&void 0===this.Of.uv&&void 0===this.Of.cv||(this.zf.addEventListener("touchstart",(t=>this.dv(t.touches)),{passive:true}),this.zf.addEventListener("touchmove",(t=>{if(2===t.touches.length&&null!==this.ff&&void 0!==this.Of.uv){const i=vs(t.touches[0],t.touches[1])/this.vf;this.Of.uv(this.ff,i),ps(t);}}),{passive:false}),this.zf.addEventListener("touchend",(t=>{this.dv(t.touches);})));}dv(t){1===t.length&&(this.pf=false),2!==t.length||this.pf||this.if?this.fv():this.vv(t);}vv(t){const i=this.zf.getBoundingClientRect()||{left:0,top:0};this.ff={nt:(t[0].clientX-i.left+(t[1].clientX-i.left))/2,st:(t[0].clientY-i.top+(t[1].clientY-i.top))/2},this.vf=vs(t[0],t[1]),void 0!==this.Of._v&&this.Of._v(),this.Ef();}fv(){null!==this.ff&&(this.ff=null,void 0!==this.Of.cv&&this.Of.cv());}av(t){if(this.uf&&this.uf(),this.yf(t))return;if(!this.Mf)return;const i=this.Cf(t);this.Bf(i,this.Of.pv),this.Mf=!ss();}sv(t){const i=ws(t.touches,b(this.gf));if(null===i)return;const n=this.Cf(t,i);this.Rf(n,this.Of.mv),this.hf=true,this.if=true;}yf(t){return t.sourceCapabilities&&void 0!==t.sourceCapabilities.firesTouchEvents?t.sourceCapabilities.firesTouchEvents:bs(t)<this.wf+500}Rf(t,i){i&&i.call(this.Of,t);}Bf(t,i){i&&i.call(this.Of,t);}Cf(t,i){const n=i||t,s=this.zf.getBoundingClientRect()||{left:0,top:0};return {clientX:n.clientX,clientY:n.clientY,pageX:n.pageX,pageY:n.pageY,screenX:n.screenX,screenY:n.screenY,localX:n.clientX-s.left,localY:n.clientY-s.top,ctrlKey:t.ctrlKey,altKey:t.altKey,shiftKey:t.shiftKey,metaKey:t.metaKey,bv:!t.type.startsWith("mouse")&&"contextmenu"!==t.type&&"click"!==t.type,wv:t.type,gv:n.target,Mv:t.view,xv:()=>{"touchstart"!==t.type&&ps(t);}}}}function vs(t,i){const n=t.clientX-i.clientX,s=t.clientY-i.clientY;return Math.sqrt(n*n+s*s)}function ps(t){t.cancelable&&t.preventDefault();}function ms(t){return {nt:t.pageX,st:t.pageY}}function bs(t){return t.timeStamp||performance.now()}function ws(t,i){for(let n=0;n<t.length;++n)if(t[n].identifier===i)return t[n];return null}function gs(t){return {jc:t.jc,Sv:{wr:t.kv.externalId},yv:t.kv.cursorStyle}}function Ms(t,i,n){for(const s of t){const t=s.gt();if(null!==t&&t.br){const e=t.br(i,n);if(null!==e)return {Mv:s,Sv:e}}}return null}function xs(t,i){return n=>{var s,e,r,h;return (null!==(e=null===(s=n.Dt())||void 0===s?void 0:s.Ta())&&void 0!==e?e:"")!==i?[]:null!==(h=null===(r=n.ca)||void 0===r?void 0:r.call(n,t))&&void 0!==h?h:[]}}class Ss{constructor(i,n,s,e){this.Li=null,this.Cv=null,this.Tv=false,this.Pv=new ii(200),this.Jr=null,this.Rv=0,this.Dv=false,this.Ov=()=>{this.Dv||this.tn.Av().$t().$h();},this.Bv=()=>{this.Dv||this.tn.Av().$t().$h();},this.tn=i,this.cn=n,this.So=n.layout,this.Oc=s,this.Vv="left"===e,this.Iv=xs("normal",e),this.zv=xs("top",e),this.Lv=xs("bottom",e),this.Ev=document.createElement("div"),this.Ev.style.height="100%",this.Ev.style.overflow="hidden",this.Ev.style.width="25px",this.Ev.style.left="0",this.Ev.style.position="relative",this.Nv=as(this.Ev,size({width:16,height:16})),this.Nv.subscribeSuggestedBitmapSizeChanged(this.Ov);const r=this.Nv.canvasElement;r.style.position="absolute",r.style.zIndex="1",r.style.left="0",r.style.top="0",this.Fv=as(this.Ev,size({width:16,height:16})),this.Fv.subscribeSuggestedBitmapSizeChanged(this.Bv);const h=this.Fv.canvasElement;h.style.position="absolute",h.style.zIndex="2",h.style.left="0",h.style.top="0";const l={hv:this.Wv.bind(this),ev:this.Wv.bind(this),Zf:this.jv.bind(this),Xf:this.jv.bind(this),lv:this.Hv.bind(this),tv:this.$v.bind(this),Jf:this.$v.bind(this),Vf:this.Uv.bind(this),Df:this.Uv.bind(this),Wf:this.qv.bind(this),pv:this.Yv.bind(this)};this.Xv=new fs(this.Fv.canvasElement,l,{qf:()=>!this.cn.handleScroll.vertTouchDrag,Yf:()=>true});}S(){this.Xv.S(),this.Fv.unsubscribeSuggestedBitmapSizeChanged(this.Bv),os(this.Fv.canvasElement),this.Fv.dispose(),this.Nv.unsubscribeSuggestedBitmapSizeChanged(this.Ov),os(this.Nv.canvasElement),this.Nv.dispose(),null!==this.Li&&this.Li.Ko().p(this),this.Li=null;}Kv(){return this.Ev}P(){return this.So.fontSize}Zv(){const t=this.Oc.W();return this.Jr!==t.R&&(this.Pv.ir(),this.Jr=t.R),t}Gv(){if(null===this.Li)return 0;let t=0;const i=this.Zv(),n=b(this.Nv.canvasElement.getContext("2d"));n.save();const s=this.Li.ja();n.font=this.Jv(),s.length>0&&(t=Math.max(this.Pv.xi(n,s[0].no),this.Pv.xi(n,s[s.length-1].no)));const e=this.Qv();for(let i=e.length;i--;){const s=this.Pv.xi(n,e[i].Zt());s>t&&(t=s);}const r=this.Li.Ct();if(null!==r&&null!==this.Cv){const i=this.Li.pn(1,r),s=this.Li.pn(this.Cv.height-2,r);t=Math.max(t,this.Pv.xi(n,this.Li.Fi(Math.floor(Math.min(i,s))+.11111111111111,r)),this.Pv.xi(n,this.Li.Fi(Math.ceil(Math.max(i,s))-.11111111111111,r)));}n.restore();const h=t||34;return es(Math.ceil(i.C+i.T+i.V+i.I+5+h))}tp(t){null!==this.Cv&&equalSizes(this.Cv,t)||(this.Cv=t,this.Dv=true,this.Nv.resizeCanvasElement(t),this.Fv.resizeCanvasElement(t),this.Dv=false,this.Ev.style.width=`${t.width}px`,this.Ev.style.height=`${t.height}px`);}ip(){return b(this.Cv).width}Gi(t){this.Li!==t&&(null!==this.Li&&this.Li.Ko().p(this),this.Li=t,t.Ko().l(this.do.bind(this),this));}Dt(){return this.Li}ir(){const t=this.tn.np();this.tn.Av().$t().L_(t,b(this.Dt()));}sp(t){if(null===this.Cv)return;if(1!==t){this.ep(),this.Nv.applySuggestedBitmapSize();const t=tryCreateCanvasRenderingTarget2D(this.Nv);null!==t&&(t.useBitmapCoordinateSpace((t=>{this.rp(t),this.Ve(t);})),this.tn.hp(t,this.Lv),this.lp(t),this.tn.hp(t,this.Iv),this.ap(t));}this.Fv.applySuggestedBitmapSize();const i=tryCreateCanvasRenderingTarget2D(this.Fv);null!==i&&(i.useBitmapCoordinateSpace((({context:t,bitmapSize:i})=>{t.clearRect(0,0,i.width,i.height);})),this.op(i),this.tn.hp(i,this.zv));}_p(){return this.Nv.bitmapSize}up(t,i,n){const s=this._p();s.width>0&&s.height>0&&t.drawImage(this.Nv.canvasElement,i,n);}bt(){var t;null===(t=this.Li)||void 0===t||t.ja();}Wv(t){if(null===this.Li||this.Li.Ni()||!this.cn.handleScale.axisPressedMouseMove.price)return;const i=this.tn.Av().$t(),n=this.tn.np();this.Tv=true,i.D_(n,this.Li,t.localY);}jv(t){if(null===this.Li||!this.cn.handleScale.axisPressedMouseMove.price)return;const i=this.tn.Av().$t(),n=this.tn.np(),s=this.Li;i.O_(n,s,t.localY);}Hv(){if(null===this.Li||!this.cn.handleScale.axisPressedMouseMove.price)return;const t=this.tn.Av().$t(),i=this.tn.np(),n=this.Li;this.Tv&&(this.Tv=false,t.A_(i,n));}$v(t){if(null===this.Li||!this.cn.handleScale.axisPressedMouseMove.price)return;const i=this.tn.Av().$t(),n=this.tn.np();this.Tv=false,i.A_(n,this.Li);}Uv(t){this.cn.handleScale.axisDoubleClickReset.price&&this.ir();}qv(t){if(null===this.Li)return;!this.tn.Av().$t().W().handleScale.axisPressedMouseMove.price||this.Li.gh()||this.Li.Oo()||this.cp(1);}Yv(t){this.cp(0);}Qv(){const t=[],i=null===this.Li?void 0:this.Li;return (n=>{for(let s=0;s<n.length;++s){const e=n[s].Rn(this.tn.np(),i);for(let i=0;i<e.length;i++)t.push(e[i]);}})(this.tn.np().$o()),t}rp({context:t,bitmapSize:i}){const{width:n,height:s}=i,e=this.tn.np().$t(),r=e.q(),h=e.md();r===h?Z(t,0,0,n,s,r):Q(t,0,0,n,s,r,h);}Ve({context:t,bitmapSize:i,horizontalPixelRatio:n}){if(null===this.Cv||null===this.Li||!this.Li.W().borderVisible)return;t.fillStyle=this.Li.W().borderColor;const s=Math.max(1,Math.floor(this.Zv().C*n));let e;e=this.Vv?i.width-s:0,t.fillRect(e,0,s,i.height);}lp(t){if(null===this.Cv||null===this.Li)return;const i=this.Li.ja(),n=this.Li.W(),s=this.Zv(),e=this.Vv?this.Cv.width-s.T:0;n.borderVisible&&n.ticksVisible&&t.useBitmapCoordinateSpace((({context:t,horizontalPixelRatio:r,verticalPixelRatio:h})=>{t.fillStyle=n.borderColor;const l=Math.max(1,Math.floor(h)),a=Math.floor(.5*h),o=Math.round(s.T*r);t.beginPath();for(const n of i)t.rect(Math.floor(e*r),Math.round(n.La*h)-a,o,l);t.fill();})),t.useMediaCoordinateSpace((({context:t})=>{var r;t.font=this.Jv(),t.fillStyle=null!==(r=n.textColor)&&void 0!==r?r:this.So.textColor,t.textAlign=this.Vv?"right":"left",t.textBaseline="middle";const h=this.Vv?Math.round(e-s.V):Math.round(e+s.T+s.V),l=i.map((i=>this.Pv.Mi(t,i.no)));for(let n=i.length;n--;){const s=i[n];t.fillText(s.no,h,s.La+l[n]);}}));}ep(){if(null===this.Cv||null===this.Li)return;let t=this.Cv.height/2;const i=[],n=this.Li.$o().slice(),s=this.tn.np(),e=this.Zv();this.Li===s.vr()&&this.tn.np().$o().forEach((t=>{s.dr(t)&&n.push(t);}));const r=this.Li.Aa()[0],h=this.Li;n.forEach((n=>{const e=n.Rn(s,h);e.forEach((t=>{t.Ai(null),t.Bi()&&i.push(t);})),r===n&&e.length>0&&(t=e[0].ki());})),i.forEach((t=>t.Ai(t.ki())));this.Li.W().alignLabels&&this.dp(i,e,t);}dp(t,i,n){if(null===this.Cv)return;const s=t.filter((t=>t.ki()<=n)),e=t.filter((t=>t.ki()>n));s.sort(((t,i)=>i.ki()-t.ki())),s.length&&e.length&&e.push(s[0]),e.sort(((t,i)=>t.ki()-i.ki()));for(const n of t){const t=Math.floor(n.Vt(i)/2),s=n.ki();s>-t&&s<t&&n.Ai(t),s>this.Cv.height-t&&s<this.Cv.height+t&&n.Ai(this.Cv.height-t);}for(let t=1;t<s.length;t++){const n=s[t],e=s[t-1],r=e.Vt(i,false),h=n.ki(),l=e.Oi();h>l-r&&n.Ai(l-r);}for(let t=1;t<e.length;t++){const n=e[t],s=e[t-1],r=s.Vt(i,true),h=n.ki(),l=s.Oi();h<l+r&&n.Ai(l+r);}}ap(t){if(null===this.Cv)return;const i=this.Qv(),n=this.Zv(),s=this.Vv?"right":"left";i.forEach((i=>{if(i.Vi()){i.gt(b(this.Li)).K(t,n,this.Pv,s);}}));}op(t){if(null===this.Cv||null===this.Li)return;const i=this.tn.Av().$t(),n=[],s=this.tn.np(),e=i.Yc().Rn(s,this.Li);e.length&&n.push(e);const r=this.Zv(),h=this.Vv?"right":"left";n.forEach((i=>{i.forEach((i=>{i.gt(b(this.Li)).K(t,r,this.Pv,h);}));}));}cp(t){this.Ev.style.cursor=1===t?"ns-resize":"default";}do(){const t=this.Gv();this.Rv<t&&this.tn.Av().$t().Kl(),this.Rv=t;}Jv(){return N(this.So.fontSize,this.So.fontFamily)}}function ks(t,i){var n,s;return null!==(s=null===(n=t._a)||void 0===n?void 0:n.call(t,i))&&void 0!==s?s:[]}function ys(t,i){var n,s;return null!==(s=null===(n=t.Pn)||void 0===n?void 0:n.call(t,i))&&void 0!==s?s:[]}function Cs(t,i){var n,s;return null!==(s=null===(n=t.Ji)||void 0===n?void 0:n.call(t,i))&&void 0!==s?s:[]}function Ts(t,i){var n,s;return null!==(s=null===(n=t.la)||void 0===n?void 0:n.call(t,i))&&void 0!==s?s:[]}class Ps{constructor(i,n){this.Cv=size({width:0,height:0}),this.fp=null,this.vp=null,this.pp=null,this.mp=false,this.bp=new R,this.wp=new R,this.gp=0,this.Mp=false,this.xp=null,this.Sp=false,this.kp=null,this.yp=null,this.Dv=false,this.Ov=()=>{this.Dv||null===this.Cp||this.$i().$h();},this.Bv=()=>{this.Dv||null===this.Cp||this.$i().$h();},this.Tp=i,this.Cp=n,this.Cp.F_().l(this.Pp.bind(this),this,true),this.Rp=document.createElement("td"),this.Rp.style.padding="0",this.Rp.style.position="relative";const s=document.createElement("div");s.style.width="100%",s.style.height="100%",s.style.position="relative",s.style.overflow="hidden",this.Dp=document.createElement("td"),this.Dp.style.padding="0",this.Op=document.createElement("td"),this.Op.style.padding="0",this.Rp.appendChild(s),this.Nv=as(s,size({width:16,height:16})),this.Nv.subscribeSuggestedBitmapSizeChanged(this.Ov);const e=this.Nv.canvasElement;e.style.position="absolute",e.style.zIndex="1",e.style.left="0",e.style.top="0",this.Fv=as(s,size({width:16,height:16})),this.Fv.subscribeSuggestedBitmapSizeChanged(this.Bv);const r=this.Fv.canvasElement;r.style.position="absolute",r.style.zIndex="2",r.style.left="0",r.style.top="0",this.Ap=document.createElement("tr"),this.Ap.appendChild(this.Dp),this.Ap.appendChild(this.Rp),this.Ap.appendChild(this.Op),this.Bp(),this.Xv=new fs(this.Fv.canvasElement,this,{qf:()=>null===this.xp&&!this.Tp.W().handleScroll.vertTouchDrag,Yf:()=>null===this.xp&&!this.Tp.W().handleScroll.horzTouchDrag});}S(){null!==this.fp&&this.fp.S(),null!==this.vp&&this.vp.S(),this.Fv.unsubscribeSuggestedBitmapSizeChanged(this.Bv),os(this.Fv.canvasElement),this.Fv.dispose(),this.Nv.unsubscribeSuggestedBitmapSizeChanged(this.Ov),os(this.Nv.canvasElement),this.Nv.dispose(),null!==this.Cp&&this.Cp.F_().p(this),this.Xv.S();}np(){return b(this.Cp)}Vp(t){null!==this.Cp&&this.Cp.F_().p(this),this.Cp=t,null!==this.Cp&&this.Cp.F_().l(Ps.prototype.Pp.bind(this),this,true),this.Bp();}Av(){return this.Tp}Kv(){return this.Ap}Bp(){if(null!==this.Cp&&(this.Ip(),0!==this.$i().wt().length)){if(null!==this.fp){const t=this.Cp.P_();this.fp.Gi(b(t));}if(null!==this.vp){const t=this.Cp.R_();this.vp.Gi(b(t));}}}zp(){null!==this.fp&&this.fp.bt(),null!==this.vp&&this.vp.bt();}g_(){return null!==this.Cp?this.Cp.g_():0}M_(t){this.Cp&&this.Cp.M_(t);}Wf(t){if(!this.Cp)return;this.Lp();const i=t.localX,n=t.localY;this.Ep(i,n,t);}hv(t){this.Lp(),this.Np(),this.Ep(t.localX,t.localY,t);}jf(t){var i;if(!this.Cp)return;this.Lp();const n=t.localX,s=t.localY;this.Ep(n,s,t);const e=this.br(n,s);this.Tp.Fp(null!==(i=null==e?void 0:e.yv)&&void 0!==i?i:null),this.$i().Wc(e&&{jc:e.jc,Sv:e.Sv});}iv(t){null!==this.Cp&&(this.Lp(),this.Wp(t));}Vf(t){null!==this.Cp&&this.jp(this.wp,t);}Df(t){this.Vf(t);}Zf(t){this.Lp(),this.Hp(t),this.Ep(t.localX,t.localY,t);}tv(t){null!==this.Cp&&(this.Lp(),this.Mp=false,this.$p(t));}Qf(t){null!==this.Cp&&this.Wp(t);}mv(t){if(this.Mp=true,null===this.xp){const i={x:t.localX,y:t.localY};this.Up(i,i,t);}}pv(t){null!==this.Cp&&(this.Lp(),this.Cp.$t().Wc(null),this.qp());}Yp(){return this.bp}Xp(){return this.wp}_v(){this.gp=1,this.$i().Un();}uv(t,i){if(!this.Tp.W().handleScale.pinch)return;const n=5*(i-this.gp);this.gp=i,this.$i().Jc(t.nt,n);}ev(t){this.Mp=false,this.Sp=null!==this.xp,this.Np();const i=this.$i().Yc();null!==this.xp&&i.yt()&&(this.kp={x:i.Yt(),y:i.Xt()},this.xp={x:t.localX,y:t.localY});}Xf(t){if(null===this.Cp)return;const i=t.localX,n=t.localY;if(null===this.xp)this.Hp(t);else {this.Sp=false;const s=b(this.kp),e=s.x+(i-this.xp.x),r=s.y+(n-this.xp.y);this.Ep(e,r,t);}}Jf(t){0===this.Av().W().trackingMode.exitMode&&(this.Sp=true),this.Kp(),this.$p(t);}br(t,i){const n=this.Cp;return null===n?null:function(t,i,n){const s=t.$o(),e=function(t,i,n){var s,e;let r,h;for(const o of t){const t=null!==(e=null===(s=o.fa)||void 0===s?void 0:s.call(o,i,n))&&void 0!==e?e:[];for(const i of t)l=i.zOrder,(!(a=null==r?void 0:r.zOrder)||"top"===l&&"top"!==a||"normal"===l&&"bottom"===a)&&(r=i,h=o);}var l,a;return r&&h?{kv:r,jc:h}:null}(s,i,n);if("top"===(null==e?void 0:e.kv.zOrder))return gs(e);for(const r of s){if(e&&e.jc===r&&"bottom"!==e.kv.zOrder&&!e.kv.isBackground)return gs(e);const s=Ms(r.Pn(t),i,n);if(null!==s)return {jc:r,Mv:s.Mv,Sv:s.Sv};if(e&&e.jc===r&&"bottom"!==e.kv.zOrder&&e.kv.isBackground)return gs(e)}return (null==e?void 0:e.kv)?gs(e):null}(n,t,i)}Zp(i,n){b("left"===n?this.fp:this.vp).tp(size({width:i,height:this.Cv.height}));}Gp(){return this.Cv}tp(t){equalSizes(this.Cv,t)||(this.Cv=t,this.Dv=true,this.Nv.resizeCanvasElement(t),this.Fv.resizeCanvasElement(t),this.Dv=false,this.Rp.style.width=t.width+"px",this.Rp.style.height=t.height+"px");}Jp(){const t=b(this.Cp);t.T_(t.P_()),t.T_(t.R_());for(const i of t.Aa())if(t.dr(i)){const n=i.Dt();null!==n&&t.T_(n),i.On();}}_p(){return this.Nv.bitmapSize}up(t,i,n){const s=this._p();s.width>0&&s.height>0&&t.drawImage(this.Nv.canvasElement,i,n);}sp(t){if(0===t)return;if(null===this.Cp)return;if(t>1&&this.Jp(),null!==this.fp&&this.fp.sp(t),null!==this.vp&&this.vp.sp(t),1!==t){this.Nv.applySuggestedBitmapSize();const t=tryCreateCanvasRenderingTarget2D(this.Nv);null!==t&&(t.useBitmapCoordinateSpace((t=>{this.rp(t);})),this.Cp&&(this.Qp(t,ks),this.tm(t),this.im(t),this.Qp(t,ys),this.Qp(t,Cs)));}this.Fv.applySuggestedBitmapSize();const i=tryCreateCanvasRenderingTarget2D(this.Fv);null!==i&&(i.useBitmapCoordinateSpace((({context:t,bitmapSize:i})=>{t.clearRect(0,0,i.width,i.height);})),this.nm(i),this.Qp(i,Ts));}sm(){return this.fp}rm(){return this.vp}hp(t,i){this.Qp(t,i);}Pp(){null!==this.Cp&&this.Cp.F_().p(this),this.Cp=null;}Wp(t){this.jp(this.bp,t);}jp(t,i){const n=i.localX,s=i.localY;t.M()&&t.m(this.$i().St().Eu(n),{x:n,y:s},i);}rp({context:t,bitmapSize:i}){const{width:n,height:s}=i,e=this.$i(),r=e.q(),h=e.md();r===h?Z(t,0,0,n,s,h):Q(t,0,0,n,s,r,h);}tm(t){const i=b(this.Cp).W_().Uh().gt();null!==i&&i.K(t,false);}im(t){const i=this.$i().qc();this.hm(t,ys,_s,i),this.hm(t,ys,us,i);}nm(t){this.hm(t,ys,us,this.$i().Yc());}Qp(t,i){const n=b(this.Cp).$o();for(const s of n)this.hm(t,i,_s,s);for(const s of n)this.hm(t,i,us,s);}hm(t,i,n,s){const e=b(this.Cp),r=e.$t().Fc(),h=null!==r&&r.jc===s,l=null!==r&&h&&void 0!==r.Sv?r.Sv.gr:void 0;cs(i,(i=>n(i,t,h,l)),s,e);}Ip(){if(null===this.Cp)return;const t=this.Tp,i=this.Cp.P_().W().visible,n=this.Cp.R_().W().visible;i||null===this.fp||(this.Dp.removeChild(this.fp.Kv()),this.fp.S(),this.fp=null),n||null===this.vp||(this.Op.removeChild(this.vp.Kv()),this.vp.S(),this.vp=null);const s=t.$t()._d();i&&null===this.fp&&(this.fp=new Ss(this,t.W(),s,"left"),this.Dp.appendChild(this.fp.Kv())),n&&null===this.vp&&(this.vp=new Ss(this,t.W(),s,"right"),this.Op.appendChild(this.vp.Kv()));}lm(t){return t.bv&&this.Mp||null!==this.xp}am(t){return Math.max(0,Math.min(t,this.Cv.width-1))}om(t){return Math.max(0,Math.min(t,this.Cv.height-1))}Ep(t,i,n){this.$i().hd(this.am(t),this.om(i),n,b(this.Cp));}qp(){this.$i().ad();}Kp(){this.Sp&&(this.xp=null,this.qp());}Up(t,i,n){this.xp=t,this.Sp=false,this.Ep(i.x,i.y,n);const s=this.$i().Yc();this.kp={x:s.Yt(),y:s.Xt()};}$i(){return this.Tp.$t()}$p(t){if(!this.mp)return;const i=this.$i(),n=this.np();if(i.I_(n,n.vn()),this.pp=null,this.mp=false,i.sd(),null!==this.yp){const t=performance.now(),n=i.St();this.yp.Dr(n.ju(),t),this.yp.Ju(t)||i.Xn(this.yp);}}Lp(){this.xp=null;}Np(){if(!this.Cp)return;if(this.$i().Un(),document.activeElement!==document.body&&document.activeElement!==document.documentElement)b(document.activeElement).blur();else {const t=document.getSelection();null!==t&&t.removeAllRanges();}!this.Cp.vn().Ni()&&this.$i().St().Ni();}Hp(t){if(null===this.Cp)return;const i=this.$i(),n=i.St();if(n.Ni())return;const s=this.Tp.W(),e=s.handleScroll,r=s.kineticScroll;if((!e.pressedMouseMove||t.bv)&&(!e.horzTouchDrag&&!e.vertTouchDrag||!t.bv))return;const h=this.Cp.vn(),l=performance.now();if(null!==this.pp||this.lm(t)||(this.pp={x:t.clientX,y:t.clientY,Od:l,_m:t.localX,um:t.localY}),null!==this.pp&&!this.mp&&(this.pp.x!==t.clientX||this.pp.y!==t.clientY)){if(t.bv&&r.touch||!t.bv&&r.mouse){const t=n.he();this.yp=new ls(.2/t,7/t,.997,15/t),this.yp.qd(n.ju(),this.pp.Od);}else this.yp=null;h.Ni()||i.B_(this.Cp,h,t.localY),i.td(t.localX),this.mp=true;}this.mp&&(h.Ni()||i.V_(this.Cp,h,t.localY),i.nd(t.localX),null!==this.yp&&this.yp.qd(n.ju(),l));}}class Rs{constructor(i,n,s,e,r){this.ft=true,this.Cv=size({width:0,height:0}),this.Ov=()=>this.sp(3),this.Vv="left"===i,this.Oc=s._d,this.cn=n,this.dm=e,this.fm=r,this.Ev=document.createElement("div"),this.Ev.style.width="25px",this.Ev.style.height="100%",this.Ev.style.overflow="hidden",this.Nv=as(this.Ev,size({width:16,height:16})),this.Nv.subscribeSuggestedBitmapSizeChanged(this.Ov);}S(){this.Nv.unsubscribeSuggestedBitmapSizeChanged(this.Ov),os(this.Nv.canvasElement),this.Nv.dispose();}Kv(){return this.Ev}Gp(){return this.Cv}tp(t){equalSizes(this.Cv,t)||(this.Cv=t,this.Nv.resizeCanvasElement(t),this.Ev.style.width=`${t.width}px`,this.Ev.style.height=`${t.height}px`,this.ft=true);}sp(t){if(t<3&&!this.ft)return;if(0===this.Cv.width||0===this.Cv.height)return;this.ft=false,this.Nv.applySuggestedBitmapSize();const i=tryCreateCanvasRenderingTarget2D(this.Nv);null!==i&&i.useBitmapCoordinateSpace((t=>{this.rp(t),this.Ve(t);}));}_p(){return this.Nv.bitmapSize}up(t,i,n){const s=this._p();s.width>0&&s.height>0&&t.drawImage(this.Nv.canvasElement,i,n);}Ve({context:t,bitmapSize:i,horizontalPixelRatio:n,verticalPixelRatio:s}){if(!this.dm())return;t.fillStyle=this.cn.timeScale.borderColor;const e=Math.floor(this.Oc.W().C*n),r=Math.floor(this.Oc.W().C*s),h=this.Vv?i.width-e:0;t.fillRect(h,0,e,r);}rp({context:t,bitmapSize:i}){Z(t,0,0,i.width,i.height,this.fm());}}function Ds(t){return i=>{var n,s;return null!==(s=null===(n=i.da)||void 0===n?void 0:n.call(i,t))&&void 0!==s?s:[]}}const Os=Ds("normal"),As=Ds("top"),Bs=Ds("bottom");class Vs{constructor(i,n){this.vm=null,this.pm=null,this.k=null,this.bm=false,this.Cv=size({width:0,height:0}),this.wm=new R,this.Pv=new ii(5),this.Dv=false,this.Ov=()=>{this.Dv||this.Tp.$t().$h();},this.Bv=()=>{this.Dv||this.Tp.$t().$h();},this.Tp=i,this.U_=n,this.cn=i.W().layout,this.gm=document.createElement("tr"),this.Mm=document.createElement("td"),this.Mm.style.padding="0",this.xm=document.createElement("td"),this.xm.style.padding="0",this.Ev=document.createElement("td"),this.Ev.style.height="25px",this.Ev.style.padding="0",this.Sm=document.createElement("div"),this.Sm.style.width="100%",this.Sm.style.height="100%",this.Sm.style.position="relative",this.Sm.style.overflow="hidden",this.Ev.appendChild(this.Sm),this.Nv=as(this.Sm,size({width:16,height:16})),this.Nv.subscribeSuggestedBitmapSizeChanged(this.Ov);const s=this.Nv.canvasElement;s.style.position="absolute",s.style.zIndex="1",s.style.left="0",s.style.top="0",this.Fv=as(this.Sm,size({width:16,height:16})),this.Fv.subscribeSuggestedBitmapSizeChanged(this.Bv);const e=this.Fv.canvasElement;e.style.position="absolute",e.style.zIndex="2",e.style.left="0",e.style.top="0",this.gm.appendChild(this.Mm),this.gm.appendChild(this.Ev),this.gm.appendChild(this.xm),this.km(),this.Tp.$t().w_().l(this.km.bind(this),this),this.Xv=new fs(this.Fv.canvasElement,this,{qf:()=>true,Yf:()=>!this.Tp.W().handleScroll.horzTouchDrag});}S(){this.Xv.S(),null!==this.vm&&this.vm.S(),null!==this.pm&&this.pm.S(),this.Fv.unsubscribeSuggestedBitmapSizeChanged(this.Bv),os(this.Fv.canvasElement),this.Fv.dispose(),this.Nv.unsubscribeSuggestedBitmapSizeChanged(this.Ov),os(this.Nv.canvasElement),this.Nv.dispose();}Kv(){return this.gm}ym(){return this.vm}Cm(){return this.pm}hv(t){if(this.bm)return;this.bm=true;const i=this.Tp.$t();!i.St().Ni()&&this.Tp.W().handleScale.axisPressedMouseMove.time&&i.Gc(t.localX);}ev(t){this.hv(t);}lv(){const t=this.Tp.$t();!t.St().Ni()&&this.bm&&(this.bm=false,this.Tp.W().handleScale.axisPressedMouseMove.time&&t.rd());}Zf(t){const i=this.Tp.$t();!i.St().Ni()&&this.Tp.W().handleScale.axisPressedMouseMove.time&&i.ed(t.localX);}Xf(t){this.Zf(t);}tv(){this.bm=false;const t=this.Tp.$t();t.St().Ni()&&!this.Tp.W().handleScale.axisPressedMouseMove.time||t.rd();}Jf(){this.tv();}Vf(){this.Tp.W().handleScale.axisDoubleClickReset.time&&this.Tp.$t().Zn();}Df(){this.Vf();}Wf(){this.Tp.$t().W().handleScale.axisPressedMouseMove.time&&this.cp(1);}pv(){this.cp(0);}Gp(){return this.Cv}Tm(){return this.wm}Pm(i,s,e){equalSizes(this.Cv,i)||(this.Cv=i,this.Dv=true,this.Nv.resizeCanvasElement(i),this.Fv.resizeCanvasElement(i),this.Dv=false,this.Ev.style.width=`${i.width}px`,this.Ev.style.height=`${i.height}px`,this.wm.m(i)),null!==this.vm&&this.vm.tp(size({width:s,height:i.height})),null!==this.pm&&this.pm.tp(size({width:e,height:i.height}));}Rm(){const t=this.Dm();return Math.ceil(t.C+t.T+t.P+t.L+t.B+t.Om)}bt(){this.Tp.$t().St().ja();}_p(){return this.Nv.bitmapSize}up(t,i,n){const s=this._p();s.width>0&&s.height>0&&t.drawImage(this.Nv.canvasElement,i,n);}sp(t){if(0===t)return;if(1!==t){this.Nv.applySuggestedBitmapSize();const i=tryCreateCanvasRenderingTarget2D(this.Nv);null!==i&&(i.useBitmapCoordinateSpace((t=>{this.rp(t),this.Ve(t),this.Am(i,Bs);})),this.lp(i),this.Am(i,Os)),null!==this.vm&&this.vm.sp(t),null!==this.pm&&this.pm.sp(t);}this.Fv.applySuggestedBitmapSize();const i=tryCreateCanvasRenderingTarget2D(this.Fv);null!==i&&(i.useBitmapCoordinateSpace((({context:t,bitmapSize:i})=>{t.clearRect(0,0,i.width,i.height);})),this.Bm([...this.Tp.$t().wt(),this.Tp.$t().Yc()],i),this.Am(i,As));}Am(t,i){const n=this.Tp.$t().wt();for(const s of n)cs(i,(i=>_s(i,t,false,void 0)),s,void 0);for(const s of n)cs(i,(i=>us(i,t,false,void 0)),s,void 0);}rp({context:t,bitmapSize:i}){Z(t,0,0,i.width,i.height,this.Tp.$t().md());}Ve({context:t,bitmapSize:i,verticalPixelRatio:n}){if(this.Tp.W().timeScale.borderVisible){t.fillStyle=this.Vm();const s=Math.max(1,Math.floor(this.Dm().C*n));t.fillRect(0,0,i.width,s);}}lp(t){const i=this.Tp.$t().St(),n=i.ja();if(!n||0===n.length)return;const s=this.U_.maxTickMarkWeight(n),e=this.Dm(),r=i.W();r.borderVisible&&r.ticksVisible&&t.useBitmapCoordinateSpace((({context:t,horizontalPixelRatio:i,verticalPixelRatio:s})=>{t.strokeStyle=this.Vm(),t.fillStyle=this.Vm();const r=Math.max(1,Math.floor(i)),h=Math.floor(.5*i);t.beginPath();const l=Math.round(e.T*s);for(let s=n.length;s--;){const e=Math.round(n[s].coord*i);t.rect(e-h,0,r,l);}t.fill();})),t.useMediaCoordinateSpace((({context:t})=>{const i=e.C+e.T+e.L+e.P/2;t.textAlign="center",t.textBaseline="middle",t.fillStyle=this.$(),t.font=this.Jv();for(const e of n)if(e.weight<s){const n=e.needAlignCoordinate?this.Im(t,e.coord,e.label):e.coord;t.fillText(e.label,n,i);}this.Tp.W().timeScale.allowBoldLabels&&(t.font=this.zm());for(const e of n)if(e.weight>=s){const n=e.needAlignCoordinate?this.Im(t,e.coord,e.label):e.coord;t.fillText(e.label,n,i);}}));}Im(t,i,n){const s=this.Pv.xi(t,n),e=s/2,r=Math.floor(i-e)+.5;return r<0?i+=Math.abs(0-r):r+s>this.Cv.width&&(i-=Math.abs(this.Cv.width-(r+s))),i}Bm(t,i){const n=this.Dm();for(const s of t)for(const t of s.Qi())t.gt().K(i,n);}Vm(){return this.Tp.W().timeScale.borderColor}$(){return this.cn.textColor}j(){return this.cn.fontSize}Jv(){return N(this.j(),this.cn.fontFamily)}zm(){return N(this.j(),this.cn.fontFamily,"bold")}Dm(){null===this.k&&(this.k={C:1,N:NaN,L:NaN,B:NaN,ji:NaN,T:5,P:NaN,R:"",Wi:new ii,Om:0});const t=this.k,i=this.Jv();if(t.R!==i){const n=this.j();t.P=n,t.R=i,t.L=3*n/12,t.B=3*n/12,t.ji=9*n/12,t.N=0,t.Om=4*n/12,t.Wi.ir();}return this.k}cp(t){this.Ev.style.cursor=1===t?"ew-resize":"default";}km(){const t=this.Tp.$t(),i=t.W();i.leftPriceScale.visible||null===this.vm||(this.Mm.removeChild(this.vm.Kv()),this.vm.S(),this.vm=null),i.rightPriceScale.visible||null===this.pm||(this.xm.removeChild(this.pm.Kv()),this.pm.S(),this.pm=null);const n={_d:this.Tp.$t()._d()},s=()=>i.leftPriceScale.borderVisible&&t.St().W().borderVisible,e=()=>t.md();i.leftPriceScale.visible&&null===this.vm&&(this.vm=new Rs("left",i,n,s,e),this.Mm.appendChild(this.vm.Kv())),i.rightPriceScale.visible&&null===this.pm&&(this.pm=new Rs("right",i,n,s,e),this.xm.appendChild(this.pm.Kv()));}}const Is=!!is&&!!navigator.userAgentData&&navigator.userAgentData.brands.some((t=>t.brand.includes("Chromium")))&&!!is&&((null===(zs=null===navigator||void 0===navigator?void 0:navigator.userAgentData)||void 0===zs?void 0:zs.platform)?"Windows"===navigator.userAgentData.platform:navigator.userAgent.toLowerCase().indexOf("win")>=0);var zs;class Ls{constructor(t,i,n){var s;this.Lm=[],this.Em=0,this.ro=0,this.o_=0,this.Nm=0,this.Fm=0,this.Wm=null,this.jm=false,this.bp=new R,this.wp=new R,this.Pc=new R,this.Hm=null,this.$m=null,this.Um=t,this.cn=i,this.U_=n,this.gm=document.createElement("div"),this.gm.classList.add("tv-lightweight-charts"),this.gm.style.overflow="hidden",this.gm.style.direction="ltr",this.gm.style.width="100%",this.gm.style.height="100%",(s=this.gm).style.userSelect="none",s.style.webkitUserSelect="none",s.style.msUserSelect="none",s.style.MozUserSelect="none",s.style.webkitTapHighlightColor="transparent",this.qm=document.createElement("table"),this.qm.setAttribute("cellspacing","0"),this.gm.appendChild(this.qm),this.Ym=this.Xm.bind(this),Es(this.cn)&&this.Km(true),this.$i=new zn(this.Dc.bind(this),this.cn,n),this.$t().Xc().l(this.Zm.bind(this),this),this.Gm=new Vs(this,this.U_),this.qm.appendChild(this.Gm.Kv());const e=i.autoSize&&this.Jm();let r=this.cn.width,h=this.cn.height;if(e||0===r||0===h){const i=t.getBoundingClientRect();r=r||i.width,h=h||i.height;}this.Qm(r,h),this.tb(),t.appendChild(this.gm),this.ib(),this.$i.St().sc().l(this.$i.Kl.bind(this.$i),this),this.$i.w_().l(this.$i.Kl.bind(this.$i),this);}$t(){return this.$i}W(){return this.cn}nb(){return this.Lm}sb(){return this.Gm}S(){this.Km(false),0!==this.Em&&window.cancelAnimationFrame(this.Em),this.$i.Xc().p(this),this.$i.St().sc().p(this),this.$i.w_().p(this),this.$i.S();for(const t of this.Lm)this.qm.removeChild(t.Kv()),t.Yp().p(this),t.Xp().p(this),t.S();this.Lm=[],b(this.Gm).S(),null!==this.gm.parentElement&&this.gm.parentElement.removeChild(this.gm),this.Pc.S(),this.bp.S(),this.wp.S(),this.eb();}Qm(i,n,s=false){if(this.ro===n&&this.o_===i)return;const e=function(i){const n=Math.floor(i.width),s=Math.floor(i.height);return size({width:n-n%2,height:s-s%2})}(size({width:i,height:n}));this.ro=e.height,this.o_=e.width;const r=this.ro+"px",h=this.o_+"px";b(this.gm).style.height=r,b(this.gm).style.width=h,this.qm.style.height=r,this.qm.style.width=h,s?this.rb(_t.es(),performance.now()):this.$i.Kl();}sp(t){ void 0===t&&(t=_t.es());for(let i=0;i<this.Lm.length;i++)this.Lm[i].sp(t.Hn(i).Fn);this.cn.timeScale.visible&&this.Gm.sp(t.jn());}Hh(t){const i=Es(this.cn);this.$i.Hh(t);const n=Es(this.cn);n!==i&&this.Km(n),this.ib(),this.hb(t);}Yp(){return this.bp}Xp(){return this.wp}Xc(){return this.Pc}lb(){null!==this.Wm&&(this.rb(this.Wm,performance.now()),this.Wm=null);const t=this.ab(null),i=document.createElement("canvas");i.width=t.width,i.height=t.height;const n=b(i.getContext("2d"));return this.ab(n),i}ob(t){if("left"===t&&!this._b())return 0;if("right"===t&&!this.ub())return 0;if(0===this.Lm.length)return 0;return b("left"===t?this.Lm[0].sm():this.Lm[0].rm()).ip()}cb(){return this.cn.autoSize&&null!==this.Hm}fb(){return this.gm}Fp(t){this.$m=t,this.$m?this.fb().style.setProperty("cursor",t):this.fb().style.removeProperty("cursor");}pb(){return this.$m}mb(){return m(this.Lm[0]).Gp()}hb(t){(void 0!==t.autoSize||!this.Hm||void 0===t.width&&void 0===t.height)&&(t.autoSize&&!this.Hm&&this.Jm(),false===t.autoSize&&null!==this.Hm&&this.eb(),t.autoSize||void 0===t.width&&void 0===t.height||this.Qm(t.width||this.o_,t.height||this.ro));}ab(i){let n=0,s=0;const e=this.Lm[0],r=(t,n)=>{let s=0;for(let e=0;e<this.Lm.length;e++){const r=this.Lm[e],h=b("left"===t?r.sm():r.rm()),l=h._p();null!==i&&h.up(i,n,s),s+=l.height;}};if(this._b()){r("left",0);n+=b(e.sm())._p().width;}for(let t=0;t<this.Lm.length;t++){const e=this.Lm[t],r=e._p();null!==i&&e.up(i,n,s),s+=r.height;}if(n+=e._p().width,this.ub()){r("right",n);n+=b(e.rm())._p().width;}const h=(t,n,s)=>{b("left"===t?this.Gm.ym():this.Gm.Cm()).up(b(i),n,s);};if(this.cn.timeScale.visible){const t=this.Gm._p();if(null!==i){let n=0;this._b()&&(h("left",n,s),n=b(e.sm())._p().width),this.Gm.up(i,n,s),n+=t.width,this.ub()&&h("right",n,s);}s+=t.height;}return size({width:n,height:s})}bb(){let i=0,n=0,s=0;for(const t of this.Lm)this._b()&&(n=Math.max(n,b(t.sm()).Gv(),this.cn.leftPriceScale.minimumWidth)),this.ub()&&(s=Math.max(s,b(t.rm()).Gv(),this.cn.rightPriceScale.minimumWidth)),i+=t.g_();n=es(n),s=es(s);const e=this.o_,r=this.ro,h=Math.max(e-n-s,0),l=this.cn.timeScale.visible;let a=l?Math.max(this.Gm.Rm(),this.cn.timeScale.minimumHeight):0;var o;a=(o=a)+o%2;const _=0+a,u=r<_?0:r-_,c=u/i;let d=0;for(let i=0;i<this.Lm.length;++i){const e=this.Lm[i];e.Vp(this.$i.Uc()[i]);let r=0,l=0;l=i===this.Lm.length-1?u-d:Math.round(e.g_()*c),r=Math.max(l,2),d+=r,e.tp(size({width:h,height:r})),this._b()&&e.Zp(n,"left"),this.ub()&&e.Zp(s,"right"),e.np()&&this.$i.Kc(e.np(),r);}this.Gm.Pm(size({width:l?h:0,height:a}),l?n:0,l?s:0),this.$i.x_(h),this.Nm!==n&&(this.Nm=n),this.Fm!==s&&(this.Fm=s);}Km(t){t?this.gm.addEventListener("wheel",this.Ym,{passive:false}):this.gm.removeEventListener("wheel",this.Ym);}wb(t){switch(t.deltaMode){case t.DOM_DELTA_PAGE:return 120;case t.DOM_DELTA_LINE:return 32}return Is?1/window.devicePixelRatio:1}Xm(t){if(!(0!==t.deltaX&&this.cn.handleScroll.mouseWheel||0!==t.deltaY&&this.cn.handleScale.mouseWheel))return;const i=this.wb(t),n=i*t.deltaX/100,s=-i*t.deltaY/100;if(t.cancelable&&t.preventDefault(),0!==s&&this.cn.handleScale.mouseWheel){const i=Math.sign(s)*Math.min(1,Math.abs(s)),n=t.clientX-this.gm.getBoundingClientRect().left;this.$t().Jc(n,i);}0!==n&&this.cn.handleScroll.mouseWheel&&this.$t().Qc(-80*n);}rb(t,i){var n;const s=t.jn();3===s&&this.gb(),3!==s&&2!==s||(this.Mb(t),this.xb(t,i),this.Gm.bt(),this.Lm.forEach((t=>{t.zp();})),3===(null===(n=this.Wm)||void 0===n?void 0:n.jn())&&(this.Wm.ts(t),this.gb(),this.Mb(this.Wm),this.xb(this.Wm,i),t=this.Wm,this.Wm=null)),this.sp(t);}xb(t,i){for(const n of t.Qn())this.ns(n,i);}Mb(t){const i=this.$i.Uc();for(let n=0;n<i.length;n++)t.Hn(n).Wn&&i[n].E_();}ns(t,i){const n=this.$i.St();switch(t.qn){case 0:n.rc();break;case 1:n.hc(t.Ot);break;case 2:n.Gn(t.Ot);break;case 3:n.Jn(t.Ot);break;case 4:n.Uu();break;case 5:t.Ot.Ju(i)||n.Jn(t.Ot.Qu(i));}}Dc(t){null!==this.Wm?this.Wm.ts(t):this.Wm=t,this.jm||(this.jm=true,this.Em=window.requestAnimationFrame((t=>{if(this.jm=false,this.Em=0,null!==this.Wm){const i=this.Wm;this.Wm=null,this.rb(i,t);for(const n of i.Qn())if(5===n.qn&&!n.Ot.Ju(t)){this.$t().Xn(n.Ot);break}}})));}gb(){this.tb();}tb(){const t=this.$i.Uc(),i=t.length,n=this.Lm.length;for(let t=i;t<n;t++){const t=m(this.Lm.pop());this.qm.removeChild(t.Kv()),t.Yp().p(this),t.Xp().p(this),t.S();}for(let s=n;s<i;s++){const i=new Ps(this,t[s]);i.Yp().l(this.Sb.bind(this),this),i.Xp().l(this.kb.bind(this),this),this.Lm.push(i),this.qm.insertBefore(i.Kv(),this.Gm.Kv());}for(let n=0;n<i;n++){const i=t[n],s=this.Lm[n];s.np()!==i?s.Vp(i):s.Bp();}this.ib(),this.bb();}yb(t,i,n){var s;const e=new Map;if(null!==t){this.$i.wt().forEach((i=>{const n=i.In().hl(t);null!==n&&e.set(i,n);}));}let r;if(null!==t){const i=null===(s=this.$i.St().Ui(t))||void 0===s?void 0:s.originalTime;void 0!==i&&(r=i);}const h=this.$t().Fc(),l=null!==h&&h.jc instanceof Zi?h.jc:void 0,a=null!==h&&void 0!==h.Sv?h.Sv.wr:void 0;return {Cb:r,se:null!=t?t:void 0,Tb:null!=i?i:void 0,Pb:l,Rb:e,Db:a,Ob:null!=n?n:void 0}}Sb(t,i,n){this.bp.m((()=>this.yb(t,i,n)));}kb(t,i,n){this.wp.m((()=>this.yb(t,i,n)));}Zm(t,i,n){this.Pc.m((()=>this.yb(t,i,n)));}ib(){const t=this.cn.timeScale.visible?"":"none";this.Gm.Kv().style.display=t;}_b(){return this.Lm[0].np().P_().W().visible}ub(){return this.Lm[0].np().R_().W().visible}Jm(){return "ResizeObserver"in window&&(this.Hm=new ResizeObserver((t=>{const i=t.find((t=>t.target===this.Um));i&&this.Qm(i.contentRect.width,i.contentRect.height);})),this.Hm.observe(this.Um,{box:"border-box"}),true)}eb(){null!==this.Hm&&this.Hm.disconnect(),this.Hm=null;}}function Es(t){return Boolean(t.handleScroll.mouseWheel||t.handleScale.mouseWheel)}function Ns(t,i){var n={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&i.indexOf(s)<0&&(n[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var e=0;for(s=Object.getOwnPropertySymbols(t);e<s.length;e++)i.indexOf(s[e])<0&&Object.prototype.propertyIsEnumerable.call(t,s[e])&&(n[s[e]]=t[s[e]]);}return n}function Fs(t,i,n,s){const e=n.value,r={se:i,ot:t,Ot:[e,e,e,e],Cb:s};return void 0!==n.color&&(r.O=n.color),r}function Ws(t,i,n,s){const e=n.value,r={se:i,ot:t,Ot:[e,e,e,e],Cb:s};return void 0!==n.lineColor&&(r.lt=n.lineColor),void 0!==n.topColor&&(r.Ts=n.topColor),void 0!==n.bottomColor&&(r.Ps=n.bottomColor),r}function js(t,i,n,s){const e=n.value,r={se:i,ot:t,Ot:[e,e,e,e],Cb:s};return void 0!==n.topLineColor&&(r.Pe=n.topLineColor),void 0!==n.bottomLineColor&&(r.Re=n.bottomLineColor),void 0!==n.topFillColor1&&(r.Se=n.topFillColor1),void 0!==n.topFillColor2&&(r.ke=n.topFillColor2),void 0!==n.bottomFillColor1&&(r.ye=n.bottomFillColor1),void 0!==n.bottomFillColor2&&(r.Ce=n.bottomFillColor2),r}function Hs(t,i,n,s){const e={se:i,ot:t,Ot:[n.open,n.high,n.low,n.close],Cb:s};return void 0!==n.color&&(e.O=n.color),e}function $s(t,i,n,s){const e={se:i,ot:t,Ot:[n.open,n.high,n.low,n.close],Cb:s};return void 0!==n.color&&(e.O=n.color),void 0!==n.borderColor&&(e.At=n.borderColor),void 0!==n.wickColor&&(e.Xh=n.wickColor),e}function Us(t,i,n,s,e){const r=m(e)(n),h=Math.max(...r),l=Math.min(...r),a=r[r.length-1],o=[a,h,l,a],_=n,{time:u,color:c}=_;return {se:i,ot:t,Ot:o,Cb:s,He:Ns(_,["time","color"]),O:c}}function qs(t){return void 0!==t.Ot}function Ys(t,i){return void 0!==i.customValues&&(t.Ab=i.customValues),t}function Xs(t){return (i,n,s,e,r,h)=>function(t,i){return i?i(t):void 0===(n=t).open&&void 0===n.value;var n;}(s,h)?Ys({ot:i,se:n,Cb:e},s):Ys(t(i,n,s,e,r),s)}function Ks(t){return {Candlestick:Xs($s),Bar:Xs(Hs),Area:Xs(Ws),Baseline:Xs(js),Histogram:Xs(Fs),Line:Xs(Fs),Custom:Xs(Us)}[t]}function Zs(t){return {se:0,Bb:new Map,ha:t}}function Gs(t,i){if(void 0!==t&&0!==t.length)return {Vb:i.key(t[0].ot),Ib:i.key(t[t.length-1].ot)}}function Js(t){let i;return t.forEach((t=>{ void 0===i&&(i=t.Cb);})),m(i)}class Qs{constructor(t){this.zb=new Map,this.Lb=new Map,this.Eb=new Map,this.Nb=[],this.U_=t;}S(){this.zb.clear(),this.Lb.clear(),this.Eb.clear(),this.Nb=[];}Fb(t,i){let n=0!==this.zb.size,s=false;const e=this.Lb.get(t);if(void 0!==e)if(1===this.Lb.size)n=false,s=true,this.zb.clear();else for(const i of this.Nb)i.pointData.Bb.delete(t)&&(s=true);let r=[];if(0!==i.length){const n=i.map((t=>t.time)),e=this.U_.createConverterToInternalObj(i),h=Ks(t.Jh()),l=t.ya(),a=t.Ca();r=i.map(((i,r)=>{const o=e(i.time),_=this.U_.key(o);let u=this.zb.get(_);void 0===u&&(u=Zs(o),this.zb.set(_,u),s=true);const c=h(o,u.se,i,n[r],l,a);return u.Bb.set(t,c),c}));}n&&this.Wb(),this.jb(t,r);let h=-1;if(s){const t=[];this.zb.forEach((i=>{t.push({timeWeight:0,time:i.ha,pointData:i,originalTime:Js(i.Bb)});})),t.sort(((t,i)=>this.U_.key(t.time)-this.U_.key(i.time))),h=this.Hb(t);}return this.$b(t,h,function(t,i,n){const s=Gs(t,n),e=Gs(i,n);if(void 0!==s&&void 0!==e)return {Ql:s.Ib>=e.Ib&&s.Vb>=e.Vb}}(this.Lb.get(t),e,this.U_))}fd(t){return this.Fb(t,[])}Ub(t,i){const n=i;!function(t){ void 0===t.Cb&&(t.Cb=t.time);}(n),this.U_.preprocessData(i);const s=this.U_.createConverterToInternalObj([i])(i.time),e=this.Eb.get(t);if(void 0!==e&&this.U_.key(s)<this.U_.key(e))throw new Error(`Cannot update oldest data, last time=${e}, new time=${s}`);let r=this.zb.get(this.U_.key(s));const h=void 0===r;void 0===r&&(r=Zs(s),this.zb.set(this.U_.key(s),r));const l=Ks(t.Jh()),a=t.ya(),o=t.Ca(),_=l(s,r.se,i,n.Cb,a,o);r.Bb.set(t,_),this.qb(t,_);const u={Ql:qs(_)};if(!h)return this.$b(t,-1,u);const c={timeWeight:0,time:r.ha,pointData:r,originalTime:Js(r.Bb)},d=At(this.Nb,this.U_.key(c.time),((t,i)=>this.U_.key(t.time)<i));this.Nb.splice(d,0,c);for(let t=d;t<this.Nb.length;++t)te(this.Nb[t].pointData,t);return this.U_.fillWeightsForPoints(this.Nb,d),this.$b(t,d,u)}qb(t,i){let n=this.Lb.get(t);void 0===n&&(n=[],this.Lb.set(t,n));const s=0!==n.length?n[n.length-1]:null;null===s||this.U_.key(i.ot)>this.U_.key(s.ot)?qs(i)&&n.push(i):qs(i)?n[n.length-1]=i:n.splice(-1,1),this.Eb.set(t,i.ot);}jb(t,i){0!==i.length?(this.Lb.set(t,i.filter(qs)),this.Eb.set(t,i[i.length-1].ot)):(this.Lb.delete(t),this.Eb.delete(t));}Wb(){for(const t of this.Nb)0===t.pointData.Bb.size&&this.zb.delete(this.U_.key(t.time));}Hb(t){let i=-1;for(let n=0;n<this.Nb.length&&n<t.length;++n){const s=this.Nb[n],e=t[n];if(this.U_.key(s.time)!==this.U_.key(e.time)){i=n;break}e.timeWeight=s.timeWeight,te(e.pointData,n);}if(-1===i&&this.Nb.length!==t.length&&(i=Math.min(this.Nb.length,t.length)),-1===i)return -1;for(let n=i;n<t.length;++n)te(t[n].pointData,n);return this.U_.fillWeightsForPoints(t,i),this.Nb=t,i}Yb(){if(0===this.Lb.size)return null;let t=0;return this.Lb.forEach((i=>{0!==i.length&&(t=Math.max(t,i[i.length-1].se));})),t}$b(t,i,n){const s={Xb:new Map,St:{Lu:this.Yb()}};if(-1!==i)this.Lb.forEach(((i,e)=>{s.Xb.set(e,{He:i,Kb:e===t?n:void 0});})),this.Lb.has(t)||s.Xb.set(t,{He:[],Kb:n}),s.St.Zb=this.Nb,s.St.Gb=i;else {const i=this.Lb.get(t);s.Xb.set(t,{He:i||[],Kb:n});}return s}}function te(t,i){t.se=i,t.Bb.forEach((t=>{t.se=i;}));}function ie(t){const i={value:t.Ot[3],time:t.Cb};return void 0!==t.Ab&&(i.customValues=t.Ab),i}function ne(t){const i=ie(t);return void 0!==t.O&&(i.color=t.O),i}function se(t){const i=ie(t);return void 0!==t.lt&&(i.lineColor=t.lt),void 0!==t.Ts&&(i.topColor=t.Ts),void 0!==t.Ps&&(i.bottomColor=t.Ps),i}function ee(t){const i=ie(t);return void 0!==t.Pe&&(i.topLineColor=t.Pe),void 0!==t.Re&&(i.bottomLineColor=t.Re),void 0!==t.Se&&(i.topFillColor1=t.Se),void 0!==t.ke&&(i.topFillColor2=t.ke),void 0!==t.ye&&(i.bottomFillColor1=t.ye),void 0!==t.Ce&&(i.bottomFillColor2=t.Ce),i}function re(t){const i={open:t.Ot[0],high:t.Ot[1],low:t.Ot[2],close:t.Ot[3],time:t.Cb};return void 0!==t.Ab&&(i.customValues=t.Ab),i}function he(t){const i=re(t);return void 0!==t.O&&(i.color=t.O),i}function le(t){const i=re(t),{O:n,At:s,Xh:e}=t;return void 0!==n&&(i.color=n),void 0!==s&&(i.borderColor=s),void 0!==e&&(i.wickColor=e),i}function ae(t){return {Area:se,Line:ne,Baseline:ee,Histogram:ne,Bar:he,Candlestick:le,Custom:oe}[t]}function oe(t){const i=t.Cb;return Object.assign(Object.assign({},t.He),{time:i})}const _e={vertLine:{color:"#9598A1",width:1,style:3,visible:true,labelVisible:true,labelBackgroundColor:"#131722"},horzLine:{color:"#9598A1",width:1,style:3,visible:true,labelVisible:true,labelBackgroundColor:"#131722"},mode:1},ue={vertLines:{color:"#D6DCDE",style:0,visible:true},horzLines:{color:"#D6DCDE",style:0,visible:true}},ce={background:{type:"solid",color:"#FFFFFF"},textColor:"#191919",fontSize:12,fontFamily:E},de={autoScale:true,mode:0,invertScale:false,alignLabels:true,borderVisible:true,borderColor:"#2B2B43",entireTextOnly:false,visible:false,ticksVisible:false,scaleMargins:{bottom:.1,top:.2},minimumWidth:0},fe={rightOffset:0,barSpacing:6,minBarSpacing:.5,fixLeftEdge:false,fixRightEdge:false,lockVisibleTimeRangeOnResize:false,rightBarStaysOnScroll:false,borderVisible:true,borderColor:"#2B2B43",visible:true,timeVisible:false,secondsVisible:true,shiftVisibleRangeOnNewBar:true,allowShiftVisibleRangeOnWhitespaceReplacement:false,ticksVisible:false,uniformDistribution:false,minimumHeight:0,allowBoldLabels:true},ve={color:"rgba(0, 0, 0, 0)",visible:false,fontSize:48,fontFamily:E,fontStyle:"",text:"",horzAlign:"center",vertAlign:"center"};function pe(){return {width:0,height:0,autoSize:false,layout:ce,crosshair:_e,grid:ue,overlayPriceScales:Object.assign({},de),leftPriceScale:Object.assign(Object.assign({},de),{visible:false}),rightPriceScale:Object.assign(Object.assign({},de),{visible:true}),timeScale:fe,watermark:ve,localization:{locale:is?navigator.language:"",dateFormat:"dd MMM 'yy"},handleScroll:{mouseWheel:true,pressedMouseMove:true,horzTouchDrag:true,vertTouchDrag:true},handleScale:{axisPressedMouseMove:{time:true,price:true},axisDoubleClickReset:{time:true,price:true},mouseWheel:true,pinch:true},kineticScroll:{mouse:false,touch:true},trackingMode:{exitMode:1}}}class me{constructor(t,i){this.Jb=t,this.Qb=i;}applyOptions(t){this.Jb.$t().Hc(this.Qb,t);}options(){return this.Li().W()}width(){return ot(this.Qb)?this.Jb.ob(this.Qb):0}Li(){return b(this.Jb.$t().$c(this.Qb)).Dt}}function be(t,i,n){const s=Ns(t,["time","originalTime"]),e=Object.assign({time:i},s);return void 0!==n&&(e.originalTime=n),e}const we={color:"#FF0000",price:0,lineStyle:2,lineWidth:1,lineVisible:true,axisLabelVisible:true,title:"",axisLabelColor:"",axisLabelTextColor:""};class ge{constructor(t){this.Eh=t;}applyOptions(t){this.Eh.Hh(t);}options(){return this.Eh.W()}tw(){return this.Eh}}class Me{constructor(t,i,n,s,e){this.iw=new R,this.Ls=t,this.nw=i,this.sw=n,this.U_=e,this.ew=s;}S(){this.iw.S();}priceFormatter(){return this.Ls.ma()}priceToCoordinate(t){const i=this.Ls.Ct();return null===i?null:this.Ls.Dt().Rt(t,i.Ot)}coordinateToPrice(t){const i=this.Ls.Ct();return null===i?null:this.Ls.Dt().pn(t,i.Ot)}barsInLogicalRange(t){if(null===t)return null;const i=new kn(new Mn(t.from,t.to)).hu(),n=this.Ls.In();if(n.Ni())return null;const s=n.hl(i.Os(),1),e=n.hl(i.ui(),-1),r=b(n.sl()),h=b(n.Vn());if(null!==s&&null!==e&&s.se>e.se)return {barsBefore:t.from-r,barsAfter:h-t.to};const l={barsBefore:null===s||s.se===r?t.from-r:s.se-r,barsAfter:null===e||e.se===h?h-t.to:h-e.se};return null!==s&&null!==e&&(l.from=s.Cb,l.to=e.Cb),l}setData(t){this.U_,this.Ls.Jh(),this.nw.rw(this.Ls,t),this.hw("full");}update(t){this.Ls.Jh(),this.nw.lw(this.Ls,t),this.hw("update");}dataByIndex(t,i){const n=this.Ls.In().hl(t,i);if(null===n)return null;return ae(this.seriesType())(n)}data(){const t=ae(this.seriesType());return this.Ls.In().ie().map((i=>t(i)))}subscribeDataChanged(t){this.iw.l(t);}unsubscribeDataChanged(t){this.iw.v(t);}setMarkers(t){this.U_;const i=t.map((t=>be(t,this.U_.convertHorzItemToInternal(t.time),t.time)));this.Ls.ia(i);}markers(){return this.Ls.na().map((t=>be(t,t.originalTime,void 0)))}applyOptions(t){this.Ls.Hh(t);}options(){return I(this.Ls.W())}priceScale(){return this.sw.priceScale(this.Ls.Dt().Ta())}createPriceLine(t){const i=D(I(we),t),n=this.Ls.sa(i);return new ge(n)}removePriceLine(t){this.Ls.ea(t.tw());}seriesType(){return this.Ls.Jh()}attachPrimitive(t){this.Ls.Sa(t),t.attached&&t.attached({chart:this.ew,series:this,requestUpdate:()=>this.Ls.$t().Kl()});}detachPrimitive(t){this.Ls.ka(t),t.detached&&t.detached();}hw(t){this.iw.M()&&this.iw.m(t);}}class xe{constructor(t,i,n){this.aw=new R,this.pu=new R,this.wm=new R,this.$i=t,this.kl=t.St(),this.Gm=i,this.kl.tc().l(this.ow.bind(this)),this.kl.nc().l(this._w.bind(this)),this.Gm.Tm().l(this.uw.bind(this)),this.U_=n;}S(){this.kl.tc().p(this),this.kl.nc().p(this),this.Gm.Tm().p(this),this.aw.S(),this.pu.S(),this.wm.S();}scrollPosition(){return this.kl.ju()}scrollToPosition(t,i){i?this.kl.Gu(t,1e3):this.$i.Jn(t);}scrollToRealTime(){this.kl.Zu();}getVisibleRange(){const t=this.kl.Du();return null===t?null:{from:t.from.originalTime,to:t.to.originalTime}}setVisibleRange(t){const i={from:this.U_.convertHorzItemToInternal(t.from),to:this.U_.convertHorzItemToInternal(t.to)},n=this.kl.Vu(i);this.$i.vd(n);}getVisibleLogicalRange(){const t=this.kl.Ru();return null===t?null:{from:t.Os(),to:t.ui()}}setVisibleLogicalRange(t){p(t.from<=t.to,"The from index cannot be after the to index."),this.$i.vd(t);}resetTimeScale(){this.$i.Zn();}fitContent(){this.$i.rc();}logicalToCoordinate(t){const i=this.$i.St();return i.Ni()?null:i.It(t)}coordinateToLogical(t){return this.kl.Ni()?null:this.kl.Eu(t)}timeToCoordinate(t){const i=this.U_.convertHorzItemToInternal(t),n=this.kl.Da(i,false);return null===n?null:this.kl.It(n)}coordinateToTime(t){const i=this.$i.St(),n=i.Eu(t),s=i.Ui(n);return null===s?null:s.originalTime}width(){return this.Gm.Gp().width}height(){return this.Gm.Gp().height}subscribeVisibleTimeRangeChange(t){this.aw.l(t);}unsubscribeVisibleTimeRangeChange(t){this.aw.v(t);}subscribeVisibleLogicalRangeChange(t){this.pu.l(t);}unsubscribeVisibleLogicalRangeChange(t){this.pu.v(t);}subscribeSizeChange(t){this.wm.l(t);}unsubscribeSizeChange(t){this.wm.v(t);}applyOptions(t){this.kl.Hh(t);}options(){return Object.assign(Object.assign({},I(this.kl.W())),{barSpacing:this.kl.he()})}ow(){this.aw.M()&&this.aw.m(this.getVisibleRange());}_w(){this.pu.M()&&this.pu.m(this.getVisibleLogicalRange());}uw(t){this.wm.m(t.width,t.height);}}function Se(t){if(void 0===t||"custom"===t.type)return;const i=t;void 0!==i.minMove&&void 0===i.precision&&(i.precision=function(t){if(t>=1)return 0;let i=0;for(;i<8;i++){const n=Math.round(t);if(Math.abs(n-t)<1e-8)return i;t*=10;}return i}(i.minMove));}function ke(t){return function(t){if(V(t.handleScale)){const i=t.handleScale;t.handleScale={axisDoubleClickReset:{time:i,price:i},axisPressedMouseMove:{time:i,price:i},mouseWheel:i,pinch:i};}else if(void 0!==t.handleScale){const{axisPressedMouseMove:i,axisDoubleClickReset:n}=t.handleScale;V(i)&&(t.handleScale.axisPressedMouseMove={time:i,price:i}),V(n)&&(t.handleScale.axisDoubleClickReset={time:n,price:n});}const i=t.handleScroll;V(i)&&(t.handleScroll={horzTouchDrag:i,vertTouchDrag:i,mouseWheel:i,pressedMouseMove:i});}(t),t}class ye{constructor(t,i,n){this.cw=new Map,this.dw=new Map,this.fw=new R,this.pw=new R,this.mw=new R,this.bw=new Qs(i);const s=void 0===n?I(pe()):D(I(pe()),ke(n));this.U_=i,this.Jb=new Ls(t,s,i),this.Jb.Yp().l((t=>{this.fw.M()&&this.fw.m(this.ww(t()));}),this),this.Jb.Xp().l((t=>{this.pw.M()&&this.pw.m(this.ww(t()));}),this),this.Jb.Xc().l((t=>{this.mw.M()&&this.mw.m(this.ww(t()));}),this);const e=this.Jb.$t();this.gw=new xe(e,this.Jb.sb(),this.U_);}remove(){this.Jb.Yp().p(this),this.Jb.Xp().p(this),this.Jb.Xc().p(this),this.gw.S(),this.Jb.S(),this.cw.clear(),this.dw.clear(),this.fw.S(),this.pw.S(),this.mw.S(),this.bw.S();}resize(t,i,n){this.autoSizeActive()||this.Jb.Qm(t,i,n);}addCustomSeries(t,i){const n=w(t),s=Object.assign(Object.assign({},_),n.defaultOptions());return this.Mw("Custom",s,i,n)}addAreaSeries(t){return this.Mw("Area",l,t)}addBaselineSeries(t){return this.Mw("Baseline",a,t)}addBarSeries(t){return this.Mw("Bar",r,t)}addCandlestickSeries(t={}){return function(t){ void 0!==t.borderColor&&(t.borderUpColor=t.borderColor,t.borderDownColor=t.borderColor),void 0!==t.wickColor&&(t.wickUpColor=t.wickColor,t.wickDownColor=t.wickColor);}(t),this.Mw("Candlestick",e,t)}addHistogramSeries(t){return this.Mw("Histogram",o,t)}addLineSeries(t){return this.Mw("Line",h,t)}removeSeries(t){const i=m(this.cw.get(t)),n=this.bw.fd(i);this.Jb.$t().fd(i),this.xw(n),this.cw.delete(t),this.dw.delete(i);}rw(t,i){this.xw(this.bw.Fb(t,i));}lw(t,i){this.xw(this.bw.Ub(t,i));}subscribeClick(t){this.fw.l(t);}unsubscribeClick(t){this.fw.v(t);}subscribeCrosshairMove(t){this.mw.l(t);}unsubscribeCrosshairMove(t){this.mw.v(t);}subscribeDblClick(t){this.pw.l(t);}unsubscribeDblClick(t){this.pw.v(t);}priceScale(t){return new me(this.Jb,t)}timeScale(){return this.gw}applyOptions(t){this.Jb.Hh(ke(t));}options(){return this.Jb.W()}takeScreenshot(){return this.Jb.lb()}autoSizeActive(){return this.Jb.cb()}chartElement(){return this.Jb.fb()}paneSize(){const t=this.Jb.mb();return {height:t.height,width:t.width}}setCrosshairPosition(t,i,n){const s=this.cw.get(n);if(void 0===s)return;const e=this.Jb.$t().cr(s);null!==e&&this.Jb.$t().ld(t,i,e);}clearCrosshairPosition(){this.Jb.$t().ad(true);}Mw(t,i,n={},s){Se(n.priceFormat);const e=D(I(u),I(i),n),r=this.Jb.$t().ud(t,e,s),h=new Me(r,this,this,this,this.U_);return this.cw.set(h,r),this.dw.set(r,h),h}xw(t){const i=this.Jb.$t();i.od(t.St.Lu,t.St.Zb,t.St.Gb),t.Xb.forEach(((t,i)=>i.J(t.He,t.Kb))),i.Fu();}Sw(t){return m(this.dw.get(t))}ww(t){const i=new Map;t.Rb.forEach(((t,n)=>{const s=n.Jh(),e=ae(s)(t);if("Custom"!==s)p(function(t){return void 0!==t.open||void 0!==t.value}(e));else {const t=n.Ca();p(!t||false===t(e));}i.set(this.Sw(n),e);}));const n=void 0!==t.Pb&&this.dw.has(t.Pb)?this.Sw(t.Pb):void 0;return {time:t.Cb,logical:t.se,point:t.Tb,hoveredSeries:n,hoveredObjectId:t.Db,seriesData:i,sourceEvent:t.Ob}}}function Ce(t,i,n){let s;if(B(t)){const i=document.getElementById(t);p(null!==i,`Cannot find element in DOM with id=${t}`),s=i;}else s=t;const e=new ye(s,i,n);return i.setOptions(e.options()),e}function Te(t,i){return Ce(t,new ts,ts.Vd(i))}Object.assign(Object.assign({},u),_);
103480
+ const e={upColor:"#26a69a",downColor:"#ef5350",wickVisible:true,borderVisible:true,borderColor:"#378658",borderUpColor:"#26a69a",borderDownColor:"#ef5350",wickColor:"#737375",wickUpColor:"#26a69a",wickDownColor:"#ef5350"},r={upColor:"#26a69a",downColor:"#ef5350",openVisible:true,thinBars:true},h={color:"#2196f3",lineStyle:0,lineWidth:3,lineType:0,lineVisible:true,crosshairMarkerVisible:true,crosshairMarkerRadius:4,crosshairMarkerBorderColor:"",crosshairMarkerBorderWidth:2,crosshairMarkerBackgroundColor:"",lastPriceAnimation:0,pointMarkersVisible:false},l={topColor:"rgba( 46, 220, 135, 0.4)",bottomColor:"rgba( 40, 221, 100, 0)",invertFilledArea:false,lineColor:"#33D778",lineStyle:0,lineWidth:3,lineType:0,lineVisible:true,crosshairMarkerVisible:true,crosshairMarkerRadius:4,crosshairMarkerBorderColor:"",crosshairMarkerBorderWidth:2,crosshairMarkerBackgroundColor:"",lastPriceAnimation:0,pointMarkersVisible:false},a={baseValue:{type:"price",price:0},topFillColor1:"rgba(38, 166, 154, 0.28)",topFillColor2:"rgba(38, 166, 154, 0.05)",topLineColor:"rgba(38, 166, 154, 1)",bottomFillColor1:"rgba(239, 83, 80, 0.05)",bottomFillColor2:"rgba(239, 83, 80, 0.28)",bottomLineColor:"rgba(239, 83, 80, 1)",lineWidth:3,lineStyle:0,lineType:0,lineVisible:true,crosshairMarkerVisible:true,crosshairMarkerRadius:4,crosshairMarkerBorderColor:"",crosshairMarkerBorderWidth:2,crosshairMarkerBackgroundColor:"",lastPriceAnimation:0,pointMarkersVisible:false},o={color:"#26a69a",base:0},_={color:"#2196f3"},u={title:"",visible:true,lastValueVisible:true,priceLineVisible:true,priceLineSource:0,priceLineWidth:1,priceLineColor:"",priceLineStyle:2,baseLineVisible:true,baseLineWidth:1,baseLineColor:"#B2B5BE",baseLineStyle:0,priceFormat:{type:"price",precision:2,minMove:.01}};var c,d;function f(t,i){const n={0:[],1:[t.lineWidth,t.lineWidth],2:[2*t.lineWidth,2*t.lineWidth],3:[6*t.lineWidth,6*t.lineWidth],4:[t.lineWidth,4*t.lineWidth]}[i];t.setLineDash(n);}function v(t,i,n,s){t.beginPath();const e=t.lineWidth%2?.5:0;t.moveTo(n,i+e),t.lineTo(s,i+e),t.stroke();}function p(t,i){if(!t)throw new Error("Assertion failed"+(i?": "+i:""))}function m(t){if(void 0===t)throw new Error("Value is undefined");return t}function b(t){if(null===t)throw new Error("Value is null");return t}function w(t){return b(m(t))}!function(t){t[t.Simple=0]="Simple",t[t.WithSteps=1]="WithSteps",t[t.Curved=2]="Curved";}(c||(c={})),function(t){t[t.Solid=0]="Solid",t[t.Dotted=1]="Dotted",t[t.Dashed=2]="Dashed",t[t.LargeDashed=3]="LargeDashed",t[t.SparseDotted=4]="SparseDotted";}(d||(d={}));const g={khaki:"#f0e68c",azure:"#f0ffff",aliceblue:"#f0f8ff",ghostwhite:"#f8f8ff",gold:"#ffd700",goldenrod:"#daa520",gainsboro:"#dcdcdc",gray:"#808080",green:"#008000",honeydew:"#f0fff0",floralwhite:"#fffaf0",lightblue:"#add8e6",lightcoral:"#f08080",lemonchiffon:"#fffacd",hotpink:"#ff69b4",lightyellow:"#ffffe0",greenyellow:"#adff2f",lightgoldenrodyellow:"#fafad2",limegreen:"#32cd32",linen:"#faf0e6",lightcyan:"#e0ffff",magenta:"#f0f",maroon:"#800000",olive:"#808000",orange:"#ffa500",oldlace:"#fdf5e6",mediumblue:"#0000cd",transparent:"#0000",lime:"#0f0",lightpink:"#ffb6c1",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",midnightblue:"#191970",orchid:"#da70d6",mediumorchid:"#ba55d3",mediumturquoise:"#48d1cc",orangered:"#ff4500",royalblue:"#4169e1",powderblue:"#b0e0e6",red:"#f00",coral:"#ff7f50",turquoise:"#40e0d0",white:"#fff",whitesmoke:"#f5f5f5",wheat:"#f5deb3",teal:"#008080",steelblue:"#4682b4",bisque:"#ffe4c4",aquamarine:"#7fffd4",aqua:"#0ff",sienna:"#a0522d",silver:"#c0c0c0",springgreen:"#00ff7f",antiquewhite:"#faebd7",burlywood:"#deb887",brown:"#a52a2a",beige:"#f5f5dc",chocolate:"#d2691e",chartreuse:"#7fff00",cornflowerblue:"#6495ed",cornsilk:"#fff8dc",crimson:"#dc143c",cadetblue:"#5f9ea0",tomato:"#ff6347",fuchsia:"#f0f",blue:"#00f",salmon:"#fa8072",blanchedalmond:"#ffebcd",slateblue:"#6a5acd",slategray:"#708090",thistle:"#d8bfd8",tan:"#d2b48c",cyan:"#0ff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkgray:"#a9a9a9",blueviolet:"#8a2be2",black:"#000",darkmagenta:"#8b008b",darkslateblue:"#483d8b",darkkhaki:"#bdb76b",darkorchid:"#9932cc",darkorange:"#ff8c00",darkgreen:"#006400",darkred:"#8b0000",dodgerblue:"#1e90ff",darkslategray:"#2f4f4f",dimgray:"#696969",deepskyblue:"#00bfff",firebrick:"#b22222",forestgreen:"#228b22",indigo:"#4b0082",ivory:"#fffff0",lavenderblush:"#fff0f5",feldspar:"#d19275",indianred:"#cd5c5c",lightgreen:"#90ee90",lightgrey:"#d3d3d3",lightskyblue:"#87cefa",lightslategray:"#789",lightslateblue:"#8470ff",snow:"#fffafa",lightseagreen:"#20b2aa",lightsalmon:"#ffa07a",darksalmon:"#e9967a",darkviolet:"#9400d3",mediumpurple:"#9370d8",mediumaquamarine:"#66cdaa",skyblue:"#87ceeb",lavender:"#e6e6fa",lightsteelblue:"#b0c4de",mediumvioletred:"#c71585",mintcream:"#f5fffa",navajowhite:"#ffdead",navy:"#000080",olivedrab:"#6b8e23",palevioletred:"#d87093",violetred:"#d02090",yellow:"#ff0",yellowgreen:"#9acd32",lawngreen:"#7cfc00",pink:"#ffc0cb",paleturquoise:"#afeeee",palegoldenrod:"#eee8aa",darkolivegreen:"#556b2f",darkseagreen:"#8fbc8f",darkturquoise:"#00ced1",peachpuff:"#ffdab9",deeppink:"#ff1493",violet:"#ee82ee",palegreen:"#98fb98",mediumseagreen:"#3cb371",peru:"#cd853f",saddlebrown:"#8b4513",sandybrown:"#f4a460",rosybrown:"#bc8f8f",purple:"#800080",seagreen:"#2e8b57",seashell:"#fff5ee",papayawhip:"#ffefd5",mediumslateblue:"#7b68ee",plum:"#dda0dd",mediumspringgreen:"#00fa9a"};function M(t){return t<0?0:t>255?255:Math.round(t)||0}function x(t){return t<=0||t>1?Math.min(Math.max(t,0),1):Math.round(1e4*t)/1e4}const S=/^#([0-9a-f])([0-9a-f])([0-9a-f])([0-9a-f])?$/i,k=/^#([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})?$/i,y=/^rgb\(\s*(-?\d{1,10})\s*,\s*(-?\d{1,10})\s*,\s*(-?\d{1,10})\s*\)$/,C=/^rgba\(\s*(-?\d{1,10})\s*,\s*(-?\d{1,10})\s*,\s*(-?\d{1,10})\s*,\s*(-?\d*\.?\d+)\s*\)$/;function T(t){(t=t.toLowerCase())in g&&(t=g[t]);{const i=C.exec(t)||y.exec(t);if(i)return [M(parseInt(i[1],10)),M(parseInt(i[2],10)),M(parseInt(i[3],10)),x(i.length<5?1:parseFloat(i[4]))]}{const i=k.exec(t);if(i)return [M(parseInt(i[1],16)),M(parseInt(i[2],16)),M(parseInt(i[3],16)),1]}{const i=S.exec(t);if(i)return [M(17*parseInt(i[1],16)),M(17*parseInt(i[2],16)),M(17*parseInt(i[3],16)),1]}throw new Error(`Cannot parse color: ${t}`)}function P(t){const i=T(t);return {t:`rgb(${i[0]}, ${i[1]}, ${i[2]})`,i:(n=i,.199*n[0]+.687*n[1]+.114*n[2]>160?"black":"white")};var n;}class R{constructor(){this.h=[];}l(t,i,n){const s={o:t,_:i,u:true===n};this.h.push(s);}v(t){const i=this.h.findIndex((i=>t===i.o));i>-1&&this.h.splice(i,1);}p(t){this.h=this.h.filter((i=>i._!==t));}m(t,i,n){const s=[...this.h];this.h=this.h.filter((t=>!t.u)),s.forEach((s=>s.o(t,i,n)));}M(){return this.h.length>0}S(){this.h=[];}}function D(t,...i){for(const n of i)for(const i in n) void 0!==n[i]&&("object"!=typeof n[i]||void 0===t[i]||Array.isArray(n[i])?t[i]=n[i]:D(t[i],n[i]));return t}function O(t){return "number"==typeof t&&isFinite(t)}function A(t){return "number"==typeof t&&t%1==0}function B(t){return "string"==typeof t}function V(t){return "boolean"==typeof t}function I(t){const i=t;if(!i||"object"!=typeof i)return i;let n,s,e;for(s in n=Array.isArray(i)?[]:{},i)i.hasOwnProperty(s)&&(e=i[s],n[s]=e&&"object"==typeof e?I(e):e);return n}function z(t){return null!==t}function L(t){return null===t?void 0:t}const E="-apple-system, BlinkMacSystemFont, 'Trebuchet MS', Roboto, Ubuntu, sans-serif";function N(t,i,n){return void 0===i&&(i=E),`${n=void 0!==n?`${n} `:""}${t}px ${i}`}class F{constructor(t){this.k={C:1,T:5,P:NaN,R:"",D:"",O:"",A:"",B:0,V:0,I:0,L:0,N:0},this.F=t;}W(){const t=this.k,i=this.j(),n=this.H();return t.P===i&&t.D===n||(t.P=i,t.D=n,t.R=N(i,n),t.L=2.5/12*i,t.B=t.L,t.V=i/12*t.T,t.I=i/12*t.T,t.N=0),t.O=this.$(),t.A=this.U(),this.k}$(){return this.F.W().layout.textColor}U(){return this.F.q()}j(){return this.F.W().layout.fontSize}H(){return this.F.W().layout.fontFamily}}class W{constructor(){this.Y=[];}X(t){this.Y=t;}K(t,i,n){this.Y.forEach((s=>{s.K(t,i,n);}));}}class j{K(t,i,n){t.useBitmapCoordinateSpace((t=>this.Z(t,i,n)));}}class H extends j{constructor(){super(...arguments),this.G=null;}J(t){this.G=t;}Z({context:t,horizontalPixelRatio:i,verticalPixelRatio:n}){if(null===this.G||null===this.G.tt)return;const s=this.G.tt,e=this.G,r=Math.max(1,Math.floor(i))%2/2,h=h=>{t.beginPath();for(let l=s.to-1;l>=s.from;--l){const s=e.it[l],a=Math.round(s.nt*i)+r,o=s.st*n,_=h*n+r;t.moveTo(a,o),t.arc(a,o,_,0,2*Math.PI);}t.fill();};e.et>0&&(t.fillStyle=e.rt,h(e.ht+e.et)),t.fillStyle=e.lt,h(e.ht);}}function $(){return {it:[{nt:0,st:0,ot:0,_t:0}],lt:"",rt:"",ht:0,et:0,tt:null}}const U={from:0,to:1};class q{constructor(t,i){this.ut=new W,this.ct=[],this.dt=[],this.ft=true,this.F=t,this.vt=i,this.ut.X(this.ct);}bt(t){const i=this.F.wt();i.length!==this.ct.length&&(this.dt=i.map($),this.ct=this.dt.map((t=>{const i=new H;return i.J(t),i})),this.ut.X(this.ct)),this.ft=true;}gt(){return this.ft&&(this.Mt(),this.ft=false),this.ut}Mt(){const t=2===this.vt.W().mode,i=this.F.wt(),n=this.vt.xt(),s=this.F.St();i.forEach(((i,e)=>{var r;const h=this.dt[e],l=i.kt(n);if(t||null===l||!i.yt())return void(h.tt=null);const a=b(i.Ct());h.lt=l.Tt,h.ht=l.ht,h.et=l.Pt,h.it[0]._t=l._t,h.it[0].st=i.Dt().Rt(l._t,a.Ot),h.rt=null!==(r=l.At)&&void 0!==r?r:this.F.Bt(h.it[0].st/i.Dt().Vt()),h.it[0].ot=n,h.it[0].nt=s.It(n),h.tt=U;}));}}class Y extends j{constructor(t){super(),this.zt=t;}Z({context:t,bitmapSize:i,horizontalPixelRatio:n,verticalPixelRatio:s}){if(null===this.zt)return;const e=this.zt.Lt.yt,r=this.zt.Et.yt;if(!e&&!r)return;const h=Math.round(this.zt.nt*n),l=Math.round(this.zt.st*s);t.lineCap="butt",e&&h>=0&&(t.lineWidth=Math.floor(this.zt.Lt.et*n),t.strokeStyle=this.zt.Lt.O,t.fillStyle=this.zt.Lt.O,f(t,this.zt.Lt.Nt),function(t,i,n,s){t.beginPath();const e=t.lineWidth%2?.5:0;t.moveTo(i+e,n),t.lineTo(i+e,s),t.stroke();}(t,h,0,i.height)),r&&l>=0&&(t.lineWidth=Math.floor(this.zt.Et.et*s),t.strokeStyle=this.zt.Et.O,t.fillStyle=this.zt.Et.O,f(t,this.zt.Et.Nt),v(t,l,0,i.width));}}class X{constructor(t){this.ft=true,this.Ft={Lt:{et:1,Nt:0,O:"",yt:false},Et:{et:1,Nt:0,O:"",yt:false},nt:0,st:0},this.Wt=new Y(this.Ft),this.jt=t;}bt(){this.ft=true;}gt(){return this.ft&&(this.Mt(),this.ft=false),this.Wt}Mt(){const t=this.jt.yt(),i=b(this.jt.Ht()),n=i.$t().W().crosshair,s=this.Ft;if(2===n.mode)return s.Et.yt=false,void(s.Lt.yt=false);s.Et.yt=t&&this.jt.Ut(i),s.Lt.yt=t&&this.jt.qt(),s.Et.et=n.horzLine.width,s.Et.Nt=n.horzLine.style,s.Et.O=n.horzLine.color,s.Lt.et=n.vertLine.width,s.Lt.Nt=n.vertLine.style,s.Lt.O=n.vertLine.color,s.nt=this.jt.Yt(),s.st=this.jt.Xt();}}function K(t,i,n,s,e,r){t.fillRect(i+r,n,s-2*r,r),t.fillRect(i+r,n+e-r,s-2*r,r),t.fillRect(i,n,r,e),t.fillRect(i+s-r,n,r,e);}function Z(t,i,n,s,e,r){t.save(),t.globalCompositeOperation="copy",t.fillStyle=r,t.fillRect(i,n,s,e),t.restore();}function G(t,i,n,s,e,r){t.beginPath(),t.roundRect?t.roundRect(i,n,s,e,r):(t.lineTo(i+s-r[1],n),0!==r[1]&&t.arcTo(i+s,n,i+s,n+r[1],r[1]),t.lineTo(i+s,n+e-r[2]),0!==r[2]&&t.arcTo(i+s,n+e,i+s-r[2],n+e,r[2]),t.lineTo(i+r[3],n+e),0!==r[3]&&t.arcTo(i,n+e,i,n+e-r[3],r[3]),t.lineTo(i,n+r[0]),0!==r[0]&&t.arcTo(i,n,i+r[0],n,r[0]));}function J(t,i,n,s,e,r,h=0,l=[0,0,0,0],a=""){if(t.save(),!h||!a||a===r)return G(t,i,n,s,e,l),t.fillStyle=r,t.fill(),void t.restore();const o=h/2;var _;G(t,i+o,n+o,s-h,e-h,(_=-o,l.map((t=>0===t?t:t+_)))),"transparent"!==r&&(t.fillStyle=r,t.fill()),"transparent"!==a&&(t.lineWidth=h,t.strokeStyle=a,t.closePath(),t.stroke()),t.restore();}function Q(t,i,n,s,e,r,h){t.save(),t.globalCompositeOperation="copy";const l=t.createLinearGradient(0,0,0,e);l.addColorStop(0,r),l.addColorStop(1,h),t.fillStyle=l,t.fillRect(i,n,s,e),t.restore();}class tt{constructor(t,i){this.J(t,i);}J(t,i){this.zt=t,this.Kt=i;}Vt(t,i){return this.zt.yt?t.P+t.L+t.B:0}K(t,i,n,s){if(!this.zt.yt||0===this.zt.Zt.length)return;const e=this.zt.O,r=this.Kt.t,h=t.useBitmapCoordinateSpace((t=>{const h=t.context;h.font=i.R;const l=this.Gt(t,i,n,s),a=l.Jt,o=(t,i)=>{l.Qt?J(h,a.ti,a.ii,a.ni,a.si,t,a.ei,[a.ht,0,0,a.ht],i):J(h,a.ri,a.ii,a.ni,a.si,t,a.ei,[0,a.ht,a.ht,0],i);};return o(r,"transparent"),this.zt.hi&&(h.fillStyle=e,h.fillRect(a.ri,a.li,a.ai-a.ri,a.oi)),o("transparent",r),this.zt._i&&(h.fillStyle=i.A,h.fillRect(l.Qt?a.ui-a.ei:0,a.ii,a.ei,a.ci-a.ii)),l}));t.useMediaCoordinateSpace((({context:t})=>{const n=h.di;t.font=i.R,t.textAlign=h.Qt?"right":"left",t.textBaseline="middle",t.fillStyle=e,t.fillText(this.zt.Zt,n.fi,(n.ii+n.ci)/2+n.pi);}));}Gt(t,i,n,s){var e;const{context:r,bitmapSize:h,mediaSize:l,horizontalPixelRatio:a,verticalPixelRatio:o}=t,_=this.zt.hi||!this.zt.mi?i.T:0,u=this.zt.bi?i.C:0,c=i.L+this.Kt.wi,d=i.B+this.Kt.gi,f=i.V,v=i.I,p=this.zt.Zt,m=i.P,b=n.Mi(r,p),w=Math.ceil(n.xi(r,p)),g=m+c+d,M=i.C+f+v+w+_,x=Math.max(1,Math.floor(o));let S=Math.round(g*o);S%2!=x%2&&(S+=1);const k=u>0?Math.max(1,Math.floor(u*a)):0,y=Math.round(M*a),C=Math.round(_*a),T=null!==(e=this.Kt.Si)&&void 0!==e?e:this.Kt.ki,P=Math.round(T*o)-Math.floor(.5*o),R=Math.floor(P+x/2-S/2),D=R+S,O="right"===s,A=O?l.width-u:u,B=O?h.width-k:k;let V,I,z;return O?(V=B-y,I=B-C,z=A-_-f-u):(V=B+y,I=B+C,z=A+_+f),{Qt:O,Jt:{ii:R,li:P,ci:D,ni:y,si:S,ht:2*a,ei:k,ti:V,ri:B,ai:I,oi:x,ui:h.width},di:{ii:R/o,ci:D/o,fi:z,pi:b}}}}class it{constructor(t){this.yi={ki:0,t:"#000",gi:0,wi:0},this.Ci={Zt:"",yt:false,hi:true,mi:false,At:"",O:"#FFF",_i:false,bi:false},this.Ti={Zt:"",yt:false,hi:false,mi:true,At:"",O:"#FFF",_i:true,bi:true},this.ft=true,this.Pi=new(t||tt)(this.Ci,this.yi),this.Ri=new(t||tt)(this.Ti,this.yi);}Zt(){return this.Di(),this.Ci.Zt}ki(){return this.Di(),this.yi.ki}bt(){this.ft=true;}Vt(t,i=false){return Math.max(this.Pi.Vt(t,i),this.Ri.Vt(t,i))}Oi(){return this.yi.Si||0}Ai(t){this.yi.Si=t;}Bi(){return this.Di(),this.Ci.yt||this.Ti.yt}Vi(){return this.Di(),this.Ci.yt}gt(t){return this.Di(),this.Ci.hi=this.Ci.hi&&t.W().ticksVisible,this.Ti.hi=this.Ti.hi&&t.W().ticksVisible,this.Pi.J(this.Ci,this.yi),this.Ri.J(this.Ti,this.yi),this.Pi}Ii(){return this.Di(),this.Pi.J(this.Ci,this.yi),this.Ri.J(this.Ti,this.yi),this.Ri}Di(){this.ft&&(this.Ci.hi=true,this.Ti.hi=false,this.zi(this.Ci,this.Ti,this.yi));}}class nt extends it{constructor(t,i,n){super(),this.jt=t,this.Li=i,this.Ei=n;}zi(t,i,n){if(t.yt=false,2===this.jt.W().mode)return;const s=this.jt.W().horzLine;if(!s.labelVisible)return;const e=this.Li.Ct();if(!this.jt.yt()||this.Li.Ni()||null===e)return;const r=P(s.labelBackgroundColor);n.t=r.t,t.O=r.i;const h=2/12*this.Li.P();n.wi=h,n.gi=h;const l=this.Ei(this.Li);n.ki=l.ki,t.Zt=this.Li.Fi(l._t,e),t.yt=true;}}const st=/[1-9]/g;class et{constructor(){this.zt=null;}J(t){this.zt=t;}K(t,i){if(null===this.zt||false===this.zt.yt||0===this.zt.Zt.length)return;const n=t.useMediaCoordinateSpace((({context:t})=>(t.font=i.R,Math.round(i.Wi.xi(t,b(this.zt).Zt,st)))));if(n<=0)return;const s=i.ji,e=n+2*s,r=e/2,h=this.zt.Hi;let l=this.zt.ki,a=Math.floor(l-r)+.5;a<0?(l+=Math.abs(0-a),a=Math.floor(l-r)+.5):a+e>h&&(l-=Math.abs(h-(a+e)),a=Math.floor(l-r)+.5);const o=a+e,_=Math.ceil(0+i.C+i.T+i.L+i.P+i.B);t.useBitmapCoordinateSpace((({context:t,horizontalPixelRatio:n,verticalPixelRatio:s})=>{const e=b(this.zt);t.fillStyle=e.t;const r=Math.round(a*n),h=Math.round(0*s),l=Math.round(o*n),u=Math.round(_*s),c=Math.round(2*n);if(t.beginPath(),t.moveTo(r,h),t.lineTo(r,u-c),t.arcTo(r,u,r+c,u,c),t.lineTo(l-c,u),t.arcTo(l,u,l,u-c,c),t.lineTo(l,h),t.fill(),e.hi){const r=Math.round(e.ki*n),l=h,a=Math.round((l+i.T)*s);t.fillStyle=e.O;const o=Math.max(1,Math.floor(n)),_=Math.floor(.5*n);t.fillRect(r-_,l,o,a-l);}})),t.useMediaCoordinateSpace((({context:t})=>{const n=b(this.zt),e=0+i.C+i.T+i.L+i.P/2;t.font=i.R,t.textAlign="left",t.textBaseline="middle",t.fillStyle=n.O;const r=i.Wi.Mi(t,"Apr0");t.translate(a+s,e+r),t.fillText(n.Zt,0,0);}));}}class rt{constructor(t,i,n){this.ft=true,this.Wt=new et,this.Ft={yt:false,t:"#4c525e",O:"white",Zt:"",Hi:0,ki:NaN,hi:true},this.vt=t,this.$i=i,this.Ei=n;}bt(){this.ft=true;}gt(){return this.ft&&(this.Mt(),this.ft=false),this.Wt.J(this.Ft),this.Wt}Mt(){const t=this.Ft;if(t.yt=false,2===this.vt.W().mode)return;const i=this.vt.W().vertLine;if(!i.labelVisible)return;const n=this.$i.St();if(n.Ni())return;t.Hi=n.Hi();const s=this.Ei();if(null===s)return;t.ki=s.ki;const e=n.Ui(this.vt.xt());t.Zt=n.qi(b(e)),t.yt=true;const r=P(i.labelBackgroundColor);t.t=r.t,t.O=r.i,t.hi=n.W().ticksVisible;}}class ht{constructor(){this.Yi=null,this.Xi=0;}Ki(){return this.Xi}Zi(t){this.Xi=t;}Dt(){return this.Yi}Gi(t){this.Yi=t;}Ji(t){return []}Qi(){return []}yt(){return true}}var lt;!function(t){t[t.Normal=0]="Normal",t[t.Magnet=1]="Magnet",t[t.Hidden=2]="Hidden";}(lt||(lt={}));class at extends ht{constructor(t,i){super(),this.tn=null,this.nn=NaN,this.sn=0,this.en=true,this.rn=new Map,this.hn=false,this.ln=NaN,this.an=NaN,this._n=NaN,this.un=NaN,this.$i=t,this.cn=i,this.dn=new q(t,this);this.fn=((t,i)=>n=>{const s=i(),e=t();if(n===b(this.tn).vn())return {_t:e,ki:s};{const t=b(n.Ct());return {_t:n.pn(s,t),ki:s}}})((()=>this.nn),(()=>this.an));const n=((t,i)=>()=>{const n=this.$i.St().mn(t()),s=i();return n&&Number.isFinite(s)?{ot:n,ki:s}:null})((()=>this.sn),(()=>this.Yt()));this.bn=new rt(this,t,n),this.wn=new X(this);}W(){return this.cn}gn(t,i){this._n=t,this.un=i;}Mn(){this._n=NaN,this.un=NaN;}xn(){return this._n}Sn(){return this.un}kn(t,i,n){this.hn||(this.hn=true),this.en=true,this.yn(t,i,n);}xt(){return this.sn}Yt(){return this.ln}Xt(){return this.an}yt(){return this.en}Cn(){this.en=false,this.Tn(),this.nn=NaN,this.ln=NaN,this.an=NaN,this.tn=null,this.Mn();}Pn(t){return null!==this.tn?[this.wn,this.dn]:[]}Ut(t){return t===this.tn&&this.cn.horzLine.visible}qt(){return this.cn.vertLine.visible}Rn(t,i){this.en&&this.tn===t||this.rn.clear();const n=[];return this.tn===t&&n.push(this.Dn(this.rn,i,this.fn)),n}Qi(){return this.en?[this.bn]:[]}Ht(){return this.tn}On(){this.wn.bt(),this.rn.forEach((t=>t.bt())),this.bn.bt(),this.dn.bt();}An(t){return t&&!t.vn().Ni()?t.vn():null}yn(t,i,n){this.Bn(t,i,n)&&this.On();}Bn(t,i,n){const s=this.ln,e=this.an,r=this.nn,h=this.sn,l=this.tn,a=this.An(n);this.sn=t,this.ln=isNaN(t)?NaN:this.$i.St().It(t),this.tn=n;const o=null!==a?a.Ct():null;return null!==a&&null!==o?(this.nn=i,this.an=a.Rt(i,o)):(this.nn=NaN,this.an=NaN),s!==this.ln||e!==this.an||h!==this.sn||r!==this.nn||l!==this.tn}Tn(){const t=this.$i.wt().map((t=>t.In().Vn())).filter(z),i=0===t.length?null:Math.max(...t);this.sn=null!==i?i:NaN;}Dn(t,i,n){let s=t.get(i);return void 0===s&&(s=new nt(this,i,n),t.set(i,s)),s}}function ot(t){return "left"===t||"right"===t}class _t{constructor(t){this.zn=new Map,this.Ln=[],this.En=t;}Nn(t,i){const n=function(t,i){return void 0===t?i:{Fn:Math.max(t.Fn,i.Fn),Wn:t.Wn||i.Wn}}(this.zn.get(t),i);this.zn.set(t,n);}jn(){return this.En}Hn(t){const i=this.zn.get(t);return void 0===i?{Fn:this.En}:{Fn:Math.max(this.En,i.Fn),Wn:i.Wn}}$n(){this.Un(),this.Ln=[{qn:0}];}Yn(t){this.Un(),this.Ln=[{qn:1,Ot:t}];}Xn(t){this.Kn(),this.Ln.push({qn:5,Ot:t});}Un(){this.Kn(),this.Ln.push({qn:6});}Zn(){this.Un(),this.Ln=[{qn:4}];}Gn(t){this.Un(),this.Ln.push({qn:2,Ot:t});}Jn(t){this.Un(),this.Ln.push({qn:3,Ot:t});}Qn(){return this.Ln}ts(t){for(const i of t.Ln)this.ns(i);this.En=Math.max(this.En,t.En),t.zn.forEach(((t,i)=>{this.Nn(i,t);}));}static ss(){return new _t(2)}static es(){return new _t(3)}ns(t){switch(t.qn){case 0:this.$n();break;case 1:this.Yn(t.Ot);break;case 2:this.Gn(t.Ot);break;case 3:this.Jn(t.Ot);break;case 4:this.Zn();break;case 5:this.Xn(t.Ot);break;case 6:this.Kn();}}Kn(){const t=this.Ln.findIndex((t=>5===t.qn));-1!==t&&this.Ln.splice(t,1);}}const ut=".";function ct(t,i){if(!O(t))return "n/a";if(!A(i))throw new TypeError("invalid length");if(i<0||i>16)throw new TypeError("invalid length");if(0===i)return t.toString();return ("0000000000000000"+t.toString()).slice(-i)}class dt{constructor(t,i){if(i||(i=1),O(t)&&A(t)||(t=100),t<0)throw new TypeError("invalid base");this.Li=t,this.rs=i,this.hs();}format(t){const i=t<0?"−":"";return t=Math.abs(t),i+this.ls(t)}hs(){if(this.os=0,this.Li>0&&this.rs>0){let t=this.Li;for(;t>1;)t/=10,this.os++;}}ls(t){const i=this.Li/this.rs;let n=Math.floor(t),s="";const e=void 0!==this.os?this.os:NaN;if(i>1){let r=+(Math.round(t*i)-n*i).toFixed(this.os);r>=i&&(r-=i,n+=1),s=ut+ct(+r.toFixed(this.os)*this.rs,e);}else n=Math.round(n*i)/i,e>0&&(s=ut+ct(0,e));return n.toFixed(0)+s}}class ft extends dt{constructor(t=100){super(t);}format(t){return `${super.format(t)}%`}}class vt{constructor(t){this._s=t;}format(t){let i="";return t<0&&(i="-",t=-t),t<995?i+this.us(t):t<999995?i+this.us(t/1e3)+"K":t<999999995?(t=1e3*Math.round(t/1e3),i+this.us(t/1e6)+"M"):(t=1e6*Math.round(t/1e6),i+this.us(t/1e9)+"B")}us(t){let i;const n=Math.pow(10,this._s);return i=(t=Math.round(t*n)/n)>=1e-15&&t<1?t.toFixed(this._s).replace(/\.?0+$/,""):String(t),i.replace(/(\.[1-9]*)0+$/,((t,i)=>i))}}function pt(t,i,n,s,e,r,h){if(0===i.length||s.from>=i.length||s.to<=0)return;const{context:l,horizontalPixelRatio:a,verticalPixelRatio:o}=t,_=i[s.from];let u=r(t,_),c=_;if(s.to-s.from<2){const i=e/2;l.beginPath();const n={nt:_.nt-i,st:_.st},s={nt:_.nt+i,st:_.st};l.moveTo(n.nt*a,n.st*o),l.lineTo(s.nt*a,s.st*o),h(t,u,n,s);}else {const e=(i,n)=>{h(t,u,c,n),l.beginPath(),u=i,c=n;};let d=c;l.beginPath(),l.moveTo(_.nt*a,_.st*o);for(let h=s.from+1;h<s.to;++h){d=i[h];const s=r(t,d);switch(n){case 0:l.lineTo(d.nt*a,d.st*o);break;case 1:l.lineTo(d.nt*a,i[h-1].st*o),s!==u&&(e(s,d),l.lineTo(d.nt*a,i[h-1].st*o)),l.lineTo(d.nt*a,d.st*o);break;case 2:{const[t,n]=gt(i,h-1,h);l.bezierCurveTo(t.nt*a,t.st*o,n.nt*a,n.st*o,d.nt*a,d.st*o);break}}1!==n&&s!==u&&(e(s,d),l.moveTo(d.nt*a,d.st*o));}(c!==d||c===d&&1===n)&&h(t,u,c,d);}}const mt=6;function bt(t,i){return {nt:t.nt-i.nt,st:t.st-i.st}}function wt(t,i){return {nt:t.nt/i,st:t.st/i}}function gt(t,i,n){const s=Math.max(0,i-1),e=Math.min(t.length-1,n+1);var r,h;return [(r=t[i],h=wt(bt(t[n],t[s]),mt),{nt:r.nt+h.nt,st:r.st+h.st}),bt(t[n],wt(bt(t[e],t[i]),mt))]}function Mt(t,i,n,s,e){const{context:r,horizontalPixelRatio:h,verticalPixelRatio:l}=i;r.lineTo(e.nt*h,t*l),r.lineTo(s.nt*h,t*l),r.closePath(),r.fillStyle=n,r.fill();}class xt extends j{constructor(){super(...arguments),this.G=null;}J(t){this.G=t;}Z(t){var i;if(null===this.G)return;const{it:n,tt:s,cs:e,et:r,Nt:h,ds:l}=this.G,a=null!==(i=this.G.fs)&&void 0!==i?i:this.G.vs?0:t.mediaSize.height;if(null===s)return;const o=t.context;o.lineCap="butt",o.lineJoin="round",o.lineWidth=r,f(o,h),o.lineWidth=1,pt(t,n,l,s,e,this.ps.bind(this),Mt.bind(null,a));}}function St(t,i,n){return Math.min(Math.max(t,i),n)}function kt(t,i,n){return i-t<=n}function yt(t){const i=Math.ceil(t);return i%2==0?i-1:i}class Ct{bs(t,i){const n=this.ws,{gs:s,Ms:e,xs:r,Ss:h,ks:l,fs:a}=i;if(void 0===this.ys||void 0===n||n.gs!==s||n.Ms!==e||n.xs!==r||n.Ss!==h||n.fs!==a||n.ks!==l){const n=t.context.createLinearGradient(0,0,0,l);if(n.addColorStop(0,s),null!=a){const i=St(a*t.verticalPixelRatio/l,0,1);n.addColorStop(i,e),n.addColorStop(i,r);}n.addColorStop(1,h),this.ys=n,this.ws=i;}return this.ys}}class Tt extends xt{constructor(){super(...arguments),this.Cs=new Ct;}ps(t,i){return this.Cs.bs(t,{gs:i.Ts,Ms:"",xs:"",Ss:i.Ps,ks:t.bitmapSize.height})}}function Pt(t,i){const n=t.context;n.strokeStyle=i,n.stroke();}class Rt extends j{constructor(){super(...arguments),this.G=null;}J(t){this.G=t;}Z(t){if(null===this.G)return;const{it:i,tt:n,cs:s,ds:e,et:r,Nt:h,Rs:l}=this.G;if(null===n)return;const a=t.context;a.lineCap="butt",a.lineWidth=r*t.verticalPixelRatio,f(a,h),a.lineJoin="round";const o=this.Ds.bind(this);void 0!==e&&pt(t,i,e,n,s,o,Pt),l&&function(t,i,n,s,e){const{horizontalPixelRatio:r,verticalPixelRatio:h,context:l}=t;let a=null;const o=Math.max(1,Math.floor(r))%2/2,_=n*h+o;for(let n=s.to-1;n>=s.from;--n){const s=i[n];if(s){const i=e(t,s);i!==a&&(l.beginPath(),null!==a&&l.fill(),l.fillStyle=i,a=i);const n=Math.round(s.nt*r)+o,u=s.st*h;l.moveTo(n,u),l.arc(n,u,_,0,2*Math.PI);}}l.fill();}(t,i,l,n,o);}}class Dt extends Rt{Ds(t,i){return i.lt}}function Ot(t,i,n,s,e=0,r=i.length){let h=r-e;for(;0<h;){const r=h>>1,l=e+r;s(i[l],n)===t?(e=l+1,h-=r+1):h=r;}return e}const At=Ot.bind(null,true),Bt=Ot.bind(null,false);function Vt(t,i){return t.ot<i}function It(t,i){return i<t.ot}function zt(t,i,n){const s=i.Os(),e=i.ui(),r=At(t,s,Vt),h=Bt(t,e,It);if(!n)return {from:r,to:h};let l=r,a=h;return r>0&&r<t.length&&t[r].ot>=s&&(l=r-1),h>0&&h<t.length&&t[h-1].ot<=e&&(a=h+1),{from:l,to:a}}class Lt{constructor(t,i,n){this.As=true,this.Bs=true,this.Vs=true,this.Is=[],this.zs=null,this.Ls=t,this.Es=i,this.Ns=n;}bt(t){this.As=true,"data"===t&&(this.Bs=true),"options"===t&&(this.Vs=true);}gt(){return this.Ls.yt()?(this.Fs(),null===this.zs?null:this.Ws):null}js(){this.Is=this.Is.map((t=>Object.assign(Object.assign({},t),this.Ls.$s().Hs(t.ot))));}Us(){this.zs=null;}Fs(){this.Bs&&(this.qs(),this.Bs=false),this.Vs&&(this.js(),this.Vs=false),this.As&&(this.Ys(),this.As=false);}Ys(){const t=this.Ls.Dt(),i=this.Es.St();if(this.Us(),i.Ni()||t.Ni())return;const n=i.Xs();if(null===n)return;if(0===this.Ls.In().Ks())return;const s=this.Ls.Ct();null!==s&&(this.zs=zt(this.Is,n,this.Ns),this.Zs(t,i,s.Ot),this.Gs());}}class Et extends Lt{constructor(t,i){super(t,i,true);}Zs(t,i,n){i.Js(this.Is,L(this.zs)),t.Qs(this.Is,n,L(this.zs));}te(t,i){return {ot:t,_t:i,nt:NaN,st:NaN}}qs(){const t=this.Ls.$s();this.Is=this.Ls.In().ie().map((i=>{const n=i.Ot[3];return this.ne(i.se,n,t)}));}}class Nt extends Et{constructor(t,i){super(t,i),this.Ws=new W,this.ee=new Tt,this.re=new Dt,this.Ws.X([this.ee,this.re]);}ne(t,i,n){return Object.assign(Object.assign({},this.te(t,i)),n.Hs(t))}Gs(){const t=this.Ls.W();this.ee.J({ds:t.lineType,it:this.Is,Nt:t.lineStyle,et:t.lineWidth,fs:null,vs:t.invertFilledArea,tt:this.zs,cs:this.Es.St().he()}),this.re.J({ds:t.lineVisible?t.lineType:void 0,it:this.Is,Nt:t.lineStyle,et:t.lineWidth,tt:this.zs,cs:this.Es.St().he(),Rs:t.pointMarkersVisible?t.pointMarkersRadius||t.lineWidth/2+2:void 0});}}class Ft extends j{constructor(){super(...arguments),this.zt=null,this.le=0,this.ae=0;}J(t){this.zt=t;}Z({context:t,horizontalPixelRatio:i,verticalPixelRatio:n}){if(null===this.zt||0===this.zt.In.length||null===this.zt.tt)return;if(this.le=this.oe(i),this.le>=2){Math.max(1,Math.floor(i))%2!=this.le%2&&this.le--;}this.ae=this.zt._e?Math.min(this.le,Math.floor(i)):this.le;let s=null;const e=this.ae<=this.le&&this.zt.he>=Math.floor(1.5*i);for(let r=this.zt.tt.from;r<this.zt.tt.to;++r){const h=this.zt.In[r];s!==h.ue&&(t.fillStyle=h.ue,s=h.ue);const l=Math.floor(.5*this.ae),a=Math.round(h.nt*i),o=a-l,_=this.ae,u=o+_-1,c=Math.min(h.ce,h.de),d=Math.max(h.ce,h.de),f=Math.round(c*n)-l,v=Math.round(d*n)+l,p=Math.max(v-f,this.ae);t.fillRect(o,f,_,p);const m=Math.ceil(1.5*this.le);if(e){if(this.zt.fe){const i=a-m;let s=Math.max(f,Math.round(h.ve*n)-l),e=s+_-1;e>f+p-1&&(e=f+p-1,s=e-_+1),t.fillRect(i,s,o-i,e-s+1);}const i=a+m;let s=Math.max(f,Math.round(h.pe*n)-l),e=s+_-1;e>f+p-1&&(e=f+p-1,s=e-_+1),t.fillRect(u+1,s,i-u,e-s+1);}}}oe(t){const i=Math.floor(t);return Math.max(i,Math.floor(function(t,i){return Math.floor(.3*t*i)}(b(this.zt).he,t)))}}class Wt extends Lt{constructor(t,i){super(t,i,false);}Zs(t,i,n){i.Js(this.Is,L(this.zs)),t.me(this.Is,n,L(this.zs));}be(t,i,n){return {ot:t,we:i.Ot[0],ge:i.Ot[1],Me:i.Ot[2],xe:i.Ot[3],nt:NaN,ve:NaN,ce:NaN,de:NaN,pe:NaN}}qs(){const t=this.Ls.$s();this.Is=this.Ls.In().ie().map((i=>this.ne(i.se,i,t)));}}class jt extends Wt{constructor(){super(...arguments),this.Ws=new Ft;}ne(t,i,n){return Object.assign(Object.assign({},this.be(t,i,n)),n.Hs(t))}Gs(){const t=this.Ls.W();this.Ws.J({In:this.Is,he:this.Es.St().he(),fe:t.openVisible,_e:t.thinBars,tt:this.zs});}}class Ht extends xt{constructor(){super(...arguments),this.Cs=new Ct;}ps(t,i){const n=this.G;return this.Cs.bs(t,{gs:i.Se,Ms:i.ke,xs:i.ye,Ss:i.Ce,ks:t.bitmapSize.height,fs:n.fs})}}class $t extends Rt{constructor(){super(...arguments),this.Te=new Ct;}Ds(t,i){const n=this.G;return this.Te.bs(t,{gs:i.Pe,Ms:i.Pe,xs:i.Re,Ss:i.Re,ks:t.bitmapSize.height,fs:n.fs})}}class Ut extends Et{constructor(t,i){super(t,i),this.Ws=new W,this.De=new Ht,this.Oe=new $t,this.Ws.X([this.De,this.Oe]);}ne(t,i,n){return Object.assign(Object.assign({},this.te(t,i)),n.Hs(t))}Gs(){const t=this.Ls.Ct();if(null===t)return;const i=this.Ls.W(),n=this.Ls.Dt().Rt(i.baseValue.price,t.Ot),s=this.Es.St().he();this.De.J({it:this.Is,et:i.lineWidth,Nt:i.lineStyle,ds:i.lineType,fs:n,vs:false,tt:this.zs,cs:s}),this.Oe.J({it:this.Is,et:i.lineWidth,Nt:i.lineStyle,ds:i.lineVisible?i.lineType:void 0,Rs:i.pointMarkersVisible?i.pointMarkersRadius||i.lineWidth/2+2:void 0,fs:n,tt:this.zs,cs:s});}}class qt extends j{constructor(){super(...arguments),this.zt=null,this.le=0;}J(t){this.zt=t;}Z(t){if(null===this.zt||0===this.zt.In.length||null===this.zt.tt)return;const{horizontalPixelRatio:i}=t;if(this.le=function(t,i){if(t>=2.5&&t<=4)return Math.floor(3*i);const n=1-.2*Math.atan(Math.max(4,t)-4)/(.5*Math.PI),s=Math.floor(t*n*i),e=Math.floor(t*i),r=Math.min(s,e);return Math.max(Math.floor(i),r)}(this.zt.he,i),this.le>=2){Math.floor(i)%2!=this.le%2&&this.le--;}const n=this.zt.In;this.zt.Ae&&this.Be(t,n,this.zt.tt),this.zt._i&&this.Ve(t,n,this.zt.tt);const s=this.Ie(i);(!this.zt._i||this.le>2*s)&&this.ze(t,n,this.zt.tt);}Be(t,i,n){if(null===this.zt)return;const{context:s,horizontalPixelRatio:e,verticalPixelRatio:r}=t;let h="",l=Math.min(Math.floor(e),Math.floor(this.zt.he*e));l=Math.max(Math.floor(e),Math.min(l,this.le));const a=Math.floor(.5*l);let o=null;for(let t=n.from;t<n.to;t++){const n=i[t];n.Le!==h&&(s.fillStyle=n.Le,h=n.Le);const _=Math.round(Math.min(n.ve,n.pe)*r),u=Math.round(Math.max(n.ve,n.pe)*r),c=Math.round(n.ce*r),d=Math.round(n.de*r);let f=Math.round(e*n.nt)-a;const v=f+l-1;null!==o&&(f=Math.max(o+1,f),f=Math.min(f,v));const p=v-f+1;s.fillRect(f,c,p,_-c),s.fillRect(f,u+1,p,d-u),o=v;}}Ie(t){let i=Math.floor(1*t);this.le<=2*i&&(i=Math.floor(.5*(this.le-1)));const n=Math.max(Math.floor(t),i);return this.le<=2*n?Math.max(Math.floor(t),Math.floor(1*t)):n}Ve(t,i,n){if(null===this.zt)return;const{context:s,horizontalPixelRatio:e,verticalPixelRatio:r}=t;let h="";const l=this.Ie(e);let a=null;for(let t=n.from;t<n.to;t++){const n=i[t];n.Ee!==h&&(s.fillStyle=n.Ee,h=n.Ee);let o=Math.round(n.nt*e)-Math.floor(.5*this.le);const _=o+this.le-1,u=Math.round(Math.min(n.ve,n.pe)*r),c=Math.round(Math.max(n.ve,n.pe)*r);if(null!==a&&(o=Math.max(a+1,o),o=Math.min(o,_)),this.zt.he*e>2*l)K(s,o,u,_-o+1,c-u+1,l);else {const t=_-o+1;s.fillRect(o,u,t,c-u+1);}a=_;}}ze(t,i,n){if(null===this.zt)return;const{context:s,horizontalPixelRatio:e,verticalPixelRatio:r}=t;let h="";const l=this.Ie(e);for(let t=n.from;t<n.to;t++){const n=i[t];let a=Math.round(Math.min(n.ve,n.pe)*r),o=Math.round(Math.max(n.ve,n.pe)*r),_=Math.round(n.nt*e)-Math.floor(.5*this.le),u=_+this.le-1;if(n.ue!==h){const t=n.ue;s.fillStyle=t,h=t;}this.zt._i&&(_+=l,a+=l,u-=l,o-=l),a>o||s.fillRect(_,a,u-_+1,o-a+1);}}}class Yt extends Wt{constructor(){super(...arguments),this.Ws=new qt;}ne(t,i,n){return Object.assign(Object.assign({},this.be(t,i,n)),n.Hs(t))}Gs(){const t=this.Ls.W();this.Ws.J({In:this.Is,he:this.Es.St().he(),Ae:t.wickVisible,_i:t.borderVisible,tt:this.zs});}}class Xt{constructor(t,i){this.Ne=t,this.Li=i;}K(t,i,n){this.Ne.draw(t,this.Li,i,n);}}class Kt extends Lt{constructor(t,i,n){super(t,i,false),this.wn=n,this.Ws=new Xt(this.wn.renderer(),(i=>{const n=t.Ct();return null===n?null:t.Dt().Rt(i,n.Ot)}));}Fe(t){return this.wn.priceValueBuilder(t)}We(t){return this.wn.isWhitespace(t)}qs(){const t=this.Ls.$s();this.Is=this.Ls.In().ie().map((i=>Object.assign(Object.assign({ot:i.se,nt:NaN},t.Hs(i.se)),{je:i.He})));}Zs(t,i){i.Js(this.Is,L(this.zs));}Gs(){this.wn.update({bars:this.Is.map(Zt),barSpacing:this.Es.St().he(),visibleRange:this.zs},this.Ls.W());}}function Zt(t){return {x:t.nt,time:t.ot,originalData:t.je,barColor:t.ue}}class Gt extends j{constructor(){super(...arguments),this.zt=null,this.$e=[];}J(t){this.zt=t,this.$e=[];}Z({context:t,horizontalPixelRatio:i,verticalPixelRatio:n}){if(null===this.zt||0===this.zt.it.length||null===this.zt.tt)return;this.$e.length||this.Ue(i);const s=Math.max(1,Math.floor(n)),e=Math.round(this.zt.qe*n)-Math.floor(s/2),r=e+s;for(let i=this.zt.tt.from;i<this.zt.tt.to;i++){const h=this.zt.it[i],l=this.$e[i-this.zt.tt.from],a=Math.round(h.st*n);let o,_;t.fillStyle=h.ue,a<=e?(o=a,_=r):(o=e,_=a-Math.floor(s/2)+s),t.fillRect(l.Os,o,l.ui-l.Os+1,_-o);}}Ue(t){if(null===this.zt||0===this.zt.it.length||null===this.zt.tt)return void(this.$e=[]);const i=Math.ceil(this.zt.he*t)<=1?0:Math.max(1,Math.floor(t)),n=Math.round(this.zt.he*t)-i;this.$e=new Array(this.zt.tt.to-this.zt.tt.from);for(let i=this.zt.tt.from;i<this.zt.tt.to;i++){const s=this.zt.it[i],e=Math.round(s.nt*t);let r,h;if(n%2){const t=(n-1)/2;r=e-t,h=e+t;}else {const t=n/2;r=e-t,h=e+t-1;}this.$e[i-this.zt.tt.from]={Os:r,ui:h,Ye:e,Xe:s.nt*t,ot:s.ot};}for(let t=this.zt.tt.from+1;t<this.zt.tt.to;t++){const n=this.$e[t-this.zt.tt.from],s=this.$e[t-this.zt.tt.from-1];n.ot===s.ot+1&&(n.Os-s.ui!==i+1&&(s.Ye>s.Xe?s.ui=n.Os-i-1:n.Os=s.ui+i+1));}let s=Math.ceil(this.zt.he*t);for(let t=this.zt.tt.from;t<this.zt.tt.to;t++){const i=this.$e[t-this.zt.tt.from];i.ui<i.Os&&(i.ui=i.Os);const n=i.ui-i.Os+1;s=Math.min(n,s);}if(i>0&&s<4)for(let t=this.zt.tt.from;t<this.zt.tt.to;t++){const i=this.$e[t-this.zt.tt.from];i.ui-i.Os+1>s&&(i.Ye>i.Xe?i.ui-=1:i.Os+=1);}}}class Jt extends Et{constructor(){super(...arguments),this.Ws=new Gt;}ne(t,i,n){return Object.assign(Object.assign({},this.te(t,i)),n.Hs(t))}Gs(){const t={it:this.Is,he:this.Es.St().he(),tt:this.zs,qe:this.Ls.Dt().Rt(this.Ls.W().base,b(this.Ls.Ct()).Ot)};this.Ws.J(t);}}class Qt extends Et{constructor(){super(...arguments),this.Ws=new Dt;}ne(t,i,n){return Object.assign(Object.assign({},this.te(t,i)),n.Hs(t))}Gs(){const t=this.Ls.W(),i={it:this.Is,Nt:t.lineStyle,ds:t.lineVisible?t.lineType:void 0,et:t.lineWidth,Rs:t.pointMarkersVisible?t.pointMarkersRadius||t.lineWidth/2+2:void 0,tt:this.zs,cs:this.Es.St().he()};this.Ws.J(i);}}const ti=/[2-9]/g;class ii{constructor(t=50){this.Ke=0,this.Ze=1,this.Ge=1,this.Je={},this.Qe=new Map,this.tr=t;}ir(){this.Ke=0,this.Qe.clear(),this.Ze=1,this.Ge=1,this.Je={};}xi(t,i,n){return this.nr(t,i,n).width}Mi(t,i,n){const s=this.nr(t,i,n);return ((s.actualBoundingBoxAscent||0)-(s.actualBoundingBoxDescent||0))/2}nr(t,i,n){const s=n||ti,e=String(i).replace(s,"0");if(this.Qe.has(e))return m(this.Qe.get(e)).sr;if(this.Ke===this.tr){const t=this.Je[this.Ge];delete this.Je[this.Ge],this.Qe.delete(t),this.Ge++,this.Ke--;}t.save(),t.textBaseline="middle";const r=t.measureText(e);return t.restore(),0===r.width&&i.length||(this.Qe.set(e,{sr:r,er:this.Ze}),this.Je[this.Ze]=e,this.Ke++,this.Ze++),r}}class ni{constructor(t){this.rr=null,this.k=null,this.hr="right",this.lr=t;}ar(t,i,n){this.rr=t,this.k=i,this.hr=n;}K(t){null!==this.k&&null!==this.rr&&this.rr.K(t,this.k,this.lr,this.hr);}}class si{constructor(t,i,n){this._r=t,this.lr=new ii(50),this.ur=i,this.F=n,this.j=-1,this.Wt=new ni(this.lr);}gt(){const t=this.F.cr(this.ur);if(null===t)return null;const i=t.dr(this.ur)?t.vr():this.ur.Dt();if(null===i)return null;const n=t.pr(i);if("overlay"===n)return null;const s=this.F.mr();return s.P!==this.j&&(this.j=s.P,this.lr.ir()),this.Wt.ar(this._r.Ii(),s,n),this.Wt}}class ei extends j{constructor(){super(...arguments),this.zt=null;}J(t){this.zt=t;}br(t,i){var n;if(!(null===(n=this.zt)||void 0===n?void 0:n.yt))return null;const{st:s,et:e,wr:r}=this.zt;return i>=s-e-7&&i<=s+e+7?{gr:this.zt,wr:r}:null}Z({context:t,bitmapSize:i,horizontalPixelRatio:n,verticalPixelRatio:s}){if(null===this.zt)return;if(false===this.zt.yt)return;const e=Math.round(this.zt.st*s);e<0||e>i.height||(t.lineCap="butt",t.strokeStyle=this.zt.O,t.lineWidth=Math.floor(this.zt.et*n),f(t,this.zt.Nt),v(t,e,0,i.width));}}class ri{constructor(t){this.Mr={st:0,O:"rgba(0, 0, 0, 0)",et:1,Nt:0,yt:false},this.Sr=new ei,this.ft=true,this.Ls=t,this.Es=t.$t(),this.Sr.J(this.Mr);}bt(){this.ft=true;}gt(){return this.Ls.yt()?(this.ft&&(this.kr(),this.ft=false),this.Sr):null}}class hi extends ri{constructor(t){super(t);}kr(){this.Mr.yt=false;const t=this.Ls.Dt(),i=t.yr().yr;if(2!==i&&3!==i)return;const n=this.Ls.W();if(!n.baseLineVisible||!this.Ls.yt())return;const s=this.Ls.Ct();null!==s&&(this.Mr.yt=true,this.Mr.st=t.Rt(s.Ot,s.Ot),this.Mr.O=n.baseLineColor,this.Mr.et=n.baseLineWidth,this.Mr.Nt=n.baseLineStyle);}}class li extends j{constructor(){super(...arguments),this.zt=null;}J(t){this.zt=t;}He(){return this.zt}Z({context:t,horizontalPixelRatio:i,verticalPixelRatio:n}){const s=this.zt;if(null===s)return;const e=Math.max(1,Math.floor(i)),r=e%2/2,h=Math.round(s.Xe.x*i)+r,l=s.Xe.y*n;t.fillStyle=s.Cr,t.beginPath();const a=Math.max(2,1.5*s.Tr)*i;t.arc(h,l,a,0,2*Math.PI,false),t.fill(),t.fillStyle=s.Pr,t.beginPath(),t.arc(h,l,s.ht*i,0,2*Math.PI,false),t.fill(),t.lineWidth=e,t.strokeStyle=s.Rr,t.beginPath(),t.arc(h,l,s.ht*i+e/2,0,2*Math.PI,false),t.stroke();}}const ai=[{Dr:0,Or:.25,Ar:4,Br:10,Vr:.25,Ir:0,zr:.4,Lr:.8},{Dr:.25,Or:.525,Ar:10,Br:14,Vr:0,Ir:0,zr:.8,Lr:0},{Dr:.525,Or:1,Ar:14,Br:14,Vr:0,Ir:0,zr:0,Lr:0}];function oi(t,i,n,s){return function(t,i){if("transparent"===t)return t;const n=T(t),s=n[3];return `rgba(${n[0]}, ${n[1]}, ${n[2]}, ${i*s})`}(t,n+(s-n)*i)}function _i(t,i){const n=t%2600/2600;let s;for(const t of ai)if(n>=t.Dr&&n<=t.Or){s=t;break}p(void 0!==s,"Last price animation internal logic error");const e=(n-s.Dr)/(s.Or-s.Dr);return {Pr:oi(i,e,s.Vr,s.Ir),Rr:oi(i,e,s.zr,s.Lr),ht:(r=e,h=s.Ar,l=s.Br,h+(l-h)*r)};var r,h,l;}class ui{constructor(t){this.Wt=new li,this.ft=true,this.Er=true,this.Nr=performance.now(),this.Fr=this.Nr-1,this.Wr=t;}jr(){this.Fr=this.Nr-1,this.bt();}Hr(){if(this.bt(),2===this.Wr.W().lastPriceAnimation){const t=performance.now(),i=this.Fr-t;if(i>0)return void(i<650&&(this.Fr+=2600));this.Nr=t,this.Fr=t+2600;}}bt(){this.ft=true;}$r(){this.Er=true;}yt(){return 0!==this.Wr.W().lastPriceAnimation}Ur(){switch(this.Wr.W().lastPriceAnimation){case 0:return false;case 1:return true;case 2:return performance.now()<=this.Fr}}gt(){return this.ft?(this.Mt(),this.ft=false,this.Er=false):this.Er&&(this.qr(),this.Er=false),this.Wt}Mt(){this.Wt.J(null);const t=this.Wr.$t().St(),i=t.Xs(),n=this.Wr.Ct();if(null===i||null===n)return;const s=this.Wr.Yr(true);if(s.Xr||!i.Kr(s.se))return;const e={x:t.It(s.se),y:this.Wr.Dt().Rt(s._t,n.Ot)},r=s.O,h=this.Wr.W().lineWidth,l=_i(this.Zr(),r);this.Wt.J({Cr:r,Tr:h,Pr:l.Pr,Rr:l.Rr,ht:l.ht,Xe:e});}qr(){const t=this.Wt.He();if(null!==t){const i=_i(this.Zr(),t.Cr);t.Pr=i.Pr,t.Rr=i.Rr,t.ht=i.ht;}}Zr(){return this.Ur()?performance.now()-this.Nr:2599}}function ci(t,i){return yt(Math.min(Math.max(t,12),30)*i)}function di(t,i){switch(t){case "arrowDown":case "arrowUp":return ci(i,1);case "circle":return ci(i,.8);case "square":return ci(i,.7)}}function fi(t){return function(t){const i=Math.ceil(t);return i%2!=0?i-1:i}(ci(t,1))}function vi(t){return Math.max(ci(t,.1),3)}function pi(t,i,n){return i?t:n?Math.ceil(t/2):0}function mi(t,i,n,s,e){const r=di("square",n),h=(r-1)/2,l=t-h,a=i-h;return s>=l&&s<=l+r&&e>=a&&e<=a+r}function bi(t,i,n,s){const e=(di("arrowUp",s)-1)/2*n.Gr,r=(yt(s/2)-1)/2*n.Gr;i.beginPath(),t?(i.moveTo(n.nt-e,n.st),i.lineTo(n.nt,n.st-e),i.lineTo(n.nt+e,n.st),i.lineTo(n.nt+r,n.st),i.lineTo(n.nt+r,n.st+e),i.lineTo(n.nt-r,n.st+e),i.lineTo(n.nt-r,n.st)):(i.moveTo(n.nt-e,n.st),i.lineTo(n.nt,n.st+e),i.lineTo(n.nt+e,n.st),i.lineTo(n.nt+r,n.st),i.lineTo(n.nt+r,n.st-e),i.lineTo(n.nt-r,n.st-e),i.lineTo(n.nt-r,n.st)),i.fill();}function wi(t,i,n,s,e,r){return mi(i,n,s,e,r)}class gi extends j{constructor(){super(...arguments),this.zt=null,this.lr=new ii,this.j=-1,this.H="",this.Jr="";}J(t){this.zt=t;}ar(t,i){this.j===t&&this.H===i||(this.j=t,this.H=i,this.Jr=N(t,i),this.lr.ir());}br(t,i){if(null===this.zt||null===this.zt.tt)return null;for(let n=this.zt.tt.from;n<this.zt.tt.to;n++){const s=this.zt.it[n];if(xi(s,t,i))return {gr:s.Qr,wr:s.wr}}return null}Z({context:t,horizontalPixelRatio:i,verticalPixelRatio:n},s,e){if(null!==this.zt&&null!==this.zt.tt){t.textBaseline="middle",t.font=this.Jr;for(let s=this.zt.tt.from;s<this.zt.tt.to;s++){const e=this.zt.it[s];void 0!==e.Zt&&(e.Zt.Hi=this.lr.xi(t,e.Zt.th),e.Zt.Vt=this.j,e.Zt.nt=e.nt-e.Zt.Hi/2),Mi(e,t,i,n);}}}}function Mi(t,i,n,s){i.fillStyle=t.O,void 0!==t.Zt&&function(t,i,n,s,e,r){t.save(),t.scale(e,r),t.fillText(i,n,s),t.restore();}(i,t.Zt.th,t.Zt.nt,t.Zt.st,n,s),function(t,i,n){if(0===t.Ks)return;switch(t.ih){case "arrowDown":return void bi(false,i,n,t.Ks);case "arrowUp":return void bi(true,i,n,t.Ks);case "circle":return void function(t,i,n){const s=(di("circle",n)-1)/2;t.beginPath(),t.arc(i.nt,i.st,s*i.Gr,0,2*Math.PI,false),t.fill();}(i,n,t.Ks);case "square":return void function(t,i,n){const s=di("square",n),e=(s-1)*i.Gr/2,r=i.nt-e,h=i.st-e;t.fillRect(r,h,s*i.Gr,s*i.Gr);}(i,n,t.Ks)}t.ih;}(t,i,function(t,i,n){const s=Math.max(1,Math.floor(i))%2/2;return {nt:Math.round(t.nt*i)+s,st:t.st*n,Gr:i}}(t,n,s));}function xi(t,i,n){return !(void 0===t.Zt||!function(t,i,n,s,e,r){const h=s/2;return e>=t&&e<=t+n&&r>=i-h&&r<=i+h}(t.Zt.nt,t.Zt.st,t.Zt.Hi,t.Zt.Vt,i,n))||function(t,i,n){if(0===t.Ks)return false;switch(t.ih){case "arrowDown":case "arrowUp":return wi(0,t.nt,t.st,t.Ks,i,n);case "circle":return function(t,i,n,s,e){const r=2+di("circle",n)/2,h=t-s,l=i-e;return Math.sqrt(h*h+l*l)<=r}(t.nt,t.st,t.Ks,i,n);case "square":return mi(t.nt,t.st,t.Ks,i,n)}}(t,i,n)}function Si(t,i,n,s,e,r,h,l,a){const o=O(n)?n:n.xe,_=O(n)?n:n.ge,u=O(n)?n:n.Me,c=O(i.size)?Math.max(i.size,0):1,d=fi(l.he())*c,f=d/2;switch(t.Ks=d,i.position){case "inBar":return t.st=h.Rt(o,a),void(void 0!==t.Zt&&(t.Zt.st=t.st+f+r+.6*e));case "aboveBar":return t.st=h.Rt(_,a)-f-s.nh,void 0!==t.Zt&&(t.Zt.st=t.st-f-.6*e,s.nh+=1.2*e),void(s.nh+=d+r);case "belowBar":return t.st=h.Rt(u,a)+f+s.sh,void 0!==t.Zt&&(t.Zt.st=t.st+f+r+.6*e,s.sh+=1.2*e),void(s.sh+=d+r)}i.position;}class ki{constructor(t,i){this.ft=true,this.eh=true,this.rh=true,this.hh=null,this.ah=null,this.Wt=new gi,this.Wr=t,this.$i=i,this.zt={it:[],tt:null};}bt(t){this.ft=true,this.rh=true,"data"===t&&(this.eh=true,this.ah=null);}gt(t){if(!this.Wr.yt())return null;this.ft&&this.oh();const i=this.$i.W().layout;return this.Wt.ar(i.fontSize,i.fontFamily),this.Wt.J(this.zt),this.Wt}_h(){if(this.rh){if(this.Wr.uh().length>0){const t=this.$i.St().he(),i=vi(t),n=1.5*fi(t)+2*i,s=this.dh();this.hh={above:pi(n,s.aboveBar,s.inBar),below:pi(n,s.belowBar,s.inBar)};}else this.hh=null;this.rh=false;}return this.hh}dh(){return null===this.ah&&(this.ah=this.Wr.uh().reduce(((t,i)=>(t[i.position]||(t[i.position]=true),t)),{inBar:false,aboveBar:false,belowBar:false})),this.ah}oh(){const t=this.Wr.Dt(),i=this.$i.St(),n=this.Wr.uh();this.eh&&(this.zt.it=n.map((t=>({ot:t.time,nt:0,st:0,Ks:0,ih:t.shape,O:t.color,Qr:t.Qr,wr:t.id,Zt:void 0}))),this.eh=false);const s=this.$i.W().layout;this.zt.tt=null;const e=i.Xs();if(null===e)return;const r=this.Wr.Ct();if(null===r)return;if(0===this.zt.it.length)return;let h=NaN;const l=vi(i.he()),a={nh:l,sh:l};this.zt.tt=zt(this.zt.it,e,true);for(let e=this.zt.tt.from;e<this.zt.tt.to;e++){const o=n[e];o.time!==h&&(a.nh=l,a.sh=l,h=o.time);const _=this.zt.it[e];_.nt=i.It(o.time),void 0!==o.text&&o.text.length>0&&(_.Zt={th:o.text,nt:0,st:0,Hi:0,Vt:0});const u=this.Wr.fh(o.time);null!==u&&Si(_,o,u,a,s.fontSize,l,t,i,r.Ot);}this.ft=false;}}class yi extends ri{constructor(t){super(t);}kr(){const t=this.Mr;t.yt=false;const i=this.Ls.W();if(!i.priceLineVisible||!this.Ls.yt())return;const n=this.Ls.Yr(0===i.priceLineSource);n.Xr||(t.yt=true,t.st=n.ki,t.O=this.Ls.ph(n.O),t.et=i.priceLineWidth,t.Nt=i.priceLineStyle);}}class Ci extends it{constructor(t){super(),this.jt=t;}zi(t,i,n){t.yt=false,i.yt=false;const s=this.jt;if(!s.yt())return;const e=s.W(),r=e.lastValueVisible,h=""!==s.mh(),l=0===e.seriesLastValueMode,a=s.Yr(false);if(a.Xr)return;r&&(t.Zt=this.bh(a,r,l),t.yt=0!==t.Zt.length),(h||l)&&(i.Zt=this.wh(a,r,h,l),i.yt=i.Zt.length>0);const o=s.ph(a.O),_=P(o);n.t=_.t,n.ki=a.ki,i.At=s.$t().Bt(a.ki/s.Dt().Vt()),t.At=o,t.O=_.i,i.O=_.i;}wh(t,i,n,s){let e="";const r=this.jt.mh();return n&&0!==r.length&&(e+=`${r} `),i&&s&&(e+=this.jt.Dt().gh()?t.Mh:t.xh),e.trim()}bh(t,i,n){return i?n?this.jt.Dt().gh()?t.xh:t.Mh:t.Zt:""}}function Ti(t,i,n,s){const e=Number.isFinite(i),r=Number.isFinite(n);return e&&r?t(i,n):e||r?e?i:n:s}class Pi{constructor(t,i){this.Sh=t,this.kh=i;}yh(t){return null!==t&&(this.Sh===t.Sh&&this.kh===t.kh)}Ch(){return new Pi(this.Sh,this.kh)}Th(){return this.Sh}Ph(){return this.kh}Rh(){return this.kh-this.Sh}Ni(){return this.kh===this.Sh||Number.isNaN(this.kh)||Number.isNaN(this.Sh)}ts(t){return null===t?this:new Pi(Ti(Math.min,this.Th(),t.Th(),-1/0),Ti(Math.max,this.Ph(),t.Ph(),1/0))}Dh(t){if(!O(t))return;if(0===this.kh-this.Sh)return;const i=.5*(this.kh+this.Sh);let n=this.kh-i,s=this.Sh-i;n*=t,s*=t,this.kh=i+n,this.Sh=i+s;}Oh(t){O(t)&&(this.kh+=t,this.Sh+=t);}Ah(){return {minValue:this.Sh,maxValue:this.kh}}static Bh(t){return null===t?null:new Pi(t.minValue,t.maxValue)}}class Ri{constructor(t,i){this.Vh=t,this.Ih=i||null;}zh(){return this.Vh}Lh(){return this.Ih}Ah(){return null===this.Vh?null:{priceRange:this.Vh.Ah(),margins:this.Ih||void 0}}static Bh(t){return null===t?null:new Ri(Pi.Bh(t.priceRange),t.margins)}}class Di extends ri{constructor(t,i){super(t),this.Eh=i;}kr(){const t=this.Mr;t.yt=false;const i=this.Eh.W();if(!this.Ls.yt()||!i.lineVisible)return;const n=this.Eh.Nh();null!==n&&(t.yt=true,t.st=n,t.O=i.color,t.et=i.lineWidth,t.Nt=i.lineStyle,t.wr=this.Eh.W().id);}}class Oi extends it{constructor(t,i){super(),this.Wr=t,this.Eh=i;}zi(t,i,n){t.yt=false,i.yt=false;const s=this.Eh.W(),e=s.axisLabelVisible,r=""!==s.title,h=this.Wr;if(!e||!h.yt())return;const l=this.Eh.Nh();if(null===l)return;r&&(i.Zt=s.title,i.yt=true),i.At=h.$t().Bt(l/h.Dt().Vt()),t.Zt=this.Fh(s.price),t.yt=true;const a=P(s.axisLabelColor||s.color);n.t=a.t;const o=s.axisLabelTextColor||a.i;t.O=o,i.O=o,n.ki=l;}Fh(t){const i=this.Wr.Ct();return null===i?"":this.Wr.Dt().Fi(t,i.Ot)}}class Ai{constructor(t,i){this.Wr=t,this.cn=i,this.Wh=new Di(t,this),this._r=new Oi(t,this),this.jh=new si(this._r,t,t.$t());}Hh(t){D(this.cn,t),this.bt(),this.Wr.$t().$h();}W(){return this.cn}Uh(){return this.Wh}qh(){return this.jh}Yh(){return this._r}bt(){this.Wh.bt(),this._r.bt();}Nh(){const t=this.Wr,i=t.Dt();if(t.$t().St().Ni()||i.Ni())return null;const n=t.Ct();return null===n?null:i.Rt(this.cn.price,n.Ot)}}class Bi extends ht{constructor(t){super(),this.$i=t;}$t(){return this.$i}}const Vi={Bar:(t,i,n,s)=>{var e;const r=i.upColor,h=i.downColor,l=b(t(n,s)),a=w(l.Ot[0])<=w(l.Ot[3]);return {ue:null!==(e=l.O)&&void 0!==e?e:a?r:h}},Candlestick:(t,i,n,s)=>{var e,r,h;const l=i.upColor,a=i.downColor,o=i.borderUpColor,_=i.borderDownColor,u=i.wickUpColor,c=i.wickDownColor,d=b(t(n,s)),f=w(d.Ot[0])<=w(d.Ot[3]);return {ue:null!==(e=d.O)&&void 0!==e?e:f?l:a,Ee:null!==(r=d.At)&&void 0!==r?r:f?o:_,Le:null!==(h=d.Xh)&&void 0!==h?h:f?u:c}},Custom:(t,i,n,s)=>{var e;return {ue:null!==(e=b(t(n,s)).O)&&void 0!==e?e:i.color}},Area:(t,i,n,s)=>{var e,r,h,l;const a=b(t(n,s));return {ue:null!==(e=a.lt)&&void 0!==e?e:i.lineColor,lt:null!==(r=a.lt)&&void 0!==r?r:i.lineColor,Ts:null!==(h=a.Ts)&&void 0!==h?h:i.topColor,Ps:null!==(l=a.Ps)&&void 0!==l?l:i.bottomColor}},Baseline:(t,i,n,s)=>{var e,r,h,l,a,o;const _=b(t(n,s));return {ue:_.Ot[3]>=i.baseValue.price?i.topLineColor:i.bottomLineColor,Pe:null!==(e=_.Pe)&&void 0!==e?e:i.topLineColor,Re:null!==(r=_.Re)&&void 0!==r?r:i.bottomLineColor,Se:null!==(h=_.Se)&&void 0!==h?h:i.topFillColor1,ke:null!==(l=_.ke)&&void 0!==l?l:i.topFillColor2,ye:null!==(a=_.ye)&&void 0!==a?a:i.bottomFillColor1,Ce:null!==(o=_.Ce)&&void 0!==o?o:i.bottomFillColor2}},Line:(t,i,n,s)=>{var e,r;const h=b(t(n,s));return {ue:null!==(e=h.O)&&void 0!==e?e:i.color,lt:null!==(r=h.O)&&void 0!==r?r:i.color}},Histogram:(t,i,n,s)=>{var e;return {ue:null!==(e=b(t(n,s)).O)&&void 0!==e?e:i.color}}};class Ii{constructor(t){this.Kh=(t,i)=>void 0!==i?i.Ot:this.Wr.In().Zh(t),this.Wr=t,this.Gh=Vi[t.Jh()];}Hs(t,i){return this.Gh(this.Kh,this.Wr.W(),t,i)}}var zi;!function(t){t[t.NearestLeft=-1]="NearestLeft",t[t.None=0]="None",t[t.NearestRight=1]="NearestRight";}(zi||(zi={}));const Li=30;class Ei{constructor(){this.Qh=[],this.tl=new Map,this.il=new Map;}nl(){return this.Ks()>0?this.Qh[this.Qh.length-1]:null}sl(){return this.Ks()>0?this.el(0):null}Vn(){return this.Ks()>0?this.el(this.Qh.length-1):null}Ks(){return this.Qh.length}Ni(){return 0===this.Ks()}Kr(t){return null!==this.rl(t,0)}Zh(t){return this.hl(t)}hl(t,i=0){const n=this.rl(t,i);return null===n?null:Object.assign(Object.assign({},this.ll(n)),{se:this.el(n)})}ie(){return this.Qh}al(t,i,n){if(this.Ni())return null;let s=null;for(const e of n){s=Ni(s,this.ol(t,i,e));}return s}J(t){this.il.clear(),this.tl.clear(),this.Qh=t;}el(t){return this.Qh[t].se}ll(t){return this.Qh[t]}rl(t,i){const n=this._l(t);if(null===n&&0!==i)switch(i){case -1:return this.ul(t);case 1:return this.cl(t);default:throw new TypeError("Unknown search mode")}return n}ul(t){let i=this.dl(t);return i>0&&(i-=1),i!==this.Qh.length&&this.el(i)<t?i:null}cl(t){const i=this.fl(t);return i!==this.Qh.length&&t<this.el(i)?i:null}_l(t){const i=this.dl(t);return i===this.Qh.length||t<this.Qh[i].se?null:i}dl(t){return At(this.Qh,t,((t,i)=>t.se<i))}fl(t){return Bt(this.Qh,t,((t,i)=>t.se>i))}vl(t,i,n){let s=null;for(let e=t;e<i;e++){const t=this.Qh[e].Ot[n];Number.isNaN(t)||(null===s?s={pl:t,ml:t}:(t<s.pl&&(s.pl=t),t>s.ml&&(s.ml=t)));}return s}ol(t,i,n){if(this.Ni())return null;let s=null;const e=b(this.sl()),r=b(this.Vn()),h=Math.max(t,e),l=Math.min(i,r),a=Math.ceil(h/Li)*Li,o=Math.max(a,Math.floor(l/Li)*Li);{const t=this.dl(h),e=this.fl(Math.min(l,a,i));s=Ni(s,this.vl(t,e,n));}let _=this.tl.get(n);void 0===_&&(_=new Map,this.tl.set(n,_));for(let t=Math.max(a+1,h);t<o;t+=Li){const i=Math.floor(t/Li);let e=_.get(i);if(void 0===e){const t=this.dl(i*Li),s=this.fl((i+1)*Li-1);e=this.vl(t,s,n),_.set(i,e);}s=Ni(s,e);}{const t=this.dl(o),i=this.fl(l);s=Ni(s,this.vl(t,i,n));}return s}}function Ni(t,i){if(null===t)return i;if(null===i)return t;return {pl:Math.min(t.pl,i.pl),ml:Math.max(t.ml,i.ml)}}class Fi{constructor(t){this.bl=t;}K(t,i,n){this.bl.draw(t);}wl(t,i,n){var s,e;null===(e=(s=this.bl).drawBackground)||void 0===e||e.call(s,t);}}class Wi{constructor(t){this.Qe=null,this.wn=t;}gt(){var t;const i=this.wn.renderer();if(null===i)return null;if((null===(t=this.Qe)||void 0===t?void 0:t.gl)===i)return this.Qe.Ml;const n=new Fi(i);return this.Qe={gl:i,Ml:n},n}xl(){var t,i,n;return null!==(n=null===(i=(t=this.wn).zOrder)||void 0===i?void 0:i.call(t))&&void 0!==n?n:"normal"}}function ji(t){var i,n,s,e,r;return {Zt:t.text(),ki:t.coordinate(),Si:null===(i=t.fixedCoordinate)||void 0===i?void 0:i.call(t),O:t.textColor(),t:t.backColor(),yt:null===(s=null===(n=t.visible)||void 0===n?void 0:n.call(t))||void 0===s||s,hi:null===(r=null===(e=t.tickVisible)||void 0===e?void 0:e.call(t))||void 0===r||r}}class Hi{constructor(t,i){this.Wt=new et,this.Sl=t,this.kl=i;}gt(){return this.Wt.J(Object.assign({Hi:this.kl.Hi()},ji(this.Sl))),this.Wt}}class $i extends it{constructor(t,i){super(),this.Sl=t,this.Li=i;}zi(t,i,n){const s=ji(this.Sl);n.t=s.t,t.O=s.O;const e=2/12*this.Li.P();n.wi=e,n.gi=e,n.ki=s.ki,n.Si=s.Si,t.Zt=s.Zt,t.yt=s.yt,t.hi=s.hi;}}class Ui{constructor(t,i){this.yl=null,this.Cl=null,this.Tl=null,this.Pl=null,this.Rl=null,this.Dl=t,this.Wr=i;}Ol(){return this.Dl}On(){var t,i;null===(i=(t=this.Dl).updateAllViews)||void 0===i||i.call(t);}Pn(){var t,i,n,s;const e=null!==(n=null===(i=(t=this.Dl).paneViews)||void 0===i?void 0:i.call(t))&&void 0!==n?n:[];if((null===(s=this.yl)||void 0===s?void 0:s.gl)===e)return this.yl.Ml;const r=e.map((t=>new Wi(t)));return this.yl={gl:e,Ml:r},r}Qi(){var t,i,n,s;const e=null!==(n=null===(i=(t=this.Dl).timeAxisViews)||void 0===i?void 0:i.call(t))&&void 0!==n?n:[];if((null===(s=this.Cl)||void 0===s?void 0:s.gl)===e)return this.Cl.Ml;const r=this.Wr.$t().St(),h=e.map((t=>new Hi(t,r)));return this.Cl={gl:e,Ml:h},h}Rn(){var t,i,n,s;const e=null!==(n=null===(i=(t=this.Dl).priceAxisViews)||void 0===i?void 0:i.call(t))&&void 0!==n?n:[];if((null===(s=this.Tl)||void 0===s?void 0:s.gl)===e)return this.Tl.Ml;const r=this.Wr.Dt(),h=e.map((t=>new $i(t,r)));return this.Tl={gl:e,Ml:h},h}Al(){var t,i,n,s;const e=null!==(n=null===(i=(t=this.Dl).priceAxisPaneViews)||void 0===i?void 0:i.call(t))&&void 0!==n?n:[];if((null===(s=this.Pl)||void 0===s?void 0:s.gl)===e)return this.Pl.Ml;const r=e.map((t=>new Wi(t)));return this.Pl={gl:e,Ml:r},r}Bl(){var t,i,n,s;const e=null!==(n=null===(i=(t=this.Dl).timeAxisPaneViews)||void 0===i?void 0:i.call(t))&&void 0!==n?n:[];if((null===(s=this.Rl)||void 0===s?void 0:s.gl)===e)return this.Rl.Ml;const r=e.map((t=>new Wi(t)));return this.Rl={gl:e,Ml:r},r}Vl(t,i){var n,s,e;return null!==(e=null===(s=(n=this.Dl).autoscaleInfo)||void 0===s?void 0:s.call(n,t,i))&&void 0!==e?e:null}br(t,i){var n,s,e;return null!==(e=null===(s=(n=this.Dl).hitTest)||void 0===s?void 0:s.call(n,t,i))&&void 0!==e?e:null}}function qi(t,i,n,s){t.forEach((t=>{i(t).forEach((t=>{t.xl()===n&&s.push(t);}));}));}function Yi(t){return t.Pn()}function Xi(t){return t.Al()}function Ki(t){return t.Bl()}class Zi extends Bi{constructor(t,i,n,s,e){super(t),this.zt=new Ei,this.Wh=new yi(this),this.Il=[],this.zl=new hi(this),this.Ll=null,this.El=null,this.Nl=[],this.Fl=[],this.Wl=null,this.jl=[],this.cn=i,this.Hl=n;const r=new Ci(this);this.rn=[r],this.jh=new si(r,this,t),"Area"!==n&&"Line"!==n&&"Baseline"!==n||(this.Ll=new ui(this)),this.$l(),this.Ul(e);}S(){null!==this.Wl&&clearTimeout(this.Wl);}ph(t){return this.cn.priceLineColor||t}Yr(t){const i={Xr:true},n=this.Dt();if(this.$t().St().Ni()||n.Ni()||this.zt.Ni())return i;const s=this.$t().St().Xs(),e=this.Ct();if(null===s||null===e)return i;let r,h;if(t){const t=this.zt.nl();if(null===t)return i;r=t,h=t.se;}else {const t=this.zt.hl(s.ui(),-1);if(null===t)return i;if(r=this.zt.Zh(t.se),null===r)return i;h=t.se;}const l=r.Ot[3],a=this.$s().Hs(h,{Ot:r}),o=n.Rt(l,e.Ot);return {Xr:false,_t:l,Zt:n.Fi(l,e.Ot),Mh:n.ql(l),xh:n.Yl(l,e.Ot),O:a.ue,ki:o,se:h}}$s(){return null!==this.El||(this.El=new Ii(this)),this.El}W(){return this.cn}Hh(t){const i=t.priceScaleId;void 0!==i&&i!==this.cn.priceScaleId&&this.$t().Xl(this,i),D(this.cn,t),void 0!==t.priceFormat&&(this.$l(),this.$t().Kl()),this.$t().Zl(this),this.$t().Gl(),this.wn.bt("options");}J(t,i){this.zt.J(t),this.Jl(),this.wn.bt("data"),this.dn.bt("data"),null!==this.Ll&&(i&&i.Ql?this.Ll.Hr():0===t.length&&this.Ll.jr());const n=this.$t().cr(this);this.$t().ta(n),this.$t().Zl(this),this.$t().Gl(),this.$t().$h();}ia(t){this.Nl=t,this.Jl();const i=this.$t().cr(this);this.dn.bt("data"),this.$t().ta(i),this.$t().Zl(this),this.$t().Gl(),this.$t().$h();}na(){return this.Nl}uh(){return this.Fl}sa(t){const i=new Ai(this,t);return this.Il.push(i),this.$t().Zl(this),i}ea(t){const i=this.Il.indexOf(t);-1!==i&&this.Il.splice(i,1),this.$t().Zl(this);}Jh(){return this.Hl}Ct(){const t=this.ra();return null===t?null:{Ot:t.Ot[3],ha:t.ot}}ra(){const t=this.$t().St().Xs();if(null===t)return null;const i=t.Os();return this.zt.hl(i,1)}In(){return this.zt}fh(t){const i=this.zt.Zh(t);return null===i?null:"Bar"===this.Hl||"Candlestick"===this.Hl||"Custom"===this.Hl?{we:i.Ot[0],ge:i.Ot[1],Me:i.Ot[2],xe:i.Ot[3]}:i.Ot[3]}la(t){const i=[];qi(this.jl,Yi,"top",i);const n=this.Ll;return null!==n&&n.yt()?(null===this.Wl&&n.Ur()&&(this.Wl=setTimeout((()=>{this.Wl=null,this.$t().aa();}),0)),n.$r(),i.unshift(n),i):i}Pn(){const t=[];this.oa()||t.push(this.zl),t.push(this.wn,this.Wh,this.dn);const i=this.Il.map((t=>t.Uh()));return t.push(...i),qi(this.jl,Yi,"normal",t),t}_a(){return this.ua(Yi,"bottom")}ca(t){return this.ua(Xi,t)}da(t){return this.ua(Ki,t)}fa(t,i){return this.jl.map((n=>n.br(t,i))).filter((t=>null!==t))}Ji(t){return [this.jh,...this.Il.map((t=>t.qh()))]}Rn(t,i){if(i!==this.Yi&&!this.oa())return [];const n=[...this.rn];for(const t of this.Il)n.push(t.Yh());return this.jl.forEach((t=>{n.push(...t.Rn());})),n}Qi(){const t=[];return this.jl.forEach((i=>{t.push(...i.Qi());})),t}Vl(t,i){if(void 0!==this.cn.autoscaleInfoProvider){const n=this.cn.autoscaleInfoProvider((()=>{const n=this.va(t,i);return null===n?null:n.Ah()}));return Ri.Bh(n)}return this.va(t,i)}pa(){return this.cn.priceFormat.minMove}ma(){return this.ba}On(){var t;this.wn.bt(),this.dn.bt();for(const t of this.rn)t.bt();for(const t of this.Il)t.bt();this.Wh.bt(),this.zl.bt(),null===(t=this.Ll)||void 0===t||t.bt(),this.jl.forEach((t=>t.On()));}Dt(){return b(super.Dt())}kt(t){if(!(("Line"===this.Hl||"Area"===this.Hl||"Baseline"===this.Hl)&&this.cn.crosshairMarkerVisible))return null;const i=this.zt.Zh(t);if(null===i)return null;return {_t:i.Ot[3],ht:this.wa(),At:this.ga(),Pt:this.Ma(),Tt:this.xa(t)}}mh(){return this.cn.title}yt(){return this.cn.visible}Sa(t){this.jl.push(new Ui(t,this));}ka(t){this.jl=this.jl.filter((i=>i.Ol()!==t));}ya(){if(this.wn instanceof Kt!=false)return t=>this.wn.Fe(t)}Ca(){if(this.wn instanceof Kt!=false)return t=>this.wn.We(t)}oa(){return !ot(this.Dt().Ta())}va(t,i){if(!A(t)||!A(i)||this.zt.Ni())return null;const n="Line"===this.Hl||"Area"===this.Hl||"Baseline"===this.Hl||"Histogram"===this.Hl?[3]:[2,1],s=this.zt.al(t,i,n);let e=null!==s?new Pi(s.pl,s.ml):null;if("Histogram"===this.Jh()){const t=this.cn.base,i=new Pi(t,t);e=null!==e?e.ts(i):i;}let r=this.dn._h();return this.jl.forEach((n=>{const s=n.Vl(t,i);if(null==s?void 0:s.priceRange){const t=new Pi(s.priceRange.minValue,s.priceRange.maxValue);e=null!==e?e.ts(t):t;}var h,l,a,o;(null==s?void 0:s.margins)&&(h=r,l=s.margins,r={above:Math.max(null!==(a=null==h?void 0:h.above)&&void 0!==a?a:0,l.above),below:Math.max(null!==(o=null==h?void 0:h.below)&&void 0!==o?o:0,l.below)});})),new Ri(e,r)}wa(){switch(this.Hl){case "Line":case "Area":case "Baseline":return this.cn.crosshairMarkerRadius}return 0}ga(){switch(this.Hl){case "Line":case "Area":case "Baseline":{const t=this.cn.crosshairMarkerBorderColor;if(0!==t.length)return t}}return null}Ma(){switch(this.Hl){case "Line":case "Area":case "Baseline":return this.cn.crosshairMarkerBorderWidth}return 0}xa(t){switch(this.Hl){case "Line":case "Area":case "Baseline":{const t=this.cn.crosshairMarkerBackgroundColor;if(0!==t.length)return t}}return this.$s().Hs(t).ue}$l(){switch(this.cn.priceFormat.type){case "custom":this.ba={format:this.cn.priceFormat.formatter};break;case "volume":this.ba=new vt(this.cn.priceFormat.precision);break;case "percent":this.ba=new ft(this.cn.priceFormat.precision);break;default:{const t=Math.pow(10,this.cn.priceFormat.precision);this.ba=new dt(t,this.cn.priceFormat.minMove*t);}}null!==this.Yi&&this.Yi.Pa();}Jl(){const t=this.$t().St();if(!t.Ra()||this.zt.Ni())return void(this.Fl=[]);const i=b(this.zt.sl());this.Fl=this.Nl.map(((n,s)=>{const e=b(t.Da(n.time,true)),r=e<i?1:-1;return {time:b(this.zt.hl(e,r)).se,position:n.position,shape:n.shape,color:n.color,id:n.id,Qr:s,text:n.text,size:n.size,originalTime:n.originalTime}}));}Ul(t){switch(this.dn=new ki(this,this.$t()),this.Hl){case "Bar":this.wn=new jt(this,this.$t());break;case "Candlestick":this.wn=new Yt(this,this.$t());break;case "Line":this.wn=new Qt(this,this.$t());break;case "Custom":this.wn=new Kt(this,this.$t(),m(t));break;case "Area":this.wn=new Nt(this,this.$t());break;case "Baseline":this.wn=new Ut(this,this.$t());break;case "Histogram":this.wn=new Jt(this,this.$t());break;default:throw Error("Unknown chart style assigned: "+this.Hl)}}ua(t,i){const n=[];return qi(this.jl,t,i,n),n}}class Gi{constructor(t){this.cn=t;}Oa(t,i,n){let s=t;if(0===this.cn.mode)return s;const e=n.vn(),r=e.Ct();if(null===r)return s;const h=e.Rt(t,r),l=n.Aa().filter((t=>t instanceof Zi)).reduce(((t,s)=>{if(n.dr(s)||!s.yt())return t;const e=s.Dt(),r=s.In();if(e.Ni()||!r.Kr(i))return t;const h=r.Zh(i);if(null===h)return t;const l=w(s.Ct());return t.concat([e.Rt(h.Ot[3],l.Ot)])}),[]);if(0===l.length)return s;l.sort(((t,i)=>Math.abs(t-h)-Math.abs(i-h)));const a=l[0];return s=e.pn(a,r),s}}class Ji extends j{constructor(){super(...arguments),this.zt=null;}J(t){this.zt=t;}Z({context:t,bitmapSize:i,horizontalPixelRatio:n,verticalPixelRatio:s}){if(null===this.zt)return;const e=Math.max(1,Math.floor(n));t.lineWidth=e,function(t,i){t.save(),t.lineWidth%2&&t.translate(.5,.5),i(),t.restore();}(t,(()=>{const r=b(this.zt);if(r.Ba){t.strokeStyle=r.Va,f(t,r.Ia),t.beginPath();for(const s of r.za){const r=Math.round(s.La*n);t.moveTo(r,-e),t.lineTo(r,i.height+e);}t.stroke();}if(r.Ea){t.strokeStyle=r.Na,f(t,r.Fa),t.beginPath();for(const n of r.Wa){const r=Math.round(n.La*s);t.moveTo(-e,r),t.lineTo(i.width+e,r);}t.stroke();}}));}}class Qi{constructor(t){this.Wt=new Ji,this.ft=true,this.tn=t;}bt(){this.ft=true;}gt(){if(this.ft){const t=this.tn.$t().W().grid,i={Ea:t.horzLines.visible,Ba:t.vertLines.visible,Na:t.horzLines.color,Va:t.vertLines.color,Fa:t.horzLines.style,Ia:t.vertLines.style,Wa:this.tn.vn().ja(),za:(this.tn.$t().St().ja()||[]).map((t=>({La:t.coord})))};this.Wt.J(i),this.ft=false;}return this.Wt}}class tn{constructor(t){this.wn=new Qi(t);}Uh(){return this.wn}}const nn={Ha:4,$a:1e-4};function sn(t,i){const n=100*(t-i)/i;return i<0?-n:n}function en(t,i){const n=sn(t.Th(),i),s=sn(t.Ph(),i);return new Pi(n,s)}function rn(t,i){const n=100*(t-i)/i+100;return i<0?-n:n}function hn(t,i){const n=rn(t.Th(),i),s=rn(t.Ph(),i);return new Pi(n,s)}function ln(t,i){const n=Math.abs(t);if(n<1e-15)return 0;const s=Math.log10(n+i.$a)+i.Ha;return t<0?-s:s}function an(t,i){const n=Math.abs(t);if(n<1e-15)return 0;const s=Math.pow(10,n-i.Ha)-i.$a;return t<0?-s:s}function on(t,i){if(null===t)return null;const n=ln(t.Th(),i),s=ln(t.Ph(),i);return new Pi(n,s)}function _n(t,i){if(null===t)return null;const n=an(t.Th(),i),s=an(t.Ph(),i);return new Pi(n,s)}function un(t){if(null===t)return nn;const i=Math.abs(t.Ph()-t.Th());if(i>=1||i<1e-15)return nn;const n=Math.ceil(Math.abs(Math.log10(i))),s=nn.Ha+n;return {Ha:s,$a:1/Math.pow(10,s)}}class cn{constructor(t,i){if(this.Ua=t,this.qa=i,function(t){if(t<0)return false;for(let i=t;i>1;i/=10)if(i%10!=0)return false;return true}(this.Ua))this.Ya=[2,2.5,2];else {this.Ya=[];for(let t=this.Ua;1!==t;){if(t%2==0)this.Ya.push(2),t/=2;else {if(t%5!=0)throw new Error("unexpected base");this.Ya.push(2,2.5),t/=5;}if(this.Ya.length>100)throw new Error("something wrong with base")}}}Xa(t,i,n){const s=0===this.Ua?0:1/this.Ua;let e=Math.pow(10,Math.max(0,Math.ceil(Math.log10(t-i)))),r=0,h=this.qa[0];for(;;){const t=kt(e,s,1e-14)&&e>s+1e-14,i=kt(e,n*h,1e-14),l=kt(e,1,1e-14);if(!(t&&i&&l))break;e/=h,h=this.qa[++r%this.qa.length];}if(e<=s+1e-14&&(e=s),e=Math.max(1,e),this.Ya.length>0&&(l=e,a=1,o=1e-14,Math.abs(l-a)<o))for(r=0,h=this.Ya[0];kt(e,n*h,1e-14)&&e>s+1e-14;)e/=h,h=this.Ya[++r%this.Ya.length];var l,a,o;return e}}class dn{constructor(t,i,n,s){this.Ka=[],this.Li=t,this.Ua=i,this.Za=n,this.Ga=s;}Xa(t,i){if(t<i)throw new Error("high < low");const n=this.Li.Vt(),s=(t-i)*this.Ja()/n,e=new cn(this.Ua,[2,2.5,2]),r=new cn(this.Ua,[2,2,2.5]),h=new cn(this.Ua,[2.5,2,2]),l=[];return l.push(e.Xa(t,i,s),r.Xa(t,i,s),h.Xa(t,i,s)),function(t){if(t.length<1)throw Error("array is empty");let i=t[0];for(let n=1;n<t.length;++n)t[n]<i&&(i=t[n]);return i}(l)}Qa(){const t=this.Li,i=t.Ct();if(null===i)return void(this.Ka=[]);const n=t.Vt(),s=this.Za(n-1,i),e=this.Za(0,i),r=this.Li.W().entireTextOnly?this.io()/2:0,h=r,l=n-1-r,a=Math.max(s,e),o=Math.min(s,e);if(a===o)return void(this.Ka=[]);let _=this.Xa(a,o),u=a%_;u+=u<0?_:0;const c=a>=o?1:-1;let d=null,f=0;for(let n=a-u;n>o;n-=_){const s=this.Ga(n,i,true);null!==d&&Math.abs(s-d)<this.Ja()||(s<h||s>l||(f<this.Ka.length?(this.Ka[f].La=s,this.Ka[f].no=t.so(n)):this.Ka.push({La:s,no:t.so(n)}),f++,d=s,t.eo()&&(_=this.Xa(n*c,o))));}this.Ka.length=f;}ja(){return this.Ka}io(){return this.Li.P()}Ja(){return Math.ceil(2.5*this.io())}}function fn(t){return t.slice().sort(((t,i)=>b(t.Ki())-b(i.Ki())))}var vn;!function(t){t[t.Normal=0]="Normal",t[t.Logarithmic=1]="Logarithmic",t[t.Percentage=2]="Percentage",t[t.IndexedTo100=3]="IndexedTo100";}(vn||(vn={}));const pn=new ft,mn=new dt(100,1);class bn{constructor(t,i,n,s){this.ro=0,this.ho=null,this.Vh=null,this.lo=null,this.ao={oo:false,_o:null},this.uo=0,this.co=0,this.do=new R,this.fo=new R,this.vo=[],this.po=null,this.mo=null,this.bo=null,this.wo=null,this.ba=mn,this.Mo=un(null),this.xo=t,this.cn=i,this.So=n,this.ko=s,this.yo=new dn(this,100,this.Co.bind(this),this.To.bind(this));}Ta(){return this.xo}W(){return this.cn}Hh(t){if(D(this.cn,t),this.Pa(),void 0!==t.mode&&this.Po({yr:t.mode}),void 0!==t.scaleMargins){const i=m(t.scaleMargins.top),n=m(t.scaleMargins.bottom);if(i<0||i>1)throw new Error(`Invalid top margin - expect value between 0 and 1, given=${i}`);if(n<0||n>1)throw new Error(`Invalid bottom margin - expect value between 0 and 1, given=${n}`);if(i+n>1)throw new Error(`Invalid margins - sum of margins must be less than 1, given=${i+n}`);this.Ro(),this.mo=null;}}Do(){return this.cn.autoScale}eo(){return 1===this.cn.mode}gh(){return 2===this.cn.mode}Oo(){return 3===this.cn.mode}yr(){return {Wn:this.cn.autoScale,Ao:this.cn.invertScale,yr:this.cn.mode}}Po(t){const i=this.yr();let n=null;void 0!==t.Wn&&(this.cn.autoScale=t.Wn),void 0!==t.yr&&(this.cn.mode=t.yr,2!==t.yr&&3!==t.yr||(this.cn.autoScale=true),this.ao.oo=false),1===i.yr&&t.yr!==i.yr&&(!function(t,i){if(null===t)return false;const n=an(t.Th(),i),s=an(t.Ph(),i);return isFinite(n)&&isFinite(s)}(this.Vh,this.Mo)?this.cn.autoScale=true:(n=_n(this.Vh,this.Mo),null!==n&&this.Bo(n))),1===t.yr&&t.yr!==i.yr&&(n=on(this.Vh,this.Mo),null!==n&&this.Bo(n));const s=i.yr!==this.cn.mode;s&&(2===i.yr||this.gh())&&this.Pa(),s&&(3===i.yr||this.Oo())&&this.Pa(),void 0!==t.Ao&&i.Ao!==t.Ao&&(this.cn.invertScale=t.Ao,this.Vo()),this.fo.m(i,this.yr());}Io(){return this.fo}P(){return this.So.fontSize}Vt(){return this.ro}zo(t){this.ro!==t&&(this.ro=t,this.Ro(),this.mo=null);}Lo(){if(this.ho)return this.ho;const t=this.Vt()-this.Eo()-this.No();return this.ho=t,t}zh(){return this.Fo(),this.Vh}Bo(t,i){const n=this.Vh;(i||null===n&&null!==t||null!==n&&!n.yh(t))&&(this.mo=null,this.Vh=t);}Ni(){return this.Fo(),0===this.ro||!this.Vh||this.Vh.Ni()}Wo(t){return this.Ao()?t:this.Vt()-1-t}Rt(t,i){return this.gh()?t=sn(t,i):this.Oo()&&(t=rn(t,i)),this.To(t,i)}Qs(t,i,n){this.Fo();const s=this.No(),e=b(this.zh()),r=e.Th(),h=e.Ph(),l=this.Lo()-1,a=this.Ao(),o=l/(h-r),_=void 0===n?0:n.from,u=void 0===n?t.length:n.to,c=this.jo();for(let n=_;n<u;n++){const e=t[n],h=e._t;if(isNaN(h))continue;let l=h;null!==c&&(l=c(e._t,i));const _=s+o*(l-r),u=a?_:this.ro-1-_;e.st=u;}}me(t,i,n){this.Fo();const s=this.No(),e=b(this.zh()),r=e.Th(),h=e.Ph(),l=this.Lo()-1,a=this.Ao(),o=l/(h-r),_=void 0===n?0:n.from,u=void 0===n?t.length:n.to,c=this.jo();for(let n=_;n<u;n++){const e=t[n];let h=e.we,l=e.ge,_=e.Me,u=e.xe;null!==c&&(h=c(e.we,i),l=c(e.ge,i),_=c(e.Me,i),u=c(e.xe,i));let d=s+o*(h-r),f=a?d:this.ro-1-d;e.ve=f,d=s+o*(l-r),f=a?d:this.ro-1-d,e.ce=f,d=s+o*(_-r),f=a?d:this.ro-1-d,e.de=f,d=s+o*(u-r),f=a?d:this.ro-1-d,e.pe=f;}}pn(t,i){const n=this.Co(t,i);return this.Ho(n,i)}Ho(t,i){let n=t;return this.gh()?n=function(t,i){return i<0&&(t=-t),t/100*i+i}(n,i):this.Oo()&&(n=function(t,i){return t-=100,i<0&&(t=-t),t/100*i+i}(n,i)),n}Aa(){return this.vo}$o(){if(this.po)return this.po;let t=[];for(let i=0;i<this.vo.length;i++){const n=this.vo[i];null===n.Ki()&&n.Zi(i+1),t.push(n);}return t=fn(t),this.po=t,this.po}Uo(t){ -1===this.vo.indexOf(t)&&(this.vo.push(t),this.Pa(),this.qo());}Yo(t){const i=this.vo.indexOf(t);if(-1===i)throw new Error("source is not attached to scale");this.vo.splice(i,1),0===this.vo.length&&(this.Po({Wn:true}),this.Bo(null)),this.Pa(),this.qo();}Ct(){let t=null;for(const i of this.vo){const n=i.Ct();null!==n&&((null===t||n.ha<t.ha)&&(t=n));}return null===t?null:t.Ot}Ao(){return this.cn.invertScale}ja(){const t=null===this.Ct();if(null!==this.mo&&(t||this.mo.Xo===t))return this.mo.ja;this.yo.Qa();const i=this.yo.ja();return this.mo={ja:i,Xo:t},this.do.m(),i}Ko(){return this.do}Zo(t){this.gh()||this.Oo()||null===this.bo&&null===this.lo&&(this.Ni()||(this.bo=this.ro-t,this.lo=b(this.zh()).Ch()));}Go(t){if(this.gh()||this.Oo())return;if(null===this.bo)return;this.Po({Wn:false}),(t=this.ro-t)<0&&(t=0);let i=(this.bo+.2*(this.ro-1))/(t+.2*(this.ro-1));const n=b(this.lo).Ch();i=Math.max(i,.1),n.Dh(i),this.Bo(n);}Jo(){this.gh()||this.Oo()||(this.bo=null,this.lo=null);}Qo(t){this.Do()||null===this.wo&&null===this.lo&&(this.Ni()||(this.wo=t,this.lo=b(this.zh()).Ch()));}t_(t){if(this.Do())return;if(null===this.wo)return;const i=b(this.zh()).Rh()/(this.Lo()-1);let n=t-this.wo;this.Ao()&&(n*=-1);const s=n*i,e=b(this.lo).Ch();e.Oh(s),this.Bo(e,true),this.mo=null;}i_(){this.Do()||null!==this.wo&&(this.wo=null,this.lo=null);}ma(){return this.ba||this.Pa(),this.ba}Fi(t,i){switch(this.cn.mode){case 2:return this.n_(sn(t,i));case 3:return this.ma().format(rn(t,i));default:return this.Fh(t)}}so(t){switch(this.cn.mode){case 2:return this.n_(t);case 3:return this.ma().format(t);default:return this.Fh(t)}}ql(t){return this.Fh(t,b(this.s_()).ma())}Yl(t,i){return t=sn(t,i),this.n_(t,pn)}e_(){return this.vo}r_(t){this.ao={_o:t,oo:false};}On(){this.vo.forEach((t=>t.On()));}Pa(){this.mo=null;const t=this.s_();let i=100;null!==t&&(i=Math.round(1/t.pa())),this.ba=mn,this.gh()?(this.ba=pn,i=100):this.Oo()?(this.ba=new dt(100,1),i=100):null!==t&&(this.ba=t.ma()),this.yo=new dn(this,i,this.Co.bind(this),this.To.bind(this)),this.yo.Qa();}qo(){this.po=null;}s_(){return this.vo[0]||null}Eo(){return this.Ao()?this.cn.scaleMargins.bottom*this.Vt()+this.co:this.cn.scaleMargins.top*this.Vt()+this.uo}No(){return this.Ao()?this.cn.scaleMargins.top*this.Vt()+this.uo:this.cn.scaleMargins.bottom*this.Vt()+this.co}Fo(){this.ao.oo||(this.ao.oo=true,this.h_());}Ro(){this.ho=null;}To(t,i){if(this.Fo(),this.Ni())return 0;t=this.eo()&&t?ln(t,this.Mo):t;const n=b(this.zh()),s=this.No()+(this.Lo()-1)*(t-n.Th())/n.Rh();return this.Wo(s)}Co(t,i){if(this.Fo(),this.Ni())return 0;const n=this.Wo(t),s=b(this.zh()),e=s.Th()+s.Rh()*((n-this.No())/(this.Lo()-1));return this.eo()?an(e,this.Mo):e}Vo(){this.mo=null,this.yo.Qa();}h_(){const t=this.ao._o;if(null===t)return;let i=null;const n=this.e_();let s=0,e=0;for(const r of n){if(!r.yt())continue;const n=r.Ct();if(null===n)continue;const h=r.Vl(t.Os(),t.ui());let l=h&&h.zh();if(null!==l){switch(this.cn.mode){case 1:l=on(l,this.Mo);break;case 2:l=en(l,n.Ot);break;case 3:l=hn(l,n.Ot);}if(i=null===i?l:i.ts(b(l)),null!==h){const t=h.Lh();null!==t&&(s=Math.max(s,t.above),e=Math.max(e,t.below));}}}if(s===this.uo&&e===this.co||(this.uo=s,this.co=e,this.mo=null,this.Ro()),null!==i){if(i.Th()===i.Ph()){const t=this.s_(),n=5*(null===t||this.gh()||this.Oo()?1:t.pa());this.eo()&&(i=_n(i,this.Mo)),i=new Pi(i.Th()-n,i.Ph()+n),this.eo()&&(i=on(i,this.Mo));}if(this.eo()){const t=_n(i,this.Mo),n=un(t);if(r=n,h=this.Mo,r.Ha!==h.Ha||r.$a!==h.$a){const s=null!==this.lo?_n(this.lo,this.Mo):null;this.Mo=n,i=on(t,n),null!==s&&(this.lo=on(s,n));}}this.Bo(i);}else null===this.Vh&&(this.Bo(new Pi(-0.5,.5)),this.Mo=un(null));var r,h;this.ao.oo=true;}jo(){return this.gh()?sn:this.Oo()?rn:this.eo()?t=>ln(t,this.Mo):null}l_(t,i,n){return void 0===i?(void 0===n&&(n=this.ma()),n.format(t)):i(t)}Fh(t,i){return this.l_(t,this.ko.priceFormatter,i)}n_(t,i){return this.l_(t,this.ko.percentageFormatter,i)}}class wn{constructor(t,i){this.vo=[],this.a_=new Map,this.ro=0,this.o_=0,this.__=1e3,this.po=null,this.u_=new R,this.kl=t,this.$i=i,this.c_=new tn(this);const n=i.W();this.d_=this.f_("left",n.leftPriceScale),this.v_=this.f_("right",n.rightPriceScale),this.d_.Io().l(this.p_.bind(this,this.d_),this),this.v_.Io().l(this.p_.bind(this,this.v_),this),this.m_(n);}m_(t){if(t.leftPriceScale&&this.d_.Hh(t.leftPriceScale),t.rightPriceScale&&this.v_.Hh(t.rightPriceScale),t.localization&&(this.d_.Pa(),this.v_.Pa()),t.overlayPriceScales){const i=Array.from(this.a_.values());for(const n of i){const i=b(n[0].Dt());i.Hh(t.overlayPriceScales),t.localization&&i.Pa();}}}b_(t){switch(t){case "left":return this.d_;case "right":return this.v_}return this.a_.has(t)?m(this.a_.get(t))[0].Dt():null}S(){this.$t().w_().p(this),this.d_.Io().p(this),this.v_.Io().p(this),this.vo.forEach((t=>{t.S&&t.S();})),this.u_.m();}g_(){return this.__}M_(t){this.__=t;}$t(){return this.$i}Hi(){return this.o_}Vt(){return this.ro}x_(t){this.o_=t,this.S_();}zo(t){this.ro=t,this.d_.zo(t),this.v_.zo(t),this.vo.forEach((i=>{if(this.dr(i)){const n=i.Dt();null!==n&&n.zo(t);}})),this.S_();}Aa(){return this.vo}dr(t){const i=t.Dt();return null===i||this.d_!==i&&this.v_!==i}Uo(t,i,n){const s=void 0!==n?n:this.y_().k_+1;this.C_(t,i,s);}Yo(t){const i=this.vo.indexOf(t);p(-1!==i,"removeDataSource: invalid data source"),this.vo.splice(i,1);const n=b(t.Dt()).Ta();if(this.a_.has(n)){const i=m(this.a_.get(n)),s=i.indexOf(t);-1!==s&&(i.splice(s,1),0===i.length&&this.a_.delete(n));}const s=t.Dt();s&&s.Aa().indexOf(t)>=0&&s.Yo(t),null!==s&&(s.qo(),this.T_(s)),this.po=null;}pr(t){return t===this.d_?"left":t===this.v_?"right":"overlay"}P_(){return this.d_}R_(){return this.v_}D_(t,i){t.Zo(i);}O_(t,i){t.Go(i),this.S_();}A_(t){t.Jo();}B_(t,i){t.Qo(i);}V_(t,i){t.t_(i),this.S_();}I_(t){t.i_();}S_(){this.vo.forEach((t=>{t.On();}));}vn(){let t=null;return this.$i.W().rightPriceScale.visible&&0!==this.v_.Aa().length?t=this.v_:this.$i.W().leftPriceScale.visible&&0!==this.d_.Aa().length?t=this.d_:0!==this.vo.length&&(t=this.vo[0].Dt()),null===t&&(t=this.v_),t}vr(){let t=null;return this.$i.W().rightPriceScale.visible?t=this.v_:this.$i.W().leftPriceScale.visible&&(t=this.d_),t}T_(t){null!==t&&t.Do()&&this.z_(t);}L_(t){const i=this.kl.Xs();t.Po({Wn:true}),null!==i&&t.r_(i),this.S_();}E_(){this.z_(this.d_),this.z_(this.v_);}N_(){this.T_(this.d_),this.T_(this.v_),this.vo.forEach((t=>{this.dr(t)&&this.T_(t.Dt());})),this.S_(),this.$i.$h();}$o(){return null===this.po&&(this.po=fn(this.vo)),this.po}F_(){return this.u_}W_(){return this.c_}z_(t){const i=t.e_();if(i&&i.length>0&&!this.kl.Ni()){const i=this.kl.Xs();null!==i&&t.r_(i);}t.On();}y_(){const t=this.$o();if(0===t.length)return {j_:0,k_:0};let i=0,n=0;for(let s=0;s<t.length;s++){const e=t[s].Ki();null!==e&&(e<i&&(i=e),e>n&&(n=e));}return {j_:i,k_:n}}C_(t,i,n){let s=this.b_(i);if(null===s&&(s=this.f_(i,this.$i.W().overlayPriceScales)),this.vo.push(t),!ot(i)){const n=this.a_.get(i)||[];n.push(t),this.a_.set(i,n);}s.Uo(t),t.Gi(s),t.Zi(n),this.T_(s),this.po=null;}p_(t,i,n){i.yr!==n.yr&&this.z_(t);}f_(t,i){const n=Object.assign({visible:true,autoScale:true},I(i)),s=new bn(t,n,this.$i.W().layout,this.$i.W().localization);return s.zo(this.Vt()),s}}class gn{constructor(t,i,n=50){this.Ke=0,this.Ze=1,this.Ge=1,this.Qe=new Map,this.Je=new Map,this.H_=t,this.U_=i,this.tr=n;}q_(t){const i=t.time,n=this.U_.cacheKey(i),s=this.Qe.get(n);if(void 0!==s)return s.Y_;if(this.Ke===this.tr){const t=this.Je.get(this.Ge);this.Je.delete(this.Ge),this.Qe.delete(m(t)),this.Ge++,this.Ke--;}const e=this.H_(t);return this.Qe.set(n,{Y_:e,er:this.Ze}),this.Je.set(this.Ze,n),this.Ke++,this.Ze++,e}}class Mn{constructor(t,i){p(t<=i,"right should be >= left"),this.X_=t,this.K_=i;}Os(){return this.X_}ui(){return this.K_}Z_(){return this.K_-this.X_+1}Kr(t){return this.X_<=t&&t<=this.K_}yh(t){return this.X_===t.Os()&&this.K_===t.ui()}}function xn(t,i){return null===t||null===i?t===i:t.yh(i)}class Sn{constructor(){this.G_=new Map,this.Qe=null,this.J_=false;}Q_(t){this.J_=t,this.Qe=null;}tu(t,i){this.iu(i),this.Qe=null;for(let n=i;n<t.length;++n){const i=t[n];let s=this.G_.get(i.timeWeight);void 0===s&&(s=[],this.G_.set(i.timeWeight,s)),s.push({index:n,time:i.time,weight:i.timeWeight,originalTime:i.originalTime});}}nu(t,i){const n=Math.ceil(i/t);return null!==this.Qe&&this.Qe.su===n||(this.Qe={ja:this.eu(n),su:n}),this.Qe.ja}iu(t){if(0===t)return void this.G_.clear();const i=[];this.G_.forEach(((n,s)=>{t<=n[0].index?i.push(s):n.splice(At(n,t,(i=>i.index<t)),1/0);}));for(const t of i)this.G_.delete(t);}eu(t){let i=[];for(const n of Array.from(this.G_.keys()).sort(((t,i)=>i-t))){if(!this.G_.get(n))continue;const s=i;i=[];const e=s.length;let r=0;const h=m(this.G_.get(n)),l=h.length;let a=1/0,o=-1/0;for(let n=0;n<l;n++){const l=h[n],_=l.index;for(;r<e;){const t=s[r],n=t.index;if(!(n<_)){a=n;break}r++,i.push(t),o=n,a=1/0;}if(a-_>=t&&_-o>=t)i.push(l),o=_;else if(this.J_)return s}for(;r<e;r++)i.push(s[r]);}return i}}class kn{constructor(t){this.ru=t;}hu(){return null===this.ru?null:new Mn(Math.floor(this.ru.Os()),Math.ceil(this.ru.ui()))}lu(){return this.ru}static au(){return new kn(null)}}function yn(t,i){return t.weight>i.weight?t:i}class Cn{constructor(t,i,n,s){this.o_=0,this.ou=null,this._u=[],this.wo=null,this.bo=null,this.uu=new Sn,this.cu=new Map,this.du=kn.au(),this.fu=true,this.vu=new R,this.pu=new R,this.mu=new R,this.bu=null,this.wu=null,this.gu=[],this.cn=i,this.ko=n,this.Mu=i.rightOffset,this.xu=i.barSpacing,this.$i=t,this.U_=s,this.Su(),this.uu.Q_(i.uniformDistribution);}W(){return this.cn}ku(t){D(this.ko,t),this.yu(),this.Su();}Hh(t,i){var n;D(this.cn,t),this.cn.fixLeftEdge&&this.Cu(),this.cn.fixRightEdge&&this.Tu(),void 0!==t.barSpacing&&this.$i.Gn(t.barSpacing),void 0!==t.rightOffset&&this.$i.Jn(t.rightOffset),void 0!==t.minBarSpacing&&this.$i.Gn(null!==(n=t.barSpacing)&&void 0!==n?n:this.xu),this.yu(),this.Su(),this.mu.m();}mn(t){var i,n;return null!==(n=null===(i=this._u[t])||void 0===i?void 0:i.time)&&void 0!==n?n:null}Ui(t){var i;return null!==(i=this._u[t])&&void 0!==i?i:null}Da(t,i){if(this._u.length<1)return null;if(this.U_.key(t)>this.U_.key(this._u[this._u.length-1].time))return i?this._u.length-1:null;const n=At(this._u,this.U_.key(t),((t,i)=>this.U_.key(t.time)<i));return this.U_.key(t)<this.U_.key(this._u[n].time)?i?n:null:n}Ni(){return 0===this.o_||0===this._u.length||null===this.ou}Ra(){return this._u.length>0}Xs(){return this.Pu(),this.du.hu()}Ru(){return this.Pu(),this.du.lu()}Du(){const t=this.Xs();if(null===t)return null;const i={from:t.Os(),to:t.ui()};return this.Ou(i)}Ou(t){const i=Math.round(t.from),n=Math.round(t.to),s=b(this.Au()),e=b(this.Bu());return {from:b(this.Ui(Math.max(s,i))),to:b(this.Ui(Math.min(e,n)))}}Vu(t){return {from:b(this.Da(t.from,true)),to:b(this.Da(t.to,true))}}Hi(){return this.o_}x_(t){if(!isFinite(t)||t<=0)return;if(this.o_===t)return;const i=this.Ru(),n=this.o_;if(this.o_=t,this.fu=true,this.cn.lockVisibleTimeRangeOnResize&&0!==n){const i=this.xu*t/n;this.xu=i;}if(this.cn.fixLeftEdge&&null!==i&&i.Os()<=0){const i=n-t;this.Mu-=Math.round(i/this.xu)+1,this.fu=true;}this.Iu(),this.zu();}It(t){if(this.Ni()||!A(t))return 0;const i=this.Lu()+this.Mu-t;return this.o_-(i+.5)*this.xu-1}Js(t,i){const n=this.Lu(),s=void 0===i?0:i.from,e=void 0===i?t.length:i.to;for(let i=s;i<e;i++){const s=t[i].ot,e=n+this.Mu-s,r=this.o_-(e+.5)*this.xu-1;t[i].nt=r;}}Eu(t){return Math.ceil(this.Nu(t))}Jn(t){this.fu=true,this.Mu=t,this.zu(),this.$i.Fu(),this.$i.$h();}he(){return this.xu}Gn(t){this.Wu(t),this.zu(),this.$i.Fu(),this.$i.$h();}ju(){return this.Mu}ja(){if(this.Ni())return null;if(null!==this.wu)return this.wu;const t=this.xu,i=5*(this.$i.W().layout.fontSize+4)/8*(this.cn.tickMarkMaxCharacterLength||8),n=Math.round(i/t),s=b(this.Xs()),e=Math.max(s.Os(),s.Os()-n),r=Math.max(s.ui(),s.ui()-n),h=this.uu.nu(t,i),l=this.Au()+n,a=this.Bu()-n,o=this.Hu(),_=this.cn.fixLeftEdge||o,u=this.cn.fixRightEdge||o;let c=0;for(const t of h){if(!(e<=t.index&&t.index<=r))continue;let n;c<this.gu.length?(n=this.gu[c],n.coord=this.It(t.index),n.label=this.$u(t),n.weight=t.weight):(n={needAlignCoordinate:false,coord:this.It(t.index),label:this.$u(t),weight:t.weight},this.gu.push(n)),this.xu>i/2&&!o?n.needAlignCoordinate=false:n.needAlignCoordinate=_&&t.index<=l||u&&t.index>=a,c++;}return this.gu.length=c,this.wu=this.gu,this.gu}Uu(){this.fu=true,this.Gn(this.cn.barSpacing),this.Jn(this.cn.rightOffset);}qu(t){this.fu=true,this.ou=t,this.zu(),this.Cu();}Yu(t,i){const n=this.Nu(t),s=this.he(),e=s+i*(s/10);this.Gn(e),this.cn.rightBarStaysOnScroll||this.Jn(this.ju()+(n-this.Nu(t)));}Zo(t){this.wo&&this.i_(),null===this.bo&&null===this.bu&&(this.Ni()||(this.bo=t,this.Xu()));}Go(t){if(null===this.bu)return;const i=St(this.o_-t,0,this.o_),n=St(this.o_-b(this.bo),0,this.o_);0!==i&&0!==n&&this.Gn(this.bu.he*i/n);}Jo(){null!==this.bo&&(this.bo=null,this.Ku());}Qo(t){null===this.wo&&null===this.bu&&(this.Ni()||(this.wo=t,this.Xu()));}t_(t){if(null===this.wo)return;const i=(this.wo-t)/this.he();this.Mu=b(this.bu).ju+i,this.fu=true,this.zu();}i_(){null!==this.wo&&(this.wo=null,this.Ku());}Zu(){this.Gu(this.cn.rightOffset);}Gu(t,i=400){if(!isFinite(t))throw new RangeError("offset is required and must be finite number");if(!isFinite(i)||i<=0)throw new RangeError("animationDuration (optional) must be finite positive number");const n=this.Mu,s=performance.now();this.$i.Xn({Ju:t=>(t-s)/i>=1,Qu:e=>{const r=(e-s)/i;return r>=1?t:n+(t-n)*r}});}bt(t,i){this.fu=true,this._u=t,this.uu.tu(t,i),this.zu();}tc(){return this.vu}nc(){return this.pu}sc(){return this.mu}Lu(){return this.ou||0}ec(t){const i=t.Z_();this.Wu(this.o_/i),this.Mu=t.ui()-this.Lu(),this.zu(),this.fu=true,this.$i.Fu(),this.$i.$h();}rc(){const t=this.Au(),i=this.Bu();null!==t&&null!==i&&this.ec(new Mn(t,i+this.cn.rightOffset));}hc(t){const i=new Mn(t.from,t.to);this.ec(i);}qi(t){return void 0!==this.ko.timeFormatter?this.ko.timeFormatter(t.originalTime):this.U_.formatHorzItem(t.time)}Hu(){const{handleScroll:t,handleScale:i}=this.$i.W();return !(t.horzTouchDrag||t.mouseWheel||t.pressedMouseMove||t.vertTouchDrag||i.axisDoubleClickReset.time||i.axisPressedMouseMove.time||i.mouseWheel||i.pinch)}Au(){return 0===this._u.length?null:0}Bu(){return 0===this._u.length?null:this._u.length-1}lc(t){return (this.o_-1-t)/this.xu}Nu(t){const i=this.lc(t),n=this.Lu()+this.Mu-i;return Math.round(1e6*n)/1e6}Wu(t){const i=this.xu;this.xu=t,this.Iu(),i!==this.xu&&(this.fu=true,this.ac());}Pu(){if(!this.fu)return;if(this.fu=false,this.Ni())return void this.oc(kn.au());const t=this.Lu(),i=this.o_/this.xu,n=this.Mu+t,s=new Mn(n-i+1,n);this.oc(new kn(s));}Iu(){const t=this._c();if(this.xu<t&&(this.xu=t,this.fu=true),0!==this.o_){const t=.5*this.o_;this.xu>t&&(this.xu=t,this.fu=true);}}_c(){return this.cn.fixLeftEdge&&this.cn.fixRightEdge&&0!==this._u.length?this.o_/this._u.length:this.cn.minBarSpacing}zu(){const t=this.uc();this.Mu>t&&(this.Mu=t,this.fu=true);const i=this.cc();null!==i&&this.Mu<i&&(this.Mu=i,this.fu=true);}cc(){const t=this.Au(),i=this.ou;if(null===t||null===i)return null;return t-i-1+(this.cn.fixLeftEdge?this.o_/this.xu:Math.min(2,this._u.length))}uc(){return this.cn.fixRightEdge?0:this.o_/this.xu-Math.min(2,this._u.length)}Xu(){this.bu={he:this.he(),ju:this.ju()};}Ku(){this.bu=null;}$u(t){let i=this.cu.get(t.weight);return void 0===i&&(i=new gn((t=>this.dc(t)),this.U_),this.cu.set(t.weight,i)),i.q_(t)}dc(t){return this.U_.formatTickmark(t,this.ko)}oc(t){const i=this.du;this.du=t,xn(i.hu(),this.du.hu())||this.vu.m(),xn(i.lu(),this.du.lu())||this.pu.m(),this.ac();}ac(){this.wu=null;}yu(){this.ac(),this.cu.clear();}Su(){this.U_.updateFormatter(this.ko);}Cu(){if(!this.cn.fixLeftEdge)return;const t=this.Au();if(null===t)return;const i=this.Xs();if(null===i)return;const n=i.Os()-t;if(n<0){const t=this.Mu-n-1;this.Jn(t);}this.Iu();}Tu(){this.zu(),this.Iu();}}class Tn{K(t,i,n){t.useMediaCoordinateSpace((t=>this.Z(t,i,n)));}wl(t,i,n){t.useMediaCoordinateSpace((t=>this.fc(t,i,n)));}fc(t,i,n){}}class Pn extends Tn{constructor(t){super(),this.vc=new Map,this.zt=t;}Z(t){}fc(t){if(!this.zt.yt)return;const{context:i,mediaSize:n}=t;let s=0;for(const t of this.zt.mc){if(0===t.Zt.length)continue;i.font=t.R;const e=this.bc(i,t.Zt);e>n.width?t.Yu=n.width/e:t.Yu=1,s+=t.wc*t.Yu;}let e=0;switch(this.zt.gc){case "top":e=0;break;case "center":e=Math.max((n.height-s)/2,0);break;case "bottom":e=Math.max(n.height-s,0);}i.fillStyle=this.zt.O;for(const t of this.zt.mc){i.save();let s=0;switch(this.zt.Mc){case "left":i.textAlign="left",s=t.wc/2;break;case "center":i.textAlign="center",s=n.width/2;break;case "right":i.textAlign="right",s=n.width-1-t.wc/2;}i.translate(s,e),i.textBaseline="top",i.font=t.R,i.scale(t.Yu,t.Yu),i.fillText(t.Zt,0,t.xc),i.restore(),e+=t.wc*t.Yu;}}bc(t,i){const n=this.Sc(t.font);let s=n.get(i);return void 0===s&&(s=t.measureText(i).width,n.set(i,s)),s}Sc(t){let i=this.vc.get(t);return void 0===i&&(i=new Map,this.vc.set(t,i)),i}}class Rn{constructor(t){this.ft=true,this.Ft={yt:false,O:"",mc:[],gc:"center",Mc:"center"},this.Wt=new Pn(this.Ft),this.jt=t;}bt(){this.ft=true;}gt(){return this.ft&&(this.Mt(),this.ft=false),this.Wt}Mt(){const t=this.jt.W(),i=this.Ft;i.yt=t.visible,i.yt&&(i.O=t.color,i.Mc=t.horzAlign,i.gc=t.vertAlign,i.mc=[{Zt:t.text,R:N(t.fontSize,t.fontFamily,t.fontStyle),wc:1.2*t.fontSize,xc:0,Yu:0}]);}}class Dn extends ht{constructor(t,i){super(),this.cn=i,this.wn=new Rn(this);}Rn(){return []}Pn(){return [this.wn]}W(){return this.cn}On(){this.wn.bt();}}var On,An,Bn,Vn,In;!function(t){t[t.OnTouchEnd=0]="OnTouchEnd",t[t.OnNextTap=1]="OnNextTap";}(On||(On={}));class zn{constructor(t,i,n){this.kc=[],this.yc=[],this.o_=0,this.Cc=null,this.Tc=new R,this.Pc=new R,this.Rc=null,this.Dc=t,this.cn=i,this.U_=n,this.Oc=new F(this),this.kl=new Cn(this,i.timeScale,this.cn.localization,n),this.vt=new at(this,i.crosshair),this.Ac=new Gi(i.crosshair),this.Bc=new Dn(this,i.watermark),this.Vc(),this.kc[0].M_(2e3),this.Ic=this.zc(0),this.Lc=this.zc(1);}Kl(){this.Ec(_t.es());}$h(){this.Ec(_t.ss());}aa(){this.Ec(new _t(1));}Zl(t){const i=this.Nc(t);this.Ec(i);}Fc(){return this.Cc}Wc(t){const i=this.Cc;this.Cc=t,null!==i&&this.Zl(i.jc),null!==t&&this.Zl(t.jc);}W(){return this.cn}Hh(t){D(this.cn,t),this.kc.forEach((i=>i.m_(t))),void 0!==t.timeScale&&this.kl.Hh(t.timeScale),void 0!==t.localization&&this.kl.ku(t.localization),(t.leftPriceScale||t.rightPriceScale)&&this.Tc.m(),this.Ic=this.zc(0),this.Lc=this.zc(1),this.Kl();}Hc(t,i){if("left"===t)return void this.Hh({leftPriceScale:i});if("right"===t)return void this.Hh({rightPriceScale:i});const n=this.$c(t);null!==n&&(n.Dt.Hh(i),this.Tc.m());}$c(t){for(const i of this.kc){const n=i.b_(t);if(null!==n)return {Ht:i,Dt:n}}return null}St(){return this.kl}Uc(){return this.kc}qc(){return this.Bc}Yc(){return this.vt}Xc(){return this.Pc}Kc(t,i){t.zo(i),this.Fu();}x_(t){this.o_=t,this.kl.x_(this.o_),this.kc.forEach((i=>i.x_(t))),this.Fu();}Vc(t){const i=new wn(this.kl,this);void 0!==t?this.kc.splice(t,0,i):this.kc.push(i);const n=void 0===t?this.kc.length-1:t,s=_t.es();return s.Nn(n,{Fn:0,Wn:true}),this.Ec(s),i}D_(t,i,n){t.D_(i,n);}O_(t,i,n){t.O_(i,n),this.Gl(),this.Ec(this.Zc(t,2));}A_(t,i){t.A_(i),this.Ec(this.Zc(t,2));}B_(t,i,n){i.Do()||t.B_(i,n);}V_(t,i,n){i.Do()||(t.V_(i,n),this.Gl(),this.Ec(this.Zc(t,2)));}I_(t,i){i.Do()||(t.I_(i),this.Ec(this.Zc(t,2)));}L_(t,i){t.L_(i),this.Ec(this.Zc(t,2));}Gc(t){this.kl.Zo(t);}Jc(t,i){const n=this.St();if(n.Ni()||0===i)return;const s=n.Hi();t=Math.max(1,Math.min(t,s)),n.Yu(t,i),this.Fu();}Qc(t){this.td(0),this.nd(t),this.sd();}ed(t){this.kl.Go(t),this.Fu();}rd(){this.kl.Jo(),this.$h();}td(t){this.kl.Qo(t);}nd(t){this.kl.t_(t),this.Fu();}sd(){this.kl.i_(),this.$h();}wt(){return this.yc}hd(t,i,n,s,e){this.vt.gn(t,i);let r=NaN,h=this.kl.Eu(t);const l=this.kl.Xs();null!==l&&(h=Math.min(Math.max(l.Os(),h),l.ui()));const a=s.vn(),o=a.Ct();null!==o&&(r=a.pn(i,o)),r=this.Ac.Oa(r,h,s),this.vt.kn(h,r,s),this.aa(),e||this.Pc.m(this.vt.xt(),{x:t,y:i},n);}ld(t,i,n){const s=n.vn(),e=s.Ct(),r=s.Rt(t,b(e)),h=this.kl.Da(i,true),l=this.kl.It(b(h));this.hd(l,r,null,n,true);}ad(t){this.Yc().Cn(),this.aa(),t||this.Pc.m(null,null,null);}Gl(){const t=this.vt.Ht();if(null!==t){const i=this.vt.xn(),n=this.vt.Sn();this.hd(i,n,null,t);}this.vt.On();}od(t,i,n){const s=this.kl.mn(0);void 0!==i&&void 0!==n&&this.kl.bt(i,n);const e=this.kl.mn(0),r=this.kl.Lu(),h=this.kl.Xs();if(null!==h&&null!==s&&null!==e){const i=h.Kr(r),l=this.U_.key(s)>this.U_.key(e),a=null!==t&&t>r&&!l,o=this.kl.W().allowShiftVisibleRangeOnWhitespaceReplacement,_=i&&(!(void 0===n)||o)&&this.kl.W().shiftVisibleRangeOnNewBar;if(a&&!_){const i=t-r;this.kl.Jn(this.kl.ju()-i);}}this.kl.qu(t);}ta(t){null!==t&&t.N_();}cr(t){const i=this.kc.find((i=>i.$o().includes(t)));return void 0===i?null:i}Fu(){this.Bc.On(),this.kc.forEach((t=>t.N_())),this.Gl();}S(){this.kc.forEach((t=>t.S())),this.kc.length=0,this.cn.localization.priceFormatter=void 0,this.cn.localization.percentageFormatter=void 0,this.cn.localization.timeFormatter=void 0;}_d(){return this.Oc}mr(){return this.Oc.W()}w_(){return this.Tc}ud(t,i,n){const s=this.kc[0],e=this.dd(i,t,s,n);return this.yc.push(e),1===this.yc.length?this.Kl():this.$h(),e}fd(t){const i=this.cr(t),n=this.yc.indexOf(t);p(-1!==n,"Series not found"),this.yc.splice(n,1),b(i).Yo(t),t.S&&t.S();}Xl(t,i){const n=b(this.cr(t));n.Yo(t);const s=this.$c(i);if(null===s){const s=t.Ki();n.Uo(t,i,s);}else {const e=s.Ht===n?t.Ki():void 0;s.Ht.Uo(t,i,e);}}rc(){const t=_t.ss();t.$n(),this.Ec(t);}vd(t){const i=_t.ss();i.Yn(t),this.Ec(i);}Zn(){const t=_t.ss();t.Zn(),this.Ec(t);}Gn(t){const i=_t.ss();i.Gn(t),this.Ec(i);}Jn(t){const i=_t.ss();i.Jn(t),this.Ec(i);}Xn(t){const i=_t.ss();i.Xn(t),this.Ec(i);}Un(){const t=_t.ss();t.Un(),this.Ec(t);}pd(){return this.cn.rightPriceScale.visible?"right":"left"}md(){return this.Lc}q(){return this.Ic}Bt(t){const i=this.Lc,n=this.Ic;if(i===n)return i;if(t=Math.max(0,Math.min(100,Math.round(100*t))),null===this.Rc||this.Rc.Ts!==n||this.Rc.Ps!==i)this.Rc={Ts:n,Ps:i,bd:new Map};else {const i=this.Rc.bd.get(t);if(void 0!==i)return i}const s=function(t,i,n){const[s,e,r,h]=T(t),[l,a,o,_]=T(i),u=[M(s+n*(l-s)),M(e+n*(a-e)),M(r+n*(o-r)),x(h+n*(_-h))];return `rgba(${u[0]}, ${u[1]}, ${u[2]}, ${u[3]})`}(n,i,t/100);return this.Rc.bd.set(t,s),s}Zc(t,i){const n=new _t(i);if(null!==t){const s=this.kc.indexOf(t);n.Nn(s,{Fn:i});}return n}Nc(t,i){return void 0===i&&(i=2),this.Zc(this.cr(t),i)}Ec(t){this.Dc&&this.Dc(t),this.kc.forEach((t=>t.W_().Uh().bt()));}dd(t,i,n,s){const e=new Zi(this,t,i,n,s),r=void 0!==t.priceScaleId?t.priceScaleId:this.pd();return n.Uo(e,r),ot(r)||e.Hh(t),e}zc(t){const i=this.cn.layout;return "gradient"===i.background.type?0===t?i.background.topColor:i.background.bottomColor:i.background.color}}function Ln(t){return !O(t)&&!B(t)}function En(t){return O(t)}!function(t){t[t.Disabled=0]="Disabled",t[t.Continuous=1]="Continuous",t[t.OnDataUpdate=2]="OnDataUpdate";}(An||(An={})),function(t){t[t.LastBar=0]="LastBar",t[t.LastVisible=1]="LastVisible";}(Bn||(Bn={})),function(t){t.Solid="solid",t.VerticalGradient="gradient";}(Vn||(Vn={})),function(t){t[t.Year=0]="Year",t[t.Month=1]="Month",t[t.DayOfMonth=2]="DayOfMonth",t[t.Time=3]="Time",t[t.TimeWithSeconds=4]="TimeWithSeconds";}(In||(In={}));const Nn=t=>t.getUTCFullYear();function Fn(t,i,n){return i.replace(/yyyy/g,(t=>ct(Nn(t),4))(t)).replace(/yy/g,(t=>ct(Nn(t)%100,2))(t)).replace(/MMMM/g,((t,i)=>new Date(t.getUTCFullYear(),t.getUTCMonth(),1).toLocaleString(i,{month:"long"}))(t,n)).replace(/MMM/g,((t,i)=>new Date(t.getUTCFullYear(),t.getUTCMonth(),1).toLocaleString(i,{month:"short"}))(t,n)).replace(/MM/g,(t=>ct((t=>t.getUTCMonth()+1)(t),2))(t)).replace(/dd/g,(t=>ct((t=>t.getUTCDate())(t),2))(t))}class Wn{constructor(t="yyyy-MM-dd",i="default"){this.wd=t,this.gd=i;}q_(t){return Fn(t,this.wd,this.gd)}}class jn{constructor(t){this.Md=t||"%h:%m:%s";}q_(t){return this.Md.replace("%h",ct(t.getUTCHours(),2)).replace("%m",ct(t.getUTCMinutes(),2)).replace("%s",ct(t.getUTCSeconds(),2))}}const Hn={xd:"yyyy-MM-dd",Sd:"%h:%m:%s",kd:" ",yd:"default"};class $n{constructor(t={}){const i=Object.assign(Object.assign({},Hn),t);this.Cd=new Wn(i.xd,i.yd),this.Td=new jn(i.Sd),this.Pd=i.kd;}q_(t){return `${this.Cd.q_(t)}${this.Pd}${this.Td.q_(t)}`}}function Un(t){return 60*t*60*1e3}function qn(t){return 60*t*1e3}const Yn=[{Rd:(Xn=1,1e3*Xn),Dd:10},{Rd:qn(1),Dd:20},{Rd:qn(5),Dd:21},{Rd:qn(30),Dd:22},{Rd:Un(1),Dd:30},{Rd:Un(3),Dd:31},{Rd:Un(6),Dd:32},{Rd:Un(12),Dd:33}];var Xn;function Kn(t,i){if(t.getUTCFullYear()!==i.getUTCFullYear())return 70;if(t.getUTCMonth()!==i.getUTCMonth())return 60;if(t.getUTCDate()!==i.getUTCDate())return 50;for(let n=Yn.length-1;n>=0;--n)if(Math.floor(i.getTime()/Yn[n].Rd)!==Math.floor(t.getTime()/Yn[n].Rd))return Yn[n].Dd;return 0}function Zn(t){let i=t;if(B(t)&&(i=Jn(t)),!Ln(i))throw new Error("time must be of type BusinessDay");const n=new Date(Date.UTC(i.year,i.month-1,i.day,0,0,0,0));return {Od:Math.round(n.getTime()/1e3),Ad:i}}function Gn(t){if(!En(t))throw new Error("time must be of type isUTCTimestamp");return {Od:t}}function Jn(t){const i=new Date(t);if(isNaN(i.getTime()))throw new Error(`Invalid date string=${t}, expected format=yyyy-mm-dd`);return {day:i.getUTCDate(),month:i.getUTCMonth()+1,year:i.getUTCFullYear()}}function Qn(t){B(t.time)&&(t.time=Jn(t.time));}class ts{options(){return this.cn}setOptions(t){this.cn=t,this.updateFormatter(t.localization);}preprocessData(t){Array.isArray(t)?function(t){t.forEach(Qn);}(t):Qn(t);}createConverterToInternalObj(t){return b(function(t){return 0===t.length?null:Ln(t[0].time)||B(t[0].time)?Zn:Gn}(t))}key(t){return "object"==typeof t&&"Od"in t?t.Od:this.key(this.convertHorzItemToInternal(t))}cacheKey(t){const i=t;return void 0===i.Ad?new Date(1e3*i.Od).getTime():new Date(Date.UTC(i.Ad.year,i.Ad.month-1,i.Ad.day)).getTime()}convertHorzItemToInternal(t){return En(i=t)?Gn(i):Ln(i)?Zn(i):Zn(Jn(i));var i;}updateFormatter(t){if(!this.cn)return;const i=t.dateFormat;this.cn.timeScale.timeVisible?this.Bd=new $n({xd:i,Sd:this.cn.timeScale.secondsVisible?"%h:%m:%s":"%h:%m",kd:" ",yd:t.locale}):this.Bd=new Wn(i,t.locale);}formatHorzItem(t){const i=t;return this.Bd.q_(new Date(1e3*i.Od))}formatTickmark(t,i){const n=function(t,i,n){switch(t){case 0:case 10:return i?n?4:3:2;case 20:case 21:case 22:case 30:case 31:case 32:case 33:return i?3:2;case 50:return 2;case 60:return 1;case 70:return 0}}(t.weight,this.cn.timeScale.timeVisible,this.cn.timeScale.secondsVisible),s=this.cn.timeScale;if(void 0!==s.tickMarkFormatter){const e=s.tickMarkFormatter(t.originalTime,n,i.locale);if(null!==e)return e}return function(t,i,n){const s={};switch(i){case 0:s.year="numeric";break;case 1:s.month="short";break;case 2:s.day="numeric";break;case 3:s.hour12=false,s.hour="2-digit",s.minute="2-digit";break;case 4:s.hour12=false,s.hour="2-digit",s.minute="2-digit",s.second="2-digit";}const e=void 0===t.Ad?new Date(1e3*t.Od):new Date(Date.UTC(t.Ad.year,t.Ad.month-1,t.Ad.day));return new Date(e.getUTCFullYear(),e.getUTCMonth(),e.getUTCDate(),e.getUTCHours(),e.getUTCMinutes(),e.getUTCSeconds(),e.getUTCMilliseconds()).toLocaleString(n,s)}(t.time,n,i.locale)}maxTickMarkWeight(t){let i=t.reduce(yn,t[0]).weight;return i>30&&i<50&&(i=30),i}fillWeightsForPoints(t,i){!function(t,i=0){if(0===t.length)return;let n=0===i?null:t[i-1].time.Od,s=null!==n?new Date(1e3*n):null,e=0;for(let r=i;r<t.length;++r){const i=t[r],h=new Date(1e3*i.time.Od);null!==s&&(i.timeWeight=Kn(h,s)),e+=i.time.Od-(n||i.time.Od),n=i.time.Od,s=h;}if(0===i&&t.length>1){const i=Math.ceil(e/(t.length-1)),n=new Date(1e3*(t[0].time.Od-i));t[0].timeWeight=Kn(new Date(1e3*t[0].time.Od),n);}}(t,i);}static Vd(t){return D({localization:{dateFormat:"dd MMM 'yy"}},null!=t?t:{})}}const is="undefined"!=typeof window;function ns(){return !!is&&window.navigator.userAgent.toLowerCase().indexOf("firefox")>-1}function ss(){return !!is&&/iPhone|iPad|iPod/.test(window.navigator.platform)}function es(t){return t+t%2}function rs(t,i){return t.Id-i.Id}function hs(t,i,n){const s=(t.Id-i.Id)/(t.ot-i.ot);return Math.sign(s)*Math.min(Math.abs(s),n)}class ls{constructor(t,i,n,s){this.zd=null,this.Ld=null,this.Ed=null,this.Nd=null,this.Fd=null,this.Wd=0,this.jd=0,this.Hd=t,this.$d=i,this.Ud=n,this.rs=s;}qd(t,i){if(null!==this.zd){if(this.zd.ot===i)return void(this.zd.Id=t);if(Math.abs(this.zd.Id-t)<this.rs)return}this.Nd=this.Ed,this.Ed=this.Ld,this.Ld=this.zd,this.zd={ot:i,Id:t};}Dr(t,i){if(null===this.zd||null===this.Ld)return;if(i-this.zd.ot>50)return;let n=0;const s=hs(this.zd,this.Ld,this.$d),e=rs(this.zd,this.Ld),r=[s],h=[e];if(n+=e,null!==this.Ed){const t=hs(this.Ld,this.Ed,this.$d);if(Math.sign(t)===Math.sign(s)){const i=rs(this.Ld,this.Ed);if(r.push(t),h.push(i),n+=i,null!==this.Nd){const t=hs(this.Ed,this.Nd,this.$d);if(Math.sign(t)===Math.sign(s)){const i=rs(this.Ed,this.Nd);r.push(t),h.push(i),n+=i;}}}}let l=0;for(let t=0;t<r.length;++t)l+=h[t]/n*r[t];Math.abs(l)<this.Hd||(this.Fd={Id:t,ot:i},this.jd=l,this.Wd=function(t,i){const n=Math.log(i);return Math.log(1*n/-t)/n}(Math.abs(l),this.Ud));}Qu(t){const i=b(this.Fd),n=t-i.ot;return i.Id+this.jd*(Math.pow(this.Ud,n)-1)/Math.log(this.Ud)}Ju(t){return null===this.Fd||this.Yd(t)===this.Wd}Yd(t){const i=t-b(this.Fd).ot;return Math.min(i,this.Wd)}}function as(t,n){const s=b(t.ownerDocument).createElement("canvas");t.appendChild(s);const e=bindTo(s,{options:{allowResizeObserver:false},transform:(t,i)=>({width:Math.max(t.width,i.width),height:Math.max(t.height,i.height)})});return e.resizeCanvasElement(n),e}function os(t){var i;t.width=1,t.height=1,null===(i=t.getContext("2d"))||void 0===i||i.clearRect(0,0,1,1);}function _s(t,i,n,s){t.wl&&t.wl(i,n,s);}function us(t,i,n,s){t.K(i,n,s);}function cs(t,i,n,s){const e=t(n,s);for(const t of e){const n=t.gt();null!==n&&i(n);}}function ds(t){is&&void 0!==window.chrome&&t.addEventListener("mousedown",(t=>{if(1===t.button)return t.preventDefault(),false}));}class fs{constructor(t,i,n){this.Xd=0,this.Kd=null,this.Zd={nt:Number.NEGATIVE_INFINITY,st:Number.POSITIVE_INFINITY},this.Gd=0,this.Jd=null,this.Qd={nt:Number.NEGATIVE_INFINITY,st:Number.POSITIVE_INFINITY},this.tf=null,this.if=false,this.nf=null,this.sf=null,this.ef=false,this.rf=false,this.hf=false,this.lf=null,this.af=null,this._f=null,this.uf=null,this.cf=null,this.df=null,this.ff=null,this.vf=0,this.pf=false,this.mf=false,this.bf=false,this.wf=0,this.gf=null,this.Mf=!ss(),this.xf=t=>{this.Sf(t);},this.kf=t=>{if(this.yf(t)){const i=this.Cf(t);if(++this.Gd,this.Jd&&this.Gd>1){const{Tf:n}=this.Pf(ms(t),this.Qd);n<30&&!this.hf&&this.Rf(i,this.Of.Df),this.Af();}}else {const i=this.Cf(t);if(++this.Xd,this.Kd&&this.Xd>1){const{Tf:n}=this.Pf(ms(t),this.Zd);n<5&&!this.rf&&this.Bf(i,this.Of.Vf),this.If();}}},this.zf=t,this.Of=i,this.cn=n,this.Lf();}S(){null!==this.lf&&(this.lf(),this.lf=null),null!==this.af&&(this.af(),this.af=null),null!==this.uf&&(this.uf(),this.uf=null),null!==this.cf&&(this.cf(),this.cf=null),null!==this.df&&(this.df(),this.df=null),null!==this._f&&(this._f(),this._f=null),this.Ef(),this.If();}Nf(t){this.uf&&this.uf();const i=this.Ff.bind(this);if(this.uf=()=>{this.zf.removeEventListener("mousemove",i);},this.zf.addEventListener("mousemove",i),this.yf(t))return;const n=this.Cf(t);this.Bf(n,this.Of.Wf),this.Mf=true;}If(){null!==this.Kd&&clearTimeout(this.Kd),this.Xd=0,this.Kd=null,this.Zd={nt:Number.NEGATIVE_INFINITY,st:Number.POSITIVE_INFINITY};}Af(){null!==this.Jd&&clearTimeout(this.Jd),this.Gd=0,this.Jd=null,this.Qd={nt:Number.NEGATIVE_INFINITY,st:Number.POSITIVE_INFINITY};}Ff(t){if(this.bf||null!==this.sf)return;if(this.yf(t))return;const i=this.Cf(t);this.Bf(i,this.Of.jf),this.Mf=true;}Hf(t){const i=ws(t.changedTouches,b(this.gf));if(null===i)return;if(this.wf=bs(t),null!==this.ff)return;if(this.mf)return;this.pf=true;const n=this.Pf(ms(i),b(this.sf)),{$f:s,Uf:e,Tf:r}=n;if(this.ef||!(r<5)){if(!this.ef){const t=.5*s,i=e>=t&&!this.cn.qf(),n=t>e&&!this.cn.Yf();i||n||(this.mf=true),this.ef=true,this.hf=true,this.Ef(),this.Af();}if(!this.mf){const n=this.Cf(t,i);this.Rf(n,this.Of.Xf),ps(t);}}}Kf(t){if(0!==t.button)return;const i=this.Pf(ms(t),b(this.nf)),{Tf:n}=i;if(n>=5&&(this.rf=true,this.If()),this.rf){const i=this.Cf(t);this.Bf(i,this.Of.Zf);}}Pf(t,i){const n=Math.abs(i.nt-t.nt),s=Math.abs(i.st-t.st);return {$f:n,Uf:s,Tf:n+s}}Gf(t){let i=ws(t.changedTouches,b(this.gf));if(null===i&&0===t.touches.length&&(i=t.changedTouches[0]),null===i)return;this.gf=null,this.wf=bs(t),this.Ef(),this.sf=null,this.df&&(this.df(),this.df=null);const n=this.Cf(t,i);if(this.Rf(n,this.Of.Jf),++this.Gd,this.Jd&&this.Gd>1){const{Tf:t}=this.Pf(ms(i),this.Qd);t<30&&!this.hf&&this.Rf(n,this.Of.Df),this.Af();}else this.hf||(this.Rf(n,this.Of.Qf),this.Of.Qf&&ps(t));0===this.Gd&&ps(t),0===t.touches.length&&this.if&&(this.if=false,ps(t));}Sf(t){if(0!==t.button)return;const i=this.Cf(t);if(this.nf=null,this.bf=false,this.cf&&(this.cf(),this.cf=null),ns()){this.zf.ownerDocument.documentElement.removeEventListener("mouseleave",this.xf);}if(!this.yf(t))if(this.Bf(i,this.Of.tv),++this.Xd,this.Kd&&this.Xd>1){const{Tf:n}=this.Pf(ms(t),this.Zd);n<5&&!this.rf&&this.Bf(i,this.Of.Vf),this.If();}else this.rf||this.Bf(i,this.Of.iv);}Ef(){null!==this.tf&&(clearTimeout(this.tf),this.tf=null);}nv(t){if(null!==this.gf)return;const i=t.changedTouches[0];this.gf=i.identifier,this.wf=bs(t);const n=this.zf.ownerDocument.documentElement;this.hf=false,this.ef=false,this.mf=false,this.sf=ms(i),this.df&&(this.df(),this.df=null);{const i=this.Hf.bind(this),s=this.Gf.bind(this);this.df=()=>{n.removeEventListener("touchmove",i),n.removeEventListener("touchend",s);},n.addEventListener("touchmove",i,{passive:false}),n.addEventListener("touchend",s,{passive:false}),this.Ef(),this.tf=setTimeout(this.sv.bind(this,t),240);}const s=this.Cf(t,i);this.Rf(s,this.Of.ev),this.Jd||(this.Gd=0,this.Jd=setTimeout(this.Af.bind(this),500),this.Qd=ms(i));}rv(t){if(0!==t.button)return;const i=this.zf.ownerDocument.documentElement;ns()&&i.addEventListener("mouseleave",this.xf),this.rf=false,this.nf=ms(t),this.cf&&(this.cf(),this.cf=null);{const t=this.Kf.bind(this),n=this.Sf.bind(this);this.cf=()=>{i.removeEventListener("mousemove",t),i.removeEventListener("mouseup",n);},i.addEventListener("mousemove",t),i.addEventListener("mouseup",n);}if(this.bf=true,this.yf(t))return;const n=this.Cf(t);this.Bf(n,this.Of.hv),this.Kd||(this.Xd=0,this.Kd=setTimeout(this.If.bind(this),500),this.Zd=ms(t));}Lf(){this.zf.addEventListener("mouseenter",this.Nf.bind(this)),this.zf.addEventListener("touchcancel",this.Ef.bind(this));{const t=this.zf.ownerDocument,i=t=>{this.Of.lv&&(t.composed&&this.zf.contains(t.composedPath()[0])||t.target&&this.zf.contains(t.target)||this.Of.lv());};this.af=()=>{t.removeEventListener("touchstart",i);},this.lf=()=>{t.removeEventListener("mousedown",i);},t.addEventListener("mousedown",i),t.addEventListener("touchstart",i,{passive:true});}ss()&&(this._f=()=>{this.zf.removeEventListener("dblclick",this.kf);},this.zf.addEventListener("dblclick",this.kf)),this.zf.addEventListener("mouseleave",this.av.bind(this)),this.zf.addEventListener("touchstart",this.nv.bind(this),{passive:true}),ds(this.zf),this.zf.addEventListener("mousedown",this.rv.bind(this)),this.ov(),this.zf.addEventListener("touchmove",(()=>{}),{passive:false});}ov(){ void 0===this.Of._v&&void 0===this.Of.uv&&void 0===this.Of.cv||(this.zf.addEventListener("touchstart",(t=>this.dv(t.touches)),{passive:true}),this.zf.addEventListener("touchmove",(t=>{if(2===t.touches.length&&null!==this.ff&&void 0!==this.Of.uv){const i=vs(t.touches[0],t.touches[1])/this.vf;this.Of.uv(this.ff,i),ps(t);}}),{passive:false}),this.zf.addEventListener("touchend",(t=>{this.dv(t.touches);})));}dv(t){1===t.length&&(this.pf=false),2!==t.length||this.pf||this.if?this.fv():this.vv(t);}vv(t){const i=this.zf.getBoundingClientRect()||{left:0,top:0};this.ff={nt:(t[0].clientX-i.left+(t[1].clientX-i.left))/2,st:(t[0].clientY-i.top+(t[1].clientY-i.top))/2},this.vf=vs(t[0],t[1]),void 0!==this.Of._v&&this.Of._v(),this.Ef();}fv(){null!==this.ff&&(this.ff=null,void 0!==this.Of.cv&&this.Of.cv());}av(t){if(this.uf&&this.uf(),this.yf(t))return;if(!this.Mf)return;const i=this.Cf(t);this.Bf(i,this.Of.pv),this.Mf=!ss();}sv(t){const i=ws(t.touches,b(this.gf));if(null===i)return;const n=this.Cf(t,i);this.Rf(n,this.Of.mv),this.hf=true,this.if=true;}yf(t){return t.sourceCapabilities&&void 0!==t.sourceCapabilities.firesTouchEvents?t.sourceCapabilities.firesTouchEvents:bs(t)<this.wf+500}Rf(t,i){i&&i.call(this.Of,t);}Bf(t,i){i&&i.call(this.Of,t);}Cf(t,i){const n=i||t,s=this.zf.getBoundingClientRect()||{left:0,top:0};return {clientX:n.clientX,clientY:n.clientY,pageX:n.pageX,pageY:n.pageY,screenX:n.screenX,screenY:n.screenY,localX:n.clientX-s.left,localY:n.clientY-s.top,ctrlKey:t.ctrlKey,altKey:t.altKey,shiftKey:t.shiftKey,metaKey:t.metaKey,bv:!t.type.startsWith("mouse")&&"contextmenu"!==t.type&&"click"!==t.type,wv:t.type,gv:n.target,Mv:t.view,xv:()=>{"touchstart"!==t.type&&ps(t);}}}}function vs(t,i){const n=t.clientX-i.clientX,s=t.clientY-i.clientY;return Math.sqrt(n*n+s*s)}function ps(t){t.cancelable&&t.preventDefault();}function ms(t){return {nt:t.pageX,st:t.pageY}}function bs(t){return t.timeStamp||performance.now()}function ws(t,i){for(let n=0;n<t.length;++n)if(t[n].identifier===i)return t[n];return null}function gs(t){return {jc:t.jc,Sv:{wr:t.kv.externalId},yv:t.kv.cursorStyle}}function Ms(t,i,n){for(const s of t){const t=s.gt();if(null!==t&&t.br){const e=t.br(i,n);if(null!==e)return {Mv:s,Sv:e}}}return null}function xs(t,i){return n=>{var s,e,r,h;return (null!==(e=null===(s=n.Dt())||void 0===s?void 0:s.Ta())&&void 0!==e?e:"")!==i?[]:null!==(h=null===(r=n.ca)||void 0===r?void 0:r.call(n,t))&&void 0!==h?h:[]}}class Ss{constructor(i,n,s,e){this.Li=null,this.Cv=null,this.Tv=false,this.Pv=new ii(200),this.Jr=null,this.Rv=0,this.Dv=false,this.Ov=()=>{this.Dv||this.tn.Av().$t().$h();},this.Bv=()=>{this.Dv||this.tn.Av().$t().$h();},this.tn=i,this.cn=n,this.So=n.layout,this.Oc=s,this.Vv="left"===e,this.Iv=xs("normal",e),this.zv=xs("top",e),this.Lv=xs("bottom",e),this.Ev=document.createElement("div"),this.Ev.style.height="100%",this.Ev.style.overflow="hidden",this.Ev.style.width="25px",this.Ev.style.left="0",this.Ev.style.position="relative",this.Nv=as(this.Ev,size({width:16,height:16})),this.Nv.subscribeSuggestedBitmapSizeChanged(this.Ov);const r=this.Nv.canvasElement;r.style.position="absolute",r.style.zIndex="1",r.style.left="0",r.style.top="0",this.Fv=as(this.Ev,size({width:16,height:16})),this.Fv.subscribeSuggestedBitmapSizeChanged(this.Bv);const h=this.Fv.canvasElement;h.style.position="absolute",h.style.zIndex="2",h.style.left="0",h.style.top="0";const l={hv:this.Wv.bind(this),ev:this.Wv.bind(this),Zf:this.jv.bind(this),Xf:this.jv.bind(this),lv:this.Hv.bind(this),tv:this.$v.bind(this),Jf:this.$v.bind(this),Vf:this.Uv.bind(this),Df:this.Uv.bind(this),Wf:this.qv.bind(this),pv:this.Yv.bind(this)};this.Xv=new fs(this.Fv.canvasElement,l,{qf:()=>!this.cn.handleScroll.vertTouchDrag,Yf:()=>true});}S(){this.Xv.S(),this.Fv.unsubscribeSuggestedBitmapSizeChanged(this.Bv),os(this.Fv.canvasElement),this.Fv.dispose(),this.Nv.unsubscribeSuggestedBitmapSizeChanged(this.Ov),os(this.Nv.canvasElement),this.Nv.dispose(),null!==this.Li&&this.Li.Ko().p(this),this.Li=null;}Kv(){return this.Ev}P(){return this.So.fontSize}Zv(){const t=this.Oc.W();return this.Jr!==t.R&&(this.Pv.ir(),this.Jr=t.R),t}Gv(){if(null===this.Li)return 0;let t=0;const i=this.Zv(),n=b(this.Nv.canvasElement.getContext("2d"));n.save();const s=this.Li.ja();n.font=this.Jv(),s.length>0&&(t=Math.max(this.Pv.xi(n,s[0].no),this.Pv.xi(n,s[s.length-1].no)));const e=this.Qv();for(let i=e.length;i--;){const s=this.Pv.xi(n,e[i].Zt());s>t&&(t=s);}const r=this.Li.Ct();if(null!==r&&null!==this.Cv){const i=this.Li.pn(1,r),s=this.Li.pn(this.Cv.height-2,r);t=Math.max(t,this.Pv.xi(n,this.Li.Fi(Math.floor(Math.min(i,s))+.11111111111111,r)),this.Pv.xi(n,this.Li.Fi(Math.ceil(Math.max(i,s))-.11111111111111,r)));}n.restore();const h=t||34;return es(Math.ceil(i.C+i.T+i.V+i.I+5+h))}tp(t){null!==this.Cv&&equalSizes(this.Cv,t)||(this.Cv=t,this.Dv=true,this.Nv.resizeCanvasElement(t),this.Fv.resizeCanvasElement(t),this.Dv=false,this.Ev.style.width=`${t.width}px`,this.Ev.style.height=`${t.height}px`);}ip(){return b(this.Cv).width}Gi(t){this.Li!==t&&(null!==this.Li&&this.Li.Ko().p(this),this.Li=t,t.Ko().l(this.do.bind(this),this));}Dt(){return this.Li}ir(){const t=this.tn.np();this.tn.Av().$t().L_(t,b(this.Dt()));}sp(t){if(null===this.Cv)return;if(1!==t){this.ep(),this.Nv.applySuggestedBitmapSize();const t=tryCreateCanvasRenderingTarget2D(this.Nv);null!==t&&(t.useBitmapCoordinateSpace((t=>{this.rp(t),this.Ve(t);})),this.tn.hp(t,this.Lv),this.lp(t),this.tn.hp(t,this.Iv),this.ap(t));}this.Fv.applySuggestedBitmapSize();const i=tryCreateCanvasRenderingTarget2D(this.Fv);null!==i&&(i.useBitmapCoordinateSpace((({context:t,bitmapSize:i})=>{t.clearRect(0,0,i.width,i.height);})),this.op(i),this.tn.hp(i,this.zv));}_p(){return this.Nv.bitmapSize}up(t,i,n){const s=this._p();s.width>0&&s.height>0&&t.drawImage(this.Nv.canvasElement,i,n);}bt(){var t;null===(t=this.Li)||void 0===t||t.ja();}Wv(t){if(null===this.Li||this.Li.Ni()||!this.cn.handleScale.axisPressedMouseMove.price)return;const i=this.tn.Av().$t(),n=this.tn.np();this.Tv=true,i.D_(n,this.Li,t.localY);}jv(t){if(null===this.Li||!this.cn.handleScale.axisPressedMouseMove.price)return;const i=this.tn.Av().$t(),n=this.tn.np(),s=this.Li;i.O_(n,s,t.localY);}Hv(){if(null===this.Li||!this.cn.handleScale.axisPressedMouseMove.price)return;const t=this.tn.Av().$t(),i=this.tn.np(),n=this.Li;this.Tv&&(this.Tv=false,t.A_(i,n));}$v(t){if(null===this.Li||!this.cn.handleScale.axisPressedMouseMove.price)return;const i=this.tn.Av().$t(),n=this.tn.np();this.Tv=false,i.A_(n,this.Li);}Uv(t){this.cn.handleScale.axisDoubleClickReset.price&&this.ir();}qv(t){if(null===this.Li)return;!this.tn.Av().$t().W().handleScale.axisPressedMouseMove.price||this.Li.gh()||this.Li.Oo()||this.cp(1);}Yv(t){this.cp(0);}Qv(){const t=[],i=null===this.Li?void 0:this.Li;return (n=>{for(let s=0;s<n.length;++s){const e=n[s].Rn(this.tn.np(),i);for(let i=0;i<e.length;i++)t.push(e[i]);}})(this.tn.np().$o()),t}rp({context:t,bitmapSize:i}){const{width:n,height:s}=i,e=this.tn.np().$t(),r=e.q(),h=e.md();r===h?Z(t,0,0,n,s,r):Q(t,0,0,n,s,r,h);}Ve({context:t,bitmapSize:i,horizontalPixelRatio:n}){if(null===this.Cv||null===this.Li||!this.Li.W().borderVisible)return;t.fillStyle=this.Li.W().borderColor;const s=Math.max(1,Math.floor(this.Zv().C*n));let e;e=this.Vv?i.width-s:0,t.fillRect(e,0,s,i.height);}lp(t){if(null===this.Cv||null===this.Li)return;const i=this.Li.ja(),n=this.Li.W(),s=this.Zv(),e=this.Vv?this.Cv.width-s.T:0;n.borderVisible&&n.ticksVisible&&t.useBitmapCoordinateSpace((({context:t,horizontalPixelRatio:r,verticalPixelRatio:h})=>{t.fillStyle=n.borderColor;const l=Math.max(1,Math.floor(h)),a=Math.floor(.5*h),o=Math.round(s.T*r);t.beginPath();for(const n of i)t.rect(Math.floor(e*r),Math.round(n.La*h)-a,o,l);t.fill();})),t.useMediaCoordinateSpace((({context:t})=>{var r;t.font=this.Jv(),t.fillStyle=null!==(r=n.textColor)&&void 0!==r?r:this.So.textColor,t.textAlign=this.Vv?"right":"left",t.textBaseline="middle";const h=this.Vv?Math.round(e-s.V):Math.round(e+s.T+s.V),l=i.map((i=>this.Pv.Mi(t,i.no)));for(let n=i.length;n--;){const s=i[n];t.fillText(s.no,h,s.La+l[n]);}}));}ep(){if(null===this.Cv||null===this.Li)return;let t=this.Cv.height/2;const i=[],n=this.Li.$o().slice(),s=this.tn.np(),e=this.Zv();this.Li===s.vr()&&this.tn.np().$o().forEach((t=>{s.dr(t)&&n.push(t);}));const r=this.Li.Aa()[0],h=this.Li;n.forEach((n=>{const e=n.Rn(s,h);e.forEach((t=>{t.Ai(null),t.Bi()&&i.push(t);})),r===n&&e.length>0&&(t=e[0].ki());})),i.forEach((t=>t.Ai(t.ki())));this.Li.W().alignLabels&&this.dp(i,e,t);}dp(t,i,n){if(null===this.Cv)return;const s=t.filter((t=>t.ki()<=n)),e=t.filter((t=>t.ki()>n));s.sort(((t,i)=>i.ki()-t.ki())),s.length&&e.length&&e.push(s[0]),e.sort(((t,i)=>t.ki()-i.ki()));for(const n of t){const t=Math.floor(n.Vt(i)/2),s=n.ki();s>-t&&s<t&&n.Ai(t),s>this.Cv.height-t&&s<this.Cv.height+t&&n.Ai(this.Cv.height-t);}for(let t=1;t<s.length;t++){const n=s[t],e=s[t-1],r=e.Vt(i,false),h=n.ki(),l=e.Oi();h>l-r&&n.Ai(l-r);}for(let t=1;t<e.length;t++){const n=e[t],s=e[t-1],r=s.Vt(i,true),h=n.ki(),l=s.Oi();h<l+r&&n.Ai(l+r);}}ap(t){if(null===this.Cv)return;const i=this.Qv(),n=this.Zv(),s=this.Vv?"right":"left";i.forEach((i=>{if(i.Vi()){i.gt(b(this.Li)).K(t,n,this.Pv,s);}}));}op(t){if(null===this.Cv||null===this.Li)return;const i=this.tn.Av().$t(),n=[],s=this.tn.np(),e=i.Yc().Rn(s,this.Li);e.length&&n.push(e);const r=this.Zv(),h=this.Vv?"right":"left";n.forEach((i=>{i.forEach((i=>{i.gt(b(this.Li)).K(t,r,this.Pv,h);}));}));}cp(t){this.Ev.style.cursor=1===t?"ns-resize":"default";}do(){const t=this.Gv();this.Rv<t&&this.tn.Av().$t().Kl(),this.Rv=t;}Jv(){return N(this.So.fontSize,this.So.fontFamily)}}function ks(t,i){var n,s;return null!==(s=null===(n=t._a)||void 0===n?void 0:n.call(t,i))&&void 0!==s?s:[]}function ys(t,i){var n,s;return null!==(s=null===(n=t.Pn)||void 0===n?void 0:n.call(t,i))&&void 0!==s?s:[]}function Cs(t,i){var n,s;return null!==(s=null===(n=t.Ji)||void 0===n?void 0:n.call(t,i))&&void 0!==s?s:[]}function Ts(t,i){var n,s;return null!==(s=null===(n=t.la)||void 0===n?void 0:n.call(t,i))&&void 0!==s?s:[]}class Ps{constructor(i,n){this.Cv=size({width:0,height:0}),this.fp=null,this.vp=null,this.pp=null,this.mp=false,this.bp=new R,this.wp=new R,this.gp=0,this.Mp=false,this.xp=null,this.Sp=false,this.kp=null,this.yp=null,this.Dv=false,this.Ov=()=>{this.Dv||null===this.Cp||this.$i().$h();},this.Bv=()=>{this.Dv||null===this.Cp||this.$i().$h();},this.Tp=i,this.Cp=n,this.Cp.F_().l(this.Pp.bind(this),this,true),this.Rp=document.createElement("td"),this.Rp.style.padding="0",this.Rp.style.position="relative";const s=document.createElement("div");s.style.width="100%",s.style.height="100%",s.style.position="relative",s.style.overflow="hidden",this.Dp=document.createElement("td"),this.Dp.style.padding="0",this.Op=document.createElement("td"),this.Op.style.padding="0",this.Rp.appendChild(s),this.Nv=as(s,size({width:16,height:16})),this.Nv.subscribeSuggestedBitmapSizeChanged(this.Ov);const e=this.Nv.canvasElement;e.style.position="absolute",e.style.zIndex="1",e.style.left="0",e.style.top="0",this.Fv=as(s,size({width:16,height:16})),this.Fv.subscribeSuggestedBitmapSizeChanged(this.Bv);const r=this.Fv.canvasElement;r.style.position="absolute",r.style.zIndex="2",r.style.left="0",r.style.top="0",this.Ap=document.createElement("tr"),this.Ap.appendChild(this.Dp),this.Ap.appendChild(this.Rp),this.Ap.appendChild(this.Op),this.Bp(),this.Xv=new fs(this.Fv.canvasElement,this,{qf:()=>null===this.xp&&!this.Tp.W().handleScroll.vertTouchDrag,Yf:()=>null===this.xp&&!this.Tp.W().handleScroll.horzTouchDrag});}S(){null!==this.fp&&this.fp.S(),null!==this.vp&&this.vp.S(),this.Fv.unsubscribeSuggestedBitmapSizeChanged(this.Bv),os(this.Fv.canvasElement),this.Fv.dispose(),this.Nv.unsubscribeSuggestedBitmapSizeChanged(this.Ov),os(this.Nv.canvasElement),this.Nv.dispose(),null!==this.Cp&&this.Cp.F_().p(this),this.Xv.S();}np(){return b(this.Cp)}Vp(t){null!==this.Cp&&this.Cp.F_().p(this),this.Cp=t,null!==this.Cp&&this.Cp.F_().l(Ps.prototype.Pp.bind(this),this,true),this.Bp();}Av(){return this.Tp}Kv(){return this.Ap}Bp(){if(null!==this.Cp&&(this.Ip(),0!==this.$i().wt().length)){if(null!==this.fp){const t=this.Cp.P_();this.fp.Gi(b(t));}if(null!==this.vp){const t=this.Cp.R_();this.vp.Gi(b(t));}}}zp(){null!==this.fp&&this.fp.bt(),null!==this.vp&&this.vp.bt();}g_(){return null!==this.Cp?this.Cp.g_():0}M_(t){this.Cp&&this.Cp.M_(t);}Wf(t){if(!this.Cp)return;this.Lp();const i=t.localX,n=t.localY;this.Ep(i,n,t);}hv(t){this.Lp(),this.Np(),this.Ep(t.localX,t.localY,t);}jf(t){var i;if(!this.Cp)return;this.Lp();const n=t.localX,s=t.localY;this.Ep(n,s,t);const e=this.br(n,s);this.Tp.Fp(null!==(i=null==e?void 0:e.yv)&&void 0!==i?i:null),this.$i().Wc(e&&{jc:e.jc,Sv:e.Sv});}iv(t){null!==this.Cp&&(this.Lp(),this.Wp(t));}Vf(t){null!==this.Cp&&this.jp(this.wp,t);}Df(t){this.Vf(t);}Zf(t){this.Lp(),this.Hp(t),this.Ep(t.localX,t.localY,t);}tv(t){null!==this.Cp&&(this.Lp(),this.Mp=false,this.$p(t));}Qf(t){null!==this.Cp&&this.Wp(t);}mv(t){if(this.Mp=true,null===this.xp){const i={x:t.localX,y:t.localY};this.Up(i,i,t);}}pv(t){null!==this.Cp&&(this.Lp(),this.Cp.$t().Wc(null),this.qp());}Yp(){return this.bp}Xp(){return this.wp}_v(){this.gp=1,this.$i().Un();}uv(t,i){if(!this.Tp.W().handleScale.pinch)return;const n=5*(i-this.gp);this.gp=i,this.$i().Jc(t.nt,n);}ev(t){this.Mp=false,this.Sp=null!==this.xp,this.Np();const i=this.$i().Yc();null!==this.xp&&i.yt()&&(this.kp={x:i.Yt(),y:i.Xt()},this.xp={x:t.localX,y:t.localY});}Xf(t){if(null===this.Cp)return;const i=t.localX,n=t.localY;if(null===this.xp)this.Hp(t);else {this.Sp=false;const s=b(this.kp),e=s.x+(i-this.xp.x),r=s.y+(n-this.xp.y);this.Ep(e,r,t);}}Jf(t){0===this.Av().W().trackingMode.exitMode&&(this.Sp=true),this.Kp(),this.$p(t);}br(t,i){const n=this.Cp;return null===n?null:function(t,i,n){const s=t.$o(),e=function(t,i,n){var s,e;let r,h;for(const o of t){const t=null!==(e=null===(s=o.fa)||void 0===s?void 0:s.call(o,i,n))&&void 0!==e?e:[];for(const i of t)l=i.zOrder,(!(a=null==r?void 0:r.zOrder)||"top"===l&&"top"!==a||"normal"===l&&"bottom"===a)&&(r=i,h=o);}var l,a;return r&&h?{kv:r,jc:h}:null}(s,i,n);if("top"===(null==e?void 0:e.kv.zOrder))return gs(e);for(const r of s){if(e&&e.jc===r&&"bottom"!==e.kv.zOrder&&!e.kv.isBackground)return gs(e);const s=Ms(r.Pn(t),i,n);if(null!==s)return {jc:r,Mv:s.Mv,Sv:s.Sv};if(e&&e.jc===r&&"bottom"!==e.kv.zOrder&&e.kv.isBackground)return gs(e)}return (null==e?void 0:e.kv)?gs(e):null}(n,t,i)}Zp(i,n){b("left"===n?this.fp:this.vp).tp(size({width:i,height:this.Cv.height}));}Gp(){return this.Cv}tp(t){equalSizes(this.Cv,t)||(this.Cv=t,this.Dv=true,this.Nv.resizeCanvasElement(t),this.Fv.resizeCanvasElement(t),this.Dv=false,this.Rp.style.width=t.width+"px",this.Rp.style.height=t.height+"px");}Jp(){const t=b(this.Cp);t.T_(t.P_()),t.T_(t.R_());for(const i of t.Aa())if(t.dr(i)){const n=i.Dt();null!==n&&t.T_(n),i.On();}}_p(){return this.Nv.bitmapSize}up(t,i,n){const s=this._p();s.width>0&&s.height>0&&t.drawImage(this.Nv.canvasElement,i,n);}sp(t){if(0===t)return;if(null===this.Cp)return;if(t>1&&this.Jp(),null!==this.fp&&this.fp.sp(t),null!==this.vp&&this.vp.sp(t),1!==t){this.Nv.applySuggestedBitmapSize();const t=tryCreateCanvasRenderingTarget2D(this.Nv);null!==t&&(t.useBitmapCoordinateSpace((t=>{this.rp(t);})),this.Cp&&(this.Qp(t,ks),this.tm(t),this.im(t),this.Qp(t,ys),this.Qp(t,Cs)));}this.Fv.applySuggestedBitmapSize();const i=tryCreateCanvasRenderingTarget2D(this.Fv);null!==i&&(i.useBitmapCoordinateSpace((({context:t,bitmapSize:i})=>{t.clearRect(0,0,i.width,i.height);})),this.nm(i),this.Qp(i,Ts));}sm(){return this.fp}rm(){return this.vp}hp(t,i){this.Qp(t,i);}Pp(){null!==this.Cp&&this.Cp.F_().p(this),this.Cp=null;}Wp(t){this.jp(this.bp,t);}jp(t,i){const n=i.localX,s=i.localY;t.M()&&t.m(this.$i().St().Eu(n),{x:n,y:s},i);}rp({context:t,bitmapSize:i}){const{width:n,height:s}=i,e=this.$i(),r=e.q(),h=e.md();r===h?Z(t,0,0,n,s,h):Q(t,0,0,n,s,r,h);}tm(t){const i=b(this.Cp).W_().Uh().gt();null!==i&&i.K(t,false);}im(t){const i=this.$i().qc();this.hm(t,ys,_s,i),this.hm(t,ys,us,i);}nm(t){this.hm(t,ys,us,this.$i().Yc());}Qp(t,i){const n=b(this.Cp).$o();for(const s of n)this.hm(t,i,_s,s);for(const s of n)this.hm(t,i,us,s);}hm(t,i,n,s){const e=b(this.Cp),r=e.$t().Fc(),h=null!==r&&r.jc===s,l=null!==r&&h&&void 0!==r.Sv?r.Sv.gr:void 0;cs(i,(i=>n(i,t,h,l)),s,e);}Ip(){if(null===this.Cp)return;const t=this.Tp,i=this.Cp.P_().W().visible,n=this.Cp.R_().W().visible;i||null===this.fp||(this.Dp.removeChild(this.fp.Kv()),this.fp.S(),this.fp=null),n||null===this.vp||(this.Op.removeChild(this.vp.Kv()),this.vp.S(),this.vp=null);const s=t.$t()._d();i&&null===this.fp&&(this.fp=new Ss(this,t.W(),s,"left"),this.Dp.appendChild(this.fp.Kv())),n&&null===this.vp&&(this.vp=new Ss(this,t.W(),s,"right"),this.Op.appendChild(this.vp.Kv()));}lm(t){return t.bv&&this.Mp||null!==this.xp}am(t){return Math.max(0,Math.min(t,this.Cv.width-1))}om(t){return Math.max(0,Math.min(t,this.Cv.height-1))}Ep(t,i,n){this.$i().hd(this.am(t),this.om(i),n,b(this.Cp));}qp(){this.$i().ad();}Kp(){this.Sp&&(this.xp=null,this.qp());}Up(t,i,n){this.xp=t,this.Sp=false,this.Ep(i.x,i.y,n);const s=this.$i().Yc();this.kp={x:s.Yt(),y:s.Xt()};}$i(){return this.Tp.$t()}$p(t){if(!this.mp)return;const i=this.$i(),n=this.np();if(i.I_(n,n.vn()),this.pp=null,this.mp=false,i.sd(),null!==this.yp){const t=performance.now(),n=i.St();this.yp.Dr(n.ju(),t),this.yp.Ju(t)||i.Xn(this.yp);}}Lp(){this.xp=null;}Np(){if(!this.Cp)return;if(this.$i().Un(),document.activeElement!==document.body&&document.activeElement!==document.documentElement)b(document.activeElement).blur();else {const t=document.getSelection();null!==t&&t.removeAllRanges();}!this.Cp.vn().Ni()&&this.$i().St().Ni();}Hp(t){if(null===this.Cp)return;const i=this.$i(),n=i.St();if(n.Ni())return;const s=this.Tp.W(),e=s.handleScroll,r=s.kineticScroll;if((!e.pressedMouseMove||t.bv)&&(!e.horzTouchDrag&&!e.vertTouchDrag||!t.bv))return;const h=this.Cp.vn(),l=performance.now();if(null!==this.pp||this.lm(t)||(this.pp={x:t.clientX,y:t.clientY,Od:l,_m:t.localX,um:t.localY}),null!==this.pp&&!this.mp&&(this.pp.x!==t.clientX||this.pp.y!==t.clientY)){if(t.bv&&r.touch||!t.bv&&r.mouse){const t=n.he();this.yp=new ls(.2/t,7/t,.997,15/t),this.yp.qd(n.ju(),this.pp.Od);}else this.yp=null;h.Ni()||i.B_(this.Cp,h,t.localY),i.td(t.localX),this.mp=true;}this.mp&&(h.Ni()||i.V_(this.Cp,h,t.localY),i.nd(t.localX),null!==this.yp&&this.yp.qd(n.ju(),l));}}class Rs{constructor(i,n,s,e,r){this.ft=true,this.Cv=size({width:0,height:0}),this.Ov=()=>this.sp(3),this.Vv="left"===i,this.Oc=s._d,this.cn=n,this.dm=e,this.fm=r,this.Ev=document.createElement("div"),this.Ev.style.width="25px",this.Ev.style.height="100%",this.Ev.style.overflow="hidden",this.Nv=as(this.Ev,size({width:16,height:16})),this.Nv.subscribeSuggestedBitmapSizeChanged(this.Ov);}S(){this.Nv.unsubscribeSuggestedBitmapSizeChanged(this.Ov),os(this.Nv.canvasElement),this.Nv.dispose();}Kv(){return this.Ev}Gp(){return this.Cv}tp(t){equalSizes(this.Cv,t)||(this.Cv=t,this.Nv.resizeCanvasElement(t),this.Ev.style.width=`${t.width}px`,this.Ev.style.height=`${t.height}px`,this.ft=true);}sp(t){if(t<3&&!this.ft)return;if(0===this.Cv.width||0===this.Cv.height)return;this.ft=false,this.Nv.applySuggestedBitmapSize();const i=tryCreateCanvasRenderingTarget2D(this.Nv);null!==i&&i.useBitmapCoordinateSpace((t=>{this.rp(t),this.Ve(t);}));}_p(){return this.Nv.bitmapSize}up(t,i,n){const s=this._p();s.width>0&&s.height>0&&t.drawImage(this.Nv.canvasElement,i,n);}Ve({context:t,bitmapSize:i,horizontalPixelRatio:n,verticalPixelRatio:s}){if(!this.dm())return;t.fillStyle=this.cn.timeScale.borderColor;const e=Math.floor(this.Oc.W().C*n),r=Math.floor(this.Oc.W().C*s),h=this.Vv?i.width-e:0;t.fillRect(h,0,e,r);}rp({context:t,bitmapSize:i}){Z(t,0,0,i.width,i.height,this.fm());}}function Ds(t){return i=>{var n,s;return null!==(s=null===(n=i.da)||void 0===n?void 0:n.call(i,t))&&void 0!==s?s:[]}}const Os=Ds("normal"),As=Ds("top"),Bs=Ds("bottom");class Vs{constructor(i,n){this.vm=null,this.pm=null,this.k=null,this.bm=false,this.Cv=size({width:0,height:0}),this.wm=new R,this.Pv=new ii(5),this.Dv=false,this.Ov=()=>{this.Dv||this.Tp.$t().$h();},this.Bv=()=>{this.Dv||this.Tp.$t().$h();},this.Tp=i,this.U_=n,this.cn=i.W().layout,this.gm=document.createElement("tr"),this.Mm=document.createElement("td"),this.Mm.style.padding="0",this.xm=document.createElement("td"),this.xm.style.padding="0",this.Ev=document.createElement("td"),this.Ev.style.height="25px",this.Ev.style.padding="0",this.Sm=document.createElement("div"),this.Sm.style.width="100%",this.Sm.style.height="100%",this.Sm.style.position="relative",this.Sm.style.overflow="hidden",this.Ev.appendChild(this.Sm),this.Nv=as(this.Sm,size({width:16,height:16})),this.Nv.subscribeSuggestedBitmapSizeChanged(this.Ov);const s=this.Nv.canvasElement;s.style.position="absolute",s.style.zIndex="1",s.style.left="0",s.style.top="0",this.Fv=as(this.Sm,size({width:16,height:16})),this.Fv.subscribeSuggestedBitmapSizeChanged(this.Bv);const e=this.Fv.canvasElement;e.style.position="absolute",e.style.zIndex="2",e.style.left="0",e.style.top="0",this.gm.appendChild(this.Mm),this.gm.appendChild(this.Ev),this.gm.appendChild(this.xm),this.km(),this.Tp.$t().w_().l(this.km.bind(this),this),this.Xv=new fs(this.Fv.canvasElement,this,{qf:()=>true,Yf:()=>!this.Tp.W().handleScroll.horzTouchDrag});}S(){this.Xv.S(),null!==this.vm&&this.vm.S(),null!==this.pm&&this.pm.S(),this.Fv.unsubscribeSuggestedBitmapSizeChanged(this.Bv),os(this.Fv.canvasElement),this.Fv.dispose(),this.Nv.unsubscribeSuggestedBitmapSizeChanged(this.Ov),os(this.Nv.canvasElement),this.Nv.dispose();}Kv(){return this.gm}ym(){return this.vm}Cm(){return this.pm}hv(t){if(this.bm)return;this.bm=true;const i=this.Tp.$t();!i.St().Ni()&&this.Tp.W().handleScale.axisPressedMouseMove.time&&i.Gc(t.localX);}ev(t){this.hv(t);}lv(){const t=this.Tp.$t();!t.St().Ni()&&this.bm&&(this.bm=false,this.Tp.W().handleScale.axisPressedMouseMove.time&&t.rd());}Zf(t){const i=this.Tp.$t();!i.St().Ni()&&this.Tp.W().handleScale.axisPressedMouseMove.time&&i.ed(t.localX);}Xf(t){this.Zf(t);}tv(){this.bm=false;const t=this.Tp.$t();t.St().Ni()&&!this.Tp.W().handleScale.axisPressedMouseMove.time||t.rd();}Jf(){this.tv();}Vf(){this.Tp.W().handleScale.axisDoubleClickReset.time&&this.Tp.$t().Zn();}Df(){this.Vf();}Wf(){this.Tp.$t().W().handleScale.axisPressedMouseMove.time&&this.cp(1);}pv(){this.cp(0);}Gp(){return this.Cv}Tm(){return this.wm}Pm(i,s,e){equalSizes(this.Cv,i)||(this.Cv=i,this.Dv=true,this.Nv.resizeCanvasElement(i),this.Fv.resizeCanvasElement(i),this.Dv=false,this.Ev.style.width=`${i.width}px`,this.Ev.style.height=`${i.height}px`,this.wm.m(i)),null!==this.vm&&this.vm.tp(size({width:s,height:i.height})),null!==this.pm&&this.pm.tp(size({width:e,height:i.height}));}Rm(){const t=this.Dm();return Math.ceil(t.C+t.T+t.P+t.L+t.B+t.Om)}bt(){this.Tp.$t().St().ja();}_p(){return this.Nv.bitmapSize}up(t,i,n){const s=this._p();s.width>0&&s.height>0&&t.drawImage(this.Nv.canvasElement,i,n);}sp(t){if(0===t)return;if(1!==t){this.Nv.applySuggestedBitmapSize();const i=tryCreateCanvasRenderingTarget2D(this.Nv);null!==i&&(i.useBitmapCoordinateSpace((t=>{this.rp(t),this.Ve(t),this.Am(i,Bs);})),this.lp(i),this.Am(i,Os)),null!==this.vm&&this.vm.sp(t),null!==this.pm&&this.pm.sp(t);}this.Fv.applySuggestedBitmapSize();const i=tryCreateCanvasRenderingTarget2D(this.Fv);null!==i&&(i.useBitmapCoordinateSpace((({context:t,bitmapSize:i})=>{t.clearRect(0,0,i.width,i.height);})),this.Bm([...this.Tp.$t().wt(),this.Tp.$t().Yc()],i),this.Am(i,As));}Am(t,i){const n=this.Tp.$t().wt();for(const s of n)cs(i,(i=>_s(i,t,false,void 0)),s,void 0);for(const s of n)cs(i,(i=>us(i,t,false,void 0)),s,void 0);}rp({context:t,bitmapSize:i}){Z(t,0,0,i.width,i.height,this.Tp.$t().md());}Ve({context:t,bitmapSize:i,verticalPixelRatio:n}){if(this.Tp.W().timeScale.borderVisible){t.fillStyle=this.Vm();const s=Math.max(1,Math.floor(this.Dm().C*n));t.fillRect(0,0,i.width,s);}}lp(t){const i=this.Tp.$t().St(),n=i.ja();if(!n||0===n.length)return;const s=this.U_.maxTickMarkWeight(n),e=this.Dm(),r=i.W();r.borderVisible&&r.ticksVisible&&t.useBitmapCoordinateSpace((({context:t,horizontalPixelRatio:i,verticalPixelRatio:s})=>{t.strokeStyle=this.Vm(),t.fillStyle=this.Vm();const r=Math.max(1,Math.floor(i)),h=Math.floor(.5*i);t.beginPath();const l=Math.round(e.T*s);for(let s=n.length;s--;){const e=Math.round(n[s].coord*i);t.rect(e-h,0,r,l);}t.fill();})),t.useMediaCoordinateSpace((({context:t})=>{const i=e.C+e.T+e.L+e.P/2;t.textAlign="center",t.textBaseline="middle",t.fillStyle=this.$(),t.font=this.Jv();for(const e of n)if(e.weight<s){const n=e.needAlignCoordinate?this.Im(t,e.coord,e.label):e.coord;t.fillText(e.label,n,i);}this.Tp.W().timeScale.allowBoldLabels&&(t.font=this.zm());for(const e of n)if(e.weight>=s){const n=e.needAlignCoordinate?this.Im(t,e.coord,e.label):e.coord;t.fillText(e.label,n,i);}}));}Im(t,i,n){const s=this.Pv.xi(t,n),e=s/2,r=Math.floor(i-e)+.5;return r<0?i+=Math.abs(0-r):r+s>this.Cv.width&&(i-=Math.abs(this.Cv.width-(r+s))),i}Bm(t,i){const n=this.Dm();for(const s of t)for(const t of s.Qi())t.gt().K(i,n);}Vm(){return this.Tp.W().timeScale.borderColor}$(){return this.cn.textColor}j(){return this.cn.fontSize}Jv(){return N(this.j(),this.cn.fontFamily)}zm(){return N(this.j(),this.cn.fontFamily,"bold")}Dm(){null===this.k&&(this.k={C:1,N:NaN,L:NaN,B:NaN,ji:NaN,T:5,P:NaN,R:"",Wi:new ii,Om:0});const t=this.k,i=this.Jv();if(t.R!==i){const n=this.j();t.P=n,t.R=i,t.L=3*n/12,t.B=3*n/12,t.ji=9*n/12,t.N=0,t.Om=4*n/12,t.Wi.ir();}return this.k}cp(t){this.Ev.style.cursor=1===t?"ew-resize":"default";}km(){const t=this.Tp.$t(),i=t.W();i.leftPriceScale.visible||null===this.vm||(this.Mm.removeChild(this.vm.Kv()),this.vm.S(),this.vm=null),i.rightPriceScale.visible||null===this.pm||(this.xm.removeChild(this.pm.Kv()),this.pm.S(),this.pm=null);const n={_d:this.Tp.$t()._d()},s=()=>i.leftPriceScale.borderVisible&&t.St().W().borderVisible,e=()=>t.md();i.leftPriceScale.visible&&null===this.vm&&(this.vm=new Rs("left",i,n,s,e),this.Mm.appendChild(this.vm.Kv())),i.rightPriceScale.visible&&null===this.pm&&(this.pm=new Rs("right",i,n,s,e),this.xm.appendChild(this.pm.Kv()));}}const Is=!!is&&!!navigator.userAgentData&&navigator.userAgentData.brands.some((t=>t.brand.includes("Chromium")))&&!!is&&((null===(zs=null===navigator||void 0===navigator?void 0:navigator.userAgentData)||void 0===zs?void 0:zs.platform)?"Windows"===navigator.userAgentData.platform:navigator.userAgent.toLowerCase().indexOf("win")>=0);var zs;class Ls{constructor(t,i,n){var s;this.Lm=[],this.Em=0,this.ro=0,this.o_=0,this.Nm=0,this.Fm=0,this.Wm=null,this.jm=false,this.bp=new R,this.wp=new R,this.Pc=new R,this.Hm=null,this.$m=null,this.Um=t,this.cn=i,this.U_=n,this.gm=document.createElement("div"),this.gm.classList.add("tv-lightweight-charts"),this.gm.style.overflow="hidden",this.gm.style.direction="ltr",this.gm.style.width="100%",this.gm.style.height="100%",(s=this.gm).style.userSelect="none",s.style.webkitUserSelect="none",s.style.msUserSelect="none",s.style.MozUserSelect="none",s.style.webkitTapHighlightColor="transparent",this.qm=document.createElement("table"),this.qm.setAttribute("cellspacing","0"),this.gm.appendChild(this.qm),this.Ym=this.Xm.bind(this),Es(this.cn)&&this.Km(true),this.$i=new zn(this.Dc.bind(this),this.cn,n),this.$t().Xc().l(this.Zm.bind(this),this),this.Gm=new Vs(this,this.U_),this.qm.appendChild(this.Gm.Kv());const e=i.autoSize&&this.Jm();let r=this.cn.width,h=this.cn.height;if(e||0===r||0===h){const i=t.getBoundingClientRect();r=r||i.width,h=h||i.height;}this.Qm(r,h),this.tb(),t.appendChild(this.gm),this.ib(),this.$i.St().sc().l(this.$i.Kl.bind(this.$i),this),this.$i.w_().l(this.$i.Kl.bind(this.$i),this);}$t(){return this.$i}W(){return this.cn}nb(){return this.Lm}sb(){return this.Gm}S(){this.Km(false),0!==this.Em&&window.cancelAnimationFrame(this.Em),this.$i.Xc().p(this),this.$i.St().sc().p(this),this.$i.w_().p(this),this.$i.S();for(const t of this.Lm)this.qm.removeChild(t.Kv()),t.Yp().p(this),t.Xp().p(this),t.S();this.Lm=[],b(this.Gm).S(),null!==this.gm.parentElement&&this.gm.parentElement.removeChild(this.gm),this.Pc.S(),this.bp.S(),this.wp.S(),this.eb();}Qm(i,n,s=false){if(this.ro===n&&this.o_===i)return;const e=function(i){const n=Math.floor(i.width),s=Math.floor(i.height);return size({width:n-n%2,height:s-s%2})}(size({width:i,height:n}));this.ro=e.height,this.o_=e.width;const r=this.ro+"px",h=this.o_+"px";b(this.gm).style.height=r,b(this.gm).style.width=h,this.qm.style.height=r,this.qm.style.width=h,s?this.rb(_t.es(),performance.now()):this.$i.Kl();}sp(t){ void 0===t&&(t=_t.es());for(let i=0;i<this.Lm.length;i++)this.Lm[i].sp(t.Hn(i).Fn);this.cn.timeScale.visible&&this.Gm.sp(t.jn());}Hh(t){const i=Es(this.cn);this.$i.Hh(t);const n=Es(this.cn);n!==i&&this.Km(n),this.ib(),this.hb(t);}Yp(){return this.bp}Xp(){return this.wp}Xc(){return this.Pc}lb(){null!==this.Wm&&(this.rb(this.Wm,performance.now()),this.Wm=null);const t=this.ab(null),i=document.createElement("canvas");i.width=t.width,i.height=t.height;const n=b(i.getContext("2d"));return this.ab(n),i}ob(t){if("left"===t&&!this._b())return 0;if("right"===t&&!this.ub())return 0;if(0===this.Lm.length)return 0;return b("left"===t?this.Lm[0].sm():this.Lm[0].rm()).ip()}cb(){return this.cn.autoSize&&null!==this.Hm}fb(){return this.gm}Fp(t){this.$m=t,this.$m?this.fb().style.setProperty("cursor",t):this.fb().style.removeProperty("cursor");}pb(){return this.$m}mb(){return m(this.Lm[0]).Gp()}hb(t){(void 0!==t.autoSize||!this.Hm||void 0===t.width&&void 0===t.height)&&(t.autoSize&&!this.Hm&&this.Jm(),false===t.autoSize&&null!==this.Hm&&this.eb(),t.autoSize||void 0===t.width&&void 0===t.height||this.Qm(t.width||this.o_,t.height||this.ro));}ab(i){let n=0,s=0;const e=this.Lm[0],r=(t,n)=>{let s=0;for(let e=0;e<this.Lm.length;e++){const r=this.Lm[e],h=b("left"===t?r.sm():r.rm()),l=h._p();null!==i&&h.up(i,n,s),s+=l.height;}};if(this._b()){r("left",0);n+=b(e.sm())._p().width;}for(let t=0;t<this.Lm.length;t++){const e=this.Lm[t],r=e._p();null!==i&&e.up(i,n,s),s+=r.height;}if(n+=e._p().width,this.ub()){r("right",n);n+=b(e.rm())._p().width;}const h=(t,n,s)=>{b("left"===t?this.Gm.ym():this.Gm.Cm()).up(b(i),n,s);};if(this.cn.timeScale.visible){const t=this.Gm._p();if(null!==i){let n=0;this._b()&&(h("left",n,s),n=b(e.sm())._p().width),this.Gm.up(i,n,s),n+=t.width,this.ub()&&h("right",n,s);}s+=t.height;}return size({width:n,height:s})}bb(){let i=0,n=0,s=0;for(const t of this.Lm)this._b()&&(n=Math.max(n,b(t.sm()).Gv(),this.cn.leftPriceScale.minimumWidth)),this.ub()&&(s=Math.max(s,b(t.rm()).Gv(),this.cn.rightPriceScale.minimumWidth)),i+=t.g_();n=es(n),s=es(s);const e=this.o_,r=this.ro,h=Math.max(e-n-s,0),l=this.cn.timeScale.visible;let a=l?Math.max(this.Gm.Rm(),this.cn.timeScale.minimumHeight):0;var o;a=(o=a)+o%2;const _=0+a,u=r<_?0:r-_,c=u/i;let d=0;for(let i=0;i<this.Lm.length;++i){const e=this.Lm[i];e.Vp(this.$i.Uc()[i]);let r=0,l=0;l=i===this.Lm.length-1?u-d:Math.round(e.g_()*c),r=Math.max(l,2),d+=r,e.tp(size({width:h,height:r})),this._b()&&e.Zp(n,"left"),this.ub()&&e.Zp(s,"right"),e.np()&&this.$i.Kc(e.np(),r);}this.Gm.Pm(size({width:l?h:0,height:a}),l?n:0,l?s:0),this.$i.x_(h),this.Nm!==n&&(this.Nm=n),this.Fm!==s&&(this.Fm=s);}Km(t){t?this.gm.addEventListener("wheel",this.Ym,{passive:false}):this.gm.removeEventListener("wheel",this.Ym);}wb(t){switch(t.deltaMode){case t.DOM_DELTA_PAGE:return 120;case t.DOM_DELTA_LINE:return 32}return Is?1/window.devicePixelRatio:1}Xm(t){if(!(0!==t.deltaX&&this.cn.handleScroll.mouseWheel||0!==t.deltaY&&this.cn.handleScale.mouseWheel))return;const i=this.wb(t),n=i*t.deltaX/100,s=-i*t.deltaY/100;if(t.cancelable&&t.preventDefault(),0!==s&&this.cn.handleScale.mouseWheel){const i=Math.sign(s)*Math.min(1,Math.abs(s)),n=t.clientX-this.gm.getBoundingClientRect().left;this.$t().Jc(n,i);}0!==n&&this.cn.handleScroll.mouseWheel&&this.$t().Qc(-80*n);}rb(t,i){var n;const s=t.jn();3===s&&this.gb(),3!==s&&2!==s||(this.Mb(t),this.xb(t,i),this.Gm.bt(),this.Lm.forEach((t=>{t.zp();})),3===(null===(n=this.Wm)||void 0===n?void 0:n.jn())&&(this.Wm.ts(t),this.gb(),this.Mb(this.Wm),this.xb(this.Wm,i),t=this.Wm,this.Wm=null)),this.sp(t);}xb(t,i){for(const n of t.Qn())this.ns(n,i);}Mb(t){const i=this.$i.Uc();for(let n=0;n<i.length;n++)t.Hn(n).Wn&&i[n].E_();}ns(t,i){const n=this.$i.St();switch(t.qn){case 0:n.rc();break;case 1:n.hc(t.Ot);break;case 2:n.Gn(t.Ot);break;case 3:n.Jn(t.Ot);break;case 4:n.Uu();break;case 5:t.Ot.Ju(i)||n.Jn(t.Ot.Qu(i));}}Dc(t){null!==this.Wm?this.Wm.ts(t):this.Wm=t,this.jm||(this.jm=true,this.Em=window.requestAnimationFrame((t=>{if(this.jm=false,this.Em=0,null!==this.Wm){const i=this.Wm;this.Wm=null,this.rb(i,t);for(const n of i.Qn())if(5===n.qn&&!n.Ot.Ju(t)){this.$t().Xn(n.Ot);break}}})));}gb(){this.tb();}tb(){const t=this.$i.Uc(),i=t.length,n=this.Lm.length;for(let t=i;t<n;t++){const t=m(this.Lm.pop());this.qm.removeChild(t.Kv()),t.Yp().p(this),t.Xp().p(this),t.S();}for(let s=n;s<i;s++){const i=new Ps(this,t[s]);i.Yp().l(this.Sb.bind(this),this),i.Xp().l(this.kb.bind(this),this),this.Lm.push(i),this.qm.insertBefore(i.Kv(),this.Gm.Kv());}for(let n=0;n<i;n++){const i=t[n],s=this.Lm[n];s.np()!==i?s.Vp(i):s.Bp();}this.ib(),this.bb();}yb(t,i,n){var s;const e=new Map;if(null!==t){this.$i.wt().forEach((i=>{const n=i.In().hl(t);null!==n&&e.set(i,n);}));}let r;if(null!==t){const i=null===(s=this.$i.St().Ui(t))||void 0===s?void 0:s.originalTime;void 0!==i&&(r=i);}const h=this.$t().Fc(),l=null!==h&&h.jc instanceof Zi?h.jc:void 0,a=null!==h&&void 0!==h.Sv?h.Sv.wr:void 0;return {Cb:r,se:null!=t?t:void 0,Tb:null!=i?i:void 0,Pb:l,Rb:e,Db:a,Ob:null!=n?n:void 0}}Sb(t,i,n){this.bp.m((()=>this.yb(t,i,n)));}kb(t,i,n){this.wp.m((()=>this.yb(t,i,n)));}Zm(t,i,n){this.Pc.m((()=>this.yb(t,i,n)));}ib(){const t=this.cn.timeScale.visible?"":"none";this.Gm.Kv().style.display=t;}_b(){return this.Lm[0].np().P_().W().visible}ub(){return this.Lm[0].np().R_().W().visible}Jm(){return "ResizeObserver"in window&&(this.Hm=new ResizeObserver((t=>{const i=t.find((t=>t.target===this.Um));i&&this.Qm(i.contentRect.width,i.contentRect.height);})),this.Hm.observe(this.Um,{box:"border-box"}),true)}eb(){null!==this.Hm&&this.Hm.disconnect(),this.Hm=null;}}function Es(t){return Boolean(t.handleScroll.mouseWheel||t.handleScale.mouseWheel)}function Ns(t,i){var n={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&i.indexOf(s)<0&&(n[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var e=0;for(s=Object.getOwnPropertySymbols(t);e<s.length;e++)i.indexOf(s[e])<0&&Object.prototype.propertyIsEnumerable.call(t,s[e])&&(n[s[e]]=t[s[e]]);}return n}function Fs(t,i,n,s){const e=n.value,r={se:i,ot:t,Ot:[e,e,e,e],Cb:s};return void 0!==n.color&&(r.O=n.color),r}function Ws(t,i,n,s){const e=n.value,r={se:i,ot:t,Ot:[e,e,e,e],Cb:s};return void 0!==n.lineColor&&(r.lt=n.lineColor),void 0!==n.topColor&&(r.Ts=n.topColor),void 0!==n.bottomColor&&(r.Ps=n.bottomColor),r}function js(t,i,n,s){const e=n.value,r={se:i,ot:t,Ot:[e,e,e,e],Cb:s};return void 0!==n.topLineColor&&(r.Pe=n.topLineColor),void 0!==n.bottomLineColor&&(r.Re=n.bottomLineColor),void 0!==n.topFillColor1&&(r.Se=n.topFillColor1),void 0!==n.topFillColor2&&(r.ke=n.topFillColor2),void 0!==n.bottomFillColor1&&(r.ye=n.bottomFillColor1),void 0!==n.bottomFillColor2&&(r.Ce=n.bottomFillColor2),r}function Hs(t,i,n,s){const e={se:i,ot:t,Ot:[n.open,n.high,n.low,n.close],Cb:s};return void 0!==n.color&&(e.O=n.color),e}function $s(t,i,n,s){const e={se:i,ot:t,Ot:[n.open,n.high,n.low,n.close],Cb:s};return void 0!==n.color&&(e.O=n.color),void 0!==n.borderColor&&(e.At=n.borderColor),void 0!==n.wickColor&&(e.Xh=n.wickColor),e}function Us(t,i,n,s,e){const r=m(e)(n),h=Math.max(...r),l=Math.min(...r),a=r[r.length-1],o=[a,h,l,a],_=n,{time:u,color:c}=_;return {se:i,ot:t,Ot:o,Cb:s,He:Ns(_,["time","color"]),O:c}}function qs(t){return void 0!==t.Ot}function Ys(t,i){return void 0!==i.customValues&&(t.Ab=i.customValues),t}function Xs(t){return (i,n,s,e,r,h)=>function(t,i){return i?i(t):void 0===(n=t).open&&void 0===n.value;var n;}(s,h)?Ys({ot:i,se:n,Cb:e},s):Ys(t(i,n,s,e,r),s)}function Ks(t){return {Candlestick:Xs($s),Bar:Xs(Hs),Area:Xs(Ws),Baseline:Xs(js),Histogram:Xs(Fs),Line:Xs(Fs),Custom:Xs(Us)}[t]}function Zs(t){return {se:0,Bb:new Map,ha:t}}function Gs(t,i){if(void 0!==t&&0!==t.length)return {Vb:i.key(t[0].ot),Ib:i.key(t[t.length-1].ot)}}function Js(t){let i;return t.forEach((t=>{ void 0===i&&(i=t.Cb);})),m(i)}class Qs{constructor(t){this.zb=new Map,this.Lb=new Map,this.Eb=new Map,this.Nb=[],this.U_=t;}S(){this.zb.clear(),this.Lb.clear(),this.Eb.clear(),this.Nb=[];}Fb(t,i){let n=0!==this.zb.size,s=false;const e=this.Lb.get(t);if(void 0!==e)if(1===this.Lb.size)n=false,s=true,this.zb.clear();else for(const i of this.Nb)i.pointData.Bb.delete(t)&&(s=true);let r=[];if(0!==i.length){const n=i.map((t=>t.time)),e=this.U_.createConverterToInternalObj(i),h=Ks(t.Jh()),l=t.ya(),a=t.Ca();r=i.map(((i,r)=>{const o=e(i.time),_=this.U_.key(o);let u=this.zb.get(_);void 0===u&&(u=Zs(o),this.zb.set(_,u),s=true);const c=h(o,u.se,i,n[r],l,a);return u.Bb.set(t,c),c}));}n&&this.Wb(),this.jb(t,r);let h=-1;if(s){const t=[];this.zb.forEach((i=>{t.push({timeWeight:0,time:i.ha,pointData:i,originalTime:Js(i.Bb)});})),t.sort(((t,i)=>this.U_.key(t.time)-this.U_.key(i.time))),h=this.Hb(t);}return this.$b(t,h,function(t,i,n){const s=Gs(t,n),e=Gs(i,n);if(void 0!==s&&void 0!==e)return {Ql:s.Ib>=e.Ib&&s.Vb>=e.Vb}}(this.Lb.get(t),e,this.U_))}fd(t){return this.Fb(t,[])}Ub(t,i){const n=i;!function(t){ void 0===t.Cb&&(t.Cb=t.time);}(n),this.U_.preprocessData(i);const s=this.U_.createConverterToInternalObj([i])(i.time),e=this.Eb.get(t);if(void 0!==e&&this.U_.key(s)<this.U_.key(e))throw new Error(`Cannot update oldest data, last time=${e}, new time=${s}`);let r=this.zb.get(this.U_.key(s));const h=void 0===r;void 0===r&&(r=Zs(s),this.zb.set(this.U_.key(s),r));const l=Ks(t.Jh()),a=t.ya(),o=t.Ca(),_=l(s,r.se,i,n.Cb,a,o);r.Bb.set(t,_),this.qb(t,_);const u={Ql:qs(_)};if(!h)return this.$b(t,-1,u);const c={timeWeight:0,time:r.ha,pointData:r,originalTime:Js(r.Bb)},d=At(this.Nb,this.U_.key(c.time),((t,i)=>this.U_.key(t.time)<i));this.Nb.splice(d,0,c);for(let t=d;t<this.Nb.length;++t)te(this.Nb[t].pointData,t);return this.U_.fillWeightsForPoints(this.Nb,d),this.$b(t,d,u)}qb(t,i){let n=this.Lb.get(t);void 0===n&&(n=[],this.Lb.set(t,n));const s=0!==n.length?n[n.length-1]:null;null===s||this.U_.key(i.ot)>this.U_.key(s.ot)?qs(i)&&n.push(i):qs(i)?n[n.length-1]=i:n.splice(-1,1),this.Eb.set(t,i.ot);}jb(t,i){0!==i.length?(this.Lb.set(t,i.filter(qs)),this.Eb.set(t,i[i.length-1].ot)):(this.Lb.delete(t),this.Eb.delete(t));}Wb(){for(const t of this.Nb)0===t.pointData.Bb.size&&this.zb.delete(this.U_.key(t.time));}Hb(t){let i=-1;for(let n=0;n<this.Nb.length&&n<t.length;++n){const s=this.Nb[n],e=t[n];if(this.U_.key(s.time)!==this.U_.key(e.time)){i=n;break}e.timeWeight=s.timeWeight,te(e.pointData,n);}if(-1===i&&this.Nb.length!==t.length&&(i=Math.min(this.Nb.length,t.length)),-1===i)return -1;for(let n=i;n<t.length;++n)te(t[n].pointData,n);return this.U_.fillWeightsForPoints(t,i),this.Nb=t,i}Yb(){if(0===this.Lb.size)return null;let t=0;return this.Lb.forEach((i=>{0!==i.length&&(t=Math.max(t,i[i.length-1].se));})),t}$b(t,i,n){const s={Xb:new Map,St:{Lu:this.Yb()}};if(-1!==i)this.Lb.forEach(((i,e)=>{s.Xb.set(e,{He:i,Kb:e===t?n:void 0});})),this.Lb.has(t)||s.Xb.set(t,{He:[],Kb:n}),s.St.Zb=this.Nb,s.St.Gb=i;else {const i=this.Lb.get(t);s.Xb.set(t,{He:i||[],Kb:n});}return s}}function te(t,i){t.se=i,t.Bb.forEach((t=>{t.se=i;}));}function ie(t){const i={value:t.Ot[3],time:t.Cb};return void 0!==t.Ab&&(i.customValues=t.Ab),i}function ne(t){const i=ie(t);return void 0!==t.O&&(i.color=t.O),i}function se(t){const i=ie(t);return void 0!==t.lt&&(i.lineColor=t.lt),void 0!==t.Ts&&(i.topColor=t.Ts),void 0!==t.Ps&&(i.bottomColor=t.Ps),i}function ee(t){const i=ie(t);return void 0!==t.Pe&&(i.topLineColor=t.Pe),void 0!==t.Re&&(i.bottomLineColor=t.Re),void 0!==t.Se&&(i.topFillColor1=t.Se),void 0!==t.ke&&(i.topFillColor2=t.ke),void 0!==t.ye&&(i.bottomFillColor1=t.ye),void 0!==t.Ce&&(i.bottomFillColor2=t.Ce),i}function re(t){const i={open:t.Ot[0],high:t.Ot[1],low:t.Ot[2],close:t.Ot[3],time:t.Cb};return void 0!==t.Ab&&(i.customValues=t.Ab),i}function he(t){const i=re(t);return void 0!==t.O&&(i.color=t.O),i}function le(t){const i=re(t),{O:n,At:s,Xh:e}=t;return void 0!==n&&(i.color=n),void 0!==s&&(i.borderColor=s),void 0!==e&&(i.wickColor=e),i}function ae(t){return {Area:se,Line:ne,Baseline:ee,Histogram:ne,Bar:he,Candlestick:le,Custom:oe}[t]}function oe(t){const i=t.Cb;return Object.assign(Object.assign({},t.He),{time:i})}const _e={vertLine:{color:"#9598A1",width:1,style:3,visible:true,labelVisible:true,labelBackgroundColor:"#131722"},horzLine:{color:"#9598A1",width:1,style:3,visible:true,labelVisible:true,labelBackgroundColor:"#131722"},mode:1},ue={vertLines:{color:"#D6DCDE",style:0,visible:true},horzLines:{color:"#D6DCDE",style:0,visible:true}},ce={background:{type:"solid",color:"#FFFFFF"},textColor:"#191919",fontSize:12,fontFamily:E},de={autoScale:true,mode:0,invertScale:false,alignLabels:true,borderVisible:true,borderColor:"#2B2B43",entireTextOnly:false,visible:false,ticksVisible:false,scaleMargins:{bottom:.1,top:.2},minimumWidth:0},fe={rightOffset:0,barSpacing:6,minBarSpacing:.5,fixLeftEdge:false,fixRightEdge:false,lockVisibleTimeRangeOnResize:false,rightBarStaysOnScroll:false,borderVisible:true,borderColor:"#2B2B43",visible:true,timeVisible:false,secondsVisible:true,shiftVisibleRangeOnNewBar:true,allowShiftVisibleRangeOnWhitespaceReplacement:false,ticksVisible:false,uniformDistribution:false,minimumHeight:0,allowBoldLabels:true},ve={color:"rgba(0, 0, 0, 0)",visible:false,fontSize:48,fontFamily:E,fontStyle:"",text:"",horzAlign:"center",vertAlign:"center"};function pe(){return {width:0,height:0,autoSize:false,layout:ce,crosshair:_e,grid:ue,overlayPriceScales:Object.assign({},de),leftPriceScale:Object.assign(Object.assign({},de),{visible:false}),rightPriceScale:Object.assign(Object.assign({},de),{visible:true}),timeScale:fe,watermark:ve,localization:{locale:is?navigator.language:"",dateFormat:"dd MMM 'yy"},handleScroll:{mouseWheel:true,pressedMouseMove:true,horzTouchDrag:true,vertTouchDrag:true},handleScale:{axisPressedMouseMove:{time:true,price:true},axisDoubleClickReset:{time:true,price:true},mouseWheel:true,pinch:true},kineticScroll:{mouse:false,touch:true},trackingMode:{exitMode:1}}}class me{constructor(t,i){this.Jb=t,this.Qb=i;}applyOptions(t){this.Jb.$t().Hc(this.Qb,t);}options(){return this.Li().W()}width(){return ot(this.Qb)?this.Jb.ob(this.Qb):0}Li(){return b(this.Jb.$t().$c(this.Qb)).Dt}}function be(t,i,n){const s=Ns(t,["time","originalTime"]),e=Object.assign({time:i},s);return void 0!==n&&(e.originalTime=n),e}const we={color:"#FF0000",price:0,lineStyle:2,lineWidth:1,lineVisible:true,axisLabelVisible:true,title:"",axisLabelColor:"",axisLabelTextColor:""};class ge{constructor(t){this.Eh=t;}applyOptions(t){this.Eh.Hh(t);}options(){return this.Eh.W()}tw(){return this.Eh}}class Me{constructor(t,i,n,s,e){this.iw=new R,this.Ls=t,this.nw=i,this.sw=n,this.U_=e,this.ew=s;}S(){this.iw.S();}priceFormatter(){return this.Ls.ma()}priceToCoordinate(t){const i=this.Ls.Ct();return null===i?null:this.Ls.Dt().Rt(t,i.Ot)}coordinateToPrice(t){const i=this.Ls.Ct();return null===i?null:this.Ls.Dt().pn(t,i.Ot)}barsInLogicalRange(t){if(null===t)return null;const i=new kn(new Mn(t.from,t.to)).hu(),n=this.Ls.In();if(n.Ni())return null;const s=n.hl(i.Os(),1),e=n.hl(i.ui(),-1),r=b(n.sl()),h=b(n.Vn());if(null!==s&&null!==e&&s.se>e.se)return {barsBefore:t.from-r,barsAfter:h-t.to};const l={barsBefore:null===s||s.se===r?t.from-r:s.se-r,barsAfter:null===e||e.se===h?h-t.to:h-e.se};return null!==s&&null!==e&&(l.from=s.Cb,l.to=e.Cb),l}setData(t){this.U_,this.Ls.Jh(),this.nw.rw(this.Ls,t),this.hw("full");}update(t){this.Ls.Jh(),this.nw.lw(this.Ls,t),this.hw("update");}dataByIndex(t,i){const n=this.Ls.In().hl(t,i);if(null===n)return null;return ae(this.seriesType())(n)}data(){const t=ae(this.seriesType());return this.Ls.In().ie().map((i=>t(i)))}subscribeDataChanged(t){this.iw.l(t);}unsubscribeDataChanged(t){this.iw.v(t);}setMarkers(t){this.U_;const i=t.map((t=>be(t,this.U_.convertHorzItemToInternal(t.time),t.time)));this.Ls.ia(i);}markers(){return this.Ls.na().map((t=>be(t,t.originalTime,void 0)))}applyOptions(t){this.Ls.Hh(t);}options(){return I(this.Ls.W())}priceScale(){return this.sw.priceScale(this.Ls.Dt().Ta())}createPriceLine(t){const i=D(I(we),t),n=this.Ls.sa(i);return new ge(n)}removePriceLine(t){this.Ls.ea(t.tw());}seriesType(){return this.Ls.Jh()}attachPrimitive(t){this.Ls.Sa(t),t.attached&&t.attached({chart:this.ew,series:this,requestUpdate:()=>this.Ls.$t().Kl()});}detachPrimitive(t){this.Ls.ka(t),t.detached&&t.detached();}hw(t){this.iw.M()&&this.iw.m(t);}}class xe{constructor(t,i,n){this.aw=new R,this.pu=new R,this.wm=new R,this.$i=t,this.kl=t.St(),this.Gm=i,this.kl.tc().l(this.ow.bind(this)),this.kl.nc().l(this._w.bind(this)),this.Gm.Tm().l(this.uw.bind(this)),this.U_=n;}S(){this.kl.tc().p(this),this.kl.nc().p(this),this.Gm.Tm().p(this),this.aw.S(),this.pu.S(),this.wm.S();}scrollPosition(){return this.kl.ju()}scrollToPosition(t,i){i?this.kl.Gu(t,1e3):this.$i.Jn(t);}scrollToRealTime(){this.kl.Zu();}getVisibleRange(){const t=this.kl.Du();return null===t?null:{from:t.from.originalTime,to:t.to.originalTime}}setVisibleRange(t){const i={from:this.U_.convertHorzItemToInternal(t.from),to:this.U_.convertHorzItemToInternal(t.to)},n=this.kl.Vu(i);this.$i.vd(n);}getVisibleLogicalRange(){const t=this.kl.Ru();return null===t?null:{from:t.Os(),to:t.ui()}}setVisibleLogicalRange(t){p(t.from<=t.to,"The from index cannot be after the to index."),this.$i.vd(t);}resetTimeScale(){this.$i.Zn();}fitContent(){this.$i.rc();}logicalToCoordinate(t){const i=this.$i.St();return i.Ni()?null:i.It(t)}coordinateToLogical(t){return this.kl.Ni()?null:this.kl.Eu(t)}timeToCoordinate(t){const i=this.U_.convertHorzItemToInternal(t),n=this.kl.Da(i,false);return null===n?null:this.kl.It(n)}coordinateToTime(t){const i=this.$i.St(),n=i.Eu(t),s=i.Ui(n);return null===s?null:s.originalTime}width(){return this.Gm.Gp().width}height(){return this.Gm.Gp().height}subscribeVisibleTimeRangeChange(t){this.aw.l(t);}unsubscribeVisibleTimeRangeChange(t){this.aw.v(t);}subscribeVisibleLogicalRangeChange(t){this.pu.l(t);}unsubscribeVisibleLogicalRangeChange(t){this.pu.v(t);}subscribeSizeChange(t){this.wm.l(t);}unsubscribeSizeChange(t){this.wm.v(t);}applyOptions(t){this.kl.Hh(t);}options(){return Object.assign(Object.assign({},I(this.kl.W())),{barSpacing:this.kl.he()})}ow(){this.aw.M()&&this.aw.m(this.getVisibleRange());}_w(){this.pu.M()&&this.pu.m(this.getVisibleLogicalRange());}uw(t){this.wm.m(t.width,t.height);}}function Se(t){if(void 0===t||"custom"===t.type)return;const i=t;void 0!==i.minMove&&void 0===i.precision&&(i.precision=function(t){if(t>=1)return 0;let i=0;for(;i<8;i++){const n=Math.round(t);if(Math.abs(n-t)<1e-8)return i;t*=10;}return i}(i.minMove));}function ke(t){return function(t){if(V(t.handleScale)){const i=t.handleScale;t.handleScale={axisDoubleClickReset:{time:i,price:i},axisPressedMouseMove:{time:i,price:i},mouseWheel:i,pinch:i};}else if(void 0!==t.handleScale){const{axisPressedMouseMove:i,axisDoubleClickReset:n}=t.handleScale;V(i)&&(t.handleScale.axisPressedMouseMove={time:i,price:i}),V(n)&&(t.handleScale.axisDoubleClickReset={time:n,price:n});}const i=t.handleScroll;V(i)&&(t.handleScroll={horzTouchDrag:i,vertTouchDrag:i,mouseWheel:i,pressedMouseMove:i});}(t),t}class ye{constructor(t,i,n){this.cw=new Map,this.dw=new Map,this.fw=new R,this.pw=new R,this.mw=new R,this.bw=new Qs(i);const s=void 0===n?I(pe()):D(I(pe()),ke(n));this.U_=i,this.Jb=new Ls(t,s,i),this.Jb.Yp().l((t=>{this.fw.M()&&this.fw.m(this.ww(t()));}),this),this.Jb.Xp().l((t=>{this.pw.M()&&this.pw.m(this.ww(t()));}),this),this.Jb.Xc().l((t=>{this.mw.M()&&this.mw.m(this.ww(t()));}),this);const e=this.Jb.$t();this.gw=new xe(e,this.Jb.sb(),this.U_);}remove(){this.Jb.Yp().p(this),this.Jb.Xp().p(this),this.Jb.Xc().p(this),this.gw.S(),this.Jb.S(),this.cw.clear(),this.dw.clear(),this.fw.S(),this.pw.S(),this.mw.S(),this.bw.S();}resize(t,i,n){this.autoSizeActive()||this.Jb.Qm(t,i,n);}addCustomSeries(t,i){const n=w(t),s=Object.assign(Object.assign({},_),n.defaultOptions());return this.Mw("Custom",s,i,n)}addAreaSeries(t){return this.Mw("Area",l,t)}addBaselineSeries(t){return this.Mw("Baseline",a,t)}addBarSeries(t){return this.Mw("Bar",r,t)}addCandlestickSeries(t={}){return function(t){ void 0!==t.borderColor&&(t.borderUpColor=t.borderColor,t.borderDownColor=t.borderColor),void 0!==t.wickColor&&(t.wickUpColor=t.wickColor,t.wickDownColor=t.wickColor);}(t),this.Mw("Candlestick",e,t)}addHistogramSeries(t){return this.Mw("Histogram",o,t)}addLineSeries(t){return this.Mw("Line",h,t)}removeSeries(t){const i=m(this.cw.get(t)),n=this.bw.fd(i);this.Jb.$t().fd(i),this.xw(n),this.cw.delete(t),this.dw.delete(i);}rw(t,i){this.xw(this.bw.Fb(t,i));}lw(t,i){this.xw(this.bw.Ub(t,i));}subscribeClick(t){this.fw.l(t);}unsubscribeClick(t){this.fw.v(t);}subscribeCrosshairMove(t){this.mw.l(t);}unsubscribeCrosshairMove(t){this.mw.v(t);}subscribeDblClick(t){this.pw.l(t);}unsubscribeDblClick(t){this.pw.v(t);}priceScale(t){return new me(this.Jb,t)}timeScale(){return this.gw}applyOptions(t){this.Jb.Hh(ke(t));}options(){return this.Jb.W()}takeScreenshot(){return this.Jb.lb()}autoSizeActive(){return this.Jb.cb()}chartElement(){return this.Jb.fb()}paneSize(){const t=this.Jb.mb();return {height:t.height,width:t.width}}setCrosshairPosition(t,i,n){const s=this.cw.get(n);if(void 0===s)return;const e=this.Jb.$t().cr(s);null!==e&&this.Jb.$t().ld(t,i,e);}clearCrosshairPosition(){this.Jb.$t().ad(true);}Mw(t,i,n={},s){Se(n.priceFormat);const e=D(I(u),I(i),n),r=this.Jb.$t().ud(t,e,s),h=new Me(r,this,this,this,this.U_);return this.cw.set(h,r),this.dw.set(r,h),h}xw(t){const i=this.Jb.$t();i.od(t.St.Lu,t.St.Zb,t.St.Gb),t.Xb.forEach(((t,i)=>i.J(t.He,t.Kb))),i.Fu();}Sw(t){return m(this.dw.get(t))}ww(t){const i=new Map;t.Rb.forEach(((t,n)=>{const s=n.Jh(),e=ae(s)(t);if("Custom"!==s)p(function(t){return void 0!==t.open||void 0!==t.value}(e));else {const t=n.Ca();p(!t||false===t(e));}i.set(this.Sw(n),e);}));const n=void 0!==t.Pb&&this.dw.has(t.Pb)?this.Sw(t.Pb):void 0;return {time:t.Cb,logical:t.se,point:t.Tb,hoveredSeries:n,hoveredObjectId:t.Db,seriesData:i,sourceEvent:t.Ob}}}function Ce(t,i,n){let s;if(B(t)){const i=document.getElementById(t);p(null!==i,`Cannot find element in DOM with id=${t}`),s=i;}else s=t;const e=new ye(s,i,n);return i.setOptions(e.options()),e}function Te(t,i){return Ce(t,new ts,ts.Vd(i))}Object.assign(Object.assign({},u),_);
103716
103481
 
103717
103482
  const determineValues = (input) => {
103718
103483
  // if input is larger than 1 return [2, 0.01]
@@ -105066,4 +104831,4 @@ const SingleBondWithProviders = (props) => {
105066
104831
  };
105067
104832
 
105068
104833
  var ChainId = types$1.ChainId;
105069
- export { BondsWithProviders as Bonds, BuyBondModalWithProviders as BuyBondModal, ChainId, FullBondsViewWithProviders as FullBondsView, ProjectViewWithProviders as ProjectView, SingleBondWithProviders as SingleBond, YourBondsWithProviders as YourBonds, generateImageFromTemplate, useSDKConfig, useTokenPrices };
104834
+ export { BLOCK_EXPLORER, BondsWithProviders as Bonds, BuyBondModalWithProviders as BuyBondModal, ChainId, FullBondsViewWithProviders as FullBondsView, ProjectViewWithProviders as ProjectView, SingleBondWithProviders as SingleBond, YourBondsWithProviders as YourBonds, generateImageFromTemplate, useSDKConfig, useTokenPrices };