@visactor/vutils 1.0.26 → 1.0.28
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.zh-CN.md +17 -0
- package/cjs/common/ascending.js +1 -2
- package/cjs/common/deviation.js +2 -1
- package/cjs/common/getType.js +1 -2
- package/cjs/common/isFunction.js +2 -1
- package/cjs/common/isObject.js +1 -2
- package/cjs/common/isPrototype.js +1 -1
- package/cjs/common/isRegExp.js +1 -1
- package/cjs/common/isShallowEqual.js +1 -1
- package/cjs/common/isString.js +1 -1
- package/cjs/common/isType.js +1 -1
- package/cjs/common/kde.d.ts +4 -0
- package/cjs/common/kde.js +25 -14
- package/cjs/common/kde.js.map +1 -1
- package/cjs/common/regression-lowess.d.ts +1 -1
- package/cjs/common/regression-lowess.js +2 -2
- package/cjs/common/regression-lowess.js.map +1 -1
- package/cjs/data-structure/bounds.js +1 -1
- package/cjs/data-structure/hashTable.js +2 -1
- package/cjs/data-structure/index.js +1 -1
- package/cjs/data-structure/matrix.js +1 -1
- package/cjs/data-structure/point.js +1 -1
- package/dist/index.js +68 -41
- package/dist/index.min.js +15 -15
- package/es/common/ascending.js +1 -2
- package/es/common/deviation.js +2 -1
- package/es/common/getType.js +1 -2
- package/es/common/isFunction.js +2 -1
- package/es/common/isObject.js +1 -2
- package/es/common/isPrototype.js +1 -1
- package/es/common/isRegExp.js +1 -1
- package/es/common/isShallowEqual.js +1 -1
- package/es/common/isString.js +1 -1
- package/es/common/isType.js +1 -1
- package/es/common/kde.d.ts +4 -0
- package/es/common/kde.js +29 -14
- package/es/common/kde.js.map +1 -1
- package/es/common/regression-lowess.d.ts +1 -1
- package/es/common/regression-lowess.js +2 -2
- package/es/common/regression-lowess.js.map +1 -1
- package/es/data-structure/bounds.js +1 -1
- package/es/data-structure/hashTable.js +2 -1
- package/es/data-structure/index.js +1 -1
- package/es/data-structure/matrix.js +1 -1
- package/es/data-structure/point.js +1 -1
- package/package.json +3 -4
- package/REGRESSION.md +0 -36
package/dist/index.min.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).VUtils={})}(this,(function(t){"use strict";function e(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var n={exports:{}};!function(t){var e=Object.prototype.hasOwnProperty,n="~";function r(){}function u(t,e,n){this.fn=t,this.context=e,this.once=n||!1}function i(t,e,r,i,s){if("function"!=typeof r)throw new TypeError("The listener must be a function");var o=new u(r,i||t,s),a=n?n+e:e;return t._events[a]?t._events[a].fn?t._events[a]=[t._events[a],o]:t._events[a].push(o):(t._events[a]=o,t._eventsCount++),t}function s(t,e){0==--t._eventsCount?t._events=new r:delete t._events[e]}function o(){this._events=new r,this._eventsCount=0}Object.create&&(r.prototype=Object.create(null),(new r).__proto__||(n=!1)),o.prototype.eventNames=function(){var t,r,u=[];if(0===this._eventsCount)return u;for(r in t=this._events)e.call(t,r)&&u.push(n?r.slice(1):r);return Object.getOwnPropertySymbols?u.concat(Object.getOwnPropertySymbols(t)):u},o.prototype.listeners=function(t){var e=n?n+t:t,r=this._events[e];if(!r)return[];if(r.fn)return[r.fn];for(var u=0,i=r.length,s=new Array(i);u<i;u++)s[u]=r[u].fn;return s},o.prototype.listenerCount=function(t){var e=n?n+t:t,r=this._events[e];return r?r.fn?1:r.length:0},o.prototype.emit=function(t,e,r,u,i,s){var o=n?n+t:t;if(!this._events[o])return!1;var a,D,l=this._events[o],h=arguments.length;if(l.fn){switch(l.once&&this.removeListener(t,l.fn,void 0,!0),h){case 1:return l.fn.call(l.context),!0;case 2:return l.fn.call(l.context,e),!0;case 3:return l.fn.call(l.context,e,r),!0;case 4:return l.fn.call(l.context,e,r,u),!0;case 5:return l.fn.call(l.context,e,r,u,i),!0;case 6:return l.fn.call(l.context,e,r,u,i,s),!0}for(D=1,a=new Array(h-1);D<h;D++)a[D-1]=arguments[D];l.fn.apply(l.context,a)}else{var c,f=l.length;for(D=0;D<f;D++)switch(l[D].once&&this.removeListener(t,l[D].fn,void 0,!0),h){case 1:l[D].fn.call(l[D].context);break;case 2:l[D].fn.call(l[D].context,e);break;case 3:l[D].fn.call(l[D].context,e,r);break;case 4:l[D].fn.call(l[D].context,e,r,u);break;default:if(!a)for(c=1,a=new Array(h-1);c<h;c++)a[c-1]=arguments[c];l[D].fn.apply(l[D].context,a)}}return!0},o.prototype.on=function(t,e,n){return i(this,t,e,n,!1)},o.prototype.once=function(t,e,n){return i(this,t,e,n,!0)},o.prototype.removeListener=function(t,e,r,u){var i=n?n+t:t;if(!this._events[i])return this;if(!e)return s(this,i),this;var o=this._events[i];if(o.fn)o.fn!==e||u&&!o.once||r&&o.context!==r||s(this,i);else{for(var a=0,D=[],l=o.length;a<l;a++)(o[a].fn!==e||u&&!o[a].once||r&&o[a].context!==r)&&D.push(o[a]);D.length?this._events[i]=1===D.length?D[0]:D:s(this,i)}return this},o.prototype.removeAllListeners=function(t){var e;return t?(e=n?n+t:t,this._events[e]&&s(this,e)):(this._events=new r,this._eventsCount=0),this},o.prototype.off=o.prototype.removeListener,o.prototype.addListener=o.prototype.on,o.prefixed=n,o.EventEmitter=o,t.exports=o}(n);var r=e(n.exports);const u=(t,e)=>Object.prototype.toString.call(t)===`[object ${e}]`,i=(t,e=!1)=>e?"boolean"==typeof t:!0===t||!1===t||u(t,"Boolean"),s=t=>"function"==typeof t,o=t=>null==t,a=t=>null!=t,D=t=>{const e=typeof t;return null!==t&&"object"===e||"function"===e},l=t=>"object"==typeof t&&null!==t,h=function(t){if(!l(t)||!u(t,"Object"))return!1;if(null===Object.getPrototypeOf(t))return!0;let e=t;for(;null!==Object.getPrototypeOf(e);)e=Object.getPrototypeOf(e);return Object.getPrototypeOf(t)===e},c=(t,e=!1)=>{const n=typeof t;return e?"string"===n:"string"===n||u(t,"String")},f=t=>Array.isArray?Array.isArray(t):u(t,"Array"),F=function(t){return null!==t&&"function"!=typeof t&&Number.isFinite(t.length)},d=t=>u(t,"Date"),m=(t,e=!1)=>{const n=typeof t;return e?"number"===n:"number"===n||u(t,"Number")},g=t=>m(t)&&Number.isFinite(t),p=t=>u(t,"RegExp"),y=Object.prototype,x=Object.prototype.hasOwnProperty;const C=(t,e,n)=>{const r=c(e)?e.split("."):e;for(let e=0;e<r.length;e++)t=t?t[r[e]]:void 0;return void 0===t?n:t},E=Object.prototype.hasOwnProperty;function M(t,e,n=!1,r=!1){if(e){if(t===e)return;if(a(e)&&"object"==typeof e){const u=Object(e),i=[];for(const t in u)i.push(t);let{length:s}=i,o=-1;for(;s--;){const s=i[++o];!a(u[s])||"object"!=typeof u[s]||r&&f(t[s])?B(t,s,u[s]):b(t,e,s,n,r)}}}}function b(t,e,n,r=!1,u=!1){const i=t[n],s=e[n];let o=e[n],a=!0;if(f(s)){if(r)o=[];else if(f(i))o=i;else if(F(i)){o=new Array(i.length);let t=-1;const e=i.length;for(;++t<e;)o[t]=i[t]}}else h(s)?(o=null!=i?i:{},"function"!=typeof i&&"object"==typeof i||(o={})):a=!1;a&&M(o,s,r,u),B(t,n,o)}function B(t,e,n){(void 0!==n&&!function(t,e){return t===e||Number.isNaN(t)&&Number.isNaN(e)}(t[e],n)||void 0===n&&!(e in t))&&(t[e]=n)}const v=Object.prototype.hasOwnProperty;function w(t){return Object.prototype.toString.call(t)}function A(t){return Object.keys(t)}function S(t,e){return t===e?0!==t||0!==e||1/t==1/e:t!=t&&e!=e}function T(t){return f(t)?t.length:D(t)?Object.keys(t).length:0}function _(t){if(!t)return[];if(Object.keys)return Object.keys(t);const e=[];for(const n in t)t.hasOwnProperty(n)&&e.push(n);return e}function N(t,e,n){const r=_(e);for(let u=0;u<r.length;u++){const i=r[u];(n?null!=e[i]:null==t[i])&&(t[i]=e[i])}return t}function L(t){return a(t)?f(t)?t:[t]:[]}function k(t){if(F(t)){return t[t.length-1]}}function I(t,e){return t<e?-1:t>e?1:t>=e?0:NaN}function
|
|
1
|
+
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).VUtils={})}(this,(function(t){"use strict";function e(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var n={exports:{}};!function(t){var e=Object.prototype.hasOwnProperty,n="~";function r(){}function u(t,e,n){this.fn=t,this.context=e,this.once=n||!1}function i(t,e,r,i,s){if("function"!=typeof r)throw new TypeError("The listener must be a function");var o=new u(r,i||t,s),a=n?n+e:e;return t._events[a]?t._events[a].fn?t._events[a]=[t._events[a],o]:t._events[a].push(o):(t._events[a]=o,t._eventsCount++),t}function s(t,e){0==--t._eventsCount?t._events=new r:delete t._events[e]}function o(){this._events=new r,this._eventsCount=0}Object.create&&(r.prototype=Object.create(null),(new r).__proto__||(n=!1)),o.prototype.eventNames=function(){var t,r,u=[];if(0===this._eventsCount)return u;for(r in t=this._events)e.call(t,r)&&u.push(n?r.slice(1):r);return Object.getOwnPropertySymbols?u.concat(Object.getOwnPropertySymbols(t)):u},o.prototype.listeners=function(t){var e=n?n+t:t,r=this._events[e];if(!r)return[];if(r.fn)return[r.fn];for(var u=0,i=r.length,s=new Array(i);u<i;u++)s[u]=r[u].fn;return s},o.prototype.listenerCount=function(t){var e=n?n+t:t,r=this._events[e];return r?r.fn?1:r.length:0},o.prototype.emit=function(t,e,r,u,i,s){var o=n?n+t:t;if(!this._events[o])return!1;var a,D,l=this._events[o],h=arguments.length;if(l.fn){switch(l.once&&this.removeListener(t,l.fn,void 0,!0),h){case 1:return l.fn.call(l.context),!0;case 2:return l.fn.call(l.context,e),!0;case 3:return l.fn.call(l.context,e,r),!0;case 4:return l.fn.call(l.context,e,r,u),!0;case 5:return l.fn.call(l.context,e,r,u,i),!0;case 6:return l.fn.call(l.context,e,r,u,i,s),!0}for(D=1,a=new Array(h-1);D<h;D++)a[D-1]=arguments[D];l.fn.apply(l.context,a)}else{var c,f=l.length;for(D=0;D<f;D++)switch(l[D].once&&this.removeListener(t,l[D].fn,void 0,!0),h){case 1:l[D].fn.call(l[D].context);break;case 2:l[D].fn.call(l[D].context,e);break;case 3:l[D].fn.call(l[D].context,e,r);break;case 4:l[D].fn.call(l[D].context,e,r,u);break;default:if(!a)for(c=1,a=new Array(h-1);c<h;c++)a[c-1]=arguments[c];l[D].fn.apply(l[D].context,a)}}return!0},o.prototype.on=function(t,e,n){return i(this,t,e,n,!1)},o.prototype.once=function(t,e,n){return i(this,t,e,n,!0)},o.prototype.removeListener=function(t,e,r,u){var i=n?n+t:t;if(!this._events[i])return this;if(!e)return s(this,i),this;var o=this._events[i];if(o.fn)o.fn!==e||u&&!o.once||r&&o.context!==r||s(this,i);else{for(var a=0,D=[],l=o.length;a<l;a++)(o[a].fn!==e||u&&!o[a].once||r&&o[a].context!==r)&&D.push(o[a]);D.length?this._events[i]=1===D.length?D[0]:D:s(this,i)}return this},o.prototype.removeAllListeners=function(t){var e;return t?(e=n?n+t:t,this._events[e]&&s(this,e)):(this._events=new r,this._eventsCount=0),this},o.prototype.off=o.prototype.removeListener,o.prototype.addListener=o.prototype.on,o.prefixed=n,o.EventEmitter=o,t.exports=o}(n);var r=e(n.exports);const u=(t,e)=>Object.prototype.toString.call(t)===`[object ${e}]`,i=(t,e=!1)=>e?"boolean"==typeof t:!0===t||!1===t||u(t,"Boolean"),s=t=>"function"==typeof t,o=t=>null==t,a=t=>null!=t,D=t=>{const e=typeof t;return null!==t&&"object"===e||"function"===e},l=t=>"object"==typeof t&&null!==t,h=function(t){if(!l(t)||!u(t,"Object"))return!1;if(null===Object.getPrototypeOf(t))return!0;let e=t;for(;null!==Object.getPrototypeOf(e);)e=Object.getPrototypeOf(e);return Object.getPrototypeOf(t)===e},c=(t,e=!1)=>{const n=typeof t;return e?"string"===n:"string"===n||u(t,"String")},f=t=>Array.isArray?Array.isArray(t):u(t,"Array"),F=function(t){return null!==t&&"function"!=typeof t&&Number.isFinite(t.length)},d=t=>u(t,"Date"),m=(t,e=!1)=>{const n=typeof t;return e?"number"===n:"number"===n||u(t,"Number")},g=t=>m(t)&&Number.isFinite(t),p=t=>u(t,"RegExp"),y=Object.prototype,x=Object.prototype.hasOwnProperty;const C=(t,e,n)=>{const r=c(e)?e.split("."):e;for(let e=0;e<r.length;e++)t=t?t[r[e]]:void 0;return void 0===t?n:t},E=Object.prototype.hasOwnProperty;function M(t,e,n=!1,r=!1){if(e){if(t===e)return;if(a(e)&&"object"==typeof e){const u=Object(e),i=[];for(const t in u)i.push(t);let{length:s}=i,o=-1;for(;s--;){const s=i[++o];!a(u[s])||"object"!=typeof u[s]||r&&f(t[s])?B(t,s,u[s]):b(t,e,s,n,r)}}}}function b(t,e,n,r=!1,u=!1){const i=t[n],s=e[n];let o=e[n],a=!0;if(f(s)){if(r)o=[];else if(f(i))o=i;else if(F(i)){o=new Array(i.length);let t=-1;const e=i.length;for(;++t<e;)o[t]=i[t]}}else h(s)?(o=null!=i?i:{},"function"!=typeof i&&"object"==typeof i||(o={})):a=!1;a&&M(o,s,r,u),B(t,n,o)}function B(t,e,n){(void 0!==n&&!function(t,e){return t===e||Number.isNaN(t)&&Number.isNaN(e)}(t[e],n)||void 0===n&&!(e in t))&&(t[e]=n)}const v=Object.prototype.hasOwnProperty;function w(t){return Object.prototype.toString.call(t)}function A(t){return Object.keys(t)}function S(t,e){return t===e?0!==t||0!==e||1/t==1/e:t!=t&&e!=e}function T(t){return f(t)?t.length:D(t)?Object.keys(t).length:0}function _(t){if(!t)return[];if(Object.keys)return Object.keys(t);const e=[];for(const n in t)t.hasOwnProperty(n)&&e.push(n);return e}function N(t,e,n){const r=_(e);for(let u=0;u<r.length;u++){const i=r[u];(n?null!=e[i]:null==t[i])&&(t[i]=e[i])}return t}function L(t){return a(t)?f(t)?t:[t]:[]}function k(t){if(F(t)){return t[t.length-1]}}function I(t,e){return t<e?-1:t>e?1:t>=e?0:NaN}function R(t){return Number(t)}function U(t,e,n=R){const r=t.length;if(!r)return;if(e<=0||r<2)return n(t[0],0,t);if(e>=1)return n(t[r-1],r-1,t);const u=(r-1)*e,i=Math.floor(u),s=n(t[i],i,t);return s+(n(t[i+1],i+1,t)-s)*(u-i)}function O(t){if(0===t)return-1/0;if(1===t)return 1/0;if(!Number.isFinite(t)||t<0||t>1)return NaN;const e=-.00778489400243029,n=-.322396458041136,r=-2.40075827716184,u=-2.54973253934373,i=4.37466414146497,s=2.93816398269878,o=.00778469570904146,a=.32246712907004,D=2.445134137143,l=3.75440866190742,h=.02425;let c,f;return t<h?(c=Math.sqrt(-2*Math.log(t)),(((((e*c+n)*c+r)*c+u)*c+i)*c+s)/((((o*c+a)*c+D)*c+l)*c+1)):t<=.97575?(c=t-.5,f=c*c,(((((-39.6968302866538*f+220.946098424521)*f-275.928510446969)*f+138.357751867269)*f-30.6647980661472)*f+2.50662827745924)*c/(((((-54.4760987982241*f+161.585836858041)*f-155.698979859887)*f+66.8013118877197)*f-13.2806815528857)*f+1)):(c=Math.sqrt(-2*Math.log(1-t)),-(((((e*c+n)*c+r)*c+u)*c+i)*c+s)/((((o*c+a)*c+D)*c+l)*c+1))}
|
|
2
2
|
/* Adapted from vega by University of Washington Interactive Data Lab
|
|
3
3
|
* https://vega.github.io/vega/
|
|
4
4
|
* Licensed under the BSD-3-Clause
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* url: https://github.com/vega/vega/blob/main/packages/vega-util/src/logger.js
|
|
7
7
|
* License: https://github.com/vega/vega/blob/main/LICENSE
|
|
8
8
|
* @license
|
|
9
|
-
*/const P="undefined"!=typeof console;function H(t,e,n){const r=[e].concat([].slice.call(n));P&&console[t].apply(console,r)}var
|
|
9
|
+
*/const P="undefined"!=typeof console;function H(t,e,n){const r=[e].concat([].slice.call(n));P&&console[t].apply(console,r)}var j;t.LoggerLevel=void 0,(j=t.LoggerLevel||(t.LoggerLevel={}))[j.None=0]="None",j[j.Error=1]="Error",j[j.Warn=2]="Warn",j[j.Info=3]="Info",j[j.Debug=4]="Debug";class q{static getInstance(t,e){return q._instance&&m(t)?q._instance.level(t):q._instance||(q._instance=new q(t,e)),q._instance}static setInstance(t){return q._instance=t}static setInstanceLevel(t){q._instance?q._instance.level(t):q._instance=new q(t)}static clearInstance(){q._instance=null}constructor(e=t.LoggerLevel.None,n){this._onErrorHandler=[],this._level=e,this._method=n}addErrorHandler(t){this._onErrorHandler.find((e=>e===t))||this._onErrorHandler.push(t)}removeErrorHandler(t){const e=this._onErrorHandler.findIndex((e=>e===t));e<0||this._onErrorHandler.splice(e,1)}callErrorHandler(...t){this._onErrorHandler.forEach((e=>e(...t)))}canLogInfo(){return this._level>=t.LoggerLevel.Info}canLogDebug(){return this._level>=t.LoggerLevel.Debug}canLogError(){return this._level>=t.LoggerLevel.Error}canLogWarn(){return this._level>=t.LoggerLevel.Warn}level(t){return arguments.length?(this._level=+t,this):this._level}error(...e){var n;return this._level>=t.LoggerLevel.Error&&(this._onErrorHandler.length?this.callErrorHandler(...e):H(null!==(n=this._method)&&void 0!==n?n:"error","ERROR",e)),this}warn(...e){return this._level>=t.LoggerLevel.Warn&&H(this._method||"warn","WARN",e),this}info(...e){return this._level>=t.LoggerLevel.Info&&H(this._method||"log","INFO",e),this}debug(...e){return this._level>=t.LoggerLevel.Debug&&H(this._method||"log","DEBUG",e),this}}q._instance=null;const W=(t,e,n)=>{let r=t,u=e;for(;r<u;){const t=Math.floor((r+u)/2);n(t)>=0?u=t:r=t+1}return r};function z(t,e){let n,r=0,u=0,i=0;if(void 0===e)for(let e of t)null!=e&&(e=+e)>=e&&(n=e-u,u+=n/++r,i+=n*(e-u));else{let s=-1;for(let o of t)null!=(o=e(o,++s,t))&&(o=+o)>=o&&(n=o-u,u+=n/++r,i+=n*(o-u))}return r>1?i/(r-1):0}const Y=(t,e)=>{let n=t;return!0!==e&&(n=t.sort(I)),U(n,.5)},G=Math.sqrt(50),V=Math.sqrt(10),$=Math.sqrt(2);const X=1e-10,Z=1e-10;function J(t,e,n=Z,r=X){const u=r,i=n*Math.max(t,e);return Math.abs(t-e)<=Math.max(u,i)}const Q=(t,e=0)=>{let n="",r=e-1;for(;r>=0;)n=`${n}${t}`,r-=1;return n},K=(t,e,n=" ",r="right")=>{const u=n,i=t+"",s=e-i.length;return s<=0?i:"left"===r?Q(u,s)+i:"center"===r?Q(u,Math.floor(s/2))+i+Q(u,Math.ceil(s/2)):i+Q(u,s)},tt=function(t,e,n){return t<e?e:t>n?n:t};let et=!1;try{et="function"==typeof requestAnimationFrame&&"function"==typeof cancelAnimationFrame}catch(t){et=!1}function nt(t,e,n){let r,u,i,s,o,a,l=0,h=!1,c=!1,f=!0;const F=!e&&0!==e&&et;if("function"!=typeof t)throw new TypeError("Expected a function");function d(e){const n=r,i=u;return r=u=void 0,l=e,s=t.apply(i,n),s}function m(t,e){return F?(cancelAnimationFrame(o),requestAnimationFrame(t)):setTimeout(t,e)}function p(t){const n=t-a;return void 0===a||n>=e||n<0||c&&t-l>=i}function y(){const t=Date.now();if(p(t))return x(t);o=m(y,function(t){const n=t-l,r=e-(t-a);return c?Math.min(r,i-n):r}(t))}function x(t){return o=void 0,f&&r?d(t):(r=u=void 0,s)}function C(...t){const n=Date.now(),i=p(n);if(r=t,u=this,a=n,i){if(void 0===o)return function(t){return l=t,o=m(y,e),h?d(t):s}(a);if(c)return o=m(y,e),d(a)}return void 0===o&&(o=m(y,e)),s}return e=+e||0,D(n)&&(h=!!n.leading,c="maxWait"in n,c&&(i=Math.max(g(n.maxWait)?n.maxWait:0,e)),f="trailing"in n?!!n.trailing:f),C.cancel=function(){void 0!==o&&function(t){if(F)return cancelAnimationFrame(t);clearTimeout(t)}(o),l=0,r=a=u=o=void 0},C.flush=function(){return void 0===o?s:x(Date.now())},C.pending=function(){return void 0!==o},C}function rt(t,e){return n=>t*(1-n)+e*n}et=!1;const ut=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,it=new RegExp(ut.source,"g");const st=/^(?:(\d{4})(?:[-\/](\d{1,2})(?:[-\/](\d{1,2})(?:[T ](\d{1,2})(?::(\d{1,2})(?::(\d{1,2})(?:[.,](\d+))?)?)?(Z|[\+\-]\d\d:?\d\d)?)?)?)?)?$/;function ot(t){if(t instanceof Date)return t;if(c(t)){const e=st.exec(t);if(!e)return new Date(NaN);if(!e[8])return new Date(+e[1],+(e[2]||1)-1,+e[3]||1,+e[4]||0,+(e[5]||0),+e[6]||0,e[7]?+e[7].substring(0,3):0);let n=+e[4]||0;return"Z"!==e[8].toUpperCase()&&(n-=+e[8].slice(0,3)),new Date(Date.UTC(+e[1],+(e[2]||1)-1,+e[3]||1,n,+(e[5]||0),+e[6]||0,e[7]?+e[7].substring(0,3):0))}return o(t)?new Date(NaN):new Date(Math.round(t))}
|
|
10
10
|
/* Adapted from vega by University of Washington Interactive Data Lab
|
|
11
11
|
* https://vega.github.io/vega/
|
|
12
12
|
* Licensed under the BSD-3-Clause
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
* License: https://github.com/vega/vega/blob/main/LICENSE
|
|
16
16
|
* @license
|
|
17
17
|
*/
|
|
18
|
-
const at=1664525,Dt=1013904223,lt=4294967296;function ht(t=1){let e=t;return()=>(e=(at*e+Dt)%lt)/lt}const ct=t=>e=>C(e,t),ft=(t,e={})=>{if(s(t))return t;const n=[t];return(e&&e.get||ct)(n)};function Ft(t,e,n){const r=[];return t.forEach((t=>{const u=e(t),i=n(t);null!=u&&null!=i&&Number.isFinite(+u)&&Number.isFinite(+i)&&r.push({x:+u,y:+i})})),r}function dt(t,e,n){const r=t-e;return Number.isFinite(r)?r/n:t/n-e/n}function mt(t){let e=1/0,n=-1/0,r=1/0,u=-1/0;for(const i of t)e=Math.min(e,i.x),n=Math.max(n,i.x),r=Math.min(r,i.y),u=Math.max(u,i.y);if(!t.length)return{xCenter:0,xScale:1,yCenter:0,yScale:1};const i=e/2+n/2,s=r/2+u/2;return{xCenter:i,yCenter:s,xScale:Math.max(Math.abs(e-i),Math.abs(n-i))||1,yScale:Math.max(Math.abs(r-s),Math.abs(u-s))||1}}function gt(t,e,n=mt(t)){const r=e+1;if(1===e){let e=0,r=0,u=0;for(const i of t)u++,e+=(dt(i.x,n.xCenter,n.xScale)-e)/u,r+=(dt(i.y,n.yCenter,n.yScale)-r)/u;let i=0,s=0;for(const u of t){const t=dt(u.x,n.xCenter,n.xScale)-e;i+=t*t,s+=t*(dt(u.y,n.yCenter,n.yScale)-r)}const o=0===i?0:s/i;return{coef:0===i?[r/(1+e*e),e*r/(1+e*e)]:[r-o*e,o],rank:0===u?0:0===i?1:2,basis:n}}const u=Array.from({length:r},(()=>new Array(r).fill(0))),i=new Array(r).fill(0),s=new Array(r);for(const e of t){const t=dt(e.x,n.xCenter,n.xScale);s[0]=1;for(let e=1;e<r;e++)s[e]=s[e-1]*t;let o=dt(e.y,n.yCenter,n.yScale);for(let t=0;t<r;t++){const e=Math.hypot(u[t][t],s[t]);if(0===e)continue;const n=u[t][t]/e,a=s[t]/e;u[t][t]=e;for(let e=t+1;e<r;e++){const r=u[t][e];u[t][e]=n*r+a*s[e],s[e]=-a*r+n*s[e]}const D=i[t];i[t]=n*D+a*o,o=-a*D+n*o}}const o=Math.max(...u.map(((t,e)=>Math.abs(t[e]))))*Number.EPSILON*r*64;if(u.some(((t,e)=>Math.abs(t[e])<=o)))return Object.assign(Object.assign({},function(t,e){const n=e.length,r=t.map((t=>t.slice())),u=Array.from({length:n},((t,e)=>Array.from({length:n},((t,n)=>+(e===n)))));for(let t=0;t<50;t++){let t=!1;for(let e=0;e<n-1;e++)for(let i=e+1;i<n;i++){let s=0,o=0,a=0;for(let t=0;t<n;t++)s+=r[t][e]**2,o+=r[t][i]**2,a+=r[t][e]*r[t][i];if(Math.abs(a)<=8*Number.EPSILON*Math.sqrt(s*o))continue;t=!0;const D=(o-s)/(2*a),l=(D>=0?1:-1)/(Math.abs(D)+Math.hypot(1,D)),h=1/Math.hypot(1,l),c=h*l;for(let t=0;t<n;t++){const n=r[t][e],s=r[t][i],o=u[t][e],a=u[t][i];r[t][e]=h*n-c*s,r[t][i]=c*n+h*s,u[t][e]=h*o-c*a,u[t][i]=c*o+h*a}}if(!t)break}const i=Array.from({length:n},((t,e)=>Math.hypot(...r.map((t=>t[e]))))),s=Math.max(...i)*Number.EPSILON*n*64,o=new Array(n).fill(0);let a=0;for(let t=0;t<n;t++){if(i[t]<=s)continue;a++;let D=0;for(let u=0;u<n;u++)D+=r[u][t]*e[u];D/=i[t]**2;for(let e=0;e<n;e++)o[e]+=u[e][t]*D}return{coef:o,rank:a}}(u,i)),{basis:n});const a=new Array(r);for(let t=r-1;t>=0;t--){let e=i[t];for(let n=t+1;n<r;n++)e-=u[t][n]*a[n];a[t]=e/u[t][t]}return{coef:a,rank:r,basis:n}}function pt(t,e){const n=dt(e,t.basis.xCenter,t.basis.xScale);let r=0;for(let e=t.coef.length-1;e>=0;e--)r=r*n+t.coef[e];return t.basis.yCenter+t.basis.yScale*r}function yt(t){let e=[t.coef[t.coef.length-1]];const n=-t.basis.xCenter/t.basis.xScale,r=1/t.basis.xScale;for(let u=t.coef.length-2;u>=0;u--){const i=new Array(e.length+1).fill(0);e.forEach(((t,e)=>{i[e]+=n*t,i[e+1]+=r*t})),i[0]+=t.coef[u],e=i}if(e=e.map((e=>e*t.basis.yScale)),e[0]+=t.basis.yCenter,e.some((t=>!Number.isFinite(t))))throw new RangeError("Regression coefficients are not finite");return e}function xt(t,e,n,r){if(!Number.isInteger(n)||n<=0||!Number.isFinite(t)||!Number.isFinite(e))return[];const u=e-t,i=1===n?0:u/(n-1);return Array.from({length:n},((s,o)=>{const a=1===n?0:o/(n-1),D=0===o?t:o===n-1?e:Number.isFinite(u)?t+o*i:(1-a)*t+a*e;return{x:D,y:r(D)}}))}function Ct(t){return!Number.isFinite(t)||t<0||t>1?NaN:-O(t/2)}function Et(t,e){return Number.isNaN(t)?NaN:0===e?0:t*e}function Mt(t,e,n,r){let u=1/0,i=-1/0,s=0,a=0;for(let r=0;r<t.length;r++){const D=t[r];let l=e(D),h=n(D);!o(l)&&(l=+l)>=l&&!o(h)&&(h=+h)>=h&&(l<u&&(u=l),l>i&&(i=l),s++,a+=l)}if(0===s)return{min:u,max:i,n:s,X:0,SSE:0,Sxx:0};const D=a/s;let l=0,h=0;for(let u=0;u<t.length;u++){const i=t[u];let s=e(i),a=n(i);if(!o(s)&&(s=+s)>=s&&!o(a)&&(a=+a)>=a){const t=a-r(s);l+=t*t;const e=s-D;h+=e*e}}return{min:u,max:i,n:s,X:D,SSE:l,Sxx:h}}function bt(t,e){const{n:n,X:r,Sxx:u,SSE:i}=e,s=n>2?i/(n-2):0;return{seMean:u>0?Math.sqrt(s*(1/n+(t-r)*(t-r)/u)):Math.sqrt(s/n),sePred:Math.sqrt(s*(1+1/n+(u>0?(t-r)*(t-r)/u:0)))}}function Bt(t,e,n,r){for(let u=0;u<t.length;u++){const i=t[u];let s=e(i),a=n(i);!o(s)&&(s=+s)>=s&&!o(a)&&(a=+a)>=a&&r(s,a,u)}}function vt(t,e,n,r,u){let i=0,s=0;for(let a=0;a<t.length;a++){const D=t[a];let l=n(D);if(!o(l)&&(l=+l)>=l){const t=l-u(e(D));i+=t*t;const n=l-r;s+=n*n}}return 0===s?0:1-i/s}const wt=t=>1/Math.sqrt(2*Math.PI)*Math.exp(-.5*t*t);function At(t,e,n=1){return t<=0||0===e?0:e*Math.pow(t,-1/(n+4))}function St(t,e,n=1){if(t<=0||0===e)return 0;return Math.pow(4/(n+2),1/(n+4))*e*Math.pow(t,-1/(n+4))}function Tt(t,e){let n=0,r=0;for(let u=0;u<t.length;u++)n=Math.max(n,Math.abs(t[u])),r=Math.max(r,Math.abs(e[u]));if(!n||!r)return;let u=0,i=0,s=0,o=0;for(let a=0;a<t.length;a++){const D=t[a]/n-s,l=e[a]/r-o,h=u+D,c=i+l;s=h-u-D,o=c-i-l,u=h,i=c}u/=t.length,i/=t.length;let a=0,D=0,l=0;for(let s=0;s<t.length;s++){const o=t[s]/n-u,h=e[s]/r-i;a+=o*o,D+=h*h,l+=o*h}if(0===a||0===D)return;const h=l/Math.sqrt(a*D);return Math.abs(h)>1&&Math.abs(h)<=1+8*Number.EPSILON?Math.sign(h):h}function _t(t){const e=t.map(((t,e)=>({value:t,index:e}))).sort(((t,e)=>t.value-e.value)),n=new Array(t.length);for(let t=0;t<e.length;){let r=t+1;for(;r<e.length&&e[r].value===e[t].value;)r++;const u=(t+r+1)/2;for(let i=t;i<r;i++)n[e[i].index]=u;t=r}return n}class Nt{}const Lt=1e-12,kt=Math.PI,It=kt/2,Ut=2*kt,Rt=2*Math.PI,Ot=Math.abs,Pt=Math.atan2,Ht=Math.cos,qt=Math.max,Wt=Math.min,zt=Math.sin,jt=Math.sqrt,Yt=Math.pow;function Gt(t,e,n){const r=n.x-e.x,u=n.y-e.y,i=t.x-e.x,s=t.y-e.y;return Math.abs(r*s-i*u)/Math.sqrt(r*r+u*u)}function Vt(t,e){return t[0]*e[1]-t[1]*e[0]}function $t(t,e){return t.x*e.y-t.y*e.x}function Xt(t,e){let n=0;for(let r=0;r<t.length;++r)n+=t[r]*e[r];return n}function Zt(t,e){return Ot(t[0]-e[0])+Ot(t[1]-e[1])<Lt}function Jt(t,e=10){return Math.round(t*e)/e}function Qt(t){const e=t.toString().split(/[eE]/),n=(e[0].split(".")[1]||"").length-(+e[1]||0);return n>0?n:0}class Kt{constructor(t=0,e=0,n,r){this.x=0,this.y=0,this.x=t,this.y=e,this.x1=n,this.y1=r}clone(){return new Kt(this.x,this.y)}copyFrom(t){return this.x=t.x,this.y=t.y,this.x1=t.x1,this.y1=t.y1,this.defined=t.defined,this.context=t.context,this}set(t,e){return this.x=t,this.y=e,this}add(t){return m(t)?(this.x+=t,void(this.y+=t)):(this.x+=t.x,this.y+=t.y,this)}sub(t){return m(t)?(this.x-=t,void(this.y-=t)):(this.x-=t.x,this.y-=t.y,this)}multi(t){throw new Error("暂不支持")}div(t){throw new Error("暂不支持")}}class te{static distancePP(t,e){return jt(Yt(t.x-e.x,2)+Yt(t.y-e.y,2))}static distanceNN(t,e,n,r){return jt(Yt(t-n,2)+Yt(e-r,2))}static distancePN(t,e,n){return jt(Yt(e-t.x,2)+Yt(n-t.y,2))}static pointAtPP(t,e,n){return new Kt((e.x-t.x)*n+t.x,(e.y-t.y)*n+t.y)}}class ee{constructor(t=0,e=0,n,r){this.r=0,this.theta=0,this.r=t,this.theta=e,this.r1=n,this.theta1=r}clone(){return new ee(this.r,this.theta)}copyFrom(t){return this.r=t.r,this.theta=t.theta,this.r1=t.r1,this.theta1=t.theta1,this.defined=t.defined,this.context=t.context,this}set(t,e){return this.r=t,this.theta=e,this}}function ne(t){return t*(Math.PI/180)}function re(t){return 180*t/Math.PI}const ue=(t=0)=>{if(t<0)for(;t<-Ut;)t+=Ut;else if(t>0)for(;t>Ut;)t-=Ut;return t},ie=ue,se=(t=0)=>t>360||t<-360?t%360:t,oe=se;function ae(t){for(;t<0;)t+=2*Math.PI;for(;t>=2*Math.PI;)t-=2*Math.PI;return t}function De(t,e){const n=Math.abs(e-t);if(n>=2*Math.PI||2*Math.PI-n<1e-6)return[0,Math.PI/2,Math.PI,1.5*Math.PI];const r=ae(Math.min(t,e)),u=r+n,i=[r,u];let s=Math.floor(r/Math.PI)*Math.PI/2;for(;s<u;)s>r&&i.push(s),s+=Math.PI/2;return i}function le(t,e,n){t[0]=e[0]-n[0],t[1]=e[1]-n[1]}function he(t,e,n,r){let u=t[0],i=e[0],s=n[0],o=r[0];return i<u&&([u,i]=[i,u]),o<s&&([o,s]=[s,o]),!(i<s||o<u)&&(u=t[1],i=e[1],s=n[1],o=r[1],i<u&&([u,i]=[i,u]),o<s&&([o,s]=[s,o]),!(i<s||o<u))}var ce;t.InnerBBox=void 0,(ce=t.InnerBBox||(t.InnerBBox={}))[ce.NONE=0]="NONE",ce[ce.BBOX1=1]="BBOX1",ce[ce.BBOX2=2]="BBOX2";const fe=(t,e,n)=>{let r=t.x1,u=t.x2,i=t.y1,s=t.y2,o=e.x1,a=e.x2,D=e.y1,l=e.y2;return n&&(r>u&&([r,u]=[u,r]),i>s&&([i,s]=[s,i]),o>a&&([o,a]=[a,o]),D>l&&([D,l]=[l,D])),{x11:r,x12:u,y11:i,y12:s,x21:o,x22:a,y21:D,y22:l}};function Fe(t,e,n){if(!e)return!0;if(!n)return t.x>=e.x1&&t.x<=e.x2&&t.y>=e.y1&&t.y<=e.y2;let r=e.x1,u=e.x2,i=e.y1,s=e.y2;return r>u&&([r,u]=[u,r]),i>s&&([i,s]=[s,i]),t.x>=r&&t.x<=u&&t.y>=i&&t.y<=s}function de(t,e){return Math.abs(e[0]*t[0]+e[1]*t[1])}function me({x:t,y:e},n,r={x:0,y:0}){return{x:(t-r.x)*Math.cos(n)-(e-r.y)*Math.sin(n)+r.x,y:(t-r.x)*Math.sin(n)+(e-r.y)*Math.cos(n)+r.y}}function ge(t){return{x:(t.x1+t.x2)/2,y:(t.y1+t.y2)/2}}function pe(t,e){const n=e?ne(t.angle):t.angle,r=ge(t);return[me({x:t.x1,y:t.y1},n,r),me({x:t.x2,y:t.y1},n,r),me({x:t.x2,y:t.y2},n,r),me({x:t.x1,y:t.y2},n,r)]}function ye(t,e,n=!1){const r=pe(t,n),u=pe(e,n),i=(t,e)=>[e.x-t.x,e.y-t.y],s=i(ge(t),ge(e)),o=i(r[0],r[1]),a=i(r[1],r[2]),D=i(u[0],u[1]),l=i(u[1],u[2]),h=n?ne(t.angle):t.angle;let c=n?ne(90-t.angle):t.angle+It;const f=n?ne(e.angle):e.angle;let F=n?ne(90-e.angle):e.angle+It;c>Rt&&(c-=Rt),F>Rt&&(F-=Rt);const d=(t,e,n,r)=>{const u=[Math.cos(e),Math.sin(e)];return t+(de(u,n)+de(u,r))/2>de(u,s)};return d((t.x2-t.x1)/2,h,D,l)&&d((t.y2-t.y1)/2,c,D,l)&&d((e.x2-e.x1)/2,f,o,a)&&d((e.y2-e.y1)/2,F,o,a)}let xe,Ce,Ee,Me,be,Be,ve,we,Ae,Se,Te,_e;function Ne(t,e,n=3,r=!1){let u=t.x1,i=t.x2,s=t.y1,o=t.y2,a=e.x1,D=e.x2,l=e.y1,h=e.y2;if(r){let t;u>i&&(t=u,u=i,i=t),s>o&&(t=s,s=o,o=t),a>D&&(t=a,a=D,D=t),l>h&&(t=l,l=h,h=t)}if(u>=D||i<=a||s>=h||o<=l)return[t,e];const c=(i-u+2*n)*(o-s+2*n),f=(D-a+2*n)*(h-l+2*n),F=Math.min(u,a),d=Math.min(s,l),m=Math.max(i,D),g=Math.max(o,h);return c+f>(m-F)*(g-d)?[{x1:F,x2:m,y1:d,y2:g}]:[t,e]}const Le={x:0,y:0},ke={x:0,y:0};function Ie(t,e,n,r){return Gt(t,e,n)<=r/2&&Pe(t,e,n)}const Ue={x:0,y:0},Re={x:0,y:0},Oe={x:0,y:0};function Pe(t,e,n){return Ue.x=e.x-t.x,Ue.y=e.y-t.y,Re.x=n.x-t.x,Re.y=n.y-t.y,Oe.x=e.y-n.y,Oe.y=n.x-e.x,$t(Ue,Oe)*$t(Re,Oe)<0}class He{constructor(t){this.canvas=t,t&&(this.ctx=t.getContext("2d"))}setCanvas(t){this.canvas=t,t&&(this.ctx=t.getContext("2d"))}measureText(t){return this.canvas?this.measureTextByCanvas(t):(console.warn("[warn] no canvas, measureText might be not accurate"),this.estimate(t))}measureTextByCanvas(t){return this.ctx?(this.ctx.font=function({fontStyle:t,fontVariant:e,fontWeight:n,fontSize:r,fontFamily:u}){return(t?t+" ":"")+(e?e+" ":"")+(n?n+" ":"")+(r||12)+"px "+(u||"sans-serif")}(t),{width:this.ctx.measureText(t.text).width,height:t.fontSize}):(console.error("[error!!!]measureTextByCanvas can not be called without canvas"),{width:-1,height:t.fontSize})}estimate({text:t,fontSize:e}){let n=0,r=0;for(let e=0;e<t.length;e++)t.charCodeAt(e)<128?n++:r++;return{width:~~(.8*n*e+r*e),height:e}}static getDefaultUtils(t){return He.instance||(He.instance=new He(t)),He.instance}}const qe=1e-8;function We(t,e,n,r,u){for(let i=0,s=u[u.length-1];i<u.length;i++){const o=u[i];if(he([t,e],[n,r],[o.x,o.y],[s.x,s.y]))return!0;s=o}return!1}function ze(t,e,n){let r=0,u=t[0];if(!u)return!1;for(let i=1;i<t.length;i++){const s=t[i];r+=je(u.x,u.y,s.x,s.y,e,n),u=s}const i=t[0];return Ye(u.x,i.x)&&Ye(u.y,i.y)||(r+=je(u.x,u.y,i.x,i.y,e,n)),0!==r}function je(t,e,n,r,u,i){if(i>e&&i>r||i<e&&i<r)return 0;if(r===e)return 0;const s=(i-e)/(r-e);let o=r<e?1:-1;1!==s&&0!==s||(o=r<e?.5:-.5);const a=s*(n-t)+t;return a===u?1/0:a>u?o:0}function Ye(t,e){return Math.abs(t-e)<qe}const Ge=t=>{if("string"!=typeof t)throw new TypeError(`Expected a \`string\`, got \`${typeof t}\``);return t.replace(Ve(),"")},Ve=({onlyFirst:t=!1}={})=>{const e=["[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)","(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]))"].join("|");return new RegExp(e,t?void 0:"g")},$e=t=>{let e=t.charCodeAt(0),n=2===t.length?t.charCodeAt(1):0,r=e;return 55296<=e&&e<=56319&&56320<=n&&n<=57343&&(e&=1023,n&=1023,r=e<<10|n,r+=65536),12288===r||65281<=r&&r<=65376||65504<=r&&r<=65510?"F":8361===r||65377<=r&&r<=65470||65474<=r&&r<=65479||65482<=r&&r<=65487||65490<=r&&r<=65495||65498<=r&&r<=65500||65512<=r&&r<=65518?"H":4352<=r&&r<=4447||4515<=r&&r<=4519||4602<=r&&r<=4607||9001<=r&&r<=9002||11904<=r&&r<=11929||11931<=r&&r<=12019||12032<=r&&r<=12245||12272<=r&&r<=12283||12289<=r&&r<=12350||12353<=r&&r<=12438||12441<=r&&r<=12543||12549<=r&&r<=12589||12593<=r&&r<=12686||12688<=r&&r<=12730||12736<=r&&r<=12771||12784<=r&&r<=12830||12832<=r&&r<=12871||12880<=r&&r<=13054||13056<=r&&r<=19903||19968<=r&&r<=42124||42128<=r&&r<=42182||43360<=r&&r<=43388||44032<=r&&r<=55203||55216<=r&&r<=55238||55243<=r&&r<=55291||63744<=r&&r<=64255||65040<=r&&r<=65049||65072<=r&&r<=65106||65108<=r&&r<=65126||65128<=r&&r<=65131||110592<=r&&r<=110593||127488<=r&&r<=127490||127504<=r&&r<=127546||127552<=r&&r<=127560||127568<=r&&r<=127569||131072<=r&&r<=194367||177984<=r&&r<=196605||196608<=r&&r<=262141?"W":32<=r&&r<=126||162<=r&&r<=163||165<=r&&r<=166||172===r||175===r||10214<=r&&r<=10221||10629<=r&&r<=10630?"Na":161===r||164===r||167<=r&&r<=168||170===r||173<=r&&r<=174||176<=r&&r<=180||182<=r&&r<=186||188<=r&&r<=191||198===r||208===r||215<=r&&r<=216||222<=r&&r<=225||230===r||232<=r&&r<=234||236<=r&&r<=237||240===r||242<=r&&r<=243||247<=r&&r<=250||252===r||254===r||257===r||273===r||275===r||283===r||294<=r&&r<=295||299===r||305<=r&&r<=307||312===r||319<=r&&r<=322||324===r||328<=r&&r<=331||333===r||338<=r&&r<=339||358<=r&&r<=359||363===r||462===r||464===r||466===r||468===r||470===r||472===r||474===r||476===r||593===r||609===r||708===r||711===r||713<=r&&r<=715||717===r||720===r||728<=r&&r<=731||733===r||735===r||768<=r&&r<=879||913<=r&&r<=929||931<=r&&r<=937||945<=r&&r<=961||963<=r&&r<=969||1025===r||1040<=r&&r<=1103||1105===r||8208===r||8211<=r&&r<=8214||8216<=r&&r<=8217||8220<=r&&r<=8221||8224<=r&&r<=8226||8228<=r&&r<=8231||8240===r||8242<=r&&r<=8243||8245===r||8251===r||8254===r||8308===r||8319===r||8321<=r&&r<=8324||8364===r||8451===r||8453===r||8457===r||8467===r||8470===r||8481<=r&&r<=8482||8486===r||8491===r||8531<=r&&r<=8532||8539<=r&&r<=8542||8544<=r&&r<=8555||8560<=r&&r<=8569||8585===r||8592<=r&&r<=8601||8632<=r&&r<=8633||8658===r||8660===r||8679===r||8704===r||8706<=r&&r<=8707||8711<=r&&r<=8712||8715===r||8719===r||8721===r||8725===r||8730===r||8733<=r&&r<=8736||8739===r||8741===r||8743<=r&&r<=8748||8750===r||8756<=r&&r<=8759||8764<=r&&r<=8765||8776===r||8780===r||8786===r||8800<=r&&r<=8801||8804<=r&&r<=8807||8810<=r&&r<=8811||8814<=r&&r<=8815||8834<=r&&r<=8835||8838<=r&&r<=8839||8853===r||8857===r||8869===r||8895===r||8978===r||9312<=r&&r<=9449||9451<=r&&r<=9547||9552<=r&&r<=9587||9600<=r&&r<=9615||9618<=r&&r<=9621||9632<=r&&r<=9633||9635<=r&&r<=9641||9650<=r&&r<=9651||9654<=r&&r<=9655||9660<=r&&r<=9661||9664<=r&&r<=9665||9670<=r&&r<=9672||9675===r||9678<=r&&r<=9681||9698<=r&&r<=9701||9711===r||9733<=r&&r<=9734||9737===r||9742<=r&&r<=9743||9748<=r&&r<=9749||9756===r||9758===r||9792===r||9794===r||9824<=r&&r<=9825||9827<=r&&r<=9829||9831<=r&&r<=9834||9836<=r&&r<=9837||9839===r||9886<=r&&r<=9887||9918<=r&&r<=9919||9924<=r&&r<=9933||9935<=r&&r<=9953||9955===r||9960<=r&&r<=9983||10045===r||10071===r||10102<=r&&r<=10111||11093<=r&&r<=11097||12872<=r&&r<=12879||57344<=r&&r<=63743||65024<=r&&r<=65039||65533===r||127232<=r&&r<=127242||127248<=r&&r<=127277||127280<=r&&r<=127337||127344<=r&&r<=127386||917760<=r&&r<=917999||983040<=r&&r<=1048573||1048576<=r&&r<=1114109?"A":"N"},Xe=()=>/[#*0-9]\uFE0F?\u20E3|[\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23ED-\u23EF\u23F1\u23F2\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB\u25FC\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u267F\u2692\u2694-\u2697\u2699\u269B\u269C\u26A0\u26A7\u26AA\u26B0\u26B1\u26BD\u26BE\u26C4\u26C8\u26CF\u26D1\u26D3\u26E9\u26F0-\u26F5\u26F7\u26F8\u26FA\u2702\u2708\u2709\u270F\u2712\u2714\u2716\u271D\u2721\u2733\u2734\u2744\u2747\u2757\u2763\u27A1\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B55\u3030\u303D\u3297\u3299]\uFE0F?|[\u261D\u270C\u270D](?:\uFE0F|\uD83C[\uDFFB-\uDFFF])?|[\u270A\u270B](?:\uD83C[\uDFFB-\uDFFF])?|[\u23E9-\u23EC\u23F0\u23F3\u25FD\u2693\u26A1\u26AB\u26C5\u26CE\u26D4\u26EA\u26FD\u2705\u2728\u274C\u274E\u2753-\u2755\u2795-\u2797\u27B0\u27BF\u2B50]|\u26F9(?:\uFE0F|\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|\u2764\uFE0F?(?:\u200D(?:\uD83D\uDD25|\uD83E\uDE79))?|\uD83C(?:[\uDC04\uDD70\uDD71\uDD7E\uDD7F\uDE02\uDE37\uDF21\uDF24-\uDF2C\uDF36\uDF7D\uDF96\uDF97\uDF99-\uDF9B\uDF9E\uDF9F\uDFCD\uDFCE\uDFD4-\uDFDF\uDFF5\uDFF7]\uFE0F?|[\uDF85\uDFC2\uDFC7](?:\uD83C[\uDFFB-\uDFFF])?|[\uDFC3\uDFC4\uDFCA](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDFCB\uDFCC](?:\uFE0F|\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDCCF\uDD8E\uDD91-\uDD9A\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF7C\uDF7E-\uDF84\uDF86-\uDF93\uDFA0-\uDFC1\uDFC5\uDFC6\uDFC8\uDFC9\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF8-\uDFFF]|\uDDE6\uD83C[\uDDE8-\uDDEC\uDDEE\uDDF1\uDDF2\uDDF4\uDDF6-\uDDFA\uDDFC\uDDFD\uDDFF]|\uDDE7\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEF\uDDF1-\uDDF4\uDDF6-\uDDF9\uDDFB\uDDFC\uDDFE\uDDFF]|\uDDE8\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDEE\uDDF0-\uDDF5\uDDF7\uDDFA-\uDDFF]|\uDDE9\uD83C[\uDDEA\uDDEC\uDDEF\uDDF0\uDDF2\uDDF4\uDDFF]|\uDDEA\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDED\uDDF7-\uDDFA]|\uDDEB\uD83C[\uDDEE-\uDDF0\uDDF2\uDDF4\uDDF7]|\uDDEC\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEE\uDDF1-\uDDF3\uDDF5-\uDDFA\uDDFC\uDDFE]|\uDDED\uD83C[\uDDF0\uDDF2\uDDF3\uDDF7\uDDF9\uDDFA]|\uDDEE\uD83C[\uDDE8-\uDDEA\uDDF1-\uDDF4\uDDF6-\uDDF9]|\uDDEF\uD83C[\uDDEA\uDDF2\uDDF4\uDDF5]|\uDDF0\uD83C[\uDDEA\uDDEC-\uDDEE\uDDF2\uDDF3\uDDF5\uDDF7\uDDFC\uDDFE\uDDFF]|\uDDF1\uD83C[\uDDE6-\uDDE8\uDDEE\uDDF0\uDDF7-\uDDFB\uDDFE]|\uDDF2\uD83C[\uDDE6\uDDE8-\uDDED\uDDF0-\uDDFF]|\uDDF3\uD83C[\uDDE6\uDDE8\uDDEA-\uDDEC\uDDEE\uDDF1\uDDF4\uDDF5\uDDF7\uDDFA\uDDFF]|\uDDF4\uD83C\uDDF2|\uDDF5\uD83C[\uDDE6\uDDEA-\uDDED\uDDF0-\uDDF3\uDDF7-\uDDF9\uDDFC\uDDFE]|\uDDF6\uD83C\uDDE6|\uDDF7\uD83C[\uDDEA\uDDF4\uDDF8\uDDFA\uDDFC]|\uDDF8\uD83C[\uDDE6-\uDDEA\uDDEC-\uDDF4\uDDF7-\uDDF9\uDDFB\uDDFD-\uDDFF]|\uDDF9\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDED\uDDEF-\uDDF4\uDDF7\uDDF9\uDDFB\uDDFC\uDDFF]|\uDDFA\uD83C[\uDDE6\uDDEC\uDDF2\uDDF3\uDDF8\uDDFE\uDDFF]|\uDDFB\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDEE\uDDF3\uDDFA]|\uDDFC\uD83C[\uDDEB\uDDF8]|\uDDFD\uD83C\uDDF0|\uDDFE\uD83C[\uDDEA\uDDF9]|\uDDFF\uD83C[\uDDE6\uDDF2\uDDFC]|\uDFF3\uFE0F?(?:\u200D(?:\u26A7\uFE0F?|\uD83C\uDF08))?|\uDFF4(?:\u200D\u2620\uFE0F?|\uDB40\uDC67\uDB40\uDC62\uDB40(?:\uDC65\uDB40\uDC6E\uDB40\uDC67|\uDC73\uDB40\uDC63\uDB40\uDC74|\uDC77\uDB40\uDC6C\uDB40\uDC73)\uDB40\uDC7F)?)|\uD83D(?:[\uDC08\uDC26](?:\u200D\u2B1B)?|[\uDC3F\uDCFD\uDD49\uDD4A\uDD6F\uDD70\uDD73\uDD76-\uDD79\uDD87\uDD8A-\uDD8D\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA\uDECB\uDECD-\uDECF\uDEE0-\uDEE5\uDEE9\uDEF0\uDEF3]\uFE0F?|[\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDC8F\uDC91\uDCAA\uDD7A\uDD95\uDD96\uDE4C\uDE4F\uDEC0\uDECC](?:\uD83C[\uDFFB-\uDFFF])?|[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDD74\uDD90](?:\uFE0F|\uD83C[\uDFFB-\uDFFF])?|[\uDC00-\uDC07\uDC09-\uDC14\uDC16-\uDC25\uDC27-\uDC3A\uDC3C-\uDC3E\uDC40\uDC44\uDC45\uDC51-\uDC65\uDC6A\uDC79-\uDC7B\uDC7D-\uDC80\uDC84\uDC88-\uDC8E\uDC90\uDC92-\uDCA9\uDCAB-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDDA4\uDDFB-\uDE2D\uDE2F-\uDE34\uDE37-\uDE44\uDE48-\uDE4A\uDE80-\uDEA2\uDEA4-\uDEB3\uDEB7-\uDEBF\uDEC1-\uDEC5\uDED0-\uDED2\uDED5-\uDED7\uDEDC-\uDEDF\uDEEB\uDEEC\uDEF4-\uDEFC\uDFE0-\uDFEB\uDFF0]|\uDC15(?:\u200D\uD83E\uDDBA)?|\uDC3B(?:\u200D\u2744\uFE0F?)?|\uDC41\uFE0F?(?:\u200D\uD83D\uDDE8\uFE0F?)?|\uDC68(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDC68\uDC69]\u200D\uD83D(?:\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?)|[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?)|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF-\uDDB3\uDDBC\uDDBD]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFC-\uDFFF])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF-\uDDB3\uDDBC\uDDBD]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFD-\uDFFF])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF-\uDDB3\uDDBC\uDDBD]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF-\uDDB3\uDDBC\uDDBD]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFD\uDFFF])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF-\uDDB3\uDDBC\uDDBD]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFE])))?))?|\uDC69(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?[\uDC68\uDC69]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?|\uDC69\u200D\uD83D(?:\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?))|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF-\uDDB3\uDDBC\uDDBD]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFC-\uDFFF])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF-\uDDB3\uDDBC\uDDBD]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB\uDFFD-\uDFFF])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF-\uDDB3\uDDBC\uDDBD]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF-\uDDB3\uDDBC\uDDBD]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB-\uDFFD\uDFFF])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF-\uDDB3\uDDBC\uDDBD]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB-\uDFFE])))?))?|\uDC6F(?:\u200D[\u2640\u2642]\uFE0F?)?|\uDD75(?:\uFE0F|\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|\uDE2E(?:\u200D\uD83D\uDCA8)?|\uDE35(?:\u200D\uD83D\uDCAB)?|\uDE36(?:\u200D\uD83C\uDF2B\uFE0F?)?)|\uD83E(?:[\uDD0C\uDD0F\uDD18-\uDD1F\uDD30-\uDD34\uDD36\uDD77\uDDB5\uDDB6\uDDBB\uDDD2\uDDD3\uDDD5\uDEC3-\uDEC5\uDEF0\uDEF2-\uDEF8](?:\uD83C[\uDFFB-\uDFFF])?|[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDDDE\uDDDF](?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDD0D\uDD0E\uDD10-\uDD17\uDD20-\uDD25\uDD27-\uDD2F\uDD3A\uDD3F-\uDD45\uDD47-\uDD76\uDD78-\uDDB4\uDDB7\uDDBA\uDDBC-\uDDCC\uDDD0\uDDE0-\uDDFF\uDE70-\uDE7C\uDE80-\uDE88\uDE90-\uDEBD\uDEBF-\uDEC2\uDECE-\uDEDB\uDEE0-\uDEE8]|\uDD3C(?:\u200D[\u2640\u2642]\uFE0F?|\uD83C[\uDFFB-\uDFFF])?|\uDDD1(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF-\uDDB3\uDDBC\uDDBD]|\uDD1D\u200D\uD83E\uDDD1))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFC-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF-\uDDB3\uDDBC\uDDBD]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB\uDFFD-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF-\uDDB3\uDDBC\uDDBD]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF-\uDDB3\uDDBC\uDDBD]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB-\uDFFD\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF-\uDDB3\uDDBC\uDDBD]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB-\uDFFE]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF-\uDDB3\uDDBC\uDDBD]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?))?|\uDEF1(?:\uD83C(?:\uDFFB(?:\u200D\uD83E\uDEF2\uD83C[\uDFFC-\uDFFF])?|\uDFFC(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB\uDFFD-\uDFFF])?|\uDFFD(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])?|\uDFFE(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB-\uDFFD\uDFFF])?|\uDFFF(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB-\uDFFE])?))?)/g;function Ze(t,e={},n){n||(n=1);const{fontStyle:r=e.fontStyle,fontVariant:u=e.fontVariant,fontWeight:i=e.fontWeight,fontSize:s=e.fontSize,fontFamily:o=e.fontFamily}=t;return(r?r+" ":"")+(u?u+" ":"")+(i?i+" ":"")+s*n+"px "+(o||"sans-serif")}class Je{constructor(t,e){this._numberCharSize=null,this._fullCharSize=null,this._letterCharSize=null,this._specialCharSizeMap={},this._canvas=null,this._context=null,this._contextSaved=!1,this._notSupportCanvas=!1,this._notSupportVRender=!1,this._userSpec={},this.specialCharSet="-/: .,@%'\"~",this._option=t,this._userSpec=null!=e?e:{},this.textSpec=this._initSpec(),a(t.specialCharSet)&&(this.specialCharSet=t.specialCharSet),this._standardMethod=a(t.getTextBounds)?this.fullMeasure.bind(this):this.measureWithNaiveCanvas.bind(this)}initContext(){if(this._notSupportCanvas)return!1;if(o(this._canvas)&&(a(this._option.getCanvasForMeasure)&&(this._canvas=this._option.getCanvasForMeasure()),o(this._canvas)&&"undefined"!=typeof window&&void 0!==window.document&&globalThis&&a(globalThis.document)&&(this._canvas=globalThis.document.createElement("canvas"))),o(this._context)&&a(this._canvas)){const t=this._canvas.getContext("2d");a(t)&&(t.save(),t.font=Ze(this.textSpec),this._contextSaved=!0,this._context=t)}return!o(this._context)||(this._notSupportCanvas=!0,!1)}_initSpec(){var t,e,n;const{defaultFontParams:r={}}=this._option,{fontStyle:u=r.fontStyle,fontVariant:i=r.fontVariant,fontWeight:s=(null!==(t=r.fontWeight)&&void 0!==t?t:"normal"),fontSize:o=(null!==(e=r.fontSize)&&void 0!==e?e:12),fontFamily:a=(null!==(n=r.fontFamily)&&void 0!==n?n:"sans-serif"),align:D,textAlign:l=(null!=D?D:"center"),baseline:h,textBaseline:f=(null!=h?h:"middle"),ellipsis:F,limit:d}=this._userSpec;let{lineHeight:m=o}=this._userSpec;if(c(m)&&"%"===m[m.length-1]){const t=Number.parseFloat(m.substring(0,m.length-1))/100;m=o*t}return{fontStyle:u,fontVariant:i,fontFamily:a,fontSize:o,fontWeight:s,textAlign:l,textBaseline:f,ellipsis:F,limit:d,lineHeight:m}}measure(t,e){switch(e){case"vrender":case"canopus":return this.fullMeasure(t);case"canvas":return this.measureWithNaiveCanvas(t);case"simple":return this.quickMeasureWithoutCanvas(t);default:return this.quickMeasure(t)}}fullMeasure(t){if(o(t))return{width:0,height:0};if(o(this._option.getTextBounds)||!this._notSupportVRender)return this.measureWithNaiveCanvas(t);const{fontFamily:e,fontSize:n,fontWeight:r,textAlign:u,textBaseline:i,ellipsis:s,limit:a,lineHeight:D}=this.textSpec;let l;try{const o=this._option.getTextBounds({text:t,fontFamily:e,fontSize:n,fontWeight:r,textAlign:u,textBaseline:i,ellipsis:!!s,maxLineWidth:a||1/0,lineHeight:D});l={width:o.width(),height:o.height()}}catch(e){this._notSupportVRender=!0,l=this.measureWithNaiveCanvas(t)}return l}measureWithNaiveCanvas(t){return this._measureReduce(t,this._measureWithNaiveCanvas.bind(this))}_measureWithNaiveCanvas(t){var e;if(!this.initContext())return this._quickMeasureWithoutCanvas(t);const n=this._context.measureText(t),{fontSize:r,lineHeight:u}=this.textSpec;return{width:n.width,height:null!==(e=u)&&void 0!==e?e:r,fontBoundingBoxAscent:n.fontBoundingBoxAscent,fontBoundingBoxDescent:n.fontBoundingBoxDescent}}quickMeasure(t){return this._measureReduce(t,this._quickMeasure.bind(this))}_quickMeasure(t){const e={width:0,height:0};for(let n=0;n<t.length;n++){const r=t[n];let u=this._measureSpecialChar(r);o(u)&&Je.NUMBERS_CHAR_SET.includes(r)&&(u=this._measureNumberChar()),o(u)&&["F","W"].includes($e(r))&&(u=this._measureFullSizeChar()),o(u)&&(u=this._measureLetterChar()),e.width+=u.width,e.height=Math.max(e.height,u.height),!o(u.fontBoundingBoxAscent)&&(e.fontBoundingBoxAscent=u.fontBoundingBoxAscent),!o(u.fontBoundingBoxDescent)&&(e.fontBoundingBoxDescent=u.fontBoundingBoxDescent)}return e}quickMeasureWithoutCanvas(t){return this._measureReduce(t,this._quickMeasureWithoutCanvas.bind(this))}_quickMeasureWithoutCanvas(t){var e;const n={width:0,height:0},{fontSize:r,lineHeight:u}=this.textSpec;for(let e=0;e<t.length;e++){const u=t[e],i=["F","W"].includes($e(u))?1:.53;n.width+=i*r}return n.height=null!==(e=u)&&void 0!==e?e:r,n}_measureReduce(t,e){var n;const{fontSize:r,lineHeight:u}=this.textSpec,i={width:0,height:0};if(o(t))return i;if(f(t)){const s=t.filter(a).map((t=>t.toString()));return 0===s.length?i:1===s.length?e(s[0]):{width:s.reduce(((t,n)=>Math.max(t,e(n).width)),0),height:s.length*((null!==(n=u)&&void 0!==n?n:r)+1)+1}}return e(t.toString())}_measureNumberChar(){if(o(this._numberCharSize)){const t=this._standardMethod(Je.NUMBERS_CHAR_SET);this._numberCharSize={width:t.width/Je.NUMBERS_CHAR_SET.length,height:t.height,fontBoundingBoxAscent:t.fontBoundingBoxAscent,fontBoundingBoxDescent:t.fontBoundingBoxDescent}}return this._numberCharSize}_measureFullSizeChar(){return o(this._fullCharSize)&&(this._fullCharSize=this._standardMethod(Je.FULL_SIZE_CHAR)),this._fullCharSize}_measureLetterChar(){if(o(this._letterCharSize)){const t=this._standardMethod(Je.ALPHABET_CHAR_SET);this._letterCharSize={width:t.width/Je.ALPHABET_CHAR_SET.length,height:t.height,fontBoundingBoxAscent:t.fontBoundingBoxAscent,fontBoundingBoxDescent:t.fontBoundingBoxDescent}}return this._letterCharSize}_measureSpecialChar(t){return a(this._specialCharSizeMap[t])?this._specialCharSizeMap[t]:this.specialCharSet.includes(t)?(this._specialCharSizeMap[t]=this._standardMethod(t),this._specialCharSizeMap[t]):null}release(){a(this._canvas)&&(this._canvas=null),a(this._context)&&(this._contextSaved&&(this._context.restore(),this._contextSaved=!1),this._context=null)}}Je.ALPHABET_CHAR_SET="abcdefghijklmnopqrstuvwxyz",Je.NUMBERS_CHAR_SET="0123456789",Je.FULL_SIZE_CHAR="字";function Qe(t,e,n){const{x1:r,y1:u,x2:i,y2:s}=e;return n.onlyTranslate()?(t!==e&&t.setValue(e.x1,e.y1,e.x2,e.y2),t.translate(n.e,n.f),e):(t.clear(),t.add(n.a*r+n.c*u+n.e,n.b*r+n.d*u+n.f),t.add(n.a*i+n.c*u+n.e,n.b*i+n.d*u+n.f),t.add(n.a*i+n.c*s+n.e,n.b*i+n.d*s+n.f),t.add(n.a*r+n.c*s+n.e,n.b*r+n.d*s+n.f),e)}class Ke{constructor(t){t?this.setValue(t.x1,t.y1,t.x2,t.y2):this.clear()}clone(){return new Ke(this)}clear(){return this.x1=+Number.MAX_VALUE,this.y1=+Number.MAX_VALUE,this.x2=-Number.MAX_VALUE,this.y2=-Number.MAX_VALUE,this}empty(){return this.x1===+Number.MAX_VALUE&&this.y1===+Number.MAX_VALUE&&this.x2===-Number.MAX_VALUE&&this.y2===-Number.MAX_VALUE}equals(t){return this.x1===t.x1&&this.y1===t.y1&&this.x2===t.x2&&this.y2===t.y2}setValue(t=0,e=0,n=0,r=0){return this.x1=t,this.y1=e,this.x2=n,this.y2=r,this}set(t=0,e=0,n=0,r=0){return n<t?(this.x2=t,this.x1=n):(this.x1=t,this.x2=n),r<e?(this.y2=e,this.y1=r):(this.y1=e,this.y2=r),this}add(t=0,e=0){return t<this.x1&&(this.x1=t),e<this.y1&&(this.y1=e),t>this.x2&&(this.x2=t),e>this.y2&&(this.y2=e),this}expand(t=0){return f(t)?(this.y1-=t[0],this.x2+=t[1],this.y2+=t[2],this.x1-=t[3]):(this.x1-=t,this.y1-=t,this.x2+=t,this.y2+=t),this}round(){return this.x1=Math.floor(this.x1),this.y1=Math.floor(this.y1),this.x2=Math.ceil(this.x2),this.y2=Math.ceil(this.y2),this}translate(t=0,e=0){return this.x1+=t,this.x2+=t,this.y1+=e,this.y2+=e,this}rotate(t=0,e=0,n=0){const r=this.rotatedPoints(t,e,n);return this.clear().add(r[0],r[1]).add(r[2],r[3]).add(r[4],r[5]).add(r[6],r[7])}scale(t=0,e=0,n=0,r=0){const u=this.scalePoints(t,e,n,r);return this.clear().add(u[0],u[1]).add(u[2],u[3])}union(t){return t.x1<this.x1&&(this.x1=t.x1),t.y1<this.y1&&(this.y1=t.y1),t.x2>this.x2&&(this.x2=t.x2),t.y2>this.y2&&(this.y2=t.y2),this}intersect(t){return t.x1>this.x1&&(this.x1=t.x1),t.y1>this.y1&&(this.y1=t.y1),t.x2<this.x2&&(this.x2=t.x2),t.y2<this.y2&&(this.y2=t.y2),this}encloses(t){return t&&this.x1<=t.x1&&this.x2>=t.x2&&this.y1<=t.y1&&this.y2>=t.y2}alignsWith(t){return t&&(this.x1===t.x1||this.x2===t.x2||this.y1===t.y1||this.y2===t.y2)}intersects(t){return t&&!(this.x2<t.x1||this.x1>t.x2||this.y2<t.y1||this.y1>t.y2)}contains(t=0,e=0){return!(t<this.x1||t>this.x2||e<this.y1||e>this.y2)}containsPoint(t){return!(t.x<this.x1||t.x>this.x2||t.y<this.y1||t.y>this.y2)}width(){return this.empty()?0:this.x2-this.x1}height(){return this.empty()?0:this.y2-this.y1}scaleX(t=0){return this.x1*=t,this.x2*=t,this}scaleY(t=0){return this.y1*=t,this.y2*=t,this}transformWithMatrix(t){return Qe(this,this,t),this}copy(t){return this.x1=t.x1,this.y1=t.y1,this.x2=t.x2,this.y2=t.y2,this}rotatedPoints(t,e,n){const{x1:r,y1:u,x2:i,y2:s}=this,o=Math.cos(t),a=Math.sin(t),D=e-e*o+n*a,l=n-e*a-n*o;return[o*r-a*u+D,a*r+o*u+l,o*r-a*s+D,a*r+o*s+l,o*i-a*u+D,a*i+o*u+l,o*i-a*s+D,a*i+o*s+l]}scalePoints(t,e,n,r){const{x1:u,y1:i,x2:s,y2:o}=this;return[t*u+(1-t)*n,e*i+(1-e)*r,t*s+(1-t)*n,e*o+(1-e)*r]}}class tn extends Ke{constructor(t,e=0){var n;super(t),t&&(this.angle=null!==(n=t.angle)&&void 0!==n?n:e)}intersects(t){return ye(this,t)}setValue(t=0,e=0,n=0,r=0,u=0){return super.setValue(t,e,n,r),this.angle=u,this}clone(){return new tn(this)}getRotatedCorners(){const t={x:(this.x1+this.x2)/2,y:(this.y1+this.y2)/2};return[me({x:this.x1,y:this.y1},this.angle,t),me({x:this.x2,y:this.y1},this.angle,t),me({x:this.x1,y:this.y2},this.angle,t),me({x:this.x2,y:this.y2},this.angle,t)]}}class en{constructor(t=1,e=0,n=0,r=1,u=0,i=0){this.a=t,this.b=e,this.c=n,this.d=r,this.e=u,this.f=i}equalToMatrix(t){return!(this.e!==t.e||this.f!==t.f||this.a!==t.a||this.d!==t.d||this.b!==t.b||this.c!==t.c)}equalTo(t,e,n,r,u,i){return!(this.e!==u||this.f!==i||this.a!==t||this.d!==r||this.b!==e||this.c!==n)}setValue(t,e,n,r,u,i){return this.a=t,this.b=e,this.c=n,this.d=r,this.e=u,this.f=i,this}reset(){return this.a=1,this.b=0,this.c=0,this.d=1,this.e=0,this.f=0,this}getInverse(){const t=this.a,e=this.b,n=this.c,r=this.d,u=this.e,i=this.f,s=new en,o=t*r-e*n;return s.a=r/o,s.b=-e/o,s.c=-n/o,s.d=t/o,s.e=(n*i-r*u)/o,s.f=-(t*i-e*u)/o,s}rotate(t){const e=Math.cos(t),n=Math.sin(t),r=this.a*e+this.c*n,u=this.b*e+this.d*n,i=this.a*-n+this.c*e,s=this.b*-n+this.d*e;return this.a=r,this.b=u,this.c=i,this.d=s,this}rotateByCenter(t,e,n){const r=Math.cos(t),u=Math.sin(t),i=(1-r)*e+u*n,s=(1-r)*n-u*e,o=r*this.a-u*this.b,a=u*this.a+r*this.b,D=r*this.c-u*this.d,l=u*this.c+r*this.d,h=r*this.e-u*this.f+i,c=u*this.e+r*this.f+s;return this.a=o,this.b=a,this.c=D,this.d=l,this.e=h,this.f=c,this}scale(t,e){return this.a*=t,this.b*=t,this.c*=e,this.d*=e,this}setScale(t,e){return this.b=this.b/this.a*t,this.c=this.c/this.d*e,this.a=t,this.d=e,this}transform(t,e,n,r,u,i){return this.multiply(t,e,n,r,u,i),this}translate(t,e){return this.e+=this.a*t+this.c*e,this.f+=this.b*t+this.d*e,this}transpose(){const{a:t,b:e,c:n,d:r,e:u,f:i}=this;return this.a=e,this.b=t,this.c=r,this.d=n,this.e=i,this.f=u,this}multiply(t,e,n,r,u,i){const s=this.a,o=this.b,a=this.c,D=this.d,l=s*t+a*e,h=o*t+D*e,c=s*n+a*r,f=o*n+D*r,F=s*u+a*i+this.e,d=o*u+D*i+this.f;return this.a=l,this.b=h,this.c=c,this.d=f,this.e=F,this.f=d,this}interpolate(t,e){const n=new en;return n.a=this.a+(t.a-this.a)*e,n.b=this.b+(t.b-this.b)*e,n.c=this.c+(t.c-this.c)*e,n.d=this.d+(t.d-this.d)*e,n.e=this.e+(t.e-this.e)*e,n.f=this.f+(t.f-this.f)*e,n}transformPoint(t,e){const{a:n,b:r,c:u,d:i,e:s,f:o}=this,a=n*i-r*u,D=i/a,l=-r/a,h=-u/a,c=n/a,f=(u*o-i*s)/a,F=-(n*o-r*s)/a,{x:d,y:m}=t;e.x=d*D+m*h+f,e.y=d*l+m*c+F}onlyTranslate(t=1){return this.a===t&&0===this.b&&0===this.c&&this.d===t}clone(){return new en(this.a,this.b,this.c,this.d,this.e,this.f)}toTransformAttrs(){const t=this.a,e=this.b,n=this.c,r=this.d,u=t*r-e*n,i={x:this.e,y:this.f,rotateDeg:0,scaleX:0,scaleY:0,skewX:0,skewY:0};if(0!==t||0!==e){const s=Math.sqrt(t*t+e*e);i.rotateDeg=e>0?Math.acos(t/s):-Math.acos(t/s),i.scaleX=s,i.scaleY=u/s,i.skewX=(t*n+e*r)/u,i.skewY=0}else if(0!==n||0!==r){const s=Math.sqrt(n*n+r*r);i.rotateDeg=Math.PI/2-(r>0?Math.acos(-n/s):-Math.acos(n/s)),i.scaleX=u/s,i.scaleY=s,i.skewX=0,i.skewY=(t*n+e*r)/u}return i.rotateDeg=re(i.rotateDeg),i}}function nn(t,e,n){e/=100,n/=100;const r=(1-Math.abs(2*n-1))*e,u=r*(1-Math.abs(t/60%2-1)),i=n-r/2;let s=0,o=0,a=0;return 0<=t&&t<60?(s=r,o=u,a=0):60<=t&&t<120?(s=u,o=r,a=0):120<=t&&t<180?(s=0,o=r,a=u):180<=t&&t<240?(s=0,o=u,a=r):240<=t&&t<300?(s=u,o=0,a=r):300<=t&&t<360&&(s=r,o=0,a=u),s=Math.round(255*(s+i)),o=Math.round(255*(o+i)),a=Math.round(255*(a+i)),{r:s,g:o,b:a}}function rn(t,e,n){t/=255,e/=255,n/=255;const r=Math.min(t,e,n),u=Math.max(t,e,n),i=u-r;let s=0,o=0,a=0;return s=0===i?0:u===t?(e-n)/i%6:u===e?(n-t)/i+2:(t-e)/i+4,s=Math.round(60*s),s<0&&(s+=360),a=(u+r)/2,o=0===i?0:i/(1-Math.abs(2*a-1)),o=+(100*o).toFixed(1),a=+(100*a).toFixed(1),{h:s,s:o,l:a}}const un=/^#([0-9a-f]{3,8})$/,sn={transparent:4294967040},on={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};function an(t){return((t=Math.max(0,Math.min(255,Math.round(t)||0)))<16?"0":"")+t.toString(16)}function Dn(t){return m(t)?new Fn(t>>16,t>>8&255,255&t,1):f(t)?new Fn(t[0],t[1],t[2]):new Fn(255,255,255)}function ln(t){return t<.04045?.0773993808*t:Math.pow(.9478672986*t+.0521327014,2.4)}function hn(t){return t<.0031308?12.92*t:1.055*Math.pow(t,.41666)-.055}const cn=(t,e)=>{const n=un.exec(t);if(e||n){const t=parseInt(n[1],16),e=n[1].length;return 3===e?new Fn((t>>8&15)+((t>>8&15)<<4),(t>>4&15)+((t>>4&15)<<4),(15&t)+((15&t)<<4),1):6===e?Dn(t):8===e?new Fn(t>>24&255,t>>16&255,t>>8&255,(255&t)/255):null}};class fn{static Brighter(t,e=1){return 1===e?t:new fn(t).brighter(e).toRGBA()}static SetOpacity(t,e=1){return 1===e?t:new fn(t).setOpacity(e).toRGBA()}static getColorBrightness(t,e="hsl"){const n=t instanceof fn?t:new fn(t);switch(e){case"hsv":default:return n.getHSVBrightness();case"hsl":return n.getHSLBrightness();case"lum":return n.getLuminance();case"lum2":return n.getLuminance2();case"lum3":return n.getLuminance3();case"wcag":return n.getLuminanceWCAG()}}static parseColorString(t){if(a(sn[t]))return function(t){return m(t)?new Fn(t>>>24,t>>>16&255,t>>>8&255,255&t):f(t)?new Fn(t[0],t[1],t[2],t[3]):new Fn(255,255,255,1)}(sn[t]);if(a(on[t]))return Dn(on[t]);const e=`${t}`.trim().toLowerCase(),n=cn(e);if(void 0!==n)return n;if(/^(rgb|RGB|rgba|RGBA)/.test(e)){const t=e.replace(/(?:\(|\)|rgba|RGBA|rgb|RGB)*/g,"").split(",");return new Fn(parseInt(t[0],10),parseInt(t[1],10),parseInt(t[2],10),parseFloat(t[3]))}if(/^(hsl|HSL|hsla|HSLA)/.test(e)){const t=e.replace(/(?:\(|\)|hsla|HSLA|hsl|HSL)*/g,"").split(","),n=nn(parseInt(t[0],10),parseInt(t[1],10),parseInt(t[2],10));return new Fn(n.r,n.g,n.b,parseFloat(t[3]))}}constructor(t){const e=fn.parseColorString(t);e?this.color=e:(console.warn(`Warn: 传入${t}无法解析为Color`),this.color=new Fn(255,255,255))}toRGBA(){return this.color.formatRgb()}toString(){return this.color.formatRgb()}toHex(){return this.color.formatHex()}toHsl(){return this.color.formatHsl()}brighter(t){const{r:e,g:n,b:r}=this.color;return this.color.r=Math.max(0,Math.min(255,Math.floor(e*t))),this.color.g=Math.max(0,Math.min(255,Math.floor(n*t))),this.color.b=Math.max(0,Math.min(255,Math.floor(r*t))),this}add(t){const{r:e,g:n,b:r}=this.color;return this.color.r+=Math.min(255,e+t.color.r),this.color.g+=Math.min(255,n+t.color.g),this.color.b+=Math.min(255,r+t.color.b),this}sub(t){return this.color.r=Math.max(0,this.color.r-t.color.r),this.color.g=Math.max(0,this.color.g-t.color.g),this.color.b=Math.max(0,this.color.b-t.color.b),this}multiply(t){const{r:e,g:n,b:r}=this.color;return this.color.r=Math.max(0,Math.min(255,Math.floor(e*t.color.r))),this.color.g=Math.max(0,Math.min(255,Math.floor(n*t.color.g))),this.color.b=Math.max(0,Math.min(255,Math.floor(r*t.color.b))),this}getHSVBrightness(){return Math.max(this.color.r,this.color.g,this.color.b)/255}getHSLBrightness(){return.5*(Math.max(this.color.r,this.color.g,this.color.b)/255+Math.min(this.color.r,this.color.g,this.color.b)/255)}setHsl(t,e,n){const r=this.color.opacity,u=rn(this.color.r,this.color.g,this.color.b),i=nn(o(t)?u.h:tt(t,0,360),o(e)?u.s:e>=0&&e<=1?100*e:e,o(n)?u.l:n<=1&&n>=0?100*n:n);return this.color=new Fn(i.r,i.g,i.b,r),this}setRGB(t,e,n){return!o(t)&&(this.color.r=t),!o(e)&&(this.color.g=e),!o(n)&&(this.color.b=n),this}setHex(t){const e=`${t}`.trim().toLowerCase(),n=cn(e,!0);return null!=n?n:this}setColorName(t){const e=on[t.toLowerCase()];return void 0!==e?this.setHex(e):console.warn("THREE.Color: Unknown color "+t),this}setScalar(t){return this.color.r=t,this.color.g=t,this.color.b=t,this}setOpacity(t=1){return this.color.opacity=t,this}getLuminance(){return(.2126*this.color.r+.7152*this.color.g+.0722*this.color.b)/255}getLuminance2(){return(.2627*this.color.r+.678*this.color.g+.0593*this.color.b)/255}getLuminance3(){return(.299*this.color.r+.587*this.color.g+.114*this.color.b)/255}getLuminanceWCAG(){const t=this.color.r/255,e=this.color.g/255,n=this.color.b/255;let r,u,i;r=t<=.03928?t/12.92:Math.pow((t+.055)/1.055,2.4),u=e<=.03928?e/12.92:Math.pow((e+.055)/1.055,2.4),i=n<=.03928?n/12.92:Math.pow((n+.055)/1.055,2.4);return.2126*r+.7152*u+.0722*i}clone(){return new fn(this.color.toString())}copyGammaToLinear(t,e=2){return this.color.r=Math.pow(t.color.r,e),this.color.g=Math.pow(t.color.g,e),this.color.b=Math.pow(t.color.b,e),this}copyLinearToGamma(t,e=2){const n=e>0?1/e:1;return this.color.r=Math.pow(t.color.r,n),this.color.g=Math.pow(t.color.g,n),this.color.b=Math.pow(t.color.b,n),this}convertGammaToLinear(t){return this.copyGammaToLinear(this,t),this}convertLinearToGamma(t){return this.copyLinearToGamma(this,t),this}copySRGBToLinear(t){return this.color.r=ln(t.color.r),this.color.g=ln(t.color.g),this.color.b=ln(t.color.b),this}copyLinearToSRGB(t){return this.color.r=hn(t.color.r),this.color.g=hn(t.color.g),this.color.b=hn(t.color.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}}class Fn{constructor(t,e,n,r){this.r=isNaN(+t)?255:Math.max(0,Math.min(255,+t)),this.g=isNaN(+e)?255:Math.max(0,Math.min(255,+e)),this.b=isNaN(+n)?255:Math.max(0,Math.min(255,+n)),a(r)?this.opacity=isNaN(+r)?1:Math.max(0,Math.min(1,+r)):this.opacity=1}formatHex(){return`#${an(this.r)+an(this.g)+an(this.b)+(1===this.opacity?"":an(255*this.opacity))}`}formatRgb(){const t=this.opacity;return`${1===t?"rgb(":"rgba("}${this.r},${this.g},${this.b}${1===t?")":`,${t})`}`}formatHsl(){const t=this.opacity,{h:e,s:n,l:r}=rn(this.r,this.g,this.b);return`${1===t?"hsl(":"hsla("}${e},${n}%,${r}%${1===t?")":`,${t})`}`}toString(){return this.formatHex()}}function dn(t){let e="",n="",r="";const u="#"===t[0]?1:0;for(let i=u;i<t.length;i++)"#"!==t[i]&&(i<u+2?e+=t[i]:i<u+4?n+=t[i]:i<u+6&&(r+=t[i]));return[parseInt(e,16),parseInt(n,16),parseInt(r,16)]}function mn(t,e,n){return Number((1<<24)+(t<<16)+(e<<8)+n).toString(16).slice(1)}function gn(t,e){const n=t.r,r=e.r,u=t.g,i=e.g,s=t.b,o=e.b,a=t.opacity,D=e.opacity;return t=>{const e=Math.round(n*(1-t)+r*t),l=Math.round(u*(1-t)+i*t),h=Math.round(s*(1-t)+o*t);return new Fn(e,l,h,a*(1-t)+D*t)}}var pn=Object.freeze({__proto__:null,Color:fn,DEFAULT_COLORS:on,RGB:Fn,hexToRgb:dn,hslToRgb:nn,interpolateRgb:gn,rgbToHex:mn,rgbToHsl:rn});function yn(t){return t?"getUTCFullYear":"getFullYear"}function xn(t){return t?"getUTCMonth":"getMonth"}function Cn(t){return t?"getUTCDate":"getDate"}function En(t){return t?"getUTCHours":"getHours"}function Mn(t){return t?"getUTCMinutes":"getMinutes"}function bn(t){return t?"getUTCSeconds":"getSeconds"}function Bn(t){return t?"getUTCMilliseconds":"getMilliseconds"}const vn=1e3,wn=6e4,An=36e5,Sn=24*An,Tn=t=>(t.setMonth(0,1),t.setHours(0,0,0,0),t),_n=(t,e)=>(t.setFullYear(t.getFullYear()+e),t),Nn=(t,e)=>e.getFullYear()-t.getFullYear(),Ln=t=>t.getFullYear(),kn=t=>(t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0),t),In=(t,e)=>(t.setUTCFullYear(t.getUTCFullYear()+e),t),Un=(t,e)=>e.getUTCFullYear()-t.getUTCFullYear(),Rn=t=>t.getUTCFullYear(),On=t=>(t.setDate(1),t.setHours(0,0,0,0),t),Pn=(t,e)=>(t.setMonth(t.getMonth()+e),t),Hn=(t,e)=>e.getMonth()-t.getMonth()+12*(e.getFullYear()-t.getFullYear()),qn=t=>t.getMonth(),Wn=t=>(t.setUTCDate(1),t.setUTCHours(0,0,0,0),t),zn=(t,e)=>(t.setUTCMonth(t.getUTCMonth()+e),t),jn=(t,e)=>e.getUTCMonth()-t.getUTCMonth()+12*(e.getUTCFullYear()-t.getUTCFullYear()),Yn=t=>t.getUTCMonth(),Gn=t=>(t.setHours(0,0,0,0),t),Vn=(t,e)=>(t.setDate(t.getDate()+e),t),$n=(t,e)=>(+e-+t-(e.getTimezoneOffset()-t.getTimezoneOffset())*wn)/Sn,Xn=t=>t.getDate()-1,Zn=t=>(t.setUTCHours(0,0,0,0),t),Jn=(t,e)=>(t.setUTCDate(t.getUTCDate()+e),t),Qn=(t,e)=>(+e-+t)/Sn,Kn=t=>t.getUTCDate()-1,tr=t=>(t.setTime(+t-t.getMilliseconds()-t.getSeconds()*vn-t.getMinutes()*wn),t),er=(t,e)=>(t.setHours(t.getHours()+e),t),nr=(t,e)=>(+e-+t)/An,rr=t=>t.getHours(),ur=t=>(t.setTime(+t-t.getUTCMilliseconds()-t.getUTCSeconds()*vn-t.getUTCMinutes()*wn),t),ir=(t,e)=>(t.setUTCHours(t.getUTCHours()+e),t),sr=t=>t.getUTCHours(),or=t=>(t.setTime(+t-t.getMilliseconds()-t.getSeconds()*vn),t),ar=(t,e)=>(t.setMinutes(t.getMinutes()+e),t),Dr=(t,e)=>(+e-+t)/wn,lr=t=>t.getMinutes(),hr=t=>(t.setTime(+t-t.getUTCMilliseconds()-t.getUTCSeconds()*vn),t),cr=(t,e)=>(t.setUTCMinutes(t.getUTCMinutes()+e),t),fr=t=>t.getUTCMinutes(),Fr=t=>(t.setTime(+t-t.getMilliseconds()),t),dr=(t,e)=>(t.setSeconds(t.getSeconds()+e),t),mr=(t,e)=>(+e-+t)/vn,gr=t=>t.getSeconds(),pr=t=>(t.setTime(+t-t.getUTCMilliseconds()),t),yr=(t,e)=>(t.setUTCSeconds(t.getUTCSeconds()+e),t),xr=t=>t.getUTCSeconds(),Cr=t=>t,Er=(t,e)=>(t.setTime(+t+e),t),Mr=(t,e)=>+e-+t,br=(t,e)=>n=>{const r=new Date(+n-1);return e(r,1),t(r),r},Br=(t,e)=>(n,r)=>{const u=new Date,i=new Date;return u.setTime(+n),i.setTime(+r),t(u),t(i),Math.floor(e(u,i))};function vr(t){const{x:e,y:n}=t.getBoundingClientRect();return{x:e,y:n}}const wr=t=>t.getBoundingClientRect().width/t.offsetWidth,Ar=t=>t.getBoundingClientRect().height/t.offsetHeight;var Sr=6371008.8,Tr={centimeters:637100880,centimetres:637100880,degrees:57.22891354143274,feet:20902260.511392,inches:39.37*Sr,kilometers:6371.0088,kilometres:6371.0088,meters:Sr,metres:Sr,miles:3958.761333810546,millimeters:6371008800,millimetres:6371008800,nauticalmiles:Sr/1852,radians:1,yards:6967335.223679999};
|
|
18
|
+
const at=1664525,Dt=1013904223,lt=4294967296;function ht(t=1){let e=t;return()=>(e=(at*e+Dt)%lt)/lt}const ct=t=>e=>C(e,t),ft=(t,e={})=>{if(s(t))return t;const n=[t];return(e&&e.get||ct)(n)};function Ft(t,e,n){const r=[];return t.forEach((t=>{const u=e(t),i=n(t);null!=u&&null!=i&&Number.isFinite(+u)&&Number.isFinite(+i)&&r.push({x:+u,y:+i})})),r}function dt(t,e,n){const r=t-e;return Number.isFinite(r)?r/n:t/n-e/n}function mt(t){let e=1/0,n=-1/0,r=1/0,u=-1/0;for(const i of t)e=Math.min(e,i.x),n=Math.max(n,i.x),r=Math.min(r,i.y),u=Math.max(u,i.y);if(!t.length)return{xCenter:0,xScale:1,yCenter:0,yScale:1};const i=e/2+n/2,s=r/2+u/2;return{xCenter:i,yCenter:s,xScale:Math.max(Math.abs(e-i),Math.abs(n-i))||1,yScale:Math.max(Math.abs(r-s),Math.abs(u-s))||1}}function gt(t,e,n=mt(t)){const r=e+1;if(1===e){let e=0,r=0,u=0;for(const i of t)u++,e+=(dt(i.x,n.xCenter,n.xScale)-e)/u,r+=(dt(i.y,n.yCenter,n.yScale)-r)/u;let i=0,s=0;for(const u of t){const t=dt(u.x,n.xCenter,n.xScale)-e;i+=t*t,s+=t*(dt(u.y,n.yCenter,n.yScale)-r)}const o=0===i?0:s/i;return{coef:0===i?[r/(1+e*e),e*r/(1+e*e)]:[r-o*e,o],rank:0===u?0:0===i?1:2,basis:n}}const u=Array.from({length:r},(()=>new Array(r).fill(0))),i=new Array(r).fill(0),s=new Array(r);for(const e of t){const t=dt(e.x,n.xCenter,n.xScale);s[0]=1;for(let e=1;e<r;e++)s[e]=s[e-1]*t;let o=dt(e.y,n.yCenter,n.yScale);for(let t=0;t<r;t++){const e=Math.hypot(u[t][t],s[t]);if(0===e)continue;const n=u[t][t]/e,a=s[t]/e;u[t][t]=e;for(let e=t+1;e<r;e++){const r=u[t][e];u[t][e]=n*r+a*s[e],s[e]=-a*r+n*s[e]}const D=i[t];i[t]=n*D+a*o,o=-a*D+n*o}}const o=Math.max(...u.map(((t,e)=>Math.abs(t[e]))))*Number.EPSILON*r*64;if(u.some(((t,e)=>Math.abs(t[e])<=o)))return Object.assign(Object.assign({},function(t,e){const n=e.length,r=t.map((t=>t.slice())),u=Array.from({length:n},((t,e)=>Array.from({length:n},((t,n)=>+(e===n)))));for(let t=0;t<50;t++){let t=!1;for(let e=0;e<n-1;e++)for(let i=e+1;i<n;i++){let s=0,o=0,a=0;for(let t=0;t<n;t++)s+=r[t][e]**2,o+=r[t][i]**2,a+=r[t][e]*r[t][i];if(Math.abs(a)<=8*Number.EPSILON*Math.sqrt(s*o))continue;t=!0;const D=(o-s)/(2*a),l=(D>=0?1:-1)/(Math.abs(D)+Math.hypot(1,D)),h=1/Math.hypot(1,l),c=h*l;for(let t=0;t<n;t++){const n=r[t][e],s=r[t][i],o=u[t][e],a=u[t][i];r[t][e]=h*n-c*s,r[t][i]=c*n+h*s,u[t][e]=h*o-c*a,u[t][i]=c*o+h*a}}if(!t)break}const i=Array.from({length:n},((t,e)=>Math.hypot(...r.map((t=>t[e]))))),s=Math.max(...i)*Number.EPSILON*n*64,o=new Array(n).fill(0);let a=0;for(let t=0;t<n;t++){if(i[t]<=s)continue;a++;let D=0;for(let u=0;u<n;u++)D+=r[u][t]*e[u];D/=i[t]**2;for(let e=0;e<n;e++)o[e]+=u[e][t]*D}return{coef:o,rank:a}}(u,i)),{basis:n});const a=new Array(r);for(let t=r-1;t>=0;t--){let e=i[t];for(let n=t+1;n<r;n++)e-=u[t][n]*a[n];a[t]=e/u[t][t]}return{coef:a,rank:r,basis:n}}function pt(t,e){const n=dt(e,t.basis.xCenter,t.basis.xScale);let r=0;for(let e=t.coef.length-1;e>=0;e--)r=r*n+t.coef[e];return t.basis.yCenter+t.basis.yScale*r}function yt(t){let e=[t.coef[t.coef.length-1]];const n=-t.basis.xCenter/t.basis.xScale,r=1/t.basis.xScale;for(let u=t.coef.length-2;u>=0;u--){const i=new Array(e.length+1).fill(0);e.forEach(((t,e)=>{i[e]+=n*t,i[e+1]+=r*t})),i[0]+=t.coef[u],e=i}if(e=e.map((e=>e*t.basis.yScale)),e[0]+=t.basis.yCenter,e.some((t=>!Number.isFinite(t))))throw new RangeError("Regression coefficients are not finite");return e}function xt(t,e,n,r){if(!Number.isInteger(n)||n<=0||!Number.isFinite(t)||!Number.isFinite(e))return[];const u=e-t,i=1===n?0:u/(n-1);return Array.from({length:n},((s,o)=>{const a=1===n?0:o/(n-1),D=0===o?t:o===n-1?e:Number.isFinite(u)?t+o*i:(1-a)*t+a*e;return{x:D,y:r(D)}}))}function Ct(t){return!Number.isFinite(t)||t<0||t>1?NaN:-O(t/2)}function Et(t,e){return Number.isNaN(t)?NaN:0===e?0:t*e}function Mt(t,e,n,r){let u=1/0,i=-1/0,s=0,a=0;for(let r=0;r<t.length;r++){const D=t[r];let l=e(D),h=n(D);!o(l)&&(l=+l)>=l&&!o(h)&&(h=+h)>=h&&(l<u&&(u=l),l>i&&(i=l),s++,a+=l)}if(0===s)return{min:u,max:i,n:s,X:0,SSE:0,Sxx:0};const D=a/s;let l=0,h=0;for(let u=0;u<t.length;u++){const i=t[u];let s=e(i),a=n(i);if(!o(s)&&(s=+s)>=s&&!o(a)&&(a=+a)>=a){const t=a-r(s);l+=t*t;const e=s-D;h+=e*e}}return{min:u,max:i,n:s,X:D,SSE:l,Sxx:h}}function bt(t,e){const{n:n,X:r,Sxx:u,SSE:i}=e,s=n>2?i/(n-2):0;return{seMean:u>0?Math.sqrt(s*(1/n+(t-r)*(t-r)/u)):Math.sqrt(s/n),sePred:Math.sqrt(s*(1+1/n+(u>0?(t-r)*(t-r)/u:0)))}}function Bt(t,e,n,r){for(let u=0;u<t.length;u++){const i=t[u];let s=e(i),a=n(i);!o(s)&&(s=+s)>=s&&!o(a)&&(a=+a)>=a&&r(s,a,u)}}function vt(t,e,n,r,u){let i=0,s=0;for(let a=0;a<t.length;a++){const D=t[a];let l=n(D);if(!o(l)&&(l=+l)>=l){const t=l-u(e(D));i+=t*t;const n=l-r;s+=n*n}}return 0===s?0:1-i/s}function wt(t){if(!t.length)return;let e=0;for(const n of t){if(!Number.isFinite(n))throw new RangeError("mean requires finite numbers");e=Math.max(e,Math.abs(n))}if(0===e)return 0;let n=0,r=0;for(const u of t){const t=u/e,i=n+t;r+=Math.abs(n)>=Math.abs(t)?n-i+t:t-i+n,n=i}return(n+r)/t.length*e}const At=t=>1/Math.sqrt(2*Math.PI)*Math.exp(-.5*t*t);function St(t,e,n=1){return t<=0||0===e?0:e*Math.pow(t,-1/(n+4))}function Tt(t,e,n=1){if(t<=0||0===e)return 0;return Math.pow(4/(n+2),1/(n+4))*e*Math.pow(t,-1/(n+4))}function _t(t,e){let n=0,r=0;for(let u=0;u<t.length;u++)n=Math.max(n,Math.abs(t[u])),r=Math.max(r,Math.abs(e[u]));if(!n||!r)return;let u=0,i=0,s=0,o=0;for(let a=0;a<t.length;a++){const D=t[a]/n-s,l=e[a]/r-o,h=u+D,c=i+l;s=h-u-D,o=c-i-l,u=h,i=c}u/=t.length,i/=t.length;let a=0,D=0,l=0;for(let s=0;s<t.length;s++){const o=t[s]/n-u,h=e[s]/r-i;a+=o*o,D+=h*h,l+=o*h}if(0===a||0===D)return;const h=l/Math.sqrt(a*D);return Math.abs(h)>1&&Math.abs(h)<=1+8*Number.EPSILON?Math.sign(h):h}function Nt(t){const e=t.map(((t,e)=>({value:t,index:e}))).sort(((t,e)=>t.value-e.value)),n=new Array(t.length);for(let t=0;t<e.length;){let r=t+1;for(;r<e.length&&e[r].value===e[t].value;)r++;const u=(t+r+1)/2;for(let i=t;i<r;i++)n[e[i].index]=u;t=r}return n}class Lt{}const kt=1e-12,It=Math.PI,Rt=It/2,Ut=2*It,Ot=2*Math.PI,Pt=Math.abs,Ht=Math.atan2,jt=Math.cos,qt=Math.max,Wt=Math.min,zt=Math.sin,Yt=Math.sqrt,Gt=Math.pow;function Vt(t,e,n){const r=n.x-e.x,u=n.y-e.y,i=t.x-e.x,s=t.y-e.y;return Math.abs(r*s-i*u)/Math.sqrt(r*r+u*u)}function $t(t,e){return t[0]*e[1]-t[1]*e[0]}function Xt(t,e){return t.x*e.y-t.y*e.x}function Zt(t,e){let n=0;for(let r=0;r<t.length;++r)n+=t[r]*e[r];return n}function Jt(t,e){return Pt(t[0]-e[0])+Pt(t[1]-e[1])<kt}function Qt(t,e=10){return Math.round(t*e)/e}function Kt(t){const e=t.toString().split(/[eE]/),n=(e[0].split(".")[1]||"").length-(+e[1]||0);return n>0?n:0}class te{constructor(t=0,e=0,n,r){this.x=0,this.y=0,this.x=t,this.y=e,this.x1=n,this.y1=r}clone(){return new te(this.x,this.y)}copyFrom(t){return this.x=t.x,this.y=t.y,this.x1=t.x1,this.y1=t.y1,this.defined=t.defined,this.context=t.context,this}set(t,e){return this.x=t,this.y=e,this}add(t){return m(t)?(this.x+=t,void(this.y+=t)):(this.x+=t.x,this.y+=t.y,this)}sub(t){return m(t)?(this.x-=t,void(this.y-=t)):(this.x-=t.x,this.y-=t.y,this)}multi(t){throw new Error("暂不支持")}div(t){throw new Error("暂不支持")}}class ee{static distancePP(t,e){return Yt(Gt(t.x-e.x,2)+Gt(t.y-e.y,2))}static distanceNN(t,e,n,r){return Yt(Gt(t-n,2)+Gt(e-r,2))}static distancePN(t,e,n){return Yt(Gt(e-t.x,2)+Gt(n-t.y,2))}static pointAtPP(t,e,n){return new te((e.x-t.x)*n+t.x,(e.y-t.y)*n+t.y)}}class ne{constructor(t=0,e=0,n,r){this.r=0,this.theta=0,this.r=t,this.theta=e,this.r1=n,this.theta1=r}clone(){return new ne(this.r,this.theta)}copyFrom(t){return this.r=t.r,this.theta=t.theta,this.r1=t.r1,this.theta1=t.theta1,this.defined=t.defined,this.context=t.context,this}set(t,e){return this.r=t,this.theta=e,this}}function re(t){return t*(Math.PI/180)}function ue(t){return 180*t/Math.PI}const ie=(t=0)=>{if(t<0)for(;t<-Ut;)t+=Ut;else if(t>0)for(;t>Ut;)t-=Ut;return t},se=ie,oe=(t=0)=>t>360||t<-360?t%360:t,ae=oe;function De(t){for(;t<0;)t+=2*Math.PI;for(;t>=2*Math.PI;)t-=2*Math.PI;return t}function le(t,e){const n=Math.abs(e-t);if(n>=2*Math.PI||2*Math.PI-n<1e-6)return[0,Math.PI/2,Math.PI,1.5*Math.PI];const r=De(Math.min(t,e)),u=r+n,i=[r,u];let s=Math.floor(r/Math.PI)*Math.PI/2;for(;s<u;)s>r&&i.push(s),s+=Math.PI/2;return i}function he(t,e,n){t[0]=e[0]-n[0],t[1]=e[1]-n[1]}function ce(t,e,n,r){let u=t[0],i=e[0],s=n[0],o=r[0];return i<u&&([u,i]=[i,u]),o<s&&([o,s]=[s,o]),!(i<s||o<u)&&(u=t[1],i=e[1],s=n[1],o=r[1],i<u&&([u,i]=[i,u]),o<s&&([o,s]=[s,o]),!(i<s||o<u))}var fe;t.InnerBBox=void 0,(fe=t.InnerBBox||(t.InnerBBox={}))[fe.NONE=0]="NONE",fe[fe.BBOX1=1]="BBOX1",fe[fe.BBOX2=2]="BBOX2";const Fe=(t,e,n)=>{let r=t.x1,u=t.x2,i=t.y1,s=t.y2,o=e.x1,a=e.x2,D=e.y1,l=e.y2;return n&&(r>u&&([r,u]=[u,r]),i>s&&([i,s]=[s,i]),o>a&&([o,a]=[a,o]),D>l&&([D,l]=[l,D])),{x11:r,x12:u,y11:i,y12:s,x21:o,x22:a,y21:D,y22:l}};function de(t,e,n){if(!e)return!0;if(!n)return t.x>=e.x1&&t.x<=e.x2&&t.y>=e.y1&&t.y<=e.y2;let r=e.x1,u=e.x2,i=e.y1,s=e.y2;return r>u&&([r,u]=[u,r]),i>s&&([i,s]=[s,i]),t.x>=r&&t.x<=u&&t.y>=i&&t.y<=s}function me(t,e){return Math.abs(e[0]*t[0]+e[1]*t[1])}function ge({x:t,y:e},n,r={x:0,y:0}){return{x:(t-r.x)*Math.cos(n)-(e-r.y)*Math.sin(n)+r.x,y:(t-r.x)*Math.sin(n)+(e-r.y)*Math.cos(n)+r.y}}function pe(t){return{x:(t.x1+t.x2)/2,y:(t.y1+t.y2)/2}}function ye(t,e){const n=e?re(t.angle):t.angle,r=pe(t);return[ge({x:t.x1,y:t.y1},n,r),ge({x:t.x2,y:t.y1},n,r),ge({x:t.x2,y:t.y2},n,r),ge({x:t.x1,y:t.y2},n,r)]}function xe(t,e,n=!1){const r=ye(t,n),u=ye(e,n),i=(t,e)=>[e.x-t.x,e.y-t.y],s=i(pe(t),pe(e)),o=i(r[0],r[1]),a=i(r[1],r[2]),D=i(u[0],u[1]),l=i(u[1],u[2]),h=n?re(t.angle):t.angle;let c=n?re(90-t.angle):t.angle+Rt;const f=n?re(e.angle):e.angle;let F=n?re(90-e.angle):e.angle+Rt;c>Ot&&(c-=Ot),F>Ot&&(F-=Ot);const d=(t,e,n,r)=>{const u=[Math.cos(e),Math.sin(e)];return t+(me(u,n)+me(u,r))/2>me(u,s)};return d((t.x2-t.x1)/2,h,D,l)&&d((t.y2-t.y1)/2,c,D,l)&&d((e.x2-e.x1)/2,f,o,a)&&d((e.y2-e.y1)/2,F,o,a)}let Ce,Ee,Me,be,Be,ve,we,Ae,Se,Te,_e,Ne;function Le(t,e,n=3,r=!1){let u=t.x1,i=t.x2,s=t.y1,o=t.y2,a=e.x1,D=e.x2,l=e.y1,h=e.y2;if(r){let t;u>i&&(t=u,u=i,i=t),s>o&&(t=s,s=o,o=t),a>D&&(t=a,a=D,D=t),l>h&&(t=l,l=h,h=t)}if(u>=D||i<=a||s>=h||o<=l)return[t,e];const c=(i-u+2*n)*(o-s+2*n),f=(D-a+2*n)*(h-l+2*n),F=Math.min(u,a),d=Math.min(s,l),m=Math.max(i,D),g=Math.max(o,h);return c+f>(m-F)*(g-d)?[{x1:F,x2:m,y1:d,y2:g}]:[t,e]}const ke={x:0,y:0},Ie={x:0,y:0};function Re(t,e,n,r){return Vt(t,e,n)<=r/2&&He(t,e,n)}const Ue={x:0,y:0},Oe={x:0,y:0},Pe={x:0,y:0};function He(t,e,n){return Ue.x=e.x-t.x,Ue.y=e.y-t.y,Oe.x=n.x-t.x,Oe.y=n.y-t.y,Pe.x=e.y-n.y,Pe.y=n.x-e.x,Xt(Ue,Pe)*Xt(Oe,Pe)<0}class je{constructor(t){this.canvas=t,t&&(this.ctx=t.getContext("2d"))}setCanvas(t){this.canvas=t,t&&(this.ctx=t.getContext("2d"))}measureText(t){return this.canvas?this.measureTextByCanvas(t):(console.warn("[warn] no canvas, measureText might be not accurate"),this.estimate(t))}measureTextByCanvas(t){return this.ctx?(this.ctx.font=function({fontStyle:t,fontVariant:e,fontWeight:n,fontSize:r,fontFamily:u}){return(t?t+" ":"")+(e?e+" ":"")+(n?n+" ":"")+(r||12)+"px "+(u||"sans-serif")}(t),{width:this.ctx.measureText(t.text).width,height:t.fontSize}):(console.error("[error!!!]measureTextByCanvas can not be called without canvas"),{width:-1,height:t.fontSize})}estimate({text:t,fontSize:e}){let n=0,r=0;for(let e=0;e<t.length;e++)t.charCodeAt(e)<128?n++:r++;return{width:~~(.8*n*e+r*e),height:e}}static getDefaultUtils(t){return je.instance||(je.instance=new je(t)),je.instance}}const qe=1e-8;function We(t,e,n,r,u){for(let i=0,s=u[u.length-1];i<u.length;i++){const o=u[i];if(ce([t,e],[n,r],[o.x,o.y],[s.x,s.y]))return!0;s=o}return!1}function ze(t,e,n){let r=0,u=t[0];if(!u)return!1;for(let i=1;i<t.length;i++){const s=t[i];r+=Ye(u.x,u.y,s.x,s.y,e,n),u=s}const i=t[0];return Ge(u.x,i.x)&&Ge(u.y,i.y)||(r+=Ye(u.x,u.y,i.x,i.y,e,n)),0!==r}function Ye(t,e,n,r,u,i){if(i>e&&i>r||i<e&&i<r)return 0;if(r===e)return 0;const s=(i-e)/(r-e);let o=r<e?1:-1;1!==s&&0!==s||(o=r<e?.5:-.5);const a=s*(n-t)+t;return a===u?1/0:a>u?o:0}function Ge(t,e){return Math.abs(t-e)<qe}const Ve=t=>{if("string"!=typeof t)throw new TypeError(`Expected a \`string\`, got \`${typeof t}\``);return t.replace($e(),"")},$e=({onlyFirst:t=!1}={})=>{const e=["[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)","(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]))"].join("|");return new RegExp(e,t?void 0:"g")},Xe=t=>{let e=t.charCodeAt(0),n=2===t.length?t.charCodeAt(1):0,r=e;return 55296<=e&&e<=56319&&56320<=n&&n<=57343&&(e&=1023,n&=1023,r=e<<10|n,r+=65536),12288===r||65281<=r&&r<=65376||65504<=r&&r<=65510?"F":8361===r||65377<=r&&r<=65470||65474<=r&&r<=65479||65482<=r&&r<=65487||65490<=r&&r<=65495||65498<=r&&r<=65500||65512<=r&&r<=65518?"H":4352<=r&&r<=4447||4515<=r&&r<=4519||4602<=r&&r<=4607||9001<=r&&r<=9002||11904<=r&&r<=11929||11931<=r&&r<=12019||12032<=r&&r<=12245||12272<=r&&r<=12283||12289<=r&&r<=12350||12353<=r&&r<=12438||12441<=r&&r<=12543||12549<=r&&r<=12589||12593<=r&&r<=12686||12688<=r&&r<=12730||12736<=r&&r<=12771||12784<=r&&r<=12830||12832<=r&&r<=12871||12880<=r&&r<=13054||13056<=r&&r<=19903||19968<=r&&r<=42124||42128<=r&&r<=42182||43360<=r&&r<=43388||44032<=r&&r<=55203||55216<=r&&r<=55238||55243<=r&&r<=55291||63744<=r&&r<=64255||65040<=r&&r<=65049||65072<=r&&r<=65106||65108<=r&&r<=65126||65128<=r&&r<=65131||110592<=r&&r<=110593||127488<=r&&r<=127490||127504<=r&&r<=127546||127552<=r&&r<=127560||127568<=r&&r<=127569||131072<=r&&r<=194367||177984<=r&&r<=196605||196608<=r&&r<=262141?"W":32<=r&&r<=126||162<=r&&r<=163||165<=r&&r<=166||172===r||175===r||10214<=r&&r<=10221||10629<=r&&r<=10630?"Na":161===r||164===r||167<=r&&r<=168||170===r||173<=r&&r<=174||176<=r&&r<=180||182<=r&&r<=186||188<=r&&r<=191||198===r||208===r||215<=r&&r<=216||222<=r&&r<=225||230===r||232<=r&&r<=234||236<=r&&r<=237||240===r||242<=r&&r<=243||247<=r&&r<=250||252===r||254===r||257===r||273===r||275===r||283===r||294<=r&&r<=295||299===r||305<=r&&r<=307||312===r||319<=r&&r<=322||324===r||328<=r&&r<=331||333===r||338<=r&&r<=339||358<=r&&r<=359||363===r||462===r||464===r||466===r||468===r||470===r||472===r||474===r||476===r||593===r||609===r||708===r||711===r||713<=r&&r<=715||717===r||720===r||728<=r&&r<=731||733===r||735===r||768<=r&&r<=879||913<=r&&r<=929||931<=r&&r<=937||945<=r&&r<=961||963<=r&&r<=969||1025===r||1040<=r&&r<=1103||1105===r||8208===r||8211<=r&&r<=8214||8216<=r&&r<=8217||8220<=r&&r<=8221||8224<=r&&r<=8226||8228<=r&&r<=8231||8240===r||8242<=r&&r<=8243||8245===r||8251===r||8254===r||8308===r||8319===r||8321<=r&&r<=8324||8364===r||8451===r||8453===r||8457===r||8467===r||8470===r||8481<=r&&r<=8482||8486===r||8491===r||8531<=r&&r<=8532||8539<=r&&r<=8542||8544<=r&&r<=8555||8560<=r&&r<=8569||8585===r||8592<=r&&r<=8601||8632<=r&&r<=8633||8658===r||8660===r||8679===r||8704===r||8706<=r&&r<=8707||8711<=r&&r<=8712||8715===r||8719===r||8721===r||8725===r||8730===r||8733<=r&&r<=8736||8739===r||8741===r||8743<=r&&r<=8748||8750===r||8756<=r&&r<=8759||8764<=r&&r<=8765||8776===r||8780===r||8786===r||8800<=r&&r<=8801||8804<=r&&r<=8807||8810<=r&&r<=8811||8814<=r&&r<=8815||8834<=r&&r<=8835||8838<=r&&r<=8839||8853===r||8857===r||8869===r||8895===r||8978===r||9312<=r&&r<=9449||9451<=r&&r<=9547||9552<=r&&r<=9587||9600<=r&&r<=9615||9618<=r&&r<=9621||9632<=r&&r<=9633||9635<=r&&r<=9641||9650<=r&&r<=9651||9654<=r&&r<=9655||9660<=r&&r<=9661||9664<=r&&r<=9665||9670<=r&&r<=9672||9675===r||9678<=r&&r<=9681||9698<=r&&r<=9701||9711===r||9733<=r&&r<=9734||9737===r||9742<=r&&r<=9743||9748<=r&&r<=9749||9756===r||9758===r||9792===r||9794===r||9824<=r&&r<=9825||9827<=r&&r<=9829||9831<=r&&r<=9834||9836<=r&&r<=9837||9839===r||9886<=r&&r<=9887||9918<=r&&r<=9919||9924<=r&&r<=9933||9935<=r&&r<=9953||9955===r||9960<=r&&r<=9983||10045===r||10071===r||10102<=r&&r<=10111||11093<=r&&r<=11097||12872<=r&&r<=12879||57344<=r&&r<=63743||65024<=r&&r<=65039||65533===r||127232<=r&&r<=127242||127248<=r&&r<=127277||127280<=r&&r<=127337||127344<=r&&r<=127386||917760<=r&&r<=917999||983040<=r&&r<=1048573||1048576<=r&&r<=1114109?"A":"N"},Ze=()=>/[#*0-9]\uFE0F?\u20E3|[\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23ED-\u23EF\u23F1\u23F2\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB\u25FC\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u267F\u2692\u2694-\u2697\u2699\u269B\u269C\u26A0\u26A7\u26AA\u26B0\u26B1\u26BD\u26BE\u26C4\u26C8\u26CF\u26D1\u26D3\u26E9\u26F0-\u26F5\u26F7\u26F8\u26FA\u2702\u2708\u2709\u270F\u2712\u2714\u2716\u271D\u2721\u2733\u2734\u2744\u2747\u2757\u2763\u27A1\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B55\u3030\u303D\u3297\u3299]\uFE0F?|[\u261D\u270C\u270D](?:\uFE0F|\uD83C[\uDFFB-\uDFFF])?|[\u270A\u270B](?:\uD83C[\uDFFB-\uDFFF])?|[\u23E9-\u23EC\u23F0\u23F3\u25FD\u2693\u26A1\u26AB\u26C5\u26CE\u26D4\u26EA\u26FD\u2705\u2728\u274C\u274E\u2753-\u2755\u2795-\u2797\u27B0\u27BF\u2B50]|\u26F9(?:\uFE0F|\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|\u2764\uFE0F?(?:\u200D(?:\uD83D\uDD25|\uD83E\uDE79))?|\uD83C(?:[\uDC04\uDD70\uDD71\uDD7E\uDD7F\uDE02\uDE37\uDF21\uDF24-\uDF2C\uDF36\uDF7D\uDF96\uDF97\uDF99-\uDF9B\uDF9E\uDF9F\uDFCD\uDFCE\uDFD4-\uDFDF\uDFF5\uDFF7]\uFE0F?|[\uDF85\uDFC2\uDFC7](?:\uD83C[\uDFFB-\uDFFF])?|[\uDFC3\uDFC4\uDFCA](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDFCB\uDFCC](?:\uFE0F|\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDCCF\uDD8E\uDD91-\uDD9A\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF7C\uDF7E-\uDF84\uDF86-\uDF93\uDFA0-\uDFC1\uDFC5\uDFC6\uDFC8\uDFC9\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF8-\uDFFF]|\uDDE6\uD83C[\uDDE8-\uDDEC\uDDEE\uDDF1\uDDF2\uDDF4\uDDF6-\uDDFA\uDDFC\uDDFD\uDDFF]|\uDDE7\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEF\uDDF1-\uDDF4\uDDF6-\uDDF9\uDDFB\uDDFC\uDDFE\uDDFF]|\uDDE8\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDEE\uDDF0-\uDDF5\uDDF7\uDDFA-\uDDFF]|\uDDE9\uD83C[\uDDEA\uDDEC\uDDEF\uDDF0\uDDF2\uDDF4\uDDFF]|\uDDEA\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDED\uDDF7-\uDDFA]|\uDDEB\uD83C[\uDDEE-\uDDF0\uDDF2\uDDF4\uDDF7]|\uDDEC\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEE\uDDF1-\uDDF3\uDDF5-\uDDFA\uDDFC\uDDFE]|\uDDED\uD83C[\uDDF0\uDDF2\uDDF3\uDDF7\uDDF9\uDDFA]|\uDDEE\uD83C[\uDDE8-\uDDEA\uDDF1-\uDDF4\uDDF6-\uDDF9]|\uDDEF\uD83C[\uDDEA\uDDF2\uDDF4\uDDF5]|\uDDF0\uD83C[\uDDEA\uDDEC-\uDDEE\uDDF2\uDDF3\uDDF5\uDDF7\uDDFC\uDDFE\uDDFF]|\uDDF1\uD83C[\uDDE6-\uDDE8\uDDEE\uDDF0\uDDF7-\uDDFB\uDDFE]|\uDDF2\uD83C[\uDDE6\uDDE8-\uDDED\uDDF0-\uDDFF]|\uDDF3\uD83C[\uDDE6\uDDE8\uDDEA-\uDDEC\uDDEE\uDDF1\uDDF4\uDDF5\uDDF7\uDDFA\uDDFF]|\uDDF4\uD83C\uDDF2|\uDDF5\uD83C[\uDDE6\uDDEA-\uDDED\uDDF0-\uDDF3\uDDF7-\uDDF9\uDDFC\uDDFE]|\uDDF6\uD83C\uDDE6|\uDDF7\uD83C[\uDDEA\uDDF4\uDDF8\uDDFA\uDDFC]|\uDDF8\uD83C[\uDDE6-\uDDEA\uDDEC-\uDDF4\uDDF7-\uDDF9\uDDFB\uDDFD-\uDDFF]|\uDDF9\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDED\uDDEF-\uDDF4\uDDF7\uDDF9\uDDFB\uDDFC\uDDFF]|\uDDFA\uD83C[\uDDE6\uDDEC\uDDF2\uDDF3\uDDF8\uDDFE\uDDFF]|\uDDFB\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDEE\uDDF3\uDDFA]|\uDDFC\uD83C[\uDDEB\uDDF8]|\uDDFD\uD83C\uDDF0|\uDDFE\uD83C[\uDDEA\uDDF9]|\uDDFF\uD83C[\uDDE6\uDDF2\uDDFC]|\uDFF3\uFE0F?(?:\u200D(?:\u26A7\uFE0F?|\uD83C\uDF08))?|\uDFF4(?:\u200D\u2620\uFE0F?|\uDB40\uDC67\uDB40\uDC62\uDB40(?:\uDC65\uDB40\uDC6E\uDB40\uDC67|\uDC73\uDB40\uDC63\uDB40\uDC74|\uDC77\uDB40\uDC6C\uDB40\uDC73)\uDB40\uDC7F)?)|\uD83D(?:[\uDC08\uDC26](?:\u200D\u2B1B)?|[\uDC3F\uDCFD\uDD49\uDD4A\uDD6F\uDD70\uDD73\uDD76-\uDD79\uDD87\uDD8A-\uDD8D\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA\uDECB\uDECD-\uDECF\uDEE0-\uDEE5\uDEE9\uDEF0\uDEF3]\uFE0F?|[\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDC8F\uDC91\uDCAA\uDD7A\uDD95\uDD96\uDE4C\uDE4F\uDEC0\uDECC](?:\uD83C[\uDFFB-\uDFFF])?|[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDD74\uDD90](?:\uFE0F|\uD83C[\uDFFB-\uDFFF])?|[\uDC00-\uDC07\uDC09-\uDC14\uDC16-\uDC25\uDC27-\uDC3A\uDC3C-\uDC3E\uDC40\uDC44\uDC45\uDC51-\uDC65\uDC6A\uDC79-\uDC7B\uDC7D-\uDC80\uDC84\uDC88-\uDC8E\uDC90\uDC92-\uDCA9\uDCAB-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDDA4\uDDFB-\uDE2D\uDE2F-\uDE34\uDE37-\uDE44\uDE48-\uDE4A\uDE80-\uDEA2\uDEA4-\uDEB3\uDEB7-\uDEBF\uDEC1-\uDEC5\uDED0-\uDED2\uDED5-\uDED7\uDEDC-\uDEDF\uDEEB\uDEEC\uDEF4-\uDEFC\uDFE0-\uDFEB\uDFF0]|\uDC15(?:\u200D\uD83E\uDDBA)?|\uDC3B(?:\u200D\u2744\uFE0F?)?|\uDC41\uFE0F?(?:\u200D\uD83D\uDDE8\uFE0F?)?|\uDC68(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDC68\uDC69]\u200D\uD83D(?:\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?)|[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?)|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF-\uDDB3\uDDBC\uDDBD]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFC-\uDFFF])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF-\uDDB3\uDDBC\uDDBD]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFD-\uDFFF])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF-\uDDB3\uDDBC\uDDBD]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF-\uDDB3\uDDBC\uDDBD]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFD\uDFFF])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF-\uDDB3\uDDBC\uDDBD]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFE])))?))?|\uDC69(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?[\uDC68\uDC69]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?|\uDC69\u200D\uD83D(?:\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?))|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF-\uDDB3\uDDBC\uDDBD]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFC-\uDFFF])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF-\uDDB3\uDDBC\uDDBD]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB\uDFFD-\uDFFF])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF-\uDDB3\uDDBC\uDDBD]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF-\uDDB3\uDDBC\uDDBD]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB-\uDFFD\uDFFF])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF-\uDDB3\uDDBC\uDDBD]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB-\uDFFE])))?))?|\uDC6F(?:\u200D[\u2640\u2642]\uFE0F?)?|\uDD75(?:\uFE0F|\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|\uDE2E(?:\u200D\uD83D\uDCA8)?|\uDE35(?:\u200D\uD83D\uDCAB)?|\uDE36(?:\u200D\uD83C\uDF2B\uFE0F?)?)|\uD83E(?:[\uDD0C\uDD0F\uDD18-\uDD1F\uDD30-\uDD34\uDD36\uDD77\uDDB5\uDDB6\uDDBB\uDDD2\uDDD3\uDDD5\uDEC3-\uDEC5\uDEF0\uDEF2-\uDEF8](?:\uD83C[\uDFFB-\uDFFF])?|[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDDDE\uDDDF](?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDD0D\uDD0E\uDD10-\uDD17\uDD20-\uDD25\uDD27-\uDD2F\uDD3A\uDD3F-\uDD45\uDD47-\uDD76\uDD78-\uDDB4\uDDB7\uDDBA\uDDBC-\uDDCC\uDDD0\uDDE0-\uDDFF\uDE70-\uDE7C\uDE80-\uDE88\uDE90-\uDEBD\uDEBF-\uDEC2\uDECE-\uDEDB\uDEE0-\uDEE8]|\uDD3C(?:\u200D[\u2640\u2642]\uFE0F?|\uD83C[\uDFFB-\uDFFF])?|\uDDD1(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF-\uDDB3\uDDBC\uDDBD]|\uDD1D\u200D\uD83E\uDDD1))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFC-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF-\uDDB3\uDDBC\uDDBD]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB\uDFFD-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF-\uDDB3\uDDBC\uDDBD]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF-\uDDB3\uDDBC\uDDBD]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB-\uDFFD\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF-\uDDB3\uDDBC\uDDBD]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB-\uDFFE]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF-\uDDB3\uDDBC\uDDBD]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?))?|\uDEF1(?:\uD83C(?:\uDFFB(?:\u200D\uD83E\uDEF2\uD83C[\uDFFC-\uDFFF])?|\uDFFC(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB\uDFFD-\uDFFF])?|\uDFFD(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])?|\uDFFE(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB-\uDFFD\uDFFF])?|\uDFFF(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB-\uDFFE])?))?)/g;function Je(t,e={},n){n||(n=1);const{fontStyle:r=e.fontStyle,fontVariant:u=e.fontVariant,fontWeight:i=e.fontWeight,fontSize:s=e.fontSize,fontFamily:o=e.fontFamily}=t;return(r?r+" ":"")+(u?u+" ":"")+(i?i+" ":"")+s*n+"px "+(o||"sans-serif")}class Qe{constructor(t,e){this._numberCharSize=null,this._fullCharSize=null,this._letterCharSize=null,this._specialCharSizeMap={},this._canvas=null,this._context=null,this._contextSaved=!1,this._notSupportCanvas=!1,this._notSupportVRender=!1,this._userSpec={},this.specialCharSet="-/: .,@%'\"~",this._option=t,this._userSpec=null!=e?e:{},this.textSpec=this._initSpec(),a(t.specialCharSet)&&(this.specialCharSet=t.specialCharSet),this._standardMethod=a(t.getTextBounds)?this.fullMeasure.bind(this):this.measureWithNaiveCanvas.bind(this)}initContext(){if(this._notSupportCanvas)return!1;if(o(this._canvas)&&(a(this._option.getCanvasForMeasure)&&(this._canvas=this._option.getCanvasForMeasure()),o(this._canvas)&&"undefined"!=typeof window&&void 0!==window.document&&globalThis&&a(globalThis.document)&&(this._canvas=globalThis.document.createElement("canvas"))),o(this._context)&&a(this._canvas)){const t=this._canvas.getContext("2d");a(t)&&(t.save(),t.font=Je(this.textSpec),this._contextSaved=!0,this._context=t)}return!o(this._context)||(this._notSupportCanvas=!0,!1)}_initSpec(){var t,e,n;const{defaultFontParams:r={}}=this._option,{fontStyle:u=r.fontStyle,fontVariant:i=r.fontVariant,fontWeight:s=(null!==(t=r.fontWeight)&&void 0!==t?t:"normal"),fontSize:o=(null!==(e=r.fontSize)&&void 0!==e?e:12),fontFamily:a=(null!==(n=r.fontFamily)&&void 0!==n?n:"sans-serif"),align:D,textAlign:l=(null!=D?D:"center"),baseline:h,textBaseline:f=(null!=h?h:"middle"),ellipsis:F,limit:d}=this._userSpec;let{lineHeight:m=o}=this._userSpec;if(c(m)&&"%"===m[m.length-1]){const t=Number.parseFloat(m.substring(0,m.length-1))/100;m=o*t}return{fontStyle:u,fontVariant:i,fontFamily:a,fontSize:o,fontWeight:s,textAlign:l,textBaseline:f,ellipsis:F,limit:d,lineHeight:m}}measure(t,e){switch(e){case"vrender":case"canopus":return this.fullMeasure(t);case"canvas":return this.measureWithNaiveCanvas(t);case"simple":return this.quickMeasureWithoutCanvas(t);default:return this.quickMeasure(t)}}fullMeasure(t){if(o(t))return{width:0,height:0};if(o(this._option.getTextBounds)||!this._notSupportVRender)return this.measureWithNaiveCanvas(t);const{fontFamily:e,fontSize:n,fontWeight:r,textAlign:u,textBaseline:i,ellipsis:s,limit:a,lineHeight:D}=this.textSpec;let l;try{const o=this._option.getTextBounds({text:t,fontFamily:e,fontSize:n,fontWeight:r,textAlign:u,textBaseline:i,ellipsis:!!s,maxLineWidth:a||1/0,lineHeight:D});l={width:o.width(),height:o.height()}}catch(e){this._notSupportVRender=!0,l=this.measureWithNaiveCanvas(t)}return l}measureWithNaiveCanvas(t){return this._measureReduce(t,this._measureWithNaiveCanvas.bind(this))}_measureWithNaiveCanvas(t){var e;if(!this.initContext())return this._quickMeasureWithoutCanvas(t);const n=this._context.measureText(t),{fontSize:r,lineHeight:u}=this.textSpec;return{width:n.width,height:null!==(e=u)&&void 0!==e?e:r,fontBoundingBoxAscent:n.fontBoundingBoxAscent,fontBoundingBoxDescent:n.fontBoundingBoxDescent}}quickMeasure(t){return this._measureReduce(t,this._quickMeasure.bind(this))}_quickMeasure(t){const e={width:0,height:0};for(let n=0;n<t.length;n++){const r=t[n];let u=this._measureSpecialChar(r);o(u)&&Qe.NUMBERS_CHAR_SET.includes(r)&&(u=this._measureNumberChar()),o(u)&&["F","W"].includes(Xe(r))&&(u=this._measureFullSizeChar()),o(u)&&(u=this._measureLetterChar()),e.width+=u.width,e.height=Math.max(e.height,u.height),!o(u.fontBoundingBoxAscent)&&(e.fontBoundingBoxAscent=u.fontBoundingBoxAscent),!o(u.fontBoundingBoxDescent)&&(e.fontBoundingBoxDescent=u.fontBoundingBoxDescent)}return e}quickMeasureWithoutCanvas(t){return this._measureReduce(t,this._quickMeasureWithoutCanvas.bind(this))}_quickMeasureWithoutCanvas(t){var e;const n={width:0,height:0},{fontSize:r,lineHeight:u}=this.textSpec;for(let e=0;e<t.length;e++){const u=t[e],i=["F","W"].includes(Xe(u))?1:.53;n.width+=i*r}return n.height=null!==(e=u)&&void 0!==e?e:r,n}_measureReduce(t,e){var n;const{fontSize:r,lineHeight:u}=this.textSpec,i={width:0,height:0};if(o(t))return i;if(f(t)){const s=t.filter(a).map((t=>t.toString()));return 0===s.length?i:1===s.length?e(s[0]):{width:s.reduce(((t,n)=>Math.max(t,e(n).width)),0),height:s.length*((null!==(n=u)&&void 0!==n?n:r)+1)+1}}return e(t.toString())}_measureNumberChar(){if(o(this._numberCharSize)){const t=this._standardMethod(Qe.NUMBERS_CHAR_SET);this._numberCharSize={width:t.width/Qe.NUMBERS_CHAR_SET.length,height:t.height,fontBoundingBoxAscent:t.fontBoundingBoxAscent,fontBoundingBoxDescent:t.fontBoundingBoxDescent}}return this._numberCharSize}_measureFullSizeChar(){return o(this._fullCharSize)&&(this._fullCharSize=this._standardMethod(Qe.FULL_SIZE_CHAR)),this._fullCharSize}_measureLetterChar(){if(o(this._letterCharSize)){const t=this._standardMethod(Qe.ALPHABET_CHAR_SET);this._letterCharSize={width:t.width/Qe.ALPHABET_CHAR_SET.length,height:t.height,fontBoundingBoxAscent:t.fontBoundingBoxAscent,fontBoundingBoxDescent:t.fontBoundingBoxDescent}}return this._letterCharSize}_measureSpecialChar(t){return a(this._specialCharSizeMap[t])?this._specialCharSizeMap[t]:this.specialCharSet.includes(t)?(this._specialCharSizeMap[t]=this._standardMethod(t),this._specialCharSizeMap[t]):null}release(){a(this._canvas)&&(this._canvas=null),a(this._context)&&(this._contextSaved&&(this._context.restore(),this._contextSaved=!1),this._context=null)}}Qe.ALPHABET_CHAR_SET="abcdefghijklmnopqrstuvwxyz",Qe.NUMBERS_CHAR_SET="0123456789",Qe.FULL_SIZE_CHAR="字";function Ke(t,e,n){const{x1:r,y1:u,x2:i,y2:s}=e;return n.onlyTranslate()?(t!==e&&t.setValue(e.x1,e.y1,e.x2,e.y2),t.translate(n.e,n.f),e):(t.clear(),t.add(n.a*r+n.c*u+n.e,n.b*r+n.d*u+n.f),t.add(n.a*i+n.c*u+n.e,n.b*i+n.d*u+n.f),t.add(n.a*i+n.c*s+n.e,n.b*i+n.d*s+n.f),t.add(n.a*r+n.c*s+n.e,n.b*r+n.d*s+n.f),e)}class tn{constructor(t){t?this.setValue(t.x1,t.y1,t.x2,t.y2):this.clear()}clone(){return new tn(this)}clear(){return this.x1=+Number.MAX_VALUE,this.y1=+Number.MAX_VALUE,this.x2=-Number.MAX_VALUE,this.y2=-Number.MAX_VALUE,this}empty(){return this.x1===+Number.MAX_VALUE&&this.y1===+Number.MAX_VALUE&&this.x2===-Number.MAX_VALUE&&this.y2===-Number.MAX_VALUE}equals(t){return this.x1===t.x1&&this.y1===t.y1&&this.x2===t.x2&&this.y2===t.y2}setValue(t=0,e=0,n=0,r=0){return this.x1=t,this.y1=e,this.x2=n,this.y2=r,this}set(t=0,e=0,n=0,r=0){return n<t?(this.x2=t,this.x1=n):(this.x1=t,this.x2=n),r<e?(this.y2=e,this.y1=r):(this.y1=e,this.y2=r),this}add(t=0,e=0){return t<this.x1&&(this.x1=t),e<this.y1&&(this.y1=e),t>this.x2&&(this.x2=t),e>this.y2&&(this.y2=e),this}expand(t=0){return f(t)?(this.y1-=t[0],this.x2+=t[1],this.y2+=t[2],this.x1-=t[3]):(this.x1-=t,this.y1-=t,this.x2+=t,this.y2+=t),this}round(){return this.x1=Math.floor(this.x1),this.y1=Math.floor(this.y1),this.x2=Math.ceil(this.x2),this.y2=Math.ceil(this.y2),this}translate(t=0,e=0){return this.x1+=t,this.x2+=t,this.y1+=e,this.y2+=e,this}rotate(t=0,e=0,n=0){const r=this.rotatedPoints(t,e,n);return this.clear().add(r[0],r[1]).add(r[2],r[3]).add(r[4],r[5]).add(r[6],r[7])}scale(t=0,e=0,n=0,r=0){const u=this.scalePoints(t,e,n,r);return this.clear().add(u[0],u[1]).add(u[2],u[3])}union(t){return t.x1<this.x1&&(this.x1=t.x1),t.y1<this.y1&&(this.y1=t.y1),t.x2>this.x2&&(this.x2=t.x2),t.y2>this.y2&&(this.y2=t.y2),this}intersect(t){return t.x1>this.x1&&(this.x1=t.x1),t.y1>this.y1&&(this.y1=t.y1),t.x2<this.x2&&(this.x2=t.x2),t.y2<this.y2&&(this.y2=t.y2),this}encloses(t){return t&&this.x1<=t.x1&&this.x2>=t.x2&&this.y1<=t.y1&&this.y2>=t.y2}alignsWith(t){return t&&(this.x1===t.x1||this.x2===t.x2||this.y1===t.y1||this.y2===t.y2)}intersects(t){return t&&!(this.x2<t.x1||this.x1>t.x2||this.y2<t.y1||this.y1>t.y2)}contains(t=0,e=0){return!(t<this.x1||t>this.x2||e<this.y1||e>this.y2)}containsPoint(t){return!(t.x<this.x1||t.x>this.x2||t.y<this.y1||t.y>this.y2)}width(){return this.empty()?0:this.x2-this.x1}height(){return this.empty()?0:this.y2-this.y1}scaleX(t=0){return this.x1*=t,this.x2*=t,this}scaleY(t=0){return this.y1*=t,this.y2*=t,this}transformWithMatrix(t){return Ke(this,this,t),this}copy(t){return this.x1=t.x1,this.y1=t.y1,this.x2=t.x2,this.y2=t.y2,this}rotatedPoints(t,e,n){const{x1:r,y1:u,x2:i,y2:s}=this,o=Math.cos(t),a=Math.sin(t),D=e-e*o+n*a,l=n-e*a-n*o;return[o*r-a*u+D,a*r+o*u+l,o*r-a*s+D,a*r+o*s+l,o*i-a*u+D,a*i+o*u+l,o*i-a*s+D,a*i+o*s+l]}scalePoints(t,e,n,r){const{x1:u,y1:i,x2:s,y2:o}=this;return[t*u+(1-t)*n,e*i+(1-e)*r,t*s+(1-t)*n,e*o+(1-e)*r]}}class en extends tn{constructor(t,e=0){var n;super(t),t&&(this.angle=null!==(n=t.angle)&&void 0!==n?n:e)}intersects(t){return xe(this,t)}setValue(t=0,e=0,n=0,r=0,u=0){return super.setValue(t,e,n,r),this.angle=u,this}clone(){return new en(this)}getRotatedCorners(){const t={x:(this.x1+this.x2)/2,y:(this.y1+this.y2)/2};return[ge({x:this.x1,y:this.y1},this.angle,t),ge({x:this.x2,y:this.y1},this.angle,t),ge({x:this.x1,y:this.y2},this.angle,t),ge({x:this.x2,y:this.y2},this.angle,t)]}}class nn{constructor(t=1,e=0,n=0,r=1,u=0,i=0){this.a=t,this.b=e,this.c=n,this.d=r,this.e=u,this.f=i}equalToMatrix(t){return!(this.e!==t.e||this.f!==t.f||this.a!==t.a||this.d!==t.d||this.b!==t.b||this.c!==t.c)}equalTo(t,e,n,r,u,i){return!(this.e!==u||this.f!==i||this.a!==t||this.d!==r||this.b!==e||this.c!==n)}setValue(t,e,n,r,u,i){return this.a=t,this.b=e,this.c=n,this.d=r,this.e=u,this.f=i,this}reset(){return this.a=1,this.b=0,this.c=0,this.d=1,this.e=0,this.f=0,this}getInverse(){const t=this.a,e=this.b,n=this.c,r=this.d,u=this.e,i=this.f,s=new nn,o=t*r-e*n;return s.a=r/o,s.b=-e/o,s.c=-n/o,s.d=t/o,s.e=(n*i-r*u)/o,s.f=-(t*i-e*u)/o,s}rotate(t){const e=Math.cos(t),n=Math.sin(t),r=this.a*e+this.c*n,u=this.b*e+this.d*n,i=this.a*-n+this.c*e,s=this.b*-n+this.d*e;return this.a=r,this.b=u,this.c=i,this.d=s,this}rotateByCenter(t,e,n){const r=Math.cos(t),u=Math.sin(t),i=(1-r)*e+u*n,s=(1-r)*n-u*e,o=r*this.a-u*this.b,a=u*this.a+r*this.b,D=r*this.c-u*this.d,l=u*this.c+r*this.d,h=r*this.e-u*this.f+i,c=u*this.e+r*this.f+s;return this.a=o,this.b=a,this.c=D,this.d=l,this.e=h,this.f=c,this}scale(t,e){return this.a*=t,this.b*=t,this.c*=e,this.d*=e,this}setScale(t,e){return this.b=this.b/this.a*t,this.c=this.c/this.d*e,this.a=t,this.d=e,this}transform(t,e,n,r,u,i){return this.multiply(t,e,n,r,u,i),this}translate(t,e){return this.e+=this.a*t+this.c*e,this.f+=this.b*t+this.d*e,this}transpose(){const{a:t,b:e,c:n,d:r,e:u,f:i}=this;return this.a=e,this.b=t,this.c=r,this.d=n,this.e=i,this.f=u,this}multiply(t,e,n,r,u,i){const s=this.a,o=this.b,a=this.c,D=this.d,l=s*t+a*e,h=o*t+D*e,c=s*n+a*r,f=o*n+D*r,F=s*u+a*i+this.e,d=o*u+D*i+this.f;return this.a=l,this.b=h,this.c=c,this.d=f,this.e=F,this.f=d,this}interpolate(t,e){const n=new nn;return n.a=this.a+(t.a-this.a)*e,n.b=this.b+(t.b-this.b)*e,n.c=this.c+(t.c-this.c)*e,n.d=this.d+(t.d-this.d)*e,n.e=this.e+(t.e-this.e)*e,n.f=this.f+(t.f-this.f)*e,n}transformPoint(t,e){const{a:n,b:r,c:u,d:i,e:s,f:o}=this,a=n*i-r*u,D=i/a,l=-r/a,h=-u/a,c=n/a,f=(u*o-i*s)/a,F=-(n*o-r*s)/a,{x:d,y:m}=t;e.x=d*D+m*h+f,e.y=d*l+m*c+F}onlyTranslate(t=1){return this.a===t&&0===this.b&&0===this.c&&this.d===t}clone(){return new nn(this.a,this.b,this.c,this.d,this.e,this.f)}toTransformAttrs(){const t=this.a,e=this.b,n=this.c,r=this.d,u=t*r-e*n,i={x:this.e,y:this.f,rotateDeg:0,scaleX:0,scaleY:0,skewX:0,skewY:0};if(0!==t||0!==e){const s=Math.sqrt(t*t+e*e);i.rotateDeg=e>0?Math.acos(t/s):-Math.acos(t/s),i.scaleX=s,i.scaleY=u/s,i.skewX=(t*n+e*r)/u,i.skewY=0}else if(0!==n||0!==r){const s=Math.sqrt(n*n+r*r);i.rotateDeg=Math.PI/2-(r>0?Math.acos(-n/s):-Math.acos(n/s)),i.scaleX=u/s,i.scaleY=s,i.skewX=0,i.skewY=(t*n+e*r)/u}return i.rotateDeg=ue(i.rotateDeg),i}}function rn(t,e,n){e/=100,n/=100;const r=(1-Math.abs(2*n-1))*e,u=r*(1-Math.abs(t/60%2-1)),i=n-r/2;let s=0,o=0,a=0;return 0<=t&&t<60?(s=r,o=u,a=0):60<=t&&t<120?(s=u,o=r,a=0):120<=t&&t<180?(s=0,o=r,a=u):180<=t&&t<240?(s=0,o=u,a=r):240<=t&&t<300?(s=u,o=0,a=r):300<=t&&t<360&&(s=r,o=0,a=u),s=Math.round(255*(s+i)),o=Math.round(255*(o+i)),a=Math.round(255*(a+i)),{r:s,g:o,b:a}}function un(t,e,n){t/=255,e/=255,n/=255;const r=Math.min(t,e,n),u=Math.max(t,e,n),i=u-r;let s=0,o=0,a=0;return s=0===i?0:u===t?(e-n)/i%6:u===e?(n-t)/i+2:(t-e)/i+4,s=Math.round(60*s),s<0&&(s+=360),a=(u+r)/2,o=0===i?0:i/(1-Math.abs(2*a-1)),o=+(100*o).toFixed(1),a=+(100*a).toFixed(1),{h:s,s:o,l:a}}const sn=/^#([0-9a-f]{3,8})$/,on={transparent:4294967040},an={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};function Dn(t){return((t=Math.max(0,Math.min(255,Math.round(t)||0)))<16?"0":"")+t.toString(16)}function ln(t){return m(t)?new dn(t>>16,t>>8&255,255&t,1):f(t)?new dn(t[0],t[1],t[2]):new dn(255,255,255)}function hn(t){return t<.04045?.0773993808*t:Math.pow(.9478672986*t+.0521327014,2.4)}function cn(t){return t<.0031308?12.92*t:1.055*Math.pow(t,.41666)-.055}const fn=(t,e)=>{const n=sn.exec(t);if(e||n){const t=parseInt(n[1],16),e=n[1].length;return 3===e?new dn((t>>8&15)+((t>>8&15)<<4),(t>>4&15)+((t>>4&15)<<4),(15&t)+((15&t)<<4),1):6===e?ln(t):8===e?new dn(t>>24&255,t>>16&255,t>>8&255,(255&t)/255):null}};class Fn{static Brighter(t,e=1){return 1===e?t:new Fn(t).brighter(e).toRGBA()}static SetOpacity(t,e=1){return 1===e?t:new Fn(t).setOpacity(e).toRGBA()}static getColorBrightness(t,e="hsl"){const n=t instanceof Fn?t:new Fn(t);switch(e){case"hsv":default:return n.getHSVBrightness();case"hsl":return n.getHSLBrightness();case"lum":return n.getLuminance();case"lum2":return n.getLuminance2();case"lum3":return n.getLuminance3();case"wcag":return n.getLuminanceWCAG()}}static parseColorString(t){if(a(on[t]))return function(t){return m(t)?new dn(t>>>24,t>>>16&255,t>>>8&255,255&t):f(t)?new dn(t[0],t[1],t[2],t[3]):new dn(255,255,255,1)}(on[t]);if(a(an[t]))return ln(an[t]);const e=`${t}`.trim().toLowerCase(),n=fn(e);if(void 0!==n)return n;if(/^(rgb|RGB|rgba|RGBA)/.test(e)){const t=e.replace(/(?:\(|\)|rgba|RGBA|rgb|RGB)*/g,"").split(",");return new dn(parseInt(t[0],10),parseInt(t[1],10),parseInt(t[2],10),parseFloat(t[3]))}if(/^(hsl|HSL|hsla|HSLA)/.test(e)){const t=e.replace(/(?:\(|\)|hsla|HSLA|hsl|HSL)*/g,"").split(","),n=rn(parseInt(t[0],10),parseInt(t[1],10),parseInt(t[2],10));return new dn(n.r,n.g,n.b,parseFloat(t[3]))}}constructor(t){const e=Fn.parseColorString(t);e?this.color=e:(console.warn(`Warn: 传入${t}无法解析为Color`),this.color=new dn(255,255,255))}toRGBA(){return this.color.formatRgb()}toString(){return this.color.formatRgb()}toHex(){return this.color.formatHex()}toHsl(){return this.color.formatHsl()}brighter(t){const{r:e,g:n,b:r}=this.color;return this.color.r=Math.max(0,Math.min(255,Math.floor(e*t))),this.color.g=Math.max(0,Math.min(255,Math.floor(n*t))),this.color.b=Math.max(0,Math.min(255,Math.floor(r*t))),this}add(t){const{r:e,g:n,b:r}=this.color;return this.color.r+=Math.min(255,e+t.color.r),this.color.g+=Math.min(255,n+t.color.g),this.color.b+=Math.min(255,r+t.color.b),this}sub(t){return this.color.r=Math.max(0,this.color.r-t.color.r),this.color.g=Math.max(0,this.color.g-t.color.g),this.color.b=Math.max(0,this.color.b-t.color.b),this}multiply(t){const{r:e,g:n,b:r}=this.color;return this.color.r=Math.max(0,Math.min(255,Math.floor(e*t.color.r))),this.color.g=Math.max(0,Math.min(255,Math.floor(n*t.color.g))),this.color.b=Math.max(0,Math.min(255,Math.floor(r*t.color.b))),this}getHSVBrightness(){return Math.max(this.color.r,this.color.g,this.color.b)/255}getHSLBrightness(){return.5*(Math.max(this.color.r,this.color.g,this.color.b)/255+Math.min(this.color.r,this.color.g,this.color.b)/255)}setHsl(t,e,n){const r=this.color.opacity,u=un(this.color.r,this.color.g,this.color.b),i=rn(o(t)?u.h:tt(t,0,360),o(e)?u.s:e>=0&&e<=1?100*e:e,o(n)?u.l:n<=1&&n>=0?100*n:n);return this.color=new dn(i.r,i.g,i.b,r),this}setRGB(t,e,n){return!o(t)&&(this.color.r=t),!o(e)&&(this.color.g=e),!o(n)&&(this.color.b=n),this}setHex(t){const e=`${t}`.trim().toLowerCase(),n=fn(e,!0);return null!=n?n:this}setColorName(t){const e=an[t.toLowerCase()];return void 0!==e?this.setHex(e):console.warn("THREE.Color: Unknown color "+t),this}setScalar(t){return this.color.r=t,this.color.g=t,this.color.b=t,this}setOpacity(t=1){return this.color.opacity=t,this}getLuminance(){return(.2126*this.color.r+.7152*this.color.g+.0722*this.color.b)/255}getLuminance2(){return(.2627*this.color.r+.678*this.color.g+.0593*this.color.b)/255}getLuminance3(){return(.299*this.color.r+.587*this.color.g+.114*this.color.b)/255}getLuminanceWCAG(){const t=this.color.r/255,e=this.color.g/255,n=this.color.b/255;let r,u,i;r=t<=.03928?t/12.92:Math.pow((t+.055)/1.055,2.4),u=e<=.03928?e/12.92:Math.pow((e+.055)/1.055,2.4),i=n<=.03928?n/12.92:Math.pow((n+.055)/1.055,2.4);return.2126*r+.7152*u+.0722*i}clone(){return new Fn(this.color.toString())}copyGammaToLinear(t,e=2){return this.color.r=Math.pow(t.color.r,e),this.color.g=Math.pow(t.color.g,e),this.color.b=Math.pow(t.color.b,e),this}copyLinearToGamma(t,e=2){const n=e>0?1/e:1;return this.color.r=Math.pow(t.color.r,n),this.color.g=Math.pow(t.color.g,n),this.color.b=Math.pow(t.color.b,n),this}convertGammaToLinear(t){return this.copyGammaToLinear(this,t),this}convertLinearToGamma(t){return this.copyLinearToGamma(this,t),this}copySRGBToLinear(t){return this.color.r=hn(t.color.r),this.color.g=hn(t.color.g),this.color.b=hn(t.color.b),this}copyLinearToSRGB(t){return this.color.r=cn(t.color.r),this.color.g=cn(t.color.g),this.color.b=cn(t.color.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}}class dn{constructor(t,e,n,r){this.r=isNaN(+t)?255:Math.max(0,Math.min(255,+t)),this.g=isNaN(+e)?255:Math.max(0,Math.min(255,+e)),this.b=isNaN(+n)?255:Math.max(0,Math.min(255,+n)),a(r)?this.opacity=isNaN(+r)?1:Math.max(0,Math.min(1,+r)):this.opacity=1}formatHex(){return`#${Dn(this.r)+Dn(this.g)+Dn(this.b)+(1===this.opacity?"":Dn(255*this.opacity))}`}formatRgb(){const t=this.opacity;return`${1===t?"rgb(":"rgba("}${this.r},${this.g},${this.b}${1===t?")":`,${t})`}`}formatHsl(){const t=this.opacity,{h:e,s:n,l:r}=un(this.r,this.g,this.b);return`${1===t?"hsl(":"hsla("}${e},${n}%,${r}%${1===t?")":`,${t})`}`}toString(){return this.formatHex()}}function mn(t){let e="",n="",r="";const u="#"===t[0]?1:0;for(let i=u;i<t.length;i++)"#"!==t[i]&&(i<u+2?e+=t[i]:i<u+4?n+=t[i]:i<u+6&&(r+=t[i]));return[parseInt(e,16),parseInt(n,16),parseInt(r,16)]}function gn(t,e,n){return Number((1<<24)+(t<<16)+(e<<8)+n).toString(16).slice(1)}function pn(t,e){const n=t.r,r=e.r,u=t.g,i=e.g,s=t.b,o=e.b,a=t.opacity,D=e.opacity;return t=>{const e=Math.round(n*(1-t)+r*t),l=Math.round(u*(1-t)+i*t),h=Math.round(s*(1-t)+o*t);return new dn(e,l,h,a*(1-t)+D*t)}}var yn=Object.freeze({__proto__:null,Color:Fn,DEFAULT_COLORS:an,RGB:dn,hexToRgb:mn,hslToRgb:rn,interpolateRgb:pn,rgbToHex:gn,rgbToHsl:un});function xn(t){return t?"getUTCFullYear":"getFullYear"}function Cn(t){return t?"getUTCMonth":"getMonth"}function En(t){return t?"getUTCDate":"getDate"}function Mn(t){return t?"getUTCHours":"getHours"}function bn(t){return t?"getUTCMinutes":"getMinutes"}function Bn(t){return t?"getUTCSeconds":"getSeconds"}function vn(t){return t?"getUTCMilliseconds":"getMilliseconds"}const wn=1e3,An=6e4,Sn=36e5,Tn=24*Sn,_n=t=>(t.setMonth(0,1),t.setHours(0,0,0,0),t),Nn=(t,e)=>(t.setFullYear(t.getFullYear()+e),t),Ln=(t,e)=>e.getFullYear()-t.getFullYear(),kn=t=>t.getFullYear(),In=t=>(t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0),t),Rn=(t,e)=>(t.setUTCFullYear(t.getUTCFullYear()+e),t),Un=(t,e)=>e.getUTCFullYear()-t.getUTCFullYear(),On=t=>t.getUTCFullYear(),Pn=t=>(t.setDate(1),t.setHours(0,0,0,0),t),Hn=(t,e)=>(t.setMonth(t.getMonth()+e),t),jn=(t,e)=>e.getMonth()-t.getMonth()+12*(e.getFullYear()-t.getFullYear()),qn=t=>t.getMonth(),Wn=t=>(t.setUTCDate(1),t.setUTCHours(0,0,0,0),t),zn=(t,e)=>(t.setUTCMonth(t.getUTCMonth()+e),t),Yn=(t,e)=>e.getUTCMonth()-t.getUTCMonth()+12*(e.getUTCFullYear()-t.getUTCFullYear()),Gn=t=>t.getUTCMonth(),Vn=t=>(t.setHours(0,0,0,0),t),$n=(t,e)=>(t.setDate(t.getDate()+e),t),Xn=(t,e)=>(+e-+t-(e.getTimezoneOffset()-t.getTimezoneOffset())*An)/Tn,Zn=t=>t.getDate()-1,Jn=t=>(t.setUTCHours(0,0,0,0),t),Qn=(t,e)=>(t.setUTCDate(t.getUTCDate()+e),t),Kn=(t,e)=>(+e-+t)/Tn,tr=t=>t.getUTCDate()-1,er=t=>(t.setTime(+t-t.getMilliseconds()-t.getSeconds()*wn-t.getMinutes()*An),t),nr=(t,e)=>(t.setHours(t.getHours()+e),t),rr=(t,e)=>(+e-+t)/Sn,ur=t=>t.getHours(),ir=t=>(t.setTime(+t-t.getUTCMilliseconds()-t.getUTCSeconds()*wn-t.getUTCMinutes()*An),t),sr=(t,e)=>(t.setUTCHours(t.getUTCHours()+e),t),or=t=>t.getUTCHours(),ar=t=>(t.setTime(+t-t.getMilliseconds()-t.getSeconds()*wn),t),Dr=(t,e)=>(t.setMinutes(t.getMinutes()+e),t),lr=(t,e)=>(+e-+t)/An,hr=t=>t.getMinutes(),cr=t=>(t.setTime(+t-t.getUTCMilliseconds()-t.getUTCSeconds()*wn),t),fr=(t,e)=>(t.setUTCMinutes(t.getUTCMinutes()+e),t),Fr=t=>t.getUTCMinutes(),dr=t=>(t.setTime(+t-t.getMilliseconds()),t),mr=(t,e)=>(t.setSeconds(t.getSeconds()+e),t),gr=(t,e)=>(+e-+t)/wn,pr=t=>t.getSeconds(),yr=t=>(t.setTime(+t-t.getUTCMilliseconds()),t),xr=(t,e)=>(t.setUTCSeconds(t.getUTCSeconds()+e),t),Cr=t=>t.getUTCSeconds(),Er=t=>t,Mr=(t,e)=>(t.setTime(+t+e),t),br=(t,e)=>+e-+t,Br=(t,e)=>n=>{const r=new Date(+n-1);return e(r,1),t(r),r},vr=(t,e)=>(n,r)=>{const u=new Date,i=new Date;return u.setTime(+n),i.setTime(+r),t(u),t(i),Math.floor(e(u,i))};function wr(t){const{x:e,y:n}=t.getBoundingClientRect();return{x:e,y:n}}const Ar=t=>t.getBoundingClientRect().width/t.offsetWidth,Sr=t=>t.getBoundingClientRect().height/t.offsetHeight;var Tr=6371008.8,_r={centimeters:637100880,centimetres:637100880,degrees:57.22891354143274,feet:20902260.511392,inches:39.37*Tr,kilometers:6371.0088,kilometres:6371.0088,meters:Tr,metres:Tr,miles:3958.761333810546,millimeters:6371008800,millimetres:6371008800,nauticalmiles:Tr/1852,radians:1,yards:6967335.223679999};
|
|
19
19
|
/* Adapted from venn.js by Ben Frederickson
|
|
20
20
|
* https://github.com/benfred/venn.js
|
|
21
21
|
* Licensed under the MIT
|
|
@@ -24,7 +24,7 @@ const at=1664525,Dt=1013904223,lt=4294967296;function ht(t=1){let e=t;return()=>
|
|
|
24
24
|
* License: https://github.com/benfred/venn.js/blob/master/LICENSE
|
|
25
25
|
* @license
|
|
26
26
|
*/
|
|
27
|
-
const
|
|
27
|
+
const Nr=1e-10;
|
|
28
28
|
/* Adapted from venn.js by Ben Frederickson
|
|
29
29
|
* https://github.com/benfred/venn.js
|
|
30
30
|
* Licensed under the MIT
|
|
@@ -32,7 +32,7 @@ const _r=1e-10;
|
|
|
32
32
|
* url: https://github.com/benfred/venn.js/blob/master/src/circleintersection.js
|
|
33
33
|
* License: https://github.com/benfred/venn.js/blob/master/LICENSE
|
|
34
34
|
* @license
|
|
35
|
-
*/function
|
|
35
|
+
*/function Lr(t,e){for(let n=0;n<e.length;++n)if(ee.distancePP(t,e[n])>e[n].radius+Nr)return!1;return!0}function kr(t,e){return t*t*Math.acos(1-e/t)-(t-e)*Math.sqrt(e*(2*t-e))}function Ir(t,e){const n=ee.distancePP(t,e),r=t.radius,u=e.radius;if(n>=r+u||n<=Math.abs(r-u))return[];const i=(r*r-u*u+n*n)/(2*n),s=Math.sqrt(r*r-i*i),o=t.x+i*(e.x-t.x)/n,a=t.y+i*(e.y-t.y)/n,D=-(e.y-t.y)*(s/n),l=-(e.x-t.x)*(s/n);return[{x:o+D,y:a-l},{x:o-D,y:a+l}]}function Rr(t){const e={x:0,y:0};for(let n=0;n<t.length;++n)e.x+=t[n].x,e.y+=t[n].y;return e.x/=t.length,e.y/=t.length,e}
|
|
36
36
|
/* Adapted from d3-time-format by Mike Bostock
|
|
37
37
|
* https://github.com/d3/d3-time-format
|
|
38
38
|
* Licensed under the ISC
|
|
@@ -47,7 +47,7 @@ const _r=1e-10;
|
|
|
47
47
|
|
|
48
48
|
* License: https://github.com/d3/d3-format/blob/main/LICENSE
|
|
49
49
|
* @license
|
|
50
|
-
*/function
|
|
50
|
+
*/function Or(t,e){const n=e?t.toExponential(e-1):t.toExponential(),r=n.indexOf("e");if(r<0)return null;const u=n.slice(0,r);return[u.length>1?u[0]+u.slice(2):u,+n.slice(r+1)]}
|
|
51
51
|
/* Adapted from d3-time-format by Mike Bostock
|
|
52
52
|
* https://github.com/d3/d3-format
|
|
53
53
|
* Licensed under the ISC
|
|
@@ -62,7 +62,7 @@ const _r=1e-10;
|
|
|
62
62
|
* License: https://github.com/d3/d3-format/blob/main/LICENSE
|
|
63
63
|
* @license
|
|
64
64
|
*/
|
|
65
|
-
let
|
|
65
|
+
let Pr;
|
|
66
66
|
/* Adapted from d3-time-format by Mike Bostock
|
|
67
67
|
* https://github.com/d3/d3-format
|
|
68
68
|
* Licensed under the ISC
|
|
@@ -70,21 +70,21 @@ let Or;
|
|
|
70
70
|
* License: https://github.com/d3/d3-format/blob/main/LICENSE
|
|
71
71
|
* @license
|
|
72
72
|
*/
|
|
73
|
-
function
|
|
73
|
+
function Hr(t,e){const n=Or(t,e);if(!n)return t+"";const r=n[0],u=n[1];return u<0?"0."+new Array(-u).join("0")+r:r.length>u+1?r.slice(0,u+1)+"."+r.slice(u+1):r+new Array(u-r.length+2).join("0")}
|
|
74
74
|
/* Adapted from d3-time-format by Mike Bostock
|
|
75
75
|
* https://github.com/d3/d3-format
|
|
76
76
|
* Licensed under the ISC
|
|
77
77
|
|
|
78
78
|
* License: https://github.com/d3/d3-format/blob/main/LICENSE
|
|
79
79
|
* @license
|
|
80
|
-
*/class
|
|
80
|
+
*/class jr{constructor(t={}){this.fill=void 0===t.fill?" ":t.fill+"",this.align=void 0===t.align?">":t.align+"",this.sign=void 0===t.sign?"-":t.sign+"",this.symbol=void 0===t.symbol?"":t.symbol+"",this.zero=!!t.zero,this.width=void 0===t.width?void 0:+t.width,this.comma=!!t.comma,this.precision=void 0===t.precision?void 0:+t.precision,this.trim=!!t.trim,this.type=void 0===t.type?"":t.type+""}toString(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(void 0===this.width?"":Math.max(1,0|this.width))+(this.comma?",":"")+(void 0===this.precision?"":"."+Math.max(0,0|this.precision))+(this.trim?"~":"")+this.type}}const qr=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function Wr(t){let e;if(e=qr.exec(t))return new jr({fill:e[1],align:e[2],sign:e[3],symbol:e[4],zero:e[5],width:e[6],comma:e[7],precision:e[8]&&e[8].slice(1),trim:e[9],type:e[10]});q.getInstance().error("invalid format: "+t)}
|
|
81
81
|
/* Adapted from d3-time-format by Mike Bostock
|
|
82
82
|
* https://github.com/d3/d3-format
|
|
83
83
|
* Licensed under the ISC
|
|
84
84
|
|
|
85
85
|
* License: https://github.com/d3/d3-format/blob/main/LICENSE
|
|
86
86
|
* @license
|
|
87
|
-
*/const zr=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];class
|
|
87
|
+
*/const zr=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];class Yr{constructor(){var t,e;this.locale={thousands:",",grouping:[3],currency:["$",""]},this.group=void 0===this.locale.grouping||void 0===this.locale.thousands?t=>t:(t=[...this.locale.grouping].map(Number),e=`${this.locale.thousands}`,function(n,r){let u=n.length;const i=[];let s=0,o=t[0],a=0;for(;u>0&&o>0&&(a+o+1>r&&(o=Math.max(1,r-a)),i.push(n.substring(u-=o,u+o)),!((a+=o+1)>r));)o=t[s=(s+1)%t.length];return i.reverse().join(e)}),this.currencyPrefix=void 0===this.locale.currency?"":this.locale.currency[0]+"",this.currencySuffix=void 0===this.locale.currency?"":this.locale.currency[1]+"",this.decimal=void 0===this.locale.decimal?".":this.locale.decimal+"",this.numerals=void 0===this.locale.numerals?t=>t:$r([...this.locale.numerals].map(String)),this.percent=void 0===this.locale.percent?"%":this.locale.percent+"",this.minus=void 0===this.locale.minus?"−":this.locale.minus+"",this.nan=void 0===this.locale.nan?"NaN":this.locale.nan+"",this.formatter=t=>this.newFormat(t),this.format=(t,e)=>this.formatter(t)(e),this.formatPrefix=(t,e)=>this._formatPrefix(t,e)}static getInstance(){return Yr.instance||(Yr.instance=new Yr),Yr.instance}newFormat(t){const e=Wr(t);let n=e.fill,r=e.align;const u=e.sign,i=e.symbol;let s=e.zero;const o=e.width;let a=e.comma,D=e.precision,l=e.trim,h=e.type;"n"===h?(a=!0,h="g"):Gr[h]||(void 0===D&&(D=12),l=!0,h="g"),(s||"0"===n&&"="===r)&&(s=!0,n="0",r="=");const c="$"===i?this.currencyPrefix:"#"===i&&/[boxX]/.test(h)?"0"+h.toLowerCase():"",f="$"===i?this.currencySuffix:/[%p]/.test(h)?this.percent:"",F=Gr[h],d=/[defgprstz%]/.test(h);D=void 0===D?6:/[gprs]/.test(h)?Math.max(1,Math.min(21,D)):Math.max(0,Math.min(20,D));const{nan:m,minus:g,decimal:p,group:y,numerals:x}=this;function C(t){let e,i,C,E=c,M=f,b=t;if("c"===h)M=F(b)+M,b="";else{b=+b;let t=b<0||1/b<0;if(b=isNaN(b)?m:F(Math.abs(b),D),l&&(b=function(t){const e=t.length;let n,r=-1;t:for(let u=1;u<e;++u)switch(t[u]){case".":r=n=u;break;case"0":0===r&&(r=u),n=u;break;default:if(!+t[u])break t;r>0&&(r=0)}return r>0?t.slice(0,r)+t.slice(n+1):t}(b)),t&&0==+b&&"+"!==u&&(t=!1),E=(t?"("===u?u:g:"-"===u||"("===u?"":u)+E,M=("s"===h?zr[8+Pr/3]:"")+M+(t&&"("===u?")":""),d)for(e=-1,i=b.length;++e<i;)if(C=b.charCodeAt(e),48>C||C>57){M=(46===C?p+b.slice(e+1):b.slice(e))+M,b=b.slice(0,e);break}}a&&!s&&(b=y(b,1/0));let B=E.length+b.length+M.length,v=B<o?new Array(o-B+1).join(n):"";switch(a&&s&&(b=y(v+b,v.length?o-M.length:1/0),v=""),r){case"<":b=E+b+M+v;break;case"=":b=E+v+b+M;break;case"^":b=v.slice(0,B=v.length>>1)+E+b+M+v.slice(B);break;default:b=v+E+b+M}return x(b)}return C.toString=function(){return t+""},C}_formatPrefix(t,e){const n=Wr(t);n.type="f";const r=this.newFormat(n.toString()),u=3*Math.max(-8,Math.min(8,Math.floor(Vr(e)/3))),i=Math.pow(10,-u),s=zr[8+u/3];return function(t){return r(i*t)+s}}}const Gr={"%":(t,e)=>(100*t).toFixed(e),b:t=>Math.round(t).toString(2),c:t=>t+"",d:function(t){return Math.abs(t=Math.round(t))>=1e21?t.toLocaleString("en").replace(/,/g,""):t.toString(10)},f:(t,e)=>t.toFixed(e),e:(t,e)=>t.toExponential(e),g:(t,e)=>t.toPrecision(e),o:t=>Math.round(t).toString(8),p:(t,e)=>Hr(100*t,e),r:Hr,s:function(t,e){const n=Or(t,e);if(!n)return t+"";const r=n[0],u=n[1],i=u-(Pr=3*Math.max(-8,Math.min(8,Math.floor(u/3))))+1,s=r.length;return i===s?r:i>s?r+new Array(i-s+1).join("0"):i>0?r.slice(0,i)+"."+r.slice(i):"0."+new Array(1-i).join("0")+Or(t,Math.max(0,e+i-1))[0]},X:t=>Math.round(t).toString(16).toUpperCase(),x:t=>Math.round(t).toString(16),t:(t,e)=>Number.isInteger(t)?t.toFixed(2):Math.floor(t*Math.pow(10,e))/Math.pow(10,e)+"",z:(t,e)=>t%1==0?t+"":t.toFixed(e)};function Vr(t){const e=Or(Math.abs(t));return e?e[1]:NaN}function $r(t){return function(e){return e.replace(/[0-9]/g,(e=>t[+e]))}}
|
|
88
88
|
/* Adapted from fmin by Ben Frederickson
|
|
89
89
|
* https://github.com/benfred/fmin
|
|
90
90
|
* Licensed under the BSD-3-Clause
|
|
@@ -92,7 +92,7 @@ function Pr(t,e){const n=Rr(t,e);if(!n)return t+"";const r=n[0],u=n[1];return u<
|
|
|
92
92
|
* url: https://github.com/benfred/fmin/blob/master/src/blas1.js
|
|
93
93
|
* License: https://github.com/benfred/fmin/blob/master/LICENSE
|
|
94
94
|
* @license
|
|
95
|
-
*/function
|
|
95
|
+
*/function Xr(t){const e=new Array(t);for(let n=0;n<t;++n)e[n]=0;return e}function Zr(t){return Math.sqrt(Zt(t,t))}function Jr(t,e,n){for(let r=0;r<e.length;++r)t[r]=e[r]*n}function Qr(t,e,n,r,u){for(let i=0;i<t.length;++i)t[i]=e*n[i]+r*u[i]}
|
|
96
96
|
/* Adapted from fmin by Ben Frederickson
|
|
97
97
|
* https://github.com/benfred/fmin
|
|
98
98
|
* Licensed under the BSD-3-Clause
|
|
@@ -101,7 +101,7 @@ function Pr(t,e){const n=Rr(t,e);if(!n)return t+"";const r=n[0],u=n[1];return u<
|
|
|
101
101
|
* License: https://github.com/benfred/fmin/blob/master/LICENSE
|
|
102
102
|
* @license
|
|
103
103
|
*/
|
|
104
|
-
function
|
|
104
|
+
function Kr(t,e,n,r,u,i,s){const o=n.fx,a=Zt(n.fxprime,e);let D=o,l=o,h=a,c=0;function f(l,c,f){for(let F=0;F<16;++F)if(u=(l+c)/2,Qr(r.x,1,n.x,u,e),D=r.fx=t(r.x,r.fxprime),h=Zt(r.fxprime,e),D>o+i*u*a||D>=f)c=u;else{if(Math.abs(h)<=-s*a)return u;h*(c-l)>=0&&(c=l),l=u,f=D}return 0}u=u||1,i=i||1e-6,s=s||.1;for(let F=0;F<10;++F){if(Qr(r.x,1,n.x,u,e),D=r.fx=t(r.x,r.fxprime),h=Zt(r.fxprime,e),D>o+i*u*a||F&&D>=l)return f(c,u,l);if(Math.abs(h)<=-s*a)return u;if(h>=0)return f(u,c,D);l=D,c=u,u*=2}return u}
|
|
105
105
|
/* Adapted from fmin by Ben Frederickson
|
|
106
106
|
* https://github.com/benfred/fmin
|
|
107
107
|
* Licensed under the BSD-3-Clause
|
|
@@ -109,7 +109,7 @@ function Qr(t,e,n,r,u,i,s){const o=n.fx,a=Xt(n.fxprime,e);let D=o,l=o,h=a,c=0;fu
|
|
|
109
109
|
* url: https://github.com/benfred/fmin/blob/master/src/conjugateGradient.js
|
|
110
110
|
* License: https://github.com/benfred/fmin/blob/master/LICENSE
|
|
111
111
|
* @license
|
|
112
|
-
*/t.AABBBounds=class extends
|
|
112
|
+
*/t.AABBBounds=class extends tn{},t.Bounds=tn,t.Color=Fn,t.ColorUtil=yn,t.DAY=Tn,t.DEFAULT_COLORS=an,t.EventEmitter=r,t.FormatSpecifier=jr,t.GraphicUtil=je,t.HOUR=Sn,t.HashTable=class{constructor(){this.items={},this.itemList=[]}get type(){return"xhHashTable"}set(t,e){const n=new Lt;n.key=t,n.value=e;let r=this.itemList.length;return this.has(t)&&(r=this.items[t].index),n.index=r,this.itemList[r]=n,this.items[t]=n,n}clear(){this.items={},this.itemList=[]}del(t){if(this.has(t)){const e=this.items[t].index;e>-1&&this.itemList.splice(e,1),delete this.items[t],this.resetIndex()}}delFrom(t){for(let e=t+1;e<this.count();e++){const t=this.itemList[e].key;delete this.items[t]}this.itemList.splice(t+1,this.count()-t),this.resetIndex()}resetIndex(){this.foreachHashv(((t,e)=>{const n=this.itemList.indexOf(e);this.items[t].index=n}))}has(t){return t in this.items}get(t){return this.has(t)?this.items[t].value:null}count(){return this.itemList.length}all(){return this.itemList.map((t=>t.value))}first(){return this.itemList[0].value}last(){return this.itemList[this.itemList.length-1].value}getByIndex(t){return this.itemList[t].value}getKeyByIndex(t){return this.itemList[t].key}foreach(t){for(const e in this.items){if(!1===t(e,this.items[e].value))return!1}return!0}foreachHashv(t){for(const e in this.items){if(!1===t(e,this.items[e]))return!1}return!0}hasValue(t){for(const e in this.items)if(this.items[e].value===t)return!0;return!1}indexOf(t){return this.has(t)?this.items[t].index:-1}insertAt(t,e,n){const r=new Lt;r.index=t,r.key=n,r.value=e,this.itemList.splice(t,0,r),this.items[n]=r,this.resetIndex()}sort(t){return this.itemList.sort(((e,n)=>t(e.value,n.value)))}toArray(){return this.itemList.slice(0,this.itemList.length).map((t=>t.value))}push(t){t.foreach(((t,e)=>{this.set(t,e)}))}mapKey(){const t=[];for(const e in this.items)t.push(e);return t}toImmutableMap(){}},t.HashValue=Lt,t.LRU=class{constructor(){this.CLEAN_THRESHOLD=1e3,this.L_TIME=1e3,this.R_COUNT=1,this.R_TIMESTAMP_MAX_SIZE=20}clearCache(t,e){const{CLEAN_THRESHOLD:n=this.CLEAN_THRESHOLD,L_TIME:r=this.L_TIME,R_COUNT:u=this.R_COUNT}=e;if(t.size<n)return 0;let i=0;const s=e=>{i++,t.delete(e)},o=Date.now();return t.forEach(((t,e)=>{if(t.timestamp.length<u)return s(e);let n=0;for(;o-t.timestamp[t.timestamp.length-1-n]<r&&(n++,!(n>=u)););if(n<u)return s(e);for(;o-t.timestamp[0]>r;)t.timestamp.shift()})),i}addLimitedTimestamp(t,e,n){const{R_TIMESTAMP_MAX_SIZE:r=this.R_TIMESTAMP_MAX_SIZE}=n;t.timestamp.length>r&&t.timestamp.shift(),t.timestamp.push(e)}clearTimeStamp(t,e){const{L_TIME:n=this.L_TIME}=e,r=Date.now();t.forEach((t=>{for(;r-t.timestamp[0]>n;)t.timestamp.shift()}))}clearItemTimestamp(t,e){const{L_TIME:n=this.L_TIME}=e,r=Date.now();for(;r-t.timestamp[0]>n;)t.timestamp.shift()}},t.Logger=q,t.MINUTE=An,t.MONTH=26784e5,t.Matrix=nn,t.NEWTON_ITERATIONS=4,t.NEWTON_MIN_SLOPE=.001,t.NumberUtil=Yr,t.OBBBounds=en,t.Point=te,t.PointService=ee,t.PolarPoint=ne,t.RGB=dn,t.SECOND=wn,t.SMALL=Nr,t.SUBDIVISION_MAX_ITERATIONS=10,t.SUBDIVISION_PRECISION=1e-7,t.TextMeasure=Qe,t.TimeUtil=Ur,t.YEAR=31536e6,t.aabbSeparation=(t,e)=>Math.max(e.x1-t.x2,t.x1-e.x2,e.y1-t.y2,t.y1-e.y2),t.abs=Pt,t.acos=function(t){return t>1?0:t<-1?It:Math.acos(t)},t.array=L,t.arrayEqual=function(t,e){if(!f(t)||!f(e))return!1;if(t.length!==e.length)return!1;for(let n=0;n<t.length;n++)if(t[n]!==e[n])return!1;return!0},t.ascending=I,t.asin=function(t){return t>=1?Rt:t<=-1?-Rt:Math.asin(t)},t.atan2=Ht,t.baseMerge=M,t.binaryFuzzySearch=(t,e)=>W(0,t.length,(n=>e(t[n]))),t.binaryFuzzySearchInNumberRange=W,t.bisect=function(t,e,n=0,r){for(o(r)&&(r=t.length);n<r;){const u=n+r>>>1;I(t[u],e)>0?r=u:n=u+1}return n}
|
|
113
113
|
/* Adapted from fmin by Ben Frederickson
|
|
114
114
|
* https://github.com/benfred/fmin
|
|
115
115
|
* Licensed under the BSD-3-Clause
|
|
@@ -117,7 +117,7 @@ function Qr(t,e,n,r,u,i,s){const o=n.fx,a=Xt(n.fxprime,e);let D=o,l=o,h=a,c=0;fu
|
|
|
117
117
|
* url: https://github.com/benfred/fmin/blob/master/src/bisect.js
|
|
118
118
|
* License: https://github.com/benfred/fmin/blob/master/LICENSE
|
|
119
119
|
* @license
|
|
120
|
-
*/,t.bootstrapEstimate=function(t,e,n){if(!t.length||t.some((t=>!Number.isFinite(t)))||!Number.isInteger(n.resamples)||n.resamples<1||!Number.isInteger(n.seed)||n.seed<0||n.seed>4294967295)throw new RangeError("bootstrap requires finite observations, positive resamples and a uint32 seed");const r=ht(n.seed),u=new Array(t.length),i=new Array(n.resamples);for(let s=0;s<n.resamples;s++){for(let e=0;e<u.length;e++)u[e]=t[Math.floor(r()*t.length)];const n=e(u);if(!Number.isFinite(n))throw new RangeError("bootstrap estimator must return a finite number");i[s]=n}return i},t.calculateAnchorOfArc=(t,e)=>{const{startAngle:n,endAngle:r,innerRadius:u,outerRadius:i}=t;let s=(n+r)/2,o=(u+i)/2;switch(e){case"inner-start":s=n,o=u;break;case"outer-start":s=n,o=i;break;case"inner-end":s=r,o=u;break;case"outer-end":s=r,o=i;break;case"inner-middle":o=u;break;case"outer-middle":o=i}return{angle:s,radius:o}},t.calculateAnchorOfBounds=(t,e)=>{const{x1:n,x2:r,y1:u,y2:i}=t,s=Math.abs(r-n),o=Math.abs(i-u);let a=(n+r)/2,D=(u+i)/2,l=0,h=0;switch(e){case"top":case"inside-top":h=-.5;break;case"bottom":case"inside-bottom":h=.5;break;case"left":case"inside-left":l=-.5;break;case"right":case"inside-right":l=.5;break;case"top-right":l=.5,h=-.5;break;case"top-left":l=-.5,h=-.5;break;case"bottom-right":l=.5,h=.5;break;case"bottom-left":l=-.5,h=.5}return a+=l*s,D+=h*o,{x:a,y:D}},t.calculateMaxRadius=function(t,e,n,r){const{x:u,y:i}=e,s=
|
|
120
|
+
*/,t.bootstrapEstimate=function(t,e,n){if(!t.length||t.some((t=>!Number.isFinite(t)))||!Number.isInteger(n.resamples)||n.resamples<1||!Number.isInteger(n.seed)||n.seed<0||n.seed>4294967295)throw new RangeError("bootstrap requires finite observations, positive resamples and a uint32 seed");const r=ht(n.seed),u=new Array(t.length),i=new Array(n.resamples);for(let s=0;s<n.resamples;s++){for(let e=0;e<u.length;e++)u[e]=t[Math.floor(r()*t.length)];const n=e(u);if(!Number.isFinite(n))throw new RangeError("bootstrap estimator must return a finite number");i[s]=n}return i},t.calculateAnchorOfArc=(t,e)=>{const{startAngle:n,endAngle:r,innerRadius:u,outerRadius:i}=t;let s=(n+r)/2,o=(u+i)/2;switch(e){case"inner-start":s=n,o=u;break;case"outer-start":s=n,o=i;break;case"inner-end":s=r,o=u;break;case"outer-end":s=r,o=i;break;case"inner-middle":o=u;break;case"outer-middle":o=i}return{angle:s,radius:o}},t.calculateAnchorOfBounds=(t,e)=>{const{x1:n,x2:r,y1:u,y2:i}=t,s=Math.abs(r-n),o=Math.abs(i-u);let a=(n+r)/2,D=(u+i)/2,l=0,h=0;switch(e){case"top":case"inside-top":h=-.5;break;case"bottom":case"inside-bottom":h=.5;break;case"left":case"inside-left":l=-.5;break;case"right":case"inside-right":l=.5;break;case"top-right":l=.5,h=-.5;break;case"top-left":l=-.5,h=-.5;break;case"bottom-right":l=.5,h=.5;break;case"bottom-left":l=-.5,h=.5}return a+=l*s,D+=h*o,{x:a,y:D}},t.calculateMaxRadius=function(t,e,n,r){const{x:u,y:i}=e,s=le(n,r),{width:o,height:a}=t,D=[];return s.forEach((t=>{const e=Math.sin(t),n=Math.cos(t);1===e?D.push(a-i):-1===e?D.push(i):1===n?D.push(o-u):-1===n?D.push(u):(e>0?D.push(Math.abs((a-i)/e)):D.push(Math.abs(i/e)),n>0?D.push(Math.abs((o-u)/n)):D.push(Math.abs(u/n)))})),Math.min.apply(null,D)},t.cartesianToPolar=function(t,e={x:0,y:0},n=0,r=2*Math.PI){const{x:u,y:i}=t,{x:s,y:o}=e;let a=u-s,D=i-o;const l=Math.sqrt(a*a+D*D);if(0===l)return{radius:0,angle:0};a/=l,D/=l;let h=Math.atan2(D,a);if(h<n)for(;h<=n;)h+=2*Math.PI;if(h>r)for(;h>=r;)h-=2*Math.PI;return{radius:l,angle:h}},t.circleArea=kr,t.circleCircleIntersection=Ir,t.circleOverlap=function(t,e,n){if(n>=t+e)return 0;if(n<=Math.abs(t-e))return Math.PI*Math.min(t,e)*Math.min(t,e);const r=e-(n*n-t*t+e*e)/(2*n);return kr(t,t-(n*n-e*e+t*t)/(2*n))+kr(e,r)},t.clamp=tt,t.clampAngleByDegree=ae,t.clampAngleByRadian=se,t.clampDegree=oe,t.clampRadian=ie,t.clampRange=(t,e,n)=>{let[r,u]=t;u<r&&(r=t[1],u=t[0]);const i=u-r;return i>=n-e?[e,n]:(r=Math.min(Math.max(r,e),n-i),[r,r+i])},t.clamper=function(t,e){let n;return t>e&&(n=t,t=e,e=n),n=>Math.max(t,Math.min(e,n))},t.clone=function(t,e=!1,n=0,r=void 0){const u=[],i=[];return void 0===e&&(e=!0),void 0===n&&(n=1/0),function t(n,s){if(null===n)return null;if(0===s)return n;let o;if("object"!=typeof n)return n;if(f(n)?o=[]:p(n)?(o=new RegExp(n.source,function(t){let e="";return t.global&&(e+="g"),t.ignoreCase&&(e+="i"),t.multiline&&(e+="m"),e}(n)),n.lastIndex&&(o.lastIndex=n.lastIndex)):o=d(n)?new Date(n.getTime()):void 0===r?Object.create(Object.getPrototypeOf(n)):Object.create(r),e){const t=u.indexOf(n);if(-1!==t)return i[t];u.push(n),i.push(o)}for(const e in n)o[e]=t(n[e],s-1);return o}(t,n)},t.cloneDeep=function t(e,n,r){let u;if(!a(e)||"object"!=typeof e||n&&n(e))return e;const s=f(e),o=e.length;u=s?new Array(o):"object"==typeof e?{}:i(e)||m(e)||c(e)?e:d(e)?new Date(+e):void 0;const D=s?void 0:Object.keys(Object(e));let l=-1;if(u)for(;++l<(D||e).length;){const i=D?D[l]:l,s=e[i];r&&r.includes(i.toString())?u[i]=s:u[i]=t(s,n,r)}return u},t.computeQuadrant=function(t){return(t=De(t))>0&&t<=Math.PI/2?2:t>Math.PI/2&&t<=Math.PI?3:t>Math.PI&&t<=3*Math.PI/2?4:1},t.conjugateGradient=function(t,e,n){let r={x:e.slice(),fx:0,fxprime:e.slice()},u={x:e.slice(),fx:0,fxprime:e.slice()};const i=e.slice();let s,o=1;const a=(n=n||{}).maxIterations||20*e.length;r.fx=t(r.x,r.fxprime);const D=r.fxprime.slice();Jr(D,r.fxprime,-1);for(let e=0;e<a;++e){if(o=Kr(t,D,r,u,o),n.history&&n.history.push({x:r.x.slice(),fx:r.fx,fxprime:r.fxprime.slice(),alpha:o}),o){Qr(i,1,u.fxprime,-1,r.fxprime);const t=Zt(r.fxprime,r.fxprime);Qr(D,Math.max(0,Zt(i,u.fxprime)/t),D,-1,u.fxprime),s=r,r=u,u=s}else Jr(D,r.fxprime,-1);if(Zr(r.fxprime)<=1e-5)break}return n.history&&n.history.push({x:r.x.slice(),fx:r.fx,fxprime:r.fxprime.slice(),alpha:o}),r},t.constant=t=>s(t)?t:()=>t,t.containedInCircles=Lr,t.correlation=function(t,e,n="pearson"){if(t.length!==e.length||!["pearson","spearman","kendall"].includes(n)||t.some((t=>!Number.isFinite(t)))||e.some((t=>!Number.isFinite(t))))throw new RangeError("correlation requires equal finite arrays and a supported method");if(!(t.length<2))return"kendall"===n?function(t,e){const n=t.map(((t,n)=>({x:t,y:e[n]}))).sort(((t,e)=>t.x-e.x||t.y-e.y)),r=[...e].sort(((t,e)=>t-e)),u=new Map;let i=0;for(let t=0;t<r.length;){let e=t+1;for(;e<r.length&&r[e]===r[t];)e++;i+=(e-t)*(e-t-1)/2,u.set(r[t],u.size+1),t=e}const s=new Float64Array(u.size+1);let o=0,a=0,D=0;for(let t=0;t<n.length;){let e=t+1;for(;e<n.length&&n[e].x===n[t].x;)e++;o+=(e-t)*(e-t-1)/2;for(let r=t;r<e;){let t=r+1;for(;t<e&&n[t].y===n[r].y;)t++;a+=(t-r)*(t-r-1)/2,r=t}for(let r=t;r<e;r++){let e=0;for(let t=u.get(n[r].y);t>0;t-=t&-t)e+=s[t];D+=t-e}for(let r=t;r<e;r++)for(let t=u.get(n[r].y);t<s.length;t+=t&-t)s[t]++;t=e}const l=t.length*(t.length-1)/2;if(l!==o&&l!==i)return(l-o-i+a-2*D)/Math.sqrt((l-o)*(l-i))}(t,e):"spearman"===n?_t(Nt(t),Nt(e)):_t(t,e)},t.cos=jt,t.crossProduct=$t,t.crossProductPoint=Xt,t.dateGetterName=En,t.dateSetterName=function(t){return t?"setUTCDate":"setDate"},t.dayCount=Xn,t.dayField=Zn,t.dayFloor=Vn,t.dayOffset=$n,t.debounce=nt,t.defaults=N,t.degreeToRadian=re,t.destination=function(t,e,n,r={}){const u=re(t[0]),i=re(t[1]),s=re(n),o=function(t,e){void 0===e&&(e="kilometers");var n=_r[e];if(!n)throw new Error(e+" units is invalid");return t/n}(e,r.units),a=Math.asin(Math.sin(i)*Math.cos(o)+Math.cos(i)*Math.sin(o)*Math.cos(s));return{x:ue(u+Math.atan2(Math.sin(s)*Math.sin(o)*Math.cos(i),Math.cos(o)-Math.sin(i)*Math.sin(a))),y:ue(a)}},t.deviation=function(t,e){const n=z(t,e);return n?Math.sqrt(n):n},t.dotProduct=Zt,t.eastAsianCharacterInfo=Xe,t.ecdf=function(t){const e=t.length,n=t.slice().sort(((t,e)=>t-e));function r(t){if(0===e)return 0;let r=0,u=e;for(;r<u;){const e=r+u>>>1;n[e]<=t?r=e+1:u=e}return r/e}return{evaluate:function(t){if(Array.isArray(t)){const e=[];for(let n=0;n<t.length;n++)e.push(r(t[n]));return e}return r(t)},evaluateGrid:function(t){const u=[];if(t<=0)return u;if(0===e)return u;const i=n[0],s=n[e-1];if(i===s){for(let e=0;e<t;e++)u.push({x:i,y:1});return u}const o=(s-i)/(t-1);for(let e=0;e<t;e++){const n=e===t-1?s:i+o*e;u.push({x:n,y:r(n)})}return u},n:e}},t.epanechnikov=t=>Math.abs(t)<=1?.75*(1-t*t):0,t.epsilon=kt,t.exponent=Vr,t.extent=(t,e)=>{const n=s(e)?e:t=>t;let r,u;if(t&&t.length){const e=t.length;for(let i=0;i<e;i+=1){let e=n(t[i]);o(e)||!m(e=+e)||Number.isNaN(e)||(o(r)?(r=e,u=e):(r=Math.min(r,e),u=Math.max(u,e)))}return[r,u]}return[r,u]},t.fakeRandom=()=>{let t=-1;const e=[0,.1,.2,.3,.4,.5,.6,.7,.8,.9];return()=>(t=(t+1)%e.length,e[t])},t.field=(t,e={})=>{if(f(t)){const n=t.map((t=>ft(t,e)));return t=>n.map((e=>e(t)))}return ft(t,e)},t.findBoundaryAngles=le,t.findZeroOfFunction=function(t,e,n,r){var u,i;const s=null!==(u=null==r?void 0:r.maxIterations)&&void 0!==u?u:100,o=null!==(i=null==r?void 0:r.tolerance)&&void 0!==i?i:1e-10,a=t(e),D=t(n);let l=n-e;if(a*D>0){return q.getInstance().error("Initial bisect points must have opposite signs"),NaN}if(0===a)return e;if(0===D)return n;for(let n=0;n<s;++n){l/=2;const n=e+l,r=t(n);if(r*a>=0&&(e=n),Math.abs(l)<o||0===r)return n}return e+l},t.fixPrecision=Qt,t.flattenArray=function t(e){if(!f(e))return[e];const n=[];for(const r of e)n.push(...t(r));return n},t.formatNumerals=$r,t.formatSpecifier=Wr,t.formatTypes=Gr,t.fullYearGetterName=xn,t.fullYearSetterName=function(t){return t?"setUTCFullYear":"setFullYear"},t.fuzzyEqualNumber=function(t,e){return Pt(t-e)<kt},t.fuzzyEqualVec=Jt,t.gaussian=At,t.gemv=function(t,e,n){for(let r=0;r<t.length;++r)t[r]=Zt(e[r],n)}
|
|
121
121
|
/* Adapted from fmin by Ben Frederickson
|
|
122
122
|
* https://github.com/benfred/fmin
|
|
123
123
|
* Licensed under the BSD-3-Clause
|
|
@@ -125,4 +125,4 @@ function Qr(t,e,n,r,u,i,s){const o=n.fx,a=Xt(n.fxprime,e);let D=o,l=o,h=a,c=0;fu
|
|
|
125
125
|
* url: https://github.com/benfred/fmin/blob/master/src/nelderMead.js
|
|
126
126
|
* License: https://github.com/benfred/fmin/blob/master/LICENSE
|
|
127
127
|
* @license
|
|
128
|
-
*/,t.generateCeil=br,t.generateCount=Br,t.generateStepInterval=(t,{floor:e,offset:n,field:r,count:u})=>{const i=Math.floor(t);if(!Number.isFinite(i)||i<=0)return null;if(i<=1)return{floor:e,offset:n,ceil:br(e,n)};const s=Br(e,u),o=r?t=>r(t)%i==0:t=>s(0,t)%i==0,a=t=>{if(!Number.isNaN(+t))for(e(t);!o(t);)t.setTime(+t-1),e(t);return t},D=(t,e)=>{if(!Number.isNaN(+t))if(i<0)for(;++e<=0;)for(n(t,-1);!o(t);)n(t,-1);else for(;--e>=0;)for(n(t,1);!o(t);)n(t,1);return t};return{floor:a,offset:D,ceil:br(a,D)}},t.get=C,t.getAABBFromPoints=function(t){return xe=1/0,Ce=1/0,Ee=-1/0,Me=-1/0,t.forEach((t=>{xe>t.x&&(xe=t.x),Ee<t.x&&(Ee=t.x),Ce>t.y&&(Ce=t.y),Me<t.y&&(Me=t.y)})),{x1:xe,y1:Ce,x2:Ee,y2:Me}},t.getAngleByPoint=function(t,e){return Math.atan2(e.y-t.y,e.x-t.x)},t.getCenter=Ir,t.getContainerSize=function(t,e=0,n=0){if(!t)return{width:e,height:n};let r;try{r=null===window||void 0===window?void 0:window.getComputedStyle}catch(t){r=()=>({})}const u=r(t);if(/^(\d*\.?\d+)(px)$/.exec(u.width)){const r=parseFloat(u.width)-parseFloat(u.paddingLeft)-parseFloat(u.paddingRight)||t.clientWidth-1,i=parseFloat(u.height)-parseFloat(u.paddingTop)-parseFloat(u.paddingBottom)||t.clientHeight-1;return{width:r<=0?e:r,height:i<=0?n:i}}return{width:e,height:n}},t.getContextFont=Ze,t.getDecimalPlaces=Qt,t.getElementAbsolutePosition=vr,t.getElementRelativePosition=function(t,e){const n=vr(t),r=vr(e);return{x:n.x-r.x,y:n.y-r.y}},t.getFormatFromValue=function(t,e){const n=ot(t),r=n[xn(e)]()+1,u=n[Cn(e)](),i=n[En(e)](),s=n[Mn(e)](),o=n[bn(e)](),a=0===n[Bn(e)](),D=a&&0===o,l=D&&0===s,h=l&&0===i,c=h&&1===u;return c&&1===r?"YYYY":c?"YYYY-MM":h?"YYYY-MM-DD":l?"HH":D?"HH:mm":a?"HH:mm:ss":"HH:mm:ss SSS"},t.getIntersectPoint=function(t,e,n,r){if(!he(t,e,n,r))return!1;const u=[0,0],i=[0,0],s=[0,0];if(le(u,e,t),le(i,r,n),Zt(u,i))return!0;le(s,n,t);const o=Vt(s,i)/Vt(u,i);return o>=0&&o<=1&&[t[0]+u[0]*o,t[1]+u[1]*o]},t.getIntervalOptions=(t,e)=>"year"===t&&e?{floor:kn,offset:In,count:Un,field:Rn}:"month"===t&&e?{floor:Wn,offset:zn,count:jn,field:Yn}:"day"===t&&e?{floor:Zn,offset:Jn,count:Qn,field:Kn}:"hour"===t&&e?{floor:ur,offset:ir,count:nr,field:sr}:"minute"===t&&e?{floor:hr,offset:cr,count:Dr,field:fr}:"second"===t&&e?{floor:pr,offset:yr,count:mr,field:xr}:"year"===t?{floor:Tn,offset:_n,count:Nn,field:Ln}:"month"===t?{floor:On,offset:Pn,count:Hn,field:qn}:"day"===t?{floor:Gn,offset:Vn,count:$n,field:Xn}:"hour"===t?{floor:tr,offset:er,count:nr,field:rr}:"minute"===t?{floor:or,offset:ar,count:Dr,field:lr}:"second"===t?{floor:Fr,offset:dr,count:mr,field:gr}:{floor:Cr,offset:Er,count:Mr},t.getOBBFromLine=function(t,e,n){return be=e.x-t.x,Be=e.y-t.y,ve=Be,we=-be,Te=Ae=Math.sqrt(ve*ve+we*we),_e=n,ve/=Ae,we/=Ae,Se=n/2,be=Se*ve,Be=Se*we,{point1:{x:t.x+be,y:t.y+Be},point2:{x:t.x-be,y:t.y-Be},point3:{x:e.x+be,y:e.y+Be},point4:{x:e.x-be,y:e.y-Be},width:Te,height:_e,left:Math.min(t.x,e.x)-Math.abs(be),top:Math.min(t.y,e.y)-Math.abs(Be)}},t.getRectIntersect=function(t,e,n){if(null===t)return e;if(null===e)return t;const{x11:r,x12:u,y11:i,y12:s,x21:o,x22:a,y21:D,y22:l}=fe(t,e,n);return r>=a||u<=o||i>=l||s<=D?{x1:0,y1:0,x2:0,y2:0}:{x1:Math.max(r,o),y1:Math.max(i,D),x2:Math.min(u,a),y2:Math.min(s,l)}},t.getScale=t=>t.offsetWidth>0?wr(t):Ar(t),t.getScaleX=wr,t.getScaleY=Ar,t.getScrollLeft=t=>{var e,n,r;return t===(null===(e=null===globalThis||void 0===globalThis?void 0:globalThis.document)||void 0===e?void 0:e.body)?(null===(r=null===(n=null===globalThis||void 0===globalThis?void 0:globalThis.document)||void 0===n?void 0:n.documentElement)||void 0===r?void 0:r.scrollLeft)||t.scrollLeft:"html"===t.tagName.toLowerCase()?0:t.scrollLeft},t.getScrollTop=t=>{var e,n,r;return t===(null===(e=null===globalThis||void 0===globalThis?void 0:globalThis.document)||void 0===e?void 0:e.body)?(null===(r=null===(n=null===globalThis||void 0===globalThis?void 0:globalThis.document)||void 0===n?void 0:n.documentElement)||void 0===r?void 0:r.scrollTop)||t.scrollTop:"html"===t.tagName.toLowerCase()?0:t.scrollTop},t.getTimeFormatter=function(t,e){return n=>{const r=ot(n),u=r[yn(e)](),i=r[xn(e)]()+1,s=Math.floor((i-1)/3)+1,o=r[Cn(e)](),a=r["get"+(e?"UTC":"")+"Day"](),D=r[En(e)](),l=(D-1)%12+1,h=r[Mn(e)](),c=r[bn(e)](),f=r[Bn(e)]();return(t||"").replace(/YYYY/g,K(u+"",4,"0","left")).replace(/yyyy/g,u+"").replace(/yy/g,u%100+"").replace(/Q/g,s+"").replace(/MM/g,K(i,2,"0","left")).replace(/M/g,i+"").replace(/dd/g,K(o,2,"0","left")).replace(/d/g,o+"").replace(/e/g,a+"").replace(/HH/g,K(D,2,"0","left")).replace(/H/g,D+"").replace(/hh/g,K(l+"",2,"0","left")).replace(/h/g,l+"").replace(/mm/g,K(h,2,"0","left")).replace(/m/g,h+"").replace(/ss/g,K(c,2,"0","left")).replace(/s/g,c+"").replace(/SSS/g,K(f,3,"0","left")).replace(/S/g,f+"")}},t.getter=ct,t.halfPi=It,t.has=(t,e)=>null!=t&&E.call(t,e),t.hasParentElement=function(t,e){let n=t.parentNode;for(;null!==n;){if(n===e)return!0;n=n.parentNode}return!1},t.hexToRgb=dn,t.hourCount=nr,t.hourField=rr,t.hourFloor=tr,t.hourOffset=er,t.hoursGetterName=En,t.hoursSetterName=function(t){return t?"setUTCHours":"setHours"},t.hslToRgb=nn,t.interpolateDate=function(t,e){const n=t.valueOf(),r=e.valueOf(),u=new Date;return t=>(u.setTime(n*(1-t)+r*t),u)},t.interpolateNumber=rt,t.interpolateNumberRound=function(t,e){return function(n){return Math.round(t*(1-n)+e*n)}},t.interpolateRgb=gn,t.interpolateString=function(t,e){let n,r,u,i=ut.lastIndex=it.lastIndex=0,s=-1;const o=[],a=[];for(t+="",e+="";(n=ut.exec(t))&&(r=it.exec(e));)(u=r.index)>i&&(u=e.slice(i,u),o[s]?o[s]+=u:o[++s]=u),(n=n[0])===(r=r[0])?o[s]?o[s]+=r:o[++s]=r:(o[++s]=null,a.push({i:s,x:rt(n,r)})),i=it.lastIndex;return i<e.length&&(u=e.slice(i),o[s]?o[s]+=u:o[++s]=u),o.length<2?a[0]?function(t){return function(e){return t(e)+""}}(a[0].x):function(t){return function(){return t}}(e):(e=a.length,function(t){for(let n,r=0;r<e;++r)o[(n=a[r]).i]=n.x(t);return o.join("")})},t.intersectionArea=function(t,e){const n=function(t){const e=[];for(let n=0;n<t.length;++n)for(let r=n+1;r<t.length;++r){const u=kr(t[n],t[r]);for(let t=0;t<u.length;++t){const i=u[t];i.parentIndex=[n,r],e.push(i)}}return e}(t),r=n.filter((function(e){return Nr(e,t)}));let u=0,i=0;const s=[];if(r.length>1){const e=Ir(r);for(let t=0;t<r.length;++t){const n=r[t];n.angle=Math.atan2(n.x-e.x,n.y-e.y)}r.sort((function(t,e){return e.angle-t.angle}));let n=r[r.length-1];for(let e=0;e<r.length;++e){const o=r[e];i+=(n.x+o.x)*(o.y-n.y);const a={x:(o.x+n.x)/2,y:(o.y+n.y)/2};let D=null;for(let e=0;e<o.parentIndex.length;++e)if(n.parentIndex.indexOf(o.parentIndex[e])>-1){const r=t[o.parentIndex[e]],u=Math.atan2(o.x-r.x,o.y-r.y),i=Math.atan2(n.x-r.x,n.y-r.y);let s=i-u;s<0&&(s+=2*Math.PI);const l=i-s/2;let h=te.distancePP(a,{x:r.x+r.radius*Math.sin(l),y:r.y+r.radius*Math.cos(l)});h>2*r.radius&&(h=2*r.radius),(null===D||D.width>h)&&(D={circle:r,width:h,p1:o,p2:n})}null!==D&&(s.push(D),u+=Lr(D.circle.radius,D.width),n=o)}}else{let e=t[0];for(let n=1;n<t.length;++n)t[n].radius<e.radius&&(e=t[n]);let n=!1;for(let r=0;r<t.length;++r)if(te.distancePP(t[r],e)>Math.abs(e.radius-t[r].radius)){n=!0;break}n?u=i=0:(u=e.radius*e.radius*Math.PI,s.push({circle:e,p1:{x:e.x,y:e.y+e.radius},p2:{x:e.x-_r,y:e.y+e.radius},width:2*e.radius}))}return i/=2,e&&(e.area=u+i,e.arcArea=u,e.polygonArea=i,e.arcs=s,e.innerPoints=r,e.intersectionPoints=n),u+i},t.isArray=f,t.isArrayLike=F,t.isBase64=t=>new RegExp(/^data:image\/(?:gif|png|jpeg|bmp|webp|svg\+xml)(?:;charset=utf-8)?;base64,(?:[A-Za-z0-9]|[+/])+={0,2}/g).test(t),t.isBoolean=i,t.isDate=d,t.isEmpty=function(t){if(o(t))return!0;if(F(t))return!t.length;const e=(t=>({}.toString.call(t).replace(/^\[object /,"").replace(/]$/,"")))(t);if("Map"===e||"Set"===e)return!t.size;if(function(t){const e=t&&t.constructor;return t===("function"==typeof e&&e.prototype||y)}(t))return!Object.keys(t).length;for(const e in t)if(x.call(t,e))return!1;return!0},t.isEqual=function t(e,n,r){if(e===n)return!0;if(typeof e!=typeof n)return!1;if(null==e||null==n)return!1;if(Number.isNaN(e)&&Number.isNaN(n))return!0;if(w(e)!==w(n))return!1;if(s(e))return!!(null==r?void 0:r.skipFunction);if("object"!=typeof e)return!1;if(f(e)){if(e.length!==n.length)return!1;for(let u=e.length-1;u>=0;u--)if(!t(e[u],n[u],r))return!1;return!0}if(!h(e))return!1;const u=A(e),i=A(n);if(u.length!==i.length)return!1;u.sort(),i.sort();for(let t=u.length-1;t>=0;t--)if(u[t]!=i[t])return!1;for(let i=u.length-1;i>=0;i--){const s=u[i];if(!t(e[s],n[s],r))return!1}return!0},t.isFunction=s,t.isGreater=function(t,e,n,r){return t>e&&!J(t,e,n,r)},t.isHTMLElement=function(t){try{return t instanceof Element}catch(e){const n=["children","innerHTML","classList","setAttribute","tagName","getBoundingClientRect"],r=Object.keys(t);return n.every((t=>r.includes(t)))}},t.isIntersect=he,t.isLess=function(t,e,n,r){return t<e&&!J(t,e,n,r)},t.isNil=o,t.isNull=t=>null===t,t.isNumber=m,t.isNumberClose=J,t.isNumeric=t=>"string"==typeof t&&(!isNaN(Number(t))&&!isNaN(parseFloat(t))),t.isObject=D,t.isObjectLike=l,t.isPlainObject=h,t.isPointInLine=je,t.isPointInPolygon=function(t,e){if(!t)return!1;if(!e)return!1;const n="Feature"===(r=e).type?r.geometry:r;var r;const u=n.type,i=e.bbox;let s=n.coordinates;if(i&&!0===Fe(t,{x1:i[0],x2:i[1],y1:i[1],y2:i[3]},!0))return!1;"Polygon"===u&&(s=[s]);let o=!1;for(let e=0;e<s.length;++e)for(let n=0;n<s[e].length;++n){if(ze(s[e][n].map((t=>({x:t[0],y:t[1]}))),t.x,t.y))return o=!0,o}return o},t.isRectIntersect=function(t,e,n){if(t&&e){if(!n)return!(t.x1>e.x2||t.x2<e.x1||t.y1>e.y2||t.y2<e.y1);const{x11:r,x12:u,y11:i,y12:s,x21:o,x22:a,y21:D,y22:l}=fe(t,e,!0);return!(r>a||u<o||i>l||s<D)}return!0},t.isRegExp=p,t.isRotateAABBIntersect=ye,t.isShallowEqual=function(t,e){if(S(t,e))return!0;if("object"!=typeof t||null===t||"object"!=typeof e||null===e)return!1;if(f(t)!==f(e))return!1;if(T(t)!==T(e))return!1;let n=!0;return Object.keys(t).forEach((r=>!!S(t[r],e[r])||(n=!1,n))),n},t.isString=c,t.isType=u,t.isUndefined=t=>void 0===t,t.isValid=a,t.isValidNumber=g,t.isValidUrl=t=>new RegExp(/^(http(s)?:\/\/)\w+[^\s]+(\.[^\s]+){1,}$/).test(t),t.kde=function(t,e={}){const n=t.length,r=e.kernel||wt;let u=e.bandwidth;if(!u||u<=0){const r=function(t){const e=t.length;if(0===e)return 0;let n=0;for(let r=0;r<e;r++)n+=t[r];n/=e;let r=0;for(let u=0;u<e;u++){const e=t[u]-n;r+=e*e}return Math.sqrt(r/e)}(t)||0,i=e.bandwidthMethod||"scott";u="silverman"===i?St(n,r,1):At(n,r,1)}if(!u||u<=0){const e=e=>{const r=[];if(e<=0)return r;let u=1/0,i=-1/0;for(let e=0;e<n;e++){const n=t[e];n<u&&(u=n),n>i&&(i=n)}if(u===1/0||i===-1/0){for(let t=0;t<e;t++)r.push({x:0,y:0});return r}for(let t=0;t<e;t++)r.push({x:u,y:0});return r};return{bandwidth:0,kernel:r,evaluate:t=>{if(Array.isArray(t)){const e=[];for(let n=0;n<t.length;n++)e.push(0);return e}return 0},evaluateGrid:e}}const i=1/(n*u);function s(e){let s=0;for(let i=0;i<n;i++)s+=r((e-t[i])/u);return s*i}return{bandwidth:u,kernel:r,evaluate:function(t){if(Array.isArray(t)){const e=[];for(let n=0;n<t.length;n++)e.push(s(t[n]));return e}return s(t)},evaluateGrid(e){const r=[];if(e<=0)return r;let u=1/0,i=-1/0;for(let e=0;e<n;e++){const n=t[e];n<u&&(u=n),n>i&&(i=n)}if(u===1/0||i===-1/0)return r;if(u===i){for(let t=0;t<e;t++)r.push({x:u,y:s(u)});return r}const o=(i-u)/(e-1);for(let t=0;t<e;t++){const n=t===e-1?i:u+o*t;r.push({x:n,y:s(n)})}return r}}},t.keys=_,t.last=k,t.lengthFromPointToLine=Gt,t.lineIntersectPolygon=We,t.lowerCamelCaseToMiddle=t=>t.replace(/([A-Z])/g,"-$1").toLowerCase(),t.lowerFirst=function(t){return t.charAt(0).toLowerCase()+t.substring(1)},t.max=qt,t.maxInArray=(t,e)=>{var n;if(0===t.length)return;let r=t[0];for(let u=1;u<t.length;u++){const i=t[u];(null!==(n=null==e?void 0:e(i,r))&&void 0!==n?n:i-r)>0&&(r=i)}return r},t.mean=function(t){if(!t.length)return;let e=0;for(const n of t){if(!Number.isFinite(n))throw new RangeError("mean requires finite numbers");e=Math.max(e,Math.abs(n))}if(0===e)return 0;let n=0,r=0;for(const u of t){const t=u/e,i=n+t;r+=Math.abs(n)>=Math.abs(t)?n-i+t:t-i+n,n=i}return(n+r)/t.length*e},t.median=Y,t.memoize=t=>{let e=null,n=null;return(...r)=>(e&&r.every(((t,n)=>t===e[n]))||(e=r,n=t(...r)),n)},t.merge=function(t,...e){let n=-1;const r=e.length;for(;++n<r;){M(t,e[n],!0)}return t},t.mergeAABB=function(t){const e=[];return function t(n,r){const u=[];r.forEach((t=>{let e;(e=Ne(n,t)).length>1?u.push(t):n=e[0]})),e.push(n),u.length&&t(u[0],u.slice(1))}(t[0],t.slice(1)),e},t.millisecondsCount=Mr,t.millisecondsFloor=Cr,t.millisecondsGetterName=Bn,t.millisecondsOffset=Er,t.millisecondsSetterName=function(t){return t?"setUTCMilliseconds":"setMilliseconds"},t.min=Wt,t.minInArray=(t,e)=>{var n;if(0===t.length)return;let r=t[0];for(let u=1;u<t.length;u++){const i=t[u];(null!==(n=null==e?void 0:e(i,r))&&void 0!==n?n:i-r)<0&&(r=i)}return r},t.minuteCount=Dr,t.minuteField=lr,t.minuteFloor=or,t.minuteOffset=ar,t.minutesGetterName=Mn,t.minutesSetterName=function(t){return t?"setUTCMinutes":"setMinutes"},t.mixin=function(t,e,n=!0){if(t="prototype"in t?t.prototype:t,e="prototype"in e?e.prototype:e,Object.getOwnPropertyNames){const r=Object.getOwnPropertyNames(e);for(let u=0;u<r.length;u++){const i=r[u];"constructor"!==i&&(n?null!=e[i]:null==t[i])&&(t[i]=e[i])}}else N(t,e,n)},t.monthCount=Hn,t.monthField=qn,t.monthFloor=On,t.monthGetterName=xn,t.monthOffset=Pn,t.monthSetterName=function(t){return t?"setUTCMonth":"setMonth"},t.nelderMead=function(t,e,n){const r=(n=n||{}).maxIterations||200*e.length,u=n.nonZeroDelta||1.05,i=n.zeroDelta||.001,s=n.minErrorDelta||1e-6,o=n.minErrorDelta||1e-5,a=void 0!==n.rho?n.rho:1,D=void 0!==n.chi?n.chi:2,l=void 0!==n.psi?n.psi:-.5,h=void 0!==n.sigma?n.sigma:.5;let c;const f=e.length,F=new Array(f+1);F[0]=e,F[0].fx=t(e),F[0].id=0;for(let n=0;n<f;++n){const r=e.slice();r[n]=r[n]?r[n]*u:i,F[n+1]=r,F[n+1].fx=t(r),F[n+1].id=n+1}function d(t){for(let e=0;e<t.length;e++)F[f][e]=t[e];F[f].fx=t.fx}const m=function(t,e){return t.fx-e.fx},g=e.slice(),p=e.slice(),y=e.slice(),x=e.slice();for(let e=0;e<r;++e){if(F.sort(m),n.history){const t=F.map((function(t){const e=t.slice();return e.fx=t.fx,e.id=t.id,e}));t.sort((function(t,e){return t.id-e.id})),n.history.push({x:F[0].slice(),fx:F[0].fx,simplex:t})}c=0;for(let t=0;t<f;++t)c=Math.max(c,Math.abs(F[0][t]-F[1][t]));if(Math.abs(F[0].fx-F[f].fx)<s&&c<o)break;for(let t=0;t<f;++t){g[t]=0;for(let e=0;e<f;++e)g[t]+=F[e][t];g[t]/=f}const e=F[f];if(Jr(p,1+a,g,-a,e),p.fx=t(p),p.fx<F[0].fx)Jr(x,1+D,g,-D,e),x.fx=t(x),x.fx<p.fx?d(x):d(p);else if(p.fx>=F[f-1].fx){let n=!1;if(p.fx>e.fx?(Jr(y,1+l,g,-l,e),y.fx=t(y),y.fx<e.fx?d(y):n=!0):(Jr(y,1-l*a,g,l*a,e),y.fx=t(y),y.fx<p.fx?d(y):n=!0),n){if(h>=1)break;for(let e=1;e<F.length;++e)Jr(F[e],1-h,F[0],h,F[e]),F[e].fx=t(F[e])}}else d(p)}return F.sort(m),{fx:F[0].fx,x:F[0]}},t.norm2=Xr,t.normalQuantile=O,t.normalTransform=function(t,e,n,r,u,i,s,o){const a=e.a,D=e.b,l=e.c,h=e.d,c=e.e,f=e.f,F=Ht(s),d=zt(s);let m,g;o?(m=o[0],g=o[1]):(m=n,g=r);const p=m-n,y=g-r,x=a*F+l*d,C=D*F+h*d,E=l*F-a*d,M=h*F-D*d;t.a=u*x,t.b=u*C,t.c=i*E,t.d=i*M,t.e=c+a*m+l*g-x*p-E*y,t.f=f+D*m+h*g-C*p-M*y},t.normalizeAngle=ae,t.normalizePadding=function(t){if(g(t))return[t,t,t,t];if(f(t)){const e=t.length;if(1===e){const e=t[0];return[e,e,e,e]}if(2===e){const[e,n]=t;return[e,n,e,n]}if(3===e){const[e,n,r]=t;return[e,n,r,n]}if(4===e)return t}if(D(t)){const{top:e=0,right:n=0,bottom:r=0,left:u=0}=t;return[e,n,r,u]}return[0,0,0,0]},t.numberSpecifierReg=qr,t.obbSeparation=(t,e)=>{const n=[{x:Math.cos(t.angle),y:Math.sin(t.angle)},{x:-Math.sin(t.angle),y:Math.cos(t.angle)},{x:Math.cos(e.angle),y:Math.sin(t.angle)},{x:-Math.sin(e.angle),y:Math.cos(t.angle)}];function r(t,e,n){const r=t.getRotatedCorners().map((t=>t.x*e+t.y*n));return{min:Math.min(...r),max:Math.max(...r)}}let u=0;for(const i of n){const n=r(t,i.x,i.y),s=r(e,i.x,i.y);let o;o=n.max<s.min?s.min-n.max:s.max<n.min?n.min-s.max:0,u=Math.max(u,o)}return u},t.ordinaryLeastSquares=function(t,e,n,r){const u=r-t*t;if(Math.abs(u)<Number.EPSILON)return{a:e,b:0};const i=(n-t*e)/u;return{a:e-i*t,b:i}},t.pad=K,t.parseUint8ToImageData=(t,e,n)=>{const r=new Uint8ClampedArray(t),u=new Uint8ClampedArray(t.length);for(let t=n-1;t>=0;t--)for(let i=0;i<e;i++){const s=t*e*4+4*i,o=(n-t)*e*4+4*i;u[o]=r[s],u[o+1]=r[s+1],u[o+2]=r[s+2],u[o+3]=r[s+3]}return new ImageData(u,e,n)},t.pi=kt,t.pi2=Rt,t.pick=function(t,e){if(!t||!h(t))return t;const n={};return e.forEach((e=>{v.call(t,e)&&(n[e]=t[e])})),n},t.pickWithout=function(t,e){if(!t||!h(t))return t;const n={};return Object.keys(t).forEach((r=>{const u=t[r];let i=!1;e.forEach((t=>{(c(t)&&t===r||t instanceof RegExp&&r.match(t))&&(i=!0)})),i||(n[r]=u)})),n},t.pointAt=function(t,e,n,r,u){let i=n,s=r;return"number"==typeof t&&"number"==typeof n&&(i=(1-u)*t+u*n),"number"==typeof e&&"number"==typeof r&&(s=(1-u)*e+u*r),{x:i,y:s}},t.pointBetweenLine=Pe,t.pointInAABB=function(t,e){return Fe(t,e,!1)},t.pointInLine=Ie,t.pointInOBB=function(t,e){return Le.x=(e.point1.x+e.point2.x)/2,Le.y=(e.point1.y+e.point2.y)/2,ke.x=(e.point3.x+e.point4.x)/2,ke.y=(e.point3.y+e.point4.y)/2,Ie(t,Le,ke,e.height)},t.pointInRect=Fe,t.polarToCartesian=function(t,e,n){return e?{x:t.x+e*Math.cos(n),y:t.y+e*Math.sin(n)}:{x:t.x,y:t.y}},t.polygonContainPoint=ze,t.polygonIntersectPolygon=function(t,e){for(let n=0;n<e.length;n++){if(ze(t,e[n].x,e[n].y))return!0;if(n>0&&We(e[n-1].x,e[n-1].y,e[n].x,e[n].y,t))return!0}return!1},t.pow=Yt,t.precisionAdd=function(t,e){return Jt(t+e,10**Math.max(Qt(t),Qt(e)))},t.precisionSub=function(t,e){return Jt(t-e,10**Math.max(Qt(t),Qt(e)))},t.quantileSorted=R,t.rSquared=vt,t.radianToDegree=re,t.randomLCG=ht,t.range=function(t,e,n){a(e)||(e=t,t=0),a(n)||(n=1);let r=-1;const u=0|Math.max(0,Math.ceil((e-t)/n)),i=new Array(u);for(;++r<u;)i[r]=t+r*n;return i},t.rectInsideAnotherRect=function(e,n,r){if(!e||!n)return t.InnerBBox.NONE;const{x11:u,x12:i,y11:s,y12:o,x21:a,x22:D,y21:l,y22:h}=fe(e,n,r);return u>a&&i<D&&s>l&&o<h?t.InnerBBox.BBOX1:a>u&&D<i&&l>s&&h<o?t.InnerBBox.BBOX2:t.InnerBBox.NONE},t.regressionBootstrap=function(t,e){var n;const r="linear"===e.method?1:null!==(n=e.degree)&&void 0!==n?n:NaN;if("linear"!==e.method&&"polynomial"!==e.method||!Number.isInteger(r)||r<1||!t.length||t.some((t=>!Number.isFinite(t.x)||!Number.isFinite(t.y)))||e.grid.some((t=>!Number.isFinite(t)))||!(e.level>0&&e.level<1)||!Number.isInteger(e.resamples)||e.resamples<1||!Number.isInteger(e.seed)||e.seed<0||e.seed>4294967295)throw new RangeError("Invalid paired regression bootstrap inputs");if(t.length<=r+1)throw new RangeError("Regression bootstrap requires positive residual degrees of freedom");const u=t.slice().sort(((t,e)=>t.x-e.x||t.y-e.y)),i=mt(u);if(gt(u,r,i).rank<r+1)throw new RangeError("Original regression design is rank deficient");const s=ht(e.seed),o=new Array(u.length),a=e.grid.map((()=>new Array(e.resamples)));for(let t=0;t<e.resamples;t++){for(let t=0;t<o.length;t++)o[t]=u[Math.floor(s()*u.length)];const n=gt(o,r,i);for(let r=0;r<e.grid.length;r++){const u=pt(n,e.grid[r]);if(!Number.isFinite(u))throw new RangeError("Regression bootstrap prediction is not finite");a[r][t]=u}}const D=(1-e.level)/2;return e.grid.map(((t,e)=>(a[e].sort(((t,e)=>t-e)),{x:t,lower:R(a[e],D),upper:R(a[e],1-D)})))},t.regressionLinear=function(t,e=(t=>t.x),n=(t=>t.y),r){var u;const i=null!==(u=null==r?void 0:r.alpha)&&void 0!==u?u:.05,s=Ft(t,e,n),o=gt(s,1),a=yt(o),D=a[0],l=a[1],h=t=>pt(o,t),c=Mt(t,e,n,h);let f=0;return s.forEach(((t,e)=>{f+=(t.y-f)/(e+1)})),{coef:{a:D,b:l},rank:o.rank,predict:h,rSquared:vt(t,e,n,f,h),evaluateGrid:function(t){return xt(c.min,c.max,t,h)},confidenceInterval:function(t=50){const e=[];if(0===c.n||t<=0)return e;const n=Ct(i);if(c.min===c.max){const r=h(c.min),u=bt(c.min,c),i=Et(n,u.seMean),s=Et(n,u.sePred);for(let n=0;n<t;n++)e.push({x:c.min,mean:r,lower:r-i,upper:r+i,predLower:r-s,predUpper:r+s});return e}const r=(c.max-c.min)/(t-1);for(let u=0;u<t;u++){const i=u===t-1?c.max:c.min+r*u,s=h(i),o=bt(i,c),a=Et(n,o.seMean),D=Et(n,o.sePred);e.push({x:i,mean:s,lower:s-a,upper:s+a,predLower:s-D,predUpper:s+D})}return e}}},t.regressionLogistic=function(t,e=(t=>t.x),n=(t=>t.y),r){var u,i,s;const o=null!==(u=null==r?void 0:r.maxIteration)&&void 0!==u?u:25,a=null!==(i=null==r?void 0:r.tol)&&void 0!==i?i:1e-6,D=null!==(s=null==r?void 0:r.alpha)&&void 0!==s?s:.05,l=[],h=[];Bt(t,e,n,((t,e)=>{l.push(t),h.push(e?1:0)}));const c=l.length;if(0===c)return{coef:[0,0],predict:t=>0,evaluateGrid:t=>[],confidenceInterval:(t=50)=>[]};let f=0,F=0;for(let t=0;t<o;t++){const t=new Array(c);let e=!0;for(let e=0;e<c;e++){const n=f+F*l[e],r=1/(1+Math.exp(-n));t[e]=r}let n=0,r=0,u=0,i=0,s=0;for(let e=0;e<c;e++){const o=t[e]*(1-t[e]),a=h[e]-t[e];n+=a,r+=a*l[e],u+=o,i+=o*l[e],s+=o*l[e]*l[e]}const o=u*s-i*i;if(Math.abs(o)<1e-12)break;const D=(s*n-i*r)/o,d=(-i*n+u*r)/o;if(f+=D,F+=d,(Math.abs(D)>a||Math.abs(d)>a)&&(e=!1),e)break}const d=t=>{const e=f+F*t;return 1/(1+Math.exp(-e))};return{coef:[f,F],predict:d,evaluateGrid:function(r){const u=[];if(r<=0)return u;let i=1/0,s=-1/0;if(Bt(t,e,n,(t=>{t<i&&(i=t),t>s&&(s=t)})),i===1/0||s===-1/0)return u;if(i===s){const t=d(i);for(let e=0;e<r;e++)u.push({x:i,y:t});return u}const o=(s-i)/(r-1);for(let t=0;t<r;t++){const e=t===r-1?s:i+o*t;u.push({x:e,y:d(e)})}return u},confidenceInterval:function(r=50){const u=[];if(r<=0)return u;const i=Mt(t,e,n,d);if(0===i.n)return u;const s=Ct(D);if(i.min===i.max){const t=d(i.min),e=bt(i.min,i),n=Et(s,e.seMean),o=Et(s,e.sePred);for(let e=0;e<r;e++)u.push({x:i.min,mean:t,lower:t-n,upper:t+n,predLower:t-o,predUpper:t+o});return u}const o=(i.max-i.min)/(r-1);for(let t=0;t<r;t++){const e=t===r-1?i.max:i.min+o*t,n=d(e),a=bt(e,i),D=Et(s,a.seMean),l=Et(s,a.sePred);u.push({x:e,mean:n,lower:n-D,upper:n+D,predLower:n-l,predUpper:n+l})}return u}}},t.regressionLowess=function(t,e=(t=>t.x),n=(t=>t.y),r={}){var u,i,s,o,a;const D=null!==(u=r.span)&&void 0!==u?u:2/3,l=null!==(i=r.degree)&&void 0!==i?i:1,h=null!==(s=r.iterations)&&void 0!==s?s:3,c=null!==(o=r.delta)&&void 0!==o?o:0,f=null!==(a=r.alpha)&&void 0!==a?a:.05;if(!(D>0&&D<=1)||!Number.isInteger(h)||h<0||!Number.isFinite(c)||c<0||0!==l&&1!==l||null!=r.maxSamples&&(!Number.isInteger(r.maxSamples)||r.maxSamples<2))throw new RangeError("Invalid LOWESS span, degree, iterations, delta or maxSamples");let F=Ft(t,e,n).sort(((t,e)=>t.x-e.x||t.y-e.y));if(null!=r.maxSamples&&F.length>r.maxSamples){const t=F,e=r.maxSamples;F=Array.from({length:e},((n,r)=>t[Math.floor(r*(t.length-1)/(e-1))]))}const d=F.length,m=F.map((t=>t.x)),g=F.map((t=>t.y)),p=mt(F),y=m.map((t=>dt(t,p.xCenter,p.xScale))),x=g.map((t=>dt(t,p.yCenter,p.yScale))),C=Math.min(d,Math.max(2,Math.floor(D*d+1e-10)));let E;function M(t){if(!d)return 0;const e=dt(t,p.xCenter,p.xScale);let n=0,r=d-C;for(;n<r;){const u=n+r>>>1,i=t-m[u],s=m[u+C]-t;(Number.isFinite(i)&&Number.isFinite(s)?i>s:e-y[u]>y[u+C]-e)?n=u+1:r=u}let u=n,i=n+C;if(m[u]===m[i-1]){for(;u>0&&m[u-1]===m[u];)u--;for(;i<d&&m[i]===m[u];)i++}const s=Math.max(Math.abs(m[u]-t),Math.abs(m[i-1]-t)),o=!Number.isFinite(s),a=o?Math.max(Math.abs(y[u]-e),Math.abs(y[i-1]-e)):s;let D=1/0,h=-1/0;for(let t=u;t<i;t++)D=Math.min(D,g[t]),h=Math.max(h,g[t]);const c=D/2+h/2,f=Math.max(Math.abs(D-c),Math.abs(h-c))||1;let F=0,x=0,M=0,b=0,B=0;for(let n=u;n<i;n++){const r=0===a?0:(o?y[n]-e:m[n]-t)/a,u=Math.abs(r),i=u>=1?0:1-u*u*u,s=i*i*i*(E?E[n]:1);F+=s,x+=s*r;const D=dt(g[n],c,f);M+=s*D,b+=s*r*r,B+=s*r*D}if(0===F){let n=1/0,r=0,u=0;for(let i=0;i<d;i++){const s=E?E[i]:1;if(0===s)continue;const a=Math.abs(o?y[i]-e:m[i]-t);a<n?(n=a,r=s,u=g[i]):a===n&&(u=u*(r/(r+s))+g[i]*(s/(r+s)),r+=s)}if(0===r)throw new RangeError("LOWESS has no effective local observations");return u}const v=x/F,w=M/F,A=b/F-v*v;return c+f*(w-(0===l||A<=32*Number.EPSILON?0:(B/F-v*w)/A)*v)}const b=[];for(let t=0;t<d&&(b.push(t),t!==d-1);){let e=t+1;if(c>0)for(;e+1<d&&m[e+1]-m[t]<=c;)e++;for(;e+1<d&&m[e+1]===m[e];)e++;t=e}let B=new Array(d);function v(){const t=new Array(d);for(let e=0;e<b.length;e++){const n=b[e];if(t[n]=M(m[n]),0===e)continue;const r=b[e-1],u=m[n]-m[r],i=Number.isFinite(u)?u:y[n]-y[r];for(let e=r+1;e<n;e++){const s=0===i?0:(Number.isFinite(u)?m[e]-m[r]:y[e]-y[r])/i;t[e]=t[r]*(1-s)+t[n]*s}}return t}for(let t=0;t<=h&&(B=v(),t!==h);t++){const t=B.map(((t,e)=>{const n=g[e]-t;return Number.isFinite(n)?Math.abs(n/p.yScale):Math.abs(x[e]-dt(t,p.yCenter,p.yScale))})),e=Y(t.slice()),n=B;E=t.map(((t,r)=>{if(0===e){return t<=64*Number.EPSILON*(Math.max(Math.abs(g[r]),Math.abs(n[r]))/p.yScale)?1:0}const u=t/(6*e);return u>=1?0:(1-u*u)**2}))}function w(t){if(0===c||d<2||t<m[0]||t>m[d-1])return M(t);let e=0,n=d-1;for(;n-e>1;){const r=e+n>>>1;m[r]<=t?e=r:n=r}if(m[n]===m[e])return B[e];const r=m[n]-m[e],u=Number.isFinite(r)?(t-m[e])/r:(dt(t,p.xCenter,p.xScale)-y[e])/(y[n]-y[e]);return B[e]*(1-u)+B[n]*u}function A(t){return Array.isArray(t)?t.map(w):w(t)}return{predict:A,evaluate:A,evaluateGrid:function(t){return xt(m[0],m[d-1],t,w)},confidenceInterval:function(r=50){const u=[];if(r<=0)return u;if(0===d)return u;const i=m[0],s=m[d-1];if(void 0===i||void 0===s||i===1/0||s===-1/0)return u;const o=Mt(t,e,n,(t=>w(t)));if(0===o.n)return u;const a=Ct(f);if(o.min===o.max){const t=w(o.min),e=bt(o.min,o),n=Et(a,e.seMean),i=Et(a,e.sePred);for(let e=0;e<r;e++)u.push({x:o.min,mean:t,lower:t-n,upper:t+n,predLower:t-i,predUpper:t+i});return u}const D=(s-i)/(r-1);for(let t=0;t<r;t++){const e=t===r-1?s:i+D*t,n=w(e),l=bt(e,o),h=Et(a,l.seMean),c=Et(a,l.sePred);u.push({x:e,mean:n,lower:n-h,upper:n+h,predLower:n-c,predUpper:n+c})}return u},fitted:F.map(((t,e)=>({x:t.x,y:B[e]})))}},t.regressionPolynomial=function(t,e=(t=>t.x),n=(t=>t.y),r={}){var u,i;const s=null!==(u=r.degree)&&void 0!==u?u:0;if(!Number.isInteger(s)||s<0)throw new RangeError("Polynomial degree must be an nonnegative integer");const o=null!==(i=r.alpha)&&void 0!==i?i:.05,a=Ft(t,e,n),D=gt(a,s),l=yt(D),h=t=>pt(D,t);return{degree:s,rank:D.rank,coef:l,predict:h,rSquared:vt(t,e,n,(()=>{let r=0,u=0;return Bt(t,e,n,((t,e)=>{r+=e,u++})),0===u?0:r/u})(),h),evaluateGrid(t){let e=1/0,n=-1/0;return a.forEach((t=>{e=Math.min(e,t.x),n=Math.max(n,t.x)})),xt(e,n,t,h)},confidenceInterval(r=50){const u=[];if(r<=0)return u;const i=Mt(t,e,n,h);if(0===i.n)return u;const s=Ct(o);if(i.min===i.max){const t=h(i.min),e=bt(i.min,i),n=Et(s,e.seMean),o=Et(s,e.sePred);for(let e=0;e<r;e++)u.push({x:i.min,mean:t,lower:t-n,upper:t+n,predLower:t-o,predUpper:t+o});return u}const a=(i.max-i.min)/(r-1);for(let t=0;t<r;t++){const e=t===r-1?i.max:i.min+a*t,n=h(e),o=bt(e,i),D=Et(s,o.seMean),l=Et(s,o.sePred);u.push({x:e,mean:n,lower:n-D,upper:n+D,predLower:n-l,predUpper:n+l})}return u}}},t.rgbToHex=mn,t.rgbToHsl=rn,t.rotatePoint=me,t.scale=Zr,t.scott=At,t.secondCount=mr,t.secondField=gr,t.secondFloor=Fr,t.secondOffset=dr,t.secondsGetterName=bn,t.secondsSetterName=function(t){return t?"setUTCSeconds":"setSeconds"},t.seedRandom=function(t){return parseFloat("0."+Math.sin(t).toString().substring(6))},t.shuffleArray=function(t,e=Math.random){let n,r,u=t.length;for(;u;)n=Math.floor(e()*u),r=t[--u],t[u]=t[n],t[n]=r;return t},t.silverman=St,t.simpleField=t=>t?"string"==typeof t||"number"==typeof t?()=>t:s(t)?t:e=>e[t.field]:null,t.sin=zt,t.span=t=>t.length<=1?0:k(t)-t[0],t.sqrt=jt,t.stringWidth=function(t,e=!0){if("string"!=typeof t||0===t.length)return 0;if(0===(t=Ge(t)).length)return 0;t=t.replace(Xe()," ");const n=e?1:2;let r=0;for(const e of t){const t=e.codePointAt(0);if(t<=31||t>=127&&t<=159)continue;if(t>=768&&t<=879)continue;switch($e(e)){case"F":case"W":r+=2;break;case"A":r+=n;break;default:r+=1}}return r},t.styleStringToObject=(t="")=>{const e={};return t.split(";").forEach((t=>{if(t){const n=t.split(":");if(2===n.length){const t=n[0].trim(),r=n[1].trim();t&&r&&(e[t]=r)}}})),e},t.substitute=function(t,e){return t&&e?t.replace(/\\?\{([^{}]+)\}/g,((t,n)=>"\\"===t.charAt(0)?t.slice(1):void 0===e[n]?"":e[n])):t},t.tau=Ut,t.throttle=function(t,e,n){let r=!0,u=!0;if("function"!=typeof t)throw new TypeError("Expected a function");return D(n)&&(r="leading"in n?!!n.leading:r,u="trailing"in n?!!n.trailing:u),nt(t,e,{leading:r,trailing:u,maxWait:e})},t.tickStep=function(t,e,n){const r=Math.abs(e-t)/Math.max(0,n);let u=Math.pow(10,Math.floor(Math.log(r)/Math.LN10));const i=r/u;return i>=G?u*=10:i>=V?u*=5:i>=$&&(u*=2),e<t?-u:u},t.toCamelCase=function(t){return t.replace(/-([a-z])/g,((t,e)=>e.toUpperCase()))},t.toDate=ot,t.toNumber=U,t.toPercent=(t,e)=>o(t)?e:c(t)?e*parseFloat(t)/100:t,t.toValidNumber=function(t){if(g(t))return t;const e=+t;return g(e)?e:0},t.transformBounds=function(t,e,n,r,u,i,s){if(!(Ot(r)<=Lt||Ot(u)<=Lt)){if(1!==r&&t.scaleX(r),1!==u&&t.scaleY(u),isFinite(i)&&Math.abs(i)>Lt){let e=0,n=0;void 0!==s&&(e=s[0],n=s[1]),t.rotate(i,e,n)}t.translate(e,n)}},t.transformBoundsWithMatrix=Qe,t.truncate=(t,e,n="right",r)=>{const u=o(r)?"…":r,i=t+"",s=i.length,a=Math.max(0,e-u.length);return s<=e?i:"left"===n?u+i.slice(s-a):"center"===n?i.slice(0,Math.ceil(a/2))+u+i.slice(s-Math.floor(a/2)):i.slice(0,a)+u},t.unionAABB=Ne,t.uniqArray=function(t){return t&&f(t)?Array.from(new Set(L(t))):t},t.upperFirst=function(t){return t.charAt(0).toUpperCase()+t.substring(1)},t.utcDayCount=Qn,t.utcDayField=Kn,t.utcDayFloor=Zn,t.utcDayOffset=Jn,t.utcHourField=sr,t.utcHourFloor=ur,t.utcHourOffset=ir,t.utcMinuteField=fr,t.utcMinuteFloor=hr,t.utcMinuteOffset=cr,t.utcMonthCount=jn,t.utcMonthField=Yn,t.utcMonthFloor=Wn,t.utcMonthOffset=zn,t.utcSecondField=xr,t.utcSecondFloor=pr,t.utcSecondOffset=yr,t.utcYearCount=Un,t.utcYearField=Rn,t.utcYearFloor=kn,t.utcYearOffset=In,t.uuid=(t,e)=>{const n="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz".split(""),r=[];let u;if(e=e||n.length,t)for(u=0;u<t;u++)r[u]=n[0|Math.random()*e];else{let t;for(r[8]=r[13]=r[18]=r[23]="-",r[14]="4",u=0;u<36;u++)r[u]||(t=0|16*Math.random(),r[u]=n[19===u?3&t|8:t])}return r.join("")},t.variance=j,t.visitPoints=Bt,t.weightedSum=Jr,t.yearCount=Nn,t.yearField=Ln,t.yearFloor=Tn,t.yearOffset=_n,t.zero=t=>0,t.zeros=$r,t.zerosM=function(t,e){return $r(t).map((function(){return $r(e)}))}}));
|
|
128
|
+
*/,t.generateCeil=Br,t.generateCount=vr,t.generateStepInterval=(t,{floor:e,offset:n,field:r,count:u})=>{const i=Math.floor(t);if(!Number.isFinite(i)||i<=0)return null;if(i<=1)return{floor:e,offset:n,ceil:Br(e,n)};const s=vr(e,u),o=r?t=>r(t)%i==0:t=>s(0,t)%i==0,a=t=>{if(!Number.isNaN(+t))for(e(t);!o(t);)t.setTime(+t-1),e(t);return t},D=(t,e)=>{if(!Number.isNaN(+t))if(i<0)for(;++e<=0;)for(n(t,-1);!o(t);)n(t,-1);else for(;--e>=0;)for(n(t,1);!o(t);)n(t,1);return t};return{floor:a,offset:D,ceil:Br(a,D)}},t.get=C,t.getAABBFromPoints=function(t){return Ce=1/0,Ee=1/0,Me=-1/0,be=-1/0,t.forEach((t=>{Ce>t.x&&(Ce=t.x),Me<t.x&&(Me=t.x),Ee>t.y&&(Ee=t.y),be<t.y&&(be=t.y)})),{x1:Ce,y1:Ee,x2:Me,y2:be}},t.getAngleByPoint=function(t,e){return Math.atan2(e.y-t.y,e.x-t.x)},t.getCenter=Rr,t.getContainerSize=function(t,e=0,n=0){if(!t)return{width:e,height:n};let r;try{r=null===window||void 0===window?void 0:window.getComputedStyle}catch(t){r=()=>({})}const u=r(t);if(/^(\d*\.?\d+)(px)$/.exec(u.width)){const r=parseFloat(u.width)-parseFloat(u.paddingLeft)-parseFloat(u.paddingRight)||t.clientWidth-1,i=parseFloat(u.height)-parseFloat(u.paddingTop)-parseFloat(u.paddingBottom)||t.clientHeight-1;return{width:r<=0?e:r,height:i<=0?n:i}}return{width:e,height:n}},t.getContextFont=Je,t.getDecimalPlaces=Kt,t.getElementAbsolutePosition=wr,t.getElementRelativePosition=function(t,e){const n=wr(t),r=wr(e);return{x:n.x-r.x,y:n.y-r.y}},t.getFormatFromValue=function(t,e){const n=ot(t),r=n[Cn(e)]()+1,u=n[En(e)](),i=n[Mn(e)](),s=n[bn(e)](),o=n[Bn(e)](),a=0===n[vn(e)](),D=a&&0===o,l=D&&0===s,h=l&&0===i,c=h&&1===u;return c&&1===r?"YYYY":c?"YYYY-MM":h?"YYYY-MM-DD":l?"HH":D?"HH:mm":a?"HH:mm:ss":"HH:mm:ss SSS"},t.getIntersectPoint=function(t,e,n,r){if(!ce(t,e,n,r))return!1;const u=[0,0],i=[0,0],s=[0,0];if(he(u,e,t),he(i,r,n),Jt(u,i))return!0;he(s,n,t);const o=$t(s,i)/$t(u,i);return o>=0&&o<=1&&[t[0]+u[0]*o,t[1]+u[1]*o]},t.getIntervalOptions=(t,e)=>"year"===t&&e?{floor:In,offset:Rn,count:Un,field:On}:"month"===t&&e?{floor:Wn,offset:zn,count:Yn,field:Gn}:"day"===t&&e?{floor:Jn,offset:Qn,count:Kn,field:tr}:"hour"===t&&e?{floor:ir,offset:sr,count:rr,field:or}:"minute"===t&&e?{floor:cr,offset:fr,count:lr,field:Fr}:"second"===t&&e?{floor:yr,offset:xr,count:gr,field:Cr}:"year"===t?{floor:_n,offset:Nn,count:Ln,field:kn}:"month"===t?{floor:Pn,offset:Hn,count:jn,field:qn}:"day"===t?{floor:Vn,offset:$n,count:Xn,field:Zn}:"hour"===t?{floor:er,offset:nr,count:rr,field:ur}:"minute"===t?{floor:ar,offset:Dr,count:lr,field:hr}:"second"===t?{floor:dr,offset:mr,count:gr,field:pr}:{floor:Er,offset:Mr,count:br},t.getOBBFromLine=function(t,e,n){return Be=e.x-t.x,ve=e.y-t.y,we=ve,Ae=-Be,_e=Se=Math.sqrt(we*we+Ae*Ae),Ne=n,we/=Se,Ae/=Se,Te=n/2,Be=Te*we,ve=Te*Ae,{point1:{x:t.x+Be,y:t.y+ve},point2:{x:t.x-Be,y:t.y-ve},point3:{x:e.x+Be,y:e.y+ve},point4:{x:e.x-Be,y:e.y-ve},width:_e,height:Ne,left:Math.min(t.x,e.x)-Math.abs(Be),top:Math.min(t.y,e.y)-Math.abs(ve)}},t.getRectIntersect=function(t,e,n){if(null===t)return e;if(null===e)return t;const{x11:r,x12:u,y11:i,y12:s,x21:o,x22:a,y21:D,y22:l}=Fe(t,e,n);return r>=a||u<=o||i>=l||s<=D?{x1:0,y1:0,x2:0,y2:0}:{x1:Math.max(r,o),y1:Math.max(i,D),x2:Math.min(u,a),y2:Math.min(s,l)}},t.getScale=t=>t.offsetWidth>0?Ar(t):Sr(t),t.getScaleX=Ar,t.getScaleY=Sr,t.getScrollLeft=t=>{var e,n,r;return t===(null===(e=null===globalThis||void 0===globalThis?void 0:globalThis.document)||void 0===e?void 0:e.body)?(null===(r=null===(n=null===globalThis||void 0===globalThis?void 0:globalThis.document)||void 0===n?void 0:n.documentElement)||void 0===r?void 0:r.scrollLeft)||t.scrollLeft:"html"===t.tagName.toLowerCase()?0:t.scrollLeft},t.getScrollTop=t=>{var e,n,r;return t===(null===(e=null===globalThis||void 0===globalThis?void 0:globalThis.document)||void 0===e?void 0:e.body)?(null===(r=null===(n=null===globalThis||void 0===globalThis?void 0:globalThis.document)||void 0===n?void 0:n.documentElement)||void 0===r?void 0:r.scrollTop)||t.scrollTop:"html"===t.tagName.toLowerCase()?0:t.scrollTop},t.getTimeFormatter=function(t,e){return n=>{const r=ot(n),u=r[xn(e)](),i=r[Cn(e)]()+1,s=Math.floor((i-1)/3)+1,o=r[En(e)](),a=r["get"+(e?"UTC":"")+"Day"](),D=r[Mn(e)](),l=(D-1)%12+1,h=r[bn(e)](),c=r[Bn(e)](),f=r[vn(e)]();return(t||"").replace(/YYYY/g,K(u+"",4,"0","left")).replace(/yyyy/g,u+"").replace(/yy/g,u%100+"").replace(/Q/g,s+"").replace(/MM/g,K(i,2,"0","left")).replace(/M/g,i+"").replace(/dd/g,K(o,2,"0","left")).replace(/d/g,o+"").replace(/e/g,a+"").replace(/HH/g,K(D,2,"0","left")).replace(/H/g,D+"").replace(/hh/g,K(l+"",2,"0","left")).replace(/h/g,l+"").replace(/mm/g,K(h,2,"0","left")).replace(/m/g,h+"").replace(/ss/g,K(c,2,"0","left")).replace(/s/g,c+"").replace(/SSS/g,K(f,3,"0","left")).replace(/S/g,f+"")}},t.getter=ct,t.halfPi=Rt,t.has=(t,e)=>null!=t&&E.call(t,e),t.hasParentElement=function(t,e){let n=t.parentNode;for(;null!==n;){if(n===e)return!0;n=n.parentNode}return!1},t.hexToRgb=mn,t.hourCount=rr,t.hourField=ur,t.hourFloor=er,t.hourOffset=nr,t.hoursGetterName=Mn,t.hoursSetterName=function(t){return t?"setUTCHours":"setHours"},t.hslToRgb=rn,t.interpolateDate=function(t,e){const n=t.valueOf(),r=e.valueOf(),u=new Date;return t=>(u.setTime(n*(1-t)+r*t),u)},t.interpolateNumber=rt,t.interpolateNumberRound=function(t,e){return function(n){return Math.round(t*(1-n)+e*n)}},t.interpolateRgb=pn,t.interpolateString=function(t,e){let n,r,u,i=ut.lastIndex=it.lastIndex=0,s=-1;const o=[],a=[];for(t+="",e+="";(n=ut.exec(t))&&(r=it.exec(e));)(u=r.index)>i&&(u=e.slice(i,u),o[s]?o[s]+=u:o[++s]=u),(n=n[0])===(r=r[0])?o[s]?o[s]+=r:o[++s]=r:(o[++s]=null,a.push({i:s,x:rt(n,r)})),i=it.lastIndex;return i<e.length&&(u=e.slice(i),o[s]?o[s]+=u:o[++s]=u),o.length<2?a[0]?function(t){return function(e){return t(e)+""}}(a[0].x):function(t){return function(){return t}}(e):(e=a.length,function(t){for(let n,r=0;r<e;++r)o[(n=a[r]).i]=n.x(t);return o.join("")})},t.intersectionArea=function(t,e){const n=function(t){const e=[];for(let n=0;n<t.length;++n)for(let r=n+1;r<t.length;++r){const u=Ir(t[n],t[r]);for(let t=0;t<u.length;++t){const i=u[t];i.parentIndex=[n,r],e.push(i)}}return e}(t),r=n.filter((function(e){return Lr(e,t)}));let u=0,i=0;const s=[];if(r.length>1){const e=Rr(r);for(let t=0;t<r.length;++t){const n=r[t];n.angle=Math.atan2(n.x-e.x,n.y-e.y)}r.sort((function(t,e){return e.angle-t.angle}));let n=r[r.length-1];for(let e=0;e<r.length;++e){const o=r[e];i+=(n.x+o.x)*(o.y-n.y);const a={x:(o.x+n.x)/2,y:(o.y+n.y)/2};let D=null;for(let e=0;e<o.parentIndex.length;++e)if(n.parentIndex.indexOf(o.parentIndex[e])>-1){const r=t[o.parentIndex[e]],u=Math.atan2(o.x-r.x,o.y-r.y),i=Math.atan2(n.x-r.x,n.y-r.y);let s=i-u;s<0&&(s+=2*Math.PI);const l=i-s/2;let h=ee.distancePP(a,{x:r.x+r.radius*Math.sin(l),y:r.y+r.radius*Math.cos(l)});h>2*r.radius&&(h=2*r.radius),(null===D||D.width>h)&&(D={circle:r,width:h,p1:o,p2:n})}null!==D&&(s.push(D),u+=kr(D.circle.radius,D.width),n=o)}}else{let e=t[0];for(let n=1;n<t.length;++n)t[n].radius<e.radius&&(e=t[n]);let n=!1;for(let r=0;r<t.length;++r)if(ee.distancePP(t[r],e)>Math.abs(e.radius-t[r].radius)){n=!0;break}n?u=i=0:(u=e.radius*e.radius*Math.PI,s.push({circle:e,p1:{x:e.x,y:e.y+e.radius},p2:{x:e.x-Nr,y:e.y+e.radius},width:2*e.radius}))}return i/=2,e&&(e.area=u+i,e.arcArea=u,e.polygonArea=i,e.arcs=s,e.innerPoints=r,e.intersectionPoints=n),u+i},t.isArray=f,t.isArrayLike=F,t.isBase64=t=>new RegExp(/^data:image\/(?:gif|png|jpeg|bmp|webp|svg\+xml)(?:;charset=utf-8)?;base64,(?:[A-Za-z0-9]|[+/])+={0,2}/g).test(t),t.isBoolean=i,t.isDate=d,t.isEmpty=function(t){if(o(t))return!0;if(F(t))return!t.length;const e=(t=>({}.toString.call(t).replace(/^\[object /,"").replace(/]$/,"")))(t);if("Map"===e||"Set"===e)return!t.size;if(function(t){const e=t&&t.constructor;return t===("function"==typeof e&&e.prototype||y)}(t))return!Object.keys(t).length;for(const e in t)if(x.call(t,e))return!1;return!0},t.isEqual=function t(e,n,r){if(e===n)return!0;if(typeof e!=typeof n)return!1;if(null==e||null==n)return!1;if(Number.isNaN(e)&&Number.isNaN(n))return!0;if(w(e)!==w(n))return!1;if(s(e))return!!(null==r?void 0:r.skipFunction);if("object"!=typeof e)return!1;if(f(e)){if(e.length!==n.length)return!1;for(let u=e.length-1;u>=0;u--)if(!t(e[u],n[u],r))return!1;return!0}if(!h(e))return!1;const u=A(e),i=A(n);if(u.length!==i.length)return!1;u.sort(),i.sort();for(let t=u.length-1;t>=0;t--)if(u[t]!=i[t])return!1;for(let i=u.length-1;i>=0;i--){const s=u[i];if(!t(e[s],n[s],r))return!1}return!0},t.isFunction=s,t.isGreater=function(t,e,n,r){return t>e&&!J(t,e,n,r)},t.isHTMLElement=function(t){try{return t instanceof Element}catch(e){const n=["children","innerHTML","classList","setAttribute","tagName","getBoundingClientRect"],r=Object.keys(t);return n.every((t=>r.includes(t)))}},t.isIntersect=ce,t.isLess=function(t,e,n,r){return t<e&&!J(t,e,n,r)},t.isNil=o,t.isNull=t=>null===t,t.isNumber=m,t.isNumberClose=J,t.isNumeric=t=>"string"==typeof t&&(!isNaN(Number(t))&&!isNaN(parseFloat(t))),t.isObject=D,t.isObjectLike=l,t.isPlainObject=h,t.isPointInLine=Ye,t.isPointInPolygon=function(t,e){if(!t)return!1;if(!e)return!1;const n="Feature"===(r=e).type?r.geometry:r;var r;const u=n.type,i=e.bbox;let s=n.coordinates;if(i&&!0===de(t,{x1:i[0],x2:i[1],y1:i[1],y2:i[3]},!0))return!1;"Polygon"===u&&(s=[s]);let o=!1;for(let e=0;e<s.length;++e)for(let n=0;n<s[e].length;++n){if(ze(s[e][n].map((t=>({x:t[0],y:t[1]}))),t.x,t.y))return o=!0,o}return o},t.isRectIntersect=function(t,e,n){if(t&&e){if(!n)return!(t.x1>e.x2||t.x2<e.x1||t.y1>e.y2||t.y2<e.y1);const{x11:r,x12:u,y11:i,y12:s,x21:o,x22:a,y21:D,y22:l}=Fe(t,e,!0);return!(r>a||u<o||i>l||s<D)}return!0},t.isRegExp=p,t.isRotateAABBIntersect=xe,t.isShallowEqual=function(t,e){if(S(t,e))return!0;if("object"!=typeof t||null===t||"object"!=typeof e||null===e)return!1;if(f(t)!==f(e))return!1;if(T(t)!==T(e))return!1;let n=!0;return Object.keys(t).forEach((r=>!!S(t[r],e[r])||(n=!1,n))),n},t.isString=c,t.isType=u,t.isUndefined=t=>void 0===t,t.isValid=a,t.isValidNumber=g,t.isValidUrl=t=>new RegExp(/^(http(s)?:\/\/)\w+[^\s]+(\.[^\s]+){1,}$/).test(t),t.kde=function(t,e={}){const n=void 0===e.standardDeviation?"population":e.standardDeviation,r=void 0===e.bandwidthAdjust?1:e.bandwidthAdjust;if("sample"!==n&&"population"!==n)throw new RangeError("standardDeviation must be sample or population");if(!Number.isFinite(r)||r<=0)throw new RangeError("bandwidthAdjust must be finite and positive");const u=t.length,i=e.kernel||At;let s=e.bandwidth;if(!s||s<=0){const r=function(t,e){const n=t.length;if(n<2)return 0;const r=wt(t),u=[];let i=0,s=1;for(let e=0;e<n;e++){const n=t[e]-r;u.push(n),i=Math.max(i,Math.abs(n))}if(i===1/0){s=Math.abs(r);for(const e of t)s=Math.max(s,Math.abs(e));i=0;for(let e=0;e<n;e++)u[e]=t[e]/s-r/s,i=Math.max(i,Math.abs(u[e]))}if(0===i)return 0;for(let t=0;t<n;t++)u[t]/=i;const o="population"===e?(n-1)/n:1;return Math.sqrt(z(u)*o)*i*s}(t,n)||0,i=e.bandwidthMethod||"scott";s="silverman"===i?Tt(u,r,1):St(u,r,1)}if(s*=r,!s||s<=0){const e=e=>{const n=[];if(e<=0)return n;let r=1/0,i=-1/0;for(let e=0;e<u;e++){const n=t[e];n<r&&(r=n),n>i&&(i=n)}if(r===1/0||i===-1/0){for(let t=0;t<e;t++)n.push({x:0,y:0});return n}for(let t=0;t<e;t++)n.push({x:r,y:0});return n};return{bandwidth:0,kernel:i,evaluate:t=>{if(Array.isArray(t)){const e=[];for(let n=0;n<t.length;n++)e.push(0);return e}return 0},evaluateGrid:e}}const o=1/u/s;function a(e){let n=0;for(let r=0;r<u;r++)n+=i((e-t[r])/s);return n*o}return{bandwidth:s,kernel:i,evaluate:function(t){if(Array.isArray(t)){const e=[];for(let n=0;n<t.length;n++)e.push(a(t[n]));return e}return a(t)},evaluateGrid(e){const n=[];if(e<=0)return n;let r=1/0,i=-1/0;for(let e=0;e<u;e++){const n=t[e];n<r&&(r=n),n>i&&(i=n)}if(r===1/0||i===-1/0)return n;if(r===i){for(let t=0;t<e;t++)n.push({x:r,y:a(r)});return n}const s=(i-r)/(e-1);for(let t=0;t<e;t++){const u=t===e-1?i:r+s*t;n.push({x:u,y:a(u)})}return n}}},t.keys=_,t.last=k,t.lengthFromPointToLine=Vt,t.lineIntersectPolygon=We,t.lowerCamelCaseToMiddle=t=>t.replace(/([A-Z])/g,"-$1").toLowerCase(),t.lowerFirst=function(t){return t.charAt(0).toLowerCase()+t.substring(1)},t.max=qt,t.maxInArray=(t,e)=>{var n;if(0===t.length)return;let r=t[0];for(let u=1;u<t.length;u++){const i=t[u];(null!==(n=null==e?void 0:e(i,r))&&void 0!==n?n:i-r)>0&&(r=i)}return r},t.mean=wt,t.median=Y,t.memoize=t=>{let e=null,n=null;return(...r)=>(e&&r.every(((t,n)=>t===e[n]))||(e=r,n=t(...r)),n)},t.merge=function(t,...e){let n=-1;const r=e.length;for(;++n<r;){M(t,e[n],!0)}return t},t.mergeAABB=function(t){const e=[];return function t(n,r){const u=[];r.forEach((t=>{let e;(e=Le(n,t)).length>1?u.push(t):n=e[0]})),e.push(n),u.length&&t(u[0],u.slice(1))}(t[0],t.slice(1)),e},t.millisecondsCount=br,t.millisecondsFloor=Er,t.millisecondsGetterName=vn,t.millisecondsOffset=Mr,t.millisecondsSetterName=function(t){return t?"setUTCMilliseconds":"setMilliseconds"},t.min=Wt,t.minInArray=(t,e)=>{var n;if(0===t.length)return;let r=t[0];for(let u=1;u<t.length;u++){const i=t[u];(null!==(n=null==e?void 0:e(i,r))&&void 0!==n?n:i-r)<0&&(r=i)}return r},t.minuteCount=lr,t.minuteField=hr,t.minuteFloor=ar,t.minuteOffset=Dr,t.minutesGetterName=bn,t.minutesSetterName=function(t){return t?"setUTCMinutes":"setMinutes"},t.mixin=function(t,e,n=!0){if(t="prototype"in t?t.prototype:t,e="prototype"in e?e.prototype:e,Object.getOwnPropertyNames){const r=Object.getOwnPropertyNames(e);for(let u=0;u<r.length;u++){const i=r[u];"constructor"!==i&&(n?null!=e[i]:null==t[i])&&(t[i]=e[i])}}else N(t,e,n)},t.monthCount=jn,t.monthField=qn,t.monthFloor=Pn,t.monthGetterName=Cn,t.monthOffset=Hn,t.monthSetterName=function(t){return t?"setUTCMonth":"setMonth"},t.nelderMead=function(t,e,n){const r=(n=n||{}).maxIterations||200*e.length,u=n.nonZeroDelta||1.05,i=n.zeroDelta||.001,s=n.minErrorDelta||1e-6,o=n.minErrorDelta||1e-5,a=void 0!==n.rho?n.rho:1,D=void 0!==n.chi?n.chi:2,l=void 0!==n.psi?n.psi:-.5,h=void 0!==n.sigma?n.sigma:.5;let c;const f=e.length,F=new Array(f+1);F[0]=e,F[0].fx=t(e),F[0].id=0;for(let n=0;n<f;++n){const r=e.slice();r[n]=r[n]?r[n]*u:i,F[n+1]=r,F[n+1].fx=t(r),F[n+1].id=n+1}function d(t){for(let e=0;e<t.length;e++)F[f][e]=t[e];F[f].fx=t.fx}const m=function(t,e){return t.fx-e.fx},g=e.slice(),p=e.slice(),y=e.slice(),x=e.slice();for(let e=0;e<r;++e){if(F.sort(m),n.history){const t=F.map((function(t){const e=t.slice();return e.fx=t.fx,e.id=t.id,e}));t.sort((function(t,e){return t.id-e.id})),n.history.push({x:F[0].slice(),fx:F[0].fx,simplex:t})}c=0;for(let t=0;t<f;++t)c=Math.max(c,Math.abs(F[0][t]-F[1][t]));if(Math.abs(F[0].fx-F[f].fx)<s&&c<o)break;for(let t=0;t<f;++t){g[t]=0;for(let e=0;e<f;++e)g[t]+=F[e][t];g[t]/=f}const e=F[f];if(Qr(p,1+a,g,-a,e),p.fx=t(p),p.fx<F[0].fx)Qr(x,1+D,g,-D,e),x.fx=t(x),x.fx<p.fx?d(x):d(p);else if(p.fx>=F[f-1].fx){let n=!1;if(p.fx>e.fx?(Qr(y,1+l,g,-l,e),y.fx=t(y),y.fx<e.fx?d(y):n=!0):(Qr(y,1-l*a,g,l*a,e),y.fx=t(y),y.fx<p.fx?d(y):n=!0),n){if(h>=1)break;for(let e=1;e<F.length;++e)Qr(F[e],1-h,F[0],h,F[e]),F[e].fx=t(F[e])}}else d(p)}return F.sort(m),{fx:F[0].fx,x:F[0]}},t.norm2=Zr,t.normalQuantile=O,t.normalTransform=function(t,e,n,r,u,i,s,o){const a=e.a,D=e.b,l=e.c,h=e.d,c=e.e,f=e.f,F=jt(s),d=zt(s);let m,g;o?(m=o[0],g=o[1]):(m=n,g=r);const p=m-n,y=g-r,x=a*F+l*d,C=D*F+h*d,E=l*F-a*d,M=h*F-D*d;t.a=u*x,t.b=u*C,t.c=i*E,t.d=i*M,t.e=c+a*m+l*g-x*p-E*y,t.f=f+D*m+h*g-C*p-M*y},t.normalizeAngle=De,t.normalizePadding=function(t){if(g(t))return[t,t,t,t];if(f(t)){const e=t.length;if(1===e){const e=t[0];return[e,e,e,e]}if(2===e){const[e,n]=t;return[e,n,e,n]}if(3===e){const[e,n,r]=t;return[e,n,r,n]}if(4===e)return t}if(D(t)){const{top:e=0,right:n=0,bottom:r=0,left:u=0}=t;return[e,n,r,u]}return[0,0,0,0]},t.numberSpecifierReg=qr,t.obbSeparation=(t,e)=>{const n=[{x:Math.cos(t.angle),y:Math.sin(t.angle)},{x:-Math.sin(t.angle),y:Math.cos(t.angle)},{x:Math.cos(e.angle),y:Math.sin(t.angle)},{x:-Math.sin(e.angle),y:Math.cos(t.angle)}];function r(t,e,n){const r=t.getRotatedCorners().map((t=>t.x*e+t.y*n));return{min:Math.min(...r),max:Math.max(...r)}}let u=0;for(const i of n){const n=r(t,i.x,i.y),s=r(e,i.x,i.y);let o;o=n.max<s.min?s.min-n.max:s.max<n.min?n.min-s.max:0,u=Math.max(u,o)}return u},t.ordinaryLeastSquares=function(t,e,n,r){const u=r-t*t;if(Math.abs(u)<Number.EPSILON)return{a:e,b:0};const i=(n-t*e)/u;return{a:e-i*t,b:i}},t.pad=K,t.parseUint8ToImageData=(t,e,n)=>{const r=new Uint8ClampedArray(t),u=new Uint8ClampedArray(t.length);for(let t=n-1;t>=0;t--)for(let i=0;i<e;i++){const s=t*e*4+4*i,o=(n-t)*e*4+4*i;u[o]=r[s],u[o+1]=r[s+1],u[o+2]=r[s+2],u[o+3]=r[s+3]}return new ImageData(u,e,n)},t.pi=It,t.pi2=Ot,t.pick=function(t,e){if(!t||!h(t))return t;const n={};return e.forEach((e=>{v.call(t,e)&&(n[e]=t[e])})),n},t.pickWithout=function(t,e){if(!t||!h(t))return t;const n={};return Object.keys(t).forEach((r=>{const u=t[r];let i=!1;e.forEach((t=>{(c(t)&&t===r||t instanceof RegExp&&r.match(t))&&(i=!0)})),i||(n[r]=u)})),n},t.pointAt=function(t,e,n,r,u){let i=n,s=r;return"number"==typeof t&&"number"==typeof n&&(i=(1-u)*t+u*n),"number"==typeof e&&"number"==typeof r&&(s=(1-u)*e+u*r),{x:i,y:s}},t.pointBetweenLine=He,t.pointInAABB=function(t,e){return de(t,e,!1)},t.pointInLine=Re,t.pointInOBB=function(t,e){return ke.x=(e.point1.x+e.point2.x)/2,ke.y=(e.point1.y+e.point2.y)/2,Ie.x=(e.point3.x+e.point4.x)/2,Ie.y=(e.point3.y+e.point4.y)/2,Re(t,ke,Ie,e.height)},t.pointInRect=de,t.polarToCartesian=function(t,e,n){return e?{x:t.x+e*Math.cos(n),y:t.y+e*Math.sin(n)}:{x:t.x,y:t.y}},t.polygonContainPoint=ze,t.polygonIntersectPolygon=function(t,e){for(let n=0;n<e.length;n++){if(ze(t,e[n].x,e[n].y))return!0;if(n>0&&We(e[n-1].x,e[n-1].y,e[n].x,e[n].y,t))return!0}return!1},t.pow=Gt,t.precisionAdd=function(t,e){return Qt(t+e,10**Math.max(Kt(t),Kt(e)))},t.precisionSub=function(t,e){return Qt(t-e,10**Math.max(Kt(t),Kt(e)))},t.quantileSorted=U,t.rSquared=vt,t.radianToDegree=ue,t.randomLCG=ht,t.range=function(t,e,n){a(e)||(e=t,t=0),a(n)||(n=1);let r=-1;const u=0|Math.max(0,Math.ceil((e-t)/n)),i=new Array(u);for(;++r<u;)i[r]=t+r*n;return i},t.rectInsideAnotherRect=function(e,n,r){if(!e||!n)return t.InnerBBox.NONE;const{x11:u,x12:i,y11:s,y12:o,x21:a,x22:D,y21:l,y22:h}=Fe(e,n,r);return u>a&&i<D&&s>l&&o<h?t.InnerBBox.BBOX1:a>u&&D<i&&l>s&&h<o?t.InnerBBox.BBOX2:t.InnerBBox.NONE},t.regressionBootstrap=function(t,e){var n;const r="linear"===e.method?1:null!==(n=e.degree)&&void 0!==n?n:NaN;if("linear"!==e.method&&"polynomial"!==e.method||!Number.isInteger(r)||r<1||!t.length||t.some((t=>!Number.isFinite(t.x)||!Number.isFinite(t.y)))||e.grid.some((t=>!Number.isFinite(t)))||!(e.level>0&&e.level<1)||!Number.isInteger(e.resamples)||e.resamples<1||!Number.isInteger(e.seed)||e.seed<0||e.seed>4294967295)throw new RangeError("Invalid paired regression bootstrap inputs");if(t.length<=r+1)throw new RangeError("Regression bootstrap requires positive residual degrees of freedom");const u=t.slice().sort(((t,e)=>t.x-e.x||t.y-e.y)),i=mt(u);if(gt(u,r,i).rank<r+1)throw new RangeError("Original regression design is rank deficient");const s=ht(e.seed),o=new Array(u.length),a=e.grid.map((()=>new Array(e.resamples)));for(let t=0;t<e.resamples;t++){for(let t=0;t<o.length;t++)o[t]=u[Math.floor(s()*u.length)];const n=gt(o,r,i);for(let r=0;r<e.grid.length;r++){const u=pt(n,e.grid[r]);if(!Number.isFinite(u))throw new RangeError("Regression bootstrap prediction is not finite");a[r][t]=u}}const D=(1-e.level)/2;return e.grid.map(((t,e)=>(a[e].sort(((t,e)=>t-e)),{x:t,lower:U(a[e],D),upper:U(a[e],1-D)})))},t.regressionLinear=function(t,e=(t=>t.x),n=(t=>t.y),r){var u;const i=null!==(u=null==r?void 0:r.alpha)&&void 0!==u?u:.05,s=Ft(t,e,n),o=gt(s,1),a=yt(o),D=a[0],l=a[1],h=t=>pt(o,t),c=Mt(t,e,n,h);let f=0;return s.forEach(((t,e)=>{f+=(t.y-f)/(e+1)})),{coef:{a:D,b:l},rank:o.rank,predict:h,rSquared:vt(t,e,n,f,h),evaluateGrid:function(t){return xt(c.min,c.max,t,h)},confidenceInterval:function(t=50){const e=[];if(0===c.n||t<=0)return e;const n=Ct(i);if(c.min===c.max){const r=h(c.min),u=bt(c.min,c),i=Et(n,u.seMean),s=Et(n,u.sePred);for(let n=0;n<t;n++)e.push({x:c.min,mean:r,lower:r-i,upper:r+i,predLower:r-s,predUpper:r+s});return e}const r=(c.max-c.min)/(t-1);for(let u=0;u<t;u++){const i=u===t-1?c.max:c.min+r*u,s=h(i),o=bt(i,c),a=Et(n,o.seMean),D=Et(n,o.sePred);e.push({x:i,mean:s,lower:s-a,upper:s+a,predLower:s-D,predUpper:s+D})}return e}}},t.regressionLogistic=function(t,e=(t=>t.x),n=(t=>t.y),r){var u,i,s;const o=null!==(u=null==r?void 0:r.maxIteration)&&void 0!==u?u:25,a=null!==(i=null==r?void 0:r.tol)&&void 0!==i?i:1e-6,D=null!==(s=null==r?void 0:r.alpha)&&void 0!==s?s:.05,l=[],h=[];Bt(t,e,n,((t,e)=>{l.push(t),h.push(e?1:0)}));const c=l.length;if(0===c)return{coef:[0,0],predict:t=>0,evaluateGrid:t=>[],confidenceInterval:(t=50)=>[]};let f=0,F=0;for(let t=0;t<o;t++){const t=new Array(c);let e=!0;for(let e=0;e<c;e++){const n=f+F*l[e],r=1/(1+Math.exp(-n));t[e]=r}let n=0,r=0,u=0,i=0,s=0;for(let e=0;e<c;e++){const o=t[e]*(1-t[e]),a=h[e]-t[e];n+=a,r+=a*l[e],u+=o,i+=o*l[e],s+=o*l[e]*l[e]}const o=u*s-i*i;if(Math.abs(o)<1e-12)break;const D=(s*n-i*r)/o,d=(-i*n+u*r)/o;if(f+=D,F+=d,(Math.abs(D)>a||Math.abs(d)>a)&&(e=!1),e)break}const d=t=>{const e=f+F*t;return 1/(1+Math.exp(-e))};return{coef:[f,F],predict:d,evaluateGrid:function(r){const u=[];if(r<=0)return u;let i=1/0,s=-1/0;if(Bt(t,e,n,(t=>{t<i&&(i=t),t>s&&(s=t)})),i===1/0||s===-1/0)return u;if(i===s){const t=d(i);for(let e=0;e<r;e++)u.push({x:i,y:t});return u}const o=(s-i)/(r-1);for(let t=0;t<r;t++){const e=t===r-1?s:i+o*t;u.push({x:e,y:d(e)})}return u},confidenceInterval:function(r=50){const u=[];if(r<=0)return u;const i=Mt(t,e,n,d);if(0===i.n)return u;const s=Ct(D);if(i.min===i.max){const t=d(i.min),e=bt(i.min,i),n=Et(s,e.seMean),o=Et(s,e.sePred);for(let e=0;e<r;e++)u.push({x:i.min,mean:t,lower:t-n,upper:t+n,predLower:t-o,predUpper:t+o});return u}const o=(i.max-i.min)/(r-1);for(let t=0;t<r;t++){const e=t===r-1?i.max:i.min+o*t,n=d(e),a=bt(e,i),D=Et(s,a.seMean),l=Et(s,a.sePred);u.push({x:e,mean:n,lower:n-D,upper:n+D,predLower:n-l,predUpper:n+l})}return u}}},t.regressionLowess=function(t,e=(t=>t.x),n=(t=>t.y),r={}){var u,i,s,o,a;const D=null!==(u=r.span)&&void 0!==u?u:.3,l=null!==(i=r.degree)&&void 0!==i?i:1,h=null!==(s=r.iterations)&&void 0!==s?s:2,c=null!==(o=r.delta)&&void 0!==o?o:0,f=null!==(a=r.alpha)&&void 0!==a?a:.05;if(!(D>0&&D<=1)||!Number.isInteger(h)||h<0||!Number.isFinite(c)||c<0||0!==l&&1!==l||null!=r.maxSamples&&(!Number.isInteger(r.maxSamples)||r.maxSamples<2))throw new RangeError("Invalid LOWESS span, degree, iterations, delta or maxSamples");let F=Ft(t,e,n).sort(((t,e)=>t.x-e.x||t.y-e.y));if(null!=r.maxSamples&&F.length>r.maxSamples){const t=F,e=r.maxSamples;F=Array.from({length:e},((n,r)=>t[Math.floor(r*(t.length-1)/(e-1))]))}const d=F.length,m=F.map((t=>t.x)),g=F.map((t=>t.y)),p=mt(F),y=m.map((t=>dt(t,p.xCenter,p.xScale))),x=g.map((t=>dt(t,p.yCenter,p.yScale))),C=Math.min(d,Math.max(2,Math.floor(D*d+1e-10)));let E;function M(t){if(!d)return 0;const e=dt(t,p.xCenter,p.xScale);let n=0,r=d-C;for(;n<r;){const u=n+r>>>1,i=t-m[u],s=m[u+C]-t;(Number.isFinite(i)&&Number.isFinite(s)?i>s:e-y[u]>y[u+C]-e)?n=u+1:r=u}let u=n,i=n+C;if(m[u]===m[i-1]){for(;u>0&&m[u-1]===m[u];)u--;for(;i<d&&m[i]===m[u];)i++}const s=Math.max(Math.abs(m[u]-t),Math.abs(m[i-1]-t)),o=!Number.isFinite(s),a=o?Math.max(Math.abs(y[u]-e),Math.abs(y[i-1]-e)):s;let D=1/0,h=-1/0;for(let t=u;t<i;t++)D=Math.min(D,g[t]),h=Math.max(h,g[t]);const c=D/2+h/2,f=Math.max(Math.abs(D-c),Math.abs(h-c))||1;let F=0,x=0,M=0,b=0,B=0;for(let n=u;n<i;n++){const r=0===a?0:(o?y[n]-e:m[n]-t)/a,u=Math.abs(r),i=u>=1?0:1-u*u*u,s=i*i*i*(E?E[n]:1);F+=s,x+=s*r;const D=dt(g[n],c,f);M+=s*D,b+=s*r*r,B+=s*r*D}if(0===F){let n=1/0,r=0,u=0;for(let i=0;i<d;i++){const s=E?E[i]:1;if(0===s)continue;const a=Math.abs(o?y[i]-e:m[i]-t);a<n?(n=a,r=s,u=g[i]):a===n&&(u=u*(r/(r+s))+g[i]*(s/(r+s)),r+=s)}if(0===r)throw new RangeError("LOWESS has no effective local observations");return u}const v=x/F,w=M/F,A=b/F-v*v;return c+f*(w-(0===l||A<=32*Number.EPSILON?0:(B/F-v*w)/A)*v)}const b=[];for(let t=0;t<d&&(b.push(t),t!==d-1);){let e=t+1;if(c>0)for(;e+1<d&&m[e+1]-m[t]<=c;)e++;for(;e+1<d&&m[e+1]===m[e];)e++;t=e}let B=new Array(d);function v(){const t=new Array(d);for(let e=0;e<b.length;e++){const n=b[e];if(t[n]=M(m[n]),0===e)continue;const r=b[e-1],u=m[n]-m[r],i=Number.isFinite(u)?u:y[n]-y[r];for(let e=r+1;e<n;e++){const s=0===i?0:(Number.isFinite(u)?m[e]-m[r]:y[e]-y[r])/i;t[e]=t[r]*(1-s)+t[n]*s}}return t}for(let t=0;t<=h&&(B=v(),t!==h);t++){const t=B.map(((t,e)=>{const n=g[e]-t;return Number.isFinite(n)?Math.abs(n/p.yScale):Math.abs(x[e]-dt(t,p.yCenter,p.yScale))})),e=Y(t.slice()),n=B;E=t.map(((t,r)=>{if(0===e){return t<=64*Number.EPSILON*(Math.max(Math.abs(g[r]),Math.abs(n[r]))/p.yScale)?1:0}const u=t/(6*e);return u>=1?0:(1-u*u)**2}))}function w(t){if(0===c||d<2||t<m[0]||t>m[d-1])return M(t);let e=0,n=d-1;for(;n-e>1;){const r=e+n>>>1;m[r]<=t?e=r:n=r}if(m[n]===m[e])return B[e];const r=m[n]-m[e],u=Number.isFinite(r)?(t-m[e])/r:(dt(t,p.xCenter,p.xScale)-y[e])/(y[n]-y[e]);return B[e]*(1-u)+B[n]*u}function A(t){return Array.isArray(t)?t.map(w):w(t)}return{predict:A,evaluate:A,evaluateGrid:function(t){return xt(m[0],m[d-1],t,w)},confidenceInterval:function(r=50){const u=[];if(r<=0)return u;if(0===d)return u;const i=m[0],s=m[d-1];if(void 0===i||void 0===s||i===1/0||s===-1/0)return u;const o=Mt(t,e,n,(t=>w(t)));if(0===o.n)return u;const a=Ct(f);if(o.min===o.max){const t=w(o.min),e=bt(o.min,o),n=Et(a,e.seMean),i=Et(a,e.sePred);for(let e=0;e<r;e++)u.push({x:o.min,mean:t,lower:t-n,upper:t+n,predLower:t-i,predUpper:t+i});return u}const D=(s-i)/(r-1);for(let t=0;t<r;t++){const e=t===r-1?s:i+D*t,n=w(e),l=bt(e,o),h=Et(a,l.seMean),c=Et(a,l.sePred);u.push({x:e,mean:n,lower:n-h,upper:n+h,predLower:n-c,predUpper:n+c})}return u},fitted:F.map(((t,e)=>({x:t.x,y:B[e]})))}},t.regressionPolynomial=function(t,e=(t=>t.x),n=(t=>t.y),r={}){var u,i;const s=null!==(u=r.degree)&&void 0!==u?u:0;if(!Number.isInteger(s)||s<0)throw new RangeError("Polynomial degree must be an nonnegative integer");const o=null!==(i=r.alpha)&&void 0!==i?i:.05,a=Ft(t,e,n),D=gt(a,s),l=yt(D),h=t=>pt(D,t);return{degree:s,rank:D.rank,coef:l,predict:h,rSquared:vt(t,e,n,(()=>{let r=0,u=0;return Bt(t,e,n,((t,e)=>{r+=e,u++})),0===u?0:r/u})(),h),evaluateGrid(t){let e=1/0,n=-1/0;return a.forEach((t=>{e=Math.min(e,t.x),n=Math.max(n,t.x)})),xt(e,n,t,h)},confidenceInterval(r=50){const u=[];if(r<=0)return u;const i=Mt(t,e,n,h);if(0===i.n)return u;const s=Ct(o);if(i.min===i.max){const t=h(i.min),e=bt(i.min,i),n=Et(s,e.seMean),o=Et(s,e.sePred);for(let e=0;e<r;e++)u.push({x:i.min,mean:t,lower:t-n,upper:t+n,predLower:t-o,predUpper:t+o});return u}const a=(i.max-i.min)/(r-1);for(let t=0;t<r;t++){const e=t===r-1?i.max:i.min+a*t,n=h(e),o=bt(e,i),D=Et(s,o.seMean),l=Et(s,o.sePred);u.push({x:e,mean:n,lower:n-D,upper:n+D,predLower:n-l,predUpper:n+l})}return u}}},t.rgbToHex=gn,t.rgbToHsl=un,t.rotatePoint=ge,t.scale=Jr,t.scott=St,t.secondCount=gr,t.secondField=pr,t.secondFloor=dr,t.secondOffset=mr,t.secondsGetterName=Bn,t.secondsSetterName=function(t){return t?"setUTCSeconds":"setSeconds"},t.seedRandom=function(t){return parseFloat("0."+Math.sin(t).toString().substring(6))},t.shuffleArray=function(t,e=Math.random){let n,r,u=t.length;for(;u;)n=Math.floor(e()*u),r=t[--u],t[u]=t[n],t[n]=r;return t},t.silverman=Tt,t.simpleField=t=>t?"string"==typeof t||"number"==typeof t?()=>t:s(t)?t:e=>e[t.field]:null,t.sin=zt,t.span=t=>t.length<=1?0:k(t)-t[0],t.sqrt=Yt,t.stringWidth=function(t,e=!0){if("string"!=typeof t||0===t.length)return 0;if(0===(t=Ve(t)).length)return 0;t=t.replace(Ze()," ");const n=e?1:2;let r=0;for(const e of t){const t=e.codePointAt(0);if(t<=31||t>=127&&t<=159)continue;if(t>=768&&t<=879)continue;switch(Xe(e)){case"F":case"W":r+=2;break;case"A":r+=n;break;default:r+=1}}return r},t.styleStringToObject=(t="")=>{const e={};return t.split(";").forEach((t=>{if(t){const n=t.split(":");if(2===n.length){const t=n[0].trim(),r=n[1].trim();t&&r&&(e[t]=r)}}})),e},t.substitute=function(t,e){return t&&e?t.replace(/\\?\{([^{}]+)\}/g,((t,n)=>"\\"===t.charAt(0)?t.slice(1):void 0===e[n]?"":e[n])):t},t.tau=Ut,t.throttle=function(t,e,n){let r=!0,u=!0;if("function"!=typeof t)throw new TypeError("Expected a function");return D(n)&&(r="leading"in n?!!n.leading:r,u="trailing"in n?!!n.trailing:u),nt(t,e,{leading:r,trailing:u,maxWait:e})},t.tickStep=function(t,e,n){const r=Math.abs(e-t)/Math.max(0,n);let u=Math.pow(10,Math.floor(Math.log(r)/Math.LN10));const i=r/u;return i>=G?u*=10:i>=V?u*=5:i>=$&&(u*=2),e<t?-u:u},t.toCamelCase=function(t){return t.replace(/-([a-z])/g,((t,e)=>e.toUpperCase()))},t.toDate=ot,t.toNumber=R,t.toPercent=(t,e)=>o(t)?e:c(t)?e*parseFloat(t)/100:t,t.toValidNumber=function(t){if(g(t))return t;const e=+t;return g(e)?e:0},t.transformBounds=function(t,e,n,r,u,i,s){if(!(Pt(r)<=kt||Pt(u)<=kt)){if(1!==r&&t.scaleX(r),1!==u&&t.scaleY(u),isFinite(i)&&Math.abs(i)>kt){let e=0,n=0;void 0!==s&&(e=s[0],n=s[1]),t.rotate(i,e,n)}t.translate(e,n)}},t.transformBoundsWithMatrix=Ke,t.truncate=(t,e,n="right",r)=>{const u=o(r)?"…":r,i=t+"",s=i.length,a=Math.max(0,e-u.length);return s<=e?i:"left"===n?u+i.slice(s-a):"center"===n?i.slice(0,Math.ceil(a/2))+u+i.slice(s-Math.floor(a/2)):i.slice(0,a)+u},t.unionAABB=Le,t.uniqArray=function(t){return t&&f(t)?Array.from(new Set(L(t))):t},t.upperFirst=function(t){return t.charAt(0).toUpperCase()+t.substring(1)},t.utcDayCount=Kn,t.utcDayField=tr,t.utcDayFloor=Jn,t.utcDayOffset=Qn,t.utcHourField=or,t.utcHourFloor=ir,t.utcHourOffset=sr,t.utcMinuteField=Fr,t.utcMinuteFloor=cr,t.utcMinuteOffset=fr,t.utcMonthCount=Yn,t.utcMonthField=Gn,t.utcMonthFloor=Wn,t.utcMonthOffset=zn,t.utcSecondField=Cr,t.utcSecondFloor=yr,t.utcSecondOffset=xr,t.utcYearCount=Un,t.utcYearField=On,t.utcYearFloor=In,t.utcYearOffset=Rn,t.uuid=(t,e)=>{const n="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz".split(""),r=[];let u;if(e=e||n.length,t)for(u=0;u<t;u++)r[u]=n[0|Math.random()*e];else{let t;for(r[8]=r[13]=r[18]=r[23]="-",r[14]="4",u=0;u<36;u++)r[u]||(t=0|16*Math.random(),r[u]=n[19===u?3&t|8:t])}return r.join("")},t.variance=z,t.visitPoints=Bt,t.weightedSum=Qr,t.yearCount=Ln,t.yearField=kn,t.yearFloor=_n,t.yearOffset=Nn,t.zero=t=>0,t.zeros=Xr,t.zerosM=function(t,e){return Xr(t).map((function(){return Xr(e)}))}}));
|