realchart 0.9.1

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/index.js ADDED
@@ -0,0 +1,7 @@
1
+
2
+ /**
3
+ * RealReport-Chart v0.9.1
4
+ * Copyright (C) 2023-2023 WooriTech Inc.
5
+ * All Rights Reserved.
6
+ */
7
+ !function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).RealChart={})}(this,(function(t){"use strict";let e=0;class s{static destroy(t){return t&&t.destroy()}constructor(t){this.$_destroyed=!1,this.$_destroying=!1,t||(this.$_hash=String(e++))}destroy(){return this.$_destroyed||this.$_destroying||(this.$_destroyed=!0,this.$_destroying=!0,this._doDestory()),null}_doDestory(){}get destroying(){return this.$_destroying}get hash(){return this.$_hash}isMe(t){return t===this.$_hash}toString(){return this.constructor.name}toBool(t){return"string"==typeof t?"true"===t:t}toNum(t,e=NaN){return t=parseFloat(t),isNaN(t)?e:t}}class i extends s{wrapper(){return this._wrapper}wrapperOrThis(){return this._wrapper||this}createWrapper(t){const e=this._wrapper=new t;return e.$_c=this,e}setWrapper(t){return this._wrapper=t,t.$_c=this,t}isWrapper(t){return t===this._wrapper}}class r extends s{constructor(){super(...arguments),this._listeners=[]}addListener(t){t&&this._listeners.indexOf(t)<0&&this._listeners.push(t)}removeListener(t){const e=this._listeners.indexOf(t);e>=0&&this._listeners.splice(e,1)}_fireEvent(t,...e){const s=Array.prototype.slice.call(arguments,0);s[0]=this;for(const e of this._listeners){const i=e[t];if(i){const t=i.apply(e,s);if(void 0!==t)return t}}}}const n="http://www.w3.org/2000/svg",a=function(t){return t&&"object"==typeof t&&!Array.isArray(t)},h=Array.isArray,o=function(t){return"string"==typeof t},l=function(t){return"number"==typeof t},c=function(t,e){return t=parseFloat(t),isNaN(t)?parseFloat(e):t},u=function(t,e,s){let i=parseFloat(t);return isNaN(i)?(i=parseFloat(e),isNaN(i)?parseFloat(s):i):i},d=function(t,e){return void 0!==t?t:e},_=function(t,e,s){return void 0!==t?t:void 0!==e?e:s};class p{static setDebugging(t=!0){this._debugging=t}static debugging(){this._debugging}}p._debugging=!1;const g={ko:{dateFormat:"yyyy.MM.dd",am:"오전",pm:"오후",notExistsDataField:"존재하지 않는 필드입니다: %1",notSpecifiedDataField:"하나 이상의 데이터필드가 설정돼야 합니다.",invalidFieldName:"잘못된 데이터필드 이름입니다: %1",invalidFieldIndex:"잘못된 데이터필드 index입니다: %1",invalidRowIndex:"잘못된 데이터행 index입니다: %1",canNotModifyData:"읽기 전용 데이터를 변경할 수 없습니다.",canNotModifyDeleted:"삭제 상태 행을 변경할 수 없습니다: %1",requiredField:"반드시 값을 지정해야 하는 필드입니다: %1",invalidValueInDomain:"값이 필드 값 도메인에 포함되지 않습니다: %1",invalidValueInRange:"값이 필드 값 범위에 포함되지 않습니다: %1",invalidToIndex:"잘못된 'to' index입니다.: %1",requireSourceData:"원본 data가 반드시 지정돼야 합니다.",requireFilterName:"필터 이름이 반드시 지정돼야 합니다.",alreadyEditing:"이미 데이터 편집 중입니다.",invalidDateFormat:"잘못된 시간 날짜 형식입니다: %1",invalidSizeValue:"잘못된 Size 값입니다: %1",invalidOuterDiv:"잘못된 외부 div 입니다: %1",canNotHorzGrouping:"수평 모드일 때 그룹핑할 수 없습니다.",dataMustSet:"데이터가 먼저 설정돼야 합니다.",requireGroupingInfos:"하나 이상의 행 그룹핑 정보가 설정돼야 합니다.",canNotRowGrouping:"데이터링크 view에 대해 행그룹핑 할 수 없습니다. dataGroupBy()를 사용하세요.",canNotDataGrouping:"데이터링크 view가 아니면 데이터그룹핑할 수 없습니다. rowGroupBy()를 사용하세요.",canNotHorzInGrouping:"그룹핑 상태일 때 수평모드로 변경할 수 없습니다.",unknownLayoutType:"잘못된 layout 종류입니다: %1",layoutMustSet:"레이아웃 모델이 반드시 설정돼야 합니다.",unknownItemViewType:"잘못된 item view 종류입니다: %1",requireCommandName:"Command 이름이 지정돼야 합니다.",commandNameDuplicated:"이미 존재하는 command 이름입니다: %1",requireDataOrGroup:"데이터소스나 그룹 모델이 반드시 지정돼야 합니다.",requireTableName:"테이블모델의 이름이 지정돼야 합니다.",alreadyTableExists:"이미 존해하는 테이블모델입니다: %1",selectEditRowFirst:"수정하거나 삽입할 행을 먼저 선택하세요."},en:{dateFormat:"M/d/yyyy",am:"AM",pm:"PM",notExistsDataField:"A data field is not exists: %1",notSpecifiedDataField:"At least one datafield must be set.",invalidFieldName:"Invalid field name: %1",invalidFieldIndex:"Invalid field index: %1",invalidRowIndex:"Invalid row index: %1",canNotModifyData:"Can not modify a readonly data.",canNotModifyDeleted:"Can not modify a deleted row: %1",requiredField:"Required field: %1",invalidValueInDomain:"The value is not int the domain: %1",invalidValueInRange:"The value is not int the range: %1",invalidToIndex:"Invalid 'to' index: %1",requireSourceData:"A source data must be set.",requireFilterName:"A filter name must be set.",alreadyEditing:"DataView is already editing.",invalidDateFormat:"Invalid datetime format: %1",invalidSizeValue:"Invalid size value: %1",invalidOuterDiv:"Invalid outer div element: %1",canNotHorzGrouping:"Can not row grouping in horz mode.",dataMustSet:"A data must be set first.",requireGroupingInfos:"At least one grouping info must be set.",canNotRowGrouping:"Can not row grouping by data link view. use dataGroupBy().",canNotDataGrouping:"Can not data grouping without data link view. rowGroupBy()를 사용하세요.",canNotHorzInGrouping:"Can not change to horz mode while grouping",unknownLayoutType:"Invalid layout: %1",layoutMustSet:"A layout model must be set.",unknownItemViewType:"Unknow item view type: %1",requireCommandName:"Command name must be supplied.",commandNameDuplicated:"Command name is already exists: %1",requireDataOrGroup:"A data or group view must be set.",requireTableName:"The name of table model is required.",alreadyTableExists:"A table model is already exists: %1",selectEditRowFirst:"First select the row you want to edit or insert."}};let m=g.ko;const y=void 0,x="%".charCodeAt(0),f=-Math.PI/2,w=2*Math.PI/360,b=Math.ceil;function P(t){return parseFloat(t.toPrecision(12))}function v(t){return null==t?null:String(t)}function V(t){return t*Math.PI*2/360}function S(t){return t+"px"}function A(t){return null==t||Number.isNaN(t)||""===t}function L(t){return t<10?`0${t}`:String(t)}function E(t,e,s){let i,r;if(null==t||Number.isNaN(t)){if(e)return null;r=s||0,i=!0}else if(!(i=!isNaN(r=+t))){const s=t.trim();if(s.charCodeAt(s.length-1)===x&&(r=1===s.length?NaN:parseFloat(s)),isNaN(r)){if(e)return null;O(m.invalidSizeValue,t)}}return{size:r,fixed:i}}function N(t,e){return E(t,!0)||E(e,!1)}function T(t,e){return t?t.fixed?t.size:t.size*e/100:NaN}class C extends Error{}const M=function(t,e){if(!t)throw new C(e)};var k;!function(t){t.UP="up",t.DOWN="down",t.LEFT="left",t.RIGHT="right"}(k||(k={}));const O=(t,e)=>{throw new Error(((t,e)=>t.replace("%1",e))(t,e))};var B,D,R;!function(t){t.LEFT="left",t.CENTER="center",t.RIGHT="right"}(B||(B={})),function(t){t.TOP="top",t.MIDDLE="middle",t.BOTTOM="bottom"}(D||(D={})),function(t){t[t.LEFT=0]="LEFT",t[t.TOP=1]="TOP",t[t.BOTTOM=2]="BOTTOM",t[t.RIGHT=3]="RIGHT"}(R||(R={}));const I=[R.LEFT,R.RIGHT],$=[R.TOP,R.BOTTOM];let F=651212;class z{static getWin(t){return t.defaultView||t.parentWindow}static isVisible(t){return t&&"none"!==t.style.display}static setVisible(t,e,s=""){return t.style.display=e?s||"":"none",e}static hide(t){t.style.display="none"}static show(t,e=""){t.style.display=e}static addClass(t,e){if(e){e.split(/\s+/g).forEach((e=>t.classList.add(e)))}return t}static removeClass(t,e){if(e){e.split(/\s+/g).forEach((e=>t.classList.remove(e)))}return t}static getImageUrl(t){const e=t.backgroundImage;if(e&&e.startsWith('url("'))return e.substring(5,e.length-2)}static getFocused(){let t=document.getSelection().focusNode;for(;t;){if(t instanceof HTMLElement)return t;t=t.parentElement}}static isAncestorOf(t,e){let s=e;for(;s;){if(s==t)return!0;s=s.parentElement}return!1}static getOffset(t){const e=t.ownerDocument,s=e.defaultView,i=t.getBoundingClientRect(),r=e.body,n=e.documentElement,a=s.pageYOffset||n.scrollTop||r.scrollTop,h=s.pageXOffset||n.scrollLeft||r.scrollLeft,o=n.clientTop||r.clientTop||0,l=n.clientLeft||r.clientLeft||0,c=i.left+h-l,u=i.top+a-o;return{x:Math.round(c),y:Math.round(u)}}static getSize(t){const e=t.getBoundingClientRect();return{width:e.width,height:e.height}}static moveX(t,e){t.style.left=e+"px"}static moveY(t,e){t.style.top=e+"px"}static move(t,e,s){t.style.left=e+"px",t.style.top=s+"px"}static moveI(t,e,s){t.style.left=(e>>>0)+"px",t.style.top=(s>>>0)+"px"}static resize(t,e,s){t.style.width=e+"px",t.style.height=s+"px"}static resizeSVG(t,e,s){t.setAttribute("viewBox",`0 0 ${e} ${s}`)}static setWidth(t,e){t.style.width=e+"px"}static setHeight(t,e){t.style.height=e+"px"}static getBrowserSize(t){const e=t?t.ownerDocument:document,s=e.defaultView;return{width:s.innerWidth||e.documentElement.clientWidth||e.body.clientWidth,height:s.innerHeight||e.documentElement.clientHeight||e.body.clientHeight}}static setRect(t,e){const s=t.style;s.left=e.x+"px",s.top=e.y+"px",s.width=e.width+"px",s.height=e.height+"px"}static setBounds(t,e,s,i,r){const n=t.style;n.left=e+"px",n.top=s+"px",n.width=i+"px",n.height=r+"px"}static setBoundsEx(t,e,s,i,r){const n=t.style;!isNaN(e)&&(n.left=e+"px"),!isNaN(s)&&(n.top=s+"px"),!isNaN(e)&&(n.width=i+"px"),!isNaN(e)&&(n.height=r+"px")}static getClientRect(t){const e=t.getBoundingClientRect();return e.cx=t.offsetLeft,e.cy=t.offsetTop,e}static getChildIndex(t){if(t){const e=t.parentNode;if(e){const s=e.children;for(let e=s.length;e--;)if(s[e]===t)return e}}return-1}static clearChildren(t){let e;for(;e=t.lastChild;)t.removeChild(e)}static clearElements(t){let e;for(;e=t.lastChild;)z.clearElements(e),t.removeChild(e)}static append(t,e){e.parentNode!==t&&t.appendChild(e)}static addChild(t,e){return!(!t||!e||e.parentNode===t)&&(t.appendChild(e),!0)}static removeChild(t,e){return!(!t||!e||e.parentNode!==t)&&(t.removeChild(e),!0)}static removeChildren(t,e){e.forEach((e=>{e instanceof Element?e.parentNode===t&&t.removeChild(e):e&&e.dom().parentNode==t&&t.removeChild(e.dom())}))}static remove(t){const e=t&&t.parentElement;return e&&e.removeChild(t),null}static clearStyle(t){t.style.cssText=""}static htmlEncode(t){return document.createElement("a").appendChild(document.createTextNode(t)).parentNode.innerHTML}static setData(t,e,s){null==s||""===s?delete t.dataset[e]:t.dataset[e]=s}static toggleData(t,e,s){s?t.dataset[e]="1":delete t.dataset[e]}static getData(t,e){return t.dataset[e]}static hasData(t,e){return void 0!==t.dataset[e]}static setVar(t,e,s){t.style.setProperty(e,s)}static animate(t,e,s,i,r=150,n="none"){const a={},h={};return a[e]=s,h[e]=i,t.animate([a,h],{duration:r,fill:n})}static setAttr(t,e,s){null!=s&&""!==s?t.setAttribute(e,s):t.removeAttribute(e)}static setAttrs(t,e){for(const s in e)t.setAttribute(s,e[s])}static getDomId(){return"-rtc-"+F++}static stopAnimation(t){if(t)try{t.finish()}catch(t){p.debugging(),console.error(t)}return null}static childByPath(t,e){let s=t;if(e){let t=0;for(;t<e.length;)s=s.childNodes[e[t++]]}return s}static childByClass(t,e){return t.getElementsByClassName(e)[0]}static setDisabled(t,e){this.setAttr(t,"disabled",!!e||void 0)}static setImportantStyle(t,e,s){t.setProperty(e,s,"important")}}const H=(new Date).getTime();Element.prototype.animate||(Element.prototype.animate=function(t){});const G=!!window.opera||navigator.userAgent.indexOf(" OPR/")>=0,j=!!window.chrome&&!G;Object.prototype.toString.call(HTMLElement).indexOf("Constructor")>0||!j&&!G&&navigator.userAgent.indexOf("Safari"),navigator.userAgent.toLocaleLowerCase().indexOf("samsungbrowser"),navigator.userAgent.toLocaleLowerCase().indexOf("miuibrowser");const U=/"([^"]*(?="))"/,W=/'([^']*(?='))'/,q='"'.charCodeAt(0),Y="'".charCodeAt(0);class X{static now(){return+new Date}static stopEvent(t,e=!1){t.preventDefault?(t.preventDefault(),t.stopPropagation()):t.returnValue=!1,e&&t.stopImmediatePropagation()}static getErrorStack(t){const e=t.stack;return e?e.split("\n").map((t=>t+"<br/>")):""}static getBaseClassName(t){return Object.getPrototypeOf(t.constructor).name}static isObject(t){return t&&"object"==typeof t&&!h(t)}static assign(t,e){this.isObject(e)&&Object.assign(t,e)}static isValidObject(t){if(this.isObject(t))for(let e in t)if(t.hasOwnProperty(e))return!0}static copyObject(t){if(t&&"object"==typeof t&&!h(t))return Object.assign({},t)}static checkArray(t){return h(t)?t:void 0}static makeArray(t,e=!1){return null!=t?h(t)?t:[t]:e?[]:void 0}static makeNumArray(t){return h(t)?t.map((t=>+t)):null!=t?[+t]:[]}static getIntArray(t,e=0){const s=[];for(let i=e,r=e+t;i<r;i++)s.push(i);return s}static isValueArray(t){if(h(t)){for(let e=t.length-1;e>=0;e--)if(null!=t[e]&&"object"==typeof t[e])return!1;return!0}return!1}static toArray(t){return h(t)?t:null!=t?[t]:null}static copyArray(t){return h(t)?t.slice(0):null!=t?[t]:void 0}static push(t,e){if(e&&e.length>0)for(let s=0,i=e.length;s<i;s++)t.push(e[s])}static isDefined(t){return null!=t}static isNotDefined(t){return null==t}static isNumber(t){return"number"==typeof t}static isValidNumber(t){return"number"==typeof t&&!isNaN(t)&&isFinite(t)}static getNumber(t,e=0){const s=parseFloat(t);return isFinite(s)?s:e}static toNumber(t,e=0){return isNaN(t)||null===t||""===t?e:+t}static getEnumValues(t){return Object.keys(t).map((e=>t[e]))}static compareText(t,e,s=!1){return t=t||"",e=e||"",s&&(t=t.toLocaleLowerCase(),e=e.toLocaleLowerCase()),t>e?1:t<e?-1:0}static getTimeF(){return(new Date).getTime()/1e3}static getTimer(){return(new Date).getTime()-H}static isWhiteSpace(t){return!t||!t.trim()}static pad(t,e,s){return e=Math.max(e||2,1),s=s||"0",new Array(e-String(t).length+1).join(s)+t}static pad16(t,e,s){return e=Math.max(e||2,1),s=s||"0",new Array(e-t.toString(16).length+1).join(s)+t.toString(16)}static pick(...t){const e=t.length;let s;for(let i=0;i<e;i++)if(s=t[i],null!=s)return s}static pickNum(...t){const e=t.length;for(let s=0;s<e;s++)if(!isNaN(t[s])&&null!==t[s])return t[s];return NaN}static included(t,...e){const s=e.length;for(let i=0;i<s;i++)if(e[i]==t)return!0;return!1}static compareTextValue(t,e,s,i){if(t===e)return!0;let r=String(t),n=null==e?void 0:String(e);return!r&&!n||!(!r||!n)&&(s||(r=r.toLowerCase(),n=n.toLowerCase()),i?n.indexOf(r)>=0:r==n)}static cast(t,e){return t instanceof e?t:null}static irandom(t,e){if(void 0!==e){const s=t>>0,i=e>>0;return Math.random()*(i-s)+s>>>0}{const e=t>>0;return Math.random()*e>>0}}static irandomExcept(t,e,s){if(0===t&&1===e&&isNaN(s))throw new Error("Invalid irandom2");for(;;){const i=this.irandom(e,s);if(i!==t)return i}}static brandom(){return Math.random()>.5}static srandom(t,e){let s="";const i=this.irandom(t,e);for(let t=0;t<i;t++)s+=String.fromCharCode(this.irandom(97,123));return s}static erandom(t){const e=Object.values(t);return e[this.irandom(e.length)]}static arandom(t){return t[Math.random()*t.length>>0]}static iarandom(t,e,s){const i=new Array;for(let s=t;s<e;s++)i.push(s);for(;i.length>s;)i.splice(X.irandom(i.length),1);return i}static alert(t){window.alert(t)}static toInt(t,e){const s=parseInt(t,e||10);return isNaN(s)?0:s}static toFloat(t){const e=parseFloat(t);return isNaN(e)?0:e}static toEven(t){return 1&t?t+1:t}static hex(t,e=2,s="0"){e=Math.max(e||2,1);const i=t.toString(16);return s=s||"0",new Array(e-i.length+1).join(s)+i}static toStr(t){return Number.isNaN(t)||null==t?"":String(t)}static extend(t,e){t=t||{};for(let s in e)t[s]=e[s];return t}static equalNumbers(t,e){return isNaN(t)==isNaN(e)&&!isNaN(t)&&t==e}static equalArrays(t,e){if(t===e)return!0;if(null==t||null==e)return!1;const s=t.length;if(s!=e.length)return!1;for(let i=0;i<s;++i)if(t[i]!==e[i])return!1;return!0}static equalObjects(t,e){if(t===e)return!0;if(!t&&!e)return!0;if(!t||!e)return!1;for(var s in t)if(t.hasOwnProperty(s)&&t[s]!==e[s])return!1;for(var s in e)if(e.hasOwnProperty(s)&&t[s]!==e[s])return!1;return!0}static parseDate(t,e){const s=new Date(t);return isNaN(s.getTime())?e||new Date:s}static isLeapYear(t){return t%4==0&&t%100!=0||t%400==0}static incMonth(t,e){const s=t.getDate();return t.setDate(1),t.setMonth(t.getMonth()+e),t.setDate(Math.min(s,X.month_days[X.isLeapYear(t.getFullYear())?1:0][t.getMonth()])),t}static minDate(t,e){return null!==t?t:null!==e?e:t.getTime()<e.getTime()?t:e}static maxDate(t,e){return null!==t?e:null!==e||t.getTime()>e.getTime()?t:e}static getTextLength2(t){let e=0,s=0,i=0;for(;i=t.charCodeAt(s++);e+=i>>7?2:1);return e}static getClassName(t){if(t&&t.constructor)return t.constructor.name||function(t){let e=t.toString();return e=e.substring(9),e=e.substring(0,e.indexOf("(")),e}(t.constructor)}static isInteger(t){return Number.isInteger?Number.isInteger(t):"number"==typeof t&&isFinite(t)&&Math.floor(t)===t}static isEmpty(t){if(t)for(let e in t)return!1;return!0}static isNotEmpty(t){if(t)for(let e in t)return!0;return!1}static capitalize(t){if("string"!=typeof t)return"";const e=t.charAt(0);return e>="A"&&e<="Z"?t:e.toUpperCase()+t.slice(1)}static uncapitalize(t){if("string"!=typeof t)return"";const e=t.charAt(0);return e>="a"&&e<="z"?t:e.toLowerCase()+t.slice(1)}static labelize(t){if("string"!=typeof t)return"";const e=t.charAt(0);let s=(t=e>="A"&&e<="Z"?t:e.toUpperCase()+t.slice(1)).charAt(0);for(let e=1;e<t.length;e++){const i=t.charAt(e);i>="A"&&i<="Z"&&(s+=" "),s+=i}return s}static deepClone(t){if(t instanceof Date)return new Date(t);if(null==t||"object"!=typeof t)return t;{const e=h(t)?[]:{};for(let s of Object.keys(t))e[s]=X.deepClone(t[s]);return e}}static getArray(t,e){const s=[];for(let i=0;i<t;i++)s.push(e);return s}static getNumArray(t,e=0){const s=[];for(let i=0;i<t;i++)s.push(e);return s}static hasSetter(t,e){for(;t;){const s=Reflect.getOwnPropertyDescriptor(t,e);if(s)return s.writable||!!s.set;t=Object.getPrototypeOf(t)}return!1}static dataUriToBinary(t){const e=";base64,",s=t.indexOf(e)+8,i=t.substring(s),r=window.atob(i),n=r.length,a=new Uint8Array(new ArrayBuffer(n));for(let t=0;t<n;t++)a[t]=r.charCodeAt(t);return a}static assignProps(t,e){let s=!1;if(e)for(let i in e)e[i]!==t[i]&&(t[i]=e[i],s=!0);return s}static assignStyleAndProps(t,e){let s=!1;if(e)for(let i in e)("style"===i||t.hasOwnProperty(i))&&(t[i]=e[i],s=!0);return s}static dedupe(t,e){for(let s=(t=t.sort(e||((t,e)=>t>e?1:t<e?-1:0))).length-1;s>0;s--)t[s]===t[s-1]&&t.splice(s,1);return t}static isUnique(t,e){for(let s=(t=t.sort(e||((t,e)=>t>e?1:t<e?-1:0))).length-1;s>0;s--)if(t[s]===t[s-1])return!1;return!0}static sortNum(t){return t.sort(((t,e)=>t-e))}static logElapsed(t,e){const s=+new Date;e(),console.log(t,+new Date-s+"ms")}static clamp(t,e,s){return isNaN(s)||(t=Math.min(t,s)),isNaN(e)||(t=Math.max(t,e)),t}static splice(t,e,s,i){const r=[e,s].concat(i);Array.prototype.splice.apply(t,r)}static makeIntArray(t,e){const s=new Array(Math.max(0,e-t));for(let i=t;i<e;i++)s[i-t]=i;return s}static setInterval(t,e){return setInterval(t,e)}static clearInterval(t){clearInterval(t)}static isStringArray(t){return h(t)&&t.every((t=>"string"==typeof t))}static isNumberArray(t){return h(t)&&t.every((t=>"number"==typeof t))}static makeLineSeparator(t){if(h(t)){if(t.length>0){let e=t[0];for(let s=1,i=t.length;s<i;s++)e+="|"+t[s];return new RegExp(e,"g")}}else if(t)return new RegExp(t,"g")}static stripQuotes(t){const e=t.charCodeAt(0);return e===q?t=t.replace(U,"$1"):e===Y&&(t=t.replace(W,"$1")),t}static isDate(t){return"[object Date]"===Object.prototype.toString.call(t)}static isValidDate(t){return t.getTime()==t.getTime()}static asFunction(t){return"function"==typeof t?t:void 0}static getFieldProp(t){const e=t.indexOf(".");if(e>=0)return{field:t.substring(0,e),props:t.substring(e+1).split(".")}}static watch(){return new K}static startsWith(t,e){if(t&&e)return 0===t.indexOf(e)}static endsWith(t,e){if(t&&e)return t.indexOf(e,-t.length)===t.length-e.length}static scaleNumber(t,e,s){const i=Math.abs(t);if(i>=1e3){let r=e.length-1;for(;r;){const n=Math.pow(1e3,r--);if(n<=Math.pow(10,Math.log(i)*Math.LOG10E)&&(s||10*i%n==0))return{value:t/n,symbol:e[r]}}}}static isNorth(t,e=.1){const s=1.5*Math.PI;return t<0&&(t+=2*Math.PI),t>=s-e&&t<=s+e}static isSouth(t,e=.1){const s=.5*Math.PI;return t>=s-e&&t<=s+e}static isLeft(t){return t>.5*Math.PI&&t<1.5*Math.PI}}X.week_days=["일","월","화","수","목","금","토"],X.month_days=[[31,28,31,30,31,30,31,31,30,31,30,31],[31,29,31,30,31,30,31,31,30,31,30,31]],X.uniqueKey=function(){let t=Math.random().toString(36).substring(2,9)+"-",e=0;return function(){return"rr-chart-"+t+e++}}();class K{constructor(){this._started=+new Date}elapsed(t=!1){const e=+new Date-this._started;return t&&(this._started=+new Date),e}elapsedText(t=!1,e="ms."){return this.elapsed(t)+e}}function Q(t){return{width:t.width,height:t.height}}class Z{static create(t,e,s,i){return X.isObject(t)?new Z(t.x,t.y,t.width,t.height):A(e)?new Z(t,t,t,t):A(s)?new Z(t,e,t,e):new Z(t,e,s,i)}constructor(t=0,e=0,s=0,i=0){this.x=t,this.y=e,this.width=s,this.height=i}get left(){return this.x}set left(t){const e=t-this.x;this.x+=e,this.width-=e}get right(){return this.x+this.width}set right(t){const e=t-(this.x+this.width);this.width+=e}get top(){return this.y}set top(t){const e=t-this.y;this.y+=e,this.height-=e}get bottom(){return this.y+this.height}set bottom(t){const e=t-(this.y+this.height);this.height+=e}get isEmpty(){return 0===this.width||0===this.height}get isValid(){return t=this,!(isNaN(t.x)||isNaN(t.y)||isNaN(t.width)||isNaN(t.height));var t}clone(){return new Z(this.x,this.y,this.width,this.height)}getInner(){return new Z(0,0,this.width,this.height)}equals(t){return t===this||t&&this.x===t.x&&this.y===t.y&&this.width===t.width&&this.height===t.height}leftBy(t){return this.x+=t,this.width-=t,this}rightBy(t){return this.width+=t,this}topBy(t){return this.y+=t,this.height-=t,this}bottomBy(t){return this.height+=t,this}shrink(t,e){return this.width-=t,this.height-=e,this}expand(t,e){return this.width+=t,this.height+=e,this}contains(t,e){return t>=this.x&&t<=this.x+this.width&&e>=this.y&&e<=this.y+this.height}setEmpty(){return this.width=this.height=0,this}move(t=0,e=0){return this.x=t,this.y=e,this}set(t,e,s,i){return this.x=t,this.y=e,this.width=s,this.height=i,this}setWidth(t){return this.width=t,this}copy(t){return this.x=t.x,this.y=t.y,this.width=t.width,this.height=t.height,this}copyHorz(t){return this.x=t.x,this.width=t.width,this}copyVert(t){return this.y=t.y,this.height=t.height,this}inflate(t=0,e,s,i){return e=void 0!==e?e:t,s=void 0!==s?s:t,i=void 0!==i?i:e,t&&(this.left=this.x-t),e&&(this.top=this.y-e),s&&(this.right=this.right+s),i&&(this.bottom=this.bottom+i),this}offset(t,e){return this.x+=t,this.y+=e,this}round(){const t=this.clone();return t.x>>>=0,t.y>>>=0,t.width>>>=0,t.height>>>=0,t}union(t){const e=this.clone();return e.left=Math.min(this.x,t.x),e.right=Math.max(this.right,t.right),e.top=Math.min(this.y,t.y),e.bottom=Math.max(this.bottom,t.bottom),e}normalize(){return this.width<0&&(this.x-=this.width,this.width*=-1),this.height<0&&(this.y-=this.height,this.height*=-1),this}toString(){return"{x: "+this.x+", y: "+this.y+", width: "+this.width+", height: "+this.height+"}"}}var J;Z.Empty=new Z,Z.Temp=new Z,function(t){t.LINE="line",t.LINES="lines",t.CIRCLE="circle",t.DIAMOND="diamond",t.RECTANGLE="rectangle",t.SQUARE="square",t.TRIANGLE="triangle",t.ITRIANGLE="itriangle"}(J||(J={})),X.getEnumValues(J);const tt=.001;class et{static line(t,e,s,i){return["M",t,e,"L",s,i]}static lines(t){let e=0;const s=["M",t[e],t[e+1]];for(;e<t.length;e++)s.push("L",t[e++],t[e]);return s.push("Z"),s}static box(t,e,s,i){return["M",t,e,"L",s,e,"L",s,i,"L",t,i,"Z"]}static rect(t){return this.rectangle(t.x,t.y,t.width,t.height)}static rectangle(t,e,s,i){return["M",t,e,"L",t+s,e,"L",t+s,e+i,"L",t,e+i,"Z"]}static square(t,e,s,i){const r=Math.min(s,i);return["M",t+=(s-r)/2,e+=(i-r)/2,"L",t+r,e,"L",t+r,e+r,"L",t,e+r,"Z"]}static circle(t,e,s){return["M",t,e,"m",s,0,"a",s,s,0,1,1,2*-s,0,"a",s,s,0,1,1,2*s,0]}static arc(t,e,s,i,r,n){const a=Math.cos(r),h=Math.sin(r),o=Math.cos(n-=tt),l=Math.sin(n),c=n-r-Math.PI<tt?0:1,u=[];return u.push("M",t+s*a,e+i*h,"A",s,i,0,c,1,t+s*o,e+i*l,"Z"),u}static sector(t,e,s,i,r,n,a,h){const o=Math.abs(a-n-2*Math.PI)<tt,l=a-n-Math.PI<tt?0:1,c=Math.cos(n),u=Math.sin(n),d=Math.cos(a-=o?tt:0),_=Math.sin(a),p=h?1:0,g=s*r,m=i*r,y=[];return y.push("M",t+s*c,e+i*u,"A",s,i,0,l,p,t+s*d,e+i*_),o?y.push("M",t+g*d,e+m*_):y.push("L",t+g*d,e+m*_),y.push("A",g,m,0,l,1-p,t+g*c,e+m*u),y.push("Z"),y}static diamond(t,e,s,i){return["M",t+s/2,e,"L",t+s,e+i/2,"L",t+s/2,e+i,"L",t,e+i/2,"Z"]}static triangle(t,e,s,i){return["M",t+s/2,e,"L",t+s,e+i,"L",t,e+i,"Z"]}static itriangle(t,e,s,i){return["M",t,e,"L",t+s,e,"L",t+s/2,e+i,"Z"]}}class st extends i{constructor(t,e,s){super(),this._inited=!1,this._testing=!1,this._dirty=!0,this._invalidElements=[],this._toAnimation=0,this._invalidateLock=!1,this._lockDirty=!1,this._cssVars={},this.loaded=!1,this._windowResizeHandler=t=>{this._windowResized()},this._clickHandler=t=>{this._pointerHandler&&this._pointerHandler.handleClick(this.toOffset(t))},this._dblClickHandler=t=>{},this._touchMoveHandler=t=>{},this._pointerDownHandler=t=>{},this._pointerMoveHandler=t=>{this._pointerHandler&&this._pointerHandler.handleMove(this.toOffset(t))},this._pointerUpHandler=t=>{},this._pointerCancelHandler=t=>{},this._pointerLeaveHandler=t=>{},this._keyPressHandler=t=>{},this._wheelHandler=t=>{},!t&&e instanceof HTMLDivElement&&(t=e.ownerDocument),this.$_initControl(t||document,e,s||st.CLASS_NAME),this._resigterEventHandlers(this._dom),this._inited=!0,this.invalidate(!0)}_doDestory(){this._unresigterEventHandlers(this._dom),z.remove(this._dom),this._dom=null,this._container=null}isInited(){return this._inited}isTesting(){return this._testing}doc(){return this._dom.ownerDocument}dom(){return this._dom}width(){return this._container.offsetWidth}height(){return this._container.offsetHeight}clearDefs(){z.clearChildren(this._defs)}clearTemporaryDefs(){const t=this._defs,e=t.children;for(let s=0;s<e.length;s++)e[s].hasAttribute(it.TEMP_KEY)&&t.removeChild(e[s])}appendDom(t){t&&this._htmlRoot.append(t)}addElement(t){t&&this._root.add(t)}removeElement(t){this._root.removeChild(t)}setPointerHandler(t){this._pointerHandler=t}invalidate(t=!1){t||!this._invalidateLock&&!this._dirty&&this._inited?(this._dirty=!0,this._requestTimer||this._testing||this.$_requestRender()):this._invalidateLock&&(this._lockDirty=!0)}invalidateLayout(t=!1){this.invalidate(t)}setLock(){this._invalidateLock=!0}releaseLock(t=!0){this._invalidateLock&&(this._invalidateLock=!1),this._lockDirty&&t&&this.invalidate(),this._lockDirty=!1}lock(t){this.setLock();try{t(this)}finally{this.releaseLock()}}silentLock(t){this.setLock();try{t(this)}finally{this.releaseLock(!1)}}getBounds(){return this._dom.getBoundingClientRect()}setAnimation(t){this._toAnimation=t||0}fling(t,e){}getCssVar(t){let e=this._cssVars[t];return t in this._cssVars?this._cssVars[t]:(e=getComputedStyle(this._root.dom).getPropertyValue(t),this._cssVars[t]=e,e)}clipBounds(t=NaN,e=NaN,s=NaN,i=NaN,r=0){const n=new at(this.doc(),t,e,s,i,r,r);return this._defs.appendChild(n.dom),n}clipRect(t){return this.clipBounds(t.x,t.y,t.width,t.height)}clipPath(){const t=new ot(this.doc());return this._defs.appendChild(t.dom),t}removeDef(t){this._defs.removeChild(t.dom)}containerToElement(t,e,s){const i=this._container.getBoundingClientRect(),r=t.dom.getBoundingClientRect();return{x:e+i.x-r.x,y:s+i.y-r.y}}_setTesting(){this._testing=!0,it.TESTING=!0}_setSize(t,e){isNaN(t)||(this._container.style.width=t+"px"),isNaN(e)||(this._container.style.height=e+"px")}$_addListener(t,e,s){t.addEventListener(e,s)}_resigterEventHandlers(t){window.addEventListener("resize",this._windowResizeHandler),this.$_addListener(t,"click",this._clickHandler),this.$_addListener(t,"dblclick",this._dblClickHandler),this.$_addListener(t,"touchmove",this._touchMoveHandler),this.$_addListener(t,"pointerdown",this._pointerDownHandler),this.$_addListener(t,"pointermove",this._pointerMoveHandler),this.$_addListener(t,"pointerup",this._pointerUpHandler),this.$_addListener(t,"pointercancel",this._pointerCancelHandler),this.$_addListener(t,"pointerleave",this._pointerLeaveHandler),this.$_addListener(t,"keypress",this._keyPressHandler),this.$_addListener(t,"wheel",this._wheelHandler)}_unresigterEventHandlers(t){window.removeEventListener("resize",this._windowResizeHandler),t.removeEventListener("click",this._clickHandler),t.removeEventListener("dblclick",this._dblClickHandler),t.removeEventListener("touchmove",this._touchMoveHandler),t.removeEventListener("pointerdown",this._pointerDownHandler),t.removeEventListener("pointermove",this._pointerMoveHandler),t.removeEventListener("pointerup",this._pointerUpHandler),t.removeEventListener("pointercancel",this._pointerCancelHandler),t.removeEventListener("pointerleave",this._pointerLeaveHandler),t.removeEventListener("keypress",this._keyPressHandler),t.removeEventListener("wheel",this._wheelHandler)}_prepareRenderers(t){}$_initControl(t,e,s){if(this._inited)return;e instanceof HTMLDivElement?this._container=e:this._container=t.getElementById(e),this._container instanceof HTMLDivElement||O(m.invalidOuterDiv,e);const i=this._container.ownerDocument,r=this._dom=i.createElement("div");Object.assign(r.style,{position:"relative",width:"100%",height:"100%",boxSizing:"border-box",overflow:"hidden",padding:"20px","-webkit-touch-callout":"none","-webkit-user-select":"none","user-select":"none","-webkit-tap-highlight-color":"rgba(0, 0, 0, 0)"}),r.className=s,this._container.appendChild(r);const a=this._svg=i.createElementNS(n,"svg");a.classList.add("rct-root"),a.style.setProperty("overflow","visible","important"),a.setAttribute("width","100%"),a.setAttribute("height","100%");const h=i.createElement("desc");h.textContent="Created by RealChart 1.0.0",a.appendChild(h);const o=this._defs=i.createElementNS(n,"defs");this._initDefs(i,o),a.appendChild(o),r.appendChild(a),this._root=new nt(this),a.appendChild(this._root._dom),this._htmlRoot=i.createElement("div"),r.appendChild(this._htmlRoot),Object.assign(this._htmlRoot.style,{position:"absolute"})}_initDefs(t,e){let s=t.createElementNS(n,"filter");const i=t.createElementNS(n,"feDropShadow");s.setAttribute("id",st.SHADOW_FILTER),i.setAttribute("dx","1"),i.setAttribute("dy","1"),i.setAttribute("flood-olor","#000"),i.setAttribute("flood-opacity","0.75"),i.setAttribute("stdDeviation","1.5"),s.appendChild(i),e.appendChild(s)}_render(){this.$_render()}$_invalidateElement(t){this._invalidElements.push(t),this.invalidate()}$_requestRender(){window.requestAnimationFrame?this._requestTimer=window.requestAnimationFrame((()=>this.$_render())):setTimeout((()=>{this.$_render()}),0)}updateNow(){this.$_render()}$_render(){if(+new Date<=this._toAnimation)this.$_requestRender();else{console.time("render chart");try{this._doBeforeRender();const t=this._dom.getBoundingClientRect(),e=this._svg.getBoundingClientRect(),s=this._svg.clientWidth,i=this._svg.clientHeight;this._htmlRoot.style.left=e.left-t.left+"px",this._htmlRoot.style.top=e.top-t.top+"px",this._doRender({x:0,y:0,width:s,height:i}),this._doRenderBackground(this._container.firstElementChild,s,i)}finally{this.loaded=!0,this._dirty=!1,this._requestTimer=null,this._invalidElements=[],this._doAfterRender(),console.timeEnd("render chart")}}}_doBeforeRender(){}_doAfterRender(){}_doRenderBackground(t,e,s){}_windowResized(){this.invalidateLayout()}toOffset(t){const e=this._container.getBoundingClientRect();return t.pointX=t.clientX-e.left,t.pointY=t.clientY-e.top,t}}st.CLASS_NAME="rct-control",st.SHADOW_FILTER="rr-chart-shadow-filter";class it extends s{constructor(t,e,s=y){super(),this._visible=!0,this._zIndex=0,this._scaleX=1,this._scaleY=1,this._rotation=0,this._styles={},this._styleDirty=!1,this._dom=t.createElementNS(n,s||"g"),(this._styleName=e)&&this.setAttr("class",e)}_doDestory(){this.remove()}get doc(){return this._dom.ownerDocument}get dom(){return this._dom}get parent(){return this._parent}get control(){return this._parent&&this._parent.control}get zIndex(){return this._zIndex}set zIndex(t){t!==this._zIndex&&(this._zIndex=t)}get x(){return this._x}set x(t){t!==this._x&&(this._x=t,this.setAttr("x",this._x))}get tx(){return this._translateX}get y(){return this._x}set y(t){t!==this._y&&(this._y=t,this.setAttr("y",this._y))}get ty(){return this._translateY}get width(){return this._width}set width(t){t!==this._width&&(this._width=t,this.setAttr("width",isNaN(t)?"":t))}get height(){return this._height}set height(t){t!==this._height&&(this._height=t,this.setAttr("height",isNaN(t)?"":t))}get visible(){return this._visible}set visible(t){this.setVisible(t)}setVisible(t){return t!==this._visible&&(this._visible=t,this._dom&&(this._dom.style.display=this._visible?"":"none")),this._visible}get rotation(){return this._rotation}set rotation(t){t!=this._rotation&&(this._rotation=t,this._updateTransform())}setRotaion(t,e,s){return t===this._originX&&e===this._originY&&s===this._rotation||(this._originX=t,this._originY=e,this._rotation=s,this._updateTransform()),this}getStyle(t){return window.getComputedStyle(this._dom).getPropertyValue(t)}hasStyle(t){return this.dom.classList.contains(t)}add(t){return t&&t._parent!==this&&(t._parent=this,this._dom.appendChild(t._dom),t._doAttached(this)),t}insertChild(t,e){return t&&t._parent!==this&&(t._parent=this,this._dom.insertBefore(t._dom,e._dom),t._doAttached(this)),t}insertFirst(t){return t&&t._parent!==this&&(t._parent=this,this._dom.insertBefore(t._dom,this._dom.firstChild),t._doAttached(this)),t}removeChild(t){t&&t._parent===this&&(this._dom.removeChild(t._dom),t._parent=null,t._doDetached(this))}remove(){return this._parent&&this._parent.removeChild(this),this}appendElement(t,e){const s=t.createElementNS(n,e);return this._dom.appendChild(s),s}insertElement(t,e,s){const i=t.createElementNS(n,e);return this._dom.insertBefore(i,s),i}getAttr(t){return this.dom.getAttribute(t)}setAttr(t,e){return this.dom.setAttribute(t,e),this}setAttrs(t){for(let e in t)this.dom.setAttribute(e,t[e]);return this}unsetAttr(t){return this.dom.removeAttribute(t),this}setBounds(t,e,s,i){return this.translate(t,e),this.resize(s,i),this}setRect(t){return this.translate(t.x,t.y),this.resize(t.width,t.height),this}getRect(){return Z.create(this._translateX,this._translateY,this.width,this.height)}getSize(){return{width:this.width,height:this.height}}getBBounds(){return this._dom.getBBox()}controlToElement(t,e){return this.control.containerToElement(this,t,e)}move(t,e){return this.x=t,this.y=e,this}translate(t,e){return t===this._translateX&&e===this._translateY||(X.isValidNumber(t)&&(this._translateX=t),X.isValidNumber(e)&&(this._translateY=e),this._updateTransform()),this}translateX(t){return t!==this._translateX&&(X.isValidNumber(t)&&(this._translateX=t),this._updateTransform()),this}translateY(t){return t!==this._translateY&&(X.isValidNumber(t)&&(this._translateY=t),this._updateTransform()),this}resize(t,e,s=!0){return t!==this._width&&s&&this.setAttr("width",this._width=t),e!==this._height&&s&&this.setAttr("height",this._height=e),this}appendDom(t){return t&&this._dom.appendChild(t),t}insertDom(t,e){return t&&this._dom.insertBefore(t,e),t}clearDom(){const t=this._dom;let e;for(;e=t.lastChild;)t.removeChild(e)}clearStyles(){const t=this.dom.style;let e=!1;for(let s in this._styles)t.removeProperty(s),e=!0;return this._styles={},e&&(this._styleDirty=!0),e}clearStyle(t){let e=!1;if(t){const s=this.dom.style;for(let i of t)i in this._styles&&(s.removeProperty(i),delete this._styles[i],e=!0);e&&(this._styleDirty=!0)}return e}setStyles(t){let e=!1;if(t){const s=this.dom.style;for(let i in t)this._styles[i]!==t[i]&&(s[i]=this._styles[i]=t[i],e=!0);e&&(this._styleDirty=!0)}return e}resetStyles(t){const e=this.clearStyles();return this.setStyles(t)||e}_resetClass(){this._styleName?this.setAttr("class",this._styleName):this.unsetAttr("class")}clearStyleAndClass(){this.clearStyles(),this._resetClass()}setStyleOrClass(t){o(t)?(this._resetClass(),t&&this._dom.classList.add(t)):this.resetStyles(t)}addStyleOrClass(t){o(t)?t&&this._dom.classList.add(t):a(t)&&this.setStyles(t)}setStyleName(t){this.setAttr("class",t)}setStyle(t,e){let s=!1;return e!==this._styles[t]&&(s=this._styleDirty=!0,this._styles[t]=e,this.dom.style[t]=e),s}putStyles(t,e){if(e=e||{},t)for(let s in t)e[s]=t[s];return e}putStyle(t,e,s){return(s=s||{})[t]=e,s}setData(t,e){this.dom.dataset[t]=e||""}unsetData(t){delete this.dom.dataset[t]}removeLater(t=!0,e=.5){return this}fadeout(t,e){return this}clipRect(t,e,s,i,r=0){const n=this.control.clipBounds(t,e,s,i,r);return this.setClip(n),n}setClip(t){t?this.setAttr("clip-path","url(#"+(t.id||t)+")"):this.unsetAttr("clip-path")}setTemporary(){return this.setAttr(it.TEMP_KEY,1),this}_testing(){return it.TESTING}_doAttached(t){}_doDetached(t){}_updateTransform(){const t=this._dom;let e=this._translateX,s=this._translateY,i=[];(X.isValidNumber(e)||X.isValidNumber(s))&&(e=e||0,s=s||0,i=["translate("+e+","+s+")"]),X.isNotEmpty(this._matrix)&&i.push("matrix("+this._matrix.join(",")+")"),this._rotation&&i.push("rotate("+this._rotation+" "+X.pick(this._originX,t.getAttribute("x"),0)+" "+X.pick(this._originY,t.getAttribute("y")||0)+")");const r=X.getNumber(this._scaleX,1),n=X.getNumber(this._scaleY,1);1===r&&1===n||i.push("scale("+r+" "+n+")"),i.length&&this._dom.setAttribute("transform",i.join(" "))}}it.TESTING=!1,it.DEBUGGING=!1,it.TEMP_KEY="_temp_";class rt extends it{constructor(t,e){super(t,e,"g")}}class nt extends it{constructor(t){super(t.doc(),null),this._control=t}get control(){return this._control}}class at extends it{constructor(t,e,s,i,r,n=0,a=0){super(t,y,"clipPath");const h=this._id=X.uniqueKey()+"-";this.setAttr("id",h);const o=this._rect=new it(t,null,"rect");o.setAttr("fill","none"),n>0&&o.setAttr("rx",String(n)),a>0&&this.dom.setAttribute("rx",String(a)),isNaN(e)||o.setBounds(e,s,i,r),this.add(o)}get id(){return this._id}setBounds(t,e,s,i){return this._rect.move(t,e),this._rect.resize(s,i),this}get x(){return this._rect.x}set x(t){this._rect.x=t}get y(){return this._rect.y}set y(t){this._rect.y=t}get width(){return this._rect.width}set width(t){this._rect.width=t}get height(){return this._rect.height}set height(t){this._rect.height=t}}class ht extends it{constructor(t,e=void 0,s=void 0){super(t,e,"path"),s&&this.setPath(s)}path(){return this._path}setPath(t){t!==this._path&&(this._path=t,o(t)?this.setAttr("d",t):this.setAttr("d",t.join(" ")))}renderShape(t,e,s,i){let r;switch(t){case"squre":case"diamond":case"triangle":case"itriangle":r=et[t](e-i,s-i,2*i,2*i);break;default:r=et.circle(e,s,i)}this.setPath(r)}}class ot extends it{constructor(t){super(t,y,"clipPath");const e=this._id=X.uniqueKey()+"-";this.setAttr("id",e),this._path=new ht(t),this.add(this._path)}get id(){return this._id}setPath(t){this._path.setPath(t)}}const lt="0".charCodeAt(0),ct="#".charCodeAt(0),ut=",".charCodeAt(0),dt="s".charCodeAt(0),_t="a".charCodeAt(0);class pt{static getFormatter(t){let e=pt.Formatters[t];return e||(pt.Formatters[t]=e=new pt(t)),e}static get Default(){return pt.getFormatter(pt.DEFAULT_FORMAT)}constructor(t){t=t.trim(),this._options=t?this.$_parse(this._format=t):{useGrouping:!1}}get format(){return this._format}toStr(t){return t.toLocaleString(void 0,this._options)}$_parse(t){const e=t.length;if(e>0){const s={useGrouping:!1,minimumIntegerDigits:0,minimumFractionDigits:0,maximumFractionDigits:0};let i=t.indexOf(".");if(i>=0){let r=i+1;for(;r<e&&t.charCodeAt(r)===lt;)s.minimumFractionDigits++,r++;for(s.maximumFractionDigits=s.minimumFractionDigits;r<e&&t.charCodeAt(r)===ct;)s.maximumFractionDigits++,r++;i-=1}else i=e-1;let r=i;for(;r>=0&&t.charCodeAt(r)===lt;)s.minimumIntegerDigits++,r--;for(;r>=0;){if(t.charCodeAt(r--)===ut){s.useGrouping=!0;break}}for(r=i;r>=0;){if(t.charCodeAt(r--)===dt){s.signDisplay="always";break}}if(!s.signDisplay)for(r=i;r>=0;){if(t.charCodeAt(r--)===_t){s.signDisplay="never";break}}return s.minimumIntegerDigits=Math.max(1,s.minimumIntegerDigits),s}}}pt.DEFAULT_FORMAT="",pt.Formatters={};const gt="$_TH";class mt{get type(){return""}parse(t){return this.text=t,this._doParse(t),this}getText(t,e){const s=this._literals;if(s&&e){let i=this.text;for(let r=0;r<s.length;r+=3)i=i.replace(s[r],e(t,s[r+1]));return i}return this.text}prepareSpan(t,e,s){const i=this.getText(e,s);return t.textContent=i,t}_doParse(t){this._literals=[];let e=0;for(;e<t.length;){const s=t.indexOf("${",e);if(s<0)break;const i=t.indexOf("}",s+2);if(i<0)break;const r=t.substring(s,i+1),n=r.substring(2,r.length-1),a=n.indexOf(":");a>0?this._literals.push(r,n.substring(0,a),n.substr(a+1)):this._literals.push(r,n,""),e=i+1}return 0==this._literals.length&&(this._literals=null),this}}class yt extends mt{prepareSpan(t,e,s){const i=this.getText(e,s),r=i.indexOf(">")+1,n=i.indexOf("<",r);return this._doPrepare(t,i,r,n),t}_doPrepare(t,e,s,i){t.textContent=e.substring(s,i);const r=e.indexOf("style=");if(r>0&&r<s){const i=e[r+6],n=e.indexOf(i,r+7);n>0&&n<s&&t.setAttribute("style",e.substring(r+7,n))}}}const xt={t:class extends yt{get type(){return"t"}},b:class extends yt{get type(){return"b"}_doPrepare(t,e,s,i){super._doPrepare(t,e,s,i),t.setAttribute("class","rct-text-bold")}},i:class extends yt{get type(){return"i"}_doPrepare(t,e,s,i){super._doPrepare(t,e,s,i),t.setAttribute("class","rct-text-italic")}}};class ft{get words(){return this._words.slice()}parse(t){function e(t){const e=s.length;e>0&&""===s[e-1].type?s[e-1].text+=t:s.push((new mt).parse(t))}const s=this._words=[];let i=0;for(;i<t.length;){const s=t[i],r=t[i+1];if("<"==s){let s;if(r in xt){const e=t.indexOf(">",i+2);if(e>=0){const n="</"+r+">",a=t.indexOf(n,e+1);if(a>=0){const e=t.substring(i,a+n.length);s=(new xt[r]).parse(e),i+=e.length}}}if(!s){e(t.substring(i));break}this._words.push(s)}else{const s=t.indexOf("<",i+1);if(!(s>=0)){e(t.substring(i));break}e(t.substring(i,s)),i=s}}return this}getText(t,e){let s="";for(let i of this._words)s+=i.getText(t,e);return s}}class wt{constructor(t){this.lineHeight=1,this.format=t}get format(){return this._format}set format(t){t!==this._format&&(this._format=t,t&&this.$_parse(t))}get lines(){return this._lines.slice()}build(t,e,s){const i=t.doc,r=c(this.lineHeight,1);let n=0;const a=this._lines,h=a.length,o=[];t.clearDom(),e=e||t;for(let l=0;l<h;l++){const h=a[l];let c=0,u=null;for(let r of h.words){const n=r.prepareSpan(t.appendElement(i,"tspan"),e,s),a=n.getBBox();n.$_TW=a.width,c=Math.max(c,n[gt]=a.height),u||(u=n)}o.push(u),h[gt]=c*r,n=Math.max(c,n)}for(let e=1;e<o.length;e++){const s=t.insertElement(i,"tspan",o[e]),r=Math.ceil(t.getAscent(this._lines[e][gt]));s.setAttribute("x","0"),s.setAttribute("dy",r),s.innerHTML="&#8203;"}t.layoutText(n)}$_parse(t){const e=this._lines=[];if(t){const s=t.split(/<br.*?>|\r\n|\n/);for(let t of s)e.push((new ft).parse(t))}}}class bt extends s{constructor(t,e=!0){super(),this.chart=t,this._visible=e}get visible(){return this._visible}set visible(t){var e;t!==this._visible&&(this._visible=t,null===(e=this.chart)||void 0===e||e._visibleChanged(this))}load(t){return this._doLoadSimple(t)||this._doLoad(t),this}prepareRender(){this._doPrepareRender(this.chart)}_changed(){var t;null===(t=this.chart)||void 0===t||t._modelChanged(this)}_doLoadSimple(t){if("boolean"==typeof t)return this.visible=t,!0}_getDefObjProps(t){}_doLoad(t){for(const e in t){let s=t[e];this._doLoadProp(e,s)||(h(s)?this[e]=s.slice(0):this[e]instanceof bt?this[e].load(s):a(s)?this[e]=Object.assign({},this._getDefObjProps(e),s):this[e]=s)}}_doLoadProp(t,e){return!1}_doPrepareRender(t){}}var Pt,vt,Vt,St,At,Lt,Et,Nt;!function(t){t.NONE="none",t.OUTLINE="outline",t.BACKGROUND="background"}(Pt||(Pt={}));class Tt extends bt{constructor(){super(...arguments),this.effect=Pt.NONE,this.autoContrast=!0}}class Ct extends Tt{constructor(t,e){super(t,e),this.offset=2,this.numberSymbols="k,M,G,T,P,E",this.numberFormat="#,##0.#"}get numberSymbols(){return this._numberSymbols}set numberSymbols(t){t!==this._numberSymbols&&(this._numberSymbols=t,this._numSymbols=t&&t.split(","))}get numberFormat(){return this._numberFormat}set numberFormat(t){t!==this._numberFormat&&(this._numberFormat=t,this._numberFormatter=t?pt.getFormatter(t):null)}get text(){return this._text}set text(t){t!==this._text&&(this._text=t,t?(this._richTextImpl||(this._richTextImpl=new wt),this._richTextImpl.format=t):this._richTextImpl=null)}buildSvg(t,e,s){this._richTextImpl.build(t,e,s)}_doLoadSimple(t){return o(t)?(this.text=t,!0):super._doLoadSimple(t)}$_getNumberText(t,e,s){if(X.isValidNumber(t)){const i=this._numSymbols&&e&&X.scaleNumber(t,this._numSymbols,s);return this._numberFormatter?i?this._numberFormatter.toStr(i.value)+i.symbol:this._numberFormatter.toStr(t):i?i.value+i.symbol:String(t)}return"NaN"}_getText(t,e,s,i=!1){let r=t||this.$_getNumberText(e,s,i)||e;return this.prefix&&(r=this.prefix+r),this.suffix&&(r+=this.suffix),r}}class Mt extends bt{}class kt extends bt{constructor(t){super(t.chart),this.axis=t,this.showAlways=!0,this.showLabel=!0,this.visible=!1}}class Ot extends bt{constructor(t,e=!0){super(null==t?void 0:t.chart,e),this.axis=t}}class Bt extends Ot{constructor(t){super(t,!1)}}class Dt extends Ot{constructor(){super(...arguments),this.gap=5}isVisible(){return this.visible&&!A(this.text)}_doLoadSimple(t){if(o(t))return this.text=t,!0}}class Rt extends Ot{constructor(t){super(t,null),this.circular=!1,this.startVisible=!0,this.endVisible=!0}isVisible(){return null==this.visible?!this.axis._isX:this.visible}getPoints(t){const e=this.axis;return this.axis._ticks.map((s=>e.getPosition(t,s.value,!1)))}}class It extends Ct{constructor(t){super(t,!0),this.align=B.LEFT,this.valign=D.TOP}}!function(t){t.LINE="line",t.RANGE="range",t.AREA="area"}(vt||(vt={}));class $t extends Ot{constructor(t){super(t),this.front=!0,this.zindex=0,this.label=new It(t.chart)}}class Ft extends $t{}class zt extends $t{}class Ht extends Ot{constructor(t){super(t),this.length=7,this.margin=3}}!function(t){t.NONE="none",t.ROTATE="rotate",t.STEP="step",t.ROWS="rows"}(Vt||(Vt={}));class Gt extends Ct{constructor(t){super(t&&t.chart,!0),this.axis=t,this.step=0,this.startStep=0,this.rows=0,this.autoArrange=Vt.ROTATE,this.wrap=!1,this.numberFormat=null}getRotation(){return this.rotation||0}}!function(t){t.NORMAL="normal",t.OPPOSITE="opposite",t.BASE="base"}(St||(St={}));class jt extends bt{constructor(t,e){super(t),this.title=new Dt(this),this.line=new Bt(this),this.grid=this._createGrid(),this.guides=[],this.crosshair=new kt(this),this._series=[],this._minPad=0,this._maxPad=0,this._values=[],this.position=St.NORMAL,this.reversed=!1,this.marginNear=0,this.marginFar=0,this.name=e,this.tick=this._createTickModel(),this.label=this._createLabelModel()}isEmpty(){return this._series.length<1}getBaseValue(){return NaN}disconnect(){this._series=[],this._values=[]}collectValues(){this._series.forEach((t=>{t.collectValues(this,this._values)}))}collectReferentsValues(){this._series.forEach((t=>{t.pointValuesPrepared(this)}))}prepareRender(){this._isHorz=this.chart.isInverted()?!this._isX:this._isX,this._isOpposite=this.position===St.OPPOSITE,this._doPrepareRender();const t=this._series,e=this._values;this._range=this._doCalcluateRange(e);let s=0,i=0;t.forEach((t=>{t.clusterable()&&(s+=c(t.groupWidth,1))})),t.forEach((t=>{if(t.clusterable()){const e=c(t.groupWidth,1)/s;t.setCluster(e,i),i+=e}}))}buildTicks(t){this._ticks=this._doBuildTicks(this._range.min,this._range.max,this._length=t)}calcPoints(t,e){this._ticks.forEach((e=>e.pos=this.getPosition(t,e.value)))}getLabelLength(t,e){return this.getUnitLength(t,e)}getValue(t){return null==t?NaN:parseFloat(t)}parseValue(t){return parseFloat(t)}contains(t){return t>=this._range.min&&t<=this._range.max}_doLoadProp(t,e){if("guide"===t)return h(e)?this.$_loadGuides(e):a(e)&&this.$_loadGuides([e]),!0}_createGrid(){return new Rt(this)}$_loadGuides(t){for(let e=0;e<t.length;e++){const s=t[e];let i;if("range"===s.type)i=new zt(this);else i=new Ft(this);i.load(s),this.guides.push(i)}}_connect(t){t&&!this._series.includes(t)&&this._series.push(t)}_doCalcluateRange(t){return{min:P(Math.min(...t)||0),max:P(Math.max(...t)||0)}}}class Ut{constructor(t,e){this._items=[],this._map=new Map,this.chart=t,this.isX=e}get count(){return this._items.length}get first(){return this._items[0]}get items(){return this._items.slice(0)}load(t){const e=this.chart,s=this._items;h(t)?t.forEach(((t,i)=>s.push(this.$_loadAxis(e,t,i)))):a(t)&&s.push(this.$_loadAxis(e,t,0))}contains(t){return this._items.indexOf(t)>=0}get(t){return this._map.get(t)}disconnect(){this._items.forEach((t=>t.disconnect()))}collectValues(){this._items.forEach((t=>t.collectValues()))}collectReferentsValues(){this._items.forEach((t=>t.collectReferentsValues()))}prepareRender(){this._items.forEach((t=>t.prepareRender()))}buildTicks(t){this._items.forEach((e=>e.buildTicks(t)))}connect(t){const e=this._items,s=this.isX?t.xAxis:t.yAxis;let i;return l(s)&&s>=0&&e.length?i=e[s]:o(s)&&(i=e.find((t=>t.name===s))),i||(i=e[0]),i&&i._connect(t),i}forEach(t){for(let e=0,s=this._items.length;e<s&&!0!==t(this._items[e],e);e++);}$_loadAxis(t,e,s){let i=t._getAxisType(e.type);if(!i){let r;if(h(e.categories))r="category";else if(this.isX){for(const i of t._getSeries().items())if(i.canCategorized()){if(e.name&&i.xAxis===e.name){r="category";break}if(l(i.xAxis)&&i.xAxis===s){r="category";break}}!r&&t.first.canCategorized()&&(r="category")}else r=t._getSeries().first.defaultYAxisType();r&&(i=t._getAxisType(r))}i||(i=t._getAxisType("linear"));const r=new i(t,e.name);return r._isX=this.isX,r.load(e),r}}class Wt extends bt{constructor(){super(...arguments),this._guides=[],this._frontGuides=[],this.size="90%",this.centerX="50%",this.centerY="50%",this.startAngle=0,this.circular=!0,this.image=new Mt(null)}getSize(t,e){return T(this._sizeDim,Math.min(t,e))}getCenter(t,e){return{cx:T(this._cxDim,t),cy:T(this._cyDim,e)}}getStartAngle(){return f+V(this.startAngle)}getPolar(t){return this.chart._polar?{start:this.getStartAngle(),cx:this._cx,cy:this._cy,rd:this._rd,deg:2*Math.PI/t._visPoints.length}:y}_doLoad(t){super._doLoad(t),this._sizeDim=E(this.size,!0)||{size:90,fixed:!1},this._cxDim=E(this.centerX,!0)||{size:50,fixed:!1},this._cyDim=E(this.centerY,!0)||{size:50,fixed:!1}}_doPrepareRender(t){super._doPrepareRender(t);const e=this._guides=[],s=this._frontGuides=[];t._getXAxes().forEach((t=>{t.guides.forEach((t=>{t.front?s.push(t):e.push(t)}))}))}}class qt extends bt{constructor(t,e){super(t.chart),this.legend=t,this.source=e}text(){return this.source.legendLabel()}}!function(t){t.BOTTOM="bottom",t.TOP="top",t.RIGHT="right",t.LEFT="left",t.PLOT="plot",t.SUBPLOT="subplot"}(At||(At={})),function(t){t.CHART="chart",t.PLOT="plot"}(Lt||(Lt={})),function(t){t.AUTO="auto",t.HORIZONTAL="horizontal",t.VERTICAL="vertical"}(Et||(Et={}));class Yt extends bt{constructor(t){super(t,void 0),this.position=At.BOTTOM,this.layout=Et.AUTO,this.alignBase=Lt.PLOT,this.itemGap=8,this.markerGap=4,this.visible=void 0}items(){return this._items.slice(0)}isEmpty(){return!this._items||this._items.length<1}isVisible(){return this.visible||!1!==this.visible&&this._items.length>1}getLayout(){if(this.layout!==Et.AUTO||this.position===At.PLOT)return this.layout;switch(this.position){case At.BOTTOM:case At.TOP:return Et.HORIZONTAL;default:return Et.VERTICAL}}prepareRender(){this._items=this.$_collectItems()}$_collectItems(){return this.chart._getLegendSources().map((t=>new qt(this,t)))}}!function(t){t.DEFAULT="default",t.SPLINE="spline",t.STEP="step"}(Nt||(Nt={}));let Xt=0;class Kt{static swap(t){const e=[];for(let s=0;s<t.length;s++)e.push({xPos:t[s].yPos,yPos:t[s].xPos});return e}constructor(t){this.pid=Xt++,this.visible=!0,this.getValueOf=(t,e)=>this[e]||this.source[e],this.source=t}get yAbs(){return Math.abs(this.yValue)}get xAbs(){return Math.abs(this.xValue)}ariaHint(){return this.x+", "+this.yValue}labelCount(){return 1}getProp(t){return null==(e=this.source)||isNaN(e)?this.source:this.source[t];var e}parse(t){const e=this.source;h(e)?this._readArray(t,e):a(e)?this._readObject(t,e):this._readSingle(e)}getLabel(t){return this.y}swap(){const t=this.xPos;this.xPos=this.yPos,this.yPos=t}_colorIndex(){return 2}_readArray(t,e){if(null==e)this.isNull=!0;else{const s=+t.colorField;isNaN(s)||(this.color=e[s]),e.length>1?(this.x=e[c(t.xField,0)],this.y=e[c(t.yField,1)]):(this.x=this.index,this.y=e[c(t.yField,0)])}}_readObject(t,e){var s,i,r,n;null==e?this.isNull=!0:(this.x=(s=e[t.xField],i=e.x,r=e.name,n=e.label,void 0!==s?s:void 0!==i?i:null!=r?r:n),this.y=_(e[t.yField],e.y,e.value),this.color=d(e[t.colorField],e.color))}_readSingle(t){this.y=t}}class Qt{constructor(t){this._points=[],this._owner=t}get count(){return this._points.length}isEmpty(){return this._points.length<1}get(t){return this._points[t]}load(t){h(t)?(t=t.sort(((t,e)=>(h(t)||a(t)?1:0)-(h(e)||a(e)?1:0))),this._points=this._owner.createPoints(t)):this._points=[]}getProps(t){return this._points.map((e=>e.getProp(t)))}getValues(t){return this._points.map((e=>e[t]))}forEach(t){for(let e=0,s=this._points.length;e<s&&!0!==t(this._points[e],e);e++);}getPoints(){return this._points}getVisibles(){return this._points}}class Zt extends bt{constructor(t){super(t.chart),this.series=t,this.text="<b>${point.x}</b><br>${series}:<b> ${point.y}</b>",this.offset=8,this.hideDelay=Zt.HIDE_DELAY,this.minWidth=100,this.minHeight=40}getValue(t,e){switch(e){case"series":case"series.name":return this.series.displayName();case"point.x":return t.x;case"point":case"point.y":return t.y;default:return e}}}var Jt,te,ee;Zt.HIDE_DELAY=700,function(t){t.DEFAULT="default",t.POINT="point",t.EDGE="edge"}(Jt||(Jt={}));class se extends Ht{constructor(){super(...arguments),this.position=Jt.POINT,this.steps=1,this.showLast=!1}getPosition(){return this.position===Jt.POINT||this.position===Jt.EDGE?this.position:this.axis._isX?Jt.POINT:Jt.EDGE}}class ie extends Gt{getTick(t){return null!=t?this._getText(t,t,!1):""}}class re extends Rt{getPoints(){const t=this.axis._pts,e=this.axis._ticks.length,s=[];for(let i=0;i<e;i++)s.push(t[i+2]);return s}}class ne extends jt{constructor(){super(...arguments),this._map=new Map,this._catPad=0,this.padding=0,this.categoryPadding=.1}getCategories(){return this._cats}getWdith(t,e){return 0}axisMin(){return this._min}axisMax(){return this._max}categoryPad(){return this._catPad}type(){return"category"}_createGrid(){return new re(this)}_createTickModel(){return new se(this)}_createLabelModel(){return new ie(this)}_doPrepareRender(){this._cats=[],this._weights=[],this._collectCategories(this._series),this._minPad=u(this.minPadding,this.padding,0),this._maxPad=u(this.maxPadding,this.padding,0),this._catPad=c(this.categoryPadding,0)}_doBuildTicks(t,e,s){this.tick;const i=this.label;let r=this._cats=this._categories.map((t=>t.c)),n=this._weights=this._categories.map((t=>t.w));const a=[];for(t=this._min=Math.floor(t),e=this._max=Math.ceil(e);r.length<=e;)r.push(String(r.length)),n.push(1);r=this._cats=r.slice(t,e+1),n=n.slice(t,e+1);const h=this._len=this._minPad+this._maxPad+n.reduce(((t,e)=>t+e),0),o=this._pts=[0];let l=this._minPad;for(let s=t;s<=e;s++)n[s-t],o.push(l/h),l+=n[s-t];o.push(l/h),o.push((l+this._maxPad)/h),this._map.clear();for(let e=1;e<o.length-2;e++){const s=t+e-1;a.push({pos:NaN,value:s,label:i.getTick(r[e-1])}),this._map.set(r[e-1],s)}return a}calcPoints(t,e){super.calcPoints(t,e);const s=this._pts;if(e>0)for(let t=0;t<s.length;t++)s[t]/=this._length;this._length=t;for(let e=0;e<s.length;e++)s[e]*=t;let i;i=this.tick.getPosition()===Jt.EDGE?s.slice(1,s.length-1):this._ticks.map((t=>t.pos)),this._markPoints=i}getPosition(t,e,s=!0){e-=this._min,s&&(e+=.5);const i=Math.floor(e),r=this._pts[i+1]+(this._pts[i+2]-this._pts[i+1])*(e-i);return this.reversed?t-r:r}getUnitLength(t,e){const s=Math.floor(e-this._min);return this._pts[s+2]-this._pts[s+1]}getValue(t){return l(t)?t:this._map.get(t)}_collectCategories(t){const e=this.categories,s=this._categories=[];if(h(e)&&e.length>0)this._len=0,e.forEach((t=>{let e,i=null==t?1:c(t.weight,1);e=null==t?null:o(t)?t:t.name||t.label,this._len+=i,s.push({c:e,w:i})}));else if(h(t))for(const e of t){const t=e.collectCategories(this);for(const e of t)s.find((t=>t.c===e))||s.push({c:e,w:1})}}}!function(t){t.AUTO="auto",t.INSIDE="inside",t.OUTSIDE="outside",t.HEAD="head",t.FOOT="foot",t.INSIDE_FIRST="insideFirst",t.OUTSIDE_FIRST="outsideFirst"}(te||(te={}));class ae extends Ct{constructor(t){super(t,!1),this.position=te.AUTO,this.offset=4}getText(t){if(X.isValidNumber(t)){return this._getText(null,t,Math.abs(t)>1e3,!0)}return t}}!function(t){t.LINEAR="linear",t.LOGARITHMIC="logarithmic",t.POLYNOMIAL="polynomial",t.POWER="power",t.EXPONENTIAL="exponential",t.MOVING_AVERAGE="movingAverage"}(ee||(ee={}));class he{}const oe={interval:5,type:"simple"};class le extends bt{constructor(t){super(t.chart),this.series=t,this.type=ee.LINEAR,this.lineType=Nt.DEFAULT,this.movingAverage=new he,this.visible=!1}_doPrepareRender(t){(this["$_"+this.type]||this.$_linear).call(this,this.series._visPoints,this._points=[])}_getDefObjProps(t){if("movingAverage"===t)return oe}$_linear(t,e){const s=t.length;if(s>1){let i=0,r=0,n=0,a=0,h=0;t.forEach((t=>{i+=t.xValue,r+=t.yValue,n+=t.xValue*t.xValue,a+=t.yValue+t.yValue,h+=t.xValue*t.yValue}));const o=(s*h-i*r)/(s*n-i*i),l=(r-o*i)/s;e.push({x:t[0].xValue,y:o*t[0].xValue+l}),e.push({x:t[s-1].xValue,y:o*t[s-1].xValue+l})}}$_logarithmic(t,e){}$_polynomial(t,e){}$_power(t,e){}$_exponential(t,e){}$_movingAverage(t,e){const s=this.movingAverage,i=t.length,r=Math.max(1,Math.min(i,s.interval));let n=r-1;for(;n<=i;){n+=1;const s=t.slice(n-r,n).reduce(((t,e)=>t+e.yValue),0);n<=i&&e.push({x:t[n-1].xValue,y:s/r})}}}class ce extends bt{static _loadSeries(t,e,s){let i=t._getSeriesType(e.type);i||(i=t._getSeriesType(s||t.type));const r=new i(t,e.name);return r.load(e),r}constructor(t,e){super(t),this.index=-1,this.zOrder=0,this.clipped=!1,this.name=e,this.pointLabel=new ae(t),this.trendline=new le(this),this.tooltip=new Zt(this),this._points=new Qt(this)}getPoints(){return this._points}getLabeledPoints(){return this._points.getPoints()}getVisiblePoints(){return this._points.getVisibles()}isEmpty(){return this._points.isEmpty()}needAxes(){return!0}canCategorized(){return!1}defaultYAxisType(){return"linear"}clusterable(){return!1}displayName(){return this.label||this.name}legendColor(){return this.color}legendLabel(){return this.label||this.name}legendVisible(){return this.visible}ignoreAxisBase(t){return!1}canMixWith(t){return!0}getBaseValue(t){return NaN}canMinPadding(t){return!0}canMaxPadding(t){return!0}_createPoint(t){return new Kt(t)}createPoints(t){return t.map(((t,e)=>{const s=this._createPoint(t);return s.index=e,s.parse(this),s.isNull||(s.isNull=null==t||null==s.y),s}))}getXStart(){let t=this._xAxisObj.parseValue(this.xStart);return isNaN(t)?this._xAxisObj.parseValue(this.chart.xStart):t}getXStep(){return c(this.xStep,this.chart.xStep)}getValue(t,e){const s=t.source;if(null==s)return NaN;s[this._getField(e)]}prepareRender(){this._xAxisObj=this.group?this.group._xAxisObj:this.chart._connectSeries(this,!0),this._yAxisObj=this.group?this.group._yAxisObj:this.chart._connectSeries(this,!1),this._visPoints=this._points.getVisibles(),this._doPrepareRender()}collectCategories(t){if(t instanceof ne){let e=t.categoryField;return null!=e?this._points.getProps(e):this._points.getValues(t===this._xAxisObj?"x":"y").filter((t=>o(t)))}}collectValues(t,e){if(t===this._xAxisObj){let s=this.getXStart()||0;const i=this.getXStep()||1;this._visPoints.forEach(((r,n)=>{let a=t.getValue(r.x);isNaN(a)&&(a=s,s+=i),isNaN(a)?r.isNull=!0:(r.xValue=a,e&&e.push(a))}))}else this._visPoints.forEach(((s,i)=>{if(s.isNull)s.y=s.yGroup=NaN;else{let i=null==s.y?NaN:t.getValue(s.y);isNaN(i)?s.yGroup=0:(s.yGroup=s.yValue=i,e&&e.push(i)),s.isNull=isNaN(s.yValue)}})),e&&(this._minValue=Math.min(...e),this._maxValue=Math.max(...e))}pointValuesPrepared(t){this._referents&&this._referents.forEach((e=>e.reference(this,t)))}reference(t,e){}isVisible(t){return this._xAxisObj.contains(t.x)&&this._yAxisObj.contains(t.y)}getLegendSources(t){t.push(this)}getLabelPosition(t){return t}getLabelOff(t){return t}referBy(t){t&&(this._referents?this._referents.indexOf(t)<0&&this._referents.push(t):this._referents=[t])}_referOtherSeries(t){return!0}_getField(t){return t===this._xAxisObj?this.xField:this.yField}_colorByPoint(){return!1}_doLoad(t){super._doLoad(t);const e=t[this.dataProp||"data"];h(e)&&e.length>0&&this._doLoadPoints(e)}_doLoadPoints(t){this._points.load(t)}_doPrepareRender(){let t,e;!1===this.pointColors?t=this.color:h(this.pointColors)?e=this.pointColors:this._colorByPoint()?e=this.chart.colors:t=this.color,this._visPoints.forEach(((s,i)=>{s.color||(s.color=t||e[i%e.length])}))}prepareAfter(){this.trendline.visible&&this.trendline.prepareRender()}}class ue{constructor(t){this._map={},this._items=[],this._visibles=[],this._series=[],this._visibleSeries=[],this.chart=t}get first(){return this._items[0]}get firstSeries(){return this._series[0]}get firstVisible(){return this._visibles[0]}get firstVisibleSeries(){return this._visibleSeries[0]}isEmpty(){return!this._items.find((t=>!t.isEmpty()))}items(){return this._items.slice(0)}visibles(){return this._visibles.slice(0)}series(){return this._series.slice(0)}visibleSeries(){return this._visibleSeries.slice(0)}needAxes(){return!!this._visibles.find((t=>t.needAxes()))||0===this._visibleSeries.length}get(t){return this._map[t]}getLegendSources(){const t=[];return this._items.forEach((e=>e.getLegendSources(t))),t}load(t){const e=this.chart,s=this._items=[],i=this._series=[],r=this._map={};h(t)?t.forEach(((t,i)=>{s.push(this.$_loadItem(e,t,i))})):a(t)&&s.push(this.$_loadItem(e,t,0)),s.forEach(((t,e)=>{t.index=e,t instanceof Pe?i.push(...t.series):t instanceof ce&&i.push(t)})),i.forEach((t=>{t.name&&(r[t.name]=t);for(const e of this._series)if(e!==t){if(!t.canMixWith(e))throw new Error("동시에 표시할 수 없는 시리즈들입니다: "+t._type()+", "+e._type());if(t._referOtherSeries(e))break}}))}prepareRender(){const t=this.chart.colors;this._visibleSeries=this._series.filter((t=>t.visible));const e=this._visibleSeries.filter((t=>t.clusterable())).length;this._visibleSeries.forEach(((s,i)=>{s.color=s.color||t[i++%t.length],s instanceof fe&&(s._single=1===e)})),this._visibles=this._items.filter((t=>t.visible)),this._visibles.forEach((t=>t.prepareRender()))}prepareAfter(){this._visibles.forEach((t=>t.prepareAfter()))}$_loadItem(t,e,s){let i=e.series&&(t._getGroupType(e.type)||t._getGroupType(t.type));if(i){const s=new i(t);return s.load(e),s}i=t._getSeriesType(e.type)||t._getSeriesType(t.type);const r=new i(t,e.name||`Series ${s+1}`);return r.load(e),r.index=s,r}}var de,_e,pe,ge;!function(t){t.DEFAULT="default",t.VISIBLE="visible",t.HIDDEN="hidden"}(de||(de={}));class me extends bt{constructor(t){super(t.chart),this.series=t,this.radius=3}}class ye extends ce{needAxes(){return!1}}class xe extends ye{constructor(){super(...arguments),this.startAngle=0,this.centerX=0,this.centerY=0}getSize(t,e){return T(this._sizeDim,Math.min(t,e))}_doLoad(t){super._doLoad(t),this._sizeDim=E(this.size,!0)||{size:80,fixed:!1}}}class fe extends ce{constructor(){super(...arguments),this._clusterWidth=1,this._clusterPos=0,this._childWidth=1,this._childPos=0,this._pointPad=0,this.groupWidth=1,this.pointWidth=1}getPointWidth(t){const e=this.group;let s=t;return e?(s*=e._clusterWidth,s*=1-2*e.groupPadding,s*=this._childWidth):s*=this._clusterWidth,s*=1-2*this._pointPad,s}getPointPos(t){const e=this.group;let s=t,i=0;return e?(i=s*e._clusterPos,s*=e._clusterWidth,i+=s*e.groupPadding,s-=s*e.groupPadding*2,i+=s*this._childPos,s*=this._childWidth):(i=s*this._clusterPos,s*=this._clusterWidth),i+=s*this._pointPad,i}getLabelPosition(t){return t===te.AUTO?te.OUTSIDE_FIRST:t}clusterable(){return!0}setCluster(t,e){this._clusterWidth=t,this._clusterPos=e}_doPrepareRender(){super._doPrepareRender(),this._pointPad=isNaN(this.pointPadding)?this._single?.25:this.group?.1:.2:this.pointPadding}}class we extends fe{constructor(){super(...arguments),this.baseValue=0,this.nullAsBase=!1}_doPrepareRender(){super._doPrepareRender(),this._base=c(this._getGroupBase(),this._yAxisObj.getBaseValue())}getBaseValue(t){return t===this._yAxisObj?this._base:NaN}_getGroupBase(){return this.baseValue}}class be extends fe{collectValues(t,e){super.collectValues(t,e),t===this._yAxisObj&&this._visPoints.forEach((t=>{const s=this._getBottomValue(t);e&&!isNaN(s)&&e.push(s)}))}}!function(t){t.DEFAULT="default",t.OVERLAP="overlap",t.STACK="stack",t.FILL="fill"}(_e||(_e={}));class Pe extends bt{constructor(){super(...arguments),this.layoutMax=100,this.index=-1,this._series=[],this._visibles=[],this.layout=_e.DEFAULT}get series(){return this._series.slice(0)}needAxes(){return!0}isEmpty(){return this._series.length<1}canCategorized(){return!0}defaultYAxisType(){return"linear"}clusterable(){return!1}getBaseValue(t){return NaN}_type(){return this._seriesType()}collectValues(t,e){if(this._visibles.length>0)if(t===this._visibles[0]._yAxisObj)switch(this.layout){case _e.STACK:this.$_collectStack(t,e);break;case _e.FILL:this.$_collectFill(t,e);break;case _e.DEFAULT:case _e.OVERLAP:this.$_collectValues(t,e)}else this.$_collectValues(t,e)}pointValuesPrepared(t){this._series.forEach((e=>e.pointValuesPrepared(t)))}collectCategories(t){let e=[];return this._visibles.forEach((s=>e=e.concat(s.collectCategories(t)))),e}ignoreAxisBase(t){for(const e of this._visibles)if(e.ignoreAxisBase(t))return!0}getLegendSources(t){t.push(...this._series)}canMinPadding(t){return!0}canMaxPadding(t){return this.layout!==_e.FILL}getVisiblePoints(){const t=[];return this._visibles.forEach((e=>t.push(...e.getVisiblePoints()))),t}_doLoadProp(t,e){if("series"===t)return this.$_loadSeries(this.chart,e),!0}prepareRender(){this._visibles=this._series.filter((t=>t.visible)),super.prepareRender()}_doPrepareRender(t){const e=this._visibles.sort(((t,e)=>(t.zOrder||0)-(e.zOrder||0)));this._xAxisObj=this.chart._connectSeries(this,!0),this._yAxisObj=this.chart._connectSeries(this,!1),e.length>0&&(e.forEach((t=>t.prepareRender())),this._doPrepareSeries(e))}prepareAfter(){this._visibles.forEach((t=>t.prepareAfter()))}_doPrepareSeries(t){}$_loadSeries(t,e){const s=this._seriesType();h(e)?e.forEach(((e,i)=>this.$_add(ce._loadSeries(t,e,s)))):a(e)&&this.$_add(ce._loadSeries(t,e,s))}$_add(t){if(!this._canContain(t))throw new Error("이 그룹에 포함될 수 없는 시리즈입니다: "+t);this._series.push(t),t.group=this,t.index=this._series.length-1}$_collectValues(t,e){this._visibles.forEach((s=>{s.collectValues(t,e)}))}$_collectPoints(t){const e=this._visibles,s=this._stackPoints=new Map;e.forEach((e=>{e.collectValues(t,null)})),e[0]._visPoints.forEach((t=>{s.set(t.xValue,[t])}));for(let t=1;t<e.length;t++)e[t]._visPoints.forEach((t=>{const e=s.get(t.xValue);e?e.push(t):s.set(t.xValue,[t])}));return s}$_collectStack(t,e){const s=this.getBaseValue(t),i=this.$_collectPoints(t);if(isNaN(s))for(const t of i.values()){t[0].yGroup=t[0].yValue||0;for(let e=1;e<t.length;e++)t[e].yGroup=t[e-1].yGroup+(t[e].yValue||0);e.push(t[t.length-1].yGroup)}else for(const t of i.values()){let i=t[0].yValue||0,r=i>=s?0:-1,n=i<s?0:-1;t[0].yGroup=t[0].yValue||0;for(let e=1;e<t.length;e++)i=t[e].yValue||0,i>=s?(r>=0&&(t[e].yGroup=t[r].yGroup+i),r=e):(n>=0&&(t[e].yGroup=t[n].yGroup+i),n=e);r>=0&&e.push(t[r].yGroup),n>=0&&e.push(t[n].yGroup)}}$_collectFill(t,e){const s=this.getBaseValue(t),i=this.layoutMax||100,r=this.$_collectPoints(t);if(isNaN(s))for(const t of r.values()){let s=0;for(const e of t)s+=e.yValue||0;let r=0;for(const e of t)r=e.yGroup=(e.yValue||0)/s*i+r;e.push(i)}else for(const t of r.values()){let r=0;for(const e of t)r+=Math.abs(e.yValue)||0;let n=0,a=0;for(const e of t)e.yValue=(e.yValue||0)/r*i,e.yValue<s?a=e.yGroup=(e.yValue||0)+a:n=e.yGroup=(e.yValue||0)+n;e.push(a,n)}}}class ve extends Pe{collectValues(t,e){if(super.collectValues(t,e),t===this._yAxisObj){const t=this._doConstraintYValues(this._visibles);e.length=0,e.push(...t)}}}class Ve extends Pe{constructor(){super(...arguments),this._clusterWidth=1,this._clusterPos=0,this.groupWidth=1,this.groupPadding=.1}}class Se extends bt{constructor(){super(...arguments),this.text="Title",this.align=B.CENTER}isVisible(){return this.visible&&!A(this.text)}_doLoadSimple(t){if(o(t))return this.text=t,!0}}!function(t){t.BOTTOM="bottom",t.RIGHT="right",t.LEFT="left",t.TOP="top"}(pe||(pe={}));class Ae extends Se{constructor(){super(...arguments),this.position=pe.BOTTOM,this.valign=D.BOTTOM,this.text=""}}class Le extends Ht{constructor(){super(...arguments),this.stepPixels=72,this.integral=!1}buildSteps(t,e,s,i){let r;return r=Array.isArray(this.steps)?this.steps.slice(0):this.stepCount>0?this._getStepsByCount(this.stepCount,e,s,i):this.stepSize>0?this._getStepsBySize(this.stepSize,e,s,i):this.stepPixels>0?this._getStepsByPixels(t,this.stepPixels,e,s,i):[s,i],r}_getStepsByCount(t,e,s,i){s>e?(s=e,e=NaN):i<e&&(i=e,e=NaN),isNaN(e)&&this.integral;let r=(i-s)/(t-1);const n=Math.pow(10,Math.floor(Math.log10(r))),a=[];if(r=this._step=Math.ceil(r/n)*n,isNaN(e))s>Math.floor(s/n)*n?s=Math.floor(s/n)*n:s<Math.ceil(s/n)*n&&(s=Math.ceil(s/n)*n);else{for(M(s<e&&i>e,"base error"),t=Math.max(3,t);;){if(!(b((e-s)/r)+b((i-e)/r)+1>t))break;r+=n}s=e-b((e-s)/r)*r}a.push(s);for(let e=1;e<t;e++)a.push(P(a[e-1]+r));return a}_getStepsBySize(t,e,s,i){const r=[];let n;if(isNaN(e))for(r.push(n=s);n<i;)r.push(n+=t);else{for(r.push(n=e);n>s;)r.unshift(n-=t);for(n=e;n<i;)r.push(n+=t)}return this._step=t,r}_getStepMultiples(t){return[1,2,2.5,5,10]}_getStepsByPixels(t,e,s,i,r){i>=s?i=s:r<=s&&(r=s);const n=r-i;if(0===n)return[];let a=Math.floor(t/this.stepPixels)+1,h=n/(a-1);const o=Math.pow(10,Math.floor(Math.log10(h))),l=this._getStepMultiples(h),c=[];let u;if(h/=o,l)if(h>l[0]){let t=0;for(;t<l.length-1;t++)if(h>l[t]&&h<l[t+1]){h=l[t+1];break}t>=l.length&&(h=l[l.length-1])}else h=l[0];if(h*=o,isNaN(s))i>Math.floor(i/h)*h?i=Math.floor(i/h)*h:i<Math.ceil(i/h)*h&&(i=Math.ceil(i/h)*h);else{for(M(i<=s&&r>=s,"base error"),a=Math.max(3,a);;){if(!(b((s-i)/h)+b((r-s)/h)+1>a))break;h+=o}i=s-b((s-i)/h)*h}for(this._step=h,c.push(P(u=i));u<r;)c.push(P(u+=h));return c}}class Ee extends Gt{constructor(){super(...arguments),this.useSymbols=!0}getTick(t){return this._getText(null,t,this.useSymbols&&this.axis.tick._step>100)}}class Ne extends Ot{constructor(){super(...arguments),this.enabled=!0,this.size="30%",this.space=12}getSize(t){return T(this._sizeDim,t)}_doLoad(t){super._doLoad(t),this.space=c(this.space,0),this._sizeDim=E(this.size,!1)}}!function(t){t.DEFAULT="default",t.TICK="tick",t.VALUE="value"}(ge||(ge={}));class Te extends jt{constructor(){super(...arguments),this.nullable=!0,this.padding=.05,this.startFit=ge.DEFAULT,this.endFit=ge.DEFAULT,this.breaks=[]}getBaseValue(){return this.baseValue}axisMin(){return this._min}axisMax(){return this._max}hasBreak(){return!!this._runBreaks}runBreaks(){return this._runBreaks&&this._runBreaks.slice(0)}getStartFit(){return this.startFit===ge.DEFAULT?this._isX?ge.VALUE:ge.TICK:this.startFit}getEndFit(){return this.endFit===ge.DEFAULT?this._isX?ge.VALUE:ge.TICK:this.endFit}contains(t){return!isNaN(t)}_createTickModel(){return new Le(this)}_createLabelModel(){return new Ee(this)}_doLoadProp(t,e){return"break"===t?(this.$_loadBreaks(e),!0):super._doLoadProp(t,e)}_doPrepareRender(){this._hardMin=this.min,this._hardMax=this.max,this._base=parseFloat(this.baseValue),this._unitLen=NaN}_doBuildTicks(t,e,s){const i=this.tick;let{min:r,max:n}=this._adjustMinMax(this._calcedMin=t,this._calcedMax=e),a=this._base;isNaN(a)&&r<0&&n>0&&(a=0);let h=i.buildSteps(s,a,r,n);const o=[];if(isNaN(this.strictMin)&&this.getStartFit()!==ge.VALUE?h.length>2&&h[1]<=r?h.slice(1):r=Math.min(r,h[0]):h.length>1&&r>h[0]&&(h=h.slice(1)),isNaN(this.strictMax)&&this.getEndFit()!==ge.VALUE?h.length>2&&h[h.length-2]>n?h.pop():n=Math.max(n,h[h.length-1]):n<h[h.length-1]&&h.length>1&&h.pop(),this._setMinMax(r,n),r!==n){this._runBreaks&&(h=this.$_getBrokenSteps(this._runBreaks,s,r,n));for(let t=0;t<h.length;t++){const e=this._createTick(s,h[t]);o.push(e)}}return o}_getTickLabel(t){return this.label.getTick(t)||String(t)}_createTick(t,e){return{pos:NaN,value:e,label:this._getTickLabel(e)}}calcPoints(t,e){super.calcPoints(t,e),this._markPoints=this._ticks.map((t=>t.pos))}$_buildBrokenSteps(t){return this.tick.buildSteps(t.len,void 0,t.from,t.to)}$_getBrokenSteps(t,e,s,i){let r=0,n=s;const a=[n],h=this._sects=[];e-=t.reduce(((t,e)=>t+e.space),0),t.forEach((t=>{const s=t.getSize(e),i={from:n,to:t.from,pos:r,len:s};r+=s,h.push(i,t._sect={from:t.from,to:t.to,pos:r,len:t.space}),r+=t.space;this.$_buildBrokenSteps(i).forEach((t=>{t>i.from&&t<=i.to&&a.push(t)})),t.space>0&&a.push(t.to)}));const o=t[t.length-1];if(i>o.to){const t={from:o.to,to:i,pos:r,len:this._length-r};h.push(t);this.$_buildBrokenSteps(t).forEach((e=>{e>t.from&&e<=t.to&&a.push(e)}))}return this._lastSect=h[h.length-1],a}getPosition(t,e){if(this._runBreaks){const s=this._sects.find((t=>e<t.to))||this._lastSect,i=s.len*(e-s.from)/(s.to-s.from);return(this.reversed?t-i:i)+s.pos}{const s=t*(e-this._min)/(this._max-this._min);return this.reversed?t-s:s}}getUnitLength(t,e){return isNaN(this._unitLen)&&(this._unitLen=this.$_calcUnitLength(t)),this._unitLen}getLabelLength(t,e){return Math.floor(t/this._ticks.length)}_adjustMinMax(t,e){this._minBased=this._maxBased=!1,this._series.forEach((s=>{const i=s.getBaseValue(this);isNaN(i)||(isNaN(this._hardMin)&&i<=t?(t=i,this._minBased=!0):isNaN(this._hardMax)&&i>=e&&(e=i,this._maxBased=!0)),this._minBased||s.canMinPadding(this)||(this._minBased=!0),this._maxBased||s.canMaxPadding(this)||(this._maxBased=!0)}));let s=0,i=0;isNaN(this.strictMin)?(this._hardMin<t&&(t=this._hardMin),this._minBased||(s=u(this.minPadding,this.padding,0))):t=this.strictMin,isNaN(this.strictMax)?(this._hardMax>e&&(e=this._hardMax),this._maxBased||(i=u(this.maxPadding,this.padding,0))):e=this.strictMax;let r=Math.max(0,e-t);return t-=r*(this._minPad=s),e+=r*(this._maxPad=i),{min:t,max:e}}_setMinMax(t,e){this._min=t,this._max=e}$_calcUnitLength(t){const e=[];this._series.forEach((t=>{t.visible&&t.clusterable()&&e.push(...t.getVisiblePoints())}));const s=this._isX,i=e.map((t=>s?t.xValue:t.yValue)).sort();let r=i[1]-i[0];for(let t=2;t<i.length;t++)r=Math.min(i[t]-i[t-1]);return t*=r/(this._max-this._min),this._unitLen=c(t,1)}$_loadBreak(t){if(a(t)&&"from"in t&&"to"in t)return new Ne(this).load(t)}$_loadBreaks(t){if(h(t))for(let e of t){const t=this.$_loadBreak(e);t&&this.breaks.push(t)}else if(t){const e=this.$_loadBreak(t);e&&this.breaks.push(e)}this.$_mergeBreaks()}$_mergeBreaks(){function t(t,e){t.to=e.to}const e=this.breaks.sort(((t,e)=>t.from-e.from)).filter((t=>t.to>t.from));if(this._runBreaks=null,e.length>0){const i=this._runBreaks=[];i.push(Object.assign(new Ne(this),e[0]));for(let r=1;r<e.length;r++){const n=i[i.length-1],a=e[r];s=n,a.from<s.to?t(n,a):i.push(Object.assign(new Ne(this),a))}}var s}}class Ce extends Te{type(){return"linear"}_adjustMinMax(t,e){const s=super._adjustMinMax(t,e),i=this._series;return 1===i.length&&i[0]instanceof Pe&&i[0].layout===_e.FILL&&(s.max=i[0].layoutMax),s}}class Me extends Le{}const ke=[1,1e3,6e4,36e5,864e5,6048e5,24192e5,314496e5],Oe=[[1,2,5,10,20,25,50,100,200,250,500],[1,2,5,10,15,30],[1,2,3,4,6,8,12],[1,2,3,4,6,12],[1,2],[1,2],[1,2,3,4,6]];class Be extends Le{_getStepMultiples(t){for(let e=0;e<7;e++)if(t>=ke[e]&&t<ke[e+1]/2)return this.scale=e,Oe[e];this.scale=7}buildSteps(t,e,s,i){return super.buildSteps(t,e,s,i)}_getStepsByPixels(t,e,s,i,r){const n=r-i;if(0===n)return[];const a=this.axis;let h=Math.floor(t/this.stepPixels)+1,o=Math.max(1,Math.floor(n/(h-1)));const l=this._getStepMultiples(o),c=ke[this.scale],u=[];if(o/=c,l)if(o>l[0]){let t=0;for(;t<l.length-1;t++)if(o>l[t]&&o<l[t+1]){o=l[t+1];break}t>=l.length&&(o=l[l.length-1])}else o=l[0];const d=a.date(i),_=a.date(r);let p,g=d;if(7===this.scale){let t=g.getFullYear();o=Math.ceil(o),g=new Date(t,0),g<d&&(t+=o,g=new Date(t,0));do{u.push(+g),t+=o,g=new Date(t,0)}while(g<=_)}else if(6===this.scale){let t=g.getFullYear(),e=g.getMonth();o=Math.ceil(o),g=new Date(t,e),g<d&&(e+=o,g=new Date(t,e));do{u.push(+g),e+=o,g=new Date(t,e)}while(g<=_)}else if(4===this.scale||5===this.scale){let t=g.getFullYear(),e=g.getMonth(),s=g.getDate();o=Math.ceil(o),g=new Date(t,e,s),g<d&&(s+=o,g=new Date(t,e,s));do{u.push(+g),s+=o*(5===this.scale?7:1),g=new Date(t,e,s)}while(g<=_)}else{switch(o*=c,this.scale){case 3:g.setMinutes(0);case 2:g.setSeconds(0);case 1:g.setMilliseconds(0)}p=g.getTime(),p<i&&(p+=o);do{u.push(p),p+=o}while(p<=r)}return u}}class De extends Te{constructor(t,e){super(t,e),this._offset=60*(new Date).getTimezoneOffset()*1e3,this.utc=!0,this.baseValue=NaN}type(){return"time"}_createTickModel(){return new Be(this)}_adjustMinMax(t,e){return super._adjustMinMax(t,e)}_doBuildTicks(t,e,s){const i=super._doBuildTicks(t,e,s);return i.forEach(((t,e)=>{t.label=this.$_getLabel(t.value,e)})),i}parseValue(t){return isNaN(t)?o(t)?new Date(t).getTime():void 0:+t}date(t){return new Date(t)}$_getLabel(t,e){const s=this.date(t);switch(this.tick.scale){case 7:return`${s.getFullYear()}`;case 6:return 0===e||0===s.getMonth()?`${s.getFullYear()}-${L(s.getMonth()+1)}`:`${s.getMonth()+1}`;case 5:case 4:return 0===e||1===s.getDate()?`${s.getMonth()+1}-${L(s.getDate())}`:`${s.getDate()}`;case 3:return 0===e||0===s.getHours()?`${s.getDate()} ${L(s.getHours())}:00`:`${L(s.getHours())}:00`;case 2:return`${s.getMinutes()}`;case 1:return`${s.getSeconds()}`;case 0:return String(t)}}}class Re extends Kt{labelCount(){return 2}getLabel(t){return 1===t?this.lowValue:this.yValue}_readArray(t,e){const s=e.length>2?1:0;this.low=e[c(t.lowField,0+s)],this.y=e[c(t.yField,1+s)],this.x=s>0?e[c(t.xField,0)]:this.index}_readObject(t,e){super._readObject(t,e),this.low=d(e[t.lowField],e.low),this.y=_(e[t.yField],e.y,e.value)}_readSingle(t){super._readSingle(t),this.low=this.y}parse(t){super.parse(t),this.lowValue=parseFloat(this.low)}}class Ie extends Kt{}class $e extends we{constructor(){super(...arguments),this.borderRaidus=0}_type(){return"bar"}canCategorized(){return!0}_createPoint(t){return new Ie(t)}_getGroupBase(){return this.group?this.group.baseValue:this.baseValue}}class Fe extends Kt{}class ze extends me{constructor(){super(...arguments),this.radius=4,this.firstVisible=de.DEFAULT,this.lastVisible=de.DEFAULT,this.minVisible=de.DEFAULT,this.maxVisible=de.DEFAULT}}class He extends ce{constructor(){super(...arguments),this.marker=new ze(this),this.nullAsBase=!1}_createPoint(t){return new Fe(t)}}var Ge,je,Ue;!function(t){t.FORWARD="forward",t.BACKWARD="backward"}(Ge||(Ge={}));class We extends He{constructor(){super(...arguments),this.lineType=Nt.DEFAULT,this.stepDir=Ge.FORWARD,this.connectNulls=!1,this.baseValue=0}_type(){return"line"}getLineType(){return this.lineType}}class qe extends Fe{}class Ye extends We{_type(){return"area"}_createPoint(t){return new qe(t)}_doPrepareRender(){super._doPrepareRender(),this._base=c(this.baseValue,this._yAxisObj.getBaseValue())}getBaseValue(t){return this._base}}class Xe extends qe{parse(t){super.parse(t),this.y=this.high=d(this.high,this.low),this.lowValue=parseFloat(this.low),this.highValue=this.yValue=parseFloat(this.high)}_readArray(t,e){const s=e.length>2?1:0;this.low=e[c(t.lowField,0+s)],this.high=e[c(t.highField,1+s)],this.x=s>0?e[c(t.xField,0)]:this.index}_readObject(t,e){super._readObject(t,e),this.low=d(e[t.lowField],e.low),this.high=d(e[t.lowField],e.high)}_readSingle(t){super._readSingle(t),this.low=this.y}}class Ke extends Fe{}class Qe extends Kt{labelCount(){return 2}getLabel(t){return 0===t?this.yValue:this.minValue}_readArray(t,e){const s=e.length>5?1:0;this.min=e[c(t.minField,0+s)],this.low=e[c(t.lowField,1+s)],this.mid=e[c(t.midField,2+s)],this.high=e[c(t.highField,3+s)],this.y=e[c(t.yField,4+s)],this.x=s>0?e[c(t.xField,0)]:this.index}_readObject(t,e){super._readObject(t,e),this.min=d(e[t.minField],e.min),this.low=d(e[t.lowField],e.low),this.mid=d(e[t.midField],e.mid),this.high=d(e[t.highField],e.high),this.y=_(e[t.yField],e.y,e.value)}_readSingle(t){super._readSingle(t),this.min=this.low=this.mid=this.high=this.y}parse(t){super.parse(t),this.minValue=parseFloat(this.min),this.lowValue=parseFloat(this.low),this.midValue=parseFloat(this.mid),this.highValue=parseFloat(this.high),this.isNull||(this.isNull=isNaN(this.minValue)||isNaN(this.lowValue)||isNaN(this.midValue)||isNaN(this.highValue))}}class Ze extends Kt{getLabel(t){return this.z}parse(t){super.parse(t),this.zValue=parseFloat(this.z)}_readArray(t,e){const s=e.length>2?1:0;this.y=e[c(t.yField,0+s)],this.z=e[c(t.zProp,1+s)],this.x=s>0?e[c(t.xField,0)]:this.index}_readObject(t,e){super._readObject(t,e),this.z=d(e[t.zProp],e.z)}_readSingle(t){super._readSingle(t),this.z=this.y}}class Je extends me{}!function(t){t.WIDTH="width",t.AREA="area"}(je||(je={}));class ts extends Kt{parse(t){super.parse(t),this.lowValue=parseFloat(this.low),this.openValue=parseFloat(this.open),this.closeValue=parseFloat(this.close),this.highValue=parseFloat(this.high),this.isNull||(this.isNull=isNaN(this.lowValue)||isNaN(this.openValue)||isNaN(this.closeValue))}_readArray(t,e){const s=e.length>4?1:0;this.low=e[c(t.lowField,0+s)],this.open=e[c(t.openField,1+s)],this.close=e[c(t.closeField,2+s)],this.y=this.high=e[c(t.highField,3+s)],this.x=s>0?e[c(t.xField,0)]:this.index}_readObject(t,e){super._readObject(t,e),this.low=d(e[t.lowField],e.row),this.open=d(e[t.openField],e.open),this.close=d(e[t.closeField],e.close),this.high=d(e[t.highField],e.high),isNaN(this.high)?isNaN(this.y)||(this.high=this.y):this.y=this.high}_readSingle(t){super._readSingle(t),this.low=this.close=this.open=this.high=this.y}}class es extends be{_type(){return"candlestick"}canCategorized(){return!0}_createPoint(t){return new ts(t)}_getBottomValue(t){return t.lowValue}}class ss extends me{constructor(){super(...arguments),this.radius=4,this.shape=J.CIRCLE}}class is extends Kt{labelCount(){return 2}getLabel(t){return 0===t?this.lowValue:this.yValue}_readArray(t,e){const s=e.length>2?1:0;this.low=e[c(t.lowField,0+s)],this.y=e[c(t.yField,1+s)],this.x=s>0?e[c(t.xField,0)]:this.index}_readObject(t,e){super._readObject(t,e),this.low=d(e[t.lowField],e.low),this.y=_(e[t.yField],e.y,e.value)}_readSingle(t){super._readSingle(t),this.low=this.y}parse(t){super.parse(t),this.lowValue=parseFloat(this.low)}}class rs extends Kt{}class ns extends Kt{labelCount(){return 2}getLabel(t){return 1===t?this.lowValue:this.yValue}_readArray(t,e){const s=e.length>2?1:0;this.low=e[c(t.lowField,0+s)],this.y=e[c(t.yField,1+s)],this.x=s>0?e[c(t.xField,0)]:this.index}_readObject(t,e){super._readObject(t,e),this.low=d(e[t.lowField],e.low),this.y=_(e[t.yField],e.y,e.value)}_readSingle(t){super._readSingle(t),this.low=this.y}parse(t){super.parse(t),this.lowValue=parseFloat(this.low),this.isNull||(this.isNull=isNaN(this.lowValue))}}class as extends Kt{}class hs extends ye{constructor(t,e){super(t,e),this.width=hs.DEF_WIDTH,this.height=hs.DEF_HEIGHT,this.neckWidth=hs.DEF_NECK_WIDTH,this.neckHeight=hs.DEF_NECK_WIDTH,this.reversed=!1}getSize(t,e){return{width:T(this._widthDim,t),height:T(this._heightDim,e)}}getNeckSize(t,e){return{width:T(this._neckWidthDim,t),height:T(this._neckHeightDim,e)}}_type(){return"funnel"}_colorByPoint(){return!0}_createPoint(t){return new as(t)}load(t){return super.load(t),this._widthDim=N(this.width,hs.DEF_WIDTH),this._heightDim=N(this.height,hs.DEF_HEIGHT),this._neckWidthDim=N(this.neckWidth,hs.DEF_NECK_WIDTH),this._neckHeightDim=N(this.neckHeight,hs.DEF_NECK_HEIGHT),this}prepareAfter(){super.prepareAfter();const t=this._visPoints;let e=0,s=0;t.forEach((t=>{e+=t.yValue}));const i=t.length;let r=0;for(;r<i-1;r++){const i=t[r],n=P(i.yValue/e);i.yRate=100*n,i.yPos=s,i.height=n,s+=n}t[r].yPos=s,t[r].height=1-s}}hs.DEF_WIDTH="85%",hs.DEF_HEIGHT="90%",hs.DEF_NECK_WIDTH="30%",hs.DEF_NECK_HEIGHT="25%";class os extends Kt{parse(t){super.parse(t),this.colorValue=parseFloat(this.color),this.isNull||(this.isNull=isNaN(this.colorValue))}_readArray(t,e){const s=e.length>2?1:0;this.y=e[c(t.yField,0+s)],this.color=e[c(t.colorField,1+s)],this.x=s>0?e[c(t.xField,0)]:this.index}_readObject(t,e){super._readObject(t,e),this.color=d(e[t.colorField],e.color)}_readSingle(t){super._readSingle(t)}getLabel(t){return this.color}}class ls extends Kt{parse(t){super.parse(t);const e=this.source;this.min=e.min,this.max=e.max}}!function(t){t.SQURE_ROOT="squreRoot",t.STURGES="struges",t.RICE="rice"}(Ue||(Ue={}));const cs={squreRoot:function(t){return Math.ceil(Math.sqrt(t))},struges:function(t){return Math.ceil(Math.log(t)*Math.LOG2E)},rice:function(t){return Math.ceil(2*Math.pow(t,1/3))}};class us extends me{constructor(){super(...arguments),this.radius=4,this.shape=J.CIRCLE}}class ds extends Kt{}class _s extends ts{}class ps extends Kt{parse(t){super.parse(t),this.xValue=this.x,this.yValue=this.y}}class gs extends Kt{constructor(){super(...arguments),this.sliced=!1,this.startAngle=0,this.angle=0}get endAngle(){return this.startAngle+this.angle}legendColor(){return this.color}legendLabel(){return this.x}legendVisible(){return this.visible}parse(t){super.parse(t),this.sliced=this.source.sliced}}class ms extends xe{constructor(){super(...arguments),this.groupSize=1,this.innerSize=0,this.sliceOffset="7%",this.labelDistance=25,this.exclusive=!0,this.sliceDuration=300,this.borderRadius=0}getInnerRadius(t){const e=this._innerDim;return e?e.size/(e.fixed?t:100):0}getSliceOffset(t){return this._sliceDim?T(this._sliceDim,t):0}getLabelPosition(){const t=this.pointLabel.position;return t===te.AUTO?te.INSIDE:t}_type(){return"pie"}_colorByPoint(){return!0}_createPoint(t){return new gs(t)}getLegendSources(t){this._visPoints.forEach((e=>{t.push(e)}))}_doLoad(t){super._doLoad(t),this._innerDim=E(this.innerSize,!0),this._sliceDim=E(this.sliceOffset,!0)}_doPrepareRender(){super._doPrepareRender(),this._groupPos=NaN}}class ys extends Kt{}class xs extends me{constructor(){super(...arguments),this.radius=5}}class fs extends Kt{_readArray(t,e){super._readArray(t,e),this.id=v(e[parseInt(t.idField)]),this.group=v(e[parseInt(t.groupField)])}_readObject(t,e){super._readObject(t,e),this.id=v(e[t.idField]),this.group=v(e[t.groupField])}}class ws{constructor(t){this.point=t}getArea(){return{x:this.x,y:this.y,width:this.width,height:this.height}}setArea(t,e,s,i){this.x=t,this.y=e,this.width=s,this.height=i}getTotal(){return this.children.reduce(((t,e)=>t+e.value),0)}}var bs,Ps,vs;!function(t){t.SQUARIFY="squarify",t.STRIP="strip",t.SLICE="slice",t.SLICE_DICE="sliceDice"}(bs||(bs={}));class Vs extends Kt{_readArray(t,e){const s=e.length>3?1:0;this.y=e[c(t.yField,0+s)],this.length=e[c(t.lengthField,1+s)],this.angle=e[c(t.angleField,2+s)],this.x=s>0?e[c(t.xField,0)]:this.index}_readObject(t,e){super._readObject(t,e),this.length=d(e[t.lengthField],e.length),this.angle=d(e[t.angleField],e.angle),this.y=_(e[t.yField],e.y,e.value)}_readSingle(t){super._readSingle(t),this.length=this.angle=this.y}parse(t){super.parse(t),this.lengthValue=parseFloat(this.length),this.angleValue=parseFloat(this.angle),this.isNull||(this.isNull=isNaN(this.lengthValue)||isNaN(this.angleValue))}}!function(t){t.CENTER="center",t.START="start",t.END="end"}(Ps||(Ps={})),function(t){t.NONE="none",t.CLOSE="close",t.OPEN="open"}(vs||(vs={}));class Ss extends Kt{constructor(){super(...arguments),this.low=0}parse(t){super.parse(t),this._isSum=!0===this.source.isSum,this._intermediate=this.source.intermediate,this._isSum&&(this.y=0),this.save=this.y}}const As={bar:class extends Ve{constructor(){super(...arguments),this.baseValue=0}_seriesType(){return"bar"}_canContain(t){return t instanceof $e}clusterable(){return!0}setCluster(t,e){this._clusterWidth=t,this._clusterPos=e}getBaseValue(t){return t._isX?NaN:c(this.baseValue,t.getBaseValue())}_doPrepareSeries(t){if(this.layout===_e.DEFAULT){const e=t.length>1?t.map((t=>t.pointWidth)).reduce(((t,e)=>t+e),0):t[0].pointWidth;let s=0;t.forEach((t=>{t._childWidth=t.pointWidth/e,t._childPos=s,s+=t._childWidth}))}else this.layout,_e.STACK}},line:class extends Pe{constructor(){super(...arguments),this.baseValue=0}_seriesType(){return"line"}_canContain(t){return t instanceof We}getBaseValue(t){return t===this._yAxisObj?c(this.baseValue,t.getBaseValue()):NaN}},area:class extends Pe{constructor(){super(...arguments),this.baseValue=0}_seriesType(){return"area"}_canContain(t){return t instanceof Ye}getBaseValue(t){return t===this._yAxisObj?c(this.baseValue,t.getBaseValue()):NaN}},pie:class extends Pe{constructor(){super(...arguments),this.polarSize="80%",this.innerSize=0}getPolarSize(t,e){return T(this._polarDim,Math.min(t,e))}getInnerRadius(t){const e=this._innerDim;return e?e.size/(e.fixed?t:100):0}_seriesType(){return"pie"}needAxes(){return!1}_canContain(t){return t instanceof ms}_doLoad(t){super._doLoad(t),this._polarDim=E(this.polarSize,!0)||{size:80,fixed:!1},this._innerDim=E(this.innerSize,!0)}_doPrepareSeries(t){if(this.layout===_e.STACK||this.layout===_e.FILL){const e=t.map((t=>t.groupSize)).reduce(((t,e)=>t+c(e,1)),0);let s=0;t.forEach((t=>{t._groupPos=s,s+=t._groupSize=c(t.groupSize,1)/e}))}}},bump:class extends ve{_type(){return"bump"}_seriesType(){return"line"}_canContain(t){return t instanceof We}_doConstraintYValues(t){const e={};t.forEach((t=>{t._visPoints.forEach((t=>{const s=t.xValue;let i=e[s];i?i.push(t):e[s]=[t]}))}));for(const t in e){const s=e[t].sort(((t,e)=>t.yValue-e.yValue));for(let t=s.length-1;t>=0;t--)s[t].yValue=s[t].yGroup=t}return X.makeIntArray(0,t.length)}}},Ls={area:Ye,arearange:class extends He{constructor(){super(...arguments),this.curved=!1}_type(){return"arearange"}_createPoint(t){return new Xe(t)}getLineType(){return this.curved?Nt.SPLINE:Nt.DEFAULT}collectValues(t,e){super.collectValues(t,e),e&&t===this._yAxisObj&&this._visPoints.forEach((t=>e.push(t.lowValue)))}},bar:$e,barrange:class extends be{_type(){return"barrange"}_createPoint(t){return new Re(t)}_getBottomValue(t){return t.lowValue}},bellcurve:class extends He{constructor(){super(...arguments),this.sigmas=3,this.pointsInSigma=5}_type(){return"bellcurve"}getLineType(){return Nt.SPLINE}createPoints(t){const e=super.createPoints(t);return e&&e.length>0?this.$_loadTable(e):[]}_referOtherSeries(t){return!this._points.isEmpty()||(t.name===this.refSeries?(this.$_loadTable(t.getPoints().getVisibles()),!0):void 0)}$_loadTable(t){const e=t.map((t=>t.yValue)).filter((t=>!isNaN(t))),s=e.length;if(s<1)return;const i=e.reduce(((t,e)=>t+e),0)/s,r=Math.sqrt(e.reduce(((t,e)=>t+Math.pow(e-i,2)))/(s-1)),n=r/this.pointsInSigma,a=i-this.sigmas*r,h=i+this.sigmas*r;let o=i;for((t=[]).push(this.$_getDenstiy(i,r,o));o>a;)o-=n,t.unshift(this.$_getDenstiy(i,r,o));for(o=i;o<h;)o+=n,t.push(this.$_getDenstiy(i,r,o));return t.forEach(((t,e)=>{t.index=e,t.x=t.source.x,t.y=t.source.y,t.yGroup=t.y})),t}$_getDenstiy(t,e,s){const i=s-t,r=Math.exp(-i*i/(2*e*e))/(e*Math.sqrt(2*Math.PI));return new Ke({x:s,y:r})}},boxplot:class extends be{_type(){return"boxplot"}_createPoint(t){return new Qe(t)}_getBottomValue(t){return t.minValue}},bubble:class extends ce{constructor(t,e){super(t,e),this.sizeMode=je.AREA,this.minSize=8,this.maxSize="20%",this.colorByPoint=!1,this.marker=new Je(this)}getPxMinMax(t){return{min:T(this._minDim,t),max:T(this._maxDim,t)}}getRadius(t,e,s){let i=(t-this._zMin)/(this._zMax-this._zMin);return this.sizeMode==je.AREA&&(i=Math.sqrt(i)),i=Math.ceil(e+i*(s-e))/2,i}_type(){return"bubble"}ignoreAxisBase(t){return!0}_createPoint(t){return new Ze(t)}_colorByPoint(){return this.colorByPoint}load(t){return super.load(t),this._minDim=E(this.minSize,!0),this._maxDim=E(this.maxSize,!0),this}_doPrepareRender(){super._doPrepareRender(),this._zMin=Number.MAX_VALUE,this._zMax=Number.MIN_VALUE,this._visPoints.forEach((t=>{this._zMin=Math.min(this._zMin,t.zValue),this._zMax=Math.max(this._zMax,t.zValue)}))}},candlestick:es,dumbbell:class extends fe{constructor(){super(...arguments),this.marker=new ss(this)}_type(){return"dumbbell"}canCategorized(){return!0}_createPoint(t){return new is(t)}_doPrepareRender(){super._doPrepareRender();const t=this.marker.radius,e=this.marker.shape;this._visPoints.forEach((s=>{s.radius=t,s.shape=e}))}collectValues(t,e){super.collectValues(t,e),e&&t===this._yAxisObj&&this._visPoints.forEach((t=>{const s=t.lowValue;!isNaN(s)&&e.push(s)}))}},equalizer:class extends we{constructor(){super(...arguments),this.segmentSize=10,this.segmentGap=4,this.segmented=!1,this.backSegments=!1}getSegmentSize(t){return T(this._segmentDim,t)}_type(){return"equalizer"}canCategorized(){return!0}_createPoint(t){return new rs(t)}_doLoad(t){super._doLoad(t),this._segmentDim=E(this.segmentSize,!1)}},errorbar:class extends be{constructor(){super(...arguments),this.pointPadding=.3}_type(){return"errorbar"}clusterable(){return!1}_createPoint(t){return new ns(t)}_getBottomValue(t){return t.lowValue}},funnel:hs,heatmap:class extends ce{getColor(t){}_type(){return"heatmap"}canMixWith(t){return!1}canCategorized(){return!0}defaultYAxisType(){return"category"}_createPoint(t){return new os(t)}_doPrepareRender(){super._doPrepareRender(),this._colorMin=Number.MAX_VALUE,this._colorMax=Number.MIN_VALUE,this._visPoints.forEach((t=>{isNaN(t.colorValue)||(this._colorMin=Math.min(this._colorMin,t.colorValue),this._colorMax=Math.max(this._colorMax,t.colorValue))}))}},histogram:class extends ce{constructor(){super(...arguments),this.binsNumber=Ue.SQURE_ROOT,this.baseValue=0}getBinCount(t){const e=c(this.binWidth,0);if(e>0)return t/e;return c(this.binsNumber,0)<1?cs[this.binsNumber||Ue.SQURE_ROOT](t):void 0}_type(){return"histogram"}ignoreAxisBase(t){return t===this._xAxisObj}_createPoint(t){return new ls(t)}_doLoadPoints(t){function e(t){let e;return e=h(t)?t[c(this.yField,0)]:a(t)?_(t[this.yField],t.y,t.value):t,parseFloat(e)}const s=[];let i=[];for(let s=0;s<t.length;s++){const r=e(t[s]);isNaN(r)||i.push(r)}if(i.length>0){i=i.sort(((t,e)=>t-e)),this.minValue<i[0]&&i.unshift(this.minValue),this.maxValue>i[i.length-1]&&i.push(this.maxValue);const t=i.length,e=i[0],r=i[t-1],n=this.getBinCount(t),a=this._binInterval=(r-e)/n;let h=0,o=e,l=o+a;for(let e=0;e<n;e++){let c=0;if(e==n-1)c=t-h;else for(;h<t&&i[h]<l;)c++,h++;s.push({x:o,y:c,min:o,max:e===n-1?r:l}),o=l,l=o+a}}super._doLoadPoints(s)}collectValues(t,e){super.collectValues(t,e),e&&(t===this._xAxisObj?e.push(this._visPoints[this._visPoints.length-1].max):t===this._yAxisObj&&e.push(this._base))}_doPrepareRender(){super._doPrepareRender(),this._base=c(this.baseValue,this._yAxisObj.getBaseValue())}getBaseValue(t){return t===this._yAxisObj?this._base:NaN}},line:We,lollipop:class extends we{constructor(){super(...arguments),this.marker=new us(this)}_type(){return"lollipop"}canCategorized(){return!0}getLabelOff(t){return t+this.marker.radius}_createPoint(t){return new ds(t)}_doPrepareRender(){super._doPrepareRender();const t=this.marker.radius,e=this.marker.shape;this._visPoints.forEach((s=>{s.radius=t,s.shape=e}))}},ohlc:class extends es{_type(){return"ohlc"}_createPoint(t){return new _s(t)}},pareto:class extends He{constructor(){super(...arguments),this.curved=!1}_type(){return"pareto"}getLineType(){return this.curved?Nt.SPLINE:Nt.DEFAULT}_createPoint(t){return new ps(t)}_referOtherSeries(t){if(t.name===this.source||t.index===this.source)return t.referBy(this),!0}reference(t,e){e._isX||(this.$_loadPoints(t._visPoints),this.collectValues(this._xAxisObj,this._xAxisObj._values),this.collectValues(this._yAxisObj,this._yAxisObj._values))}$_loadPoints(t){const e=[],s=t.reduce(((t,e)=>t+c(e.yValue,0)),0);let i=0;t.forEach((t=>{t.isNull||e.push({x:t.xValue,y:i+=100*t.yValue/s})})),this._doLoadPoints(e),this._visPoints=this._points.getVisibles()}},pie:ms,scatter:class extends ce{constructor(t,e){super(t,e),this.jitterX=0,this.jitterY=0,this.marker=new xs(this)}_type(){return"scatter"}ignoreAxisBase(t){return!0}_createPoint(t){return new ys(t)}},treemap:class extends ce{constructor(){super(...arguments),this.idField="id",this.groupField="group",this.algorithm=bs.SQUARIFY,this.alternate=!0,this._map={}}buildMap(t,e){function s(t){if(t.children){let e=0;t.children.forEach(((t,i)=>{s(t),e+=t.value})),t.value=e,t.children=t.children.sort(((t,e)=>e.value-t.value)),t.children.forEach(((t,e)=>{t.index=e}))}else r.push(t),t.value=t.point?t.point.yValue:0}const i="vertical"===this.startDir||e>t,r=this._leafs=[];return this._roots.forEach(((t,e)=>{s(t)})),this._roots=this._roots.sort(((t,e)=>e.value-t.value)),this._roots.forEach(((t,e)=>{t.index=e})),(this[this.algorithm]||this.squarify).call(this,this._roots,t,e,i),this._leafs}_type(){return"treemap"}needAxes(){return!1}canMixWith(t){return!1}_createPoint(t){return new fs(t)}getLabeledPoints(){return this._leafs.map((t=>t.point))}_doPrepareRender(){super._doPrepareRender(),this._roots=this.$_buildTree(this._visPoints)}$_buildTree(t){const e=[],s=[],i=this._map;t.forEach((t=>{if(!t.isNull){const r=new ws(t);t.id&&(i[t.id]=r),t.group?s.push(r):e.push(r)}}));for(let t=s.length-1;t>=0;t--){const r=s[t],n=i[r.point.group];(r.parent=n)?(n.children||(n.children=[]),n.children.push(r),r.children&&s.splice(t,1)):(e.push(r),s.splice(t,1))}return e}$_squarifyRow(t,e,s,i){const r=e.width*e.height,n=e.width,a=e.height;let h=e.x,o=e.y,l=Number.MAX_VALUE,c=0;const u=[];for(;t.length>0;){let d,_,p,g,m;if(d=t.shift(),c+=d.value,g=c*r/i,1===s?(_=g/a,p=a*d.value/c):(p=g/n,_=n*d.value/c),m=Math.max(_/p,p/_),t.length>0&&m>l)return t.unshift(d),c-=d.value,g=r*c/i,1===s?(p=a,_=g/p):(_=n,p=g/_),u.forEach((t=>{1===s?(t.setArea(h,o,_,a*t.value/c),o+=t.height):(t.setArea(h,o,n*t.value/c,p),h+=t.width)})),1===s?(e.x+=_,e.width-=_):(e.y+=p,e.height-=p),i-c;if(0===t.length)return g=r*c/i,1===s?(p=a,_=g/p):(_=n,p=g/_),u.push(d),u.forEach((t=>{1===s?(t.setArea(h,o,_,a*t.value/c),o+=t.height):(t.setArea(h,o,n*t.value/c,p),h+=t.width)})),0;l=m,u.push(d)}}$_squarify(t,e,s,i){const r=t.slice(0);let n=s?1:0,a=t.reduce(((t,e)=>t+e.value),0);do{a=this.$_squarifyRow(r,e,n,a),i&&(n=1-n)}while(a>0);t.forEach((t=>{t.children&&this.$_squarify(t.children,t.getArea(),!s,!0)}))}squarify(t,e,s,i){this.$_squarify(t,{x:0,y:0,width:e,height:s},i,!0)}strip(t,e,s,i){this.$_squarify(t,{x:0,y:0,width:e,height:s},i,!1)}$_sliceNext(t,e,s,i){if(t.x=e.x,t.y=e.y,1===s){const s=e.height*t.value/i;t.width=e.width,t.height=s,e.y+=s,e.height-=s}else{const s=e.width*t.value/i;t.height=e.height,t.width=s,e.x+=s,e.width-=s}t.children&&this.$_slice(t.children,t.getArea(),0===s,!0)}$_slice(t,e,s,i){let r=t.reduce(((t,e)=>t+e.value),0),n=s?1:0;t.forEach((t=>{this.$_sliceNext(t,e,n,r),r-=t.value,i&&(n=1-n)}))}slice(t,e,s,i){this.$_slice(t,{x:0,y:0,width:e,height:s},i,!1)}sliceDice(t,e,s,i){this.$_slice(t,{x:0,y:0,width:e,height:s},i,!0)}},vector:class extends ce{constructor(){super(...arguments),this.origin=Ps.CENTER,this.maxLength=20,this.startAngle=0,this.arrowHead=vs.CLOSE}_type(){return"vector"}ignoreAxisBase(t){return!0}_createPoint(t){return new Vs(t)}_doLoad(t){super._doLoad(t)}_doPrepareRender(){super._doPrepareRender();const t=this._visPoints;if(t.length>0){const e=this.maxLength,s=this.origin,i=t.map((t=>t.length)).reduce(((t,e)=>Math.max(t,e)));t.forEach((t=>{const r=t.length/i;switch(t._len=r*e,s){case Ps.START:case Ps.END:t._off=t._len/2;break;default:t._off=0}}))}}},waterfall:class extends be{constructor(t,e){super(t,e)}_type(){return"waterfall"}canCategorized(){return!0}_createPoint(t){return new Ss(t)}_doPrepareRender(){super._doPrepareRender();const t=this._visPoints;if(t.length<1)return;let e,s,i=t[0],r=i.y=i._isSum?0:i.y,n=r,a=r,h=r,o=0;for(let l=1,c=t.length;l<c;l++){if(i=t[l],i._isSum){const e=t[l-1],r=!0===i._intermediate||l<c-1&&!1!==i._intermediate,n=i.save=i.y=r?h:a;i.yGroup=i.yValue=i.y,r?h<0?(o=e.low,s=o-n):(s=e.y,o=s-n):(o=t[0].low,s=o+n),h=0}else e=i.y,e<0?n<0?(s=r+n,o=s+e):(s=r,o=s+e):(o=r,s=o+e),h+=e,a+=e;n=i.y,i.y=r=s,i.low=o}}_getBottomValue(t){return t.y=t.save,NaN}}},Es={category:ne,linear:Ce,time:De,date:De,log:class extends Te{type(){return"log"}_createTickModel(){return new Me(this)}_doCalcluateRange(t){const e=super._doCalcluateRange(t);return e.min=Math.log10(e.min),e.max=Math.log10(e.max),e}_createTick(t,e){return super._createTick(t,Math.pow(10,e))}getPosition(t,e){return e=e>0?Math.log10(e):0,super.getPosition(t,e)}}};class Ns extends bt{constructor(){super(...arguments),this.polar=!1,this.animatable=!0,this.xStart=0,this.xStep=1,this.axisGap=8}}class Ts extends r{constructor(t){super(),this.colors=["#1bafdc","#12d365","#343ec3","#81d8c1","#fe6a35","#6b8abc","#d568fb","#2ee0ca","#fa4b42","#feb56a"],this.type="bar",this._options=new Ns(this),this._title=new Se(this),this._subtitle=new Ae(this),this._legend=new Yt(this),this._series=new ue(this),this._xAxes=new Ut(this,!0),this._yAxes=new Ut(this,!1),this._body=new Wt(this),t&&this.load(t),this._polar=!0===this.options.polar}startAngle(){return this.body.getStartAngle()}get xStart(){return this._options.xStart}get xStep(){return this._options.xStep}animatable(){return!1!==this._options.animatable}get options(){return this._options}get title(){return this._title}get subtitle(){return this._subtitle}get first(){return this._series.first}get firstSeries(){return this._series.firstSeries}get legend(){return this._legend}get xAxis(){return this._xAxes.first}get yAxis(){return this._yAxes.first}get body(){return this._body}needAxes(){return this._series.needAxes()}_getSeries(){return this._series}_getXAxes(){return this._xAxes}_getYAxes(){return this._yAxes}isInverted(){return!this._polar&&this._inverted}isEmpty(){return this._series.isEmpty()}seriesByName(t){return this._series.get(t)}axisByName(t){return this._xAxes.get(t)||this._yAxes.get(t)}containsAxis(t){return this._xAxes.contains(t)||this._yAxes.contains(t)}getAxes(t){const e=this._xAxes.items,s=this._yAxes.items;let i;if(this.isInverted())switch(t){case R.LEFT:i=e.filter((t=>!t._isOpposite));break;case R.RIGHT:i=e.filter((t=>t._isOpposite));break;case R.BOTTOM:i=s.filter((t=>!t._isOpposite));break;case R.TOP:i=s.filter((t=>t._isOpposite))}else switch(t){case R.LEFT:i=s.filter((t=>!t._isOpposite));break;case R.RIGHT:i=s.filter((t=>t._isOpposite));break;case R.BOTTOM:i=e.filter((t=>!t._isOpposite));break;case R.TOP:i=e.filter((t=>t._isOpposite))}return i||[]}_getLegendSources(){return this._series.getLegendSources()}load(t){["type","inverted"].forEach((e=>{e in t&&(this[e]=t[e])})),this._options.load(t.options),this._title.load(t.title),this._subtitle.load(t.subtitle),this._legend.load(t.legend),this._series.load(t.series),this._xAxes.load(t.xAxes||t.xAxis||{}),this._yAxes.load(t.yAxes||t.yAxis||{}),this._body.load(t.plot),this._inverted=this.inverted}_connectSeries(t,e){return e?this._xAxes.connect(t):this._yAxes.connect(t)}prepareRender(){this._xAxes.disconnect(),this._yAxes.disconnect(),this._series.prepareRender(),this._xAxes.collectValues(),this._yAxes.collectValues(),this._xAxes.collectReferentsValues(),this._yAxes.collectReferentsValues(),this._xAxes.prepareRender(),this._yAxes.prepareRender(),this._series.prepareAfter(),this._legend.prepareRender()}layoutAxes(t,e,s,i){this._xAxes.buildTicks(s?e:t),this._yAxes.buildTicks(s?t:e),this.$_calcAxesPoints(t,e,s,0)}calcAxesPoints(t,e,s){this.$_calcAxesPoints(t,e,s,1)}$_calcAxesPoints(t,e,s,i){let r=s?e:t;this._xAxes.forEach((t=>{t.calcPoints(r,i)})),r=s?t:e,this._yAxes.forEach((t=>{t.calcPoints(r,i)}))}update(){}_getGroupType(t){return As[t]}_getSeriesType(t){return Ls[String(t).toLowerCase()]}_getAxisType(t){return Es[String(t).toLowerCase()]}getAxesGap(){return this._options.axisGap||0}_visibleChanged(t){this._fireEvent("onVisibleChanged",t)}_modelChanged(t){}}class Cs{constructor(t){this._chart=t}handleMove(t){const e=t.pointX,s=t.pointY,i=this._chart.chartView().bodyView();i.pointerMoved(i.controlToElement(e,s),t.target)}handleClick(t){const e=this._chart.chartView(),s=t.target,i=e.legendByDom(s);if(i)i.source.visible=!i.source.visible;else{const t=e.seriesByDom(s);t&&t.clicked(s)}}handleDblClick(t){}handleWheel(t){}}class Ms{static empty(){return new Ms}static create(t=0,e=0){return new Ms(t,e)}constructor(t=0,e=0){this.x=t,this.y=e}get isEmpty(){return 0===this.x||0===this.y}clone(){return new Ms(this.x,this.y)}equals(t){return t===this||t&&this.x===t.x&&this.y===t.y}setEmpty(){return this.x=this.y=0,this}set(t,e){return this.x=t,this.y=e,this}round(){const t=this.clone();return t.x>>>=0,t.y>>>=0,t}toString(){return"{x: "+this.x+", y: "+this.y+"}"}}class ks{static empty(){return new ks}static create(t=0,e=0){return new ks(t,e)}constructor(t=0,e=0){this.width=t,this.height=e}get isEmpty(){return 0===this.width||0===this.height}clone(){return new ks(this.width,this.height)}equals(t){return t===this||t&&this.width===t.width&&this.height===t.height}setEmpty(){return this.width=this.height=0,this}set(t,e){return this.width=t,this.height=e,this}round(){const t=this.clone();return t.width>>>=0,t.height>>>=0,t}toString(){return"{width: "+this.width+", height: "+this.height+"}"}}ks.EMPTY=new ks;class Os extends it{constructor(t,e=y){super(t,e,"g"),this._doInitChildren(t)}_movable(){return!1}setAttr(t,e){return Os.IGNORE_ATTRS.hasOwnProperty(t)||super.setAttr(t,e),this}_doInitChildren(t){}}Os.IGNORE_ATTRS={width:"",height:""};class Bs extends ht{constructor(t,e=y,s=y){super(t,e),this.setAttr("shapeRendering","cripsEdges"),s&&this.setLine(s)}setLine(t,e,s,i){X.isNumber(t)?this.setPath(et.line(t,e,s,i)):t&&this.setPath(et.line(t.x1,t.y1,t.x2,t.y2))}setVLine(t,e,s){this.setPath(et.line(t,e,t,s))}setVLineC(t,e,s){this.setPath(et.line(t,e,t,s))}setHLine(t,e,s){this.setPath(et.line(e,t,s,t))}setHLineC(t,e,s){this.setPath(et.line(e,t,s,t))}}class Ds{static isBright(t){return new Ds(t).isBright()}static getContrast(t,e,s){return new Ds(t).getContrast(e,s)}static interpolate(t,e,s){const i=(16711680&t)>>16,r=(65280&t)>>8,n=255&t;return(i+(((16711680&e)>>16)-i)*s<<16)+(r+(((65280&e)>>8)-r)*s<<8)+(n+((255&e)-n)*s)}constructor(t){this.r=0,this.g=0,this.b=0,this.a=1,(t=t&&t.trim())&&(X.startsWith(t,"rgb(")&&X.endsWith(t,")")?this.$_parseRgb(t.substring(4,t.length-1)):X.startsWith(t,"rgba(")&&X.endsWith(t,")")?this.$_parseRgb(t.substring(5,t.length-1)):X.startsWith(t,"#")&&this.$_parseNumber(t.substr(1)))}get rgba(){return"rgba("+[this.r,this.g,this.b,this.a].join(",")+")"}isBright(){return.299*this.r+.587*this.g+.114*this.b>140}getContrast(t,e){return this.isBright()?t||"#000000":e||"#FFFFFF"}brighten(t,e=null){return(e=e||new Ds(null)).r=Math.ceil(this.r+(255-this.r)*t),e.g=Math.ceil(this.g+(255-this.g)*t),e.b=Math.ceil(this.b+(255-this.b)*t),e.a=this.a,e}toString(){return this.rgba}$_parseRgb(t){const e=t.split(/\,\s*/);e.length>=3&&(this.r=+e[0],this.g=+e[1],this.b=+e[2],e.length>=4?this.a=+e[3]:this.a=1)}$_parseNumber(t){const e=t.length;let s;e>6?(s=parseInt(t.substr(0,6),16),this.a=parseInt(t.substring(6),16)/255):e>0&&(3===e&&(t=t.charAt(0)+t.charAt(0)+t.charAt(1)+t.charAt(1)+t.charAt(2)+t.charAt(2)),s=parseInt(t,16)),this.r=(16711680&s)>>16,this.g=(65280&s)>>8,this.b=255&s}}var Rs,Is,$s;!function(t){t.START="start",t.MIDDLE="middle",t.END="end"}(Rs||(Rs={})),function(t){t.TOP="top",t.MIDDLE="middle",t.BOTTOM="bottom"}(Is||(Is={})),function(t){t.TRUNCATE="truncate",t.WRAP="wrap",t.ELLIPSIS="ellipsis"}($s||($s={}));class Fs extends it{constructor(t,e=y){super(t,e,"text"),this._layout=Is.TOP,this._overflow=$s.WRAP,this._dirty=!0,this._text="",this.setAttr("text-anchor","middle")}get text(){return this._text}set text(t){(t=t||"")!==this._text&&(this._dirty=!0,this.dom.textContent=this._text=t,this.layoutText())}get anchor(){return this.getAttr("text-anchor")}set anchor(t){t!==this.anchor&&this.setAttr("text-anchor",t)}get layout(){return this._layout}set layout(t){t!==this._layout&&(this._layout=t,this.layoutText())}get overflow(){return this._overflow}set overflow(t){t!==this._overflow&&(this._overflow=t,this.layoutText())}get svg(){return this.dom.innerHTML}set svg(t){t=t||"",this.dom.innerHTML=t}get opacity(){return this.getAttr("fill-opacity")}set opacity(t){this.setAttr("fill-opacity",t)}getAscent(t){return.75*t}layoutText(t){const e=this.getBBounds(),s=this.getAscent(isNaN(t)?e.height:t);let i;switch(this._layout){case Is.MIDDLE:i=Math.floor(s/2);break;case Is.BOTTOM:i=s-e.height;break;default:i=Math.ceil(s)}this.setAttr("y",i)}isFitIn(t){return this.calcWidth()>=t}calcWidth(){const t=this._text.length;return t&&this.dom.getSubStringLength(0,t)}calcRangeWidth(t=0,e=Number.MAX_SAFE_INTEGER){return t=Math.max(0,t),(e=Math.min(this._text.length,e))>t?this.dom.getSubStringLength(t,e-t):0}truncate(t,e){let s=this._text;if(!s)return;const i=this.dom;let r,n=0,a=s.length;do{r=Math.ceil((n+a)/2);i.getSubStringLength(0,r)>t?a=r-1:n=r}while(n<a);for(this.text=s.substring(0,n)+"…";n>0&&this.calcWidth()>t;)this.text=s.substring(0,--n)+"…"}setContrast(t,e,s){return this.setStyleOrClass(Ds.isBright(getComputedStyle(t).fill)?e:s),this}clearDom(){super.clearDom(),this._dirty=!0}setStyles(t){let e=super.setStyles(t);return e&&this.layoutText(),e}setStyle(t,e){let s=super.setStyle(t,e);return s&&this.layoutText(),s}getBBounds(){return(this._dirty||this._styleDirty)&&(this._bounds=this.dom.getBBox(),this._dirty=this._styleDirty=!1),this._bounds}getBBoundsTest(){return(this._dirty||this._styleDirty)&&(this._bounds={x:this.x,y:this.y,width:100,height:30},this._dirty=this._styleDirty=!1),this._bounds}}class zs{static create(t,e,s,i){return isNaN(s)?isNaN(e)?new zs(t,t,t,t):new zs(t,t,e,e):new zs(t,e,s,i)}static createFrom(t){const e=t.split(/\s*[\s,]+\s*/g);return this.create.call(null,...e.map((t=>+t)))}constructor(t=0,e=0,s=0,i=0){this.top=t,this.bottom=e,this.left=s,this.right=i}clone(){return new zs(this.top,this.bottom,this.left,this.right)}applyPadding(t){return this.left=c(t.paddingLeft,0),this.right=c(t.paddingRight,0),this.top=c(t.paddingTop,0),this.bottom=c(t.paddingBottom,0),this}applyMargin(t){return this.left=c(t.marginLeft,0),this.right=c(t.marginRight,0),this.top=c(t.marginTop,0),this.bottom=c(t.marginBottom,0),this}shrink(t){return{x:t.x+this.left,y:t.y+this.top,width:t.width-this.left-this.right,height:t.height-this.top-this.bottom}}toString(){return"{top: "+this.top+", bottom: "+this.bottom+", left: "+this.left+", right: "+this.right+"}"}}zs.Empty=Object.freeze(new zs),zs.Temp=new zs;class Hs extends it{static create(t,e,s,i,r,n,a=0){return new Hs(t,e,{x:s,y:i,width:r,height:n,r:a})}constructor(t,e=y,s=y){super(t,e,"rect"),this.rect=s,this.setAttr("shapeRendering","cripsEdges")}get rect(){return this._rect&&Object.assign({},this._rect)}set rect(t){if(t!==this._rect&&(this._rect=t&&Object.assign({},t),t)){this.setRect(t);let e=t.rx||t.r,s=t.ry||t.r;e>0&&this.dom.setAttribute("rx",String(e)),s>0&&this.dom.setAttribute("rx",String(s))}}setBounds(t,e,s,i,r=0){return this.rect={x:t,y:e,width:s,height:i,r:r},this}setBox(t,e,s,i){this.rect=i<0?{x:t,y:e+i,width:s,height:-i}:{x:t,y:e,width:s,height:i}}setRadius(t){t>0&&(this._rect&&(this._rect.rx=this._rect.ry=t),this.dom.setAttribute("rx",String(t)),this.dom.setAttribute("ry",String(t)))}}class Gs extends ht{constructor(t,e=y){super(t,e)}setBox(t,e,s,i){return this.setPath(et.box(t,e,s,i)),this}}class js extends it{constructor(t,e=y){super(t,e,"g"),it.DEBUGGING&&(this.add(this._debugRect=new Hs(t,"rct-debug")),this._debugRect.setAttr("pointerEvents","none"))}chart(){return this.model.chart}measure(t,e,s,i,r){this.setStyleOrClass(e.style),e!==this.model&&(this.model=e,this._doModelChanged());const n=this._doMeasure(t,this.model,s,i,r);return this.mw=n.width,this.mh=n.height,n}layout(t){return this._doLayout(t),it.DEBUGGING?(this._debugRect||this.insertFirst(this._debugRect=new Hs(this.doc,"rct-debug")),this.width>1&&this.height>1&&this._debugRect.setRect(this._getDebugRect())):this._debugRect&&(this._debugRect.remove(),this._debugRect=null),this}resizeByMeasured(){return this.resize(this.mw,this.mh),this}_getDebugRect(){return{x:0,y:0,width:this.width,height:this.height}}_invalidate(){var t;null===(t=this.control)||void 0===t||t.invalidateLayout()}_doModelChanged(){}}class Us extends js{constructor(t,e,s){super(t,e),this._margins=new zs,this._paddings=new zs,this.add(this._background=new Hs(t,s))}_getDebugRect(){return this._margins.shrink(super._getDebugRect())}measure(t,e,s,i,r){this.setStyleOrClass(e.style),e!==this.model&&(this.model=e,this._doModelChanged()),this._setBackgroundStyle(this._background);const n=getComputedStyle(this.dom),a=getComputedStyle(this._background.dom),h=this._paddings,o=this._margins;h.applyPadding(a),this._borderRadius=parseFloat(a.borderRadius)||0,o.applyMargin(n);const l=this._doMeasure(t,e,s,i,r);return l.height+=o.top+o.bottom+h.top+h.bottom,l.width+=o.left+o.right+h.left+h.right,this.mw=l.width,this.mh=l.height,l}layout(t){super.layout(t);const e=this._margins;return this._background.setBounds(e.left+this._getBackOffset(),e.top,this.width-e.left-e.right,this.height-e.top-e.bottom,this._borderRadius),this}_getBackOffset(){return 0}}class Ws extends Us{constructor(t){super(t,Ws.TITLE_CLASS,"rct-axis-title-background"),this.add(this._textView=new Fs(t))}_setBackgroundStyle(t){t.setStyleOrClass(this.model.backgroundStyle)}_getBackOffset(){return-this.width/2}_doMeasure(t,e,s,i,r){return this.rotation=0,this._textView.text=e.text,Q(this._textView.getBBounds())}_doLayout(t){const e=this._paddings,s=this._margins;t||this.setRotaion(0,this.height/2,this.model.axis.position===St.OPPOSITE?90:270),this._textView.translateY(s.top+e.top)}layout(t){return super.layout(t),this._debugRect&&this._debugRect.setBounds(-this.width/2,0,this.width,this.height),this}}Ws.TITLE_CLASS="rct-axis-title";class qs extends js{constructor(t){super(t,Xs.TICK_CLASS),this.add(this._lineView=new Bs(t))}_doMeasure(t,e,s,i,r){return ks.create(s,i)}_doLayout(t){this.model.axis._isHorz?this._lineView.setVLineC(0,0,this.height):this._lineView.setHLineC(0,0,this.width)}}class Ys extends Fs{constructor(){super(...arguments),this.index=-1,this.col=0,this.row=0,this.tickWidth=0}get rotatedWidth(){const t=this.rotation*w,e=this.getBBounds();return Math.abs(Math.sin(t)*e.height)+Math.abs(Math.cos(t)*e.width)}get rotatedHeight(){const t=this.rotation*w,e=this.getBBounds();return Math.abs(Math.cos(t)*e.height)+Math.abs(Math.sin(t)*e.width)}}class Xs extends js{constructor(t){super(t,Xs.AXIS_CLASS),this._markViews=[],this._labelViews=[],this.add(this._lineView=new Bs(t,Xs.LINE_CLASS)),this.add(this._titleView=new Ws(t)),this.add(this._markContainer=new it(t,"rct-axis-tick-marks")),this.add(this._labelContainer=new it(t,"rct-axis-tick-labels"))}checkHeight(t,e,s){const i=this.model;let r=0;return this.$_prepareLabels(t,i)&&(r+=this.$_measureLabelsHorz(i,this._labelViews,e)),(this._titleView.visible=i.title.isVisible())&&(r+=this._titleView.measure(t,i.title,e,s,1).height),r}checkWidth(t,e,s){const i=this.model;let r=0;return this.$_prepareLabels(t,i)&&(r+=this.$_measureLabelsVert(this._labelViews)),(this._titleView.visible=i.title.isVisible())&&(r+=this._titleView.measure(t,i.title,e,s,1).height),r}prepareGuides(t,e,s){let i=this.model.guides.filter((t=>!t.front));e.addAll(t,i),i=this.model.guides.filter((t=>t.front)),s.addAll(t,i)}_doMeasure(t,e,s,i,r){const n=e._isHorz,a=this._titleView,h=this._labelViews;let o=0;return this._lineView.visible=e.line.visible,this._markLen=e.tick.length||0,this._markLen>0&&(o+=e.tick.margin||0),o+=this._markLen,this.$_prepareTickMarks(t,e)&&this._markViews.forEach((n=>n.measure(t,e.tick,s,i,r))),this.$_prepareLabels(t,e)?o+=this._labelSize=n?this.$_measureLabelsHorz(e,h,s):this.$_measureLabelsVert(h):this._labelSize=0,a.visible&&(o+=a.mh,o+=e.title.gap||0),ks.create(n?s:o,n?o:i)}_doLayout(){const t=this.model,e=t._isHorz,s=t._isOpposite,i=t._ticks,r=t._markPoints,n=this._titleView,a=this._labelViews,h=this._markLen,o=this.width,l=this.height;this._lineView.visible&&(e?this._lineView.setHLine(s?l:0,0,o):this._lineView.setVLine(s?0:o,0,l)),this._markContainer.visible&&(e?this._markViews.forEach(((t,e)=>{t.resize(1,h),t.layout().translate(r[e],s?l-h:0)})):this._markViews.forEach(((t,e)=>{t.resize(h,1),t.layout().translate(s?0:o-h,l-r[e])})));const c=h+(t.tick.margin||0);if(this._labelContainer.visible&&(e?this.$_layoutLabelsHorz(a,i,s,o,l,c):this.$_layoutLabelsVert(a,i,s,o,l,c)),n.visible){const i=this._labelSize,r=t.title.gap||0;if(n.resizeByMeasured().layout(e),e){const t=s?0:c+i+r;n.translate(o/2,t)}else{const t=s?c+i+r+n.height/2:o-c-i-r-n.height/2;n.translate(t,(l-n.height)/2)}}}$_prepareTickMarks(t,e){const s=this._markContainer;if(s.visible=e.tick.visible){const i=e._markPoints.length,r=this._markViews;for(;r.length<i;){const e=new qs(t);s.add(e),r.push(e)}for(;r.length>i;)r.pop().remove();return!0}}$_prepareLabels(t,e){const s=this._labelContainer;if(s.visible=e.label.visible){const i=e._ticks,r=i.length,n=this._labelViews;for(;n.length<r;){const e=new Ys(t,"rct-axis-label");e.anchor=Rs.START,s.add(e),n.push(e)}for(;n.length>r;)n.pop().remove();return n.forEach(((t,e)=>{t.value=i[e].value,t.text=i[e].label})),n.length}return 0}$_getRows(t){return 2}$_getStep(t){return 2}$_measureLabelsHorz(t,e,s){const i=t.label;let r,n=i.step>>0,a=i.rows>>0,h=i.rotation%360,o=!1;if(n>0||a>0||h>0||h<0);else{for(let i=0;i<e.length-1;i++){const r=t.getLabelLength(s,e[i].value);if(e[i].getBBounds().width>=r){o=!0;break}}if(o){switch(i.autoArrange){case Vt.ROTATE:h=-45;break;case Vt.ROWS:a=this.$_getRows(e);break;case Vt.STEP:n=this.$_getStep(e)}o=!1}}if(n>1){const t=Math.max(0,i.startStep||0);e.forEach((t=>t.index=-1));for(let s=t;s<e.length;s+=n)e[s].index=s;e.forEach((t=>t.setVisible(t.index>=0))),e=e.filter((t=>t.visible))}else e.forEach(((t,e)=>{t.index=e,t.setVisible(!0)}));if(a>1?(e.forEach(((t,e)=>t.row=e%a)),this._labelRowPts=[]):(e.forEach((t=>t.row=0)),this._labelRowPts=[0]),h=o?-45:h||0,e.forEach((t=>{t.rotation=h})),a>1){const t=this._labelRowPts;for(let e=0;e<a;e++)t.push(0);isNaN(h)||0==h?e.forEach((e=>{t[e.row]=Math.max(t[e.row],e.getBBounds().height)})):e.forEach((e=>{t[e.row]=Math.max(t[e.row],e.rotatedHeight)})),t.unshift(0);for(let e=2;e<t.length;e++)t[e]+=t[e-1];return t[t.length-1]}if(isNaN(h)||0==h){r=e[0].getBBounds().height;for(let t=1;t<e.length;t++)r=Math.max(r,e[t].getBBounds().height)}else{r=e[0].rotatedHeight;for(let t=1;t<e.length;t++)r=Math.max(r,e[t].rotatedHeight)}return r}$_measureLabelsVert(t){let e=t[0].getBBounds().width;for(let s=1;s<t.length;s++)e=Math.max(e,t[s].getBBounds().width);return e}$_layoutLabelsHorz(t,e,s,i,r,n){const a=this._labelRowPts;t.forEach((t=>{if(t.visible){const i=t.rotation,h=i*w,o=t.getBBounds(),l=Math.floor(t.getAscent(o.height));let c=e[t.index].pos,u=s?r-n-o.height-a[t.row]:n+a[t.row];i<-15&&i>=-90?(t.anchor=Rs.END,c+=-Math.sin(h)*l/2-1,u+=Math.cos(h)*l-l):i>15&&i<=90?(t.anchor=Rs.START,c-=Math.sin(h)*l/2-1,u+=Math.cos(h)*l-l):t.anchor=Rs.MIDDLE,t.translate(c,u)}}))}$_layoutLabelsVert(t,e,s,i,r,n){const a=s?n:i-n;t.forEach(((t,i)=>{if(t.visible){const n=t.getBBounds(),h=s?a:a-n.width;t.translate(h,r-e[i].pos-n.height/2)}}))}}Xs.AXIS_CLASS="rct-axis",Xs.LINE_CLASS="rct-axis-line",Xs.TICK_CLASS="rct-axis-tick-mark";class Ks extends s{constructor(t,e,s,i=0){super(),this.removeDelay=0,this._pool=[],this._views=[],this._removes=[],this._owner=t,this._creator=e,this._styleName=s,this.removeDelay=i}_doDestory(){this._owner=null,this._creator=null,super._doDestory()}get isEmpty(){return 0===this._views.length}get count(){return this._views.length}get first(){return this._views[0]}get last(){return this._views[this._views.length-1]}get(t){return this._views[t]}getAll(){return this._views.slice()}elementOf(t){for(let e of this._views)if(e.dom.contains(t))return e}$_create(t,e=-1,s=0){let i=this._pool.pop();return i||(i=new this._creator(t,this._styleName)),this._owner.add(i),i}prepare(t,e,s){const i=this._owner.doc,r=this._pool,n=this._views;for(;n.length>t;)r.push(n.pop().remove());for(;n.length<t;){const e=this.$_create(i);n.push(e),null==s||s(e,n.length-1,t)}return e&&this.forEach(e),this}reprepare(t,e,s,i,r,n){const a=this._owner.doc,h=this._pool,o=this._views,l=[];for(let t=this._removes.length-1;t>=0;t--)if(!this._removes[t].parent){const e=this._removes.splice(t,1)[0];h.push(e)}for(let i=0,n=e.length;i<n;i++){const h=e[i];let c=-1;if(t)for(let e=0,i=o.length;e<i;e++){const i=o[e][t];if(s&&i===h[s]||!s&&i===h){l.push(o[e]),c=e;break}}if(c>=0){const t=o.splice(c,1)[0];t.parent||this._owner.add(t)}else{const t=this.$_create(a,i,n);l.push(t),null==r||r(t,i,n)}}for(let t=0,e=o.length;t<e;t++){const s=o[t];s.removing||(this.removeDelay>0?this._removes.push(s.removeLater(!1,this.removeDelay)):h.push(s.remove()),null==i||i(s,t,e))}return this._views=l,n&&this.forEach(n),this}borrow(){const t=this._pool.pop()||new this._creator(this._owner.doc,this._styleName);return this._owner.add(t),t}free(t,e=0){if(t){e>0?t.removeLater(!1,e):t.remove(),this._pool.push(t);const s=this._views.indexOf(t);s>=0&&this._views.splice(s,1)}}freeAll(t,e=0){for(let s of t)this.free(s,e)}fadeout(t,e,s){if(t){t.fadeout(e,s),this._pool.push(t);const i=this._views.indexOf(t);i>=0&&this._views.splice(i,1)}}forEach(t){const e=this._views;for(let s=0,i=e.length;s<i;s++)t(e[s],s,i)}visit(t){const e=this._views.length;let s=0;for(;s<e&&!1!==t(this._views[s],s,e);s++);return s===e}find(t){const e=this._views;for(let s=0,i=e.length;s<i;s++)if(t(e[s]))return e[s]}sort(t){return this._views=this._views.sort(t),this}map(t){return this._views.map(t)}}const Qs=function(t){return isNaN(t)?0:t};class Zs{constructor(){this._path=[]}length(){return this._path.length}isEmpty(){return 0===this._path.length}clear(){return this._path=[],this}end(t=!1){return t&&this._path.push("Z"),this._path.join(" ")}close(t){const e=this.end(!0);return t&&this.clear(),e}move(t,e){return l(t)?this._path.push("M",Qs(t),Qs(e)):this._path.push("M",Qs(t.x),Qs(t.y)),this}moveBy(t,e){return l(t)?this._path.push("m",Qs(t),Qs(e)):this._path.push("m",Qs(t.x),Qs(t.y)),this}line(t,e){return l(t)?this._path.push("L",Qs(t),Qs(e)):this._path.push("L",Qs(t.x),Qs(t.y)),this}curve(t,e,s,i,r,n){return this._path.push("C",t,e,s,i,r,n),this}quad(t,e,s,i){return l(t)?this._path.push("Q",t,e,s,i):this._path.push("Q",t.x1,t.y1,t.x2,t.y2),this}rect(t,e,s,i){return this._path.push("M",t,e,"l",s,0,"l",0,i,"l",-s,0),this}lines(...t){if(l(t[0]))for(let e=0;e<t.length;e+=2)this._path.push("L",Qs(t[e]),Qs(t[e+1]));else for(let e=0;e<t.length;e++)this._path.push("L",Qs(t[e].x),Qs(t[e].y));return this}polygon(...t){return this.lines(...t),this._path.push("Z"),this}getMove(t=0,e=!0){if(t<this._path.length&&"M"===this._path[t]){const s={x:this._path[t+1],y:this._path[t+2]};return e&&this._path.splice(t,3),s}}getLine(t=0,e=!0){if(t<this._path.length&&"L"===this._path[t]){const s={x:this._path[t+1],y:this._path[t+2]};return e&&this._path.splice(t,3),s}}getQuad(t=0,e=!0){if(t<this._path.length&&"Q"===this._path[t]){const s={x1:this._path[t+1],y1:this._path[t+2],x2:this._path[t+3],y2:this._path[t+4]};return e&&this._path.splice(t,5),s}}getPoints(t,e,s=!0){const i=[];for(;t<this._path.length&&i.length<e&&t<this._path.length&&("M"===this._path[t]||"L"===this._path[t]);)i.push({x:this._path[t+1],y:this._path[t+2]}),s&&this._path.splice(t,3);return i}}class Js extends it{constructor(t,e){super(t,e,"image"),this._dirty=!0,this.setAttr("preserveAspectRatio","none")}get url(){return this.getAttr("href")}set url(t){t!==this.url&&(this._dirty=!0,t?this.setAttr("href",t):this.unsetAttr("href"))}setImage(t,e,s){return!!t&&(this.setAttr("href",t),this.resize(e,s),!0)}getBBounds(){return this._dirty&&(this._bounds=this.dom.getBBox(),this._dirty=!1),this._bounds}_doSizeChanged(){this._dirty=!0}}class ti extends Os{constructor(t,e=y){super(t),this.add(this._text=new Fs(t,e)),this._text.anchor=Rs.START}get text(){return this._text.text}get anchor(){return this._text.anchor}setText(t){return this._outline&&(this._outline.text=t),this._text.text=t,this}setSvg(t){return this._text.svg=t,this}setModel(t,e,s){var i,r,n,a;const h=e.effect;return this._model=e,this._text.setStyleOrClass(e.style),h===Pt.BACKGROUND?(null===(i=this._outline)||void 0===i||i.remove(),this._back||(this._back=new Hs(t,"rct-label-background")),this.insertFirst(this._back),this._back.setStyleOrClass(e.backgroundStyle)):h===Pt.OUTLINE?(null===(r=this._back)||void 0===r||r.remove(),this._outline||(this._outline=new Fs(t),this._outline.anchor=Rs.START),this.insertFirst(this._outline),this._outline.setStyleOrClass(e.style)):(null===(n=this._back)||void 0===n||n.remove(),null===(a=this._outline)||void 0===a||a.remove()),this}setContrast(t){if(t&&this._model.autoContrast&&this._text.setContrast(t,this._model.darkStyle||"rct-label-dark",this._model.brightStyle||"rct-label-bright"),this._outline&&this._outline.parent){const t=Ds.getContrast(getComputedStyle(this._text.dom).fill);this._outline.setStyles({fill:t,stroke:t,strokeWidth:"2px"})}return this}layout(){if(this._back&&this._back.parent){const t=getComputedStyle(this._back.dom),e=this._text.getBBounds(),s=parseFloat(t.paddingLeft)||0,i=parseFloat(t.paddingTop)||0;this._back.setBounds(-s,-i,e.width+s+(parseFloat(t.paddingRight)||0),e.height+i+(parseFloat(t.paddingBottom)||0),3)}return this}}const ei=Math.pow,si=Math.sqrt,ii=Math.sin,ri=Math.cos,ni=Math.PI,ai=1.70158,hi=1.525*ai,oi=ai+1,li=2*ni/3,ci=2*ni/4.5,ui=function(t){const e=7.5625,s=2.75;return t<1/s?e*t*t:t<2/s?e*(t-=1.5/s)*t+.75:t<2.5/s?e*(t-=2.25/s)*t+.9375:e*(t-=2.625/s)*t+.984375},di={inQuad:t=>t*t,outQuad:t=>1-(1-t)*(1-t),inOutQuad:t=>t<.5?2*t*t:1-ei(-2*t+2,2)/2,inCubic:t=>t*t*t,outCubic:t=>1-ei(1-t,3),outCubic2:t=>1-ei(1-t,4),inOutCubic:t=>t<.5?4*t*t*t:1-ei(-2*t+2,3)/2,inQuart:t=>t*t*t*t,outQuart:t=>1-ei(1-t,4),inOutQuart:t=>t<.5?8*t*t*t*t:1-ei(-2*t+2,4)/2,inQuint:t=>t*t*t*t*t,outQuint:t=>1-ei(1-t,5),inOutQuint:t=>t<.5?16*t*t*t*t*t:1-ei(-2*t+2,5)/2,inSine:t=>1-ri(t*ni/2),outSine:t=>ii(t*ni/2),inOutSine:t=>-(ri(ni*t)-1)/2,inExpo:t=>0===t?0:ei(2,10*t-10),outExpo:t=>1===t?1:1-ei(2,-10*t),inOutExpo:t=>0===t?0:1===t?1:t<.5?ei(2,20*t-10)/2:(2-ei(2,-20*t+10))/2,inCirc:t=>1-si(1-ei(t,2)),outCirc:t=>si(1-ei(t-1,2)),inOutCirc:t=>t<.5?(1-si(1-ei(2*t,2)))/2:(si(1-ei(-2*t+2,2))+1)/2,inBack:t=>oi*t*t*t-ai*t*t,outBack:t=>1+oi*ei(t-1,3)+ai*ei(t-1,2),inOutBack:t=>t<.5?ei(2*t,2)*(7.189819*t-hi)/2:(ei(2*t-2,2)*((hi+1)*(2*t-2)+hi)+2)/2,inElastic:t=>0===t?0:1===t?1:-ei(2,10*t-10)*ii((10*t-10.75)*li),outElastic:t=>0===t?0:1===t?1:ei(2,-10*t)*ii((10*t-.75)*li)+1,inOutElastic:t=>0===t?0:1===t?1:t<.5?-ei(2,20*t-10)*ii((20*t-11.125)*ci)/2:ei(2,-20*t+10)*ii((20*t-11.125)*ci)/2+1,inBounce:t=>1-ui(1-t),outBounce:ui,inOutBounce:t=>t<.5?(1-ui(1-2*t))/2:(1+ui(2*t-1))/2};class _i{constructor(){this.delay=0,this.duration=_i.DURATION,this.easing="inOutSine",this._handler=()=>{const t=+new Date-this._started-this.delay;let e=Math.min(1,Math.max(0,P(t/this.duration)));this._easing&&(e=this._easing(e));try{this._doUpdate(e)||this._stop()}finally{t>=this.duration?this._stop():this._started&&window.requestAnimationFrame(this._handler)}}}start(){this._start(this.duration,this.delay,this.easing)}_start(t,e=0,s=null){this._stop(),this.duration=c(t,_i.DURATION),this.delay=e||0,this._easing=di[s],this._doStart(),this._started=+new Date,this._timer=setTimeout((()=>this._stop()),1.2*this.duration),this._handler()}_stop(){this._started&&(clearTimeout(this._timer),this._timer=null,this._started=null,this._doStop())}_doStart(){}_doStop(){}}_i.DURATION=700,_i.SHORT_DURATION=300;class pi{static slide(t,e){new mi(t,e)}static fadeIn(t){new gi(t,{prop:"opacity",start:"0",end:"1"})}static grow(t){new yi(t)}constructor(t,e){const s=this._createAnimation(t,e);s instanceof Animation&&(s.addEventListener("finish",(()=>{t._animationFinished(s)})),t._animationStarted(s))}}class gi extends pi{constructor(t,e){super(t,e)}_createAnimation(t,e){const s={},i={};return s[e.prop]=e.start,i[e.prop]=e.end,t.dom.animate([s,i],{duration:_i.DURATION,fill:"none"})}}class mi extends pi{constructor(t,e){super(t,e)}_createAnimation(t,e){const s=this.$_clipRect(t);let i;switch(e&&e.from){case"top":i=this.$_top(t,s,e);break;case"bottom":i=this.$_bottom(t,s,e);break;case"right":i=this.$_right(t,s,e);break;default:i=this.$_left(t,s,e)}return i.addEventListener("finish",(()=>{s.dom.remove()})),i}$_aniOptions(t){return{duration:_i.DURATION,fill:"none"}}$_clipRect(t){return t.clipRect(.1*-t.width,.1*-t.height,1.2*t.width,1.2*t.height).setTemporary()}$_left(t,e,s){return e.dom.firstElementChild.animate([{width:"0"},{width:S(t.width)}],this.$_aniOptions(s))}$_right(t,e,s){return e.dom.firstElementChild.animate([{transform:`translateX(${t.width}px)`},{transform:""}],this.$_aniOptions(s))}$_top(t,e,s){return e.dom.firstElementChild.animate([{height:"0"},{height:S(t.height)}],this.$_aniOptions(s))}$_bottom(t,e,s){return e.dom.firstElementChild.animate([{transform:`translateY(${t.height}px)`},{transform:""}],this.$_aniOptions(s))}}class yi extends _i{constructor(t){super(),this._series=t,this.start()}_doUpdate(t){if(this._series.parent)return this._series.setViewRate(t),!0}_doStop(){this._series.parent&&this._series.setViewRate(NaN),this._series=null}}class xi extends ti{constructor(t){super(t,"rct-point-label"),this.moving=!1}}class fi extends Os{constructor(t){super(t,"rct-series-labels"),this._labels=[new Ks(this,xi),new Ks(this,xi)],this._maps=[],this.setStyle("pointerEvents","none")}clear(){this._labels[0].prepare(0),this._labels[1].prepare(0)}prepareLabel(t,e,s,i,r){if(e.setVisible(i.visible&&!i.isNull)){const n=r.text,a=r.style;e.point=i,e.setModel(t,r,null),n?(r.buildSvg(e._text,r,i.getValueOf),e.setStyles(a),e._outline&&r.buildSvg(e._outline,r,i.getValueOf)):e.setText(r.getText(i.getLabel(s))).setStyles(a)}}prepare(t,e){const s=this._labels,i=e.getLabeledPoints(),r=e.pointLabel;if(r.visible){const e=this._maps;s[0].prepare(i.length),s[1].prepare(i.length),e[0]={},e[1]={},i.forEach(((i,n)=>{for(let a=0;a<i.labelCount();a++){const h=s[a].get(n);h.setVisible(!i.isNull)&&(this.prepareLabel(t,h,a,i,r),e[a][i.pid]=h)}})),this.setStyleOrClass(r.style)}else this.clear()}get(t,e){const s=this._maps[e];return s&&s[t.pid]}borrow(t){return this._labels[t].borrow()}free(t,e,s=0){e&&this._labels[t].free(e,s)}}class wi extends Os{constructor(t){super(t),this.add(this._line=new ht(t))}setLine(t){this._line.setPath(t)}}class bi extends Os{constructor(t){super(t,"rct-point-label-lines"),this._lines=new Ks(this,wi)}prepare(t){const e=this._lines,s=t.getPoints();if(t.pointLabel.visible){const t=this._map={};e.prepare(s.count).forEach(((e,i)=>{const r=s.get(i);e.visible=r.visible,t[r.pid]=e}))}else e.prepare(0)}get(t){return this._map[t.pid]}}class Pi extends rt{constructor(){super(...arguments),this.inverted=!1}invert(t,e){return t!==this.inverted&&((this.inverted=t)?this.setAttr("transform",`translate(0,${e}) rotate(90) scale(-1,1)`):this.setAttr("transform","")),this.inverted}}class vi extends js{constructor(t,e){super(t,"rct-series "+e),this._inverted=!1,this._animatable=!0,this._viewRate=NaN,this.add(this._pointContainer=new Pi(t,"rct-series-points")),this.add(this._labelContainer=new fi(t))}getClipContainer(){return this._pointContainer}setViewRate(t){isNaN(t)&&isNaN(this._viewRate)||t===this._viewRate||(this._viewRate=t,isNaN(t)?this.control.invalidateLayout():this._doViewRateChanged(t))}_doViewRateChanged(t){}_setChartOptions(t,e){this._inverted=t,this._animatable=e}_animationStarted(t){this._labelContainer&&this._labelContainer.visible&&this._labelContainer.setVisible(!1)}_animationFinished(t){this._invalidate()}pointByDom(t){return this._getPointPool().elementOf(t)}clicked(t){const e=this.pointByDom(t);e&&this._doPointClicked(e)}_doPointClicked(t){}_doMeasure(t,e,s,i,r){return this.setClip(void 0),this._prepareSeries(t,e),!this._lazyPrepareLabels()&&this._labelContainer.prepare(t,e),e.trendline.visible?(this._trendLineView||this.add(this._trendLineView=new ht(t,"rct-series-trendline")),this._trendLineView.setVisible(!0)):this._trendLineView&&this._trendLineView.setVisible(!1),ks.create(s,i)}_doLayout(){this._labelViews(),this._renderSeries(this.width,this.height),this._trendLineView&&this._trendLineView.visible&&this.$_renderTrendline(),this._afterRender(),this._animatable&&this._runShowEffect(!this.control.loaded)}_labelViews(){return this._labelContainer.setVisible(this.model.pointLabel.visible&&!this._animating()),this._labelContainer.visible&&this._labelContainer}_getViewRate(){return c(this._viewRate,1)}_animating(){return!isNaN(this._viewRate)}_lazyPrepareLabels(){return!1}_afterRender(){}_getShowAnimation(){}_runShowEffect(t){}$_renderTrendline(){const t=this.model,e=t._xAxisObj,s=t._yAxisObj,i=t.trendline._points.map((t=>({x:e.getPosition(e._length,t.x),y:s._length-s.getPosition(s._length,t.y)}))),r=new Zs;r.move(i[0].x,i[0].y),r.lines(...i),this._trendLineView.setPath(r.end(!1))}_layoutLabel(t){let{inverted:e,x:s,y:i,hPoint:r,labelView:n,labelOff:a}=t;const h=r<0,o=n.getBBounds();let l=!0;switch(e?i-=o.height/2:s-=o.width/2,t.labelPos){case te.INSIDE:e?s-=r/2+a:i+=(r-o.height)/2+a;break;case te.HEAD:e?h?s+=o.width-a:s-=o.width+a:h?i-=o.height+a:i+=a;break;case te.FOOT:e?s-=h?r+o.width+a:r-a:i+=h?r+a:r-o.height-a;break;case te.OUTSIDE:default:e?h?s-=o.width+a:s+=a:h?i+=a:i-=o.height+a,l=!1}n.setContrast(l&&t.pointView.dom),n.layout().translate(s,i)}}vi.POINT_CLASS="rct-data-point",vi.DATA_FOUCS="focus";class Vi extends ht{constructor(t){super(t,vi.POINT_CLASS+" rct-box-point"),this.labelViews=[]}}let Si=class extends Vi{layout(t,e){this.setPath(et.rect({x:t-this.wPoint/2,y:e,width:this.wPoint,height:-this.hPoint}))}};class Ai extends vi{constructor(){super(...arguments),this._labelInfo={}}_prepareSeries(t,e){this._preparePointViews(t,e,e._visPoints)}_renderSeries(t,e){this._pointContainer.invert(this._inverted,e),this._layoutPointViews(t,e)}_runShowEffect(t){t&&pi.grow(this)}_doViewRateChanged(t){this._layoutPointViews(this.width,this.height)}}class Li extends Ai{_layoutPointViews(t,e){const s=this.model,i=this._inverted,r=this._getViewRate(),n=s.pointLabel,a=this._labelViews(),h=s._xAxisObj,o=s._yAxisObj,l=h instanceof ne?2*h.categoryPad():0,u=i?t:e,d=i?e:t,_=i?0:e,p=o.getPosition(u,o.axisMin()),g=s.getBaseValue(o),m=c(o.getPosition(u,g),p),y=!isNaN(g),x=a&&Object.assign(this._labelInfo,{inverted:i,labelPos:s.getLabelPosition(n.position),labelOff:s.getLabelOff(n.offset)});this._getPointPool().forEach(((t,e)=>{const n=t.point;if(t.setVisible(!n.isNull)){const c=h.getUnitLength(d,n.xValue)*(1-l),g=s.getPointWidth(c),f=(o.getPosition(u,n.yValue)-m)*r;let w,b;w=h.getPosition(d,n.xValue)-c/2,b=_,n.xPos=w+=s.getPointPos(c)+g/2,n.yPos=b-=y&&m!==p?o.getPosition(u,n.yGroup*r):o.getPosition(u,n.yGroup)*r,this._layoutPointView(t,e,w,b+f,g,f),x&&(x.labelView=a.get(n,0))&&(i&&(b=d-h.getPosition(d,n.xValue)+c/2,w=_,n.yPos=b-=s.getPointPos(c)+g/2,n.xPos=w+=y?o.getPosition(u,n.yGroup)*r:o.getPosition(u,n.yGroup*r)),x.pointView=t,x.x=w,x.y=b,x.wPoint=g,x.hPoint=f,this._layoutLabel(x))}}))}}class Ei extends Ai{_layoutPointViews(t,e){const s=this.model,i=s.chart.isInverted(),r=this._getViewRate(),n=s.pointLabel,a=this._labelViews(),h=s._xAxisObj,o=s._yAxisObj,l=h instanceof ne?2*h.categoryPad():0,c=i?t:e,u=i?e:t,d=i?0:e,_=a&&Object.assign(this._labelInfo,{inverted:i,labelPos:s.getLabelPosition(n.position),labelOff:s.getLabelOff(n.offset)});this._getPointPool().forEach(((t,e)=>{const n=t.point;if(t.setVisible(!n.isNull)){const p=h.getUnitLength(u,n.xValue)*(1-l),g=s.getPointWidth(p),m=(o.getPosition(c,n.yValue)-o.getPosition(c,this._getLowValue(n)))*r;let y=h.getPosition(u,n.xValue)-p/2,x=d;n.xPos=y+=s.getPointPos(p)+g/2,n.yPos=x-=o.getPosition(c,n.yGroup)*r,this._layoutPointView(t,e,y,x,g,m),a&&(i&&(x=u-h.getPosition(u,n.xValue)+p/2,y=d,n.yPos=x-=s.getPointPos(p)+g/2,n.xPos=y+=o.getPosition(c,n.yGroup)*r),_.pointView=t,_.hPoint=m,_.x=y,_.y=x,(_.labelView=a.get(n,0))&&(_.hPoint=m,this._layoutLabel(_)),(_.labelView=a.get(n,1))&&(i?_.x-=m:_.y+=m,_.hPoint=-m,this._layoutLabel(_)))}}))}}class Ni extends ht{constructor(t){super(t,vi.POINT_CLASS+" rct-line-point-marker")}}class Ti extends it{constructor(){super(...arguments),this.inverted=!1}invert(t,e){return t!==this.inverted&&((this.inverted=t)?this.dom.style.transform=`translate(${e}px, ${e}px) rotate(-90deg) scale(1, -1)`:this.dom.style.transform=""),this.inverted}}class Ci extends vi{constructor(t,e){super(t,e),this._needBelow=!1,this.insertFirst(this._lineContainer=new Ti(t,"rct-line-series-lines")),this._lineContainer.add(this._line=new ht(t,"rct-line-series-line")),this._markers=new Ks(this._pointContainer,Ni)}getClipContainer(){return null}_getPointPool(){return this._markers}_prepareSeries(t,e){this.$_prepareMarkers(e._visPoints)}_renderSeries(t,e){const s=this.model;this._lineContainer.invert(this._inverted,e),s instanceof We&&this._prepareBelow(s,t,e),this._layoutMarkers(s._visPoints,t,e),this._layoutLines(s._visPoints)}_runShowEffect(t){this._polar?t&&pi.grow(this):t&&pi.slide(this,{from:function(t){const e=t.model._xAxisObj.reversed;return t._inverted?e?"top":"bottom":e?"right":"left"}(this)})}_doViewRateChanged(t){this._layoutMarkers(this.model._visPoints,this.width,this.height),this._layoutLines(this.model._visPoints.slice())}_markersPerPoint(){return 1}_prepareBelow(t,e,s){const i=this.control;t._yAxisObj;let r=this._lowLine;if(this._needBelow=t.belowStyle&&t._minValue<t.baseValue,this._needBelow)return r||(this._lineContainer.insertChild(r=this._lowLine=new ht(this.doc),this._line),this._upperClip=i.clipBounds(),this._lowerClip=i.clipBounds()),this._line.setClip(this._upperClip),r.setClip(this._lowerClip),!0;null==r||r.setClip(),this._line.setClip()}$_resetClips(t,e,s,i){const r=this.model._yAxisObj.reversed;let n;(n=this._upperClip)&&(i?r?n.setBounds(0,e-s,e,t):n.setBounds(0,e-t,e,t-s):r?n.setBounds(0,0+s,t,e-s):n.setBounds(0,0,t,s)),(n=this._lowerClip)&&(this._inverted?r?n.setBounds(0,e-t,e,t-s):n.setBounds(0,e-s,e,t):r?n.setBounds(0,0,t,s):n.setBounds(0,0+s,t,e-s))}$_prepareMarkers(t){const e=this.model.marker;if(this._pointContainer.visible=e.visible){const s=this._markersPerPoint(),i=t.length;this._markers.prepare(i*s,((s,r)=>{const n=t[r%i];n.isNull||(n.radius=e.radius,n.shape=e.shape,s.point=n)}))}}_layoutMarker(t,e,s){const i=this.model.color,r=t.point,n=r.shape,a=r.radius;let h;switch(n){case"square":case"diamond":case"triangle":case"itriangle":e-=a,s-=a,h=et[n](0,0,2*a,2*a);break;default:h=et.circle(0,0,a)}t.translate(e,s),t.setPath(h),t.setStyle("stroke","gray"),t.setStyle("fill",i)}_layoutMarkers(t,e,s){const i=this.model,r=this._inverted,n=this._polar=i.chart.body.getPolar(i),a=this._getViewRate(),h=i.marker.visible,o=i.pointLabel.offset,l=this._labelViews(),c=i._xAxisObj,u=i._yAxisObj,d=r?e:s,_=r?s:e,p=s;for(let e=0,s=t.length;e<s;e++){const s=t[e];let i,g;if(n){const t=n.start+e*n.deg,r=u.getPosition(n.rd,s.yGroup)*a;i=s.xPos=n.cx+r*Math.cos(t),g=s.yPos=n.cy+r*Math.sin(t)}else i=s.xPos=c.getPosition(_,s.xValue),g=s.yPos=p-u.getPosition(d,s.yGroup),r&&(i=u.getPosition(d,s.yGroup),g=p-c.getPosition(_,s.xValue));const m=this._markers.get(e),y=l&&l.get(s,0);if(m&&m.setVisible(!s.isNull)){if(this._layoutMarker(m,i,g),y){const t=y.getBBounds();y.visible=!0,y.translate(i-t.width/2,g-t.height-o-(h?s.radius:0))}}else y&&(y.visible=!1)}}_layoutLines(t){const e=this.model,s=new Zs;let i,r=0;for(;r<t.length;){const e=t[r++];if(!e.isNull){s.move(e.xPos,e.yPos);break}}if(this._linePts=t,r<t.length-1&&(this._buildLines(t,r,s),this._line.setPath(i=s.end(this._polar)),this._line.clearStyleAndClass(),this._line.setStyle("stroke",e.color),this._line.addStyleOrClass(e.style),z.setImportantStyle(this._line.dom.style,"fill","none"),e instanceof We&&this._needBelow)){const t=e._yAxisObj,s=e.baseValue;this._inverted?this.$_resetClips(this.width,this.height,t.getPosition(this.width,s),!0):this.$_resetClips(this.width,this.height,this.height-t.getPosition(this.height,s),!1),this._lowLine.setPath(i),this._lowLine.clearStyleAndClass(),this._lowLine.setStyle("stroke",e.color),this._lowLine.addStyleOrClass(e.style),this._lowLine.addStyleOrClass(e.belowStyle),z.setImportantStyle(this._lowLine.dom.style,"fill","none")}}_buildLines(t,e,s){const i=this.model,r=i.getLineType();r===Nt.SPLINE?this._drawCurve(t,e-1,s):i instanceof We&&r===Nt.STEP?this._drawStep(t,e,s,i.stepDir):this._drawLine(t,e,s)}_drawLine(t,e,s){const i=t.length;let r=e;for(;r<i;)if(t[r].isNull){do{r++}while(r<i&&t[r].isNull);r<i&&(s.move(t[r].xPos,t[r].yPos),r++)}else s.line(t[r].xPos,t[r].yPos),r++}_drawCurve(t,e,s){const i=t.length;let r;if(t&&t.length>1){let n=e;for(r=e;r<i;)if(t[r].isNull){r-1>n&&this.$_drawCurve(t,n,r-1,s);do{r++}while(r<i&&t[r].isNull);n=r,r<i&&(s.move(t[r].xPos,t[r].yPos),r++)}else r++;r-1>n&&this.$_drawCurve(t,n,r-1,s)}}$_drawCurve(t,e,s,i){let r=e;if(1===Math.abs(s-e))return void i.line(t[r+1].xPos,t[r+1].yPos);const n=.23,a={x:0,y:0},h={x:0,y:0},o={x:0,y:0},l={x:t[r+1].xPos-t[r].xPos,y:t[r+1].yPos-t[r].yPos},c={x:0,y:0},u={x:0,y:0},d={x:0,y:0};let _={x:0,y:0},p=Math.sqrt(l.x*l.x+l.y*l.y);l.x/=p,l.y/=p;let g=t[r+1].xPos-t[r].xPos,m=t[r].xPos,y=t[r].yPos;for(++r;r!=s;r++){o.x=-l.x,o.y=-l.y,l.x=t[r+1].xPos-t[r].xPos,l.y=t[r+1].yPos-t[r].yPos,p=Math.sqrt(l.x*l.x+l.y*l.y),l.x/=p,l.y/=p,l.x<o.x?(_.x=o.x-l.x,_.y=o.y-l.y):(_.x=l.x-o.x,_.y=l.y-o.y);const s=Math.sqrt(_.x*_.x+_.y*_.y);_.x/=s,_.y/=s,o.y*l.y>=0&&(_={x:1,y:0}),a.x=-_.x*g*n,a.y=-_.y*g*n,r===e+1?i.quad(t[r].xPos+a.x,t[r].yPos+a.y,t[r].xPos,t[r].yPos):(c.x=m+h.x,c.y=y+h.y,u.x=t[r].xPos+a.x,u.y=t[r].yPos+a.y,d.x=(c.x+u.x)/2,d.y=(c.y+u.y)/2,i.quad(c.x,c.y,d.x,d.y),i.quad(u.x,u.y,t[r].xPos,t[r].yPos)),g=t[r+1].xPos-t[r].xPos,h.x=_.x*g*n,h.y=_.y*g*n,m=t[r].xPos,y=t[r].yPos}i.quad(m+h.x,y+h.y,t[r].xPos,t[r].yPos)}_drawStep(t,e,s,i){const r=t.length;let n=e;for(;n<r;)if(t[n].isNull){do{n++}while(n<r&&t[n].isNull);n<r&&(s.move(t[n].xPos,t[n].yPos),n++)}else i===Ge.BACKWARD?(s.line(t[n-1].xPos,t[n].yPos),s.line(t[n].xPos,t[n].yPos)):(s.line(t[n].xPos,t[n-1].yPos),s.line(t[n].xPos,t[n].yPos)),n++}}class Mi extends Ci{constructor(t){super(t,Mi.CLASS)}}Mi.CLASS="rct-line-series";class ki extends ht{static create(t,e,s,i,r,n,a,h,o=!0){return new ki(t,e,{cx:s,cy:i,rx:r,ry:n,innerRadius:0,start:a,angle:h,clockwise:o})}static createInner(t,e="",s,i,r,n,a,h,o,l=!0){return new ki(t,e,{cx:s,cy:i,rx:r,ry:n,innerRadius:a,start:h,angle:o,clockwise:l})}constructor(t,e=y,s=y){super(t,e),this.cx=0,this.cy=0,this.rx=0,this.ry=0,this.innerRadius=0,this.start=0,this.angle=0,this.clockwise=!0,this.rate=1,s&&this._assignShape(s),this.setAttr("role","img")}equals(t){return t.cx===this.cx&&t.cy===this.cy&&t.rx===this.rx&&t.ry===this.ry&&t.innerRadius===this.innerRadius&&t.start===this.start&&t.angle===this.angle&&t.clockwise===this.clockwise}setSector(t){this._assignShape(t)}_getShape(){return{cx:this.cx,cy:this.cy,rx:this.rx,ry:this.ry,innerRadius:this.innerRadius,start:this.start,angle:this.angle,clockwise:this.clockwise}}_assignShape(t){this.cx=t.cx,this.cy=t.cy,this.rx=t.rx,this.ry=t.ry,this.innerRadius=t.innerRadius,this.start=t.start,this.angle=t.angle,this.clockwise=t.clockwise,this._updateShape()}_updateShape(){this.setPath(et.sector(this.cx,this.cy,this.rx*this.rate,this.ry*this.rate,this.innerRadius||0,this.start,this.start+this.angle,this.clockwise))}}class Oi extends ki{constructor(t){super(t,vi.POINT_CLASS+" rct-bar-point")}}class Bi extends Os{constructor(t){super(t,vi.POINT_CLASS+" rct-boxplot-point")}layout(){const t=this.point,e=this.width,s=this.height,i=t.yValue-t.minValue,r=e/2;const n=0+s-s*(t.lowValue-t.minValue)/i,a=0+s-s*(t.highValue-t.minValue)/i,h=s*(t.highValue-t.lowValue)/i;this._box.setStyle("fill",t.color),this._stemUp.setVLine(r,0,a),this._stemDown.setVLine(r,n,s),this._min.setHLine(0,e/4,3*e/4),this._max.setHLine(0+s,e/4,3*e/4),this._box.setBox(0,a,e,h),this._mid.setHLine(0+s-s*(t.midValue-t.minValue)/i,0,e)}_doInitChildren(t){this.add(this._stemUp=new Bs(t,"rct-boxplot-point-stem")),this.add(this._stemDown=new Bs(t,"rct-boxplot-point-stem")),this.add(this._box=new Hs(t,"rct-boxplot-point-box")),this.add(this._mid=new Bs(t,"rct-boxplot-point-mid")),this.add(this._min=new Bs(t,"rct-boxplot-point-min")),this.add(this._max=new Bs(t,"rct-boxplot-point-max"))}}let Di=class extends ht{constructor(t){super(t,vi.POINT_CLASS+" rct-bubble-point-marker")}};let Ri=class extends Os{constructor(t){super(t,vi.POINT_CLASS+" rct-candlestick-point")}layout(){const t=this.point,e=this.width,s=this.height,i=t.highValue-t.lowValue;const r=0+s-s*(Math.min(t.openValue,t.closeValue)-t.lowValue)/i,n=0+s-s*(Math.max(t.openValue,t.closeValue)-t.lowValue)/i,a=Math.min(n,r),h=Math.max(1,Math.abs(r-n)),o=t.close<t.open;this._body.setStyle("fill",o?"":t.color),this._wickUpper.setVLine(0,0,n),this._wickLower.setVLine(0,r,s),this._body.setBox(-e/2,a,e,h),this._body.setStyleName(o?"rct-candlestick-point-fall":"")}_doInitChildren(t){this.add(this._wickUpper=new Bs(t,"rct-candlestick-point-wick")),this.add(this._wickLower=new Bs(t,"rct-candlestick-point-wick")),this.add(this._body=new Hs(t))}};let Ii=class extends Os{constructor(t){super(t,vi.POINT_CLASS+" rct-dumbbell-point"),this.add(this._line=new Bs(t)),this.add(this._hmarker=new ht(t,"rct-dumbbell-point-marker")),this.add(this._lmarker=new ht(t,"rct-dumbbell-point-marker"))}layout(t){const e=this.point.hPoint;return t?(this._line.setHLineC(0,0,e),this._hmarker.renderShape(this.point.shape,0,0,this.point.radius),this._lmarker.renderShape(this.point.shape,e,0,this.point.radius)):(this._line.setVLineC(0,0,e),this._hmarker.renderShape(this.point.shape,0,0,this.point.radius),this._lmarker.renderShape(this.point.shape,0,e,this.point.radius)),this}};let $i=class extends Os{constructor(t){super(t,vi.POINT_CLASS+" rct-equalizer-point"),this._backs=new Ks(this,ht),this._segments=new Ks(this,ht),this._decimal=0}prepareSegments(t,e,s,i,r){this._decimal=i,this._backs.prepare(t?e:0).forEach(((t,e)=>{t.setStyleName(r)})),this._segments.prepare(Math.round(s)).forEach(((t,e)=>{}))}layout(t,e,s){const i=this.wPoint,r=this.hPoint,n=r<0?Math.max:Math.min;e-=i/2,r<0&&(t=t.map((t=>-t))),this._backs.forEach(((e,r)=>{e.setPath(et.rectangle(0,s-t[2*r],i,n(-1,t[2*r]-t[2*r+1])))})),this._segments.forEach(((a,h,o)=>{h===o-1&&this._decimal>0?a.setPath(et.rectangle(e,s-t[2*h],i,r<0?n(1,this._decimal):n(-1,-this._decimal))):a.setPath(et.rectangle(e,s-t[2*h],i,n(-1,t[2*h]-t[2*h+1])))}))}};let Fi=class extends Os{constructor(t){super(t,vi.POINT_CLASS+" rct-errorbar-point"),this.add(this._stem=new Bs(t)),this.add(this._whiskerUp=new Bs(t)),this.add(this._whiskerDown=new Bs(t))}layout(){const t=this.width,e=this.height,s=t/2;this._stem.setVLine(s,0,e),this._whiskerUp.setHLine(0,0,t),this._whiskerDown.setHLine(e,0,t)}};class zi extends ht{constructor(t){super(t,vi.POINT_CLASS+" rct-funnel-point")}}class Hi extends Hs{constructor(t){super(t,vi.POINT_CLASS+" rct-heatmap-point")}}let Gi=class extends Vi{layout(t,e){this.setPath(et.rect({x:t-this.wPoint/2,y:e,width:this.wPoint,height:-this.hPoint}))}};let ji=class extends Os{constructor(t){super(t,vi.POINT_CLASS+" rct-lollipop-point"),this.add(this._line=new Bs(t)),this.add(this._marker=new ht(t,"rct-lollipop-point-marker"))}layout(){this._line.setVLineC(0,0,this.height),this._marker.renderShape(this.point.shape,0,0,this.point.radius)}};class Ui extends Os{constructor(t){super(t,vi.POINT_CLASS+" rct-ohlc-point")}layout(){const t=this.point,e=this.width,s=this.height,i=t.highValue-t.lowValue,r=-e/2;const n=0+s-s*(Math.min(t.openValue,t.closeValue)-t.lowValue)/i,a=0+s-s*(Math.max(t.openValue,t.closeValue)-t.lowValue)/i;this._back.setBox(r,0,e,s),this._tickOpen.setHLine(n,r,0),this._tickClose.setHLine(a,0,this.width),this._bar.setVLine(0,0,0+s),this._bar.setStyleName(t.close<t.open?"rct-ohlc-point-bar-fall":"rct-ohlc-point-bar")}_doInitChildren(t){this.add(this._tickOpen=new Bs(t,"rct-ohlc-point-tick")),this.add(this._tickClose=new Bs(t,"rct-ohlc-point-tick")),this.add(this._bar=new Bs(t)),this.add(this._back=new Hs(t,"rct-ohlc-point-back")),z.setImportantStyle(this._back.dom.style,"fill","transparent")}}class Wi extends it{constructor(t,e,s,i,r){super(t,e,"circle"),"number"==typeof s&&this.setCircle(s,i,r)}setCircle(t,e,s){this.setAttrs({cx:t,cy:e,r:s})}}class qi extends ki{constructor(t){super(t,vi.POINT_CLASS+" rct-pie-point")}setSectorEx(t,e,s,i=!1){let r=!1;return i?r=!0:this._assignShape(s),r}}class Yi extends ht{constructor(t){super(t,vi.POINT_CLASS+" rct-scatter-point-marker")}}class Xi extends ht{constructor(t){super(t,vi.POINT_CLASS+" rct-treemap-point")}get point(){return this.node.point}render(){this.setPath(et.rect(this.node))}}class Ki extends ht{constructor(t){super(t,vi.POINT_CLASS+" rct-vector-point")}layout(t,e,s){const i=this.point._len,r=this.point._off,n=.5;let a;switch(t){case vs.NONE:a=[0,-.5*i,0,n*i];break;case vs.OPEN:const t=.15,e=.45,s=.2;a=[0,-e*i,-t*i,-s*i,0,-.5*i,t*i,-s*i,0,-e*i,0,n*i];break;default:const r=.1,h=.3;a=[0,-h*i,-r*i,-h*i,0,-.5*i,r*i,-h*i,0,-h*i,0,n*i]}const h=["M",a[0],a[1]+r];for(let t=2;t<a.length;t+=2)h.push("L",a[t],a[t+1]+r);this.rotation=e,this.setPath(h)}}class Qi extends Vi{layout(t,e){this.setPath(et.rect({x:t-this.wPoint/2,y:e,width:this.wPoint,height:-this.hPoint}))}}const Zi={area:class extends Ci{constructor(t){super(t,"rct-area-series"),this._lineContainer.insertFirst(this._area=new ht(t,"rct-area-series-area"))}_layoutLines(t){super._layoutLines(t),this._polar?this._layoutPolar(this._area,t):this._layoutArea(this._area,t)}_prepareBelow(t,e,s){var i;let r=this._lowArea;if(this._area.setStyle("fill",this.model.color),null===(i=this._lowArea)||void 0===i||i.setStyle("fill",this.model.color),super._prepareBelow(t,e,s))return r||this._lineContainer.insertChild(r=this._lowArea=new ht(this.doc,"rct-area-series-area"),this._area),this._area.setClip(this._upperClip),r.setClip(this._lowerClip),!0;null==r||r.setClip(),this._area.setClip()}_layoutMarkers(t,e,s){super._layoutMarkers(t,e,s);const i=this.model._yAxisObj,r=s;for(let e=0,n=t.length;e<n;e++){const n=t[e];n.yLow=r-i.getPosition(s,n.yGroup-n.yValue)}}_layoutArea(t,e){const s=this.model,i=this._needBelow?this._lowArea:void 0,r=s.group,n=s.chart.isInverted(),a=s._yAxisObj,h=n?this.width:this.height,o=s.getBaseValue(a),l=this.height-a.getPosition(h,c(o,a.axisMin())),u=new Zs;let d,_=0;for(;_<e.length&&e[_].isNull;)_++;if(!r||r.layout!==_e.STACK&&r.layout!==_e.FILL){u.move(e[_].xPos,l),u.line(e[_].xPos,e[_].yPos),this._buildLines(e,_+1,u);const t=u._path;for(_=6;_<t.length;)"M"===t[_]?(t.splice(_,0,"L",t[_-2],l),_+=3,t.splice(_,0,"M",t[_+1],l),t[_+3]="L",_+=6):"Q"===t[_]?_+=4:_+=3;u.line(t[t.length-2],l)}else{const t=_;for(u.move(e[_].xPos,e[_].yLow),u.line(e[_].xPos,e[_].yPos),_++;_<e.length;)u.line(e[_].xPos,e[_].yPos),_++;for(_=e.length-1,u.line(e[_].xPos,e[_].yLow);_>=t;)u.line(e[_].xPos,e[_].yLow),_--}t.setPath(d=u.end()),t.clearStyleAndClass(),t.setStyle("fill",s.color),t.addStyleOrClass(s.style),i&&(i.setPath(d),i.clearStyleAndClass(),i.setStyle("fill",s.color),i.setStyleOrClass(s.style),i.setStyleOrClass(s.belowStyle))}_layoutPolar(t,e){const s=this.model,i=s.group,r=s._yAxisObj,n=r instanceof Ce?s.getBaseValue(r):NaN,a=this.height;r.getPosition(a,X.isNotEmpty(n)?n:r.axisMax());const h=new Zs;if(!i||i.layout!==_e.STACK&&i.layout!==_e.FILL){h.move(e[0].xPos,e[0].yPos);for(let t=1;t<e.length;t++)h.line(e[t].xPos,e[t].yPos);t.setPath(h.end())}else{h.move(e[0].xPos,e[0].yLow),h.line(e[0].xPos,e[0].yPos);for(let t=1;t<e.length;t++)h.line(e[t].xPos,e[t].yPos);h.line(e[e.length-1].xPos,e[e.length-1].yLow);for(let t=e.length-1;t>=0;t--)h.line(e[t].xPos,e[t].yLow);t.setPath(h.end())}t.clearStyleAndClass(),t.setStyle("fill",s.color),t.addStyleOrClass(s.style)}},arearange:class extends Ci{constructor(t){super(t,"rct-area-range"),this.insertFirst(this._areaContainer=new Ti(t,"rct-area-series-areas")),this._areaContainer.add(this._area=new ht(t,"rct-area-series-area")),this._lineContainer.add(this._lowerLine=new ht(t,"rct-line-series-line")),z.setImportantStyle(this._lowerLine.dom.style,"fill","none")}_markersPerPoint(){return 2}_renderSeries(t,e){this._areaContainer.invert(this.model.chart.isInverted(),e),super._renderSeries(t,e)}_layoutMarkers(t,e,s){super._layoutMarkers(t,e,s);const i=this.model,r=this._inverted,n=i._yAxisObj,a=r?e:s,h=s;for(let e=0,s=t.length;e<s;e++){const s=t[e];s.yLow=h-n.getPosition(a,s.lowValue)}if(i.marker.visible){const e=this._markers;for(let s=0,i=t.length;s<i;s++){const h=t[s],o=e.get(s+i);let l,c;h.isNull?o.visible=!1:(o.visible=!0,r?(l=n.getPosition(a,h.lowValue),c=e.get(s).ty):(l=h.xPos,c=h.yLow),this._layoutMarker(o,l,c))}}}_layoutLines(t){super._layoutLines(t);const e=t.map((t=>({xPos:t.xPos,yPos:t.yLow,isNull:t.isNull}))).slice().reverse(),s=new Zs;let i=0;for(;i<e.length&&e[i].isNull;)i++;s.move(e[i].xPos,e[i].yPos),this._buildLines(e,i+1,s),this._lowerLine.setPath(s.end(!1)),this._lowerLine.setStyle("stroke",this.model.color),this.$_layoutArea(this._area,this._linePts,e)}$_layoutArea(t,e,s){const i=new Zs;let r=0;for(;r<e.length&&e[r].isNull;)r++;const n=e.length;let a,h,o,l=r++;for(;r<n;)if(e[r].isNull){for(a=r,a>l&&(h=e.slice(l,a),o=s.slice(n-a,n-l),i.move(h[0].xPos,h[0].yPos),this._buildLines(h,1,i),i.line(o[0].xPos,o[0].yPos),this._buildLines(o,1,i));r<n&&e[r].isNull;)r++;l=r}else r++;r>l&&(a=r,h=e.slice(l,a),o=s.slice(n-a,n-l),i.move(h[0].xPos,h[0].yPos),this._buildLines(h,1,i),i.line(o[0].xPos,o[0].yPos),this._buildLines(o,1,i)),t.setPath(i.end())}},bar:class extends Li{constructor(t){super(t,"rct-bar-series"),this._labelInfo={}}_getPointPool(){return this.chart()._polar?this._sectors:this._bars}_preparePointViews(t,e,s){e.chart._polar?this.$_parepareSectors(t,e,e._visPoints):this.$_parepareBars(t,e,e._visPoints)}_layoutPointViews(t,e){this.model.chart._polar?this.$_layoutSectors():super._layoutPointViews(t,e)}_layoutPointView(t,e,s,i,r,n){t.wPoint=r,t.hPoint=n,t.layout(s,i)}$_parepareBars(t,e,s){const i=e.style;this._bars||(this._bars=new Ks(this._pointContainer,Si)),this._bars.prepare(s.length,((t,e)=>{const r=t.point=s[e];t.setStyleOrClass(i),r.color&&t.setStyle("fill",r.color)}))}$_parepareSectors(t,e,s){const i=e.style;this._sectors||(this._sectors=new Ks(this._pointContainer,Oi)),this._sectors.prepare(s.length,((t,e)=>{const r=t.point=s[e];t.setStyleOrClass(i),r.color&&t.setStyle("fill",r.color)}))}$_layoutSectors(){const t=this.model,e=this._getViewRate(),s=t.pointLabel,i=this._labelViews(),r=t.chart.body,n=t._xAxisObj,a=t._yAxisObj,h=r.getPolar(t),o=i&&Object.assign(this._labelInfo,{labelPos:t.getLabelPosition(s.position),labelOff:t.getLabelOff(s.offset)});this._sectors.forEach(((s,r)=>{const l=s.point,c=a.getPosition(h.rd,l.yGroup)*e,u=n.getUnitLength(2*Math.PI,l.xValue),d=t.getPointWidth(u);if(s.setSector({cx:h.cx,cy:h.cy,rx:c,ry:c,start:h.start+r*h.deg,angle:d,clockwise:!0}),i&&(o.labelView=i.get(l,0))){const t=s.start+s.angle,e=s.cx+s.rx/2*Math.cos(t),i=s.cy+s.ry/2*Math.sin(t),r=o.labelView.getBBounds();o.labelView._text.anchor=Rs.MIDDLE,o.labelView.translate(e-r.width/2,i-r.height/2)}}))}},barrange:class extends Ei{constructor(t){super(t,"rct-barrange-series"),this._bars=new Ks(this._pointContainer,Si)}_getPointPool(){return this._bars}_preparePointViews(t,e,s){this._bars.prepare(s.length,((t,e)=>{t.point=s[e],t.setStyle("fill",s[e].color)}))}_getLowValue(t){return t.lowValue}_layoutPointView(t,e,s,i,r,n){t.wPoint=r,t.hPoint=n,t.layout(s,i+n)}},bellcurve:class extends Ci{constructor(t){super(t,"rct-bellcurve-series")}},boxplot:class extends Ei{constructor(t){super(t,"rct-boxplot-series"),this._boxes=new Ks(this._pointContainer,Bi)}_getPointPool(){return this._boxes}_getLowValue(t){return t.minValue}_layoutPointView(t,e,s,i,r,n){t.setBounds(s-r/2,i,r,n),t.layout()}_preparePointViews(t,e,s){this._boxes.prepare(s.length,((t,e)=>{t.point=s[e]}))}},bubble:class extends vi{constructor(t){super(t,"rct-bubble-series"),this._markers=new Ks(this._pointContainer,Di)}_getPointPool(){return this._markers}_prepareSeries(t,e){e.getPoints().getVisibles(),this.$_prepareMarkser(e._visPoints)}_renderSeries(t,e){this.$_layoutMarkers(t,e)}_runShowEffect(t){t&&pi.grow(this)}_doViewRateChanged(t){this.$_layoutMarkers(this.width,this.height)}$_prepareMarkser(t){const e=this.model,s=(e._xAxisObj._length<e._yAxisObj._length?e._xAxisObj:e._yAxisObj)._length,i=e.marker,r=t.length,{min:n,max:a}=e.getPxMinMax(s);this._markers.prepare(r,((s,r)=>{const h=s.point=t[r];h.radius=e.getRadius(h.zValue,n,a),h.shape=i.shape,h.color&&s.setStyle("fill",h.color)}))}$_layoutMarkers(t,e){const s=this.model,i=this._inverted,r=this._getViewRate();s.pointLabel.offset;const n=this._labelViews(),a=s._xAxisObj,h=s._yAxisObj,o=i?t:e,l=i?e:t,c=e;let u,d;this._markers.forEach(((t,e)=>{const s=t.point;if(t.setVisible(!s.isNull&&!isNaN(s.zValue))){const e=s.radius*r;let _,p,g;p=s.xPos=a.getPosition(l,s.xValue),g=s.yPos=c-h.getPosition(o,s.yValue),i&&(p=h.getPosition(o,s.yGroup),g=c-a.getPosition(l,s.xValue)),_=et.circle(0,0,e),t.setPath(_),t.translate(p,g),n&&(u=n.get(s,0))&&(u.setContrast(t.dom),u.layout(),d=u.getBBounds(),u.setVisible(d.width<=s.radius)&&u.translate(p-d.width/2,g-d.height/2))}}))}},candlestick:class extends Ei{constructor(t){super(t,"rct-candlestick-series"),this._sticks=new Ks(this._pointContainer,Ri)}_getPointPool(){return this._sticks}_getLowValue(t){return t.lowValue}_preparePointViews(t,e,s){this._sticks.prepare(s.length,((t,e)=>{t.point=s[e]}))}_layoutPointView(t,e,s,i,r,n){t.setBounds(s,i,r,n),t.layout()}},dumbbell:class extends vi{constructor(t){super(t,"rct-dumbbell-series"),this._labelInfo={}}_getPointPool(){return this._bars}_prepareSeries(t,e){this.$_parepareBars(t,e,e._visPoints)}_renderSeries(t,e){this.$_layoutBars(t,e)}_runShowEffect(t){t&&pi.grow(this)}_doViewRateChanged(t){this.$_layoutBars(this.width,this.height)}$_parepareBars(t,e,s){const i=e.style;this._bars||(this._bars=new Ks(this._pointContainer,Ii)),this._bars.prepare(s.length,((t,e)=>{t.point=s[e],t.setStyle("fill",s[e].color),t.setStyleOrClass(i)}))}$_layoutBars(t,e){const s=this.model,i=s.chart.isInverted(),r=this._getViewRate(),n=s.pointLabel.offset,a=this._labelViews(),h=s._xAxisObj,o=s._yAxisObj,l=h instanceof ne?2*h.categoryPad():0,c=i?t:e,u=i?e:t,d=i?0:e;this._bars.forEach(((t,e)=>{const _=t.point;if(t.setVisible(!_.isNull)){const e=h.getUnitLength(u,_.xValue)*(1-l),p=s.getPointWidth(e),g=o.getPosition(c,_.yValue),m=Math.abs(o.getPosition(c,_.lowValue)-g)*r;let y,x,f;if(i?(f=u-h.getPosition(u,_.xValue),x=d):(x=h.getPosition(u,_.xValue),f=d),i?(_.yPos=f+=s.getPointPos(e)-p/2,_.xPos=x+=o.getPosition(c,_.yGroup)*r,x-=m):(_.xPos=x+=s.getPointPos(e)-p/2,_.yPos=f-=o.getPosition(c,_.yGroup)*r),_.hPoint=m,t.layout(i).translate(x,f),a){if(y=a.get(_,1)){const t=y.getBBounds();i?y.translate(x+m+n+_.radius,f-t.height/2):y.translate(x-t.width/2,f-t.height-n-_.radius)}if(y=a.get(_,0)){const t=y.getBBounds();i?y.translate(x-t.width-n-_.radius,f-t.height/2):y.translate(x-t.width/2,f+m+n+_.radius)}}}}))}},equalizer:class extends Li{constructor(t){super(t,"rct-equalizer-series"),this._bars=new Ks(this._pointContainer,$i)}_getPointPool(){return this._bars}_preparePointViews(t,e,s){this.$_parepareBars(s)}_layoutPointViews(t,e){const s=(this._inverted?t:e)*this._getViewRate();this.$_buildSegments(this.model,s),super._layoutPointViews(t,e)}_layoutPointView(t,e,s,i,r,n){t.wPoint=r,t.hPoint=n,t.layout(this._pts,s,i)}$_parepareBars(t){this._bars.prepare(t.length,((e,s)=>{const i=e.point=t[s];i.color&&e.setStyle("fill",i.color)}))}$_buildSegments(t,e){const s=t.backSegments,i=t._yAxisObj.axisMax(),r=t.segmented,n=t.segmentGap||0,a=this._pts=[];let h,o,l=0;for(o=t.maxCount>0?t.maxCount:Math.round(e/(t.getSegmentSize(e)+n/2)),h=(e-n*(o-1))/o;a.length<2*o;)a.push(l,l+h),l+=h+n;a[a.length-1]=e;const c=a.length/2;this._bars.forEach((n=>{const o=n.point;if(n.setVisible(!o.isNull)){const l=o.yValue/i;let u=-1,d=0;for(let t=0;t<c-1;t++)if(l>=a[2*t]/e&&l<a[2*(t+1)]/e){u=t+1,d=!r&&l<a[2*t+1]/e?l*e-a[2*t]:h;break}u<0&&(u=c,d=h),n.prepareSegments(s,c,u,d,t.backStyle)}}))}},errorbar:class extends Ei{constructor(t){super(t,"rct-errorbar-series"),this._bars=new Ks(this._pointContainer,Fi)}_getPointPool(){return this._bars}_getLowValue(t){return t.lowValue}_preparePointViews(t,e,s){this._bars.prepare(s.length,((t,e)=>{t.point=s[e],t.setStyle("stroke",s[e].color)}))}_layoutPointView(t,e,s,i,r,n){t.setBounds(s-r/2,i,r,n),t.layout()}},funnel:class extends vi{constructor(t){super(t,"rct-funnel-series"),this._segments=new Ks(this._pointContainer,zi)}_getPointPool(){return this._segments}_prepareSeries(t,e){this.$_prepareSegments(e._visPoints)}_renderSeries(t,e){this.$_layoutSegments(t,e)}_runShowEffect(t){t&&pi.slide(this,{from:this.model.reversed?"bottom":"top"})}$_prepareSegments(t){const e=t.length;this._segments.prepare(e,((e,s)=>{const i=t[s];e.point=i,e.setStyle("fill",i.color)}))}$_layoutSegments(t,e){function s(t){return n?l+(g-l)*(u-t)/(u-p):l+(g-l)*(t-c)/(p-c)}const i=this.model;i.pointLabel;const r=this._labelViews(),n=i.reversed,a=i.getSize(t,e),h=i.getNeckSize(t,e),o=new Zs,l=(t-a.width)/2,c=(e-a.height)/2,u=c+a.height,d=l+a.width/2,_=a.height-h.height,p=n?u-_:c+_,g=l+(a.width-h.width)/2;let m;this._segments.forEach((t=>{const e=t.point;if(t.setVisible(!e.isNull)){const i=e.yPos*a.height,l=(e.yPos+e.height)*a.height,y=n?u-i:c+i,x=n?u-l:c+l;let f,w,b,P;i>=_?(f=g,w=f+h.width,o.move(f,y).lines(w,y,w,x,f,x)):l<_?(f=s(y),w=f+2*(d-f),b=s(x),P=b+2*(d-b),o.move(f,y).lines(w,y,P,x,b,x)):(f=s(y),w=f+2*(d-f),b=g,P=b+h.width,o.move(f,y).lines(w,y,P,p,P,x,b,x,b,p));const v=o.close(!0);if(t.setPath(v),e.xPos=d,e.yPos=y+(x-y)/2,r&&(m=r.get(e,0))){const t=m.getBBounds();m.translate(d-t.width/2,y+(x-y-t.height)/2)}}}))}},heatmap:class extends vi{constructor(t){super(t,"rct-heatmap-series"),this._cells=new Ks(this._pointContainer,Hi)}_getPointPool(){return this._cells}_prepareSeries(t,e){this.$_parepareCells(e._visPoints)}_renderSeries(t,e){this._pointContainer.invert(this._inverted,e),this.$_layoutCells(t,e)}_runShowEffect(t){t&&pi.slide(this)}$_parepareCells(t){this._cells.prepare(t.length,((e,s)=>{e.point=t[s]}))}$_layoutCells(t,e){const s=this.model,i=s.chart.isInverted();s.pointLabel.offset;const r=this._labelViews(),n=s._xAxisObj,a=s._yAxisObj,h=i?t:e,o=i?e:t,l=new Ds(s.color);this._cells.forEach((t=>{const c=t.point;if(t.setVisible(!c.isNull)){const u=n.getUnitLength(o,c.xValue),d=u,_=a.getUnitLength(h,c.yValue),p=_,g=i?0:e;let m,y,x;if(m=(c.xPos=n.getPosition(o,c.xValue))-u/2,y=(c.yPos=g-a.getPosition(h,c.yValue))-_/2,t.setBounds(m,y,d,p),t.setStyle("fill",l.brighten(1-c.colorValue/s._colorMax).toString()),r&&(x=r.get(c,0))){const t=x.getBBounds();i?(y=o-n.getPosition(o,c.xValue),m=g,y-=t.height/2,m+=a.getPosition(h,c.yValue)-t.width/2):(m+=(d-t.width)/2,y+=(p-t.height)/2),x.translate(m,y)}}}))}},histogram:class extends Ai{constructor(t){super(t,"rct-histogram-series"),this._bars=new Ks(this._pointContainer,Gi)}_getPointPool(){return this._bars}_preparePointViews(t,e,s){this.$_parepareBars(t,s)}_layoutPointView(t,e,s,i,r,n){t.wPoint=r,t.hPoint=n,t.layout(s,i)}_layoutPointViews(t,e){const s=this.model,i=this._inverted,r=this._getViewRate(),n=s.pointLabel,a=this._labelViews(),h=s._xAxisObj,o=s._yAxisObj,l=i?t:e,c=i?e:t,u=o.getPosition(l,s.getBaseValue(o)),d=i?0:e,_=a&&Object.assign(this._labelInfo,{inverted:i,labelPos:s.getLabelPosition(n.position),labelOff:s.getLabelOff(n.offset)});this._getPointPool().forEach(((t,e)=>{const s=t.point,n=h.getPosition(c,s.min),p=h.getPosition(c,s.max),g=o.getPosition(l,s.yValue),m=p-n+(p>n?-1:1),y=g-u;let x=n+(p-n)/2,f=d;s.xPos=x,s.yPos=f-=g,this._layoutPointView(t,e,x,f+y,m,y*r),_&&(_.labelView=a.get(s,0))&&(i&&(f=c-x,x=d,s.yPos=f,s.xPos=x+=o.getPosition(l,s.yGroup)),_.pointView=t,_.x=x,_.y=f,_.wPoint=m,_.hPoint=y,this._layoutLabel(_))}))}$_parepareBars(t,e){this._bars.prepare(e.length,((t,s)=>{t.point=e[s]}))}$_layoutBars(t,e){const s=this.model._xAxisObj,i=this.model._yAxisObj,r=this.height,n=this._getViewRate();this._bars.forEach(((a,h)=>{const o=a.point,l=s.getPosition(t,o.min),c=s.getPosition(t,o.max),u=l+(c-l)/2,d=i.getPosition(e,a.point.yValue)*n,_=Math.max(1,c-l-1);o.xPos=u,o.yPos=r-d,a.wPoint=_,a.hPoint=d,a.layout(u,r)}))}},line:Mi,lollipop:class extends Li{constructor(t){super(t,"rct-lollipop-series")}_getPointPool(){return this._bars}_preparePointViews(t,e,s){this.$_parepareBars(t,e,s)}_layoutPointView(t,e,s,i,r,n){t.setBounds(s,i-n,0,n),t.layout()}$_parepareBars(t,e,s){const i=e.style;this._bars||(this._bars=new Ks(this._pointContainer,ji)),this._bars.prepare(s.length,((t,e)=>{t.point=s[e],t.setStyle("fill",s[e].color),t.setStyleOrClass(i)}))}},ohlc:class extends Ei{constructor(t){super(t,"rct-ohlc-series"),this._sticks=new Ks(this._pointContainer,Ui)}_getPointPool(){return this._sticks}_getLowValue(t){return t.lowValue}_preparePointViews(t,e,s){this.$_prepareSticks(s)}_layoutPointView(t,e,s,i,r,n){t.setBounds(s,i,r,n),t.layout()}$_prepareSticks(t){this._sticks.prepare(t.length,((e,s)=>{e.point=t[s]}))}$_layoutSticks(t,e){const s=this.model;this._inverted;const i=this._getViewRate(),r=s.pointLabel.offset,n=this._labelViews(),a=s._xAxisObj,h=s._yAxisObj,o=this.height;this._sticks.forEach(((l,c)=>{const u=l.point;if(l.setVisible(!u.isNull)){const c=a.getUnitLength(t,u.xValue),d=s.getPointWidth(c),_=(u.xPos=a.getPosition(t,u.xValue))-d/2,p=u.yPos=o-h.getPosition(e,u.yValue)*i,g=d,m=Math.abs(o-h.getPosition(e,u.lowValue)-p)*i;let y;if(l.setBounds(_,p,g,m),l.layout(),n&&(y=n.get(u,0))){const t=y.getBBounds();y.translate(_+(g-t.width)/2,p-t.height-r)}}}))}},pareto:class extends Ci{constructor(t){super(t,"rct-pareto-series")}},pie:class extends vi{constructor(t){super(t,"rct-pie-series"),this._sectors=new Ks(this._pointContainer,qi,null,.5),this._cx=0,this._cy=0,this._rd=0,this._rdInner=0,this._slicedOff=0,this.add(this._circle=new Wi(t)),this._circle.setStyles({stroke:"#aaa",fill:"none",strokeDasharray:"2"}),this.add(this._lineContainer=new bi(t))}_getPointPool(){return this._sectors}_prepareSeries(t,e){this.$_prepareSectors(e._visPoints),this._lineContainer.prepare(e)}_renderSeries(t,e){isNaN(this.model._groupPos)?this.$_calcNormal(t,e):this.$_calcGroup(t,e),this.$_layoutSectors(this.model._visPoints,t,e)}$_calcNormal(t,e){const s=this.model.getSize(t,e);this._rd=Math.floor(s/2),this._rdInner=this.model.getInnerRadius(this._rd)}$_calcGroup(t,e){const s=this.model,i=s.group,r=Math.floor(i?i.getPolarSize(t,e)/2:s.getSize(t,e)/2),n=i?i.getInnerRadius(r)*r:s.getInnerRadius(r),a=r-n;this._rd=n+(s._groupPos+s._groupSize)*a,this._rdInner=(n+s._groupPos*a)/this._rd}_runShowEffect(t){t&&pi.grow(this)}_doPointClicked(t){}$_prepareSectors(t){const e=t.length;this._sectors.prepare(e,((e,s)=>{const i=t[s];e.point=i,e.setAttr("aria-label",i.ariaHint()),e.setStyle("fill",i.color)}))}$_calcAngles(t){const e=this._getViewRate(),s=t.map((t=>t.yValue)).reduce(((t,e)=>t+e),0);let i=f+V(this.model.startAngle);t.forEach((t=>{t.yRate=t.yValue/s,t.startAngle=i,i+=t.angle=t.yRate*Math.PI*2*e}))}$_layoutSectors(t,e,s){const i=this.model,r=this._getViewRate(),n=this._cx=Math.floor(e/2),a=this._cy=Math.floor(s/2),h=this._rd,o=this._rdInner,l=i.pointLabel,c=i.getLabelPosition();l.offset;const u=this._labelViews(),d=this._lineContainer,_=this._slicedOff=i.getSliceOffset(h)*r,p=new Zs;let g;(this._circle.visible=this._sectors.isEmpty)&&this._circle.setCircle(this._cx,this._cy,this._rd),this.$_calcAngles(t),this._sectors.forEach((t=>{const e=t.point,s=e.startAngle;let i=0,r=0;if(e.sliced){const t=s+e.angle/2;i+=Math.cos(t)*_,r+=Math.sin(t)*_}const l=e.startAngle+e.angle/2;if(e.xPos=n+Math.cos(l)*(_+.7*h),e.yPos=a+Math.sin(l)*(_+.7*h),t.setSectorEx(u,null,{cx:n+i,cy:a+r,rx:h,ry:h,innerRadius:o,start:s,angle:e.angle,clockwise:!0},!1),u&&(g=u.get(e,0))){const s=d.get(e);c?(s.visible=!1,this.$_layoutLabelInner(e,g,0,0,e.sliced?_:0)):(s.visible=!0,this.$_layoutLabel(e,g,s,0,0,e.sliced?_:0,p)),g.setContrast(c&&t.dom)}}))}$_layoutLabel(t,e,s,i,r,n,a){const h=e.getBBounds(),o=t.startAngle+t.angle/2,l=X.isLeft(o);let c,u=this._cx,d=this._cy,_=this._rd+.8*r,p=Math.cos(o)*n,g=Math.sin(o)*n,m=u+Math.cos(o)*this._rd,y=d+Math.sin(o)*this._rd,x=u+Math.cos(o)*_,f=d+Math.sin(o)*_;c=l?x-.2*r:x+.2*r,s&&(s.visible=!0,s.move(m,y),s.setLine(a.move(0,0).quad(x-m,f-y,c-m,f-y).end()),!e.moving&&s.translate(m+p,y+g)),l?(c-=h.width+i,f-=h.height/2):(c+=i,f-=h.height/2),e.move(c,f),!e.moving&&e.layout().translate(c+p,f+g)}$_layoutLabelInner(t,e,s,i,r){const n=e.getBBounds(),a=t.startAngle+t.angle/2;let h=this._cx+Math.cos(a)*(r+.7*this._rd),o=this._cy+Math.sin(a)*(r+.7*this._rd);e.layout().translate(h-n.width/2,o-n.height/2)}_doViewRateChanged(t){this.$_layoutSectors(this.model._visPoints,this.width,this.height)}},scatter:class extends vi{constructor(t){super(t,"rct-scatter-series"),this._markers=new Ks(this._pointContainer,Yi)}_getPointPool(){return this._markers}_prepareSeries(t,e){this.$_prepareMarkers(e._visPoints)}_renderSeries(t,e){this.$_layoutMarkers(t,e)}_runShowEffect(t){t&&pi.slide(this)}$_prepareMarkers(t){const e=this.model,s=e.color;e.marker;const i=t.length;this._pointContainer.setStyle("fill",s),this._markers.prepare(i,((e,s)=>{const i=t[s];e.point=i}))}$_layoutMarkers(t,e){const s=this.model,i=this._inverted,r=s.marker;s.pointLabel.offset;const n=this._labelViews(),a=s._xAxisObj,h=s._yAxisObj,o=i?t:e,l=i?e:t,c=e;let u,d;this._markers.forEach(((t,e)=>{const s=t.point;if(t.setVisible(!s.isNull)){const e=r.shape,_=r.radius;let p,g,m;switch(g=s.xPos=a.getPosition(l,s.xValue),m=s.yPos=c-h.getPosition(o,s.yValue),i&&(g=h.getPosition(o,s.yGroup),m=c-a.getPosition(l,s.xValue)),e){case"square":case"diamond":case"triangle":case"itriangle":p=et[e](0-_,0-_,2*_,2*_);break;default:p=et.circle(0,0,_)}t.setPath(p),t.translate(g,m),n&&(u=n.get(s,0))&&(d=u.getBBounds(),u.translate(g-d.width/2,m-d.height/2))}}))}},treemap:class extends vi{constructor(t){super(t,"rct-Treemap-series"),this._nodeViews=new Ks(this._pointContainer,Xi)}_lazyPrepareLabels(){return!0}_getPointPool(){return this._nodeViews}_prepareSeries(t,e){}_renderSeries(t,e){const s=this.model;s.pointLabel;const i=this._labelViews(),r=s.buildMap(t,e),n=new Ds(s.color);let a;i.prepare(this.doc,s),this._nodeViews.prepare(r.length,((t,e,s)=>{const h=r[e],o=h.parent;let l=n;if(o&&(!o._color&&o.point.color&&(l=o._color=new Ds(o.point.color)),o._color&&(l=o._color)),t.node=h,t.setStyle("fill",l.brighten(h.index/s).toString()),t.render(),h.point.xPos=h.x+h.width/2,h.point.yPos=h.y+h.height/2,i&&(a=i.get(h.point,0))){const t=a.getBBounds();a.setVisible(h.width>=t.height&&h.height>=t.height)&&a.translate(h.x+h.width/2-t.width/2,h.y+h.height/2-t.height/2)}}))}_runShowEffect(t){t&&new mi(this)}},vector:class extends vi{constructor(t){super(t,"rct-vector-series"),this._arrows=new Ks(this._pointContainer,Ki)}_getPointPool(){return this._arrows}_prepareSeries(t,e){const s=e.getPoints().getVisibles();this.$_prepareArrows(s)}_renderSeries(t,e){const s=this.model,i=s.startAngle,r=s.arrowHead,n=s._xAxisObj,a=s._yAxisObj;this._arrows.forEach((t=>{const e=t.point;if(t.setVisible(!e.isNull)){const s=e.xPos=n.getPosition(this.width,e.xValue),h=e.yPos=this.height-a.getPosition(this.height,e.yValue);t.translate(s,h),t.layout(r,e.angleValue+i,!1)}}))}_runShowEffect(t){t&&pi.fadeIn(this)}$_prepareArrows(t){this._arrows.prepare(t.length,((e,s)=>{e.point=t[s],e.setStyle("stroke",e.point.color)}))}},waterfall:class extends Ei{constructor(t){super(t,"rct-Waterfall-series"),this._bars=new Ks(this._pointContainer,Qi),this.add(this._lineContainer=new rt(t,"rct-waterfall-series-lines")),this._lines=new Ks(this._lineContainer,Bs)}_getPointPool(){return this._bars}_getLowValue(t){return t.low}_preparePointViews(t,e,s){this.$_parepareBars(t,s)}_layoutPointView(t,e,s,i,r,n){const a=t.point;if(t.wPoint=r,t.hPoint=n,i+=n,t.layout(s,i),e>0){const t=this._lines.get(e-1),h=a._isSum?i-n:a.y>=0?i:i-n;t.setHLine(h,this._xPrev+this._wPrev/2,s-r/2)}this._xPrev=s,this._wPrev=r}_layoutPointViews(t,e){this._inverted?this._lineContainer.dom.style.transform=`translate(0px, ${e}px) rotate(90deg) scale(-1, 1)`:this._lineContainer.dom.style.transform="",super._layoutPointViews(t,e)}$_parepareBars(t,e){this._bars.prepare(e.length,((t,s)=>{const i=e[s];t.point=i,t.setStyleOrClass(i._isSum?"rct-waterfall-point-sum":i.y<0?"rct-waterfall-point-negative":"")})),this._lines.prepare(e.length-1,((t,s)=>{t.visible=!e[s].isNull&&!e[s+1].isNull}))}}};class Ji extends js{constructor(t){super(t,"rct-axis-grid"),this._lines=new Ks(this,Bs)}_doMeasure(t,e,s,i,r){return this._pts=e.getPoints(e.axis._isHorz?s:i),this._lines.prepare(this._pts.length,(t=>{})),ks.create(s,i)}_doLayout(){const t=this.model.axis,e=this.width,s=this.height,i=this._pts;t._isHorz?this._lines.forEach(((t,e)=>{t.setVLineC(i[e],0,s)})):this._lines.forEach(((t,r)=>{t.setHLineC(s-i[r],0,e)}))}}class tr extends it{constructor(t){super(t,"rct-axis-break"),this.add(this._mask=new ht(t))}setModel(t){this._model=t}layout(t,e){const s=this._model,i=new Zs;i.rect(0,0,t,s._sect.len),this._mask.setPath(i.end())}}class er extends it{constructor(t){super(t,"rct-axis-guide"),this.add(this._label=new Fs(t,"rct-axis-guide-label"))}vertical(){return this.model.axis._isHorz}prepare(t){this.model=t,this._label.text=t.label.text,this._label.setStyles(t.label.style)}}class sr extends er{constructor(t){super(t),this.insertFirst(this._line=new Bs(t,"rct-axis-guide-line"))}prepare(t){super.prepare(t),this._line.setStyles(t.style)}layout(t,e){const s=this.model,i=s.label,r=this._label;let n,a,h,o;if(this.vertical()){const r=s.axis.getPosition(t,s.value,!0);switch(this._line.setVLineC(r,0,e),i.align){case B.CENTER:n=r,h=Rs.MIDDLE;break;case B.RIGHT:n=r,h=Rs.START;break;default:n=r,h=Rs.END}switch(i.valign){case D.BOTTOM:a=e,o=Is.BOTTOM;break;case D.MIDDLE:a=e/2,o=Is.MIDDLE;break;default:a=0,o=Is.TOP}}else{const l=e-s.axis.getPosition(e,s.value,!0);switch(this._line.setHLineC(l,0,t),i.align){case B.CENTER:n=t/2,h=Rs.MIDDLE;break;case B.RIGHT:n=t,h=Rs.END;break;default:n=0,h=Rs.START}switch(i.valign){case D.BOTTOM:a=l+1,o=Is.TOP;break;case D.MIDDLE:a=l,o=Is.MIDDLE;break;default:a=l-r.getBBounds().height,o=Is.TOP}}r.anchor=h,r.layout=o,r.translate(n,a)}}class ir extends er{constructor(t){super(t),this.insertFirst(this._box=new Gs(t,"rct-axis-guide-range"))}prepare(t){super.prepare(t)}layout(t,e){const s=this.model,i=this._label;if(this.vertical()){const r=s.axis.getPosition(t,s.start,!0),n=s.axis.getPosition(t,s.end,!0);let a,h,o,l;switch(s.label.align){case B.CENTER:a+=(n-r)/2,o=Rs.MIDDLE;break;case B.RIGHT:a=n,o=Rs.END;break;default:a=r,o=Rs.START}switch(s.label.valign){case D.BOTTOM:h=e,l=Is.BOTTOM;break;case D.MIDDLE:h=e/2,l=Is.MIDDLE;break;default:h=0,l=Is.TOP}i.anchor=o,i.layout=l,i.translate(a,h),this._box.setBox(r,0,n,e)}else{const r=e-this.model.axis.getPosition(e,Math.min(s.start,s.end),!0),n=e-this.model.axis.getPosition(e,Math.max(s.start,s.end),!0);let a,h,o,l;switch(s.label.align){case B.CENTER:a=t/2,o=Rs.MIDDLE;break;case B.RIGHT:a=t,o=Rs.END;break;default:a=0,o=Rs.START}switch(s.label.valign){case D.BOTTOM:h=r,l=Is.BOTTOM;break;case D.MIDDLE:h=n+(r-n)/2,l=Is.MIDDLE;break;default:h=n,l=Is.TOP}i.anchor=o,i.layout=l,i.translate(a,h),this._box.setBox(0,n,t,r)}}}class rr extends rt{constructor(){super(...arguments),this._linePool=[],this._rangePool=[],this._views=[]}prepare(){const t=this._views;for(let e=t.length-1;e>=0;e--){const e=t.pop();e.remove(),e instanceof ir?this._rangePool.push(e):this._linePool.push(e)}M(0===t.length,"GuideContainer.prepare")}addAll(t,e){e.forEach((e=>{if(e instanceof zt){let s=this._rangePool.pop()||new ir(t);this.add(s),s.prepare(e),this._views.push(s)}else if(e instanceof Ft){let s=this._linePool.pop()||new sr(t);this.add(s),s.prepare(e),this._views.push(s)}}))}add(t){return this._views.push(t),super.add(t)}}class nr extends Bs{constructor(t){super(t,"rct-crosshair-line"),this.setStyle("pointerEvents","none")}setModel(t){t!=this._model&&(this._model=t)}layout(t,e,s,i){this._model.axis._isHorz?this.setVLine(t,0,i):this.setHLine(e,0,s)}}class ar extends js{constructor(t,e){super(t,ar.BODY_CLASS),this._gridViews=new Map,this._breakViews=[],this._seriesViews=[],this._seriesMap=new Map,this._focused=null,this._owner=e,this.add(this._background=new Hs(t,"rct-plot-background")),this.add(this._image=new Js(t,"rct-plot-image")),this.add(this._gridContainer=new rt(t,"rct-grids")),this.add(this._guideContainer=new rr(t,"rct-guides")),this.add(this._seriesContainer=new rt(t,"rct-series-container")),this.add(this._axisBreakContainer=new rt(t,"rct-axis-breaks")),this.add(this._frontGuideContainer=new rr(t,"rct-front-guides")),this.add(this._feedbackContainer=new rt(t,"rct-feedbacks")),this._crosshairLines=new Ks(this._feedbackContainer,nr)}prepareGuideContainers(){this._guideContainer.prepare(),this._frontGuideContainer.prepare()}pointerMoved(t,e){const s=this.width,i=this.height;if(this._crosshairLines.forEach((e=>{e.setVisible(t.x>=0&&t.x<s&&t.y>=0&&t.y<i)&&e.layout(t.x,t.y,s,i)})),e instanceof SVGElement&&(e.classList.contains(vi.POINT_CLASS)||e.parentElement instanceof SVGElement&&e.parentElement.classList.contains(vi.POINT_CLASS)))for(let t=this._seriesViews.length-1;t>=0;t--){const s=this._seriesViews[t].pointByDom(e);if(s){this.$_setFocused(this._seriesViews[t].model,s);break}}else this.$_setFocused(null,null)}$_setFocused(t,e){if(e!=this._focused)return this._focused&&this._focused.unsetData(vi.DATA_FOUCS),this._focused=e,this._focused?(this._focused.setData(vi.DATA_FOUCS),this._owner.showTooltip(t,e.point)):this._owner.hideTooltip(),!0}seriesByDom(t){return this._seriesViews.find((e=>e.dom.contains(t)))}_doMeasure(t,e,s,i,r){const n=e.chart;if(this._background.setStyleOrClass(e.style),this.$_prepareSeries(t,n._getSeries().visibleSeries()),this._seriesViews.forEach(((e,n)=>{e.measure(t,this._series[n],s,i,r)})),this._polar=n._polar,!this._polar){this.$_prepareGrids(t,n);for(const e of this._gridViews.keys())this._gridViews.get(e).measure(t,e.grid,s,i,r);this.$_prepareAxisBreaks(t,n),this.$_preppareCrosshairs(t,n)}return ks.create(s,i)}_doLayout(){const t=this.width,e=this.height,s=this._image;if(this._background.resize(t,e),s.setVisible(s.setImage(this.model.image.url,t,e))&&s.setStyleOrClass(this.model.image.style),this._seriesViews.forEach((s=>{this._owner.clipSeries(s.getClipContainer(),0,0,t,e),s.resize(t,e),s.layout()})),!this._polar){for(const s of this._gridViews.values())s.resize(t,e),s.layout();this._breakViews.forEach((s=>{s.translate(0,e-s._model._sect.pos-s._model._sect.len),s.layout(t,e)})),[this._guideContainer,this._frontGuideContainer].forEach((s=>{s._views.forEach((s=>s.layout(t,e)))}))}}$_createSeriesView(t,e){return new(Zi[e._type()])(t)}$_prepareGrids(t,e){const s=e.needAxes(),i=this._gridContainer,r=this._gridViews;for(const t of r.keys())s&&e.containsAxis(t)&&t.grid.isVisible()||(r.get(t).remove(),r.delete(t));[e._getXAxes(),e._getYAxes()].forEach((e=>e.forEach((e=>{if(s&&e.grid.isVisible()&&!r.has(e)){const s=new Ji(t);r.set(e,s),i.add(s)}}))))}$_prepareSeries(t,e){const s=this._seriesContainer,i=this.model.chart.isInverted(),r=this.model.chart.animatable(),n=this._seriesMap,a=this._seriesViews;for(const t of n.keys())e.indexOf(t)<0&&n.delete(t);this._series=e,a.forEach((t=>t.remove())),a.length=0,e.forEach((e=>{const h=n.get(e)||this.$_createSeriesView(t,e);h._setChartOptions(i,r),s.add(h),n.set(e,h),a.push(h)}))}$_prepareAxisBreaks(t,e){const s=this._axisBreakContainer,i=this._breakViews,r=[];for([e._getXAxes(),e._getYAxes()].forEach((t=>t.forEach((t=>{t instanceof Ce&&r.push(...t.runBreaks()||[])}))));i.length<r.length;){const e=new tr(t);s.add(e),i.push(e)}for(;i.length>r.length;)i.pop().remove();i.forEach(((t,e)=>t.setModel(r[e])))}$_preppareCrosshairs(t,e){const s=this._crosshairLines,i=[];[e._getXAxes(),e._getYAxes()].forEach((t=>t.forEach((t=>{t.crosshair.visible&&i.push(t.crosshair)})))),s.prepare(i.length,((t,e)=>{t.setModel(i[e])}))}}ar.BODY_CLASS="rct-plot";class hr extends js{constructor(t){super(t,"rct-legend-item"),this.add(this._marker=Hs.create(t,"rct-legend-item-marker",0,0,12,12,6)),this.add(this._label=new Fs(t,"rct-legend-item-label")),this._label.anchor=Rs.START}_doMeasure(t,e,s,i,r){z.setData(this._label.dom,"hidden",e.source.visible?"":1),z.setData(this._marker.dom,"hidden",e.source.visible?"":1),this._label.text=e.text();const n=Q(this._label.getBBounds());return this._gap=c(e.legend.markerGap,0),ks.create(this._marker.width+this._gap+n.width,Math.max(this._marker.height,n.height))}_doLayout(){this._marker.translate(0,(this.height-this._marker.height)/2),this._label.translate(this._marker.width+this._gap,(this.height-this._label.getBBounds().height)/2)}}class or extends Us{constructor(t){super(t,or.LEGEND_CLASS,"rct-legend-background"),this._itemViews=new Ks(this,hr)}legendByDom(t){const e=this._itemViews.elementOf(t);return e&&e.model}_setBackgroundStyle(t){t.setStyleOrClass(this.model.backgroundStyles)}_doMeasure(t,e,s,i,r){const n=e.items(),a=this._vertical=e.getLayout()===Et.VERTICAL,h=e.itemGap,o=this._itemViews;let l=0,c=0;return this.$_prepareItems(t,n),o.forEach(((e,h)=>{e._marker.setStyle("fill",n[h].source.legendColor());const o=e.measure(t,n[h],s,i,r);a?(l=Math.max(l,o.width),c+=o.height):(c=Math.max(c,o.height),l+=o.width)})),a?c+=(o.count-1)*h:l+=(o.count-1)*h,ks.create(l,c)}_doLayout(){const t=this._vertical,e=this.model.itemGap,s=this._margins,i=this._paddings;let r=s.left,n=s.top;r+=i.left,n+=i.top,this._itemViews.forEach((s=>{s.resizeByMeasured().layout(),s.translate(r,n),t?n+=s.height+e:r+=s.width+e}))}$_prepareItems(t,e){this._itemViews.prepare(e.length)}}or.LEGEND_CLASS="rct-legend";class lr extends it{constructor(t){super(t,"rct-polar-axis-tick-mark"),this.add(this._lineView=new Wi(t))}layout(){}}class cr extends it{constructor(t,e){super(t,e),this.add(this._markContainer=new rt(t,"rct-polar-axis-markers")),this._markViews=new Ks(this._markContainer,lr),this.add(this._gridContainer=new it(t,"rct-polar-axis-grids")),this.add(this._labelContainer=new rt(t,"rct-polar-axis-labels")),this._labelViews=new Ks(this._labelContainer,Fs)}prepare(t,e){this._model=e,this._markLen=e.tick.length,this.$_prepareTickMarks(t,e),this.$_prepareLabels(t,e),this._doPrepare(e,e._ticks)}layout(t,e,s,i){const r=this._model._ticks;return this._doLayout(this._model,e,s,i,r,t),this}$_prepareTickMarks(t,e){this._markViews.prepare(e._ticks.length)}$_prepareLabels(t,e){const s=e._ticks;this._labelViews.prepare(s.length,((t,e)=>{t.text=s[e].label}),(t=>{t.anchor=Rs.START}))}}class ur extends cr{constructor(t){super(t,"rct-polar-xaxis"),this._gridLines=new Ks(this._gridContainer,Bs,"rct-polar-xaxis-grid-line"),this.add(this._lineView=new Wi(t,"rct-polar-xaxis-line")),this._lineView.setStyle("fill","none")}_doPrepare(t,e){this._gridLines.prepare(e.length),this._lineView.visible=t.line.visible}_doLayout(t,e,s,i,r,n){const a=t.chart.startAngle();this._gridLines.forEach(((t,n)=>{const h=r[n].pos*Math.PI*2,o=e+Math.cos(a+h)*i,l=s+Math.sin(a+h)*i;t.setLine(e,s,o,l)}));const h=i+t.tick.length;this._labelViews.forEach(((t,i)=>{const n=r[i];t.anchor=Rs.MIDDLE,t.layout=Is.MIDDLE,t.text=n.label;const o=t.getBBounds(),l=n.pos*Math.PI*2,c=e+Math.cos(a+l)*(h+o.width/2),u=s+Math.sin(a+l)*(h+o.height/2);t.translate(c,u)})),this._lineView.setCircle(e,s,i)}}class dr extends cr{constructor(t){super(t,"rct-polar-yaxis"),this._gridLines=new Ks(this._gridContainer,Wi,"rct-polar-yaxis-grid-line"),this.add(this._lineView=new Bs(t,"rct-polar-yaxis-line"))}_doPrepare(t,e){this._gridLines.prepare(e.length,null,(t=>{t.setStyle("fill","none")})),this._lineView.visible=t.line.visible}_doLayout(t,e,s,i,r,n){this._gridLines.forEach(((t,i)=>{const n=r[i];t.setCircle(e,s,n.pos)})),this._labelViews.forEach(((t,i)=>{const n=r[i];t.anchor=Rs.END,t.layout=Is.MIDDLE,t.text=n.label,t.translate(e-4,s-n.pos)})),this._lineView.setVLine(e,s,s-i)}}class _r extends ar{constructor(){super(...arguments),this._yAxisViews=[]}_doMeasure(t,e,s,i,r){const n=e.chart,a=super._doMeasure(t,e,s,i,r);return this.$_prepareAxes(t,n.xAxis,n._getYAxes().items),a}_doLayout(){const t=this.model,e=t.getSize(this.width,this.height),s=t._rd=t.getSize(this.width,this.height)/2,{cx:i,cy:r}=t.getCenter(this.width,this.height);t._cx=i,t._cy=r,this._seriesViews.forEach((t=>{t.resize(e,e),t.layout()})),this._xAxisView.layout(t.chart.yAxis,i,r,s),this._yAxisViews.forEach((t=>{t.layout(null,i,r,s)}))}$_prepareAxes(t,e,s){this._axisContainer||(this.add(this._axisContainer=new it(t,"rct-polar-axes")),this._axisContainer.add(this._xAxisView=new ur(t))),this._xAxisView.prepare(t,e);const i=this._yAxisViews;for(;i.length<s.length;){const e=new dr(t);this._axisContainer.add(e),i.push(e)}for(;i.length>s.length;)i.pop().remove();i.forEach(((e,i)=>e.prepare(t,s[i])))}}class pr extends Us{constructor(t,e){super(t,e?pr.SUBTITLE_CLASS:pr.TITLE_CLASS,e?"rct-subtitle-background":"rct-title-background"),this.add(this._textView=new Fs(t)),this._textView.anchor=Rs.START}_setBackgroundStyle(t){t.setStyleOrClass(this.model.backgroundStyle)}_doMeasure(t,e,s,i,r){return this._textView.text=this.model.text,Q(this._textView.getBBounds())}_doLayout(){this._textView.translate(this._margins.left+this._paddings.left,this._margins.top+this._paddings.top),this._textView.layoutText()}}pr.TITLE_CLASS="rct-title",pr.SUBTITLE_CLASS="rct-subtitle";class gr extends it{constructor(t){super(t,"rct-tooltip"),this._textCallback=(t,e)=>this._model.getValue(t,e),this._hideHandler=()=>{this.$_hide(),this._hideTimer=void 0},this.add(this._back=new ht(t,"rct-tooltip-back")),this.add(this._textView=new Fs(t,"rct-tooltip-text")),this._back.setAttr("filter","url(#"+st.SHADOW_FILTER+")"),this._textView.anchor=Rs.START,this._richText=new wt,this._richText.lineHeight=1.2,this.hide(!0,!1)}show(t,e,s,i,r){this._model=t,this._textView,this._richText.format=t.text,this._richText.build(this._textView,e,this._textCallback);const n=this._textView.getBBounds(),a=Math.max(t.minWidth||0,n.width+16),h=Math.max(t.minHeight||0,n.height+12),o=new Zs;o.rect(0,0,a,h),this._back.setPath(o.end(!0)),this._textView.translate((a-n.width)/2,(h-n.height)/2);const l=this.tx,c=this.ty;t.series.chart.isInverted()?this.translate(s+t.offset,i-h/2):this.translate(s-a/2,i-h-t.offset),this._hideTimer&&(clearTimeout(this._hideTimer),this._hideTimer=void 0),"visible"===this.getStyle("visibility")?this.dom.animate([{transform:`translate(${l}px,${c}px)`},{transform:`translate(${this.tx}px,${this.ty}px)`}],{duration:300,fill:"none"}):this.setStyle("visibility","visible")}hide(t,e){t?(this._hideTimer&&(clearTimeout(this._hideTimer),this._hideTimer=void 0),this.$_hide()):this._hideTimer||(this._hideTimer=setTimeout(this._hideHandler,this._model?this._model.hideDelay:Zt.HIDE_DELAY))}$_hide(){!function(t,e,s,i,r){const n=function(t,e){const s={};return s[t]=e,s}(e,s),a=t.animate([{},n],{duration:i,fill:"none"});a&&r&&a.addEventListener("finish",r)}(this.dom,"opacity",0,200,(()=>{this.setStyle("visibility","hidden")}))}}class mr extends Os{measure(t,e,s,i,r){const n=this._doMeasure(t,e,s,i,r);return this.mw=n.width,this.mh=n.height,n}resizeByMeasured(){return this.resize(this.mw,this.mh),this}layout(t){return this._doLayout(t),this}}class yr extends mr{_doInitChildren(t){this.add(this.titleView=new pr(t,!1)),this.add(this.subtitleView=new pr(t,!0))}_doMeasure(t,e,s,i,r){const n=this.titleView,a=this.subtitleView;let h,o=s,l=0;return(n.visible=e.title.isVisible())&&(h=n.measure(t,e.title,s,i,r),l+=h.height,i-=h.height),(a.visible=e.subtitle.isVisible())&&(h=a.measure(t,e.subtitle,s,i,r),l+=h.height,i-=h.height),{width:o,height:l}}_doLayout(t){const e=this.titleView,s=this.subtitleView,i=e.model,r=s.model,n=t.width;let a=0;if(e.visible){let t=0;switch(e.resizeByMeasured().layout(),i.align){case B.LEFT:break;case B.RIGHT:t+=n-e.width;break;default:t+=(n-e.width)/2}e.translate(t,a),a+=e.height}if(s.visible){let t=0;switch(s.resizeByMeasured().layout(),r.position,r.align){case B.LEFT:break;case B.RIGHT:t+=n-s.width;break;default:t+=(n-s.width)/2}s.translate(t,a)}}}class xr extends mr{_doInitChildren(t){this.add(this._legendView=new or(t))}_doMeasure(t,e,s,i,r){return this._legendView.measure(t,e.legend,s,i,r)}_doLayout(){this._legendView.resize(this.width,this.height),this._legendView.layout()}}class fr extends mr{constructor(t,e){super(t),this.dir=e,this.views=[],this._gap=0}prepare(t,e,s,i){const r=this.views;for(;r.length<e.length;){const e=new Xs(t);this.add(e),r.push(e)}for(;r.length>e.length;)r.pop().remove();r.forEach(((r,n)=>{r.model=e[n],r.prepareGuides(t,s,i)})),this.axes=e,(this.visible=r.length>0)&&(this.isHorz=r[0].model._isHorz,this._gap=r[0].model.chart.getAxesGap())}checkHeights(t,e,s){let i=0;return this.views.forEach((r=>{i+=r.checkHeight(t,e,s)})),i+(this.views.length-1)*this._gap}checkWidths(t,e,s){let i=0;return this.views.forEach((r=>{i+=r.checkWidth(t,e,s)})),i+(this.views.length-1)*this._gap}_doMeasure(t,e,s,i,r){const n=this.axes;let a=0,h=0;return this.views.forEach(((e,o)=>{const l=e.measure(t,n[o],s,i,r);e.setAttr("xy",n[o]._isX?"x":"y"),a+=l.width,h+=l.height})),this.isHorz?h+=(this.views.length-1)*this._gap:a+=(this.views.length-1)*this._gap,ks.create(a,h)}_doLayout(){const t=this.width,e=this.height;let s=0;this.views.forEach((i=>{this.isHorz?i.resize(t,i.mh):i.resize(i.mw,e),i.layout(),this.isHorz?(i.translateY(this.dir===R.TOP?e-s-i.mh:s),s+=i.mh+this._gap):(i.translateX(this.dir===R.RIGHT?s:t-s-i.mw),s+=i.mw+this._gap),i.move(undefined,undefined)}))}}class wr extends Os{}class br extends it{constructor(t){super(t,"rct-chart"),this._inverted=!1,this._axisSectionViews=new Map,Object.values(R).forEach((e=>{if(l(e)){const s=new fr(t,e);this.add(s),this._axisSectionViews.set(e,s)}})),this.add(this._currBody=this._bodyView=new ar(t,this)),this.add(this._titleSectionView=new yr(t)),this.add(this._legendSectionView=new xr(t)),this.add(this._tooltipView=new gr(t))}titleView(){return this._titleSectionView.titleView}subtitleView(){return this._titleSectionView.subtitleView}bodyView(){return this._bodyView}measure(t,e,s,i,r){if(e&&1==r&&e.prepareRender(),this.$_checkEmpty(t,e,s,i))return;const n=this._model=e,a=n._polar,h=n.legend;let o,l=s,c=i;if(this._inverted=e.isInverted(),o=this._titleSectionView.measure(t,n,l,c,r),c-=o.height,this._legendSectionView.visible=h.isVisible())switch(o=this._legendSectionView.measure(t,n,l,c,r),h.position){case At.TOP:case At.BOTTOM:c-=o.height;break;case At.RIGHT:case At.LEFT:l-=o.width}this.$_prepareBody(t,a),a?this.$_measurePolar(t,n,l,c,1):this.$_measurePlot(t,n,l,c,1)}layout(){var t;const e=this._model;let s=this.width,i=this.height;if(null===(t=this._emptyView)||void 0===t?void 0:t.visible)return void this._emptyView.resize(s,i);const r=e.options.polar,n=e.legend;let a=0,h=0;const o=this._titleSectionView;let l=0;const c=h;o.visible&&(o.resizeByMeasured(),i-=l=o.height),h=this.height;const u=this._legendSectionView;let d,_,p,g,m=0,y=0;if(u.visible)switch(u.resizeByMeasured().layout(),m=u.height,y=u.width,n.position){case At.TOP:d=l,i-=m;break;case At.BOTTOM:i-=m,d=this.height-m,h-=m;break;case At.RIGHT:s-=y,_=this.width-y;break;case At.LEFT:s-=y,a+=y,_=0}r||(g=new Map(this._axisSectionViews),I.forEach((t=>{(p=g.get(t))&&p.visible?s-=p.mw:g.delete(t)})),$.forEach((t=>{(p=g.get(t))&&p.visible?i-=p.mh:g.delete(t)})),(p=g.get(R.LEFT))&&p.visible&&(p.resize(p.mw,i),p.layout(),a+=p.mw),(p=g.get(R.RIGHT))&&p.visible&&(p.resize(p.mw,i),p.layout()),(p=g.get(R.BOTTOM))&&p.visible&&(p.resize(s,p.mh),p.layout(),h-=p.mh),(p=g.get(R.TOP))&&p.visible&&(p.resize(s,p.mh),p.layout()));const x=this._org=Ms.create(a,h);this._plotWidth=s,this._plotHeight=i,r||((p=g.get(R.LEFT))&&p.translate(x.x-p.mw,x.y-p.height),(p=g.get(R.RIGHT))&&p.translate(x.x+s,x.y-p.height),(p=g.get(R.BOTTOM))&&p.translate(x.x,x.y),(p=g.get(R.TOP))&&p.translate(x.x,x.y-i-p.height));const f=this._plotHeight,w=this._plotWidth;a=x.x,h=x.y-f,this._currBody.resize(w,f),this._currBody.layout().translate(a,h),o.visible&&o.layout(this._currBody.getRect()).translate(a,c),u.visible&&(n.position===At.PLOT?(isNaN(+n.left)?isNaN(+n.right)?a+=(w-y)/2:a+=w-y-+n.right:a+=+n.left,isNaN(+n.top)?isNaN(+n.bottom)?h+=(f-m)/2:h+=f-m-+n.bottom:h+=+n.top):isNaN(d)?(a=_,h+=(i-m)/2):(a+=(s-y)/2,h=d),u.translate(a,h)),this._tooltipView.hide(!0,!1)}showTooltip(t,e){const s=e.xPos+this._bodyView.tx,i=e.yPos+this._bodyView.ty;this._tooltipView.show(t.tooltip,e,s,i,!0)}hideTooltip(){this._tooltipView.hide(!1,!0)}legendByDom(t){return this._legendSectionView._legendView.legendByDom(t)}seriesByDom(t){return this._bodyView.seriesByDom(t)}clipSeries(t,e,s,i,r){t&&(this._model.inverted?this._seriesClip.setBounds(0,-i,r,i):this._seriesClip.setBounds(0,0,i,r),t.setClip(this._seriesClip))}_doAttached(t){this._seriesClip=this.control.clipBounds()}$_checkEmpty(t,e,s,i){if(!e||e.isEmpty())return this._emptyView||(this._emptyView=new wr(t)),this._emptyView.resize(s,i),!0;this._emptyView&&(this._emptyView.visible=!1)}$_prepareBody(t,e){var s,i;e?(this._polarView||(this._polarView=new _r(t,this),this.insertChild(this._polarView,this._bodyView)),this._currBody=this._polarView,null===(s=this._bodyView)||void 0===s||s.setVisible(!1),this._polarView.setVisible(!0)):(null===(i=this._polarView)||void 0===i||i.setVisible(!1),this._bodyView.setVisible(!0),this._currBody=this._bodyView)}$_prepareAxes(t,e){const s=this._currBody._guideContainer,i=this._currBody._frontGuideContainer,r=!e.options.polar&&e.needAxes(),n=this._axisSectionViews;for(const a of n.keys()){const h=n.get(a);r?h.prepare(t,e.getAxes(a),s,i):h.visible=!1}}$_measurePlot(t,e,s,i,r){const n=this._axisSectionViews,a=s,h=i;this._bodyView.prepareGuideContainers(),this.$_prepareAxes(t,e),e.layoutAxes(s,i,this._inverted,r),s-=n.get(R.LEFT).checkWidths(t,s,i),s-=n.get(R.RIGHT).checkWidths(t,s,i),i-=n.get(R.BOTTOM).checkHeights(t,s,i),i-=n.get(R.TOP).checkHeights(t,s,i),e.layoutAxes(s,i,this._inverted,r);for(const a of n.keys()){const h=n.get(a);h.visible&&h.measure(t,e,s,i,r)}s=a,i=h;for(const t of n.keys()){const e=n.get(t);e.visible&&(t===R.LEFT||t===R.RIGHT?s-=e.mw:t!==R.BOTTOM&&t!==R.TOP||(i-=e.mh))}e.layoutAxes(s,i,this._inverted,r);for(const a of n.keys()){const h=n.get(a);h.visible&&h.measure(t,e,s,i,r)}s=a,i=h;for(const t of n.keys()){const e=n.get(t);e.visible&&(t===R.LEFT||t===R.RIGHT?s-=e.mw:t!==R.BOTTOM&&t!==R.TOP||(i-=e.mh))}e.calcAxesPoints(s,i,this._inverted),this._bodyView.measure(t,e.body,s,i,r)}$_measurePolar(t,e,s,i,r){const n=e.body.getSize(s,i)/2;this.$_prepareAxes(t,e),e.layoutAxes(2*Math.PI,n,!1,r),this._polarView.measure(t,e.body,s,i,r)}}class Pr extends st{constructor(t,e){super(t,e),this.addElement(this._chartView=new br(t)),this.setPointerHandler(new Cs(this))}onVisibleChanged(t,e){e instanceof ce&&this.invalidateLayout()}get model(){return this._model}set model(t){t!==this._model&&(this._model&&this._model.removeListener(this),this._model=t,this._model&&this._model.addListener(this),this.invalidateLayout())}chartView(){return this._chartView}refresh(){this.invalidateLayout()}update(t,e=!1){this.loaded=!e,this.model=new Ts(t)}useImage(t){}_doRender(t){this.clearTemporaryDefs(),this._chartView.measure(this.doc(),this._model,t.width,t.height,1),this._chartView.resize(t.width,t.height),this._chartView.layout()}_doRenderBackground(t,e,s){this._model&&Object.assign(t.style,this._model.options.style)}}class vr{static getVersion(){return"0.9.1"}static setDebugging(t){it.DEBUGGING=t}static createChart(t,e,s){const i=new Pr(t,e);return i.model=new Ts(s),i}}const Vr=vr.getVersion,Sr=vr.setDebugging,Ar=vr.createChart;t.Chart=Ts,t.ChartControl=Pr,t.createChart=Ar,t.getVersion=Vr,t.setDebugging=Sr}));