Greasy Fork is available in English.

vtable

vtable库

Este script no debería instalarse directamente. Es una biblioteca que utilizan otros scripts mediante la meta-directiva de inclusión // @require https://update.greasyfork.org/scripts/485070/1313040/vtable.js

!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).VTable={})}(this,(function(t){"use strict";class e{static GenAutoIncrementId(){return e.auto_increment_id++}}e.auto_increment_id=0;class i{constructor(t){this.id=e.GenAutoIncrementId(),this.registry=t}}const r="named",n="inject",o="multi_inject",s="inversify:tagged",a="inversify:paramtypes";class l{constructor(t,e){this.key=t,this.value=e}toString(){return this.key===r?`named: ${String(this.value).toString()} `:`tagged: { key:${this.key.toString()}, value: ${String(this.value)} }`}}var h=function(t){var e;return function(t){const e=Object.prototype.hasOwnProperty,i="function"==typeof Symbol,r=i&&void 0!==Symbol.toPrimitive?Symbol.toPrimitive:"@@toPrimitive",n=i&&void 0!==Symbol.iterator?Symbol.iterator:"@@iterator",o="function"==typeof Object.create,s={__proto__:[]}instanceof Array,a=!o&&!s,l={create:o?function(){return S(Object.create(null))}:s?function(){return S({__proto__:null})}:function(){return S({})},has:a?function(t,i){return e.call(t,i)}:function(t,e){return e in t},get:a?function(t,i){return e.call(t,i)?t[i]:void 0}:function(t,e){return t[e]}},h=Object.getPrototypeOf(Function),c="object"==typeof process&&process.env&&"true"===process.env.REFLECT_METADATA_USE_MAP_POLYFILL,d=c||"function"!=typeof Map||"function"!=typeof Map.prototype.entries?function(){const t={},e=[],i=function(){function t(t,e,i){this._index=0,this._keys=t,this._values=e,this._selector=i}return t.prototype["@@iterator"]=function(){return this},t.prototype[n]=function(){return this},t.prototype.next=function(){const t=this._index;if(t>=0&&t<this._keys.length){const i=this._selector(this._keys[t],this._values[t]);return t+1>=this._keys.length?(this._index=-1,this._keys=e,this._values=e):this._index++,{value:i,done:!1}}return{value:void 0,done:!0}},t.prototype.throw=function(t){throw this._index>=0&&(this._index=-1,this._keys=e,this._values=e),t},t.prototype.return=function(t){return this._index>=0&&(this._index=-1,this._keys=e,this._values=e),{value:t,done:!0}},t}();return function(){function e(){this._keys=[],this._values=[],this._cacheKey=t,this._cacheIndex=-2}return Object.defineProperty(e.prototype,"size",{get:function(){return this._keys.length},enumerable:!0,configurable:!0}),e.prototype.has=function(t){return this._find(t,!1)>=0},e.prototype.get=function(t){const e=this._find(t,!1);return e>=0?this._values[e]:void 0},e.prototype.set=function(t,e){const i=this._find(t,!0);return this._values[i]=e,this},e.prototype.delete=function(e){const i=this._find(e,!1);if(i>=0){const r=this._keys.length;for(let t=i+1;t<r;t++)this._keys[t-1]=this._keys[t],this._values[t-1]=this._values[t];return this._keys.length--,this._values.length--,e===this._cacheKey&&(this._cacheKey=t,this._cacheIndex=-2),!0}return!1},e.prototype.clear=function(){this._keys.length=0,this._values.length=0,this._cacheKey=t,this._cacheIndex=-2},e.prototype.keys=function(){return new i(this._keys,this._values,r)},e.prototype.values=function(){return new i(this._keys,this._values,o)},e.prototype.entries=function(){return new i(this._keys,this._values,s)},e.prototype["@@iterator"]=function(){return this.entries()},e.prototype[n]=function(){return this.entries()},e.prototype._find=function(t,e){return this._cacheKey!==t&&(this._cacheIndex=this._keys.indexOf(this._cacheKey=t)),this._cacheIndex<0&&e&&(this._cacheIndex=this._keys.length,this._keys.push(t),this._values.push(void 0)),this._cacheIndex},e}();function r(t,e){return t}function o(t,e){return e}function s(t,e){return[t,e]}}():Map,u=(c||"function"!=typeof Set||"function"!=typeof Set.prototype.entries?function(){function t(){this._map=new d}Object.defineProperty(t.prototype,"size",{get:function(){return this._map.size},enumerable:!0,configurable:!0}),t.prototype.has=function(t){return this._map.has(t)},t.prototype.add=function(t){return this._map.set(t,t),this},t.prototype.delete=function(t){return this._map.delete(t)},t.prototype.clear=function(){this._map.clear()},t.prototype.keys=function(){return this._map.keys()},t.prototype.values=function(){return this._map.values()},t.prototype.entries=function(){return this._map.entries()},t.prototype["@@iterator"]=function(){return this.keys()},t.prototype[n]=function(){return this.keys()}}():Set,new(c||"function"!=typeof WeakMap?function(){const t=16,i=l.create(),r=n();return function(){function t(){this._key=n()}return t.prototype.has=function(t){const e=o(t,!1);return void 0!==e&&l.has(e,this._key)},t.prototype.get=function(t){const e=o(t,!1);return void 0!==e?l.get(e,this._key):void 0},t.prototype.set=function(t,e){return o(t,!0)[this._key]=e,this},t.prototype.delete=function(t){const e=o(t,!1);return void 0!==e&&delete e[this._key]},t.prototype.clear=function(){this._key=n()},t}();function n(){let t;do{t="@@WeakMap@@"+a()}while(l.has(i,t));return i[t]=!0,t}function o(t,i){if(!e.call(t,r)){if(!i)return;Object.defineProperty(t,r,{value:l.create()})}return t[r]}function s(t,e){for(let i=0;i<e;++i)t[i]=255*Math.random()|0;return t}function a(){const e=(i=t,"function"==typeof Uint8Array?"undefined"!=typeof crypto?crypto.getRandomValues(new Uint8Array(i)):s(new Uint8Array(i),i):s(new Array(i),i));var i;e[6]=79&e[6]|64,e[8]=191&e[8]|128;let r="";for(let i=0;i<t;++i){const t=e[i];4!==i&&6!==i&&8!==i||(r+="-"),t<16&&(r+="0"),r+=t.toString(16).toLowerCase()}return r}}():WeakMap));function g(t,e,i){let r=u.get(t);if(b(r)){if(!i)return;r=new d,u.set(t,r)}let n=r.get(e);if(b(n)){if(!i)return;n=new d,r.set(e,n)}return n}function p(t,e,i){if(f(t,e,i))return!0;const r=_(e);return!y(r)&&p(t,r,i)}function f(t,e,i){const r=g(e,i,!1);return!b(r)&&!!r.has(t)}function m(t,e,i){if(f(t,e,i))return function(t,e,i){const r=g(e,i,!1);if(!b(r))return r.get(t)}(t,e,i);const r=_(e);return y(r)?void 0:m(t,r,i)}function b(t){return void 0===t}function y(t){return null===t}function C(t){return"object"==typeof t?null!==t:"function"==typeof t}function v(t,e){switch(function(t){if(null===t)return 1;switch(typeof t){case"undefined":return 0;case"boolean":return 2;case"string":return 3;case"symbol":return 4;case"number":return 5;case"object":return null===t?1:6;default:return 6}}(t)){case 0:case 1:case 2:case 3:case 4:case 5:return t}const i=3===e?"string":5===e?"number":"default",n=function(t,e){const i=t[e];if(null!=i){if(!x(i))throw new TypeError;return i}}(t,r);if(void 0!==n){const e=n.call(t,i);if(C(e))throw new TypeError;return e}return function(t,e){if("string"===e){const e=t.toString;if(x(e)){const i=e.call(t);if(!C(i))return i}const i=t.valueOf;if(x(i)){const e=i.call(t);if(!C(e))return e}}else{const e=t.valueOf;if(x(e)){const i=e.call(t);if(!C(i))return i}const i=t.toString;if(x(i)){const e=i.call(t);if(!C(e))return e}}throw new TypeError}(t,"default"===i?"number":i)}function w(t){const e=v(t,3);return"symbol"==typeof e?e:function(t){return""+t}(e)}function x(t){return"function"==typeof t}function _(t){const e=Object.getPrototypeOf(t);if("function"!=typeof t||t===h)return e;if(e!==h)return e;const i=t.prototype,r=i&&Object.getPrototypeOf(i);if(null==r||r===Object.prototype)return e;const n=r.constructor;return"function"!=typeof n||n===t?e:n}function S(t){return t.__=void 0,delete t.__,t}t("defineMetadata",(function(t,e,i,r){if(!C(i))throw new TypeError;return n=t,o=e,void g(i,r,!0).set(n,o);var n,o})),t("hasMetadata",(function(t,e,i){if(!C(e))throw new TypeError;return b(i)||(i=w(i)),p(t,e,i)})),t("hasOwnMetadata",(function(t,e,i){if(!C(e))throw new TypeError;return b(i)||(i=w(i)),f(t,e,i)})),t("getMetadata",(function(t,e,i){if(!C(e))throw new TypeError;return b(i)||(i=w(i)),m(t,e,i)}))}((e=t,function(t,i){"function"!=typeof e[t]&&Object.defineProperty(e,t,{configurable:!0,writable:!0,value:i})})),t}({});function c(t,e,i,r){!function(t,e,i,r){const n=[r];let o={};h.hasOwnMetadata(t,e)&&(o=h.getMetadata(t,e));let s=o[i];void 0===s&&(s=[]),s.push(...n),o[i]=s,h.defineMetadata(t,o,e)}(s,t,i.toString(),r)}function d(t){return(e,i,r)=>{c(e,0,r,t)}}function u(t){return e=>(i,r,n)=>d(new l(t,e))(i,r,n)}const g=u(n),p=u(o);function f(){return function(t){return h.defineMetadata(a,null,t),t}}function m(t){return d(new l(r,t))}const b="Singleton",y="Transient",C="ConstantValue",v="DynamicValue",w="Factory",x="Function",_="Instance",S="Invalid";class A{constructor(t,i){this.id=e.GenAutoIncrementId(),this.activated=!1,this.serviceIdentifier=t,this.scope=i,this.type=S,this.constraint=t=>!0,this.implementationType=null,this.cache=null,this.factory=null,this.provider=null,this.dynamicValue=null}clone(){const t=new A(this.serviceIdentifier,this.scope);return t.activated=t.scope===b&&this.activated,t.implementationType=this.implementationType,t.dynamicValue=this.dynamicValue,t.scope=this.scope,t.type=this.type,t.provider=this.provider,t.constraint=this.constraint,t.cache=this.cache,t}}class B{getConstructorMetadata(t){return{compilerGeneratedMetadata:h.getMetadata(a,t),userGeneratedMetadata:h.getMetadata(s,t)||{}}}getPropertiesMetadata(t){throw new Error("暂未实现")}}const T=(M=r,t=>{const e=e=>{if(null==e)return!1;if(e.key===M&&e.value===t)return!0;if(null==e.constructorArgsMetadata)return!1;const i=e.constructorArgsMetadata;for(let e=0;e<i.length;e++)if(i[e].key===M&&i[e].value===t)return!0;return!1};return e.metaData=new l(M,t),e});var M;class R{constructor(t){this._binding=t}inRequestScope(){throw new Error("暂未实现")}inSingletonScope(){return this._binding.scope=b,this}inTransientScope(){return this._binding.scope=y,this}whenTargetNamed(t){return this._binding.constraint=T(t),this}}class P{constructor(t){this._binding=t}to(t){return this._binding.type=_,this._binding.implementationType=t,new R(this._binding)}toSelf(){const t=this._binding.serviceIdentifier;return this.to(t)}toDynamicValue(t){return this._binding.type=v,this._binding.cache=null,this._binding.dynamicValue=t,this._binding.implementationType=null,new R(this._binding)}toConstantValue(t){return this._binding.type=C,this._binding.cache=t,this._binding.dynamicValue=null,this._binding.implementationType=null,this._binding.scope=b,new R(this._binding)}toFactory(t){return this._binding.type=w,this._binding.factory=t,this._binding.scope=b,new R(this._binding)}toService(t){this.toDynamicValue((e=>e.container.get(t)))}}const E=Symbol("ContributionProvider");class H{constructor(t,e){this.serviceIdentifier=t,this.container=e}getContributions(){return this.caches||(this.caches=[],this.container&&this.container.isBound(this.serviceIdentifier)&&this.caches.push(...this.container.getAll(this.serviceIdentifier))),this.caches}}function L(t,e){t(E).toDynamicValue((t=>{let{container:i}=t;return new H(e,i)})).inSingletonScope().whenTargetNamed(e)}class k{constructor(t,e){this._args=t,this.name=e,this.taps=[]}tap(t,e){this._tap("sync",t,e)}unTap(t,e){const i="string"==typeof t?t.trim():t.name;i&&(this.taps=this.taps.filter((t=>t.name!==i&&(!e||t.fn===e))))}_parseOptions(t,e,i){let r;if("string"==typeof e)r={name:e.trim()};else if("object"!=typeof e||null===e)throw new Error("Invalid tap options");if("string"!=typeof r.name||""===r.name)throw new Error("Missing name for tap");return r=Object.assign({type:t,fn:i},r),r}_tap(t,e,i){this._insert(this._parseOptions(t,e,i))}_insert(t){let e;"string"==typeof t.before?e=new Set([t.before]):Array.isArray(t.before)&&(e=new Set(t.before));let i=0;"number"==typeof t.stage&&(i=t.stage);let r=this.taps.length;for(;r>0;){r--;const t=this.taps[r];this.taps[r+1]=t;const n=t.stage||0;if(e){if(e.has(t.name)){e.delete(t.name);continue}if(e.size>0)continue}if(!(n>i)){r++;break}}this.taps[r]=t}}class I extends k{call(){for(var t=arguments.length,e=new Array(t),i=0;i<t;i++)e[i]=arguments[i];this.taps.map((t=>t.fn)).forEach((t=>t(...e)))}}const F=Symbol.for("EnvContribution"),z=Symbol.for("VGlobal");var O=function(t,e,i,r){var n,o=arguments.length,s=o<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,i,r);else for(var a=t.length-1;a>=0;a--)(n=t[a])&&(s=(o<3?n(s):o>3?n(e,i,s):n(e,i))||s);return o>3&&s&&Object.defineProperty(e,i,s),s},D=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},W=function(t,e){return function(i,r){e(i,r,t)}};let N=class{get env(){return this._env}get devicePixelRatio(){return this._env||this.setEnv("browser"),this.envContribution.getDevicePixelRatio()}get supportEvent(){return this._env||this.setEnv("browser"),this.envContribution.supportEvent}set supportEvent(t){this._env||this.setEnv("browser"),this.envContribution.supportEvent=t}get supportsTouchEvents(){return this._env||this.setEnv("browser"),this.envContribution.supportsTouchEvents}set supportsTouchEvents(t){this._env||this.setEnv("browser"),this.envContribution.supportsTouchEvents=t}get supportsPointerEvents(){return this._env||this.setEnv("browser"),this.envContribution.supportsPointerEvents}set supportsPointerEvents(t){this._env||this.setEnv("browser"),this.envContribution.supportsPointerEvents=t}get supportsMouseEvents(){return this._env||this.setEnv("browser"),this.envContribution.supportsMouseEvents}set supportsMouseEvents(t){this._env||this.setEnv("browser"),this.envContribution.supportsMouseEvents=t}get applyStyles(){return this._env||this.setEnv("browser"),this.envContribution.applyStyles}set applyStyles(t){this._env||this.setEnv("browser"),this.envContribution.applyStyles=t}constructor(t){this.contributions=t,this.id=e.GenAutoIncrementId(),this.hooks={onSetEnv:new I(["lastEnv","env","global"])},this.measureTextMethod="native",this.optimizeVisible=!1}bindContribution(t){const e=[];if(this.contributions.getContributions().forEach((i=>{const r=i.configure(this,t);r&&r.then&&e.push(r)})),e.length)return Promise.all(e)}getDynamicCanvasCount(){return this._env||this.setEnv("browser"),this.envContribution.getDynamicCanvasCount()}getStaticCanvasCount(){return this._env||this.setEnv("browser"),this.envContribution.getStaticCanvasCount()}setEnv(t,e){if(e&&!0===e.force||this._env!==t)return this.deactiveCurrentEnv(),this.activeEnv(t,e)}deactiveCurrentEnv(){this.envContribution&&this.envContribution.release()}activeEnv(t,e){const i=this._env;this._env=t;const r=this.bindContribution(e);if(r&&r.then)return r.then((()=>{this.envParams=e,this.hooks.onSetEnv.call(i,t,this)}));this.envParams=e,this.hooks.onSetEnv.call(i,t,this)}setActiveEnvContribution(t){this.envContribution=t}createCanvas(t){return this._env||this.setEnv("browser"),this.envContribution.createCanvas(t)}createOffscreenCanvas(t){return this._env||this.setEnv("browser"),this.envContribution.createOffscreenCanvas(t)}releaseCanvas(t){return this._env||this.setEnv("browser"),this.envContribution.releaseCanvas(t)}addEventListener(t,e,i){return this._env||this.setEnv("browser"),this.envContribution.addEventListener(t,e,i)}removeEventListener(t,e,i){return this._env||this.setEnv("browser"),this.envContribution.removeEventListener(t,e,i)}dispatchEvent(t){return this._env||this.setEnv("browser"),this.envContribution.dispatchEvent(t)}getRequestAnimationFrame(){return this._env||this.setEnv("browser"),this.envContribution.getRequestAnimationFrame()}getCancelAnimationFrame(){return this._env||this.setEnv("browser"),this.envContribution.getCancelAnimationFrame()}getElementById(t){return this._env||this.setEnv("browser"),this.envContribution.getElementById?this.envContribution.getElementById(t):null}getRootElement(){return this._env||this.setEnv("browser"),this.envContribution.getRootElement?this.envContribution.getRootElement():null}getDocument(){return this._env||this.setEnv("browser"),this.envContribution.getDocument?this.envContribution.getDocument():null}mapToCanvasPoint(t,e){return this._env||this.setEnv("browser"),this.envContribution.mapToCanvasPoint?this.envContribution.mapToCanvasPoint(t,e):null}loadImage(t){return this._env||this.setEnv("browser"),this.envContribution.loadImage(t)}loadSvg(t){return this._env||this.setEnv("browser"),this.envContribution.loadSvg(t)}loadJson(t){return this._env||this.setEnv("browser"),this.envContribution.loadJson(t)}loadArrayBuffer(t){return this._env||this.setEnv("browser"),this.envContribution.loadArrayBuffer(t)}loadBlob(t){return this._env||this.setEnv("browser"),this.envContribution.loadBlob(t)}isChrome(){return null!=this._isChrome||(this._env||this.setEnv("browser"),this._isChrome="browser"===this._env&&navigator.userAgent.indexOf("Chrome")>-1),this._isChrome}isSafari(){return null!=this._isSafari||(this._env||this.setEnv("browser"),this._isSafari="browser"===this._env&&/Safari/.test(navigator.userAgent)&&!/Chrome/.test(navigator.userAgent)),this._isSafari}getNativeAABBBounds(t){return this._env||this.setEnv("browser"),this.envContribution.getNativeAABBBounds(t)}removeDom(t){return this._env||this.setEnv("browser"),this.envContribution.removeDom(t)}createDom(t){return this._env||this.setEnv("browser"),this.envContribution.createDom(t)}getElementTop(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return this._env||this.setEnv("browser"),this.envContribution.getElementTop(t,e)}getElementLeft(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return this._env||this.setEnv("browser"),this.envContribution.getElementLeft(t,e)}getElementTopLeft(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return this._env||this.setEnv("browser"),this.envContribution.getElementTopLeft(t,e)}};function G(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}N=O([f(),W(0,g(E)),W(0,m(F)),D("design:paramtypes",[Object])],N);var j={exports:{}};!function(t){var e=Object.prototype.hasOwnProperty,i="~";function r(){}function n(t,e,i){this.fn=t,this.context=e,this.once=i||!1}function o(t,e,r,o,s){if("function"!=typeof r)throw new TypeError("The listener must be a function");var a=new n(r,o||t,s),l=i?i+e:e;return t._events[l]?t._events[l].fn?t._events[l]=[t._events[l],a]:t._events[l].push(a):(t._events[l]=a,t._eventsCount++),t}function s(t,e){0==--t._eventsCount?t._events=new r:delete t._events[e]}function a(){this._events=new r,this._eventsCount=0}Object.create&&(r.prototype=Object.create(null),(new r).__proto__||(i=!1)),a.prototype.eventNames=function(){var t,r,n=[];if(0===this._eventsCount)return n;for(r in t=this._events)e.call(t,r)&&n.push(i?r.slice(1):r);return Object.getOwnPropertySymbols?n.concat(Object.getOwnPropertySymbols(t)):n},a.prototype.listeners=function(t){var e=i?i+t:t,r=this._events[e];if(!r)return[];if(r.fn)return[r.fn];for(var n=0,o=r.length,s=new Array(o);n<o;n++)s[n]=r[n].fn;return s},a.prototype.listenerCount=function(t){var e=i?i+t:t,r=this._events[e];return r?r.fn?1:r.length:0},a.prototype.emit=function(t,e,r,n,o,s){var a=i?i+t:t;if(!this._events[a])return!1;var l,h,c=this._events[a],d=arguments.length;if(c.fn){switch(c.once&&this.removeListener(t,c.fn,void 0,!0),d){case 1:return c.fn.call(c.context),!0;case 2:return c.fn.call(c.context,e),!0;case 3:return c.fn.call(c.context,e,r),!0;case 4:return c.fn.call(c.context,e,r,n),!0;case 5:return c.fn.call(c.context,e,r,n,o),!0;case 6:return c.fn.call(c.context,e,r,n,o,s),!0}for(h=1,l=new Array(d-1);h<d;h++)l[h-1]=arguments[h];c.fn.apply(c.context,l)}else{var u,g=c.length;for(h=0;h<g;h++)switch(c[h].once&&this.removeListener(t,c[h].fn,void 0,!0),d){case 1:c[h].fn.call(c[h].context);break;case 2:c[h].fn.call(c[h].context,e);break;case 3:c[h].fn.call(c[h].context,e,r);break;case 4:c[h].fn.call(c[h].context,e,r,n);break;default:if(!l)for(u=1,l=new Array(d-1);u<d;u++)l[u-1]=arguments[u];c[h].fn.apply(c[h].context,l)}}return!0},a.prototype.on=function(t,e,i){return o(this,t,e,i,!1)},a.prototype.once=function(t,e,i){return o(this,t,e,i,!0)},a.prototype.removeListener=function(t,e,r,n){var o=i?i+t:t;if(!this._events[o])return this;if(!e)return s(this,o),this;var a=this._events[o];if(a.fn)a.fn!==e||n&&!a.once||r&&a.context!==r||s(this,o);else{for(var l=0,h=[],c=a.length;l<c;l++)(a[l].fn!==e||n&&!a[l].once||r&&a[l].context!==r)&&h.push(a[l]);h.length?this._events[o]=1===h.length?h[0]:h:s(this,o)}return this},a.prototype.removeAllListeners=function(t){var e;return t?(e=i?i+t:t,this._events[e]&&s(this,e)):(this._events=new r,this._eventsCount=0),this},a.prototype.off=a.prototype.removeListener,a.prototype.addListener=a.prototype.on,a.prefixed=i,a.EventEmitter=a,t.exports=a}(j);var U=G(j.exports);var V=(t,e)=>Object.prototype.toString.call(t)===`[object ${e}]`;var K=function(t){return arguments.length>1&&void 0!==arguments[1]&&arguments[1]?"boolean"==typeof t:!0===t||!1===t||V(t,"Boolean")};var $=t=>"function"==typeof t;var X=t=>null==t;var Y=t=>null!=t;var q=t=>{const e=typeof t;return null!==t&&"object"===e||"function"===e};var Z=t=>"object"==typeof t&&null!==t;var J=function(t){if(!Z(t)||!V(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};var Q=t=>void 0===t;var et=function(t){const e=typeof t;return arguments.length>1&&void 0!==arguments[1]&&arguments[1]?"string"===e:"string"===e||V(t,"String")};var it=t=>Array.isArray?Array.isArray(t):V(t,"Array");var rt=function(t){return null!==t&&"function"!=typeof t&&Number.isFinite(t.length)};var nt=t=>V(t,"Date");var ot=function(t){const e=typeof t;return arguments.length>1&&void 0!==arguments[1]&&arguments[1]?"number"===e:"number"===e||V(t,"Number")};var st=t=>ot(t)&&Number.isFinite(t);var at=t=>new RegExp(/^(http(s)?:\/\/)\w+[^\s]+(\.[^\s]+){1,}$/).test(t);var lt=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);var ht=t=>({}.toString.call(t).replace(/^\[object /,"").replace(/]$/,""));const ct=Object.prototype;var dt=function(t){const e=t&&t.constructor;return t===("function"==typeof e&&e.prototype||ct)};const ut=Object.prototype.hasOwnProperty;function gt(t){if(X(t))return!0;if(rt(t))return!t.length;const e=ht(t);if("Map"===e||"Set"===e)return!t.size;if(dt(t))return!Object.keys(t).length;for(const e in t)if(ut.call(t,e))return!1;return!0}var pt=(t,e,i)=>{const r=et(e)?e.split("."):e;for(let e=0;e<r.length;e++)t=t?t[r[e]]:void 0;return void 0===t?i:t};const ft=Object.prototype.hasOwnProperty;var mt=(t,e)=>null!=t&&ft.call(t,e);function bt(t){let e;if(!Y(t)||"object"!=typeof t)return t;const i=it(t),r=t.length;e=i?new Array(r):"object"==typeof t?{}:K(t)||ot(t)||et(t)?t:nt(t)?new Date(+t):void 0;const n=i?void 0:Object.keys(Object(t));let o=-1;if(e)for(;++o<(n||t).length;){const i=n?n[o]:o,r=t[i];e[i]=bt(r)}return e}function yt(t,e){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(e){if(t===e)return;if(Y(e)&&"object"==typeof e){const r=Object(e),n=[];for(const t in r)n.push(t);let{length:o}=n,s=-1;for(;o--;){const o=n[++s];Y(r[o])&&"object"==typeof r[o]?Ct(t,e,o,i):vt(t,o,r[o])}}}}function Ct(t,e,i){let r=arguments.length>3&&void 0!==arguments[3]&&arguments[3];const n=t[i],o=e[i];let s=e[i],a=!0;if(it(o)){if(r)s=[];else if(it(n))s=n;else if(rt(n)){s=new Array(n.length);let t=-1;const e=n.length;for(;++t<e;)s[t]=n[t]}}else J(o)?(s=n,"function"!=typeof n&&"object"==typeof n||(s={})):a=!1;a&&yt(s,o,r),vt(t,i,s)}function vt(t,e,i){(void 0!==i&&!function(t,e){return t===e||Number.isNaN(t)&&Number.isNaN(e)}(t[e],i)||void 0===i&&!(e in t))&&(t[e]=i)}function wt(t){let e=-1;const i=arguments.length<=1?0:arguments.length-1;for(;++e<i;)yt(t,e+1<1||arguments.length<=e+1?void 0:arguments[e+1],!0);return t}function xt(t){return Object.prototype.toString.call(t)}function _t(t){return Object.keys(t)}function St(t,e,i){if(t===e)return!0;if(typeof t!=typeof e)return!1;if(null==t||null==e)return!1;if(Number.isNaN(t)&&Number.isNaN(e))return!0;if(xt(t)!==xt(e))return!1;if($(t))return!!(null==i?void 0:i.skipFunction);if("object"!=typeof t)return!1;if(it(t)){if(t.length!==e.length)return!1;for(let r=t.length-1;r>=0;r--)if(!St(t[r],e[r],i))return!1;return!0}if(!J(t))return!1;const r=_t(t),n=_t(e);if(r.length!==n.length)return!1;r.sort(),n.sort();for(let t=r.length-1;t>=0;t--)if(r[t]!=n[t])return!1;for(let n=r.length-1;n>=0;n--){const o=r[n];if(!St(t[o],e[o],i))return!1}return!0}function At(t,e,i){const r=function(t){if(!t)return[];if(Object.keys)return Object.keys(t);const e=[];for(const i in t)t.hasOwnProperty(i)&&e.push(i);return e}(e);for(let n=0;n<r.length;n++){const o=r[n];(i?null!=e[o]:null==t[o])&&(t[o]=e[o])}return t}function Bt(t){return Y(t)?it(t)?t:[t]:[]}function Tt(t){if(rt(t))return t[t.length-1]}const Mt=(t,e)=>{var i;if(0===t.length)return;let r=t[0];for(let n=1;n<t.length;n++){const o=t[n];(null!==(i=null==e?void 0:e(o,r))&&void 0!==i?i:o-r>0)&&(r=o)}return r},Rt=(t,e)=>{var i;if(0===t.length)return;let r=t[0];for(let n=1;n<t.length;n++){const o=t[n];(null!==(i=null==e?void 0:e(o,r))&&void 0!==i?i:o-r<0)&&(r=o)}return r};function Pt(t,e){if(!it(t)||!it(e))return!1;if(t.length!==e.length)return!1;for(let i=0;i<t.length;i++)if(t[i]!==e[i])return!1;return!0}function Et(t){if(!it(t))return[t];const e=[];for(const i of t)e.push(...Et(i));return e}function Ht(t,e){return t<e?-1:t>e?1:t>=e?0:NaN}function Lt(t){return Number(t)}const kt=1e-10,It=1e-10;function Ft(t,e){const i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:kt,r=(arguments.length>2&&void 0!==arguments[2]?arguments[2]:It)*Math.max(t,e);return Math.abs(t-e)<=Math.max(i,r)}function zt(t,e,i,r){return t>e&&!Ft(t,e,i,r)}function Ot(t,e,i,r){return t<e&&!Ft(t,e,i,r)}const Dt=t=>{let e=null,i=null;return function(){for(var r=arguments.length,n=new Array(r),o=0;o<r;o++)n[o]=arguments[o];return e&&n.every(((t,i)=>t===e[i]))||(e=n,i=t(...n)),i}};var Wt=function(t,e,i){return t<e?e:t>i?i:t};var Nt=(t,e,i)=>{let[r,n]=t;n<r&&(r=t[1],n=t[0]);const o=n-r;return o>=i-e?[e,i]:(r=Math.min(Math.max(r,e),i-o),[r,r+o])};function Gt(t,e){let i;return t>e&&(i=t,t=e,e=i),i=>Math.max(t,Math.min(e,i))}let jt=!1;try{jt="function"==typeof requestAnimationFrame&&"function"==typeof cancelAnimationFrame}catch(t){jt=!1}function Ut(t,e,i){let r,n,o,s,a,l,h=0,c=!1,d=!1,u=!0;const g=!e&&0!==e&&jt;if("function"!=typeof t)throw new TypeError("Expected a function");function p(e){const i=r,o=n;return r=n=void 0,h=e,s=t.apply(o,i),s}function f(t,e){return g?(cancelAnimationFrame(a),requestAnimationFrame(t)):setTimeout(t,e)}function m(t){const i=t-l;return void 0===l||i>=e||i<0||d&&t-h>=o}function b(){const t=Date.now();if(m(t))return y(t);a=f(b,function(t){const i=t-h,r=e-(t-l);return d?Math.min(r,o-i):r}(t))}function y(t){return a=void 0,u&&r?p(t):(r=n=void 0,s)}function C(){const t=Date.now(),i=m(t);for(var o=arguments.length,u=new Array(o),g=0;g<o;g++)u[g]=arguments[g];if(r=u,n=this,l=t,i){if(void 0===a)return function(t){return h=t,a=f(b,e),c?p(t):s}(l);if(d)return a=f(b,e),p(l)}return void 0===a&&(a=f(b,e)),s}return e=+e||0,q(i)&&(c=!!i.leading,d="maxWait"in i,d&&(o=Math.max(st(i.maxWait)?i.maxWait:0,e)),u="trailing"in i?!!i.trailing:u),C.cancel=function(){void 0!==a&&function(t){if(g)return cancelAnimationFrame(t);clearTimeout(t)}(a),h=0,r=l=n=a=void 0},C.flush=function(){return void 0===a?s:y(Date.now())},C.pending=function(){return void 0!==a},C}function Vt(t,e){return i=>t*(1-i)+e*i}function Kt(t,e){return function(i){return Math.round(t*(1-i)+e*i)}}jt=!1;const $t=1e-12,Xt=Math.PI,Yt=Xt/2,qt=2*Xt,Zt=2*Math.PI,Jt=Math.abs,Qt=Math.atan2,te=Math.cos,ee=Math.max,ie=Math.min,re=Math.sin,ne=Math.sqrt,oe=Math.pow;function se(t){return t>1?0:t<-1?Xt:Math.acos(t)}function ae(t){return t>=1?Yt:t<=-1?-Yt:Math.asin(t)}function le(t,e,i,r,n){let o,s;return"number"==typeof t&&"number"==typeof i&&(o=(1-n)*t+n*i),"number"==typeof e&&"number"==typeof r&&(s=(1-n)*e+n*r),{x:o,y:s}}class he{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2?arguments[2]:void 0,r=arguments.length>3?arguments[3]:void 0;this.x=0,this.y=0,this.x=t,this.y=e,this.x1=i,this.y1=r}clone(){return new he(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 ot(t)?(this.x+=t,void(this.y+=t)):(this.x+=t.x,this.y+=t.y,this)}sub(t){return ot(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 ce{static distancePP(t,e){return ne(oe(t.x-e.x,2)+oe(t.y-e.y,2))}static distanceNN(t,e,i,r){return ne(oe(t-i,2)+oe(e-r,2))}static distancePN(t,e,i){return ne(oe(e-t.x,2)+oe(i-t.y,2))}static pointAtPP(t,e,i){return new he((e.x-t.x)*i+t.x,(e.y-t.y)*i+t.y)}}function de(t,e,i){const{x1:r,y1:n,x2:o,y2:s}=e;return i.onlyTranslate()?(t!==e&&t.setValue(e.x1,e.y1,e.x2,e.y2),t.translate(i.e,i.f),e):(t.clear(),t.add(i.a*r+i.c*n+i.e,i.b*r+i.d*n+i.f),t.add(i.a*o+i.c*n+i.e,i.b*o+i.d*n+i.f),t.add(i.a*o+i.c*s+i.e,i.b*o+i.d*s+i.f),t.add(i.a*r+i.c*s+i.e,i.b*r+i.d*s+i.f),e)}class ue{constructor(t){t?this.setValue(t.x1,t.y1,t.x2,t.y2):this.clear()}clone(){return new ue(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(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;return this.x1=t,this.y1=e,this.x2=i,this.y2=r,this}set(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;return i<t?(this.x2=t,this.x1=i):(this.x1=t,this.x2=i),r<e?(this.y2=e,this.y1=r):(this.y1=e,this.y2=r),this}add(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]: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(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return it(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(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return this.x1+=t,this.x2+=t,this.y1+=e,this.y2+=e,this}rotate(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;const r=this.rotatedPoints(t,e,i);return this.clear().add(r[0],r[1]).add(r[2],r[3]).add(r[4],r[5]).add(r[6],r[7])}scale(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;const n=this.scalePoints(t,e,i,r);return this.clear().add(n[0],n[1]).add(n[2],n[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(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]: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(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return this.x1*=t,this.x2*=t,this}scaleY(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return this.y1*=t,this.y2*=t,this}transformWithMatrix(t){return de(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,i){const{x1:r,y1:n,x2:o,y2:s}=this,a=Math.cos(t),l=Math.sin(t),h=e-e*a+i*l,c=i-e*l-i*a;return[a*r-l*n+h,l*r+a*n+c,a*r-l*s+h,l*r+a*s+c,a*o-l*n+h,l*o+a*n+c,a*o-l*s+h,l*o+a*s+c]}scalePoints(t,e,i,r){const{x1:n,y1:o,x2:s,y2:a}=this;return[t*n+(1-t)*i,e*o+(1-e)*r,t*s+(1-t)*i,e*a+(1-e)*r]}}class ge extends ue{}function pe(t){return t*(Math.PI/180)}const fe=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;if(t<0)for(;t<-qt;)t+=qt;else if(t>0)for(;t>qt;)t-=qt;return t};class me{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1,n=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0,o=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0;this.a=t,this.b=e,this.c=i,this.d=r,this.e=n,this.f=o}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,i,r,n,o){return!(this.e!==n||this.f!==o||this.a!==t||this.d!==r||this.b!==e||this.c!==i)}setValue(t,e,i,r,n,o){return this.a=t,this.b=e,this.c=i,this.d=r,this.e=n,this.f=o,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,i=this.c,r=this.d,n=this.e,o=this.f,s=new me,a=t*r-e*i;return s.a=r/a,s.b=-e/a,s.c=-i/a,s.d=t/a,s.e=(i*o-r*n)/a,s.f=-(t*o-e*n)/a,s}rotate(t){const e=Math.cos(t),i=Math.sin(t),r=this.a*e+this.c*i,n=this.b*e+this.d*i,o=this.a*-i+this.c*e,s=this.b*-i+this.d*e;return this.a=r,this.b=n,this.c=o,this.d=s,this}rotateByCenter(t,e,i){const r=Math.cos(t),n=Math.sin(t),o=(1-r)*e+n*i,s=(1-r)*i-n*e,a=r*this.a-n*this.b,l=n*this.a+r*this.b,h=r*this.c-n*this.d,c=n*this.c+r*this.d,d=r*this.e-n*this.f+o,u=n*this.e+r*this.f+s;return this.a=a,this.b=l,this.c=h,this.d=c,this.e=d,this.f=u,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,i,r,n,o){return this.multiply(t,e,i,r,n,o),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:i,d:r,e:n,f:o}=this;return this.a=e,this.b=t,this.c=r,this.d=i,this.e=o,this.f=n,this}multiply(t,e,i,r,n,o){const s=this.a,a=this.b,l=this.c,h=this.d,c=s*t+l*e,d=a*t+h*e,u=s*i+l*r,g=a*i+h*r,p=s*n+l*o+this.e,f=a*n+h*o+this.f;return this.a=c,this.b=d,this.c=u,this.d=g,this.e=p,this.f=f,this}interpolate(t,e){const i=new me;return i.a=this.a+(t.a-this.a)*e,i.b=this.b+(t.b-this.b)*e,i.c=this.c+(t.c-this.c)*e,i.d=this.d+(t.d-this.d)*e,i.e=this.e+(t.e-this.e)*e,i.f=this.f+(t.f-this.f)*e,i}transformPoint(t,e){const{a:i,b:r,c:n,d:o,e:s,f:a}=this,l=i*o-r*n,h=o/l,c=-r/l,d=-n/l,u=i/l,g=(n*a-o*s)/l,p=-(i*a-r*s)/l,{x:f,y:m}=t;e.x=f*h+m*d+g,e.y=f*c+m*u+p}onlyTranslate(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1;return this.a===t&&0===this.b&&0===this.c&&this.d===t}clone(){return new me(this.a,this.b,this.c,this.d,this.e,this.f)}toTransformAttrs(){const t=this.a,e=this.b,i=this.c,r=this.d,n=t*r-e*i,o={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);o.rotateDeg=e>0?Math.acos(t/s):-Math.acos(t/s),o.scaleX=s,o.scaleY=n/s,o.skewX=(t*i+e*r)/n,o.skewY=0}else if(0!==i||0!==r){const s=Math.sqrt(i*i+r*r);o.rotateDeg=Math.PI/2-(r>0?Math.acos(-i/s):-Math.acos(i/s)),o.scaleX=n/s,o.scaleY=s,o.skewX=0,o.skewY=(t*i+e*r)/n}return o.rotateDeg=180*o.rotateDeg/Math.PI,o}}class be{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:i=this.CLEAN_THRESHOLD,L_TIME:r=this.L_TIME,R_COUNT:n=this.R_COUNT}=e;if(t.size<i)return 0;let o=0;const s=e=>{o++,t.delete(e)},a=Date.now();return t.forEach(((t,e)=>{if(t.timestamp.length<n)return s(e);let i=0;for(;a-t.timestamp[t.timestamp.length-1-i]<r&&(i++,!(i>=n)););if(i<n)return s(e);for(;a-t.timestamp[0]>r;)t.timestamp.shift()})),o}addLimitedTimestamp(t,e,i){const{R_TIMESTAMP_MAX_SIZE:r=this.R_TIMESTAMP_MAX_SIZE}=i;t.timestamp.length>r&&t.timestamp.shift(),t.timestamp.push(e)}clearTimeStamp(t,e){const{L_TIME:i=this.L_TIME}=e,r=Date.now();t.forEach((t=>{for(;r-t.timestamp[0]>i;)t.timestamp.shift()}))}clearItemTimestamp(t,e){const{L_TIME:i=this.L_TIME}=e,r=Date.now();for(;r-t.timestamp[0]>i;)t.timestamp.shift()}}function ye(t,e,i){e/=100,i/=100;const r=(1-Math.abs(2*i-1))*e,n=r*(1-Math.abs(t/60%2-1)),o=i-r/2;let s=0,a=0,l=0;return 0<=t&&t<60?(s=r,a=n,l=0):60<=t&&t<120?(s=n,a=r,l=0):120<=t&&t<180?(s=0,a=r,l=n):180<=t&&t<240?(s=0,a=n,l=r):240<=t&&t<300?(s=n,a=0,l=r):300<=t&&t<360&&(s=r,a=0,l=n),s=Math.round(255*(s+o)),a=Math.round(255*(a+o)),l=Math.round(255*(l+o)),{r:s,g:a,b:l}}function Ce(t,e,i){t/=255,e/=255,i/=255;const r=Math.min(t,e,i),n=Math.max(t,e,i),o=n-r;let s=0,a=0,l=0;return s=0===o?0:n===t?(e-i)/o%6:n===e?(i-t)/o+2:(t-e)/o+4,s=Math.round(60*s),s<0&&(s+=360),l=(n+r)/2,a=0===o?0:o/(1-Math.abs(2*l-1)),a=+(100*a).toFixed(1),l=+(100*l).toFixed(1),{h:s,s:a,l:l}}const ve=/^#([0-9a-f]{3,8})$/,we={transparent:4294967040},xe={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 _e(t){return((t=Math.max(0,Math.min(255,Math.round(t)||0)))<16?"0":"")+t.toString(16)}function Se(t){return ot(t)?new Me(t>>16,t>>8&255,255&t,1):it(t)?new Me(t[0],t[1],t[2]):new Me(255,255,255)}function Ae(t){return t<.04045?.0773993808*t:Math.pow(.9478672986*t+.0521327014,2.4)}function Be(t){return t<.0031308?12.92*t:1.055*Math.pow(t,.41666)-.055}class Te{static Brighter(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;return 1===e?t:new Te(t).brighter(e).toRGBA()}static SetOpacity(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;return 1===e?t:new Te(t).setOpacity(e).toRGBA()}static getColorBrightness(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"hsl";const i=t instanceof Te?t:new Te(t);switch(e){case"hsv":default:return i.getHSVBrightness();case"hsl":return i.getHSLBrightness();case"lum":return i.getLuminance();case"lum2":return i.getLuminance2();case"lum3":return i.getLuminance3()}}static parseColorString(t){if(Y(we[t]))return function(t){return ot(t)?new Me(t>>>24,t>>>16&255,t>>>8&255,255&t):it(t)?new Me(t[0],t[1],t[2],t[3]):new Me(255,255,255,1)}(we[t]);if(Y(xe[t]))return Se(xe[t]);const e=`${t}`.trim().toLowerCase(),i=ve.exec(e);if(i){const t=parseInt(i[1],16),e=i[1].length;return 3===e?new Me((t>>8&15)+((t>>8&15)<<4),(t>>4&15)+((t>>4&15)<<4),(15&t)+((15&t)<<4),1):6===e?Se(t):8===e?new Me(t>>24&255,t>>16&255,t>>8&255,(255&t)/255):void 0}if(/^(rgb|RGB|rgba|RGBA)/.test(e)){const t=e.replace(/(?:\(|\)|rgba|RGBA|rgb|RGB)*/g,"").split(",");return new Me(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(","),i=ye(parseInt(t[0],10),parseInt(t[1],10),parseInt(t[2],10));return new Me(i.r,i.g,i.b,parseFloat(t[3]))}}constructor(t){const e=Te.parseColorString(t);this.color=e||new Me(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:i,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(i*t))),this.color.b=Math.max(0,Math.min(255,Math.floor(r*t))),this}add(t){const{r:e,g:i,b:r}=this.color;return this.color.r+=Math.min(255,e+t.color.r),this.color.g+=Math.min(255,i+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:i,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(i*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,i){const r=this.color.opacity,n=Ce(this.color.r,this.color.g,this.color.b),o=ye(X(t)?n.h:Wt(t,0,360),X(e)?n.s:e>=0&&e<=1?100*e:e,X(i)?n.l:i<=1&&i>=0?100*i:i);return this.color=new Me(o.r,o.g,o.b,r),this}setRGB(t,e,i){return!X(t)&&(this.color.r=t),!X(e)&&(this.color.g=e),!X(i)&&(this.color.b=i),this}setHex(t){const e=`${t}`.trim().toLowerCase(),i=ve.exec(e),r=parseInt(i[1],16),n=i[1].length;return 3===n?new Me((r>>8&15)+((r>>8&15)<<4),(r>>4&15)+((r>>4&15)<<4),(15&r)+((15&r)<<4),1):6===n?Se(r):8===n?new Me(r>>24&255,r>>16&255,r>>8&255,(255&r)/255):this}setColorName(t){const e=xe[t.toLowerCase()];return void 0!==e&&this.setHex(e),this}setScalar(t){return this.color.r=t,this.color.g=t,this.color.b=t,this}setOpacity(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]: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}clone(){return new Te(this.color.toString())}copyGammaToLinear(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]: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){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:2;const i=e>0?1/e:1;return this.color.r=Math.pow(t.color.r,i),this.color.g=Math.pow(t.color.g,i),this.color.b=Math.pow(t.color.b,i),this}convertGammaToLinear(t){return this.copyGammaToLinear(this,t),this}convertLinearToGamma(t){return this.copyLinearToGamma(this,t),this}copySRGBToLinear(t){return this.color.r=Ae(t.color.r),this.color.g=Ae(t.color.g),this.color.b=Ae(t.color.b),this}copyLinearToSRGB(t){return this.color.r=Be(t.color.r),this.color.g=Be(t.color.g),this.color.b=Be(t.color.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}}class Me{constructor(t,e,i,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(+i)?255:Math.max(0,Math.min(255,+i)),Y(r)?this.opacity=isNaN(+r)?1:Math.max(0,Math.min(1,+r)):this.opacity=1}formatHex(){return`#${_e(this.r)+_e(this.g)+_e(this.b)+(1===this.opacity?"":_e(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:i,l:r}=Ce(this.r,this.g,this.b);return`${1===t?"hsl(":"hsla("}${e},${i}%,${r}%${1===t?")":`,${t})`}`}toString(){return this.formatHex()}}var Re=Object.freeze({__proto__:null,Color:Te,DEFAULT_COLORS:xe,RGB:Me,hexToRgb:function(t){let e="",i="",r="";const n="#"===t[0]?1:0;for(let o=n;o<t.length;o++)"#"!==t[o]&&(o<n+2?e+=t[o]:o<n+4?i+=t[o]:o<n+6&&(r+=t[o]));return[parseInt(e,16),parseInt(i,16),parseInt(r,16)]},hslToRgb:ye,interpolateRgb:function(t,e){const i=t.r,r=e.r,n=t.g,o=e.g,s=t.b,a=e.b,l=t.opacity,h=e.opacity;return t=>{const e=Math.round(i*(1-t)+r*t),c=Math.round(n*(1-t)+o*t),d=Math.round(s*(1-t)+a*t);return new Me(e,c,d,l*(1-t)+h*t)}},rgbToHex:function(t,e,i){return Number((1<<24)+(t<<16)+(e<<8)+i).toString(16).slice(1)},rgbToHsl:Ce});let Pe,Ee,He,Le,ke,Ie,Fe,ze;function Oe(t,e,i){return null===t?e:null===e?t:(Pe=t.x1,Ee=t.x2,He=t.y1,Le=t.y2,ke=e.x1,Ie=e.x2,Fe=e.y1,ze=e.y2,i&&(Pe>Ee&&([Pe,Ee]=[Ee,Pe]),He>Le&&([He,Le]=[Le,He]),ke>Ie&&([ke,Ie]=[Ie,ke]),Fe>ze&&([Fe,ze]=[ze,Fe])),Pe>=Ie||Ee<=ke||He>=ze||Le<=Fe?{x1:0,y1:0,x2:0,y2:0}:{x1:Math.max(Pe,ke),y1:Math.max(He,Fe),x2:Math.min(Ee,Ie),y2:Math.min(Le,ze)})}var De;function We(t,e,i){return!(t&&e&&(i?(Pe=t.x1,Ee=t.x2,He=t.y1,Le=t.y2,ke=e.x1,Ie=e.x2,Fe=e.y1,ze=e.y2,Pe>Ee&&([Pe,Ee]=[Ee,Pe]),He>Le&&([He,Le]=[Le,He]),ke>Ie&&([ke,Ie]=[Ie,ke]),Fe>ze&&([Fe,ze]=[ze,Fe]),Pe>Ie||Ee<ke||He>ze||Le<Fe):t.x1>e.x2||t.x2<e.x1||t.y1>e.y2||t.y2<e.y1))}function Ne(t,e){return Math.abs(e[0]*t[0]+e[1]*t[1])}function Ge(t,e){let{x:i,y:r}=t,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{x:0,y:0};return{x:(i-n.x)*Math.cos(e)+(r-n.y)*Math.sin(e)+n.x,y:(i-n.x)*Math.sin(e)+(n.y-r)*Math.cos(e)+n.y}}function je(t){return t/180*Math.PI}function Ue(t){return{x:(t.x1+t.x2)/2,y:(t.y1+t.y2)/2}}function Ve(t,e){const i=e?t.angle:je(t.angle),r=Ue(t);return[Ge({x:t.x1,y:t.y1},i,r),Ge({x:t.x2,y:t.y1},i,r),Ge({x:t.x2,y:t.y2},i,r),Ge({x:t.x1,y:t.y2},i,r)]}!function(t){t[t.NONE=0]="NONE",t[t.BBOX1=1]="BBOX1",t[t.BBOX2=2]="BBOX2"}(De||(De={}));const Ke=t=>{let e=t.charCodeAt(0),i=2===t.length?t.charCodeAt(1):0,r=e;return 55296<=e&&e<=56319&&56320<=i&&i<=57343&&(e&=1023,i&=1023,r=e<<10|i,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"};class $e{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(),Y(t.specialCharSet)&&(this.specialCharSet=t.specialCharSet),this._standardMethod=Y(t.getTextBounds)?this.fullMeasure.bind(this):this.measureWithNaiveCanvas.bind(this)}initContext(){if(this._notSupportCanvas)return!1;if(X(this._canvas)&&(Y(this._option.getCanvasForMeasure)&&(this._canvas=this._option.getCanvasForMeasure()),X(this._canvas)&&"undefined"!=typeof window&&void 0!==window.document&&globalThis&&Y(globalThis.document)&&(this._canvas=globalThis.document.createElement("canvas"))),X(this._context)&&Y(this._canvas)){const t=this._canvas.getContext("2d");Y(t)&&(t.save(),t.font=function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{fontStyle:i=e.fontStyle,fontVariant:r=e.fontVariant,fontWeight:n=e.fontWeight,fontSize:o=e.fontSize,fontFamily:s=e.fontFamily}=t;return(i?i+" ":"")+(r?r+" ":"")+(n?n+" ":"")+o+"px "+(s||"sans-serif")}(this.textSpec),this._contextSaved=!0,this._context=t)}return!X(this._context)||(this._notSupportCanvas=!0,!1)}_initSpec(){var t,e,i;const{defaultFontParams:r={}}=this._option,{fontStyle:n=r.fontStyle,fontVariant:o=r.fontVariant,fontWeight:s=(null!==(t=r.fontWeight)&&void 0!==t?t:"normal"),fontSize:a=(null!==(e=r.fontSize)&&void 0!==e?e:12),fontFamily:l=(null!==(i=r.fontFamily)&&void 0!==i?i:"sans-serif"),align:h,textAlign:c=(null!=h?h:"center"),baseline:d,textBaseline:u=(null!=d?d:"middle"),ellipsis:g,limit:p}=this._userSpec;let{lineHeight:f=a}=this._userSpec;if(et(f)&&"%"===f[f.length-1]){const t=Number.parseFloat(f.substring(0,f.length-1))/100;f=a*t}return{fontStyle:n,fontVariant:o,fontFamily:l,fontSize:a,fontWeight:s,textAlign:c,textBaseline:u,ellipsis:g,limit:p,lineHeight:f}}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(X(t))return{width:0,height:0};if(X(this._option.getTextBounds)||!this._notSupportVRender)return this.measureWithNaiveCanvas(t);const{fontFamily:e,fontSize:i,fontWeight:r,textAlign:n,textBaseline:o,ellipsis:s,limit:a,lineHeight:l}=this.textSpec;let h;try{const c=this._option.getTextBounds({text:t,fontFamily:e,fontSize:i,fontWeight:r,textAlign:n,textBaseline:o,ellipsis:!!s,maxLineWidth:a||1/0,lineHeight:l});h={width:c.width(),height:c.height()}}catch(e){this._notSupportVRender=!0,h=this.measureWithNaiveCanvas(t)}return h}measureWithNaiveCanvas(t){return this._measureReduce(t,this._measureWithNaiveCanvas.bind(this))}_measureWithNaiveCanvas(t){var e;if(!this.initContext())return this._quickMeasureWithoutCanvas(t);const i=this._context.measureText(t),{fontSize:r,lineHeight:n}=this.textSpec;return{width:i.width,height:null!==(e=n)&&void 0!==e?e:r}}quickMeasure(t){return this._measureReduce(t,this._quickMeasure.bind(this))}_quickMeasure(t){const e={width:0,height:0};for(let i=0;i<t.length;i++){const r=t[i];let n=this._measureSpecialChar(r);X(n)&&$e.NUMBERS_CHAR_SET.includes(r)&&(n=this._measureNumberChar()),X(n)&&["F","W"].includes(Ke(r))&&(n=this._measureFullSizeChar()),X(n)&&(n=this._measureLetterChar()),e.width+=n.width,e.height=Math.max(e.height,n.height)}return e}quickMeasureWithoutCanvas(t){return this._measureReduce(t,this._quickMeasureWithoutCanvas.bind(this))}_quickMeasureWithoutCanvas(t){var e;const i={width:0,height:0},{fontSize:r,lineHeight:n}=this.textSpec;for(let e=0;e<t.length;e++){const n=t[e],o=["F","W"].includes(Ke(n))?1:.53;i.width+=o*r}return i.height=null!==(e=n)&&void 0!==e?e:r,i}_measureReduce(t,e){var i;const{fontSize:r,lineHeight:n}=this.textSpec,o={width:0,height:0};if(X(t))return o;if(it(t)){const s=t.filter(Y).map((t=>t.toString()));return 0===s.length?o:1===s.length?e(s[0]):{width:s.reduce(((t,i)=>Math.max(t,e(i).width)),0),height:s.length*((null!==(i=n)&&void 0!==i?i:r)+1)+1}}return e(t.toString())}_measureNumberChar(){if(X(this._numberCharSize)){const t=this._standardMethod($e.NUMBERS_CHAR_SET);this._numberCharSize={width:t.width/$e.NUMBERS_CHAR_SET.length,height:t.height}}return this._numberCharSize}_measureFullSizeChar(){return X(this._fullCharSize)&&(this._fullCharSize=this._standardMethod($e.FULL_SIZE_CHAR)),this._fullCharSize}_measureLetterChar(){if(X(this._letterCharSize)){const t=this._standardMethod($e.ALPHABET_CHAR_SET);this._letterCharSize={width:t.width/$e.ALPHABET_CHAR_SET.length,height:t.height}}return this._letterCharSize}_measureSpecialChar(t){return Y(this._specialCharSizeMap[t])?this._specialCharSizeMap[t]:this.specialCharSet.includes(t)?(this._specialCharSizeMap[t]=this._standardMethod(t),this._specialCharSizeMap[t]):null}release(){Y(this._canvas)&&(this._canvas=null),Y(this._context)&&(this._contextSaved&&(this._context.restore(),this._contextSaved=!1),this._context=null)}}$e.ALPHABET_CHAR_SET="abcdefghijklmnopqrstuvwxyz",$e.NUMBERS_CHAR_SET="0123456789",$e.FULL_SIZE_CHAR="字";const Xe="undefined"!=typeof console;function Ye(t,e,i){const r=[e].concat([].slice.call(i));Xe&&console[t].apply(console,r)}var qe;!function(t){t[t.None=0]="None",t[t.Error=1]="Error",t[t.Warn=2]="Warn",t[t.Info=3]="Info",t[t.Debug=4]="Debug"}(qe||(qe={}));class Ze{static getInstance(t,e){return Ze._instance&&ot(t)?Ze._instance.level(t):Ze._instance||(Ze._instance=new Ze(t,e)),Ze._instance}static setInstance(t){return Ze._instance=t}static setInstanceLevel(t){Ze._instance?Ze._instance.level(t):Ze._instance=new Ze(t)}static clearInstance(){Ze._instance=null}constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:qe.None,e=arguments.length>1?arguments[1]:void 0;this._onErrorHandler=[],this._level=t,this._method=e}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(){for(var t=arguments.length,e=new Array(t),i=0;i<t;i++)e[i]=arguments[i];this._onErrorHandler.forEach((t=>t(...e)))}canLogInfo(){return this._level>=qe.Info}canLogDebug(){return this._level>=qe.Debug}canLogError(){return this._level>=qe.Error}canLogWarn(){return this._level>=qe.Warn}level(t){return arguments.length?(this._level=+t,this):this._level}error(){for(var t,e=arguments.length,i=new Array(e),r=0;r<e;r++)i[r]=arguments[r];return this._level>=qe.Error&&(this._onErrorHandler.length?this.callErrorHandler(...i):Ye(null!==(t=this._method)&&void 0!==t?t:"error","ERROR",i)),this}warn(){for(var t=arguments.length,e=new Array(t),i=0;i<t;i++)e[i]=arguments[i];return this._level>=qe.Warn&&Ye(this._method||"warn","WARN",e),this}info(){for(var t=arguments.length,e=new Array(t),i=0;i<t;i++)e[i]=arguments[i];return this._level>=qe.Info&&Ye(this._method||"log","INFO",e),this}debug(){for(var t=arguments.length,e=new Array(t),i=0;i<t;i++)e[i]=arguments[i];return this._level>=qe.Debug&&Ye(this._method||"log","DEBUG",e),this}}function Je(t){if(st(t))return[t,t,t,t];if(it(t)){const e=t.length;if(1===e){const e=t[0];return[e,e,e,e]}if(2===e){const[e,i]=t;return[e,i,e,i]}if(3===e){const[e,i,r]=t;return[e,i,r,i]}if(4===e)return t}if(q(t)){const{top:e=0,right:i=0,bottom:r=0,left:n=0}=t;return[e,i,r,n]}return[0,0,0,0]}Ze._instance=null;const Qe=qt-1e-8;class ti{constructor(t){this.init(t)}init(t){this.bounds=t}arc(t,e,i,r,n,o){if(Math.abs(n-r)>Qe)return this.bounds.add(t-i,e-i),void this.bounds.add(t+i,e+i);let s,a,l,h,c=1/0,d=-1/0,u=1/0,g=-1/0;function p(t){l=i*Math.cos(t),h=i*Math.sin(t),l<c&&(c=l),l>d&&(d=l),h<u&&(u=h),h>g&&(g=h)}if(p(r),p(n),n!==r)if((r%=qt)<0&&(r+=qt),(n%=qt)<0&&(n+=qt),n<r&&(o=!o,s=r,r=n,n=s),o)for(n-=qt,s=r-r%Yt,a=0;a<4&&s>n;++a,s-=Yt)p(s);else for(s=r-r%Yt+Yt,a=0;a<4&&s<n;++a,s+=Yt)p(s);this.bounds.add(t+c,e+u),this.bounds.add(t+d,e+g)}arcTo(t,e,i,r,n){throw new Error("不支持arcTo")}bezierCurveTo(t,e,i,r,n,o){this.bounds.add(t,e),this.bounds.add(i,r),this.bounds.add(n,o)}closePath(){}ellipse(){throw new Error("不支持ellipse")}lineTo(t,e){this.bounds.add(t,e)}moveTo(t,e){this.bounds.add(t,e)}quadraticCurveTo(t,e,i,r){this.bounds.add(t,e),this.bounds.add(i,r)}rect(t,e,i,r){this.bounds.add(t,e),this.bounds.add(t+i,e+r)}clear(){this.bounds.clear()}release(){}}class ei{constructor(){this.curves=[],this.bounds=new ge}getCurveLengths(){return this.curves.map((t=>t.getLength()))}getPointAt(t){return{x:0,y:0}}getLength(){return 0}getBounds(){return this.bounds}}const ii=/([-+]?((\d+\.\d+)|((\d+)|(\.\d+)))(?:[eE][-+]?\d+)?)/gi,ri={m:2,l:2,h:1,v:1,c:6,s:4,q:4,t:2,a:7,M:2,L:2,H:1,V:1,C:6,S:4,Q:4,T:2,A:7},ni=0,oi=1,si=2,ai=3,li=4,hi=5,ci=6,di=7,ui=8;let gi,pi,fi,mi,bi,yi;var Ci,vi,wi,xi,_i,Si,Ai,Bi,Ti;function Mi(t){const e=t[0],i=t[1],r=t[2],n=t[3],o=t[4],s=t[5],a=t[6],l=t[7],h=l*o,c=-a*s,d=a*o,u=l*s,g=Math.cos(r),p=Math.sin(r),f=Math.cos(n),m=Math.sin(n),b=.5*(n-r),y=Math.sin(.5*b),C=8/3*y*y/Math.sin(b),v=e+g-C*p,w=i+p+C*g,x=e+f,_=i+m,S=x+C*m,A=_-C*f;return[h*v+c*w,d*v+u*w,h*S+c*A,d*S+u*A,h*x+c*_,d*x+u*_]}function Ri(t,e,i,r){const n=function(t,e,i,r,n,o,s,a,l){const h=pe(s),c=Math.sin(h),d=Math.cos(h),u=d*(a-t)*.5+c*(l-e)*.5,g=d*(l-e)*.5-c*(a-t)*.5;let p=u*u/((i=Math.abs(i))*i)+g*g/((r=Math.abs(r))*r);p>1&&(p=Math.sqrt(p),i*=p,r*=p);const f=d/i,m=c/i,b=-c/r,y=d/r,C=f*a+m*l,v=b*a+y*l,w=f*t+m*e,x=b*t+y*e;let _=1/((w-C)*(w-C)+(x-v)*(x-v))-.25;_<0&&(_=0);let S=Math.sqrt(_);o===n&&(S=-S);const A=.5*(C+w)-S*(x-v),B=.5*(v+x)+S*(w-C),T=Math.atan2(v-B,C-A);let M=Math.atan2(x-B,w-A)-T;M<0&&1===o?M+=qt:M>0&&0===o&&(M-=qt);const R=Math.ceil(Math.abs(M/(Yt+.001))),P=[];for(let t=0;t<R;++t){const e=T+t*M/R,n=T+(t+1)*M/R;P[t]=[A,B,e,n,i,r,c,d]}return P}(r[5],r[6],r[0],r[1],r[3],r[4],r[2],e,i);for(let e=0;e<n.length;++e){const i=Mi(n[e]);t.bezierCurveTo(i[0],i[1],i[2],i[3],i[4],i[5])}}!function(t){t[t.NONE=0]="NONE",t[t.UPDATE_BOUNDS=1]="UPDATE_BOUNDS",t[t.UPDATE_SHAPE=2]="UPDATE_SHAPE",t[t.CLEAR_SHAPE=253]="CLEAR_SHAPE",t[t.UPDATE_SHAPE_AND_BOUNDS=3]="UPDATE_SHAPE_AND_BOUNDS",t[t.INIT=179]="INIT",t[t.CLEAR_BOUNDS=254]="CLEAR_BOUNDS",t[t.UPDATE_GLOBAL_MATRIX=32]="UPDATE_GLOBAL_MATRIX",t[t.CLEAR_GLOBAL_MATRIX=223]="CLEAR_GLOBAL_MATRIX",t[t.UPDATE_LOCAL_MATRIX=16]="UPDATE_LOCAL_MATRIX",t[t.CLEAR_LOCAL_MATRIX=239]="CLEAR_LOCAL_MATRIX",t[t.UPDATE_GLOBAL_LOCAL_MATRIX=48]="UPDATE_GLOBAL_LOCAL_MATRIX",t[t.UPDATE_LAYOUT=128]="UPDATE_LAYOUT",t[t.CLEAR_LAYOUT=127]="CLEAR_LAYOUT"}(Ci||(Ci={})),function(t){t[t.GLOBAL=1]="GLOBAL",t[t.LOCAL=16]="LOCAL",t[t.GLOBAL_ACCURATE=3]="GLOBAL_ACCURATE",t[t.LOCAL_ACCURATE=48]="LOCAL_ACCURATE"}(vi||(vi={})),function(t){t[t.INIT=0]="INIT",t[t.DEFAULT=1]="DEFAULT",t[t.STATE=2]="STATE",t[t.ANIMATE_BIND=10]="ANIMATE_BIND",t[t.ANIMATE_PLAY=11]="ANIMATE_PLAY",t[t.ANIMATE_START=12]="ANIMATE_START",t[t.ANIMATE_UPDATE=13]="ANIMATE_UPDATE",t[t.ANIMATE_END=14]="ANIMATE_END",t[t.TRANSLATE=20]="TRANSLATE",t[t.TRANSLATE_TO=21]="TRANSLATE_TO",t[t.SCALE=22]="SCALE",t[t.SCALE_TO=23]="SCALE_TO",t[t.ROTATE=24]="ROTATE",t[t.ROTATE_TO=25]="ROTATE_TO"}(wi||(wi={})),function(t){t[t.INITIAL=0]="INITIAL",t[t.RUNNING=1]="RUNNING",t[t.PAUSED=2]="PAUSED",t[t.END=3]="END"}(xi||(xi={})),function(t){t[t.NORMAL=0]="NORMAL",t[t.SET_ATTR_IMMEDIATELY=1]="SET_ATTR_IMMEDIATELY"}(_i||(_i={})),function(t){t.wait="wait",t.from="from",t.to="to",t.customAnimate="customAnimate"}(Si||(Si={})),function(t){t[t.ROW=1]="ROW",t[t.COLUMN=2]="COLUMN"}(Ai||(Ai={})),function(t){t[t.CubicBezierCurve=0]="CubicBezierCurve",t[t.QuadraticBezierCurve=1]="QuadraticBezierCurve",t[t.ArcCurve=2]="ArcCurve",t[t.LineCurve=3]="LineCurve",t[t.EllipseCurve=4]="EllipseCurve",t[t.MoveCurve=5]="MoveCurve"}(Bi||(Bi={})),function(t){t[t.beforeFillStroke=0]="beforeFillStroke",t[t.afterFillStroke=1]="afterFillStroke"}(Ti||(Ti={}));const Pi=[(t,e,i,r,n,o,s)=>e.arc(t[1]*n+i,t[2]*o+r,t[3]*(n+o)/2,t[4],t[5],t[6],s),(t,e,i,r,n,o,s)=>e.arcTo(t[1]*n+i,t[2]*o+r,t[3]*n+i,t[4]*o+r,t[5]*(n+o)/2,s),(t,e,i,r,n,o,s)=>e.bezierCurveTo(t[1]*n+i,t[2]*o+r,t[3]*n+i,t[4]*o+r,t[5]*n+i,t[6]*o+r,s),(t,e,i,r)=>e.closePath(),(t,e,i,r,n,o)=>e.ellipse(t[1]*n+i,t[2]*o+r,t[3]*n,t[4]*o,t[5],t[6],t[7],t[8]),(t,e,i,r,n,o,s)=>e.lineTo(t[1]*n+i,t[2]*o+r,s),(t,e,i,r,n,o,s)=>e.moveTo(t[1]*n+i,t[2]*o+r,s),(t,e,i,r,n,o,s)=>e.quadraticCurveTo(t[1]*n+i,t[2]*o+r,t[3]*n+i,t[4]*o+r,s),(t,e,i,r,n,o,s)=>e.rect(t[1]*n+i,t[2]*o+r,t[3]*n,t[4]*o,s)];function Ei(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,n=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1,o=arguments.length>5&&void 0!==arguments[5]?arguments[5]:1,s=arguments.length>6?arguments[6]:void 0;for(let a=0;a<t.length;a++){const l=t[a];Pi[l[0]](l,e,i,r,n,o,s)}}class Hi{getLength(t){return null!=t?this.calcProjLength(t):(Number.isFinite(this.length)||(this.length=this.calcLength()),this.length)}}function Li(t,e,i,r,n){return function(t,e){let i=0;const r=t.length;for(let n=0;n<r;n++){const o=t[n],s=e[n],a=t[(n+1)%r],l=e[(n+1)%r];i+=ce.distanceNN(o,s,a,l)}return i/2}([t.x,e.x,i.x,r.x],[t.y,e.y,i.y,r.y])}function ki(t,e,i,r,n){const o=1-n;return o*o*o*t+3*e*n*o*o+3*i*n*n*o+r*n*n*n}function Ii(t,e,i,r,n){const o=ki(t.x,e.x,i.x,r.x,n),s=ki(t.y,e.y,i.y,r.y,n);return new he(o,s)}function Fi(t,e){const{p0:i,p1:r,p2:n,p3:o}=t,s=Ii(i,r,n,o,e),a=ce.pointAtPP(i,r,e),l=ce.pointAtPP(r,n,e),h=ce.pointAtPP(n,o,e),c=ce.pointAtPP(a,l,e),d=ce.pointAtPP(l,h,e);return[new zi(i,a,c,s),new zi(s,d,h,o)]}class zi extends Hi{constructor(t,e,i,r){super(),this.type=Bi.CubicBezierCurve,this.p0=t,this.p1=e,this.p2=i,this.p3=r}_validPoint(){return Number.isFinite(this.p0.x+this.p0.y+this.p1.x+this.p1.y+this.p2.x+this.p2.y+this.p3.x+this.p3.y)}getPointAt(t){if(!1!==this.defined)return Ii(this.p0,this.p1,this.p2,this.p3,t);throw new Error("defined为false的点不能getPointAt")}calcLength(){return this._validPoint()?Li(this.p0,this.p1,this.p2,this.p3):60}calcProjLength(t){return t===Ai.ROW?Jt(this.p0.x-this.p3.x):t===Ai.COLUMN?Jt(this.p0.y-this.p3.y):0}getAngleAt(t){const e=ee(t-.01,0),i=ie(t+.01,1),r=this.getPointAt(e),n=this.getPointAt(i);return Qt(n.y-r.y,n.x-r.x)}}function Oi(t,e){const{p0:i,p1:r}=t,n=ce.pointAtPP(i,r,e);return[new Di(i,n),new Di(n,r)]}class Di extends Hi{constructor(t,e){super(),this.type=Bi.LineCurve,this.p0=t,this.p1=e}getPointAt(t){if(!1!==this.defined)return ce.pointAtPP(this.p0,this.p1,t);throw new Error("defined为false的点不能getPointAt")}getAngleAt(t){return null==this.angle&&(this.angle=Qt(this.p1.y-this.p0.y,this.p1.x-this.p0.x)),this.angle}_validPoint(){return Number.isFinite(this.p0.x+this.p0.y+this.p1.x+this.p1.y)}calcLength(){return this._validPoint()?ce.distancePP(this.p0,this.p1):60}calcProjLength(t){return t===Ai.ROW?Jt(this.p0.x-this.p1.x):t===Ai.COLUMN?Jt(this.p0.y-this.p1.y):0}}class Wi{get endX(){return this._lastX}get endY(){return this._lastY}constructor(t,e){this.init(t,e)}init(t,e){this._lastX=this._lastY=this._startX=this._startY=0,this.curveType=t,this.direction=e,this.curves=[]}bezierCurveTo(t,e,i,r,n,o,s,a){const l=new zi(new he(this._lastX,this._lastY),new he(t,e),new he(i,r),new he(n,o));l.originP1=this._lastOriginP,l.originP2=a,l.defined=s,this.curves.push(l),this._lastX=n,this._lastY=o,this._lastOriginP=a}closePath(){if(this.curves.length<2)return;const t=this.curves[this.curves.length-1];this.lineTo(this._startX,this._startY,t.defined,this._startOriginP)}ellipse(){throw new Error("SegContext不支持调用ellipse")}lineTo(t,e,i,r){const n=this.addLinearCurve(t,e,i,this._lastOriginP,r);this.curves.push(n),this._lastX=t,this._lastY=e,this._lastOriginP=r}moveTo(t,e,i){return this._lastX=this._startX=t,this._lastY=this._startY=e,this._lastOriginP=i,this._startOriginP=i,this}quadraticCurveTo(t,e,i,r){throw new Error("SegContext不支持调用quadraticCurveTo")}clear(){this.curves=[],this.length=NaN}tryUpdateLength(t){return this.getLength(t)}addLinearCurve(t,e,i,r,n){const o=new Di(new he(this._lastX,this._lastY),new he(t,e));return o.originP1=r,o.originP2=n,o.defined=i,o}getPointAt(t){throw new Error("暂未实现")}getCurveLengths(){return[]}getLength(t){var e,i;if(t===Ai.COLUMN){if(!this.curves.length)return 0;const t=this.curves[0],i=this.curves[this.curves.length-1],r=null!==(e=i.p3)&&void 0!==e?e:i.p1;return Jt(t.p0.y-r.y)}if(t===Ai.ROW){if(!this.curves.length)return 0;const t=this.curves[0],e=this.curves[this.curves.length-1],r=null!==(i=e.p3)&&void 0!==i?i:e.p1;return Jt(t.p0.x-r.x)}return Number.isFinite(this.length)||(this.length=this.curves.reduce(((t,e)=>t+e.getLength()),0)),this.length}}class Ni extends Wi{bezierCurveTo(t,e,i,r,n,o,s,a){return super.bezierCurveTo(e,t,r,i,o,n,s,a)}lineTo(t,e,i,r){return super.lineTo(e,t,i,r)}moveTo(t,e,i){return super.moveTo(e,t,i)}clear(){return super.clear()}}function Gi(t,e){let i=!1;for(let r=0,n=e.length;r<=n;r++)r>=n===i&&((i=!i)?t.lineStart():t.lineEnd()),i&&t.point(e[r])}function ji(t,e,i){const r=null!=e?e:Jt(i[i.length-1].x-i[0].x)>Jt(i[i.length-1].y-i[0].y)?Ai.ROW:Ai.COLUMN;return"monotoneY"===t?new Ni(t,r):new Wi(t,r)}class Ui{constructor(t,e){this.context=t,e&&(this.startPoint=e)}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._point=0,this.startPoint&&this.point(this.startPoint)}lineEnd(){(this._line||0!==this._line&&1===this._point)&&this.context.closePath(),this._line=1-this._line}point(t){const e=t.x,i=t.y;switch(this._point){case 0:this._point=1,this._line?this.context.lineTo(e,i,!1!==this._lastDefined&&!1!==t.defined,t):this.context.moveTo(e,i,t);break;case 1:this._point=2;default:this.context.lineTo(e,i,!1!==this._lastDefined&&!1!==t.defined,t)}this._lastDefined=t.defined}tryUpdateLength(){return this.context.tryUpdateLength()}}function Vi(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{direction:i,startPoint:r}=e;if(t.length<2-Number(!!r))return null;const n=ji("linear",i,t);return function(t,e){Gi(t,e)}(new Ui(n,r),t),n}function Ki(t,e,i,r,n){t.context.bezierCurveTo((2*t._x0+t._x1)/3,(2*t._y0+t._y1)/3,(t._x0+2*t._x1)/3,(t._y0+2*t._y1)/3,(t._x0+4*t._x1+e)/6,(t._y0+4*t._y1+i)/6,r,t.lastPoint1)}class $i{constructor(t,e){this.context=t,this.startPoint=e}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0,this.startPoint&&this.point(this.startPoint)}lineEnd(){2===this._point&&Ki(this,6*this._x1-(this._x0+4*this._x1),6*this._y1-(this._y0+4*this._y1),!1!==this._lastDefined1&&!1!==this._lastDefined2,this.lastPoint1),(this._line||0!==this._line&&1===this._point)&&this.context.closePath(),this._line=1-this._line}point(t){const e=t.x,i=t.y;switch(this._point){case 0:this._point=1,this._line?this.context.lineTo(e,i,!1!==this._lastDefined1&&!1!==this._lastDefined2,t):this.context.moveTo(e,i,t);break;case 1:this._point=2;break;default:Ki(this,e,i,!1!==this._lastDefined1&&!1!==this._lastDefined2)}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=i,this._lastDefined1=this._lastDefined2,this._lastDefined2=t.defined,this.lastPoint0=this.lastPoint1,this.lastPoint1=t}tryUpdateLength(){return this.context.tryUpdateLength()}}function Xi(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{direction:i,startPoint:r}=e;if(t.length<2-Number(!!r))return null;if(t.length<3-Number(!!r))return Vi(t,e);const n=ji("basis",i,t);return function(t,e){Gi(t,e)}(new $i(n,r),t),n}function Yi(t){return t<0?-1:1}function qi(t,e,i){const r=t._x1-t._x0,n=e-t._x1,o=(t._y1-t._y0)/(r||Number(n<0&&-0)),s=(i-t._y1)/(n||Number(r<0&&-0)),a=(o*n+s*r)/(r+n);return(Yi(o)+Yi(s))*Math.min(Math.abs(o),Math.abs(s),.5*Math.abs(a))||0}function Zi(t,e){const i=t._x1-t._x0;return i?(3*(t._y1-t._y0)/i-e)/2:e}function Ji(t,e,i,r,n){const o=t._x0,s=t._y0,a=t._x1,l=t._y1,h=(a-o)/3;t.context.bezierCurveTo(o+h,s+h*e,a-h,l-h*i,a,l,r,t.lastPoint1)}class Qi{constructor(t,e){this.context=t,this.startPoint=e}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._x0=this._x1=this._y0=this._y1=this._t0=NaN,this._point=0,this.startPoint&&this.point(this.startPoint)}lineEnd(){switch(this._point){case 2:this.context.lineTo(this._x1,this._y1,!1!==this._lastDefined1&&!1!==this._lastDefined2,this.lastPoint1);break;case 3:Ji(this,this._t0,Zi(this,this._t0),!1!==this._lastDefined1&&!1!==this._lastDefined2,this.lastPoint1)}(this._line||0!==this._line&&1===this._point)&&this.context.closePath(),this._line=1-this._line}point(t){let e=NaN;const i=t.x,r=t.y;switch(this._point){case 0:this._point=1,this._line?this.context.lineTo(i,r,!1!==this._lastDefined1&&!1!==this._lastDefined2,t):this.context.moveTo(i,r,t);break;case 1:this._point=2;break;case 2:this._point=3,Ji(this,Zi(this,e=qi(this,i,r)),e,!1!==this._lastDefined1&&!1!==this._lastDefined2);break;default:Ji(this,this._t0,e=qi(this,i,r),!1!==this._lastDefined1&&!1!==this._lastDefined2)}this._x0=this._x1,this._x1=i,this._y0=this._y1,this._y1=r,this._t0=e,this._lastDefined1=this._lastDefined2,this._lastDefined2=!1!==t.defined,this.lastPoint0=this.lastPoint1,this.lastPoint1=t}tryUpdateLength(){return this.context.tryUpdateLength()}}class tr extends Qi{constructor(t,e){super(t,e)}point(t){return super.point({y:t.x,x:t.y,defined:t.defined})}}function er(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{direction:i,startPoint:r}=e;if(t.length<2-Number(!!r))return null;if(t.length<3-Number(!!r))return Vi(t,e);const n=ji("monotoneX",i,t);return function(t,e){Gi(t,e)}(new Qi(n,r),t),n}function ir(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{direction:i,startPoint:r}=e;if(t.length<2-Number(!!r))return null;if(t.length<3-Number(!!r))return Vi(t,e);const n=ji("monotoneY",i,t);return function(t,e){Gi(t,e)}(new tr(n,r),t),n}let rr=class{constructor(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:.5,i=arguments.length>2?arguments[2]:void 0;this.context=t,this._t=e,this.startPoint=i}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._x=this._y=NaN,this._point=0,this.startPoint&&this.point(this.startPoint)}lineEnd(){0<this._t&&this._t<1&&2===this._point&&this.context.lineTo(this._x,this._y,!1!==this._lastDefined,this.lastPoint),(this._line||0!==this._line&&1===this._point)&&this.context.closePath(),this._line>=0&&(this._t=1-this._t,this._line=1-this._line)}point(t){const e=t.x,i=t.y;switch(this._point){case 0:this._point=1,this._line?this.context.lineTo(e,i,!1!==this._lastDefined&&!1!==t.defined,t):this.context.moveTo(e,i,t);break;case 1:this._point=2;default:if(this._t<=0)this.context.lineTo(this._x,i,!1!==this._lastDefined&&!1!==t.defined,this.lastPoint),this.context.lineTo(e,i,!1!==this._lastDefined&&!1!==t.defined,t);else{const r=this._x*(1-this._t)+e*this._t;this.context.lineTo(r,this._y,!1!==this._lastDefined&&!1!==t.defined,this.lastPoint),this.context.lineTo(r,i,!1!==this._lastDefined&&!1!==t.defined,t)}}this._lastDefined=t.defined,this._x=e,this._y=i,this.lastPoint=t}tryUpdateLength(){return this.context.tryUpdateLength()}};function nr(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const{direction:r,startPoint:n}=i;if(t.length<2-Number(!!n))return null;const o=new Wi("step",null!=r?r:Jt(t[t.length-1].x-t[0].x)>Jt(t[t.length-1].y-t[0].y)?Ai.ROW:Ai.COLUMN);return function(t,e){Gi(t,e)}(new rr(o,e,n),t),o}class or extends Ui{lineEnd(){this.context.closePath()}}function sr(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{direction:i,startPoint:r}=e;if(t.length<2-Number(!!r))return null;const n=ji("linear",i,t);return function(t,e){Gi(t,e)}(new or(n,r),t),n}function ar(t,e,i){switch(e){case"linear":default:return Vi(t,i);case"basis":return Xi(t,i);case"monotoneX":return er(t,i);case"monotoneY":return ir(t,i);case"step":return nr(t,.5,i);case"stepBefore":return nr(t,0,i);case"stepAfter":return nr(t,1,i);case"linearClosed":return sr(t,i)}}class lr extends ei{constructor(t){super(),this.commandList=[],t&&(this._ctx=t),this._boundsContext=new ti(this.bounds)}setCtx(t){this._ctx=t}moveTo(t,e){return this.commandList.push([ci,t,e]),this._ctx&&this._ctx.moveTo(t,e),this}lineTo(t,e){return this.commandList.push([hi,t,e]),this._ctx&&this._ctx.lineTo(t,e),this}quadraticCurveTo(t,e,i,r){return this.commandList.push([di,t,e,i,r]),this._ctx&&this._ctx.quadraticCurveTo(t,e,i,r),this}bezierCurveTo(t,e,i,r,n,o){return this.commandList.push([si,t,e,i,r,n,o]),this._ctx&&this._ctx.bezierCurveTo(t,e,i,r,n,o),this}arcTo(t,e,i,r,n){return this.commandList.push([oi,t,e,i,r,n]),this._ctx&&this._ctx.arcTo(t,e,i,r,n),this}ellipse(t,e,i,r,n,o,s,a){return this.commandList.push([li,t,e,i,r,n,o,s,a]),this._ctx&&this._ctx.ellipse(t,e,i,r,n,o,s,a),this}rect(t,e,i,r){return this.commandList.push([ui,t,e,i,r]),this._ctx&&this._ctx.rect(t,e,i,r),this}arc(t,e,i,r,n,o){return this.commandList.push([ni,t,e,i,r,n,o]),this._ctx&&this._ctx.arc(t,e,i,r,n,o),this}closePath(){return this.commandList.push([ai]),this._ctx&&this._ctx.closePath(),this}addCurve(t){this.curves.push(t)}clear(){this.transformCbList=null,this.commandList.length=0,this.curves.length=0}toString(){if(!this.toStringCbList){const t=[];t[ci]=t=>`M${t[1]} ${t[2]}`,t[hi]=t=>`L${t[1]} ${t[2]}`,t[di]=t=>`Q${t[1]} ${t[2]} ${t[3]} ${t[4]}`,t[si]=t=>`C${t[1]} ${t[2]} ${t[3]} ${t[4]} ${t[5]} ${t[6]}`,t[ni]=t=>{const e=[];((t,e,i,r,n,o,s)=>{const a=Math.abs(i-e),l=4*Math.tan(a/4)/3,h=i<e?-1:1,c=Math.cos(e),d=Math.sin(e),u=Math.cos(i),g=Math.sin(i),p=c*o+r,f=d*s+n,m=u*o+r,b=g*s+n,y=o*l*h,C=s*l*h;t.push(p-y*d,f+C*c,m+y*g,b-C*u,m,b)})(e,t[4],t[5],t[1],t[2],t[3],t[3]);let i="";for(let t=0;t<e.length;t+=6)i+=`C${e[t]} ${e[t+1]} ${e[t+2]} ${e[t+3]} ${e[t+4]} ${e[t+5]}`;return i},t[ai]=t=>"Z",this.toStringCbList=t}const t=this.toStringCbList;let e="";return this.commandList.forEach((i=>{e+=t[i[0]](i)})),e}fromString(t,e,i,r,n){this.clear();const o=function(t){if(!t)return[];const e=t.match(/[mzlhvcsqta][^mzlhvcsqta]*/gi);if(null===e)return[];let i,r;const n=[];for(let t=0,o=e.length;t<o;t++)if(gi=e[t],pi=gi.slice(1),fi=gi[0],i=[fi],r=pi.match(ii),null!==r){for(let t=0,e=r.length;t<e;t++)mi=r[t],bi=parseFloat(mi),Number.isNaN(bi)||i.push(bi);if(yi=ri[fi],i.length-1>yi){let t;for(let e=1,r=i.length;e<r;e+=yi){t=[fi];for(let r=e,n=e+yi;r<n;r++)t.push(i[r]);n.push(t)}}else n.push(i)}else n.push(i);return n}(t);return this._runCommandStrList(o,e,i,r,n),this._updateBounds(),this}fromLine(t){const{points:e,curveType:i,clipRangeByDimension:r}=t.attribute;if(!e)return;const n=ar(e,i);"x"===r?this.direction=Ai.ROW:"y"===r?this.direction=Ai.COLUMN:"auto"===r&&(this.direction=n.direction),this.curves=n.curves}fromCustomPath2D(t,e,i,r,n){return this.clear(),this._runCommandList(t.commandList,e,i,r,n),this._updateBounds(),this}transform(t,e,i,r){const n=this.commandList;if(!this.transformCbList){const t=[];t[ci]=this.moveToTransform,t[hi]=this.lineToTransform,t[di]=this.quadraticCurveToTransform,t[si]=this.bezierCurveToTransform,t[oi]=this.arcToTransform,t[li]=this.ellipseTransform,t[ui]=this.rectTransform,t[ni]=this.arcTransform,t[ai]=this.closePathTransform,this.transformCbList=t}n.forEach((n=>{this.transformCbList[n[0]](n,t,e,i,r)})),this._updateBounds()}moveToTransform(t,e,i,r,n){t[1]=t[1]*r+e,t[2]=t[2]*n+i}lineToTransform(t,e,i,r,n){t[1]=t[1]*r+e,t[2]=t[2]*n+i}quadraticCurveToTransform(t,e,i,r,n){t[1]=t[1]*r+e,t[2]=t[2]*n+i,t[3]=t[3]*r+e,t[4]=t[4]*n+i}bezierCurveToTransform(t,e,i,r,n){t[1]=t[1]*r+e,t[2]=t[2]*n+i,t[3]=t[3]*r+e,t[4]=t[4]*n+i,t[5]=t[5]*r+e,t[6]=t[6]*n+i}arcToTransform(t,e,i,r,n){t[1]=t[1]*r+e,t[2]=t[2]*n+i,t[3]=t[3]*r+e,t[4]=t[4]*n+i,t[5]=t[5]*(r+n)/2}ellipseTransform(t,e,i,r,n){t[1]=t[1]*r+e,t[2]=t[2]*n+i,t[3]=t[3]*r,t[4]=t[4]*n}rectTransform(t,e,i,r,n){t[1]=t[1]*r+e,t[2]=t[2]*n+i,t[3]=t[3]*r,t[4]=t[4]*n}arcTransform(t,e,i,r,n){t[1]=t[1]*r+e,t[2]=t[2]*n+i,t[3]=t[3]*(r+n)/2}closePathTransform(){}_runCommandStrList(t){let e,i,r,n,o,s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,l=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1,h=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1,c=null,d=0,u=0,g=0,p=0;for(let f=0,m=t.length;f<m;++f){switch(e=t[f],1===l&&1===h||(e=cr(e,l,h)),e[0]){case"l":d+=e[1],u+=e[2],this.lineTo(d+s,u+a);break;case"L":d=e[1],u=e[2],this.lineTo(d+s,u+a);break;case"h":d+=e[1],this.lineTo(d+s,u+a);break;case"H":d=e[1],this.lineTo(d+s,u+a);break;case"v":u+=e[1],this.lineTo(d+s,u+a);break;case"V":u=e[1],this.lineTo(d+s,u+a);break;case"m":d+=e[1],u+=e[2],this.moveTo(d+s,u+a);break;case"M":d=e[1],u=e[2],this.moveTo(d+s,u+a);break;case"c":i=d+e[5],r=u+e[6],g=d+e[3],p=u+e[4],this.bezierCurveTo(d+e[1]+s,u+e[2]+a,g+s,p+a,i+s,r+a),d=i,u=r;break;case"C":d=e[5],u=e[6],g=e[3],p=e[4],this.bezierCurveTo(e[1]+s,e[2]+a,g+s,p+a,d+s,u+a);break;case"s":i=d+e[3],r=u+e[4],g=2*d-g,p=2*u-p,this.bezierCurveTo(g+s,p+a,d+e[1]+s,u+e[2]+a,i+s,r+a),g=d+e[1],p=u+e[2],d=i,u=r;break;case"S":i=e[3],r=e[4],g=2*d-g,p=2*u-p,this.bezierCurveTo(g+s,p+a,e[1]+s,e[2]+a,i+s,r+a),d=i,u=r,g=e[1],p=e[2];break;case"q":i=d+e[3],r=u+e[4],g=d+e[1],p=u+e[2],this.quadraticCurveTo(g+s,p+a,i+s,r+a),d=i,u=r;break;case"Q":i=e[3],r=e[4],this.quadraticCurveTo(e[1]+s,e[2]+a,i+s,r+a),d=i,u=r,g=e[1],p=e[2];break;case"t":i=d+e[1],r=u+e[2],null===c[0].match(/[QqTt]/)?(g=d,p=u):"t"===c[0]?(g=2*d-n,p=2*u-o):"q"===c[0]&&(g=2*d-g,p=2*u-p),n=g,o=p,this.quadraticCurveTo(g+s,p+a,i+s,r+a),d=i,u=r,g=d+e[1],p=u+e[2];break;case"T":i=e[1],r=e[2],g=2*d-g,p=2*u-p,this.quadraticCurveTo(g+s,p+a,i+s,r+a),d=i,u=r;break;case"a":Ri(this,d+s,u+a,[e[1],e[2],e[3],e[4],e[5],e[6]+d+s,e[7]+u+a]),d+=e[6],u+=e[7];break;case"A":Ri(this,d+s,u+a,[e[1],e[2],e[3],e[4],e[5],e[6]+s,e[7]+a]),d=e[6],u=e[7];break;case"z":case"Z":this.closePath()}c=e}}_runCommandList(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1,n=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1;if(0!==e||0!==i||1!==r||1!==n)for(let o=0,s=t.length;o<s;++o){const s=t[o].slice();switch(s[0]){case hi:this.lineToTransform(s,e,i,r,n);break;case ci:this.moveToTransform(s,e,i,r,n);break;case si:this.bezierCurveToTransform(s,e,i,r,n);break;case di:this.quadraticCurveToTransform(s,e,i,r,n);break;case ni:this.arcToTransform(s,e,i,r,n);break;case li:this.ellipseTransform(s,e,i,r,n);break;case ui:this.rectTransform(s,e,i,r,n);break;case oi:this.arcToTransform(s,e,i,r,n);break;case ai:this.closePath()}}else this.commandList=t.map((t=>t.slice()))}_updateBounds(){this.bounds.clear(),Ei(this.commandList,this._boundsContext)}release(){this.commandList=[],this._boundsContext=null,this._ctx=null}getLength(){if(this.direction===Ai.COLUMN){if(!this.curves.length)return 0;const t=this.curves[0],e=this.curves[this.curves.length-1];return Jt(t.p0.y-e.p1.y)}if(this.direction===Ai.ROW){if(!this.curves.length)return 0;const t=this.curves[0],e=this.curves[this.curves.length-1];return Jt(t.p0.x-e.p1.x)}return this.curves.reduce(((t,e)=>t+e.getLength()),0)}getAttrAt(t){if(!this.curves)return{pos:{x:0,y:0},angle:0};let e,i=0;for(let r=0;r<this.curves.length;r++){e=this.curves[r];const n=e.getLength(this.direction);if(i+n>=t)break;i+=n}const r=(t-i)/e.getLength(this.direction);return{pos:e.getPointAt(r),angle:e.getAngleAt(r)}}}const hr=["l",0,0,0,0,0,0,0];function cr(t,e,i){const r=hr[0]=t[0];if("a"===r||"A"===r)hr[1]=e*t[1],hr[2]=i*t[2],hr[3]=t[3],hr[4]=t[4],hr[5]=t[5],hr[6]=e*t[6],hr[7]=i*t[7];else if("h"===r||"H"===r)hr[1]=e*t[1];else if("v"===r||"V"===r)hr[1]=i*t[1];else for(let r=1,n=t.length;r<n;++r)hr[r]=(r%2==1?e:i)*t[r];return hr}const dr={x:0,y:0,z:0,dx:0,dy:0,dz:0,scrollX:0,scrollY:0,scaleX:1,scaleY:1,scaleZ:1,angle:0,alpha:0,beta:0,scaleCenter:[0,0],anchor:[0,0],anchor3d:[0,0],postMatrix:new me},ur={fillOpacity:1,fill:!1,shadowBlur:0,shadowColor:"black",shadowOffsetX:0,shadowOffsetY:0},gr={strokeOpacity:1,lineDash:[],lineDashOffset:0,lineWidth:1,lineCap:"butt",lineJoin:"miter",miterLimit:10,strokeBoundsBuffer:2,stroke:!1},pr=Object.assign({outerBorder:Object.assign(Object.assign({},gr),{distance:0}),innerBorder:Object.assign(Object.assign({},gr),{distance:0})},gr),fr={text:"",maxLineWidth:1/0,textAlign:"left",textBaseline:"alphabetic",fontSize:16,fontFamily:"PingFang SC,Microsoft Yahei,system-ui,-apple-system,segoe ui,\n    Roboto,Helvetica,Arial,sans-serif, apple color emoji,segoe ui emoji,segoe ui symbol",fontWeight:"",ellipsis:"…",fontVariant:"",fontStyle:"",lineHeight:void 0,underline:0,lineThrough:0,scaleIn3d:!1,direction:"horizontal",wordBreak:"break-all",ignoreBuf:!1,verticalMode:0,wrap:!1,whiteSpace:"no-wrap",heightLimit:1/0,lineClamp:1/0,suffixPosition:"end",disableAutoClipedPoptip:void 0},mr=Object.assign(Object.assign(Object.assign(Object.assign({opacity:1,background:null,texture:null,textureColor:"black",textureSize:10,texturePadding:2,backgroundMode:"no-repeat",backgroundFit:!0,blur:0,cursor:null,html:null},ur),pr),{alignSelf:"auto"}),{pickStrokeBuffer:0}),br={connectedType:"none",connectedStyle:{},connectedX:NaN,connectedY:NaN},yr=Object.assign(Object.assign(Object.assign({strokeSeg:null,pickable:!0,childrenPickable:!0,fillPickable:!0,strokePickable:!0,visible:!0,zIndex:0,layout:null,boundsPadding:0,pickMode:"accurate",customPickShape:null,boundsMode:"accurate",keepDirIn3d:!0,shadowRootIdx:1,globalZIndex:1,globalCompositeOperation:"",overflow:"hidden"},{_debug_bounds:!1}),mr),dr),Cr=Object.assign(Object.assign({},yr),{startAngle:0,endAngle:Zt,innerRadius:0,outerRadius:1,cornerRadius:0,padRadius:0,padAngle:0,cap:!1,forceShowCap:!1}),vr=Object.assign(Object.assign(Object.assign({},yr),br),{points:[],segments:[],curveType:"linear",clipRange:1,closePath:!1}),wr=Object.assign(Object.assign({},yr),{radius:1,startAngle:0,endAngle:Zt}),xr=Object.assign(Object.assign({},yr),{width:0,height:0,cornerRadius:0,path:[],clip:!1,visibleAll:!0,display:"relative",flexDirection:"row",flexWrap:"wrap",justifyContent:"flex-start",alignItems:"flex-start",alignContent:"flex-start"}),_r=Object.assign(Object.assign({},yr),{path:"",width:0,height:0,cornerRadius:0,clip:!1}),Sr=Object.assign(Object.assign(Object.assign({},yr),br),{points:[],segments:[],curveType:"linear",clipRange:1,clipRangeByDimension:"default",closePath:!1}),Ar=Object.assign(Object.assign({},yr),{path:new lr,customPath:()=>{Ze.getInstance().warn("空函数")}}),Br=Object.assign(Object.assign({},yr),{points:[],cornerRadius:0,closePath:!0}),Tr=Object.assign(Object.assign({},yr),{width:0,height:0,x1:0,y1:0,strokeBoundsBuffer:0,cornerRadius:0}),Mr=Object.assign(Object.assign({},yr),{width:0,height:0,x1:0,y1:0,cornerRadius:0,length:0}),Rr=Object.assign(Object.assign({},yr),{symbolType:"circle",size:10,keepDirIn3d:!0}),Pr=Object.assign(Object.assign(Object.assign({},yr),fr),{strokeBoundsBuffer:0,keepDirIn3d:!0}),Er=Object.assign(Object.assign({},yr),{width:300,height:300,ellipsis:!0,wordBreak:"break-word",verticalDirection:"top",textAlign:"left",textBaseline:"top",layoutDirection:"horizontal",textConfig:[],maxHeight:void 0,maxWidth:void 0,singleLine:!1}),Hr=Object.assign(Object.assign({repeatX:"no-repeat",repeatY:"no-repeat",image:"",width:0,height:0},yr),{fill:!0,cornerRadius:0}),Lr=Object.assign(Object.assign({},Hr),{backgroundShowMode:"never",backgroundWidth:0,backgroundHeight:0,textAlign:"left",textBaseline:"middle",direction:"horizontal",margin:0,id:"",width:20,height:20,backgroundFill:"rgba(101, 117, 168, 0.1)",backgroundFillOpacity:1,backgroundStroke:!1,backgroundStrokeOpacity:1,backgroundRadius:4,opacity:1});const kr=new class{},Ir={horizontal:{width:"width",height:"height",left:"left",top:"top",x:"x",y:"y",bottom:"bottom"},vertical:{width:"height",height:"width",left:"top",top:"left",x:"y",y:"x",bottom:"right"}},Fr=!0,zr=!1,Or=/\w|\(|\)|-/,Dr=/[.?!,;:/,。?!、;:]/,Wr=/\S/;function Nr(t,e,i,r,n){if(!e||e<=0)return 0;const o=kr.graphicUtil.textMeasure;let s=r,a=t.slice(0,s),l=Math.floor(o.measureText(a,i).width),h=t.slice(0,s+1),c=Math.floor(o.measureText(h,i).width);for(;l>e||c<=e;){if(l>e?s--:s++,s>t.length){s=t.length;break}if(s<0){s=0;break}a=t.slice(0,s),l=Math.floor(o.measureText(a,i).width),h=t.slice(0,s+1),c=Math.floor(o.measureText(h,i).width)}return n&&(s=Gr(t,s)),s}function Gr(t,e){let i=e;for(;Or.test(t[i-1])&&Or.test(t[i])||Dr.test(t[i]);)if(i--,i<=0)return e;return i}function jr(t,e){const i=kr.graphicUtil.textMeasure.measureText(t,e),r={ascent:0,height:0,descent:0,width:0};return"number"!=typeof i.actualBoundingBoxAscent||"number"!=typeof i.actualBoundingBoxDescent?(r.width=Math.floor(i.width),r.height=e.fontSize||0,r.ascent=r.height,r.descent=0):(r.width=Math.floor(i.width),r.height=Math.floor(i.actualBoundingBoxAscent+i.actualBoundingBoxDescent),r.ascent=Math.floor(i.actualBoundingBoxAscent),r.descent=r.height-r.ascent),r}var Ur=function(t,e,i,r){var n,o=arguments.length,s=o<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,i,r);else for(var a=t.length-1;a>=0;a--)(n=t[a])&&(s=(o<3?n(s):o>3?n(e,i,s):n(e,i))||s);return o>3&&s&&Object.defineProperty(e,i,s),s};let Vr=class{configure(t,e){this.canvas=t.canvas,this.context=t.context,t.bindTextMeasure(this)}measureTextWidth(t,e){return this.context?(this.context.setTextStyleWithoutAlignBaseline(e),this.context.measureText(t).width):this.estimate(t,e).width}estimate(t,e){let{fontSize:i=Pr.fontSize}=e,r=0,n=0;for(let e=0;e<t.length;e++)t.charCodeAt(e)<128?r++:n++;return{width:~~(.8*r*i+n*i),height:i}}measureTextPixelHeight(t,e){var i;if(!this.context)return null!==(i=e.fontSize)&&void 0!==i?i:fr.fontSize;this.context.setTextStyleWithoutAlignBaseline(e);const r=this.context.measureText(t);return Math.abs(r.actualBoundingBoxAscent-r.actualBoundingBoxDescent)}measureTextBoundHieght(t,e){var i;if(!this.context)return null!==(i=e.fontSize)&&void 0!==i?i:fr.fontSize;this.context.setTextStyleWithoutAlignBaseline(e);const r=this.context.measureText(t);return Math.abs(r.fontBoundingBoxAscent-r.fontBoundingBoxDescent)}measureText(t,e){return this.context?(this.context.setTextStyleWithoutAlignBaseline(e),this.context.measureText(t)):this.estimate(t,e)}clipTextVertical(t,e,i,r){if(0===t.length)return{verticalList:t,width:0};const{fontSize:n=12}=e;t.forEach((t=>{t.width=0===t.direction?n:this.measureTextWidth(t.text,e)}));const o=[];let s=0,a=0;for(;a<t.length&&s+t[a].width<i;a++)s+=t[a].width,o.push(t[a]);if(t[a]&&t[a].text.length>1){const n=this._clipText(t[a].text,e,i-s,0,t[a].text.length-1,"end",!1);if(r&&n.str!==t[a].text){let i="",r=0;for(let e=0;e<a;e++){const n=t[e];i+=n.text,r+=n.text.length}i+=t[a].text;let o=Gr(i,r+n.str.length);o-=r,o!==n.str.length-1&&(n.str=n.str.substring(0,o),n.width=this.measureTextWidth(n.str,e))}o.push(Object.assign(Object.assign({},t[a]),{text:n.str,width:n.width})),s+=n.width}return{verticalList:o,width:s}}clipText(t,e,i,r){if(0===t.length)return{str:"",width:0};let n=this.measureTextWidth(t,e);if(n<=i)return{str:t,width:n};if(n=this.measureTextWidth(t[0],e),n>i)return{str:"",width:0};const o=this._clipText(t,e,i,0,t.length-1,"end",!1);if(r&&o.str!==t){const i=Gr(t,o.str.length);i!==o.str.length&&(o.str=t.substring(0,i),o.width=this.measureTextWidth(o.str,e))}return o}_clipText(t,e,i,r,n,o,s){let a;if("start"===o)a=this._clipTextStart(t,e,i,r,n),s&&(a.result=s+a.str);else if("middle"===o){const r=this._clipTextMiddle(t,e,i,"","",0,0,1);a={str:"none",width:r.width,result:r.left+s+r.right}}else a=this._clipTextEnd(t,e,i,r,n),s&&(a.result=a.str+s);return a}_clipTextEnd(t,e,i,r,n){const o=Math.floor((r+n)/2),s=t.substring(0,o+1),a=this.measureTextWidth(s,e);let l;if(a>i){if(s.length<=1)return{str:"",width:0};const n=t.substring(0,o);return l=this.measureTextWidth(n,e),l<=i?{str:n,width:l}:this._clipTextEnd(t,e,i,r,o)}if(a<i){if(o>=t.length-1)return{str:t,width:this.measureTextWidth(t,e)};const r=t.substring(0,o+2);return l=this.measureTextWidth(r,e),l>=i?{str:s,width:a}:this._clipTextEnd(t,e,i,o,n)}return{str:s,width:a}}_clipTextStart(t,e,i,r,n){const o=Math.ceil((r+n)/2),s=t.substring(o-1,t.length-1),a=this.measureTextWidth(s,e);let l;if(a>i){if(s.length<=1)return{str:"",width:0};const r=t.substring(o,t.length-1);return l=this.measureTextWidth(r,e),l<=i?{str:r,width:l}:this._clipTextStart(t,e,i,o,t.length-1)}if(a<i){if(o<=0)return{str:t,width:this.measureTextWidth(t,e)};const n=t.substring(o-2,t.length-1);return l=this.measureTextWidth(n,e),l>=i?{str:s,width:a}:this._clipTextStart(t,e,i,r,o)}return{str:s,width:a}}_clipTextMiddle(t,e,i,r,n,o,s,a){const l=t.substring(0,a),h=this.measureTextWidth(l,e);if(h+s>i)return{left:r,right:n,width:o+s};const c=t.substring(t.length-a,t.length),d=this.measureTextWidth(c,e);return h+d>i?{left:l,right:n,width:h+s}:this._clipTextMiddle(t,e,i,l,c,h,d,a+1)}clipTextWithSuffixVertical(t,e,i,r,n,o){if(""===r)return this.clipTextVertical(t,e,i,n);if(0===t.length)return{verticalList:t,width:0};const s=this.clipTextVertical(t,e,i,n);if(s.verticalList.length===t.length&&s.verticalList[s.verticalList.length-1].width===t[t.length-1].width)return s;const a=this.measureTextWidth(r,e);if(a>i)return s;let l;if(i-=a,"start"===o){const o=this.revertVerticalList(t);l=this.clipTextVertical(o,e,i,n);const s=this.revertVerticalList(l.verticalList);s.unshift({text:r,direction:1,width:a}),l.verticalList=s}else if("middle"===o){const o=this.clipTextVertical(t,e,i/2,n),s=this.revertVerticalList(t),h=this.clipTextVertical(s,e,i/2,n);o.verticalList.push({text:r,direction:1,width:a}),this.revertVerticalList(h.verticalList).forEach((t=>o.verticalList.push(t))),l={verticalList:o.verticalList,width:o.width+h.width}}else l=this.clipTextVertical(t,e,i,n),l.verticalList.push({text:r,direction:1,width:a});return l.width+=a,l}revertVerticalList(t){return t.reverse().map((t=>{const e=t.text.split("").reverse().join("");return Object.assign(Object.assign({},t),{text:e})}))}clipTextWithSuffix(t,e,i,r,n,o){if(""===r)return this.clipText(t,e,i,n);if(0===t.length)return{str:"",width:0};const s=this.measureTextWidth(t,e);if(s<=i)return{str:t,width:s};const a=this.measureTextWidth(r,e);if(a>i)return{str:"",width:0};i-=a;const l=this._clipText(t,e,i,0,t.length-1,o,r);if(n&&l.str!==t){const i=Gr(t,l.str.length);i!==l.str.length&&(l.str=t.substring(0,i),l.width=this.measureTextWidth(l.str,e))}return l.str=l.result,l.width+=a,l}};Vr=Ur([f()],Vr);var Kr=function(t,e,i,r){var n,o=arguments.length,s=o<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,i,r);else for(var a=t.length-1;a>=0;a--)(n=t[a])&&(s=(o<3?n(s):o>3?n(e,i,s):n(e,i))||s);return o>3&&s&&Object.defineProperty(e,i,s),s};const $r=Symbol.for("TextMeasureContribution");let Xr=class extends Vr{};Xr=Kr([f()],Xr);const Yr=new class{constructor(t){const i=t||{};i.defaultScope=i.defaultScope||y,this.options=i,this.id=e.GenAutoIncrementId(),this._bindingDictionary=new Map,this._metadataReader=new B}load(t){const e=this._getContainerModuleHelpersFactory()(t.id);t.registry(e.bindFunction,e.unbindFunction,e.isboundFunction,e.rebindFunction)}get(t){const e=this._getNotAllArgs(t,!1);return this._get(e)}getAll(t){const e=this._getAllArgs(t);return this._get(e)}getTagged(t,e,i){const r=this._getNotAllArgs(t,!1,e,i);return this._get(r)}getNamed(t,e){return this.getTagged(t,r,e)}isBound(t){return this._bindingDictionary.has(t)}bind(t){const e=this.options.defaultScope,i=new A(t,e),r=this._bindingDictionary.get(t)||[];return r.push(i),this._bindingDictionary.set(t,r),new P(i)}unbind(t){this._bindingDictionary.delete(t)}rebind(t){return this.unbind(t),this.bind(t)}_getContainerModuleHelpersFactory(){const t=(t,e)=>{t._binding.moduleId=e},e=e=>i=>{const r=this.bind(i);return t(r,e),r},i=()=>t=>this.unbind(t),r=()=>t=>this.isBound(t),n=e=>i=>{const r=this.rebind(i);return t(r,e),r};return t=>({bindFunction:e(t),isboundFunction:r(),rebindFunction:n(t),unbindFunction:i(),unbindAsyncFunction:t=>null})}_getNotAllArgs(t,e,i,r){return{avoidConstraints:!1,isMultiInject:e,serviceIdentifier:t,key:i,value:r}}_getAllArgs(t){return{avoidConstraints:!0,isMultiInject:!0,serviceIdentifier:t}}_get(t){const e=[];return this._bindingDictionary.get(t.serviceIdentifier).filter((e=>e.constraint(t))).forEach((t=>{e.push(this._resolveFromBinding(t))})),t.isMultiInject||1!==e.length?e:e[0]}_getChildRequest(t){const e=t.implementationType,{userGeneratedMetadata:i}=this._metadataReader.getConstructorMetadata(e),r=Object.keys(i),s=[];for(let t=0;t<r.length;t++){const e=i[t],r={};e.forEach((t=>{r[t.key]=t.value}));const a={inject:r[n],multiInject:r[o]},l=a.inject||a.multiInject,h={serviceIdentifier:l,constructorArgsMetadata:e},c={injectIdentifier:l,metadata:e,bindings:this._bindingDictionary.get(l).filter((t=>t.constraint(h)))};s.push(c)}return s}_resolveFromBinding(t){const e=this._getResolvedFromBinding(t);return this._saveToScope(t,e),e}_getResolvedFromBinding(t){let e;switch(t.type){case C:case x:e=t.cache;break;case _:e=this._resolveInstance(t,t.implementationType);break;default:e=t.dynamicValue({container:this})}return e}_resolveInstance(t,e){if(t.activated)return t.cache;const i=this._getChildRequest(t);return this._createInstance(e,i)}_createInstance(t,e){return e.length?new t(...this._resolveRequests(e)):new t}_resolveRequests(t){return t.map((t=>t.bindings.length>1?t.bindings.map((t=>this._resolveFromBinding(t))):this._resolveFromBinding(t.bindings[0])))}_saveToScope(t,e){t.scope===b&&(t.cache=e,t.activated=!0)}},qr=Symbol.for("CanvasFactory"),Zr=Symbol.for("Context2dFactory");function Jr(t){return Yr.getNamed(qr,kr.global.env)(t)}const Qr=new class{constructor(){this.pools=[],this.allocatedCanvas=[]}shareCanvas(){return this.allocatedCanvas.length?this.allocatedCanvas[0]:this.getCommonCanvas()}getCommonCanvas(){return this._commonCanvas||(this._commonCanvas=this.allocate({width:100,height:100,dpr:2})),this._commonCanvas}allocate(t){if(!this.pools.length){const e=Jr(Object.assign({nativeCanvas:kr.global.createCanvas(t)},t));return this.allocatedCanvas.push(e),e}const e=this.pools.pop();return e.resize(t.width,t.height),e.dpr=t.dpr,e}allocateByObj(t){if(!this.pools.length){const e={width:t.width/t.dpr,height:t.height/t.dpr,dpr:t.dpr},i=Jr(Object.assign({nativeCanvas:kr.global.createCanvas(e)},e));return this.allocatedCanvas.push(i),i}const e=this.pools.pop();return e.width=t.width,e.height=t.height,e}free(t){this.pools.push(t)}get length(){return this.pools.length}release(){this.pools=[]}};var tn=function(t,e,i,r){var n,o=arguments.length,s=o<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,i,r);else for(var a=t.length-1;a>=0;a--)(n=t[a])&&(s=(o<3?n(s):o>3?n(e,i,s):n(e,i))||s);return o>3&&s&&Object.defineProperty(e,i,s),s},en=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const rn=Symbol.for("VWindow"),nn=Symbol.for("WindowHandlerContribution");let on=class{get width(){if(this._handler){const t=this._handler.getWH();return this._width=t.width}return this._width}get height(){if(this._handler){const t=this._handler.getWH();return this._height=t.height}return this._height}get dpr(){return this._handler.getDpr()}constructor(){this.hooks={onChange:new I(["x","y","width","height"])},this._uid=e.GenAutoIncrementId(),this.global=kr.global,this.postInit()}postInit(){this.global.hooks.onSetEnv.tap("window",(()=>{this.active()})),this.active()}active(){const t=this.global;t.env&&!this.actived&&(Yr.getNamed(nn,t.env).configure(this,t),this.actived=!0)}get style(){return this._handler.getStyle()}set style(t){this._handler.setStyle(t)}create(t){this._handler.createWindow(t);const e=this._handler.getWH();this._width=e.width,this._height=e.height,this.title=this._handler.getTitle(),this.resizable=!0}setWindowHandler(t){this._handler=t}setDpr(t){return this._handler.setDpr(t)}resize(t,e){return this._handler.resizeWindow(t,e)}configure(){throw new Error("暂不支持")}release(){return this._handler.releaseWindow()}getContext(){return this._handler.getContext()}getNativeHandler(){return this._handler.getNativeHandler()}getImageBuffer(t){return this._handler.getImageBuffer?this._handler.getImageBuffer(t):null}addEventListener(t,e,i){return this._handler.addEventListener(t,e,i)}removeEventListener(t,e,i){return this._handler.removeEventListener(t,e,i)}dispatchEvent(t){return this._handler.dispatchEvent(t)}getBoundingClientRect(){return this._handler.getBoundingClientRect()}getContainer(){return this._handler.container}clearViewBox(t,e){this._handler.clearViewBox(t,e)}isVisible(t){return this._handler.isVisible(t)}onVisibleChange(t){return this._handler.onVisibleChange(t)}getTopLeft(t){return this._handler.getTopLeft(t)}};on=tn([f(),en("design:paramtypes",[])],on);var sn=function(t,e,i,r){var n,o=arguments.length,s=o<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,i,r);else for(var a=t.length-1;a>=0;a--)(n=t[a])&&(s=(o<3?n(s):o>3?n(e,i,s):n(e,i))||s);return o>3&&s&&Object.defineProperty(e,i,s),s},an=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},ln=function(t,e){return function(i,r){e(i,r,t)}};let hn=class{get canvas(){return this.tryInitCanvas(),this._canvas}get context(){return this.tryInitCanvas(),this._context}constructor(t){this.contributions=t,this.configured=!1,this.global=kr.global,this.global.hooks.onSetEnv.tap("graphic-util",((t,e,i)=>{this.configured=!1,this.configure(i,e)}))}get textMeasure(){return this._textMeasure||this.configure(this.global,this.global.env),this._textMeasure}configure(t,e){this.configured||(this.contributions.getContributions().forEach((t=>{t.configure(this,e)})),this.configured=!0)}tryInitCanvas(){if(!this._canvas){const t=Qr.shareCanvas();this._canvas=t,this._context=t.getContext("2d")}}bindTextMeasure(t){this._textMeasure=t}measureText(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"native";var r;this.configure(this.global,this.global.env);const n=this.global.measureTextMethod;this.global.measureTextMethod=i;const o={width:this._textMeasure.measureTextWidth(t,e),height:null!==(r=e.fontSize)&&void 0!==r?r:fr.fontSize};return this.global.measureTextMethod=n,o}createTextMeasureInstance(t,e,i){return this.configure(this.global,this.global.env),new $e(Object.assign({defaultFontParams:{fontFamily:fr.fontFamily,fontSize:fr.fontSize},getCanvasForMeasure:i||(()=>this.canvas),getTextBounds:void 0,specialCharSet:"-/: .,@%'\"~"+$e.ALPHABET_CHAR_SET+$e.ALPHABET_CHAR_SET.toUpperCase()},null!=e?e:{}),t)}drawGraphicToCanvas(t,e,i){if(!e.defaultLayer)return null;const r=Yr.get(rn),n=t.AABBBounds,o=n.width(),s=n.height();r.create({width:o,height:s,canvas:i,dpr:e.window.dpr,canvasControled:!0,offscreen:!0,title:""});const a=-n.x1,l=-n.y1,h=e.params.optimize.disableCheckGraphicWidthOutRange;e.params.optimize.disableCheckGraphicWidthOutRange=!0,e.defaultLayer.getNativeHandler().drawTo(r,[t],{x:a,y:l,width:o,height:s,stage:e,layer:e.defaultLayer,renderService:e.renderService,background:"transparent",clear:!0,updateBounds:!1}),e.params.optimize.disableCheckGraphicWidthOutRange=h;const c=r.getNativeHandler();return c.nativeCanvas?c.nativeCanvas:null}};var cn;hn=sn([f(),ln(0,g(E)),ln(0,m($r)),an("design:paramtypes",[Object])],hn),function(t){t[t.transform=0]="transform",t[t.matrix=1]="matrix"}(cn||(cn={}));const dn=new me;let un=class{constructor(){this.matrix=new me}init(t){return this.mode=cn.transform,this.originTransform=t,this.matrix.reset(),this}fromMatrix(t,e){return this.mode=cn.matrix,this.outSourceMatrix=t,this.outTargetMatrix=e,this}scaleMatrix(t,e,i){const r=this.outSourceMatrix;if(dn.setValue(r.a,r.b,r.c,r.d,r.e,r.f),this.outTargetMatrix.reset(),i){const{x:r,y:n}=i;this.outTargetMatrix.translate(r,n),this.outTargetMatrix.scale(t,e),this.outTargetMatrix.translate(-r,-n)}else this.outTargetMatrix.scale(t,e);return this.outTargetMatrix.multiply(dn.a,dn.b,dn.c,dn.d,dn.e,dn.f),this}rotateMatrix(t,e){const i=this.outSourceMatrix;if(dn.setValue(i.a,i.b,i.c,i.d,i.e,i.f),this.outTargetMatrix.reset(),e){const{x:i,y:r}=e;this.outTargetMatrix.translate(i,r),this.outTargetMatrix.rotate(t),this.outTargetMatrix.translate(-i,-r)}else this.outTargetMatrix.rotate(t);return this.outTargetMatrix.multiply(dn.a,dn.b,dn.c,dn.d,dn.e,dn.f),this}scale(t,e,i){return this.mode===cn.matrix?this.scaleMatrix(t,e,i):this}rotate(t,e){return this.mode===cn.matrix?this.rotateMatrix(t,e):this}translateMatrix(t,e){const i=this.outSourceMatrix;return dn.setValue(i.a,i.b,i.c,i.d,i.e,i.f),this.outTargetMatrix.reset(),this.outTargetMatrix.translate(t,e),this.outTargetMatrix.multiply(dn.a,dn.b,dn.c,dn.d,dn.e,dn.f),this}translate(t,e){return this.mode===cn.matrix?this.translateMatrix(t,e):this}simplify(t){return this.mode===cn.matrix?this.simplifyMatrix(t):this}simplifyMatrix(t){return this}};un=sn([f(),an("design:paramtypes",[])],un);const gn={arc:Cr,area:vr,circle:wr,line:Sr,path:Ar,symbol:Rr,text:Pr,rect:Tr,rect3d:Mr,polygon:Br,richtext:Er,richtextIcon:Lr,image:Hr,group:xr,glyph:_r},pn=Object.keys(gn);function fn(t,e){Object.keys(e).forEach((i=>{t[i]=e[i]}))}const mn={arc:Object.assign({},gn.arc),area:Object.assign({},gn.area),circle:Object.assign({},gn.circle),line:Object.assign({},gn.line),path:Object.assign({},gn.path),symbol:Object.assign({},gn.symbol),text:Object.assign({},gn.text),rect:Object.assign({},gn.rect),rect3d:Object.assign({},gn.rect3d),polygon:Object.assign({},gn.polygon),richtext:Object.assign({},gn.richtext),richtextIcon:Object.assign({},gn.richtextIcon),image:Object.assign({},gn.image),group:Object.assign({},gn.group),glyph:Object.assign({},gn.glyph)};class bn{constructor(){this.initTheme(),this.dirty=!1}initTheme(){this._defaultTheme={},pn.forEach((t=>{this._defaultTheme[t]=Object.create(mn[t])})),this.combinedTheme=this._defaultTheme}getTheme(t){if(!t)return this.combinedTheme;if(!this.dirty)return this.combinedTheme;let e={};const i=this.getParentWithTheme(t);return i&&(e=i.theme),this.applyTheme(t,e),this.combinedTheme}getParentWithTheme(t){for(;t.parent;)if((t=t.parent).theme)return t;return null}applyTheme(t,e){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(this.dirty){const r=this.getParentWithTheme(t);if(r){const t=r.theme;(t.dirty||i)&&t.applyTheme(r,e,!0)}this.userTheme?this.doCombine(r&&r.theme.combinedTheme):(r?this.combinedTheme=r.theme.combinedTheme:(this.combinedTheme=this._defaultTheme,Ze.getInstance().warn("未知错误,走到不应该走的区域里")),this.dirty=!1)}return this.combinedTheme}doCombine(t){const e=this.userTheme,i=this.combinedTheme;pn.forEach((r=>{const n=Object.create(mn[r]);t&&t[r]&&fn(n,t[r]),i[r]&&fn(n,i[r]),e[r]&&fn(n,e[r]),this.combinedTheme[r]=n})),e.common&&pn.forEach((t=>{fn(this.combinedTheme[t],e.common)})),this.dirty=!1}setTheme(t,e){let i=this.userTheme;i?Object.keys(t).forEach((e=>{i[e]?Object.assign(i[e],t[e]):i[e]=Object.assign({},t[e])})):i=t,this.userTheme=i,this.dirty=!0,this.dirtyChildren(e)}resetTheme(t,e){this.userTheme=t,this.dirty=!0,this.dirtyChildren(e)}dirtyChildren(t){t.forEachChildren((t=>{t.isContainer&&(t.theme&&(t.theme.dirty=!0),this.dirtyChildren(t))}))}}const yn=new bn;function Cn(t,e){return t.glyphHost?Cn(t.glyphHost):e?(t.isContainer,e):function(t){let e;if(e=t.isContainer?t:t.parent,e){for(;e&&!e.theme;)e=e.parent;return e?(e.theme||e.createTheme(),e.theme.getTheme(e)):yn.getTheme()}return null}(t)||yn.getTheme()}var vn=function(t,e,i,r){return new(i||(i=Promise))((function(n,o){function s(t){try{l(r.next(t))}catch(t){o(t)}}function a(t){try{l(r.throw(t))}catch(t){o(t)}}function l(t){var e;t.done?n(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(s,a)}l((r=r.apply(t,e||[])).next())}))};class wn extends U{get previousSibling(){return this._prev}get nextSibling(){return this._next}get children(){return this.getChildren()}get firstChild(){return this._firstChild}get lastChild(){return this._lastChild}get count(){return this._count}get childrenCount(){return this._idMap?this._idMap.size:0}constructor(){super(),this._uid=e.GenAutoIncrementId(),this._firstChild=null,this._lastChild=null,this.parent=null,this._count=1}forEachChildren(t){if(arguments.length>1&&void 0!==arguments[1]&&arguments[1]){let e=this._lastChild,i=0;for(;e;){if(t(e,i++))return;e=e._prev}}else{let e=this._firstChild,i=0;for(;e;){if(t(e,i++))return;e=e._next}}}forEachChildrenAsync(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return vn(this,void 0,void 0,(function*(){if(e){let e=this._lastChild,i=0;for(;e;){let r=t(e,i++);if(r.then&&(r=yield r),r)return;e=e._prev}}else{let e=this._firstChild,i=0;for(;e;){let r=t(e,i++);if(r.then&&(r=yield r),r)return;e=e._next}}}))}forEach(t){return this.forEachChildren(t)}appendChild(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if(this._uid===t._uid)return null;if(!e&&t.isAncestorsOf(this))throw new Error("【Node::appendChild】不能将父辈元素append为子元素");return t.parent&&t.parent.removeChild(t),t.parent=this,this._lastChild?(this._lastChild._next=t,t._prev=this._lastChild,this._lastChild=t):(this._firstChild=this._lastChild=t,t._prev=t._next=null),this._idMap||(this._idMap=new Map),this._idMap.set(t._uid,t),this.setCount(t.count),this._structEdit=!0,t}appendChildArrHighPerformance(t){return t}insertBefore(t,e){if(!e)return this.appendChild(t);if(this._uid===t._uid)return null;if(t.isAncestorsOf(this))throw new Error("【Node::insertBefore】不能将父辈元素insert为子元素");return e.parent!==this?null:(t.parent&&t.parent.removeChild(t),t.parent=this,t._prev=e._prev,e._prev?e._prev._next=t:this._firstChild=t,e._prev=t,t._next=e,this._idMap||(this._idMap=new Map),this._idMap.set(t._uid,t),this._structEdit=!0,this.setCount(t.count),t)}insertAfter(t,e){if(!e)return this.appendChild(t);if(this._uid===t._uid)return null;if(t.isAncestorsOf(this))throw new Error("【Node::insertAfter】不能将父辈元素insert为子元素");return e.parent!==this?null:(t.parent&&t.parent.removeChild(t),t.parent=this,e._next?(e._next._prev=t,t._next=e._next):this._lastChild=t,e._next=t,t._prev=e,this._idMap||(this._idMap=new Map),this._idMap.set(t._uid,t),this._structEdit=!0,this.setCount(t.count),t)}insertInto(t,e){if(!this._ignoreWarn&&this._nodeList&&Ze.getInstance().warn("insertIntoKeepIdx和insertInto混用可能会存在错误"),e>=this.childrenCount)return this.appendChild(t);if(this._uid===t._uid)return null;if(t.isAncestorsOf(this))throw new Error("【Node::insertBefore】不能将父辈元素insert为子元素");if(t.parent&&t.parent.removeChild(t),t.parent=this,0===e)t._next=this._firstChild,this._firstChild&&(this._firstChild._prev=t),t._prev=null,this._firstChild=t;else{let i=this._firstChild;for(let t=0;t<e;t++){if(!i)return null;t>0&&(i=i._next)}if(!i)return null;t._next=i._next,t._prev=i,i._next=t,t._next&&(t._next._prev=t)}return this._idMap||(this._idMap=new Map),this._idMap.set(t._uid,t),this._structEdit=!0,this.setCount(t.count),t}insertIntoKeepIdx(t,e){if(this._nodeList||(this._nodeList=this.children),this._nodeList[e]){const i=this._nodeList[e];return this._nodeList.splice(e,0,t),this.insertBefore(t,i)}let i;this._nodeList[e]=t;for(let t=e-1;t>=0&&(i=this._nodeList[t],!i);t--);if(i)return i._next?this.insertBefore(t,i._next):this.appendChild(t);this._ignoreWarn=!0;const r=this.insertInto(t,0);return this._ignoreWarn=!1,r}removeChild(t){if(!this._idMap)return null;if(!this._idMap.has(t._uid))return null;if(this._idMap.delete(t._uid),this._nodeList){const e=this._nodeList.findIndex((e=>e===t));e>0&&this._nodeList.splice(e,1)}return t._prev?t._prev._next=t._next:this._firstChild=t._next,t._next?t._next._prev=t._prev:this._lastChild=t._prev,t.parent=null,t._prev=null,t._next=null,this._structEdit=!0,this.setCount(-t.count),t}delete(){this.parent&&this.parent.removeChild(this)}removeAllChild(){if(!this._idMap)return;let t=this._firstChild;for(;t;)t.parent=null,t._prev=null,t._next=null,t=t._next;this._firstChild=null,this._lastChild=null,this._idMap.clear(),this._structEdit=!0,this.setCount(1-this._count)}replaceChild(t,e){throw new Error("暂不支持")}find(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=null;return this.forEachChildren(((e,r)=>!(e===this||!t(e,r)||(i=e,0)))),e&&this.forEachChildren((e=>{if(e.isContainer){const r=e.find(t,!0);if(r)return i=r,!0}return!1})),i}findAll(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=[];return this.forEachChildren(((e,r)=>{e!==this&&t(e,r)&&i.push(e)})),e&&this.forEachChildren((e=>{if(e.isContainer){const r=e.findAll(t,!0);r.length&&(i=i.concat(r))}})),i}getElementById(t){return this.find((e=>e.id===t),!0)}findChildById(t){return this.getElementById(t)}findChildByUid(t){return this._idMap&&this._idMap.get(t)||null}getElementsByName(t){return this.findAll((e=>e.name===t),!0)}findChildrenByName(t){return this.getElementsByName(t)}getElementsByType(t){return this.findAll((e=>e.type===t),!0)}getChildByName(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return this.find((e=>e.name===t),e)}getChildAt(t){let e=this._firstChild;if(!e)return null;for(let i=0;i<t;i++){if(!e._next)return null;e=e._next}return e}at(t){return this.getChildAt(t)}containNode(t){if(!this._idMap)return!1;if(this._idMap.has(t._uid))return!0;let e=this._firstChild;for(;e;){if(e.containNode(t))return!0;e=e._next}return!1}getRootNode(){let t=this.parent;for(;null==t?void 0:t.parent;)t=t.parent;return t||this}hasChildNodes(){return null!==this._firstChild}addChild(t){return this.appendChild(t)}add(t){return this.appendChild(t)}getChildren(){const t=[];let e=this._firstChild;for(;e;)t.push(e),e=e._next;return t}isChildOf(t){return!!this.parent&&this.parent._uid===t._uid}isParentOf(t){return t.isChildOf(this)}isDescendantsOf(t){let e=this.parent;if(!e)return!1;do{if(e._uid===t._uid)return!0;e=e.parent}while(null!==e);return!1}isAncestorsOf(t){return t.isDescendantsOf(this)}getAncestor(t){throw new Error("暂不支持")}setAllDescendantsProps(t,e){let i=this._firstChild;for(;i;)i[t]=e,i.setAllDescendantsProps(t,e),i=i._next}setCount(t){this._count+=t;let e=this.parent;if(e)do{e._count+=t,e=e.parent}while(null!==e)}clone(){throw new Error("暂不支持")}cloneTo(t){throw new Error("暂不支持")}getParent(){return this.parent}del(t){return this.removeChild(t)}addEventListener(t,e,i){const r=K(i,!0)&&i||q(i)&&i.capture,n=q(i)&&i.once,o=$(e)?void 0:e;return t=r?`${t}capture`:t,e=$(e)?e:e.handleEvent,n?super.once(t,e,o):super.on(t,e,o),this}on(t,e,i){return this.addEventListener(t,e,i)}removeEventListener(t,e,i){const r=K(i,!0)&&i||q(i)&&i.capture,n=$(e)?void 0:e;t=r?`${t}capture`:t,e=$(e)?e:e.handleEvent;const o=q(i)&&i.once;return super.off(t,e,n,o),this}off(t,e,i){return this.removeEventListener(t,e,i)}once(t,e,i){return q(i)?(i.once=!0,this.addEventListener(t,e,i)):this.addEventListener(t,e,{once:!0})}removeAllEventListeners(){return super.removeAllListeners(),this}removeAllListeners(){return this.removeAllEventListeners()}dispatchEvent(t){for(var e=arguments.length,i=new Array(e>1?e-1:0),r=1;r<e;r++)i[r-1]=arguments[r];return super.emit(t.type,t,...i),!t.defaultPrevented}emit(t,e){return this.dispatchEvent(t,e)}release(){this.removeAllListeners()}}class xn{get layerX(){return this.layer.x}get layerY(){return this.layer.y}get pageX(){return this.page.x}get pageY(){return this.page.y}get x(){return this.canvas.x}get y(){return this.canvas.y}get canvasX(){return this.canvas.x}get canvasY(){return this.canvas.y}get viewX(){return this.viewport.x}get viewY(){return this.viewport.y}constructor(t){this.bubbles=!0,this.cancelBubble=!0,this.cancelable=!1,this.composed=!1,this.defaultPrevented=!1,this.eventPhase=xn.prototype.NONE,this.propagationStopped=!1,this.propagationImmediatelyStopped=!1,this.layer={x:0,y:0},this.page={x:0,y:0},this.canvas={x:0,y:0},this.viewport={x:0,y:0},this.NONE=0,this.CAPTURING_PHASE=1,this.AT_TARGET=2,this.BUBBLING_PHASE=3,this.manager=t}composedPath(){return!this.manager||this.path&&this.path[this.path.length-1]===this.target||(this.path=this.target?this.manager.propagationPath(this.target):[]),this.path}preventDefault(){this.nativeEvent instanceof Event&&this.nativeEvent.cancelable&&this.nativeEvent.preventDefault(),this.defaultPrevented=!0}stopImmediatePropagation(){this.propagationImmediatelyStopped=!0}stopPropagation(){this.nativeEvent instanceof Event&&this.nativeEvent.cancelable&&this.nativeEvent.stopPropagation(),this.propagationStopped=!0}initEvent(){}initUIEvent(){}clone(){throw new Error("Method not implemented.")}}class _n extends xn{constructor(){super(...arguments),this.client={x:0,y:0},this.movement={x:0,y:0},this.offset={x:0,y:0},this.global={x:0,y:0},this.screen={x:0,y:0}}get clientX(){return this.client.x}get clientY(){return this.client.y}get movementX(){return this.movement.x}get movementY(){return this.movement.y}get offsetX(){return this.offset.x}get offsetY(){return this.offset.y}get globalX(){return this.global.x}get globalY(){return this.global.y}get screenX(){return this.screen.x}get screenY(){return this.screen.y}getModifierState(t){return"getModifierState"in this.nativeEvent&&this.nativeEvent.getModifierState(t)}initMouseEvent(t,e,i,r,n,o,s,a,l,h,c,d,u,g,p){throw new Error("Method not implemented.")}}class Sn extends _n{constructor(){super(...arguments),this.width=0,this.height=0,this.isPrimary=!1}getCoalescedEvents(){return"pointermove"===this.type||"mousemove"===this.type||"touchmove"===this.type?[this]:[]}getPredictedEvents(){throw new Error("getPredictedEvents is not supported!")}clone(){var t,e,i;const r=new Sn(this.manager);return r.eventPhase=r.NONE,r.currentTarget=null,r.path=[],r.target=null,r.nativeEvent=this.nativeEvent,r.originalEvent=this.originalEvent,null===(t=this.manager)||void 0===t||t.copyPointerData(this,r),null===(e=this.manager)||void 0===e||e.copyMouseData(this,r),null===(i=this.manager)||void 0===i||i.copyData(this,r),r.target=this.target,r.path=this.composedPath().slice(),r.type=this.type,r}}class An extends _n{constructor(){super(...arguments),this.DOM_DELTA_PIXEL=0,this.DOM_DELTA_LINE=1,this.DOM_DELTA_PAGE=2}clone(){var t,e,i;const r=new An(this.manager);return r.eventPhase=r.NONE,r.currentTarget=null,r.path=[],r.target=null,r.nativeEvent=this.nativeEvent,r.originalEvent=this.originalEvent,null===(t=this.manager)||void 0===t||t.copyWheelData(this,r),null===(e=this.manager)||void 0===e||e.copyMouseData(this,r),null===(i=this.manager)||void 0===i||i.copyData(this,r),r.target=this.target,r.path=this.composedPath().slice(),r.type=this.type,r}}An.DOM_DELTA_PIXEL=0,An.DOM_DELTA_LINE=1,An.DOM_DELTA_PAGE=2;class Bn extends xn{constructor(t,e){super(),this.type=t,this.detail=e}}const Tn="object"==typeof performance&&performance.now?performance:Date;function Mn(t){return"mouse"===t||"pen"===t}const Rn={pickable:!0,visible:!0,dispatchEvent(t){var e;if(!(t instanceof xn))throw new Error("DisplayObject cannot propagate events outside of the Federated Events API");return t.defaultPrevented=!1,t.path=[],t.target=this,null===(e=null==t?void 0:t.manager)||void 0===e||e.dispatchEvent(t),!t.defaultPrevented},emit(t,e){return this.dispatchEvent(new Bn(t,e))}},Pn={touchstart:"pointerdown",touchend:"pointerup",touchendoutside:"pointerupoutside",touchmove:"pointermove",touchcancel:"pointercancel"};class En{constructor(t){this.resolution=1,this.onPointerDown=t=>{if(this.supportsTouchEvents&&"touch"===t.pointerType)return;const e=this.normalizeToPointerData(t);this.autoPreventDefault&&e[0].isNormalized&&(t.cancelable||!("cancelable"in t))&&t.preventDefault();for(let t=0,i=e.length;t<i;t++){const i=e[t],r=this.bootstrapEvent(this.rootPointerEvent,i);this.manager.mapEvent(r)}this.setCursor(this.manager.cursor,this.manager.cursorTarget)},this.onPointerMove=t=>{if(this.supportsTouchEvents&&"touch"===t.pointerType)return;if(this.isEventOutsideOfTargetElement(t))return;const e=this.normalizeToPointerData(t);for(let t=0,i=e.length;t<i;t++){const i=this.bootstrapEvent(this.rootPointerEvent,e[t]);this.manager.mapEvent(i)}this.setCursor(this.manager.cursor,this.manager.cursorTarget)},this.onPointerUp=t=>{if(this.supportsTouchEvents&&"touch"===t.pointerType)return;const e=this.isEventOutsideOfTargetElement(t)?"outside":"",i=this.normalizeToPointerData(t);for(let t=0,r=i.length;t<r;t++){const r=this.bootstrapEvent(this.rootPointerEvent,i[t]);r.type+=e,this.manager.mapEvent(r)}this.setCursor(this.manager.cursor,this.manager.cursorTarget)},this.onPointerOverOut=t=>{if(this.supportsTouchEvents&&"touch"===t.pointerType)return;const e=this.normalizeToPointerData(t);for(let t=0,i=e.length;t<i;t++){const i=this.bootstrapEvent(this.rootPointerEvent,e[t]);this.manager.mapEvent(i)}this.setCursor(this.manager.cursor,this.manager.cursorTarget)},this.onWheel=t=>{const e=this.normalizeWheelEvent(t);this.manager.mapEvent(e)};const{targetElement:e,resolution:i,rootNode:r,global:n,viewport:o,autoPreventDefault:s=!1,clickInterval:a}=t;this.manager=new class{constructor(t,e){this.dispatch=new U,this.cursorTarget=null,this.mappingState={trackingData:{}},this.eventPool=new Map,this.onPointerDown=(t,e)=>{if(!(t instanceof Sn))return void Ze.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const i=this.createPointerEvent(t,t.type,e);if(this.dispatchEvent(i,"pointerdown"),"touch"===i.pointerType)this.dispatchEvent(i,"touchstart");else if(Mn(i.pointerType)){const t=2===i.button;this.dispatchEvent(i,t?"rightdown":"mousedown")}this.trackingData(t.pointerId).pressTargetsByButton[t.button]=i.composedPath(),this.freeEvent(i)},this.onPointerMove=(t,e)=>{var i,r;if(!(t instanceof Sn))return void Ze.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const n=this.createPointerEvent(t,t.type,e),o=Mn(n.pointerType),s=this.trackingData(t.pointerId),a=this.findMountedTarget(s.overTargets);if(s.overTargets&&a&&a!==this.rootTarget&&a!==n.target){const e="mousemove"===t.type?"mouseout":"pointerout",i=this.createPointerEvent(t,e,a||void 0);if(this.dispatchEvent(i,"pointerout"),o&&this.dispatchEvent(i,"mouseout"),!n.composedPath().includes(a)){const e=this.createPointerEvent(t,"pointerleave",a||void 0);for(e.eventPhase=e.AT_TARGET;e.target&&!n.composedPath().includes(e.target);)e.currentTarget=e.target,this.notifyTarget(e),o&&this.notifyTarget(e,"mouseleave"),e.target=e.target.parent;this.freeEvent(e)}this.freeEvent(i)}if(a!==n.target){const e="mousemove"===t.type?"mouseover":"pointerover",i=this.clonePointerEvent(n,e);this.dispatchEvent(i,"pointerover"),o&&this.dispatchEvent(i,"mouseover");let r=null==a?void 0:a.parent;for(;r&&r!==this.rootTarget.parent&&r!==n.target;)r=r.parent;if(!r||r===this.rootTarget.parent){const t=this.clonePointerEvent(n,"pointerenter");for(t.eventPhase=t.AT_TARGET;t.target&&t.target!==a&&t.target!==this.rootTarget.parent;)t.currentTarget=t.target,this.notifyTarget(t),o&&this.notifyTarget(t,"mouseenter"),t.target=t.target.parent;this.freeEvent(t)}this.freeEvent(i)}this.dispatchEvent(n,"pointermove"),"touch"===n.pointerType&&this.dispatchEvent(n,"touchmove"),o&&(this.dispatchEvent(n,"mousemove"),this.cursorTarget=n.target,this.cursor=(null===(r=null===(i=n.target)||void 0===i?void 0:i.attribute)||void 0===r?void 0:r.cursor)||this.rootTarget.getCursor()),s.overTargets=n.composedPath(),this.freeEvent(n)},this.onPointerOver=(t,e)=>{var i,r;if(!(t instanceof Sn))return void Ze.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const n=this.trackingData(t.pointerId),o=this.createPointerEvent(t,t.type,e),s=Mn(o.pointerType);this.dispatchEvent(o,"pointerover"),s&&this.dispatchEvent(o,"mouseover"),"mouse"===o.pointerType&&(this.cursorTarget=o.target,this.cursor=(null===(r=null===(i=o.target)||void 0===i?void 0:i.attribute)||void 0===r?void 0:r.cursor)||this.rootTarget.getCursor());const a=this.clonePointerEvent(o,"pointerenter");for(a.eventPhase=a.AT_TARGET;a.target&&a.target!==this.rootTarget.parent;)a.currentTarget=a.target,this.notifyTarget(a),s&&this.notifyTarget(a,"mouseenter"),a.target=a.target.parent;n.overTargets=o.composedPath(),this.freeEvent(o),this.freeEvent(a)},this.onPointerOut=(t,e)=>{if(!(t instanceof Sn))return void Ze.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const i=this.trackingData(t.pointerId);if(i.overTargets){const e=Mn(t.pointerType),r=this.findMountedTarget(i.overTargets),n=this.createPointerEvent(t,"pointerout",r||void 0);this.dispatchEvent(n),e&&this.dispatchEvent(n,"mouseout");const o=this.createPointerEvent(t,"pointerleave",r||void 0);for(o.eventPhase=o.AT_TARGET;o.target&&o.target!==this.rootTarget.parent;)o.currentTarget=o.target,this.notifyTarget(o),e&&this.notifyTarget(o,"mouseleave"),o.target=o.target.parent;i.overTargets=[],this.freeEvent(n),this.freeEvent(o)}this.cursorTarget=null,this.cursor=""},this.onPointerUp=(t,e)=>{var i;if(!(t instanceof Sn))return void Ze.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const r=Tn.now(),n=this.createPointerEvent(t,t.type,e);if(this.dispatchEvent(n,"pointerup"),"touch"===n.pointerType)this.dispatchEvent(n,"touchend");else if(Mn(n.pointerType)){const t=2===n.button;this.dispatchEvent(n,t?"rightup":"mouseup")}const o=this.trackingData(t.pointerId),s=this.findMountedTarget(o.pressTargetsByButton[t.button]);let a=s;if(s&&!n.composedPath().includes(s)){let e=s;for(;e&&!n.composedPath().includes(e);){if(n.currentTarget=e,this.notifyTarget(n,"pointerupoutside"),"touch"===n.pointerType)this.notifyTarget(n,"touchendoutside");else if(Mn(n.pointerType)){const t=2===n.button;this.notifyTarget(n,t?"rightupoutside":"mouseupoutside")}e=e.parent}delete o.pressTargetsByButton[t.button],a=e}if(a){const e=this.clonePointerEvent(n,"click");e.target=a,e.path=[],o.clicksByButton[t.button]||(o.clicksByButton[t.button]={clickCount:0,target:e.target,timeStamp:r});const s=o.clicksByButton[t.button];s.target===e.target&&r-s.timeStamp<(null!==(i=this._config.clickInterval)&&void 0!==i?i:200)?++s.clickCount:s.clickCount=1,s.target=e.target,s.timeStamp=r,e.detail=s.clickCount,Mn(e.pointerType)?(this.dispatchEvent(e,"click"),2===s.clickCount&&this.dispatchEvent(e,"dblclick")):"touch"===e.pointerType&&(this.dispatchEvent(e,"tap"),2===s.clickCount&&this.dispatchEvent(e,"dbltap")),this.dispatchEvent(e,"pointertap"),this.freeEvent(e)}this.freeEvent(n)},this.onPointerUpOutside=(t,e)=>{if(!(t instanceof Sn))return void Ze.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const i=this.trackingData(t.pointerId),r=this.findMountedTarget(i.pressTargetsByButton[t.button]),n=this.createPointerEvent(t,t.type,e);if(r){let e=r;for(;e;)n.currentTarget=e,this.notifyTarget(n,"pointerupoutside"),"touch"===n.pointerType?this.notifyTarget(n,"touchendoutside"):Mn(n.pointerType)&&this.notifyTarget(n,2===n.button?"rightupoutside":"mouseupoutside"),e=e.parent;delete i.pressTargetsByButton[t.button]}this.freeEvent(n)},this.onWheel=(t,e)=>{if(!(t instanceof An))return void Ze.getInstance().warn("EventManager cannot map a non-wheel event as a wheel event");const i=this.createWheelEvent(t,e);this.dispatchEvent(i),this.freeEvent(i)},this.rootTarget=t,this.mappingTable={},this._config=Object.assign({clickInterval:200},e),this.addEventMapping("pointerdown",this.onPointerDown),this.addEventMapping("pointermove",this.onPointerMove),this.addEventMapping("pointerout",this.onPointerOut),this.addEventMapping("pointerleave",this.onPointerOut),this.addEventMapping("pointerover",this.onPointerOver),this.addEventMapping("pointerup",this.onPointerUp),this.addEventMapping("pointerupoutside",this.onPointerUpOutside),this.addEventMapping("wheel",this.onWheel)}addEventMapping(t,e){this.mappingTable[t]||(this.mappingTable[t]=[]),this.mappingTable[t].push({fn:e,priority:0}),this.mappingTable[t].sort(((t,e)=>t.priority-e.priority))}dispatchEvent(t,e){t.propagationStopped=!1,t.propagationImmediatelyStopped=!1,this.propagate(t,e),this.dispatch.emit(e||t.type,t)}mapEvent(t){var e,i,r,n,o,s,a;if(!this.rootTarget)return;const l=this.mappingTable[t.type];let h;const c=`${t.canvasX}-${t.canvasY}`;if((null===(e=this._prePointTargetCache)||void 0===e?void 0:e[c])&&(null===(r=null===(i=this._prePointTargetCache)||void 0===i?void 0:i[c])||void 0===r?void 0:r.stage)&&(null===(o=null===(n=this._prePointTargetCache)||void 0===n?void 0:n[c])||void 0===o?void 0:o.stage.renderCount)===(null===(s=this._prePointTargetCache)||void 0===s?void 0:s.stageRenderCount)?h=this._prePointTargetCache[c]:(h=this.pickTarget(t.canvasX,t.canvasY,t),t.pickParams||(this._prePointTargetCache={[c]:h,stageRenderCount:null!==(a=null==h?void 0:h.stage.renderCount)&&void 0!==a?a:-1})),l)for(let e=0,i=l.length;e<i;e++)l[e].fn(t,h);else Ze.getInstance().warn(`[EventManager]: Event mapping not defined for ${t.type}`)}propagate(t,e){if(!t.target)return;const i=t.composedPath();t.eventPhase=t.CAPTURING_PHASE;for(let r=0,n=i.length-1;r<n;r++)if(t.currentTarget=i[r],this.notifyTarget(t,e),t.propagationStopped||t.propagationImmediatelyStopped)return;if(t.eventPhase=t.AT_TARGET,t.currentTarget=t.target,this.notifyTarget(t,e),!t.propagationStopped&&!t.propagationImmediatelyStopped){t.eventPhase=t.BUBBLING_PHASE;for(let r=i.length-2;r>=0;r--)if(t.currentTarget=i[r],this.notifyTarget(t,e),t.propagationStopped||t.propagationImmediatelyStopped)return}}propagationPath(t){const e=[t];for(let i=0;i<2048&&t!==this.rootTarget&&t.parent;i++){if(!t.parent)throw new Error("Cannot find propagation path to disconnected target");e.push(t.parent),t=t.parent}return e.reverse(),e}notifyTarget(t,e){e=null!=e?e:t.type;const i=t.eventPhase===t.CAPTURING_PHASE||t.eventPhase===t.AT_TARGET?`${e}capture`:e;this.notifyListeners(t,i),t.eventPhase===t.AT_TARGET&&this.notifyListeners(t,e)}findMountedTarget(t){if(!t)return null;let e=t[0];for(let i=1;i<t.length&&t[i].parent===e;i++)e=t[i];return e}createPointerEvent(t,e,i){const r=this.allocateEvent(Sn);return this.copyPointerData(t,r),this.copyMouseData(t,r),this.copyData(t,r),r.nativeEvent=t.nativeEvent,r.originalEvent=t,r.target=i||this.pickTarget(r.global.x,r.global.y,r),"string"==typeof e&&(r.type=e),r}createWheelEvent(t,e){const i=this.allocateEvent(An);return this.copyWheelData(t,i),this.copyMouseData(t,i),this.copyData(t,i),i.nativeEvent=t.nativeEvent,i.originalEvent=t,i.target=e||this.pickTarget(i.global.x,i.global.y,i),i}clonePointerEvent(t,e){const i=this.allocateEvent(Sn);return i.nativeEvent=t.nativeEvent,i.originalEvent=t.originalEvent,this.copyPointerData(t,i),this.copyMouseData(t,i),this.copyData(t,i),i.target=t.target,i.path=t.composedPath().slice(),i.type=null!=e?e:i.type,i}copyWheelData(t,e){e.deltaMode=t.deltaMode,e.deltaX=t.deltaX,e.deltaY=t.deltaY,e.deltaZ=t.deltaZ}copyPointerData(t,e){t instanceof Sn&&e instanceof Sn&&(e.pointerId=t.pointerId,e.width=t.width,e.height=t.height,e.isPrimary=t.isPrimary,e.pointerType=t.pointerType,e.pressure=t.pressure,e.tangentialPressure=t.tangentialPressure,e.tiltX=t.tiltX,e.tiltY=t.tiltY,e.twist=t.twist)}copyMouseData(t,e){t instanceof _n&&e instanceof _n&&(e.altKey=t.altKey,e.button=t.button,e.buttons=t.buttons,e.ctrlKey=t.ctrlKey,e.shiftKey=t.shiftKey,e.metaKey=t.metaKey,["client","movement","canvas","screen","global","offset","viewport"].forEach((i=>{e[i].x=t[i].x,e[i].y=t[i].y})))}copyData(t,e){e.isTrusted=t.isTrusted,e.srcElement=t.srcElement,e.timeStamp=Tn.now(),e.type=t.type,e.detail=t.detail,e.view=t.view,e.which=t.which,e.layer.x=t.layer.x,e.layer.y=t.layer.y,e.page.x=t.page.x,e.page.y=t.page.y,e.pickParams=t.pickParams}trackingData(t){return this.mappingState.trackingData[t]||(this.mappingState.trackingData[t]={pressTargetsByButton:{},clicksByButton:{},overTarget:null}),this.mappingState.trackingData[t]}allocateEvent(t){var e;this.eventPool.has(t)||this.eventPool.set(t,[]);const i=(null===(e=this.eventPool.get(t))||void 0===e?void 0:e.pop())||new t(this);return i.eventPhase=i.NONE,i.currentTarget=null,i.path=[],i.target=null,i}freeEvent(t){var e;if(t.manager!==this)throw new Error("It is illegal to free an event not managed by this EventManager!");const i=t.constructor;this.eventPool.has(i)||this.eventPool.set(i,[]),null===(e=this.eventPool.get(i))||void 0===e||e.push(t)}notifyListeners(t,e){const i=t.currentTarget._events[e];if(i)if("fn"in i)i.once&&t.currentTarget.removeEventListener(e,i.fn,{once:!0}),i.fn.call(i.context,t);else for(let r=0,n=i.length;r<n&&!t.propagationImmediatelyStopped;r++)i[r].once&&t.currentTarget.removeEventListener(e,i[r].fn,{once:!0}),i[r].fn.call(i[r].context,t);this.emitDelegation(t,e)}emitDelegation(t,e){const i=t.currentTarget._events["*"];if(i)if("fn"in i)i.fn.call(i.context,t,e);else for(let r=0,n=i.length;r<n&&!t.propagationImmediatelyStopped;r++)i[r].fn.call(i[r].context,t,e)}pickTarget(t,e,i){let r;const n=this.rootTarget.pick(t,e);return r=n&&n.graphic?n.graphic:n&&n.group?n.group:this.rootTarget.AABBBounds.contains(t,e)?this.rootTarget:null,i&&(i.pickParams=n.params),r}}(r,{clickInterval:a}),this.globalObj=n,this.supportsPointerEvents=n.supportsPointerEvents,this.supportsTouchEvents=n.supportsTouchEvents,this.supportsMouseEvents=n.supportsMouseEvents,this.applyStyles=n.applyStyles,this.autoPreventDefault=s,this.eventsAdded=!1,this.viewport=o,this.rootPointerEvent=new Sn,this.rootWheelEvent=new An,this.cursorStyles={default:"inherit",pointer:"pointer"},this.resolution=i,this.setTargetElement(e)}release(){this.setTargetElement(null)}setCursor(t,e){if(!e&&!this.manager.rootTarget.window._handler.canvas.controled)return;t||(t="default");const{applyStyles:i,domElement:r}=this;if(this.currentCursor===t)return;this.currentCursor=t;const n=this.cursorStyles[t];n?"string"==typeof n&&i?r.style.cursor=n:"function"==typeof n?n(t):"object"==typeof n&&i&&Object.assign(r.style,n):i&&et(t)&&!mt(this.cursorStyles,t)&&(r.style.cursor=t)}setTargetElement(t){this.removeEvents(),this.domElement=t,this.addEvents()}addEvents(){if(this.eventsAdded||!this.domElement)return;const{globalObj:t,domElement:e}=this;this.supportsPointerEvents?(t.getDocument()?(t.getDocument().addEventListener("pointermove",this.onPointerMove,!0),t.getDocument().addEventListener("pointerup",this.onPointerUp,!0)):(e.addEventListener("pointermove",this.onPointerMove,!0),e.addEventListener("pointerup",this.onPointerUp,!0)),e.addEventListener("pointerdown",this.onPointerDown,!0),e.addEventListener("pointerleave",this.onPointerOverOut,!0),e.addEventListener("pointerover",this.onPointerOverOut,!0)):(t.getDocument()?(t.getDocument().addEventListener("mousemove",this.onPointerMove,!0),t.getDocument().addEventListener("mouseup",this.onPointerUp,!0)):(e.addEventListener("mousemove",this.onPointerMove,!0),e.addEventListener("mouseup",this.onPointerUp,!0)),e.addEventListener("mousedown",this.onPointerDown,!0),e.addEventListener("mouseout",this.onPointerOverOut,!0),e.addEventListener("mouseover",this.onPointerOverOut,!0)),this.supportsTouchEvents&&(e.addEventListener("touchstart",this.onPointerDown,!0),e.addEventListener("touchend",this.onPointerUp,!0),e.addEventListener("touchmove",this.onPointerMove,!0)),e.addEventListener("wheel",this.onWheel,{capture:!0}),this.eventsAdded=!0}removeEvents(){if(!this.eventsAdded||!this.domElement)return;const{globalObj:t,domElement:e}=this;this.supportsPointerEvents?(t.getDocument()?(t.getDocument().removeEventListener("pointermove",this.onPointerMove,!0),t.getDocument().removeEventListener("pointerup",this.onPointerUp,!0)):(e.removeEventListener("pointermove",this.onPointerMove,!0),e.removeEventListener("pointerup",this.onPointerUp,!0)),e.removeEventListener("pointerdown",this.onPointerDown,!0),e.removeEventListener("pointerleave",this.onPointerOverOut,!0),e.removeEventListener("pointerover",this.onPointerOverOut,!0)):(t.getDocument()?(t.getDocument().removeEventListener("mousemove",this.onPointerMove,!0),t.getDocument().removeEventListener("mouseup",this.onPointerUp,!0)):(e.removeEventListener("mousemove",this.onPointerMove,!0),e.removeEventListener("mouseup",this.onPointerUp,!0)),e.removeEventListener("mousedown",this.onPointerDown,!0),e.removeEventListener("mouseout",this.onPointerOverOut,!0),e.removeEventListener("mouseover",this.onPointerOverOut,!0)),this.supportsTouchEvents&&(e.removeEventListener("touchstart",this.onPointerDown,!0),e.removeEventListener("touchend",this.onPointerUp,!0),e.removeEventListener("touchmove",this.onPointerMove,!0)),e.removeEventListener("wheel",this.onWheel,!0),this.domElement=null,this.eventsAdded=!1}mapToViewportPoint(t){const e=this.viewport,{x:i,y:r}=t;return{x:i-e.x,y:r-e.y}}mapToCanvasPoint(t){var e;const i=null===(e=this.globalObj)||void 0===e?void 0:e.mapToCanvasPoint(t,this.domElement);if(i)return i;const{clientX:r,clientY:n}=t,o=this.domElement.getBoundingClientRect();return{x:r-o.left,y:n-o.top}}normalizeToPointerData(t){const e=[];if(this.supportsTouchEvents&&t.changedTouches&&t.changedTouches.length)for(let i=0,r=t.changedTouches.length;i<r;i++){const r=t.changedTouches[i];Q(r.button)&&(r.button=0),Q(r.buttons)&&(r.buttons=1),Q(r.isPrimary)&&(r.isPrimary=1===t.touches.length&&"touchstart"===t.type),Q(r.width)&&(r.width=r.radiusX||1),Q(r.height)&&(r.height=r.radiusY||1),Q(r.tiltX)&&(r.tiltX=0),Q(r.tiltY)&&(r.tiltY=0),Q(r.pointerType)&&(r.pointerType="touch"),Q(r.pointerId)&&(r.pointerId=r.identifier||0),Q(r.pressure)&&(r.pressure=r.force||.5),Q(r.twist)&&(r.twist=0),Q(r.tangentialPressure)&&(r.tangentialPressure=0),Q(r.layerX)&&(r.layerX=r.offsetX=r.clientX),Q(r.layerY)&&(r.layerY=r.offsetY=r.clientY),r.isNormalized=!0,r.type=t.type,e.push(r)}else if(!this.globalObj.supportsMouseEvents||t instanceof MouseEvent&&!(this.supportsPointerEvents&&t instanceof PointerEvent)){const i=t;Q(i.isPrimary)&&(i.isPrimary=!0),Q(i.width)&&(i.width=1),Q(i.height)&&(i.height=1),Q(i.tiltX)&&(i.tiltX=0),Q(i.tiltY)&&(i.tiltY=0),Q(i.pointerType)&&(i.pointerType="mouse"),Q(i.pointerId)&&(i.pointerId=1),Q(i.pressure)&&(i.pressure=.5),Q(i.twist)&&(i.twist=0),Q(i.tangentialPressure)&&(i.tangentialPressure=0),i.isNormalized=!0,e.push(i)}else e.push(t);return e}normalizeWheelEvent(t){const e=this.rootWheelEvent;this.transferMouseData(e,t),e.deltaMode=t.deltaMode,e.deltaX=t.deltaX,e.deltaY=t.deltaY,e.deltaZ=t.deltaZ;const{x:i,y:r}=this.mapToCanvasPoint(t);e.canvas.x=i,e.canvas.y=r,e.global.x=i,e.global.y=r,e.offset.x=i,e.offset.y=r;const{x:n,y:o}=this.mapToViewportPoint(e);return e.viewport.x=n,e.viewport.y=o,e.nativeEvent=t,e.type=t.type,e}bootstrapEvent(t,e){t.originalEvent=null,t.nativeEvent=e,t.pointerId=e.pointerId,t.width=e.width,t.height=e.height,t.isPrimary=e.isPrimary,t.pointerType=e.pointerType,t.pressure=e.pressure,t.tangentialPressure=e.tangentialPressure,t.tiltX=e.tiltX,t.tiltY=e.tiltY,t.twist=e.twist,this.transferMouseData(t,e);const{x:i,y:r}=this.mapToCanvasPoint(e);t.canvas.x=i,t.canvas.y=r,t.global.x=i,t.global.y=r,t.offset.x=i,t.offset.y=r;const{x:n,y:o}=this.mapToViewportPoint(t);return t.viewport.x=n,t.viewport.y=o,t.isTrusted=e.isTrusted,"pointerleave"===t.type&&(t.type="pointerout"),t.type.startsWith("mouse")&&(t.type=t.type.replace("mouse","pointer")),t.type.startsWith("touch")&&(t.type=Pn[t.type]||t.type),t}transferMouseData(t,e){t.isTrusted=e.isTrusted,t.srcElement=e.srcElement,t.timeStamp=Tn.now(),t.type=e.type,t.altKey=e.altKey,t.button=e.button,t.buttons=e.buttons,t.client.x=e.clientX,t.client.y=e.clientY,t.ctrlKey=e.ctrlKey,t.shiftKey=e.shiftKey,t.metaKey=e.metaKey,t.movement.x=e.movementX,t.movement.y=e.movementY,t.page.x=e.pageX,t.page.y=e.pageY,t.relatedTarget=null}isEventOutsideOfTargetElement(t){let e=t.target;return t.composedPath&&t.composedPath().length>0&&(e=t.composedPath()[0]),e!==(this.domElement.getNativeHandler?this.domElement.getNativeHandler().nativeCanvas:this.domElement)}}class Hn{constructor(){this.time=0}static Avaliable(){return!0}avaliable(){return Hn.Avaliable()}tick(t,e){this.time=Math.max(0,t+this.time),e(this,{once:!0})}tickTo(t,e){this.time=Math.max(0,t),e(this,{once:!0})}release(){this.timerId>0&&(this.timerId=-1)}getTime(){return this.time}}class Ln{static Avaliable(){return!0}avaliable(){return Ln.Avaliable()}tick(t,e){this.timerId=setTimeout((()=>{e(this)}),t)}release(){this.timerId>0&&(clearTimeout(this.timerId),this.timerId=-1)}getTime(){return Date.now()}}class kn{static Avaliable(){return!!kr.global.getRequestAnimationFrame()}avaliable(){return kn.Avaliable()}tick(t,e){kr.global.getRequestAnimationFrame()((()=>{this.released||e(this)}))}release(){this.released=!0}getTime(){return Date.now()}}var In;!function(t){t[t.INITIAL=0]="INITIAL",t[t.RUNNING=1]="RUNNING",t[t.PAUSE=2]="PAUSE"}(In||(In={}));class Fn{constructor(){}static linear(t){return t}static none(){return this.linear}static get(t){return t<-1?t=-1:t>1&&(t=1),function(e){return 0===t?e:t<0?e*(e*-t+1+t):e*((2-e)*t+(1-t))}}static getPowIn(t){return function(e){return Math.pow(e,t)}}static getPowOut(t){return function(e){return 1-Math.pow(1-e,t)}}static getPowInOut(t){return function(e){return(e*=2)<1?.5*Math.pow(e,t):1-.5*Math.abs(Math.pow(2-e,t))}}static getBackIn(t){return function(e){return e*e*((t+1)*e-t)}}static getBackOut(t){return function(e){return--e*e*((t+1)*e+t)+1}}static getBackInOut(t){return t*=1.525,function(e){return(e*=2)<1?e*e*((t+1)*e-t)*.5:.5*((e-=2)*e*((t+1)*e+t)+2)}}static sineIn(t){return 1-Math.cos(t*Math.PI/2)}static sineOut(t){return Math.sin(t*Math.PI/2)}static sineInOut(t){return-(Math.cos(Math.PI*t)-1)/2}static expoIn(t){return 0===t?0:Math.pow(2,10*t-10)}static expoOut(t){return 1===t?1:1-Math.pow(2,-10*t)}static expoInOut(t){return 0===t?0:1===t?1:t<.5?Math.pow(2,20*t-10)/2:(2-Math.pow(2,-20*t+10))/2}static circIn(t){return-(Math.sqrt(1-t*t)-1)}static circOut(t){return Math.sqrt(1- --t*t)}static circInOut(t){return(t*=2)<1?-.5*(Math.sqrt(1-t*t)-1):.5*(Math.sqrt(1-(t-=2)*t)+1)}static bounceOut(t){return t<1/2.75?7.5625*t*t:t<2/2.75?7.5625*(t-=1.5/2.75)*t+.75:t<2.5/2.75?7.5625*(t-=2.25/2.75)*t+.9375:7.5625*(t-=2.625/2.75)*t+.984375}static bounceIn(t){return 1-Fn.bounceOut(1-t)}static bounceInOut(t){return t<.5?.5*Fn.bounceIn(2*t):.5*Fn.bounceOut(2*t-1)+.5}static getElasticIn(t,e){return function(i){if(0===i||1===i)return i;const r=e/Zt*Math.asin(1/t);return-t*Math.pow(2,10*(i-=1))*Math.sin((i-r)*Zt/e)}}static getElasticOut(t,e){return function(i){if(0===i||1===i)return i;const r=e/Zt*Math.asin(1/t);return t*Math.pow(2,-10*i)*Math.sin((i-r)*Zt/e)+1}}static getElasticInOut(t,e){return function(i){const r=e/Zt*Math.asin(1/t);return(i*=2)<1?t*Math.pow(2,10*(i-=1))*Math.sin((i-r)*Zt/e)*-.5:t*Math.pow(2,-10*(i-=1))*Math.sin((i-r)*Zt/e)*.5+1}}}Fn.quadIn=Fn.getPowIn(2),Fn.quadOut=Fn.getPowOut(2),Fn.quadInOut=Fn.getPowInOut(2),Fn.cubicIn=Fn.getPowIn(3),Fn.cubicOut=Fn.getPowOut(3),Fn.cubicInOut=Fn.getPowInOut(3),Fn.quartIn=Fn.getPowIn(4),Fn.quartOut=Fn.getPowOut(4),Fn.quartInOut=Fn.getPowInOut(4),Fn.quintIn=Fn.getPowIn(5),Fn.quintOut=Fn.getPowOut(5),Fn.quintInOut=Fn.getPowInOut(5),Fn.backIn=Fn.getBackIn(1.7),Fn.backOut=Fn.getBackOut(1.7),Fn.backInOut=Fn.getBackInOut(1.7),Fn.elasticIn=Fn.getElasticIn(1,.3),Fn.elasticOut=Fn.getElasticOut(1,.3),Fn.elasticInOut=Fn.getElasticInOut(1,.3*1.5);class zn{constructor(){this.id=e.GenAutoIncrementId(),this.animateHead=null,this.animateTail=null,this.animateCount=0,this.paused=!1}addAnimate(t){this.animateTail?(this.animateTail.nextAnimate=t,t.prevAnimate=this.animateTail,this.animateTail=t,t.nextAnimate=null):(this.animateHead=t,this.animateTail=t),this.animateCount++}pause(){this.paused=!0}resume(){this.paused=!1}tick(t){if(this.paused)return;let e=this.animateHead;for(this.animateCount=0;e;)e.status===xi.END?this.removeAnimate(e):e.status===xi.RUNNING||e.status===xi.INITIAL?(this.animateCount++,e.advance(t)):e.status===xi.PAUSED&&this.animateCount++,e=e.nextAnimate}clear(){let t=this.animateHead;for(;t;)t.release(),t=t.nextAnimate;this.animateHead=null,this.animateTail=null,this.animateCount=0}removeAnimate(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];t._onRemove&&t._onRemove.forEach((t=>t())),t===this.animateHead?(this.animateHead=t.nextAnimate,t===this.animateTail?this.animateTail=null:this.animateHead.prevAnimate=null):t===this.animateTail?(this.animateTail=t.prevAnimate,this.animateTail.nextAnimate=null):(t.prevAnimate.nextAnimate=t.nextAnimate,t.nextAnimate.prevAnimate=t.prevAnimate),e&&t.release()}}const On=new zn;class Dn{constructor(t,e,i,r,n){this.from=t,this.to=e,this.duration=i,this.easing=r,this.params=n,this.updateCount=0}bind(t,e){this.target=t,this.subAnimate=e,this.onBind()}onBind(){}onFirstRun(){}onStart(){}onEnd(){}getEndProps(){}getFromProps(){return this.from}getMergedEndProps(){var t;const e=this.getEndProps();return e?this._endProps===e?this._mergedEndProps:(this._endProps=e,void(this._mergedEndProps=Object.assign({},null!==(t=this.step.prev.getLastProps())&&void 0!==t?t:{},e))):this.step.prev?this.step.prev.getLastProps():e}update(t,e,i){if(0===this.updateCount){this.onFirstRun();const t=this.step.getLastProps();Object.keys(t).forEach((e=>{this.subAnimate.animate.validAttr(e)&&(i[e]=t[e])}))}this.updateCount+=1,this.onUpdate(t,e,i),t&&this.onEnd()}}class Wn extends Dn{constructor(t){super(null,null,0,"linear"),this.cb=t}onUpdate(t,e,i){}onStart(){this.cb()}}class Nn{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:e.GenAutoIncrementId(),i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:On;this.id=t,this.timeline=i,this.status=xi.INITIAL,this.tailAnimate=new Gn(this),this.subAnimates=[this.tailAnimate],this.timeScale=1,this.rawPosition=-1,this._startTime=0,this._duringTime=0,this.timeline.addAnimate(this)}setTimeline(t){t!==this.timeline&&(this.timeline.removeAnimate(this,!1),t.addAnimate(this))}getStartTime(){return this._startTime}getDuration(){return this.subAnimates.reduce(((t,e)=>t+e.totalDuration),0)}after(t){const e=t.getDuration();return this._startTime=e,this}afterAll(t){let e=-1/0;return t.forEach((t=>{e=ee(t.getDuration(),e)})),this._startTime=e,this}parallel(t){return this._startTime=t.getStartTime(),this}static AddInterpolate(t,e){Nn.interpolateMap.set(t,e)}play(t){if(this.tailAnimate.play(t),this.target){const t=this.target.stage;t&&t.renderNextFrame()}return 1===this.subAnimates.length&&this.tailAnimate.duration===t.duration&&this.trySetAttribute(t.getFromProps(),t.mode),this}trySetAttribute(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Nn.mode;t&&e&_i.SET_ATTR_IMMEDIATELY&&this.target.setAttributes&&this.target.setAttributes(t,!1,{type:wi.ANIMATE_PLAY})}runCb(t){const e=new Wn((()=>{t(this,e.step.prev)}));return this.tailAnimate.play(e),this}customInterpolate(t,e,i,r,n,o){const s=Nn.interpolateMap.get(t)||Nn.interpolateMap.get("");return!!s&&s(t,e,i,r,n,o)}pause(){this.status===xi.RUNNING&&(this.status=xi.PAUSED)}resume(){this.status===xi.PAUSED&&(this.status=xi.RUNNING)}to(t,e,i,r){if(this.tailAnimate.to(t,e,i,r),this.target){const t=this.target.stage;t&&t.renderNextFrame()}return this}from(t,e,i,r){if(this.tailAnimate.from(t,e,i,r),this.target){const t=this.target.stage;t&&t.renderNextFrame()}return this}wait(t){if(this.tailAnimate.wait(t),this.target){const t=this.target.stage;t&&t.renderNextFrame()}return this}startAt(t){if(this.tailAnimate.startAt(t),this.target){const t=this.target.stage;t&&t.renderNextFrame()}return this}loop(t){if(this.tailAnimate.loop=t,this.target){const t=this.target.stage;t&&t.renderNextFrame()}return this}reversed(t){if(this.tailAnimate.reversed=t,this.target){const t=this.target.stage;t&&t.renderNextFrame()}return this}bounce(t){if(this.tailAnimate.bounce=t,this.target){const t=this.target.stage;t&&t.renderNextFrame()}return this}subAnimate(){const t=new Gn(this,this.tailAnimate);return this.tailAnimate=t,this.subAnimates.push(t),t.bind(this.target),this}getStartProps(){return this.subAnimates[0].getStartProps()}getEndProps(){return this.tailAnimate.getEndProps()}depreventAttr(t){this._preventAttrs&&this._preventAttrs.delete(t)}preventAttr(t){this._preventAttrs||(this._preventAttrs=new Set),this._preventAttrs.add(t)}preventAttrs(t){t.forEach((t=>this.preventAttr(t)))}validAttr(t){return!this._preventAttrs||!this._preventAttrs.has(t)}bind(t){return this.target=t,this.target.onAnimateBind&&this.target.onAnimateBind(this),this.subAnimates.forEach((e=>{e.bind(t)})),this}advance(t){if(this._duringTime<this._startTime){if(this._duringTime+t*this.timeScale<this._startTime)return void(this._duringTime+=t*this.timeScale);t=this._duringTime+t*this.timeScale-this._startTime,this._duringTime=this._startTime}this.status===xi.INITIAL&&(this.status=xi.RUNNING,this._onStart&&this._onStart.forEach((t=>t()))),this.setPosition(this.rawPosition+t*this.timeScale)&&this.status===xi.RUNNING&&(this.status=xi.END,this._onEnd&&this._onEnd.forEach((t=>t())))}setPosition(t){let e,i=0;const r=this.rawPosition,n=this.subAnimates.reduce(((t,e)=>t+e.totalDuration),0);t<0&&(t=0);const o=t>=n;if(o&&(t=n),t===r)return o;for(let r=0;r<this.subAnimates.length&&(e=this.subAnimates[r],!(i+e.totalDuration>=t));r++)i+=e.totalDuration,e=void 0;return this.rawPosition=t,e.setPosition(t-i),o}onStart(t){this._onStart||(this._onStart=[]),this._onStart.push(t)}onEnd(t){this._onEnd||(this._onEnd=[]),this._onEnd.push(t)}onRemove(t){this._onRemove||(this._onRemove=[]),this._onRemove.push(t)}onFrame(t){this._onFrame||(this._onFrame=[]),this._onFrame.push(t)}release(){this.status=xi.END}stop(t){t||this.target.onStop(),"start"===t?this.target.onStop(this.getStartProps()):"end"===t?this.target.onStop(this.getEndProps()):this.target.onStop(t),this.release()}}Nn.mode=_i.NORMAL,Nn.interpolateMap=new Map;class Gn{get totalDuration(){return this.calcAttr(),this._totalDuration+this._startAt}constructor(t,e){this.rawPosition=-1,this.position=0,this.loop=0,this.duration=0,this.animate=t,this.stepHead=new jn(0,0,e?Object.assign({},e.stepTail.props):{}),this.stepTail=this.stepHead,this.dirty=!0,this._startAt=0}calcAttr(){this.dirty&&(this._totalDuration=this.duration*(this.loop+1))}bind(t){return this.target=t,this}play(t){let e=t.duration;(null==e||e<0)&&(e=0);const i=t.easing,r="string"==typeof i?Fn[i]:i,n=this._addStep(e,null,r);return n.type=Si.customAnimate,this._appendProps(t.getEndProps(),n,!1),this._appendCustomAnimate(t,n),this}to(t,e,i,r){(null==e||e<0)&&(e=0);const n="string"==typeof i?Fn[i]:i,o=this._addStep(e,null,n);return o.type=Si.to,this._appendProps(t,o,!!r&&r.tempProps),o.propKeys||(o.propKeys=Object.keys(o.props)),r&&r.noPreventAttrs||this.target.animates.forEach((t=>{t.id!==this.animate.id&&t.preventAttrs(o.propKeys)})),this}from(t,e,i,r){this.to(t,0,i,r);const n={};this.stepTail.propKeys||(this.stepTail.propKeys=Object.keys(this.stepTail.props)),this.stepTail.propKeys.forEach((t=>{n[t]=this.getLastPropByName(t,this.stepTail)})),this.to(n,e,i,r),this.stepTail.type=Si.from}startAt(t){return t<0&&(t=0),this._startAt=t,this}getStartProps(){var t;return null===(t=this.stepHead)||void 0===t?void 0:t.props}getEndProps(){return this.stepTail.props}getLastStep(){return this._lastStep}wait(t){if(t>0){const e=this._addStep(+t,null);e.type=Si.wait,e.prev.customAnimate?e.props=e.prev.customAnimate.getEndProps():e.props=e.prev.props,this.target.onAddStep&&this.target.onAddStep(e)}return this}_addStep(t,e,i){const r=new jn(this.duration,t,e,i);return this.duration+=t,this.stepTail.append(r),this.stepTail=r,r}_appendProps(t,e,i){e.props=i?t:Object.assign({},t);let r=e.prev;const n=e.props;for(e.propKeys||(e.propKeys=Object.keys(e.props)),e.propKeys.forEach((t=>{void 0===e.props[t]&&(e.props[t]=this.target.getDefaultAttribute(t))}));r.prev;)r.props&&(r.propKeys||(r.propKeys=Object.keys(r.props)),r.propKeys.forEach((t=>{void 0===n[t]&&(n[t]=r.props[t])}))),e.propKeys=Object.keys(e.props),r=r.prev;const o=this.stepHead.props;e.propKeys||(e.propKeys=Object.keys(n)),e.propKeys.forEach((t=>{if(void 0===o[t]){const e=this.animate.getStartProps();o[t]=e[t]=this.target.getComputedAttribute(t)}})),this.target.onAddStep&&this.target.onAddStep(e)}_appendCustomAnimate(t,e){e.customAnimate=t,t.step=e,t.bind(this.target,this)}setPosition(t){var e;const i=this.duration,r=this.loop,n=this.rawPosition;let o,s,a=!1;const l=null!==(e=this._startAt)&&void 0!==e?e:0;if(t<0&&(t=0),t<l)return this.rawPosition=t,!1;if(t-=l,i<=0)return a=!0,a;if(o=Math.floor(t/i),s=t-o*i,a=t>=r*i+i,a&&(s=i,o=r,t=s*o+i),t===n)return a;const h=!this.reversed!=!(this.bounce&&o%2);return h&&(s=i-s),this._deltaPosition=s-this.position,this.position=s,this.rawPosition=t+l,this.updatePosition(a,h),a}updatePosition(t,e){if(!this.stepHead)return;let i=this.stepHead.next;const r=this.position,n=this.duration;if(this.target&&i){let o=i.next;for(;o&&o.position<=r;)i=o,o=i.next;let s=t?0===n?1:r/n:(r-i.position)/i.duration;i.easing&&(s=i.easing(s)),this.tryCallCustomAnimateLifeCycle(i,this._lastStep||(e?this.stepTail:this.stepHead),e),this.updateTarget(i,s,t),this._lastStep=i,this.animate._onFrame&&this.animate._onFrame.forEach((t=>t(i,s)))}}tryCallCustomAnimateLifeCycle(t,e,i){if(t!==e)if(i){let i=e.prev;for(;i&&i!==t;)i.customAnimate&&(i.customAnimate.onStart&&i.customAnimate.onStart(),i.customAnimate.onEnd&&i.customAnimate.onEnd()),i=t.prev;e&&e.customAnimate&&e.customAnimate.onEnd&&e.customAnimate.onEnd(),t&&t.customAnimate&&t.customAnimate.onStart&&t.customAnimate.onStart()}else{let i=e.next;for(;i&&i!==t;)i.customAnimate&&(i.customAnimate.onStart&&i.customAnimate.onStart(),i.customAnimate.onEnd&&i.customAnimate.onEnd()),i=i.next;e&&e.customAnimate&&e.customAnimate.onEnd&&e.customAnimate.onEnd(),t&&t.customAnimate&&t.customAnimate.onStart&&t.customAnimate.onStart()}}getLastPropByName(t,e){let i=e.prev;for(;i;){if(i.props&&void 0!==i.props[t])return i.props[t];if(i.customAnimate){const e=i.customAnimate.getEndProps()[t];if(void 0!==e)return e}i=i.prev}return Ze.getInstance().warn("未知错误,step中找不到属性"),e.props[t]}updateTarget(t,e,i){null==t.props&&null==t.customAnimate||this.target.onStep(this,this.animate,t,e,i)}}class jn{constructor(t,e,i,r){this.duration=e,this.position=t,this.props=i,this.easing=r}append(t){t.prev=this,t.next=this.next,this.next=t}getLastProps(){let t=this.prev;for(;t;){if(t.props)return t.props;if(t.customAnimate)return t.customAnimate.getMergedEndProps();t=t.prev}return null}}const Un=200,Vn="cubicOut";var Kn;!function(t){t[t.Top=1]="Top",t[t.Right=2]="Right",t[t.Bottom=4]="Bottom",t[t.Left=8]="Left",t[t.ALL=15]="ALL"}(Kn||(Kn={}));const $n=[!1,!1,!1,!1],Xn=[0,0,0,0],Yn=t=>t?it(t)?0===t.length?0:1===t.length?t[0]:2===t.length?(Xn[0]=t[0],Xn[2]=t[0],Xn[1]=t[1],Xn[3]=t[1],Xn):t:t:0,qn=[{x:0,y:0},{x:0,y:0},{x:0,y:0},{x:0,y:0}],Zn=[1,2,3,0,1,2,3,0];function Jn(t,e,i,r){for(;t>=Zt;)t-=Zt;for(;t<0;)t+=Zt;for(;t>e;)e+=Zt;qn[0].x=i,qn[1].y=i,qn[2].x=-i,qn[3].y=-i;const n=Math.ceil(t/Yt)%4,o=Math.ceil(e/Yt)%4;if(r.add(te(t)*i,re(t)*i),r.add(te(e)*i,re(e)*i),n!==o||e-t>Xt){let t=!1;for(let e=0;e<Zn.length;e++)if(t||n!==Zn[e]){if(t&&o===Zn[e])break;if(t){const t=qn[Zn[e]];r.add(t.x,t.y)}}else{t=!0;const e=qn[n];r.add(e.x,e.y)}}}function Qn(t,e,i){const{x:r,y:n}=le(t.x,t.y,e.x,e.y,i),{x:o,y:s}=le(t.x1,t.y1,e.x1,e.y1,i),a=new he(r,n,o,s);return a.defined=e.defined,a}function to(t,e,i){if(!t||!e)return[];Array.isArray(t)||(t=[t]),Array.isArray(e)||(e=[e]);let r=[];if(t.length>e.length){r=e.map((t=>{const e=new he(t.x,t.y,t.x1,t.y1);return e.defined=t.defined,e}));for(let n=0;n<e.length;n++)r[n]=Qn(t[n],e[n],i)}else{r=e.map((t=>{const e=new he(t.x,t.y,t.x1,t.y1);return e.defined=t.defined,e}));for(let n=0;n<t.length;n++)r[n]=Qn(t[n],e[n],i)}return r}function eo(t,e){if(it(t)){let i;for(let r=0;r<t.length&&void 0===i;r++)i=t[r][e];return i}return t[e]}class io{constructor(){this.durations=[],this.timeout=io.TimeOut,this.lastDate=0,this.durationsListThreshold=30}call(t){return this.lastDate=Date.now(),setTimeout((()=>{this.appendDuration(Date.now()-this.lastDate),t(0)}),this.timeout,!0)}clear(t){clearTimeout(t)}appendDuration(t){this.durations.push(t),this.durations.length>this.durationsListThreshold&&this.durations.shift(),this.timeout=Math.min(Math.max(this.durations.reduce(((t,e)=>t+e),0)/this.durations.length,1e3/60),1e3/30)}}io.TimeOut=1e3/60;const ro=new io,no=(t,e)=>et(t)&&"%"===t[t.length-1]?e*(Number.parseFloat(t.substring(0,t.length-1))/100):t;var oo;!function(t){t[t.Color255=0]="Color255",t[t.Color1=1]="Color1"}(oo||(oo={}));class so{static Get(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:oo.Color1,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[0,0,0,1];if(e===oo.Color1){const e=so.store1[t];if(e)return i[0]=e[0],i[1]=e[1],i[2]=e[2],i[3]=e[3],i;const r=Te.parseColorString(t);if(r){const e=[r.r/255,r.g/255,r.b/255,r.opacity];so.store1[t]=e,so.store255[t]=[r.r,r.g,r.b,r.opacity],i[0]=e[0],i[1]=e[1],i[2]=e[2],i[3]=e[3]}return i}const r=so.store255[t];if(r)return i[0]=r[0],i[1]=r[1],i[2]=r[2],i[3]=r[3],i;const n=Te.parseColorString(t);return n&&(so.store1[t]=[n.r/255,n.g/255,n.b/255,n.opacity],so.store255[t]=[n.r,n.g,n.b,n.opacity],i[0]=n.r,i[1]=n.g,i[2]=n.b,i[3]=n.opacity),i}static Set(t,e,i){if(e===oo.Color1){if(so.store1[t])return;so.store1[t]=i,so.store255[t]=[Math.floor(255*i[0]),Math.floor(255*i[1]),Math.floor(255*i[2]),Math.floor(255*i[3])]}else{if(so.store255[t])return;so.store255[t]=i,so.store1[t]=[i[0]/255,i[1]/255,i[2]/255,i[3]]}}}function ao(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return Array.isArray(t)?e?`rgb(${Math.round(t[0])},${Math.round(t[1])},${Math.round(t[2])},${t[3].toFixed(2)})`:`rgb(${Math.round(t[0])},${Math.round(t[1])},${Math.round(t[2])})`:t}function lo(t,e,i,r,n){if(!t||!e)return t&&ao(t)||e&&ao(e)||!1;let o,s,a=!1,l=!1;if(Array.isArray(t)?o=t:"string"==typeof t?o=so.Get(t,oo.Color255):a=!0,Array.isArray(e)?s=e:"string"==typeof e?s=so.Get(e,oo.Color255):l=!0,a!==l){const o=a?t:e,s=a?e:t,l=Object.assign(Object.assign({},o),{stops:o.stops.map((t=>Object.assign(Object.assign({},t),{color:ao(s)})))});return a?lo(o,l,i,r,n):lo(l,o,i,r,n)}if(a){if(t.gradient===e.gradient){const r=t,n=e,o=r.stops,s=n.stops;if(o.length!==s.length)return!1;if("linear"===r.gradient)return function(t,e,i){const r=t.stops,n=e.stops;return{gradient:"linear",x0:t.x0+(e.x0-t.x0)*i,x1:t.x1+(e.x1-t.x1)*i,y0:t.y0+(e.y0-t.y0)*i,y1:t.y1+(e.y1-t.y1)*i,stops:new Array(r.length).fill(0).map(((t,e)=>({color:uo(r[e].color,n[e].color,i),offset:r[e].offset+(n[e].offset-r[e].offset)*i})))}}(r,n,i);if("radial"===r.gradient)return function(t,e,i){const r=t.stops,n=e.stops;return{gradient:"radial",x0:t.x0+(e.x0-t.x0)*i,x1:t.x1+(e.x1-t.x1)*i,y0:t.y0+(e.y0-t.y0)*i,y1:t.y1+(e.y1-t.y1)*i,r0:t.r0+(e.r0-t.r0)*i,r1:t.r1+(e.r1-t.r1)*i,stops:new Array(r.length).fill(0).map(((t,e)=>({color:uo(r[e].color,n[e].color,i),offset:r[e].offset+(n[e].offset-r[e].offset)*i})))}}(r,n,i);if("conical"===r.gradient)return function(t,e,i){const r=t.stops,n=e.stops;return{gradient:"conical",startAngle:t.startAngle+(e.startAngle-t.startAngle)*i,endAngle:t.endAngle+(e.endAngle-t.endAngle)*i,x:t.x+(e.x-t.x)*i,y:t.y+(e.y-t.y)*i,stops:new Array(r.length).fill(0).map(((t,e)=>({color:uo(r[e].color,n[e].color,i),offset:r[e].offset+(n[e].offset-r[e].offset)*i})))}}(r,n,i)}return!1}return n&&n(o,s),ao(function(t,e,i){return[t[0]+(e[0]-t[0])*i,t[1]+(e[1]-t[1])*i,t[2]+(e[2]-t[2])*i,t[3]+(e[3]-t[3])*i]}(o,s,i),r)}so.store255={},so.store1={};const ho=[0,0,0,0],co=[0,0,0,0];function uo(t,e,i){return so.Get(t,oo.Color255,ho),so.Get(e,oo.Color255,co),`rgba(${Math.round(ho[0]+(co[0]-ho[0])*i)},${Math.round(ho[1]+(co[1]-ho[1])*i)},${Math.round(ho[2]+(co[2]-ho[2])*i)},${ho[3]+(co[3]-ho[3])*i})`}class go{static GetImage(t,e){var i;let r=go.cache.get(t);r?"fail"===r.loadState?kr.global.getRequestAnimationFrame()((()=>{e.imageLoadFail(t)})):"init"===r.loadState||"loading"===r.loadState?null===(i=r.waitingMark)||void 0===i||i.push(e):e&&e.imageLoadSuccess(t,r.data):(r={type:"image",loadState:"init"},go.cache.set(t,r),r.dataPromise=kr.global.loadImage(t),r.dataPromise?(r.waitingMark=[e],r.dataPromise.then((e=>{var i;r.loadState=(null==e?void 0:e.data)?"success":"fail",r.data=null==e?void 0:e.data,null===(i=r.waitingMark)||void 0===i||i.map(((i,n)=>{(null==e?void 0:e.data)?(r.loadState="success",r.data=e.data,i.imageLoadSuccess(t,e.data)):(r.loadState="fail",i.imageLoadFail(t))}))}))):(r.loadState="fail",e.imageLoadFail(t)))}static GetSvg(t,e){var i;let r=go.cache.get(t);r?"fail"===r.loadState?kr.global.getRequestAnimationFrame()((()=>{e.imageLoadFail(t)})):"init"===r.loadState||"loading"===r.loadState?null===(i=r.waitingMark)||void 0===i||i.push(e):e&&kr.global.getRequestAnimationFrame()((()=>{e.imageLoadSuccess(t,r.data)})):(r={type:"image",loadState:"init"},go.cache.set(t,r),r.dataPromise=kr.global.loadSvg(t),r.dataPromise?(r.waitingMark=[e],r.dataPromise.then((e=>{var i;r.loadState=(null==e?void 0:e.data)?"success":"fail",r.data=null==e?void 0:e.data,null===(i=r.waitingMark)||void 0===i||i.map(((i,n)=>{(null==e?void 0:e.data)?(r.loadState="success",r.data=e.data,i.imageLoadSuccess(t,e.data)):(r.loadState="fail",i.imageLoadFail(t))}))}))):(r.loadState="fail",e.imageLoadFail(t)))}static GetFile(t,e){let i=go.cache.get(t);return i?"init"===i.loadState||"fail"===i.loadState?Promise.reject():"loading"===i.loadState?i.dataPromise.then((t=>t.data)):Promise.resolve(i.data):(i={type:e,loadState:"init"},go.cache.set(t,i),"arrayBuffer"===e?i.dataPromise=kr.global.loadArrayBuffer(t):"blob"===e?i.dataPromise=kr.global.loadBlob(t):"json"===e&&(i.dataPromise=kr.global.loadJson(t)),i.dataPromise.then((t=>t.data)))}}go.cache=new Map;const po=new me,fo=new ge,mo=["lineWidth","scaleX","scaleY","angle","anchor","visible"],bo=["x","y"],yo=["scaleX","scaleY"],Co=["angle"],vo=new he,wo={strokeSeg:1,boundsPadding:2,pickMode:1,boundsMode:1,customPickShape:1,pickable:1,childrenPickable:1,visible:1,zIndex:1,layout:1,keepDirIn3d:1,outerBorder:1,innerBorder:1,lineDash:1,lineCap:1,lineJoin:1,miterLimit:2,strokeBoundsBuffer:2,scaleCenter:1,anchor:1,anchor3d:1,postMatrix:1,backgroundMode:2,background:1,texture:1,cursor:1,html:1};class xo extends wn{static mixin(t){const e=Object.keys(t);for(let i=0;i<e.length;++i){const r=e[i];Object.defineProperty(xo.prototype,r,Object.getOwnPropertyDescriptor(t,r))}}get AABBBounds(){return this.tryUpdateAABBBounds("imprecise"===this.attribute.boundsMode)}get OBBBounds(){return this.tryUpdateOBBBounds()}get globalAABBBounds(){return this.tryUpdateGlobalAABBBounds()}get transMatrix(){return this.tryUpdateLocalTransMatrix(!0)}get globalTransMatrix(){return this.tryUpdateGlobalTransMatrix(!0)}constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};super(),this._AABBBounds=new ge,this._updateTag=Ci.INIT,this.attribute=t,this.valid=this.isValid(),t.background&&this.loadImage(t.background,!0)}setMode(t){"3d"===t?this.set3dMode():this.set2dMode()}set3dMode(){this.in3dMode=!0}set2dMode(){this.in3dMode=!1}getOffsetXY(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];var i,r;const{dx:n=t.dx,dy:o=t.dy}=this.attribute;if(e&&this.parent){const t=this.parent.attribute;vo.x=n+(null!==(i=t.scrollX)&&void 0!==i?i:0),vo.y=o+(null!==(r=t.scrollY)&&void 0!==r?r:0)}else vo.x=n,vo.y=o;return vo}onAnimateBind(t){this._emitCustomEvent("animate-bind",t)}tryUpdateAABBBounds(t){if(!this.shouldUpdateAABBBounds())return this._AABBBounds;if(!this.valid)return this._AABBBounds.clear(),this._AABBBounds;kr.graphicService.beforeUpdateAABBBounds(this,this.stage,!0,this._AABBBounds);const e=this.doUpdateAABBBounds(t);return this.addUpdateLayoutTag(),kr.graphicService.afterUpdateAABBBounds(this,this.stage,this._AABBBounds,this,!0),e}combindShadowAABBBounds(t){if(this.shadowRoot){const e=this.shadowRoot.AABBBounds.clone();t.union(e)}}tryUpdateGlobalAABBBounds(){return this._globalAABBBounds?this._globalAABBBounds.setValue(this._AABBBounds.x1,this._AABBBounds.y1,this._AABBBounds.x2,this._AABBBounds.y2):this._globalAABBBounds=this.AABBBounds.clone(),this.parent&&this._globalAABBBounds.transformWithMatrix(this.parent.globalTransMatrix),this._globalAABBBounds}tryUpdateGlobalTransMatrix(){if(this._globalTransMatrix){if(this.parent){const t=this.parent.globalTransMatrix;this._globalTransMatrix.setValue(t.a,t.b,t.c,t.d,t.e,t.f)}}else this._globalTransMatrix=this.parent?this.parent.globalTransMatrix.clone():this.transMatrix.clone();return this.shouldUpdateGlobalMatrix()&&this.doUpdateGlobalMatrix(),this._globalTransMatrix}shouldUpdateGlobalMatrix(){return!0}tryUpdateLocalTransMatrix(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];return this._transMatrix||(this._transMatrix=new me),this.shouldUpdateLocalMatrix()&&(this.doUpdateLocalMatrix(),t&&this.clearUpdateLocalPositionTag()),this._transMatrix}shouldUpdateAABBBounds(){return this.shadowRoot?!!(this._updateTag&Ci.UPDATE_BOUNDS)||this.shadowRoot.shouldUpdateAABBBounds():!!(this._updateTag&Ci.UPDATE_BOUNDS)}shouldSelfChangeUpdateAABBBounds(){return this.shadowRoot?!!(this._updateTag&Ci.UPDATE_BOUNDS)||this.shadowRoot.shouldUpdateAABBBounds():!!(this._updateTag&Ci.UPDATE_BOUNDS)}shouldUpdateLocalMatrix(){return!!(this._updateTag&Ci.UPDATE_LOCAL_MATRIX)}isValid(){var t,e;const i=this.attribute;return Number.isFinite((null!==(t=i.x)&&void 0!==t?t:0)+(null!==(e=i.y)&&void 0!==e?e:0))}_validNumber(t){return null==t||Number.isFinite(t)}shouldUpdateShape(){return!!(this._updateTag&Ci.UPDATE_SHAPE)}clearUpdateShapeTag(){this._updateTag&=Ci.CLEAR_SHAPE}containsPoint(t,e,i,r){if(!r)return!1;if(i===vi.GLOBAL){const i=new he(t,e);this.parent&&this.parent.globalTransMatrix.transformPoint(i,i),t=i.x,e=i.y}return r.containsPoint(this,{x:t,y:e})}setAttributes(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=arguments.length>2?arguments[2]:void 0;(t=this.onBeforeAttributeUpdate&&this.onBeforeAttributeUpdate(t,this.attribute,null,i)||t).background&&this.loadImage(t.background,!0),this._setAttributes(t,e,i)}_setAttributes(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=arguments.length>2?arguments[2]:void 0;const r=Object.keys(t);for(let e=0;e<r.length;e++){const i=r[e];this.attribute[i]=t[i]}this.valid=this.isValid(),this.updateShapeAndBoundsTagSetted()||!e&&!this.needUpdateTags(r)?this.addUpdateBoundTag():this.addUpdateShapeAndBoundsTag(),this.addUpdatePositionTag(),this.addUpdateLayoutTag(),this.onAttributeUpdate(i)}setAttribute(t,e,i,r){var n;const o=this.onBeforeAttributeUpdate&&this.onBeforeAttributeUpdate({[t]:e},this.attribute,t,r);o?this._setAttributes(o,i,r):X(null===(n=this.normalAttrs)||void 0===n?void 0:n[t])?(this.attribute[t]=e,this.valid=this.isValid(),this.updateShapeAndBoundsTagSetted()||!i&&!this.needUpdateTag(t)?this.addUpdateBoundTag():this.addUpdateShapeAndBoundsTag(),this.addUpdatePositionTag(),this.addUpdateLayoutTag(),this.onAttributeUpdate(r)):this.normalAttrs[t]=e,"background"===t&&this.loadImage(e,!0)}needUpdateTags(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:mo;for(let i=0;i<e.length;i++){const r=e[i];if(-1!==t.indexOf(r))return!0}return!1}needUpdateTag(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:mo;for(let i=0;i<e.length;i++)if(t===e[i])return!0;return!1}initAttributes(t){const e={type:wi.INIT};t=this.onBeforeAttributeUpdate&&this.onBeforeAttributeUpdate(t,this.attribute,null,e)||t,this.attribute=t,t.background&&this.loadImage(t.background,!0),this._updateTag=Ci.INIT,this.onAttributeUpdate(e)}translate(t,e){var i,r;if(0===t&&0===e)return this;const n={type:wi.TRANSLATE},o=this.onBeforeAttributeUpdate&&this.onBeforeAttributeUpdate({x:t,y:e},this.attribute,bo,n);o&&(t=o.x,e=o.y,delete o.x,delete o.y,this._setAttributes(o));const s=this.attribute,a=s.postMatrix;return a?kr.transformUtil.fromMatrix(a,a).translate(t,e):(s.x=(null!==(i=s.x)&&void 0!==i?i:dr.x)+t,s.y=(null!==(r=s.y)&&void 0!==r?r:dr.y)+e),this.addUpdatePositionTag(),this.addUpdateBoundTag(),this.addUpdateLayoutTag(),this.onAttributeUpdate(n),this}translateTo(t,e){const i=this.attribute;if(i.x===t&&i.y===e)return this;const r={type:wi.TRANSLATE_TO},n=this.onBeforeAttributeUpdate&&this.onBeforeAttributeUpdate({x:t,y:e},this.attribute,bo,r);return n?(this._setAttributes(n,!1,r),this):(i.x=t,i.y=e,this.addUpdatePositionTag(),this.addUpdateBoundTag(),this.addUpdateLayoutTag(),this.onAttributeUpdate(r),this)}scale(t,e,i){var r,n;if(1===t&&1===e)return this;const o={type:wi.SCALE},s=this.onBeforeAttributeUpdate&&this.onBeforeAttributeUpdate({scaleX:t,scaleY:e,scaleCenter:i},this.attribute,yo,o);s&&(t=s.scaleX,e=s.scaleY,delete s.scaleX,delete s.scaleY,this._setAttributes(s));const a=this.attribute;if(i){let{postMatrix:r}=this.attribute;r||(r=new me,a.postMatrix=r),kr.transformUtil.fromMatrix(r,r).scale(t,e,i)}else a.scaleX=(null!==(r=a.scaleX)&&void 0!==r?r:dr.scaleX)*t,a.scaleY=(null!==(n=a.scaleY)&&void 0!==n?n:dr.scaleY)*e;return this.addUpdatePositionTag(),this.addUpdateBoundTag(),this.addUpdateLayoutTag(),this.onAttributeUpdate(o),this}scaleTo(t,e){const i=this.attribute;if(i.scaleX===t&&i.scaleY===e)return this;const r={type:wi.SCALE_TO},n=this.onBeforeAttributeUpdate&&this.onBeforeAttributeUpdate({scaleX:t,scaleY:e},this.attribute,yo,r);return n?(this._setAttributes(n,!1,r),this):(i.scaleX=t,i.scaleY=e,this.addUpdatePositionTag(),this.addUpdateBoundTag(),this.addUpdateLayoutTag(),this.onAttributeUpdate(r),this)}rotate(t,e){var i;if(0===t)return this;const r={type:wi.ROTATE},n=this.onBeforeAttributeUpdate&&this.onBeforeAttributeUpdate({angle:t,rotateCenter:e},this.attribute,Co,r);n&&(delete n.angle,this._setAttributes(n,!1,r));const o=this.attribute;if(e){let{postMatrix:i}=this.attribute;i||(i=new me,o.postMatrix=i),kr.transformUtil.fromMatrix(i,i).rotate(t,e)}else o.angle=(null!==(i=o.angle)&&void 0!==i?i:dr.angle)+t;return this.addUpdatePositionTag(),this.addUpdateBoundTag(),this.addUpdateLayoutTag(),this.onAttributeUpdate(r),this}rotateTo(t){const e=this.attribute;if(e.angle===t)return this;const i={type:wi.ROTATE_TO},r=this.onBeforeAttributeUpdate&&this.onBeforeAttributeUpdate(t,this.attribute,Co,i);return r?(this._setAttributes(r,!1,i),this):(e.angle=t,this.addUpdatePositionTag(),this.addUpdateBoundTag(),this.addUpdateLayoutTag(),this.onAttributeUpdate(i),this)}skewTo(t,e){return this}animate(t){this.animates||(this.animates=new Map);const e=new Nn(null==t?void 0:t.id).bind(this);if(t){const{onStart:i,onFrame:r,onEnd:n,onRemove:o}=t;null!=i&&e.onStart(i),null!=r&&e.onFrame(r),null!=n&&e.onEnd(n),null!=o&&e.onRemove(o),e.interpolateFunc=t.interpolate}return this.animates.set(e.id,e),e.onRemove((()=>{this.animates.delete(e.id)})),e}onAttributeUpdate(t){t&&t.skipUpdateCallback||(kr.graphicService.onAttributeUpdate(this),this._emitCustomEvent("afterAttributeUpdate",t))}update(t){t?(t.bounds&&this.tryUpdateAABBBounds("imprecise"===this.attribute.boundsMode),t.trans&&this.tryUpdateLocalTransMatrix()):(this.tryUpdateAABBBounds("imprecise"===this.attribute.boundsMode),this.tryUpdateLocalTransMatrix())}hasState(t){return!(!this.currentStates||!this.currentStates.length)&&(!!X(t)||this.currentStates.includes(t))}getState(t){var e;return null===(e=this.states)||void 0===e?void 0:e[t]}applyStateAttrs(t,e,i,r){var n,o,s,a;if(i){const i=Object.keys(t),l=this.getNoWorkAnimateAttr(),h={};let c;r?i.forEach((e=>{l[e]?(c||(c={}),c[e]=t[e]):h[e]=void 0===t[e]?this.getDefaultAttribute(e):t[e]})):i.forEach((e=>{l[e]?(c||(c={}),c[e]=t[e]):h[e]=t[e]}));const d=this.animate();d.stateNames=e,d.to(h,null!==(o=null===(n=this.stateAnimateConfig)||void 0===n?void 0:n.duration)&&void 0!==o?o:Un,null!==(a=null===(s=this.stateAnimateConfig)||void 0===s?void 0:s.easing)&&void 0!==a?a:Vn),c&&this.setAttributes(c,!1,{type:wi.STATE})}else this.setAttributes(t,!1,{type:wi.STATE})}updateNormalAttrs(t){const e={};this.normalAttrs?(Object.keys(t).forEach((t=>{t in this.normalAttrs?(e[t]=this.normalAttrs[t],delete this.normalAttrs[t]):e[t]=this.getNormalAttribute(t)})),Object.keys(this.normalAttrs).forEach((e=>{t[e]=this.normalAttrs[e]}))):Object.keys(t).forEach((t=>{e[t]=this.getNormalAttribute(t)})),this.normalAttrs=e}getNormalAttribute(t){let e=this.attribute[t];return this.animates&&this.animates.forEach((i=>{if(i.stateNames){const r=i.getEndProps();mt(r,t)&&(e=r[t])}})),e}clearStates(t){this.hasState()&&this.normalAttrs?(this.currentStates=[],this.applyStateAttrs(this.normalAttrs,this.currentStates,t,!0)):this.currentStates=[],this.normalAttrs=null}removeState(t,e){if((this.currentStates?this.currentStates.indexOf(t):-1)>=0){const i=this.currentStates.filter((e=>e!==t));this.useStates(i,e)}}toggleState(t,e){if(this.hasState(t))this.removeState(t,e);else if((this.currentStates?this.currentStates.indexOf(t):-1)<0){const i=this.currentStates?this.currentStates.slice():[];i.push(t),this.useStates(i,e)}}addState(t,e,i){var r;if(this.currentStates&&this.currentStates.includes(t)&&(e||1===this.currentStates.length))return;const n=e&&(null===(r=this.currentStates)||void 0===r?void 0:r.length)?this.currentStates.concat([t]):[t];this.useStates(n,i)}useStates(t,e){var i;if(!t.length)return void this.clearStates(e);if((null===(i=this.currentStates)||void 0===i?void 0:i.length)===t.length&&!t.some(((t,e)=>this.currentStates[e]!==t)))return;const r={};t.forEach((e=>{var i;const n=this.stateProxy?this.stateProxy(e,t):null===(i=this.states)||void 0===i?void 0:i[e];n&&Object.assign(r,n)})),this.updateNormalAttrs(r),this.currentStates=t,this.applyStateAttrs(r,t,e)}addUpdateBoundTag(){this._updateTag|=Ci.UPDATE_BOUNDS,this.parent&&this.parent.addChildUpdateBoundTag(),this.glyphHost&&this.glyphHost.addUpdateBoundTag()}addUpdateShapeTag(){this._updateTag|=Ci.UPDATE_SHAPE}addUpdateShapeAndBoundsTag(){this._updateTag|=Ci.UPDATE_SHAPE_AND_BOUNDS,this.parent&&this.parent.addChildUpdateBoundTag(),this.glyphHost&&this.glyphHost.addUpdateBoundTag()}updateShapeAndBoundsTagSetted(){return(this._updateTag&Ci.UPDATE_SHAPE_AND_BOUNDS)===Ci.UPDATE_SHAPE_AND_BOUNDS}clearUpdateBoundTag(){this._updateTag&=Ci.CLEAR_BOUNDS}addUpdatePositionTag(){this.shadowRoot&&this.shadowRoot.addUpdateGlobalPositionTag(),this._updateTag|=Ci.UPDATE_GLOBAL_LOCAL_MATRIX}addUpdateGlobalPositionTag(){this.shadowRoot&&this.shadowRoot.addUpdateGlobalPositionTag(),this._updateTag|=Ci.UPDATE_GLOBAL_MATRIX}clearUpdateLocalPositionTag(){this._updateTag&=Ci.CLEAR_LOCAL_MATRIX}clearUpdateGlobalPositionTag(){this._updateTag&=Ci.CLEAR_GLOBAL_MATRIX}addUpdateLayoutTag(){this._updateTag|=Ci.UPDATE_LAYOUT}clearUpdateLayoutTag(){this._updateTag&=Ci.CLEAR_LAYOUT}needUpdateLayout(){return!!(this._updateTag&Ci.UPDATE_LAYOUT)}getAnchor(t,e){const i=[0,0],r=()=>{if(e.b)return e.b;const{scaleX:t,scaleY:i,angle:r}=this.attribute;return fo.copy(this._AABBBounds),this.setAttributes({scaleX:1,scaleY:1,angle:0}),e.b=this.AABBBounds.clone(),this._AABBBounds.copy(fo),this.setAttributes({scaleX:t,scaleY:i,angle:r}),e.b};if("string"==typeof t[0]){const e=parseFloat(t[0])/100,n=r();i[0]=n.x1+(n.x2-n.x1)*e}else i[0]=t[0];if("string"==typeof t[1]){const e=parseFloat(t[1])/100,n=r();i[1]=n.y1+(n.y2-n.y1)*e}else i[1]=t[1];return i}doUpdateLocalMatrix(){const{x:t=dr.x,y:e=dr.y,scaleX:i=dr.scaleX,scaleY:r=dr.scaleY,angle:n=dr.angle,scaleCenter:o,anchor:s,postMatrix:a}=this.attribute;let l=[0,0];const h={};if(s&&(l=this.getAnchor(s,h)),!o||1===i&&1===r)!function(t,e,i,r,n,o,s,a){const l=e.a,h=e.b,c=e.c,d=e.d,u=e.e,g=e.f,p=te(s),f=re(s);let m,b;a?(m=a[0],b=a[1]):(m=i,b=r);const y=m-i,C=b-r,v=l*p+c*f,w=h*p+d*f,x=c*p-l*f,_=d*p-h*f;t.a=n*v,t.b=n*w,t.c=o*x,t.d=o*_,t.e=u+l*m+c*b-v*y-x*C,t.f=g+h*m+d*b-w*y-_*C}(this._transMatrix,this._transMatrix.reset(),t,e,i,r,n,s&&l);else{const s=this._transMatrix;s.reset(),s.translate(l[0],l[1]),s.rotate(n),s.translate(-l[0],-l[1]),s.translate(t,e),l=this.getAnchor(o,h),kr.transformUtil.fromMatrix(s,s).scale(i,r,{x:l[0],y:l[1]})}const c=this.getOffsetXY(dr);if(this._transMatrix.e+=c.x,this._transMatrix.f+=c.y,a){const t=po.setValue(a.a,a.b,a.c,a.d,a.e,a.f),e=this._transMatrix;t.multiply(e.a,e.b,e.c,e.d,e.e,e.f),e.setValue(t.a,t.b,t.c,t.d,t.e,t.f)}}doUpdateGlobalMatrix(){if(this.parent){this._globalTransMatrix.multiply(this.transMatrix.a,this.transMatrix.b,this.transMatrix.c,this.transMatrix.d,this.transMatrix.e,this.transMatrix.f);const{scrollX:t=0,scrollY:e=0}=this.parent.attribute;this._globalTransMatrix.translate(t,e)}}setStage(t,e){if(this.stage!==t){if(this.stage=t,this.layer=e,this.setStageToShadowRoot(t,e),this.animates&&this.animates.size){const e=t.getTimeline();this.animates.forEach((t=>{t.setTimeline(e)}))}this._onSetStage&&this._onSetStage(this,t,e),kr.graphicService.onSetStage(this,t)}}setStageToShadowRoot(t,e){this.shadowRoot&&this.shadowRoot.setStage(t,e)}onAddStep(t){}onStop(t){t&&this.setAttributes(t,!1,{type:wi.ANIMATE_END})}onStep(t,e,i,r,n){const o={};if(i.customAnimate)i.customAnimate.update(n,r,o);else{const s=i.props,a=i.parsedProps,l=i.propKeys;this.stepInterpolate(t,e,o,i,r,n,s,void 0,a,l)}this.setAttributes(o,!1,{type:wi.ANIMATE_UPDATE,animationState:{ratio:r,end:n,step:i,isFirstFrameOfStep:t.getLastStep()!==i}}),this.stage&&this.stage.renderNextFrame()}stepInterpolate(t,e,i,r,n,o,s,a,l,h){h||(h=Object.keys(s),r.propKeys=h),o?r.propKeys.forEach((t=>{e.validAttr(t)&&(i[t]=s[t])})):h.forEach((o=>{var h;if(!e.validAttr(o))return;const c=s[o],d=null!==(h=a&&a[o])&&void 0!==h?h:t.getLastPropByName(o,r);if(null==c||null==d)return void(i[o]=c);let u;u=e.interpolateFunc&&e.interpolateFunc(o,n,d,c,i),u||(u=e.customInterpolate(o,n,d,c,this,i),u||this.defaultInterpolate(c,d,o,i,l,n)||this._interpolate(o,n,d,c,i))})),r.parsedProps=l}defaultInterpolate(t,e,i,r,n,o){if(Number.isFinite(t))return r[i]=e+(t-e)*o,!0;if("fill"===i){n||(n={});const s=n.fillColorArray,a=lo(e,null!=s?s:t,o,!1,((t,e)=>{n.fillColorArray=e}));return a&&(r[i]=a),!0}if("stroke"===i){n||(n={});const s=n.strokeColorArray,a=lo(e,null!=s?s:t,o,!1,((t,e)=>{n.strokeColorArray=e}));return a&&(r[i]=a),!0}if("shadowColor"===i){n||(n={});const s=n.shadowColorArray,a=lo(e,null!=s?s:t,o,!0,((t,e)=>{n.shadowColorArray=e}));return a&&(r[i]=a),!0}return!1}_interpolate(t,e,i,r,n){}getDefaultAttribute(t){return Cn(this)[this.type][t]}getComputedAttribute(t){var e;return null!==(e=this.attribute[t])&&void 0!==e?e:this.getDefaultAttribute(t)}onSetStage(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];this._onSetStage=t,e&&this.stage&&t(this,this.stage)}attachShadow(t){return t&&(t.shadowHost=this),this.shadowRoot=null!=t?t:kr.graphicService.creator.shadowRoot(this),this.addUpdateBoundTag(),this.shadowRoot.setStage(this.stage,this.layer),this.shadowRoot}detachShadow(){this.shadowRoot&&(this.addUpdateBoundTag(),this.shadowRoot=null)}toJson(){return{attribute:this.attribute,_uid:this._uid,type:this.type,name:this.name,children:this.children.map((t=>t.toJson()))}}createPathProxy(t){return et(t,!0)?this.pathProxy=(new lr).fromString(t):this.pathProxy=new lr,this.pathProxy}loadImage(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(!t||e&&function(t){return!(!t.fill&&!t.stroke)}(t))return;const i=t;this.resources||(this.resources=new Map);const r={data:"init",state:null};this.resources.set(i,r),"string"==typeof t?(r.state="loading",t.startsWith("<svg")?(go.GetSvg(t,this),this.backgroundImg=this.backgroundImg||e):(at(t)||t.includes("/")||lt(t))&&(go.GetImage(t,this),this.backgroundImg=this.backgroundImg||e)):(r.state="success",r.data=t,this.backgroundImg=this.backgroundImg||e)}imageLoadSuccess(t,e,i){if(!this.resources)return;const r=this.resources.get(t);r&&(r.state="success",r.data=e,i&&i(),this.addUpdateBoundTag(),this.stage&&this.stage.renderNextFrame())}imageLoadFail(t,e){if(!this.resources)return;const i=this.resources.get(t);i&&(i.state="fail",e&&e())}_stopAnimates(t){t&&t.forEach((t=>{t.stop()}))}stopAnimates(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];this._stopAnimates(this.animates),this.shadowRoot&&this.shadowRoot.stopAnimates(!0),this.isContainer&&t&&this.forEachChildren((e=>{e.stopAnimates(t)}))}release(){this.releaseStatus="released",kr.graphicService.onRelease(this)}_emitCustomEvent(t,e){var i,r;if(this._events&&t in this._events){const n=new Bn(t,e);n.bubbles=!1,n.manager=null===(r=null===(i=this.stage)||void 0===i?void 0:i.eventSystem)||void 0===r?void 0:r.manager,this.dispatchEvent(n)}}}xo.mixin(Rn);class _o{constructor(t){this.tagname=t,this.child=[],this[":@"]={}}add(t,e){"__proto__"===t&&(t="#__proto__"),this.child.push({[t]:e})}addChild(t){"__proto__"===t.tagname&&(t.tagname="#__proto__"),t[":@"]&&Object.keys(t[":@"]).length>0?this.child.push({[t.tagname]:t.child,":@":t[":@"]}):this.child.push({[t.tagname]:t.child})}}function So(t,e,i,r){const n=t.indexOf(e,i);if(-1===n)throw new Error(r);return n+e.length-1}function Ao(t,e,i){const r=function(t,e){let i,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:">",n="";for(let o=e;o<t.length;o++){let e=t[o];if(i)e===i&&(i="");else if('"'===e||"'"===e)i=e;else if(e===r[0]){if(!r[1])return{data:n,index:o};if(t[o+1]===r[1])return{data:n,index:o}}else"\t"===e&&(e=" ");n+=e}}(t,e+1,arguments.length>3&&void 0!==arguments[3]?arguments[3]:">");if(!r)return;let n=r.data;const o=r.index,s=n.search(/\s/);let a=n,l=!0;-1!==s&&(a=n.substr(0,s).replace(/\s\s*$/,""),n=n.substr(s+1));const h=a;if(i){const t=a.indexOf(":");-1!==t&&(a=a.substr(t+1),l=a!==r.data.substr(t+1))}return{tagName:a,tagExp:n,closeIndex:o,attrExpPresent:l,rawTagName:h}}const Bo=new RegExp("([^\\s=]+)\\s*(=\\s*(['\"])([\\s\\S]*?)\\3)?","gm");class To{constructor(t){this.currentNode=null,this.options=t,this.tagsNodeStack=[],this.docTypeEntities={}}addChild(t,e,i){const r=e.tagname;"string"==typeof r?(e.tagname=r,t.addChild(e)):t.addChild(e)}buildAttributesMap(t,e,i){const r={};if(!t)return;const n=function(t,e){const i=[];let r=e.exec(t);for(;r;){const n=[];n.startIndex=e.lastIndex-r[0].length;const o=r.length;for(let t=0;t<o;t++)n.push(r[t]);i.push(n),r=e.exec(t)}return i}(t,Bo),o=n.length;for(let t=0;t<o;t++){const e=n[t][1],i=n[t][4];e&&(r[e]=void 0===i||(isNaN(i)?i:Number(i)))}return r}parseXml(t){t=t.replace(/\r\n?/g,"\n");const e=new _o("!xml");let i=e,r="",n="";for(let o=0;o<t.length;o++)if("<"===t[o])if("/"===t[o+1]){const e=So(t,">",o,"Closing Tag is not closed."),s=n.lastIndexOf(".");n=n.substring(0,s),i=this.tagsNodeStack.pop(),i&&i.child&&r&&i.child[i.child.length-1][":@"]&&(i.child[i.child.length-1][":@"].text=r),r="",o=e}else if("?"===t[o+1])o=Ao(t,o,!1,"?>").closeIndex+1;else if("!--"===t.substr(o+1,3))o=So(t,"--\x3e",o+4,"Comment is not closed.");else{const s=Ao(t,o,!1);let a=s.tagName,l=s.tagExp;const h=s.attrExpPresent,c=s.closeIndex;if(a!==e.tagname&&(n+=n?"."+a:a),l.length>0&&l.lastIndexOf("/")===l.length-1){"/"===a[a.length-1]?(a=a.substr(0,a.length-1),n=n.substr(0,n.length-1),l=a):l=l.substr(0,l.length-1);const t=new _o(a);a!==l&&h&&(t[":@"]=this.buildAttributesMap(l,n,a)),this.addChild(i,t,n),n=n.substr(0,n.lastIndexOf("."))}else{const t=new _o(a);this.tagsNodeStack.push(i),a!==l&&h&&(t[":@"]=this.buildAttributesMap(l,n,a)),this.addChild(i,t,n),i=t}r="",o=c}else r+=t[o];return e.child}}function Mo(t,e){return Ro(t)}function Ro(t,e){const i={};for(let e=0;e<t.length;e++){const r=t[e],n=Po(r);if(void 0!==n&&r[n]){const t=Ro(r[n]);Ho(t),r[":@"]&&Eo(t,r[":@"]),void 0!==i[n]&&i.hasOwnProperty(n)?(Array.isArray(i[n])||(i[n]=[i[n]]),i[n].push(t)):i[n]=t}}return i}function Po(t){const e=Object.keys(t);for(let t=0;t<e.length;t++){const i=e[t];if(":@"!==i)return i}}function Eo(t,e,i){if(e){const i=Object.keys(e),r=i.length;for(let n=0;n<r;n++){const r=i[n];t[r]=e[r]}}}function Ho(t){return 0===Object.keys(t).length}class Lo{constructor(t){this.options=Object.assign({},Lo.defaultOptions,t)}valid(t){return t.startsWith("<")}parse(t){if(!this.valid)return!1;return Mo(new To(this.options).parseXml(t),this.options)}}function ko(t,e,i){let r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;return t.expand(e+(r/2+(i?function(t,e){return t?e:0}(i,e):0))),t}Lo.defaultOptions={};let Io=0;function Fo(){return Io++}var zo;function Oo(t){const e=[];let i=0,r="";for(let n=0;n<t.length;n++)No(t[n])?i?r+=t[n]:(i=1,r=t[n]):(i&&(e.push({text:r,direction:zo.VERTICAL}),r="",i=0),e.push({text:t[n],direction:zo.HORIZONTAL}));return r&&e.push({text:r,direction:zo.VERTICAL}),e}!function(t){t[t.HORIZONTAL=0]="HORIZONTAL",t[t.VERTICAL=1]="VERTICAL"}(zo||(zo={}));const Do=new Map;["…","(",")","—","【","】","「","」","《","》"].forEach((t=>Do.set(t,!0)));const Wo=new Map;function No(t){if(Do.has(t))return!0;if(Wo.has(t))return!1;let e=!1;return t.codePointAt(0)<256&&(e=!0),e}[""].forEach((t=>Wo.set(t,!0)));const Go=Fo(),jo=Fo(),Uo=Fo(),Vo=Fo(),Ko=Fo(),$o=Fo(),Xo=Fo(),Yo=Fo(),qo=Fo(),Zo=Fo(),Jo=Fo(),Qo=Fo(),ts=Fo(),es=Fo(),is=Fo(),rs=Fo(),ns=Symbol.for("GraphicService"),os=Symbol.for("GraphicCreator"),ss={"stroke-linecap":"lineCap","stroke-linejoin":"lineJoin","stroke-dasharray":"lineDash","stroke-dashoffset":"lineDashOffset","stroke-width":"lineWidth","fill-opacity":"fillOpacity","stroke-opacity":"strokeOpacity",stroke:"stroke",fill:"fill"},as=Object.keys(ss);var ls;!function(t){t[t.LESS_GROUP=0]="LESS_GROUP",t[t.MORE_GROUP=1]="MORE_GROUP"}(ls||(ls={}));let hs=class t extends xo{constructor(t){super(t),this.type="group",this.parent=null,this.isContainer=!0,this.numberType=$o,this._childUpdateTag=Ci.UPDATE_BOUNDS}setMode(t){"3d"===t?this.set3dMode():this.set2dMode()}set3dMode(){this.in3dMode=!0}set2dMode(){this.in3dMode=!1}setTheme(t){return this.theme||(this.theme=new bn),this.theme.setTheme(t,this)}createTheme(){this.theme||(this.theme=new bn)}hideAll(){this.setAttribute("visible",!1),this.forEachChildren((t=>{t.isContainer&&t.hideAll?t.hideAll():t.setAttribute("visible",!1)}))}showAll(){this.setAttribute("visible",!0),this.forEachChildren((t=>{t.isContainer&&t.showAll?t.showAll():t.setAttribute("visible",!0)}))}containsPoint(t,e,i){if(i===vi.GLOBAL){const i=new he(t,e);return this.parent&&this.parent.globalTransMatrix.transformPoint(i,i),this.AABBBounds.contains(i.x,i.y)}return this.AABBBounds.contains(t,e)}shouldUpdateAABBBounds(){return!!super.shouldUpdateAABBBounds()||!!(this._childUpdateTag&Ci.UPDATE_BOUNDS)}tryUpdateAABBBounds(){if(!this.shouldUpdateAABBBounds())return this._AABBBounds;kr.graphicService.beforeUpdateAABBBounds(this,this.stage,!0,this._AABBBounds);const t=this.shouldSelfChangeUpdateAABBBounds(),e=this.doUpdateAABBBounds();return this.addUpdateLayoutTag(),kr.graphicService.afterUpdateAABBBounds(this,this.stage,this._AABBBounds,this,t),e}doUpdateLocalMatrix(){const{x:t=dr.x,y:e=dr.y,dx:i=dr.dx,dy:r=dr.dy,scaleX:n=dr.scaleX,scaleY:o=dr.scaleY,angle:s=dr.angle,postMatrix:a}=this.attribute;if(0!==t||0!==e||0!==i||0!==r||1!==n||1!==o||0!==s||a)return super.doUpdateLocalMatrix();this._transMatrix.reset()}doUpdateAABBBounds(){const t=this.attribute,e=Cn(this).group;this._AABBBounds.setValue(1/0,1/0,-1/0,-1/0);const i=kr.graphicService.updateGroupAABBBounds(t,e,this._AABBBounds,this),{boundsPadding:r=e.boundsPadding}=t,n=Yn(r);return n&&i.expand(n),this.parent&&this.parent.addChildUpdateBoundTag(),this.clearUpdateBoundTag(),this._emitCustomEvent("AAABBBoundsChange"),i}clearUpdateBoundTag(){this._updateTag&=Ci.CLEAR_BOUNDS,this._childUpdateTag&=Ci.CLEAR_BOUNDS}tryUpdateOBBBounds(){throw new Error("暂不支持")}addUpdateBoundTag(){this._updateTag|=Ci.UPDATE_BOUNDS,this.parent&&this.parent.addChildUpdateBoundTag()}addChildUpdateBoundTag(){this._childUpdateTag&Ci.UPDATE_BOUNDS||(this._childUpdateTag|=Ci.UPDATE_BOUNDS,this.parent&&this.parent.addChildUpdateBoundTag())}getTheme(){return this.theme.getTheme(this)}incrementalAppendChild(t){const e=super.appendChild(t);return this.stage&&e&&(e.stage=this.stage,e.layer=this.layer),this.addUpdateBoundTag(),kr.graphicService.onAddIncremental(t,this,this.stage),e}incrementalClearChild(){super.removeAllChild(),this.addUpdateBoundTag(),kr.graphicService.onClearIncremental(this,this.stage)}appendChild(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];const i=super.appendChild(t);return e&&this.stage&&i&&i.setStage(this.stage,this.layer),this.addUpdateBoundTag(),i}insertBefore(t,e){const i=super.insertBefore(t,e);return this.stage&&i&&i.setStage(this.stage,this.layer),this.addUpdateBoundTag(),i}insertAfter(t,e){const i=super.insertAfter(t,e);return this.stage&&i&&i.setStage(this.stage,this.layer),this.addUpdateBoundTag(),i}insertInto(t,e){const i=super.insertInto(t,e);return this.stage&&i&&i.setStage(this.stage,this.layer),this.addUpdateBoundTag(),i}removeChild(t){const e=super.removeChild(t);return t.stage=null,kr.graphicService.onRemove(t),this.addUpdateBoundTag(),e}removeAllChild(){this.forEachChildren((t=>{kr.graphicService.onRemove(t)})),super.removeAllChild(),this.addUpdateBoundTag()}setStage(t,e){this.stage!==t&&(this.stage=t,this.layer=e,this.setStageToShadowRoot(t,e),this._onSetStage&&this._onSetStage(this,t,e),kr.graphicService.onSetStage(this,t),this.forEachChildren((e=>{e.setStage(t,this.layer)})))}addUpdatePositionTag(){super.addUpdatePositionTag(),this.forEachChildren((t=>{t.isContainer&&t.addUpdateGlobalPositionTag()}))}addUpdateGlobalPositionTag(){super.addUpdateGlobalPositionTag(),this.forEachChildren((t=>{t.isContainer&&t.addUpdateGlobalPositionTag()}))}tryUpdateGlobalTransMatrix(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];if(this.shouldUpdateGlobalMatrix()){if(this._globalTransMatrix){if(this.parent){const t=this.parent.globalTransMatrix;this._globalTransMatrix.setValue(t.a,t.b,t.c,t.d,t.e,t.f)}}else this._globalTransMatrix=this.parent?this.parent.globalTransMatrix.clone():this.transMatrix.clone();this.doUpdateGlobalMatrix(),t&&this.clearUpdateGlobalPositionTag()}return this._globalTransMatrix}shouldUpdateGlobalMatrix(){return!!(this._updateTag&Ci.UPDATE_GLOBAL_MATRIX)}_getChildByName(t,e){return this.find((e=>e.name===t),e)}createOrUpdateChild(t,e,i){let r=this._getChildByName(t);return r?r.setAttributes(e):(r=kr.graphicService.creator[i](e),r.name=t,this.add(r)),r}clone(){return new t(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return t.NOWORK_ANIMATE_ATTR}};function cs(t){return new hs(t)}hs.NOWORK_ANIMATE_ATTR=wo;class ds extends hs{get offscreen(){return this.layerHandler.offscreen}get layerMode(){return this.layerHandler.type}get width(){return this.stage?this.stage.width:0}get height(){return this.stage?this.stage.height:0}get viewWidth(){return this.stage?this.stage.viewWidth:0}get viewHeight(){return this.stage?this.stage.viewHeight:0}get dirtyBound(){throw new Error("暂不支持")}get dpr(){return this._dpr}constructor(t,e,i,r){var n;super({}),this.stage=t,this.global=e,this.window=i,this.main=r.main,this.layerHandler=r.layerHandler,this.layerHandler.init(this,i,{main:r.main,canvasId:r.canvasId,width:this.viewWidth,height:this.viewHeight,zIndex:null!==(n=r.zIndex)&&void 0!==n?n:0}),this.layer=this,this.subLayers=new Map,this.theme=new bn,this.background="rgba(0, 0, 0, 0)",this.afterDrawCbs=[]}combineSubLayer(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];const e=Array.from(this.subLayers.values()).sort(((t,e)=>t.zIndex-e.zIndex));this.layerHandler.merge(e.map((e=>(e.layer.subLayers.size&&e.layer.combineSubLayer(t),e.layer.getNativeHandler())))),t&&e.forEach((t=>{t.group&&(t.group.incremental=0)})),e.forEach((t=>{kr.layerService.releaseLayer(this.stage,t.layer)})),this.subLayers.clear()}getNativeHandler(){return this.layerHandler}setStage(t,e){super.setStage(t,this)}pick(t,e){throw new Error("暂不支持")}tryRenderSecondaryLayer(t,e){this.layerHandler.secondaryHandlers&&this.layerHandler.secondaryHandlers.length&&this.layerHandler.secondaryHandlers.forEach((i=>{i.layer.renderCount=this.renderCount,i.layer.render(t,e)}))}render(t,e){var i;const r=this.stage;this.layerHandler.render([this],{renderService:t.renderService,x:r.x,y:r.y,width:this.viewWidth,height:this.viewHeight,stage:this.stage,layer:this,background:null!==(i=t.background)&&void 0!==i?i:this.background,updateBounds:t.updateBounds},e),this.afterDrawCbs.forEach((t=>t(this))),this.tryRenderSecondaryLayer(t,e)}resize(t,e){this.layerHandler.resize(t,e)}resizeView(t,e){this.layerHandler.resizeView(t,e)}setDpr(t){this.layerHandler.setDpr(t)}afterDraw(t){this.afterDrawCbs.push(t)}startAnimate(t){throw new Error("暂不支持")}setToFrame(t){throw new Error("暂不支持")}prepare(t,e){}combineTo(t,e){var i,r,n;this.offscreen&&(this.layerHandler.drawTo(t,[this],Object.assign({background:null!==(i=e.background)&&void 0!==i?i:this.background,renderService:e.renderService,x:null!==(r=e.x)&&void 0!==r?r:this.stage.x,y:null!==(n=e.y)&&void 0!==n?n:this.stage.y,width:this.viewWidth,height:this.viewHeight,stage:this.stage,layer:this},e)),this.afterDrawCbs.forEach((t=>t(this))))}release(){super.release(),this.layerHandler.release(),this.subLayers&&this.subLayers.forEach((t=>{kr.layerService.releaseLayer(this.stage,t.layer)}))}drawTo(t,e){var i,r,n;this.layerHandler.drawTo(t,[this],Object.assign({background:null!==(i=e.background)&&void 0!==i?i:this.background,renderService:e.renderService,x:null!==(r=e.x)&&void 0!==r?r:this.stage.x,y:null!==(n=e.y)&&void 0!==n?n:this.stage.y,width:this.viewWidth,height:this.viewHeight,stage:this.stage,layer:this},e)),this.afterDrawCbs.forEach((t=>t(this)))}}const us=Symbol.for("TransformUtil"),gs=Symbol.for("GraphicUtil"),ps=Symbol.for("LayerService"),fs=Symbol.for("StaticLayerHandlerContribution"),ms=Symbol.for("DynamicLayerHandlerContribution"),bs=Symbol.for("VirtualLayerHandlerContribution");var ys,Cs=function(t,e,i,r){var n,o=arguments.length,s=o<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,i,r);else for(var a=t.length-1;a>=0;a--)(n=t[a])&&(s=(o<3?n(s):o>3?n(e,i,s):n(e,i))||s);return o>3&&s&&Object.defineProperty(e,i,s),s},vs=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let ws=ys=class{static GenerateLayerId(){return`${ys.idprefix}_${ys.prefix_count++}`}constructor(){this.layerMap=new Map,this.global=kr.global}tryInit(){this.inited||(this.staticLayerCountInEnv=this.global.getStaticCanvasCount(),this.dynamicLayerCountInEnv=this.global.getDynamicCanvasCount(),this.inited=!0)}getStageLayer(t){return this.layerMap.get(t)}getRecommendedLayerType(t){return t||(0!==this.staticLayerCountInEnv?"static":0!==this.dynamicLayerCountInEnv?"dynamic":"virtual")}getLayerHandler(t){let e;return e="static"===t?Yr.get(fs):"dynamic"===t?Yr.get(ms):Yr.get(bs),e}createLayer(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{main:!1};var i;this.tryInit();let r=this.getRecommendedLayerType(e.layerMode);r=e.main||e.canvasId?"static":r;const n=this.getLayerHandler(r),o=new ds(t,this.global,t.window,Object.assign(Object.assign({main:!1},e),{layerMode:r,canvasId:null!==(i=e.canvasId)&&void 0!==i?i:ys.GenerateLayerId(),layerHandler:n})),s=this.layerMap.get(t)||[];return s.push(o),this.layerMap.set(t,s),this.staticLayerCountInEnv--,o}prepareStageLayer(t){let e;t.forEachChildren((t=>{const i=t.getNativeHandler();"virtual"===i.type?(i.mainHandler=e,e.secondaryHandlers.push(i)):(e=i,e.secondaryHandlers=[])}))}releaseLayer(t,e){e.release();const i=this.layerMap.get(t)||[];this.layerMap.set(t,i.filter((t=>t!==e)))}layerCount(t){return(this.layerMap.get(t)||[]).length}restLayerCount(t){return"browser"===this.global.env?10:0}};ws.idprefix="visactor_layer",ws.prefix_count=0,ws=ys=Cs([f(),vs("design:paramtypes",[])],ws);var xs=new i((t=>{t(z).to(N).inSingletonScope(),t(rn).to(on),t(gs).to(hn).inSingletonScope(),t(us).to(un).inSingletonScope(),t(ps).to(ws).inSingletonScope()}));function _s(t,e){return!(!t&&!e)}function Ss(t,e){let i;return i=it(t)?t.some((t=>t||void 0===t)):!!t,i&&e>0}function As(t,e,i){return i&&t*e>0}function Bs(t,e,i,r,n){return n&&t*e>0&&0!==i&&0!==r}function Ts(t,e){return t*e>0}function Ms(t,e,i,r){return t*e>0&&0!==i&&0!==r}function Rs(t,e,i,r,n,o,s,a){const l=i-t,h=r-e,c=s-n,d=a-o;let u=d*l-c*h;return u*u<$t?[]:(u=(c*(e-o)-d*(t-n))/u,[t+u*l,e+u*h])}function Ps(t,e,i,r,n,o,s){const a=t-i,l=e-r,h=(s?o:-o)/Math.sqrt(a*a+l*l),c=h*l,d=-h*a,u=t+c,g=e+d,p=i+c,f=r+d,m=(u+p)/2,b=(g+f)/2,y=p-u,C=f-g,v=y*y+C*C,w=n-o,x=u*f-p*g,_=(C<0?-1:1)*Math.sqrt(Math.max(0,w*w*v-x*x));let S=(x*C-y*_)/v,A=(-x*y-C*_)/v;const B=(x*C+y*_)/v,T=(-x*y+C*_)/v,M=S-m,R=A-b,P=B-m,E=T-b;return M*M+R*R>P*P+E*E&&(S=B,A=T),{cx:S,cy:A,x01:-c,y01:-d,x11:S*(n/w-1),y11:A*(n/w-1)}}function Es(t,e,i,r,n,o,s){const{startAngle:a,endAngle:l}=t.getParsedAngle(),h=Jt(l-a),c=l>a;let d=!1;if(n<o){const t=n;n=o,o=t}if(n<=$t)e.moveTo(i,r);else if(h>=Zt-$t)e.moveTo(i+n*te(a),r+n*re(a)),e.arc(i,r,n,a,l,!c),o>$t&&(e.moveTo(i+o*te(l),r+o*re(l)),e.arc(i,r,o,l,a,c));else{const u=t.getParsedCornerRadius(),{outerDeltaAngle:g,innerDeltaAngle:p,outerStartAngle:f,outerEndAngle:m,innerEndAngle:b,innerStartAngle:y}=t.getParsePadAngle(a,l),C=u,v=u,w=u,x=u,_=Math.max(v,C),S=Math.max(w,x);let A=_,B=S;const T=n*te(f),M=n*re(f),R=o*te(b),P=o*re(b);let E,H,L,k;if((S>$t||_>$t)&&(E=n*te(m),H=n*re(m),L=o*te(y),k=o*re(y),h<Xt)){const t=Rs(T,M,L,k,E,H,R,P);if(t){const e=T-t[0],i=M-t[1],r=E-t[0],s=H-t[1],a=1/re(se((e*r+i*s)/(ne(e*e+i*i)*ne(r*r+s*s)))/2),l=ne(t[0]*t[0]+t[1]*t[1]);B=ie(S,(o-l)/(a-1)),A=ie(_,(n-l)/(a+1))}}if(g<.001)s&&(s[3]||s[1])&&e.moveTo(i+T,r+M),d=!0;else if(A>$t){const t=ie(C,A),o=ie(v,A),a=Ps(L,k,T,M,n,t,Number(c)),l=Ps(E,H,R,P,n,o,Number(c));A<_&&t===o?!s||s[0]?(e.moveTo(i+a.cx+a.x01,r+a.cy+a.y01),e.arc(i+a.cx,r+a.cy,A,Qt(a.y01,a.x01),Qt(l.y01,l.x01),!c)):e.moveTo(i+a.cx+A*te(Qt(l.y01,l.x01)),r+a.cy+A*re(Qt(l.y01,l.x01))):!s||s[0]?(e.moveTo(i+a.cx+a.x01,r+a.cy+a.y01),t>0&&e.arc(i+a.cx,r+a.cy,t,Qt(a.y01,a.x01),Qt(a.y11,a.x11),!c),e.arc(i,r,n,Qt(a.cy+a.y11,a.cx+a.x11),Qt(l.cy+l.y11,l.cx+l.x11),!c),o>0&&e.arc(i+l.cx,r+l.cy,o,Qt(l.y11,l.x11),Qt(l.y01,l.x01),!c)):o>0?e.moveTo(i+l.cx+o*te(Qt(l.y01,l.x01)),r+l.cy+o*re(Qt(l.y01,l.x01))):e.moveTo(i+E,r+n*re(m))}else!s||s[0]?(e.moveTo(i+T,r+M),e.arc(i,r,n,f,m,!c)):e.moveTo(i+n*te(m),r+n*re(m));if(!(o>$t)||p<.001)!s||s[1]?e.lineTo(i+R,r+P):e.moveTo(i+R,r+P),d=!0;else if(B>$t){const t=ie(x,B),n=ie(w,B),a=Ps(R,P,E,H,o,-n,Number(c)),l=Ps(T,M,L,k,o,-t,Number(c));if(!s||s[1]?e.lineTo(i+a.cx+a.x01,r+a.cy+a.y01):e.moveTo(i+a.cx+a.x01,r+a.cy+a.y01),B<S&&t===n){const t=Qt(l.y01,l.x01);!s||s[2]?e.arc(i+a.cx,r+a.cy,B,Qt(a.y01,a.x01),t,!c):e.moveTo(i+a.cx+te(t),r+a.cy+re(t))}else!s||s[2]?(n>0&&e.arc(i+a.cx,r+a.cy,n,Qt(a.y01,a.x01),Qt(a.y11,a.x11),!c),e.arc(i,r,o,Qt(a.cy+a.y11,a.cx+a.x11),Qt(l.cy+l.y11,l.cx+l.x11),c),t>0&&e.arc(i+l.cx,r+l.cy,t,Qt(l.y11,l.x11),Qt(l.y01,l.x01),!c)):t>0?e.moveTo(i+l.cx+t*te(Qt(l.y01,l.x01)),r+l.cy+t*re(Qt(l.y01,l.x01))):e.moveTo(i+L,r+k)}else!s||s[1]?e.lineTo(i+R,r+P):e.moveTo(i+R,r+P),!s||s[2]?e.arc(i,r,o,b,y,c):e.moveTo(i+o*te(y),r+o*re(y))}return s?s[3]&&e.lineTo(i+n*te(a),r+n*re(a)):e.closePath(),d}class Hs{static GetCanvas(){try{return Hs.canvas||(Hs.canvas=kr.global.createCanvas({})),Hs.canvas}catch(t){return null}}static GetCtx(){if(!Hs.ctx){const t=Hs.GetCanvas();Hs.ctx=t.getContext("2d")}return Hs.ctx}}class Ls extends be{static getInstance(){return Ls._instance||(Ls._instance=new Ls),Ls._instance}constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:100;super(),this.cacheParams={CLEAN_THRESHOLD:100,L_TIME:1e3},this.dataMap=new Map;const i=Hs.GetCanvas(),r=Hs.GetCtx();if(i.width=e,i.height=1,!r)return;if(r.translate(0,0),!r)throw new Error("获取ctx发生错误");const n=r.createLinearGradient(0,0,e,0);t.forEach((t=>{n.addColorStop(t[0],t[1])})),r.fillStyle=n,r.fillRect(0,0,e,1),this.rgbaSet=r.getImageData(0,0,e,1).data}getColor(t){const e=this.rgbaSet.slice(4*t,4*t+4);return`rgba(${e[0]}, ${e[1]}, ${e[2]}, ${e[3]/255})`}GetOrCreate(t,e,i,r){let n=arguments.length>4&&void 0!==arguments[4]?arguments[4]:[],o=arguments.length>5&&void 0!==arguments[5]?arguments[5]:100,s=`${t}${e}${i}${r}`;n.forEach((t=>s+=t.join())),s+=o;let a=this.dataMap.get(s);return a||(a={data:new Ls(n,o),timestamp:[]},this.addLimitedTimestamp(a,Date.now(),{}),this.dataMap.set(s,a)),this.clearCache(this.dataMap,this.cacheParams),a.data}}class ks{static GetSize(t){for(let e=0;e<ks.ImageSize.length;e++)if(ks.ImageSize[e]>=t)return ks.ImageSize[e];return t}static Get(t,e,i,r,n,o,s){const a=ks.GenKey(t,e,i,r,n),l=ks.cache[a];if(!l||0===l.length)return null;for(let t=0;t<l.length;t++)if(l[t].width>=o&&l[t].height>=s)return l[t].pattern;return null}static Set(t,e,i,r,n,o,s,a){const l=ks.GenKey(t,e,i,r,n);ks.cache[l]?ks.cache[l].push({width:s,height:a,pattern:o}):ks.cache[l]=[{width:s,height:a,pattern:o}]}static GenKey(t,e,i,r,n){return`${e},${i},${r},${n},${t.join()}`}}ks.cache={},ks.ImageSize=[20,40,80,160,320,640,1280,2560];const Is=Symbol.for("ArcRenderContribution"),Fs=Symbol.for("AreaRenderContribution"),zs=Symbol.for("CircleRenderContribution"),Os=Symbol.for("GroupRenderContribution"),Ds=Symbol.for("ImageRenderContribution"),Ws=Symbol.for("PathRenderContribution"),Ns=Symbol.for("PolygonRenderContribution"),Gs=Symbol.for("RectRenderContribution"),js=Symbol.for("SymbolRenderContribution"),Us=Symbol.for("TextRenderContribution"),Vs=Symbol.for("InteractiveSubRenderContribution"),Ks=["radius","startAngle","endAngle",...mo];let $s=class t extends xo{constructor(){super(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{radius:1}),this.type="circle",this.numberType=Vo}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{startAngle:t,endAngle:e,radius:i}=this.attribute;return this._validNumber(t)&&this._validNumber(e)&&this._validNumber(i)}doUpdateAABBBounds(t){const e=Cn(this).circle;this._AABBBounds.setValue(1/0,1/0,-1/0,-1/0);const i=this.attribute,r=kr.graphicService.updateCircleAABBBounds(i,Cn(this).circle,this._AABBBounds,t,this),{boundsPadding:n=e.boundsPadding}=i,o=Yn(n);return o&&r.expand(o),this.clearUpdateBoundTag(),r}tryUpdateOBBBounds(){throw new Error("暂不支持")}getDefaultAttribute(t){return Cn(this).circle[t]}needUpdateTags(t){return super.needUpdateTags(t,Ks)}needUpdateTag(t){return super.needUpdateTag(t,Ks)}toCustomPath(){var t,e,i;const r=this.attribute,n=null!==(t=r.radius)&&void 0!==t?t:this.getDefaultAttribute("radius"),o=null!==(e=r.startAngle)&&void 0!==e?e:this.getDefaultAttribute("startAngle"),s=null!==(i=r.endAngle)&&void 0!==i?i:this.getDefaultAttribute("endAngle"),a=new lr;return a.arc(0,0,n,o,s),a}clone(){return new t(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return t.NOWORK_ANIMATE_ATTR}};function Xs(t){return new $s(t)}function Ys(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=arguments.length>2?arguments[2]:void 0;i||(i=1);const{fontStyle:r=e.fontStyle,fontVariant:n=e.fontVariant,fontWeight:o=e.fontWeight,fontSize:s=e.fontSize,fontFamily:a=e.fontFamily}=t;return(r?r+" ":"")+(n?n+" ":"")+(o?o+" ":"")+s*i+"px "+(a||"sans-serif")}function qs(t,e){return"end"===t||"right"===t?-e:"center"===t?-e/2:0}function Zs(t,e,i){return"middle"===t?-e/2:"top"===t?0:"bottom"===t?(arguments.length>3&&void 0!==arguments[3]?arguments[3]:0)-e:t&&"alphabetic"!==t?0:(i||(i=e),-(e-i)/2-.79*i)}$s.NOWORK_ANIMATE_ATTR=wo;class Js{constructor(t,e,i){this.fontFamily=t,this.textOptions=e,this.textMeasure=i}LayoutBBox(t,e,i){if("left"===e||"start"===e)t.xOffset=0;else if("center"===e)t.xOffset=t.width/-2;else{if("right"!==e&&"end"!==e)throw new Error("非法的textAlign");t.xOffset=-t.width}return t.yOffset="top"===i?0:"middle"===i?t.height/-2:"alphabetic"===i?-.79*t.height:-t.height,t}GetLayout(t,e,i,r,n,o,s,a,l){const h=[],c=[e,i],d=[0,0];for(;t.length>0;){const{str:i}=this.textMeasure.clipTextWithSuffix(t,this.textOptions,e,s,a,l);h.push({str:i,width:this.textMeasure.measureTextWidth(i,this.textOptions)}),t=t.substring(i.length)}"left"===r||"start"===r||("center"===r?d[0]=c[0]/-2:"right"!==r&&"end"!==r||(d[0]=-c[0])),"top"===n||("middle"===n?d[1]=c[1]/-2:"bottom"===n&&(d[1]=-c[1]));const u={xOffset:d[0],yOffset:d[1],width:c[0],height:c[1]};return this.layoutWithBBox(u,h,r,n,o)}GetLayoutByLines(t,e,i,r){let n=arguments.length>4&&void 0!==arguments[4]?arguments[4]:"",o=arguments.length>5?arguments[5]:void 0,s=arguments.length>6?arguments[6]:void 0,a=arguments.length>7&&void 0!==arguments[7]?arguments[7]:"end";t=t.map((t=>t.toString()));const l=[],h=[0,0];if("number"==typeof s&&s!==1/0){let e;for(let i=0,r=t.length;i<r;i++)e=Math.min(this.textMeasure.measureTextWidth(t[i],this.textOptions),s),l.push({str:this.textMeasure.clipTextWithSuffix(t[i],this.textOptions,e,n,o,a).str,width:e});h[0]=s}else{let e,i;s=0;for(let r=0,n=t.length;r<n;r++)i=t[r],e=this.textMeasure.measureTextWidth(i,this.textOptions),s=Math.max(s,e),l.push({str:i,width:e});h[0]=s}h[1]=l.length*r,h[0]=l.reduce(((t,e)=>Math.max(t,e.width)),0);const c={xOffset:0,yOffset:0,width:h[0],height:h[1]};return this.LayoutBBox(c,e,i),this.layoutWithBBox(c,l,e,i,r)}layoutWithBBox(t,e,i,r,n){const o=[0,0],s=e.length*n;"top"===r||("middle"===r?o[1]=(t.height-s)/2:"bottom"===r&&(o[1]=t.height-s));for(let s=0;s<e.length;s++)this.lineOffset(t,e[s],i,r,n,o);return{bbox:t,lines:e,fontFamily:this.fontFamily,fontSize:this.textOptions.fontSize,fontWeight:this.textOptions.fontWeight,lineHeight:n,textAlign:i,textBaseline:r}}lineOffset(t,e,i,r,n,o){return"left"===i||"start"===i?e.leftOffset=0:"center"===i?e.leftOffset=(t.width-e.width)/2:"right"!==i&&"end"!==i||(e.leftOffset=t.width-e.width),e.topOffset=(n-this.textOptions.fontSize)/2+.79*this.textOptions.fontSize+o[1],o[1]+=n,e}}const Qs=["text","maxLineWidth","heightLimit","lineClamp","fontSize","fontFamily","fontWeight","ellipsis","lineHeight","direction","wordBreak","heightLimit","lineClamp",...mo];let ta=class t extends xo{get font(){const t=Cn(this).text;return this._font||(this._font=Ys(this.attribute,t)),this._font}get clipedText(){var t;const e=this.attribute,i=Cn(this).text;if(!this.isSimplify())return;const{maxLineWidth:r=i.maxLineWidth}=e;return Number.isFinite(r)?(this.tryUpdateAABBBounds(),this.cache.clipedText):(null!==(t=e.text)&&void 0!==t?t:i.text).toString()}get clipedWidth(){if(this.isSimplify())return this.tryUpdateAABBBounds(),this.cache.clipedWidth}get cliped(){const t=Cn(this).text,e=this.attribute;if(this.isMultiLine)return;const{maxLineWidth:i=t.maxLineWidth}=e;return!!Number.isFinite(i)&&(this.tryUpdateAABBBounds(),"vertical"===e.direction&&this.cache.verticalList&&this.cache.verticalList[0]?this.cache.verticalList[0].map((t=>t.text)).join("")!==e.text.toString():null!=this.clipedText&&this.clipedText!==e.text.toString())}get multilineLayout(){if(this.isMultiLine)return this.tryUpdateAABBBounds(),this.cache.layoutData}isSimplify(){return!this.isMultiLine&&"vertical"!==this.attribute.direction}get isMultiLine(){return Array.isArray(this.attribute.text)||"normal"===this.attribute.whiteSpace}constructor(){super(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{text:"",fontSize:16}),this.type="text",this.numberType=rs,this.cache={}}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{text:t}=this.attribute;return it(t)?!t.every((t=>null==t||""===t)):null!=t&&""!==t}doUpdateAABBBounds(){const t=Cn(this).text;this._AABBBounds.setValue(1/0,1/0,-1/0,-1/0);const e=this.attribute,i=kr.graphicService.updateTextAABBBounds(e,t,this._AABBBounds,this),{boundsPadding:r=t.boundsPadding}=this.attribute,n=Yn(r);return n&&i.expand(n),this.clearUpdateBoundTag(),i}updateWrapAABBBounds(t){var e,i,r,n;const o=Cn(this).text,{fontFamily:s=o.fontFamily,textAlign:a=o.textAlign,textBaseline:l=o.textBaseline,fontSize:h=o.fontSize,ellipsis:c=o.ellipsis,maxLineWidth:d,stroke:u=o.stroke,lineWidth:g=o.lineWidth,wordBreak:p=o.wordBreak,fontWeight:f=o.fontWeight,ignoreBuf:m=o.ignoreBuf,suffixPosition:b=o.suffixPosition,heightLimit:y=0,lineClamp:C}=this.attribute,v=null!==(e=no(this.attribute.lineHeight,this.attribute.fontSize||o.fontSize))&&void 0!==e?e:this.attribute.fontSize||o.fontSize,w=m?0:2;if(!this.shouldUpdateShape()&&(null===(i=this.cache)||void 0===i?void 0:i.layoutData)){const t=this.cache.layoutData.bbox;return this._AABBBounds.set(t.xOffset,t.yOffset,t.xOffset+t.width,t.yOffset+t.height),u&&this._AABBBounds.expand(g/2),this._AABBBounds}const x=kr.graphicUtil.textMeasure,_=new Js(s,{fontSize:h,fontWeight:f,fontFamily:s},x),S=it(t)?t.map((t=>t.toString())):[t.toString()],A=[],B=[0,0];let T=1/0;if(y>0&&(T=Math.max(Math.floor(y/v),1)),C&&(T=Math.min(T,C)),"number"==typeof d&&d!==1/0){if(d>0)for(let t=0;t<S.length;t++){const e=S[t];let i=!0;if(t===T-1){const t=_.textMeasure.clipTextWithSuffix(e,_.textOptions,d,c,!1,b);A.push({str:t.str,width:t.width});break}const o=_.textMeasure.clipText(e,_.textOptions,d,"break-word"===p);if(""!==e&&""===o.str){if(c){const t=_.textMeasure.clipTextWithSuffix(e,_.textOptions,d,c,!1,b);o.str=null!==(r=t.str)&&void 0!==r?r:"",o.width=null!==(n=t.width)&&void 0!==n?n:0}else o.str="",o.width=0;i=!1}if(A.push({str:o.str,width:o.width}),o.str.length===e.length);else if(i){const i=e.substring(o.str.length);S.splice(t+1,0,i)}}let t=0;A.forEach((e=>{t=Math.max(t,e.width)})),B[0]=t}else{let t,e,i=0;for(let r=0,n=S.length;r<n;r++){if(r===T-1){const t=_.textMeasure.clipTextWithSuffix(S[r],_.textOptions,d,c,!1,b);A.push({str:t.str,width:t.width}),i=Math.max(i,t.width);break}e=S[r],t=_.textMeasure.measureTextWidth(e,_.textOptions,"break-word"===p),i=Math.max(i,t),A.push({str:e,width:t})}B[0]=i}B[1]=A.length*(v+w);const M={xOffset:0,yOffset:0,width:B[0],height:B[1]};_.LayoutBBox(M,a,l);const R=_.layoutWithBBox(M,A,a,l,v);return this.cache.layoutData=R,this.clearUpdateShapeTag(),this._AABBBounds.set(M.xOffset,M.yOffset,M.xOffset+M.width,M.yOffset+M.height),u&&this._AABBBounds.expand(g/2),this._AABBBounds}updateSingallineAABBBounds(t){const e=Cn(this).text,{direction:i=e.direction}=this.attribute;return"horizontal"===i?this.updateHorizontalSinglelineAABBBounds(t):this.updateVerticalSinglelineAABBBounds(t)}updateMultilineAABBBounds(t){const e=Cn(this).text,{direction:i=e.direction}=this.attribute;return"horizontal"===i?this.updateHorizontalMultilineAABBBounds(t):this.updateVerticalMultilineAABBBounds(t)}updateHorizontalSinglelineAABBBounds(t){var e,i;const r=Cn(this).text,{wrap:n=r.wrap}=this.attribute;if(n)return this.updateWrapAABBBounds([t]);const o=kr.graphicUtil.textMeasure;let s,a;const l=this.attribute,{maxLineWidth:h=r.maxLineWidth,ellipsis:c=r.ellipsis,textAlign:d=r.textAlign,textBaseline:u=r.textBaseline,fontFamily:g=r.fontFamily,fontSize:p=r.fontSize,fontWeight:f=r.fontWeight,stroke:m=r.stroke,lineWidth:b=r.lineWidth,ignoreBuf:y=r.ignoreBuf,whiteSpace:C=r.whiteSpace,suffixPosition:v=r.suffixPosition}=l;if("normal"===C)return this.updateWrapAABBBounds(t);const w=y?0:Math.max(2,.075*p),x=l.fontSize||r.fontSize,_=null!==(e=no(l.lineHeight,x))&&void 0!==e?e:x+w;if(!this.shouldUpdateShape()&&this.cache){s=null!==(i=this.cache.clipedWidth)&&void 0!==i?i:0;const t=qs(d,s),e=Zs(u,_,p);return this._AABBBounds.set(t,e,t+s,e+_),m&&this._AABBBounds.expand(b/2),this._AABBBounds}if(Number.isFinite(h)){if(c){const e=!0===c?r.ellipsis:c,i=o.clipTextWithSuffix(t.toString(),{fontSize:p,fontWeight:f,fontFamily:g},h,e,!1,v);a=i.str,s=i.width}else{const e=o.clipText(t.toString(),{fontSize:p,fontWeight:f,fontFamily:g},h,!1);a=e.str,s=e.width}this.cache.clipedText=a,this.cache.clipedWidth=s}else s=o.measureTextWidth(t.toString(),{fontSize:p,fontWeight:f,fontFamily:g}),this.cache.clipedText=t.toString(),this.cache.clipedWidth=s;this.clearUpdateShapeTag();const S=qs(d,s);let A=_;kr.global&&kr.global.isSafari()&&(A+=.2*p);const B=Zs(u,A,p,w);return this._AABBBounds.set(S,B,S+s,B+A),m&&this._AABBBounds.expand(b/2),this._AABBBounds}getBaselineMapAlign(){return t.baselineMapAlign}getAlignMapBaseline(){return t.alignMapBaseline}updateVerticalSinglelineAABBBounds(e){var i,r,n;const o=Cn(this).text,s=kr.graphicUtil.textMeasure;let a;const l=this.attribute,{ignoreBuf:h=o.ignoreBuf}=l,c=h?0:2,{maxLineWidth:d=o.maxLineWidth,ellipsis:u=o.ellipsis,fontSize:g=o.fontSize,fontWeight:p=o.fontWeight,fontFamily:f=o.fontFamily,stroke:m=o.stroke,lineWidth:b=o.lineWidth,verticalMode:y=o.verticalMode,suffixPosition:C=o.suffixPosition}=l,v=null!==(i=no(l.lineHeight,l.fontSize||o.fontSize))&&void 0!==i?i:(l.fontSize||o.fontSize)+c;let{textAlign:w=o.textAlign,textBaseline:x=o.textBaseline}=l;if(!y){const e=w;w=null!==(r=t.baselineMapAlign[x])&&void 0!==r?r:"left",x=null!==(n=t.alignMapBaseline[e])&&void 0!==n?n:"top"}if(!this.shouldUpdateShape()&&this.cache){a=this.cache.clipedWidth;const t=qs(w,a),e=Zs(x,v,g);return this._AABBBounds.set(e,t,e+v,t+a),m&&this._AABBBounds.expand(b/2),this._AABBBounds}let _=[Oo(e.toString())];if(Number.isFinite(d)){if(u){const t=!0===u?o.ellipsis:u,e=s.clipTextWithSuffixVertical(_[0],{fontSize:g,fontWeight:p,fontFamily:f},d,t,!1,C);_=[e.verticalList],a=e.width}else{const t=s.clipTextVertical(_[0],{fontSize:g,fontWeight:p,fontFamily:f},d,!1);_=[t.verticalList],a=t.width}this.cache.verticalList=_,this.cache.clipedWidth=a}else a=0,_[0].forEach((t=>{const e=t.direction===zo.HORIZONTAL?g:s.measureTextWidth(t.text,{fontSize:g,fontWeight:p,fontFamily:f});a+=e,t.width=e})),this.cache.verticalList=_,this.cache.clipedWidth=a;this.clearUpdateShapeTag();const S=qs(w,a),A=Zs(x,v,g);return this._AABBBounds.set(A,S,A+v,S+a),m&&this._AABBBounds.expand(b/2),this._AABBBounds}updateHorizontalMultilineAABBBounds(t){var e,i;const r=Cn(this).text,{wrap:n=r.wrap}=this.attribute;if(n)return this.updateWrapAABBBounds(t);const o=this.attribute,{fontFamily:s=r.fontFamily,textAlign:a=r.textAlign,textBaseline:l=r.textBaseline,fontSize:h=r.fontSize,fontWeight:c=r.fontWeight,ellipsis:d=r.ellipsis,maxLineWidth:u,stroke:g=r.stroke,lineWidth:p=r.lineWidth,whiteSpace:f=r.whiteSpace,suffixPosition:m=r.suffixPosition}=o,b=null!==(e=no(o.lineHeight,o.fontSize||r.fontSize))&&void 0!==e?e:o.fontSize||r.fontSize;if("normal"===f)return this.updateWrapAABBBounds(t);if(!this.shouldUpdateShape()&&(null===(i=this.cache)||void 0===i?void 0:i.layoutData)){const t=this.cache.layoutData.bbox;return this._AABBBounds.set(t.xOffset,t.yOffset,t.xOffset+t.width,t.yOffset+t.height),g&&this._AABBBounds.expand(p/2),this._AABBBounds}const y=kr.graphicUtil.textMeasure,C=new Js(s,{fontSize:h,fontWeight:c,fontFamily:s},y).GetLayoutByLines(t,a,l,b,!0===d?r.ellipsis:d||void 0,!1,u,m),{bbox:v}=C;return this.cache.layoutData=C,this.clearUpdateShapeTag(),this._AABBBounds.set(v.xOffset,v.yOffset,v.xOffset+v.width,v.yOffset+v.height),g&&this._AABBBounds.expand(p/2),this._AABBBounds}updateVerticalMultilineAABBBounds(e){var i,r,n;const o=Cn(this).text,s=kr.graphicUtil.textMeasure;let a;const l=this.attribute,{ignoreBuf:h=o.ignoreBuf}=l,c=h?0:2,{maxLineWidth:d=o.maxLineWidth,ellipsis:u=o.ellipsis,fontFamily:g=o.fontFamily,fontSize:p=o.fontSize,fontWeight:f=o.fontWeight,stroke:m=o.stroke,lineWidth:b=o.lineWidth,verticalMode:y=o.verticalMode,suffixPosition:C=o.suffixPosition}=l,v=null!==(i=no(l.lineHeight,l.fontSize||o.fontSize))&&void 0!==i?i:(l.fontSize||o.fontSize)+c;let{textAlign:w=o.textAlign,textBaseline:x=o.textBaseline}=l;if(!y){const e=w;w=null!==(r=t.baselineMapAlign[x])&&void 0!==r?r:"left",x=null!==(n=t.alignMapBaseline[e])&&void 0!==n?n:"top"}if(a=0,!this.shouldUpdateShape()&&this.cache){this.cache.verticalList.forEach((t=>{const e=t.reduce(((t,e)=>t+e.width),0);a=ee(e,a)}));const t=qs(w,a),e=this.cache.verticalList.length*v,i=Zs(x,e,p);return this._AABBBounds.set(i,t,i+e,t+a),m&&this._AABBBounds.expand(b/2),this._AABBBounds}const _=e.map((t=>Oo(t.toString())));_.forEach(((t,e)=>{if(Number.isFinite(d))if(u){const i=!0===u?o.ellipsis:u,r=s.clipTextWithSuffixVertical(t,{fontSize:p,fontWeight:f,fontFamily:g},d,i,!1,C);_[e]=r.verticalList,a=r.width}else{const i=s.clipTextVertical(t,{fontSize:p,fontWeight:f,fontFamily:g},d,!1);_[e]=i.verticalList,a=i.width}else a=0,t.forEach((t=>{const e=t.direction===zo.HORIZONTAL?p:s.measureTextWidth(t.text,{fontSize:p,fontWeight:f,fontFamily:g});a+=e,t.width=e}))})),this.cache.verticalList=_,this.clearUpdateShapeTag(),this.cache.verticalList.forEach((t=>{const e=t.reduce(((t,e)=>t+e.width),0);a=ee(e,a)}));const S=qs(w,a),A=this.cache.verticalList.length*v,B=Zs(x,A,p);return this._AABBBounds.set(B,S,B+A,S+a),m&&this._AABBBounds.expand(b/2),this._AABBBounds}tryUpdateOBBBounds(){throw new Error("暂不支持")}getDefaultAttribute(t){return Cn(this).text[t]}needUpdateTags(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Qs;return super.needUpdateTags(t,e)}needUpdateTag(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Qs;return super.needUpdateTag(t,e)}clone(){return new t(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return t.NOWORK_ANIMATE_ATTR}};function ea(t){return new ta(t)}ta.NOWORK_ANIMATE_ATTR=Object.assign({ellipsis:1,wordBreak:1,direction:1,textAlign:1,textBaseline:1,fontFamily:1,fontWeight:1},wo),ta.baselineMapAlign={top:"left",bottom:"right",middle:"center"},ta.alignMapBaseline={left:"top",right:"bottom",center:"middle"};const ia=["heightLimit","lineClamp"];class ra extends ta{constructor(t){super(Object.assign(Object.assign({},t),{wrap:!0}))}_isValid(){const{text:t}=this.attribute;return it(t)?!t.every((t=>null==t||""===t)):null!=t&&""!==t}updateMultilineAABBBounds(t){var e,i,r,n;const o=Cn(this).text,{fontFamily:s=o.fontFamily,textAlign:a=o.textAlign,textBaseline:l=o.textBaseline,fontSize:h=o.fontSize,ellipsis:c=o.ellipsis,maxLineWidth:d,stroke:u=o.stroke,lineWidth:g=o.lineWidth,wordBreak:p=o.wordBreak,fontWeight:f=o.fontWeight,ignoreBuf:m=o.ignoreBuf,heightLimit:b=0,suffixPosition:y=o.suffixPosition,lineClamp:C}=this.attribute,v=null!==(e=no(this.attribute.lineHeight,this.attribute.fontSize||o.fontSize))&&void 0!==e?e:this.attribute.fontSize||o.fontSize,w=m?0:2;if(!this.shouldUpdateShape()&&(null===(i=this.cache)||void 0===i?void 0:i.layoutData)){const t=this.cache.layoutData.bbox;return this._AABBBounds.set(t.xOffset,t.yOffset,t.xOffset+t.width,t.yOffset+t.height),u&&this._AABBBounds.expand(g/2),this._AABBBounds}const x=kr.graphicUtil.textMeasure,_=new Js(s,{fontSize:h,fontWeight:f,fontFamily:s},x),S=t.map((t=>t.toString())),A=[],B=[0,0];let T=1/0;if(b>0&&(T=Math.max(Math.floor(b/v),1)),C&&(T=Math.min(T,C)),"number"==typeof d&&d!==1/0){if(d>0)for(let t=0;t<S.length;t++){const e=S[t];let i=!0;if(t===T-1){const t=_.textMeasure.clipTextWithSuffix(e,_.textOptions,d,c,!1,y);A.push({str:t.str,width:t.width});break}const o=_.textMeasure.clipText(e,_.textOptions,d,"break-word"===p);if(""!==e&&""===o.str){if(c){const t=_.textMeasure.clipTextWithSuffix(e,_.textOptions,d,c,!1,y);o.str=null!==(r=t.str)&&void 0!==r?r:"",o.width=null!==(n=t.width)&&void 0!==n?n:0}else o.str="",o.width=0;i=!1}if(A.push({str:o.str,width:o.width}),o.str.length===e.length);else if(i){const i=e.substring(o.str.length);S.splice(t+1,0,i)}}let t=0;A.forEach((e=>{t=Math.max(t,e.width)})),B[0]=t}else{let t,e,i=0;for(let r=0,n=S.length;r<n;r++){if(r===T-1){const t=_.textMeasure.clipTextWithSuffix(S[r],_.textOptions,d,c,!1,y);A.push({str:t.str,width:t.width}),i=Math.max(i,t.width);break}e=S[r],t=_.textMeasure.measureTextWidth(e,_.textOptions,"break-word"===p),i=Math.max(i,t),A.push({str:e,width:t})}B[0]=i}B[1]=A.length*(v+w);const M={xOffset:0,yOffset:0,width:B[0],height:B[1]};_.LayoutBBox(M,a,l);const R=_.layoutWithBBox(M,A,a,l,v);return this.cache.layoutData=R,this.clearUpdateShapeTag(),this._AABBBounds.set(M.xOffset,M.yOffset,M.xOffset+M.width,M.yOffset+M.height),u&&this._AABBBounds.expand(g/2),this._AABBBounds}needUpdateTags(t){for(let e=0;e<ia.length;e++){const i=ia[e];if(-1!==t.indexOf(i))return!0}return super.needUpdateTags(t)}needUpdateTag(t){for(let e=0;e<ia.length;e++)if(t===ia[e])return!0;return super.needUpdateTag(t)}getNoWorkAnimateAttr(){return ra.NOWORK_ANIMATE_ATTR}}function na(t){return new ra(t)}class oa{bounds(t,e){if(ot(t)){const i=t/2;e.x1=-i,e.x2=i,e.y1=-i,e.y2=i}else e.x1=-t[0]/2,e.x2=t[0]/2,e.y1=-t[1]/2,e.y2=t[1]/2}}function sa(t,e,i,r,n){return n?t.arc(i,r,e,0,qt,!1,n):t.arc(i,r,e,0,qt),!1}var aa=new class extends oa{constructor(){super(...arguments),this.type="circle",this.pathStr="M0.5,0A0.5,0.5,0,1,1,-0.5,0A0.5,0.5,0,1,1,0.5,0"}draw(t,e,i,r,n){return sa(t,e/2,i,r,n)}drawOffset(t,e,i,r,n,o){return sa(t,e/2+n,i,r,o)}drawToSvgPath(t,e,i,r){const n=t/2;return`M ${e-n}, ${i} a ${n},${n} 0 1,0 ${2*n},0 a ${n},${n} 0 1,0 -${2*n},0`}};var la=new class extends oa{constructor(){super(...arguments),this.type="cross",this.pathStr="M-0.5,-0.2L-0.5,0.2L-0.2,0.2L-0.2,0.5L0.2,0.5L0.2,0.2L0.5,0.2L0.5,-0.2L0.2,-0.2L0.2,-0.5L-0.2,-0.5L-0.2,-0.2Z"}draw(t,e,i,r,n){return function(t,e,i,r,n){return t.moveTo(-3*e+i,-e+r,n),t.lineTo(-e+i,-e+r,n),t.lineTo(-e+i,-3*e+r,n),t.lineTo(e+i,-3*e+r,n),t.lineTo(e+i,-e+r,n),t.lineTo(3*e+i,-e+r,n),t.lineTo(3*e+i,e+r,n),t.lineTo(e+i,e+r,n),t.lineTo(e+i,3*e+r,n),t.lineTo(-e+i,3*e+r,n),t.lineTo(-e+i,e+r,n),t.lineTo(-3*e+i,e+r,n),t.closePath(),!0}(t,e/6,i,r,n)}drawOffset(t,e,i,r,n,o){return function(t,e,i,r,n,o){return t.moveTo(-3*e+i-n,-e+r-n,o),t.lineTo(-e+i-n,-e+r-n,o),t.lineTo(-e+i-n,-3*e+r-n,o),t.lineTo(e+i+n,-3*e+r-n,o),t.lineTo(e+i+n,-e+r-n,o),t.lineTo(3*e+i+n,-e+r-n,o),t.lineTo(3*e+i+n,e+r+n,o),t.lineTo(e+i+n,e+r+n,o),t.lineTo(e+i+n,3*e+r+n,o),t.lineTo(-e+i-n,3*e+r+n,o),t.lineTo(-e+i-n,e+r+n,o),t.lineTo(-3*e+i-n,e+r+n,o),t.closePath(),!0}(t,e/6,i,r,n,o)}};function ha(t,e,i,r,n){return t.moveTo(i,r-e,n),t.lineTo(e+i,r,n),t.lineTo(i,r+e,n),t.lineTo(i-e,r,n),t.closePath(),!0}var ca=new class extends oa{constructor(){super(...arguments),this.type="diamond",this.pathStr="M-0.5,0L0,-0.5L0.5,0L0,0.5Z"}draw(t,e,i,r,n){return ha(t,e/2,i,r,n)}drawFitDir(t,e,i,r,n){return ha(t,e/2,i,r,n)}drawOffset(t,e,i,r,n,o){return ha(t,e/2+n,i,r,o)}};function da(t,e,i,r){const n=2*e;return t.rect(i-e,r-e,n,n),!1}var ua=new class extends oa{constructor(){super(...arguments),this.type="square",this.pathStr="M-0.5,-0.5h1v1h-1Z"}draw(t,e,i,r){return da(t,e/2,i,r)}drawOffset(t,e,i,r,n){return da(t,e/2+n,i,r)}};class ga extends oa{constructor(){super(...arguments),this.type="triangleUp",this.pathStr="M0.5,0.5 L-0.5,0.5 L0,-0.5 Z"}draw(t,e,i,r){return function(t,e,i,r){return t.moveTo(i+e,e+r),t.lineTo(i-e,e+r),t.lineTo(i,r-e),t.closePath(),!0}(t,e/2,i,r)}drawOffset(t,e,i,r,n){return function(t,e,i,r,n){return t.moveTo(i+e+2*n,e+r+n),t.lineTo(i-e-2*n,e+r+n),t.lineTo(i,r-e-2*n),t.closePath(),!0}(t,e/2,i,r,n)}}var pa=new ga;var fa=new class extends ga{constructor(){super(...arguments),this.type="triangle"}};const ma=Math.sin(Math.PI/10)/Math.sin(7*Math.PI/10),ba=Math.sin(qt/10)*ma,ya=-Math.cos(qt/10)*ma;function Ca(t,e,i,r){const n=ba*e,o=ya*e;t.moveTo(i,-e+r),t.lineTo(n+i,o+r);for(let s=1;s<5;++s){const a=qt*s/5,l=Math.cos(a),h=Math.sin(a);t.lineTo(h*e+i,-l*e+r),t.lineTo(l*n-h*o+i,h*n+l*o+r)}return t.closePath(),!0}var va=new class extends oa{constructor(){super(...arguments),this.type="star",this.pathStr="M4.51351666838205,0A4.51351666838205,4.51351666838205,0,1,1,-4.51351666838205,0A4.51351666838205,4.51351666838205,0,1,1,4.51351666838205,0"}draw(t,e,i,r){return Ca(t,e/2,i,r)}drawOffset(t,e,i,r,n){return Ca(t,e/2+n,i,r)}};const wa=ne(3);function xa(t,e,i,r){const n=e,o=n/wa,s=o/5,a=e;return t.moveTo(0+i,-n+r),t.lineTo(o/2+i,r),t.lineTo(s/2+i,r),t.lineTo(s/2+i,a+r),t.lineTo(-s/2+i,a+r),t.lineTo(-s/2+i,r),t.lineTo(-o/2+i,r),t.closePath(),!0}var _a=new class extends oa{constructor(){super(...arguments),this.type="arrow",this.pathStr="M-0.07142857142857142,0.5L0.07142857142857142,0.5L0.07142857142857142,-0.0625L0.2,-0.0625L0,-0.5L-0.2,-0.0625L-0.07142857142857142,-0.0625Z"}draw(t,e,i,r){return xa(t,e/2,i,r)}drawOffset(t,e,i,r,n){return xa(t,e/2+n,i,r)}};function Sa(t,e,i,r){const n=2*e;return t.moveTo(i,-e+r),t.lineTo(n/3/2+i,e+r),t.lineTo(-n/3/2+i,e+r),t.closePath(),!0}var Aa=new class extends oa{constructor(){super(...arguments),this.type="wedge",this.pathStr="M0,-0.5773502691896257L-0.125,0.28867513459481287L0.125,0.28867513459481287Z"}draw(t,e,i,r){return Sa(t,e/2,i,r)}drawOffset(t,e,i,r,n){return Sa(t,e/2+n,i,r)}};function Ba(t,e,i,r){return t.moveTo(-e+i,r),t.lineTo(i,e+r),!1}var Ta=new class extends oa{constructor(){super(...arguments),this.type="stroke",this.pathStr=""}draw(t,e,i,r){return Ba(t,e/2,i,r)}drawOffset(t,e,i,r,n){return Ba(t,e/2+n,i,r)}};const Ma=-.5,Ra=ne(3)/2,Pa=1/ne(12);function Ea(t,e,i,r){const n=e/2,o=e*Pa,s=n,a=e*Pa+e,l=-s,h=a;return t.moveTo(n+i,o+r),t.lineTo(s+i,a+r),t.lineTo(l+i,h+r),t.lineTo(Ma*n-Ra*o+i,Ra*n+Ma*o+r),t.lineTo(Ma*s-Ra*a+i,Ra*s+Ma*a+r),t.lineTo(Ma*l-Ra*h+i,Ra*l+Ma*h+r),t.lineTo(Ma*n+Ra*o+i,Ma*o-Ra*n+r),t.lineTo(Ma*s+Ra*a+i,Ma*a-Ra*s+r),t.lineTo(Ma*l+Ra*h+i,Ma*h-Ra*l+r),t.closePath(),!1}var Ha=new class extends oa{constructor(){super(...arguments),this.type="wye",this.pathStr="M4.51351666838205,0A4.51351666838205,4.51351666838205,0,1,1,-4.51351666838205,0A4.51351666838205,4.51351666838205,0,1,1,4.51351666838205,0"}draw(t,e,i,r){return Ea(t,e/2,i,r)}drawOffset(t,e,i,r,n){return Ea(t,e/2+n,i,r)}};var La=new class extends oa{constructor(){super(...arguments),this.type="triangleLeft",this.pathStr="M-0.5,0 L0.5,0.5 L0.5,-0.5 Z"}draw(t,e,i,r){return function(t,e,i,r){return t.moveTo(-e+i,r),t.lineTo(e+i,e+r),t.lineTo(e+i,r-e),t.closePath(),!0}(t,e/2,i,r)}drawOffset(t,e,i,r,n){return function(t,e,i,r,n){return t.moveTo(-e+i-2*n,r),t.lineTo(e+i+n,e+r+2*n),t.lineTo(e+i+n,r-e-2*n),t.closePath(),!0}(t,e/2,i,r,n)}};var ka=new class extends oa{constructor(){super(...arguments),this.type="triangleRight",this.pathStr="M-0.5,0.5 L0.5,0 L-0.5,-0.5 Z"}draw(t,e,i,r){return function(t,e,i,r){return t.moveTo(i-e,e+r),t.lineTo(e+i,r),t.lineTo(i-e,r-e),t.closePath(),!0}(t,e/2,i,r)}drawOffset(t,e,i,r,n){return function(t,e,i,r,n){return t.moveTo(i-e-n,e+r+2*n),t.lineTo(e+i+2*n,r),t.lineTo(i-e-n,r-e-2*n),t.closePath(),!0}(t,e/2,i,r,n)}};var Ia=new class extends oa{constructor(){super(...arguments),this.type="triangleDown",this.pathStr="M-0.5,-0.5 L0.5,-0.5 L0,0.5 Z"}draw(t,e,i,r){return function(t,e,i,r){return t.moveTo(i-e,r-e),t.lineTo(i+e,r-e),t.lineTo(i,r+e),t.closePath(),!0}(t,e/2,i,r)}drawOffset(t,e,i,r,n){return function(t,e,i,r,n){return t.moveTo(i-e-2*n,r-e-n),t.lineTo(i+e+2*n,r-e-n),t.lineTo(i,r+e+2*n),t.closePath(),!0}(t,e/2,i,r,n)}};const Fa=ne(3);function za(t,e,i,r){const n=e*Fa;return t.moveTo(i,r+-n/3*2),t.lineTo(e+i,r+n),t.lineTo(i-e,r+n),t.closePath(),!0}var Oa=new class extends ga{constructor(){super(...arguments),this.type="thinTriangle",this.pathStr="M0,-0.5773502691896257L-0.5,0.28867513459481287L0.5,0.28867513459481287Z"}draw(t,e,i,r){return za(t,e/2/Fa,i,r)}drawOffset(t,e,i,r,n){return za(t,e/2/Fa+n,i,r)}};function Da(t,e,i,r){const n=2*e;return t.moveTo(e+i,r-n),t.lineTo(i-e,r),t.lineTo(e+i,n+r),!0}var Wa=new class extends oa{constructor(){super(...arguments),this.type="arrow2Left",this.pathStr="M 0.25 -0.5 L -0.25 0 l 0.25 0.5"}draw(t,e,i,r){return Da(t,e/4,i,r)}drawOffset(t,e,i,r,n){return Da(t,e/4+n,i,r)}};function Na(t,e,i,r){const n=2*e;return t.moveTo(i-e,r-n),t.lineTo(i+e,r),t.lineTo(i-e,n+r),!0}var Ga=new class extends oa{constructor(){super(...arguments),this.type="arrow2Right",this.pathStr="M -0.25 -0.5 l 0.25 0 l -0.25 0.5"}draw(t,e,i,r){return Na(t,e/4,i,r)}drawOffset(t,e,i,r,n){return Na(t,e/4+n,i,r)}};function ja(t,e,i,r){const n=2*e;return t.moveTo(i-n,r+e),t.lineTo(i,r-e),t.lineTo(i+n,r+e),!0}var Ua=new class extends oa{constructor(){super(...arguments),this.type="arrow2Up",this.pathStr="M -0.5 0.25 L 0 -0.25 l 0.5 0.25"}draw(t,e,i,r){return ja(t,e/4,i,r)}drawOffset(t,e,i,r,n){return ja(t,e/4+n,i,r)}};function Va(t,e,i,r){const n=2*e;return t.moveTo(i-n,r-e),t.lineTo(i,r+e),t.lineTo(i+n,r-e),!0}var Ka=new class extends oa{constructor(){super(...arguments),this.type="arrow2Down",this.pathStr="M -0.5 -0.25 L 0 0.25 l 0.5 -0.25"}draw(t,e,i,r){return Va(t,e/4,i,r)}drawOffset(t,e,i,r,n){return Va(t,e/4+n,i,r)}};function $a(t,e,i,r,n){return t.moveTo(i,r-e),t.lineTo(i,r+e),!0}var Xa=new class extends oa{constructor(){super(...arguments),this.type="lineV",this.pathStr="M0,-0.5L0,0.5"}draw(t,e,i,r,n){return $a(t,e/2,i,r)}drawOffset(t,e,i,r,n,o){return $a(t,e/2+n,i,r)}drawToSvgPath(t,e,i,r){const n=t/2;return`M ${e}, ${i-n} L ${e},${i+n}`}};function Ya(t,e,i,r,n){return t.moveTo(i-e,r),t.lineTo(i+e,r),!0}var qa=new class extends oa{constructor(){super(...arguments),this.type="lineH",this.pathStr="M-0.5,0L0.5,0"}draw(t,e,i,r,n){return Ya(t,e/2,i,r)}drawOffset(t,e,i,r,n,o){return Ya(t,e/2+n,i,r)}drawToSvgPath(t,e,i,r){const n=t/2;return`M ${e-n}, ${i} L ${e+n},${i}`}};function Za(t,e,i,r,n){return t.moveTo(i-e,r-e),t.lineTo(i+e,r+e),t.moveTo(i+e,r-e),t.lineTo(i-e,r+e),!0}var Ja=new class extends oa{constructor(){super(...arguments),this.type="close",this.pathStr="M-0.5,-0.5L0.5,0.5,M0.5,-0.5L-0.5,0.5"}draw(t,e,i,r,n){return Za(t,e/2,i,r)}drawOffset(t,e,i,r,n,o){return Za(t,e/2+n,i,r)}drawToSvgPath(t,e,i,r){const n=t/2;return`M ${e-n}, ${i-n} L ${e+n},${i+n} M ${e+n}, ${i-n} L ${e-n},${i+n}`}};function Qa(t,e,i,r){return t.rect(i-e[0]/2,r-e[1]/2,e[0],e[1]),!1}function tl(t,e,i,r){const n=e,o=e/2;return t.rect(i-n/2,r-o/2,n,o),!1}var el=new class extends oa{constructor(){super(...arguments),this.type="rect",this.pathStr="M -0.5,0.25 L 0.5,0.25 L 0.5,-0.25,L -0.5,-0.25 Z"}draw(t,e,i,r){return ot(e)?tl(t,e,i,r):Qa(t,e,i,r)}drawOffset(t,e,i,r,n){return ot(e)?tl(t,e+2*n,i,r):Qa(t,[e[0]+2*n,e[1]+2*n],i,r)}};const il=new ge;class rl{constructor(t,e){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];this.pathStr="",this.type=t,it(e)?this.svgCache=e:this.path=e,this.isSvg=i}drawOffset(t,e,i,r,n,o,s){return this.isSvg?!!this.svgCache&&(this.svgCache.forEach((n=>{t.beginPath(),Ei(n.path.commandList,t,i,r,e,e),s&&s(n.path,n.attribute)})),!1):(Ei(this.path.commandList,t,i,r,e+n,e+n),!1)}draw(t,e,i,r,n,o){return this.isSvg?!!this.svgCache&&(this.svgCache.forEach((n=>{t.beginPath(),Ei(n.path.commandList,t,i,r,e,e),o&&o(n.path,n.attribute)})),!1):(Ei(this.path.commandList,t,i,r,e,e),!1)}bounds(t,e){if(this.isSvg){if(!this.svgCache)return;return e.clear(),void this.svgCache.forEach((i=>{let{path:r}=i;il.x1=r.bounds.x1*t,il.y1=r.bounds.y1*t,il.x2=r.bounds.x2*t,il.y2=r.bounds.y2*t,e.union(il)}))}this.path.bounds&&(e.x1=this.path.bounds.x1*t,e.y1=this.path.bounds.y1*t,e.x2=this.path.bounds.x2*t,e.y2=this.path.bounds.y2*t)}}const nl={};[aa,la,ca,ua,Oa,fa,va,_a,Aa,Ta,Ha,La,ka,pa,Ia,Wa,Ga,Ua,Ka,el,Xa,qa,Ja].forEach((t=>{nl[t.type]=t}));const ol={arrowLeft:"M 0.25 -0.5 L -0.25 0 l 0.5 0.5",arrowRight:"M -0.25 -0.5 l 0.5 0.5 l -0.5 0.5",rectRound:"M 0.3 -0.5 C 0.41 -0.5 0.5 -0.41 0.5 -0.3 C 0.5 -0.3 0.5 0.3 0.5 0.3 C 0.5 0.41 0.41 0.5 0.3 0.5 C 0.3 0.5 -0.3 0.5 -0.3 0.5 C -0.41 0.5 -0.5 0.41 -0.5 0.3 C -0.5 0.3 -0.5 -0.3 -0.5 -0.3 C -0.5 -0.41 -0.41 -0.5 -0.3 -0.5 C -0.3 -0.5 0.3 -0.5 0.3 -0.5 Z",roundLine:"M 1.2392 -0.258 L -1.3432 -0.258 C -1.4784 -0.258 -1.588 -0.1436 -1.588 -0.002 c 0 0.1416 0.1096 0.256 0.2448 0.256 l 2.5824 0 c 0.1352 0 0.2448 -0.1144 0.2448 -0.256 C 1.484 -0.1436 1.3744 -0.258 1.2392 -0.258 z"},sl=new ge,al=["symbolType","size",...mo];let ll=class t extends xo{constructor(){super(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{symbolType:"circle"}),this.type="symbol",this.numberType=is}getParsedPath(){return this.shouldUpdateShape()&&(this.doUpdateParsedPath(),this.clearUpdateShapeTag()),this._parsedPath}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{size:t}=this.attribute;return it(t)?2===t.length&&t.every(this._validNumber):this._validNumber(t)}doUpdateParsedPath(){const e=Cn(this).symbol;let{symbolType:i=e.symbolType}=this.attribute,r=nl[i];if(r)return this._parsedPath=r,r;if(r=t.userSymbolMap[i],r)return this._parsedPath=r,r;if(i=ol[i]||i,!0===function(t){return t.startsWith("<svg")||t.startsWith("<?xml")}(i)){const e=new Lo,{svg:r}=e.parse(i);if(!r)return null;const n=it(r.path)?r.path:[r.path];sl.clear();const o=[];n.forEach((t=>{const e=(new lr).fromString(t.d),i={};as.forEach((e=>{t[e]&&(i[ss[e]]=t[e])})),o.push({path:e,attribute:i}),sl.union(e.bounds)}));const s=sl.width(),a=sl.height(),l=1/ee(s,a);return o.forEach((t=>t.path.transform(0,0,l,l))),this._parsedPath=new rl(i,o,!0),t.userSymbolMap[i]=this._parsedPath,this._parsedPath}const n=(new lr).fromString(i),o=n.bounds.width(),s=n.bounds.height(),a=1/ee(o,s);return n.transform(0,0,a,a),this._parsedPath=new rl(i,n),t.userSymbolMap[i]=this._parsedPath,this._parsedPath}doUpdateAABBBounds(t){const e=Cn(this).symbol;this._AABBBounds.setValue(1/0,1/0,-1/0,-1/0);const i=this.attribute,r=kr.graphicService.updateSymbolAABBBounds(i,Cn(this).symbol,this._AABBBounds,t,this),{boundsPadding:n=e.boundsPadding}=i,o=Yn(n);return o&&r.expand(o),this.clearUpdateBoundTag(),r}tryUpdateOBBBounds(){throw new Error("暂不支持")}getDefaultAttribute(t){return Cn(this).symbol[t]}needUpdateTags(t){return super.needUpdateTags(t,al)}needUpdateTag(t){return super.needUpdateTag(t,al)}toCustomPath(){const t=this.getParsedPath(),e=this.attribute.size,i=it(e)?e:[e,e];return t.path?(new lr).fromCustomPath2D(t.path,0,0,i[0],i[1]):(new lr).fromString(t.pathStr,0,0,i[0],i[1])}clone(){return new t(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return t.NOWORK_ANIMATE_ATTR}};function hl(t){return new ll(t)}ll.userSymbolMap={},ll.NOWORK_ANIMATE_ATTR=Object.assign({symbolType:1},wo);const cl=["segments","points","curveType",...mo];let dl=class t extends xo{constructor(){super(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}),this.type="line",this.numberType=Yo}isValid(){return super.isValid()&&this._isValid()}_isValid(){if(this.pathProxy)return!0;const{points:t,segments:e}=this.attribute;return e?0!==e.length:!(!t||t.length<=1)}_interpolate(t,e,i,r,n){"points"===t&&(n.points=to(i,r,e))}doUpdateAABBBounds(){const t=Cn(this).line;this._AABBBounds.setValue(1/0,1/0,-1/0,-1/0);const e=this.attribute,i=kr.graphicService.updateLineAABBBounds(e,Cn(this).line,this._AABBBounds,this),{boundsPadding:r=t.boundsPadding}=e,n=Yn(r);return n&&i.expand(n),this.clearUpdateBoundTag(),i}tryUpdateOBBBounds(){throw new Error("暂不支持")}getDefaultAttribute(t){return Cn(this).line[t]}needUpdateTags(t){return super.needUpdateTags(t,cl)}needUpdateTag(t){return super.needUpdateTag(t,cl)}toCustomPath(){const t=this.attribute,e=new lr,i=t.segments,r=t=>{if(t&&t.length){let i=!0;t.forEach((t=>{!1!==t.defined&&(i?e.moveTo(t.x,t.y):e.lineTo(t.x,t.y),i=!1)}))}};return i&&i.length?i.forEach((t=>{r(t.points)})):t.points&&r(t.points),e}clone(){return new t(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return t.NOWORK_ANIMATE_ATTR}};function ul(t){return new dl(t)}dl.NOWORK_ANIMATE_ATTR=Object.assign({segments:1,curveType:1},wo);const gl=["width","x1","y1","height","cornerRadius",...mo];let pl=class t extends xo{constructor(t){super(t),this.type="rect",this.numberType=Qo}isValid(){return super.isValid()&&this._isValid()}_isValid(){return!0}doUpdateAABBBounds(){const t=Cn(this).rect;this._AABBBounds.setValue(1/0,1/0,-1/0,-1/0);const e=this.attribute,i=kr.graphicService.updateRectAABBBounds(e,Cn(this).rect,this._AABBBounds,this),{boundsPadding:r=t.boundsPadding}=e,n=Yn(r);return n&&i.expand(n),this.clearUpdateBoundTag(),i}tryUpdateOBBBounds(){throw new Error("暂不支持")}getDefaultAttribute(t){return Cn(this).rect[t]}needUpdateTags(t){return super.needUpdateTags(t,gl)}needUpdateTag(t){return super.needUpdateTag(t,gl)}toCustomPath(){const t=this.attribute;let e=X(t.width)?t.x1-t.x:t.width,i=X(t.height)?t.y1-t.y:t.height,r=0,n=0;e<0&&(r=e,e=-e),i<0&&(n=i,i=-i);const o=new lr;return o.moveTo(r,n),o.rect(r,n,e,i),o}clone(){return new t(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return t.NOWORK_ANIMATE_ATTR}};function fl(t){return new pl(t)}pl.NOWORK_ANIMATE_ATTR=wo;const ml=[[0,0,0],[1,0,0],[1,1,0],[0,1,0],[0,0,1],[1,0,1],[1,1,1],[0,1,1]];class bl extends pl{constructor(t){super(t),this.type="rect3d",this.numberType=ts}findFace(){const t={polygons:[],vertices:[],edges:[]},e=Cn(this).rect3d,{x1:i,y1:r,x:n,y:o,length:s=ie(e.width,e.height)}=this.attribute;let{width:a,height:l}=this.attribute;a=null!=a?a:i-n,l=null!=l?l:r-o;for(let e=0;e<ml.length;e++){const i=ml[e];t.vertices.push([i[0]*a,i[1]*l,i[2]*s])}return t.polygons.push({polygon:[0,1,5,4],normal:[0,-1,0]}),t.polygons.push({polygon:[2,3,7,6],normal:[0,1,0]}),t.polygons.push({polygon:[4,7,3,0],normal:[-1,0,0]}),t.polygons.push({polygon:[1,2,6,5],normal:[1,0,0]}),t.polygons.push({polygon:[0,1,2,3],normal:[0,0,-1]}),t.polygons.push({polygon:[4,5,6,7],normal:[0,0,1]}),t.edges=[[0,1],[1,2],[2,3],[3,0],[4,5],[5,6],[6,7],[7,4],[0,4],[3,7],[1,5],[2,6]],t}getNoWorkAnimateAttr(){return bl.NOWORK_ANIMATE_ATTR}}function yl(t){return new bl(t)}bl.NOWORK_ANIMATE_ATTR=wo;class Cl extends xo{constructor(t){super(t),this.type="glyph",this.numberType=Ko,this.subGraphic=[],this._onInit&&this._onInit(this),this.valid=this.isValid()}setSubGraphic(t){this.detachSubGraphic(),this.subGraphic=t,t.forEach((t=>{t.glyphHost=this,Object.setPrototypeOf(t.attribute,this.attribute)})),this.valid=this.isValid(),this.addUpdateBoundTag()}detachSubGraphic(){this.subGraphic.forEach((t=>{t.glyphHost=null,Object.setPrototypeOf(t.attribute,{})}))}getSubGraphic(){return this.subGraphic}onInit(t){this._onInit=t}onUpdate(t){this._onUpdate=t}isValid(){return!0}setAttribute(t,e,i,r){super.setAttribute(t,e,i,r),this.subGraphic.forEach((t=>{t.addUpdateShapeAndBoundsTag(),t.addUpdatePositionTag()}))}setAttributes(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=arguments.length>2?arguments[2]:void 0;super.setAttributes(t,e,i),this.subGraphic.forEach((t=>{t.addUpdateShapeAndBoundsTag(),t.addUpdatePositionTag()}))}translate(t,e){return super.translate(t,e),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}translateTo(t,e){return super.translateTo(t,e),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}scale(t,e,i){return super.scale(t,e,i),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}scaleTo(t,e){return super.scaleTo(t,e),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}rotate(t){return super.rotate(t),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}rotateTo(t){return super.rotate(t),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}doUpdateAABBBounds(){this._AABBBounds.setValue(1/0,1/0,-1/0,-1/0);const t=kr.graphicService.updateGlyphAABBBounds(this.attribute,Cn(this).glyph,this._AABBBounds,this);return this.clearUpdateBoundTag(),t}tryUpdateOBBBounds(){throw new Error("暂不支持")}needUpdateTags(t){return!1}needUpdateTag(t){return!1}useStates(t,e){var i;if(!t.length)return void this.clearStates(e);if((null===(i=this.currentStates)||void 0===i?void 0:i.length)===t.length&&!t.some(((t,e)=>this.currentStates[e]!==t)))return;const r={},n=this.subGraphic.map((()=>({})));t.forEach((e=>{var i;const o=this.glyphStateProxy?this.glyphStateProxy(e,t):this.glyphStates[e];o&&(Object.assign(r,o.attributes),(null===(i=o.subAttributes)||void 0===i?void 0:i.length)&&n.forEach(((t,e)=>{Object.assign(t,o.subAttributes[e])})))})),this.subGraphic.forEach(((i,r)=>{i.updateNormalAttrs(n[r]),i.applyStateAttrs(n[r],t,e)})),this.updateNormalAttrs(r),this.currentStates=t,this.applyStateAttrs(r,t,e)}clearStates(t){this.hasState()&&this.normalAttrs&&(this.subGraphic.forEach((e=>{e.applyStateAttrs(e.normalAttrs,this.currentStates,t,!0),e.normalAttrs=null})),this.applyStateAttrs(this.normalAttrs,this.currentStates,t,!0),this.normalAttrs=null,this.currentStates=[])}clone(){const t=new Cl(Object.assign({},this.attribute));return t.setSubGraphic(this.subGraphic.map((t=>t.clone()))),t}getNoWorkAnimateAttr(){return Cl.NOWORK_ANIMATE_ATTR}}function vl(t){return new Cl(t)}Cl.NOWORK_ANIMATE_ATTR=wo;class wl{constructor(t,e,i,r,n,o,s,a,l,h,c,d,u,g){this.left=t,this.top=e,this.width=i,this.height=r,this.actualHeight=0,this.bottom=e+r,this.right=t+i,this.ellipsis=n,this.wordBreak=o,this.verticalDirection=s,this.lines=[],this.globalAlign=a,this.globalBaseline=l,this.layoutDirection=h,this.directionKey=Ir[this.layoutDirection],this.isWidthMax=c,this.isHeightMax=d,this.singleLine=u,g?(g.clear(),this.icons=g):this.icons=new Map}draw(t,e){const{width:i,height:r}=this.getActualSize(),n=this.isWidthMax?Math.min(this.width,i):this.width||i||0;let o=this.isHeightMax?Math.min(this.height,r):this.height||r||0;o=Math.min(o,r);let s=0;switch(this.globalBaseline){case"top":s=0;break;case"middle":s=-o/2;break;case"bottom":s=-o}let a=0;switch(this.globalAlign){case"left":a=0;break;case"center":a=-n/2;break;case"right":a=-n}let l=this[this.directionKey.height];this.singleLine&&(l=this.lines[0].height+1);let h=!1;if("middle"===this.verticalDirection)if(this.actualHeight>=l&&0!==l)for(let i=0;i<this.lines.length;i++){const{top:r,height:n}=this.lines[i];if(r+n<this[this.directionKey.top]||r+n>this[this.directionKey.top]+l)return h;let o=!1;this.ellipsis&&this.lines[i+1]&&this.lines[i+1].top+this.lines[i+1].height>this[this.directionKey.top]+l&&(o=!0,h=!0),this.lines[i].draw(t,o,this.lines[i][this.directionKey.left]+a,this.lines[i][this.directionKey.top]+s,e)}else{const i=Math.floor((l-this.actualHeight)/2);"vertical"===this.layoutDirection?a+=i:s+=i;for(let i=0;i<this.lines.length;i++)this.lines[i].draw(t,!1,this.lines[i][this.directionKey.left]+a,this.lines[i][this.directionKey.top]+s,e)}else if("bottom"===this.verticalDirection&&"vertical"!==this.layoutDirection)for(let i=0;i<this.lines.length;i++){const{top:r,height:n}=this.lines[i],o=l-this.lines[i].top-this.lines[i].height;if(0===l)this.lines[i].draw(t,!1,a,o+s,e);else{if(o+n>this[this.directionKey.top]+l||o<this[this.directionKey.top])return h;{let r=!1;this.ellipsis&&this.lines[i+1]&&o-this.lines[i+1].height<this[this.directionKey.top]&&(r=!0,h=!0),this.lines[i].draw(t,r,a,o+s,e)}}}else{"bottom"===this.verticalDirection&&"vertical"===this.layoutDirection&&this.singleLine&&this.isWidthMax&&(a+=this.lines[0].height+1);for(let i=0;i<this.lines.length;i++){"bottom"===this.verticalDirection&&"vertical"===this.layoutDirection&&(a-=this.lines[i].height+this.lines[i].top);const{top:r,height:n}=this.lines[i];if(0===l)this.lines[i].draw(t,!1,this.lines[i][this.directionKey.left]+a,this.lines[i][this.directionKey.top]+s,e);else{if(r+n<this[this.directionKey.top]||r+n>this[this.directionKey.top]+l)return h;{let r=!1;this.ellipsis&&this.lines[i+1]&&this.lines[i+1].top+this.lines[i+1].height>this[this.directionKey.top]+l&&(r=!0,h=!0),this.lines[i].draw(t,r,this.lines[i][this.directionKey.left]+a,this.lines[i][this.directionKey.top]+s,e)}}}}return h}getActualSize(){return this.ellipsis?this.getActualSizeWidthEllipsis():this.getRawActualSize()}getRawActualSize(){let t=0,e=0;for(let i=0;i<this.lines.length;i++){const r=this.lines[i];r.actualWidth>t&&(t=r.actualWidth),e+=r.height}return{width:"vertical"===this.layoutDirection?e:t,height:"vertical"===this.layoutDirection?t:e}}getActualSizeWidthEllipsis(){let t=0,e=0;const{width:i,height:r}=this.getRawActualSize();this.width,this.height;let n=this[this.directionKey.height];if(this.singleLine&&(n=this.lines[0].height+1),"middle"===this.verticalDirection)if(this.actualHeight>=n&&0!==n)for(let i=0;i<this.lines.length;i++){const{top:r,height:o}=this.lines[i];if(r+o<this[this.directionKey.top]||r+o>this[this.directionKey.top]+n);else if(this.ellipsis&&this.lines[i+1]&&this.lines[i+1].top+this.lines[i+1].height>this[this.directionKey.top]+n){const r=this.lines[i].getWidthWithEllips();r>t&&(t=r),e+=this.lines[i].height}else this.lines[i].actualWidth>t&&(t=this.lines[i].actualWidth),e+=this.lines[i].height}else{Math.floor((n-this.actualHeight)/2);for(let i=0;i<this.lines.length;i++)this.lines[i].actualWidth>t&&(t=this.lines[i].actualWidth),e+=this.lines[i].height}else if("bottom"===this.verticalDirection)for(let i=0;i<this.lines.length;i++){const{top:r,height:o}=this.lines[i],s=n-this.lines[i].top-this.lines[i].height;if(0===n)this.lines[i].actualWidth>t&&(t=this.lines[i].actualWidth),e+=this.lines[i].height;else if(s+o>this[this.directionKey.top]+n||s<this[this.directionKey.top]);else if(this.ellipsis&&this.lines[i+1]&&s-this.lines[i+1].height<this[this.directionKey.top]){const r=this.lines[i].getWidthWithEllips();r>t&&(t=r),e+=this.lines[i].height}else this.lines[i].actualWidth>t&&(t=this.lines[i].actualWidth),e+=this.lines[i].height}else for(let i=0;i<this.lines.length;i++){const{top:r,height:o}=this.lines[i];if(0===n)this.lines[i].actualWidth>t&&(t=this.lines[i].actualWidth),e+=this.lines[i].height;else if(r+o<this[this.directionKey.top]||r+o>this[this.directionKey.top]+n);else if(this.ellipsis&&this.lines[i+1]&&this.lines[i+1].top+this.lines[i+1].height>this[this.directionKey.top]+n){const r=this.lines[i].getWidthWithEllips();r>t&&(t=r),e+=this.lines[i].height}else this.lines[i].actualWidth>t&&(t=this.lines[i].actualWidth),e+=this.lines[i].height}return{width:"vertical"===this.layoutDirection?e:t,height:"vertical"===this.layoutDirection?t:e}}}class xl{constructor(t,e,i){this.fontSize=i.fontSize||16,this.textBaseline=i.textBaseline||"alphabetic";const r=no(i.lineHeight,this.fontSize);this.lineHeight="number"==typeof r?r>this.fontSize?r:this.fontSize:Math.floor(1.2*this.fontSize),this.height=this.lineHeight;const{ascent:n,height:o,descent:s,width:a}=jr(t,i);let l=0,h=0,c=0;this.height>o&&(l=(this.height-o)/2,h=Math.ceil(l),c=Math.floor(l)),"top"===this.textBaseline?(this.ascent=l,this.descent=o-l):"bottom"===this.textBaseline?(this.ascent=o-l,this.descent=l):"middle"===this.textBaseline?(this.ascent=this.height/2,this.descent=this.height/2):(this.ascent=n+h,this.descent=s+c),this.length=t.length,this.width=a||0,this.text=t||"",this.newLine=e||!1,this.character=i,this.left=0,this.top=0,this.ellipsis="normal",this.ellipsisWidth=0,this.ellipsisOtherParagraphWidth=0,"vertical"===i.direction&&(this.direction=i.direction,this.widthOrigin=this.width,this.heightOrigin=this.height,this.width=this.heightOrigin,this.height=this.widthOrigin,this.lineHeight=this.height)}updateWidth(){const{width:t}=jr(this.text,this.character);this.width=t,"vertical"===this.direction&&(this.widthOrigin=this.width,this.width=this.heightOrigin,this.height=this.widthOrigin)}draw(t,e,i,r,n){let o=this.text,s=this.left+i;e+=this.top;let a=this.direction;if(this.verticalEllipsis)o="...",a="vertical",e-=this.ellipsisWidth/2;else{if("hide"===this.ellipsis)return;if("add"===this.ellipsis)o+="...","right"===n&&(s-=this.ellipsisWidth);else if("replace"===this.ellipsis){const t=Nr(o,("vertical"===a?this.height:this.width)-this.ellipsisWidth+this.ellipsisOtherParagraphWidth,this.character,o.length-1);if(o=o.slice(0,t),o+="...","right"===n){const{width:e}=jr(this.text.slice(t),this.character);"vertical"===a||(s-=this.ellipsisWidth-e)}}}switch(this.character.script){case"super":e-=this.ascent*(1/3);break;case"sub":e+=this.descent/2}"vertical"===a&&(t.save(),t.rotateAbout(Math.PI/2,s,e),t.translate(-this.heightOrigin||-this.lineHeight/2,-this.descent/2),t.translate(s,e),s=0,e=0),this.character.stroke&&(function(t,e){const i=e&&e.stroke||zr;if(!i)return void(t.globalAlpha=0);t.globalAlpha=1,t.lineWidth=e&&"number"==typeof e.lineHeight?e.lineHeight:1,t.strokeStyle=i;let r=e.fontSize||16;switch(e.script){case"super":case"sub":r*=.8}t.setTextStyle({textAlign:"left",textBaseline:e.textBaseline||"alphabetic",fontStyle:e.fontStyle||"",fontWeight:e.fontWeight||"",fontSize:r,fontFamily:e.fontFamily||"sans-serif"})}(t,this.character),t.strokeText(o,s,e)),function(t,e){const i=e&&e.fill||Fr;if(!i)return void(t.globalAlpha=0);t.globalAlpha=1,t.fillStyle=i;let r=e.fontSize||16;switch(e.script){case"super":case"sub":r*=.8}t.setTextStyle({textAlign:"left",textBaseline:e.textBaseline||"alphabetic",fontStyle:e.fontStyle||"",fontWeight:e.fontWeight||"",fontSize:r,fontFamily:e.fontFamily||"sans-serif"})}(t,this.character),this.character.fill&&t.fillText(o,s,e),this.character.fill&&("boolean"==typeof this.character.lineThrough||"boolean"==typeof this.character.underline?(this.character.underline&&t.fillRect(s,1+e,this.widthOrigin||this.width,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1),this.character.lineThrough&&t.fillRect(s,1+e-this.ascent/2,this.widthOrigin||this.width,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1)):"underline"===this.character.textDecoration?t.fillRect(s,1+e,this.widthOrigin||this.width,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1):"line-through"===this.character.textDecoration&&t.fillRect(s,1+e-this.ascent/2,this.widthOrigin||this.width,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1)),"vertical"===a&&t.restore()}getWidthWithEllips(t){let e=this.text;const i="vertical"===t?this.height:this.width;if("hide"===this.ellipsis)return i;if("add"===this.ellipsis)return i+this.ellipsisWidth;if("replace"===this.ellipsis){const t=Nr(e,i-this.ellipsisWidth+this.ellipsisOtherParagraphWidth,this.character,e.length-1);e=e.slice(0,t),e+="...";const{width:r}=jr(this.text.slice(t),this.character);return i+this.ellipsisWidth-r}return i}}const _l=["width","height","image",...mo];let Sl=class t extends xo{constructor(t){super(t),this.type="image",this.numberType=Xo,this.loadImage(this.attribute.image)}get width(){var t;return null!==(t=this.attribute.width)&&void 0!==t?t:0}set width(t){this.attribute.width===t&&(this.attribute.width=t,this.addUpdateShapeAndBoundsTag())}get height(){var t;return null!==(t=this.attribute.height)&&void 0!==t?t:0}set height(t){this.attribute.height===t&&(this.attribute.height=t,this.addUpdateShapeAndBoundsTag())}get repeatX(){var t;return null!==(t=this.attribute.repeatX)&&void 0!==t?t:"no-repeat"}set repeatX(t){this.attribute.repeatX===t&&(this.attribute.repeatX=t)}get repeatY(){var t;return null!==(t=this.attribute.repeatY)&&void 0!==t?t:"no-repeat"}set repeatY(t){this.attribute.repeatY===t&&(this.attribute.repeatY=t)}get image(){return this.attribute.image}set image(t){t!==this.attribute.image&&(this.attribute.image=t,this.loadImage(this.attribute.image))}imageLoadSuccess(t,e,i){super.imageLoadSuccess(t,e,(()=>{this.successCallback&&this.successCallback()}))}imageLoadFail(t,e){super.imageLoadFail(t,(()=>{this.failCallback&&this.failCallback()}))}doUpdateAABBBounds(){const t=Cn(this).image;this._AABBBounds.setValue(1/0,1/0,-1/0,-1/0);const e=this.attribute,i=kr.graphicService.updateImageAABBBounds(e,Cn(this).image,this._AABBBounds,this),{boundsPadding:r=t.boundsPadding}=e,n=Yn(r);return n&&i.expand(n),this.clearUpdateBoundTag(),i}tryUpdateOBBBounds(){throw new Error("暂不支持")}getDefaultAttribute(t){return Hr[t]}needUpdateTags(t){return super.needUpdateTags(t,_l)}needUpdateTag(t){return super.needUpdateTag(t,_l)}clone(){return new t(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return t.NOWORK_ANIMATE_ATTR}};function Al(t){return new Sl(t)}Sl.NOWORK_ANIMATE_ATTR=Object.assign({image:1,repeatX:1,repeatY:1},wo);class Bl extends Sl{constructor(t){if(super(t),this._x=0,this._y=0,this._hovered=!1,this._marginArray=[0,0,0,0],"always"===t.backgroundShowMode&&(this._hovered=!0),t.margin){const e=Yn(t.margin);this._marginArray="number"==typeof e?[e,e,e,e]:e}this.onBeforeAttributeUpdate=(t,e,i)=>{if(it(i)&&-1!==i.indexOf("margin")||"margin"===i)if(e.margin){const t=Yn(e.margin);this._marginArray="number"==typeof t?[t,t,t,t]:t}else this._marginArray=[0,0,0,0]}}get width(){var t;return(null!==(t=this.attribute.width)&&void 0!==t?t:0)+this._marginArray[1]+this._marginArray[3]}get height(){var t;return(null!==(t=this.attribute.height)&&void 0!==t?t:0)+this._marginArray[0]+this._marginArray[2]}tryUpdateAABBBounds(){if(!this.shouldUpdateAABBBounds())return this._AABBBounds;this.doUpdateAABBBounds();const{width:t=Hr.width,height:e=Hr.height}=this.attribute,{backgroundWidth:i=t,backgroundHeight:r=e}=this.attribute,n=(i-t)/2,o=(r-e)/2;return this._AABBBounds.expand([0,2*n,2*o,0]),this._AABBBounds}setHoverState(t){"hover"===this.attribute.backgroundShowMode&&this._hovered!==t&&(this._hovered=t)}}class Tl{constructor(t,e,i,r,n,o,s,a){this.left=t,this.width=e,this.baseline=i,this.ascent=r,this.descent=n,this.top=i-r,this.paragraphs=o.map((t=>t)),this.textAlign=(this.paragraphs[0]instanceof Bl?this.paragraphs[0].attribute.textAlign:this.paragraphs[0].character.textAlign)||"left",this.direction=s,this.directionKey=Ir[this.direction],this.actualWidth=0;let l=0;this.paragraphs.forEach(((t,e)=>{if(0===e&&t instanceof xl){const e=Wr.exec(t.text);0!==(null==e?void 0:e.index)&&(t.text=t.text.slice(null==e?void 0:e.index),t.updateWidth())}this.actualWidth+=t[this.directionKey.width],l=Math.max(t[this.directionKey.height],l)})),this.height=l,this.blankWidth=a?0:this.width-this.actualWidth,this.calcOffset(e,a)}calcOffset(t,e){const i=this.directionKey,r=this.height;let n=this.left,o=0;if(this.actualWidth<t&&!e)switch(this.textAlign){case"right":n=t-this.actualWidth;break;case"center":n=(t-this.actualWidth)/2;break;case"justify":this.paragraphs.length<2?n=(t-this.actualWidth)/2:o=(t-this.actualWidth)/(this.paragraphs.length-1)}this.paragraphs.map((function(t){t instanceof Bl?(t["_"+i.x]=n,n+=t[i.width]+o,t["_"+i.y]="top"===t.attribute.textBaseline?0:"bottom"===t.attribute.textBaseline?r-t.height:(r-t.height)/2):(t[i.left]=n,n+=t[i.width]+o)}))}draw(t,e,i,r,n){if(e){let t=0;for(let e=this.paragraphs.length-1;e>=0;e--){const i=this.paragraphs[e];if(i instanceof Bl)break;if("vertical"===this.direction&&"vertical"!==i.direction){i.verticalEllipsis=!0;break}const{width:r}=jr("...",i.character),n=r||0;if(n<=this.blankWidth+t){i.ellipsis="add";break}if(n<=this.blankWidth+t+i.width){i.ellipsis="replace",i.ellipsisWidth=n,i.ellipsisOtherParagraphWidth=this.blankWidth+t;break}i.ellipsis="hide",t+=i.width}}this.paragraphs.map(((e,o)=>{if(e instanceof Bl)return e.setAttributes({x:i+e._x,y:r+e._y}),void n(e,t,i+e._x,r+e._y,this.ascent);e.draw(t,r+this.ascent,i,0===o,this.textAlign)}))}getWidthWithEllips(){let t=0;for(let e=this.paragraphs.length-1;e>=0;e--){const i=this.paragraphs[e];if(i instanceof Bl)break;const{width:r}=jr("...",i.character),n=r||0;if(n<=this.blankWidth+t){i.ellipsis="add",i.ellipsisWidth=n;break}if(n<=this.blankWidth+t+i.width){i.ellipsis="replace",i.ellipsisWidth=n,i.ellipsisOtherParagraphWidth=this.blankWidth+t;break}i.ellipsis="hide",t+=i.width}let e=0;return this.paragraphs.map(((t,i)=>{e+=t instanceof Bl?t.width:t.getWidthWithEllips(this.direction)})),e}}class Ml{constructor(t){this.frame=t,this.width=this.frame.width,this.height=this.frame.height,this.lineWidth=0,this.y=this.frame.top,this.maxAscent=0,this.maxDescent=0,this.maxAscentForBlank=0,this.maxDescentForBlank=0,this.lineBuffer=[],this.direction=t.layoutDirection,this.directionKey=Ir[this.direction]}store(t){if(t instanceof Bl){this.frame.icons.set(t.richtextId,t),this.lineBuffer.push(t),this.lineWidth+=t[this.directionKey.width];let e=0,i=0;"top"===t.attribute.textBaseline?(e=0,i=t.height):"bottom"===t.attribute.textBaseline?(e=t.height,i=0):(e=t.height/2,i=t.height/2),this.maxAscent=Math.max(this.maxAscent,e),this.maxDescent=Math.max(this.maxDescent,i)}else this.lineBuffer.push(t),0!==t.text.length?(this.lineWidth+=t[this.directionKey.width],this.maxAscent=Math.max(this.maxAscent,t.ascent),this.maxDescent=Math.max(this.maxDescent,t.descent)):(this.maxAscentForBlank=Math.max(this.maxAscentForBlank,t.ascent),this.maxDescentForBlank=Math.max(this.maxDescentForBlank,t.descent))}send(){if(0===this.lineBuffer.length)return;const t=0===this.maxAscent?this.maxAscentForBlank:this.maxAscent,e=0===this.maxDescent?this.maxDescentForBlank:this.maxDescent,i=new Tl(this.frame.left,this[this.directionKey.width],this.y+t,t,e,this.lineBuffer,this.direction,"horizontal"===this.direction?this.frame.isWidthMax:this.frame.isHeightMax);this.frame.lines.push(i),this.frame.actualHeight+=i.height,this.y+=i.height,this.lineBuffer.length=0,this.lineWidth=this.maxAscent=this.maxDescent=this.maxAscentForBlank=this.maxDescentForBlank=0}deal(t){t instanceof Bl?"horizontal"===this.direction&&0===this.width||"vertical"===this.direction&&0===this.height||this.lineWidth+t[this.directionKey.width]<=this[this.directionKey.width]?this.store(t):0===this.lineBuffer.length?(this.store(t),this.send()):(this.send(),this.deal(t)):"number"!=typeof this.width||this.width<0||(t.newLine&&this.send(),0!==t.text.length&&("horizontal"===this.direction&&0===this.width||"vertical"===this.direction&&0===this.height||this.lineWidth+t[this.directionKey.width]<=this[this.directionKey.width]?this.store(t):this.lineWidth===this[this.directionKey.width]?(this.send(),this.deal(t)):this.cut(t)))}cut(t){const e=this[this.directionKey.width]-this.lineWidth||0,i=Math.ceil(e/t[this.directionKey.width]*t.length)||0,r=Nr(t.text,e,t.character,i,"break-word"===this.frame.wordBreak);if(0!==r){const[e,i]=function(t,e){const i=t.text.slice(0,e),r=t.text.slice(e);return[new xl(i,t.newLine,t.character),new xl(r,!0,t.character)]}(t,r);this.store(e),this.deal(i)}else 0!==this.lineBuffer.length&&(this.send(),this.deal(t))}}const Rl=["width","height","ellipsis","wordBreak","verticalDirection","maxHeight","maxWidth","textAlign","textBaseline","textConfig","layoutDirection",...mo];class Pl extends xo{constructor(t){super(t),this.type="richtext",this._currentHoverIcon=null,this.numberType=es}get width(){var t;return null!==(t=this.attribute.width)&&void 0!==t?t:Er.width}set width(t){this.attribute.width!==t&&(this.attribute.width=t,this.addUpdateShapeAndBoundsTag())}get height(){var t;return null!==(t=this.attribute.height)&&void 0!==t?t:Er.height}set height(t){this.attribute.height!==t&&(this.attribute.height=t,this.addUpdateShapeAndBoundsTag())}get maxWidth(){return this.attribute.maxWidth}set maxWidth(t){this.attribute.maxWidth!==t&&(this.attribute.maxWidth=t,this.addUpdateShapeAndBoundsTag())}get maxHeight(){return this.attribute.maxHeight}set maxHeight(t){this.attribute.maxHeight!==t&&(this.attribute.maxHeight=t,this.addUpdateShapeAndBoundsTag())}get ellipsis(){var t;return null!==(t=this.attribute.ellipsis)&&void 0!==t?t:Er.ellipsis}set ellipsis(t){this.attribute.ellipsis!==t&&(this.attribute.ellipsis=t,this.addUpdateShapeAndBoundsTag())}get wordBreak(){var t;return null!==(t=this.attribute.wordBreak)&&void 0!==t?t:Er.wordBreak}set wordBreak(t){this.attribute.wordBreak!==t&&(this.attribute.wordBreak=t,this.addUpdateShapeAndBoundsTag())}get verticalDirection(){var t;return null!==(t=this.attribute.verticalDirection)&&void 0!==t?t:Er.verticalDirection}set verticalDirection(t){this.attribute.verticalDirection!==t&&(this.attribute.verticalDirection=t,this.addUpdateShapeAndBoundsTag())}get textAlign(){var t;return null!==(t=this.attribute.textAlign)&&void 0!==t?t:Er.textAlign}set textAlign(t){this.attribute.textAlign!==t&&(this.attribute.textAlign=t,this.addUpdateShapeAndBoundsTag())}get textBaseline(){var t;return null!==(t=this.attribute.textBaseline)&&void 0!==t?t:Er.textBaseline}set textBaseline(t){this.attribute.textBaseline!==t&&(this.attribute.textBaseline=t,this.addUpdateShapeAndBoundsTag())}get textConfig(){var t;return null!==(t=this.attribute.textConfig)&&void 0!==t?t:Er.textConfig}set textConfig(t){this.attribute.textConfig=t,this.addUpdateShapeAndBoundsTag()}doUpdateAABBBounds(){const t=Cn(this).richtext;this._AABBBounds.setValue(1/0,1/0,-1/0,-1/0);const e=this.attribute,i=kr.graphicService.updateRichTextAABBBounds(e,Cn(this).richtext,this._AABBBounds,this),{boundsPadding:r=t.boundsPadding}=e,n=Yn(r);return n&&i.expand(n),this.clearUpdateBoundTag(),i}tryUpdateOBBBounds(){throw new Error("暂不支持")}getDefaultAttribute(t){return Er[t]}needUpdateTags(t){return super.needUpdateTags(t,Rl)}needUpdateTag(t){return super.needUpdateTag(t,Rl)}getFrameCache(){return this.shouldUpdateShape()&&(this.doUpdateFrameCache(),this.clearUpdateShapeTag()),this._frameCache}doUpdateFrameCache(){var t;const{textConfig:e=[],maxWidth:i,maxHeight:r,width:n,height:o,ellipsis:s,wordBreak:a,verticalDirection:l,textAlign:h,textBaseline:c,layoutDirection:d,singleLine:u}=this.attribute,g=[];for(let t=0;t<e.length;t++)if("image"in e[t]){const i=e[t],r=i.id&&this._frameCache&&this._frameCache.icons&&this._frameCache.icons.get(i.id);if(r)g.push(r);else{const t=new Bl(i);t.successCallback=()=>{var t;this.addUpdateBoundTag(),null===(t=this.stage)||void 0===t||t.renderNextFrame()},t.richtextId=i.id,g.push(t)}}else if(e[t].text.includes("\n")){const i=e[t].text.split("\n");for(let r=0;r<i.length;r++)g.push(new xl(i[r],0!==r,e[t]))}else g.push(new xl(e[t].text,!1,e[t]));const p="number"==typeof i&&Number.isFinite(i)&&i>0,f="number"==typeof r&&Number.isFinite(r)&&r>0,m="number"==typeof n&&Number.isFinite(n)&&n>0&&(!p||n<=i),b="number"==typeof o&&Number.isFinite(o)&&o>0&&(!f||o<=r),y=new wl(0,0,(m?n:p?i:0)||0,(b?o:f?r:0)||0,s,a,l,h,c,d||"horizontal",!m&&p,!b&&f,u||!1,null===(t=this._frameCache)||void 0===t?void 0:t.icons),C=new Ml(y);for(let t=0;t<g.length;t++)C.deal(g[t]);if(C.send(),!("horizontal"===y.layoutDirection?m:b)){const t=y.getActualSizeWidthEllipsis();let e="horizontal"===y.layoutDirection?t.width:t.height;("horizontal"===y.layoutDirection?p:f)&&(e=Math.min(e,"horizontal"===y.layoutDirection?i:r)),y.lines.forEach((function(t){t.calcOffset(e,!1)}))}this._frameCache=y}clone(){return new Pl(Object.assign({},this.attribute))}setStage(t,e){super.setStage(t,e),this.getFrameCache().icons.forEach((i=>{i.setStage(t,e)}))}bindIconEvent(){this.addEventListener("pointermove",(t=>{var e,i,r,n,o;const s=this.pickIcon(t.global);s&&s===this._currentHoverIcon||(s?(null===(e=this._currentHoverIcon)||void 0===e||e.setHoverState(!1),this._currentHoverIcon=s,this._currentHoverIcon.setHoverState(!0),null===(i=this.stage)||void 0===i||i.setCursor(s.attribute.cursor),null===(r=this.stage)||void 0===r||r.renderNextFrame()):!s&&this._currentHoverIcon&&(this._currentHoverIcon.setHoverState(!1),this._currentHoverIcon=null,null===(n=this.stage)||void 0===n||n.setCursor(),null===(o=this.stage)||void 0===o||o.renderNextFrame()))})),this.addEventListener("pointerleave",(t=>{var e,i;this._currentHoverIcon&&(this._currentHoverIcon.setHoverState(!1),this._currentHoverIcon=null,null===(e=this.stage)||void 0===e||e.setCursor(),null===(i=this.stage)||void 0===i||i.renderNextFrame())}))}pickIcon(t){const e=this.getFrameCache(),{e:i,f:r}=this.globalTransMatrix;let n;return e.icons.forEach((e=>{var o,s;e.AABBBounds.containsPoint({x:t.x-i,y:t.y-r})&&(n=e,n.globalX=(null!==(o=n.attribute.x)&&void 0!==o?o:0)+i,n.globalY=(null!==(s=n.attribute.y)&&void 0!==s?s:0)+r)})),n}getNoWorkAnimateAttr(){return Pl.NOWORK_ANIMATE_ATTR}}function El(t){return new Pl(t)}Pl.NOWORK_ANIMATE_ATTR=Object.assign({ellipsis:1,wordBreak:1,verticalDirection:1,textAlign:1,textBaseline:1,textConfig:1,layoutDirection:1},wo);const Hl=["path","customPath",...mo];class Ll extends xo{constructor(t){super(t),this.type="path",this.numberType=qo}get pathShape(){return this.tryUpdateAABBBounds(),this.getParsedPathShape()}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{path:t}=this.attribute;return null!=t&&""!==t}getParsedPathShape(){const t=Cn(this).path;if(!this.valid)return t.path;const e=this.attribute;return e.path instanceof lr?e.path:(X(this.cache)&&this.doUpdatePathShape(),this.cache instanceof lr?this.cache:t.path)}doUpdateAABBBounds(){const t=Cn(this).path;this.doUpdatePathShape(),this._AABBBounds.setValue(1/0,1/0,-1/0,-1/0);const e=this.attribute,i=kr.graphicService.updatePathAABBBounds(e,Cn(this).path,this._AABBBounds,this),{boundsPadding:r=t.boundsPadding}=e,n=Yn(r);return n&&i.expand(n),this.clearUpdateBoundTag(),i}doUpdatePathShape(){const t=this.attribute;et(t.path,!0)?this.cache=(new lr).fromString(t.path):t.customPath&&(this.cache=new lr,t.customPath(this.cache,this))}tryUpdateOBBBounds(){throw new Error("暂不支持")}getDefaultAttribute(t){return Cn(this).path[t]}needUpdateTags(t){return super.needUpdateTags(t,Hl)}needUpdateTag(t){return super.needUpdateTag(t,Hl)}toCustomPath(){return(new lr).fromCustomPath2D(this.getParsedPathShape(),0,0)}clone(){return new Ll(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return Ll.NOWORK_ANIMATE_ATTR}}function kl(t){return new Ll(t)}Ll.NOWORK_ANIMATE_ATTR=Object.assign({path:1,customPath:1},wo);const Il=["segments","points","curveType",...mo];class Fl extends xo{constructor(t){super(t),this.type="area",this.numberType=Uo}isValid(){return super.isValid()&&this._isValid()}_isValid(){if(this.pathProxy)return!0;const{points:t,segments:e}=this.attribute;return e?0!==e.length:!!t&&0!==t.length}doUpdateAABBBounds(){const t=Cn(this).area;this._AABBBounds.setValue(1/0,1/0,-1/0,-1/0);const e=this.attribute,i=kr.graphicService.updateAreaAABBBounds(e,Cn(this).area,this._AABBBounds,this),{boundsPadding:r=t.boundsPadding}=e,n=Yn(r);return n&&i.expand(n),this.clearUpdateBoundTag(),i}tryUpdateOBBBounds(){throw new Error("暂不支持")}_interpolate(t,e,i,r,n){"points"===t&&(n.points=to(i,r,e))}getDefaultAttribute(t){return Cn(this).area[t]}needUpdateTags(t){return super.needUpdateTags(t,Il)}needUpdateTag(t){return super.needUpdateTag(t,Il)}toCustomPath(){const t=new lr,e=this.attribute,i=e.segments,r=e=>{if(e&&e.length){let i=!0;const r=[];if(e.forEach((e=>{var n,o;!1!==e.defined&&(i?t.moveTo(e.x,e.y):t.lineTo(e.x,e.y),r.push({x:null!==(n=e.x1)&&void 0!==n?n:e.x,y:null!==(o=e.y1)&&void 0!==o?o:e.y}),i=!1)})),r.length){for(let e=r.length-1;e>=0;e--)t.lineTo(r[e].x,r[e].y);t.closePath()}}};return e.points?r(e.points):i&&i.length&&i.forEach((t=>{r(t.points)})),t}clone(){return new Fl(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return Fl.NOWORK_ANIMATE_ATTR}}function zl(t){return new Fl(t)}Fl.NOWORK_ANIMATE_ATTR=Object.assign({segments:1,curveType:1},wo);const Ol=["innerRadius","outerRadius","startAngle","endAngle","cornerRadius","padAngle","padRadius","cap",...mo];let Dl=class t extends xo{constructor(t){super(t),this.type="arc",this.numberType=Go}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{startAngle:t,endAngle:e,outerRadius:i,innerRadius:r}=this.attribute;return this._validNumber(t)&&this._validNumber(e)&&this._validNumber(i)&&this._validNumber(r)}getParsedCornerRadius(){const t=Cn(this).arc,{cornerRadius:e=t.cornerRadius,outerRadius:i=t.outerRadius,innerRadius:r=t.innerRadius}=this.attribute;if(0===e||"0%"===e)return 0;const n=Math.abs(i-r);return Math.min(ot(e,!0)?e:n*parseFloat(e)/100,n/2)}getParsedAngle(){const t=Cn(this).arc;let{startAngle:e=t.startAngle,endAngle:i=t.endAngle}=this.attribute;const{cap:r=t.cap}=this.attribute,n=i-e>=0?1:-1,o=i-e;if(e=fe(e),i=e+o,r&&Jt(o)<Zt-$t){let o=1,s=1;r.length&&(o=Number(r[0]),s=Number(r[1]));const{outerRadius:a=t.outerRadius,innerRadius:l=t.innerRadius}=this.attribute,h=Math.abs(a-l)/2,c=h/a;if(h>$t&&a>$t)return{startAngle:e-n*c*o,endAngle:i+n*c*s,sc:n*c*o,ec:n*c*s}}return{startAngle:e,endAngle:i}}getParsePadAngle(t,e){const i=Cn(this).arc,{outerRadius:r=i.outerRadius,innerRadius:n=i.innerRadius,padAngle:o=i.padAngle}=this.attribute,{padRadius:s=ne(r*r+n*n)}=this.attribute,a=Jt(e-t);let l=t,h=e,c=t,d=e;const u=o/2;let g=a,p=a;if(u>$t&&s>$t){const i=e>t?1:-1;let o=ae(Number(s)/n*re(u)),a=ae(Number(s)/r*re(u));return(g-=2*o)>$t?(o*=i,c+=o,d-=o):(g=0,c=d=(t+e)/2),(p-=2*a)>$t?(a*=i,l+=a,h-=a):(p=0,l=h=(t+e)/2),{outerStartAngle:l,outerEndAngle:h,innerStartAngle:c,innerEndAngle:d,innerDeltaAngle:g,outerDeltaAngle:p}}return{outerStartAngle:l,outerEndAngle:h,innerStartAngle:c,innerEndAngle:d,innerDeltaAngle:g,outerDeltaAngle:p}}doUpdateAABBBounds(t){const e=Cn(this).arc;this._AABBBounds.setValue(1/0,1/0,-1/0,-1/0);const i=this.attribute,r=kr.graphicService.updateArcAABBBounds(i,Cn(this).arc,this._AABBBounds,t,this),{boundsPadding:n=e.boundsPadding}=i,o=Yn(n);return o&&r.expand(o),this.clearUpdateBoundTag(),r}tryUpdateOBBBounds(){throw new Error("暂不支持")}needUpdateTags(t){return super.needUpdateTags(t,Ol)}needUpdateTag(t){return super.needUpdateTag(t,Ol)}getDefaultAttribute(t){return Cn(this).arc[t]}toCustomPath(){const t=this.attribute,{startAngle:e,endAngle:i}=this.getParsedAngle();let r=t.innerRadius,n=t.outerRadius;const o=Jt(i-e),s=i>e;if(n<r){const t=n;n=r,r=t}const a=new lr;if(n<=$t)a.moveTo(0,0);else if(o>=Zt-$t)a.moveTo(0+n*te(e),0+n*re(e)),a.arc(0,0,n,e,i,!s),r>$t&&(a.moveTo(0+r*te(i),0+r*re(i)),a.arc(0,0,r,i,e,s));else{const t=n*te(e),o=n*re(e),l=r*te(i),h=r*re(i);a.moveTo(0+t,0+o),a.arc(0,0,n,e,i,!s),a.lineTo(0+l,0+h),a.arc(0,0,r,i,e,s),a.closePath()}return a}clone(){return new t(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return t.NOWORK_ANIMATE_ATTR}};function Wl(t){return new Dl(t)}Dl.NOWORK_ANIMATE_ATTR=Object.assign({cap:1},wo);class Nl extends Dl{constructor(t){super(t),this.type="arc3d",this.numberType=jo}doUpdateAABBBounds(){const t=Cn(this).arc;this._AABBBounds.setValue(1/0,1/0,-1/0,-1/0);const e=this.attribute,i=kr.graphicService.updateArc3dAABBBounds(e,Cn(this).polygon,this._AABBBounds,this),{boundsPadding:r=t.boundsPadding}=e,n=Yn(r);return n&&i.expand(n),this.clearUpdateBoundTag(),this._AABBBounds}getNoWorkAnimateAttr(){return Nl.NOWORK_ANIMATE_ATTR}}function Gl(t){return new Nl(t)}Nl.NOWORK_ANIMATE_ATTR=Object.assign({cap:1},wo);const jl=["points","cornerRadius",...mo];class Ul extends xo{constructor(t){super(t),this.type="polygon",this.numberType=Zo}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{points:t}=this.attribute;return t&&t.length>=2}doUpdateAABBBounds(){const t=Cn(this).polygon;this._AABBBounds.setValue(1/0,1/0,-1/0,-1/0);const e=this.attribute,i=kr.graphicService.updatePolygonAABBBounds(e,Cn(this).polygon,this._AABBBounds,this),{boundsPadding:r=t.boundsPadding}=e,n=Yn(r);return n&&i.expand(n),this.clearUpdateBoundTag(),this._AABBBounds}tryUpdateOBBBounds(){throw new Error("暂不支持")}_interpolate(t,e,i,r,n){"points"===t&&(n.points=to(i,r,e))}getDefaultAttribute(t){return Cn(this).polygon[t]}needUpdateTags(t){return super.needUpdateTags(t,jl)}needUpdateTag(t){return super.needUpdateTag(t,jl)}toCustomPath(){const t=this.attribute.points,e=new lr;return t.forEach(((t,i)=>{0===i?e.moveTo(t.x,t.y):e.lineTo(t.x,t.y)})),e.closePath(),e}clone(){return new Ul(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return Ul.NOWORK_ANIMATE_ATTR}}function Vl(t){return new Ul(t)}Ul.NOWORK_ANIMATE_ATTR=wo;class Kl extends Ul{constructor(t){super(t),this.type="pyramid3d",this.numberType=Jo}doUpdateAABBBounds(){const t=Cn(this).polygon;this._AABBBounds.setValue(1/0,1/0,-1/0,-1/0);const e=this.attribute,i=kr.graphicService.updatePyramid3dAABBBounds(e,Cn(this).polygon,this._AABBBounds,this),{boundsPadding:r=t.boundsPadding}=e,n=Yn(r);return n&&i.expand(n),this.clearUpdateBoundTag(),this._AABBBounds}findFace(){const{points:t}=this.attribute,e=t.map(((e,i)=>{const r=3===i?t[0]:t[i+1],n=e.x-r.x;return 0===n?0:(e.y-r.y)/n})),i=t.map((t=>({p:t,d:0})));let r=!1,n=0;for(let t=0;t<e.length-1;t++){for(let o=t+1;o<e.length;o++){if(e[t]===e[o]){r=!0;const e=ce.distancePP(i[t].p,i[t+1].p);i[t].d=e,i[t+1].d=e,n=ee(n,e);const s=ce.distancePP(i[o].p,i[o+1].p);i[o].d=s,i[o+1].d=s,n=ee(n,s)}if(r)break}if(r)break}for(let e=t.length-1;e>=0;e--){const r=t[e];i.unshift({p:r,d:0})}for(let e=0;e<t.length;e++){const r=(n-i[e+t.length].d)/2;i[e].d+=r,i[e+t.length].d+=r}const o={polygons:[],vertices:[],edges:[]};return i.forEach((t=>{o.vertices.push([t.p.x,t.p.y,t.d])})),o.polygons.push({polygon:[0,4,5,1],normal:[0,-1,0]}),o.polygons.push({polygon:[7,6,2,3],normal:[0,1,0]}),o.polygons.push({polygon:[0,4,7,3],normal:[-1,0,0]}),o.polygons.push({polygon:[1,5,6,2],normal:[1,0,0]}),o.polygons.push({polygon:[0,1,2,3],normal:[0,0,-1]}),o.polygons.push({polygon:[4,5,6,7],normal:[0,0,1]}),o.edges=[[0,1],[1,2],[2,3],[3,0],[4,5],[5,6],[6,7],[7,4],[0,4],[3,7],[1,5],[2,6]],o}_isValid(){return super._isValid()&&4===this.attribute.points.length}getNoWorkAnimateAttr(){return Kl.NOWORK_ANIMATE_ATTR}}function $l(t){return new Kl(t)}Kl.NOWORK_ANIMATE_ATTR=wo;class Xl extends hs{constructor(t){super({x:0,y:0}),this.type="shadowroot",this.shadowHost=t}addUpdateBoundTag(){super.addUpdateBoundTag(),this.shadowHost&&this.shadowHost.addUpdateBoundTag()}addUpdateShapeAndBoundsTag(){super.addUpdateShapeAndBoundsTag(),this.shadowHost&&this.shadowHost.addUpdateBoundTag()}tryUpdateGlobalTransMatrix(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];if(this.shouldUpdateGlobalMatrix()){const e=this.transMatrix;this._globalTransMatrix?this._globalTransMatrix.setValue(e.a,e.b,e.c,e.d,e.e,e.f):this._globalTransMatrix=e.clone(),this.doUpdateGlobalMatrix(),t&&this.clearUpdateGlobalPositionTag()}return this._globalTransMatrix}doUpdateGlobalMatrix(){if(this.shadowHost){const t=this.shadowHost.globalTransMatrix;this._globalTransMatrix.multiply(t.a,t.b,t.c,t.d,t.e,t.f)}}tryUpdateGlobalAABBBounds(){return this._globalAABBBounds?this._globalAABBBounds.setValue(this._AABBBounds.x1,this._AABBBounds.y1,this._AABBBounds.x2,this._AABBBounds.y2):this._globalAABBBounds=this._AABBBounds.clone(),this.shadowHost&&this._globalAABBBounds.transformWithMatrix(this.shadowHost.globalTransMatrix),this._globalAABBBounds}}function Yl(t){return new Xl(t)}class ql{updateBounds(t,e,i,r){const{outerBorder:n,shadowBlur:o=e.shadowBlur}=t;if(n){const t=e.outerBorder,{distance:r=t.distance,lineWidth:s=t.lineWidth}=n;i.expand(r+(o+s)/2)}return i}}class Zl extends ql{updateBounds(t,e,i,r){const{outerBorder:n,shadowBlur:o=e.shadowBlur,strokeBoundsBuffer:s=e.strokeBoundsBuffer}=t;if(n){const t=e.outerBorder,{distance:r=t.distance,lineWidth:a=t.lineWidth}=n;ko(i,r+(o+a)/2,!0,s)}return i}}class Jl{constructor(){this.pools=[]}static identity(t){return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=1,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}allocate(){if(!this.pools.length)return[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1];const t=this.pools.pop();return Jl.identity(t),t}allocateByObj(t){let e;e=this.pools.length?this.pools.pop():[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1];for(let i=0;i<e.length;i++)e[i]=t[i];return e}free(t){t&&this.pools.push(t)}get length(){return this.pools.length}release(){this.pools=[]}}const Ql=new class{constructor(){this.pools=[]}allocate(t,e,i,r,n,o){if(!this.pools.length)return new me(t,e,i,r,n,o);const s=this.pools.pop();return s.a=t,s.b=e,s.c=i,s.d=r,s.e=n,s.f=o,s}allocateByObj(t){if(!this.pools.length)return new me(t.a,t.b,t.c,t.d,t.e,t.f);const e=this.pools.pop();return e.a=t.a,e.b=t.b,e.c=t.c,e.d=t.d,e.e=t.e,e.f=t.f,e}free(t){this.pools.push(t)}get length(){return this.pools.length}release(){this.pools=[]}},th=new Jl;var eh=function(t,e,i,r){var n,o=arguments.length,s=o<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,i,r);else for(var a=t.length-1;a>=0;a--)(n=t[a])&&(s=(o<3?n(s):o>3?n(e,i,s):n(e,i))||s);return o>3&&s&&Object.defineProperty(e,i,s),s},ih=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},rh=function(t,e){return function(i,r){e(i,r,t)}};function nh(t,e,i){const r=i[0],n=i[1],o=i[2];let s,a,l,h,c,d,u,g,p,f,m,b;return e===t?(t[12]=e[0]*r+e[4]*n+e[8]*o+e[12],t[13]=e[1]*r+e[5]*n+e[9]*o+e[13],t[14]=e[2]*r+e[6]*n+e[10]*o+e[14],t[15]=e[3]*r+e[7]*n+e[11]*o+e[15]):(s=e[0],a=e[1],l=e[2],h=e[3],c=e[4],d=e[5],u=e[6],g=e[7],p=e[8],f=e[9],m=e[10],b=e[11],t[0]=s,t[1]=a,t[2]=l,t[3]=h,t[4]=c,t[5]=d,t[6]=u,t[7]=g,t[8]=p,t[9]=f,t[10]=m,t[11]=b,t[12]=s*r+c*n+p*o+e[12],t[13]=a*r+d*n+f*o+e[13],t[14]=l*r+u*n+m*o+e[14],t[15]=h*r+g*n+b*o+e[15]),t}function oh(t,e){t[0]=e.a,t[1]=e.b,t[2]=0,t[3]=0,t[4]=e.c,t[5]=e.d,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=e.e,t[13]=e.f,t[14]=0,t[15]=1}function sh(t,e,i){const r=e[0],n=e[1],o=e[2],s=e[3],a=e[4],l=e[5],h=e[6],c=e[7],d=e[8],u=e[9],g=e[10],p=e[11],f=e[12],m=e[13],b=e[14],y=e[15];let C=i[0],v=i[1],w=i[2],x=i[3];return t[0]=C*r+v*a+w*d+x*f,t[1]=C*n+v*l+w*u+x*m,t[2]=C*o+v*h+w*g+x*b,t[3]=C*s+v*c+w*p+x*y,C=i[4],v=i[5],w=i[6],x=i[7],t[4]=C*r+v*a+w*d+x*f,t[5]=C*n+v*l+w*u+x*m,t[6]=C*o+v*h+w*g+x*b,t[7]=C*s+v*c+w*p+x*y,C=i[8],v=i[9],w=i[10],x=i[11],t[8]=C*r+v*a+w*d+x*f,t[9]=C*n+v*l+w*u+x*m,t[10]=C*o+v*h+w*g+x*b,t[11]=C*s+v*c+w*p+x*y,C=i[12],v=i[13],w=i[14],x=i[15],t[12]=C*r+v*a+w*d+x*f,t[13]=C*n+v*l+w*u+x*m,t[14]=C*o+v*h+w*g+x*b,t[15]=C*s+v*c+w*p+x*y,t}function ah(t,e,i){var r;const{x:n=i.x,y:o=i.y,z:s=i.z,dx:a=i.dx,dy:l=i.dy,dz:h=i.dz,scaleX:c=i.scaleX,scaleY:d=i.scaleY,scaleZ:u=i.scaleZ,alpha:g=i.alpha,beta:p=i.beta,angle:f=i.angle,anchor3d:m=e.attribute.anchor,anchor:b}=e.attribute,y=[0,0,0];if(m){if("string"==typeof m[0]){const t=parseFloat(m[0])/100,i=e.AABBBounds;y[0]=i.x1+(i.x2-i.x1)*t}else y[0]=m[0];if("string"==typeof m[1]){const t=parseFloat(m[1])/100,i=e.AABBBounds;y[1]=i.x1+(i.x2-i.x1)*t}else y[1]=m[1];y[2]=null!==(r=m[2])&&void 0!==r?r:0}if(function(t){t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=1,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1}(t),nh(t,t,[n+a,o+l,s+h]),nh(t,t,[y[0],y[1],y[2]]),function(t,e,i){const r=Math.sin(i),n=Math.cos(i),o=e[4],s=e[5],a=e[6],l=e[7],h=e[8],c=e[9],d=e[10],u=e[11];e!==t&&(t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[4]=o*n+h*r,t[5]=s*n+c*r,t[6]=a*n+d*r,t[7]=l*n+u*r,t[8]=h*n-o*r,t[9]=c*n-s*r,t[10]=d*n-a*r,t[11]=u*n-l*r}(t,t,p),function(t,e,i){const r=Math.sin(i),n=Math.cos(i),o=e[0],s=e[1],a=e[2],l=e[3],h=e[8],c=e[9],d=e[10],u=e[11];e!==t&&(t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[0]=o*n-h*r,t[1]=s*n-c*r,t[2]=a*n-d*r,t[3]=l*n-u*r,t[8]=o*r+h*n,t[9]=s*r+c*n,t[10]=a*r+d*n,t[11]=l*r+u*n}(t,t,g),nh(t,t,[-y[0],-y[1],y[2]]),function(t,e,i){const r=i[0],n=i[1],o=i[2];t[0]=e[0]*r,t[1]=e[1]*r,t[2]=e[2]*r,t[3]=e[3]*r,t[4]=e[4]*n,t[5]=e[5]*n,t[6]=e[6]*n,t[7]=e[7]*n,t[8]=e[8]*o,t[9]=e[9]*o,t[10]=e[10]*o,t[11]=e[11]*o,t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]}(t,t,[c,d,u]),f){const i=th.allocate(),r=[0,0];if(b){if("string"==typeof m[0]){const t=parseFloat(m[0])/100,i=e.AABBBounds;r[0]=i.x1+(i.x2-i.x1)*t}else r[0]=m[0];if("string"==typeof m[1]){const t=parseFloat(m[1])/100,i=e.AABBBounds;r[1]=i.x1+(i.x2-i.x1)*t}else r[1]=m[1]}nh(i,i,[r[0],r[1],0]),function(t,e,i){const r=Math.sin(i),n=Math.cos(i),o=e[0],s=e[1],a=e[2],l=e[3],h=e[4],c=e[5],d=e[6],u=e[7];e!==t&&(t[8]=e[8],t[9]=e[9],t[10]=e[10],t[11]=e[11],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[0]=o*n+h*r,t[1]=s*n+c*r,t[2]=a*n+d*r,t[3]=l*n+u*r,t[4]=h*n-o*r,t[5]=c*n-s*r,t[6]=d*n-a*r,t[7]=u*n-l*r}(i,i,f),nh(i,i,[-r[0],-r[1],0]),sh(t,t,i)}}let lh=class{constructor(t){this.creator=t,this.hooks={onAttributeUpdate:new I(["graphic"]),onSetStage:new I(["graphic","stage"]),onRemove:new I(["graphic"]),onRelease:new I(["graphic"]),onAddIncremental:new I(["graphic","group","stage"]),onClearIncremental:new I(["graphic","group","stage"]),beforeUpdateAABBBounds:new I(["graphic","stage","willUpdate","aabbBounds"]),afterUpdateAABBBounds:new I(["graphic","stage","aabbBounds","globalAABBBounds","selfChange"])},this.tempAABBBounds1=new ge,this.tempAABBBounds2=new ge,this._rectBoundsContribitions=[new ql],this._symbolBoundsContribitions=[new Zl],this._circleBoundsContribitions=[new ql],this._arcBoundsContribitions=[new ql],this._pathBoundsContribitions=[new ql]}onAttributeUpdate(t){this.hooks.onAttributeUpdate.taps.length&&this.hooks.onAttributeUpdate.call(t)}onSetStage(t,e){this.hooks.onSetStage.taps.length&&this.hooks.onSetStage.call(t,e)}onRemove(t){this.hooks.onRemove.taps.length&&this.hooks.onRemove.call(t)}onRelease(t){this.hooks.onRelease.taps.length&&this.hooks.onRelease.call(t)}onAddIncremental(t,e,i){this.hooks.onAddIncremental.taps.length&&this.hooks.onAddIncremental.call(t,e,i)}onClearIncremental(t,e){this.hooks.onClearIncremental.taps.length&&this.hooks.onClearIncremental.call(t,e)}beforeUpdateAABBBounds(t,e,i,r){this.hooks.beforeUpdateAABBBounds.taps.length&&this.hooks.beforeUpdateAABBBounds.call(t,e,i,r)}afterUpdateAABBBounds(t,e,i,r,n){this.hooks.afterUpdateAABBBounds.taps.length&&this.hooks.afterUpdateAABBBounds.call(t,e,i,r,n)}updatePathProxyAABBBounds(t,e){const i="function"==typeof e.pathProxy?e.pathProxy(e.attribute):e.pathProxy;if(!i)return!1;const r=new ti(t);return Ei(i.commandList,r,0,0),!0}updateRectAABBBounds(t,e,i,r){if(!this._validCheck(t,e,i,r))return i;if(!this.updatePathProxyAABBBounds(i,r)){let{width:e,height:r}=t;const{x1:n,y1:o,x:s,y:a}=t;e=null!=e?e:n-s,r=null!=r?r:o-a,i.set(0,0,e||0,r||0)}const n=this.tempAABBBounds1,o=this.tempAABBBounds2;return n.setValue(i.x1,i.y1,i.x2,i.y2),o.setValue(i.x1,i.y1,i.x2,i.y2),this._rectBoundsContribitions.length&&this._rectBoundsContribitions.forEach((s=>{s.updateBounds(t,e,n,r),i.union(n),n.setValue(o.x1,o.y1,o.x2,o.y2)})),this.transformAABBBounds(t,i,e,!1,r),i}updateGroupAABBBounds(t,e,i,r){const{width:n,height:o,path:s,clip:a=e.clip}=t;s&&s.length?s.forEach((t=>{i.union(t.AABBBounds)})):null!=n&&null!=o&&i.set(0,0,n,o),a||r.forEachChildren((t=>{i.union(t.AABBBounds)}));const l=this.tempAABBBounds1,h=this.tempAABBBounds2;return l.setValue(i.x1,i.y1,i.x2,i.y2),h.setValue(i.x1,i.y1,i.x2,i.y2),this.transformAABBBounds(t,i,e,!1,r),i}updateGlyphAABBBounds(t,e,i,r){return this._validCheck(t,e,i,r)?(r.getSubGraphic().forEach((t=>{i.union(t.AABBBounds)})),i):i}updateRichTextAABBBounds(t,e,i,r){if(!this._validCheck(t,e,i,r))return i;if(!r)return i;const{width:n=e.width,height:o=e.height,maxWidth:s=e.maxWidth,maxHeight:a=e.maxHeight,textAlign:l=e.textAlign,textBaseline:h=e.textBaseline}=t;if(n>0&&o>0)i.set(0,0,n,o);else{const t=r.getFrameCache(),{width:e,height:l}=t.getActualSize();let h=n||e||0,c=o||l||0;c="number"==typeof a&&c>a?a:c||0,h="number"==typeof s&&h>s?s:h||0,i.set(0,0,h,c)}let c=0;switch(h){case"top":c=0;break;case"middle":c=-i.height()/2;break;case"bottom":c=-i.height()}let d=0;switch(l){case"left":d=0;break;case"center":d=-i.width()/2;break;case"right":d=-i.width()}i.translate(d,c);const u=this.tempAABBBounds1,g=this.tempAABBBounds2;return u.setValue(i.x1,i.y1,i.x2,i.y2),g.setValue(i.x1,i.y1,i.x2,i.y2),this.transformAABBBounds(t,i,e,!1,r),i}updateTextAABBBounds(t,e,i,r){if(!this._validCheck(t,e,i,r))return i;if(!r)return i;const{text:n=e.text}=r.attribute;Array.isArray(n)?r.updateMultilineAABBBounds(n):r.updateSingallineAABBBounds(n);const o=this.tempAABBBounds1,s=this.tempAABBBounds2;o.setValue(i.x1,i.y1,i.x2,i.y2),s.setValue(i.x1,i.y1,i.x2,i.y2);const{scaleX:a=e.scaleX,scaleY:l=e.scaleY,shadowBlur:h=e.shadowBlur,strokeBoundsBuffer:c=e.strokeBoundsBuffer}=t;if(h){ko(o,h/Math.abs(a+l),!0,c),i.union(o)}return this.combindShadowAABBBounds(i,r),de(i,i,r.transMatrix),i}updatePathAABBBounds(t,e,i,r){if(!this._validCheck(t,e,i,r))return i;this.updatePathProxyAABBBounds(i,r)||this.updatePathAABBBoundsImprecise(t,e,i,r);const n=this.tempAABBBounds1,o=this.tempAABBBounds2;n.setValue(i.x1,i.y1,i.x2,i.y2),o.setValue(i.x1,i.y1,i.x2,i.y2),this._pathBoundsContribitions.length&&this._pathBoundsContribitions.forEach((s=>{s.updateBounds(t,e,n,r),i.union(n),n.setValue(o.x1,o.y1,o.x2,o.y2)}));const{lineJoin:s=e.lineJoin}=t;return this.transformAABBBounds(t,i,e,"miter"===s,r),i}updatePathAABBBoundsImprecise(t,e,i,r){if(!r)return i;const n=r.getParsedPathShape();return i.union(n.getBounds()),i}updatePyramid3dAABBBounds(t,e,i,r){if(!r)return i;const n=r.stage;if(!n||!n.camera)return i;r.findFace().vertices.forEach((t=>{const e=t[0],r=t[1];i.add(e,r)}));const o=this.tempAABBBounds1,s=this.tempAABBBounds2;return o.setValue(i.x1,i.y1,i.x2,i.y2),s.setValue(i.x1,i.y1,i.x2,i.y2),this.transformAABBBounds(t,i,e,!1,r),i}updateArc3dAABBBounds(t,e,i,r){if(!r)return i;const n=r.stage;if(!n||!n.camera)return i;const{outerRadius:o=e.outerRadius,height:s=0}=t,a=o+s;i.setValue(-a,-a,a,a);const l=this.tempAABBBounds1,h=this.tempAABBBounds2;return l.setValue(i.x1,i.y1,i.x2,i.y2),h.setValue(i.x1,i.y1,i.x2,i.y2),this.transformAABBBounds(t,i,e,!1,r),i}updatePolygonAABBBounds(t,e,i,r){if(!this._validCheck(t,e,i,r))return i;this.updatePathProxyAABBBounds(i,r)||this.updatePolygonAABBBoundsImprecise(t,e,i,r);const n=this.tempAABBBounds1,o=this.tempAABBBounds2;n.setValue(i.x1,i.y1,i.x2,i.y2),o.setValue(i.x1,i.y1,i.x2,i.y2);const{lineJoin:s=e.lineJoin}=t;return this.transformAABBBounds(t,i,e,"miter"===s,r),i}updatePolygonAABBBoundsImprecise(t,e,i,r){const{points:n=e.points}=t;return n.forEach((t=>{i.add(t.x,t.y)})),i}updateLineAABBBounds(t,e,i,r){if(!this._validCheck(t,e,i,r))return i;this.updatePathProxyAABBBounds(i,r)||(t.segments?this.updateLineAABBBoundsBySegments(t,e,i,r):this.updateLineAABBBoundsByPoints(t,e,i,r));const n=this.tempAABBBounds1,o=this.tempAABBBounds2;n.setValue(i.x1,i.y1,i.x2,i.y2),o.setValue(i.x1,i.y1,i.x2,i.y2);const{lineJoin:s=e.lineJoin}=t;return this.transformAABBBounds(t,i,e,"miter"===s,r),i}updateLineAABBBoundsByPoints(t,e,i,r){const{points:n=e.points}=t,o=i;return n.forEach((t=>{o.add(t.x,t.y)})),o}updateLineAABBBoundsBySegments(t,e,i,r){const{segments:n=e.segments}=t,o=i;return n.forEach((t=>{t.points.forEach((t=>{o.add(t.x,t.y)}))})),o}updateAreaAABBBounds(t,e,i,r){if(!this._validCheck(t,e,i,r))return i;this.updatePathProxyAABBBounds(i,r)||(t.segments?this.updateAreaAABBBoundsBySegments(t,e,i,r):this.updateAreaAABBBoundsByPoints(t,e,i,r));const n=this.tempAABBBounds1,o=this.tempAABBBounds2;n.setValue(i.x1,i.y1,i.x2,i.y2),o.setValue(i.x1,i.y1,i.x2,i.y2);const{lineJoin:s=e.lineJoin}=t;return this.transformAABBBounds(t,i,e,"miter"===s,r),i}updateAreaAABBBoundsByPoints(t,e,i,r){const{points:n=e.points}=t,o=i;return n.forEach((t=>{var e,i;o.add(t.x,t.y),o.add(null!==(e=t.x1)&&void 0!==e?e:t.x,null!==(i=t.y1)&&void 0!==i?i:t.y)})),o}updateAreaAABBBoundsBySegments(t,e,i,r){const{segments:n=e.segments}=t,o=i;return n.forEach((t=>{t.points.forEach((t=>{var e,i;o.add(t.x,t.y),o.add(null!==(e=t.x1)&&void 0!==e?e:t.x,null!==(i=t.y1)&&void 0!==i?i:t.y)}))})),o}updateCircleAABBBounds(t,e,i,r,n){if(!this._validCheck(t,e,i,n))return i;this.updatePathProxyAABBBounds(i,n)||(r?this.updateCircleAABBBoundsImprecise(t,e,i,n):this.updateCircleAABBBoundsAccurate(t,e,i,n));const o=this.tempAABBBounds1,s=this.tempAABBBounds2;return o.setValue(i.x1,i.y1,i.x2,i.y2),s.setValue(i.x1,i.y1,i.x2,i.y2),this._circleBoundsContribitions.length&&this._circleBoundsContribitions.forEach((r=>{r.updateBounds(t,e,o,n),i.union(o),o.setValue(s.x1,s.y1,s.x2,s.y2)})),this.transformAABBBounds(t,i,e,!1,n),i}updateCircleAABBBoundsImprecise(t,e,i,r){const{radius:n=e.radius}=t;return i.set(-n,-n,n,n),i}updateCircleAABBBoundsAccurate(t,e,i,r){const{startAngle:n=e.startAngle,endAngle:o=e.endAngle,radius:s=e.radius}=t;return o-n>Zt-$t?i.set(-s,-s,s,s):Jn(n,o,s,i),i}updateArcAABBBounds(t,e,i,r,n){if(!this._validCheck(t,e,i,n))return i;this.updatePathProxyAABBBounds(i,n)||(r?this.updateArcAABBBoundsImprecise(t,e,i,n):this.updateArcAABBBoundsAccurate(t,e,i,n));const o=this.tempAABBBounds1,s=this.tempAABBBounds2;o.setValue(i.x1,i.y1,i.x2,i.y2),s.setValue(i.x1,i.y1,i.x2,i.y2),this._arcBoundsContribitions.length&&this._arcBoundsContribitions.forEach((r=>{r.updateBounds(t,e,o,n),i.union(o),o.setValue(s.x1,s.y1,s.x2,s.y2)}));const{lineJoin:a=e.lineJoin}=t;return this.transformAABBBounds(t,i,e,"miter"===a,n),i}updateArcAABBBoundsImprecise(t,e,i,r){const{innerRadius:n=e.innerRadius}=t;let{outerRadius:o=e.outerRadius}=t;return o<n&&(o=n),i.set(-o,-o,o,o),i}updateArcAABBBoundsAccurate(t,e,i,r){let{outerRadius:n=e.outerRadius,innerRadius:o=e.innerRadius}=t;if(n<o){const t=n;n=o,o=t}let{endAngle:s=e.endAngle,startAngle:a=e.startAngle}=t;if(a>s){const t=a;a=s,s=t}return n<=$t?i.set(0,0,0,0):Math.abs(s-a)>Zt-$t?i.set(-n,-n,n,n):(Jn(a,s,n,i),Jn(a,s,o,i)),i}updateSymbolAABBBounds(t,e,i,r,n){if(!this._validCheck(t,e,i,n))return i;this.updatePathProxyAABBBounds(i,n)||(r?this.updateSymbolAABBBoundsImprecise(t,e,i,n):this.updateSymbolAABBBoundsAccurate(t,e,i,n));const o=this.tempAABBBounds1,s=this.tempAABBBounds2;o.setValue(i.x1,i.y1,i.x2,i.y2),s.setValue(i.x1,i.y1,i.x2,i.y2),this._symbolBoundsContribitions.length&&this._symbolBoundsContribitions.forEach((r=>{r.updateBounds(t,e,o,n),i.union(o),o.setValue(s.x1,s.y1,s.x2,s.y2)}));const{lineJoin:a=e.lineJoin}=t;return this.transformAABBBounds(t,i,e,"miter"===a,n),i}updateSymbolAABBBoundsImprecise(t,e,i,r){const{size:n=e.size}=t;if(it(n))i.set(-n[0]/2,-n[1]/2,n[0]/2,n[1]/2);else{const t=n/2;i.set(-t,-t,t,t)}return i}updateSymbolAABBBoundsAccurate(t,e,i,r){if(!r)return i;const{size:n=e.size}=t;return r.getParsedPath().bounds(n,i),i}updateImageAABBBounds(t,e,i,r){if(!this._validCheck(t,e,i,r))return i;if(!this.updatePathProxyAABBBounds(i,r)){const{width:r=e.width,height:n=e.height}=t;i.set(0,0,r,n)}const n=this.tempAABBBounds1,o=this.tempAABBBounds2;return n.setValue(i.x1,i.y1,i.x2,i.y2),o.setValue(i.x1,i.y1,i.x2,i.y2),this.transformAABBBounds(t,i,e,!1,r),i}combindShadowAABBBounds(t,e){if(e&&e.shadowRoot){const i=e.shadowRoot.AABBBounds;t.union(i)}}transformAABBBounds(t,e,i,r,n){const{scaleX:o=i.scaleX,scaleY:s=i.scaleY,stroke:a=i.stroke,shadowBlur:l=i.shadowBlur,lineWidth:h=i.lineWidth,pickStrokeBuffer:c=i.pickStrokeBuffer,strokeBoundsBuffer:d=i.strokeBoundsBuffer}=t,u=this.tempAABBBounds1,g=this.tempAABBBounds2;if(a&&h){ko(u,(h+c)/Math.abs(o+s),r,d),e.union(u),u.setValue(g.x1,g.y1,g.x2,g.y2)}if(l){const{shadowOffsetX:r=i.shadowOffsetX,shadowOffsetY:n=i.shadowOffsetY}=t;ko(u,l/Math.abs(o+s)*2,!1,d+1),u.translate(r,n),e.union(u)}this.combindShadowAABBBounds(e,n);let p=!0;const f=n.transMatrix;n&&n.isContainer&&(p=!(1===f.a&&0===f.b&&0===f.c&&1===f.d&&0===f.e&&0===f.f)),p&&de(e,e,f)}_validCheck(t,e,i,r){if(!r)return!0;if(!r.valid)return i.clear(),!1;const{visible:n=e.visible}=t;return!!n||(i.clear(),!1)}};lh=eh([f(),rh(0,g(os)),ih("design:paramtypes",[Object])],lh);const hh=new class{constructor(){this.store=new Map}RegisterGraphicCreator(t,e){this.store.set(t,e),this[t]=e}CreateGraphic(t,e){const i=this.store.get(t);return i?i(e):null}};let ch;function dh(t){return ch||(ch=hh.CreateGraphic("text",{})),ch.setAttributes(t),ch.AABBBounds}const uh={x:0,y:0,z:0,lastModelMatrix:null};class gh{init(t){t&&(this._renderContribitions=t.getContributions()),this._renderContribitions||(this._renderContribitions=[]),this.builtinContributions&&this.builtinContributions.forEach((t=>this._renderContribitions.push(t))),this._renderContribitions.length&&(this._renderContribitions.sort(((t,e)=>e.order-t.order)),this._beforeRenderContribitions=this._renderContribitions.filter((t=>t.time===Ti.beforeFillStroke)),this._afterRenderContribitions=this._renderContribitions.filter((t=>t.time===Ti.afterFillStroke)))}beforeRenderStep(t,e,i,r,n,o,s,a,l,h,c,d,u){this._beforeRenderContribitions&&this._beforeRenderContribitions.forEach((g=>{g.drawShape(t,e,i,r,n,o,s,a,l,h,c,d,u)}))}afterRenderStep(t,e,i,r,n,o,s,a,l,h,c,d,u){this._afterRenderContribitions&&this._afterRenderContribitions.forEach((g=>{g.drawShape(t,e,i,r,n,o,s,a,l,h,c,d,u)}))}valid(t,e,i,r){const{fill:n=e.fill,background:o,stroke:s=e.stroke,opacity:a=e.opacity,fillOpacity:l=e.fillOpacity,lineWidth:h=e.lineWidth,strokeOpacity:c=e.strokeOpacity,visible:d=e.visible}=t.attribute,u=As(a,l,n),g=Ts(a,c),p=_s(n,o),f=Ss(s,h);return!(!t.valid||!d)&&!(!p&&!f)&&!!(u||g||i||r||o)&&{fVisible:u,sVisible:g,doFill:p,doStroke:f}}transform(t,e,i){let r=arguments.length>3&&void 0!==arguments[3]&&arguments[3];const{x:n=e.x,y:o=e.y,z:s=e.z,scaleX:a=e.scaleX,scaleY:l=e.scaleY,angle:h=e.angle,postMatrix:c}=t.attribute,d=i.modelMatrix,u=i.camera;uh.x=n,uh.y=o,uh.z=s,uh.lastModelMatrix=d;const g=u&&(r||function(t){const{alpha:e,beta:i}=t.attribute;return e||i}(t)),p=g?t.transMatrix.onlyTranslate()&&!c:1===a&&1===l&&0===h&&!c;if(g){const r=th.allocate(),n=th.allocate();ah(n,t,e),sh(r,d||r,n),uh.x=0,uh.y=0,uh.z=0,i.modelMatrix=r,i.setTransform(1,0,0,1,0,0,!0),th.free(n)}if(p&&!d){const r=t.getOffsetXY(e);uh.x+=r.x,uh.y+=r.y,uh.z=s,i.setTransformForCurrent()}else if(g)uh.x=0,uh.y=0,uh.z=0,i.setTransform(1,0,0,1,0,0,!0);else if(u&&i.project){const r=t.getOffsetXY(e);uh.x+=r.x,uh.y+=r.y,this.transformWithoutTranslate(i,uh.x,uh.y,uh.z,a,l,h)}else i.transformFromMatrix(t.transMatrix,!0),uh.x=0,uh.y=0,uh.z=0;return uh}transformUseContext2d(t,e,i,r){const n=r.camera;if(this.camera=n,n){const e=t.AABBBounds,n=e.x2-e.x1,o=e.y2-e.y1,s=r.project(0,0,i),a=r.project(n,0,i),l=r.project(n,o,i),h={x:0,y:0},c={x:n,y:0},d={x:n,y:o};r.camera=null;const u=1/(h.x*(d.y-c.y)-c.x*d.y+d.x*c.y+(c.x-d.x)*h.y),g=-(h.y*(l.x-a.x)-c.y*l.x+d.y*a.x+(c.y-d.y)*s.x)*u,p=(c.y*l.y+h.y*(a.y-l.y)-d.y*a.y+(d.y-c.y)*s.y)*u,f=(h.x*(l.x-a.x)-c.x*l.x+d.x*a.x+(c.x-d.x)*s.x)*u,m=-(c.x*l.y+h.x*(a.y-l.y)-d.x*a.y+(d.x-c.x)*s.y)*u,b=(h.x*(d.y*a.x-c.y*l.x)+h.y*(c.x*l.x-d.x*a.x)+(d.x*c.y-c.x*d.y)*s.x)*u,y=(h.x*(d.y*a.y-c.y*l.y)+h.y*(c.x*l.y-d.x*a.y)+(d.x*c.y-c.x*d.y)*s.y)*u;r.setTransform(g,p,f,m,b,y,!0)}}restoreTransformUseContext2d(t,e,i,r){this.camera&&(r.camera=this.camera)}transformWithoutTranslate(t,e,i,r,n,o,s){const a=t.project(e,i,r);t.translate(a.x,a.y,!1),t.scale(n,o,!1),t.rotate(s,!1),t.translate(-a.x,-a.y,!1),t.setTransformForCurrent()}_draw(t,e,i,r,n){const{context:o}=r;if(!o)return;o.highPerformanceSave();const s=this.transform(t,e,o,i),{x:a,y:l,z:h,lastModelMatrix:c}=s;this.z=h,function(t,e,i,r,n,o,s,a){if(!t.pathProxy)return!1;const l=Cn(t,null==o?void 0:o.theme)[t.type],{fill:h=l.fill,stroke:c=l.stroke,opacity:d=l.opacity,fillOpacity:u=l.fillOpacity,lineWidth:g=l.lineWidth,strokeOpacity:p=l.strokeOpacity,visible:f=l.visible}=t.attribute,m=As(d,u,h),b=Ts(d,p),y=_s(h),C=Ss(c,g);return!f||(!y&&!C||(!(m||b||s||a)||(e.beginPath(),Ei(("function"==typeof t.pathProxy?t.pathProxy(t.attribute):t.pathProxy).commandList,e,i,r),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),C&&(a?a(e,t.attribute,l):b&&(e.setStrokeStyle(t,t.attribute,i,r,l),e.stroke())),y&&(s?s(e,t.attribute,l):m&&(e.setCommonStyle(t,t.attribute,i,r,l),e.fill())),!0)))}(t,o,a,l,0,n)||(this.drawShape(t,o,a,l,r,n),this.z=0,o.modelMatrix!==c&&th.free(o.modelMatrix),o.modelMatrix=c),o.highPerformanceRestore()}}function ph(t,e,i){let r=e;const{a:n,b:o,c:s,d:a}=t.currentMatrix,l=Math.sign(n)*Math.sqrt(n*n+o*o),h=Math.sign(a)*Math.sqrt(s*s+a*a);return l+h===0?0:(r=r/Math.abs(l+h)*2*i,r)}function fh(t,e,i,r,n){if(!e||!0===e)return"black";let o,s;if(it(e))for(let t=0;t<e.length&&(s=e[t],!s);t++);else s=e;return"string"==typeof s?s:("linear"===s.gradient?o=function(t,e,i){let r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,n=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0;var o,s,a,l;const h=i.AABBBounds;if(!h)return;let c=h.x2-h.x1,d=h.y2-h.y1,u=h.x1-r,g=h.y1-n;if(i.attribute){const{scaleX:t=1,scaleY:e=1}=i.attribute;if(t*e==0)return;c/=t,d/=e,u/=t,g/=e}const p=t.createLinearGradient(u+(null!==(o=e.x0)&&void 0!==o?o:0)*c,g+(null!==(s=e.y0)&&void 0!==s?s:0)*d,u+(null!==(a=e.x1)&&void 0!==a?a:1)*c,g+(null!==(l=e.y1)&&void 0!==l?l:0)*d);return e.stops.forEach((t=>{p.addColorStop(t.offset,t.color)})),p}(t,s,i,r,n):"conical"===s.gradient?o=function(t,e,i){let r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,n=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0;var o,s;const a=i.AABBBounds;if(!a)return;let l=a.x2-a.x1,h=a.y2-a.y1,c=a.x1-r,d=a.y1-n;if(i.attribute){const{scaleX:t=1,scaleY:e=1}=i.attribute;if(t*e==0)return;l/=t,h/=e,c/=t,d/=e}const u=t.createConicGradient(c+(null!==(o=e.x)&&void 0!==o?o:0)*l,d+(null!==(s=e.y)&&void 0!==s?s:0)*h,e.startAngle,e.endAngle);return e.stops.forEach((t=>{u.addColorStop(t.offset,t.color)})),u.GetPattern(l+c,h+d,void 0)}(t,s,i,r,n):"radial"===s.gradient&&(o=function(t,e,i){let r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,n=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0;var o,s,a,l,h,c;const d=i.AABBBounds;if(!d)return;let u=d.x2-d.x1,g=d.y2-d.y1,p=d.x1-r,f=d.y1-n;if(i.attribute){const{scaleX:t=1,scaleY:e=1}=i.attribute;if(t*e==0)return;p/=t,f/=e,u/=t,g/=e}const m=t.createRadialGradient(p+(null!==(o=e.x0)&&void 0!==o?o:.5)*u,f+(null!==(s=e.y0)&&void 0!==s?s:.5)*g,Math.max(u,g)*(null!==(a=e.r0)&&void 0!==a?a:0),p+(null!==(l=e.x1)&&void 0!==l?l:.5)*u,f+(null!==(h=e.y1)&&void 0!==h?h:.5)*g,Math.max(u,g)*(null!==(c=e.r1)&&void 0!==c?c:.5));return e.stops.forEach((t=>{m.addColorStop(t.offset,t.color)})),m}(t,s,i,r,n)),o||"orange")}var mh=function(t,e,i,r){var n,o=arguments.length,s=o<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,i,r);else for(var a=t.length-1;a>=0;a--)(n=t[a])&&(s=(o<3?n(s):o>3?n(e,i,s):n(e,i))||s);return o>3&&s&&Object.defineProperty(e,i,s),s},bh=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},yh=function(t,e){return function(i,r){e(i,r,t)}};class Ch{constructor(){this.time=Ti.beforeFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,r,n,o,s,a,l,h,c,d,u){const{background:g,backgroundMode:p=l.backgroundMode,backgroundFit:f=l.backgroundFit}=t.attribute;if(g)if(t.backgroundImg&&t.resources){const n=t.resources.get(g);if("success"!==n.state||!n.data)return;if(e.save(),t.parent&&!t.transMatrix.onlyTranslate()){const i=Cn(t.parent).group,{scrollX:r=i.scrollX,scrollY:n=i.scrollY}=t.parent.attribute;e.setTransformFromMatrix(t.parent.globalTransMatrix,!0),e.translate(r,n)}e.clip();const o=t.AABBBounds;e.setCommonStyle(t,t.attribute,i,r,l),this.doDrawImage(e,n.data,o,p,f),e.restore(),t.transMatrix.onlyTranslate()||e.setTransformForCurrent()}else e.highPerformanceSave(),e.setCommonStyle(t,t.attribute,i,r,l),e.fillStyle=g,e.fill(),e.highPerformanceRestore()}doDrawImage(t,e,i,r,n){if("no-repeat"===r)t.drawImage(e,i.x1,i.y1,i.width(),i.height());else{const o=i.width(),s=i.height();let a=o,l=s;if(n&&"repeat"!==r&&(e.width||e.height)){const i=e.width,n=e.height;"repeat-x"===r?a=i*(s/n):"repeat-y"===r&&(l=n*(o/i));const h=Qr.allocate({width:a,height:l,dpr:t.dpr}),c=h.getContext("2d");c&&(c.inuse=!0,c.clearMatrix(),c.setTransformForCurrent(!0),c.clearRect(0,0,a,l),c.drawImage(e,0,0,a,l),e=h.nativeCanvas),document.body.appendChild(e),Qr.free(h)}const h=t.createPattern(e,r);t.fillStyle=h,t.translate(i.x1,i.y1),t.fillRect(0,0,o,s),t.translate(-i.x1,-i.y1)}}}const vh=new Ch;let wh=class{constructor(t){this.subRenderContribitions=t,this.time=Ti.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,r,n,o,s,a,l,h,c,d,u){this._subRenderContribitions||(this._subRenderContribitions=this.subRenderContribitions.getContributions()),this._subRenderContribitions.forEach((g=>{g.render(t,e,i,r,n,o,s,a,l,h,c,d,u)}))}};wh=mh([f(),yh(0,g(E)),yh(0,m(Vs)),bh("design:paramtypes",[Object])],wh);class xh{constructor(){this.time=Ti.afterFillStroke,this.useStyle=!0,this.order=10}createCommonPattern(t,e,i,r,n){const o=(t-2*e)/2,s=r.dpr,a=Qr.allocate({width:t,height:t,dpr:s}),l=a.getContext("2d");if(!l)return null;l.inuse=!0,l.clearMatrix(),l.setTransformForCurrent(!0),l.clearRect(0,0,t,t),n(o,l);const h=r.createPattern(a.nativeCanvas,"repeat");return h.setTransform&&h.setTransform(new DOMMatrix([1/s,0,0,1/s,0,0])),Qr.free(a),h}createCirclePattern(t,e,i,r){return this.createCommonPattern(t,e,i,r,((t,e)=>{e.fillStyle=i,e.arc(t,t,t,0,Zt),e.fill()}))}createDiamondPattern(t,e,i,r){return this.createCommonPattern(t,e,i,r,((e,r)=>{const n=t/2,o=n;r.fillStyle=i,r.moveTo(n,o-e),r.lineTo(e+n,o),r.lineTo(n,o+e),r.lineTo(n-e,o),r.closePath(),r.fill()}))}createRectPattern(t,e,i,r){return this.createCommonPattern(t,e,i,r,((t,r)=>{const n=e,o=n;r.fillStyle=i,r.fillRect(n,o,2*t,2*t)}))}createVerticalLinePattern(t,e,i,r){return this.createCommonPattern(t,e,i,r,((r,n)=>{const o=e;n.fillStyle=i,n.fillRect(o,0,2*r,t)}))}createHorizontalLinePattern(t,e,i,r){return this.createCommonPattern(t,e,i,r,((r,n)=>{const o=e;n.fillStyle=i,n.fillRect(0,o,t,2*r)}))}createBiasLRLinePattern(t,e,i,r){return this.createCommonPattern(t,e,i,r,((e,r)=>{r.strokeStyle=i,r.lineWidth=e,r.moveTo(0,0),r.lineTo(t,t);const n=t/2,o=-n;r.moveTo(n,o),r.lineTo(n+t,o+t),r.moveTo(-n,-o),r.lineTo(-n+t,-o+t),r.stroke()}))}createBiasRLLinePattern(t,e,i,r){return this.createCommonPattern(t,e,i,r,((e,r)=>{r.strokeStyle=i,r.lineWidth=e,r.moveTo(t,0),r.lineTo(0,t);const n=t/2,o=n;r.moveTo(t+n,o),r.lineTo(n,o+t),r.moveTo(t-n,-o),r.lineTo(-n,-o+t),r.stroke()}))}createGridPattern(t,e,i,r){return this.createCommonPattern(t,e,i,r,((t,r)=>{const n=e,o=n;r.fillStyle=i,r.fillRect(n,o,t,t),r.fillRect(n+t,o+t,t,t)}))}initTextureMap(t,e){this.textureMap=new Map}drawShape(t,e,i,r,n,o,s,a,l,h,c,d,u){this.textureMap||this.initTextureMap(e,t.stage);const{texture:g=l.texture,textureColor:p=l.textureColor,textureSize:f=l.textureSize,texturePadding:m=l.texturePadding}=t.attribute;g&&this.drawTexture(g,t,e,i,r,l,p,f,m)}drawTexture(t,e,i,r,n,o,s,a,l){let h=this.textureMap.get(t);if(!h)switch(t){case"circle":h=this.createCirclePattern(a,l,s,i);break;case"diamond":h=this.createDiamondPattern(a,l,s,i);break;case"rect":h=this.createRectPattern(a,l,s,i);break;case"vertical-line":h=this.createVerticalLinePattern(a,l,s,i);break;case"horizontal-line":h=this.createHorizontalLinePattern(a,l,s,i);break;case"bias-lr":h=this.createBiasLRLinePattern(a,l,s,i);break;case"bias-rl":h=this.createBiasRLLinePattern(a,l,s,i);break;case"grid":h=this.createGridPattern(a,l,s,i)}h&&(i.highPerformanceSave(),i.setCommonStyle(e,e.attribute,r,n,o),i.fillStyle=h,i.fill(),i.highPerformanceRestore())}}const _h=new xh;const Sh=new class{constructor(){this.time=Ti.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,r,n,o,s,a,l,h,c,d){const{outerBorder:u,innerBorder:g}=t.attribute,p=u&&!1!==u.visible,f=g&&!1!==g.visible;if(!p&&!f)return;const{innerRadius:m=l.innerRadius,outerRadius:b=l.outerRadius,startAngle:y=l.startAngle,endAngle:C=l.endAngle,opacity:v=l.opacity,x:w=l.x,y:x=l.y,scaleX:_=l.scaleX,scaleY:S=l.scaleY}=t.attribute,A=!(!u||!u.stroke),B=!(!g||!g.stroke);if(p){const{distance:n=l.outerBorder.distance}=u,o=ph(e,n,e.dpr),s=n/b;if(t.setAttributes({outerRadius:b+o,innerRadius:m-o,startAngle:y-s,endAngle:C+s}),e.beginPath(),Es(t,e,i,r,b+o,m-o),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),d)d(e,u,l.outerBorder);else if(A){const n=l.outerBorder.opacity;l.outerBorder.opacity=v,e.setStrokeStyle(t,u,(w-i)/_,(x-r)/S,l.outerBorder),l.outerBorder.opacity=n,e.stroke()}}if(f){const{distance:n=l.innerBorder.distance}=g,o=ph(e,n,e.dpr),s=n/b;if(t.setAttributes({outerRadius:b-o,innerRadius:m+o,startAngle:y+s,endAngle:C-s}),e.beginPath(),Es(t,e,i,r,b-o,m+o),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),d)d(e,g,l.innerBorder);else if(B){const n=l.innerBorder.opacity;l.innerBorder.opacity=v,e.setStrokeStyle(t,g,(w-i)/_,(x-r)/S,l.innerBorder),l.innerBorder.opacity=n,e.stroke()}}t.setAttributes({outerRadius:b,innerRadius:m,startAngle:y,endAngle:C})}},Ah=_h,Bh=vh;const Th=new class{constructor(){this.time=Ti.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,r,n,o,s,a,l,h,c,d){const{outerBorder:u,innerBorder:g}=t.attribute,p=u&&!1!==u.visible,f=g&&!1!==g.visible;if(!p&&!f)return;const{radius:m=l.radius,startAngle:b=l.startAngle,endAngle:y=l.endAngle,opacity:C=l.opacity,x:v=l.x,y:w=l.y,scaleX:x=l.scaleX,scaleY:_=l.scaleY}=t.attribute,S=!(!u||!u.stroke),A=!(!g||!g.stroke);if(p){const{distance:n=l.outerBorder.distance}=u,o=ph(e,n,e.dpr);if(e.beginPath(),e.arc(i,r,m+o,b,y),e.closePath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),d)d(e,u,l.outerBorder);else if(S){const n=l.outerBorder.opacity;l.outerBorder.opacity=C,e.setStrokeStyle(t,u,(v-i)/x,(w-r)/_,l.outerBorder),l.outerBorder.opacity=n,e.stroke()}}if(f){const{distance:n=l.innerBorder.distance}=g,o=ph(e,n,e.dpr);if(e.beginPath(),e.arc(i,r,m-o,b,y),e.closePath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),d)d(e,g,l.innerBorder);else if(A){const n=l.innerBorder.opacity;l.innerBorder.opacity=C,e.setStrokeStyle(t,g,(v-i)/x,(w-r)/_,l.innerBorder),l.innerBorder.opacity=n,e.stroke()}}}},Mh=_h,Rh=vh;const Ph=new class extends Ch{constructor(){super(...arguments),this.time=Ti.beforeFillStroke}drawShape(t,e,i,r,n,o,s,a,l,h,c,d){const{background:u,backgroundMode:g=l.backgroundMode,backgroundFit:p=l.backgroundFit}=t.attribute;if(u)if(t.backgroundImg&&t.resources){const i=t.resources.get(u);if("success"!==i.state||!i.data)return;e.highPerformanceSave(),e.setTransformFromMatrix(t.parent.globalTransMatrix,!0);const r=t.AABBBounds;this.doDrawImage(e,i.data,r,g,p),e.highPerformanceRestore(),e.setTransformForCurrent()}else e.highPerformanceSave(),e.fillStyle=u,e.fill(),e.highPerformanceRestore()}},Eh=Xt/2;function Hh(t,e,i,r,n,o){let s;if(r<0&&(e+=r,r=-r),n<0&&(i+=n,n=-n),ot(o,!0))s=[o=Jt(o),o,o,o];else if(Array.isArray(o)){const t=o;let e,i;switch(t.length){case 0:s=[0,0,0,0];break;case 1:e=Jt(t[0]),s=[e,e,e,e];break;case 2:case 3:e=Jt(t[0]),i=Jt(t[1]),s=[e,i,e,i];break;default:s=t,s[0]=Jt(s[0]),s[1]=Jt(s[1]),s[2]=Jt(s[2]),s[3]=Jt(s[3])}}else s=[0,0,0,0];if(r<0||s[0]+s[1]+s[2]+s[3]<1e-12)return t.rect(e,i,r,n);const[a,l,h,c]=[[e,i],[e+r,i],[e+r,i+n],[e,i+n]],d=Math.min(r/2,n/2),u=[Math.min(d,s[0]),Math.min(d,s[1]),Math.min(d,s[2]),Math.min(d,s[3])],g=[a[0]+u[0],a[1]],p=[a[0],a[1]+u[0]],f=[l[0]-u[1],l[1]],m=[l[0],l[1]+u[1]],b=[h[0]-u[2],h[1]],y=[h[0],h[1]-u[2]],C=[c[0]+u[3],c[1]],v=[c[0],c[1]-u[3]];if(t.moveTo(g[0],g[1]),t.lineTo(f[0],f[1]),!Pt(f,m)){const e=f[0],i=f[1]+u[1];t.arc(e,i,u[1],-Eh,0,!1)}if(t.lineTo(y[0],y[1]),!Pt(b,y)){const e=y[0]-u[2],i=y[1];t.arc(e,i,u[2],0,Eh,!1)}if(t.lineTo(C[0],C[1]),!Pt(C,v)){const e=C[0],i=C[1]-u[3];t.arc(e,i,u[3],Eh,Xt,!1)}if(t.lineTo(p[0],p[1]),!Pt(g,p)){const e=g[0],i=g[1]+u[0];t.arc(e,i,u[0],Xt,Xt+Eh,!1)}return t.closePath(),t}const Lh=new class extends Ch{constructor(){super(...arguments),this.time=Ti.beforeFillStroke}drawShape(t,e,i,r,n,o,s,a,l,h,c,d){const{background:u,backgroundMode:g=l.backgroundMode,backgroundFit:p=l.backgroundFit}=t.attribute;if(u)if(t.backgroundImg){const i=t.resources.get(u);if("success"!==i.state||!i.data)return;if(e.save(),t.parent&&!t.transMatrix.onlyTranslate()){const i=Cn(t.parent).group,{scrollX:r=i.scrollX,scrollY:n=i.scrollY}=t.parent.attribute;e.setTransformFromMatrix(t.parent.globalTransMatrix,!0),e.translate(r,n)}const r=t.AABBBounds;this.doDrawImage(e,i.data,r,g,p),e.restore(),t.transMatrix.onlyTranslate()||e.setTransformForCurrent()}else if(q(u)){const{stroke:i,fill:r,lineWidth:n=1,cornerRadius:o=0,expandX:s=0,expandY:a=0}=u;if(!i&&!r)return;e.beginPath();const{x:l,y:h,width:c,height:d}=function(t){const e=Yn(t.attribute.boundsPadding),i=t.AABBBounds;let r=i.x1,n=i.y1,o=i.width(),s=i.height();return ot(e)?(r+=e,n+=e,o-=2*e,s-=2*e):(r+=e[3],n+=e[0],o-=e[1]+e[3],s-=e[0]+e[2]),{x:r,y:n,width:o,height:s}}(t);o?Hh(e,l-s,h-a,c+2*s,d+2*a,o):e.rect(l-s,h-a,c+2*s,d+2*a),e.globalAlpha=1,r&&(e.fillStyle=r,e.fill()),i&&n>0&&(e.lineWidth=n,e.strokeStyle=i,e.stroke())}else{e.beginPath();const n=t.AABBBounds;e.rect(i,r,n.width(),n.height()),e.fillStyle=u,e.globalAlpha=1,e.fill()}}};var kh=function(t,e,i,r){var n,o=arguments.length,s=o<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,i,r);else for(var a=t.length-1;a>=0;a--)(n=t[a])&&(s=(o<3?n(s):o>3?n(e,i,s):n(e,i))||s);return o>3&&s&&Object.defineProperty(e,i,s),s};let Ih=class{constructor(){this.time=Ti.beforeFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,r,n,o,s,a,l,h,c,d,u){const{stroke:g=l.stroke}=t.attribute;Array.isArray(g)&&g.some((t=>!1===t))&&(u.doStroke=!1)}};Ih=kh([f()],Ih);let Fh=class{constructor(){this.time=Ti.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,r,n,o,s,a,l,h,c,d){const{width:u=l.width,height:g=l.height,stroke:p=l.stroke}=t.attribute;if(Array.isArray(p)&&p.some((t=>!1===t))){if(e.setStrokeStyle(t,t.attribute,i,r,l),e.beginPath(),e.moveTo(i,r),p[0]?e.lineTo(i+u,r):e.moveTo(i+u,r),p[1]?e.lineTo(i+u,r+g):e.moveTo(i+u,r+g),p[2]?e.lineTo(i,r+g):e.moveTo(i,r+g),p[3]){const t=p[0]?r-e.lineWidth/2:r;e.lineTo(i,t)}else e.moveTo(i,r);e.stroke()}}};Fh=kh([f()],Fh);const zh=new class{constructor(){this.time=Ti.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,r,n,o,s,a,l,h,c,d){const{outerBorder:u,innerBorder:g}=t.attribute,p=u&&!1!==u.visible,f=g&&!1!==g.visible;if(!p&&!f)return;const{cornerRadius:m=l.cornerRadius,opacity:b=l.opacity,x:y=l.x,y:C=l.y,scaleX:v=l.scaleX,scaleY:w=l.scaleY,x1:x,y1:_}=t.attribute;let{width:S,height:A}=t.attribute;S=(null!=S?S:x-i)||0,A=(null!=A?A:_-r)||0;const B=!(!u||!u.stroke),T=!(!g||!g.stroke);if(p){const{distance:n=l.outerBorder.distance}=u,o=ph(e,n,e.dpr),s=i-o,a=r-o,h=2*o;if(0===m||it(m)&&m.every((t=>0===t))?(e.beginPath(),e.rect(s,a,S+h,A+h)):(e.beginPath(),Hh(e,s,a,S+h,A+h,m)),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),d)d(e,u,l.outerBorder);else if(B){const n=l.outerBorder.opacity;l.outerBorder.opacity=b,e.setStrokeStyle(t,u,(y-i)/v,(C-r)/w,l.outerBorder),l.outerBorder.opacity=n,e.stroke()}}if(f){const{distance:n=l.innerBorder.distance}=g,o=ph(e,n,e.dpr),s=i+o,a=r+o,h=2*o;if(0===m||it(m)&&m.every((t=>0===t))?(e.beginPath(),e.rect(s,a,S-h,A-h)):(e.beginPath(),Hh(e,s,a,S-h,A-h,m)),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),d)d(e,g,l.innerBorder);else if(T){const n=l.innerBorder.opacity;l.innerBorder.opacity=b,e.setStrokeStyle(t,g,(y-i)/v,(C-r)/w,l.innerBorder),l.innerBorder.opacity=n,e.stroke()}}}},Oh=_h,Dh=vh;const Wh=new class{constructor(){this.time=Ti.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,r,n,o,s,a,l,h,c,d){const u=t.getParsedPath();if(!u)return;const{outerBorder:g,innerBorder:p}=t.attribute,f=g&&!1!==g.visible,m=p&&!1!==p.visible;if(!f&&!m)return;const{size:b=l.size,opacity:y=l.opacity,x:C=l.x,y:v=l.y,scaleX:w=l.scaleX,scaleY:x=l.scaleY}=t.attribute,_=!(!g||!g.stroke),S=!(!p||!p.stroke);if(f){const{distance:n=l.outerBorder.distance}=g,o=ph(e,n,e.dpr);if(e.beginPath(),!1===u.drawOffset(e,b,i,r,o)&&e.closePath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),d)d(e,g,l.outerBorder);else if(_){const n=l.outerBorder.opacity;l.outerBorder.opacity=y,e.setStrokeStyle(t,g,(C-i)/w,(v-r)/x,l.outerBorder),l.outerBorder.opacity=n,e.stroke()}}if(m){const{distance:n=l.innerBorder.distance}=p,o=ph(e,n,e.dpr);if(e.beginPath(),!1===u.drawOffset(e,b,i,r,-o)&&e.closePath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),d)d(e,p,l.innerBorder);else if(S){const n=l.innerBorder.opacity;l.innerBorder.opacity=y,e.setStrokeStyle(t,p,(C-i)/w,(v-r)/x,l.innerBorder),l.innerBorder.opacity=n,e.stroke()}}}},Nh=_h,Gh=vh;var jh=function(t,e,i,r){var n,o=arguments.length,s=o<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,i,r);else for(var a=t.length-1;a>=0;a--)(n=t[a])&&(s=(o<3?n(s):o>3?n(e,i,s):n(e,i))||s);return o>3&&s&&Object.defineProperty(e,i,s),s},Uh=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Vh=function(t,e){return function(i,r){e(i,r,t)}};let Kh=class extends gh{constructor(t){super(),this.arcRenderContribitions=t,this.numberType=Go,this.builtinContributions=[Sh,Bh,Ah],this.init(t)}drawArcTailCapPath(t,e,i,r,n,o,s,a){const l=a-s,h=t.getParsedAngle(),c=h.startAngle;let d=h.endAngle;d=a;const u=Jt(d-c),g=d>c;let p=!1;if(n<o){const t=n;n=o,o=t}const f=t.getParsedCornerRadius(),{outerDeltaAngle:m,innerDeltaAngle:b,outerStartAngle:y,outerEndAngle:C,innerEndAngle:v,innerStartAngle:w}=t.getParsePadAngle(c,d),x=f,_=f,S=f,A=f,B=Math.max(_,x),T=Math.max(S,A);let M=B,R=T;const P=n*te(y),E=n*re(y),H=o*te(v),L=o*re(v);let k,I,F,z;if((T>$t||B>$t)&&(k=n*te(C),I=n*re(C),F=o*te(w),z=o*re(w),u<Xt)){const t=Rs(P,E,F,z,k,I,H,L);if(t){const e=P-t[0],i=E-t[1],r=k-t[0],s=I-t[1],a=1/re(se((e*r+i*s)/(ne(e*e+i*i)*ne(r*r+s*s)))/2),l=ne(t[0]*t[0]+t[1]*t[1]);R=ie(T,(o-l)/(a-1)),M=ie(B,(n-l)/(a+1))}}if(M>$t){const t=ie(x,M),o=ie(_,M),s=Ps(F,z,P,E,n,t,Number(g)),a=Ps(k,I,H,L,n,o,Number(g));if(M<B&&t===o)e.moveTo(i+s.cx+s.x01,r+s.cy+s.y01),e.arc(i+s.cx,r+s.cy,M,Qt(s.y01,s.x01),Qt(a.y01,a.x01),!g);else{const t=d-l-.03,s=Qt(a.y11,a.x11);e.arc(i,r,n,t,s,!g),o>0&&e.arc(i+a.cx,r+a.cy,o,Qt(a.y11,a.x11),Qt(a.y01,a.x01),!g)}}else e.moveTo(i+P,r+E);if(!(o>$t)||b<.001)e.lineTo(i+H,r+L),p=!0;else if(R>$t){const t=ie(A,R),n=ie(S,R),s=Ps(H,L,k,I,o,-n,Number(g)),a=Ps(P,E,F,z,o,-t,Number(g));if(e.lineTo(i+s.cx+s.x01,r+s.cy+s.y01),R<T&&t===n){const t=Qt(a.y01,a.x01);e.arc(i+s.cx,r+s.cy,R,Qt(s.y01,s.x01),t,!g)}else{n>0&&e.arc(i+s.cx,r+s.cy,n,Qt(s.y01,s.x01),Qt(s.y11,s.x11),!g);const t=Qt(s.cy+s.y11,s.cx+s.x11),a=d-l-.03;e.arc(i,r,o,t,a,g)}}else e.lineTo(i+o*te(w),r+o*re(w));return p}drawShape(t,e,i,r,n,o,s,a){const l=Cn(t,null==o?void 0:o.theme).arc,{fill:h=l.fill,stroke:c=l.stroke,x:d=l.x,y:u=l.y}=t.attribute,g=this.valid(t,l,s,a);if(!g)return;const{fVisible:p,sVisible:f,doFill:m,doStroke:b}=g,{outerRadius:y=l.outerRadius,innerRadius:C=l.innerRadius,cap:v=l.cap,forceShowCap:w=l.forceShowCap}=t.attribute;let x=0;const _=(K(v)&&v||v[0])&&"conical"===h.gradient;if(_){const{sc:e,startAngle:i,endAngle:r}=t.getParsedAngle();Jt(r-i)<Zt-$t&&(x=e||0,h.startAngle-=x,h.endAngle-=x)}let S=!1;const{isFullStroke:A,stroke:B}=(t=>{var e;let i=!0;if(K(t,!0)){for(let r=0;r<4;r++)$n[r]=t,i&&(i=!(null!==(e=$n[r])&&void 0!==e&&!e));i=t}else if(Array.isArray(t))for(let e=0;e<4;e++)$n[e]=!!t[e],i&&(i=!!$n[e]);else $n[0]=!1,$n[1]=!1,$n[2]=!1,$n[3]=!1;return{isFullStroke:i,stroke:$n}})(c);if((m||A)&&(e.beginPath(),Es(t,e,i,r,y,C),S=!0,e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,i,r,m,b,p,f,l,n,s,a),m&&(s?s(e,t.attribute,l):p&&(e.setCommonStyle(t,t.attribute,d-i,u-r,l),e.fill())),b&&A&&(a?a(e,t.attribute,l):f&&(e.setStrokeStyle(t,t.attribute,d-i,u-r,l),e.stroke()))),!A&&b&&(e.beginPath(),Es(t,e,i,r,y,C,B),S||this.beforeRenderStep(t,e,i,r,m,b,p,f,l,n,s,a),a?a(e,t.attribute,l):f&&(e.setStrokeStyle(t,t.attribute,i,r,l),e.stroke())),(K(v)&&v||v[1])&&w){const{startAngle:o,endAngle:h}=t.getParsedAngle();if(Jt(h-o)>=Zt-$t){e.beginPath();const o=Math.abs(y-C)/2/y,{endAngle:h=l.endAngle,fill:c=l.fill}=t.attribute,d=h;if(this.drawArcTailCapPath(t,e,i,r,y,C,d,d+o),S||this.beforeRenderStep(t,e,i,r,m,b,p,f,l,n,s,a),m){const n=c;if("conical"===n.gradient){const o=function(t,e,i,r){const{stops:n,startAngle:o,endAngle:s}=r;for(;i<0;)i+=Zt;for(;i>Zt;)i-=Zt;if(i<o)return n[0].color;if(i>s)return n[0].color;let a,l,h=(i-o)/(s-o);for(let t=0;t<n.length;t++)if(n[t].offset>=h){a=n[t-1],l=n[t];break}return h=(h-a.offset)/(l.offset-a.offset),lo(a.color,l.color,h,!1)}(0,0,h,n);s||As&&(e.setCommonStyle(t,t.attribute,i,r,l),e.fillStyle=o,e.fill())}}b&&(a||f&&(e.setStrokeStyle(t,t.attribute,i,r,l),e.stroke()))}}this.afterRenderStep(t,e,i,r,m,b,p,f,l,n,s,a),_&&(h.startAngle+=x,h.endAngle+=x)}draw(t,e,i,r){const n=Cn(t,null==r?void 0:r.theme).arc;this._draw(t,n,!1,i,r)}};Kh=jh([f(),Vh(0,g(E)),Vh(0,m(Is)),Uh("design:paramtypes",[Object])],Kh);var $h=function(t,e,i,r){var n,o=arguments.length,s=o<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,i,r);else for(var a=t.length-1;a>=0;a--)(n=t[a])&&(s=(o<3?n(s):o>3?n(e,i,s):n(e,i))||s);return o>3&&s&&Object.defineProperty(e,i,s),s},Xh=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Yh=function(t,e){return function(i,r){e(i,r,t)}};let qh=class extends gh{constructor(t){super(),this.circleRenderContribitions=t,this.numberType=Vo,this.builtinContributions=[Th,Rh,Mh],this.init(t)}drawShape(t,e,i,r,n,o,s,a){const l=Cn(t,null==o?void 0:o.theme).circle,{radius:h=l.radius,startAngle:c=l.startAngle,endAngle:d=l.endAngle,x:u=l.x,y:g=l.y}=t.attribute,p=this.valid(t,l,s,a);if(!p)return;const{fVisible:f,sVisible:m,doFill:b,doStroke:y}=p;e.beginPath(),e.arc(i,r,h,c,d),e.closePath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,i,r,b,y,f,m,l,n,s,a),b&&(s?s(e,t.attribute,l):f&&(e.setCommonStyle(t,t.attribute,u-i,g-r,l),e.fill())),y&&(a?a(e,t.attribute,l):m&&(e.setStrokeStyle(t,t.attribute,u-i,g-r,l),e.stroke())),this.afterRenderStep(t,e,i,r,b,y,f,m,l,n,s,a)}draw(t,e,i,r){const n=Cn(t,null==r?void 0:r.theme).circle;this._draw(t,n,!1,i,r)}};function Zh(t,e,i,r){if(!e.p1)return;const{offsetX:n=0,offsetY:o=0,offsetZ:s=0}=r||{};if(1===i)e.p2&&e.p3?t.bezierCurveTo(n+e.p1.x,o+e.p1.y,n+e.p2.x,o+e.p2.y,n+e.p3.x,o+e.p3.y,s):t.lineTo(n+e.p1.x,o+e.p1.y,s);else if(e.p2&&e.p3){const[r]=Fi(e,i);t.bezierCurveTo(n+r.p1.x,o+r.p1.y,n+r.p2.x,o+r.p2.y,n+r.p3.x,o+r.p3.y,s)}else{const r=e.getPointAt(i);t.lineTo(n+r.x,o+r.y,s)}}function Jh(t,e,i,r,n){var o;const{offsetX:s=0,offsetY:a=0,offsetZ:l=0,mode:h="none",drawConnect:c=!1,zeroX:d=0,zeroY:u=0}=n||{};if(c&&"none"===h)return;if(!e)return;let g=!0;const{curves:p}=e;if(i>=1){if(c){let e,i=!0;p.forEach(((r,n)=>{var o;let h=r.p0;if(r.originP1!==r.originP2){if(e&&e.originP1===e.originP2&&(h=e.p0),r.defined)i||(t.lineTo(h.x+s,h.y+a,l),i=!i);else{const{originP1:e,originP2:n}=r;let c;if(e&&!1!==e.defined?c=h:e&&!1!==n.defined&&(c=null!==(o=r.p3)&&void 0!==o?o:r.p1),i){i=!i;const e=c?c.x:r.p0.x,n=c?c.y:r.p0.y;t.moveTo(e+s,n+a,l)}else c&&(i=!i,t.lineTo(c.x+s,c.y+a,l))}e=r}else e=r}))}else p.forEach((e=>{e.defined?(g&&t.moveTo(e.p0.x+s,e.p0.y+a,l),Zh(t,e,1,n),g=!1):g=!0}));return}if(i<=0)return;let f;"x"===r?f=Ai.ROW:"y"===r?f=Ai.COLUMN:"auto"===r&&(f=e.direction);const m=i*e.tryUpdateLength(f);let b=0,y=!0,C=null;for(let e=0,i=p.length;e<i;e++){const i=p[e],r=i.getLength(f),h=(m-b)/r;if(b+=r,h<0)break;if(c){let e=i.p0;if(i.originP1===i.originP2){C=i;continue}if(C&&C.originP1===C.originP2&&(e=C.p0),i.defined)y||(t.lineTo(e.x+s,e.y+a,l),y=!y);else{const{originP1:r,originP2:n}=i;let h;if(r&&!1!==r.defined?h=e:r&&!1!==n.defined&&(h=null!==(o=i.p3)&&void 0!==o?o:i.p1),y){y=!y;const e=h?h.x:i.p0.x,r=h?h.y:i.p0.y;t.moveTo(e+s,r+a,l)}else h&&(y=!y,t.lineTo(h.x+s,h.y+a,l))}C=i}else{if(!i.defined){g=!0;continue}g&&t.moveTo(i.p0.x+s,i.p0.y+a,l),Zh(t,i,ie(h,1),n),g=!1}}}qh=$h([f(),Yh(0,g(E)),Yh(0,m(zs)),Xh("design:paramtypes",[Object])],qh);var Qh=function(t,e,i,r){var n,o=arguments.length,s=o<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,i,r);else for(var a=t.length-1;a>=0;a--)(n=t[a])&&(s=(o<3?n(s):o>3?n(e,i,s):n(e,i))||s);return o>3&&s&&Object.defineProperty(e,i,s),s};let tc=class extends gh{constructor(){super(...arguments),this.numberType=Yo}draw(t,e,i,r){const n=Cn(t,null==r?void 0:r.theme).line;this._draw(t,n,!1,i,r)}drawSegmentItem(t,e,i,r,n,o,s,a,l,h,c,d,u,g,p){var f,m,b,y,C;if(!e)return;t.beginPath();const v=null!==(f=this.z)&&void 0!==f?f:0;Jh(t.camera?t:t.nativeContext,e,l,h,{offsetX:c,offsetY:d,offsetZ:v}),u.cache&&!it(u.cache)&&u.cache.curves.every((t=>t.defined))&&u.attribute.curveType&&u.attribute.curveType.includes("Closed")&&t.closePath(),t.setShadowBlendStyle&&t.setShadowBlendStyle(u,s,a);const{x:w=0,x:x=0}=s;!1!==i&&(g?g(t,s,a):n&&(t.setCommonStyle(u,s,w-c,x-d,a),t.fill())),!1!==r&&(p?p(t,s,a):o&&(t.setStrokeStyle(u,s,w-c,x-d,a),t.stroke()));let{connectedType:_,connectedX:S,connectedY:A,connectedStyle:B}=s;if(it(a)?(_=null!==(m=null!=_?_:a[0].connectedType)&&void 0!==m?m:a[1].connectedType,S=null!==(b=null!=S?S:a[0].connectedX)&&void 0!==b?b:a[1].connectedX,A=null!==(y=null!=A?A:a[0].connectedY)&&void 0!==y?y:a[1].connectedY,B=null!==(C=null!=B?B:a[0].connectedStyle)&&void 0!==C?C:a[1].connectedStyle):(_=null!=_?_:a.connectedType,S=null!=S?S:a.connectedX,A=null!=A?A:a.connectedY,B=null!=B?B:a.connectedStyle),"connect"!==_&&"zero"!==_&&(_="none"),"none"!==_){t.beginPath(),Jh(t.camera?t:t.nativeContext,e,l,h,{offsetX:c,offsetY:d,offsetZ:v,drawConnect:!0,mode:_,zeroX:S,zeroY:A});const f=[];it(a)?a.forEach((t=>f.push(t))):f.push(a),f.push(s),!1!==i&&(g?g(t,s,a):n&&(t.setCommonStyle(u,B,w-c,x-d,f),t.fill())),!1!==r&&(p?p(t,s,a):o&&(t.setStrokeStyle(u,B,w-c,x-d,f),t.stroke()))}return!1}drawLinearLineHighPerformance(t,e,i,r,n,o,s,a,l,h,c,d,u){var g;e.beginPath();const p=null!==(g=this.z)&&void 0!==g?g:0,{points:f}=t.attribute,m=f[0];e.moveTo(m.x+s,m.y+a,p);for(let t=1;t<f.length;t++){const i=f[t];e.lineTo(i.x+s,i.y+a,p)}e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l);const{x:b=0,x:y=0}=t.attribute;!1!==i&&(d?d(e,t.attribute,l):n&&(e.setCommonStyle(t,t.attribute,b-s,y-a,l),e.fill())),!1!==r&&(u?u(e,t.attribute,l):o&&(e.setStrokeStyle(t,t.attribute,b-s,y-a,l),e.stroke()))}drawShape(t,e,i,r,n,o,s,a){const l=Cn(t,null==o?void 0:o.theme).line,{fill:h=l.fill,stroke:c=l.stroke,fillOpacity:d=l.fillOpacity,strokeOpacity:u=l.strokeOpacity,segments:g,points:p,closePath:f}=t.attribute;if(!this.valid(t,l,s,a))return;let{curveType:m=l.curveType}=t.attribute;f&&"linear"===m&&(m="linearClosed");const{clipRange:b=l.clipRange,clipRangeByDimension:y=l.clipRangeByDimension}=t.attribute;if(1===b&&!g&&!p.some((t=>!1===t.defined))&&"linear"===m)return this.drawLinearLineHighPerformance(t,e,!!h,!!c,d,u,i,r,l,n,o,s,a);if(t.shouldUpdateShape()){const{points:e,segments:i}=t.attribute,r=e;if(i&&i.length){let e,r;if(t.cache=i.map(((t,i)=>{if(t.points.length<=1&&0===i)return t.points[0]&&(r={endX:t.points[0].x,endY:t.points[0].y,curves:[{defined:!1!==t.points[0].defined}]}),null;1===i?e={x:r.endX,y:r.endY,defined:r.curves[r.curves.length-1].defined}:i>1&&(e.x=r.endX,e.y=r.endY,e.defined=r.curves[r.curves.length-1].defined);const n=ar(t.points,m,{startPoint:e});return r=n,n})).filter((t=>!!t)),"linearClosed"===m){let e;for(let i=0;i<t.cache.length;i++){const r=t.cache[i];for(let t=0;t<r.curves.length;t++)if(r.curves[t].defined){e=r.curves[t].p0;break}if(e)break}t.cache[t.cache.length-1]&&t.cache[t.cache.length-1].lineTo(e.x,e.y,!0)}}else{if(!e||!e.length)return t.cache=null,void t.clearUpdateShapeTag();t.cache=ar(r,m)}t.clearUpdateShapeTag()}if(Array.isArray(t.cache)){const n=t.attribute.segments.filter((t=>t.points.length));if(1===n[0].points.length&&n.shift(),1===b){let o=!1;t.cache.forEach(((g,p)=>{o||(o=this.drawSegmentItem(e,g,!!h,!!c,d,u,n[p],[l,t.attribute],b,y,i,r,t,s,a))}))}else{const o=t.cache.reduce(((t,e)=>t+e.getLength()),0),g=b*o;let p=0,f=!1;t.cache.forEach(((o,m)=>{if(f)return;const b=o.getLength(),C=(g-p)/b;p+=b,C>0&&(f=this.drawSegmentItem(e,o,!!h,!!c,d,u,n[m],[l,t.attribute],ie(C,1),y,i,r,t,s,a))}))}}else this.drawSegmentItem(e,t.cache,!!h,!!c,d,u,t.attribute,l,b,y,i,r,t,s,a)}};function ec(t,e,i,r){if(e.length<2)return;const{offsetX:n=0,offsetY:o=0,offsetZ:s=0,mode:a}=r||{};let l=e[0];t.moveTo(l.p0.x+n,l.p0.y+o,s),l=e[e.length-1];let h=l.p3||l.p1;t.lineTo(h.x+n,h.y+o,s),l=i[i.length-1],t.lineTo(l.p0.x+n,l.p0.y+o,s),l=i[0],h=l.p3||l.p1,t.lineTo(h.x+n,h.y+o,s),t.closePath()}function ic(t,e,i,r){const{offsetX:n=0,offsetY:o=0,offsetZ:s=0}=r||{};let a=!0;e.forEach((e=>{e.defined?(a&&t.moveTo(e.p0.x+n,e.p0.y+o,s),Zh(t,e,1,r),a=!1):a=!0})),a=!0;for(let e=i.length-1;e>=0;e--){const l=i[e];l.defined?(a&&t.lineTo(l.p0.x+n,l.p0.y+o,s),Zh(t,l,1,r),a=!1):a=!0}t.closePath()}tc=Qh([f()],tc);const rc=new class extends xh{constructor(){super(...arguments),this.time=Ti.afterFillStroke}drawShape(t,e,i,r,n,o,s,a,l,h,c,d,u){var g,p,f,m;this.textureMap||this.initTextureMap(e,t.stage);const{attribute:b=t.attribute}=u||{},{texture:y=(null!==(g=t.attribute.texture)&&void 0!==g?g:eo(l,"texture")),textureColor:C=(null!==(p=t.attribute.textureColor)&&void 0!==p?p:eo(l,"textureColor")),textureSize:v=(null!==(f=t.attribute.textureSize)&&void 0!==f?f:eo(l,"textureSize")),texturePadding:w=(null!==(m=t.attribute.texturePadding)&&void 0!==m?m:eo(l,"texturePadding"))}=b;y&&this.drawTexture(y,t,e,i,r,l,C,v,w)}},nc=vh;var oc=function(t,e,i,r){var n,o=arguments.length,s=o<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,i,r);else for(var a=t.length-1;a>=0;a--)(n=t[a])&&(s=(o<3?n(s):o>3?n(e,i,s):n(e,i))||s);return o>3&&s&&Object.defineProperty(e,i,s),s},sc=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},ac=function(t,e){return function(i,r){e(i,r,t)}};function lc(t,e,i){switch(e){case"linear":default:return Vi(t,i);case"basis":return Xi(t,i);case"monotoneX":return er(t,i);case"monotoneY":return ir(t,i);case"step":return nr(t,.5,i);case"stepBefore":return nr(t,0,i);case"stepAfter":return nr(t,1,i);case"linearClosed":return sr(t,i)}}let hc=class extends gh{constructor(t){super(),this.areaRenderContribitions=t,this.numberType=Uo,this.builtinContributions=[rc,nc],this.init(t)}drawLinearAreaHighPerformance(t,e,i,r,n,o,s,a,l,h,c,d,u){var g,p,f,m,b;e.beginPath();const y=null!==(g=this.z)&&void 0!==g?g:0,{points:C}=t.attribute,v=C[0];e.moveTo(v.x+s,v.y+a,y);for(let t=1;t<C.length;t++){const i=C[t];e.lineTo(i.x+s,i.y+a,y)}for(let t=C.length-1;t>=0;t--){const i=C[t];e.lineTo((null!==(p=i.x1)&&void 0!==p?p:i.x)+s,(null!==(f=i.y1)&&void 0!==f?f:i.y)+a,y)}e.closePath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,s,a,!!n,!1,i,!1,l,h,d,null,{attribute:t.attribute});const{x:w=0,x:x=0}=t.attribute;if(!1!==i&&(d?d(e,t.attribute,l):n&&(e.setCommonStyle(t,t.attribute,w-s,x-a,l),e.fill())),this.afterRenderStep(t,e,s,a,!!n,!1,i,!1,l,h,d,null,{attribute:t.attribute}),r){const{stroke:i=l&&l.stroke}=t.attribute;if(it(i)&&(i[0]||i[2])&&!1===i[1])if(e.beginPath(),i[0]){e.moveTo(v.x+s,v.y+a,y);for(let t=1;t<C.length;t++){const i=C[t];e.lineTo(i.x+s,i.y+a,y)}}else if(i[2]){const t=C[C.length-1];e.moveTo(t.x+s,t.y+a,y);for(let t=C.length-2;t>=0;t--){const i=C[t];e.lineTo((null!==(m=i.x1)&&void 0!==m?m:i.x)+s,(null!==(b=i.y1)&&void 0!==b?b:i.y)+a,y)}}u?u(e,t.attribute,l):(e.setStrokeStyle(t,t.attribute,w-s,x-a,l),e.stroke())}}drawShape(t,e,i,r,n,o,s,a){var l,h,c,d,u,g;const p=Cn(t,null==o?void 0:o.theme).area,{fill:f=p.fill,stroke:m=p.stroke,fillOpacity:b=p.fillOpacity,z:y=p.z,strokeOpacity:C=p.strokeOpacity}=t.attribute,v=this.valid(t,p,s,a);if(!v)return;const{doFill:w,doStroke:x}=v,{clipRange:_=p.clipRange,closePath:S,points:A,segments:B}=t.attribute;let{curveType:T=p.curveType}=t.attribute;if(S&&"linear"===T&&(T="linearClosed"),1===_&&!B&&!A.some((t=>!1===t.defined))&&"linear"===T)return this.drawLinearAreaHighPerformance(t,e,!!f,x,b,C,i,r,p,n,o,s,a);if(t.shouldUpdateShape()){if(B&&B.length){let e,i;const r=B.map(((t,r)=>{if(t.points.length<=1&&0===r)return t.points[0]&&(i={endX:t.points[0].x,endY:t.points[0].y}),null;1===r?e={x:i.endX,y:i.endY}:r>1&&(e.x=i.endX,e.y=i.endY);const n=lc(t.points,T,{startPoint:e});return i=n,n})).filter((t=>!!t));let n;const o=[];for(let t=B.length-1;t>=0;t--){const e=B[t].points,i=[];for(let t=e.length-1;t>=0;t--)i.push({x:null!==(l=e[t].x1)&&void 0!==l?l:e[t].x,y:null!==(h=e[t].y1)&&void 0!==h?h:e[t].y});if(0!==t){const e=B[t-1].points,r=e[e.length-1];r&&i.push({x:null!==(c=r.x1)&&void 0!==c?c:r.x,y:null!==(d=r.y1)&&void 0!==d?d:r.y})}i.length>1&&(n=lc(i,"stepBefore"===T?"stepAfter":"stepAfter"===T?"stepBefore":T),o.unshift(n))}t.cacheArea=o.map(((t,e)=>({top:r[e],bottom:t})))}else{if(!A||!A.length)return t.cacheArea=null,void t.clearUpdateShapeTag();{const e=A,i=[];for(let t=A.length-1;t>=0;t--)i.push({x:null!==(u=A[t].x1)&&void 0!==u?u:A[t].x,y:null!==(g=A[t].y1)&&void 0!==g?g:A[t].y});const r=lc(e,T),n=lc(i,"stepBefore"===T?"stepAfter":"stepAfter"===T?"stepBefore":T);t.cacheArea={top:r,bottom:n}}}t.clearUpdateShapeTag()}if(Array.isArray(t.cacheArea)){const o=t.attribute.segments.filter((t=>t.points.length));if(1===o[0].points.length&&o.shift(),1===_){let l=!1;t.cacheArea.forEach(((h,c)=>{l||(l=this.drawSegmentItem(e,h,w,b,x,C,o[c],[p,t.attribute],_,i,r,y,t,n,s,a))}))}else{const l=t.cacheArea.reduce(((t,e)=>t+e.top.getLength()),0),h=_*l;let c=0,d=!1;t.cacheArea.forEach(((l,u)=>{if(d)return;const g=l.top.getLength(),f=(h-c)/g;c+=g,f>0&&(d=this.drawSegmentItem(e,l,w,b,x,C,o[u],[p,t.attribute],ie(f,1),i,r,y,t,n,s,a))}))}}else this.drawSegmentItem(e,t.cacheArea,w,b,x,C,t.attribute,p,_,i,r,y,t,n,s,a)}draw(t,e,i,r){const n=Cn(t,null==r?void 0:r.theme).area;this._draw(t,n,!1,i,r)}drawSegmentItem(t,e,i,r,n,o,s,a,l,h,c,d,u,g,p,f){let m=!1;return m=m||this._drawSegmentItem(t,e,i,r,n,o,s,a,l,h,c,d,u,g,!1,p,f),m=m||this._drawSegmentItem(t,e,i,r,n,o,s,a,l,h,c,d,u,g,!0,p,f),m}_drawSegmentItem(t,e,i,r,n,o,s,a,l,h,c,d,u,g,p,f,m){var b,y,C,v;let{connectedType:w,connectedX:x,connectedY:_,connectedStyle:S}=s;const A=[];if(p&&(it(a)?(w=null!==(b=null!=w?w:a[0].connectedType)&&void 0!==b?b:a[1].connectedType,x=null!==(y=null!=x?x:a[0].connectedX)&&void 0!==y?y:a[1].connectedX,_=null!==(C=null!=_?_:a[0].connectedY)&&void 0!==C?C:a[1].connectedY,S=null!==(v=null!=S?S:a[0].connectedStyle)&&void 0!==v?v:a[1].connectedStyle):(w=null!=w?w:a.connectedType,x=null!=x?x:a.connectedX,_=null!=_?_:a.connectedY,S=null!=S?S:a.connectedStyle),"connect"!==w&&"zero"!==w&&(w="none"),it(a)?a.forEach((t=>A.push(t))):A.push(a),A.push(s)),p&&"none"===w)return!1;if(!e)return;t.beginPath();const{points:B,segments:T}=u.attribute;let M,R,P=Ai.ROW;if(T){const t=T[T.length-1];R=T[0].points[0],M=t.points[t.points.length-1]}else R=B[0],M=B[B.length-1];P=Jt(M.x-R.x)>Jt(M.y-R.y)?Ai.ROW:Ai.COLUMN,function(t,e,i,r){var n;const{drawConnect:o=!1,mode:s="none"}=r||{};if(o&&"none"===s)return;const{top:a,bottom:l}=e;if(a.curves.length!==l.curves.length)return;if(i>=1){const e=[],i=[];let n=!0;if(o){let n,o,s=!0;const h=a.curves.length;a.curves.forEach(((a,c)=>{const d=l.curves[h-c-1];let u=a,g=d;if(a.originP1===a.originP2)return n=a,void(o=d);if(n&&n.originP1===n.originP2&&(u=n,g=o),a.defined)s||(e.push(u),i.push(g),ec(t,e,i,r),e.length=0,i.length=0,s=!s);else{const{originP1:n,originP2:o}=a;let l,h;n&&!1!==n.defined?(l=u,h=g):n&&!1!==o.defined&&(l=a,h=d),s?(s=!s,e.push(l||a),i.push(h||d)):l&&(s=!s,e.push(l||a),i.push(h||d),ec(t,e,i,r),e.length=0,i.length=0)}n=a})),ec(t,e,i,r)}else{for(let o=0,s=a.curves.length;o<s;o++){const h=a.curves[o];n!==h.defined?(n?(ic(t,e,i,r),e.length=0,i.length=0):(e.push(h),i.push(l.curves[s-o-1])),n=!n):n&&(e.push(h),i.push(l.curves[s-o-1]))}ic(t,e,i,r)}return}if(i<=0)return;let{direction:h}=r||{};const{curves:c}=a,d=null!==(n=c[c.length-1].p3)&&void 0!==n?n:c[c.length-1].p1,u=Jt(d.x-c[0].p0.x),g=Jt(d.y-c[0].p0.y);h=null!=h?h:u>g?Ai.ROW:Ai.COLUMN,Number.isFinite(u)||(h=Ai.COLUMN),Number.isFinite(g)||(h=Ai.ROW);const p=i*(h===Ai.ROW?u:g);let f=0,m=!0;const b=[],y=[];let C,v,w=!0;for(let e=0,i=a.curves.length;e<i;e++){const n=a.curves[e],s=n.getLength(h),c=(p-f)/s;if(c<0)break;if(f+=s,o){const o=l.curves[i-e-1];let s=n,a=o;if(n.originP1===n.originP2){C=n,v=o;continue}if(C&&C.originP1===C.originP2&&(s=C,a=v),n.defined)w||(b.push(s),y.push(a),ec(t,b,y,r),b.length=0,y.length=0,w=!w);else{const{originP1:e,originP2:i}=n;let l,h;e&&!1!==e.defined?(l=s,h=a):e&&!1!==i.defined&&(l=n,h=o),w?(w=!w,b.push(l||n),y.push(h||o)):l&&(w=!w,b.push(l||n),y.push(h||o),ec(t,b,y,r),b.length=0,y.length=0)}C=n}else{let o=null,s=null;m!==n.defined?(m?(ic(t,b,y,r),b.length=0,y.length=0):(o=n,s=l.curves[i-e-1]),m=!m):m&&(o=n,s=l.curves[i-e-1]),o&&s&&(c<1&&(o=o.p2&&o.p3?Fi(o,c)[0]:Oi(o,c)[0],s=s.p2&&s.p3?Fi(s,1-c)[1]:Oi(s,1-c)[1]),o.defined=m,s.defined=m,b.push(o),y.push(s)),o=null,s=null}}o?ec(t,b,y,r):ic(t,b,y,r)}(t.camera?t:t.nativeContext,e,l,{offsetX:h,offsetY:c,offsetZ:d,direction:P,drawConnect:p,mode:w,zeroX:x,zeroY:_}),this.beforeRenderStep(u,t,h,c,!!r,!1,i,!1,a,g,f,null,{attribute:s}),t.setShadowBlendStyle&&t.setShadowBlendStyle(u,s,a);const{x:E=0,x:H=0}=s;if(!1!==i&&(f?f(t,s,a):r&&(t.setCommonStyle(u,p?S:s,E-h,H-c,p?A:a),t.fill())),this.afterRenderStep(u,t,h,c,!!r,!1,i,!1,a,g,f,null,{attribute:s}),!1!==n)if(m)m(t,s,a);else{const{stroke:i=a&&a[1]&&a[1].stroke}=s;it(i)&&(i[0]||i[2])&&!1===i[1]&&(t.beginPath(),Jh(t.camera?t:t.nativeContext,i[0]?e.top:e.bottom,l,P===Ai.ROW?"x":"y",{offsetX:h,offsetY:c,offsetZ:d,drawConnect:p,mode:w,zeroX:x,zeroY:_})),t.setStrokeStyle(u,p?S:s,E-h,H-c,p?A:a),t.stroke()}return!1}};hc=oc([f(),ac(0,g(E)),ac(0,m(Fs)),sc("design:paramtypes",[Object])],hc);const cc=_h,dc=vh;var uc=function(t,e,i,r){var n,o=arguments.length,s=o<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,i,r);else for(var a=t.length-1;a>=0;a--)(n=t[a])&&(s=(o<3?n(s):o>3?n(e,i,s):n(e,i))||s);return o>3&&s&&Object.defineProperty(e,i,s),s},gc=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},pc=function(t,e){return function(i,r){e(i,r,t)}};let fc=class extends gh{constructor(t){super(),this.pathRenderContribitions=t,this.numberType=qo,this.builtinContributions=[dc,cc],this.init(t)}drawShape(t,e,i,r,n,o,s,a){var l,h,c;const d=null!==(l=this.tempTheme)&&void 0!==l?l:Cn(t,null==o?void 0:o.theme).path,{x:u=d.x,y:g=d.y}=t.attribute,p=null!==(h=this.z)&&void 0!==h?h:0,f=this.valid(t,d,s,a);if(!f)return;const{fVisible:m,sVisible:b,doFill:y,doStroke:C}=f;if(e.beginPath(),t.pathShape)Ei(t.pathShape.commandList,e,i,r,1,1,p);else{Ei((null!==(c=t.attribute.path)&&void 0!==c?c:d.path).commandList,e,i,r,1,1,p)}e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,d),this.beforeRenderStep(t,e,i,r,y,C,m,b,d,n,s,a),C&&(a?a(e,t.attribute,d):b&&(e.setStrokeStyle(t,t.attribute,u-i,g-r,d),e.stroke())),y&&(s?s(e,t.attribute,d):m&&(e.setCommonStyle(t,t.attribute,u-i,g-r,d),e.fill())),this.afterRenderStep(t,e,i,r,y,C,m,b,d,n,s,a)}draw(t,e,i,r){const n=Cn(t,null==r?void 0:r.theme).path;this.tempTheme=n,this._draw(t,n,!1,i,r),this.tempTheme=null}};fc=uc([f(),pc(0,g(E)),pc(0,m(Ws)),gc("design:paramtypes",[Object])],fc);var mc=function(t,e,i,r){var n,o=arguments.length,s=o<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,i,r);else for(var a=t.length-1;a>=0;a--)(n=t[a])&&(s=(o<3?n(s):o>3?n(e,i,s):n(e,i))||s);return o>3&&s&&Object.defineProperty(e,i,s),s},bc=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},yc=function(t,e){return function(i,r){e(i,r,t)}};let Cc=class extends gh{constructor(t){super(),this.rectRenderContribitions=t,this.type="rect",this.numberType=Qo,this.builtinContributions=[zh,Dh,Oh],this.init(t)}drawShape(t,e,i,r,n,o,s,a){var l;const h=null!==(l=this.tempTheme)&&void 0!==l?l:Cn(t,null==o?void 0:o.theme).rect,{fill:c=h.fill,background:d,stroke:u=h.stroke,cornerRadius:g=h.cornerRadius,opacity:p=h.opacity,fillOpacity:f=h.fillOpacity,lineWidth:m=h.lineWidth,strokeOpacity:b=h.strokeOpacity,visible:y=h.visible,x1:C,y1:v,x:w=h.x,y:x=h.y}=t.attribute;let{width:_,height:S}=t.attribute;_=(null!=_?_:C-w)||0,S=(null!=S?S:v-x)||0;const A=Bs(p,f,_,S,c),B=Ms(p,b,_,S),T=_s(c,d),M=Ss(u,m);if(!t.valid||!y)return;if(!T&&!M)return;if(!(A||B||s||a||d))return;0===g||it(g)&&g.every((t=>0===t))?(e.beginPath(),e.rect(i,r,_,S)):(e.beginPath(),Hh(e,i,r,_,S,g));const R={doFill:T,doStroke:M};e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,h),this.beforeRenderStep(t,e,i,r,T,M,A,B,h,n,s,a,R),R.doFill&&(s?s(e,t.attribute,h):A&&(e.setCommonStyle(t,t.attribute,w-i,x-r,h),e.fill())),R.doStroke&&(a?a(e,t.attribute,h):B&&(e.setStrokeStyle(t,t.attribute,w-i,x-r,h),e.stroke())),this.afterRenderStep(t,e,i,r,T,M,A,B,h,n,s,a)}draw(t,e,i,r){const n=Cn(t,null==r?void 0:r.theme).rect;this.tempTheme=n,this._draw(t,n,!1,i,r),this.tempTheme=null}};Cc=mc([f(),yc(0,g(E)),yc(0,m(Gs)),bc("design:paramtypes",[Object])],Cc);var vc=function(t,e,i,r){var n,o=arguments.length,s=o<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,i,r);else for(var a=t.length-1;a>=0;a--)(n=t[a])&&(s=(o<3?n(s):o>3?n(e,i,s):n(e,i))||s);return o>3&&s&&Object.defineProperty(e,i,s),s},wc=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},xc=function(t,e){return function(i,r){e(i,r,t)}};let _c=class extends gh{constructor(t){super(),this.symbolRenderContribitions=t,this.numberType=is,this.builtinContributions=[Wh,Gh,Nh],this.init(t)}drawShape(t,e,i,r,n,o,s,a){var l;const h=Cn(t,null==o?void 0:o.theme).symbol,{size:c=h.size,x:d=h.x,y:u=h.y,scaleX:g=h.scaleX,scaleY:p=h.scaleY}=t.attribute,f=this.valid(t,h,s,a);if(!f)return;const{fVisible:m,sVisible:b,doFill:y,doStroke:C}=f,v=t.getParsedPath();if(!v)return;const{keepDirIn3d:w=h.keepDirIn3d}=t.attribute,x=null!==(l=this.z)&&void 0!==l?l:0;if(e.beginPath(),w&&e.camera&&e.project){const n=e.project(i,r,x),o=e.camera;e.camera=null,!1===v.draw(e,it(c)?[c[0]*g,c[1]*p]:c*g,n.x,n.y,void 0,((n,o)=>{var l,c,f;if(t._parsedPath.svgCache){const e=Object.assign({},o);e.fill=null!==(l=o.fill)&&void 0!==l?l:t.attribute.fill,e.opacity=null!==(c=o.fill)&&void 0!==c?c:t.attribute.opacity,e.fillOpacity=t.attribute.fillOpacity,e.stroke=null!==(f=o.stroke)&&void 0!==f?f:t.attribute.stroke,o=e}o.fill&&(s?s(e,t.attribute,h):(e.setCommonStyle(t,o,d-i,u-r,h),e.fill())),o.stroke&&(a?a(e,t.attribute,h):(e.setStrokeStyle(t,o,(d-i)/g,(u-r)/p,h),e.stroke()))}))&&e.closePath(),e.camera=o}else!1===v.draw(e,c,i,r,x,((n,o)=>{var l,c,f;if(t._parsedPath.svgCache){const e=Object.assign({},o);e.fill=null!==(l=o.fill)&&void 0!==l?l:t.attribute.fill,e.opacity=null!==(c=o.opacity)&&void 0!==c?c:t.attribute.opacity,e.fillOpacity=t.attribute.fillOpacity,e.stroke=null!==(f=o.stroke)&&void 0!==f?f:t.attribute.stroke,o=e}o.fill&&(s?s(e,t.attribute,h):(e.setCommonStyle(t,o,d-i,u-r,h),e.fill())),o.stroke&&(a?a(e,t.attribute,h):(e.setStrokeStyle(t,o,(d-i)/g,(u-r)/p,h),e.stroke()))}))&&e.closePath();e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,h),this.beforeRenderStep(t,e,i,r,y,C,m,b,h,n,s,a),y&&!v.isSvg&&(s?s(e,t.attribute,h):m&&(e.setCommonStyle(t,t.attribute,d-i,u-r,h),e.fill())),C&&!v.isSvg&&(a?a(e,t.attribute,h):b&&(e.setStrokeStyle(t,t.attribute,(d-i)/g,(u-r)/p,h),e.stroke())),this.afterRenderStep(t,e,i,r,y,C,m,b,h,n,s,a)}draw(t,e,i,r){const n=Cn(t,null==r?void 0:r.theme).symbol;this._draw(t,n,!1,i,r)}};_c=vc([f(),xc(0,g(E)),xc(0,m(js)),wc("design:paramtypes",[Object])],_c);const Sc=new class extends Ch{constructor(){super(...arguments),this.time=Ti.beforeFillStroke}drawShape(t,e,i,r,n,o,s,a,l,h,c,d){const{background:u,backgroundMode:g=l.backgroundMode,backgroundFit:p=l.backgroundFit}=t.attribute;if(!u)return;const f=t.AABBBounds;if(t.backgroundImg&&t.resources){const i=t.resources.get(u);if("success"!==i.state||!i.data)return;e.highPerformanceSave(),e.setTransformFromMatrix(t.parent.globalTransMatrix,!0),this.doDrawImage(e,i.data,f,g,p),e.highPerformanceRestore(),e.setTransformForCurrent()}else e.highPerformanceSave(),e.fillStyle=u,e.fillRect(f.x1,f.y1,f.width(),f.height()),e.highPerformanceRestore()}};var Ac=function(t,e,i,r){var n,o=arguments.length,s=o<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,i,r);else for(var a=t.length-1;a>=0;a--)(n=t[a])&&(s=(o<3?n(s):o>3?n(e,i,s):n(e,i))||s);return o>3&&s&&Object.defineProperty(e,i,s),s},Bc=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Tc=function(t,e){return function(i,r){e(i,r,t)}};let Mc=class extends gh{constructor(t){super(),this.textRenderContribitions=t,this.numberType=rs,this.builtinContributions=[Sc],this.init(t)}drawShape(t,e,i,r,n,o,s,a){var l,h,c;const d=Cn(t,null==o?void 0:o.theme).text,{text:u,underline:g=d.underline,lineThrough:p=d.lineThrough,keepDirIn3d:f=d.keepDirIn3d,direction:m=d.direction,whiteSpace:b=d.whiteSpace,fontSize:y=d.fontSize,verticalMode:C=d.verticalMode,x:v=d.x,y:w=d.y}=t.attribute;let{textAlign:x=d.textAlign,textBaseline:_=d.textBaseline}=t.attribute;if(!C&&"vertical"===m){const e=x;x=null!==(l=t.getBaselineMapAlign()[_])&&void 0!==l?l:"left",_=null!==(h=t.getAlignMapBaseline()[e])&&void 0!==h?h:"top"}const S=null!==(c=no(t.attribute.lineHeight,y))&&void 0!==c?c:y,A=this.valid(t,d,s,a);if(!A)return;const{fVisible:B,sVisible:T,doFill:M,doStroke:R}=A,P=!f,E=this.z||0;e.beginPath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,d),this.beforeRenderStep(t,e,i,r,M,R,B,T,d,n,s,a),P&&this.transformUseContext2d(t,d,E,e);const H=(n,o,l,h)=>{let c=i+o;const u=r+l;if(h){e.highPerformanceSave(),c+=y;const t=Ql.allocate(1,0,0,1,0,0);t.rotateByCenter(Math.PI/2,c,u),e.transformFromMatrix(t,!0),Ql.free(t)}R&&(a?a(e,t.attribute,d):T&&(e.setStrokeStyle(t,t.attribute,v-i,w-r,d),e.strokeText(n,c,u,E))),M&&(s?s(e,t.attribute,d):B&&(e.setCommonStyle(t,t.attribute,v-i,w-r,d),e.fillText(n,c,u,E),this.drawUnderLine(g,p,t,c,u,E,d,e))),h&&(e.highPerformanceRestore(),e.setTransformForCurrent())};if(t.isMultiLine)if(e.setTextStyleWithoutAlignBaseline(t.attribute,d,E),"horizontal"===m){const{multilineLayout:n}=t;if(!n)return void e.highPerformanceRestore();const{xOffset:o,yOffset:l}=n.bbox;R&&(a?a(e,t.attribute,d):T&&(e.setStrokeStyle(t,t.attribute,v-i,w-r,d),n.lines.forEach((t=>{e.strokeText(t.str,(t.leftOffset||0)+o+i,(t.topOffset||0)+l+r,E)})))),M&&(s?s(e,t.attribute,d):B&&(e.setCommonStyle(t,t.attribute,v-i,w-r,d),n.lines.forEach((n=>{e.fillText(n.str,(n.leftOffset||0)+o+i,(n.topOffset||0)+l+r,E),this.drawMultiUnderLine(g,p,t,(n.leftOffset||0)+i,(n.topOffset||0)+l+r,E,n.width,d,e)}))))}else{t.tryUpdateAABBBounds();const i=t.cache,{verticalList:r}=i;e.textAlign="left",e.textBaseline="top";const n=S*r.length;let o=0;r.forEach((t=>{const e=t.reduce(((t,e)=>t+(e.width||0)),0);o=ee(e,o)}));let s=0,a=0;"bottom"===_?a=-n:"middle"===_&&(a=-n/2),"center"===x?s-=o/2:"right"===x&&(s-=o),r.forEach(((t,e)=>{const i=t.reduce(((t,e)=>t+(e.width||0)),0),r=o-i;let l=s;"center"===x?l+=r/2:"right"===x&&(l+=r),t.forEach((t=>{const{text:i,width:r,direction:o}=t;H(i,n-(e+1)*S+a,l,o),l+=r}))}))}else if("horizontal"===m){e.setTextStyle(t.attribute,d,E);const i=t.clipedText;let r=0;S!==y&&("top"===_?r=(S-y)/2:"middle"===_||"bottom"===_&&(r=-(S-y)/2)),H(i,0,r,0)}else{t.tryUpdateAABBBounds();const i=t.cache;if(i){e.setTextStyleWithoutAlignBaseline(t.attribute,d,E);const{verticalList:r}=i;let n=0;const o=r[0].reduce(((t,e)=>t+(e.width||0)),0);let s=0;"bottom"===_?s=-S:"middle"===_&&(s=-S/2),"center"===x?n-=o/2:"right"===x&&(n-=o),e.textAlign="left",e.textBaseline="top",r[0].forEach((t=>{const{text:e,width:i,direction:r}=t;H(e,s,n,r),n+=i}))}}P&&this.restoreTransformUseContext2d(t,d,E,e),this.afterRenderStep(t,e,i,r,M,R,B,T,d,n,s,a)}draw(t,e,i,r){const n=Cn(t,null==r?void 0:r.theme).text,{keepDirIn3d:o=n.keepDirIn3d}=t.attribute,s=!o;this._draw(t,n,s,i,r)}drawUnderLine(t,e,i,r,n,o,s,a){if(e+t<=0)return;const{textAlign:l=s.textAlign,textBaseline:h=s.textBaseline,fontSize:c=s.fontSize,fill:d=s.fill,opacity:u=s.opacity,fillOpacity:g=s.fillOpacity}=i.attribute,p=i.clipedWidth,f=qs(l,p),m=Zs(h,c,c),b={lineWidth:0,stroke:d,opacity:u,strokeOpacity:g};if(t){b.lineWidth=t,a.setStrokeStyle(i,b,r,n,s),a.beginPath();const e=n+m+c;a.moveTo(r+f,e,o),a.lineTo(r+f+p,e,o),a.stroke()}if(e){b.lineWidth=e,a.setStrokeStyle(i,b,r,n,s),a.beginPath();const t=n+m+c/2;a.moveTo(r+f,t,o),a.lineTo(r+f+p,t,o),a.stroke()}}drawMultiUnderLine(t,e,i,r,n,o,s,a,l){if(e+t<=0)return;const{textAlign:h=a.textAlign,fontSize:c=a.fontSize,fill:d=a.fill,opacity:u=a.opacity,fillOpacity:g=a.fillOpacity}=i.attribute,p=qs(h,s),f=Zs("alphabetic",c,c),m={lineWidth:0,stroke:d,opacity:u,strokeOpacity:g};let b=-3;if(t){m.lineWidth=t,l.setStrokeStyle(i,m,r,n,a),l.beginPath();const e=n+f+c+b;l.moveTo(r+p,e,o),l.lineTo(r+p+s,e,o),l.stroke()}if(b=-1,e){m.lineWidth=e,l.setStrokeStyle(i,m,r,n,a),l.beginPath();const t=n+f+c/2+b;l.moveTo(r+p,t,o),l.lineTo(r+p+s,t,o),l.stroke()}}};function Rc(t,e,i,r){t.moveTo(e[0].x+i,e[0].y+r);for(let n=1;n<e.length;n++)t.lineTo(e[n].x+i,e[n].y+r)}function Pc(t,e){return Math.sqrt(t*t+e*e)}function Ec(t,e,i,r,n){const o=e/i;return{x:t.x-r*o,y:t.y-n*o}}Mc=Ac([f(),Tc(0,g(E)),Tc(0,m(Us)),Bc("design:paramtypes",[Object])],Mc);const Hc=_h,Lc=vh;var kc=function(t,e,i,r){var n,o=arguments.length,s=o<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,i,r);else for(var a=t.length-1;a>=0;a--)(n=t[a])&&(s=(o<3?n(s):o>3?n(e,i,s):n(e,i))||s);return o>3&&s&&Object.defineProperty(e,i,s),s},Ic=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Fc=function(t,e){return function(i,r){e(i,r,t)}};let zc=class extends gh{constructor(t){super(),this.polygonRenderContribitions=t,this.numberType=Zo,this.builtinContributions=[Lc,Hc],this.init(t)}drawShape(t,e,i,r,n,o,s,a){const l=Cn(t,null==o?void 0:o.theme).polygon,{points:h=l.points,cornerRadius:c=l.cornerRadius,x:d=l.x,y:u=l.y,closePath:g=l.closePath}=t.attribute,p=this.valid(t,l,s,a);if(!p)return;const{fVisible:f,sVisible:m,doFill:b,doStroke:y}=p;e.beginPath(),c<=0||it(c)&&c.every((t=>0===t))?Rc(e.camera?e:e.nativeContext,h,i,r):function(t,e,i,r,n){let o=!(arguments.length>5&&void 0!==arguments[5])||arguments[5];var s;if(e.length<3)return void Rc(t,e,i,r);let a=0,l=e.length-1;o||(a+=1,l-=1,t.moveTo(e[0].x+i,e[0].y+r));for(let o=a;o<=l;o++){const a=e[0===o?l:(o-1)%e.length],h=e[o%e.length],c=e[(o+1)%e.length],d=h.x-a.x,u=h.y-a.y,g=h.x-c.x,p=h.y-c.y,f=(Math.atan2(u,d)-Math.atan2(p,g))/2,m=Math.abs(Math.tan(f));let b=Array.isArray(n)?null!==(s=n[o%e.length])&&void 0!==s?s:0:n,y=b/m;const C=Pc(d,u),v=Pc(g,p),w=Math.min(C,v);y>w&&(y=w,b=w*m);const x=Ec(h,y,C,d,u),_=Ec(h,y,v,g,p),S=2*h.x-x.x-_.x,A=2*h.y-x.y-_.y,B=Pc(S,A),T=Ec(h,Pc(y,b),B,S,A);let M=Math.atan2(x.y-T.y,x.x-T.x);const R=Math.atan2(_.y-T.y,_.x-T.x);let P=R-M;P<0&&(M=R,P=-P),P>Math.PI&&(P-=Math.PI),0===o?t.moveTo(x.x+i,x.y+r):t.lineTo(x.x+i,x.y+r),P&&t.arcTo(h.x+i,h.y+r,_.x+i,_.y+r,b),t.lineTo(_.x+i,_.y+r)}o||t.lineTo(e[l+1].x+i,e[l+1].y+r)}(e.camera?e:e.nativeContext,h,i,r,c,g),g&&e.closePath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,i,r,b,y,f,m,l,n,s,a),b&&(s?s(e,t.attribute,l):f&&(e.setCommonStyle(t,t.attribute,d-i,u-r,l),e.fill())),y&&(a?a(e,t.attribute,l):m&&(e.setStrokeStyle(t,t.attribute,d-i,u-r,l),e.stroke())),this.afterRenderStep(t,e,i,r,b,y,f,m,l,n,s,a)}draw(t,e,i,r){const n=Cn(t,null==r?void 0:r.theme).polygon;this._draw(t,n,!1,i,r)}};zc=kc([f(),Fc(0,g(E)),Fc(0,m(Ns)),Ic("design:paramtypes",[Object])],zc);var Oc=function(t,e,i,r){var n,o=arguments.length,s=o<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,i,r);else for(var a=t.length-1;a>=0;a--)(n=t[a])&&(s=(o<3?n(s):o>3?n(e,i,s):n(e,i))||s);return o>3&&s&&Object.defineProperty(e,i,s),s},Dc=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Wc=function(t,e){return function(i,r){e(i,r,t)}};const Nc=["","repeat-x","repeat-y","repeat"];let Gc=class extends gh{constructor(t){super(),this.imageRenderContribitions=t,this.numberType=Xo,this.builtinContributions=[Lh],this.init(t)}drawShape(t,e,i,r,n,o,s){const a=Cn(t).image,{width:l=a.width,height:h=a.height,repeatX:c=a.repeatX,repeatY:d=a.repeatY,cornerRadius:u=a.cornerRadius,image:g}=t.attribute,p=this.valid(t,a,s);if(!p)return;const{fVisible:f,sVisible:m,doFill:b,doStroke:y}=p;if(e.setShadowBlendStyle&&e.setShadowBlendStyle(t,a),this.beforeRenderStep(t,e,i,r,b,!1,f,!1,a,n,s),b)if(s)s(e,t.attribute,a);else if(f){if(!g||!t.resources)return;const n=t.resources.get(g);if("success"!==n.state)return;let o=!1;0===u||it(u)&&u.every((t=>0===t))||(e.beginPath(),Hh(e,i,r,l,h,u),e.save(),e.clip(),o=!0),e.setCommonStyle(t,t.attribute,i,r,a);let s=0;if("repeat"===c&&(s|=1),"repeat"===d&&(s|=2),s){const t=e.createPattern(n.data,Nc[s]);e.fillStyle=t,e.translate(i,r,!0),e.fillRect(0,0,l,h),e.translate(-i,-r,!0)}else e.drawImage(n.data,i,r,l,h);o&&e.restore()}this.afterRenderStep(t,e,i,r,b,!1,f,!1,a,n,s)}draw(t,e,i){const{image:r}=t.attribute;if(!r||!t.resources)return;if("success"!==t.resources.get(r).state)return;const{context:n}=e.drawParams;if(!n)return;const o=Cn(t).image;this._draw(t,o,!1,i)}};Gc=Oc([f(),Wc(0,g(E)),Wc(0,m(Ds)),Dc("design:paramtypes",[Object])],Gc);const jc=Symbol.for("IncrementalDrawContribution"),Uc=Symbol.for("ArcRender"),Vc=Symbol.for("Arc3dRender"),Kc=Symbol.for("AreaRender"),$c=Symbol.for("CircleRender"),Xc=Symbol.for("GraphicRender"),Yc=Symbol.for("GroupRender"),qc=Symbol.for("LineRender"),Zc=Symbol.for("PathRender"),Jc=Symbol.for("PolygonRender"),Qc=Symbol.for("RectRender"),td=Symbol.for("Rect3DRender"),ed=Symbol.for("SymbolRender"),id=Symbol.for("TextRender"),rd=Symbol.for("RichTextRender"),nd=Symbol.for("Pyramid3dRender"),od=Symbol.for("GlyphRender"),sd=Symbol.for("ImageRender"),ad=Symbol.for("DrawContribution");var ld=function(t,e,i,r){var n,o=arguments.length,s=o<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,i,r);else for(var a=t.length-1;a>=0;a--)(n=t[a])&&(s=(o<3?n(s):o>3?n(e,i,s):n(e,i))||s);return o>3&&s&&Object.defineProperty(e,i,s),s},hd=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},cd=function(t,e){return function(i,r){e(i,r,t)}};const dd=Symbol.for("RenderService");let ud=class{constructor(t){this.drawContribution=t}prepare(t){t&&this.renderTreeRoots.forEach((e=>{this._prepare(e,t)}))}_prepare(t,e){t.forEachChildren((t=>{this._prepare(t,e)})),t.update({bounds:e,trans:!0})}prepareRenderList(){}beforeDraw(t){}draw(t){this.drawContribution.draw(this,Object.assign({},this.drawParams))}afterDraw(t){this.drawContribution.afterDraw&&this.drawContribution.afterDraw(this,Object.assign({},this.drawParams))}render(t,e){this.renderTreeRoots=t,this.drawParams=e;const i=e.updateBounds;this.prepare(i),this.prepareRenderList(),this.beforeDraw(e),this.draw(e),this.afterDraw(e)}};ud=ld([f(),cd(0,g(ad)),hd("design:paramtypes",[Object])],ud);var gd=new i((t=>{t(dd).to(ud).inSingletonScope()}));const pd=Symbol.for("PickerService"),fd=Symbol.for("GlobalPickerService");var md=function(t,e,i,r){var n,o=arguments.length,s=o<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,i,r);else for(var a=t.length-1;a>=0;a--)(n=t[a])&&(s=(o<3?n(s):o>3?n(e,i,s):n(e,i))||s);return o>3&&s&&Object.defineProperty(e,i,s),s};const bd=Symbol.for("PickItemInterceptor");let yd=class{constructor(){this.order=1}afterPickItem(t,e,i,r,n){return t.attribute.shadowRootIdx>0||!t.attribute.shadowRootIdx?this._pickItem(t,e,i,r,n):null}beforePickItem(t,e,i,r,n){return t.attribute.shadowRootIdx<0?this._pickItem(t,e,i,r,n):null}_pickItem(t,e,i,r,n){if(!t.shadowRoot)return null;const{parentMatrix:o}=n||{};if(!o)return null;const s=e.pickContext;s.highPerformanceSave();const a=t.shadowRoot,l=Ql.allocateByObj(o),h=new he(l.a*i.x+l.c*i.y+l.e,l.b*i.x+l.d*i.y+l.f),c=e.pickGroup(a,h,l,r);return s.highPerformanceRestore(),c}};yd=md([f()],yd);let Cd=class{constructor(){this.order=1}beforePickItem(t,e,i,r,n){const o=t.baseGraphic;if(o&&o.parent){const t=new he(i.x,i.y),n=e.pickContext;n.highPerformanceSave();const s=o.parent.globalTransMatrix;s.transformPoint(t,t);const a=o.isContainer?e.pickGroup(o,t.clone(),s,r):e.pickItem(o,t.clone(),s,r);return n.highPerformanceRestore(),a}return null}};Cd=md([f()],Cd);let vd=class{constructor(){this.order=1}beforePickItem(t,e,i,r,n){if(!t.in3dMode||r.in3dInterceptor)return null;const o=e.pickContext,s=t.stage;if(!o||!s)return null;if(r.in3dInterceptor=!0,o.save(),this.initCanvasCtx(o),o.camera=s.camera,t.isContainer){let s,a=!1,l=!1;if(t.forEachChildren((t=>(a=t.numberType===jo,!a))),t.forEachChildren((t=>(l=!!t.findFace,!l))),a){const o=t.getChildren(),a=[...o];a.sort(((t,e)=>{var i,r,n,o;let s=(null!==(r=null!==(i=t.attribute.startAngle)&&void 0!==i?i:0+t.attribute.endAngle)&&void 0!==r?r:0)/2,a=(null!==(o=null!==(n=e.attribute.startAngle)&&void 0!==n?n:0+e.attribute.endAngle)&&void 0!==o?o:0)/2;for(;s<0;)s+=Zt;for(;a<0;)a+=Zt;return a-s})),a.forEach((t=>{t._next=null,t._prev=null})),t.removeAllChild(),t.update(),a.forEach((e=>{t.appendChild(e)})),r.hack_pieFace="outside",s=e.pickGroup(t,i,n.parentMatrix,r),s.graphic||(r.hack_pieFace="inside",s=e.pickGroup(t,i,n.parentMatrix,r)),s.graphic||(r.hack_pieFace="top",s=e.pickGroup(t,i,n.parentMatrix,r)),t.removeAllChild(),o.forEach((t=>{t._next=null,t._prev=null})),o.forEach((e=>{t.appendChild(e)}))}else if(l){const a=t.getChildren(),l=a.map((t=>({ave_z:t.findFace().vertices.map((e=>{var i;return o.view(e[0],e[1],null!==(i=e[2]+t.attribute.z)&&void 0!==i?i:0)[2]})).reduce(((t,e)=>t+e),0),g:t})));l.sort(((t,e)=>e.ave_z-t.ave_z)),t.removeAllChild(),l.forEach((t=>{t.g._next=null,t.g._prev=null})),t.update(),l.forEach((e=>{t.add(e.g)})),s=e.pickGroup(t,i,n.parentMatrix,r),t.removeAllChild(),a.forEach((t=>{t._next=null,t._prev=null})),t.update(),a.forEach((e=>{t.add(e)}))}else s=e.pickGroup(t,i,n.parentMatrix,r);return o.camera=null,r.in3dInterceptor=!1,o.restore(),s}return o.restore(),null}initCanvasCtx(t){t.setTransformForCurrent()}};vd=md([f()],vd);var wd=new i(((t,e,i)=>{i(pd)||(t(fd).toSelf(),t(pd).toService(fd)),t(vd).toSelf().inSingletonScope(),t(bd).toService(vd),t(yd).toSelf().inSingletonScope(),t(bd).toService(yd),t(Cd).toSelf().inSingletonScope(),t(bd).toService(Cd),L(t,bd)})),xd=new i((t=>{t(ns).to(lh).inSingletonScope(),t(os).toConstantValue(hh)}));const _d=Symbol.for("AutoEnablePlugins"),Sd=Symbol.for("PluginService");var Ad=function(t,e,i,r){var n,o=arguments.length,s=o<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,i,r);else for(var a=t.length-1;a>=0;a--)(n=t[a])&&(s=(o<3?n(s):o>3?n(e,i,s):n(e,i))||s);return o>3&&s&&Object.defineProperty(e,i,s),s},Bd=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Td=function(t,e){return function(i,r){e(i,r,t)}};let Md=class{constructor(t){this.autoEnablePlugins=t,this.onStartupFinishedPlugin=[],this.onRegisterPlugin=[],this.actived=!1}active(t,e){this.stage=t,this.actived=!0;const{pluginList:i}=e;i&&Yr.isBound(_d)&&this.autoEnablePlugins.getContributions().forEach((t=>{i.includes(t.name)&&this.register(t)}))}findPluginsByName(t){const e=[];return this.onStartupFinishedPlugin.forEach((i=>{i.name===t&&e.push(i)})),this.onRegisterPlugin.forEach((i=>{i.name===t&&e.push(i)})),e}register(t){"onStartupFinished"===t.activeEvent?this.onStartupFinishedPlugin.push(t):"onRegister"===t.activeEvent&&(this.onRegisterPlugin.push(t),t.activate(this))}unRegister(t){"onStartupFinished"===t.activeEvent?this.onStartupFinishedPlugin.splice(this.onStartupFinishedPlugin.indexOf(t),1):"onRegister"===t.activeEvent&&this.onRegisterPlugin.splice(this.onStartupFinishedPlugin.indexOf(t),1),t.deactivate(this)}release(){this.onStartupFinishedPlugin.forEach((t=>{t.deactivate(this)})),this.onStartupFinishedPlugin=[],this.onRegisterPlugin.forEach((t=>{t.deactivate(this)})),this.onRegisterPlugin=[]}};Md=Ad([f(),Td(0,g(E)),Td(0,m(_d)),Bd("design:paramtypes",[Object])],Md);var Rd=new i((t=>{t(Sd).to(Md),function(t,e){t(E).toDynamicValue((t=>{let{container:i}=t;return new H(e,i)})).whenTargetNamed(e)}(t,_d)})),Pd=new i((t=>{L(t,F)})),Ed=new i((t=>{t($r).to(Xr).inSingletonScope(),L(t,$r)})),Hd=function(t,e,i,r){var n,o=arguments.length,s=o<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,i,r);else for(var a=t.length-1;a>=0;a--)(n=t[a])&&(s=(o<3?n(s):o>3?n(e,i,s):n(e,i))||s);return o>3&&s&&Object.defineProperty(e,i,s),s},Ld=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let kd=class{constructor(){this.type="static",this.offscreen=!1,this.global=kr.global}setDpr(t){this.canvas.dpr=t}init(t,e,i){if(this.layer=t,this.window=e,i.main)this.main=!0,this.context=e.getContext(),this.canvas=this.context.getCanvas();else{let t;this.main=!1,i.canvasId&&(t=this.global.getElementById(i.canvasId)),t||(t=this.global.createCanvas({width:e.width,height:e.height})),t.style&&(t.style["pointer-events"]="none");const r=e.getContext().getCanvas().nativeCanvas,n=Jr({nativeCanvas:t,width:e.width,height:e.height,dpr:e.dpr,id:i.canvasId,canvasControled:!0,container:e.getContainer(),x:r.offsetLeft,y:r.offsetTop});n.applyPosition(),this.canvas=n,this.context=n.getContext()}}resize(t,e){this.canvas.resize(t,e)}resizeView(t,e){}render(t,e,i){var r;if(!this.main){const t=this.window.getContext().getCanvas().nativeCanvas;!t||this.canvas.x===t.offsetLeft&&this.canvas.y===t.offsetTop||(this.canvas.x=t.offsetLeft,this.canvas.y=t.offsetTop,this.canvas.applyPosition())}e.renderService.render(t,Object.assign(Object.assign({context:this.context,clear:null!==(r=e.background)&&void 0!==r?r:"#ffffff"},e),i))}merge(t){t.forEach((t=>{const e=t.getContext().canvas.nativeCanvas;this.context.drawImage(e,0,0)}))}prepare(t,e){}drawTo(t,e,i){var r;const n=t.getContext();i.renderService.render(e,Object.assign(Object.assign({context:n},i),{clear:i.clear?null!==(r=i.background)&&void 0!==r?r:"#fff":void 0}))}getContext(){return this.context}release(){this.canvas.release()}};kd=Hd([f(),Ld("design:paramtypes",[])],kd);var Id=function(t,e,i,r){var n,o=arguments.length,s=o<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,i,r);else for(var a=t.length-1;a>=0;a--)(n=t[a])&&(s=(o<3?n(s):o>3?n(e,i,s):n(e,i))||s);return o>3&&s&&Object.defineProperty(e,i,s),s},Fd=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let zd=class{constructor(){this.offscreen=!1,this.type="virtual",this.global=kr.global}setDpr(t){}init(t,e,i){if(this.layer=t,this.window=e,i.main)throw new Error("virtual layer不能作为main layer");this.main=!1,this.canvas=null,this.context=null}resize(t,e){}resizeView(t,e){}render(t,e,i){this.mainHandler.render(t,e,Object.assign(Object.assign({},i),{clear:!1}))}merge(t){}prepare(t,e){}drawTo(t,e,i){var r;const n=t.getContext();i.renderService.render(e,Object.assign(Object.assign({context:n},i),{clear:i.clear?null!==(r=i.background)&&void 0!==r?r:"#fff":void 0}))}getContext(){return null}release(){}};zd=Id([f(),Fd("design:paramtypes",[])],zd);var Od=function(t,e,i,r){var n,o=arguments.length,s=o<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,i,r);else for(var a=t.length-1;a>=0;a--)(n=t[a])&&(s=(o<3?n(s):o>3?n(e,i,s):n(e,i))||s);return o>3&&s&&Object.defineProperty(e,i,s),s},Dd=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let Wd=class{constructor(){this.offscreen=!0,this.type="dynamic",this.global=kr.global}setDpr(t){this.canvas.dpr=t}init(t,e,i){this.layer=t;const r=Jr({nativeCanvas:this.global.createOffscreenCanvas({width:i.width,height:i.height,dpr:e.dpr}),width:i.width,height:i.height,dpr:e.dpr,canvasControled:!0});this.canvas=r,this.context=r.getContext()}resize(t,e){this.canvas.resize(t,e)}resizeView(t,e){this.canvas.resize(t,e)}render(t,e){var i;e.renderService.render(t,Object.assign(Object.assign({context:this.context},e),{x:0,y:0,clear:null!==(i=e.background)&&void 0!==i?i:"#ffffff"}))}prepare(t,e){}release(){this.canvas.release()}getContext(){return this.context}drawTo(t,e,i){const r=t.getContext(),n=t.dpr,{x:o=0,y:s=0,width:a=this.layer.viewWidth,height:l=this.layer.viewHeight}=i;r.nativeContext.save(),r.nativeContext.setTransform(n,0,0,n,0,0),i.clear&&r.clearRect(o,s,a,l),r.drawImage(this.canvas.nativeCanvas,0,0,this.canvas.width,this.canvas.height,o,s,a,l),r.nativeContext.restore()}merge(t){}};Wd=Od([f(),Dd("design:paramtypes",[])],Wd);var Nd=new i((t=>{t(kd).toSelf(),t(Wd).toSelf(),t(zd).toSelf(),t(fs).toService(kd),t(ms).toService(Wd),t(bs).toService(zd)}));var Gd=function(t,e,i,r){return new(i||(i=Promise))((function(n,o){function s(t){try{l(r.next(t))}catch(t){o(t)}}function a(t){try{l(r.throw(t))}catch(t){o(t)}}function l(t){var e;t.done?n(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(s,a)}l((r=r.apply(t,e||[])).next())}))};function jd(t,e,i){let r=arguments.length>3&&void 0!==arguments[3]&&arguments[3],n=arguments.length>4&&void 0!==arguments[4]&&arguments[4];const o={},s=[];let a=!1;if(n)a=!0;else{let i;t.forEachChildren(((t,r)=>{const{zIndex:n=e}=t.attribute;if(0===r)i=n;else if(i!==n)return a=!0,!0;return!1}),r)}if(a){t.forEachChildren((t=>{const{zIndex:i=e}=t.attribute;o[i]?o[i].push(t):(o[i]=[t],s.push(i))}),r),s.sort(((t,e)=>r?e-t:t-e));let a=!1;for(let t=0;t<s.length&&!a;t++){const e=s[t],l=o[e];n&&l.sort(((t,e)=>{var i,n;return(r?-1:1)*((null!==(i=e.attribute.z)&&void 0!==i?i:0)-(null!==(n=t.attribute.z)&&void 0!==n?n:0))}));for(let t=0;t<l.length;t++)if(i(l[t],t)){a=!0;break}}}else t.forEachChildren(i,r)}function Ud(t,e,i){let r=arguments.length>3&&void 0!==arguments[3]&&arguments[3];return Gd(this,void 0,void 0,(function*(){yield t.forEachChildrenAsync(i,r)}))}function Vd(t,e,i){let r=arguments.length>3&&void 0!==arguments[3]&&arguments[3];const n={},o=[];let s=!1;t.forEachChildren(((t,e)=>{const{zIndex:r=i}=t.attribute;if(0===e);else if(void 0!==r)return s=!0,!0;return!1}),r);let a=null,l=!1;if(s){t.forEachChildren((t=>{const{zIndex:e=i}=t.attribute;n[e]?n[e].push(t):(n[e]=[t],o.push(e))}),r),o.sort(((t,e)=>r?e-t:t-e));let s=!1;for(let t=0;t<o.length&&!s;t++){const i=o[t],r=n[i];for(let t=0;t<r.length;t++){if(l){s=!0,a=r[t];break}r[t]._uid!==e||(l=!0)}}}else t.forEachChildren((t=>l?(a=t,!0):(t._uid===e&&(l=!0),!1)),r);return a}var Kd=function(t,e,i,r){var n,o=arguments.length,s=o<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,i,r);else for(var a=t.length-1;a>=0;a--)(n=t[a])&&(s=(o<3?n(s):o>3?n(e,i,s):n(e,i))||s);return o>3&&s&&Object.defineProperty(e,i,s),s},$d=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const Xd=Symbol.for("DrawItemInterceptor"),Yd=new ge;class qd{constructor(){this.order=1}afterDrawItem(t,e,i,r,n){return(t.attribute.shadowRootIdx>0||!t.attribute.shadowRootIdx)&&this.drawItem(t,e,i,r,n),!1}beforeDrawItem(t,e,i,r,n){return t.attribute.shadowRootIdx<0&&this.drawItem(t,e,i,r,n),!1}drawItem(t,e,i,r,n){if(!t.shadowRoot)return!1;const{context:o}=i;if(o.highPerformanceSave(),o.transformFromMatrix(t.transMatrix,!0),r.dirtyBounds&&r.backupDirtyBounds){Yd.copy(r.dirtyBounds);const e=t.globalTransMatrix.getInverse();r.dirtyBounds.copy(r.backupDirtyBounds).transformWithMatrix(e)}return r.renderGroup(t.shadowRoot,i,t.parent.globalTransMatrix),o.highPerformanceRestore(),r.dirtyBounds&&r.backupDirtyBounds&&r.dirtyBounds.copy(Yd),!0}}class Zd{constructor(){this.order=1}afterDrawItem(t,e,i,r,n){return t.attribute._debug_bounds&&this.drawItem(t,e,i,r,n),!1}drawItem(t,e,i,r,n){if(!t.attribute._debug_bounds)return!1;const{context:o}=i;o.highPerformanceSave(),t.parent&&o.setTransformFromMatrix(t.parent.globalTransMatrix,!0),t.glyphHost&&t.glyphHost.parent&&o.setTransformFromMatrix(t.glyphHost.parent.globalTransMatrix,!0);const s=t.AABBBounds;return!0!==t.attribute._debug_bounds&&t.attribute._debug_bounds(o,t),o.strokeRect(s.x1,s.y1,s.width(),s.height()),o.highPerformanceRestore(),!0}}let Jd=class{constructor(){this.order=1,this.interceptors=[new qd,new tu,new Qd,new Zd]}afterDrawItem(t,e,i,r,n){for(let o=0;o<this.interceptors.length;o++)if(this.interceptors[o].afterDrawItem&&this.interceptors[o].afterDrawItem(t,e,i,r,n))return!0;return!1}beforeDrawItem(t,e,i,r,n){if((!t.in3dMode||i.in3dInterceptor)&&!t.shadowRoot&&!(t.baseGraphic||t.attribute.globalZIndex||t.interactiveGraphic))return!1;for(let o=0;o<this.interceptors.length;o++)if(this.interceptors[o].beforeDrawItem&&this.interceptors[o].beforeDrawItem(t,e,i,r,n))return!0;return!1}};Jd=Kd([f(),$d("design:paramtypes",[])],Jd);class Qd{constructor(){this.order=1}beforeDrawItem(t,e,i,r,n){return!this.processing&&(t.baseGraphic?this.beforeDrawInteractive(t,e,i,r,n):this.beforeSetInteractive(t,e,i,r,n))}beforeSetInteractive(t,e,i,r,n){let o=t.interactiveGraphic;if(t.attribute.globalZIndex){o||(o=t.clone(),t.interactiveGraphic=o,o.baseGraphic=t),o.setAttributes({globalZIndex:0,zIndex:t.attribute.globalZIndex},!1,{skipUpdateCallback:!0}),i.stage.tryInitInteractiveLayer();const e=i.stage.getLayer("_builtin_interactive");return e&&this.getShadowRoot(e).add(o),!0}if(o){i.stage.tryInitInteractiveLayer();const e=i.stage.getLayer("_builtin_interactive");e&&this.getShadowRoot(e).removeChild(o),t.interactiveGraphic=null,o.baseGraphic=null}return!1}beforeDrawInteractive(t,e,i,r,n){const o=t.baseGraphic;if(o){this.processing=!0;const{context:t}=i;return t.highPerformanceSave(),t.setTransformFromMatrix(o.parent.globalTransMatrix,!0),o.isContainer?r.renderGroup(o,i,o.parent.globalTransMatrix):r.renderItem(o,i),t.highPerformanceRestore(),this.processing=!1,!0}return!1}getShadowRoot(t){var e;let i=t.getElementById("_interactive_group");return i||(i=hh.CreateGraphic("group",{}),i.id="_interactive_group",t.add(i)),null!==(e=i.shadowRoot)&&void 0!==e?e:i.attachShadow()}}class tu{constructor(){this.order=1}beforeDrawItem(t,e,i,r,n){if(!t.in3dMode||i.in3dInterceptor)return!1;i.in3dInterceptor=!0;const{context:o,stage:s}=e.drawParams;o.canvas,o.save(),this.initCanvasCtx(o),o.camera=s.camera;const a=o.currentMatrix;a.a/=o.dpr,a.b/=o.dpr,a.c/=o.dpr,a.d/=o.dpr,a.e/=o.dpr,a.f/=o.dpr;const l=th.allocate();oh(l,a);const h=o.modelMatrix;if(h){if(l){const t=th.allocate();o.modelMatrix=sh(t,h,l)}}else o.modelMatrix=l;if(o.setTransform(1,0,0,1,0,0,!0),t.isContainer){let e=!1,n=!1;if(t.forEachChildren((t=>(e=t.numberType===jo,!e))),t.forEachChildren((t=>(n=!!t.findFace,!n))),e){const e=t.getChildren(),n=[...e];n.sort(((t,e)=>{var i,r,n,o;let s=((null!==(i=t.attribute.startAngle)&&void 0!==i?i:0)+(null!==(r=t.attribute.endAngle)&&void 0!==r?r:0))/2,a=((null!==(n=e.attribute.startAngle)&&void 0!==n?n:0)+(null!==(o=e.attribute.endAngle)&&void 0!==o?o:0))/2;for(;s<0;)s+=Zt;for(;a<0;)a+=Zt;return a-s})),n.forEach((t=>{t._next=null,t._prev=null})),t.removeAllChild(),t.update(),n.forEach((e=>{t.appendChild(e)}));const o=t.parent.globalTransMatrix;i.hack_pieFace="outside",r.renderGroup(t,i,o),i.hack_pieFace="inside",r.renderGroup(t,i,o),i.hack_pieFace="top",r.renderGroup(t,i,o),t.removeAllChild(),e.forEach((t=>{t._next=null,t._prev=null})),e.forEach((e=>{t.appendChild(e)}))}else if(n){const e=t.getChildren(),n=e.map((t=>({ave_z:t.findFace().vertices.map((e=>{var i;return o.view(e[0],e[1],null!==(i=e[2]+t.attribute.z)&&void 0!==i?i:0)[2]})).reduce(((t,e)=>t+e),0),g:t})));n.sort(((t,e)=>e.ave_z-t.ave_z)),t.removeAllChild(),n.forEach((t=>{t.g._next=null,t.g._prev=null})),t.update(),n.forEach((e=>{t.add(e.g)})),r.renderGroup(t,i,t.parent.globalTransMatrix,!0),t.removeAllChild(),e.forEach((t=>{t._next=null,t._prev=null})),t.update(),e.forEach((e=>{t.add(e)}))}else r.renderGroup(t,i,t.parent.globalTransMatrix)}else r.renderItem(t,i);return o.camera=null,o.restore(),o.modelMatrix!==h&&th.free(o.modelMatrix),o.modelMatrix=h,i.in3dInterceptor=!1,!0}initCanvasCtx(t){t.setTransformForCurrent()}}const eu=new class{constructor(){this.pools=[];for(let t=0;t<10;t++)this.pools.push(new ge)}allocate(t,e,i,r){if(!this.pools.length)return(new ge).setValue(t,e,i,r);const n=this.pools.pop();return n.x1=t,n.y1=e,n.x2=i,n.y2=r,n}allocateByObj(t){if(!this.pools.length)return new ge(t);const e=this.pools.pop();return e.x1=t.x1,e.y1=t.y1,e.x2=t.x2,e.y2=t.y2,e}free(t){this.pools.push(t)}get length(){return this.pools.length}release(){this.pools=[]}};var iu=function(t,e,i,r){var n,o=arguments.length,s=o<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,i,r);else for(var a=t.length-1;a>=0;a--)(n=t[a])&&(s=(o<3?n(s):o>3?n(e,i,s):n(e,i))||s);return o>3&&s&&Object.defineProperty(e,i,s),s},ru=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},nu=function(t,e){return function(i,r){e(i,r,t)}};let ou=class{constructor(t,e){this.contributions=t,this.drawItemInterceptorContributions=e,this.currentRenderMap=new Map,this.defaultRenderMap=new Map,this.styleRenderMap=new Map,this.dirtyBounds=new ue,this.backupDirtyBounds=new ue,this.global=kr.global,this.layerService=kr.layerService,this.init()}init(){this.contributions.forEach((t=>{if(t.style){const e=this.styleRenderMap.get(t.style)||new Map;e.set(t.numberType,t),this.styleRenderMap.set(t.style,e)}else this.defaultRenderMap.set(t.numberType,t)})),this.InterceptorContributions=this.drawItemInterceptorContributions.getContributions().sort(((t,e)=>t.order-e.order))}prepareForDraw(t,e){e.updateBounds?this.useDirtyBounds=!0:this.useDirtyBounds=!e.stage.params.optimize.disableCheckGraphicWidthOutRange}draw(t,e){this.prepareForDraw(t,e),e.drawContribution=this,this.currentRenderMap=this.styleRenderMap.get(e.renderStyle)||this.defaultRenderMap,this.currentRenderService=t;const{context:i,stage:r,x:n=0,y:o=0,width:s,height:a}=e;if(!i)return;const l=this.dirtyBounds.setValue(0,0,s,a);if(r.dirtyBounds&&!r.dirtyBounds.empty()){const t=Oe(l,r.dirtyBounds,!1);l.x1=Math.floor(t.x1),l.y1=Math.floor(t.y1),l.x2=Math.ceil(t.x2),l.y2=Math.ceil(t.y2)}const h=i.dpr%1;(h||.5!==h)&&(l.x1=Math.floor(l.x1*i.dpr)/i.dpr,l.y1=Math.floor(l.y1*i.dpr)/i.dpr,l.x2=Math.ceil(l.x2*i.dpr)/i.dpr,l.y2=Math.ceil(l.y2*i.dpr)/i.dpr),this.backupDirtyBounds.copy(l),i.inuse=!0,i.clearMatrix(),i.setTransformForCurrent(!0);const c=l.width()*i.dpr<i.canvas.width||l.height()*i.dpr<i.canvas.height;i.save(),i.translate(n,o,!0),c&&(i.beginPath(),i.rect(l.x1,l.y1,l.width(),l.height()),i.clip()),r.camera&&(this.dirtyBounds.setValue(-1/0,-1/0,1/0,1/0),this.backupDirtyBounds.setValue(-1/0,-1/0,1/0,1/0)),this.clearScreen(t,i,e),i.save(),t.renderTreeRoots.sort(((t,e)=>{var i,r;return(null!==(i=t.attribute.zIndex)&&void 0!==i?i:yr.zIndex)-(null!==(r=e.attribute.zIndex)&&void 0!==r?r:yr.zIndex)})).forEach((t=>{t.isContainer?this.renderGroup(t,e,Ql.allocate(1,0,0,1,0,0)):this.renderItem(t,e)})),i.restore(),i.restore(),i.draw(),i.inuse=!1}doRegister(){throw new Error("暂不支持")}_findNextGraphic(t){let e=t.parent,i=t._uid;for(;e;){const t=Vd(e,i,yr.zIndex);if(t)return t;i=e._uid,e=e.parent}return null}renderGroup(t,e,i,r){if(e.break||!1===t.attribute.visibleAll)return;if(t.incremental&&(null==e.startAtId||e.startAtId===t._uid))return e.break=!0,void this._increaseRender(t,e);if(this.useDirtyBounds&&!We(t.AABBBounds,this.dirtyBounds,!1))return;let n,o=i;if(this.useDirtyBounds){n=eu.allocateByObj(this.dirtyBounds);const e=t.transMatrix;o=Ql.allocateByObj(i).multiply(e.a,e.b,e.c,e.d,e.e,e.f),this.dirtyBounds.copy(this.backupDirtyBounds).transformWithMatrix(o.getInverse())}this.renderItem(t,e,{drawingCb:()=>{var i;r?t.forEachChildren((t=>{e.break||(t.isContainer?this.renderGroup(t,e,o):this.renderItem(t,e))})):jd(t,yr.zIndex,(t=>{e.break||(t.isContainer?this.renderGroup(t,e,o):this.renderItem(t,e))}),!1,!!(null===(i=e.context)||void 0===i?void 0:i.camera))}}),this.useDirtyBounds&&(this.dirtyBounds.copy(n),eu.free(n),Ql.free(o))}_increaseRender(t,e){const{layer:i,stage:r}=e,{subLayers:n}=i;let o=n.get(t._uid);o||(o={layer:this.layerService.createLayer(r),zIndex:n.size,group:t},n.set(t._uid,o));const s=o.layer.getNativeHandler().getContext(),a=o.drawContribution||Yr.get(jc);a.dirtyBounds.setValue(-1/0,-1/0,1/0,1/0),a.backupDirtyBounds.setValue(-1/0,-1/0,1/0,1/0),a.draw(this.currentRenderService,Object.assign(Object.assign({},e),{drawContribution:a,clear:"transparent",layer:o.layer,context:s,startAtId:t._uid,break:!1})),o.drawContribution=a;const l=this._findNextGraphic(t);if(l)if(l.isContainer&&l.incremental)this._increaseRender(l,e);else{let t=n.get(l._uid);t||(t={layer:this.layerService.createLayer(r),zIndex:n.size},n.set(l._uid,t));const i=t.layer.getNativeHandler().getContext();this.draw(this.currentRenderService,Object.assign(Object.assign({},e),{drawContribution:a,clear:"transparent",layer:t.layer,context:i,startAtId:l._uid,break:!1}))}}getRenderContribution(t){let e;return e||(e=this.selectRenderByNumberType(t.numberType)),e||(e=this.selectRenderByType(t.type)),e}renderItem(t,e,i){if(this.InterceptorContributions.length)for(let r=0;r<this.InterceptorContributions.length;r++){const n=this.InterceptorContributions[r];if(n.beforeDrawItem&&n.beforeDrawItem(t,this.currentRenderService,e,this,i))return}const r=this.getRenderContribution(t);if(!r)return;let n,o=!1;if(t.parent){const{scrollX:e=0,scrollY:i=0}=t.parent.attribute;if(o=!(!e&&!i),o){n=this.dirtyBounds.clone();const r=t.globalTransMatrix.getInverse();this.dirtyBounds.copy(this.backupDirtyBounds).transformWithMatrix(r),this.dirtyBounds.translate(-e,-i)}}if(this.useDirtyBounds&&!t.isContainer&&!We(t.AABBBounds,this.dirtyBounds,!1))return void(o&&this.dirtyBounds.copy(n));const s=null!=e.startAtId&&t._uid!==e.startAtId;if(t._uid===e.startAtId&&(e.startAtId=null),i&&(i.skipDraw=s),s?t.isContainer&&r.draw(t,this.currentRenderService,e,i):r.draw(t,this.currentRenderService,e,i),o&&this.dirtyBounds.copy(n),this.InterceptorContributions.length)for(let i=0;i<this.InterceptorContributions.length;i++){const r=this.InterceptorContributions[i];if(r.afterDrawItem&&r.afterDrawItem(t,this.currentRenderService,e,this))return}}selectRenderByType(t){return Ze.getInstance().warn("未知错误,不应该走到这里"),null}selectRenderByNumberType(t){return this.currentRenderMap.get(t)||this.defaultRenderMap.get(t)}clearScreen(t,e,i){var r;const{clear:n}=i;if(n){const o=e.getCanvas(),{width:s=o.width,height:a=o.height}=i,l=0,h=0;e.clearRect(l,h,s,a);const c=null===(r=t.drawParams)||void 0===r?void 0:r.stage;if(c&&c.backgroundImg&&c.resources){const t=c.resources.get(n);t&&"success"===t.state&&t.data&&e.drawImage(t.data,l,h,s,a)}else e.fillStyle=fh(e,n,{AABBBounds:{x1:l,y1:h,x2:l+s,y2:h+a}},0,0),e.fillRect(l,h,s,a)}}afterDraw(t,e){}};ou=iu([f(),nu(0,p(Xc)),nu(1,g(E)),nu(1,m(Xd)),ru("design:paramtypes",[Array,Object])],ou);var su=function(t,e,i,r){var n,o=arguments.length,s=o<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,i,r);else for(var a=t.length-1;a>=0;a--)(n=t[a])&&(s=(o<3?n(s):o>3?n(e,i,s):n(e,i))||s);return o>3&&s&&Object.defineProperty(e,i,s),s},au=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},lu=function(t,e){return function(i,r){e(i,r,t)}};let hu=class{constructor(t){this.groupRenderContribitions=t,this.numberType=$o}drawShape(t,e,i,r,n,o,s,a){const l=Cn(t,null==o?void 0:o.theme).group,{fill:h=l.fill,background:c,stroke:d=l.stroke,opacity:u=l.opacity,width:g=l.width,height:p=l.height,clip:f=l.clip,fillOpacity:m=l.fillOpacity,strokeOpacity:b=l.strokeOpacity,cornerRadius:y=l.cornerRadius,path:C=l.path,lineWidth:v=l.lineWidth,visible:w=l.visible}=t.attribute,x=Bs(u,m,g,p,h),_=Ms(u,b,g,p),S=_s(h,c),A=Ss(d,v);if(!t.valid||!w)return;if(!f){if(!S&&!A)return;if(!(x||_||s||a||c))return}if(C&&C.length&&n.drawContribution){const t=e.disableFill,i=e.disableStroke,r=e.disableBeginPath;e.disableFill=!0,e.disableStroke=!0,e.disableBeginPath=!0,C.forEach((t=>{n.drawContribution.getRenderContribution(t).draw(t,n.renderService,n,o)})),e.disableFill=t,e.disableStroke=i,e.disableBeginPath=r}else 0===y||it(y)&&y.every((t=>0===t))?(e.beginPath(),e.rect(i,r,g,p)):(e.beginPath(),Hh(e,i,r,g,p,y));this._groupRenderContribitions||(this._groupRenderContribitions=this.groupRenderContribitions.getContributions()||[],this._groupRenderContribitions.push(Ph));const B={doFill:S,doStroke:A};this._groupRenderContribitions.forEach((o=>{o.time===Ti.beforeFillStroke&&o.drawShape(t,e,i,r,S,A,x,_,l,n,s,a,B)})),f&&e.clip(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),B.doFill&&(s?s(e,t.attribute,l):x&&(e.setCommonStyle(t,t.attribute,i,r,l),e.fill())),B.doStroke&&(a?a(e,t.attribute,l):_&&(e.setStrokeStyle(t,t.attribute,i,r,l),e.stroke())),this._groupRenderContribitions.forEach((o=>{o.time===Ti.afterFillStroke&&o.drawShape(t,e,i,r,S,A,x,_,l,n,s,a)}))}draw(t,e,i,r){const{context:n}=i;if(!n)return;const{clip:o}=t.attribute;o?n.save():n.highPerformanceSave();const s=Cn(t,null==r?void 0:r.theme).group,a=n.modelMatrix;if(n.camera){const e=th.allocate(),i=th.allocate();ah(i,t,s),sh(e,a||e,i),n.modelMatrix=e,th.free(i),n.setTransform(1,0,0,1,0,0,!0)}else n.transformFromMatrix(t.transMatrix,!0);n.beginPath(),r.skipDraw?this.drawShape(t,n,0,0,i,r,(()=>!1),(()=>!1)):this.drawShape(t,n,0,0,i);const{scrollX:l=s.scrollX,scrollY:h=s.scrollY}=t.attribute;let c;(l||h)&&n.translate(l,h),r&&r.drawingCb&&(c=r.drawingCb()),n.modelMatrix!==a&&th.free(n.modelMatrix),n.modelMatrix=a,c&&c.then?c.then((()=>{o?n.restore():n.highPerformanceRestore()})):o?n.restore():n.highPerformanceRestore()}};hu=su([f(),lu(0,g(E)),lu(0,m(Os)),au("design:paramtypes",[Object])],hu);var cu=function(t,e,i,r){var n,o=arguments.length,s=o<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,i,r);else for(var a=t.length-1;a>=0;a--)(n=t[a])&&(s=(o<3?n(s):o>3?n(e,i,s):n(e,i))||s);return o>3&&s&&Object.defineProperty(e,i,s),s};let du=class extends tc{constructor(){super(...arguments),this.numberType=Yo}drawShape(t,e,i,r,n,o,s,a){if(t.incremental&&n.multiGraphicOptions){const{startAtIdx:e,length:o}=n.multiGraphicOptions,{segments:l=[]}=t.attribute;if(e>l.length)return;const h=Cn(t).line,{fill:c=h.fill,stroke:d=h.stroke,opacity:u=h.opacity,fillOpacity:g=h.fillOpacity,strokeOpacity:p=h.strokeOpacity,lineWidth:f=h.lineWidth,visible:m=h.visible}=t.attribute,b=As(u,g,c),y=Ts(u,p),C=_s(c),v=Ss(d,f);if(!t.valid||!m)return;if(!C&&!v)return;if(!(b||y||s||a))return;const{context:w}=n;for(let n=e;n<e+o;n++)this.drawIncreaseSegment(t,w,l[n-1],l[n],t.attribute.segments[n],[h,t.attribute],i,r)}else super.drawShape(t,e,i,r,n,o,s,a)}drawIncreaseSegment(t,e,i,r,n,o,s,a){r&&(e.beginPath(),function(t,e,i,r){const{offsetX:n=0,offsetY:o=0}=r||{},s=e?e.points[e.points.length-1]:i.points[0];t.moveTo(s.x+n,s.y+o),i.points.forEach((e=>{!1!==e.defined?t.lineTo(e.x+n,e.y+o):t.moveTo(e.x+n,e.y+o)}))}(e.nativeContext,i,r,{offsetX:s,offsetY:a}),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,n,o),e.setStrokeStyle(t,n,s,a,o),e.stroke())}};du=cu([f()],du);var uu=function(t,e,i,r){var n,o=arguments.length,s=o<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,i,r);else for(var a=t.length-1;a>=0;a--)(n=t[a])&&(s=(o<3?n(s):o>3?n(e,i,s):n(e,i))||s);return o>3&&s&&Object.defineProperty(e,i,s),s};let gu=class extends hc{constructor(){super(...arguments),this.numberType=Uo}drawShape(t,e,i,r,n,o,s){if(t.incremental&&n.multiGraphicOptions){const{startAtIdx:o,length:a}=n.multiGraphicOptions,{segments:l=[]}=t.attribute;if(o>l.length)return;const h=Cn(t).area,{fill:c=h.fill,fillOpacity:d=h.fillOpacity,opacity:u=h.opacity,visible:g=h.visible}=t.attribute,p=As(u,d,c),f=_s(c);if(!t.valid||!g)return;if(!f)return;if(!p&&!s)return;for(let n=o;n<o+a;n++)this.drawIncreaseSegment(t,e,l[n-1],l[n],t.attribute.segments[n],[h,t.attribute],i,r)}else super.drawShape(t,e,i,r,n,o,s)}drawIncreaseSegment(t,e,i,r,n,o,s,a){r&&(e.beginPath(),function(t,e,i,r){const{offsetX:n=0,offsetY:o=0}=r||{},{points:s}=i,a=[];for(let t=0;t<s.length;t++)s[t].defined;a.push(s),a.forEach(((i,r)=>{var s,a,l,h;const c=e&&0===r?e.points[e.points.length-1]:i[0];t.moveTo(c.x+n,c.y+o),i.forEach((e=>{!1!==e.defined?t.lineTo(e.x+n,e.y+o):t.moveTo(e.x+n,e.y+o)}));for(let e=i.length-1;e>=0;e--){const r=i[e];t.lineTo(null!==(s=r.x1)&&void 0!==s?s:r.x,null!==(a=r.y1)&&void 0!==a?a:r.y)}t.lineTo(null!==(l=c.x1)&&void 0!==l?l:c.x,null!==(h=c.y1)&&void 0!==h?h:c.y),t.closePath()}))}(e.camera?e:e.nativeContext,i,r,{offsetX:s,offsetY:a}),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,n,o),e.setCommonStyle(t,n,s,a,o),e.fill())}};gu=uu([f()],gu);var pu,fu=function(t,e,i,r){var n,o=arguments.length,s=o<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,i,r);else for(var a=t.length-1;a>=0;a--)(n=t[a])&&(s=(o<3?n(s):o>3?n(e,i,s):n(e,i))||s);return o>3&&s&&Object.defineProperty(e,i,s),s},mu=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},bu=function(t,e){return function(i,r){e(i,r,t)}},yu=function(t,e,i,r){return new(i||(i=Promise))((function(n,o){function s(t){try{l(r.next(t))}catch(t){o(t)}}function a(t){try{l(r.throw(t))}catch(t){o(t)}}function l(t){var e;t.done?n(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(s,a)}l((r=r.apply(t,e||[])).next())}))};!function(t){t[t.NORMAL=0]="NORMAL",t[t.STOP=1]="STOP"}(pu||(pu={}));let Cu=class extends ou{constructor(t,e,i,r){super(t,r),this.contributions=t,this.lineRender=e,this.areaRender=i,this.drawItemInterceptorContributions=r,this.rendering=!1,this.currFrameStartAt=0,this.currentIdx=0,this.status=pu.NORMAL,this.checkingForDrawPromise=null,this.hooks={completeDraw:new I([])}}init(){super.init(),this.defaultRenderMap.set(this.lineRender.numberType,this.lineRender),this.defaultRenderMap.set(this.areaRender.numberType,this.areaRender)}draw(t,e){return yu(this,void 0,void 0,(function*(){if(this.checkingForDrawPromise)return;this.lastRenderService=t,this.lastDrawContext=e,this.checkingForDrawPromise=this.checkForDraw(e);const i=yield this.checkingForDrawPromise;if(this.checkingForDrawPromise=null,i)return;this.currentRenderService=t;const{context:r,x:n=0,y:o=0}=e;r&&(r.inuse=!0,r.clearMatrix(),r.setTransformForCurrent(!0),r.save(),e.restartIncremental&&this.clearScreen(this.currentRenderService,r,e),r.translate(n,o,!0),r.save(),t.renderTreeRoots.sort(((t,e)=>{var i,r;return(null!==(i=t.attribute.zIndex)&&void 0!==i?i:yr.zIndex)-(null!==(r=e.attribute.zIndex)&&void 0!==r?r:yr.zIndex)})).forEach((t=>{this.renderGroup(t,e)})),this.hooks.completeDraw.tap("top-draw",(()=>{r.restore(),r.restore(),r.draw(),r.inuse=!1,this.rendering=!1})))}))}_increaseRender(t,e){return yu(this,void 0,void 0,(function*(){this.rendering=!0,yield this._renderIncrementalGroup(t,e)}))}_renderIncrementalGroup(t,e){return yu(this,void 0,void 0,(function*(){this.count=t.count,yield new Promise((i=>{this.renderItem(t,e,{drawingCb:()=>yu(this,void 0,void 0,(function*(){if(2!==t.count)yield Ud(t,yr.zIndex,((i,r)=>{if(this.status===pu.STOP)return!0;if(i.isContainer)return!1;if(r<this.currentIdx)return!1;const n=this.currFrameStartAt+t.incremental;return r<n&&(this.currentIdx=r+1,this.renderItem(i,e)),r===n-1&&(this.currFrameStartAt=this.currentIdx,this.waitToNextFrame())})),i(!1);else{const r=t.getChildAt(0);if(r.incremental&&r.attribute.segments)for(r.incrementalAt||(r.incrementalAt=0);r.incrementalAt<r.attribute.segments.length;)e.multiGraphicOptions={startAtIdx:r.incrementalAt,length:r.incremental},this.renderItem(r,e),r.incrementalAt+=r.incremental,yield this.waitToNextFrame();else this.renderItem(r,e);i(!1)}}))})})),this.hooks.completeDraw.call()}))}waitToNextFrame(){return yu(this,void 0,void 0,(function*(){return new Promise((t=>{this.global.getRequestAnimationFrame()((()=>{t(!1)}))}))}))}checkForDraw(t){return yu(this,void 0,void 0,(function*(){let e=this.rendering;return t.restartIncremental&&(e=!1,yield this.forceStop(),this.resetToInit()),e}))}forceStop(){return yu(this,void 0,void 0,(function*(){this.rendering&&(this.status=pu.STOP,yield new Promise((t=>{this.hooks.completeDraw.tap("stopCb",(()=>{this.status=pu.NORMAL,this.hooks.completeDraw.taps=this.hooks.completeDraw.taps.filter((t=>"stopCb"!==t.name)),t(!1)}))})))}))}resetToInit(){this.currFrameStartAt=0,this.currentIdx=0}renderGroup(t,e){return yu(this,void 0,void 0,(function*(){if(!e.break&&!1!==t.attribute.visibleAll)return t.incremental&&e.startAtId===t._uid?(yield this._increaseRender(t,e),void(e.break=!0)):void(yield new Promise((i=>{this.renderItem(t,e,{drawingCb:()=>yu(this,void 0,void 0,(function*(){yield Ud(t,yr.zIndex,(t=>yu(this,void 0,void 0,(function*(){e.break||t.isContainer&&(yield this.renderGroup(t,e))})))),i(!1)}))})})))}))}};Cu=fu([f(),bu(0,p(Xc)),bu(1,g(du)),bu(2,g(gu)),bu(3,g(E)),bu(3,m(Xd)),mu("design:paramtypes",[Array,Object,Object,Object])],Cu);var vu=new i((t=>{t(Ch).toSelf().inSingletonScope(),t(xh).toSelf().inSingletonScope(),t(ad).to(ou),t(jc).to(Cu),t(Yc).to(hu).inSingletonScope(),t(Xc).toService(Yc),L(t,Os),t(wh).toSelf().inSingletonScope(),L(t,Vs),L(t,Xc),t(Jd).toSelf().inSingletonScope(),t(Xd).toService(Jd),L(t,Xd)}));let wu=!1;function xu(){wu||(wu=!0,Yr.load(xs),Yr.load(xd),Yr.load(gd),Yr.load(wd),Yr.load(Rd),function(t){t.load(Pd),t.load(Ed),t.load(Nd)}(Yr),function(t){t.load(vu)}(Yr))}xu();const _u=Yr.get(z);kr.global=_u;const Su=Yr.get(gs);kr.graphicUtil=Su;const Au=Yr.get(us);kr.transformUtil=Au;const Bu=Yr.get(ns);kr.graphicService=Bu;const Tu=Yr.get(ps);kr.layerService=Tu;class Mu{constructor(){this.name="AutoRenderPlugin",this.activeEvent="onRegister",this._uid=e.GenAutoIncrementId(),this.key=this.name+this._uid}activate(t){this.pluginService=t,kr.graphicService.hooks.onAttributeUpdate.tap(this.key,(e=>{e.glyphHost&&(e=e.glyphHost),e.stage===t.stage&&null!=e.stage&&e.stage.renderNextFrame()})),kr.graphicService.hooks.onSetStage.tap(this.key,(e=>{e.glyphHost&&(e=e.glyphHost),e.stage===t.stage&&null!=e.stage&&e.stage.renderNextFrame()}))}deactivate(t){kr.graphicService.hooks.onAttributeUpdate.taps=kr.graphicService.hooks.onAttributeUpdate.taps.filter((t=>t.name!==this.key)),kr.graphicService.hooks.onSetStage.taps=kr.graphicService.hooks.onSetStage.taps.filter((t=>t.name!==this.key))}}class Ru{constructor(){this.name="ViewTransform3dPlugin",this.activeEvent="onRegister",this._uid=e.GenAutoIncrementId(),this.key=this.name+this._uid,this.onMouseDown=t=>{this.option3d||(this.option3d=this.pluginService.stage.option3d),this.option3d&&(this.mousedown=!0,this.pageX=t.page.x,this.pageY=t.page.y)},this.onMouseUp=t=>{this.option3d||(this.option3d=this.pluginService.stage.option3d),this.option3d&&(this.mousedown=!1)},this.onMouseMove=t=>{var e,i;const r=this.pluginService.stage;if(this.option3d||(this.option3d=r.option3d),this.option3d&&this.mousedown)if(this.pageX&&this.pageY){const n=t.page.x-this.pageX,o=t.page.y-this.pageY;this.pageX=t.page.x,this.pageY=t.page.y;const s=n/100,a=o/100;this.option3d.alpha=(null!==(e=this.option3d.alpha)&&void 0!==e?e:0)+s,this.option3d.beta=(null!==(i=this.option3d.beta)&&void 0!==i?i:0)+a,r.set3dOptions(this.option3d),r.renderNextFrame()}else this.pageX=t.page.x,this.pageY=t.page.y}}activate(t){this.pluginService=t;const e=t.stage;this.option3d=e.option3d,e.addEventListener("mousedown",this.onMouseDown),e.addEventListener("mouseup",this.onMouseUp),e.addEventListener("mousemove",this.onMouseMove)}deactivate(t){const e=t.stage;e.removeEventListener("mousedown",this.onMouseDown),e.removeEventListener("mouseup",this.onMouseUp),e.removeEventListener("mousemove",this.onMouseMove)}}class Pu{constructor(){this.name="IncrementalAutoRenderPlugin",this.activeEvent="onRegister",this.nextFrameRenderGroupSet=new Set,this.willNextFrameRender=!1,this.nextUserParams={},this._uid=e.GenAutoIncrementId(),this.key=this.name+this._uid}activate(t){this.pluginService=t,kr.graphicService.hooks.onAddIncremental.tap(this.key,((e,i,r)=>{e.glyphHost&&(e=e.glyphHost),e.stage===t.stage&&null!=e.stage&&(this.nextUserParams.startAtId=i._uid,this.renderNextFrame(i))})),kr.graphicService.hooks.onClearIncremental.tap(this.key,((e,i)=>{e.stage===t.stage&&null!=e.stage&&(this.nextUserParams.startAtId=e._uid,this.nextUserParams.restartIncremental=!0,this.renderNextFrame(e))}))}deactivate(t){kr.graphicService.hooks.onAddIncremental.taps=kr.graphicService.hooks.onAddIncremental.taps.filter((t=>t.name!==this.key)),kr.graphicService.hooks.onClearIncremental.taps=kr.graphicService.hooks.onClearIncremental.taps.filter((t=>t.name!==this.key))}renderNextFrame(t){this.nextFrameRenderGroupSet.add(t),this.willNextFrameRender||(this.willNextFrameRender=!0,kr.global.getRequestAnimationFrame()((()=>{this._doRenderInThisFrame(),this.willNextFrameRender=!1})))}_doRenderInThisFrame(){const t=this.pluginService.stage;this.nextFrameRenderGroupSet.size&&(this.nextFrameRenderGroupSet.forEach((e=>{const i=e.layer;if(!i||!e.layer.subLayers)return;const r=e.layer.subLayers.get(e._uid);r&&r.drawContribution&&r.drawContribution.draw(t.renderService,Object.assign({x:t.x,y:t.y,width:i.viewWidth,height:i.viewHeight,stage:t,layer:i,clear:"transparent",renderService:t.renderService,updateBounds:!1,startAtId:e._uid,context:r.layer.getNativeHandler().getContext()},this.nextUserParams))})),this.nextUserParams={},this.nextFrameRenderGroupSet.clear())}}class Eu{constructor(){this.name="HtmlAttributePlugin",this.activeEvent="onRegister",this._uid=e.GenAutoIncrementId(),this.key=this.name+this._uid}activate(t){this.pluginService=t,t.stage.hooks.afterRender.tap(this.key,(e=>{e&&e===this.pluginService.stage&&this.drawHTML(t.stage.renderService)})),kr.graphicService.hooks.onRelease.tap(this.key,(t=>{this.removeDom(t)}))}deactivate(t){t.stage.hooks.afterRender.taps=t.stage.hooks.afterRender.taps.filter((t=>t.name!==this.key))}drawHTML(t){"browser"===kr.global.env&&t.renderTreeRoots.sort(((t,e)=>{var i,r;return(null!==(i=t.attribute.zIndex)&&void 0!==i?i:yr.zIndex)-(null!==(r=e.attribute.zIndex)&&void 0!==r?r:yr.zIndex)})).forEach((t=>{this.renderGroupHTML(t)}))}renderGroupHTML(t){this.renderGraphicHTML(t),t.forEachChildren((t=>{t.isContainer?this.renderGroupHTML(t):this.renderGraphicHTML(t)}))}removeDom(t){t.bindDom&&t.bindDom.size&&(t.bindDom.forEach((t=>{t.dom&&t.dom.parentElement.removeChild(t.dom)})),t.bindDom.clear())}renderGraphicHTML(t){const{html:e}=t.attribute;if(!e)return void(t.bindDom&&t.bindDom.size&&(t.bindDom.forEach((t=>{t.dom&&t.dom.parentElement.removeChild(t.dom)})),t.bindDom.clear()));const i=t.stage;if(!i)return;const{dom:r,container:n,width:o,height:s,style:a,anchorType:l="boundsLeftTop"}=e;t.bindDom||(t.bindDom=new Map);const h=t.bindDom.get(r);if(h&&(!n||n===h.container))return;let c,d;t.bindDom.forEach((t=>{let{wrapGroup:e}=t;kr.global.removeDom(e)})),c="string"==typeof r?(new DOMParser).parseFromString(r,"text/html").firstChild:r;const u=n||(!0===i.params.enableHtmlAttribute?null:i.params.enableHtmlAttribute);d=u?"string"==typeof u?kr.global.getElementById(u):u:t.stage.window.getContainer();const g=kr.global.createDom({tagName:"div",width:o,height:s,style:a,parent:d});g&&(g.appendChild(c),t.bindDom.set(r,{dom:c,container:n,wrapGroup:g})),g.style.pointerEvents="none",g.style.position||(g.style.position="absolute",d.style.position="relative");let p=0,f=0;if("position"===l){const e=t.globalTransMatrix;p=e.e,f=e.f}else{const e=t.globalAABBBounds;p=e.x1,f=e.y1}const m=kr.global.getElementTopLeft(d,!1),b=i.window.getTopLeft(!1),y=p+b.left-m.left,C=f+b.top-m.top;g.style.left=`${y}px`,g.style.top=`${C}px`}}const Hu=new ge;class Lu{constructor(){this.name="DirtyBoundsPlugin",this.activeEvent="onRegister",this._uid=e.GenAutoIncrementId(),this.key=this.name+this._uid}activate(t){this.pluginService=t,t.stage.hooks.afterRender.tap(this.key,(t=>{t&&t===this.pluginService.stage&&t.dirtyBounds.clear()})),kr.graphicService.hooks.beforeUpdateAABBBounds.tap(this.key,((t,e,i,r)=>{t.glyphHost&&(t=t.glyphHost),e&&e===this.pluginService.stage&&e.renderCount&&(t.isContainer&&!t.shouldSelfChangeUpdateAABBBounds()||i&&(Hu.setValue(r.x1,r.y1,r.x2,r.y2),e.dirty(Hu,t.parent&&t.parent.globalTransMatrix)))})),kr.graphicService.hooks.afterUpdateAABBBounds.tap(this.key,((t,e,i,r,n)=>{e&&e===this.pluginService.stage&&e.renderCount&&(t.isContainer&&!n||e.dirty(r.globalAABBBounds))})),kr.graphicService.hooks.onRemove.tap(this.key,(t=>{const e=t.stage;e&&e===this.pluginService.stage&&e.renderCount&&e&&e.dirty(t.globalAABBBounds)}))}deactivate(t){kr.graphicService.hooks.beforeUpdateAABBBounds.taps=kr.graphicService.hooks.beforeUpdateAABBBounds.taps.filter((t=>t.name!==this.key)),kr.graphicService.hooks.afterUpdateAABBBounds.taps=kr.graphicService.hooks.afterUpdateAABBBounds.taps.filter((t=>t.name!==this.key)),t.stage.hooks.afterRender.taps=t.stage.hooks.afterRender.taps.filter((t=>t.name!==this.key)),kr.graphicService.hooks.onRemove.taps=kr.graphicService.hooks.onRemove.taps.filter((t=>t.name!==this.key))}}const ku=new ge;class Iu{constructor(){this.name="FlexLayoutPlugin",this.activeEvent="onRegister",this.id=e.GenAutoIncrementId(),this.key=this.name+this.id,this.tempBounds=new ge}tryLayout(t){if(this.layouting)return;this.layouting=!0;const e=t.parent;if(!e||!t.needUpdateLayout())return;const i=Cn(e).group,{display:r=i.display}=e.attribute;if("flex"!==r)return;const{flexDirection:n=i.flexDirection,flexWrap:o=i.flexWrap,justifyContent:s=i.justifyContent,alignItems:a=i.alignItems,alignContent:l=i.alignContent,clip:h=i.clip}=e.attribute;let c=0,d=0,u=0;if(e.forEachChildren((t=>{const e=t.AABBBounds;"column"===n||"column-reverse"===n?(d+=e.height(),c=Math.max(c,e.width())):(c+=e.width(),d=Math.max(d,e.height())),u+=e.x1,u+=e.y1,u+=e.x2,u+=e.y2})),!isFinite(u))return;const g=e.attribute.width||c,p=e.attribute.height||d;e.attribute.width||(e.attribute.width=0),e.attribute.height||(e.attribute.height=0),this.tempBounds.copy(e._AABBBounds);const f={main:{len:g,field:"x"},cross:{len:p,field:"y"},dir:1},m=f.main,b=f.cross;"row-reverse"===n?f.dir=-1:"column"===n?(m.len=p,b.len=g,m.field="y",b.field="x"):"column-reverse"===n&&(m.len=p,b.len=g,m.field="y",b.field="x",f.dir=-1);let y=0,C=0;const v=[];e.forEachChildren((t=>{const e=t.AABBBounds,i="x"===m.field?e.width():e.height(),r="x"===b.field?e.width():e.height();v.push({mainLen:i,crossLen:r}),y+=i,C=Math.max(C,r)}));const w=[];if(y>m.len&&"wrap"===o){let t=0,e=0;v.forEach(((i,r)=>{let{mainLen:n,crossLen:o}=i;t+n>m.len?0===t?(w.push({idx:r,mainLen:t+n,crossLen:o}),t=0,e=0):(w.push({idx:r-1,mainLen:t,crossLen:o}),t=n,e=o):(t+=n,e=Math.max(e,o))})),w.push({idx:v.length-1,mainLen:t,crossLen:e})}else w.push({idx:v.length-1,mainLen:y,crossLen:C});const x=e.getChildren();let _=0;if(w.forEach((t=>{this.layoutMain(e,x,s,m,v,_,t),_=t.idx+1})),C=w.reduce(((t,e)=>t+e.crossLen),0),1===w.length)if("flex-end"===a){const t=b.len;this.layoutCross(x,a,b,t,v,w[0],0)}else if("center"===a){const t=b.len/2;this.layoutCross(x,a,b,t,v,w[0],0)}else x.forEach((t=>{t.attribute[b.field]=Fu(t,b.field)}));else if("flex-start"===l){_=0;let t=0;w.forEach(((e,i)=>{this.layoutCross(x,"flex-start",b,t,v,w[i],_),_=e.idx+1,t+=e.crossLen}))}else if("center"===l){_=0;let t=Math.max(0,(b.len-C)/2);w.forEach(((e,i)=>{this.layoutCross(x,"center",b,t+e.crossLen/2,v,w[i],_),_=e.idx+1,t+=e.crossLen}))}else if("space-around"===l){_=0;const t=Math.max(0,(b.len-C)/w.length/2);let e=t;w.forEach(((i,r)=>{this.layoutCross(x,"flex-start",b,e,v,w[r],_),_=i.idx+1,e+=i.crossLen+2*t}))}else if("space-between"===l){_=0;const t=Math.max(0,(b.len-C)/(2*w.length-2));let e=0;w.forEach(((i,r)=>{this.layoutCross(x,"flex-start",b,e,v,w[r],_),_=i.idx+1,e+=i.crossLen+2*t}))}x.forEach(((t,e)=>{t.addUpdateBoundTag(),t.addUpdatePositionTag(),t.clearUpdateLayoutTag()})),e.addUpdateLayoutTag(),h||this.tempBounds.equals(e.AABBBounds)||(this.tryLayout(e),this.layouting=!1)}layoutMain(t,e,i,r,n,o,s){if("flex-start"===i){let t=0;for(let i=o;i<=s.idx;i++)e[i].attribute[r.field]=t+Fu(e[i],r.field),t+=n[i].mainLen}else if("flex-end"===i){let t=r.len;for(let i=o;i<=s.idx;i++)t-=n[i].mainLen,e[i].attribute[r.field]=t+Fu(e[i],r.field)}else if("space-around"===i)if(s.mainLen>=r.len){let t=0;for(let i=o;i<=s.idx;i++)e[i].attribute[r.field]=t+Fu(e[i],r.field),t+=n[i].mainLen}else{const t=s.idx-o+1,i=(r.len-s.mainLen)/t/2;let a=i;for(let t=o;t<=s.idx;t++)e[t].attribute[r.field]=a+Fu(e[t],r.field),a+=n[t].mainLen+2*i}else if("space-between"===i)if(s.mainLen>=r.len){let t=0;for(let i=o;i<=s.idx;i++)e[i].attribute[r.field]=t+Fu(e[i],r.field),t+=n[i].mainLen}else{const t=s.idx-o+1,i=(r.len-s.mainLen)/(2*t-2);let a=0;for(let t=o;t<=s.idx;t++)e[t].attribute[r.field]=a+Fu(e[t],r.field),a+=n[t].mainLen+2*i}else if("center"===i){let t=(r.len-s.mainLen)/2;for(let i=o;i<=s.idx;i++)e[i].attribute[r.field]=t+Fu(e[i],r.field),t+=n[i].mainLen}}layoutCross(t,e,i,r,n,o,s){if("flex-end"===e)for(let e=s;e<=o.idx;e++)t[e].attribute[i.field]=r-n[e].crossLen+Fu(t[e],i.field);else if("center"===e)for(let e=s;e<=o.idx;e++)t[e].attribute[i.field]=r-n[e].crossLen/2+Fu(t[e],i.field);else for(let e=s;e<=o.idx;e++)t[e].attribute[i.field]=r+Fu(t[e],i.field)}activate(t){this.pluginService=t,kr.graphicService.hooks.onAttributeUpdate.tap(this.key,(t=>{t.glyphHost&&(t=t.glyphHost),this.tryLayout(t),this.layouting=!1})),kr.graphicService.hooks.beforeUpdateAABBBounds.tap(this.key,((t,e,i,r)=>{t.glyphHost&&(t=t.glyphHost),e&&e===this.pluginService.stage&&t.isContainer&&ku.copy(r)})),kr.graphicService.hooks.afterUpdateAABBBounds.tap(this.key,((t,e,i,r,n)=>{e&&e===this.pluginService.stage&&t.isContainer&&(ku.equals(i)||(this.tryLayout(t),this.layouting=!1))})),kr.graphicService.hooks.onSetStage.tap(this.key,(t=>{t.glyphHost&&(t=t.glyphHost),this.tryLayout(t),this.layouting=!1}))}deactivate(t){kr.graphicService.hooks.onAttributeUpdate.taps=kr.graphicService.hooks.onAttributeUpdate.taps.filter((t=>t.name!==this.key)),kr.graphicService.hooks.onSetStage.taps=kr.graphicService.hooks.onSetStage.taps.filter((t=>t.name!==this.key))}}function Fu(t,e){if(!t.attribute.boundsPadding)return 0;if(function(t){return"number"==typeof t&&Number.isFinite(t)}(t.attribute.boundsPadding))return t.attribute.boundsPadding;if(it(t.attribute.boundsPadding)&&1===t.attribute.boundsPadding.length)return t.attribute.boundsPadding[0];const i=Yn(t.attribute.boundsPadding);return"x"===e?i[3]:"y"===e?i[0]:0}const zu=new class{set mode(t){this._mode!==t&&(this._mode=t,this.setupTickHandler())}get mode(){return this._mode}constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];this.handleTick=(t,e)=>{const{once:i=!1}=null!=e?e:{};this.ifCanStop()?this.stop():(this._handlerTick(t),i||t.tick(this.interval,this.handleTick))},this._handlerTick=t=>{const e=this.tickerHandler.getTime();let i=0;this.lastFrameTime>=0&&(i=e-this.lastFrameTime),this.lastFrameTime=e,this.status===In.RUNNING&&(this.tickCounts++,this.timelines.forEach((t=>{t.tick(i)})))},this.init(),this.lastFrameTime=-1,this.tickCounts=0,this.timelines=t,this.autoStop=!0}init(){this.interval=NaN,this.status=In.INITIAL,kr.global.hooks.onSetEnv.tap("default-ticker",(()=>{this.initHandler()})),kr.global.env&&this.initHandler()}addTimeline(t){this.timelines.push(t)}remTimeline(t){this.timelines=this.timelines.filter((e=>e!==t))}initHandler(){if(this._mode)return null;const t=[{mode:"raf",cons:kn},{mode:"timeout",cons:Ln},{mode:"manual",cons:Hn}];for(let e=0;e<t.length;e++)if(t[e].cons.Avaliable()){this.mode=t[e].mode;break}return null}setupTickHandler(){let t;switch(this._mode){case"raf":t=new kn;break;case"timeout":t=new Ln;break;case"manual":t=new Hn;break;default:Ze.getInstance().warn("非法的计时器模式"),t=new kn}return!!t.avaliable()&&(this.tickerHandler&&this.tickerHandler.release(),this.tickerHandler=t,!0)}setInterval(t){this.interval=t}getInterval(){return this.interval}setFPS(t){this.setInterval(1e3/t)}getFPS(){return 1e3/this.interval}tick(t){this.tickerHandler.tick(t,(t=>{this.handleTick(t,{once:!0})}))}tickTo(t){this.tickerHandler.tickTo&&this.tickerHandler.tickTo(t,(t=>{this.handleTick(t,{once:!0})}))}pause(){return this.status!==In.INITIAL&&(this.status=In.PAUSE,!0)}resume(){return this.status!==In.INITIAL&&(this.status=In.RUNNING,!0)}ifCanStop(){if(this.autoStop){if(!this.timelines.length)return!0;if(0===this.timelines.reduce(((t,e)=>t+e.animateCount),0))return!0}return!1}start(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(this.status===In.RUNNING)return!1;if(!this.tickerHandler)return!1;if(!t){if(this.status===In.PAUSE)return!1;if(!this.timelines.length)return!1;if(0===this.timelines.reduce(((t,e)=>t+e.animateCount),0))return!1}return this.status=In.RUNNING,this.tickerHandler.tick(0,this.handleTick),!0}stop(){this.status=In.INITIAL,this.setupTickHandler(),this.lastFrameTime=-1}};zu.addTimeline(On),zu.setFPS(60);class Ou{constructor(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:.8;this.dir=t,this.color=e,this.colorRgb=so.Get(e,oo.Color1),this.ambient=i;const r=ne(t[0]*t[0]+t[1]*t[1]+t[2]*t[2]);this.formatedDir=[t[0]/r,t[1]/r,t[2]/r]}computeColor(t,e){const i=this.formatedDir,r=ie(ee((t[0]*i[0]+t[1]*i[1]+t[2]*i[2])*(1-this.ambient/2),0)+this.ambient,1);let n;n=et(e)?so.Get(e,oo.Color1):e;const o=this.colorRgb;return`rgb(${o[0]*n[0]*r}, ${o[1]*n[1]*r}, ${o[2]*n[2]*r})`}}function Du(t,e,i){const r=e[0],n=e[1],o=e[2],s=e[3],a=e[4],l=e[5],h=e[6],c=e[7],d=e[8],u=e[9],g=e[10],p=e[11],f=e[12],m=e[13],b=e[14],y=e[15];let C=i[0],v=i[1],w=i[2],x=i[3];return t[0]=C*r+v*a+w*d+x*f,t[1]=C*n+v*l+w*u+x*m,t[2]=C*o+v*h+w*g+x*b,t[3]=C*s+v*c+w*p+x*y,C=i[4],v=i[5],w=i[6],x=i[7],t[4]=C*r+v*a+w*d+x*f,t[5]=C*n+v*l+w*u+x*m,t[6]=C*o+v*h+w*g+x*b,t[7]=C*s+v*c+w*p+x*y,C=i[8],v=i[9],w=i[10],x=i[11],t[8]=C*r+v*a+w*d+x*f,t[9]=C*n+v*l+w*u+x*m,t[10]=C*o+v*h+w*g+x*b,t[11]=C*s+v*c+w*p+x*y,C=i[12],v=i[13],w=i[14],x=i[15],t[12]=C*r+v*a+w*d+x*f,t[13]=C*n+v*l+w*u+x*m,t[14]=C*o+v*h+w*g+x*b,t[15]=C*s+v*c+w*p+x*y,t}function Wu(t,e,i){const r=e[0],n=e[1],o=e[2];let s=i[3]*r+i[7]*n+i[11]*o+i[15];return s=s||1,t[0]=(i[0]*r+i[4]*n+i[8]*o+i[12])/s,t[1]=(i[1]*r+i[5]*n+i[9]*o+i[13])/s,t[2]=(i[2]*r+i[6]*n+i[10]*o+i[14])/s,t}class Nu{set params(t){this._params=Object.assign({},t),this._projectionMatrixCached=this.forceGetProjectionMatrix(),this._viewMatrixCached=this.forceGetViewMatrix()}get params(){return Object.assign({},this._params)}constructor(t){this.params=t}getViewMatrix(){return this._viewMatrixCached||(this._viewMatrixCached=th.allocate()),this._viewMatrixCached}forceGetViewMatrix(){this._viewMatrixCached||(this._viewMatrixCached=th.allocate());const{pos:t,center:e,up:i}=this.params.viewParams;return function(t,e,i,r){let n,o,s,a,l,h,c,d,u,g;const p=e[0],f=e[1],m=e[2],b=r[0],y=r[1],C=r[2],v=i[0],w=i[1],x=i[2];Math.abs(p-v)<$t&&Math.abs(f-w)<$t&&Math.abs(m-x)<$t?Jl.identity(t):(c=p-v,d=f-w,u=m-x,g=1/Math.hypot(c,d,u),c*=g,d*=g,u*=g,n=y*u-C*d,o=C*c-b*u,s=b*d-y*c,g=Math.hypot(n,o,s),g?(g=1/g,n*=g,o*=g,s*=g):(n=0,o=0,s=0),a=d*s-u*o,l=u*n-c*s,h=c*o-d*n,g=Math.hypot(a,l,h),g?(g=1/g,a*=g,l*=g,h*=g):(a=0,l=0,h=0),t[0]=n,t[1]=a,t[2]=c,t[3]=0,t[4]=o,t[5]=l,t[6]=d,t[7]=0,t[8]=s,t[9]=h,t[10]=u,t[11]=0,t[12]=-(n*p+o*f+s*m),t[13]=-(a*p+l*f+h*m),t[14]=-(c*p+d*f+u*m),t[15]=1)}(this._viewMatrixCached,t,e,i),this._vp||(this._vp=th.allocate()),this._vp=Du(this._vp,this.getProjectionMatrix(),this.getViewMatrix()),this._viewMatrixCached}getProjectionMatrix(){return this._projectionMatrixCached||(this._projectionMatrixCached=th.allocate()),this._projectionMatrixCached}forceGetProjectionMatrix(){this._projectionMatrixCached||(this._projectionMatrixCached=th.allocate());const{left:t,top:e,right:i,bottom:r}=this._params;return function(t,e,i,r,n,o,s){const a=1/(e-i),l=1/(r-n),h=1/(o-s);t[0]=-2*a,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=-2*l,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=2*h,t[11]=0,t[12]=(e+i)*a,t[13]=(n+r)*l,t[14]=(s+o)*h,t[15]=1}(this._projectionMatrixCached,t,i,r,e,0,-2e6),this._vp||(this._vp=th.allocate()),this._vp=Du(this._vp,this.getProjectionMatrix(),this.getViewMatrix()),this._projectionMatrixCached}getField(){const{fieldRatio:t=.8,fieldDepth:e,left:i,right:r}=this._params;return(null!=e?e:r-i)*t}getProjectionScale(t){const e=this.getField();return e/(e+t)}view(t,e,i){const r=[0,0,0];return Wu(r,[t,e,i],this._viewMatrixCached),r}vp(t,e,i){const r=[0,0,0],{pos:n}=this._params.viewParams;Wu(r,[t,e,i],this._viewMatrixCached),t=r[0],e=r[1],i=r[2];const o=this.getProjectionScale(i);return{x:t*o+n[0],y:e*o+n[1]}}}let Gu;function ju(){if(null==Gu){try{Gu=!!window}catch(t){Gu=!1}if(Gu)try{Gu=!tt}catch(t){Gu=!0}}}function Uu(){return ju(),Gu}const Vu="white";class Ku extends hs{set viewBox(t){this._viewBox.setValue(t.x1,t.y1,t.x2,t.y2)}get viewBox(){return this._viewBox}get x(){return this._viewBox.x1}set x(t){this._viewBox.translate(t-this._viewBox.x1,0)}get y(){return this._viewBox.y1}set y(t){this._viewBox.translate(0,t-this._viewBox.y1)}get width(){return this.window.width}set width(t){this.resize(t,this.height)}get viewWidth(){return this._viewBox.width()}set viewWidth(t){this.resizeView(t,this.viewHeight)}get viewHeight(){return this._viewBox.height()}set viewHeight(t){this.resizeView(this.viewWidth,t)}get height(){return this.window.height}set height(t){this.resize(this.width,t)}get dpr(){return this.window.dpr}set dpr(t){this.setDpr(t)}get background(){var t;return null!==(t=this._background)&&void 0!==t?t:Vu}set background(t){this._background=t}get defaultLayer(){return this.at(0)}get eventSystem(){return this._eventSystem}constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};var e;super({}),this._onVisibleChange=t=>{this._skipRender<0||(t?(this.dirtyBounds&&this.dirtyBounds.setValue(0,0,this._viewBox.width(),this._viewBox.height()),this._skipRender>1&&this.renderNextFrame(),this._skipRender=0):this._skipRender=1)},this.beforeRender=t=>{this._beforeRender&&this._beforeRender(t)},this.afterRender=t=>{this.renderCount++,this._afterRender&&this._afterRender(t),this._afterNextRenderCbs&&this._afterNextRenderCbs.forEach((e=>e(t))),this._afterNextRenderCbs=null},this.params=t,this.theme=new bn,this.hooks={beforeRender:new I(["stage"]),afterRender:new I(["stage"])},this.global=kr.global,!this.global.env&&Uu()&&this.global.setEnv("browser"),this.window=Yr.get(rn),this.renderService=Yr.get(dd),this.pluginService=Yr.get(Sd),this.layerService=Yr.get(ps),this.pluginService.active(this,t),this.window.create({width:t.width,height:t.height,container:t.container,dpr:t.dpr||this.global.devicePixelRatio,canvasControled:!1!==t.canvasControled,title:t.title||"",canvas:t.canvas}),this._viewBox=new ge,t.viewBox?this._viewBox.setValue(t.viewBox.x1,t.viewBox.y1,t.viewBox.x2,t.viewBox.y2):this._viewBox.setValue(0,0,this.width,this.height),this.state="normal",this.renderCount=0,this.tryInitEventSystem(),this._subView=!(this._viewBox.width()===this.width&&this._viewBox.height()===this.height),this._background=null!==(e=t.background)&&void 0!==e?e:Vu,this.appendChild(this.layerService.createLayer(this,{main:!0})),this.nextFrameRenderLayerSet=new Set,this.willNextFrameRender=!1,this.stage=this,this.renderStyle=t.renderStyle,t.autoRender&&this.enableAutoRender(),!1===t.disableDirtyBounds&&this.enableDirtyBounds(),t.enableHtmlAttribute&&this.enableHtmlAttribute(t.enableHtmlAttribute),t.enableLayout&&this.enableLayout(),this.hooks.beforeRender.tap("constructor",this.beforeRender),this.hooks.afterRender.tap("constructor",this.afterRender),this._beforeRender=t.beforeRender,this._afterRender=t.afterRender,this.ticker=t.ticker||zu,this.supportInteractiveLayer=!1!==t.interactiveLayer,this.timeline=new zn,this.ticker.addTimeline(this.timeline),this.timeline.pause(),t.optimize||(t.optimize={}),this.optmize(t.optimize),t.background&&et(this._background)&&this._background.includes("/")&&this.setAttributes({background:this._background})}tryInitEventSystem(){this.global.supportEvent&&!this._eventSystem&&(this._eventSystem=new En(Object.assign({targetElement:this.window,resolution:this.window.dpr||this.global.devicePixelRatio,rootNode:this,global:this.global,viewport:{viewBox:this._viewBox,get x(){return this.viewBox.x1},get y(){return this.viewBox.y1},get width(){return this.viewBox.width()},get height(){return this.viewBox.height()}}},this.params.event)))}preventRender(t){t?this._skipRender=-1/0:!1!==this.params.optimize.skipRenderWithOutRange?this._skipRender=this.window.isVisible()?0:1:this._skipRender=0}optmize(t){this.optmizeRender(t.skipRenderWithOutRange),this.params.optimize=t}optmizeRender(){arguments.length>0&&void 0!==arguments[0]&&arguments[0]&&(this._skipRender=this._skipRender<0?this._skipRender:this.window.isVisible()?0:1,this.window.onVisibleChange(this._onVisibleChange))}getTimeline(){return this.timeline}get3dOptions(t){const{center:e={x:this.width/2,y:this.height/2,z:0,dx:0,dy:0,dz:0},light:i={},alpha:r=0,beta:n=0,camera:o,fieldRatio:s=1,fieldDepth:a}=t;return Object.assign(Object.assign({},t),{center:e,light:i,alpha:r,beta:n,camera:o,fieldRatio:s,fieldDepth:a})}set3dOptions(t){var e,i,r,n,o,s;this.option3d=t;const a=this.get3dOptions(t),{light:l,center:h,camera:c,alpha:d,beta:u,fieldRatio:g,fieldDepth:p}=a,{dir:f=[1,1,-1],color:m="white",ambient:b}=l,y=(null!==(e=h.x)&&void 0!==e?e:this.width/2)+(null!==(i=h.dx)&&void 0!==i?i:0),C=(null!==(r=h.y)&&void 0!==r?r:this.height/2)+(null!==(n=h.dy)&&void 0!==n?n:0),v=[y,C,(null!==(o=h.z)&&void 0!==o?o:0)+(null!==(s=h.dz)&&void 0!==s?s:0)];let w=0,x=0,_=0;c||(w=Math.sin(d)+y,x=Math.sin(u)+C,_=Math.cos(d)*Math.cos(u)*1),this.light=new Ou(f,m,b);const S={left:0,right:this.width,top:0,bottom:this.height,fieldRatio:g,fieldDepth:p,viewParams:{pos:[w,x,_],center:v,up:[0,1,0]}};this.camera?this.camera.params=S:this.camera=new Nu(S),t.enableView3dTransform&&this.enableView3dTransform()}setBeforeRender(t){this._beforeRender=t}setAfterRender(t){this._afterRender=t}afterNextRender(t){this._afterNextRenderCbs||(this._afterNextRenderCbs=[]),this._afterNextRenderCbs.push(t)}enableView3dTransform(){this.view3dTranform||(this.view3dTranform=!0,this.pluginService.register(new Ru))}disableView3dTranform(){this.view3dTranform&&(this.view3dTranform=!1,this.pluginService.findPluginsByName("ViewTransform3dPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableAutoRender(){this.autoRender||(this.autoRender=!0,this.pluginService.register(new Mu))}disableAutoRender(){this.autoRender&&(this.autoRender=!1,this.pluginService.findPluginsByName("AutoRenderPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableIncrementalAutoRender(){this.increaseAutoRender||(this.increaseAutoRender=!0,this.pluginService.register(new Pu))}disableIncrementalAutoRender(){this.increaseAutoRender&&(this.increaseAutoRender=!1,this.pluginService.findPluginsByName("IncrementalAutoRenderPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableDirtyBounds(){if(this.dirtyBounds)return;this.dirtyBounds=new ue;let t=this.pluginService.findPluginsByName("DirtyBoundsPlugin")[0];t?t.activate(this.pluginService):(t=new Lu,this.pluginService.register(t))}disableDirtyBounds(){this.dirtyBounds&&(this.dirtyBounds=null,this.pluginService.findPluginsByName("DirtyBoundsPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableLayout(){this._enableLayout||(this._enableLayout=!0,this.pluginService.register(new Iu))}disableLayout(){this._enableLayout&&(this._enableLayout=!1,this.pluginService.findPluginsByName("FlexLayoutPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableHtmlAttribute(t){this.htmlAttribute||(this.htmlAttribute=t,this.pluginService.register(new Eu))}disableHtmlAttribute(){this.htmlAttribute&&(this.htmlAttribute=!1,this.pluginService.findPluginsByName("HtmlAttributePlugin").forEach((t=>{this.pluginService.unRegister(t)})))}tryUpdateAABBBounds(){const t=this._viewBox;return this._AABBBounds.setValue(t.x1,t.y1,t.x2,t.y2),this._AABBBounds}combineLayer(t,e){throw new Error("暂不支持")}createLayer(t,e){const i=this.layerService.createLayer(this,{main:!1,layerMode:e,canvasId:t});return this.appendChild(i),i}sortLayer(t){const e=this.children;e.sort(t),this.removeAllChild(),e.forEach((t=>{this.appendChild(t)}))}removeLayer(t){return this.removeChild(this.findChildByUid(t))}tryInitInteractiveLayer(){this.supportInteractiveLayer&&!this.interactiveLayer&&(this.interactiveLayer=this.createLayer(),this.interactiveLayer.name="_builtin_interactive",this.interactiveLayer.attribute.pickable=!1,this.nextFrameRenderLayerSet.add(this.interactiveLayer))}clearViewBox(t){this.window.clearViewBox(this._viewBox,t)}render(t,e){this.ticker.start(),this.timeline.resume();const i=this.state;this.state="rendering",this.layerService.prepareStageLayer(this),this._skipRender||(this.lastRenderparams=e,this.hooks.beforeRender.call(this),this.renderLayerList(this.children),this.combineLayersToWindow(),this.nextFrameRenderLayerSet.clear(),this.hooks.afterRender.call(this)),this.state=i,this._skipRender&&this._skipRender++}combineLayersToWindow(){}renderNextFrame(t,e){this.nextFrameRenderLayerSet.size!==this.childrenCount&&(t||this).forEach((t=>{this.nextFrameRenderLayerSet.add(t)})),this.willNextFrameRender||(this.willNextFrameRender=!0,this.global.getRequestAnimationFrame()((()=>{this._doRenderInThisFrame(),this.willNextFrameRender=!1})))}_doRenderInThisFrame(){this.timeline.resume(),this.ticker.start();const t=this.state;this.state="rendering",this.layerService.prepareStageLayer(this),this.nextFrameRenderLayerSet.size&&!this._skipRender&&(this.hooks.beforeRender.call(this),this.renderLayerList(Array.from(this.nextFrameRenderLayerSet.values()),this.lastRenderparams||{}),this.combineLayersToWindow(),this.hooks.afterRender.call(this),this.nextFrameRenderLayerSet.clear()),this.state=t,this._skipRender&&this._skipRender++}renderLayerList(t,e){const i=[];for(let e=0;e<t.length;e++){let r=t[e];"virtual"===r.layerMode&&(r=r.getNativeHandler().mainHandler.layer),i.includes(r)||i.push(r)}i.forEach((t=>{t.renderCount>this.renderCount||(t.renderCount=this.renderCount+1,t.render({renderService:this.renderService,background:t===this.defaultLayer?this.background:void 0,updateBounds:!(!this.dirtyBounds||this.dirtyBounds.empty())},Object.assign({renderStyle:this.renderStyle},e)))})),this.interactiveLayer&&!t.includes(this.interactiveLayer)&&this.interactiveLayer.render({renderService:this.renderService,updateBounds:!(!this.dirtyBounds||this.dirtyBounds.empty())},Object.assign({renderStyle:this.renderStyle},e))}resizeWindow(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];this.window.resize(t,e),i&&this.render()}resize(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];this.window.resize(t,e),this.forEachChildren((i=>{i.resize(t,e)})),this._subView||this.viewBox.setValue(this.viewBox.x1,this.viewBox.y1,this.viewBox.x1+t,this.viewBox.y1+e),this.camera&&this.option3d&&this.set3dOptions(this.option3d),i&&this.render()}resizeView(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];this.viewBox.setValue(this.viewBox.x1,this.viewBox.y1,this.viewBox.x1+t,this.viewBox.y1+e),this.forEachChildren((i=>{i.resizeView(t,e)})),this.camera&&(this.camera.params=Object.assign(Object.assign({},this.camera.params),{right:this.width,bottom:this.height})),i&&this.render()}setViewBox(t,e,i,r,n){let o=!0;"object"==typeof t?(this.viewBox.setValue(t.x1,t.y1,t.x2,t.y2),!1===e&&(o=!1)):(this.viewBox.setValue(t,e,t+i,e+r),!1===n&&(o=!1)),this.forEachChildren((t=>{t.resizeView(this.viewBox.width(),this.viewBox.height())})),o&&this.render()}setDpr(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];this.forEachChildren((e=>{e.setDpr(t)})),e&&this.render()}setOrigin(t,e){throw new Error("暂不支持")}export(t){throw new Error("暂不支持")}pick(t,e){this.pickerService||(this.pickerService=Yr.get(pd));const i=this.pickerService.pick(this.children,new he(t,e),{bounds:this.AABBBounds});return!(!(null==i?void 0:i.graphic)&&!(null==i?void 0:i.group))&&i}startAnimate(t){throw new Error("暂不支持")}setToFrame(t){throw new Error("暂不支持")}release(){super.release(),this.eventSystem&&this.eventSystem.release(),this.pluginService.release(),this.forEach((t=>{t.release()})),this.interactiveLayer&&this.interactiveLayer.release(),this.window.release()}setStage(t){}dirty(t,e){e&&t.transformWithMatrix(e),this.dirtyBounds.empty()&&this.dirtyBounds.setValue(t.x1,t.y1,t.x2,t.y2),this.dirtyBounds.union(t)}getLayer(t){return this.children.filter((e=>e.name===t))[0]}renderTo(t,e){this.forEachChildren(((i,r)=>{i.drawTo(t,Object.assign(Object.assign({},e),{renderService:this.renderService,background:i===this.defaultLayer?this.background:void 0,clear:0===r,updateBounds:!(!this.dirtyBounds||this.dirtyBounds.empty())}))}))}renderToNewWindow(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],e=arguments.length>1?arguments[1]:void 0;const i=Yr.get(rn);if(t)i.create({width:this.viewWidth,height:this.viewHeight,dpr:this.window.dpr,canvasControled:!0,offscreen:!0,title:""});else{const t=e?e.width():Math.min(this.viewWidth,this.window.width-this.x),r=e?e.height():Math.min(this.viewHeight,this.window.height-this.y);i.create({width:t,height:r,dpr:this.window.dpr,canvasControled:!0,offscreen:!0,title:""})}const r=e?-e.x1:0,n=e?-e.y1:0;return this.renderTo(i,{x:r,y:n,width:e?e.x2:i.width,height:e?e.y2:i.height}),i}toCanvas(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],e=arguments.length>1?arguments[1]:void 0;const i=this.renderToNewWindow(t,e).getNativeHandler();return i.nativeCanvas?i.nativeCanvas:null}setCursor(t){this._cursor=t,this.eventSystem.setCursor(t,"ignore")}getCursor(){return this._cursor}}var $u=function(t,e,i,r){var n,o=arguments.length,s=o<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,i,r);else for(var a=t.length-1;a>=0;a--)(n=t[a])&&(s=(o<3?n(s):o>3?n(e,i,s):n(e,i))||s);return o>3&&s&&Object.defineProperty(e,i,s),s},Xu=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const Yu={WIDTH:500,HEIGHT:500,DPR:1};let qu=class{get displayWidth(){return this._pixelWidth/this._dpr}get displayHeight(){return this._pixelHeight/this._dpr}get id(){return this._id}get x(){return this._x}set x(t){this._x=t}get y(){return this._y}set y(t){this._y=t}get nativeCanvas(){return this._nativeCanvas}get width(){return this._pixelWidth}set width(t){this._pixelWidth=t,this._displayWidth=t/(this._dpr||1)}get height(){return this._pixelHeight}set height(t){this._pixelHeight=t,this._displayHeight=t/(this._dpr||1)}getContext(t){return this._context}get visiable(){return this._visiable}set visiable(t){this._visiable=t,t?this.show():this.hide()}get dpr(){return this._dpr}set dpr(t){this._dpr=t,this.resize(this._displayWidth,this._displayHeight)}constructor(t){var e;const{nativeCanvas:i,width:r=Yu.WIDTH,height:n=Yu.HEIGHT,dpr:o=Yu.DPR,x:s,y:a,id:l,canvasControled:h=!0}=t;this._x=null!=s?s:0,this._y=null!=a?a:0,this._pixelWidth=r*o,this._pixelHeight=n*o,this._visiable=!1!==t.visiable,this.controled=h,this._displayWidth=r,this._displayHeight=n,this._dpr=o,this._nativeCanvas=i,this._id=null!==(e=i.id)&&void 0!==e?e:l,l&&(i.id=l),this.init(t)}getNativeCanvas(){return this._nativeCanvas}hide(){}show(){}applyPosition(){}resetStyle(t){}resize(t,e){}toDataURL(t,e){return""}readPixels(t,e,i,r){return this._context.getImageData(t,e,i,r)}convertToBlob(t){throw new Error("暂未实现")}transferToImageBitmap(){throw new Error("暂未实现")}release(){this.controled&&this._nativeCanvas.parentElement&&this._nativeCanvas.parentElement.removeChild(this._nativeCanvas)}};qu.env="browser",qu=$u([f(),Xu("design:paramtypes",[Object])],qu);var Zu=function(t,e,i,r){var n,o=arguments.length,s=o<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,i,r);else for(var a=t.length-1;a>=0;a--)(n=t[a])&&(s=(o<3?n(s):o>3?n(e,i,s):n(e,i))||s);return o>3&&s&&Object.defineProperty(e,i,s),s};let Ju=class{configure(t){t.env===this.type&&t.setActiveEnvContribution(this)}getNativeAABBBounds(t){return new ge}removeDom(t){return!1}createDom(t){return null}getDynamicCanvasCount(){return 999}getStaticCanvasCount(){return 999}getElementById(t){return document.getElementById(t)}getRootElement(){return document.body}loadJson(t){const e=fetch(t).then((t=>t.json()));return e.then((t=>({data:t,state:"success"}))).catch((()=>({data:null,state:"fail"}))),e}loadArrayBuffer(t){return fetch(t).then((t=>t.arrayBuffer())).then((t=>({data:t,loadState:"success"}))).catch((()=>({data:null,loadState:"fail"})))}loadBlob(t){return fetch(t).then((t=>t.blob())).then((t=>({data:t,loadState:"success"}))).catch((()=>({data:null,loadState:"fail"})))}getElementTop(t,e){return 0}getElementLeft(t,e){return 0}getElementTopLeft(t,e){return{top:0,left:0}}};Ju=Zu([f()],Ju);var Qu=function(t,e,i,r){var n,o=arguments.length,s=o<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,i,r);else for(var a=t.length-1;a>=0;a--)(n=t[a])&&(s=(o<3?n(s):o>3?n(e,i,s):n(e,i))||s);return o>3&&s&&Object.defineProperty(e,i,s),s},tg=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let eg=class{constructor(){this._uid=e.GenAutoIncrementId()}onChange(t){this._onChangeCb=t}configure(t,e){e.env===this.type&&t.setWindowHandler(this)}release(){this.releaseWindow()}isVisible(t){return!0}onVisibleChange(t){}getTopLeft(t){return{top:0,left:0}}};eg=Qu([f(),tg("design:paramtypes",[])],eg);var ig=function(t,e,i,r){var n,o=arguments.length,s=o<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,i,r);else for(var a=t.length-1;a>=0;a--)(n=t[a])&&(s=(o<3?n(s):o>3?n(e,i,s):n(e,i))||s);return o>3&&s&&Object.defineProperty(e,i,s),s},rg=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},ng=function(t,e){return function(i,r){e(i,r,t)}};let og=class{constructor(t){this.pickItemInterceptorContributions=t,this.type="default",this.global=kr.global}_init(){this.InterceptorContributions=this.pickItemInterceptorContributions.getContributions().sort(((t,e)=>t.order-e.order))}pick(t,e,i){let r={graphic:null,group:null};i.pickerService=this;let n=0,o=0;if(i&&i.bounds){if(!i.bounds.contains(e.x,e.y))return r;n=i.bounds.x1,o=i.bounds.y1}this.pickContext&&(this.pickContext.inuse=!0),i.pickContext=this.pickContext,this.pickContext&&this.pickContext.clearMatrix(!0,1);const s=new me(1,0,0,1,n,o);let a;for(let n=t.length-1;n>=0&&(r=t[n].isContainer?this.pickGroup(t[n],e,s,i):this.pickItem(t[n],e,s,i),!r.graphic);n--)a||(a=r.group);if(r.graphic||(r.group=a),this.pickContext&&(this.pickContext.inuse=!1),r.graphic){let t=r.graphic;for(;t.parent;)t=t.parent;t.shadowHost&&(r.params={shadowTarget:r.graphic},r.graphic=t.shadowHost)}return r}containsPoint(t,e,i){var r;return!!(null===(r=this.pickItem(t,e,null,null!=i?i:{pickContext:this.pickContext,pickerService:this}))||void 0===r?void 0:r.graphic)}pickGroup(t,e,i,r){let n={group:null,graphic:null};if(!1===t.attribute.visibleAll)return n;const o=r.pickContext,s=o.modelMatrix;if(o.camera){const e=t.transMatrix,i=th.allocate();if(oh(i,e),s){if(i){const t=th.allocate();o.modelMatrix=sh(t,s,i),th.free(i)}}else oh(i,t.globalTransMatrix),o.modelMatrix=i}if(this.InterceptorContributions.length)for(let n=0;n<this.InterceptorContributions.length;n++){const a=this.InterceptorContributions[n];if(a.beforePickItem){const n=a.beforePickItem(t,this,e,r,{parentMatrix:i});if(n)return o.modelMatrix!==s&&th.free(o.modelMatrix),o.modelMatrix=s,n}}const a=t.transMatrix,l=Ql.allocateByObj(i),h=new he(e.x,e.y);l.transformPoint(h,h);const c=t.AABBBounds.containsPoint(h);if(!c&&!t.stage.camera)return n;const d=this.pickItem(t,h.clone(),i,r);d&&d.graphic&&(n.graphic=d.graphic,n.params=d.params);const u=!1!==t.attribute.pickable&&c;return l.multiply(a.a,a.b,a.c,a.d,a.e,a.f),!1===t.attribute.childrenPickable||d&&d.graphic||jd(t,yr.zIndex,(o=>{if(o.isContainer){const i=new he(e.x,e.y),s=Cn(t).group,{scrollX:a=s.scrollX,scrollY:h=s.scrollY}=t.attribute;i.x-=a,i.y-=h,n=this.pickGroup(o,i,l,r)}else{const s=new he(e.x,e.y);l.transformPoint(s,s);const a=Cn(t).group,{scrollX:h=a.scrollX,scrollY:c=a.scrollY}=t.attribute;s.x-=h,s.y-=c;const d=this.pickItem(o,s,i,r);d&&d.graphic&&(n.graphic=d.graphic,n.params=d.params)}return!!n.graphic||!!n.group}),!0,!!o.camera),o.modelMatrix!==s&&th.free(o.modelMatrix),o.modelMatrix=s,n.graphic||n.group||!u||t.stage.camera||(n.group=t),Ql.free(l),n}selectPicker(t){return this.pickerMap.get(t.numberType)||null}};og=ig([f(),ng(0,g(E)),ng(0,m(bd)),rg("design:paramtypes",[Object])],og);let sg=!1;const ag=new i((t=>{sg||(sg=!0,t(Kh).toSelf().inSingletonScope(),t(Uc).to(Kh).inSingletonScope(),t(Xc).toService(Uc),t(Is).toService(wh),L(t,Is))}));let lg=!1;const hg=new i((t=>{lg||(lg=!0,t(Cc).toSelf().inSingletonScope(),t(Qc).to(Cc).inSingletonScope(),t(Xc).toService(Qc),t(Fh).toSelf(),t(Ih).toSelf(),t(Gs).toService(Fh),t(Gs).toService(Ih),t(Gs).toService(wh),L(t,Gs))}));let cg=!1;const dg=new i((t=>{cg||(cg=!0,t(tc).toSelf().inSingletonScope(),t(du).toSelf().inSingletonScope(),t(qc).to(tc).inSingletonScope(),t(Xc).toService(qc))}));let ug=!1;const gg=new i((t=>{ug||(ug=!0,t(hc).toSelf().inSingletonScope(),t(Kc).to(hc).inSingletonScope(),t(Xc).toService(Kc),t(Fs).toService(wh),L(t,Fs),t(gu).toSelf().inSingletonScope())}));let pg=!1;const fg=new i((t=>{pg||(pg=!0,t(_c).toSelf().inSingletonScope(),t(ed).to(_c).inSingletonScope(),t(Xc).toService(ed),t(js).toService(wh),L(t,js))}));let mg=!1;const bg=new i((t=>{mg||(mg=!0,t(qh).toSelf().inSingletonScope(),t($c).to(qh).inSingletonScope(),t(Xc).toService($c),t(zs).toService(wh),L(t,zs))}));let yg=!1;const Cg=new i((t=>{yg||(yg=!0,t(id).to(Mc).inSingletonScope(),t(Xc).toService(id),t(Us).toService(wh),L(t,Us))}));let vg=!1;const wg=new i((t=>{vg||(vg=!0,t(fc).toSelf().inSingletonScope(),t(Zc).to(fc).inSingletonScope(),t(Xc).toService(Zc),t(Ws).toService(wh),L(t,Ws))}));let xg=!1;const _g=new i((t=>{xg||(xg=!0,t(Jc).to(zc).inSingletonScope(),t(Xc).toService(Jc),t(Ns).toService(wh),L(t,Ns))}));var Sg=function(t,e,i,r){var n,o=arguments.length,s=o<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,i,r);else for(var a=t.length-1;a>=0;a--)(n=t[a])&&(s=(o<3?n(s):o>3?n(e,i,s):n(e,i))||s);return o>3&&s&&Object.defineProperty(e,i,s),s};let Ag=class{constructor(){this.numberType=Ko}drawShape(t,e,i,r,n,o,s,a){n.drawContribution&&t.getSubGraphic().forEach((t=>{const l=n.drawContribution.getRenderContribution(t);l&&l.drawShape&&l.drawShape(t,e,i,r,n,o,s,a)}))}draw(t,e,i,r){const{context:n}=i;if(!n)return;if(n.highPerformanceSave(),!i.drawContribution)return;const o=Cn(t),s=t.getSubGraphic();s.length&&s.forEach((t=>{i.drawContribution.renderItem(t,i,{theme:o})})),n.highPerformanceRestore()}};Ag=Sg([f()],Ag);let Bg=!1;const Tg=new i((t=>{Bg||(Bg=!0,t(od).to(Ag).inSingletonScope(),t(Xc).toService(od))}));var Mg=function(t,e,i,r){var n,o=arguments.length,s=o<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,i,r);else for(var a=t.length-1;a>=0;a--)(n=t[a])&&(s=(o<3?n(s):o>3?n(e,i,s):n(e,i))||s);return o>3&&s&&Object.defineProperty(e,i,s),s},Rg=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let Pg=class extends gh{constructor(){super(),this.numberType=es,this.builtinContributions=[Sc],this.init()}drawShape(t,e,i,r,n){const o=Cn(t).richtext,{strokeOpacity:s=o.strokeOpacity,opacity:a=o.opacity,fillOpacity:l=o.fillOpacity,visible:h=o.visible}=t.attribute;if(!t.valid||!h)return;const c=As(a,l,!0),d=As(a,s,!0);c&&(e.translate(i,r),this.beforeRenderStep(t,e,i,r,c,d,c,d,o,n),t.getFrameCache().draw(e,this.drawIcon),this.afterRenderStep(t,e,i,r,c,d,c,d,o,n))}drawIcon(t,e,i,r,n){var o;const s=Cn(t).richtextIcon,{width:a=s.width,height:l=s.height,opacity:h=s.opacity,image:c,backgroundFill:d=s.backgroundFill,backgroundFillOpacity:u=s.backgroundFillOpacity,backgroundStroke:g=s.backgroundStroke,backgroundStrokeOpacity:p=s.backgroundStrokeOpacity,backgroundRadius:f=s.backgroundRadius,margin:m}=t.attribute,{backgroundWidth:b=a,backgroundHeight:y=l}=t.attribute;if(m&&(i+=t._marginArray[3],r+=t._marginArray[0]),t._hovered){const t=(b-a)/2,n=(y-l)/2;0===f?(e.beginPath(),e.rect(i-t,r-n,b,y)):(e.beginPath(),Hh(e,i-t,r-n,b,y,f)),d&&(e.globalAlpha=u,e.fillStyle=d,e.fill()),g&&(e.globalAlpha=p,e.strokeStyle=g,e.stroke())}const C=c&&(null===(o=null==t?void 0:t.resources)||void 0===o?void 0:o.get(c));C&&"success"===C.state&&(e.globalAlpha=h,e.drawImage(C.data,i,r,a,l))}draw(t,e,i){const r=Cn(t).richtext;this._draw(t,r,!1,i)}};Pg=Mg([f(),Rg("design:paramtypes",[])],Pg);let Eg=!1;const Hg=new i((t=>{Eg||(Eg=!0,t(rd).to(Pg).inSingletonScope(),t(Xc).toService(rd))}));let Lg=!1;const kg=new i((t=>{Lg||(Lg=!0,t(sd).to(Gc).inSingletonScope(),t(Xc).toService(sd),t(Ds).toService(wh),L(t,Ds))}));var Ig=function(t,e,i,r){var n,o=arguments.length,s=o<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,i,r);else for(var a=t.length-1;a>=0;a--)(n=t[a])&&(s=(o<3?n(s):o>3?n(e,i,s):n(e,i))||s);return o>3&&s&&Object.defineProperty(e,i,s),s};let Fg=class extends gh{constructor(){super(...arguments),this.type="rect3d",this.numberType=ts}drawShape(t,e,i,r,n,o,s,a){var l;const h=Cn(t,null==o?void 0:o.theme).rect3d,{fill:c=h.fill,stroke:d=h.stroke,x1:u,y1:g,x:p,y:f,opacity:m=h.opacity,fillOpacity:b=h.fillOpacity,lineWidth:y=h.lineWidth,strokeOpacity:C=h.strokeOpacity,visible:v=h.visible}=t.attribute;let{width:w,height:x}=t.attribute;w=(null!=w?w:u-p)||0,x=(null!=x?x:g-f)||0;const _=null!==(l=this.z)&&void 0!==l?l:0,S=Bs(m,b,w,x,c),A=Ms(m,C,w,x),B=_s(c),T=Ss(d,y);if(!t.valid||!v)return;if(!B&&!T)return;if(!(S||A||s||a))return;const{light:M,camera:R}=n.stage||{},P=t.findFace();if(!1!==c){e.setCommonStyle(t,t.attribute,i,r,h);let n=c;"string"!=typeof n&&(n="black"),this.fill(i,r,_,P,n,e,M,s)}!1!==d&&(e.setStrokeStyle(t,t.attribute,i,r,h),this.stroke(i,r,_,P,e))}stroke(t,e,i,r,n){const o=r.vertices;r.edges.forEach((r=>{const s=o[r[0]],a={x:t+s[0],y:e+s[1],z:i+s[2]},l=o[r[1]],h={x:t+l[0],y:e+l[1],z:i+l[2]};n.beginPath(),n.moveTo(a.x,a.y,a.z),n.lineTo(h.x,h.y,h.z),n.stroke()}))}fill(t,e,i,r,n,o,s,a){const l=so.Get(n,oo.Color255),h=r.vertices,c=h.map((t=>o.view(t[0],t[1],t[2])[2])),d=[];r.polygons.forEach(((t,e)=>{d.push({faceIdx:e,polygon:t});const{polygon:i,normal:r}=t,n=c[i[0]],o=c[i[1]],s=c[i[2]],a=c[i[3]];t.ave_z=n+o+s+a})),d.sort(((t,e)=>e.polygon.ave_z-t.polygon.ave_z)),d.forEach((r=>{const{polygon:c,normal:d}=r.polygon,u=h[c[0]],g=h[c[1]],p=h[c[2]],f=h[c[3]],m={x:t+u[0],y:e+u[1],z:i+u[2]},b={x:t+g[0],y:e+g[1],z:i+g[2]},y={x:t+p[0],y:e+p[1],z:i+p[2]},C={x:t+f[0],y:e+f[1],z:i+f[2]};o.beginPath(),o.moveTo(m.x,m.y,m.z),o.lineTo(b.x,b.y,b.z),o.lineTo(y.x,y.y,y.z),o.lineTo(C.x,C.y,C.z),o.closePath(),a?a(o,null,null):(o.fillStyle=s?s.computeColor(d,l):n,o.fill())}))}draw(t,e,i){const r=Cn(t).rect;this._draw(t,r,!1,i)}};Fg=Ig([f()],Fg);let zg=!1;const Og=new i((t=>{zg||(zg=!0,t(td).to(Fg).inSingletonScope(),t(Xc).toService(td))}));var Dg=function(t,e,i,r){var n,o=arguments.length,s=o<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,i,r);else for(var a=t.length-1;a>=0;a--)(n=t[a])&&(s=(o<3?n(s):o>3?n(e,i,s):n(e,i))||s);return o>3&&s&&Object.defineProperty(e,i,s),s};let Wg=class extends gh{constructor(){super(...arguments),this.numberType=jo}drawShape(t,e,i,r,n,o,s,a){var l;const h=Cn(t,null==o?void 0:o.theme).arc,{fill:c=h.fill}=t.attribute,d=this.valid(t,h,s,a);if(!d)return;const{fVisible:u,sVisible:g,doFill:p,doStroke:f}=d,m=null!==(l=this.z)&&void 0!==l?l:0,{outerRadius:b=h.outerRadius,innerRadius:y=h.innerRadius,height:C=10}=t.attribute,v=so.Get(c,oo.Color255),{light:w}=n.stage||{},x=n.hack_pieFace,_={top:m,bottom:m+C},S={top:[0,1,0],bottom:[0,-1,0],outside:[1,0,-1],inside:[1,0,-1]};"bottom"===x||"top"===x?(e.beginPath(),function(t,e,i,r,n,o,s){const{startAngle:a,endAngle:l}=t.getParsedAngle(),h=Jt(l-a),c=l>a;let d=!1;if(o<s){const t=o;o=s,s=t}if(o<=$t)e.moveTo(i,r,n);else if(h>=Zt-$t)e.moveTo(i+o*te(a),r+o*re(a),n),e.arc(i,r,o,a,l,!c,n),s>$t&&(e.moveTo(i+s*te(l),r+s*re(l),n),e.arc(i,r,s,l,a,c,n));else{const{outerDeltaAngle:h,innerDeltaAngle:u,outerStartAngle:g,outerEndAngle:p,innerEndAngle:f,innerStartAngle:m}=t.getParsePadAngle(a,l),b=o*te(g),y=o*re(g),C=s*te(f),v=s*re(f);h<.001?d=!0:(e.moveTo(i+b,r+y,n),e.arc(i,r,o,g,p,!c,n)),!(s>$t)||u<.001?(e.lineTo(i+C,r+v,n),d=!0):(e.lineTo(i+C,r+v,n),e.arc(i,r,s,f,m,c,n))}e.closePath()}(t,e,i,r,_[x],b,y),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,h),p&&(s?s(e,t.attribute,h):u&&(e.setCommonStyle(t,t.attribute,i,r,h),e.fillStyle=w?w.computeColor(S[x],v):c,e.fill())),f&&(a?a(e,t.attribute,h):g&&(e.setStrokeStyle(t,t.attribute,i,r,h),e.stroke()))):"outside"!==x&&"inside"!==x||("inside"===x&&(e.save(),e.beginPath(),e.arc(i,r,y,0,Zt,!0,_.top),e.clip()),e.beginPath(),function(t,e,i,r,n,o,s,a){const{startAngle:l,endAngle:h}=t.getParsedAngle(),c=Jt(h-l),d=h>l;let u=!1;if(s<=$t)e.moveTo(i,r,n);else if(c>=Zt-$t)e.moveTo(i+s*te(l),r+s*re(l),n),e.arc(i,r,s,l,h,!d,n),e.lineTo(i+s*te(h),r+s*re(h),o),e.arc(i,r,s,h,l,d,o);else{const{innerouterDeltaAngle:t,innerouterStartAngle:c,innerouterEndAngle:g}=a(l,h),p=s*te(c),f=s*re(c),m=s*te(g),b=s*re(g);t<.001?u=!0:(e.moveTo(i+p,r+f,n),e.arc(i,r,s,c,g,!d,n),e.lineTo(i+m,r+b,o),e.arc(i,r,s,g,c,d,o))}e.closePath()}(t,e,i,r,_.top,_.bottom,"outside"===x?b:y,((e,i)=>{const{outerDeltaAngle:r,innerDeltaAngle:n,outerStartAngle:o,outerEndAngle:s,innerEndAngle:a,innerStartAngle:l}=t.getParsePadAngle(e,i);return"outside"===x?{innerouterDeltaAngle:r,innerouterEndAngle:s,innerouterStartAngle:o}:{innerouterDeltaAngle:n,innerouterEndAngle:a,innerouterStartAngle:l}})),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,h),p&&(s?s(e,t.attribute,h):u&&(e.setCommonStyle(t,t.attribute,i,r,h),e.fillStyle=w?w.computeColor(S[x],v):c,e.fill())),f&&(a?a(e,t.attribute,h):g&&(e.setStrokeStyle(t,t.attribute,i,r,h),e.stroke())),"inside"===x&&e.restore())}draw(t,e,i,r){const n=Cn(t,null==r?void 0:r.theme).arc;this._draw(t,n,!1,i,r)}};Wg=Dg([f()],Wg);let Ng=!1;const Gg=new i((t=>{Ng||(Ng=!0,t(Vc).to(Wg).inSingletonScope(),t(Xc).toService(Vc))}));var jg=function(t,e,i,r){var n,o=arguments.length,s=o<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,i,r);else for(var a=t.length-1;a>=0;a--)(n=t[a])&&(s=(o<3?n(s):o>3?n(e,i,s):n(e,i))||s);return o>3&&s&&Object.defineProperty(e,i,s),s};let Ug=class extends gh{constructor(){super(...arguments),this.type="pyramid3d",this.numberType=Jo}drawShape(t,e,i,r,n,o,s,a){var l;const h=Cn(t,null==o?void 0:o.theme).polygon,{fill:c=h.fill,stroke:d=h.stroke,face:u=[!0,!0,!0,!0,!0,!0]}=t.attribute,g=null!==(l=this.z)&&void 0!==l?l:0;if(!this.valid(t,h,s,a))return;const{light:p,camera:f}=n.stage||{},m=t.findFace();if(!1!==c){e.setCommonStyle(t,t.attribute,i,r,h);let n=c;"string"!=typeof n&&(n="black"),this.fill(i,r,g,m,u,n,e,p,f,t,h,s)}!1!==d&&(e.setStrokeStyle(t,t.attribute,i,r,h),this.stroke(i,r,g,m,e))}stroke(t,e,i,r,n){const o=r.vertices;r.edges.forEach((r=>{const s=o[r[0]],a=o[r[1]],l={x:t+s[0],y:e+s[1],z:i+s[2]},h={x:t+a[0],y:e+a[1],z:i+a[2]};n.beginPath(),n.moveTo(l.x,l.y,l.z),n.lineTo(h.x,h.y,h.z),n.stroke()}))}fill(t,e,i,r,n,o,s,a,l,h,c,d){const u=so.Get(o,oo.Color255),g=r.vertices,p=g.map((t=>s.view(t[0],t[1],t[2])[2])),f=[];r.polygons.forEach(((t,e)=>{if(!n[e])return;f.push({faceIdx:e,polygon:t});const{polygon:i,normal:r}=t,o=p[i[0]],s=p[i[1]],a=p[i[2]],l=p[i[3]];t.ave_z=o+s+a+l})),f.sort(((t,e)=>e.polygon.ave_z-t.polygon.ave_z)),f.forEach((r=>{const{polygon:n,normal:l}=r.polygon,p=g[n[0]],f=g[n[1]],m=g[n[2]],b=g[n[3]],y={x:t+p[0],y:e+p[1],z:i+p[2]},C={x:t+f[0],y:e+f[1],z:i+f[2]},v={x:t+m[0],y:e+m[1],z:i+m[2]},w={x:t+b[0],y:e+b[1],z:i+b[2]};s.beginPath(),s.moveTo(y.x,y.y,y.z),s.lineTo(C.x,C.y,C.z),s.lineTo(v.x,v.y,v.z),s.lineTo(w.x,w.y,w.z),s.closePath(),d?d(s,h.attribute,c):(s.fillStyle=a?a.computeColor(l,u):o,s.fill())}))}draw(t,e,i){const r=Cn(t).polygon;this._draw(t,r,!1,i)}};Ug=jg([f()],Ug);let Vg=!1;const Kg=new i((t=>{Vg||(Vg=!0,t(nd).to(Ug).inSingletonScope(),t(Xc).toService(nd))}));const $g={onPointerDown:"pointerdown",onPointerUp:"pointerup",onPointerUpOutside:"pointerupoutside",onPointerTap:"pointertap",onPointerOver:"pointerover",onPointerMove:"pointermove",onPointerEnter:"pointerenter",onPointerLeave:"pointerleave",onPointerOut:"pointerout",onMouseDown:"mousedown",onMouseUp:"mouseup",onMouseUpOutside:"mouseupoutside",onMouseMove:"mousemove",onMouseOver:"mouseover",onMouseOut:"mouseout",onMouseEnter:"mouseenter",onMouseLeave:"mouseleave",onPinch:"pinch",onPinchStart:"pinchstart",onPinchEnd:"pinchend",onPan:"pan",onPanStart:"panstart",onPanEnd:"panend",onDrag:"drag",onDragStart:"dragstart",onDragEnter:"dragenter",onDragLeave:"dragleave",onDragOver:"dragover",onDragEnd:"dragend",onRightDown:"rightdown",onRightUp:"rightup",onRightUpOutside:"rightupoutside",onTouchStart:"touchstart",onTouchEnd:"touchend",onTouchEndOutside:"touchendoutside",onTouchMove:"touchmove",onTouchCancel:"touchcancel",onPress:"press",onPressUp:"pressup",onPressEnd:"pressend",onSwipe:"swipe",onDrop:"drop",onWeel:"wheel",onClick:"click",onDblClick:"dblclick"};var Xg=function(t,e){var i={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)<0&&(i[r]=t[r]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(r=Object.getOwnPropertySymbols(t);n<r.length;n++)e.indexOf(r[n])<0&&Object.prototype.propertyIsEnumerable.call(t,r[n])&&(i[r[n]]=t[r[n]])}return i};function Yg(t,e){if(it(t))return t.forEach((t=>Yg(t,e)));e.push(t)}const qg=(t,e)=>{const i=e.x-t.x,r=e.y-t.y;return Math.abs(i)>Math.abs(r)?i>0?"right":"left":r>0?"down":"up"},Zg=(t,e)=>{const i=Math.abs(e.x-t.x),r=Math.abs(e.y-t.y);return Math.sqrt(i*i+r*r)};class Jg extends U{constructor(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};var i,r,n,o,s,a,l,h,c,d;super(),this.cachedEvents=[],this.startPoints=[],this.processEvent={},this.throttleTimer=0,this.emitThrottles=[],this.lastTapTarget=null,this.onStart=t=>{this.reset(),this.startTime=Tn.now();const{cachedEvents:e,startPoints:i}=this;t&&e.push(t.clone()),i.length=e.length;for(let t=0;t<e.length;t++){const{x:r,y:n}=e[t],o={x:r,y:n};i[t]=o}if(1!==i.length)this.startDistance=Zg(i[0],i[1]),this.center=(t=>{const e=t.length;if(1===e)return{x:Math.round(t[0].x),y:Math.round(t[0].y)};let i=0,r=0,n=0;for(;n<e;)i+=t[n].x,r+=t[n].y,n++;return{x:Math.round(i/e),y:Math.round(r/e)}})([i[0],i[1]]);else{const t=e[0];this.pressTimeout=setTimeout((()=>{t.direction="none",t.deltaX=0,t.deltaY=0,t.points=i,this.triggerStartEvent("press",t),this.triggerEvent("press",t),this.eventType="press",this.direction="none"}),this.config.press.time)}},this.onMove=t=>{this.clearPressTimeout();const{startPoints:e,cachedEvents:i}=this;if(!e.length)return;const r=t.clone(),{x:n,y:o,pointerId:s}=r;for(let t=0,e=i.length;t<e;t++)if(s===i[t].pointerId){i[t]=r;break}const a={x:n,y:o},l=i.map((t=>({x:t.x,y:t.y}))),h=Tn.now();if(this.prevMoveTime=this.lastMoveTime,this.prevMovePoint=this.lastMovePoint,this.lastMoveTime=h,this.lastMovePoint=a,1===e.length){const t=e[0],i=n-t.x,s=o-t.y,h=this.direction||qg(t,a);this.direction=h;const c=this.getEventType(a);return r.direction=h,r.deltaX=i,r.deltaY=s,r.points=l,this.triggerStartEvent(c,r),void this.triggerEvent(c,r)}const{startDistance:c}=this,d=Zg(l[0],l[1]);r.scale=d/c,r.center=this.center,r.points=l,this.triggerStartEvent("pinch",r),this.triggerEvent("pinch",r)},this.onEnd=t=>{const e=t.clone(),{cachedEvents:i,startPoints:r}=this,n=i.map((t=>({x:t.x,y:t.y})));if(e.points=n,this.triggerEndEvent(e),1===i.length){const i=Tn.now(),n=this.lastMoveTime;if(i-n<100){const t=n-(this.prevMoveTime||this.startTime);if(t>0){const i=this.prevMovePoint||r[0],n=this.lastMovePoint||r[0],o=Zg(i,n),s=o/t;s>this.config.swipe.velocity&&o>this.config.swipe.threshold&&(e.velocity=s,e.direction=qg(i,n),this.triggerEvent("swipe",e))}}i-this.lastTapTime<this.config.tap.interval&&t.target===this.lastTapTarget?this.tapCount++:this.tapCount=1,this.lastTapTime=i,this.lastTapTarget=t.target,1===this.tapCount?this.triggerEvent("tap",e):2===this.tapCount&&(this.triggerEvent("doubletap",e),this.tapCount=0)}for(let t=0,n=i.length;t<n;t++)if(i[t].pointerId===e.pointerId){i.splice(t,1),r.splice(t,1);break}this.reset(),i.length>0&&this.onStart()},this.element=t,this.tapCount=0,this.lastTapTime=0,this.config={press:{time:null!==(r=null===(i=null==e?void 0:e.press)||void 0===i?void 0:i.time)&&void 0!==r?r:251,threshold:null!==(o=null===(n=null==e?void 0:e.press)||void 0===n?void 0:n.threshold)&&void 0!==o?o:9},swipe:{threshold:null!==(a=null===(s=null==e?void 0:e.swipe)||void 0===s?void 0:s.threshold)&&void 0!==a?a:10,velocity:null!==(h=null===(l=null==e?void 0:e.swipe)||void 0===l?void 0:l.velocity)&&void 0!==h?h:.3},tap:{interval:null!==(d=null===(c=null==e?void 0:e.tap)||void 0===c?void 0:c.interval)&&void 0!==d?d:300}},this.initEvents()}initEvents(){const{element:t}=this;t&&(t.addEventListener("pointerdown",this.onStart),t.addEventListener("pointermove",this.onMove),t.addEventListener("pointerup",this.onEnd),t.addEventListener("pointerupoutside",this.onEnd))}removeEvents(){const{element:t}=this;t&&(t.removeEventListener("pointerdown",this.onStart),t.removeEventListener("pointermove",this.onMove),t.removeEventListener("pointerup",this.onEnd),t.removeEventListener("pointerupoutside",this.onEnd))}release(){this.removeEvents(),this.element=null}getEventType(t){const{eventType:e,startTime:i,startPoints:r}=this;if(e)return e;let n;return n=Tn.now()-i>this.config.press.time&&Zg(r[0],t)<this.config.press.threshold?"press":"pan",this.eventType=n,n}enable(t){this.processEvent[t]=!0}isProcess(t){return this.processEvent[t]}pushEvent(t,e){const{emitThrottles:i}=this,r={type:t,ev:e};for(let e=0,n=i.length;e<n;e++)if(i[e].type===t)return void i.splice(e,1,r);i.push(r)}clearPressTimeout(){this.pressTimeout&&(clearTimeout(this.pressTimeout),this.pressTimeout=null)}reset(){this.clearPressTimeout(),this.startTime=0,this.startDistance=0,this.direction=null,this.eventType=null,this.prevMoveTime=0,this.prevMovePoint=null,this.lastMoveTime=0,this.lastMovePoint=null}triggerEvent(t,e){this.pushEvent(t,e);const{throttleTimer:i,emitThrottles:r}=this;i||(this.throttleTimer=kr.global.getRequestAnimationFrame()((()=>{for(let t=0,e=r.length;t<e;t++){const{type:e,ev:i}=r[t];this.emitEvent(e,i)}this.throttleTimer=0,this.emitThrottles.length=0})))}triggerStartEvent(t,e){this.isProcess(t)||(this.enable(t),this.triggerEvent(`${t}start`,e))}triggerEndEvent(t){const e=this.processEvent;Object.keys(e).forEach((i=>{this.triggerEvent(`${i}end`,t),"press"===i&&this.triggerEvent(`${i}up`,t),delete e[i]}))}emitEvent(t,e){const i=this.element._events["*"];if(i)if("fn"in i)i.fn.call(i.context,e,t);else for(let r=0,n=i.length;r<n&&!e.propagationImmediatelyStopped;r++)i[r].fn.call(i[r].context,e,t);this.emit(t,e)}}var Qg=function(t,e,i,r){var n,o=arguments.length,s=o<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,i,r);else for(var a=t.length-1;a>=0;a--)(n=t[a])&&(s=(o<3?n(s):o>3?n(e,i,s):n(e,i))||s);return o>3&&s&&Object.defineProperty(e,i,s),s},tp=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const ep=[0,0,0],ip=new me(1,0,0,1,0,0);let rp=class{set fillStyle(t){this.nativeContext.fillStyle=t}get fillStyle(){return this.nativeContext.fillStyle}set font(t){this.nativeContext.font=t}get font(){return this.nativeContext.font}set globalAlpha(t){this.nativeContext.globalAlpha=t}get globalAlpha(){return this.nativeContext.globalAlpha}set lineCap(t){this.nativeContext.lineCap=t}get lineCap(){return this.nativeContext.lineCap}set lineDashOffset(t){this.nativeContext.lineDashOffset=t}get lineDashOffset(){return this.nativeContext.lineDashOffset}set lineJoin(t){this.nativeContext.lineJoin=t}get lineJoin(){return this.nativeContext.lineJoin}set lineWidth(t){this.nativeContext.lineWidth=t}get lineWidth(){return this.nativeContext.lineWidth}set miterLimit(t){this.nativeContext.miterLimit=t}get miterLimit(){return this.nativeContext.miterLimit}set shadowBlur(t){this.nativeContext.shadowBlur=t}get shadowBlur(){return this.nativeContext.shadowBlur}set shadowColor(t){this.nativeContext.shadowColor=t}get shadowColor(){return this.nativeContext.shadowColor}set shadowOffsetX(t){this.nativeContext.shadowOffsetX=t}get shadowOffsetX(){return this.nativeContext.shadowOffsetX}set shadowOffsetY(t){this.nativeContext.shadowOffsetY=t}get shadowOffsetY(){return this.nativeContext.shadowOffsetY}set strokeStyle(t){this.nativeContext.strokeStyle=t}get strokeStyle(){return this.nativeContext.strokeStyle}set textAlign(t){this.nativeContext.textAlign=t}get textAlign(){return this.nativeContext.textAlign}set textBaseline(t){this.nativeContext.textBaseline=t}get textBaseline(){return this.nativeContext.textBaseline}get inuse(){return!!this._inuse}set inuse(t){t!==!!this._inuse&&(this._inuse=t,t?(this.nativeContext.save(),this.reset()):this.nativeContext.restore())}constructor(t,e){this.fillAttributes=Object.assign(Object.assign({},ur),{opacity:1}),this.strokeAttributes=Object.assign(Object.assign({},pr),{opacity:1}),this.textAttributes=Object.assign(Object.assign({},fr),{opacity:1}),this._clearShadowStyle=!1,this._clearFilterStyle=!1,this._clearGlobalCompositeOperationStyle=!1;const i=t.nativeCanvas.getContext("2d");if(!i)throw new Error("发生错误,获取2d上下文失败");this.nativeContext=i,this.canvas=t,this.matrix=new me(1,0,0,1,0,0),this.stack=[],this.dpr=e,this.applyedMatrix=new me(1,0,0,1,0,0)}reset(){this.stack.length&&Ze.getInstance().warn("可能存在bug,matrix没有清空"),this.matrix.setValue(1,0,0,1,0,0),this.applyedMatrix=new me(1,0,0,1,0,0),this.stack.length=0,this.nativeContext.setTransform(1,0,0,1,0,0)}getCanvas(){return this.canvas}getContext(){return this.nativeContext}setTransformForCurrent(){!(arguments.length>0&&void 0!==arguments[0]&&arguments[0])&&this.applyedMatrix.equalToMatrix(this.matrix)||(this.applyedMatrix.setValue(this.matrix.a,this.matrix.b,this.matrix.c,this.matrix.d,this.matrix.e,this.matrix.f),this.nativeContext.setTransform(this.matrix.a,this.matrix.b,this.matrix.c,this.matrix.d,this.matrix.e,this.matrix.f))}get currentMatrix(){return this.matrix}cloneMatrix(t){return Ql.allocateByObj(t)}clear(){this.save(),this.resetTransform(),this.nativeContext.clearRect(0,0,this.canvas.width,this.canvas.height),this.restore()}restore(){this.nativeContext.restore(),this.stack.length>0&&(Ql.free(this.matrix),this.matrix=this.stack.pop(),this.setTransformForCurrent(!0))}highPerformanceRestore(){this.stack.length>0&&(Ql.free(this.matrix),this.matrix=this.stack.pop())}rotate(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];this.matrix.rotate(t),e&&this.setTransformForCurrent()}save(){const t=this.cloneMatrix(this.matrix);this.stack.push(t),this.nativeContext.save()}highPerformanceSave(){const t=this.cloneMatrix(this.matrix);this.stack.push(t)}scale(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];this.matrix.scale(t,e),i&&this.setTransformForCurrent()}setScale(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];this.matrix.setScale(t,e),i&&this.setTransformForCurrent()}scalePoint(t,e,i,r){let n=!(arguments.length>4&&void 0!==arguments[4])||arguments[4];this.translate(i,r,!1),this.scale(t,e,!1),this.translate(-i,-r,!1),n&&this.setTransformForCurrent()}setTransform(t,e,i,r,n,o){let s=!(arguments.length>6&&void 0!==arguments[6])||arguments[6],a=arguments.length>7&&void 0!==arguments[7]?arguments[7]:this.dpr;this.matrix.setValue(a*t,a*e,a*i,a*r,a*n,a*o),s&&this.setTransformForCurrent()}setTransformFromMatrix(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:this.dpr;this.matrix.setValue(t.a*i,t.b*i,t.c*i,t.d*i,t.e*i,t.f*i),e&&this.setTransformForCurrent()}resetTransform(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.dpr;this.setTransform(e,0,0,e,0,0),t&&this.setTransformForCurrent()}transform(t,e,i,r,n,o){let s=!(arguments.length>6&&void 0!==arguments[6])||arguments[6];this.matrix.multiply(t,e,i,r,n,o),s&&this.setTransformForCurrent()}transformFromMatrix(t,e){this.matrix.multiply(t.a,t.b,t.c,t.d,t.e,t.f),e&&this.setTransformForCurrent()}translate(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];this.matrix.translate(t,e),i&&this.setTransformForCurrent()}rotateDegrees(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];const i=t*Math.PI/180;this.rotate(i,e)}rotateAbout(t,e,i){let r=!(arguments.length>3&&void 0!==arguments[3])||arguments[3];this.translate(e,i,!1),this.rotate(t,!1),this.translate(-e,-i,!1),r&&this.setTransformForCurrent()}rotateDegreesAbout(t,e,i){let r=!(arguments.length>3&&void 0!==arguments[3])||arguments[3];this.translate(e,i,!1),this.rotateDegrees(t,!1),this.translate(-e,-i,!1),r&&this.setTransformForCurrent()}beginPath(){this.disableBeginPath||this.nativeContext.beginPath()}clip(t,e){t?"string"==typeof t?this.nativeContext.clip(t):this.nativeContext.clip(t,e):this.nativeContext.clip()}arc(t,e,i,r,n,o,s){if(s=s||0,this.camera){const a=[];((t,e,i,r,n,o,s,a)=>{if(a)for(;i>e;)i-=Zt;else for(;i<e;)i+=Zt;const l=Xt/3*(i>e?1:-1);let h=e,c=h;for(;c!==i;){c=l>0?Math.min(c+l,i):Math.max(c+l,i);const e=Math.abs(c-h),a=4*Math.tan(e/4)/3,d=c<h?-1:1,u=Math.cos(h),g=Math.sin(h),p=Math.cos(c),f=Math.sin(c),m=u*o+r,b=g*s+n,y=p*o+r,C=f*s+n,v=o*a*d,w=s*a*d;t.push([m-v*g,b+w*u,y+v*f,C-w*p,y,C]),h=c}})(a,r,n,t,e,i,i,o);for(let t=0;t<a.length;++t){const e=a[t];this.bezierCurveTo(e[0],e[1],e[2],e[3],e[4],e[5],s)}}else this.nativeContext.arc(t,e,i,r,n,o)}arcTo(t,e,i,r,n){this.nativeContext.arcTo(t,e,i,r,n)}bezierCurveTo(t,e,i,r,n,o,s){if(s=s||0,this.camera){let a=s,l=s;this.modelMatrix&&(Wu(ep,[t,e,s],this.modelMatrix),t=ep[0],e=ep[1],a=ep[2],Wu(ep,[i,r,s],this.modelMatrix),i=ep[0],r=ep[1],l=ep[2],Wu(ep,[n,o,s],this.modelMatrix),n=ep[0],o=ep[1],s=ep[2]);let h=this.camera.vp(n,o,s);n=h.x,o=h.y,h=this.camera.vp(t,e,a),t=h.x,e=h.y,h=this.camera.vp(i,r,l),i=h.x,r=h.y}this.nativeContext.bezierCurveTo(t,e,i,r,n,o)}closePath(){this.nativeContext.closePath()}ellipse(t,e,i,r,n,o,s,a){null==a?this.nativeContext.ellipse(t,e,i,r,n,o,s):this.nativeContext.ellipse(t,e,i,r,n,o,s,a)}lineTo(t,e,i){if(i=i||0,this.camera){this.modelMatrix&&(Wu(ep,[t,e,i],this.modelMatrix),t=ep[0],e=ep[1],i=ep[2]);const r=this.camera.vp(t,e,i);t=r.x,e=r.y}this.nativeContext.lineTo(t,e)}moveTo(t,e,i){if(i=i||0,this.camera){this.modelMatrix&&(Wu(ep,[t,e,i],this.modelMatrix),t=ep[0],e=ep[1],i=ep[2]);const r=this.camera.vp(t,e,i);t=r.x,e=r.y}this.nativeContext.moveTo(t,e)}quadraticCurveTo(t,e,i,r,n){if(n=n||0,this.camera){let o=n;this.modelMatrix&&(Wu(ep,[t,e,n],this.modelMatrix),t=ep[0],e=ep[1],o=ep[2],Wu(ep,[i,r,n],this.modelMatrix),i=ep[0],r=ep[1],n=ep[2]);let s=this.camera.vp(i,r,n);i=s.x,r=s.y,s=this.camera.vp(t,e,o),t=s.x,e=s.y}this.nativeContext.quadraticCurveTo(t,e,i,r)}rect(t,e,i,r,n){n=n||0,this.camera?(this.moveTo(t,e,n),this.lineTo(t+i,e,n),this.lineTo(t+i,e+r,n),this.lineTo(t,e+r,n),this.closePath()):this.nativeContext.rect(t,e,i,r)}createImageData(){const t=arguments;return 2===t.length?this.nativeContext.createImageData(t[0],t[1]):1===t.length?this.nativeContext.createImageData(t[0]):null}createLinearGradient(t,e,i,r){return this.nativeContext.createLinearGradient(t,e,i,r)}createPattern(t,e){return 0===t.width||0===t.height?null:this.nativeContext.createPattern(t,e)}createRadialGradient(t,e,i,r,n,o){return this.nativeContext.createRadialGradient(t,e,i,r,n,o)}createConicGradient(t,e,i,r){let n,o=!1;const s=this;return{stops:[],addColorStop(t,e){this.stops.push([t,e]),o=!0},GetPattern(a,l,h){return o&&(h||(h=r-i),n=function(t,e,i,r,n,o,s,a,l){const h=Math.floor(180*n/Math.PI),c=Hs.GetCanvas(),d=Hs.GetCtx();if(!d)return null;const u=ks.GetSize(a),g=ks.GetSize(l);let p=ks.Get(e,i,r,o,s,u,g);if(p)return p;const f=Math.sqrt(Math.max(Math.max(Math.pow(i,2)+Math.pow(r,2),Math.pow(u-i,2)+Math.pow(r,2)),Math.max(Math.pow(u-i,2)+Math.pow(g-r,2),Math.pow(i,2)+Math.pow(g-r,2)))),m=h+1,b=n/Math.max(1,m-1),y=Ls.getInstance().GetOrCreate(i,r,u,g,e,m),C=2*Math.PI*f/360;c.width=u,c.height=g,d.setTransform(1,0,0,1,0,0),d.clearRect(0,0,u,g),d.translate(i,r),d.rotate(o);for(let t=0,e=m-1;t<e&&!(o+t*b>s);t++){const e=y.getColor(t);d.beginPath(),d.rotate(b),d.moveTo(0,0),d.lineTo(f,-2*C),d.lineTo(f,0),d.fillStyle=e,d.closePath(),d.fill()}const v=d.getImageData(0,0,u,g);return c.width=v.width,c.height=v.height,d.putImageData(v,0,0),p=t.createPattern(c,"no-repeat"),p&&ks.Set(e,i,r,o,s,p,u,g),p}(s,this.stops,t,e,h,i,r,a,l),o=!1),n}}}fill(t,e){this.disableFill||(t?this.nativeContext.fill(t):this.nativeContext.fill())}fillRect(t,e,i,r){this.nativeContext.fillRect(t,e,i,r)}clearRect(t,e,i,r){this.nativeContext.clearRect(t,e,i,r)}project(t,e,i){if(i=i||0,this.camera){this.modelMatrix&&(Wu(ep,[t,e,i],this.modelMatrix),t=ep[0],e=ep[1],i=ep[2]);const r=this.camera.vp(t,e,i);t=r.x,e=r.y}return{x:t,y:e}}view(t,e,i){return i=i||0,this.camera?(this.modelMatrix&&(Wu(ep,[t,e,i],this.modelMatrix),t=ep[0],e=ep[1],i=ep[2]),this.camera.view(t,e,i)):[t,e,i]}fillText(t,e,i,r){if(r=r||0,this.camera){this.modelMatrix&&(Wu(ep,[e,i,r],this.modelMatrix),e=ep[0],i=ep[1],r=ep[2]);const t=this.camera.vp(e,i,r);e=t.x,i=t.y}this.nativeContext.fillText(t,e,i)}getImageData(t,e,i,r){return this.nativeContext.getImageData(t,e,i,r)}getLineDash(){return this.nativeContext.getLineDash()}isPointInPath(t,e){return this.nativeContext.isPointInPath(t,e)}isPointInStroke(t,e){return this.nativeContext.isPointInStroke(t,e)}measureText(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:kr.global.measureTextMethod;var i,r;if(!e||"native"===e)return this.nativeContext.measureText(t);this.mathTextMeasure||(this.mathTextMeasure=kr.graphicUtil.createTextMeasureInstance({},{},(()=>this.canvas.nativeCanvas)));const n=null!==(i=this.fontFamily)&&void 0!==i?i:fr.fontFamily,o=null!==(r=this.fontSize)&&void 0!==r?r:fr.fontSize;return this.mathTextMeasure.textSpec.fontFamily===n&&this.mathTextMeasure.textSpec.fontSize===o||(this.mathTextMeasure.textSpec.fontFamily=n,this.mathTextMeasure.textSpec.fontSize=o,this.mathTextMeasure._numberCharSize=null,this.mathTextMeasure._fullCharSize=null,this.mathTextMeasure._letterCharSize=null,this.mathTextMeasure._specialCharSizeMap={}),this.mathTextMeasure.measure(t,e)}putImageData(t,e,i){this.nativeContext.putImageData(t,e,i)}setLineDash(t){const e=arguments,i=this.nativeContext;this.nativeContext.setLineDash?i.setLineDash(e[0]):"mozDash"in i?i.mozDash=e[0]:"webkitLineDash"in i&&(i.webkitLineDash=e[0])}stroke(t){this.disableStroke||(t?this.nativeContext.stroke(t):this.nativeContext.stroke())}strokeRect(t,e,i,r){this.nativeContext.strokeRect(t,e,i,r)}strokeText(t,e,i,r){if(r=r||0,this.camera){this.modelMatrix&&(Wu(ep,[e,i,r],this.modelMatrix),e=ep[0],i=ep[1],r=ep[2]);const t=this.camera.vp(e,i,r);e=t.x,i=t.y}this.nativeContext.strokeText(t,e,i)}drawImage(){const t=this.nativeContext,e=arguments;3===e.length?t.drawImage(e[0],e[1],e[2]):5===e.length?t.drawImage(e[0],e[1],e[2],e[3],e[4]):9===e.length&&t.drawImage(e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8])}setCommonStyle(t,e,i,r,n){if(Array.isArray(n)){if(n.length<=1)return this._setCommonStyle(t,e,i,r,n[0]);const o=Object.create(n[0]);return n.forEach(((t,e)=>{0!==e&&Object.assign(o,t)})),this._setCommonStyle(t,e,i,r,o)}return this._setCommonStyle(t,e,i,r,n)}_setCommonStyle(t,e,i,r,n){const o=this.nativeContext;n||(n=this.fillAttributes);const{fillOpacity:s=n.fillOpacity,opacity:a=n.opacity,fill:l=n.fill}=e;s>1e-12&&a>1e-12?(o.globalAlpha=s*a,o.fillStyle=fh(this,l,t,i,r)):o.globalAlpha=s*a}setShadowBlendStyle(t,e,i){if(Array.isArray(i)){if(i.length<=1)return this._setShadowBlendStyle(t,i[0]);const r=Object.create(i[0]);return i.forEach(((t,e)=>{0!==e&&Object.assign(r,t)})),this._setShadowBlendStyle(t,e,r)}return this._setShadowBlendStyle(t,e,i)}_setShadowBlendStyle(t,e,i){const r=this.nativeContext;i||(i=this.fillAttributes);const{opacity:n=i.opacity,shadowBlur:o=i.shadowBlur,shadowColor:s=i.shadowColor,shadowOffsetX:a=i.shadowOffsetX,shadowOffsetY:l=i.shadowOffsetY,blur:h=i.blur,globalCompositeOperation:c=i.globalCompositeOperation}=e;n<=1e-12||(o||a||l?(r.shadowBlur=o*this.dpr,r.shadowColor=s,r.shadowOffsetX=a*this.dpr,r.shadowOffsetY=l*this.dpr,this._clearShadowStyle=!0):this._clearShadowStyle&&(r.shadowBlur=0,r.shadowOffsetX=0,r.shadowOffsetY=0),h?(r.filter=`blur(${h}px)`,this._clearFilterStyle=!0):this._clearFilterStyle&&(r.filter="blur(0px)",this._clearFilterStyle=!1),c?(r.globalCompositeOperation=c,this._clearGlobalCompositeOperationStyle=!0):this._clearGlobalCompositeOperationStyle&&(r.globalCompositeOperation="source-over",this._clearGlobalCompositeOperationStyle=!1))}setStrokeStyle(t,e,i,r,n){if(Array.isArray(n)){if(n.length<=1)return this._setStrokeStyle(t,e,i,r,n[0]);const o=Object.create(n[0]);return n.forEach(((t,e)=>{0!==e&&Object.assign(o,t)})),this._setStrokeStyle(t,e,i,r,o)}return this._setStrokeStyle(t,e,i,r,n)}_setStrokeStyle(t,e,i,r,n){const o=this.nativeContext;n||(n=this.strokeAttributes);const{strokeOpacity:s=n.strokeOpacity,opacity:a=n.opacity}=e;if(s>1e-12&&a>1e-12){const{lineWidth:l=n.lineWidth,stroke:h=n.stroke,lineJoin:c=n.lineJoin,lineDash:d=n.lineDash,lineCap:u=n.lineCap,miterLimit:g=n.miterLimit}=e;o.globalAlpha=s*a,o.lineWidth=ph(this,l,this.dpr),o.strokeStyle=fh(this,h,t,i,r),o.lineJoin=c,o.setLineDash(d),o.lineCap=u,o.miterLimit=g}}setTextStyleWithoutAlignBaseline(t,e,i){const r=this.nativeContext;e||(e=this.textAttributes);const{scaleIn3d:n=e.scaleIn3d}=t;t.font?r.font=t.font:r.font=Ys(t,e,n&&this.camera&&this.camera.getProjectionScale(i));const{fontFamily:o=e.fontFamily,fontSize:s=e.fontSize}=t;this.fontFamily=o,this.fontSize=s,r.textAlign="left",r.textBaseline="alphabetic"}setTextStyle(t,e,i){var r,n;const o=this.nativeContext;e||(e=this.textAttributes),t.font?o.font=t.font:o.font=Ys(t,e,this.camera&&this.camera.getProjectionScale(i));const{fontFamily:s=e.fontFamily,fontSize:a=e.fontSize}=t;this.fontFamily=s,this.fontSize=a,o.textAlign=null!==(r=t.textAlign)&&void 0!==r?r:e.textAlign,o.textBaseline=null!==(n=t.textBaseline)&&void 0!==n?n:e.textBaseline}draw(){}clearMatrix(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.dpr;this.setTransformFromMatrix(ip,t,e)}onlyTranslate(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.dpr;return this.matrix.a===t&&0===this.matrix.b&&0===this.matrix.c&&this.matrix.d===t}release(){this.stack.forEach((t=>Ql.free(t))),this.stack.length=0}};rp.env="browser",rp=Qg([f(),tp("design:paramtypes",[Object,Number])],rp);var np=function(t,e,i,r){var n,o=arguments.length,s=o<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,i,r);else for(var a=t.length-1;a>=0;a--)(n=t[a])&&(s=(o<3?n(s):o>3?n(e,i,s):n(e,i))||s);return o>3&&s&&Object.defineProperty(e,i,s),s},op=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let sp=class extends qu{constructor(t){super(t)}init(t){const{container:e}=t;if("string"==typeof e){const t=kr.global.getElementById(e);t&&(this._container=t)}else this._container=e;this._context=new rp(this,this._dpr),this.initStyle()}initStyle(){if(!this.controled)return;const{nativeCanvas:t}=this;t.width=this._pixelWidth,t.height=this._pixelHeight,!t.style||this.setCanvasStyle(t,this._x,this._y,this._displayWidth,this._displayHeight),this._container&&this._container.appendChild(t),this.visiable||this.hide()}hide(){this._nativeCanvas&&(this._nativeCanvas.style.display="none")}show(){this._nativeCanvas&&(this._nativeCanvas.style.display="block")}applyPosition(){const t=this._nativeCanvas;t.style.position="absolute",t.style.top=`${this._y}px`,t.style.left=`${this._x}px`}resetStyle(t){if(!this.controled)return;const{width:e=this._displayWidth,height:i=this._displayHeight,dpr:r=this._dpr,x:n=this._x,y:o=this._y}=t,{nativeCanvas:s}=this;s.width=e*r,s.height=i*r,!s.style||this.setCanvasStyle(s,n,o,e,i),t.id&&(s.id=t.id),this.visiable||this.hide()}setCanvasStyle(t,e,i,r,n){this.controled&&(t.style.width=`${r}px`,t.style.height=`${n}px`)}toDataURL(t,e){return"image/jpeg"===t?this._nativeCanvas.toDataURL(t,e):"image/png"===t?this._nativeCanvas.toDataURL(t):this._nativeCanvas.toDataURL(t,e)}resize(t,e){this.controled&&(this._pixelWidth=t*this._dpr,this._pixelHeight=e*this._dpr,this._displayWidth=t,this._displayHeight=e,this._nativeCanvas.style&&(this._nativeCanvas.style.width=`${t}px`,this._nativeCanvas.style.height=`${e}px`),this._nativeCanvas.width=this._pixelWidth,this._nativeCanvas.height=this._pixelHeight,this._context.dpr=this._dpr)}};function ap(t,e){return new i((i=>{i(qr).toDynamicValue((()=>e=>new t(e))).whenTargetNamed(t.env),i(Zr).toDynamicValue((()=>(t,i)=>new e(t,i))).whenTargetNamed(e.env)}))}sp.env="browser",sp=np([f(),op("design:paramtypes",[Object])],sp);const lp=ap(sp,rp),hp=Symbol.for("MathPickerContribution"),cp=Symbol.for("MathArcPicker"),dp=Symbol.for("MathAreaPicker"),up=Symbol.for("MathCirclePicker"),gp=Symbol.for("MathImagePicker"),pp=Symbol.for("MathLinePicker"),fp=Symbol.for("MathPathPicker"),mp=Symbol.for("MathRectPicker"),bp=Symbol.for("MathSymbolPicker"),yp=Symbol.for("MathTextPicker"),Cp=Symbol.for("MathPolygonPicker"),vp=Symbol.for("MathGlyphPicker"),wp=Symbol.for("CanvasArcPicker"),xp=Symbol.for("CanvasArc3dPicker"),_p=Symbol.for("CanvasAreaPicker"),Sp=Symbol.for("CanvasCirclePicker"),Ap=Symbol.for("CanvasImagePicker"),Bp=Symbol.for("CanvasLinePicker"),Tp=Symbol.for("CanvasPathPicker"),Mp=Symbol.for("CanvasRectPicker"),Rp=Symbol.for("CanvasRect3dPicker"),Pp=Symbol.for("CanvasSymbolPicker"),Ep=Symbol.for("CanvasTextPicker"),Hp=Symbol.for("CanvasPolygonPicker"),Lp=Symbol.for("CanvasPyramid3dPicker"),kp=Symbol.for("CanvasRichTextPicker"),Ip=Symbol.for("CanvasGlyphPicker"),Fp=Symbol.for("CanvasGroupPicker"),zp=Symbol.for("CanvasPickerContribution");var Op=function(t,e,i,r){var n,o=arguments.length,s=o<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,i,r);else for(var a=t.length-1;a>=0;a--)(n=t[a])&&(s=(o<3?n(s):o>3?n(e,i,s):n(e,i))||s);return o>3&&s&&Object.defineProperty(e,i,s),s},Dp=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Wp=function(t,e){return function(i,r){e(i,r,t)}};let Np=class extends og{constructor(t,e,i){super(i),this.contributions=t,this.drawContribution=e,this.pickItemInterceptorContributions=i,this.global.hooks.onSetEnv.tap("canvas-picker-service",((t,e,i)=>{this.configure(i,e)})),this.configure(this.global,this.global.env),this.pickerMap=new Map,this.init()}init(){this.contributions.getContributions().forEach((t=>{this.pickerMap.set(t.numberType,t)})),super._init()}configure(t,e){this.pickCanvas=Qr.shareCanvas(),this.pickContext=this.pickCanvas.getContext("2d")}pickItem(t,e,i,r){if(!1===t.attribute.pickable)return null;if(this.InterceptorContributions.length)for(let n=0;n<this.InterceptorContributions.length;n++){const o=this.InterceptorContributions[n];if(o.beforePickItem){const n=o.beforePickItem(t,this,e,r,{parentMatrix:i});if(n)return n}}const n=this.pickerMap.get(t.numberType);if(!n)return null;const o=n.contains(t,e,r)?t:null,s={graphic:o};if(o)return s;if(this.InterceptorContributions.length)for(let n=0;n<this.InterceptorContributions.length;n++){const o=this.InterceptorContributions[n];if(o.afterPickItem){const n=o.afterPickItem(t,this,e,r,{parentMatrix:i});if(n)return n}}return s}};Np=Op([f(),Wp(0,g(E)),Wp(0,m(zp)),Wp(1,g(ad)),Wp(2,g(E)),Wp(2,m(bd)),Dp("design:paramtypes",[Object,Object,Object])],Np);var Gp=function(t,e,i,r){var n,o=arguments.length,s=o<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,i,r);else for(var a=t.length-1;a>=0;a--)(n=t[a])&&(s=(o<3?n(s):o>3?n(e,i,s):n(e,i))||s);return o>3&&s&&Object.defineProperty(e,i,s),s};let jp=class{constructor(){this.type="group",this.numberType=$o}contains(t,e,i){return!1}};jp=Gp([f()],jp);let Up=!1;var Vp=new i(((t,e,i,r)=>{Up||(Up=!0,t(Fp).to(jp).inSingletonScope(),t(zp).toService(Fp),L(t,zp))}));const Kp=new i(((t,e,i,r)=>{i(Np)||t(Np).toSelf().inSingletonScope(),i(pd)?r(pd).toService(Np):t(pd).toService(Np)}));var $p,Xp=function(t,e,i,r){var n,o=arguments.length,s=o<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,i,r);else for(var a=t.length-1;a>=0;a--)(n=t[a])&&(s=(o<3?n(s):o>3?n(e,i,s):n(e,i))||s);return o>3&&s&&Object.defineProperty(e,i,s),s},Yp=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let qp=$p=class extends eg{get container(){return this.canvas.nativeCanvas.parentElement}static GenerateCanvasId(){return`${$p.idprefix}_${$p.prefix_count++}`}constructor(){super(),this.type="browser",this._canvasIsIntersecting=!0,this.global=kr.global}getTitle(){return this.canvas.id.toString()}getWH(){return{width:this.canvas.width/(this.canvas.dpr||1),height:this.canvas.height/(this.canvas.dpr||1)}}getXY(){return this.canvas.nativeCanvas.getBoundingClientRect()}createWindow(t){t.canvas?this.createWindowByCanvas(t):this.createWindowByConfig(t),this.postInit()}postInit(){if(this.global.optimizeVisible)try{this.observerCanvas()}catch(t){}}isElementVisible(t){const e=t.getBoundingClientRect(),i=window.innerWidth||document.documentElement.clientWidth,r=window.innerHeight||document.documentElement.clientHeight;return!(e.right<0||e.bottom<0||e.left>i||e.top>r)}observerCanvas(){this._canvasIsIntersecting=this.isElementVisible(this.canvas.nativeCanvas);const t=new IntersectionObserver(((t,e)=>{t.forEach((t=>{this._canvasIsIntersecting!==t.isIntersecting?(this._canvasIsIntersecting=t.isIntersecting,this._onVisibleChangeCb&&this._onVisibleChangeCb(t.isIntersecting)):this._canvasIsIntersecting=t.isIntersecting}))}));t&&t.observe(this.canvas.nativeCanvas)}createWindowByConfig(t){const e=this.global.createCanvas({width:t.width,height:t.height});let i;if(i="string"==typeof t.container?this.global.getElementById(t.container):t.container?t.container:this.global.getRootElement(),!i)throw new Error("发生错误,containerId可能传入有误");t.offscreen?i=null:i.appendChild(e);const r={width:t.width,height:t.height,dpr:t.dpr,nativeCanvas:e,container:i,id:$p.GenerateCanvasId(),canvasControled:!0};this.canvas=new sp(r)}createWindowByCanvas(t){var e;let i;if("string"==typeof t.canvas){if(i=this.global.getElementById(t.canvas),!i)throw new Error("canvasId 参数不正确,请确认canvas存在并插入dom")}else i=t.canvas;if(!i)throw new Error("发生错误,传入的canvas不正确");let r=t.width,n=t.height;if(null==r||null==n||!t.canvasControled){const t=i.getBoundingClientRect();r=t.width,n=t.height}let o=t.dpr;null==o&&(o=null!==(e=i.getContext("2d").pixelRatio)&&void 0!==e?e:i.width/r),this.canvas=new sp({width:r,height:n,dpr:o,nativeCanvas:i,canvasControled:t.canvasControled})}releaseWindow(){this.canvas.release()}resizeWindow(t,e){this.canvas.resize(t,e)}setDpr(t){this.canvas.dpr=t}getContext(){return this.canvas.getContext()}getNativeHandler(){return this.canvas}getDpr(){return this.canvas.dpr}addEventListener(t,e,i){return this.canvas.nativeCanvas.addEventListener(t,e,i)}removeEventListener(t,e,i){return this.canvas.nativeCanvas.removeEventListener(t,e,i)}dispatchEvent(t){return this.canvas.nativeCanvas.dispatchEvent(t)}getStyle(){return this.canvas.nativeCanvas.style}setStyle(t){this.canvas.nativeCanvas.style=t}getBoundingClientRect(){const t=this.canvas.nativeCanvas,e=this.getWH();return t.parentElement?this.canvas.nativeCanvas.getBoundingClientRect():{x:0,y:0,width:e.width,height:e.height,left:0,top:0,right:0,bottom:0}}clearViewBox(t,e){const i=this.getContext(),r=this.getDpr();i.nativeContext.save(),i.nativeContext.setTransform(r,0,0,r,0,0),i.clearRect(t.x1,t.y1,t.x2-t.x1,t.y2-t.y1),e&&(i.fillStyle=e,i.fillRect(t.x1,t.y1,t.x2-t.x1,t.y2-t.y1)),i.nativeContext.restore()}isVisible(t){return this._canvasIsIntersecting}onVisibleChange(t){this._onVisibleChangeCb=t}getTopLeft(t){return this.global.getElementTopLeft(this.canvas.nativeCanvas,t)}};qp.env="browser",qp.idprefix="visactor_window",qp.prefix_count=0,qp=$p=Xp([f(),Yp("design:paramtypes",[])],qp);const Zp=new i((t=>{t(qp).toSelf(),t(nn).toDynamicValue((t=>t.container.get(qp))).whenTargetNamed(qp.env)}));var Jp=function(t,e,i,r){var n,o=arguments.length,s=o<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,i,r);else for(var a=t.length-1;a>=0;a--)(n=t[a])&&(s=(o<3?n(s):o>3?n(e,i,s):n(e,i))||s);return o>3&&s&&Object.defineProperty(e,i,s),s},Qp=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};class tf{get x1(){return this.dom.getBoundingClientRect().left}get x2(){return this.dom.getBoundingClientRect().right}get y1(){return this.dom.getBoundingClientRect().top}get y2(){return this.dom.getBoundingClientRect().bottom}get width(){return this.dom.getBoundingClientRect().width}get height(){return this.dom.getBoundingClientRect().height}constructor(t){this.dom=t}}function ef(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];const i=document.createElement("img");if(i.crossOrigin="anonymous",e){const e=new Blob([t],{type:"image/svg+xml"});t=window.URL.createObjectURL(e)}return i.src=t,i.complete?Promise.resolve(i):new Promise(((t,e)=>{i.onload=()=>{t(i)},i.onerror=()=>{e(new Error("加载失败"))}}))}let rf=class extends Ju{constructor(){super(),this.type="browser",this.supportEvent=!0;try{this.supportsTouchEvents="ontouchstart"in globalThis,this.supportsPointerEvents=!!globalThis.PointerEvent,this.supportsMouseEvents=!!globalThis.MouseEvent}catch(t){this.supportsTouchEvents=!1,this.supportsPointerEvents=!1,this.supportsPointerEvents=!1}this.applyStyles=!0}mapToCanvasPoint(t,e){var i;if(e){const{clientX:r,clientY:n}=t,o=e.getBoundingClientRect(),s=null===(i=e.getNativeHandler)||void 0===i?void 0:i.call(e).nativeCanvas;let a,l;return s&&(a=o.width/s.offsetWidth,l=o.height/s.offsetHeight),{x:(r-o.left)/(st(a)?a:1),y:(n-o.top)/(st(l)?l:1)}}return{x:t.offsetX,y:t.offsetY}}getNativeAABBBounds(t){let e=t;if("string"==typeof t&&(e=(new DOMParser).parseFromString(t,"text/html").firstChild),e.getBoundingClientRect){const t=e.getBoundingClientRect();return new tf(t)}return new ge}removeDom(t){return t.parentElement.removeChild(t),!0}createDom(t){const{tagName:e="div",width:i,height:r,style:n,parent:o}=t,s=document.createElement(e);if(n&&(et(n)?s.setAttribute("style",n):Object.keys(n).forEach((t=>{s.setAttribute(t,n[t])}))),null!=i&&(s.style.width=`${i}px`),null!=r&&(s.style.height=`${r}px`),o){const t=et(o)?this.getElementById(o):o;t&&t.appendChild&&t.appendChild(s)}return s}loadImage(t){return ef(t,!1).then((t=>({data:t,loadState:"success"}))).catch((()=>({data:null,loadState:"fail"})))}loadSvg(t){return ef(t,!0).then((t=>({data:t,loadState:"success"}))).catch((()=>({data:null,loadState:"fail"})))}createCanvas(t){var i,r;const n=document.createElement("canvas");t.id&&(n.id=null!==(i=t.id)&&void 0!==i?i:e.GenAutoIncrementId().toString());const o=null!==(r=t.dpr)&&void 0!==r?r:window.devicePixelRatio;return t.width&&t.height&&(n.style.width=`${t.width}px`,n.style.height=`${t.height}px`,n.width=t.width*o,n.height=t.height*o),n}createOffscreenCanvas(t){var e;const i=null!==(e=t.dpr)&&void 0!==e?e:window.devicePixelRatio;return new OffscreenCanvas(t.width*i,t.height*i)}releaseCanvas(t){let e;e="string"==typeof t?document.getElementById(t):t,e&&e.parentElement&&e.parentElement.removeChild(e)}getDevicePixelRatio(){return window.devicePixelRatio}getRequestAnimationFrame(){return window.requestAnimationFrame}getCancelAnimationFrame(){return window.cancelAnimationFrame}addEventListener(t,e,i){return document.addEventListener(t,e,i)}removeEventListener(t,e,i){return document.removeEventListener(t,e,i)}dispatchEvent(t){return document.dispatchEvent(t)}getElementById(t){return document.getElementById(t)}getRootElement(){return document.body}getDocument(){return document}release(){}getElementTop(t,e){let i=t.offsetTop,r=t.offsetParent;for(;null!==r;)i+=r.offsetTop,r=r.offsetParent;return i}getElementLeft(t,e){let i=t.offsetLeft,r=t.offsetParent;for(;null!==r;)i+=r.offsetLeft,r=r.offsetParent;return i}getElementTopLeft(t,e){let i=t.offsetTop,r=t.offsetLeft,n=t.offsetParent;for(;null!==n;)i+=n.offsetTop,r+=n.offsetLeft,n=n.offsetParent;return{top:i,left:r}}};rf=Jp([f(),Qp("design:paramtypes",[])],rf);let nf=!1;const of=new i((t=>{nf||(nf=!0,t(rf).toSelf().inSingletonScope(),t(F).toService(rf))}));let sf=!1;var af=function(t,e,i,r){var n,o=arguments.length,s=o<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,i,r);else for(var a=t.length-1;a>=0;a--)(n=t[a])&&(s=(o<3?n(s):o>3?n(e,i,s):n(e,i))||s);return o>3&&s&&Object.defineProperty(e,i,s),s},lf=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let hf=class extends rp{constructor(t,e){super(t,e);const i=t.nativeCanvas.getContext("2d");if(!i)throw new Error("发生错误,获取2d上下文失败");this.nativeContext=i,this.canvas=t,this.matrix=new me(1,0,0,1,0,0),this.stack=[],this.dpr=null!=e?e:1}release(){}};hf.env="node",hf=af([f(),lf("design:paramtypes",[Object,Number])],hf);var cf=function(t,e,i,r){var n,o=arguments.length,s=o<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,i,r);else for(var a=t.length-1;a>=0;a--)(n=t[a])&&(s=(o<3?n(s):o>3?n(e,i,s):n(e,i))||s);return o>3&&s&&Object.defineProperty(e,i,s),s},df=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let uf=class extends qu{constructor(t){super(t)}init(){this._context=new hf(this,this._dpr),this.nativeCanvas.width=this._pixelWidth,this.nativeCanvas.height=this._pixelHeight}release(){this._nativeCanvas.release&&$(this._nativeCanvas.release)&&this._nativeCanvas.release()}};uf.env="node",uf=cf([f(),df("design:paramtypes",[Object])],uf);const gf=ap(uf,hf);var pf=function(t,e,i,r){var n,o=arguments.length,s=o<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,i,r);else for(var a=t.length-1;a>=0;a--)(n=t[a])&&(s=(o<3?n(s):o>3?n(e,i,s):n(e,i))||s);return o>3&&s&&Object.defineProperty(e,i,s),s},ff=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},mf=function(t,e){return function(i,r){e(i,r,t)}};let bf=class extends eg{get container(){return null}constructor(t){super(),this.global=t,this.type="node"}getTitle(){return""}getWH(){return{width:this.canvas.displayWidth,height:this.canvas.displayHeight}}getXY(){return{x:0,y:0}}createWindow(t){t.canvas?this.createWindowByCanvas(t):this.createWindowByConfig(t)}createWindowByConfig(t){const i=this.global.createCanvas({width:t.width,height:t.height}),r={width:t.width,height:t.height,dpr:t.dpr,nativeCanvas:i,id:e.GenAutoIncrementId().toString(),canvasControled:!0};this.canvas=new uf(r)}createWindowByCanvas(t){const e=t.canvas;let i=t.width,r=t.height;null!=i&&null!=r&&t.canvasControled||(i=e.width,r=e.height),this.canvas=new uf({width:i,height:r,dpr:1,nativeCanvas:e,canvasControled:t.canvasControled})}releaseWindow(){this.canvas.release()}resizeWindow(t,e){this.canvas.resize(t,e)}setDpr(t){this.canvas.dpr=t}getContext(){return this.canvas.getContext()}getNativeHandler(){return this.canvas}getDpr(){return this.canvas.dpr}getImageBuffer(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"image/png";return this.canvas.nativeCanvas.toBuffer(t)}addEventListener(t,e,i){}dispatchEvent(t){return!0}removeEventListener(t,e,i){}getStyle(){}setStyle(t){}getBoundingClientRect(){return null}clearViewBox(t,e){}};bf.env="node",bf=pf([f(),mf(0,g(z)),ff("design:paramtypes",[Object])],bf);const yf=new i((t=>{t(bf).toSelf(),t(nn).toDynamicValue((t=>t.container.get(bf))).whenTargetNamed(bf.env)}));var Cf=function(t,e,i,r){var n,o=arguments.length,s=o<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,i,r);else for(var a=t.length-1;a>=0;a--)(n=t[a])&&(s=(o<3?n(s):o>3?n(e,i,s):n(e,i))||s);return o>3&&s&&Object.defineProperty(e,i,s),s};let vf=class extends Ju{constructor(){super(...arguments),this.type="node",this._lastTime=0,this.supportEvent=!1}configure(t,e){t.env===this.type&&(t.setActiveEnvContribution(this),this.pkg=e)}getDynamicCanvasCount(){return 0}getStaticCanvasCount(){return 999}loadJson(t){const e=fetch(t).then((t=>t.json()));return e.then((t=>({data:t,state:"success"}))).catch((()=>({data:null,state:"fail"}))),e}loadArrayBuffer(t){return fetch(t).then((t=>t.arrayBuffer())).then((t=>({data:t,loadState:"success"}))).catch((()=>({data:null,loadState:"fail"})))}loadImage(t){const{loadImage:e}=this.pkg;return e?e(t).then((t=>({loadState:t?"success":"fail",data:t}))).catch((()=>({loadState:"fail",data:null}))):Promise.reject(new Error("node-canvas loadImage could not be found!"))}loadSvg(t){const e=this.pkg.Resvg;if(!e)return Promise.reject(new Error("@resvg/resvg-js svgParser could not be found!"));const i=new e(t).render().asPng();return this.loadImage(i)}createCanvas(t){return this.pkg.createCanvas(t.width,t.height)}releaseCanvas(t){}getDevicePixelRatio(){return 1}getRequestAnimationFrame(){return function(t){return ro.call(t)}}getCancelAnimationFrame(){return t=>{ro.clear(t)}}addEventListener(t,e,i){}removeEventListener(t,e,i){}getElementById(t){return null}getRootElement(){return null}dispatchEvent(t){}release(){}createOffscreenCanvas(t){}};vf=Cf([f()],vf);let wf=!1;const xf=new i((t=>{wf||(wf=!0,t(vf).toSelf().inSingletonScope(),t(F).toService(vf))}));let _f=!1;var Sf=function(t,e,i,r){var n,o=arguments.length,s=o<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,i,r);else for(var a=t.length-1;a>=0;a--)(n=t[a])&&(s=(o<3?n(s):o>3?n(e,i,s):n(e,i))||s);return o>3&&s&&Object.defineProperty(e,i,s),s},Af=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Bf=function(t,e){return function(i,r){e(i,r,t)}};let Tf=class{constructor(t){this.canvasRenderer=t,this.type="arc",this.numberType=Go}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:r}=null!=i?i:{};if(!r)return!1;const n=Cn(t).arc;r.highPerformanceSave();let{x:o=n.x,y:s=n.y}=t.attribute;if(t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(n);o+=e.x,s+=e.y,r.setTransformForCurrent()}else o=0,s=0,r.transformFromMatrix(t.transMatrix,!0);let a=!1;return this.canvasRenderer.drawShape(t,r,o,s,{},null,((t,i,r)=>!!a||(a=t.isPointInPath(e.x,e.y),a)),((t,i,n)=>{if(a)return!0;const o=i.lineWidth||n.lineWidth,s=i.pickStrokeBuffer||n.pickStrokeBuffer;return r.lineWidth=ph(r,o+s,r.dpr),a=t.isPointInStroke(e.x,e.y),a})),r.highPerformanceRestore(),a}};Tf=Sf([f(),Bf(0,g(Uc)),Af("design:paramtypes",[Object])],Tf);let Mf=!1;const Rf=new i(((t,e,i,r)=>{Mf||(Mf=!0,t(wp).to(Tf).inSingletonScope(),t(zp).toService(wp))}));var Pf=function(t,e,i,r){var n,o=arguments.length,s=o<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,i,r);else for(var a=t.length-1;a>=0;a--)(n=t[a])&&(s=(o<3?n(s):o>3?n(e,i,s):n(e,i))||s);return o>3&&s&&Object.defineProperty(e,i,s),s},Ef=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Hf=function(t,e){return function(i,r){e(i,r,t)}};let Lf=class{constructor(t){this.canvasRenderer=t,this.type="arc",this.numberType=Go}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:r}=null!=i?i:{};if(!r)return!1;const n=Cn(t).arc;r.highPerformanceSave();let{x:o=n.x,y:s=n.y}=t.attribute;if(t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(n);o+=e.x,s+=e.y,r.setTransformForCurrent()}else o=0,s=0,r.transformFromMatrix(t.transMatrix,!0);let a=!1;return this.canvasRenderer.drawShape(t,r,o,s,{},null,((t,i,r)=>!!a||(a=t.isPointInPath(e.x,e.y),a)),((t,i,n)=>{if(a)return!0;const o=i.lineWidth||n.lineWidth,s=i.pickStrokeBuffer||n.pickStrokeBuffer;return r.lineWidth=o+s,a=t.isPointInStroke(e.x,e.y),a})),r.highPerformanceRestore(),a}};Lf=Pf([f(),Hf(0,g(Uc)),Ef("design:paramtypes",[Object])],Lf);let kf=!1;const If=new i(((t,e,i,r)=>{kf||(kf=!0,t(cp).to(Lf).inSingletonScope(),t(hp).toService(cp))}));var Ff=function(t,e,i,r){var n,o=arguments.length,s=o<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,i,r);else for(var a=t.length-1;a>=0;a--)(n=t[a])&&(s=(o<3?n(s):o>3?n(e,i,s):n(e,i))||s);return o>3&&s&&Object.defineProperty(e,i,s),s},zf=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Of=function(t,e){return function(i,r){e(i,r,t)}};const Df=new ge;let Wf=class{constructor(t){this.canvasRenderer=t,this.type="rect",this.numberType=Qo}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:r}=null!=i?i:{};if(!r)return!1;const n=Cn(t).rect,{cornerRadius:o=n.cornerRadius}=t.attribute;let{x:s=n.x,y:a=n.y}=t.attribute;r.highPerformanceSave();let l=!0;if(t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(n);s+=e.x,a+=e.y,r.setTransformForCurrent()}else s=0,a=0,l=!1,r.transformFromMatrix(t.transMatrix,!0);let h=!0;if(!l||t.shadowRoot||ot(o,!0)&&0!==o||it(o)&&o.some((t=>0!==t)))h=!1,this.canvasRenderer.drawShape(t,r,s,a,{},null,((t,i,r)=>!!h||(h=t.isPointInPath(e.x,e.y),h)),((t,i,n)=>{if(h)return!0;const o=i.lineWidth||n.lineWidth,s=i.pickStrokeBuffer||n.pickStrokeBuffer;return r.lineWidth=ph(r,o+s,r.dpr),h=t.isPointInStroke(e.x,e.y),h}));else{const{fill:i=n.fill,stroke:r=n.stroke,lineWidth:o=n.lineWidth}=t.attribute;if(i)h=!0;else if(r){const i=t.AABBBounds;Df.setValue(i.x1,i.y1,i.x2,i.y2),Df.expand(-o/2),h=!Df.containsPoint(e)}}return r.highPerformanceRestore(),h}};Wf=Ff([f(),Of(0,g(Qc)),zf("design:paramtypes",[Object])],Wf);let Nf=!1;const Gf=new i(((t,e,i,r)=>{Nf||(Nf=!0,t(Mp).to(Wf).inSingletonScope(),t(zp).toService(Mp))}));var jf=function(t,e,i,r){var n,o=arguments.length,s=o<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,i,r);else for(var a=t.length-1;a>=0;a--)(n=t[a])&&(s=(o<3?n(s):o>3?n(e,i,s):n(e,i))||s);return o>3&&s&&Object.defineProperty(e,i,s),s},Uf=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Vf=function(t,e){return function(i,r){e(i,r,t)}};const Kf=new ge;let $f=class{constructor(t){this.canvasRenderer=t,this.type="rect",this.numberType=Qo}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:r}=null!=i?i:{};if(!r)return!1;const n=Cn(t).rect,{cornerRadius:o=n.cornerRadius}=t.attribute;let{x:s=n.x,y:a=n.y}=t.attribute;r.highPerformanceSave();let l=!0;if(t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(n);s+=e.x,a+=e.y,r.setTransformForCurrent()}else s=0,a=0,l=!1,r.transformFromMatrix(t.transMatrix,!0);let h=!0;if(!l||ot(o,!0)&&0!==o||it(o)&&o.some((t=>0!==t)))h=!1,this.canvasRenderer.drawShape(t,r,s,a,{},null,((t,i,r)=>!!h||(h=t.isPointInPath(e.x,e.y),h)),((t,i,n)=>{if(h)return!0;const o=i.lineWidth||n.lineWidth,s=i.pickStrokeBuffer||n.pickStrokeBuffer;return r.lineWidth=o+s,h=t.isPointInStroke(e.x,e.y),h}));else if(h){const{fill:i=n.fill,stroke:r=n.stroke,lineWidth:o=n.lineWidth}=t.attribute;if(i)h=!0;else if(r){const i=t.AABBBounds;Kf.setValue(i.x1,i.y1,i.x2,i.y2),Kf.expand(-o/2),h=!Kf.containsPoint(e)}}return r.highPerformanceRestore(),h}};$f=jf([f(),Vf(0,g(Qc)),Uf("design:paramtypes",[Object])],$f);let Xf=!1;const Yf=new i(((t,e,i,r)=>{Xf||(Xf=!0,t(mp).to($f).inSingletonScope(),t(hp).toService(mp))}));var qf=function(t,e,i,r){var n,o=arguments.length,s=o<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,i,r);else for(var a=t.length-1;a>=0;a--)(n=t[a])&&(s=(o<3?n(s):o>3?n(e,i,s):n(e,i))||s);return o>3&&s&&Object.defineProperty(e,i,s),s};let Zf=class extends gh{};Zf=qf([f()],Zf);var Jf=function(t,e,i,r){var n,o=arguments.length,s=o<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,i,r);else for(var a=t.length-1;a>=0;a--)(n=t[a])&&(s=(o<3?n(s):o>3?n(e,i,s):n(e,i))||s);return o>3&&s&&Object.defineProperty(e,i,s),s},Qf=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},tm=function(t,e){return function(i,r){e(i,r,t)}};let em=class extends Zf{constructor(t){super(),this.canvasRenderer=t,this.type="line",this.numberType=Yo}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:r}=null!=i?i:{};if(!r)return!1;r.highPerformanceSave();const n=Cn(t).line,o=this.transform(t,n,r),{x:s,y:a,z:l,lastModelMatrix:h}=o;let c=e;if(r.camera){c=e.clone();const i=t.parent.globalTransMatrix;c.x=i.a*e.x+i.c*e.y+i.e,c.y=i.b*e.x+i.d*e.y+i.f}this.canvasRenderer.z=l;let d=!1;return this.canvasRenderer.drawShape(t,r,s,a,{},null,(t=>!!d||(d=t.isPointInPath(c.x,c.y),d)),((t,e,i)=>{if(d)return!0;const n=e.lineWidth||i.lineWidth,o=e.pickStrokeBuffer||i.pickStrokeBuffer;return r.lineWidth=ph(r,n+o,r.dpr),d=t.isPointInStroke(c.x,c.y),d})),this.canvasRenderer.z=0,r.modelMatrix!==h&&th.free(r.modelMatrix),r.modelMatrix=h,r.highPerformanceRestore(),d}};em=Jf([f(),tm(0,g(qc)),Qf("design:paramtypes",[Object])],em);let im=!1;const rm=new i(((t,e,i,r)=>{im||(im=!0,t(Bp).to(em).inSingletonScope(),t(zp).toService(Bp))}));var nm=function(t,e,i,r){var n,o=arguments.length,s=o<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,i,r);else for(var a=t.length-1;a>=0;a--)(n=t[a])&&(s=(o<3?n(s):o>3?n(e,i,s):n(e,i))||s);return o>3&&s&&Object.defineProperty(e,i,s),s},om=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},sm=function(t,e){return function(i,r){e(i,r,t)}};let am=class{constructor(t){this.canvasRenderer=t,this.type="line",this.numberType=Yo}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:r}=null!=i?i:{};if(!r)return!1;const n=Cn(t).line;let{x:o=n.x,y:s=n.y}=t.attribute;if(r.highPerformanceSave(),t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(n);o+=e.x,s+=e.y,r.setTransformForCurrent()}else o=0,s=0,r.transformFromMatrix(t.transMatrix,!0);let a=!1;return this.canvasRenderer.drawShape(t,r,o,s,{},null,(t=>!!a||(a=t.isPointInPath(e.x,e.y),a)),((t,i,n)=>{if(a)return!0;const o=i.lineWidth||n.lineWidth,s=i.pickStrokeBuffer||n.pickStrokeBuffer;return r.lineWidth=o+s,a=t.isPointInStroke(e.x,e.y),a})),r.highPerformanceRestore(),a}};am=nm([f(),sm(0,g(qc)),om("design:paramtypes",[Object])],am);let lm=!1;const hm=new i(((t,e,i,r)=>{lm||(lm=!0,t(pp).to(am).inSingletonScope(),t(hp).toService(pp))}));var cm=function(t,e,i,r){var n,o=arguments.length,s=o<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,i,r);else for(var a=t.length-1;a>=0;a--)(n=t[a])&&(s=(o<3?n(s):o>3?n(e,i,s):n(e,i))||s);return o>3&&s&&Object.defineProperty(e,i,s),s},dm=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},um=function(t,e){return function(i,r){e(i,r,t)}};let gm=class{constructor(t){this.canvasRenderer=t,this.type="area",this.numberType=Uo}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:r}=null!=i?i:{};if(!r)return!1;const n=Cn(t).area;let{x:o=n.x,y:s=n.y}=t.attribute;const{fillPickable:a=n.fillPickable,strokePickable:l=n.strokePickable}=t.attribute;if(r.highPerformanceSave(),t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(n);o+=e.x,s+=e.y,r.setTransformForCurrent()}else o=0,s=0,r.transformFromMatrix(t.transMatrix,!0);let h=!1;return this.canvasRenderer.drawShape(t,r,o,s,{},null,(t=>!!h||!!a&&(h=t.isPointInPath(e.x,e.y),h)),((t,i,n)=>{if(h)return!0;if(!l)return!1;const o=i.lineWidth||n.lineWidth,s=i.pickStrokeBuffer||n.pickStrokeBuffer;return r.lineWidth=ph(r,o+s,r.dpr),h=t.isPointInStroke(e.x,e.y),h})),r.highPerformanceRestore(),h}};gm=cm([f(),um(0,g(Kc)),dm("design:paramtypes",[Object])],gm);let pm=!1;const fm=new i(((t,e,i,r)=>{pm||(pm=!0,t(_p).to(gm).inSingletonScope(),t(zp).toService(_p))}));var mm=function(t,e,i,r){var n,o=arguments.length,s=o<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,i,r);else for(var a=t.length-1;a>=0;a--)(n=t[a])&&(s=(o<3?n(s):o>3?n(e,i,s):n(e,i))||s);return o>3&&s&&Object.defineProperty(e,i,s),s},bm=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},ym=function(t,e){return function(i,r){e(i,r,t)}};let Cm=class{constructor(t){this.canvasRenderer=t,this.type="area",this.numberType=Uo}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:r}=null!=i?i:{};if(!r)return!1;const n=Cn(t).area;let{x:o=n.x,y:s=n.y}=t.attribute;if(r.highPerformanceSave(),t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(n);o+=e.x,s+=e.y,r.setTransformForCurrent()}else o=0,s=0,r.transformFromMatrix(t.transMatrix,!0);let a=!1;return this.canvasRenderer.drawShape(t,r,o,s,{},null,(t=>!!a||(a=t.isPointInPath(e.x,e.y),a))),r.highPerformanceRestore(),a}};Cm=mm([f(),ym(0,g(Kc)),bm("design:paramtypes",[Object])],Cm);let vm=!1;const wm=new i(((t,e,i,r)=>{vm||(vm=!0,t(dp).to(Cm).inSingletonScope(),t(hp).toService(dp))}));var xm=function(t,e,i,r){var n,o=arguments.length,s=o<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,i,r);else for(var a=t.length-1;a>=0;a--)(n=t[a])&&(s=(o<3?n(s):o>3?n(e,i,s):n(e,i))||s);return o>3&&s&&Object.defineProperty(e,i,s),s},_m=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Sm=function(t,e){return function(i,r){e(i,r,t)}};let Am=class extends Zf{constructor(t){super(),this.canvasRenderer=t,this.type="symbol",this.numberType=is}contains(t,e,i){const{pickContext:r}=null!=i?i:{};if(!r)return!1;const n=t.getParsedPath();if(!r.camera){if(!t.AABBBounds.containsPoint(e))return!1;if(n.isSvg||"imprecise"===t.attribute.pickMode)return!0}r.highPerformanceSave();const o=Cn(t).symbol,s=this.transform(t,o,r),{x:a,y:l,z:h,lastModelMatrix:c}=s;let d=e;if(r.camera){d=e.clone();const i=t.parent.globalTransMatrix;d.x=i.a*e.x+i.c*e.y+i.e,d.y=i.b*e.x+i.d*e.y+i.f}this.canvasRenderer.z=h;let u=!1;return this.canvasRenderer.drawShape(t,r,a,l,{},null,((t,e,i)=>!!u||(u=t.isPointInPath(d.x,d.y),u)),((t,e,i)=>{if(u)return!0;const n=e.lineWidth||i.lineWidth,o=e.pickStrokeBuffer||i.pickStrokeBuffer;return r.lineWidth=ph(r,n+o,r.dpr),u=t.isPointInStroke(d.x,d.y),u})),this.canvasRenderer.z=0,r.modelMatrix!==c&&th.free(r.modelMatrix),r.modelMatrix=c,r.highPerformanceRestore(),u}};Am=xm([f(),Sm(0,g(ed)),_m("design:paramtypes",[Object])],Am);let Bm=!1;const Tm=new i(((t,e,i,r)=>{Bm||(Bm=!0,t(Pp).to(Am).inSingletonScope(),t(zp).toService(Pp))}));var Mm=function(t,e,i,r){var n,o=arguments.length,s=o<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,i,r);else for(var a=t.length-1;a>=0;a--)(n=t[a])&&(s=(o<3?n(s):o>3?n(e,i,s):n(e,i))||s);return o>3&&s&&Object.defineProperty(e,i,s),s},Rm=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Pm=function(t,e){return function(i,r){e(i,r,t)}};let Em=class{constructor(t){this.canvasRenderer=t,this.type="symbol",this.numberType=is}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:r}=null!=i?i:{};if(!r)return!1;const n=Cn(t).symbol;let{x:o=n.x,y:s=n.y}=t.attribute;if(r.highPerformanceSave(),t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(n);o+=e.x,s+=e.y,r.setTransformForCurrent()}else o=0,s=0,r.transformFromMatrix(t.transMatrix,!0);let a=!1;return this.canvasRenderer.drawShape(t,r,o,s,{},null,((t,i,r)=>!!a||(a=t.isPointInPath(e.x,e.y),a)),((t,i,n)=>{if(a)return!0;const o=i.lineWidth||n.lineWidth,s=i.pickStrokeBuffer||n.pickStrokeBuffer;return r.lineWidth=o+s,a=t.isPointInStroke(e.x,e.y),a})),r.highPerformanceRestore(),a}};Em=Mm([f(),Pm(0,g(ed)),Rm("design:paramtypes",[Object])],Em);let Hm=!1;const Lm=new i(((t,e,i,r)=>{Hm||(Hm=!0,t(bp).to(Em).inSingletonScope(),t(hp).toService(bp))}));var km=function(t,e,i,r){var n,o=arguments.length,s=o<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,i,r);else for(var a=t.length-1;a>=0;a--)(n=t[a])&&(s=(o<3?n(s):o>3?n(e,i,s):n(e,i))||s);return o>3&&s&&Object.defineProperty(e,i,s),s},Im=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Fm=function(t,e){return function(i,r){e(i,r,t)}};let zm=class{constructor(t){this.canvasRenderer=t,this.type="circle",this.numberType=Vo}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:r}=null!=i?i:{};if(!r)return!1;const n=Cn(t).circle;let{x:o=n.x,y:s=n.y}=t.attribute;if(r.highPerformanceSave(),t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(n);o+=e.x,s+=e.y,r.setTransformForCurrent()}else o=0,s=0,r.transformFromMatrix(t.transMatrix,!0);let a=!1;return this.canvasRenderer.drawShape(t,r,o,s,{},null,((t,i,r)=>!!a||(a=t.isPointInPath(e.x,e.y),a)),((t,i,n)=>{if(a)return!0;const o=i.lineWidth||n.lineWidth,s=i.pickStrokeBuffer||n.pickStrokeBuffer;return r.lineWidth=ph(r,o+s,r.dpr),a=t.isPointInStroke(e.x,e.y),a})),r.highPerformanceRestore(),a}};zm=km([f(),Fm(0,g($c)),Im("design:paramtypes",[Object])],zm);let Om=!1;const Dm=new i(((t,e,i,r)=>{Om||(Om=!0,t(Sp).to(zm).inSingletonScope(),t(zp).toService(Sp))}));var Wm=function(t,e,i,r){var n,o=arguments.length,s=o<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,i,r);else for(var a=t.length-1;a>=0;a--)(n=t[a])&&(s=(o<3?n(s):o>3?n(e,i,s):n(e,i))||s);return o>3&&s&&Object.defineProperty(e,i,s),s},Nm=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Gm=function(t,e){return function(i,r){e(i,r,t)}};let jm=class{constructor(t){this.canvasRenderer=t,this.type="circle",this.numberType=Vo}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:r}=null!=i?i:{};if(!r)return!1;const n=Cn(t).circle;let{x:o=n.x,y:s=n.y}=t.attribute;if(r.highPerformanceSave(),t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(n);o+=e.x,s+=e.y,r.setTransformForCurrent()}else o=0,s=0,r.transformFromMatrix(t.transMatrix,!0);let a=!1;return this.canvasRenderer.drawShape(t,r,o,s,{},null,((t,i,r)=>!!a||(a=t.isPointInPath(e.x,e.y),a)),((t,i,n)=>{if(a)return!0;const o=i.lineWidth||n.lineWidth,s=i.pickStrokeBuffer||n.pickStrokeBuffer;return r.lineWidth=o+s,a=t.isPointInStroke(e.x,e.y),a})),r.highPerformanceRestore(),a}};jm=Wm([f(),Gm(0,g($c)),Nm("design:paramtypes",[Object])],jm);let Um=!1;const Vm=new i(((t,e,i,r)=>{Um||(Um=!0,t(up).to(jm).inSingletonScope(),t(hp).toService(up))}));var Km=function(t,e,i,r){var n,o=arguments.length,s=o<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,i,r);else for(var a=t.length-1;a>=0;a--)(n=t[a])&&(s=(o<3?n(s):o>3?n(e,i,s):n(e,i))||s);return o>3&&s&&Object.defineProperty(e,i,s),s},$m=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Xm=function(t,e){return function(i,r){e(i,r,t)}};let Ym=class extends Zf{constructor(t){super(),this.canvasRenderer=t,this.type="text",this.numberType=rs}contains(t,e,i){const{pickContext:r}=null!=i?i:{};if(!r)return!1;const n=t.AABBBounds;if(!r.camera)return!!n.containsPoint(e);r.highPerformanceSave();const o=Cn(t).text,{keepDirIn3d:s=o.keepDirIn3d}=t.attribute,a=!s,l=this.transform(t,o,r,a),{x:h,y:c,z:d,lastModelMatrix:u}=l;this.canvasRenderer.z=d;let g=e;if(r.camera){g=e.clone();const i=t.parent.globalTransMatrix;g.x=i.a*e.x+i.c*e.y+i.e,g.y=i.b*e.x+i.d*e.y+i.f}let p=!1;return this.canvasRenderer.drawShape(t,r,h,c,{},null,((e,i,r)=>{if(p)return!0;const{fontSize:n=o.fontSize,textBaseline:s=o.textBaseline,textAlign:a=o.textAlign}=t.attribute,l=t.AABBBounds,u=l.height(),f=l.width(),m=Zs(s,u,n),b=qs(a,f);return e.rect(b+h,m+c,f,u,d),p=e.isPointInPath(g.x,g.y),p}),((t,e,i)=>p)),this.canvasRenderer.z=0,r.modelMatrix!==u&&th.free(r.modelMatrix),r.modelMatrix=u,r.highPerformanceRestore(),p}};Ym=Km([f(),Xm(0,g(id)),$m("design:paramtypes",[Object])],Ym);let qm=!1;const Zm=new i(((t,e,i,r)=>{qm||(qm=!0,t(Ep).to(Ym).inSingletonScope(),t(zp).toService(Ep))}));var Jm=function(t,e,i,r){var n,o=arguments.length,s=o<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,i,r);else for(var a=t.length-1;a>=0;a--)(n=t[a])&&(s=(o<3?n(s):o>3?n(e,i,s):n(e,i))||s);return o>3&&s&&Object.defineProperty(e,i,s),s};let Qm=class{constructor(){this.type="text",this.numberType=rs}contains(t,e,i){return!!t.AABBBounds.containsPoint(e)}};Qm=Jm([f()],Qm);let tb=!1;const eb=new i(((t,e,i,r)=>{tb||(tb=!0,t(yp).to(Qm).inSingletonScope(),t(hp).toService(yp))}));var ib=function(t,e,i,r){var n,o=arguments.length,s=o<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,i,r);else for(var a=t.length-1;a>=0;a--)(n=t[a])&&(s=(o<3?n(s):o>3?n(e,i,s):n(e,i))||s);return o>3&&s&&Object.defineProperty(e,i,s),s},rb=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},nb=function(t,e){return function(i,r){e(i,r,t)}};let ob=class extends Zf{constructor(t){super(),this.canvasRenderer=t,this.type="path",this.numberType=qo}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:r}=null!=i?i:{};if(!r)return!1;const n=Cn(t).path;r.highPerformanceSave();const o=this.transform(t,n,r),{x:s,y:a,z:l,lastModelMatrix:h}=o;let c=e;if(r.camera){c=e.clone();const i=t.parent.globalTransMatrix;c.x=i.a*e.x+i.c*e.y+i.e,c.y=i.b*e.x+i.d*e.y+i.f}this.canvasRenderer.z=l;let d=!1;return this.canvasRenderer.drawShape(t,r,s,a,{},null,((t,e,i)=>!!d||(d=t.isPointInPath(c.x,c.y),d)),((t,e,i)=>{if(d)return!0;const n=e.lineWidth||i.lineWidth,o=e.pickStrokeBuffer||i.pickStrokeBuffer;return r.lineWidth=ph(r,n+o,r.dpr),d=t.isPointInStroke(c.x,c.y),d})),this.canvasRenderer.z=0,r.modelMatrix!==h&&th.free(r.modelMatrix),r.modelMatrix=h,r.highPerformanceRestore(),d}};ob=ib([f(),nb(0,g(Zc)),rb("design:paramtypes",[Object])],ob);let sb=!1;const ab=new i(((t,e,i,r)=>{sb||(sb=!0,t(Tp).to(ob).inSingletonScope(),t(zp).toService(Tp))}));var lb=function(t,e,i,r){var n,o=arguments.length,s=o<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,i,r);else for(var a=t.length-1;a>=0;a--)(n=t[a])&&(s=(o<3?n(s):o>3?n(e,i,s):n(e,i))||s);return o>3&&s&&Object.defineProperty(e,i,s),s},hb=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},cb=function(t,e){return function(i,r){e(i,r,t)}};let db=class{constructor(t){this.canvasRenderer=t,this.type="path",this.numberType=qo}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:r}=null!=i?i:{};if(!r)return!1;const n=Cn(t).path;let{x:o=n.x,y:s=n.y}=t.attribute;if(r.highPerformanceSave(),t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(n);o+=e.x,s+=e.y,r.setTransformForCurrent()}else o=0,s=0,r.transformFromMatrix(t.transMatrix,!0);let a=!1;return this.canvasRenderer.drawShape(t,r,o,s,{},null,((t,i,r)=>!!a||(a=t.isPointInPath(e.x,e.y),a)),((t,i,n)=>{if(a)return!0;const o=i.lineWidth||n.lineWidth,s=i.pickStrokeBuffer||n.pickStrokeBuffer;return r.lineWidth=o+s,a=t.isPointInStroke(e.x,e.y),a})),r.highPerformanceRestore(),a}};db=lb([f(),cb(0,g(Zc)),hb("design:paramtypes",[Object])],db);let ub=!1;const gb=new i(((t,e,i,r)=>{ub||(ub=!0,t(fp).to(db).inSingletonScope(),t(hp).toService(fp))}));var pb=function(t,e,i,r){var n,o=arguments.length,s=o<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,i,r);else for(var a=t.length-1;a>=0;a--)(n=t[a])&&(s=(o<3?n(s):o>3?n(e,i,s):n(e,i))||s);return o>3&&s&&Object.defineProperty(e,i,s),s},fb=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},mb=function(t,e){return function(i,r){e(i,r,t)}};let bb=class{constructor(t){this.canvasRenderer=t,this.type="polygon",this.numberType=Zo}contains(t,e,i){if(!t.AABBBounds.contains(e.x,e.y))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:r}=null!=i?i:{};if(!r)return!1;const n=Cn(t).polygon;let{x:o=n.x,y:s=n.y}=t.attribute;if(r.highPerformanceSave(),t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(n);o+=e.x,s+=e.y,r.setTransformForCurrent()}else o=0,s=0,r.transformFromMatrix(t.transMatrix,!0);let a=!1;return this.canvasRenderer.drawShape(t,r,o,s,{},null,((t,i,r)=>!!a||(a=t.isPointInPath(e.x,e.y),a)),((t,i,n)=>{if(a)return!0;const o=i.lineWidth||n.lineWidth,s=i.pickStrokeBuffer||n.pickStrokeBuffer;return r.lineWidth=ph(r,o+s,r.dpr),a=t.isPointInStroke(e.x,e.y),a})),r.highPerformanceRestore(),a}};bb=pb([f(),mb(0,g(Jc)),fb("design:paramtypes",[Object])],bb);let yb=!1;const Cb=new i(((t,e,i,r)=>{yb||(yb=!0,t(Hp).to(bb).inSingletonScope(),t(zp).toService(Hp))}));var vb=function(t,e,i,r){var n,o=arguments.length,s=o<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,i,r);else for(var a=t.length-1;a>=0;a--)(n=t[a])&&(s=(o<3?n(s):o>3?n(e,i,s):n(e,i))||s);return o>3&&s&&Object.defineProperty(e,i,s),s},wb=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},xb=function(t,e){return function(i,r){e(i,r,t)}};let _b=class{constructor(t){this.canvasRenderer=t,this.type="polygon",this.numberType=Zo}contains(t,e,i){if(!t.AABBBounds.contains(e.x,e.y))return!1;const{pickContext:r}=null!=i?i:{};if(!r)return!1;const n=Cn(t).polygon;let{x:o=n.x,y:s=n.y}=t.attribute;if(r.highPerformanceSave(),t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(n);o+=e.x,s+=e.y,r.setTransformForCurrent()}else o=0,s=0,r.transformFromMatrix(t.transMatrix,!0);let a=!1;return this.canvasRenderer.drawShape(t,r,o,s,{},null,((t,i,r)=>!!a||(a=t.isPointInPath(e.x,e.y),a)),((t,i,n)=>{if(a)return!0;const o=i.lineWidth||n.lineWidth,s=i.pickStrokeBuffer||n.pickStrokeBuffer;return r.lineWidth=o+s,a=t.isPointInStroke(e.x,e.y),a})),r.highPerformanceRestore(),a}};_b=vb([f(),xb(0,g(Jc)),wb("design:paramtypes",[Object])],_b);let Sb=!1;const Ab=new i(((t,e,i,r)=>{Sb||(Sb=!0,t(Cp).to(_b).inSingletonScope(),t(hp).toService(Cp))}));var Bb=function(t,e,i,r){var n,o=arguments.length,s=o<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,i,r);else for(var a=t.length-1;a>=0;a--)(n=t[a])&&(s=(o<3?n(s):o>3?n(e,i,s):n(e,i))||s);return o>3&&s&&Object.defineProperty(e,i,s),s},Tb=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Mb=function(t,e){return function(i,r){e(i,r,t)}};let Rb=class{constructor(t){this.canvasRenderer=t,this.type="glyph",this.numberType=Ko}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:r}=null!=i?i:{};if(!r)return!1;const n=null==i?void 0:i.pickerService;if(n){let r=!1;return t.getSubGraphic().forEach((t=>{if(r)return;const o=n.pickItem(t,e,null,i);r=!(!o||!o.graphic)})),r}return!1}};Rb=Bb([f(),Mb(0,g(od)),Tb("design:paramtypes",[Object])],Rb);let Pb=!1;const Eb=new i(((t,e,i,r)=>{Pb||(Pb=!0,t(Ip).to(Rb).inSingletonScope(),t(zp).toService(Ip))}));var Hb=function(t,e,i,r){var n,o=arguments.length,s=o<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,i,r);else for(var a=t.length-1;a>=0;a--)(n=t[a])&&(s=(o<3?n(s):o>3?n(e,i,s):n(e,i))||s);return o>3&&s&&Object.defineProperty(e,i,s),s},Lb=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},kb=function(t,e){return function(i,r){e(i,r,t)}};let Ib=class{constructor(t){this.canvasRenderer=t,this.type="glyph",this.numberType=Ko}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:r}=null!=i?i:{};if(!r)return!1;const n=null==i?void 0:i.pickerService;if(n){let r=!1;return t.getSubGraphic().forEach((t=>{r||(r=!!n.pickItem(t,e,null,i))})),r}return!1}};Ib=Hb([f(),kb(0,g(od)),Lb("design:paramtypes",[Object])],Ib);let Fb=!1;const zb=new i(((t,e,i,r)=>{Fb||(Fb=!0,t(vp).to(Ib).inSingletonScope(),t(Ib).toService(vp))}));var Ob=function(t,e,i,r){var n,o=arguments.length,s=o<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,i,r);else for(var a=t.length-1;a>=0;a--)(n=t[a])&&(s=(o<3?n(s):o>3?n(e,i,s):n(e,i))||s);return o>3&&s&&Object.defineProperty(e,i,s),s},Db=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Wb=function(t,e){return function(i,r){e(i,r,t)}};let Nb=class{constructor(t){this.canvasRenderer=t,this.type="richtext",this.numberType=es}contains(t,e,i){return!!t.AABBBounds.containsPoint(e)}};Nb=Ob([f(),Wb(0,g(rd)),Db("design:paramtypes",[Object])],Nb);let Gb=!1;const jb=new i(((t,e,i,r)=>{Gb||(Gb=!0,t(kp).to(Nb).inSingletonScope(),t(zp).toService(kp))}));var Ub=function(t,e,i,r){var n,o=arguments.length,s=o<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,i,r);else for(var a=t.length-1;a>=0;a--)(n=t[a])&&(s=(o<3?n(s):o>3?n(e,i,s):n(e,i))||s);return o>3&&s&&Object.defineProperty(e,i,s),s};let Vb=class{constructor(){this.type="image",this.numberType=Xo}contains(t,e,i){const{pickContext:r}=null!=i?i:{};return!!r&&!!t.AABBBounds.containsPoint(e)}};Vb=Ub([f()],Vb);let Kb=!1;const $b=new i(((t,e,i,r)=>{Kb||(Kb=!0,t(gp).to(Vb).inSingletonScope(),t(Vb).toService(gp))}));var Xb=function(t,e,i,r){var n,o=arguments.length,s=o<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,i,r);else for(var a=t.length-1;a>=0;a--)(n=t[a])&&(s=(o<3?n(s):o>3?n(e,i,s):n(e,i))||s);return o>3&&s&&Object.defineProperty(e,i,s),s};let Yb=class{constructor(){this.type="image",this.numberType=Xo}contains(t,e,i){const{pickContext:r}=null!=i?i:{};return!!r&&!!t.AABBBounds.containsPoint(e)}};Yb=Xb([f()],Yb);let qb=!1;const Zb=new i(((t,e,i,r)=>{qb||(qb=!0,t(Ap).to(Yb).inSingletonScope(),t(zp).toService(Ap))}));let Jb=!1;const Qb=new i(((t,e,i,r)=>{Jb||(Jb=!0,t(gp).to(Vb).inSingletonScope(),t(Vb).toService(gp))}));var ty=function(t,e,i,r){var n,o=arguments.length,s=o<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,i,r);else for(var a=t.length-1;a>=0;a--)(n=t[a])&&(s=(o<3?n(s):o>3?n(e,i,s):n(e,i))||s);return o>3&&s&&Object.defineProperty(e,i,s),s},ey=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},iy=function(t,e){return function(i,r){e(i,r,t)}};new ge;let ry=class extends Zf{constructor(t){super(),this.canvasRenderer=t,this.type="rect3d",this.numberType=ts}contains(t,e,i){const{pickContext:r}=null!=i?i:{};if(!r)return!1;const n=Cn(t).rect;r.highPerformanceSave();const o=this.transform(t,n,r),{x:s,y:a,z:l,lastModelMatrix:h}=o;let c=e;if(r.camera){c=e.clone();const i=t.parent.globalTransMatrix;c.x=i.a*e.x+i.c*e.y+i.e,c.y=i.b*e.x+i.d*e.y+i.f}this.canvasRenderer.z=l;let d=!1;return this.canvasRenderer.drawShape(t,r,s,a,i,null,((t,e,i)=>!!d||(d=t.isPointInPath(c.x,c.y),d))),this.canvasRenderer.z=0,r.modelMatrix!==h&&th.free(r.modelMatrix),r.modelMatrix=h,r.highPerformanceRestore(),d}};ry=ty([f(),iy(0,g(td)),ey("design:paramtypes",[Object])],ry);let ny=!1;const oy=new i(((t,e,i,r)=>{ny||(ny=!0,t(Rp).to(ry).inSingletonScope(),t(zp).toService(Rp))}));var sy=function(t,e,i,r){var n,o=arguments.length,s=o<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,i,r);else for(var a=t.length-1;a>=0;a--)(n=t[a])&&(s=(o<3?n(s):o>3?n(e,i,s):n(e,i))||s);return o>3&&s&&Object.defineProperty(e,i,s),s},ay=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},ly=function(t,e){return function(i,r){e(i,r,t)}};let hy=class extends Zf{constructor(t){super(),this.canvasRenderer=t,this.type="arc3d",this.numberType=jo}contains(t,e,i){const{pickContext:r}=null!=i?i:{};if(!r)return!1;const n=Cn(t).arc;r.highPerformanceSave();const o=this.transform(t,n,r),{x:s,y:a,z:l,lastModelMatrix:h}=o;let c=e;if(r.camera){c=e.clone();const i=t.parent.globalTransMatrix;c.x=i.a*e.x+i.c*e.y+i.e,c.y=i.b*e.x+i.d*e.y+i.f}this.canvasRenderer.z=l;let d=!1;return this.canvasRenderer.drawShape(t,r,s,a,i,null,((t,e,i)=>!!d||(d=t.isPointInPath(c.x,c.y),d))),this.canvasRenderer.z=0,r.modelMatrix!==h&&th.free(r.modelMatrix),r.modelMatrix=h,r.highPerformanceRestore(),d}};hy=sy([f(),ly(0,g(Vc)),ay("design:paramtypes",[Object])],hy);let cy=!1;const dy=new i(((t,e,i,r)=>{cy||(cy=!0,t(xp).to(hy).inSingletonScope(),t(zp).toService(xp))}));var uy=function(t,e,i,r){var n,o=arguments.length,s=o<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,i,r);else for(var a=t.length-1;a>=0;a--)(n=t[a])&&(s=(o<3?n(s):o>3?n(e,i,s):n(e,i))||s);return o>3&&s&&Object.defineProperty(e,i,s),s},gy=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},py=function(t,e){return function(i,r){e(i,r,t)}};let fy=class extends Zf{constructor(t){super(),this.canvasRenderer=t,this.type="pyramid3d",this.numberType=Jo}contains(t,e,i){const{pickContext:r}=null!=i?i:{};if(!r)return!1;const n=Cn(t).polygon;r.highPerformanceSave();const o=this.transform(t,n,r),{x:s,y:a,z:l,lastModelMatrix:h}=o;let c=e;if(r.camera){c=e.clone();const i=t.parent.globalTransMatrix;c.x=i.a*e.x+i.c*e.y+i.e,c.y=i.b*e.x+i.d*e.y+i.f}this.canvasRenderer.z=l;let d=!1;return this.canvasRenderer.drawShape(t,r,s,a,{},null,((t,e,i)=>!!d||(d=t.isPointInPath(c.x,c.y),d)),((t,e,i)=>!1)),this.canvasRenderer.z=0,r.modelMatrix!==h&&th.free(r.modelMatrix),r.modelMatrix=h,r.highPerformanceRestore(),d}};fy=uy([f(),py(0,g(nd)),gy("design:paramtypes",[Object])],fy);let my=!1;const by=new i(((t,e,i,r)=>{my||(my=!0,t(Lp).to(fy).inSingletonScope(),t(zp).toService(Lp))})),yy=Uu();let Cy=!1;let vy=!1;let wy=!1;let xy=!1;let _y=!1;let Sy=!1;function Ay(){Sy||(Sy=!0,hh.RegisterGraphicCreator("group",cs))}let By=!1;function Ty(){By||(By=!0,hh.RegisterGraphicCreator("image",Al),Yr.load(kg),Yr.load(yy?Zb:Qb))}let My=!1;function Ry(){My||(My=!0,hh.RegisterGraphicCreator("line",ul),Yr.load(dg),Yr.load(yy?rm:hm))}let Py=!1;function Ey(){Py||(Py=!0,hh.RegisterGraphicCreator("path",kl),Yr.load(wg),Yr.load(yy?ab:gb))}let Hy=!1;function Ly(){Hy||(Hy=!0,hh.RegisterGraphicCreator("polygon",Vl),Yr.load(_g),Yr.load(yy?Cb:Ab))}let ky=!1;let Iy=!1;function Fy(){Iy||(Iy=!0,hh.RegisterGraphicCreator("rect",fl),Yr.load(hg),Yr.load(yy?Gf:Yf))}let zy=!1;let Oy=!1;function Dy(){Oy||(Oy=!0,hh.RegisterGraphicCreator("richtext",El),Yr.load(Hg),Yr.load(yy?jb:$b))}let Wy=!1;let Ny=!1;function Gy(){Ny||(Ny=!0,hh.RegisterGraphicCreator("symbol",hl),Yr.load(fg),Yr.load(yy?Tm:Lm))}let jy=!1;function Uy(){jy||(jy=!0,hh.RegisterGraphicCreator("text",ea),Yr.load(Cg),Yr.load(yy?Zm:eb))}let Vy=!1;function Ky(){Vy||(Vy=!0,hh.RegisterGraphicCreator("wrapText",na))}var $y,Xy,Yy,qy,Zy,Jy,Qy,tC,eC;xu(),Uu()?function(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];sf||(sf=!0,t.load(of),t.load(lp),t.load(Zp),e&&function(t){t.load(Vp),t.load(Kp)}(t))}(Yr):(ju(),!Gu&&function(t){_f||(_f=!0,t.load(xf),t.load(gf),t.load(yf))}(Yr)),Cy||(Cy=!0,hh.RegisterGraphicCreator("arc",Wl),Yr.load(ag),Yr.load(yy?Rf:If)),vy||(vy=!0,hh.RegisterGraphicCreator("arc3d",Gl),Yr.load(Gg),Yr.load(dy)),wy||(wy=!0,hh.RegisterGraphicCreator("area",zl),Yr.load(gg),Yr.load(yy?fm:wm)),xy||(xy=!0,hh.RegisterGraphicCreator("circle",Xs),Yr.load(bg),Yr.load(yy?Dm:Vm)),_y||(_y=!0,hh.RegisterGraphicCreator("glyph",vl),Yr.load(Tg),Yr.load(yy?Eb:zb)),Ay(),Ty(),Ry(),Ey(),Ly(),ky||(ky=!0,hh.RegisterGraphicCreator("pyramid3d",$l),Yr.load(Kg),Yr.load(by)),Fy(),zy||(zy=!0,hh.RegisterGraphicCreator("rect3d",yl),Yr.load(Og),Yr.load(oy)),Dy(),Wy||(Wy=!0,hh.RegisterGraphicCreator("shadowRoot",Yl)),Gy(),Uy(),Ky(),function(t){t.default="default",t.grabing="grabing",t.scrolling="scrolling"}($y||($y={})),function(t){t.single="single",t.column="column",t.row="row",t.cross="cross",t.none="none"}(Xy||(Xy={})),function(t){t.top="top",t.bottom="bottom",t.left="left",t.right="right"}(Yy||(Yy={})),function(t){t.expand="expand",t.collapse="collapse",t.none="none"}(qy||(qy={})),function(t){t.RECORD="RECORD",t.NONE="NONE",t.SUM="SUM",t.MIN="MIN",t.MAX="MAX",t.AVG="AVG",t.COUNT="COUNT"}(Zy||(Zy={})),function(t){t.ASC="ASC",t.DESC="DESC"}(Jy||(Jy={})),function(t){t.inlineFront="inlineFront",t.inlineEnd="inlineEnd",t.left="left",t.right="right",t.absoluteRight="absoluteRight",t.contentLeft="contentLeft",t.contentRight="contentRight",t.absolute="absolute"}(Qy||(Qy={})),function(t){t.frozen="frozen",t.sort="sort",t.dropDown="dropDown",t.dropDownState="dropDownState",t.play="play",t.damagePic="damagePic",t.expand="expand",t.collapse="collapse",t.drillDown="drillDown",t.drillUp="drillUp"}(tC||(tC={})),function(t){t.upwardIconName="sort_upward",t.downwardIconName="sort_downward",t.normalIconName="sort_normal",t.freezeIconName="freeze",t.frozenIconName="frozen",t.frozenCurrentIconName="frozenCurrent",t.dropdownIconName="dropdownIcon",t.expandIconName="expand",t.collapseIconName="collapse"}(eC||(eC={}));var iC=Object.freeze({__proto__:null,get AggregationType(){return Zy},get HierarchyState(){return qy},get HighlightScope(){return Xy},get IconFuncTypeEnum(){return tC},get IconPosition(){return Qy},get InteractionState(){return $y},get InternalIconName(){return eC},get Placement(){return Yy},get SortType(){return Jy}});let rC,nC=1,oC=class{listenersData={listeners:{},listenerData:{}};on(t,e){const i=this.listenersData.listeners[t]||(this.listenersData.listeners[t]=[]);i.push(e);const r=nC++;return this.listenersData.listenerData[r]={type:t,listener:e,remove:()=>{delete this.listenersData.listenerData[r];const n=i.indexOf(e);i.splice(n,1),this.listenersData.listeners[t].length||delete this.listenersData.listeners[t]}},r}off(t,e){if(e){const i=t;this.removeEventListener(i,e)}else{const e=t;if(!this.listenersData)return;this.listenersData.listenerData[e]?.remove()}}addEventListener(t,e,i){this.on(t,e)}removeEventListener(t,e){if(this.listenersData)for(const i in this.listenersData.listenerData){const r=this.listenersData.listenerData[i];r.type===t&&r.listener===e&&this.off(i)}}hasListeners(t){return!!this.listenersData&&!!this.listenersData.listeners[t]}fireListeners(t,e){if(!this.listenersData)return[];const i=this.listenersData.listeners[t];return i?i.map((t=>t.call(this,e))).filter((t=>Y(t))):[]}release(){delete this.listenersData}};const sC={CHANGE_STYLE:"change_style"};let aC,lC,hC,cC=class t extends oC{_color;_fontSize;_fontFamily;_fontWeight;_fontVariant;_fontStyle;_padding;_defaultPadding=[10,16,10,16];_textStick;_textOverflow;_textAlign;_textBaseline;_bgColor;_borderColor;_lineHeight;_underline;_underlineColor;_underlineDash;_lineThrough;_lineThroughColor;_lineThroughDash;_linkColor;_cursor;_borderLineWidth;_borderLineDash;_marked;static get EVENT_TYPE(){return sC}static get DEFAULT(){return rC||(rC=new t)}constructor(t={},e={}){super(),this._textAlign=t?.textAlign??e?.textAlign,this._textBaseline=t?.textBaseline??e?.textBaseline,this._color=t?.color??e?.color,this._fontSize=t.fontSize??e?.fontSize,this._fontFamily=t.fontFamily??e?.fontFamily,this._fontWeight=t.fontWeight??e?.fontWeight,this._fontVariant=t.fontVariant??e?.fontVariant,this._fontStyle=t.fontStyle??e?.fontStyle,this._padding=t?.padding??e?.padding??this._defaultPadding,this._borderColor=t?.borderColor??e?.borderColor,this._textOverflow=t?.textOverflow??e?.textOverflow,this._textStick=t.textStick??e?.textStick??!1,this._bgColor=t?.bgColor??e?.bgColor,this._lineHeight=t?.lineHeight??e?.lineHeight,this._underline=t?.underline??e?.underline,this._underlineColor=t?.underlineColor??e?.underlineColor,this._underlineDash=t?.underlineDash??e?.underlineDash,this._lineThrough=t?.lineThrough??e?.lineThrough,this._lineThroughColor=t?.lineThroughColor??e?.lineThroughColor,this._lineThroughDash=t?.lineThroughDash??e?.lineThroughDash,this._linkColor=t?.linkColor??e?.linkColor,this._cursor=t.cursor??e?.cursor,this._borderLineWidth=t.borderLineWidth??e?.borderLineWidth,this._borderLineDash=t.borderLineDash??e?.borderLineDash,this._marked=t.marked??e?.marked}get color(){return this._color}set color(t){this._color=t}get fontSize(){return this._fontSize}set fontSize(t){this._fontSize=t}get fontFamily(){return this._fontFamily}set fontFamily(t){this._fontFamily=t}get fontWeight(){return this._fontWeight}set fontWeight(t){this._fontWeight=t}get fontVariant(){return this._fontVariant}set fontVariant(t){this._fontVariant=t}get fontStyle(){return this._fontStyle}set fontStyle(t){this._fontStyle=t}get padding(){return this._padding}set padding(t){this._padding=t}get textOverflow(){return this._textOverflow}set textOverflow(t){this._textOverflow=t}get bgColor(){return this._bgColor}set bgColor(t){this._bgColor=t}get borderColor(){return this._borderColor}set borderColor(t){this._borderColor=t}get textStick(){return this._textStick}set textStick(t){this._textStick=t}get textAlign(){return this._textAlign}set textAlign(t){this._textAlign=t}get textBaseline(){return this._textBaseline}set textBaseline(t){this._textBaseline=t}get lineHeight(){return this._lineHeight}set lineHeight(t){this._lineHeight=t}get underline(){return this._underline}set underline(t){this._underline=t}get underlineColor(){return this._underlineColor}set underlineColor(t){this._underlineColor=t}get underlineDash(){return this._underlineDash}set underlineDash(t){this._underlineDash=t}get lineThrough(){return this._lineThrough}set lineThrough(t){this._lineThrough=t}get lineThroughColor(){return this._lineThroughColor}set lineThroughColor(t){this._lineThroughColor=t}get lineThroughDash(){return this._lineThroughDash}set lineThroughDash(t){this._lineThroughDash=t}get linkColor(){return this._linkColor}set linkColor(t){this._linkColor=t}get cursor(){return this._cursor}set cursor(t){this._cursor=t}get borderLineWidth(){return this._borderLineWidth}set borderLineWidth(t){this._borderLineWidth=t}get borderLineDash(){return this._borderLineDash}set borderLineDash(t){this._borderLineDash=t}get marked(){return this._marked}set marked(t){this._marked=t}clone(){return new t(this,null)}},dC=class t extends cC{static get DEFAULT(){return aC||(aC=new t)}constructor(t={},e={}){super(t,e)}clone(){return new t(this,null)}};class uC extends cC{_autoWrapText;_lineClamp;static get DEFAULT(){return lC||(lC=new uC)}constructor(t={},e={}){super(t,e),this._autoWrapText=t?.autoWrapText??e?.autoWrapText,this._lineClamp=t?.lineClamp??e?.lineClamp}clone(){return new uC(this,null)}get lineClamp(){return this._lineClamp}set lineClamp(t){this._lineClamp=t}get autoWrapText(){return this._autoWrapText}set autoWrapText(t){this._autoWrapText=t}}function gC(t,e,i,r=cC,n){return t||e?t instanceof cC?t:"function"==typeof t?gC(t(i),e,i,r,n):(t||(t={}),n&&!Y(t.autoWrapText)&&(t.autoWrapText=!0),new r(t??{},e??{})):r.DEFAULT}const pC={CHANGE_STYLE:"change_style"};class fC extends oC{_color;_fontSize;_fontFamily;_fontWeight;_fontVariant;_fontStyle;_textOverflow;_padding;_defaultPadding=[10,16,10,16];_textStick;_marked;_textAlign;_textBaseline;_bgColor;_borderColor;_lineHeight;_underline;_underlineColor;_underlineDash;_lineThrough;_lineThroughColor;_lineThroughDash;_linkColor;_cursor;_borderLineWidth;_borderLineDash;static get EVENT_TYPE(){return pC}static get DEFAULT(){return hC||(hC=new fC)}constructor(t={},e={}){super(),this._color=t.color??e?.color,this._fontSize=t.fontSize??e?.fontSize,this._fontFamily=t.fontFamily??e?.fontFamily,this._fontWeight=t.fontWeight??e?.fontWeight,this._fontVariant=t.fontVariant??e?.fontVariant,this._fontStyle=t.fontStyle??e?.fontStyle,this._textOverflow=(t.textOverflow??e?.textOverflow)||"ellipsis",this._textStick=t.textStick??e?.textStick??!1,this._marked=t.marked??e?.marked??!1,this._textAlign=(t.textAlign??e?.textAlign)||"left",this._textBaseline=(t.textBaseline??e?.textBaseline)||"middle",this._bgColor=t.bgColor??e?.bgColor,this._padding=t.padding??e?.padding??this._defaultPadding,this._borderColor=t.borderColor??e?.borderColor,this._lineHeight=t.lineHeight??e?.lineHeight,this._underline=t.underline??e?.underline,this._underlineColor=t.underlineColor??e?.underlineColor,this._underlineDash=t.underlineDash??e?.underlineDash,this._lineThrough=t.lineThrough??e?.lineThrough,this._lineThroughColor=t.lineThroughColor??e?.lineThroughColor,this._lineThroughDash=t.lineThroughDash??e?.lineThroughDash,this._linkColor=t.linkColor??e?.linkColor,this._cursor=t.cursor??e?.cursor,this._borderLineWidth=t.borderLineWidth??e?.borderLineWidth,this._borderLineDash=t.borderLineDash??e?.borderLineDash}get bgColor(){return this._bgColor}set bgColor(t){this._bgColor=t}get color(){return this._color}set color(t){this._color=t}get fontSize(){return this._fontSize}set fontSize(t){this._fontSize=t}get fontFamily(){return this._fontFamily}set fontFamily(t){this._fontFamily=t}get fontWeight(){return this._fontWeight}set fontWeight(t){this._fontWeight=t}get fontVariant(){return this._fontVariant}set fontVariant(t){this._fontVariant=t}get fontStyle(){return this._fontStyle}set fontStyle(t){this._fontStyle=t}get textOverflow(){return this._textOverflow}set textOverflow(t){this._textOverflow=t}get padding(){return this._padding??this._defaultPadding}set padding(t){this._padding=t}get borderColor(){return this._borderColor}set borderColor(t){this._borderColor=t}get textStick(){return this._textStick}set textStick(t){this._textStick=t}get marked(){return this._marked}set marked(t){this._marked=t}get textAlign(){return this._textAlign}set textAlign(t){this._textAlign=t}get textBaseline(){return this._textBaseline}set textBaseline(t){this._textBaseline=t}get lineHeight(){return this._lineHeight}set lineHeight(t){this._lineHeight=t}get underline(){return this._underline}set underline(t){this._underline=t}get underlineColor(){return this._underlineColor}set underlineColor(t){this._underlineColor=t}get underlineDash(){return this._underlineDash}set underlineDash(t){this._underlineDash=t}get lineThrough(){return this._lineThrough}set lineThrough(t){this._lineThrough=t}get lineThroughColor(){return this._lineThroughColor}set lineThroughColor(t){this._lineThroughColor=t}get lineThroughDash(){return this._lineThroughDash}set lineThroughDash(t){this._lineThroughDash=t}get linkColor(){return this._linkColor}set linkColor(t){this._linkColor=t}get cursor(){return this._cursor}set cursor(t){this._cursor=t}get borderLineWidth(){return this._borderLineWidth}set borderLineWidth(t){this._borderLineWidth=t}get borderLineDash(){return this._borderLineDash}set borderLineDash(t){this._borderLineDash=t}clone(){return new fC(this)}}let mC;class bC extends fC{_autoWrapText;_lineClamp;static get DEFAULT(){return mC||(mC=new bC)}constructor(t={},e=null){super(t,e),this._autoWrapText=t?.autoWrapText??e?.autoWrapText,this._lineClamp=t?.lineClamp??e?.lineClamp}clone(){return new bC(this,null)}get lineClamp(){return this._lineClamp}set lineClamp(t){this._lineClamp=t}get autoWrapText(){return this._autoWrapText}set autoWrapText(t){this._autoWrapText=t}}function yC(t,e,i,r,n){return t||e?t instanceof fC?t:"function"==typeof t?yC(t(i),e,i,r,n):(t||(t={}),n&&!Y(t.autoWrapText)&&(t.autoWrapText=!0),new r(t??{},e??{})):r.DEFAULT}class CC{static _mode;static get mode(){return CC._mode||(CC._mode=function(){let t="browser";try{"node"===window.type?t="node":"undefined"==typeof window||window.performance?"undefined"==typeof window&&(t="node"):t="miniApp"}catch(e){t="node"}return t}()),CC._mode}static set mode(t){CC._mode=t}static dpr=0;static CreateCanvas;static LoadImage;static RequestAnimationFrame;static CancelAnimationFrame;static RegisterCreateCanvas(t){CC.CreateCanvas=t}static RegisterLoadImage(t){CC.LoadImage=t}static GetCreateCanvasFunc(){return CC.CreateCanvas?CC.CreateCanvas:"worker"===CC.mode?(t=200,e=200)=>new OffscreenCanvas(t,e):void 0}static RegisterRequestAnimationFrame(t){CC.RequestAnimationFrame=t()}static GetRequestAnimationFrame(){if(CC.RequestAnimationFrame)return CC.RequestAnimationFrame}static RegisterCancelAnimationFrame(t){CC.CancelAnimationFrame=t()}static GetCancelAnimationFrame(){if(CC.CancelAnimationFrame)return CC.CancelAnimationFrame}}function vC(t){return t?.hoverOn||"none"===t?.visible?0:t?.width??7}const wC=(t,e)=>(t=>{switch(Object.prototype.toString.call(t)){case"[object Object]":return"object";case"[object Function]":return"function";case"[object Array]":return"array";case"[object String]":return"string";case"[object Number]":return"number";case"[object RegExp]":return"regExp";case"[object Boolean]":return"boolean";case"[object Symbol]":return"symbol";case"[object Date]":return"date";case"[object Undefined]":return"undefined";case"[object Null]":return"null";case"[object Error]":return"error";case"[object HTMLDocument]":return"document";case"[object global]":return"global";default:return null}})(t)===e,xC=t=>wC(t,"object"),_C=t=>wC(t,"string"),SC=t=>wC(t,"number"),AC=t=>wC(t,"boolean");function BC(t,...e){if(!e.length)return t||{};const i=e.shift();if(xC(t)&&xC(i))for(const e in i)xC(i[e])?(t[e]||Object.assign(t,{[e]:{}}),xC(t[e])||Object.assign(t,{[e]:i[e]}),BC(t[e],i[e])):null!==i[e]&&void 0!==i[e]&&Object.assign(t,{[e]:i[e]});return BC(t,...e)}function TC(t){return"function"==typeof t&&(t=t()),Y(t)?`${t}`:""}function MC(t){if(t?.length<=0)return t;const e=t.length,i=t[0].length,r=new Array(i);for(let n=0;n<e;n++)for(let o=0;o<i;o++)r[o]||(r[o]=new Array(e)),r[o][n]=t[n][o];return r}function RC(t,e){let i=null;return function(...r){i||(t.apply(this,r),i=setTimeout((()=>{i=null}),e))}}function PC(t,e){for(t=`${t}`;t.length<e;)t="0"+t;return t}function EC(t,e,i){t=(t=t.replace(/^\s*|\s*$/,"")).replace(/^#?([a-f0-9])([a-f0-9])([a-f0-9])$/i,"#$1$1$2$2$3$3");const r=Math.round(256*e)*(i?-1:1),n=t.match(new RegExp("^rgba?\\(\\s*(\\d|[1-9]\\d|1\\d{2}|2[0-4][0-9]|25[0-5])\\s*,\\s*(\\d|[1-9]\\d|1\\d{2}|2[0-4][0-9]|25[0-5])\\s*,\\s*(\\d|[1-9]\\d|1\\d{2}|2[0-4][0-9]|25[0-5])(?:\\s*,\\s*(0|1|0?\\.\\d+))?\\s*\\)$","i")),o=n&&Y(n[4])?n[4]:null,s=n?[n[1],n[2],n[3]]:t.replace(/^#?([a-f0-9][a-f0-9])([a-f0-9][a-f0-9])([a-f0-9][a-f0-9])/i,(function(){return`${parseInt(arguments[1],16)},${parseInt(arguments[2],16)},${parseInt(arguments[3],16)}`})).split(/,/);return n?`rgb${null!==o?"a":""}(${Math[i?"max":"min"](parseInt(s[0],10)+r,i?0:255)}, ${Math[i?"max":"min"](parseInt(s[1],10)+r,i?0:255)}, ${Math[i?"max":"min"](parseInt(s[2],10)+r,i?0:255)}${null!==o?`, ${o}`:""})`:["#",PC(Math[i?"max":"min"](parseInt(s[0],10)+r,i?0:255).toString(16),2),PC(Math[i?"max":"min"](parseInt(s[1],10)+r,i?0:255).toString(16),2),PC(Math[i?"max":"min"](parseInt(s[2],10)+r,i?0:255).toString(16),2)].join("")}function HC(t){return _C(t)||SC(t)||AC(t)?t.toString():""}function LC(){return navigator.userAgent.match(/(phone|pad|pod|iPhone|iPod|ios|iPad|Android|Mobile|BlackBerry|IEMobile|MQQBrowser|JUC|Fennec|wOSBrowser|BrowserNG|WebOS|Symbian|Windows Phone)/i)}function kC(t,e,i){return"desc"!==i?t===e?0:t>e?1:-1:t===e?0:t<e?1:-1}function IC(t){return/^-?\d+(\.\d+)?$/.test(t)}const FC="undefined"==typeof window||void 0===window.window;let zC,OC;const DC={get find(){return zC||(zC=Array.prototype.find?(t,e)=>Array.prototype.find.call(t,e):(t,e)=>{const i=DC.findIndex(t,e);return i>=0?t[i]:void 0},zC)},get findIndex(){return OC||(OC=Array.prototype.findIndex?(t,e)=>Array.prototype.findIndex.call(t,e):(t,e)=>{const{length:i}=t;for(let r=0;r<i;r++){if(e(t[r],r,t))return r}return-1},OC)}};const{IE:WC,Chrome:NC,Firefox:GC,Edge:jC,Safari:UC}=function(){if(FC)return{IE:!1,Edge:!1,Chrome:!1,Firefox:!1,Safari:!1};const t=window.navigator.userAgent.toLowerCase();return{IE:!!/(msie|trident)/.exec(t),Edge:t.indexOf("edge")>-1,Chrome:t.indexOf("chrome")>-1&&-1===t.indexOf("edge"),Firefox:t.indexOf("firefox")>-1,Safari:t.indexOf("safari")>-1&&-1===t.indexOf("edge")}}();function VC(...t){const e={};return t.forEach((t=>{for(const i in t)Object.defineProperty(e,i,{get:()=>t[i],set(e){t[i]=e},configurable:!0,enumerable:!0})})),e}function KC(t,e,...i){let r=t;for(let t=0;t<i.length&&null!=r;t++)r=e(r,i[t]);return r}function $C(t,...e){return KC(t,((t,e)=>t[e]),...e)}function XC(t,...e){return"function"==typeof t?t(...e):t}function YC(t){return Boolean(t&&"function"==typeof t.then)}function qC(t,e,i){return t.start.col<=e&&e<=t.end.col&&t.start.row<=i&&i<=t.end.row||t.end.col<=e&&e<=t.start.col&&t.end.row<=i&&i<=t.start.row}function ZC(t){return{start:{col:Math.min(t.start.col,t.end.col),row:Math.min(t.start.row,t.end.row)},end:{col:Math.max(t.start.col,t.end.col),row:Math.max(t.start.row,t.end.row)}}}function JC(t,e){const i=ZC(t),r=ZC(e);if(Math.max(i.start.col,r.start.col)<=Math.min(i.end.col,r.end.col)){if(Math.max(i.start.row,r.start.row)<=Math.min(i.end.row,r.end.row))return!0}return!1}const QC=WC,tv={isObject:function(t){return t===Object(t)}},ev={endsWith:function(t,e,i){const r=HC(t);("number"!=typeof i||!isFinite(i)||Math.floor(i)!==i||i>r.length)&&(i=r.length),i-=e.length;const n=r.lastIndexOf(e,i);return-1!==n&&n===i}},iv={isTouchEvent:function(t){return!!t.changedTouches}},rv={toBoxArray:function(t){return Array.isArray(t)?3===t.length?[t[0],t[1],t[2],t[1]]:2===t.length?[t[0],t[1],t[0],t[1]]:1===t.length?[t[0],t[0],t[0],t[0]]:[t[0],t[1],t[2],t[3]]:[t,t,t,t]}},nv=Function.prototype,ov={CLICK_CELL:"click_cell",DBLCLICK_CELL:"dblclick_cell",MOUSEDOWN_CELL:"mousedown_cell",MOUSEUP_CELL:"mouseup_cell",SELECTED_CELL:"selected_cell",KEYDOWN:"keydown",MOUSEENTER_TABLE:"mouseenter_table",MOUSELEAVE_TABLE:"mouseleave_table",MOUSEMOVE_CELL:"mousemove_cell",MOUSEENTER_CELL:"mouseenter_cell",MOUSELEAVE_CELL:"mouseleave_cell",CONTEXTMENU_CELL:"contextmenu_cell",RESIZE_COLUMN:"resize_column",RESIZE_COLUMN_END:"resize_column_end",CHANGE_HEADER_POSITION:"change_header_position",SORT_CLICK:"sort_click",FREEZE_CLICK:"freeze_click",SCROLL:"scroll",DROPDOWN_MENU_CLICK:"dropdown_menu_click",MOUSEOVER_CHART_SYMBOL:"mouseover_chart_symbol",DRAG_SELECT_END:"drag_select_end",COPY_DATA:"copy_data",DROPDOWN_ICON_CLICK:"dropdown_icon_click",DROPDOWN_MENU_CLEAR:"dropdown_menu_clear",TREE_HIERARCHY_STATE_CHANGE:"tree_hierarchy_state_change",SHOW_MENU:"show_menu",HIDE_MENU:"hide_menu",ICON_CLICK:"icon_click",LEGEND_ITEM_CLICK:"legend_item_click",LEGEND_ITEM_HOVER:"legend_item_hover",LEGEND_ITEM_UNHOVER:"legend_item_unHover",LEGEND_CHANGE:"legend_change",MOUSEENTER_AXIS:"mouseenter_axis",MOUSELEAVE_AXIS:"mouseleave_axis",CHECKBOX_STATE_CHANGE:"checkbox_state_change",AFTER_RENDER:"after_render",INITIALIZED:"initialized",CHANGE_CELL_VALUE:"change_cell_value"},sv=(t,e)=>(t=>{switch(Object.prototype.toString.call(t)){case"[object Object]":return"object";case"[object Function]":return"function";case"[object Array]":return"array";case"[object String]":return"string";case"[object Number]":return"number";case"[object RegExp]":return"regExp";case"[object Boolean]":return"boolean";case"[object Symbol]":return"symbol";case"[object Date]":return"date";case"[object Undefined]":return"undefined";case"[object Null]":return"null";case"[object Error]":return"error";case"[object HTMLDocument]":return"document";case"[object global]":return"global";default:return null}})(t)===e;function av(t,e,i){let r,n,o,s,a,l,h=0,c=!1,d=!1,u=!0;const g=!e&&0!==e&&"function"==typeof requestAnimationFrame;if("function"!=typeof t)throw new TypeError("Expected a function");function p(e){const i=r,o=n;return n=void 0,r=void 0,h=e,s=t.apply(o,i),s}function f(t,e){return g?requestAnimationFrame(t):setTimeout(t,e)}function m(t){const i=t-l;return void 0===l||i>=e||i<0||c&&t-h>=o}function b(){const t=Date.now();if(m(t))return function(t){return a=void 0,u&&r?p(t):(n=void 0,r=void 0,s)}(t);a=f(b,function(t){const i=t-h,r=e&&-(t-l);return c?Math.min(r,o-i):r}(t))}return e=+e||0,sv(i,"object")&&(d=!!i.leading,c="maxWait"in i,c&&(o=Math.max(+i.maxWait||0,e)),u="trailing"in i?!!i.trailing:u),function(...t){const i=Date.now(),o=m(i);if(r=t,n=this,l=i,o){if(void 0===a)return function(t){return h=t,a=f(b,e),d?p(t):s}(l);if(c)return a=f(b,e),p(l)}return void 0===a&&(a=f(b,e)),s}}let lv=1;class hv{resizeTime=100;element;cb;observer;lastSize={width:0,height:0};callBackDebounce;constructor(t,e,i){if(this.element=t,this.cb=e,this.lastSize=this.getSize(),i&&(this.resizeTime=Math.max(i,16)),this.callBackDebounce=av(this.callBack,this.resizeTime),window?.addEventListener("resize",this.onResize),"ResizeObserver"in window){const t=window.ResizeObserver;this.observer=new t(this.mutationResize),this.observer?.observe(this.element)}else"MutationObserver"in window&&(this.observer=new MutationObserver(this.mutationResize),this.observer.observe(this.element,{attributes:!0,attributeFilter:["style"]}))}mutationResize=()=>{this.onResize()};disConnect(){window.removeEventListener("resize",this.onResize),this.observer&&(this.observer.disconnect(),this.observer=void 0)}callBack=()=>{const t=this.getSize();t.width===this.lastSize.width&&t.height===this.lastSize.height||(this.lastSize=t,this.cb&&this.cb({...this.lastSize}))};setSize(t){this.lastSize=t}onResize=()=>{this.checkSize()&&this.callBackDebounce()};checkSize(){const t=this.getSize();return t.width!==this.lastSize.width||t.height!==this.lastSize.height}getSize(){return this.element?{width:Math.floor(this.element.clientWidth),height:Math.floor(this.element.clientHeight)}:{...this.lastSize}}}class cv{resizeTime;listeners={};reseizeListeners={};on(t,e,i,...r){if("node"===CC.mode)return-1;const n=lv++;if(t?.addEventListener)if("resize"!==e||t===window)t?.addEventListener(e,i,...r);else{const e=new hv(t,i,this.resizeTime);this.reseizeListeners[n]=e}const o={target:t,type:e,listener:i,options:r};return this.listeners[n]=o,n}once(t,e,i,...r){if("node"===CC.mode)return-1;const n=this.on(t,e,((...t)=>{this.off(n),i(...t)}),...r);return n}off(t){if("node"===CC.mode)return;if(null==t)return;const e=this.listeners?.[t];e&&(delete this.listeners[t],e.target.removeEventListener&&e.target.removeEventListener(e.type,e.listener,...e.options))}fire(t,e,...i){if("node"!==CC.mode)for(const r in this.listeners){const n=this.listeners[r];n.target===t&&n.type===e&&n.listener.call(n.target,...i)}}hasListener(t,e){if("node"===CC.mode)return!1;let i=!1;for(const r in this.listeners){const n=this.listeners[r];n.target===t&&n.type===e&&(i=!0)}return i}clear(){if("node"!==CC.mode){for(const t in this.listeners){const e=this.listeners[t];e.target.removeEventListener&&e.target.removeEventListener(e.type,e.listener,...e.options)}for(const t in this.reseizeListeners){const e=this.reseizeListeners[t];e?.disConnect()}this.listeners={}}}release(){"node"!==CC.mode&&(this.clear(),this.listeners={})}}const dv=(t,e)=>{let i=0,r=t.length-1;for(;i<=r;){const n=Math.floor((i+r)/2);if(t[n]===e)return n;t[n]>e?r=n-1:i=n+1}return r<0?0:r};class uv{_keys=[];_vals={};_sorted=!1;count(){return this._keys.length}values(){return this._vals}valueArr(){return Object.values(this._vals)}adjustOrder(t,e,i){const{_keys:r}=this;if(this._sorted||(r.sort(((t,e)=>t<e?-1:t>e?1:0)),this._sorted=!0),t>e){const n=[];for(let o=dv(r,t+i-1);o>=0;o--){const s=r[o];if(s>=t)n.push(this.get(s));else if(e<=s&&s<t)this.put(s+i,this.get(s));else if(s<e)break}for(let t=0;t<i;t++)this.put(e+t,n[i-1-t])}const{length:n}=r;if(t<e){const o=[];for(let s=dv(r,t);s<n;s++){const n=r[s];if(n>=t&&n<t+i)o.push(this.get(n));else if(t+i<=n&&n<=e)this.put(n-i,this.get(n));else if(n>e)break}for(let t=0;t<i;t++)this.put(e+t,o[t])}}del(t){delete this._vals[t];const e=this._keys.indexOf(t);-1!==e&&this._keys.splice(e,1)}put(t,e){t in this._vals||(this._keys.push(t),this._sorted=!1),this._vals[t]=e}get(t){return this._vals[t]}has(t){return Y(this._vals[t])}contain(t){return Object.values(this._vals).indexOf(t)>=0}each(t,e,i){const{_keys:r}=this,{length:n}=r;this._sorted||(r.sort(((t,e)=>t<e?-1:t>e?1:0)),this._sorted=!0);for(let o=dv(r,t);o<n;o++){const n=r[o];if(t<=n&&n<=e){if(!1===i(this.get(n),n))break}else if(e<n)return}}clear(){this._keys.length=0,this._vals={},this._sorted=!1}getLastIndex(){return this._keys[this._keys.length-1]}delLast(){const t=this.getLastIndex();this.del(t)}delAndReorder(t){if(!this.has(t))return;const e=this.getLastIndex();this.adjustOrder(t+1,t,e-t),this.delLast()}addAndReorder(t,e){const i=this.getLastIndex();this.adjustOrder(t,t+1,i-t),Y(e)&&this.put(t,e)}}let gv=class t{bounds;constructor(t,e,i,r){this.bounds=new ue,this.bounds.set(t,e,t+i,e+r)}static bounds(e,i,r,n){return new t(e,i,Math.round(r-e),Math.round(n-i))}get left(){return this.bounds.x1}set left(t){this.bounds.x1=t}get top(){return this.bounds.y1}set top(t){this.bounds.y1=t}get right(){return this.bounds.x2}set right(t){this.bounds.x2=t}get bottom(){return this.bounds.y2}set bottom(t){this.bounds.y2=t}get width(){return this.bounds.width()}set width(t){this.bounds.x2=this.bounds.x1+t}get height(){return this.bounds.height()}set height(t){this.bounds.y2=this.bounds.y1+t}offsetLeft(t){this.bounds.translate(t,0)}offsetTop(t){this.bounds.translate(0,t)}copy(){return new t(this.left,this.top,this.width,this.height)}contains(t){return this.bounds.encloses(t.bounds)}inPoint(t,e){return this.bounds.contains(t,e)}};var pv={underlayBackgroundColor:"transparent",defaultStyle:{color:"#D3D5DA",bgColor:"#373b45",fontSize:12,fontFamily:"PingFang SC",fontWeight:500,lineHeight:12,borderColor:"#444A54",padding:[8,12,8,12],hover:{cellBgColor:"#2F4774"}},headerStyle:{color:"#D3D5DA",bgColor:"#373b45",fontSize:12,fontFamily:"PingFang SC",fontWeight:500,lineHeight:12,borderColor:"#444A54",padding:[8,12,8,12],hover:{cellBgColor:"#2F4774"}},rowHeaderStyle:{},cornerHeaderStyle:{},bodyStyle:{color:"#e5e7ea",bgColor:function(t){const{row:e,table:i}=t;return 1&e-i.frozenRowCount?"#282a2e":"#2d3137"},fontSize:12,fontFamily:"PingFang SC",fontWeight:500,lineHeight:12,borderColor:"#444A54",padding:[8,12,8,12],hover:{cellBgColor:"#29364D"}},frameStyle:{borderColor:"#d1d5da",borderLineWidth:1,borderLineDash:[],cornerRadius:10,shadowBlur:6,shadowOffsetX:0,shadowOffsetY:0,shadowColor:"rgba(00, 24, 47, 0.06)"},columnResize:{lineWidth:1,lineColor:"#416EFF",bgColor:"#D9E2FF",width:3},frozenColumnLine:{shadow:{width:4,startColor:"rgba(00, 24, 47, 0.05)",endColor:"rgba(00, 24, 47, 0)"}},selectionStyle:{cellBgColor:"rgba(255, 255, 255, 0.1)",cellBorderColor:"#4284FF",cellBorderLineWidth:2},tooltipStyle:{bgColor:"#FFF",color:"#000",fontSize:12,fontFamily:"Arial,sans-serif"}};var fv={underlayBackgroundColor:"#FFF",defaultStyle:{color:"#FFF",bgColor:"#5389FF",borderColor:"#5286FA",hover:{cellBgColor:"#2E67E3"}},headerStyle:{color:"#FFF",bgColor:"#5389FF",borderColor:"#A1C1FF",hover:{cellBgColor:"#2E67E3"}},bodyStyle:{color:"#000",bgColor:function(t){const{row:e,table:i}=t;return 1&e-i.frozenRowCount?"#FFF":"#F4F8FF"},borderColor:"#E0EAFE",hover:{cellBgColor:"#E9EFFD"}},frameStyle:{borderColor:"#E1E4E8",borderLineWidth:1,borderLineDash:[],cornerRadius:0,shadowBlur:0,shadowOffsetX:0,shadowOffsetY:0,shadowColor:"black"},columnResize:{lineWidth:1,lineColor:"#416EFF",bgColor:"#D9E2FF",width:3},frozenColumnLine:{shadow:{width:3,startColor:"#CBDCFE",endColor:"#CBDCFE"}},selectionStyle:{cellBgColor:"rgba(0, 0, 255,0.1)"},tooltipStyle:{bgColor:"#FFF",color:"#000",fontSize:12,fontFamily:"Arial,sans-serif"}};var mv={underlayBackgroundColor:"#FFF",defaultStyle:{color:"#1B1F23",bgColor:"#EEF1F5",fontSize:14,fontFamily:"Arial,sans-serif",fontWeight:600,lineHeight:14,borderColor:"#e1e4e8",padding:[8,12,8,12]},headerStyle:{color:"#1B1F23",bgColor:"#EEF1F5",fontSize:14,fontFamily:"Arial,sans-serif",fontWeight:600,lineHeight:14,borderColor:"#e1e4e8",padding:[8,12,8,12],hover:{cellBgColor:"#c8daf6"}},rowHeaderStyle:{color:"#1B1F23",bgColor:"#EEF1F5",fontSize:12,fontFamily:"PingFang SC",fontWeight:500,lineHeight:12,borderColor:"#e1e4e8",padding:[8,12,8,12],hover:{cellBgColor:"#c8daf6"}},cornerHeaderStyle:{color:"#1B1F23",bgColor:"#EEF1F5",fontSize:12,fontFamily:"PingFang SC",fontWeight:500,lineHeight:12,borderColor:"#e1e4e8",padding:[8,12,8,12],hover:{cellBgColor:"#c8daf6"}},bodyStyle:{padding:[8,12,8,12],color:"#141414",fontSize:14,fontFamily:"Arial,sans-serif",fontWeight:400,textAlign:"left",bgColor:function(t){const{row:e,table:i}=t;return 1&e-i.frozenRowCount?"#fbfbfc":"#FFF"},borderColor:"#e1e4e8",lineHeight:14,hover:{cellBgColor:"#F7F8FA",inlineRowBgColor:"#F3F8FF",inlineColumnBgColor:"#F3F8FF"}},frameStyle:{borderColor:"#d1d5da",borderLineWidth:1,borderLineDash:[],cornerRadius:4,shadowBlur:6,shadowOffsetX:0,shadowOffsetY:0,shadowColor:"rgba(00, 24, 47, 0.06)"},columnResize:{lineWidth:1,lineColor:"#416EFF",bgColor:"#D9E2FF",width:3},frozenColumnLine:{shadow:{width:4,startColor:"rgba(00, 24, 47, 0.05)",endColor:"rgba(00, 24, 47, 0)"}},selectionStyle:{cellBgColor:"rgba(0, 0, 255,0.1)",cellBorderLineWidth:2,cellBorderColor:"#3073f2"},tooltipStyle:{bgColor:"#FFF",color:"#000",fontSize:12,fontFamily:"Arial,sans-serif"}};var bv={underlayBackgroundColor:"#FFF",defaultStyle:{borderColor:"#E1E4E8",color:"#000",bgColor:"#ECF1F5"},headerStyle:{fontSize:16,fontWeight:"bold",bgColor:"#ECF1F5",hover:{cellBgColor:"#CCE0FF",inlineRowBgColor:"#F3F8FF",inlineColumnBgColor:"#F3F8FF"}},rowHeaderStyle:{fontSize:16,fontWeight:"bold",bgColor:"#ECF1F5",hover:{cellBgColor:"#CCE0FF",inlineRowBgColor:"#F3F8FF",inlineColumnBgColor:"#F3F8FF"}},cornerHeaderStyle:{fontSize:16,fontWeight:"bold"},bodyStyle:{fontSize:14,bgColor:function(t){const{row:e,table:i}=t;return 1&e-i.frozenRowCount?"#FDFDFD":"#FAF9FB"},hover:{cellBgColor:"#CCE0FF",inlineRowBgColor:"#F3F8FF",inlineColumnBgColor:"#F3F8FF"}},frameStyle:{borderColor:"#E1E4E8",borderLineWidth:1,borderLineDash:[],cornerRadius:0,shadowBlur:0,shadowOffsetX:0,shadowOffsetY:0,shadowColor:"black"},columnResize:{lineWidth:1,lineColor:"#416EFF",bgColor:"#D9E2FF",width:3},frozenColumnLine:{shadow:{width:3,startColor:"rgba(225, 228, 232, 0.6)",endColor:"rgba(225, 228, 232, 0.6)"}},selectionStyle:{cellBgColor:"rgba(0, 0, 255,0.1)",cellBorderLineWidth:2,inlineColumnBgColor:"#CCE0FF",inlineRowBgColor:"#CCE0FF",cellBorderColor:"#0000ff"},tooltipStyle:{bgColor:"#FFF",color:"#000",fontSize:12,fontFamily:"Arial,sans-serif"}};var yv={underlayBackgroundColor:"#FFF",defaultStyle:{borderColor:function(t){const{col:e,table:i}=t,{colCount:r,frozenColCount:n}=i,o="#ccc7c7",s="#ccc7c7";return n-1===e||r-1===e?[o,"#f2f2f2",s,null]:[o,null,s,null]},hover:{cellBorderColor:"#0000FF",cellBgColor:"#D0E0E3"},bgColor:"#FFF"},headerStyle:{color:"rgba(0, 0, 0, 0.87)",borderColor:function(t){const{row:e,table:{frozenRowCount:i}}=t;return i-1===e?["#f2f2f2","#f2f2f2","#ccc7c7","#f2f2f2"]:["#f2f2f2"]}},bodyStyle:{color:"rgba(0, 0, 0, 0.87)"},frameStyle:{borderColor:"#f2f2f2",borderLineWidth:1},columnResize:{lineWidth:1,lineColor:"#416EFF",bgColor:"#D9E2FF"},selectionStyle:{cellBorderColor:"#FD5",cellBgColor:"rgba(111, 168, 220, 0.1)"},tooltipStyle:{bgColor:"#FFF",color:"#000",fontSize:12,fontFamily:"Arial,sans-serif"}};const Cv={},vv="Arial,sans-serif",wv=[],xv=/^(https?|ftp|file):\/\/[-A-Za-z0-9+&@#/%?=~_|!:,.;]+[-A-Za-z0-9+&@#/%=~_|]/,_v="$$indicator$$",Sv={type:"line"};function Av(t){return t||{}}const Bv={visible:!0,position:"auto",padding:8,titleStyle:{fontSize:12,fontWeight:"bold",fill:"#4E5969"},contentStyle:{fontSize:12,fill:"#4E5969"},panel:{visible:!0,fill:"#fff",stroke:"#ffffff",lineWidth:0,cornerRadius:3,shadowBlur:12,shadowOffsetX:0,shadowOffsetY:4,shadowColor:"rgba(0, 0, 0, 0.1)",size:0,space:12}};function Tv(t,e,i,r){return $C(t,...i)||$C(e,...i)||r&&$C(t,...r)||r&&$C(e,...r)}class Mv{internalTheme;_defaultStyle=null;_header=null;_cornerHeader=null;_cornerRightTopCell=null;_cornerLeftBottomCell=null;_cornerRightBottomCell=null;_rightFrozen=null;_bottomFrozen=null;_rowHeader=null;_body=null;_scroll=null;_tooltip=null;_frameStyle=null;_columnResize=null;_dragHeaderSplitLine=null;_frozenColumnLine=null;_selectionStyle=null;_axisStyle=null;_textPopTipStyle=null;constructor(t,e){this.internalTheme={obj:t,superTheme:e}}get font(){const{obj:t,superTheme:e}=this.internalTheme;return Tv(t,e,["font"],["bodyStyle","font"])}get underlayBackgroundColor(){const{obj:t,superTheme:e}=this.internalTheme;return Tv(t,e,["underlayBackgroundColor"])}get defaultStyle(){if(!this._defaultStyle){const{obj:t,superTheme:e}=this.internalTheme,i=BC({},e.defaultStyle,t.defaultStyle);this._defaultStyle={get fontSize(){return i.fontSize??16},get fontFamily(){return i.fontFamily??vv},get fontWeight(){return i.fontWeight},get fontVariant(){return i.fontVariant},get fontStyle(){return i.fontStyle},get bgColor(){return i.bgColor??"#FFF"},get color(){return i.color??"#000"},get borderColor(){return i.borderColor??"#000"},get borderLineWidth(){return i.borderLineWidth??1},get borderLineDash(){return i.borderLineDash??wv},get hover(){if(i.hover)return{get cellBgColor(){return i.hover?.cellBgColor??void 0},get inlineColumnBgColor(){return i.hover?.inlineColumnBgColor??(i.hover?.cellBgColor&&"string"==typeof i.hover?.cellBgColor?EC(i.hover?.cellBgColor,.1,!1):void 0)??void 0},get inlineRowBgColor(){return i.hover?.inlineRowBgColor??(i.hover?.cellBgColor&&"string"==typeof i.hover?.cellBgColor?EC(i.hover?.cellBgColor,.1,!1):void 0)??void 0}}},get padding(){return i.padding??[10,16,10,16]},get textAlign(){return i.textAlign??"left"},get textBaseline(){return i.textBaseline??"middle"},get textOverflow(){return i.textOverflow??"ellipsis"},get lineHeight(){return i.lineHeight},get autoWrapText(){return i.autoWrapText??!1},get lineClamp(){return i.lineClamp??"auto"},get linkColor(){return i.linkColor??"#3772ff"},get cursor(){return i.cursor??"auto"},get marked(){return i.marked??!1},get underline(){return i.underline??!1},get underlineColor(){return i.underlineColor},get underlineDash(){return i.underlineDash},get lineThrough(){return i.lineThrough??!1},get lineThroughColor(){return i.lineThroughColor},get lineThroughDash(){return i.lineThroughDash}}}return this._defaultStyle}get headerStyle(){if(!this._header){const{obj:t,superTheme:e}=this.internalTheme,i=BC({},this.defaultStyle,e.headerStyle,t.headerStyle);this._header=this.getStyle(i)}return this._header}get cornerHeaderStyle(){if(!this._cornerHeader){const{obj:t,superTheme:e}=this.internalTheme,i=BC({},this.defaultStyle,e.cornerHeaderStyle,t.cornerHeaderStyle);this._cornerHeader=this.getStyle(i)}return this._cornerHeader}get cornerRightTopCellStyle(){if(!this._cornerRightTopCell){const{obj:t,superTheme:e}=this.internalTheme;if(!e.cornerRightTopCellStyle&&!t.cornerRightTopCellStyle)return this._cornerRightTopCell;const i=BC({},this.defaultStyle,e.cornerRightTopCellStyle,t.cornerRightTopCellStyle);this._cornerRightTopCell=this.getStyle(i)}return this._cornerRightTopCell}get cornerLeftBottomCellStyle(){if(!this._cornerLeftBottomCell){const{obj:t,superTheme:e}=this.internalTheme;if(!e.cornerLeftBottomCellStyle&&!t.cornerLeftBottomCellStyle)return this._cornerLeftBottomCell;const i=BC({},this.defaultStyle,e.cornerLeftBottomCellStyle,t.cornerLeftBottomCellStyle);this._cornerLeftBottomCell=this.getStyle(i)}return this._cornerLeftBottomCell}get cornerRightBottomCellStyle(){if(!this._cornerRightBottomCell){const{obj:t,superTheme:e}=this.internalTheme;if(!e.cornerRightBottomCellStyle&&!t.cornerRightBottomCellStyle)return this._cornerRightBottomCell;const i=BC({},this.defaultStyle,e.cornerRightBottomCellStyle,t.cornerRightBottomCellStyle);this._cornerRightBottomCell=this.getStyle(i)}return this._cornerRightBottomCell}get rightFrozenStyle(){if(!this._rightFrozen){const{obj:t,superTheme:e}=this.internalTheme;if(!e.rightFrozenStyle&&!t.rightFrozenStyle)return this._rightFrozen;const i=BC({},this.defaultStyle,this.rowHeaderStyle,e.rightFrozenStyle,t.rightFrozenStyle);this._rightFrozen=this.getStyle(i)}return this._rightFrozen}get bottomFrozenStyle(){if(!this._bottomFrozen){const{obj:t,superTheme:e}=this.internalTheme;if(!e.bottomFrozenStyle&&!t.bottomFrozenStyle)return this._bottomFrozen;const i=BC({},this.defaultStyle,this.headerStyle,e.bottomFrozenStyle,t.bottomFrozenStyle);this._bottomFrozen=this.getStyle(i)}return this._bottomFrozen}get rowHeaderStyle(){if(!this._rowHeader){const{obj:t,superTheme:e}=this.internalTheme,i=BC({},this.defaultStyle,e.rowHeaderStyle,t.rowHeaderStyle);this._rowHeader=this.getStyle(i)}return this._rowHeader}get bodyStyle(){if(!this._body){const{obj:t,superTheme:e}=this.internalTheme,i=BC({},this.defaultStyle,e.bodyStyle,t.bodyStyle);this._body=this.getStyle(i)}return this._body}get frameStyle(){if(!this._frameStyle){const{obj:t,superTheme:e}=this.internalTheme,i=BC({},e.frameStyle,t.frameStyle);this._frameStyle={get borderColor(){return i.borderColor},get borderLineWidth(){return i.borderLineWidth},get borderLineDash(){return i.borderLineDash},get shadowBlur(){return i.shadowBlur},get shadowColor(){return i.shadowColor},get shadowOffsetX(){return i.shadowOffsetX},get shadowOffsetY(){return i.shadowOffsetY},get cornerRadius(){return i.cornerRadius}}}return this._frameStyle}get scrollStyle(){if(!this._scroll){const{obj:t,superTheme:e}=this.internalTheme,i=BC({},e.scrollStyle,t.scrollStyle);this._scroll={get scrollSliderColor(){return i.scrollSliderColor??"#C0C0C0"},get scrollRailColor(){return i.scrollRailColor},get visible(){return i.visible??"scrolling"},get width(){return i.width??7},get hoverOn(){return i.hoverOn??!0}}}return this._scroll}get tooltipStyle(){if(!this._tooltip){const{obj:t,superTheme:e}=this.internalTheme,i=BC({},e.tooltipStyle,t.tooltipStyle);this._tooltip={get fontFamily(){return i.fontFamily??vv},get fontSize(){return i.fontSize??16},get bgColor(){return i.bgColor??"#000"},get padding(){return i.padding??[6,8]},get color(){return i.color??"#FFF"}}}return this._tooltip}get columnResize(){if(!this._columnResize){const{obj:t,superTheme:e}=this.internalTheme,i=BC({},e.columnResize,t.columnResize);this._columnResize={get lineColor(){return i.lineColor??"#416EFF"},get bgColor(){return i.bgColor??"#D9E2FF"},get lineWidth(){return i.lineWidth??1},get width(){return i.width??i.lineWidth+2},get labelColor(){return i.labelColor??"#FFF"},get labelFontSize(){return i.labelFontSize??10},get labelFontFamily(){return i.labelFontFamily??"sans-serif"},get labelBackgroundFill(){return i.labelBackgroundFill??"#3073F2"},get labelBackgroundCornerRadius(){return i.labelBackgroundCornerRadius??5}}}return this._columnResize}get dragHeaderSplitLine(){if(!this._dragHeaderSplitLine){const{obj:t,superTheme:e}=this.internalTheme,i=BC({},e.dragHeaderSplitLine,t.dragHeaderSplitLine);this._dragHeaderSplitLine={get lineColor(){return i.lineColor??"blue"},get lineWidth(){return i.lineWidth??2},get shadowBlockColor(){return i.shadowBlockColor??"rgba(204,204,204,0.3)"}}}return this._dragHeaderSplitLine}get frozenColumnLine(){if(!this._frozenColumnLine){const{obj:t,superTheme:e}=this.internalTheme,i=BC({},e.frozenColumnLine,t.frozenColumnLine);this._frozenColumnLine={get shadow(){if(i.shadow)return{get width(){return i.shadow?.width??24},get startColor(){return i.shadow?.startColor??"rgba(00, 24, 47, 0.06)"},get endColor(){return i.shadow?.endColor??"rgba(00, 24, 47, 0)"}}},get border(){if(i.border)return{get lineColor(){return i.border?.lineColor??"rgba(00, 24, 47, 0.06)"},get bgColor(){return i.border?.bgColor??i.border?.lineColor??"rgba(00, 24, 47, 0.06)"},get lineWidth(){return i.border?.lineWidth??4},get width(){return i.border?.width??i.border?.lineWidth??4}}}}}return this._frozenColumnLine}get selectionStyle(){if(!this._selectionStyle){const{obj:t,superTheme:e}=this.internalTheme,i=BC({},e.selectionStyle,t.selectionStyle);this._selectionStyle={get cellBgColor(){return i?.cellBgColor??"rgba(0, 0, 255,0.1)"},get cellBorderColor(){return i?.cellBorderColor??"#3073f2"},get cellBorderLineWidth(){return i?.cellBorderLineWidth??2}}}return this._selectionStyle}get axisStyle(){if(!this._axisStyle){const{obj:t,superTheme:e}=this.internalTheme,i=BC({},e.axisStyle,t.axisStyle);this._axisStyle=function(t){return{defaultAxisStyle:Av(t.defaultAxisStyle),leftAxisStyle:Av(t.leftAxisStyle),rightAxisStyle:Av(t.rightAxisStyle),topAxisStyle:Av(t.topAxisStyle),bottomAxisStyle:Av(t.bottomAxisStyle)}}(i)}return this._axisStyle}get textPopTipStyle(){if(!this._textPopTipStyle){const{obj:t,superTheme:e}=this.internalTheme,i=BC({},Bv,e.textPopTipStyle,t.textPopTipStyle);this._textPopTipStyle=i}return this._textPopTipStyle}hasProperty(t){const{obj:e,superTheme:i}=this.internalTheme;return Rv(e,t)||Rv(i,t)}extends(t){return new Mv(t,this)}getStyle(t){return{get fontSize(){return t.fontSize},get fontFamily(){return t.fontFamily},get fontWeight(){return t.fontWeight},get fontVariant(){return t.fontVariant},get fontStyle(){return t.fontStyle},get bgColor(){return t.bgColor},get color(){return t.color},get borderColor(){return t.borderColor},get borderLineWidth(){return t.borderLineWidth},get borderLineDash(){return t.borderLineDash},get hover(){if(t.hover)return{get cellBgColor(){return t.hover?.cellBgColor??void 0},get inlineColumnBgColor(){return t.hover?.inlineColumnBgColor??(t.hover?.cellBgColor&&"string"==typeof t.hover?.cellBgColor?EC(t.hover?.cellBgColor,.1,!1):void 0)??void 0},get inlineRowBgColor(){return t.hover?.inlineRowBgColor??(t.hover?.cellBgColor&&"string"==typeof t.hover?.cellBgColor?EC(t.hover?.cellBgColor,.1,!1):void 0)??void 0}}},get frameStyle(){if(t.frameStyle)return{get borderColor(){return t.frameStyle?.borderColor??void 0},get borderLineWidth(){return t.frameStyle?.borderLineWidth??void 0},get borderLineDash(){return t.frameStyle?.borderLineDash??void 0}}},get padding(){return t.padding},get textAlign(){return t.textAlign},get textBaseline(){return t.textBaseline},get textOverflow(){return t.textOverflow},get lineHeight(){return t.lineHeight},get autoWrapText(){return t.autoWrapText},get lineClamp(){return t.lineClamp},get linkColor(){return t.linkColor},get cursor(){return t.cursor},get textStick(){return t.textStick},get marked(){return t.marked},get underline(){return t.underline??!1},get underlineColor(){return t.underlineColor},get underlineDash(){return t.underlineDash},get lineThrough(){return t.lineThrough??!1},get lineThroughColor(){return t.lineThroughColor},get lineThroughDash(){return t.lineThroughDash}}}}function Rv(t,e){if(t instanceof Mv)return t.hasProperty(e);let i=t;if(!i)return!1;for(let t=0;t<e.length;t++){if(i=i[e[t]],!i)return!1}return!!i}const Pv=new Mv(pv,pv),Ev=new Mv(fv,fv),Hv=new Mv(mv,mv),Lv=new Mv(bv,bv),kv=new Mv(yv,yv),Iv={DEFAULT:Lv,SIMPLIFY:kv,ARCO:Hv,DARK:Pv,BRIGHT:Ev},Fv={TableTheme:Mv};function zv(t){if(!t)return null;if("string"==typeof t){const e=function(t,e){if(t[e])return t[e];const i=e.toLowerCase();if(t[i])return t[i];const r=e.toLowerCase();if(t[r])return t[r];for(const e in t)if(e.toLowerCase()===i)return t[e]}(Ov(),t);return e?e instanceof Mv?e:new Mv(e,e):null}return t instanceof Mv?t:new Mv(t,t)}function Ov(){return VC(Iv,Cv)}var Dv={DARK:Pv,BRIGHT:Ev,ARCO:Hv,DEFAULT:Lv,SIMPLIFY:kv,theme:Fv,of:zv,get:Ov},Wv=Object.freeze({__proto__:null,ARCO:Hv,BRIGHT:Ev,DARK:Pv,DEFAULT:Lv,SIMPLIFY:kv,default:Dv,get:Ov,of:zv,theme:Fv});function Nv(t,e,i){if(!t.isHeader(e,i)&&!t.getBodyColumnDefine(e,i)?.mergeCell)return!1;const r=t.getCellRange(e,i);return!(r.start.col===r.end.col&&r.start.row===r.end.row)&&r}const Gv=["x","y","dx","dy","scaleX","scaleY","angle","anchor","postMatrix","visible","clip","pickable","childrenPickable","zIndex","cursor"];class jv extends hs{constructor(t,e){super(t),(null==e?void 0:e.mode)&&(this.mode=e.mode,this.setMode(e.mode)),(null==e?void 0:e.skipDefault)&&(this.skipDefault=!0),this.setTheme({common:{strokeBoundsBuffer:0}}),this.attribute=t,this.onSetStage((()=>{this.render(),this.bindEvents()}))}setAttribute(t,e,i){J(this.attribute[t])&&J(e)&&!$(this.attribute[t])&&!$(e)?wt(this.attribute[t],e):this.attribute[t]=e,Gv.includes(t)||this.render(),this.valid=this.isValid(),this.updateShapeAndBoundsTagSetted()||!i&&!this.needUpdateTag(t)?this.addUpdateBoundTag():this.addUpdateShapeAndBoundsTag(),this.addUpdatePositionTag(),this.onAttributeUpdate()}setAttributes(t,e){const i=Object.keys(t);this._mergeAttributes(t,i),i.every((t=>Gv.includes(t)))||this.render(),this.valid=this.isValid(),this.updateShapeAndBoundsTagSetted()||!e&&!this.needUpdateTags(i)?this.addUpdateBoundTag():this.addUpdateShapeAndBoundsTag(),this.addUpdatePositionTag(),this.onAttributeUpdate()}_mergeAttributes(t,e){X(e)&&(e=Object.keys(t));for(let i=0;i<e.length;i++){const r=e[i];!J(this.attribute[r])||$(this.attribute[r])||$(t[r])?this.attribute[r]=t[r]:wt(this.attribute[r],t[r])}}bindEvents(){}_getNodeId(t){return`${this.id}-${this.name}-${t}`}_dispatchEvent(t,e){var i;const r=new Bn(t,e);r.manager=null===(i=this.stage)||void 0===i?void 0:i.eventSystem.manager,this.dispatchEvent(r)}}const Uv={debounce:Ut,throttle:function(t,e,i){let r=!0,n=!0;if("function"!=typeof t)throw new TypeError("Expected a function");return q(i)&&(r="leading"in i?!!i.leading:r,n="trailing"in i?!!i.trailing:n),Ut(t,e,{leading:r,trailing:n,maxWait:e})}};Ay(),Fy();class Vv extends jv{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:wt({},Vv.defaultAttributes,t)),this.name="scrollbar",this._onRailPointerDown=t=>{const{viewX:e,viewY:i}=t,{direction:r,width:n,height:o,range:s}=this.attribute,a=this._sliderSize,[l,h]=this._getScrollRange();let c;if("vertical"===r){const t=i-this._viewPosition.y,e=Wt(t-a/2,l,h);c=t/o,this._slider.setAttribute("y",e,!0)}else{const t=e-this._viewPosition.x,i=Wt(t-a/2,l,h);c=t/n,this._slider.setAttribute("x",i,!0)}this.setScrollRange([c-(s[1]-s[0])/2,c+(s[1]-s[0])/2],!1),this.stage&&!this.stage.autoRender&&this.stage.renderNextFrame()},this._onSliderPointerDown=t=>{t.stopPropagation();const{direction:e}=this.attribute;this._prePos="horizontal"===e?t.clientX:t.clientY,this._dispatchEvent("scrollDown",{pos:this._prePos,event:t}),"browser"===_u.env?(_u.addEventListener("pointermove",this._onSliderPointerMove,{capture:!0}),_u.addEventListener("pointerup",this._onSliderPointerUp)):(this.stage.addEventListener("pointermove",this._onSliderPointerMove,{capture:!0}),this.stage.addEventListener("pointerup",this._onSliderPointerUp),this.stage.addEventListener("pointerupoutside",this._onSliderPointerUp))},this._computeScrollValue=t=>{const{direction:e}=this.attribute;let i,r,n=0;const{width:o,height:s}=this._getSliderRenderBounds();return"vertical"===e?(r=t.clientY,n=r-this._prePos,i=n/s):(r=t.clientX,n=r-this._prePos,i=n/o),[r,i]},this._onSliderPointerMove=Uv[this.attribute.delayType]((t=>{t.stopPropagation();const e=this.getScrollRange(),[i,r]=this._computeScrollValue(t);this.setScrollRange([e[0]+r,e[1]+r],!0),this._prePos=i}),this.attribute.delayTime),this._onSliderPointerUp=t=>{t.preventDefault();const{realTime:e=!0,range:i,limitRange:r=[0,1]}=this.attribute,n=this.getScrollRange(),[o,s]=this._computeScrollValue(t),a=[n[0]+s,n[1]+s];e||this._dispatchEvent("scroll",{pre:i,value:Nt(a,r[0],r[1])}),this._dispatchEvent("scrollUp",{pre:i,value:Nt(a,r[0],r[1])}),"browser"===_u.env?(_u.removeEventListener("pointermove",this._onSliderPointerMove,{capture:!0}),_u.removeEventListener("pointerup",this._onSliderPointerUp)):(this.stage.removeEventListener("pointermove",this._onSliderPointerMove,{capture:!0}),this.stage.removeEventListener("pointerup",this._onSliderPointerUp),this.stage.removeEventListener("pointerupoutside",this._onSliderPointerUp))}}setScrollRange(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];const{direction:i="horizontal",limitRange:r=[0,1],range:n,realTime:o=!0}=this.attribute,s=Nt(t,r[0],r[1]);if(e){const t=this._getSliderPos(s);this._slider&&("horizontal"===i?this._slider.setAttribute("x",t[0],!0):this._slider.setAttribute("y",t[0],!0),this.stage&&!this.stage.autoRender&&this.stage.renderNextFrame())}this.attribute.range=s,o&&(this._dispatchEvent("scroll",{pre:n,value:s}),this._dispatchEvent("scrollDrag",{pre:n,value:s}))}getScrollRange(){return this.attribute.range}bindEvents(){if(this.attribute.disableTriggerEvent)return;const{delayType:t="throttle",delayTime:e=0}=this.attribute;this._rail&&this._rail.addEventListener("pointerdown",Uv[t](this._onRailPointerDown,e)),this._slider&&this._slider.addEventListener("pointerdown",this._onSliderPointerDown)}render(){this._reset();const{direction:t="horizontal",width:e,height:i,range:r,limitRange:n=[0,1],railStyle:o,sliderStyle:s,padding:a=2}=this.attribute,l=this.createOrUpdateChild("scrollbar-container",{},"group"),h=l.createOrUpdateChild("scrollbar-rail",Object.assign({x:0,y:0,width:e,height:i},o),"rect");this._rail=h;const c=this._getSliderRenderBounds(),d=this._getSliderPos(Nt(r,n[0],n[1])),u=d[1]-d[0];let g;this._sliderSize=u,g="horizontal"===t?{x:d[0],y:c.y1,width:u,height:c.height}:{x:c.x1,y:d[0],width:c.width,height:u};const p=l.createOrUpdateChild("slider",Object.assign(Object.assign(Object.assign(Object.assign({},g),{cornerRadius:this._getDefaultSliderCornerRadius()}),s),{boundsPadding:Je(a),pickMode:"imprecise"}),"rect");this._slider=p,this._container=l;const f=this._container.AABBBounds;this._viewPosition={x:f.x1,y:f.y1}}_getSliderRenderBounds(){if(this._sliderRenderBounds)return this._sliderRenderBounds;const{width:t,height:e,padding:i=2}=this.attribute,[r,n,o,s]=Je(i),a={x1:s,y1:r,x2:t-n,y2:e-o,width:Math.max(0,t-(s+n)),height:Math.max(0,e-(r+o))};return this._sliderRenderBounds=a,a}_getDefaultSliderCornerRadius(){const{direction:t,round:e}=this.attribute;if(e){const{width:e,height:i}=this._getSliderRenderBounds();return"horizontal"===t?i:e}return 0}_getSliderPos(t){const{direction:e}=this.attribute,{width:i,height:r,x1:n,y1:o}=this._getSliderRenderBounds();return"horizontal"===e?[i*t[0]+n,i*t[1]+n]:[r*t[0]+o,r*t[1]+o]}_getScrollRange(){if(this._sliderLimitRange)return this._sliderLimitRange;const{limitRange:t=[0,1],direction:e}=this.attribute,[i,r]=Nt(t,0,1),{width:n,height:o,x1:s,y1:a}=this._getSliderRenderBounds(),l=this._sliderSize;return"horizontal"===e?Nt([s+i*n,s+r*n],s,n-l):Nt([a+i*o,a+r*o],a,o-l)}_reset(){this._sliderRenderBounds=null,this._sliderLimitRange=null}}function Kv(t,e){t.forEachChildren((t=>{const i=e(t);t.isContainer&&!i&&Kv(t,e)}))}function $v(t,e,i){const r=function(t,e){const[i,r]=t,[n,o]=e,s=Math.sqrt((i*i+r*r)*(n*n+o*o)),a=s&&(i*n+r*o)/s;return Math.acos(Math.min(Math.max(a,-1),1))}(t,e),n=function(t,e){return t[0]*e[1]-e[0]*t[1]}(t,e)>=0;return i?n?2*Math.PI-r:r:n?r:2*Math.PI-r}var Xv;Vv.defaultAttributes={direction:"horizontal",round:!0,sliderSize:20,sliderStyle:{fill:"rgba(0, 0, 0, .5)"},railStyle:{fill:"rgba(0, 0, 0, .0)"},padding:2,scrollRange:[0,1],delayType:"throttle",delayTime:0,realTime:!0},function(t){t.selected="selected",t.selectedReverse="selected_reverse",t.hover="hover",t.hoverReverse="hover_reverse"}(Xv||(Xv={}));const Yv={[Xv.selectedReverse]:{},[Xv.selected]:{},[Xv.hover]:{},[Xv.hoverReverse]:{}},qv={container:"",width:30,height:30,style:{}};function Zv(t,e){var i;if(!t)return{width:0,height:0};const r=dh({text:t,fontFamily:e.fontFamily,fontSize:e.fontSize||12,fontWeight:e.fontWeight,textAlign:null!==(i=e.textAlign)&&void 0!==i?i:"center",textBaseline:e.textBaseline,ellipsis:!!e.ellipsis,maxLineWidth:e.maxLineWidth||1/0,lineHeight:e.fontSize||12});return{width:r.width(),height:r.height()}}function Jv(){Ay(),Fy(),Gy(),Dy(),Uy()}var Qv=function(t,e){var i={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)<0&&(i[r]=t[r]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(r=Object.getOwnPropertySymbols(t);n<r.length;n++)e.indexOf(r[n])<0&&Object.prototype.propertyIsEnumerable.call(t,r[n])&&(i[r[n]]=t[r[n]])}return i};Jv();let tw=class t extends jv{constructor(e,i){super((null==i?void 0:i.skipDefault)?e:wt({},t.defaultAttributes,e)),this.name="tag"}render(){var t,e,i;const{text:r="",textStyle:n={},shape:o={},panel:s={},space:a=4,minWidth:l,maxWidth:h,padding:c=4,visible:d,state:u,type:g,textAlwaysCenter:p}=this.attribute,f=Je(c),m=this.createOrUpdateChild("tag-content",{x:0,y:0,zIndex:1},"group");let b,y=f[1]+f[3],C=f[0]+f[2],v=0,w=0;const{visible:x}=o,_=Qv(o,["visible"]);if(K(x)){const t=(null==_?void 0:_.size)||10,e=ot(t)?t:Math.max(t[0],t[1]);b=m.createOrUpdateChild("tag-shape",Object.assign(Object.assign({symbolType:"circle",size:t,strokeBoundsBuffer:0},_),{visible:x,x:e/2,y:e/2}),"symbol"),gt(null==u?void 0:u.shape)||(b.states=u.shape),x&&(w=e+a)}let S;if(y+=w,v+=w,"rich"===g){const i=Object.assign(Object.assign({textConfig:r,visible:Y(r)&&!1!==d},n),{x:v,y:0,width:null!==(t=n.width)&&void 0!==t?t:0,height:null!==(e=n.height)&&void 0!==e?e:0});S=m.createOrUpdateChild("tag-text",i,"richtext");const{visible:o}=s,a=Qv(s,["visible"]);if(d&&K(o)){const t=this.createOrUpdateChild("tag-panel",Object.assign(Object.assign({},a),{visible:o&&!!r,x:S.AABBBounds.x1,y:S.AABBBounds.y1,width:S.AABBBounds.width(),height:S.AABBBounds.height()}),"rect");gt(null==u?void 0:u.panel)||(t.states=u.panel)}}else if("html"===g){const t=Object.assign(Object.assign({textConfig:[],visible:Y(r)&&!1!==d,html:Object.assign(Object.assign({dom:r},qv),n)},n),{x:v,y:0});S=m.createOrUpdateChild("tag-text",t,"richtext");const{visible:e}=s,i=Qv(s,["visible"]);if(d&&K(e)){const t=this.createOrUpdateChild("tag-panel",Object.assign(Object.assign({},i),{visible:e&&!!r,x:S.AABBBounds.x1,y:S.AABBBounds.y1,width:S.AABBBounds.width(),height:S.AABBBounds.height()}),"rect");gt(null==u?void 0:u.panel)||(t.states=u.panel)}}else{const t=Object.assign(Object.assign({text:r,visible:Y(r)&&!1!==d,lineHeight:null==n?void 0:n.fontSize},n),{x:v,y:0});X(t.lineHeight)&&(t.lineHeight=n.fontSize),S=m.createOrUpdateChild("tag-text",t,"text"),gt(null==u?void 0:u.text)||(S.states=u.text);const e=Zv(t.text,n),a=e.width,c=e.height;y+=a;const g=null!==(i=o.size)&&void 0!==i?i:10,x=ot(g)?g:Math.max(g[0],g[1]);C+=Math.max(c,o.visible?x:0);const{textAlign:_,textBaseline:A}=n;(Y(l)||Y(h))&&(Y(l)&&y<l&&(y=l),Y(h)&&y>h&&(y=h,S.setAttribute("maxLineWidth",h-f[1]-f[2])));let B=0,T=0;"center"===_?(B-=y/2,b&&b.setAttribute("x",(b.attribute.x||0)-a/2),m.setAttribute("x",-w/2)):"right"===_||"end"===_?(B-=y,b&&b.setAttribute("x",(b.attribute.x||0)-a),m.setAttribute("x",-f[1]-w)):"left"!==_&&"start"!==_||m.setAttribute("x",f[3]),!p||"left"!==_&&"start"!==_||S.setAttributes({x:v+y/2,textAlign:"center"}),"middle"===A?(T-=C/2,b&&b.setAttribute("y",0)):"bottom"===A?(T-=C,b&&b.setAttribute("y",-c/2),m.setAttribute("y",-f[2])):"top"===A&&(m.setAttribute("y",f[0]),b&&b.setAttribute("y",c/2));const{visible:M}=s,R=Qv(s,["visible"]);if(d&&K(M)){const t=this.createOrUpdateChild("tag-panel",Object.assign(Object.assign({},R),{visible:M&&!!r,x:B,y:T,width:y,height:C}),"rect");gt(null==u?void 0:u.panel)||(t.states=u.panel)}}}};tw.defaultAttributes={visible:!0,textStyle:{fontSize:12,fill:"#000",textAlign:"left",textBaseline:"top"},space:4,padding:4,shape:{fill:"#000"}};const ew={visible:!0,position:"auto",titleStyle:{fontSize:16,fill:"#08979c"},contentStyle:{fontSize:12,fill:"green"},panel:{visible:!0,fill:"#e6fffb",size:12,space:0,stroke:"#87e8de",lineWidth:1,cornerRadius:4}},iw={poptip:wt({},ew)};var rw=function(t,e){var i={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)<0&&(i[r]=t[r]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(r=Object.getOwnPropertySymbols(t);n<r.length;n++)e.indexOf(r[n])<0&&Object.prototype.propertyIsEnumerable.call(t,r[n])&&(i[r[n]]=t[r[n]])}return i};const nw=new ge;Ay(),Ky(),Gy(),Fy();class ow extends jv{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:wt({},ow.defaultAttributes,t)),this.name="poptip",this.positionList=["top","tl","tr","bottom","bl","br","left","lt","lb","right","rt","rb"]}render(){var t,e,i,r,n,o,s,a;const{titleStyle:l={},position:h,contentStyle:c={},panel:d={},space:u=4,minWidth:g=0,maxWidth:p=1/0,padding:f=4,maxWidthPercent:m,visible:b,state:y,dx:C=0,dy:v=0}=this.attribute;let{title:w="",content:x=""}=this.attribute;w=this.attribute.titleFormatMethod?this.attribute.titleFormatMethod(w):w,x=this.attribute.contentFormatMethod?this.attribute.contentFormatMethod(x):x;const _=Je(f),S=this.createOrUpdateChild("poptip-content",{x:0,y:0,zIndex:1},"group"),A=p-_[1]-_[3],B=Y(w)&&!1!==b,T=Object.assign(Object.assign({text:it(w)?w:[w],visible:B},l),{x:_[3],y:_[0],maxLineWidth:A,textAlign:"left",textBaseline:"top"}),M=S.createOrUpdateChild("poptip-title",T,"wrapText");gt(null==y?void 0:y.title)||(M.states=y.title);const R=M.AABBBounds,P=R.height(),E=R.width();let H=P+u;B||(H=0);const L=Y(x)&&!1!==b,k=Object.assign(Object.assign({text:it(x)?x:[x],visible:L},c),{x:_[3],y:_[0]+H,maxLineWidth:A,textAlign:"left",textBaseline:"top"}),I=S.createOrUpdateChild("poptip-content",k,"wrapText");gt(null==y?void 0:y.content)||(I.states=y.content);const F=I.AABBBounds,z=F.height(),O=F.width();L&&(H+=z);let D=ee(E+_[1]+_[3],O+_[1]+_[3]);D>p?D=p:D<g&&(D=g);let W=_[0]+_[2]+H;const{visible:N}=d,G=rw(d,["visible"]),j=null!==(t=G.size)&&void 0!==t?t:12,U=it(j)?[j[0]+(null!==(e=G.space)&&void 0!==e?e:0),j[1]+(null!==(i=G.space)&&void 0!==i?i:0)]:j+(null!==(r=G.space)&&void 0!==r?r:0),V=null!==(n=G.lineWidth)&&void 0!==n?n:1,$=this.stage?[null!==(o=this.stage.viewWidth)&&void 0!==o?o:this.stage.width,null!==(s=this.stage.viewHeight)&&void 0!==s?s:this.stage.height]:void 0;if($){const t=this.AABBBounds,e=null!==(a=this.attribute.x)&&void 0!==a?a:t.x1,i=$[0]-t.x1;let r=Math.max(e,i);const n=(it(j)?j[0]:12)+3;if(r=Math.min(r-n,r*m),r<D){D=r;const t=_[1]+_[3];M.setAttribute("maxLineWidth",r-t),I.setAttribute("maxLineWidth",r-t),W=_[0]+_[2],B&&(W+=M.AABBBounds.height()+u),W+=I.AABBBounds.height()}}const X="auto"===h;let q,Z=-1/0;for(let t=0;t<this.positionList.length+1;t++){const e=X?this.positionList[t===this.positionList.length?q:t]:h,{angle:i,offset:r,rectOffset:n}=this.getAngleAndOffset(e,D,W,it(U)?U:[U,U-V]);if(K(N)){const t=(it(j)?j[0]:j)/4,e=S.createOrUpdateChild("poptip-symbol-panel",Object.assign(Object.assign({},G),{visible:N&&(L||B),x:t,y:0,strokeBoundsBuffer:-1,boundsPadding:-2,anchor:[0,0],symbolType:"arrow2Left",angle:i,dx:r[0],dy:r[1],size:j,zIndex:-9}),"symbol");gt(null==y?void 0:y.panel)||(e.states=y.panel);const n=S.createOrUpdateChild("poptip-rect-panel",Object.assign(Object.assign({},G),{visible:N&&(L||B),x:0,y:0,width:D,height:W,zIndex:-8}),"rect");gt(null==y?void 0:y.panel)||(n.states=y.panel)}if(S.setAttributes({x:-r[0]+C,y:-r[1]+v}),!X||!$)break;{nw.setValue(0,0,D,W).transformWithMatrix(S.globalTransMatrix);const e=nw,i=(new ue).setValue(0,0,$[0],$[1]);if(Q=i,tt=!1,(J=e)&&Q?(Pe=J.x1,Ee=J.x2,He=J.y1,Le=J.y2,ke=Q.x1,Ie=Q.x2,Fe=Q.y1,ze=Q.y2,tt&&(Pe>Ee&&([Pe,Ee]=[Ee,Pe]),He>Le&&([He,Le]=[Le,He]),ke>Ie&&([ke,Ie]=[Ie,ke]),Fe>ze&&([Fe,ze]=[ze,Fe])),Pe>ke&&Ee<Ie&&He>Fe&&Le<ze?De.BBOX1:ke>Pe&&Ie<Ee&&Fe>He&&ze<Le?De.BBOX2:De.NONE):De.NONE)break;{const r=Oe(e,i,!1),n=(r.x2-r.x1)*(r.y2-r.y1);n>Z&&(Z=n,q=t)}}}var J,Q,tt}getAngleAndOffset(t,e,i,r){const n=r[1]/2;switch(t){case"tl":return{angle:Xt/2*3,offset:[e/4,i+n],rectOffset:[-e/4,-i-r[1]]};case"top":return{angle:Xt/2*3,offset:[e/2,i+n],rectOffset:[0,-i-r[1]]};case"tr":return{angle:Xt/2*3,offset:[e/4*3,i+n],rectOffset:[e/4*3,-i-r[1]]};case"rt":return{angle:0,offset:[-n,i/5],rectOffset:[e/4*3,-i-r[1]]};case"right":return{angle:0,offset:[-n,i/2],rectOffset:[e/4*3,-i-r[1]]};case"rb":return{angle:0,offset:[-n,i/5*4],rectOffset:[e/4*3,-i-r[1]]};case"bl":return{angle:Xt/2,offset:[e/4,-n],rectOffset:[-e/4,-i-r[1]]};case"bottom":return{angle:Xt/2,offset:[e/2,-n],rectOffset:[0,-i-r[1]]};case"br":return{angle:Xt/2,offset:[e/4*3,-n],rectOffset:[e/4*3,-i-r[1]]};case"lt":return{angle:Xt,offset:[e+n,i/5],rectOffset:[-e/4,-i-r[1]]};case"left":return{angle:Xt,offset:[e+n,i/2],rectOffset:[0,-i-r[1]]};case"lb":return{angle:Xt,offset:[e+n,i/5*4],rectOffset:[e/4*3,-i-r[1]]}}}}ow.defaultAttributes={position:"rt",visible:!0,title:null,content:null,titleStyle:{fontSize:12,fill:"#000",textAlign:"left",textBaseline:"top"},contentStyle:{fontSize:12,fill:"#000",textAlign:"left",textBaseline:"top"},maxWidthPercent:.8,space:8,padding:10};var sw=function(t,e,i,r){var n,o=arguments.length,s=o<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,i,r);else for(var a=t.length-1;a>=0;a--)(n=t[a])&&(s=(o<3?n(s):o>3?n(e,i,s):n(e,i))||s);return o>3&&s&&Object.defineProperty(e,i,s),s};let aw=class{render(t,e,i,r,n,o,s,a,l,h,c,d,u){var g;if(1===t._showPoptip){const{visible:e,visibleCb:i}=t.attribute.poptip||{};if(!1===e||i&&!1===i(t))return;const r={};wt(r,ow.defaultAttributes,t.attribute.poptip?t.attribute.poptip:{}),this.poptipComponent?this.poptipComponent.initAttributes(r):this.poptipComponent=new ow(r);let n=t.attribute.poptip||{};if("text"===t.type&&null==n.title&&null==n.content){const e={};wt(e,iw.poptip,n),n=e,n.content=null!==(g=n.content)&&void 0!==g?g:t.attribute.text}const o=t.globalTransMatrix;this.poptipComponent.setAttributes(Object.assign(Object.assign({visibleAll:!0,pickable:!1,childrenPickable:!1},n),{x:o.e,y:o.f})),h.stage.tryInitInteractiveLayer();const s=h.stage.getLayer("_builtin_interactive");s&&s.add(this.poptipComponent)}else 2===t._showPoptip&&(t._showPoptip=0,this.poptipComponent&&this.poptipComponent.setAttributes({visibleAll:!1}))}};aw=sw([f()],aw);var lw=function(t,e,i,r){var n,o=arguments.length,s=o<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,i,r);else for(var a=t.length-1;a>=0;a--)(n=t[a])&&(s=(o<3?n(s):o>3?n(e,i,s):n(e,i))||s);return o>3&&s&&Object.defineProperty(e,i,s),s};let hw=class{constructor(){this.name="poptip",this.activeEvent="onRegister",this._uid=e.GenAutoIncrementId(),this.key=this.name+this._uid,this.poptip=t=>{const e=t.target;if(e.isContainer||!e.attribute)return void this.unpoptip(t);if(e===this.activeGraphic)return;const{poptip:i}=e.attribute;i&&(e.setAttributes({}),e._showPoptip=1),this.activeGraphic&&(this.activeGraphic.setAttributes({}),this.activeGraphic._showPoptip=2),this.setActiveGraphic(e,!0)},this.unpoptip=t=>{this.activeGraphic&&(this.activeGraphic.setAttributes({}),this.activeGraphic._showPoptip=2,this.setActiveGraphic(null,!0))}}activate(t){this.pluginService=t;const{stage:e}=this.pluginService;e.addEventListener("pointerover",this.poptip)}setActiveGraphic(t,e){this.activeGraphic=t,this.pluginService.stage.renderNextFrame()}deactivate(t){const{stage:e}=this.pluginService;e.removeEventListener("pointerover",this.poptip)}};hw=lw([f()],hw);let cw=class{constructor(){this.name="poptipForText",this.activeEvent="onRegister",this._uid=e.GenAutoIncrementId(),this.key=this.name+this._uid,this.pointerlave=t=>{const{stage:e}=this.pluginService;t.target===e&&this.unpoptip(t)},this.poptip=t=>{const e=t.target;if("text"!==e.type||!e.cliped||e.isContainer||!e.attribute||e.attribute.disableAutoClipedPoptip)return void this.unpoptip(t);if(e===this.activeGraphic)return;const{poptip:i={}}=e.attribute;i&&(e.setAttributes({}),e._showPoptip=1),this.activeGraphic&&(this.activeGraphic.setAttributes({}),this.activeGraphic._showPoptip=2),this.setActiveGraphic(e,!0)},this.unpoptip=t=>{this.activeGraphic&&(this.activeGraphic.setAttributes({}),this.activeGraphic._showPoptip=2,this.setActiveGraphic(null,!0))}}activate(t){this.pluginService=t;const{stage:e}=this.pluginService;e.addEventListener("pointerover",this.poptip),e.addEventListener("pointerleave",this.pointerlave)}setActiveGraphic(t,e){this.activeGraphic=t,this.pluginService.stage.renderNextFrame()}deactivate(t){const{stage:e}=this.pluginService;e.removeEventListener("pointerover",this.poptip),e.removeEventListener("pointerleave",this.pointerlave)}};cw=lw([f()],cw);const dw=new i(((t,e,i,r)=>{i(aw)||(t(aw).toSelf().inSingletonScope(),t(Vs).toService(aw)),i(hw)||(t(hw).toSelf(),t(_d).toService(hw)),i(cw)||(t(cw).toSelf(),t(_d).toService(cw))}));Ay(),Ry(),Ly(),Gy();class uw extends jv{getStartAngle(){return this._startAngle}getEndAngle(){return this._endAngle}getMainSegmentPoints(){return this._mainSegmentPoints}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:wt({},uw.defaultAttributes,t)),this.name="segment"}render(){this.removeAllChild(),this._reset();const{startSymbol:t,endSymbol:e,lineStyle:i,state:r,visible:n=!0,multiSegment:o,mainSegmentIndex:s}=this.attribute;if(!n)return;this._computeLineAngle();const a=this._renderSymbol(t,"start"),l=this._renderSymbol(e,"end");if(this.startSymbol=a,this.endSymbol=l,o){const t=[...this.attribute.points];if(st(s))t[s]=this._clipPoints(t[s]);else{const e=this._clipPoints(Et(t));t[0][0]=e[0],t[t.length-1][t[t.length-1].length-1]=e[e.length-1]}t.forEach(((t,e)=>{var n,o;const s=hh.line(Object.assign(Object.assign({points:t},it(i)?null!==(n=i[e])&&void 0!==n?n:i[i.length-1]:i),{fill:!1}));s.name=`${this.name}-line`,s.id=this._getNodeId("line"+e),gt(null==r?void 0:r.line)||(s.states=it(r.line)?null!==(o=r.line[e])&&void 0!==o?o:r.line[r.line.length-1]:r.line),this.add(s)}))}else{const t=hh.polygon(Object.assign(Object.assign({points:this._clipPoints(this.attribute.points)},Bt(i)[0]),{fill:!1,closePath:!1}));t.name=`${this.name}-line`,t.id=this._getNodeId("line"),gt(null==r?void 0:r.line)||(t.states=[].concat(r.line)[0]),this.add(t)}}_renderSymbol(t,e){const i=this._getMainSegmentPoints();if(!i.length)return;const{autoRotate:r=!0}=t;let n;if(t&&t.visible){const o=this._startAngle,s=this._endAngle,{state:a}=this.attribute,l=i[0],h=i[i.length-1],{refX:c=0,refY:d=0,refAngle:u=0,style:g,symbolType:p,size:f=12}=t;let m,b;"start"===e?(m={x:l.x+(st(o)?c*Math.cos(o)+d*Math.cos(o-Math.PI/2):0),y:l.y+(st(o)?c*Math.sin(o)+d*Math.sin(o-Math.PI/2):0)},b=o+Math.PI/2):(m={x:h.x+(st(s)?c*Math.cos(s)+d*Math.cos(s-Math.PI/2):0),y:h.y+(st(s)?c*Math.sin(s)+d*Math.sin(s-Math.PI/2):0)},b=s+Math.PI/2),n=hh.symbol(Object.assign(Object.assign(Object.assign({},m),{symbolType:p,size:f,angle:r?b+u:0,strokeBoundsBuffer:0}),g)),n.name=`${this.name}-${e}-symbol`,n.id=this._getNodeId(`${e}-symbol`),gt(null==a?void 0:a.symbol)||(n.states=a.symbol),this.add(n)}return n}_getMainSegmentPoints(){if(this._mainSegmentPoints)return this._mainSegmentPoints;const{points:t,multiSegment:e,mainSegmentIndex:i}=this.attribute;let r;return r=e?st(i)?t[i]:Et(t):t,this._mainSegmentPoints=r,r}_clipPoints(t){const{startSymbol:e={},endSymbol:i={}}=this.attribute;let r=t;if(e.visible){const i=e.clip?e.size||10:0;r=[{x:t[0].x-i/2*(Math.cos(this._startAngle)||0),y:t[0].y-i/2*(Math.sin(this._startAngle)||0)},...r.slice(1)]}if(i.visible){const e=i.clip?i.size||10:0,n={x:t[t.length-1].x-e/2*(Math.cos(this._endAngle)||0),y:t[t.length-1].y-e/2*(Math.sin(this._endAngle)||0)};r=[...r.slice(0,r.length-1),n]}return r}_computeLineAngle(){const t=this._getMainSegmentPoints();if(t.length<=1)return;const e=t[0],i=t[1],r=t[t.length-2],n=t[t.length-1],o=[e.x-i.x,e.y-i.y],s=Math.atan2(o[1],o[0]),a=[n.x-r.x,n.y-r.y],l=Math.atan2(a[1],a[0]);this._startAngle=s,this._endAngle=l}_reset(){this.startSymbol=null,this.endSymbol=null,this._startAngle=null,this._endAngle=null,this._mainSegmentPoints=null}}var gw,pw;uw.defaultAttributes={visible:!0,lineStyle:{lineWidth:1,stroke:"#000"},startSymbol:{visible:!1,autoRotate:!0,symbolType:"triangle",size:12,refX:0,refY:0,refAngle:0,style:{fill:"#000",zIndex:1}},endSymbol:{visible:!1,autoRotate:!0,symbolType:"triangle",size:12,refX:0,refY:0,refAngle:0,style:{fill:"#000",zIndex:1}}},function(t){t.innerView="inner-view",t.axisContainer="axis-container",t.labelContainer="axis-label-container",t.tickContainer="axis-tick-container",t.tick="axis-tick",t.subTick="axis-sub-tick",t.label="axis-label",t.title="axis-title",t.gridContainer="axis-grid-container",t.grid="axis-grid",t.gridRegion="axis-grid-region",t.line="axis-line",t.background="axis-background",t.axisLabelBackground="axis-label-background"}(gw||(gw={})),function(t){t.selected="selected",t.selectedReverse="selected_reverse",t.hover="hover",t.hoverReverse="hover_reverse"}(pw||(pw={}));const fw={[pw.selectedReverse]:{},[pw.selected]:{},[pw.hover]:{},[pw.hoverReverse]:{}},mw={title:{space:4,padding:0,textStyle:{fontSize:12,fill:"#333333",fontWeight:"normal",fillOpacity:1}},label:{visible:!0,inside:!1,space:4,padding:0,style:{fontSize:12,fill:"#333",fontWeight:"normal",fillOpacity:1}},tick:{visible:!0,inside:!1,alignWithLabel:!0,length:4,style:{lineWidth:1,stroke:"#000",strokeOpacity:1}},subTick:{visible:!1,inside:!1,count:4,length:2,style:{lineWidth:1,stroke:"#999",strokeOpacity:1}},line:{visible:!0,style:{lineWidth:1,stroke:"#000",strokeOpacity:1}}};class bw extends jv{constructor(){super(...arguments),this.name="axis",this.data=[],this.tickLineItems=[],this.subTickLineItems=[],this.axisLabelLayerSize={},this.axisLabelsContainer=null,this._onHover=t=>{const e=t.target;e!==this._lastHover&&e.name&&!gt(e.states)&&(e.addState(Xv.hover,!0),Kv(this.axisContainer,(t=>{t!==e&&t.name&&!gt(t.states)&&t.addState(Xv.hoverReverse,!0)})),this._lastHover=e)},this._onUnHover=t=>{this._lastHover&&(Kv(this.axisContainer,(t=>{t.name&&!gt(t.states)&&(t.removeState(Xv.hoverReverse),t.removeState(Xv.hover))})),this._lastHover=null)},this._onClick=t=>{const e=t.target;if(this._lastSelect===e&&e.hasState(Xv.selected))return this._lastSelect=null,void Kv(this.axisContainer,(t=>{t.name&&!gt(t.states)&&(t.removeState(Xv.selectedReverse),t.removeState(Xv.selected))}));e.name&&!gt(e.states)&&(e.addState(Xv.selected,!0),Kv(this.axisContainer,(t=>{t!==e&&t.name&&!gt(t.states)&&t.addState(Xv.selectedReverse,!0)})),this._lastSelect=e)}}getInnerView(){return this._innerView}getPrevInnerView(){return this._prevInnerView}getBoundsWithoutRender(t){const e=bt(this.attribute);wt(this.attribute,t);const i=hh.group({x:this.attribute.x,y:this.attribute.y});return this.add(i),this._renderInner(i),this.removeChild(i),this.attribute=e,i.AABBBounds}render(){this.removeAllChild(),this._prevInnerView=this._innerView,this._innerView=hh.group({x:0,y:0,pickable:!1}),this.add(this._innerView),this._renderInner(this._innerView),this._bindEvent()}_bindEvent(){if(this.attribute.disableTriggerEvent)return;const{hover:t,select:e}=this.attribute;t&&(this._innerView.addEventListener("pointermove",this._onHover),this._innerView.addEventListener("pointerout",this._onUnHover)),e&&this._innerView.addEventListener("pointerdown",this._onClick)}_renderInner(t){const{title:e,label:i,tick:r,line:n,items:o}=this.attribute,s=hh.group({x:0,y:0,zIndex:1});if(s.name=gw.axisContainer,s.id=this._getNodeId("container"),s.setMode(this.mode),this.axisContainer=s,t.add(s),n&&n.visible&&this.renderLine(s),o&&o.length&&(this.data=this._transformItems(o[0]),r&&r.visible&&this.renderTicks(s),i&&i.visible)){const t=hh.group({x:0,y:0,pickable:!1});t.name=gw.labelContainer,t.id=this._getNodeId("label-container"),this.axisLabelsContainer=t,s.add(t),o.forEach(((e,i)=>{const r=this.renderLabels(t,e,i),n=r.getChildren();this.beforeLabelsOverlap(n,e,r,i,o.length),this.handleLabelsOverlap(n,e,r,i,o.length),this.afterLabelsOverlap(n,e,r,i,o.length);let s=0,a=0,l="center",h="middle";n.forEach((t=>{var e;const i=t.attribute,r=null!==(e=i.angle)&&void 0!==e?e:0,n=t.AABBBounds;let o=n.width(),c=n.height();r&&(o=Math.abs(o*Math.cos(r)),c=Math.abs(c*Math.sin(r))),s=Math.max(s,o),a=Math.max(a,c),l=i.textAlign,h=i.textBaseline})),this.axisLabelLayerSize[i]={width:s,height:a,textAlign:l,textBaseline:h}}))}e&&e.visible&&this.renderTitle(s)}renderTicks(t){const e=this.getTickLineItems(),i=hh.group({x:0,y:0,pickable:!1});i.name=gw.tickContainer,i.id=this._getNodeId("tick-container"),t.add(i),e.forEach(((t,r)=>{var n;const o=hh.line(Object.assign({},this._getTickLineAttribute("tick",t,r,e)));if(o.name=gw.tick,o.id=this._getNodeId(t.id),gt(null===(n=this.attribute.tick)||void 0===n?void 0:n.state))o.states=Yv;else{const t=this.data[r],e=wt({},Yv,this.attribute.tick.state);Object.keys(e).forEach((i=>{$(e[i])&&(e[i]=e[i](t.rawValue,r,t,this.data))})),o.states=e}i.add(o)})),this.tickLineItems=e;const{subTick:r}=this.attribute;if(r&&r.visible){const t=this.getSubTickLineItems();t.length&&t.forEach(((t,n)=>{const o=hh.line(Object.assign({},this._getTickLineAttribute("subTick",t,n,e)));if(o.name=gw.subTick,o.id=this._getNodeId(`${n}`),gt(r.state))o.states=Yv;else{const i=wt({},Yv,r.state);Object.keys(i).forEach((r=>{$(i[r])&&(i[r]=i[r](t.value,n,t,e))})),o.states=i}i.add(o)})),this.subTickLineItems=t}}renderLabels(t,e,i){const{dataFilter:r}=this.attribute.label;r&&$(r)&&(e=r(e,i));const n=this._transformItems(e),o=hh.group({x:0,y:0,pickable:!1});return o.name=`${gw.labelContainer}-layer-${i}`,o.id=this._getNodeId(`label-container-layer-${i}`),t.add(o),n.forEach(((t,e)=>{var r,s,a;const l=this._getLabelAttribute(t,e,n,i);let h;if("rich"===l.type?(l.textConfig=l.text,l.width=null!==(r=l.width)&&void 0!==r?r:0,l.height=null!==(s=l.height)&&void 0!==s?s:0,h=hh.richtext(l)):"html"===l.type?(l.textConfig=[],l.html=Object.assign(Object.assign({dom:l.text},qv),l),h=hh.richtext(l)):h=hh.text(l),h.name=gw.label,h.id=this._getNodeId(`layer${i}-label-${t.id}`),gt(null===(a=this.attribute.label)||void 0===a?void 0:a.state))h.states=Yv;else{const r=wt({},Yv,this.attribute.label.state);Object.keys(r).forEach((o=>{$(r[o])&&(r[o]=r[o](t,e,n,i))})),h.states=r}o.add(h)})),o}renderTitle(t){const e=this.getTitleAttribute(),i=new tw(Object.assign({},e));i.name=gw.title,i.id=this._getNodeId("title"),t.add(i)}getVerticalCoord(t,e,i){const r=this.getVerticalVector(e,i,t);return{x:t.x+r[0],y:t.y+r[1]}}getTextAlign(t){let e="center";return Ft(t[0],0)?Ft(t[1],0)?Object.is(t[1],-0)?e="start":Object.is(t[0],-0)&&(e="end"):e="center":t[0]>0?e="start":t[0]<0&&(e="end"),e}getTickLineItems(){const{tick:t}=this.attribute,e=this.data,i=[],{alignWithLabel:r,inside:n=!1,length:o,dataFilter:s}=t;let a=1;return e.length>=2&&(a=e[1].value-e[0].value),(s&&$(s)?s(e):e).forEach((t=>{let e=t.point,s=t.value;if(!r){const i=t.value-a/2;if(this.isInValidValue(i))return;e=this.getTickCoord(i),s=i}const l=this.getVerticalCoord(e,o,n);if("3d"===this.mode){const r=this.getVerticalVector(o,n,e);let a=0,h=0;Jt(r[0])>Jt(r[1])?a=Xt/2*(l.x>e.x?1:-1):h=Xt/2*(l.y>e.y?-1:1),i.push({start:e,end:l,value:s,id:`tick-${t.id}`,anchor:[e.x,e.y],alpha:a,beta:h})}else i.push({start:e,end:l,value:s,id:`tick-${t.id}`})})),i}getSubTickLineItems(){const{subTick:t}=this.attribute,e=[],{count:i=4,inside:r=!1,length:n=2}=t,o=this.tickLineItems,s=o.length;if(s>=2)for(let t=0;t<s-1;t++){const s=o[t],a=o[t+1];for(let t=0;t<i;t++){const o=(t+1)/(i+1),l=(1-o)*s.value+o*a.value,h=this.getTickCoord(l),c=this.getVerticalCoord(h,n,r);e.push({start:h,end:c,value:l,id:`sub-tick-${l}`})}}return e}_getTickLineAttribute(t,e,i,r){let n=pt(this.attribute,`${t}.style`);const o=this.data[i];n=$(n)?wt({},pt(mw,`${t}.style`),"tick"===t?n(o.rawValue,i,o,this.data):n(e.value,i,e,r)):n;const{start:s,end:a,anchor:l,alpha:h,beta:c}=e;return Object.assign({points:[s,a],anchor:l,alpha:h,beta:c},n)}_getLabelAttribute(t,e,i,r){var n,o;const{space:s=4,inside:a=!1,formatMethod:l,type:h="text",text:c}=this.attribute.label;let d=s,u=0;(null===(n=this.attribute.tick)||void 0===n?void 0:n.visible)&&this.attribute.tick.inside===a&&(u=this.attribute.tick.length||4),(null===(o=this.attribute.subTick)||void 0===o?void 0:o.visible)&&this.attribute.subTick.inside===a&&(u=Math.max(u,this.attribute.subTick.length||2)),d+=u;const g=this.getRelativeVector(t.point);r>0&&(0===g[1]?d+=(this.axisLabelLayerSize[r-1].height+pt(this.attribute,"label.space",4))*r:d+=(this.axisLabelLayerSize[r-1].width+pt(this.attribute,"label.space",4))*r);const p=this.getVerticalCoord(t.point,d,a),f=this.getVerticalVector(d||1,a,p),m=l?l(`${t.label}`,t,e,i,r):t.label;let{style:b}=this.attribute.label;b=$(b)?wt({},mw.label.style,b(t,e,i,r)):b;return b=wt(this.getLabelAlign(f,a,b.angle),b),$(b.text)&&(b.text=b.text({label:t.label,value:t.rawValue,index:t.index,layer:r})),Object.assign(Object.assign(Object.assign({},this.getLabelPosition(p,f,m,b)),{text:null!=c?c:m,lineHeight:null==b?void 0:b.fontSize,type:h}),b)}getLabelPosition(t,e,i,r){return t}_transformItems(t){const e=[];return t.forEach((t=>{var i;e.push(Object.assign(Object.assign({},t),{point:this.getTickCoord(t.value),id:null!==(i=t.id)&&void 0!==i?i:t.label}))})),e}}function yw(t){t.forEach((t=>{if(t.rotatedBounds||!t.attribute.angle)return;const e=function(t){const e=t.AABBBounds;return{x1:e.x1,x2:e.x2,y1:e.y1,y2:e.y2,centerX:t.attribute.x,centerY:t.attribute.y,angle:t.attribute.angle}}(t),i=(o=e.centerX,s=e.centerY,a=e.angle,l=t.attribute.x,h=t.attribute.y,{x:(o-l)*Math.cos(a)+(s-h)*Math.sin(a)+l,y:(o-l)*Math.sin(a)+(h-s)*Math.cos(a)+h}),r=i.x-e.centerX,n=i.y-e.centerY;var o,s,a,l,h;e.x1+=r,e.x2+=r,e.y1+=n,e.y2+=n,e.centerX+=r,e.centerY+=n,t.rotatedBounds=e}))}function Cw(t,e){return We(t.AABBBounds,e.AABBBounds,!1)&&(!t.rotatedBounds||!e.rotatedBounds||function(t,e){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2],r=arguments.length>3?arguments[3]:void 0;const n=Ve(t,i),o=Ve(e,i),s=(t,e)=>[e.x-t.x,e.y-t.y];r&&(r.save(),r.fillStyle="red",r.globalAlpha=.6,n.forEach(((t,e)=>{0===e?r.moveTo(t.x,t.y):r.lineTo(t.x,t.y)})),r.fill(),r.restore(),r.save(),r.fillStyle="green",r.globalAlpha=.6,o.forEach(((t,e)=>{0===e?r.moveTo(t.x,t.y):r.lineTo(t.x,t.y)})),r.fill(),r.restore());const a=Ue(t),l=Ue(e);r&&r.fillRect(a.x,a.y,2,2),r&&r.fillRect(l.x,l.y,2,2);const h=s(a,l),c=s(n[0],n[1]),d=s(n[1],n[2]),u=s(o[0],o[1]),g=s(o[1],o[2]),p=i?t.angle:je(t.angle);let f=i?t.angle+Yt:je(90-t.angle);const m=i?e.angle:je(e.angle);let b=i?e.angle+Yt:je(90-e.angle);f>Zt&&(f-=Zt),b>Zt&&(b-=Zt);const y=(t,e,i,r)=>{const n=[Math.cos(e),Math.sin(e)];return t+(Ne(n,i)+Ne(n,r))/2>Ne(n,h)};return y((t.x2-t.x1)/2,p,u,g)&&y((t.y2-t.y1)/2,f,u,g)&&y((e.x2-e.x1)/2,m,c,d)&&y((e.y2-e.y1)/2,b,c,d)}(t.rotatedBounds,e.rotatedBounds,!0))}const vw={parity:function(t){return t.filter(((t,e)=>e%2?t.setAttribute("opacity",0):1))},greedy:function(t,e){let i;return t.filter(((t,r)=>r&&ww(i,t,e)?t.setAttribute("opacity",0):(i=t,1)))}};function ww(t,e,i){const r=t.AABBBounds,n=e.AABBBounds;return i>Math.max(n.x1-r.x2,r.x1-n.x2,n.y1-r.y2,r.y1-n.y2)&&(!t.rotatedBounds||!e.rotatedBounds||i>Math.max(e.rotatedBounds.x1-t.rotatedBounds.x2,t.rotatedBounds.x1-e.rotatedBounds.x2,e.rotatedBounds.y1-t.rotatedBounds.y2,t.rotatedBounds.y1-e.rotatedBounds.y2))}function xw(t,e){for(let i,r=1,n=t.length,o=t[0];r<n;o=i,++r)if(ww(o,i=t[r],e))return!0}function _w(t){const e=t.AABBBounds;return e.width()>1&&e.height()>1}function Sw(t){for(let e=1;e<t.length;e++)if(Cw(t[e-1],t[e]))return!0;return!1}function Aw(t,e){"bottom"!==t&&"top"!==t||function(t,e){e.forEach((e=>{e.attribute.angle&&e.setAttributes(Object.assign(Object.assign({},Tw(t,e.attribute.angle)),{angle:Bw(e.attribute.angle)}))}))}(t,e),"left"!==t&&"right"!==t||function(t,e){e.forEach(((e,i)=>{e.attribute.angle&&e.setAttributes(Object.assign(Object.assign({},Mw(t,e.attribute.angle)),{angle:Bw(e.attribute.angle)}))}))}(t,e),yw(e)}function Bw(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;if(t<0)for(;t<0;)t+=2*Math.PI;if(t>0)for(;t>=2*Math.PI;)t-=2*Math.PI;return t}function Tw(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=["center","left","left","left","center","right","right","right","left"],r=["top","top","middle","bottom","bottom","bottom","middle","top","top"];"top"===t&&(i=["center","right","right","right","center","left","left","left","right"],r=["bottom","bottom","middle","top","top","top","middle","bottom","bottom"]);const n=(e=Bw(e))/(.5*Math.PI);let o;return o=n===Math.floor(n)?2*Math.floor(n):2*Math.floor(n)+1,{textAlign:i[o],textBaseline:r[o]}}function Mw(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=["right","right","center","left","center","left","center","right","right"],r=["middle","middle","top","top","middle","middle","bottom","bottom","middle"];"right"===t&&(i=["left","right","right","right","left","left","left","left","right"],r=["middle","bottom","middle","top","top","top","middle","bottom","bottom"]);const n=(e=Bw(e))/(.5*Math.PI);let o;return o=n===Math.floor(n)?2*Math.floor(n):2*Math.floor(n)+1,{textAlign:i[o],textBaseline:r[o]}}var Rw=function(t,e){var i={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)<0&&(i[r]=t[r]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(r=Object.getOwnPropertySymbols(t);n<r.length;n++)e.indexOf(r[n])<0&&Object.prototype.propertyIsEnumerable.call(t,r[n])&&(i[r[n]]=t[r[n]])}return i};Ay(),Ry(),Dy(),Uy(),Fy();class Pw extends bw{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:wt({},Pw.defaultAttributes,t),e)}_renderInner(t){var e;super._renderInner(t);const{panel:i}=this.attribute;if(i&&i.visible){const t=this.axisContainer,r=t.AABBBounds,n=hh.rect(Object.assign({x:r.x1,y:r.y1,width:r.width(),height:r.height()},i.style));n.name=gw.background,n.id=this._getNodeId("background"),n.states=wt({},fw,null!==(e=i.state)&&void 0!==e?e:{}),t.insertBefore(n,t.firstChild)}}renderLine(t){const{start:e,end:i,line:r}=this.attribute,n=r,{startSymbol:o,endSymbol:s,style:a,breakRange:l,breakShape:h,breakShapeStyle:c,state:d}=n,u=Rw(n,["startSymbol","endSymbol","style","breakRange","breakShape","breakShapeStyle","state"]),g=Object.assign({points:[e,i],startSymbol:o,endSymbol:s,lineStyle:a},u);gt(d)||(g.state={line:wt({},fw,d),symbol:wt({},fw,d)});const p=new uw(g);p.name=gw.line,p.id=this._getNodeId("line"),t.add(p)}getTitleAttribute(){var t,e,i;const r=this.attribute.title,{position:n="middle",space:o=4,textStyle:s={},autoRotate:a=!0,shape:l,background:h,state:c={}}=r,d=Rw(r,["position","space","textStyle","autoRotate","shape","background","state"]);let u=.5;"start"===n?u=0:"end"===n&&(u=1);const{verticalFactor:g=1}=this.attribute,p=-1*g,f=this.getTickCoord(u),m=this.getRelativeVector();let b=0;if((null===(t=this.attribute.label)||void 0===t?void 0:t.visible)&&!1===this.attribute.label.inside){const t=+pt(this.attribute,"label.space",4);b+=t;const e=Object.keys(this.axisLabelLayerSize).length;if(0===m[1]){const i=this.axisLabelsContainer?this.axisLabelsContainer.AABBBounds.height():0;isFinite(i)?b+=i+(e-1)*t:b=0}else{if(0===m[0]){const i=this.axisLabelsContainer?this.axisLabelsContainer.AABBBounds.width():0;isFinite(i)?b+=i+(e-1)*t:b=0}else Object.keys(this.axisLabelLayerSize).forEach(((e,i)=>{b+=this.axisLabelLayerSize[e].width+(i>0?t:0)}));const i=this.axisLabelLayerSize[0].textAlign,r="start"===i||"left"===i,n="center"===i,o=m[1]>0;b=1===p?o?r?b:n?b/2:t:r?t:n?b/2:b:o?r?t:n?b/2:b:r?b:n?b/2:t}}let y=0;(null===(e=this.attribute.tick)||void 0===e?void 0:e.visible)&&!1===this.attribute.tick.inside&&(y=this.attribute.tick.length||4),(null===(i=this.attribute.subTick)||void 0===i?void 0:i.visible)&&!1===this.attribute.subTick.inside&&(y=Math.max(y,this.attribute.subTick.length||2));const C=y+b+o,v=this.getVerticalCoord(f,C,!1),w=this.getVerticalVector(C,!1,{x:0,y:0});let x,_,{angle:S}=d;if(x="start"===n?"start":"end"===n?"end":"center",X(S)&&a){S=$v(m,[1,0],!0);const{verticalFactor:t=1}=this.attribute;_=1==-1*t?"bottom":"top"}else x=this.getTextAlign(w),_=this.getTextBaseline(w,!1);const A=Object.assign(Object.assign(Object.assign({},v),d),{textStyle:Object.assign({textAlign:x,textBaseline:_},s),state:{text:wt({},fw,c.text),shape:wt({},fw,c.shape),panel:wt({},fw,c.background)}});return A.angle=S,l&&l.visible&&(A.shape=Object.assign({visible:!0},l.style),l.space&&(A.space=l.space)),h&&h.visible&&(A.panel=Object.assign({visible:!0},h.style)),A}getTextBaseline(t,e){let i="middle";const{verticalFactor:r=1}=this.attribute,n=(e?1:-1)*r;return Ft(t[1],0)?i=!Ft(t[0],0)||Object.is(t[0],-0)||Object.is(t[1],-0)?"middle":1===n?"bottom":"top":t[1]>0?i="top":t[1]<0&&(i="bottom"),i}getLabelAlign(t,e,i){const r=this.attribute.orient;if(st(i)||0===t[0]&&0===t[1]){if("top"===r||"bottom"===r)return Tw(r,i);if("left"===r||"right"===r)return Mw(r,i)}return{textAlign:this.getTextAlign(t),textBaseline:this.getTextBaseline(t,e)}}beforeLabelsOverlap(t,e,i,r,n){const{flush:o=!1}=this.attribute.label||{};if(o&&t.length){const{orient:e,start:i,end:r}=this.attribute,n="bottom"===e||"top"===e,o=t[0],s=Tt(t),a=n?o.attribute.x>s.attribute.x:o.attribute.y<s.attribute.y;if(n)if(a){const t=r.x,e=i.x,n=o.AABBBounds.x2,a=s.AABBBounds.x1;n>t&&o.setAttributes({x:t,textAlign:"right"}),a<e&&s.setAttributes({x:e,textAlign:"left"})}else{const t=i.x,e=r.x,n=o.AABBBounds.x1,a=s.AABBBounds.x2;n<t&&o.setAttributes({x:t,textAlign:"left"}),a>e&&s.setAttributes({x:e,textAlign:"right"})}else if(a){const t=o.AABBBounds.y1,e=s.AABBBounds.y2,n=i.y,a=r.y;t<n&&o.setAttributes({y:n,textBaseline:"top"}),e>a&&s.setAttributes({y:a,textBaseline:"bottom"})}else{const t=r.y,e=i.y,n=o.AABBBounds.y2,a=s.AABBBounds.y1;n>t&&o.setAttributes({y:t,textBaseline:"bottom"}),a<e&&s.setAttributes({y:e,textBaseline:"top"})}}}handleLabelsOverlap(t,e,i,r,n){if(gt(t))return;const{verticalLimitSize:o,label:s,orient:a}=this.attribute,l=this._getAxisLabelLimitLength(o,n),{layoutFunc:h,autoRotate:c,autoRotateAngle:d,autoLimit:u,limitEllipsis:g,autoHide:p,autoHideMethod:f,autoHideSeparation:m,lastVisible:b}=s;if($(h))h(t,e,r,this);else{if(c&&function(t,e){if(gt(t))return;const{orient:i,labelRotateAngle:r=[0,45,90]}=e;if(0===r.length||t.some((t=>!!t.attribute.angle)))return;let n=0,o=0;for(r&&r.length>0&&(o=r.length);n<o;){const e=r[n++];if(t.forEach((t=>{t.attribute.angle=pe(e)})),Aw(i,t),!Sw(t))break}}(t,{labelRotateAngle:d,orient:a}),u&&st(l)&&l>0){const e="left"!==a&&"right"!==a||!t.some((t=>"vertical"===t.attribute.direction))?1/0:Math.abs(this.attribute.start.y-this.attribute.end.y)/t.length;!function(t,e){const{limitLength:i,verticalLimitLength:r,ellipsis:n="...",orient:o}=e;!gt(t)&&st(i)&&t.forEach((t=>{if(("top"===o||"bottom"===o)&&Math.floor(t.AABBBounds.height())<=i)return;const e=t.attribute.direction;if(("left"===o||"right"===o)&&("vertical"===e&&Math.floor(t.AABBBounds.height())<=r||"vertical"!==e&&Math.floor(t.AABBBounds.width())<=i))return;const s=t.attribute.angle;let a=0===s||X(s)?"top"===o||"bottom"===o?null:"vertical"===e?r:i:Math.abs(i/Math.sin(s));st(t.attribute.maxLineWidth)&&(a=st(a)?Math.min(t.attribute.maxLineWidth,a):t.attribute.maxLineWidth),t.setAttributes({maxLineWidth:a,ellipsis:t.attribute.ellipsis||n})}))}(t,{limitLength:l,verticalLimitLength:e,ellipsis:g,orient:a})}p&&function(t,e){if(gt(t))return;const i=t.filter(_w);if(gt(i))return;let r;r=function(t){return t.forEach((t=>t.setAttribute("opacity",1))),t}(i),yw(r);const{method:n="parity",separation:o=0}=e,s=$(n)?n:vw[n]||vw.parity;if(r.length>=3&&xw(r,o)){do{r=s(r,o)}while(r.length>=3&&xw(r,o));if(r.length<3||e.lastVisible){const t=Tt(i);if(!t.attribute.opacity){const e=r.length;if(e>1){t.setAttribute("opacity",1);for(let i=e-1;i>=0&&ww(r[i],t,o);i--)r[i].setAttribute("opacity",0)}}}}i.forEach((t=>{t.setAttribute("visible",!!t.attribute.opacity)}))}(t,{orient:a,method:f,separation:m,lastVisible:b})}}afterLabelsOverlap(t,e,i,r,n){const{verticalLimitSize:o,orient:s}=this.attribute,a="bottom"===s||"top"===s,l=i.AABBBounds;let h=a?l.height():l.width();const{verticalMinSize:c}=this.attribute;if(st(c)&&(!st(o)||c<=o)){const t=this._getAxisLabelLimitLength(c,n);let e,r;h=Math.max(h,t),"left"===s?(e=l.x2-h,r=l.y1):"right"===s?(e=l.x1,r=l.y1):"top"===s?(e=l.x1,r=l.y2-h):"bottom"===s&&(e=l.x1,r=l.y1);const o=hh.rect({x:e,y:r,width:a?l.width():h,height:a?h:l.height(),pickable:!1});o.name=gw.axisLabelBackground,o.id=this._getNodeId("axis-label-background"),i.insertBefore(o,i.firstChild)}if(Y(this.attribute.label.containerAlign)){let e;"left"===s?e=l.x2:"right"===s?e=l.x1:"top"===s?e=l.y2:"bottom"===s&&(e=l.y1),function(t,e,i,r,n){if("right"===r||"left"===r){if("left"===n){const n="right"===r?0:-1;t.forEach((t=>{t.setAttributes({x:e+i*n,textAlign:"left"})}))}else if("right"===n){const n="right"===r?1:0;t.forEach((t=>{t.setAttributes({x:e+i*n,textAlign:"right"})}))}else if("center"===n){const n="right"===r?1:-1;t.forEach((t=>{t.setAttributes({x:e+.5*i*n,textAlign:"center"})}))}}else if("bottom"===r||"top"===r)if("top"===n){const n="bottom"===r?0:-1;t.forEach((t=>{t.setAttributes({y:e+i*n,textBaseline:"top"})}))}else if("bottom"===n){const n="bottom"===r?1:0;t.forEach((t=>{t.setAttributes({y:e+i*n,textBaseline:"bottom"})}))}else if("middle"===n){const n="bottom"===r?1:-1;t.forEach((t=>{t.setAttributes({y:e+.5*i*n,textBaseline:"middle"})}))}}(t,e,h,s,this.attribute.label.containerAlign)}}_getAxisLabelLimitLength(t,e){var i,r,n;const{label:o,title:s,line:a,tick:l}=this.attribute,h=null!==(i=o.space)&&void 0!==i?i:4;let c=t,d=0,u=0;const g=a&&a.visible?null!==(r=a.style.lineWidth)&&void 0!==r?r:1:0,p=l&&l.visible?null!==(n=l.length)&&void 0!==n?n:4:0;if(s&&s.visible&&"string"==typeof s.text){d=Zv(s.text,s.textStyle).height;const t=Je(s.padding);u=s.space+t[0]+t[2]}return c&&(c=(c-h-u-d-g-p)/e),c}}function Ew(){Ay(),Gy(),Uy()}Pw.defaultAttributes=mw,function(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];if(t="prototype"in t?t.prototype:t,e="prototype"in e?e.prototype:e,Object.getOwnPropertyNames){const r=Object.getOwnPropertyNames(e);for(let n=0;n<r.length;n++){const o=r[n];"constructor"!==o&&(i?null!=e[o]:null==t[o])&&(t[o]=e[o])}}else At(t,e,i)}(Pw,class{isInValidValue(t){return t<0||t>1}getTickCoord(t){const{start:e}=this.attribute,i=this.getRelativeVector();return{x:e.x+i[0]*t,y:e.y+i[1]*t}}getRelativeVector(t){const{start:e,end:i}=this.attribute;return[i.x-e.x,i.y-e.y]}getVerticalVector(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];const{verticalFactor:i=1}=this.attribute,r=function(t){const[e,i]=t;let r=e*e+i*i;return r>0&&(r=1/Math.sqrt(r)),[t[0]*r,t[1]*r]}(this.getRelativeVector());return function(t,e){return[t[0]*e,t[1]*e]}([r[1],-1*r[0]],t*(e?1:-1)*i)}});const Hw={space:8,style:{fill:"rgb(47, 69, 84)",cursor:"pointer",size:15},state:{disable:{fill:"rgb(170, 170, 170)",cursor:"not-allowed"},hover:{}}};Ew();class Lw extends jv{getCurrent(){return this._current}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:wt({},Lw.defaultAttributes,t)),this.name="pager",this._current=1,this._onHover=t=>{const e=t.target;e.hasState("disable")||e.addState("hover")},this._onUnHover=t=>{t.target.removeState("hover")},this._onClick=t=>{const e=t.target;if("preHandler"===e.name){if(1===this._current)return;this._current-=1,1===this._current?e.addState("disable"):e.removeState("disable"),this._dispatchEvent("toPrev",{current:this._current,total:this._total,direction:"pre",event:t})}if("nextHandler"===e.name){if(this._current===this._total)return;this._current+=1,this._current===this._total?e.addState("disable"):e.removeState("disable"),this._dispatchEvent("toNext",{current:this._current,total:this._total,direction:"next",event:t})}this._current>1&&this.preHandler.removeState("disable"),this._current<this._total&&this.nextHandler.removeState("disable"),this.text.setAttribute("text",`${this._current}/${this._total}`)}}render(){var t;this._reset();const{layout:e="horizontal",handler:i=Hw,total:r,defaultCurrent:n=1,textStyle:o,padding:s=0}=this.attribute;this._current=n;const a=Je(s),l="horizontal"===e,h=hh.group({x:0,y:0}),c=i.style||{},d=c.size||15,u=null!==(t=i.space)&&void 0!==t?t:8,g=i.state||{};let{preShape:p,nextShape:f}=i;p||(p=l?"triangleLeft":"triangleUp"),f||(f=l?"triangleRight":"triangleDown");const m=hh.symbol(Object.assign(Object.assign({strokeBoundsBuffer:0,pickMode:"imprecise"},c),{x:0,y:0,symbolType:p,size:d}));m.states=g,m.name="preHandler",this.preHandler=m,h.add(m);const{width:b,height:y}=Zv(`${r}/${r}`,Object.assign({textAlign:"center",textBaseline:"middle"},o)),C=ot(d)?d:d[0],v=ot(d)?d:d[1],w=hh.text(Object.assign({x:l?C/2+u+b/2:0,y:l?0:v/2+u+y/2,text:`${n}/${r}`,textAlign:"center",textBaseline:"middle",lineHeight:null==o?void 0:o.fontSize},o));this.text=w,h.add(w);const x=hh.symbol(Object.assign(Object.assign({strokeBoundsBuffer:0,pickMode:"imprecise"},c),{x:l?C+2*u+b:0,y:l?0:v+2*u+y,symbolType:f,size:d}));x.name="nextHandler",x.states=g,this.nextHandler=x,h.add(x),1===this._total?(m.addState("disable"),x.addState("disable")):1===this._current?m.addState("disable"):this._current===r&&x.addState("disable");const _=h.AABBBounds,S=_.width(),A=_.height();h.translateTo(0-_.x1+a[3],0-_.y1+a[0]),this.add(h),this.attribute.width=S+a[1]+a[3],this.attribute.height=A+a[0]+a[2],this._bindEvents()}_bindEvents(){this.attribute.disableTriggerEvent||(this.preHandler&&(this.preHandler.addEventListener("pointerenter",this._onHover),this.preHandler.addEventListener("pointerleave",this._onUnHover),this.preHandler.addEventListener("pointerdown",this._onClick)),this.nextHandler&&(this.nextHandler.addEventListener("pointerenter",this._onHover),this.nextHandler.addEventListener("pointerleave",this._onUnHover),this.nextHandler.addEventListener("pointerdown",this._onClick)))}_reset(){this.removeAllChild(),this._current=1,this._total=this.attribute.total,this.preHandler=this.nextHandler=this.text=null}}Lw.defaultAttributes={handler:Hw,textStyle:{fill:"rgb(51, 51, 51)",fontSize:12}};const kw=16,Iw=8,Fw=12;var zw,Ow,Dw;!function(t){t.selected="selected",t.unSelected="unSelected",t.selectedHover="selectedHover",t.unSelectedHover="unSelectedHover",t.focus="focus"}(zw||(zw={})),function(t){t.legendItemHover="legendItemHover",t.legendItemUnHover="legendItemUnHover",t.legendItemClick="legendItemClick",t.legendItemAttributeUpdate="legendItemAttributeUpdate"}(Ow||(Ow={})),function(t){t.innerView="innerView",t.title="legendTitle",t.item="legendItem",t.itemShape="legendItemShape",t.itemLabel="legendItemLabel",t.itemValue="legendItemValue",t.focus="legendItemFocus"}(Dw||(Dw={}));class Ww extends jv{constructor(){super(...arguments),this.name="legend",this._title=null}render(){this.removeAllChild();const{interactive:t=!0,title:e,padding:i=0}=this.attribute,r=Je(i),n=hh.group({x:r[3],y:r[0],pickable:t,childrenPickable:t});n.name=Dw.innerView,this.add(n),this._innerView=n,(null==e?void 0:e.visible)&&this._renderTitle(e),this._renderContent(),this._adjustLayout(),t&&this._bindEvents();const o=this._innerView.AABBBounds;this.attribute.width=o.width()+r[1]+r[3],this.attribute.height=o.height()+r[0]+r[2]}_renderTitle(t){const{text:e="",textStyle:i,padding:r=0,background:n,minWidth:o,maxWidth:s,shape:a}=t,l={x:0,y:0,text:e,textStyle:i,padding:Je(r),minWidth:o,maxWidth:s};a&&a.visible&&(l.shape=Object.assign({visible:!0},a.style),Y(a.space)&&(l.space=a.space)),n&&n.visible&&(l.panel=Object.assign({visible:!0},n.style));const h=new tw(l);h.name=Dw.title,this._title=h,this._innerView.add(h)}_adjustLayout(){var t;if(this._title){const e=this._innerView.AABBBounds.width(),i=this._title.AABBBounds.width(),r=null===(t=this.attribute.title)||void 0===t?void 0:t.align;"center"===r?this._title.setAttribute("x",(e-i)/2):"end"===r&&this._title.setAttribute("x",e-i)}}}function Nw(){Ay(),Uy(),Fy(),Gy()}function Gw(){Ay(),Jv()}var jw=function(t,e){var i={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)<0&&(i[r]=t[r]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(r=Object.getOwnPropertySymbols(t);n<r.length;n++)e.indexOf(r[n])<0&&Object.prototype.propertyIsEnumerable.call(t,r[n])&&(i[r[n]]=t[r[n]])}return i};const Uw={[zw.focus]:{},[zw.selected]:{},[zw.selectedHover]:{},[zw.unSelected]:{},[zw.unSelectedHover]:{}};Gw(),Ew();class Vw extends Ww{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:wt({},Vw.defaultAttributes,t)),this.name="discreteLegend",this._itemsContainer=null,this._itemHeightByUser=void 0,this._itemHeight=0,this._itemMaxWidth=0,this._onHover=t=>{const e=t.target;if(e&&e.name&&e.name.startsWith(Dw.item)){const i=e.delegate;if(this._lastActiveItem){if(this._lastActiveItem.id===i.id)return;this._unHover(this._lastActiveItem,t)}this._hover(i,t)}else this._lastActiveItem&&(this._unHover(this._lastActiveItem,t),this._lastActiveItem=null)},this._onUnHover=t=>{this._lastActiveItem&&(this._unHover(this._lastActiveItem,t),this._lastActiveItem=null)},this._onClick=t=>{var e,i,r,n;const o=t.target;if(o&&o.name&&o.name.startsWith(Dw.item)){const s=o.delegate;if(o.name===Dw.focus){const r=s.hasState(zw.focus);s.toggleState(zw.focus),r?null===(e=this._itemsContainer)||void 0===e||e.getChildren().forEach((e=>{this._removeLegendItemState(e,[zw.unSelected,zw.unSelectedHover,zw.focus],t),this._setLegendItemState(e,zw.selected,t)})):(this._setLegendItemState(s,zw.selected,t),this._removeLegendItemState(s,[zw.unSelected,zw.unSelectedHover],t),null===(i=this._itemsContainer)||void 0===i||i.getChildren().forEach((e=>{s!==e&&(this._removeLegendItemState(e,[zw.selected,zw.selectedHover,zw.focus],t),this._setLegendItemState(e,zw.unSelected,t))})))}else{null===(r=this._itemsContainer)||void 0===r||r.getChildren().forEach((t=>{t.removeState(zw.focus)}));const{selectMode:e="multiple",allowAllCanceled:i=!0}=this.attribute,o=s.hasState(zw.selected),a=this._getSelectedLegends();if("multiple"===e){if(!1===i&&o&&1===a.length)return void this._dispatchLegendEvent(Ow.legendItemClick,s,t);o?(this._removeLegendItemState(s,[zw.selected,zw.selectedHover],t),this._setLegendItemState(s,zw.unSelected,t)):(this._setLegendItemState(s,zw.selected,t),this._removeLegendItemState(s,[zw.unSelected,zw.unSelectedHover],t))}else this._setLegendItemState(s,zw.selected,t),this._removeLegendItemState(s,[zw.unSelected,zw.unSelectedHover],t),null===(n=this._itemsContainer)||void 0===n||n.getChildren().forEach((e=>{s!==e&&(this._removeLegendItemState(e,[zw.selected,zw.selectedHover],t),this._setLegendItemState(e,zw.unSelected,t))}))}this._dispatchLegendEvent(Ow.legendItemClick,s,t)}}}setSelected(t){var e;(null===(e=this._itemsContainer)||void 0===e?void 0:e.getChildren()).forEach((e=>{const i=e.data;t.includes(i.label)?(this._setLegendItemState(e,zw.selected),this._removeLegendItemState(e,[zw.unSelected,zw.unSelectedHover])):(this._removeLegendItemState(e,[zw.selected,zw.selectedHover]),this._setLegendItemState(e,zw.unSelected))}))}_renderContent(){const{item:t={},items:e,reversed:i,maxCol:r=1,maxRow:n=2}=this.attribute;if(!1===t.visible||gt(e))return;let o=e;i&&(o=null==e?void 0:e.reverse());const s=hh.group({x:0,y:0});this._itemsContainer=s;const{layout:a,maxWidth:l,maxHeight:h,defaultSelected:c=[],autoPage:d}=this.attribute,u="horizontal"===a,{spaceCol:g=kw,spaceRow:p=Iw,maxWidth:f,width:m,height:b}=t;Y(f)?Y(m)?this._itemWidthByUser=Math.min(f,m):this._itemWidthByUser=f:Y(m)&&(this._itemWidthByUser=m),Y(b)&&(this._itemHeightByUser=b);let y=!1,C=0,v=0,w=0,x=1,_=1;o.forEach(((t,e)=>{t.id||(t.id=t.label),t.index=e;const i=this._renderEachItem(t,!!gt(c)||(null==c?void 0:c.includes(t.label)),e,o),a=i.attribute.width,d=i.attribute.height;this._itemHeight=Math.max(this._itemHeight,d),C=Math.max(a,C),this._itemMaxWidth=Math.max(a,this._itemMaxWidth),u?(x=n,Y(l)&&(a>=l?(y=!0,e>0&&(v=0,w+=d+p,_+=1)):l<v+a&&(y=!0,v=0,w+=d+p,_+=1)),e>0&&i.setAttributes({x:v,y:w}),v+=g+a):(x=r,Y(h)&&h<w+d&&(y=!0,w=0,v+=C+g,C=0,_+=1),e>0&&i.setAttributes({x:v,y:w}),w+=p+d),s.add(i)}));let S=!1;y&&d&&_>x&&(S=this._renderPager(u)),S||(s.setAttribute("y",this._title?this._title.AABBBounds.height()+pt(this.attribute,"title.space",8):0),this._innerView.add(s))}_bindEvents(){if(this.attribute.disableTriggerEvent)return;if(!this._itemsContainer)return;const{hover:t=!0,select:e=!0}=this.attribute;t&&(this._itemsContainer.addEventListener("pointermove",this._onHover),this._itemsContainer.addEventListener("pointerleave",this._onUnHover)),e&&this._itemsContainer.addEventListener("pointerdown",this._onClick)}_renderEachItem(t,e,i,r){var n,o;const{id:s,label:a,value:l,shape:h}=t,{padding:c=0,focus:d,focusIconStyle:u}=this.attribute.item,{shape:g,label:p,value:f,background:m}=this.attribute.item,b=this._handleStyle(g,t,e,i,r),y=this._handleStyle(p,t,e,i,r),C=this._handleStyle(f,t,e,i,r),v=this._handleStyle(m,t,e,i,r),w=Je(c);let x;!1===m.visible?(x=hh.group({x:0,y:0,cursor:null===(n=v.style)||void 0===n?void 0:n.cursor}),this._appendDataToShape(x,Dw.item,t,x)):(x=hh.group(Object.assign({x:0,y:0},v.style)),this._appendDataToShape(x,Dw.item,t,x,v.state)),x.id=`${null!=s?s:a}-${i}`,x.addState(e?zw.selected:zw.unSelected);const _=hh.group({x:0,y:0,pickable:!1});x.add(_);let S,A=0,B=0,T=0;if(g&&!1!==g.visible){const i=pt(b,"style.size",10);B=it(i)?i[0]||0:i,T=pt(g,"space",8);const r=hh.symbol(Object.assign(Object.assign({x:0,y:0,symbolType:"circle",strokeBoundsBuffer:0},h),b.style));Object.keys(b.state||{}).forEach((t=>{const e=b.state[t].fill||b.state[t].stroke;h.fill&&X(b.state[t].fill)&&e&&(b.state[t].fill=e),h.stroke&&X(b.state[t].stroke)&&e&&(b.state[t].stroke=e)})),this._appendDataToShape(r,Dw.itemShape,t,x,b.state),r.addState(e?zw.selected:zw.unSelected),_.add(r)}let M=0;if(d){const e=pt(u,"size",10);S=hh.symbol(Object.assign(Object.assign({x:0,y:-e/2-1,strokeBoundsBuffer:0},u),{visible:!0,pickMode:"imprecise",boundsPadding:w})),this._appendDataToShape(S,Dw.focus,t,x),M=e}const R=hh.text(Object.assign(Object.assign({x:B/2+T,y:0,textAlign:"start",textBaseline:"middle",lineHeight:null===(o=y.style)||void 0===o?void 0:o.fontSize},y.style),{text:p.formatMethod?p.formatMethod(a,t,i):a}));this._appendDataToShape(R,Dw.itemLabel,t,x,y.state),R.addState(e?zw.selected:zw.unSelected),_.add(R);const P=pt(p,"space",8);if(Y(l)){const r=pt(f,"space",d?8:0),n=hh.text(Object.assign(Object.assign({x:0,y:0,textAlign:"start",textBaseline:"middle",lineHeight:C.style.fontSize},C.style),{text:f.formatMethod?f.formatMethod(l,t,i):l}));if(this._appendDataToShape(n,Dw.itemValue,t,x,C.state),n.addState(e?zw.selected:zw.unSelected),this._itemWidthByUser){const t=this._itemWidthByUser-w[1]-w[3]-B-T-P-M-r,e=n.AABBBounds,i=R.AABBBounds,o=e.width(),s=i.width();s>t?(t-o)/s>.4?R.setAttribute("maxLineWidth",t-o):(n.setAttribute("maxLineWidth",.5*t),R.setAttribute("maxLineWidth",.5*t)):n.setAttribute("maxLineWidth",t-s),f.alignRight?n.setAttributes({textAlign:"right",x:this._itemWidthByUser-B/2-w[1]-w[3]-M-r}):n.setAttribute("x",R.AABBBounds.x2+r)}else n.setAttribute("x",R.AABBBounds.x2+r);A=n.AABBBounds.x2+r,_.add(n)}else this._itemWidthByUser?(R.setAttribute("maxLineWidth",this._itemWidthByUser-w[1]-w[3]-B-T-M),A=R.AABBBounds.x2+P):A=R.AABBBounds.x2+P;S&&(S.setAttribute("x",A),_.add(S));const E=_.AABBBounds,H=E.width(),L=E.height(),k=Y(this.attribute.item.width)?this.attribute.item.width:H+w[1]+w[3],I=this._itemHeightByUser||L+w[0]+w[2];return x.attribute.width=k,x.attribute.height=I,S&&S.setAttribute("visible",!1),_.translateTo(-E.x1+w[3],-E.y1+w[0]),x}_renderPager(t){const e=this._title?this._title.AABBBounds.height()+pt(this.attribute,"title.space",8):0,{maxWidth:i,maxHeight:r,maxCol:n=1,maxRow:o=2,item:s={},pager:a={},disableTriggerEvent:l}=this.attribute,{spaceCol:h=kw,spaceRow:c=Iw}=s,d=this._itemsContainer,{animation:u=!0,animationDuration:g=450,animationEasing:p="quadIn",space:f=Fw,position:m="middle"}=a,b=jw(a,["animation","animationDuration","animationEasing","space","position"]);let y,C=0,v=0,w=0,x=0,_=1;if(t){if(y=new Lw(Object.assign(Object.assign({layout:1===o?"horizontal":"vertical",total:99},wt({handler:{preShape:"triangleUp",nextShape:"triangleDown"}},b)),{disableTriggerEvent:l})),this._pager=y,this._innerView.add(y),C=(o-1)*c+this._itemHeight*o,v=i-y.AABBBounds.width()-f,v<=0)return this._innerView.removeChild(y),!1;let t;d.getChildren().forEach(((t,e)=>{const{width:i,height:r}=t.attribute;v<w+i&&(w=0,x+=r+c,_+=1),e>0&&t.setAttributes({x:w,y:x}),w+=h+i})),y.setAttribute("total",Math.ceil(_/o)),t="start"===m?e:"end"===m?e+C-y.AABBBounds.height()/2:e+C/2-y.AABBBounds.height()/2,y.setAttributes({x:v,y:t})}else{if(y=new Lw(Object.assign({layout:"horizontal",total:99,disableTriggerEvent:l},b)),this._pager=y,this._innerView.add(y),v=this._itemMaxWidth*n+(n-1)*h,C=r-y.AABBBounds.height()-f-e,C<=0)return this._innerView.removeChild(y),!1;let t;d.getChildren().forEach(((t,e)=>{const{height:i}=t.attribute;C<x+i&&(x=0,w+=this._itemMaxWidth+h,_+=1),e>0&&t.setAttributes({x:w,y:x}),x+=c+i})),y.setAttribute("total",Math.ceil(_/n)),t="start"===m?0:"end"===m?v-y.AABBBounds.width():(v-y.AABBBounds.width())/2,y.setAttributes({x:t,y:r-y.AABBBounds.height()})}a.defaultCurrent>1&&(t?d.setAttribute("y",-(a.defaultCurrent-1)*(C+c)):d.setAttribute("x",-(a.defaultCurrent-1)*(v+h)));const S=hh.group({x:0,y:e,width:v,height:C,clip:!0,pickable:!1});S.add(d),this._innerView.add(S);const A=e=>{const{current:i}=e.detail;u?d.animate().to(t?{y:-(i-1)*(C+c)}:{x:-(i-1)*(v+h)},g,p):t?d.setAttribute("y",-(i-1)*(C+c)):d.setAttribute("x",-(i-1)*(v+h))};return this._pager.addEventListener("toPrev",A),this._pager.addEventListener("toNext",A),!0}_hover(t,e){this._lastActiveItem=t,t.hasState(zw.selected)?this._setLegendItemState(t,zw.selectedHover,e):this._setLegendItemState(t,zw.unSelectedHover,e);const i=t.getChildren()[0].find((t=>t.name===Dw.focus),!1);i&&i.setAttribute("visible",!0),this._dispatchLegendEvent(Ow.legendItemHover,t,e)}_unHover(t,e){let i=!1;(t.hasState(zw.unSelectedHover)||t.hasState(zw.selectedHover))&&(i=!0),t.removeState(zw.unSelectedHover),t.removeState(zw.selectedHover),t.getChildren()[0].getChildren().forEach((t=>{i||!t.hasState(zw.unSelectedHover)&&!t.hasState(zw.selectedHover)||(i=!0),t.removeState(zw.unSelectedHover),t.removeState(zw.selectedHover)}));const r=t.getChildren()[0].find((t=>t.name===Dw.focus),!1);r&&r.setAttribute("visible",!1),i&&this._dispatchLegendEvent(Ow.legendItemAttributeUpdate,t,e),this._dispatchLegendEvent(Ow.legendItemUnHover,t,e)}_setLegendItemState(t,e,i){let r=!1;t.hasState(e)||(r=!0),t.addState(e,!0),t.getChildren()[0].getChildren().forEach((t=>{t.name!==Dw.focus&&(r||t.hasState(e)||(r=!0),t.addState(e,!0))})),r&&this._dispatchLegendEvent(Ow.legendItemAttributeUpdate,t,i)}_removeLegendItemState(t,e,i){let r=!1;e.forEach((e=>{!r&&t.hasState(e)&&(r=!0),t.removeState(e)})),t.getChildren()[0].getChildren().forEach((t=>{t.name!==Dw.focus&&e.forEach((e=>{!r&&t.hasState(e)&&(r=!0),t.removeState(e)}))})),r&&this._dispatchLegendEvent(Ow.legendItemAttributeUpdate,t,i)}_getSelectedLegends(){var t;const e=[];return null===(t=this._itemsContainer)||void 0===t||t.getChildren().forEach((t=>{t.hasState(zw.selected)&&e.push(t.data)})),e}_appendDataToShape(t,e,i,r){let n=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{};t.name=e,t.data=i,t.delegate=r,t.states=wt({},Uw,n)}_dispatchLegendEvent(t,e,i){const r=this._getSelectedLegends();r.sort(((t,e)=>t.index-e.index));const n=r.map((t=>t.label));this._dispatchEvent(t,{item:e,data:e.data,selected:e.hasState(zw.selected),currentSelectedItems:r,currentSelected:n,event:i})}_handleStyle(t,e,i,r,n){const o={};return t.style&&($(t.style)?o.style=t.style(e,i,r,n):o.style=t.style),t.state&&(o.state={},Object.keys(t.state).forEach((s=>{t.state[s]&&($(t.state[s])?o.state[s]=t.state[s](e,i,r,n):o.state[s]=t.state[s])}))),o}}var Kw;function $w(t){switch(t){case Kw.Linear:case Kw.Log:case Kw.Pow:case Kw.Sqrt:case Kw.Symlog:case Kw.Time:return!0;default:return!1}}function Xw(t){return t}Vw.defaultAttributes={layout:"horizontal",title:{align:"start",space:12,textStyle:{fontSize:12,fontWeight:"bold",fill:"#2C3542"}},item:{spaceCol:kw,spaceRow:Iw,shape:{space:8,style:{size:10,cursor:"pointer"},state:{selectedHover:{opacity:.85},unSelected:{opacity:.5}}},label:{space:8,style:{fontSize:12,fill:"#2C3542",cursor:"pointer"},state:{selectedHover:{opacity:.85},unSelected:{fill:"#D8D8D8"}}},value:{alignRight:!1,style:{fontSize:12,fill:"#ccc",cursor:"pointer"},state:{selectedHover:{opacity:.85},unSelected:{fill:"#D8D8D8"}}},background:{style:{cursor:"pointer"}},focus:!1,focusIconStyle:{size:10,symbolType:"M8 1C11.866 1 15 4.13401 15 8C15 11.866 11.866 15 8 15C4.13401 15 1 11.866 1 8C1 4.13401 4.13401 1 8 1ZM8.75044 2.55077L8.75 3.75H7.25L7.25006 2.5507C4.81247 2.88304 2.88304 4.81247 2.5507 7.25006L3.75 7.25V8.75L2.55077 8.75044C2.8833 11.1878 4.81264 13.117 7.25006 13.4493L7.25 12.25H8.75L8.75044 13.4492C11.1876 13.1167 13.1167 11.1876 13.4492 8.75044L12.25 8.75V7.25L13.4493 7.25006C13.117 4.81264 11.1878 2.8833 8.75044 2.55077ZM8 5.5C9.38071 5.5 10.5 6.61929 10.5 8C10.5 9.38071 9.38071 10.5 8 10.5C6.61929 10.5 5.5 9.38071 5.5 8C5.5 6.61929 6.61929 5.5 8 5.5ZM8 7C7.44772 7 7 7.44772 7 8C7 8.55228 7.44772 9 8 9C8.55228 9 9 8.55228 9 8C9 7.44772 8.55228 7 8 7Z",fill:"#333",cursor:"pointer"}},autoPage:!0,pager:{space:Fw,handler:{style:{size:10},space:4}},hover:!0,select:!0,selectMode:"multiple",allowAllCanceled:!0},function(t){t.Identity="identity",t.Linear="linear",t.Log="log",t.Pow="pow",t.Sqrt="sqrt",t.Symlog="symlog",t.Time="time",t.Quantile="quantile",t.Quantize="quantize",t.Threshold="threshold",t.Ordinal="ordinal",t.Point="point",t.Band="band"}(Kw||(Kw={})),Object.values(Kw).forEach((t=>{}));const Yw=t=>-Math.log(-t),qw=t=>-Math.exp(-t),Zw=t=>isFinite(t)?Math.pow(10,t):t<0?0:t,Jw=t=>10===t?Zw:t===Math.E?Math.exp:e=>Math.pow(t,e),Qw=t=>t===Math.E?Math.log:10===t?Math.log10:2===t?Math.log2:(t=Math.log(t),e=>Math.log(e)/t),tx=t=>e=>Math.sign(e)*Math.log1p(Math.abs(e/t)),ex=t=>e=>Math.sign(e)*Math.expm1(Math.abs(e))*t;function ix(t,e){if(t=Number(t),e=Number(e),e-=t)return i=>(i-t)/e;const i=Number.isNaN(e)?NaN:.5;return()=>i}function rx(t,e,i){const r=t[0],n=t[1],o=e[0],s=e[1];let a,l;return n<r?(a=ix(n,r),l=i(s,o)):(a=ix(r,n),l=i(o,s)),t=>l(a(t))}function nx(t,e,i){let r;return r=1===t?t+2*i:t-e+2*i,t?r>0?r:1:0}function ox(t,e){const i=(t[1]-t[0])/(e[1]-e[0]),r=t[0]-i*e[0];return[r,i+r]}function sx(t,e,i){const r=Math.min(t.length,e.length)-1,n=new Array(r),o=new Array(r);let s=-1;for(t[r]<t[0]&&(t=t.slice().reverse(),e=e.slice().reverse());++s<r;)n[s]=ix(t[s],t[s+1]),o[s]=i(e[s],e[s+1]);return function(e){const i=function(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,r=arguments.length>3?arguments[3]:void 0;for(X(r)&&(r=t.length);i<r;){const n=i+r>>>1;Ht(t[n],e)>0?r=n:i=n+1}return i}(t,e,1,r)-1;return o[i](n[i](e))}}const ax=(t,e)=>{const i=t.slice();let r=0,n=i.length-1,o=i[r],s=i[n];return s<o&&([r,n]=[n,r],[o,s]=[s,o]),i[r]=e.floor(o),i[n]=e.ceil(s),i},lx=function(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];const i=Math.floor(Math.log10(t)),r=t/Math.pow(10,i);let n;return n=e?r<1.5?1:r<3?2:r<7?5:10:r<=1?1:r<=2?2:r<=5?5:10,n*Math.pow(10,i)};class hx{constructor(){this._rangeFactorStart=null,this._rangeFactorEnd=null}_calculateWholeRange(t){return this._wholeRange?this._wholeRange:Y(this._rangeFactorStart)&&Y(this._rangeFactorEnd)&&2===t.length?(this._wholeRange=ox(t,[this._rangeFactorStart,this._rangeFactorEnd]),this._wholeRange):t}rangeFactor(t,e,i){return t?(2===t.length&&t.every((t=>t>=0&&t<=1))&&(this._wholeRange=null,0===t[0]&&1===t[1]?(this._rangeFactorStart=null,this._rangeFactorEnd=null):(this._rangeFactorStart=t[0],this._rangeFactorEnd=t[1])),this):i?(this._wholeRange=null,this._rangeFactorStart=null,this._rangeFactorEnd=null,this):Y(this._rangeFactorStart)&&Y(this._rangeFactorEnd)?[this._rangeFactorStart,this._rangeFactorEnd]:null}rangeFactorStart(t,e){var i;return X(t)?this._rangeFactorStart:(t>=0&&t<=1&&(this._wholeRange=null,0!==t||!X(this._rangeFactorEnd)&&1!==this._rangeFactorEnd?(this._rangeFactorStart=t,this._rangeFactorEnd=null!==(i=this._rangeFactorEnd)&&void 0!==i?i:1):(this._rangeFactorStart=null,this._rangeFactorEnd=null)),this)}rangeFactorEnd(t,e){var i;return X(t)?this._rangeFactorEnd:(t>=0&&t<=1&&(this._wholeRange=null,0!==t||!X(this._rangeFactorStart)&&0!==this._rangeFactorStart?(this._rangeFactorEnd=t,this._rangeFactorStart=null!==(i=this._rangeFactorStart)&&void 0!==i?i:0):(this._rangeFactorStart=null,this._rangeFactorEnd=null)),this)}generateFishEyeTransform(){var t;if(!this._fishEyeOptions)return void(this._fishEyeTransform=null);const{distortion:e=2,radiusRatio:i=.1,radius:r}=this._fishEyeOptions,n=this.range(),o=n[0],s=n[n.length-1],a=Math.min(o,s),l=Math.max(o,s),h=Wt(null!==(t=this._fishEyeOptions.focus)&&void 0!==t?t:0,a,l),c=X(r)?(l-a)*i:r;let d=Math.exp(e);d=d/(d-1)*c;const u=e/c;this._fishEyeTransform=t=>{const e=Math.abs(t-h);if(e>=c)return t;if(e<=1e-6)return h;const i=d*(1-Math.exp(-e*u))/e*.75+.25;return h+(t-h)*i}}unknown(t){return arguments.length?(this._unknown=t,this):this._unknown}}const cx=Symbol("implicit");class dx extends hx{specified(t){var e;return t?(this._specified=Object.assign(null!==(e=this._specified)&&void 0!==e?e:{},t),this):Object.assign({},this._specified)}_getSpecifiedValue(t){if(this._specified)return this._specified[t]}constructor(){super(),this.type=Kw.Ordinal,this._index=new Map,this._domain=[],this._ordinalRange=[],this._unknown=cx}clone(){return(new dx).domain(this._domain).range(this._ordinalRange).unknown(this._unknown)}calculateVisibleDomain(t){return Y(this._rangeFactorStart)&&Y(this._rangeFactorEnd)&&2===t.length?[this.invert(t[0]),this.invert(t[1])]:this._domain}scale(t){const e=`${t}`,i=this._getSpecifiedValue(e);if(void 0!==i)return i;let r=this._index.get(e);if(!r){if(this._unknown!==cx)return this._unknown;r=this._domain.push(t),this._index.set(e,r)}const n=this._ordinalRange[(r-1)%this._ordinalRange.length];return this._fishEyeTransform?this._fishEyeTransform(n):n}invert(t){let e=0;for(;e<this._ordinalRange.length&&this._ordinalRange[e]!==t;)e++;return this._domain[(e-1)%this._domain.length]}domain(t){if(!t)return this._domain.slice();this._domain=[],this._index=new Map;for(const e of t){const t=`${e}`;this._index.has(t)||this._index.set(t,this._domain.push(e))}return this}range(t){if(!t)return this._ordinalRange.slice();const e=Array.from(t);return this._ordinalRange=e,this}}function ux(t,e,i,r){let n;const o=[];let s;if(e=Math.floor(+e),t=Math.floor(+t),!(i=Math.floor(+i)))return[];if(t===e)return[t];if(n=e<t){const i=t;t=e,e=i}let a=Gt(1,e-t+1)(i);if(s=Math.floor((e-t+1)/a),!r)for(;Math.ceil((e-t+1)/s)>i&&a>1;)a-=1,s=Math.floor((e-t)/a);let l=t;for(;l<=e;)o.push(l),l+=s;return n&&o.reverse(),o}class gx extends dx{constructor(t){super(),this.type=Kw.Band,this._range=[0,1],this._step=void 0,this._bandwidth=void 0,this._isFixed=!1,this._round=!1,this._paddingInner=0,this._paddingOuter=0,this._align=.5,this._unknown=void 0,delete this.unknown,this.rescale(t)}rescale(t,e){if(t)return this;this._wholeRange=null;const i=this._calculateWholeRange(this._range,e),r=super.domain().length,n=i[1]<i[0];let o=i[Number(n)-0];const s=i[1-Number(n)],a=nx(r,this._paddingInner,this._paddingOuter);return this._step=(s-o)/Math.max(1,a||1),this._round&&(this._step=Math.floor(this._step)),o+=(s-o-this._step*(r-this._paddingInner))*this._align,this.isBandwidthFixed()||(this._bandwidth=this._step*(1-this._paddingInner)),this._round&&(o=Math.round(o),this.isBandwidthFixed()||(this._bandwidth=Math.round(this._bandwidth))),this._bandRangeState={reverse:n,start:n?o+this._step*(r-1):o,count:r},this.generateFishEyeTransform(),this}scale(t){if(!this._bandRangeState)return;const e=`${t}`,i=this._getSpecifiedValue(e);if(void 0!==i)return i;let r=this._index.get(e);if(!r){if(this._unknown!==cx)return this._unknown;r=this._domain.push(t),this._index.set(e,r)}const{count:n,start:o,reverse:s}=this._bandRangeState,a=o+(r-1)%n*(s?-1:1)*this._step;return this._fishEyeTransform?this._fishEyeTransform(a):a}_calculateWholeRange(t,e){if(this._wholeRange)return this._wholeRange;if((this._minBandwidth||this._maxBandwidth)&&!this._isBandwidthFixedByUser()){let e;if(Y(this._rangeFactorStart)&&Y(this._rangeFactorEnd)&&2===t.length){const i=ox(t,[this._rangeFactorStart,this._rangeFactorEnd]);e=Math.abs(i[1]-i[0])}else e=Math.abs(t[1]-t[0]);const i=function(t,e,i,r,n){const o=nx(t,i,r);let s=e/Math.max(1,o||1);n&&(s=Math.floor(s));let a=s*(1-i);return n&&(a=Math.round(a)),a}(super.domain().length,e,this._paddingInner,this._paddingOuter,this._round);i<this._minBandwidth?(this._bandwidth=this._minBandwidth,this._isFixed=!0):i>this._maxBandwidth?(this._bandwidth=this._maxBandwidth,this._isFixed=!0):(this._bandwidth=i,this._isFixed=!1)}if(this.isBandwidthFixed()){const s=(i=super.domain().length,r=this._bandwidth,n=this._paddingInner,o=this._paddingOuter,1===n&&(n=0),nx(i,n,o)*(r/(1-n))*Math.sign(t[1]-t[0])),a=Math.min((t[1]-t[0])/s,1);if(Y(this._rangeFactorStart)&&Y(this._rangeFactorEnd)){if(s>0){const e=t[0]-s*this._rangeFactorStart,i=e+s;this._wholeRange=[e,i]}else{const e=t[1]+s*(1-this._rangeFactorEnd),i=e-s;this._wholeRange=[i,e]}const i=this._rangeFactorStart+a<=1,r=this._rangeFactorEnd-a>=0;"rangeFactorStart"===e&&i?this._rangeFactorEnd=this._rangeFactorStart+a:"rangeFactorEnd"===e&&r?this._rangeFactorStart=this._rangeFactorEnd-a:t[0]<=t[1]?i?this._rangeFactorEnd=this._rangeFactorStart+a:r?this._rangeFactorStart=this._rangeFactorEnd-a:(this._rangeFactorStart=0,this._rangeFactorEnd=a):r?this._rangeFactorStart=this._rangeFactorEnd-a:i?this._rangeFactorEnd=this._rangeFactorStart+a:(this._rangeFactorStart=1-a,this._rangeFactorEnd=1)}else this._rangeFactorStart=0,this._rangeFactorEnd=a,this._wholeRange=[t[0],t[0]+s];return this._wholeRange}var i,r,n,o;return super._calculateWholeRange(t)}calculateWholeRangeSize(){const t=this._calculateWholeRange(this._range);return Math.abs(t[1]-t[0])}calculateVisibleDomain(t){const e=this._domain;if(Y(this._rangeFactorStart)&&Y(this._rangeFactorEnd)&&e.length){const i=this._getInvertIndex(t[0]),r=this._getInvertIndex(t[1]);return e.slice(Math.min(i,r),Math.max(i,r)+1)}return e}domain(t,e){return t?(super.domain(t),this.rescale(e)):super.domain()}range(t,e){return t?(this._range=[Lt(t[0]),Lt(t[1])],this.rescale(e)):this._range}rangeRound(t,e){return this._range=[Lt(t[0]),Lt(t[1])],this._round=!0,this.rescale(e)}ticks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this.calculateVisibleDomain(this._range);return-1===t?e:ux(0,e.length-1,t,!1).map((t=>e[t]))}tickData(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;return this.ticks(t).map(((t,e)=>({index:e,tick:t,value:(this.scale(t)-this._range[0]+this._bandwidth/2)/(this._range[1]-this._range[0])})))}forceTicks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this.calculateVisibleDomain(this._range);return ux(0,e.length-1,t,!0).filter((t=>t<e.length)).map((t=>e[t]))}stepTicks(t){const e=this.calculateVisibleDomain(this._range);return function(t,e,i){const r=[];let n;if(i=Gt(1,(e=Math.floor(+e))-(t=Math.floor(+t))+1)(Math.floor(+i)),n=e<t){const i=t;t=e,e=i}let o=t;for(;o<=e;)r.push(o),o+=i;return n&&r.reverse(),r}(0,e.length-1,t).map((t=>e[t]))}_getInvertIndex(t){let e=0;const i=this.step()/2,r=this.bandwidth()/2,n=this._domain.length,o=this.range(),s=o[0]>o[o.length-1];for(e=0;e<n;e++){const o=this.scale(this._domain[e])+r;if(0===e&&(!s&&!zt(t,o+i)||s&&!Ot(t,o-i)))break;if(e===n-1)break;if(!Ot(t,o-i)&&!zt(t,o+i))break}return e>=0&&e<=n-1?e:n-1}invert(t){return this._domain[this._getInvertIndex(t)]}padding(t,e){return void 0!==t?(this._paddingOuter=Math.max(0,Math.min(Array.isArray(t)?Math.min.apply(null,t):t)),this._paddingInner=this._paddingOuter,this.rescale(e)):this._paddingInner}paddingInner(t,e){return void 0!==t?(this._paddingInner=Math.max(0,Math.min(1,t)),this.rescale(e)):this._paddingInner}paddingOuter(t,e){return void 0!==t?(this._paddingOuter=Math.max(0,Math.min(1,t)),this.rescale(e)):this._paddingOuter}step(){return this._step}round(t,e){return void 0!==t?(this._round=t,this.rescale(e)):this._round}align(t,e){return void 0!==t?(this._align=Math.max(0,Math.min(1,t)),this.rescale(e)):this._align}rangeFactor(t,e){return t?(super.rangeFactor(t),this.rescale(e)):super.rangeFactor()}rangeFactorStart(t,e){return X(t)?super.rangeFactorStart():(super.rangeFactorStart(t),this.rescale(e,"rangeFactorStart"))}rangeFactorEnd(t,e){return X(t)?super.rangeFactorEnd():(super.rangeFactorEnd(t),this.rescale(e,"rangeFactorEnd"))}bandwidth(t,e){return t?("auto"===t?(this._bandwidth=void 0,this._isFixed=!1):(this._bandwidth=t,this._isFixed=!0),this._userBandwidth=t,this.rescale(e)):this._bandwidth}maxBandwidth(t,e){return t?(this._maxBandwidth="auto"===t?void 0:t,this.rescale(e)):this._maxBandwidth}minBandwidth(t,e){return t?(this._minBandwidth="auto"===t?void 0:t,this.rescale(e)):this._minBandwidth}fishEye(t,e,i){return t||i?(this._fishEyeOptions=t,this._fishEyeTransform=null,this.rescale(e)):this._fishEyeOptions}isBandwidthFixed(){return this._isFixed&&!!this._bandwidth}_isBandwidthFixedByUser(){return this._isFixed&&this._userBandwidth&&ot(this._userBandwidth)}clone(){var t,e,i;return new gx(!0).domain(this._domain,!0).range(this._range,!0).round(this._round,!0).paddingInner(this._paddingInner,!0).paddingOuter(this._paddingOuter,!0).align(this._align,!0).bandwidth(null!==(t=this._userBandwidth)&&void 0!==t?t:"auto",!0).maxBandwidth(null!==(e=this._maxBandwidth)&&void 0!==e?e:"auto",!0).minBandwidth(null!==(i=this._maxBandwidth)&&void 0!==i?i:"auto")}}const{interpolateRgb:px}=Re;function fx(t,e){const i=typeof e;let r;if(X(e)||"boolean"===i)return()=>e;if("number"===i)return Vt(t,e);if("string"===i){if(r=Te.parseColorString(e)){const e=px(Te.parseColorString(t),r);return t=>e(t).formatRgb()}return Vt(Number(t),Number(e))}return e instanceof Me?px(t,e):e instanceof Te?px(t.color,e.color):e instanceof Date?function(t,e){const i=t.valueOf(),r=e.valueOf(),n=new Date;return t=>(n.setTime(i*(1-t)+r*t),n)}(t,e):Vt(Number(t),Number(e))}class mx extends hx{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Xw,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Xw;super(),this._unknown=void 0,this.transformer=t,this.untransformer=e,this._forceAlign=!0,this._domain=[0,1],this._range=[0,1],this._clamp=Xw,this._piecewise=rx,this._interpolate=fx}calculateVisibleDomain(t){var e;return Y(this._rangeFactorStart)&&Y(this._rangeFactorEnd)&&2===t.length?[this.invert(t[0]),this.invert(t[1])]:null!==(e=this._niceDomain)&&void 0!==e?e:this._domain}fishEye(t,e,i){return t||i?(this._fishEyeOptions=t,this._fishEyeTransform=null,this.rescale(e)):this._fishEyeOptions}scale(t){var e;if(t=Number(t),Number.isNaN(t)||this._domainValidator&&!this._domainValidator(t))return this._unknown;this._output||(this._output=this._piecewise((null!==(e=this._niceDomain)&&void 0!==e?e:this._domain).map(this.transformer),this._calculateWholeRange(this._range),this._interpolate));const i=this._output(this.transformer(this._clamp(t)));return this._fishEyeTransform?this._fishEyeTransform(i):i}invert(t){var e;return this._input||(this._input=this._piecewise(this._calculateWholeRange(this._range),(null!==(e=this._niceDomain)&&void 0!==e?e:this._domain).map(this.transformer),Vt)),this._clamp(this.untransformer(this._input(t)))}domain(t,e){var i;if(!t)return(null!==(i=this._niceDomain)&&void 0!==i?i:this._domain).slice();this._domainValidator=null,this._niceType=null,this._niceDomain=null;const r=Array.from(t,Lt);return this._domain=r,this.rescale(e)}range(t,e){if(!t)return this._range.slice();const i=Array.from(t);return this._range=i,this.rescale(e)}rangeRound(t,e){const i=Array.from(t);return this._range=i,this._interpolate=Kt,this.rescale(e)}rescale(t){var e;if(t)return this;const i=null!==(e=this._niceDomain)&&void 0!==e?e:this._domain,r=i.length,n=this._range.length;let o=Math.min(r,n);if(r&&r<n&&this._forceAlign){const t=n-r+1,e=i[r-1],s=r>=2?(e-i[r-2])/t:0;for(let n=1;n<=t;n++)i[r-2+n]=e-s*(t-n);o=n}return void 0===this._clamp&&(this._clamp=Gt(i[0],i[o-1])),this._piecewise=o>2?sx:rx,this._output=this._input=null,this._wholeRange=null,this.generateFishEyeTransform(),this}clamp(t,e,i){return arguments.length?(this._clamp=e||(t?void 0:Xw),this.rescale(i)):this._clamp!==Xw}interpolate(t,e){return arguments.length?(this._interpolate=t,this.rescale(e)):this._interpolate}ticks(){return[]}tickData(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this.ticks(t);return(null!=e?e:[]).map(((t,e)=>({index:e,tick:t,value:(this.scale(t)-this._range[0])/(this._range[1]-this._range[0])})))}rangeFactor(t,e){return t?(super.rangeFactor(t),this._output=this._input=null,this):super.rangeFactor()}rangeFactorStart(t,e){return X(t)?super.rangeFactorStart():(super.rangeFactorStart(t),this._output=this._input=null,this)}rangeFactorEnd(t,e){return X(t)?super.rangeFactorEnd():(super.rangeFactorEnd(t),this._output=this._input=null,this)}forceAlignDomainRange(t){return arguments.length?(this._forceAlign=t,this):this._forceAlign}}const bx=Math.sqrt(50),yx=Math.sqrt(10),Cx=Math.sqrt(2),vx=[1,2,5,10],wx=(t,e,i)=>{let r=1,n=t;const o=Math.floor((e-1)/2),s=Math.abs(t);return t>=0&&t<=Number.MIN_VALUE?n=0:t<0&&t>=-Number.MIN_VALUE?n=-(e-1):!i&&s<1?r=Ax(s).step:(i||s>1)&&(n=Math.floor(t)-o*r),r>0?(t>0?n=Math.max(n,0):t<0&&(n=Math.min(n,-(e-1)*r)),function(t,e,i){Y(e)||(e=t,t=0),Y(i)||(i=1);let r=-1;const n=0|Math.max(0,Math.ceil((e-t)/i)),o=new Array(n);for(;++r<n;)o[r]=t+r*i;return o}(0,e).map((t=>n+t*r))):t>0?_x(0,-(e-1)/r,r):_x((e-1)/r,0,r)},xx=Dt(((t,e,i,r)=>{let n,o,s,a,l=-1;if(i=+i,(t=+t)==(e=+e))return[t];if(Math.abs(t-e)<=Number.MIN_VALUE&&i>0)return[t];if((n=e<t)&&(o=t,t=e,e=o),a=Bx(t,e,i).step,!isFinite(a))return[];if(a>0){let i=Math.round(t/a),r=Math.round(e/a);for(i*a<t&&++i,r*a>e&&--r,s=new Array(o=r-i+1);++l<o;)s[l]=(i+l)*a}else if(a<0&&(null==r?void 0:r.noDecimals)){a=1;const i=Math.ceil(t),r=Math.floor(e);if(!(i<=r))return[];for(s=new Array(o=r-i+1);++l<o;)s[l]=i+l}else{a=-a;let i=Math.round(t*a),r=Math.round(e*a);for(i/a<t&&++i,r/a>e&&--r,s=new Array(o=r-i+1);++l<o;)s[l]=(i+l)/a}return n&&s.reverse(),s})),_x=(t,e,i)=>{let r,n,o=-1;if(i>0){let s=Math.floor(t/i),a=Math.ceil(e/i);for((s+1)*i<t&&++s,(a-1)*i>e&&--a,n=new Array(r=a-s+1);++o<r;)n[o]=(s+o)*i}else{i=-i;let s=Math.floor(t*i),a=Math.ceil(e*i);for((s+1)/i<t&&++s,(a-1)/i>e&&--a,n=new Array(r=a-s+1);++o<r;)n[o]=(s+o)/i}return n},Sx=Dt(((t,e,i,r)=>{let n,o,s;if(i=+i,(t=+t)==(e=+e))return wx(t,i,null==r?void 0:r.noDecimals);if(Math.abs(t-e)<=Number.MIN_VALUE&&i>0)return wx(t,i,null==r?void 0:r.noDecimals);(n=e<t)&&(s=t,t=e,e=s);const a=Bx(t,e,i);let l=a.step;if(!isFinite(l))return[];if(l>0){let r=1;const{power:n,gap:s}=a,h=10===s?2*10**n:1*10**n;for(;r<=5&&(o=_x(t,e,l),o.length>i+1)&&i>2;)l+=h,r+=1;i>2&&o.length<i-1&&(o=((t,e,i)=>{let r;const n=t[0],o=t[t.length-1],s=e-t.length;if(o<=0){const e=[];for(r=s;r>=1;r--)e.push(n-r*i);return e.concat(t)}if(n>=0){for(r=1;r<=s;r++)t.push(o+r*i);return t}let a=[];const l=[];for(r=1;r<=s;r++)r%2==0?a=[n-Math.floor(r/2)*i].concat(a):l.push(o+Math.ceil(r/2)*i);return a.concat(t).concat(l)})(o,i,l))}else(null==r?void 0:r.noDecimals)&&l<0&&(l=1),o=_x(t,e,l);return n&&o.reverse(),o})),Ax=t=>{const e=Math.floor(Math.log(t)/Math.LN10),i=t/10**e;let r=vx[0];return i>=bx?r=vx[3]:i>=yx?r=vx[2]:i>=Cx&&(r=vx[1]),e>=0?{step:r*10**e,gap:r,power:e}:{step:-(10**-e)/r,gap:r,power:e}};function Bx(t,e,i){const r=(e-t)/Math.max(0,i);return Ax(r)}function Tx(t,e,i){let r;if(i=+i,(t=+t)==(e=+e)&&i>0)return[t];if(i<=0||0===(r=function(t,e,i){return(e-t)/Math.max(1,i-1)}(t,e,i))||!isFinite(r))return[];const n=new Array(i);for(let e=0;e<i;e++)n[e]=t+e*r;return n}function Mx(t){let e,i,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:10,n=0,o=t.length-1,s=t[n],a=t[o],l=10;for(a<s&&(i=s,s=a,a=i,i=n,n=o,o=i);l-- >0;){if(i=Bx(s,a,r).step,i===e)return t[n]=s,t[o]=a,t;if(i>0)s=Math.floor(s/i)*i,a=Math.ceil(a/i)*i;else{if(!(i<0))break;s=Math.ceil(s*i)/i,a=Math.floor(a*i)/i}e=i}}function Rx(t,e){const i=ot(e.forceMin),r=ot(e.forceMax);let n=null;const o=[];let s=null;const a=i&&r?t=>t>=e.forceMin&&t<=e.forceMax:i?t=>t>=e.forceMin:r?t=>t<=e.forceMax:null;return i?o[0]=e.forceMin:ot(e.min)&&e.min<=Math.min(t[0],t[t.length-1])&&(o[0]=e.min),r?o[1]=e.forceMax:ot(e.max)&&e.max>=Math.max(t[0],t[t.length-1])&&(o[1]=e.max),ot(o[0])&&ot(o[1])?(s=t.slice(),s[0]=o[0],s[s.length-1]=o[1]):n=ot(o[0])||ot(o[1])?ot(o[0])?"max":"min":"all",{niceType:n,niceDomain:s,niceMinMax:o,domainValidator:a}}const Px=(t,e,i)=>Math.abs(e-t)<1?+i.toFixed(1):Math.round(+i),Ex=Dt(((t,e,i,r,n,o)=>{const s=[],a={},l=n(t),h=n(e);let c=[];if(Number.isInteger(r))c=Sx(l,h,i);else{const t=(h-l)/(i-1);for(let e=0;e<i;e++)c.push(l+e*t)}return c.forEach((i=>{const n=o(i),l=Number.isInteger(r)?Px(t,e,n):Px(t,e,lx(n)),h=Px(t,e,((t,e)=>{let i,r;return e[0]<e[1]?(i=e[0],r=e[1]):(i=e[1],r=e[0]),Math.min(Math.max(t,i),r)})(l,[t,e]));!a[h]&&!isNaN(h)&&c.length>1&&(a[h]=1,s.push(h))})),s})),Hx=Dt(((t,e,i,r,n)=>Tx(r(t),r(e),i).map((t=>lx(n(t))))));class Lx extends mx{constructor(){super(...arguments),this.type=Kw.Linear}clone(){return(new Lx).domain(this._domain,!0).range(this._range,!0).unknown(this._unknown).clamp(this.clamp(),null,!0).interpolate(this._interpolate)}tickFormat(){return()=>{}}d3Ticks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10,e=arguments.length>1?arguments[1]:void 0;const i=this.calculateVisibleDomain(this._range);return xx(i[0],i[i.length-1],t,e)}ticks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10,e=arguments.length>1?arguments[1]:void 0;var i;if(Y(this._rangeFactorStart)&&Y(this._rangeFactorEnd)&&(this._rangeFactorStart>0||this._rangeFactorEnd<1)&&2===this._range.length||!this._niceType)return this.d3Ticks(t,e);const r=null!==(i=this._niceDomain)&&void 0!==i?i:this._domain,n=this._domain,o=r[0],s=r[r.length-1];let a=Sx(n[0],n[n.length-1],t,e);if(!a.length)return a;if(this._domainValidator)a=a.filter(this._domainValidator);else if((a[0]!==o||a[a.length-1]!==s)&&this._niceType){const t=r.slice();if("all"===this._niceType?(t[0]=a[0],t[t.length-1]=a[a.length-1],this._niceDomain=t,this.rescale()):"min"===this._niceType&&a[0]!==o?(t[0]=a[0],this._niceDomain=t,this.rescale()):"max"===this._niceType&&a[a.length-1]!==s&&(t[t.length-1]=a[a.length-1],this._niceDomain=t,this.rescale()),"all"!==this._niceType){const e=Math.min(t[0],t[t.length-1]),i=Math.max(t[0],t[t.length-1]);a=a.filter((t=>t>=e&&t<=i))}}return a}forceTicks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this.calculateVisibleDomain(this._range);return Tx(e[0],e[e.length-1],t)}stepTicks(t){const e=this.calculateVisibleDomain(this._range);return function(t,e,i){let r,n,o=-1;if(i=+i,(n=(e=+e)<(t=+t))&&(r=t,t=e,e=r),!isFinite(i)||e-t<=i)return[t];const s=Math.floor((e-t)/i+1),a=new Array(s);for(;++o<s;)a[o]=t+o*i;return n&&a.reverse(),a}(e[0],e[e.length-1],t)}nice(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10,e=arguments.length>1?arguments[1]:void 0;var i,r;const n=this._domain;let o=[];if(e){const t=Rx(n,e);if(o=t.niceMinMax,this._domainValidator=t.domainValidator,this._niceType=t.niceType,t.niceDomain)return this._niceDomain=t.niceDomain,this.rescale(),this}else this._niceType="all";if(this._niceType){const e=Mx(n.slice(),t);"min"===this._niceType?e[e.length-1]=null!==(i=o[1])&&void 0!==i?i:e[e.length-1]:"max"===this._niceType&&(e[0]=null!==(r=o[0])&&void 0!==r?r:e[0]),this._niceDomain=e,this.rescale()}return this}niceMin(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;this._niceType="min";const e=this._domain[this._domain.length-1],i=Mx(this.domain(),t);return i&&(i[i.length-1]=e,this._niceDomain=i,this.rescale()),this}niceMax(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;this._niceType="max";const e=this._domain[0],i=Mx(this._domain.slice(),t);return i&&(i[0]=e,this._niceDomain=i,this.rescale()),this}}function kx(t){return e=>-t(-e)}function Ix(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Number.EPSILON;return e=>Math.max(e,t)}class Fx extends mx{constructor(){super(Qw(10),Jw(10)),this.type=Kw.Log,this._limit=Ix(),this._logs=this.transformer,this._pows=this.untransformer,this._domain=[1,10],this._base=10}clone(){return(new Fx).domain(this._domain,!0).range(this._range,!0).unknown(this._unknown).clamp(this.clamp(),null,!0).interpolate(this._interpolate,!0).base(this._base)}rescale(t){var e;if(t)return this;super.rescale();const i=Qw(this._base),r=Jw(this._base);return(null!==(e=this._niceDomain)&&void 0!==e?e:this._domain)[0]<0?(this._logs=kx(i),this._pows=kx(r),this._limit=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Number.EPSILON;return e=>Math.min(e,-t)}(),this.transformer=Yw,this.untransformer=qw):(this._logs=i,this._pows=r,this._limit=Ix(),this.transformer=this._logs,this.untransformer=r),this}scale(t){var e;if(t=Number(t),Number.isNaN(t)||this._domainValidator&&!this._domainValidator(t))return this._unknown;this._output||(this._output=this._piecewise((null!==(e=this._niceDomain)&&void 0!==e?e:this._domain).map(this._limit).map(this.transformer),this._calculateWholeRange(this._range),this._interpolate));const i=this._output(this.transformer(this._limit(this._clamp(t))));return this._fishEyeTransform?this._fishEyeTransform(i):i}base(t,e){return arguments.length?(this._base=t,this.rescale(e)):this._base}tickFormat(){return Xw}d3Ticks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this.domain();let i=this._limit(e[0]),r=this._limit(e[e.length-1]);const n=r<i;n&&([i,r]=[r,i]);let o,s,a=this._logs(i),l=this._logs(r),h=[];if(!(this._base%1)&&l-a<t){if(a=Math.floor(a),l=Math.ceil(l),i>0){for(;a<=l;++a)for(o=1;o<this._base;++o)if(s=a<0?o/this._pows(-a):o*this._pows(a),!(s<i)){if(s>r)break;h.push(s)}}else for(;a<=l;++a)for(o=this._base-1;o>=1;--o)if(s=a>0?o/this._pows(-a):o*this._pows(a),!(s<i)){if(s>r)break;h.push(s)}2*h.length<t&&(h=Sx(i,r,t))}else h=Sx(a,l,Math.min(l-a,t)).map(this._pows);return h=h.filter((t=>0!==t)),n?h.reverse():h}ticks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this.calculateVisibleDomain(this._range);return Ex(this._limit(e[0]),this._limit(e[e.length-1]),t,this._base,this.transformer,this.untransformer)}forceTicks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this.calculateVisibleDomain(this._range);return Hx(e[0],e[e.length-1],t,this.transformer,this.untransformer)}stepTicks(t){const e=this.calculateVisibleDomain(this._range);return Hx(this._limit(e[0]),this._limit(e[e.length-1]),t,this.transformer,this.untransformer)}nice(){let t=arguments.length>1?arguments[1]:void 0;var e,i;const r=this._domain;let n=[],o=null;if(t){const e=Rx(r,t);if(n=e.niceMinMax,this._domainValidator=e.domainValidator,o=e.niceType,e.niceDomain)return this._niceDomain=e.niceDomain,this.rescale(),this}else o="all";if(o){const t=ax(r.slice(),{floor:t=>this._pows(Math.floor(this._logs(this._limit(t)))),ceil:t=>Math.abs(t)>=1?Math.ceil(t):this._pows(Math.ceil(this._logs(this._limit(t))))});return"min"===o?t[t.length-1]=null!==(e=n[1])&&void 0!==e?e:t[t.length-1]:"max"===o&&(t[0]=null!==(i=n[0])&&void 0!==i?i:t[0]),this._niceDomain=t,this.rescale(),this}return this}niceMin(){const t=this._domain[this._domain.length-1];this.nice();const e=this._domain.slice();return this._domain&&(e[e.length-1]=t,this._niceDomain=e,this.rescale()),this}niceMax(){const t=this._domain[0];this.nice();const e=this._domain.slice();return this._domain&&(e[0]=t,this._niceDomain=e,this.rescale()),this}}class zx extends Lx{constructor(){super(tx(1),ex(1)),this.type=Kw.Symlog,this._const=1}clone(){return(new zx).domain(this._domain,!0).range(this._range,!0).unknown(this._unknown).clamp(this.clamp(),null,!0).interpolate(this._interpolate,!0).constant(this._const)}constant(t,e){return arguments.length?(this._const=t,this.transformer=tx(t),this.untransformer=ex(t),this.rescale(e)):this._const}ticks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this.calculateVisibleDomain(this._range);return Ex(e[0],e[e.length-1],t,this._const,this.transformer,this.untransformer)}forceTicks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this.calculateVisibleDomain(this._range);return Hx(e[0],e[e.length-1],t,this.transformer,this.untransformer)}stepTicks(t){const e=this.calculateVisibleDomain(this._range);return Hx(e[0],e[e.length-1],t,this.transformer,this.untransformer)}nice(){let t=arguments.length>1?arguments[1]:void 0;var e,i;const r=this._domain;let n=[],o=null;if(t){const e=Rx(r,t);if(n=e.niceMinMax,this._domainValidator=e.domainValidator,o=e.niceType,e.niceDomain)return this._niceDomain=e.niceDomain,this.rescale(),this}else o="all";if(o){const t=ax(r.slice(),{floor:t=>Math.floor(t),ceil:t=>Math.ceil(t)});return"min"===o?t[t.length-1]=null!==(e=n[1])&&void 0!==e?e:t[t.length-1]:"max"===o&&(t[0]=null!==(i=n[0])&&void 0!==i?i:t[0]),this._niceDomain=t,this.rescale(),this}return this}niceMin(){const t=this._domain[this._domain.length-1];this.nice();const e=this._domain.slice();return this._domain&&(e[e.length-1]=t,this._niceDomain=e,this.rescale()),this}niceMax(){const t=this._domain[0];this.nice();const e=this._domain.slice();return this._domain&&(e[0]=t,this._niceDomain=e,this.rescale()),this}}var Ox;function Dx(t){return it(t)?t:[t,t]}function Wx(t){return t?"ew-resize":"ns-resize"}!function(t){t.innerView="innerView",t.railContainer="sliderRailContainer",t.rail="sliderRail",t.startText="sliderStartText",t.endText="sliderEndText",t.startHandler="sliderStartHandler",t.startHandlerText="startHandlerText",t.endHandler="sliderEndHandler",t.endHandlerText="sliderEndHandlerText",t.track="sliderTrack",t.trackContainer="sliderTrackContainer"}(Ox||(Ox={})),Nw();class Nx extends jv{get track(){return this._track}get currentValue(){return this._currentValue}get startHandler(){return this._startHandler}get endHandler(){return this._endHandler}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:wt({},Nx.defaultAttributes,t)),this.name="slider",this._isHorizontal=!0,this._startHandler=null,this._endHandler=null,this._startHandlerText=null,this._endHandlerText=null,this._currentHandler=null,this._currentValue={},this._onHandlerPointerdown=t=>{t.stopPropagation(),this._currentHandler=t.target,this._prePos=this._isHorizontal?t.clientX:t.clientY,"browser"===_u.env?(_u.addEventListener("pointermove",this._onHandlerPointerMove,{capture:!0}),_u.addEventListener("pointerup",this._onHandlerPointerUp)):(this.stage.addEventListener("pointermove",this._onHandlerPointerMove,{capture:!0}),this.stage.addEventListener("pointerup",this._onHandlerPointerUp),this.stage.addEventListener("pointerupoutside",this._onHandlerPointerUp))},this._onHandlerPointerMove=t=>{var e,i;t.stopPropagation();const{railWidth:r,railHeight:n,min:o,max:s}=this.attribute;if(s===o)return;let a,l,h,c=0;this._isHorizontal?(a=t.clientX,c=a-this._prePos,l=null===(i=this._currentHandler)||void 0===i?void 0:i.attribute.x,h=r):(a=t.clientY,c=a-this._prePos,l=null===(e=this._currentHandler)||void 0===e?void 0:e.attribute.y,h=n);const d=Wt(l+c,0,h),u=d/h*(s-o)+o;"text"===this._currentHandler.type?this._updateHandlerText(this._currentHandler,d,u):this._updateHandler(this._currentHandler,d,u),this._updateTrack(),this._prePos=a,this._dispatchChangeEvent()},this._onHandlerPointerUp=t=>{t.preventDefault(),this._currentHandler=null,"browser"===_u.env?(_u.removeEventListener("pointermove",this._onHandlerPointerMove,{capture:!0}),_u.removeEventListener("pointerup",this._onHandlerPointerUp)):(this.stage.removeEventListener("pointermove",this._onHandlerPointerMove,{capture:!0}),this.stage.removeEventListener("pointerup",this._onHandlerPointerUp),this.stage.removeEventListener("pointerupoutside",this._onHandlerPointerUp))},this._onTrackPointerdown=t=>{t.stopPropagation(),this._prePos=this._isHorizontal?t.clientX:t.clientY,"browser"===_u.env?(_u.addEventListener("pointermove",this._onTrackPointerMove,{capture:!0}),_u.addEventListener("pointerup",this._onTrackPointerUp)):(this.stage.addEventListener("pointermove",this._onTrackPointerMove,{capture:!0}),this.stage.addEventListener("pointerup",this._onTrackPointerUp),this.stage.addEventListener("pointerupoutside",this._onTrackPointerUp))},this._onTrackPointerMove=t=>{t.stopPropagation();const{railWidth:e,railHeight:i,min:r,max:n}=this.attribute;if(n===r)return;const{startHandler:o,endHandler:s}=this._getHandlers();let a,l,h;this._isHorizontal?(a=t.clientX,l=this._track.attribute.width,h=e):(a=t.clientY,l=this._track.attribute.height,h=i);const c=a-this._prePos;if(o){const t=this._isHorizontal?o.attribute.x:o.attribute.y,e=Wt(t+c,0,h-l),i=e/h*(n-r)+r;this._updateHandler(o,e,i)}if(s){const t=this._isHorizontal?s.attribute.x:s.attribute.y,e=Wt(t+c,l,h),i=e/h*(n-r)+r,a=null==o?void 0:o.attribute;this._updateHandler(s,e,i),this._track.setAttributes(this._isHorizontal?{x:Math.min(a.x,s.attribute.x),width:Math.abs(a.x-s.attribute.x)}:{y:Math.min(a.y,s.attribute.y),height:Math.abs(a.y-s.attribute.y)})}this._prePos=a,this._dispatchChangeEvent()},this._onTrackPointerUp=t=>{t.preventDefault(),"browser"===_u.env?(_u.removeEventListener("pointermove",this._onTrackPointerMove,{capture:!0}),_u.removeEventListener("pointerup",this._onTrackPointerUp)):(this.stage.removeEventListener("pointermove",this._onTrackPointerMove,{capture:!0}),this.stage.removeEventListener("pointerup",this._onTrackPointerUp),this.stage.removeEventListener("pointerupoutside",this._onTrackPointerUp))},this._onRailPointerDown=t=>{t.stopPropagation();const{railWidth:e,railHeight:i,min:r,max:n}=this.attribute;if(n===r)return;const o=this._startHandler,s=this._endHandler;let a,l,h,c;this._isHorizontal?(a=t.viewX-this._rail.globalAABBBounds.x1,l=null==o?void 0:o.attribute.x,h=null==s?void 0:s.attribute.x,c=e):(a=t.viewY-this._rail.globalAABBBounds.y1,l=null==o?void 0:o.attribute.y,h=null==s?void 0:s.attribute.y,c=i);const d=a/c*(n-r)+r;if(Y(h)){const t=Math.abs(a-l)>Math.abs(a-h)?s:o;this._updateHandler(t,a,d)}else this._updateHandler(o,a,d);this._updateTrack(),this._dispatchChangeEvent()}}setValue(t){const{layout:e,railWidth:i,railHeight:r,min:n,max:o}=this.attribute;if(o===n)return;const[s,a]=Bt(t),{startHandler:l,endHandler:h}=this._getHandlers(),c="vertical"===e?r:i,d=(s-n)/(o-n)*c;if(l&&this._updateHandler(l,d,s),h){const t=(a-n)/(o-n)*c;this._updateHandler(h,t,a)}this._updateTrack()}render(){var t,e;this.removeAllChild();const{layout:i="horizontal",railWidth:r,railHeight:n,startText:o,endText:s,min:a,max:l,showHandler:h=!0}=this.attribute;let{value:c}=this.attribute;X(c)&&(c=[a,l]),this._currentValue={startValue:Dx(c)[0],endValue:Dx(c)[1]};const d="horizontal"===i;this._isHorizontal=d;const u=hh.group({x:0,y:0});u.name=Ox.innerView,this.add(u),this._innerView=u;let g,p=0;if(o&&o.visible){g=hh.text(Object.assign({x:d?0:r/2,y:d?n/2:0,textAlign:d?"start":"center",textBaseline:d?"middle":"top",text:o.text,lineHeight:null===(t=o.style)||void 0===t?void 0:t.fontSize},o.style)),g.name=Ox.startText,u.add(g);const e=Y(o.space)?o.space:0;p+=(d?g.AABBBounds.width():g.AABBBounds.height())+e}const f=hh.group({x:d?p:0,y:d?0:p});u.add(f);const m=hh.group({x:0,y:0});let b;if(m.name=Ox.railContainer,this._railContainer=m,f.add(m),this._renderRail(m),p+=d?r:n,s&&s.visible){const t=Y(s.space)?s.space:0;b=hh.text(Object.assign({x:d?p+t:r/2,y:d?n/2:p+t,textAlign:d?"start":"center",textBaseline:d?"middle":"top",text:s.text,lineHeight:null===(e=s.style)||void 0===e?void 0:e.fontSize},s.style)),b.name=Ox.endText,u.add(b)}this._renderTrack(m),h&&(this._renderHandlers(f),this._bindEvents())}_renderRail(t){const{railWidth:e,railHeight:i,railStyle:r,slidable:n}=this.attribute;let o="default";!1!==n&&(o="pointer");const s=hh.rect(Object.assign({x:0,y:0,width:e,height:i,cursor:o},r));return s.name=Ox.rail,t.add(s),this._rail=s,s}_renderHandlers(t){const{range:e,min:i,max:r,handlerSize:n=14,handlerStyle:o,handlerText:s,railHeight:a,railWidth:l,slidable:h}=this.attribute;let{value:c}=this.attribute;X(c)&&(c=[i,r]);const d=s&&s.visible,u=this._isHorizontal,g=u?l:a,[p,f]=Dx(c),m=r===i?e?0:g:(p-i)/(r-i)*g,b=this._renderHandler(Object.assign({x:u?m:l/2,y:u?a/2:m,size:n,strokeBoundsBuffer:0,cursor:!1===h?"default":Wx(u)},o));if(b.name=Ox.startHandler,this._startHandler=b,t.add(b),this._currentValue.startPos=m,d){const i=this._renderHandlerText(p,e?"start":"end");i.name=Ox.startHandlerText,t.add(i),this._startHandlerText=i}if(e){const e=r===i?g:(f-i)/(r-i)*g,s=this._renderHandler(Object.assign({x:u?e:l/2,y:u?a/2:e,size:n,strokeBoundsBuffer:0,cursor:!1===h?"default":Wx(u)},o));if(s.name=Ox.endHandler,this._endHandler=s,t.add(s),this._currentValue.endPos=e,d){const e=this._renderHandlerText(f,"end");e.name=Ox.endHandlerText,t.add(e),this._endHandlerText=e}}}_renderTrack(t){const{range:e,min:i,max:r,railHeight:n,railWidth:o,trackStyle:s,railStyle:a,slidable:l,value:h}=this.attribute;let c,d;if(X(h))e?(c=i,d=r):c=d=i;else if(e){const t=Nt(h,i,r);c=t[0],d=t[1]}else c=i,d=Wt(h,i,r);const u=this._isHorizontal,g=u?o:n;e||(c=i);const p=hh.group({x:0,y:0,width:o,height:n,cornerRadius:null==a?void 0:a.cornerRadius,clip:!0,pickable:!1});p.name=Ox.trackContainer;const f=q(e)&&!0===e.draggableTrack;let m;m=!1===l?"default":!1===e||!1===f?"pointer":Wx(u);const b=r===i?g:(d-c)/(r-i)*g,y=r===i?0:(c-i)/(r-i)*g,C=hh.rect(Object.assign({x:u?y:0,y:u?0:y,width:u?b:o,height:u?n:b,cursor:m},s));C.name=Ox.track,this._track=C,p.add(C),t.add(p)}_renderHandler(t){return hh.symbol(t)}_renderHandlerText(t,e){var i,r,n;const{align:o,min:s,max:a,handlerSize:l=14,handlerText:h={},railHeight:c,railWidth:d,slidable:u}=this.attribute,g=this._isHorizontal,p=g?d:c,f=a===s?"start"===e?0:p:(t-s)/(a-s)*p,m=null!==(i=h.space)&&void 0!==i?i:4,b={text:h.formatter?h.formatter(t):t.toFixed(null!==(r=h.precision)&&void 0!==r?r:0),lineHeight:null===(n=h.style)||void 0===n?void 0:n.lineHeight,cursor:!1===u?"default":Wx(g)};return g?"top"===o?(b.textBaseline="bottom",b.textAlign="center",b.x=f,b.y=(c-l)/2-m):(b.textBaseline="top",b.textAlign="center",b.x=f,b.y=(c+l)/2+m):"left"===o?(b.textBaseline="middle",b.textAlign="end",b.x=(d-l)/2-m,b.y=f):(b.textBaseline="middle",b.textAlign="start",b.x=(d+l)/2+m,b.y=f),hh.text(Object.assign(Object.assign({},b),h.style))}_bindEvents(){if(this.attribute.disableTriggerEvent)return;const{slidable:t,range:e}=this.attribute;t&&(this._startHandler&&this._startHandler.addEventListener("pointerdown",this._onHandlerPointerdown),this._startHandlerText&&this._startHandlerText.addEventListener("pointerdown",this._onHandlerPointerdown),this._endHandler&&this._endHandler.addEventListener("pointerdown",this._onHandlerPointerdown),this._endHandlerText&&this._endHandlerText.addEventListener("pointerdown",this._onHandlerPointerdown),q(e)&&e.draggableTrack&&this._track.addEventListener("pointerdown",this._onTrackPointerdown),this._railContainer.addEventListener("pointerdown",this._onRailPointerDown))}_updateTrack(){const t=this._startHandler,e=this._endHandler;if(this._isHorizontal){const i=null==t?void 0:t.attribute.x;if(e){const t=null==e?void 0:e.attribute.x;this._track.setAttributes({x:Math.min(i,t),width:Math.abs(i-t)})}else this._track.setAttributes({width:i})}else{const i=null==t?void 0:t.attribute.y;if(e){const t=null==e?void 0:e.attribute.y;this._track.setAttributes({y:Math.min(i,t),height:Math.abs(i-t)})}else this._track.setAttributes({height:i})}}_updateHandler(t,e,i){var r;const n=this._isHorizontal;t.setAttribute(n?"x":"y",e);const o=t.name===Ox.startHandler?this._startHandlerText:this._endHandlerText;if(o){const{handlerText:t={}}=this.attribute;o.setAttributes({text:t.formatter?t.formatter(i):i.toFixed(null!==(r=t.precision)&&void 0!==r?r:0),[n?"x":"y"]:e})}t.name===Ox.startHandler?(this._currentValue.startValue=i,this._currentValue.startPos=e):(this._currentValue.endValue=i,this._currentValue.endPos=e)}_updateHandlerText(t,e,i){var r;const n=this._isHorizontal,{handlerText:o={}}=this.attribute;t.setAttributes({[n?"x":"y"]:e,text:o.formatter?o.formatter(i):i.toFixed(null!==(r=o.precision)&&void 0!==r?r:0)});const s=t.name===Ox.startHandlerText?this._startHandler:this._endHandler;s&&s.setAttributes({[n?"x":"y"]:e}),t.name===Ox.startHandlerText?(this._currentValue.startValue=i,this._currentValue.startPos=e):(this._currentValue.endValue=i,this._currentValue.endPos=e)}_dispatchChangeEvent(){const t=!!this.attribute.range,e=this._currentValue;this._dispatchEvent("change",{value:t?[Math.min(e.endValue,e.startValue),Math.max(e.endValue,e.startValue)]:e.startValue,position:t?[Math.min(e.endPos,e.startPos),Math.max(e.endPos,e.startPos)]:e.startPos})}_getHandlers(){let t,e=this._startHandler,i=this._endHandler;return this._isHorizontal?i&&i.attribute.x<(null==e?void 0:e.attribute.x)&&(t=e,e=i,i=t):i&&i.attribute.y<(null==e?void 0:e.attribute.y)&&(t=e,e=i,i=t),{startHandler:e,endHandler:i}}}Nx.defaultAttributes={slidable:!0,layout:"horizontal",align:"bottom",height:8,showHandler:!0,handlerSize:14,handlerStyle:{symbolType:"circle",fill:"#fff",stroke:"#91caff",lineWidth:2},railStyle:{fill:"rgba(0,0,0,.04)"},trackStyle:{fill:"#91caff"},showValue:!0,valueStyle:{fill:"#2C3542",fontSize:12},startText:{style:{fill:"#2C3542",fontSize:12}},endText:{style:{fill:"#2C3542",fontSize:12}},handlerText:{visible:!0,space:4,precision:0,style:{fill:"#2C3542",fontSize:12}}},Gw(),Nw();class Gx extends Ww{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:wt({},Gx.defaultAttributes,t)),this.name="colorLegend",this._onSliderChange=t=>{this._updateColor(),this.dispatchEvent(t)}}setSelected(t){this._slider&&(this._slider.setValue(t),this._updateColor())}_renderContent(){const{colors:t,slidable:e,layout:i,align:r,min:n,max:o,value:s,railWidth:a,railHeight:l,showHandler:h=!0,handlerSize:c,handlerStyle:d,railStyle:u,trackStyle:g,startText:p,endText:f,handlerText:m,showTooltip:b,tooltip:y,disableTriggerEvent:C}=this.attribute,v=[],w=(o-n)/(t.length-1);for(let e=0;e<t.length;e++)v.push(n+w*e);this._colorScale=(new Lx).domain(v,!0).range(t),this._color=this._getTrackColor();const x=new Nx({x:0,y:0,range:{draggableTrack:!0},slidable:e,layout:i,align:r,min:n,max:o,value:s,railWidth:a,railHeight:l,showHandler:h,handlerSize:c,handlerStyle:d,railStyle:u,trackStyle:Object.assign({fill:this._color},g),startText:p,endText:f,handlerText:m,showTooltip:b,tooltip:y,disableTriggerEvent:C});this._innerView.add(x),this._slider=x,x.translateTo(0-x.AABBBounds.x1,(this._title?this._title.AABBBounds.height()+pt(this.attribute,"title.space",12):0)-x.AABBBounds.y1),this._updateColor()}_bindEvents(){this.attribute.disableTriggerEvent||this._slider&&this._slider.addEventListener("change",this._onSliderChange)}_getTrackColor(){const{colors:t,layout:e}=this.attribute;if(gt(t))return;const i=t.length;if(1===i)return t[0];const r=[];for(let e=0;e<i;e++){const n=e/(i-1);r.push({offset:n,color:t[e]})}const n="horizontal"===e;return{gradient:"linear",stops:r,x0:0,y0:0,x1:n?1:0,y1:n?0:1}}_updateColor(){const{layout:t="horizontal",colors:e,railWidth:i,railHeight:r}=this.attribute,{startHandler:n,endHandler:o,track:s}=this._slider,{startValue:a,endValue:l,startPos:h,endPos:c}=this._slider.currentValue,d=this._colorScale.scale(a),u=this._colorScale.scale(l);null==n||n.setAttribute("fill",d),null==o||o.setAttribute("fill",u);const g="horizontal"===t?i:r;if(Math.abs(h-c)!==g&&e&&e.length>1){const t=this._color.stops,e=Math.min(h,c),i=Math.max(h,c),r=e/g,n=i/g,o=n-r,d=t.filter((t=>t.offset>r&&t.offset<n)),u=Math.min(a,l),p=Math.max(a,l),f=this._colorScale.scale(u),m=this._colorScale.scale(p),b=[{offset:0,color:f}];d.forEach((t=>{b.push({offset:(t.offset-r)/o,color:t.color})})),b.push({offset:1,color:m}),s.setAttribute("fill",Object.assign(Object.assign({},this._color),{stops:b}))}}}function jx(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"bottom",e=0;return"top"===t?`\n    M${e},-6L${e-3.5},-2.5\n    v5\n    h7\n    v-5\n    Z\n`:"left"===t?(e=1,`\n    M${e-6},0L${e-6+2.5},-3.5\n    h5\n    v7\n    h-5\n    Z\n`):"right"===t?(e=-1,`\n    M${e+6},0L${e+6-2.5},-3.5\n    h-5\n    v7\n    h5\n    Z\n  `):`\n    M${e},6L${e-3.5},2.5\n    v-5\n    h7\n    v5\n    Z\n`}Gx.defaultAttributes={layout:"horizontal",title:{align:"start",space:12,textStyle:{fontSize:12,fontWeight:"bold",fill:"rgba(46, 47, 50, 1)"}},handlerSize:10,handlerStyle:{lineWidth:4,stroke:"#fff",outerBorder:{distance:2,lineWidth:1,stroke:"#ccc"}}},Gw(),Nw(),Ey();class Ux extends Ww{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:wt({},Ux.defaultAttributes,t)),this.name="sizeLegend",this._onSliderChange=t=>{this.dispatchEvent(t)}}setSelected(t){this._slider&&this._slider.setValue(t)}_renderContent(){const{slidable:t,layout:e,align:i,min:r,max:n,value:o,railWidth:s,railHeight:a,showHandler:l=!0,handlerSize:h,handlerStyle:c,railStyle:d,trackStyle:u,startText:g,endText:p,handlerText:f,showTooltip:m,tooltip:b,sizeBackground:y,disableTriggerEvent:C}=this.attribute,v=hh.group({x:0,y:0});this._innerView.add(v);const w=new Nx({x:0,y:0,zIndex:1,range:{draggableTrack:!0},slidable:t,layout:e,align:i,min:r,max:n,value:o,railWidth:s,railHeight:a,showHandler:l,handlerSize:h,handlerStyle:Object.assign({symbolType:jx(i)},c),railStyle:d,trackStyle:u,startText:g,endText:p,handlerText:f,showTooltip:m,tooltip:b,disableTriggerEvent:C});v.add(w);let x,_=0;"horizontal"===e?"top"===i?(x=`M0,0L${s},0L${s},12Z`,_=a):(x=`M0,12L${s},12L${s},0Z`,w.setAttribute("y",12)):"left"===i?x=`M${s},0L${s},0L${s+12},${a}L${s},${a}Z`:(x=`M0,${a}L12,${a}L12,0Z`,w.setAttribute("x",12));const S=hh.path(Object.assign(Object.assign({x:0,y:_,path:x},y),{zIndex:0}));v.add(S);const A=this._title?this._title.AABBBounds.height()+pt(this.attribute,"title.space",12):0;v.translate(0-v.AABBBounds.x1,A-v.AABBBounds.y1),this._slider=w}_bindEvents(){this.attribute.disableTriggerEvent||this._slider&&this._slider.addEventListener("change",this._onSliderChange)}}Ux.defaultAttributes={layout:"horizontal",title:{align:"start",space:12,textStyle:{fontSize:12,fontWeight:"bold",fill:"rgba(46, 47, 50, 1)"}},handlerSize:10,handlerStyle:{lineWidth:1,stroke:"#ccc",fill:"#fff"},sizeBackground:{fill:"rgba(20,20,20,0.1)"}},Ay(),Ky(),Dy();let Vx=class t extends jv{constructor(e,i){super((null==i?void 0:i.skipDefault)?e:wt({},t.defaultAttributes,e)),this.name="title"}render(){var t,e,i,r,n,o,s,a,l,h,c,d,u,g,p,f,m,b,y,C,v,w,x,_,S,A,B,T,M,R,P,E,H,L,k,I,F,z,O,D,W,N;const{textType:G,text:j,subtextType:U,textStyle:V={},subtext:K,subtextStyle:$={},width:X,height:q,minWidth:Z,maxWidth:J,minHeight:Q,maxHeight:tt,align:et,verticalAlign:it,padding:rt=0}=this.attribute,nt=Je(rt),ot=this.createOrUpdateChild("title-container",{x:nt[3],y:nt[0],zIndex:1},"group");if(!1!==this.attribute.visible&&!1!==V.visible)if("rich"===G||Y(V.character)){const h=Object.assign({x:null!==(t=V.x)&&void 0!==t?t:0,y:null!==(e=V.y)&&void 0!==e?e:0,width:null!==(r=null!==(i=V.width)&&void 0!==i?i:X)&&void 0!==r?r:0,height:null!==(o=null!==(n=V.height)&&void 0!==n?n:q)&&void 0!==o?o:0,ellipsis:null===(s=V.ellipsis)||void 0===s||s,wordBreak:null!==(a=V.wordBreak)&&void 0!==a?a:"break-word",maxHeight:V.maxHeight,maxWidth:V.maxWidth,textConfig:null!==(l=V.character)&&void 0!==l?l:j},V);this._mainTitle=ot.createOrUpdateChild("mainTitle",h,"richtext")}else if("html"===G){const t=Object.assign({html:Object.assign(Object.assign({dom:j},qv),V),x:null!==(h=V.x)&&void 0!==h?h:0,y:null!==(c=V.y)&&void 0!==c?c:0,width:null!==(u=null!==(d=V.width)&&void 0!==d?d:X)&&void 0!==u?u:0,height:null!==(p=null!==(g=V.height)&&void 0!==g?g:q)&&void 0!==p?p:0,ellipsis:null===(f=V.ellipsis)||void 0===f||f,wordBreak:null!==(m=V.wordBreak)&&void 0!==m?m:"break-word",maxHeight:V.maxHeight,maxWidth:V.maxWidth,textConfig:[]},V);this._mainTitle=ot.createOrUpdateChild("mainTitle",t,"richtext")}else Y(j)&&(this._mainTitle=ot.createOrUpdateChild("mainTitle",Object.assign(Object.assign({text:[j]},V),{maxLineWidth:null!==(b=V.maxLineWidth)&&void 0!==b?b:X,heightLimit:V.heightLimit,lineClamp:V.lineClamp,ellipsis:null===(y=V.ellipsis)||void 0===y||y,x:0,y:0}),"wrapText"));const st=this._mainTitle?this._mainTitle.AABBBounds.height():0,at=this._mainTitle?this._mainTitle.AABBBounds.width():0;if(!1!==this.attribute.visible&&!1!==$.visible)if("rich"===U||Y($.character)){const t=Object.assign({x:null!==(C=$.x)&&void 0!==C?C:0,y:null!==(v=$.y)&&void 0!==v?v:0,width:null!==(x=null!==(w=$.width)&&void 0!==w?w:X)&&void 0!==x?x:0,height:null!==(S=null!==(_=$.height)&&void 0!==_?_:q)&&void 0!==S?S:0,ellipsis:null===(A=$.ellipsis)||void 0===A||A,wordBreak:null!==(B=$.wordBreak)&&void 0!==B?B:"break-word",maxHeight:$.maxHeight,maxWidth:$.maxWidth,textConfig:null!==(T=$.character)&&void 0!==T?T:K},$);this._subTitle=ot.createOrUpdateChild("subTitle",t,"richtext")}else if("html"===U){const t=Object.assign({html:Object.assign(Object.assign({dom:K},qv),$),x:null!==(M=$.x)&&void 0!==M?M:0,y:null!==(R=$.y)&&void 0!==R?R:0,width:null!==(E=null!==(P=$.width)&&void 0!==P?P:X)&&void 0!==E?E:0,height:null!==(L=null!==(H=$.height)&&void 0!==H?H:q)&&void 0!==L?L:0,ellipsis:null===(k=$.ellipsis)||void 0===k||k,wordBreak:null!==(I=$.wordBreak)&&void 0!==I?I:"break-word",maxHeight:$.maxHeight,maxWidth:$.maxWidth,textConfig:[]},$);this._subTitle=ot.createOrUpdateChild("subTitle",t,"richtext")}else Y(K)&&(this._subTitle=ot.createOrUpdateChild("subTitle",Object.assign(Object.assign({text:[K]},$),{maxLineWidth:null!==(F=$.maxLineWidth)&&void 0!==F?F:X,heightLimit:$.heightLimit,lineClamp:$.lineClamp,ellipsis:null===(z=$.ellipsis)||void 0===z||z,x:0,y:st}),"wrapText"));const lt=this._subTitle?this._subTitle.AABBBounds.height():0,ht=this._subTitle?this._subTitle.AABBBounds.width():0;let ct=Math.max(at,ht),dt=st+(null!==(O=$.height)&&void 0!==O?O:lt);if(Y(X)&&(ct=X,this._mainTitle&&this._mainTitle.setAttribute("maxLineWidth",X),this._subTitle&&this._subTitle.setAttribute("maxLineWidth",X)),Y(q)&&(dt=q),Y(Z)&&ct<Z&&(ct=Z),Y(J)&&(this._mainTitle&&this._mainTitle.setAttribute("maxLineWidth",J),this._subTitle&&this._subTitle.setAttribute("maxLineWidth",J),this._mainTitle&&this._mainTitle.setAttribute("maxWidth",J),this._subTitle&&this._subTitle.setAttribute("maxWidth",J),ct>J&&(ct=J)),Y(Q)&&dt<Q&&(dt=Q),Y(tt)&&(this._mainTitle&&this._mainTitle.setAttribute("maxHeight",tt),this._subTitle&&this._subTitle.setAttribute("maxHeight",tt-st),dt>tt&&(dt=tt)),ot.attribute.width=ct,ot.attribute.height=dt,ot.attribute.boundsPadding=nt,this._mainTitle){if(Y(et)||Y(V.align)){const t=V.align?V.align:et,e=null!==(D=V.width)&&void 0!==D?D:at;"left"===t?(this._mainTitle.setAttribute("x",0),this._mainTitle.setAttribute("textAlign","left")):"center"===t?(this._mainTitle.setAttribute("x",e/2),this._mainTitle.setAttribute("textAlign","center")):"right"===t&&(this._mainTitle.setAttribute("x",e),this._mainTitle.setAttribute("textAlign","right"))}if(Y(it)||Y(V.verticalAlign)){const t=V.verticalAlign?V.verticalAlign:it,e=V.height?V.height:dt;"top"===t?(this._mainTitle.setAttribute("y",0),this._mainTitle.setAttribute("textBaseline","top")):"middle"===t?(this._mainTitle.setAttribute("y",e/2),this._mainTitle.setAttribute("textBaseline","middle")):"bottom"===t&&(this._mainTitle.setAttribute("y",e),this._mainTitle.setAttribute("textBaseline","bottom"))}}if(this._subTitle){if(Y(et)||Y($.align)){const t=$.align?$.align:et,e=null!==(W=$.width)&&void 0!==W?W:ht;"left"===t?(this._subTitle.setAttribute("x",0),this._subTitle.setAttribute("textAlign","left")):"center"===t?(this._subTitle.setAttribute("x",e/2),this._subTitle.setAttribute("textAlign","center")):"right"===t&&(this._subTitle.setAttribute("x",e),this._subTitle.setAttribute("textAlign","right"))}if(Y(it)||Y(V.verticalAlign)){const t=$.verticalAlign?$.verticalAlign:it,e=st,i=null!==(N=$.height)&&void 0!==N?N:0;"top"===t?(this._subTitle.setAttribute("y",e),this._subTitle.setAttribute("textBaseline","top")):"middle"===t?(this._subTitle.setAttribute("y",e+i/2),this._subTitle.setAttribute("textBaseline","middle")):"bottom"===t&&(this._subTitle.setAttribute("y",e+i),this._subTitle.setAttribute("textBaseline","bottom"))}}}};Vx.defaultAttributes={textStyle:{ellipsis:"...",fill:"#333",fontSize:20,fontWeight:"bold",textAlign:"left",textBaseline:"top"},subtextStyle:{ellipsis:"...",fill:"#6F6F6F",fontSize:16,fontWeight:"normal",textAlign:"left",textBaseline:"top"}};Ay(),Fy(),Ky(),Ty();class Kx extends jv{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:wt({},Kx.defaultAttributes,t)),this.renderGroup(),this.onBeforeAttributeUpdate=(t,e,i)=>{"interactive"in t&&this.setAttribute("pickable",t.interactive),"disabled"in t&&this.setAttribute("cursor",t.disable?this.attribute.disableCursor:this.attribute.cursor)},this.addEventListener("click",this.handleClick)}render(){this.removeAllChild(),this.renderBox(),this.renderIcon(),this.renderText(),this.layout()}renderBox(){this._box=new pl(wt({},this.attribute.box));const t=this.attribute.checked||this.attribute.indeterminate;t&&this.attribute.disabled?this._box.setAttributes({fill:this.attribute.box.disableCheckedFill,stroke:this.attribute.box.disableCheckedStroke}):t&&this._box.setAttributes({fill:this.attribute.box.checkedFill,stroke:this.attribute.box.checkedStroke}),this.appendChild(this._box)}renderIcon(){this._checkIcon=new Sl(wt({image:this.attribute.icon.checkIconImage},this.attribute.icon)),this.appendChild(this._checkIcon),this._indeterminateIcon=new Sl(wt({image:this.attribute.icon.indeterminateIconImage},this.attribute.icon)),this.appendChild(this._indeterminateIcon),this.attribute.checked?(this._checkIcon.setAttribute("visible",!0),this._indeterminateIcon.setAttribute("visible",!1)):this.attribute.indeterminate?(this._checkIcon.setAttribute("visible",!1),this._indeterminateIcon.setAttribute("visible",!0)):(this._checkIcon.setAttribute("visible",!1),this._indeterminateIcon.setAttribute("visible",!1))}renderText(){this._text=new ra(wt({},this.attribute.text)),this.attribute.disabled&&this._text.setAttribute("fill",this.attribute.text.disableFill),this.appendChild(this._text)}renderGroup(){this.attribute.interactive||this.setAttribute("pickable",!1),this.attribute.disabled&&this.setAttribute("cursor",this.attribute.disableCursor)}layout(){const t=this.attribute.box.height,e=this.attribute.icon.height,i=this._text.AABBBounds.height(),r=Math.max(t,e,i),n=r/2-t/2,o=r/2-e/2,s=r/2-i/2,a=this.attribute.box.width,l=this.attribute.icon.width,h=Math.max(a,l),c=h/2-a/2,d=h/2-l/2,u=h+this.attribute.spaceBetweenTextAndIcon;this._box.setAttributes({x:c,y:n}),this._checkIcon.setAttributes({x:d,y:o}),this._indeterminateIcon.setAttributes({x:d,y:o}),this._text.setAttributes({x:u,y:s})}handleClick(){this.attribute.disabled||(this.attribute.checked?(this.setAttribute("checked",!1),this.setAttribute("indeterminate",!1)):(this.setAttribute("checked",!0),this.setAttribute("indeterminate",!1)),this._dispatchEvent("checkbox_state_change",{eventType:"checkbox_state_change",checked:this.attribute.checked}))}}function $x(t){const e={...t};return gt(t.style)||(e.textStyle=Xx(t.style)),gt(t.textStyle)||wt(e.textStyle,Xx(t.textStyle)),t.shape?.style&&Xx(e.shape.style),t.background?.style&&Xx(e.background.style),e}function Xx(t){return gt(t)||t.angle&&(t.angle=pe(t.angle)),t}function Yx(t={}){return gt(t.style)||(t.style=Xx(t.style)),gt(t.state)||Object.keys(t.state).forEach((e=>{gt(t.state[e])||(t.state[e]=Xx(t.state[e]))})),t}function qx(t){return gt(t)?null:(Object.keys(t).forEach((e=>{gt(t[e])||(t[e]=Xx(t[e]))})),t)}Kx.defaultAttributes={interactive:!0,disabled:!1,checked:!1,indeterminate:!1,cursor:"pointer",disableCursor:"not-allowed",spaceBetweenTextAndIcon:8,text:{text:"text",fontSize:14,fill:"#000",disableFill:"rgb(201,205,212)",textBaseline:"top",pickable:!1},icon:{checkIconImage:'<svg width="200" height="200" viewBox="0 0 1024 1024" fill="#fff" xmlns="http://www.w3.org/2000/svg"><path d="M877.44815445 206.10060629a64.72691371 64.72691371 0 0 0-95.14856334 4.01306852L380.73381888 685.46812814 235.22771741 533.48933518a64.72691371 64.72691371 0 0 0-92.43003222-1.03563036l-45.82665557 45.82665443a64.72691371 64.72691371 0 0 0-0.90617629 90.61767965l239.61903446 250.10479331a64.72691371 64.72691371 0 0 0 71.19960405 15.14609778 64.33855261 64.33855261 0 0 0 35.08198741-21.23042702l36.24707186-42.71976334 40.5190474-40.77795556-3.36579926-3.49525333 411.40426297-486.74638962a64.72691371 64.72691371 0 0 0-3.88361443-87.64024149l-45.3088404-45.43829334z"></path></svg>',indeterminateIconImage:'<svg width="200" height="200" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg" fill="none"><path stroke="#fff" stroke-linecap="round" stroke-linejoin="round" stroke-width="5" d="M5 12h14"/></svg>',width:10,height:10,pickable:!1},box:{width:14,height:14,cornerRadius:2,fill:"#fff",stroke:"rgb(229,230,235)",disableFill:"rgb(242,243,245)",checkedFill:"rgb(22, 93, 255)",checkedStroke:"rgb(22, 93, 255)",disableCheckedFill:"rgb(148, 191, 255)",disableCheckedStroke:"rgb(148, 191, 255)",pickable:!1}};const Zx={left:{textAlign:"center",textBaseline:"bottom"},right:{textAlign:"center",textBaseline:"bottom"},radius:{},angle:{}},Jx="PingFang SC,Microsoft Yahei,system-ui,-apple-system,segoe ui,Roboto,Helvetica,Arial,sans-serif, apple color emoji,segoe ui emoji,segoe ui symbol",Qx=14,t_={FONT_FAMILY:Jx,LABEL_FONT_SIZE:Qx,MAP_LABEL_FONT_SIZE:10,TITLE_FONT_SIZE:18,AXIS_TICK_SIZE:4},e_={domainLine:{visible:!0,style:{lineWidth:1,stroke:"#D9DDE4",strokeOpacity:1}},grid:{visible:!0,style:{lineWidth:1,stroke:"#EBEDF2",strokeOpacity:1,lineDash:[]}},subGrid:{visible:!1,style:{lineWidth:1,stroke:"#EBEDF2",strokeOpacity:1,lineDash:[4,4]}},tick:{visible:!0,tickSize:t_.AXIS_TICK_SIZE,style:{lineWidth:1,stroke:"#D9DDE4",strokeOpacity:1}},subTick:{visible:!1,tickSize:t_.AXIS_TICK_SIZE/2,style:{lineWidth:1,stroke:"#D9DDE4",strokeOpacity:1}},label:{visible:!0,space:1,style:{fontSize:t_.LABEL_FONT_SIZE,fill:"#89909D",fontWeight:"normal",fillOpacity:1}},title:{space:10,style:{fontSize:t_.LABEL_FONT_SIZE,fill:"#333333",fontWeight:"normal",fillOpacity:1}}};function i_(t){const e=wt({},t);let i,r=e.title?.angle??0;"left"!==e.orient&&"right"!==e.orient||e.title?.autoRotate&&X(e.title.angle)&&(r="left"===e.orient?-90:90,i=Zx[e.orient]);const n=function(t,e){if(!t||!J(t))return t;const i={};return Object.keys(t).forEach((r=>{const n=t[r];let o=!1;e.forEach((t=>{(et(t)&&t===r||t instanceof RegExp&&r.match(t))&&(o=!0)})),o||(i[r]=n)})),i}(e.label,["style","formatMethod","state"]);return{orient:e.orient,select:e.select,hover:e.hover,line:(o=e.domainLine,Yx(o),Yx(o.startSymbol),Yx(o.endSymbol),o),label:{style:Xx(e.label.style),formatMethod:e.label.formatMethod?(t,i,r)=>e.label.formatMethod(i.rawValue,i):null,state:qx(e.label.state),...n},tick:{visible:e.tick.visible,length:e.tick.tickSize,inside:e.tick.inside,alignWithLabel:e.tick.alignWithLabel,style:Xx(e.tick.style),state:qx(e.tick.state),dataFilter:e.tick.dataFilter},subTick:{visible:e.subTick.visible,length:e.subTick.tickSize,inside:e.subTick.inside,count:e.subTick.tickCount,style:Xx(e.subTick.style),state:qx(e.subTick.state)},grid:{type:"line",visible:e.grid.visible,alternateColor:e.grid.alternateColor,alignWithLabel:e.grid.alignWithLabel,style:Xx(e.grid.style)},subGrid:{type:"line",visible:e.subGrid.visible,alternateColor:e.subGrid.alternateColor,style:Xx(e.subGrid.style)},title:{visible:e.title.visible,position:e.title.position,space:e.title.space,autoRotate:!1,angle:r?pe(r):null,textStyle:wt({},i,Xx(e.title.style)),padding:e.title.padding,shape:{visible:e.title.shape?.visible,space:e.title.shape?.space,style:Xx(e.title.shape?.style)},background:{visible:e.title.background?.visible,style:Xx(e.title.background?.style)},state:{text:qx(e.title.state),shape:qx(e.title.shape?.state),background:qx(e.title.background?.state)}},panel:{visible:e.background?.visible,style:Xx(e.background?.style),state:qx(e.background?.state)}};var o}function r_(t){return"bottom"===t||"top"===t}class n_{_scale;_scales;bandPadding;paddingInner;paddingOuter;constructor(){this._scale=new gx,this._scales=[this._scale]}valueToPosition(t){return this._scale.scale(t)}getPosition(t){let e=0,i=this._scale;if(1===this._scales.length||1===t.length)e=this.valueToPosition(t[0]);else{const r=Math.min(t.length,this._scales.length);for(let i=0;i<r;i++)e+=this._scales[i].scale(t[i]);i=this._scales[r-1]}return{position:e,bandScale:i}}calcScales(t,e){const{bandPadding:i,paddingInner:r,paddingOuter:n}=this,o=it(i),s=it(r),a=it(n);for(let l=0;l<this._scales.length;l++){const h=o?i[l]:i,c=s?r[l]:r,d=a?n[l]:n;this._scales[l].paddingInner(c??h??t,!0).paddingOuter(d??h??e)}}dataToPosition(t,e={}){if(0===t.length||0===this._scales.length)return 0;const{position:i,bandScale:r}=this.getPosition(t);return i+r.bandwidth()*(e.bandPosition??.5)}updateScaleDomain(t){for(let e=0;e<this._scales.length;e++)this._scales[e].domain(t)}updateRange(t){const[e,i]=this._scale.range();t[0]===e&&t[1]===i||this._scale.range(t)}}const o_=(t,e)=>{var i,r;if(!(null==e?void 0:e.fields))return t;if(0===t.length)return t;const n=e.fields,o=t[0],s={},a=[];for(const e in n)if(Object.prototype.hasOwnProperty.call(n,e)){const l=n[e];if(!l.type){let r=o;e in o||(r=null!==(i=t.find((t=>e in t)))&&void 0!==i?i:o),l.type="number"==typeof r[e]?"linear":"ordinal"}let h;if("number"==typeof l.sortIndex&&(h={key:e,type:l.type,index:l.sortIndex,sortIndex:{},sortIndexCount:0,sortReverse:!0===l.sortReverse},a.push(h)),(null===(r=l.domain)||void 0===r?void 0:r.length)>0)if("ordinal"===l.type){l._domainCache={},s[e]=l;const t={};l.domain.forEach(((e,i)=>{t[e]=i,l._domainCache[e]=i})),h&&(h.sortIndex=t,h.sortIndexCount=l.domain.length)}else l.domain.length>=2&&(s[e]=l)}return Object.keys(s).length>0&&(t=t.filter((t=>{for(const e in s){const i=s[e];if("ordinal"===i.type){if(!(t[e]in i._domainCache))return!1}else if(i.domain[0]>t[e]||i.domain[1]<t[e])return!1}return!0}))),a.sort(((t,e)=>t.index-e.index)),t.sort(((t,e)=>function(t,e,i){for(let r=0;r<i.length;r++){const n=i[r];let o=0;if("ordinal"===n.type?(void 0===n.sortIndex[e[n.key]]&&(n.sortIndex[e[n.key]]=n.sortIndexCount++),void 0===n.sortIndex[t[n.key]]&&(n.sortIndex[t[n.key]]=n.sortIndexCount++),o=n.sortIndex[t[n.key]]-n.sortIndex[e[n.key]]):"linear"===n.type&&(o=t[n.key]-e[n.key]),n.sortReverse&&(o=-o),0!==o)return o}return 0}(t,e,a))),t};let s_=0;function a_(){return s_>1e8&&(s_=0),(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"dataset")+"_"+s_++}class l_{constructor(t){var e;let i;this.options=t,this.isDataSet=!0,this.transformMap={},this.parserMap={},this.dataViewMap={},this.target=new U,i=(null==t?void 0:t.name)?t.name:a_("dataset"),this.name=i,this._logger=null!==(e=null==t?void 0:t.logger)&&void 0!==e?e:Ze.getInstance()}setLogger(t){this._logger=t}getDataView(t){return this.dataViewMap[t]}setDataView(t,e){var i;this.dataViewMap[t]&&(null===(i=this._logger)||void 0===i||i.error(`Error: dataView ${t} 之前已存在,请重新命名`)),this.dataViewMap[t]=e}removeDataView(t){this.dataViewMap[t]=null,delete this.dataViewMap[t]}registerParser(t,e){var i;this.parserMap[t]&&(null===(i=this._logger)||void 0===i||i.warn(`Warn: transform ${t} 之前已注册,执行覆盖逻辑`)),this.parserMap[t]=e}removeParser(t){this.parserMap[t]=null,delete this.parserMap[t]}getParser(t){return this.parserMap[t]||this.parserMap.default}registerTransform(t,e){var i;this.transformMap[t]&&(null===(i=this._logger)||void 0===i||i.warn(`Warn: transform ${t} 之前已注册,执行覆盖逻辑`)),this.transformMap[t]=e}removeTransform(t){this.transformMap[t]=null,delete this.transformMap[t]}getTransform(t){return this.transformMap[t]}multipleDataViewAddListener(t,e,i){this._callMap||(this._callMap=new Map);let r=this._callMap.get(i);r||(r=()=>{t.some((t=>t.isRunning))||i()}),t.forEach((t=>{t.target.addListener(e,r)})),this._callMap.set(i,r)}allDataViewAddListener(t,e){this.multipleDataViewAddListener(Object.values(this.dataViewMap),t,e)}multipleDataViewRemoveListener(t,e,i){if(this._callMap){const r=this._callMap.get(i);r&&t.forEach((t=>{t.target.removeListener(e,r)})),this._callMap.delete(i)}}multipleDataViewUpdateInParse(t){t.forEach((t=>{var e;return null===(e=this.getDataView(t.name))||void 0===e?void 0:e.markRunning()})),t.forEach((t=>{var e;return null===(e=this.getDataView(t.name))||void 0===e?void 0:e.parseNewData(t.data,t.options)}))}multipleDataViewUpdateInRawData(t){t.forEach((t=>{var e;return null===(e=this.getDataView(t.name))||void 0===e?void 0:e.markRunning()})),t.forEach((t=>{var e;return null===(e=this.getDataView(t.name))||void 0===e?void 0:e.updateRawData(t.data,t.options)}))}destroy(){this.transformMap=null,this.parserMap=null,this.dataViewMap=null,this._callMap=null,this.target.removeAllListeners()}}const h_="_data-view-diff-rank";class c_{constructor(t,e){var i=this;let r;this.dataSet=t,this.options=e,this.isDataView=!0,this.target=new U,this.parseOption=null,this.transformsArr=[],this.isRunning=!1,this.rawData={},this.history=!1,this.parserData={},this.latestData={},this._fields=null,this.reRunAllTransform=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{pushHistory:!0,emitMessage:!0};return i.isRunning=!0,i.resetTransformData(),i.transformsArr.forEach((e=>{i.executeTransform(e,{pushHistory:t.pushHistory,emitMessage:!1}),i.isLastTransform(e)&&i.diffLastData()})),i.isRunning=!1,!1!==t.emitMessage&&i.target.emit("change",[]),i},this.markRunning=()=>{this.isRunning=!0,this.target.emit("markRunning",[])},r=(null==e?void 0:e.name)?e.name:a_("dataview"),this.name=r,(null==e?void 0:e.history)&&(this.history=e.history,this.historyData=[]),this.dataSet.setDataView(r,this),this.setFields(null==e?void 0:e.fields)}parse(t,e){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];var r;this.isRunning=!0,i&&this.target.emit("beforeParse",[]),e&&(this.parseOption=e);const n=this.cloneParseData(t,e);if(null==e?void 0:e.type){const t=(null!==(r=this.dataSet.getParser(e.type))&&void 0!==r?r:this.dataSet.getParser("bytejson"))(n,e.options,this);this.rawData=n,this.parserData=t,this.history&&this.historyData.push(n,t),this.latestData=t}else this.parserData=n,this.rawData=n,this.history&&this.historyData.push(n),this.latestData=n;return this.isRunning=!1,i&&this.target.emit("afterParse",[]),this}transform(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if(this.isRunning=!0,t&&t.type){let i=!0;if("fields"===t.type){this._fields=t.options.fields;const e=this.transformsArr.findIndex((e=>e.type===t.type));e>=0&&(i=!1,this.transformsArr[e].options.fields=this._fields)}if(i&&this.transformsArr.push(t),e){const e=this.isLastTransform(t);this.executeTransform(t),e&&this.diffLastData()}}return this.sortTransform(),this.isRunning=!1,this}isLastTransform(t){return this.transformsArr[this.transformsArr.length-1]===t}sortTransform(){this.transformsArr.length>=2&&this.transformsArr.sort(((t,e)=>{var i,r;return(null!==(i=t.level)&&void 0!==i?i:0)-(null!==(r=e.level)&&void 0!==r?r:0)}))}executeTransform(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{pushHistory:!0,emitMessage:!0};const{pushHistory:i,emitMessage:r}=e,n=this.dataSet.getTransform(t.type)(this.latestData,t.options);this.history&&!1!==i&&this.historyData.push(n),this.latestData=n,!1!==r&&this.target.emit("change",[])}resetTransformData(){this.latestData=this.parserData,this.history&&(this.historyData.length=0,this.historyData.push(this.rawData,this.parserData))}enableDiff(t){this._diffData=!0,this._diffKeys=t,this._diffMap=new Map,this._diffRank=0}disableDiff(){this._diffData=!1,this._diffMap=null,this._diffRank=null}resetDiff(){this._diffMap=new Map,this._diffRank=0}diffLastData(){var t;if(!this._diffData)return;if(!this.latestData.forEach)return;if(!(null===(t=this._diffKeys)||void 0===t?void 0:t.length))return;const e=this._diffRank+1;if(0===this._diffRank)this.latestData.forEach((t=>{t[h_]=e,this._diffMap.set(this._diffKeys.reduce(((e,i)=>e+t[i]),""),t)})),this.latestDataAUD={add:Array.from(this.latestData),del:[],update:[]};else{let t;this.latestDataAUD={add:[],del:[],update:[]},this.latestData.forEach((i=>{i[h_]=e,t=this._diffKeys.reduce(((t,e)=>t+i[e]),""),this._diffMap.get(t)?this.latestDataAUD.update.push(i):this.latestDataAUD.add.push(i),this._diffMap.set(t,i)})),this._diffMap.forEach(((t,i)=>{t[h_]<e&&(this.latestDataAUD.del.push(t),this._diffMap.delete(i))}))}this._diffRank=e}cloneParseData(t,e){let i=!1;return t instanceof c_||!0!==(null==e?void 0:e.clone)||(i=!0),i?bt(t):t}parseNewData(t,e){this.parse(t,e||this.parseOption),this.reRunAllTransform()}updateRawData(t,e){const i=this.cloneParseData(t,e);this.rawData=i,this.parserData=i,this.latestData=i,this.reRunAllTransform()}getFields(){var t;return this._fields?this._fields:"dataview"===(null===(t=this.parseOption)||void 0===t?void 0:t.type)&&1===this.rawData.length&&this.rawData[0].getFields?this.rawData[0].getFields():null}setFields(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];this._fields=t&&e?wt({},this._fields,t):t;const i=this.transformsArr.find((t=>"fields"===t.type));!X(this._fields)&&X(i)?(this.dataSet.registerTransform("fields",o_),this.transform({type:"fields",options:{fields:this._fields}},!1)):i&&(i.options.fields=this._fields)}destroy(){this.dataSet.removeDataView(this.name),this._diffMap=null,this._diffRank=null,this.latestData=null,this.rawData=null,this.parserData=null,this.transformsArr=null,this.target=null}}const d_=new class{constructor(){this.store=new Map}RegisterGraphicCreator(t,e){this.store.set(t,e),this[t]=e}CreateGraphic(t,e){const i=this.store.get(t);return i?i(e):null}};let u_;function g_(t){return u_||(u_=d_.CreateGraphic("text",{})),u_.setAttributes(t),u_.AABBBounds}const p_=(t,e,i,r)=>new $e(Object.assign({defaultFontParams:Object.assign({fontFamily:"PingFang SC,Helvetica Neue,Microsoft Yahei,system-ui,-apple-system,segoe ui,Roboto,Helvetica,Arial,sans-serif,apple color emoji,segoe ui emoji,segoe ui symbol",fontSize:14},r),getTextBounds:i?void 0:g_,specialCharSet:"-/: .,@%'\"~"+$e.ALPHABET_CHAR_SET+$e.ALPHABET_CHAR_SET.toUpperCase()},null!=e?e:{}),t);function f_(t){let e="center",i="middle";return e=(t=function(t){for(;t<0;)t+=2*Math.PI;for(;t>=2*Math.PI;)t-=2*Math.PI;return t}(t))>=Math.PI*(5/3)||t<=Math.PI*(1/3)?"left":t>=Math.PI*(2/3)&&t<=Math.PI*(4/3)?"right":"center",i=t>=Math.PI*(7/6)&&t<=Math.PI*(11/6)?"bottom":t>=Math.PI*(1/6)&&t<=Math.PI*(5/6)?"top":"middle",{align:e,baseline:i}}const m_=t=>t.map(((t,e)=>({index:e,value:t}))),b_=function(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;const r=new ge(t).expand(i/2),n=new ge(e).expand(i/2);return r.intersects(n)};function y_(t,e,i){return i>Math.max(e.x1-t.x2,t.x1-e.x2,e.y1-t.y2,t.y1-e.y2)}function C_(t,e){for(let i,r=1,n=t.length,o=t[0];r<n;o=i,++r)if(i=t[r],y_(o.AABBBounds,i.AABBBounds,e))return!0;return!1}const v_=(t,e,i)=>{var r;const{labelStyle:n,axisOrientType:o,labelFlush:s,labelFormatter:a,startAngle:l=0}=i;let h=null!==(r=n.angle)&&void 0!==r?r:0;"vertical"===n.direction&&(h+=pe(90));const c=["bottom","top"].includes(o),d=["left","right"].includes(o);let u=1,g=0;c||(d?(u=0,g=1):l&&(u=Math.cos(l),g=-Math.sin(l)));const p=p_(n),f=e.map(((i,r)=>{var o,l;const f=a?a(i):`${i}`,{width:m,height:b}=p.quickMeasure(f),y=Math.max(m,12),C=Math.max(b,12),v=t.scale(i),w=u*v,x=g*v;let _,S,A=w,B=x;_=s&&c&&0===r?"left":s&&c&&r===e.length-1?"right":null!==(o=n.textAlign)&&void 0!==o?o:"center","right"===_?A-=y:"center"===_&&(A-=y/2),S=s&&d&&0===r?"top":s&&d&&r===e.length-1?"bottom":null!==(l=n.textBaseline)&&void 0!==l?l:"middle","bottom"===S?B-=C:"middle"===S&&(B-=C/2);const T=(new ge).set(A,B,A+y,B+C);return h&&T.rotate(h,w,x),T}));return f},w_=(t,e,i)=>{var r;const{labelStyle:n,getRadius:o,labelOffset:s,labelFormatter:a}=i,l=null==o?void 0:o(),h=null!==(r=n.angle)&&void 0!==r?r:0,c=p_(n);return e.map((e=>{const i=a?a(e):`${e}`,{width:r,height:n}=c.quickMeasure(i),o=Math.max(r,12),d=Math.max(n,12),u=t.scale(e);let g=0,p=0;const f=f_(u),{x:m,y:b}=function(t,e,i){return{x:t.x+e*Math.cos(i),y:t.y+e*Math.sin(i)}}({x:0,y:0},l+s,u);return g=m+("right"===f.align?-o:"center"===f.align?-o/2:0),p=b+("bottom"===f.baseline?-d:"middle"===f.baseline?-d/2:0),(new ge).set(g,p,g+o,p+d).rotate(h,g+o/2,p+d/2)}))},x_={parity:function(t){return t.filter(((t,e)=>e%2==0))},greedy:function(t,e){let i;return t.filter(((t,r)=>!(r&&y_(i.AABBBounds,t.AABBBounds,e)||(i=t,0))))}},__=(t,e,i,r)=>v_(t,e,i).map((t=>r?[t.x1,t.x2,t.width()]:[t.y1,t.y2,t.height()])),S_=function(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;return Math.max(t[0],e[0])-i/2<=Math.min(t[1],e[1])+i/2},A_=(t,e)=>t[1]<e[0]?e[0]-t[1]:e[1]<t[0]?t[0]-e[1]:0,B_=(t,e,i,r,n,o)=>{let s=0,a=0,l=-1,h=Number.MAX_VALUE;const c=r=>{let n=!0,o=0;do{o+r<t.length&&S_(e[o],e[o+r],i)&&(n=!1),o+=r}while(n&&o<t.length);return n},d=((t,e,i)=>{let r=t,n=e;for(;r<n;){const t=Math.floor((r+n)/2);i(t)>=0?n=t:r=t+1}return r})(n,t.length,(t=>c(t)?1:-1));let u=d;do{if(u>d&&!o&&!c(u))u++;else{if(!r){a=u;break}{const r=t.length-1;let n,o=0;n=t.length%u>0?t.length-t.length%u+u:t.length;do{if(n-=u,n!==r&&!S_(e[n],e[r],i))break;o++}while(n>0);if(n===r){a=u,s=o;break}{const i=Math.floor(t.length/u)-o+1;if(i<l)break;{l=i;const t=A_(e[n],e[r]),c=n-u>=0?A_(e[n-u],e[n]):t,d=Math.abs(t-c);if(d<h&&(h=d,a=u,s=o),t<=c)break}}}u++}}while(u<=t.length);return{step:a,delCount:s}},T_=(t,e,i,r)=>{let n=r;do{let r=!0;n++;let o=0;do{o+n<t.length&&b_(e[o],e[o+n],i)&&(r=!1),o+=n}while(r&&o<t.length);if(r)break}while(n<=t.length);let o=0;if(t.length>2){let i=t.length-t.length%n;for(i>=t.length&&(i-=n);i>0&&b_(e[0],e[i]);)o++,i-=n}return{step:n,delCount:o}},M_=(t,e)=>{if($w(t.type))return((t,e)=>{if(!$w(t.type))return m_(t.domain());const i=t.range(),r=Math.abs(i[i.length-1]-i[0]);if(r<2)return m_([t.domain()[0]]);const{tickCount:n,forceTickCount:o,tickStep:s,noDecimals:a=!1,labelStyle:l}=e;let h;if(Y(s))h=t.stepTicks(s);else if(Y(o))h=t.forceTicks(o);else if("d3"===e.tickMode){const e=$(n)?n({axisLength:r,labelStyle:l}):n;h=t.d3Ticks(null!=e?e:5,{noDecimals:a})}else{const e=$(n)?n({axisLength:r,labelStyle:l}):n;h=t.ticks(null!=e?e:5,{noDecimals:a})}if(e.sampling&&("cartesian"===e.coordinateType||"polar"===e.coordinateType&&"radius"===e.axisOrientType)){const{labelGap:i=4,labelFlush:r}=e;let n=v_(t,h,e).map(((t,e)=>({AABBBounds:t,value:h[e]})));for(;n.length>=3&&C_(n,i);)n=x_.parity(n);const o=n.map((t=>t.value));o.length<3&&r&&(o.length>1&&o.pop(),Tt(o)!==Tt(h)&&o.push(Tt(h))),h=o}return m_(h)})(t,e);if(function(t){switch(t){case Kw.Ordinal:case Kw.Point:case Kw.Band:return!0;default:return!1}}(t.type)){if("cartesian"===e.coordinateType)return((t,e)=>{var i;const r=t.domain();if(!r.length)return[];const{tickCount:n,forceTickCount:o,tickStep:s,labelGap:a=4,axisOrientType:l,labelStyle:h}=e,c=(t=>["bottom","top","z"].includes(t))(l),d=t.range(),u=t.calculateWholeRangeSize();if(u<2)return e.labelLastVisible?m_([r[r.length-1]]):m_([r[0]]);let g;if(Y(s))g=t.stepTicks(s);else if(Y(o))g=t.forceTicks(o);else if(Y(n)){const e=$(n)?n({axisLength:u,labelStyle:h}):n;g=t.ticks(e)}else if(e.sampling){const n=(null!==(i=e.labelStyle.fontSize)&&void 0!==i?i:12)+2,o=Rt(d),s=Mt(d);if(r.length<=u/n){const i=(s-o)/r.length,n=__(t,r,e,c),l=Math.min(...n.map((t=>t[2]))),h=B_(r,n,a,e.labelLastVisible,Math.floor(l/i),!1);g=t.stepTicks(h.step),e.labelLastVisible&&(h.delCount&&(g=g.slice(0,g.length-h.delCount)),g.push(r[r.length-1]))}else{const i=[r[0],r[Math.floor(r.length/2)],r[r.length-1]],n=__(t,i,e,c);let l=null;n.forEach((t=>{l?l[2]<t[2]&&(l=t):l=t}));const h=s-o-a>0?Math.ceil(r.length*(a+l[2])/(s-o-a)):r.length-1;g=t.stepTicks(h),!e.labelLastVisible||g.length&&g[g.length-1]===r[r.length-1]||(g.length&&Math.abs(t.scale(g[g.length-1])-t.scale(r[r.length-1]))<l[2]&&(g=g.slice(0,-1)),g.push(r[r.length-1]))}}else g=t.domain();return m_(g)})(t,e);if("polar"===e.coordinateType&&"angle"===e.axisOrientType)return((t,e)=>{const{tickCount:i,forceTickCount:r,tickStep:n,getRadius:o,labelOffset:s,labelGap:a=0,labelStyle:l}=e,h=null==o?void 0:o();if(!h)return m_(t.domain());let c;if(Y(n))c=t.stepTicks(n);else if(Y(r))c=t.forceTicks(r);else if(Y(i)){const e=t.range(),r=Math.abs(e[e.length-1]-e[0]),n=$(i)?i({axisLength:r,labelStyle:l}):i;c=t.ticks(n)}else if(e.sampling){const i=t.domain(),r=t.range(),n=w_(t,i,e),o=Rt(r),l=Mt(r),d=Math.abs(l-o)*(h+s)/i.length,{step:u,delCount:g}=T_(i,n,a,Math.floor(n.reduce(((t,e)=>Math.min(t,e.width(),e.height())),Number.MAX_VALUE)/d));c=t.stepTicks(u),c=c.slice(0,c.length-g)}else c=t.domain();return m_(c)})(t,e)}return m_(t.domain())},R_=Math.sqrt(50),P_=Math.sqrt(10),E_=Math.sqrt(2);class H_{_extend={};_scale;_scales;nice;zero;domain;expand;forceTickCount;tickCount;niceType;type;constructor(t){this.type=t??"linear",this._scale="log"===t?new Fx:"symlog"===t?new zx:new Lx,this._scales=[this._scale]}setExtraAttrFromSpec(t,e,i,r,n,o){this.nice=!1,this.zero=e,this.zero&&(i.min=Math.min(i.min,0),i.max=Math.max(i.max,0)),this.domain=i,this.expand=r,"log"===this.type?this._scale.base(n??10):"symlog"===this.type&&this._scale.constant(o??10)}transformScaleDomain(){"symlog"===this.type||"log"===this.type||this.setScaleNice()}setScaleNice(){"log"===this.type?this.setLogScaleNice():this.setLinearScaleNice()}setLogScaleNice(){X(this.domain?.min)&&X(this.domain?.max)?this.nice&&this._scale.nice():Y(this.domain?.min)&&X(this.domain?.max)?this.nice&&this._scale.niceMax():X(this.domain?.min)&&Y(this.domain?.max)&&this.nice&&this._scale.niceMin()}setLinearScaleNice(){let t=this.forceTickCount??this.tickCount??10;"accurateFirst"===this.niceType&&(t=Math.max(10,t)),X(this.domain?.min)&&X(this.domain?.max)?this.nice&&this._scale.nice(t):Y(this.domain?.min)&&X(this.domain?.max)?this.nice&&this._scale.niceMax(t):X(this.domain?.min)&&Y(this.domain?.max)?this.nice&&this._scale.niceMin(t):this.nice&&this._scale.nice(t)}dataToPosition(t){return this.valueToPosition(t[0])}valueToPosition(t){return this._scale.scale(t)}computeLinearDomain(t){const e=[];return t.forEach((t=>{const{min:i,max:r}=t;e[0]=void 0===e[0]?i:Math.min(e[0],i),e[1]=void 0===e[1]?r:Math.max(e[1],r)})),this.expandDomain(e),this.includeZero(e),this.setDomainMinMax(e),e}expandDomain(t){if(!this.expand)return;const e=t[0],i=t[t.length-1];Y(this.expand.min)&&(t[0]=e-(i-e)*this.expand.min),Y(this.expand.max)&&(t[t.length-1]=i+(i-e)*this.expand.max)}niceDomain(t){if(Y(t[0])||Y(t[1])||"linear"!==this.type)return t;if(Math.abs(Rt(t)-Mt(t))<=1e-12){let e=t[0];const i=e>=0?1:-1;if(e=Math.abs(e),e<1)t[0]=0,t[1]=1;else{let i=e/5;const r=Math.floor(Math.log(i)/Math.LN10),n=i/Math.pow(10,r);i=(n>=R_?10:n>=P_?5:n>=E_?2:1)*Math.pow(10,r),t[0]=0,t[1]=10*i}i<0&&(t.reverse(),t[0]*=-1,t[1]*=-1)}return t}niceMinMax(){if(this.nice){let t=this.forceTickCount??this.tickCount??10;"accurateFirst"===this.niceType&&(t=Math.max(10,t)),X(this.domain?.min)&&X(this.domain?.max)?this._scale.nice(t):Y(this.domain?.min)&&X(this.domain?.max)?this._scale.niceMax(t):X(this.domain?.min)&&Y(this.domain?.max)?this._scale.niceMin(t):this._scale.nice(t)}}includeZero(t){this.zero&&(t[0]=Math.min(t[0],0),t[t.length-1]=Math.max(t[t.length-1],0))}setExtendDomain(t,e){if(void 0===e)return void delete this._extend[t];this._extend[t]=e;const i=this._scale.domain();this.extendDomain(i),this.includeZero(i),this.setDomainMinMax(i),this.niceDomain(i),this._scale.domain(i,this.nice),this.niceMinMax()}extendDomain(t){let e;const i=t.length-1,r=t[0]-t[i]>0,n=r?i:0,o=r?0:i;for(const i in this._extend)e=this._extend[i],e>t[o]&&(t[o]=e),e<t[n]&&(t[n]=e)}setDomainMinMax(t){if(!this.domain)return;const{min:e,max:i}=this.domain;Y(e)&&(t[0]=e),Y(i)&&(t[1]=i)}setZero(t){this.zero!==t&&(this.zero=t,this.updateScaleDomain())}updateScaleDomain(){const t=this.computeDomain([this.domain]);this.updateScaleDomainByModel(t)}computeDomain(t){return this.computeLinearDomain(t)}updateScaleDomainByModel(t){t=t??this._scale.domain(),this.extendDomain(t),this.includeZero(t),this.setDomainMinMax(t),this.niceDomain(t),this._scale.domain(t,this.nice),this.niceMinMax()}updateRange(t){const[e,i]=this._scale.range();t[0]===e&&t[1]===i||this._scale.range(t)}}function L_(t,e){const i=e.option;gt(t)||i?.label?.flush&&function(t,e){const{width:i,height:r}=e.getLayoutRect(),n=r_(e.orient),o=!0===e.option.inverse,s=t[0],a=Tt(t);if(n)if(o){const t=i,e=0,r=s.AABBBounds.x2,n=a.AABBBounds.x1;r>t&&s.setAttributes({x:t,textAlign:"right"}),n<e&&a.setAttributes({x:e,textAlign:"left"})}else{const t=0,e=i,r=s.AABBBounds.x1,n=a.AABBBounds.x2;r<t&&s.setAttributes({x:t,textAlign:"left"}),n>e&&a.setAttributes({x:e,textAlign:"right"})}else if(o){const t=s.AABBBounds.y1,e=a.AABBBounds.y2,i=0,n=r;t<i&&s.setAttributes({y:i,textBaseline:"top"}),e>n&&a.setAttributes({y:n,textBaseline:"bottom"})}else{const t=r,e=0,i=s.AABBBounds.y2,n=a.AABBBounds.y1;i>t&&s.setAttributes({y:t,textBaseline:"bottom"}),n<e&&a.setAttributes({y:e,textBaseline:"top"})}}(t,e)}const k_=t=>t;class I_{width;height;x=0;y=0;table;option;orient;visible;type;inverse;data;tickData;scale;component;constructor(t,e,i,r,n){this.table=n,this.orient=t.orient??"left",this.type=t.type??"band",this.option=wt({},function(t){return t?.colorScheme?.default?.palette?wt({},e_,{tick:{style:{stroke:t.colorScheme.default.palette.axisDomainColor||"#D9DDE4"}},subTick:{style:{stroke:t.colorScheme.default.palette.axisDomainColor||"#D9DDE4"}},label:{style:{fill:t.colorScheme.default.palette.axisLabelFontColor||"#89909D"}},title:{style:{fill:t.colorScheme.default.palette.secondaryFontColor||"#333333"}}}):e_}(t.__vtableChartTheme),function(t,e){let i;"left"===t?i=e.axisStyle.leftAxisStyle:"right"===t?i=e.axisStyle.rightAxisStyle:"top"===t?i=e.axisStyle.topAxisStyle:"bottom"===t&&(i=e.axisStyle.bottomAxisStyle);return wt({},e.axisStyle.defaultAxisStyle,i)}(this.orient,n.theme),function(t,e,i){if(!i)return{};const r=i.axis;let n,o;"linear"===e||"log"===e||"symlog"===e?n=i.axisLinear:"band"===e&&(n=i.axisBand);"top"===t||"bottom"===t?o=i.axisX:"left"!==t&&"right"!==t||(o=i.axisY);return wt({},r,n,o)}(this.orient,this.type,t.__vtableChartTheme),t),"left"===this.orient||"right"===this.orient?(this.width=e,this.height=i-r[2],this.y=r[0]):"top"!==this.orient&&"bottom"!==this.orient||(this.width=e-r[1],this.height=i,this.x=r[3]),this.visible=t.visible??!0,this.inverse="inverse"in t&&!!t.inverse,"band"===t.type&&(this.data=t.domain),this.initScale(),this.initData(),this.createComponent(),this.initEvent()}initScale(){const t=this.option;"band"===this.type||"point"===this.type?(this.scale=new n_,this.scale.bandPadding=t.bandPadding,this.scale.paddingInner=t.paddingInner,this.scale.paddingOuter=t.paddingOuter,this.scale.calcScales(.1,.3),this.scale.updateScaleDomain(this.data),this.updateScaleRange()):"linear"!==this.type&&"time"!==this.type&&"log"!==this.type&&"symlog"!==this.type||(this.scale=new H_(this.type),this.scale.setExtraAttrFromSpec(t.nice,t.zero,t.range,t.expand,t.base,t.constant),this.scale.transformScaleDomain(),this.scale.updateScaleDomain(),this.updateScaleRange())}initData(){var t,e,i;!function(t,e,i){t.getParser(e)||t.registerParser(e,i)}(this.table._vDataSet,"scale",k_),t=this.table._vDataSet,e="ticks",i=M_,t.getTransform(e)||t.registerTransform(e,i);const r=this.option.label||{},n=this.option.tick||{},o=new c_(this.table._vDataSet).parse(this.scale._scale,{type:"scale"}).transform({type:"ticks",options:{sampling:!1!==this.option.sampling,tickCount:n.tickCount,forceTickCount:n.forceTickCount,tickStep:n.tickStep,tickMode:n.tickMode,noDecimals:n.noDecimals,axisOrientType:this.orient,coordinateType:"cartesian",labelStyle:r.style,labelFormatter:r.formatMethod,labelGap:r.minGap,labelLastVisible:r.lastVisible,labelFlush:r.flush}},!1);this.tickData=o,this.computeData()}computeData(){this.tickData.reRunAllTransform()}initEvent(){}createComponent(){const t=i_(this.option),e=this.getUpdateAttribute();e.verticalFactor="top"===this.orient||"right"===this.orient?-1:1,this.component=new Pw(wt({},t,e)),this.component.setAttributes(this.setLayoutStartPosition({x:0,y:0})),this.component.originAxis=this}resize(t,e){this.width=t,this.height=e,this.updateScaleRange(),this.computeData();const i=i_(this.option),r=this.getUpdateAttribute();r.verticalFactor="top"===this.orient||"right"===this.orient?-1:1,this.component.setAttributes(wt({},i,r)),this.component.setAttributes(this.setLayoutStartPosition({x:0,y:0})),this.overlap()}overlap(){!function(t,e){const i=t.find((t=>"axis-label-container-layer-0"===t.name),!0),r=t.find((t=>"axis-label-container-layer-1"===t.name),!0);L_(i?i.getChildren():[],e),L_(r?r.getChildren():[],e)}(this.component,this)}getLayoutRect(){return{width:this.width,height:this.height}}getUpdateAttribute(){this.table.tableNoFrameHeight,this.table.tableNoFrameWidth;const{width:t,height:e}=this.getLayoutRect(),i=r_(this.orient),r="left"===(n=this.orient)||"right"===n;var n;let o={x:0,y:0},s=0;i?(o={x:t,y:0},s=t):r&&(o={x:0,y:e},s=e);return{start:{x:this.x,y:this.y},end:o,title:{text:this.option.title.text,maxWidth:this._getTitleLimit(i)},items:this.getLabelItems(s)}}getLabelItems(t){return[this.tickData.latestData.map((e=>({id:e.value,label:e.value,value:0===t?0:this.scale.dataToPosition([e.value])/t,rawValue:e.value}))).filter((t=>t.value>=0&&t.value<=1))]}updateScaleRange(){const{width:t,height:e}=this.getLayoutRect(),i=this.option.inverse||!1;let r=[0,0];r_(this.orient)?st(t)&&(r=i?[t,0]:[0,t]):st(e)&&(r=i?[0,e]:[e,0]),this.scale.updateRange(r)}setLayoutStartPosition(t){let{x:e,y:i}=t;return st(e)&&(e+=Number("left"===this.orient)*this.getLayoutRect().width),st(i)&&(i+=Number("top"===this.orient)*this.getLayoutRect().height),{x:e,y:i}}_getTitleLimit(t){if(this.option.title.visible&&X(this.option.title.style?.maxLineWidth)){let e=this.option.title.style?.angle||0;if(this.option.title?.autoRotate&&X(this.option.title.angle)&&(e="left"===this.option.orient?-90:90),t){const t=this.getLayoutRect().width,i=Math.abs(Math.cos(pe(e)));return i<1e-6?1/0:t/i}const i=this.getLayoutRect().height,r=Math.abs(Math.sin(pe(e)));return r<1e-6?1/0:i/r}return null}getScale(){return this.scale._scale}getDomainSpec(){return this.scale.domain}}function F_(t,e,i,r,n,o){const s=function(t,e){const i=new Array(e);for(let r=0;r<e;r++)i[r]=t(r);return i}(t,i);s.sort(((t,e)=>r(o(t),o(e),n)));for(let t=0;t<i;t++)e(t,s[t])}function z_(t,e){if(t===e)return!0;if(t.length!==e.length)return!1;for(let i=0;i<t.length;i++)if(t[i]!==e[i])return!1;return!0}const O_={SOURCE_LENGTH_UPDATE:"source_length_update",CHANGE_ORDER:"change_order"};function D_(t,e){const i=XC(t);if(YC(i)){const t=i.then((t=>(e(t),t)));return e(t),t}return i}function W_(t,e,i,r,n,o){if(null==t)return;if(YC(t))return t.then((t=>W_(t,e,i,r,n,o)));const s=function(t){if(tv.isObject(t)){const e=t;if(Y(e.get)&&Y(e.set))return!0}return!1}(e)?e.get:e;if(s in t){return D_(t[s],o)}if("function"==typeof s){return D_(s(t,i,r,n),o)}if(Array.isArray(s)){const e=function(t,e){let i,r=t;for(;i=e.shift();)r=r[i];return r}(t,[...s]);return D_(e,o)}const a=`${s}`.split(".");if(a.length<=1){return D_(t[s],o)}return D_(KC(t,((t,e)=>W_(t,e,i,r,n,nv)),...a),o)}function N_(t,e){if(!t)return e;const i=t[e];return Y(i)?i:e}class G_ extends oC{_get;_sourceLength;_source;sortedIndexMap;lastOrder;lastOrderFn;lastOrderField;currentIndexedData=[];userPagination;pagination;_currentPagerIndexedData;enableHierarchyState=!1;static get EVENT_TYPE(){return O_}treeDataHierarchyState=new Map;beforeChangedRecordsMap=[];constructor(t,e,i){if(super(),this._get=t?.get.bind(t)||void 0,this._sourceLength=t?.length||0,this._source=t?.source??t,this.sortedIndexMap=new Map,this._currentPagerIndexedData=[],this.userPagination=e,this.pagination=e||{totalCount:this._sourceLength,perPageCount:this._sourceLength,currentPage:0},i>=1&&(this.enableHierarchyState=!0),this.currentIndexedData=Array.from({length:this._sourceLength},((t,e)=>e)),this.enableHierarchyState)for(let t=0;t<this._sourceLength;t++){this.getOriginalRecord(t).children&&this.treeDataHierarchyState.set(t,qy.collapse)}if(i>1){let t=this._sourceLength;for(let e=0;e<t;e++){const r=this.currentIndexedData[e],n=this.getOriginalRecord(r);if(n.children?.length>0){this.treeDataHierarchyState.set(Array.isArray(r)?r.join(","):r,qy.expand);const o=this.initChildrenNodeHierarchy(r,i,2,n);e+=o,t+=o}}}this.updatePagerData()}initChildrenNodeHierarchy(t,e,i,r){if(i>e)return 0;let n=0;const o=r.children?.length??0;for(let s=0;s<o;s++){n+=1;const o=r.children[s],a=Array.isArray(t)?t.concat(s):[t,s];this.currentIndexedData.splice(this.currentIndexedData.indexOf(t)+n,0,a),o.children?.length>0&&(i<e?this.treeDataHierarchyState.set(Array.isArray(a)?a.join(","):a,qy.expand):this.treeDataHierarchyState.set(Array.isArray(a)?a.join(","):a,qy.collapse)),n+=this.initChildrenNodeHierarchy(a,e,i+1,o)}return n}updatePagination(t){this.pagination=t||{totalCount:this._sourceLength,perPageCount:this._sourceLength,currentPage:0},this.updatePagerData()}updatePagerData(){const{currentIndexedData:t}=this,{perPageCount:e,currentPage:i}=this.pagination,r=e*(i||0),n=r+e;if(this._currentPagerIndexedData.length=0,t&&t.length>0){let e=-1;for(let i=0;i<t.length;i++)if((Array.isArray(t[i])&&1===t[i].length||!Array.isArray(t[i]))&&e++,e>=r&&e<n)this._currentPagerIndexedData.push(t[i]);else if(e>=n)break}else if(this._sourceLength>0)throw new Error("currentIndexedData should has values!")}get source(){return this._source}get(t){return this.getOriginalRecord(N_(this.currentPagerIndexedData,t))}getRaw(t){return this.getRawRecord(N_(this.currentPagerIndexedData,t))}getIndexKey(t){return N_(this.currentPagerIndexedData,t)}getTableIndex(t){return this.currentPagerIndexedData.findIndex((e=>e===t))}getField(t,e,i,r,n){return this.getOriginalField(N_(this.currentPagerIndexedData,t),e,i,r,n)}getRawField(t,e,i,r,n){return this.getRawFieldData(N_(this.currentPagerIndexedData,t),e,i,r,n)}hasField(t,e){return this.hasOriginalField(N_(this.currentPagerIndexedData,t),e)}getHierarchyState(t){const e=this.getIndexKey(t);return this.treeDataHierarchyState.get(Array.isArray(e)?e.join(","):e)??null}toggleHierarchyState(t){const e=this.currentIndexedData.slice(0),i=this.getIndexKey(t),r=this.getHierarchyState(t),n=this.getOriginalRecord(i);if(this.clearSortedIndexMap(),r===qy.collapse)this.treeDataHierarchyState.set(Array.isArray(i)?i.join(","):i,qy.expand),this.pushChildrenNode(i,qy.expand,n);else if(r===qy.expand){let t=0;const e=(i,r,n)=>{if(r&&r!==qy.collapse&&r!==qy.none&&n.children)for(let r=0;r<n.children.length;r++){t+=1;const o=Array.isArray(i)?i.concat([r]):[i,r];e(o,this.treeDataHierarchyState.get(o.join(",")),n.children[r])}};e(i,r,n),this.currentIndexedData.splice(this.currentIndexedData.indexOf(i)+1,t),this.treeDataHierarchyState.set(Array.isArray(i)?i.join(","):i,qy.collapse)}this.updatePagerData();const o=function(t,e){const i=[],r=[],n=new Map;for(let e=0;e<t.length;e++){const i=t[e],r=JSON.stringify(i);n.has(r)?n.get(r).push(e):n.set(r,[e])}for(let t=0;t<e.length;t++){const r=e[t],o=JSON.stringify(r);if(n.has(o)){const t=n.get(o);t.shift(),0===t.length&&n.delete(o)}else i.push(t)}for(let i=0;i<t.length;i++){const n=t[i];e.some((t=>z_(t,n)))||r.push(i)}return{add:i,remove:r}}(e,this.currentIndexedData);return o}pushChildrenNode(t,e,i){if(!e||e===qy.collapse||e===qy.none)return 0;let r=0;if(i.children){const e=Array.from({length:i.children.length},((t,e)=>e));this.lastOrder&&"normal"!==this.lastOrder&&this.lastOrderField&&F_((t=>Y(e[t])?e[t]:e[t]=t),((t,i)=>{e[t]=i}),i.children.length,this.lastOrderFn,this.lastOrder,(e=>this.getOriginalField(Array.isArray(t)?t.concat([e]):[t,e],this.lastOrderField)));for(let n=0;n<e.length;n++){r+=1;const o=Array.isArray(t)?t.concat([e[n]]):[t,e[n]];this.currentIndexedData.splice(this.currentIndexedData.indexOf(t)+r,0,o);const s=this.treeDataHierarchyState.get(o.join(",")),a=this.getOriginalRecord(o);!s&&a.children&&this.treeDataHierarchyState.set(o.join(","),qy.collapse),r+=this.pushChildrenNode(o,this.treeDataHierarchyState.get(o.join(",")),i.children[e[n]])}}return r}changeFieldValue(t,e,i,r,n,o){if(null!==i&&e>=0){const r=this.getIndexKey(e);if(!this.beforeChangedRecordsMap[r]){const t=this.getOriginalRecord(r);this.beforeChangedRecordsMap[r]=bt(t)}if("string"==typeof i||"number"==typeof i){const e=this.beforeChangedRecordsMap[r][i],n=this.getOriginalRecord(r);"number"==typeof e&&IC(t)?n[i]=parseFloat(t):n[i]=t}}}setRecord(t,e){const i=this.getIndexKey(e);if(Array.isArray(i)){const e=i[i.length-1];this.getOriginalRecord(i.slice(0,i.length-1)).children.splice(e,1,t)}else this.source.splice(i,1,t)}addRecord(t,e){if(this.source.splice(e,0,t),this.currentIndexedData.push(this.currentIndexedData.length),this._sourceLength+=1,this.userPagination){this.pagination.totalCount=this._sourceLength;const{perPageCount:t,currentPage:i}=this.pagination;e<t*(i||0)+t&&this.updatePagerData()}else this.pagination.perPageCount=this._sourceLength,this.pagination.totalCount=this._sourceLength,this.updatePagerData()}addRecords(t,e){if(Array.isArray(t)){this.source.splice(e,0,...t);for(let e=0;e<t.length;e++)this.currentIndexedData.push(this.currentIndexedData.length);this._sourceLength+=t.length}if(this.userPagination){this.pagination.totalCount=this._sourceLength;const{perPageCount:t,currentPage:i}=this.pagination;e<t*(i||0)+t&&this.updatePagerData()}else this.pagination.perPageCount=this._sourceLength,this.pagination.totalCount=this._sourceLength,this.updatePagerData()}addRecordForSorted(t){this.source.push(t),this.currentIndexedData.push(this.currentIndexedData.length),this._sourceLength+=1,this.sortedIndexMap.clear(),this.userPagination||(this.pagination.perPageCount=this._sourceLength,this.pagination.totalCount=this._sourceLength)}addRecordsForSorted(t){if(Array.isArray(t)){this.source.push(...t);for(let e=0;e<t.length;e++)this.currentIndexedData.push(this.currentIndexedData.length);this._sourceLength+=t.length,this.sortedIndexMap.clear()}this.userPagination||(this.pagination.perPageCount=this._sourceLength,this.pagination.totalCount=this._sourceLength)}deleteRecordsForSorted(t){const e=t.sort(((t,e)=>e-t));for(let t=0;t<e.length;t++){const i=e[t];if(i>=this._sourceLength||i<0)continue;const r=this.currentIndexedData[i];this.source.splice(r,1),this._sourceLength-=1}this.sortedIndexMap.clear(),this.userPagination||(this.pagination.perPageCount=this._sourceLength,this.pagination.totalCount=this._sourceLength)}deleteRecords(t){const e=[],i=t.sort(((t,e)=>e-t));for(let t=0;t<i.length;t++){const r=i[t];r>=this._sourceLength||r<0||(e.push(r),this.source.splice(r,1),this.currentIndexedData.pop(),this._sourceLength-=1)}return this.userPagination||(this.pagination.perPageCount=this._sourceLength,this.pagination.totalCount=this._sourceLength),this.updatePagerData(),e}sort(t,e,i=("desc"!==e?(t,e)=>t===e?0:t>e?1:-1:(t,e)=>t===e?0:t<e?1:-1)){this.lastOrderField=t,this.lastOrder=e,this.lastOrderFn=i;let r,n=this.sortedIndexMap.get(t);if(n&&(r=n[e],r&&r.length>0))return this.currentIndexedData=r,this.updatePagerData(),void this.fireListeners(O_.CHANGE_ORDER,null);const o=[];if("normal"===e)for(let t=0;t<this._sourceLength;t++)o[t]=t;else F_((t=>Y(o[t])?o[t]:o[t]=t),((t,e)=>{o[t]=e}),this._sourceLength,i,e,(e=>this.getOriginalField(e,t)));if(this.currentIndexedData=o,this.enableHierarchyState){let t=o.length;window.performance.now();for(let e=0;e<t;e++){const i=this.pushChildrenNode(o[e],this.treeDataHierarchyState.get(o[e]),this.getOriginalRecord(o[e]));t+=i,e+=i}}n||(n={asc:[],desc:[],normal:[]},this.sortedIndexMap.set(t,n)),n[e]=o,this.updatePagerData(),this.fireListeners(O_.CHANGE_ORDER,null)}clearSortedIndexMap(){this.lastOrderField&&this.lastOrder&&this.sortedIndexMap.forEach(((t,e)=>{e!==this.lastOrderField?this.sortedIndexMap.delete(e):"asc"===this.lastOrder?(t.desc=[],t.normal=[]):"desc"===this.lastOrder?(t.asc=[],t.normal=[]):(t.desc=[],t.asc=[])}))}get sourceLength(){return this._sourceLength}set sourceLength(t){this._sourceLength!==t&&(this._sourceLength=t,this.fireListeners(O_.SOURCE_LENGTH_UPDATE,this._sourceLength))}get length(){return this.currentPagerIndexedData.length}get dataSource(){return this}get currentPagerIndexedData(){return this._currentPagerIndexedData.length>0?this._currentPagerIndexedData:[]}release(){super.release?.()}clearSortedMap(){this.currentIndexedData&&(this.currentIndexedData.length=0),this.currentIndexedData=null,this.sortedIndexMap.forEach((t=>{t.asc&&(t.asc.length=0),t.desc&&(t.desc.length=0)})),this.sortedIndexMap.clear()}clearCurrentIndexedData(){this.currentIndexedData=null,this.currentPagerIndexedData.length=0}getOriginalRecord(t){return D_(this._get(t),(e=>{this.recordPromiseCallBack(t,e)}))}getRawRecord(t){return this.beforeChangedRecordsMap?.[t]?this.beforeChangedRecordsMap[t]:D_(this._get(t),(e=>{this.recordPromiseCallBack(t,e)}))}getOriginalField(t,e,i,r,n){if(null===e)return;return W_(this.getOriginalRecord(t),e,i,r,n,(i=>{this.fieldPromiseCallBack(t,e,i)}))}getRawFieldData(t,e,i,r,n){if(null===e)return;return W_(this.getRawRecord(t),e,i,r,n,(i=>{this.fieldPromiseCallBack(t,e,i)}))}hasOriginalField(t,e){if(null===e)return!1;if("function"==typeof e)return!0;const i=this.getOriginalRecord(t);return Boolean(i&&e in i)}fieldPromiseCallBack(t,e,i){}recordPromiseCallBack(t,e){}static EMPTY=new G_({get(){},length:0})}class j_ extends G_{_recordCache;_fieldCache;static get EVENT_TYPE(){return G_.EVENT_TYPE}static ofArray(t,e,i){return new j_({get:e=>Array.isArray(e)?function(t,e){let i=t;for(let t=0;t<e.length;t++){const r=e[t];if(!i[r])return;i=i[r],i&&i.children&&t+1<e.length&&(i=i.children)}return i}(t,e):t[e],length:t.length,source:t},e,i)}constructor(t,e,i){super(t,e,i),this._recordCache={},this._fieldCache={}}getOriginalRecord(t){return this._recordCache&&this._recordCache[t]?this._recordCache[t]:super.getOriginalRecord(t)}getOriginalField(t,e,i,r,n){const o=this._fieldCache&&this._fieldCache[t];if(o){const t=o.get(e);if(t)return t}return super.getOriginalField(t,e,i,r,n)}clearCache(){this._recordCache&&(this._recordCache={}),this._fieldCache&&(this._fieldCache={})}fieldPromiseCallBack(t,e,i){!function(t,e,i,r){(t[e]||(t[e]=new Map)).set(i,r)}(this._fieldCache,t,e,i)}recordPromiseCallBack(t,e){this._recordCache[t]=e}release(){super.release?.()}}var U_=Object.freeze({__proto__:null,CachedDataSource:j_,DataSource:G_}),V_={exports:{}},K_={},$_=new RegExp(["^\\s*(?=(?:(?:[-a-z]+\\s*){0,2}(italic|oblique))?)","(?=(?:(?:[-a-z]+\\s*){0,2}(small-caps))?)","(?=(?:(?:[-a-z]+\\s*){0,2}(bold(?:er)?|lighter|[1-9]00 ))?)","(?:(?:normal|\\1|\\2|\\3)\\s*){0,3}((?:xx?-)?","(?:small|large)|medium|smaller|larger|[\\.\\d]+(?:\\%|in|[cem]m|ex|p[ctx]))","(?:\\s*\\/\\s*(normal|[\\.\\d]+(?:\\%|in|[cem]m|ex|p[ctx])?))","?\\s*([-,\\\"\\'\\sa-z]+?)\\s*$"].join(""),"i"),X_=["style","variant","weight","size","lineHeight","family"],Y_=/([\.0-9]+)(.*)/,q_=function(t,e,i){var r=t.match(Y_);if(r){t=parseFloat(r[1]);var n=r[2].toLowerCase().trim(),o=Math.round(t);switch(o===t&&(t=o),n){case"em":if(null===e)return;return t*e;case"px":return t;case"pt":return t/(72/i);case"pc":return t/(6/i);case"mm":return t*(i/25.4);case"cm":return t*(i/2.54);case"in":return t*i;case"%":if(null===e)return;return e*(t/100)}}},Z_={size:q_,lineHeight:q_},J_={serif:1,"sans-serif":1,cursive:1,fantasy:1,monospace:1},Q_=V_.exports=function(t,e,i){var r=t+"-"+(e||"null")+"@"+i;if(i=i||96,void 0!==K_[r])return K_[r];if(e&&(e=Q_(e,null,i)),"inherit"===t)return e;var n=$_.exec(t);if(n){n.shift();for(var o={},s=0;s<n.length;s++){var a=X_[s],l=n[s];if(Z_[a]&&l){var h=e&&e[a]||null,c=Z_[a](l,h,i);l=void 0===c&&"lineHeight"===a&&l?o.size*parseFloat(l):c}if(l&&"normal"!==l){if("inherit"===l){if(!e)return;l=e[a]}l.trim&&(l=l.trim()),o[a]=l}}Object.keys(o).length||(o=null),K_[r]=o;var d=[];o.style&&d.push(o.style),o.variant&&d.push(o.variant),o.weight&&"400"!==o.weight&&"normal"!==o.weight&&d.push(o.weight),d.push(o.size+"px"),o.lineHeight&&(d[d.length-1]+="/"+o.lineHeight+"px");var u=o.family.split(",");return o.family=u.map((function(t){return t=t.trim(),J_[t.toLowerCase()]&&(t=t.toLowerCase()),t})),d.push(o.family),Object.defineProperty(o,"toString",{value:function(){return d.map((function(t){return Array.isArray(t)?t.map((function(t){return t.indexOf(" ")>-1?'"'+t.replace(/["']/g,"")+'"':t})).join(", "):t})).join(" ")}}),o}K_[r]=null};V_.exports.generics=J_;var tS=G(V_.exports);function eS(t){if(ot(t)||et(t)||it(t)){let e=Yn(t);return"number"==typeof e||"string"==typeof e?e=[e,e,e,e]:Array.isArray(e)&&(e=e.slice(0)),e}return t&&(isFinite(t.bottom)||isFinite(t.left)||isFinite(t.right)||isFinite(t.top))?[t.top??0,t.right??0,t.bottom??0,t.left??0]:[0,0,0,0]}const iS=0,rS=1,nS=2,oS=3,sS=10,aS=11,lS=12,hS=9,cS=13,dS=10,uS=12,gS=32,pS=37,fS=46,mS=48,bS=57,yS=65,CS=90,vS=97,wS=122;function xS(t){return function(t){return t>=vS&&t<=wS}(t)||function(t){return t>=yS&&t<=CS}(t)}function _S(t){return t===hS||t===dS||t===uS||t===cS||t===gS}function SS(t){return t>=mS&&t<=bS}function AS(t){return t===fS}function BS(t){return xS(t)||t===pS}function TS(t){return new Error(`calc parse error: ${t}`)}const MS={"*":3,"/":3,"+":2,"-":2};function RS(t,e){function i(t){const i=t.pop(),r=t.pop(),n=t.pop();if(!(n&&n.nodeType&&r&&r.type===nS&&i&&i.nodeType))throw TS(e);return{nodeType:aS,left:n,op:r,right:i}}const r=[];for(;t.length;){const n=t.shift();if(n.type===iS&&"("===n.value){let i=0;const n=DC.findIndex(t,(t=>{if(t.type===iS&&"("===t.value)i++;else if(t.type===iS&&")"===t.value){if(!i)return!0;i--}return!1}));if(-1===n)throw TS(e);r.push(RS(t.splice(0,n),e)),t.shift()}else if(n.type===nS){if(r.length>=3){const t=r[r.length-2].value;MS[n.value]<=MS[t]&&r.push(i(r))}r.push(n)}else if(n.type===rS){const{value:t,unit:e}=n;r.push({nodeType:sS,value:t,unit:e})}else n.type===oS&&r.push({nodeType:lS,value:n.value})}for(;r.length>1;)r.push(i(r));return r[0]}function PS(t){const e=function(t){const e=t.replace(/calc\(/g,"(").trim(),i=[],r=e.length;for(let s=0;s<r;s++){const r=e[s],a=r.charCodeAt(0);if("("===r||")"===r)i.push({value:r,type:iS});else if("*"===r||"/"===r)i.push({value:r,type:nS});else if("+"===r||"-"===r)s=n(r,s+1)-1;else if(SS(a)||AS(a))s=o(r,s+1)-1;else if(!_S(a))throw TS(t)}function n(t,n){if(n<r){const i=e[n],r=i.charCodeAt(0);if(SS(r)||AS(r))return o(t+i,n+1)}return i.push({value:t,type:nS}),n}function o(n,o){let a=o;for(;a<r;a++){const i=e[a],r=i.charCodeAt(0);if(SS(r))n+=i;else{if("."!==i){if(BS(r))return s(n,i,a+1);break}if(n.indexOf(".")>=0)throw TS(t);n+=i}}if("."===n)throw TS(t);return i.push({value:parseFloat(n),type:oS}),a}function s(t,n,o){let s=o;for(;s<r;s++){const t=e[s];if(!BS(t.charCodeAt(0)))break;n+=t}return i.push({value:parseFloat(t),unit:n,type:rS}),s}return i}(t);return RS(e,t)}function ES(t,e){if(t.nodeType===aS){const i=ES(t.left,e),r=ES(t.right,e);switch(t.op.value){case"+":return i+r;case"-":return i-r;case"*":return i*r;case"/":return i/r;default:throw new Error(`calc error. unknown operator: ${t.op.value}`)}}else if(t.nodeType===sS)switch(t.unit){case"%":return t.value*e.full/100;case"px":return t.value;default:throw new Error(`calc error. unknown unit: ${t.unit}`)}else if(t.nodeType===lS)return t.value;throw new Error("calc error.")}function HS(t,e){return ES(PS(t),e)}function LS(t){return!!et(t)&&(!!t.endsWith("%")&&function(t){return!(X(t)||!ot(t)&&+t!=+t)}(t.substring(0,t.length-1)))}function kS(t,e){const{dataSourceEventIds:i}=t.internalProps;i&&i.forEach((e=>t.internalProps.handler.off(e))),e(t),t.internalProps.dataSourceEventIds=[t.internalProps.handler.on(t.internalProps.dataSource,G_.EVENT_TYPE.CHANGE_ORDER,(()=>{t.dataSource.enableHierarchyState&&t.refreshRowColCount(),t.render()}))]}function IS(t,e=[]){kS(t,(()=>{const i=e;t.internalProps.records=e;const r=t.internalProps.dataSource=j_.ofArray(i,t.pagination,t.options.hierarchyExpandLevel??(t._hasHierarchyTreeHeader?.()?1:void 0));t.addReleaseObj(r)}))}function FS(t,e){kS(t,(()=>{if(e)if(e instanceof G_)t.internalProps.dataSource=e;else{const i=t.internalProps.dataSource=new j_(e);t.addReleaseObj(i)}else t.internalProps.dataSource=G_.EMPTY;t.internalProps.records=null}))}function zS(t,e){return Math.round((i=e,r=t.internalProps.calcWidthContext,"string"==typeof i?HS(i.trim(),r):i-0));var i,r}function OS(t,e,i,r,n,o=!0){const s=eS(n("padding",t,i,r,e)),a=n("bgColor",t,i,r,e),l=n("font",t,i,r,e);let h,c,d;if(l){const{family:t,size:e,weight:i}=function(t){return tS(t)}(l);h=t.join(" "),c=e,d=i}else h=n("fontFamily",t,i,r,e),c=n("fontSize",t,i,r,e),d=n("fontWeight",t,i,r,e);const u=n("textAlign",t,i,r,e),g=n("textBaseline",t,i,r,e),p=n("color",t,i,r,e),f=n("lineHeight",t,i,r,e),m=n("underline",t,i,r,e),b=n("lineThrough",t,i,r,e),y=Math.max(1,Math.floor(c/10)),C=n("textOverflow",t,i,r,e),v=n("borderColor",t,i,r,e),w=n("borderLineWidth",t,i,r,e),x=n("borderLineDash",t,i,r,e),_=n("marked",t,i,r,e),S=n("cursor",t,i,r,e),A=!(s&&a&&l&&u&&g&&p&&C&&v&&w&&x&&"boolean"==typeof m&&"boolean"==typeof b&&"boolean"==typeof _);if(!o)return{hasFunctionPros:A};const B={text:{fontFamily:h,fontSize:c,fontWeight:d,fill:p,textAlign:u,textBaseline:g,lineHeight:f??c,underline:m?y:void 0,lineThrough:b?y:void 0,ellipsis:C&&"clip"!==C?"ellipsis"===C?"...":C:void 0},group:{fill:a,lineDash:x,lineWidth:w,stroke:v,cursor:"auto"===S||"default"===S?void 0:S},_vtable:{padding:s,marked:_}};if(Array.isArray(w)&&(B.group.strokeArrayWidth=eS(w)),Array.isArray(v)){const t=eS(v);B.group.stroke=!t.every((t=>!t))&&t,B.group.strokeArrayColor=eS(v)}return{theme:B,hasFunctionPros:A}}function DS(t){if(t.sortState){let e,i,r;if(Array.isArray(t.sortState)?0!==t.sortState.length&&({order:e,field:i,fieldKey:r}=t.sortState?.[0]):({order:e,field:i,fieldKey:r}=t.sortState),e&&i&&"normal"!==e){const n=t._getSortFuncFromHeaderOption(void 0,i,r);let o;o=r?t.internalProps.layoutMap.headerObjects.find((t=>t&&t.fieldKey===r)):t.internalProps.layoutMap.headerObjects.find((t=>t&&t.field===i)),t.dataSource.sort(o.field,e,n??kC)}}}function WS(t,e,i){const r=i.theme.frameStyle.cornerRadius;if(r){if(0===t&&0===e)return[r,0,0,0];if(t===i.colCount-1&&0===e)return[0,r,0,0];if(0===t&&e===i.rowCount-1)return[0,0,0,r];if(t===i.colCount-1&&e===i.rowCount-1)return[0,0,r,0]}return 0}let NS=class extends Sl{role;tooltip;constructor(t){super(t),"mouseenter_cell"!==this.attribute.visibleTime&&"click_cell"!==this.attribute.visibleTime||(this.attribute.opacity=0),this.attribute.hoverImage&&(this.attribute.originImage=this.attribute.image)}get backgroundWidth(){return this.attribute.backgroundWidth??this.attribute.width??0}get backgroundHeight(){return this.attribute.backgroundHeight??this.attribute.height??0}};function GS(t,e,i,r,n,o,s,a,l,h){let c,d,u,g,p=!0,f=!1;if("function"==typeof t){const e=t({col:i,row:r,dataValue:h.getCellOriginValue(i,r),value:h.getCellValue(i,r)||"",rect:{left:0,top:0,right:n,bottom:o,width:n,height:o},table:h});e.rootContainer&&(e.rootContainer=VS(e.rootContainer)),e.rootContainer instanceof hs&&(g=e.rootContainer,g.name="custom-container"),p=e.renderDefault,f=e.enableCellPadding}else if("function"==typeof e){const t=e({col:i,row:r,dataValue:h.getCellOriginValue(i,r),value:h.getCellValue(i,r)||"",rect:{left:0,top:0,right:n,bottom:o,width:n,height:o},table:h});t&&(u=t.elements,p=t.renderDefault,c=t.expectedWidth,d=t.expectedHeight)}else e&&(c=e.expectedWidth,d=e.expectedHeight,u=e.elements,p=e.renderDefault);if(u){g=function(t,e,i,r){const n=new hs({x:0,y:0,width:e,height:i,fill:!1,stroke:!1,pickable:!1});n.name="custom-container";const o=function(t,e,i,r){const n=[],o=0,s=0,a=[0,0,0,0];for(let l=0;l<t.length;l++){const h=t[l],c=Object.assign({},h);for(const t in c)c.hasOwnProperty(t)&&$(c[t])&&(c[t]=c[t](r));const d=c;Y(d.x)&&(d.x=et(d.x)?jS(d.x,e-a[1]):Number(d.x)),Y(d.y)&&(d.y=et(d.y)?jS(d.y,i-a[2]):Number(d.y)),"width"in c&&(c.width=et(c.width)?jS(c.width,e-a[1]):Number(c.width)),"height"in c&&(c.height=et(c.height)?jS(c.height,i-a[2]):Number(c.height)),"radius"in c&&(c.radius=et(c.radius)?jS(c.radius,Math.min(e-a[1],i-a[2])):Number(c.radius)),"hover"in c&&(c.hover.x=et(c.hover.x)?jS(c.hover.x,e-a[1]):Number(c.hover.x),c.hover.y=et(c.hover.y)?jS(c.hover.y,i-a[2]):Number(c.hover.y),c.hover.width=et(c.hover.width)?jS(c.hover.width,e-a[1]):Number(c.hover.width),c.hover.height=et(c.hover.height)?jS(c.hover.height,i-a[2]):Number(c.hover.height),c.hover.x+=o,c.hover.y+=s),d.x=d.x+o,d.y=d.y+s,n.push(c)}return n}(t,e,i,r);return o.forEach((t=>{switch(t.clickable&&(t.pickable=t.clickable),t.type){case"arc":const e=Wl({x:t.x,y:t.y,dx:t.dx??0,dy:t.dy??0,fill:t.fill,stroke:t.stroke,outerRadius:t.radius,startAngle:t.startAngle,endAngle:t.endAngle,pickable:!!t.pickable,cursor:t.cursor});n.appendChild(e);break;case"text":if(t.background){const e=t.background?.expandX??0,i=t.background?.expandY??0,r=fl({x:t.x-e,y:t.y-i,dx:t.dx??0,dy:t.dy??0,width:t.width+2*e,height:t.height+2*i,cornerRadius:t.background?.cornerRadius??0,fill:t.background?.fill??"#888"});n.appendChild(r)}const i=new ta(Object.assign({pickable:!!t.pickable,fill:t.color??t.fill},t));n.appendChild(i);break;case"rect":const r=fl({x:t.x,y:t.y,dx:t.dx??0,dy:t.dy??0,width:t.width,height:t.height,cornerRadius:t.radius,fill:t.fill,stroke:t.stroke,pickable:!!t.pickable,cursor:t.cursor});n.appendChild(r);break;case"circle":const o=Xs({x:t.x,y:t.y,dx:t.dx??0,dy:t.dy??0,radius:t.radius,fill:t.fill,stroke:t.stroke,pickable:!!t.pickable,cursor:t.cursor});n.appendChild(o);break;case"icon":const s=new NS({x:t.x,y:t.y,dx:t.dx??0,dy:t.dy??0,width:t.width,height:t.height,image:t.svg,backgroundWidth:t.hover?t.hover.width??t.width:void 0,backgroundHeight:t.hover?t.hover.width??t.width:void 0,backgroundColor:t.hover?t.hover.bgColor??"rgba(22,44,66,0.2)":void 0,pickable:!!t.pickable,cursor:t.cursor});s.role="icon-custom",n.appendChild(s);break;case"image":const a=new NS({x:t.x,y:t.y,dx:t.dx??0,dy:t.dy??0,width:t.width,height:t.height,image:t.src,backgroundWidth:t.hover?t.hover.width??t.width:void 0,backgroundHeight:t.hover?t.hover.width??t.width:void 0,backgroundColor:t.hover?t.hover.bgColor??"rgba(22,44,66,0.2)":void 0,pickable:!!t.pickable,cursor:t.cursor,shape:t.shape});a.role="image-custom",n.appendChild(a);break;case"line":const l=ul({points:t.points,stroke:t.stroke,pickable:!!t.pickable,cursor:t.cursor});n.appendChild(l)}})),n}(u,s?c:n,a?d:o,h.getCellValue(i,r))}return f&&g.setAttributes({x:l[3],y:l[0],width:n-l[1]-l[3],height:o-l[0]-l[2]}),US(g,n,o),{elementsGroup:g,renderDefault:p}}function jS(t,e){return t.endsWith("px")?parseInt(t,10):t.endsWith("%")&&e?parseInt(t,10)/100*e:parseInt(t,10)}function US(t,e,i){t&&t.forEachChildren((t=>{t&&(q(t.attribute.width)&&t.attribute.width.percent&&t.setAttribute("width",t.attribute.width.percent/100*e+(t.attribute.width.delta??0)),q(t.attribute.height)&&t.attribute.height.percent&&t.setAttribute("height",t.attribute.height.percent/100*i+(t.attribute.height.delta??0)),"group"===t.type&&US(t,t.attribute.width,t.attribute.height))}))}function VS(t){if(!t||!t.$$typeof)return t;const e=t.type,{attribute:i,children:r,stateProxy:n}=t.props,o=e({attribute:i});return function(t,e){let i=!1;switch(t.type){case"richtext":case"rich/image":break;default:i=!0}i&&Object.keys(e).forEach((i=>{const r=$g[i];r&&t.on(r,e[i])}))}(o,t.props),n&&(o.stateProxy=n),o.id=i.id,o.name=i.name,it(r)?r.forEach((t=>{const e=VS(t);o.add(e)})):r&&o.add(VS(r)),o}const KS={};class $S{static cache=new Map;static setIcon(t,e){this.cache.set(t,e)}static getIcon(t){return this.cache.has(t)?this.cache.get(t):null}static hasIcon(t){return this.cache.has(t)}static clear(t){return this.cache.delete(t)}static clearAll(){this.cache=new Map}}const XS={get sort_downward(){return{type:"svg",svg:'<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg"> <path d="M4.6665 9H11.3332L7.99984 13.1667L4.6665 9Z" fill="#282F38" fill-opacity="0.35"/><path d="M11.3335 7L4.66683 7L8.00016 2.83333L11.3335 7Z" fill="#416EFF"/> </svg>',width:16,height:16,funcType:tC.sort,name:"sort_downward",positionType:Qy.contentRight,marginLeft:3,hover:{width:22,height:22,bgColor:"rgba(101, 117, 168, 0.1)"},cursor:"pointer"}},get sort_upward(){return{type:"svg",svg:'<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg"> <path d="M4.6665 9H11.3332L7.99984 13.1667L4.6665 9Z" fill="#416EFF"/><path d="M11.3335 7L4.66683 7L8.00016 2.83333L11.3335 7Z" fill="#282F38" fill-opacity="0.35"/></svg> ',width:16,height:16,funcType:tC.sort,positionType:Qy.contentRight,name:"sort_upward",marginLeft:3,hover:{width:22,height:22,bgColor:"rgba(101, 117, 168, 0.1)"},cursor:"pointer"}},get sort_normal(){return{type:"svg",svg:'<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M4.6665 9H11.3332L7.99984 13.1667L4.6665 9Z" fill="#282F38" fill-opacity="0.35"/><path d="M11.3335 7L4.66683 7L8.00016 2.83333L11.3335 7Z" fill="#282F38" fill-opacity="0.35"/></svg> ',width:16,height:16,funcType:tC.sort,positionType:Qy.contentRight,name:"sort_normal",marginLeft:3,hover:{width:22,height:22,bgColor:"rgba(101, 117, 168, 0.1)"},cursor:"pointer"}},get freeze(){return{type:"svg",svg:'<svg width="22" height="22" viewBox="0 0 22 22" fill="none" xmlns="http://www.w3.org/2000/svg"><g clip-path="url(#clip0)"><path d="M17.1313 8.42047C17.1932 8.48238 17.2423 8.55587 17.2759 8.63676C17.3094 8.71764 17.3266 8.80434 17.3266 8.89189C17.3266 8.97944 17.3094 9.06613 17.2759 9.14702C17.2423 9.2279 17.1932 9.3014 17.1313 9.3633L13.3843 13.1103C13.7007 14.3048 13.5305 15.4443 12.8388 16.2395C12.8104 16.2781 12.7778 16.3136 12.7417 16.3451L12.712 16.3755C12.6501 16.4374 12.5766 16.4865 12.4957 16.52C12.4148 16.5535 12.3281 16.5707 12.2406 16.5707C12.153 16.5707 12.0663 16.5535 11.9854 16.52C11.9046 16.4865 11.8311 16.4374 11.7692 16.3755L9.17633 13.7826L6.05316 16.9058L5.11983 17.0925C5.09291 17.0979 5.06508 17.0965 5.03881 17.0886C5.01254 17.0806 4.98863 17.0663 4.96923 17.0469C4.94982 17.0275 4.9355 17.0036 4.92755 16.9773C4.9196 16.951 4.91827 16.9232 4.92366 16.8963L5.11033 15.963L8.23333 12.8396L5.64066 10.2471C5.57875 10.1852 5.52964 10.1117 5.49614 10.0309C5.46263 9.94997 5.44539 9.86327 5.44539 9.77572C5.44539 9.68817 5.46263 9.60148 5.49614 9.52059C5.52964 9.43971 5.57875 9.36621 5.64066 9.3043C5.65066 9.2943 5.66066 9.2843 5.67099 9.27464C5.70266 9.2383 5.73833 9.20547 5.77766 9.17664C6.57283 8.48564 7.71199 8.31564 8.90599 8.63197L12.6528 4.88497C12.7147 4.82306 12.7882 4.77395 12.8691 4.74045C12.95 4.70694 13.0367 4.6897 13.1242 4.6897C13.2118 4.6897 13.2985 4.70694 13.3794 4.74045C13.4603 4.77395 13.5338 4.82306 13.5957 4.88497L17.1312 8.42047H17.1313ZM15.7172 8.8918L13.1243 6.29914L9.56483 9.8588C9.47574 9.94788 9.36323 10.0099 9.24034 10.0376C9.11746 10.0654 8.98922 10.0578 8.87049 10.0156C8.22783 9.78764 7.63899 9.7553 7.17749 9.89814L12.1182 14.8388C12.261 14.3771 12.2287 13.7885 12.0007 13.146C11.9585 13.0272 11.9509 12.899 11.9787 12.7761C12.0064 12.6532 12.0684 12.5407 12.1575 12.4516L15.7172 8.89164V8.8918Z" fill="#282F38" fill-opacity="0.2"/></g><defs><clipPath id="clip0"><rect width="22" height="22" fill="white"/></clipPath></defs></svg>',width:22,height:22,name:"freeze",funcType:tC.frozen,positionType:Qy.right,marginRight:0,hover:{width:22,height:22,bgColor:"rgba(101, 117, 168, 0.1)"},cursor:"pointer"}},get frozen(){return{type:"svg",svg:'<svg width="22" height="22" viewBox="0 0 22 22" fill="none" xmlns="http://www.w3.org/2000/svg"> <path d="M8.49975 3.66663C8.32294 3.66663 8.15337 3.73686 8.02835 3.86189C7.90332 3.98691 7.83309 4.15648 7.83309 4.33329V9.63246C6.76475 10.2533 6.07942 11.1795 6.00625 12.2308C5.99892 12.2786 5.99692 12.3268 6.00009 12.3741L5.99975 12.4166C5.99975 12.5934 6.06999 12.763 6.19501 12.888C6.32004 13.0131 6.48961 13.0833 6.66642 13.0833H10.3333L10.3331 17.5L10.8611 18.292C10.8763 18.3148 10.8969 18.3335 10.9211 18.3464C10.9453 18.3594 10.9723 18.3662 10.9998 18.3662C11.0272 18.3662 11.0542 18.3594 11.0784 18.3464C11.1026 18.3335 11.1232 18.3148 11.1384 18.292L11.6664 17.5L11.6666 13.0833H15.3331C15.5099 13.0833 15.6795 13.0131 15.8045 12.888C15.9295 12.763 15.9998 12.5934 15.9998 12.4166C15.9998 12.4025 15.9998 12.3883 15.9994 12.3741C16.0028 12.3263 16.0008 12.2776 15.9933 12.2295C15.9196 11.1786 15.2343 10.2528 14.1664 9.63229V4.33329C14.1664 4.15648 14.0962 3.98691 13.9712 3.86189C13.8461 3.73686 13.6766 3.66663 13.4998 3.66663H8.49975Z" fill="#282F38" fill-opacity="0.35"/></svg>',width:22,height:22,name:"frozen",funcType:tC.frozen,positionType:Qy.right,marginRight:0,hover:{width:22,height:22,bgColor:"rgba(101, 117, 168, 0.1)"},cursor:"pointer"}},get frozenCurrent(){return{type:"svg",svg:'<svg width="22" height="22" viewBox="0 0 22 22" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M8.49975 3.66663C8.32294 3.66663 8.15337 3.73686 8.02835 3.86189C7.90332 3.98691 7.83309 4.15648 7.83309 4.33329V9.63246C6.76475 10.2533 6.07942 11.1795 6.00625 12.2308C5.99892 12.2786 5.99692 12.3268 6.00009 12.3741L5.99975 12.4166C5.99975 12.5934 6.06999 12.763 6.19501 12.888C6.32004 13.0131 6.48961 13.0833 6.66642 13.0833H10.3333L10.3331 17.5L10.8611 18.292C10.8763 18.3148 10.8969 18.3335 10.9211 18.3464C10.9453 18.3594 10.9723 18.3662 10.9998 18.3662C11.0272 18.3662 11.0542 18.3594 11.0784 18.3464C11.1026 18.3335 11.1232 18.3148 11.1384 18.292L11.6664 17.5L11.6666 13.0833H15.3331C15.5099 13.0833 15.6795 13.0131 15.8045 12.888C15.9295 12.763 15.9998 12.5934 15.9998 12.4166C15.9998 12.4025 15.9998 12.3883 15.9994 12.3741C16.0028 12.3263 16.0008 12.2776 15.9933 12.2295C15.9196 11.1786 15.2343 10.2528 14.1664 9.63229V4.33329C14.1664 4.15648 14.0962 3.98691 13.9712 3.86189C13.8461 3.73686 13.6766 3.66663 13.4998 3.66663H8.49975Z" fill="#416EFF"/></svg>',width:22,height:22,funcType:tC.frozen,positionType:Qy.right,name:"frozenCurrent",marginRight:0,hover:{width:22,height:22,bgColor:"rgba(101, 117, 168, 0.1)"},cursor:"pointer"}},get dropdownIcon(){return{type:"svg",svg:'<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"><g><rect x="2" y="1" width="20" height="20" rx="10" fill="white"/><rect x="2.5" y="1.5" width="19" height="19" rx="9.5" stroke="#959DA5"/></g><path d="M14.9492 9.39531C15.0086 9.31911 15.0165 9.21887 14.9698 9.1356C14.923 9.05234 14.8294 9 14.7273 9L9.27273 9C9.17057 9 9.07697 9.05234 9.03023 9.1356C8.98348 9.21887 8.99142 9.31911 9.0508 9.39531L11.7781 12.8953C11.8293 12.961 11.9119 13 12 13C12.0881 13 12.1707 12.961 12.2219 12.8953L14.9492 9.39531Z" fill="#4F5965"/></svg>',width:24,height:24,funcType:tC.dropDown,positionType:Qy.absoluteRight,name:"dropdownIcon",marginRight:0,hover:{width:24,height:24,bgColor:"rgba(101, 117, 168, 0.1)",image:'<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"><g><rect x="2" y="1" width="20" height="20" rx="10" fill="#1E54C9"/><rect x="2.5" y="1.5" width="19" height="19" rx="9.5" stroke="#141414" stroke-opacity="0.2"/></g><path d="M14.9492 9.39531C15.0086 9.31911 15.0165 9.21887 14.9698 9.1356C14.923 9.05234 14.8294 9 14.7273 9L9.27273 9C9.17057 9 9.07697 9.05234 9.03023 9.1356C8.98348 9.21887 8.99142 9.31911 9.0508 9.39531L11.7781 12.8953C11.8293 12.961 11.9119 13 12 13C12.0881 13 12.1707 12.961 12.2219 12.8953L14.9492 9.39531Z" fill="white"/></svg>'},cursor:"pointer",visibleTime:"mouseenter_cell"}},get play(){return{type:"svg",svg:'<svg width="24" height="24" viewBox="0 0 48 48" fill="none" xmlns="http://www.w3.org/2000/svg"><rect width="48" height="48" fill="white" fill-opacity="0.01" /><path d="M24 44C35.0457 44 44 35.0457 44 24C44 12.9543 35.0457 4 24 4C12.9543 4 4 12.9543 4 24C4 35.0457 12.9543 44 24 44Z" fill="none" stroke="#686a6e" stroke-width="4" stroke-linejoin="round" stroke-opacity="0.7" /><path d="M20 24V17.0718L26 20.5359L32 24L26 27.4641L20 30.9282V24Z" fill="none" stroke="#686a6e" stroke-width="4" stroke-linejoin="round" stroke-opacity="0.7" /></svg>',width:24,height:24,funcType:tC.play,positionType:Qy.right,name:"play",marginRight:0,hover:{width:24,height:24,bgColor:"rgba(101, 117, 168, 0.1)"},cursor:"pointer"}},get damage_pic(){return{type:"svg",svg:'<svg width="24" height="24" viewBox="0 0 48 48" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M5 10V38C5 39.1046 5.89543 40 7 40H14H18L15 29L22 27L21 20L29 16L27 13L30 8H7C5.89543 8 5 8.89543 5 10Z" fill="none" stroke="#333" stroke-width="4" stroke-linecap="round" stroke-linejoin="round"/><path d="M43 38V10C43 8.89543 42.1046 8 41 8H38L34 14L37 19L28 23L29 31L22 33L24 40H41C42.1046 40 43 39.1046 43 38Z" fill="none" stroke="#333" stroke-width="4" stroke-linecap="round" stroke-linejoin="round"/><path fill-rule="evenodd" clip-rule="evenodd" d="M14.5 18C15.3284 18 16 17.3284 16 16.5C16 15.6716 15.3284 15 14.5 15C13.6716 15 13 15.6716 13 16.5C13 17.3284 13.6716 18 14.5 18Z" fill="none" stroke="#333" stroke-width="4" stroke-linecap="round" stroke-linejoin="round"/></svg>',width:24,height:24,funcType:tC.damagePic,positionType:Qy.left,name:"damage_pic",marginRight:0,hover:{width:24,height:24,bgColor:"rgba(101, 117, 168, 0.1)"},cursor:"pointer"}},get expand(){return{type:"svg",svg:'<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 16 16" fill="none">\n      <path d="M4.64988 6.81235C4.38797 6.48497 4.62106 6 5.04031 6L10.9597 6C11.3789 6 11.612 6.48497 11.3501 6.81235L8.39043 10.512C8.19027 10.7622 7.80973 10.7622 7.60957 10.512L4.64988 6.81235Z" fill="#141414" fill-opacity="0.65"/>\n      </svg>',width:16,height:16,funcType:tC.expand,name:"expand",positionType:Qy.contentLeft,marginLeft:0,marginRight:4,hover:{width:22,height:22,bgColor:"rgba(101, 117, 168, 0.1)"},cursor:"pointer"}},get collapse(){return{type:"svg",svg:'<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 16 16" fill="none">\n      <path d="M5.81235 11.3501C5.48497 11.612 5 11.3789 5 10.9597L5 5.04031C5 4.62106 5.48497 4.38797 5.81235 4.64988L9.51196 7.60957C9.76216 7.80973 9.76216 8.19027 9.51196 8.39044L5.81235 11.3501Z" fill="#141414" fill-opacity="0.65"/>\n      </svg>',width:16,height:16,funcType:tC.collapse,name:"collapse",positionType:Qy.contentLeft,marginLeft:0,marginRight:4,hover:{width:22,height:22,bgColor:"rgba(101, 117, 168, 0.1)"},cursor:"pointer"}},get drillDown(){return{name:"drillDown",type:"svg",positionType:Qy.absolute,funcType:tC.drillDown,svg:'<svg class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><path d="M810.666667 85.333333c70.688 0 128 57.312 128 128v597.333334c0 70.688-57.312 128-128 128H213.333333c-70.688 0-128-57.312-128-128V213.333333c0-70.688 57.312-128 128-128h597.333334z m0 85.333334H213.333333a42.666667 42.666667 0 0 0-42.613333 40.533333L170.666667 213.333333v597.333334a42.666667 42.666667 0 0 0 40.533333 42.613333L213.333333 853.333333h597.333334a42.666667 42.666667 0 0 0 42.613333-40.533333L853.333333 810.666667V213.333333a42.666667 42.666667 0 0 0-40.533333-42.613333L810.666667 170.666667zM549.333333 288a5.333333 5.333333 0 0 1 5.333334 5.333333V469.333333h176a5.333333 5.333333 0 0 1 5.333333 5.333334v74.666666a5.333333 5.333333 0 0 1-5.333333 5.333334H554.666667v176a5.333333 5.333333 0 0 1-5.333334 5.333333h-74.666666a5.333333 5.333333 0 0 1-5.333334-5.333333V554.666667H293.333333a5.333333 5.333333 0 0 1-5.333333-5.333334v-74.666666a5.333333 5.333333 0 0 1 5.333333-5.333334H469.333333V293.333333a5.333333 5.333333 0 0 1 5.333334-5.333333h74.666666z"></path></svg>',width:13,height:13,cursor:"pointer"}},get drillUp(){return{name:"drillUp",type:"svg",positionType:Qy.absolute,funcType:tC.drillUp,svg:'<svg class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><path d="M810.666667 85.333333c70.688 0 128 57.312 128 128v597.333334c0 70.688-57.312 128-128 128H213.333333c-70.688 0-128-57.312-128-128V213.333333c0-70.688 57.312-128 128-128h597.333334z m0 85.333334H213.333333a42.666667 42.666667 0 0 0-42.613333 40.533333L170.666667 213.333333v597.333334a42.666667 42.666667 0 0 0 40.533333 42.613333L213.333333 853.333333h597.333334a42.666667 42.666667 0 0 0 42.613333-40.533333L853.333333 810.666667V213.333333a42.666667 42.666667 0 0 0-40.533333-42.613333L810.666667 170.666667zM693.333333 469.333333a42.666667 42.666667 0 1 1 0 85.333334H330.666667a42.666667 42.666667 0 1 1 0-85.333334h362.666666z"></path></svg>',width:13,height:13,cursor:"pointer"}}};function YS(){return VC(XS,KS)}let qS=class extends hs{role;col;row;mergeStartCol;mergeStartRow;mergeEndCol;mergeEndRow;contentWidth;contentHeight;rowNumber;colHeight;border;needUpdate;needUpdateWidth;needUpdateHeight;clear(){this.removeAllChild()}getChildByName(t,e){let i=null;return this.forEachChildren((e=>e.name===t&&(i=e,!0))),e&&this.forEachChildren((e=>{if(e.getChildByName){const r=e.getChildByName(t,!0);if(r)return i=r,!0}return!1})),i}get width(){let t=this.AABBBounds.width();return t!==1/0&&t!==-1/0||(t=0),Math.max(t,this.attribute.width??0)}get height(){let t=this.AABBBounds.height();return t!==1/0&&t!==-1/0||(t=0),Math.max(t,this.attribute.height??0)}setDeltaWidth(t){0!==t&&(this.setAttribute("width",(this.attribute.width??0)+t),this.border&&(this.border.setAttribute("width",this.border.attribute.width+t),"group"===this.border.type&&this.border.firstChild.setAttribute("width",this.border.firstChild.attribute.width+t)))}setDeltaHeight(t){0!==t&&(this.setAttribute("height",(this.attribute.height??0)+t),this.border&&(this.border.setAttribute("height",this.border.attribute.height+t),"group"===this.border.type&&this.border.firstChild.setAttribute("width",this.border.firstChild.attribute.height+t)))}setDeltaX(t){0!==t&&this.setAttribute("x",this.attribute.x+t)}setDeltaY(t){0!==t&&this.setAttribute("y",this.attribute.y+t)}forEachChildrenSkipChild(t,e="border-rect",i=!1){if(i){let i=this._lastChild,r=0;for(;i;){if(i.name!==e){if(t(i,r++))return}i=i._prev}}else{let i=this._firstChild,r=0;for(;i;){if(i.name!==e){if(t(i,r++))return}i=i._next}}}getColGroup(t){let e=this._firstChild;if(!e)return null;for(let i=0;i<this.childrenCount;i++){if(e.col===t)return e;e=e._next}return null}getRowGroup(t){let e=this._firstChild;if(!e)return null;for(let i=0;i<this.childrenCount;i++){if(e.row===t)return e;e=e._next}return null}getChildAt(t){const e=super.getChildAt(t);return e&&"border-rect"===e.name?e._next:e}tryUpdateAABBBounds(){if("cell"===this.role){if(!this.shouldUpdateAABBBounds())return this._AABBBounds;const t=this.shouldSelfChangeUpdateAABBBounds(),e=this.doUpdateAABBBounds();return this.addUpdateLayoutTag(),function(t,e){if(!t.stage.dirtyBounds)return;if(!t.stage||!t.stage.renderCount)return;if(t.isContainer&&!e)return;t.stage.dirty(t.globalAABBBounds)}(this,t),e}return super.tryUpdateAABBBounds()}doUpdateAABBBounds(){if("cell"===this.role){const t=this.attribute,{x:e,y:i,width:r,height:n}=t;return this._AABBBounds.setValue(e,i,e+r,i+n),this.parent&&this.parent.addChildUpdateBoundTag(),this.clearUpdateBoundTag(),this._AABBBounds}return"body"===this.role||"row-header"===this.role||"col-header"===this.role||"right-frozen"===this.role||"bottom-frozen"===this.role||"corner-header"===this.role||"corner-right-top-header"===this.role||"corner-right-bottom-header"===this.role||"corner-left-bottom-header"===this.role?(this._AABBBounds.setValue(-1/0,-1/0,1/0,1/0),this.parent&&this.parent.addChildUpdateBoundTag(),this.clearUpdateBoundTag(),this._AABBBounds):super.doUpdateAABBBounds()}updateColumnRowNumber(t){this.rowNumber?this.rowNumber=Math.max(this.rowNumber,t):this.rowNumber=t}updateColumnHeight(t){this.colHeight?this.colHeight+=t:this.colHeight=t}};function ZS(t,e,i,r){let n=t,o=e;return n>i&&(n=i,o=n*e/t),o>r&&(o=r,n=o*t/e),{width:n,height:o}}function JS(t,e,i,r,n,o,s="left",a="middle",l=[0,0,0,0],h=0,c=0,d=0,u=0){const g=t+i,p=e+r;let f=t+l[3]+h;"right"===s||"end"===s?f=g-n-l[1]-c:"center"===s&&(f=t+(i-n+h-c)/2);let m=e+l[0]+d;return"bottom"===a||"alphabetic"===a||"ideographic"===a?m=p-o-l[2]-u:"middle"===a&&(m=e+(r-o+d-u)/2),{x:f,y:m}}function QS(t,e,i,r,n){const o=e&&Y(e[t])?e[t]:null;if("function"==typeof o){return o({col:i,row:r,table:n,value:n.getCellValue(i,r),dataValue:n.getCellOriginValue(i,r),cellHeaderPaths:n.getCellHeaderPaths(i,r)})}return o}function tA(t,e,i,r,n){const o=e&&Y(e[t])?e[t]:null;if("function"==typeof o){return o({col:i,row:r,table:n,value:n.getCellValue(i,r),dataValue:n.getCellOriginValue(i,r),cellHeaderPaths:n.getCellHeaderPaths(i,r)})}}function eA(t,e,i,r,n,o){let s=!1,a=null,l=null;return n.table.getColWidth(t)<i+o[1]+o[3]&&(a=i+o[1]+o[3],s=!0),n.table.getRowHeight(e)<r+o[2]+o[0]&&(l=r+o[2]+o[0],s=!0),!!s&&("number"==typeof a&&n.setColWidth(t,a),"number"==typeof l&&n.setRowHeight(e,l),n.component.updateScrollBar(),!0)}function iA(t,e,i,r){const n=t.getChildByName("image"),o="string"!=typeof n.attribute.image&&n.attribute.image||n.resources?.get(n.attribute.image).data;if(!o)return;const s=r._getCellStyle(e,i),a=QS("textAlign",s,e,i,r)??"left",l=QS("textBaseline",s,e,i,r)??"middle",h=eS(QS("padding",s,e,i,r))??[0,0,0,0];if(n.keepAspectRatio){const{width:e,height:i}=ZS(o.width||o.videoWidth,o.height||o.videoHeight,t.attribute.width-(h[1]+h[3]),t.attribute.height-(h[0]+h[2])),r=JS(0,0,t.attribute.width,t.attribute.height,e,i,a,l,h);n.setAttributes({x:r.x,y:r.y,width:e,height:i})}else n.setAttributes({x:h[3],y:h[0],width:t.attribute.width-h[1]-h[3],height:t.attribute.height-h[0]-h[2]});const c=t.getChildByName("play-icon");if(c){const e=0,i=0,r=t.attribute.width,o=t.attribute.height,s=Math.floor(Math.min(r-h[1]-h[3],o-h[2]-h[0])/2),a=e+(r>n.attribute.width?n.attribute.x-e+n.attribute.width/2:r/2),l=i+(o>n.attribute.height?n.attribute.y-i+n.attribute.height/2:o/2);c.setAttributes({x:a-s/2,y:l-s/2,width:s,height:s})}}function rA(t,e,i,r,n,o,s,a,l){t.dependField&&(n=l.getCellOriginRecord(o,s)?.[t.dependField]??n),t.barType=t.barType??"default",t.min=t.min??0,t.max=t.max??t.min+100;const h=l.getRowHeight(s);let c=i,d=h;const u=new qS({x:0,y:0,width:c,height:d});u.name="progress-bar";const{showBar:g,barColor:p,barBgColor:f,barPositiveColor:m,barNegativeColor:b,barAxisColor:y,barRightToLeft:C,showBarMark:v,barMarkPositiveColor:w,barMarkNegativeColor:x,barMarkWidth:_,barMarkPosition:S}=e;let{barHeight:A,barBottom:B,barPadding:T}=e;1===T.length?T=[T[0],T[0],T[0],T[0]]:2===T.length?T=[T[0],T[1],T[0],T[1]]:3===T.length&&(T=[T[0],T[1],T[2],T[1]]),T=T.map(((t,e)=>{if("string"==typeof t&&ev.endsWith(t,"%")){const r=Number(t.substr(0,t.length-1));return 0===e||2===e?h*r/100:i*r/100}return Number(t)}));const M=eS(QS("borderLineWidth",e,o,s,l));let R=Math.max(T[0],M[0]);const P=Math.max(T[1],M[1]),E=Math.max(T[2],M[2]);let H=Math.max(T[3],M[3]);c-=P+H,d-=E+R,1&R&&(R+=.5),1&H&&(H+=.5);const L=R,k=H,I=c;"string"==typeof A&&ev.endsWith(A,"%")?(A=Number(A.substr(0,A.length-1)),A=d*A/100):A=Number(A),"string"==typeof B&&ev.endsWith(B,"%")?(B=Number(B.substr(0,B.length-1)),B=d*B/100):B=Number(B);if(XC(g,{col:o,row:s,table:l,context:null,value:r,dataValue:n})){let e=`${n}`;ev.endsWith(e,"%")&&(e=e.substr(0,e.length-1));const i=Number(e);if(isNaN(i))return u;if("default"===(t.barType??"default")){const e=i<t.min?0:i>t.max?1:(i-t.min)/(t.max-t.min),a=c,h=L+d-A-B,g=Math.min(a*e,a),m=C?k+I-g:k,b=XC(f,{col:o,row:s,table:l,context:null,value:r,dataValue:n,percentile:e});if(b){const t=fl({x:m,y:h,width:a,height:A,fill:b});u.addChild(t)}const y=fl({x:m,y:h,width:g,height:A,fill:XC(p,{col:o,row:s,table:l,context:null,value:r,dataValue:n,percentile:e})||"#20a8d8"});u.addChild(y)}else if("negative"===t.barType){const e=t.min<0?-t.min:0,a=t.max>0?t.max:0,g=e/(e+a),p=1-g,T=i>0?i/a:0,M=i<0?-i/e:0,R=c,P=L+d-A-B,E=k,H=XC(f,{col:o,row:s,table:l,context:null,value:r,dataValue:n,percentile:T});if(H){const t=fl({x:E,y:P,width:R,height:A,fill:H});u.addChild(t)}const I=C?p*R:g*R,F=Math.min(R*g*M,R),z=C?{left:E+I,top:P,width:F,height:A}:{left:E+I-F,top:P,width:F,height:A},O=XC(b,{col:o,row:s,table:l,context:null,value:r,dataValue:n,percentile:M})||"#20a8d8",D=fl({x:z.left,y:z.top,width:z.width,height:z.height,fill:O});u.addChild(D);const W=Math.min(R*p*T,R),N=C?{left:E+I-W,top:P,width:W,height:A}:{left:E+I,top:P,width:W,height:A},G=XC(m,{col:o,row:s,table:l,context:null,value:r,dataValue:n,percentile:T})||"#20a8d8",j=fl({x:N.left,y:N.top,width:N.width,height:N.height,fill:G});u.addChild(j);const U=C?z.left:N.left,V=ul({x:0,y:0,stroke:XC(y),lineWidth:1,lineDash:[2,2],points:[{x:U,y:0},{x:U,y:h}]});if(u.addChild(V),v&&(T||M)){const t=_,e=[];let i;if(T>0)if(i=XC(w,{col:o,row:s,table:l,context:null,value:r,dataValue:n,percentile:T})||"#20a8d8","right"===S){const t=C?N.left+_/2:N.left+N.width-_/2;e.push({x:t,y:N.top}),e.push({x:t,y:N.top+N.height})}else"bottom"===S&&(e.push({x:N.left,y:N.top+N.height-_/2}),e.push({x:N.left+N.width,y:N.top+N.height-_/2}));else if(M>0)if(i=XC(x,{col:o,row:s,table:l,context:null,value:r,dataValue:n,percentile:M})||"#20a8d8","right"===S){const t=C?z.left+z.width-_/2:z.left+_/2;e.push({x:t,y:z.top}),e.push({x:t,y:z.top+z.height})}else"bottom"===S&&(e.push({x:z.left,y:z.top+z.height-_/2}),e.push({x:z.left+z.width,y:z.top+z.height-_/2}));const a=ul({x:0,y:0,stroke:i,lineWidth:t,points:e});u.addChild(a)}}else if("negative_no_axis"===t.barType){const e=t.min<0?-t.min:0,a=t.max>0?t.max:0,h=Math.max(e,a),g=0===h?0:Math.abs(i)/h,p=c,y=Math.min(p*g,p),T=L+d-A-B,M=C?k+I-y:k,R=XC(f,{col:o,row:s,table:l,context:null,value:r,dataValue:n,percentile:g});if(R){const t=fl({x:M,y:T,width:p,height:A,fill:R});u.addChild(t)}const P={left:M,top:T,width:y,height:A};let E;E=i>=0?XC(m,{col:o,row:s,table:l,context:null,value:r,percentile:g,dataValue:n})||"#20a8d8":XC(b,{col:o,row:s,table:l,context:null,value:r,dataValue:n,percentile:g})||"#20a8d8";const H=fl({x:P.left,y:P.top,width:P.width,height:P.height,fill:E});if(u.addChild(H),v&&i){const t=_,e=[];let a;if(a=i>=0?XC(w,{col:o,row:s,table:l,context:null,value:r,dataValue:n,percentile:g})||"#20a8d8":XC(x,{col:o,row:s,table:l,context:null,value:r,dataValue:n,percentile:g})||"#20a8d8","right"===S){const t=C?P.left+_/2:P.left+P.width-_/2;e.push({x:t,y:P.top}),e.push({x:t,y:P.top+P.height})}else"bottom"===S&&(e.push({x:P.left,y:P.top+P.height-_/2}),e.push({x:P.left+P.width,y:P.top+P.height-_/2}));const h=ul({x:0,y:0,stroke:a,lineWidth:t,points:e});u.addChild(h)}}}return u}YS();const nA=new class extends gx{constructor(t){super(!1),this.type=Kw.Point,this._padding=0,this.paddingInner(1,t),this.padding=this.paddingOuter,this.paddingInner=void 0,this.paddingOuter=void 0}},oA=new Lx;function sA(t,e,i,r,n,o,s,a,l,h,c){t||((t=new qS({x:i,y:r,width:s,height:a,lineWidth:c?.group?.lineWidth??void 0,fill:c?.group?.fill??void 0,stroke:c?.group?.stroke??void 0,strokeArrayWidth:c?.group?.strokeArrayWidth??void 0,strokeArrayColor:c?.group?.strokeArrayColor??void 0,cursor:c?.group?.cursor??void 0,lineCap:"square",clip:!0,cornerRadius:c.group.cornerRadius})).role="cell",t.col=n,t.row=o,e?.addChild(t));const d=function(t,e,i,r,n,o){let s,a;const l=o.internalProps.layoutMap.getBody(t,e).sparklineSpec,h=o.getCellValue(t,e);if(!Array.isArray(h))return;const c=n[3],d=n[0];i-=n[1]+n[3],r-=n[0]+n[2];const u=0,g=r;if("function"==typeof l){const n={col:t,row:e,dataValue:o.getCellOriginValue(t,e)||"",value:o.getCellValue(t,e)||"",rect:o.getCellRangeRelativeRect(o.getCellRange(t,e)),table:o};s=l(n),a=aA(s,c,d,i,r)}else s=l,a=aA(l,c,d,i,r);const p=[],f=[];let m,b;if("object"==typeof s.xField)nA.domain(s.xField.domain),m=s.xField.field;else if("string"==typeof s.xField){const t=h.map((t=>t[s.xField]));nA.domain(t),m=s.xField}else Array.isArray(h)&&(nA.domain(Array.from({length:h.length},((t,e)=>e))),m=s.xField);if(nA.range([0,i]),"object"==typeof s.yField)oA.domain(s.yField.domain),b=s.yField.field;else if("string"==typeof s.yField){const t=h.map((t=>t[s.yField]));oA.domain([Math.min(...t),Math.max(...t)]),b=s.yField}else Array.isArray(h)&&h.every((t=>"number"==typeof t))&&(oA.domain([Math.min(...h),Math.max(...h)]),b=s.yField);if(oA.range([0,r]),"object"==typeof s.xField&&Array.isArray(s.xField.domain)){const t=h.map((t=>t[s.xField.field])),e=s.xField.domain;for(let i=0;i<e.length;i++){let r=!1;for(let n=0;n<t.length;n++)if(e[i]==t[n]){const t=h[n];if(!Y(t[m])||!Y(t[b]))break;p.push({x:u+nA.scale(t[m]),y:g-oA.scale(t[b]),defined:Y(t[b])}),f.push(t),r=!0;break}r||(p.push({x:u+nA.scale(e[i]),y:0,defined:!1}),f.push({[m]:e[i],[b]:null}))}}else for(let t=0;t<h.length;t++){const e=h[t];p.push({x:u+nA.scale(m?e[m]:t),y:g-oA.scale(b?e[b]:e),defined:Y(b?e[b]:e),rawData:e}),f.push(e)}const y=a.getChildByName("sparkline-line");y&&y.setAttribute("points",p);y.bandwidth=nA.step(),y.min=oA.range()[0],y.max=oA.range()[1];const C=a.getChildByName("sparkline-symbol-group");if(C){const t="isolatedPoint"===s.pointShowRule;if("all"===s.pointShowRule)for(let t=0;t<p.length;t++){const{x:e,y:i,defined:r}=p[t];if(r){const t=hl({x:e,y:i});C.appendChild(t)}}else if(t)for(let t=0;t<p.length;t++){const{x:e,y:i,defined:r}=p[t];if(r&&(!p[t-1]||!p[t-1].defined)&&(!p[t+1]||!p[t+1].defined)){const t=hl({x:e,y:i});C.appendChild(t)}}}return a}(n,o,s,a,l,h);return d&&t.appendChild(d),t}function aA(t,e,i,r,n){let o;o="function"==typeof t?t(null):t;const s=new qS({x:e,y:i,width:r,height:n,stroke:!1,fill:!1});if(s.name="sparkline","line"===o.type){const t=ul({x:0,y:0,curveType:o.smooth?"monotoneX":"linear",stroke:o.line?.style?.stroke??"blue",lineWidth:o.line?.style?.strokeWidth??2});t.name="sparkline-line",s.addChild(t),o.crosshair&&(t.hover=o.crosshair?.style??{stroke:"#000",interpolate:"linear"});const e=new qS({x:0,y:0,width:r,height:n,stroke:!1,fill:!1});e.name="sparkline-symbol-group",e.setTheme({symbol:{stroke:o.point?.style?.stroke??"#000",lineWidth:o.point?.style?.strokeWidth??1,fill:o.point?.style?.fill??"#000",size:2*(o.point?.style?.size??3),symbolType:"circle"}}),s.addChild(e),e.hover=o.point?.hover??!1}return s}const lA=Fo();class hA extends hs{type="chart";chartInstance;activeChartInstance;active;cacheCanvas;constructor(t){super(t),this.numberType=lA,t.chartInstance?this.chartInstance=t.chartInstance:(t.chartInstance=this.chartInstance=new t.ClassType(t.spec,{renderCanvas:t.canvas,mode:"node"===this.attribute.mode?"node":"desktop-browser",modeParams:this.attribute.modeParams,canvasControled:!1,viewBox:{x1:0,x2:0,y1:0,y2:0},dpr:t.dpr,interactive:!1,animation:!1,autoFit:!1}),this.chartInstance.renderSync())}activate(t){this.active=!0;const{col:e,row:i}=this.parent,{x1:r,y1:n,x2:o,y2:s}=this.getViewBox(),a=function(t,e,i){const{layoutMap:r}=i.internalProps,n=new ue,o=i.scenegraph.tableGroup.globalAABBBounds;n.x1=o.x1,n.x2=o.x2,n.y1=o.y1,n.y2=o.y2,r.isFrozenColumn(t,e)||r.isRightFrozenColumn(t,e)?r.isLeftBottomCorner(t,e)||r.isRightTopCorner(t,e)||(r.isFrozenColumn(t,e)||r.isRightFrozenColumn(t,e)?(n.y1=o.y1+i.getFrozenRowsHeight(),n.y2=o.y2-i.getBottomFrozenRowsHeight()):r.isBottomFrozenRow(t,e)&&(n.x1=o.x1+i.getFrozenColsWidth(),n.x2=o.x2-i.getRightFrozenColsWidth())):(n.x1=o.x1+i.getFrozenColsWidth(),n.x2=o.x2-i.getRightFrozenColsWidth(),n.y1=o.y1+i.getFrozenRowsHeight(),n.y2=o.y2-i.getBottomFrozenRowsHeight());return n}(e,i,t),l=a.intersect({x1:r-t.scrollLeft,x2:o-t.scrollLeft,y1:n-t.scrollTop,y2:s-t.scrollTop});this.activeChartInstance=new this.attribute.ClassType(this.attribute.spec,{renderCanvas:this.attribute.canvas,mode:"desktop-browser",canvasControled:!1,viewBox:{x1:r-t.scrollLeft,x2:o-t.scrollLeft,y1:n-t.scrollTop,y2:s-t.scrollTop},dpr:t.internalProps.pixelRatio,animation:!1,interactive:!0,autoFit:!1,beforeRender:t=>{const e=t.window.getContext();e.inuse=!0,e.clearMatrix(),e.setTransformForCurrent(!0),e.beginPath(),e.rect(l.x1,l.y1,l.x2-l.x1,l.y2-l.y1),e.clip()},afterRender(t){t.window.getContext().inuse=!1}}),this.activeChartInstance.renderSync(),t.internalProps.layoutMap?.updateDataStateToActiveChartInstance?.(this.activeChartInstance),this.activeChartInstance.on("click",(e=>{hA.temp&&t.scenegraph.updateChartState(e?.datum)})),this.activeChartInstance.on("brushEnd",(e=>{t.scenegraph.updateChartState(e?.value?.inBrushData),hA.temp=0,setTimeout((()=>{hA.temp=1}),0)})),t._bindChartEvent?.(this.activeChartInstance)}static temp=1;deactivate(){this.active=!1,this.activeChartInstance?.updateViewBox({x1:-1e3,x2:-800,y1:-1e3,y2:-800},!1,!1),this.activeChartInstance?.release(),this.activeChartInstance=null}updateData(t){this.attribute.data=t}getViewBox(){const t=this.parent,e=this.attribute.cellPadding,i=this.stage.table;return{x1:Math.ceil(t.globalAABBBounds.x1+e[3]+i.scrollLeft),x2:Math.ceil(t.globalAABBBounds.x1+t.attribute.width-e[1]+i.scrollLeft),y1:Math.ceil(t.globalAABBBounds.y1+e[0]+i.scrollTop),y2:Math.ceil(t.globalAABBBounds.y1+t.attribute.height-e[2]+i.scrollTop)}}}const cA={},dA={};function uA(t,e,i,r,n,o,s,a,l,h,c,d,u,g,p,f){const m=VC(dA,cA)[c],b=tA("padding",p._getCellStyle(n,o),n,o,p);Y(b)&&(l=b),t||((t=new qS({x:i,y:r,width:s,height:a,lineWidth:f?.group?.lineWidth??void 0,fill:f?.group?.fill??void 0,stroke:f?.group?.stroke??void 0,strokeArrayWidth:f?.group?.strokeArrayWidth??void 0,strokeArrayColor:f?.group?.strokeArrayColor??void 0,cursor:f?.group?.cursor??void 0,lineCap:"square",clip:!0,cornerRadius:f.group.cornerRadius})).role="cell",t.col=n,t.row=o,e?.addChild(t)),t.AABBBounds.width();const y=new hA({stroke:!1,x:l[3],y:l[0],canvas:p.canvas??p.scenegraph.stage.window.getContext().canvas,mode:p.options.mode,modeParams:p.options.modeParams,spec:d,ClassType:m,width:s-l[3]-l[1],height:a-l[2]-l[0],chartInstance:u,dataId:g,data:p.getCellValue(n,o),cellPadding:l,dpr:p.internalProps.pixelRatio,axes:p.isPivotChart()?p.internalProps.layoutMap.getChartAxes(n,o):[]});return t.appendChild(y),p.internalProps.layoutMap.setChartInstance(n,o,y.chartInstance),t}class gA extends qS{_leftGroup;_rightGroup;_centerGroup;_autoWidth=!1;_autoHeight=!1;_cellWidth;_originCellWidth;_cellHeight;_align;_baseline;constructor(t){super(t),this._leftGroup=new qS({pickable:!1,fill:!1,stroke:!1}),this._leftGroup.role="content-left",this._rightGroup=new qS({pickable:!1,fill:!1,stroke:!1}),this._rightGroup.role="content-right",this._centerGroup=new qS({pickable:!1,fill:!1,stroke:!1}),this._centerGroup.role="content-center",this.appendChild(this._leftGroup),this.appendChild(this._rightGroup),this.appendChild(this._centerGroup)}setCellContentOption(t){this._autoWidth=t.autoWidth,this._autoHeight=t.autoHeight,this._cellWidth=t.cellWidth,this._originCellWidth=t.cellWidth,this._cellHeight=t.cellHeight,this._align=t.align,this._baseline=t.baseline}addLeftOccupyingIcon(t){t.setAttribute("x",this._leftGroup.width+(t.attribute.marginLeft??0)),this._leftGroup.appendChild(t),this._leftGroup.setDeltaWidth((t.attribute.marginLeft??0)+(t.attribute.marginRight??0)+t.attribute.width)}addRightOccupyingIcon(t){t.setAttribute("x",this._rightGroup.width+(t.attribute.marginLeft??0)),this._rightGroup.appendChild(t),this._rightGroup.setDeltaWidth((t.attribute.marginLeft??0)+(t.attribute.marginRight??0)+t.attribute.width)}addContent(t){const e=this._centerGroup.lastChild;e&&t.setAttributes({x:e.attribute.x+e.AABBBounds.width()}),this._centerGroup.appendChild(t),t instanceof ta&&(this._centerGroup.setAttribute("pickable",!1),t.setAttribute("textAlign","left"))}layout(){let t=this._leftGroup.width;t===1/0&&(t=0);let e=this._rightGroup.width;if(e===-1/0&&(e=0),this._autoWidth){const i=this._centerGroup.width;this._cellWidth=t+e+i,this.setAttribute("width",this._cellWidth)}else{const i=this._cellWidth-t-e;this.updateCenterLayout(i);const r=this._centerGroup.width;this._cellWidth=t+e+r,this.setAttribute("width",this._cellWidth)}this.updateHorizontalPos();const i=this._leftGroup.height,r=this._rightGroup.height,n=this._centerGroup.height;this._cellHeight=Math.max(i,r,n),this.setAttribute("height",this._cellHeight),this.updateVerticalPos()}updateCenterLayout(t){let e=t;this._centerGroup.forEachChildren((t=>{t instanceof NS&&(e-=t.AABBBounds.width())}));const i=this._centerGroup.getChildByName("text");i instanceof Pl?i.setAttribute("width",e):i instanceof ta&&i.setAttribute("maxLineWidth",e);let r=0;this._centerGroup.forEachChildren((t=>{t.setAttribute("x",r),r+=t.AABBBounds.width()}))}updateHorizontalPos(){this._leftGroup.setAttribute("x",0),this._rightGroup.setAttribute("x",this._cellWidth-this._rightGroup.width),this._centerGroup.setAttribute("x",this._leftGroup.width),"left"===this._align||"start"===this._align?this.setAttribute("dx",0):"center"===this._align?this.setAttribute("dx",-this.attribute.width/2):"right"!==this._align&&"end"!==this._align||this.setAttribute("dx",-this.attribute.width)}updateVerticalPos(){"top"===this._baseline?(this._leftGroup.setAttribute("y",0),this._rightGroup.setAttribute("y",0),this._centerGroup.setAttribute("y",0)):"middle"===this._baseline?(this._leftGroup.forEachChildren((t=>{t.setAttribute("y",(this._leftGroup.height-t.AABBBounds.height())/2)})),this._rightGroup.forEachChildren((t=>{t.setAttribute("y",(this._rightGroup.height-t.AABBBounds.height())/2)})),this._leftGroup.setAttribute("y",this._cellHeight/2-this._leftGroup.height/2),this._rightGroup.setAttribute("y",this._cellHeight/2-this._rightGroup.height/2),this._centerGroup.setAttribute("y",this._cellHeight/2-this._centerGroup.height/2)):"bottom"===this._baseline&&(this._leftGroup.forEachChildren((t=>{t.setAttribute("y",this._leftGroup.height-t.AABBBounds.height())})),this._rightGroup.forEachChildren((t=>{t.setAttribute("y",this._rightGroup.height-t.AABBBounds.height())})),this._leftGroup.setAttribute("y",this._cellHeight-this._leftGroup.height),this._rightGroup.setAttribute("y",this._cellHeight-this._rightGroup.height),this._centerGroup.setAttribute("y",this._cellHeight-this._centerGroup.height))}updateWidth(t){this._cellWidth=t,this._originCellWidth=t,this.layout()}updateHeight(t){this._cellHeight=t,this._cellWidth=this._originCellWidth,this.layout()}}function pA(t,e,i){let r=0;const n=i.internalProps.layoutMap;if(n.isHeader(t,e)){const i=n.getHeader(t,e);i?.hierarchyLevel&&(r=(i.hierarchyLevel??0)*(n.rowHierarchyIndent??0))}else{const o=i.getBodyColumnDefine(t,e);if(o?.tree){const o=i.dataSource.getIndexKey(i.getRecordShowIndexByCell(t,e));r=Array.isArray(o)&&i.getHierarchyState(t,e)!==qy.none?(o.length-1)*(n.hierarchyIndent??0):0}}return r}function fA(t,e,i,r,n){const o={};"image"===t.type?o.image=t.src:("svg"===t.type||"svg"in t)&&(o.image=t.svg),o.width=t.width,o.height=t.height,o.visibleTime=t.visibleTime??"always",o.funcType=t.funcType,o.interactive=t.interactive;let s=0;if(ot(i)&&ot(r)&&n&&(t.funcType===tC.collapse||t.funcType===tC.expand)&&(s=pA(i,r,n)),o.marginLeft=(t.marginLeft??0)+s,o.marginRight=t.marginRight??0,t.interactive&&(o.pickable=!1),t.hover&&(o.backgroundWidth=t.hover.width??t.width,o.backgroundHeight=t.hover.width??t.width,o.backgroundColor=t.hover.bgColor??"rgba(22,44,66,0.2)",o.hoverImage=t.hover.image),t.cursor&&(o.cursor=t.cursor),"shape"in t&&"circle"===t.shape&&(o.shape=t.shape),e)return e.setAttributes(o),e.loadImage(o.image),e;const a=new NS(o);return a.tooltip=t.tooltip,a}function mA(t){const e={};return"image"===t.type?e.image=t.src:("svg"===t.type||"svg"in t)&&(e.image=t.svg),e.visibleTime=t.visibleTime??"always",e.funcType=t.funcType,e.id=t.name,e.width=t.width,e.height=t.height,(t.marginRight||t.marginLeft)&&(e.margin=[0,t.marginRight??0,0,t.marginLeft??0]),t.hover&&(e.backgroundWidth=t.hover.width??t.width,e.backgroundHeight=t.hover.height??t.height,e.backgroundShowMode="hover",e.hoverImage=t.hover.image,e.backgroundStroke=!1,e.backgroundFill=t.hover.bgColor??"rgba(22,44,66,0.2)"),t.cursor&&(e.cursor=t.cursor),e.tooltip=t.tooltip,e}function bA(t,e,i,r,n,o,s,a,l){let h,c=0,d=0,u=0,g=0;t.forEachChildren((t=>{"icon-left"===t.role?(c+=t.AABBBounds.width(),d=Math.max(d,t.AABBBounds.height())):"icon-right"===t.role&&(u+=t.AABBBounds.width(),g=Math.max(g,t.AABBBounds.height()))}));const p=t.getChildByName("text"),f=t.getChildByName("content");let m;p instanceof ta?(h=p.AABBBounds.height(),p.setAttribute("maxLineWidth",e-c-g-(o[1]+o[3])),m=p.AABBBounds.height()):p instanceof Pl?(h=p.AABBBounds.height(),p.setAttribute("width",e-c-g-(o[1]+o[3])),m=p.AABBBounds.height()):f&&(h=f.AABBBounds.height(),f.updateWidth(e-c-g-(o[1]+o[3])),m=f.AABBBounds.height());const b=Math.max(d,g,h)+o[0]+o[2];if(t.forEachChildren((i=>{"icon-left"===i.role||("icon-right"===i.role||"icon-absolute-right"===i.role?i.setAttribute("x",i.attribute.x+r):"content"===i.name||"text"===i.name?(i.AABBBounds.width(),"center"===s?i.setAttribute("x",o[3]+c+(e-(o[1]+o[3])-c-u)/2):"right"===s&&i.setAttribute("x",o[3]+e-(o[1]+o[3])-u)):"mark"===i.name&&i.setAttribute("x",t.attribute.width))})),n){let e=Math.max(d,m,g);if(function(t,e,i,r){const n=t.table,o=Nv(n,e.col,e.row);if(o&&o.end.row-o.start.row){r/=o.end.row-o.start.row+1,i/=o.end.row-o.start.row+1;for(let t=o.start.row;t<=o.end.row;t++){const e=n.getRowHeight(t);if(e===r&&i!==e)return!0;if(i>e)return!0}}else{const t=n.getRowHeight(e.row);if(t===r&&i!==t)return!0;if(i>t)return!0}return!1}(l,t,e+o[0]+o[2],b))return!0;e=(t.contentHeight??i)-(o[0]+o[2]),t.forEachChildren((t=>{"rect"!==t.type&&"chart"!==t.type&&("mark"===t.name?t.setAttribute("y",0):"middle"===a?t.setAttribute("y",o[0]+(e-t.AABBBounds.height())/2):"bottom"===a?t.setAttribute("y",o[0]+e-t.AABBBounds.height()):t.setAttribute("y",o[0]))}))}else"middle"!==a&&"bottom"!==a||t.forEachChildren((t=>{"rect"!==t.type&&"chart"!==t.type&&("mark"===t.name?t.setAttribute("y",0):"middle"===a?t.setAttribute("y",(i-o[2]+o[0]-t.AABBBounds.height())/2):"bottom"===a?t.setAttribute("y",i-t.AABBBounds.height()-o[2]):t.setAttribute("y",o[0]))}));return!1}function yA(t,e,i,r,n,o,s){const a=e-(n[0]+n[2]),l=t.getChildByName("text");if(l instanceof ta&&!r)l.setAttributes({heightLimit:a});else if(l instanceof Pl&&!r)l.setAttributes({height:a});else if(t.getChildByName("content")){t.getChildByName("content").updateHeight(a)}t.forEachChildren((t=>{t.setAttribute("dy",0),"rect"===t.type||"chart"===t.type||("mark"===t.name?t.setAttribute("y",0):"middle"===s?t.setAttribute("y",n[0]+(a-t.AABBBounds.height())/2):"bottom"===s?t.setAttribute("y",n[0]+a-t.AABBBounds.height()):t.setAttribute("y",n[0]))}))}function CA(t,e,i,r,n,o,s,a,l,h,c,d,u,g,p,f,m){const b=t._getCellStyle(o,s),y=tA("padding",b,o,s,t);Y(y)&&(c=y),m?.text?.textAlign&&(d=m?.text?.textAlign),m?.text?.textBaseline&&(u=m?.text?.textBaseline);const C="autoHeight"===t.heightMode,v="auto"===a,w=b.autoWrapText??t.internalProps.autoWrapText,x=b.lineClamp,_=new qS({x:r,y:n,width:l,height:h,lineWidth:m?.group?.lineWidth??void 0,fill:m?.group?.fill??void 0,stroke:m?.group?.stroke??void 0,strokeArrayWidth:m?.group?.strokeArrayWidth??void 0,strokeArrayColor:m?.group?.strokeArrayColor??void 0,cursor:m?.group?.cursor??void 0,lineCap:"square",clip:!0,cornerRadius:m.group.cornerRadius});if(_.role="cell",_.col=o,_.row=s,i?.addChild(_),p&&_.appendChild(p),f){const i=e;let r;if(g&&(r=t.getCellIcons(o,s)),function(t,e,i,r,n,o,s,a,l,h,c,d,u,g){const p=[],f=[],m=[],b=[],y=[],C=[],v=[],w=[];let x,_=0,S=0,A=0,B=0,T=0,M=0;if(Array.isArray(e)&&0!==e.length){let R;if(e.forEach((t=>{switch(t.positionType){case Qy.left:p.push(t);break;case Qy.right:f.push(t);break;case Qy.contentLeft:m.push(t);break;case Qy.contentRight:b.push(t);break;case Qy.absoluteRight:w.push(t);break;case Qy.inlineFront:y.push(t);break;case Qy.inlineEnd:C.push(t)}})),p.forEach((e=>{const i=fA(e,void 0,t.col,t.row,u);i.role="icon-left",i.name=e.name,i.setAttribute("x",_+(i.attribute.marginLeft??0)),_+=i.AABBBounds.width()+(i.attribute.marginLeft??0)+(i.attribute.marginRight??0),S=Math.max(S,i.AABBBounds.height()),t.appendChild(i)})),f.forEach((e=>{const i=fA(e,void 0,t.col,t.row,u);i.role="icon-right",i.name=e.name,i.setAttribute("x",A+(i.attribute.marginLeft??0)),A+=i.AABBBounds.width()+(i.attribute.marginLeft??0)+(i.attribute.marginRight??0),B=Math.max(B,i.AABBBounds.height()),t.appendChild(i)})),v.forEach((e=>{const i=fA(e,void 0,t.col,t.row,u);i.role="icon-absolute-left",i.name=e.name,i.setAttribute("x",T+(i.attribute.marginLeft??0)),T+=i.AABBBounds.width()+(i.attribute.marginLeft??0)+(i.attribute.marginRight??0),t.appendChild(i)})),w.forEach((e=>{const i=fA(e,void 0,t.col,t.row,u);i.role="icon-absolute-right",i.name=e.name,i.setAttribute("x",M+(i.attribute.marginLeft??0)),M+=i.AABBBounds.width()+(i.attribute.marginLeft??0)+(i.attribute.marginRight??0),t.appendChild(i)})),0===y.length&&0===C.length){const t=TC(i).replace(/\r?\n/g,"\n").replace(/\r/g,"\n").split("\n"),e={text:1===t.length?t[0]:t,maxLineWidth:n?1/0:l-(r[1]+r[3])-_-A,textBaseline:"top",heightLimit:o?-1:h-(r[0]+r[2]),pickable:!1,autoWrapText:s,lineClamp:a,wordBreak:"break-word",whiteSpace:1!==t.length||s?"normal":"no-wrap"},c=new ta(g.text?Object.assign({},g.text,e):e);c.name="text",R=c}else{const e=Object.assign({text:i?.toString()},t.parent?.theme?.userTheme?.text||{});g.text&&Object.assign(e,g.text),e.textBaseline="middle";const s=[...y.map((t=>mA(t))),e,...C.map((t=>mA(t)))];s[0].textAlign=c;const a=new Pl({width:n?0:l-(r[1]+r[3])-_-A,height:o?0:h-(r[0]+r[2]),textConfig:s,verticalDirection:o?"top":d,ellipsis:e.ellipsis});a.name="text",R=a,a.bindIconEvent()}if(0!==m.length||0!==b.length){const e=new gA({x:0,y:0,fill:!1,stroke:!1});e.name="content",e.setCellContentOption({autoWidth:n,autoHeight:o,cellWidth:l-(r[1]+r[3])-_-A,cellHeight:h-(r[0]+r[2]),align:c,baseline:d}),m.forEach((i=>{const r=fA(i,void 0,t.col,t.row,u);r.role="icon-content-left",r.name=i.name,e.addLeftOccupyingIcon(r)})),b.forEach((i=>{const r=fA(i,void 0,t.col,t.row,u);r.role="icon-content-right",r.name=i.name,e.addRightOccupyingIcon(r)})),e.addContent(R),t.appendChild(e),e.layout(),x=e.AABBBounds.width(),e.AABBBounds.height()}else t.firstChild?t.insertBefore(R,t.firstChild):t.appendChild(R),x=R.AABBBounds.width(),R.AABBBounds.height()}else if(Y(i)){const e=TC(i).replace(/\r?\n/g,"\n").replace(/\r/g,"\n").split("\n"),c=pA(t.col,t.row,u),d={text:1===e.length?e[0]:e,maxLineWidth:n?1/0:l-(r[1]+r[3]+c),textBaseline:"top",autoWrapText:s,lineClamp:a,wordBreak:"break-word",heightLimit:o?-1:h-(r[0]+r[2]),pickable:!1,dx:c,whiteSpace:1!==e.length||s?"normal":"no-wrap"},p=new ta(g.text?Object.assign({},g.text,d):d);p.name="text",t.appendChild(p),x=p.AABBBounds.width(),p.AABBBounds.height()}const R=n?_+x+A:l-(r[1]+r[3]),P=h-(r[0]+r[2]);t.forEachChildren((t=>{"icon-left"===t.role?t.setAttribute("x",t.attribute.x+r[3]):"icon-right"===t.role?t.setAttribute("x",t.attribute.x+R-A+r[3]):"icon-absolute-right"===t.role?t.setAttribute("x",t.attribute.x+R-M+r[3]+r[1]):"content"!==t.name&&"text"!==t.name||("center"===c&&"richtext"!==t.type?t.setAttribute("x",r[3]+_+(R-_-A)/2):"right"===c&&"richtext"!==t.type?t.setAttribute("x",r[3]+R-A):t.setAttribute("x",r[3]+_))})),t.forEachChildren((t=>{"middle"===d?t.setAttribute("y",r[0]+(P-t.AABBBounds.height())/2):"bottom"===d?t.setAttribute("y",r[0]+P-t.AABBBounds.height()):t.setAttribute("y",r[0])})),t.setAttributes({width:R+r[1]+r[3],height:P+r[0]+r[2]})}(_,r,i,c,v,C,w,"number"==typeof x?x:void 0,l,h,d,u,t,m),m?._vtable?.marked){const t=Wl({x:_.attribute.width,y:0,startAngle:Math.PI/2,endAngle:Math.PI,outerRadius:6,fill:"#3073F2",pickable:!1});t.name="mark",_.appendChild(t)}}return p&&_.setAttributes({width:Math.max(_.attribute.width,p.attribute.width??0),height:Math.max(_.attribute.height,p.attribute.height??0)}),_}const vA=YS();function wA(t,e,i){t.then((()=>{i(),e.scenegraph.updateNextFrame()})).catch((t=>{}))}function xA(t,e,i,r,n,o,s,a,l,h,c,d,u,g,p){t||((t=new qS({x:i,y:r,width:a,height:l,lineWidth:g?.group?.lineWidth??void 0,fill:g?.group?.fill??void 0,stroke:g?.group?.stroke??void 0,strokeArrayWidth:g?.group?.strokeArrayWidth??void 0,strokeArrayColor:g?.group?.strokeArrayColor??void 0,cursor:g?.group?.cursor??void 0,lineCap:"square",clip:!0,cornerRadius:g.group.cornerRadius})).role="cell",t.col=n,t.row=o,e?.addChild(t));const f=function(t,e,i,r,n,o,s,a,l){const h=l._getCellStyle(t,e),c=QS("size",h,t,e,l),d=QS("spaceBetweenTextAndIcon",h,t,e,l),u=l.getCellValue(t,e),g=l.getCellOriginValue(t,e);let p,f,m=u??"";q(u)?(p=u.checked,f=u.disable,m=u.text):"boolean"==typeof u&&(p=u,m="");p=l.stateManager.syncCheckedState(t,e,a.field,p);const b=pA(t,e,l),y=l._getCellStyle(t,e),C=y.autoWrapText??l.internalProps.autoWrapText,{lineClamp:v}=y,{checked:w,disable:x}=a;if(null==p||"function"==typeof p){const i=XC(w,{col:t,row:e,table:l,context:null,value:u,dataValue:g});p=l.stateManager.syncCheckedState(t,e,a.field,i)}const _=XC(x,{col:t,row:e,table:l,context:null,value:u,dataValue:g}),S="auto"===i,A="autoHeight"===l.heightMode,B={text:1===m.length?m[0]:m,maxLineWidth:S?1/0:r-(o[1]+o[3]+b)-c-d,textBaseline:"top",autoWrapText:C,lineClamp:v,wordBreak:"break-word",heightLimit:A?-1:n-(o[0]+o[2]),pickable:!1,dx:b,whiteSpace:1!==m.length||C?"normal":"no-wrap"},T=s.text?Object.assign({},s.text,B):B;let M;M=new Kx("indeterminate"===p?{x:0,y:0,text:T,icon:{width:Math.floor(c/1.4),height:Math.floor(c/1.4)},box:{width:c,height:c},spaceBetweenTextAndIcon:d,checked:void 0,indeterminate:!0,disabled:f??_??!1}:{x:0,y:0,text:T,icon:{width:Math.floor(c/1.4),height:Math.floor(c/1.4)},box:{width:c,height:c},spaceBetweenTextAndIcon:d,checked:p,indeterminate:void 0,disabled:f??_??!1});return M.name="checkbox",M}(n,o,s,a,l,h,g,p,u);return f&&t.appendChild(f),f.render(),a-=h[1]+h[3],l-=h[0]+h[2],"center"===c?f.setAttribute("x",h[3]+(a-f.AABBBounds.width())/2):"right"===c?f.setAttribute("x",h[3]+a-f.AABBBounds.width()):f.setAttribute("x",h[3]),"middle"===d?f.setAttribute("y",h[0]+(l-f.AABBBounds.height())/2):"bottom"===d?f.setAttribute("y",h[0]+l-f.AABBBounds.height()):f.setAttribute("y",h[0]),t}function _A(t,e,i,r,n,o,s,a,l,h,c,d,u,g,p,f){let m,b;if(YC(e)&&(e=r.getCellValue(n,o)),r.internalProps?.dataConfig?.mappingRules&&!r.isHeader(n,o)&&r.internalProps?.dataConfig?.mappingRules?.forEach(((t,e)=>{t.bgColor&&r.internalProps.layoutMap.getIndicatorKey(n,o)===t.bgColor.indicatorKey&&(m=t.bgColor.mapping)})),"text"===t||"link"===t){if("link"===t){const s=e,a=r._getCellStyle(n,o);"link"===t&&("templateLink"in i&&i.templateLink||!("linkDetect"in i)||!i.linkDetect||xv.test(s))&&(f?(f.text.fill=QS("linkColor",a,n,o,r),f.group.cursor="pointer"):f={text:{fill:QS("linkColor",a,n,o,r)},group:{cursor:"pointer"}})}if(m){const t=r.getCellOriginValue(n,o),e=m(r,t);e&&(f?f.group.fill=e:f={group:{fill:e}})}let y,C,v,w=!0;if("body"!==r.getCellLocation(n,o)?(C=i?.headerCustomRender,v=i?.headerCustomLayout):(C=i?.customRender||r.customRender,v=i?.customLayout),v||C){const t=GS(v,C,n,o,a,l,!1,"autoHeight"===r.heightMode,d,r);y=t.elementsGroup,w=t.renderDefault}b=CA(r,e,h,0,c,n,o,s,a,l,d,u,g,p,y,w,f);const x=r.internalProps.layoutMap.getAxisConfigInPivotChart(n,o);if(x){const t=new I_(x,b.attribute.width,b.attribute.height,d,r);b.clear(),b.appendChild(t.component),t.overlap()}else r.internalProps.layoutMap.isEmpty(n,o)?(b.setAttributes({fill:!1,stroke:!1}),b.clear()):r.internalProps.layoutMap.isAxisCell(n,o)&&b.clear()}else if("image"===t)b=function(t,e,i,r,n,o,s,a,l,h,c,d,u,g){const p=tA("padding",u._getCellStyle(r,n),r,n,u);Y(p)&&(h=p),g?.text?.textAlign&&(c=g?.text?.textAlign),g?.text?.textBaseline&&(d=g?.text?.textBaseline);const f=new qS({x:e,y:i,width:o,height:s,lineWidth:g?.group?.lineWidth??void 0,fill:g?.group?.fill??void 0,stroke:g?.group?.stroke??void 0,strokeArrayWidth:g?.group?.strokeArrayWidth??void 0,strokeArrayColor:g?.group?.strokeArrayColor??void 0,cursor:g?.group?.cursor??void 0,lineCap:"square",clip:!0,cornerRadius:g.group.cornerRadius});f.role="cell",f.col=r,f.row=n,t?.addChild(f);const m=u.getCellValue(r,n),b=Al({x:h[3],y:h[0],width:o-h[1]-h[3],height:s-h[0]-h[2],image:m,cursor:"pointer"});return b.name="image",b.keepAspectRatio=a,b.successCallback=a||l?()=>{const t=b.resources.get(b.attribute.image).data;if(l&&eA(r,n,t.width,t.height,u.scenegraph,h),a){const{width:e,height:i}=ZS(t.width,t.height,f.attribute.width-h[1]-h[3],f.attribute.height-h[0]-h[2]),r=JS(0,0,f.attribute.width,f.attribute.height,e,i,c,d,h);b.setAttributes({x:r.x,y:r.y,width:e,height:i})}u.scenegraph.updateNextFrame()}:()=>{iA(f,r,n,u)},b.failCallback=()=>{const t=YS();b.image=t.damage_pic.svg},f.appendChild(b),f}(h,0,c,n,o,r.getColWidth(n),r.getRowHeight(o),i.keepAspectRatio,i.imageAutoSizing,d,u,g,r,f);else if("video"===t)b=function(t,e,i,r,n,o,s,a,l,h,c,d,u,g){const p=tA("padding",u._getCellStyle(r,n),r,n,u);Y(p)&&(h=p),g?.text?.textAlign&&(c=g?.text?.textAlign),g?.text?.textBaseline&&(d=g?.text?.textBaseline);const f=new qS({x:e,y:i,width:o,height:s,lineWidth:g?.group?.lineWidth??void 0,fill:g?.group?.fill??void 0,stroke:g?.group?.stroke??void 0,strokeArrayWidth:g?.group?.strokeArrayWidth??void 0,strokeArrayColor:g?.group?.strokeArrayColor??void 0,cursor:g?.group?.cursor??void 0,lineCap:"square",clip:!0,cornerRadius:g.group.cornerRadius});f.role="cell",f.col=r,f.row=n,t?.addChild(f);const m=u.getCellValue(r,n),b=document.createElement("video");b.addEventListener("loadeddata",(()=>{l&&eA(r,n,b.videoWidth,b.videoHeight,u.scenegraph,h);const t=f.attribute.width,e=f.attribute.height;if(a){const{width:i,height:r}=ZS(b.videoWidth,b.videoHeight,t-h[1]-h[3],e-h[0]-h[2]),n=JS(0,0,t,e,i,r,c,d,h);y.setAttributes({width:i,height:r,x:n.x,y:n.y})}else y.setAttributes({x:h[3],y:h[0],width:t-h[1]-h[3],height:e-h[2]-h[0]});const i=Math.floor(Math.min(t-h[1]-h[3],e-h[2]-h[0])/2),o=0+(t>y.attribute.width?y.attribute.x-0+y.attribute.width/2:t/2),s=0+(e>y.attribute.height?y.attribute.y-0+y.attribute.height/2:e/2),g=new NS({x:o-i/2,y:s-i/2,width:i,height:i,image:vA.play.svg,cursor:vA.play.cursor});g.name="play-icon",f.appendChild(g),u.scenegraph.updateNextFrame()})),b.onerror=()=>{y.image=vA.damage_pic.svg},b.src=m,b.setAttribute("preload","auto");const y=Al({x:h[3],y:h[0],width:o-h[1]-h[3],height:s-h[2]-h[0],image:b,cursor:"pointer"});return y.name="image",f.appendChild(y),f}(h,0,c,n,o,r.getColWidth(n),r.getRowHeight(o),i.keepAspectRatio,i.imageAutoSizing,d,u,g,r,f);else if("chart"===t){const t=r.internalProps.layoutMap.getChartInstance(n,o);b=uA(null,h,0,c,n,o,r.getColWidth(n),r.getRowHeight(o),d,0,i.chartModule,r.isPivotChart()?r.internalProps.layoutMap.getChartSpec(n,o):i.chartSpec,t,r.internalProps.layoutMap?.getChartDataId(n,o)??"data",r,f)}else if("progressbar"===t){const t=r._getCellStyle(n,o),p=r.getCellOriginValue(n,o);b=CA(r,e,h,0,c,n,o,s,a,l,d,u,g,!1,null,!0,f);const m=rA(i,t,s,e,p,n,o,0,r);b.firstChild?b.insertBefore(m,b.firstChild):b.appendChild(m)}else"sparkline"===t?b=sA(null,h,0,c,n,o,a,l,d,r,f):"checkbox"===t&&(b=xA(null,h,0,c,n,o,s,a,l,d,u,g,r,f,i));return b}function SA(t,e,i,r){const n=i.scenegraph.highPerformanceGetCell(t,e,!0),o=i._getCellStyle(t,e),s=o.autoWrapText??i.internalProps.autoWrapText,a=i.getCellLocation(t,e),l="body"!==a?i.getHeaderDefine(t,e):i.getBodyColumnDefine(t,e);let h,c;("body"!==a||l?.mergeCell||i.internalProps.customMergeCell)&&(c=i.getCellRange(t,e),h=c.start.col!==c.end.col||c.start.row!==c.end.row);let d=OS(o,i,h?c.start.col:t,h?c.start.row:e,QS).theme;if(d.group.cornerRadius=WS(t,e,i),!r&&!h&&function(t,e,i,r,n){const o=n.getBodyColumnDefine(t,e),s=!!o?.icon||!!o?.tree,a=n.getBodyColumnType(t,e),l="autoHeight"===n.heightMode,h=n.getCellValue(t,e);if(!(n.isHeader(t,e)||"cell"!==i.role||"text"!==a||r||l||s||"text"!==i.firstChild?.type||YC(h)))return!0;return!1}(t,e,n,s,i)){const r=i.getColWidth(t),a=i.getRowHeight(e);n.setAttributes({width:r,height:a,lineWidth:d?.group?.lineWidth??void 0,fill:d?.group?.fill??void 0,stroke:d?.group?.stroke??void 0,strokeArrayWidth:d?.group?.strokeArrayWidth??void 0,strokeArrayColor:d?.group?.strokeArrayColor??void 0,cursor:d?.group?.cursor??void 0,cornerRadius:d?.group?.cornerRadius??0,y:i.scenegraph.getCellGroupY(e)});const l=n.getChildByName("text");if(l){const n=TC(i.getCellValue(t,e)).replace(/\r?\n/g,"\n").replace(/\r/g,"\n").split("\n"),h=pA(t,e,i),c=o.lineClamp,u=eS(QS("padding",o,t,e,i))??[0,0,0,0],g=d.text.textAlign;let p=0;p="center"===g?u[3]+(r-(u[1]+u[3]))/2:"right"===g?u[3]+r-(u[1]+u[3]):u[3];const f={text:1!==n.length||s?n:n[0],maxLineWidth:r-(u[1]+u[3]+h),textBaseline:"top",autoWrapText:s,lineClamp:c,wordBreak:"break-word",heightLimit:a-(u[0]+u[2]),pickable:!1,dx:h,x:p},m=l.attribute.text;if(l.setAttributes(d.text?Object.assign({},d.text,f):f),!m&&l.attribute.text){const t=d.text.textBaseline,e=a-(u[0]+u[2]);let i=0;i="middle"===t?u[0]+(e-l.AABBBounds.height())/2:"bottom"===t?u[0]+e-l.AABBBounds.height():u[0],l.setAttributes({y:i})}}return n}if(!r&&"empty"===n.role)return;const u=i.isHeader(t,e)?i._getHeaderLayoutMap(t,e).headerType:i.getBodyColumnType(t,e);let g,p,f=i.getCellValue(t,e);if(i.internalProps.customMergeCell){const r=i.getCustomMerge(t,e);if(r){const{range:n,text:o,style:s}=r;c=n,h=c.start.col!==c.end.col||c.start.row!==c.end.row,f=o,g=s,g&&(d=OS(g,i,c.start.col,c.start.row,QS).theme,d.group.cornerRadius=WS(t,e,i))}}const m="body"!==a||(!!l?.icon||!!l?.tree),b=d._vtable.padding,y=d._vtable.textAlign,C=d._vtable.textBaseline;let v,w,x;if(i.internalProps?.dataConfig?.mappingRules&&!i.isHeader(t,e)&&i.internalProps?.dataConfig?.mappingRules?.forEach(((r,n)=>{r.bgColor&&i.internalProps.layoutMap.getIndicatorKey(t,e)===r.bgColor.indicatorKey&&(v=r.bgColor.mapping)})),"body"!==a?(l?.headerCustomRender,l?.headerCustomLayout):(l?.customRender||i.customRender,l?.customLayout),c?(w=i.getColsWidth(c.start.col,c.end.col),x=i.getRowsHeight(c.start.row,c.end.row)):(w=i.getColWidth(t),x=i.getRowHeight(e)),YC(f)?(n.removeAllChild(),wA(f,i,AA.bind(null,u,f,l,i,t,e,v,w,x,n,b,y,C,m,r,d))):p=AA(u,f,l,i,t,e,v,w,x,n,b,y,C,m,r,d),h){const r=i.getRowHeight(e),n=i.getColWidth(t),{width:o}=p.attribute,{height:s}=p.attribute;p.contentWidth=o,p.contentHeight=s,TA(p,n,r,c,i)}return p}function AA(t,e,i,r,n,o,s,a,l,h,c,d,u,g,p,f){if(YC(e)&&(e=r.getCellValue(n,o)),!p&&(h.row!==o||h.col!==n))return null;const m=_A(t,e,i,r,n,o,r.getColWidth(n),a,l,p?r.scenegraph.getColGroup(n):h.parent,p?0:r.scenegraph.getCellGroupY(o),c,d,u,g,f);return!p&&h.parent&&(h.parent.insertAfter(m,h),h.parent.removeChild(h),r.scenegraph?.proxy.cellCache.get(n)&&r.scenegraph?.proxy.cellCache.set(n,m)),m}function BA(t,e,i,r,n,o,s,a,l,h){let c,d,u,g=0;t.lastChild&&t.lastChild.row===r-1?g=t.lastChild.attribute.y+t.lastChild.attribute.height:t.colHeight&&(g=t.colHeight);for(let p=r;p<=n;p++){const r=p,n="body"!==l?a.getHeaderDefine(e,r):a.getBodyColumnDefine(e,r),f="body"!==l||(!!n?.icon||!!n?.tree);let m,b,y,C=a.getCellValue(e,r),v=i,w=a.getRowHeight(r);if(a.internalProps.customMergeCell){const t=a.getCustomMerge(e,r);if(t){const{range:e,text:i,style:r}=t;if(m=e,b=m.start.col!==m.end.col||m.start.row!==m.end.row,b){const t=MA(m,o,a);v=t.cellWidth,w=t.cellHeight}C=i,y=r}}if(!m&&("body"!==l||n?.mergeCell)&&(m=a.getCellRange(e,r),b=m.start.col!==m.end.col||m.start.row!==m.end.row,b)){const t=MA(m,o,a);v=t.cellWidth,w=t.cellHeight}const x=OS(y||a._getCellStyle(e,r),a,m?m.start.col:e,m?m.start.row:r,QS).theme;x.group.cornerRadius=WS(e,r,a),x.group.width=i,x.group.height=Array.isArray(s)?s[r]:s,x._vtable.padding&&(c=x._vtable.padding),x.text.textAlign&&(d=x.text.textAlign),x.text.textBaseline&&(u=x.text.textBaseline),"body"===l||x.group.fill||(x.group.fill="#fff");const _=(a.isHeader(e,r)?a._getHeaderLayoutMap(e,r).headerType:a.getBodyColumnType(e,r))||"text";if(YC(C)){wA(C,a,_A.bind(null,_,C,n,a,e,r,i,v,w,t,g,c,d,u,f,x)),t.updateColumnRowNumber(r);const o=a.getRowHeight(r);t.updateColumnHeight(o),g+=o}else{const o=_A(_,C,n,a,e,r,i,v,w,t,g,c,d,u,f,x);if(t.updateColumnRowNumber(r),b){const i=a.getRowHeight(r),n=a.getColWidth(e),{width:s}=o.attribute,{height:l}=o.attribute;o.contentWidth=s,o.contentHeight=l,TA(o,n,i,m,a),t.updateColumnHeight(i),g+=i}else t.updateColumnHeight(o.attribute.height),g+=o.attribute.height}if(h&&r>h)break}return t.setAttribute("width",i),{width:i,height:g}}function TA(t,e,i,r,n){const{col:o,row:s}=t,a=-n.getColsWidth(r.start.col,o-1),l=-n.getRowsHeight(r.start.row,s-1);t.forEachChildren((t=>{t.setAttributes({dx:(t.attribute.dx??0)+a,dy:(t.attribute.dy??0)+l})}));const h=t.attribute.lineWidth,c=it(h),d=[0,0,0,0];o===r.start.col&&(d[3]=c?h[3]:h),s===r.start.row&&(d[0]=c?h[0]:h),o===r.end.col&&(d[1]=c?h[1]:h),s===r.end.row&&(d[2]=c?h[2]:h);const u=e!==t.attribute.width,g=i!==t.attribute.height;return t.setAttributes({width:e,height:i,strokeArrayWidth:d}),t.mergeStartCol=r.start.col,t.mergeStartRow=r.start.row,t.mergeEndCol=r.end.col,t.mergeEndRow=r.end.row,{widthChange:u,heightChange:g}}function MA(t,e,i){let r=0,n=0;const o=e.get(`${t.start.col},${t.start.row};${t.end.col},${t.end.row}`);if(o)r=o.cellWidth,n=o.cellHeight;else{for(let e=t.start.col;e<=t.end.col;e++)r+=i.getColWidth(e);for(let e=t.start.row;e<=t.end.row;e++)n+=i.getRowHeight(e);e.set(`${t.start.col},${t.start.row};${t.end.col},${t.end.row}`,{cellWidth:r,cellHeight:n})}return{cellWidth:r,cellHeight:n}}function RA(t){return!!("cell"===t.role&&ot(t.mergeStartCol)&&ot(t.mergeStartRow)&&ot(t.mergeEndCol)&&ot(t.mergeEndRow))}const PA=5;function EA(t,e,i,r,n,o){if(i?.zero&&(t=Math.min(t,0),e=Math.max(e,0)),i?.expand){const r=t,n=e;Y(i.expand.min)&&(t=r-(n-r)*i.expand.min),Y(i.expand.max)&&(e=n+(n-r)*i.expand.max)}let s,a;if(ot(i?.min)&&(t=i.min),ot(i?.max)&&(e=i.max),"log"===i?.type?(s=new Fx,s.base(i?.base??10)):"symlog"===i?.type?(s=new zx,s.constant(i?.constant??10)):s=new Lx,s.domain([t,e],!!i?.nice),i?.nice){let t=i.tick?.forceTickCount??i.tick?.tickCount??10;$(t)&&(t=t({axisLength:n,labelStyle:i?.label?.style??{fontSize:t_.LABEL_FONT_SIZE}})),"accurateFirst"===i.niceType&&(t=Math.max(10,t)),X(i.min)&&X(i.max)?s.nice(t):Y(i.min)&&X(i.max)?s.niceMax(t):X(i.min)&&Y(i.max)&&s.niceMin(t)}return delete s._niceType,o||(a=s.ticks(ot(i?.tickCount)?i?.tickCount:PA,{noDecimals:i?.tick?.noDecimals})),{range:s.domain(),ticks:a}}function HA(t){return 2===t.length&&st(t[0])&&st(t[1])&&t[1]>=t[0]}function LA(t){const e=t[1]-t[0],i=t[1]*t[0]<0;let r=t[0]<=0?0-t[0]:0,n=t[1]>0?t[1]-0:0;return 0===e?t[0]<0?(r=1,n=0):t[0]>0&&(r=0,n=1):(r/=e,n/=e),{total:e,negative:r,positive:n,includeZero:i,domain:t,extendable_min:!0,extendable_max:!0}}function kA(t,e){const{positive:i,negative:r,extendable_min:n,extendable_max:o,domain:s}=t,{positive:a,negative:l,extendable_min:h,extendable_max:c,domain:d}=e;if(a>0){if(!h)return!1;let t=r/i;o&&(t=r/Math.max(i,a),s[1]=-s[0]/t),d[0]=-d[1]*t}else if(l>0){if(!c)return!1;let t=i/r;n&&(t=i/Math.max(r,r),s[0]=-s[1]/t),d[1]=-d[0]*t}return!0}function IA(t,e){const{extendable_min:i,extendable_max:r,domain:n}=t,{positive:o,negative:s,domain:a}=e;return(0!==o||0!==s)&&(!(o>0&&!r)&&(!(s>0&&!i)&&(n[0]=a[0],n[1]=a[1],!0)))}function FA(t,e){const{positive:i,negative:r,extendable_max:n,domain:o}=t,{positive:s,negative:a,extendable_min:l,domain:h}=e;if(n&&l){const t=Math.max(r,a)/Math.max(i,s);o[1]=-o[0]/t,h[0]=-h[1]*t}else if(l){const t=r/i;h[0]=-h[1]*t}else{if(!n)return!1;{const t=a/s;o[1]=-o[0]/t}}return!0}function zA(t,e){const{extendable_min:i,domain:r}=t,{extendable_max:n,domain:o}=e;return!(!i||!n)&&(r[0]=-r[1],o[1]=-o[0],!0)}function OA(t,e){const i=[t.min,t.max],r=[e.min,e.max];if(!HA(i)||!HA(r))return;const n=LA(i),o=LA(r),{positive:s,negative:a,extendable_min:l,extendable_max:h,includeZero:c}=n,{positive:d,negative:u,extendable_min:g,extendable_max:p,includeZero:f}=o;if(0===s&&0===a){if(!IA(n,o))return}else if(0===d&&0===u){if(!IA(o,n))return}else if(c||f)if(c&&!f){if(!kA(n,o))return}else if(f&&!c){if(!kA(o,n))return}else{if(a===u)return;if(a>u){if(!FA(n,o))return}else if(!FA(o,n))return}else{if(0===a&&0===d){if(!zA(n,o))return}else if(0===u&&0===s&&!zA(o,n))return;if(0===a&&0===u)if(0===i[0]&&r[0]>0){if(!g)return;r[0]=0}else{if(!(0===r[0]&&i[0]>0))return;if(!l)return;i[0]=0}if(0===s&&0===d)if(0===i[1]&&r[1]>0){if(!p)return;r[1]=0}else{if(!(0===r[1]&&i[1]>0))return;if(!h)return;i[1]=0}}return{range1:i,range2:r}}function DA(t,e,i){if(i._table.isPivotChart())if(i.indicatorsAsCol){if(i.hasTwoIndicatorAxes&&e===i.columnHeaderLevelCount-1&&t>=i.rowHeaderLevelCount&&t<i.colCount-i.rightFrozenColCount){const r=jA("top",t,e+1,t,i.columnHeaderLevelCount-1,t,e,1,i);if(!r)return;const{range:n,ticks:o,axisOption:s,isZeroAlign:a,theme:l}=r;if(a){const r=jA("bottom",t,e+1,t,i.columnHeaderLevelCount-1,t,e,0,i);if(r){const{range:t}=r,e=OA(n,t);e&&(n.min=e.range1[0],n.max=e.range1[1])}}return ot(s?.min)&&(n.min=s.min,n.min>0&&(s.zero=!1)),ot(s?.max)&&(n.max=s.max,n.max<0&&(s.zero=!1)),wt({range:n},s,{orient:"top",type:s?.type||"linear",label:{flush:!0},__ticksForVTable:o,__vtableChartTheme:l})}if(e===i.rowCount-i.bottomFrozenRowCount&&t>=i.rowHeaderLevelCount&&t<i.colCount-i.rightFrozenColCount){const r=i.getIndicatorKeyInChartSpec(t,e);let n=null;r?.forEach((t=>{const e=i.getIndicatorInfo(t);e&&(n=e)}));const o=jA("bottom",t,e-1,t,e,t,e,0,i);if(!o)return;const{range:s,ticks:a,axisOption:l,isZeroAlign:h,theme:c}=o;if(h){const r=jA("top",t,e-1,t,e,t,e,1,i);if(r){const{range:t}=r,e=OA(s,t);e&&(s.min=e.range1[0],s.max=e.range1[1])}}return ot(l?.min)&&(s.min=l.min,s.min>0&&(l.zero=!1)),ot(l?.max)&&(s.max=l.max,s.max<0&&(l.zero=!1)),wt({title:{visible:!0,text:n?.title},range:s},l,{orient:"bottom",type:l?.type||"linear",label:{flush:!0},__ticksForVTable:a,__vtableChartTheme:c})}if(t===i.rowHeaderLevelCount-1&&e>=i.columnHeaderLevelCount&&e<i.rowCount-i.bottomFrozenRowCount){let r=i.getDimensionKeyInChartSpec(i.rowHeaderLevelCount,e)?.[0];it(r)&&(r=r[0]);const n=(i.dataset.collectedValues[r]??[])[i.getRowKeysPath(t,e)??""]??[],{axisOption:o,isPercent:s,theme:a}=WA(t+1,e,"left",i);if(!1===o?.visible)return;return wt({domain:Array.from(n).reverse(),title:{autoRotate:!0}},o,{orient:"left",type:"band",__vtableChartTheme:a})}}else{if(t===i.rowHeaderLevelCount-1&&e>=i.columnHeaderLevelCount&&e<i.rowCount-i.bottomFrozenRowCount){const r=i.getIndicatorKeyInChartSpec(t,e);let n=null;r?.forEach((t=>{const e=i.getIndicatorInfo(t);e&&(n=e)}));const o=jA("left",t+1,e,t,e,t,e,0,i);if(!o)return;const{range:s,ticks:a,axisOption:l,isZeroAlign:h,theme:c}=o;if(h){const r=jA("right",t+1,e,t,e,t,e,1,i);if(r){const{range:t}=r,e=OA(s,t);e&&(s.min=e.range1[0],s.max=e.range1[1])}}return ot(l?.min)&&(s.min=l.min,s.min>0&&(l.zero=!1)),ot(l?.max)&&(s.max=l.max,s.max<0&&(l.zero=!1)),wt({title:{visible:!0,text:n?.title,autoRotate:!0},range:s},l,{orient:"left",type:l?.type||"linear",label:{flush:!0},__ticksForVTable:a,__vtableChartTheme:c})}if(t===i.colCount-i.rightFrozenColCount&&e>=i.columnHeaderLevelCount&&e<i.rowCount-i.bottomFrozenRowCount){const r=jA("right",t-1,e,i.rowHeaderLevelCount-1,e,t,e,1,i);if(!r)return;const{range:n,ticks:o,axisOption:s,isZeroAlign:a,theme:l}=r;if(a){const r=jA("left",t-1,e,i.rowHeaderLevelCount-1,e,t,e,0,i);if(r){const{range:t}=r,e=OA(n,t);e&&(n.min=e.range1[0],n.max=e.range1[1])}}return ot(s?.min)&&(n.min=s.min,n.min>0&&(s.zero=!1)),ot(s?.max)&&(n.max=s.max,n.max<0&&(s.zero=!1)),wt({range:n,title:{autoRotate:!0}},s,{orient:"right",type:s?.type||"linear",label:{flush:!0},__ticksForVTable:o,__vtableChartTheme:l})}if(e===i.rowCount-i.bottomFrozenRowCount&&t>=i.rowHeaderLevelCount&&t<i.colCount-i.rightFrozenColCount){let r=i.getDimensionKeyInChartSpec(t,i.columnHeaderLevelCount)?.[0];it(r)&&(r=r[0]);const n=i.dataset.collectedValues[r]??[],o=i.getColKeysPath(t,e),s=n?.[o??""]??[],{axisOption:a,isPercent:l,theme:h}=WA(t,e-1,"bottom",i);if(!1===a?.visible)return;return wt({domain:Array.from(s)},a,{orient:"bottom",type:"band",__vtableChartTheme:h})}}}function WA(t,e,i,r){const n=r.getRawChartSpec(t,e);if(n&&it(n.axes)){const t=n.axes.find((t=>t.orient===i));if(t){const{seriesIndex:e,seriesId:o}=t;let s;return Y(o)&&it(n.series)?s=(it(o)?o:[o]).map((t=>n.series.findIndex((e=>e.id===t)))):Y(e)&&it(n.series)&&(s=e),{axisOption:t,isPercent:n.percent,isZeroAlign:NA(n,i,r),seriesIndice:s,theme:n.theme}}}return{axisOption:r._table.pivotChartAxes.find((t=>t.orient===i)),isPercent:!1,isZeroAlign:NA(n,i,r),theme:n.theme}}function NA(t,e,i){const r=[];let n;if("left"===e||"right"===e?r.push("left","right"):"top"!==e&&"bottom"!==e||r.push("top","bottom"),n=t&&it(t.axes)?t.axes:i._table.pivotChartAxes,it(n)){const t=[];n.forEach((e=>{r.includes(e.orient)&&t.push(e)}));for(let e=0;e<t.length;e++){const i=t[e];if(i.sync&&i.sync.zeroAlign&&i.sync.axisId&&t.find((t=>t.id===i.sync.axisId)))return!0}}return!1}function GA(t,e,i,r,n){if(it(n)){const o={min:1/0,max:-1/0};for(let s=0;s<n.length;s++){const a=GA(t,e,i,r,n[s]);a&&(o.min=Math.min(o.min,a.min),o.max=Math.max(o.max,a.max))}return isFinite(o.min)&&isFinite(o.max)?o:null}let o=e?.[n];if(it(o)&&(o=o[0]),!o)return null;const s=t[o],a=wt({},s?.[r??""]??{min:0,max:1});return a.positiveMax&&a.positiveMax>a.max&&(a.max=a.positiveMax),a.negativeMin&&a.negativeMin<a.min&&(a.min=a.negativeMin),a.min===a.max&&(a.min>0?a.min=0:a.max=0),a}function jA(t,e,i,r,n,o,s,a,l){const{axisOption:h,isPercent:c,isZeroAlign:d,seriesIndice:u,theme:g}=WA(e,i,t,l);if(!1===h?.visible)return;const p=l.getIndicatorKeyInChartSpec(r,n);let f;f="top"===t||"bottom"===t?l.getColKeysPath(o,s):l.getRowKeysPath(o,s);const m=GA(l.dataset.collectedValues,p,d,f,u??a);if(!m)return;c&&(m.min=m.min<0?-1:0,m.max=m.max>0?1:0);const{range:b,ticks:y}=EA(m.min,m.max,h,0,l._table.getColWidth(o));return m.min=isNaN(b[0])?0:b[0],m.max=isNaN(b[1])?1:b[1],ot(h?.min)&&(m.min=h.min,m.min>0&&(h.zero=!1)),ot(h?.max)&&(m.max=h.max,m.max<0&&(h.zero=!1)),{axisOption:h,isZeroAlign:d,range:m,ticks:y,theme:g}}function UA(t,e){const i=wt({},e_,t);let r=0;!1!==i.tick.visible&&(r=i.tick.width??4);let n=0;if(i.label.visible){if("band"===i.type){i.domain.forEach((t=>{i.label.formatMethod&&(t=i.label.formatMethod(t));const{width:r,height:o}=e.measureText(t,{fontSize:i.label?.style?.fontSize??Qx,fontWeight:i.label?.style?.fontWeight??"normal",fontFamily:i.label?.style?.fontFamily??Jx}),s=i.label?.style?.maxLineWidth||1/0,a=(i.label?.style?.angle??0)+("vertical"===i.label?.style?.direction?90:0);n=Math.max(n,$A(Math.min(r,s),o,a).width)}))}else{let r;if(it(t.__ticksForVTable))r=t.__ticksForVTable;else{const t=i.range,e=Math.abs(t.min)>1?Math.round(t.min):t.min,n=Math.abs(t.max)>1?Math.round(t.max):t.max;r=[KA(e),KA(n)]}r.forEach((t=>{i.label.formatMethod&&(t=i.label.formatMethod(t));const{width:r,height:o}=e.measureText(t,{fontSize:i.label?.style?.fontSize??Qx,fontWeight:i.label?.style?.fontWeight??"normal",fontFamily:i.label?.style?.fontFamily??Jx}),s=i.label?.style?.maxLineWidth||1/0,a=(i.label?.style?.angle??0)+("vertical"===i.label?.style?.direction?90:0);n=Math.max(n,$A(Math.min(r,s),o,a).width)}))}n+=i.label.space??4}let o=0;if(i.title.visible&&i.title.text){const{width:r,height:n}=e.measureText(i.title.text,{fontSize:i.title?.style?.fontSize??Qx,fontWeight:i.title?.style?.fontWeight??"normal",fontFamily:i.title?.style?.fontFamily??Jx}),s=i.label?.style?.maxLineWidth||1/0,a=$A(Math.min(r,s),n,i.title?.style?.angle);o="left"!==t.orient&&"right"!==t.orient||!i.title.autoRotate?a.width:a.height,o+=i.title.space??4}return r+n+o+2}function VA(t,e){const i=wt({},e_,t);let r=0;!1!==i.tick.visible&&(r=i.tick.width??4);let n=0;if(i.label.visible){if("band"===i.type){i.domain.forEach((t=>{i.label.formatMethod&&(t=i.label.formatMethod(t));const{width:r,height:o}=e.measureText(t,{fontSize:i.label?.style?.fontSize??Qx,fontWeight:i.label?.style?.fontWeight??"normal",fontFamily:i.label?.style?.fontFamily??Jx}),s=i.label?.style?.maxLineWidth||1/0,a=(i.label?.style?.angle??0)+("vertical"===i.label?.style?.direction?90:0);n=Math.max(n,$A(Math.min(r,s),o,a).height)}))}else{let r;if(it(t.__ticksForVTable))r=t.__ticksForVTable;else{const t=i.range,e=Math.abs(t.min)>1?Math.round(t.min):t.min,n=Math.abs(t.max)>1?Math.round(t.max):t.max;r=[KA(e),KA(n)]}r.forEach((t=>{i.label.formatMethod&&(t=i.label.formatMethod(t));const{width:r,height:o}=e.measureText(t,{fontSize:i.label?.style?.fontSize??Qx,fontWeight:i.label?.style?.fontWeight??"normal",fontFamily:i.label?.style?.fontFamily??Jx}),s=i.label?.style?.maxLineWidth||1/0,a=(i.label?.style?.angle??0)+("vertical"===i.label?.style?.direction?90:0);n=Math.max(n,$A(Math.min(r,s),o,a).height)}))}n+=i.label.space??4}let o=0;if(i.title.visible&&i.title.text){const{width:r,height:n}=e.measureText(i.title.text,{fontSize:i.title?.style?.fontSize??Qx,fontWeight:i.title?.style?.fontWeight??"normal",fontFamily:i.title?.style?.fontFamily??Jx}),s=i.label?.style?.maxLineWidth||1/0,a=$A(Math.min(r,s),n,i.title?.style?.angle);o="bottom"!==t.orient&&"top"!==t.orient||!i.title.autoRotate?a.height:a.width,o+=i.title.space??4}return r+n+o+2}function KA(t){return"number"!=typeof t&&(t=Number(t)),Number(t.toPrecision(1)).toString()}function $A(t,e,i=0){const r=i*Math.PI/180,n=-t/2,o=-e/2,s=t/2,a=-e/2,l=t/2,h=e/2,c=-t/2,d=e/2,u={x:n*Math.cos(r)-o*Math.sin(r),y:n*Math.sin(r)+o*Math.cos(r)},g={x:s*Math.cos(r)-a*Math.sin(r),y:s*Math.sin(r)+a*Math.cos(r)},p={x:l*Math.cos(r)-h*Math.sin(r),y:l*Math.sin(r)+h*Math.cos(r)},f={x:c*Math.cos(r)-d*Math.sin(r),y:c*Math.sin(r)+d*Math.cos(r)},m=Math.min(u.x,g.x,p.x,f.x),b=Math.max(u.x,g.x,p.x,f.x),y=Math.min(u.y,g.y,p.y,f.y);return{width:b-m,height:Math.max(u.y,g.y,p.y,f.y)-y}}const XA=new ta({ignoreBuf:!0}),YA=new Pl({width:0,height:0,textConfig:[]}),qA=new Kx({});function ZA(t,e,i,r=!0,n){"undefined"!=typeof window&&window.performance.now();const o=[],s=[];if(n)for(let e=0;e<t.rowCount;e++)o[e]=t.getRowHeight(e);t.defaultHeaderRowHeight,t.defaultHeaderColWidth;const a="auto"===t.defaultHeaderRowHeight||it(t.defaultHeaderRowHeight)&&t.defaultHeaderRowHeight.some((t=>"auto"===t)),l="autoHeight"===t.heightMode||"adaptive"===t.heightMode;if(l||a){e=e??0,i=i??t.rowCount-1,(0===e&&i===t.rowCount-1||r)&&t._clearRowRangeHeightsMap();for(let i=e;i<t.columnHeaderLevelCount;i++){let e=0,r=t.colCount-1;if((t.isPivotTable()&&!t.isPivotChart()||t.isPivotChart()&&!t.internalProps.layoutMap.indicatorsAsCol)&&tB(t,i)&&(e=0,r=t.rowHeaderLevelCount),l||"auto"===t.getDefaultRowHeight(i)){const o=JA(i,e,r,t);n?s[i]=Math.round(o):t._setRowHeight(i,o)}}for(let e=t.rowCount-t.bottomFrozenRowCount;e<=i;e++)if(l||"auto"===t.getDefaultRowHeight(e)){const i=JA(e,0,t.colCount-1,t);n?s[e]=Math.round(i):t._setRowHeight(e,i)}if(i<t.columnHeaderLevelCount||!l);else if(t.internalProps.transpose||t.isPivotTable()&&!t.internalProps.layoutMap.indicatorsAsCol||!function(t){const{layoutMap:e}=t.internalProps,i=t.columnHeaderLevelCount;if((t.internalProps.autoWrapText||t.isPivotChart())&&("autoHeight"===t.options.heightMode||"adaptive"===t.options.heightMode))return!1;for(let r=0;r<t.colCount;r++){const n=e.getBody(r,i);if("function"==typeof n.style||"function"==typeof n.icon||n.define?.customRender||n.define?.customLayout||"function"==typeof n.define?.icon)return!1;const o=t._getCellStyle(r,i);if("function"==typeof o.padding||"function"==typeof o.fontSize||"function"==typeof o.lineHeight||!0===o.autoWrapText)return!1}return!0}(t))if(t.internalProps.transpose||t.isPivotTable()&&!t.internalProps.layoutMap.indicatorsAsCol)for(let r=Math.max(e,t.columnHeaderLevelCount);r<=i;r++){let e;e=QA(t,r)?JA(r,0,t.rowHeaderLevelCount,t):JA(r,0,t.colCount-1,t),n?s[r]=Math.round(e):t._setRowHeight(r,e)}else for(let r=Math.max(e,t.columnHeaderLevelCount);r<=i;r++){const e=JA(r,0,t.colCount-1,t);n?s[r]=Math.round(e):t._setRowHeight(r,e)}else{!function(t,e,i,r,n){for(let o=e;o<=i;o++)n?n[o]=t:r._setRowHeight(o,t)}(JA(t.columnHeaderLevelCount,0,t.colCount-1,t),t.columnHeaderLevelCount,t.rowCount-1-t.bottomFrozenRowCount,t,n?s:void 0);for(let e=t.rowCount-t.bottomFrozenRowCount;e<=i;e++){const i=JA(e,0,t.colCount-1,t);n?s[e]=Math.round(i):t._setRowHeight(e,i)}}}else{t.rowHeightsMap.clear();for(let e=0;e<t.rowCount;e++)s[e]=t.getRowHeight(e)}if((0===e&&i===t.rowCount-1||r)&&t._clearRowRangeHeightsMap(),"adaptive"===t.heightMode){t._clearRowRangeHeightsMap();const e=t.getRowsHeight(0,t.columnHeaderLevelCount-1),i=t.isPivotChart()?t.getBottomFrozenRowsHeight():0,r=t.tableNoFrameHeight-e-i,o=t.columnHeaderLevelCount,a=t.isPivotChart()?t.rowCount-t.bottomFrozenRowCount:t.rowCount;let l=0;for(let e=o;e<a;e++)l+=n?s[e]:t.getRowHeight(e);const h=r/l;for(let e=o;e<a;e++){let i;i=e===a-1?r-(n?s.reduce(((t,e,i)=>i>=o&&i<=a-2?t+e:t),0):t.getRowsHeight(o,a-2)):Math.round((n?s[e]:t.getRowHeight(e))*h),n?s[e]=i:t._setRowHeight(e,i,!1)}}else if(t.autoFillHeight){t._clearRowRangeHeightsMap();const e=t.tableNoFrameHeight;let i=0,r=0;for(let e=0;e<t.rowCount;e++){const o=n?s[e]:t.getRowHeight(e);(e<t.columnHeaderLevelCount||t.isPivotChart()&&e>=t.rowCount-t.bottomFrozenRowCount)&&(r+=o),i+=o}if(t.scenegraph._dealAutoFillHeightOriginRowsHeight=i,i<e&&i-r>0){const o=t.columnHeaderLevelCount,a=t.isPivotChart()?t.rowCount-t.bottomFrozenRowCount:t.rowCount,l=(e-r)/(i-r);for(let i=o;i<a;i++){let h;h=i===a-1?e-r-(n?s.reduce(((t,e,i)=>i>=o&&i<=a-2?t+e:t),0):t.getRowsHeight(o,a-2)):Math.round((n?s[i]:t.getRowHeight(i))*l),n?s[i]=h:t._setRowHeight(i,h,!1)}}}if(n){for(let e=0;e<t.rowCount;e++){const i=s[e]??t.getRowHeight(e);i!==o[e]&&t._setRowHeight(e,i)}for(let e=0;e<t.rowCount;e++){const i=t.getRowHeight(e);i!==o[e]&&t.scenegraph.updateRowHeight(e,i-o[e],!0)}}}function JA(t,e,i,r){let n=0;if(r.isPivotChart()&&t>=r.columnHeaderLevelCount&&t<r.rowCount-r.bottomFrozenRowCount)if(r.internalProps.layoutMap.indicatorsAsCol){const e=r.internalProps.layoutMap.getOptimunHeightForChart(t);if(e>0)return e}else{const e=r.getDefaultRowHeight(t);if(ot(e))return e}for(let o=e;o<=i;o++){const e=eB(o,t,r);if(e&&(n=Math.max(e.height,n),!e.renderDefault))continue;if(r.isPivotChart()){const e=DA(o,t,r.internalProps.layoutMap);if(e){const t=VA(e,r);if("number"==typeof t){n=Math.max(t,n);continue}}}const i=r.isHeader(o,t)?r._getHeaderLayoutMap(o,t)?.headerType:r.getBodyColumnType(o,t);if("text"!==i&&"link"!==i&&"progressbar"!==i&&"checkbox"!==i){const e=r.getDefaultRowHeight(t);n=Math.max(n,ot(e)?e:r.defaultRowHeight);continue}const s=iB(o,t,i,r);n=Math.max(s,n)}return n}function QA(t,e){const{layoutMap:i}=t.internalProps;if(t.internalProps.autoWrapText&&("autoHeight"===t.options.heightMode||"adaptive"===t.options.heightMode))return!1;const r=i.getBody(t.rowHeaderLevelCount,e);if("function"==typeof r.style||"function"==typeof r.icon||r.define?.customRender||r.define?.customLayout||"function"==typeof r.define?.icon)return!1;const n=t._getCellStyle(t.rowHeaderLevelCount,e);return"function"!=typeof n.padding&&"function"!=typeof n.fontSize&&"function"!=typeof n.lineHeight&&!0!==n.autoWrapText}function tB(t,e){const{layoutMap:i}=t.internalProps;if(t.internalProps.autoWrapText&&("autoHeight"===t.options.heightMode||"adaptive"===t.options.heightMode))return!1;const r=i.getHeader(t.rowHeaderLevelCount,e);if("function"==typeof r.style||"function"==typeof r.icons||r.define?.headerCustomRender||r.define?.headerCustomLayout||"function"==typeof r.define?.icon)return!1;const n=t._getCellStyle(t.rowHeaderLevelCount,e);return"function"!=typeof n.padding&&"function"!=typeof n.fontSize&&"function"!=typeof n.lineHeight&&!0!==n.autoWrapText}function eB(t,e,i){const r=i.getCustomRender(t,e),n=i.getCustomLayout(t,e);if(r||n){let o=1,s=0,a=!1,l=!1;if(i.isHeader(t,e)||i.getBodyColumnDefine(t,e)?.mergeCell){const r=i.getCellRange(t,e);o=r.end.row-r.start.row+1}const h={col:t,row:e,dataValue:i.getCellOriginValue(t,e),value:i.getCellValue(t,e)||"",rect:rB(t,e,i),table:i};if(n){const e=n(h);e.rootContainer instanceof hs?(e.rootContainer=VS(e.rootContainer),US(e.rootContainer,i.getColWidth(t),0),e.rootContainer.setStage(i.scenegraph.stage),s=e.rootContainer.AABBBounds.height()??0,a=e.renderDefault,l=e.enableCellPadding):s=0}else if("function"==typeof r){const t=r(h);s=t?.expectedHeight??0,a=t?.renderDefault}else s=r?.expectedHeight??0,a=r?.renderDefault;if(l){const r=eS(QS("padding",i._getCellStyle(t,e),t,e,i));s+=r[0]+r[2]}return{height:s/o,renderDefault:a}}}function iB(t,e,i,r){let n=0;const o=r.getCellValue(t,e),s=r._getCellStyle(t,e);let a=0,l=0;const h=[];let c=0;const d=[];let u=0,g=!1;if("body"!==r.getCellLocation(t,e))g=!0;else{const i=r.getBodyColumnDefine(t,e);g=!!i?.icon||!!i?.tree}if(g){const i=r.getCellIcons(t,e);i?.forEach((t=>{t.positionType!==Qy.absoluteRight&&t.positionType!==Qy.inlineFront&&t.positionType!==Qy.inlineEnd?(l+=(t.width??0)+(t.marginLeft??0)+(t.marginRight??0),a=Math.max(a,t.height??0)):t.positionType===Qy.inlineFront?(h.push(t),c=Math.max(c,(t.height??0)+(t.marginLeft??0)+(t.marginRight??0))):t.positionType===Qy.inlineEnd&&(d.push(t),u=Math.max(u,(t.height??0)+(t.marginLeft??0)+(t.marginRight??0)))}))}let p=1,f=t;if(r.isHeader(t,e)||r.getBodyColumnDefine(t,e)?.mergeCell){const i=r.getCellRange(t,e);p=i.end.row-i.start.row+1,t=i.start.col,f=i.end.col}const m=eS(QS("padding",s,t,e,r)),b=QS("fontSize",s,t,e,r),y=QS("fontStyle",s,t,e,r),C=QS("fontWeight",s,t,e,r),v=QS("lineHeight",s,t,e,r)??b,w=QS("fontFamily",s,t,e,r),x=QS("autoWrapText",s,t,e,r);let _;_="checkbox"===i&&q(o)?o.text:o;const S=HC(_).split("\n")||[],A=r.getColsWidth(t,f);if("checkbox"===i){const i=QS("size",s,t,e,r);if(x){const o=QS("spaceBetweenTextAndIcon",s,t,e,r),a=A-(m[1]+m[3])-l-i-o;qA.setAttributes({text:{maxLineWidth:a,text:S,fontSize:b,fontStyle:y,fontWeight:C,fontFamily:w,lineHeight:v,wordBreak:"break-word"},icon:{width:Math.floor(i/1.4),height:Math.floor(i/1.4)},box:{width:i,height:i},spaceBetweenTextAndIcon:o}),qA.render(),n=XA.AABBBounds.height()}else n=Math.max(i,S.length*v)}else if(h.length||d.length){const t=Object.assign({text:o?.toString(),fontFamily:w,fontSize:b,fontStyle:y,fontWeight:C,lineHeight:v});t.textBaseline="middle";const e=[...h.map((t=>mA(t))),t,...d.map((t=>mA(t)))];YA.setAttributes({width:A-(m[1]+m[3])-l,height:0,textConfig:e}),n=YA.AABBBounds.height()}else if(x){const t=A-(m[1]+m[3])-l;XA.setAttributes({maxLineWidth:t,text:S,fontSize:b,fontStyle:y,fontWeight:C,fontFamily:w,lineHeight:v,wordBreak:"break-word",whiteSpace:1!==S.length||x?"normal":"no-wrap"}),n=XA.AABBBounds.height()}else n=S.length*v;return(Math.max(n,a)+m[0]+m[2])/p}function rB(t,e,i){return{left:0,top:0,right:i.getColWidth(t),bottom:i.getRowHeight(e),width:i.getColWidth(t),height:0}}function nB(t,e,i,r){r||t.table._setRowHeight(e,t.table.getRowHeight(e)+i,!0);for(let r=0;r<t.table.colCount;r++){const n=t.getCell(r,e),o=Nv(t.table,r,e);if(o&&o.start.col!==r)continue;oB(t,n,r,e,n.attribute.height+i,i,t.table.isHeader(r,e)),t.updateCellContentWhileResize(r,e)}let n=0,o=0;e<t.table.columnHeaderLevelCount?(n=e+1,o=t.table.columnHeaderLevelCount-1):(n=e+1,o=t.bodyRowEnd);for(let e=n;e<=o;e++)for(let r=0;r<t.table.colCount;r++){const n=t.getCell(r,e);"cell"===n.role&&n.setAttribute("y",n.attribute.y+i)}}function oB(t,e,i,r,n,o,s){e&&function(t,e,i,r,n,o,s){if(e.attribute.height===n&&!e.needUpdateHeight)return;e.needUpdateHeight=!1,e.setAttribute("height",n);const a=t.table.isHeader(i,r)?t.table._getHeaderLayoutMap(i,r).headerType:t.table.getBodyColumnType(i,r);if("progressbar"===a){const n=t.table.getBodyColumnDefine(i,r),o=t.table._getCellStyle(i,r),s=t.table.getCellValue(i,r),a=t.table.getCellOriginValue(i,r),l=(eS(QS("padding",o,i,r,t.table)),rA(n,o,e.attribute.width,s,a,i,r,0,t.table)),h=e.getChildByName("progress-bar");e.insertBefore(l,h),e.removeChild(h),h.removeAllChild(),h.release()}else if("sparkline"===a){e.removeAllChild();const n=t.table._getCellStyle(i,r),o=eS(QS("padding",n,i,r,t.table));sA(e,e.parent,e.attribute.x,e.attribute.y,i,r,e.attribute.width,e.attribute.height,o,t.table,OS(n,t.table,i,r,QS).theme)}else if("image"===a||"video"===a)iA(e,i,r,t.table);else if("axis"===e.firstChild?.name)e.firstChild?.originAxis.resize(e.attribute.width,e.attribute.height);else{let o=!0;const s=e.getChildByName("custom-container");if(s){let n,a,l;s.removeAllChild(),e.removeChild(s);if("body"!==t.table.getCellLocation(i,r)){const e=t.table.getHeaderDefine(i,r);a=e?.headerCustomRender,l=e?.headerCustomLayout}else{const e=t.table.getBodyColumnDefine(i,r);a=e?.customRender||t.table.customRender,l=e?.customLayout}if(l||a){const s=eS(QS("padding",t.table._getCellStyle(i,r),i,r,t.table)),h=GS(l,a,i,r,e.attribute.width,e.attribute.height,!1,"autoHeight"===t.table.heightMode,s,t.table);n=h.elementsGroup,o=h.renderDefault}e.childrenCount>0?e.insertBefore(n,e.firstChild):e.appendChild(n)}if(o){const o=t.table._getCellStyle(i,r);!function(t,e,i,r,n,o,s,a){if(RA(t)){e=0;for(let i=t.mergeStartRow;i<=t.mergeEndRow;i++)e+=a.getRowHeight(i);for(let i=t.mergeStartCol;i<=t.mergeEndCol;i++)for(let o=t.mergeStartRow;o<=t.mergeEndRow;o++){const l=a.scenegraph.getCell(i,o);l.forEachChildren((t=>{t.setAttributes({dx:0,dy:0})})),yA(l,e,0,r,n,0,s);const h=a.getRowHeight(o),c=a.getColWidth(i);l.contentHeight=e;const{widthChange:d}=TA(l,c,h,{start:{col:t.mergeStartCol,row:t.mergeStartRow},end:{col:t.mergeEndCol,row:t.mergeEndRow}},a);d&&(l.needUpdateWidth=!0)}}else yA(t,e,0,r,n,0,s)}(e,n,0,"autoHeight"===t.table.heightMode,eS(o.padding),o.textAlign,o.textBaseline,t.table)}}}(t,e,i,r,n)}function sB(t,e,i,r,n){let o=!1;const s=t?.attribute.width??0;if(t?.setAttribute("width",s+e),t?.forEachChildren(((t,a)=>{const l=function(t,e,i,r,n,o,s,a,l){if(e.attribute.width===o&&!e.needUpdateWidth)return!1;e.needUpdateWidth=!1,e.setAttribute("width",o);const h=e;if(!h)return!1;const c=t.table.isHeader(i,r)?t.table._getHeaderLayoutMap(i,r).headerType:t.table.getBodyColumnType(i,r);let d=!1;if("progressbar"===c){const e=t.table.getBodyColumnDefine(i,r),n=t.table._getCellStyle(i,r),o=t.table.getCellValue(i,r),s=t.table.getCellOriginValue(i,r),a=(eS(QS("padding",n,i,r,t.table)),rA(e,n,h.attribute.width,o,s,i,r,0,t.table)),l=h.getChildByName("progress-bar");h.insertBefore(a,l),h.removeChild(l),l.removeAllChild(),l.release()}else if("sparkline"===c){h.removeAllChild();const e=t.table._getCellStyle(i,r),n=eS(QS("padding",e,i,r,t.table));sA(h,h.parent,h.attribute.x,h.attribute.y,i,r,h.attribute.width,h.attribute.height,n,t.table,OS(e,t.table,i,r,QS).theme)}else if("image"===c||"video"===c)iA(h,i,r,t.table);else if("axis"===h.firstChild?.name){const e=t.table.internalProps.layoutMap.getAxisConfigInPivotChart(i,r),n=eS(QS("padding",t.table._getCellStyle(i,r),i,r,t.table));if(e){const i=new I_(e,h.attribute.width,h.attribute.height,n,t.table);h.clear(),h.appendChild(i.component),i.overlap()}}else if("axis"===e.firstChild?.name)e.firstChild?.originAxis.resize(e.attribute.width,e.attribute.height);else{let n=!0;const a=e.getChildByName("custom-container");if(a){let o,s,l;a.removeAllChild(),e.removeChild(a);if("body"!==t.table.getCellLocation(i,r)){const e=t.table.getHeaderDefine(i,r);s=e?.headerCustomRender,l=e?.headerCustomLayout}else{const e=t.table.getBodyColumnDefine(i,r);s=e?.customRender||t.table.customRender,l=e?.customLayout}if(l||s){const e=eS(QS("padding",t.table._getCellStyle(i,r),i,r,t.table)),a=GS(l,s,i,r,h.attribute.width,h.attribute.height,!1,"autoHeight"===t.table.heightMode,e,t.table);o=a.elementsGroup,n=a.renderDefault,d=!0}e.childrenCount>0?e.insertBefore(o,e.firstChild):e.appendChild(o)}if(n){const e=t.table._getCellStyle(i,r);d=function(t,e,i,r,n,o,s,a){if(RA(t)){e=0;let l=!1;for(let i=t.mergeStartCol;i<=t.mergeEndCol;i++)e+=a.getColWidth(i);let h=0;for(let e=t.mergeStartRow;e<=t.mergeEndRow;e++)h+=a.getRowHeight(e);for(let c=t.mergeStartCol;c<=t.mergeEndCol;c++)for(let d=t.mergeStartRow;d<=t.mergeEndRow;d++){const u=a.scenegraph.getCell(c,d);u.forEachChildren((t=>{t.setAttributes({dx:0,dy:0})}));const g=bA(u,e,h,i,r,n,o,s,a.scenegraph),p=pA(u.col,u.row,a);if(p){const t=u.getChildByName("text"),e=u.getChildByName("expand")||u.getChildByName("collapse");"icon-left"!==e?.role&&t&&t.setAttribute("dx",p)}const f=a.getRowHeight(d),m=a.getColWidth(c);u.contentWidth=e;const{heightChange:b}=TA(u,m,f,{start:{col:t.mergeStartCol,row:t.mergeStartRow},end:{col:t.mergeEndCol,row:t.mergeEndRow}},a);b&&(u.needUpdateHeight=!0),l=l||g}return l}return bA(t,e,a.getRowHeight(t.row),i,r,n,o,s,a.scenegraph)}(h,o,s,l,eS(e.padding),e.textAlign,e.textBaseline,t.table)}}return!!l&&d}(n,t,t.col,t.row,0,s+e,e,"row-body"!==r||(t.col,n.table.rowHeaderLevelCount),i);if(l){const e=Nv(n.table,t.col,t.row);if(e&&e.end.row-e.start.row)for(let t=e.start.row;t<=e.end.row;t++)aB(n,t);else aB(n,t.row);o=!0}})),o){let t,e,i,o=0;for(let s=0;s<n.table.colCount;s++){if("col-corner"===r?(i=0,t=n.getColGroup(s,!0),e=n.colHeaderGroup.attribute.height??0):"row-body"===r?(i=n.table.frozenRowCount,t=n.getColGroup(s,!1),e=n.bodyGroup.attribute.height??0):"bottom"===r?(i=n.table.rowCount-n.table.bottomFrozenRowCount,t=n.getColGroupInBottom(s),e=n.bottomFrozenGroup.attribute.height??0):"left-bottom"===r?(i=n.table.rowCount-n.table.bottomFrozenRowCount,t=n.getColGroupInLeftBottomCorner(s),e=n.leftBottomCornerGroup.attribute.height??0):"right-top"===r?(i=0,t=n.getColGroupInRightTopCorner(s),e=n.rightTopCornerGroup.attribute.height??0):"right-bottom"===r&&(i=n.table.rowCount-n.table.bottomFrozenRowCount,t=n.getColGroupInRightBottomCorner(s),e=n.rightBottomCornerGroup.attribute.height??0),!t)continue;let a=0;t.forEachChildren((t=>{t.setAttribute("y",a),a+=n.table.getRowHeight(t.row)??0})),o=a}n.updateContainerHeight(i,o-e)}}function aB(t,e){const i=Math.round(JA(e,0,t.table.colCount-1,t.table));t.table._setRowHeight(e,i,!0);for(let r=0;r<t.table.colCount;r++){const n=i,o=t.highPerformanceGetCell(r,e);if("empty"===o.role)return;oB(t,o,r,e,n,o.attribute.height,t.table.isHeader(r,e))}}var lB;!function(t){t.dropDown="dropDown",t.contextmenu="contextmenu",t.custom="custom"}(lB||(lB={}));const hB={fontSize:12,fontFamily:"Arial,sans-serif",color:"#000",highlightColor:"#2E68CF",hoverBgColor:"#EEE",lineHeight:30,bgColor:"#FFF",cornerRadius:4,borderWidth:.5,borderColor:"#CCC",menuPadding:6,menuItemPadding:9,maxLineWidth:200};const cB=YS();class dB{icon;constructor(){const t=cB.drillDown;this.icon=new NS({x:-1e3,y:-1e3,image:t.svg,width:t.width,height:t.height,dx:-t.width/2,dy:-t.height/2,visible:!1,funcType:t.funcType,cursor:t.cursor}),this.icon.role="icon-drill"}appand(t){t.appendChild(this.icon)}update(t,e,i,r,n,o){if(!t||r&&n)return this.icon.setAttributes({x:-1e3,y:-1e3,visible:!1}),void o.updateNextFrame();const s=cB.drillDown,a=cB.drillUp;this.icon.setAttributes({x:e,y:i,image:r?s.svg:a.svg,visible:!0}),this.icon.loadImage(this.icon.attribute.image),o.updateNextFrame()}}class uB{columnMoverLabel;columnMoverLine;columnMoverBack;table;x;constructor(t){const e=t.theme.dragHeaderSplitLine.lineWidth,i=t.theme.dragHeaderSplitLine.lineColor,r=t.theme.dragHeaderSplitLine.shadowBlockColor;this.columnMoverLabel=hl({visible:!1,pickable:!1,x:0,y:0,symbolType:"triangle",fill:i}),this.columnMoverLine=ul({visible:!1,pickable:!1,stroke:i,lineWidth:e,x:0,y:0,points:[{x:0,y:0},{x:0,y:0}]}),this.columnMoverBack=fl({visible:!1,pickable:!1,fill:r,x:0,y:0,width:0,height:0}),this.table=t}appand(t){t.appendChild(this.columnMoverLabel),t.appendChild(this.columnMoverLine),t.appendChild(this.columnMoverBack)}show(t,e,i){const r=this.table.getCellLocation(t,e),n=Nv(this.table,t,e);n&&(t=n.start.col,e=n.start.row);let o=0,s=0,a=0,l=0,h=0,c=0,d=0,u=0,g=Math.PI;const p=[];"columnHeader"===r?(o=this.table.getColsWidth(0,t-1)-this.table.stateManager.scroll.horizontalBarPos,s=this.table.getRowsHeight(0,this.table.frozenRowCount-1),l=this.table.tableNoFrameHeight,a=n?this.table.getColsWidth(n.start.col,n.end.col):this.table.getColWidth(t),h=o-i,d=o+a,u=2,p.push({x:0,y:0}),p.push({x:0,y:this.table.tableNoFrameHeight})):"rowHeader"===r&&(s=this.table.getRowsHeight(0,e-1)-this.table.stateManager.scroll.verticalBarPos,o=this.table.getColsWidth(0,this.table.frozenColCount-1),a=this.table.tableNoFrameWidth,l=n?this.table.getRowsHeight(n.start.row,n.end.row):this.table.getRowHeight(e),c=s-i,d=2,u=s+l,g=Math.PI/2,p.push({x:0,y:0}),p.push({x:this.table.tableNoFrameWidth,y:0})),this.columnMoverBack.setAttributes({visible:!0,x:o-h,y:s-c,width:a,height:l,dx:h,dy:c}),this.columnMoverLine.setAttributes({x:d,y:u,visible:!0,points:p}),this.columnMoverLabel.setAttributes({visible:!0,x:d,y:u,angle:g})}hide(){this.columnMoverLabel.setAttribute("visible",!1),this.columnMoverLine.setAttribute("visible",!1),this.columnMoverBack.setAttribute("visible",!1)}update(t,e,i,r){"number"==typeof t&&"number"==typeof e?(this.columnMoverLabel.setAttribute("x",e-this.table.stateManager.scroll.horizontalBarPos),this.columnMoverLine.setAttribute("x",e-this.table.stateManager.scroll.horizontalBarPos),this.columnMoverBack.setAttribute("x",t)):"number"==typeof i&&"number"==typeof r&&(this.columnMoverLabel.setAttribute("y",r-this.table.stateManager.scroll.verticalBarPos),this.columnMoverLine.setAttribute("y",r-this.table.stateManager.scroll.verticalBarPos),this.columnMoverBack.setAttribute("y",i))}}function gB(t,e,i){if(i)return e.tableNoFrameWidth-e.getColsWidth(t,e.colCount-1);let r=e.getColsWidth(0,t);return t>=e.frozenColCount&&(r-=e.scrollLeft),r}class pB{table;border;columnResizeLine;columnResizeBgLine;columnResizeLabel;menu;vScrollBar;hScrollBar;frozenShadowLine;drillIcon;cellMover;constructor(t){this.table=t;const e=this.table.theme;this.createScrollBar();const i=e.columnResize?.lineColor,r=e.columnResize?.lineWidth,n=e.columnResize?.bgColor,o=e.columnResize?.width,s=e.columnResize?.labelColor,a=e.columnResize?.labelFontSize,l=e.columnResize?.labelFontFamily,h=e.columnResize?.labelBackgroundFill,c=e.columnResize?.labelBackgroundCornerRadius;this.columnResizeLine=ul({visible:!1,pickable:!1,stroke:i,lineWidth:r,x:0,y:0,points:[{x:0,y:0},{x:0,y:0}]}),this.columnResizeBgLine=ul({visible:!1,pickable:!1,stroke:n,lineWidth:o,x:0,y:0,points:[{x:0,y:0},{x:0,y:0}]});const d=ea({visible:!1,pickable:!1,x:0,y:0,fontSize:a,fill:s,fontFamily:l,text:"",textBaseline:"top",dx:16,dy:-a/2}),u=fl({visible:!1,pickable:!1,fill:h,x:0,y:0,width:5*a*.8,height:a+8,cornerRadius:c,dx:12,dy:-a/2-4});this.columnResizeLabel=cs({visible:!1,pickable:!1,x:0,y:0}),this.columnResizeLabel.appendChild(u),this.columnResizeLabel.appendChild(d),this.cellMover=new uB(this.table);const g=e.frozenColumnLine?.shadow?.width,p=e.frozenColumnLine?.shadow?.startColor,f=e.frozenColumnLine?.shadow?.endColor;this.frozenShadowLine=fl({visible:!0,pickable:!1,x:0,y:0,width:g,height:0,fill:{gradient:"linear",x0:0,y0:0,x1:1,y1:0,stops:[{color:p,offset:0},{color:f,offset:1}]}}),this.menu=new class{_table;_menuInstance;_menuInfo;constructor(t){this._table=t,this._menuInstance=new qS({x:0,y:0,fill:hB.bgColor,stroke:hB.borderColor,cornerRadius:hB.cornerRadius,lineWidth:hB.borderWidth}),this._menuInfo={x:-1,y:-1,col:-1,row:-1,type:lB.dropDown,menuInfo:[],highlightIndex:-1}}bindTableComponent(t){t.appendChild(this._menuInstance),this.bindEvent()}release(){}attach(t,e,i,r,n,o){if(n===lB.dropDown&&this.checkDropDownMenuChange(i,r)){const t=this.getMenuInfo(i,r,n);if(!t)return;const{menuInfo:e,highlightIndex:o}=t;this.updateMenuInfo(i,r,n,e,o),this.updateMenuInstance(e,o)}else if(n===lB.contextmenu&&this.checkContextMenuChange(t,e)){const t=this.getMenuInfo(i,r,n);if(!t)return;const{menuInfo:e,highlightIndex:o}=t;this.updateMenuInfo(i,r,n,e,o),this.updateMenuInstance(e,o)}this.updatePosition(t-this._table.scenegraph.x,e-this._table.scenegraph.y),this.addToScene()}updateMenuInfo(t,e,i,r,n){this._menuInfo.col=t,this._menuInfo.row=e,this._menuInfo.type=i,this._menuInfo.menuInfo=r,this._menuInfo.highlightIndex=n}checkDropDownMenuChange(t,e){const{type:i,col:r,row:n}=this._menuInfo;return i!==lB.dropDown||t!==r||e!==n}checkContextMenuChange(t,e){const{type:i,menuInfo:r}=this._menuInfo;return i!==lB.contextmenu||r!==this._table.internalProps.menu?.contextMenuItems}updateMenuInstance(t,e){this._menuInstance.removeAllChild();let i=hB.menuPadding;const r=hB.menuPadding;let n=0;t.forEach(((t,o)=>{const s=e===o;let a,l;"string"==typeof t?l=t:"object"==typeof t&&(l=t.text,a=s?t.selectedIcon:t.icon);const h=new qS({y:i,x:r,height:hB.lineHeight,fill:hB.bgColor});h.role="menu-item",this._menuInstance.appendChild(h),h.stateProxy=t=>"hover"===t?{fill:hB.hoverBgColor}:{fill:hB.bgColor},h.addEventListener("pointerenter",(t=>{h.addState("hover",!0,!1),this._table.scenegraph.updateNextFrame()})),h.addEventListener("pointerleave",(t=>{h.removeState("hover",!1),this._table.scenegraph.updateNextFrame()}));const c=new ta({x:hB.menuItemPadding,y:hB.menuItemPadding,fill:s?hB.highlightColor:hB.color,text:l,textBaseline:"top",fontSize:hB.fontSize,fontFamily:hB.fontFamily,pickable:!1,maxLineWidth:hB.maxLineWidth,ellipsis:"…"});if(h.addChild(c),a){c.AABBBounds.height();const t=a.width??16,e=a.height??16,i=new NS({x:hB.menuItemPadding,y:(hB.lineHeight-e)/2,width:t,height:e,image:a.svg,pickable:!1});i.role="menu-icon",h.insertBefore(i,c),c.setAttribute("x",t+hB.menuItemPadding)}n=Math.max(h.AABBBounds.width(),n),i+=hB.lineHeight})),this._menuInstance.setAttributes({width:n+2*hB.menuItemPadding+2*hB.menuPadding,height:i+hB.menuPadding}),this._menuInstance.forEachChildren((t=>{t.setAttribute("width",n+2*hB.menuItemPadding)}))}updatePosition(t,e){this._menuInstance.setAttributes({x:this._menuInfo.type===lB.dropDown?t-this._menuInstance.attribute.width:t,y:e}),this._menuInfo.x=lB.dropDown?t-this._menuInstance.attribute.width:t,this._menuInfo.y=e}addToScene(){this._table.scenegraph.updateNextFrame()}detach(){this._menuInstance.setAttributes({x:-1e3,y:-1e3}),this._table.scenegraph.updateNextFrame()}getMenuInfo(t,e,i){if(i===lB.dropDown){const{dropDownMenu:i=this._table.globalDropDownMenu,pivotInfo:r}=this._table._getHeaderLayoutMap(t,e);let n=-1;if(Array.isArray(i))for(let r=0;r<i.length;r++)if(this._table._dropDownMenuIsHighlight(t,e,r)){n=r;break}return{menuInfo:i,highlightIndex:n}}if(i===lB.contextmenu){const i=this._table.internalProps.menu?.contextMenuItems;let r;if(Array.isArray(i))r=i;else if("function"==typeof i){const{field:n}=this._table.isHeader(t,e)?this._table.getHeaderDefine(t,e):this._table.getBodyColumnDefine(t,e);r=i(n,e)}return{menuInfo:r,highlightIndex:-1}}}bindEvent(){this._menuInstance.addEventListener("click",(t=>{const{target:e}=t;if(e&&"menu-item"===e.role){const t=this.getEventInfo(e),i=this._table.getMenuInfo(this._menuInfo.col,this._menuInfo.row,this._menuInfo.type),r=Object.assign(t,i);this._table.fireListeners(ov.DROPDOWN_MENU_CLICK,r)}}))}getEventInfo(t){const e=t.parent;let i=0;e.forEachChildren(((e,r)=>e===t&&(i=r-1,!0)));const r="string"==typeof this._menuInfo.menuInfo[i]?this._menuInfo.menuInfo[i]:this._menuInfo.menuInfo[i].text,n="string"==typeof this._menuInfo.menuInfo[i]?r:this._menuInfo.menuInfo[i].menuKey||r;return{col:this._menuInfo.col,row:this._menuInfo.row,dropDownIndex:i,highlight:i===this._menuInfo.highlightIndex,text:r,menuKey:n}}get bounds(){return this._menuInstance.globalAABBBounds}}(this.table),this.drillIcon=new dB}addToGroup(t){t.addChild(this.frozenShadowLine),t.addChild(this.columnResizeBgLine),t.addChild(this.columnResizeLine),t.addChild(this.columnResizeLabel),this.table.theme.scrollStyle.hoverOn?(t.addChild(this.hScrollBar),t.addChild(this.vScrollBar)):(t.stage.defaultLayer.addChild(this.hScrollBar),t.stage.defaultLayer.addChild(this.vScrollBar)),this.menu.bindTableComponent(t),this.drillIcon.appand(t),this.cellMover.appand(t)}createScrollBar(){const t=this.table.theme,e=t.scrollStyle?.scrollRailColor,i=t.scrollStyle?.scrollSliderColor,r=t.scrollStyle?.width;this.hScrollBar=new Vv({direction:"horizontal",x:2*-this.table.tableNoFrameWidth,y:2*-this.table.tableNoFrameHeight,width:this.table.tableNoFrameWidth,height:r,padding:0,railStyle:{fill:e},sliderStyle:{fill:i},range:[0,.1],visible:!1}),this.hScrollBar.render(),this.hScrollBar.hideAll(),this.vScrollBar=new Vv({direction:"vertical",x:2*-this.table.tableNoFrameWidth,y:2*-this.table.tableNoFrameHeight,width:r,height:this.table.tableNoFrameHeight-this.table.getFrozenRowsHeight(),padding:0,railStyle:{fill:e},sliderStyle:{fill:i},range:[0,.1],visible:!1}),this.vScrollBar.render(),this.vScrollBar.hideAll()}updateScrollBar(){const t=this.table.stateManager.scroll.horizontalBarPos,e=this.table.stateManager.scroll.verticalBarPos,i=this.table.theme,r=i.scrollStyle?.width,n=i.scrollStyle?.visible,o=Math.ceil(this.table.scenegraph.tableGroup.attribute.width),s=Math.ceil(this.table.scenegraph.tableGroup.attribute.height),a=this.table.getAllRowsHeight(),l=this.table.getAllColsWidth(),h=this.table.getFrozenRowsHeight(),c=this.table.getFrozenColsWidth(),d=this.table.getBottomFrozenRowsHeight(),u=this.table.getRightFrozenColsWidth();if(l>o){const t=Math.min(s,a),e=Math.max(.05,(o-c)/(l-c));this.hScrollBar.setAttributes({x:c+(this.table.theme.scrollStyle.hoverOn?0:this.table.scenegraph.tableGroup.attribute.x),y:t-(this.table.theme.scrollStyle.hoverOn?r:-this.table.scenegraph.tableGroup.attribute.y),width:o-c-u,range:[0,e],visible:"always"===n});const i=this.hScrollBar.AABBBounds&&this.hScrollBar.globalAABBBounds;this.hScrollBar._viewPosition={x:i.x1,y:i.y1},"always"===n&&this.hScrollBar.showAll()}else this.hScrollBar.setAttributes({x:2*-this.table.tableNoFrameWidth,y:2*-this.table.tableNoFrameHeight,width:0,visible:!1});if(a>s){const t=Math.min(o,l),e=Math.max(.05,(s-h)/(a-h));this.vScrollBar.setAttributes({x:t-(this.table.theme.scrollStyle.hoverOn?r:-this.table.scenegraph.tableGroup.attribute.x),y:h+(this.table.theme.scrollStyle.hoverOn?0:this.table.scenegraph.tableGroup.attribute.y),height:s-h-d,range:[0,e],visible:"always"===n});const i=this.vScrollBar.AABBBounds&&this.vScrollBar.globalAABBBounds;this.vScrollBar._viewPosition={x:i.x1,y:i.y1},"always"===n&&this.vScrollBar.showAll()}else this.vScrollBar.setAttributes({x:2*-this.table.tableNoFrameWidth,y:2*-this.table.tableNoFrameHeight,height:0,visible:!1});this.table.stateManager.setScrollLeft(t),this.table.stateManager.setScrollTop(e)}hideResizeCol(){this.columnResizeLine.setAttribute("visible",!1),this.columnResizeBgLine.setAttribute("visible",!1),this.columnResizeLabel.setAttribute("visible",!1),this.columnResizeLabel.hideAll()}showResizeCol(t,e,i){const r=gB(t,this.table,i);this.columnResizeLine.setAttributes({visible:!0,x:r,points:[{x:0,y:0},{x:0,y:this.table.getRowsHeight(0,this.table.rowCount-1)}]}),this.columnResizeBgLine.setAttributes({visible:!0,x:r,points:[{x:0,y:0},{x:0,y:this.table.getRowsHeight(0,this.table.rowCount-1)}]}),this.columnResizeLabel.showAll(),this.columnResizeLabel.setAttributes({visible:!0,x:r,y:e}),this.columnResizeLabel.lastChild.setAttribute("text",`${this.table.getColWidth(t)}px`)}updateResizeCol(t,e,i){const r=gB(t,this.table,i);this.columnResizeLine.setAttributes({x:r,points:[{x:0,y:0},{x:0,y:this.table.getRowsHeight(0,this.table.rowCount-1)}]}),this.columnResizeBgLine.setAttributes({x:r,points:[{x:0,y:0},{x:0,y:this.table.getRowsHeight(0,this.table.rowCount-1)}]}),this.columnResizeLabel.setAttributes({x:r,y:e}),this.columnResizeLabel.lastChild.setAttribute("text",`${Math.floor(this.table.getColWidth(t))}px`)}hideMoveCol(){this.cellMover.hide()}showMoveCol(t,e,i){this.cellMover.show(t,e,i)}updateMoveCol(t,e,i,r){this.cellMover.update(t,e,i,r)}setFrozenColumnShadow(t,e){if(t<0)this.frozenShadowLine.setAttributes({visible:!1});else{const i=gB(t,this.table,e);this.frozenShadowLine.setAttributes({visible:!0,x:i,height:this.table.getRowsHeight(0,this.table.rowCount-1)})}}hideVerticalScrollBar(){const t=this.table.theme.scrollStyle.visible;"focus"!==t&&"scrolling"!==t||(this.vScrollBar.setAttribute("visible",!1),this.vScrollBar.hideAll(),this.table.scenegraph.updateNextFrame())}showVerticalScrollBar(){const t=this.table.theme.scrollStyle.visible;"focus"!==t&&"scrolling"!==t||(this.vScrollBar.setAttribute("visible",!0),this.vScrollBar.showAll(),this.table.scenegraph.updateNextFrame())}hideHorizontalScrollBar(){const t=this.table.theme.scrollStyle.visible;"focus"!==t&&"scrolling"!==t||(this.hScrollBar.setAttribute("visible",!1),this.hScrollBar.hideAll(),this.table.scenegraph.updateNextFrame())}showHorizontalScrollBar(){const t=this.table.theme.scrollStyle.visible;"focus"!==t&&"scrolling"!==t||(this.hScrollBar.setAttribute("visible",!0),this.hScrollBar.showAll(),this.table.scenegraph.updateNextFrame())}updateVerticalScrollBarPos(t){const e=this.vScrollBar.attribute.range,i=e[1]-e[0],r=t*(1-i);this.vScrollBar.setAttribute("range",[r,r+i]);const n=this.vScrollBar.AABBBounds&&this.vScrollBar.globalAABBBounds;this.vScrollBar._viewPosition={x:n.x1,y:n.y1}}updateHorizontalScrollBarPos(t){const e=this.hScrollBar.attribute.range,i=e[1]-e[0],r=t*(1-i);this.hScrollBar.setAttribute("range",[r,r+i]);const n=this.hScrollBar.AABBBounds&&this.hScrollBar.globalAABBBounds;this.hScrollBar._viewPosition={x:n.x1,y:n.y1}}}function fB(t,e,i,r,n){if(!e)return;const o="table"===i,{shadowBlur:s,shadowOffsetX:a,shadowOffsetY:l,shadowColor:h,cornerRadius:c,borderColor:d,borderLineWidth:u,borderLineDash:g}=e;let p=!1;const f={},m={pickable:!1};s&&o&&(m.shadowBlur=s,m.shadowOffsetX=a,m.shadowOffsetY=l,m.shadowColor=h,m.stroke=!0,m.stroke=h,m.lineWidth=1,p=!0),u&&(m.stroke=!0,m.fill=!1,m.stroke=bB(d,r),m.lineWidth=u,g&&(m.lineDash=g),m.lineCap="square"),Array.isArray(d)&&(m.strokeArrayColor=eS(d)),Array.isArray(u)&&(m.strokeArrayWidth=eS(u),m.lineWidth=1),c&&(m.cornerRadius=c,f.cornerRadius=c);const b=m.strokeArrayWidth?m.strokeArrayWidth[0]:m.lineWidth??0,y=m.strokeArrayWidth?m.strokeArrayWidth[1]:m.lineWidth??0,C=m.strokeArrayWidth?m.strokeArrayWidth[2]:m.lineWidth??0,v=m.strokeArrayWidth?m.strokeArrayWidth[3]:m.lineWidth??0;if(t.setAttributes(f),!n&&m.stroke)if(m.x=v/2,m.y=b/2,m.pickable=!1,o){let e,i;if(m.x=t.attribute.x-v/2,m.y=t.attribute.y-b/2,m.width=t.attribute.width+v/2+y/2,m.height=t.attribute.height+b/2+C/2,p){m.fill="white",m.notAdjustPos=!0,i=cs(m),i.name="table-border-rect",e=fl({x:v/2,y:b/2,width:t.attribute.width,height:t.attribute.height,fill:"red",cornerRadius:t.attribute.cornerRadius,globalCompositeOperation:"destination-out"}),i.addChild(e);const r=fl({width:1,height:1,fill:"transparent",pickable:!1});i.addChild(r)}else i=fl(m),i.name="table-border-rect";t.parent.insertBefore(i,t),t.border=i}else{m.width=t.attribute.width-v/2-y/2,m.height=t.attribute.height-b/2-C/2;const e=fl(m);e.name="border-rect",t.addChild(e),t.border=e}}function mB(t,e,i){const{borderColor:r}=e;t.border?.setAttribute("stroke",bB(r,i))}function bB(t,e){let i=!0;return e&&!it(t)?i=e.map((e=>!!e&&t)):e?i=e:e||it(t)?it(t)&&(i=!0):i=t,i}function yB(t){if(!t.border)return;const e=t.border.attribute.strokeArrayWidth?t.border.attribute.strokeArrayWidth[0]:t.border.attribute.lineWidth??0,i=t.border.attribute.strokeArrayWidth?t.border.attribute.strokeArrayWidth[1]:t.border.attribute.lineWidth??0,r=t.border.attribute.strokeArrayWidth?t.border.attribute.strokeArrayWidth[2]:t.border.attribute.lineWidth??0,n=t.border.attribute.strokeArrayWidth?t.border.attribute.strokeArrayWidth[3]:t.border.attribute.lineWidth??0;t.border.setAttributes({width:t.attribute.width-n/2-i/2,height:t.attribute.height-e/2-r/2}),"group"===t.border.type&&t.border.firstChild.setAttributes({width:t.attribute.width,height:t.attribute.height})}function CB(t,e){t.setAttribute("cornerRadius",e),t.border&&t.border.setAttribute("cornerRadius",e)}
/*! *****************************************************************************
    Copyright (c) Microsoft Corporation.

    Permission to use, copy, modify, and/or distribute this software for any
    purpose with or without fee is hereby granted.

    THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
    REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
    AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
    INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
    LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
    OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
    PERFORMANCE OF THIS SOFTWARE.
    ***************************************************************************** */function vB(t,e,i,r){var n,o=arguments.length,s=o<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,i,r);else for(var a=t.length-1;a>=0;a--)(n=t[a])&&(s=(o<3?n(s):o>3?n(e,i,s):n(e,i))||s);return o>3&&s&&Object.defineProperty(e,i,s),s}const wB=[],xB=[];let _B=5,SB=!1;function AB(t){Y(t)&&(_B=t)}function BB(t){const{axes:e,dataId:i,data:r,spec:n}=t.attribute,{chartInstance:o}=t,s=t.getViewBox();s.x2<=s.x1&&(s.x2=s.x1+1),s.y2<=s.y1&&(s.y2=s.y1+1),e.forEach(((t,e)=>{"band"===t.type?o.updateModelSpec({type:"axes",index:e},{domain:t.domain.slice(0)},!0):o.updateModelSpecSync({type:"axes",index:e},{min:t.range?.min??0,max:t.range?.max??0},!0)})),o.updateViewBox({x1:s.x1-t.getRootNode().table.scrollLeft,x2:s.x2-t.getRootNode().table.scrollLeft,y1:s.y1-t.getRootNode().table.scrollTop,y2:s.y2-t.getRootNode().table.scrollTop},!1,!1);const a=t.getRootNode().table;if(a.internalProps.layoutMap?.updateDataStateToActiveChartInstance?.(o),"string"==typeof i)o.updateDataSync(i,r??[]);else{const t=[];for(const e in i){const s=i[e],a=n.series.find((t=>t?.data?.id===e));t.push({id:e,values:s?r?.filter((t=>t.hasOwnProperty(s)))??[]:r??[],fields:a?.data?.fields}),o.updateFullDataSync||o.updateDataSync(e,s?r?.filter((t=>t.hasOwnProperty(s)))??[]:r??[])}o.updateFullDataSync?.(t)}!function(t,e){const{viewWidth:i,viewHeight:r}=t;if(i<MB&&r<MB)return void(e.cacheCanvas=t.toCanvas());const n=Math.ceil(r/MB),o=Math.ceil(i/MB),s=[];for(let e=0;e<n;e++)for(let n=0;n<o;n++){const o=n*MB,a=e*MB,l=o+MB>i?i:o+MB,h=a+MB>r?r:a+MB,c=l-o,d=h-a,u=new ue;u.setValue(o,a,l,h);const g=t.toCanvas(!1,u);s.push({canvas:g,x:o,y:a,width:c,height:d})}e.cacheCanvas=s}(o.getStage(),t)}function TB(t){SB=!0,xB.length>0?requestAnimationFrame((()=>{const e=xB.splice(0,_B);wB.splice(0,_B),e.forEach((t=>{BB(t),t.addUpdateBoundTag()})),t.render(),TB(t)})):SB=!1}const MB=2e3;const RB=Symbol.for("ChartRender");let PB=class{type;numberType=lA;drawShape(t,e,i,r,n,o,s,a){const l=Cn(t,o?.theme).group,{dataId:h,data:c,spec:d}=t.attribute;t.getViewBox();const{width:u=l.width,height:g=l.height}=t.attribute,{chartInstance:p,active:f,cacheCanvas:m,activeChartInstance:b}=t;if(!f&&m)it(m)?m.forEach((t=>{const{x:i,y:r,width:n,height:o,canvas:s}=t;e.drawImage(s,i,r,n,o)})):e.drawImage(m,i,r,u,g);else if(b)if("string"==typeof h)b.updateDataSync(h,c??[]);else{const t=[];for(const e in h){const i=h[e],r=d.series.find((t=>t?.data?.id===e));t.push({id:e,values:i?c?.filter((t=>t.hasOwnProperty(i)))??[]:c??[],fields:r?.data?.fields}),p.updateFullDataSync||b.updateDataSync(e,i?c?.filter((t=>t.hasOwnProperty(i)))??[]:c??[])}b.updateFullDataSync?.(t)}else t.getRootNode().table.internalProps.renderChartAsync?(-1===wB.indexOf(`${t.parent.col}+${t.parent.row}`)&&(wB.push(`${t.parent.col}+${t.parent.row}`),xB.push(t)),SB||TB(t.getRootNode().table)):BB(t)}draw(t,e,i,r){const{context:n}=i;if(!n)return;const{clip:o}=t.attribute;o?n.save():n.highPerformanceSave(),n.transformFromMatrix(t.transMatrix,!0),n.beginPath(),r.skipDraw?this.drawShape(t,n,0,0,i,r,(()=>!1),(()=>!1)):this.drawShape(t,n,0,0,i),o?n.restore():n.highPerformanceRestore()}};PB=vB([f()],PB);let EB=class{time=Ti.beforeFillStroke;useStyle=!0;order=0;drawShape(t,e,i,r,n,o,s,a,l,h,c,d,u){const{shape:g}=t.attribute;if("circle"===g){const{width:n=l.width,height:o=l.height}=t.attribute;e.beginPath(),e.arc(i+n/2,r+o/2,Math.min(n,o)/2,0,2*Math.PI),e.closePath(),e.save(),e.clip()}}};EB=vB([f()],EB);let HB=class{time=Ti.afterFillStroke;useStyle=!0;order=0;drawShape(t,e,i,r,n,o,s,a,l,h,c,d,u){const{shape:g}=t.attribute;"circle"===g&&e.restore()}};function LB(t,e,i,r){const{highlightScope:n,disableHeader:o,cellPos:s}=t.hover,a=t.table,l=a.isHeader(e,i);if(l&&o)return;let h;if(n===Xy.single&&s.col===e&&s.row===i?h="cellBgColor":n===Xy.column&&s.col===e?h="inlineColumnBgColor":n===Xy.row&&s.row===i?h="inlineRowBgColor":n===Xy.cross&&(s.col===e&&s.row===i?h="cellBgColor":s.col===e?h="inlineColumnBgColor":s.row===i&&(h="inlineRowBgColor")),h){let t;if(l){const n=a.getHeaderDefine(e,i);t=n?.disableHeaderHover,r.firstChild&&"axis"===r.firstChild.name&&a.options.hover?.disableAxisHover&&(t=!0)}else{const r=a.getBodyColumnDefine(e,i);t=r?.disableHover}t&&(h=void 0)}return h}HB=vB([f()],HB);let kB=class{time=Ti.beforeFillStroke;useStyle=!0;order=0;drawShape(t,e,i,r,n,o,s,a,l,h,c,d,u){const{stroke:g=l.stroke,strokeArrayWidth:p=l.strokeArrayWidth,strokeArrayColor:f=l.strokeArrayColor}=t.attribute;g&&(Array.isArray(p)||Array.isArray(f))&&(u.doStroke=!1)}};kB=vB([f()],kB);let IB=class{time=Ti.afterFillStroke;useStyle=!0;order=0;drawShape(t,e,i,r,n,o,s,a,l,h,c,d){const{width:u=l.width,height:g=l.height,stroke:p=l.stroke,strokeArrayColor:f=l.strokeArrayColor,strokeArrayWidth:m=l.strokeArrayWidth,lineWidth:b=l.lineWidth,strokeColor:y=l.stroke}=t.attribute;if(!p||!Array.isArray(m)&&0===b)return;let C,v;if(Array.isArray(f)||Array.isArray(m)){if("number"==typeof b&&1&b||Array.isArray(m)&&m.some((t=>1&t))){i=Math.floor(i)+.5,r=Math.floor(r)+.5;const{width:e,height:n}=VB(t,Math.ceil(u),Math.ceil(g));C=e,v=n}else C=Math.ceil(u),v=Math.ceil(g);FB(t,e,i,r,l,p,m||b,f||y,C,v)}}};function FB(t,e,i,r,n,o,s,a,l,h,c,d){const u=function(t){if(!Array.isArray(t))return{isSplitDraw:!1,width:t};let e;for(let i=0;i<t.length;i++){const r=t[i];if(r)if(e){if(r!==e)return{isSplitDraw:!0}}else e=r}return{isSplitDraw:!1,width:e}}(s),g=!Array.isArray(s),p=!Array.isArray(o),f=Array.isArray(d),m=Array.isArray(a)||u.isSplitDraw;e.setStrokeStyle(t,t.attribute,i,r,n);let b=!1;e.getLineDash().length&&(b=!0),e.beginPath(),e.moveTo(i,r),(p||o[0])&&(g||s[0])?(f&&Array.isArray(d[0])?(e.moveTo(i+l*d[0][0],r),e.lineTo(i+l*(d[0][1]-d[0][0]),r),e.moveTo(i+l,r)):(e.moveTo(i,r),e.lineTo(i+l,r)),!m&&!b||a&&!a[0]||(a&&(e.strokeStyle=a[0]),g||(e.lineWidth=s[0]),e.lineDashOffset=e.currentMatrix.e/e.currentMatrix.a,e.stroke(),e.beginPath(),e.moveTo(i+l,r))):e.moveTo(i+l,r),(p||o[1])&&(g||s[1])?(f&&Array.isArray(d[1])?(e.moveTo(i+l,r+h*d[1][0]),e.lineTo(i+l,r+h*(d[1][1]-d[1][0])),e.moveTo(i+l,r+h)):(e.moveTo(i+l,r),e.lineTo(i+l,r+h)),!m&&!b||a&&!a[1]||(a&&(e.strokeStyle=a[1]),g||(e.lineWidth=s[1]),e.lineDashOffset=e.currentMatrix.f/e.currentMatrix.d,e.stroke(),e.beginPath(),e.moveTo(i+l,r+h))):e.moveTo(i+l,r+h),(p||o[2])&&(g||s[2])?(f&&Array.isArray(d[2])?(e.moveTo(i+l*d[2][0],r+h),e.lineTo(i+l*(d[2][1]-d[2][0]),r+h),e.moveTo(i,r+h)):(e.moveTo(i,r+h),e.lineTo(i+l,r+h)),!m&&!b||a&&!a[2]||(a&&(e.strokeStyle=a[2]),g||(e.lineWidth=s[2]),e.lineDashOffset=e.currentMatrix.e/e.currentMatrix.a,e.stroke(),e.beginPath(),e.moveTo(i,r+h))):e.moveTo(i,r+h),(p||o[3])&&(g||s[3])?(f&&Array.isArray(d[3])?(e.moveTo(i,r+h*d[3][0]),e.lineTo(i,r+h*(d[3][1]-d[3][0])),e.moveTo(i,r)):(e.moveTo(i,r),e.lineTo(i,r+h)),!m&&!b||a&&!a[3]||(a&&(e.strokeStyle=a[3]),g||(e.lineWidth=s[3]),e.lineDashOffset=e.currentMatrix.f/e.currentMatrix.d,e.stroke(),e.beginPath(),e.moveTo(i,r))):e.moveTo(i,r),m||b||(!g&&u.width&&(e.lineWidth=u.width),e.stroke())}IB=vB([f()],IB);let zB=class{time=Ti.beforeFillStroke;useStyle=!0;order=0;drawShape(t,e,i,r,n,o,s,a,l,h,c,d,u){const{lineDash:g=l.lineDash,stroke:p=l.stroke,strokeArrayColor:f=l.strokeArrayColor,strokeArrayWidth:m=l.strokeArrayWidth}=t.attribute;p&&Array.isArray(g)&&g.length&&!Array.isArray(f)&&!Array.isArray(m)&&(u.doStroke=!1)}};zB=vB([f()],zB);let OB=class{time=Ti.afterFillStroke;useStyle=!0;order=0;drawShape(t,e,i,r,n,o,s,a,l,h,c,d){const{lineDash:u=l.lineDash,stroke:g=l.stroke,strokeArrayColor:p=l.strokeArrayColor,strokeArrayWidth:f=l.strokeArrayWidth,lineWidth:m=l.lineWidth}=t.attribute;if(!g||!Array.isArray(u)||!u.length||Array.isArray(p)||Array.isArray(f))return;let b,y,{width:C=l.width,height:v=l.height}=t.attribute;if(C=Math.ceil(C),v=Math.ceil(v),1&m){i=Math.floor(i)+.5,r=Math.floor(r)+.5;const{width:e,height:n}=VB(t,Math.ceil(C),Math.ceil(v));b=e,y=n}else b=Math.ceil(C),y=Math.ceil(v);e.setStrokeStyle(t,t.attribute,i,r,l),e.beginPath(),e.moveTo(i,r),e.lineTo(i+b,r),e.lineDashOffset=e.currentMatrix.e/e.currentMatrix.a,e.stroke(),e.beginPath(),e.moveTo(i+b,r),e.lineTo(i+b,r+y),e.lineDashOffset=e.currentMatrix.f/e.currentMatrix.d,e.stroke(),e.beginPath(),e.moveTo(i,r+y),e.lineTo(i+b,r+y),e.lineDashOffset=e.currentMatrix.e/e.currentMatrix.a,e.stroke(),e.beginPath(),e.moveTo(i,r),e.lineTo(i,r+y),e.lineDashOffset=e.currentMatrix.f/e.currentMatrix.d,e.stroke()}};OB=vB([f()],OB);let DB=class{time=Ti.beforeFillStroke;useStyle=!0;order=0;drawShape(t,e,i,r,n,o,s,a,l,h,c,d,u){const{lineWidth:g=l.lineWidth,stroke:p=l.stroke,lineDash:f=l.lineDash,strokeArrayWidth:m=l.strokeArrayWidth,strokeArrayColor:b=l.strokeArrayColor,notAdjustPos:y}=t.attribute;!0!==y&&p&&Array.isArray(f)&&!f.length&&!Array.isArray(b)&&!Array.isArray(m)&&1&g&&(u.doStroke=!1)}};DB=vB([f()],DB);let WB=class{time=Ti.afterFillStroke;useStyle=!0;order=0;drawShape(t,e,i,r,n,o,s,a,l,h,c,d){const{lineWidth:u=l.lineWidth,stroke:g=l.stroke,lineDash:p=l.lineDash,strokeArrayWidth:f=l.strokeArrayWidth,strokeArrayColor:m=l.strokeArrayColor,notAdjustPos:b,cornerRadius:y=l.cornerRadius}=t.attribute,{width:C=l.width,height:v=l.height}=t.attribute;if(!0!==b&&g&&Array.isArray(p)&&!p.length&&!Array.isArray(m)&&!Array.isArray(f)&&1&u){const{width:n,height:o}=VB(t,Math.ceil(C),Math.ceil(v));e.beginPath(),i=Math.floor(i)+.5,r=Math.floor(r)+.5,y?Hh(e,i,r,n,o,y):e.rect(i,r,n,o),e.setStrokeStyle(t,t.attribute,i,r,l),e.stroke()}}};WB=vB([f()],WB);let NB=class{time=Ti.beforeFillStroke;useStyle=!0;order=0;drawShape(t,e,i,r,n,o,s,a,l,h,c,d,u){if("cell"===t.role){const e=t.stage.table;if(e.stateManager.interactionState!==$y.scrolling){const i=function(t,e){let i,r;if("cell"===t.role&&Y(t.mergeStartCol)&&Y(t.mergeStartRow)&&Y(t.mergeEndCol)&&Y(t.mergeEndRow))for(let r=t.mergeStartCol;r<=t.mergeEndCol;r++)for(let n=t.mergeStartRow;n<=t.mergeEndRow;n++){const o=LB(e.stateManager,r,n,t);!o||i&&"cellBgColor"!==o||(i=o)}else"cell"===t.role&&(i=LB(e.stateManager,t.col,t.row,t));if(!i)return;const n=e.internalProps.layoutMap;return n.isCornerHeader(t.col,t.row)?r=e.theme.cornerHeaderStyle?.hover||e.theme.headerStyle?.hover:n.isColumnHeader(t.col,t.row)?r=e.theme.headerStyle?.hover:n.isRowHeader(t.col,t.row)?r=e.theme.rowHeaderStyle?.hover:n.isBottomFrozenRow(t.col,t.row)?r=e.theme.bottomFrozenStyle?.hover||(e.isListTable()?e.theme.bodyStyle?.hover:e.theme.headerStyle?.hover):n.isRightFrozenColumn(t.col,t.row)?r=e.theme.rightFrozenStyle?.hover||(e.isListTable()?e.theme.bodyStyle?.hover:e.theme.rowHeaderStyle?.hover):e.isHeader(t.col,t.row)||(r=e.theme.bodyStyle?.hover),QS(i,r,t.col,t.row,e)}(t,e);i&&(t.attribute._vtableHoverFill=i)}}}};NB=vB([f()],NB);let GB=class{time=Ti.afterFillStroke;useStyle=!0;order=0;drawShape(t,e,i,r,n,o,s,a,l,h,c,d){if(t.attribute._vtableHoverFill)if(c);else if(s){const n=t.attribute.fill;t.attribute.fill=t.attribute._vtableHoverFill,e.setCommonStyle(t,t.attribute,i,r,l),e.fill(),t.attribute.fill=n,t.attribute._vtableHoverFill=void 0}}};GB=vB([f()],GB);let jB=class{time=Ti.beforeFillStroke;useStyle=!0;order=0;drawShape(t,e,i,r,n,o,s,a,l,h,c,d,u){const g=t.stage.table;if("body"===t.role){const i=-(t.attribute.x??0)+g.getFrozenColsWidth(),r=-(t.attribute.y??0)+g.getFrozenRowsHeight(),n=t.parent.attribute.width-g.getFrozenColsWidth()-g.getRightFrozenColsWidth(),o=t.parent.attribute.height-g.getFrozenRowsHeight()-g.getBottomFrozenRowsHeight();e.beginPath(),e.rect(i,r,n,o)}else if("row-header"===t.role){const i=0,r=-(t.attribute.y??0)+g.getFrozenRowsHeight(),n=g.getFrozenColsWidth(),o=t.parent.attribute.height-g.getFrozenRowsHeight()-g.getBottomFrozenRowsHeight();e.beginPath(),e.rect(i,r,n,o)}else if("col-header"===t.role){const i=-(t.attribute.x??0)+g.getFrozenColsWidth(),r=0,n=t.parent.attribute.width-g.getFrozenColsWidth()-g.getRightFrozenColsWidth(),o=g.getFrozenRowsHeight();e.beginPath(),e.rect(i,r,n,o)}else if("right-frozen"===t.role){const i=0,r=-(t.attribute.y??0)+g.getFrozenRowsHeight(),n=g.getRightFrozenColsWidth(),o=t.parent.attribute.height-g.getFrozenRowsHeight()-g.getBottomFrozenRowsHeight();e.beginPath(),e.rect(i,r,n,o)}else if("bottom-frozen"===t.role){const i=-(t.attribute.x??0)+g.getFrozenColsWidth(),r=0,n=t.parent.attribute.width-g.getFrozenColsWidth()-g.getRightFrozenColsWidth(),o=g.getBottomFrozenRowsHeight();e.beginPath(),e.rect(i,r,n,o)}else if("corner-header"===t.role){const t=0,i=0,r=g.getFrozenColsWidth(),n=g.getFrozenRowsHeight();e.beginPath(),e.rect(t,i,r,n)}else if("corner-right-top-header"===t.role){const t=0,i=0,r=g.getRightFrozenColsWidth(),n=g.getFrozenRowsHeight();e.beginPath(),e.rect(t,i,r,n)}else if("corner-right-bottom-header"===t.role){const t=0,i=0,r=g.getRightFrozenColsWidth(),n=g.getBottomFrozenRowsHeight();e.beginPath(),e.rect(t,i,r,n)}else if("corner-left-bottom-header"===t.role){const t=0,i=0,r=g.getFrozenColsWidth(),n=g.getBottomFrozenRowsHeight();e.beginPath(),e.rect(t,i,r,n)}}};jB=vB([f()],jB);let UB=class{time=Ti.afterFillStroke;useStyle=!0;order=0;drawShape(t,e,i,r,n,o,s,a,l,h,c,d){t.role}};function VB(t,e,i){const r=t.stage.table;if("cell"===t.role){let n=t.col,o=t.row;const s=Nv(r,n,o);s&&(n=s.end.col,o=s.end.row),(r&&n===r.colCount-1||r&&n===r.frozenColCount-1&&r.scrollLeft)&&(e-=1),(r&&o===r.rowCount-1||r&&o===r.frozenRowCount-1&&r.scrollTop)&&(i-=1)}else"corner-frozen"===t.role&&(r.scrollLeft&&(e-=1),r.scrollTop&&(i-=1));return{width:e,height:i}}UB=vB([f()],UB);let KB=class{time=Ti.beforeFillStroke;useStyle=!0;order=0;drawShape(t,e,i,r,n,o,s,a,l,h,c,d,u){const{stroke:g=l.stroke,strokeArrayWidth:p=l.strokeArrayWidth,strokeArrayColor:f=l.strokeArrayColor}=t.attribute;g&&(Array.isArray(g)||Array.isArray(p)||Array.isArray(f))&&(u.doStroke=!1)}};KB=vB([f()],KB);let $B=class{time=Ti.afterFillStroke;useStyle=!0;order=0;drawShape(t,e,i,r,n,o,s,a,l,h,c,d){const{width:u=l.width,height:g=l.height,stroke:p=l.stroke,strokeArrayColor:f=l.strokeArrayColor,strokeArrayWidth:m=l.strokeArrayWidth,lineWidth:b=l.lineWidth,strokeColor:y=l.stroke}=t.attribute;p&&(Array.isArray(m)||0!==b)&&(Array.isArray(p)||Array.isArray(f)||Array.isArray(m))&&("border-rect"!==t.name&&"table-border-rect"!==t.name&&("number"==typeof b&&1&b||Array.isArray(m)&&m.some((t=>1&t)))&&(i=Math.floor(i)+.5,r=Math.floor(r)+.5),FB(t,e,i,r,l,p,m||b,f||y,Math.ceil(u),Math.ceil(g)))}};$B=vB([f()],$B);var XB=new i(((t,e,i,r)=>{i(Ih)?r(Ih).to(KB).inSingletonScope():(t(KB).toSelf().inSingletonScope(),t(Gs).toService(KB)),i(Fh)?r(Fh).to($B).inSingletonScope():(t($B).toSelf().inSingletonScope(),t(Gs).toService($B)),t(PB).toSelf().inSingletonScope(),t(RB).to(PB),t(Xc).to(PB),t(EB).toSelf().inSingletonScope(),t(Ds).toService(EB),t(HB).toSelf().inSingletonScope(),t(Ds).toService(HB),t(NB).toSelf().inSingletonScope(),t(Os).toService(NB),t(GB).toSelf().inSingletonScope(),t(Os).toService(GB),t(IB).toSelf().inSingletonScope(),t(Os).toService(IB),t(kB).toSelf().inSingletonScope(),t(Os).toService(kB),t(zB).toSelf().inSingletonScope(),t(Os).toService(zB),t(OB).toSelf().inSingletonScope(),t(Os).toService(OB),t(DB).toSelf().inSingletonScope(),t(Os).toService(DB),t(WB).toSelf().inSingletonScope(),t(Os).toService(WB),t(jB).toSelf().inSingletonScope(),t(Os).toService(jB),t(UB).toSelf().inSingletonScope(),t(Os).toService(UB)}));function YB(t,e,i,r){"undefined"!=typeof window&&window.performance.now(),e=e??0,i=i??t.colCount-1,0===e&&i===t.colCount-1&&t._clearColRangeWidthsMap();const n=[],o=[];if(r)for(let e=0;e<t.colCount;e++)n[e]=t.getColWidth(e);for(let n=e;n<=i;n++){let e;if(!t.internalProps.transpose&&"only-header"===t.internalProps.layoutMap.columnWidths?.[n]?.columnWidthComputeMode&&"showHeader"in t.internalProps.layoutMap){const i=t.internalProps.layoutMap.showHeader;t.internalProps.layoutMap.showHeader=!0,e=qB(n,0,t.internalProps.layoutMap.headerLevelCount-1,t),t.internalProps.layoutMap.showHeader=i}else e=t.internalProps.transpose||"only-body"!==t.internalProps.layoutMap.columnWidths?.[n]?.columnWidthComputeMode?qB(n,0,t.rowCount-1,t):qB(n,t.internalProps.layoutMap.getBodyRange().start.row,t.internalProps.layoutMap.getBodyRange().end.row,t);t._setColContentWidth(n,e);t.getColWidth(n)!==e&&t._clearColRangeWidthsMap(n),r?o[n]=Math.round(t._adjustColWidth(n,e)):t._setColWidth(n,t._adjustColWidth(n,e),!1,!0)}if("adaptive"===t.widthMode){t._clearColRangeWidthsMap();const e=t.tableNoFrameWidth;let i=0;for(let e=0;e<t.colCount;e++){const n=r?o[e]:t.getColWidth(e);(e<t.rowHeaderLevelCount||t.isPivotChart()&&e>=t.colCount-t.rightFrozenColCount)&&(i+=n)}eT(e-i,t.rowHeaderLevelCount,t.isPivotChart()?t.colCount-t.rightFrozenColCount:t.colCount,r,o,t)}else if(t.autoFillWidth){t._clearColRangeWidthsMap();const e=t.tableNoFrameWidth;let i=0,n=0;for(let e=0;e<t.colCount;e++){const s=r?o[e]:t.getColWidth(e);(e<t.rowHeaderLevelCount||t.isPivotChart()&&e>=t.colCount-t.rightFrozenColCount)&&(i+=s),n+=s}if(n<e&&n>i){eT(e-i,t.rowHeaderLevelCount,t.isPivotChart()?t.colCount-t.rightFrozenColCount:t.colCount,r,o,t)}}if(r){for(let e=0;e<t.colCount;e++){const i=o[e]??t.getColWidth(e);i!==n[e]&&t._setColWidth(e,i)}for(let e=0;e<t.colCount;e++){const i=t.getColWidth(e);i!==n[e]&&t.scenegraph.updateColWidth(e,i-n[e],!0,!0)}t.scenegraph.updateContainer()}}function qB(t,e,i,r,n=!1){const o=function(t,e){const i=e.getColWidthDefined(t);if(e.internalProps._widthResizedColMap.has(t))return e.getColWidth(t);return i}(t,r);return n&&!r.internalProps.transpose?ZB(o,t,e,i,n,r):"number"==typeof o?o:"auto"!==o&&"string"==typeof o?r._adjustColWidth(t,r._colWidthDefineToPxWidth(o)):ZB(o,t,e,i,n,r)}function ZB(t,e,i,r,n,o){let s=0,a=1,l=1;if(r-i>5e3&&(l=Math.ceil((r-i)/5e3)),o.isPivotChart()&&e>=o.rowHeaderLevelCount&&e<o.colCount-o.rightFrozenColCount){if(o.internalProps.layoutMap.indicatorsAsCol)return o.defaultColWidth;{const t=o.internalProps.layoutMap.getOptimunWidthForChart(e);if(t>0)return t}}for(let h=i;h<=r;h+=a){if(o.isPivotChart()){const t=o.internalProps.layoutMap,i=DA(e,h,t);if(i){const t=UA(i,o);if("number"==typeof t){s=Math.max(t,s);continue}}else if(t.isLeftBottomCorner(e,h)||t.isRightTopCorner(e,h)||t.isRightBottomCorner(e,h))continue}const i=JB(e,h,o);if(i&&(s=Math.max(i.width,s),!i.renderDefault))continue;const r=t;if("number"==typeof r&&"standard"===o.widthMode&&!n){s=Math.max(r,s);continue}const c=o.isHeader(e,h)?o._getHeaderLayoutMap(e,h)?.headerType:o.getBodyColumnType(e,h);if("text"!==c&&"link"!==c&&"progressbar"!==c&&"checkbox"!==c){s=Math.max(s,o.getColWidthDefinedNumber(e)||0);continue}let d=0;const u=o.internalProps.layoutMap;if(u.isHeader(e,h)){const t=u.getHeader(e,h);if("only-body"===t?.define?.columnWidthComputeMode)continue;t?.hierarchyLevel&&(d=(t.hierarchyLevel??0)*(u.rowHierarchyIndent??0))}else{a=l;const t=o.getBodyColumnDefine(e,h);if(t?.tree){const t=o.dataSource.getIndexKey(o.getRecordShowIndexByCell(e,h));d=Array.isArray(t)&&o.getHierarchyState(e,h)!==qy.none?(t.length-1)*(u.hierarchyIndent??0):0}}const g=QB(e,h,c,o);s=Math.max(g+d,s),a>1&&o.bottomFrozenRowCount>0&&h<o.rowCount-o.bottomFrozenRowCount&&h+a>=o.rowCount-o.bottomFrozenRowCount&&(h=o.rowCount-o.bottomFrozenRowCount-a,a=1,l=1)}const h=o.getMinColWidth(e),c=o.getMaxColWidth(e);return s<h?h:s>c?c:s}function JB(t,e,i){const r=i.getCustomRender(t,e),n=i.getCustomLayout(t,e);if(r||n){let o=1,s=0,a=!1,l=!1;if(i.isHeader(t,e)||i.getBodyColumnDefine(t,e)?.mergeCell){const r=i.getCellRange(t,e);o=r.end.col-r.start.col+1}const h={col:t,row:e,dataValue:i.getCellOriginValue(t,e),value:i.getCellValue(t,e)||"",rect:tT(t,e,i),table:i};if(n){const t=n(h);t.rootContainer instanceof hs?(t.rootContainer=VS(t.rootContainer),US(t.rootContainer,0,i.getRowHeight(e)),t.rootContainer.setStage(i.scenegraph.stage),s=t.rootContainer.AABBBounds.width()??0,a=t.renderDefault,l=t.enableCellPadding):s=0}else if("function"==typeof r){const t=r(h);s=t?.expectedWidth??0,a=t?.renderDefault}else s=r?.expectedWidth??0,a=r?.renderDefault;if(l){const r=eS(QS("padding",i._getCellStyle(t,e),t,e,i));s+=r[1]+r[3]}return{width:s/o,renderDefault:a}}}function QB(t,e,i,r){let n=0;const o=r.getCellValue(t,e),s=r._getCellStyle(t,e);let a=0,l=!1;if("body"!==r.getCellLocation(t,e))l=!0;else{const i=r.getBodyColumnDefine(t,e);l=!!i?.icon||!!i?.tree}if(l){const i=r.getCellIcons(t,e);i?.forEach((t=>{t.positionType!==Qy.absoluteRight&&(a+=(t.width??0)+(t.marginLeft??0)+(t.marginRight??0))}))}let h=1;if(r.isHeader(t,e)||r.getBodyColumnDefine(t,e)?.mergeCell){const i=r.getCellRange(t,e);h=i.end.col-i.start.col+1}const c=eS(QS("padding",s,t,e,r)),d=c[1]+c[3],u=QS("fontSize",s,t,e,r),g=QS("fontFamily",s,t,e,r),p=QS("fontWeight",s,t,e,r);let f;f="checkbox"===i&&q(o)?o.text:o;const m=HC(f).split("\n")||[];if(m.length>=1?m.forEach((t=>{const e=r.measureText(t.slice(0,r.options.maxCharactersNumber||200),{fontSize:u,fontFamily:g,fontWeight:p}).width;n=Math.max((e+d+4+a)/h,n)})):n=Math.max((d+4+a)/h,n),!1!==r.internalProps.limitMaxAutoWidth&&(n=Math.min("number"==typeof r.internalProps.limitMaxAutoWidth?r.internalProps.limitMaxAutoWidth:450,n)),"checkbox"===i){const i=QS("size",s,t,e,r);if(n+=i,f){const i=QS("spaceBetweenTextAndIcon",s,t,e,r);n+=i}}return n}function tT(t,e,i){return{left:0,top:0,right:i.getColWidth(t),bottom:i.getRowHeight(e),width:0,height:0}}function eT(t,e,i,r,n,o,s){let a=0;const l=[];for(let s=e;s<i;s++){const e=r?n[s]:o.getColWidth(s),i=o.getMaxColWidth(s),h=o.getMinColWidth(s);e!==i&&e!==h?(a+=e,l.push(s)):t-=e}const h=t/a;for(let e=0;e<l.length;e++){const i=l[e];let a;a=e===l.length-1?t-l.reduce(((t,e,s)=>e!==i?t+(r?n[e]:o.getColWidth(e)):t),0):Math.round((r?n[i]:o.getColWidth(i))*h),r?n[i]=o._adjustColWidth(i,a):s?o.scenegraph.setColWidth(i,o._adjustColWidth(i,a)):o._setColWidth(i,o._adjustColWidth(i,a),!1,!0)}}const iT=new qS({});function rT(t,e,i,r,n,o,s,a,l,h){if(r>n||o>s)return;const{layoutMap:c,defaultRowHeight:d,defaultHeaderRowHeight:u,defaultColWidth:g}=l.internalProps;let p=0,f=0;for(let c=r;c<=n;c++){const r=c,n=l.getColWidth(r),g=new qS({x:e+p,y:i,width:n,height:0,clip:!1,pickable:!1});g.role="column",g.col=c,t.addChild(g);const{width:m,height:b}=BA(g,r,n,o,s,l.scenegraph.mergeMap,"columnHeader"===a&&ot(u)?u:d,l,a,h);p+=m,f=Math.max(f,b)}t.setAttribute("width",p),t.setAttribute("height",f)}function nT(t){let e=t.firstChild;for(;"group"!==e.type;)e=e._next;return e}function oT(t){let e=t.lastChild;for(;"group"!==e.type;)e=e._prev;return e}function sT(t,e,i,r="left"){for(let n=t;n<=e;n++){const t=i.scenegraph.getColGroup(n);t&&aT(t,i,r);const e=i.scenegraph.getColGroup(n,!0);e&&aT(e,i,r);const o=i.scenegraph.getColGroupInBottom(n);o&&aT(o,i,r)}const n=Math.min(i.scenegraph.proxy.colLimit,i.scenegraph.proxy.bodyRightCol-i.scenegraph.proxy.bodyLeftCol+1),o=i.getColsWidth(i.frozenColCount,i.frozenColCount+n),s=i.getColsWidth(i.frozenColCount,i.colCount-1);i.scenegraph.proxy.xLimitLeft=o/2,i.scenegraph.proxy.xLimitRight=s-o/2}function aT(t,e,i="left"){if("left"===i){let i;const r=function(t){let e=t._prev;for(;e&&"group"!==e.type;)e=e._prev;return e}(t);i=r?r.attribute.x+e.getColWidth(t._prev.col):e.getColsWidth(e.frozenColCount,t.col-1),t.setAttribute("x",i)}else{let i;const r=function(t){let e=t._next;for(;e&&"group"!==e.type;)e=e._next;return e}(t);i=r?r.attribute.x-e.getColWidth(t.col):e.getColsWidth(e.frozenColCount,t.col-1),t.setAttribute("x",i)}}async function lT(t,e){const i=e.table.getTargetColAt(t+e.table.scenegraph.rowHeaderGroup.attribute.width);if(!i)return;const r=i.col,n=i.left;e.screenLeftCol=r;!function(t,e,i,r,n){t>0?(hT(t,"left",n.screenLeftCol,i,r,n),n.table.scenegraph.setBodyAndColHeaderX(-r+n.deltaX)):t<0?(hT(-t,"right",n.screenLeftCol,i,r,n),n.table.scenegraph.setBodyAndColHeaderX(-r+n.deltaX)):n.table.scenegraph.setBodyAndColHeaderX(-r+n.deltaX)}(e.screenLeftCol-e.referenceCol,0,n,t,e),e.table.scenegraph.updateNextFrame()}async function hT(t,e,i,r,n,o){if("left"===e&&o.colEnd+t>o.bodyRightCol?t=o.bodyRightCol-o.colEnd:"right"===e&&o.colStart-t<o.bodyLeftCol&&(t=o.colStart-o.bodyLeftCol),0!==t)if(t<0&&(e="left"===e?"right":"left",t=-t),t<o.colEnd-o.colStart){const n="left"===e?o.colStart:o.colEnd-t+1,s="left"===e?o.colStart+t-1:o.colEnd,a="left"===e?o.colEnd+1:o.colStart-t,l="left"===e?o.colEnd+t:o.colStart-1;YB(o.table,a,l),function(t,e,i,r){for(let n=t;n<=e;n++)r.table.scenegraph.bodyGroup.childrenCount>0&&"group"===r.table.scenegraph.bodyGroup.firstChild.type&&uT(r.table.scenegraph.bodyGroup,i,r),r.table.scenegraph.colHeaderGroup.childrenCount>0&&"group"===r.table.scenegraph.colHeaderGroup.firstChild.type&&uT(r.table.scenegraph.colHeaderGroup,i,r),r.table.scenegraph.bottomFrozenGroup.childrenCount>0&&"group"===r.table.scenegraph.bottomFrozenGroup.firstChild.type&&uT(r.table.scenegraph.bottomFrozenGroup,i,r)}(n,s,e,o);const h=a,c=l;o.colStart="left"===e?o.colStart+t:o.colStart-t,o.colEnd="left"===e?o.colEnd+t:o.colEnd-t,gT(h,c,o),sT(h,c,o.table,e);const d=r-((o.table.scenegraph.getColGroup(i)||o.table.scenegraph.getColGroup(i,!0)).attribute.x+o.table.getFrozenColsWidth()+o.table.scenegraph.proxy.deltaX);o.table.scenegraph.proxy.deltaX+=d,o.currentCol="left"===e?o.currentCol+t:o.currentCol-t,o.totalCol="left"===e?o.totalCol+t:o.totalCol-t,o.referenceCol=o.colStart+Math.floor((o.colEnd-o.colStart)/2),o.colUpdatePos=a,o.colUpdateDirection=e,o.table.scenegraph.updateNextFrame()}else{const s="left"===e?o.colStart+t:o.colStart-t,a="left"===e?o.colEnd+t:o.colEnd-t;YB(o.table,s,a);!function(t,e,i,r){r.table.scenegraph.colHeaderGroup.forEachChildren(((n,o)=>{"group"===n.type&&cT(n,"left"===i?n.col+e:n.col-e,0===o?t:n._prev.attribute.x+r.table.getColWidth(n._prev.col))})),r.table.scenegraph.bottomFrozenGroup.forEachChildren(((n,o)=>{"group"===n.type&&cT(n,"left"===i?n.col+e:n.col-e,0===o?t:n._prev.attribute.x+r.table.getColWidth(n._prev.col))})),r.table.scenegraph.bodyGroup.forEachChildren(((n,o)=>{"group"===n.type&&cT(n,"left"===i?n.col+e:n.col-e,0===o?t:n._prev.attribute.x+r.table.getColWidth(n._prev.col))}))}(o.table.getColsWidth(o.bodyLeftCol,s-1),t,e,o);const l=s,h=a;if(o.colStart=s,o.colEnd=a,gT(l,h,o),sT(l,h,o.table,a>o.bodyRightCol-(o.colEnd-o.colStart+1)?"right":"left"),l===o.bodyLeftCol){const t=o.table.scenegraph.getColGroup(l).attribute.x-n;o.table.scenegraph.proxy.deltaX=t}else if(h===o.bodyRightCol){const t=o.table.scenegraph.getColGroup(h),e=t.attribute.x+t.attribute.width-(o.table.tableNoFrameWidth-o.table.getFrozenColsWidth())-n;o.table.scenegraph.proxy.deltaX=-e}else{const t=r-((o.table.scenegraph.getColGroup(i)||o.table.scenegraph.getColGroup(i,!0)).attribute.x+o.table.getFrozenColsWidth()+o.table.scenegraph.proxy.deltaX);o.table.scenegraph.proxy.deltaX=t}o.currentCol="left"===e?o.currentCol+t:o.currentCol-t,o.totalCol="left"===e?o.totalCol+t:o.totalCol-t,o.referenceCol=o.colStart+Math.floor((o.colEnd-o.colStart)/2),o.colUpdatePos=o.colStart,o.colUpdateDirection=a>o.bodyRightCol-(o.colEnd-o.colStart+1)?"right":"left",o.table.scenegraph.updateNextFrame()}}function cT(t,e,i){t.col=e,t.forEachChildren((t=>{t.col=e,t.needUpdate=!0})),t.setAttribute("x",i),t.needUpdate=!0}function dT(t,e){if(!t)return;let i=t.firstChild;for(;i;){i=e.updateCellGroupContent(i)._next}t.needUpdate=!1,t.setAttribute("width",e.table.getColWidth(t.col))}function uT(t,e,i){if("left"===e){const e=nT(t),r=oT(t);cT(e,r.col+1,r.attribute.x+i.table.getColWidth(r.col)),t.appendChild(e),t.border&&t.appendChild(t.border)}else{const e=oT(t),r=nT(t);cT(e,r.col-1,r.attribute.x-i.table.getColWidth(r.col-1)),t.insertBefore(e,t.firstChild)}}function gT(t,e,i){for(let r=t;r<=e;r++){const t=i.table.scenegraph.getColGroup(r);t&&dT(t,i);const e=i.table.scenegraph.getColGroup(r,!0);e&&dT(e,i);const n=i.table.scenegraph.getColGroupInBottom(r);n&&dT(n,i);const o=i.table.scenegraph.getColGroupInRightTopCorner(r);o&&dT(o,i);const s=i.table.scenegraph.getColGroupInRightBottomCorner(r);s&&dT(s,i)}}function pT(t,e,i,r,n,o="up"){if("up"===o)for(let o=t;o<=e;o++)for(let t=i;t<=r;t++){const e=n.scenegraph.highPerformanceGetCell(o,t,!0);if(!e.row)continue;let i;i=e._prev?e._prev?.attribute.y+n.getRowHeight(e._prev.row):n.getRowsHeight(n.columnHeaderLevelCount,e.row-1),e.setAttribute("y",i)}else for(let o=t;o<=e;o++)for(let t=r;t>=i;t--){const e=n.scenegraph.highPerformanceGetCell(o,t,!0);if(!e.row)continue;let i;i=e._next?e._next?.attribute.y-n.getRowHeight(e.row):n.getRowsHeight(n.columnHeaderLevelCount,e.row-1),e.setAttribute("y",i)}const s=Math.min(n.scenegraph.proxy.rowLimit,n.scenegraph.proxy.bodyBottomRow-n.scenegraph.proxy.bodyTopRow+1),a=n.getRowsHeight(n.columnHeaderLevelCount,n.columnHeaderLevelCount+s),l=n.getRowsHeight(n.columnHeaderLevelCount,n.rowCount-1);n.scenegraph.proxy.yLimitTop=a/2,n.scenegraph.proxy.yLimitBottom=l-a/2}async function fT(t,e){const i=e.table.getTargetRowAt(t+e.table.scenegraph.colHeaderGroup.attribute.height);if(!i)return;const r=i.row,n=i.top;e.screenTopRow=r;!function(t,e,i,r,n){t>0?(mT(t,"up",e,i,r,n),n.updateBody(r-n.deltaY)):t<0?(mT(-t,"down",e,i,r,n),n.updateBody(r-n.deltaY)):n.updateBody(r-n.deltaY)}(r-e.referenceRow,r,n,t,e)}async function mT(t,e,i,r,n,o){if("up"===e&&o.rowEnd+t>o.bodyBottomRow?t=o.bodyBottomRow-o.rowEnd:"down"===e&&o.rowStart-t<o.bodyTopRow&&(t=o.rowStart-o.bodyTopRow),0!==t)if(t<0&&(e="up"===e?"down":"up",t=-t),t<o.rowEnd-o.rowStart){const n="up"===e?o.rowStart:o.rowEnd-t+1,s="up"===e?o.rowStart+t-1:o.rowEnd,a="up"===e?o.rowEnd+1:o.rowStart-t,l="up"===e?o.rowEnd+t:o.rowStart-1;let h,c;if("autoHeight"===o.table.heightMode)h=a,c=l;else{h=Math.max(o.bodyTopRow,i-1*o.screenRowCount),c=Math.min(o.bodyBottomRow,i+2*o.screenRowCount)}if(ZA(o.table,h,c,"autoHeight"===o.table.heightMode),function(t,e,i,r){for(let n=0;n<r.table.frozenColCount;n++){const o=r.table.scenegraph.getColGroup(n);if(o)for(let n=t;n<=e;n++)bT(o,i,r)}for(let n=r.table.colCount-r.table.rightFrozenColCount;n<r.table.colCount;n++){const o=r.table.scenegraph.getColGroup(n);if(o)for(let n=t;n<=e;n++)bT(o,i,r)}for(let n=r.bodyLeftCol;n<=r.bodyRightCol;n++){const o=r.table.scenegraph.getColGroup(n);if(o)for(let n=t;n<=e;n++)bT(o,i,r)}}(n,s,e,o),o.rowStart="up"===e?o.rowStart+t:o.rowStart-t,o.rowEnd="up"===e?o.rowEnd+t:o.rowEnd-t,yT(h,c,o),"autoHeight"===o.table.heightMode){pT(o.bodyLeftCol,o.bodyRightCol,h,c,o.table,l>o.bodyBottomRow-(o.rowEnd-o.rowStart+1)?"down":"up"),pT(0,o.table.frozenColCount-1,h,c,o.table,l>o.bodyBottomRow-(o.rowEnd-o.rowStart+1)?"down":"up"),pT(o.table.colCount-o.table.rightFrozenColCount,o.table.colCount-1,h,c,o.table,l>o.bodyBottomRow-(o.rowEnd-o.rowStart+1)?"down":"up");const t=r-(o.table.scenegraph.highPerformanceGetCell(o.bodyLeftCol,i,!0).attribute.y+o.table.getFrozenRowsHeight()+o.table.scenegraph.proxy.deltaY);o.table.scenegraph.proxy.deltaY+=t}o.currentRow="up"===e?o.currentRow+t:o.currentRow-t,o.totalRow=Math.max(0,Math.min(o.table.rowCount-1,"up"===e?o.totalRow+t:o.totalRow-t)),o.referenceRow=o.rowStart+Math.floor((o.rowEnd-o.rowStart)/2),o.rowUpdatePos=Math.min(o.rowUpdatePos,a),o.rowUpdateDirection=e,o.table.scenegraph.updateNextFrame(),"autoHeight"!==o.table.heightMode&&await o.progress()}else{const s="up"===e?o.rowStart+t:o.rowStart-t,a="up"===e?o.rowEnd+t:o.rowEnd-t,l=o.table.getRowsHeight(o.bodyTopRow,s-1);let h,c;if("autoHeight"===o.table.heightMode?(h=s,c=a):(h=Math.max(o.bodyTopRow,i-1*o.screenRowCount),c=Math.min(o.bodyBottomRow,i+2*o.screenRowCount)),ZA(o.table,h,c),function(t,e,i,r){for(let n=0;n<r.table.frozenColCount;n++){const o=r.table.scenegraph.getColGroup(n);o?.forEachChildren(((n,o)=>{r.updateCellGroupPosition(n,"up"===i?n.row+e:n.row-e,0===o?t:n._prev.attribute.y+r.table.getRowHeight(n._prev.row))}))}for(let n=r.table.colCount-r.table.rightFrozenColCount;n<r.table.colCount;n++){const o=r.table.scenegraph.getColGroup(n);o?.forEachChildren(((n,o)=>{r.updateCellGroupPosition(n,"up"===i?n.row+e:n.row-e,0===o?t:n._prev.attribute.y+r.table.getRowHeight(n._prev.row))}))}for(let n=r.bodyLeftCol;n<=r.bodyRightCol;n++){const o=r.table.scenegraph.getColGroup(n);o?.forEachChildren(((n,o)=>{r.updateCellGroupPosition(n,"up"===i?n.row+e:n.row-e,0===o?t:n._prev.attribute.y+r.table.getRowHeight(n._prev.row))}))}}(l,t,e,o),o.rowStart=s,o.rowEnd=a,yT(h,c,o),"autoHeight"===o.table.heightMode&&(pT(o.bodyLeftCol,o.bodyRightCol,h,c,o.table,a>o.bodyBottomRow-(o.rowEnd-o.rowStart+1)?"down":"up"),pT(0,o.table.frozenColCount-1,h,c,o.table,a>o.bodyBottomRow-(o.rowEnd-o.rowStart+1)?"down":"up"),pT(o.table.colCount-o.table.rightFrozenColCount,o.table.colCount-1,h,c,o.table,a>o.bodyBottomRow-(o.rowEnd-o.rowStart+1)?"down":"up")),h===o.bodyTopRow){const t=o.table.scenegraph.highPerformanceGetCell(o.bodyLeftCol,h,!0).attribute.y-n;o.table.scenegraph.proxy.deltaY=t}else if(c===o.bodyBottomRow){const t=o.table.scenegraph.highPerformanceGetCell(o.bodyLeftCol,c,!0),e=t.attribute.y+t.attribute.height-(o.table.tableNoFrameHeight-o.table.getFrozenRowsHeight())-n;o.table.scenegraph.proxy.deltaY=-e}else{const t=r-(o.table.scenegraph.highPerformanceGetCell(o.bodyLeftCol,i,!0).attribute.y+o.table.getFrozenRowsHeight()+o.table.scenegraph.proxy.deltaY);o.table.scenegraph.proxy.deltaY=t}o.currentRow="up"===e?o.currentRow+t:o.currentRow-t,o.totalRow=Math.max(0,Math.min(o.table.rowCount-1,"up"===e?o.totalRow+t:o.totalRow-t)),o.referenceRow=o.rowStart+Math.floor((o.rowEnd-o.rowStart)/2),o.rowUpdatePos=o.rowStart,o.rowUpdateDirection=a>o.bodyBottomRow-(o.rowEnd-o.rowStart+1)?"down":"up",o.table.scenegraph.updateNextFrame(),"autoHeight"!==o.table.heightMode&&await o.progress()}}function bT(t,e,i){if(t.childrenCount>=1)if("up"===e){const e=t.firstChild;i.updateCellGroupPosition(e,t.lastChild.row+1,t.lastChild.attribute.y+i.table.getRowHeight(t.lastChild.row)),t.appendChild(e)}else{const e=t.lastChild;i.updateCellGroupPosition(e,t.firstChild.row-1,t.firstChild.attribute.y-i.table.getRowHeight(e.row)),t.insertBefore(e,t.firstChild)}}function yT(t,e,i){for(let r=0;r<i.table.frozenColCount;r++)for(let n=t;n<=e;n++){const t=i.highPerformanceGetCell(r,n,!0);i.updateCellGroupContent(t)}for(let r=i.table.colCount-i.table.rightFrozenColCount;r<i.table.colCount;r++)for(let n=t;n<=e;n++){const t=i.highPerformanceGetCell(r,n);i.updateCellGroupContent(t)}for(let r=i.bodyLeftCol;r<=i.bodyRightCol;r++)for(let n=t;n<=e;n++){const t=i.highPerformanceGetCell(r,n);i.updateCellGroupContent(t)}i.table.scenegraph.updateNextFrame()}iT.role="empty";class CT{table;isRelease=!1;mode="column";isProgressing;rowLimit=200;currentRow=0;totalRow;yLimitTop;yLimitBottom;rowStart=0;rowEnd=0;referenceRow=0;bodyTopRow;bodyBottomRow;screenRowCount;firstScreenRowLimit;taskRowCount;rowUpdatePos;rowUpdateDirection;screenTopRow=0;totalActualBodyRowCount;deltaY=0;colLimit=100;bodyRightCol;totalCol;colStart;colEnd;taskColCount;xLimitLeft;xLimitRight;screenColCount;firstScreenColLimit;colUpdatePos;currentCol;referenceCol;screenLeftCol=0;colUpdateDirection;totalActualBodyColCount;deltaX=0;cellCache=new Map;constructor(t){this.table=t,this.table.isPivotChart()?(this.rowLimit=100,this.colLimit=100):"autoHeight"===this.table.heightMode?this.rowLimit=100:"autoWidth"===this.table.widthMode&&(this.colLimit=100),this.table.internalProps.transpose?this.mode="row":this.table.isPivotTable()&&(this.mode="pivot"),this.table.options.maintainedDataCount&&(this.rowLimit=this.table.options.maintainedDataCount)}get bodyLeftCol(){return this.table.frozenColCount}setParamsForColumn(){this.bodyRightCol=this.table.colCount-1-this.table.rightFrozenColCount;const t=Math.min(this.colLimit,this.bodyRightCol-this.bodyLeftCol+1);this.totalActualBodyColCount=t,this.totalCol=this.bodyLeftCol+t-1,this.colStart=this.bodyLeftCol;const e=this.table.defaultColWidth;this.taskColCount=1*Math.ceil(this.table.tableNoFrameWidth/e);const i=e*t,r=e*(this.bodyRightCol-this.bodyLeftCol+1);this.xLimitLeft=i/2,this.xLimitRight=r-i/2;const n=5*this.table.tableNoFrameWidth;this.screenColCount=Math.ceil(this.table.tableNoFrameWidth/e),this.firstScreenColLimit=Math.max(15,this.bodyLeftCol+Math.min(this.colLimit,Math.ceil(n/e))),this.colUpdatePos=this.bodyRightCol}setParamsForRow(){this.bodyTopRow=this.table.columnHeaderLevelCount,this.bodyBottomRow=this.table.rowCount-1-this.table.bottomFrozenRowCount;const t=Math.min(this.rowLimit,this.bodyBottomRow-this.bodyTopRow+1);this.totalActualBodyRowCount=t,this.totalRow=this.bodyTopRow+t-1,this.rowStart=this.bodyTopRow;const e=this.table.defaultRowHeight;this.taskRowCount=1*Math.ceil(this.table.tableNoFrameHeight/e);const i=e*t,r=e*(this.bodyBottomRow-this.bodyTopRow+1);this.yLimitTop=i/2,this.yLimitBottom=r-i/2;const n=5*this.table.tableNoFrameHeight;this.screenRowCount=Math.ceil(this.table.tableNoFrameHeight/e),this.firstScreenRowLimit=Math.max(30,this.bodyTopRow+Math.min(this.rowLimit,Math.ceil(n/e))),this.rowUpdatePos=this.bodyBottomRow}resize(){const t=this.table.defaultColWidth;this.taskColCount=1*Math.ceil(this.table.tableNoFrameWidth/t);const e=5*this.table.tableNoFrameWidth;this.screenColCount=Math.ceil(this.table.tableNoFrameWidth/t),this.firstScreenColLimit=this.bodyLeftCol+Math.min(this.colLimit,Math.ceil(e/t));const i=this.table.defaultRowHeight;this.taskRowCount=1*Math.ceil(this.table.tableNoFrameHeight/i);const r=5*this.table.tableNoFrameHeight;this.screenRowCount=Math.ceil(this.table.tableNoFrameHeight/i),this.firstScreenRowLimit=this.bodyTopRow+Math.min(this.rowLimit,Math.ceil(r/i))}createGroupForFirstScreen(t,e,i,r,n,o,s,a){!function(t,e,i,r,n,o,s,a,l){const{table:h}=l,{leftBottomCornerGroup:c,rightTopCornerGroup:d,rightBottomCornerGroup:u}=h.scenegraph;let g,p;l.setParamsForRow(),l.setParamsForColumn(),g="adaptive"===h.widthMode?h.colCount-1:Math.min(l.firstScreenColLimit,h.colCount-1),p="adaptive"===h.heightMode?h.rowCount-1:Math.min(l.firstScreenRowLimit,h.rowCount-1),0===h.internalProps._widthResizedColMap.size&&YB(h,0,g),ZA(h,0,p),g<h.colCount-h.rightFrozenColCount&&YB(h,h.colCount-h.rightFrozenColCount,h.colCount-1),p<h.rowCount-h.bottomFrozenRowCount&&ZA(h,h.rowCount-h.bottomFrozenRowCount,h.rowCount-1),h.scenegraph.colHeaderGroup.setAttribute("x",h.getFrozenColsWidth()),h.scenegraph.rowHeaderGroup.setAttribute("y",h.getFrozenRowsHeight()),h.scenegraph.bottomFrozenGroup.setAttribute("x",h.getFrozenColsWidth()),h.scenegraph.rightFrozenGroup.setAttribute("y",h.getFrozenRowsHeight()),h.scenegraph.bodyGroup.setAttributes({x:h.getFrozenColsWidth(),y:h.getFrozenRowsHeight()}),rT(t,s,a,0,h.frozenColCount-1,0,h.columnHeaderLevelCount-1,h.isListTable()?"columnHeader":"cornerHeader",h),g-h.rightFrozenColCount>=h.frozenColCount&&rT(e,s,a,h.frozenColCount,g-h.rightFrozenColCount,0,h.columnHeaderLevelCount-1,"columnHeader",h),rT(i,s,a,0,h.frozenColCount-1,h.columnHeaderLevelCount,p-h.bottomFrozenRowCount,h.isListTable()&&!h.internalProps.transpose?"body":"rowHeader",h),h.bottomFrozenRowCount>0&&(rT(c,s,a,0,h.frozenColCount-1,h.rowCount-1-h.bottomFrozenRowCount+1,h.rowCount-1,h.isListTable()?"body":"rowHeader",h),g-h.rightFrozenColCount>=h.frozenColCount&&rT(n,s,a,h.frozenColCount,g-h.rightFrozenColCount,h.rowCount-1-h.bottomFrozenRowCount+1,h.rowCount-1,h.isPivotChart()?"rowHeader":"body",h)),h.rightFrozenColCount>0&&(rT(d,s,a,h.colCount-1-h.rightFrozenColCount+1,h.colCount-1,0,h.columnHeaderLevelCount-1,"columnHeader",h),rT(r,s,a,h.colCount-1-h.rightFrozenColCount+1,h.colCount-1,h.columnHeaderLevelCount,p-h.bottomFrozenRowCount,h.isPivotChart()?"rowHeader":"body",h)),h.bottomFrozenRowCount>0&&h.rightFrozenColCount>0&&rT(u,s,a,h.colCount-1-h.rightFrozenColCount+1,h.colCount-1,h.rowCount-1-h.bottomFrozenRowCount+1,h.rowCount-1,"body",h),g-h.rightFrozenColCount>=h.frozenColCount&&rT(o,s,a,h.frozenColCount,g-h.rightFrozenColCount,h.columnHeaderLevelCount,p-h.bottomFrozenRowCount,"body",h),o.firstChild||e.firstChild?(l.currentRow=o.firstChild?.rowNumber??l.totalRow,l.rowEnd=l.currentRow,l.rowUpdatePos=l.rowEnd+1,l.referenceRow=l.rowStart+Math.floor((l.rowEnd-l.rowStart)/2),l.currentCol=o.lastChild?.col??e.lastChild?.col??l.totalCol,l.colEnd=l.currentCol,l.colUpdatePos=l.colEnd+1,l.referenceCol=l.colStart+Math.floor((l.colEnd-l.colStart)/2),l.progress()):(l.currentRow=l.totalRow,l.rowEnd=l.currentRow,l.rowUpdatePos=l.rowEnd+1,l.referenceRow=l.rowStart+Math.floor((l.rowEnd-l.rowStart)/2),l.currentCol=l.totalCol,l.colEnd=l.currentCol,l.colUpdatePos=l.colEnd+1,l.referenceCol=l.colStart+Math.floor((l.colEnd-l.colStart)/2))}(t,e,i,r,n,o,s,a,this)}async progress(){if(!this.isProgressing)return this.isProgressing=!0,new Promise(((t,e)=>{setTimeout((async()=>{this.isProgressing=!1,this.isRelease||(this.colUpdatePos<=this.colEnd?(await this.updateColCellGroupsAsync(),await this.progress()):this.rowUpdatePos<=this.rowEnd?(await this.updateRowCellGroupsAsync(),await this.progress()):this.currentCol<this.totalCol?(await this.createCol(),await this.progress()):this.currentRow<this.totalRow&&(await this.createRow(),await this.progress()),t())}),16)}))}async createRow(){this.taskRowCount&&this.createRowCellGroup(this.taskRowCount)}async createCol(){this.taskColCount&&this.createColGroup(this.taskRowCount)}createRowCellGroup(t){const e=Math.min(this.totalRow,this.currentRow+t);if(ZA(this.table,this.currentRow+1,e,!1),this.table.frozenColCount){let t=0;for(let i=0;i<this.table.frozenColCount;i++){const r=this.table.scenegraph.getColGroup(i),n=this.table.isListTable()?"body":"rowHeader",{height:o}=BA(r,i,r.attribute.width,this.currentRow+1,e,this.table.scenegraph.mergeMap,this.table.internalProps.defaultRowHeight,this.table,n);t=Math.max(t,o),this.table.scenegraph.rowHeaderGroup.setAttribute("height",t)}}if(this.table.rightFrozenColCount){let t=0;for(let i=this.table.colCount-this.table.rightFrozenColCount;i<this.table.colCount;i++){const r=this.table.scenegraph.getColGroup(i),n=this.table.isPivotChart()?"rowHeader":"body",{height:o}=BA(r,i,r.attribute.width,this.currentRow+1,e,this.table.scenegraph.mergeMap,this.table.internalProps.defaultRowHeight,this.table,n);t=Math.max(t,o),this.table.scenegraph.rightFrozenGroup.setAttribute("height",t)}}let i=0;for(let t=this.bodyLeftCol;t<=this.bodyRightCol;t++){const r=this.table.scenegraph.getColGroup(t);if(!r)continue;const n=t<this.table.rowHeaderLevelCount?"rowHeader":"body",{height:o}=BA(r,t,r.attribute.width,this.currentRow+1,e,this.table.scenegraph.mergeMap,this.table.internalProps.defaultRowHeight,this.table,n);i=Math.max(i,o)}this.table.scenegraph.bodyGroup.setAttribute("height",i),this.currentRow=e,this.rowEnd=e,this.rowUpdatePos=this.rowEnd,this.referenceRow=this.rowStart+Math.floor((e-this.rowStart)/2),this.table.scenegraph.updateContainer(),this.table.scenegraph.updateBorderSizeAndPosition()}createColGroup(t){const e=Math.min(this.totalCol,this.currentCol+t);YB(this.table,this.currentCol+1,e);for(let t=0;t<this.table.rowCount;t++){const e=this.highPerformanceGetCell(this.currentCol,t);ot(e.mergeStartCol)&&e.mergeStartCol>this.currentCol&&this.table.scenegraph.updateCellContent(e.col,e.row)}if(this.table.columnHeaderLevelCount){const t=this.table.scenegraph.colHeaderGroup.lastChild instanceof qS?this.table.scenegraph.colHeaderGroup.lastChild:this.table.scenegraph.colHeaderGroup.lastChild._prev,i=t.attribute.x+t.attribute.width,r=t.attribute.y;rT(this.table.scenegraph.colHeaderGroup,i,r,this.currentCol+1,e,0,this.table.columnHeaderLevelCount-1,"columnHeader",this.table)}if(this.table.bottomFrozenRowCount){const t=this.table.scenegraph.bottomFrozenGroup.lastChild instanceof qS?this.table.scenegraph.bottomFrozenGroup.lastChild:this.table.scenegraph.bottomFrozenGroup.lastChild._prev,i=t.attribute.x+t.attribute.width,r=t.attribute.y;rT(this.table.scenegraph.bottomFrozenGroup,i,r,this.currentCol+1,e,this.table.rowCount-this.table.bottomFrozenRowCount,this.table.rowCount-1,"columnHeader",this.table)}let i=this.table.scenegraph.bodyGroup.lastChild&&(this.table.scenegraph.bodyGroup.lastChild instanceof qS?this.table.scenegraph.bodyGroup.lastChild:this.table.scenegraph.bodyGroup.lastChild._prev);i||(i=this.table.scenegraph.colHeaderGroup.lastChild&&(this.table.scenegraph.colHeaderGroup.lastChild instanceof qS?this.table.scenegraph.colHeaderGroup.lastChild:this.table.scenegraph.colHeaderGroup.lastChild._prev));const r=i.attribute.x+i.attribute.width,n=i.attribute.y;rT(this.table.scenegraph.bodyGroup,r,n,this.currentCol+1,e,this.rowStart,this.rowEnd,"body",this.table),this.currentCol=e,this.colEnd=e,this.colUpdatePos=this.colEnd,this.referenceCol=this.colStart+Math.floor((e-this.colStart)/2),this.table.scenegraph.updateContainer(),this.table.scenegraph.updateBorderSizeAndPosition()}async setY(t){const e=this.table.getRowsHeight(this.bodyTopRow,this.bodyTopRow+(this.rowEnd-this.rowStart+1))/2,i=this.table.getAllRowsHeight()-e;t<e&&this.rowStart===this.bodyTopRow||t>i&&this.rowEnd===this.bodyBottomRow?this.table.scenegraph.setBodyAndRowHeaderY(-t):this.table.scenegraph.bodyGroup.firstChild&&0!==this.table.scenegraph.bodyGroup.firstChild.childrenCount?this.dynamicSetY(t):this.table.scenegraph.setBodyAndRowHeaderY(-t)}async setX(t){const e=this.table.getColsWidth(this.bodyLeftCol,this.bodyLeftCol+(this.colEnd-this.colStart+1))/2,i=this.table.getAllColsWidth()-e;t<e&&this.colStart===this.bodyLeftCol||t>i&&this.colEnd===this.bodyRightCol||this.table.scenegraph.bodyGroup.firstChild&&0===this.table.scenegraph.bodyGroup.firstChild.childrenCount?this.table.scenegraph.setBodyAndColHeaderX(-t):this.dynamicSetX(t)}async dynamicSetY(t){fT(t,this)}async dynamicSetX(t){lT(t,this)}updateBody(t){this.table.scenegraph.setBodyAndRowHeaderY(-t)}async updateRowCellGroupsAsync(){this.updateCellGroups(this.taskRowCount)}updateCellGroups(t){const e=Math.min(this.bodyBottomRow,this.rowUpdatePos+t);"autoHeight"===this.table.heightMode&&ZA(this.table,this.rowUpdatePos,e,!1),yT(this.rowUpdatePos,e,this),"autoHeight"===this.table.heightMode&&(pT(this.bodyLeftCol,this.bodyRightCol,this.rowUpdatePos,e,this.table,this.rowUpdateDirection),pT(0,this.table.frozenColCount-1,this.rowUpdatePos,e,this.table,this.rowUpdateDirection),pT(this.table.colCount-this.table.rightFrozenColCount,this.table.colCount-1,this.rowUpdatePos,e,this.table,this.rowUpdateDirection)),this.rowUpdatePos=e+1}updateBottomFrozenCellGroups(){const t=this.table.rowCount-this.table.bottomFrozenRowCount,e=this.table.rowCount-1;"autoHeight"===this.table.heightMode&&ZA(this.table,t,e,!1),yT(t,e,this),"autoHeight"===this.table.heightMode&&(pT(this.bodyLeftCol,this.bodyRightCol,t,e,this.table,this.rowUpdateDirection),pT(0,this.table.frozenColCount-1,t,e,this.table,this.rowUpdateDirection),pT(this.table.colCount-this.table.rightFrozenColCount,this.table.colCount-1,t,e,this.table,this.rowUpdateDirection))}updateRightFrozenCellGroups(){const t=this.table.colCount-this.table.rightFrozenColCount,e=this.table.colCount-1;"autoWidth"===this.table.widthMode&&YB(this.table,t,e,!1),gT(t,e,this),"autoHeight"===this.table.heightMode&&sT(t,e,this.table,this.colUpdateDirection)}async updateColCellGroupsAsync(){this.updateColGroups(this.taskRowCount)}updateColGroups(t){const e=Math.min(this.bodyRightCol,this.colUpdatePos+t);YB(this.table,this.colUpdatePos,e),gT(this.colUpdatePos,e,this),this.colUpdatePos=e+1}updateCellGroupPosition(t,e,i){t.row=e,t.setAttribute("y",i),t.needUpdate=!0,t.needUpdateForAutoRowHeight=!0}updateCellGroupContent(t){if(!t.needUpdate||"cell"!==t.role)return t;const e=this.table.scenegraph.updateCellContent(t.col,t.row);return t.needUpdate=!1,e||t}async sortCellVertical(){await async function(t){for(let e=0;e<t.table.frozenColCount;e++){const i=t.table.scenegraph.getColGroup(e);i?.forEachChildren(((t,e)=>{t.needUpdate=!0}))}for(let e=t.table.colCount-t.table.rightFrozenColCount;e<t.table.colCount;e++){const i=t.table.scenegraph.getColGroup(e);i?.forEachChildren(((t,e)=>{t.needUpdate=!0}))}for(let e=t.bodyLeftCol;e<=t.bodyRightCol;e++){const i=t.table.scenegraph.getColGroup(e);i?.forEachChildren(((t,e)=>{t.needUpdate=!0}))}let e,i;"autoHeight"===t.table.heightMode?(e=t.rowStart,i=t.rowEnd):(e=Math.max(t.bodyTopRow,t.screenTopRow-1*t.screenRowCount),i=Math.min(t.bodyBottomRow,t.screenTopRow+2*t.screenRowCount)),ZA(t.table,e,i),yT(e,i,t),"autoHeight"===t.table.heightMode&&pT(t.bodyLeftCol,t.bodyRightCol,e,i,t.table,t.rowEnd>t.bodyBottomRow-(t.rowEnd-t.rowStart+1)?"down":"up"),t.rowUpdatePos=t.rowStart,t.rowUpdateDirection=t.rowEnd>t.bodyBottomRow-(t.rowEnd-t.rowStart+1)?"down":"up",t.table.scenegraph.updateNextFrame(),"autoHeight"!==t.table.heightMode&&await t.progress()}(this)}async sortCellHorizontal(){await async function(t){t.table.scenegraph.bottomFrozenGroup.forEachChildren(((t,e)=>{"group"===t.type&&(t.needUpdate=!0,t?.forEachChildren((t=>{t.needUpdate=!0})))})),t.table.scenegraph.bodyGroup.forEachChildren(((t,e)=>{"group"===t.type&&(t.needUpdate=!0,t?.forEachChildren((t=>{t.needUpdate=!0})))}));const e=Math.max(t.bodyLeftCol,t.screenLeftCol-1*t.screenColCount),i=Math.min(t.bodyRightCol,t.screenLeftCol+2*t.screenColCount);YB(t.table,e,i),gT(e,i,t),t.colUpdatePos=t.colStart,t.colUpdateDirection=t.colEnd>t.bodyRightCol-(t.colEnd-t.colStart+1)?"right":"left",t.table.scenegraph.updateNextFrame(),await t.progress()}(this)}highPerformanceGetCell(t,e,i){if(e>=this.table.columnHeaderLevelCount&&e<this.table.rowCount-this.table.bottomFrozenRowCount&&(e<this.rowStart||e>this.rowEnd))return iT;if(t>=this.table.frozenColCount&&t<this.table.colCount-this.table.rightFrozenColCount&&(t<this.colStart||t>this.colEnd))return iT;if(this.cellCache.get(t)){const r=this.cellCache.get(t);if((r._next||r._prev)&&Math.abs(r.row-e)<e){let n=vT(r,e);return n&&(i||"shadow-cell"!==n.role)||(n=this.table.scenegraph.getCell(t,e,i)),n.row&&this.cellCache.set(t,n),n}const n=this.table.scenegraph.getCell(t,e,i);return n.col===t&&n.row&&this.cellCache.set(t,n),n}const r=this.table.scenegraph.getCell(t,e,i);return r.col===t&&r.row&&this.cellCache.set(t,r),r}release(){this.isRelease=!0}}function vT(t,e){return t?t.row===e?t:t.row>e?vT(t._prev,e):vT(t._next,e):null}function wT(t,e,i){const[r,n,o,s]=e.split("-"),a=parseInt(r,10),l=parseInt(n,10),h=parseInt(o,10),c=parseInt(s,10);let d,u=a,g=l,p=h,f=c;switch(t.role){case"rowHeader":d=i.table.getBodyVisibleRowRange(),d&&(g=Math.max(l,d.rowStart-1),f=Math.min(c,d.rowEnd+1));break;case"columnHeader":case"bottomFrozen":d=i.table.getBodyVisibleCellRange(),d&&(u=Math.max(a,d.colStart-1),p=Math.min(h,d.colEnd+1));break;case"cornerHeader":case"rightTopCorner":case"leftBottomCorner":case"rightBottomCorner":break;case"rightFrozen":d=i.table.getBodyVisibleCellRange(),d&&(g=Math.max(l,d.rowStart-1),f=Math.min(c,d.rowEnd+1));break;default:d=i.table.getBodyVisibleCellRange(),d&&(g=Math.max(l,d.rowStart-1),f=Math.min(c,d.rowEnd+1),u=Math.max(a,d.colStart-1),p=Math.min(h,d.colEnd+1))}const m=i.table.getColsWidth(u,p),b=i.table.getRowsHeight(g,f),y=i.highPerformanceGetCell(u,g).globalAABBBounds;t.rect.setAttributes({x:y.x1-i.tableGroup.attribute.x,y:y.y1-i.tableGroup.attribute.y,width:m,height:b,visible:!0});const C=!!i.table.frozenColCount&&a===i.table.frozenColCount,v=!!i.table.rightFrozenColCount&&(i.table.rightFrozenColCount>0&&h===i.table.colCount-i.table.rightFrozenColCount-1),w=!i.table.frozenRowCount||l===i.table.frozenRowCount,x=!!i.table.bottomFrozenRowCount&&c===i.table.rowCount-i.table.bottomFrozenRowCount-1;if(C&&t.rect.attribute.stroke[3]||v&&t.rect.attribute.stroke[1]||w&&t.rect.attribute.stroke[0]||x&&t.rect.attribute.stroke[2]){if(C&&t.rect.attribute.stroke[3]&&i.tableGroup.insertAfter(t.rect,"columnHeader"===t.role?i.cornerHeaderGroup:"bottomFrozen"===t.role?i.leftBottomCornerGroup:i.rowHeaderGroup),x&&t.rect.attribute.stroke[2]&&i.tableGroup.insertAfter(t.rect,"rowHeader"===t.role?i.leftBottomCornerGroup:"rightFrozen"===t.role?i.rightBottomCornerGroup:i.bottomFrozenGroup),w&&t.rect.attribute.stroke[0]&&i.tableGroup.insertAfter(t.rect,"rowHeader"===t.role?i.cornerHeaderGroup:"rightFrozen"===t.role?i.rightTopCornerGroup:i.colHeaderGroup),v&&t.rect.attribute.stroke[1]&&i.tableGroup.insertAfter(t.rect,"columnHeader"===t.role?i.rightTopCornerGroup:"bottomFrozen"===t.role?i.rightBottomCornerGroup:i.rightFrozenGroup),t.rect.attribute.x<i.table.getFrozenColsWidth()&&i.table.scrollLeft>0&&("body"===t.role||"columnHeader"===t.role||"bottomFrozen"===t.role)){const e=t.rect.attribute.width-(i.table.getFrozenColsWidth()-t.rect.attribute.x);t.rect.setAttributes({x:t.rect.attribute.x+(i.table.getFrozenColsWidth()-t.rect.attribute.x),width:e>0?e:0})}if(i.table.getRightFrozenColsWidth()>0&&i.rightFrozenGroup.attribute.height>0&&t.rect.attribute.x+t.rect.attribute.width>i.rightFrozenGroup.attribute.x&&("body"===t.role||"columnHeader"===t.role||"bottomFrozen"===t.role)){const e=i.rightFrozenGroup.attribute.x-t.rect.attribute.x;t.rect.setAttributes({x:t.rect.attribute.x,width:e>0?e:0})}if(t.rect.attribute.y<i.colHeaderGroup.attribute.height&&i.table.scrollTop>0&&("body"===t.role||"rowHeader"===t.role||"rightFrozen"===t.role)){const e=t.rect.attribute.height-(i.colHeaderGroup.attribute.height-t.rect.attribute.y);t.rect.setAttributes({y:t.rect.attribute.y+(i.colHeaderGroup.attribute.height-t.rect.attribute.y),height:e>0?e:0})}if(i.bottomFrozenGroup.attribute.width>0&&i.bottomFrozenGroup.attribute.height>0&&t.rect.attribute.y+t.rect.attribute.height>i.bottomFrozenGroup.attribute.y&&("body"===t.role||"rowHeader"===t.role||"rightFrozen"===t.role)){const e=i.bottomFrozenGroup.attribute.y-t.rect.attribute.y;t.rect.setAttributes({y:t.rect.attribute.y,height:e>0?e:0})}}else i.tableGroup.insertAfter(t.rect,"body"===t.role?i.bodyGroup:"columnHeader"===t.role?i.colHeaderGroup:"rowHeader"===t.role?i.rowHeaderGroup:"cornerHeader"===t.role?i.cornerHeaderGroup:"rightTopCorner"===t.role?i.rightTopCornerGroup:"rightFrozen"===t.role?i.rightFrozenGroup:"leftBottomCorner"===t.role?i.leftBottomCornerGroup:"bottomFrozen"===t.role?i.bottomFrozenGroup:i.rightBottomCornerGroup);let _=0;"number"==typeof t.rect.attribute.lineWidth&&(_=Math.ceil(t.rect.attribute.lineWidth/2)),h===i.table.colCount-1&&(Array.isArray(t.rect.attribute.lineWidth)&&(_=Math.ceil((t.rect.attribute.lineWidth[1]??0)/2)),t.rect.setAttributes({width:t.rect.attribute.width-_})),0===a&&(Array.isArray(t.rect.attribute.lineWidth)&&(_=Math.ceil((t.rect.attribute.lineWidth[3]??0)/2)),t.rect.setAttributes({x:t.rect.attribute.x+_,width:t.rect.attribute.width-_})),c===i.table.rowCount-1&&(Array.isArray(t.rect.attribute.lineWidth)&&(_=Math.ceil((t.rect.attribute.lineWidth[2]??0)/2)),t.rect.setAttributes({height:t.rect.attribute.height-_})),0===l&&(Array.isArray(t.rect.attribute.lineWidth)&&(_=Math.ceil((t.rect.attribute.lineWidth[0]??0)/2)),t.rect.setAttributes({y:t.rect.attribute.y+_,height:t.rect.attribute.height-_}))}function xT(t,e,i,r,n){let o=Math.min(r,e),s=Math.min(n,i),a=Math.max(r,e),l=Math.max(n,i);const h=()=>{let e=!1;for(let i=o;i<=a;i++){if(i===o)for(let r=s;r<=l;r++){const n=Nv(t.table,i,r);if(n&&n.start.col<o){o=n.start.col,e=!0;break}}if(!e&&i===a)for(let r=s;r<=l;r++){const n=Nv(t.table,i,r);if(n&&n.end.col>a){a=n.end.col,e=!0;break}}if(e)break}if(!e)for(let i=s;i<=l;i++){if(i===s)for(let r=o;r<=a;r++){const n=Nv(t.table,r,i);if(n&&n.start.row<s){s=n.start.row,e=!0;break}}if(!e&&i===l)for(let r=o;r<=a;r++){const n=Nv(t.table,r,i);if(n&&n.end.row>l){l=n.end.row,e=!0;break}}if(e)break}e&&h()};h(),t.selectingRangeComponents.forEach(((t,e)=>{t.rect.delete()})),t.selectingRangeComponents=new Map;let c=!1,d=!1,u=!1,g=!1,p=!1,f=!1,m=!1,b=!1,y=!1;if(o<=t.table.frozenColCount-1&&s<=t.table.frozenRowCount-1&&(f=!0),a>=t.table.colCount-t.table.rightFrozenColCount&&s<=t.table.frozenRowCount-1&&(m=!0),o<=t.table.frozenColCount-1&&l>=t.table.rowCount-t.table.bottomFrozenRowCount&&(y=!0),a>=t.table.colCount-t.table.rightFrozenColCount&&l>=t.table.rowCount-t.table.bottomFrozenRowCount&&(b=!0),o<=t.table.frozenColCount-1&&l>=t.table.frozenRowCount&&s<=t.table.rowCount-t.table.bottomFrozenRowCount-1&&(c=!0),a>=t.table.colCount-t.table.rightFrozenColCount&&l>=t.table.frozenRowCount&&s<=t.table.rowCount-t.table.bottomFrozenRowCount-1&&(d=!0),s<=t.table.frozenRowCount-1&&a>=t.table.frozenColCount&&o<=t.table.colCount-t.table.rightFrozenColCount-1&&(u=!0),l>=t.table.rowCount-t.table.bottomFrozenRowCount&&a>=t.table.frozenColCount&&o<=t.table.colCount-t.table.rightFrozenColCount-1&&(g=!0),o<=t.table.colCount-t.table.rightFrozenColCount-1&&a>=t.table.frozenColCount&&s<=t.table.rowCount-t.table.bottomFrozenRowCount-1&&l>=t.table.frozenRowCount&&(p=!0),f){const e=Math.min(a,t.table.frozenColCount-1),i=Math.min(l,t.table.frozenRowCount-1),r=[!0,!u,!c,!0];t.createCellSelectBorder(o,s,e,i,"cornerHeader",`${o}${s}${a}${l}`,r)}if(m){const e=Math.max(o,t.table.colCount-t.table.rightFrozenColCount),i=Math.min(l,t.table.frozenRowCount-1),r=[!0,!0,!d,!u];t.createCellSelectBorder(e,s,a,i,"rightTopCorner",`${o}${s}${a}${l}`,r)}if(y){const e=Math.min(a,t.table.frozenColCount-1),i=Math.max(s,t.table.rowCount-t.table.bottomFrozenRowCount),r=[!c,!g,!0,!0];t.createCellSelectBorder(o,i,e,l,"leftBottomCorner",`${o}${s}${a}${l}`,r)}if(b){const e=Math.max(o,t.table.colCount-t.table.rightFrozenColCount),i=Math.max(s,t.table.rowCount-t.table.bottomFrozenRowCount),r=[!d,!0,!0,!g];t.createCellSelectBorder(e,i,a,l,"rightBottomCorner",`${o}${s}${a}${l}`,r)}if(u){const e=Math.max(o,t.table.frozenColCount),i=Math.min(a,t.table.colCount-t.table.rightFrozenColCount-1),r=Math.min(l,t.table.frozenRowCount-1),n=[!0,!m,!p,!f];t.createCellSelectBorder(e,s,i,r,"columnHeader",`${o}${s}${a}${l}`,n)}if(g){const e=Math.max(o,t.table.frozenColCount),i=Math.min(a,t.table.colCount-t.table.rightFrozenColCount-1),r=Math.max(s,t.table.rowCount-t.table.bottomFrozenRowCount),n=[!p,!b,!0,!y];t.createCellSelectBorder(e,r,i,l,"bottomFrozen",`${o}${s}${a}${l}`,n)}if(c){const e=Math.max(s,t.table.frozenRowCount),i=Math.min(l,t.table.rowCount-t.table.bottomFrozenRowCount-1),r=Math.min(a,t.table.frozenColCount-1),n=[!f,!p,!y,!0];t.createCellSelectBorder(o,e,r,i,"rowHeader",`${o}${s}${a}${l}`,n)}if(d){const e=Math.max(s,t.table.frozenRowCount),i=Math.min(l,t.table.rowCount-t.table.bottomFrozenRowCount-1),r=Math.max(o,t.table.colCount-t.table.rightFrozenColCount),n=[!m,!0,!b,!p];t.createCellSelectBorder(r,e,a,i,"rightFrozen",`${o}${s}${a}${l}`,n)}if(p){const e=Math.max(o,t.table.frozenColCount),i=Math.max(s,t.table.frozenRowCount),r=Math.min(a,t.table.colCount-t.table.rightFrozenColCount-1),n=Math.min(l,t.table.rowCount-t.table.bottomFrozenRowCount-1),h=[!u,!d,!g,!c];t.createCellSelectBorder(e,i,r,n,"body",`${o}${s}${a}${l}`,h)}}function _T(t){t.selectingRangeComponents.forEach(((e,i)=>{t.selectedRangeComponents.get(i)&&t.selectedRangeComponents.get(i).rect.delete(),t.selectedRangeComponents.set(i,e)})),t.selectingRangeComponents=new Map,t.updateNextFrame()}function ST(t){t.selectedRangeComponents.forEach(((t,e)=>{t.rect.delete()})),t.selectedRangeComponents=new Map}function AT(t,e,i,r){const n=r.scenegraph,o=BT(t.map((t=>t.row))).sort(((t,e)=>e-t)),s=BT(e.map((t=>t.row))).sort(((t,e)=>t-e)),a=BT(i.map((t=>t.row))).sort(((t,e)=>t-e));o.forEach((t=>{!function(t,e){!function(t,e){for(let i=0;i<e.table.colCount;i++){const r=e.getColGroup(i,!1);if(!r)continue;let n;r.forEachChildren((e=>e.row===t&&(n=e,!0))),n&&(r.updateColumnHeight(-n.attribute.height),r.removeChild(n))}}(t,e);const i=e.proxy;t>=i.rowStart&&t<=i.rowEnd&&(i.rowEnd--,i.currentRow--);i.bodyBottomRow--;const r=Math.min(i.rowLimit,i.bodyBottomRow-i.bodyTopRow+1);i.totalActualBodyRowCount=r,i.totalRow=i.rowStart+r-1}(t,n)}));const l=r.rowHeightsMap;let h;o.forEach((t=>{l.delAndReorder(t)})),o.length&&function(t){function e(e,i){e.row=i;const r=Nv(t.table,e.col,e.row);r?(e.mergeStartCol=r.start.col,e.mergeEndCol=r.end.col,e.mergeStartRow=r.start.row,e.mergeEndRow=r.end.row):(e.mergeStartCol=void 0,e.mergeEndCol=void 0,e.mergeStartRow=void 0,e.mergeEndRow=void 0)}t.bodyGroup.forEachChildren((i=>{let r=t.bodyRowStart;i?.forEachChildren((t=>{e(t,r),r++}))})),t.rowHeaderGroup.forEachChildren((i=>{let r=t.bodyRowStart;i?.forEachChildren((t=>{e(t,r),r++}))})),t.rightFrozenGroup.forEachChildren((i=>{let r=t.bodyRowStart;i?.forEachChildren((t=>{e(t,r),r++}))})),t.bottomFrozenGroup.forEachChildren((i=>{let r=t.table.rowCount-t.table.bottomFrozenRowCount;i?.forEachChildren((t=>{e(t,r),r++}))})),t.leftBottomCornerGroup.forEachChildren((i=>{let r=t.table.rowCount-t.table.bottomFrozenRowCount;i?.forEachChildren((t=>{e(t,r),r++}))})),t.rightBottomCornerGroup.forEachChildren((i=>{let r=t.table.rowCount-t.table.bottomFrozenRowCount;i?.forEachChildren((t=>{e(t,r),r++}))}))}(n),n.table._clearRowRangeHeightsMap(),s.forEach((t=>{const e=function(t,e){const i=e.proxy;i.bodyBottomRow++;const r=Math.min(i.rowLimit,i.bodyBottomRow-i.bodyTopRow+1);if(i.totalActualBodyRowCount=r,i.totalRow=i.rowStart+r-1,t<i.rowStart)return;if(t>i.rowEnd)return i.rowEnd-i.rowStart+1<i.rowLimit?(i.rowEnd++,i.currentRow++,TT(t,e),t):void 0;if(i.rowEnd-i.rowStart+1<i.rowLimit)return i.rowEnd++,i.currentRow++,TT(t,e),t;return t}(t,n);h=h??e,l.addAndReorder(t)})),function(t){function e(e,i,r){e.row=i,e.setAttribute("y",r);const n=Nv(t.table,e.col,e.row);n?(e.mergeStartCol=n.start.col,e.mergeEndCol=n.end.col,e.mergeStartRow=n.start.row,e.mergeEndRow=n.end.row):(e.mergeStartCol=void 0,e.mergeEndCol=void 0,e.mergeStartRow=void 0,e.mergeEndRow=void 0)}t.bodyGroup.forEachChildren((i=>{let r=t.bodyRowStart,n=t.getCellGroupY(r);i?.forEachChildren((t=>{e(t,r,n),r++,n+=t.attribute.height}))})),t.rowHeaderGroup.forEachChildren((i=>{let r=t.bodyRowStart,n=t.getCellGroupY(r);i?.forEachChildren((t=>{e(t,r,n),r++,n+=t.attribute.height}))})),t.rightFrozenGroup.forEachChildren((i=>{let r=t.bodyRowStart,n=t.getCellGroupY(r);i?.forEachChildren((t=>{e(t,r,n),r++,n+=t.attribute.height}))})),t.bottomFrozenGroup.forEachChildren((i=>{let r=t.table.rowCount-t.table.bottomFrozenRowCount,n=0;i?.forEachChildren((t=>{e(t,r,n),r++,n+=t.attribute.height}))})),t.leftBottomCornerGroup.forEachChildren((i=>{let r=t.table.rowCount-t.table.bottomFrozenRowCount,n=0;i?.forEachChildren((t=>{e(t,r,n),r++,n+=t.attribute.height}))})),t.rightBottomCornerGroup.forEachChildren((i=>{let r=t.table.rowCount-t.table.bottomFrozenRowCount,n=0;i?.forEachChildren((t=>{e(t,r,n),r++,n+=t.attribute.height}))}))}(n);for(let t=0;t<r.colCount;t++)a.forEach((e=>{const i=Nv(n.table,t,e);if(i)for(let t=i.start.col;t<=i.end.col;t++)for(let e=i.start.row;e<=i.end.row;e++)SA(t,e,n.table,!1);else SA(t,e,n.table,!1)}));if(ot(h)){for(let t=0;t<r.colCount;t++)for(let e=h;e<r.rowCount;e++){const i=n.highPerformanceGetCell(t,e,!0);i&&(i.needUpdate=!0)}n.proxy.rowUpdatePos=h}if(s.length){if(!ot(h)){const t=Math.min(...s);n.proxy.rowUpdatePos=Math.min(t,n.proxy.rowUpdatePos)}n.proxy.rowUpdateDirection="up",n.proxy.updateCellGroups(2*n.proxy.screenRowCount),d(),n.proxy.progress()}else o.length&&(n.proxy.updateCellGroups(2*n.proxy.screenRowCount),d(),n.proxy.progress());const c=r.getRowsHeight(r.frozenRowCount,r.rowCount-1-r.bottomFrozenRowCount);function d(){if(s?.[s?.length-1]>=r.rowCount-r.bottomFrozenRowCount||a?.[a?.length-1]>=r.rowCount-r.bottomFrozenRowCount||o?.[0]>=r.rowCount-r.bottomFrozenRowCount){for(let t=0;t<r.colCount;t++)for(let e=r.rowCount-r.bottomFrozenRowCount;e<r.rowCount;e++){const i=n.highPerformanceGetCell(t,e,!0);i&&(i.needUpdate=!0)}n.proxy.updateBottomFrozenCellGroups()}}n.updateContainerHeight(n.table.frozenRowCount,c-n.bodyGroup.attribute.height)}function BT(t){const e=[];for(let i=0;i<t.length;i++)-1===e.indexOf(t[i])&&e.push(t[i]);return e}function TT(t,e){for(let i=0;i<e.table.colCount;i++){const r=new qS({x:0,y:0,width:e.table.getColWidth(i),height:e.table.getRowHeight(t)});if(r.role="cell",r.col=i,r.row=t,r.needUpdate=!0,!r)continue;const n=e.getColGroup(i);if(n)if(n.firstChild&&t<n.firstChild.row)n.insertBefore(r,n.firstChild),n.firstChild.row=n.firstChild.row+1;else if(n.lastChild&&t>n.lastChild.row)n.appendChild(r);else{const o=e.highPerformanceGetCell(i,t,!0);o!==r&&(n.insertBefore(r,o),o&&(o.row=o.row+1),o!==n.lastChild&&n.lastChild&&(n.lastChild.row=n.lastChild.row+1))}}}function MT(t){const{changedCells:e}=t.internalProps.stick;e.forEach((e=>{t.scenegraph.getCell(e.col,e.row).forEachChildren((t=>{t.setAttributes({dx:e.dx,dy:e.dy})}))})),e.length=0;const{scrollTop:i,scrollLeft:r,frozenRowCount:n,frozenColCount:o}=t,s=t.getFrozenRowsHeight(),a=t.getFrozenColsWidth(),{row:l}=t.getRowAt(i+s+1),{col:h}=t.getColAt(r+a+1),c=Math.max(l,t.frozenRowCount),d=Math.max(h,t.frozenColCount),u=t.getAllRowsHeight()>t.tableNoFrameHeight?t.getRowAt(i+t.tableNoFrameHeight-1).row:t.rowCount-1,g=t.getAllColsWidth()>t.tableNoFrameWidth?t.getColAt(r+t.tableNoFrameWidth-1).col:t.colCount-1;if(!(g<0||u<0)){for(let i=0;i<n&&!(g<d);i++)[d,g].forEach((r=>{if(t._getCellStyle(r,i)?.textStick){ET(t.scenegraph.getCell(r,i),a+t.tableX,t.tableNoFrameWidth-t.getRightFrozenColsWidth()+t.tableX,e,t)}}));for(let i=0;i<o&&!(u<c);i++)[c,u].forEach((r=>{if(t._getCellStyle(i,r)?.textStick&&"tree"!==t.internalProps.layoutMap.rowHierarchyType){RT(t.scenegraph.getCell(i,r),s+t.tableY,t.tableNoFrameHeight-t.getBottomFrozenRowsHeight()+t.tableY,e,t)}}));for(let i=d;i<=g&&!(u<c);i++)[c,u].forEach((r=>{if(t._getCellStyle(i,r)?.textStick){RT(t.scenegraph.getCell(i,r),s+t.tableY,t.tableNoFrameHeight-t.getBottomFrozenRowsHeight()+t.tableY,e,t)}}));for(let i=c;i<u&&!(g<d);i++)[d,g].forEach((r=>{if(t._getCellStyle(r,i)?.textStick){ET(t.scenegraph.getCell(r,i),a+t.tableX,t.tableNoFrameWidth-t.getRightFrozenColsWidth()+t.tableX,e,t)}}))}}function RT(t,e,i,r,n){if(ot(t.mergeStartCol)&&ot(t.mergeStartRow)&&ot(t.mergeEndCol)&&ot(t.mergeEndRow))for(let o=t.mergeStartCol;o<=t.mergeEndCol;o++)for(let s=t.mergeStartRow;s<=t.mergeEndRow;s++){PT(n.scenegraph.getCell(o,s),e,i,r)}else PT(t,e,i,r)}function PT(t,e,i,r){const n=t.getChildByName("text",!0);if(!n)return;n.AABBBounds.width();const o=n.globalAABBBounds.y1,s=n.globalAABBBounds.y2;if(o<e){const i=o-e;r.push({col:t.col,row:t.row,dx:t.firstChild?.attribute.dx??0,dy:t.firstChild?.attribute.dy??0}),t.forEachChildren((t=>{t.setAttribute("dy",(t.attribute.dy??0)-i+2)}))}else if(s>i){const e=s-i;r.push({col:t.col,row:t.row,dx:t.firstChild?.attribute.dx??0,dy:t.firstChild?.attribute.dy??0}),t.forEachChildren((t=>{t.setAttribute("dy",(t.attribute.dy??0)-e)}))}}function ET(t,e,i,r,n){if(ot(t.mergeStartCol)&&ot(t.mergeStartRow)&&ot(t.mergeEndCol)&&ot(t.mergeEndRow))for(let o=t.mergeStartCol;o<=t.mergeEndCol;o++)for(let s=t.mergeStartRow;s<=t.mergeEndRow;s++){HT(n.scenegraph.getCell(o,s),e,i,r)}else HT(t,e,i,r)}function HT(t,e,i,r){const n=t.getChildByName("text",!0);if(!n)return;n.AABBBounds.width();const o=n.globalAABBBounds.x1,s=n.globalAABBBounds.x2;if(o<e){const i=o-e;r.push({col:t.col,row:t.row,dx:t.firstChild?.attribute.dx??0,dy:t.firstChild?.attribute.dy??0}),t.forEachChildren((t=>{t.setAttribute("dx",(t.attribute.dx??0)-i+2)}))}else if(s>i){const e=s-i;r.push({col:t.col,row:t.row,dx:t.firstChild?.attribute.dx??0,dy:t.firstChild?.attribute.dy??0}),t.forEachChildren((t=>{t.setAttribute("dx",(t.attribute.dx??0)-e)}))}}function LT(t){const e=t.internalProps.layoutMap.headerObjects,i=t.internalProps.layoutMap.columnObjects;for(let t=0;t<e.length;t++){const i=e[t];if(i&&i.style?.textStick)return!0}for(let t=0;t<i.length;t++){const e=i[t];if(e&&e.style?.textStick)return!0}return!1}function kT(t){const e=t.bodyGroup.firstChild instanceof qS?t.bodyGroup.firstChild:null;e&&(t.rowHeaderGroup.appendChild(e),t.rowHeaderGroup.setAttribute("width",t.rowHeaderGroup.attribute.width+e.attribute.width),t.bodyGroup.setAttribute("width",t.bodyGroup.attribute.width-e.attribute.width))}function IT(t){const e=t.colHeaderGroup.firstChild instanceof qS?t.colHeaderGroup.firstChild:null;e&&(t.cornerHeaderGroup.appendChild(e),t.cornerHeaderGroup.setAttribute("width",t.cornerHeaderGroup.attribute.width+e.attribute.width),t.colHeaderGroup.setAttribute("width",t.colHeaderGroup.attribute.width-e.attribute.width))}function FT(t){const e=t.rowHeaderGroup.lastChild instanceof qS?t.rowHeaderGroup.lastChild:t.rowHeaderGroup.lastChild?._prev;e&&(WT(t.bodyGroup,e,t.bodyGroup.firstChild),t.bodyGroup.setAttribute("width",t.bodyGroup.attribute.width+e.attribute.width),t.rowHeaderGroup.setAttribute("width",t.rowHeaderGroup.attribute.width-e.attribute.width))}function zT(t){const e=t.cornerHeaderGroup.lastChild instanceof qS?t.cornerHeaderGroup.lastChild:t.cornerHeaderGroup.lastChild?._prev;e&&(WT(t.colHeaderGroup,e,t.colHeaderGroup.firstChild),t.colHeaderGroup.setAttribute("width",t.colHeaderGroup.attribute.width+e.attribute.width),t.cornerHeaderGroup.setAttribute("width",t.cornerHeaderGroup.attribute.width-e.attribute.width))}function OT(t){const e=t.bottomFrozenGroup.firstChild instanceof qS?t.bottomFrozenGroup.firstChild:null;e&&(t.leftBottomCornerGroup.appendChild(e),t.leftBottomCornerGroup.setAttribute("width",t.leftBottomCornerGroup.attribute.width+e.attribute.width),t.bottomFrozenGroup.setAttribute("width",t.bottomFrozenGroup.attribute.width-e.attribute.width),t.table.isPivotChart()&&e.forEachChildren((t=>{t.setAttributes({stroke:!1,fill:!1})})))}function DT(t){const e=t.leftBottomCornerGroup.lastChild instanceof qS?t.leftBottomCornerGroup.lastChild:t.leftBottomCornerGroup.lastChild?._prev;e&&(WT(t.bottomFrozenGroup,e,t.bottomFrozenGroup.firstChild),t.bottomFrozenGroup.setAttribute("width",t.bottomFrozenGroup.attribute.width+e.attribute.width),t.leftBottomCornerGroup.setAttribute("width",t.leftBottomCornerGroup.attribute.width-e.attribute.width),t.table.isPivotChart()&&e.forEachChildren((e=>{const i=t.table._getCellStyle(e.col,e.row),r=t.table.getCellRange(e.col,e.row),n=OS(i,t.table,r?r.start.col:e.col,r?r.start.row:e.row,QS).theme;e.setAttributes({fill:n?.group?.fill??void 0,stroke:n?.group?.stroke??void 0})})))}function WT(t,e,i){e&&t&&(i?t.insertBefore(e,i):t.appendChild(e))}function NT(t){for(let e=t.proxy.colStart;e<=t.proxy.colEnd;e++){const i=t.getColGroup(e);i?.getChildren()?.forEach((t=>{t.children.forEach((t=>{"chart"===t.type&&(t.cacheCanvas=null,t.addUpdateBoundTag())}))}))}}function GT(t,e){t.forEachChildren((t=>{"column"===t.role&&t.forEachChildren((t=>{if("cell"===t.role){let i=!1;if(t.forEachChildren((t=>"axis"===t.name&&(i=!0,!0))),i){const i=e.internalProps.layoutMap.getAxisConfigInPivotChart(t.col,t.row),r=eS(QS("padding",e._getCellStyle(t.col,t.row),t.col,t.row,e)),n=new I_(i,t.attribute.width,t.attribute.height,r,e);t.clear(),t.appendChild(n.component),n.overlap()}}}))}))}function jT(t,e,i){return new qS({x:0,y:0,width:t,height:e,clip:i??!1,pickable:!1})}function UT(t,e){return t.forEachChildrenSkipChild(((t,i)=>{t.setAttribute("x",e),e+=t.attribute.width})),e}var VT=new i(((t,e,i,r)=>{t(XT).toSelf().inSingletonScope(),r($r).toService(XT)}));const KT=new Map;function $T(t,e,i,r="normal"){const n=`${t}-${e}-${i}-${r}`,o=KT.get(n);if(o)return o;const s=(a={fontSize:t,fontFamily:i,fontWeight:e,fontStyle:r},new $e({defaultFontParams:{fontFamily:fr.fontFamily,fontSize:fr.fontSize},getTextBounds:h?void 0:dh,specialCharSet:`{}()//&-/: .,@%'"~…${$e.ALPHABET_CHAR_SET}${$e.ALPHABET_CHAR_SET.toUpperCase()}0123456789`,...l??{}},a));var a,l,h;return KT.set(n,s),s}class XT extends Xr{measureTextWidth(t,e){const{fontSize:i,fontFamily:r="Arial,sans-serif",fontWeight:n="normal",fontStyle:o="normal"}=e;return $T(i,n,r,o).measure(t).width}measureText(t,e){const{fontSize:i,fontFamily:r="Arial,sans-serif",fontWeight:n="normal",fontStyle:o="normal"}=e;return $T(i,n,r,o).measure(t)}}const YT=new class{measureText(t,e){const{fontSize:i,fontFamily:r="Arial,sans-serif",fontWeight:n="normal",fontStyle:o="normal"}=e;return $T(i,n,r,o).measure(t)}measureTextWidth(t,e){const{fontSize:i,fontFamily:r="Arial,sans-serif",fontWeight:n="normal",fontStyle:o="normal"}=e;return $T(i,n,r,o).measure(t).width}clipText(t,e,i){if(0===t.length)return{str:"",width:0};let r=this.measureTextWidth(t,e);return r<=i?{str:t,width:r}:(r=this.measureTextWidth(t[0],e),r>i?{str:"",width:0}:this._clipText(t,e,i,0,t.length-1))}_clipText(t,e,i,r,n){const o=Math.floor((r+n)/2),s=t.substring(0,o+1),a=this.measureTextWidth(s,e);let l;if(a>i){if(s.length<=1)return{str:"",width:0};const n=t.substring(0,o);return l=this.measureTextWidth(n,e),l<=i?{str:n,width:l}:this._clipText(t,e,i,r,o)}if(a<i){if(o>=t.length-1)return{str:t,width:this.measureTextWidth(t,e)};const r=t.substring(0,o+2);return l=this.measureTextWidth(r,e),l>=i?{str:s,width:a}:this._clipText(t,e,i,o,n)}return{str:s,width:a}}clipTextWithSuffix(t,e,i,r){if(""===r)return this.clipText(t,e,i);if(0===t.length)return{str:"",width:0};const n=this.measureTextWidth(t,e);if(n<=i)return{str:t,width:n};const o=this.measureTextWidth(r,e);if(o>i)return{str:"",width:0};i-=o;const s=this._clipText(t,e,i,0,t.length-1);return s.str+=r,s.width+=o,s}};function qT(t,e,i,r,n){const o=t.name;QT(i,r,(t=>t.name===o),(t=>{fA(e,t),t.name=e.name}),n),n.updateNextFrame()}function ZT(t,e,i,r,n,o,s,a){const l=a.table.internalProps.headerHelper.getSortIcon(r,a.table,t,e);if(i&&qT(i,l,t,e,a),!function(t,e,i,r,n){const o=n.getCellRange(t,e),s=n.getCellRange(i,r);return o.start.col===s.start.col&&o.start.row===s.start.row&&o.end.col===s.end.col&&o.end.row===s.end.row}(t,e,n,o,a.table)){const t=a.table.internalProps.headerHelper.getSortIcon("normal",a.table,n,o);s?qT(s,t,n,o,a):function(t,e,i,r){const n=r.getCell(t,e);if(Y(n.mergeStartCol)&&Y(n.mergeStartRow)&&Y(n.mergeEndCol)&&Y(n.mergeEndRow))for(let t=n.mergeStartCol;t<=n.mergeEndCol;t++)for(let e=n.mergeStartRow;e<=n.mergeEndRow;e++){let n;r.getCell(t,e).forEachChildren((t=>"sort"===t.attribute.funcType&&(n=t,!0))),n&&(fA(i,n),n.name=i.name)}else{let t;n.forEachChildren((e=>"sort"===e.attribute.funcType&&(t=e,!0))),t&&(fA(i,t),t.name=i.name)}}(n,o,t,a)}}function JT(t,e,i){t.forEachChildren((t=>{"group"===t.type?JT(t,e,i):e(t)&&i(t)}))}function QT(t,e,i,r,n){const o=n.getCell(t,e);if(Y(o.mergeStartCol)&&Y(o.mergeStartRow)&&Y(o.mergeEndCol)&&Y(o.mergeEndRow))for(let t=o.mergeStartCol;t<=o.mergeEndCol;t++)for(let e=o.mergeStartRow;e<=o.mergeEndRow;e++)JT(n.getCell(t,e),i,r);else JT(o,i,r)}function tM(t,e){const{bgColor:i,borderColor:r,borderLineWidth:n,borderLineDash:o}=e,s={x:0,y:0,width:0,height:0,visible:!1,pickable:!0,fill:i};return s.stroke=bB(r,void 0),s.lineWidth=n,o&&(s.lineDash=o),s.lineCap="square",Array.isArray(r)&&(s.strokeArrayColor=eS(r)),Array.isArray(n)&&(s.strokeArrayWidth=eS(n),s.lineWidth=1),t.setAttributes(s),t.role="corner-frozen",t}function eM(t,e,i,r){const n=r.scenegraph,o=iM(t.map((t=>t.col))).sort(((t,e)=>e-t)),s=iM(e.map((t=>t.col))).sort(((t,e)=>t-e)),a=iM(i.map((t=>t.col))).sort(((t,e)=>t-e));o.forEach((t=>{!function(t,e){const i=e.proxy;if(t>=e.table.rowHeaderLevelCount)if(t>=e.table.colCount-e.table.rightFrozenColCount);else{const i=e.getColGroup(t,!1);i&&i.parent===e.bodyGroup&&e.bodyGroup.removeChild(i);const r=e.getColGroupInBottom(t);r&&r.parent===e.bottomFrozenGroup&&e.bottomFrozenGroup.removeChild(r)}t>=i.colStart&&t<=i.colEnd&&(i.colEnd--,i.currentCol--);i.bodyRightCol--;const r=Math.min(i.colLimit,i.bodyRightCol-i.bodyLeftCol+1);i.totalActualBodyColCount=r,i.totalCol=i.colStart+r-1}(t,n)}));const l=r.colWidthsMap;let h;if(o.forEach((t=>{l.delAndReorder(t)})),o.length&&rM(n),n.table._clearColRangeWidthsMap(),s.forEach((t=>{const e=function(t,e){const i=e.proxy;i.bodyRightCol++;const r=Math.min(i.colLimit,i.bodyRightCol-i.bodyLeftCol+1);if(i.totalActualBodyColCount=r,i.totalCol=i.colStart+r-1,t<i.colStart)return;if(t>i.colEnd)return i.colEnd-i.colStart+1<i.colLimit?(i.colEnd++,i.currentCol++,nM(t,e),t):void 0;if(i.colEnd-i.colStart+1<i.colLimit)return i.colEnd++,i.currentCol++,nM(t,e),t;return t}(t,n);rM(n),h=h??e,l.addAndReorder(t)})),function(t){let e=t.bodyColStart,i=t.getCellGroupX(e);function r(i){i.col=e;const r=Nv(t.table,i.col,i.row);r&&(i.mergeStartCol=r.start.col,i.mergeStartCol=r.start.col,i.mergeEndCol=r.end.col,i.mergeEndCol=r.end.col),i.role}t.bodyGroup.forEachChildren((t=>{t.col=e,t?.forEachChildren((t=>{r(t)})),t.setAttribute("x",i),i+=t.attribute.width,e++})),e=t.bodyColStart,i=t.getCellGroupX(e),t.colHeaderGroup.forEachChildren((t=>{t.col=e,t?.forEachChildren((t=>{r(t)})),t.setAttribute("x",i),i+=t.attribute.width,e++})),e=t.bodyColStart,i=t.getCellGroupX(e),t.bottomFrozenGroup.forEachChildren((t=>{t.col=e,t?.forEachChildren((t=>{r(t)})),t.setAttribute("x",i),i+=t.attribute.width,e++})),e=t.table.colCount-t.table.rightFrozenColCount,i=0,t.rightFrozenGroup.forEachChildren((t=>{t.col=e,t?.forEachChildren((t=>{r(t)})),t.setAttribute("x",i),i+=t.attribute.width,e++})),e=t.table.colCount-t.table.rightFrozenColCount,i=0,t.rightTopCornerGroup.forEachChildren((t=>{t.col=e,t?.forEachChildren((t=>{r(t)})),t.setAttribute("x",i),i+=t.attribute.width,e++})),e=t.table.colCount-t.table.rightFrozenColCount,i=0,t.rightBottomCornerGroup.forEachChildren((t=>{t.col=e,t?.forEachChildren((t=>{r(t)})),t.setAttribute("x",i),i+=t.attribute.width,e++}))}(n),a.forEach((t=>{for(let e=0;e<r.rowCount;e++){const i=Nv(n.table,t,e);if(i)for(let t=i.start.col;t<=i.end.col;t++)for(let t=i.start.col;t<=i.end.col;t++)SA(t,e,n.table,!1);else SA(t,e,n.table,!1)}})),ot(h)){for(let t=h;t<r.colCount;t++)for(let e=0;e<r.rowCount;e++){const i=n.highPerformanceGetCell(t,e,!0);i&&(i.needUpdate=!0)}n.proxy.colUpdatePos=h}if(s.length){if(!ot(h)){const t=Math.min(...s);n.proxy.colUpdatePos=t}n.proxy.colUpdateDirection="left",n.proxy.updateColGroups(2*n.proxy.screenColCount),d(),n.proxy.progress()}else o.length&&(n.proxy.updateColGroups(2*n.proxy.screenColCount),d(),n.proxy.progress());const c=r.getColsWidth(r.frozenColCount,r.colCount-1);function d(){if(s?.[s?.length-1]>=r.colCount-r.rightFrozenColCount||a?.[a?.length-1]>=r.colCount-r.rightFrozenColCount||o?.[0]>=r.colCount-r.rightFrozenColCount){for(let t=r.colCount-r.rightFrozenColCount;t<r.colCount;t++)for(let e=0;e<r.rowCount;e++){const i=n.highPerformanceGetCell(t,e,!0);i&&(i.needUpdate=!0)}n.proxy.updateRightFrozenCellGroups()}}n.updateContainerWidth(n.table.frozenColCount,c-n.bodyGroup.attribute.width)}function iM(t){const e=[];for(let i=0;i<t.length;i++)-1===e.indexOf(t[i])&&e.push(t[i]);return e}function rM(t){let e=t.bodyColStart;function i(i){i.col=e;const r=Nv(t.table,i.col,i.row);r&&(i.mergeStartCol=r.start.col,i.mergeStartCol=r.start.col,i.mergeEndCol=r.end.col,i.mergeEndCol=r.end.col),i.role}t.bodyGroup.forEachChildren((t=>{t.col=e,t?.forEachChildren((t=>{i(t)})),e++})),e=t.bodyColStart,t.colHeaderGroup.forEachChildren((t=>{t.col=e,t?.forEachChildren((t=>{i(t)})),e++})),e=t.bodyColStart,t.bottomFrozenGroup.forEachChildren((t=>{t.col=e,t?.forEachChildren((t=>{i(t)})),e++}))}function nM(t,e){if(e.colHeaderGroup&&e.table.columnHeaderLevelCount>0){const r=new qS({x:0,y:0,width:e.table.getColWidth(t),height:0,clip:!1,pickable:!1});r.role="column",r.col=t;const n=e.getColGroup(t,!0);n?e.colHeaderGroup.insertBefore(r,n):e.colHeaderGroup.appendChild(r),i(r,t,0,e.table.columnHeaderLevelCount-1)}if(e.bodyGroup){const r=new qS({x:0,y:0,width:e.table.getColWidth(t),height:0,clip:!1,pickable:!1});r.role="column",r.col=t;const n=e.getColGroup(t,!1);n?e.bodyGroup.insertBefore(r,n):e.bodyGroup.appendChild(r),i(r,t,e.bodyRowStart,e.bodyRowEnd)}if(e.bottomFrozenGroup&&e.table.bottomFrozenRowCount>0){const r=new qS({x:0,y:0,width:e.table.getColWidth(t),height:0,clip:!1,pickable:!1});r.role="column",r.col=t;const n=e.getColGroupInBottom(t);n?e.bottomFrozenGroup.insertBefore(r,n):e.bottomFrozenGroup.appendChild(r),i(r,t,e.table.rowCount-e.table.bottomFrozenRowCount,e.table.rowCount-1)}function i(t,i,r,n){for(let o=r;o<=n;o++){const r=new qS({x:0,y:0,width:e.table.getColWidth(i),height:e.table.getRowHeight(o)});r.role="cell",r.col=i,r.row=o,r.needUpdate=!0,t.appendChild(r)}}}Yr.load(dw),Yr.load(XB),Yr.load(VT);class oM{proxy;tableGroup;colHeaderGroup;cornerHeaderGroup;rowHeaderGroup;bodyGroup;rightFrozenGroup;bottomFrozenGroup;rightTopCornerGroup;leftBottomCornerGroup;rightBottomCornerGroup;componentGroup;selectedRangeComponents;selectingRangeComponents;lastSelectId;component;stage;table;isPivot;transpose;hasFrozen;frozenColCount;frozenRowCount;clear;mergeMap;_dealAutoFillHeightOriginRowsHeight;constructor(t){var e;let i,r;var n;this.table=t,this.hasFrozen=!1,this.clear=!0,this.mergeMap=new Map,e=this.table.theme.textPopTipStyle,wt(iw.poptip,ew,e),"node"===CC.mode?(_u.setEnv("node",t.options.modeParams),i=t.canvasWidth,r=t.canvasHeight):(_u.setEnv("browser"),i=t.canvas.width,r=t.canvas.height),this.stage=(n={canvas:t.canvas,width:i,height:r,disableDirtyBounds:!1,background:t.theme.underlayBackgroundColor,dpr:t.internalProps.pixelRatio,enableLayout:!0,afterRender:()=>{this.table.fireListeners("after_render",null)}},new Ku(n)),this.stage.defaultLayer.setTheme({group:{boundsPadding:0,strokeBoundsBuffer:0,lineJoin:"round"},text:{ignoreBuf:!0}}),this.initSceneGraph(),this.stage.defaultLayer.add(this.tableGroup),this.stage.table=this.table,this.createComponent()}get width(){return this.tableGroup.attribute?.width??0}get height(){return this.tableGroup.attribute?.height??0}get x(){return this.tableGroup.attribute?.x??0}get y(){return this.tableGroup.attribute?.y??0}get bodyRowStart(){return this.proxy.rowStart??0}get bodyRowEnd(){return this.proxy.rowEnd??this.table.rowCount-1}get bodyColStart(){return this.proxy.colStart??0}get bodyColEnd(){return this.proxy.colEnd??this.table.colCount-1}initSceneGraph(){this.isPivot=this.table.isPivotTable(),this.transpose=this.table.options.transpose,function(t){const e=t.table.tableNoFrameWidth,i=t.table.tableNoFrameHeight;t.tableGroup=new qS({x:0,y:0,width:e,height:i,clip:!0,pickable:!1}),t.tableGroup.role="table";const r=jT(0,0,!0);r.role="col-header",t.colHeaderGroup=r;const n=jT(0,0,!0);n.role="corner-header",t.cornerHeaderGroup=n;const o=jT(0,0,!0);o.role="row-header",t.rowHeaderGroup=o;const s=jT(e,0,!0);s.role="body",t.bodyGroup=s;const a=jT(0,0,!0);a.role="right-frozen",t.rightFrozenGroup=a;const l=jT(0,0,!0);l.role="bottom-frozen",t.bottomFrozenGroup=l;const h=jT(0,0);h.role="component",t.componentGroup=h;const c=jT(0,0,!0);c.role="corner-right-top-header",t.rightTopCornerGroup=c;const d=jT(0,0,!0);d.role="corner-right-bottom-header",t.rightBottomCornerGroup=d;const u=jT(0,0,!0);u.role="corner-left-bottom-header",t.leftBottomCornerGroup=u,t.tableGroup.addChild(s),t.tableGroup.addChild(o),t.tableGroup.addChild(l),t.tableGroup.addChild(r),t.tableGroup.addChild(a),t.tableGroup.addChild(d),t.tableGroup.addChild(c),t.tableGroup.addChild(u),t.tableGroup.addChild(n),t.tableGroup.addChild(h)}(this)}clearCells(){(this.table.isPivotChart()||this.table.hasCustomRenderOrLayout())&&this.stage.pluginService.findPluginsByName("poptipForText").forEach((t=>{t.deactivate(this.stage.pluginService)})),this.clear=!0,this.hasFrozen=!1,this.mergeMap.clear(),this.colHeaderGroup.clear(),this.rowHeaderGroup.clear(),this.cornerHeaderGroup.clear(),this.bodyGroup.clear(),this.bottomFrozenGroup.clear(),this.rightFrozenGroup.clear(),this.rightTopCornerGroup.clear(),this.rightBottomCornerGroup.clear(),this.leftBottomCornerGroup.clear(),this.colHeaderGroup.setAttributes({x:0,y:0,width:0,height:0}),this.rowHeaderGroup.setAttributes({x:0,y:0,width:0,height:0}),this.cornerHeaderGroup.setAttributes({x:0,y:0,width:0,height:0}),this.bodyGroup.setAttributes({x:0,y:0,width:0,height:0}),this.rightFrozenGroup.setAttributes({x:0,y:0,width:0,height:0}),this.bottomFrozenGroup.setAttributes({x:0,y:0,width:0,height:0}),this.rightTopCornerGroup.setAttributes({x:0,y:0,width:0,height:0,visible:!1}),this.leftBottomCornerGroup.setAttributes({x:0,y:0,width:0,height:0,visible:!1}),this.rightBottomCornerGroup.setAttributes({x:0,y:0,width:0,height:0,visible:!1}),this.tableGroup.setAttributes({x:this.table.tableX,y:this.table.tableY,width:0,height:0}),this.tableGroup.border&&(this.tableGroup.parent.removeChild(this.tableGroup.border),delete this.tableGroup.border),this.proxy?.release()}updateStageBackground(){this.stage.background=this.table.theme.underlayBackgroundColor,this.stage.renderNextFrame()}createComponent(){this.component=new pB(this.table),this.component.addToGroup(this.componentGroup),this.selectedRangeComponents=new Map,this.selectingRangeComponents=new Map}createSceneGraph(){(this.table.isPivotChart()||this.table.hasCustomRenderOrLayout())&&this.stage.pluginService.autoEnablePlugins.getContributions().forEach((t=>{"poptipForText"===t.name&&this.stage.pluginService.register(t)})),this.clear=!1,this.frozenColCount=this.table.frozenColCount,this.frozenRowCount=this.table.columnHeaderLevelCount,this.proxy=new CT(this.table),fB(this.tableGroup,this.table.theme.frameStyle,this.tableGroup.role,void 0,!0),this.table.isPivotChart()&&(tM(this.rightTopCornerGroup,this.table.theme.cornerRightTopCellStyle||this.table.theme.cornerHeaderStyle||{}),tM(this.leftBottomCornerGroup,this.table.theme.cornerLeftBottomCellStyle||this.table.theme.cornerHeaderStyle||{}),tM(this.rightBottomCornerGroup,this.table.theme.cornerRightBottomCellStyle||this.table.theme.cornerHeaderStyle||{})),this.proxy.createGroupForFirstScreen(this.cornerHeaderGroup,this.colHeaderGroup,this.rowHeaderGroup,this.rightFrozenGroup,this.bottomFrozenGroup,this.bodyGroup,0,0),this.afterScenegraphCreated()}renderSceneGraph(){this.stage.render()}getCell(t,e,i){let r;if(r=this.table.rightFrozenColCount>0&&t>=this.table.colCount-this.table.rightFrozenColCount&&e<this.table.frozenRowCount?this.rightTopCornerGroup.getColGroup(t)?.getRowGroup(e):this.table.bottomFrozenRowCount>0&&e>=this.table.rowCount-this.table.bottomFrozenRowCount&&t<this.table.frozenColCount?this.leftBottomCornerGroup.getColGroup(t)?.getRowGroup(e):this.table.rightFrozenColCount>0&&this.table.bottomFrozenRowCount>0&&t>=this.table.colCount-this.table.rightFrozenColCount&&e>=this.table.rowCount-this.table.bottomFrozenRowCount?this.rightBottomCornerGroup.getColGroup(t)?.getRowGroup(e):this.table.rightFrozenColCount>0&&t>this.table.colCount-1-this.table.rightFrozenColCount?this.rightFrozenGroup.getColGroup(t)?.getRowGroup(e):this.table.bottomFrozenRowCount>0&&e>this.table.rowCount-1-this.table.bottomFrozenRowCount?this.bottomFrozenGroup.getColGroup(t)?.getRowGroup(e):this.getColGroup(t,e<this.frozenRowCount)?.getRowGroup(e),r&&"shadow-cell"===r.role&&!i){const i=this.table.getCellRange(t,e);i.start.col===t&&i.start.row===e||(r=this.getCell(i.start.col,i.start.row))}return r||iT}highPerformanceGetCell(t,e,i){return this.proxy.highPerformanceGetCell(t,e,i)}getColGroup(t,e=!1){let i;return i=t<this.frozenColCount&&e?this.cornerHeaderGroup.getColGroup(t):t<this.frozenColCount?this.rowHeaderGroup.getColGroup(t):e&&this.table.rightFrozenColCount>0&&t>this.table.colCount-1-this.table.rightFrozenColCount?this.rightTopCornerGroup.getColGroup(t):!e&&this.table.rightFrozenColCount>0&&t>this.table.colCount-1-this.table.rightFrozenColCount?this.rightFrozenGroup.getColGroup(t):e?this.colHeaderGroup.getColGroup(t):this.bodyGroup.getColGroup(t),i||void 0}getColGroupInBottom(t){if(this.table.bottomFrozenRowCount>0)return this.bottomFrozenGroup.getColGroup(t)}getColGroupInLeftBottomCorner(t){if(this.table.bottomFrozenRowCount>0)return this.leftBottomCornerGroup.getColGroup(t)}getColGroupInRightTopCorner(t){if(this.table.rightFrozenColCount>0)return this.rightTopCornerGroup.getColGroup(t)}getColGroupInRightBottomCorner(t){if(this.table.rightFrozenColCount>0&&this.table.bottomFrozenRowCount>0)return this.rightBottomCornerGroup.getColGroup(t)}getCellSize(t,e){const i=this.getCell(t,e),r=Nv(this.table,t,e);let n=i.attribute.width,o=i.attribute.height;return r&&(n/=r.end.col-r.start.col+1,o/=r.end.row-r.start.row+1),{width:n,height:o}}updateNextFrame(){this.resetAllSelectComponent(),this.stage.renderNextFrame()}resetAllSelectComponent(){var t;this.table.stateManager.select?.ranges?.length>0&&((t=this).selectingRangeComponents.forEach(((e,i)=>{wT(e,i,t)})),t.selectedRangeComponents.forEach(((e,i)=>{wT(e,i,t)})))}hideHoverIcon(t,e){!function(t,e,i){-1!==t&&-1!==e&&(QT(t,e,(t=>"mouseenter_cell"===t.attribute.visibleTime),(t=>{t.setAttribute("opacity",0)}),i),i.updateNextFrame())}(t,e,this)}showHoverIcon(t,e){!function(t,e,i){-1!==t&&-1!==e&&(QT(t,e,(t=>"mouseenter_cell"===t.attribute.visibleTime),(t=>{t.setAttribute("opacity",1)}),i),i.updateNextFrame())}(t,e,this)}hideClickIcon(t,e){!function(t,e,i){-1!==t&&-1!==e&&(QT(t,e,(t=>"click_cell"===t.attribute.visibleTime),(t=>{t.setAttribute("opacity",0)}),i),i.updateNextFrame())}(t,e,this)}showClickIcon(t,e){!function(t,e,i){-1!==t&&-1!==e&&(QT(t,e,(t=>"click_cell"===t.attribute.visibleTime),(t=>{t.setAttribute("opacity",1)}),i),i.updateNextFrame())}(t,e,this)}getIcon(t,e,i,r){return function(t,e,i,r,n){let o;return n.getCell(t,e).forEachChildren((t=>{t.role&&t.role.startsWith("icon")&&t.containsPoint(i,r,vi.GLOBAL)&&(o=t)})),o}(t,e,i,r,this)}setIconHoverStyle(t,e,i,r){!function(t,e,i,r,n){if((t.attribute.backgroundColor||t.attribute.hoverImage)&&QT(e,i,(e=>e.name===t.name),(t=>{if(t.attribute.backgroundColor){let e=t.parent.getChildByName("icon-back");e?e.setAttributes({x:(t.attribute.x??0)+(t.attribute.dx??0)+(t.AABBBounds.width()-t.backgroundWidth)/2,y:(t.attribute.y??0)+(t.AABBBounds.height()-t.backgroundHeight)/2,dx:t.attribute.dx??0,dy:t.attribute.dy??0,width:t.backgroundWidth,height:t.backgroundHeight,fill:t.attribute.backgroundColor,cornerRadius:5,visible:!0}):(e=fl({x:(t.attribute.x??0)+(t.attribute.dx??0)+(t.AABBBounds.width()-t.backgroundWidth)/2,y:(t.attribute.y??0)+(t.AABBBounds.height()-t.backgroundHeight)/2,dx:t.attribute.dx??0,dy:t.attribute.dy??0,width:t.backgroundWidth,height:t.backgroundHeight,fill:t.attribute.backgroundColor,cornerRadius:5,pickable:!1,visible:!0}),e.name="icon-back"),t.parent.insertBefore(e,t)}t.attribute.hoverImage&&t.attribute.image!==t.attribute.hoverImage&&(t.image=t.attribute.hoverImage)}),n),t.tooltip){const{x1:r,x2:o,y1:s,y2:a}=t.globalAABBBounds,l={content:t.tooltip.title,referencePosition:{rect:{left:r,right:o,top:s,bottom:a,width:t.globalAABBBounds.width(),height:t.globalAABBBounds.height()},placement:t.tooltip.placement},style:Object.assign({},n.table.internalProps.theme?.tooltipStyle,t.tooltip?.style)};n.table.internalProps.tooltipHandler.isBinded(l)||n.table.showTooltip(e,i,l)}}(t,e,i,0,this)}updateSortIcon(t,e,i,r,n,o,s){ZT(t,e,i,r,n,o,s,this)}updateFrozenIcon(t,e){!function(t){for(let e=0;e<t.table.colCount;e++)for(let i=0;i<t.table.columnHeaderLevelCount;i++)QT(e,i,(t=>"frozen"===t.attribute.funcType),(r=>{const n=t.table.internalProps.headerHelper.getFrozenIcon(e,i);fA(n,r),r.name=n.name}),t)}(this)}updateHierarchyIcon(t,e){!function(t,e,i){let r;r=i.table.isHeader(t,e)?i.table.internalProps.headerHelper.getHierarchyIcon(t,e):i.table.internalProps.bodyHelper.getHierarchyIcon(t,e),QT(t,e,(t=>t.attribute.funcType===tC.collapse||t.attribute.funcType===tC.expand),(t=>{fA(r,t),t.name=r.name}),i)}(t,e,this)}setIconNormalStyle(t,e,i){!function(t,e,i,r){(t.attribute.backgroundColor||t.attribute.hoverImage)&&QT(e,i,(e=>e.name===t.name),(t=>{const e=t.parent.getChildByName("icon-back");e&&e.setAttribute("visible",!1),t.attribute.hoverImage&&t.attribute.image!==t.attribute.originImage&&(t.image=t.attribute.originImage)}),r)}(t,e,i,this)}residentHoverIcon(t,e){!function(t,e,i){QT(t,e,(t=>t.attribute.funcType===tC.dropDown),(t=>{t.oldVisibleTime=t.attribute.visibleTime,t.setAttribute("visibleTime","always"),t.setAttribute("opacity",1)}),i)}(t,e,this)}resetResidentHoverIcon(t,e){!function(t,e,i){QT(t,e,(t=>t.attribute.funcType===tC.dropDown),(t=>{t.oldVisibleTime&&t.setAttribute("visibleTime",t.oldVisibleTime),t.setAttribute("opacity","always"===t.attribute.visibleTime?1:0)}),i)}(t,e,this)}deactivateChart(t,e){if(-1===t||-1===e)return;const i=this.getCell(t,e);i?.firstChild?.deactivate?.()}activateChart(t,e){if(-1===t||-1===e)return;const i=this.getCell(t,e);i?.firstChild?.activate?.(this.table)}removeInteractionBorder(t,e){const i=this.getCell(t,e);i.setAttribute("highlightStroke",void 0),i.setAttribute("highlightStrokeArrayWidth",void 0),i.setAttribute("highlightStrokeArrayColor",void 0)}createCellSelectBorder(t,e,i,r,n,o,s){!function(t,e,i,r,n,o,s,a){const l=Math.min(e,r),h=Math.min(i,n),c=Math.max(e,r),d=Math.max(i,n),u=t.highPerformanceGetCell(l,h).globalAABBBounds,g=t.table.theme,p=g.selectionStyle?.cellBorderColor,f=g.selectionStyle?.cellBorderLineWidth,m=fl({pickable:!1,fill:g.selectionStyle?.cellBgColor??"rgba(0, 0, 255,0.1)",lineWidth:f,stroke:a.map((t=>!!t&&p)),x:u.x1-t.tableGroup.attribute.x,y:u.y1-t.tableGroup.attribute.y,width:0,height:0,visible:!0});t.lastSelectId=s,t.selectingRangeComponents.set(`${l}-${h}-${c}-${d}-${s}`,{rect:m,role:o}),t.tableGroup.insertAfter(m,"body"===o?t.bodyGroup:"columnHeader"===o?t.colHeaderGroup:"rowHeader"===o?t.rowHeaderGroup:"cornerHeader"===o?t.cornerHeaderGroup:"rightTopCorner"===o?t.rightTopCornerGroup:"rightFrozen"===o?t.rightFrozenGroup:"leftBottomCorner"===o?t.leftBottomCornerGroup:"bottomFrozen"===o?t.bottomFrozenGroup:t.rightBottomCornerGroup)}(this,t,e,i,r,n,o,s)}moveSelectingRangeComponentsToSelectedRangeComponents(){_T(this)}deleteLastSelectedRangeComponents(){var t;(t=this).selectedRangeComponents.forEach(((e,i)=>{i.split("-")[4]===t.lastSelectId&&(e.rect.delete(),t.selectedRangeComponents.delete(i))}))}deleteAllSelectBorder(){ST(this)}updateCellSelectBorder(t,e,i,r){xT(this,t,e,i,r)}recreateAllSelectRangeComponents(){ST(this),this.table.stateManager.select.ranges.forEach((t=>{xT(this,t.start.col,t.start.row,t.end.col,t.end.row)})),_T(this)}updateColWidth(t,e,i,r){!function(t,e,i,r){r||t.table._setColWidth(e,t.table.getColWidth(e)+i,!0);const n="autoHeight"===t.table.heightMode,o=t.getColGroup(e,!0),s=t.getColGroupInRightTopCorner(e);o&&!s&&sB(o,i,n,"col-corner",t),s&&sB(s,i,n,"right-top",t);const a=t.getColGroup(e);a&&sB(a,i,n,"row-body",t);const l=t.getColGroupInLeftBottomCorner(e);l&&sB(l,i,n,"left-bottom",t);const h=t.getColGroupInBottom(e);h&&sB(h,i,n,"bottom",t);const c=t.getColGroupInRightBottomCorner(e);c&&sB(c,i,n,"right-bottom",t),e<t.frozenColCount?(t.cornerHeaderGroup.forEachChildrenSkipChild(((t,r)=>{t.col>e&&t.setAttribute("x",t.attribute.x+i)})),t.rowHeaderGroup.forEachChildrenSkipChild(((t,r)=>{t.col>e&&t.setAttribute("x",t.attribute.x+i)}))):(t.colHeaderGroup.forEachChildrenSkipChild(((t,r)=>{t.col>e&&t.setAttribute("x",t.attribute.x+i)})),t.bodyGroup.forEachChildrenSkipChild(((t,r)=>{t.col>e&&t.setAttribute("x",t.attribute.x+i)}))),l&&t.leftBottomCornerGroup.forEachChildrenSkipChild(((t,r)=>{t.col>e&&t.setAttribute("x",t.attribute.x+i)})),h&&t.bottomFrozenGroup.forEachChildrenSkipChild(((t,r)=>{t.col>e&&t.setAttribute("x",t.attribute.x+i)})),c&&t.rightBottomCornerGroup.forEachChildrenSkipChild(((t,r)=>{t.col>e&&t.setAttribute("x",t.attribute.x+i)}))}(this,t,Math.round(e),r),i||this.updateContainer()}updateChartSize(t){!function(t,e){for(let i=e;i<=t.proxy.colEnd;i++){const e=t.getColGroup(i);e?.getChildren()?.forEach((e=>{const i=t.table.getColWidth(e.col),r=t.table.getRowHeight(e.row);e.children.forEach((t=>{"chart"===t.type&&(t.cacheCanvas=null,t.setAttribute("width",Math.ceil(i-t.attribute.cellPadding[3]-t.attribute.cellPadding[1])),t.setAttribute("height",Math.ceil(r-t.attribute.cellPadding[0]-t.attribute.cellPadding[2])))}))}))}}(this,t)}updateChartState(t){this.table.isPivotChart()&&function(t,e){const i=t.table;if(i.isPivotChart()){const r=i._selectedDataItemsInChart.length;if((null===e||0===e?.length||0===Object.keys(e).length)&&0===r)return;const n=[];if(Array.isArray(e))e.forEach((t=>{if(t&&0!==t.key&&Object.keys(t).length>0){const e={};for(const i in t)i.startsWith("VGRAMMAR_")||i.startsWith("__VCHART")||(e[i]=t[i]);n.push(e)}}));else if(e&&0!==e.key&&Object.keys(e).length>0){const t={};for(const i in e)i.startsWith("VGRAMMAR_")||i.startsWith("__VCHART")||(t[i]=e[i]);n.push(t)}St(i._selectedDataItemsInChart,n)||(i._selectedDataItemsInChart=n,i.internalProps.layoutMap.updateDataStateToChartInstance(),NT(t),i.scenegraph.updateNextFrame())}}(this,t)}updateCheckboxCellState(t,e,i){if(this.transpose)this.bodyGroup.children?.forEach((t=>{t.getChildAt(e).getChildren().forEach((t=>{"checkbox"===t.name&&t.setAttribute("checked",i)}))}));else{const e=this.getColGroup(t);e.children?.forEach((t=>{t.getChildren().find((t=>{"checkbox"===t.name&&t.setAttribute("checked",i)}))}))}}updateHeaderCheckboxCellState(t,e,i){if(this.transpose)this.rowHeaderGroup.children?.forEach((t=>{t.getChildAt(e).getChildren().forEach((t=>{"checkbox"===t.name&&("indeterminate"===i?(t.setAttribute("indeterminate",!0),t.setAttribute("checked",void 0)):(t.setAttribute("indeterminate",void 0),t.setAttribute("checked",i)))}))}));else{const e=this.getColGroup(t,!0);e.children?.forEach((t=>{t.getChildren().find((t=>{"checkbox"===t.name&&("indeterminate"===i?(t.setAttribute("indeterminate",!0),t.setAttribute("checked",void 0)):(t.setAttribute("indeterminate",void 0),t.setAttribute("checked",i)))}))}))}}updateAutoColWidth(t){this.table.internalProps._widthResizedColMap.delete(t);const e=this.table.getColWidth(t),i=qB(t,0,this.table.rowCount-1,this.table,!0);i!==e&&this.updateColWidth(t,i-e)}recalculateColWidths(){YB(this.table,0,this.table.colCount-1,!0)}recalculateRowHeights(){ZA(this.table,0,this.table.rowCount-1,!0,!0)}resize(){this.proxy.resize(),("adaptive"===this.table.widthMode||this.table.autoFillWidth)&&(0===this.table.internalProps._widthResizedColMap.size?this.recalculateColWidths():this.dealWidthMode()),"adaptive"===this.table.heightMode?this.recalculateRowHeights():this.table.autoFillHeight&&this.dealHeightMode(),this.resetFrozen(),this.updateTableSize(),this.updateBorderSizeAndPosition(),this.component.updateScrollBar(),("adaptive"===this.table.widthMode||"adaptive"===this.table.heightMode||this.table.autoFillWidth||this.table.autoFillHeight)&&this.updateChartSize(this.table.rowHeaderLevelCount),this.proxy.progress(),this.updateNextFrame()}updateTableSize(){this.tableGroup.setAttributes({x:this.table.tableX,y:this.table.tableY,width:Math.min(this.table.tableNoFrameWidth,Math.max(this.colHeaderGroup.attribute.width,this.bodyGroup.attribute.width,0)+Math.max(this.cornerHeaderGroup.attribute.width,this.rowHeaderGroup.attribute.width,0)+this.rightBottomCornerGroup.attribute.width),height:Math.min(this.table.tableNoFrameHeight,Math.max(this.colHeaderGroup.attribute.height,this.cornerHeaderGroup.attribute.height,0)+Math.max(this.rowHeaderGroup.attribute.height,this.bodyGroup.attribute.height,0)+this.bottomFrozenGroup.attribute.height)}),this.tableGroup.border&&"rect"===this.tableGroup.border.type?this.tableGroup.border.setAttributes({x:this.table.tableX-this.tableGroup.border.attribute.lineWidth/2,y:this.table.tableY-this.tableGroup.border.attribute.lineWidth/2,width:this.tableGroup.attribute.width+this.tableGroup.border.attribute.lineWidth,height:this.tableGroup.attribute.height+this.tableGroup.border.attribute.lineWidth}):this.tableGroup.border&&"group"===this.tableGroup.border.type&&(this.tableGroup.border.setAttributes({x:this.table.tableX-this.tableGroup.border.attribute.lineWidth/2,y:this.table.tableY-this.tableGroup.border.attribute.lineWidth/2,width:this.tableGroup.attribute.width+this.tableGroup.border.attribute.lineWidth,height:this.tableGroup.attribute.height+this.tableGroup.border.attribute.lineWidth}),this.tableGroup.border.firstChild?.setAttributes({x:this.tableGroup.border.attribute.lineWidth/2,y:this.tableGroup.border.attribute.lineWidth/2,width:this.tableGroup.attribute.width,height:this.tableGroup.attribute.height})),this.table.bottomFrozenRowCount>0&&(this.bottomFrozenGroup.setAttribute("y",this.tableGroup.attribute.height-this.bottomFrozenGroup.attribute.height),this.leftBottomCornerGroup.setAttributes({visible:!0,y:this.tableGroup.attribute.height-this.bottomFrozenGroup.attribute.height,height:this.bottomFrozenGroup.attribute.height,width:this.table.getFrozenColsWidth()}),this.rightBottomCornerGroup.setAttributes({visible:!0,y:this.tableGroup.attribute.height-this.bottomFrozenGroup.attribute.height,height:this.bottomFrozenGroup.attribute.height})),this.table.rightFrozenColCount>0&&(this.rightFrozenGroup.setAttribute("x",this.tableGroup.attribute.width-this.table.getRightFrozenColsWidth()),this.rightTopCornerGroup.setAttributes({visible:!0,x:this.tableGroup.attribute.width-this.table.getRightFrozenColsWidth(),width:this.table.getRightFrozenColsWidth(),height:this.table.getFrozenRowsHeight()}),this.rightBottomCornerGroup.setAttributes({visible:!0,x:this.tableGroup.attribute.width-this.table.getRightFrozenColsWidth(),width:this.table.getRightFrozenColsWidth()}))}updateRowHeight(t,e,i){nB(this,t,e=Math.round(e),i),this.updateContainerHeight(t,e)}updateRowsHeight(t,e,i){for(let r=0;r<t.length;r++){const n=t[r],o=e[r];nB(this,n,Math.round(o),i),this._updateContainerHeight(n,o)}this.updateTableSize(),this.component.updateScrollBar(),this.updateNextFrame()}updateContainerWidth(t,e){t<this.frozenColCount?(this.rowHeaderGroup.setDeltaWidth(e),this.cornerHeaderGroup.setDeltaWidth(e),this.colHeaderGroup.setDeltaX(e),this.bodyGroup.setDeltaX(e)):(this.colHeaderGroup.setDeltaWidth(e),this.bodyGroup.setDeltaWidth(e)),this.updateTableSize(),this.component.updateScrollBar(),this.updateNextFrame()}_updateContainerHeight(t,e){t<this.table.frozenRowCount?(this.colHeaderGroup.setDeltaHeight(e),this.cornerHeaderGroup.setDeltaHeight(e),this.rowHeaderGroup.setDeltaY(e),this.bodyGroup.setDeltaY(e),this.rightFrozenGroup.setDeltaY(e)):t>=this.table.rowCount-this.table.bottomFrozenRowCount?(this.leftBottomCornerGroup.setDeltaHeight(e),this.bottomFrozenGroup.setDeltaHeight(e),this.rightBottomCornerGroup.setDeltaHeight(e)):(this.rowHeaderGroup.setDeltaHeight(e),this.bodyGroup.setDeltaHeight(e),this.rightFrozenGroup.setDeltaHeight(e))}updateContainerHeight(t,e){this._updateContainerHeight(t,e),this.updateTableSize(),this.component.updateScrollBar(),this.updateNextFrame()}setColWidth(t,e){const i=this.table.getColWidth(t);i!==e&&(this.updateColWidth(t,e-i),this.table._clearColRangeWidthsMap(t))}setRowHeight(t,e){const i=this.table.getRowHeight(t);i!==e&&(this.updateRowHeight(t,e-i),this.table._clearRowRangeHeightsMap(t))}setX(t){this.table.scenegraph.proxy.setX(-t)}setY(t){this.table.scenegraph.proxy.setY(-t)}setBodyAndRowHeaderY(t){this.colHeaderGroup.attribute.height+t!==this.bodyGroup.attribute.y&&(this.bodyGroup.setAttribute("y",this.colHeaderGroup.attribute.height+t),this.rowHeaderGroup.setAttribute("y",this.colHeaderGroup.attribute.height+t),this.table.rightFrozenColCount>0&&this.rightFrozenGroup.setAttribute("y",this.colHeaderGroup.attribute.height+t),this.updateNextFrame())}setBodyAndColHeaderX(t){this.table.getFrozenColsWidth()+t!==this.bodyGroup.attribute.x&&(this.bodyGroup.setAttribute("x",this.table.getFrozenColsWidth()+t),this.colHeaderGroup.setAttribute("x",this.table.getFrozenColsWidth()+t),this.table.bottomFrozenRowCount>0&&this.bottomFrozenGroup.setAttribute("x",this.table.getFrozenColsWidth()+t),this.updateNextFrame())}afterScenegraphCreated(){this.isPivot||this.transpose||this.component.setFrozenColumnShadow(this.table.frozenColCount-1),this.table.stateManager.checkFrozen(),this.updateContainer(),this.createFrameBorder(),this.updateBorderSizeAndPosition(),this.component.updateScrollBar(),MT(this.table),this.updateNextFrame()}dealWidthMode(){const t=this.table;if("adaptive"===t.widthMode){t._clearColRangeWidthsMap();const e=t.tableNoFrameWidth;let i=0;for(let e=0;e<t.colCount;e++)if(e<t.rowHeaderLevelCount||t.isPivotChart()&&e>=t.colCount-t.rightFrozenColCount){i+=t.getColWidth(e)}eT(e-i,t.rowHeaderLevelCount,t.isPivotChart()?t.colCount-t.rightFrozenColCount:t.colCount,!1,[],t,!0)}else if(t.autoFillWidth){t._clearColRangeWidthsMap();const e=t.tableNoFrameWidth;let i=0,r=0;for(let e=0;e<t.colCount;e++){const n=t.getColWidth(e);(e<t.rowHeaderLevelCount||t.isPivotChart()&&e>=t.colCount-t.rightFrozenColCount)&&(i+=n),r+=n}if(r<e&&r>i){eT(e-i,t.rowHeaderLevelCount,t.isPivotChart()?t.colCount-t.rightFrozenColCount:t.colCount,!1,[],t,!0)}}let e=0;this.bodyGroup.forEachChildrenSkipChild((t=>{e+=t.attribute.width})),this.bodyGroup.setAttribute("width",e);let i=0;this.colHeaderGroup.forEachChildrenSkipChild((t=>{i+=t.attribute.width})),this.colHeaderGroup.setAttribute("width",i);let r=0;this.rowHeaderGroup.forEachChildrenSkipChild((t=>{r+=t.attribute.width})),this.rowHeaderGroup.setAttribute("width",r);let n=0;this.cornerHeaderGroup.forEachChildrenSkipChild((t=>{n+=t.attribute.width})),this.cornerHeaderGroup.setAttribute("width",n),this.colHeaderGroup.setAttribute("x",this.cornerHeaderGroup.attribute.width),this.rowHeaderGroup.setAttribute("y",this.colHeaderGroup.attribute.height),this.bodyGroup.setAttributes({x:this.rowHeaderGroup.attribute.width,y:this.colHeaderGroup.attribute.height})}dealHeightMode(){const t=this.table;if("adaptive"===t.heightMode){t._clearRowRangeHeightsMap();const e=t.getRowsHeight(0,t.columnHeaderLevelCount-1),i=t.isPivotChart()?t.getBottomFrozenRowsHeight():0,r=t.tableNoFrameHeight-e-i,n=t.columnHeaderLevelCount,o=t.isPivotChart()?t.rowCount-t.bottomFrozenRowCount:t.rowCount;let s=0;for(let e=n;e<o;e++)s+=t.getRowHeight(e);const a=r/s;for(let e=n;e<o;e++){let i;i=e===o-1?r-t.getRowsHeight(n,o-2):Math.round(t.getRowHeight(e)*a),this.setRowHeight(e,i)}}else if(t.autoFillHeight){t._clearRowRangeHeightsMap();const e=t.tableNoFrameHeight;let i=0,r=0;for(let e=0;e<t.rowCount;e++){const n=t.getRowHeight(e);(e<t.columnHeaderLevelCount||t.isPivotChart()&&e>=t.rowCount-t.bottomFrozenRowCount)&&(r+=n),i+=n}if((this._dealAutoFillHeightOriginRowsHeight??i)<e&&i-r>0){const n=t.columnHeaderLevelCount,o=t.isPivotChart()?t.rowCount-t.bottomFrozenRowCount:t.rowCount,s=(e-r)/(i-r);for(let i=n;i<o;i++){let a;a=i===o-1?e-r-t.getRowsHeight(n,o-2):Math.round(t.getRowHeight(i)*s),this.setRowHeight(i,a)}}}}dealFrozen(){!function(t){if(t.table.frozenColCount>t.table.rowHeaderLevelCount){t.rowHeaderGroup.setAttribute("height",t.bodyGroup.attribute.height),t.rowHeaderGroup.setAttribute("y",t.bodyGroup.attribute.y),t.cornerHeaderGroup.setAttribute("height",t.colHeaderGroup.attribute.height);for(let e=0;e<t.table.frozenColCount-t.table.rowHeaderLevelCount;e++)kT(t),IT(t),OT(t)}else if(t.table.frozenColCount<t.table.rowHeaderLevelCount)for(let e=0;e<t.table.rowHeaderLevelCount-t.table.frozenColCount;e++)FT(t),zT(t),DT(t);t.bodyGroup.setAttribute("x",t.rowHeaderGroup.attribute.width),t.colHeaderGroup.setAttribute("x",t.cornerHeaderGroup.attribute.width),t.updateContainer(),t.updateBorderSizeAndPosition(),t.isPivot||t.transpose||t.component.setFrozenColumnShadow(t.table.frozenColCount-1),t.hasFrozen=!0,t.frozenColCount=t.table.frozenColCount,t.frozenRowCount=t.colHeaderGroup.firstChild?.childrenCount??0}(this)}resetFrozen(){!function(t){if(t.frozenColCount>t.table.frozenColCount)for(let e=0;e<t.frozenColCount-t.table.frozenColCount;e++)FT(t),zT(t),DT(t);else if(t.frozenColCount<t.table.frozenColCount){t.rowHeaderGroup.setAttribute("height",t.bodyGroup.attribute.height),t.rowHeaderGroup.setAttribute("y",t.bodyGroup.attribute.y),t.cornerHeaderGroup.setAttribute("height",t.colHeaderGroup.attribute.height);for(let e=0;e<t.table.frozenColCount-t.frozenColCount;e++)kT(t),IT(t),OT(t)}t.deleteAllSelectBorder(),t.table.stateManager.select.ranges.forEach((e=>{t.updateCellSelectBorder(e.start.col,e.start.row,e.end.col,e.end.row)})),t.frozenColCount=t.table.frozenColCount,t.frozenRowCount=t.colHeaderGroup.firstChild?.childrenCount??0,t.proxy.colStart=t.table.frozenColCount,t.bodyGroup.setAttribute("x",t.rowHeaderGroup.attribute.width),t.colHeaderGroup.setAttribute("x",t.cornerHeaderGroup.attribute.width),t.updateContainer(),t.updateBorderSizeAndPosition(),t.isPivot||t.transpose||t.component.setFrozenColumnShadow(t.table.frozenColCount-1),t.hasFrozen=!0}(this)}updateCellLayoutWidthCertainWidth(t,e,i){const r=t.attribute.width;let n=!1;return t.forEachChildren(((t,o)=>{o+=e;const s=Nv(this.table,i,o);s?t=this.getCell(s.start.col,s.start.row):t.setAttribute("width",r);const a=eS(QS("padding",this.table._getCellStyle(i,o),i,o,this.table)),l=t.getChildByName("text");let h=0,c=0;if(l)h=l.AABBBounds.height()+(a[0]+a[2]),l.setAttribute("maxLineWidth",r-(a[1]+a[3])),c=l.AABBBounds.height()+(a[0]+a[2]);else{const e=t.getChildAt(1);h=e.AABBBounds.height()+(a[0]+a[2]),e._cellWidth=r-(a[1]+a[3]),e.layout(),c=e.AABBBounds.height()+(a[0]+a[2])}const d=this.table.getRowHeight(o);t.attribute.height!==c&&(t.setAttribute("height",c),(d===h||c>d)&&(n=!0))})),n}updateHeaderPosition(t,e,i,r){!function(t,e,i,r,n){const o=n.scenegraph,s=n.getCellLocation(i,r),a="columnHeader"===s?"column":"rowHeader"===s?"row":void 0;let l=0,h=0,c=0,d=0,u=0,g=0,p=0,f=0;if("column"===a){const o=Nv(n,t,e),s=Nv(n,i,r);o&&s?(l=o.start.col,c=o.end.col,u=s.start.col,p=s.end.col,h=o.start.row,g=s.start.row):(l=t,c=t,u=i,p=i,h=e,g=r),d=n.rowCount-1,f=n.rowCount-1}else if("row"===a){const o=Nv(n,t,e),s=Nv(n,i,r);o&&s?(h=o.start.row,d=o.end.row,g=s.start.row,f=s.end.row,l=o.start.col,u=s.start.col):(h=e,d=e,g=r,f=r,l=t,u=i),c=n.colCount-1,p=n.colCount-1}const m=Math.min(l,u),b=Math.max(c,p),y=Math.min(h,g),C=Math.max(d,f);for(let t=m;t<=b;t++){const e=n.getColWidth(t),i=n.scenegraph.getColGroup(t,!0),r=n.scenegraph.getColGroup(t),o=n.scenegraph.getColGroupInBottom(t);i&&(i.setAttribute("width",e),i.forEachChildren((t=>{t.setAttribute("width",e)}))),r&&(r.setAttribute("width",e),r.forEachChildren((t=>{t.setAttribute("width",e)}))),o&&(o.setAttribute("width",e),o.forEachChildren((t=>{t.setAttribute("width",e)})))}if(o.updateContainer(),"column"===a)for(let t=m;t<=b;t++){const e=n.scenegraph.getColGroup(t);e?.setAttribute("chartInstance",void 0);for(let e=0;e<=n.frozenRowCount-1;e++)o.updateCellContent(t,e);for(let e=o.bodyRowStart;e<=o.bodyRowEnd;e++)o.updateCellContent(t,e);for(let e=n.rowCount-n.bottomFrozenRowCount;e<=n.rowCount-1;e++)o.updateCellContent(t,e)}else{for(let t=0;t<=n.frozenColCount-1;t++){const e=n.scenegraph.getColGroup(t);e?.setAttribute("chartInstance",void 0);for(let e=y;e<=C;e++)o.updateCellContent(t,e)}for(let t=o.bodyColStart;t<=o.bodyColEnd;t++){const e=n.scenegraph.getColGroup(t);e?.setAttribute("chartInstance",void 0);for(let e=y;e<=C;e++)o.updateCellContent(t,e)}for(let t=n.colCount-n.rightFrozenColCount;t<=n.colCount-1;t++){const e=n.scenegraph.getColGroup(t);e?.setAttribute("chartInstance",void 0);for(let e=y;e<=C;e++)o.updateCellContent(t,e)}}}(t,e,i,r,this.table)}updateContainerAttrWidthAndX(){const t=UT(this.cornerHeaderGroup,0),e=UT(this.rowHeaderGroup,0),i=this.colHeaderGroup.hasChildNodes()&&this.colHeaderGroup.firstChild?UT(this.colHeaderGroup,this.colHeaderGroup.firstChild.col>0?this.table.getColsWidth(this.table.frozenColCount??0,this.colHeaderGroup.firstChild.col-1):0):0,r=this.bodyGroup.hasChildNodes()&&this.bodyGroup.firstChild?UT(this.bodyGroup,this.bodyGroup.firstChild.col>0?this.table.getColsWidth(this.table.frozenColCount??0,this.bodyGroup.firstChild.col-1):0):0,n=UT(this.rightFrozenGroup,0);this.bottomFrozenGroup.hasChildNodes()&&this.bottomFrozenGroup.firstChild&&UT(this.bottomFrozenGroup,this.bottomFrozenGroup.firstChild.col>0?this.table.getColsWidth(this.table.frozenColCount??0,this.bottomFrozenGroup.firstChild.col-1):0),UT(this.leftBottomCornerGroup,0),UT(this.rightTopCornerGroup,0),UT(this.rightBottomCornerGroup,0),this.cornerHeaderGroup.setDeltaWidth(t-this.cornerHeaderGroup.attribute.width),this.leftBottomCornerGroup.setDeltaWidth(t-this.leftBottomCornerGroup.attribute.width),this.colHeaderGroup.setDeltaWidth(i-this.colHeaderGroup.attribute.width),this.rowHeaderGroup.setDeltaWidth(e-this.rowHeaderGroup.attribute.width),this.bottomFrozenGroup.setDeltaWidth(e-this.bottomFrozenGroup.attribute.width),this.rightFrozenGroup.setDeltaWidth(n-this.table.getRightFrozenColsWidth()),this.rightTopCornerGroup.setDeltaWidth(n-this.rightTopCornerGroup.attribute.width),this.rightBottomCornerGroup.setDeltaWidth(n-this.rightBottomCornerGroup.attribute.width),this.bodyGroup.setDeltaWidth(r-this.bodyGroup.attribute.width),this.colHeaderGroup.setAttribute("x",this.cornerHeaderGroup.attribute.width),this.bottomFrozenGroup.setAttribute("x",this.table.getFrozenColsWidth()),this.bodyGroup.setAttribute("x",this.rowHeaderGroup.attribute.width)}updateContainer(){this.updateContainerAttrWidthAndX(),this.updateTableSize();const t=this.table.stateManager.scroll.horizontalBarPos,e=this.table.stateManager.scroll.verticalBarPos;this.component.updateScrollBar(),this.table.stateManager.setScrollLeft(t),this.table.stateManager.setScrollTop(e),this.updateNextFrame()}updateCellContentWhileResize(t,e){const i=this.table.getBodyColumnType(t,e),r=this.getCell(t,e);"image"!==i&&"video"!==i||iA(r,t,e,this.table)}createFrameBorder(){this.updateTableSize();const t=!this.isPivot;fB(this.bodyGroup,this.table.theme.bodyStyle.frameStyle,this.bodyGroup.role,t?[!0,!0,!0,!1]:void 0),fB(this.rowHeaderGroup,this.isPivot?this.table.theme.rowHeaderStyle.frameStyle:this.table.theme.bodyStyle.frameStyle,this.rowHeaderGroup.role,t?[!0,!1,!0,!0]:void 0),fB(this.colHeaderGroup,this.table.theme.headerStyle.frameStyle,this.colHeaderGroup.role,t?[!0,!0,!0,!1]:void 0),fB(this.cornerHeaderGroup,this.isPivot?this.table.theme.cornerHeaderStyle.frameStyle:this.table.theme.headerStyle.frameStyle,this.cornerHeaderGroup.role,t?[!0,!1,!0,!0]:void 0),fB(this.tableGroup,this.table.theme.frameStyle,this.tableGroup.role,void 0)}getResizeColAt(t,e,i,r=8){if(i){let e;if(t<i.globalAABBBounds.x1+r?e={col:i.col-1,row:i.row,x:i.globalAABBBounds.x1}:i.globalAABBBounds.x2-r<t&&(e={col:i.col,row:i.row,x:i.globalAABBBounds.x2}),e&&this.table.rightFrozenColCount>0&&e.col===this.table.colCount-this.table.rightFrozenColCount-1&&this.table.tableNoFrameWidth-this.table.getFrozenColsWidth()-this.table.getRightFrozenColsWidth()+this.table.scrollLeft<this.bodyGroup.attribute.width&&(e.col=e.col+1,e.rightFrozen=!0),e)return e}else;return{col:-1,row:-1}}updateFrozen(){this.clear||(this.resetFrozen(),this.component.updateScrollBar())}dealWidthRightFrozen(t){this.clear?this.table.internalProps.rightFrozenColCount=t:function(t,e){const{table:i,proxy:r,rightTopCornerGroup:n,rightFrozenGroup:o,rightBottomCornerGroup:s,bottomFrozenGroup:a,bodyGroup:l,colHeaderGroup:h}=e,c=e.table.rightFrozenColCount;if(t>c){for(let r=i.colCount-c-1;r>=i.colCount-t;r--)WT(o,e.getColGroup(r),o.firstChild),WT(n,e.getColGroup(r,!0),n.firstChild),WT(s,e.getColGroupInBottom(r),s.firstChild);let r=0;o.forEachChildren((t=>{t.setAttribute("x",r),r+=t.attribute.width})),r=0,n.forEachChildren((t=>{t.setAttribute("x",r),r+=t.attribute.width})),r=0,s.forEachChildren((t=>{t.setAttribute("x",r),r+=t.attribute.width}))}else if(t<c){for(let r=i.colCount-c;r<i.colCount-t;r++){const t=e.getColGroup(r);t.setAttribute("x",l.lastChild.attribute.x+i.getColWidth(l.lastChild.col)),l.appendChild(t);const n=e.getColGroupInRightTopCorner(r);n.setAttribute("x",h.lastChild.attribute.x+i.getColWidth(h.lastChild.col)),h.appendChild(n);const o=e.getColGroupInRightBottomCorner(r);o.setAttribute("x",a.lastChild.attribute.x+i.getColWidth(a.lastChild.col)),a.appendChild(o)}let r=0;o.forEachChildren((t=>{t.setAttribute("x",r),r+=t.attribute.width})),r=0,n.forEachChildren((t=>{t.setAttribute("x",r),r+=t.attribute.width})),r=0,s.forEachChildren((t=>{t.setAttribute("x",r),r+=t.attribute.width}))}o.setAttribute("width",i.getColsWidth(i.colCount-t,i.colCount-1)),n.setAttribute("width",i.getColsWidth(i.colCount-t,i.colCount-1)),s.setAttribute("width",i.getColsWidth(i.colCount-t,i.colCount-1)),i.internalProps.rightFrozenColCount=t,e.updateContainer(),e.component.updateScrollBar(),e.updateNextFrame()}(t,this)}dealWidthBottomFrozen(t){this.clear?this.table.internalProps.bottomFrozenRowCount=t:function(t,e){const{table:i,proxy:r,bottomFrozenGroup:n,leftBottomCornerGroup:o,rightBottomCornerGroup:s}=e;n.childrenCount||(r.table.isPivotChart()||(rT(o,0,0,0,i.frozenColCount-1,0,-1,"rowHeader",i),rT(s,0,0,i.colCount-i.rightFrozenColCount,i.colCount-1,0,-1,"body",i)),rT(n,0,0,r.colStart,r.colEnd,0,-1,"body",i));const a=e.table.bottomFrozenRowCount;if(t>a){for(let r=0;r<i.frozenColCount;r++){const n=e.getColGroupInLeftBottomCorner(r);for(let o=i.rowCount-a-1;o>=i.rowCount-t;o--)WT(n,e.getCell(r,o,!0),n.firstChild);let o=0;n.forEachChildren((t=>{t.setAttribute("y",o),o+=i.getRowHeight(t.row)}))}for(let n=r.colStart;n<=r.colEnd;n++){const r=e.getColGroupInBottom(n);for(let o=i.rowCount-a-1;o>=i.rowCount-t;o--)WT(r,e.getCell(n,o,!0),r.firstChild);let o=0;r.forEachChildren((t=>{t.setAttribute("y",o),o+=i.getRowHeight(t.row)}))}if(i.rightFrozenColCount>0)for(let r=i.colCount-i.rightFrozenColCount;r<i.colCount;r++){const n=e.getColGroupInRightBottomCorner(r);for(let o=i.rowCount-a-1;o>=i.rowCount-t;o--)WT(n,e.getCell(r,o,!0),n.firstChild);let o=0;n.forEachChildren((t=>{t.setAttribute("y",o),o+=i.getRowHeight(t.row)}))}}else if(t<a){for(let r=0;r<i.rowHeaderLevelCount;r++){const n=e.getColGroup(r);for(let o=i.rowCount-a;o<i.rowCount-t;o++){const t=e.getCell(r,o,!0);t.setAttribute("y",n.lastChild.attribute.y+i.getRowHeight(n.lastChild.row)),n.appendChild(t)}const o=e.getColGroupInLeftBottomCorner(r);let s=0;o.forEachChildren((t=>{t.setAttribute("y",s),s+=i.getRowHeight(t.row)}))}for(let n=r.colStart;n<=r.colEnd;n++){const r=e.getColGroup(n);for(let o=i.rowCount-a;o<i.rowCount-t;o++){const t=e.getCell(n,o,!0);t.setAttribute("y",r.lastChild.attribute.y+i.getRowHeight(r.lastChild.row)),r.appendChild(t)}const o=e.getColGroupInBottom(n);let s=0;o.forEachChildren((t=>{t.setAttribute("y",s),s+=i.getRowHeight(t.row)}))}if(i.rightFrozenColCount>0)for(let r=i.colCount-i.rightFrozenColCount;r<i.colCount;r++){const n=e.getColGroup(r);for(let o=i.rowCount-a;o<i.rowCount-t;o++){const t=e.getCell(r,o,!0);t.setAttribute("y",n.lastChild.attribute.y+i.getRowHeight(n.lastChild.row)),n.appendChild(t)}const o=e.getColGroupInRightBottomCorner(r);let s=0;o.forEachChildren((t=>{t.setAttribute("y",s),s+=i.getRowHeight(t.row)}))}}n.setAttribute("height",i.getRowsHeight(i.rowCount-t,i.rowCount-1)),o.setAttribute("height",i.getRowsHeight(i.rowCount-t,i.rowCount-1)),s.setAttribute("height",i.getRowsHeight(i.rowCount-t,i.rowCount-1)),i.internalProps.bottomFrozenRowCount=t,e.updateContainer(),e.component.updateScrollBar(),e.updateNextFrame()}(t,this)}updateBorderSizeAndPosition(){this.bodyGroup.border&&(this.bodyGroup.appendChild(this.bodyGroup.border),yB(this.bodyGroup),this.rowHeaderGroup.attribute.width,mB(this.bodyGroup,this.table.theme.bodyStyle.frameStyle)),this.colHeaderGroup.border&&(this.colHeaderGroup.appendChild(this.colHeaderGroup.border),yB(this.colHeaderGroup),this.cornerHeaderGroup.attribute.width,mB(this.colHeaderGroup,this.table.theme.headerStyle.frameStyle)),this.rowHeaderGroup.border&&(this.rowHeaderGroup.appendChild(this.rowHeaderGroup.border),yB(this.rowHeaderGroup)),this.cornerHeaderGroup.border&&(this.cornerHeaderGroup.appendChild(this.cornerHeaderGroup.border),yB(this.cornerHeaderGroup)),function(t){if(!t.theme.frameStyle.cornerRadius)return;const e=t.theme.frameStyle.cornerRadius,{cornerHeaderGroup:i,colHeaderGroup:r,rowHeaderGroup:n,bodyGroup:o,rightTopCornerGroup:s,leftBottomCornerGroup:a,rightBottomCornerGroup:l,rightFrozenGroup:h,bottomFrozenGroup:c}=t.scenegraph;i.setAttribute("cornerRadius",0),r.setAttribute("cornerRadius",0),n.setAttribute("cornerRadius",0),o.setAttribute("cornerRadius",0),s.setAttribute("cornerRadius",0),a.setAttribute("cornerRadius",0),l.setAttribute("cornerRadius",0),h.setAttribute("cornerRadius",0),c.setAttribute("cornerRadius",0),i.attribute.width>0&&i.attribute.height>0?CB(i,[e,0,0,0]):r.attribute.height>0?CB(r,[e,0,0,0]):n.attribute.width>0?CB(n,[e,0,0,0]):CB(o,[e,0,0,0]),a.attribute.width>0&&a.attribute.height>0?CB(a,[0,0,0,e]):c.attribute.height>0?CB(c,[0,0,0,e]):n.attribute.width>0?CB(n,[0,0,0,e]):CB(o,[0,0,0,e]),s.attribute.width>0&&s.attribute.height>0?CB(s,[0,e,0,0]):r.attribute.height>0?CB(r,[0,e,0,0]):h.attribute.width>0?CB(h,[0,e,0,0]):CB(o,[0,e,0,0]),l.attribute.width>0&&l.attribute.height>0?CB(l,[0,0,e,0]):h.attribute.width>0?CB(h,[0,0,e,0]):c.attribute.height>0?CB(c,[0,0,e,0]):CB(o,[0,0,e,0])}(this.table)}sortCell(){this.isPivot||(this.transpose?this.proxy.sortCellHorizontal():this.proxy.sortCellVertical())}getCellOverflowText(t,e){const i=this.getCell(t,e).getChildByName("text",!0);if(i&&"text"===i.type){const t=it(i.attribute.text)?i.attribute.text.join(""):i.attribute.text;let e="";if(et(i.cache.clipedText)?e=i.cache.clipedText:i.cache.layoutData?.lines?.forEach((t=>{e+=t.str})),e!==t)return t}else if(i&&"richtext"===i.type){const t=i;if(t.attribute.ellipsis&&t._frameCache&&t.attribute.height<t._frameCache.actualHeight){return t.attribute.textConfig.find((t=>t.text)).text}}return null}updateDrill(t,e,i,r,n){this.component.drillIcon.update(t,e,i,r,n,this)}updateCellContent(t,e){if(!this.clear)return SA(t,e,this.table)}setPixelRatio(t){this.stage.disableDirtyBounds(),this.stage.window.setDpr(t),this.stage.render(),this.stage.enableDirtyBounds()}updateRow(t,e,i=[]){AT(t,e,i,this.table),this.recalculateColWidths(),this.recalculateRowHeights(),this.table.stateManager.checkFrozen(),this.isPivot||this.transpose||this.component.setFrozenColumnShadow(this.table.frozenColCount-1),this.component.updateScrollBar(),this.updateNextFrame()}updateCol(t,e,i=[]){eM(t,e,i,this.table),this.recalculateColWidths(),this.recalculateRowHeights(),this.table.stateManager.checkFrozen(),this.isPivot||this.transpose||this.component.setFrozenColumnShadow(this.table.frozenColCount-1),this.component.updateScrollBar(),this.updateNextFrame()}getColumnGroupX(t){return t<this.table.rowHeaderLevelCount?this.table.getColsWidth(0,t-1):t<this.table.colCount-this.table.rightFrozenColCount?this.table.getColsWidth(this.table.rowHeaderLevelCount,t-1):t<this.table.colCount?this.table.getColsWidth(this.table.colCount-this.table.bottomFrozenRowCount,t-1):0}getCellGroupY(t){return t<this.table.columnHeaderLevelCount?this.table.getRowsHeight(0,t-1):t<this.table.rowCount-this.table.bottomFrozenRowCount?this.table.getRowsHeight(this.table.columnHeaderLevelCount,t-1):t<this.table.rowCount?this.table.getRowsHeight(this.table.rowCount-this.table.bottomFrozenRowCount,t-1):0}getCellGroupX(t){return t<this.table.rowHeaderLevelCount?this.table.getColsWidth(0,t-1):t<this.table.colCount-this.table.rightFrozenColCount?this.table.getColsWidth(this.table.rowHeaderLevelCount,t-1):t<this.table.colCount?this.table.getColsWidth(this.table.colCount-this.table.rightFrozenColCount,t-1):0}}function sM(t,e,i){const r=t.getCell(e,i);if(Y(r.mergeStartCol)&&Y(r.mergeStartRow)&&Y(r.mergeEndCol)&&Y(r.mergeEndRow))for(let e=r.mergeStartCol;e<=r.mergeEndCol;e++)for(let i=r.mergeStartRow;i<=r.mergeEndRow;i++){t.getCell(e,i).addUpdateBoundTag()}else r.addUpdateBoundTag()}function aM(t,e,i,r,n){const o=t.table;for(let i=0;i<o.columnHeaderLevelCount;i++)sM(t,e,i);const s=t.getColGroup(e);return s?.addUpdateBoundTag(),!0}function lM(t,e,i,r,n,o){const s=t.table;for(let i=0;i<s.columnHeaderLevelCount;i++)sM(t,e,i);const a=t.getColGroup(e);return a?.addUpdateBoundTag(),!0}function hM(t,e,i,r,n){const o=t.table;for(let e=0;e<o.colCount;e++)sM(t,e,i);return!0}function cM(t,e,i,r,n,o){const s=t.table;for(let e=0;e<s.colCount;e++)sM(t,e,i);return!0}function dM(t,e,i){const{table:r}=t,{scenegraph:n}=r,{highlightScope:o,singleStyle:s,disableHeader:a,cellPos:l,cellPosContainHeader:h}=t.hover,c=l.col,d=l.row;if(o===Xy.none||a&&(h.col!==e||h.row!==i)){const t=h.col,r=h.row;n.hideHoverIcon(t,r),n.showHoverIcon(e,i),h.col=e,h.row=i}if((a&&r.isHeader(e,i)||o===Xy.none)&&(e=-1,i=-1),c===e&&d===i)return;n.deactivateChart(c,d),n.activateChart(e,i);let u=!1;const{ranges:g,highlightScope:p}=t.select;if(-1!==c&&-1!==d&&(u=function(t,e,i,r,n,o,s){let a=!1;o===Xy.single?a=!!function(t,e,i,r,n){return sM(t,e,i),!0}(t,e,i)||a:o===Xy.row?a=!!hM(t,0,i)||a:o===Xy.column?a=!!aM(t,e)||a:o===Xy.cross&&(a=!!hM(t,0,i)||a,a=!!aM(t,e)||a);return a}(n,c,d,0,0,o),a||n.hideHoverIcon(c,d)),-1===e||-1===i)return l.col=-1,l.row=-1,void(!u||c===e&&d===i||t.table.scenegraph.updateNextFrame());o===Xy.single?u=!!function(t,e,i,r,n){return sM(t,e,i),!0}(n,e,i)||u:o===Xy.row?u=!!cM(n,0,i)||u:o===Xy.column?u=!!lM(n,e)||u:o===Xy.cross&&(u=!!cM(n,0,i)||u,u=!!lM(n,e)||u),o===Xy.none||a||n.showHoverIcon(e,i),l.col=e,l.row=i,u&&t.table.scenegraph.updateNextFrame()}function uM(t,e,i){let r,n=null,o=!1;if(Array.isArray(i.sortState))for(let s=0;s<i.sortState.length&&(r=i.sortState[s],r&&(n=i._getHeaderCellBySortState(r)),n&&(o=gM(t,e,n.col,n.row,i)),!o);s++);else r=i.sortState,r&&(n=i._getHeaderCellBySortState(r)),n&&(o=gM(t,e,n.col,n.row,i));const s=i.getHeaderDefine(t,e);r&&o&&s?.sort?r.order="asc"===r.order?"desc":"desc"===r.order?"normal":"asc":s?.sort?r={fieldKey:i.getHeaderFieldKey(t,e),field:i.getHeaderField(t,e),order:"asc"}:o&&s?.showSort||(r={fieldKey:i.getHeaderFieldKey(t,e),field:i.getHeaderField(t,e),order:"normal"});i.fireListeners(ov.SORT_CLICK,r).includes(!1)||(i.internalProps.sortState=r,i.stateManager.setSortState(r),s?.sort&&function(t,e,i){let r;r=t.fieldKey?e.internalProps.layoutMap.headerObjects.find((e=>e&&e.fieldKey===t.fieldKey)):e.internalProps.layoutMap.headerObjects.find((e=>e&&e.field===t.field));if(!r)return;const{field:n}=r;if(null===n)return;"function"==typeof i.sort?e.dataSource.sort(n,t.order||"asc",i.sort):e.dataSource.sort(n,t.order||"asc",kC)}(r,i,s),i.internalProps.layoutMap.clearCellRangeMap(),i.scenegraph.sortCell(),i.stateManager.updateSelectPos(-1,-1))}function gM(t,e,i,r,n){return n._getLayoutCellId(t,e)===n._getLayoutCellId(i,r)}const pM=VC(ov,{PIVOT_SORT_CLICK:"pivot_sort_click",DRILLMENU_CLICK:"drillmenu_click"}),fM=VC(ov,{VCHART_EVENT_TYPE:"vchart_event_type"});function mM(t){if("canMoveHeaderPosition"in t.table.internalProps.layoutMap&&t.columnMove.moving&&t.columnMove.colSource>=0&&t.columnMove.rowSource>=0&&t.columnMove.colTarget>=0&&t.columnMove.rowTarget>=0){t.table.moveHeaderPosition({col:t.columnMove.colSource,row:t.columnMove.rowSource},{col:t.columnMove.colTarget,row:t.columnMove.rowTarget})&&(!function(t,e,i,r,n){const o=Math.min(t,i),s=Math.max(t,i),a=Math.min(e,r),l=Math.max(e,r);for(let t=o;t<=s;t++)n._clearColRangeWidthsMap(t);for(let t=a;t<=l;t++)n._clearRowRangeHeightsMap(t)}(t.columnMove.colSource,t.columnMove.rowSource,t.columnMove.colTarget,t.columnMove.rowTarget,t.table),t.table.clearCellStyleCache(),t.table.scenegraph.updateHeaderPosition(t.columnMove.colSource,t.columnMove.rowSource,t.columnMove.colTarget,t.columnMove.rowTarget)),t.updateCursor()}setTimeout((()=>{t.columnMove.moving=!1,delete t.columnMove.colSource,delete t.columnMove.rowSource,delete t.columnMove.colTarget,delete t.columnMove.rowTarget}),0),t.table.scenegraph.component.hideMoveCol(),t.columnResize.col<t.table.frozenColCount&&!t.table.isPivotTable()&&!t.table.transpose&&t.table.scenegraph.component.setFrozenColumnShadow(t.table.frozenColCount-1,t.columnResize.isRightFrozen),t.table.scenegraph.updateNextFrame()}function bM(t){if(!t)return;const e=t.role?.startsWith("icon")?t:"richtext"===t.type?t._currentHoverIcon:void 0;return e?"richtext"===t.type?{icon:e,position:{left:t.globalAABBBounds.x1+e.globalAABBBounds.x1,right:t.globalAABBBounds.x1+e.globalAABBBounds.x2,top:t.globalAABBBounds.y1+e.globalAABBBounds.y1,bottom:t.globalAABBBounds.y1+e.globalAABBBounds.y2,width:e.globalAABBBounds.x2-e.globalAABBBounds.x1,height:e.globalAABBBounds.y2-e.globalAABBBounds.y1},type:"richtext-icon"}:{icon:e,position:{left:e.globalAABBBounds.x1,right:e.globalAABBBounds.x2,top:e.globalAABBBounds.y1,bottom:e.globalAABBBounds.y2,width:e.globalAABBBounds.x2-e.globalAABBBounds.x1,height:e.globalAABBBounds.y2-e.globalAABBBounds.y1},type:"icon"}:void 0}function yM(t,e){"adaptive"===e.table.widthMode&&e.columnResize.col<e.table.colCount-1?(e.table.scenegraph.updateColWidth(e.columnResize.col,t),e.table.scenegraph.updateColWidth(e.columnResize.col+1,-t),e.table.internalProps._widthResizedColMap.add(e.columnResize.col),e.table.internalProps._widthResizedColMap.add(e.columnResize.col+1)):(e.table.scenegraph.updateColWidth(e.columnResize.col,t),e.table.internalProps._widthResizedColMap.add(e.columnResize.col))}class CM{table;interactionState;select;hover;hoverIcon;residentHoverIcon;columnResize;columnMove;menu;sort;frozen;scroll;tablePosition;drill;sparkLine;_clearVerticalScrollBar;_clearHorizontalScrollBar;fastScrolling=!1;checkedState=[];headerCheckedState={};_checkboxCellTypeFields=[];_headerCheckFuncs={};resetInteractionState=av((()=>{this.updateInteractionState($y.default)}),100);constructor(t){this.table=t,this.initState(),this.updateVerticalScrollBar=this.updateVerticalScrollBar.bind(this),this.updateHorizontalScrollBar=this.updateHorizontalScrollBar.bind(this)}initState(){this._initState(),this.setHoverState(),this.setSelectState(),this.setFrozenState()}updateOptionSetState(){this._updateOptionSetState(),this.setHoverState(),this.setSelectState(),this.setFrozenState()}_updateOptionSetState(){this.interactionState=$y.default,this.hoverIcon={col:-1,row:-1,icon:null},this.columnResize={col:-1,x:0,resizing:!1},this.columnMove={colSource:-1,colTarget:-1,rowSource:-1,rowTarget:-1,x:0,y:0,moving:!1},this.menu={x:-1,y:-1,isShow:!1,itemList:[],bounds:new ue,highlightIndex:-1,dropDownMenuHighlight:[]},this.sort={col:-1,row:-1,order:"normal"},this.frozen={col:-1},this.tablePosition={absoluteX:0,absoluteY:0},this.drill={col:-1,row:-1},this.sparkLine={col:-1,row:-1}}_initState(){this.interactionState=$y.default,this.select={highlightScope:Xy.single,ranges:[],cellPos:{col:-1,row:-1},selecting:!1},this.hover={highlightScope:Xy.single,cellPos:{col:-1,row:-1}},this.hoverIcon={col:-1,row:-1,icon:null},this.columnResize={col:-1,x:0,resizing:!1},this.columnMove={colSource:-1,colTarget:-1,rowSource:-1,rowTarget:-1,x:0,y:0,moving:!1},this.menu={x:-1,y:-1,isShow:!1,itemList:[],bounds:new ue,highlightIndex:-1,dropDownMenuHighlight:[]},this.sort={col:-1,row:-1,order:"normal"},this.frozen={col:-1},this.scroll={horizontalBarPos:0,verticalBarPos:0},this.tablePosition={absoluteX:0,absoluteY:0},this.drill={col:-1,row:-1},this.sparkLine={col:-1,row:-1}}setHoverState(){const{highlightMode:t,disableHover:e,disableHeaderHover:i}=this.table.options.hover??{highlightMode:"cell"};e?this.hover.highlightScope=Xy.none:"cross"===t?this.hover.highlightScope=Xy.cross:"row"===t?this.hover.highlightScope=Xy.row:"column"===t?this.hover.highlightScope=Xy.column:"cell"===t&&(this.hover.highlightScope=Xy.single),this.hover.singleStyle=!e,this.hover.disableHeader=i,(this.hover.highlightScope===Xy.none||i)&&(this.hover.cellPosContainHeader={col:-1,row:-1})}setSelectState(){const{headerSelectMode:t,disableSelect:e,disableHeaderSelect:i}=Object.assign({},{headerSelectMode:"inline",disableSelect:!1,disableHeaderSelect:!1},this.table.options.select);this.select.highlightScope=e?Xy.none:Xy.single,this.select.singleStyle=!e,this.select.disableHeader=i,this.select.headerSelectMode=t}isSelected(t,e){let i=!1;return this.select.ranges.forEach((r=>{qC(r,t,e)&&(i=!0)})),i}setSortState(t){this.sort.field=t?.field,this.sort.fieldKey=t?.fieldKey,this.sort.order=t?.order}setFrozenState(){this.frozen.col=this.table.frozenColCount-1}updateInteractionState(t){if(this.interactionState===t)return;const e=this.interactionState;this.interactionState=t,e===$y.scrolling&&$y.default}updateHoverhighlightScope(t){this.hover.highlightScope!==t&&(this.hover.highlightScope=t)}updateHoverPos(t,e){dM(this,t,e)}updateSelectPos(t,e,i=!1,r=!1,n=!1){-1!==e&&-1!==e&&(this.select.selecting=!0),function(t,e,i,r,n,o){const{table:s,interactionState:a}=t,{scenegraph:l}=s,{highlightScope:h,disableHeader:c,cellPos:d}=t.select;if((c&&s.isHeader(e,i)||"none"===h)&&(e=-1,i=-1),-1!==e&&-1!==i)if(a===$y.grabing&&t.select.ranges.length>0){const r=t.select.ranges[t.select.ranges.length-1];e>r.start.col&&e>r.end.col&&s._makeVisibleCell(e+1,i),i>r.start.row&&i>r.end.row&&s._makeVisibleCell(e,i+1),e<r.start.col&&e<r.end.col&&s._makeVisibleCell(e-1,i),i<r.start.row&&i<r.end.row&&s._makeVisibleCell(e,i-1)}else s._makeVisibleCell(e,i);if(o){t.select.ranges=[],l.deleteAllSelectBorder(),t.select.ranges.push({start:{col:0,row:0},end:{col:s.colCount-1,row:s.rowCount-1}});const e=t.select.ranges[t.select.ranges.length-1];l.updateCellSelectBorder(e.start.col,e.start.row,e.end.col,e.end.row)}else if(-1===d.col||-1===d.row||-1!==e&&-1!==i)if(a!==$y.default||s.stateManager.isResizeCol()){if(a===$y.grabing&&!s.stateManager.isResizeCol()){-1===d.col&&(d.col=e),-1===d.row&&(d.row=i);const r=t.select.ranges[t.select.ranges.length-1];r&&(r.end={col:e,row:i}),d.col=e,d.row=i,r&&l.updateCellSelectBorder(r.start.col,r.start.row,e,i)}}else{const o=t.select.ranges[t.select.ranges.length-1];if(r&&o){if("cell"!==t.select.headerSelectMode&&s.isColumnHeader(e,i)){const t=Math.min(o.start.col,o.end.col,e),r=Math.max(o.start.col,o.end.col,e),n=Math.min(o.start.row,o.end.row,i),a=s.rowCount-1;o.start={col:t,row:n},o.end={col:r,row:a}}else if("cell"!==t.select.headerSelectMode&&s.isRowHeader(e,i)){const t=Math.min(o.start.col,o.end.col,e),r=s.colCount-1,n=Math.min(o.start.row,o.end.row,i),a=Math.max(o.start.row,o.end.row,i);o.start={col:t,row:n},o.end={col:r,row:a}}else o.end={col:e,row:i};l.deleteLastSelectedRangeComponents(),l.updateCellSelectBorder(o.start.col,o.start.row,o.end.col,o.end.row)}else{if(-1===d.col||-1===d.row||n||(t.select.ranges=[],l.deleteAllSelectBorder()),"cell"!==t.select.headerSelectMode&&s.isColumnHeader(e,i)){const r=s.getCellRange(e,i);t.select.ranges.push({start:{col:r.start.col,row:i},end:{col:r.end.col,row:s.rowCount-1}})}else if("cell"!==t.select.headerSelectMode&&s.isRowHeader(e,i)){const r=s.getCellRange(e,i);t.select.ranges.push({start:{col:e,row:r.start.row},end:{col:s.colCount-1,row:r.end.row}})}else e>=0&&i>=0&&t.select.ranges.push({start:{col:e,row:i},end:{col:e,row:i}});d.col=e,d.row=i;const r=t.select.ranges?.[t.select.ranges.length-1];r&&l.updateCellSelectBorder(r.start.col,r.start.row,r.end.col,r.end.row)}}else d.col=-1,d.row=-1,t.select.ranges=[],l.deleteAllSelectBorder();l.updateNextFrame()}(this,t,e,i,r,n)}checkCellRangeInSelect(t,e){return function(t,e,i,r){for(let r=0;r<i.length;r++)if(JC(i[r],{start:t,end:e}))return!0;return!1}(t,e,this.select.ranges,this.select.highlightScope)}updateHoverIcon(t,e,i,r,n){if(i===this.residentHoverIcon?.icon)return;const o=bM(i);if(o)if("richtext-icon"===o.type){const i=o.icon;if(this.hoverIcon.icon&&this.hoverIcon.icon!==this.residentHoverIcon?.icon&&(this.table.scenegraph.setIconNormalStyle(this.hoverIcon.icon,this.hoverIcon.col,this.hoverIcon.row),this.hoverIcon.col=-1,this.hoverIcon.col=-1,this.hoverIcon.icon=null,this.table.scenegraph.updateNextFrame()),i.attribute.tooltip){const r={content:i.attribute.tooltip.title,referencePosition:{rect:o.position,placement:i.attribute.tooltip.placement},style:Object.assign({},this.table.internalProps.theme?.tooltipStyle,i.tooltip?.style)};this.table.internalProps.tooltipHandler.isBinded(r)||this.table.showTooltip(t,e,r)}}else{const i=o.icon;i!==this.hoverIcon.icon&&(this.hoverIcon.icon&&this.hoverIcon.icon!==this.residentHoverIcon?.icon&&this.table.scenegraph.setIconNormalStyle(this.hoverIcon.icon,this.hoverIcon.col,this.hoverIcon.row),this.hoverIcon.col=t,this.hoverIcon.row=e,this.hoverIcon.icon=i,this.table.scenegraph.setIconHoverStyle(i,t,e,r),this.table.scenegraph.updateNextFrame())}else this.hoverIcon.icon&&this.hoverIcon.icon!==this.residentHoverIcon?.icon&&(this.table.scenegraph.setIconNormalStyle(this.hoverIcon.icon,this.hoverIcon.col,this.hoverIcon.row),this.hoverIcon.col=-1,this.hoverIcon.col=-1,this.hoverIcon.icon=null,this.table.scenegraph.updateNextFrame())}isResizeCol(){return this.columnResize.resizing}isSelecting(){return this.select.selecting}endSelectCells(t=!0){if(this.select.selecting=!1,0===this.select.ranges.length)return;this.table.scenegraph.moveSelectingRangeComponentsToSelectedRangeComponents();const e=this.select.ranges[this.select.ranges.length-1].end.col,i=this.select.ranges[this.select.ranges.length-1].end.row;t&&this.table.fireListeners(ov.SELECTED_CELL,{ranges:this.select.ranges,col:e,row:i})}endResizeCol(){setTimeout((()=>{this.columnResize.resizing=!1}),0),this.table.scenegraph.updateChartSize(this.columnResize.col),this.checkFrozen(),this.table.scenegraph.component.hideResizeCol(),this.table.scenegraph.updateNextFrame()}startResizeCol(t,e,i,r){this.columnResize.resizing=!0,this.columnResize.col=t,this.columnResize.x=e,this.columnResize.isRightFrozen=r,this.table.scenegraph.component.showResizeCol(t,i,r),this.table.stateManager.updateSelectPos(-1,-1),this.table.scenegraph.updateNextFrame()}updateResizeCol(t,e){!function(t,e,i){t=Math.ceil(t),e=Math.ceil(e);let r=i.columnResize.isRightFrozen?i.columnResize.x-t:t-i.columnResize.x;if(Math.abs(r)<1)return;const n=i.table.getColWidth(i.columnResize.col);let o=n;o+=r;const s=i.table.getMinColWidth(i.columnResize.col),a=i.table.getMaxColWidth(i.columnResize.col);if(o<s||o>a){if(n===s||n===a)return;r=n-s>a-n?a-n:s-n}let l=i.table.getColWidth(i.columnResize.col)+r;if(l<i.table.internalProps.limitMinWidth&&(l=i.table.internalProps.limitMinWidth,r=l-i.table.getColWidth(i.columnResize.col)),"adaptive"===i.table.widthMode&&i.columnResize.col<i.table.colCount-1){const t=i.table.getColWidth(i.columnResize.col+1),e=i.table.getMinColWidth(i.columnResize.col+1),n=i.table.getMaxColWidth(i.columnResize.col+1);let o=t;if(o-=r,o<e||o>n){if(t===e||t===n)return;r=t-e>n-t?n-t:e-t}o-r<i.table.internalProps.limitMinWidth&&(r=o-i.table.internalProps.limitMinWidth)}r=Math.ceil(r),i.columnResize.col<i.table.rowHeaderLevelCount||i.columnResize.col>=i.table.colCount-i.table.rightFrozenColCount?yM(r,i):"indicator"===i.table.internalProps.columnResizeType?function(t,e){const i=e.table.internalProps.layoutMap;let r,n,o;if(i.indicatorsAsCol)r=i.getIndicatorKey(e.columnResize.col,e.table.columnHeaderLevelCount);else{const t=i.getCellHeaderPaths(e.columnResize.col,e.table.columnHeaderLevelCount-1),r=t.colHeaderPaths[t.colHeaderPaths.length-1];n=r.dimensionKey,o=r.value}for(let s=e.table.rowHeaderLevelCount;s<e.table.colCount-e.table.rightFrozenColCount;s++){const a=i.getIndicatorKey(s,e.table.columnHeaderLevelCount);if(i.indicatorsAsCol&&a===r)e.table.scenegraph.updateColWidth(s,t),e.table.internalProps._widthResizedColMap.add(s);else if(!i.indicatorsAsCol){const r=i.getCellHeaderPaths(s,e.table.columnHeaderLevelCount-1),a=r?.colHeaderPaths[r.colHeaderPaths.length-1];a&&n===a.dimensionKey&&o===a.value&&(e.table.scenegraph.updateColWidth(s,t),e.table.internalProps._widthResizedColMap.add(s))}}}(r,i):"indicatorGroup"===i.table.internalProps.columnResizeType?function(t,e){const i=e.table.internalProps.layoutMap,r=i.getCellHeaderPaths(e.columnResize.col,e.table.columnHeaderLevelCount),n=i.getHeadNode(r.colHeaderPaths.slice(0,r.colHeaderPaths.length-1)),o=n.startInTotal+e.table.frozenColCount,s=n.startInTotal+e.table.frozenColCount+n.size-1,a=e.table.getColsWidth(o,s),l=t;for(let t=o;t<=s;t++){if(!(e.table.internalProps.transpose||e.table.isPivotTable()&&!i.indicatorsAsCol)){const r=i.getBody(t,e.table.columnHeaderLevelCount);if(r?.disableColumnResize)continue}const r=e.table.getColWidth(t);e.table.scenegraph.updateColWidth(t,r/a*l),e.table.internalProps._widthResizedColMap.add(t)}}(r,i):"all"===i.table.internalProps.columnResizeType?function(t,e){const i=e.table.internalProps.layoutMap;for(let r=e.table.frozenColCount;r<e.table.colCount-e.table.rightFrozenColCount;r++){if(!(e.table.internalProps.transpose||e.table.isPivotTable()&&!i.indicatorsAsCol)){const t=i.getBody(r,e.table.columnHeaderLevelCount);if(t?.disableColumnResize)continue}e.table.scenegraph.updateColWidth(r,t),e.table.internalProps._widthResizedColMap.add(r)}}(r,i):yM(r,i),i.columnResize.x=t,i.table.scenegraph.component.updateResizeCol(i.columnResize.col,e,i.columnResize.isRightFrozen),i.columnResize.col<i.table.frozenColCount&&!i.table.isPivotTable()&&!i.table.transpose&&i.table.scenegraph.component.setFrozenColumnShadow(i.table.frozenColCount-1,i.columnResize.isRightFrozen),i.table.scenegraph.updateNextFrame()}(t,e,this)}startMoveCol(t,e,i,r){!function(t,e,i,r,n){if(!("canMoveHeaderPosition"in n.table.internalProps.layoutMap))return;n.columnMove.moving=!0,n.columnMove.colSource=t,n.columnMove.rowSource=e,n.columnMove.x=i-n.table.tableX,n.columnMove.y=r-n.table.tableY;const o=n.table.getCellLocation(t,e),s="columnHeader"===o?n.columnMove.x:"rowHeader"===o?n.columnMove.y:0;n.table.scenegraph.component.showMoveCol(t,e,s),n.table.stateManager.updateSelectPos(-1,-1),n.table.scenegraph.updateNextFrame()}(t,e,i,r,this)}updateMoveCol(t,e,i,r){!function(t,e,i,r,n){if(!("canMoveHeaderPosition"in n.table.internalProps.layoutMap))return;const o=function(t,e,i){const r=i.getCellRange(t.col,t.row);if(i.isColumnHeader(t.col,t.row)){const n=i.getCellRange(e.col,r.start.row);e.row>=i.columnHeaderLevelCount&&(e.row=i.columnHeaderLevelCount-1),e.col>=t.col?e.col=n.end.col:e.col=n.start.col}else if(i.isRowHeader(t.col,t.row)){const n=i.getCellRange(r.start.col,e.row);e.col>=i.rowHeaderLevelCount&&(e.col=i.rowHeaderLevelCount-1);const o=i.internalProps.layoutMap;if("tree"===o.rowHierarchyType){const r=o.getCellHeaderPathsWidthTreeNode(t.col,t.row).rowHeaderPaths,n=o.getCellHeaderPathsWidthTreeNode(e.col,e.row).rowHeaderPaths;if(r.length<=n.length){const o=n[r.length-1];o&&(e.row>=t.row?e.row=o.startInTotal+o.size-1+i.columnHeaderLevelCount:e.row=o.startInTotal+i.columnHeaderLevelCount)}}else e.row>=t.row?e.row=n.end.row:e.row=n.start.row}return e}({col:n.columnMove.colSource,row:n.columnMove.rowSource},{col:t,row:e},n.table);let s,a,l,h;n.columnMove.x=i-n.table.tableX,n.columnMove.y=r-n.table.tableY,n.columnMove.colTarget=o.col,n.columnMove.rowTarget=o.row,n.table.internalProps.layoutMap.canMoveHeaderPosition({col:n.columnMove.colSource,row:n.columnMove.rowSource},{col:n.columnMove.colTarget,row:n.columnMove.rowTarget})?n.updateCursor("grabbing"):n.updateCursor("not-allowed");const c=n.table.getCellLocation(t,e);"columnHeader"===c?(a=n.columnMove.x,s=n.columnMove.colTarget>=n.columnMove.colSource?n.table.getColsWidth(0,n.columnMove.colTarget):n.table.getColsWidth(0,n.columnMove.colTarget-1)):"rowHeader"===c&&(h=n.columnMove.y,l=n.columnMove.rowTarget>=n.columnMove.rowSource?n.table.getRowsHeight(0,n.columnMove.rowTarget):n.table.getRowsHeight(0,n.columnMove.rowTarget-1)),n.table.scenegraph.component.updateMoveCol(a,s,h,l),n.table.scenegraph.updateNextFrame()}(t,e,i,r,this)}isMoveCol(){return this.columnMove.moving}endMoveCol(){mM(this)}checkFrozen(){const t=this.table.isListTable()&&!this.table.internalProps.transpose?this.table.options.frozenColCount:this.table.rowHeaderLevelCount;if(t){if(this.table.tableNoFrameWidth-this.table.getColsWidth(0,t-1)<=120)return this.table._setFrozenColCount(0),this.setFrozenCol(-1),!1;if(this.table.frozenColCount!==t)return this.table._setFrozenColCount(t),this.setFrozenCol(t),!1}return!0}setFrozenCol(t){t!==this.frozen.col?(this.frozen.col=t,this.table.scenegraph.updateFrozen(),this.table.scenegraph.updateFrozenIcon(0,this.table.colCount-1)):this.table.scenegraph.updateFrozenIcon(0,this.table.colCount-1)}updateVerticalScrollBar(t){const e=this.table.getAllRowsHeight();this.scroll.verticalBarPos=Math.ceil(t*(e-this.table.scenegraph.height)),this.table.scenegraph.setY(-this.scroll.verticalBarPos),this.scroll.verticalBarPos-=this.table.scenegraph.proxy.deltaY,this.table.scenegraph.proxy.deltaY=0,this.table.stateManager.updateHoverPos(-1,-1),this.table.fireListeners(ov.SCROLL,{scrollTop:this.scroll.verticalBarPos,scrollLeft:this.scroll.horizontalBarPos,scrollHeight:this.table.theme.scrollStyle?.width,scrollWidth:this.table.theme.scrollStyle?.width,viewHeight:this.table.tableNoFrameHeight,viewWidth:this.table.tableNoFrameWidth,scrollDirection:"vertical",scrollRatioY:t})}updateHorizontalScrollBar(t){const e=this.table.getAllColsWidth();this.scroll.horizontalBarPos=Math.ceil(t*(e-this.table.scenegraph.width)),this.table.scenegraph.setX(-this.scroll.horizontalBarPos),this.scroll.horizontalBarPos-=this.table.scenegraph.proxy.deltaX,this.table.scenegraph.proxy.deltaX=0,this.table.stateManager.updateHoverPos(-1,-1),this.table.fireListeners(ov.SCROLL,{scrollTop:this.scroll.verticalBarPos,scrollLeft:this.scroll.horizontalBarPos,scrollHeight:this.table.theme.scrollStyle?.width,scrollWidth:this.table.theme.scrollStyle?.width,viewHeight:this.table.tableNoFrameHeight,viewWidth:this.table.tableNoFrameWidth,scrollDirection:"horizontal",scrollRatioX:t})}setScrollTop(t){const e=this.table.getAllRowsHeight();t=Math.max(0,Math.min(t,e-this.table.scenegraph.height)),(t=Math.ceil(t))!==this.scroll.verticalBarPos&&this.table.stateManager.updateHoverPos(-1,-1),this.scroll.verticalBarPos=t,this.table.scenegraph.setY(-t);const i=t/(e-this.table.scenegraph.height);this.table.scenegraph.component.updateVerticalScrollBarPos(i),this.table.fireListeners(ov.SCROLL,{scrollTop:this.scroll.verticalBarPos,scrollLeft:this.scroll.horizontalBarPos,scrollHeight:this.table.theme.scrollStyle?.width,scrollWidth:this.table.theme.scrollStyle?.width,viewHeight:this.table.tableNoFrameHeight,viewWidth:this.table.tableNoFrameWidth,scrollDirection:"vertical",scrollRatioY:i})}setScrollLeft(t){const e=this.table.getAllColsWidth();this.table.getFrozenColsWidth(),t=Math.max(0,Math.min(t,e-this.table.scenegraph.width)),(t=Math.ceil(t))!==this.scroll.horizontalBarPos&&this.table.stateManager.updateHoverPos(-1,-1),this.scroll.horizontalBarPos=t,this.table.scenegraph.setX(-t);const i=t/(e-this.table.scenegraph.width);this.table.scenegraph.component.updateHorizontalScrollBarPos(i),this.table.fireListeners(ov.SCROLL,{scrollTop:this.scroll.verticalBarPos,scrollLeft:this.scroll.horizontalBarPos,scrollHeight:this.table.theme.scrollStyle?.width,scrollWidth:this.table.theme.scrollStyle?.width,viewHeight:this.table.tableNoFrameHeight,viewWidth:this.table.tableNoFrameWidth,scrollDirection:"horizontal",scrollRatioX:i})}hideVerticalScrollBar(){this.table.scenegraph.component.hideVerticalScrollBar()}showVerticalScrollBar(t){this.table.scenegraph.component.showVerticalScrollBar(),t&&(clearTimeout(this._clearVerticalScrollBar),this._clearVerticalScrollBar=setTimeout((()=>{this.table.scenegraph.component.hideVerticalScrollBar()}),1e3))}hideHorizontalScrollBar(){this.table.scenegraph.component.hideHorizontalScrollBar()}showHorizontalScrollBar(t){this.table.scenegraph.component.showHorizontalScrollBar(),t&&(clearTimeout(this._clearHorizontalScrollBar),this._clearHorizontalScrollBar=setTimeout((()=>{this.table.scenegraph.component.hideHorizontalScrollBar()}),1e3))}triggerContextMenu(t,e,i,r){this.menu.isShow&&this.menu.x===i&&this.menu.y===r?this.hideMenu():this.showContextMenu(t,e,i,r)}showContextMenu(t,e,i,r){this.table.internalProps.menu?.contextMenuItems&&("html"===this.table.internalProps.menu.renderMode?this.menu.isShow=!0:(this.menu.isShow=!0,this.menu.x=i,this.menu.y=r,this.table.scenegraph.component.menu.attach(i,r,t,e,lB.contextmenu)),this.table.fireListeners(ov.SHOW_MENU,{x:i,y:r,col:t,row:e,type:"contextmenu"}))}triggerDropDownMenu(t,e,i,r){this.table.fireListeners(ov.DROPDOWN_ICON_CLICK,{col:t,row:e}),this.menu.isShow?this.hideMenu():this.showDropDownMenu(t,e,i,r)}showDropDownMenu(t,e,i,r){"html"===this.table.internalProps.menu.renderMode?this.menu.isShow=!0:(this.menu.isShow=!0,this.table.scenegraph.component.menu.attach(i,r,t,e,lB.dropDown),this.menu.bounds=this.table.scenegraph.component.menu.bounds),this.table.fireListeners(ov.SHOW_MENU,{x:i,y:r,col:t,row:e,type:"dropDown"}),this.residentHoverIcon&&this.table.scenegraph.setIconNormalStyle(this.residentHoverIcon.icon,this.residentHoverIcon.col,this.residentHoverIcon.row);const n=this.table.scenegraph.getCell(t,e);let o;n.forEachChildren((t=>t.attribute.funcType===tC.dropDown&&(o=t,!0))),o&&(this.residentHoverIcon={col:t,row:e,icon:o},this.table.scenegraph.setIconHoverStyle(this.residentHoverIcon.icon,this.residentHoverIcon.col,this.residentHoverIcon.row,n),this.table.scenegraph.residentHoverIcon(t,e))}hideMenu(){this.menu.isShow&&(this.table.fireListeners(ov.DROPDOWN_MENU_CLEAR,null),this.table.fireListeners(ov.HIDE_MENU,null),this.menu.isShow=!1,this.table.scenegraph.component.menu.detach(),this.residentHoverIcon&&(this.table.scenegraph.setIconNormalStyle(this.residentHoverIcon.icon,this.residentHoverIcon.col,this.residentHoverIcon.row),this.table.scenegraph.resetResidentHoverIcon(this.residentHoverIcon.col,this.residentHoverIcon.row),this.residentHoverIcon=null))}setDropDownMenuHighlight(t){this.menu.dropDownMenuHighlight=t;for(let e=0;e<t.length;e++){const{col:i,row:r}=t[e];this.table.scenegraph.updateCellContent(i,r)}}dropDownMenuIsHighlight(t,e,i){const r=this.menu.dropDownMenuHighlight;if(Array.isArray(r))for(let n=0;n<r.length;n++){const o=r[n];let{col:s,row:a}=o;const{field:l,menuKey:h}=o;if("number"!=typeof s||"number"!=typeof a)if(this.table.isPivotTable()&&(Array.isArray(l),1)){const t=this.table.internalProps.layoutMap.getPivotCellAdress(l);if(!t)continue;s=t.col,a=t.row}else{const t=this.table.internalProps.layoutMap.getHeaderCellAddressByField(l);if(!t)continue;s=t.col,a=t.row}if(Y(s)&&Y(a)&&this.table.isCellRangeEqual(t,e,s,a)){const r=this.table._getHeaderLayoutMap(s??t,a??e).dropDownMenu||this.table.globalDropDownMenu;if(r)for(let t=0;t<r.length;t++){const e=r[t];if(q(e)&&(e.menuKey||e.text)===(h||"")&&t===i)return!0;if(et(e)&&e===h&&t===i)return!0}}}return!1}triggerSort(t,e,i){if(this.table.isPivotTable()){const i=this.table.getPivotSortState(t,e);return void this.table.fireListeners(pM.PIVOT_SORT_CLICK,{col:t,row:e,order:i||"normal",dimensionInfo:this.table.internalProps.layoutMap.getPivotDimensionInfo(t,e),cellLocation:this.table.getCellLocation(t,e)})}const r=this.sort.col,n=this.sort.row;uM(t,e,this.table),this.sort.col=t,this.sort.row=e,this.table.scenegraph.updateSortIcon(this.sort.col,this.sort.row,i,this.sort.order,r,n,this.sort.icon),this.sort.icon=i}updateSortState(t){if(t.field===this.sort.field&&t.order===this.sort.order)return;const e=this.sort.col,i=this.sort.row,r="asc"===this.sort.order?"sort_downward":"desc"===this.sort.order?"sort_upward":"sort_normal";this.setSortState(t);const n=this.table.internalProps.layoutMap.getHeaderCellAddressByField(t.field);this.sort.col=n.col,this.sort.row=n.row;const o=this.table.scenegraph.getCell(this.sort.col,this.sort.row).getChildByName(r,!0);this.table.scenegraph.updateSortIcon(this.sort.col,this.sort.row,o,this.sort.order,e,i,this.sort.icon)}triggerFreeze(t,e,i){this.table.isPivotTable()||this.table.transpose||(!function(t,e,i){i.frozenColCount>0?t!==i.frozenColCount-1?i.setFrozenColCount(t+1):i.setFrozenColCount(0):i.setFrozenColCount(t+1)}(t,0,this.table),this.frozen.icon=i)}updateCursor(t="default"){this.table.getElement().style.cursor=t}updateDrillState(t,e,i,r,n,o){this.drill.dimensionKey=t,this.drill.title=e,this.drill.drillDown=i,this.drill.drillUp=r,this.drill.col=n,this.drill.row=o,function(t,e,i,r,n){const o=n.getCellLocation(t,e);let s=0,a=0,l=!1;"columnHeader"===o?(s=n.getColsWidth(0,n.rowHeaderLevelCount-1)-(0===n.frozenColCount?n.scrollLeft:0),a=n.getRowsHeight(0,e-1)+n.getRowHeight(e)/2,l=!0):"rowHeader"===o&&(a=n.getRowsHeight(0,n.columnHeaderLevelCount-1),s=n.getColsWidth(0,t-1)+n.getColWidth(t)/2,l=!0),n.scenegraph.updateDrill(l,s,a,i,r)}(n,o,i,r,this.table)}updateSparklineHoverPose(t,e,i,r){-1!==this.sparkLine.col&&-1!==this.sparkLine.row&&function(t,e,i){const r=i.scenegraph.getCell(t,e).getChildByName("sparkline"),n=r?.getChildByName("highlight-line"),o=r?.getChildByName("highlight-symbol");n&&n.setAttributes({visible:!1,pickable:!1}),o&&o.setAttributes({visible:!1,pickable:!1}),i.scenegraph.updateNextFrame()}(this.sparkLine.col,this.sparkLine.row,this.table);let n=!1;-1!==t&&-1!==e&&(n=function(t,e,i,r,n){const o=n.scenegraph.getCell(t,e).getChildByName("sparkline"),s=o?.getChildByName("sparkline-line"),a=o?.getChildByName("sparkline-symbol-group");if(!s)return!1;const l=s.bandwidth,h=s.min,c=s.max,d=s.attribute.points;let u;i-=o.globalAABBBounds.x1,o.globalAABBBounds.y1;for(let t=0;t<d.length;t++){const{x:e,y:r,defined:n,rawData:g}=d[t];if(Math.abs(i-e)<l/2&&(u={point:d[t],points:d,pointsBandWidth:l,pointData:g},n)){const t=o.getChildByName("highlight-line");if(t)t.setAttributes({points:[{x:e,y:c},{x:e,y:h}],visible:!0,pickable:!0});else{const t=ul({points:[{x:e,y:c},{x:e,y:h}],lineWidth:s.hover?.strokeWidth,stroke:s.hover?.stroke});t.name="highlight-line",o.addChild(t)}const i=o.getChildByName("highlight-symbol");if(i)i.setAttributes({x:e,y:r,visible:!0,pickable:!0});else{const t=hl({x:e,y:r,stroke:a.hover.stroke,lineWidth:a.hover.strokeWidth,fill:a.hover.fill,size:2*a.hover.size,symbolType:"circle"});t.name="highlight-symbol",o.addChild(t)}break}}if(n.scenegraph.updateNextFrame(),u){const i={col:t,row:e,field:n.getHeaderField(t,e),value:n.getCellValue(t,e),dataValue:n.getCellOriginValue(t,e),cellHeaderPaths:n.internalProps.layoutMap.getCellHeaderPaths(t,e),title:n.getBodyColumnDefine(t,e).title,cellRange:n.getCellRelativeRect(t,e),sparkline:{pointData:u.pointData},scaleRatio:n.canvas.getBoundingClientRect().width/n.canvas.offsetWidth};n.fireListeners(ov.MOUSEOVER_CHART_SYMBOL,i)}return!0}(t,e,i,0,this.table)),n?(this.sparkLine.col=t,this.sparkLine.row=e):(this.sparkLine.col=-1,this.sparkLine.row=-1)}setCheckedState(t,e,i,r){const n=this.table.getRecordShowIndexByCell(t,e);if(n>=0){const t=this.table.dataSource.getIndexKey(n);this.checkedState[t]||(this.checkedState[t]={}),this.checkedState[t][i]=r}}setHeaderCheckedState(t,e){this.headerCheckedState[t]=e,this.checkedState?.forEach((i=>{i[t]=e}))}syncCheckedState(t,e,i,r){if(this.table.isHeader(t,e)){if(Y(this.headerCheckedState[i]))return this.headerCheckedState[i];if("function"==typeof r)return;if(Y(r))this.headerCheckedState[i]=r;else if(this.checkedState?.length>0){return this.updateHeaderCheckedState(i)}return this.headerCheckedState[i]}const n=this.table.getRecordShowIndexByCell(t,e);if(n>=0){const t=this.table.dataSource.getIndexKey(n);if(Y(this.checkedState[t]?.[i]))return this.checkedState[t][i];this.checkedState[t]||(this.checkedState[t]={}),this.checkedState[t][i]=r}return r}initCheckedState(t){let e=!1;this._checkboxCellTypeFields=[],this._headerCheckFuncs={},this.table.internalProps.layoutMap.headerObjects.forEach(((t,i)=>{if("checkbox"===t.headerType){const i=t.define.checked;null==i||"function"==typeof i?(e=!0,"function"==typeof i&&(this._headerCheckFuncs[t.field]=i)):this.headerCheckedState[t.field]=i,"checkbox"!==t.define.cellType||t.fieldFormat||this._checkboxCellTypeFields.push(t.field)}})),e&&t.forEach(((t,e)=>{this._checkboxCellTypeFields.forEach((i=>{const r=t[i];let n;if(q(r)?n=r.checked:"boolean"==typeof r&&(n=r),null==n){const t=this._headerCheckFuncs[i];if(t){const o=this.table.getCellAddrByFieldRecord(i,e);n=XC(t,{col:o.col,row:o.row,table:this.table,context:null,value:r})}}this.checkedState[e]||(this.checkedState[e]={}),this.checkedState[e][i]=n}))}))}updateHeaderCheckedState(t){const e=this.checkedState.every((e=>!0===e[t]));if(e)return this.headerCheckedState[t]=!0,e;if(this.checkedState.every((e=>!1===e[t])))return this.headerCheckedState[t]=!1,!1;return!!this.checkedState.find((e=>!0===e[t]))&&(this.headerCheckedState[t]="indeterminate","indeterminate")}initLeftRecordsCheckState(t){for(let e=this.checkedState.length;e<t.length;e++){const i=t[e];this._checkboxCellTypeFields.forEach((t=>{const r=i[t];let n;q(r)?n=r.checked:"boolean"==typeof r&&(n=r),this.checkedState[e]||(this.checkedState[e]={}),this.checkedState[e][t]=n}))}}}function vM(t){const e={abstractPos:{x:t.x,y:t.y}},i=function(t){for(;t&&t.parent;){if("cell"===t.role)return t;t=t.parent}return null}(t.target);return i&&(e.eventArgs={col:i.col,row:i.row,event:t,targetCell:i,target:t.target}),e}function wM(t){const e=t.table;t.gesture=new Jg(e.scenegraph.tableGroup,{tap:{interval:300}}),t.gesture.on("doubletap",(t=>{!function(t,e){const i=vM(t);let r=-1,n=-1;i.eventArgs&&(r=i.eventArgs.col,n=i.eventArgs.row);const o=e.getCellValue(r,n),s=i.eventArgs?.targetCell?.globalAABBBounds;if(s&&e.internalProps.focusControl.setFocusRect(new gv(s.x1+e.scrollLeft,s.y1+e.scrollTop,s.x2-s.x1,s.y2-s.y1),o),e.hasListeners(ov.DBLCLICK_CELL)){const o=e.getCellInfo(r,n);let s,a;if(i.eventArgs?.target){const t=bM(i.eventArgs?.target);t&&(s=t.icon,a=t.position)}const l={...o,event:t.nativeEvent,federatedEvent:t,cells:[],targetIcon:s?{name:s.name,position:a,funcType:s.attribute.funcType}:void 0,target:i?.eventArgs?.target};e.fireListeners(ov.DBLCLICK_CELL,l)}}(t,e)}))}function xM(t){if(t.stateManager.endResizeCol(),t.hasListeners(ov.RESIZE_COLUMN_END)){const e=[];for(let i=0;i<t.colCount;i++)e.push(t.getColWidth(i));t.fireListeners(ov.RESIZE_COLUMN_END,{col:t.stateManager.columnResize.col,columns:e})}}function _M(t,e){let{deltaX:i,deltaY:r}=t;t.shiftKey&&t.deltaY&&(i=r,r=0);const[n,o]=function(t,e,i){const r=2,n=Math.abs(t/e),o=n<=1/r?0:t,s=n>r?0:e;return[Math.ceil(o*(i.horizontal??0)),Math.ceil(s*(i.vertical??0))]}(i,r,{horizontal:1,vertical:1});(n||o)&&e.interactionState!==$y.scrolling&&e.updateInteractionState($y.scrolling),n&&(e.setScrollLeft(e.scroll.horizontalBarPos+n),e.showHorizontalScrollBar(!0)),o&&(e.setScrollTop(e.scroll.verticalBarPos+o),e.showVerticalScrollBar(!0)),e.resetInteractionState(),t.cancelable&&("none"===e.table.internalProps.overscrollBehavior||Math.abs(r)>=Math.abs(i)&&0!==r&&SM(r,e)||Math.abs(r)<=Math.abs(i)&&0!==i&&AM(i,e))&&t.preventDefault()}function SM(t,e){return 0!=e.table.getAllRowsHeight()-e.table.scenegraph.height&&(!function(t,e){const i=e.table.getAllRowsHeight()-e.table.scenegraph.height;return 0!==i&&t<=0&&e.scroll.verticalBarPos<1}(t,e)&&!function(t,e){const i=e.table.getAllRowsHeight()-e.table.scenegraph.height;return 0!==i&&t>=0&&Math.abs(e.scroll.verticalBarPos-i)<1}(t,e))}function AM(t,e){return 0!=e.table.getAllColsWidth()-e.table.scenegraph.width&&(!function(t,e){const i=e.table.getAllColsWidth()-e.table.scenegraph.width;return 0!==i&&t<=0&&e.scroll.horizontalBarPos<1}(t,e)&&!function(t,e){const i=e.table.getAllColsWidth()-e.table.scenegraph.width;return 0!==i&&t>=0&&Math.abs(e.scroll.horizontalBarPos-i)<1}(t,e))}function BM(t){const e=t.table,i=e.stateManager,r=e.scenegraph;t.touchMovePoints=[],e.scenegraph.tableGroup.addEventListener("touchstart",(e=>{e.target.isChildOf(r.component.vScrollBar)||e.target.isChildOf(r.component.vScrollBar)||(t.isTouchdown=!0,t.touchMovePoints.push({x:e.page.x,y:e.page.y,timestamp:Date.now()}))})),window.addEventListener("touchmove",(r=>{if(t.touchMove&&r.preventDefault(),!t.isTouchdown||!TM(r))return;t.touchMovePoints.length>4&&t.touchMovePoints.shift(),t.touchMovePoints.push({x:r.changedTouches[0].pageX,y:r.changedTouches[0].pageY,timestamp:Date.now()});const n=-t.touchMovePoints[t.touchMovePoints.length-1].x+t.touchMovePoints[t.touchMovePoints.length-2].x,o=-t.touchMovePoints[t.touchMovePoints.length-1].y+t.touchMovePoints[t.touchMovePoints.length-2].y;_M({deltaX:n,deltaY:o},i),r.cancelable&&("none"===e.internalProps.overscrollBehavior||Math.abs(o)>=Math.abs(n)&&0!==o&&SM(o,i)||Math.abs(o)<=Math.abs(n)&&0!==n&&AM(n,i))&&r.preventDefault()}),{passive:!1}),window.addEventListener("touchend",(e=>{if(t.touchEnd=!0,t.touchMove=!1,t.isTouchdown&&TM(e)){if(t.touchMovePoints?.length){t.touchMovePoints.length>4&&t.touchMovePoints.shift(),t.touchMovePoints.push({x:e.changedTouches[0].pageX,y:e.changedTouches[0].pageY,timestamp:Date.now()});const r=t.touchMovePoints[0],n=t.touchMovePoints[t.touchMovePoints?.length-1];!function(t,e,i){let r=Date.now();const n=.95,o=()=>{const s=Date.now(),a=s-r;let l=!0;const h=Math.pow(n,a/16),c=h*t,d=h*e;let u=0,g=0;Math.abs(c)>.05&&(l=!1,u=(t+c)/2*a),Math.abs(d)>.05&&(l=!1,g=(e+d)/2*a),_M({deltaX:-u,deltaY:-g},i),l||(r=s,t=c,e=d,requestAnimationFrame(o))};requestAnimationFrame(o)}((n.x-r.x)/(n.timestamp-r.timestamp),(n.y-r.y)/(n.timestamp-r.timestamp),i)}t.isTouchdown=!1,t.touchMovePoints=[]}})),window.addEventListener("touchcancel",(e=>{t.touchEnd=!0,t.touchMove=!1,t.isTouchdown&&(t.isTouchdown=!1,t.touchMovePoints=[])}))}function TM(t){return!!t.changedTouches}function MM(t,e,i){if(i.indicatorsAsCol){if(i.hasTwoIndicatorAxes&&e===i.columnHeaderLevelCount-1&&t>=i.rowHeaderLevelCount&&t<i.colCount-i.rightFrozenColCount)return"top";if(e===i.rowCount-i.bottomFrozenRowCount&&t>=i.rowHeaderLevelCount&&t<i.colCount-i.rightFrozenColCount)return"bottom";if(t===i.rowHeaderLevelCount-1&&e>=i.rowHeaderLevelCount&&e<i.rowCount-i.bottomFrozenRowCount)return"left"}else{if(t===i.rowHeaderLevelCount-1&&e>=i.columnHeaderLevelCount&&e<i.rowCount-i.bottomFrozenRowCount)return"left";if(t===i.colCount-i.rightFrozenColCount&&e>=i.columnHeaderLevelCount&&e<i.rowCount-i.bottomFrozenRowCount)return"right";if(e===i.rowCount-i.bottomFrozenRowCount&&t>=i.rowHeaderLevelCount&&t<i.colCount-i.rightFrozenColCount)return"bottom"}return"bottom"}class RM{table;isPointerDownOnTable=!1;isTouchdown;touchMovePoints;touchSetTimeout;touchEnd;touchMove;gesture;handleTextStickBindId;LastPointerXY;LastBodyPointerXY;isDown=!1;isDraging=!1;constructor(t){this.table=t,"node"!==CC.mode&&(this.bindOuterEvent(),setTimeout((()=>{this.bindSelfEvent()}),0))}bindOuterEvent(){!function(t){const e=t.table,i=e.stateManager;document.body.addEventListener("pointerdown",(t=>{e.eventManager.LastBodyPointerXY={x:t.x,y:t.y},e.eventManager.isDown=!0})),document.addEventListener("pointerup",(t=>{e.eventManager.LastBodyPointerXY=null,e.eventManager.isDown=!1,e.eventManager.isDraging=!1})),document.body.addEventListener("pointermove",(r=>{if(e.eventManager.isDown&&e.eventManager.LastBodyPointerXY){const t=e.eventManager.LastBodyPointerXY?.x??r.x,i=e.eventManager.LastBodyPointerXY?.y??r.y;(Math.abs(t-r.x)>1||Math.abs(i-r.y)>1)&&(e.eventManager.isDraging=!0)}const{x:n,y:o}=e._getMouseAbstractPoint(r,!1);i.interactionState!==$y.scrolling&&i.interactionState===$y.grabing&&i.isResizeCol()&&(t.dealColumnResize(n,o),e.hasListeners(ov.RESIZE_COLUMN)&&e.fireListeners(ov.RESIZE_COLUMN,{col:e.stateManager.columnResize.col,colWidth:e.getColWidth(e.stateManager.columnResize.col)}))})),e.scenegraph.tableGroup.addEventListener("pointermove",(r=>{const n=e.eventManager.LastPointerXY?.x??r.x,o=e.eventManager.LastPointerXY?.y??r.y;e.eventManager.LastPointerXY={x:r.x,y:r.y},t.touchSetTimeout&&(clearTimeout(t.touchSetTimeout),t.touchSetTimeout=void 0);const s=vM(r);if(i.interactionState===$y.scrolling)return;if(i.interactionState===$y.grabing&&Math.abs(n-r.x)+Math.abs(o-r.y)>=1)return void(i.isResizeCol()||(i.isMoveCol()?t.dealColumnMover(s):t.dealTableSelect(s,!0)));i.isResizeCol()||t.checkColumnResize(s)?i.updateCursor("col-resize"):i.updateCursor();const a=r.path.find((t=>"cell"===t.role));if(e.hasListeners(ov.MOUSELEAVE_CELL)&&("cell"!==a?.role||-1===e.stateManager.hover.cellPos.col||-1===e.stateManager.hover.cellPos.row||a.col===e.stateManager.hover.cellPos.col&&a.row===e.stateManager.hover.cellPos.row||e.fireListeners(ov.MOUSELEAVE_CELL,{col:e.stateManager.hover.cellPos.col,row:e.stateManager.hover.cellPos.row,cellRange:e.getCellRangeRelativeRect({col:e.stateManager.hover.cellPos.col,row:e.stateManager.hover.cellPos.row}),scaleRatio:e.canvas.getBoundingClientRect().width/e.canvas.offsetWidth,event:r.nativeEvent,target:s?.eventArgs?.target})),e.hasListeners(ov.MOUSEENTER_CELL)&&"cell"===a?.role&&Y(a.col)&&Y(a.row)&&(a.col!==e.stateManager.hover.cellPos.col||a.row!==e.stateManager.hover.cellPos.row)&&e.fireListeners(ov.MOUSEENTER_CELL,{col:a.col,row:a.row,cellRange:e.getCellRangeRelativeRect({col:a.col,row:a.row}),scaleRatio:e.canvas.getBoundingClientRect().width/e.canvas.offsetWidth,event:r.nativeEvent,target:s?.eventArgs?.target}),t.dealIconHover(s),t.dealTableHover(s),s.eventArgs&&e.hasListeners(ov.MOUSEMOVE_CELL)){let t,i;if(s.eventArgs?.target){const e=bM(s.eventArgs?.target);e&&(t=e.icon,i=e.position)}e.fireListeners(ov.MOUSEMOVE_CELL,{col:s.eventArgs.col,row:s.eventArgs.row,x:s.abstractPos.x,y:s.abstractPos.y,event:r.nativeEvent,targetIcon:t?{name:t.name,position:i,funcType:t.attribute.funcType}:void 0,target:s?.eventArgs?.target})}})),e.scenegraph.tableGroup.addEventListener("pointerout",(e=>{const i=vM(e),r=i?.eventArgs?.target;"table"===r?.role&&t.dealTableHover()})),e.scenegraph.tableGroup.addEventListener("pointerover",(t=>{const i=vM(t),r=i?.eventArgs?.target;if(r&&e.hasListeners(ov.MOUSEOVER_CHART_SYMBOL)&&"symbol"===r.type){const r=t.composedPath().find((t=>"cell"===t.roll));if(r){const{col:n,row:o}=r,s={col:n,row:o,field:e.getHeaderField(n,o),value:e.getCellValue(n,o),dataValue:e.getCellOriginValue(n,o),cellHeaderPaths:e.internalProps.layoutMap.getCellHeaderPaths(n,o),title:e.getBodyColumnDefine(n,o).title,cellRange:e.getCellRelativeRect(n,o),event:t.nativeEvent,sparkline:{pointData:void 0},scaleRatio:e.canvas.getBoundingClientRect().width/e.canvas.offsetWidth,target:i?.eventArgs?.target};e.fireListeners(ov.MOUSEOVER_CHART_SYMBOL,s)}}})),e.scenegraph.tableGroup.addEventListener("pointerleave",(r=>{i.isResizeCol()||i.isMoveCol()||i.isSelecting()||(i.updateInteractionState($y.default),i.updateCursor()),t.dealTableHover();const n=r.target;n&&!n.isDescendantsOf(e.scenegraph.tableGroup)&&e.fireListeners(ov.MOUSELEAVE_TABLE,{col:-1,row:-1,event:r.nativeEvent,target:void 0})})),e.scenegraph.tableGroup.addEventListener("pointerupoutside",(r=>{const n=vM(r);if(i.menu.isShow&&n.eventArgs?.target!==i.residentHoverIcon?.icon&&setTimeout((()=>{e.internalProps.menuHandler.pointInMenuElement(r.page.x,r.page.y)||i.menu.isShow&&i.hideMenu()}),0),i.isResizeCol())xM(e);else if(i.isMoveCol())e.stateManager.endMoveCol(),-1!==e.stateManager.columnMove?.colSource&&-1!==e.stateManager.columnMove?.rowSource&&-1!==e.stateManager.columnMove?.colTarget&&-1!==e.stateManager.columnMove?.rowTarget&&e.hasListeners(ov.CHANGE_HEADER_POSITION)&&e.fireListeners(ov.CHANGE_HEADER_POSITION,{target:{col:e.stateManager.columnMove.colTarget,row:e.stateManager.columnMove.rowTarget},source:{col:e.stateManager.columnMove.colSource,row:e.stateManager.columnMove.rowSource}});else if(i.isSelecting()&&e.stateManager.select?.ranges?.length){const t=e.stateManager.select.ranges[e.stateManager.select.ranges.length-1].end.col,i=e.stateManager.select.ranges[e.stateManager.select.ranges.length-1].end.row;if(e.stateManager.endSelectCells(),e.hasListeners(ov.DRAG_SELECT_END)){const n={event:r.nativeEvent,cells:[],col:t,row:i,scaleRatio:e.canvas.getBoundingClientRect().width/e.canvas.offsetWidth,target:void 0};n.cells=e.getSelectedCellInfos(),e.fireListeners(ov.DRAG_SELECT_END,n)}}e.editorManager?.completeEdit(r.nativeEvent),i.updateInteractionState($y.default),t.dealTableHover()})),e.scenegraph.tableGroup.addEventListener("pointerdown",(r=>{if(e.eventManager.isPointerDownOnTable=!0,setTimeout((()=>{e.eventManager.isPointerDownOnTable=!1}),0),e.eventManager.isDown=!0,e.eventManager.LastBodyPointerXY={x:r.x,y:r.y},r.stopPropagation(),e.eventManager.LastPointerXY={x:r.x,y:r.y},0!==r.button)return;const n=vM(r);if(i.interactionState!==$y.default)return;e.isPivotChart()&&"chart"!==n?.eventArgs?.target.type&&e.scenegraph.updateChartState(null),n.eventArgs?.target!==i.residentHoverIcon?.icon&&i.hideMenu(),e.editorManager?.completeEdit(r.nativeEvent);const o=n?.eventArgs?.target?.role?.startsWith("icon")?n.eventArgs.target:void 0;if(!o||!1===o.attribute.interactive)if("touch"===r.pointerType)t.touchEnd=!1,t.touchSetTimeout=setTimeout((()=>{t.isTouchdown=!1,t.touchMove=!0,(!t.touchEnd&&t.checkColumnResize(n,!0)||!t.touchEnd&&t.chechColumnMover(n)||t.dealTableSelect(n)&&!t.touchEnd)&&i.updateInteractionState($y.grabing)}),500),t.dealTableHover(n);else{if(t.checkColumnResize(n,!0))return e.scenegraph.updateChartState(null),void i.updateInteractionState($y.grabing);if(t.chechColumnMover(n))return void i.updateInteractionState($y.grabing);t.dealTableSelect(n)&&i.updateInteractionState($y.grabing)}if(e.hasListeners(ov.MOUSEDOWN_CELL)){const t=vM(r);t.eventArgs&&e.fireListeners(ov.MOUSEDOWN_CELL,{col:t.eventArgs.col,row:t.eventArgs.row,event:r.nativeEvent,target:t?.eventArgs?.target})}})),e.scenegraph.tableGroup.addEventListener("pointerup",(t=>{if(0===t.button){if("grabing"===i.interactionState){if(i.updateInteractionState($y.default),i.isResizeCol())xM(e);else if(i.isMoveCol()){const i=vM(t);e.stateManager.endMoveCol(),i.eventArgs&&e.hasListeners(ov.CHANGE_HEADER_POSITION)&&e.fireListeners(ov.CHANGE_HEADER_POSITION,{target:{col:i.eventArgs.col,row:i.eventArgs.row},source:{col:e.stateManager.columnMove.colSource,row:e.stateManager.columnMove.colSource}})}else if(i.isSelecting()){e.stateManager.endSelectCells();const i=vM(t);if(i.eventArgs&&e.hasListeners(ov.DRAG_SELECT_END)){const r={event:t.nativeEvent,cells:[],col:i.eventArgs.target.col,row:i.eventArgs.target.row,scaleRatio:e.canvas.getBoundingClientRect().width/e.canvas.offsetWidth,target:i?.eventArgs?.target};r.cells=e.getSelectedCellInfos(),e.fireListeners(ov.DRAG_SELECT_END,r)}}}else i.interactionState===$y.scrolling&&i.updateInteractionState($y.default);if(e.hasListeners(ov.MOUSEUP_CELL)){const i=vM(t);i.eventArgs&&e.fireListeners(ov.MOUSEUP_CELL,{col:i.eventArgs.col,row:i.eventArgs.row,event:t.nativeEvent,target:i?.eventArgs?.target})}}})),e.scenegraph.tableGroup.addEventListener("rightdown",(t=>{const r=vM(t);if(r.eventArgs){i.triggerContextMenu(r.eventArgs.col,r.eventArgs.row,r.abstractPos.x,r.abstractPos.y);const{col:n,row:o}=r.eventArgs;if(e.hasListeners(ov.CONTEXTMENU_CELL)){const i=e.getCellInfo(n,o);let s,a;if(r.eventArgs?.target){const t=bM(r.eventArgs?.target);t&&(s=t.icon,a=t.position)}const l={...i,event:t.nativeEvent,cells:[],targetIcon:s?{name:s.name,position:a,funcType:s.attribute.funcType}:void 0,target:r?.eventArgs?.target};!function(t,e,i){for(let r=0;r<t.length;r++){const n=t[r];if(n.start.col<=e&&e<=n.end.col&&n.start.row<=i&&i<=n.end.row||n.end.col<=e&&e<=n.start.col&&n.end.row<=i&&i<=n.start.row)return!0}return!1}(e.stateManager.select.ranges,n,o)?l.cells=[[i]]:l.cells=e.getSelectedCellInfos(),e.fireListeners(ov.CONTEXTMENU_CELL,l)}}})),e.scenegraph.tableGroup.addEventListener("pointertap",(r=>{if(e.stateManager.columnResize.resizing||e.stateManager.columnMove.moving)return;const n=vM(r);if(t.dealIconClick(r,n),n?.eventArgs){if(t.touchSetTimeout&&"touch"===r.pointerType){const e=vM(r);t.touchSetTimeout&&(clearTimeout(t.touchSetTimeout),t.dealTableSelect(e),i.endSelectCells(),t.touchSetTimeout=void 0)}if(!t.touchMove&&e.hasListeners(ov.CLICK_CELL)){const{col:t,row:i}=n.eventArgs,o=e.getCellInfo(t,i);let s,a;if(n.eventArgs?.target){const t=bM(n.eventArgs?.target);t&&(s=t.icon,a=t.position)}const l={...o,event:r.nativeEvent,federatedEvent:r,cells:[],targetIcon:s?{name:s.name,position:a,funcType:s.attribute.funcType}:void 0,target:n?.eventArgs?.target};e.fireListeners(ov.CLICK_CELL,l)}}})),e.scenegraph.stage.addEventListener("pointerdown",(t=>{const r=vM(t);r.eventArgs?.target!==i.residentHoverIcon?.icon&&i.hideMenu(),e.editorManager?.completeEdit(t.nativeEvent)})),e.scenegraph.stage.addEventListener("pointertap",(r=>{const n=r.target;e.eventManager.isDraging||!n||n.isDescendantsOf(e.scenegraph.tableGroup)?e.eventManager.isDraging&&i.endSelectCells():(i.updateInteractionState($y.default),t.dealTableHover(),t.dealTableSelect(),i.updateCursor(),e.scenegraph.updateChartState(null))})),e.scenegraph.tableGroup.addEventListener("checkbox_state_change",(t=>{const i=vM(t),{col:r,row:n}=i.eventArgs,o=e.getCellInfo(r,n),s=Nv(e,r,n);if(s)for(let i=s.start.col;i<=s.end.col;i++)for(let r=s.start.row;r<=s.end.row;r++)e.scenegraph.getCell(i,r).forEachChildren((e=>{"checkbox"===e.name&&e.setAttributes({checked:t.target.attribute.checked,indeterminate:t.target.attribute.indeterminate})}));const a={...o,event:t.nativeEvent,target:i?.eventArgs?.target,checked:t.detail.checked};if(e.isHeader(r,n))e.stateManager.setHeaderCheckedState(o.field,t.detail.checked),"checkbox"===e.getBodyColumnDefine(r,n).cellType&&e.scenegraph.updateCheckboxCellState(r,n,t.detail.checked);else if(e.stateManager.setCheckedState(r,n,o.field,t.detail.checked),"checkbox"===e.getBodyColumnDefine(r,n).headerType){const t=e.stateManager.headerCheckedState[o.field],i=e.stateManager.updateHeaderCheckedState(o.field);t!==i&&e.scenegraph.updateHeaderCheckboxCellState(r,n,i)}e.fireListeners(ov.CHECKBOX_STATE_CHANGE,a)}))}(this),function(t){const e=t.table,i=e.stateManager,r=e.internalProps.handler;r.on(e.getElement(),"mousedown",(t=>{e.eventManager.isPointerDownOnTable&&t.stopPropagation()})),r.on(e.getElement(),"blur",(e=>{t.dealTableHover()})),r.on(e.getElement(),"wheel",(t=>{_M(t,i)})),r.on(e.getElement(),"keydown",(r=>{if("a"===r.key&&(r.ctrlKey||r.metaKey))e.keyboardOptions?.selectAllOnCtrlA&&(r.preventDefault(),t.deelTableSelectAll());else if(i.select.cellPos.col>=0&&i.select.cellPos.row>=0&&("ArrowUp"===r.key||"ArrowDown"===r.key||"ArrowLeft"===r.key||"ArrowRight"===r.key)){if(!e.options.keyboardOptions?.moveEditCellOnArrowKeys&&e.editorManager.editingEditor)return;let t,n;r.preventDefault(),r.stopPropagation(),"ArrowUp"===r.key?(t=i.select.cellPos.col,n=Math.min(e.rowCount-1,Math.max(0,i.select.cellPos.row-1))):"ArrowDown"===r.key?(t=i.select.cellPos.col,n=Math.min(e.rowCount-1,Math.max(0,i.select.cellPos.row+1))):"ArrowLeft"===r.key?(n=i.select.cellPos.row,t=Math.min(e.colCount-1,Math.max(0,i.select.cellPos.col-1))):"ArrowRight"===r.key&&(n=i.select.cellPos.row,t=Math.min(e.colCount-1,Math.max(0,i.select.cellPos.col+1))),e.selectCell(t,n),e.options.keyboardOptions?.moveEditCellOnArrowKeys&&e.editorManager.editingEditor&&(e.editorManager.completeEdit(),e.getElement().focus(),e.getEditor(t,n)&&e.editorManager.startEditCell(t,n))}else if("Escape"===r.key)e.editorManager.editingEditor&&(e.editorManager.editingEditor.exit(),e.editorManager.editingEditor=null);else if("Enter"===r.key){if(e.editorManager.editingEditor)e.editorManager.completeEdit(),e.getElement().focus();else if((e.options.keyboardOptions?.editCellOnEnter??1)&&1===(e.stateManager.select.ranges?.length??0)){const t=e.stateManager.select.ranges[0].start.col,i=e.stateManager.select.ranges[0].start.row,r=e.stateManager.select.ranges[0].end.col,n=e.stateManager.select.ranges[0].end.row;t===r&&i===n&&e.getEditor(t,i)&&e.editorManager.startEditCell(t,i)}}else if("Tab"===r.key&&(e.options.keyboardOptions?.moveFocusCellOnTab??1)&&(r.preventDefault(),i.select.cellPos.col>=0&&i.select.cellPos.row>=0)){let t,r;i.select.cellPos.col===e.colCount-1?(r=Math.min(e.rowCount-1,i.select.cellPos.row+1),t=e.rowHeaderLevelCount):i.select.cellPos.row===e.rowCount-1?(r=e.rowCount-1,t=e.rowHeaderLevelCount):(r=i.select.cellPos.row,t=i.select.cellPos.col+1),e.selectCell(t,r),e.editorManager.editingEditor&&(e.editorManager.completeEdit(),e.getElement().focus()),e.getEditor(t,r)&&e.editorManager.startEditCell(t,r)}if(e.hasListeners(ov.KEYDOWN)){const t={keyCode:r.keyCode??r.which,code:r.code,event:r,scaleRatio:e.canvas.getBoundingClientRect().width/e.canvas.offsetWidth};e.fireListeners(ov.KEYDOWN,t)}})),r.on(e.getElement(),"copy",(t=>{if(e.keyboardOptions?.copySelected){const i=e.getCopyValue();Y(i)&&(t.preventDefault(),QC?window.clipboardData.setData("Text",i):t.clipboardData.setData("text/plain",i),e.fireListeners(ov.COPY_DATA,{cellRange:e.stateManager.select.ranges,copyData:i}))}})),r.on(e.getElement(),"paste",(t=>{if(e.keyboardOptions?.pasteValueToCell&&e.changeCellValues){if(e.editorManager?.editingEditor)return;if(e.stateManager.select.ranges?.length>0){const i=e.stateManager.select.ranges,r=Math.min(i[0].start.col,i[0].end.col),n=Math.min(i[0].start.row,i[0].end.row),o=(t.clipboardData||window.Clipboard).getData("text").split("\n"),s=[];o.forEach((function(t,e){const i=t.split("\t"),r=[];s.push(r),i.forEach((function(t,e){e===i.length-1&&(t=t.trim()),r.push(t)}))})),e.changeCellValues(r,n,s)}}})),r.on(e.getElement(),"contextmenu",(t=>{t.preventDefault()})),r.on(e.getContainer(),"resize",(t=>{0===t.width&&0===t.height||e.resize()}))}(this),function(t){const e=t.table,i=e.stateManager,r=e.scenegraph;r.component.vScrollBar.addEventListener("pointerover",(t=>{i.showVerticalScrollBar()})),r.component.hScrollBar.addEventListener("pointerover",(t=>{i.showHorizontalScrollBar()})),r.component.vScrollBar.addEventListener("pointerout",(t=>{i.interactionState!==$y.scrolling&&i.hideVerticalScrollBar()})),r.component.hScrollBar.addEventListener("pointerout",(t=>{i.interactionState!==$y.scrolling&&i.hideHorizontalScrollBar()})),r.component.vScrollBar.addEventListener("scrollDown",(t=>{r.table.eventManager.LastBodyPointerXY={x:t.x,y:t.y},r.table.eventManager.isDown=!0,i.interactionState!==$y.scrolling&&i.updateInteractionState($y.scrolling),r.table.stateManager.hideMenu(),r.table.editorManager?.completeEdit()})),r.component.vScrollBar.addEventListener("pointerup",(()=>{i.fastScrolling=!1,r.table.eventManager.isDraging=!1,i.interactionState===$y.scrolling&&i.updateInteractionState($y.default)})),r.component.vScrollBar.addEventListener("pointerupoutside",(()=>{i.fastScrolling=!1,i.interactionState===$y.scrolling&&i.updateInteractionState($y.default)})),r.component.vScrollBar.addEventListener("scrollUp",(t=>{r.table.eventManager.isDraging=!1})),r.component.hScrollBar.addEventListener("scrollDown",(t=>{r.table.eventManager.LastBodyPointerXY={x:t.x,y:t.y},r.table.eventManager.isDown=!0,i.interactionState!==$y.scrolling&&i.updateInteractionState($y.scrolling),r.table.stateManager.hideMenu(),r.table.editorManager?.completeEdit()})),r.component.hScrollBar.addEventListener("pointerup",(()=>{i.fastScrolling=!1,r.table.eventManager.isDraging=!1,i.interactionState===$y.scrolling&&i.updateInteractionState($y.default)})),r.component.hScrollBar.addEventListener("pointerupoutside",(()=>{i.fastScrolling=!1,i.interactionState===$y.scrolling&&i.updateInteractionState($y.default)})),r.component.hScrollBar.addEventListener("scrollUp",(t=>{r.table.eventManager.isDraging=!1}));const n=RC(i.updateVerticalScrollBar,20),o=RC(i.updateHorizontalScrollBar,20);r.component.vScrollBar.addEventListener("scrollDrag",(t=>{r.table.eventManager.isDown&&(r.table.eventManager.isDraging=!0),i.fastScrolling=!0,i.interactionState!==$y.scrolling&&i.updateInteractionState($y.scrolling);const e=t.detail.value[0]/(1-t.detail.value[1]+t.detail.value[0]);n(e,t)})),r.component.hScrollBar.addEventListener("scrollDrag",(t=>{r.table.eventManager.isDown&&(r.table.eventManager.isDraging=!0),i.fastScrolling=!0,i.interactionState!==$y.scrolling&&i.updateInteractionState($y.scrolling);const e=t.detail.value[0]/(1-t.detail.value[1]+t.detail.value[0]);o(e)}))}(this),BM(this),wM(this)}updateEventBinder(){setTimeout((()=>{LT(this.table)&&!this.handleTextStickBindId?this.handleTextStickBindId=this.table.on(ov.SCROLL,(t=>{MT(this.table)})):!LT(this.table)&&this.handleTextStickBindId&&(this.table.off(this.handleTextStickBindId),this.handleTextStickBindId=void 0)}),0)}bindSelfEvent(){if(this.table.isReleased)return;const t=this.table.stateManager;var e;this.table.on(ov.ICON_CLICK,(e=>{const{col:i,row:r,x:n,y:o,funcType:s,icon:a}=e;var l;s===tC.dropDown?t.triggerDropDownMenu(i,r,n,o):s===tC.sort?t.triggerSort(i,r,a):s===tC.frozen?t.triggerFreeze(i,r,a):s===tC.drillDown?(l=this.table).fireListeners(pM.DRILLMENU_CLICK,l.stateManager.drill):s!==tC.collapse&&s!==tC.expand||(this.table.stateManager.updateSelectPos(-1,-1),this.table.toggleHierarchyState(i,r))})),this.table.on(ov.DROPDOWN_MENU_CLICK,(()=>{t.hideMenu()})),LT(this.table)&&(this.handleTextStickBindId=this.table.on(ov.SCROLL,(t=>{MT(this.table)}))),e=this.table,"browser"===CC.mode&&e.on(ov.CLICK_CELL,(t=>{const{col:i,row:r}=t;let n;n=e.internalProps.layoutMap.isHeader(i,r)?e.isPivotTable()?e._getHeaderLayoutMap(i,r).headerType:e.getHeaderDefine(i,r).headerType:e.getBodyColumnType(i,r);const o=e.isHeader(i,r)?e.getHeaderDefine(i,r):e.getBodyColumnDefine(i,r),s=e.getCellValue(i,r),a=e.getCellOriginValue(i,r);if("link"===n){if(!1===o.linkJump)return;const t=o.templateLink,n=!1!==o.linkDetect;let l;if(t){const n=e.getCellOriginRecord(i,r),o=Object.assign({__value:s,__dataValue:a},n),h=/\{\s*(\S+?)\s*\}/g;l=t.replace(h,((t,e)=>o[e]))}else if(n){if(!xv.test(s))return;l=s}else l=s;window.open(l)}else if("image"===n){const t=document.createElement("div");t.style.width="100%",t.style.height="100%",t.style.position="absolute",t.style.top="0",t.style.left="0",t.style.backgroundColor="rgba(30, 30, 30, 0.4)",t.style.display="flex",t.style.justifyContent="center",t.style.alignItems="center",t.style.overflow="hidden",t.style.zIndex="9999",t.addEventListener("click",(e=>{e.target===t&&document.body.removeChild(t)}));const e=new Image;e.src=s,e.style.maxWidth="80%",e.style.maxHeight="80%",t.appendChild(e),document.body.appendChild(t)}else if("video"===n){const t=document.createElement("div");t.style.width="100%",t.style.height="100%",t.style.position="absolute",t.style.top="0",t.style.left="0",t.style.backgroundColor="rgba(30, 30, 30, 0.4)",t.style.display="flex",t.style.justifyContent="center",t.style.alignItems="center",t.style.overflow="hidden",t.style.zIndex="9999",t.addEventListener("click",(e=>{e.target===t&&document.body.removeChild(t)}));const e=document.createElement("video");e.src=s,e.style.maxWidth="80%",e.style.maxHeight="80%",e.setAttribute("preload","auto"),e.setAttribute("controls","true"),t.appendChild(e),document.body.appendChild(t)}})),this.table.on(ov.DBLCLICK_CELL,(t=>{if(t.federatedEvent){const e=vM(t.federatedEvent),i=this.table.scenegraph.getResizeColAt(e.abstractPos.x,e.abstractPos.y,e.eventArgs?.targetCell);if(this.table._canResizeColumn(i.col,i.row)&&i.col>=0){this.table.scenegraph.updateAutoColWidth(i.col),this.table.isPivotChart()&&this.table.scenegraph.updateChartSize(i.col);const t=this.table.stateManager;t.columnResize.col<t.table.frozenColCount&&!t.table.isPivotTable()&&!t.table.transpose&&t.table.scenegraph.component.setFrozenColumnShadow(t.table.frozenColCount-1,t.columnResize.isRightFrozen)}}})),this.table.isPivotTable()&&function(t){const e=t.internalProps.layoutMap.rowsDefine,i=t.internalProps.layoutMap.columnsDefine;for(let t=0;t<e.length;t++){const i=e[t];if("string"!=typeof i&&(i.drillDown||i.drillUp))return!0}for(let t=0;t<i.length;t++){const e=i[t];if("string"!=typeof e&&(e.drillDown||e.drillUp))return!0}return!1}(this.table)&&function(t){t.on(ov.MOUSEENTER_CELL,(e=>{const{col:i,row:r}=e;if(-1===i||-1===r)return;const n=t.internalProps.layoutMap.getHeaderDimension(i,r);n?.drillDown||n?.drillUp?t.stateManager.updateDrillState(n.dimensionKey,n.title,n.drillDown,n.drillUp,i,r):t.stateManager.updateDrillState(void 0,void 0,!1,!1,-1,-1)})),t.on(ov.MOUSELEAVE_TABLE,(e=>{t.stateManager.updateDrillState(void 0,void 0,!1,!1,-1,-1)}))}(this.table),function(t){let e=!1;e=t.isPivotTable()?t.internalProps.layoutMap.indicatorsDefine.some((t=>"string"!=typeof t&&"sparkline"===t.cellType)):t.internalProps.layoutMap.columnObjects.some((t=>"sparkline"===t.cellType));e&&(t.on(ov.MOUSEMOVE_CELL,(e=>{const{col:i,row:r,x:n,y:o}=e;"sparkline"!==t.getBodyColumnType(i,r)&&t.stateManager.updateSparklineHoverPose(-1,-1,0,0),t.stateManager.updateSparklineHoverPose(i,r,n,o)})),t.on(ov.MOUSELEAVE_TABLE,(e=>{t.stateManager.updateSparklineHoverPose(-1,-1,0,0)})))}(this.table),function(t){t.isPivotChart()&&t.scenegraph.tableGroup.addEventListener("click",(e=>{if(!t.stateManager.columnMove.moving&&!t.stateManager.columnResize.resizing)if("axis-label"===e.target.name){const i=vM(e),{col:r,row:n}=i.eventArgs,o=t.internalProps.layoutMap;let s,a;o.indicatorsAsCol?(s=o.getDimensionKeyInChartSpec(o.rowHeaderLevelCount,n)[0],a=o.getCellHeaderPaths(o.rowHeaderLevelCount-2,n).rowHeaderPaths):(s=o.getDimensionKeyInChartSpec(r,o.columnHeaderLevelCount)[0],a=o.getCellHeaderPaths(r,o.columnHeaderLevelCount-1).colHeaderPaths);const l=a.map((t=>({key:t.dimensionKey,value:t.value}))).filter((t=>t.key));if(l.push({key:s,value:e.target.attribute.text}),t._selectedDimensionInChart.length&&function(t,e){if(t.length!==e.length)return!1;for(let i=0;i<t.length;i++)if(t[i].key!==e[i].key||t[i].value!==e[i].value)return!1;return!0}(t._selectedDimensionInChart,l))return;t._selectedDimensionInChart=l,o.updateDataStateToChartInstance(),NT(t.scenegraph),t.scenegraph.updateNextFrame()}else t._selectedDimensionInChart?.length&&(t._selectedDimensionInChart.length=0,t.internalProps.layoutMap.updateDataStateToChartInstance(),NT(t.scenegraph),t.scenegraph.updateNextFrame())}))}(this.table),function(t){t.isPivotChart()&&(t.on(ov.MOUSEENTER_CELL,(e=>{t.scenegraph.getCell(e.col,e.row).forEachChildren((i=>{if("axis"===i.name){const i=MM(e.col,e.row,t.internalProps.layoutMap);e.axisPosition=i,t.fireListeners(ov.MOUSEENTER_AXIS,e)}}))})),t.on(ov.MOUSELEAVE_CELL,(e=>{t.scenegraph.getCell(e.col,e.row).forEachChildren((i=>{if("axis"===i.name){const i=MM(e.col,e.row,t.internalProps.layoutMap);e.axisPosition=i,t.fireListeners(ov.MOUSELEAVE_AXIS,e)}}))})))}(this.table)}dealTableHover(t){if(!t)return void this.table.stateManager.updateHoverPos(-1,-1);const{eventArgs:e}=t;e?this.table.stateManager.updateHoverPos(e.col,e.row):this.table.stateManager.updateHoverPos(-1,-1)}dealIconHover(t){const{eventArgs:e}=t;e?this.table.stateManager.updateHoverIcon(e.col,e.row,e.target,e.targetCell,e.event):this.table.stateManager.updateHoverIcon(-1,-1,void 0,void 0)}dealMenuHover(t){}dealTableSelect(t,e){if(!t)return this.table.stateManager.updateSelectPos(-1,-1),!1;const{eventArgs:i}=t;if(i){if("checkbox"===i.target.name)return!1;const r=this.table.getBodyColumnDefine(i.col,i.row);return this.table.isHeader(i.col,i.row)&&(r?.disableHeaderSelect||this.table.stateManager.select?.disableHeader)||!this.table.isHeader(i.col,i.row)&&r?.disableSelect?(e||this.table.stateManager.updateSelectPos(-1,-1),!1):!this.table.isPivotChart()||"axis-label"!==t?.eventArgs?.target.name&&"chart"!==t?.eventArgs?.target.type?(this.table.stateManager.updateSelectPos(i.col,i.row,i.event.shiftKey,i.event.ctrlKey||i.event.metaKey),!0):(this.table.stateManager.updateSelectPos(-1,-1),!1)}return!1}deelTableSelectAll(){this.table.stateManager.updateSelectPos(-1,-1,!1,!1,!0)}dealMenuSelect(t){}checkColumnResize(t,e){const{eventArgs:i}=t;if(i){const r=this.table.scenegraph.getResizeColAt(t.abstractPos.x,t.abstractPos.y,i.targetCell);if(this.table._canResizeColumn(r.col,r.row)&&r.col>=0)return e&&this.table.stateManager.startResizeCol(r.col,t.abstractPos.x,t.abstractPos.y,r.rightFrozen),!0}return!1}dealColumnResize(t,e){this.table.stateManager.updateResizeCol(t,e)}chechColumnMover(t){const{eventArgs:e}=t;return!!(e&&this.table.isHeader(e.col,e.row)&&function(t,e,i){for(let r=0;r<i.length;r++)if(qC(i[r],t,e))return!0;return!1}(e.col,e.row,this.table.stateManager.select.ranges)&&this.table._canDragHeaderPosition(e.col,e.row))&&(this.table.stateManager.startMoveCol(e.col,e.row,t.abstractPos.x,t.abstractPos.y),!0)}dealColumnMover(t){const{eventArgs:e}=t;this.table.stateManager.updateMoveCol(e.col,e.row,t.abstractPos.x,t.abstractPos.y)}startColumnResize(t){}dealIconClick(t,e){const{eventArgs:i}=e,{target:r,event:n,col:o,row:s}=i||{target:t.target,event:t,col:-1,row:-1},a=r;if(a.role&&a.role.startsWith("icon-"))return this.table.fireListeners(ov.ICON_CLICK,{name:a.name,x:(a.globalAABBBounds.x1+a.globalAABBBounds.x2)/2,y:a.globalAABBBounds.y2,col:o,row:s,funcType:a.attribute.funcType,icon:a}),!0;if(r instanceof Pl){const t=r.pickIcon(n.global);if(t)return this.table.fireListeners(ov.ICON_CLICK,{name:t.attribute.id,x:t.globalX+t.globalAABBBounds.width()/2,y:t.globalY+t.AABBBounds.height(),col:o,row:s,funcType:t.attribute.funcType,icon:t}),!0}return!1}release(){this.gesture.release()}}let PM;const EM=t=>{const e=t.value;return Number(e)>80?"#20a8d8":Number(e)>50?"#4dbd74":Number(e)>20?"#ffc107":"#f86c6b"};class HM extends cC{_showBar;_barColor;_barBgColor;_barPositiveColor;_barNegativeColor;_barAxisColor;_barHeight;_barBottom;_barPadding;_showBarMark;_barMarkPositiveColor;_barMarkNegativeColor;_barMarkWidth;_barMarkPosition;_barRightToLeft;static get DEFAULT(){return PM||(PM=new HM)}constructor(t={},e={}){super(t,e),this._showBar=t.showBar??!0,this._barColor=t.barColor??EM,this._barPositiveColor=t.barPositiveColor??"#4dbd74",this._barNegativeColor=t.barNegativeColor??"#f86c6b",this._barAxisColor=t.barAxisColor??"black",this._barBgColor=t.barBgColor,this._barHeight=t.barHeight??3,this._barHeight=t.barHeight??3,this._barBottom=t.barBottom??0,this._barPadding=t.barPadding??[1,1,1,1],this._showBarMark=t.showBarMark??!1,this._barMarkPositiveColor=t.barMarkPositiveColor??"#4dbd74",this._barMarkNegativeColor=t.barMarkNegativeColor??"#f86c6b",this._barMarkWidth=t.barMarkWidth??2,this._barMarkPosition=t.barMarkPosition??"right",this._barRightToLeft=t.barRightToLeft??!1}get showBar(){return this._showBar}set showBar(t){this._showBar=t}get barColor(){return this._barColor}set barColor(t){this._barColor=t}get barBgColor(){return this._barBgColor}set barBgColor(t){this._barBgColor=t}get barHeight(){return this._barHeight}set barHeight(t){this._barHeight=t}get barBottom(){return this._barBottom}set barBottom(t){this._barBottom=t}get barPositiveColor(){return this._barPositiveColor}set barPositiveColor(t){this._barPositiveColor=t}get barNegativeColor(){return this._barNegativeColor}set barNegativeColor(t){this._barNegativeColor=t}get barAxisColor(){return this._barAxisColor}set barAxisColor(t){this._barAxisColor=t}get barPadding(){return this._barPadding}set barPadding(t){this._barPadding=t}get showBarMark(){return this._showBarMark}set showBarMark(t){this._showBarMark=t}get barMarkPositiveColor(){return this._barMarkPositiveColor}set barMarkPositiveColor(t){this._barMarkPositiveColor=t}get barMarkNegativeColor(){return this._barMarkNegativeColor}set barMarkNegativeColor(t){this._barMarkNegativeColor=t}get barMarkWidth(){return this._barMarkWidth}set barMarkWidth(t){this._barMarkWidth=t}get barMarkPosition(){return this._barMarkPosition}set barMarkPosition(t){this._barMarkPosition=t}get barRightToLeft(){return this._barRightToLeft}set barRightToLeft(t){this._barRightToLeft=t}clone(){return new HM(this,null)}}const LM=["type","content","font","color","width","height","marginRight","marginLeft","src","svg","name","path","positionType","tooltip","hover","cursor","shape","interactive"];let kM,IM=class t extends cC{_size;_spaceBetweenTextAndIcon;static get DEFAULT(){return kM||(kM=new t)}constructor(t={},e={}){super(t,e),this._size=(t.size??e?.size)||14,this._spaceBetweenTextAndIcon=(t.spaceBetweenTextAndIcon??e?.spaceBetweenTextAndIcon)||8}get size(){return this._size}set size(t){this._size=t}get spaceBetweenTextAndIcon(){return this._spaceBetweenTextAndIcon}set spaceBetweenTextAndIcon(t){this._spaceBetweenTextAndIcon=t}clone(){return new t(this)}};class FM{expandIcon;collapseIcon;_table;constructor(t){this._table=t;const e=YS();this.expandIcon=e[eC.expandIconName],this.collapseIcon=e[eC.collapseIconName]}getIcons(t,e,i,r,n){const o=[],{icon:s}=this._table.getBodyColumnDefine(t,e);if(s){let n;if("function"==typeof s){n=s({col:t,row:e,value:i,dataValue:r,table:this._table})}else n=s;const a=YS(),l=t=>{let e;e="string"==typeof t?a[t]:t,e&&o.push(e)};Array.isArray(n)?n.forEach(((t,e)=>{l(t)})):l(n)}const a=this.getHierarchyIcon(t,e);return a&&o.push(a),n&&o.forEach(((i,r)=>{(i.content||i.src)&&(o[r]=this.getCellIconFromRecordValue(i,t,e))})),o}getStyleClass(t){switch(t){case"text":case"link":return uC;case"image":case"video":return dC;case"chart":case"sparkline":return cC;case"progressbar":return HM;case"checkbox":return IM}}getCellIconFromRecordValue(t,e,i){if(Array.isArray(t))return t.map((t=>this.getCellIconFromRecordValue(t,e,i)));if(!tv.isObject(t)||"function"==typeof t)return this._table.getFieldData(t,e,i);const r={},n=t;return LM.forEach((t=>{if(void 0!==n[t]){const o=this._table.getFieldData(n[t],e,i);null!=o?r[t]=o:this._table._hasField?.(n[t],e,i)||(r[t]=n[t])}})),r}getHierarchyIcon(t,e){const i=this._table.getHierarchyState(t,e);return i===qy.expand?this.expandIcon:i===qy.collapse?this.collapseIcon:void 0}}function zM(t,e){const i=document.createElement(t);return e&&i.classList.add(...e),i}!function(){if("node"===CC.mode)return;const t=document.createElement("style");t.id="vtable-menu-styleSheet",t.textContent="\n@keyframes vtable__menu-element--shown-animation {\n\t0% {\n\t\topacity: 0;\n\t}\n\t100% {\n\t\topacity: 1;\n\t}\n}\n.vtable__menu-element {\n\tposition: absolute;\n\tbox-sizing: border-box;\n\tborder-radius: 4px;\n\tbackground-color: #fff;\n\tpadding: 6px 0;\n\t/* pointer-events: none; */\n\tuser-select: none;\n\tcolor: #000;\n\tmax-width: 300px;\n\tz-index: 99999;\n\tborder: #CCC 0.5px solid;\n\tcursor: default;\n\twidth: max-content;\n\tbox-shadow: 0px 8px 16px rgba(27, 31, 35, 0.12);\n}\n.vtable__menu-element--hidden {\n\topacity: 0;\n\t/* transform: translate(-50%, -50%); */\n\ttransition: opacity 75ms linear;\n\tz-index: -9999;\n}\n.vtable__menu-element--shown {\n\topacity: 1;\n\t/* transform: translate(-50%, -50%); */\n\tanimation: vtable__menu-element--shown-animation 150ms ease-out;\n}\n.vtable__menu-element__content {\n\tfont-family: Roboto;\n\tfont-size: 12px;\n\toverflow: hidden;\n\tdisplay: inline-block;\n\t/* height: 100%; */\n\tline-height: 30px;\n}\n.vtable__menu-element__item {\n\theight: 32px;\n\tpadding: 0px 12px;\n\tcursor: pointer;\n\tposition: relative;\n\tdisplay: flex;\n\talign-items: center;\n\tjustify-content: flex-start;\n}\n.vtable__menu-element__item:hover {\n\tbackground-color: rgba(27, 31, 35, 0.06);\n}\n.vtable__menu-element__icon{\n\t/* vertical-align: top; */\n\tdisplay: flex;\n\t/* line-height: 30px; */\n\tmargin-right: 6px;\n}\n.vtable__menu-element__no-event {\n\tpointer-events: none;\n}\n.vtable__menu-element--select {\n\tcolor: #2E68CF;\n}.vtable__menu-element--normal {\n\tcolor: rgba(20, 20, 20, 0.9);;\n}\n.vtable__menu-element__split {\n\theight: 0px;\n\tborder: 1px solid rgb(209, 213, 218);\n\tmargin: 5px 0;\n}\n.vtable__menu-element__title {\n\tcolor: rgb(149, 149, 149);\n}\n.vtable__menu-element__arrow {\n\tposition: absolute;\n\tright: 3px;\n\tfont-weight: bold;\n\tmargin-top: 1px;\n}\n.vtable__menu-element__item-text {\n\tmargin-right: 15px;\n}\n",document.head.appendChild(t)}();const OM="vtable__menu-element",DM=`${OM}__item`,WM=`${OM}__content`,NM=`${OM}--hidden`,GM=`${OM}--shown`,jM=`${OM}--normal`,UM=`${OM}--select`,VM=`${OM}__icon`,KM=`${OM}__split`,$M=`${OM}__title`,XM=`${OM}__arrow`,YM=`${OM}__no-event`,qM=`${OM}__item-text`;function ZM(){return zM("div",[OM,NM])}function JM(t,e,i,r,n,o){const s=t.getCellRange(r,n);for(let r=0;r<e.length;r++){const n=e[r];let{col:o,row:a}=n;const{field:l,menuKey:h}=n;if("number"!=typeof o||"number"!=typeof a)if(t.isPivotTable()&&(Array.isArray(l),1)){const e=t.internalProps.layoutMap.getPivotCellAdress(l);if(!e)continue;o=e.col,a=e.row}else{const e=t.internalProps.layoutMap.getHeaderCellAddressByField(l);if(!e)continue;o=e.col,a=e.row}if(Y(o)&&Y(a)&&qC(s,o,a)&&i===h)return!0}return!1}class QM{_handler;_rootElement;_secondElement;_menuInstanceInfo;_showChildrenIndex;_mouseEnterSecondElement;constructor(t){this._handler=new cv,this._rootElement=ZM(),this._secondElement=ZM(),this._secondElement.sub=!0,this._showChildrenIndex=-1,this._rootElement.addEventListener("wheel",(t=>{t.stopPropagation()})),this._rootElement?.addEventListener("mousedown",(t=>{t.stopPropagation(),t.preventDefault()})),this._rootElement?.addEventListener("touchend",(e=>{if(e.stopPropagation(),e.preventDefault(),this._rootElement.classList.contains(NM))return;const{col:i,row:r,dropDownIndex:n,menuKey:o,text:s,hasChildren:a}=e.target;if("number"!=typeof n||a)return void e.stopPropagation();const l=t.isPivotTable()?t.internalProps.layoutMap.getPivotDimensionInfo(i,r):t.getHeaderField(i,r),h=t._dropDownMenuIsHighlight(i,r,n);t.fireListeners(ov.DROPDOWN_MENU_CLICK,{col:i,row:r,field:l,menuKey:o,text:s,highlight:h,cellLocation:t.getCellLocation(i,r)}),t.fireListeners(ov.DROPDOWN_MENU_CLEAR,null),t.fireListeners(ov.HIDE_MENU,null),e.stopPropagation()})),this._rootElement?.addEventListener("click",(e=>{if(e.stopPropagation(),e.preventDefault(),this._rootElement.classList.contains(NM))return;const{col:i,row:r,dropDownIndex:n,menuKey:o,text:s,hasChildren:a}=e.target;if("number"!=typeof n||a)return void e.stopPropagation();const l=t.isPivotTable()?t.internalProps.layoutMap.getPivotDimensionInfo(i,r):t.getHeaderField(i,r),h=t._dropDownMenuIsHighlight(i,r,n);t.fireListeners(ov.DROPDOWN_MENU_CLICK,{col:i,row:r,field:l,menuKey:o,text:s,highlight:h,cellLocation:t.getCellLocation(i,r)}),t.fireListeners(ov.DROPDOWN_MENU_CLEAR,null),t.fireListeners(ov.HIDE_MENU,null),e.stopPropagation()})),this._rootElement?.addEventListener("mousemove",(e=>{if(this._rootElement.classList.contains(NM))return;e.stopPropagation();const{hasChildren:i,dropDownIndex:r,col:n,row:o,sub:s}=e.target;if(i){this._showChildrenIndex=r;const i=this._secondElement;i?.classList.remove(NM),i?.classList.add(GM),i.innerHTML="";const s=this._menuInstanceInfo.content[r]?.children;for(let e=0;e<s.length;e++){const r=s[e],a=tR(r,!!t.stateManager.menu.dropDownMenuHighlight&&JM(t,t.stateManager.menu.dropDownMenuHighlight,"object"==typeof r?r?.menuKey||r?.text:r,n,o));a.col=n,a.row=o,a.dropDownIndex=e,"string"==typeof r?(a.text=r,a.menuKey=r):"object"==typeof r&&(a.text=r.text,a.menuKey=r.menuKey||r.text),a.sub=!0,a.sub=!0,i.appendChild(a)}const a=e.target.getBoundingClientRect();this._bindSecondElement(t,n,o,a.right,a.top)}else if(i&&this._showChildrenIndex===r){const t=this._secondElement;t?.classList.remove(NM),t?.classList.add(GM)}else!s&&this._secondElement?.classList.contains(GM)&&setTimeout((()=>{if(!0!==this._mouseEnterSecondElement){this._showChildrenIndex=-1;const t=this._secondElement;t?.classList.remove(GM),t?.classList.add(NM)}}),300)})),this._secondElement?.addEventListener("wheel",(t=>{t.stopPropagation()})),this._secondElement?.addEventListener("mousemove",(t=>{this._rootElement.classList.contains(NM)||t.stopPropagation()})),this._secondElement?.addEventListener("mouseenter",(t=>{this._mouseEnterSecondElement=!0})),this._secondElement?.addEventListener("mouseleave",(t=>{this._mouseEnterSecondElement=!1})),this._secondElement?.addEventListener("mousedown",(t=>{t.stopPropagation(),t.preventDefault()})),this._secondElement?.addEventListener("click",(e=>{if(e.stopPropagation(),e.preventDefault(),this._secondElement.classList.contains(NM))return;const{col:i,row:r,dropDownIndex:n,menuKey:o,text:s,hasChildren:a}=e.target;if("number"!=typeof n||a)return void e.stopPropagation();const l=t.isPivotTable()?t.internalProps.layoutMap.getPivotDimensionInfo(i,r):t.getHeaderField(i,r);let h=!1;this._menuInstanceInfo.content.forEach(((e,n)=>{if("object"==typeof e&&e.children&&e.children.length)for(let n=0;n<e.children.length;n++){const s=e.children[n];if(JM(t,t.stateManager.menu.dropDownMenuHighlight,"object"==typeof s?s?.menuKey:s,i,r)&&o===("object"==typeof s?s?.menuKey:s))return void(h=!0)}})),t.fireListeners(ov.DROPDOWN_MENU_CLICK,{col:i,row:r,field:l,cellHeaderPaths:t.isPivotTable()?t.getCellHeaderPaths(i,r):void 0,menuKey:o,text:s,highlight:h,cellLocation:t.getCellLocation(i,r)}),t.fireListeners(ov.DROPDOWN_MENU_CLEAR,null),t.fireListeners(ov.HIDE_MENU,null),e.stopPropagation()}))}get rootElement(){return this._rootElement}release(){this.unbindFromCell();const t=this._rootElement;t?.parentElement&&t.parentElement.removeChild(t),this._handler.release(),delete this._rootElement}bindToCell(t,e,i,r){const n=this._rootElement,o=this._secondElement;if(this._menuInstanceInfo=r,n?.classList.remove(GM),n?.classList.add(NM),o?.classList.remove(GM),o?.classList.add(NM),this._canBindToCell(t,e,i)){if(n.innerHTML="",Array.isArray(r.content)){const o=r.content;for(let r=0;r<o?.length;r++){const s=o[r];let a=!!t.stateManager.menu.dropDownMenuHighlight&&JM(t,t.stateManager.menu.dropDownMenuHighlight,"object"==typeof s?s?.menuKey||s?.text:s,e,i);if(t.stateManager.menu.dropDownMenuHighlight&&"object"==typeof s&&Array.isArray(s.children)&&s.children.length)for(let r=0;r<s.children.length;r++){const n=s.children[r];if(JM(t,t.stateManager.menu.dropDownMenuHighlight,"object"==typeof n?n?.menuKey||n?.text:n,e,i)){a=!0;break}}const l=tR(s,a);l.col=e,l.row=i,l.dropDownIndex=r,"string"==typeof s?(l.text=s,l.menuKey=s):"object"==typeof s&&(l.text=s.text,l.menuKey=s.menuKey||s.text,s.children?.length&&(l.hasChildren=!0)),n.appendChild(l)}}if(this._bindToCell(t,e,i,r.position,r.referencePosition))return n?.classList.add(GM),n?.classList.remove(NM),!0}else this.unbindFromCell();return!1}unbindFromCell(){const t=this._rootElement,e=this._secondElement;this._menuInstanceInfo=void 0,t?.parentElement&&(t.classList.remove(GM),t.classList.add(NM)),e?.parentElement&&(e.classList.remove(GM),e.classList.add(NM))}_canBindToCell(t,e,i){const r=t.getCellRangeRelativeRect({col:e,row:i}),n=t.getElement(),{top:o,bottom:s,left:a,right:l}=r;if(t.isFrozenCell(e,i))return!0;if(s<t.getFrozenRowsHeight()||l<t.getFrozenColsWidth()||a>t.tableNoFrameWidth-t.getRightFrozenColsWidth()||o>t.tableNoFrameHeight-t.getBottomFrozenRowsHeight())return!1;const{offsetHeight:h,offsetWidth:c}=n;return!(h<o)&&!(c<a)}_bindToCell(t,e,i,r,n){const o=this._rootElement,s=t.getElement(),{width:a,height:l}=t.internalProps.element.getBoundingClientRect();if(o){o.parentElement!==s&&s.appendChild(o),o.style.left="0px";const t=.8*a;o.style.maxWidth=`${t}px`;const e=o.clientWidth,i=o.clientHeight;let h,c;return r?(h=r.x,c=r.y):n&&(h=n.rect.right-e,c=n.rect.bottom),c+i>l&&(c=l-i),c<0&&(c/=2),o.style.top=`${c}px`,h<0?h=0:h+e>a&&(h=a-e),o.style.left=`${h}px`,!0}return!1}_bindSecondElement(t,e,i,r,n){const o=this._secondElement,s=this._rootElement,a=t.getElement(),{width:l,left:h,top:c}=t.internalProps.element.getBoundingClientRect(),{x:d,y:u,width:g}=s.getBoundingClientRect();if(o){o.parentElement!==a&&a.appendChild(o),o.style.left="0px";const t=.8*l;o.style.maxWidth=`${t}px`;const e=o.clientWidth,i=n-4-c,s=r-h;o.style.top=`${i}px`;let d=s;return d+e>l?d=d-e-g:d+=4,o.style.left=`${d}px`,!0}return!1}pointInMenuElement(t,e){const i=this._rootElement,{x:r,y:n,width:o,height:s}=i.getBoundingClientRect();if(t>r-5&&t<r+o+5&&e>n-5&&e<n+s+5)return!0;if(this._secondElement){const{x:r,y:n,width:o,height:s}=i.getBoundingClientRect();if(t>r-5&&t<r+o+5&&e>n-5&&e<n+s+5)return!0}return!1}}function tR(t,e){const i=zM("div",[DM,e?UM:jM]);if("string"==typeof t){const e=zM("span",[WM,YM,qM]);e.innerHTML=t,i.appendChild(e)}else if("object"==typeof t){const r=t.type??"item";if("split"===r)return i?.classList.add(KM),i;if(t?.icon?.svg)if(xv.test(t.icon.svg)){const e=new Image;t.icon.width?e.style.width=t.icon.width.toString()+"px":e.style.width="16px",t.icon.height?e.style.height=t.icon.height.toString()+"px":e.style.height="16px",e.src=t.icon.svg,i.appendChild(e)}else{const r=zM("span",[VM,YM]);r.innerHTML=e&&t.selectedIcon&&t.selectedIcon.svg?t.selectedIcon.svg:t.icon.svg,t.icon.width&&r.children[0].setAttribute("width",t.icon.width.toString()),t.icon.height&&r.children[0].setAttribute("height",t.icon.height.toString()),i.appendChild(r)}const n=zM("span",[WM,YM,qM]);if(n.innerHTML=t.text,i.appendChild(n),"title"===r)i?.classList.add(YM,$M);else if(t?.children?.length){const t=zM("span",[WM,YM,XM]);t.innerHTML=e?'<svg width="8" height="12" viewBox="0 0 10 17" fill="none" xmlns="http://www.w3.org/2000/svg" style="vertical-align: baseline"><path d="M1.78186 16.7729L0.300378 15.2915L6.8189 8.77295L0.300377 2.25443L1.78186 0.77295L9.78186 8.77295L1.78186 16.7729Z" fill="#2E68CF" fill-opacity="0.65"></path></svg>':'<svg width="8" height="12" viewBox="0 0 10 17" fill="none" xmlns="http://www.w3.org/2000/svg" style="vertical-align: baseline"><path d="M1.78186 16.7729L0.300378 15.2915L6.8189 8.77295L0.300377 2.25443L1.78186 0.77295L9.78186 8.77295L1.78186 16.7729Z" fill="#141414" fill-opacity="0.65"></path></svg>',i.appendChild(t)}}return i}let eR,iR;class rR extends fC{static get DEFAULT(){return eR||(eR=new rR)}constructor(t={},e={}){super(t,e),this.textAlign=(t.textAlign??e?.textAlign)||"center"}clone(){return new rR(this)}}class nR extends fC{_size;_spaceBetweenTextAndIcon;static get DEFAULT(){return iR||(iR=new nR)}constructor(t={},e={}){super(t,e),this._size=(t.size??e?.size)||14,this._spaceBetweenTextAndIcon=(t.spaceBetweenTextAndIcon??e?.spaceBetweenTextAndIcon)||8}get size(){return this._size}set size(t){this._size=t}get spaceBetweenTextAndIcon(){return this._spaceBetweenTextAndIcon}set spaceBetweenTextAndIcon(t){this._spaceBetweenTextAndIcon=t}clone(){return new nR(this)}}class oR{normalIcon;upIcon;downIcon;freezeIcon;frozenIcon;frozenCurrentIcon;dropDownAbsoluteIcon;expandIcon;collapseIcon;_table;constructor(t){this._table=t;const e=YS();this.freezeIcon=e[eC.freezeIconName],this.frozenIcon=e[eC.frozenIconName],this.frozenCurrentIcon=e[eC.frozenCurrentIconName],this.normalIcon=e[eC.normalIconName],this.upIcon=e[eC.upwardIconName],this.downIcon=e[eC.downwardIconName],this.dropDownAbsoluteIcon=e[eC.dropdownIconName],this.expandIcon=e[eC.expandIconName],this.collapseIcon=e[eC.collapseIconName]}getIcons(t,e){const i=[];if(this._table.isPivotTable()){const{showSort:r}=this._table.internalProps.layoutMap.getHeader(t,e);if(r){const r=this._table.getPivotSortState(t,e),n="asc"===r?this.downIcon:"desc"===r?this.upIcon:this.normalIcon;n&&i.push(n)}}else{const r=this._table.sortState;let n;n=void 0;const o=this._table.getCellRange(t,e);if(r)if(Array.isArray(r))for(let t=0;t<r.length;t++){const e=r[t],i=this._table._getHeaderCellBySortState(e);if(i&&qC(o,i.col,i.row)){({order:n}=e);break}}else{const t=this._table._getHeaderCellBySortState(r);t&&qC(o,t.col,t.row)&&({order:n}=r)}const s=this.getSortIcon(n,this._table,t,e);s&&i.push(s)}if(this._table.showFrozenIcon&&t<this._table.allowFrozenColCount){const r=this.getFrozenIcon(t,e);r&&i.push(r)}if(this.checkDropDownIcon(this._table,t,e)){const t=this.dropDownAbsoluteIcon;i.push(t)}const r=this.getDropDownStateIcons(this._table,t,e);r.length&&i.push(...r);const{headerIcon:n}=this._table._getHeaderLayoutMap(t,e),o=this.getHierarchyIcon(t,e);if(o&&i.push(o),n){let r;if("function"==typeof n){r=n({col:t,row:e,value:this._table.getCellValue(t,e),dataValue:this._table.getCellOriginValue(t,e),table:this._table})}else r=n;const o=YS(),s=t=>{let e;e="string"==typeof t?o[t]:t,e&&i.push(e)};Array.isArray(r)?r.forEach(((t,e)=>{s(t)})):s(r)}return i}getFrozenIcon(t,e){if(this._table.isPivotTable()||this._table.transpose)return null;if(this._table.rightFrozenColCount&&t>=this._table.colCount-this._table.rightFrozenColCount)return null;const i=this._table.getHeaderDefine(t,e);if(i.columns&&i.columns.length>0)return null;let r=this.freezeIcon;return this._table.options.frozenColCount-1>t?r=this.frozenIcon:this._table.options.frozenColCount-1===t&&(r=this.frozenCurrentIcon),r}getSortIcon(t,e,i,r){const n="asc"===t?this.downIcon:"desc"===t?this.upIcon:this.normalIcon,o=e.getHeaderDefine(i,r);return!o||!o.showSort&&!o.sort||o.columns&&o.columns.length>0?null:n}getDropDownStateIcons(t,e,i){const r=t.getHeaderDefine(e,i),n=t._getHeaderLayoutMap(e,i),{dropDownMenu:o}=n,s=[];if(Array.isArray(o)&&o.length||Array.isArray(t.globalDropDownMenu)&&t.globalDropDownMenu.length&&!r?.columns?.length){const r=o||t.globalDropDownMenu;let n=-1,a=-1;for(let o=0;o<r.length;o++){const s=r[o];if("object"==typeof s&&s.children&&s.children.length)for(let r=0;r<s.children.length;r++){const l=s.children[r];if(t.stateManager.menu?.dropDownMenuHighlight&&JM(t,t.stateManager.menu?.dropDownMenuHighlight,"object"==typeof l?l?.menuKey:l,e,i)){n=o,a=r;break}}if(t._dropDownMenuIsHighlight(e,i,o)){n=o;break}}if(-1!==n){let e;e=-1!==a?(o||t.globalDropDownMenu)[n].children[a]:(o||t.globalDropDownMenu)[n],e.stateIcon&&(e.stateIcon.svg?s.push({type:"svg",name:e.stateIcon.src||e.stateIcon.svg,width:e.stateIcon.width||22,height:e.stateIcon.height||22,svg:e.stateIcon.svg,positionType:Qy.right,marginRight:0,funcType:tC.dropDownState,interactive:!1}):e.stateIcon.src&&s.push({type:"image",name:e.stateIcon.src||e.stateIcon.svg,width:e.stateIcon.width||22,height:e.stateIcon.height||22,src:e.stateIcon.src,positionType:Qy.right,marginRight:0,funcType:tC.dropDownState,interactive:!1}))}}return s}getDropDownIconRect(t,e,i){const r=this.downIcon.hover?.width??this.downIcon?.width??0,n=this.downIcon.hover?.height??this.downIcon?.height??0,o=t.right-2-r,s=t.right-2;let a;a="middle"===i?t.top+t.height/2-r/2:"top"===i?t.top+e/2:"bottom"===i?t.bottom-2*e:t.top;return{left:o,right:s,top:a,bottom:n+a,width:r,height:n}}getHierarchyIcon(t,e){const{hierarchyState:i}=this._table._getHeaderLayoutMap(t,e);if(i){if(i===qy.expand)return this.expandIcon;if(i===qy.collapse)return this.collapseIcon}}checkDropDownIcon(t,e,i){if(t.isPivotTable()){const r=t._getHeaderLayoutMap(e,i);if(Array.isArray(r.dropDownMenu)&&r.dropDownMenu.length)return!0}else{const r=t.getHeaderDefine(e,i);if(Array.isArray(r.dropDownMenu)&&r.dropDownMenu.length||(!Array.isArray(r.dropDownMenu)||0!==r.dropDownMenu.length)&&Array.isArray(t.globalDropDownMenu)&&t.globalDropDownMenu.length&&!r?.columns?.length)return!0}return!1}getStyleClass(t){switch(t){case"text":case"link":return bC;case"image":case"video":return rR;case"checkbox":return nR}}}class sR{_table;_tooltipElement;constructor(t){this._table=t}release(){this.unbindTooltipElement(),this._tooltipElement&&this._tooltipElement.release?.(),this._tooltipElement=void 0}_getTooltipElement(){return this._tooltipElement||(this._tooltipElement=this.createTooltipElementInternal()),this._tooltipElement}bindTooltipElement(t,e,i,r){return this._getTooltipElement().bindToCell(this._table,t,e,i,r)}moveTooltipElement(t,e,i,r){this._getTooltipElement().move(this._table,t,e,i,r)}unbindTooltipElement(){this._getTooltipElement().unbindFromCell()}locateTooltipElement(t,e,i,r,n){this._getTooltipElement()._locate(this._table,t,e,i,r,n)}}!function(){if("node"===CC.mode)return;const t=document.createElement("style");t.id="vtable-tooltip-styleSheet",t.textContent="\n@keyframes vtable__bubble-tooltip-element--shown-animation {\n\t0% {\n\t\topacity: 0;\n\t}\n\t100% {\n\t\topacity: 1;\n\t}\n}\n.vtable__bubble-tooltip-element {\n\tposition: absolute;\n\t\n\tpointer-events: none;\n\tuser-select: none;\n\tmax-width: 300px;\n\tz-index: 99999;\n\n\tbackground: #FFFFFF;\n    border: 1px solid #E6E8ED;\n    box-sizing: border-box;\n    border-radius: 4px;\n    box-shadow: 0px 2px 4px rgb(27 31 35 / 8%);\n    color: #141414;\n    font-size: 13px;\n}\n.vtable__bubble-tooltip-element--hidden {\n\topacity: 0;\n\t/* transform: translate(-50%, -50%); */\n\ttransition: opacity 75ms linear;\n}\n.vtable__bubble-tooltip-element--shown {\n\topacity: 1;\n\t/* transform: translate(-50%, -50%); */\n\tanimation: vtable__bubble-tooltip-element--shown-animation 150ms ease-out;\n}\n.vtable__bubble-tooltip-element__content {\n\t/* font-size: .75rem; */\n\tpadding: 6px 8px;\n\tmin-height: 1em;\n\tline-height: 1.5;\n\twidth: 100%;\n\tdisplay: block;\n\twhite-space: pre-wrap;\n\tmargin: 0;\n\tbox-sizing: border-box;\n\toverflow: hidden;\n\tword-wrap: break-word;\n\tposition: relative;\n\tbackground-color: #FFF;\n\tz-index: 2;\n\tborder-radius: 4px\n}\n.vtable__bubble-tooltip-element__triangle {\n\t/* font-size: .75rem; */\n\tposition: absolute;\n\twidth: 10px;\n\theight: 10px;\n\tdisplay: block;\n\ttransform: rotate(45deg);\n    transform-origin: 50% 50% 0;\n\tz-index: 1;\n\tbackground-color: #FFF;\n\tborder: 1px solid #E6E8ED;\n}\n",document.head.appendChild(t)}();const aR="vtable__bubble-tooltip-element",lR=`${aR}__content`,hR=`${aR}__triangle`,cR=`${aR}--hidden`,dR=`${aR}--shown`;class uR{_handler;_rootElement;_messageElement;_triangleElement;constructor(){this._handler=new cv;const t=this._rootElement=zM("div",[aR,cR]),e=zM("span",[lR]),i=zM("span",[hR]);t.appendChild(i),t.appendChild(e),this._messageElement=t.querySelector(`.${lR}`)||void 0,this._triangleElement=t.querySelector(`.${hR}`)||void 0}bindToCell(t,e,i,r,n){const o=this._rootElement,s=this._messageElement,a=this._triangleElement;if(o?.classList.remove(dR),o?.classList.add(cR),this._canBindToCell(t,e,i)){s.setAttribute("style",""),a.setAttribute("style",""),r?.className&&o.classList.add(r.className),r?.style?.bgColor&&(s.style.backgroundColor=r?.style?.bgColor),r?.style?.bgColor&&(a.style.backgroundColor=r?.style?.bgColor),a.style.display=!0===r?.style?.arrowMark?"block":"none",r?.style?.fontSize&&(s.style.fontSize=(r?.style?.fontSize??12)+"px"),r?.style?.fontFamily&&(s.style.fontFamily=r?.style?.fontFamily),r?.style?.color&&(s.style.color=r?.style?.color),r?.style?.padding&&(s.style.padding=`${r?.style?.padding.join("px ")}px`),s&&(s.textContent=r?.content);if(this._bindToCell(t,e,i,r?.position,r?.referencePosition,n,r?.style?.arrowMark))return o?.classList.add(dR),o?.classList.remove(cR),!0}else this.unbindFromCell();return!1}release(){this.unbindFromCell();const t=this._rootElement;t?.parentElement&&t.parentElement.removeChild(t),this._handler?.release?.(),delete this._rootElement,delete this._messageElement}move(t,e,i,r,n){const o=this._rootElement;this._canBindToCell(t,e,i)?(this._bindToCell(t,e,i,r?.position,r?.referencePosition,n),o?.classList.add(dR),o?.classList.remove(cR)):this.unbindFromCell()}unbindFromCell(){const t=this._rootElement;t?.parentElement&&(t.classList.remove(dR),t.classList.add(cR))}_canBindToCell(t,e,i){const r=t.getCellRangeRelativeRect({col:e,row:i}),n=t.getElement(),{bottom:o,left:s,right:a,top:l}=r;if(t.isFrozenCell(e,i))return!0;if(o<t.getFrozenRowsHeight()||a<t.getFrozenColsWidth()||s>t.tableNoFrameWidth-t.getRightFrozenColsWidth()||l>t.tableNoFrameHeight-t.getBottomFrozenRowsHeight())return!1;const{offsetHeight:h,offsetWidth:c}=n;return!(l>h)&&!(s>c)}_bindToCell(t,e,i,r,n,o,s){const a=this._rootElement,l=t.getCellRangeRelativeRect({col:e,row:i}),h=t.getElement(),c=t.internalProps.element.offsetWidth,{width:d}=l;if(a){let l,u;a.parentElement!==h&&h.appendChild(a),a.style.left="0px";const g=Math.min(.8*c,4*d);a.style.maxWidth=`${g}px`;const p=a.clientWidth,f=a.clientHeight;if(!r&&!n)return!1;{const a=this.getComputedPosition(t,e,i,r,n,o,s);u=a.x,l=a.y}a.style.left=`${u}px`,a.style.top=`${l}px`,LC()&&(a.style.fontSize="11px");const{x1:m,x2:b,y1:y,y2:C}=t.stateManager.menu.bounds,v=u,w=v+p,x=l,_=v+f;return!(t.stateManager.menu.isShow&&m<w&&b>v&&C>x&&y<_)}return!1}getComputedPosition(t,e,i,r,n,o,s){const a=this._rootElement,l=t.getCellRangeRelativeRect({col:e,row:i}),{width:h,height:c}=t.internalProps.element.getBoundingClientRect(),{width:d}=l;let u,g;const p=Math.min(.8*h,4*d);a.style.maxWidth=`${p}px`;const f=a.clientWidth,m=a.clientHeight,b=s?6:0;if(r)g=r.x,u=r.y+b,this._triangleElement.style.left="50%",this._triangleElement.style.marginLeft="-5px",this._triangleElement.style.top="-5px";else if(n){let t=n.placement??Yy.bottom;const e=n.rect.left+n.rect.width/2,i=n.rect.top+n.rect.height/2,r=n.rect.top,s=n.rect.bottom,a=n.rect.left,l=n.rect.right;let d=0;const p=()=>{d++,d>=4||(this.removeStyleFromTriangle(),t===Yy.top?(g=e-f/2,u=r-m-b,this._triangleElement.style.left="50%",this._triangleElement.style.marginLeft="-5px",this._triangleElement.style.bottom="-5px",o&&u<0&&(t=Yy.right,p())):t===Yy.bottom?(g=e-f/2,u=s+b,this._triangleElement.style.left="50%",this._triangleElement.style.marginLeft="-5px",this._triangleElement.style.top="-5px",o&&u+m>c&&(t=Yy.left,p())):t===Yy.left?(u=i-m/2,g=a-f-b,this._triangleElement.style.top="50%",this._triangleElement.style.marginTop="-5px",this._triangleElement.style.right="-5px",o&&g<0&&(t=Yy.top,p())):t===Yy.right&&(u=i-m/2,g=l+b,this._triangleElement.style.top="50%",this._triangleElement.style.marginTop="-5px",this._triangleElement.style.left="-5px",o&&g+f>h&&(t=Yy.bottom,p())))};p()}return o&&(g<0?g=0:g+a.offsetWidth>h&&(g=h-a.offsetWidth)),{x:g,y:u}}removeStyleFromTriangle(){this._triangleElement.style.left="",this._triangleElement.style.right="",this._triangleElement.style.top="",this._triangleElement.style.bottom="",this._triangleElement.style.marginLeft="",this._triangleElement.style.marginTop=""}_locate(t,e,i,r,n,o){const s=this.getComputedPosition(t,e,i,r,n,o),a=s.x,l=s.y;this._rootElement.style.left=`${a}px`,this._rootElement.style.top=`${l}px`}}class gR extends sR{createTooltipElementInternal(){return new uR}}const pR={"bubble-tooltip":function(t){return new gR(t)}};class fR{_table;_tooltipInstances;_attachInfo;confine;constructor(t,e){this._table=t,this._tooltipInstances={},this._bindTableEvent(t),this.confine=e}release(){const t=this._tooltipInstances;for(const e in t)t[e]?.release?.();delete this._tooltipInstances,this._attachInfo=null}_bindToCell(t,e,i){const r=this._attachInfo,n=this._getTooltipInstanceInfo(t,e);if(!r||n&&r.instance===n||(r.instance?.unbindTooltipElement(),this._attachInfo=null),!n)return;if(n&&n.bindTooltipElement(t,e,i,this.confine)){const r=this._table.getCellRange(t,e);this._attachInfo={range:r,instance:n,tooltipOptions:i}}}_move(t,e,i){const r=this._attachInfo;if(!r||!qC(r.range,t,e))return;const{instance:n}=r;n?.moveTooltipElement(t,e,i,this.confine)}moveToPosition(t,e,i,r){const n=this._attachInfo;if(!n||!qC(n.range,t,e))return;const{instance:o}=n;this._attachInfo.tooltipOptions.position=i,this._attachInfo.tooltipOptions.referencePosition=r,o?.locateTooltipElement(t,e,i,r,this.confine)}_unbindFromCell(){const t=this._attachInfo;if(!t)return;const{instance:e}=t;e?.unbindTooltipElement(),this._attachInfo=null}_isBindCell(t,e){const i=this._attachInfo;return!!i&&qC(i.range,t,e)}_bindTableEvent(t){t.on(ov.MOUSEENTER_CELL,(e=>{if(LC())return;const{x1:i,x2:r,y1:n,y2:o}=t.stateManager.menu.bounds;if(t.stateManager.menu.isShow&&"number"==typeof e.x&&"number"==typeof e.y&&e.x>i&&e.x<r&&e.y>n&&e.y<o)return;const{col:s,row:a}=e;let l;const h=t.getHeaderDescription(s,a);if(h){const e=t.getCellRangeRelativeRect({col:s,row:a});l={content:h,referencePosition:{placement:Yy.bottom,rect:e},style:{arrowMark:!1}}}else if(t.internalProps.tooltip?.isShowOverflowTextTooltip){const e=t.getCellOverflowText(s,a),i=t.getCellRangeRelativeRect({col:s,row:a});e&&(l={content:h?`${h}\n    ${e}`:e,referencePosition:{placement:Yy.bottom,rect:i},style:t.theme.tooltipStyle})}l&&this._bindToCell(e.col,e.row,l)})),t.on(ov.MOUSEMOVE_CELL,(e=>{if(!LC()){if(this._attachInfo?.tooltipOptions?.referencePosition){const i=this._attachInfo.tooltipOptions.referencePosition,{event:r}=e,{left:n,right:o,top:s,bottom:a}=i.rect,l=t._getMouseAbstractPoint(r,!1);l.inTable&&l.x>=n-5&&l.x<=o+5&&l.y>=s-5&&l.y<=a+5||this._unbindFromCell()}this._attachInfo&&t.stateManager.menu.isShow&&this._bindToCell(e.col,e.row)}})),t.on(ov.MOUSELEAVE_CELL,(t=>{this._unbindFromCell()})),t.on(ov.SELECTED_CELL,(t=>{this._isBindCell(t.col,t.row)&&this._unbindFromCell()})),t.on(ov.MOUSELEAVE_TABLE,(t=>{this._unbindFromCell()})),t.on(ov.SCROLL,(e=>{const i=this._attachInfo;if(i?.tooltipOptions&&i?.range?.start){const{col:e,row:r}=i.range.start,n=t.getCellRangeRelativeRect({col:e,row:r});i.tooltipOptions.referencePosition.rect=n,this._move(i.range.start.col,i.range.start.row,i.tooltipOptions)}}))}_getTooltipInstanceInfo(t,e){const i=this._table,r=this._tooltipInstances,n="bubble-tooltip";return r&&r[n]||r&&(r[n]=pR[n](i))}isBinded(t){return JSON.stringify(t)===JSON.stringify(this._attachInfo?.tooltipOptions)}}class mR{_table;_menuElement;constructor(t){this._table=t}release(){this.unbindMenuElement(),this._menuElement&&this._menuElement.release(),this._menuElement=void 0}_getMenuElement(){return this._menuElement||(this._menuElement=this.createMenuElementInternal()),this._menuElement}bindMenuElement(t,e,i){return this._getMenuElement().bindToCell(this._table,t,e,i)}unbindMenuElement(){this._getMenuElement().unbindFromCell()}pointInMenuElement(t,e){return this._getMenuElement().pointInMenuElement(t,e)}}const bR="vtable__menu-element",yR=`${bR}--hidden`,CR=`${bR}--shown`;class vR{_handler;_rootElement;_menuInstanceInfo;constructor(t){this._handler=new cv,this._rootElement=zM("div",[bR,yR]),this._rootElement.addEventListener("wheel",(t=>{t.stopPropagation()})),this._rootElement?.addEventListener("mousedown",(t=>{t.stopPropagation(),t.preventDefault()})),this._rootElement?.addEventListener("click",(e=>{if(e.stopPropagation(),e.preventDefault(),this._rootElement.classList.contains(yR))return;const{col:i,row:r,dropDownIndex:n,menuKey:o,text:s,hasChildren:a}=e.target;if("number"!=typeof n||a)return void e.stopPropagation();const l=t.isPivotTable()?t.internalProps.layoutMap.getPivotDimensionInfo(i,r):t.getHeaderField(i,r),h=t._dropDownMenuIsHighlight(i,r,n);t.fireListeners(ov.DROPDOWN_MENU_CLICK,{col:i,row:r,field:l,menuKey:o,text:s,highlight:h,cellLocation:t.getCellLocation(i,r)}),t.fireListeners(ov.DROPDOWN_MENU_CLEAR,null),t.fireListeners(ov.HIDE_MENU,null),e.stopPropagation()})),this._rootElement?.addEventListener("mousemove",(t=>{this._rootElement.classList.contains(yR)||t.stopPropagation()}))}get rootElement(){return this._rootElement}release(){this.unbindFromCell();const t=this._rootElement;t?.parentElement&&t.parentElement.removeChild(t),this._handler.release(),delete this._rootElement}bindToCell(t,e,i,r){const n=this._rootElement;if(this._menuInstanceInfo=r,n?.classList.remove(CR),n?.classList.add(yR),this._canBindToCell(t,e,i)){n.innerHTML="",n.appendChild(r.content);if(this._bindCell(t,e,i,r.position,r.referencePosition))return n?.classList.add(CR),n?.classList.remove(yR),!0}else this.unbindFromCell();return!1}unbindFromCell(){const t=this._rootElement;this._menuInstanceInfo=void 0,t?.parentElement&&(t.classList.remove(CR),t.classList.add(yR))}_canBindToCell(t,e,i){const r=t.getCellRangeRelativeRect({col:e,row:i}),n=t.getElement(),{top:o,bottom:s,left:a,right:l}=r;if(t.isFrozenCell(e,i))return!0;if(s<t.getFrozenRowsHeight()||l<t.getFrozenColsWidth()||a>t.tableNoFrameWidth-t.getRightFrozenColsWidth()||o>t.tableNoFrameHeight-t.getBottomFrozenRowsHeight())return!1;const{offsetHeight:h,offsetWidth:c}=n;return!(h<o)&&!(c<a)}_bindCell(t,e,i,r,n){const o=this._rootElement,s=t.getElement(),{width:a,height:l}=t.internalProps.element.getBoundingClientRect();if(o){o.parentElement!==s&&s.appendChild(o),o.style.left="0px";const t=.8*a;o.style.maxWidth=`${t}px`;const e=o.clientWidth,i=o.clientHeight;let h,c;return r&&(h=r.x,c=r.y),n&&(h=n.rect.right-e,c=n.rect.bottom),c+i>l&&(c=l-i,h+=e-2),c<0&&(c/=2),o.style.top=`${c}px`,h<0?h=0:h+e>a&&(h=a-e),o.style.left=`${h}px`,!0}return!1}pointInMenuElement(t,e){const i=this._rootElement,{x:r,y:n,width:o,height:s}=i.getBoundingClientRect();return t>r-5&&t<r+o+5&&e>n-5&&e<n+s+5}}class wR extends mR{createMenuElementInternal(){return new QM(this._table)}}let xR=class extends mR{createMenuElementInternal(){return new vR(this._table)}};const _R={"dropdown-menu":function(t){return new wR(t)},"context-menu":function(t){return new wR(t)},container:t=>new xR(t)};class SR{_table;_menuInstances;_attachInfo;constructor(t){this._table=t,this._menuInstances={},this._bindTableEvent(t)}release(){const t=this._menuInstances;for(const e in t)t[e].release();delete this._menuInstances,this._attachInfo=null}_bindToCell(t,e,i,r){const n=this._attachInfo,o=this._getMenuInstanceInfo(t,e,i,r);if(!n||o&&n.instance===o.instance||(n.instance?.unbindMenuElement(),this._attachInfo=null),!o)return;const{instance:s,info:a}=o;if(s&&s.bindMenuElement(t,e,a)){const i=this._table.getCellRange(t,e);this._attachInfo={range:i,instance:s}}}_unbindFromCell(){const t=this._attachInfo;if(!t)return;const{instance:e}=t;e?.unbindMenuElement(),this._attachInfo=null}_isBindToCell(t,e){const i=this._attachInfo;return!!i&&qC(i.range,t,e)}pointInMenuElement(t,e){if(!this._attachInfo)return!1;const i=this._attachInfo,{instance:r}=i;return r.pointInMenuElement(t,e)}_bindTableEvent(t){t.on(ov.DROPDOWN_ICON_CLICK,(t=>{this._attachInfo&&this._isBindToCell(t.col,t.row)?this._unbindFromCell():this._bindToCell(t.col,t.row,"dropdown-menu")})),t.on(ov.DROPDOWN_MENU_CLEAR,(t=>{this._unbindFromCell()})),t.on(ov.CONTEXTMENU_CELL,(e=>{if("html"===t.internalProps.menu?.renderMode){const i=t._getMouseAbstractPoint(e.event,!1);let r=null;i.inTable&&"function"==typeof t.internalProps.menu?.contextMenuItems?r=t.internalProps.menu.contextMenuItems(t.getHeaderField(e.col,e.row),e.row):i.inTable&&Array.isArray(t.internalProps.menu?.contextMenuItems)&&(r=t.internalProps.menu?.contextMenuItems),this._bindToCell(e.col,e.row,"context-menu",{content:r,position:{x:i.x,y:i.y}})}}))}_getMenuInstanceInfo(t,e,i,r){const n=this._table,o=this._menuInstances,s=function(t,e,i,r,n){const{lineHeight:o,textBaseline:s,textStick:a}=t._getCellStyle(e,i);let l=t.getCellRangeRelativeRect(t.getCellRange(e,i));a&&(l=t.getVisibleCellRangeRelativeRect({col:e,row:i}));let{left:h,right:c,bottom:d,top:u,width:g,height:p}=l;if(t.isHeader(e,i)&&({left:h,right:c,bottom:d,top:u,width:g,height:p}=t.internalProps.headerHelper.getDropDownIconRect(l,o,s||"middle")),n?.content)return{type:r,position:n.position,referencePosition:n.referencePosition??{rect:{left:h,right:c,top:u,bottom:d,width:g,height:p}},content:n.content};if("dropdown-menu"===r){const{dropDownMenu:n=t.globalDropDownMenu,pivotInfo:o}=t._getHeaderLayoutMap(e,i);return{type:r,referencePosition:{rect:{left:h,right:c,top:u,bottom:d,width:g,height:p}},content:n,pivotInfo:o}}return null}(n,t,e,i,r);if(!s)return null;return{instance:o&&o[i]||o&&(o[i]=_R[i](n)),type:i,info:s}}}class AR extends EventTarget{_table;_input;constructor(t,e){if(super(),this._table=t,"node"===CC.mode)return;const i=document.createElement("div");i.style.opacity="0",i.dataset.vtable="vtable",i.style.pointerEvents="none",i.classList.add("input-container");const r=this._input=document.createElement("input");i.appendChild(r),r.classList.add("table-focus-control"),r.dataset.vtable="vtable",r.readOnly=!0,e.appendChild(i)}focus(){this._input.focus({preventScroll:!0})}setFocusRect(t,e){const i=this._input;i.value=e,i.select();const r=t.top-this._table.scrollTop,n=t.left-this._table.scrollLeft;i.style.top=`${r.toFixed()}px`,i.style.left=`${n.toFixed()}px`,i.style.width=`${t.width.toFixed()}px`,i.style.height=`${t.height.toFixed()}px`}get input(){return this._input}release(){}}let BR=1;FC?BR=1:(BR=Math.ceil(window.devicePixelRatio||1),BR>1&&BR%2!=0&&(BR+=1));const TR={orient:"bottom",position:"middle",padding:30,title:{visible:!1,padding:0,textStyle:{fontSize:14,fill:"#000000",fontWeight:"normal"},space:12},item:{visible:!0,spaceCol:10,spaceRow:10,padding:2,background:{state:{selectedHover:{fill:"gray",fillOpacity:.7},unSelectedHover:{fill:"gray",fillOpacity:.2}}},shape:{space:4,state:{unSelected:{fillOpacity:.5}}},label:{space:4,style:{fill:"#89909D",fontSize:14},state:{unSelected:{fillOpacity:.5}}}},allowAllCanceled:!0,visible:!0};function MR(t,e){const{title:i={},item:r={},pager:n={},background:o={},type:s,id:a,visible:l,orient:h,position:c,data:d,filter:u,regionId:g,regionIndex:p,seriesIndex:f,seriesId:m,padding:b,...y}=wt({},TR,t),C=y;return i.visible&&(C.title=$x(i)),gt(r.focusIconStyle)||Xx(r.focusIconStyle),Yx(r.shape),Yx(r.label),Yx(r.value),Yx(r.background),LS(r.maxWidth)&&(r.maxWidth=Number(r.maxWidth.substring(0,r.maxWidth.length-1))*e.width/100),LS(r.width)&&(r.width=Number(r.width.substring(0,r.width.length-1))*e.width/100),LS(r.height)&&(r.height=Number(r.height.substring(0,r.height.length-1))*e.width/100),C.item=r,gt(n.textStyle)||Xx(n.textStyle),Yx(n.handler),C.pager=n,o.visible&&!gt(o.style)&&(wt(C,o.style),Y(o.padding)&&(C.padding=o.padding)),C}class RR{table;option;orient;visible;position;selectedData;legendComponent;constructor(t,e){this.table=e,this.option=bt(t),this.orient=t.orient??"left",this.visible=t.visible??!0,this.position=t.position??"middle",this.selectedData=t.defaultSelected??[],this.createComponent(),this.initEvent()}createComponent(){const t=this.getLegendAttributes({width:this.table.tableNoFrameWidth,height:this.table.tableNoFrameHeight}),e=new Vw(wt({},t,{defaultSelected:this.selectedData}));e.name="legend",this.legendComponent=e,this.table.scenegraph.stage.defaultLayer.appendChild(e),this.adjustTableSize(t)}resize(){this.legendComponent&&(this.legendComponent.setAttributes({width:this.table.tableNoFrameWidth,height:this.table.tableNoFrameHeight}),this.adjustTableSize(this.legendComponent.attribute))}adjustTableSize(t){let e=isFinite(this.legendComponent.AABBBounds.width())?this.legendComponent.AABBBounds.width():0,i=isFinite(this.legendComponent.AABBBounds.height())?this.legendComponent.AABBBounds.height():0;if(e<=0||i<=0)return;const r=this.table.tableNoFrameWidth,n=this.table.tableNoFrameHeight,o=eS(t.padding??this.option.padding??10);let s=0,a=0;"left"===this.orient?(s=o[3],a=0,e+=o[1]+o[3]):"top"===this.orient?(s=0,a=o[0],i+=o[0]+o[2]):"right"===this.orient?(s=r-e-o[1],a=0,e+=o[1]+o[3]):"bottom"===this.orient&&(s=0,a=n-i-o[2],i+=o[0]+o[2]);const l="bottom"===this.orient||"top"===this.orient?"horizontal":"vertical",h=this.position;let c=0,d=0;"horizontal"===l?c="middle"===h?(r-e)/2:"end"===h?r-e-o[1]:o[3]:d="middle"===h?(n-i)/2:"end"===h?n-i-o[2]:o[0],this.legendComponent.setAttributes({dx:c,dy:d,x:s,y:a}),"left"===this.orient?(this.table.tableNoFrameWidth=this.table.tableNoFrameWidth-Math.ceil(e),this.table.tableX+=Math.ceil(e)):"top"===this.orient?(this.table.tableNoFrameHeight=this.table.tableNoFrameHeight-Math.ceil(i),this.table.tableY+=Math.ceil(i)):"right"===this.orient?this.table.tableNoFrameWidth=this.table.tableNoFrameWidth-Math.ceil(e):"bottom"===this.orient&&(this.table.tableNoFrameHeight=this.table.tableNoFrameHeight-Math.ceil(i))}getLegendAttributes(t){return{layout:"bottom"===this.orient||"top"===this.orient?"horizontal":"vertical",items:this.getLegendItems(),maxWidth:t.width,maxHeight:t.height,...MR(this.option,t)}}getLegendItems(){return this.option.data}initEvent(){this.legendComponent&&(this.legendComponent.addEventListener(Ow.legendItemClick,(t=>{const e=pt(t,"detail.currentSelected");this.table.fireListeners(ov.LEGEND_ITEM_CLICK,{model:this,value:e,event:t})})),this.legendComponent.addEventListener(Ow.legendItemHover,(t=>{const e=pt(t,"detail");this.table.fireListeners(ov.LEGEND_ITEM_HOVER,{model:this,value:e,event:t})})),this.legendComponent.addEventListener(Ow.legendItemUnHover,(t=>{const e=pt(t,"detail");this.table.fireListeners(ov.LEGEND_ITEM_UNHOVER,{model:this,value:e,event:t})})),this.legendComponent.addEventListener("legendItemAttributeUpdate",(t=>{this.table.scenegraph.updateNextFrame()})))}getLegendBounds(){return{width:isFinite(this.legendComponent.AABBBounds.width())?this.legendComponent.AABBBounds.width():0,height:isFinite(this.legendComponent.AABBBounds.height())?this.legendComponent.AABBBounds.height():0}}release(){this.legendComponent&&this.table.scenegraph.stage.defaultLayer.removeChild(this.legendComponent),this.legendComponent=null}}const PR={orient:"right",position:"middle",padding:30,title:{visible:!1,padding:0,textStyle:{fontSize:14,fontWeight:"normal",fill:{type:"palette",key:"titleFontColor"}},space:12},handler:{visible:!0},startText:{style:{fontSize:14,fontWeight:"normal",fill:{type:"palette",key:"labelFontColor"}}},endText:{style:{fontSize:14,fontWeight:"normal",fill:{type:"palette",key:"labelFontColor"}}},handlerText:{style:{fontSize:14,fontWeight:"normal",fill:{type:"palette",key:"labelFontColor"}}}},ER={horizontal:{...PR,rail:{width:200,height:8,style:{fill:"rgba(0,0,0,0.04)"}}},vertical:{...PR,rail:{width:8,height:200,style:{fill:"rgba(0,0,0,0.04)"}}}},HR={horizontal:{sizeBackground:{fill:"#cdcdcd"},track:{style:{fill:"rgba(20,20,20,0.1)"}},rail:{width:200,height:4,style:{fill:"rgba(0,0,0,0.04)"}},...PR},vertical:{sizeBackground:{fill:"#cdcdcd"},track:{style:{fill:"rgba(20,20,20,0.1)"}},rail:{width:4,height:200,style:{fill:"rgba(0,0,0,0.04)"}},...PR}};function LR(t,e){const{title:i={},handler:r={},rail:n={},track:o={},startText:s,endText:a,handlerText:l,sizeBackground:h,background:c={},type:d,id:u,visible:g,orient:p,position:f,data:m,defaultSelected:b,field:y,filter:C,regionId:v,regionIndex:w,seriesIndex:x,seriesId:_,padding:S,...A}=wt({},("color"===t.type?ER:HR)["bottom"===t.orient||"top"===t.orient?"horizontal":"vertical"],t),B=A;return i.visible&&(B.title=$x(i)),B.showHandler=!1!==r.visible,gt(r.style)||(B.handlerStyle=Xx(r.style)),Y(n.width)&&(B.railWidth=n.width),Y(n.height)&&(B.railHeight=n.height),gt(n.style)||(B.railStyle=Xx(n.style)),gt(o.style)||(B.trackStyle=Xx(o.style)),B.startText=Yx(s),B.endText=Yx(a),B.handlerText=Yx(l),gt(h)||(B.sizeBackground=Xx(h)),c.visible&&!gt(c.style)&&(wt(B,c.style),Y(c.padding)&&(B.padding=c.padding)),B}class kR{table;option;orient;visible;position;selectedData;legendComponent;constructor(t,e){this.table=e,this.option=bt(t),this.orient=t.orient??"left",this.visible=t.visible??!0,this.position=t.position??"middle",this.selectedData=t.defaultSelected??[],this.createComponent(),this.initEvent()}createComponent(){const t=this.getLegendAttributes({width:this.table.tableNoFrameWidth,height:this.table.tableNoFrameHeight});let e;e="color"===this.option.type?new Gx(wt({},t,{slidable:!0})):new Ux(wt({},t,{slidable:!0})),e.name="legend",this.legendComponent=e,this.table.scenegraph.stage.defaultLayer.appendChild(e),this.adjustTableSize(t)}resize(){this.legendComponent&&(this.legendComponent.setAttributes({width:this.table.tableNoFrameWidth,height:this.table.tableNoFrameHeight}),this.adjustTableSize(this.legendComponent.attribute))}adjustTableSize(t){let e=isFinite(this.legendComponent.AABBBounds.width())?this.legendComponent.AABBBounds.width():0,i=isFinite(this.legendComponent.AABBBounds.height())?this.legendComponent.AABBBounds.height():0;if(e<=0||i<=0)return;const r=this.table.tableNoFrameWidth,n=this.table.tableNoFrameHeight,o=eS(t.padding??this.option.padding??10);let s=0,a=0;"left"===this.orient?(s=o[3],a=0,e+=o[1]+o[3]):"top"===this.orient?(s=0,a=o[0],i+=o[0]+o[2]):"right"===this.orient?(s=r-e-o[1],a=0,e+=o[1]+o[3]):"bottom"===this.orient&&(s=0,a=n-i-o[2],i+=o[0]+o[2]);const l="bottom"===this.orient||"top"===this.orient?"horizontal":"vertical",h=this.position;let c=0,d=0;"horizontal"===l?c="middle"===h?(r-e)/2:"end"===h?r-e-o[1]:o[3]:d="middle"===h?(n-i)/2:"end"===h?n-i-o[2]:o[0],this.legendComponent.setAttributes({dx:c,dy:d,x:s,y:a}),"left"===this.orient?(this.table.tableNoFrameWidth=this.table.tableNoFrameWidth-Math.ceil(e),this.table.tableX+=Math.ceil(e)):"top"===this.orient?(this.table.tableNoFrameHeight=this.table.tableNoFrameHeight-Math.ceil(i),this.table.tableY+=Math.ceil(i)):"right"===this.orient?this.table.tableNoFrameWidth=this.table.tableNoFrameWidth-Math.ceil(e):"bottom"===this.orient&&(this.table.tableNoFrameHeight=this.table.tableNoFrameHeight-Math.ceil(i))}getLegendAttributes(t){const e="bottom"===this.orient||"top"===this.orient?"horizontal":"vertical",i="horizontal"===e?"bottom":this.orient;return{...LR(this.option),layout:e,align:i,min:this.option.min,max:this.option.max,value:this.option.value,["color"===this.option.type?"colors":"sizeRange"]:"color"===this.option.type?this.option.colors:this.option.sizeRange}}initEvent(){this.legendComponent&&this.legendComponent.addEventListener("change",(t=>{const e=pt(t,"detail.value");this.table.fireListeners(ov.LEGEND_CHANGE,{model:this,value:e,event:t}),this.table.scenegraph.updateNextFrame()}))}getLegendBounds(){return{width:isFinite(this.legendComponent.AABBBounds.width())?this.legendComponent.AABBBounds.width():0,height:isFinite(this.legendComponent.AABBBounds.height())?this.legendComponent.AABBBounds.height():0}}release(){this.legendComponent&&this.table.scenegraph.stage.defaultLayer.removeChild(this.legendComponent),this.legendComponent=null}}function IR(t,e){return"color"===t.type||"size"===t.type?new kR(t,e):new RR(t,e)}const{toBoxArray:FR}=rv,{isTouchEvent:zR}=iv,OR=/^\$(\d+)\$(\d+)$/;!function(){if("node"===CC.mode)return;const t=document.createElement("style");t.id="vtable-style-styleSheet",t.textContent="\n.vtable .input-container {\n\tposition: absolute;\n\ttop:0px;\n}\n.vtable .table-scrollable {\n\tposition: absolute;\n\toverflow: scroll;\n}\n.vtable .table-scrollable::-webkit-scrollbar-button{\n\tbackground-color: transparent;\n}\n.vtable .table-scrollable::-webkit-scrollbar-track-piece{\n\tbackground-color: transparent;\n}\n.vtable .table-scrollable::-webkit-scrollbar-corner {\n\tbackground-color: transparent;\n}\n.vtable .table-scrollable::-webkit-scrollbar-thumb {\n\tborder-radius      : 4px;\n\tbackground-color   : rgba(100, 100, 100, .5);\n}\n\n.vtable .table-scroll-end-point {\n\topacity: 0;\n\tposition: relative;\n}\n.vtable {\n\t/* 设置overflow: auto 应该是为了滚动条的某个问题 但设置了auto之后 dom的下拉菜单只能显示在vtable节点中 超出会截断;现在去掉auto 暂时滚动条的问题没有发现 */\n\t/* overflow: auto; */\n\tposition: relative;\n\twidth: 100%;\n\theight: 100%;\n\ttext-align: left;\n  -webkit-font-smoothing:auto;\n}\n.vtable > canvas {\n\tposition: absolute;\n\twidth: 0;\n\theight: 0;\n}\n.vtable .table-focus-control {\n\tposition: relative !important;\n\twidth: 1px;\n\theight: 1px;\n\topacity: 0;\n\tpadding: 0;\n\tmargin: 0;\n\tbox-sizing: border-box;\n\tpointer-events: none;\n\tmax-width: 500px;\n\tmax-height: 500px;\n\tfloat: none !important;\n}\n.vtable input.table-focus-control::-ms-clear {\n\tvisibility: hidden;\n}\n.vtable input.table-focus-control.composition {\n\topacity: 1;\n\tmax-width: none;\n\tmax-height: none;\n}\n",document.head.appendChild(t)}();const DR={};class WR extends oC{internalProps;showFrozenIcon=!0;showSort=!0;padding;globalDropDownMenu;tableNoFrameWidth;tableNoFrameHeight;tableX;tableY;_widthMode;_heightMode;_autoFillWidth;_autoFillHeight;customRender;canvasWidth;canvasHeight;_vDataSet;scenegraph;stateManager;eventManager;_pixelRatio;static get EVENT_TYPE(){return ov}options;version="0.17.9";pagination;id=`VTable${Date.now()}`;headerStyleCache;bodyStyleCache;bodyBottomStyleCache;container;isReleased=!1;_chartEventMap={};constructor(t,e={}){if(super(),!t&&"node"!==e.mode)throw new Error("vtable's container is undefined");const{frozenColCount:i=0,defaultRowHeight:r=40,defaultHeaderRowHeight:n,defaultColWidth:o=80,defaultHeaderColWidth:s,widthMode:a="standard",heightMode:l="standard",autoFillWidth:h=!1,autoFillHeight:c=!1,keyboardOptions:d,columnResizeMode:u,dragHeaderMode:g,showFrozenIcon:p,allowFrozenColCount:f,padding:m,hover:b,menu:y,select:C,customRender:v,pixelRatio:w=BR,renderChartAsync:x,renderChartAsyncBatchCount:_,mode:S,modeParams:A,canvasWidth:B,canvasHeight:T,overscrollBehavior:M,limitMinWidth:R}=e;this.container=t,this.options=e,this.options.container=t,this._widthMode=a,this._heightMode=l,this._autoFillWidth=h,this._autoFillHeight=c,this.customRender=v,this.padding={top:0,right:0,left:0,bottom:0},m&&("number"==typeof m?(this.padding.top=m,this.padding.left=m,this.padding.bottom=m,this.padding.right=m):(m.top&&(this.padding.top=m.top),m.bottom&&(this.padding.bottom=m.bottom),m.left&&(this.padding.left=m.left),m.right&&(this.padding.right=m.right))),this.tableNoFrameWidth=0,this.tableNoFrameHeight=0,this.canvasWidth=B,this.canvasHeight=T;const P=this.internalProps={};void 0!==p&&(this.showFrozenIcon=p),"number"==typeof f&&f<=0&&(this.showFrozenIcon=!1),"node"!==CC.mode&&(P.element=function(t){const e=document.createElement("div");e.setAttribute("tabindex","0"),e.classList.add("vtable"),e.style.outline="none",e.style.margin=`${t.top}px ${t.right}px ${t.bottom}px ${t.left}px`;const i=(e.offsetWidth||e.parentElement?.offsetWidth||1)-1,r=(e.offsetHeight||e.parentElement?.offsetHeight||1)-1;return e.style.width=i&&i-t.left-t.right+"px"||"0px",e.style.height=r&&r-t.top-t.bottom+"px"||"0px",e}(this.padding),P.focusControl=new AR(this,P.element),P.canvas=document.createElement("canvas"),P.element.appendChild(P.canvas),P.context=P.canvas.getContext("2d")),P.handler=new cv,ot(this.options.resizeTime)&&(P.handler.resizeTime=this.options.resizeTime),P.pixelRatio=w,P.frozenColCount=i,P.defaultRowHeight=r,P.defaultHeaderRowHeight=n??r,P.defaultColWidth=o,P.defaultHeaderColWidth=s??o,P.keyboardOptions=d,P.columnResizeMode=u,P.dragHeaderMode=g,P.renderChartAsync=x,AB(_),P.overscrollBehavior=M??"auto",P._rowHeightsMap=new uv,P._rowRangeHeightsMap=new Map,P._colRangeWidthsMap=new Map,P._widthResizedColMap=new Set,this.colWidthsMap=new uv,this.colContentWidthsMap=new uv,this.colWidthsLimit={},P.calcWidthContext={_:P,get full(){return"node"===CC.mode?B/(w??1):this._.canvas.width/(this._.context.pixelRatio??window.devicePixelRatio)}},P.cellTextOverflows={},P.focusedTable=!1,P.theme=Dv.of(e.theme??Dv.DEFAULT),t?(t.innerHTML="",t.appendChild(P.element),this._updateSize()):this._updateSize(),this.options=e,P.theme=Dv.of(e.theme??Dv.DEFAULT),P.bodyHelper=new FM(this),P.headerHelper=new oR(this),P.autoWrapText=e.autoWrapText,P.allowFrozenColCount=e.allowFrozenColCount??P.colCount,P.limitMaxAutoWidth=e.limitMaxAutoWidth??450,P.limitMinWidth=null!=R?"number"==typeof R?R:R?10:0:10,this._vDataSet=new l_,this.scenegraph=new oM(this),this.stateManager=new CM(this),this.eventManager=new RM(this),e.legends&&(P.legends=IR(e.legends,this),this.scenegraph.tableGroup.setAttributes({x:this.tableX,y:this.tableY})),P.tooltip=Object.assign({renderMode:"html",isShowOverflowTextTooltip:!1,confine:!0},e.tooltip),"html"===P.tooltip.renderMode&&(P.tooltipHandler=new fR(this,P.tooltip.confine)),P.menu=Object.assign({renderMode:"html"},e.menu),Array.isArray(e.menu?.dropDownMenuHighlight)&&this.setDropDownMenuHighlight(e.menu?.dropDownMenuHighlight),Array.isArray(e.menu?.defaultHeaderMenuItems)&&(this.globalDropDownMenu=e.menu.defaultHeaderMenuItems),"html"===P.menu.renderMode&&(P.menuHandler=new SR(this)),this.headerStyleCache=new Map,this.bodyStyleCache=new Map,this.bodyBottomStyleCache=new Map,P.stick={changedCells:[]},P.customMergeCell=e.customMergeCell}throttleInvalidate=function(t,e){let i=null;return function(...r){i||(i=setTimeout((()=>{t.apply(this,r),i=null}),e))}}(this.render.bind(this),200);getContainer(){return this.container}getElement(){return this.internalProps.element}get canvas(){return this.internalProps.canvas}resize(){this._updateSize(),this.internalProps.legends&&this.internalProps.legends.resize(),this.internalProps.title&&this.internalProps.title.resize(),this.scenegraph.resize()}get rowCount(){return this.internalProps.rowCount}set rowCount(t){this.internalProps.rowCount=t}get colCount(){return this.internalProps.colCount??0}set colCount(t){this.internalProps.colCount=t}get frozenColCount(){return this.internalProps.layoutMap?.frozenColCount??this.internalProps.frozenColCount??0}set frozenColCount(t){t>=this.colCount&&(t=0),this.internalProps.frozenColCount=t,this.options.frozenColCount=t,this.tableNoFrameWidth-this.getColsWidth(0,t-1)<=120&&(this.internalProps.frozenColCount=0),this.stateManager.setFrozenCol(this.internalProps.frozenColCount)}setFrozenColCount(t){t>=this.colCount&&(t=0),this.internalProps.frozenColCount=t,this.options.frozenColCount=t,this.tableNoFrameWidth-this.getColsWidth(0,t-1)<=120&&(this.internalProps.frozenColCount=0),this.stateManager.setFrozenCol(this.internalProps.frozenColCount)}_setFrozenColCount(t){t>=this.colCount&&(t=0),this.internalProps.frozenColCount=t}_resetFrozenColCount(){this.options.frozenColCount&&(this.tableNoFrameWidth-this.getColsWidth(0,this.options.frozenColCount-1)<=120?this._setFrozenColCount(0):this.frozenColCount!==this.options.frozenColCount&&this._setFrozenColCount(this.options.frozenColCount))}get frozenRowCount(){return this.internalProps.layoutMap?.frozenRowCount??this.internalProps.frozenRowCount??0}set frozenRowCount(t){this.internalProps.frozenRowCount=t}get rightFrozenColCount(){return this.internalProps.layoutMap?.rightFrozenColCount??this.internalProps.rightFrozenColCount??0}set rightFrozenColCount(t){this.scenegraph.dealWidthRightFrozen(t)}get bottomFrozenRowCount(){return this.internalProps.layoutMap?.bottomFrozenRowCount??this.internalProps.bottomFrozenRowCount??0}set bottomFrozenRowCount(t){this.scenegraph.dealWidthBottomFrozen(t)}get defaultRowHeight(){return this.internalProps.defaultRowHeight}set defaultRowHeight(t){this.internalProps.defaultRowHeight=t,this.options.defaultRowHeight=t}get defaultHeaderRowHeight(){return this.internalProps.defaultHeaderRowHeight}set defaultHeaderRowHeight(t){this.internalProps.defaultHeaderRowHeight=t,this.options.defaultHeaderRowHeight=t}get defaultColWidth(){return this.internalProps.defaultColWidth}set defaultColWidth(t){this.internalProps.defaultColWidth=t,this.options.defaultColWidth=t}get defaultHeaderColWidth(){return this.internalProps.defaultHeaderColWidth}set defaultHeaderColWidth(t){this.internalProps.defaultHeaderColWidth=t,this.options.defaultHeaderColWidth=t}get colWidthsMap(){return this.internalProps._colWidthsMap}set colWidthsMap(t){this.internalProps._colWidthsMap=t}get colContentWidthsMap(){return this.internalProps._colContentWidthsMap}set colContentWidthsMap(t){this.internalProps._colContentWidthsMap=t}get _colRangeWidthsMap(){return this.internalProps._colRangeWidthsMap}set _colRangeWidthsMap(t){this.internalProps._colRangeWidthsMap=t}get _rowRangeHeightsMap(){return this.internalProps._rowRangeHeightsMap}set _rowRangeHeightsMap(t){this.internalProps._rowRangeHeightsMap=t}get rowHeightsMap(){return this.internalProps._rowHeightsMap}set rowHeightsMap(t){this.internalProps._rowHeightsMap=t}get colWidthsLimit(){return this.internalProps._colWidthsLimit}set colWidthsLimit(t){this.internalProps._colWidthsLimit=t}get keyboardOptions(){return this.internalProps.keyboardOptions??null}set keyboardOptions(t){this.internalProps.keyboardOptions=t??void 0}get widthMode(){return this._widthMode}set widthMode(t){t!==this._widthMode&&(this._widthMode=t,this.options.widthMode=t)}get heightMode(){return this._heightMode}set heightMode(t){t!==this._heightMode&&(this._heightMode=t,this.options.heightMode=t)}get autoFillWidth(){return this._autoFillWidth}set autoFillWidth(t){t!==this._autoFillWidth&&(this._autoFillWidth=t)}get autoFillHeight(){return this._autoFillHeight}set autoFillHeight(t){t!==this._autoFillHeight&&(this._autoFillHeight=t)}_colWidthDefineToPxWidth(t){return"auto"===t?0:zS(this,t)}_getColWidthLimits(t){const e=this.colWidthsLimit[t];if(!e)return null;const i={};return e.min&&(i.min=zS(this,e.min),i.minDef=e.min),e.max&&(i.max=zS(this,e.max),i.maxDef=e.max),i}_adjustColWidth(t,e){const i=this._getColWidthLimits(t);return Math.max(function(t,e){return t?t.min&&t.min>e?t.min:t.max&&t.max<e?t.max:e:e}(i,e),0)}setPixelRatio(t){this.internalProps.pixelRatio=t,this.scenegraph.setPixelRatio(t)}_updateSize(){const{padding:t}=this;let e=0,i=0;if("browser"===CC.mode){const r=this.getElement(),n=r.parentElement?.offsetWidth??0,o=r.parentElement?.offsetHeight??0;r.style.width=n&&n-t.left-t.right+"px"||"0px",r.style.height=o&&o-t.top-t.bottom+"px"||"0px";const{canvas:s}=this.internalProps;e=s.parentElement?.offsetWidth??0,i=s.parentElement?.offsetHeight??0,this?.scenegraph?.stage?this.scenegraph.stage.resize(e,i):(s.style.width="",s.style.height="",s.width=e,s.height=i,s.style.width=`${e}px`,s.style.height=`${i}px`)}else"node"===CC.mode&&(e=this.canvasWidth-1,i=this.canvasHeight-1);const r=Math.floor(e-vC(this.getTheme().scrollStyle)),n=Math.floor(i-vC(this.getTheme().scrollStyle));if(this.internalProps.theme?.frameStyle){const t=FR(this.internalProps.theme.frameStyle?.borderLineWidth??[null]),e=FR(this.internalProps.theme.frameStyle?.shadowBlur??[0]);this.tableX=(t[3]??0)+(e[3]??0),this.tableY=(t[0]??0)+(e[0]??0),this.tableNoFrameWidth=r-((t[1]??0)+(e[1]??0))-((t[3]??0)+(e[3]??0)),this.tableNoFrameHeight=n-((t[0]??0)+(e[0]??0))-((t[2]??0)+(e[2]??0))}}get rowHierarchyType(){return"grid"}getColsWidth(t,e){e=Math.min(e,this.colCount-1);const i=this._colRangeWidthsMap.get(`$${t}$${e}`);if(null!=i)return i;const r=this._colRangeWidthsMap.get(`$${t}$${e-1}`);if(null!=r){const i=r+this.getColWidth(e);return t>=0&&e>=0&&!Number.isNaN(i)&&this._colRangeWidthsMap.set(`$${t}$${e}`,Math.round(i)),Math.round(i)}let n=0;for(let i=t;i<=e;i++)n+=this.getColWidth(i);return t>=0&&e>=0&&this._colRangeWidthsMap.set(`$${t}$${e}`,Math.round(n)),Math.round(n)}getRowHeight(t){if(this.rowHeightsMap.get(t))return this.rowHeightsMap.get(t);const e=this.getDefaultRowHeight(t);return ot(e)?e:this.defaultRowHeight}getDefaultRowHeight(t){return this.isColumnHeader(0,t)||this.isCornerHeader(0,t)?Array.isArray(this.defaultHeaderRowHeight)?this.defaultHeaderRowHeight[t]??this.internalProps.defaultRowHeight:this.defaultHeaderRowHeight:this.isBottomFrozenRow(this.rowHeaderLevelCount,t)?Array.isArray(this.defaultHeaderRowHeight)?this.defaultHeaderRowHeight[this.columnHeaderLevelCount>0?this.columnHeaderLevelCount-this.bottomFrozenRowCount:0]??this.internalProps.defaultRowHeight:this.defaultHeaderRowHeight:this.internalProps.defaultRowHeight}_setRowHeight(t,e,i){this.rowHeightsMap.put(t,Math.round(e)),i&&this._clearRowRangeHeightsMap(t)}getRowsHeight(t,e){const i=this._rowRangeHeightsMap.get(`$${t}$${e}`);if(null!=i)return i;const r=this._rowRangeHeightsMap.get(`$${t}$${e-1}`);if(null!=r){const i=Math.round(r+(this.rowHeightsMap.get(e)??(this.isColumnHeader(0,e)||this.isCornerHeader(0,e)?Array.isArray(this.defaultHeaderRowHeight)&&ot(this.defaultHeaderRowHeight[e])?this.defaultHeaderRowHeight[e]:ot(this.defaultHeaderRowHeight)?this.defaultHeaderRowHeight:this.internalProps.defaultRowHeight:this.internalProps.defaultRowHeight)));return t>=0&&e>=0&&this._rowRangeHeightsMap.set(`$${t}$${e}`,Math.round(i)),i}let n=0;if("standard"===this.heightMode&&!this.autoFillHeight&&this.internalProps.layoutMap&&e>=this.columnHeaderLevelCount&&!this.bottomFrozenRowCount&&!this.hasAutoImageColumn()){for(let e=t;e<this.columnHeaderLevelCount;e++)n+=this.getRowHeight(e);n+=this.defaultRowHeight*(e-Math.max(this.columnHeaderLevelCount,t)+1)}else for(let i=t;i<=e;i++)n+=this.getRowHeight(i);return t>=0&&e>=0&&n>0&&this._rowRangeHeightsMap.set(`$${t}$${e}`,Math.round(n)),Math.round(n)}getColWidthDefined(t){const{layoutMap:e}=this.internalProps;if("autoWidth"===this.widthMode)return"auto";const{width:i}=e?.getColumnWidthDefined(t)??{};return"number"==typeof i&&i<=0?0:i||(this.isRowHeader(t,0)||this.isCornerHeader(t,0)?Array.isArray(this.defaultHeaderColWidth)?this.defaultHeaderColWidth[t]??this.defaultColWidth:this.defaultHeaderColWidth:this.isRightFrozenColumn(t,this.columnHeaderLevelCount)&&this.isPivotTable()?Array.isArray(this.defaultHeaderColWidth)?this.defaultHeaderColWidth[this.rowHeaderLevelCount-this.rightFrozenColCount]??this.defaultColWidth:this.defaultHeaderColWidth:this.defaultColWidth)}getColWidthDefinedNumber(t){const e=this.getColWidthDefined(t);return this._adjustColWidth(t,this._colWidthDefineToPxWidth(e))}getColWidth(t){const e=this.colWidthsMap.get(t)??(t<this.rowHeaderLevelCount?Array.isArray(this.defaultHeaderColWidth)?this.defaultHeaderColWidth[t]??this.defaultColWidth:this.defaultHeaderColWidth:this.defaultColWidth);return"adaptive"===this.widthMode&&"number"==typeof e||this.transpose&&"number"==typeof e?this._colWidthDefineToPxWidth(e):this._adjustColWidth(t,this._colWidthDefineToPxWidth(e))}_setColWidth(t,e,i,r){this.colWidthsMap.put(t,"number"==typeof e?Math.round(e):e),i&&this._clearColRangeWidthsMap(t),r||this.stateManager.checkFrozen()}_clearColRangeWidthsMap(t){if("number"!=typeof t)this._colRangeWidthsMap.clear();else{const e=this._colRangeWidthsMap.keys();for(const i of e){const e=OR.exec(i);if(e){const r=Number(e[1]),n=Number(e[2]);t>=r&&t<=n&&this._colRangeWidthsMap.delete(i)}}}}_clearRowRangeHeightsMap(t){if("number"!=typeof t)this._rowRangeHeightsMap.clear();else{const e=this._rowRangeHeightsMap.keys();for(const i of e){const e=OR.exec(i);if(e){const r=Number(e[1]),n=Number(e[2]);t>=r&&t<=n&&this._rowRangeHeightsMap.delete(i)}}}}_getColContentWidth(t){return Number(this.colContentWidthsMap.get(t))}_setColContentWidth(t,e){this.colContentWidthsMap.put(t,e)}getAllRowsHeight(){if(this.internalProps.rowCount<=0)return 0;return this.getRowsHeight(0,this.internalProps.rowCount-1)}getAllColsWidth(){if(this.internalProps.colCount<=0)return 0;return this.getColsWidth(0,this.internalProps.colCount-1)}getMaxColWidth(t){const e=this.colWidthsLimit[t];let i=(e&&e.max)??1/0;return"string"==typeof i&&(i=zS(this,i)),i}setMaxColWidth(t,e){(this.colWidthsLimit[t]||(this.colWidthsLimit[t]={})).max=e}getMinColWidth(t){const e=this.colWidthsLimit[t];let i=(e&&e.min)??0;return"string"==typeof i&&(i=zS(this,i)),i}setMinColWidth(t,e){(this.colWidthsLimit[t]||(this.colWidthsLimit[t]={})).min=e}getCellRect(t,e){const i=this.isFrozenCell(t,e);let r;const n=this.getColWidth(t);let o;i&&i.col?this.isRightFrozenColumn(t,e)?r=this.tableNoFrameWidth-(this.getColsWidth(t,this.colCount-1)??0):(r=this.getColsWidth(0,t-1)||0,r+=this.scrollLeft):r=this.getColsWidth(0,t-1)||0;const s=this.getRowHeight(e);return i&&i.row?this.isBottomFrozenRow(t,e)?r=this.tableNoFrameHeight-(this.getRowsHeight(e,this.rowCount-1)??0):(o=this.getRowsHeight(0,e-1),o+=this.scrollTop):o=this.getRowsHeight(0,e-1),new gv(Math.round(r),Math.round(o),Math.round(n),Math.round(s))}getMergeCellRect(t,e){const i=this.getCellRange(t,e),r=this.getColsWidth(0,i.start.col-1)||0,n=this.getColsWidth(i.start.col,i.end.col),o=this.getRowsHeight(0,i.start.row-1)||0,s=this.getRowsHeight(i.start.row,i.end.row);return new gv(Math.round(r),Math.round(o),Math.round(n),Math.round(s))}getCellRelativeRect(t,e){return this._toRelativeRect(this.getCellRect(t,e))}getCellRangeRelativeRect(t){if(t.start)return this._toRelativeRect(this.getCellsRect(t.start.col,t.start.row,t.end.col,t.end.row));const e=this.getCellRange(t.col,t.row);return this._toRelativeRect(this.getCellsRect(e.start.col,e.start.row,e.end.col,e.end.row))}getVisibleCellRangeRelativeRect(t){let e;return e=t.start?t:this.getCellRange(t.col,t.row),this._getVisiableRect(this.getCellRangeRelativeRect(t),e)}_getVisiableRect(t,e){const i=e.start.col>=this.frozenColCount?Math.max(t.left,this.frozenColCount>=1?this.getColsWidth(0,this.frozenColCount-1):0):t.left,r=Math.min(t.right,this.tableNoFrameWidth),n=t.copy();n.left=i,n.right=r;const o=e.start.row>=this.frozenRowCount?Math.max(t.top,this.frozenRowCount>=1?this.getRowsHeight(0,this.frozenRowCount-1):0):t.top,s=Math.min(t.bottom,this.tableNoFrameHeight);return n.top=o,n.bottom=s,n}getCellsRect(t,e,i,r){const n=this.isFrozenCell(t,e),o=this.isFrozenCell(i,r);let s=this.getColsWidth(0,t-1)||0,a=this.getColsWidth(t,i);if(n&&n.col){const e=this.scrollLeft;s+=e,o&&o.col||(a-=e,a=Math.max(a,this.getColsWidth(t,this.frozenColCount-1)))}let l=this.getRowsHeight(0,e-1),h=this.getRowsHeight(e,r);if(n&&n.row){const t=this.scrollTop;l+=t,o&&o.row||(h-=t,h=Math.max(h,this.getRowsHeight(e,this.frozenRowCount-1)))}return new gv(Math.round(s),Math.round(l),Math.round(a),Math.round(h))}getCellsRectWidth(t,e,i,r){const n=this.isFrozenCell(t,e),o=this.isFrozenCell(i,r);let s=this.getColsWidth(t,i);if(n&&n.col){const e=this.scrollLeft;o&&o.col||(s-=e,s=Math.max(s,this.getColsWidth(t,this.frozenColCount-1)))}return s}getCellRangeRect(t){if(t.start)return this.getCellsRect(t.start.col,t.start.row,t.end.col,t.end.row);const e=this.getCellRange(t.col,t.row);return this.getCellsRect(e.start.col,e.start.row,e.end.col,e.end.row)}getCellRangeRectWidth(t){if(t.start)return this.getCellsRectWidth(t.start.col,t.start.row,t.end.col,t.end.row);const e=this.getCellRange(t.col,t.row);return this.getCellsRectWidth(e.start.col,e.start.row,e.end.col,e.end.row)}isFrozenCell(t,e){const i=this.isFrozenRow(e)||this.isBottomFrozenRow(e),r=this.isFrozenColumn(t)||this.isRightFrozenColumn(t);return i||r?{row:i,col:r}:null}getRowAt(t){const e=function(t,e){if(!t.internalProps.frozenRowCount)return null;let{scrollTop:i}=t;const r=t.internalProps.frozenRowCount;for(let n=0;n<r;n++){const r=t.getRowHeight(n),o=i+r;if(o>e)return{top:i,row:n,bottom:o,height:r};i=o}return null}(this,t);if(e)return e;let i=this.getTargetRowAt(t);return i||(i={top:-1,row:-1,bottom:-1,height:-1}),i}getColAt(t){const e=function(t,e){if(!t.internalProps.frozenColCount)return null;let{scrollLeft:i}=t;const r=t.internalProps.frozenColCount;for(let n=0;n<r;n++){const r=t.getColWidth(n),o=i+r;if(o>e)return{left:i,col:n,right:o,width:r};i=o}return null}(this,t);if(e)return e;let i=this.getTargetColAt(t);return i||(i={left:-1,col:-1,right:-1,width:1}),i}getCellAt(t,e){const i=this.getRowAt(e),{row:r,top:n,bottom:o,height:s}=i,a=this.getColAt(t),{col:l,left:h,right:c,width:d}=a;return{row:r,col:l,rect:{left:h,right:c,top:n,bottom:o,width:d,height:s}}}_checkRowCol(t,e){return t>=0&&t<this.colCount&&e>=0&&e<this.rowCount}_makeVisibleCell(t,e){if(this._checkRowCol(t,e)){const i=this.isFrozenCell(t,e);if(i&&i.col&&i.row)return;const r=this.getCellRect(t,e),n=function(t){let e=0,i=0;t.frozenColCount>0&&(e=t.getFrozenColsWidth()),t.rightFrozenColCount>0&&(i=t.getRightFrozenColsWidth());let r=0,n=0;return t.frozenRowCount>0&&(r=t.getFrozenRowsHeight()),t.bottomFrozenRowCount>0&&(n=t.getBottomFrozenRowsHeight()),new gv(t.scrollLeft+e,t.scrollTop+r,t.tableNoFrameWidth-e-i,t.tableNoFrameHeight-r-n)}(this);if(n.contains(r))return;i&&i.col||this.getColsWidth(0,this.frozenColCount-1)+r.width>this.canvas.width||(r.left<n.left?this.scrollLeft-=n.left-r.left:n.right<r.right&&(this.scrollLeft-=n.right-r.right)),i&&i.row||this.getRowsHeight(0,this.frozenRowCount-1)+r.height>this.canvas.height||(r.top<n.top?this.scrollTop-=n.top-r.top:n.bottom<r.bottom&&(this.scrollTop-=n.bottom-r.bottom))}}render(){this.scenegraph.renderSceneGraph()}renderAsync(){return this.scenegraph.updateNextFrame(),new Promise(((t,e)=>{setTimeout((()=>{t()}),0)}))}_toRelativeRect(t){const e=t.copy(),i=this.getVisibleRect();return e.offsetLeft(this.tableX-i.left),e.offsetTop(this.tableY-i.top),e}getVisibleRect(){const{scrollTop:t,scrollLeft:e}=this,i=this.tableNoFrameWidth,r=this.tableNoFrameHeight;return new gv(e,t,i,r)}get visibleRowCount(){const{frozenRowCount:t}=this,e=this.getVisibleRect(),i=t>0?e.top+this.getRowsHeight(0,t-1):e.top,r=this.getTargetRowAt(i);if(!r)return 0;const n=Math.max(r.top>=i?r.row:r.row+1,t);let o=this.getRowsHeight(0,n-1),s=0;const{rowCount:a}=this;for(let t=n;t<a;t++){const i=o+this.getRowHeight(t);if(e.bottom<i)break;s++,o=i}return s}getBodyVisibleCellRange(){const{scrollTop:t,scrollLeft:e}=this,i=this.getFrozenRowsHeight(),r=this.getFrozenColsWidth(),n=this.getBottomFrozenRowsHeight(),o=this.getRightFrozenColsWidth(),{row:s}=this.getRowAt(t+i+1),{col:a}=this.getColAt(e+r+1),l=this.getAllRowsHeight()>this.tableNoFrameHeight?this.getRowAt(t+this.tableNoFrameHeight-1-n).row:this.rowCount-1,h=this.getAllColsWidth()>this.tableNoFrameWidth?this.getColAt(e+this.tableNoFrameWidth-1-o).col:this.colCount-1;return h<0||l<0?null:{rowStart:s,colStart:a,rowEnd:l,colEnd:h}}getBodyVisibleRowRange(){const{scrollTop:t}=this,e=this.getFrozenRowsHeight(),i=this.getBottomFrozenRowsHeight(),{row:r}=this.getRowAt(t+e+1),n=this.getAllRowsHeight()>this.tableNoFrameHeight?this.getRowAt(t+this.tableNoFrameHeight-1-i).row:this.rowCount-1;return n<0?null:{rowStart:r,rowEnd:n}}getBodyVisibleColRange(){const{scrollLeft:t}=this,e=this.getFrozenColsWidth(),i=this.getRightFrozenColsWidth(),{col:r}=this.getColAt(t+e+1),n=this.getAllColsWidth()>this.tableNoFrameWidth?this.getColAt(t+this.tableNoFrameWidth-1-i).col:this.colCount-1;return n<0?null:{colStart:r,colEnd:n}}get visibleColCount(){const{frozenColCount:t}=this,e=this.getVisibleRect(),i=t>0?e.left+this.getColsWidth(0,t-1):e.left,r=this.getTargetColAt(i);if(!r)return 0;const n=Math.max(r.left>=i?r.col:r.col+1,t);let o=this.getColsWidth(0,n-1),s=0;const{colCount:a}=this;for(let t=n;t<a;t++){const i=o+this.getColWidth(t);if(e.right<i)break;s++,o=i}return s}get scrollTop(){return this.stateManager.scroll.verticalBarPos}set scrollTop(t){this.stateManager.setScrollTop(t)}get scrollLeft(){return this.stateManager.scroll.horizontalBarPos}set scrollLeft(t){this.stateManager.setScrollLeft(t)}getScrollLeft(){return this.scrollLeft}getScrollTop(){return this.scrollTop}setScrollLeft(t){this.scrollLeft=Math.ceil(t)}setScrollTop(t){this.scrollTop=Math.ceil(t)}getCellOverflowText(t,e){return this.scenegraph.getCellOverflowText(t,e)}addReleaseObj(t){if(!t||!t.release||"function"!=typeof t.release)throw new Error("not releaseObj!");(this.internalProps.releaseList=this.internalProps.releaseList||[]).push(t)}dispose(){this.release()}release(){const t=this.internalProps;t.tooltipHandler?.release?.(),t.menuHandler?.release?.(),$S.clearAll(),super.release?.(),t.handler?.release?.(),t.focusControl?.release?.(),t.legends?.release(),t.title?.release(),t.layoutMap.release(),t.releaseList&&(t.releaseList.forEach((t=>t?.release?.())),t.releaseList=null),this.scenegraph.stage.release(),this.scenegraph.proxy.release();const{parentElement:e}=t.element;e&&e.removeChild(t.element),this.isReleased=!0}fireListeners(t,e){return super.fireListeners(t,e)}updateOption(t){this.options=t;const{frozenColCount:e=0,defaultRowHeight:i=40,defaultHeaderRowHeight:r,defaultColWidth:n=80,defaultHeaderColWidth:o=80,keyboardOptions:s,columnResizeMode:a,dragHeaderMode:l,showFrozenIcon:h,allowFrozenColCount:c,padding:d,hover:u,menu:g,select:p,pixelRatio:f,widthMode:m,heightMode:b,autoFillWidth:y,autoFillHeight:C,customRender:v,renderChartAsync:w,renderChartAsyncBatchCount:x,overscrollBehavior:_,limitMinWidth:S}=t;f&&f!==this.internalProps.pixelRatio&&(this.internalProps.pixelRatio=f),d&&("number"==typeof d?(this.padding.top=d,this.padding.left=d,this.padding.bottom=d,this.padding.right=d):(d.top&&(this.padding.top=d.top),d.bottom&&(this.padding.bottom=d.bottom),d.left&&(this.padding.left=d.left),d.right&&(this.padding.right=d.right))),this.showFrozenIcon="boolean"!=typeof h||h,"number"==typeof c&&c<=0&&(this.showFrozenIcon=!1),this.widthMode=m??"standard",this.heightMode=b??"standard",this.autoFillWidth=y??!1,this.autoFillHeight=C??!1,this.customRender=v;const A=this.internalProps;"node"!==CC.mode&&function(t,e){t.style.margin=`${e.top}px ${e.right}px ${e.bottom}px ${e.left}px`;const i=(t.offsetWidth||t.parentElement?.offsetWidth||1)-1,r=(t.offsetHeight||t.parentElement?.offsetHeight||1)-1;t.style.width=i&&i-e.left-e.right+"px"||"0px",t.style.height=r&&r-e.top-e.bottom+"px"||"0px"}(A.element,this.padding),A.frozenColCount=e,A.defaultRowHeight=i,A.defaultHeaderRowHeight=r??i,A.defaultColWidth=n,A.defaultHeaderColWidth=o??n,A.keyboardOptions=s,A.columnResizeMode=a,A.dragHeaderMode=l,A.renderChartAsync=w,AB(x),A.overscrollBehavior=_??"auto",A.cellTextOverflows={},A._rowHeightsMap=new uv,A._rowRangeHeightsMap=new Map,A._colRangeWidthsMap=new Map,A._widthResizedColMap=new Set,this.colWidthsMap=new uv,this.colContentWidthsMap=new uv,this.colWidthsLimit={},A.theme=Dv.of(t.theme??Dv.DEFAULT),this.scenegraph.updateStageBackground(),A.autoWrapText=t.autoWrapText,A.allowFrozenColCount=t.allowFrozenColCount??A.colCount,A.limitMaxAutoWidth=t.limitMaxAutoWidth??450,A.limitMinWidth=null!=S?"number"==typeof S?S:S?10:0:10,this._vDataSet=new l_,A.legends?.release(),A.title?.release(),A.layoutMap.release(),this.scenegraph.clearCells(),this.stateManager.updateOptionSetState(),this._updateSize(),this.eventManager.updateEventBinder(),t.legends&&(A.legends=IR(t.legends,this),this.scenegraph.tableGroup.setAttributes({x:this.tableX,y:this.tableY})),A.tooltip=Object.assign({renderMode:"html",isShowOverflowTextTooltip:!1,confine:!0},t.tooltip),"html"!==A.tooltip.renderMode||A.tooltipHandler||(A.tooltipHandler=new fR(this,A.tooltip.confine)),A.menu=Object.assign({renderMode:"html"},t.menu),"html"!==A.menu.renderMode||A.menuHandler||(A.menuHandler=new SR(this)),this.clearCellStyleCache(),this.clearColWidthCache(),this.clearRowHeightCache()}renderWithRecreateCells(){const t={col:this.stateManager.hover.cellPos.col,row:this.stateManager.hover.cellPos.row};this.refreshHeader(),this.scenegraph.clearCells(),this.clearCellStyleCache(),this.scenegraph.createSceneGraph(),this.stateManager.updateHoverPos(t.col,t.row),this.render()}getFrozenRowsHeight(){return this.getRowsHeight(0,this.frozenRowCount-1)}getFrozenColsWidth(){return this.getColsWidth(0,this.frozenColCount-1)}getBottomFrozenRowsHeight(){if(this.bottomFrozenRowCount>0){return this.getRowsHeight(this.rowCount-this.bottomFrozenRowCount,this.rowCount-1)}return 0}getRightFrozenColsWidth(){if(this.rightFrozenColCount>0){return this.getColsWidth(this.colCount-this.rightFrozenColCount,this.colCount-1)}return 0}getDrawRange(){const t=Math.min(this.tableNoFrameWidth,this.getAllColsWidth()),e=Math.min(this.tableNoFrameHeight,this.getAllRowsHeight());return new gv(this.tableX,this.tableY,t,e)}_getMouseAbstractPoint(t,e=!0){const i=this;let r;if(!t)return{inTable:!1,x:void 0,y:void 0};r=zR(t)?t.changedTouches[0]:t;const n=r.clientX||r.pageX+window.scrollX,o=r.clientY||r.pageY+window.scrollY,s=i.internalProps.canvas.getBoundingClientRect();let a=!0;s.right<=n&&(a=!1),s.bottom<=o&&(a=!1);const l=s.width,h=l/(this.canvas.offsetWidth||l),c=s.height,d=c/(this.canvas.offsetHeight||c);return{x:(n-s.left)/h+(e?i.scrollLeft:0),y:(o-s.top)/d+(e?i.scrollTop:0),inTable:a}}getTheme(){return this.internalProps.theme}getTargetColAt(t){if(0===t)return{left:0,col:0,right:0,width:0};const e=(e,i)=>{let r=i-this.getColWidth(e);const{colCount:n}=this.internalProps;for(let i=e;i<n;i++){const e=this.getColWidth(i),n=r+e;if(Math.round(r)<=Math.round(t)&&Math.round(t)<Math.round(n))return{left:r,col:i,right:n,width:e};r=n}return null},i=this.computeTargetColByX(t),r=this.getColsWidth(0,i);return t>=r?e(i,r):((e,i)=>{let r=i;for(let i=e;i>=0;i--){const e=this.getColWidth(i),n=r-e;if(Math.round(n)<=Math.round(t)&&Math.round(t)<Math.round(r))return{left:n,col:i,right:r,width:e};r=n}return null})(i,r)}getTargetRowAt(t){if(0===t)return{top:0,row:0,bottom:0,height:0};const e=(e,i)=>{let r=i-this.getRowHeight(e);const{rowCount:n}=this.internalProps;for(let i=e;i<n;i++){const e=this.getRowHeight(i),n=r+e;if(Math.round(r)<=Math.round(t)&&Math.round(t)<Math.round(n))return{top:r,row:i,bottom:n,height:e};r=n}return null},i=this.computeTargetRowByY(t),r=this.getRowsHeight(0,i);return t>=r?e(i,r):((e,i)=>{let r=i;for(let i=e;i>=0;i--){const e=this.getRowHeight(i),n=r-e;if(Math.round(n)<=Math.round(t)&&Math.round(t)<Math.round(r))return{top:n,row:i,bottom:r,height:e};r=n}return null})(i,r)}computeTargetRowByY(t){let e=this.internalProps.defaultRowHeight;return this._rowRangeHeightsMap.get("$0$"+(this.rowCount-1))&&(e=this._rowRangeHeightsMap.get("$0$"+(this.rowCount-1))/this.rowCount),Math.min(Math.ceil(t/e),this.rowCount-1)}computeTargetColByX(t){if(this._colRangeWidthsMap.get("$0$"+(this.colCount-1))){let e=0,i=this.colCount-1;for(;i-e>1;){const r=Math.floor((e+i)/2);if(t<this._colRangeWidthsMap.get(`$0$${r}`))i=r;else{if(!(t>this._colRangeWidthsMap.get(`$0$${r}`)))return r;e=r}}return i}return Math.min(Math.ceil(t/this.internalProps.defaultColWidth),this.colCount-1)}clearSelected(){this.stateManager.updateSelectPos(-1,-1)}selectCell(t,e){this.stateManager.updateSelectPos(t,e),this.stateManager.endSelectCells()}selectCells(t){const{scrollLeft:e,scrollTop:i}=this;t.forEach(((t,e)=>{t.start.col===t.end.col&&t.start.row===t.end.row?this.stateManager.updateSelectPos(t.start.col,t.start.row,!1,e>=1):(this.stateManager.updateSelectPos(t.start.col,t.start.row,!1,e>=1),this.stateManager.updateInteractionState($y.grabing),this.stateManager.updateSelectPos(t.end.col,t.end.row,!1,e>=1)),this.stateManager.endSelectCells(!1),this.stateManager.updateInteractionState($y.default)})),this.setScrollTop(i),this.setScrollLeft(e)}get allowFrozenColCount(){return this.internalProps.allowFrozenColCount}get rowHeaderLevelCount(){return this.internalProps.layoutMap.rowHeaderLevelCount}get columnHeaderLevelCount(){return this.internalProps.layoutMap.columnHeaderLevelCount}get records(){return this.internalProps.records}get dataSource(){return this.internalProps.dataSource}set dataSource(t){this.scenegraph.clearCells(),FS(this,t),this.refreshRowColCount(),this.scenegraph.createSceneGraph(),this.render()}get autoWrapText(){return this.internalProps.autoWrapText}set autoWrapText(t){this.internalProps.autoWrapText=t,this.options.autoWrapText=t}updateAutoWrapText(t){this.internalProps.autoWrapText!==t&&(this.internalProps.autoWrapText=t,this.options.autoWrapText=t,this.scenegraph.clearCells(),this.clearCellStyleCache(),this.scenegraph.createSceneGraph(),this.render())}get theme(){return this.internalProps.theme}set theme(t){this.internalProps.theme=Dv.of(t??Dv.DEFAULT),this.options.theme=t}updateTheme(t){const e={col:this.stateManager.hover.cellPos.col,row:this.stateManager.hover.cellPos.row};this.internalProps.theme=Dv.of(t??Dv.DEFAULT),this.options.theme=t,this.scenegraph.updateStageBackground(),this.scenegraph.clearCells(),this.clearCellStyleCache(),this.scenegraph.createSceneGraph(),this.stateManager.updateHoverPos(e.col,e.row),this.render()}getBodyField(t,e){return this.internalProps.layoutMap.getBody(t,e).field}getBodyColumnDefine(t,e){const i=this.internalProps.layoutMap.getBody(t,e);return i?.define}getBodyColumnType(t,e){return QS("cellType",{cellType:this.internalProps.layoutMap.getBody(t,e).cellType},t,e,this)}getCellType(t,e){let i;return i=this.isHeader(t,e)?this.internalProps.layoutMap.getHeader(t,e).headerType:this.internalProps.layoutMap.getBody(t,e).cellType,QS("cellType",{cellType:i},t,e,this)}getHeaderField(t,e){return this.internalProps.layoutMap.getHeaderField(t,e)}getHeaderFieldKey(t,e){return this.internalProps.layoutMap.getHeaderFieldKey(t,e)}getHeaderDefine(t,e){const i=this.internalProps.layoutMap.getHeader(t,e);return i?.define}getCellLocation(t,e){return this.internalProps.layoutMap.getCellLocation(t,e)}getCellHeaderPaths(t,e){return this.internalProps.layoutMap.getCellHeaderPaths(t,e)}getHeadersDefine(t,e){const i=[];for(;;){const r=this.getHeaderDefine(t,e);if(!r||!r.field&&!r.columns)break;i.push(r),e++}return i}_getHeaderLayoutMap(t,e){return this.internalProps.layoutMap.getHeader(t,e)}_getBodyLayoutMap(t,e){return this.internalProps.layoutMap.getBody(t,e)}getContext(){return this.internalProps.context}getRecordByCell(t,e){if(!this.internalProps.layoutMap.isHeader(t,e))return this.internalProps.dataSource?.get(this.getRecordShowIndexByCell(t,e))}getRecordByRowCol(t,e){return this.getRecordByCell(t,e)}getRecordStartRowByRecordIndex(t){return this.internalProps.layoutMap.getRecordStartRowByRecordIndex(t)}_getHeaderCellBySortState(t){const{layoutMap:e}=this.internalProps;let i;if(i=t.fieldKey?e.headerObjects.find((e=>e&&e.fieldKey===t.fieldKey)):e.headerObjects.find((e=>e&&e.field===t.field)),i){return e.getHeaderCellAdressById(i.id)}}getCellRange(t,e){if(this.internalProps.customMergeCell){const i=this.internalProps.customMergeCell(t,e,this);if(i&&i.range&&i.text)return i.range}return this.internalProps.layoutMap.getCellRange(t,e)}getCustomMerge(t,e){if(this.internalProps.customMergeCell){const i=this.internalProps.customMergeCell(t,e,this);if(i&&i.range&&i.text){if(i.style){const r=this.internalProps.bodyHelper.getStyleClass("text"),n=gC(i.style,this.theme.bodyStyle,{col:t,row:e,table:this,value:i.text,dataValue:this.getCellOriginValue(t,e),cellHeaderPaths:this.getCellHeaderPaths(t,e)},r,this.options.autoWrapText);i.style=n}return i}}}isCellRangeEqual(t,e,i,r){return this.internalProps.layoutMap.isCellRangeEqual(t,e,i,r)}_getLayoutCellId(t,e){return this.internalProps.layoutMap.getCellId(t,e)}getHeaderDescription(t,e){const i=this._getHeaderLayoutMap(t,e),r=i?.define,n=r?.description??i?.description;if("function"==typeof n){return n({col:t,row:e,value:this.getCellValue(t,e),dataValue:this.getCellOriginValue(t,e)})}return n}setDropDownMenuHighlight(t){this.stateManager.setDropDownMenuHighlight(t)}_dropDownMenuIsHighlight(t,e,i){return this.stateManager.dropDownMenuIsHighlight(t,e,i)}isHeader(t,e){return this.internalProps.layoutMap&&this.internalProps.layoutMap.isHeader(t,e)}isColumnHeader(t,e){return this.internalProps.layoutMap?.isColumnHeader(t,e)}isRowHeader(t,e){return this.internalProps.layoutMap?.isRowHeader(t,e)}isCornerHeader(t,e){return this.internalProps.layoutMap?.isCornerHeader(t,e)}isFrozenColumn(t,e){return this.internalProps.layoutMap?.isFrozenColumn(t,e)}isLeftFrozenColumn(t,e){return this.internalProps.layoutMap?.isFrozenColumn(t,e)}isRightFrozenColumn(t,e){return this.internalProps.layoutMap?.isRightFrozenColumn(t,e)}isFrozenRow(t,e){return this.internalProps.layoutMap?.isFrozenRow(t,e)}isTopFrozenRow(t,e){return this.internalProps.layoutMap?.isFrozenRow(t,e)}isBottomFrozenRow(t,e){return this.internalProps.layoutMap?.isBottomFrozenRow(t,e)}getCellInfo(t,e){if(t>=0&&e>=0){const i=this.isHeader(t,e)?this.getHeaderDefine(t,e):this.getBodyColumnDefine(t,e);return{col:t,row:e,field:this.getHeaderField(t,e),cellHeaderPaths:this.internalProps.layoutMap.getCellHeaderPaths(t,e),title:i?.title,cellType:i?.cellType?"string"==typeof i.cellType?i.cellType:"progressbar":"text",originData:this.getCellOriginRecord(t,e),cellRange:this.getCellRangeRelativeRect({col:t,row:e}),value:this.getCellValue(t,e),dataValue:this.getCellOriginValue(t,e),cellLocation:this.getCellLocation(t,e),scaleRatio:this.canvas.getBoundingClientRect().width/this.canvas.offsetWidth}}}_hasField(t,e,i){if(null==t)return!1;const r=this;if(r.internalProps.layoutMap.isHeader(e,i))return!1;const n=r.getRecordShowIndexByCell(e,i);return r.internalProps.dataSource?.hasField(n,t)}_getCellStyle(t,e){const{layoutMap:i}=this.internalProps;if(i.isHeader(t,e)){let r;if(!this.isPivotTable()||this.isBottomFrozenRow(e)||this.isRightFrozenColumn(t))r=`${t}-${e}`;else{const i=this.getHeaderDefine(t,e);r=i?.dimensionKey?`dim-${i.dimensionKey}`:i?.indicatorKey?`ind-${i.indicatorKey}`:`${t}-${e}`}let n=this.headerStyleCache.get(r);if(n)return n;const o=i.getHeader(t,e);let s;if(this.isPivotChart()&&function(t,e,i){if(!i._table.isPivotChart())return!1;if(i.indicatorsAsCol){if(i.hasTwoIndicatorAxes&&e===i.columnHeaderLevelCount-1&&t>=i.rowHeaderLevelCount&&t<i.colCount-i.rightFrozenColCount)return!0;if(e===i.rowCount-i.bottomFrozenRowCount&&t>=i.rowHeaderLevelCount&&t<i.colCount-i.rightFrozenColCount)return!0}else if(e===i.rowCount-i.bottomFrozenRowCount&&t>=i.rowHeaderLevelCount&&t<i.colCount-i.rightFrozenColCount)return!0;return!1}(t,e,i)){const e=i.getBody(t,this.rowHeaderLevelCount);s=e.style?.padding??this.theme.bodyStyle.padding}else if(this.isPivotChart()&&function(t,e,i){if(!i._table.isPivotChart())return!1;if(i.indicatorsAsCol){if(t===i.rowHeaderLevelCount-1&&e>=i.columnHeaderLevelCount&&e<i.rowCount-i.bottomFrozenRowCount)return!0}else{if(t===i.rowHeaderLevelCount-1&&e>=i.columnHeaderLevelCount&&e<i.rowCount-i.bottomFrozenRowCount)return!0;if(t===i.colCount-i.rightFrozenColCount&&e>=i.columnHeaderLevelCount&&e<i.rowCount-i.bottomFrozenRowCount)return!0}return!1}(t,e,i)){const t=i.getBody(this.columnHeaderLevelCount,e);s=t.style?.padding??this.theme.bodyStyle.padding}if((!o||o.isEmpty)&&(i.isLeftBottomCorner(t,e)||i.isRightBottomCorner(t,e)||i.isCornerHeader(t,e)||i.isRightTopCorner(t,e)))return DR;const a=this.internalProps.headerHelper.getStyleClass(o?.headerType||"text");if(i.isBottomFrozenRow(t,e)&&this.theme.bottomFrozenStyle)n=yC(s?{padding:s}:{},this.theme.bottomFrozenStyle,{col:t,row:e,table:this,value:this.getCellValue(t,e),dataValue:this.getCellOriginValue(t,e),cellHeaderPaths:this.getCellHeaderPaths(t,e)},a,this.options.autoWrapText);else if(i.isRightFrozenColumn(t,e)&&this.theme.rightFrozenStyle)n=yC(s?{padding:s}:{},this.theme.rightFrozenStyle,{col:t,row:e,table:this,value:this.getCellValue(t,e),dataValue:this.getCellOriginValue(t,e),cellHeaderPaths:this.getCellHeaderPaths(t,e)},a,this.options.autoWrapText);else{const r=o?.style||{};s&&(r.padding=s),n=yC(r,i.isColumnHeader(t,e)||i.isBottomFrozenRow(t,e)?this.theme.headerStyle:i.isRowHeader(t,e)||i.isRightFrozenColumn(t,e)?this.theme.rowHeaderStyle:this.theme.cornerHeaderStyle,{col:t,row:e,table:this,value:this.getCellValue(t,e),dataValue:this.getCellOriginValue(t,e),cellHeaderPaths:this.getCellHeaderPaths(t,e)},a,this.options.autoWrapText)}return this.headerStyleCache.set(r,n),n}let r,n;if(r=this.isListTable()&&!this.transpose||this.isPivotTable()&&this.internalProps.layoutMap.indicatorsAsCol?t:e,n=i.isBottomFrozenRow(e)?this.bodyBottomStyleCache.get(r):this.bodyStyleCache.get(r),n)return n;const o=i.getBody(t,e),s=this.internalProps.bodyHelper.getStyleClass(o.cellType),a=o?.style;return n=gC(a,i.isBottomFrozenRow(e)&&this.theme.bottomFrozenStyle?this.theme.bottomFrozenStyle:i.isRightFrozenColumn(t)&&this.theme.rightFrozenStyle?this.theme.rightFrozenStyle:this.theme.bodyStyle,{col:t,row:e,table:this,value:this.getCellValue(t,e),dataValue:this.getCellOriginValue(t,e),cellHeaderPaths:this.getCellHeaderPaths(t,e)},s,this.options.autoWrapText),$(a)||(i.isBottomFrozenRow(e)?this.bodyBottomStyleCache.set(r,n):this.bodyStyleCache.set(r,n)),n}clearCellStyleCache(){this.headerStyleCache.clear(),this.bodyStyleCache.clear(),this.bodyBottomStyleCache.clear()}clearRowHeightCache(){this.internalProps._rowHeightsMap.clear(),this._clearRowRangeHeightsMap()}clearColWidthCache(){this.internalProps._colWidthsMap.clear(),this._clearColRangeWidthsMap()}_canResizeColumn(t,e){if(!(t>=0&&e>=0))return!1;if(this.isCellRangeEqual(t,e,t+1,e))return!1;if("none"===this.internalProps.columnResizeMode)return!1;if("header"===this.internalProps.columnResizeMode){if(!this.isHeader(t,e))return!1}else if("body"===this.internalProps.columnResizeMode&&this.isHeader(t,e))return!1;const i=this.colWidthsLimit[t];return!(i&&i.min&&i.max)||i.max!==i.min}_canDragHeaderPosition(t,e){if(this.isHeader(t,e)&&this.stateManager.isSelected(t,e)){const i=this.stateManager.select.ranges[0];if(this.isColumnHeader(t,e)){if(i.end.row!==this.rowCount-1)return!1}else{if(!this.isRowHeader(t,e))return!1;if(i.end.col!==this.colCount-1)return!1}const r=this.getHeaderDefine(t,e);if(!r)return!1;if(void 0===r.dragHeader){if("all"===this.internalProps.dragHeaderMode)return!0;if("column"===this.internalProps.dragHeaderMode){if(this.isColumnHeader(t,e))return!0}else if("row"===this.internalProps.dragHeaderMode&&this.isRowHeader(t,e))return!0;return!1}return r.dragHeader}return!1}getCellIcons(t,e){let i;if(this.isHeader(t,e))i=this.internalProps.headerHelper.getIcons(t,e);else{const r=this.getCellValue(t,e),n=this.getCellOriginValue(t,e),o=this.internalProps.context;i=this.internalProps.bodyHelper.getIcons(t,e,r,n,o)}return i}showDropDownMenu(t,e,i){let r="dropdown-menu";i&&(r=Array.isArray(i.content)?"dropdown-menu":"container"),"html"===this.internalProps.menu.renderMode&&(this.stateManager.menu.isShow=!0,this.internalProps.menuHandler._bindToCell(t,e,r,i))}showTooltip(t,e,i){"html"===this.internalProps.tooltip.renderMode&&this.internalProps.tooltipHandler._bindToCell(t,e,i)}getCellStyle(t,e){const i=this._getCellStyle(t,e),r=OS(i,this,t,e,QS).theme,{autoWrapText:n,lineClamp:o,textOverflow:s}=i;return{textAlign:r.text.textAlign,textBaseline:r.text.textBaseline,bgColor:K(r.group.fill)?QS("bgColor",i,t,e,this):r.group.fill,color:K(r.text.fill)?QS("color",i,t,e,this):r.text.fill,fontFamily:r.text.fontFamily,fontSize:r.text.fontSize,fontWeight:r.text.fontWeight,fontVariant:r.text.fontVariant,fontStyle:r.text.fontStyle,lineHeight:r.text.lineHeight,autoWrapText:n??!1,lineClamp:o??"auto",textOverflow:s,borderColor:K(r.group.stroke)?QS("borderColor",i,t,e,this):r.group.stroke,borderLineWidth:r.group.lineWidth,borderLineDash:r.group.lineDash,underline:!!r.text.underline,lineThrough:!!r.text.lineThrough,padding:r._vtable.padding,underlineWidth:r.text.underline,lineThroughLineWidth:r.text.lineThrough,_strokeArrayWidth:r.group.strokeArrayWidth,_strokeArrayColor:r.group.strokeArrayColor,_linkColor:QS("linkColor",i,t,e,this)}}getAllBodyCells(t,e){const i=this.rowHeaderLevelCount,r=this.columnHeaderLevelCount,n=this.colCount-1,o=this.rowCount-1;return Array(Math.min(e??2e3,o-r+1,this.rowCount)).fill(0).map(((e,o)=>Array(Math.min(t??2e3,n-i+1,this.colCount)).fill(0).map(((t,e)=>this.getCellInfo(e+i,o+r)))))}getAllCells(t,e){const i=0,r=0,n=this.colCount-1,o=this.rowCount-1;return Array(Math.min(e??2e3,o-r+1,this.rowCount)).fill(0).map(((e,o)=>Array(Math.min(t??2e3,n-i+1,this.colCount)).fill(0).map(((t,e)=>this.getCellInfo(e+i,o+r)))))}getAllColumnHeaderCells(){const t=this.rowHeaderLevelCount,e=0,i=this.colCount-1,r=this.columnHeaderLevelCount-1;return Array(r-e+1).fill(0).map(((r,n)=>Array(i-t+1).fill(0).map(((i,r)=>this.getCellInfo(r+t,n+e)))))}getAllRowHeaderCells(){const t=0,e=this.columnHeaderLevelCount,i=this.rowHeaderLevelCount-1,r=this.rowCount-1;return Array(r-e+1).fill(0).map(((r,n)=>Array(i-t+1).fill(0).map(((i,r)=>this.getCellInfo(r+t,n+e)))))}scrollToCell(t){const e=this.getDrawRange();if(Y(t.col)&&t.col>=this.frozenColCount){const i=this.getFrozenColsWidth(),r=this.getColsWidth(0,t.col-1);this.scrollLeft=Math.min(r-i,this.getAllColsWidth()-e.width)}if(Y(t.row)&&t.row>=this.frozenRowCount){const i=this.getFrozenRowsHeight(),r=this.getRowsHeight(0,t.row-1);this.scrollTop=Math.min(r-i,this.getAllRowsHeight()-e.height)}this.render()}getCopyValue(){if(this.stateManager.select?.ranges?.length>0){const t=this.stateManager.select.ranges;let e=Math.min(t[0].start.col,t[0].end.col),i=Math.max(t[0].start.col,t[0].end.col),r=Math.min(t[0].start.row,t[0].end.row),n=Math.max(t[0].start.row,t[0].end.row);t.forEach((t=>{e=Math.min(e,t.start.col,t.end.col),i=Math.max(i,t.start.col,t.end.col),r=Math.min(r,t.start.row,t.end.row),n=Math.max(n,t.start.row,t.end.row)}));const o=e=>{let i=!1;return t.forEach((t=>{const r=Math.min(t.start.row,t.end.row),n=Math.max(t.start.row,t.end.row);r<=e&&n>=e&&(i=!0)})),i},s=e=>{let i=!1;return t.forEach((t=>{const r=Math.min(t.start.col,t.end.col),n=Math.max(t.start.col,t.end.col);r<=e&&n>=e&&(i=!0)})),i},a=(e,i)=>{let r;return t.forEach((t=>{const n=Math.min(t.start.row,t.end.row),o=Math.max(t.start.row,t.end.row),s=Math.min(t.start.col,t.end.col),a=Math.max(t.start.col,t.end.col);s<=e&&a>=e&&n<=i&&o>=i&&(r=t)})),r},l=(t,e,i)=>{const r=this.getCellRange(t,e);let n=r.start.col,o=r.start.row;if(i){const t=Math.min(i.start.col,i.end.col),e=Math.min(i.start.row,i.end.row);n=Math.max(t,r.start.col),o=Math.max(e,r.start.row)}if(n!==t||o!==e)return"";return this.getCellValue(t,e)};let h="";for(let t=r;t<=n;t++){if(o(t)){for(let r=e;r<=i;r++){if(s(r)){const e=a(r,t);if(e){const n=l(r,t,e);if("undefined"!=typeof Promise&&n instanceof Promise);else{const t=`${n}`;/^\[object .*\]$/.exec(t)||(h+=t)}(r<e.end.col||r<i)&&(h+="\t")}else h+="\t"}}t<n&&(h+="\n")}}return h}return""}getSelectedCellInfos(){if(!this.stateManager.select?.ranges)return null;const t=this.stateManager.select.ranges;if(!t.length)return[];let e=Math.min(t[0].start.col,t[0].end.col),i=Math.max(t[0].start.col,t[0].end.col),r=Math.min(t[0].start.row,t[0].end.row),n=Math.max(t[0].start.row,t[0].end.row);t.forEach((t=>{e=Math.min(e,t.start.col,t.end.col),i=Math.max(i,t.start.col,t.end.col),r=Math.min(r,t.start.row,t.end.row),n=Math.max(n,t.start.row,t.end.row)}));const o=e=>{let i=!1;return t.forEach((t=>{const r=Math.min(t.start.row,t.end.row),n=Math.max(t.start.row,t.end.row);r<=e&&n>=e&&(i=!0)})),i},s=e=>{let i=!1;return t.forEach((t=>{const r=Math.min(t.start.col,t.end.col),n=Math.max(t.start.col,t.end.col);r<=e&&n>=e&&(i=!0)})),i},a=(e,i)=>{let r;return t.forEach((t=>{const n=Math.min(t.start.row,t.end.row),o=Math.max(t.start.row,t.end.row),s=Math.min(t.start.col,t.end.col),a=Math.max(t.start.col,t.end.col);s<=e&&a>=e&&n<=i&&o>=i&&(r=t)})),r},l=[];for(let t=r;t<=n;t++){if(o(t)){const r=[];for(let n=e;n<=i;n++){if(s(n)){if(a(n,t)){const e=this.getCellInfo(n,t);r.push(e)}}}l.push(r)}}return l}measureText(t,e){return YT.measureText(t,e)}getCustomRender(t,e){let i;if("body"!==this.getCellLocation(t,e)){const r=this.getHeaderDefine(t,e);i=r?.headerCustomRender}else{const r=this.getBodyColumnDefine(t,e);i=r?.customRender||this.customRender}return i}getCustomLayout(t,e){let i;if("body"!==this.getCellLocation(t,e)){const r=this.getHeaderDefine(t,e);i=r?.headerCustomLayout}else{const r=this.getBodyColumnDefine(t,e);i=r?.customLayout}return i}hasAutoImageColumn(){return this.internalProps.layoutMap.columnObjects.find((t=>!("image"!==t.cellType&&"function"!=typeof t.cellType||!t.define.imageAutoSizing)))}_getActiveChartInstance(){const t=this.scenegraph.getCell(this.stateManager.hover?.cellPos?.col,this.stateManager.hover?.cellPos?.row);return"chart"===t?.getChildren()?.[0]?.type?t.getChildren()[0].activeChartInstance:null}cellIsInVisualView(t,e){const i=this.getDrawRange(),r=this.getCellRelativeRect(t,e);return t<this.frozenColCount&&e<this.frozenRowCount||r.top>=i.top&&r.bottom<=i.bottom&&r.left>=i.left&&r.right<=i.right}getCustomMergeValue(t,e){if(this.internalProps.customMergeCell){const i=this.getCustomMerge(t,e);if(i){const{text:t}=i;return t}}}exportImg(){return this.scenegraph.stage.toCanvas().toDataURL()}exportCellImg(t,e){const i=this.cellIsInVisualView(t,e),{scrollTop:r,scrollLeft:n}=this;i||this.scrollToCell({col:t,row:e});const o=this.getCellRelativeRect(t,e),s=this.scenegraph.stage.toCanvas(!1,(new ge).set(o.left+this.tableX+1,o.top+this.tableY+1,o.right+this.tableX,o.bottom+this.tableY));return i||(this.setScrollTop(r),this.setScrollLeft(n)),s.toDataURL()}exportCellRangeImg(t){const{scrollTop:e,scrollLeft:i}=this,r=Math.min(t.start.col,t.end.col),n=Math.min(t.start.row,t.end.row),o=Math.max(t.start.col,t.end.col),s=Math.max(t.start.row,t.end.row),a=this.cellIsInVisualView(r,n),l=this.cellIsInVisualView(o,s);a&&l||this.scrollToCell({col:r,row:n});const h=this.getCellRangeRelativeRect({start:{col:r,row:n},end:{col:o,row:s}}),c=this.scenegraph.stage.toCanvas(!1,(new ge).set(h.left+this.tableX+1,h.top+this.tableY+1,h.right+this.tableX,h.bottom+this.tableY)).toDataURL();return a&&l||(this.setScrollTop(e),this.setScrollLeft(i)),c}exportCanvas(){return this.scenegraph.stage.toCanvas()}getImageBuffer(t="image/png"){if("node"!==this.options.mode)return;this.render();const e=this.scenegraph.stage;if(e){const i=this.tableX+this.getAllColsWidth(),r=this.tableY+this.getAllRowsHeight();if(i>=this.canvasWidth&&r>=this.canvasHeight){e.render();return e.window.getImageBuffer(t)}return this.scenegraph.stage.toCanvas(!1,(new ge).set(0,0,Math.min(this.canvasWidth,i),Math.min(this.canvasHeight,r))).toBuffer(t)}return null}getBodyIndexByTableIndex(t,e){return{col:t-this.rowHeaderLevelCount,row:e-this.columnHeaderLevelCount}}getTableIndexByBodyIndex(t,e){return{col:t+this.rowHeaderLevelCount,row:e+this.columnHeaderLevelCount}}onVChartEvent(t,e,i){this._chartEventMap[t]||(this._chartEventMap[t]=[]),"function"==typeof e?this._chartEventMap[t].push({callback:e}):this._chartEventMap[t].push({callback:i,query:e})}offVChartEvent(t,e){this._chartEventMap[t]&&(this._chartEventMap[t]=e?this._chartEventMap[t].filter((t=>t.callback!==e)):[])}_bindChartEvent(t){if(t)for(const e in this._chartEventMap)(this._chartEventMap[e]||[]).forEach((i=>{i.query?t.on(e,i.query,i.callback):t.on(e,i.callback)}))}}var NR=Object.freeze({__proto__:null,BaseTable:WR});const GR={};function jR(t){if(GR[t])return GR[t]}function UR(t,e,i){const r=t[e];return t[e]=i,r}function VR(t){for(const e in t)delete t[e]}function KR(){VR(Cv),VR(KS),VR(cA)}var $R=Object.freeze({__proto__:null,chartModule:function(t,e){return null!=e?UR(cA,t,e):cA[t]},clearAll:KR,editor:function(t,e){return null!=e?UR(GR,t,e):GR[t]},icon:function(t,e){return null!=e?UR(KS,t,e):KS[t]},theme:function(t,e){return null!=e?UR(Cv,t,e):Cv[t]}});var XR=Object.freeze({__proto__:null,dateFormat:function(t,e,i,r,n){null==i&&(i=!1),null==r&&(r=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]),null==n&&(n=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"]);const o=i?"UTC":"",s=function(t){return`0${t}`.substring(0,2)};return function(i){const a=new Date(Date.parse(i[t]));return e.replace(/%(.)/g,(function(t,e){switch(e){case"y":return a[`get${o}FullYear`]();case"m":return s(a[`get${o}Month`]()+1);case"n":return r[a[`get${o}Month`]()];case"d":return s(a[`get${o}Date`]());case"w":return n[a[`get${o}Day`]()];case"x":return a[`get${o}Day`]();case"H":return s(a[`get${o}Hours`]());case"M":return s(a[`get${o}Minutes`]());case"S":return s(a[`get${o}Seconds`]());default:return`%${e}`}}))}},numberFormat:function(t){return t=Object.assign({},{digitsAfterDecimal:2,scaler:1,thousandsSep:",",decimalSep:".",prefix:"",suffix:""},t),function(e){if(isNaN(e)||!isFinite(e))return"";const i=function(t,e,i){const r=(t+="").split(".");let n=r[0];const o=r.length>1?i+r[1]:"";return n=function(t,e){return t.replace(/\d+/,(function(t){return t.replace(/(\d)(?=(\d{3})+$)/g,(function(t){return`${t}${e}`}))}))}(n,e),n+o}((t.scaler*e).toFixed(t.digitsAfterDecimal),t.thousandsSep,t.decimalSep);return`${t.prefix}${i}${t.suffix}`}}});const YR="NO_AXISID_FRO_VTABLE";function qR(t,e,i){const r=i.getRawChartSpec(t,e);if(r?.series){const t={};return r.data?.id&&(t[r.data.id]=void 0),r?.series.forEach((e=>{if(!e.data?.fromDataId)if(e.data?.transforms)t[e.data?.id??r.data?.id??"data"]=void 0;else{const i="horizontal"===e.direction?e.xField:e.yField;t[e.data?.id??r.data?.id??"data"]=e.data?.id?i:void 0}})),t}return r.data.id}function ZR(t,e,i,r,n,o,s){const{axisOption:a,isPercent:l,isZeroAlign:h,seriesIndice:c}=WA(t,e,r,s),d=GA(s.dataset.collectedValues,n,h,o,c??i);if(l&&(d.min=d.min<0?-1:0,d.max=d.max>0?1:0),(a?.zero||d.min===d.max)&&(d.min=Math.min(d.min,0),d.max=Math.max(d.max,0)),a?.nice){const{range:e}=EA(d.min,d.max,a,0,s._table.getColWidth(t));d.min=e[0],d.max=e[1]}return ot(a?.min)&&(d.min=a.min),ot(a?.max)&&(d.max=a.max),{range:d,isZeroAlign:h,axisOption:a}}class JR{seqId=0;_headerObjects;_headerObjectMap;_headerCellIds;_columns;bodyRowSpanCount=1;hierarchyIndent;_transpose=!1;_showHeader=!0;_recordsCount=0;_table;_cellRangeMap;constructor(t,e,i,r){this._cellRangeMap=new Map,this._showHeader=i,this._table=t,this._columns=[],this._headerCellIds=[],this.hierarchyIndent=r??20,this._headerObjects=this._addHeaders(0,e,[]),this._headerObjectMap=this._headerObjects.reduce(((t,e)=>(t[e.id]=e,t)),{})}get transpose(){return this._transpose}set transpose(t){this._transpose=t}get showHeader(){return this._showHeader}set showHeader(t){this._showHeader=t}isHeader(t,e){return!!(this.transpose&&t>=0&&t<this.headerLevelCount)||!this.transpose&&e>=0&&e<this.headerLevelCount}getCellLocation(t,e){return this.isHeader(t,e)?this.transpose?"rowHeader":"columnHeader":"body"}isRowHeader(t,e){return!!(this.transpose&&t>=0&&t<=this.headerLevelCount-1)}isColumnHeader(t,e){return!this.transpose&&e>=0&&e<=this.headerLevelCount-1}isFrozenColumn(t,e){if(Y(e)){if(t>=0&&t<this.frozenColCount&&e>=this.frozenRowCount&&e<this.rowCount-this.bottomFrozenRowCount)return!0}else if(this.frozenColCount>0&&t>=0&&t<this.frozenColCount)return!0;return!1}isRightFrozenColumn(t,e){if(Y(e)){if(t>=this.colCount-this.rightFrozenColCount&&e>=this.frozenRowCount&&e<this.rowCount-this.bottomFrozenRowCount)return!0}else if(this.rightFrozenColCount>0&&t>=this.colCount-this.rightFrozenColCount)return!0;return!1}isFrozenRow(t,e){if(Y(e)){if(e>=0&&e<this.frozenRowCount&&t>=this.frozenColCount&&t<this.colCount-this.rightFrozenColCount)return!0}else if(e=t,this.frozenRowCount>0&&e>=0&&e<this.frozenRowCount)return!0;return!1}isBottomFrozenRow(t,e){if(Y(e)){if(e>=this.rowCount-this.bottomFrozenRowCount&&t>=this.frozenColCount&&t<this.colCount-this.rightFrozenColCount)return!0}else if(e=t,this.frozenRowCount>0&&e>=this.rowCount-this.bottomFrozenRowCount)return!0;return!1}isLeftBottomCorner(t,e){return t>=0&&t<this.rowHeaderLevelCount&&e>=this.rowCount-this.bottomFrozenRowCount}isRightTopCorner(t,e){return t>=this.colCount-this.rightFrozenColCount&&e>=0&&e<this.columnHeaderLevelCount}isRightBottomCorner(t,e){return t>=this.colCount-this.rightFrozenColCount&&e>=this.rowCount-this.bottomFrozenRowCount}isCornerHeader(t,e){return!1}getColumnHeaderRange(){return this.transpose?{start:{col:0,row:0},end:{col:this._headerCellIds.length-1,row:(this.rowCount??0)-1}}:{start:{col:0,row:0},end:{col:(this.colCount??0)-1,row:this._headerCellIds.length-1}}}getRowHeaderRange(){return this.transpose?{start:{col:0,row:0},end:{col:this._headerCellIds.length-1,row:(this.rowCount??0)-1}}:{start:{col:0,row:0},end:{col:(this.colCount??0)-1,row:this._headerCellIds.length-1}}}getCornerHeaderRange(){}getBodyRange(){return this.transpose?{start:{col:this.headerLevelCount,row:0},end:{col:(this.colCount??0)-1,row:(this.rowCount??0)-1}}:{start:{col:0,row:this.headerLevelCount},end:{col:(this.colCount??0)-1,row:(this.rowCount??0)-1}}}get headerLevelCount(){return this.showHeader?this._headerCellIds.length:0}get columnHeaderLevelCount(){return this.transpose?0:this.headerLevelCount}get rowHeaderLevelCount(){return this.transpose?this.headerLevelCount:0}get frozenColCount(){return this._table.internalProps.frozenColCount?this.colCount>this._table.internalProps.frozenColCount?this._table.internalProps.frozenColCount:this.colCount:0}get frozenRowCount(){return this._table.internalProps.frozenRowCount?this.rowCount>=this._table.internalProps.frozenRowCount?this._table.internalProps.frozenRowCount:this.rowCount:0}get bottomFrozenRowCount(){return this._table.internalProps.bottomFrozenRowCount?this.rowCount-this.headerLevelCount>=this._table.internalProps.bottomFrozenRowCount?this._table.internalProps.bottomFrozenRowCount:this.rowCount-this.headerLevelCount:0}get rightFrozenColCount(){return this._table.internalProps.rightFrozenColCount?this.colCount-this.rowHeaderLevelCount>=this._table.internalProps.rightFrozenColCount?this._table.internalProps.rightFrozenColCount:this.colCount-this.rowHeaderLevelCount:0}get colCount(){return this.transpose?this.headerLevelCount+this.recordsCount:this._columns.length}get rowCount(){return this.transpose?this._columns.length:this.headerLevelCount+this.recordsCount}get bodyRowCount(){return this.transpose?this._columns.length:this.rowCount-this.bottomFrozenRowCount-this.headerLevelCount}get bodyColCount(){return this.transpose?this.colCount-this.rightFrozenColCount-this.rowHeaderLevelCount:this._columns.length}get recordsCount(){return this._recordsCount}set recordsCount(t){this._recordsCount=t}get headerObjects(){return this._headerObjects}get columnObjects(){return this._columns}get columnWidths(){return this._columns}getColumnWidthDefined(t){if(this.transpose){let e,i,r=0;if(t>=this.rowHeaderLevelCount){let t;return this.columnObjects.forEach(((n,o)=>{"number"==typeof n.width?r=Math.max(n.width,r):"auto"===n.width&&(t=!0),"number"==typeof n.minWidth&&(i=Math.max(n.minWidth,i)),"number"==typeof n.maxWidth&&(e=Math.max(n.maxWidth,e))})),r=r>0?r:t?"auto":void 0,{width:r,minWidth:i,maxWidth:e}}if(this.isRowHeader(t,0)){const e=Array.isArray(this._table.defaultHeaderColWidth)?this._table.defaultHeaderColWidth[t]??this._table.defaultColWidth:this._table.defaultHeaderColWidth;return"auto"===e?{width:"auto"}:{width:e}}}return this._columns[t]}getCellId(t,e){return this.transpose?this.headerLevelCount<=t?this._columns[e]?.id:this._headerCellIds[t]?.[e]:this.headerLevelCount<=e?this._columns[t]?.id:this._headerCellIds[e]?.[t]}getHeader(t,e){const i=this.getCellId(t,e);return this._headerObjectMap[i]}getHeaderFieldKey(t,e){const i=this.getCellId(t,e);return this._headerObjectMap[i]?.fieldKey||(this.transpose?this._columns[e]?.fieldKey:this._columns[t]?.fieldKey)}getHeaderField(t,e){const i=this.getCellId(t,e);return this._headerObjectMap[i]?.field||(this.transpose?this._columns[e]&&this._columns[e].field:this._columns[t]&&this._columns[t].field)}getHeaderCellAdressById(t){for(let e=0;e<this._headerCellIds.length;e++){const i=this._headerCellIds[e];for(let r=0;r<i.length;r++)if(i[r]===t)return this.transpose?{col:e,row:r}:{col:r,row:e}}}getHeaderCellAddressByField(t){const e=this.headerObjects.find((e=>e&&e.field===t));return this.getHeaderCellAdressById(e.id)}getBody(t,e){return this.transpose?this._columns[e]:this._columns[t]}getBodyLayoutRangeById(t){if(this.transpose){for(let e=0;e<(this.rowCount??0);e++)if(t===this._columns[e].id)return{start:{col:0,row:e},end:{col:0,row:e}}}else for(let e=0;e<(this.colCount??0);e++)if(t===this._columns[e].id)return{start:{col:e,row:0},end:{col:e,row:0}};throw new Error(`can not found body layout @id=${t}`)}getBodyCellValue(t,e){if(this.isHeader(t,e))return null;const{field:i,fieldFormat:r}=this.getBody(t,e);return this._table.getFieldData(r||i,t,e)}getCellRange(t,e){if(-1===t||-1===e)return{start:{col:t,row:e},end:{col:t,row:e}};if(this._cellRangeMap.has(`$${t}$${e}`))return this._cellRangeMap.get(`$${t}$${e}`);let i={start:{col:t,row:e},end:{col:t,row:e}};if(this.transpose)i=this.getCellRangeTranspose(t,e);else if(this.headerLevelCount<=e){if(this.headerLevelCount<=e&&this.columnObjects[t]?.define?.mergeCell){const r=this.getBodyCellValue(t,e);for(let n=e-1;n>=this.headerLevelCount;n--){const e=this.getBodyCellValue(t,n);if("boolean"==typeof this.columnObjects[t].define.mergeCell){if(r!==e)break}else if(!this.columnObjects[t].define.mergeCell(r,e))break;i.start.row=n}for(let n=e+1;n<this.rowCount;n++){const e=this.getBodyCellValue(t,n);if("boolean"==typeof this.columnObjects[t].define.mergeCell){if(r!==e)break}else if(!this.columnObjects[t].define.mergeCell(r,e))break;i.end.row=n}}}else{const r=this.getCellId(t,e);for(let n=t-1;n>=0&&r===this.getCellId(n,e);n--)i.start.col=n;for(let n=t+1;n<(this.colCount??0)&&r===this.getCellId(n,e);n++)i.end.col=n;for(let n=e-1;n>=0&&r===this.getCellId(t,n);n--)i.start.row=n;for(let n=e+1;n<this.headerLevelCount&&r===this.getCellId(t,n);n++)i.end.row=n}return this._cellRangeMap.set(`$${t}$${e}`,i),i}getCellRangeTranspose(t,e){const i={start:{col:t,row:e},end:{col:t,row:e}};if(this.headerLevelCount<=t||-1===t&&-1===e){if(this.headerLevelCount<=t&&this.columnObjects[e]?.define?.mergeCell){const r=this.getBodyCellValue(t,e);for(let n=t-1;n>=this.headerLevelCount;n--){const t=this.getBodyCellValue(n,e);if("boolean"==typeof this.columnObjects[e].define.mergeCell){if(r!==t)break}else if(!this.columnObjects[e].define.mergeCell(r,t))break;i.start.col=n}for(let n=t+1;n<(this.colCount??0);n++){const t=this.getBodyCellValue(n,e);if("boolean"==typeof this.columnObjects[e].define.mergeCell){if(r!==t)break}else if(!this.columnObjects[e].define.mergeCell(r,t))break;i.end.col=n}}return i}const r=this.getCellId(t,e);for(let n=e-1;n>=0&&r===this.getCellId(t,n);n--)i.start.row=n;for(let n=e+1;n<(this.rowCount??0)&&r===this.getCellId(t,n);n++)i.end.row=n;for(let n=t-1;n>=0&&r===this.getCellId(n,e);n--)i.start.col=n;for(let n=t+1;n<this.headerLevelCount&&r===this.getCellId(n,e);n++)i.end.col=n;return i}isCellRangeEqual(t,e,i,r){const n=this.getCellRange(t,e),o=this.getCellRange(i,r);return n.start.col===o.start.col&&n.end.col===o.end.col&&n.start.row===o.start.row&&n.end.row===o.end.row}getRecordIndexByCell(t,e){return this.transpose?t<this.headerLevelCount?-1:t-this.headerLevelCount:e<this.headerLevelCount?-1:e-this.headerLevelCount}getRecordStartRowByRecordIndex(t){return this.headerLevelCount+t}_addHeaders(t,e,i,r){const n=[],o=this._newRow(t,r);return e.forEach((e=>{const s=this._columns.length,a=this.seqId++,l={id:a,title:e.title??e.caption,headerIcon:e.headerIcon,field:e.field,fieldKey:e?.fieldKey,fieldFormat:e.fieldFormat,style:e.headerStyle,headerType:e.headerType??"text",dropDownMenu:e.dropDownMenu,define:e,columnWidthComputeMode:e.columnWidthComputeMode};n[a]=l;for(let e=t-1;e>=0;e--)this._headerCellIds[e][s]=i[e];if(o[s]=r?this._headerCellIds[t-1][s]:a,e.columns)this._addHeaders(t+1,e.columns,[...i,a],e.hideColumnsSubHeader).forEach((t=>n.push(t)));else{const i=e;this._columns.push({id:this.seqId++,field:i.field,fieldKey:i.fieldKey,fieldFormat:i.fieldFormat,width:i.width,minWidth:i.minWidth,maxWidth:i.maxWidth,icon:i.icon,cellType:i.cellType??i.columnType??"text",chartModule:"chartModule"in i?i.chartModule:null,chartSpec:"chartSpec"in i?i.chartSpec:null,sparklineSpec:"sparklineSpec"in i?i.sparklineSpec:Sv,style:i.style,define:i,columnWidthComputeMode:i.columnWidthComputeMode,disableColumnResize:i?.disableColumnResize});for(let e=t+1;e<this._headerCellIds.length;e++)this._headerCellIds[e][s]=a}})),n}_newRow(t,e=!1){if(this._headerCellIds[t]){const e=this._headerCellIds[t-1];if(e.length>this._headerCellIds[t].length)for(let i=this._headerCellIds[t].length;i<e.length;i++)this._headerCellIds[t][i]=e[i];return this._headerCellIds[t]}if(e)return[];const i=this._headerCellIds[t]=[];if(!this._columns.length)return i;const r=this._headerCellIds[t-1];for(let t=0;t<r.length;t++)i[t]=r[t];return i}getCellHeaderPaths(t,e){let i=[],r=[];return this.transpose?r=[{field:this._columns[e].field}]:i=[{field:this._columns[t].field}],{colHeaderPaths:i,rowHeaderPaths:r,cellLocation:this.getCellLocation(t,e)}}getParentCellId(t,e){if(0!==e)return this.isColumnHeader(t,e)?this.getCellId(t,e-1):this.isRowHeader(t,e)?this.getCellId(t-1,e):void 0}canMoveHeaderPosition(t,e){if(t.col<0||t.row<0||e.col<0||e.row<0)return!1;const i=this.getCellRange(t.col,t.row);if(this.isColumnHeader(t.col,t.row)){return this.getParentCellId(t.col,i.start.row)===this.getParentCellId(e.col,i.start.row)}if(this.isRowHeader(t.col,t.row)){return this.getParentCellId(i.start.col,t.row)===this.getParentCellId(i.start.col,e.row)}return!1}moveHeaderPosition(t,e){if(this.canMoveHeaderPosition(t,e)){const i=this.getCellRange(t.col,t.row);if(this.isColumnHeader(t.col,t.row)){const r=i.end.col-i.start.col+1;let n;const o=this.getCellRange(e.col,i.start.row);if(n=e.col>=t.col?o.end.col-r+1:o.start.col,n===i.start.col)return null;for(let t=0;t<this._headerCellIds.length;t++){const e=this._headerCellIds[t].splice(i.start.col,r);e.unshift(n,0),Array.prototype.splice.apply(this._headerCellIds[t],e)}const s=this._columns.splice(i.start.col,r);return s.unshift(n,0),Array.prototype.splice.apply(this._columns,s),this._cellRangeMap=new Map,{sourceIndex:i.start.col,targetIndex:n,moveSize:r,moveType:"column"}}if(this.isRowHeader(t.col,t.row)){const r=i.end.row-i.start.row+1;let n;const o=this.getCellRange(i.start.col,e.row);if(n=e.row>=t.row?o.end.row-r+1:o.start.row,n===i.start.row)return null;for(let t=0;t<this._headerCellIds.length;t++){const e=this._headerCellIds[t].splice(i.start.row,r);e.unshift(n,0),Array.prototype.splice.apply(this._headerCellIds[t],e)}const s=this._columns.splice(i.start.row,r);return s.unshift(n,0),Array.prototype.splice.apply(this._columns,s),this._cellRangeMap=new Map,{sourceIndex:i.start.row,targetIndex:n,moveSize:r,moveType:"row"}}}return null}toggleHierarchyState(t){const e=t.add.map((t=>({col:0,row:this._table.frozenRowCount+t}))),i=t.remove.map((t=>({col:0,row:this._table.frozenRowCount+t})));return{addCellPositions:e,removeCellPositions:i}}setChartInstance(t,e,i){(this.transpose?this._columns[e]:this._columns[t]).chartInstance=i}getChartInstance(t,e){return(this.transpose?this._columns[e]:this._columns[t]).chartInstance}getAxisConfigInPivotChart(t,e){}isEmpty(t,e){return!1}isAxisCell(t,e){return!1}getChartAxes(t,e){return[]}getRawChartSpec(t,e){const i=this.getBody(t,e);return i?.chartSpec}getChartDataId(t,e){return qR(t,e,this)}release(){const t=this._table._getActiveChartInstance();t?.release(),this.columnObjects.forEach((t=>{t.chartInstance?.release()}))}clearCellRangeMap(){this._cellRangeMap.clear()}updateColumnTitle(t,e,i){const r=this._table.internalProps.layoutMap.getHeader(t,e);r.title=i,r.define.title=i}}class QR{table;_titleOption;isReleased=!1;_titleComponent;_cacheAttrs;constructor(t,e){this.table=e,this._titleOption=t,!1!==t.visible&&(this._titleComponent=this._createOrUpdateTitleComponent(this._getTitleAttrs()))}_createOrUpdateTitleComponent(t){if(this._titleComponent)St(t,this._cacheAttrs)||this._titleComponent.setAttributes(t);else{const e=new Vx(t);e.name="title",this.table.scenegraph.stage.defaultLayer.appendChild(e),this._titleComponent=e}return this._adjustTableSize(this._titleComponent.attribute),this._titleComponent}resize(){if(!this._titleComponent)return;const t=eS(this._titleOption.padding??10),e=this._titleOption.width??Math.min(this.table.tableNoFrameWidth,this.table.getDrawRange().width)-t[1]-t[3],i=this._titleOption.height??Math.min(this.table.tableNoFrameHeight,this.table.getDrawRange().height)-t[0]-t[2];this._titleComponent.setAttributes({x:this._titleOption.x??"right"===this._titleOption.orient?this.table.tableX+Math.min(this.table.tableNoFrameWidth,this.table.getDrawRange().width):this.table.tableX,y:this._titleOption.y??"bottom"===this._titleOption.orient?this.table.tableY+this.table.tableNoFrameHeight:this.table.tableY,width:"top"===this._titleOption.orient||"bottom"===this._titleOption.orient?e:this._titleOption.width,height:"left"===this._titleOption.orient||"right"===this._titleOption.orient?i:this._titleOption.height,textStyle:{width:e,...this._titleOption.textStyle},subtextStyle:{width:e,...this._titleOption.subtextStyle}}),this._adjustTableSize(this._titleComponent.attribute)}_adjustTableSize(t){const e=isFinite(this._titleComponent?.AABBBounds.width())?this._titleComponent.AABBBounds.width():0,i=isFinite(this._titleComponent?.AABBBounds.height())?this._titleComponent.AABBBounds.height():0;"left"===this._titleOption.orient?(this.table.tableNoFrameWidth=this.table.tableNoFrameWidth-Math.ceil(e),this.table.tableX+=Math.ceil(e)):"top"===this._titleOption.orient?(this.table.tableNoFrameHeight=this.table.tableNoFrameHeight-Math.ceil(i),this.table.tableY+=Math.ceil(i)):"right"===this._titleOption.orient?this.table.tableNoFrameWidth=this.table.tableNoFrameWidth-Math.ceil(e):"bottom"===this._titleOption.orient&&(this.table.tableNoFrameHeight=this.table.tableNoFrameHeight-Math.ceil(i)),this._cacheAttrs=t,"right"!==this._titleOption.orient&&"bottom"!==this._titleOption.orient||this._titleComponent.setAttributes({x:this._titleOption.x??"right"===this._titleOption.orient?this.table.tableX+this.table.tableNoFrameWidth:this.table.tableX,y:this._titleOption.y??"bottom"===this._titleOption.orient?this.table.tableY+this.table.tableNoFrameHeight:this.table.tableY})}release(){this._titleComponent&&this.table.scenegraph.stage.defaultLayer.removeChild(this._titleComponent),this._titleComponent=null,this.isReleased=!0}_getTitleAttrs(){const t=this._titleOption.text||this._titleOption.subtext?10:0,e=eS(this._titleOption.padding??t),i=this._titleOption.width??Math.min(this.table.tableNoFrameWidth,this.table.getDrawRange().width)-e[1]-e[3],r=this._titleOption.height??Math.min(this.table.tableNoFrameHeight,this.table.getDrawRange().height)-e[0]-e[2];return{text:this._titleOption.text??"",subtext:this._titleOption.subtext??"",x:this._titleOption.x??"right"===this._titleOption.orient?this.table.tableX+Math.min(this.table.tableNoFrameWidth,this.table.getDrawRange().width):this.table.tableX,y:this._titleOption.y??"bottom"===this._titleOption.orient?this.table.tableY+this.table.tableNoFrameHeight:this.table.tableY,width:"top"===this._titleOption.orient||"bottom"===this._titleOption.orient?i:this._titleOption.width,height:"left"===this._titleOption.orient||"right"===this._titleOption.orient?r:this._titleOption.height,minWidth:this._titleOption.minWidth,maxWidth:this._titleOption.maxWidth,minHeight:this._titleOption.minHeight,maxHeight:this._titleOption.maxHeight,padding:this._titleOption.padding,align:this._titleOption.align??"left",verticalAlign:this._titleOption.verticalAlign??"top",textStyle:{width:i,...this._titleOption.textStyle},subtextStyle:{width:i,...this._titleOption.subtextStyle}}}}class tP{table;editingEditor;editCell;constructor(t){this.table=t,this.bindEvent()}bindEvent(){const t=this.table.internalProps.handler;this.table.on(ov.DBLCLICK_CELL,(t=>{if(!this.table.options.editCellTrigger||"doubleclick"===this.table.options.editCellTrigger){const{col:e,row:i}=t,r=vM(t.federatedEvent),n=this.table.scenegraph.getResizeColAt(r.abstractPos.x,r.abstractPos.y,r.eventArgs?.targetCell);if(this.table._canResizeColumn(n.col,n.row)&&n.col>=0)return;this.startEditCell(e,i)}})),this.table.on(ov.CLICK_CELL,(t=>{if("click"===this.table.options.editCellTrigger){const{col:e,row:i}=t;this.startEditCell(e,i)}})),t.on(this.table.getElement(),"wheel",(t=>{this.completeEdit()}))}startEditCell(t,e){if(this.table.isPivotTable()&&this.table.isHeader(t,e))return;const i=this.table.getEditor(t,e);if(i){if(this.table.getCustomRender(t,e)||this.table.getCustomLayout(t,e))return;if(!this.table.isHeader(t,e)){const i=this.table.getCellRange(t,e);if(i.start.col!==i.end.col||i.start.row!==i.end.row)return}i.bindSuccessCallback?.((()=>{this.completeEdit()})),this.editingEditor=i,this.editCell={col:t,row:e};const r=this.table.getCellOriginValue(t,e),n=this.table.getCellRangeRelativeRect(this.table.getCellRange(t,e));i.beginEditing(this.table.getElement(),{rect:{left:n.left,top:n.top,width:n.width,height:n.height}},r)}}completeEdit(t){const e=t?.target;if(this.editingEditor&&(!e||e&&!this.editingEditor.targetIsOnEditor(e))){const t=this.editingEditor.getValue();this.table.changeCellValue(this.editCell.col,this.editCell.row,t),this.editingEditor.exit(),this.editingEditor=null}}}class eP{sharedVar;sizeIncludeParent=!1;rowExpandLevel;hierarchyType;tree={id:0,dimensionKey:"",value:"",children:[],level:-1,levelSpan:1,startIndex:0,size:0,startInTotal:0,hierarchyState:void 0};totalLevel=0;dimensionKeys=new uv;cache=new Map;constructor(t,e,i="grid",r=void 0){this.sizeIncludeParent=null!=r,this.rowExpandLevel=r,this.hierarchyType=i,this.sharedVar=e,this.reset(t)}reset(t,e=!1){this.cache.clear(),this.dimensionKeys=new uv,this.tree.children=t,this.setTreeNode(this.tree,0,this.tree),this.totalLevel=this.dimensionKeys.count()}setTreeNode(t,e,i){t.startIndex=e,t.startInTotal=(i.startInTotal??0)+t.startIndex,(t.dimensionKey??t.indicatorKey)&&(!this.dimensionKeys.contain(t.indicatorKey?_v:t.dimensionKey)&&this.dimensionKeys.put(t.level,t.indicatorKey?_v:t.dimensionKey),t.id||(t.id=++this.sharedVar.seqId));let r=t.dimensionKey&&this.sizeIncludeParent?1:0;return"grid"===this.hierarchyType?t.children?.length>=1?t.children.forEach((e=>{e.level=(t.level??0)+1,r+=this.setTreeNode(e,r,t)})):r=1:t.hierarchyState===qy.expand&&t.children?.length>=1?t.children.forEach((e=>{e.level=(t.level??0)+1,r+=this.setTreeNode(e,r,t)})):t.hierarchyState===qy.collapse&&t.children?.length>=1?t.children.forEach((e=>{e.level=(t.level??0)+1,this.setTreeNode(e,r,t)})):!t.hierarchyState&&t.level+1<this.rowExpandLevel&&t.children?.length>=1?(t.hierarchyState=qy.expand,t.children.forEach((e=>{e.level=(t.level??0)+1,r+=this.setTreeNode(e,r,t)}))):t.children?.length>=1?(t.hierarchyState=qy.collapse,t.children.forEach((e=>{e.level=(t.level??0)+1,this.setTreeNode(e,r,t)}))):(t.hierarchyState=qy.none,r=1),t.size=r,r}getTreePath(t,e=30){const i=[];return this.searchPath(t,this.tree,i,e),i.shift(),i}getTreePathByCellIds(t){const e=[];let i=this.tree.children;for(let r=0;r<t.length;r++){const n=t[r],o=this.findNodeById(i,n);if(!o)break;e.push(o),i=o.children}return e}findNodeById(t,e){return t.find((t=>t.id===e))}searchPath(t,e,i,r){if(!e)return;if(t<e.startIndex||t>=e.startIndex+e.size)return;if(i.push(e),!e.children||0===e.children.length||e.level>=r)return;const n=t-e.startIndex;if(this.cache.has(e.level+1)){const t=this.cache.get(e.level+1);if(n>=t.startIndex&&n<t.startIndex+t.size)return void this.searchPath(n,t,i,r)}let o=0,s=e.children.length-1;for(;o<=s;){const t=Math.floor((o+s)/2),a=e.children[t];if(n>=a.startIndex&&n<a.startIndex+a.size){this.cache.set(a.level,a);const t=[];this.cache.forEach(((e,i)=>{i>a.level&&t.push(i)})),t.forEach((t=>{this.cache.delete(t)})),this.searchPath(n,a,i,r);break}n<a.startIndex?s=t-1:o=t+1}}movePosition(t,e,i){let r,n,o;const s=(a,l)=>{if((void 0===n||void 0===o)&&(a.level===t&&(a.startInTotal===e&&(n=l),a.startInTotal<=i&&i<=a.startInTotal+a.size-1&&(o=l)),a.children&&a.level<t)){r=a;for(let t=0;t<a.children.length;t++)(e>=a.children[t].startInTotal&&e<=a.children[t].startInTotal+a.children[t].size||i>=a.children[t].startInTotal&&i<=a.children[t].startInTotal+a.children[t].size)&&s(a.children[t],t)}};s(this.tree,0);const a=r.children.splice(n,1);a.unshift(o,0),Array.prototype.splice.apply(r.children,a)}}function iP(t,e){e?.forEach((e=>{const i={dimensionKey:e.dimensionKey,indicatorKey:e.indicatorKey,value:e.value,hierarchyState:e.hierarchyState,children:void 0};t.push(i),e.children&&(i.children=[],iP(i.children,e.children))}))}function rP(t,e){let i=0;return t?.forEach((t=>{e?i++:t.children&&0!==t.children.length||i++,t.children&&(i+=rP(t.children,e))})),i}function nP(t,e,i,r,n,o){const s=t.id,a=o.rowsDefine?.find((e=>"string"!=typeof e&&e.dimensionKey===t.dimensionKey))??o.columnsDefine?.find((e=>"string"!=typeof e&&e.dimensionKey===t.dimensionKey)),l=o.indicatorsDefine?.find((e=>"string"!=typeof e&&(t.indicatorKey?e.indicatorKey===t.indicatorKey:e.title===t.value))),h={id:s,title:t.value??l?.title,field:t.dimensionKey,style:"function"==typeof(l??a)?.headerStyle?(l??a)?.headerStyle:Object.assign({},(l??a)?.headerStyle),headerType:l?.headerType??a?.headerType??"text",headerIcon:l?.headerIcon??a?.headerIcon,define:Object.assign({},t,l??a),fieldFormat:l?.headerFormat??a?.headerFormat,dropDownMenu:l?.dropDownMenu??a?.dropDownMenu,pivotInfo:{value:t.value,dimensionKey:t.dimensionKey,isPivotCorner:!1},width:a?.width,minWidth:a?.minWidth,maxWidth:a?.maxWidth,showSort:l?.showSort??a?.showSort,description:a?.description};l?(l.customRender&&(t.customRender=l.customRender),Y(o._indicators?.find((t=>t.indicatorKey===l.indicatorKey)))||o._indicators?.push({id:++o.sharedVar.seqId,indicatorKey:l.indicatorKey,field:l.indicatorKey,fieldFormat:l?.format,cellType:l?.cellType??l?.columnType??"text",chartModule:"chartModule"in l?l.chartModule:null,chartSpec:"chartSpec"in l?l.chartSpec:null,sparklineSpec:"sparklineSpec"in l?l.sparklineSpec:null,style:l?.style,icon:l?.icon,define:Object.assign({},t,l,{dragHeader:a?.dragHeader}),width:l?.width,minWidth:l?.minWidth,maxWidth:l?.maxWidth,disableColumnResize:l?.disableColumnResize})):t.indicatorKey&&(Y(o._indicators?.find((e=>e.indicatorKey===t.indicatorKey)))||o._indicators?.push({id:++o.sharedVar.seqId,indicatorKey:t.indicatorKey,field:t.indicatorKey,cellType:"text",define:Object.assign({},t)})),i[s]=h,o._headerObjects[s]=h,e[n][o.colIndex]=s;for(let t=n-1;t>=0;t--)e[t][o.colIndex]=r[t];if(t.levelSpan>1)for(let i=1;i<t.levelSpan;i++)e[n+i]||(e[n+i]=[]),e[n+i][o.colIndex]=s;if(t.children?.length>=1)o._addHeaders(e,n+(t.levelSpan??1),t.children??[],[...r,...Array(t.levelSpan??1).fill(s)]).forEach((t=>i.push(t)));else{for(let t=n+1;t<e.length;t++)e[t][o.colIndex]=s;o.colIndex++}}function oP(t,e,i,r,n,o,s,a,l){const h=t.id,c=a.find((e=>"string"!=typeof e&&e.dimensionKey===t.dimensionKey)),d={id:h,title:t.value,field:t.dimensionKey,style:t.level+1===o||"function"==typeof c?.headerStyle?c?.headerStyle:Object.assign({},c?.headerStyle,{textAlign:"left"}),headerType:c?.headerType??"text",headerIcon:c?.headerIcon,define:Object.assign(t,{linkJump:c?.linkJump,linkDetect:c?.linkDetect,templateLink:c?.templateLink,keepAspectRatio:c?.keepAspectRatio??!1,imageAutoSizing:c?.imageAutoSizing,headerCustomRender:c?.headerCustomRender,headerCustomLayout:c?.headerCustomLayout,dragHeader:c?.dragHeader,disableHeaderHover:!!c?.disableHeaderHover,disableHeaderSelect:!!c?.disableHeaderSelect}),fieldFormat:c?.headerFormat,dropDownMenu:c?.dropDownMenu,pivotInfo:{value:t.value,dimensionKey:t.dimensionKey,isPivotCorner:!1},hierarchyLevel:t.level,dimensionTotalLevel:o,hierarchyState:t.level+1===o?void 0:t.hierarchyState,width:c?.width,minWidth:c?.minWidth,maxWidth:c?.maxWidth,parentCellId:r[r.length-1]};i[h]=d,l._headerObjects[h]=d,e[n][l.colIndex]=h;for(let t=n-1;t>=0;t--)e[t][l.colIndex]=r[t];if(t.hierarchyState===qy.expand&&t.children?.length>=1)s&&l.colIndex++,l._addHeadersForTreeMode(e,n,t.children??[],[...r,h],o,s&&t.hierarchyState===qy.expand,a).forEach((t=>i.push(t)));else{s&&l.colIndex++;for(let t=n+1;t<e.length;t++)e[t][l.colIndex]=h}}const sP={startInTotal:0,level:0};class aP{sharedVar;colIndex=0;_showHeader=!0;rowDimensionTree;columnDimensionTree;rowTree;columnTree;cornerHeaderObjs;columnHeaderObjs=[];rowHeaderObjs=[];_cornerHeaderCellIds=[];_columnHeaderCellIds=[];_rowHeaderCellIds=[];_rowHeaderCellIds_FULL=[];_columnWidths=[];_columnHeaderLevelCount;_rowHeaderLevelCount;rowsDefine;columnsDefine;indicatorsDefine;columnPaths=[];_headerObjects=[];_headerObjectMap={};_indicators=[];indicatorTitle;indicatorsAsCol=!0;hideIndicatorName=!1;_showRowHeader=!0;_showColumnHeader=!0;_rowHeaderTitle;_columnHeaderTitle;cornerSetting;_indicatorShowType="column";rowHierarchyType;rowExpandLevel;rowHierarchyIndent;rowDimensionKeys=[];colDimensionKeys=[];indicatorKeys=[];indicatorDimensionKey=_v;_largeCellRangeCache;_CellHeaderPathMap;_table;extensionRows;_rowHeaderExtensionTree={};_extensionRowDimensionKeys=[];fullRowDimensionKeys=[];dataset;pagination;currentPageStartIndex;currentPageEndIndex;hasTwoIndicatorAxes;_chartItemSpanSize;_chartPaddingInner;_chartPaddingOuter;_chartItemBandSize;_chartPadding;_lastCellCol;_lastCellRow;_lastCellHeaderPath;constructor(t,e){if(this.sharedVar={seqId:0},this._table=t,"tree"===t.options.rowHierarchyType&&(this.extensionRows=t.options.extensionRows),this.dataset=e,this._largeCellRangeCache=[],this._CellHeaderPathMap=new Map,this.rowTree=t.internalProps.rowTree,this.columnTree=t.internalProps.columnTree,this.rowsDefine=t.internalProps.rows??[],this.columnsDefine=t.internalProps.columns??[],this.indicatorsDefine=t.internalProps.indicators??[],this.indicatorTitle=t.options.indicatorTitle,this.indicatorsAsCol=t.options.indicatorsAsCol??!0,this.hideIndicatorName=t.options.hideIndicatorName??!1,this.showRowHeader=t.options.showRowHeader??!0,this.showColumnHeader=t.options.showColumnHeader??!0,this.rowHeaderTitle=t.options.rowHeaderTitle,this.columnHeaderTitle=t.options.columnHeaderTitle,this.rowHierarchyType=t.options.rowHierarchyType??"grid",this.rowExpandLevel=t.options.rowExpandLevel??1,this.rowHierarchyIndent=t.options.rowHierarchyIndent??20,this.cornerSetting=t.options.corner??{titleOnDimension:"column"},e&&(this.rowTree=e.rowHeaderTree,this.columnTree=e.colHeaderTree,this.indicatorsAsCol&&this._table.isPivotChart())){const t=e=>{e.forEach((e=>{e.children?.length?t(e.children):e.children=[{dimensionKey:"axis",value:""}]}))};this.rowTree?.length?t(this.rowTree):this.rowTree=[{dimensionKey:"axis",value:""}]}if(this.indicatorsDefine?.forEach((t=>{"string"==typeof t?this.indicatorKeys.push(t):this.indicatorKeys.push(t.indicatorKey)})),this.columnDimensionTree=new eP(this.columnTree??[],this.sharedVar),this.rowDimensionTree=new eP(this.rowTree??[],this.sharedVar,this.rowHierarchyType,"tree"===this.rowHierarchyType?this.rowExpandLevel:void 0),this.colDimensionKeys=this.columnDimensionTree.dimensionKeys.valueArr(),this.rowDimensionKeys=this.rowDimensionTree.dimensionKeys.valueArr(),this.fullRowDimensionKeys=this.fullRowDimensionKeys.concat(this.rowDimensionKeys),this.resetRowHeaderLevelCount(),this.columnDimensionTree.tree.children?.length>=1&&(this.columnHeaderObjs=this._addHeaders(this._columnHeaderCellIds,0,this.columnDimensionTree.tree.children,[])),this.columnHeaderTitle){this.sharedVar.seqId=Math.max(this.sharedVar.seqId,this._headerObjects.length);const t=++this.sharedVar.seqId,e=Array(this.colCount-this.rowHeaderLevelCount).fill(t);this._columnHeaderCellIds.unshift(e);const i={id:t,title:"string"==typeof this.columnHeaderTitle.title?this.columnHeaderTitle.title:this.columnsDefine.reduce(((t,e)=>"string"==typeof e?t:t+(t?`/${e.title}`:`${e.title}`)),""),field:void 0,headerType:this.columnHeaderTitle.headerType??"text",style:this.columnHeaderTitle.headerStyle,define:{id:t,disableHeaderHover:!!this.columnHeaderTitle.disableHeaderHover,disableHeaderSelect:!!this.columnHeaderTitle.disableHeaderSelect}};this.columnHeaderObjs.push(i),this._headerObjects[t]=i}if(this.colIndex=0,this.rowDimensionTree.tree.children?.length>=1&&(this.rowHeaderObjs="tree"===this.rowHierarchyType?this._addHeadersForTreeMode(this._rowHeaderCellIds_FULL,0,this.rowDimensionTree.tree.children,[],this.rowDimensionTree.totalLevel,!0,this.rowsDefine):this._addHeaders(this._rowHeaderCellIds_FULL,0,this.rowDimensionTree.tree.children,[])),this.rowHeaderTitle){this.sharedVar.seqId=Math.max(this.sharedVar.seqId,this._headerObjects.length);const t=++this.sharedVar.seqId,e=Array(this._rowHeaderCellIds_FULL[0]?.length??this.rowDimensionTree.tree.size).fill(t);this._rowHeaderCellIds_FULL.unshift(e);const i={id:t,title:"string"==typeof this.rowHeaderTitle.title?this.rowHeaderTitle.title:this.rowsDefine.reduce(((t,e)=>"string"==typeof e?t:t+(t?`/${e.title}`:`${e.title}`)),""),field:void 0,headerType:this.rowHeaderTitle.headerType??"text",style:this.rowHeaderTitle.headerStyle,define:{id:t,disableHeaderHover:!!this.columnHeaderTitle.disableHeaderHover,disableHeaderSelect:!!this.columnHeaderTitle.disableHeaderSelect}};this.rowHeaderObjs.push(i),this._headerObjects[t]=i}if(this._table.isPivotChart()&&(this.hasTwoIndicatorAxes=this._indicators.some((t=>!!(t.chartSpec&&t.chartSpec.series&&t.chartSpec.series.length>1)))),this.resetColumnHeaderLevelCount(),this._rowHeaderCellIds_FULL=MC(this._rowHeaderCellIds_FULL),"tree"===t.options.rowHierarchyType&&this.extensionRows?.length>=1&&(this.generateExtensionRowTree(),this.extensionRows.forEach((t=>{const e=[];t.rows.forEach((t=>{"string"==typeof t?e.push(t):e.push(t.dimensionKey)})),this._extensionRowDimensionKeys.push(e),this.fullRowDimensionKeys=this.fullRowDimensionKeys.concat(e)}))),this.sharedVar.seqId=Math.max(this.sharedVar.seqId,this._headerObjects.length),"column"===this.cornerSetting.titleOnDimension)this.cornerHeaderObjs=this._addCornerHeaders(this.columnHeaderTitle?[""].concat(this.colDimensionKeys):this.colDimensionKeys,this.columnsDefine);else if("row"===this.cornerSetting.titleOnDimension)if("tree"===this.rowHierarchyType&&this.extensionRows?.length>=1){const t=[];t.push(this.rowDimensionKeys[0]),this._extensionRowDimensionKeys.forEach((e=>{t.push(e[0])}));const e=this.extensionRows.reduce(((t,e)=>t.concat(e.rows)),[]);this.cornerHeaderObjs=this._addCornerHeaders(this.rowHeaderTitle?[""].concat(t):t,this.rowsDefine.concat(e))}else this.cornerHeaderObjs=this._addCornerHeaders(this.rowHeaderTitle?[""].concat(this.rowDimensionKeys):this.rowDimensionKeys,this.rowsDefine);else this.cornerHeaderObjs=this._addCornerHeaders(null,void 0);this.colIndex=0,this._headerObjectMap=this._headerObjects.reduce(((t,e)=>(t[e.id]=e,t)),{}),this.indicatorsAsCol&&!this.hideIndicatorName?this._indicatorShowType="column":this.indicatorsAsCol||this.hideIndicatorName?this._indicatorShowType="none":this._indicatorShowType="row",this.setPagination(t.options.pagination),this._table.isPivotChart()&&(this._chartItemSpanSize=0,this._chartItemBandSize=0,this._indicators.find((t=>{t?.style?.padding&&(this._chartPadding=t.style.padding),t.chartSpec?.barWidth&&(this._chartItemSpanSize=t.chartSpec?.barWidth);const e=t.chartSpec?.axes?.find((t=>"band"===t.type));return e?.bandSize&&(this._chartItemBandSize=e?.bandSize,this._chartPaddingInner=(it(e.paddingInner)?e.paddingInner[0]:e.paddingInner)??0,this._chartPaddingOuter=(it(e.paddingOuter)?e.paddingOuter[0]:e.paddingOuter)??0),this._chartItemSpanSize>0||(t.chartSpec.series?.find((t=>(t.barWidth&&(this._chartItemSpanSize=t.barWidth),this._chartItemSpanSize>0))),!1)}))),this.setColumnWidths()}_addHeaders(t,e,i,r){const n=this;const o=[];t[e]||function(e){const i=t[e]=[];if(0===n.colIndex)return i;const r=t[e-1];for(let t=0;t<r?.length;t++)i[t]=r[t]}(e);for(let n=0;n<i.length;n++){nP(i[n],t,o,r,e,this)}return o}_addHeadersForTreeMode(t,e,i,r,n,o,s){const a=this;const l=[];t[e]||function(e){const i=t[e]=[];if(0===a.colIndex)return i;const r=t[e-1];for(let t=0;t<r?.length;t++)i[t]=r[t]}(e);for(let a=0;a<i.length;a++){oP(i[a],t,l,r,e,n,o,s,this)}return l}_addCornerHeaders(t,e){const i=[];if(t)t.forEach(((t,r)=>{const n=++this.sharedVar.seqId,o=e.find((e=>"string"!=typeof e&&e.dimensionKey===t)),s={id:n,title:t===this.indicatorDimensionKey?this.indicatorTitle:o?o.title:"axis"===t?"":t,field:"维度名称",style:this.cornerSetting.headerStyle,headerType:this.cornerSetting.headerType??"text",define:{dimensionKey:"维度名称",id:n,value:t,disableHeaderHover:!!this.cornerSetting.disableHeaderHover,disableHeaderSelect:!!this.cornerSetting.disableHeaderSelect},dropDownMenu:o?.cornerDropDownMenu,pivotInfo:{value:o?.title??"",dimensionKey:t,isPivotCorner:!0},description:o?.cornerDescription};if(i[n]=s,this._headerObjects[n]=s,"column"===this.cornerSetting.titleOnDimension){this._cornerHeaderCellIds[r]||(this._cornerHeaderCellIds[r]=[]);for(let t=0;t<this.rowHeaderLevelCount;t++)this._cornerHeaderCellIds[r][t]=n}else if("row"===this.cornerSetting.titleOnDimension)for(let t=0;t<this.columnHeaderLevelCount;t++)this._cornerHeaderCellIds[t]||(this._cornerHeaderCellIds[t]=[]),this._cornerHeaderCellIds[t][r]=n}));else{const t=++this.sharedVar.seqId,e={id:t,title:"",field:"维度名称",style:this.cornerSetting.headerStyle,headerType:this.cornerSetting.headerType??"text",define:{dimensionKey:"维度名称",id:t,value:"",disableHeaderHover:!!this.cornerSetting.disableHeaderHover,disableHeaderSelect:!!this.cornerSetting.disableHeaderSelect}};i[t]=e,this._headerObjects[t]=e;for(let e=0;e<this.columnHeaderLevelCount;e++)for(let i=0;i<this.rowHeaderLevelCount;i++)this._cornerHeaderCellIds[e]||(this._cornerHeaderCellIds[e]=[]),this._cornerHeaderCellIds[e][i]=t}return i}generateExtensionRowTree(){this.extensionRows.forEach(((t,e)=>{const i=this._rowHeaderCellIds_FULL;this._rowHeaderCellIds_FULL=[],i.forEach(((e,i)=>{const r=e[e.length-1];let n,o;if(this.colIndex=0,"function"==typeof t.rowTree){const i=this.findFullCellIds(e);n=t.rowTree(i.map((t=>({dimensionKey:this._headerObjects[t].field,value:this._headerObjects[t].title}))))}else n=bt(t.rowTree);this._rowHeaderExtensionTree[r]?(this._rowHeaderExtensionTree[r].reset(this._rowHeaderExtensionTree[r].tree.children,!0),o=this._rowHeaderExtensionTree[r]):(o=new eP(n??[],this.sharedVar,this.rowHierarchyType,void 0),this._rowHeaderExtensionTree[r]=o);const s=[];this._addHeadersForTreeMode(s,0,o.tree.children,[],o.totalLevel,!0,t.rows);for(let t=0;t<s[0].length;t++)this._rowHeaderCellIds_FULL.push(e.concat(s[0][t]))}))}))}setColumnWidths(){const t=new Array(this.colCount).fill(void 0);if(this.showHeader&&this.showRowHeader)if(this.rowHeaderTitle&&(t[0]={}),"tree"===this.rowHierarchyType){const e=this.rowDimensionKeys[0];if(e){const i=this.rowsDefine?.find((t=>"string"!=typeof t&&t.dimensionKey===e));i&&(t[0+(this.rowHeaderTitle?1:0)]={width:i.width,minWidth:i.minWidth,maxWidth:i.maxWidth})}this._extensionRowDimensionKeys?.forEach(((e,i)=>{const r=e[0];if(r){const e=this.extensionRows[i].rows?.find((t=>"string"!=typeof t&&t.dimensionKey===r));e&&(t[i+1+(this.rowHeaderTitle?1:0)]={width:e.width,minWidth:e.minWidth,maxWidth:e.maxWidth})}}))}else this.rowDimensionKeys.forEach(((e,i)=>{const r=this.rowsDefine?.find((t=>"string"!=typeof t&&t.dimensionKey===e));r&&(t[i+(this.rowHeaderTitle?1:0)]={width:r.width,minWidth:r.minWidth,maxWidth:r.maxWidth})}));if(this.indicatorsAsCol)for(let e=this.rowHeaderLevelCount;e<this.colCount;e++){const i=this.getBody(e,this.columnHeaderLevelCount);t[e]={width:i?.width,minWidth:i?.minWidth,maxWidth:i?.maxWidth}}else{let e,i,r,n=0;this._indicators?.forEach(((t,o)=>{"number"==typeof t.width?n=Math.max(t.width,n):"auto"===t.width&&(r=!0),"number"==typeof t.minWidth&&(i=Math.max(t.minWidth,i)),"number"==typeof t.maxWidth&&(e=Math.max(t.maxWidth,e))})),n=n>0?n:r?"auto":void 0,t.fill({width:n,minWidth:i,maxWidth:e},this.rowHeaderLevelCount,this.colCount-this.rightFrozenColCount)}this._columnWidths=t}get columnWidths(){return this._columnWidths}getColumnWidthDefined(t){return this._columnWidths[t]}get showHeader(){return this._showHeader}set showHeader(t){this._showHeader=t}get showColumnHeader(){return this._showColumnHeader}set showColumnHeader(t){this._showColumnHeader=t}get showRowHeader(){return this._showRowHeader}set showRowHeader(t){this._showRowHeader=t}get columnHeaderTitle(){return this._columnHeaderTitle}set columnHeaderTitle(t){this._columnHeaderTitle=t}get rowHeaderTitle(){return this._rowHeaderTitle}set rowHeaderTitle(t){this._rowHeaderTitle=t}getHeaderFieldKey(t,e){}getCellLocation(t,e){return this.isCornerHeader(t,e)?"cornerHeader":this.isColumnHeader(t,e)?"columnHeader":this.isRowHeader(t,e)?"rowHeader":"body"}isHeader(t,e){return t>=0&&t<this.rowHeaderLevelCount||(e>=0&&e<this.columnHeaderLevelCount||(t>=this.colCount-this.rightHeaderColCount||e>=this.rowCount-this.bottomHeaderRowCount))}isCornerHeader(t,e){return t>=0&&t<this.rowHeaderLevelCount&&e>=0&&e<this.columnHeaderLevelCount}isColumnHeader(t,e){return t>=this.rowHeaderLevelCount&&e>=0&&e<this.columnHeaderLevelCount}isRowHeader(t,e){return t>=0&&t<this.rowHeaderLevelCount&&e>=this.columnHeaderLevelCount}isFrozenColumn(t,e){if(Y(e)){if(t>=0&&t<this.frozenColCount&&e>=this.frozenRowCount&&e<this.rowCount-this.bottomFrozenRowCount)return!0}else if(this.frozenColCount>0&&t>=0&&t<this.frozenColCount)return!0;return!1}isRightFrozenColumn(t,e){if(Y(e)){if(t>=this.colCount-this.rightFrozenColCount&&e>=this.frozenRowCount&&e<this.rowCount-this.bottomFrozenRowCount)return!0}else if(this.rightFrozenColCount>0&&t>=this.colCount-this.rightFrozenColCount)return!0;return!1}isFrozenRow(t,e){if(Y(e)){if(e>=0&&e<this.frozenRowCount&&t>=this.frozenColCount&&t<this.colCount-this.rightFrozenColCount)return!0}else if(e=t,this.frozenRowCount>0&&e>=0&&e<this.frozenRowCount)return!0;return!1}isBottomFrozenRow(t,e){if(Y(e)){if(e>=this.rowCount-this.bottomFrozenRowCount&&t>=this.frozenColCount&&t<this.colCount-this.rightFrozenColCount)return!0}else if(e=t,this.frozenRowCount>0&&e>=this.rowCount-this.bottomFrozenRowCount)return!0;return!1}isLeftBottomCorner(t,e){return t>=0&&t<this.rowHeaderLevelCount&&e>=this.rowCount-this.bottomFrozenRowCount}isRightTopCorner(t,e){return t>=this.colCount-this.rightFrozenColCount&&e>=0&&e<this.columnHeaderLevelCount}isRightBottomCorner(t,e){return t>=this.colCount-this.rightFrozenColCount&&e>=this.rowCount-this.bottomFrozenRowCount}getColumnHeaderRange(){return{start:{col:this.rowHeaderLevelCount,row:0},end:{col:this.colCount-1,row:this.columnHeaderLevelCount-1}}}getRowHeaderRange(){return{start:{col:0,row:this.columnHeaderLevelCount},end:{col:this.rowHeaderLevelCount-1,row:this.rowCount-1}}}getCornerHeaderRange(){return{start:{col:0,row:0},end:{col:this.rowHeaderLevelCount-1,row:this.columnHeaderLevelCount-1}}}getBodyRange(){return{start:{col:this.rowHeaderLevelCount,row:this.columnHeaderLevelCount},end:{col:this.colCount-1,row:this.rowCount-1}}}resetCellIds(){}get frozenColCount(){return this._table.internalProps.frozenColCount?this.colCount>this._table.internalProps.frozenColCount?this._table.internalProps.frozenColCount:this.colCount:0}get frozenRowCount(){return this._table.internalProps.frozenRowCount?this.rowCount>=this._table.internalProps.frozenRowCount?this._table.internalProps.frozenRowCount:this.rowCount:0}get headerLevelCount(){return this.columnHeaderLevelCount}resetColumnHeaderLevelCount(){if(this.showHeader&&this.showColumnHeader){if(this._table.isPivotChart()&&this.indicatorsAsCol&&!this.dataset?.colKeys?.length&&!this.hasTwoIndicatorAxes)return void(this.columnHeaderLevelCount=0);let t=this.indicatorsAsCol&&this.hideIndicatorName&&this.colDimensionKeys[this.colDimensionKeys.length-1]===this.indicatorDimensionKey?this.columnDimensionTree.totalLevel-1:this.columnDimensionTree.totalLevel;return this.columnHeaderTitle&&(t+=1),this._table.isPivotChart()&&this.indicatorsAsCol&&!this.hasTwoIndicatorAxes&&(t-=1),void(this.columnHeaderLevelCount=t)}this.columnHeaderLevelCount=0}resetRowHeaderLevelCount(){if(this.showHeader&&this.showRowHeader){if("tree"===this.rowHierarchyType){const t=this.extensionRows?.length??0;return this.rowHeaderTitle?void(this.rowHeaderLevelCount=2+t):void(this.rowHeaderLevelCount=1+t)}const t=this.rowDimensionKeys.length;let e=t;return this.indicatorsAsCol||this.hideIndicatorName&&this.rowDimensionKeys[this.rowDimensionKeys.length-1]===this.indicatorDimensionKey&&(e=t-1),this.rowHeaderTitle&&(e+=1),void(this.rowHeaderLevelCount=e)}this.rowHeaderLevelCount=this.indicatorsAsCol||this.hideIndicatorName?0:1}get columnHeaderLevelCount(){return this._columnHeaderLevelCount}set columnHeaderLevelCount(t){this._columnHeaderLevelCount=t}get rowHeaderLevelCount(){return this._rowHeaderLevelCount}set rowHeaderLevelCount(t){this._rowHeaderLevelCount=t}get colCount(){return this.columnDimensionTree.tree.size+this.rowHeaderLevelCount+this.rightHeaderColCount}get rowCount(){return((!Array.isArray(this._table.records)||this._table.records.length>0)&&this._indicators?.length>0&&!this._rowHeaderCellIds?.length?1:this._rowHeaderCellIds?.length??0)+this.columnHeaderLevelCount+this.bottomHeaderRowCount}get bodyRowSpanCount(){return this.rowDimensionTree.tree.size}get bottomFrozenRowCount(){if(!this._table.isPivotChart())return this._table.internalProps.bottomFrozenRowCount?this.rowCount-this.headerLevelCount>=this._table.internalProps.bottomFrozenRowCount?this._table.internalProps.bottomFrozenRowCount:this.rowCount-this.headerLevelCount:0;if(this.indicatorKeys.length>=1){const t=this._table.pivotChartAxes.find((t=>"bottom"===t.orient));return!1===t?.visible?0:(this.indicatorsAsCol,1)}return 0}get rightFrozenColCount(){if(!this._table.isPivotChart())return this._table.internalProps.rightFrozenColCount?this.colCount-this.rowHeaderLevelCount>=this._table.internalProps.rightFrozenColCount?this._table.internalProps.rightFrozenColCount:this.colCount-this.rowHeaderLevelCount:0;const t=this._table.pivotChartAxes.find((t=>"right"===t.orient));return!1===t?.visible||this.indicatorsAsCol?0:this.hasTwoIndicatorAxes?1:0}get bodyRowCount(){return this.rowCount-this.bottomFrozenRowCount-this.headerLevelCount}get bodyColCount(){return this.colCount-this.rightFrozenColCount-this.rowHeaderLevelCount}get headerObjects(){return this._headerObjects}get columnObjects(){return this._indicators}getCellId(t,e){if(e>=0&&t>=0){if(this.isCornerHeader(t,e))return this._cornerHeaderCellIds[e][t];if(this.isColumnHeader(t,e))return this._columnHeaderCellIds[e][t-this.rowHeaderLevelCount];if(this.isRowHeader(t,e))return this._rowHeaderCellIds[e-this.columnHeaderLevelCount]?.[t];if(this.isRightFrozenColumn(t,e))return this._rowHeaderCellIds[e-this.columnHeaderLevelCount][this.rowHeaderLevelCount-1];if(this.isBottomFrozenRow(t,e))return this._columnHeaderCellIds[this.columnHeaderLevelCount-1]?.[t-this.rowHeaderLevelCount]}}getHeader(t,e){const i=this.getCellId(t,e);return this._headerObjectMap[i]??{id:void 0,field:"",headerType:"text",define:void 0}}getHeaderField(t,e){const i=this.getCellId(t,e);return this._headerObjectMap[i]?.field||this.getBody(t,e)?.field}getHeaderCellAdressById(t){for(let e=0;e<this._columnHeaderCellIds.length;e++){const i=this._columnHeaderCellIds[e];for(let r=0;r<i.length;r++)if(i[r]===t)return{col:r+this._table.frozenColCount,row:e}}for(let e=0;e<this._rowHeaderCellIds.length;e++){const i=this._rowHeaderCellIds[e];for(let r=0;r<i.length;r++)if(i[r]===t)return{col:r,row:e+this._table.frozenRowCount}}for(let e=0;e<this._cornerHeaderCellIds.length;e++){const i=this._cornerHeaderCellIds[e];for(let r=0;r<i.length;r++)if(i[r]===t)return{col:r,row:e}}}getHeaderCellAddressByField(t){const e=this.headerObjects.find((e=>e&&e.field===t));return this.getHeaderCellAdressById(e.id)}getBody(t,e){const i=this.getCellHeaderPaths(t,e);if(this.indicatorsAsCol){const t=i.colHeaderPaths?.find((t=>t.indicatorKey))?.indicatorKey;return this._indicators?.find((e=>e.indicatorKey===t))??this._indicators[0]??{id:"",field:void 0,indicatorKey:void 0,cellType:"text",define:void 0}}const r=i.rowHeaderPaths?.find((t=>t.indicatorKey))?.indicatorKey;return this._indicators?.find((t=>t.indicatorKey===r))??this._indicators[0]??{id:"",field:void 0,indicatorKey:void 0,cellType:"text",define:void 0}}getCellRange(t,e){const i={start:{col:t,row:e},end:{col:t,row:e}};if(!this.isHeader(t,e)||-1===t||-1===e)return i;if(this.isRightFrozenColumn(t,e)||this.isBottomFrozenRow(t,e))return i;for(let i=0;i<this._largeCellRangeCache.length;i++){const r=this._largeCellRangeCache[i];if(t>=r.start.col&&t<=r.end.col&&e>=r.start.row&&e<=r.end.row)return r}if(this.isHeader(t,e)&&-1!==t&&-1!==e){const r=this.getCellId(t,e);for(let n=t-1;n>=0&&r===this.getCellId(n,e);n--)i.start.col=n;for(let n=t+1;n<(this.colCount??0)&&r===this.getCellId(n,e);n++)i.end.col=n;for(let n=e-1;n>=0&&r===this.getCellId(t,n);n--)i.start.row=n;for(let n=e+1;n<(this.rowCount??0)&&r===this.getCellId(t,n);n++)i.end.row=n}return(i.end.col-i.start.col>100||i.end.row-i.start.row>100)&&this._largeCellRangeCache.push(i),i}isCellRangeEqual(t,e,i,r){const n=this.getCellRange(t,e),o=this.getCellRange(i,r);return n.start.col===o.start.col&&n.end.col===o.end.col&&n.start.row===o.start.row&&n.end.row===o.end.row}getBodyIndexByRow(t){return t<this.columnHeaderLevelCount||t>=this.rowCount-this.bottomHeaderRowCount?-1:t-this.columnHeaderLevelCount}get bottomHeaderRowCount(){return this._table.isPivotChart()?this.bottomFrozenRowCount:0}get rightHeaderColCount(){return this._table.isPivotChart()?this.rightFrozenColCount:0}getBodyIndexByCol(t){return t<this.rowHeaderLevelCount||t>=this.colCount-this.rightHeaderColCount?-1:t-this.rowHeaderLevelCount}getRecordStartRowByRecordIndex(t){return this.columnHeaderLevelCount+t}getRecordIndexByCell(t,e){}getCellHeaderPathsWidthTreeNode(t,e){if(t===this._lastCellCol&&e===this._lastCellRow)return this._lastCellHeaderPath;for(let i=0;i<this._largeCellRangeCache.length;i++){const r=this._largeCellRangeCache[i];if(t>=r.start.col&&t<=r.end.col&&e>=r.start.row&&e<=r.end.row)break}const i=this.getBodyIndexByCol(t),r=this.getBodyIndexByRow(e)+this.currentPageStartIndex;let n=[],o=[];if(e>=0&&i>=0&&(n=this.columnDimensionTree.getTreePath(i,this.showHeader&&this.showColumnHeader?e-(this.columnHeaderTitle?1:0):this.columnDimensionTree.totalLevel)),t>=0&&r>=0)if("tree"===this.rowHierarchyType){const t=this._rowHeaderCellIds[r];let e=this.rowDimensionTree,i=0;for(;e;){const r=[];let n=t[i];for(r.push(n);;){const t=this._headerObjectMap[n];if(!t?.parentCellId)break;r.unshift(t.parentCellId),n=t.parentCellId}const s=e.getTreePathByCellIds(r);o=o.concat(s),e=this._rowHeaderExtensionTree[t[i]],i++}}else o=this.rowDimensionTree.getTreePath(r,this.showHeader&&this.showRowHeader?t-(this.rowHeaderTitle?1:0):this.rowDimensionTree.totalLevel);const s={colHeaderPaths:n,rowHeaderPaths:o,cellLocation:this.getCellLocation(t,e)};return this._lastCellHeaderPath=s,this._lastCellCol=t,this._lastCellRow=e,s}getCellHeaderPaths(t,e){const i=this.getCellHeaderPathsWidthTreeNode(t,e),r={colHeaderPaths:[],rowHeaderPaths:[],cellLocation:i.cellLocation};return i.colHeaderPaths?.forEach((t=>{const e={};e.dimensionKey=t.dimensionKey,e.indicatorKey=t.indicatorKey,e.value=t.value??this.getIndicatorInfoByIndicatorKey(t.indicatorKey)?.title??"",r.colHeaderPaths.push(e)})),i.rowHeaderPaths?.forEach((t=>{if("axis"!==t.dimensionKey){const e={};e.dimensionKey=t.dimensionKey,e.indicatorKey=t.indicatorKey,e.value=t.value??this.getIndicatorInfoByIndicatorKey(t.indicatorKey)?.title??"",r.rowHeaderPaths.push(e)}})),r}getIndicatorInfoByIndicatorKey(t){const e=this.indicatorsDefine?.find((e=>"string"!=typeof e&&(!!t&&e.indicatorKey===t)));return e}findFullCellIds(t){const e=[];for(let i=0;i<t.length;i++){let r=t[i];for(e.push(r);;){const t=this._headerObjectMap[r];if(!t?.parentCellId)break;e.unshift(t.parentCellId),r=t.parentCellId}}return e}getHeaderDimension(t,e){if(this.isHeader(t,e)){const i=this.getHeader(t,e);return this.rowsDefine?.find((t=>"string"!=typeof t&&t.dimensionKey===i.field))??this.columnsDefine?.find((t=>"string"!=typeof t&&t.dimensionKey===i.field))}}isColumnIndicatorHeader(t,e){return"column"===this._indicatorShowType&&e===this.columnHeaderLevelCount-1&&t>=this.rowHeaderLevelCount}isRowIndicatorHeader(t,e){return"row"===this._indicatorShowType&&t===this.rowHeaderLevelCount-1&&e>=this.columnHeaderLevelCount}isIndicatorHeader(t,e){return this.isColumnIndicatorHeader(t,e)||this.isRowIndicatorHeader(t,e)}toggleHierarchyState(t,e){const i=this._rowHeaderCellIds_FULL.slice(0),r=i.map(((e,i)=>({col:t,row:i+this.columnHeaderLevelCount}))),n=this.getHeader(t,e);if(n.define.hierarchyState=n.define.hierarchyState===qy.collapse?qy.expand:qy.collapse,this.rowDimensionTree.reset(this.rowDimensionTree.tree.children,!0),this._rowHeaderCellIds_FULL=[],this.rowHeaderObjs=this._addHeadersForTreeMode(this._rowHeaderCellIds_FULL,0,this.rowDimensionTree.tree.children,[],this.rowDimensionTree.totalLevel,!0,this.rowsDefine),this.rowHeaderTitle){const t=++this.sharedVar.seqId,e=Array(this.rowCount-this.columnHeaderLevelCount).fill(t);this._rowHeaderCellIds_FULL.unshift(e);const i={id:t,title:"string"==typeof this.rowHeaderTitle.title?this.rowHeaderTitle.title:this.rowsDefine.reduce(((t,e)=>"string"==typeof e?t:t+(t?`/${e.title}`:`${e.title}`)),""),field:void 0,headerType:this.rowHeaderTitle.headerType??"text",style:this.rowHeaderTitle.headerStyle,define:{field:"",headerType:"text",cellType:"text",disableHeaderHover:!!this.columnHeaderTitle.disableHeaderHover,disableHeaderSelect:!!this.columnHeaderTitle.disableHeaderSelect}};this.rowHeaderObjs.push(i),this._headerObjects[t]=i}this._rowHeaderCellIds_FULL=MC(this._rowHeaderCellIds_FULL),"tree"===this.rowHierarchyType&&this.extensionRows?.length>=1&&this.generateExtensionRowTree(),this.colIndex=0,this._headerObjectMap=this._headerObjects.reduce(((t,e)=>(t[e.id]=e,t)),{}),this._CellHeaderPathMap=new Map,this._largeCellRangeCache.length=0;const o=function(t,e,i,r,n,o){const s=o.columnHeaderLevelCount,a=[],l=[];for(let t=0;t<i.length;t++)r.includes(i[t])||l.push(n[t]);for(let e=0;e<r.length;e++)if(!i.includes(r[e])){const i={col:t,row:s+e};a.push(i)}let h=o.getParentCellId(t,e),c=o.getRowHeaderCellAddressByCellId(h);const d=[];for(c&&d.push(c);h;)h=o.getParentCellId(c.col,c.row),h&&(c=o.getRowHeaderCellAddressByCellId(h),d.push(c));return{addCellPositions:a,removeCellPositions:l,updateCellPositions:d}}(t,e,i.map((e=>e[t])),this._rowHeaderCellIds_FULL.map((e=>e[t])),r,this);return this._rowHeaderCellIds=this._rowHeaderCellIds_FULL,o}isHeaderForColWidth(t,e){return this.isHeader(t,e)}getHeaderForColWidth(t,e){return this.getHeader(t,e)}getPivotCellAdress(t){if(!Array.isArray(t))return;let e,i,r=this.rowTree,n=this.columnTree;for(let o=0;o<t.length;o++){const s=t[o];if((s.isPivotCorner||!s.value)&&o===t.length-1){if("row"===this?.cornerSetting?.titleOnDimension){let t=0;return"grid"===this.rowHierarchyType&&(t=this.rowDimensionKeys.indexOf(s.dimensionKey)),-1===t?void 0:{col:this.rowHeaderTitle?t+1:t,row:0}}const t=this.colDimensionKeys.indexOf(s.dimensionKey);return-1===t?void 0:{col:0,row:this.columnHeaderTitle?t+1:t}}let a=!1;for(let t=0;t<n.length;t++){const e=n[t];if((Y(s.dimensionKey)&&e.dimensionKey===s.dimensionKey||Y(s.indicatorKey)&&e.indicatorKey===s.indicatorKey)&&e.value===s.value){n=e.children,i=e,a=!0;break}}if(!a)for(let t=0;t<r.length;t++){const i=r[t];if((Y(s.dimensionKey)&&i.dimensionKey===s.dimensionKey||Y(s.indicatorKey)&&i.indicatorKey===s.indicatorKey)&&i.value===s.value){r=i.children,e=i;break}}}let o=0,s=0;if(e){s=this.columnHeaderLevelCount;const{startInTotal:t,level:i}=e;return s+=t,o="grid"===this.rowHierarchyType?this.rowHeaderTitle?i+1:i:0,{col:o,row:s}}if(i){o=this.rowHeaderLevelCount;const{startInTotal:t,level:e}=i;return o+=t,s=this.columnHeaderTitle?e+1:e,{col:o,row:s}}}getPivotDimensionInfo(t,e){const{colHeaderPaths:i,rowHeaderPaths:r}=this.getCellHeaderPaths(t,e),n=[];return i.length?i.forEach(((t,e)=>{n.push({dimensionKey:t.dimensionKey,value:t.value,isPivotCorner:!1,indicatorKey:t.indicatorKey})})):r.length?r.forEach(((t,e)=>{n.push({dimensionKey:t.dimensionKey,value:t.value,isPivotCorner:!1,indicatorKey:t.indicatorKey})})):this.isCornerHeader(t,e)&&("row"===this?.cornerSetting?.titleOnDimension?n.push({dimensionKey:this.rowDimensionKeys[this.rowHeaderTitle?t-1:t],isPivotCorner:!0}):n.push({dimensionKey:this.colDimensionKeys[this.columnHeaderTitle?e-1:e],isPivotCorner:!0})),n}getIndicatorKey(t,e){return this.getBody(t,e)?.indicatorKey}getParentCellId(t,e){if(0!==e)return this.isColumnHeader(t,e)?this.getCellId(t,e-1):this.isRowHeader(t,e)?this.getCellId(t-1,e):void 0}getRowHeaderCellAddressByCellId(t){let e,i;if(this._rowHeaderCellIds.find(((r,n)=>!!r.find(((i,r)=>i===t&&(e=r,!0)))&&(i=n,!0))),Y(e)&&Y(i))return{col:e,row:i+this.columnHeaderLevelCount}}canMoveHeaderPosition(t,e){if(t.col<0||t.row<0||e.col<0||e.row<0)return!1;const i=this.getCellRange(t.col,t.row);if(this.isColumnHeader(t.col,t.row)){return this.getParentCellId(t.col,i.start.row)===this.getParentCellId(e.col,i.start.row)}if(this.isRowHeader(t.col,t.row)){if("tree"!==this.rowHierarchyType){return this.getParentCellId(i.start.col,t.row)===this.getParentCellId(i.start.col,e.row)}{const i=bt(this.getCellHeaderPathsWidthTreeNode(t.col,t.row).rowHeaderPaths),r=bt(this.getCellHeaderPathsWidthTreeNode(e.col,e.row).rowHeaderPaths);if(i.pop(),r.pop(),i.length<=r.length)return i.length!==r.length||!i.find(((t,e)=>t.dimensionKey!==r[e].dimensionKey||t.value!==r[e].value))}}return!1}moveHeaderPosition(t,e){if(this.canMoveHeaderPosition(t,e)&&!this.isCellRangeEqual(t.col,t.row,e.col,e.row)){const i=this.getCellRange(t.col,t.row);if(this.isColumnHeader(t.col,t.row)){const r=i.end.col-i.start.col+1;let n;const o=this.getCellRange(e.col,i.start.row);if(n=e.col>=t.col?o.end.col-r+1:o.start.col,n===i.end.col-this.rowHeaderLevelCount)return null;for(let t=0;t<this._columnHeaderCellIds.length;t++){const e=this._columnHeaderCellIds[t].splice(i.start.col-this.rowHeaderLevelCount,r);e.unshift(n-this.rowHeaderLevelCount,0),Array.prototype.splice.apply(this._columnHeaderCellIds[t],e)}const s=this._columnWidths.splice(i.start.col,r);return s.unshift(n,0),Array.prototype.splice.apply(this._columnWidths,s),this.columnDimensionTree.movePosition(t.row,i.start.col-this.rowHeaderLevelCount,n-this.rowHeaderLevelCount),this.columnDimensionTree.reset(this.columnDimensionTree.tree.children,!0),this._CellHeaderPathMap=new Map,this._largeCellRangeCache.length=0,{sourceIndex:i.start.col,targetIndex:n,moveSize:r,moveType:"column"}}if(this.isRowHeader(t.col,t.row)){let r;const n=this.getCellHeaderPathsWidthTreeNode(t.col,t.row).rowHeaderPaths,o=this.getCellHeaderPathsWidthTreeNode(e.col,e.row).rowHeaderPaths,s=n[n.length-1],a=o[n.length-1],l=s.size;if(r=e.row>=t.row?a.startInTotal+a.size-l:a.startInTotal,r===t.row-this.columnHeaderLevelCount||r===i.end.row-this.columnHeaderLevelCount)return null;const h=this._rowHeaderCellIds.splice(i.start.row-this.columnHeaderLevelCount,l);h.unshift(r-this.currentPageStartIndex,0),Array.prototype.splice.apply(this._rowHeaderCellIds,h);const c=this._rowHeaderCellIds_FULL.splice(i.start.row+this.currentPageStartIndex,l);return c.unshift(r,0),Array.prototype.splice.apply(this._rowHeaderCellIds_FULL,c),this.rowDimensionTree.movePosition(this.getCellHeaderPathsWidthTreeNode(t.col,t.row).rowHeaderPaths.length-1,i.start.row-this.columnHeaderLevelCount,r+(e.row>t.row?s.size-1:0)),this.rowDimensionTree.reset(this.rowDimensionTree.tree.children,!0),this._CellHeaderPathMap=new Map,this._largeCellRangeCache.length=0,{sourceIndex:i.start.row,targetIndex:r+this.columnHeaderLevelCount,moveSize:l,moveType:"row"}}}return null}getCellAdressByHeaderPath(t){let e,i,r=!1;if(Array.isArray(t)){if(t.length>this.rowDimensionKeys.length+this.colDimensionKeys.length)return;e=t.filter((t=>this.colDimensionKeys.indexOf(t.dimensionKey)>=0)),i=t.filter((t=>this.rowDimensionKeys.indexOf(t.dimensionKey)>=0))}else e=t.colHeaderPaths,i=t.rowHeaderPaths,"body"===t?.cellLocation&&this._table.isPivotTable()&&(r=!0);if(!Array.isArray(e)&&!Array.isArray(i))return;e?.sort(((t,e)=>this.colDimensionKeys.indexOf(t.dimensionKey??this.indicatorDimensionKey)-this.colDimensionKeys.indexOf(e.dimensionKey??this.indicatorDimensionKey))),i?.sort(((t,e)=>this.fullRowDimensionKeys.indexOf(t.dimensionKey??this.indicatorDimensionKey)-this.fullRowDimensionKeys.indexOf(e.dimensionKey??this.indicatorDimensionKey)));let n,o,s,a,l=!1;e?.length>=1&&i?.length>=1&&(l=!0);let h,c,d=this.rowTree,u=this.columnTree;if(e)for(let t=0;t<e.length;t++){const i=e[t];for(let t=0;t<u.length;t++){const e=u[t];if(!Y(i.indicatorKey)&&e.dimensionKey===i.dimensionKey&&e.value===i.value||Y(i.indicatorKey)&&e.indicatorKey===i.indicatorKey){u=e.children,l&&!u?c=e:l||(c=e);break}}}if(i?.length>=1)if("tree"===this.rowHierarchyType){const t=i[i.length-1],e=this.headerObjects.filter((e=>(e?.field===t.dimensionKey||e?.field===t.indicatorKey)&&e?.title===t.value)).map((t=>t.id)),r=this._rowHeaderCellIds.filter((t=>e.indexOf(t[t.length-1])>=0)).find((t=>{const e=this.findFullCellIds(t);return e.length===i.length&&e.every((t=>{const e=this._headerObjectMap[t];return i.find((t=>t.dimensionKey===e.field&&t.value===e.title))}))}));o=this._rowHeaderCellIds.indexOf(r)+this.columnHeaderLevelCount}else for(let t=0;t<i.length;t++){const e=i[t];for(let t=0;t<d.length;t++){const i=d[t];if(!Y(e.indicatorKey)&&i.dimensionKey===e.dimensionKey&&i.value===e.value||Y(e.indicatorKey)&&i.indicatorKey===e.indicatorKey&&(!e.value||i.value===e.value)){d=i.children,l&&!d?h=i:l||(h=i);break}}}if(r||!l||(h||Y(o))&&c){if(h||r){o=this.columnHeaderLevelCount;const{startInTotal:t,level:e}=h??sP;o+=t??0,s="grid"===this.rowHierarchyType?this.rowHeaderTitle?e+1:e:0}if(c||r){n=this.rowHeaderLevelCount;const{startInTotal:t,level:e}=c??sP;n+=t??0,a=this.columnHeaderTitle?e+1:e}return Y(n)||Y(o)?{col:n??s,row:o??a}:void 0}}setChartInstance(t,e,i){const r=this.getCellHeaderPaths(t,e);let n;if(this.indicatorsAsCol){const t=r.colHeaderPaths.find((t=>t.indicatorKey))?.indicatorKey;n=this._indicators?.find((e=>e.indicatorKey===t))}else{const t=r.rowHeaderPaths.find((t=>t.indicatorKey))?.indicatorKey;n=this._indicators?.find((e=>e.indicatorKey===t))}n&&(n.chartInstance=i)}getChartInstance(t,e){const i=this.getCellHeaderPaths(t,e);let r;if(this.indicatorsAsCol){const t=i.colHeaderPaths.find((t=>t.indicatorKey))?.indicatorKey;r=this._indicators?.find((e=>e.indicatorKey===t))}else{const t=i.rowHeaderPaths.find((t=>t.indicatorKey))?.indicatorKey;r=this._indicators?.find((e=>e.indicatorKey===t))}return r?.chartInstance}getDimension(t,e){return"column"===e?this.columnsDefine?.find((e=>"string"!=typeof e&&e.dimensionKey===t)):"row"===e?this.rowsDefine?.find((e=>"string"!=typeof e&&e.dimensionKey===t)):void 0}getAxisConfigInPivotChart(t,e){return DA(t,e,this)}isEmpty(t,e){return!!this._table.isPivotChart()&&(!!this.isLeftBottomCorner(t,e)||(!!this.isRightBottomCorner(t,e)||!!this.isRightTopCorner(t,e)))}isAxisCell(t,e){if(!this._table.isPivotChart())return!1;if(this.indicatorKeys.length>=1){if(this.isBottomFrozenRow(t,e)||this.isRightFrozenColumn(t,e))return!0;if(this.isRowHeader(t,e)&&t===this.rowHeaderLevelCount-1)return!0;if(this.hasTwoIndicatorAxes&&this.indicatorsAsCol&&e===this.columnHeaderLevelCount-1)return!0}return!1}getChartAxes(t,e){return function(t,e,i){const r=[];if(i.indicatorsAsCol){const n=i.getIndicatorKeyInChartSpec(t,e),o=i.getColKeysPath(t,e);n.forEach(((s,a)=>{const{range:l,isZeroAlign:h,axisOption:c}=ZR(t,e,a,0===a?"bottom":"top",n,o,i);if(h){const r=ZR(t,e,n.length-1-a,0===a?"top":"bottom",n,o,i);if(r){const{range:t}=r,e=OA(l,t);e&&(l.min=e.range1[0],l.max=e.range1[1])}}ot(c?.min)&&(l.min=c.min),ot(c?.max)&&(l.max=c.max),r.push(wt({range:l},c,{type:c?.type||"linear",orient:0===a?"bottom":"top",label:{visible:!1},title:{visible:!1},domainLine:{visible:!1},seriesIndex:a,sync:{axisId:YR}}))}));let s=i.getDimensionKeyInChartSpec(i.rowHeaderLevelCount,e)?.[0];it(s)&&(s=s[0]);const a=(i.dataset.cacheCollectedValues[s]||i.dataset.collectedValues[s]||[])[i.getRowKeysPath(t,e)??""],{axisOption:l,isPercent:h}=WA(t,e,"left",i);r.push(wt({domain:Array.from(a??[])},l,{type:"band",orient:"left",label:{visible:!1},domainLine:{visible:!1},tick:{visible:!1},subTick:{visible:!1},title:{visible:!1}}))}else{const n=i.getIndicatorKeyInChartSpec(t,e),o=i.getRowKeysPath(t,e);n.forEach(((s,a)=>{const{range:l,isZeroAlign:h,axisOption:c}=ZR(t,e,a,0===a?"left":"right",n,o,i);if(h){const r=ZR(t,e,n.length-1-a,0===a?"right":"left",n,o,i);if(r){const{range:t}=r,e=OA(l,t);e&&(l.min=e.range1[0],l.max=e.range1[1])}}ot(c?.min)&&(l.min=c.min),ot(c?.max)&&(l.max=c.max),r.push(wt({range:l},c,{type:c?.type||"linear",orient:0===a?"left":"right",label:{visible:!1},title:{visible:!1},domainLine:{visible:!1},seriesIndex:a,sync:{axisId:YR}}))}));let s=i.getDimensionKeyInChartSpec(t,i.columnHeaderLevelCount)[0];it(s)&&(s=s[0]);const a=i.dataset.cacheCollectedValues[s]||i.dataset.collectedValues[s]||[],l=i.getColKeysPath(t,e),h=a?.[l??""]??[],{axisOption:c,isPercent:d}=WA(t,e,"bottom",i);r.push(wt({domain:Array.from(h)},c,{type:"band",orient:"bottom",visible:!0,label:{visible:!1},domainLine:{visible:!1},tick:{visible:!1},subTick:{visible:!1},title:{visible:!1}}))}return r}(t,e,this)}getRawChartSpec(t,e){return function(t,e,i){const r=i.getCellHeaderPaths(t,e);let n;if(i.indicatorsAsCol){const t=r.colHeaderPaths.find((t=>t.indicatorKey))?.indicatorKey;n=i.columnObjects.find((e=>e.indicatorKey===t))}else{const t=r.rowHeaderPaths.find((t=>t.indicatorKey))?.indicatorKey;n=i.columnObjects.find((e=>e.indicatorKey===t))}const o=n?.chartSpec;return o}(t,e,this)}getChartDataId(t,e){return qR(t,e,this)}setPagination(t){if(this.clearCellRangeMap(),this.pagination=t,"grid"===this.rowHierarchyType&&Y(this.pagination?.perPageCount)&&Y(this.pagination?.currentPage)){!1===this.indicatorsAsCol&&(this.pagination.perPageCount=Math.ceil(this.pagination.perPageCount/this.indicatorKeys.length)*this.indicatorKeys.length);const{perPageCount:t,currentPage:e}=this.pagination;this.currentPageStartIndex=t*(e||0),this.currentPageEndIndex=this.currentPageStartIndex+t,this._rowHeaderCellIds=this._rowHeaderCellIds_FULL?.slice(this.currentPageStartIndex,this.currentPageEndIndex)}else this.currentPageStartIndex=0,this.currentPageEndIndex=this._rowHeaderCellIds_FULL.length,this._rowHeaderCellIds=this._rowHeaderCellIds_FULL?.slice(this.currentPageStartIndex,this.currentPageEndIndex);this.pagination&&(this.pagination.totalCount=this._rowHeaderCellIds_FULL?.length)}release(){const t=this._table._getActiveChartInstance();t?.release(),this._indicators?.forEach((t=>{t.chartInstance?.release()}))}getHeadNode(t){if(!Array.isArray(t))return;let e,i,r=this.rowTree,n=this.columnTree;for(let o=0;o<t.length;o++){const s=t[o];if((s.isPivotCorner||!s.value)&&o===t.length-1)return;let a=!1;for(let t=0;t<n.length;t++){const e=n[t];if((Y(s.dimensionKey)&&e.dimensionKey===s.dimensionKey||Y(s.indicatorKey)&&e.indicatorKey===s.indicatorKey)&&e.value===s.value){n=e.children,i=e,a=!0;break}}if(!a)for(let t=0;t<r.length;t++){const i=r[t];if((Y(s.dimensionKey)&&i.dimensionKey===s.dimensionKey||Y(s.indicatorKey)&&i.indicatorKey===s.indicatorKey)&&i.value===s.value){r=i.children,e=i;break}}}return e||(i||void 0)}clearCellRangeMap(){this._largeCellRangeCache.length=0,this._CellHeaderPathMap=new Map}getDimensionKeyInChartSpec(t,e){const i=this.getRawChartSpec(t,e),r=[];return i?(!1===this.indicatorsAsCol?r.push(i.xField??i?.series[0]?.xField):r.push(i.yField??i?.series[0]?.yField),r):null}getChartSpec(t,e){return function(t,e,i){let r=i.getRawChartSpec(t,e);return r?(r=bt(r),r.sortDataByAxis=!0,it(r.series)&&r.series.forEach((t=>{t.sortDataByAxis=!0})),r.axes=i.getChartAxes(t,e),r.padding=0,r.dataZoom=[],r):null}(t,e,this)}_generateChartState(){return{vtable_selected:{filter:t=>{if(this._table._selectedDataItemsInChart.length>=1){return!!this._table._selectedDataItemsInChart.find((e=>{for(const i in e)if(e[i]!==t[i])return!1;return!0}))}if(this._table._selectedDimensionInChart?.length){return!!this._table._selectedDimensionInChart.every((e=>t[e.key]===e.value))}return!1}},vtable_selected_reverse:{filter:t=>{if(this._table._selectedDataItemsInChart.length>=1){return!this._table._selectedDataItemsInChart.find((e=>{for(const i in e)if(e[i]!==t[i])return!1;return!0}))}if(this._table._selectedDimensionInChart?.length){return!this._table._selectedDimensionInChart.every((e=>t[e.key]===e.value))}return!1}}}}updateDataStateToChartInstance(t){t||(t=this._table._getActiveChartInstance());const e=this._generateChartState();this._indicators.forEach((t=>{t.chartInstance.updateState(e)})),t?.updateState(e)}updateDataStateToActiveChartInstance(t){t||(t=this._table._getActiveChartInstance());const e=this._generateChartState();t?.updateState(e)}getIndicatorKeyInChartSpec(t,e){const i=this.getRawChartSpec(t,e),r=[];return i?(!1===this.indicatorsAsCol?i.series?i.series.forEach((t=>{const e=t.yField;r.push(e)})):r.push(i.yField):i.series?i.series.forEach((t=>{const e=t.xField;r.push(e)})):r.push(i.xField),r):null}getOptimunHeightForChart(t){const e=this.getCellHeaderPaths(this.rowHeaderLevelCount,t).rowHeaderPaths;let i,r;for(const t in this.dataset.collectValuesBy)if("yField"===this.dataset.collectValuesBy[t].type&&!this.dataset.collectValuesBy[t].range){i=this.dataset.collectedValues[t]?.[e.map((t=>t.value)).join(this.dataset.stringJoinChar)];break}if(this._chartItemBandSize)r=lP(i?.length??0,this._chartItemBandSize,this._chartPaddingInner,this._chartPaddingOuter);else{const t=this._chartItemSpanSize||25;r=(i?.length??0)*(t+t/3)}const n=eS(this._chartPadding??this._table.theme.bodyStyle.padding??0);return r+n[0]+n[2]}getOptimunWidthForChart(t){const e=this.getCellHeaderPaths(t,this.columnHeaderLevelCount).colHeaderPaths;let i,r;for(const t in this.dataset.collectValuesBy)if("xField"===this.dataset.collectValuesBy[t].type&&!this.dataset.collectValuesBy[t].range){i=this.dataset.collectedValues[t]?.[e.map((t=>t.value)).join(this.dataset.stringJoinChar)];break}if(this._chartItemBandSize)r=lP(i?.length??0,this._chartItemBandSize,this._chartPaddingInner,this._chartPaddingOuter);else{const t=this._chartItemSpanSize||25;r=(i?.length??0)*(t+t/3)}const n=eS(this._chartPadding??this._table.theme.bodyStyle.padding??0);return r+n[1]+n[3]}get leftAxesCount(){if(!this._table.isPivotChart())return 0;const t=this._table.pivotChartAxes.find((t=>"left"===t.orient));return!1===t?.visible?0:(this.indicatorsAsCol,1)}get topAxesCount(){if(!this._table.isPivotChart())return 0;const t=this._table.pivotChartAxes.find((t=>"top"===t.orient));return!1===t?.visible?0:this.indicatorsAsCol&&this.hasTwoIndicatorAxes?1:0}get rightAxesCount(){return this.rightFrozenColCount}get bottomAxesCount(){return this.bottomFrozenRowCount}getColKeysPath(t,e){const i=this.getCellHeaderPaths(t,e),r=[];return i.colHeaderPaths.length&&i.colHeaderPaths.forEach((t=>{t.dimensionKey&&r.push(t.value)})),r?.join(this.dataset.stringJoinChar)}getRowKeysPath(t,e){const i=this.getCellHeaderPaths(t,e),r=[];return i.rowHeaderPaths.length&&i.rowHeaderPaths.forEach((t=>{t.dimensionKey&&r.push(t.value)})),r?.join(this.dataset.stringJoinChar)}getIndicatorInfo(t,e=""){const i=this.indicatorsDefine?.find((i=>"string"!=typeof i&&(t?i.indicatorKey===t:!!e&&i.title===e)));return i}getLayoutRowTree(){const t=[];return iP(t,this.rowDimensionTree.tree.children),t}getLayoutRowTreeCount(){let t=rP(this.rowDimensionTree.tree.children,"tree"===this.rowHierarchyType);return this.extensionRows?.forEach((e=>{if("function"!=typeof e.rowTree){const i=rP(e.rowTree,!0);t*=i}})),t}updateDataset(t){}}function lP(t,e,i,r){1===i&&(i=0);const n=function(t,e,i){let r;r=1===t?t+2*i:t-e+2*i;return t?r>0?r:1:0}(t,i,r),o=e/(1-i);return Math.ceil(n*o)}class hP{dataConfig;records;tree={};changedTree={};colFlatKeys={};rowFlatKeys={};stringJoinChar=String.fromCharCode(0);rowsIsTotal=[];colsIsTotal=[];colGrandTotalLabel;colSubTotalLabel;rowGrandTotalLabel;rowSubTotalLabel;constructor(t,e){this.dataConfig=t,e&&(this.records=e,"undefined"!=typeof window&&window.performance.now(),this.setRecords(e),"undefined"!=typeof window&&window.performance.now()),delete this.rowFlatKeys,delete this.colFlatKeys}setRecords(t){this.processRecords()}processRecords(){for(let t=0,e=this.records.length;t<e;t++){const e=this.records[t];this.processRecord(e)}}processRecord(t){const e=[],i=[];for(let e=0,r=this.dataConfig.rows.length;e<r;e++){const r=this.dataConfig.rows[e];void 0!==t[r]&&r!==this.dataConfig.indicatorDimensionKey&&i.push(t[r])}for(let i=0,r=this.dataConfig.columns.length;i<r;i++){const r=this.dataConfig.columns[i];void 0!==t[r]&&r!==this.dataConfig.indicatorDimensionKey&&e.push(t[r])}this.dataConfig.indicators?.forEach((r=>{const n=t[r];void 0!==n&&(this.dataConfig.indicatorsAsCol?e.push(r):i.push(r));const o=i.join(this.stringJoinChar),s=e.join(this.stringJoinChar);0!==i.length&&(this.rowFlatKeys[o]||(this.rowFlatKeys[o]=1)),0!==e.length&&(this.colFlatKeys[s]||(this.colFlatKeys[s]=1)),0===e.length&&0===i.length||(this.tree[o]||(this.tree[o]={}),void 0!==n&&(this.tree[o][s]={value:n,record:t},this.dataConfig.indicatorsAsCol?e.pop():i.pop()))}))}getTreeNode(t=[],e=[],i,r=!0){let n,o;if("string"==typeof t)n=t;else{let e=!1;t.map(((r,n)=>{r===i&&(t.splice(n,1),e=!0)})),e&&t.push(i),n=t.join(this.stringJoinChar)}if("string"==typeof e)o=e;else{let t=!1;e.map(((r,n)=>{r===i&&(e.splice(n,1),t=!0)})),t&&e.push(i),o=e.join(this.stringJoinChar)}return r&&Y(this.changedTree[n]?.[o])?{value:this.changedTree[n][o],record:this.tree?.[n]?.[o]?.record}:this.tree?.[n]?.[o]??void 0}changeTreeNodeValue(t=[],e=[],i,r){let n,o;if("string"==typeof t)n=t;else{let e=!1;t.map(((r,n)=>{r===i&&(t.splice(n,1),e=!0)})),e&&t.push(i),n=t.join(this.stringJoinChar)}if("string"==typeof e)o=e;else{let t=!1;e.map(((r,n)=>{r===i&&(e.splice(n,1),t=!0)})),t&&e.push(i),o=e.join(this.stringJoinChar)}this.changedTree[n]||(this.changedTree[n]={}),this.changedTree[n][o]=r}}class cP{className="Aggregator";isRecord=!0;records=[];type;field;formatFun;_formatedValue;needSplitPositiveAndNegativeForSum=!1;constructor(t,e,i,r){this.field=t,this.needSplitPositiveAndNegativeForSum=r??!1,this.formatFun=e,this.isRecord=i??this.isRecord}clearCacheValue(){this._formatedValue=void 0}formatValue(t,e,i){return this._formatedValue||(this.formatFun?this._formatedValue=this.formatFun(this.value(),t,e,i):this._formatedValue=this.value()),this._formatedValue}reset(){this.records=[]}}class dP extends cP{type=Zy.RECORD;isRecord=!0;push(t){this.isRecord&&("Aggregator"===t.className?this.records.push(...t.records):this.records.push(t))}value(){return this.records}reset(){this.records=[]}}class uP extends cP{type=Zy.NONE;isRecord=!0;fieldValue;push(t){this.isRecord&&(this.records=[t]),this.fieldValue=t[this.field]}value(){return this.fieldValue}reset(){this.records=[],this.fieldValue=void 0}}class gP extends cP{type=Zy.SUM;sum=0;positiveSum=0;nagetiveSum=0;push(t){if(this.isRecord&&("Aggregator"===t.className?this.records.push(...t.records):this.records.push(t)),"Aggregator"===t.className){const e=t.value();this.sum+=e,this.needSplitPositiveAndNegativeForSum&&(e>0?this.positiveSum+=e:e<0&&(this.nagetiveSum+=e))}else if(!isNaN(parseFloat(t[this.field]))){const e=parseFloat(t[this.field]);this.sum+=e,this.needSplitPositiveAndNegativeForSum&&(e>0?this.positiveSum+=e:e<0&&(this.nagetiveSum+=e))}}value(){return this.sum}positiveValue(){return this.positiveSum}negativeValue(){return this.nagetiveSum}reset(){this.records=[],this.sum=0}}class pP extends cP{type=Zy.COUNT;count=0;push(t){this.isRecord&&("Aggregator"===t.className?this.records.push(...t.records):this.records.push(t)),"Aggregator"===t.className?this.count+=t.value():this.count++}value(){return this.count}reset(){this.records=[],this.count=0}}class fP extends cP{type=Zy.AVG;sum=0;count=0;push(t){this.isRecord&&("Aggregator"===t.className?this.records.push(...t.records):this.records.push(t)),"Aggregator"===t.className&&t.type===Zy.AVG?(this.sum+=t.sum,this.count+=t.count):isNaN(parseFloat(t[this.field]))||(this.sum+=parseFloat(t[this.field]),this.count++)}value(){return this.sum/this.count}reset(){this.records=[],this.sum=0,this.count=0}}class mP extends cP{type=Zy.MAX;max=Number.MIN_SAFE_INTEGER;push(t){this.isRecord&&("Aggregator"===t.className?this.records.push(...t.records):this.records.push(t)),"Aggregator"===t.className?this.max=t.max>this.max?t.max:this.max:"number"==typeof t?this.max=t>this.max?t:this.max:"number"==typeof t[this.field]?this.max=t[this.field]>this.max?t[this.field]:this.max:isNaN(t[this.field])||(this.max=parseFloat(t[this.field])>this.max?parseFloat(t[this.field]):this.max)}value(){return this.max}reset(){this.records=[],this.max=Number.MIN_SAFE_INTEGER}}class bP extends cP{type=Zy.MIN;min=Number.MAX_SAFE_INTEGER;isRecord=!1;push(t){this.isRecord&&("Aggregator"===t.className?this.records.push(...t.records):this.records.push(t)),"Aggregator"===t.className?this.min=t.min<this.min?t.min:this.min:"number"==typeof t?this.min=t<this.min?t:this.min:"number"==typeof t[this.field]&&(this.min=t[this.field]<this.min?t[this.field]:this.min)}value(){return this.min}reset(){this.records=[],this.min=Number.MAX_SAFE_INTEGER}}function yP(t,e){return t&&e?t.toString().localeCompare(e.toString(),"zh"):t?1:-1}function CP(t,e){const i=/(\d+)|(\D+)/g,r=/\d/,n=/^0/;let o,s,a,l,h=0,c=0;if(null!==e&&null===t)return-1;if(null!==t&&null===e)return 1;if("number"==typeof t&&isNaN(t))return-1;if("number"==typeof e&&isNaN(e))return 1;if(h=+t,c=+e,h<c)return-1;if(h>c)return 1;if("number"==typeof t&&"number"!=typeof e)return-1;if("number"==typeof e&&"number"!=typeof t)return 1;if("number"==typeof t&&"number"==typeof e)return 0;if(isNaN(c)&&!isNaN(h))return-1;if(isNaN(h)&&!isNaN(c))return 1;if(o=String(t),a=String(e),o===a)return 0;if(!r.test(o)||!r.test(a))return o>a?1:-1;for(o=o.match(i),a=a.match(i);o.length&&a.length;)if(s=o.shift(),l=a.shift(),s!==l)return r.test(s)&&r.test(l)?s.replace(n,".0")-l.replace(n,".0"):s>l?1:-1;return o.length-a.length}class vP{dataConfig;records;tree={};changedTree={};colFlatKeys={};rowFlatKeys={};colKeys=[];rowKeys=[];rowOrder="key_a_to_z";colOrder="key_a_to_z";sorted=!1;sortRules;filterRules;aggregationRules;derivedFieldRules;mappingRules;totals;indicatorStatistics=[];aggregators={};stringJoinChar=String.fromCharCode(0);rowsIsTotal=[];colsIsTotal=[];colGrandTotalLabel;colSubTotalLabel;rowGrandTotalLabel;rowSubTotalLabel;needSplitPositiveAndNegative;collectValuesBy;collectedValues={};cacheCollectedValues={};rows;columns;indicatorKeys;customRowTree;customColTree;colHeaderTree;rowHeaderTree;rowHierarchyType;indicators;indicatorsAsCol;totalRecordsTree={};constructor(t,e,i,r,n,o,s,a,l,h,c){if(this.registerAggregators(),this.dataConfig=t,this.rowHierarchyType=a??"grid",this.sortRules=this.dataConfig?.sortRules,this.aggregationRules=this.dataConfig?.aggregationRules,this.derivedFieldRules=this.dataConfig?.derivedFieldRules,this.mappingRules=this.dataConfig?.mappingRules,this.totals=this.dataConfig?.totals,this.rows=e,this.columns=i,this.indicatorKeys=r,this.indicatorsAsCol=o,this.indicators=n,this.customColTree=l,this.customRowTree=h,this.colGrandTotalLabel=this.totals?.column?.grandTotalLabel??"总计",this.colSubTotalLabel=this.totals?.column?.subTotalLabel??"小计",this.rowGrandTotalLabel=this.totals?.row?.grandTotalLabel??"总计",this.rowSubTotalLabel=this.totals?.row?.subTotalLabel??"小计",this.collectValuesBy=this.dataConfig?.collectValuesBy,this.needSplitPositiveAndNegative=c??!1,this.rowsIsTotal=new Array(this.rows?.length??0).fill(!1),this.colsIsTotal=new Array(this.columns?.length??0).fill(!1),this.totals?.row?.showSubTotals)for(let t=0,e=this.totals?.row?.subTotalsDimensions?.length;t<e;t++){const e=this.totals.row.subTotalsDimensions[t],i=this.rows.indexOf(e);this.rowsIsTotal[i]=!0}if(this.totals?.column?.showSubTotals)for(let t=0,e=this.totals?.column?.subTotalsDimensions?.length;t<e;t++){const e=this.totals.column.subTotalsDimensions[t],i=this.columns.indexOf(e);this.colsIsTotal[i]=!0}this.setRecords(s)}setRecords(t){this.records=t,this.collectedValues={},this.cacheCollectedValues={},this.totalRecordsTree={},this.tree={},this.colFlatKeys={},this.rowFlatKeys={},this.colKeys=[],this.rowKeys=[],t&&(this.records=t,"undefined"!=typeof window&&window.performance.now(),this.processRecords(),this.processCollectedValuesWithSumBy(),this.generateCollectedValuesSortRule(),this.processCollectedValuesWithSortBy(),"undefined"!=typeof window&&window.performance.now(),"undefined"!=typeof window&&window.performance.now(),this.totalStatistics(),"undefined"!=typeof window&&window.performance.now(),"undefined"!=typeof window&&window.performance.now(),this.sortKeys(),"undefined"!=typeof window&&window.performance.now(),"undefined"!=typeof window&&window.performance.now(),this.customRowTree?(this.indicatorsAsCol||(this.customRowTree=this._adjustCustomTree(this.customRowTree)),this.rowHeaderTree=this.customRowTree):"tree"===this.rowHierarchyType?this.rowHeaderTree=this.ArrToTree1(this.rowKeys,this.rows,this.indicatorsAsCol?void 0:this.indicators,this.totals?.row?.showGrandTotals||!this.indicatorsAsCol&&0===this.columns.length||this.indicatorsAsCol&&0===this.rows.length,this.rowGrandTotalLabel):this.rowHeaderTree=this.ArrToTree(this.rowKeys,this.rows,this.indicatorsAsCol?void 0:this.indicators,this.rowsIsTotal,this.totals?.row?.showGrandTotals||this.indicatorsAsCol&&0===this.rows.length,this.rowGrandTotalLabel,this.rowSubTotalLabel,this.totals?.row?.showGrandTotalsOnTop??!1,this.totals?.row?.showSubTotalsOnTop??!1),this.customColTree?(this.indicatorsAsCol&&(this.customColTree=this._adjustCustomTree(this.customColTree)),this.colHeaderTree=this.customColTree):this.colHeaderTree=this.ArrToTree(this.colKeys,this.columns,this.indicatorsAsCol?this.indicators:void 0,this.colsIsTotal,this.totals?.column?.showGrandTotals||!this.indicatorsAsCol&&0===this.columns.length,this.colGrandTotalLabel,this.colSubTotalLabel,this.totals?.column?.showGrandTotalsOnLeft??!1,this.totals?.column?.showSubTotalsOnLeft??!1),"undefined"!=typeof window&&window.performance.now(),this.dataConfig?.isPivotChart&&this.cacheDeminsionCollectedValues())}registerAggregator(t,e){this.aggregators[t]=e}registerAggregators(){this.registerAggregator(Zy.RECORD,dP),this.registerAggregator(Zy.SUM,gP),this.registerAggregator(Zy.COUNT,pP),this.registerAggregator(Zy.MAX,mP),this.registerAggregator(Zy.MIN,bP),this.registerAggregator(Zy.AVG,fP),this.registerAggregator(Zy.NONE,uP)}processCollectedValuesWithSumBy(){for(const t in this.collectedValues)if(this.collectValuesBy[t]?.sumBy)for(const e in this.collectedValues[t]){const i=Object.values(this.collectedValues[t][e]).reduce(((t,e)=>e.value()>t?e.value():t),Number.MIN_SAFE_INTEGER),r=Object.values(this.collectedValues[t][e]).reduce(((t,e)=>e.value()<t?e.value():t),Number.MAX_SAFE_INTEGER);let n,o;this.needSplitPositiveAndNegative&&(n=Object.values(this.collectedValues[t][e]).reduce(((t,e)=>e.positiveValue()>t?e.positiveValue():t),Number.MIN_SAFE_INTEGER),o=Object.values(this.collectedValues[t][e]).reduce(((t,e)=>e.negativeValue()<t?e.negativeValue():t),Number.MAX_SAFE_INTEGER)),this.collectedValues[t][e]={},this.collectedValues[t][e].max=i,this.collectedValues[t][e].min=r,this.needSplitPositiveAndNegative&&(this.collectedValues[t][e].positiveMax=n,this.collectedValues[t][e].negativeMin=o)}}processCollectedValuesWithSortBy(){for(const t in this.collectedValues)if(this.collectValuesBy[t]?.sortBy)for(const e in this.collectedValues[t])this.collectedValues[t][e]=this.collectedValues[t][e].sort(((e,i)=>this.collectValuesBy[t]?.sortBy.indexOf(e)-this.collectValuesBy[t]?.sortBy.indexOf(i)))}generateCollectedValuesSortRule(){for(const t in this.collectedValues)if(this.collectValuesBy[t]&&!this.collectValuesBy[t].sortBy){let e=[];for(const i in this.collectedValues[t])Array.isArray(this.collectedValues[t][i])&&(e.push(...this.collectedValues[t][i]),e=Array.from(new Set(e)));e.length>0&&(this.collectValuesBy[t].sortBy=e)}}processRecords(){let t=!1;if(this.dataConfig?.filterRules?.length>=1&&(t=!0),Array.isArray(this.records))for(let e=0,i=this.records.length;e<i;e++){const i=this.records[e];t&&!this.filterRecord(i)||this.processRecord(i)}else for(const e in this.records)for(let i=0,r=this.records[e].length;i<r;i++){const r=this.records[e][i];t&&!this.filterRecord(r)||this.processRecord(r,e)}this.rowFlatKeys={},this.colFlatKeys={}}filterRecord(t){let e=!0;for(let i=0;i<this.dataConfig.filterRules.length;i++){const r=this.dataConfig?.filterRules[i];if(r.filterKey){const i=t[r.filterKey];if(-1===r.filteredValues.indexOf(i)){e=!1;break}}else if(!r.filterFunc?.(t)){e=!1;break}}return e}processRecord(t,e){this.derivedFieldRules?.forEach(((e,i)=>{t[e.fieldName]=e.derivedFunc(t)}));for(const e in this.collectValuesBy)if(t[e]){this.collectedValues[e]||(this.collectedValues[e]={});const i=this.collectValuesBy[e].by.map((e=>t[e])).join(this.stringJoinChar);if(this.collectedValues[e][i]||(this.collectValuesBy[e].sumBy?this.collectedValues[e][i]={}:this.collectValuesBy[e].range?this.collectedValues[e][i]={min:Number.MAX_SAFE_INTEGER,max:Number.MIN_SAFE_INTEGER}:this.collectedValues[e][i]=[]),this.collectValuesBy[e].sumBy){const r=this.collectValuesBy[e].sumBy.map((e=>t[e])).join(this.stringJoinChar);this.collectedValues[e][i][r]||(this.collectedValues[e][i][r]=new this.aggregators[Zy.SUM](e,void 0,void 0,this.needSplitPositiveAndNegative)),this.collectedValues[e][i][r].push(t)}else if(this.collectValuesBy[e].range){const r=this.collectedValues[e][i];r.max=Math.max(t[e],r.max),r.min=Math.min(t[e],r.min)}else{const r=this.collectedValues[e][i];-1===r.indexOf(t[e])&&r.push(t[e])}}const i=[],r=[];let n=!1;for(let e=0,i=this.rows.length;e<i;e++){const i=this.rows[e];if(i in t)r.push(t[i]);else{if(this.dataConfig?.totals?.row?.showGrandTotals&&0===e&&!this.rows.find((e=>e in t))){r.push(this.rowGrandTotalLabel),n=!0;break}if(this.dataConfig?.totals?.row?.showSubTotals&&this.dataConfig?.totals?.row?.subTotalsDimensions.indexOf(this.rows[e-1])>=0){"grid"===this.rowHierarchyType&&r.push(this.rowSubTotalLabel),n=!0;break}}}for(let e=0,r=this.columns.length;e<r;e++){const r=this.columns[e];if(r in t)i.push(t[r]);else{if(this.dataConfig?.totals?.column?.showGrandTotals&&0===e&&!this.columns.find((e=>e in t))){i.push(this.colGrandTotalLabel),n=!0;break}if(this.dataConfig?.totals?.column?.showSubTotals&&this.dataConfig?.totals?.column?.subTotalsDimensions.indexOf(this.columns[e-1])>=0){i.push(this.colSubTotalLabel),n=!0;break}}}const o=r.join(this.stringJoinChar),s=i.join(this.stringJoinChar);if(n){this.totalRecordsTree[o]||(this.totalRecordsTree[o]={}),this.totalRecordsTree[o][s]||(this.totalRecordsTree[o][s]=[]);for(let e=0;e<this.indicatorKeys.length;e++){const i=this.getAggregatorRule(this.indicatorKeys[e]);this.totalRecordsTree[o]?.[s]?.[e]||(this.totalRecordsTree[o][s][e]=new this.aggregators[i?.aggregationType??Zy.SUM](i?.field??this.indicatorKeys[e],i?.formatFun??this.indicators?.find((t=>"string"!=typeof t&&t.indicatorKey===this.indicatorKeys[e]))?.format)),this.indicatorKeys[e]in t&&this.totalRecordsTree[o]?.[s]?.[e].push(t)}}else{0!==r.length&&(this.rowFlatKeys[o]||(this.rowKeys.push(r),this.rowFlatKeys[o]=1)),0!==i.length&&(this.colFlatKeys[s]||(this.colKeys.push(i),this.colFlatKeys[s]=1)),this.tree[o]||(this.tree[o]={}),this.tree[o]?.[s]||(this.tree[o][s]=[]);for(let i=0;i<this.indicatorKeys.length;i++){const r=this.getAggregatorRule(this.indicatorKeys[i]);if(this.tree[o]?.[s]?.[i]||(this.tree[o][s][i]=new this.aggregators[r?.aggregationType??Zy.SUM](r?.field??this.indicatorKeys[i],r?.formatFun??this.indicators?.find((t=>"string"!=typeof t&&t.indicatorKey===this.indicatorKeys[i]))?.format)),e)this.indicatorKeys[i]===e&&this.tree[o]?.[s]?.[i].push(t);else if(r?.field)if("string"==typeof r?.field)r?.field in t&&this.tree[o]?.[s]?.[i].push(t);else{const e=r?.field.find((e=>e in t));e&&this.tree[o]?.[s]?.[i].push(t)}else this.indicatorKeys[i]in t&&this.tree[o]?.[s]?.[i].push(t)}if(this.mappingRules)for(let e=0;e<this.indicatorKeys.length;e++){if(!this.indicatorStatistics[e]){const t=this.getAggregatorRule(this.indicatorKeys[e]);this.indicatorStatistics[e]={max:new this.aggregators[Zy.MAX](this.indicatorKeys[e]),min:new this.aggregators[Zy.MIN](this.indicatorKeys[e]),total:new this.aggregators[t?.aggregationType??Zy.SUM](t?.field??this.indicatorKeys[e],t?.formatFun??this.indicators?.find((t=>"string"!=typeof t&&t.indicatorKey===this.indicatorKeys[e]))?.format)}}this.indicatorStatistics[e].max.push(this.tree[o]?.[s]?.[e].value()),this.indicatorStatistics[e].min.push(this.tree[o]?.[s]?.[e].value()),this.indicatorStatistics[e].total.push(t)}}}updateSortRules(t){this.sorted=!1,this.sortRules=t,this.sortKeys()}updateFilterRules(t,e=!1){if(this.filterRules=t,e)this.tree={};else for(const t in this.tree)for(const e in this.tree[t])for(let i=0;i<this.tree[t][e].length;i++)this.tree[t][e][i].reset();this.collectedValues={},this.processRecords(),this.processCollectedValuesWithSumBy(),this.processCollectedValuesWithSortBy(),this.dataConfig?.isPivotChart&&this.cacheDeminsionCollectedValues()}getAggregatorRule(t){return this.aggregationRules?.find(((e,i)=>t===e.indicatorKey))}getAggregator(t=[],e=[],i,r=!0){const n=this.indicatorKeys.indexOf(i);let o,s;o="string"==typeof t?t:t.join(this.stringJoinChar),s="string"==typeof e?e:e.join(this.stringJoinChar);const a=this.tree[o]?.[s]?.[n];if(r&&Y(this.changedTree[o]?.[s]?.[n])){const t=this.changedTree[o][s][n];return a?{value:()=>t,formatValue:a.formatValue,formatFun:a.formatFun,records:a.records,className:"",push(){},clearCacheValue(){},reset(){}}:{value:()=>t,className:"",push(){},formatValue:()=>t,clearCacheValue(){},reset(){}}}return a||{className:"",push(){},value:()=>null,formatValue:()=>"",clearCacheValue(){},reset(){}}}sortKeys(){const t=this;if(!this.sorted){this.sorted=!0;const e=function(e,i){return t.getAggregator(e,i,"").value()};switch(this.rowOrder){case"value_a_to_z":this.rowKeys.sort((function(t,i){return CP(e(t,[]),e(i,[]))}));break;case"value_z_to_a":this.rowKeys.sort((function(t,i){return-CP(e(t,[]),e(i,[]))}));break;default:this.rowKeys.sort(this.arrSort(this.rows,!0))}switch(this.colOrder){case"value_a_to_z":this.colKeys.sort((function(t,i){return CP(e([],t),e([],i))}));break;case"value_z_to_a":this.colKeys.sort((function(t,i){return-CP(e([],t),e([],i))}));break;default:const t=this.arrSort(this.columns,!1);this.colKeys.sort(t)}}}arrSort(t,e){let i;const r=this,n=function(n){const o=[];for(let n=0,s=t.length;n<s;n++)if(i=t[n],r.sortRules)for(let t=0,s=r.sortRules.length;t<s;t++)r.sortRules[t].sortField===i&&o.push({field:i,fieldIndex:n,sortRule:r.sortRules[t],func:r.getSort(r.sortRules[t],e)});return o}.call(this);return function(i,o){let s,a;for(let l=0;l<n.length;l++){if(a=n[l],a.sortRule?.sortByIndicator){let n=i,l=o;a.fieldIndex<t.length-1&&(n=i.slice(0,a.fieldIndex+1),n.push(e?r.totals?.row?.subTotalLabel:r.totals?.column?.subTotalLabel),l=o.slice(0,a.fieldIndex+1),l.push(e?r.totals?.row?.subTotalLabel:r.totals?.column?.subTotalLabel)),s=a.func(n,l)}else s=a.func?.(i[a.fieldIndex],o[a.fieldIndex]);if(0!==s)return s*(a.sortRule?.sortType===Jy.DESC?-1:1)}return 0}}getSort(t,e){const i=this;return t.sortByIndicator?(r,n)=>{const o=function(e,r){return e.length<i.rows.length&&e[e.length-1]!==i.rowSubTotalLabel&&e[e.length-1]!==i.rowGrandTotalLabel&&e.push(i.rowSubTotalLabel),r.length<i.columns.length&&r[r.length-1]!==i.colSubTotalLabel&&r[r.length-1]!==i.colGrandTotalLabel&&r.push(i.colSubTotalLabel),i.getAggregator(e,r,t.sortByIndicator).value()};return e?CP(o(r,t.query),o(n,t.query)):CP(o(t.query,r),o(t.query,n))}:t.sortBy?function(t){let e;const i={},r={};for(let n=0;n<t.length;n++)e=t[n],i[e]=n,"string"==typeof e&&(r[e.toLowerCase()]=n);return function(t,e){return null!==i[t]&&void 0!==i[t]&&null!==i[e]&&void 0!==i[e]?i[t]-i[e]:null!==i[t]&&void 0!==i[t]?-1:null!==i[e]&&void 0!==i[e]?1:null!==r[t]&&void 0!==i[t]&&null!==r[e]&&void 0!==i[e]?r[t]-r[e]:null===r[t]||void 0===i[t]||null===r[e]||void 0===i[e]?0:null!==r[t]&&void 0!==i[t]?-1:null!==r[e]&&void 0!==i[e]?1:CP(t,e)}}(t.sortBy):t.sortType?yP:t.sortFunc?t.sortFunc:CP}totalStatistics(){const t=this;if(t?.totals?.column?.showSubTotals&&t?.totals?.column?.subTotalsDimensions?.length>=1||t?.totals?.row?.showSubTotals&&t?.totals?.row?.subTotalsDimensions?.length>=1||t?.totals?.column?.showGrandTotals||t?.totals?.row?.showGrandTotals){const e=[],i=(e,i)=>{if(this.totalRecordsTree?.[e]?.[i])return void(this.tree[e][i]=this.totalRecordsTree?.[e]?.[i]);const r=i.split(this.stringJoinChar);for(let n=0,o=t.totals?.column?.subTotalsDimensions?.length;n<o;n++){const o=t.totals.column.subTotalsDimensions[n],s=t.columns.indexOf(o);if(s>=0){const n=r.slice(0,s+1);n.push(t.totals?.column?.subTotalLabel??"小计");const o=n.join(this.stringJoinChar);if(this.totalRecordsTree?.[e]?.[o])return void(this.tree[e][o]=this.totalRecordsTree?.[e]?.[o]);this.tree[e][o]||(this.tree[e][o]=[]);for(let r=0;r<this.indicatorKeys.length;r++){if(!this.tree[e][o][r]){const t=this.getAggregatorRule(this.indicatorKeys[r]);this.tree[e][o][r]=new this.aggregators[t?.aggregationType??Zy.SUM](t?.field??this.indicatorKeys[r],t?.formatFun??this.indicators?.find((t=>"string"!=typeof t&&t.indicatorKey===this.indicatorKeys[r]))?.format)}this.tree[e][o][r].push(t.tree[e]?.[i]?.[r])}}}if(t.totals?.column?.showGrandTotals||0===this.rows.length){const r=t.colGrandTotalLabel;if(this.totalRecordsTree?.[e]?.[r])return void(this.tree[e][r]=this.totalRecordsTree?.[e]?.[r]);this.tree[e][r]||(this.tree[e][r]=[]);for(let n=0;n<this.indicatorKeys.length;n++){if(!this.tree[e][r][n]){const t=this.getAggregatorRule(this.indicatorKeys[n]);this.tree[e][r][n]=new this.aggregators[t?.aggregationType??Zy.SUM](t?.field??this.indicatorKeys[n],t?.formatFun??this.indicators?.find((t=>"string"!=typeof t&&t.indicatorKey===this.indicatorKeys[n]))?.format)}this.tree[e][r][n].push(t.tree[e]?.[i]?.[n])}}};Object.keys(t.tree).forEach((r=>{const n=r.split(this.stringJoinChar);Object.keys(t.tree[r]).forEach((o=>{for(let i=0,s=t.totals?.row?.subTotalsDimensions?.length;i<s;i++){const s=t.totals.row.subTotalsDimensions[i],a=t.rows.indexOf(s);if(a>=0&&a<t.rows.length-1){const i=n.slice(0,a+1);"grid"===this.rowHierarchyType&&i.push(t.totals?.row?.subTotalLabel??"小计");const s=i.join(this.stringJoinChar);this.tree[s]||(this.tree[s]={},e.push(s)),this.tree[s][o]||(this.tree[s][o]=[]);for(let e=0;e<this.indicatorKeys.length;e++){if(!this.tree[s][o][e]){const t=this.getAggregatorRule(this.indicatorKeys[e]);this.tree[s][o][e]=new this.aggregators[t?.aggregationType??Zy.SUM](t?.field??this.indicatorKeys[e],t?.formatFun??this.indicators?.find((t=>"string"!=typeof t&&t.indicatorKey===this.indicatorKeys[e]))?.format)}this.tree[s][o][e].push(t.tree[r]?.[o]?.[e])}}}if(t.totals?.row?.showGrandTotals||0===this.columns.length){const i=t.rowGrandTotalLabel;this.tree[i]||(this.tree[i]={},e.push(i)),this.tree[i][o]||(this.tree[i][o]=[]);for(let e=0;e<this.indicatorKeys.length;e++){if(!this.tree[i][o][e]){const t=this.getAggregatorRule(this.indicatorKeys[e]);this.tree[i][o][e]=new this.aggregators[t?.aggregationType??Zy.SUM](t?.field??this.indicatorKeys[e],t?.formatFun??this.indicators?.find((t=>"string"!=typeof t&&t.indicatorKey===this.indicatorKeys[e]))?.format)}this.tree[i][o][e].push(t.tree[r]?.[o]?.[e])}}i(r,o)}))})),e.forEach((e=>{Object.keys(t.tree[e]).forEach((t=>{i(e,t)}))}))}}ArrToTree1(t,e,i,r,n){const o=[],s=this.stringJoinChar,a=new Map;function l(t){const r=[];let n;t.forEach(((l,h)=>{r.push(l);const c=r.join(s);let d=a.get(c);d||(d={value:l,dimensionKey:e[h],children:h===t.length-1&&i?.length>=1?i?.map((t=>"string"==typeof t?{indicatorKey:t,value:t}:{indicatorKey:t.indicatorKey,value:t.title})):[]},a.set(c,d),n?n.children.push(d):o.push(d)),n=d}))}return t.forEach((t=>l(t))),r&&l([n]),o}ArrToTree(t,e,i,r,n,o,s,a,l){let h=[];const c=this.stringJoinChar,d=new Map;if(t?.length?t.forEach((t=>function(t){const n=[];let o;t.forEach(((a,u)=>{n.push(a);const g=n.join(c);let p=d.get(g);if(!p){if(p={value:a,dimensionKey:e[u],children:u===t.length-1&&i?.length>=1?i?.map((t=>"string"==typeof t?{indicatorKey:t,value:t}:{indicatorKey:t.indicatorKey,value:t.title})):[]},r[u]){let t=p.children;const n={value:s,dimensionKey:e[u+1],levelSpan:r.length-u-1,children:i?.length>=1?i?.map((t=>"string"==typeof t?{indicatorKey:t,value:t}:{indicatorKey:t.indicatorKey,value:t.title})):[]};t.push(n),t=n.children}d.set(g,p),o?r[u-1]&&!l?o.children.splice(o.children.length-1,0,p):o.children.push(p):h.push(p)}o=p}))}(t))):i&&(h=i?.map((t=>({indicatorKey:t.indicatorKey,value:t.title??t.indicatorKey})))),n&&t?.length){const t={value:o,dimensionKey:e[0],levelSpan:r.length,children:i?.map((t=>"string"==typeof t?{indicatorKey:t,value:t}:{indicatorKey:t.indicatorKey,value:t.title}))??[]};a?h.unshift(t):h.push(t)}return h}TreeToArr(t){const e=[];function i(t,r){r.push(t.id),t.children.length>0?t.children?.forEach((t=>i(t,[...r]))):e.push(r)}return t.forEach((t=>i(t,[]))),e}cacheDeminsionCollectedValues(){for(const t in this.collectValuesBy)"xField"!==this.collectValuesBy[t].type&&"yField"!==this.collectValuesBy[t].type||(this.dataConfig.dimensionSortArray?this.cacheCollectedValues[t]=wP(this.collectedValues[t],this.dataConfig.dimensionSortArray):this.cacheCollectedValues[t]=this.collectedValues[t])}_adjustCustomTree(t){const e=(t,i)=>{t.forEach((t=>{t.indicatorKey||i||t.children?.length?t.children&&e(t.children,i||!!t.indicatorKey):t.children=this.indicators?.map((t=>({indicatorKey:t.indicatorKey,value:t.title??t.indicatorKey})))}))};return t?.length?e(t,!1):t=this.indicators?.map((t=>({indicatorKey:t.indicatorKey,value:t.title??t.indicatorKey}))),t}changeTreeNodeValue(t=[],e=[],i,r){const n=this.indicatorKeys.indexOf(i);let o,s;o="string"==typeof t?t:t.join(this.stringJoinChar),s="string"==typeof e?e:e.join(this.stringJoinChar),this.changedTree[o]?.[s]?this.changedTree[o][s][n]=r:this.changedTree[o]?(this.changedTree[o][s]=[],this.changedTree[o][s][n]=r):(this.changedTree[o]={},this.changedTree[o][s]=[],this.changedTree[o][s][n]=r)}}function wP(t,e){return t.sort(((t,i)=>{const r=e.indexOf(t),n=e.indexOf(i);return r<n?-1:r>n?1:0}))}class xP extends hs{constructor(t){t.direction&&(t.flexDirection=t.direction),!t.justifyContent||"start"!==t.justifyContent&&"end"!==t.justifyContent||(t.justifyContent="flex-"+t.justifyContent),!t.alignItems||"start"!==t.alignItems&&"end"!==t.alignItems||(t.alignItems="flex-"+t.alignItems),!t.alignContent||"start"!==t.alignContent&&"end"!==t.alignContent||(t.alignContent="flex-"+t.alignContent),t.display="flex",t.flexDirection||(t.flexDirection="row"),t.clip=!0,t.fill=t?.background?.fill,t.stroke=t?.background?.stroke,t.lineWidth=t?.background?.lineWidth,t.cornerRadius=t?.background?.cornerRadius;const e=it(t.boundsPadding),i=[t.marginTop??(e?t.boundsPadding[0]:t.boundsPadding)??0,t.marginRight??(e?t.boundsPadding[1]:t.boundsPadding)??0,t.marginBottom??(e?t.boundsPadding[2]??t.boundsPadding[0]:t.boundsPadding)??0,t.marginLeft??(e?t.boundsPadding[3]??t.boundsPadding[1]:t.boundsPadding)??0];t.boundsPadding=i,super(t)}}var _P=Object.freeze({__proto__:null,Arc:class extends Dl{constructor(t){const e=it(t.boundsPadding),i=[t.marginTop??(e?t.boundsPadding[0]:t.boundsPadding)??0,t.marginRight??(e?t.boundsPadding[1]:t.boundsPadding)??0,t.marginBottom??(e?t.boundsPadding[2]??t.boundsPadding[0]:t.boundsPadding)??0,t.marginLeft??(e?t.boundsPadding[3]??t.boundsPadding[1]:t.boundsPadding)??0];t.boundsPadding=i,super(t)}},Circle:class extends $s{constructor(t){const e=it(t.boundsPadding),i=[t.marginTop??(e?t.boundsPadding[0]:t.boundsPadding)??0,t.marginRight??(e?t.boundsPadding[1]:t.boundsPadding)??0,t.marginBottom??(e?t.boundsPadding[2]??t.boundsPadding[0]:t.boundsPadding)??0,t.marginLeft??(e?t.boundsPadding[3]??t.boundsPadding[1]:t.boundsPadding)??0];t.boundsPadding=i,super(t)}},Container:xP,Group:class extends hs{constructor(t){const e=it(t.boundsPadding),i=[t.marginTop??(e?t.boundsPadding[0]:t.boundsPadding)??0,t.marginRight??(e?t.boundsPadding[1]:t.boundsPadding)??0,t.marginBottom??(e?t.boundsPadding[2]??t.boundsPadding[0]:t.boundsPadding)??0,t.marginLeft??(e?t.boundsPadding[3]??t.boundsPadding[1]:t.boundsPadding)??0];t.boundsPadding=i,super(t)}},GroupElement:class extends xP{constructor(t){t.flexWrap="nowrap",super(t)}},Icon:class extends Sl{svg;iconName;cache;constructor(t){let e;if(et(t.iconName)){e=YS()[t.iconName],e&&(t.width=t.width??e.width,t.height=t.height??e.height,t.svg=e.svg,t.cursor=e.cursor)}t.svg&&(t.image=t.svg);const i=it(t.boundsPadding),r=[t.marginTop??(i?t.boundsPadding[0]:t.boundsPadding)??0,t.marginRight??(i?t.boundsPadding[1]:t.boundsPadding)??0,t.marginBottom??(i?t.boundsPadding[2]??t.boundsPadding[0]:t.boundsPadding)??0,t.marginLeft??(i?t.boundsPadding[3]??t.boundsPadding[1]:t.boundsPadding)??0];t.boundsPadding=r,super(t),this.cache=e}},Image:class extends Sl{constructor(t){t.src&&(t.image=t.src),"circle"===t.shape&&(t.cornerRadius=t.width/2);const e=it(t.boundsPadding),i=[t.marginTop??(e?t.boundsPadding[0]:t.boundsPadding)??0,t.marginRight??(e?t.boundsPadding[1]:t.boundsPadding)??0,t.marginBottom??(e?t.boundsPadding[2]??t.boundsPadding[0]:t.boundsPadding)??0,t.marginLeft??(e?t.boundsPadding[3]??t.boundsPadding[1]:t.boundsPadding)??0];t.boundsPadding=i,super(t)}},Rect:class extends pl{constructor(t){const e=it(t.boundsPadding),i=[t.marginTop??(e?t.boundsPadding[0]:t.boundsPadding)??0,t.marginRight??(e?t.boundsPadding[1]:t.boundsPadding)??0,t.marginBottom??(e?t.boundsPadding[2]??t.boundsPadding[0]:t.boundsPadding)??0,t.marginLeft??(e?t.boundsPadding[3]??t.boundsPadding[1]:t.boundsPadding)??0];t.boundsPadding=i,super(t)}},Tag:class extends tw{constructor(t){const e=it(t.boundsPadding),i=[t.marginTop??(e?t.boundsPadding[0]:t.boundsPadding)??0,t.marginRight??(e?t.boundsPadding[1]:t.boundsPadding)??0,t.marginBottom??(e?t.boundsPadding[2]??t.boundsPadding[0]:t.boundsPadding)??0,t.marginLeft??(e?t.boundsPadding[3]??t.boundsPadding[1]:t.boundsPadding)??0];t.boundsPadding=i,super(t)}getSize(t){this.AABBBounds.width()}},Text:class extends ta{constructor(t){t.textBaseline||(t.textBaseline="top");const e=it(t.boundsPadding),i=[t.marginTop??(e?t.boundsPadding[0]:t.boundsPadding)??0,t.marginRight??(e?t.boundsPadding[1]:t.boundsPadding)??0,t.marginBottom??(e?t.boundsPadding[2]??t.boundsPadding[0]:t.boundsPadding)??0,t.marginLeft??(e?t.boundsPadding[3]??t.boundsPadding[1]:t.boundsPadding)??0];t.boundsPadding=i,t.fill=t.fill??"#000",super(t)}getSize(t){this.AABBBounds.width()}},percentCalc:function(t,e=0){return{percent:t,delta:e}}});function SP(t){const e={isPivotChart:!0},i=t.rows?.reduce(((t,e)=>("string"==typeof e?t.push(e):t.push(e.dimensionKey),t)),[])??[],r=t.columns?.reduce(((t,e)=>("string"==typeof e?t.push(e):t.push(e.dimensionKey),t)),[])??[],n=t.indicators?.reduce(((t,e)=>("string"==typeof e?t.push(e):t.push(e.indicatorKey),t)),[])??[];e.collectValuesBy=function(t,e,i){const r={};for(let n=0,o=t.indicators?.length;n<o;n++)if("string"!=typeof t.indicators[n]&&t.indicators[n].chartSpec)if(!1===t.indicatorsAsCol){const o=t.indicators[n];if(r[o.indicatorKey]={by:i,range:!0,sumBy:!1!==o.chartSpec?.stack&&e.concat(o.chartSpec?.xField)},o.chartSpec.series)o.chartSpec.series.forEach((t=>{const n="string"==typeof t.xField?t.xField:t.xField[0];r[n]={by:e,type:"horizontal"!==t.direction?"xField":void 0,range:"horizontal"===t.direction,sortBy:"horizontal"!==t.direction?t?.data?.fields?.[n]?.domain??o.chartSpec?.data?.fields?.[n]?.domain:void 0};const s=t.yField;r[s]={by:i,range:"horizontal"!==t.direction,sumBy:!1!==t.stack&&e.concat(t?.xField),sortBy:"horizontal"===t.direction?t?.data?.fields?.[s]?.domain??o.chartSpec?.data?.fields?.[s]?.domain:void 0}}));else{const s="string"==typeof o.chartSpec.xField?o.chartSpec.xField:o.chartSpec.xField[0];r[s]={by:e,type:"horizontal"!==o.chartSpec.direction?"xField":void 0,range:"horizontal"===o.chartSpec.direction,sortBy:"horizontal"!==o.chartSpec.direction?o.chartSpec?.data?.fields?.[s]?.domain:void 0};const a=o.chartSpec.yField;r[a]={by:i,range:"horizontal"!==t.indicators[n].chartSpec.direction,sumBy:!1!==o.chartSpec.stack&&e.concat(o.chartSpec?.xField),sortBy:"horizontal"===o.chartSpec.direction?o.chartSpec?.data?.fields?.[a]?.domain:void 0}}}else{const o=t.indicators[n];if(r[o.indicatorKey]={by:e,range:!0,sumBy:!1!==o.chartSpec?.stack&&i.concat(o.chartSpec?.yField)},o.chartSpec.series)o.chartSpec.series.forEach((t=>{const n="string"==typeof t.yField?t.yField:t.yField[0];r[n]={by:i,type:"horizontal"===t.direction?"yField":void 0,range:"horizontal"!==t.direction,sortBy:"horizontal"===t.direction?t?.data?.fields?.[n]?.domain??o.chartSpec?.data?.fields?.[n]?.domain:void 0};const s=t.xField;r[s]={by:e,range:"horizontal"===t.direction,sumBy:!1!==t.stack&&i.concat(t?.yField),sortBy:"horizontal"!==t.direction?t?.data?.fields?.[s]?.domain??o.chartSpec?.data?.fields?.[s]?.domain:void 0}}));else{const s="string"==typeof o.chartSpec.yField?o.chartSpec.yField:o.chartSpec.yField[0];r[s]={by:i,type:"horizontal"===o.chartSpec.direction?"yField":void 0,range:"horizontal"!==o.chartSpec.direction,sortBy:"horizontal"===o.chartSpec.direction?o.chartSpec?.data?.fields?.[s]?.domain:void 0};const a=o.chartSpec.xField;r[a]={by:e,range:"horizontal"===t.indicators[n].chartSpec.direction,sumBy:!1!==o.chartSpec.stack&&i.concat(o.chartSpec?.yField),sortBy:"horizontal"!==o.chartSpec.direction?o.chartSpec?.data?.fields?.[a]?.domain:void 0}}}return r}(t,r,i),e.aggregationRules=function(t){const e=[];return t.indicators?.forEach((i=>{if("string"==typeof i)e.push({indicatorKey:i,field:i,aggregationType:Zy.RECORD});else if(i.chartSpec?.series){const r=[];i.chartSpec?.series.forEach((e=>{const i=!1===t.indicatorsAsCol?e.yField:e.xField;-1===r.indexOf(i)&&r.push(i)})),e.push({indicatorKey:i.indicatorKey,field:r,aggregationType:Zy.RECORD})}else{const r=!1===t.indicatorsAsCol?i.chartSpec.yField:i.chartSpec.xField;e.push({indicatorKey:i.indicatorKey,field:r??i.indicatorKey,aggregationType:Zy.RECORD})}})),e}(t);return new vP(e,i,r,n,t.indicators,t.indicatorsAsCol??!0,t.records,void 0,t.columnTree,t.rowTree,!0)}function AP(t,e,i,r,n,o){if(it(t))for(let l=0;l<t.length;l++)if(o?o(t[l],e):(s=t[l],a=e,JSON.stringify(s)===JSON.stringify(a)))return n.getCellHeaderPaths(i,r);var s,a}t.CustomLayout=_P,t.DataStatistics=XR,t.ListTable=class extends WR{showHeader=!0;editorManager;constructor(t,e){"node"===CC.mode?(e=t,t=null):t instanceof HTMLElement||(e=t,t=t.container?t.container:null),super(t,e);const i=this.internalProps;this.pagination=e.pagination,i.sortState=e.sortState,i.columns=e.columns?bt(e.columns):e.header?bt(e.header):[],e.columns?.forEach(((t,e)=>{t.editor&&(i.columns[e].editor=t.editor)})),this.showHeader=e.showHeader??!0,this.transpose=e.transpose??!1,"node"!==CC.mode&&(this.editorManager=new tP(this)),this.refreshHeader(),e.dataSource?FS(this,e.dataSource):e.records?this.setRecords(e.records,i.sortState):this.setRecords([]),e.title&&(i.title=new QR(e.title,this),this.scenegraph.resize()),setTimeout((()=>{this.fireListeners(ov.INITIALIZED,null)}),0)}isListTable(){return!0}isPivotTable(){return!1}isPivotChart(){return!1}get sortState(){return this.internalProps.sortState}updateColumns(t){const e={col:this.stateManager.hover.cellPos.col,row:this.stateManager.hover.cellPos.row};this.internalProps.columns=bt(t),t.forEach(((t,e)=>{t.editor&&(this.internalProps.columns[e].editor=t.editor)})),this.options.columns=t,this.refreshHeader(),this.scenegraph.clearCells(),this.headerStyleCache=new Map,this.bodyStyleCache=new Map,this.bodyBottomStyleCache=new Map,this.scenegraph.createSceneGraph(),this.stateManager.updateHoverPos(e.col,e.row),this.renderAsync(),this.eventManager.updateEventBinder()}get columns(){return this.internalProps.columns}get header(){return this.internalProps.columns}set header(t){this.internalProps.columns=t,this.options.header=t,this.refreshHeader(),this.renderAsync()}get transpose(){return this.internalProps.transpose??!1}set transpose(t){this.internalProps.transpose!==t&&(this.internalProps.transpose=t,this.options.transpose=t,this.internalProps.layoutMap&&(this.internalProps.layoutMap.transpose=t,this.refreshRowColCount(),this._resetFrozenColCount(),this.renderAsync()))}getCellValue(t,e){if(-1===t||-1===e)return null;const i=this.getCustomMergeValue(t,e);if(i)return i;const r=this;if(r.internalProps.layoutMap.isHeader(t,e)){const{title:i}=r.internalProps.layoutMap.getHeader(t,e);return"function"==typeof i?i():i}const{field:n,fieldFormat:o}=r.internalProps.layoutMap.getBody(t,e);return r.getFieldData(o||n,t,e)}getCellOriginValue(t,e){if(-1===t||-1===e)return null;const i=this;if(i.internalProps.layoutMap.isHeader(t,e)){const{title:r}=i.internalProps.layoutMap.getHeader(t,e);return"function"==typeof r?r():r}const{field:r}=i.internalProps.layoutMap.getBody(t,e);return i.getFieldData(r,t,e)}getCellRawValue(t,e){if(-1===t||-1===e)return null;const i=this;if(i.internalProps.layoutMap.isHeader(t,e)){const{title:r}=i.internalProps.layoutMap.getHeader(t,e);return"function"==typeof r?r():r}const{field:r}=i.internalProps.layoutMap.getBody(t,e);return i.getRawFieldData(r,t,e)}getRecordShowIndexByCell(t,e){const{layoutMap:i}=this.internalProps;return i.getRecordIndexByCell(t,e)}getTableIndexByRecordIndex(t){return this.transpose?this.dataSource.getTableIndex(t)+this.rowHeaderLevelCount:this.dataSource.getTableIndex(t)+this.columnHeaderLevelCount}getTableIndexByField(t){const e=this.internalProps.layoutMap.columnObjects.find((e=>e.field===t)),i=this.internalProps.layoutMap.getBodyLayoutRangeById(e.id);return this.transpose?i.start.row:i.start.col}getCellAddrByFieldRecord(t,e){return this.transpose?{col:this.getTableIndexByRecordIndex(e),row:this.getTableIndexByField(t)}:{col:this.getTableIndexByField(t),row:this.getTableIndexByRecordIndex(e)}}getCellOriginRecord(t,e){const i=this,r=i.getRecordShowIndexByCell(t,e);if(r>-1)return i.dataSource.get(r)}getCellRawRecord(t,e){const i=this,r=i.getRecordShowIndexByCell(t,e);if(r>-1)return i.dataSource.getRaw(r)}_canResizeColumn(t,e){const i=super._canResizeColumn(t,e);if(i&&!this.transpose){const e=this.internalProps.layoutMap.getBody(t,this.columnHeaderLevelCount);if(e?.disableColumnResize)return!1}return i}updateOption(t,e=!1){const i=this.internalProps;return super.updateOption(t),this.pagination=t.pagination,this.showHeader=t.showHeader??!0,i.columns=t.columns?bt(t.columns):t.header?bt(t.header):[],t.columns.forEach(((t,e)=>{t.editor&&(i.columns[e].editor=t.editor)})),this.transpose=t.transpose??!1,this.refreshHeader(),i.releaseList&&(i.releaseList.forEach((t=>t?.release?.())),i.releaseList=null),t.dataSource?FS(this,t.dataSource):t.records?this.setRecords(t.records,t.sortState):(this._resetFrozenColCount(),this.scenegraph.createSceneGraph(),this.render()),t.title&&(i.title=new QR(t.title,this),this.scenegraph.resize()),new Promise((t=>{setTimeout(t,0)}))}updatePagination(t){this.pagination&&("number"==typeof t.currentPage&&t.currentPage>=0&&(this.pagination.currentPage=t.currentPage),t.perPageCount&&(this.pagination.perPageCount=t.perPageCount||this.pagination.perPageCount),this.scenegraph.clearCells(),this.dataSource.updatePagination(this.pagination),this.refreshRowColCount(),this.scenegraph.createSceneGraph(),this.renderAsync())}refreshHeader(){const t=this,e=t.internalProps,i=t.transpose,r=t.showHeader,n=e.layoutMap=new JR(this,e.columns??[],r,t.options.hierarchyIndent);if(n.transpose=i,!i)for(let e=0;e<n.columnWidths.length;e++){const{width:i,minWidth:r,maxWidth:o}=n.columnWidths?.[e]??{};i&&("string"==typeof i&&"auto"!==i||"number"==typeof i&&i>0)&&t._setColWidth(e,i),r&&("number"==typeof r&&r>0||"string"==typeof r)&&t.setMinColWidth(e,r),o&&("number"==typeof o&&o>0||"string"==typeof o)&&t.setMaxColWidth(e,o)}this.refreshRowColCount()}refreshRowColCount(){const t=this,{layoutMap:e}=t.internalProps;e&&(e.recordsCount=t.internalProps.dataSource?.length??0,t.transpose?(t.rowCount=e.rowCount??0,t.colCount=(t.internalProps.dataSource?.length??0)*e.bodyRowSpanCount+e.headerLevelCount,t.frozenRowCount=0,this.internalProps.frozenColCount=e.headerLevelCount??0,t.bottomFrozenRowCount!==(this.options.bottomFrozenRowCount??0)&&(t.bottomFrozenRowCount=this.options.bottomFrozenRowCount??0),t.rightFrozenColCount!==(this.options.rightFrozenColCount??0)&&(t.rightFrozenColCount=this.options.rightFrozenColCount??0)):(t.colCount=e.colCount??0,t.rowCount=(t.internalProps.dataSource?.length??0)*e.bodyRowSpanCount+e.headerLevelCount,this.internalProps.frozenColCount=this.options.frozenColCount??0,t.frozenRowCount=e.headerLevelCount,t.bottomFrozenRowCount!==(this.options.bottomFrozenRowCount??0)&&(t.bottomFrozenRowCount=this.options.bottomFrozenRowCount??0),t.rightFrozenColCount!==(this.options.rightFrozenColCount??0)&&(t.rightFrozenColCount=this.options.rightFrozenColCount??0)),this.stateManager.setFrozenCol(this.internalProps.frozenColCount))}getFieldData(t,e,i){if(null===t)return null;const r=this;if(r.internalProps.layoutMap.isHeader(e,i))return null;const n=r.getRecordShowIndexByCell(e,i);return r.internalProps.dataSource.getField(n,t,e,i,this)}getRawFieldData(t,e,i){if(null===t)return null;const r=this;if(r.internalProps.layoutMap.isHeader(e,i))return null;const n=r.getRecordShowIndexByCell(e,i);return r.internalProps.dataSource.getRawField(n,t,e,i,this)}moveHeaderPosition(t,e){const i=this.internalProps.layoutMap.moveHeaderPosition(t,e);if(i){if("column"===i.moveType){if(this.colWidthsMap.adjustOrder(i.sourceIndex,i.targetIndex,i.moveSize),!this.transpose){this.colWidthsLimit={};for(let t=0;t<this.internalProps.layoutMap.columnWidths.length;t++){const{minWidth:e,maxWidth:i}=this.internalProps.layoutMap.columnWidths?.[t]??{};e&&("number"==typeof e&&e>0||"string"==typeof e)&&this.setMinColWidth(t,e),i&&("number"==typeof i&&i>0||"string"==typeof i)&&this.setMaxColWidth(t,i)}}const t=Math.min(i.sourceIndex,i.targetIndex),e=Math.max(i.sourceIndex,i.targetIndex);for(let i=t;i<=e;i++)this._clearColRangeWidthsMap(i)}else{const t=Math.min(i.sourceIndex,i.targetIndex),e=Math.max(i.sourceIndex,i.targetIndex);for(let i=t;i<=e;i++)this._clearRowRangeHeightsMap(i)}return!0}return!1}getCellAddress(t,e){let i;for(let e=0;e<this.internalProps.records.length;e++){const r=this.internalProps.records[e];if("function"==typeof t)t(r)&&(i=e);else{let n=!0;for(const e in t)if(r[e]!==t[e]){n=!1;break}n&&(i=e)}if(Y(i))break}const r=this.getCellRangeByField(e,i);if(r)return{row:r.start.row,col:r.start.col}}getCellRangeByField(t,e){const{layoutMap:i}=this.internalProps,r=i.columnObjects.find((e=>e.field===t));if(r){const t=i.getBodyLayoutRangeById(r.id);let n;return Y(e)&&(n=i.getRecordStartRowByRecordIndex(e)),this.transpose?{start:{row:t.start.row,col:Y(n)?n+t.start.col:void 0},end:{row:t.end.row,col:Y(n)?n+t.end.col:void 0}}:{start:{col:t.start.col,row:Y(n)?n+t.start.row:void 0},end:{col:t.end.col,row:Y(n)?n+t.end.row:void 0}}}return null}getHierarchyState(t,e){if(!this.getBodyColumnDefine(t,e).tree)return qy.none;const i=this.getRecordShowIndexByCell(t,e);return this.dataSource.getHierarchyState(i)}toggleHierarchyState(t,e){const i=this.getHierarchyState(t,e);if(i===qy.expand)this._refreshHierarchyState(t,e),this.fireListeners(ov.TREE_HIERARCHY_STATE_CHANGE,{col:t,row:e,hierarchyState:qy.collapse});else if(i===qy.collapse){const i=this.getCellOriginRecord(t,e);Array.isArray(i.children)&&this._refreshHierarchyState(t,e),this.fireListeners(ov.TREE_HIERARCHY_STATE_CHANGE,{col:t,row:e,hierarchyState:qy.expand,originData:i})}}_refreshHierarchyState(t,e){const i=this.getRecordShowIndexByCell(t,e),r=this.dataSource.toggleHierarchyState(i),n=this.internalProps.layoutMap.toggleHierarchyState(r);this.refreshRowColCount(),this.clearCellStyleCache(),this.scenegraph.updateHierarchyIcon(t,e),this.scenegraph.updateRow(n.removeCellPositions,n.addCellPositions)}_hasHierarchyTreeHeader(){return(this.options.columns??this.options.header)?.some(((t,e)=>t.tree))}getMenuInfo(t,e,i){return{field:this.getHeaderField(t,e),value:this.getCellValue(t,e),cellLocation:this.getCellLocation(t,e)}}_getSortFuncFromHeaderOption(t,e,i){if(t||(t=this.internalProps.columns),e&&t&&t.length>0)for(let r=0;r<t.length;r++){const n=t[r];if((i&&i===n.fieldKey||!i&&n.field===e)&&n.sort&&"function"==typeof n.sort)return n.sort;if(n.columns){const t=this._getSortFuncFromHeaderOption(n.columns,e,i);if(t)return t}}}updateSortState(t,e=!0){if(t)this.internalProps.sortState=t;else if(this.internalProps.sortState)if(Array.isArray(this.internalProps.sortState))for(let t=0;t<this.internalProps.sortState.length;t++){this.internalProps.sortState[t].order="normal"}else this.internalProps.sortState.order="normal";let i,r,n;if(Array.isArray(this.internalProps.sortState)?({order:i,field:r,fieldKey:n}=this.internalProps.sortState?.[0]):({order:i,field:r,fieldKey:n}=this.internalProps.sortState),r&&e){const t=this._getSortFuncFromHeaderOption(this.internalProps.columns,r,n);let e;e=n?this.internalProps.layoutMap.headerObjects.find((t=>t&&t.fieldKey===n)):this.internalProps.layoutMap.headerObjects.find((t=>t&&t.field===r)),e?.define?.sort&&(this.dataSource.sort(e.field,i,t),this.internalProps.layoutMap.clearCellRangeMap(),this.scenegraph.sortCell())}this.stateManager.updateSortState(t)}getCheckboxState(t){return this.stateManager.checkedState.length<this.rowCount-this.columnHeaderLevelCount&&this.stateManager.initLeftRecordsCheckState(this.records),Y(t)?this.stateManager.checkedState.map((e=>e[t])):this.stateManager.checkedState}getCellCheckboxState(t,e){const i=this.getBodyColumnDefine(t,e),r=i?.field,n=i?.cellType;if(Y(r)&&"checkbox"===n){const i=this.dataSource.getIndexKey(this.getRecordShowIndexByCell(t,e));return this.stateManager.checkedState[i][r]}}setRecords(t,e){"undefined"!=typeof window&&window.performance.now();const i={col:this.stateManager.hover.cellPos.col,row:this.stateManager.hover.cellPos.row};if(this.scenegraph.clearCells(),void 0!==e&&(this.internalProps.sortState=e,this.stateManager.setSortState(this.sortState)),t){if(IS(this,t),this.sortState){let t,e,i;if(Array.isArray(this.sortState)?0!==this.sortState.length&&({order:t,field:e,fieldKey:i}=this.sortState?.[0]):({order:t,field:e,fieldKey:i}=this.sortState),t&&e&&"normal"!==t){const r=this._getSortFuncFromHeaderOption(void 0,e,i);let n;n=i?this.internalProps.layoutMap.headerObjects.find((t=>t&&t.fieldKey===i)):this.internalProps.layoutMap.headerObjects.find((t=>t&&t.field===e)),this.dataSource.sort(n.field,t,r??kC)}}this.refreshRowColCount()}else IS(this,t);this.stateManager.initCheckedState(t),this.clearCellStyleCache(),this.scenegraph.createSceneGraph(),this.stateManager.updateHoverPos(i.col,i.row),this.internalProps.title&&!this.internalProps.title.isReleased&&(this._updateSize(),this.internalProps.title.resize(),this.scenegraph.resize()),this.render()}setRecordChildren(t,e,i){const r=this.getCellOriginRecord(e,i);r.children=t;const n=this.getRecordShowIndexByCell(e,i);this.dataSource.setRecord(r,n),this._refreshHierarchyState(e,i)}startEditCell(t,e){if(Y(t)&&Y(e))this.selectCell(t,e),this.editorManager.startEditCell(t,e);else if(this.stateManager.select?.cellPos){const{col:t,row:e}=this.stateManager.select.cellPos;Y(t)&&Y(e)&&this.editorManager.startEditCell(t,e)}}completeEditCell(){this.editorManager.completeEdit()}getEditor(t,e){const i=this.getBodyColumnDefine(t,e);let r=this.isHeader(t,e)?i?.headerEditor??this.options.headerEditor:i?.editor??this.options.editor;if("function"==typeof r){r=r({col:t,row:e,dataValue:this.getCellOriginValue(t,e),value:this.getCellValue(t,e)||"",table:this})}return"string"==typeof r?jR(r):r}changeCellValue(t,e,i){const r=this.getRecordShowIndexByCell(t,e),{field:n}=this.internalProps.layoutMap.getBody(t,e),o=this.getCellRawValue(t,e);this.isHeader(t,e)?this.internalProps.layoutMap.updateColumnTitle(t,e,i):this.dataSource.changeFieldValue(i,r,n,t,e,this);const s=this.getCellRange(t,e);for(let t=s.start.col;t<=s.end.col;t++)for(let e=s.start.row;e<=s.end.row;e++)this.scenegraph.updateCellContent(t,e);if("adaptive"===this.widthMode||this.autoFillWidth&&this.getAllColsWidth()<=this.tableNoFrameWidth)0===this.internalProps._widthResizedColMap.size&&this.scenegraph.recalculateColWidths();else if(!this.internalProps._widthResizedColMap.has(t)){const e=this.getColWidth(t),i=qB(t,0,this.rowCount-1,this,!1);i!==e&&this.scenegraph.updateColWidth(t,i-e)}if("adaptive"===this.heightMode||this.autoFillHeight&&this.getAllRowsHeight()<=this.tableNoFrameHeight)this.scenegraph.recalculateRowHeights();else if("autoHeight"===this.heightMode){const t=this.getRowHeight(e),i=JA(e,0,this.colCount-1,this);this.scenegraph.updateRowHeight(e,i-t)}this.fireListeners(ov.CHANGE_CELL_VALUE,{col:t,row:e,rawValue:o,changedValue:this.getCellOriginValue(t,e)}),this.scenegraph.updateNextFrame()}changeCellValues(t,e,i){let r=t,n=e;for(let o=0;o<i.length&&!(n>=this.rowCount-1);o++){n=e+o;const s=i[o];let a=t;for(let i=0;i<s.length&&!(a>=this.colCount-1);i++){a=t+i;const r=s[i],n=this.getRecordShowIndexByCell(t+i,e+o),{field:l}=this.internalProps.layoutMap.getBody(t+i,e+o),h=this.getCellRawValue(t+i,e+o);this.isHeader(t+i,e+o)?this.internalProps.layoutMap.updateColumnTitle(t+i,e+o,r):this.dataSource.changeFieldValue(r,n,l,t+i,e+o,this),this.fireListeners(ov.CHANGE_CELL_VALUE,{col:t,row:e,rawValue:h,changedValue:this.getCellOriginValue(t+i,e+o)})}r=Math.max(r,a)}const o=this.getCellRange(t,e),s=this.getCellRange(r,n);for(let t=o.start.col;t<=s.end.col;t++)for(let e=o.start.row;e<=s.end.row;e++)this.scenegraph.updateCellContent(t,e);if("adaptive"===this.widthMode||this.autoFillWidth&&this.getAllColsWidth()<=this.tableNoFrameWidth)0===this.internalProps._widthResizedColMap.size&&this.scenegraph.recalculateColWidths();else for(let e=t;e<=s.end.col;e++)if(!this.internalProps._widthResizedColMap.has(e)){const t=this.getColWidth(e),i=qB(e,0,this.rowCount-1,this,!1);i!==t&&this.scenegraph.updateColWidth(e,i-t)}if("adaptive"===this.heightMode||this.autoFillHeight&&this.getAllRowsHeight()<=this.tableNoFrameHeight)this.scenegraph.recalculateRowHeights();else if("autoHeight"===this.heightMode){const t=[],i=[];for(let r=e;r<=s.end.row;r++)if(this.rowHeightsMap.get(r)){const e=this.getRowHeight(r),n=JA(r,0,this.colCount-1,this);t.push(r),i.push(n-e)}this.scenegraph.updateRowsHeight(t,i)}this.scenegraph.updateNextFrame()}addRecord(t,e){if(this.sortState)this.dataSource.addRecordForSorted(t),DS(this),this.refreshRowColCount(),this.scenegraph.clearCells(),this.scenegraph.createSceneGraph();else{(void 0===e||e>this.dataSource.sourceLength)&&(e=this.dataSource.sourceLength);const i=this.transpose?this.rowHeaderLevelCount:this.columnHeaderLevelCount;this.dataSource.addRecord(t,e);const r=this.rowCount;this.refreshRowColCount();const n=this.transpose?this.colCount:this.rowCount;if(this.pagination){const{perPageCount:t,currentPage:o}=this.pagination,s=t*(o||0)+t;if(e<s)if(e<s-t)this.scenegraph.clearCells(),this.scenegraph.createSceneGraph();else{const o=e-(s-t)+i;if(r-i===this.pagination.perPageCount){const t=[];for(let e=o;e<n;e++)this.transpose?t.push({col:e,row:0}):t.push({col:0,row:e});this.transpose?this.scenegraph.updateCol([],[],t):this.scenegraph.updateRow([],[],t)}else{const t=[];for(let e=o;e<Math.min(n,o+1);e++)this.transpose?t.push({col:e,row:0}):t.push({col:0,row:e});this.transpose?this.scenegraph.updateCol([],t,[]):this.scenegraph.updateRow([],t,[])}}}else{const t=[];for(let r=e+i;r<e+i+1;r++)this.transpose?t.push({col:r,row:0}):t.push({col:0,row:r});this.transpose?this.scenegraph.updateCol([],t,[]):this.scenegraph.updateRow([],t,[])}}}addRecords(t,e){if(this.sortState)this.dataSource.addRecordsForSorted(t),DS(this),this.refreshRowColCount(),this.scenegraph.clearCells(),this.scenegraph.createSceneGraph();else{void 0===e||e>this.dataSource.sourceLength?e=this.dataSource.sourceLength:e<0&&(e=0);const i=this.transpose?this.rowHeaderLevelCount:this.columnHeaderLevelCount;this.dataSource.addRecords(t,e);const r=this.transpose?this.colCount:this.rowCount;this.refreshRowColCount();const n=this.transpose?this.colCount:this.rowCount;if(this.pagination){const{perPageCount:o,currentPage:s}=this.pagination,a=o*(s||0)+o;if(e<a)if(e<a-o)this.scenegraph.clearCells(),this.scenegraph.createSceneGraph();else{const s=e-(a-o)+i;if(r-i===this.pagination.perPageCount){const t=[];for(let e=s;e<n;e++)this.transpose?t.push({col:e,row:0}):t.push({col:0,row:e});this.transpose?this.scenegraph.updateCol([],[],t):this.scenegraph.updateRow([],[],t)}else{const e=[];for(let i=s;i<Math.min(n,s+(Array.isArray(t)?t.length:1));i++)this.transpose?e.push({col:i,row:0}):e.push({col:0,row:i});this.transpose?this.scenegraph.updateCol([],e,[]):this.scenegraph.updateRow([],e,[])}}}else{const r=[];for(let n=e+i;n<e+i+(Array.isArray(t)?t.length:1);n++)this.transpose?r.push({col:n,row:0}):r.push({col:0,row:n});this.transpose?this.scenegraph.updateCol([],r,[]):this.scenegraph.updateRow([],r,[])}}}deleteRecords(t){if(t?.length>0)if(this.sortState)this.dataSource.deleteRecordsForSorted(t),DS(this),this.refreshRowColCount(),this.scenegraph.clearCells(),this.scenegraph.createSceneGraph();else{const e=this.dataSource.deleteRecords(t);if(0===e.length)return;const i=this.transpose?this.colCount:this.rowCount;this.refreshRowColCount();const r=this.transpose?this.colCount:this.rowCount,n=e.sort(((t,e)=>t-e)),o=n[0];if(this.pagination){const{perPageCount:t,currentPage:e}=this.pagination,n=t*(e||0)+t;if(o<n)if(o<n-t)this.scenegraph.clearCells(),this.scenegraph.createSceneGraph();else{const e=[],s=[];for(let i=o-(n-t)+(this.transpose?this.rowHeaderLevelCount:this.columnHeaderLevelCount);i<r;i++)this.transpose?e.push({col:i,row:0}):e.push({col:0,row:i});if(r<i)for(let t=r;t<i;t++)this.transpose?s.push({col:t,row:0}):s.push({col:0,row:t});this.transpose?this.scenegraph.updateCol(s,[],e):this.scenegraph.updateRow(s,[],e)}}else{const t=[];for(let e=0;e<n.length;e++){const i=n[e]+(this.transpose?this.rowHeaderLevelCount:this.columnHeaderLevelCount);this.transpose?t.push({col:i,row:0}):t.push({col:0,row:i})}this.transpose?this.scenegraph.updateCol(t,[],[]):this.scenegraph.updateRow(t,[],[])}}}hasCustomRenderOrLayout(){const{headerObjects:t}=this.internalProps.layoutMap;if(this.options.customRender)return!0;for(let e=0;e<t.length;e++){const i=t[e];if(i?.define?.customLayout||i?.define?.headerCustomLayout||i?.define?.customRender||i?.define?.headerCustomRender)return!0}return!1}},t.PivotChart=class extends WR{pivotSortState;dataset;_selectedDataItemsInChart=[];_selectedDimensionInChart=[];_chartEventMap={};_axes;constructor(t,e){"node"===CC.mode?(e=t,t=null):t instanceof HTMLElement||(e=t,t=t.container?t.container:null),super(t,e),e.layout&&Object.assign(e,e.layout),this.internalProps.columns=bt(e.columns),this.internalProps.rows=bt(e.rows),this.internalProps.indicators=bt(e.indicators),this.internalProps.columnTree=!e.indicatorsAsCol||e.columns?.length||e.columnTree?bt(e.columnTree):[],this.internalProps.rowTree=e.indicatorsAsCol||e.rows?.length||e.rowTree?bt(e.rowTree):[],this.internalProps.records=e.records,this.setCustomStateNameToSpec(),this.internalProps.columnResizeType=e.columnResizeType??"column",this.internalProps.dataConfig={isPivotChart:!0},this._axes=it(e.axes)?e.axes:[];const i=e.rows?.reduce(((t,e)=>("string"==typeof e?t.push(e):t.push(e.dimensionKey),t)),[])??[],r=e.columns?.reduce(((t,e)=>("string"==typeof e?t.push(e):t.push(e.dimensionKey),t)),[])??[],n=e.indicators?.reduce(((t,e)=>("string"==typeof e?t.push(e):t.push(e.indicatorKey),t)),[])??[];this.internalProps.dataConfig.collectValuesBy=this._generateCollectValuesConfig(r,i),this.internalProps.dataConfig.aggregationRules=this._generateAggregationRules(),this.internalProps.dataConfig.dimensionSortArray=this._getDimensionSortArray(),this.dataset=new vP(this.internalProps.dataConfig,i,r,n,this.internalProps.indicators,e.indicatorsAsCol??!0,e.records,void 0,this.internalProps.columnTree,this.internalProps.rowTree,!0),this.internalProps.layoutMap=new aP(this,this.dataset),this.refreshHeader(),this.scenegraph.createSceneGraph(),e.title&&(this.internalProps.title=new QR(e.title,this),this.scenegraph.resize()),setTimeout((()=>{this.fireListeners(ov.INITIALIZED,null)}),0)}static get EVENT_TYPE(){return fM}get pivotChartAxes(){return this._axes}isListTable(){return!1}isPivotTable(){return!0}isPivotChart(){return!0}_canResizeColumn(t,e){const i=super._canResizeColumn(t,e);if(i&&!this.internalProps.layoutMap.indicatorsAsCol){const e=this.internalProps.layoutMap.getBody(t,this.columnHeaderLevelCount);if(e?.disableColumnResize)return!1}return i}updateOption(t,e=!1){const i=this.internalProps;super.updateOption(t),this.internalProps.columns=bt(t.columns),this.internalProps.rows=bt(t.rows),this.internalProps.indicators=t.indicators?.length?bt(t.indicators):[],this.internalProps.columnTree=!t.indicatorsAsCol||t.columns?.length||t.columnTree?bt(t.columnTree):[],this.internalProps.rowTree=t.indicatorsAsCol||t.rows?.length||t.rowTree?bt(t.rowTree):[],t.records&&(this.internalProps.records=t.records),this.setCustomStateNameToSpec(),this._selectedDataItemsInChart=[],i.columnResizeType=t.columnResizeType??"column",i.dataConfig={isPivotChart:!0},this._axes=it(t.axes)?t.axes:[];const r=t.rows?.reduce(((t,e)=>("string"==typeof e?t.push(e):t.push(e.dimensionKey),t)),[])??[],n=t.columns?.reduce(((t,e)=>("string"==typeof e?t.push(e):t.push(e.dimensionKey),t)),[])??[],o=t.indicators?.reduce(((t,e)=>("string"==typeof e?t.push(e):t.push(e.indicatorKey),t)),[])??[];return this.internalProps.dataConfig.collectValuesBy=this._generateCollectValuesConfig(n,r),this.internalProps.dataConfig.aggregationRules=this._generateAggregationRules(),this.internalProps.dataConfig.dimensionSortArray=this._getDimensionSortArray(),this.dataset=new vP(this.internalProps.dataConfig,r,n,o,this.internalProps.indicators,t.indicatorsAsCol??!0,t.records??this.internalProps.records,void 0,this.internalProps.columnTree,this.internalProps.rowTree,!0),i.layoutMap=new aP(this,this.dataset),this.refreshHeader(),i.releaseList&&(i.releaseList.forEach((t=>t?.release?.())),i.releaseList=null),this.scenegraph.clearCells(),this.scenegraph.createSceneGraph(),t.title&&(this.internalProps.title=new QR(t.title,this),this.scenegraph.resize()),new Promise((t=>{setTimeout(t,0)}))}updatePagination(){}refreshHeader(){const t=this.internalProps;for(let e=0;e<t.layoutMap.columnWidths.length;e++){const{width:i,minWidth:r,maxWidth:n}=t.layoutMap.columnWidths?.[e]??{};i&&("string"==typeof i&&"auto"!==i||"number"==typeof i&&i>0)&&this._setColWidth(e,i),r&&("number"==typeof r&&r>0||"string"==typeof r)&&this.setMinColWidth(e,r),n&&("number"==typeof n&&n>0||"string"==typeof n)&&this.setMaxColWidth(e,n)}this.refreshRowColCount()}refreshRowColCount(){const t=this,{layoutMap:e}=t.internalProps;e&&(t.colCount=e.colCount??0,t.rowCount=e.rowCount??0,t.internalProps.frozenColCount=e.rowHeaderLevelCount??0,t.frozenRowCount=e.headerLevelCount,t.bottomFrozenRowCount!==(e?.bottomFrozenRowCount??0)&&(t.bottomFrozenRowCount=e?.bottomFrozenRowCount??0),t.rightFrozenColCount!==(e?.rightFrozenColCount??0)&&(t.rightFrozenColCount=e?.rightFrozenColCount??0),this.stateManager.setFrozenCol(this.internalProps.frozenColCount))}_getSortFuncFromHeaderOption(t,e,i){}syncHierarchyState(t,e){t.value===e.value&&t.dimensionKey===e.dimensionKey&&(e.hierarchyState=e.hierarchyState??(e?.children?t.hierarchyState:void 0),e?.children?.forEach(((e,i)=>{t?.children?.[i]&&e&&this.syncHierarchyState(t.children[i],e)})))}getRecordShowIndexByCell(t,e){}getTableIndexByRecordIndex(t){}getTableIndexByField(t){}getCellAddrByFieldRecord(t,e){}getBodyIndexByRow(t){const{layoutMap:e}=this.internalProps;return e.getBodyIndexByRow(t)}getBodyIndexByCol(t){const{layoutMap:e}=this.internalProps;return e.getBodyIndexByCol(t)}getCellValue(t,e){const i=this.getCustomMergeValue(t,e);if(i)return i;if(this.internalProps.layoutMap.isHeader(t,e)){const{title:i,fieldFormat:r}=this.internalProps.layoutMap.getHeader(t,e);return"function"==typeof r?r(i,t,e,this):i}if(this.dataset){const i=this.internalProps.layoutMap.getCellHeaderPaths(t,e),r=i.colHeaderPaths.map((t=>t.indicatorKey??t.value)),n=i.rowHeaderPaths.map((t=>t.indicatorKey??t.value)),o=this.dataset.getAggregator(this.internalProps.layoutMap.indicatorsAsCol?n:n.slice(0,-1),this.internalProps.layoutMap.indicatorsAsCol?r.slice(0,-1):r,this.internalProps.layoutMap.getIndicatorKey(t,e));return o.value?o.value():void 0}const{fieldFormat:r}=this.internalProps.layoutMap.getBody(t,e),n=this.getBodyIndexByRow(e),o=this.getBodyIndexByCol(t),s=this.records[n]?.[o];if("function"==typeof r){return r(s,t,e,this)}return s}getCellOriginValue(t,e){const i=this;if(i.internalProps.layoutMap.isHeader(t,e)){const{title:r}=i.internalProps.layoutMap.getHeader(t,e);return"function"==typeof r?r():r}if(this.dataset){const i=this.internalProps.layoutMap.getCellHeaderPaths(t,e),r=i.colHeaderPaths.map((t=>t.indicatorKey??t.value)),n=i.rowHeaderPaths.map((t=>t.indicatorKey??t.value)),o=this.dataset.getAggregator(this.internalProps.layoutMap.indicatorsAsCol?n:n.slice(0,-1),this.internalProps.layoutMap.indicatorsAsCol?r.slice(0,-1):r,this.internalProps.layoutMap.getIndicatorKey(t,e));return o.value?o.value():void 0}const r=this.getBodyIndexByRow(e),n=this.getBodyIndexByCol(t),o=this.records[r]?.[n];return o}getCellRawValue(t,e){return this.getCellOriginValue(t,e)}getCellOriginRecord(t,e){if(!this.internalProps.layoutMap.isHeader(t,e)&&this.dataset){const i=this.internalProps.layoutMap.getCellHeaderPaths(t,e),r=i.colHeaderPaths.map((t=>t.indicatorKey??t.value)),n=i.rowHeaderPaths.map((t=>t.indicatorKey??t.value));return this.dataset.getAggregator(this.internalProps.layoutMap.indicatorsAsCol?n:n.slice(0,-1),this.internalProps.layoutMap.indicatorsAsCol?r.slice(0,-1):r,this.internalProps.layoutMap.getIndicatorKey(t,e)).records}}getCellRawRecord(t,e){return this.getCellOriginRecord(t,e)}updateSortRules(t){this.internalProps.dataConfig.sortRules=t,this.dataset.updateSortRules(t),this.internalProps.layoutMap.updateDataset(this.dataset),this.render()}updatePivotSortState(t){for(let e=0;e<t.length;e++){const{dimensions:i,order:r}=t[e],n=this.internalProps.layoutMap.getPivotCellAdress(i);n&&this.pivotSortState.push({col:n.col,row:n.row,order:r})}}getPivotSortState(t,e){if(!this.pivotSortState)return;const i=this.getCellRange(t,e);for(let t=0;t<this.pivotSortState.length;t++){const{col:e,row:r,order:n}=this.pivotSortState[t];if(qC(i,e,r))return n}}moveHeaderPosition(t,e){const i=this.internalProps.layoutMap.moveHeaderPosition(t,e);if(i){if("column"===i.moveType){if(this.options.records?.[0]?.constructor===Array)for(let t=0;t<this.internalProps.records.length;t++){const e=this.internalProps.records[t].splice(i.sourceIndex-this.rowHeaderLevelCount,i.moveSize);e.unshift(i.targetIndex-this.rowHeaderLevelCount,0),Array.prototype.splice.apply(this.internalProps.records[t],e)}this.colWidthsMap.adjustOrder(i.sourceIndex,i.targetIndex,i.moveSize);for(let t=0;t<this.internalProps.layoutMap.columnWidths.length;t++){const{minWidth:e,maxWidth:i}=this.internalProps.layoutMap.columnWidths?.[t]??{};e&&("number"==typeof e&&e>0||"string"==typeof e)&&this.setMinColWidth(t,e),i&&("number"==typeof i&&i>0||"string"==typeof i)&&this.setMaxColWidth(t,i)}}else if("row"===i.moveType){if(this.options.records?.[0]?.constructor===Array){const t=this.internalProps.records.splice(i.sourceIndex-this.columnHeaderLevelCount,i.moveSize);t.unshift(i.targetIndex-this.columnHeaderLevelCount,0),Array.prototype.splice.apply(this.internalProps.records,t)}this.rowHeightsMap.adjustOrder(i.sourceIndex,i.targetIndex,i.moveSize)}return!0}return!1}toggleHierarchyState(t,e){const i=this.getHierarchyState(t,e);i===qy.expand?this.fireListeners(fM.TREE_HIERARCHY_STATE_CHANGE,{col:t,row:e,hierarchyState:qy.collapse}):i===qy.collapse&&this.fireListeners(fM.TREE_HIERARCHY_STATE_CHANGE,{col:t,row:e,hierarchyState:qy.expand,originData:this.getCellOriginRecord(t,e)});const r=this.internalProps.layoutMap.toggleHierarchyState(t,e);this.refreshRowColCount(),this.clearCellStyleCache(),this.scenegraph.updateHierarchyIcon(t,e),this.scenegraph.updateRow(r.removeCellPositions,r.addCellPositions)}getHeaderCellAddressByPath(t){return this.internalProps.layoutMap.getPivotCellAdress(t)}getCellAddressByHeaderPaths(t){return this.internalProps.layoutMap.getCellAdressByHeaderPath(t)}getHeaderPathByXY(t){let e;e=t?this.getCellAt(t.x+this.getFrozenColsWidth()+this.scrollLeft+1,t.y+this.getFrozenRowsHeight()+this.scrollTop+1):this.getCellAt(this.getFrozenColsWidth()+this.scrollLeft+1,this.getFrozenRowsHeight()+this.scrollTop+1);return this.internalProps.layoutMap.getCellHeaderPaths(e.col,e.row)}getHierarchyState(t,e){return this._getHeaderLayoutMap(t,e)?.hierarchyState}_hasHierarchyTreeHeader(){return"tree"===this.internalProps.layoutMap.rowHierarchyType}getMenuInfo(t,e,i){const r=this.internalProps.layoutMap.getPivotDimensionInfo(t,e);return{dimensionKey:r[r.length-1].dimensionKey,value:this.getCellValue(t,e),cellLocation:this.getCellLocation(t,e),isPivotCorner:this.isCornerHeader(t,e)}}_generateCollectValuesConfig(t,e){const i=this.internalProps.indicators,r={};for(let n=0,o=i?.length;n<o;n++)if("string"!=typeof i[n]&&i[n].chartSpec)if(!1===this.options.indicatorsAsCol){const o=i[n];if(!1!==o.chartSpec?.stack&&("bar"===o.chartSpec?.type||"area"===o.chartSpec?.type)&&(o.chartSpec.stack=!0),r[o.indicatorKey]={by:e,range:!0,sumBy:o.chartSpec?.stack&&t.concat(o.chartSpec?.xField)},o.chartSpec.series)o.chartSpec.series.forEach((i=>{const n="string"==typeof i.xField?i.xField:i.xField[0];r[n]={by:t,type:"horizontal"!==i.direction?"xField":void 0,range:"horizontal"===i.direction,sortBy:"horizontal"!==i.direction?i?.data?.fields?.[n]?.domain??o.chartSpec?.data?.fields?.[n]?.domain:void 0};const s=i.yField;!1!==i.stack&&("bar"===i.type||"area"===i.type)&&(i.stack=!0),r[s]={by:e,range:"horizontal"!==i.direction,sumBy:i.stack&&t.concat(i?.xField),sortBy:"horizontal"===i.direction?i?.data?.fields?.[s]?.domain??o.chartSpec?.data?.fields?.[s]?.domain:void 0}}));else{const s="string"==typeof o.chartSpec.xField?o.chartSpec.xField:o.chartSpec.xField[0];r[s]={by:t,type:"horizontal"!==o.chartSpec.direction?"xField":void 0,range:"horizontal"===o.chartSpec.direction,sortBy:"horizontal"!==o.chartSpec.direction?o.chartSpec?.data?.fields?.[s]?.domain:void 0},!1!==o.chartSpec?.stack&&("bar"===o.chartSpec?.type||"area"===o.chartSpec?.type)&&(o.chartSpec.stack=!0);const a=o.chartSpec.yField;r[a]={by:e,range:"horizontal"!==i[n].chartSpec.direction,sumBy:o.chartSpec.stack&&t.concat(o.chartSpec?.xField),sortBy:"horizontal"===o.chartSpec.direction?o.chartSpec?.data?.fields?.[a]?.domain:void 0}}}else{const o=i[n];if(!1!==o.chartSpec?.stack&&("bar"===o.chartSpec?.type||"area"===o.chartSpec?.type)&&(o.chartSpec.stack=!0),r[o.indicatorKey]={by:t,range:!0,sumBy:o.chartSpec?.stack&&e.concat(o.chartSpec?.yField)},o.chartSpec.series)o.chartSpec.series.forEach((i=>{const n="string"==typeof i.yField?i.yField:i.yField[0];r[n]={by:e,type:"horizontal"===i.direction?"yField":void 0,range:"horizontal"!==i.direction,sortBy:"horizontal"===i.direction?i?.data?.fields?.[n]?.domain??o.chartSpec?.data?.fields?.[n]?.domain:void 0};const s=i.xField;!1!==i.stack&&("bar"===i.type||"area"===i.type)&&(i.stack=!0),r[s]={by:t,range:"horizontal"===i.direction,sumBy:i.stack&&e.concat(i?.yField),sortBy:"horizontal"!==i.direction?i?.data?.fields?.[s]?.domain??o.chartSpec?.data?.fields?.[s]?.domain:void 0}}));else{const s="string"==typeof o.chartSpec.yField?o.chartSpec.yField:o.chartSpec.yField[0];r[s]={by:e,type:"horizontal"===o.chartSpec.direction?"yField":void 0,range:"horizontal"!==o.chartSpec.direction,sortBy:"horizontal"===o.chartSpec.direction?o.chartSpec?.data?.fields?.[s]?.domain:void 0},!1!==o.chartSpec?.stack&&("bar"===o.chartSpec?.type||"area"===o.chartSpec?.type)&&(o.chartSpec.stack=!0);const a=o.chartSpec.xField;r[a]={by:t,range:"horizontal"===i[n].chartSpec.direction,sumBy:o.chartSpec.stack&&e.concat(o.chartSpec?.yField),sortBy:"horizontal"!==o.chartSpec.direction?o.chartSpec?.data?.fields?.[a]?.domain:void 0}}}return r}_generateAggregationRules(){const t=[];return this.internalProps.indicators?.forEach((e=>{if("string"==typeof e)t.push({indicatorKey:e,field:e,aggregationType:Zy.RECORD});else if(e.chartSpec?.series){const i=[];e.chartSpec?.series.forEach((t=>{const e=!1===this.options.indicatorsAsCol?t.yField:t.xField;-1===i.indexOf(e)&&i.push(e)})),t.push({indicatorKey:e.indicatorKey,field:i,aggregationType:Zy.RECORD})}else{const i=!1===this.options.indicatorsAsCol?e.chartSpec.yField:e.chartSpec.xField;t.push({indicatorKey:e.indicatorKey,field:i??e.indicatorKey,aggregationType:Zy.RECORD})}})),t}setCustomStateNameToSpec(){const t=t=>{t.bar?.state?.selected&&(t.bar.state.vtable_selected=t.bar.state.selected,t.bar.state.vtable_selected_reverse=t.bar.state.selected_reverse,delete t.bar.state.selected,delete t.bar.state.selected_reverse),t.point?.state?.selected&&(t.point.state.vtable_selected=t.point.state.selected,t.point.state.vtable_selected_reverse=t.point.state.selected_reverse,delete t.point.state.selected,delete t.point.state.selected_reverse),t.line?.state?.selected&&(t.line.state.vtable_selected=t.line.state.selected,t.line.state.vtable_selected_reverse=t.line.state.selected_reverse,delete t.line.state.selected,delete t.line.state.selected_reverse),t.area?.state?.selected&&(t.area.state.vtable_selected=t.area.state.selected,t.area.state.vtable_selected_reverse=t.area.state.selected_reverse,delete t.area.state.selected,delete t.area.state.selected_reverse)};this.internalProps.indicators?.forEach((e=>{if(e.chartSpec){const i=e.chartSpec;i.series?i.series.forEach((e=>{t(e)})):t(i)}}))}updateFilterRules(t){this.internalProps.dataConfig.filterRules=t,this.dataset.updateFilterRules(t),NT(this.scenegraph),function(t){const e=t.table;for(let i=t.proxy.colStart;i<=t.proxy.colEnd;i++){const r=t.getColGroup(i);r?.getChildren()?.forEach((t=>{const i=t.col,r=t.row;t.children.forEach((t=>{if("chart"===t.type){t.updateData(e.getCellValue(i,r));const n=e.internalProps.layoutMap.getChartAxes(i,r);t.setAttribute("axes",n);const o=t.attribute.spec;o.axes=n,t.setAttribute("spec",o)}}))}))}GT(t.rowHeaderGroup,t.table),GT(t.colHeaderGroup,t.table),GT(t.rightFrozenGroup,t.table),GT(t.bottomFrozenGroup,t.table)}(this.scenegraph),this.render()}getLegendSelected(){return this.internalProps.legends.legendComponent._getSelectedLegends().map((t=>t.label))}setLegendSelected(t){this.internalProps.legends.legendComponent.setSelected(t)}getChartDatumPosition(t,e){const{chartInstance:i,bounds:r}=this.getChartInstance(e);if(i){const e=i.convertDatumToPosition(t);return e?{x:Math.round(e.x+r.x1),y:Math.round(e.y+r.y1)}:null}return null}getCellAddressByRecord(t){const e=[],i=[],r={},n=[];this.dataset.dataConfig.aggregationRules.forEach((t=>{if("string"==typeof t.field)r[t.field]=t.indicatorKey,n.push(t.field);else for(let e=0;e<t.field.length;e++)r[t.field[e]]=t.indicatorKey,n.push(t.field[e])}));for(const o in t)this.dataset.rows.indexOf(o)>=0&&e.push({dimensionKey:o,value:t[o]}),this.dataset.columns.indexOf(o)>=0&&i.push({dimensionKey:o,value:t[o]}),n.indexOf(o)>=0&&(this.dataset.indicatorsAsCol?i.push({indicatorKey:r[o]}):e.push({indicatorKey:r[o]}));return this.getCellAddressByHeaderPaths({rowHeaderPaths:e,colHeaderPaths:i,cellLocation:"body"})}getChartInstance(t){const e=this.getCellAddressByHeaderPaths(t);if(e){const t=this.getCellRelativeRect(e.col,e.row),i=this.scenegraph.getCell(e.col,e.row);let r;const n=i?.getChildren()?.[0];if(n.attribute.chartInstance){r=n.attribute.chartInstance;const{dataId:t,data:e,axes:i,spec:o}=n.attribute,s=n.getViewBox();if(i.forEach(((t,e)=>{"linear"===t.type?r.updateModelSpecSync({type:"axes",index:e},{min:t.range?.min??0,max:t.range?.max??0},!0):"band"===t.type&&r.updateModelSpec({type:"axes",index:e},{domain:t.domain.slice(0)},!0)})),r.updateViewBox({x1:s.x1-n.getRootNode().table.scrollLeft,x2:s.x2-n.getRootNode().table.scrollLeft,y1:s.y1-n.getRootNode().table.scrollTop,y2:s.y2-n.getRootNode().table.scrollTop},!1,!1),"string"==typeof t)r.updateDataSync(t,e??[]);else{const i=[];for(const n in t){const s=t[n],a=o.series.find((t=>t?.data?.id===n));i.push({id:n,values:s?e?.filter((t=>t.hasOwnProperty(s)))??[]:e??[],fields:a?.data?.fields}),r.updateFullDataSync||r.updateDataSync(n,s?e?.filter((t=>t.hasOwnProperty(s)))??[]:e??[])}r.updateFullDataSync?.(i)}this.renderAsync()}return{chartInstance:r,bounds:t.bounds}}return{}}_getDimensionSortArray(){if(this.options?.axes?.length){const t=this.options.indicatorsAsCol?"left":"bottom",e=this.options.axes.find((e=>e.orient===t));if(e&&it(e.domain))return e.domain}}setRecords(t){const e={col:this.stateManager.hover.cellPos.col,row:this.stateManager.hover.cellPos.row};this.options.records=this.internalProps.records=t,this.options;const i=this.internalProps;this.dataset.setRecords(t),i.layoutMap=new aP(this,this.dataset),this.refreshHeader(),this.scenegraph.clearCells(),this.clearCellStyleCache(),this.scenegraph.createSceneGraph(),this.stateManager.updateHoverPos(e.col,e.row),this.internalProps.title&&!this.internalProps.title.isReleased&&(this._updateSize(),this.internalProps.title.resize(),this.scenegraph.resize()),this.eventManager.updateEventBinder()}hasCustomRenderOrLayout(){if(this.options.customRender)return!0;const{columnsDefine:t,rowsDefine:e,indicatorsDefine:i}=this.internalProps.layoutMap;for(let e=0;e<t.length;e++){const i=t[e];if("string"!=typeof i&&(i.headerCustomLayout||i.headerCustomRender))return!0}for(let t=0;t<e.length;t++){const i=e[t];if("string"!=typeof i&&(i.headerCustomLayout||i.headerCustomRender))return!0}for(let t=0;t<i.length;t++){const e=i[t];if("string"!=typeof e&&(e.customLayout||e.headerCustomLayout||e.customRender||e.headerCustomRender))return!0}return!1}},t.PivotTable=class extends WR{pivotSortState;editorManager;dataset;flatDataToObjects;constructor(t,e){"node"===CC.mode?(e=t,t=null):t instanceof HTMLElement||(e=t,t=t.container?t.container:null),super(t,e),e.layout&&Object.assign(e,e.layout),this.internalProps.columns=bt(e.columns),this.internalProps.rows=bt(e.rows),this.internalProps.indicators=bt(e.indicators),e.indicators?.forEach(((t,e)=>{"object"==typeof t&&t?.editor&&(this.internalProps.indicators[e].editor=t.editor)})),this.internalProps.columnTree=!e.indicatorsAsCol||e.columns?.length||e.columnTree?bt(e.columnTree):[],this.internalProps.rowTree=e.indicatorsAsCol||e.rows?.length||e.rowTree?bt(e.rowTree):[],this.internalProps.records=e.records,this.pagination=e.pagination,this.internalProps.columnResizeType=e.columnResizeType??"column",this.internalProps.dataConfig=bt(e.dataConfig),this.internalProps.enableDataAnalysis=e.enableDataAnalysis,e.rowTree||e.columnTree||(this.internalProps.enableDataAnalysis=!0);const i=this.internalProps.records;if(this.internalProps.enableDataAnalysis&&(e.rows||e.columns)){const t=e.rows?.reduce(((t,e)=>("string"==typeof e?t.push(e):t.push(e.dimensionKey),t)),[])??[],i=e.columns?.reduce(((t,e)=>("string"==typeof e?t.push(e):t.push(e.dimensionKey),t)),[])??[],r=e.indicators?.reduce(((t,e)=>("string"==typeof e?t.push(e):t.push(e.indicatorKey),t)),[])??[];this.dataset=new vP(this.internalProps.dataConfig,t,i,r,this.internalProps.indicators,e.indicatorsAsCol??!0,e.records,e.rowHierarchyType,this.internalProps.columnTree,this.internalProps.rowTree),this.internalProps.layoutMap=new aP(this,this.dataset)}else{if(!Array.isArray(this.internalProps.columnTree)&&!Array.isArray(this.internalProps.rowTree))return;this.internalProps.layoutMap=new aP(this,null),i?.[0]?.constructor!==Array&&(this.flatDataToObjects=new hP({rows:this.internalProps.layoutMap.fullRowDimensionKeys,columns:this.internalProps.layoutMap.colDimensionKeys,indicators:this.internalProps.layoutMap.indicatorKeys,indicatorsAsCol:this.internalProps.layoutMap.indicatorsAsCol,indicatorDimensionKey:this.internalProps.layoutMap.indicatorDimensionKey},i))}this.pivotSortState=[],e.pivotSortState&&this.updatePivotSortState(e.pivotSortState),"node"!==CC.mode&&(this.editorManager=new tP(this)),this.refreshHeader(),this.stateManager.initCheckedState(i),this.scenegraph.createSceneGraph(),e.title&&(this.internalProps.title=new QR(e.title,this),this.scenegraph.resize()),setTimeout((()=>{this.fireListeners(ov.INITIALIZED,null)}),0)}static get EVENT_TYPE(){return pM}isListTable(){return!1}isPivotTable(){return!0}isPivotChart(){return!1}_canResizeColumn(t,e){const i=super._canResizeColumn(t,e);if(i&&!this.internalProps.layoutMap.indicatorsAsCol){const e=this.internalProps.layoutMap.getBody(t,this.columnHeaderLevelCount);if(e?.disableColumnResize)return!1}return i}updateOption(t,e=!1){const i=this.internalProps;if(super.updateOption(t),this.internalProps.columns=bt(t.columns),this.internalProps.rows=bt(t.rows),this.internalProps.indicators=t.indicators?.length?bt(t.indicators):[],t.indicators?.forEach(((t,e)=>{"object"==typeof t&&t?.editor&&(this.internalProps.indicators[e].editor=t.editor)})),this.internalProps.columnTree=!t.indicatorsAsCol||t.columns?.length||t.columnTree?bt(t.columnTree):[],this.internalProps.rowTree=t.indicatorsAsCol||t.rows?.length||t.rowTree?bt(t.rowTree):[],t.records&&(this.internalProps.records=t.records),this.stateManager.initCheckedState(this.internalProps.records),this.pagination=t.pagination,i.columnResizeType=t.columnResizeType??"column",i.dataConfig=bt(t.dataConfig),i.enableDataAnalysis=t.enableDataAnalysis,t.rowTree||t.columnTree||(i.enableDataAnalysis=!0),"tree"===t?.rowHierarchyType&&"tree"===this.internalProps.layoutMap.rowHierarchyType&&this.internalProps.layoutMap.rowExpandLevel===t?.rowExpandLevel){const t=this.internalProps.layoutMap.rowDimensionTree.tree.children;this.internalProps.rowTree?.forEach(((e,i)=>{const r=t.find((t=>t.dimensionKey===e.dimensionKey&&t.value===e.value));r&&this.syncHierarchyState(r,e)}))}const r=this.internalProps.records;if(this.internalProps.enableDataAnalysis&&(t.rows||t.columns)){const e=t.rows?.reduce(((t,e)=>("string"==typeof e?t.push(e):t.push(e.dimensionKey),t)),[]),r=t.columns?.reduce(((t,e)=>("string"==typeof e?t.push(e):t.push(e.dimensionKey),t)),[]),n=t.indicators?.reduce(((t,e)=>("string"==typeof e?t.push(e):t.push(e.indicatorKey),t)),[]);this.dataset=new vP(i.dataConfig,e,r,n,this.internalProps.indicators,t.indicatorsAsCol??!0,t.records,t.rowHierarchyType,this.internalProps.columnTree,this.internalProps.rowTree),i.layoutMap=new aP(this,this.dataset)}else{if(!Array.isArray(this.internalProps.columnTree)&&!Array.isArray(this.internalProps.rowTree))return this;i.layoutMap=new aP(this,null),r?.[0]?.constructor!==Array&&(this.flatDataToObjects=new hP({rows:i.layoutMap.fullRowDimensionKeys,columns:i.layoutMap.colDimensionKeys,indicators:i.layoutMap.indicatorKeys,indicatorsAsCol:i.layoutMap.indicatorsAsCol,indicatorDimensionKey:i.layoutMap.indicatorDimensionKey},r))}return this.pivotSortState=[],t.pivotSortState&&this.updatePivotSortState(t.pivotSortState),this.refreshHeader(),i.releaseList&&(i.releaseList.forEach((t=>t?.release?.())),i.releaseList=null),this.scenegraph.clearCells(),this.scenegraph.createSceneGraph(),t.title&&(this.internalProps.title=new QR(t.title,this),this.scenegraph.resize()),new Promise((t=>{setTimeout(t,0)}))}updatePagination(t){t?(this.pagination||(this.pagination={currentPage:0,perPageCount:0}),"number"==typeof t.currentPage&&t.currentPage>=0&&(this.pagination.currentPage=t.currentPage),t.perPageCount&&(this.pagination.perPageCount=t.perPageCount||this.pagination.perPageCount),this.scenegraph.clearCells(),this.internalProps.layoutMap.setPagination(this.pagination),this.refreshRowColCount(),this.scenegraph.createSceneGraph(),this.render()):this.pagination&&(this.pagination=void 0,this.scenegraph.clearCells(),this.internalProps.layoutMap.setPagination(void 0),this.refreshRowColCount(),this.scenegraph.createSceneGraph(),this.render())}refreshHeader(){const t=this.internalProps;for(let e=0;e<t.layoutMap.columnWidths.length;e++){const{width:i,minWidth:r,maxWidth:n}=t.layoutMap.columnWidths?.[e]??{};i&&("string"==typeof i&&"auto"!==i||"number"==typeof i&&i>0)&&this._setColWidth(e,i),r&&("number"==typeof r&&r>0||"string"==typeof r)&&this.setMinColWidth(e,r),n&&("number"==typeof n&&n>0||"string"==typeof n)&&this.setMaxColWidth(e,n)}this.refreshRowColCount()}refreshRowColCount(){const t=this,{layoutMap:e}=t.internalProps;e&&(t.colCount=e.colCount??0,t.rowCount=e.rowCount??0,t.internalProps.frozenColCount=e.rowHeaderLevelCount??0,t.frozenRowCount=e.headerLevelCount,t.bottomFrozenRowCount!==(this.options.bottomFrozenRowCount??0)&&(t.bottomFrozenRowCount=this.options.bottomFrozenRowCount??0),t.rightFrozenColCount!==(this.options.rightFrozenColCount??0)&&(t.rightFrozenColCount=this.options.rightFrozenColCount??0),this.stateManager.setFrozenCol(this.internalProps.frozenColCount))}_getSortFuncFromHeaderOption(t,e,i){}get rowHierarchyType(){return this.internalProps.layoutMap.rowHierarchyType}syncHierarchyState(t,e){t.value===e.value&&t.dimensionKey===e.dimensionKey&&(e.hierarchyState=e.hierarchyState??(e?.children?t.hierarchyState:void 0),e?.children?.forEach(((e,i)=>{if(t?.children?.[i]&&e){const i=t.children.find((t=>t.dimensionKey===e.dimensionKey&&t.value===e.value));i&&this.syncHierarchyState(i,e)}})))}getRecordShowIndexByCell(t,e){}getTableIndexByRecordIndex(t){}getTableIndexByField(t){}getCellAddrByFieldRecord(t,e){}getBodyIndexByRow(t){const{layoutMap:e}=this.internalProps;return e.getBodyIndexByRow(t)}getBodyIndexByCol(t){const{layoutMap:e}=this.internalProps;return e.getBodyIndexByCol(t)}getFieldData(t,e,i){if(this.internalProps.layoutMap.isHeader(e,i))return;if(this.dataset){const r=this.internalProps.layoutMap.getCellHeaderPaths(e,i);if(r){const n=r.colHeaderPaths.map((t=>t.indicatorKey??t.value)),o=r.rowHeaderPaths.map((t=>t.indicatorKey??t.value)),s=this.dataset.getAggregator(this.internalProps.layoutMap.indicatorsAsCol?o:o.slice(0,-1),this.internalProps.layoutMap.indicatorsAsCol?n.slice(0,-1):n,this.internalProps.layoutMap.getIndicatorKey(e,i));if(s.records&&s.records.length>=1)return s.records[0][t]}}else if(this.flatDataToObjects){const r=this.internalProps.layoutMap.getCellHeaderPaths(e,i),n=r.colHeaderPaths.map((t=>t.indicatorKey??t.value)),o=r.rowHeaderPaths.map((t=>t.indicatorKey??t.value)),s=this.flatDataToObjects.getTreeNode(o,n,this.internalProps.layoutMap.getBody(e,i).indicatorKey,!1);if(s?.record)return s?.record[t]}const r=this.getBodyIndexByRow(i),n=this.getBodyIndexByCol(e);return this.records[r]?.[n]}getCellValue(t,e){const i=this.getCustomMergeValue(t,e);if(i)return i;if(this.internalProps.layoutMap.isHeader(t,e)){const{title:i,fieldFormat:r}=this.internalProps.layoutMap.getHeader(t,e);return"function"==typeof r?r(i,t,e,this):i}if(this.dataset){const i=this.internalProps.layoutMap.getCellHeaderPaths(t,e),r=i.colHeaderPaths.map((t=>t.indicatorKey??t.value)),n=i.rowHeaderPaths.map((t=>t.indicatorKey??t.value)),o=this.dataset.getAggregator(this.internalProps.layoutMap.indicatorsAsCol?n:n.slice(0,-1),this.internalProps.layoutMap.indicatorsAsCol?r.slice(0,-1):r,this.internalProps.layoutMap.getIndicatorKey(t,e));return o.formatValue?o.formatValue(t,e,this):""}if(this.flatDataToObjects){const i=this.internalProps.layoutMap.getCellHeaderPaths(t,e),r=i.colHeaderPaths.map((t=>t.indicatorKey??t.value)),n=i.rowHeaderPaths.map((t=>t.indicatorKey??t.value)),o=this.flatDataToObjects.getTreeNode(n,r,this.internalProps.layoutMap.getBody(t,e).indicatorKey),{fieldFormat:s}=this.internalProps.layoutMap.getBody(t,e);return"function"==typeof s?s(o?.value,t,e,this):o?.value??""}const{fieldFormat:r}=this.internalProps.layoutMap.getBody(t,e),n=this.getBodyIndexByRow(e),o=this.getBodyIndexByCol(t),s=this.records[n]?.[o];if("function"==typeof r){return r(s,t,e,this)}return s}getCellOriginValue(t,e){const i=this;if(i.internalProps.layoutMap.isHeader(t,e)){const{title:r}=i.internalProps.layoutMap.getHeader(t,e);return"function"==typeof r?r():r}if(this.dataset){const i=this.internalProps.layoutMap.getCellHeaderPaths(t,e),r=i.colHeaderPaths.map((t=>t.indicatorKey??t.value)),n=i.rowHeaderPaths.map((t=>t.indicatorKey??t.value)),o=this.dataset.getAggregator(this.internalProps.layoutMap.indicatorsAsCol?n:n.slice(0,-1),this.internalProps.layoutMap.indicatorsAsCol?r.slice(0,-1):r,this.internalProps.layoutMap.getIndicatorKey(t,e));return o.value?o.value():void 0}if(this.flatDataToObjects){const i=this.internalProps.layoutMap.getCellHeaderPaths(t,e),r=i.colHeaderPaths.map((t=>t.indicatorKey??t.value)),n=i.rowHeaderPaths.map((t=>t.indicatorKey??t.value)),o=this.flatDataToObjects.getTreeNode(n,r,this.internalProps.layoutMap.getBody(t,e).indicatorKey);return o?.value}const r=this.getBodyIndexByRow(e),n=this.getBodyIndexByCol(t),o=this.records[r]?.[n];return o}getCellRawValue(t,e){const i=this;if(i.internalProps.layoutMap.isHeader(t,e)){const{title:r}=i.internalProps.layoutMap.getHeader(t,e);return"function"==typeof r?r():r}if(this.dataset){const i=this.internalProps.layoutMap.getCellHeaderPaths(t,e),r=i.colHeaderPaths.map((t=>t.indicatorKey??t.value)),n=i.rowHeaderPaths.map((t=>t.indicatorKey??t.value)),o=this.dataset.getAggregator(this.internalProps.layoutMap.indicatorsAsCol?n:n.slice(0,-1),this.internalProps.layoutMap.indicatorsAsCol?r.slice(0,-1):r,this.internalProps.layoutMap.getIndicatorKey(t,e),!1);return o.value?o.value():void 0}if(this.flatDataToObjects){const i=this.internalProps.layoutMap.getCellHeaderPaths(t,e),r=i.colHeaderPaths.map((t=>t.indicatorKey??t.value)),n=i.rowHeaderPaths.map((t=>t.indicatorKey??t.value)),o=this.flatDataToObjects.getTreeNode(n,r,this.internalProps.layoutMap.getBody(t,e).indicatorKey,!1);return o?.value}const r=this.getBodyIndexByRow(e),n=this.getBodyIndexByCol(t),o=this.records[r]?.[n];return o}getCellOriginRecord(t,e){if(this.internalProps.layoutMap.isHeader(t,e))return;if(this.dataset){const i=this.internalProps.layoutMap.getCellHeaderPaths(t,e),r=i.colHeaderPaths.map((t=>t.indicatorKey??t.value)),n=i.rowHeaderPaths.map((t=>t.indicatorKey??t.value));return this.dataset.getAggregator(this.internalProps.layoutMap.indicatorsAsCol?n:n.slice(0,-1),this.internalProps.layoutMap.indicatorsAsCol?r.slice(0,-1):r,this.internalProps.layoutMap.getIndicatorKey(t,e)).records}if(this.flatDataToObjects){const i=this.internalProps.layoutMap.getCellHeaderPaths(t,e),r=i.colHeaderPaths.map((t=>t.indicatorKey??t.value)),n=i.rowHeaderPaths.map((t=>t.indicatorKey??t.value)),o=this.flatDataToObjects.getTreeNode(n,r,this.internalProps.layoutMap.getBody(t,e).indicatorKey,!1);return o?.record}const i=this.getBodyIndexByRow(e),r=this.getBodyIndexByCol(t),n=this.records[i]?.[r];return n}getCellRawRecord(t,e){return this.getCellOriginRecord(t,e)}updateSortRules(t){this.internalProps.dataConfig.sortRules=t,this.dataset.updateSortRules(t),this.scenegraph.clearCells(),this.refreshHeader(),this.scenegraph.createSceneGraph(),this.render()}updatePivotSortState(t){for(let e=0;e<t.length;e++){const{dimensions:i,order:r}=t[e],n=this.internalProps.layoutMap.getPivotCellAdress(i);n&&this.pivotSortState.push({col:n.col,row:n.row,order:r})}}getPivotSortState(t,e){if(!this.pivotSortState)return;const i=this.getCellRange(t,e);for(let t=0;t<this.pivotSortState.length;t++){const{col:e,row:r,order:n}=this.pivotSortState[t];if(qC(i,e,r))return n}}moveHeaderPosition(t,e){const i=this.internalProps.layoutMap.moveHeaderPosition(t,e);if(i){if("column"===i.moveType){if(this.options.records?.[0]?.constructor===Array)for(let t=0;t<this.internalProps.records.length;t++){const e=this.internalProps.records[t].splice(i.sourceIndex-this.rowHeaderLevelCount,i.moveSize);e.unshift(i.targetIndex-this.rowHeaderLevelCount,0),Array.prototype.splice.apply(this.internalProps.records[t],e)}this.colWidthsMap.adjustOrder(i.sourceIndex,i.targetIndex,i.moveSize);for(let t=0;t<this.internalProps.layoutMap.columnWidths.length;t++){const{minWidth:e,maxWidth:i}=this.internalProps.layoutMap.columnWidths?.[t]??{};e&&("number"==typeof e&&e>0||"string"==typeof e)&&this.setMinColWidth(t,e),i&&("number"==typeof i&&i>0||"string"==typeof i)&&this.setMaxColWidth(t,i)}}else if("row"===i.moveType){if(this.options.records?.[0]?.constructor===Array){const t=this.internalProps.records.splice(i.sourceIndex-this.columnHeaderLevelCount,i.moveSize);t.unshift(i.targetIndex-this.columnHeaderLevelCount,0),Array.prototype.splice.apply(this.internalProps.records,t)}this.rowHeightsMap.adjustOrder(i.sourceIndex,i.targetIndex,i.moveSize)}return!0}return!1}toggleHierarchyState(t,e){const i=this.getHierarchyState(t,e);i===qy.expand?this.fireListeners(pM.TREE_HIERARCHY_STATE_CHANGE,{col:t,row:e,hierarchyState:qy.collapse}):i===qy.collapse&&this.fireListeners(pM.TREE_HIERARCHY_STATE_CHANGE,{col:t,row:e,hierarchyState:qy.expand,originData:this.getCellOriginRecord(t,e)});const r=this.internalProps.layoutMap.toggleHierarchyState(t,e);this.refreshRowColCount(),this.clearCellStyleCache(),this.scenegraph.updateHierarchyIcon(t,e),this.scenegraph.updateRow(r.removeCellPositions,r.addCellPositions,r.updateCellPositions)}getHeaderCellAddressByPath(t){return this.internalProps.layoutMap.getPivotCellAdress(t)}getCellAddressByHeaderPaths(t){return this.internalProps.layoutMap.getCellAdressByHeaderPath(t)}getHeaderPathByXY(t){let e;e=t?this.getCellAt(t.x+this.getFrozenColsWidth()+this.scrollLeft+1,t.y+this.getFrozenRowsHeight()+this.scrollTop+1):this.getCellAt(this.getFrozenColsWidth()+this.scrollLeft+1,this.getFrozenRowsHeight()+this.scrollTop+1);return this.internalProps.layoutMap.getCellHeaderPaths(e.col,e.row)}getHierarchyState(t,e){return this._getHeaderLayoutMap(t,e)?.hierarchyState}getLayoutRowTree(){return this.internalProps.layoutMap.getLayoutRowTree()}getLayoutRowTreeCount(){return this.internalProps.layoutMap.getLayoutRowTreeCount()}getCellHeaderTreeNodes(t,e){return this.internalProps.layoutMap.getCellHeaderPathsWidthTreeNode(t,e)}_hasHierarchyTreeHeader(){return"tree"===this.internalProps.layoutMap.rowHierarchyType}getMenuInfo(t,e,i){const r=this.internalProps.layoutMap.getPivotDimensionInfo(t,e);return{dimensionKey:r[r.length-1].dimensionKey,value:this.getCellValue(t,e),cellLocation:this.getCellLocation(t,e),isPivotCorner:this.isCornerHeader(t,e)}}setRecords(t){const e={col:this.stateManager.hover.cellPos.col,row:this.stateManager.hover.cellPos.row};this.options.records=this.internalProps.records=t;const i=this.options,r=this.internalProps;this.internalProps.enableDataAnalysis&&(i.rows||i.columns)?(this.dataset.setRecords(t),r.layoutMap=new aP(this,this.dataset),this.pivotSortState=[],i.pivotSortState&&this.updatePivotSortState(i.pivotSortState)):(Array.isArray(this.internalProps.columnTree)||Array.isArray(this.internalProps.rowTree))&&t?.[0]?.constructor!==Array&&(this.flatDataToObjects=new hP({rows:r.layoutMap.fullRowDimensionKeys,columns:r.layoutMap.colDimensionKeys,indicators:r.layoutMap.indicatorKeys,indicatorsAsCol:r.layoutMap.indicatorsAsCol,indicatorDimensionKey:r.layoutMap.indicatorDimensionKey},t)),this.refreshHeader(),this.scenegraph.clearCells(),this.clearCellStyleCache(),this.scenegraph.createSceneGraph(),this.stateManager.updateHoverPos(e.col,e.row),this.internalProps.title&&!this.internalProps.title.isReleased&&(this._updateSize(),this.internalProps.title.resize(),this.scenegraph.resize()),this.eventManager.updateEventBinder()}completeEditCell(){this.editorManager.completeEdit()}getEditor(t,e){const i=this.getBodyColumnDefine(t,e);let r=i?.editor??this.options.editor;if("function"==typeof r){r=r({col:t,row:e,dataValue:this.getCellOriginValue(t,e),value:this.getCellValue(t,e)||"",table:this})}return"string"==typeof r?jR(r):r}changeCellValue(t,e,i){let r=i;if("number"==typeof this.getCellRawValue(t,e)&&IC(i)&&(r=parseFloat(i)),this._changeCellValueToDataSet(t,e,r),this.scenegraph.updateCellContent(t,e),"adaptive"===this.widthMode||this.autoFillWidth&&this.getAllColsWidth()<=this.tableNoFrameWidth)0===this.internalProps._widthResizedColMap.size&&this.scenegraph.recalculateColWidths();else if(!this.internalProps._widthResizedColMap.has(t)){const e=this.getColWidth(t),i=qB(t,0,this.rowCount-1,this,!1);i!==e&&this.scenegraph.updateColWidth(t,i-e)}if("adaptive"===this.heightMode||this.autoFillHeight&&this.getAllRowsHeight()<=this.tableNoFrameHeight)this.scenegraph.recalculateRowHeights();else if("autoHeight"===this.heightMode){const t=this.getRowHeight(e),i=JA(e,0,this.colCount-1,this);this.scenegraph.updateRowHeight(e,i-t)}this.fireListeners(ov.CHANGE_CELL_VALUE,{col:t,row:e,rawValue:this.getCellRawValue(t,e),changedValue:r}),this.scenegraph.updateNextFrame()}changeCellValues(t,e,i){let r=t,n=e;for(let o=0;o<i.length&&!(n>=this.rowCount-1);o++){n=e+o;const s=i[o];let a=t;for(let i=0;i<s.length&&!(a>=this.colCount-1);i++){a=t+i;const r=s[i];let n=r;const l=this.getCellRawValue(t+i,e+o);"number"==typeof l&&IC(r)&&(n=parseFloat(r)),this._changeCellValueToDataSet(t+i,e+o,n),this.fireListeners(ov.CHANGE_CELL_VALUE,{col:t,row:e,rawValue:l,changedValue:this.getCellOriginValue(t+i,e+o)})}r=Math.max(r,a)}const o=this.getCellRange(t,e),s=this.getCellRange(r,n);for(let t=o.start.col;t<=s.end.col;t++)for(let e=o.start.row;e<=s.end.row;e++)this.scenegraph.updateCellContent(t,e);if("adaptive"===this.widthMode||this.autoFillWidth&&this.getAllColsWidth()<=this.tableNoFrameWidth)0===this.internalProps._widthResizedColMap.size&&this.scenegraph.recalculateColWidths();else for(let e=t;e<=s.end.col;e++)if(!this.internalProps._widthResizedColMap.has(e)){const t=this.getColWidth(e),i=qB(e,0,this.rowCount-1,this,!1);i!==t&&this.scenegraph.updateColWidth(e,i-t)}if("adaptive"===this.heightMode||this.autoFillHeight&&this.getAllRowsHeight()<=this.tableNoFrameHeight)this.scenegraph.recalculateRowHeights();else if("autoHeight"===this.heightMode){const t=[],i=[];for(let r=e;r<=s.end.row;r++)if(this.rowHeightsMap.get(r)){const e=this.getRowHeight(r),n=JA(r,0,this.colCount-1,this);t.push(r),i.push(n-e)}this.scenegraph.updateRowsHeight(t,i)}this.scenegraph.updateNextFrame()}_changeCellValueToDataSet(t,e,i){if(this.dataset){const r=this.internalProps.layoutMap.getCellHeaderPaths(t,e),n=r.colHeaderPaths.map((t=>t.indicatorKey??t.value)),o=r.rowHeaderPaths.map((t=>t.indicatorKey??t.value));this.dataset.changeTreeNodeValue(this.internalProps.layoutMap.indicatorsAsCol?o:o.slice(0,-1),this.internalProps.layoutMap.indicatorsAsCol?n.slice(0,-1):n,this.internalProps.layoutMap.getIndicatorKey(t,e),i)}else if(this.flatDataToObjects){const r=this.internalProps.layoutMap.getCellHeaderPaths(t,e),n=r.colHeaderPaths.map((t=>t.indicatorKey??t.value)),o=r.rowHeaderPaths.map((t=>t.indicatorKey??t.value));this.flatDataToObjects.changeTreeNodeValue(o,n,this.internalProps.layoutMap.getBody(t,e).indicatorKey,i)}else{const r=this.getBodyIndexByRow(e),n=this.getBodyIndexByCol(t);this.records[r][n]=i}}hasCustomRenderOrLayout(){if(this.options.customRender)return!0;const{columnsDefine:t,rowsDefine:e,indicatorsDefine:i}=this.internalProps.layoutMap;for(let e=0;e<t.length;e++){const i=t[e];if("string"!=typeof i&&(i.headerCustomLayout||i.headerCustomRender))return!0}for(let t=0;t<e.length;t++){const i=e[t];if("string"!=typeof i&&(i.headerCustomLayout||i.headerCustomRender))return!0}for(let t=0;t<i.length;t++){const e=i[t];if("string"!=typeof e&&(e.customLayout||e.headerCustomLayout||e.customRender||e.headerCustomRender))return!0}return!1}},t.TYPES=iC,t.VArc=function(t){return hh.arc(t?t.attribute:{})},t.VArea=function(t){return hh.area(t?t.attribute:{})},t.VCircle=function(t){return hh.circle(t?t.attribute:{})},t.VGlyph=function(t){return hh.glyph(t?t.attribute:{})},t.VGroup=function(t){return hh.group(t?t.attribute:{})},t.VImage=function(t){return hh.image(t?t.attribute:{})},t.VLine=function(t){return hh.line(t?t.attribute:{})},t.VPath=function(t){return hh.path(t?t.attribute:{})},t.VPolygon=function(t){return hh.polygon(t?t.attribute:{})},t.VRect=function(t){return hh.rect(t?t.attribute:{})},t.VSymbol=function(t){return hh.symbol(t?t.attribute:{})},t.VTag=function(t){return new tw(t?t.attribute:{})},t.VText=function(t){return hh.text(t?t.attribute:{})},t.clearGlobal=function(){KR()},t.core=NR,t.data=U_,t.getDataCellPath=function(t,e,i){const r=SP(t),n=new aP({options:t,internalProps:t,isPivotChart:()=>!0,pivotChartAxes:[],_selectedDataItemsInChart:[],_getActiveChartInstance:()=>({updateState:()=>{}})},r);for(let t=0;t<n.colCount;t++)for(let o=0;o<n.rowCount;o++){if(n.isHeader(t,o))continue;const s=n.getCellHeaderPaths(t,o),a=s.colHeaderPaths.map((t=>t.indicatorKey??t.value)),l=s.rowHeaderPaths.map((t=>t.indicatorKey??t.value)),h=r.getAggregator(n.indicatorsAsCol?l:l.slice(0,-1),n.indicatorsAsCol?a.slice(0,-1):a,n.getIndicatorKey(t,o)),c=AP(h.value?h.value():void 0,e,t,o,n,i);if(c)return c}},t.getIcons=function(){return YS()},t.graphicUtil=Su,t.jsx=function(t,e){const i=e||{},{key:r,attribute:n,stateProxy:o}=i,s=Xg(i,["key","attribute","stateProxy"]);let a=t;et(t)&&(a=hh[t]);const l=[];for(var h=arguments.length,c=new Array(h>2?h-2:0),d=2;d<h;d++)c[d-2]=arguments[d];c.length&&Yg(1===c.length?c[0]:c,l);const u="Group"===a.name?new a(n):a(e);return function(t,e,i){let r,n=!1;switch(t.type){case"richtext":case"rich/image":break;case"rich/text":r=t.attribute||{},e[0]&&(r.text=e[0]);break;default:n=!0}n?(e.forEach((e=>{e&&t.add(e)})),Object.keys(i).forEach((e=>{const r=$g[e];r&&t.on(r,i[e])}))):"richtext"===t.type&&(t.attribute.textConfig=e.map((t=>t.attribute)).filter((t=>t)))}(u,l,s),o&&(u.stateProxy=o),u},t.register=$R,t.renderChart=BB,t.themes=Wv,t.updateCell=SA,t.version="0.17.9"}));