80*s){n=h=t[0],o=a=t[1];for(var S=s;Sh&&(h=c),d>a&&(a=d);g=0!==(g=Math.max(h-n,a-o))?32767/g:0}return r(y,x,s,n,o,g,0),x}function i(t,e,i,s,r){var n,o;if(r===T(t,e,i,s)>0)for(n=e;n=e;n-=s)o=A(n,t[n],t[n+1],o);return o&&y(o,o.next)&&(w(o),o=o.next),o}function s(t,e){if(!t)return t;e||(e=t);var i,s=t;do{if(i=!1,s.steiner||!y(s,s.next)&&0!==p(s.prev,s,s.next))s=s.next;else{if(w(s),(s=e=s.prev)===s.next)break;i=!0}}while(i||s!==e);return e}function r(t,e,i,l,u,c,f){if(t){!f&&c&&function(t,e,i,s){var r=t;do{0===r.z&&(r.z=d(r.x,r.y,e,i,s)),r.prevZ=r.prev,r.nextZ=r.next,r=r.next}while(r!==t);r.prevZ.nextZ=null,r.prevZ=null,function(t){var e,i,s,r,n,o,h,a,l=1;do{for(i=t,t=null,n=null,o=0;i;){for(o++,s=i,h=0,e=0;e0||a>0&&s;)0!==h&&(0===a||!s||i.z<=s.z)?(r=i,i=i.nextZ,h--):(r=s,s=s.nextZ,a--),n?n.nextZ=r:t=r,r.prevZ=n,n=r;i=s}n.nextZ=null,l*=2}while(o>1)}(r)}(t,l,u,c);for(var g,m,p=t;t.prev!==t.next;)if(g=t.prev,m=t.next,c?o(t,l,u,c):n(t))e.push(g.i/i|0),e.push(t.i/i|0),e.push(m.i/i|0),w(t),t=m.next,p=m.next;else if((t=m)===p){f?1===f?r(t=h(s(t),e,i),e,i,l,u,c,2):2===f&&a(t,e,i,l,u,c):r(s(t),e,i,l,u,c,1);break}}}function n(t){var e=t.prev,i=t,s=t.next;if(p(e,i,s)>=0)return!1;for(var r=e.x,n=i.x,o=s.x,h=e.y,a=i.y,l=s.y,u=rn?r>o?r:o:n>o?n:o,f=h>a?h>l?h:l:a>l?a:l,m=s.next;m!==e;){if(m.x>=u&&m.x<=d&&m.y>=c&&m.y<=f&&g(r,h,n,a,o,l,m.x,m.y)&&p(m.prev,m,m.next)>=0)return!1;m=m.next}return!0}function o(t,e,i,s){var r=t.prev,n=t,o=t.next;if(p(r,n,o)>=0)return!1;for(var h=r.x,a=n.x,l=o.x,u=r.y,c=n.y,f=o.y,m=ha?h>l?h:l:a>l?a:l,S=u>c?u>f?u:f:c>f?c:f,v=d(m,y,e,i,s),b=d(x,S,e,i,s),M=t.prevZ,A=t.nextZ;M&&M.z>=v&&A&&A.z<=b;){if(M.x>=m&&M.x<=x&&M.y>=y&&M.y<=S&&M!==r&&M!==o&&g(h,u,a,c,l,f,M.x,M.y)&&p(M.prev,M,M.next)>=0)return!1;if(M=M.prevZ,A.x>=m&&A.x<=x&&A.y>=y&&A.y<=S&&A!==r&&A!==o&&g(h,u,a,c,l,f,A.x,A.y)&&p(A.prev,A,A.next)>=0)return!1;A=A.nextZ}for(;M&&M.z>=v;){if(M.x>=m&&M.x<=x&&M.y>=y&&M.y<=S&&M!==r&&M!==o&&g(h,u,a,c,l,f,M.x,M.y)&&p(M.prev,M,M.next)>=0)return!1;M=M.prevZ}for(;A&&A.z<=b;){if(A.x>=m&&A.x<=x&&A.y>=y&&A.y<=S&&A!==r&&A!==o&&g(h,u,a,c,l,f,A.x,A.y)&&p(A.prev,A,A.next)>=0)return!1;A=A.nextZ}return!0}function h(t,e,i){var r=t;do{var n=r.prev,o=r.next.next;!y(n,o)&&x(n,r,r.next,o)&&b(n,o)&&b(o,n)&&(e.push(n.i/i|0),e.push(r.i/i|0),e.push(o.i/i|0),w(r),w(r.next),r=t=o),r=r.next}while(r!==t);return s(r)}function a(t,e,i,n,o,h){var a=t;do{for(var l=a.next.next;l!==a.prev;){if(a.i!==l.i&&m(a,l)){var u=M(a,l);return a=s(a,a.next),u=s(u,u.next),r(a,e,i,n,o,h,0),void r(u,e,i,n,o,h,0)}l=l.next}a=a.next}while(a!==t)}function l(t,e){return t.x-e.x}function u(t,e){var i=function(t,e){var i,s=e,r=t.x,n=t.y,o=-1/0;do{if(n<=s.y&&n>=s.next.y&&s.next.y!==s.y){var h=s.x+(n-s.y)*(s.next.x-s.x)/(s.next.y-s.y);if(h<=r&&h>o&&(o=h,i=s.x=s.x&&s.x>=u&&r!==s.x&&g(ni.x||s.x===i.x&&c(i,s)))&&(i=s,f=a)),s=s.next}while(s!==l);return i}(t,e);if(!i)return e;var r=M(i,t);return s(r,r.next),s(i,i.next)}function c(t,e){return p(t.prev,t,e.prev)<0&&p(e.next,t,t.next)<0}function d(t,e,i,s,r){return(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=(t-i)*r|0)|t<<8))|t<<4))|t<<2))|t<<1))|(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=(e-s)*r|0)|e<<8))|e<<4))|e<<2))|e<<1))<<1}function f(t){var e=t,i=t;do{(e.x=(t-o)*(n-h)&&(t-o)*(s-h)>=(i-o)*(e-h)&&(i-o)*(n-h)>=(r-o)*(s-h)}function m(t,e){return t.next.i!==e.i&&t.prev.i!==e.i&&!function(t,e){var i=t;do{if(i.i!==t.i&&i.next.i!==t.i&&i.i!==e.i&&i.next.i!==e.i&&x(i,i.next,t,e))return!0;i=i.next}while(i!==t);return!1}(t,e)&&(b(t,e)&&b(e,t)&&function(t,e){var i=t,s=!1,r=(t.x+e.x)/2,n=(t.y+e.y)/2;do{i.y>n!=i.next.y>n&&i.next.y!==i.y&&r<(i.next.x-i.x)*(n-i.y)/(i.next.y-i.y)+i.x&&(s=!s),i=i.next}while(i!==t);return s}(t,e)&&(p(t.prev,t,e.prev)||p(t,e.prev,e))||y(t,e)&&p(t.prev,t,t.next)>0&&p(e.prev,e,e.next)>0)}function p(t,e,i){return(e.y-t.y)*(i.x-e.x)-(e.x-t.x)*(i.y-e.y)}function y(t,e){return t.x===e.x&&t.y===e.y}function x(t,e,i,s){var r=v(p(t,e,i)),n=v(p(t,e,s)),o=v(p(i,s,t)),h=v(p(i,s,e));return r!==n&&o!==h||!(0!==r||!S(t,i,e))||!(0!==n||!S(t,s,e))||!(0!==o||!S(i,t,s))||!(0!==h||!S(i,e,s))}function S(t,e,i){return e.x<=Math.max(t.x,i.x)&&e.x>=Math.min(t.x,i.x)&&e.y<=Math.max(t.y,i.y)&&e.y>=Math.min(t.y,i.y)}function v(t){return t>0?1:t<0?-1:0}function b(t,e){return p(t.prev,t,t.next)<0?p(t,e,t.next)>=0&&p(t,t.prev,e)>=0:p(t,e,t.prev)<0||p(t,t.next,e)<0}function M(t,e){var i=new D(t.i,t.x,t.y),s=new D(e.i,e.x,e.y),r=t.next,n=e.prev;return t.next=e,e.prev=t,i.next=r,r.prev=i,s.next=i,i.prev=s,n.next=s,s.prev=n,s}function A(t,e,i,s){var r=new D(t,e,i);return s?(r.next=s.next,r.prev=s,s.next.prev=r,s.next=r):(r.prev=r,r.next=r),r}function w(t){t.next.prev=t.prev,t.prev.next=t.next,t.prevZ&&(t.prevZ.nextZ=t.nextZ),t.nextZ&&(t.nextZ.prevZ=t.prevZ)}function D(t,e,i){this.i=t,this.x=e,this.y=i,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}function T(t,e,i,s){for(var r=0,n=e,o=i-s;n0&&(s+=t[r-1].length,i.holes.push(s))}return i}},369:(t,e,i)=>{i.r(e),i.d(e,{Collection:()=>D,Iterable:()=>Ts,List:()=>ai,Map:()=>ze,OrderedMap:()=>Mi,OrderedSet:()=>ls,Range:()=>qi,Record:()=>gs,Repeat:()=>bs,Seq:()=>K,Set:()=>Vi,Stack:()=>Bi,default:()=>Es,fromJS:()=>Ms,get:()=>ae,getIn:()=>Xi,has:()=>he,hasIn:()=>ji,hash:()=>yt,is:()=>ft,isAssociative:()=>w,isCollection:()=>S,isImmutable:()=>L,isIndexed:()=>A,isKeyed:()=>b,isList:()=>hi,isMap:()=>ut,isOrdered:()=>F,isOrderedMap:()=>ct,isOrderedSet:()=>Fi,isPlainObject:()=>re,isRecord:()=>P,isSeq:()=>I,isSet:()=>Ri,isStack:()=>Ei,isValueObject:()=>dt,merge:()=>we,mergeDeep:()=>Te,mergeDeepWith:()=>Ee,mergeWith:()=>De,remove:()=>ue,removeIn:()=>pe,set:()=>ce,setIn:()=>ge,update:()=>xe,updateIn:()=>de,version:()=>Ds});var s="delete",r=5,n=1<>>0;if(""+i!==e||4294967295===i)return NaN;e=i}return e<0?u(t)+e:e}function d(){return!0}function f(t,e,i){return(0===t&&!y(t)||void 0!==i&&t<=-i)&&(void 0===e||void 0!==i&&e>=i)}function g(t,e){return p(t,e,0)}function m(t,e){return p(t,e,e)}function p(t,e,i){return void 0===t?i:y(t)?e===1/0?e:0|Math.max(0,e+t):void 0===e||e===t?t:0|Math.min(e,t)}function y(t){return t<0||0===t&&1/t==-1/0}var x="@@__IMMUTABLE_ITERABLE__@@";function S(t){return Boolean(t&&t[x])}var v="@@__IMMUTABLE_KEYED__@@";function b(t){return Boolean(t&&t[v])}var M="@@__IMMUTABLE_INDEXED__@@";function A(t){return Boolean(t&&t[M])}function w(t){return b(t)||A(t)}var D=function(t){return S(t)?t:K(t)},T=function(t){function e(t){return b(t)?t:J(t)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e}(D),E=function(t){function e(t){return A(t)?t:Q(t)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e}(D),B=function(t){function e(t){return S(t)&&!w(t)?t:tt(t)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e}(D);D.Keyed=T,D.Indexed=E,D.Set=B;var k="@@__IMMUTABLE_SEQ__@@";function I(t){return Boolean(t&&t[k])}var C="@@__IMMUTABLE_RECORD__@@";function P(t){return Boolean(t&&t[C])}function L(t){return S(t)||P(t)}var R="@@__IMMUTABLE_ORDERED__@@";function F(t){return Boolean(t&&t[R])}var _=0,O=1,z=2,V="function"==typeof Symbol&&Symbol.iterator,N="@@iterator",G=V||N,U=function(t){this.next=t};function H(t,e,i,s){var r=0===t?e:1===t?i:[e,i];return s?s.value=r:s={value:r,done:!1},s}function W(){return{value:void 0,done:!0}}function Y(t){return!!Array.isArray(t)||!!$(t)}function q(t){return t&&"function"==typeof t.next}function X(t){var e=$(t);return e&&e.call(t)}function $(t){var e=t&&(V&&t[V]||t[N]);if("function"==typeof e)return e}U.prototype.toString=function(){return"[Iterator]"},U.KEYS=_,U.VALUES=O,U.ENTRIES=z,U.prototype.inspect=U.prototype.toSource=function(){return this.toString()},U.prototype[G]=function(){return this};var j=Object.prototype.hasOwnProperty;function Z(t){return!(!Array.isArray(t)&&"string"!=typeof t)||t&&"object"==typeof t&&Number.isInteger(t.length)&&t.length>=0&&(0===t.length?1===Object.keys(t).length:t.hasOwnProperty(t.length-1))}var K=function(t){function e(t){return null==t?nt():L(t)?t.toSeq():function(t){var e,i,s=at(t);if(s)return(i=$(e=t))&&i===e.entries?s.fromEntrySeq():function(t){var e=$(t);return e&&e===t.keys}(t)?s.toSetSeq():s;if("object"==typeof t)return new it(t);throw new TypeError("Expected Array or collection object of values, or keyed object: "+t)}(t)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.toSeq=function(){return this},e.prototype.toString=function(){return this.__toString("Seq {","}")},e.prototype.cacheResult=function(){return!this._cache&&this.__iterateUncached&&(this._cache=this.entrySeq().toArray(),this.size=this._cache.length),this},e.prototype.__iterate=function(t,e){var i=this._cache;if(i){for(var s=i.length,r=0;r!==s;){var n=i[e?s-++r:r++];if(!1===t(n[1],n[0],this))break}return r}return this.__iterateUncached(t,e)},e.prototype.__iterator=function(t,e){var i=this._cache;if(i){var s=i.length,r=0;return new U((function(){if(r===s)return{value:void 0,done:!0};var n=i[e?s-++r:r++];return H(t,n[0],n[1])}))}return this.__iteratorUncached(t,e)},e}(D),J=function(t){function e(t){return null==t?nt().toKeyedSeq():S(t)?b(t)?t.toSeq():t.fromEntrySeq():P(t)?t.toSeq():ot(t)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.toKeyedSeq=function(){return this},e}(K),Q=function(t){function e(t){return null==t?nt():S(t)?b(t)?t.entrySeq():t.toIndexedSeq():P(t)?t.toSeq().entrySeq():ht(t)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.of=function(){return e(arguments)},e.prototype.toIndexedSeq=function(){return this},e.prototype.toString=function(){return this.__toString("Seq [","]")},e}(K),tt=function(t){function e(t){return(S(t)&&!w(t)?t:Q(t)).toSetSeq()}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.of=function(){return e(arguments)},e.prototype.toSetSeq=function(){return this},e}(K);K.isSeq=I,K.Keyed=J,K.Set=tt,K.Indexed=Q,K.prototype[k]=!0;var et=function(t){function e(t){this._array=t,this.size=t.length}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.get=function(t,e){return this.has(t)?this._array[c(this,t)]:e},e.prototype.__iterate=function(t,e){for(var i=this._array,s=i.length,r=0;r!==s;){var n=e?s-++r:r++;if(!1===t(i[n],n,this))break}return r},e.prototype.__iterator=function(t,e){var i=this._array,s=i.length,r=0;return new U((function(){if(r===s)return{value:void 0,done:!0};var n=e?s-++r:r++;return H(t,n,i[n])}))},e}(Q),it=function(t){function e(t){var e=Object.keys(t).concat(Object.getOwnPropertySymbols?Object.getOwnPropertySymbols(t):[]);this._object=t,this._keys=e,this.size=e.length}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.get=function(t,e){return void 0===e||this.has(t)?this._object[t]:e},e.prototype.has=function(t){return j.call(this._object,t)},e.prototype.__iterate=function(t,e){for(var i=this._object,s=this._keys,r=s.length,n=0;n!==r;){var o=s[e?r-++n:n++];if(!1===t(i[o],o,this))break}return n},e.prototype.__iterator=function(t,e){var i=this._object,s=this._keys,r=s.length,n=0;return new U((function(){if(n===r)return{value:void 0,done:!0};var o=s[e?r-++n:n++];return H(t,o,i[o])}))},e}(J);it.prototype[R]=!0;var st,rt=function(t){function e(t){this._collection=t,this.size=t.length||t.size}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.__iterateUncached=function(t,e){if(e)return this.cacheResult().__iterate(t,e);var i=X(this._collection),s=0;if(q(i))for(var r;!(r=i.next()).done&&!1!==t(r.value,s++,this););return s},e.prototype.__iteratorUncached=function(t,e){if(e)return this.cacheResult().__iterator(t,e);var i=X(this._collection);if(!q(i))return new U(W);var s=0;return new U((function(){var e=i.next();return e.done?e:H(t,s++,e.value)}))},e}(Q);function nt(){return st||(st=new et([]))}function ot(t){var e=at(t);if(e)return e.fromEntrySeq();if("object"==typeof t)return new it(t);throw new TypeError("Expected Array or collection object of [k, v] entries, or keyed object: "+t)}function ht(t){var e=at(t);if(e)return e;throw new TypeError("Expected Array or collection object of values: "+t)}function at(t){return Z(t)?new et(t):Y(t)?new rt(t):void 0}var lt="@@__IMMUTABLE_MAP__@@";function ut(t){return Boolean(t&&t[lt])}function ct(t){return ut(t)&&F(t)}function dt(t){return Boolean(t&&"function"==typeof t.equals&&"function"==typeof t.hashCode)}function ft(t,e){if(t===e||t!=t&&e!=e)return!0;if(!t||!e)return!1;if("function"==typeof t.valueOf&&"function"==typeof e.valueOf){if((t=t.valueOf())===(e=e.valueOf())||t!=t&&e!=e)return!0;if(!t||!e)return!1}return!!(dt(t)&&dt(e)&&t.equals(e))}var gt="function"==typeof Math.imul&&-2===Math.imul(4294967295,2)?Math.imul:function(t,e){var i=65535&(t|=0),s=65535&(e|=0);return i*s+((t>>>16)*s+i*(e>>>16)<<16>>>0)|0};function mt(t){return t>>>1&1073741824|3221225471&t}var pt=Object.prototype.valueOf;function yt(t){if(null==t)return xt(t);if("function"==typeof t.hashCode)return mt(t.hashCode(t));var e,i,s,r=(e=t).valueOf!==pt&&"function"==typeof e.valueOf?e.valueOf(e):e;if(null==r)return xt(r);switch(typeof r){case"boolean":return r?1108378657:1108378656;case"number":return function(t){if(t!=t||t===1/0)return 0;var e=0|t;for(e!==t&&(e^=4294967295*t);t>4294967295;)e^=t/=4294967295;return mt(e)}(r);case"string":return r.length>Bt?(void 0===(s=Ct[i=r])&&(s=St(i),It===kt&&(It=0,Ct={}),It++,Ct[i]=s),s):St(r);case"object":case"function":return function(t){var e;if(wt&&void 0!==(e=At.get(t)))return e;if(void 0!==(e=t[Et]))return e;if(!bt){if(void 0!==(e=t.propertyIsEnumerable&&t.propertyIsEnumerable[Et]))return e;if(void 0!==(e=function(t){if(t&&t.nodeType>0)switch(t.nodeType){case 1:return t.uniqueID;case 9:return t.documentElement&&t.documentElement.uniqueID}}(t)))return e}if(e=Mt(),wt)At.set(t,e);else{if(void 0!==vt&&!1===vt(t))throw new Error("Non-extensible objects are not allowed as keys.");if(bt)Object.defineProperty(t,Et,{enumerable:!1,configurable:!1,writable:!1,value:e});else if(void 0!==t.propertyIsEnumerable&&t.propertyIsEnumerable===t.constructor.prototype.propertyIsEnumerable)t.propertyIsEnumerable=function(){return this.constructor.prototype.propertyIsEnumerable.apply(this,arguments)},t.propertyIsEnumerable[Et]=e;else{if(void 0===t.nodeType)throw new Error("Unable to set a non-enumerable property on object.");t[Et]=e}}return e}(r);case"symbol":return function(t){var e=Dt[t];return void 0!==e||(e=Mt(),Dt[t]=e),e}(r);default:if("function"==typeof r.toString)return St(r.toString());throw new Error("Value type "+typeof r+" cannot be hashed.")}}function xt(t){return null===t?1108378658:1108378659}function St(t){for(var e=0,i=0;i=0&&(l.get=function(e,i){return(e=c(this,e))>=0&&eh)return{value:void 0,done:!0};var t=r.next();return s||e===O||t.done?t:H(e,a-1,e===_?void 0:t.value[1],t)}))},l}function Gt(t,e,i,s){var r=Zt(t);return r.__iterateUncached=function(r,n){var o=this;if(n)return this.cacheResult().__iterate(r,n);var h=!0,a=0;return t.__iterate((function(t,n,l){if(!h||!(h=e.call(i,t,n,l)))return a++,r(t,s?n:a-1,o)})),a},r.__iteratorUncached=function(r,n){var o=this;if(n)return this.cacheResult().__iterator(r,n);var h=t.__iterator(z,n),a=!0,l=0;return new U((function(){var t,n,u;do{if((t=h.next()).done)return s||r===O?t:H(r,l++,r===_?void 0:t.value[1],t);var c=t.value;n=c[0],u=c[1],a&&(a=e.call(i,u,n,o))}while(a);return r===z?t:H(r,n,u,t)}))},r}function Ut(t,e,i){var s=Zt(t);return s.__iterateUncached=function(r,n){if(n)return this.cacheResult().__iterate(r,n);var o=0,h=!1;return function t(a,l){a.__iterate((function(n,a){return(!e||l0}function qt(t,e,i,s){var r=Zt(t),n=new et(i).map((function(t){return t.size}));return r.size=s?n.max():n.min(),r.__iterate=function(t,e){for(var i,s=this.__iterator(O,e),r=0;!(i=s.next()).done&&!1!==t(i.value,r++,this););return r},r.__iteratorUncached=function(t,r){var n=i.map((function(t){return t=D(t),X(r?t.reverse():t)})),o=0,h=!1;return new U((function(){var i;return h||(i=n.map((function(t){return t.next()})),h=s?i.every((function(t){return t.done})):i.some((function(t){return t.done}))),h?{value:void 0,done:!0}:H(t,o++,e.apply(null,i.map((function(t){return t.value}))))}))},r}function Xt(t,e){return t===e?t:I(t)?e:t.constructor(e)}function $t(t){if(t!==Object(t))throw new TypeError("Expected [K, V] tuple: "+t)}function jt(t){return b(t)?T:A(t)?E:B}function Zt(t){return Object.create((b(t)?J:A(t)?Q:tt).prototype)}function Kt(){return this._iter.cacheResult?(this._iter.cacheResult(),this.size=this._iter.size,this):K.prototype.cacheResult.call(this)}function Jt(t,e){return void 0===t&&void 0===e?0:void 0===t?1:void 0===e?-1:t>e?1:t0;)e[i]=arguments[i+1];if("function"!=typeof t)throw new TypeError("Invalid merger function: "+t);return Ae(this,e,t)}function Ae(t,e,i){for(var s=[],r=0;r0;)e[i]=arguments[i+1];return ke(t,e)}function De(t,e){for(var i=[],s=arguments.length-2;s-- >0;)i[s]=arguments[s+2];return ke(e,i,t)}function Te(t){for(var e=[],i=arguments.length-1;i-- >0;)e[i]=arguments[i+1];return Be(t,e)}function Ee(t,e){for(var i=[],s=arguments.length-2;s-- >0;)i[s]=arguments[s+2];return Be(e,i,t)}function Be(t,e,i){return ke(t,e,function(t){return function e(i,s,r){return ne(i)&&ne(s)&&(n=s,o=K(i),h=K(n),A(o)===A(h)&&b(o)===b(h))?ke(i,[s],e):t?t(i,s,r):s;var n,o,h}}(i))}function ke(t,e,i){if(!ne(t))throw new TypeError("Cannot merge into non-data-structure value: "+t);if(L(t))return"function"==typeof i&&t.mergeWith?t.mergeWith.apply(t,[i].concat(e)):t.merge?t.merge.apply(t,e):t.concat.apply(t,e);for(var s=Array.isArray(t),r=t,n=s?E:T,o=s?function(e){r===t&&(r=le(r)),r.push(e)}:function(e,s){var n=j.call(r,s),o=n&&i?i(r[s],e,s):e;n&&o===r[s]||(r===t&&(r=le(r)),r[s]=o)},h=0;h0;)e[i]=arguments[i+1];return Be(this,e,t)}function Pe(t){for(var e=[],i=arguments.length-1;i-- >0;)e[i]=arguments[i+1];return de(this,t,Ze(),(function(t){return ke(t,e)}))}function Le(t){for(var e=[],i=arguments.length-1;i-- >0;)e[i]=arguments[i+1];return de(this,t,Ze(),(function(t){return Be(t,e)}))}function Re(t){var e=this.asMutable();return t(e),e.wasAltered()?e.__ensureOwner(this.__ownerID):this}function Fe(){return this.__ownerID?this:this.__ensureOwner(new l)}function _e(){return this.__ensureOwner()}function Oe(){return this.__altered}var ze=function(t){function e(e){return null==e?Ze():ut(e)&&!F(e)?e:Ze().withMutations((function(i){var s=t(e);ee(s.size),s.forEach((function(t,e){return i.set(e,t)}))}))}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.of=function(){for(var t=[],e=arguments.length;e--;)t[e]=arguments[e];return Ze().withMutations((function(e){for(var i=0;i=t.length)throw new Error("Missing value for key: "+t[i]);e.set(t[i],t[i+1])}}))},e.prototype.toString=function(){return this.__toString("Map {","}")},e.prototype.get=function(t,e){return this._root?this._root.get(0,void 0,t,e):e},e.prototype.set=function(t,e){return Ke(this,t,e)},e.prototype.remove=function(t){return Ke(this,t,h)},e.prototype.deleteAll=function(t){var e=D(t);return 0===e.size?this:this.withMutations((function(t){e.forEach((function(e){return t.remove(e)}))}))},e.prototype.clear=function(){return 0===this.size?this:this.__ownerID?(this.size=0,this._root=null,this.__hash=void 0,this.__altered=!0,this):Ze()},e.prototype.sort=function(t){return Mi(Ht(this,t))},e.prototype.sortBy=function(t,e){return Mi(Ht(this,e,t))},e.prototype.map=function(t,e){var i=this;return this.withMutations((function(s){s.forEach((function(r,n){s.set(n,t.call(e,r,n,i))}))}))},e.prototype.__iterator=function(t,e){return new qe(this,t,e)},e.prototype.__iterate=function(t,e){var i=this,s=0;return this._root&&this._root.iterate((function(e){return s++,t(e[1],e[0],i)}),e),s},e.prototype.__ensureOwner=function(t){return t===this.__ownerID?this:t?je(this.size,this._root,t,this.__hash):0===this.size?Ze():(this.__ownerID=t,this.__altered=!1,this)},e}(T);ze.isMap=ut;var Ve=ze.prototype;Ve[lt]=!0,Ve[s]=Ve.remove,Ve.removeAll=Ve.deleteAll,Ve.setIn=me,Ve.removeIn=Ve.deleteIn=ye,Ve.update=Se,Ve.updateIn=ve,Ve.merge=Ve.concat=be,Ve.mergeWith=Me,Ve.mergeDeep=Ie,Ve.mergeDeepWith=Ce,Ve.mergeIn=Pe,Ve.mergeDeepIn=Le,Ve.withMutations=Re,Ve.wasAltered=Oe,Ve.asImmutable=_e,Ve["@@transducer/init"]=Ve.asMutable=Fe,Ve["@@transducer/step"]=function(t,e){return t.set(e[0],e[1])},Ve["@@transducer/result"]=function(t){return t.asImmutable()};var Ne=function(t,e){this.ownerID=t,this.entries=e};Ne.prototype.get=function(t,e,i,s){for(var r=this.entries,n=0,o=r.length;n=si)return function(t,e,i,s){t||(t=new l);for(var r=new We(t,yt(i),[i,s]),n=0;n>>t)&o),h=this.bitmap;return 0==(h&n)?s:this.nodes[ei(h&n-1)].get(t+r,e,i,s)},Ge.prototype.update=function(t,e,i,s,a,l,u){void 0===i&&(i=yt(s));var c=(0===e?i:i>>>e)&o,d=1<=ri)return function(t,e,i,s,r){for(var o=0,h=new Array(n),a=0;0!==i;a++,i>>>=1)h[a]=1&i?e[o++]:void 0;return h[s]=r,new Ue(t,o+1,h)}(t,p,f,c,x);if(g&&!x&&2===p.length&&Qe(p[1^m]))return p[1^m];if(g&&x&&1===p.length&&Qe(x))return x;var S=t&&t===this.ownerID,v=g?x?f:f^d:f|d,b=g?x?ii(p,m,x,S):function(t,e,i){var s=t.length-1;if(i&&e===s)return t.pop(),t;for(var r=new Array(s),n=0,o=0;o>>t)&o,h=this.nodes[n];return h?h.get(t+r,e,i,s):s},Ue.prototype.update=function(t,e,i,s,n,a,l){void 0===i&&(i=yt(s));var u=(0===e?i:i>>>e)&o,c=n===h,d=this.nodes,f=d[u];if(c&&!f)return this;var g=Je(f,t,e+r,i,s,n,a,l);if(g===f)return this;var m=this.count;if(f){if(!g&&--m>>i)&o,l=(0===i?s:s>>>i)&o,u=a===l?[ti(t,e,i+r,s,n)]:(h=new We(e,s,n),a>1&1431655765))+(t>>2&858993459))+(t>>4)&252645135,127&(t+=t>>8)+(t>>16)}function ii(t,e,i,s){var r=s?t:Qt(t);return r[e]=i,r}var si=n/4,ri=n/2,ni=n/4,oi="@@__IMMUTABLE_LIST__@@";function hi(t){return Boolean(t&&t[oi])}var ai=function(t){function e(e){var i=mi();if(null==e)return i;if(hi(e))return e;var s=t(e),o=s.size;return 0===o?i:(ee(o),o>0&&o=0&&t=t.size||e<0)return t.withMutations((function(t){e<0?Si(t,e).set(0,i):Si(t,0,e+1).set(e,i)}));e+=t._origin;var s=t._tail,r=t._root,n={value:!1};return e>=vi(t._capacity)?s=pi(s,t.__ownerID,0,e,i,n):r=pi(r,t.__ownerID,t._level,e,i,n),n.value?t.__ownerID?(t._root=r,t._tail=s,t.__hash=void 0,t.__altered=!0,t):gi(t._origin,t._capacity,t._level,r,s):t}(this,t,e)},e.prototype.remove=function(t){return this.has(t)?0===t?this.shift():t===this.size-1?this.pop():this.splice(t,1):this},e.prototype.insert=function(t,e){return this.splice(t,0,e)},e.prototype.clear=function(){return 0===this.size?this:this.__ownerID?(this.size=this._origin=this._capacity=0,this._level=r,this._root=this._tail=this.__hash=void 0,this.__altered=!0,this):mi()},e.prototype.push=function(){var t=arguments,e=this.size;return this.withMutations((function(i){Si(i,0,e+t.length);for(var s=0;s>>e&o;if(s>=this.array.length)return new ui([],t);var n,h=0===s;if(e>0){var a=this.array[s];if((n=a&&a.removeBefore(t,e-r,i))===a&&h)return this}if(h&&!n)return this;var l=yi(this,t);if(!h)for(var u=0;u>>e&o;if(n>=this.array.length)return this;if(e>0){var h=this.array[n];if((s=h&&h.removeAfter(t,e-r,i))===h&&n===this.array.length-1)return this}var a=yi(this,t);return a.array.splice(n+1),s&&(a.array[n]=s),a};var ci,di={};function fi(t,e){var i=t._origin,s=t._capacity,o=vi(s),h=t._tail;return function t(a,l,u){return 0===l?function(t,r){var a=r===o?h&&h.array:t&&t.array,l=r>i?0:i-r,u=s-r;return u>n&&(u=n),function(){if(l===u)return di;var t=e?--u:l++;return a&&a[t]}}(a,u):function(o,h,a){var l,u=o&&o.array,c=a>i?0:i-a>>h,d=1+(s-a>>h);return d>n&&(d=n),function(){for(;;){if(l){var i=l();if(i!==di)return i;l=null}if(c===d)return di;var s=e?--d:c++;l=t(u&&u[s],h-r,a+(s<>>i&o,c=t&&u0){var d=t&&t.array[u],f=pi(d,e,i-r,s,n,h);return f===d?t:((l=yi(t,e)).array[u]=f,l)}return c&&t.array[u]===n?t:(h&&a(h),l=yi(t,e),void 0===n&&u===l.array.length-1?l.array.pop():l.array[u]=n,l)}function yi(t,e){return e&&t&&e===t.ownerID?t:new ui(t?t.array.slice():[],e)}function xi(t,e){if(e>=vi(t._capacity))return t._tail;if(e<1<0;)i=i.array[e>>>s&o],s-=r;return i}}function Si(t,e,i){void 0!==e&&(e|=0),void 0!==i&&(i|=0);var s=t.__ownerID||new l,n=t._origin,h=t._capacity,a=n+e,u=void 0===i?h:i<0?h+i:n+i;if(a===n&&u===h)return t;if(a>=u)return t.clear();for(var c=t._level,d=t._root,f=0;a+f<0;)d=new ui(d&&d.array.length?[void 0,d]:[],s),f+=1<<(c+=r);f&&(a+=f,n+=f,u+=f,h+=f);for(var g=vi(h),m=vi(u);m>=1<g?new ui([],s):p;if(p&&m>g&&ar;S-=r){var v=g>>>S&o;x=x.array[v]=yi(x.array[v],s)}x.array[g>>>r&o]=p}if(u=m)a-=m,u-=m,c=r,d=null,y=y&&y.removeBefore(s,0,a);else if(a>n||m>>c&o;if(b!==m>>>c&o)break;b&&(f+=(1<n&&(d=d.removeBefore(s,c,a-f)),d&&m>>r<=n&&a.size>=2*o.size?(s=(r=a.filter((function(t,e){return void 0!==t&&l!==e}))).toKeyedSeq().map((function(t){return t[0]})).flip().toMap(),t.__ownerID&&(s.__ownerID=r.__ownerID=t.__ownerID)):(s=o.remove(e),r=l===a.size-1?a.pop():a.set(l,void 0))}else if(u){if(i===a.get(l)[1])return t;s=o,r=a.set(l,[e,i])}else s=o.set(e,a.size),r=a.set(a.size,[e,i]);return t.__ownerID?(t.size=s.size,t._map=s,t._list=r,t.__hash=void 0,t.__altered=!0,t):Ai(s,r)}Mi.isOrderedMap=ct,Mi.prototype[R]=!0,Mi.prototype[s]=Mi.prototype.remove;var Ti="@@__IMMUTABLE_STACK__@@";function Ei(t){return Boolean(t&&t[Ti])}var Bi=function(t){function e(t){return null==t?Pi():Ei(t)?t:Pi().pushAll(t)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.of=function(){return this(arguments)},e.prototype.toString=function(){return this.__toString("Stack [","]")},e.prototype.get=function(t,e){var i=this._head;for(t=c(this,t);i&&t--;)i=i.next;return i?i.value:e},e.prototype.peek=function(){return this._head&&this._head.value},e.prototype.push=function(){var t=arguments;if(0===arguments.length)return this;for(var e=this.size+arguments.length,i=this._head,s=arguments.length-1;s>=0;s--)i={value:t[s],next:i};return this.__ownerID?(this.size=e,this._head=i,this.__hash=void 0,this.__altered=!0,this):Ci(e,i)},e.prototype.pushAll=function(e){if(0===(e=t(e)).size)return this;if(0===this.size&&Ei(e))return e;ee(e.size);var i=this.size,s=this._head;return e.__iterate((function(t){i++,s={value:t,next:s}}),!0),this.__ownerID?(this.size=i,this._head=s,this.__hash=void 0,this.__altered=!0,this):Ci(i,s)},e.prototype.pop=function(){return this.slice(1)},e.prototype.clear=function(){return 0===this.size?this:this.__ownerID?(this.size=0,this._head=void 0,this.__hash=void 0,this.__altered=!0,this):Pi()},e.prototype.slice=function(e,i){if(f(e,i,this.size))return this;var s=g(e,this.size);if(m(i,this.size)!==this.size)return t.prototype.slice.call(this,e,i);for(var r=this.size-s,n=this._head;s--;)n=n.next;return this.__ownerID?(this.size=r,this._head=n,this.__hash=void 0,this.__altered=!0,this):Ci(r,n)},e.prototype.__ensureOwner=function(t){return t===this.__ownerID?this:t?Ci(this.size,this._head,t,this.__hash):0===this.size?Pi():(this.__ownerID=t,this.__altered=!1,this)},e.prototype.__iterate=function(t,e){var i=this;if(e)return new et(this.toArray()).__iterate((function(e,s){return t(e,s,i)}),e);for(var s=0,r=this._head;r&&!1!==t(r.value,s++,this);)r=r.next;return s},e.prototype.__iterator=function(t,e){if(e)return new et(this.toArray()).__iterator(t,e);var i=0,s=this._head;return new U((function(){if(s){var e=s.value;return s=s.next,H(t,i++,e)}return{value:void 0,done:!0}}))},e}(E);Bi.isStack=Ei;var ki,Ii=Bi.prototype;function Ci(t,e,i,s){var r=Object.create(Ii);return r.size=t,r._head=e,r.__ownerID=i,r.__hash=s,r.__altered=!1,r}function Pi(){return ki||(ki=Ci(0))}Ii[Ti]=!0,Ii.shift=Ii.pop,Ii.unshift=Ii.push,Ii.unshiftAll=Ii.pushAll,Ii.withMutations=Re,Ii.wasAltered=Oe,Ii.asImmutable=_e,Ii["@@transducer/init"]=Ii.asMutable=Fe,Ii["@@transducer/step"]=function(t,e){return t.unshift(e)},Ii["@@transducer/result"]=function(t){return t.asImmutable()};var Li="@@__IMMUTABLE_SET__@@";function Ri(t){return Boolean(t&&t[Li])}function Fi(t){return Ri(t)&&F(t)}function _i(t,e){if(t===e)return!0;if(!S(e)||void 0!==t.size&&void 0!==e.size&&t.size!==e.size||void 0!==t.__hash&&void 0!==e.__hash&&t.__hash!==e.__hash||b(t)!==b(e)||A(t)!==A(e)||F(t)!==F(e))return!1;if(0===t.size&&0===e.size)return!0;var i=!w(t);if(F(t)){var s=t.entries();return e.every((function(t,e){var r=s.next().value;return r&&ft(r[1],t)&&(i||ft(r[0],e))}))&&s.next().done}var r=!1;if(void 0===t.size)if(void 0===e.size)"function"==typeof t.cacheResult&&t.cacheResult();else{r=!0;var n=t;t=e,e=n}var o=!0,a=e.__iterate((function(e,s){if(i?!t.has(e):r?!ft(e,t.get(s,h)):!ft(t.get(s,h),e))return o=!1,!1}));return o&&t.size===a}function Oi(t,e){var i=function(i){t.prototype[i]=e[i]};return Object.keys(e).forEach(i),Object.getOwnPropertySymbols&&Object.getOwnPropertySymbols(e).forEach(i),t}function zi(t){if(!t||"object"!=typeof t)return t;if(!S(t)){if(!ne(t))return t;t=K(t)}if(b(t)){var e={};return t.__iterate((function(t,i){e[i]=zi(t)})),e}var i=[];return t.__iterate((function(t){i.push(zi(t))})),i}var Vi=function(t){function e(e){return null==e?Wi():Ri(e)&&!F(e)?e:Wi().withMutations((function(i){var s=t(e);ee(s.size),s.forEach((function(t){return i.add(t)}))}))}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.of=function(){return this(arguments)},e.fromKeys=function(t){return this(T(t).keySeq())},e.intersect=function(t){return(t=D(t).toArray()).length?Gi.intersect.apply(e(t.pop()),t):Wi()},e.union=function(t){return(t=D(t).toArray()).length?Gi.union.apply(e(t.pop()),t):Wi()},e.prototype.toString=function(){return this.__toString("Set {","}")},e.prototype.has=function(t){return this._map.has(t)},e.prototype.add=function(t){return Ui(this,this._map.set(t,t))},e.prototype.remove=function(t){return Ui(this,this._map.remove(t))},e.prototype.clear=function(){return Ui(this,this._map.clear())},e.prototype.map=function(t,e){var i=this,s=!1,r=Ui(this,this._map.mapEntries((function(r){var n=r[1],o=t.call(e,n,n,i);return o!==n&&(s=!0),[o,o]}),e));return s?r:this},e.prototype.union=function(){for(var e=[],i=arguments.length;i--;)e[i]=arguments[i];return 0===(e=e.filter((function(t){return 0!==t.size}))).length?this:0!==this.size||this.__ownerID||1!==e.length?this.withMutations((function(i){for(var s=0;s=0&&e=0&&i>>-15,461845907),e=gt(e<<13|e>>>-13,5),e=gt((e=(e+3864292196|0)^t)^e>>>16,2246822507),e=mt((e=gt(e^e>>>13,3266489909))^e>>>16)}(t.__iterate(i?e?function(t,e){s=31*s+as(yt(t),yt(e))|0}:function(t,e){s=s+as(yt(t),yt(e))|0}:e?function(t){s=31*s+yt(t)|0}:function(t){s=s+yt(t)|0}),s)}(this))}});var Ki=D.prototype;Ki[x]=!0,Ki[G]=Ki.values,Ki.toJSON=Ki.toArray,Ki.__toStringMapper=oe,Ki.inspect=Ki.toSource=function(){return this.toString()},Ki.chain=Ki.flatMap,Ki.contains=Ki.includes,Oi(T,{flip:function(){return Xt(this,_t(this))},mapEntries:function(t,e){var i=this,s=0;return Xt(this,this.toSeq().map((function(r,n){return t.call(e,[n,r],s++,i)})).fromEntrySeq())},mapKeys:function(t,e){var i=this;return Xt(this,this.toSeq().flip().map((function(s,r){return t.call(e,s,r,i)})).flip())}});var Ji=T.prototype;Ji[v]=!0,Ji[G]=Ki.entries,Ji.toJSON=Zi,Ji.__toStringMapper=function(t,e){return oe(e)+": "+oe(t)},Oi(E,{toKeyedSeq:function(){return new Pt(this,!1)},filter:function(t,e){return Xt(this,Vt(this,t,e,!1))},findIndex:function(t,e){var i=this.findEntry(t,e);return i?i[0]:-1},indexOf:function(t){var e=this.keyOf(t);return void 0===e?-1:e},lastIndexOf:function(t){var e=this.lastKeyOf(t);return void 0===e?-1:e},reverse:function(){return Xt(this,zt(this,!1))},slice:function(t,e){return Xt(this,Nt(this,t,e,!1))},splice:function(t,e){var i=arguments.length;if(e=Math.max(e||0,0),0===i||2===i&&!e)return this;t=g(t,t<0?this.count():this.size);var s=this.slice(0,t);return Xt(this,1===i?s:s.concat(Qt(arguments,2),this.slice(t+e)))},findLastIndex:function(t,e){var i=this.findLastEntry(t,e);return i?i[0]:-1},first:function(t){return this.get(0,t)},flatten:function(t){return Xt(this,Ut(this,t,!1))},get:function(t,e){return(t=c(this,t))<0||this.size===1/0||void 0!==this.size&&t>this.size?e:this.find((function(e,i){return i===t}),void 0,e)},has:function(t){return(t=c(this,t))>=0&&(void 0!==this.size?this.size===1/0||te?-1:0}function as(t,e){return t^e+2654435769+(t<<6)+(t>>2)|0}ts.has=Ki.includes,ts.contains=ts.includes,ts.keys=ts.values,Oi(J,Ji),Oi(Q,Qi),Oi(tt,ts);var ls=function(t){function e(t){return null==t?fs():Fi(t)?t:fs().withMutations((function(e){var i=B(t);ee(i.size),i.forEach((function(t){return e.add(t)}))}))}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.of=function(){return this(arguments)},e.fromKeys=function(t){return this(T(t).keySeq())},e.prototype.toString=function(){return this.__toString("OrderedSet {","}")},e}(Vi);ls.isOrderedSet=Fi;var us,cs=ls.prototype;function ds(t,e){var i=Object.create(cs);return i.size=t?t.size:0,i._map=t,i.__ownerID=e,i}function fs(){return us||(us=ds(wi()))}cs[R]=!0,cs.zip=Qi.zip,cs.zipWith=Qi.zipWith,cs.zipAll=Qi.zipAll,cs.__empty=fs,cs.__make=ds;var gs=function(t,e){var i;!function(t){if(P(t))throw new Error("Can not call `Record` with an immutable Record as default values. Use a plain javascript object instead.");if(L(t))throw new Error("Can not call `Record` with an immutable Collection as default values. Use a plain javascript object instead.");if(null===t||"object"!=typeof t)throw new Error("Can not call `Record` with a non-object as default values. Use a plain javascript object instead.")}(t);var s=function(n){var o=this;if(n instanceof s)return n;if(!(this instanceof s))return new s(n);if(!i){i=!0;var h=Object.keys(t),a=r._indices={};r._name=e,r._keys=h,r._defaultValues=t;for(var l=0;l2?[]:void 0,{"":t})}function As(t,e,i,s,r,n){if("string"!=typeof i&&!L(i)&&(Z(i)||Y(i)||re(i))){if(~t.indexOf(i))throw new TypeError("Cannot convert circular structure to Immutable");t.push(i),r&&""!==s&&r.push(s);var o=e.call(n,s,K(i).map((function(s,n){return As(t,e,s,n,r,i)})),r&&r.slice());return t.pop(),r&&r.pop(),o}return i}function ws(t,e){return A(e)?e.toList():b(e)?e.toMap():e.toSet()}var Ds="4.2.4",Ts=D;const Es={version:Ds,Collection:D,Iterable:D,Seq:K,Map:ze,OrderedMap:Mi,List:ai,Stack:Bi,Set:Vi,OrderedSet:ls,Record:gs,Range:qi,Repeat:bs,is:ft,fromJS:Ms,hash:yt,isImmutable:L,isCollection:S,isKeyed:b,isIndexed:A,isAssociative:w,isOrdered:F,isValueObject:dt,isPlainObject:re,isSeq:I,isList:hi,isMap:ut,isOrderedMap:ct,isStack:Ei,isSet:Ri,isOrderedSet:Fi,isRecord:P,get:ae,getIn:Xi,has:he,hasIn:ji,merge:we,mergeDeep:Te,mergeWith:De,mergeDeepWith:Ee,remove:ue,removeIn:pe,set:ce,setIn:ge,update:xe,updateIn:de}},475:(t,e,i)=>{Object.defineProperty(e,"i",{value:!0});var s=i(369),r=i(102),n=i(187),o=function(t){if(t&&t.i)return t;var e=Object.create(null);return t&&Object.keys(t).forEach((function(i){if("default"!==i){var s=Object.getOwnPropertyDescriptor(t,i);Object.defineProperty(e,i,s.get?s:{enumerable:!0,get:function(){return t[i]}})}})),e.default=t,Object.freeze(e)}(s),h=function(t){return t&&"object"==typeof t&&"default"in t?t:{default:t}}(n);class a{constructor(){this.o=!0}l(){return this.o}}class l extends a{constructor(t,e){super(),this.u=t,this.o=e}S(t){return t!==this.u&&(this.u=t,this.o=!0),this}M(){return this.u}l(){return super.l()}}const u=(t,e)=>({x:t,y:e}),c=(t,e)=>({x:t,y:e}),d=(t,e,i)=>({position:t,high:e,low:i}),f=(t,e,i)=>({x:t,y:e,z:i}),g=t=>{const e=Array(0),i=Array(0);return t.length>0&&t.forEach((t=>{e.push(u(t.position,t.high)),i.push(u(t.position,t.low))})),[e,i]},m=(t,e)=>({min:t,max:e}),p=(t,e,i,s)=>({x:Math.ceil(t),y:Math.ceil(e),width:Math.ceil(i),height:Math.ceil(s)}),y=(t,e=!0)=>new l(t,e),x=(t=0,e=0,i=0,s=0)=>({left:t,top:e,right:i,bottom:s}),S=x,v=(t,e)=>({left:void 0!==e.left?e.left:t.left,top:void 0!==e.top?e.top:t.top,right:void 0!==e.right?e.right:t.right,bottom:void 0!==e.bottom?e.bottom:t.bottom}),b=s.Record({r:1,g:1,b:1,a:1});class M extends b{constructor(t){super(t)}toString(){return`color:${this.r},${this.g},${this.b},${this.a}`}setA(t){return this.set("a",t/255)}setR(t){return this.set("r",t/255)}setG(t){return this.set("g",t/255)}setB(t){return this.set("b",t/255)}getA(){return 255*this.get("a")}getR(){return 255*this.get("r")}getG(){return 255*this.get("g")}getB(){return 255*this.get("b")}getHighlight(){return this._||(this._=new M({r:this.r+.45*(1-this.r),g:this.g+.45*(1-this.g),b:this.b+.45*(1-this.b),a:this.a<1?this.a+.45*(1-this.a):1})),this._}getLighter(){return this.C||(this.C=new M({r:this.r+.4*(1-this.r),g:this.g+.4*(1-this.g),b:this.b+.4*(1-this.b),a:this.a})),this.C}getDarker(){return this.T||(this.T=new M({r:this.r-.4*(1-this.r),g:this.g-.4*(1-this.g),b:this.b-.4*(1-this.b),a:this.a})),this.T}toRGBAString(){return`rgba( ${255*this.r}, ${255*this.g}, ${255*this.b}, ${255*this.a} )`}}const A=(t,e,i,s=255)=>new M({r:t/255,g:e/255,b:i/255,a:s/255}),w=t=>{const e=t.startsWith("#")?t.substring(1):t.startsWith("0x")?t.substr(2):t;switch(e.length){case 8:return new M({r:Number(`0x${e.substring(0,2)}`)/255,g:Number(`0x${e.substring(2,4)}`)/255,b:Number(`0x${e.substring(4,6)}`)/255,a:Number(`0x${e.substring(6,8)}`)/255});case 6:return new M({r:Number(`0x${e.substring(0,2)}`)/255,g:Number(`0x${e.substring(2,4)}`)/255,b:Number(`0x${e.substring(4,6)}`)/255});case 4:return new M({r:Number(`0x${e.charAt(0)}${e.charAt(0)}`)/255,g:Number(`0x${e.charAt(1)}${e.charAt(1)}`)/255,b:Number(`0x${e.charAt(2)}${e.charAt(2)}`)/255,a:Number(`0x${e.charAt(3)}${e.charAt(3)}`)/255});case 3:return new M({r:Number(`0x${e.charAt(0)}${e.charAt(0)}`)/255,g:Number(`0x${e.charAt(1)}${e.charAt(1)}`)/255,b:Number(`0x${e.charAt(2)}${e.charAt(2)}`)/255});default:throw new Error(`ColorHEX parsing error | input: ${t}`)}},D=(t,e=1,i=1)=>{let s,r,n;t/=360;const o=Math.floor(6*t),h=6*t-o,a=i*(1-e),l=i*(1-h*e),u=i*(1-(1-h)*e);switch(o%6){case 0:s=i,r=u,n=a;break;case 1:s=l,r=i,n=a;break;case 2:s=a,r=i,n=u;break;case 3:s=a,r=l,n=i;break;case 4:s=u,r=a,n=i;break;default:s=i,r=a,n=l}return new M({r:s,g:r,b:n})},T={aliceblue:"#f0f8ff",antiquewhite:"#faebd7",aqua:"#00ffff",aquamarine:"#7fffd4",azure:"#f0ffff",beige:"#f5f5dc",bisque:"#ffe4c4",black:"#000000",blanchedalmond:"#ffebcd",blue:"#0000ff",blueviolet:"#8a2be2",brown:"#a52a2a",burlywood:"#deb887",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",cornflowerblue:"#6495ed",cornsilk:"#fff8dc",crimson:"#dc143c",cyan:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkgray:"#a9a9a9",darkgreen:"#006400",darkkhaki:"#bdb76b",darkmagenta:"#8b008b",darkolivegreen:"#556b2f",darkorange:"#ff8c00",darkorchid:"#9932cc",darkred:"#8b0000",darksalmon:"#e9967a",darkseagreen:"#8fbc8f",darkslateblue:"#483d8b",darkslategray:"#2f4f4f",darkturquoise:"#00ced1",darkviolet:"#9400d3",deeppink:"#ff1493",deepskyblue:"#00bfff",dimgray:"#696969",dodgerblue:"#1e90ff",firebrick:"#b22222",floralwhite:"#fffaf0",forestgreen:"#228b22",fuchsia:"#ff00ff",gainsboro:"#dcdcdc",ghostwhite:"#f8f8ff",gold:"#ffd700",goldenrod:"#daa520",gray:"#808080",green:"#008000",greenyellow:"#adff2f",honeydew:"#f0fff0",hotpink:"#ff69b4",indianred:"#cd5c5c",indigo:"#4b0082",ivory:"#fffff0",khaki:"#f0e68c",lavender:"#e6e6fa",lavenderblush:"#fff0f5",lawngreen:"#7cfc00",lemonchiffon:"#fffacd",lightblue:"#add8e6",lightcoral:"#f08080",lightcyan:"#e0ffff",lightgoldenrodyellow:"#fafad2",lightgrey:"#d3d3d3",lightgreen:"#90ee90",lightpink:"#ffb6c1",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",lightskyblue:"#87cefa",lightslategray:"#778899",lightsteelblue:"#b0c4de",lightyellow:"#ffffe0",lime:"#00ff00",limegreen:"#32cd32",linen:"#faf0e6",magenta:"#ff00ff",maroon:"#800000",mediumaquamarine:"#66cdaa",mediumblue:"#0000cd",mediumorchid:"#ba55d3",mediumpurple:"#9370d8",mediumseagreen:"#3cb371",mediumslateblue:"#7b68ee",mediumspringgreen:"#00fa9a",mediumturquoise:"#48d1cc",mediumvioletred:"#c71585",midnightblue:"#191970",mintcream:"#f5fffa",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",navajowhite:"#ffdead",navy:"#000080",oldlace:"#fdf5e6",olive:"#808000",olivedrab:"#6b8e23",orange:"#ffa500",orangered:"#ff4500",orchid:"#da70d6",palegoldenrod:"#eee8aa",palegreen:"#98fb98",paleturquoise:"#afeeee",palevioletred:"#d87093",papayawhip:"#ffefd5",peachpuff:"#ffdab9",peru:"#cd853f",pink:"#ffc0cb",plum:"#dda0dd",powderblue:"#b0e0e6",purple:"#800080",rebeccapurple:"#663399",red:"#ff0000",rosybrown:"#bc8f8f",royalblue:"#4169e1",saddlebrown:"#8b4513",salmon:"#fa8072",sandybrown:"#f4a460",seagreen:"#2e8b57",seashell:"#fff5ee",sienna:"#a0522d",silver:"#c0c0c0",skyblue:"#87ceeb",slateblue:"#6a5acd",slategray:"#708090",snow:"#fffafa",springgreen:"#00ff7f",steelblue:"#4682b4",tan:"#d2b48c",teal:"#008080",thistle:"#d8bfd8",tomato:"#ff6347",turquoise:"#40e0d0",violet:"#ee82ee",wheat:"#f5deb3",white:"#ffffff",whitesmoke:"#f5f5f5",yellow:"#ffff00",yellowgreen:"#9acd32"},E=new M({}),B=A(0,0,0,0),k=(t,e)=>t.value-e.value,I=s.Record({steps:[],title:"",units:"",interpolate:!0,color:A(0,0,0,255),length:0,min:0,max:0,subranges:[],isValid:!1}),C=t=>{const{steps:e}=t,i=e.length;e.sort(k);const[s,r]=i>0?[e[0].value,e[i-1].value]:[0,0],n=i>0?i-1:0,o=Array(n);for(let t=0;t0&&s!==r}};class P extends I{constructor(t){super(((t,e)=>({steps:t.steps,title:t.title,units:t.units,interpolate:t.interpolate,color:t.color,length:e.length,min:e.min,max:e.max,subranges:e.subranges,isValid:e.isValid}))(t,C(t)))}toString(){return`LUT:interpolate=${this.interpolate},steps=${this.steps.map((t=>`${t.value},${t.color.toString()}`)).join(",")}`}setSteps(t){return this.merge(C({...this,steps:t}))}getSteps(){return this.get("steps")}setTitle(t){return this.set("title",t)}getTitle(){return this.get("title")}setUnits(t){return this.set("units",t)}getUnits(){return this.get("units")}setInterpolation(t){return this.set("interpolate",t)}getInterpolation(){return this.get("interpolate")}setFallbackColor(t){return this.set("color",t)}getFallbackColor(){return this.get("color")}getColors(t){if(Array.isArray(t)){if(Array.isArray(t[0])){const e=t,i=e.length,s=e[0].length,r=[...Array(i)].map((()=>Array(s)));for(let t=0;t=a&&t<=l){if(a===l)return i.color;const e=(t-i.value)/(h.value-i.value);return s=i.color,r=h.color,n=e,new M({r:s.r+(r.r-s.r)*n,g:s.g+(r.g-s.g)*n,b:s.b+(r.b-s.b)*n,a:s.a+(r.a-s.a)*n})}}return t=0;s-=1)if(t>=e[s].value)return e[s].color;return e[0].color}}const L=s.Record({});class R extends L{constructor(){super(...arguments),this.type="fillstyle"}toString(){return"emptyFill"}}const F=new R,_=s.Record({color:A(255,255,255)});class O extends _{constructor(){super(...arguments),this.type="fillstyle"}}class z extends O{constructor(t){super(t)}toString(){return`solidFill:${this.color.toString()}`}setColor(t){return t instanceof M?this.set("color",t):this.set("color",t(this.get("color")))}getColor(){return this.get("color")}setA(t){return this.setColor(this.getColor().setA(t))}setR(t){return this.setColor(this.getColor().setR(t))}setG(t){return this.setColor(this.getColor().setG(t))}setB(t){return this.setColor(this.getColor().setB(t))}}class V extends O{constructor(t){super(t)}toString(){return`individualPointFill:${this.color.toString()}`}setFallbackColor(t){return t instanceof M?this.set("color",t):this.set("color",t(this.get("color")))}getFallbackColor(){return this.get("color")}}const N=s.Record({lut:new P({steps:[]}),lookUpProperty:"value"});class G extends N{constructor(t){super(t),this.type="fillstyle"}toString(){return`palettedFill:lut=${this.lut.toString()},lookUpProperty=${this.lookUpProperty}`}getPalette(){return this.get("lut")}setLookUpProperty(t){return"function"==typeof t?this.set("lookUpProperty",t(this.get("lookUpProperty"))):this.set("lookUpProperty",t)}getLookUpProperty(){return this.get("lookUpProperty")}}const U={linear:(t,e,i)=>{const s=e-t;return r=>rs=>ss=>ss=>s{const e=Jt(t);return(i,s,r)=>{const n=e(i),o=e(s);return e=>e(this.delta===this.duration||this.F)&&0===this.nextAnimations.length,this.values=t,this.action=e,this.duration=i,this.easing=s,this.D=n,this.eases=t.map((([t,e])=>s(t,e,i)))}L(){this.P.emit("start")}start(){return this.D.includes(this)||this.D.push(this),this}addNextAnimations(t){return t instanceof Array?t.forEach((t=>this.nextAnimations.push(t))):this.nextAnimations.push(t),this}NextAnimation(t,e,i=this.duration,s=this.easing){const r=new H(t,e,i,s,this.D);return this.nextAnimations.push(r),r}onAnimationStart(t,e){return this.P.on("start",t,e)}onAnimationEnd(t,e){return this.P.on("end",t,e)}onEveryAnimationEnd(t,e){return this.P.on("everyEnd",t,e)}onAllAnimationEnd(t,e){return this.P.on("allEnd",t,e)}allOffAnimationEnd(){return this.P.topicOff("end"),this}allOffEveryAnimationEnd(){return this.P.topicOff("everyEnd"),this}allOffAllAnimationEnd(){return this.P.topicOff("allEnd"),this}offAnimationEnd(t){return this.P.off(t,"end")}offEveryAnimationEnd(t){return this.P.off(t,"everyEnd")}offAllAnimationEnd(t){return this.P.off(t,"allEnd")}finish(t=!0){if(this.F=!0,this.D.splice(this.D.indexOf(this),1),this.nextAnimations.length>0){const e=this.nextAnimations[0];return t&&(this.P.listeners("allEnd").forEach(((t,i)=>e.onAllAnimationEnd(t,i))),this.P.listeners("everyEnd").forEach(((t,i)=>e.onEveryAnimationEnd(t,i)))),e.addNextAnimations(this.nextAnimations.slice(1)),e.start(),t&&(this.P.emit("end",e),this.P.emit("everyEnd",e)),e}t&&(this.P.emit("end",void 0),this.P.emit("everyEnd",void 0),this.P.emit("allEnd"))}finishAll(t=!0){let e=this;for(;e;)e=e.finish(t)}getFinalValues(){return this.nextAnimations.length>0?this.nextAnimations[this.nextAnimations.length-1].values.map(St):this.values.map(St)}getTimeUntilFinish(){let t=this.duration-this.delta;for(let e=0;e{e>60&&console.log("Note: Animator FPS is usually capped at 60 by the browser!");const i=[];let s,r,n=0;const o=()=>{s=void 0;const h=Date.now();r=r||h,n=h-r,n/1e3>=1/e&&(r=Date.now()-n%(1e3/e),i.forEach((t=>{0===t.delta&&t.L(),t.delta+=n-n%(1e3/e),t.delta>t.duration&&(t.delta=t.duration),t.action(t.eases.map((e=>e(t.delta)))),t.delta===t.duration&&t.finish()})),t()),i.length>0?s=gt.requestAnimationFrame(o):(s=void 0,r=void 0)};return(t=1e3,e=U.linear)=>(r,n,h=t)=>{const a=new H(r,n,h,e,i).start();return s||(s=gt.requestAnimationFrame(o)),a}};var Y,q;e.GradientShape=void 0,(Y=e.GradientShape||(e.GradientShape={})).circle="circle",Y.ellipse="ellipse",e.GradientExtent=void 0,(q=e.GradientExtent||(e.GradientExtent={})).closestSide="closest-side",q.closestCorner="closest-corner",q.farthestSide="farthest-side",q.farthestCorner="farthest-corner";const X=s.Record({stops:[{color:w("#f00"),offset:0},{color:w("#0f0"),offset:1}],position:u(.5,.5),shape:e.GradientShape.ellipse,extent:e.GradientExtent.farthestCorner});class $ extends X{constructor(t){if(super(t),this.type="fillstyle",null===t||t&&null===t.stops||t&&t.stops&&!Array.isArray(t.stops)||t&&t.stops&&Array.isArray(t.stops)&&t.stops.length<2)throw new Error("RadialGradientFill requires minimum two color stops to be defined.")}toString(){return`radialGradientFill:${this.shape},${this.extent},${this.position.x},${this.position.y},${this.stops.map((t=>`${t.offset},${t.color.toString()}`)).join(",")}`}setColorStops(t){if(t.length<2)throw new Error("Minimum of two color stops required");return this.set("stops",t)}getColorStops(){return this.get("stops")}setPosition(t){return this.set("position",t)}getPosition(){return this.get("position")}setShape(t){return this.set("shape",t)}getShape(){return this.get("shape")}setExtent(t){return this.set("extent",t)}getExtent(){return this.get("extent")}}const j=s.Record({stops:[{color:w("#f00"),offset:0},{color:w("#0f0"),offset:1}],angle:0});class Z extends j{constructor(t){if(super(t),this.type="fillstyle",null===t||t&&null===t.stops||t&&t.stops&&!Array.isArray(t.stops)||t&&t.stops&&Array.isArray(t.stops)&&t.stops.length<2)throw new Error("LinearGradientFill requires minimum two color stops to be defined.")}toString(){return`linearGradientFill:${this.angle},${this.stops.map((t=>`${t.offset},${t.color.toString()}`)).join(",")}`}setColorStops(t){if(t.length<2)throw new Error("Minimum of two color stops required");const e=t.sort(((t,e)=>t.offset-e.offset));return this.set("stops",e)}getColorStops(){return this.get("stops")}setAngle(t,e){return this.set("angle",e?oi(t):t)}getAngle(t){return t?ni(this.get("angle")):this.get("angle")}}const K=s.Record({}),J=new class extends K{constructor(){super(...arguments),this.type="linestyle",this.lineType="empty",this.thickness=0}setThickness(t){return this}getThickness(){return 0}O(){return 0}setFillStyle(t){return this}getFillStyle(){return F}},Q=s.Record({fillStyle:new z({color:A(255,255,255)}),thickness:1});class tt extends Q{constructor(t){super(t),this.type="linestyle",this.lineType="solid"}setFillStyle(t){return"function"==typeof t?this.set("fillStyle",t(this.getFillStyle())):this.set("fillStyle",t)}getFillStyle(){return this.get("fillStyle")}setThickness(t){return"function"==typeof t?this.set("thickness",t(this.getThickness())):this.set("thickness",t)}getThickness(){return this.get("thickness")}O(){const t=this.getThickness();return t<0?1:t}}class et{constructor(t,e,i,s){this.cellIndex=t,this.cellSpan=e,this.cellsAmount=i,this.observedAmount=s,this.x=new it,this.y=new it,this.z=new it,this.P=new r.Eventer;const n={...t},o={...e};if(s){const t=t=>{this.cellsAmount.x=t.reduce(Ie,0),this.cellIndex.x=t.reduce(((t,e,i)=>i>=n.x?t:t+e),0),this.cellSpan.x=t.reduce(((t,e,i)=>i>=n.x&&i{this.cellsAmount.y=t.reduce(Ie,0),this.cellIndex.y=t.reduce(((t,e,i)=>i>=n.y?t:t+e),0),this.cellSpan.y=t.reduce(((t,e,i)=>i>=n.y&&i{s.x.N(e),s.y.N(r)}}}G(){return this.V&&(this.V(),this.V=void 0),this}H(t){return this.P.on("cell-resize",t)}W(t){return this.P.off(t,"cell-resize")}}class it extends a{constructor(){super(...arguments),this.U=0,this.$=10,this.Y=1}X(){return this.o=!1,this}j(){return this.o=!0,this}getInnerStart(){return this.U}getInnerEnd(){return this.$}getInnerInterval(){return Math.abs(this.getInnerEnd()-this.getInnerStart())}Z(t,e){return this.U=t,this.$=e,this.K(),this}q(t){return this.Y=t,this.K(),this}J(t){return t/this.Y}K(){const t=this.J(this.$-this.U),e=this.Y;void 0!==this.tt&&!1!==Mt(t,this.tt)||(this.o=!0,this.it=e,this.tt=t)}st(){return this.tt}et(){return this.it}ht(){return this.$new t.scale1DConstructor(0,1,1,void 0),d2:t=>(new t.scaleXYConstructor).nt({x:0,y:0},{x:1,y:1},{x:1,y:1},void 0),d3:()=>new et({x:0,y:0},{x:1,y:1},{x:1,y:1},void 0)},rt=(t,e,i)=>e===i?t:i.ot(e.ut(t)),nt=(t,e,i)=>{if(e===i)return t;const s=e instanceof Di?e.x:e.x instanceof Di?e.x.x:e.x.ct,r=e instanceof Di?e.y:e.y instanceof Di?e.y.y:e.y.ct,n=i instanceof Di?i.x:i.x instanceof Di?i.x.x:i.x.ct,o=i instanceof Di?i.y:i.y instanceof Di?i.y.y:i.y.ct;return{...t,x:rt(t.x,s,n),y:rt(t.y,r,o)}},ot=(...t)=>{if(0===t.length)return{remove:bt};let e=!1;const i=t.map((i=>i.onIntervalChange(((s,r,n)=>((i,s,r)=>{e||(e=!0,t.filter((t=>t!==i)).forEach((t=>t.dt(s,r,!1,!1,"synchronizedAxis"))),e=!1)})(i,r,n)))));let s=!1;const r=t.map((e=>e.onStoppedStateChanged(((i,r)=>((e,i)=>{s||(s=!0,t.filter((t=>t!==e)).forEach((t=>t.setStopped(i))),s=!1)})(e,r)))));return{remove:()=>{t.forEach(((t,e)=>{t.offIntervalChange(i[e]),t.offStoppedStateChanged(r[e])}))}}};class ht extends Error{constructor(t,e){super(`ChartError: ${t} ${e?`in ${e.constructor.name}`:""}`),Object.setPrototypeOf(this,ht.prototype)}}class at extends Error{constructor(t,e,i=!1){const s=`EngineError: ${t} ${e?`in ${e.constructor.name}`:""}`;super(s),i&>.alert(s),Object.setPrototypeOf(this,at.prototype)}}class lt extends at{constructor(t){super(t),Object.setPrototypeOf(this,lt.prototype)}}var ut,ct,dt,ft;e.UISpace=void 0,(ut=e.UISpace||(e.UISpace={}))[ut.Content=0]="Content",ut[ut.PaddedContent=1]="PaddedContent",ut[ut.PaddedBackground=2]="PaddedBackground",ut[ut.Everything=3]="Everything",e.UIVisibilityModes=void 0,(ct=e.UIVisibilityModes||(e.UIVisibilityModes={}))[ct.never=0]="never",ct[ct.always=1]="always",ct[ct.whenHovered=2]="whenHovered",ct[ct.whenDragged=3]="whenDragged",ct[ct.whenNotDragged=4]="whenNotDragged",ct[ct.whenHoveredOrDragged=5]="whenHoveredOrDragged",e.UIDraggingModes=void 0,(dt=e.UIDraggingModes||(e.UIDraggingModes={}))[dt.notDraggable=0]="notDraggable",dt[dt.draggable=1]="draggable",dt[dt.onlyHorizontal=2]="onlyHorizontal",dt[dt.onlyVertical=3]="onlyVertical",e.UIDirections=void 0,(ft=e.UIDirections||(e.UIDirections={}))[ft.Up=0]="Up",ft[ft.Right=1]="Right",ft[ft.Down=2]="Down",ft[ft.Left=3]="Left";const gt="undefined"!=typeof window?window:void 0!==i.g&&i.g._lcjs?i.g._lcjs:{},mt=(t,e)=>t.x===e.x&&t.y===e.y,pt=t=>t!==Me&&t!==Ae&&!Number.isNaN(t)&&Number.isFinite(t)&&t!==1/0&&t!==-1/0,yt=(t,e)=>Math.min(t,e.y),xt=(t,e)=>Math.max(t,e.y),St=t=>t[1],vt=t=>t.dispose(),bt=()=>{},Mt=(t,e)=>t===e,At=(t,e,i)=>i>e?Math.min(Math.max(t,e),i):Math.min(Math.max(t,i),e),wt=t=>Array.prototype.concat.apply([],t),Dt=(t,e)=>{const{x:i,y:s}={x:t[0].length,y:t.length},{column:r,row:n}=e,o=Math.max(0,r.start),h=Math.min(i,r.end),a=Math.max(0,n.start),l=Math.min(s,n.end),u=h-o,c=l-a,d=Array.from(Array(c)).map((()=>Array(u)));for(let e=a,i=0;e{const i=e&&void 0!==e.row.start?e.row.start:0,s=e&&void 0!==e.row.end?e.row.end:t.y,r=e&&void 0!==e.column.start?e.column.start:0,n=e&&void 0!==e.column.end?e.column.end:t.x;return[Math.min(i,s),Math.max(i,s),Math.min(r,n),Math.max(r,n)]},Et=(t,e)=>{for(;e;)t.push(t.shift()),e-=1},Bt=t=>{const e=[];for(const i of t)e.push(i.slice());return e},kt=(t,e)=>void 0!==t?t:e,It=t=>t.ft(),Ct=t=>t.yt(),Pt=t=>t.St(),Lt=t=>t.xt(),Rt=t=>t.min.x,Ft=t=>t.max.x,_t=t=>t.min.y,Ot=t=>t.max.y,zt=(t,e,i,s,r)=>{if(t.length>0){let n=r?s(r):void 0;for(let s=0;st.position===e.position&&t.high===e.high&&t.low===e.low,Nt=u(0,1),Gt=u(1,0),Ut=u(0,-1),Ht=u(-1,0),Wt=u(0,0),Yt=t=>{switch(t){case e.UIDirections.Up:return Nt;case e.UIDirections.Right:return Gt;case e.UIDirections.Down:return Ut;case e.UIDirections.Left:return Ht;default:return Wt}},qt=t=>t===e.UIDirections.Left||t===e.UIDirections.Right,Xt=t=>{t.stopPropagation(),t.preventDefault()},$t=(t,e)=>{if(!e){const e=t.length,i=new Float32Array(2*e);let s=0;for(let r=0;r{const e=t.length,i=new Float32Array(3*e);let s=0;for(let r=0;re=>{const i=t.indexOf(e);i>=0&&t.splice(i,1)},Kt=t=>{let e=t.length;for(let i=0;i{const e=Math.log(t);return t=>Math.log(t)/e},Qt=Jt(Math.E),te=(t,e)=>{const i=e[t];return i?i():void 0},ee=(t,e)=>{let i;if(e)i=e;else{const e={x:0,y:0};for(let i=0;ihi(Je(t,i))-hi(Je(e,i))))},ie=(t,e,i)=>{if(0===t.length)return!1===i.canReturnB?e.slice():e;const s=e.length;if(s<1e5)return t.push.apply(t,e),t;for(let i=0;ii<0?t:i>1?e:A(t.getR()+i*(e.getR()-t.getR()),t.getG()+i*(e.getG()-t.getG()),t.getB()+i*(e.getB()-t.getB()),t.getA()+i*(e.getA()-t.getA())),re=t=>255===t.getA()?t:t.setA(255),ne=(()=>{const t=A(0,0,0);return i=>(i=re(i),new $({shape:e.GradientShape.circle,extent:e.GradientExtent.farthestCorner,position:{x:.2,y:.8},stops:[{offset:0,color:i},{offset:1,color:se(i,t,.5)}]}))})(),oe=(()=>{const t=t=>{var e;if(t){if(t instanceof z){if(0===t.getColor().getA())return;return t.getColor()}if(t instanceof $||t instanceof Z){const i=t.getColorStops();return 3===i.length?i[1].color:null===(e=i[0])||void 0===e?void 0:e.color}}};return(e,i,s)=>{const r=[];if(s.fill&&r.push(s.fill),s.fill2&&r.push(s.fill2),s.stroke){const t=s.stroke;t instanceof tt&&r.push(t.getFillStyle())}if(s.point3D){const t=s.point3D;r.push(t.getFillStyle())}let n;if(s.behavior&&!0===s.behavior.colorStep){const[e,s]=r.reduce(((e,i)=>{if(e[0]&&e[1])return e;const s=t(i);return s&&(void 0===e[0]?e[0]=s:e[1]=s),e}),[void 0,void 0]);n=e&&s?(o=e)===(h=s)||o.getR()===h.getR()&&o.getG()===h.getG()&&o.getB()===h.getB()?ne(o):(o=re(o),h=re(h),new Z({angle:0,stops:[{offset:0,color:h},{offset:.5,color:h},{offset:.5,color:o},{offset:1,color:o}]})):i.uiButtonFillStyle}else{const e=r.reduce(((e,i)=>e||t(i)),void 0);n=e?ne(e):i.uiButtonFillStyle}var o,h;e.setButtonOffFillStyle(new z({color:A(255,255,255,0)})).setButtonOffStrokeStyle(i.uiButtonStrokeStyle).setButtonOnFillStyle(n).setButtonOnStrokeStyle(J)}})(),he=t=>{const e=t;if(e instanceof G)return{lut:e.getPalette(),lookUpProperty:e.getLookUpProperty()}},ae=t=>{let e=0;return()=>(e+=1,`${t}-${e}`)},le=(t,e)=>{let i="string"==typeof t?t:String(t);const s=i.indexOf(".");let r=s>=0?s:i.length;for(;r"function"==typeof t?t(e):t,ce=t=>t.ctrlKey?Math.sign(t.deltaY)*Math.min(.05*Math.abs(t.deltaY),1):Math.sign(t.deltaY),de=(t,e)=>e(),fe=()=>new Error("LightningChart JS encountered an unexpected error.\nPlease report this issue to support@lightningchart.com or Stack Overflow with tag [lightningchart]");new z({color:A(255,255,255,1)});const ge=t=>t===we||t.min.x===we.min.x&&t.max.x===we.max.x&&t.min.y===we.min.y&&t.max.y===we.max.y,me=t=>"boolean"==typeof t?t?1:0:t>1?1:t<0?0:t,pe=(t,e)=>{throw new Error(e)},ye=()=>{const t=W((()=>{}));let e;return(i,s,r,n)=>{const o=null==n?void 0:n.onStart,h=null==n?void 0:n.onCompleted,a=(null==n?void 0:n.easing)||U.ease,l=(null==n?void 0:n.durationMs)||1e3;let u;if(e)if(0===e.nextAnimations.length){const t=e.NextAnimation([[i,s]],(([i])=>{e=t,r(i)}),l,a);u=t}else{i=e.nextAnimations.pop().values[0][0];const t=e.NextAnimation([[i,s]],(([i])=>{e=t,r(i)}),l,a);u=t}else u=t(l,a)([[i,s]],(([t])=>{r(t)})),e=u;u.onAnimationEnd((()=>{e=void 0})),o&&u.onAnimationStart(o),h&&u.onAnimationEnd(h)}},xe=t=>{let e;return()=>e||(e=t(),e)},Se=t=>{if(t===J)return 0;const e=t.getThickness();return e<0?1:1*e},ve=(t,e,i,s)=>{const r=`LightningChart JS Resources not found.\nresourcesBaseUrl: "${t}"\ninitiator: ${i}\nresource url: ${e}\nFor more information, please find the FAQ from API documentation at below link:\nhttps://lightningchart.com/lightningchart-js-api-documentation/\nand read section "What is LightningChart JS Resources not found error?"`;if(s.shouldCrash)throw gt.alert(r),new Error(r);gt.console.warn(r)},be={add:(t,e)=>f(t.x+e,t.y+e,t.z+e),addVec(t,...e){const i={x:t.x,y:t.y,z:t.z};for(const t of e)i.x+=t.x,i.y+=t.y,i.z+=t.z;return i},subtract:(t,e)=>f(t.x-e,t.y-e,t.z-e),subtractVec(t,...e){const i={x:t.x,y:t.y,z:t.z};for(const t of e)i.x-=t.x,i.y-=t.y,i.z-=t.z;return i},multiply:(t,e)=>f(t.x*e,t.y*e,t.z*e),divide:(t,e)=>f(t.x/e,t.y/e,t.z/e),multiplyVec(t,...e){const i={x:t.x,y:t.y,z:t.z};for(const t of e)i.x*=t.x,i.y*=t.y,i.z*=t.z;return i},divideVec(t,...e){const i={x:t.x,y:t.y,z:t.z};for(const t of e)i.x/=t.x,i.y/=t.y,i.z/=t.z;return i},length:t=>Math.sqrt(t.x*t.x+t.y*t.y+t.z*t.z),normalize:t=>be.divide(t,be.length(t)),dot:(t,e)=>t.x*e.x+t.y*e.y+t.z*e.z,cross:(t,e)=>f(t.y*e.z-t.z*e.y,t.z*e.x-t.x*e.z,t.x*e.y-t.y*e.x),angle:(t,e)=>Math.acos(be.dot(t,e)/(be.length(t)*be.length(e))),rotateAroundAxis(t,e,i){const s=Math.cos(i),r=Math.sin(i),n=be.dot(e,t),o=be.cross(e,t);return be.addVec(be.multiply(t,s),be.addVec(be.multiply(e,(1-s)*n),be.multiply(o,r)))},lerp:(t,e,i)=>(i=At(i,0,1),be.addVec(be.multiply(t,1-i),be.multiply(e,i))),equals:(t,e)=>Mt(t.x,e.x)&&Mt(t.y,e.y)&&Mt(t.z,e.z),abs:t=>({x:Math.abs(t.x),y:Math.abs(t.y),z:Math.abs(t.z)}),sign:t=>({x:Math.sign(t.x),y:Math.sign(t.y),z:Math.sign(t.z)})},Me=Number.MAX_SAFE_INTEGER,Ae=-Number.MAX_SAFE_INTEGER,we=m(u(Me,Me),u(Ae,Ae)),De=m(f(Me,Me,Me),f(Ae,Ae,Ae)),Te=(t,e)=>{const i=Math.log(t)/Math.log(e);return Math.floor((t=>(Math.ceil(t)-t<1e-4?t=Math.ceil(t):t-Math.floor(t)<1e-4&&(t=Math.floor(t)),t))(i))},Ee=(t,e)=>!(e.min.x>t.max.x||e.max.xt.max.y||e.max.y!(t[1].xe[1].x||t[3].ye[3].y),ke=(t,e)=>m(u(Math.max(Math.min(t[0].x,t[2].x),Math.min(e[0].x,e[2].x)),Math.max(Math.min(t[0].y,t[2].y),Math.min(e[0].y,e[2].y))),u(Math.min(Math.max(t[0].x,t[2].x),Math.max(e[0].x,e[2].x)),Math.min(Math.max(t[0].y,t[2].y),Math.max(e[0].y,e[2].y)))),Ie=(t,e)=>e+t,Ce=(t,e,i)=>{const s=Je(e,t),r=s.x*s.x+s.y*s.y;if(0===r)return t;const n=Je(i,t),o=(n.x*s.x+n.y*s.y)/r;return o<=0?t:o>=1?e:u(t.x+o*s.x,t.y+o*s.y)},Pe=(t,e,i)=>i>e?t>=e&&t<=i:t>=i&&t<=e,Le=(t,e)=>{const i=t.x-e.x,s=t.y-e.y;return Math.sqrt(i*i+s*s)},Re=(t,e)=>{const i=t.x-e.x,s=t.y-e.y;return i*i+s*s},Fe=(t,e,i)=>{const s=Re(e,i);if(0===s)return[Re(t,e),e];let r=ii(Je(t,e),Je(i,e))/s;r=Math.max(0,Math.min(1,r));const n=u(e.x+r*(i.x-e.x),e.y+r*(i.y-e.y));return[Re(t,n),n]},_e=(t,e,i)=>Ke(t,Ze(Je(e,t),i)),Oe=(t,e,i)=>be.addVec(t,be.multiply(be.subtractVec(e,t),i));function ze(t){const e=t.length;if(e>0){let i=t[0].x,s=t[0].x,r=t[0].y,n=t[0].y;for(let o=0;oi&&(i=e.x),e.xr&&(r=e.y),e.y0){let i=t[0].x,s=t[0].x,r=t[0].y,n=t[0].y,o=t[0].z,h=t[0].z;for(let a=0;ai&&(i=e.x),e.xr&&(r=e.y),e.yo&&(o=e.z),e.zm(u(t.min.xe.max.x?t.max.x:e.max.x,t.max.y>e.max.y?t.max.y:e.max.y)),Ge=(t,e)=>m(f(t.min.xe.max.x?t.max.x:e.max.x,t.max.y>e.max.y?t.max.y:e.max.y,t.max.z>e.max.z?t.max.z:e.max.z));function Ue(t,e,i,s){const r=t.x-s.x,n=t.y-s.y,o=s.x-i.x,h=i.y-s.y,a=h*r+o*n,l=(s.y-e.y)*r+(e.x-s.x)*n,u=h*(e.x-s.x)+o*(e.y-s.y);return u<0?a<=0&&l<=0&&a+l>=u:a>=0&&l>=0&&a+l<=u}const He=(t,e,i,s)=>u((t.x+e.x+i.x+s.x)/4,(t.y+e.y+i.y+s.y)/4),We=(t,e,i,s,r)=>{if(e.x>i.x)if(e.x>s.x)if(e.x>r.x){if(t.x>e.x)return!1;if(r.xr.x)return!1;if(s.xr.x){if(t.x>s.x)return!1;if(r.xr.x)return!1;if(t.xs.x)if(i.x>r.x){if(t.x>i.x)return!1;if(r.xr.x)return!1;if(s.xr.x){if(t.x>s.x)return!1;if(r.xr.x)return!1;if(s.xi.y)if(e.y>s.y)if(e.y>r.y){if(t.y>e.y)return!1;if(r.yr.y)return!1;if(s.yr.y){if(t.y>s.y)return!1;if(r.yr.y)return!1;if(t.ys.y)if(i.y>r.y){if(t.y>i.y)return!1;if(r.yr.y)return!1;if(s.yr.y){if(t.y>s.y)return!1;if(r.yr.y)return!1;if(s.y{const s=(i.y-e.y)/(i.x-e.x),r=e.y+(t-e.x)*s;return u(t,r)},ri=(t,e,i)=>{const s=(i.y-e.y)/(i.x-e.x),r=e.x+(t-e.y)/s;return u(r,t)};function ni(t){return t*Math.PI/180}function oi(t){return 180*t/Math.PI}function hi(t){return 180*Math.atan2(t.y,t.x)/Math.PI}function ai(t){return u(Math.cos(t),Math.sin(t))}function li(t){let e=-1;const i=Math.cos(t),s=Math.sin(t);return i>0&&i<1&&s>0&&s<1?e=1:i<0&&i>-1&&s>0&&s<1?e=2:i<0&&i>-1&&s<0&&s>-1?e=3:i>0&&i<1&&s<0&&s>-1&&(e=4),e}const ui=(t,e,i,s)=>{let r,n,o,h;if(e.x-t.x!=0||s.x-i.x!=0)return e.x-t.x==0?(o=e.x,n=(s.y-i.y)/(s.x-i.x),h=n*(o-i.x)+i.y):s.x-i.x==0?(o=s.x,r=(e.y-t.y)/(e.x-t.x),h=r*(o-t.x)+t.y):(r=(e.y-t.y)/(e.x-t.x),n=(s.y-i.y)/(s.x-i.x),o=(i.y-n*i.x+r*t.x-t.y)/(r-n),h=r*(o-t.x)+t.y),u(o,h)},ci=(t,e)=>{const i=t.length,s=e.length,r=new Uint16Array(i+s);return r.set(t,0),r.set(e,i),r};class di{constructor(){this.bt=!0}getInnerStart(){return this.U}getInnerEnd(){return this.$}getInnerInterval(){return Math.abs(this.$-this.U)}Z(t,e){return this.U=t,this.$=e,this}X(){return this.bt=!1,this}j(){return this.bt=!0,this}}class fi extends di{constructor(t,e,i,s){if(super(),this.vt=!0,this.Mt=!0,this._t=[0,0],this.At=!0,this.wt=t,this.kt=e,this.Ct=i,this.Tt=t,this.It=e,s){const t=s.R(this.Ft.bind(this));this.Ft(s.M()),this.Pt=()=>s.N(t)}}q(t){return this.Y=t,this.Mt=!0,this}Dt(t){return this._t=t.map(Math.abs),this.At=!0,this}Bt(){return this.wt/this.Ct*this.Y+this._t[0]}Lt(){return(this.wt+this.kt)/this.Ct*this.Y-this._t[1]}Ot(){return this.getCellSize()-this.Rt()}Et(){return this.Y}getCellSize(){return this.zt(this.Y)}Rt(){return this._t[0]+this._t[1]}Vt(){return this._t}Ft(t){this.Ct=t.reduce(Ie,0),this.wt=t.reduce(((t,e,i)=>i>=this.Tt?t:t+e),0),this.kt=t.reduce(((t,e,i)=>i>=this.Tt&&ixi;return!n&&!o||!!r&&(e>t?{start:n?yi:t,end:o?xi:e}:{start:o?xi:t,end:n?yi:e})}ut(t){const e=this.Bt(),i=this.Lt(),s=Math.max(t,yi);return e+(this.Gt.function(s)-this.Ht.scaleStartLog)/this.Ht.scaleIntervalLog*(i-e)}ot(t){const e=this.Bt(),i=(t-e)/(this.Lt()-e),s=this.Ht.scaleStartLog+i*this.Ht.scaleIntervalLog;return this.Gt.number**s}Nt(){this.Gt&&this.Wt()}Z(t,e){return super.Z(t,e),this.Gt&&this.Wt(),this}Dt(t){return super.Dt(t),this.Gt&&this.Wt(),this}q(t){return super.q(t),this.Gt&&this.Wt(),this}Ut(t){return this.Gt={internal:t,function:mi(t),number:pi(t)},this}$t(){return this.Gt.internal}Yt(t,e){const i=this.ut(t)+e;return this.ot(i)}get Xt(){return this.Mt||this.bt||this.At||this.vt}Wt(){const t=this.Gt.function(this.U),e=this.Gt.function(this.$)-t,i=2*this.Bt()/this.Y-1,s=2*this.Lt()/this.Y-1-i;return this.Ht={scaleStartLog:t,scaleIntervalLog:e,viewportStart:i,viewportSize:s},this.Ht}jt(){return this.Ht}}const mi=t=>"e"===t?Qt:Jt(t),pi=t=>"e"===t?Math.E:t,yi=.9*1e-9,xi=1.1*10**32,Si=["K","M","B","T"],vi=(t,e,i)=>{const s=Math.abs(i-e),r=Math.max(2-Te(s,10),0);return t.toFixed(r)},bi={Numeric:(t,e)=>vi(t,e.getInnerStart(),e.getInnerEnd()),NumericUnits:(t,e)=>{const i=Math.abs(e.getInnerEnd()-e.getInnerStart()),s=t<0;t=Math.abs(t);const r=Te(t,1e3),n=1e3**r;let o="",h="";if(i>=1e3&&t>=1e3){const e=10**(Te(i,10)-1),a=Math.round(t/e)*e/n;let l=r;for(;l>0;){const t=Math.min(l,Si.length)-1;h=Si[t]+h,l-=t+1}o=(s?"-":"")+a}else{let e=String(Math.floor(t));for(let t=1;t<=r;t+=1){const i=e.length-(3*t+(t-1));e=`${e.substring(0,i)} ${e.substring(i,e.length)}`}o=(s?"-":"")+e+(i<=10?((t,e)=>{if(0===e)return"";let i=(Math.abs(t)-Math.abs(Math.floor(t))).toString().substring(1);return i.length>e&&(i=i.substring(0,e+1)),i})(t,2-Te(i,10)):"")}return o+=h,o}},Mi=(t,e)=>{const i=mi(e);return"e"===e?t?(t,e)=>`${Math.floor(i(t))}e`:()=>"":(t,e)=>{const s=t.toString();if(t>1)return s;const r=Math.floor(i(t));return t.toFixed(Math.abs(r))}};class Ai extends fi{constructor(t,e,i,s){super(t,e,i,s),this.Zt=!1,this.Xt=!1,this.Kt=0,this.Y=1e3,this.Z(0,10),this.K()}rt(t,e,i,s,r){if(t===e)return!1;const n=Math.abs(s-i),o=Math.abs(e-t);if(!this.Zt){const i=((t,e,i)=>{const s=((t,e)=>{if(eAe&&tAe){const i=Math.abs(t/2**23),s=Math.abs(e/2**23),r=Math.min(i,s);return 10**Math.floor(Math.log10(r))}})(t,e);if(void 0!==s)return s*i})(t,e,this.getCellSize());if(void 0===i)return!1;if(o>i)return!0;const s=(e+t)/2,h=(r?i/2:n/2)*(t>e?-1:1);return{start:s-h,end:s+h}}const h=10**-(12-Math.log10(Math.max(Math.abs(t),1)));if(o>h)return!0;const a=(e+t)/2,l=(r?h/2:n/2)*(t>e?-1:1);return{start:a-l,end:a+l}}Nt(){this.K()}ut(t){return this.Bt()+(t-this.U)/(this.$-this.U)*(this.Lt()-this.Bt())}ot(t){return this.U+(t-this.Bt())/(this.Lt()-this.Bt())*(this.$-this.U)}Z(t,e){return super.Z(t,e),this.K(),this}Dt(t){return super.Dt(t),this.K(),this}q(t){return super.q(t),this.qt=wi(this.$-this.U,this._t,this.Y,this.kt,this.Ct),this.K(),this}Jt(){return this.Zt=!0,this}Qt(){return this.Zt}ti(){return Math.abs(this.ii)}si(){return this.ti()/this.qt}ei(){return this.hi}ri(){return this.ni}getPixelSize(){return this.qt}jt(){return this.Ht}j(){return super.j(),this.Xt=!0,this}X(){return super.X(),this.Xt=!1,this}oi(t,e=bi.Numeric){return e(t,this)}ai(){const t=Math.abs(this.getInnerEnd()).toString().length,e=Math.abs(this.getInnerStart()).toString().length;return t>e?t:e}li(t){return wi(t,this._t,this.Y,this.kt,this.Ct)}K(){let t=this.U,e=this.$,i=0;this.Zt&&(t=0,e=this.$-this.U,i=this.U);const s=e-t,r=wi(s,this._t,this.Y,this.kt,this.Ct);this.ni=t-this._t[0]*r,this.hi=e+this._t[1]*r;const n=this.hi-this.ni,o=n-this.ii,h=Math.abs(o/r),a=s-this.Kt,l=Math.abs(a/r);(!this.Ht||h>=.4||l>=.4)&&(this.Kt=s,this.ii=n,this.qt=r,this.Xt=!0);const u=this.ii*this.Ct/(2*this.kt),c=-(this.ni-this.ii*this.wt/this.kt)-u,d=2*this.Bt()/this.Y-1,f=2*this.Lt()/this.Y-1-d;this.Ht={displacement:c,scaling:u,highPrecisionOffset:i,viewportStart:d,viewportSize:f,scaleStartLog:0,scaleIntervalLog:0}}Yt(t,e){return t+this.qt*e}}const wi=(t,e,i,s=1,r=1)=>t/(i*s/r-(e[0]+e[1]));class Di{ui(t,e){return"x"in t?(this.x=t.x,this.y=t.y):(this.x=t,this.y=e),this}X(){return this.x.X(),this.y.X(),this}j(){return this.x.j(),this.y.j(),this}q(t,e){return"object"==typeof t?(this.x.q(t.x),this.y.q(t.y)):(this.x.q(t),this.y.q(e)),this}Et(){return u(this.x.Et(),this.y.Et())}ci(t){return this.x.Dt(t),this}di(t){return this.y.Dt(t),this}Rt(){return u(this.x.Rt(),this.y.Rt())}fi(t,e){return this.x.Z(t,e),this}gi(t,e){return this.y.Z(t,e),this}getInnerIntervalPixels(){const t=this.x.getCellSize(),e=this.y.getCellSize();return{x:t-this.x.Rt(),y:e-this.y.Rt()}}pi(){return this.x.Xt||this.y.Xt}}class Ti extends Di{constructor(){super(...arguments),this.mi="LinearScaleXY"}nt(t,e,i,s){return this.x=new Ai(t.x,e.x,i.x,s?s.x:void 0),this.y=new Ai(t.y,e.y,i.y,s?s.y:void 0),this}Qt(){return this.x.Qt()||this.y.Qt()}yi(){return u(this.x.getPixelSize(),this.y.getPixelSize())}jt(){return{x:this.x.jt(),y:this.y.jt()}}Yt(t,e){const i=this.yi();return{x:t.x+e.x*i.x,y:t.y+e.y*i.y}}Si(t,e,i,s){const r=this.yi(),n=$e(t,e);return n.x*=s,n.y*=s,{x:t.x+i*r.x*n.x,y:t.y+i*r.y*n.y}}}class Ei extends Di{constructor(){super(...arguments),this.mi="MixedScaleXY"}Qt(){return!1}Yt(t,e){const i=this.x.ut(t.x),s=this.y.ut(t.y),r={x:i+e.x,y:s+e.y};return{x:this.x.ot(r.x),y:this.y.ot(r.y)}}Si(t,e,i,s){const r={x:this.x.ut(t.x),y:this.y.ut(t.y)},n={x:this.x.ut(e.x),y:this.y.ut(e.y)},o=Xe(Je(n,r)),h=$e(n,r),a={x:r.x+o.x*s+h.x*i,y:r.y+o.y*s+h.y*i};return{x:this.x.ot(a.x),y:this.y.ot(a.y)}}jt(){const t=this.x.jt(),e=this.y.jt();return{uScaleStart:[this.x.U,this.y.U],uScaleInterval:[this.x.getInnerInterval(),this.y.getInnerInterval()],uScaleStartLog:[t.scaleStartLog,e.scaleStartLog],uScaleIntervalLog:[t.scaleIntervalLog,e.scaleIntervalLog],uViewportStart:[t.viewportStart,e.viewportStart],uViewportSize:[t.viewportSize,e.viewportSize]}}}const Bi={fitting:{start:(t,e,i,s)=>e>=t?i:s,end:(t,e,i,s)=>e>=t?s:i},expansion:{start:(t,e,i,s)=>e>=t?it?s:t,end:(t,e,i,s)=>e>=t?s>e?s:e:ie>t?Bi.progressive.end(t,e,i,s)+(t-e):s>t?s:t,end:(t,e,i,s)=>e>t?s>e?s:e:Bi.progressive.start(t,e,i,s)+(e-t)},regressive:{start:(t,e,i,s)=>e>t?ie>t?Bi.regressive.start(t,e,i,s)+(e-t):ivoid 0!==t.xi,Ci=t=>void 0!==t.bi,Pi={vi:bi.Numeric},Li=(t,e)=>[t,e],Ri=(t,e,i,s)=>{const r=[],n=Math.round(Math.abs((t-e)/i));for(let o=1;o{Mt(t,0)&&(t=0),Mt(e,0)&&(e=0);const n=[];let o=void 0!==s?((t,e,i)=>t-(t-i)%e)(t,i,s):t;if(i<=0)throw new Error(`_getRegularGreatKeyValues unit less than or equal to 0, unit: ${i}`);for(;o{const r=[];let n=i(t),o=0;for(;n1e3)throw new Error("Infinite loop in Axis tick key values logic.");return r.push(n),r},Oi=(t,...e)=>{const i=e.length>0?e.length:t?1:0;return(s,r,n,o,h,a)=>{if(r>=i)return;const l=e[r]||1;let u=!1,c=!1,d=1;return t&&(u="ignore"in t?"first"===t.ignore||"both"===t.ignore:u,c="ignore"in t?"last"===t.ignore||"both"===t.ignore:c,d="offset"in t&&void 0!==t.offset?t.offset:d),((t,e,i,s,r)=>(i&&(t=t.filter(((t,e)=>e>0))),s&&(t=t.filter(((e,i)=>i(i+r)%e==0))))(s,l,u,c,d)}},zi=(t,e)=>{if(e.has(t))return e.get(t);const i=ze(t._i.Mi());return e.set(t,i),i},Vi=t=>{const e=new Map;if(t!==Pi){for(const i of t.Ai)e.set(i,new Map);for(const i of t.wi)e.set(i,new Map)}return e};class Ni{constructor(t,e,i,s,n,o,h){this.P=new r.Eventer,this.ki=Pi,this.Ci=ki.Empty,this.Ti=new Map,this.Ii=new Map,this.Fi=Bi.fitting,this.Pi=!0,this.Di=W((()=>this.chart.Li.Bi()))(300,U.linear),this.Oi=!0,this.Ri=!0,this.Ei=!1,this.zi=Ae,this.Vi=!1,this.Ni=!1,this.Gi=Ae,this.Hi=Ae,this.Wi=Ae,this.Ui={},this.$i=(t,e,i,s,r,n)=>{const o=[],h=[];for(const a of t){if(as){o.push(a);continue}const t=this.Ti.get(e),l=(t?t.get(a):void 0)||this.Yi(a,e);l.Xi=!1;const u=this.ji(l,r);n.set(l,u),o.push(a),h.push(l)}return{displayedKeyValues:o,createdTicks:h}},this.Zi=(t,e,i,s,r,n,o,h,a,l,u)=>{const c=[];for(let d=0;dvoid 0!==t)).filter((e=>e.qi!==i||!!t.find((t=>t===e)))).map((t=>Ee(e,zi(t,a))?t:void 0)),m=y.some((t=>void 0!==t))}else m=!1;if(m){let t=!0;const e=y.filter((t=>void 0!==t));if(t&&i.Ji&&e.every((t=>Ii(t.qi)))&&(t=!1),t&&i.Ji&&i.Ji.Qi&&!1===i.Ji.Qi(g,s,r,n,o,h)&&(t=!1),!1===t)continue;return!0}c.push(f)}return c},this.formatValue=t=>this.ki.vi(t,this.ct),this.ts=([t,e])=>{this.ss(t,e)},this.chart=t,this.es=e,this.hs=s,this.rs=o,this.ct=i,this.ns=h,"logarithmic"===h.type&&this.setAnimationZoom(U.logarithmic(pi(h.base))),this.os=o.numeric,this.setTickStrategy("Numeric"),this.ls=i.getInnerStart(),this.us=i.getInnerEnd(),n&&this.setAnimationsEnabled(!1)}getTitle(){return this.ds.cs()}setTitle(t){return this.ds.fs(t),this.chart.Li.Bi(),this}getTitleFillStyle(){return this.ds.gs()}setTitleFillStyle(t){return this.ds.ps(t),this.chart.Li.Bi(),this}getTitleFont(){return this.ds.ys()}setTitleFont(t){return this.ds.Ss(t),this.chart.Li.Bi(),this}setTitleRotation(t){return this.ds.xs(t),this.chart.Li.Bi(),this}getTitleRotation(){return this.ds.bs()}setTitleEffect(t){return this.Ms.vs(t),this.chart.Li.Bi(),this}getTitleEffect(){return this.Ms._s()}setTickStrategy(t,e){if(this.As(),"Empty"===t)this.ki=Pi,this.Ci=t;else if("Numeric"===t){"Numeric"!==this.Ci&&(this.os=this.rs.numeric);const i=e||(t=>t);this.os=i(this.os),this.ki=this.os.ws(this.ns),this.Ci=t}else if("DateTime"===t){"DateTime"!==this.Ci&&(this.os=this.rs.datetime);const i=e||(t=>t);this.os=i(this.os),this.ki=this.os.ws(this.ns),this.Ci=t}else if("Time"===t){"Time"!==this.Ci&&(this.os=this.rs.time);const i=e||(t=>t);this.os=i(this.os),this.ki=this.os.ws(this.ns),this.Ci=t}return this.Ii.forEach((t=>Array.from(t.values()).forEach((t=>t.dispose())))),this.Ii=Vi(this.ki),this.chart.Li.Bi(),this}getTickStrategy(){return this.Ci}ks(){return this.ki}Cs(t){this.ki=t,this.Ii.forEach((t=>Array.from(t.values()).forEach((t=>t.dispose())))),this.Ii=Vi(this.ki),this.chart.Li.Bi()}setInterval(t){const{start:e,end:i,animate:s,stopAxisAfter:r}=t;return this.dt(void 0!==e?e:this.ls,void 0!==i?i:this.us,void 0!==s&&s,void 0===r||r,"userSetInterval"),this}dt(t,e,i=!1,s=!0,r){let n={start:t,end:e};const o=Math.abs(e-t);if(Math.abs(this.us-this.ls),void 0!==this.ki.Ts&&this.ki.Ts>o){const i=(e+t)/2,s=this.ki.Ts/2*(t>e?-1:1);n={start:i-s,end:i+s}}if(void 0!==this.ki.Is&&this.ki.Ise?-1:1);n={start:i-s,end:i+s}}const h=this.ct.rt(n.start,n.end,this.ls,this.us,!0);if(!1===h)return this;let a;switch(!0===h||(n=h),r){case"userSetInterval":case"userFit":case"interactionSetInterval":case"interactionZoom":a=!0;break;case"zoomBandChart":case"synchronizedAxis":a=!1;break;default:return pe(0,""),this}if(this.Fs&&this.Fs.finishAll(!1),this.Di&&(!0===i||i>0)){this.setStopped(!0);const t=!0===i?void 0:i,e=!this.Fs||this.Fs.isOver()?this.Di:this.Fs.NextAnimation.bind(this);this.Fs=e([[this.ls,n.start],[this.us,n.end]],this.ts,t),this.Fs.onAnimationEnd((()=>{this.Fs=void 0,a&&(this.Wi=gt.performance.now())})),this.Fs.onAnimationEnd((()=>this.setStopped(s)))}else this.ss(n.start,n.end),s&&this.setStopped(!0),a&&(this.Wi=gt.performance.now());return this}getInterval(){return{start:this.ls,end:this.us}}setStopped(t){return t===this.Ei||(t&&(this.Fs&&this.Fs.finishAll(!1),this.Fs=void 0),this.Ei=t,this.P.emit("stoppedStateChanged",this,this.Ei),this.zi=gt.performance.now(),this.chart.Li.Bi()),this}getStopped(){return this.Ei}onStoppedStateChanged(t){return this.P.on("stoppedStateChanged",t)}offStoppedStateChanged(t){return this.P.off(t,"stoppedStateChanged")}fit(t,e=!1){const i=this.Ps(!1);if(i){const s=this.us>=this.ls,r=s?i.min:i.max,n=s?i.max:i.min;this.dt(r,n,t,e,"userFit")}return this}setScrollStrategy(t){return this.Fi=t,this.chart.Li.Bi(),this}getScrollStrategy(){return this.Fi}setAnimationScroll(t){return this.Pi=Boolean(t),this.chart.Li.Bi(),this}setAnimationZoom(t,e=300){return this.Fs&&(this.Fs.finishAll(!1),this.Fs=void 0),this.Di=t?W((()=>this.chart.Li.Bi()))(e,t):void 0,this}setAnimationsEnabled(t){return this.Oi=t,t?(this.setAnimationScroll(!0),this.setAnimationZoom(U.ease,void 0)):(this.setAnimationScroll(void 0),this.setAnimationZoom(void 0)),this}getAnimationsEnabled(){return this.Oi}setVisible(t){const e=this.Ri!==t;return this.Ri=t,this.ds.setVisible(t),this.Ds((e=>{e._i.setVisible(t)})),e&&this.P.emit("visibleStateChanged",this,this.Ri),this}getVisible(){return this.Ri}onIntervalChange(t){return this.P.on("scaleChange",t)}offIntervalChange(t){return this.P.off(t,"scaleChange")}onVisibleStateChanged(t){return this.P.on("visibleStateChanged",t)}offVisibleStateChanged(t){return this.P.off(t,"visibleStateChanged")}Bs(t,e){const i=new Map;if(this.ki===Pi)return this.As(),i;e=e||new Map;const s=this.Ls(),r=s.min,n=s.max,o=n-r,h=t.physicalAxisSize;this.Ui.physicalAxisSize=h;const a=Ui(this.ki,r,n,this.ls,this.us,h),l=[];if(this.Os(),l.push(...this.Rs(this.ki,r,n,a,e,t,i)),this.Es(this.ki,r,n,a,e,t,l,i),this.zs(),a)for(const[t,e]of this.Ii){const i=a.get(t);if(void 0!==i)for(const[t,s]of e)i.includes(t)||(null==s||s.dispose(),e.delete(t))}return this.Ui.min=r,this.Ui.max=n,this.Ui.scaleInterval=o,this.Ui.physicalAxisSize=h,i}Vs(t){const e=t.qi.Ns;t._i.fs(e(t.u,this.ct)).Gs()}Hs(t,e){const i=e.Ws;t._i.ps(i.getLabelFillStyle()).Ss(i.getLabelFont()).xs(i.getLabelRotation())}Yi(t,e){const i=this.Ii.get(e);let s=i.get(t);s?(i.delete(t),s.qi=e,s.Us(!0)):s=this.$s(t,e);const r=this.Ti.get(e)||new Map;return r.set(t,s),this.Ti.set(e,r),this.Hs(s,e),s}ji(t,e){const i=this.Ys(t,e);return this.Vs(t),i}Rs(t,e,i,s,r,n,o){const h=[];for(const a of t.Ai){const t=s.get(a);for(const s of t){if(si)continue;const t=this.Ti.get(a),l=(t?t.get(s):void 0)||this.Yi(s,a),u=this.ji(l,n),c=zi(l,r);h.find((t=>Ee(c,zi(t,r))))&&l._i.setVisible(!1),l.Xi=!1,o.set(l,u),h.push(l)}}return h}Es(t,e,i,s,r,n,o,h){let a,l=[];for(const u of t.wi){const t=s.get(u);if(!t)break;let c;if(void 0===a)c=[{start:e,end:i,keyValues:t}];else{c=[];for(let e=0;e=i&&e0){if(void 0===u.Ji){y=!1;break}const t=u.Ji.Xs;if(a=t(a,d-1,n,h,e,i),void 0===a)break}const p=this.Zi(m.filter((t=>a.some((e=>Mt(t.u,e))))),g,u,d,n,h,e,i,r,o,l);!0!==p?t=t.concat(p):(d+=1,f=-1,t=[])}p=t,m.forEach((e=>{t.find((t=>t===e))||this.js(e)}))}if(l=p,!y)break}}js(t){const e=this.Ti.get(t.qi);null==e||e.delete(t.u);const i=this.Ii.get(t.qi);i&&i.has(t.u)?t.dispose():i&&(t.Us(!1),i.set(t.u,t))}Ds(t){for(const e of this.Ti.values())for(const i of e.values())t(i)}Zs(t,e){for(const i of this.Ti.values())for(const s of i.values())e=t(e,s);return e}As(){this.Ti.forEach(((t,e)=>{t.forEach((t=>this.js(t)))})),this.Ti.clear()}Os(){for(const t of this.Ti.values())for(const e of t.values())e.Xi=!0}zs(){for(const t of this.Ti.values())for(const[e,i]of t.entries())i.Xi&&(i.dispose(),t.delete(e))}Ls(){const t=this.ct.getInnerStart()this.ct.getInnerStart()?this.ct.getInnerEnd():this.ct.getInnerStart();return m(t,e)}Ki(t,e){return!(t.Xi||0===t._i.cs().length||Ii(e)&&!0!==e.Ks)}qs(t,e){return this.ki===Pi||(this.ki.Ai.forEach((i=>{e=t(e,i.Ws)})),this.ki.wi.forEach((i=>{(t=>void 0!==t.Ns)(i)&&(e=t(e,i.Ws))}))),e}Ps(t){let e;for(const t of this.Js()){if(!t.Qs())continue;const i=this.es.te(t),s=this.es.ie(t);if(void 0!==i&&pt(i)&&void 0!==s&&pt(s)){if("logarithmic"===this.ns.type){let t;if(Math.sign(i)!==Math.sign(s)&&(t=`Logarithmic series data range must be either > 0 or < 0 (encountered [${i}, ${s}])`),0!==i&&0!==s||(t=`Logarithmic series data range is not defined at 0 (encountered [${i}, ${s}])`),t)throw gt.alert(t),new Error(t)}e?(e.min=Math.min(e.min,i),e.max=Math.max(e.max,s)):e=m(i,s)}}if(e&&pt(e.min)&&pt(e.max)){if(Mt(e.min,e.max)){if(t)return;return{min:e.min-1,max:e.max+1}}return e}}se(){let t=0;for(const e of this.Js()){if(!e.Qs())continue;const i=this.es.ee(e);i&&(t=Math.max(t,i))}return t}he(){const t=this.Js(),e=this.Vi;let i=!1;if(0!==t.length&&this.Fi&&!this.Ei){const t=this.Ps(!0);if(t){const e=this.ls,s=this.us;let r=this.Fi.start(e,s,t.min,t.max),n=this.Fi.end(e,s,t.min,t.max);const o=!1===Mt(e,r),h=!1===Mt(s,n);if(r=o?r:e,n=h?n:s,o||h){let t=!1;if(this.Pi)if(this.Pi){t=!0;const a=o?this.re(e,r):e,l=h?this.re(s,n):s;if(!0===this.ss(a,l,{allowClamping:!1})&&(o&&!1===Mt(a,r)||h&&!1===Mt(l,n))){this.chart.Li.Bi(!0),i=!0;let t=Math.abs(n-r)/Math.abs(a-l);t<1&&(t=1/t),this.Ni=t>=1.4}}else t=!1;t||this.ss(r,n)}}}i?(this.Vi!==i&&(this.Vi=i,this.Gi=gt.performance.now()),this.ne&&(clearTimeout(this.ne),this.ne=void 0)):!0===e&&void 0===this.ne&&(this.Ni=!1,this.ne=setTimeout((()=>{!1!==this.Vi&&(this.Vi=!1,this.Gi=gt.performance.now()),this.ne=void 0,this.chart.Li.Bi()}),200))}ss(t,e,i){const s=!i||!("allowClamping"in i)||void 0===i.allowClamping||i.allowClamping;let r={start:t,end:e},n=!0;const o=Math.abs(e-t),h=Math.abs(this.us-this.ls);if(void 0!==this.ki.Ts&&this.ki.Ts>o){const i=(e+t)/2,o=(s?this.ki.Ts/2:h/2)*(t>e?-1:1);r={start:i-o,end:i+o},n=!1}if(void 0!==this.ki.Is&&this.ki.Ise?-1:1);r={start:i-o,end:i+o},n=!1}let a=this.ct.rt(r.start,r.end,this.ls,this.us,s);if(!1===a)return!1;!0!==a&&(r=a);const l=this.se(),u=this.oe(Math.min(r.start,r.end),Math.max(r.start,r.end),l);return a=this.ct.rt(r.end>r.start?u.min:u.max,r.end>r.start?u.max:u.min,this.ls,this.us,!1),!!a&&(!0===a?this.ct.Z(r.end>r.start?u.min:u.max,r.end>r.start?u.max:u.min):this.ct.Z(r.start,r.end),this.ls=r.start,this.us=r.end,this.P.emit("scaleChange",this,r.start,r.end),this.Hi=gt.performance.now(),this.chart.Li.Bi(),n)}ae(){return this.Vi}le(){return void 0!==this.Fs}}class Gi{constructor(t,e,i,s,r=i.ue(s).setMouseInteractions(!1)){this.Xi=!1,this.ce=!1,this.de=[],this.qi=t,this.u=e,this.fe=i,this.ge=s,this._i=r,this.de.push(r)}Us(t){this.de.forEach((e=>e.setVisible(t)))}dispose(){return this.ce||(this.ce=!0,this.de.forEach((t=>t.dispose()))),this}}const Ui=(t,e,i,s,r,n)=>{const o=new Map;for(const n of t.Ai){let t=n.pe(e,i,s,r);t=Hi(t),o.set(n,t)}let h;for(const s of t.wi){let t;if(void 0===h)t=s.pe(e,i,e,i);else{let r=[];const o=h.filter((t=>e<=t&&t<=i)).length;if(o>0){const t=n/(o-1);if(void 0!==s.me&&s.me>t)break}for(let t=0;t(t=(t=>{const e={},i=[],s=t.length;let r=0;for(let n=0;nt-e)),Wi=s.Record({size:14,family:"Arial",weight:"normal",style:"normal",variant:!1});class Yi extends Wi{constructor(t){super(t)}setSize(t){return this.set("size",t)}setFamily(t){return this.set("family",t)}setWeight(t){return this.set("weight",t)}setStyle(t){return this.set("style",t)}setVariant(t){return this.set("variant",t)}getSize(){return this.get("size")}getFamily(){return this.get("family")}getWeight(){return this.get("weight")}getStyle(){return this.get("style")}getVariant(){return this.get("variant")}}const qi=new Yi,Xi=new class{},$i=s.Record({shape:"sphere",size:10,fillStyle:new z,wireframeStyle:J});class ji extends $i{constructor(t){super(t)}setSize(t){return this.set("size",t)}getSize(){return this.get("size")}setFillStyle(t){return"function"==typeof t?this.set("fillStyle",t(this.get("fillStyle"))):this.set("fillStyle",t)}getFillStyle(){return this.get("fillStyle")}setWireframeStyle(t){return"function"==typeof t?this.set("wireframeStyle",t(this.get("wireframeStyle"))):this.set("wireframeStyle",t)}getWireframeStyle(){return this.get("wireframeStyle")}setShape(t){return this.set("shape",t)}getShape(){return this.get("shape")}}const Zi=s.Record({size:5,fillStyle:new z});class Ki extends Zi{constructor(t){super(t)}setSize(t){return this.set("size",t)}getSize(){return this.get("size")}setFillStyle(t){return"function"==typeof t?this.set("fillStyle",t(this.get("fillStyle"))):this.set("fillStyle",t)}getFillStyle(){return this.get("fillStyle")}}const Ji={Triangulated:ji,Pixelated:Ki};class Qi{constructor(t){this.ye=new Map,this.Li=t}Se(t,e,i){const s=i.animationEnabled;this.ye.set(t,{applyHighlight:e,curUnanimatedHighlightValue:0,curAnimationPositionMillis:0,animationEnabled:s,curAnimatedHighlightValue:0});const r=t.onDispose((()=>{this.ye.delete(t),t.offDispose(r)}))}xe(t,e){const i=this.ye.get(t);i&&(i.curUnanimatedHighlightValue=me(e),this.Li.Bi())}be(t){const e=this.ye.get(t);return e?e.curUnanimatedHighlightValue:0}ve(t,e){const i=this.ye.get(t);i&&(i.animationEnabled=e)}Me(t){const e=this.ye.get(t);return!!e&&e.animationEnabled}Gs(t){let e=!1;this.ye.forEach(((i,s)=>{let r;if(i.animationEnabled){const s=1e3;if(i.curUnanimatedHighlightValue>0){const n=i.curAnimationPositionMillis/s;r=i.curUnanimatedHighlightValue*Math.abs(Math.sin(n*Math.PI/2+.5));const o=0===i.curAnimatedHighlightValue?1:t;i.curAnimationPositionMillis+=o,e=!0}else i.curAnimatedHighlightValue>0&&0===i.curUnanimatedHighlightValue?(r=Math.max(i.curAnimatedHighlightValue-t/s,0),e=e||r>0):r=0,i.curAnimationPositionMillis=0}else r=i.curUnanimatedHighlightValue;r!==i.curAnimatedHighlightValue&&(i.applyHighlight(r),i.curAnimatedHighlightValue=r)})),e&&this.Li.Bi(!0)}}const ts=new Map,es=t=>{const e=t.getSize(),i=t.getFamily(),s=t.getWeight(),r=t.getStyle(),n=t.getVariant(),o=`${r} ${n?"small-caps":"normal"} ${s} ${e}px ${i}`;let h=ts.get(o);return h||(h=((t,e)=>({font:t,properties:e}))(o,{size:e,family:i,style:r,variant:n,weight:s}),ts.set(o,h)),h};var is,ss;!function(t){t[t.click=0]="click",t[t.dbclick=1]="dbclick",t[t.mouseDown=2]="mouseDown",t[t.mouseUp=3]="mouseUp",t[t.contextmenu=4]="contextmenu",t[t.wheel=5]="wheel"}(is||(is={})),function(t){t[t.touchStart=0]="touchStart",t[t.touchMove=1]="touchMove",t[t.touchEnd=2]="touchEnd"}(ss||(ss={}));const rs=t=>({container:t._e,scale:t.ct,setMouseStyle:(e,i)=>t.Ae(e,i),restoreMouseStyle:e=>t.we(e),clientLocation2Engine:(e,i)=>t.ke(e,i),engineLocation2Client:(e,i)=>t.Ce(e,i),captureFrame:(e,i)=>t.Te(e,i),renderFrame:(e,i,s=!1)=>t.Ie(e,i,s),layout:()=>{t.Fe(),t.Pe()},setBackgroundFillStyle(e){return t.setBackgroundFillStyle(e),this},setBackgroundStrokeStyle(e){return t.setBackgroundStrokeStyle(e),this},getBackgroundFillStyle:()=>t.getBackgroundFillStyle(),getBackgroundStrokeStyle:()=>t.getBackgroundStrokeStyle(),addCustomIcon:(e,i)=>t.De(e,i)}),ns=[];let os;const hs=()=>{if(void 0!==os){const t=gt.getComputedStyle(gt.document.body),e=Number(t.getPropertyValue("margin-top").replace("px",""))+Number(t.getPropertyValue("margin-bottom").replace("px",""));os.style.height=gt.innerHeight-e+"px",(()=>{for(let t=0;tthis.Bi()),60),this.Oe=u(0,0),this.Re=void 0,this.Ee=()=>{},this.ze=()=>{},this.Ve=[],this.Ne=-1,this.Ge=[],this.He=!0,this.ce=!1,this.Pe=()=>{const{bottom:t,left:e}=this.We().getBoundingClientRect();return this.Oe=u(Math.floor(e),Math.floor(t)),this},this.Fe=()=>{this.Ue&&this.Ue()},this.Ae=(t,e)=>{if(!e){this._e.style.cursor=t;const e=this.Ne;return this.Ne+=1,this.Ge.push([e,t]),e}return this.we(e),this.Ae(t)},this.we=t=>{const e=t?this.Ge.findIndex((e=>e[0]===t)):-1;e>=0?(this.Ge.splice(e,1),this.Ge.length>0?this._e.style.cursor=this.Ge[this.Ge.length-1][1]:this._e.style.cursor="default"):(this.Ge.push([0,"default"]),this._e.style.cursor="default")},this.$e=t=>(this.Ye.S(t),this),this.Xe=()=>this.Ye.M(),this.je=()=>{this.Ee&&this.Ee(),this.Ze(),this.Ke(),this.ze&&this.ze()},this.qe=t=>(this.Be.set(t.Je(),t),this.Be=new Map([...this.Be.entries()].sort(((t,e)=>t[0]-e[0]))),t),this.Qe=t=>(this.Be.delete(t),this),this.X=()=>(this.Ye.o=!1,this),this.j=()=>(this.Ye.o=!0,this),this.th=t=>{if(!this.He)return;const e=this.ih,i=e&&e.clientX===t.clientX&&e.clientY===t.clientY,s=this.ke(t.clientX,t.clientY),r=this.sh(t,{x:t.clientX,y:t.clientY});if(this.eh&&r!==this.eh&&!this.hh){this.eh.rh=!1;const e=this.eh.oh;e&&e(this.eh,t)}if(r&&r.getMouseInteractions()&&!this.hh)if(r.rh){if(!i){const e=r.ah;e&&e(r,t)}}else{r.rh=!0;const e=r.lh;e&&e(r,t)}if(this.hh){const i=this.hh.entity.uh,s=e?u(t.clientX-e.clientX,e.clientY-t.clientY):{x:0,y:0};!i||0===s.x&&0===s.y||i(this.hh.entity,t,this.hh.button,this.hh.startLocation,s)}this.dh=t,this.ih=t,this.fh=s,this.eh=r},this.gh=t=>{if(this.He=!1,this.fh=void 0,this.dh=t,this.ih=void 0,this.hh){const e=this.hh.entity.ph;e&&e(this.hh.entity,t,this.hh.button,this.hh.startLocation),this.hh.entity.rh=!1;const i=this.hh.entity.oh;i&&i(this.hh.entity,t),this.hh=void 0}if(this.mh){const e=this.mh.entity.yh;e&&e(this.mh.entity,t),this.mh=void 0}if(this.eh){this.eh.rh=!1;const e=this.eh.oh;e&&e(this.eh,t),this.eh=void 0}},this.Sh=t=>{this.He=!0,this.dh=t},this.xh=()=>this.fh,this.hs=t.theme,this.bh=e.bh,this.Mh={_h:e._h,Ah:e.Ah,wh:e.wh,kh:e.kh,Ch:e.Ch,Th:e.Th,Ih:t&&t.overrideInteractionMouseButtons?t.overrideInteractionMouseButtons:void 0,Fh:t&&void 0!==t.resourcesBaseUrl&&null!==t.resourcesBaseUrl?t.resourcesBaseUrl:`${gt.location.origin}/resources`,Ph:!t||!("warnings"in t)||"boolean"!=typeof t.warnings||t.warnings,Dh:(()=>{const e=null==t?void 0:t.pickingPrecision;if("string"==typeof e){const t=e.toLowerCase();if("best"===t)return 1;if("high"===t)return.5;if("low"===t)return 1/8}return 1/4})(),Bh:void 0===(null==t?void 0:t.interactable)||t.interactable,Lh:void 0===t.textPixelSnappingEnabled||t.textPixelSnappingEnabled};const i=t?t.container:void 0;if(i){if("string"==typeof i){const t=gt.document.getElementById(i);if(!t)throw new Error(`Container "${i}" doesn't exist.`);this._e=t}else this._e=i;gt.addEventListener("resize",this.Fe),this.Ve.push((()=>{gt.removeEventListener("resize",this.Fe)}))}else{if(void 0===os){const t=gt.document.createElement("div");t.id="lcjs-auto-flexbox",t.style.position="relative",t.style.width="100%",t.style.display="flex",t.style.flexDirection="column",gt.document.body.appendChild(t),os=t,gt.addEventListener("resize",hs)}let t=1;for(;null!==gt.document.getElementById(`chart-${t}`);)t+=1;this._e=gt.document.createElement("div"),this._e.id=`chart-${t}`,this._e.style.flex="1",os.appendChild(this._e),hs(),ns.push(this.Fe),this.Ve.push((()=>{os&&os.removeChild(this._e),ns.includes(this.Fe)&&ns.splice(ns.indexOf(this.Fe),1),0===ns.length&&os&&(gt.document.body.removeChild(os),os=void 0,gt.removeEventListener("resize",hs))}))}if(gt.ResizeObserver){const t=t=>{for(const e of t)e.target===this._e&&this.Fe()};this.Oh=new gt.ResizeObserver(t.bind(this)),this.Oh.observe(this._e)}""===this._e.style.position&&(this._e.style.position="relative"),this._e.style.boxSizing="content-box",this._e.addEventListener("fullscreenchange",this.Fe),this._e.addEventListener("webkitfullscreenchange",this.Fe);const s=t?t.maxFps:void 0;this.Rh=s?-1===s?-1:0!==s?1e3/s:0:0;const n=new Map;let o=!1;const h=(t,e)=>i=>{const s=function(t){return{x:t.clientX,y:t.clientY}}(i);switch(i.type){case"pointerover":case"pointerenter":case"pointermove":case"pointerdown":n.set(i.pointerId,s);break;default:n.delete(i.pointerId),o=!1}switch(i.interactions=Array.from(n.values()),i.pointerType){case"pen":case"mouse":default:t&&t(i);break;case"touch":e&&e(i)}i.defaultPrevented&&(o=!0)};if(this._e.onwheel=this.Eh(is.wheel),this._e.oncontextmenu=this.Eh(is.contextmenu),this._e.onclick=this.Eh(is.click),this._e.ondblclick=this.Eh(is.dbclick),this._e.onlostpointercapture=()=>{o=!1},this._e.ontouchmove=t=>{o&&t.preventDefault()},this._e.onpointerover=h(),this._e.onpointerenter=h(this.Sh),this._e.onpointerdown=h(this.Eh(is.mouseDown),this.zh(ss.touchStart)),this._e.onpointermove=h(this.th,this.zh(ss.touchMove)),this._e.onpointerup=h(this.Eh(is.mouseUp),this.zh(ss.touchEnd)),this._e.onpointercancel=h(),this._e.onpointerout=h(),this._e.onpointerleave=h(this.gh,this.zh(ss.touchEnd)),!gt.requestAnimationFrame||!gt.cancelAnimationFrame)throw new Error("LightningChart JS depends on requestAnimationFrame. Make sure to load a polyfill in older browsers.");gt.addEventListener("scroll",this.Pe),this.Ye=y(new M({r:0,g:0,b:0,a:0})),this.Vh=new Qi(this)}Nh(){return this.Gh}Hh(){return this.Wh}setBackgroundFillStyle(t){return this.Uh.ps(t),this}getBackgroundFillStyle(){return this.Uh.gs()}setBackgroundStrokeStyle(t){return this.Uh.$h(t),this}getBackgroundStrokeStyle(){return this.Uh.Yh()}Xh(t){return this.ze=t,this}jh(t){return this.Ee=t,this}Zh(t){return this.Be.get(t)}Kh(){return Array.from(this.Be.keys()).reverse().reduce(((t,e)=>e!==Number.MAX_SAFE_INTEGER&&e>t?e:t),0)+1}Eh(t){return e=>this.qh(t,e)}qh(t,e){if(!this.He)return;t===is.contextmenu&&Xt(e);const i=this.ke(e.clientX,e.clientY),s=this.sh(e,{x:e.clientX,y:e.clientY});if(t===is.mouseUp){if(this.hh){const t=this.hh.entity.ph;if(t&&t(this.hh.entity,e,this.hh.button,this.hh.startLocation),s!==this.hh.entity){this.hh.entity.rh=!1;const t=this.hh.entity.oh;t&&t(this.hh.entity,e)}this.hh=void 0}if(this.mh){const t=this.mh.entity.getMouseInteractions()&&this.mh.entity.yh;t&&t(this.mh.entity,e),this.mh=void 0}}else if(s&&s.getMouseInteractions()){const i=t===is.click?s.Jh:t===is.dbclick?s.Qh:t===is.mouseDown?s.tr:t===is.wheel?s.ir:t===is.contextmenu?s.sr:void 0;if(i&&i(s,e),t===is.mouseDown){this.mh={entity:s,event:e};const t=this.mh.event.button,i=s.er;i&&i(s,e,t),this.hh={entity:s,button:t,startLocation:u(e.clientX,e.clientY)}}}this.dh=e,this.fh=i,this.eh=s}zh(t){return e=>this.hr(t,e)}hr(t,e){const i=e.interactions.length;if(this.rr=e,this.nr){const s=t===ss.touchMove?this.nr.ar:t===ss.touchEnd?this.nr.lr:t===ss.touchStart?this.nr.ur:void 0;s&&s(this.nr,e),t===ss.touchEnd&&0===i&&(this.nr.rh=!1,this.nr=void 0)}else if(t===ss.touchStart){for(let t=0;t{t()})),this.Ve.length=0,this.Re&>.cancelAnimationFrame(this.Re)}ke(t,e){return u(t-this.Oe.x,this.Oe.y-e)}Ce(t,e){return u(t+this.Oe.x,this.Oe.y-e)}}const cs=(t=1)=>({type:"horizontalProgressive",packager:(e,i,s)=>{if(e.length>1){const r=Ze(i,s*t),n=Math.abs(r.x),o=e.length,h=[];let a=0,l=0,c=e[0].x+n;for(;ls&&(s=e[l].y),e[l].y({type:"horizontalRegressive",packager:(e,i,s)=>{if(e.length>1){const r=Ze(i,s*t),n=Math.abs(r.x),o=e.length,h=[];let a=0,l=0,c=e[0].x-n;for(;lc&&l=c;)e[l].y>s&&(s=e[l].y),e[l].y({type:"verticalProgressive",packager:(e,i,s)=>{if(e.length>1){const r=Ze(i,s*t),n=Math.abs(r.y),o=e.length,h=[];let a=0,l=0,c=e[0].y+n;for(;ls&&(s=e[l].x),e[l].x({type:"verticalRegressive",packager:(e,i,s)=>{if(e.length>1){const r=Ze(i,s*t),n=Math.abs(r.y),o=e.length,h=[];let a=0,l=0,c=e[0].y-n;for(;lc&&l=c;)e[l].x>s&&(s=e[l].x),e[l].x{const e="nearest"===t?ps.Nearest:"nearest-x"===t?ps.NearestX:"nearest-y"===t?ps.NearestY:void 0;return void 0!==e?e:ps.NearestX},xs=(t,e,i,s,r,n,o,h,a,l)=>{const u=t.length;if(0===u)return;const c=s?1:0,d=u-(r?2:1);if(i===ps.Nearest)return Ss(t,e,n,o,c,d);if(i===ps.NearestX||i===ps.NearestY){if("boolean"==typeof l&&("x"===a&&i===ps.NearestX||"y"===a&&i===ps.NearestY))return Ms(t,nt(e,o,n),a,l,c,d);if(i===ps.NearestX)return vs(t,nt(e,o,n),h,c,d);if(i===ps.NearestY)return bs(t,nt(e,o,n),h,c,d)}},Ss=(t,e,i,s,r,n)=>{let o,h=Number.MAX_VALUE;for(let a=r;a<=n;a+=1){const r=t[a];if(!Number.isNaN(r.x)&&!Number.isNaN(r.y)){const t=nt(r,i,s),n=(t.x-e.x)**2+(t.y-e.y)**2;n{if(e.xi.max.x)return;let n,o=Number.MAX_VALUE;for(let i=s;i<=r;i+=1){const s=t[i],r=s.x>e.x?s.x-e.x:e.x-s.x;r{if(e.yi.max.y)return;let n,o=Number.MAX_VALUE;for(let i=s;i<=r;i+=1){const s=t[i],r=s.y>e.y?s.y-e.y:e.y-s.y;r{const o="x"===i,h=o?e.x:e.y,a=t[r],l=t[n],u=a.xl.x?a.x:l.x,f=a.y>l.y?a.y:l.y;if(o&&(hd)||!o&&(hf))return;let g=r,m=Math.floor((r+n)/2),p=n,y=-1;for(;;){const e=h-(o?t[m].x:t[m].y);if(e*(s?-1:1)>0)g=Math.min(m+1,p),y=Math.floor((g+p)/2);else{if(0===Math.abs(e))return m;p=Math.max(m-1,g),y=Math.floor((g+p)/2)}if(y===m){const i=m>r?Math.abs(h-(o?t[m-1].x:t[m-1].y)):Me,s=m{const o="x"===i,h=o?e.x:e.y,a=t[r],l=t[n],u=a.xl.x?a.x:l.x,f=a.y>l.y?a.y:l.y;if(o&&(hd)||!o&&(hf))return;let g=r,m=Math.floor((r+n)/2),p=n,y=-1;for(;;){const i=h-(o?t[m].x:t[m].y);if(i*(s?-1:1)>0)g=Math.min(m+1,p),y=Math.floor((g+p)/2);else{if(0===Math.abs(i))return{a:m,b:m,lerpAmount:0};p=Math.max(m-1,g),y=Math.floor((g+p)/2)}if(y===m){if(i*(s?-1:1)<0&&m>r){const i=t[m-1],s=t[m];return{a:m-1,b:m,lerpAmount:o?(e.x-i.x)/(s.x-i.x):(e.y-i.y)/(s.y-i.y)}}if(mthis.P.on("dispose",t),this.offDispose=t=>this.P.off(t,"dispose"),this.Li=t,this.vr=e,this.Mr=i,this._r=ws,ws+=1,this.Ar=t.hs.highlightColorOffset}wr(t){return void 0!==this.Mr.find((e=>e.type===t))}kr(t,e){var i;return!!this.wr(t)&&!0===e(null===(i=this.Mr.find((e=>e.type===t)))||void 0===i?void 0:i.args)}dispose(){return this.ce||(this.rh&&this.oh&&this.oh(this),this.ce=!0,this.vr(this),this.P.emit("dispose",this)),this}setVisible(t){const e=this.Ri;return this.Ri=t,!t&&e&&(this.rh&&this.oh&&this.oh(this),this.rh=!1),this}getVisible(){return this.Ri}setMouseInteractions(t){const e=this.pr.M();return this.pr.S(t),t||(e&&this.rh&&this.oh&&this.oh(this),this.rh=!1),this}getMouseInteractions(){return this.pr.M()}getIsUnderMouse(){return this.rh}getIsGrabbed(){return this.yr}setMouseMoveEventHandler(t){return this.ah=t,this}setMouseEnterEventHandler(t){return this.lh=t,this}setMouseLeaveEventHandler(t){return this.oh=t,this}setMouseClickEventHandler(t){return this.Jh=t,this}setMouseDoubleClickEventHandler(t){return this.Qh=t,this}setMouseDownEventHandler(t){return this.tr=t,this}setMouseUpEventHandler(t){return this.yh=t,this}setMouseWheelEventHandler(t){return this.ir=t,this}setMouseContextMenuEventHandler(t){return this.sr=t,this}setMouseDragEventHandler(t){return this.uh=t,this}setMouseDragStartEventHandler(t){return this.er=t,this}setMouseDragStopEventHandler(t){return this.ph=t,this}setTouchStartEventHandler(t){return this.ur=t,this}setTouchMoveEventHandler(t){return this.ar=t,this}setTouchEndEventHandler(t){return this.lr=t,this}Cr(t){return this.Sr=t,this}Tr(){return this.Sr?this.Sr:Ts}Ir(t){return this.br=t,this}Fr(){return this.br}Pr(t){return this.Ar=t,this}Dr(){return this.Ar}}const Ts=m(u(0,0),u(0,0));class Es extends Ds{constructor(t,e,i,s){super(t,i,s),this.Br=0,this.Lr=e,this.Lr.Or=!0}Rr(t){return this.Br===t||(this.Br=t,this.Lr.Or=!0),this}Er(){return this.Br}}class Bs extends Es{constructor(t,e,i,s,r){super(t,e,s,r),this.zr=!0,this.ct=i}}const ks=(t,e,i)=>{if(i instanceof Ti){const s=i.yi(),r=Qe(e,{x:Math.abs(s.x),y:Math.abs(s.y)});return m(u(t.min.x-r.x,t.min.y-r.y),u(t.max.x+r.x,t.max.y+r.y))}return m(i.Yt(u(t.min.x,t.min.y),Ze(e,-1)),i.Yt(u(t.max.x,t.max.y),e))},Is=(t,e)=>"function"==typeof e?e(t):e,Cs=(t,e)=>!t||t!==e,Ps=(t,e)=>t===F&&e!==F,Ls=t=>t!==F;class Rs extends Bs{constructor(t,e,i,s,r){super(t,e,i,s,r),this.Vr=ls.fillStyle,this.Li=t}ps(t){return this.Vr=Is(this.Vr,t),this}gs(){return this.Vr}Nr(){return Cs(this.Gr,this.Vr)}Hr(){return Ps(this.Gr,this.Vr)}Wr(){return Ls(this.Vr)}Ur(t){this.Gr=t}}class Fs extends Rs{constructor(t,e,i,s,r){super(t,e,i,s,r),this.$r=ls.lineStyle,this.Li=t}$h(t){return this.$r="function"==typeof t?t(this.$r):t,this}Yh(){return this.$r}Yr(){return!this.Xr||this.Xr!==this.$r}jr(t){return!this.Xr||this.Xr.getThickness()!==t}Wr(){return this.$r!==J||super.Wr()}Hr(){return(this.$r!==J||this.Vr!==F)&&this.Xr===J&&this.Gr===F}Zr(t){this.Xr=t}}class _s extends Rs{constructor(t,e,i,s,r,n=y(5)){super(t,e,i,s,r),this.size=y(5),this.size=n}q(t){return this.size.S(t),this}}class Os extends Rs{constructor(t,e,i,s,r,n=y(ls.font)){super(t,e,i,s,r),this.Kr=y(""),this.qr=y(u(0,0)),this.Jr=y(0),this.Qr=y(0),this.tn=y(u(0,0)),this.sn=y(0),this.en=y(qi),this.hn=u(0,0),this._t=y(x(1,1,1,1)),this.rn=y(S(4,4,4,4)),this.font=y(ls.font),this.nn=!1,this.font=n}Wr(){return Ls(this.Vr)&&this.Kr.M().length>0}Hr(){return!1===this.nn&&this.Wr()}fs(t){return this.Kr.S(t),this}cs(){return this.Kr.M()}Ss(t){return t instanceof Yi?this.en.S(t):this.en.S(t(this.en.M())),this}ys(){return this.en.M()}an(t){return this.en.S(this.en.M().setFamily(t)),this}ln(){return this.en.M().getFamily()}un(t){return this.en.S(this.en.M().setSize(t)),this}cn(){return this.en.M().getSize()}dn(t){return this.en.S(this.en.M().setWeight(t)),this}fn(){return this.en.M().getWeight()}gn(t){return this.en.S(this.en.M().setStyle(t)),this}pn(){return this.en.M().getStyle()}mn(t){return this.en.S(this.en.M().setVariant(t)),this}yn(){return this.en.M().getVariant()}Sn(t){return this.qr.S(t),this}xn(){return this.qr.M()}xs(t){return this.sn.S(t),this}bs(){return this.sn.M()}bn(t,e){return this.tn.S(u(t,e)),this}vn(){return this.tn.M()}Mn(t){return this.Qr.S(t),this}_n(){return this.Qr.M()}An(t){return this.Jr.S(t),this}wn(){return this.Jr.M()}kn(t){return this.Qr.S(t.x),this.Jr.S(t.y),this}Cn(t){return this._t.S(t),this}Tn(){return this._t.M()}In(t){return this.rn.S(t),this}Fn(){return this.rn.M()}}class zs extends _s{constructor(t,i,s,r,n,o=5){super(t,i,s,r,n,y(o)),this.Pn=[],this.Dn=y(e.PointShape.Square),this.sn=y(0),this.Bn=y(!1),this.Ln=y(!1),this.On=y(!1),this.Rn=we,this.En=0,this.zn=[],this.Vn=0,this.Nn=we,this.Gn=ps.Nearest,this.Hn=!1}Wn(t){return this.Gn=t,this}Un(){return this.zn}$n(){return this.Pn}Yn(t){return this.Dn.S(t),this}xs(t){return this.sn.S(t),this}Xn(t){return this.Bn.S(t),this}jn(t){return this.Ln.S(t),this}Zn(t){return this.On.S(t),this}Kn(t,e){return Array.isArray(t)||(t=[t]),this.Vn+=t.length,this.zn=ie(this.zn,t,{canReturnB:!0}),this.Nn&&(this.Nn=e?Ne(this.Nn,e):void 0),this}qn(){return this.Hn=!0,this.Pn.length=0,this.En=0,this.Rn=we,this.zn=[],this.Vn=0,this}Jn(){return this.En}Qn(){return this.Vn}}class Vs extends Fs{constructor(t,e,i,s,r){super(t,e,i,s,r),this.qr=y(u(0,0)),this.Y=y(u(100,100)),this.sn=y(0),this.hn=y(u(0,0)),this.io=!1}Gs(){return this.so(),this}Sn(t){const e=this.qr.M();return t.x===e.x&&t.y===e.y||(this.qr.S(t),this.so()),this}xn(){return this.qr.M()}eo(t){const e=this.qr.M();return t!==e.x&&(this.qr.S(u(t,e.y)),this.so()),this}ho(t){const e=this.qr.M();return t!==e.y&&(this.qr.S(u(e.x,t)),this.so()),this}q(t){const e=this.Y.M();return t.x===e.x&&t.y===e.y||(this.Y.S(u(t.x,t.y)),this.so()),this}Et(){return this.Y.M()}ro(t){const e=this.Y.M();return t!==e.x&&(this.Y.S(u(t,e.y)),this.so()),this}no(t){const e=this.Y.M();return t!==e.x&&(this.Y.S(u(e.x,t)),this.so()),this}xs(t){return this.sn.S(t),this}bs(){return this.sn.M()}oo(t){const e=this.hn.M();return t===e&&e.x===t.x&&e.y===t.y||(void 0===t?(this.io=!1,this.so()):(this.io=!0,this.hn.S(t))),this}so(){if(!this.io){const t=this.qr.M(),e=this.Y.M(),i=u(t.x+e.x/2,t.y+e.y/2),s=this.hn.M();i.x===s.x&&i.y===s.y||this.hn.S(i)}}}class Ns extends Fs{constructor(){super(...arguments),this.Pn=[],this.qr=y(u(0,0)),this.Rn=we,this.ao=!1}lo(t){return t=Kt(t),this.Pn=t,this.ao=!0,this}uo(){return this.Pn}yt(){return this.Rn.max.x}ft(){return this.Rn.min.x}xt(){return this.Rn.max.y}St(){return this.Rn.min.y}co(){return 0}do(){return 0}}class Gs extends Ns{}class Us extends Rs{constructor(t,e,i,s,r){super(t,e,i,s,r),this.fo=new Array,this.po=new Array,this.mo=y({type:"disabled",packager:(t,e,i)=>t.slice()}),this.Rn=we,this.yo=0,this.So=!1,this.zn=[Array(),Array()],this.xo=!1,this.bo=(new z).setColor(A(42,171,240)),this.Hn=!1,this.vo=!1,this.Mo=!1}Kn(t,e){const i=this.yo-1,s=i>0&&!this.xo;let[r,n]=s?[[this.fo[i]],[this.po[i]]]:[[],[]];if(t instanceof Array){const[e,i]=g(t);r=ie(r,e,{canReturnB:!0}),n=ie(n,i,{canReturnB:!0})}else{const e=t.position;r.push(u(e,t.high)),n.push(u(e,t.low))}return this.xo?(this.zn[0]=ie(this.zn[0],r,{canReturnB:!0}),this.zn[1]=ie(this.zn[1],n,{canReturnB:!0})):(this.zn=[r,n],this.xo=!0),this.Rn=Ne(this.Rn,e||Ne(ze(r),ze(n))),this}qn(){return this.Hn=!0,this.fo.length=0,this.po.length=0,this.yo=0,this.Rn=we,this}$n(){return[this.fo,this.po]}Un(){return[this.zn[0],this.zn[1]]}_o(t){return this.mo.S(t),this}Ao(){return this.mo.M()}wo(t){return this.bo="function"==typeof t?t(this.bo):t,this}ko(){return this.bo}Jn(){return this.yo-(Number(this.vo)+Number(this.Mo))}Qn(){return this.zn.length}Co(t){return this.vo=t,this}To(){return this.vo}Io(t){return this.Mo=t,this}Fo(){return this.Mo}Hr(){return this.Gr===F&&this.Po===F&&(this.Vr!==F||this.bo!==F)}Do(t){this.Po=t}Wr(){return this.bo!==F||super.Wr()}Nr(){return super.Nr()||!this.Po||this.Po!==this.bo}}class Hs extends Fs{constructor(t,e,i,s,r){super(t,e,i,s,r),this.qr=y(u(0,0)),this.Bo=y(0),this.hi=y(360),this.Lo=y(100),this.Oo=y(100),this.Ro=y(0),this.Eo=y(void 0),this.zo=u(0,0),this.Vo=u(0,0),this.No=u(0,0)}Go(){return this.Lo.M()}Ho(){return this.Oo.M()}xn(){return this.qr.M()}Wo(){return this.Bo.M()}ei(){return this.hi.M()}Uo(){return this.Ro.M()}$o(){return this.Eo.M()}Yo(){return this.zo}Xo(){return this.Vo}jo(){return this.No}Sn(t){return this.qr.S(t),this}Zo(t){return this.Bo.S(t),this}Ko(t){return this.hi.S(t),this}qo(t){return this.Oo.S(t),this.Lo.S(t),this}Jo(t){return this.Lo.S(t),this}Qo(t){return this.Oo.S(t),this}ta(t){return this.Ro.S(t<0?0:t),this}ia(t){return this.Eo.S(void 0!==t&&t<=0?void 0:t),this}}var Ws;!function(t){t[t.Complex=0]="Complex",t[t.Simple=1]="Simple"}(Ws||(Ws={}));class Ys extends Bs{constructor(t,e,i,s,r){super(t,e,i,s,r),this.sa=ls.lineStyle,this.engine=t}ea(t){return this.sa=((t,e)=>"function"==typeof e?e(t):e)(this.sa,t),this}ha(){return this.sa}Yr(){return((t,e)=>!t||t!==e)(this.ra,this.sa)}na(t){return((t,e)=>!t||t.getThickness()!==e)(this.ra,t)}Hr(){return((t,e)=>t===J&&e!==J)(this.ra,this.sa)}Wr(){return(t=>t!==J&&t.getFillStyle()!==F)(this.sa)}oa(t){this.ra=t}}class qs extends Ys{constructor(t,e,i,s,r){super(t,e,i,s,r),this.ni=u(0,0),this.hi=u(0,0),this.aa=!1}S({min:t,max:e}){return this.aa=!0,this.ni=t,this.hi=e,this}ri(){return this.ni}ei(){return this.hi}la(t){return this.aa=!0,this.ni=t,this}Ko(t){return this.aa=!0,this.hi=t,this}}class Xs extends Ys{constructor(t,e,i,s,r){super(t,e,i,s,r),this.ua=[],this.aa=!1}Kn(t,e){return this.ua.push(t),this.ua.push(e),this.aa=!0,this}qn(){return this.ua.length=0,this.aa=!0,this}}class $s extends Ys{constructor(t,e,i,s,r){super(t,e,i,s,r),this.ca=[],this.Rn=we,this.zn=new Array,this.En=0,this.Gn=ps.NearestX,this.Hn=!1,this.da=y(void 0),this.vo=!1,this.Mo=!1}fa(t){return this.da.S(t),this}ga(){return this.da.M()}Un(){return this.zn}$n(){return this.ca}Wn(t){return this.Gn=t,this}qn(){return this.Hn=!0,this.ca.length=0,this.En=0,this.zn=[],this.Rn=we,this}Jn(){return this.En-(Number(this.vo)+Number(this.Mo))}Qn(){return this.zn.length}Co(t){return this.vo=t,this}To(){return this.vo}Io(t){return this.Mo=t,this}Fo(){return this.Mo}}class js extends Rs{constructor(t,e,i,s,r){super(t,e,i,s,r),this.yo=0,this.pa=0,this.Y=y({x:0,y:0}),this.ma=y({x:0,y:0}),this.ya=y({x:0,y:0}),this.ni={x:0,y:0},this.hi={x:0,y:0},this.Sa=!0,this.xa=!0,this.ba=!0,this.Rn=we,this.va=!0,this.Ma=F}_a(t){return this.Ma=Is(this.Ma,t),this}Aa(){return this.Ma}S(t){return Zs.S(this,t,((t,e)=>({x:t,y:e}))),this}wa(){return Zs.wa(this)}ka(){return Zs.ka(this)}xn(){return Zs.xn(this)}Qn(){return Zs.Qn(this)}Ca(t,e,i){return Zs.Ca(this,t,e,i),this}Ta(t,e,i){return Zs.Ta(this,t,e,i),this}Ia(t,e){return Zs.Ia(this,t,e),this}Fa(t,e){return Zs.Fa(this,t,e),this}Pa(t,e){return Zs.Pa(this,t,e),this}qn(){return Zs.qn(this,((t,e)=>({x:t,y:e}))),this}Da(){return Zs.Da(this)}Ba(){return Zs.Ba(this)}La(){return Zs.La(this)}Jn(){return Zs.Jn(this)}Hr(){return Zs.Hr(this)}Wr(){return Zs.Wr(this)}Oa(){return this.Ra}Ea(){return this.za}}const Zs={S(t,e,i){t.Sa=!0,t.xa=!0,t.ba=!0;const{start:s}=e,{end:r}=e,{rows:n}=e,{columns:o}=e;t.va=e.pixelate;const h={x:e.pixelate&&o>=1||!e.pixelate&&o>1?o:0,y:e.pixelate&&n>=1||!e.pixelate&&n>1?n:0};t.ma.S(h),t.ni={...s},t.hi={...r},t.Y.S(Je(r,s)),Zs.Va(t,i)},Va(t,e){const i=t.ma.M();if(i.x>0&&i.y>0){t.Ra?t.Ra.length=0:t.Ra=[];const s=t.va?Ke(i,{x:1,y:1}):{x:i.x,y:i.y};t.ya.S(s),t.Ra=Array.from(Array(s.y)).map((()=>Array(s.x))),t.za=Array.from(Array(i.y)).map((()=>Array(i.x))),Zs.Na(t,i,s,e),t.yo=s.x*s.y,t.pa=i.x*i.y}else t.Ra=void 0,t.ya.S({x:0,y:0})},Na(t,e,i,s){const r=t.ni,n=t.hi,o=t.Ra,h=t.za;if(o){const e=i.x,h=i.y,{x:a,y:l}=t.Y.M(),u={x:a/(e-1),y:l/(h-1)};for(let t=0;tt.ma.o||t.ya.o,ka(t){const e=t.ma.M();return{columns:e.x,rows:e.y}},xn(t){const e=t.ni,i=t.hi;return{start:{x:e.x,y:e.y},end:{x:i.x,y:i.y}}},Qn(t){throw new Error("Method not implemented.")},Ca(t,e,i,s){const r="geometry"===i||"y"===i?t.Ra:t.za;if(r){const n=t.ya.M();if("y"===i){const t=Bt(r);for(let i=0;iEt(t,e)));const o=r===t.Ra?t.ya.M():t.ma.M(),h={column:{start:o.x-e,end:o.x},row:{start:0,end:o.y}},a=(t=>{const e=t.length,i=e>0?t[0].length:0,s=Array.from(Array(i)).map((()=>Array(e)));for(let r=0;r0?e[0].length:0;for(let a=r,l=0;a0?e[0].length:0;for(let a=r,l=0;a0?e[0].length:0;for(let a=r,l=0;a0?e[0].length:0;for(let a=r,l=0;at.yo,Jn:t=>t.pa,Hr:t=>Ps(t.Gr,t.Vr)||Ps(t.Wa,t.Ma),Wr:t=>Ls(t.Vr)||Ls(t.Ma)};class Ks{constructor(t,e){this.Fh=t,this.Ua=e,this.$a=e.rows*Er,this.Ya=e.columns*Br}}var Js,Qs;e.OnScreenMenuButtonType=void 0,(Js=e.OnScreenMenuButtonType||(e.OnScreenMenuButtonType={}))[Js.ZoomIn=0]="ZoomIn",Js[Js.ZoomInX=1]="ZoomInX",Js[Js.ZoomInY=2]="ZoomInY",Js[Js.ZoomOut=3]="ZoomOut",Js[Js.ZoomOutX=4]="ZoomOutX",Js[Js.ZoomOutY=5]="ZoomOutY",Js[Js.ZoomToFit=6]="ZoomToFit",Js[Js.ToggleAnimations=7]="ToggleAnimations",e.OnScreenMenuButtonShape=void 0,(Qs=e.OnScreenMenuButtonShape||(e.OnScreenMenuButtonShape={}))[Qs.Circle=0]="Circle",Qs[Qs.Rectangle=1]="Rectangle",Qs[Qs.RoundedRectangle=2]="RoundedRectangle";const tr={x:-43,y:0},er={x:-65,y:0},ir={x:-86,y:0},sr={x:-107,y:-1},rr={x:-128,y:-3},nr={x:-150,y:0},or={x:-171,y:0},hr={x:-276,y:0},ar={x:-298,y:0},lr={x:0,y:0},ur={x:-21,y:0};class cr extends Ks{constructor(t,e,i,s){super(t,i),this.Xa=gt.document.createElement("button"),this.ja=gt.document.createElement("div"),this.Za=gt.document.createElement("label"),this.Ua=i,this.Ka=e,this.qa=s}Ja(t,e,i,s){this.Qa(t,s),this.tl(),this.il(e),this.sl(),this.Za.textContent=i||"";const r=gt.document.createElement("div");this.el(r),this.Xa.onclick=this.onClick.bind(this),r.appendChild(this.ja),r.appendChild(this.Za),this.Xa.appendChild(r)}sl(){this.Xa.style.cursor="pointer"}el(t){t.style.display="flex",t.style.justifyContent="center",t.style.alignContent="center",t.style.flexDirection="column"}il(t){"string"==typeof t?(this.ja.style.backgroundImage=`url(${t})`,this.ja.style.backgroundSize="100%",this.ja.style.backgroundRepeat="no-repeat",this.ja.style.backgroundPosition="center",this.ja.style.width="20px",this.ja.style.height="20px"):this.applyStyleForSprite(t),this.ja.style.margin="auto"}tl(){switch(this.Ka){case e.OnScreenMenuButtonShape.RoundedRectangle:this.Xa.style.borderRadius="10px";break;case e.OnScreenMenuButtonShape.Rectangle:this.Xa.style.borderRadius="0px";break;case e.OnScreenMenuButtonShape.Circle:default:this.Xa.style.borderRadius="31px"}}Qa(t,e){this.Xa.style.width=`${this.Ya.toString()}px`,this.Xa.style.height=`${this.$a.toString()}px`,this.Xa.style.backgroundColor=t,this.Xa.style.opacity=e||kr,this.Xa.style.alignItems="center",this.Xa.style.border="2px solid #707070",this.Xa.style.transition="background-color .8s ease"}applyStyleForSprite(t){this.ja.style.backgroundImage=`url(${this.Fh}/${Ir})`,this.ja.style.backgroundPositionX=`${t.x}px`,this.ja.style.backgroundPositionY=`${t.y}px`,this.ja.style.backgroundSize="1600%",this.ja.style.backgroundRepeat="no-repeat",this.ja.style.width="20px",this.ja.style.height="20px"}hl(t){return t.appendChild(this.Xa),t}rl(){return this.Xa}}class dr extends cr{constructor(t,e,i,s){super(t,e,i,s),this.nl="",this.ol="",this.al=!1,this.qa=s}ll(){this.ul(),this.onToggledStateAction()}cl(){this.dl(),this.onInitialStateAction()}dl(){this.fl(this.nl)}ul(){this.fl(this.ol)}fl(t){"string"==typeof t?this.ja.style.background=t:(this.ja.style.backgroundImage=`url(${this.Fh}/${Ir})`,this.ja.style.backgroundPositionX=`${t.x}px`,this.ja.style.backgroundPositionY=`${t.y}px`)}onClick(){this.al?this.cl():this.ll(),this.al=!this.al}}class fr extends cr{constructor(t,e,i){super(t,i,{rows:1,columns:1},e),this.qa=e;const s=this.qa.getTheme();this.Ja(s.onScreenMenuBackgroundColor.toRGBAString(),tr)}onClick(){const t=this.qa.pl();t&&this.qa.zoom(t,{x:-1,y:-1})}}class gr extends cr{constructor(t,e,i){super(t,i,{rows:1,columns:1},e),this.qa=e;const s=this.qa.getTheme();this.Ja(s.onScreenMenuBackgroundColor.toRGBAString(),sr)}onClick(){const t=this.qa.pl();t&&this.qa.zoom(t,{x:-1,y:0})}}class mr extends cr{constructor(t,e,i){super(t,i,{rows:1,columns:1},e),this.qa=e;const s=this.qa.getTheme();this.Ja(s.onScreenMenuBackgroundColor.toRGBAString(),nr)}onClick(){const t=this.qa.pl();t&&this.qa.zoom(t,{x:0,y:-1})}}class pr extends cr{constructor(t,e,i){super(t,i,{rows:1,columns:1},e),this.qa=e;const s=this.qa.getTheme();this.Ja(s.onScreenMenuBackgroundColor.toRGBAString(),er)}onClick(){const t=this.qa.pl();t&&this.qa.zoom(t,{x:1,y:1})}}class yr extends cr{constructor(t,e,i){super(t,i,{rows:1,columns:1},e),this.qa=e;const s=this.qa.getTheme();this.Ja(s.onScreenMenuBackgroundColor.toRGBAString(),rr)}onClick(){const t=this.qa.pl();t&&this.qa.zoom(t,{x:1,y:0})}}class xr extends cr{constructor(t,e,i){super(t,i,{rows:1,columns:1},e),this.qa=e;const s=this.qa.getTheme();this.Ja(s.onScreenMenuBackgroundColor.toRGBAString(),or)}onClick(){const t=this.qa.pl();t&&this.qa.zoom(t,{x:0,y:1})}}class Sr extends dr{constructor(t,e,i){super(t,i,{rows:1,columns:1},e),this.qa=e;const s=this.qa.getTheme();this.nl=hr,this.ol=ar,this.Ja(s.onScreenMenuBackgroundColor.toRGBAString(),this.nl)}onToggledStateAction(){this.qa.setAnimationsEnabled(!1)}onInitialStateAction(){this.qa.setAnimationsEnabled(!0)}}class vr extends cr{constructor(t,e,i){super(t,i,{rows:1,columns:1},e),this.qa=e;const s=this.qa.getTheme();this.Ja(s.onScreenMenuBackgroundColor.toRGBAString(),ir)}onClick(){this.qa.forEachAxis((t=>{t.fit(!0)}))}}class br extends cr{constructor(t,e,i){super(t,e.shape||Cr,e.dimensions||{rows:1,columns:1},i);const s=i.getTheme(),r=e.color||s.onScreenMenuBackgroundColor.toRGBAString(),n=e.icon||"",o=e.label||"",h=e.opacity||"";this.Ja(r,n,o,h),this.ml=e.action}onClick(){this.ml(this.qa)}}class Mr extends dr{constructor(t,e,i,s){super(t,e,{rows:1,columns:1},i),this.qa=i,this.yl=s,this.nl=ur,this.ol=lr,this.Ja(Pr,this.nl)}dl(){this.fl(this.nl),this.Xa.style.backgroundColor=Pr,this.Xa.style.border="2px solid #707070",this.Xa.style.margin="0px"}ul(){this.fl(this.ol),this.Xa.style.background="#FECC00 0% 0% no-repeat padding-box",this.Xa.style.border="10px solid #BCBCBC12",this.Xa.style.margin="1px"}onToggledStateAction(){var t;null===(t=this.yl)||void 0===t||t.style.setProperty("display","block")}onInitialStateAction(){var t;null===(t=this.yl)||void 0===t||t.style.setProperty("display","none")}}var Ar;e.MouseStyles=void 0,(Ar=e.MouseStyles||(e.MouseStyles={})).Move="move",Ar.ResizeColumn="col-resize",Ar.ResizeRow="row-resize",Ar.Horizontal="ew-resize",Ar.Vertical="ns-resize",Ar.NorthWest="nw-resize",Ar.NorthEast="ne-resize",Ar.Copy="copy",Ar.CrossHair="crosshair",Ar.Default="default",Ar.Help="help",Ar.Restricted="not-allowed",Ar.None="none",Ar.Point="pointer",Ar.Text="text",Ar.Wait="wait",Ar.ZoomIn="zoom-in",Ar.ZoomOut="zoom-out";const wr={LeftBottom:u(-1,-1),CenterBottom:u(0,-1),RightBottom:u(1,-1),LeftCenter:u(-1,0),Center:u(0,0),RightCenter:u(1,0),LeftTop:u(-1,1),CenterTop:u(0,1),RightTop:u(1,1)},Dr=new z({color:A(255,255,255,0)}),Tr=new tt({thickness:1,fillStyle:Dr}),Er=60,Br=60,kr="1.0",Ir="osm/osm-sprite-transparent.png",Cr=e.OnScreenMenuButtonShape.Circle,Pr="#363636";var Lr;e.OSMPosition=void 0,(Lr=e.OSMPosition||(e.OSMPosition={}))[Lr.TopRight=0]="TopRight",Lr[Lr.TopLeft=1]="TopLeft",Lr[Lr.BottomLeft=2]="BottomLeft",Lr[Lr.BottomRight=3]="BottomRight";const Rr=t=>{const e=t.length;if(e>0){let i=0,s=0;for(let r=0;r{const e=t.length,i=new Array(e).fill(!1),s=(s,r)=>{for(let n=0;n=this.vl?(this.bl.splice(t,1),t-=1):this.bl[t].state&&(s=!0);return this.xl?0===e.interactions.length&&(this.bl.push({state:!1,time:i}),this.xl=!1):1===e.interactions.length&&"pointerdown"===e.type&&(this.bl.push({state:!0,time:i}),s=!0,this.xl=!0),s}Gs(t,e,i){if(i){const i=this.bl.reduce(((t,e)=>(e.state?t.on+=1:t.off+=1,t)),{on:0,off:0});i.on>=2&&i.off>=1&&(this.Ml(t,e),this.bl.length=0)}}},Or=class{constructor(t,e,i,s=1,r=100){this._l=t,this.Al=e,this.wl=i,this.kl=s,this.Cl=r}Sl(t,e){const i=e.interactions.length;if(i===this.kl){if(void 0!==this.Tl)return!0;if("pointerdown"===e.type&&(1===i||(t=>{const e=t.length;if(e>0){const i=Rr(t);let s=0;for(let r=0;r{const i=t.getDraggingMode();return void 0!==i&&i!==e.UIDraggingModes.notDraggable?i===e.UIDraggingModes.draggable?e.MouseStyles.Move:i===e.UIDraggingModes.onlyHorizontal?e.MouseStyles.Horizontal:e.MouseStyles.Vertical:void 0};class Nr{constructor(){this.Ri=!0,this.P=new r.Eventer,this.Bl=0,this.Ll=(t,e)=>{0===this.Bl&&this.P.emit("mouseEnter",this,e),this.Bl+=1},this.Ol=(t,e)=>{this.Bl-=1,this.Bl<1&&(this.P.emit("mouseLeave",this,e),this.Bl=0)},this.Rl=(t,e)=>{this.P.emit("mouseClick",this,e)},this.El=(t,e)=>{this.P.emit("mouseDoubleClick",this,e)},this.zl=(t,e)=>{this.P.emit("mouseDown",this,e)},this.Vl=(t,e)=>{this.P.emit("mouseUp",this,e)},this.Nl=(t,e)=>{this.P.emit("mouseMove",this,e)},this.Gl=(t,e,i)=>{this.P.emit("mouseDragStart",this,e,i)},this.Hl=(t,e,i,s,r)=>{this.P.emit("mouseDrag",this,e,i,s,r)},this.Wl=(t,e,i,s)=>{this.P.emit("mouseDragStop",this,e,i,s)},this.Ul=(t,e)=>{this.P.emit("mouseWheel",this,e)},this.$l=(t,e)=>{this.Bl+=1,this.P.emit("touchStart",this,e)},this.Yl=(t,e)=>{this.P.emit("touchMove",this,e)},this.Xl=(t,e)=>{this.Bl-=1,this.P.emit("touchEnd",this,e)},this.jl=t=>(t instanceof Bs?t.setMouseEnterEventHandler(this.Ll).setMouseLeaveEventHandler(this.Ol).setMouseClickEventHandler(this.Rl).setMouseDoubleClickEventHandler(this.El).setMouseDownEventHandler(this.zl).setMouseUpEventHandler(this.Vl).setMouseMoveEventHandler(this.Nl).setMouseDragEventHandler(this.Hl).setMouseDragStartEventHandler(this.Gl).setMouseDragStopEventHandler(this.Wl).setMouseWheelEventHandler(this.Ul).setTouchStartEventHandler(this.$l).setTouchMoveEventHandler(this.Yl).setTouchEndEventHandler(this.Xl):(t.onMouseEnter(this.Ll),t.onMouseLeave(this.Ol),t.onMouseClick(this.Rl),t.onMouseDoubleClick(this.El),t.onMouseDown(this.zl),t.onMouseUp(this.Vl),t.onMouseMove(this.Nl),t.onMouseDrag(this.Hl),t.onMouseDragStart(this.Gl),t.onMouseDragStop(this.Wl),t.onMouseWheel(this.Ul),t.onTouchStart(this.$l),t.onTouchMove(this.Yl),t.onTouchEnd(this.Xl)),t)}onMouseEnter(t){return this.P.on("mouseEnter",t)}onMouseLeave(t){return this.P.on("mouseLeave",t)}onMouseClick(t){return this.P.on("mouseClick",t)}onMouseDoubleClick(t){return this.P.on("mouseDoubleClick",t)}onMouseDown(t){return this.P.on("mouseDown",t)}onMouseUp(t){return this.P.on("mouseUp",t)}onMouseMove(t){return this.P.on("mouseMove",t)}onMouseDragStart(t){return this.P.on("mouseDragStart",t)}onMouseDrag(t){return this.P.on("mouseDrag",t)}onMouseDragStop(t){return this.P.on("mouseDragStop",t)}onMouseWheel(t){return this.P.on("mouseWheel",t)}onTouchStart(t){return this.P.on("touchStart",t)}onTouchMove(t){return this.P.on("touchMove",t)}onTouchEnd(t){return this.P.on("touchEnd",t)}offMouseEnter(t){return this.P.off(t,"mouseEnter")}offMouseLeave(t){return this.P.off(t,"mouseLeave")}offMouseClick(t){return this.P.off(t,"mouseClick")}offMouseDoubleClick(t){return this.P.off(t,"mouseDoubleClick")}offMouseDown(t){return this.P.off(t,"mouseDown")}offMouseUp(t){return this.P.off(t,"mouseUp")}offMouseMove(t){return this.P.off(t,"mouseMove")}offMouseDragStart(t){return this.P.off(t,"mouseDragStart")}offMouseDrag(t){return this.P.off(t,"mouseDrag")}offMouseDragStop(t){return this.P.off(t,"mouseDragStop")}offMouseWheel(t){return this.P.off(t,"mouseWheel")}offTouchStart(t){return this.P.off(t,"touchStart")}offTouchMove(t){return this.P.off(t,"touchMove")}offTouchEnd(t){return this.P.off(t,"touchEnd")}getIsUnderMouse(){return this.Bl>0}setVisible(t){const e=this.Ri!==t;return this.Ri=t,e&&this.P.emit("visibleStateChanged",this,this.Ri),this}getVisible(){return this.Ri}onVisibleStateChanged(t){return this.P.on("visibleStateChanged",t)}offVisibleStateChanged(t){return this.P.off(t,"visibleStateChanged")}}const Gr=(t,i,s)=>{const r=t.getDraggingMode();if(r!==e.UIDraggingModes.notDraggable){const n=t.scale.Yt(t.getPosition(),{x:r!==e.UIDraggingModes.onlyVertical?i.x:0,y:r!==e.UIDraggingModes.onlyHorizontal?i.y:0}),o=t.scale,h=t.getSize(),a=t.getOrigin(),l=o.Yt({x:o.x.getInnerStart(),y:o.y.getInnerStart()},Qe({x:(1+a.x)/2,y:(1+a.y)/2},h)),u=o.Yt({x:o.x.getInnerEnd(),y:o.y.getInnerEnd()},Qe({x:(a.x-1)/2,y:(a.y-1)/2},h)),c={x:Math.min(Math.max(n.x,l.x),u.x),y:Math.min(Math.max(n.y,l.y),u.y)};t.setPosition(c),Xt(s)}},Ur=(t,e,i,s,r)=>{Gr(t,r,e)},Hr=(t,e,i,s,r)=>{Gr(t,s,r)};class Wr extends Nr{constructor(t,e,i,s,r){super(),this.position=u(50,50),this.origin=u(0,0),this.size=u(0,0),this.ce=!1,this.Zl=void 0,this.Kl=void 0,this.ql=Vr,this.Jl=void 0,this.Ql=()=>{const t="function"==typeof this.ql?this.ql(this):this.ql;t&&(this.Kl=this.Lr.Li.Ae(t))},this.tu=()=>{this.Lr.Li.we(this.Kl)},this._t=x(0,0,0,0),this.Lr=t,this.renderingScale=e,this.scale=i,this.vr=s,this.hs=r,this.Lr.Bi(),this.onMouseEnter(this.Ql),this.onMouseLeave(this.tu),this.onMouseDrag(Ur);const n=Fr(new Or(bt,Hr,bt));this.onTouchStart(n.onTouchStart),this.onTouchMove(n.onTouchMove),this.onTouchEnd(n.onTouchEnd),this.hs=r}setEffect(t){return this.iu=this.iu||this.Lr.Li.iu.su(this,{eu:{shapes:this.hu()}}),this.iu.eu.vs(t),this}getEffect(){return!!this.iu&&this.iu.eu._s()}setAutoDispose(t){return this.Jl=t,this.Lr.Bi(),this}getAutoDispose(){return this.Jl}getSize(t=e.UISpace.Everything){return t===e.UISpace.Everything?u(this.size.x+(this._t.left+this._t.right),this.size.y+(this._t.bottom+this._t.top)):this.size}setContentSize(t){this.size=t}setMargin(t){return this._t="object"==typeof t?v(this._t,t):{left:t,top:t,right:t,bottom:t},this.Lr.Bi(),this}getMargin(){return this._t}ru(){if(this.Jl){const t=this.size,e=this.renderingScale.Et(),i={x:t.x/e.x,y:t.y/e.y};("max-width"===this.Jl.type&&i.x>=this.Jl.maxWidth||"max-height"===this.Jl.type&&i.y>=this.Jl.maxHeight)&&this.dispose()}return this}Gs(){return this}dispose(){return this.ce||(this.Lr.Bi(),this.ce=!0,this.vr(this),this.P.emit("dispose",this)),this}setVisible(t){return super.setVisible(t),this.Lr.Bi(),this}onDispose(t){return this.P.on("dispose",t)}offDispose(t){return this.P.off(t,"dispose")}setPosition(t){return this.position=t,this.Lr.Bi(),this}getPosition(t=this.origin,i=e.UISpace.Everything){const s=this.getSize(e.UISpace.Everything),r=this.scale.Yt(this.position,Qe({x:-(this.origin.x+1)/2,y:-(this.origin.y+1)/2},s));if(i===e.UISpace.Everything)return this.scale.Yt(r,Qe({x:(t.x+1)/2,y:(t.y+1)/2},s));const n=this.scale.Yt(r,{x:this._t.left,y:this._t.bottom}),o=this.getSize(e.UISpace.Content);return this.scale.Yt(n,Qe({x:(t.x+1)/2,y:(t.y+1)/2},o))}setOrigin(t){return this.origin=t,this.Lr.Bi(),this}getOrigin(){return this.origin}setDraggingMode(t=e.UIDraggingModes.notDraggable){return this.Zl=t,this.Lr.Bi(),this}getDraggingMode(){return void 0!==this.Zl?this.Zl:e.UIDraggingModes.notDraggable}setMouseStyle(t){return this.ql=t,this}getMouseStyle(){return this.ql}}class Yr extends Wr{constructor(t,e,i,s,r,n){super(t,e,i,r,n),this.rn=x(),this.nu=0,this.Lr=t,this.ou=s,this.backgroundElement=new this.ou(this.Lr,this.renderingScale,this.scale,bt,n),this.jl(this.backgroundElement)}hu(){return this.backgroundElement.hu()}onHighlight(t){return this.P.on("highlight",t)}offHighlight(t){return this.P.off(t)}setBackground(t){return t(this.backgroundElement),this}getBackground(){return this.backgroundElement}ru(){return super.ru(),this.ce||this.backgroundElement.setOrigin(this.origin).setPosition(this.getPosition(this.origin,e.UISpace.PaddedBackground)).ru(),this}Gs(){const t=this.getSize(e.UISpace.PaddedContent);return this.backgroundElement.au(t).Gs(),super.Gs()}dispose(){return super.dispose(),this.backgroundElement.dispose(),this}setVisible(t){return super.setVisible(t),this.backgroundElement.setVisible(t),this}setPadding(t){return this.rn="object"==typeof t?v(this.rn,t):{left:t,top:t,right:t,bottom:t},this.Lr.Bi(),this}getPadding(){return this.rn}getSize(t=e.UISpace.Everything){let i=super.getSize(t);return t>=e.UISpace.PaddedContent&&(i=u(i.x+this.rn.left+this.rn.right,i.y+this.rn.bottom+this.rn.top)),t>=e.UISpace.PaddedBackground&&(i=u(i.x+this.backgroundElement.lu()+this.backgroundElement.uu(),i.y+this.backgroundElement.cu()+this.backgroundElement.du())),i}getPosition(t=this.origin,i=e.UISpace.Everything){if(i===e.UISpace.Everything)return super.getPosition(t,i);const s=super.getPosition(u(-1,-1),e.UISpace.Everything),r=this.getMargin(),n=this.scale.Yt(s,{x:r.left,y:r.bottom});if(i===e.UISpace.PaddedBackground){const i=this.getSize(e.UISpace.PaddedBackground);return this.scale.Yt(n,Qe({x:(t.x+1)/2,y:(t.y+1)/2},i))}const o=this.scale.Yt(n,{x:this.backgroundElement.lu(),y:this.backgroundElement.cu()});if(i===e.UISpace.PaddedContent){const i=this.getSize(e.UISpace.PaddedContent);return this.scale.Yt(o,Qe({x:(t.x+1)/2,y:(t.y+1)/2},i))}const h=this.getPadding(),a=this.scale.Yt(o,{x:h.left,y:h.bottom}),l=this.getSize(e.UISpace.Content);return this.scale.Yt(a,Qe({x:(t.x+1)/2,y:(t.y+1)/2},l))}setMouseInteractions(t){return this.backgroundElement.setMouseInteractions(t),this}getMouseInteractions(){return this.backgroundElement.getMouseInteractions()}getHighlight(){return this.nu}setHighlight(t){return this.nu=me(t),this.backgroundElement.setHighlight(t),this.P.emit("highlight",t),this}}const qr=t=>"setBackground"in t;class Xr extends Nr{constructor(t,e,i,s,r,n,o,h,a,l,u){super(),this.u=0,this.fu=1,this.gu=!0,this.pu=new Yi,this.mu=!0,this.ce=!1,this.axisScale=s,this.renderingScale=r,this.yu=o,this.Su=h,this.xu=a,this.vr=l,this.bu=e,this.vu=i,this.Mu=this.jl(this.bu._u(this.renderingScale)),this.hs=u,this.Au=this.jl(this.xu.wu(this.vu,this.renderingScale,n,bt,this.hs,!1).setOrigin(Yt(this.Su)).setDirection(this.Su)),this.axis=t,this.setMouseInteractions(!1),"major"===this.Au.ku?this.Mu.ea(u.xAxisNumericTicks.majorTickStyle.gridStrokeStyle):"minor"===this.Au.ku?this.Mu.ea(u.xAxisNumericTicks.minorTickStyle.gridStrokeStyle):"other"===this.Au.ku&&this.Mu.ea(u.cursorGridStrokeStyleX)}setValue(t){return this.u=t,this.vu.Bi(),this.P.emit("valueChange",this.u),this}getValue(){return this.u}setTextFormatter(t){return this.Cu=t,this.vu.Bi(),this}setTickLength(t){return this.Au.setPointerLength(t),this.bu.Bi(),this}getTickLength(){return this.Au.getPointerLength()}setTickLabelPadding(t){return this.Au.setTickLabelPadding(t),this.bu.Bi(),this}setTickLabelRotation(t){return this.Au.setTextRotation(t),this.bu.Bi(),this}getTickLabelRotation(){return this.Au.getTextRotation()}getTickLabelPadding(){return this.Au.getTickLabelPadding()}setGridStrokeLength(t){return this.fu=t,this.bu.Bi(),this}getGridStrokeLength(){return this.fu}setGridStrokeStyle(t){return this.Mu.ea(t),this.bu.Bi(),this}getGridStrokeStyle(){return this.Mu.ha()}dispose(){return this.ce||(this.ce=!0,this.Mu.dispose(),this.Au.dispose(),this.vr(this),this.bu.Li.Bi(),this.P.emit("dispose",this)),this}onDispose(t){return this.P.on("dispose",t)}offDispose(t){return this.P.off(t,"dispose")}setMarkerVisible(t){return this.gu=t,this.vu.Bi(),this}getMarkerVisible(){return this.gu}setMarker(t){return t(this.Au),this.vu.Bi(),this}getMarker(){return this.Au}setMouseInteractions(t){return this.Au.setMouseInteractions(t),this.Mu.setMouseInteractions(t),this}getMouseInteractions(){return this.Mu.getMouseInteractions()}setAllocatesAxisSpace(t){return this.mu=t,this.vu.Bi(),this}getAllocatesAxisSpace(){return this.mu}isInScale(){return Pe(this.u,this.axisScale.getInnerStart(),this.axisScale.getInnerEnd())}onValueChange(t){return this.P.on("valueChange",t)}offValueChange(t){return this.P.off(t,"valueChange")}}class $r extends Xr{constructor(t,e,i,s,r,n,o,h,a,l,u){super(t,e,i,s,r,n,o,h,u,a,l),this.Tu=!1,this.vr=a,this.bu=e,this.vu=i}dispose(){return this.Tu=!1,super.dispose()}update(){return this}plot(t,e,i,s){if(this.isInScale()&&this.getVisible()){this.Tu=!1;const r=rt(this.u,this.axisScale,this.yu.getWidth(this.renderingScale));this.Mu.setVisible(!0).la(this.yu.toPoint(r,t)).Ko(this.yu.toPoint(r,t-(i+e*this.fu))),this.gu?(this.Cu&&this.Au.setText(this.Cu(this.u,this)),this.Au.setVisible(!0).setPosition(this.yu.toPoint(r,s))):this.Au.setVisible(!1)}else this.Mu.setVisible(!1),this.Au.setVisible(!1);return this.Au.Gs().ru(),this}Iu(){const t=this.Au.Gs().getSize();return this.yu.getHeight(t)}}var jr;e.HighlightModes=void 0,(jr=e.HighlightModes||(e.HighlightModes={}))[jr.noHighlighting=0]="noHighlighting",jr[jr.onHover=1]="onHover",jr[jr.onHoverIndividual=2]="onHoverIndividual";class Zr{constructor(t,i,s,n){this.Fu=!0,this.Pu=e.HighlightModes.onHover,this.ce=!1,this.Ri=!0,this.Du=0,this.P=new r.Eventer,this.Bu=[],this.Lu=(t,e)=>{this.setVisible(e)},this.Ou=()=>this.setHighlight(1),this.Ru=()=>this.setHighlight(0),this.onMouseEnter=t=>this.P.on("mouseEnter",t),this.onMouseLeave=t=>this.P.on("mouseLeave",t),this.onMouseClick=t=>this.P.on("mouseClick",t),this.onMouseDoubleClick=t=>this.P.on("mouseDoubleClick",t),this.onMouseDown=t=>this.P.on("mouseDown",t),this.onMouseUp=t=>this.P.on("mouseUp",t),this.onMouseMove=t=>this.P.on("mouseMove",t),this.offMouseEnter=t=>this.P.off(t,"mouseEnter"),this.offMouseLeave=t=>this.P.off(t,"mouseLeave"),this.offMouseClick=t=>this.P.off(t,"mouseClick"),this.offMouseDoubleClick=t=>this.P.off(t,"mouseDoubleClick"),this.offMouseDown=t=>this.P.off(t,"mouseDown"),this.offMouseUp=t=>this.P.off(t,"mouseUp"),this.offMouseMove=t=>this.P.off(t,"mouseMove"),this.offMouseDragStart=t=>this.P.off(t,"mouseDragStart"),this.offMouseDrag=t=>this.P.off(t,"mouseDrag"),this.offMouseDragStop=t=>this.P.off(t,"mouseDragStop"),this.offMouseWheel=t=>this.P.off(t,"mouseWheel"),this.Eu=(t,e)=>{0===this.Du&&this.P.emit("mouseEnter",this,e),this.zu()},this.Vu=(t,e)=>{1===this.Du&&this.P.emit("mouseLeave",this,e),this.Nu()},this.Gu=(t,e)=>{this.P.emit("mouseMove",this,e),this.Hu()},this.Wu=(t,e)=>this.P.emit("mouseClick",this,e),this.Uu=(t,e)=>this.P.emit("mouseDoubleClick",this,e),this.$u=(t,e)=>this.P.emit("mouseDown",this,e),this.Yu=(t,e)=>this.P.emit("mouseUp",this,e),this.Xu=(t,e,i)=>{this.P.emit("mouseDragStart",this,e,i)},this.ju=(t,e,i,s,r)=>{this.P.emit("mouseDrag",this,e,i,s,r)},this.Zu=(t,e,i,s)=>{this.P.emit("mouseDragStop",this,e,i,s)},this.Ku=(t,e)=>{this.P.emit("mouseWheel",this,e)},this.qu=(t,e)=>{this.P.emit("touchStart",this,e),this.zu()},this.Ju=(t,e)=>{this.P.emit("touchMove",this,e),this.Hu()},this.Qu=(t,e)=>{this.P.emit("touchEnd",this,e),this.Nu()},this.qa=t,this.tc=i,this.hs=s,this.de=new Map,this.ic=n,this.iu=this.ic.su(this,{sc:{themeEffectEnabled:this.hs.effectsText},hc:{}}),this.qa.Li.Vh.Se(this,(t=>{this.de.forEach(((e,i)=>i.Ir(t))),this.Bu.forEach((e=>{e.setHighlight(t)}))}),{animationEnabled:this.qa.getAnimationsEnabled()})}rc(t,e){const i=void 0===(null==e?void 0:e.setEventHandlers)||e.setEventHandlers,s=void 0!==(null==e?void 0:e.isText)&&e.isText;this.de.set(t,{isText:s});const r=Array.from(this.de);this.iu.sc.nc(r.filter((t=>t[1].isText)).map((t=>t[0]))),this.iu.hc.nc(r.filter((t=>!t[1].isText)).map((t=>t[0]))),t.setMouseInteractions(this.Fu).setVisible(this.Ri).Ir(this.getHighlight()),i&&t.setMouseEnterEventHandler(this.Eu).setMouseLeaveEventHandler(this.Vu).setMouseClickEventHandler(this.Wu).setMouseDoubleClickEventHandler(this.Uu).setMouseDownEventHandler(this.$u).setMouseUpEventHandler(this.Yu).setMouseMoveEventHandler(this.Gu).setMouseDragStartEventHandler(this.Xu).setMouseDragEventHandler(this.ju).setMouseDragStopEventHandler(this.Zu).setMouseWheelEventHandler(this.Ku).setTouchStartEventHandler(this.qu).setTouchMoveEventHandler(this.Ju).setTouchEndEventHandler(this.Qu)}oc(t){this.de.delete(t)}setEffect(t){return this.iu.sc.vs(t&&this.hs.effectsText),this.iu.hc.vs(t),this.qa.Li.Bi(),this}getEffect(){return this.iu.sc._s()||this.iu.hc._s()}onHighlight(t){return this.P.on("highlight",t)}offHighlight(t){return this.P.off(t)}setName(t){return this.ac=t,this.Bu.forEach((t=>t.setText(this.ac))),this}getName(){return this.ac}dispose(){return this.ce||(this.ce=!0,this.de.forEach(((t,e)=>e.dispose())),this.tc(this),this.Bu.forEach((t=>{t.dispose()})),this.Bu.length=0,this.P.emit("dispose",this),this.qa.Li.Bi()),this}setVisible(t){return t===this.Ri||(this.Ri=t,this.de.forEach(((e,i)=>i.setVisible(t))),this.Bu.forEach((e=>e.setOn(t))),this.P.emit("visibleStateChanged",this,this.Ri),this.qa.Li.Bi()),this}getVisible(){return this.Ri}onVisibleStateChanged(t){return this.P.on("visibleStateChanged",t)}offVisibleStateChanged(t){return this.P.off(t,"visibleStateChanged")}setHighlight(t){return this.qa.Li.Vh.xe(this,t),this.P.emit("highlight",t),this}getHighlight(){return this.qa.Li.Vh.be(this)}setAnimationHighlight(t){return this.qa.Li.Vh.ve(this,t),this}getAnimationHighlight(){return this.qa.Li.Vh.Me(this)}setMouseInteractions(t){return this.Fu=t,this.de.forEach(((e,i)=>i.setMouseInteractions(t))),this.qa.Li.Bi(),this}getMouseInteractions(){return this.Fu}getIsUnderMouse(){return this.Du>0}setHighlightOnHover(t){return this.Pu=t?e.HighlightModes.onHover:e.HighlightModes.noHighlighting,!1===t&&this.getHighlight()>0&&this.setHighlight(!1),this}getHighlightOnHover(){return this.Pu!==e.HighlightModes.noHighlighting}attach(t,e=!0){t.setText(this.ac),t.setButtonOffStrokeStyle(t.getButtonOffStrokeStyle().setThickness(1)),t.setButtonOnStrokeStyle(t.getButtonOnStrokeStyle().setThickness(1));const i=t.getLocked();return t.setLocked(!1).setOn(this.getVisible()).setLocked(i),e&&t.onSwitch(this.Lu),t.setLocked(!e),t.onMouseEnter(this.Ou),t.onMouseLeave(this.Ru),this.onMouseEnter((()=>t.setHighlight(!0))),this.onMouseLeave((()=>t.setHighlight(!1))),this.onTouchStart((()=>t.setHighlight(!0))),this.onTouchEnd((()=>t.setHighlight(!1))),this.Bu.push(t),this}onMouseDragStart(t){return this.P.on("mouseDragStart",t)}onMouseDrag(t){return this.P.on("mouseDrag",t)}onMouseDragStop(t){return this.P.on("mouseDragStop",t)}onMouseWheel(t){return this.P.on("mouseWheel",t)}onTouchStart(t){return this.P.on("touchStart",t)}onTouchMove(t){return this.P.on("touchMove",t)}onTouchEnd(t){return this.P.on("touchEnd",t)}onDispose(t){return this.P.on("dispose",t)}offTouchStart(t){return this.P.off(t,"touchStart")}offTouchMove(t){return this.P.off(t,"touchMove")}offTouchEnd(t){return this.P.off(t,"touchEnd")}offDispose(t){return this.P.off(t,"dispose")}zu(t=1){this.Du+=t,this.Du===t&&this.Pu===e.HighlightModes.onHover&&this.setHighlight(!0)}Nu(t=1){this.Du=Math.max(0,this.Du-t),0===this.Du&&this.Pu===e.HighlightModes.onHover&&this.setHighlight(!1)}Hu(){}}class Kr extends Zr{constructor(t,e,i,s,r,n,o,h){super(e,i,o,h),this.Lr=t,this.axis=s,this.ct=r,this.lc=n,this.uc()}}class Jr extends Kr{constructor(t,e,i,s,r,n,o,h){super(t,e,i,s,r,n,o,h),this.ac="Band",this.cc=0,this.dc=0,this.Vr=this.hs.bandFillStyle,this.$r=this.hs.bandStrokeStyle,this.fc=this.Lr.gc(this.ct).ps(this.Vr).$h(this.$r).Ir(this.getHighlight()),this.rc(this.fc)}setValueStart(t){return this.cc=t,this.P.emit("valueChange",this,this.cc,this.dc),this.Lr.Bi(),this}getValueStart(){return this.cc}setValueEnd(t){return this.dc=t,this.P.emit("valueChange",this,this.cc,this.dc),this.Lr.Bi(),this}getValueEnd(){return this.dc}setFillStyle(t){this.Vr="function"==typeof t?t(this.Vr):t;const e=this.Vr;return this.fc.ps(e),this.Lr.Bi(),this}getFillStyle(){return this.Vr}setStrokeStyle(t){this.$r="function"==typeof t?t(this.$r):t;const e=this.$r;return this.fc.$h(e),this.Lr.Bi(),this}getStrokeStyle(){return this.$r}onValueChange(t){return this.P.on("valueChange",t)}offValueChange(t){return this.P.off(t,"valueChange")}ru(){return this.fc.Sn(this.lc.toVec2(this.cc,this.lc.getHeight(this.ct).getInnerStart())).q(this.lc.toVec2(this.dc-this.cc,this.lc.getHeight(this.ct).getInnerInterval())),this}attach(t,e){return super.attach(t,e),oe(t,this.hs,{fill:this.Vr,stroke:this.$r}),this}mc(t,e){t.Ir(e),this.Lr.Bi()}uc(){let t,i;const s=(e,s)=>{const r=nt(this.Lr.Li.ke(s.x,s.y),this.Lr.Li.ct,this.ct),n=this.lc.getWidth(r),o=this.axis.ct.ut(this.cc),h=this.axis.ct.ut(this.dc),a=(this.axis.ct.ut(n)-o)/(h-o);t=!(a<.1||a>.9),!1===t&&(i=a<.5)},r=(e,s,r,n,o)=>{const h=this.lc.getWidth(n);t?(this.cc=this.axis.ct.Yt(this.cc,h),this.dc=this.axis.ct.Yt(this.dc,h)):i?this.cc=this.axis.ct.Yt(this.cc,h):this.dc=this.axis.ct.Yt(this.dc,h),Xt(o),this.P.emit("valueChange",this,this.cc,this.dc),this.Lr.Bi()};this.onMouseMove(((i,r)=>{s(0,u(r.clientX,r.clientY));const n=t?e.MouseStyles.Point:this.lc.getWidth({x:e.MouseStyles.Horizontal,y:e.MouseStyles.Vertical});this.yc=this.qa.engine.setMouseStyle(n,this.yc)})),this.onMouseLeave((()=>{this.qa.engine.restoreMouseStyle(this.yc),this.yc=void 0})),this.onMouseDrag(((t,e,i,s,n)=>{0===i&&r(0,0,0,n,e)}));const n=Fr(new Or(s,r));this.onTouchStart(n.onTouchStart),this.onTouchMove(n.onTouchMove),this.onTouchEnd(n.onTouchEnd)}}class Qr extends Kr{constructor(t,e,i,s,r,n,o,h){super(t,e,i,s,r,n,o,h),this.ac="Constant Line",this.u=0,this.$r=this.hs.constantLineStrokeStyle,this.Sc=!0,this.xc=this.Lr._u(this.ct).ea(this.$r).Ir(this.getHighlight()),this.rc(this.xc)}setValue(t){return this.u=t,this.P.emit("valueChange",this,this.u),this.Lr.Bi(),this}getValue(){return this.u}setStrokeStyle(t){this.$r="function"==typeof t?t(this.$r):t;const e=this.$r;return this.xc.ea(e),this.Lr.Bi(),this}getStrokeStyle(){return this.$r}setInteractionMoveByDragging(t){return this.Sc=t,this}getInteractionMoveByDragging(){return this.Sc}onValueChange(t){return this.P.on("valueChange",t)}offValueChange(t){return this.P.off(t,"valueChange")}ru(){return this.xc.la(this.lc.toVec2(this.u,this.lc.getHeight(this.ct).getInnerStart())).Ko(this.lc.toVec2(this.u,this.lc.getHeight(this.ct).getInnerEnd())),this}attach(t,e){return super.attach(t,e),oe(t,this.hs,{stroke:this.$r}),this}mc(t,e){t.Ir(e),this.Lr.Bi()}uc(){const t=(t,e)=>{this.Sc&&(this.u=this.axis.ct.Yt(this.u,this.lc.getWidth(e)),this.P.emit("valueChange",this,this.u),this.Lr.Bi(),Xt(t))};this.onMouseMove((()=>{if(this.Sc){const t=this.lc.getWidth({x:e.MouseStyles.Horizontal,y:e.MouseStyles.Vertical});this.yc=this.qa.engine.setMouseStyle(t,this.yc)}})),this.onMouseLeave((()=>{this.Sc&&(this.qa.engine.restoreMouseStyle(this.yc),this.yc=void 0)})),this.onMouseDrag(((e,i,s,r,n)=>{this.Sc&&0===s&&t(i,n)}));const i=Fr(new Or(void 0,((e,i,s,r,n)=>t(n,r))));this.onTouchStart(i.onTouchStart),this.onTouchMove(i.onTouchMove),this.onTouchEnd(i.onTouchEnd)}}const tn=(t,e)=>t.setTextFillStyle(e.uiTextFillStyle).setTextFont(e.uiTextFont),en=(t,e)=>(oe(t.setButtonOffSize(e.uiButtonSize).setButtonOnSize(e.uiButtonSize),e,{fill:e.uiButtonFillStyle}),t),sn=(t,e,i)=>{i&&qr(t)&&t.setBackground((t=>t.setFillStyle(e.uiBackgroundFillStyle).setStrokeStyle(e.uiBackgroundStrokeStyle))).setEffect(!0)},rn={uiElement:void 0,stylers:o.List(),addStyler(t){return{...this,stylers:this.stylers.push(t)}},applyStylers(t,e){return this.stylers.forEach((i=>void 0!==i?i(t,e):void 0)),t}},nn={background:void 0,setBackground(t){return{...this,background:t}}},on={wu(t,e,i,s,r,n){const o=this.applyStylers(new this.uiElement(t,e,i,s,r),r);return sn(o,r,n),o}},hn={wu(t,e,i,s,r,n){const o=this.applyStylers(new this.uiElement(t,e,i,this.background,s,r),r);return sn(o,r,n),o}};class an extends Wr{constructor(){super(...arguments),this.bc=!0}ru(){return super.ru(),this}setMouseInteractions(t){return this.bc=t,this}getMouseInteractions(){return this.bc}hu(){return[]}}class ln extends an{onHighlight(t){return this.P.on("highlight",t)}offHighlight(t){return this.P.off(t)}au(t){return this.size=t,this}lu(){return 0}uu(){return 0}du(){return 0}cu(){return 0}setHighlight(t){return this}getHighlight(){return 0}setFillStyle(){return this}getFillStyle(){return F}setStrokeStyle(){return this}getStrokeStyle(){return J}setStrokeThickness(){return this}getStrokeThickness(){return 0}}class un extends ln{constructor(){super(...arguments),this.setSize=this.au.bind(this)}}class cn extends Wr{constructor(){super(...arguments),this.Vr=F,this.P=new r.Eventer,this.nu=0}onHighlight(t){return this.P.on("highlight",t)}offHighlight(t){return this.P.off(t)}hu(){return[this.Dn]}setFillStyle(t){return this.Vr="function"==typeof t?t(this.Vr):t,this.Dn.ps(this.Vr),this.Lr.Bi(),this}getFillStyle(){return this.Vr}getHighlight(){return this.nu}setHighlight(t){return this.nu=t,this.Dn.Ir(t),this.P.emit("highlight",t),this.Lr.Bi(),this}setMouseInteractions(t){return this.Dn.setMouseInteractions(t),this}getMouseInteractions(){return this.Dn.getMouseInteractions()}dispose(){return super.dispose(),this.Dn.dispose(),this}setVisible(t){return super.setVisible(t),this.Dn.setVisible(t),this}}class dn extends cn{constructor(){super(...arguments),this.$r=J}setStrokeStyle(t){return this.$r="function"==typeof t?t(this.$r):t,this.Dn.$h(this.$r),this.Lr.Bi(),this}getStrokeStyle(){return this.$r}}class fn extends dn{constructor(t,e,i,s,r,n){super(t,e,i,r,n),this.Lr=t,this.Dn=this.Lr.vc(this.renderingScale,Ws.Simple).$h(this.getStrokeStyle()).ps(this.getFillStyle()).setVisible(!1),this.jl(this.Dn)}Mc(){const t=this._c();if(t.length>2){const e=ze(t),i=u(e.max.x-e.min.x,e.max.y-e.min.y);this.setContentSize(i);const s=t.map((t=>{const s=Ke(t,Ze(e.min,-1));return this.scale.Yt(this.position,Ke(s,Qe(Ze(Ke(this.origin,u(1,1)),-.5),i)))})).map((t=>nt(t,this.scale,this.renderingScale)));this.Dn.lo(s).setVisible(this.getVisible()).setVisible(this.getVisible())}else this.Dn&&this.Dn.setVisible(!1),this.setContentSize(u(0,0))}ru(){return super.ru(),this.ce||this.Mc(),this}Gs(){return this.Mc(),super.Gs()}setVisible(t){return super.setVisible(t),this.Dn.setVisible(t),this}}class gn extends cn{constructor(t,e,i,s,r){super(t,e,i,s,r),this.Kr="label",this.Dn=this.Lr.ue(this.renderingScale).ps(this.Vr).fs(this.Kr),this.jl(this.Dn)}ru(){const t=this.getPosition(u(0,0),e.UISpace.Content),i=nt(t,this.scale,this.renderingScale);return this.Dn.Sn(i),this}Gs(){this.Dn.Gs();const t=0===this.Kr.length?u(0,0):this.Dn.Ac();return this.setContentSize(t),super.Gs()}setText(t){return this.Kr=t,this.Dn.fs(this.Kr),this.Lr.Bi(),this}getText(){return this.Kr}setFont(t){return this.Dn.Ss(t),this.Lr.Bi(),this}getFont(){return this.Dn.ys()}setTextRotation(t){return this.Dn.xs(t),this.Lr.Bi(),this}getTextRotation(){return this.Dn.bs()}}const mn={...rn,...on,uiElement:gn};class pn extends dn{constructor(t,e,i,s,r){super(t,e,i,s,r),this.fitTo=this.au.bind(this),this.setSize=this.fitTo,this.Dn=this.Lr.gc(e).ps(this.Vr).$h(this.getStrokeStyle()),this.jl(this.Dn)}ru(){const t=ze([this.getPosition(u(-1,-1),e.UISpace.Content),this.getPosition(u(1,1),e.UISpace.Content)].map((t=>nt(t,this.scale,this.renderingScale)))),i={x:t.max.x-t.min.x,y:t.max.y-t.min.y};return this.Dn.q(i).Sn(nt(this.getPosition(u(-1,-1),e.UISpace.Content),this.scale,this.renderingScale)),this}au(t){return this.setContentSize(t),this.Lr.Bi(),this}lu(){return 0}uu(){return 0}du(){return 0}cu(){return 0}}class yn extends dn{constructor(t,e,i,s,r){super(t,e,i,s,r),this.wc=u(0,0),this.setSize=this.fitTo.bind(this),this.Dn=t.kc(e).Zo(0).Ko(360).ps(this.Vr).$h(this.getStrokeStyle()),this.jl(this.Dn)}ru(){const t=this.getSize(e.UISpace.Content).x/2;return this.Dn.Jo(t*this.renderingScale.yi().x).Qo(t*this.renderingScale.yi().y).Sn(nt(this.getPosition(u(0,0),e.UISpace.Content),this.scale,this.renderingScale)).ia(255).Gs(),this}au(t){const e=Math.sqrt(t.x*t.x/4+t.y*t.y/4);return this.setContentSize(u(2*e,2*e)),this.wc=t,this.Lr.Bi(),this}lu(){return(this.getSize(e.UISpace.Content).x-this.wc.x)/2}uu(){return(this.getSize(e.UISpace.Content).x-this.wc.x)/2}du(){return(this.getSize(e.UISpace.Content).y-this.wc.y)/2}cu(){return(this.getSize(e.UISpace.Content).y-this.wc.y)/2}fitTo(t){const e=Math.min(t.x,t.y);return this.setContentSize(u(e,e)),this.wc=t,this}}class xn extends fn{constructor(t,e,i,s,r){super(t,e,i,Ws.Simple,s,r),this.Cc=y(u(0,0)),this.Tc=!1,this.setSize=this.fitTo.bind(this),this.Lr=t,this.Mc()}_c(){const t=this.Cc.M();if(this.Tc){const e=Math.min(t.x,t.y);return[u(0,0),u(e/2,e/2),u(0,e),u(-e/2,e/2)]}const e=2*Math.sqrt(this.Cc.M().x*this.Cc.M().x/4+this.Cc.M().y*this.Cc.M().y/4),i=u(Math.cos(Math.PI/4)*e,0),s=u(0,Math.sin(Math.PI/4)*e),r=u(0,0),n=Ke(r,Ke(i,s)),o=Ke(n,Ke(s,Ze(i,-1)));return[r,n,o,Je(o,Ke(i,s))]}au(t){return this.Cc.S(t),this.Tc=!1,this.Lr.Bi(),this}lu(){return this.Tc?0:(this.getSize(e.UISpace.Content).x-this.Cc.M().x)/2}uu(){return this.Tc?0:(this.getSize(e.UISpace.Content).x-this.Cc.M().x)/2}du(){return this.Tc?0:(this.getSize(e.UISpace.Content).y-this.Cc.M().y)/2}cu(){return this.Tc?0:(this.getSize(e.UISpace.Content).y-this.Cc.M().y)/2}fitTo(t){return this.Cc.S(t),this.Tc=!0,this.Lr.Bi(),this}}class Sn extends fn{constructor(t,i,s,r,n){super(t,i,s,Ws.Simple,r,n),this.Ic=y(u(0,0)),this.Fc=y(10),this.Pc=y(void 0),this.Su=y(e.UIDirections.Right),this.Mc()}setDirection(t){return this.Su.S(t),this.Lr.Bi(),this}getDirection(){return this.Su.M()}setPointerLength(t){return this.Fc.S(t),this.Lr.Bi(),this}getPointerLength(){return this.Fc.M()}setPointerAngle(t){return this.Pc.S(t),this.Lr.Bi(),this}getPointerAngle(){let t=this.Pc.M();if(void 0===t){const e=this.Dc();if(0===e)return 0;t=0!==e?180*Math.atan(2*this.getPointerLength()/e)/Math.PI:0}return Math.min(Math.max(t,1),89)}au(t){return this.Ic.S(t),this.Lr.Bi(),this}Bc(){const t=this.getPointerAngle();return 0===t?0:2*this.getPointerLength()/Math.tan(t*Math.PI/180)}Lc(){return qt(this.Su.M())?this.Ic.M().x:this.Ic.M().y}Dc(){return qt(this.Su.M())?this.Ic.M().y:this.Ic.M().x}lu(){switch(this.Su.M()){case e.UIDirections.Right:return 0;case e.UIDirections.Left:return this.getPointerLength();case e.UIDirections.Up:case e.UIDirections.Down:return Math.max(0,this.Bc()-this.Dc());default:return 0}}uu(){switch(this.Su.M()){case e.UIDirections.Right:return this.getPointerLength();case e.UIDirections.Left:return 0;case e.UIDirections.Up:case e.UIDirections.Down:return Math.max(0,this.Bc()-this.Dc());default:return 0}}du(){switch(this.Su.M()){case e.UIDirections.Right:case e.UIDirections.Left:return Math.max(0,this.Bc()-this.Dc());case e.UIDirections.Up:return this.getPointerLength();case e.UIDirections.Down:default:return 0}}cu(){switch(this.Su.M()){case e.UIDirections.Right:case e.UIDirections.Left:return Math.max(0,this.Bc()-this.Dc());case e.UIDirections.Up:return 0;case e.UIDirections.Down:return this.getPointerLength();default:return 0}}_c(){const t=Yt(this.Su.M()),e=$e(u(0,0),t),i=this.getPointerLength(),s=this.Bc(),r=this.Lc(),n=this.Dc();if(!(0!==i&&0!==s||0!==r&&0!==n))return[];const o=u(0,0),h=Ke(Ke(o,Ze(t,-i)),Ze(e,s/2)),a=Ke(h,Ze(e,(n-s)/2)),l=Ke(a,Ze(t,-r)),c=Ke(Ke(o,Ze(t,-i)),Ze(e,-s/2)),d=Ke(c,Ze(e,-(n-s)/2)),f=Ke(d,Ze(t,-r));let g;return g=0===r||0===n?[o,h,c]:0===i||0===s?[a,l,f,d]:Mt(n,s)?[o,h,l,f,c]:[o,h,a,l,f,d,c],g}}class vn extends an{setSize(t){return this.setContentSize(t),this.Lr.Bi(),this}}class bn extends Yr{constructor(){super(...arguments),this.Oc=[],this.Rc=0,this.Ec=t=>{const e=this.Oc.indexOf(t);e>=0&&this.Oc.splice(e,1)}}getMembers(){return this.Oc}getMemberCount(){return this.Oc.length}setMinimumSize(t){return this.zc=t,this.Lr.Bi(),this}getMinimumSize(){return this.zc}addElement(t,e=-1){const i=t.wu(this.Lr,this.renderingScale,this.scale,this.Ec,this.hs,!1);return i.setMouseInteractions(this.getMouseInteractions()),e>=0?this.Oc.splice(e,0,i):this.Oc.push(i),i.setVisible(this.getVisible()),this.jl(i),this.ce&&(de(0,(()=>{})),i.dispose()),i}dispose(){return super.dispose(),this.Oc.slice().forEach(vt),this}setVisible(t){return super.setVisible(t),this.Oc.forEach((e=>e.setVisible(t))),this}setMouseInteractions(t){super.setMouseInteractions(t);for(let e=0;et+ +(e instanceof vn)),0),s=i>0?(this.size.x-this.Rc)/i:0;return this.Oc.reduce(((e,i)=>i instanceof vn?this.scale.Yt({x:e,y:t.y},{x:s+i.getSize().x,y:0}).x:i.setOrigin(u(-1,1)).setPosition(u(e,t.y)).ru().getPosition(u(1,0)).x),t.x),this}Gs(){for(let t=0;tt+ +(e instanceof vn)),0),s=i>0?(this.size.y-this.Rc)/i:0;return this.Oc.reduce(((e,i)=>i instanceof vn?this.scale.Yt({x:t.x,y:e},{x:0,y:-(s+i.getSize().y)}).y:i.setOrigin(u(-1,1)).setPosition(u(t.x,e)).ru().getPosition(u(0,-1)).y),t.y),this}Gs(){for(let t=0;t{const i={},s=`stylable${t}s`;return i[s]=e,i[`set${t}FillStyle`]=function(t){return this[s].forEach((e=>e.setFillStyle(t))),this},i[`get${t}FillStyle`]=function(){return this[s][0].getFillStyle()},i[`set${t}Font`]=function(t){return this[s].forEach((e=>e.setFont(t))),this},i[`get${t}Font`]=function(){return this[s][0].getFont()},i[`set${t}Rotation`]=function(t){return this[s].forEach((e=>e.setTextRotation(t))),this},i[`get${t}Rotation`]=function(){return this[s][0].getTextRotation()},i},Cn=In("Text",[]),Pn={button:void 0,isLocked:!1,setOn(t){if(!this.isLocked){const e=this.button.getOn()!==t;this.button.setOn(t),e&&this.P.emit("switch",t)}return this},getOn(){return this.button.getOn()},setLocked(t){return this.isLocked=t,this},getLocked(){return this.isLocked},onSwitch(t){return this.P.on("switch",(e=>t(this,e)))},offSwitch(t){return this.P.off(t,"switch")},setButtonOffFillStyle(t){return this.button.setOffFillStyle(t),this},getButtonOffFillStyle(){return this.button.getOffFillStyle()},setButtonOffStrokeStyle(t){return this.button.setOffStrokeStyle(t),this},getButtonOffStrokeStyle(){return this.button.getOffStrokeStyle()},setButtonOffSize(t){return this.button.setOffSize(t),this},getButtonOffSize(){return this.button.getOffSize()},setButtonOnFillStyle(t){return this.button.setOnFillStyle(t),this},getButtonOnFillStyle(){return this.button.getOnFillStyle()},setButtonOnStrokeStyle(t){return this.button.setOnStrokeStyle(t),this},getButtonOnStrokeStyle(){return this.button.getOnStrokeStyle()},setButtonOnSize(t){return this.button.setOnSize(t),this},getButtonOnSize(){return this.button.getOnSize()}},Ln={pointable:void 0,setDirection(t){return this.pointable.setDirection(t),this},getDirection(){return this.pointable.getDirection()},setPointerLength(t){return this.pointable.setPointerLength(t),this},getPointerLength(){return this.pointable.getPointerLength()}},Rn={...rn,...nn,background:pn,wu(t,e,i,s,r,n){const o=new Mn(t,e,i,this.background,s,r),h=o.addElement(mn,void 0),a=Object.assign(o,kn,{setTextLabel:h},Cn,{stylableTexts:[h]});return sn(a,r,n),this.applyStylers(a,r)}}.addStyler(tn),Fn={...rn,...nn,background:Sn,wu(t,i,s,r,n,o){const h=new Mn(t,i,s,this.background,r,n),a=h.addElement(mn,void 0),l=h.getBackground(),u=Object.assign(h,kn,{setTextLabel:a},Cn,{stylableTexts:[a]},Ln,{pointable:l},{setTickLabelPadding(t){return this.getDirection()===e.UIDirections.Up?this.setPadding({top:t}):this.getDirection()===e.UIDirections.Down?this.setPadding({bottom:t}):this.getDirection()===e.UIDirections.Right?this.setPadding({right:t}):this.getDirection()===e.UIDirections.Left&&this.setPadding({left:t}),this},getTickLabelPadding(){return this.getDirection()===e.UIDirections.Up?this.getPadding().top:this.getDirection()===e.UIDirections.Down?this.getPadding().bottom:this.getDirection()===e.UIDirections.Right?this.getPadding().right:this.getPadding().left}});return u.ku="other",u.setPointerLength(n.xAxisNumericTicks.majorTickStyle.getTickLength()).setTickLabelPadding(n.xAxisNumericTicks.majorTickStyle.getTickPadding()).setTextFont(n.uiTextFont).setTextFillStyle(n.uiTextFillStyle).setBackground((t=>t.setFillStyle(n.uiBackgroundFillStyle).setStrokeStyle(n.uiBackgroundStrokeStyle))),sn(u,n,o),this.applyStylers(u,n)}};class _n extends Wr{constructor(t,e,i,s,n,o,h){super(t,e,i,o,h),this.xl=!1,this.P=new r.Eventer,this.getOn=()=>this.xl,this.Nc=this.jl(new s(this.Lr,this.renderingScale,this.scale,bt,h)),this.Gc=this.jl(new n(this.Lr,this.renderingScale,this.scale,bt,h))}hu(){return[...this.Nc.hu(),...this.Gc.hu()]}onHighlight(t){return this.P.on("highlight",t)}offHighlight(t){return this.P.off(t)}setOn(t){return this.xl=t,this.Lr.Bi(),this}setOffFillStyle(t){return this.Nc.setFillStyle(t),this}getOffFillStyle(){return this.Nc.getFillStyle()}setOffStrokeStyle(t){return this.Nc.setStrokeStyle(t),this}getOffStrokeStyle(){return this.Nc.getStrokeStyle()}setOffSize(t){return this.Nc.fitTo("number"==typeof t?u(t,t):t),this}getOffSize(){return this.Nc.getSize()}setOnFillStyle(t){return this.Gc.setFillStyle(t),this}getOnFillStyle(){return this.Gc.getFillStyle()}setOnStrokeStyle(t){return this.Gc.setStrokeStyle(t),this}getOnStrokeStyle(){return this.Gc.getStrokeStyle()}setOnSize(t){return this.Gc.fitTo("number"==typeof t?u(t,t):t),this}getOnSize(){return this.Gc.getSize()}ru(){return super.ru(),this.xl?(this.Nc.setVisible(!1),this.Gc.setVisible(this.getVisible()).setPosition(this.getPosition(u(0,0),e.UISpace.Content)).ru()):(this.Nc.setVisible(this.getVisible()).setPosition(this.getPosition(u(0,0),e.UISpace.Content)).ru(),this.Gc.setVisible(!1)),this}Gs(){const t=this.Nc.Gs().getSize(),e=this.Gc.Gs().getSize();return this.setContentSize(u(Math.max(t.x,e.x),Math.max(t.y,e.y))),super.Gs()}dispose(){return super.dispose(),this.Nc.dispose(),this.Gc.dispose(),this}setMouseInteractions(t){return this.Gc.setMouseInteractions(t),this.Nc.setMouseInteractions(t),this}getMouseInteractions(){return this.Gc.getMouseInteractions()}setHighlight(t){const e=me(t);return this.Gc.setHighlight(e),this.Nc.setHighlight(e),this.P.emit("highlight",t),this.Lr.Bi(),this}getHighlight(){return this.Gc.getHighlight()}}const On={...rn,uiElement:_n,pictureOff:yn,pictureOn:yn,setPictureOff(t){return{...this,pictureOff:t}},setPictureOn(t){return{...this,pictureOn:t}},wu(t,e,i,s,r,n){const o=this.applyStylers(new this.uiElement(t,e,i,this.pictureOff,this.pictureOn,s,r),r);return sn(o,r,n),o}},zn={...rn,...nn,background:pn,buttonBuilder:On,setPictureOff(t){return{...this,buttonBuilder:this.buttonBuilder.setPictureOff(t)}},setPictureOn(t){return{...this,buttonBuilder:this.buttonBuilder.setPictureOn(t)}},wu(t,i,s,r,n,o){const h=new Mn(t,i,s,this.background,r,n),a=h.addElement(En);a.addGap();const l=a.addElement(this.buttonBuilder);a.addGap();const u=h.addElement(En);u.addGap();const c=u.addElement(mn);u.addGap(),h.addGap();const d=Object.assign(h,kn,{setTextLabel:c},Cn,{stylableTexts:[c]},Pn,{button:l});return d.onMouseClick(((t,e)=>{d.setOn(!d.getOn())})),d.onMouseEnter((()=>d.setHighlight(!0))),d.onMouseLeave((()=>d.setHighlight(!1))),d.setMouseStyle(e.MouseStyles.Point),d.setPadding({left:6}),sn(d,n,o),this.applyStylers(d,n)}}.addStyler(tn).addStyler(en);class Vn extends Wr{constructor(t,e,i,s,r,n){super(t,e,i,s,r),this.Hc=[],this.Wc=2,this.Uc="",this.$c=(t,e)=>void 0!==t.label?t.label:vi(t.value,e.min,e.max),this.Yc=0,this.Xc=0,this.jc=!1,this.Lr=t,this.Zc=n,this.Kc=this.jl(t.gc(e).$h(J)),this.qc=this.jl(t.ue(e).ps(r.uiTextFillStyle).Ss(r.uiTextFont).setMouseInteractions(!1)),"vertical"===n?(this.Jc=140,this.Qc=25):(this.Jc=160,this.Qc=15)}hu(){return[this.Kc,this.qc]}td(t){this.sd=t;const e=Un(t,"vertical"===this.Zc?0:90,this.jc);return this.Kc.ps(e),this.Lr.Bi(),this}ed(){return this.sd}hd(t){return this.Jc=t,this.Lr.Bi(),this}rd(){return this.Jc}nd(t){return this.Qc=t,this.Lr.Bi(),this}od(){return this.Qc}ad(t){return this.Uc=t,this.Lr.Bi(),this}ld(){return this.Uc}ud(t){return this.$c=t,this.Lr.Bi(),this}setLUTDisplayProportionalSteps(t){if(this.jc=t,this.sd){const t=Un(this.sd,"vertical"===this.Zc?0:90,this.jc);this.Kc.ps(t)}return this.Lr.Bi(),this}getLUTDisplayProportionalSteps(){return this.jc}setFillStyle(t){return this.qc.ps(t),this.Lr.Bi(),this}getFillStyle(){return this.qc.gs()}setFont(t){return this.qc.Ss(t),this.Lr.Bi(),this}getFont(){return this.qc.ys()}setTextRotation(t){return this.Xc=t,this.qc.xs(t),this.Lr.Bi(),this}getTextRotation(){return this.qc.bs()}ru(){var t,i,s,r;if(super.ru(),this.ce)return this;const n=this.sd;if(n){const o=this.renderingScale.yi(),h=n.min,a=n.max;if("vertical"===this.Zc){const s=this.getPosition({x:-1,y:-1},e.UISpace.Content),r=Ke(s,{x:this.Kc.Et().x+this.Wc*o.x,y:0}),l={x:r.x,y:r.y+(this.Uc.length>0?this.Yc*o.y+this.qc.Et().y:0)+.5*((null===(t=this.Hc[0])||void 0===t?void 0:t.Et().y)||0)},u={x:l.x,y:this.getPosition({x:-1,y:1},e.UISpace.Content).y-.5*((null===(i=this.Hc[this.Hc.length-1])||void 0===i?void 0:i.Et().y)||0)};this.Kc.Sn({x:s.x,y:l.y}),this.qc.kn({x:-1,y:-1}).Sn(r),n.getSteps().forEach(((t,e)=>{const i=_e(l,u,this.jc?!0===n.getInterpolation()?(t.value-h)/(a-h):.9*(t.value-h)/(a-h):!0===n.getInterpolation()?e/(n.getSteps().length-1):e/n.getSteps().length);this.Hc[e].kn({x:-1,y:0}).Sn(i)}))}else{const t=this.getPosition({x:-1,y:-1},e.UISpace.Content),i=this.getPosition({x:1,y:1},e.UISpace.Content),l=this.Hc.reduce(((t,e)=>Math.max(t,e.Et().y)),0),u=Ke(t,{x:.5*((null===(s=this.Hc[0])||void 0===s?void 0:s.Et().x)||0),y:l}),c={x:i.x,y:u.y},d={x:c.x-(.5*((null===(r=this.Hc[this.Hc.length-1])||void 0===r?void 0:r.Et().x)||0)+(this.Uc.length>0?this.Yc*o.x+this.qc.Et().x:0)),y:u.y},f={x:u.x,y:u.y+this.Wc*o.y};this.Kc.Sn(f),this.qc.kn({x:1,y:1}).Sn(c),n.getSteps().forEach(((t,e)=>{const i=_e(u,d,this.jc?!0===n.getInterpolation()?(t.value-h)/(a-h):.9*(t.value-h)/(a-h):!0===n.getInterpolation()?e/(n.getSteps().length-1):e/n.getSteps().length);this.Hc[e].kn({x:0,y:1}).Sn(i)}))}}return this}Gs(){if(this.sd&&this.getVisible()){const t=this.sd.getSteps();for(let e=this.Hc.length;eMath.max(t,e.Gs().Ac().x)),0),this.qc.Gs().Ac().x),s=(this.Uc.length>0?this.Yc+this.qc.Gs().Ac().y:0)+e+.5*this.Hc[0].Gs().Ac().y+.5*this.Hc[this.Hc.length-1].Gs().Ac().y;this.setContentSize({x:i,y:s})}else{const t=this.Jc,e=this.Qc;this.Kc.q({x:t*this.renderingScale.x.getPixelSize(),y:e*this.renderingScale.y.getPixelSize()});const i=Math.max(this.Uc.length>0?this.Yc+this.qc.Gs().Ac().x:0,.5*this.Hc[this.Hc.length-1].Gs().Ac().x),s=t+.5*this.Hc[0].Gs().Ac().x+i,r=e+this.Wc+this.Hc.reduce(((t,e)=>Math.max(t,e.Gs().Ac().y)),0);this.setContentSize({x:s,y:r})}}else this.Hc.forEach((t=>t.dispose())),this.Hc.length=0,this.qc.setVisible(!1),this.Kc.setVisible(!1),this.setContentSize({x:0,y:0});return super.Gs()}dispose(){return super.dispose(),this.Kc.dispose(),this.Hc.forEach(vt),this.qc.dispose(),this}setMouseInteractions(t){return this.Kc.setMouseInteractions(t),this}getMouseInteractions(){return this.Kc.getMouseInteractions()}}const Nn={lutElement:{},setLUT(t){return this.lutElement.td(t),this},getLUT(){return this.lutElement.ed()},setLUTLength(t){return this.lutElement.hd(t),this},getLUTLength(){return this.lutElement.rd()},setLUTThickness(t){return this.lutElement.nd(t),this},getLUTThickness(){return this.lutElement.od()},setLookUpUnit(t){return this.lutElement.ad(t),this},getLookUpUnit(){return this.lutElement.ld()},setLUTStepValueFormatter(t){return this.lutElement.ud(t),this},setLUTDisplayProportionalSteps(t){return this.lutElement.setLUTDisplayProportionalSteps(t),this},getLUTDisplayProportionalSteps(){return this.lutElement.getLUTDisplayProportionalSteps()}},Gn={...rn,...nn,background:pn,alignment:"horizontal",setAlignment(t){return{...this,alignment:t}},wu(t,e,i,s,r,n){const o=new An(t,e,i,this.background,s,r),h=o.addElement({wu:()=>new Vn(t,e,i,bt,r,this.alignment)}),a=Object.assign(o,Cn,{stylableTexts:[h]},Nn,{lutElement:h});return sn(a,r,n),this.applyStylers(a,r)}}.addStyler(tn),Un=(t,e,i)=>{const s=t.getSteps(),r=t.min,n=t.max-r;if(!0===t.getInterpolation())return new Z({angle:e,stops:s.map(((e,o)=>({offset:i?(e.value-r)/n:o/(s.length-1),color:e.color||t.color})))});const o=[];for(let e=0;enew Vn(t,i,s,bt,n,this.alignment)});"vertical"===this.alignment&&d.setMargin({left:n.uiButtonSize+6});const f=Object.assign(o,kn,{setTextLabel:c},Cn,{stylableTexts:[c,d]},In("LUTText",[d]),Pn,{button:l},Nn,{lutElement:d});return f.onMouseClick((()=>{f.setOn(!f.getOn())})),f.onMouseEnter((()=>f.setHighlight(!0))),f.onMouseLeave((()=>f.setHighlight(!1))),f.setMouseStyle(e.MouseStyles.Point),f.setPadding({left:6}),this.applyStylers(f,n)}}.addStyler(tn).addStyler(en),Wn={alignment:null,title:null,entryStylers:null,legendBoxDisposed:null,entries:[],add(t,e){const i=!e||"object"!=typeof e||void 0===e.toggleVisibilityOnClick||e.toggleVisibilityOnClick,s=e&&"object"==typeof e&&void 0!==e.builder?e.builder:void 0;return this.legendBoxDisposed()||(t instanceof mo?this.addChart(t,i,s):"attach"in t?this.addAttachable(t,i,s):t&&this.addDashboard(t,i,s)),this},addAttachable(t,e,i){const s=t.ed&&t.ed();let r=i;r||(r=s?Hn.setAlignment(this.alignment):zn);const n=this.addElement(r);if(s&&"setLUT"in n){n.setLUT(s.lut);const t=s.lut.getUnits(),e=s.lookUpProperty,i=t.length>0?t:"x"===e?"x":"y"===e?"y":"z"===e?"z":"";n.setLookUpUnit(i)}return this.entryStylers.forEach((t=>t(n))),this.entries.push({entry:n,component:t}),t.attach(n,e),this},addChart(t,e,i){return t.dd().forEach((t=>this.addAttachable(t,e,i))),this},addDashboard(t,e,i){return t.getCells().filter((t=>t.panel instanceof mo)).forEach((t=>this.addChart(t.panel,e,i))),this},setTitle(t){return this.title.setText(t),this},getTitle(){return this.title.getText()},setTitleFillStyle(t){return this.title.setTextFillStyle(t),this},getTitleFillStyle(){return this.title.getTextFillStyle()},setTitleFont(t){return this.title.setTextFont(t),this},getTitleFont(){return this.title.getTextFont()},setTitleRotation(t){return this.title.setTextRotation(t),this},getTitleRotation(){return this.title.getTextRotation()},setEntries(t){return this.entries.forEach((e=>t(e.entry,e.component))),this}},Yn={alignment:"vertical",layoutBuilder:En,setAlignment(t){return{...this,alignment:t,layoutBuilder:"horizontal"===t?Bn:En}},getAlignment(){return this.alignment},titleBuilder:Rn,styleTitle(t){return{...this,titleBuilder:this.titleBuilder.addStyler(t)}},entryStylers:[],styleEntries(t){return{...this,entryStylers:[...this.entryStylers,t]}}},qn={...rn,...nn,...Yn,background:pn,wu(t,e,i,s,r,n){const o=this.layoutBuilder.setBackground(this.background).wu(t,e,i,s,r,!1);let h=Object.assign(o,Wn,{alignment:this.alignment,entryStylers:this.entryStylers,legendBoxDisposed:()=>o.ce});h.entries=[];const a=h.addElement("horizontal"===this.alignment?En:Bn),l=a.addElement(this.titleBuilder).setText("Legend").setTextFillStyle(r.legendTitleFillStyle).setTextFont(r.legendTitleFont);return a.addGap(),h=Object.assign(h,{title:l}),"horizontal"===this.alignment&&l.setMargin({right:6}),sn(h,r,n),this.applyStylers(h,r)}}.addStyler(((t,e)=>t.setPadding(5)));class Xn extends Wr{constructor(t,i,s,r,n){super(t,i,s,r,n),this.fd=10,this.gd=e.UIDirections.Up,this.pd=0,this.ku="major",this.Kr=this.jl(t.ue(this.renderingScale)),this.xc=this.jl(t._u(this.renderingScale))}hu(){return[this.Kr]}ru(){if(super.ru(),this.ce)return this;const t=nt(this.getPosition(),this.scale,this.renderingScale),i=this.renderingScale.Yt(t,{x:this.gd===e.UIDirections.Right?-this.fd:this.gd===e.UIDirections.Left?this.fd:0,y:this.gd===e.UIDirections.Up?-this.fd:this.gd===e.UIDirections.Down?this.fd:0}),s=this.renderingScale.Yt(i,{x:this.gd===e.UIDirections.Right?-this.pd:this.gd===e.UIDirections.Left?this.pd:0,y:this.gd===e.UIDirections.Up?-this.pd:this.gd===e.UIDirections.Down?this.pd:0});return this.xc.la(t).Ko(i),this.Kr.Sn(s).kn(this.gd===e.UIDirections.Up?{x:0,y:1}:this.gd===e.UIDirections.Down?{x:0,y:-1}:this.gd===e.UIDirections.Right?{x:1,y:0}:{x:-1,y:0}),this}Gs(){const t=this.xc.ha(),i=t instanceof tt?t.getThickness():0;return this.size=this.gd===e.UIDirections.Left||this.gd===e.UIDirections.Right?{x:this.fd+this.pd+this.Kr.Gs().Ac().x,y:i}:{y:this.fd+this.pd+this.Kr.Gs().Ac().y,x:i},super.Gs()}dispose(){return super.dispose(),this.Kr.dispose(),this.xc.dispose(),this}setVisible(t){return super.setVisible(t),this.Kr.setVisible(t),this.xc.setVisible(t),this}setMouseInteractions(t){return this.Kr.setMouseInteractions(t),this.xc.setMouseInteractions(t),this}getMouseInteractions(){return this.Kr.getMouseInteractions()}getText(){return this.Kr.cs()}setTextFillStyle(t){return this.Kr.ps(t),this.Lr.Bi(),this}getTextFillStyle(){return this.Kr.gs()}setTextFont(t){return this.Kr.Ss(t),this}setTextRotation(t){return this.Kr.xs(t),this}getTextRotation(){return this.Kr.bs()}getTextFont(){return this.Kr.ys()}setText(t){return this.Kr.fs(t),this.Lr.Bi(),this}setDirection(t){return this.gd=t,this.Lr.Bi(),this}getDirection(){return this.gd}setPointerLength(t){return this.fd=t,this.Lr.Bi(),this}getPointerLength(){return this.fd}setTickLabelPadding(t){return this.pd=t,this.Lr.Bi(),this}getTickLabelPadding(){return this.pd}setTickStyle(t){return this.xc.ea(t),this.Lr.Bi(),this}getTickStyle(){return this.xc.ha()}}const $n={...rn,wu(t,e,i,s,r,n){const o=new Xn(t,e,i,s,r);return sn(o,r,n),this.applyStylers(o,r)}}.addStyler(tn),jn=$n.addStyler(((t,e)=>(t.ku="major",t.setPointerLength(e.xAxisNumericTicks.majorTickStyle.tickLength).setTickLabelPadding(e.xAxisNumericTicks.majorTickStyle.tickPadding).setTickStyle(e.xAxisNumericTicks.majorTickStyle.tickStyle).setTextFont(e.xAxisNumericTicks.majorTickStyle.labelFont).setTextFillStyle(e.xAxisNumericTicks.majorTickStyle.labelFillStyle)))),Zn=$n.addStyler(((t,e)=>(t.ku="minor",t.setPointerLength(e.xAxisNumericTicks.minorTickStyle.tickLength).setTickLabelPadding(e.xAxisNumericTicks.minorTickStyle.tickPadding).setTickStyle(e.xAxisNumericTicks.minorTickStyle.tickStyle).setTextFont(e.xAxisNumericTicks.minorTickStyle.labelFont).setTextFillStyle(e.xAxisNumericTicks.minorTickStyle.labelFillStyle)))),Kn=zn.addStyler((t=>t.onSwitch(((e,i)=>!0===i?setTimeout((()=>t.setOn(!1)),300):void 0)))),Jn=qn.setAlignment("horizontal"),Qn=qn.setAlignment("vertical"),to={TextBox:Rn,CheckBox:zn,ButtonBox:Kn,PointableTextBox:Fn,AxisTickMajor:jn,AxisTickMinor:Zn,LUTRange:Gn},eo={HorizontalLegendBox:Jn,VerticalLegendBox:Qn};class io extends Gi{constructor(t,e,i,s,r,n,o){super(t,e,i,s,o),this.md=r,this.yd=n}}const so=(t,e,i)=>At(t+.1*(e-t)+.5*i.getPixelSize()*Math.sign(e-t),t,e),ro=(t,e,i)=>{const s=i.ut(t),r=i.ut(e);return At(i.ot(s+.1*(r-s)+.5*Math.sign(r-s)),t,e)};class no extends Ni{constructor(t,i,s,n,o,h,a,l,c,d,f,g,m,p,y,x,S){var v;super(f,d,l,y,x,{numeric:d.getWidth({x:y.xAxisNumericTicks,y:y.yAxisNumericTicks}),datetime:d.getWidth({x:y.xAxisDateTimeTicks,y:y.yAxisDateTimeTicks}),time:d.getWidth({x:y.xAxisTimeTicks,y:y.yAxisTimeTicks})},S),this.Sd=new Map,this.xd=void 0,this.bd=0,this.vd=[],this.Md=[],this.Fi=Bi.fitting,this._d=!0,this.Ad=0,this.wd=8,this.kd=void 0,this.Cd=void 0,this.Td=20,this.Id=1,this.Fd=!0,this.Pd=!0,this.Dd=!0,this.Bd=!0,this.Ld=!0,this.Od=!0,this.Rd=!0,this.Ed=!0,this.zd=!0,this.Vd=!0,this.Nd=this.es.defaultDragMouseStyle,this.Gd=this.es.defaultDragMouseStyle,this.Hd=this.es.defaultDragMouseStyle,this.Wd=this.es.defaultDragMouseStyle,this.Ud=this.es.defaultDragMouseStyle,this.P=new r.Eventer,this.$d=[],this.Yd=t=>{const e=this.Md.indexOf(t);e>=0&&this.Md.splice(e,1)},this.Xd=t=>(this.Md.indexOf(t)<0&&this.Md.push(t),this.Yd),this.qu=(t,e)=>this.P.emit("axisAreaTouch",this,e),this.jd=Zt(this.$d),this.onAxisInteractionAreaMouseClick=t=>this.P.on("axisAreaMouseClick",t),this.onAxisInteractionAreaMouseDoubleClick=t=>this.P.on("axisAreaDoubleClick",t),this.onAxisInteractionAreaMouseDown=t=>this.P.on("axisAreaMouseDown",t),this.onAxisInteractionAreaMouseUp=t=>this.P.on("axisAreaMouseUp",t),this.onAxisInteractionAreaMouseEnter=t=>this.P.on("axisAreaMouseEnter",t),this.onAxisInteractionAreaMouseLeave=t=>this.P.on("axisAreaMouseLeave",t),this.onAxisInteractionAreaMouseMove=t=>this.P.on("axisAreaMouseMove",t),this.onAxisInteractionAreaMouseWheel=t=>this.P.on("axisAreaMouseWheel",t),this.onAxisInteractionAreaMouseDragStart=t=>this.P.on("axisAreaMouseDragStart",t),this.onAxisInteractionAreaMouseDrag=t=>this.P.on("axisAreaMouseDrag",t),this.onAxisInteractionAreaMouseDragStop=t=>this.P.on("axisAreaMouseDragStop",t),this.onAxisInteractionAreaTouchStart=t=>this.P.on("axisAreaTouchStart",t),this.onAxisInteractionAreaTouch=t=>this.P.on("axisAreaTouch",t),this.onAxisInteractionAreaTouchStop=t=>this.P.on("axisAreaTouchEnd",t),this.offAxisInteractionAreaMouseClick=t=>this.P.off(t,"axisAreaMouseClick"),this.offAxisInteractionAreaMouseDoubleClick=t=>this.P.off(t,"axisAreaDoubleClick"),this.offAxisInteractionAreaMouseDown=t=>this.P.off(t,"axisAreaMouseDown"),this.offAxisInteractionAreaMouseUp=t=>this.P.off(t,"axisAreaMouseUp"),this.offAxisInteractionAreaMouseEnter=t=>this.P.off(t,"axisAreaMouseEnter"),this.offAxisInteractionAreaMouseLeave=t=>this.P.off(t,"axisAreaMouseLeave"),this.offAxisInteractionAreaMouseMove=t=>this.P.off(t,"axisAreaMouseMove"),this.offAxisInteractionAreaMouseWheel=t=>this.P.off(t,"axisAreaMouseWheel"),this.offAxisInteractionAreaMouseDragStart=t=>this.P.off(t,"axisAreaMouseDragStart"),this.offAxisInteractionAreaMouseDrag=t=>this.P.off(t,"axisAreaMouseDrag"),this.offAxisInteractionAreaMouseDragStop=t=>this.P.off(t,"axisAreaMouseDragStop"),this.offAxisInteractionAreaTouchStart=t=>this.P.off(t,"axisAreaTouchStart"),this.offAxisInteractionAreaTouch=t=>this.P.off(t,"axisAreaTouch"),this.offAxisInteractionAreaTouchStop=t=>this.P.off(t,"axisAreaTouchEnd"),this.Zd=(t,e)=>e.getAllocatesAxisSpace()?Math.max(t,e.update().Iu()):t,this.Kd=t=>{const e=this.vd.indexOf(t);-1!==e&&this.vd.splice(e,1)},this.qd=(t,e)=>{this.P.emit("axisAreaDoubleClick",this,e),this.Bd&&(this.setStopped(!1),Xt(e))},this.Jd=t=>{this.P.emit("axisAreaMouseEnter",this),(this.Pd||this.Fd||this.Dd||this.Bd)&&this.Qd(t)},this.tf=t=>{this.if(t),this.P.emit("axisAreaMouseLeave",this)},this.sf=(t,e,i)=>{var s,r;this.P.emit("axisAreaMouseDragStart",this,e,i);const n=kt(null===(s=this.chart.ef.Ih)||void 0===s?void 0:s.axisXYZoomMouseButton,0),o=kt(null===(r=this.chart.ef.Ih)||void 0===r?void 0:r.axisXYPanMouseButton,2),h=u(e.clientX,e.clientY);i===o&&this.Pd?(this.hf(t),Xt(e)):i===n&&this.Fd&&(this.rf(t,h),Xt(e))},this.nf=(t,e,i,s,r)=>{var n,o;this.P.emit("axisAreaMouseDrag",this,e,i,s,r);const h=kt(null===(n=this.chart.ef.Ih)||void 0===n?void 0:n.axisXYZoomMouseButton,0),a=kt(null===(o=this.chart.ef.Ih)||void 0===o?void 0:o.axisXYPanMouseButton,2),l=u(e.clientX,e.clientY);i===a&&this.Pd?(this.af(t,r),Xt(e)):i===h&&this.Fd&&(this.lf(t,s,l,r),Xt(e))},this.uf=(t,e,i,s)=>{var r,n;this.P.emit("axisAreaMouseDragStop",this,e,i,s);const o=kt(null===(r=this.chart.ef.Ih)||void 0===r?void 0:r.axisXYZoomMouseButton,0),h=kt(null===(n=this.chart.ef.Ih)||void 0===n?void 0:n.axisXYPanMouseButton,2),a=u(e.clientX,e.clientY);i===h&&this.Pd?(this.cf(t),Xt(e)):i===o&&this.Fd&&(this.df(t,s,a),Xt(e)),t.getIsUnderMouse()&&(this.Pd||this.Fd||this.Dd||this.Bd)&&this.Qd(t)},this.ff=(t,e)=>{if(this.P.emit("axisAreaMouseWheel",this,e),this.Dd){this.setStopped(!0);const t=this.es.getWidth(this.gf.Li.ke(e.clientX,e.clientY)),i=this.ct.ot(t);this.zoom(i,ce(e)),Xt(e)}},this.pf=(t,e)=>this.P.emit("axisAreaMouseClick",this,e),this.mf=(t,e)=>this.P.emit("axisAreaMouseDown",this,e),this.yf=(t,e)=>this.P.emit("axisAreaMouseUp",this,e),this.Sf=(t,e)=>this.P.emit("axisAreaMouseMove",this,e),this.xf=(t,e,i)=>{this.P.emit("axisAreaTouchStart",this,i),this.Fd&&(this.Qd(t),this.rf(t,e),Xt(i))},this.bf=(t,e,i,s,r)=>{this.P.emit("axisAreaTouch",this,r),this.Fd&&(this.lf(t,e,i,s),Xt(r))},this.vf=(t,e,i,s)=>{this.P.emit("axisAreaTouchEnd",this,s),this.Fd&&(this.df(t,e,i),this.if(t),Xt(s))},this.Mf=(t,e,i,s)=>{(this.Pd||this.Dd)&&(this.Qd(t),this.hf(t),Xt(s))},this._f=(t,e,i,s,r,n)=>{if(this.Pd){const e=u((s.x+r.x)/2,(s.y+r.y)/2);this.af(t,e),Xt(n)}if(this.Dd){const t=this.gf.Li.ke(e.x,e.y),o=this.gf.Li.ke(i.x,i.y),h=Math.abs(this.es.getWidth(Je(t,s))-this.es.getWidth(Je(o,r)))-Math.abs(this.es.getWidth(t)-this.es.getWidth(o)),a=this.ct.Yt(this.ls,-h),l=this.ct.Yt(this.us,h);this.ss(a,l),Xt(n)}},this.Af=(t,e,i,s)=>{(this.Pd||this.Dd)&&(this.cf(t),this.if(t),Xt(s))},this.wf=(t,e)=>{(this.Ld||this.Od)&&this.kf(t)},this.Cf=(t,e)=>{this.Tf(t)},this.If=(t,e,i)=>{const s=u(e.clientX,e.clientY);this.Ld&&this.Ff(t,s)},this.Pf=(t,e,i,s,r)=>{const n=u(e.clientX,e.clientY);this.Ld&&this.Df(t,n,s,r)},this.Bf=(t,e,i,s,r)=>{const n=u(e.clientX,e.clientY);this.Ld&&this.Lf(t,n,s,r)},this.Of=(t,e,i,s)=>{const r=u(e.clientX,e.clientY);(this.Ld||this.Od)&&this.Rf(t,r,s),(this.Ld||this.Od)&&this.kf(t)},this.Ef=(t,e)=>{this.Od&&(this.setStopped(!0),this.zoom(this.ls,ce(e)),Xt(e))},this.zf=(t,e)=>{this.Od&&(this.setStopped(!0),this.zoom(this.us,ce(e)),Xt(e))},this.Vf=(t,e,i)=>{this.Ld&&(this.kf(t),this.Ff(t,e),Xt(i))},this.Nf=(t,e,i,s,r)=>{this.Ld&&(this.Df(t,e,i,s),Xt(r))},this.Gf=(t,e,i,s,r)=>{this.Ld&&(this.Lf(t,e,i,s),Xt(r))},this.Hf=(t,e,i,s)=>{this.Ld&&(this.Rf(t,e,i),this.Tf(t),Xt(s))},this.md=t,this.Wf=i,this.gf=s,this.Uf=o,this.$f=h,this.chart=f,this.Yf=m,this.Xf=n,this.ic=a,p(this,this.Xd),l.jf=this,this.Zf=g,this.Kf=this.Zf>50?1:-1,this.qf=(v=this.es.toPoint(0,-this.Kf),Math.abs(v.x)>=Math.abs(v.y)?v.x>=0?e.UIDirections.Right:e.UIDirections.Left:v.y>=0?e.UIDirections.Up:e.UIDirections.Down),this.Jf=c,this.Qf=this.ct instanceof Ai?(new Ti).ui(this.es.toVec2(this.ct,this.Jf)):(new Ei).ui(this.es.toVec2(this.ct,this.Jf)),this.tg=this.chart.pixelScale,this.ig=(new Ti).ui(this.es.toVec2(this.es.getWidth(this.tg),this.Jf)),this.sg=this.gf._u(this.Qf).setMouseInteractions(!1),this.eg=this.gf._u(this.Qf).setMouseInteractions(!1),this.hg=this.gf._u(this.Qf).setMouseInteractions(!1),this.rg=this.Xf.gc(this.tg).ps(d.getWidth({x:y.xAxisOverlayStyle,y:y.yAxisOverlayStyle})).$h(J).Pr(y.highlightColorOffsetAxisOverlay||y.highlightColorOffset),this.ng=this.Xf.gc(this.tg).ps(d.getWidth({x:y.xAxisZoomingBandFillStyle,y:y.yAxisZoomingBandFillStyle})).$h(d.getWidth({x:y.xAxisZoomingBandStrokeStyle,y:y.yAxisZoomingBandStrokeStyle})),this.og=this.Xf.gc(this.tg).ps(d.getWidth({x:y.xAxisOverlayStyle,y:y.yAxisOverlayStyle})).$h(J).Pr(y.highlightColorOffsetAxisOverlay||y.highlightColorOffset),this.ag=this.Xf.gc(this.tg).ps(d.getWidth({x:y.xAxisOverlayStyle,y:y.yAxisOverlayStyle})).$h(J).Pr(y.highlightColorOffsetAxisOverlay||y.highlightColorOffset),this.ds=this.Xf.ue(this.Qf).setMouseInteractions(!1).xs(this.es.getTitleTextRotation(this.Kf)),this.chart.Li.Vh.Se(this.rg,(t=>this.rg.Ir(t)),{animationEnabled:this.Oi}),this.chart.Li.Vh.Se(this.og,(t=>this.og.Ir(t)),{animationEnabled:this.Oi}),this.chart.Li.Vh.Se(this.ag,(t=>this.ag.Ir(t)),{animationEnabled:this.Oi});const b=Fr(new Or(this.xf,this.bf,this.vf,1),new zr(this.Mf,this._f,this.Af),new _r(this.qd)),M=Fr(new Or(this.Vf,this.Nf,this.Hf)),A=Fr(new Or(this.Vf,this.Gf,this.Hf));this.rg.setMouseEnterEventHandler(this.Jd).setMouseLeaveEventHandler(this.tf).setMouseDragStartEventHandler(this.sf).setMouseDragEventHandler(this.nf).setMouseDragStopEventHandler(this.uf).setMouseWheelEventHandler(this.ff).setMouseDoubleClickEventHandler(this.qd).setMouseClickEventHandler(this.pf).setMouseDownEventHandler(this.mf).setMouseUpEventHandler(this.yf).setMouseMoveEventHandler(this.Sf).setTouchStartEventHandler(b.onTouchStart).setTouchMoveEventHandler(b.onTouchMove).setTouchEndEventHandler(b.onTouchEnd),this.og.setMouseEnterEventHandler(this.wf).setMouseLeaveEventHandler(this.Cf).setMouseDragStartEventHandler(this.If).setMouseDragEventHandler(this.Pf).setMouseDragStopEventHandler(this.Of).setMouseWheelEventHandler(this.Ef).setTouchStartEventHandler(M.onTouchStart).setTouchMoveEventHandler(M.onTouchMove).setTouchEndEventHandler(M.onTouchEnd),this.ag.setMouseEnterEventHandler(this.wf).setMouseLeaveEventHandler(this.Cf).setMouseDragStartEventHandler(this.If).setMouseDragEventHandler(this.Bf).setMouseDragStopEventHandler(this.Of).setMouseWheelEventHandler(this.zf).setTouchStartEventHandler(A.onTouchStart).setTouchMoveEventHandler(A.onTouchMove).setTouchEndEventHandler(A.onTouchEnd),this.sg.ea(d.getWidth({x:y.xAxisStrokeStyle,y:y.yAxisStrokeStyle})),this.eg.ea(d.getWidth({x:y.xAxisNibStyle,y:y.yAxisNibStyle})),this.hg.ea(d.getWidth({x:y.xAxisNibStyle,y:y.yAxisNibStyle})),this.ds.ps(d.getWidth({x:y.xAxisTitleFillStyle,y:y.yAxisTitleFillStyle})).Ss(d.getWidth({x:y.xAxisTitleFont,y:y.yAxisTitleFont})),this.iu=a.su(this,{}),this.Ms=this.iu.lg([this.ds]).vs(y.effectsText)}ae(){return this.Vi}le(){return void 0!==this.Fs}addBand(t=!0){const e=t?this.$f:this.Uf,i=new Jr(e,this.chart,this.jd,this,this.Qf,this.es,this.hs,this.ic);return this.$d.push(i),i}addConstantLine(t=!0){const e=t?this.$f:this.Uf,i=new Qr(e,this.chart,this.jd,this,this.Qf,this.es,this.hs,this.ic);return this.$d.push(i),i}ug(t){this.$d.forEach(t)}cg(t){return this.$d.map(t)}getHighlighters(){return this.$d}setThickness(t){return"number"==typeof t?(this.dg=t,this.gg=t):"object"==typeof t&&(this.dg=t.min,this.gg=t.max),this.md.Bi(),this}getThickness(){return{min:this.dg,max:this.gg}}setMouseInteractions(t){return this.setAxisInteractionPanByDragging(t).setAxisInteractionReleaseByDoubleClicking(t).setAxisInteractionZoomByDragging(t).setAxisInteractionZoomByWheeling(t).setNibInteractionScaleByDragging(t).setNibInteractionScaleByWheeling(t)}Js(){return this.Md}$s(t,e){return new io(e,t,this.gf,this.Qf,this.md,this.Qf)}As(){if(this.Sd){for(const t of this.Sd)t[1].grid.dispose(),t[1].tick.dispose();this.Sd.clear()}super.As()}Ys(t,e){const{tickStart:i}=e,s=t.qi.Ws,r=i+s.getTickLength()*this.Kf+s.getTickPadding()*this.Kf;t._i.Sn(this.es.toPoint(t.u,r)).kn(this.es.toPoint(s.getLabelAlignment(),-this.Kf)).xs(s.labelRotation).setVisible(this.getVisible())}pg(t,e){const{startPosition:i,gridStrokeLen:s,gridStrokeStart:r,tickStart:n}=e,o=t.qi.Ws,h=i-s*o.getGridStrokeLength(),a=n+o.getTickLength()*this.Kf;return{gridStroke:{start:this.es.toPoint(t.u,r),end:this.es.toPoint(t.u,h)},tickStroke:{start:this.es.toPoint(t.u,n),end:this.es.toPoint(t.u,a)}}}mg(t,e,i,s){return this.md._u(this.Qf).ea(new tt({fillStyle:new z({color:D(360*(1-s))}),thickness:5})).la(this.es.toVec2(t,0)).Ko(this.es.toVec2(t,this.Kf*(50*s)))}re(t,e){return"linear"===this.ns.type?so(t,e,this.ct):ro(t,e,this.ct)}yg(t,e){return e instanceof Ai?so:ro}oe(t,e,i){if("linear"===this.ns.type){const s=this.ct.li(e-t);return{min:t-i*s,max:e+i*s}}const s=this.ct;return{min:s.Yt(t,-i),max:s.Yt(e,i)}}ru(t,e,i){const s=this.sg.ha(),r=this.ct.getInnerStart()this.ct.getInnerStart()?this.ct.getInnerEnd():this.ct.getInnerStart(),o=this.ct.Ot(),h=this.Jf.getInnerInterval(),a=s instanceof tt?s.getThickness()*this.Kf/2:0,l=this.Zf/100*h,u=l+t,c=u+a,d=h*this.Kf,f=c+a,g=this.vd.reduce(this.Zd,0);let m,p=0;if(this.ki!==Pi){const t=this.ct.Ot();this.Bs({physicalAxisSize:t,startPosition:l,gridStrokeLen:d,gridStrokeStart:u,tickStart:f});for(const[e,i]of this.Ti){let s=this.Sd.get(e);if(!s)if(e.xi)s={grid:this.md.Sg(this.Qf).setMouseInteractions(!1),tick:this.md.Sg(this.Qf).setMouseInteractions(!1)};else if("xg"in e){const t=Array.from(this.Ti.keys()).filter((t=>"xg"in t)).reverse().indexOf(e),i=this.Wf[t];if(!i)throw new Error("Not enough tick layers. This is an internal LCJS error - if you see this, please contact Arction support.");s={grid:i.Sg(this.Qf).setMouseInteractions(!1),tick:i.Sg(this.Qf).setMouseInteractions(!1)}}if(s){s.grid.qn(),s.tick.qn();for(const[e,r]of i){const e=this.pg(r,{physicalAxisSize:t,startPosition:l,gridStrokeLen:d,gridStrokeStart:u,tickStart:f});s.grid.Kn(e.gridStroke.start,e.gridStroke.end),s.tick.Kn(e.tickStroke.start,e.tickStroke.end)}s.grid.ea(e.Ws.getGridStrokeStyle()),s.tick.ea(e.Ws.getTickStyle()),this.Sd.set(e,s)}}for(const t of this.Ti.values()){let e=Ae;for(const i of t.values()){const t=i.qi.Ws,s=this.es.getHeight(i._i.Et()),r=t.getTickLength()+t.getTickPadding()+s+t.getLabelPadding();e=Math.max(e,r)}p=Math.max(p,e)}m=f+Math.max(p,g)*this.Kf}else p=0,m=f+g*this.Kf;this.sg.la(this.es.toPoint(r,c)).Ko(this.es.toPoint(n,c)),this.eg.la(this.es.toPoint(this.ct.Yt(this.ct.getInnerStart(),this.wd),c)).Ko(this.es.toPoint(this.ct.getInnerStart(),c)),this.hg.la(this.es.toPoint(this.ct.Yt(this.ct.getInnerEnd(),-this.wd),c)).Ko(this.es.toPoint(this.ct.getInnerEnd(),c));const y=this.ds&&this.ds.cs().length>0?this.es.getHeight(this.ds.Gs().Et()):0,x=m+.5*y*this.Kf;this.ds.Sn(this.es.toPoint(this.ct.Yt(this.ct.getInnerStart(),o/2),x));const S=f,v=S+this.Kf*this.bd,b=this.Ld||this.Od?Math.min(this.Td,.25*o):0,M={start:this.es.toVec2(this.ct.Yt(this.ct.getInnerStart(),b),S),end:this.es.toVec2(this.ct.Yt(this.ct.getInnerEnd(),-b),v)};if(this.xd){const e=this.Zf/100*h+t,i=-this.Kf*h-t,s={start:this.es.toVec2(this.xd.min,f+this.Kf*this.bd),end:this.es.toVec2(this.xd.max,e+i)},r=nt(s.start,this.Qf,this.tg),n=nt(s.end,this.Qf,this.tg);this.ng.Sn(r).q(Je(n,r)).setVisible(!0)}else this.ng.setVisible(!1);const A=nt(this.es.toVec2(this.ct.getInnerStart(),v),this.Qf,this.tg),w=nt(M.start,this.Qf,this.tg),D=nt(M.end,this.Qf,this.tg),T=nt(this.es.toVec2(this.ct.getInnerEnd(),S),this.Qf,this.tg);this.rg.Sn(w).q(Je(D,w)),this.og.Sn(A).q(Je(w,A)),this.ag.Sn(D).q(Je(T,D));for(const e of this.vd)e.update().plot(u,d,t,f);for(const t of this.$d)t.ru();const E=(s instanceof tt?s.getThickness():0)+Math.max(p,g)+(this.ds&&this.ds.cs().length>0?y+this.Ad:0);return this.bd=At(E,void 0!==this.dg?this.dg:0,void 0!==this.gg?this.gg:Me),this}bg(t){const e=this.sg.ha(),i=e instanceof tt?e.getThickness()*this.Kf/2:0,s=this.Jf.getInnerInterval(),r=this.Zf/100*s+t,n=r+i,o=s*this.Kf,h=n+i;for(const e of this.vd)e.update().plot(r,o,t,h);for(const t of this.$d)t.ru()}vg(){return this.bd}Mg(t,e){e=e||to.AxisTickMajor;const i=new $r(this,t?this.md:this.Xf,this.Xf,this.ct,this.ig,this.ig,this.es,this.qf,this.Kd,this.hs,e).setTextFormatter(this.formatValue);return this.vd.push(i),i}Qd(t){this.chart.Li.Vh.xe(t,1),this.kd=t.Li.Ae(this.Nd,this.kd)}if(t){this.chart.Li.Vh.xe(t,0),t.Li.we(this.kd)}hf(t){this.setStopped(!0),t.Li.we(this.kd)}af(t,e){const i=-this.es.getWidth(e);this.pan(i),this.kd=t.Li.Ae(this.Gd,this.kd)}pan(t){const e=this.ls,i=this.us,s=this.ct.Yt(e,t),r=this.ct.Yt(i,t);this.ss(s,r,{allowClamping:!1})}zoom(t,e){const i=this.ct.ut(this.ls),s=this.ct.ut(this.us),r=this.ct.ut(t),n=At((r-i)/(s-i),0,1),o=.2*this.ct.Ot(),h=n*this.Id*o*-e,a=(1-n)*this.Id*o*e,l=this.ct.Yt(this.ls,h),u=this.ct.Yt(this.us,a);this.ss(l,u)}cf(t){this.xd=void 0,t.Li.we(this.kd)}rf(t,e){this.setStopped(!0),t.Li.we(this.kd),this.chart.Li.Vh.xe(this.rg,0)}lf(t,e,i,s){const r=nt(this.gf.Li.ke(i.x,i.y),this.gf.Li.ct,this.Qf),n=At(this.es.getWidth(r),this.ls,this.us),o=this.es.getWidth(nt(this.gf.Li.ke(e.x,e.y),this.gf.Li.ct,this.Qf)),h=Pe(this.es.getHeight(r),this.es.getHeight(nt(this.rg.xn(),this.tg,this.Qf)),this.es.getHeight(nt(Ke(this.rg.xn(),this.rg.Et()),this.tg,this.Qf)));Math.abs(this.ct.ut(n)-this.ct.ut(o))>10&&h?(this.xd=m(Math.min(n,o),Math.max(n,o)),this.kd=t.Li.Ae(this.Hd,this.kd)):(this.xd=void 0,this.kd=t.Li.Ae(this.Nd,this.kd)),this.gf.Bi()}df(t,e,i){if(this.xd){const t=this.xd.min,e=this.xd.max,i=this.us{e.Us(t)}));for(const e of this.Sd.values())e.grid.setVisible(t),e.tick.setVisible(t);return super.setVisible(t),this.md.Bi(),this}setAnimationsEnabled(t){return super.setAnimationsEnabled(t),this.setAnimationHighlight(this.Oi),this}}const oo=(t,e)=>t instanceof gi||e instanceof gi?(new Ei).ui(t,e):(new Ti).ui(t,e),ho=(t,e,i="image/png",s)=>{e+=`.${i.slice(i.indexOf("image/")+6)}`;const r=t.captureFrame(i,s);if("image/png"!==i&&r.type.includes("image/png"))throw new Error(`saveToFile | type not supported by browser: ${i}\nCheck support table for HTMLCanvasElement.toDataURL`);if(gt.navigator.msSaveBlob)gt.navigator.msSaveBlob(r,e);else{const t=gt.document.createElement("a");gt.document.body.appendChild(t);const i=gt.URL.createObjectURL(r);t.href=i,t.download=e,t.click(),setTimeout((()=>{gt.URL.revokeObjectURL(i),gt.document.body.removeChild(t)}),0)}},ao=(t,i,s,r,n,o)=>{const h=t.wu(i,s,r,n,o,!0);return h.setDraggingMode(e.UIDraggingModes.draggable),h},lo=t=>{if(t instanceof Di)return t;const e=t.x instanceof no?t.x.ct:t.x.x,i=t.y instanceof no?t.y.ct:t.y.y;return oo(e,i)};class uo{constructor(t,e,i,s,n,o,h,a){this._g=[],this.Ag=[],this.P=new r.Eventer,this.wg=void 0,this.kg=void 0,this.Cg=void 0,this._t=x(0,0,0,0),this.ce=!1,this.Tg=()=>{this.Ig=!0,this.Fg.Bi()},this.Pg=t=>e=>{const i=this._g.indexOf(e);-1!==i&&this._g.splice(i,1),this.Li.Bi(),t.G()},this.Dg=t=>{const e=this.Ag.indexOf(t);-1!==e&&this.Ag.splice(e,1),this.Li.Bi()},this.Ig=!0,this.onResize=t=>this.P.on("resize",t),this.offResize=t=>this.P.off(t,"resize"),this.ef=t,this.Bg=i,this.Fg=s,this.removePanel=n,this.hs=e.Li.hs;const l=e.Li.Et();this.uiScale=i.d2({scaleXYConstructor:Ti}).fi(0,100).gi(0,100).q(l),this.pixelScale=i.d2({scaleXYConstructor:Ti}).fi(0,this.uiScale.x.getCellSize()).gi(0,this.uiScale.y.getCellSize()).q(l),this.engine=e.Li.Lg,this.Li=e.Li.Og,this.iu=this.Li.iu.su(this,{}),this.Rg=()=>e.Eg("unidentified ui"),this.zg=e.Vg(),this.Ng=this.Fg.gc(this.uiScale).Sn(u(0,0)).q(u(100,100)).ps(o).$h(h).setMouseMoveEventHandler(((t,e)=>this.P.emit("mouseMovePanelBackground",this,e))).setMouseEnterEventHandler(((t,e)=>this.P.emit("mouseEnterPanelBackground",this,e))).setMouseLeaveEventHandler(((t,e)=>this.P.emit("mouseLeavePanelBackground",this,e))).setMouseDownEventHandler(((t,e)=>this.P.emit("mouseDownPanelBackground",this,e))).setMouseUpEventHandler(((t,e)=>this.P.emit("mouseUpPanelBackground",this,e))).setMouseClickEventHandler(((t,e)=>this.P.emit("mouseClickPanelBackground",this,e))).setMouseDoubleClickEventHandler(((t,e)=>this.P.emit("mouseDoubleClickPanelBackground",this,e))).setMouseWheelEventHandler(((t,e)=>this.P.emit("mouseWheelPanelBackground",this,e))).setMouseDragStartEventHandler(((t,e,i)=>this.P.emit("mouseDragStartPanelBackground",this,e,i))).setMouseDragEventHandler(((t,e,i,s,r)=>this.P.emit("mouseDragPanelBackground",this,e,i,s,r))).setMouseDragStopEventHandler(((t,e,i,s)=>this.P.emit("mouseDragStopPanelBackground",this,e,i,s))).setTouchStartEventHandler(((t,e)=>this.P.emit("touchStartPanelBackground",this,e))).setTouchMoveEventHandler(((t,e)=>this.P.emit("touchMovePanelBackground",this,e))).setTouchEndEventHandler(((t,e)=>this.P.emit("touchEndPanelBackground",this,e)));const c=e.Li.cr(this.Tg);if(this.Gg=e.Li.dr.bind(e.Li,c),a){const t=a.on(this.Tg);this.Hg=()=>a.off(t)}this.wg=n}getTheme(){return this.hs}setBackgroundFillStyle(t){return this.Ng.ps(t),this.Fg.Bi(),this}getBackgroundFillStyle(){return this.Ng.gs()}setBackgroundStrokeStyle(t){return this.Ng.$h(t),this.Fg.Bi(),this}getBackgroundStrokeStyle(){return this.Ng.Yh()}Wg(t){return this._g.push(t),this.Li.Bi(),t}Ug(t){return this.Ag.push(t),this.Li.Bi(),t}addUIElement(t=Rn,e=this.uiScale){e=lo(e);const i=this.Rg();return this.Wg(ao(t,i,this.uiScale,e,this.Pg(i),this.hs))}addLegendBox(t=qn,i=this.uiScale){i=lo(i);const s=this.Ug(ao(t,this.zg,this.uiScale,i,this.Dg,this.hs));return s.setDraggingMode(e.UIDraggingModes.notDraggable),void 0!==i&&i!==this.uiScale||(void 0===t||"vertical"===t.getAlignment()?s.setOrigin(wr.RightCenter).setPosition({x:100,y:50}):s.setOrigin(wr.CenterBottom).setPosition(this.uiScale.Yt({x:50,y:0},{x:0,y:3}))),s}dispose(){return this.ce||(this.ce=!0,this.Gg&&this.Gg(),this.Hg&&this.Hg(),co(this.uiScale),co(this.pixelScale),this.kg&&this.kg(),this.Fg.G(),this.zg.G(),this._g.slice().forEach((t=>{t.dispose()})),this.Ag.slice().forEach((t=>{t.dispose()})),this.Li.Bi(),this.wg&&this.wg(this),this.P.emit("dispose",this)),this}onDispose(t){return this.P.on("dispose",t)}offDispose(t){return this.P.off(t,"dispose")}saveToFile(t,e,i){return ho(this.engine,t,e,i),this}Cn(t){this._t=t,this.Tg()}X(){return this.pixelScale.X(),this.uiScale.X(),this}j(){return this.pixelScale.j(),this.uiScale.j(),this}ru(){if(this.Ig){const t=this.Fg.Li.Et(),e=t.x,i=t.y;this.uiScale.q(e,i),this.pixelScale.q(e,i);const s=[this._t.left,this._t.right],r=[this._t.bottom,this._t.top];this.uiScale.ci(s),this.uiScale.di(r);const n=this.uiScale.getInnerIntervalPixels();this.pixelScale.fi(0,n.x).ci(s).gi(0,n.y).di(r),this.P.emit("resize",this,n.x,n.y,e,i)}this.Ig=!1}$g(){for(let t=0;t{t.Pt&&t.Pt()};class fo extends uo{constructor(t,e,i,s,r,n){super(t,e,i,e.Xg("uipanel bg",0),s,e.Li.hs.uiPanelBackgroundFillStyle,e.Li.hs.uiPanelBackgroundStrokeStyle,n),this.Yg(r,this.pixelScale)}setMinimumSize(t){return this.zc=t,this.Li.Bi(),this}getMinimumSize(){return this.zc}ru(){super.ru(),super.$g()}}const go=x(10,10,10,10);class mo extends uo{constructor(t,e,i,s,r,n,o,h,a,l,c){super(t,e,i,s,n,o,h,c),this.jg={},this.rn=go,this.Oi=!0,this.Zg=r,this.Kg=this.Zg.ue(this.uiScale).fs("Chart").Sn(u(50,100)).kn(u(0,1)).Ss(a).ps(l).setMouseInteractions(!1),this.qg=this.iu.lg([this.Kg]).vs(this.hs.effectsText)}setAnimationsEnabled(t){return this.Oi=t,this}getAnimationsEnabled(){return this.Oi}setTitle(t){return this.Kg.fs(t),this.Li.Bi(),this}getTitle(){return this.Kg.cs()}getTitleSize(){return this.Kg.Gs().Ac()}setTitleFillStyle(t){return this.Kg.ps(t),this.Tg(),this}getTitleFillStyle(){return this.Kg.gs()}setTitleFont(t){return this.Kg.Ss(t),this.Tg(),this}getTitleFont(){return this.Kg.ys()}setTitleRotation(t){return this.Kg.xs(t),this.Li.Bi(),this}getTitleRotation(){return this.Kg.bs()}setTitleEffect(t){return this.qg.vs(t),this.Li.Bi(),this}getTitleEffect(){return this.qg._s()}setTitleMargin(t){var e,i;return this.jg="object"==typeof t?this.jg?(e=this.jg,{left:void 0!==(i=t).left?i.left:e.left,top:void 0!==i.top?i.top:e.top,right:void 0!==i.right?i.right:e.right,bottom:void 0!==i.bottom?i.bottom:e.bottom}):t:{left:t,top:t,right:t,bottom:t},this.Tg(),this}getTitleMargin(){return this.jg}setPadding(t){return this.rn="object"==typeof t?v(this.rn,t):{left:t,top:t,right:t,bottom:t},this.Tg(),this}getPadding(){return this.rn}Jg(t){const e=t.Qg(),i=null==e?void 0:e.height,s=null==e?void 0:e.width;if(void 0!==i&&void 0!==s)return{x:i/2,y:s/2}}dispose(){return super.dispose(),this.Zg.G(),this}}const po={tp:(t,e)=>t.gs()!==F&&0!==t.cs().length&&t.getVisible()?t.Gs().Ac().y+(void 0!==e.top?e.top:10)+(void 0!==e.bottom?e.bottom:0):0,ip(t,e){t.Sn(u(50,100)).Cn({top:void 0!==e.top?e.top:10,right:e.right||0,left:e.left||0,bottom:e.bottom||0})}};var yo;e.SliceLabelIndices=void 0,(yo=e.SliceLabelIndices||(e.SliceLabelIndices={}))[yo.LabelsInsideSlices=0]="LabelsInsideSlices",yo[yo.LabelsOnSides=1]="LabelsOnSides";const xo={SortByName:(t,e)=>t.getName().localeCompare(e.getName(),void 0,{numeric:!0}),SortByValueAscending:(t,e)=>t.getAnimatedValue()-e.getAnimatedValue(),SortByValueDescending:(t,e)=>e.getAnimatedValue()-t.getAnimatedValue(),None:()=>0},So={Name:t=>`${t.getName()}`,NamePlusValue:t=>`${t.getName()}: ${Math.round(t.getAnimatedValue())}`,NamePlusRelativeValue:(t,e)=>`${t.getName()}: ${(100*e).toFixed(2)}%`};class vo extends Zr{constructor(){super(...arguments),this.ac="Slice",this.u=0}}const bo=(t,e)=>{Xt(e),t.setExploded(!t.getExploded())};class Mo extends vo{}class Ao extends Mo{constructor(t,e,i,s,r,n,o,h){super(s,n,o,h),this.sp=!1,this.ep=F,this.hp=F,this.rp=this.u,this.np=this.sp?1:0,this.op=this.getVisible(),this.ap=W((()=>this.qa.Li.Bi())),this.lp=W((()=>this.qa.Li.Bi())),this.up=()=>{this.cp=void 0},this.dp=()=>{this.fp=void 0},this.index=t,this.qa=s,this.scale=r,this.tc=n,this.gp=e.kc(r).Ir(this.getHighlight()),this.rc(this.gp),this._i=i.ue(r).Ir(this.getHighlight()),this.rc(this._i,{isText:!0}),this.onMouseClick(bo),this.onTouchEnd(bo)}setValue(t){return this.qa.getAnimationsEnabled()?this.op&&this.pp(this.rp,t):this.rp=t,this.u=t,this.qa.Li.Bi(),this}getValue(){return this.u}setExploded(t){if(t&&!1===this.qa.getMultipleSliceExplosion()){const t=this.qa.getSlices();for(let e=0;e{this.np=t,this.qa.Li.Bi()})),this.fp.onEveryAnimationEnd(this.dp),this.sp=!this.sp):!1!==this.qa.getMultipleSliceExplosion()||t?(this.np=this.sp?0:1,this.sp=!this.sp):(this.np=0,this.sp=!this.sp),this.qa.Li.Bi(),this}getExploded(){return this.sp}setVisible(t){return this.op=t,!1===t?this.qa.getAnimationsEnabled()&&this.rp>0?(this.cp&&(this.cp.finish(!1),this.cp=void 0),this.pp(this.rp,0,(()=>super.setVisible(!1)))):(this.rp=0,super.setVisible(!1)):this.qa.getAnimationsEnabled()?(this.cp&&(this.cp.finish(!1),this.cp=void 0),super.setVisible(!0),this.pp(this.rp,this.u)):(this.rp=this.u,super.setVisible(!0)),this}pp(t,e,i){this.cp=this.ap(300,U.ease)([[t,e]],(([t])=>{this.rp=t,this.qa.Li.Bi()})),this.cp.onEveryAnimationEnd(this.up),i&&this.cp.onAnimationEnd(i)}setStyle(t,e,i,s){this.ep=t,this.hp=i,this.gp.ps(this.ep).$h(e),this._i.ps(this.hp).Ss(s);for(let t=0;tKe(e,Ze(ai(.5*(t.Wo()+t.ei())*Math.PI/180),i)),Do=(t,e,i,s,r,n)=>{const o=t.length;let h=90;for(let a=0;a{const e=t.getSlices();for(let t=0;t{const e=this.mp.indexOf(t);e>=0&&(this.mp.splice(e,1),this.Ip())},this.ef.Ah||this.ef._h||this.Li.bh(7),this.Fp=e.Pp("pieChart bottom",0),this.Dp=e.Pp("pieChart top",1),this.Kg.fs("Pie Chart"),this.Yg(r,this.pixelScale),this.onBackgroundMouseDoubleClick(To);const h=Fr(new _r(To));this.onBackgroundTouchStart(h.onTouchStart),this.onBackgroundTouchMove(h.onTouchMove),this.onBackgroundTouchEnd(h.onTouchEnd),o&&this.setAnimationsEnabled(!1)}addSlice(t,e){const i=new Ao(this._p,this.Fp,this.Dp,this,this.pixelScale,this.Tp,this.hs,this.Li.iu);this._p+=1,i.setName(t);const s=this.Oi;return this.Oi=!1,i.setValue(e),this.Oi=s,i.setEffect(this.kp),this.Bp(i),this.mp.push(i),this.Ip(),i.setHighlightOnHover(this.bp),i}addSlices(t){const e=[];for(let i=0;ie.iu.hc.vs(t))),this.Li.Bi(),this}getSliceEffect(){return this.kp}setSliceSorter(t){return this.yp=t,this.mp=this.mp.sort(this.yp),this.Li.Bi(),this}getSliceSorter(){return this.yp}setLabelFillStyle(t){this.Mp="function"==typeof t?t(this.Mp):t;for(let t=0;te.iu.sc.vs(t))),this.Li.Bi(),this}getLabelEffect(){return this.Cp}setLabelFormatter(t){return this.Lp=t,this.Li.Bi(),this}getLabelFormatter(){return this.Lp}setSliceHighlightOnHover(t){return this.bp=t,this.mp.forEach((e=>e.setHighlightOnHover(t))),this}ru(){super.ru(),po.ip(this.Kg,this.jg),super.$g();const t=po.tp(this.Kg,this.jg),e=u(this.pixelScale.x.getInnerInterval()-(this.rn.left+this.rn.right),this.pixelScale.y.getInnerInterval()-(this.rn.bottom+this.rn.top+t)),i=u(this.rn.left+e.x/2,this.rn.bottom+e.y/2);if(this.sd){const t=this.sd;this.mp.forEach((e=>{this.Bp(e,new z({color:t.getColors(e.getAnimatedValue())}))}))}for(let t=0;t0;this.mp[t].gp.setVisible(e),this.mp[t]._i.setVisible(e)}this.mp=this.mp.sort(this.yp);const s=this.mp.filter((t=>t.getAnimatedValue()>0));let r=0;for(let t=0;t0?o/r:0);var o;for(let t=0;tt.dispose())),this}}const Bo={UserSeries:{type:"ApplicationType",args:{type:"UserSeries"}},InternalUI:{type:"ApplicationType",args:{type:"InternalUI"}}},ko=(...t)=>{const e=[];return t.forEach((t=>{var i;t&&"object"==typeof(i=t)&&i&&"pattern"in i&&e.push({type:"DataPattern",args:t})})),e};var Io;!function(t){t[t.TopRight=0]="TopRight",t[t.TopLeft=1]="TopLeft",t[t.BottomLeft=2]="BottomLeft",t[t.BottomRight=3]="BottomRight"}(Io||(Io={}));const Co=(t,e,i,s,r,n,o,h,a)=>{if(0===t.length)return;const l=s.x+e*r.x*.5,c=1===i?Math.max:Math.min;let d;for(let r=0;r{const o=r*t.getAnimatedExplosion(),h=t.gp,a=t._i,l=wo(h,i,s+n+o),c=ri(a.xn().y,l,i);return[l,c,u(a.xn().x-e*(n+a.Et().x),c.y)]},Lo=(...t)=>e=>{const i=(t=>{let e=.5*(t.gp.Wo()+t.gp.ei());for(e%=360;e<0;)e+=360;return e<=90?Io.TopRight:e<180?Io.TopLeft:e<270?Io.BottomLeft:Io.BottomRight})(e);return t.includes(i)},Ro=Lo(Io.BottomLeft,Io.TopLeft),Fo=Lo(Io.BottomRight,Io.TopRight),_o=Lo(Io.TopLeft,Io.TopRight),Oo=Lo(Io.BottomLeft,Io.BottomRight);class zo extends Eo{constructor(t,e,i,s,r,n,o){super(t,e,i,s,r,n,o),this.Lp=So.NamePlusValue,this.Rp=5,this.Ep=5,this.zp=[],this.Vp=this.hs.pieChartConnectorStrokeStyle,this.setPadding({bottom:50})}setLabelConnectorStyle(t){this.Vp=t;for(let t=0;tt.getXMin(),ie:t=>t.getXMax(),ee:t=>t.Wp().x,$p:t=>t.x,Yp:(t,e)=>({x:t.x,y:e.y,z:e.z}),gd:f(0,-1,0),Xp:t=>{const e={x:t.x>=0?1:-1,y:t.y>=0?1:-1,z:t.z>=0?1:-1};return{gridlinePositionA:f(0,e.y,e.z),gridlinePositionB:f(0,e.y,-e.z),gridlinePositionC:f(0,-e.y,-e.z)}}},Uo={te:t=>t.getYMin(),ie:t=>t.getYMax(),ee:t=>t.Wp().y,$p:t=>t.y,Yp:(t,e)=>({x:e.x,y:t.y,z:e.z}),gd:f(-1,0,0),Xp:t=>{const e={x:t.x>=0?1:-1,y:t.y>=0?1:-1,z:t.z>=0?1:-1};return{gridlinePositionA:f(e.x,0,e.z),gridlinePositionB:f(e.x,0,-e.z),gridlinePositionC:f(-e.x,0,-e.z)}}},Ho={te:t=>t.getZMin(),ie:t=>t.getZMax(),ee:t=>t.Wp().z,$p:t=>t.z,Yp:(t,e)=>({x:e.x,y:e.y,z:t.z}),gd:f(1,0,0),Xp:t=>{const e={x:t.x>=0?1:-1,y:t.y>=0?1:-1,z:t.z>=0?1:-1};return{gridlinePositionA:f(e.x,-e.y,0),gridlinePositionB:f(e.x,e.y,0),gridlinePositionC:f(-e.x,e.y,0)}}},Wo=t=>{if(t instanceof tt){const e=t.getThickness(),i=t.getFillStyle();if(i instanceof z)return 1===e?Xi:new ji({size:e,fillStyle:i,shape:"sphere"})}return Xi};class Yo extends Ni{constructor(t,e,i,s,r,n,o,h,a){super(t,e,i,s,h,{numeric:e.$p({x:t.Li.hs.xAxis3DNumericTicks,y:t.Li.hs.yAxis3DNumericTicks,z:t.Li.hs.zAxis3DNumericTicks}),datetime:e.$p({x:t.Li.hs.xAxis3DDateTimeTicks,y:t.Li.hs.yAxis3DDateTimeTicks,z:t.Li.hs.zAxis3DDateTimeTicks}),time:e.$p({x:t.Li.hs.xAxis3DTimeTicks,y:t.Li.hs.yAxis3DTimeTicks,z:t.Li.hs.zAxis3DTimeTicks})},{type:"linear"}),this.Sd=new Map,this.jp=()=>{},this.Zp=()=>{},this.Kp=()=>{},this.qp=()=>{},this.Jp=r,this.Qp=n,this.tm=o,this.im=this.Jp.ct;const l=this.es.$p({x:this.hs.xAxis3DStrokeStyle,y:this.hs.yAxis3DStrokeStyle,z:this.hs.zAxis3DStrokeStyle});this.sm=this.Jp.Gp([Bo.InternalUI]).ea(l).hm(Wo(l)).setMouseInteractions(!1),this.ds=this.Qp.ue(this.tm).setMouseInteractions(!1).ps(e.$p({x:t.Li.hs.xAxis3DTitleFillStyle,y:t.Li.hs.yAxis3DTitleFillStyle,z:t.Li.hs.zAxis3DTitleFillStyle})).Ss(e.$p({x:t.Li.hs.xAxis3DTitleFont,y:t.Li.hs.yAxis3DTitleFont,z:t.Li.hs.zAxis3DTitleFont})),this.iu=a,this.Ms=this.iu.lg([this.ds]).vs(s.effectsText),this.sm.setMouseEnterEventHandler(this.jp).setMouseLeaveEventHandler(this.Zp).setMouseDragEventHandler(this.Kp).setMouseDragStopEventHandler(this.qp),i.jf=this}setStrokeStyle(t){return this.sm.ea(t).hm(Wo(this.sm.ha())),this.chart.Li.Bi(),this}getStrokeStyle(){return this.sm.ha()}setMouseInteractions(t){return this}setVisible(t){this.sm.setVisible(t);for(const e of this.Sd.values())e.grid.setVisible(t),e.tick.setVisible(t);return super.setVisible(t),this.Qp.Bi(),this}Js(){return this.chart.getSeries()}rm(t){return Math.abs(this.ct.J(t)*this.Jp.nm(1))}oe(t,e,i){const s=Math.abs(this.ct.J(e-t)*this.Jp.nm(1));return{min:t-i*s,max:e+i*s}}$s(t,e){return new qo(e,t,this.Qp,this.tm,this.Jp)}Ys(t,e){const{wuSize:i,start:s,end:r,tickDirection3D:n,tickDirection2D:o}=e,h=t.qi.Ws,a=(t.u-this.ct.getInnerStart())/(this.ct.getInnerEnd()-this.ct.getInnerStart()),l=be.addVec(Oe(s,r,a),be.multiplyVec(be.multiply(n,this.Jp.nm(.5*this.sm.ha().getThickness())),i)),c=be.addVec(l,be.multiplyVec(be.multiply(n,this.Jp.nm(h.tickLength)),i)),d=this.Jp.om(c)||u(0,0),f=Ke(nt(d,this.chart.engine.scale,this.tm),Ze(o,h.tickPadding));return t._i.Sn(f).kn({x:-o.x,y:-o.y}),{posTickEnd3D:c,posTickStart3D:l,tickPositionRelative:a}}mg(t,e,i){const{wuSize:s,start:r,end:n,tickDirection3D:o}=e,h=(t-this.ct.getInnerStart())/(this.ct.getInnerEnd()-this.ct.getInnerStart()),a=be.addVec(Oe(r,n,h),be.multiplyVec(be.multiply(o,this.Jp.nm(.5*this.sm.ha().getThickness())),s)),l=be.addVec(a,be.multiplyVec(be.multiply(o,this.Jp.nm(10)),s)),c=this.Jp.om(a)||u(0,0),d=this.Jp.om(l)||u(0,0);return this.Qp._u(this.tm).la(c).Ko(d).ea(new tt({fillStyle:new z({color:D(120*i)}),thickness:1}))}re(t,e){return Xo(t,e,this.ct)}ru(t){const e=this.im,i=f(e.x.st(),e.y.st(),e.z.st());let s,r;this.es===Ho?(s=f(e.x.getInnerEnd(),e.y.getInnerStart(),e.z.getInnerStart()),r=f(e.x.getInnerEnd(),e.y.getInnerStart(),e.z.getInnerEnd())):(s=f(e.x.getInnerStart(),e.y.getInnerStart(),e.z.getInnerStart()),r=this.es.Yp(f(e.x.getInnerEnd(),e.y.getInnerEnd(),e.z.getInnerEnd()),s));const n=this.es.gd,o=this.Jp.om(s)||u(0,0),h=this.Jp.om(r)||u(0,0),a=Oe(s,r,.5),l=be.addVec(a,be.multiplyVec(be.multiply(n,-1),i)),c=this.Jp.om(a)||u(0,0),d=this.Jp.om(l)||u(0,0),g=Xe(Je(nt(c,this.chart.engine.scale,this.tm),nt(d,this.chart.engine.scale,this.tm)));this.sm.qn().Kn([s,r]);const{gridlinePositionA:m,gridlinePositionB:p,gridlinePositionC:y}=this.es.Xp(t),x=t=>({x:-1===t.x?this.im.x.getInnerStart():1===t.x?this.im.x.getInnerEnd():0,y:-1===t.y?this.im.y.getInnerStart():1===t.y?this.im.y.getInnerEnd():0,z:-1===t.z?this.im.z.getInnerStart():1===t.z?this.im.z.getInnerEnd():0}),S=x(m),v=x(p),b=x(y),M={physicalAxisSize:je(Je(o,h)),wuSize:i,start:s,end:r,tickDirection3D:n,tickDirection2D:g,gridlinePositionA:S,gridlinePositionB:v,gridlinePositionC:b},A=this.Bs(M);for(const[t,e]of this.Ti){let i=this.Sd.get(t);i||(i={grid:this.Jp.Sg().setMouseInteractions(!1),tick:this.Jp.Sg().setMouseInteractions(!1)}),i.grid.qn(),i.tick.qn();for(const[,t]of e){const e=this.pg(t,M,A);e.gridStroke&&i.grid.Kn(e.gridStroke),i.tick.Kn([e.tickStroke.start,e.tickStroke.end])}i.grid.ea(t.Ws.getGridStrokeStyle()),i.tick.ea(t.Ws.getTickStyle()),this.Sd.set(t,i)}const w=this.Zs(((t,e)=>{const i=e._i.Et();return t.x=Math.max(t.x,i.x),t.y=Math.max(t.y,i.y),t}),u(0,0)),D=Math.atan((h.y-o.y)/(h.x-o.x));this.ds.kn({x:0,y:0}).xs(180*-D/Math.PI);const T=be.addVec(a,be.multiplyVec(be.multiply(n,this.Jp.nm(.5*this.sm.ha().getThickness()+this.qs(((t,e)=>Math.max(t,e.tickLength)),0))),i)),E=this.Jp.om(T)||u(0,0),B=Ke(nt(E,this.chart.engine.scale,this.tm),Ke(Ke(Qe(w,g),Ze(g,this.qs(((t,e)=>Math.max(t,e.labelPadding)),0))),Qe(Ze(this.ds.Gs().Et(),.5),g)));this.ds.Sn(B),this.sm.am={overrideFollowing:!1,skipMousePicking:!1}}pg(t,e,i){const{gridlinePositionA:s,gridlinePositionB:r,gridlinePositionC:n}=e,o=i.get(t),h=o.posTickStart3D,a=o.posTickEnd3D,l=o.tickPositionRelative;let u;return Mt(l,0)||Mt(l,1)||(u=[this.isX()?{...s,x:h.x}:this.isY()?{...s,y:h.y}:this.isZ()?{...s,z:h.z}:{x:0,y:0,z:0},this.isX()?{...r,x:h.x}:this.isY()?{...r,y:h.y}:this.isZ()?{...r,z:h.z}:{x:0,y:0,z:0},this.isX()?{...n,x:h.x}:this.isY()?{...n,y:h.y}:this.isZ()?{...n,z:h.z}:{x:0,y:0,z:0}]),{gridStroke:u,tickStroke:{start:h,end:a}}}As(){if(this.Sd){for(const t of this.Sd)t[1].grid.dispose(),t[1].tick.dispose();this.Sd.clear()}super.As()}isX(){return this.es===Go}isY(){return this.es===Uo}isZ(){return this.es===Ho}}class qo extends Gi{constructor(t,e,i,s,r,n){super(t,e,i,s,n),this.md=r}}const Xo=(t,e,i)=>At(t+.1*(e-t)+Math.abs(i.st())/100*Math.sign(e-t),Math.min(t,e),Math.max(t,e));class $o{constructor(){this.type="simple"}}const jo=new $o;class Zo{constructor(t){this.type="phong",this.ambientReflection=1,this.specularReflection=.1,this.diffuseReflection=1,this.ambientColor=w("#000"),this.specularColor=w("#fff"),this.shininess=32,t&&(this.ambientReflection=Number.isNaN(Number(t.ambientReflection))?this.ambientReflection:Number(t.ambientReflection),this.specularReflection=Number.isNaN(Number(t.specularReflection))?this.specularReflection:Number(t.specularReflection),this.diffuseReflection=Number.isNaN(Number(t.diffuseReflection))?this.diffuseReflection:Number(t.diffuseReflection),this.ambientColor=t.ambientColor||this.ambientColor,this.specularColor=t.specularColor||this.specularColor,this.shininess=t.shininess||this.shininess)}}const Ko=new Zo,Jo={Simple:$o,Phong:Zo};class Qo extends Zr{constructor(t,e,i,s,r){super(t,e,s,r),this.lm=Ko,this.um=!0,this.dm=!0,this.qa=t,this.Jp=i,this.de=new Map,this.onMouseWheel(this.qa.fm),this.onMouseDrag(this.qa.gm),this.onTouchStart(this.qa.pm.onTouchStart),this.onTouchMove(this.qa.pm.onTouchMove),this.onTouchEnd(this.qa.pm.onTouchEnd)}setAutoScrollingEnabled(t){return this.um=t,this.qa.Li.Bi(),this}getAutoScrollingEnabled(){return this.um}setColorShadingStyle(t){return this.lm=t,this.de.forEach(((e,i)=>i.ym(t))),this.Jp.Bi(),this}getColorShadingStyle(){return this.lm}setDepthTestEnabled(t){return this.dm=t,this.de.forEach(((e,i)=>i.Sm(t))),this.Jp.Bi(),this}getDepthTestEnabled(){return this.dm}xm(){}ru(){}bm(){}getXMax(){const t=this.Dn;return t?t.yt():void 0}getXMin(){const t=this.Dn;return t?t.ft():void 0}getYMax(){const t=this.Dn;return t?t.xt():void 0}getYMin(){const t=this.Dn;return t?t.St():void 0}getZMax(){const t=this.Dn;return t?t.vm():void 0}getZMin(){const t=this.Dn;return t?t.Mm():void 0}Wp(){const t=this.Dn;return t?f(t.co(),t.do(),t._m()):f(0,0,0)}}class th extends Qo{constructor(t,e,i,s,r){super(t,e,i,s,r),this.ac="Box Series 3D",this.Am=.25,this.ed=()=>he(this.Vr);const n=this.qa.getSeries().length;this.Vr=ue(this.hs.boxSeries3DFillStyle,n),this.Dn=this.Jp.km().Sm(this.dm).ps(this.Vr).wm(this.Am).Ir(this.getHighlight()),this.rc(this.Dn)}invalidateData(t){const e=t.length;if(0===e)return this;const i=t[0];if(!i)return this;let s;if("xMin"in i||"yMin"in i||"zMin"in i||"xMax"in i||"yMax"in i||"zMax"in i){s=[];for(let i=0;ihe(this.sa.getFillStyle())}setStrokeStyle(t){this.sa="function"==typeof t?t(this.sa):t;const e=this.sa;return this.Dn.ea(e),this.Jp.Bi(),this}getStrokeStyle(){return this.sa}add(t){return(t=Array.isArray(t)?t:[t])?(this.Dn.Kn(t.slice()),this.Jp.Bi(),this):this}clear(){return this.Dn.qn(),this.Du=0,this}getPointAmount(){const t=this.Dn;return t.Jn()+t.Qn()}Qs(){return this.um&&this.getPointAmount()>0&&this.getVisible()}mc(t,e){t.Ir(e),this.Jp.Bi()}attach(t,e){return super.attach(t,e),oe(t,this.hs,{stroke:this.sa}),this}}class ih extends eh{constructor(t,e,i,s,r){super(t,e,i,s,r),this.ac="Line Series 3D";const n=this.qa.getSeries().length;this.sa=ue(s.lineSeries3DStrokeStyle,n),this.Tm=ls.pointStyle3D,this.Im(this.sa),this.Dn=this.Jp.Gp([Bo.UserSeries]).Sm(this.dm).ea(this.sa).hm(this.Tm).Ir(this.getHighlight()),this.rc(this.Dn)}setStrokeStyle(t){super.setStrokeStyle(t),this.Im(this.sa);const e=this.Tm;return this.Dn.hm(e),this}Im(t){const e=new Ji.Triangulated({shape:"sphere",fillStyle:t.getFillStyle(),size:t.getThickness()});this.Tm=e}}class sh extends eh{constructor(t,e,i,s,r){super(t,e,i,s,r),this.ac="Point Line Series 3D",this.ed=()=>he(this.sa.getFillStyle())||he(this.Tm.getFillStyle());const n=this.qa.getSeries().length;this.sa=ue(s.pointLineSeries3DStrokeStyle,n),this.Tm=ue(s.pointLineSeries3DPointStyle,n),this.Fm(),this.Dn=this.Jp.Gp([Bo.UserSeries]).Sm(this.dm).ea(this.sa).hm(this.Tm).Ir(this.getHighlight()),this.rc(this.Dn)}setPointStyle(t){return this.Tm="function"==typeof t?t(this.Tm):t,this.Fm(),this.Dn.hm(this.Tm),this.Jp.Bi(),this}getPointStyle(){return this.Tm}setStrokeStyle(t){super.setStrokeStyle(t);const e=this.sa,i=Math.abs(e.getThickness()),s=this.Tm;i>s.getSize()&&(this.Tm=s.setSize(i)),this.Fm();const r=this.Tm;return this.Dn.hm(r),this.Jp.Bi(),this}Fm(){const t=this.Tm,e=t.getSize();this.Tm=t.setSize(e)}mc(t,e){t.Ir(e),this.Jp.Bi()}}class rh extends Qo{constructor(t,e,i,s,r,n){super(t,e,i,s,r)}add(t){return(t=Array.isArray(t)?t:[t])?(this.Dn.Kn(t.slice()),this.Jp.Bi(),this):this}clear(){return this.Dn.qn(),this.Du=0,this}getPointAmount(){const t=this.Dn;return t.Jn()+t.Qn()}Qs(){return this.um&&this.getPointAmount()>0&&this.getVisible()}mc(t,e){t.Ir(e),this.Jp.Bi()}attach(t,e){return super.attach(t,e),oe(t,this.hs,{point3D:this.Pm}),this}}class nh extends rh{constructor(t,e,i,s,r,n){super(t,e,i,s,r,n),this.ac="Point Series 3D",this.ed=()=>he(this.Pm.getFillStyle());const o=this.qa.getSeries().length;this.Pm=ue(s.pointSeries3DPointStyle,o);const h={individualPointColorEnabled:!1,individualPointSizeEnabled:!1,individualLookupValuesEnabled:!1,individualPointSizeAxisEnabled:!1,...n};this.Dn=this.Jp.Bm(h).Sm(this.dm).Dm(this.Pm).Ir(this.getHighlight()),this.rc(this.Dn)}setPointStyle(t){this.Pm="function"==typeof t?t(this.Pm):t;const e=this.Pm;return this.Dn.Dm(e),this.Jp.Bi(),this}getPointStyle(){return this.Pm}}class oh extends rh{constructor(t,e,i,s,r,n){super(t,e,i,s,r,n),this.ac="Point Cloud Series 3D",this.ed=()=>he(this.Pm.getFillStyle());const o=this.qa.getSeries().length;this.Pm=ue(s.pointCloudSeries3DPointStyle,o);const h={individualPointColorEnabled:!1,individualPointSizeEnabled:!1,individualLookupValuesEnabled:!1,individualPointSizeAxisEnabled:!1,...n};this.Dn=this.Jp.Bm(h).Dm(this.Pm).Ir(this.getHighlight()),this.rc(this.Dn)}setPointStyle(t){this.Pm="function"==typeof t?t(this.Pm):t;const e=this.Pm;return this.Dn.Dm(e),this.Jp.Bi(),this}getPointStyle(){return this.Pm}}const hh={Triangulated:nh,Pixelated:oh};class ah extends mo{constructor(t,e,i,s,r,n,o,h,a,l,u){super(t,e,i,s,r,n,o,h,a,l,u),this.Lm=[],this.Om=0,this.Rm=t=>{const e=this.Lm.indexOf(t);e>=0&&(this.Lm.splice(e,1),this.P.emit("seriesDispose",this,t))},this.Em=()=>{this.Om+=1},this.zm=()=>{this.Om-=1},this.onSeriesBackgroundMouseEnter=t=>this.P.on("mouseEnterSeriesBackground",t),this.onSeriesBackgroundMouseLeave=t=>this.P.on("mouseLeaveSeriesBackground",t),this.onSeriesBackgroundMouseMove=t=>this.P.on("mouseMoveSeriesBackground",t),this.onSeriesBackgroundMouseDown=t=>this.P.on("mouseDownSeriesBackground",t),this.onSeriesBackgroundMouseUp=t=>this.P.on("mouseUpSeriesBackground",t),this.onSeriesBackgroundMouseClick=t=>this.P.on("mouseClickSeriesBackground",t),this.onSeriesBackgroundMouseDoubleClick=t=>this.P.on("mouseDoubleClickSeriesBackground",t),this.onSeriesBackgroundMouseDragStart=t=>this.P.on("mouseDragStartSeriesBackground",t),this.onSeriesBackgroundMouseDrag=t=>this.P.on("mouseDragSeriesBackground",t),this.onSeriesBackgroundMouseDragStop=t=>this.P.on("mouseDragStopSeriesBackground",t),this.onSeriesBackgroundMouseWheel=t=>this.P.on("mouseWheelSeriesBackground",t),this.onSeriesBackgroundTouchStart=t=>this.P.on("touchStartSeriesBackground",t),this.onSeriesBackgroundTouchMove=t=>this.P.on("touchMoveSeriesBackground",t),this.onSeriesBackgroundTouchEnd=t=>this.P.on("touchEndSeriesBackground",t),this.offSeriesBackgroundMouseEnter=t=>this.P.off(t,"mouseEnterSeriesBackground"),this.offSeriesBackgroundMouseLeave=t=>this.P.off(t,"mouseLeaveSeriesBackground"),this.offSeriesBackgroundMouseMove=t=>this.P.off(t,"mouseMoveSeriesBackground"),this.offSeriesBackgroundMouseDown=t=>this.P.off(t,"mouseDownSeriesBackground"),this.offSeriesBackgroundMouseUp=t=>this.P.off(t,"mouseUpSeriesBackground"),this.offSeriesBackgroundMouseClick=t=>this.P.off(t,"mouseClickSeriesBackground"),this.offSeriesBackgroundMouseDoubleClick=t=>this.P.off(t,"mouseDoubleClickSeriesBackground"),this.offSeriesBackgroundMouseDragStart=t=>this.P.off(t,"mouseDragStartSeriesBackground"),this.offSeriesBackgroundMouseDrag=t=>this.P.off(t,"mouseDragSeriesBackground"),this.offSeriesBackgroundMouseDragStop=t=>this.P.off(t,"mouseDragStopSeriesBackground"),this.offSeriesBackgroundMouseWheel=t=>this.P.off(t,"mouseWheelSeriesBackground"),this.offSeriesBackgroundTouchStart=t=>this.P.off(t,"touchStartSeriesBackground"),this.offSeriesBackgroundTouchMove=t=>this.P.off(t,"touchMoveSeriesBackground"),this.offSeriesBackgroundTouchEnd=t=>this.P.off(t,"touchEndSeriesBackground"),this.Vm=this.iu.lg()}setAnimationsEnabled(t){return super.setAnimationsEnabled(t),this.Lm.forEach((e=>e.setAnimationHighlight(t))),this}Nm(t,e){this.Vm.nc([e]),t.setMouseMoveEventHandler(((t,e)=>{this.P.emit("mouseMoveSeriesBackground",this,e)})).setMouseEnterEventHandler(((t,e)=>{this.P.emit("mouseEnterSeriesBackground",this,e)})).setMouseLeaveEventHandler(((t,e)=>{this.P.emit("mouseLeaveSeriesBackground",this,e)})).setMouseDownEventHandler(((t,e)=>this.P.emit("mouseDownSeriesBackground",this,e))).setMouseUpEventHandler(((t,e)=>this.P.emit("mouseUpSeriesBackground",this,e))).setMouseClickEventHandler(((t,e)=>this.P.emit("mouseClickSeriesBackground",this,e))).setMouseDoubleClickEventHandler(((t,e)=>this.P.emit("mouseDoubleClickSeriesBackground",this,e))).setMouseWheelEventHandler(((t,e)=>this.P.emit("mouseWheelSeriesBackground",this,e))).setMouseDragStartEventHandler(((t,e,i)=>this.P.emit("mouseDragStartSeriesBackground",this,e,i))).setMouseDragEventHandler(((t,e,i,s,r)=>this.P.emit("mouseDragSeriesBackground",this,e,i,s,r))).setMouseDragStopEventHandler(((t,e,i,s)=>this.P.emit("mouseDragStopSeriesBackground",this,e,i,s))).setTouchStartEventHandler(((t,e)=>{this.P.emit("touchStartSeriesBackground",this,e)})).setTouchMoveEventHandler(((t,e)=>{this.P.emit("touchMoveSeriesBackground",this,e)})).setTouchEndEventHandler(((t,e)=>{this.P.emit("touchEndSeriesBackground",this,e)}))}setSeriesBackgroundFillStyle(t){return this.Gm.ps(t),this.Li.Bi(),this}getSeriesBackgroundFillStyle(){return this.Gm.gs()}setSeriesBackgroundStrokeStyle(t){return this.Hm.$h(t),this.Li.Bi(),this}getSeriesBackgroundStrokeStyle(){return this.Hm.Yh()}setSeriesBackgroundEffect(t){return this.Vm.vs(t),this.Li.Bi(),this}getSeriesBackgroundEffect(){return this.Vm._s()}Wm(t){this.Lm.push(t),t.onMouseEnter(this.Em),t.onMouseLeave(this.zm),void 0!==this.Um&&t.setHighlightOnHover(this.Um),this.P.emit("seriesAdded",this,t)}dd(){return this.Lm}$m(){return this.Om}setSeriesHighlightOnHover(t){return this.Um=t,this.Lm.forEach((e=>e.setHighlightOnHover(t))),this}dispose(){return this.Lm.slice().forEach(vt),super.dispose()}}const lh=be.normalize({x:-.5610788649579117,y:-.35242840511865414,z:-1.1349149375849081});class uh{constructor(t,e,i,s){this.Ym=!0,this.Xm=!0,this.jm=2*-Math.PI/2160,this.Zm=2*Math.PI/2160,this.Km=.1,this.qm=1*Math.PI/180,this.Jm=t,this.Qm=e,this.ty=i,this.om=s}getDefaultCameraConfiguration(t){const e={direction:lh,location:be.multiply(lh,-1)};return this.cameraLocationChanged({boundingBox:t,cameraDirection:e.direction,cameraLocation:e.location})||e}applyCameraInteractions(t,e){let i={direction:t.cameraDirection,location:t.cameraLocation};return e.forEach((t=>{"rotate"===t.type?i=this.iy(i,t):"wheel-zoom"===t.type?i=this.sy(i,t):"rotate+zoom"===t.type?i=this.ey(i,t):"fixed-rotate"===t.type?i=this.hy(i,t):"move"===t.type&&(i=this.ny(i,t))})),this.Ym?i=this.oy(t.boundingBox,i):this.Xm&&(i=this.ly(t.boundingBox,i)),i}iy(t,e){const{rotation:i}=e,s=t.location,r=be.multiply(be.normalize(t.location),-1),{Right:n,Up:o}=this.uy(r);let h=s;const a=this.gy(r),l=i.x*this.jm*a;h=be.rotateAroundAxis(h,o,l);const u=(i.y>0?1:-1)*Math.min(Math.abs(i.y)*this.Zm,a-this.qm);return 0!==u&&(h=be.rotateAroundAxis(h,n,u)),{location:h,direction:be.multiply(be.normalize(h),-1)}}sy(t,e){const{deltaY:i}=e;this.Ym&&this.py(!1);const s=t.location,r=be.multiply(be.normalize(s),-1),n=i*this.Km,o=be.length(s)*-n;return{direction:r,location:be.addVec(s,be.multiply(r,o))}}ey(t,e){const{rotation:i,cameraDistance:s}=e;this.Ym&&this.py(!1);let r=this.iy(t,{type:"rotate",rotation:i});const n=r.location,o=be.multiply(be.normalize(n),-1),h=be.multiply(o,-s);return r={direction:be.multiply(be.normalize(h),-1),location:h},r}hy(t,e){this.Ym&&this.py(!1);const{rotation:i}=e,s=t.location,r=t.direction,{Right:n,Up:o}=this.uy(r),h=i.x*this.jm;let a=be.normalize(be.rotateAroundAxis(r,o,h));const l=i.y*this.Zm;return a=be.normalize(be.rotateAroundAxis(a,n,l)),{location:s,direction:a}}ny(t,e){this.Ym&&this.py(!1),this.Xm=!1;const{amountRight:i,amountForward:s}=e,r=t.location,n=t.direction,{Right:o}=this.uy(n);return{location:be.addVec(r,be.multiply(n,.01*s),be.multiply(o,.01*i)),direction:n}}boundingBoxChanged(t){const e={location:t.cameraLocation,direction:be.multiply(be.normalize(t.cameraLocation),-1)};return this.Ym?this.oy(t.boundingBox,e):this.ly(t.boundingBox,e)}cameraLocationChanged(t){const e={location:t.cameraLocation,direction:be.multiply(be.normalize(t.cameraLocation),-1)};return this.Ym?this.oy(t.boundingBox,e):this.ly(t.boundingBox,e)}viewportChanged(t){const e={location:t.cameraLocation,direction:be.multiply(be.normalize(t.cameraLocation),-1)};if(this.Ym)return this.oy(t.boundingBox,e)}oy(t,e,i){let s=e;i=void 0!==i?i:0,s=this.my(t,s,100,20,1,i,5);const r=this.gy(s.direction);return s=this.yy(s,this.Sy(t,s,100,1),r),s}my(t,e,i,s,r,n,o){return ch(n,o,(t=>({direction:e.direction,location:be.multiply(e.direction,-t)})),(e=>this.xy(t,e)),i,r,"linear",s)}Sy(t,e,i,s){const{Right:r,Left:n,Up:o,Down:h}=this.uy(e.direction),a=this.by(t,!1,e);let l=e;const u=s,c=.1;return Math.abs(a.bottom-a.top)>u&&(l=a.bottom({location:l.location,direction:be.normalize(be.lerp(l.direction,h,t))})),(e=>this.vy(t,e)),0,u,!0,i):dh(0,c,(t=>({location:l.location,direction:be.normalize(be.lerp(l.direction,o,t))})),(e=>this.vy(t,e)),0,u,!0,i)),Math.abs(a.left-a.right)>u&&(l=a.left({location:l.location,direction:be.normalize(be.lerp(l.direction,n,t))})),(e=>this.My(t,e)),0,u,!0,i):dh(0,c,(t=>({location:l.location,direction:be.normalize(be.lerp(l.direction,r,t))})),(e=>this.My(t,e)),0,u,!0,i)),l}xy(t,e){const i=this.by(t,!0,e);return Math.min(i.left+i.right,i.top+i.bottom)}My(t,e){const i=this.by(t,!1,e);return Math.abs(i.left-i.right)}vy(t,e){const i=this.by(t,!1,e);return Math.abs(i.top-i.bottom)}by(t,e,i){const s=ze(this._y(t,e,i).map((t=>nt(t,this.Jm,this.Qm))));return{left:s.min.x,right:this.Qm.x.getInnerEnd()-s.max.x,top:this.Qm.y.getInnerEnd()-s.max.y,bottom:s.min.y}}_y(t,e,i){const s=this.ty,r=f(s.x.getInnerStart(),s.y.getInnerStart(),s.z.getInnerStart()),n=f(s.x.getInnerEnd(),s.y.getInnerEnd(),s.z.getInnerEnd()),o=[],h=e?16:4,a=(r.x+n.x)/2,l=(r.z+n.z)/2,u=Math.sqrt(2)*(n.x-a),c=Math.sqrt(2)*(n.z-l);return[r.y,n.y].forEach((t=>{for(let e=0;ethis.om(t,i))).filter((t=>void 0!==t))}ly(t,e){const i=be.length(e.location),s=this.Ay(t);return i{let a,l=0,u=(e+t)/2;do{const h=i(u);if(a={value:u,result:h,score:s(h)},Math.abs(a.score-r)<=n)break;const c=a.score>r;c&&"linear"===o||!c&&"reversed"===o?(u=(a.value+t)/2,e=a.value):(u=(a.value+e)/2,t=a.value),l+=1}while(l{let a,l=0,u=t;do{const c=i(u),d=s(c);if(void 0===a||Math.abs(d-r)he(this.Vr),this.lm=jo;const o=this.qa.getSeries().length;this.Vr=ue(this.hs.surfaceGridSeries3DFillStyle,o),this.Ma=ue(this.hs.surfaceGridSeries3DWireframeStyle,o);const h=s.start||{x:0,z:0},a=s.end?{x:(s.end.x-h.x)/s.columns,z:(s.end.z-h.z)/s.rows}:s.step||{x:1,z:1},l={heatmapDataType:"intensity",dataOrder:s.dataOrder||"columns",columns:s.columns,rows:s.rows,start:h,step:a};this.Mh=l,this.Dn=this.Jp.ky(l).ps(this.Vr)._a(this.Ma).ym(this.lm).Ir(this.getHighlight()),this.rc(this.Dn)}setFillStyle(t){return this.Vr="function"==typeof t?t(this.Vr):t,this.Dn.ps(this.Vr),this.Jp.Bi(),this}getFillStyle(){return this.Vr}setWireframeStyle(t){return this.Ma="function"==typeof t?t(this.Ma):t,this.Dn._a(this.Ma),this.Jp.Bi(),this}getWireframeStyle(){return this.Dn.Aa()}setIntensityInterpolation(t){return t=t||"disabled",this.Dn.Cy(t),this.Jp.Bi(),this}getIntensityInterpolation(){return this.Dn.Ty()}invalidateIntensityValues(t){if(Array.isArray(t)){if(0===t.length||0===t[0].length)return this;const e={x:t.length,y:t[0].length,columns:"columns"===this.Mh.dataOrder?t.length:t[0].length,rows:"rows"===this.Mh.dataOrder?t.length:t[0].length},i="columns"===this.Mh.dataOrder?this.Mh.columns:this.Mh.rows,s="columns"===this.Mh.dataOrder?this.Mh.rows:this.Mh.columns;if(e.x>i||e.y>s){if(!0===this.qa.ef.Ph){const t=`SurfaceGridSeries3D.invalidateIntensityValues intensity matrix overflow.\n Grid ${this.Mh.columns}x${this.Mh.rows}, input ${e.columns}x${e.rows}.\n Excess data will be automatically clipped. This can result in sub-optimal performance.`;gt.console.warn(t)}const r=[];for(let e=0;eo||n>h){if(!0===this.qa.ef.Ph){const i=`SurfaceGridSeries3D.invalidateIntensityValues intensity matrix overflow.\n Grid ${this.Mh.columns}x${this.Mh.rows}, input ${e.columns}x${e.rows} starting at [${t.iColumn},${t.iRow}].\n Out of bounds data will be automatically clipped. This can result in sub-optimal performance.`;gt.console.warn(i)}const a=Math.max(-i,0),l=Math.max(-r,0),u=Math.max(s-o,0),c=Math.max(n-h,0),d=e.primary-(a+u),f=[];if(0===l&&0===c)for(let e=0;ei||e.y>s){if(!0===this.qa.ef.Ph){const t=`SurfaceGridSeries3D.invalidateHeightMap height matrix overflow.\n Grid ${this.Mh.columns}x${this.Mh.rows}, input ${e.columns}x${e.rows}.\n Excess data will be automatically clipped. This can result in sub-optimal performance.`;gt.console.warn(t)}const r=[];for(let e=0;eo||n>h){if(!0===this.qa.ef.Ph){const i=`SurfaceGridSeries3D.invalidateHeightMap height matrix overflow.\n Grid ${this.Mh.columns}x${this.Mh.rows}, input ${e.columns}x${e.rows} starting at [${t.iColumn},${t.iRow}].\n Out of bounds data will be automatically clipped. This can result in sub-optimal performance.`;gt.console.warn(i)}const a=Math.max(-i,0),l=Math.max(-r,0),u=Math.max(s-o,0),c=Math.max(n-h,0),d=e.primary-(a+u),f=[];if(0===l&&0===c)for(let e=0;ehe(this.Vr),this.lm=jo;const o=this.qa.getSeries().length;this.Vr=ue(this.hs.surfaceScrollingGridSeries3DFillStyle,o),this.Ma=ue(this.hs.surfaceScrollingGridSeries3DWireframeStyle,o);const h=s.start||{x:0,z:0},a=s.step||{x:1,z:1},l={heatmapDataType:"intensity",scrollDimension:s.scrollDimension||"columns",columns:s.columns,rows:s.rows,start:h,step:a};this.Mh=l,this.Dn=this.Jp.By(l).ps(this.Vr)._a(this.Ma).ym(this.lm).Ir(this.getHighlight()),this.rc(this.Dn)}setFillStyle(t){return this.Vr="function"==typeof t?t(this.Vr):t,this.Dn.ps(this.Vr),this.Jp.Bi(),this}getFillStyle(){return this.Vr}setWireframeStyle(t){return this.Ma="function"==typeof t?t(this.Ma):t,this.Dn._a(this.Ma),this.Jp.Bi(),this}getWireframeStyle(){return this.Dn.Aa()}setIntensityInterpolation(t){return t=t||"disabled",this.Dn.Cy(t),this.Jp.Bi(),this}getIntensityInterpolation(){return this.Dn.Ty()}clear(){return this.Dn.qn(),this.Jp.Bi(),this}addValues(t){if(!t)return this;let e=t.yValues,i=t.intensityValues;if(!e&&!i)return this;if(e&&0===e.length&&(e=void 0),i&&0===i.length&&(i=void 0),e){const t=e[0].length,i=0+t-1,s="columns"===this.Mh.scrollDimension?this.Mh.rows:this.Mh.columns;if(i>s-1){if(!0===this.qa.ef.Ph){const e=`SurfaceScrollingGridSeries3D.addValues input yValues overflow.\nGrid was created with ${s} ${"columns"===this.Mh.scrollDimension?"rows":"columns"}, input yValues have ${t}.\nExcess data will be automatically clipped. This can result in sub-optimal performance.`;gt.console.warn(e)}const i=[];for(let t=0;ts-1){if(!0===this.qa.ef.Ph){const e=`SurfaceScrollingGridSeries3D.addValues intensityValues overflow.\nGrid was created with ${s} ${"columns"===this.Mh.scrollDimension?"rows":"columns"}, input intensityValues have ${t}.\nExcess data will be automatically clipped. This can result in sub-optimal performance.`;gt.console.warn(e)}const e=[];for(let t=0;ts?e=e.slice(0,s):i=i.slice(0,t)}}const s=e?e.length:null==i?void 0:i.length,r=e?e[0].length:null==i?void 0:i[0].length;return this.Dn.Ly({startPrimary:0,startSecondary:0,lengthPrimary:s,lengthSecondary:r,heightMapValues:e,intensityValues:i}),this.Jp.Bi(),this}setCullMode(t){return this.Dn.Py("boolean"==typeof t?t?"cull-back":"disabled":t),this}getCullMode(){return this.Dn.Dy()}xm(){}ru(){}bm(){}Qs(){return this.um&&this.getVisible()}mc(t,e){t.Ir(e),this.Jp.Bi()}}class mh extends ah{constructor(t,e,i,s,r,n,o){let h;super(t,e,i,e.Xg("chart3D bg",0),e.Eg("chart3D ui"),s,e.Li.hs.chart3DBackgroundFillStyle,e.Li.hs.chart3DBackgroundStrokeStyle,e.Li.hs.chart3DTitleFont,e.Li.hs.chart3DTitleFillStyle,n),this.Oy=1,this.Ry=[],this.Ey=2,this.zy=!0,this.Vy=!0,this.Ny=!0,this.Gy=0,this.axes={id:"axes",chart:this},this.world={id:"world",chart:this},this.Ve=[],this.Ue=()=>{const t=this.Jp.Hy();this.Uy.Wy(t),this.$y.Wy(t);const e=this.Yy.viewportChanged(this.Xy());e&&this.jy(e),this.Li.Bi()},this.gm=(t,e,i,s,r)=>{if(this.Ny){const t=r;this.Ry.push({type:"rotate",rotation:t}),this.Li.Bi(),Xt(e)}},this.fm=(t,e)=>{if(this.Vy){if(this.zy)Math.sign(this.Gy)!==Math.sign(e.deltaY)?this.Gy=ce(e):this.Gy+=ce(e);else{const t=ce(e);this.Ry.push({type:"wheel-zoom",deltaY:t})}this.Li.Bi(),Xt(e)}},this.ef.Ah||this.ef._h||this.Li.bh(1),this.Kg.fs("Chart3D"),this.Zy=i.d3(),this.Zy.x.Z(-1,1),this.Zy.y.Z(-1,1),this.Zy.z.Z(-1,1),this.Jp=e.Ky("chart3D layer3D",0,this.Zy),this.Uy=e.qy("chart3D series bg",0),this.$y=e.Pp("chart3D axis ui",1),this.Jy={x:new Yo(this,Go,this.Zy.x,this.hs,this.Jp,this.$y,this.pixelScale,!1,this.iu),y:new Yo(this,Uo,this.Zy.y,this.hs,this.Jp,this.$y,this.pixelScale,!1,this.iu),z:new Yo(this,Ho,this.Zy.z,this.hs,this.Jp,this.$y,this.pixelScale,!1,this.iu)},this.Qy=this.Jp.Gp([Bo.InternalUI]).setMouseInteractions(!1),this.setBoundingBoxStrokeStyle(this.hs.chart3DBoundingBoxStrokeStyle),this.Gm=this.Uy.vc(this.engine.scale,Ws.Simple).ps(this.hs.chart3DSeriesBackgroundFillStyle).$h(J).setMouseInteractions(!0),this.Hm=this.Uy.vc(this.engine.scale,Ws.Simple).ps(F).$h(this.hs.chart3DSeriesBackgroundStrokeStyle).setMouseInteractions(!1),super.Nm(this.Gm,this.Hm),this.tS({x:1,y:1,z:1},!0),this.Yy=new uh(this.engine.scale,this.pixelScale,this.Zy,((t,e)=>(e&&this.jy(e),this.Jp.om(t)))),this.iS=this.Yy.getDefaultCameraConfiguration(this.sS(this.eS)),this.jy(this.iS),this.pm=Fr(new zr(((t,e,i)=>{h={locationOne:e,locationTwo:i,cameraLocation:this.Jp.getCameraLocation()}}),((t,e,i,s,r,n)=>{if(!this.Ny&&!this.Vy)return;const o=(h.locationOne.x-h.locationTwo.x)**2+(h.locationOne.y-h.locationTwo.y)**2,a=(e.x-i.x)**2+(e.y-i.y)**2,l=be.length(h.cameraLocation),c=o/a*l,d=u((s.x+r.x)/2,(s.y+r.y)/2);this.Ry.push({type:"rotate+zoom",rotation:this.Ny?d:{x:0,y:0},cameraDistance:this.Vy?c:l}),this.Li.Bi(),Xt(n)}),(t=>{})),new Or((t=>{}),((t,e,i,s,r)=>{if(this.Ny){const t=s;this.Ry.push({type:"rotate",rotation:t}),this.Li.Bi(),Xt(r)}}),(t=>{}))),this.onBackgroundTouchStart(this.pm.onTouchStart),this.onBackgroundTouchMove(this.pm.onTouchMove),this.onBackgroundTouchEnd(this.pm.onTouchEnd),this.onSeriesBackgroundTouchStart(this.pm.onTouchStart),this.onSeriesBackgroundTouchMove(this.pm.onTouchMove),this.onSeriesBackgroundTouchEnd(this.pm.onTouchEnd),this.onBackgroundMouseDrag(this.gm),this.onBackgroundMouseWheel(this.fm),this.onBackgroundMouseDown(((t,e)=>{Xt(e)})),this.onSeriesBackgroundMouseDrag(this.gm),this.onSeriesBackgroundMouseWheel(this.fm),this.onSeriesBackgroundMouseDown(((t,e)=>{Xt(e)})),o&&!0===o.disableAnimations&&this.setAnimationsEnabled(!1),this.onResize(this.Ue),this.Ue(),this.Yg(r,this.pixelScale)}addPointSeries(t){const e=new(t&&t.type||nh)(this,this.Rm,this.Jp,this.hs,this.Li.iu,t);return this.Wm(e),e}addLineSeries(){const t=new ih(this,this.Rm,this.Jp,this.hs,this.Li.iu);return this.Wm(t),t}addPointLineSeries(){const t=new sh(this,this.Rm,this.Jp,this.hs,this.Li.iu);return this.Wm(t),t}addSurfaceGridSeries(t){const e=new fh(this,this.Rm,this.Jp,t,this.hs,this.Li.iu);return this.Wm(e),e}addSurfaceScrollingGridSeries(t){const e=new gh(this,this.Rm,this.Jp,t,this.hs,this.Li.iu);return this.Wm(e),e}addBoxSeries(){const t=new th(this,this.Rm,this.Jp,this.hs,this.Li.iu);return this.Wm(t),t}getDefaultAxisX(){return this.Jy.x}getDefaultAxisY(){return this.Jy.y}getDefaultAxisZ(){return this.Jy.z}getDefaultAxes(){return[this.Jy.x,this.Jy.y,this.Jy.z]}setCameraLocation(t){let e={location:t,direction:be.normalize(be.multiply(t,-1))};const i=this.Yy.cameraLocationChanged(this.Xy(e));return i&&(e=i),this.jy(e),this.Li.Bi(),this}getCameraLocation(){return this.Jp.getCameraLocation()}getCameraDirection(){return this.Jp.getCameraDirection()}setCameraAutomaticFittingEnabled(t){this.Yy.py(t);const e=this.Yy.cameraLocationChanged(this.Xy());return e&&this.jy(e),this}getCameraAutomaticFittingEnabled(){return this.Yy.wy()}onCameraChange(t){return this.P.on("cameraChange",t)}offCameraChange(t){return this.P.off(t,"cameraChange")}setBoundingBoxStrokeStyle(t){return this.Qy.ea(t).hm(Wo(this.Qy.ha())),this.Jp.Bi(),this}getBoundingBoxStrokeStyle(){return this.Qy.ha()}setBoundingBox(t){return this.tS(t,!1),this}tS(t,e){this.eS=t;const i=this.sS(t);if(this.Zy.x.q(i.x),this.Zy.y.q(i.y),this.Zy.z.q(-i.z),!e){const t=this.Yy.boundingBoxChanged(this.Xy());t&&this.jy(t)}this.Li.Bi()}getBoundingBox(){return this.eS}ru(){const t=gt.performance.now();if(po.ip(this.Kg,this.jg),0!==this.Gy){const e=this.hS?t-this.hS:1e3/60,i=this.Gy*e*.006;this.Ry.push({type:"wheel-zoom",deltaY:i}),this.Gy=Math.sign(this.Gy)*Math.max(Math.abs(this.Gy)-.01*e,0),0!==this.Gy?(this.Li.Bi(!0),this.hS=t):this.hS=void 0}const e=this.getCameraDirection();if(this.Ry.length>0){const t=this.Yy.applyCameraInteractions(this.Xy(),this.Ry);t&&this.jy(t),this.Ry.length=0}this.rS&&be.equals(this.rS.location,this.iS.location)&&be.equals(this.rS.direction,this.iS.direction)||this.P.emit("cameraChange",this,this.getCameraLocation()),this.rS=this.iS,super.ru();for(let t=0;tthis.Jp.om(t))),o=this.Jp.om(f((s.x+r.x)/2,(s.y+r.y)/2,(s.z+r.z)/2)),h=ee(n,o),a=[];for(let t=0;t0?t-1:h.length-1],h[t{t()})),this.Ve.length=0,this.Zy.G(),this.Jp.G(),this.$y.G(),this.Uy.G(),super.dispose()}X(){return this.Zy.x.X(),this.Zy.y.X(),this.Zy.z.X(),super.X()}j(){return super.j()}jy(t){this.Jp.setCameraLocation(t.location).setCameraDirection(t.direction).setLightLocation(be.addVec(t.location,be.multiply(t.direction,-this.Ey))),this.iS=t,this.Li.Bi()}sS(t){return be.divide(t,be.length(t)/this.Oy)}Xy(t=this.iS){return{boundingBox:this.sS(this.eS),cameraLocation:t.location,cameraDirection:t.direction}}setMouseInteractions(t){return this.setMouseInteractionZoom(t).setMouseInteractionRotate(t)}setMouseInteractionZoom(t){return this.Vy=t,this}getMouseInteractionZoom(){return this.Vy}setMouseInteractionRotate(t){return this.Ny=t,this}getMouseInteractionRotate(){return this.Ny}forEachAxis(t){return t(this.Jy.x),t(this.Jy.y),t(this.Jy.z),this}getMinimumSize(){}getSeries(){return this.Lm}setAnimationsEnabled(t){return super.setAnimationsEnabled(t),this.setAnimationZoom(t),this.forEachAxis((e=>e.setAnimationsEnabled(t))),this}setAnimationZoom(t){return this.zy=!!t,this}getAnimationZoom(){return this.zy}}const ph={Column:En,Row:Bn};class yh extends fo{constructor(t,e,i,s,r,n){super(t,e,i,s,r,n),this.nS=new Map,this.oS=this.addUIElement(ph.Row).setPosition({x:0,y:100}).setOrigin(wr.LeftTop).setBackground((t=>t.setFillStyle(F).setStrokeStyle(J)))}add(t,e){return(t instanceof mo?[t]:t instanceof fd?t.getCells().filter((t=>t.panel instanceof mo)).map((t=>t.panel)):[]).forEach((t=>{const i=this.oS.addElement(eo.VerticalLegendBox).setBackground((t=>t.setFillStyle(F).setStrokeStyle(J))).add(t,e).setTitle(t.getTitle());this.nS.set(t,i)})),this.Li.Bi(),this}setLegendBoxes(t){return this.nS.forEach(((e,i)=>t(e,i))),this}getMinimumSize(){return super.getMinimumSize()||this.oS.getSize()}}class xh{constructor(t,e){this.aS=t,this.lS=e}alter(t){this.uS=void 0!==this.uS?this.uS:this.lS(),this.cS=t,this.aS(t)}resetValue(){void 0!==this.cS&&(void 0!==this.uS&&this.isAltered()&&this.aS(this.uS),this.uS=void 0,this.cS=void 0)}getNormalValue(){return void 0!==this.uS?this.uS:this.lS()}isAltered(){return void 0!==this.cS&&this.lS()===this.cS}}class Sh{constructor(t,e){this.dS=[],this.fS=t,this.ct=e}update(){return this.fS.getVisible()?!(this.gS()&&(!this.pS()||(this.resetTable(),this.fS.Gs(),this.gS()))&&(this.mS(),this.fS.Gs(),this.gS()&&(this.resetTable(),this.fS.Gs(),1))):(this.pS()&&this.resetTable(),!0)}pS(){for(let t=0;t{const s=nt(t.getPosition(u(-1,-1),e.UISpace.PaddedBackground),t.scale,i),r=nt(t.getPosition(u(1,1),e.UISpace.PaddedBackground),t.scale,i);return s.xi.x.getInnerEnd()||s.yi.y.getInnerEnd()})(this.fS,this.ct)}yS(){return((t,i)=>{const s=nt(t.getPosition(u(-1,-1),e.UISpace.PaddedBackground),t.scale,i),r=nt(t.getPosition(u(1,1),e.UISpace.PaddedBackground),t.scale,i);return s.xi.x.getInnerEnd()})(this.fS,this.ct)}SS(){return((t,i)=>{const s=nt(t.getPosition(u(-1,-1),e.UISpace.PaddedBackground),t.scale,i),r=nt(t.getPosition(u(1,1),e.UISpace.PaddedBackground),t.scale,i);return s.yi.y.getInnerEnd()})(this.fS,this.ct)}xS(t){return this.dS.push(t),t}}class vh extends Sh{constructor(){super(...arguments),this.hn=this.xS(new xh((t=>this.fS.setOrigin(t)),(()=>this.fS.getOrigin())))}mS(){const t=this.hn.getNormalValue(),e=u(this.yS()?-t.x:t.x,this.SS()?-t.y:t.y);this.hn.alter(e)}}class bh extends Sh{constructor(t,e,i,s){super(t,e),this.bS=this.xS(new xh((t=>this.fS.setTextFont((e=>e.setSize(t)))),(()=>this.fS.getTextFont().getSize()))),this.vS=i,this.MS=s}mS(){const t=this.bS.getNormalValue(),e=this.vS;if(enew vh(t,e),FontSize:(t=5,e=5)=>(i,s)=>new bh(i,s,t,e)};class Ah{constructor(){this._S=[]}addRow(...t){return this._S.push(t),this}}class wh extends Ah{wu(){const t=this._S;return this._S=[],t}AS(){return this._S.length=0,this}}class Dh extends Dn{constructor(){super(...arguments),this.pu=this.hs.cursorResultTableTextFont,this.Xc=0,this.wS=this.hs.cursorResultTableTextFillStyle}setContent(t){for(let e=0;e=e)this.getMembers()[s].dispose(),s-=1,i-=1;else{const e=t[s].length;let i=r.getMembers().length;for(let n=0;n=e)r.getMembers()[n].dispose(),n-=1,i-=1;else if(void 0!==o&&o.length>0){for(let t=h.length;t=h.length)t=r.addElement(mn,void 0);else{const e=h[n];e instanceof vn?(r.getMembers()[n].dispose(),t=r.addElement(mn,n)):t=e}t.setFont(this.pu).setFillStyle(this.wS).setText(o).setTextRotation(this.Xc)}else{for(let t=h.length;t=h.length?r.addGap(void 0,void 0):h[n]instanceof gn&&(r.getMembers()[n].dispose(),r.addGap(void 0,n))}}}}return this.Lr.Bi(),this}setTextFillStyle(t){this.wS="function"==typeof t?t(this.wS):t;for(let t=0;tt.setFillStyle(n.cursorResultTableFillStyle).setStrokeStyle(n.cursorResultTableStrokeStyle))).setTextFillStyle(n.cursorResultTableTextFillStyle).setTextFont(n.cursorResultTableTextFont),this.BS=Mh.Flip(this.fS,this.scale)}dispose(){return this.DS.dispose(),this.fS.dispose(),this}pointAt(t){return this.qr=t.series.scale===this.scale?t.location:nt(t.location,t.series.scale,this.scale),this.DS.setPosition(this.qr),this.fS.setPosition(this.qr).setContent(t.resultTableContent),this.Lr.Bi(),this}getPosition(){return this.qr}setVisible(t){return this.Ri=t,this.Lr.Bi(),this}getVisible(){return this.Ri}setPointMarkerVisible(t){return this.CS=t,this.Lr.Bi(),this}getPointMarkerVisible(){return this.CS}setPointMarker(t){return t(this.DS),this.Lr.Bi(),this}getPointMarker(){return this.DS}setResultTableVisible(t){return this.TS=t,this.Lr.Bi(),this}getResultTableVisible(){return this.TS}setResultTable(t){return t(this.fS),this.Lr.Bi(),this}getResultTable(){return this.fS}setAutoFitStrategy(t){return this.BS&&this.BS.resetTable(),this.BS=t?t(this.fS,this.Lr.Li.ct):void 0,this.Lr.Bi(),this}getAutoFitStrategy(){return void 0!==this.BS}ru(){return this.BS&&this.BS.update(),this.fS.setVisible(this.IS&&this.Ri&&this.TS),this.DS.setVisible(this.IS&&this.Ri&&this.CS),this.DS.ru(),this.fS.ru(),this}Gs(){return this.DS.Gs(),this.fS.Gs(),this.IS=((t,e,i=e)=>{const s=e!==i?nt(t,e,i):t;return s.x>=i.x.getInnerStart()&&s.x<=i.x.getInnerEnd()&&s.y>=i.y.getInnerStart()&&s.y<=i.y.getInnerEnd()})(this.qr,this.scale),this}}class Eh extends Th{constructor(){super(...arguments),this.LS=!1}pointAt(t){return this.OS(t.fillStyle),super.pointAt(t)}OS(t){t&&this.LS&&this.fS.setTextFillStyle(t)}setResultTableAutoTextStyle(t){return this.LS=t,this.Lr.Bi(),this}getResultTableAutoTextStyle(){return this.LS}}class Bh extends Th{setPosition(t){return this.qr=t,this.DS.setPosition(t),this.fS.setPosition(t),this.Lr.Bi(),this}}class kh{constructor(t,e,i=[]){this.RS=[],this.ES=(t,e)=>(this.RS.forEach((i=>i(t,e))),t),this.FS=t,this.PS=e,this.RS=i}}class Ih extends kh{constructor(){super(...arguments),this.zS=(t,e,i,s)=>this.ES(new Eh(t,e,i,this.FS,this.PS,s),s),this.addStyler=t=>new Ih(this.FS,this.PS,this.RS.map((t=>t)).concat(t)),this.setPointMarker=t=>new Ih(t,this.PS,this.RS.map((t=>t))),this.setResultTableBackground=t=>new Ih(this.FS,t,this.RS.map((t=>t)))}}class Ch extends kh{constructor(){super(...arguments),this.VS=(t,e,i,s)=>this.ES(new Bh(t,e,i,this.FS,this.PS,s),s),this.addStyler=t=>new Ch(this.FS,this.PS,this.RS.map((t=>t)).concat(t)),this.setPointMarker=t=>new Ch(t,this.PS,this.RS.map((t=>t))),this.setResultTableBackground=t=>new Ch(this.FS,t,this.RS.map((t=>t)))}}const Ph=t=>t.setPointMarker((t=>t.setSize(u(5,5)).setOrigin(u(0,0)))).setResultTable((t=>t.setEffect(!0).setOrigin(u(-1,-1)).setMargin(5))),Lh=(t,e)=>t.setPointMarker((t=>t.setFillStyle(e.chartMarkerPointMarkerFillStyle).setStrokeStyle(e.chartMarkerPointMarkerStrokeStyle).setSize(u(20,20)).setOrigin(u(0,0)))).setResultTable((t=>t.setEffect(!0).setBackground((t=>t)).setOrigin(u(-1,-1)).setMargin(10)));new Ih(pn,pn,[Ph]);const Rh=new Ih(pn,Sn,[Ph,t=>t.setPointMarkerVisible(!1).setResultTable((t=>t.setOrigin(u(0,-1)).setMargin(0).setBackground((t=>{t instanceof Sn&&t.setDirection(e.UIDirections.Down).setPointerLength(10).setPointerAngle(60)}))))]),Fh=Rh;new Ch(xn,pn,[Lh,t=>t.setResultTableVisible(!1)]);const _h=new Ch(un,pn,[Lh,t=>t.setResultTable((t=>t.setOrigin(wr.LeftBottom)))]),Oh=(t,e,i,s,r)=>({location:t,scale:e,resultTableContent:i,series:s,fillStyle:r}),zh={World:"World",USA:"USA",NorthAmerica:"NorthAmerica",SouthAmerica:"SouthAmerica",Canada:"Canada",Europe:"Europe",Asia:"Asia",Africa:"Africa",Australia:"Australia"},Vh=(t,e)=>!(!e.name||t.name.toLowerCase()!==e.name.toLowerCase())||"ISO_A3"in t&&"ISO_A3"in e&&t.ISO_A3.toLowerCase()===e.ISO_A3.toLowerCase(),Nh=(t,e)=>{let i=e.geometry;return i=Gh(t,e,i),i=Uh(t,e,i),i},Gh=(t,e,i)=>{if(t===zh.Asia){const t=[];for(let e=0;e{const s=e.name.toLowerCase();let r;if(t===zh.USA&&("alaska"===s?r={translate:{x:55,y:-25},scale:{x:.16,y:.16}}:"hawaii"===s&&(r={translate:{x:48,y:7},scale:{x:1,y:1}})),r){const{translate:t,scale:n}=r,o=ze(wt(i)),h=[];for(let e=0;e{this.Lm.includes(t)||(this.Lm.push(t),this.P.emit("seriesAdded",this,t))},this.HS=i.WS();const d=()=>{this.NS!==e.AutoCursorModes.disabled&&this.Li.Bi()},f=()=>{this.NS!==e.AutoCursorModes.disabled&&this.Li.Bi()},g=()=>{this.NS!==e.AutoCursorModes.disabled&&this.Li.Bi()},m=()=>{this.NS!==e.AutoCursorModes.disabled&&this.Li.Bi()},p=()=>{this.NS!==e.AutoCursorModes.disabled&&this.Li.Bi()},y=()=>{this.NS!==e.AutoCursorModes.disabled&&this.Li.Bi()};this.onSeriesBackgroundMouseEnter(d),this.onSeriesBackgroundMouseMove(f),this.onSeriesBackgroundMouseLeave(g),this.onSeriesBackgroundTouchStart(m),this.onSeriesBackgroundTouchMove(p),this.onSeriesBackgroundTouchEnd(y),this.US(((t,e)=>{const i=e.onMouseEnter(d),s=e.onMouseMove(f),r=e.onMouseLeave(g),n=e.onTouchStart(m),o=e.onTouchMove(p),h=e.onTouchEnd(y),a=this.$S(((t,l)=>{l===e&&(e.offMouseEnter(i),e.offMouseMove(s),e.offMouseLeave(r),e.offTouchStart(n),e.offTouchMove(o),e.offTouchEnd(h)),this.YS(a)}))}))}setAutoCursor(t){return this.XS&&t(this.XS),this.Li.Bi(),this}getAutoCursor(){return this.XS}setAutoCursorMode(t){return this.NS=t,this.Li.Bi(),this}getAutoCursorMode(){return this.NS}jS(t){if(t.xthis.uiScale.x.Lt()||t.ythis.uiScale.y.Lt())return;let e,i=Number.MAX_VALUE;for(const s of this.Lm)if(s.getCursorEnabled()&&s.getVisible()){const r=s.jS(t,!1);if(r){const s=nt(r.location,r.scale,this.engine.scale),n=Le(t,s);Number.isNaN(n)||e&&!(nt.getIsUnderMouse())),r=this.Gm.getIsUnderMouse();this.NS===e.AutoCursorModes.snapToClosest?(r||void 0!==s)&&(i=t&&this.jS(t)):this.NS===e.AutoCursorModes.onHover&&void 0!==s&&s.getCursorEnabled()&&(i=t&&s.jS(t,!0))}i?this.XS.pointAt(i).setVisible(!0):this.XS.setVisible(!1),this.XS.Gs().ru()}US(t){return this.P.on("seriesAdded",t)}KS(t){return this.P.off(t)}$S(t){return this.P.on("seriesDispose",t)}YS(t){return this.P.off(t)}dispose(){return this.HS.G(),this.XS.dispose(),super.dispose()}}class Xh extends mo{constructor(t,i,s,r,n,o,h){super(t,i,s,i.Xg("mapChart bg",0),i.Eg("mapChart ui"),r,i.Li.hs.mapChartBackgroundFillStyle,i.Li.hs.mapChartBackgroundStrokeStyle,i.Li.hs.mapChartTitleFont,i.Li.hs.mapChartTitleFillStyle,h),this.qS=[],this.JS=[],this.QS=[],this.ct=this.Bg.d2({scaleXYConstructor:Ti}),this.Fu=!0,this.Vr=this.hs.mapChartFillStyle,this.$r=this.hs.mapChartStrokeStyle,this.tx=this.hs.mapChartOutlierRegionFillStyle,this.ix=this.hs.mapChartOutlierRegionStrokeStyle,this.sx=this.hs.mapChartSeparateRegionFillStyle,this.hx=this.hs.mapChartSeparateRegionStrokeStyle,this.nu=0,this.nx=e.AutoCursorModes.onHover,this.ox=$h,this.Oi=!1,this.onMouseEnter=t=>this.P.on("mouseEnter",t),this.onMouseLeave=t=>this.P.on("mouseLeave",t),this.onMouseClick=t=>this.P.on("mouseClick",t),this.onMouseDoubleClick=t=>this.P.on("mouseDoubleClick",t),this.onMouseDown=t=>this.P.on("mouseDown",t),this.onMouseUp=t=>this.P.on("mouseUp",t),this.onMouseMove=t=>this.P.on("mouseMove",t),this.offMouseEnter=t=>this.P.off(t,"mouseEnter"),this.offMouseLeave=t=>this.P.off(t,"mouseLeave"),this.offMouseClick=t=>this.P.off(t,"mouseClick"),this.offMouseDoubleClick=t=>this.P.off(t,"mouseDoubleClick"),this.offMouseDown=t=>this.P.off(t,"mouseDown"),this.offMouseUp=t=>this.P.off(t,"mouseUp"),this.offMouseMove=t=>this.P.off(t,"mouseMove"),this.offMouseDragStart=t=>this.P.off(t,"mouseDragStart"),this.offMouseDrag=t=>this.P.off(t,"mouseDrag"),this.offMouseDragStop=t=>this.P.off(t,"mouseDragStop"),this.offMouseWheel=t=>this.P.off(t,"mouseWheel"),this.onMapDataReady=t=>{const e=this.P.on("mapDataReady",t);return this.lx&>.setTimeout((()=>t())),e},this.onViewChange=t=>this.P.on("viewChange",t),this.ux=(t,e,i,s,r)=>{this.ct.x.q(s).Dt([this._t.left+this.rn.left,this._t.right+this.rn.right]),this.ct.y.q(r).Dt([this._t.bottom+this.rn.bottom,this._t.top+this.rn.top+po.tp(this.Kg,this.jg)]),this.gx&&this.mx(this.yx,this.ct,this.gx)},this.Eu=(t,i,s,r)=>{this.nx!==e.AutoCursorModes.disabled&&(this.Sx(t,s,r),Xt(i)),this.P.emit("mouseEnter",this,i)},this.Vu=(t,e,i,s)=>{this.xx(t,i,s),this.P.emit("mouseLeave",this,e),e&&Xt(e)},this.Gu=(t,i,s,r)=>{this.nx!==e.AutoCursorModes.disabled&&(this.Sx(t,s,r),Xt(i)),this.P.emit("mouseMove",this,i)},this.Wu=(t,e)=>this.P.emit("mouseClick",this,e),this.Uu=(t,e)=>this.P.emit("mouseDoubleClick",this,e),this.$u=(t,e)=>this.P.emit("mouseDown",this,e),this.Yu=(t,e)=>this.P.emit("mouseUp",this,e),this.Xu=(t,e,i)=>{this.P.emit("mouseDragStart",this,e,i)},this.ju=(t,e,i,s,r)=>{this.P.emit("mouseDrag",this,e,i,s,r)},this.Zu=(t,e,i,s)=>{this.P.emit("mouseDragStop",this,e,i,s)},this.Ku=(t,e)=>{this.P.emit("mouseWheel",this,e)},this.qu=(t,e,i,s)=>{this.bx=this.engine.clientLocation2Engine(e.clientX,e.clientY),this.Sx(t,i,s),this.P.emit("touchStart",this,e),Xt(e)},this.Ju=(t,e,i,s)=>{this.bx=this.engine.clientLocation2Engine(e.clientX,e.clientY),this.Sx(t,i,s),this.P.emit("touchMove",this,e),Xt(e)},this.Qu=(t,e,i,s)=>{this.bx=void 0,this.xx(t,i,s),this.P.emit("touchEnd",this,e),Xt(e)},this.ef.Ah||this.ef._h||this.Li.bh(3),this.vx=i.Pp("mapChart plotting",0),this.onResize(this.ux),this.Kg.fs("Map Chart");const a=kt(o?o.autoCursorBuilder:void 0,_h);this.Mx=a.VS(i.WS(),this.ct,this.ct,this.hs).setVisible(!1),this._x=this.iu.lg(),this.Yg(n,this.uiScale);const l=kt(o&&o.type,zh.World);this.yx=l,this.Ax(l).then((()=>{this.P.emit("mapDataReady")}))}setFillStyle(t){return this.Vr="function"==typeof t?t(this.Vr):t,this.wx(),this}getFillStyle(){return this.Vr}setStrokeStyle(t){return this.$r="function"==typeof t?t(this.$r):t,this.wx(),this}getStrokeStyle(){return this.$r}setEffect(t){return this._x.vs(t),this.Li.Bi(),this}getEffect(){return this._x._s()}setOutlierRegionFillStyle(t){return this.tx="function"==typeof t?t(this.tx):t,this.JS.forEach((t=>t.ps(this.tx))),this.Li.Bi(),this}getOutlierRegionFillStyle(){return this.tx}setOutlierRegionStrokeStyle(t){return this.ix="function"==typeof t?t(this.ix):t,this.JS.forEach((t=>t.$h(this.ix))),this.Li.Bi(),this}getOutlierRegionStrokeStyle(){return this.ix}setSeparateRegionFillStyle(t){return this.sx="function"==typeof t?t(this.sx):t,this.QS.forEach((t=>t.ps(this.sx))),this.Li.Bi(),this}getSeparateRegionFillStyle(){return this.sx}setSeparateRegionStrokeStyle(t){return this.hx="function"==typeof t?t(this.hx):t,this.QS.forEach((t=>t.$h(this.hx))),this.Li.Bi(),this}getSeparateRegionStrokeStyle(){return this.hx}invalidateRegionValues(t){if(!this.lx||!this.kx)return this.Cx=this.Cx||[],this.Cx.push(t),this;const e=this.Vr,i=e instanceof G;if("function"==typeof t)for(let s=0;st.setMouseInteractions(this.Fu))),this}getMouseInteractions(){return this.Fu}offMapDataReady(t){return this.P.off(t,"mapDataReady")}offViewChange(t){return this.P.off(t,"viewChange")}async Ax(t){const e=await((t,e)=>{let i;if(t===zh.World)i="countries_world.json";else if(t===zh.NorthAmerica)i="countries_northAmerica.json";else if(t===zh.SouthAmerica)i="countries_southAmerica.json";else if(t===zh.Africa)i="countries_africa.json";else if(t===zh.Europe)i="countries_europe.json";else if(t===zh.Asia)i="countries_asia.json";else if(t===zh.USA)i="states_usa.json";else if(t===zh.Canada)i="territoriesProvinces_canada.json";else{if(t!==zh.Australia){const e=`LCJS MapChart unidentified \`type\`: ${t}`;throw gt.alert(e),new Error(e)}i="territories_australia.json"}const s=`${e}/maps/${i}`;return gt.fetch(s).then((t=>t.json())).catch((t=>{ve(e,s,"Map Chart",{shouldCrash:!0})}))})(t,this.ef.Fh);this.kx=new Array(e.regions.length).map((t=>{})).fill(void 0);const i=Hh[t];if(!i)throw new Error("Unidentified map type.");for(const t of e.outliers)for(const e of t.geometry){const t=this.vx.vc(this.ct,Ws.Simple).lo(e).setMouseInteractions(this.Fu).ps(this.tx).$h(this.ix);this.JS.push(t)}if(t===zh.USA){const t=25.8,e=29.7;this.QS.push(this.vx.gc(this.ct).setMouseInteractions(!1).ps(this.sx).$h(this.hx).Sn({x:-126,y:t}).q({x:10,y:e-t}),this.vx.gc(this.ct).setMouseInteractions(!1).ps(this.sx).$h(this.hx).Sn({x:-113,y:t}).q({x:7,y:e-t}))}for(let s=0;sthis.Eu(e,i,r,s))).setMouseLeaveEventHandler(((t,i)=>this.Vu(e,i,r,s))).setMouseClickEventHandler(this.Wu).setMouseDoubleClickEventHandler(this.Uu).setMouseDownEventHandler(this.$u).setMouseUpEventHandler(this.Yu).setMouseMoveEventHandler(((t,i)=>this.Gu(e,i,r,s))).setMouseDragStartEventHandler(this.Xu).setMouseDragEventHandler(this.ju).setMouseDragStopEventHandler(this.Zu).setMouseWheelEventHandler(this.Ku).setTouchStartEventHandler(((t,i)=>this.qu(e,i,r,s))).setTouchMoveEventHandler(((t,i)=>this.Ju(e,i,r,s))).setTouchEndEventHandler(((t,i)=>this.Qu(e,i,r,s))),n.push(e)}this.qS.push(n)}if(this._x.nc(this.qS.flat()),this.wx(),this.gx=i,this.mx(t,this.ct,i),this.lx=e,this.Cx){for(const t of this.Cx)this.invalidateRegionValues(t);this.Cx=void 0}this.ru()}mx(t,e,i){const s=Wh[t],r=e.x.getCellSize(),n=e.y.getCellSize()/r,o={min:{x:i.min.x,y:i.min.y},max:{x:i.max.x,y:i.max.y}};if(ns){const t=(o.max.y-o.min.y)*(n/s-1);o.min.y-=t/2,o.max.y+=t/2}e.x.Z(o.min.x,o.max.x),e.y.Z(o.min.y,o.max.y);const h=this.ct.x.Vt(),a=this.ct.y.Vt();this.P.emit("viewChange",{latitudeRange:{start:o.min.y,end:o.max.y},longitudeRange:{start:o.min.x,end:o.max.x},margin:{top:a[1],bottom:a[0],left:h[0],right:h[1]}})}Ix(t){for(let e=0;ei.ps(t).$h(e)));this.Li.Bi()}Tx(t,e,i){const s=void 0!==e?i.getColors(e):i.getFallbackColor(),r=new z({color:s});for(const e of t)e.ps(r)}Sx(t,e,i){this.Fx={polygon:t,region:e,iRegion:i},this.Li.Bi()}xx(t,e,i){this.Fx&&t===this.Fx.polygon&&(this.Fx=void 0,this.Li.Bi())}setAnimationsEnabled(t){return this.Oi=!t,this}getAnimationsEnabled(){return this.Oi}getMinimumSize(){}dd(){return[this]}ru(){super.ru(),super.$g(),po.ip(this.Kg,this.jg);const t=p(this.ct.x.Bt(),this.ct.y.Bt(),this.ct.x.Ot(),this.ct.y.Ot());this.vx.Wy(t);const e=this.Li.xh()||this.bx;if(this.Fx&&e){const t=this.kx&&this.kx[this.Fx.iRegion];let i=nt(e,this.engine.scale,this.ct);i={x:At(i.x,this.ct.x.getInnerStart(),this.ct.x.getInnerEnd()),y:At(i.y,this.ct.y.getInnerStart(),this.ct.y.getInnerEnd())};let s=i.x,r=i.y;const n=this.Fx.region.transform;this.Fx.region.outlier&&n&&(s=(s-n.translate.x-n.vertexBoundaries.min.x)/n.scale.x+n.vertexBoundaries.min.x,r=(r-n.translate.y-n.vertexBoundaries.min.y)/n.scale.y+n.vertexBoundaries.min.y),this.Mx.setPosition(i).setVisible(!0).getResultTable().setContent(this.ox(new wh,this.Fx.region,t,s,r,this).wu())}else this.Mx.setVisible(!1);return this.Mx.Gs().ru(),this}dispose(){return this.vx.G(),this.Mx.dispose(),co(this.ct),super.dispose()}X(){return super.X(),this.ct.X(),this}j(){return super.j(),this.ct.j(),this}ed(){return he(this.Vr)}attach(t,e){return t.setText(this.getTitle()),t.setButtonOffStrokeStyle(t.getButtonOffStrokeStyle().setThickness(1)),t.setButtonOnStrokeStyle(t.getButtonOnStrokeStyle().setThickness(1)),t.setOn(!0).setLocked(!0),t.onMouseEnter((()=>{})),t.onMouseLeave((()=>{})),this.onMouseEnter((()=>t.setHighlight(!0))),this.onMouseLeave((()=>t.setHighlight(!1))),this.onTouchStart((()=>t.setHighlight(!0))),this.onTouchEnd((()=>t.setHighlight(!1))),oe(t,this.hs,{fill:this.Vr}),this}}const $h=(t,e,i,s,r,n)=>(t.addRow(`${e.name}`).addRow(jh(s,r)),void 0!==i&&t.addRow(`Region value: ${i.toFixed(1)}`),t),jh=(t,e)=>{const i=t>0,s=e>0;return`${[le(Math.abs(0|t),2),"° ",le(Math.abs(0|(t<0?t=-t:t)%1*60),2),"' "].join("")+(i?"E":"W")}, ${[le(Math.abs(0|e),2),"° ",le(Math.abs(0|(e<0?e=-e:e)%1*60),2),"' "].join("")+(s?"N":"S")}`};class Zh extends Ni{constructor(t,e,i,s,r,n,o,h,a){super(t,e,e.Px(i),s,r,{numeric:e.Dx({amplitude:s.polarAmplitudeAxisNumericTicks,radial:s.polarAmplitudeAxisNumericTicks}),datetime:e.Dx({amplitude:s.polarAmplitudeAxisDateTimeTicks,radial:s.polarAmplitudeAxisDateTimeTicks}),time:e.Dx({amplitude:s.polarAmplitudeAxisTimeTicks,radial:s.polarAmplitudeAxisTimeTicks})},{type:"linear"}),this.Bx=n,this.Lx=o,this.Ox=h,this.iu=a,this.Rx=i,this.Ex=e.Dx({amplitude:s.polarAmplitudeAxisStrokeStyle,radial:s.polarRadialAxisStrokeStyle}),this.ds=h.ue(i).setMouseInteractions(!1).Ss(e.Dx({amplitude:s.polarAmplitudeAxisTitleFont,radial:s.polarRadialAxisTitleFont})).ps(e.Dx({amplitude:s.polarAmplitudeAxisTitleFillStyle,radial:s.polarRadialAxisTitleFillStyle})),this.Ms=this.iu.lg([this.ds]).vs(s.effectsText)}setStrokeStyle(t){return this.Ex="function"==typeof t?t(this.Ex):t,this.Lx.Bi(),this}getStrokeStyle(){return this.Ex}$s(t,e){return new Kh(e,t,this.Rx,this.Ox,this.Ox,this.zx(this.Bx,this.Rx),this.Ox._u(this.Rx).setMouseInteractions(!1))}Ys(t,e){const i=this.Vx(this.Rx,t);this.Nx&&!1===this.Nx(t)?t._i.setVisible(!1):t._i.setVisible(!0).Sn(Ke(this.Gx(this.Rx,t.u),i.padding)).kn(i.alignment).xs(i.rotation).bn(i.offset.x,i.offset.y),this.Hx(this.Rx,t.Wx,t.Ux,t)}setMouseInteractions(t){return this}ru(){this.Bs({physicalAxisSize:0});const t=this.Zs(((t,e)=>{const i=e.qi.Ws,s=.5*this.Ex.getThickness()+i.tickLength+i.tickPadding+Math.abs(e._i.Gs().Et().y/this.Rx.yi().y)+i.labelPadding;return Math.max(t,s)}),0);return this.$x(this.Rx,this.Ex,t),this.Yx(this.Rx,this.ds,t),t}}class Kh extends io{constructor(t,e,i,s,r,n,o,h){super(t,e,s,i,r,i,h),this.Wx=n,this.Ux=o,n.setMouseInteractions(!1),this.de.push(n,o)}}class Jh extends Zh{constructor(t,e,i,s,r,n,o,h,a){super(t,Qh,e,i,s,r,n,o,h),this.sm=this.Lx._u(this.Rx).setMouseInteractions(!1),this.Xx=a,this.setScrollStrategy(Bi.expansion),this.setTickStrategy(ki.Numeric),this.setTitle("Amplitude")}Js(){return this.Xx()}re(t,e){return so(t,e,this.Rx.y)}oe(t,e,i){const s=2*(e-t),r=this.Rx.x.li(s);return{min:t-i*r,max:e+i*r}}Gx(t,e){return{x:t.jx()?e-t.Zx().start:t.Zx().start-e,y:0}}zx(t,e){return t.kc(e)}Hx(t,e,i,s){const r=s.qi.Ws,n=t.jx()?s.u-t.Zx().start:t.Zx().start-s.u;Mt(s.u,t.Zx().start)||Mt(s.u,t.Zx().end)?e.setVisible(!1):e.setVisible(!0).Zo(0).Ko(360).ia(void 0).ta(0).qo(n).ia(60).ps(F).$h(r.gridStrokeStyle);const o=.5*this.Ex.getThickness();i.la({x:n,y:-o*t.yi().y}).Ko({x:n,y:-(o+r.tickLength)*t.yi().y}).ea(r.tickStyle)}Vx(t,e){const i=e.qi.Ws;return{alignment:{x:0,y:1},padding:{x:0,y:t.yi().y*-(.5*this.Ex.getThickness()+i.tickLength+i.tickPadding)},rotation:0,offset:{x:0,y:0}}}$x(t,e,i){const s=t.jx()?t.Zx().end-t.Zx().start:t.Zx().start-t.Zx().end;this.sm.la({x:0,y:0}).Ko({x:s,y:0}).ea(e)}Yx(t,e,i){const s=t.jx()?(t.Zx().start+t.Zx().end)/2-t.Zx().start:t.Zx().start-(t.Zx().start+t.Zx().end)/2;e.kn({x:0,y:1}).Sn({x:s,y:-i*t.yi().y})}}const Qh={te:t=>t.getAmplitudeMin(),ie:t=>t.getAmplitudeMax(),ee:t=>{},Px:t=>({getInnerStart:()=>t.Zx().start,getInnerEnd:()=>t.Zx().end,Z:(e,i)=>t.Kx(e,i),rt:(e,i,s,r,n)=>t.y.rt(e,i,s,r,n)}),Dx:t=>t.amplitude};class ta extends Zh{constructor(t,e,i,s,r,n,o,h){super(t,ia,e,i,s,r,n,o,h),this.qx=90,this.Jx=12,this.Qx=ea,this.sm=this.Lx.kc(this.Rx).setMouseInteractions(!1),this.Nx=t=>{let e=180*(t.u-this.Rx.tb())/Math.PI%360;for(;e<0;)e+=360;for(;e>360;)e-=360;if(e>=0&&e<=20||e>=340&&e<=360)return!1},this.Fi=void 0,this.setTickStyle(i.polarRadialAxisTickStyle),this.setTitle("Degrees"),this.setNorth(this.qx)}setTickStyle(t){return this.ib="function"==typeof t?t(this.ib):t,this.sb(),this.Lx.Bi(),this}getTickStyle(){return this.ib}setTickFormattingFunction(t){return this.Qx=t,this.sb(),this.Lx.Bi(),this}getTickFormattingFunction(){return this.Qx}setClockwise(t){this.Rx.eb(t);const e=this.qx*Math.PI/180;return t?this.Rx.hb(e+Math.PI/2):this.Rx.hb(e-Math.PI/2),this.Lx.Bi(),this}getClockwise(){return!this.Rx.rb()}setNorth(t){for(;t<0;)t+=360;t%=360,this.qx=t;const e=t*Math.PI/180;return this.getClockwise()?this.Rx.hb(e+Math.PI/2):this.Rx.hb(e-Math.PI/2),this.Lx.Bi(),this}getNorth(){return 180*this.Rx.tb()/Math.PI}setDivision(t){return this.Jx=t,this.sb(),this.Lx.Bi(),this}getDivision(){return this.Jx}Js(){return[]}re(t,e){return e}oe(t,e,i){return{min:t,max:e}}Gx(t,e){const i=t.rb()?1:-1,s=t.tb(),r=t.jx()?t.Zx().end-t.Zx().start:t.Zx().start-t.Zx().end;return{x:Math.cos((e-s)*i)*r,y:Math.sin((e-s)*i)*r}}zx(t,e){return t._u(e)}Hx(t,e,i,s){const r=this.ib,n=t.rb()?1:-1,o=t.tb(),h=(s.u-o)*n,a=Math.cos(h),l=Math.sin(h),u=t.jx()?t.Zx().end-t.Zx().start:t.Zx().start-t.Zx().end,c={x:a*u,y:l*u};e.la({x:0,y:0}).Ko(c);const d={x:c.x+a*r.tickLength*t.yi().x,y:c.y+l*r.tickLength*t.yi().y};i.la(c).Ko(d),e.ea(r.gridStrokeStyle),i.ea(r.tickStyle)}Vx(t,e){const i=this.ib,s=t.rb()?1:-1,r=t.tb();let n,o=(e.u-r)*s;for(;o<0;)o+=2*Math.PI;for(;o>=2*Math.PI;)o-=2*Math.PI;n=o>0&&o<=Math.PI?-o+Math.PI/2:-o-Math.PI/2;const h=i.tickLength+i.tickPadding,a=Math.cos(o)*h*t.yi().x,l=Math.sin(o)*h*t.yi().y;return{alignment:{x:0,y:0},padding:{x:a,y:l},rotation:180*n/Math.PI,offset:{x:a,y:l}}}$x(t,e,i){const s=t.jx()?t.Zx().end-t.Zx().start:t.Zx().start-t.Zx().end;this.sm.Zo(0).Ko(360).ta(0).qo(s+.5*e.getThickness()*t.yi().x).ia(60).ps(F).$h(e)}Yx(t,e,i){const s=t.tb(),r=this.Vx(t,{u:0+s}),n=t.jx()?t.Zx().end-t.Zx().start:t.Zx().start-t.Zx().end;e.kn(r.alignment).xs(r.rotation).bn(r.offset.x,r.offset.y).Sn(Ke({x:n,y:0},r.padding))}sb(){this.Cs({Ai:[],wi:[{_i:"Radial ticks",xg:0,Ws:this.ib,Ns:this.Qx,pe:(t,e,i,s)=>{const r=[],n=2*Math.PI/this.Jx;for(let t=0;t<2*Math.PI;t+=n)r.push(t);return r},Ji:{Xs:()=>{},Qi:()=>!1},me:void 0}],vi:ea,Ts:void 0,Is:void 0})}}const ea=(t,e,i)=>(180*t/Math.PI).toFixed(0),ia={te:t=>{},ie:t=>{},ee:t=>{},Px:t=>({getInnerStart:()=>0,getInnerEnd:()=>2*Math.PI,Z:(t,e)=>{},rt:(e,i,s,r,n)=>t.x.rt(e,i,s,r,n)}),Dx:t=>t.radial};class sa extends Zr{constructor(t,e,i,s,r,n){super(e,i,r,n),this.ac="Sector",this.nb=0,this.ob=1*Math.PI/2,this.ab=void 0,this.lb=void 0,this.Lr=t,this.Rx=s,this.gp=this.Lr.kc(this.Rx).Ir(this.getHighlight()),this.rc(this.gp),this.Vr=r.polarSectorFillStyle,this.$r=r.polarSectorStrokeStyle,this.setMouseInteractions(!1)}setAngleStart(t){return this.nb=At(t,0,360),this.Lr.Bi(),this}getAngleStart(){return this.nb}setAngleEnd(t){return this.ob=At(t,0,360),this.Lr.Bi(),this}getAngleEnd(){return this.ob}setAmplitudeStart(t){return this.ab=t,this.Lr.Bi(),this}getAmplitudeStart(){return this.ab}setAmplitudeEnd(t){return this.lb=t,this.Lr.Bi(),this}getAmplitudeEnd(){return this.lb}setFillStyle(t){return this.Vr="function"==typeof t?t(this.Vr):t,this.Lr.Bi(),this}getFillStyle(){return this.Vr}setStrokeStyle(t){return this.$r="function"==typeof t?t(this.$r):t,this.Lr.Bi(),this}getStrokeStyle(){return this.$r}ru(){const t=this.Rx.Zx(),e=180*this.Rx.tb()/Math.PI,i=void 0!==this.ab?At(this.ab,t.start,t.end):t.start,s=void 0!==this.lb?At(this.lb,t.start,t.end):t.end,r=this.Rx.jx()?i-t.start:t.start-i,n=this.Rx.jx()?s-t.start:t.start-s,o=Math.min(r,n),h=Math.max(r,n),a=this.Rx.rb()?1:-1,l=Math.abs(this.ob-this.nb);this.gp.Zo((this.nb-e)*a).Ko((this.ob-e)*a).ta(100*o/h).qo(h).ps(this.Vr).$h(this.$r).ia(Math.ceil(l/2))}mc(t,e){t.Ir(e),this.Lr.Bi()}attach(t,e=!0){return super.attach(t,e),oe(t,this.hs,{fill:this.Vr,stroke:this.$r}),this}}class ra extends Zr{constructor(){super(...arguments),this.um=!0,this.ub=!0}setAutoScrollingEnabled(t){return this.um=t,this.qa.Li.Bi(),this}getAutoScrollingEnabled(){return this.um}xm(){}ru(){}bm(){}setCursorEnabled(t){return this.ub=t,this}getCursorEnabled(){return this.ub}}class na extends ra{constructor(t,e,i,s,r,n){super(e,i,r,n),this.ox=oa,this.Lr=t,this.qa=e,this.scale=s}getAmplitudeMin(){return this.cb?this.cb.min:void 0}getAmplitudeMax(){return this.cb?this.cb.max:void 0}setCursorResultTableFormatter(t){return this.ox=t,this.qa.Li.Bi(),this}getCursorResultTableFormatter(){return this.ox}setCursorEnabled(t){return super.setCursorEnabled(t)}}const oa=(t,e,i,s,r)=>t.addRow(e.getName()).addRow("Angle:","",Math.round(i).toString()).addRow("Amplitude","",r(s)),ha=(t,e,i)=>t*(1-i)+e*i,aa=(t,e,i,s,r)=>{if(void 0===e.value||void 0===i.value||void 0===s.value||void 0===r.value)return;const n=(t.x-i.point.x)/(r.point.x-i.point.x),o=(r.point.y-i.point.y)*n+i.point.y,h=(t.x-e.point.x)/(s.point.x-e.point.x),a=(s.point.y-e.point.y)*h+e.point.y,l=(t.y-a)/(o-a),u=ha(i.value,r.value,n),c=ha(e.value,s.value,h);return ha(c,u,l)},la=(t,e)=>{const i=[],s=e.Zx().start,r=e.Zx().end,n=e.jx(),o=e.rb()?1:-1,h=e.tb(),a=Math.abs(r-s),l=Math.min(s,r)+.001*a,u=Math.max(s,r)-.001*a;for(const e of t){const t=At(e.amplitude,l,u),r=e.angle*Math.PI/180-h,a=Math.cos(r*o)*(n?t-s:s-t),c=Math.sin(r*o)*(n?t-s:s-t),d=e.color;i.push({x:a,y:c,color:d})}return i},ua=t=>{const e={min:Me,max:Ae};for(const i of t)e.min=Math.min(e.min,i.amplitude),e.max=Math.max(e.max,i.amplitude);return e},ca=t=>t.slice().map((t=>t.angle>=0&&t.angle<=360?t:{...t,angle:t.angle%360})),da=(t,e)=>{let i=hi(t);for(e.rb()||(i*=-1),i+=180*e.tb()/Math.PI;i<0;)i+=360;i%=360;const s=je(t),r=e.Zx(),n=Math.abs(r.end-r.start);return{angle:i,amplitude:ha(r.start,r.end,s/n)}};class fa extends na{constructor(t,e,i,s,r,n){super(t,e,i,s,r,n),this.ac="Line Series",this.fb=[],this.gb=!1,this.pb=!1;const o=this.qa.getSeries().length;this.sa=ue(this.hs.polarLineSeriesStrokeStyle,o),this.mb=t.Gp(s,void 0,[Bo.UserSeries]).ea(this.sa).Ir(this.getHighlight()).Wn(ps.Nearest),this.rc(this.mb)}setData(t){return this.fb=ca(t),this.gb=!0,this.cb=ua(this.fb),this.Lr.Bi(),this}setStrokeStyle(t){this.sa="function"==typeof t?t(this.sa):t;const e=this.sa;return this.mb.ea(e),this.Lr.Bi(),this}getStrokeStyle(){return this.sa}setConnectDataAutomaticallyEnabled(t){return this.pb=t,this.Lr.Bi(),this}getConnectDataAutomaticallyEnabled(){return this.pb}Qs(){return this.um&&this.fb.length>0&&this.getVisible()}mc(t,e){t.Ir(e),this.Lr.Bi()}jS(t,e){return this.yb(t,this.mb)}solveNearestFromScreen(t){return this.yb(t,this.mb)}yb(t,e){const i=e.Sb(t);if(!i)return;const{angle:s,amplitude:r}=da(i,this.scale);return Oh(i,this.scale,this.ox(new wh,this,s,r,this.qa.getAmplitudeAxis().formatValue).wu(),this,this.sa.getFillStyle())}ru(){if(this.gb||this.scale.xb()){const t=la(this.fb,this.scale),e=ze(t);this.pb?(t.push({...t[0]}),this.mb.Io(!0)):this.mb.Io(!1),this.mb.qn().Kn(t).Cr(e),this.gb=!1,this.mb.Gs()}}attach(t,e=!0){return super.attach(t,e),oe(t,this.hs,{stroke:this.sa}),this}}class ga extends na{constructor(t,i,s,r,n,o){super(t,i,s,r,n,o),this.ac="Point Line Series",this.fb=[],this.gb=!1,this.pb=!1,this.bb=3,this.sn=0,this.vb=e.PointShape.Circle;const h=this.qa.getSeries().length;this.Vr=ue(this.hs.polarPointLineSeriesFillStyle,h),this.sa=ue(this.hs.polarPointLineSeriesStrokeStyle,h),this.mb=t.Gp(r,void 0,[Bo.UserSeries]).ea(this.sa).Ir(this.getHighlight()).Wn(ps.Nearest),this.rc(this.mb),this.Mb=t.Bm(r).ps(this.Vr).Yn(this.vb).q(this.bb).Ir(this.getHighlight()).Wn(ps.Nearest),this.rc(this.Mb)}setData(t){return this.fb=ca(t),this.gb=!0,this.cb=ua(this.fb),this.Lr.Bi(),this}setStrokeStyle(t){this.sa="function"==typeof t?t(this.sa):t;const e=this.sa;return this.mb.ea(e),this.Lr.Bi(),this}getStrokeStyle(){return this.sa}setPointFillStyle(t){this.Vr="function"==typeof t?t(this.Vr):t;const e=this.Vr;return this.Mb.ps(e),this.Lr.Bi(),this}getPointFillStyle(){return this.Vr}setPointSize(t){return this.bb=t,this.Mb.q(t),this.Lr.Bi(),this}getPointSize(){return this.bb}setPointShape(t){return this.vb=t,this.Mb.Yn(this.vb),this}getPointShape(){return this.vb}setPointRotation(t){return this.sn=t,this.Mb.xs(t),this.Lr.Bi(),this}getPointRotation(){return this.sn}setConnectDataAutomaticallyEnabled(t){return this.pb=t,this.Lr.Bi(),this}getConnectDataAutomaticallyEnabled(){return this.pb}Qs(){return this.um&&this.fb.length>0&&this.getVisible()}mc(t,e){t.Ir(e),this.Lr.Bi()}jS(t,e){return this.yb(t,this.mb)}solveNearestFromScreen(t){return this.yb(t,this.mb)}yb(t,e){const i=e instanceof zs?e.jS(t):e.Sb(t);if(!i)return;const{angle:s,amplitude:r}=da(i,this.scale);return Oh(i,this.scale,this.ox(new wh,this,s,r,this.qa.getAmplitudeAxis().formatValue).wu(),this,"color"in i&&this.Vr instanceof V?new z({color:i.color}):this.Vr)}ru(){if(this.gb||this.scale.xb()){const t=la(this.fb,this.scale),e=ze(t);this.pb?(t.push({...t[0]}),this.mb.Io(!0)):this.mb.Io(!1),this.mb.qn().Kn(t).Cr(e),this.Mb.qn().Kn(t).Cr(e),this.gb=!1,this.mb.Gs(),this.Mb.Gs()}}}class ma extends na{constructor(t,i,s,r,n,o){super(t,i,s,r,n,o),this.ac="Point Series",this.fb=[],this.gb=!1,this.bb=3,this.sn=0,this.vb=e.PointShape.Circle;const h=this.qa.getSeries().length;this.Vr=ue(this.hs.polarPointSeriesFillStyle,h),this.Mb=t.Bm(r).ps(this.Vr).Yn(this.vb).q(this.bb).Ir(this.getHighlight()).Wn(ps.Nearest),this.rc(this.Mb)}setData(t){return this.fb=ca(t),this.gb=!0,this.cb=ua(this.fb),this.Lr.Bi(),this}setPointFillStyle(t){this.Vr="function"==typeof t?t(this.Vr):t;const e=this.Vr;return this.Mb.ps(e),this.Lr.Bi(),this}getPointFillStyle(){return this.Vr}setPointSize(t){return this.bb=t,this.Mb.q(t),this.Lr.Bi(),this}getPointSize(){return this.bb}setPointShape(t){return this.vb=t,this.Mb.Yn(this.vb),this}getPointShape(){return this.vb}setPointRotation(t){return this.sn=t,this.Mb.xs(t),this.Lr.Bi(),this}getPointRotation(){return this.sn}Qs(){return this.um&&this.fb.length>0&&this.getVisible()}mc(t,e){t.Ir(e),this.Lr.Bi()}jS(t,e){const i=this.Mb.jS(t);if(!i)return;const{angle:s,amplitude:r}=da(i,this.scale);return Oh(i,this.scale,this.ox(new wh,this,s,r,this.qa.getAmplitudeAxis().formatValue).wu(),this,"color"in i&&this.Vr instanceof V?new z({color:i.color}):this.Vr)}solveNearestFromScreen(t){return this.jS(t,!1)}ru(){if(this.gb||this.scale.xb()){const t=la(this.fb,this.scale),e=ze(t);this.Mb.qn().Kn(t).Cr(e),this.gb=!1,this.Mb.Gs()}}attach(t,e=!0){return super.attach(t,e),oe(t,this.hs,{fill:this.Vr}),this}}class pa{constructor(t,e,i,s){this.P=new r.Eventer,this._b=!1,this.qa=t,this.Ab=e,this.Lm=i,this.Dn=s}setGeometry(t){return this.wb=t,this._b=!0,this.qa.Li.Bi(),this}getGeometry(){return this.wb}setMouseInteractions(t){return this.Dn.setMouseInteractions(t),this}dispose(){return this.Dn.dispose(),this.Ab(this),this.P.emit("dispose",this),this}onDispose(t){return this.P.on("dispose",t)}offDispose(t){return this.P.off(t,"dispose")}setVisible(t){const e=this.Dn.getVisible()!==t;return this.Dn.setVisible(t),e&&this.P.emit("visibleStateChanged",this,t),this.qa.Li.Bi(),this}getVisible(){return this.Dn.getVisible()}onVisibleStateChanged(t){return this.P.on("visibleStateChanged",t)}offVisibleStateChanged(t){return this.P.off(t,"visibleStateChanged")}}const ya=(t,e,i)=>{const s=e.ct,r=i.ct;let n=(t.x-s.getInnerStart())/(s.getInnerEnd()-s.getInnerStart()),o=(t.y-r.getInnerStart())/(r.getInnerEnd()-r.getInnerStart());return 1===i.Kf&&(n=1-n),1===e.Kf&&(o=1-o),u(o,n)};class xa extends Bh{constructor(t,e,i,s,r,n,o,h,a){super(t,e,oo(i.ct,s.ct),r,n,a),this.kb=!1,this.Cb=!1,this.Tb=!0,this.Ib=!0,this.Fb=!1,this.Pb=!1,this.setGridStrokeYStyle=t=>(this.Db.setGridStrokeStyle(t),this),this.getGridStrokeYStyle=()=>this.Db.getGridStrokeStyle(),this.axisX=i,this.axisY=s,this.Bb=o,this.Lb=h,this.Ob=this.axisX.Mg(!1,this.Bb).setMouseInteractions(!1).setAllocatesAxisSpace(!1),this.Db=this.axisY.Mg(!1,this.Lb).setMouseInteractions(!1).setAllocatesAxisSpace(!1)}dispose(){return super.dispose(),this.Ob.dispose(),this.Db.dispose(),this}pointAt(t){return super.pointAt(t),this.setPosition(nt(t.location,t.scale,this.scale)),this}setPosition(t){super.setPosition(t),this.Ob.setValue(t.x),this.Db.setValue(t.y);const e=ya(u(this.Ob.getValue(),this.Db.getValue()),this.axisX,this.axisY);return this.Ob.setGridStrokeLength(this.Fb?e.x:1),this.Db.setGridStrokeLength(this.Pb?e.y:1),this}ru(){this.Ob.setVisible(this.Ri&&this.IS).setMarkerVisible(this.Ri&&this.IS&&this.kb),this.Db.setVisible(this.Ri&&this.IS).setMarkerVisible(this.Ri&&this.IS&&this.Cb);const t=ya(u(this.Ob.getValue(),this.Db.getValue()),this.axisX,this.axisY);return this.Ob.setGridStrokeLength(this.Fb?t.x:1),this.Db.setGridStrokeLength(this.Pb?t.y:1),super.ru()}setGridStrokeXCut(t){return this.Fb=t,this.Lr.Bi(),this}getGridStrokeXCut(){return this.Fb}setGridStrokeYCut(t){return this.Pb=t,this.Lr.Bi(),this}getGridStrokeYCut(){return this.Pb}setGridStrokeXStyle(t){return this.Ob.setGridStrokeStyle(t),this}getGridStrokeXStyle(){return this.Ob.getGridStrokeStyle()}setTickMarkerXVisible(t){return this.kb=t,this.Lr.Bi(),this}getTickMarkerXVisible(){return this.kb}setTickMarkerYVisible(t){return this.Cb=t,this.Lr.Bi(),this}getTickMarkerYVisible(){return this.Cb}setTickMarkerX(t){return this.Ob.setMarker(t),this}setTickMarkerY(t){return this.Db.setMarker(t),this}getTickMarkerX(){return this.Ob.getMarker()}getTickMarkerY(){return this.Db.getMarker()}}class Sa extends Eh{constructor(t,e,i,s,r,n,o,h){super(t,e,i,s,r,h),this.Fb=!1,this.Pb=!1,this.Rb=!1,this.Eb=!1,this.zb=new Map,this.Vb=new Map,this.kb=!0,this.Cb=!0,this.FS=s,this.PS=r,this.Bb=n,this.Lb=o,this.Nb=h.cursorGridStrokeStyleX,this.Gb=h.cursorGridStrokeStyleY}dispose(){return super.dispose(),this.zb.forEach((t=>t.dispose())),this.Vb.forEach((t=>t.dispose())),this.Hb=void 0,this.Wb=void 0,this}ru(){return this.Hb&&this.Hb.setVisible(this.Ri&&this.IS).setMarkerVisible(this.Ri&&this.IS&&this.kb),this.Wb&&this.Wb.setVisible(this.Ri&&this.IS).setMarkerVisible(this.Ri&&this.IS&&this.Cb),super.ru()}pointAt(t){const{location:e}=t,{series:i}=t,{axisX:s}=i,{axisY:r}=i,n=this.Yi(s,!0),o=this.Yi(r,!1);n!==this.Hb&&this.Hb&&this.Hb.setVisible(!1),o!==this.Wb&&this.Wb&&this.Wb.setVisible(!1),n.setValue(e.x),o.setValue(e.y);const h=ya(u(e.x,e.y),s,r);return n.setGridStrokeLength(this.Fb?h.x:1),o.setGridStrokeLength(this.Pb?h.y:1),this.Hb=n,this.Wb=o,super.pointAt(t)}OS(t){if(super.OS(t),t){const e=e=>e.setTextFillStyle(t);this.Hb&&this.Rb&&this.Hb.setMarker(e),this.Wb&&this.Eb&&this.Wb.setMarker(e)}}Yi(t,e){let i=(e?this.zb:this.Vb).get(t);return i||(e?(i=t.Mg(!1,this.Bb),this.zb.set(t,i)):(i=t.Mg(!1,this.Lb),this.Vb.set(t,i)),this.Hs(i,e),i.setMouseInteractions(!1).setAllocatesAxisSpace(!1)),i}Hs(t,e){const i=e?this.Nb:this.Gb;return t.setGridStrokeStyle(i),t.setMouseInteractions(!1),(e?this.kb:this.Cb)?t.setMarkerVisible(!0):t.setMarkerVisible(!1),t}setGridStrokeXCut(t){return this.Fb=t,this.Lr.Bi(),this}getGridStrokeXCut(){return this.Fb}setGridStrokeYCut(t){return this.Pb=t,this.Lr.Bi(),this}getGridStrokeYCut(){return this.Pb}setGridStrokeXStyle(t){return this.Nb=t instanceof Function?t(this.getGridStrokeXStyle()):t,this.zb.forEach((t=>t.setGridStrokeStyle(this.Nb))),this}getGridStrokeXStyle(){return this.Nb}setGridStrokeYStyle(t){return this.Gb=t instanceof Function?t(this.getGridStrokeYStyle()):t,this.Vb.forEach((t=>t.setGridStrokeStyle(this.Gb))),this}getGridStrokeYStyle(){return this.Gb}setTickMarkerXVisible(t){return this.kb=t,this.Lr.Bi(),this}getTickMarkerXVisible(){return this.kb}setTickMarkerYVisible(t){return this.Cb=t,this.Lr.Bi(),this}getTickMarkerYVisible(){return this.Cb}setTickMarkerX(t){return this.zb.forEach((e=>e.setMarker(t))),this.Bb=this.Bb.addStyler(t),this.Lr.Bi(),this}setTickMarkerY(t){return this.Vb.forEach((e=>e.setMarker(t))),this.Lb=this.Lb.addStyler(t),this.Lr.Bi(),this}setTickMarkerXAutoTextStyle(t){return this.Rb=t,this.Lr.Bi(),this}getTickMarkerXAutoTextStyle(){return this.Rb}setTickMarkerYAutoTextStyle(t){return this.Eb=t,this.Lr.Bi(),this}getTickMarkerYAutoTextStyle(){return this.Eb}}class va extends kh{constructor(t,e,i,s,r){super(t,e,r),this.FS=t,this.PS=e,this.Bb=i,this.Lb=s,this.RS=r}}class ba extends va{constructor(){super(...arguments),this.zS=(t,e,i,s)=>this.ES(new Sa(t,e,i,this.FS,this.PS,this.Bb,this.Lb,s),s),this.addStyler=t=>new ba(this.FS,this.PS,this.Bb,this.Lb,this.RS.map((t=>t)).concat(t)),this.setPointMarker=t=>new ba(t,this.PS,this.Bb,this.Lb,this.RS.map((t=>t))),this.setResultTableBackground=t=>new ba(this.FS,t,this.Bb,this.Lb,this.RS.map((t=>t)))}}class Ma extends va{constructor(){super(...arguments),this.VS=(t,e,i,s,r)=>this.ES(new xa(t,e,i,s,this.FS,this.PS,this.Bb,this.Lb,r),r),this.addStyler=t=>new Ma(this.FS,this.PS,this.Bb,this.Lb,this.RS.map((t=>t)).concat(t)),this.setPointMarker=t=>new Ma(t,this.PS,this.Bb,this.Lb,this.RS.map((t=>t))),this.setResultTableBackground=t=>new Ma(this.FS,t,this.Bb,this.Lb,this.RS.map((t=>t)))}}const Aa=new ba(pn,pn,to.PointableTextBox,to.PointableTextBox,[(t,e)=>{Ph(t),t.setTickMarkerX((t=>{t.setEffect(!0).setTextFont(e.cursorTickMarkerXTextFont).setTextFillStyle(e.cursorTickMarkerXTextFillStyle),qr(t)&&t.setBackground((t=>t.setFillStyle(e.cursorTickMarkerXBackgroundFillStyle).setStrokeStyle(e.cursorTickMarkerXBackgroundStrokeStyle)))})),t.setTickMarkerY((t=>{t.setEffect(!0).setTextFont(e.cursorTickMarkerYTextFont).setTextFillStyle(e.cursorTickMarkerYTextFillStyle),qr(t)&&t.setBackground((t=>t.setFillStyle(e.cursorTickMarkerYBackgroundFillStyle).setStrokeStyle(e.cursorTickMarkerYBackgroundStrokeStyle)))}))}]),wa=new Ma(xn,pn,to.PointableTextBox,to.PointableTextBox,[(t,e)=>{Lh(t,e),t.setTickMarkerX((t=>{t.setEffect(!0).setTextFont(e.cursorTickMarkerXTextFont).setTextFillStyle(e.cursorTickMarkerXTextFillStyle),qr(t)&&t.setBackground((t=>t.setFillStyle(e.cursorTickMarkerXBackgroundFillStyle).setStrokeStyle(e.cursorTickMarkerXBackgroundStrokeStyle)))})),t.setTickMarkerY((t=>{t.setEffect(!0).setTextFont(e.cursorTickMarkerYTextFont).setTextFillStyle(e.cursorTickMarkerYTextFillStyle),qr(t)&&t.setBackground((t=>t.setFillStyle(e.cursorTickMarkerYBackgroundFillStyle).setStrokeStyle(e.cursorTickMarkerYBackgroundStrokeStyle)))}))}]),Da=(t,i,s)=>{switch(t){case e.UIVisibilityModes.always:return!0;case e.UIVisibilityModes.never:return!1;case e.UIVisibilityModes.whenDragged:return s;case e.UIVisibilityModes.whenHovered:return i&&!s;case e.UIVisibilityModes.whenHoveredOrDragged:return s||i;case e.UIVisibilityModes.whenNotDragged:return!s;default:return!1}},Ta=(t,e)=>Math.min(Math.max(t,e.getInnerStart()),e.getInnerEnd());class Ea{constructor(t,i,s,n,o,h){this.Ub=e.UIVisibilityModes.always,this.$b=e.UIVisibilityModes.always,this.pr=!0,this.ce=!1,this.Yb=!1,this.Xb=!1,this.qr=u(0,0),this.Zl=e.UIDraggingModes.draggable,this.Kl=void 0,this.P=new r.Eventer,this.Ri=!0,this.jb=(t,i,s)=>{this.Yb=!0,this.Lr.Bi();const r=this.Zl===e.UIDraggingModes.notDraggable?this.Zl:s||this.Zl;this.Kl=this.Lr.Li.Ae(r===e.UIDraggingModes.notDraggable?e.MouseStyles.Restricted:r===e.UIDraggingModes.draggable?e.MouseStyles.Move:r===e.UIDraggingModes.onlyHorizontal?e.MouseStyles.Horizontal:e.MouseStyles.Vertical)},this.Zb=()=>{this.Yb=!1,this.Lr.Bi(),this.Lr.Li.we(this.Kl)},this.Kb=(t,e)=>{this.Xb=!0,Xt(e),this.Lr.Bi()},this.qb=(t,i)=>{if(this.Zl!==e.UIDraggingModes.notDraggable){const s=i||this.Zl,r=nt(this.Lr.Li.ke(t.x,t.y),this.Lr.Li.ct,this.scale),n=u(s!==e.UIDraggingModes.onlyVertical?Ta(r.x,this.scale.x):this.qr.x,s!==e.UIDraggingModes.onlyHorizontal?Ta(r.y,this.scale.y):this.qr.y);return this.setPosition(n),!0}return!1},this.Jb=(t,e)=>{this.Xb=!1,Xt(e),this.Lr.Bi()},this.onDispose=t=>this.P.on("dispose",t),this.offDispose=t=>this.P.off(t,"dispose"),this.Lr=t,this.renderingScale=i,this.scale=s,this.Mx=n,this.Qb=o,this.hs=h;const a=n.getPointMarker().setMouseInteractions(!0);a.onMouseEnter(this.jb),a.onMouseLeave(this.Zb),a.onMouseDragStart(this.Kb),a.onMouseDrag(((t,e)=>this.qb(u(e.clientX,e.clientY))&&Xt(e))),a.onMouseDragStop(this.Jb),a.onTouchStart(this.Kb),a.onTouchMove(((t,e)=>this.qb(u(e.clientX,e.clientY))&&Xt(e))),a.onTouchEnd(this.Jb),n.getResultTable().setMouseInteractions(!0),this.setPosition(this.qr)}setPosition(t){return this.qr=t,this.Mx.setPosition(t),this.P.emit("positionChange",this,this.qr),this}getPosition(){return this.qr}onPositionChange(t){return this.P.on("positionChange",t)}offPositionChange(t){return this.P.off(t,"positionChange")}setPointMarkerVisibility(t){return this.Ub=t,this.Lr.Bi(),this}getPointMarkerVisibility(){return this.Ub}setResultTableVisibility(t){return this.$b=t,this.Lr.Bi(),this}getResultTableVisibility(){return this.$b}setMouseInteractions(t){return this.pr=t,this.Mx.getPointMarker().setMouseInteractions(t),this.Mx.getResultTable().setMouseInteractions(t),this}getMouseInteractions(){return this.pr}setAutoFitStrategy(t){return this.Mx.setAutoFitStrategy(t),this}getAutoFitStrategy(){return this.Mx.getAutoFitStrategy()}isAttached(){return!0}ru(){const t=this.isAttached();return Da(this.Ub,this.Yb,this.Xb)?this.Mx.setPointMarkerVisible(!0):this.Mx.setPointMarkerVisible(!1),t&&Da(this.$b,this.Yb,this.Xb)?this.Mx.setResultTableVisible(!0):this.Mx.setResultTableVisible(!1),this.Mx.ru(),this}Gs(){return this.Mx.Gs(),this}pointAt(t){return this.Mx.pointAt(t),this}dispose(){return this.ce||(this.ce=!0,this.Qb(this),this.Mx.dispose(),this.P.emit("dispose")),this}setVisible(t){const e=this.Ri!==t;return this.Ri=t,this.Mx.setVisible(t),e&&this.P.emit("visibleStateChanged",this,this.Ri),this}getVisible(){return this.Ri}onVisibleStateChanged(t){return this.P.on("visibleStateChanged",t)}offVisibleStateChanged(t){return this.P.off(t,"visibleStateChanged")}setPointMarker(t){return this.Mx.setPointMarker(t),this}getPointMarker(){return this.Mx.getPointMarker()}setResultTable(t){return this.Mx.setResultTable(t),this}getResultTable(){return this.Mx.getResultTable()}setDraggingMode(t=e.UIDraggingModes.notDraggable){return this.Zl=t,this.Lr.Bi(),this}getDraggingMode(){return this.Zl}}class Ba extends Ea{constructor(t,i,s,r,n,o,h){super(t,i,oo(s.ct,r.ct),n.VS(t,i,s,r,h),o,h),this.tv=e.UIVisibilityModes.always,this.sv=e.UIVisibilityModes.always,this.ev=e.UIVisibilityModes.always,this.hv=e.UIVisibilityModes.always,this.gridStrokeStyleX=this.Mx.getGridStrokeXStyle(),this.gridStrokeStyleY=this.Mx.getGridStrokeYStyle(),this.Lr=t,this.axisX=s,this.axisY=r,this.Qb=o;const a=this.Mx.getTickMarkerX().setMouseInteractions(!0);a.onMouseEnter(((t,i)=>this.jb(t,i,e.UIDraggingModes.onlyHorizontal))),a.onMouseLeave(this.Zb),a.onMouseDragStart(this.Kb),a.onMouseDrag(((t,i)=>this.qb(u(i.clientX,i.clientY),e.UIDraggingModes.onlyHorizontal)&&Xt(i))),a.onMouseDragStop(this.Jb),a.onTouchStart(this.Kb),a.onTouchMove(((t,i)=>this.qb(u(i.clientX,i.clientY),e.UIDraggingModes.onlyHorizontal)&&Xt(i)));const l=this.Mx.getTickMarkerY().setMouseInteractions(!0);l.onMouseEnter(((t,i)=>this.jb(t,i,e.UIDraggingModes.onlyVertical))),l.onMouseLeave(this.Zb),l.onMouseDragStart(this.Kb),l.onMouseDrag(((t,i)=>this.qb(u(i.clientX,i.clientY),e.UIDraggingModes.onlyVertical)&&Xt(i))),l.onMouseDragStop(this.Jb),l.onTouchStart(this.Kb),l.onTouchMove(((t,i)=>this.qb(u(i.clientX,i.clientY),e.UIDraggingModes.onlyVertical)&&Xt(i)))}ru(){const t=this.isAttached();return this.Ri&&t&&Da(this.ev,this.Yb,this.Xb)?this.Mx.setTickMarkerXVisible(!0):this.Mx.setTickMarkerXVisible(!1),this.Ri&&t&&Da(this.hv,this.Yb,this.Xb)?this.Mx.setTickMarkerYVisible(!0):this.Mx.setTickMarkerYVisible(!1),this.Mx.setGridStrokeXStyle(this.Ri&&t&&Da(this.tv,this.Yb,this.Xb)?this.gridStrokeStyleX:J),this.Mx.setGridStrokeYStyle(this.Ri&&t&&Da(this.sv,this.Yb,this.Xb)?this.gridStrokeStyleY:J),super.ru()}setGridStrokeXVisibility(t){return this.tv=t,this.Lr.Bi(),this}getGridStrokeXVisibility(){return this.tv}setGridStrokeYVisibility(t){return this.sv=t,this.Lr.Bi(),this}getGridStrokeYVisibility(){return this.sv}setTickMarkerXVisibility(t){return this.ev=t,this.Lr.Bi(),this}getTickMarkerXVisibility(){return this.ev}setTickMarkerYVisibility(t){return this.hv=t,this.Lr.Bi(),this}getTickMarkerYVisibility(){return this.hv}setGridStrokeXCut(t){return this.Mx.setGridStrokeXCut(t),this}getGridStrokeXCut(){return this.Mx.getGridStrokeXCut()}setGridStrokeYCut(t){return this.Mx.setGridStrokeYCut(t),this}getGridStrokeYCut(){return this.Mx.getGridStrokeYCut()}setGridStrokeXStyle(t){return this.gridStrokeStyleX="function"==typeof t?t(this.gridStrokeStyleX):t,this}getGridStrokeXStyle(){return this.Mx.getGridStrokeXStyle()}setGridStrokeYStyle(t){return this.gridStrokeStyleY="function"==typeof t?t(this.gridStrokeStyleY):t,this}getGridStrokeYStyle(){return this.Mx.getGridStrokeYStyle()}setTickMarkerX(t){return this.Mx.setTickMarkerX(t),this}getTickMarkerX(){return this.Mx.getTickMarkerX()}setTickMarkerY(t){return this.Mx.setTickMarkerY(t),this}getTickMarkerY(){return this.Mx.getTickMarkerY()}setMouseInteractions(t){return super.setMouseInteractions(t),this.Mx.getTickMarkerX().setMouseInteractions(t),this.Mx.getTickMarkerY().setMouseInteractions(t),this}}class ka extends Ba{}class Ia extends ka{constructor(t,e,i,s,r,n){super(t,e,i.axisX,i.axisY,s,r,n),this.rv=!1,this.Lr=t,this.owningSeries=i}setPosition(t){return super.setPosition(t),this.rv=!1,this.Lr.Bi(),this}Gs(){if(!this.rv){const t=this.owningSeries.solveNearestFromScreen(nt(this.qr,this.scale,this.Lr.Li.ct));t?(this.qr=nt(t.location,this.owningSeries.scale,this.scale),this.Mx.pointAt(t),this.rv=!0):this.Mx.setPosition(this.qr)}return super.Gs()}isAttached(){return this.rv}}class Ca extends ra{constructor(t,e,i,s,r,n,o,h,a,l){super(t,e,a,l),this.nv=[],this.addMarker=(t=wa)=>{const e=new Ia(this.ov(),this.qa.uiScale,this,t,this.removeMarker,this.hs);return this.nv.push(e),e},this.removeMarker=t=>{const e=this.nv.indexOf(t);-1!==e&&this.nv.splice(e,1)},this.de=new Map,this.chart=t,this.Lr=i,this.axisX=s,this.axisY=r,this.axisXAttachHandler=n,this.axisYAttachHandler=o,this.ov=h,this.scale=oo(s.ct,r.ct),this.av=t.lv,t.lv+=1,this.uv(this.scale),this.attacheAxis(),this.onMouseEnter(this.chart.cv),this.onMouseLeave(this.chart.dv),this.onMouseWheel(this.chart.fm),this.onMouseDragStart(this.chart.fv),this.onMouseDrag(this.chart.gm),this.onMouseDragStop(this.chart.gv),this.onTouchStart(this.chart.pm.onTouchStart),this.onTouchMove(this.chart.pm.onTouchMove),this.onTouchEnd(this.chart.pm.onTouchEnd)}attacheAxis(){this.pv=this.axisXAttachHandler(this),this.mv=this.axisYAttachHandler(this)}ru(){super.ru();for(let t=0;t{e.Rr(this.av)})),this.qa.Li.Bi(),this}dispose(){return super.dispose(),this.nv.slice().forEach((t=>t.dispose())),this.pv(this),this.mv(this),this}yv(){for(let t=0;t{const r=t.length;let n=0;if(void 0!==e){const r=i-e;if(r>0){const e=t.slice(n,r);n+=r,s(e,!0)}}for(;nt))=>{const i=[];let s;for(let r=0;r{const s=void 0!==i?i:0,r=new Array(t.length);for(let i=0;it.addRow(e.getName()).addRow("X","",e.axisX.formatValue(i)).addRow("Y","",e.axisY.formatValue(s));class _a extends Ca{constructor(t,i,s,r,n,o,h,a,l,u,c){super(t,i,s,r,n,o,h,a,u,c),this.Sv=[],this.ca=[],this.xv=0,this.rh=!1,this.Pu=e.HighlightModes.onHover,this.ox=Fa,this.bv=l}setDataCleaning(t){const e=t&&t.minDataPointCount;return this.xv=void 0!==e&&e>0?e:0,this.Lr.Bi(),this}add(t){if(Array.isArray(t)?this.vv(t):this.vv([t]),this.ca.length>0){const t=this.ca[this.ca.length-1];this.Mv={x:t.x,y:t.y}}return this}addArrayX(t,e=1,i){let s=i;return s||(s=this.Mv?this.Mv.y+e:0),this.add(((t,e=1,i)=>{const s=void 0!==i?i:0,r=new Array(t.length);for(let i=0;i{const i=new Array(t.length);for(let s=0;st+e.Jn()+e.Qn()),this.ca.length)}clear(){this._v=void 0;for(let t=0;t0&&this.getVisible()}getXMax(){return this.bv.getXMax(this.Sv,this._v)||0}getXMin(){return this.bv.getXMin(this.Sv,this._v)||0}getYMax(){return this.bv.getYMax(this.Sv,this._v)||0}getYMin(){return this.bv.getYMin(this.Sv,this._v)||0}Wp(){const t=u(0,0);for(const e of this.Sv)t.x=Math.max(t.x,e.co()),t.y=Math.max(t.y,e.do());return t}Av(t,e,i,s){this.bv.Av(t,e,i,s,this.scale,(t=>{this.oc(t)}))}xm(){super.xm();const t=this.Sv.length;this.wv&&this.Av(this.Sv,this.getPointAmount(),this.wv,this.xv),t!==this.Sv.length&&this.yv()}ru(){super.ru();const t=this.getBoundaries();this.ca.length>0&&(this.kv(this.ca),this.ca=[]);for(const e of this.Sv)e.Cr(t);return super.ru()}bm(){super.bm(),this._v=void 0,this.ca.length=0}vv(t){0!==t.length&&(this._v?this._v=Ne(this._v,ze(t)):this._v=ze(t),this.P.emit("dataAdd",this,t,this._v),this.ca=ie(this.ca,t,{canReturnB:!1}),this.Lr.Bi())}Cv(){return La(this.Sv)}Tv(t){return this.P.on("dataAdd",t)}Iv(t){return this.P.off(t)}Fv(t){return this.P.on("dataClear",t)}Pv(t){return this.P.off(t)}}const Oa=(t,e,i,s)=>{let r,n,o=Number.MAX_VALUE;for(let h=0;h{const e=this.Bv.indexOf(t);e>=0&&this.Bv.splice(e,1);const i=this.Dv.findIndex((e=>e===t.Dn));i>=0&&this.Dv.splice(i,1),this.oc(t.Dn),this.Lr.Bi()};const o=this.qa.getSeries().length;this.Vr=ue(this.hs.polarPolygonSeriesFillStyle,o),this.$r=ue(this.hs.polarPolygonSeriesStrokeStyle,o)}addPolygon(){const t=new pa(this.qa,this.Lv,this,this.Ov());return this.Bv.push(t),t}setFillStyle(t){this.Vr="function"==typeof t?t(this.Vr):t;const e=this.Vr;for(const t of this.Dv)t.ps(e);return this.Lr.Bi(),this}getFillStyle(){return this.Vr}setStrokeStyle(t){this.$r="function"==typeof t?t(this.$r):t;const e=this.$r;for(const t of this.Dv)t.$h(e);return this.Lr.Bi(),this}getStrokeStyle(){return this.$r}Qs(){return this.um&&void 0!==this.Bv.find((t=>void 0!==t.Rv))&&this.getVisible()}ru(){this.Bv.forEach((t=>{(t._b||this.scale.xb())&&t.Ev&&(t.Dn.lo(la(t.Ev,this.scale)),t._b=!1,t.Dn.Gs())}))}xm(){super.xm();const t=m(Me,Ae);this.Bv.forEach((e=>{if(!e.wb)return;const i=!e._b&&e.Ev?e.Ev:ca(e.wb);e.Ev=i;const s=!e._b&&e.Rv?e.Rv:ua(i);e.Rv=s,t.min=Math.min(t.min,s.min),t.max=Math.max(t.max,s.max)})),this.cb=t}mc(t,e){t.Ir(e),this.Lr.Bi()}jS(t,e){const i=Oa(t,this.Dv,((t,e)=>{const i=t.jS(e);if(i)return nt(i,this.scale,t.Li.ct)}),Le);if(!i)return;const s=nt(i[0],i[1].Li.ct,this.scale),r=this.zv(i[1]);if(!r)return;const{angle:n,amplitude:o}=da(s,this.scale);return{location:s,scale:this.scale,resultTableContent:this.ox(new wh,this,n,o,this.qa.getAmplitudeAxis().formatValue).wu(),series:this,fillStyle:this.Vr,polarPolygon:r}}solveNearestFromScreen(t){return this.jS(t,!1)}attach(t,e=!0){return super.attach(t,e),oe(t,this.hs,{fill:this.Vr,stroke:this.$r}),this}Ov(){const t=this.Lr.vc(this.scale,Ws.Simple).ps(this.Vr).$h(this.$r).Ir(this.getHighlight());return this.Dv.push(t),this.rc(t),t}zv(t){return this.Bv.find((e=>e.Dn===t))}}class Va extends na{constructor(t,e,i,s,r,n){super(t,e,i,s,r,n),this.ac="Area Series",this.fb=[],this.gb=!1,this.pb=!1,this.Vv=!1;const o=this.qa.getSeries().length;this.Vr=ue(this.hs.polarAreaSeriesFillStyle,o),this.$r=ue(this.hs.polarAreaSeriesStrokeStyle,o)}setData(t){const e=(t=>{const e=[];let i,s,r=!1;for(let n=0;n0&&this.getVisible()}attach(t,e=!0){return super.attach(t,e),oe(t,this.hs,{fill:this.Vr,stroke:this.$r}),this}}class Na extends Va{constructor(t,e,i,s,r,n){super(t,e,i,s,r,n),this.Nv=this.Lr.vc(this.scale,Ws.Simple).Ir(this.getHighlight()),this.rc(this.Nv)}ru(){if(this.gb||this.scale.xb()){const t=this.fb,e=!0===this.pb?la(t.concat((t=>{if(0===t.length)return t;const e=t[0],i=t[t.length-1];if(Mt(e.angle,i.angle))return t;const s=1*Math.sign(i.angle-e.angle);let r=0;const n=[];for(let t=i.angle+s;!Mt(t%360,e.angle%360);t+=s)if(n.push({angle:t,amplitude:0}),r+=1,r>360)return[];for(let t=0;t=this.Gv.start}eb(t){this.Hv=t,this.Xv=!0}rb(){return!1===this.Hv}hb(t){this.Wv=t,this.Xv=!0}tb(){return this.Wv}Qt(){return!1}nt(t,e,i,s){return this.x=new Ai(t.x,e.x,i.x,s?s.x:void 0),this.y=new Ai(t.y,e.y,i.y,s?s.y:void 0),this}jt(){return this.Ht}xb(){return this.Yv}Kv(){return this.Xv}pi(){return this.Xt}yi(){return this.jv}X(){return this.o=!1,this.Xt=!1,this.Yv=!1,this.Xv=!1,this}j(){return this.o=!0,this.Xt=!0,this.Yv=!0,this.Xv=!0,this}q(t,e){return"object"==typeof t?(this.Y.x=t.x,this.Y.y=t.y):(this.Y.x=t,this.Y.y=e),this.Zv(),this}ci(t){return this.Uv=t,this.Zv(),this}di(t){return this.$v=t,this.Zv(),this}Rt(){return u(this.Uv[0]+this.Uv[1],this.$v[0]+this.$v[1])}Et(){return this.Y}Zv(){const t=this.Gv,e=u(this.x.zt(this.Y.x),this.y.zt(this.Y.y)),i=this.Uv[0]+this.Uv[1],s=this.$v[0]+this.$v[1],r=Math.max(e.x-i,0),n=Math.max(e.y-s,0),o=.5*(r>n?n:r),h=[this.Uv[0]+Math.max((r-2*o)/2,0),this.Uv[1]+Math.max((r-2*o)/2,0)],a=[this.$v[0]+Math.max((n-2*o)/2,0),this.$v[1]+Math.max((n-2*o)/2,0)],l=Math.abs(t.end-t.start);this.x.q(this.Y.x).Dt(h).Z(-l,l),this.y.q(this.Y.y).Dt(a).Z(-l,l),this.jv={x:this.x.getPixelSize(),y:this.y.getPixelSize()},this.Ht={x:this.x.jt(),y:this.y.jt()},this.j()}Yt(t,e){const i=this.yi();return{x:t.x+e.x*i.x,y:t.y+e.y*i.y}}Si(t,e,i,s){const r=this.yi(),n=$e(t,e);return n.x*=s,n.y*=s,{x:t.x+i*r.x*n.x,y:t.y+i*r.y*n.y}}}class Ua extends qh{constructor(t,i,s,r,n,o,h){super(t,i,s,i.Xg("polarChart bg",0),i.Eg("polarChart ui"),r,i.Li.hs.polarChartBackgroundFillStyle,i.Li.hs.polarChartBackgroundStrokeStyle,i.Li.hs.polarChartTitleFont,i.Li.hs.polarChartTitleFillStyle,h),this.NS=e.AutoCursorModes.snapToClosest,this.$d=[],this.pr=!0,this.qv=(t,e,i,s,r)=>{this.Rx.q(s,r)},this.jd=Zt(this.$d),this.Jv=t=>{this.$d.push(t)},this.Qv=()=>this.Lm,this.ef.Ah||this.ef._h||this.Li.bh(4),this.tM=i.qy("polarChart series bg",0),this.iM=i.Pp("polarChart axis gridlines",0),this.sM=i.Pp("polarChart series",1),this.eM=i.Pp("polarChart axis lines",2),this.hM=i.Pp("polarChart axis ticks",3),this.Rx=s.d2({scaleXYConstructor:Ga}),this.onResize(this.qv),this.Kg.fs("Polar Chart");const a=kt(o?o.autoCursorBuilder:void 0,Fh);this.XS=a.zS(this.HS,this.uiScale,this.uiScale,this.hs),this.Gm=this.tM.kc(this.Rx).ps(this.hs.polarChartSeriesBackgroundFillStyle).$h(J).Zo(0).Ko(360).ta(0),this.Hm=this.tM.kc(this.Rx).ps(F).$h(this.hs.polarChartSeriesBackgroundStrokeStyle).Zo(0).Ko(360).ta(0),super.Nm(this.Gm,this.Hm),this.Yg(n,this.pixelScale),this.rM=new Jh(this,this.Rx,this.hs,!(!o||!0!==o.disableAnimations),this.iM,this.eM,this.hM,this.iu,this.Qv),this.nM=new ta(this,this.Rx,this.hs,!(!o||!0!==o.disableAnimations),this.iM,this.eM,this.hM,this.iu),o&&!0===o.disableAnimations&&this.setAnimationsEnabled(!1)}addLineSeries(){const t=new fa(this.sM,this,this.Rm,this.Rx,this.hs,this.Li.iu);return this.Wm(t),t}addPointSeries(){const t=new ma(this.sM,this,this.Rm,this.Rx,this.hs,this.Li.iu);return this.Wm(t),t}addPointLineSeries(){const t=new ga(this.sM,this,this.Rm,this.Rx,this.hs,this.Li.iu);return this.Wm(t),t}addAreaSeries(){const t=new Na(this.sM,this,this.Rm,this.Rx,this.hs,this.Li.iu);return this.Wm(t),t}addPolygonSeries(){const t=new za(this.sM,this,this.Rm,this.Rx,this.hs,this.Li.iu);return this.Wm(t),t}getSeries(){return this.Lm}addSector(){const t=new sa(this.sM,this,this.jd,this.Rx,this.hs,this.Li.iu);return this.Jv(t),t}getAmplitudeAxis(){return this.rM}getRadialAxis(){return this.nM}ru(){var t,e;super.ru(),po.ip(this.Kg,this.jg);for(const t of this.Lm)t.xm();this.rM.he(),this.nM.he();for(const t of this.Lm)t.ru();for(let t=1;t<=2;t+=1){const e=this.rM.ru(),i=this.nM.ru(),s=po.tp(this.Kg,this.jg),r=[this.rn.left+i,this.rn.right+i],n=[this.rn.bottom+i,this.rn.top+i+s];this.Rx.ci(r).di(n);const o=4;if(!(!this.oM||Math.abs(this.oM.amplitude-e)>=o||Math.abs(this.oM.radial-i)>=o)||1!==t){this.oM={amplitude:e,radial:i};break}}const i=this.Rx.Zx().start,s=this.Rx.Zx().end,r=this.Rx.jx()?((null===(t=this.oM)||void 0===t?void 0:t.radial)||0)*this.Rx.x.getPixelSize()+s-i:((null===(e=this.oM)||void 0===e?void 0:e.radial)||0)*this.Rx.x.getPixelSize()+i-s;this.Gm.qo(r).ia(360),this.Hm.qo(r).ia(360);for(const t of this.$d)t.ru();this.ZS(!1);for(const t of this.Lm)t.bm();return super.$g(),this.aM(),this}setAnimationsEnabled(t){return super.setAnimationsEnabled(t),this.rM.setAnimationsEnabled(t),this.nM.setAnimationsEnabled(t),this}setMouseInteractions(t){return this.pr=t,this}getMouseInteractions(){return this.pr}getMinimumSize(){return u(Ha,Ha)}aM(){}forEachAxis(t){return t(this.rM),t(this.nM),this}dispose(){return this.tM.G(),this.iM.G(),this.sM.G(),this.eM.G(),this.hM.G(),this.$d.slice().forEach((t=>t.dispose())),super.dispose()}dd(){return[...this.Lm,...this.$d]}}const Ha=300;class Wa extends vo{}class Ya extends Wa{constructor(t,e,i,s,r,n,o,h){super(s,n,o,h),this.ac="Slice",this.u=0,this.sp=!1,this.lM=F,this.hp=F,this.rp=this.u,this.ap=W((()=>this.qa.Li.Bi())),this.up=()=>{this.cp=void 0},this.index=t,this.qa=s,this.scale=r,this.tc=n,this.Nv=e.vc(r,Ws.Simple).Ir(this.getHighlight()),this.rc(this.Nv),this._i=i.ue(r).Ir(this.getHighlight()),this.rc(this._i,{isText:!0})}setValue(t){return this.qa.getAnimationsEnabled()?this.getVisible()&&this.pp(this.rp,t):this.rp=t,this.u=t,this.qa.Li.Bi(),this}getValue(){return this.u}setVisible(t){return!1===t?this.qa.getAnimationsEnabled()&&this.rp>0?(this.cp&&(this.cp.finish(!1),this.cp=void 0),this.pp(this.rp,0,(()=>super.setVisible(!1)))):(this.rp=0,super.setVisible(!1)):this.qa.getAnimationsEnabled()?(this.cp&&(this.cp.finish(!1),this.cp=void 0),super.setVisible(!0),this.pp(this.rp,this.u)):(this.rp=this.u,super.setVisible(!0)),this}pp(t,e,i){this.cp=this.ap(300,U.ease)([[t,e]],(([t])=>{this.rp=t,this.qa.Li.Bi()})),this.cp.onEveryAnimationEnd(this.up),i&&this.cp.onAnimationEnd(i)}setStyle(t,e,i,s){this.lM=t,this.hp=i,this.Nv.ps(this.lM).$h(e),this._i.ps(this.hp).Ss(s);for(let t=0;t{let i=100;return t<=0?t=0:(i=t>=100?100:t,t=e*(i/100)),t},$a=(t,i,s,r,n,o=0,h=e.FunnelSliceModes.VariableHeight,a)=>{i=Xa(i,r.x),s=Xa(s,r.x);const l=t.length;let u=0,c=0;u=t.reduce(((t,e)=>t+e.getAnimatedValue()),0);let d={x:a-i/2,y:r.y+n.bottom},f={x:a+i/2,y:r.y+n.bottom},g={x:0,y:n.bottom},m={x:0,y:n.bottom},p=0,y=0;if(o)for(let i=0;i0&&(d={x:g.x+x*o,y:g.y-o},f={x:m.x-x*o,y:m.y-o}),v=(i+c/u*(s-i))/2,g={x:a-v,y:parseInt(`${h===e.FunnelSliceModes.VariableWidth?d.y-S:S}`,10)},m={x:a+v,y:parseInt(`${h===e.FunnelSliceModes.VariableWidth?f.y-S:S}`,10)},f.x>=d.x&&m.x>g.x&&y.Nv.lo([g,d,f,m])}};class ja extends mo{constructor(t,i,s,r,n,o,h){super(t,i,s,i.Xg("funnelChart bg",0),i.Eg("funnelChart ui"),r,i.Li.hs.funnelChartBackgroundFillStyle,i.Li.hs.funnelChartBackgroundStrokeStyle,i.Li.hs.funnelChartTitleFont,i.Li.hs.funnelChartTitleFillStyle,o),this.mp=[],this.yp=xo.None,this.bp=!0,this._p=0,this.uM=80,this.cM=20,this.dM=0,this.fM=e.FunnelSliceModes.VariableHeight,this.kp=!0,this.Tp=t=>{const e=this.mp.indexOf(t);e>=0&&(this.mp.splice(e,1),this.Ip())},this.ef.Ah||this.ef._h||this.Li.bh(5),this.Cp=this.hs.effectsText,this.Fp=i.Pp("funnelChart bottom",0),this.Dp=i.Pp("funnelChart top",1),this.Kg.fs("Funnel Chart"),this.Sp=this.hs.funnelChartSliceFillStylePalette,this.xp=this.hs.funnelChartSliceStrokeStyle,this.vp=this.hs.funnelChartSliceLabelFont,this.Mp=this.hs.funnelChartSliceLabelFillStyle,h&&this.setAnimationsEnabled(!1),this.Yg(n,this.pixelScale)}addSlice(t,e){const i=new Ya(this._p,this.Fp,this.Dp,this,this.pixelScale,this.Tp,this.hs,this.Li.iu);return this._p+=1,i.setName(t),i.setValue(e),i.iu.sc.vs(this.Cp),i.iu.hc.vs(this.kp),this.mp.push(i),this.Li.Bi(),i.setHighlightOnHover(this.bp),i}addSlices(t){const e=[];for(let i=0;ie.iu.hc.vs(t))),this.Li.Bi(),this}getSliceEffect(){return this.kp}setSliceSorter(t){return this.yp=t,this.mp=this.mp.sort(this.yp),this.Li.Bi(),this}getSliceSorter(){return this.yp}setLabelFillStyle(t){return this.Mp="function"==typeof t?t(this.Mp):t,this.Li.Bi(),this}getLabelFillStyle(){return this.Mp}setLabelFont(t){return this.vp="function"==typeof t?t(this.vp):t,this.Li.Bi(),this}getLabelFont(){return this.vp}setLabelEffect(t){return this.Cp=t,this.mp.forEach((e=>e.iu.sc.vs(t))),this.Li.Bi(),this}getLabelEffect(){return this.Cp}setLabelFormatter(t){return this.Lp=t,this.Li.Bi(),this}getLabelFormatter(){return this.Lp}setSliceHighlightOnHover(t){return this.bp=t,this.mp.forEach((e=>e.setHighlightOnHover(t))),this}ru(){super.ru(),po.ip(this.Kg,this.jg),super.$g();const t=po.tp(this.Kg,this.jg),e=u(this.pixelScale.x.getInnerInterval()-(this.rn.left+this.rn.right),this.pixelScale.y.getInnerInterval()-(this.rn.bottom+this.rn.top+t)),i=u(this.rn.left+e.x/2,this.rn.bottom+e.y/2);this.mp=this.mp.sort(this.yp);for(let t=0,{length:e}=this.mp;tt.getAnimatedValue()>0));let r=0;for(let t=0;t0?o/r:0);var o;for(let t=0;tt.dispose())),super.dispose()}}const Za=(t,i,s)=>{const r=t.uo();if(r.length>0){let t;const n=(r[1].y-r[0].y)/2+r[0].y;return t=i===e.FunnelLabelSide.Left?(r[0].x-r[1].x)/2+r[1].x-s:(r[2].x-(4===r.length?r[3].x:r[1].x))/2+(4===r.length?r[3].x:r[1].x)+s,{x:t,y:n}}},Ka=t=>{const e=t.uo();if(e.length>0)return{x:(e[2].x-e[1].x)/2+e[1].x,y:(e[1].y-e[0].y)/2+e[0].y}};class Ja extends ja{constructor(){super(...arguments),this.Lp=So.NamePlusValue,this.Rp=10,this.gM=e.FunnelLabelSide.Left,this.pM=e.SliceLabelIndices.LabelsOnSides,this.zp=[],this.Vp=this.hs.funnelChartConnectorStrokeStyle}setLabelConnectorStyle(t){this.Vp=t;for(let t=0;t{const e=this.mp.indexOf(t);e>=0&&this.mp.splice(e,1)},this.ef.Ah||this.ef._h||this.Li.bh(6),this.Lr=e.Pp("gaugeChart layer",0),this.Dp=e.Pp("gaugeChart top layer",1),this.Kg.fs("Gauge Chart"),this.Yg(r,this.pixelScale);const h=Fr();this.onBackgroundTouchStart(h.onTouchStart),this.onBackgroundTouchMove(h.onTouchMove),this.onBackgroundTouchEnd(h.onTouchEnd),o&&this.setAnimationsEnabled(!1)}dispose(){return this.Lr.G(),this.Dp.G(),this.mp.slice().forEach((t=>t.dispose())),super.dispose()}}class rl extends sl{constructor(t,e,i,s,r,n,o){super(t,e,i,s,r,n,o),this.Vo=90,this.No=-270,this.SM={min:this.Vo,max:this.No},this.xM=W((()=>this.Lr.Bi())),this.bM=()=>{this.vM=void 0},this.MM=e.Pp("radialGaugeChart bg arc",2),this._M=this.Lr.kc(this.pixelScale).ps(this.hs.gaugeChartEmptyGaugeFillStyle).$h(this.hs.gaugeChartEmptyGaugeStrokeStyle)}setAngleInterval(t,e){t===e?e-=360:Math.abs(e-t)>360&&(e-=(e-t)%360);const i=this.Vo,s=this.No,r=this.SM;return this.getAnimationsEnabled()?this.AM(r,{min:t,max:e}):(r.min=t,r.max=e,this.Vo=t,this.No=e),this.P.emit("angleIntervalChange",this,{min:i,max:s},{min:t,max:e}),this.Li.Bi(),this}getAngleInterval(){return{min:this.Vo,max:this.No}}setGaugeFillStyle(t){return this._M.ps(t),this.Li.Bi(),this}setGaugeStrokeStyle(t){return this._M.$h(t),this.Li.Bi(),this}AM(t,e,i){this.vM=this.xM(1e3,U.ease)([[t.min,e.min],[t.max,e.max]],(([t,e])=>{this.SM={min:t,max:e},this.Vo=t,this.No=e,this.Lr.Bi()})),this.vM.onEveryAnimationEnd(this.bM),i&&this.vM.onAnimationEnd(i)}onAngleIntervalChange(t){return this.P.on("angleIntervalChange",t)}offAngleIntervalChange(t){return this.P.off(t,"angleIntervalChange")}dispose(){return super.dispose(),this.MM.G(),this}}class nl extends vo{wM(t){return this.P.on("valueChange",t)}kM(t){return this.P.on("valueIntervalChange",t)}offValueChange(t){return this.P.off(t,"valueChange")}offIntervalChange(t){return this.P.off(t,"valueIntervalChange")}attach(t,e=!0){return super.attach(t,e),this.styleAttachedEntry(t),this}styleAttachedEntry(t){oe(t,this.hs,{fill:this.CM})}}class ol extends nl{onValueChange(t){return this.wM(t)}onIntervalChange(t){return this.kM(t)}}class hl extends ol{constructor(t,e,i,s,r,n,o){super(i,r,n,o),this.Vo=0,this.No=0,this.TM=0,this.IM=0,this.FM=0,this.PM=100,this.DM=!0,this.rp=this.u,this.op=this.getVisible(),this.ap=ye(),this.BM=t=>{this.rp=t,this.qa.Li.Bi()},this.LM=t,this.fe=e,this.qa=i,this.scale=s,this.CM=this.hs.gaugeChartGaugeFillStyle,this.gp=t.kc(s).ps(this.CM).$h(J).Ir(this.getHighlight()),this.rc(this.gp),this.OM=e.ue(s).Ir(this.getHighlight()),this.rc(this.OM,{isText:!0}),this.RM=e.ue(s).Ir(this.getHighlight()),this.rc(this.RM,{isText:!0}),this._i=e.ue(s).Ir(this.getHighlight()),this.rc(this._i,{isText:!0}),this.OM.ps(n.gaugeChartIntervalLabelsFillStyle).Ss(n.gaugeChartIntervalLabelsFont),this.RM.ps(n.gaugeChartIntervalLabelsFillStyle).Ss(n.gaugeChartIntervalLabelsFont),this._i.ps(n.gaugeChartValueLabelFillStyle).Ss(n.gaugeChartValueLabelFont),this.setName("Gauge Slice")}ru(){const t=this.qa.getDataLabelFormatter(),e=this.Vo/90r&&(i=r);const n=this.No-e*this.IM,o=this.Vo+e*this.TM,h=this.PM-this.FM,a=(0!==h?(n-o)/h:1/0)*(i-this.FM);this.gp.Zo(o).Ko(o+a);const l="function"==typeof t?t(i,{getInnerStart:()=>s,getInnerEnd:()=>r}):t.format(i);this._i.fs(l)}EM(){const t=this.qa.getIntervalLabelFormatter(),e="function"==typeof t?t(this.FM,{getInnerStart:()=>this.FM,getInnerEnd:()=>this.PM}):t.format(this.FM);return this.OM.fs(e).Gs(),this.OM.Et()}zM(){const t=this.qa.getIntervalLabelFormatter(),e="function"==typeof t?t(this.PM,{getInnerStart:()=>this.FM,getInnerEnd:()=>this.PM}):t.format(this.PM);return this.RM.fs(e).Gs(),this.RM.Et()}setName(t){return super.setName(t),this.qa.Li.Bi(),this}setValue(t){const e=this.u;return this.qa.getAnimationsEnabled()?this.op&&this.ap(e,t,this.BM):this.rp=t,this.u=t,this.P.emit("valueChange",this,e,t),this.qa.Li.Bi(),this}getValue(){return this.u}setVisible(t){return this.op=t,!1===t?this.qa.getAnimationsEnabled()&&this.rp>0?this.ap(this.rp,0,this.BM,{onCompleted:()=>super.setVisible(!1)}):(this.rp=0,super.setVisible(!1)):this.qa.getAnimationsEnabled()?(super.setVisible(!0),this.ap(this.rp,this.u,this.BM)):(this.rp=this.u,super.setVisible(!0)),this}setInterval(t,e){const i=this.FM,s=this.PM;return this.P.emit("valueIntervalChange",this,{min:i,max:s},{min:t,max:e}),this.FM=t,this.PM=e,this.qa.Li.Bi(),this}setIntervalLabelsFont(t){return this.OM.Ss(t),this.RM.Ss(t),this.qa.Li.Bi(),this}getIntervalLabelsFont(){return this.OM.ys()}setIntervalLabelsFillStyle(t){return this.OM.ps(t),this.RM.ps(t),this.qa.Li.Bi(),this}getIntervalLabelsFillStyle(){return this.OM.gs()}setIntervalLabelsVisible(t){return t?(this.OM.setVisible(!0),this.RM.setVisible(!0)):(this.OM.setVisible(!1),this.RM.setVisible(!1)),this.DM=t,this}getIntervalLabelsVisible(){return this.DM}setAngleInterval(t,e){return this.Vo=t,this.No=e,this.qa.Li.Bi(),this}setMinAngle(t){return this.Vo=t,this.qa.Li.Bi(),this}setMaxAngle(t){return this.No=t,this.qa.Li.Bi(),this}setMarginInDegrees(t=this.TM,e=this.IM){return t!==this.TM&&(this.TM=t),e!==this.IM&&(this.IM=e),this.qa.Li.Bi(),this}setFillStyle(t){this.CM="function"==typeof t?t(this.CM):t;const e=this.CM;this.gp.ps(e);for(let t=0;tr?25*s:25*r))){const o=Array(n+2),h=Math.PI;let a=0,l=0;const c=e*h/180,d=(i*h/180-c)/n;for(o[a]=u(t.x,t.y),a+=1;a<=n+1;)o[a]=u(t.x+s*Math.cos(c+l*d),t.y+r*Math.sin(c+l*d)),a+=1,l+=1;return[o,n]}class ll extends rl{constructor(t,e,i,s,r,n,o){super(t,e,i,s,r,n,o),this.Qc=20,this.GM=new Intl.NumberFormat,this.HM=new Intl.NumberFormat,this.WM=!1,this.UM=5;const h=new hl(this.Lr,this.Dp,this,this.pixelScale,this.Tp,this.hs,this.Li.iu);this.$M=h,this.mp.push(h),this.setPadding(10)}ru(){super.ru(),po.ip(this.Kg,this.jg),super.$g();const t=po.tp(this.Kg,this.jg),e=ze([this.$M.EM(),this.$M.zM()]),i=u(this.pixelScale.x.getInnerInterval()-(this.rn.left+this.rn.right+2*e.max.x),this.pixelScale.y.getInnerInterval()-(this.rn.bottom+this.rn.top+2*e.max.y+t)),s=Math.max(.5*Math.min(i.x,i.y),0),r=u(this.rn.left+e.max.x+.5*i.x,this.rn.bottom+e.max.y+.5*i.y),n=this.WM?this.YM(r,s):r,o=this._M.$r.getThickness(),h=s-.5*o,a=s-this.Qc;let l=a/s*100;l=l>100||l<0?99:l;const c=100*(1-(this.Qc-o)/s);this.XM(n,a)&&(this._M.qo(s).ta(l),this.$M.gp.qo(h).ta(c));const d=.5*(f=s,(g=this.No-this.Vo)/(2*Math.PI*f*(g/360))*o);var f,g;this._M.Zo(this.Vo).Ko(this.No).Sn(n),this.$M.gp.Sn(n),this.$M._i.Sn(n),this.sd&&this.$M.setFillStyle(new z({color:this.sd.getColors(this.$M.getAnimatedValue())})),this.$M.setMinAngle(this.Vo).setMaxAngle(this.No).setMarginInDegrees(d,d).ru();const m=this._M.Go();if(this.$M.getIntervalLabelsVisible()){this.jM(this.Vo,this.No,n,m+this.UM);const t=this.$M.OM.Gs().Mi(),e=this.$M.RM.Gs().Mi();Be(t,e)&&this.ZM(t,e,n,m+this.UM)}}XM(t,e){const i=Ze(this.$M._i.Gs().Et(),.5),s=t.x+e,r=t.x-e,n=t.y+e,o=t.y-e;return!(t.x+i.x>s||t.x-i.xn||t.y-i.y=0?i=-s:s=-i),[i,s]}YM(t,e){const[i]=al(t,this.Vo,this.No,e,e),s=ze(i),r=.5*(s.max.x-s.min.x),n=.5*(s.max.y-s.min.y);return Ke(Je(t,u(s.min.x+r,s.min.y+n)),t)}jM(t,e,i,s){const r=ni(t),n=ni(e);this.$M.OM.Sn(Ye(u(i.x+s,i.y),i,-r)),this.$M.RM.Sn(Ye(u(i.x+s,i.y),i,-n)),this.$M.OM.kn(u(-Math.cos(r),-Math.sin(r))),this.$M.RM.kn(u(-Math.cos(n),-Math.sin(n)))}getDefaultSlice(){return this.$M}setAutoScaling(t){return this.WM=t,this.Li.Bi(),this}getAutoScaling(){return this.WM}setDataLabelFormatter(t){return this.HM=t,this.Li.Bi(),this}getDataLabelFormatter(){return this.HM}setIntervalLabelFormatter(t){return this.GM=t,this.Li.Bi(),this}getIntervalLabelFormatter(){return this.GM}setIntervalLabelPadding(t){return this.UM=t,this.Li.Bi(),this}getIntervalLabelPadding(){return this.UM}setThickness(t){return this.Qc=t,this}setLUT(t){return this.sd=t,this.Li.Bi(),this}setDataLabelFont(t){return this.$M._i.Ss(t),this.Li.Bi(),this}getDataLabelFont(){return this.$M._i.ys()}getMinimumSize(){return u(500,300)}setDataLabelFillStyle(t){return this.$M.VM(t),this.Li.Bi(),this}getDataLabelFillStyle(){return this.$M.NM()}dd(){return this.mp}dispose(){return this.$M.dispose(),super.dispose()}}class ul extends vo{}class cl extends ul{constructor(t,e,i,s,r,n,o,h){super(s,n,o,h),this.ac="Slice",this.u=0,this.sp=!1,this.lM=F,this.hp=F,this.rp=this.u,this.ap=W((()=>this.qa.Li.Bi())),this.up=()=>{this.cp=void 0},this.index=t,this.qa=s,this.scale=r,this.tc=n,this.Nv=e.vc(r,Ws.Simple).Ir(this.getHighlight()),this.rc(this.Nv),this._i=i.ue(r).Ir(this.getHighlight()),this.rc(this._i,{isText:!0})}setValue(t){return this.qa.getAnimationsEnabled()?this.getVisible()&&this.pp(this.rp,t):this.rp=t,this.u=t,this.qa.Li.Bi(),this}getValue(){return this.u}setVisible(t){return!1===t?this.qa.getAnimationsEnabled()&&this.rp>0?(this.cp&&(this.cp.finish(!1),this.cp=void 0),this.pp(this.rp,0,(()=>super.setVisible(!1)))):(this.rp=0,super.setVisible(!1)):this.qa.getAnimationsEnabled()?(this.cp&&(this.cp.finish(!1),this.cp=void 0),super.setVisible(!0),this.pp(this.rp,this.u)):(this.rp=this.u,super.setVisible(!0)),this}pp(t,e,i){this.cp=this.ap(300,U.ease)([[t,e]],(([t])=>{this.rp=t,this.qa.Li.Bi()})),this.cp.onEveryAnimationEnd(this.up),i&&this.cp.onAnimationEnd(i)}setStyle(t,e,i,s){this.lM=t,this.hp=i,this.Nv.ps(this.lM).$h(e),this._i.ps(this.hp).Ss(s);for(let t=0;t{let i=100;return t<=0?t=0:(i=t>=100?100:t,t=e*(i/100)),t},fl=(t,i,s,r,n,o=0,h=e.PyramidSliceModes.VariableHeight,a)=>{i=dl(i,r.x),s=dl(s,r.x);const l=t.length;let u=0,c=0;u=t.reduce(((t,e)=>t+e.getAnimatedValue()),0);let d={x:a-i/2,y:r.y+n.bottom},f={x:a+i/2,y:r.y+n.bottom},g={x:0,y:n.bottom},m={x:0,y:n.bottom},p=0,y=0;if(o)for(let i=0;i0&&(d={x:g.x+x*o,y:g.y-o},f={x:m.x-x*o,y:m.y-o}),v=(i+c/u*(s-i))/2,g={x:a-v,y:parseInt(`${h===e.PyramidSliceModes.VariableWidth?d.y-S:S}`,10)},m={x:a+v,y:parseInt(`${h===e.PyramidSliceModes.VariableWidth?f.y-S:S}`,10)},f.x>=d.x&&m.x>=g.x&&y.Nv.lo([g,d,f,m])}};class gl extends mo{constructor(t,i,s,r,n,o,h){super(t,i,s,i.Xg("pyramidChart bg",0),i.Eg("pyramidChart ui"),r,i.Li.hs.pyramidChartBackgroundFillStyle,i.Li.hs.pyramidChartBackgroundStrokeStyle,i.Li.hs.pyramidChartTitleFont,i.Li.hs.pyramidChartTitleFillStyle,o),this.mp=[],this.yp=xo.None,this.Sp=this.hs.pyramidChartSliceFillStylePalette,this.xp=this.hs.pyramidChartSliceStrokeStyle,this.bp=!0,this.vp=this.hs.pyramidChartSliceLabelFont,this.Mp=this.hs.pyramidChartSliceLabelFillStyle,this._p=0,this.uM=0,this.cM=80,this.dM=0,this.fM=e.PyramidSliceModes.VariableHeight,this.kp=!0,this.Tp=t=>{const e=this.mp.indexOf(t);e>=0&&(this.mp.splice(e,1),this.Ip())},this.ef.Ah||this.ef._h||this.Li.bh(8),this.Cp=this.hs.effectsText,this.Fp=i.Pp("pyramidChart bottom",0),this.Dp=i.Pp("pyramidChart top",1),this.Kg.fs("Pyramid Chart"),h&&this.setAnimationsEnabled(!1),this.Yg(n,this.pixelScale)}addSlice(t,e){const i=new cl(this._p,this.Fp,this.Dp,this,this.pixelScale,this.Tp,this.hs,this.Li.iu);return this._p+=1,i.setName(t),i.setValue(e),i.iu.sc.vs(this.Cp),i.iu.hc.vs(this.kp),this.mp.push(i),this.Li.Bi(),i}addSlices(t){const e=[];for(let i=0;ie.iu.hc.vs(t))),this.Li.Bi(),this}getSliceEffect(){return this.kp}setSliceSorter(t){return this.yp=t,this.mp=this.mp.sort(this.yp),this.Li.Bi(),this}getSliceSorter(){return this.yp}setLabelFillStyle(t){return this.Mp="function"==typeof t?t(this.Mp):t,this.Li.Bi(),this}getLabelFillStyle(){return this.Mp}setLabelFont(t){return this.vp="function"==typeof t?t(this.vp):t,this.Li.Bi(),this}getLabelFont(){return this.vp}setLabelEffect(t){return this.Cp=t,this.mp.forEach((e=>e.iu.sc.vs(t))),this.Li.Bi(),this}getLabelEffect(){return this.Cp}setLabelFormatter(t){return this.Lp=t,this.Li.Bi(),this}getLabelFormatter(){return this.Lp}setSliceHighlightOnHover(t){return this.bp=t,this.mp.forEach((e=>e.setHighlightOnHover(t))),this}ru(){super.ru(),po.ip(this.Kg,this.jg),super.$g();const t=po.tp(this.Kg,this.jg),e=u(this.pixelScale.x.getInnerInterval()-(this.rn.left+this.rn.right),this.pixelScale.y.getInnerInterval()-(this.rn.bottom+this.rn.top+t)),i=u(this.rn.left+e.x/2,this.rn.bottom+e.y/2);this.mp=this.mp.sort(this.yp);for(let t=0,{length:e}=this.mp;tt.getAnimatedValue()>0));let r=0;for(let t=0;t0?o/r:0);var o;for(let t=0;tt.dispose())),super.dispose()}}const ml=(t,i,s)=>{const r=t.uo();if(r.length>0){let t;const n=(r[1].y-r[0].y)/2+r[0].y;return t=i===e.PyramidLabelSide.Left?(r[0].x-r[1].x)/2+r[1].x-s:(r[2].x-(4===r.length?r[3].x:r[1].x))/2+(4===r.length?r[3].x:r[1].x)+s,{x:t,y:n}}},pl=t=>{const e=t.uo();if(e.length>0)return{x:(e[2].x-e[1].x)/2+e[1].x,y:(e[1].y-e[0].y)/2+e[0].y}};class yl extends gl{constructor(){super(...arguments),this.Lp=So.NamePlusValue,this.Rp=10,this.gM=e.PyramidLabelSide.Left,this.pM=e.SliceLabelIndices.LabelsOnSides,this.zp=[],this.Vp=this.hs.pyramidChartConnectorStrokeStyle}setLabelConnectorStyle(t){this.Vp=t;for(let t=0;t(t.alignmentX=(r+Math.PI/2)%(2*Math.PI)<=Math.PI?-1:1,t.alignmentY=r%(2*Math.PI)<=Math.PI?-1:1,t.paddingX=Math.cos(r)*n,t.paddingY=Math.sin(r)*n,t),Ml=(t,e,i,s,r,n,o,h)=>{if(0===e)return t.paddingX=h,t.alignmentX=-1,t};var Al;e.SpiderWebMode=void 0,(Al=e.SpiderWebMode||(e.SpiderWebMode={}))[Al.Normal=0]="Normal",Al[Al.Circle=1]="Circle";class wl{constructor(t,e,i,s,n,o,h,a){this.P=new r.Eventer,this.qM=t,this.fe=e,this.scale=i,this.chart=s,this.tag=n,this.axisScale=o,this.JM=h,this.QM=a,this.t_=this.qM._u(this.scale).setMouseInteractions(!1),this.i_=this.fe.ue(this.scale).fs(this.tag).setMouseInteractions(!1),this.s_=this.JM(this,this.fe.Gp(this.scale,void 0,[Bo.InternalUI])).ea(this.chart.getNibStyle()),this.QM.nc([this.i_])}Op(t,i,s,r,n,o,h){const a=i.length,l=i[s>0?s-1:a-1],c=i[s],d=i[s{const n=s/i,o=[];for(let h=-s/2;h<=s/2;h+=r){const r=n*(h/s)+e,a=u(t.x+Math.cos(r)*i,t.y+Math.sin(r)*i);o.push(a)}return o})(t,r,n,f)),h?this.i_.setVisible(!0).Sn(Ke(c,u(h.paddingX,h.paddingY))).Mn(h.alignmentX).An(h.alignmentY):this.i_.setVisible(!1)}getLabelSize(){return this.i_.Ss(this.chart.getAxisLabelFont()).ps(this.chart.getAxisLabelStyle()).Gs().Et()}dispose(){this.t_&&this.t_.dispose(),this.i_&&this.i_.dispose(),this.s_&&this.s_.dispose()}}const Dl=(t,e,i,s,r)=>t.addRow(e.getName()).addRow("Axis:","",s).addRow("Value:","",r(i));class Tl extends ra{constructor(t,i,s,r,n,o,h,a,l,u,c){super(t,l,u,c),this.ac="Spider Series",this.ca=new Map,this.Pu=e.HighlightModes.onHover,this.ox=Dl,this.bb=8,this.sn=0,this.e_=ye(),this.h_={},this.r_={},this.op=this.getVisible(),this.n_=1,this.o_=((t,e)=>{const i=W((()=>{}));let s,r,n=1;return(o,h,a)=>{if(o===r)return;r=o;const l=(null==a?void 0:a.easing)||U.ease,u=(null==a?void 0:a.durationMs)||1e3;s&&(s.finish(!1),s=void 0),!1===o?h&&n?(s=i(u,l)([[n,0]],(([e])=>{n=e,t(n)})),s.onAnimationEnd((()=>{s=void 0,e(!1)}))):(n=0,e(!1)):h?(e(!0),s=i(u,l)([[n,1]],(([e])=>{n=e,t(n)})),s.onAnimationEnd((()=>{s=void 0}))):(n=1,e(!0))}})((t=>{this.n_=t,this.Lr.Li.Bi()}),(t=>{super.setVisible(t)})),this.qa=t,this.Lr=i,this.vb=r,this.a_=n,this.Jy=o,this.l_=h,this.u_=a,this.scale=s;const d=this.qa.getSeries().length;this.c_=ue(u.spiderSeriesFillStyle,d),this.d_=ue(u.spiderSeriesStrokeStyle,d),this.f_=ue(u.spiderSeriesPointFillStyle,d)}Qs(){return this.um&&this.ca.size>0&&this.getVisible()}addPoints(...t){t=t.filter((t=>void 0!==t.axis));for(let e=0;ee.set(t.axis,t.value))),this.e_(0,1,(t=>{e.forEach(((e,s)=>{const r=(null==i?void 0:i.get(s))||0;this.ca.set(s,r+t*(e-r)),this.Lr.Li.Bi()}))}),{easing:this.h_.easing,durationMs:this.h_.durationMs,onStart:()=>{i=new Map(this.ca)}})}else for(let e=0;e=3&&(this.Nv||(this.Nv=this.Lr.vc(this.scale,Ws.Simple).$h(this.d_).ps(this.c_).Ir(this.getHighlight()),this.rc(this.Nv)),this.Nv.lo(t),this.Mb||(this.Mb=this.Lr.Bm(this.scale).q(this.bb).Yn(this.vb).xs(this.sn).ps(this.f_).Ir(this.getHighlight()),this.rc(this.Mb)),this.Mb.qn().Kn(t))}}attach(t,e=!0){return super.attach(t,e),oe(t,this.hs,{fill:this.c_,stroke:this.d_}),this}g_(){for(let t=0;t{const i=Math.PI/2-2*t*Math.PI/e;return i>=0?i:i+2*Math.PI},Bl=t=>ze(t.i_.Mi()),kl=t=>ze(t.Mi()),Il=(t,i,s,r)=>t.ta(0).Sn(s).Zo(90).Ko(-270).ia(i===e.SpiderWebMode.Circle?void 0:r.length),Cl={alignmentX:0,alignmentY:0,paddingX:0,paddingY:0},Pl={alignmentX:0,alignmentY:0,paddingX:0,paddingY:0},Ll=()=>{Pl.alignmentX=0,Pl.alignmentY=0,Pl.paddingX=0,Pl.paddingY=0};class Rl extends qh{constructor(t,i,s,r,n,o,h){super(t,i,s,i.Xg("spiderChart bg",0),i.Eg("spiderChart ui"),r,i.Li.hs.spiderChartBackgroundFillStyle,i.Li.hs.spiderChartBackgroundStrokeStyle,i.Li.hs.spiderChartTitleFont,i.Li.hs.spiderChartTitleFillStyle,h),this.NS=e.AutoCursorModes.onHover,this.rn=x(20,20,20,20),this.axisScale=st.d1({scale1DConstructor:Ai,dimension:"x"}).Z(0,1),this.Jy=[],this.p_=[],this.m_=[],this.y_=Bi.expansion,this.S_=!0,this.x_=Ml,this.b_=bl,this.pr=!0,this.v_=e.SpiderWebMode.Normal,this.M_=4,this.__=this.hs.spiderChartWebStyle,this.A_=this.hs.spiderChartScaleLabelFillStyle,this.w_=this.hs.spiderChartScaleLabelFont,this.k_=5,this.C_=this.hs.spiderChartAxisLabelFillStyle,this.T_=this.hs.spiderChartAxisLabelFont,this.I_=5,this.F_=this.hs.spiderChartAxisStrokeStyle,this.P_=this.hs.spiderChartAxisNibStrokeStyle,this.wd=10,this.D_=x(),this.hasAxis=t=>this.Jy.reduce(((e,i)=>e||i.tag===t),!1),this.formatValue=t=>this.axisScale.oi(t,bi.Numeric),this.B_=()=>(t=>{const e=t.length;for(let i=0;ithis.O_.kc(this.pixelScale).setMouseInteractions(!1),this.R_=t=>t.dispose(),this.E_=()=>this.gf.ue(this.pixelScale).setMouseInteractions(!1),this.z_=t=>t.dispose(),this.V_=t=>this.formatValue(this.axisScale.getInnerStart()+t*(this.axisScale.getInnerEnd()-this.axisScale.getInnerStart())),this.N_=(t,e)=>{let i,s;const r=()=>{void 0!==this.G_&&this.G_.finish(),i=m(this.axisScale.getInnerStart(),this.axisScale.getInnerEnd()),s=this.y_,this.y_=void 0},n=(e,s,r,n,o)=>{const h=u(r.x-s.x,s.y-r.y),a=this.Jy.findIndex((e=>e===t));if(a>=0&&void 0!==i){const e=El(a,this.Jy.length),s=u(Math.cos(e),Math.sin(e)),r=h.x*s.x+h.y*s.y,n=je(Je(t.t_.ri(),t.t_.ei())),l=i.min+(i.max-i.min)*Math.max(1+r/n,.01);this.axisScale.Z(i.min,l),Xt(o),this.Li.Bi()}},o=()=>{if(i=void 0,void 0!==s)if(this.Oi){const t=m(this.axisScale.getInnerStart(),this.axisScale.getInnerEnd()),e=this.H_(),i=s;if(void 0!==e){const s=i.start(t.min,t.max,e.min,e.max),r=i.end(t.min,t.max,e.min,e.max);this.G_=this.Fg.Li.Le(300,U.ease)([[0,1]],(([e])=>{this.axisScale.Z(t.min+e*(s-t.min),t.max+e*(r-t.max))})),this.G_.onAnimationEnd((()=>{this.G_=void 0,this.y_=i}))}else this.y_=s}else this.y_=s;s=void 0};e.setMouseEnterEventHandler(this.W_).setMouseLeaveEventHandler(this.U_).setMouseDragStartEventHandler(r).setMouseDragEventHandler(((t,e,i,s,r)=>n(0,u(e.clientX,e.clientY),s,0,e))).setMouseDragStopEventHandler(o);const h=Fr(new Or(((t,e,i)=>{this.W_(t),r(),Xt(i)}),n,((t,e,i,s)=>{this.U_(t),o(),Xt(s)})));return e.setTouchStartEventHandler(h.onTouchStart).setTouchMoveEventHandler(h.onTouchMove).setTouchEndEventHandler(h.onTouchEnd)},this.Y_=t=>{this.S_&&!this.hasAxis(t)&&this.addAxis(t)},this.l_=(t,e)=>{for(const i of this.Jy)if(i.tag===t){const t=Math.max(Math.min((e-this.axisScale.getInnerStart())/(this.axisScale.getInnerEnd()-this.axisScale.getInnerStart()),1),0);return _e(i.t_.ri(),i.t_.ei(),t)}},this.u_=t=>{if(0===this.Jy.length)return;const e=Je(nt(t,this.engine.scale,this.pixelScale),this.Jy[0].t_.ri()),i=Math.atan2(e.y,e.x);let s,r=Me;for(const t of this.Jy){const e=Je(t.t_.ei(),t.t_.ri()),n=Math.atan2(e.y,e.x),o=Math.abs(i-n);o{this.pr&&(t.ea(this.P_),this.Zg.Bi())},this.U_=t=>{t.ea(this.P_),this.Zg.Bi()},this.ef.Ah||this.ef._h||this.Li.bh(9),this.tM=i.qy("spiderChart series bg",0),this.O_=i.Pp("spiderChart web shapes",0),this.X_=i.Pp("spiderChart axis bg",1),this.vx=i.Pp("spiderChart plotting",2),this.gf=i.Pp("spiderChart fg",3),this.QM=this.iu.lg().vs(this.hs.effectsText),this.Kg.fs("Spider Chart");const a=kt(o?o.autoCursorBuilder:void 0,Rh);this.XS=a.zS(this.HS,this.uiScale,this.uiScale,this.hs),this.Gm=this.tM.kc(this.pixelScale).ps(this.hs.spiderChartSeriesBackgroundFillStyle).$h(J).Zo(90).Ko(-270).ta(0),this.Hm=this.tM.kc(this.pixelScale).ps(F).$h(this.hs.spiderChartSeriesBackgroundStrokeStyle).Zo(90).Ko(-270).ta(0),super.Nm(this.Gm,this.Hm),o&&!0===o.disableAnimations&&this.setAnimationsEnabled(!1),this.Yg(n,this.pixelScale)}addAxis(t){if("string"==typeof t){if(!this.hasAxis(t)){const e=new wl(this.X_,this.gf,this.pixelScale,this,t,this.axisScale,this.N_,this.QM);this.Jy.push(e)}}else t&&this.Jy.push(t);return this.QM.nc(this.Jy.map((t=>t.i_))),this.Zg.Bi(),this}addSeries(t=e.PointShape.Circle){const i=new Tl(this,this.vx,this.pixelScale,t,this.Y_,this.Jy,this.l_,this.u_,this.Rm,this.hs,this.Li.iu);return this.Wm(i),i}getSeriesCount(){return this.Lm.length}getSeries(){return this.Lm}setWebMode(t){return this.v_=t,this.Zg.Bi(),this}getWebMode(){return this.v_}setWebCount(t){return this.M_=t,this.Zg.Bi(),this}getWebCount(){return this.M_}setWebStyle(t){return this.__="function"==typeof t?t(this.__):t,this.Zg.Bi(),this}getWebStyle(){return this.__}setScaleLabelStyle(t){return this.A_="function"==typeof t?t(this.A_):t,this.Zg.Bi(),this}getScaleLabelStyle(){return this.A_}setScaleLabelFont(t){return this.w_="function"==typeof t?t(this.w_):t,this.Zg.Bi(),this}getScaleLabelFont(){return this.w_}setScaleLabelPadding(t){return this.k_=t,this.Zg.Bi(),this}getScaleLabelPadding(){return this.k_}setScaleLabelStrategy(t){return this.x_=t,this.Zg.Bi(),this}setScaleLabelFormatter(t){return this.formatValue=t,this.Zg.Bi(),this}setAxisLabelStyle(t){return this.C_="function"==typeof t?t(this.C_):t,this.Zg.Bi(),this}getAxisLabelStyle(){return this.C_}setAxisLabelFont(t){return this.T_="function"==typeof t?t(this.T_):t,this.Zg.Bi(),this}getAxisLabelFont(){return this.T_}setAxisLabelEffect(t){return this.QM.vs(t),this.Li.Bi(),this}getAxisLabelEffect(){return this.QM._s()}setAxisLabelPadding(t){return this.I_=t,this.Zg.Bi(),this}getAxisLabelPadding(){return this.I_}setAxisLabelStrategy(t){return this.b_=t,this.Zg.Bi(),this}setAxisStyle(t){return this.F_="function"==typeof t?t(this.F_):t,this.Zg.Bi(),this}getAxisStyle(){return this.F_}setNibStyle(t){return this.P_="function"==typeof t?t(this.P_):t,this.Zg.Bi(),this}getNibStyle(){return this.P_}setNibLength(t){return this.wd=t,this.Zg.Bi(),this}getNibLength(){return this.wd}setAutoAxis(t){return this.S_=t,this}getAutoAxis(){return this.S_}setMouseInteractions(t){return this.pr=t,this}getMouseInteractions(){return this.pr}setAxisScrollStrategy(t){return this.y_=t,this.Zg.Bi(),this}getAxisScrollStrategy(){return this.y_}setAxisInterval(t,e=0){return this.axisScale.Z(e,t),this.Zg.Bi(),this}getOriginValue(){return this.axisScale.getInnerStart()}getEdgeValue(){return this.axisScale.getInnerEnd()}ru(){super.ru(),po.ip(this.Kg,this.jg);const t=this.Jy.length,e=po.tp(this.Kg,this.jg),i=u(this.pixelScale.x.getInnerInterval()-(this.rn.left+this.rn.right),this.pixelScale.y.getInnerInterval()-(this.rn.bottom+this.rn.top+e)),s=((t=0,e=0,i=0,s=0)=>({left:t,top:e,right:i,bottom:s}))(0,0,0,0);if(void 0!==this.b_){const e=Math.min(i.x,i.y)/2;for(let i=0;i0?s.right=Math.max(s.right,l.x+.5*(1-a.alignmentX)*h.x-e):s.left=Math.max(s.left,-l.x+.5*(a.alignmentX+1)*h.x-e),o>0?s.top=Math.max(s.top,l.y+.5*(1-a.alignmentY)*h.y-e):s.bottom=Math.max(s.bottom,-l.y+.5*(a.alignmentY+1)*h.y-e)}}if(this.y_){const t=this.H_();if(void 0!==t){const e=this.y_.start(this.axisScale.getInnerStart(),this.axisScale.getInnerEnd(),t.min,t.max),i=this.y_.end(this.axisScale.getInnerStart(),this.axisScale.getInnerEnd(),t.min,t.max);this.axisScale.Z(e,i)}}const r=u(this.pixelScale.x.getInnerStart()+(s.left+this.pixelScale.x.getInnerInterval()-s.right)/2,this.pixelScale.y.getInnerStart()+(s.bottom+this.pixelScale.y.getInnerInterval()-s.top)/2),n=Math.min(i.x/2-(s.left+s.right)/2,i.y/2-(s.bottom+s.top)/2);this.D_=x(this._t.left+this.rn.left+s.left,this._t.top+this.rn.top+e+s.top,this._t.right+this.rn.right+s.right,this._t.bottom+this.rn.bottom+s.bottom),this.Op(r,n);for(const t of this.Lm)t.xm();for(const t of this.Lm)t.ru();super.$g(),this.ZS(!1);for(const t of this.Lm)t.bm()}dispose(){return this.tM.G(),this.O_.G(),this.X_.G(),this.vx.G(),this.gf.G(),super.dispose()}getMinimumSize(){return u(this.D_.left+this.D_.right+100,this.D_.bottom+this.D_.top+100)}Op(t,e){const i=this.Jy.length,s=[];for(let r=0;r{const a=t.length,l=n.length,u=e>0&&l>1;for(let l=0;l=a&&t.push(o());const h=t[l];Il(h,i,s,n);const u=r*((l+1)/e);h.qo(u)}else l{const c=r.length,d=t.length;let f=0;if(void 0!==e)for(let a=0;a=d&&t.push(h());const e=t[f];f+=1;const s=(i-r)/i,c=_e(n,o[a],s);e.Sn(Ke(c,u(p.paddingX,p.paddingY))).Mn(p.alignmentX).An(p.alignmentY).fs(l(s))}}}for(let e=f;e1;for(const s of this.Jy)for(const r of this.Lm){const n=r.getValue(s.tag,i);void 0!==n&&(t=void 0===t?n:Math.min(t,n),e=void 0===e?n:Math.max(e,n))}if(void 0!==t&&void 0!==e)return m(t,e)}}const Fl={getWidth:t=>t.x,getHeight:t=>t.y,toVec2:(t,e)=>({x:t,y:e}),toPoint:(t,e)=>u(t,e)},_l={getWidth:t=>t.y,getHeight:t=>t.x,toVec2:(t,e)=>({x:e,y:t}),toPoint:(t,e)=>u(e,t)},Ol={defaultDragMouseStyle:e.MouseStyles.Horizontal,getTitleTextRotation:()=>0,te:t=>t.getXMin(),ie:t=>t.getXMax(),ee:t=>t.Wp().x},zl={defaultDragMouseStyle:e.MouseStyles.Vertical,getTitleTextRotation:t=>90*t,te:t=>t.getYMin(),ie:t=>t.getYMax(),ee:t=>t.Wp().y},Vl={...Fl,...Ol},Nl={..._l,...zl};class Gl extends Nr{constructor(t,e,i,s){super(),this.de=[],this.nu=0,this.bc=!0,this.P=new r.Eventer,this.j_=t=>(this.de.push(t),this.jl(t),t.setMouseInteractions(this.bc),t),this.getHighlight=()=>this.nu,this.Lr=t,this.scale=e,this.Z_=i,this.hs=s}K_(){return this.de}onHighlight(t){return this.P.on("highlight",t)}offHighlight(t){return this.P.off(t)}dispose(){return this.de.forEach(vt),this.Z_&&this.Z_(this),this.Lr.Li.Bi(),this.P.emit("dispose",this),this}setVisible(t){return super.setVisible(t),this.de.forEach((e=>e.setVisible(t))),this.Lr.Li.Bi(),this}onDispose(t){return this.P.on("dispose",t)}offDispose(t){return this.P.off(t,"dispose")}setHighlight(t){return this.nu=me(t),this.Lr.Bi(),this}setMouseInteractions(t){this.bc=t;for(let t=0;t{t.K_().forEach((t=>this.oc(t)));const e=this.q_.findIndex((e=>e===t));e>=0&&this.q_.splice(e,1),this.Lr.Bi()}}clear(){return this.q_.slice().forEach(vt),this.q_.length=0,this.Du=0,this.Lr.Bi(),this}J_(t,e){void 0!==e?this.q_.splice(e,0,t):this.q_.push(t),t.K_().forEach((t=>this.rc(t,{setEventHandlers:!1}))),t.onMouseEnter(((t,e)=>this.Eu(t,e))),t.onMouseLeave(((t,e)=>this.Vu(t,e))),t.onMouseClick(((t,e)=>this.Wu(t,e))),t.onMouseDoubleClick(((t,e)=>this.Uu(t,e))),t.onMouseDown(((t,e)=>this.$u(t,e))),t.onMouseUp(((t,e)=>this.Yu(t,e))),t.onMouseMove(((t,e)=>this.Gu(t,e))),t.onMouseDragStart(((t,e,i)=>this.Xu(t,e,i))),t.onMouseDrag(((t,e,i,s,r)=>this.ju(t,e,i,s,r))),t.onMouseDragStop(((t,e,i,s)=>this.Zu(t,e,i,s))),t.onMouseWheel(((t,e)=>this.Ku(t,e))),t.onTouchStart(((t,e)=>this.qu(t,e))),t.onTouchMove(((t,e)=>this.Ju(t,e))),t.onTouchEnd(((t,e)=>this.Qu(t,e))),this.Lr.Bi()}mc(t,e){t.setHighlight(e)}Q_(t){return this.q_.find((e=>e.K_().includes(t)))}setCursorEnabled(t){return super.setCursorEnabled(t)}}class Hl extends Gl{}class Wl extends Ul{constructor(){super(...arguments),this.tA=void 0,this.iA=()=>{this.tA=void 0}}Qs(){return this.um&&this.q_.length>0&&this.getVisible()}setDefaultStyle(t){this.sA=t,this.q_.forEach(t),t(this.eA);for(let t=0;tt.getVisible()&&t.getIsUnderMouse())):this.q_.filter((t=>t.getVisible())),this.rA,Le);if(void 0!==i)return{location:nt(i[0],this.Lr.Li.ct,this.scale),scale:this.scale,resultTableContent:this.ox(new wh,this,i[1]).wu(),series:this,fillStyle:i[1].getDominantStyle(),figure:i[1]}}solveNearestFromScreen(t){return this.jS(t,!1)}J_(t){super.J_(t),this.sA&&this.sA(t)}clear(){return this.tA=void 0,super.clear()}getXMax(){return this.tA||(this.tA=this.nA()),this.tA.max.x}getXMin(){return this.tA||(this.tA=this.nA()),this.tA.min.x}getYMax(){return this.tA||(this.tA=this.nA()),this.tA.max.y}getYMin(){return this.tA||(this.tA=this.nA()),this.tA.min.y}Wp(){return u(0,0)}nA(){const t=m(c(Me,Me),c(Ae,Ae));for(let e=0;e{const i=[],s=t.length,r=e;if(s>0){let e=0,n=t[0];i[e]=n,e+=1;for(let o=1;o