@visactor/vtable-plugins 1.18.5 → 1.18.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- !function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("@visactor/vtable")):"function"==typeof define&&define.amd?define(["exports","@visactor/vtable"],e):e(((t="undefined"!=typeof globalThis?globalThis:t||self).VTable=t.VTable||{},t.VTable.plugins={}),t.VTable)}(this,(function(t,e){"use strict";function i(t){var e=Object.create(null);return t&&Object.keys(t).forEach((function(i){if("default"!==i){var n=Object.getOwnPropertyDescriptor(t,i);Object.defineProperty(e,i,n.get?n:{enumerable:!0,get:function(){return t[i]}})}})),e.default=t,Object.freeze(e)}var n=i(e);function s(t){return Math.floor(t)===t}class r{static GenAutoIncrementId(){return r.auto_increment_id++}}r.auto_increment_id=0;class a{constructor(t){this.id=r.GenAutoIncrementId(),this.registry=t}}const o="named",l="inject",h="multi_inject",d="inversify:tagged",c="inversify:paramtypes";class u{constructor(t,e){this.key=t,this.value=e}toString(){return this.key===o?`named: ${String(this.value).toString()} `:`tagged: { key:${this.key.toString()}, value: ${String(this.value)} }`}}var p=function(t){var e;return function(t){const e="function"==typeof Symbol&&void 0!==Symbol.toPrimitive?Symbol.toPrimitive:"@@toPrimitive",i=Object.getPrototypeOf(Function),n=("object"==typeof process&&process.env&&process.env.REFLECT_METADATA_USE_MAP_POLYFILL,Map),s=new WeakMap;function r(t,e,i){let r=s.get(t);if(h(r)){if(!i)return;r=new n,s.set(t,r)}let a=r.get(e);if(h(a)){if(!i)return;a=new n,r.set(e,a)}return a}function a(t,e,i){if(o(t,e,i))return!0;const n=f(e);return!d(n)&&a(t,n,i)}function o(t,e,i){const n=r(e,i,!1);return!h(n)&&!!n.has(t)}function l(t,e,i){if(o(t,e,i))return function(t,e,i){const n=r(e,i,!1);if(!h(n))return n.get(t)}(t,e,i);const n=f(e);return d(n)?void 0:l(t,n,i)}function h(t){return void 0===t}function d(t){return null===t}function c(t){return"object"==typeof t?null!==t:"function"==typeof t}function u(t,i){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 n=3===i?"string":5===i?"number":"default",s=function(t,e){const i=t[e];if(null!=i){if(!g(i))throw new TypeError;return i}}(t,e);if(void 0!==s){const e=s.call(t,n);if(c(e))throw new TypeError;return e}return function(t,e){if("string"===e){const e=t.toString;if(g(e)){const i=e.call(t);if(!c(i))return i}const i=t.valueOf;if(g(i)){const e=i.call(t);if(!c(e))return e}}else{const e=t.valueOf;if(g(e)){const i=e.call(t);if(!c(i))return i}const i=t.toString;if(g(i)){const e=i.call(t);if(!c(e))return e}}throw new TypeError}(t,"default"===n?"number":n)}function p(t){const e=u(t,3);return"symbol"==typeof e?e:function(t){return""+t}(e)}function g(t){return"function"==typeof t}function f(t){const e=Object.getPrototypeOf(t);if("function"!=typeof t||t===i)return e;if(e!==i)return e;const n=t.prototype,s=n&&Object.getPrototypeOf(n);if(null==s||s===Object.prototype)return e;const r=s.constructor;return"function"!=typeof r||r===t?e:r}t("defineMetadata",(function(t,e,i,n){if(!c(i))throw new TypeError;return s=t,a=e,void r(i,n,!0).set(s,a);var s,a})),t("hasMetadata",(function(t,e,i){if(!c(e))throw new TypeError;return h(i)||(i=p(i)),a(t,e,i)})),t("hasOwnMetadata",(function(t,e,i){if(!c(e))throw new TypeError;return h(i)||(i=p(i)),o(t,e,i)})),t("getMetadata",(function(t,e,i){if(!c(e))throw new TypeError;return h(i)||(i=p(i)),l(t,e,i)}))}((e=t,function(t,i){"function"!=typeof e[t]&&Object.defineProperty(e,t,{configurable:!0,writable:!0,value:i})})),t}({});function g(t,e,i,n){!function(t,e,i,n){const s=[n];let r={};p.hasOwnMetadata(t,e)&&(r=p.getMetadata(t,e));let a=r[i];void 0===a&&(a=[]),a.push(...s),r[i]=a,p.defineMetadata(t,r,e)}(d,t,i.toString(),n)}function f(t){return(e,i,n)=>{g(e,0,n,t)}}function v(t){return e=>(i,n,s)=>f(new u(t,e))(i,n,s)}const m=v(l),b=v(h);function y(){return function(t){return p.defineMetadata(c,null,t),t}}function x(t){return f(new u(o,t))}const _="Singleton",w="Transient",T="ConstantValue",S="DynamicValue",k="Factory",B="Function",A="Instance",C="Invalid";class L{constructor(t,e){this.id=r.GenAutoIncrementId(),this.activated=!1,this.serviceIdentifier=t,this.scope=e,this.type=C,this.constraint=t=>!0,this.implementationType=null,this.cache=null,this.factory=null,this.provider=null,this.dynamicValue=null}clone(){const t=new L(this.serviceIdentifier,this.scope);return t.activated=t.scope===_&&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 O{getConstructorMetadata(t){return{compilerGeneratedMetadata:p.getMetadata(c,t),userGeneratedMetadata:p.getMetadata(d,t)||{}}}getPropertiesMetadata(t){throw new Error("暂未实现")}}const E=(R=o,t=>{const e=e=>{if(null==e)return!1;if(e.key===R&&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===R&&i[e].value===t)return!0;return!1};return e.metaData=new u(R,t),e});var R;class M{constructor(t){this._binding=t}inRequestScope(){throw new Error("暂未实现")}inSingletonScope(){return this._binding.scope=_,this}inTransientScope(){return this._binding.scope=w,this}whenTargetNamed(t){return this._binding.constraint=E(t),this}}class P{constructor(t){this._binding=t}to(t){return this._binding.type=A,this._binding.implementationType=t,new M(this._binding)}toSelf(){const t=this._binding.serviceIdentifier;return this.to(t)}toDynamicValue(t){return this._binding.type=S,this._binding.cache=null,this._binding.dynamicValue=t,this._binding.implementationType=null,new M(this._binding)}toConstantValue(t){return this._binding.type=T,this._binding.cache=t,this._binding.dynamicValue=null,this._binding.implementationType=null,this._binding.scope=_,new M(this._binding)}toFactory(t){return this._binding.type=k,this._binding.factory=t,this._binding.scope=_,new M(this._binding)}toService(t){this.toDynamicValue((e=>e.container.get(t)))}}const D=Symbol("ContributionProvider");class I{constructor(t,e){this.serviceIdentifier=t,this.container=e,N.setStore(this.serviceIdentifier,this)}getContributions(){return this.caches||(this.caches=[],this.container&&this.container.isBound(this.serviceIdentifier)&&this.caches.push(...this.container.getAll(this.serviceIdentifier))),this.caches}refresh(){this.caches&&(this.caches.length=0,this.container&&this.container.isBound(this.serviceIdentifier)&&this.caches.push(...this.container.getAll(this.serviceIdentifier)))}}function F(t,e){t(D).toDynamicValue((t=>{let{container:i}=t;return new I(e,i)})).inSingletonScope().whenTargetNamed(e)}class N{static getStore(t){return this.store.get(t)}static setStore(t,e){this.store.set(t,e)}static refreshAllContributions(){this.store.forEach((t=>{t.refresh()}))}}N.store=new Map;class H{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 n;if("string"==typeof e)n={name:e.trim()};else if("object"!=typeof e||null===e)throw new Error("Invalid tap options");if("string"!=typeof n.name||""===n.name)throw new Error("Missing name for tap");return n=Object.assign({type:t,fn:i},n),n}_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 n=this.taps.length;for(;n>0;){n--;const t=this.taps[n];this.taps[n+1]=t;const s=t.stage||0;if(e){if(e.has(t.name)){e.delete(t.name);continue}if(e.size>0)continue}if(!(s>i)){n++;break}}this.taps[n]=t}}class z extends H{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 W=Symbol.for("EnvContribution"),U=Symbol.for("VGlobal");class j{constructor(){this._listenerMap=new Map,this._eventListenerTransformer=t=>t}setEventListenerTransformer(t){this._eventListenerTransformer=t||(t=>t)}addEventListener(t,e,i){if(!e)return;const n=t=>{const i=this._eventListenerTransformer(t);"function"==typeof e?e(i):e.handleEvent&&e.handleEvent(i)};this._listenerMap.has(t)||this._listenerMap.set(t,new Map),this._listenerMap.get(t).set(e,n),this._nativeAddEventListener(t,n,i)}removeEventListener(t,e,i){var n;if(!e)return;const s=null===(n=this._listenerMap.get(t))||void 0===n?void 0:n.get(e);s&&(this._nativeRemoveEventListener(t,s,i),this._listenerMap.get(t).delete(e),0===this._listenerMap.get(t).size&&this._listenerMap.delete(t))}dispatchEvent(t){return this._nativeDispatchEvent(t)}clearAllEventListeners(){this._listenerMap.forEach(((t,e)=>{t.forEach(((t,i)=>{this._nativeRemoveEventListener(e,t,void 0)}))})),this._listenerMap.clear()}_nativeAddEventListener(t,e,i){throw new Error("_nativeAddEventListener must be implemented by derived classes")}_nativeRemoveEventListener(t,e,i){throw new Error("_nativeRemoveEventListener must be implemented by derived classes")}_nativeDispatchEvent(t){throw new Error("_nativeDispatchEvent must be implemented by derived classes")}}var G=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Y=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},V=function(t,e){return function(i,n){e(i,n,t)}},X=function(t,e,i,n){return new(i||(i=Promise))((function(s,r){function a(t){try{l(n.next(t))}catch(t){r(t)}}function o(t){try{l(n.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?s(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((n=n.apply(t,e||[])).next())}))};let K=class extends j{get env(){return this._env}get isImageAnonymous(){return this._isImageAnonymous}set isImageAnonymous(t){this._isImageAnonymous=t}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){super(),this.contributions=t,this._isImageAnonymous=!0,this.eventListenerTransformer=t=>t,this.id=r.GenAutoIncrementId(),this.hooks={onSetEnv:new z(["lastEnv","env","global"])},this.measureTextMethod="native",this.optimizeVisible=!1}_nativeAddEventListener(t,e,i){return this._env||this.setEnv("browser"),this.envContribution.addEventListener(t,e,i)}_nativeRemoveEventListener(t,e,i){return this._env||this.setEnv("browser"),this.envContribution.removeEventListener(t,e,i)}_nativeDispatchEvent(t){return this._env||this.setEnv("browser"),this.envContribution.dispatchEvent(t)}bindContribution(t){const e=[];if(this.contributions.getContributions().forEach((i=>{const n=i.configure(this,t);n&&n.then&&e.push(n)})),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 n=this.bindContribution(e);if(n&&n.then)return n.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)}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)}loadFont(t,e,i){return X(this,void 0,void 0,(function*(){return this._env||this.setEnv("browser"),this.envContribution.loadFont(t,e,i)}))}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)}updateDom(t,e){return this._env||this.setEnv("browser"),this.envContribution.updateDom(t,e)}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)}isMacOS(){return this._env||this.setEnv("browser"),this.envContribution.isMacOS()}copyToClipBoard(t){return this._env||this.setEnv("browser"),this.envContribution.copyToClipBoard(t)}};var $;function q(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}K=G([y(),V(0,m(D)),V(0,x(W)),Y("design:paramtypes",[Object])],K),function(t){t[t.estimate=0]="estimate",t[t.actualBounding=1]="actualBounding",t[t.fontBounding=2]="fontBounding"}($||($={}));var Z={exports:{}};!function(t){var e=Object.prototype.hasOwnProperty,i="~";function n(){}function s(t,e,i){this.fn=t,this.context=e,this.once=i||!1}function r(t,e,n,r,a){if("function"!=typeof n)throw new TypeError("The listener must be a function");var o=new s(n,r||t,a),l=i?i+e:e;return t._events[l]?t._events[l].fn?t._events[l]=[t._events[l],o]:t._events[l].push(o):(t._events[l]=o,t._eventsCount++),t}function a(t,e){0==--t._eventsCount?t._events=new n:delete t._events[e]}function o(){this._events=new n,this._eventsCount=0}Object.create&&(n.prototype=Object.create(null),(new n).__proto__||(i=!1)),o.prototype.eventNames=function(){var t,n,s=[];if(0===this._eventsCount)return s;for(n in t=this._events)e.call(t,n)&&s.push(i?n.slice(1):n);return Object.getOwnPropertySymbols?s.concat(Object.getOwnPropertySymbols(t)):s},o.prototype.listeners=function(t){var e=i?i+t:t,n=this._events[e];if(!n)return[];if(n.fn)return[n.fn];for(var s=0,r=n.length,a=new Array(r);s<r;s++)a[s]=n[s].fn;return a},o.prototype.listenerCount=function(t){var e=i?i+t:t,n=this._events[e];return n?n.fn?1:n.length:0},o.prototype.emit=function(t,e,n,s,r,a){var o=i?i+t:t;if(!this._events[o])return!1;var l,h,d=this._events[o],c=arguments.length;if(d.fn){switch(d.once&&this.removeListener(t,d.fn,void 0,!0),c){case 1:return d.fn.call(d.context),!0;case 2:return d.fn.call(d.context,e),!0;case 3:return d.fn.call(d.context,e,n),!0;case 4:return d.fn.call(d.context,e,n,s),!0;case 5:return d.fn.call(d.context,e,n,s,r),!0;case 6:return d.fn.call(d.context,e,n,s,r,a),!0}for(h=1,l=new Array(c-1);h<c;h++)l[h-1]=arguments[h];d.fn.apply(d.context,l)}else{var u,p=d.length;for(h=0;h<p;h++)switch(d[h].once&&this.removeListener(t,d[h].fn,void 0,!0),c){case 1:d[h].fn.call(d[h].context);break;case 2:d[h].fn.call(d[h].context,e);break;case 3:d[h].fn.call(d[h].context,e,n);break;case 4:d[h].fn.call(d[h].context,e,n,s);break;default:if(!l)for(u=1,l=new Array(c-1);u<c;u++)l[u-1]=arguments[u];d[h].fn.apply(d[h].context,l)}}return!0},o.prototype.on=function(t,e,i){return r(this,t,e,i,!1)},o.prototype.once=function(t,e,i){return r(this,t,e,i,!0)},o.prototype.removeListener=function(t,e,n,s){var r=i?i+t:t;if(!this._events[r])return this;if(!e)return a(this,r),this;var o=this._events[r];if(o.fn)o.fn!==e||s&&!o.once||n&&o.context!==n||a(this,r);else{for(var l=0,h=[],d=o.length;l<d;l++)(o[l].fn!==e||s&&!o[l].once||n&&o[l].context!==n)&&h.push(o[l]);h.length?this._events[r]=1===h.length?h[0]:h:a(this,r)}return this},o.prototype.removeAllListeners=function(t){var e;return t?(e=i?i+t:t,this._events[e]&&a(this,e)):(this._events=new n,this._eventsCount=0),this},o.prototype.off=o.prototype.removeListener,o.prototype.addListener=o.prototype.on,o.prefixed=i,o.EventEmitter=o,t.exports=o}(Z);var J=q(Z.exports);var Q=(t,e)=>Object.prototype.toString.call(t)===`[object ${e}]`;var tt=function(t){return arguments.length>1&&void 0!==arguments[1]&&arguments[1]?"boolean"==typeof t:!0===t||!1===t||Q(t,"Boolean")};var et=t=>"function"==typeof t;var it=t=>null==t;var nt=t=>null!=t;var st=t=>{const e=typeof t;return null!==t&&"object"===e||"function"===e};var rt=t=>"object"==typeof t&&null!==t;var at=function(t){if(!rt(t)||!Q(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 ot=t=>void 0===t;var lt=function(t){const e=typeof t;return arguments.length>1&&void 0!==arguments[1]&&arguments[1]?"string"===e:"string"===e||Q(t,"String")};var ht=t=>Array.isArray?Array.isArray(t):Q(t,"Array");var dt=function(t){return null!==t&&"function"!=typeof t&&Number.isFinite(t.length)};var ct=function(t){const e=typeof t;return arguments.length>1&&void 0!==arguments[1]&&arguments[1]?"number"===e:"number"===e||Q(t,"Number")};var ut=t=>ct(t)&&Number.isFinite(t);var pt=t=>new RegExp(/^(http(s)?:\/\/)\w+[^\s]+(\.[^\s]+){1,}$/).test(t);var gt=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 ft=t=>({}.toString.call(t).replace(/^\[object /,"").replace(/]$/,""));const vt=Object.prototype;var mt=function(t){const e=t&&t.constructor;return t===("function"==typeof e&&e.prototype||vt)};const bt=Object.prototype.hasOwnProperty;function yt(t){if(it(t))return!0;if(dt(t))return!t.length;const e=ft(t);if("Map"===e||"Set"===e)return!t.size;if(mt(t))return!Object.keys(t).length;for(const e in t)if(bt.call(t,e))return!1;return!0}const xt=Object.prototype.hasOwnProperty;var _t=(t,e)=>null!=t&&xt.call(t,e);function wt(t,e){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2],n=arguments.length>3&&void 0!==arguments[3]&&arguments[3];if(e){if(t===e)return;if(nt(e)&&"object"==typeof e){const s=Object(e),r=[];for(const t in s)r.push(t);let{length:a}=r,o=-1;for(;a--;){const a=r[++o];!nt(s[a])||"object"!=typeof s[a]||n&&ht(t[a])?St(t,a,s[a]):Tt(t,e,a,i,n)}}}}function Tt(t,e,i){let n=arguments.length>3&&void 0!==arguments[3]&&arguments[3],s=arguments.length>4&&void 0!==arguments[4]&&arguments[4];const r=t[i],a=e[i];let o=e[i],l=!0;if(ht(a)){if(n)o=[];else if(ht(r))o=r;else if(dt(r)){o=new Array(r.length);let t=-1;const e=r.length;for(;++t<e;)o[t]=r[t]}}else at(a)?(o=null!=r?r:{},"function"!=typeof r&&"object"==typeof r||(o={})):l=!1;l&&wt(o,a,n,s),St(t,i,o)}function St(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 kt(t){let e=-1;const i=arguments.length<=1?0:arguments.length-1;for(;++e<i;)wt(t,e+1<1||arguments.length<=e+1?void 0:arguments[e+1],!0);return t}function Bt(t,e){if(!ht(t)||!ht(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}const At="undefined"!=typeof console;function Ct(t,e,i){const n=[e].concat([].slice.call(i));At&&console[t].apply(console,n)}var Lt;!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"}(Lt||(Lt={}));class Ot{static getInstance(t,e){return Ot._instance&&ct(t)?Ot._instance.level(t):Ot._instance||(Ot._instance=new Ot(t,e)),Ot._instance}static setInstance(t){return Ot._instance=t}static setInstanceLevel(t){Ot._instance?Ot._instance.level(t):Ot._instance=new Ot(t)}static clearInstance(){Ot._instance=null}constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Lt.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>=Lt.Info}canLogDebug(){return this._level>=Lt.Debug}canLogError(){return this._level>=Lt.Error}canLogWarn(){return this._level>=Lt.Warn}level(t){return arguments.length?(this._level=+t,this):this._level}error(){for(var t,e=arguments.length,i=new Array(e),n=0;n<e;n++)i[n]=arguments[n];return this._level>=Lt.Error&&(this._onErrorHandler.length?this.callErrorHandler(...i):Ct(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>=Lt.Warn&&Ct(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>=Lt.Info&&Ct(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>=Lt.Debug&&Ct(this._method||"log","DEBUG",e),this}}Ot._instance=null;function Et(t,e){const i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1e-10,n=(arguments.length>2&&void 0!==arguments[2]?arguments[2]:1e-10)*Math.max(t,e);return Math.abs(t-e)<=Math.max(i,n)}var Rt=function(t,e,i){return t<e?e:t>i?i:t};var Mt=(t,e,i)=>{let[n,s]=t;s<n&&(n=t[1],s=t[0]);const r=s-n;return r>=i-e?[e,i]:(n=Math.min(Math.max(n,e),i-r),[n,n+r])};let Pt=!1;try{Pt="function"==typeof requestAnimationFrame&&"function"==typeof cancelAnimationFrame}catch(t){Pt=!1}function Dt(t,e,i){let n,s,r,a,o,l,h=0,d=!1,c=!1,u=!0;const p=!e&&0!==e&&Pt;if("function"!=typeof t)throw new TypeError("Expected a function");function g(e){const i=n,r=s;return n=s=void 0,h=e,a=t.apply(r,i),a}function f(t,e){return p?(cancelAnimationFrame(o),requestAnimationFrame(t)):setTimeout(t,e)}function v(t){const i=t-l;return void 0===l||i>=e||i<0||c&&t-h>=r}function m(){const t=Date.now();if(v(t))return b(t);o=f(m,function(t){const i=t-h,n=e-(t-l);return c?Math.min(n,r-i):n}(t))}function b(t){return o=void 0,u&&n?g(t):(n=s=void 0,a)}function y(){const t=Date.now(),i=v(t);for(var r=arguments.length,u=new Array(r),p=0;p<r;p++)u[p]=arguments[p];if(n=u,s=this,l=t,i){if(void 0===o)return function(t){return h=t,o=f(m,e),d?g(t):a}(l);if(c)return o=f(m,e),g(l)}return void 0===o&&(o=f(m,e)),a}return e=+e||0,st(i)&&(d=!!i.leading,c="maxWait"in i,c&&(r=Math.max(ut(i.maxWait)?i.maxWait:0,e)),u="trailing"in i?!!i.trailing:u),y.cancel=function(){void 0!==o&&function(t){if(p)return cancelAnimationFrame(t);clearTimeout(t)}(o),h=0,n=l=s=o=void 0},y.flush=function(){return void 0===o?a:b(Date.now())},y.pending=function(){return void 0!==o},y}Pt=!1;const It=1e-12,Ft=Math.PI,Nt=Ft/2,Ht=2*Ft,zt=2*Math.PI,Wt=Math.abs,Ut=Math.atan2,jt=Math.cos,Gt=Math.max,Yt=Math.min,Vt=Math.sin,Xt=Math.sqrt,Kt=Math.pow;function $t(t,e,i,n,s){let r=i,a=n;return"number"==typeof t&&"number"==typeof i&&(r=(1-s)*t+s*i),"number"==typeof e&&"number"==typeof n&&(a=(1-s)*e+s*n),{x:r,y:a}}class qt{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,n=arguments.length>3?arguments[3]:void 0;this.x=0,this.y=0,this.x=t,this.y=e,this.x1=i,this.y1=n}clone(){return new qt(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 ct(t)?(this.x+=t,void(this.y+=t)):(this.x+=t.x,this.y+=t.y,this)}sub(t){return ct(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 Zt{static distancePP(t,e){return Xt(Kt(t.x-e.x,2)+Kt(t.y-e.y,2))}static distanceNN(t,e,i,n){return Xt(Kt(t-i,2)+Kt(e-n,2))}static distancePN(t,e,i){return Xt(Kt(e-t.x,2)+Kt(i-t.y,2))}static pointAtPP(t,e,i){return new qt((e.x-t.x)*i+t.x,(e.y-t.y)*i+t.y)}}function Jt(t){return t*(Math.PI/180)}function Qt(t,e,i){if(null===t)return e;if(null===e)return t;const{x11:n,x12:s,y11:r,y12:a,x21:o,x22:l,y21:h,y22:d}=ee(t,e,i);return n>=l||s<=o||r>=d||a<=h?{x1:0,y1:0,x2:0,y2:0}:{x1:Math.max(n,o),y1:Math.max(r,h),x2:Math.min(s,l),y2:Math.min(a,d)}}var te;!function(t){t[t.NONE=0]="NONE",t[t.BBOX1=1]="BBOX1",t[t.BBOX2=2]="BBOX2"}(te||(te={}));const ee=(t,e,i)=>{let n=t.x1,s=t.x2,r=t.y1,a=t.y2,o=e.x1,l=e.x2,h=e.y1,d=e.y2;return i&&(n>s&&([n,s]=[s,n]),r>a&&([r,a]=[a,r]),o>l&&([o,l]=[l,o]),h>d&&([h,d]=[d,h])),{x11:n,x12:s,y11:r,y12:a,x21:o,x22:l,y21:h,y22:d}};function ie(t,e,i){if(!t||!e)return te.NONE;const{x11:n,x12:s,y11:r,y12:a,x21:o,x22:l,y21:h,y22:d}=ee(t,e,i);return n>o&&s<l&&r>h&&a<d?te.BBOX1:o>n&&l<s&&h>r&&d<a?te.BBOX2:te.NONE}function ne(t,e,i){if(t&&e){if(!i)return!(t.x1>e.x2||t.x2<e.x1||t.y1>e.y2||t.y2<e.y1);const{x11:n,x12:s,y11:r,y12:a,x21:o,x22:l,y21:h,y22:d}=ee(t,e,!0);return!(n>l||s<o||r>d||a<h)}return!0}function se(t,e){return Math.abs(e[0]*t[0]+e[1]*t[1])}function re(t,e){let{x:i,y:n}=t,s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{x:0,y:0};return{x:(i-s.x)*Math.cos(e)-(n-s.y)*Math.sin(e)+s.x,y:(i-s.x)*Math.sin(e)+(n-s.y)*Math.cos(e)+s.y}}function ae(t){return{x:(t.x1+t.x2)/2,y:(t.y1+t.y2)/2}}function oe(t,e){const i=e?Jt(t.angle):t.angle,n=ae(t);return[re({x:t.x1,y:t.y1},i,n),re({x:t.x2,y:t.y1},i,n),re({x:t.x2,y:t.y2},i,n),re({x:t.x1,y:t.y2},i,n)]}const le=t=>{let e=t.charCodeAt(0),i=2===t.length?t.charCodeAt(1):0,n=e;return 55296<=e&&e<=56319&&56320<=i&&i<=57343&&(e&=1023,i&=1023,n=e<<10|i,n+=65536),12288===n||65281<=n&&n<=65376||65504<=n&&n<=65510?"F":8361===n||65377<=n&&n<=65470||65474<=n&&n<=65479||65482<=n&&n<=65487||65490<=n&&n<=65495||65498<=n&&n<=65500||65512<=n&&n<=65518?"H":4352<=n&&n<=4447||4515<=n&&n<=4519||4602<=n&&n<=4607||9001<=n&&n<=9002||11904<=n&&n<=11929||11931<=n&&n<=12019||12032<=n&&n<=12245||12272<=n&&n<=12283||12289<=n&&n<=12350||12353<=n&&n<=12438||12441<=n&&n<=12543||12549<=n&&n<=12589||12593<=n&&n<=12686||12688<=n&&n<=12730||12736<=n&&n<=12771||12784<=n&&n<=12830||12832<=n&&n<=12871||12880<=n&&n<=13054||13056<=n&&n<=19903||19968<=n&&n<=42124||42128<=n&&n<=42182||43360<=n&&n<=43388||44032<=n&&n<=55203||55216<=n&&n<=55238||55243<=n&&n<=55291||63744<=n&&n<=64255||65040<=n&&n<=65049||65072<=n&&n<=65106||65108<=n&&n<=65126||65128<=n&&n<=65131||110592<=n&&n<=110593||127488<=n&&n<=127490||127504<=n&&n<=127546||127552<=n&&n<=127560||127568<=n&&n<=127569||131072<=n&&n<=194367||177984<=n&&n<=196605||196608<=n&&n<=262141?"W":32<=n&&n<=126||162<=n&&n<=163||165<=n&&n<=166||172===n||175===n||10214<=n&&n<=10221||10629<=n&&n<=10630?"Na":161===n||164===n||167<=n&&n<=168||170===n||173<=n&&n<=174||176<=n&&n<=180||182<=n&&n<=186||188<=n&&n<=191||198===n||208===n||215<=n&&n<=216||222<=n&&n<=225||230===n||232<=n&&n<=234||236<=n&&n<=237||240===n||242<=n&&n<=243||247<=n&&n<=250||252===n||254===n||257===n||273===n||275===n||283===n||294<=n&&n<=295||299===n||305<=n&&n<=307||312===n||319<=n&&n<=322||324===n||328<=n&&n<=331||333===n||338<=n&&n<=339||358<=n&&n<=359||363===n||462===n||464===n||466===n||468===n||470===n||472===n||474===n||476===n||593===n||609===n||708===n||711===n||713<=n&&n<=715||717===n||720===n||728<=n&&n<=731||733===n||735===n||768<=n&&n<=879||913<=n&&n<=929||931<=n&&n<=937||945<=n&&n<=961||963<=n&&n<=969||1025===n||1040<=n&&n<=1103||1105===n||8208===n||8211<=n&&n<=8214||8216<=n&&n<=8217||8220<=n&&n<=8221||8224<=n&&n<=8226||8228<=n&&n<=8231||8240===n||8242<=n&&n<=8243||8245===n||8251===n||8254===n||8308===n||8319===n||8321<=n&&n<=8324||8364===n||8451===n||8453===n||8457===n||8467===n||8470===n||8481<=n&&n<=8482||8486===n||8491===n||8531<=n&&n<=8532||8539<=n&&n<=8542||8544<=n&&n<=8555||8560<=n&&n<=8569||8585===n||8592<=n&&n<=8601||8632<=n&&n<=8633||8658===n||8660===n||8679===n||8704===n||8706<=n&&n<=8707||8711<=n&&n<=8712||8715===n||8719===n||8721===n||8725===n||8730===n||8733<=n&&n<=8736||8739===n||8741===n||8743<=n&&n<=8748||8750===n||8756<=n&&n<=8759||8764<=n&&n<=8765||8776===n||8780===n||8786===n||8800<=n&&n<=8801||8804<=n&&n<=8807||8810<=n&&n<=8811||8814<=n&&n<=8815||8834<=n&&n<=8835||8838<=n&&n<=8839||8853===n||8857===n||8869===n||8895===n||8978===n||9312<=n&&n<=9449||9451<=n&&n<=9547||9552<=n&&n<=9587||9600<=n&&n<=9615||9618<=n&&n<=9621||9632<=n&&n<=9633||9635<=n&&n<=9641||9650<=n&&n<=9651||9654<=n&&n<=9655||9660<=n&&n<=9661||9664<=n&&n<=9665||9670<=n&&n<=9672||9675===n||9678<=n&&n<=9681||9698<=n&&n<=9701||9711===n||9733<=n&&n<=9734||9737===n||9742<=n&&n<=9743||9748<=n&&n<=9749||9756===n||9758===n||9792===n||9794===n||9824<=n&&n<=9825||9827<=n&&n<=9829||9831<=n&&n<=9834||9836<=n&&n<=9837||9839===n||9886<=n&&n<=9887||9918<=n&&n<=9919||9924<=n&&n<=9933||9935<=n&&n<=9953||9955===n||9960<=n&&n<=9983||10045===n||10071===n||10102<=n&&n<=10111||11093<=n&&n<=11097||12872<=n&&n<=12879||57344<=n&&n<=63743||65024<=n&&n<=65039||65533===n||127232<=n&&n<=127242||127248<=n&&n<=127277||127280<=n&&n<=127337||127344<=n&&n<=127386||917760<=n&&n<=917999||983040<=n&&n<=1048573||1048576<=n&&n<=1114109?"A":"N"};function he(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:n=e.fontStyle,fontVariant:s=e.fontVariant,fontWeight:r=e.fontWeight,fontSize:a=e.fontSize,fontFamily:o=e.fontFamily}=t;return(n?n+" ":"")+(s?s+" ":"")+(r?r+" ":"")+a*i+"px "+(o||"sans-serif")}class de{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(),nt(t.specialCharSet)&&(this.specialCharSet=t.specialCharSet),this._standardMethod=nt(t.getTextBounds)?this.fullMeasure.bind(this):this.measureWithNaiveCanvas.bind(this)}initContext(){if(this._notSupportCanvas)return!1;if(it(this._canvas)&&(nt(this._option.getCanvasForMeasure)&&(this._canvas=this._option.getCanvasForMeasure()),it(this._canvas)&&"undefined"!=typeof window&&void 0!==window.document&&globalThis&&nt(globalThis.document)&&(this._canvas=globalThis.document.createElement("canvas"))),it(this._context)&&nt(this._canvas)){const t=this._canvas.getContext("2d");nt(t)&&(t.save(),t.font=he(this.textSpec),this._contextSaved=!0,this._context=t)}return!it(this._context)||(this._notSupportCanvas=!0,!1)}_initSpec(){var t,e,i;const{defaultFontParams:n={}}=this._option,{fontStyle:s=n.fontStyle,fontVariant:r=n.fontVariant,fontWeight:a=(null!==(t=n.fontWeight)&&void 0!==t?t:"normal"),fontSize:o=(null!==(e=n.fontSize)&&void 0!==e?e:12),fontFamily:l=(null!==(i=n.fontFamily)&&void 0!==i?i:"sans-serif"),align:h,textAlign:d=(null!=h?h:"center"),baseline:c,textBaseline:u=(null!=c?c:"middle"),ellipsis:p,limit:g}=this._userSpec;let{lineHeight:f=o}=this._userSpec;if(lt(f)&&"%"===f[f.length-1]){const t=Number.parseFloat(f.substring(0,f.length-1))/100;f=o*t}return{fontStyle:s,fontVariant:r,fontFamily:l,fontSize:o,fontWeight:a,textAlign:d,textBaseline:u,ellipsis:p,limit:g,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(it(t))return{width:0,height:0};if(it(this._option.getTextBounds)||!this._notSupportVRender)return this.measureWithNaiveCanvas(t);const{fontFamily:e,fontSize:i,fontWeight:n,textAlign:s,textBaseline:r,ellipsis:a,limit:o,lineHeight:l}=this.textSpec;let h;try{const d=this._option.getTextBounds({text:t,fontFamily:e,fontSize:i,fontWeight:n,textAlign:s,textBaseline:r,ellipsis:!!a,maxLineWidth:o||1/0,lineHeight:l});h={width:d.width(),height:d.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:n,lineHeight:s}=this.textSpec;return{width:i.width,height:null!==(e=s)&&void 0!==e?e:n,fontBoundingBoxAscent:i.fontBoundingBoxAscent,fontBoundingBoxDescent:i.fontBoundingBoxDescent}}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 n=t[i];let s=this._measureSpecialChar(n);it(s)&&de.NUMBERS_CHAR_SET.includes(n)&&(s=this._measureNumberChar()),it(s)&&["F","W"].includes(le(n))&&(s=this._measureFullSizeChar()),it(s)&&(s=this._measureLetterChar()),e.width+=s.width,e.height=Math.max(e.height,s.height),!it(s.fontBoundingBoxAscent)&&(e.fontBoundingBoxAscent=s.fontBoundingBoxAscent),!it(s.fontBoundingBoxDescent)&&(e.fontBoundingBoxDescent=s.fontBoundingBoxDescent)}return e}quickMeasureWithoutCanvas(t){return this._measureReduce(t,this._quickMeasureWithoutCanvas.bind(this))}_quickMeasureWithoutCanvas(t){var e;const i={width:0,height:0},{fontSize:n,lineHeight:s}=this.textSpec;for(let e=0;e<t.length;e++){const s=t[e],r=["F","W"].includes(le(s))?1:.53;i.width+=r*n}return i.height=null!==(e=s)&&void 0!==e?e:n,i}_measureReduce(t,e){var i;const{fontSize:n,lineHeight:s}=this.textSpec,r={width:0,height:0};if(it(t))return r;if(ht(t)){const a=t.filter(nt).map((t=>t.toString()));return 0===a.length?r:1===a.length?e(a[0]):{width:a.reduce(((t,i)=>Math.max(t,e(i).width)),0),height:a.length*((null!==(i=s)&&void 0!==i?i:n)+1)+1}}return e(t.toString())}_measureNumberChar(){if(it(this._numberCharSize)){const t=this._standardMethod(de.NUMBERS_CHAR_SET);this._numberCharSize={width:t.width/de.NUMBERS_CHAR_SET.length,height:t.height,fontBoundingBoxAscent:t.fontBoundingBoxAscent,fontBoundingBoxDescent:t.fontBoundingBoxDescent}}return this._numberCharSize}_measureFullSizeChar(){return it(this._fullCharSize)&&(this._fullCharSize=this._standardMethod(de.FULL_SIZE_CHAR)),this._fullCharSize}_measureLetterChar(){if(it(this._letterCharSize)){const t=this._standardMethod(de.ALPHABET_CHAR_SET);this._letterCharSize={width:t.width/de.ALPHABET_CHAR_SET.length,height:t.height,fontBoundingBoxAscent:t.fontBoundingBoxAscent,fontBoundingBoxDescent:t.fontBoundingBoxDescent}}return this._letterCharSize}_measureSpecialChar(t){return nt(this._specialCharSizeMap[t])?this._specialCharSizeMap[t]:this.specialCharSet.includes(t)?(this._specialCharSizeMap[t]=this._standardMethod(t),this._specialCharSizeMap[t]):null}release(){nt(this._canvas)&&(this._canvas=null),nt(this._context)&&(this._contextSaved&&(this._context.restore(),this._contextSaved=!1),this._context=null)}}function ce(t,e,i){const{x1:n,y1:s,x2:r,y2:a}=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*n+i.c*s+i.e,i.b*n+i.d*s+i.f),t.add(i.a*r+i.c*s+i.e,i.b*r+i.d*s+i.f),t.add(i.a*r+i.c*a+i.e,i.b*r+i.d*a+i.f),t.add(i.a*n+i.c*a+i.e,i.b*n+i.d*a+i.f),e)}de.ALPHABET_CHAR_SET="abcdefghijklmnopqrstuvwxyz",de.NUMBERS_CHAR_SET="0123456789",de.FULL_SIZE_CHAR="字";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,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;return this.x1=t,this.y1=e,this.x2=i,this.y2=n,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,n=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),n<e?(this.y2=e,this.y1=n):(this.y1=e,this.y2=n),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 ht(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 n=this.rotatedPoints(t,e,i);return this.clear().add(n[0],n[1]).add(n[2],n[3]).add(n[4],n[5]).add(n[6],n[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,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;const s=this.scalePoints(t,e,i,n);return this.clear().add(s[0],s[1]).add(s[2],s[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 ce(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:n,y1:s,x2:r,y2:a}=this,o=Math.cos(t),l=Math.sin(t),h=e-e*o+i*l,d=i-e*l-i*o;return[o*n-l*s+h,l*n+o*s+d,o*n-l*a+h,l*n+o*a+d,o*r-l*s+h,l*r+o*s+d,o*r-l*a+h,l*r+o*a+d]}scalePoints(t,e,i,n){const{x1:s,y1:r,x2:a,y2:o}=this;return[t*s+(1-t)*i,e*r+(1-e)*n,t*a+(1-t)*i,e*o+(1-e)*n]}}class pe extends ue{}class ge extends ue{constructor(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;var i;super(t),t&&(this.angle=null!==(i=t.angle)&&void 0!==i?i:e)}intersects(t){return function(t,e){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];const n=oe(t,i),s=oe(e,i),r=(t,e)=>[e.x-t.x,e.y-t.y],a=r(ae(t),ae(e)),o=r(n[0],n[1]),l=r(n[1],n[2]),h=r(s[0],s[1]),d=r(s[1],s[2]),c=i?Jt(t.angle):t.angle;let u=i?Jt(90-t.angle):t.angle+Nt;const p=i?Jt(e.angle):e.angle;let g=i?Jt(90-e.angle):e.angle+Nt;u>zt&&(u-=zt),g>zt&&(g-=zt);const f=(t,e,i,n)=>{const s=[Math.cos(e),Math.sin(e)];return t+(se(s,i)+se(s,n))/2>se(s,a)};return f((t.x2-t.x1)/2,c,h,d)&&f((t.y2-t.y1)/2,u,h,d)&&f((e.x2-e.x1)/2,p,o,l)&&f((e.y2-e.y1)/2,g,o,l)}(this,t)}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,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0;return super.setValue(t,e,i,n),this.angle=s,this}clone(){return new ge(this)}getRotatedCorners(){const t={x:(this.x1+this.x2)/2,y:(this.y1+this.y2)/2};return[re({x:this.x1,y:this.y1},this.angle,t),re({x:this.x2,y:this.y1},this.angle,t),re({x:this.x1,y:this.y2},this.angle,t),re({x:this.x2,y:this.y2},this.angle,t)]}}class fe{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,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1,s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0,r=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0;this.a=t,this.b=e,this.c=i,this.d=n,this.e=s,this.f=r}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,n,s,r){return!(this.e!==s||this.f!==r||this.a!==t||this.d!==n||this.b!==e||this.c!==i)}setValue(t,e,i,n,s,r){return this.a=t,this.b=e,this.c=i,this.d=n,this.e=s,this.f=r,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,n=this.d,s=this.e,r=this.f,a=new fe,o=t*n-e*i;return a.a=n/o,a.b=-e/o,a.c=-i/o,a.d=t/o,a.e=(i*r-n*s)/o,a.f=-(t*r-e*s)/o,a}rotate(t){const e=Math.cos(t),i=Math.sin(t),n=this.a*e+this.c*i,s=this.b*e+this.d*i,r=this.a*-i+this.c*e,a=this.b*-i+this.d*e;return this.a=n,this.b=s,this.c=r,this.d=a,this}rotateByCenter(t,e,i){const n=Math.cos(t),s=Math.sin(t),r=(1-n)*e+s*i,a=(1-n)*i-s*e,o=n*this.a-s*this.b,l=s*this.a+n*this.b,h=n*this.c-s*this.d,d=s*this.c+n*this.d,c=n*this.e-s*this.f+r,u=s*this.e+n*this.f+a;return this.a=o,this.b=l,this.c=h,this.d=d,this.e=c,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,n,s,r){return this.multiply(t,e,i,n,s,r),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:n,e:s,f:r}=this;return this.a=e,this.b=t,this.c=n,this.d=i,this.e=r,this.f=s,this}multiply(t,e,i,n,s,r){const a=this.a,o=this.b,l=this.c,h=this.d,d=a*t+l*e,c=o*t+h*e,u=a*i+l*n,p=o*i+h*n,g=a*s+l*r+this.e,f=o*s+h*r+this.f;return this.a=d,this.b=c,this.c=u,this.d=p,this.e=g,this.f=f,this}interpolate(t,e){const i=new fe;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:n,c:s,d:r,e:a,f:o}=this,l=i*r-n*s,h=r/l,d=-n/l,c=-s/l,u=i/l,p=(s*o-r*a)/l,g=-(i*o-n*a)/l,{x:f,y:v}=t;e.x=f*h+v*c+p,e.y=f*d+v*u+g}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 fe(this.a,this.b,this.c,this.d,this.e,this.f)}toTransformAttrs(){const t=this.a,e=this.b,i=this.c,n=this.d,s=t*n-e*i,r={x:this.e,y:this.f,rotateDeg:0,scaleX:0,scaleY:0,skewX:0,skewY:0};if(0!==t||0!==e){const a=Math.sqrt(t*t+e*e);r.rotateDeg=e>0?Math.acos(t/a):-Math.acos(t/a),r.scaleX=a,r.scaleY=s/a,r.skewX=(t*i+e*n)/s,r.skewY=0}else if(0!==i||0!==n){const a=Math.sqrt(i*i+n*n);r.rotateDeg=Math.PI/2-(n>0?Math.acos(-i/a):-Math.acos(i/a)),r.scaleX=s/a,r.scaleY=a,r.skewX=0,r.skewY=(t*i+e*n)/s}return r.rotateDeg=180*r.rotateDeg/Math.PI,r}}function ve(t,e,i){e/=100,i/=100;const n=(1-Math.abs(2*i-1))*e,s=n*(1-Math.abs(t/60%2-1)),r=i-n/2;let a=0,o=0,l=0;return 0<=t&&t<60?(a=n,o=s,l=0):60<=t&&t<120?(a=s,o=n,l=0):120<=t&&t<180?(a=0,o=n,l=s):180<=t&&t<240?(a=0,o=s,l=n):240<=t&&t<300?(a=s,o=0,l=n):300<=t&&t<360&&(a=n,o=0,l=s),a=Math.round(255*(a+r)),o=Math.round(255*(o+r)),l=Math.round(255*(l+r)),{r:a,g:o,b:l}}function me(t,e,i){t/=255,e/=255,i/=255;const n=Math.min(t,e,i),s=Math.max(t,e,i),r=s-n;let a=0,o=0,l=0;return a=0===r?0:s===t?(e-i)/r%6:s===e?(i-t)/r+2:(t-e)/r+4,a=Math.round(60*a),a<0&&(a+=360),l=(s+n)/2,o=0===r?0:r/(1-Math.abs(2*l-1)),o=+(100*o).toFixed(1),l=+(100*l).toFixed(1),{h:a,s:o,l:l}}const be=/^#([0-9a-f]{3,8})$/,ye={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 we(t){return ct(t)?new Ae(t>>16,t>>8&255,255&t,1):ht(t)?new Ae(t[0],t[1],t[2]):new Ae(255,255,255)}function Te(t){return t<.04045?.0773993808*t:Math.pow(.9478672986*t+.0521327014,2.4)}function Se(t){return t<.0031308?12.92*t:1.055*Math.pow(t,.41666)-.055}const ke=(t,e)=>{const i=be.exec(t);if(e||i){const t=parseInt(i[1],16),e=i[1].length;return 3===e?new Ae((t>>8&15)+((t>>8&15)<<4),(t>>4&15)+((t>>4&15)<<4),(15&t)+((15&t)<<4),1):6===e?we(t):8===e?new Ae(t>>24&255,t>>16&255,t>>8&255,(255&t)/255):null}};class Be{static Brighter(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;return 1===e?t:new Be(t).brighter(e).toRGBA()}static SetOpacity(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;return 1===e?t:new Be(t).setOpacity(e).toRGBA()}static getColorBrightness(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"hsl";const i=t instanceof Be?t:new Be(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();case"wcag":return i.getLuminanceWCAG()}}static parseColorString(t){if(nt(ye[t]))return function(t){return ct(t)?new Ae(t>>>24,t>>>16&255,t>>>8&255,255&t):ht(t)?new Ae(t[0],t[1],t[2],t[3]):new Ae(255,255,255,1)}(ye[t]);if(nt(xe[t]))return we(xe[t]);const e=`${t}`.trim().toLowerCase(),i=ke(e);if(void 0!==i)return i;if(/^(rgb|RGB|rgba|RGBA)/.test(e)){const t=e.replace(/(?:\(|\)|rgba|RGBA|rgb|RGB)*/g,"").split(",");return new Ae(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=ve(parseInt(t[0],10),parseInt(t[1],10),parseInt(t[2],10));return new Ae(i.r,i.g,i.b,parseFloat(t[3]))}}constructor(t){const e=Be.parseColorString(t);this.color=e||new Ae(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:n}=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(n*t))),this}add(t){const{r:e,g:i,b:n}=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,n+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:n}=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(n*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 n=this.color.opacity,s=me(this.color.r,this.color.g,this.color.b),r=ve(it(t)?s.h:Rt(t,0,360),it(e)?s.s:e>=0&&e<=1?100*e:e,it(i)?s.l:i<=1&&i>=0?100*i:i);return this.color=new Ae(r.r,r.g,r.b,n),this}setRGB(t,e,i){return!it(t)&&(this.color.r=t),!it(e)&&(this.color.g=e),!it(i)&&(this.color.b=i),this}setHex(t){const e=`${t}`.trim().toLowerCase(),i=ke(e,!0);return null!=i?i: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}getLuminanceWCAG(){const t=this.color.r/255,e=this.color.g/255,i=this.color.b/255;let n,s,r;return n=t<=.03928?t/12.92:Math.pow((t+.055)/1.055,2.4),s=e<=.03928?e/12.92:Math.pow((e+.055)/1.055,2.4),r=i<=.03928?i/12.92:Math.pow((i+.055)/1.055,2.4),.2126*n+.7152*s+.0722*r}clone(){return new Be(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=Te(t.color.r),this.color.g=Te(t.color.g),this.color.b=Te(t.color.b),this}copyLinearToSRGB(t){return this.color.r=Se(t.color.r),this.color.g=Se(t.color.g),this.color.b=Se(t.color.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}}class Ae{constructor(t,e,i,n){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)),nt(n)?this.opacity=isNaN(+n)?1:Math.max(0,Math.min(1,+n)):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:n}=me(this.r,this.g,this.b);return`${1===t?"hsl(":"hsla("}${e},${i}%,${n}%${1===t?")":`,${t})`}`}toString(){return this.formatHex()}}function Ce(t){if(ut(t))return[t,t,t,t];if(ht(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,n]=t;return[e,i,n,i]}if(4===e)return t}if(st(t)){const{top:e=0,right:i=0,bottom:n=0,left:s=0}=t;return[e,i,n,s]}return[0,0,0,0]}const Le=Ht-1e-8;class Oe{constructor(t){this.init(t)}init(t){this.bounds=t}arc(t,e,i,n,s,r){if(Math.abs(s-n)>Le)return this.bounds.add(t-i,e-i),void this.bounds.add(t+i,e+i);let a,o,l,h,d=1/0,c=-1/0,u=1/0,p=-1/0;function g(t){l=i*Math.cos(t),h=i*Math.sin(t),l<d&&(d=l),l>c&&(c=l),h<u&&(u=h),h>p&&(p=h)}if(g(n),g(s),s!==n)if((n%=Ht)<0&&(n+=Ht),(s%=Ht)<0&&(s+=Ht),s<n&&(r=!r,a=n,n=s,s=a),r)for(s-=Ht,a=n-n%Nt,o=0;o<4&&a>s;++o,a-=Nt)g(a);else for(a=n-n%Nt+Nt,o=0;o<4&&a<s;++o,a+=Nt)g(a);this.bounds.add(t+d,e+u),this.bounds.add(t+c,e+p)}arcTo(t,e,i,n,s){this.bounds.add(t,e)}bezierCurveTo(t,e,i,n,s,r){this.bounds.add(t,e),this.bounds.add(i,n),this.bounds.add(s,r)}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,n){this.bounds.add(t,e),this.bounds.add(i,n)}rect(t,e,i,n){this.bounds.add(t,e),this.bounds.add(t+i,e+n)}clear(){this.bounds.clear()}release(){}}class Ee{constructor(){this._curves=[],this.bounds=new pe}get curves(){return this._curves}getCurveLengths(){return this._curves.map((t=>t.getLength()))}getPointAt(t){return{x:0,y:0}}getLength(){return 0}getBounds(){return this.bounds}}const Re=/([-+]?((\d+\.\d+)|((\d+)|(\.\d+)))(?:[eE][-+]?\d+)?)/gi,Me={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},Pe=0,De=1,Ie=2,Fe=3,Ne=4,He=5,ze=6,We=7,Ue=8;let je,Ge,Ye,Ve,Xe,Ke;var $e,qe,Ze,Je,Qe,ti,ei,ii,ni;function si(t){const e=t[0],i=t[1],n=t[2],s=t[3],r=t[4],a=t[5],o=t[6],l=t[7],h=l*r,d=-o*a,c=o*r,u=l*a,p=Math.cos(n),g=Math.sin(n),f=Math.cos(s),v=Math.sin(s),m=.5*(s-n),b=Math.sin(.5*m),y=8/3*b*b/Math.sin(m),x=e+p-y*g,_=i+g+y*p,w=e+f,T=i+v,S=w+y*v,k=T-y*f;return[h*x+d*_,c*x+u*_,h*S+d*k,c*S+u*k,h*w+d*T,c*w+u*T]}function ri(t,e,i,n){const s=function(t,e,i,n,s,r,a,o,l){const h=Jt(a),d=Math.sin(h),c=Math.cos(h),u=c*(o-t)*.5+d*(l-e)*.5,p=c*(l-e)*.5-d*(o-t)*.5;let g=u*u/((i=Math.abs(i))*i)+p*p/((n=Math.abs(n))*n);g>1&&(g=Math.sqrt(g),i*=g,n*=g);const f=c/i,v=d/i,m=-d/n,b=c/n,y=f*o+v*l,x=m*o+b*l,_=f*t+v*e,w=m*t+b*e;let T=1/((_-y)*(_-y)+(w-x)*(w-x))-.25;T<0&&(T=0);let S=Math.sqrt(T);r===s&&(S=-S);const k=.5*(y+_)-S*(w-x),B=.5*(x+w)+S*(_-y),A=Math.atan2(x-B,y-k);let C=Math.atan2(w-B,_-k)-A;C<0&&1===r?C+=Ht:C>0&&0===r&&(C-=Ht);const L=Math.ceil(Math.abs(C/(Nt+.001))),O=[];for(let t=0;t<L;++t){const e=A+t*C/L,s=A+(t+1)*C/L;O[t]=[k,B,e,s,i,n,d,c]}return O}(n[5],n[6],n[0],n[1],n[3],n[4],n[2],e,i);for(let e=0;e<s.length;++e){const i=si(s[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"}($e||($e={})),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"}(qe||(qe={})),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"}(Ze||(Ze={})),function(t){t[t.INITIAL=0]="INITIAL",t[t.RUNNING=1]="RUNNING",t[t.PAUSED=2]="PAUSED",t[t.END=3]="END"}(Je||(Je={})),function(t){t[t.NORMAL=0]="NORMAL",t[t.SET_ATTR_IMMEDIATELY=1]="SET_ATTR_IMMEDIATELY"}(Qe||(Qe={})),function(t){t.wait="wait",t.from="from",t.to="to",t.customAnimate="customAnimate"}(ti||(ti={})),function(t){t[t.ROW=1]="ROW",t[t.COLUMN=2]="COLUMN"}(ei||(ei={})),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"}(ii||(ii={})),function(t){t[t.beforeFillStroke=0]="beforeFillStroke",t[t.afterFillStroke=1]="afterFillStroke"}(ni||(ni={}));const ai=[(t,e,i,n,s,r,a)=>e.arc(t[1]*s+i,t[2]*r+n,t[3]*(s+r)/2,t[4],t[5],t[6],a),(t,e,i,n,s,r,a)=>e.arcTo(t[1]*s+i,t[2]*r+n,t[3]*s+i,t[4]*r+n,t[5]*(s+r)/2,a),(t,e,i,n,s,r,a)=>e.bezierCurveTo(t[1]*s+i,t[2]*r+n,t[3]*s+i,t[4]*r+n,t[5]*s+i,t[6]*r+n,a),(t,e,i,n)=>e.closePath(),(t,e,i,n,s,r)=>e.ellipse(t[1]*s+i,t[2]*r+n,t[3]*s,t[4]*r,t[5],t[6],t[7],t[8]),(t,e,i,n,s,r,a)=>e.lineTo(t[1]*s+i,t[2]*r+n,a),(t,e,i,n,s,r,a)=>e.moveTo(t[1]*s+i,t[2]*r+n,a),(t,e,i,n,s,r,a)=>e.quadraticCurveTo(t[1]*s+i,t[2]*r+n,t[3]*s+i,t[4]*r+n,a),(t,e,i,n,s,r,a)=>e.rect(t[1]*s+i,t[2]*r+n,t[3]*s,t[4]*r,a)];function oi(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1,r=arguments.length>5&&void 0!==arguments[5]?arguments[5]:1,a=arguments.length>6?arguments[6]:void 0;for(let o=0;o<t.length;o++){const l=t[o];ai[l[0]](l,e,i,n,s,r,a)}}class li{getLength(t){return null!=t?this.calcProjLength(t):(Number.isFinite(this.length)||(this.length=this.calcLength()),this.length)}}function hi(t,e){let i=0;const n=t.length;for(let s=0;s<n;s++){const r=t[s],a=e[s],o=t[(s+1)%n],l=e[(s+1)%n];i+=Zt.distanceNN(r,a,o,l)}return i/2}function di(t,e,i,n,s){const r=1-s;return r*r*r*t+3*e*s*r*r+3*i*s*s*r+n*s*s*s}function ci(t,e,i,n,s){const r=di(t.x,e.x,i.x,n.x,s),a=di(t.y,e.y,i.y,n.y,s);return new qt(r,a)}function ui(t,e,i,n){const s=1-n;return s*s*t+2*s*n*e+n*n*i}function pi(t,e,i,n){const s=ui(t.x,e.x,i.x,n),r=ui(t.y,e.y,i.y,n);return new qt(s,r)}class gi extends li{constructor(t,e,i){super(),this.type=ii.QuadraticBezierCurve,this.p0=t,this.p1=e,this.p2=i}_validPoint(){return Number.isFinite(this.p0.x+this.p0.y+this.p1.x+this.p1.y+this.p2.x+this.p2.y)}getPointAt(t){if(!1!==this.defined)return pi(this.p0,this.p1,this.p2,t);throw new Error("defined为false的点不能getPointAt")}calcLength(){return this._validPoint()?(t=this.p0,e=this.p1,i=this.p2,hi([t.x,e.x,i.x],[t.y,e.y,i.y])):60;var t,e,i}calcProjLength(t){return t===ei.ROW?Wt(this.p0.x-this.p2.x):t===ei.COLUMN?Wt(this.p0.y-this.p2.y):0}getAngleAt(t){const e=Gt(t-.01,0),i=Yt(t+.01,1),n=this.getPointAt(e),s=this.getPointAt(i);return Ut(s.y-n.y,s.x-n.x)}draw(t,e,i,n,s,r){if(t.moveTo(this.p0.x*n+e,this.p0.y*s+i),r>=1)t.quadraticCurveTo(this.p1.x*n+e,this.p1.y*s+i,this.p2.x*n+e,this.p2.y*s+i);else if(r>0){const[a]=function(t,e){const{p0:i,p1:n,p2:s}=t,r=pi(i,n,s,e),a=Zt.pointAtPP(i,n,e),o=Zt.pointAtPP(n,s,e);return[new gi(i,a,r),new gi(r,o,s)]}(this,r);t.quadraticCurveTo(a.p1.x*n+e,a.p1.y*s+i,a.p2.x*n+e,a.p2.y*s+i)}}getYAt(t){throw new Error("QuadraticBezierCurve暂不支持getYAt")}includeX(t){throw new Error("QuadraticBezierCurve暂不支持includeX")}}function fi(t,e){const{p0:i,p1:n,p2:s,p3:r}=t,a=ci(i,n,s,r,e),o=Zt.pointAtPP(i,n,e),l=Zt.pointAtPP(n,s,e),h=Zt.pointAtPP(s,r,e),d=Zt.pointAtPP(o,l,e),c=Zt.pointAtPP(l,h,e);return[new vi(i,o,d,a),new vi(a,c,h,r)]}class vi extends li{constructor(t,e,i,n){super(),this.type=ii.CubicBezierCurve,this.p0=t,this.p1=e,this.p2=i,this.p3=n}_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 ci(this.p0,this.p1,this.p2,this.p3,t);throw new Error("defined为false的点不能getPointAt")}calcLength(){return this._validPoint()?(t=this.p0,e=this.p1,i=this.p2,n=this.p3,hi([t.x,e.x,i.x,n.x],[t.y,e.y,i.y,n.y])):60;var t,e,i,n}calcProjLength(t){return t===ei.ROW?Wt(this.p0.x-this.p3.x):t===ei.COLUMN?Wt(this.p0.y-this.p3.y):0}getAngleAt(t){const e=Gt(t-.01,0),i=Yt(t+.01,1),n=this.getPointAt(e),s=this.getPointAt(i);return Ut(s.y-n.y,s.x-n.x)}draw(t,e,i,n,s,r){if(t.moveTo(this.p0.x*n+e,this.p0.y*s+i),r>=1)t.bezierCurveTo(this.p1.x*n+e,this.p1.y*s+i,this.p2.x*n+e,this.p2.y*s+i,this.p3.x*n+e,this.p3.y*s+i);else if(r>0){const[a]=fi(this,r);t.bezierCurveTo(a.p1.x*n+e,a.p1.y*s+i,a.p2.x*n+e,a.p2.y*s+i,a.p3.x*n+e,a.p3.y*s+i)}}includeX(t){const e=Yt(this.p0.x,this.p1.x,this.p2.x,this.p3.x),i=Gt(this.p0.x,this.p1.x,this.p2.x,this.p3.x);return t>=e&&t<=i}getYAt(t){const e=Yt(this.p0.x,this.p1.x,this.p2.x,this.p3.x),i=(t-e)/(Gt(this.p0.x,this.p1.x,this.p2.x,this.p3.x)-e);return this.getPointAt(i).y}}function mi(t,e){const{p0:i,p1:n}=t,s=Zt.pointAtPP(i,n,e);return[new bi(i,s),new bi(s,n)]}class bi extends li{constructor(t,e){super(),this.type=ii.LineCurve,this.p0=t,this.p1=e}getPointAt(t){if(!1!==this.defined)return Zt.pointAtPP(this.p0,this.p1,t);throw new Error("defined为false的点不能getPointAt")}getAngleAt(t){return null==this.angle&&(this.angle=Ut(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()?Zt.distancePP(this.p0,this.p1):60}calcProjLength(t){return t===ei.ROW?Wt(this.p0.x-this.p1.x):t===ei.COLUMN?Wt(this.p0.y-this.p1.y):0}draw(t,e,i,n,s,r){if(t.moveTo(this.p0.x*n+e,this.p0.y*s+i),r>=1)t.lineTo(this.p1.x*n+e,this.p1.y*s+i);else if(r>0){const a=this.getPointAt(r);t.lineTo(a.x*n+e,a.y*s+i)}}includeX(t){return t>=this.p0.x&&t<=this.p1.x||t>=this.p1.x&&t<=this.p0.x}getYAt(t){if(this.includeX(t)){let e=this.p0,i=this.p1;this.p0.x>this.p1.x&&(e=this.p1,i=this.p0);const n=(t-e.x)/(i.x-e.x);return e.y+n*(i.y-e.y)}return 1/0}}class yi{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,n,s,r,a,o){const l=new vi(new qt(this._lastX,this._lastY),new qt(t,e),new qt(i,n),new qt(s,r));l.originP1=this._lastOriginP,l.originP2=o,l.defined=a,this.curves.push(l),this._lastX=s,this._lastY=r,this._lastOriginP=o}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,n){const s=this.addLinearCurve(t,e,i,this._lastOriginP,n);this.curves.push(s),this._lastX=t,this._lastY=e,this._lastOriginP=n}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,n){throw new Error("SegContext不支持调用quadraticCurveTo")}clear(){this.curves=[],this.length=NaN}tryUpdateLength(t){return this.getLength(t)}addLinearCurve(t,e,i,n,s){const r=new bi(new qt(this._lastX,this._lastY),new qt(t,e));return r.originP1=n,r.originP2=s,r.defined=i,r}getPointAt(t){throw new Error("暂未实现")}getCurveLengths(){return[]}getLength(t){var e,i;if(t===ei.COLUMN){if(!this.curves.length)return 0;const t=this.curves[0],i=this.curves[this.curves.length-1],n=null!==(e=i.p3)&&void 0!==e?e:i.p1;return Wt(t.p0.y-n.y)}if(t===ei.ROW){if(!this.curves.length)return 0;const t=this.curves[0],e=this.curves[this.curves.length-1],n=null!==(i=e.p3)&&void 0!==i?i:e.p1;return Wt(t.p0.x-n.x)}return Number.isFinite(this.length)||(this.length=this.curves.reduce(((t,e)=>t+e.getLength()),0)),this.length}}class xi extends yi{bezierCurveTo(t,e,i,n,s,r,a,o){return super.bezierCurveTo(e,t,n,i,r,s,a,o)}lineTo(t,e,i,n){return super.lineTo(e,t,i,n)}moveTo(t,e,i){return super.moveTo(e,t,i)}clear(){return super.clear()}}function _i(t,e){let i=!1;for(let n=0,s=e.length;n<=s;n++)n>=s===i&&((i=!i)?t.lineStart():t.lineEnd()),i&&t.point(e[n])}function wi(t,e,i){const n=null!=e?e:Wt(i[i.length-1].x-i[0].x)>Wt(i[i.length-1].y-i[0].y)?ei.ROW:ei.COLUMN;return"monotoneY"===t?new xi(t,n):new yi(t,n)}class Ti{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 Si(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{direction:i,startPoint:n}=e;if(t.length<2-Number(!!n))return null;const s=wi("linear",i,t);return function(t,e){_i(t,e)}(new Ti(s,n),t),s}function ki(t,e,i,n,s){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,n,t.lastPoint1)}class Bi{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 Ai(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{direction:i,startPoint:n}=e;if(t.length<2-Number(!!n))return null;if(t.length<3-Number(!!n))return Si(t,e);const s=wi("basis",i,t);return function(t,e){_i(t,e)}(new Bi(s,n),t),s}function Ci(t){return t<0?-1:1}function Li(t,e,i){const n=t._x1-t._x0,s=e-t._x1,r=(t._y1-t._y0)/(n||Number(s<0&&-0)),a=(i-t._y1)/(s||Number(n<0&&-0)),o=(r*s+a*n)/(n+s);return(Ci(r)+Ci(a))*Math.min(Math.abs(r),Math.abs(a),.5*Math.abs(o))||0}function Oi(t,e){const i=t._x1-t._x0;return i?(3*(t._y1-t._y0)/i-e)/2:e}function Ei(t,e,i,n,s){const r=t._x0,a=t._y0,o=t._x1,l=t._y1,h=(o-r)/3;t.context.bezierCurveTo(r+h,a+h*e,o-h,l-h*i,o,l,n,t.lastPoint1)}class Ri{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:Ei(this,this._t0,Oi(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,n=t.y;switch(this._point){case 0:this._point=1,this._line?this.context.lineTo(i,n,!1!==this._lastDefined1&&!1!==this._lastDefined2,t):this.context.moveTo(i,n,t);break;case 1:this._point=2;break;case 2:this._point=3,Ei(this,Oi(this,e=Li(this,i,n)),e,!1!==this._lastDefined1&&!1!==this._lastDefined2);break;default:Ei(this,this._t0,e=Li(this,i,n),!1!==this._lastDefined1&&!1!==this._lastDefined2)}this._x0=this._x1,this._x1=i,this._y0=this._y1,this._y1=n,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 Mi extends Ri{constructor(t,e){super(t,e)}point(t){return super.point({y:t.x,x:t.y,defined:t.defined})}}function Pi(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{direction:i,startPoint:n}=e;if(t.length<2-Number(!!n))return null;if(t.length<3-Number(!!n))return Si(t,e);const s=wi("monotoneX",i,t);return function(t,e){_i(t,e)}(new Ri(s,n),t),s}function Di(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{direction:i,startPoint:n}=e;if(t.length<2-Number(!!n))return null;if(t.length<3-Number(!!n))return Si(t,e);const s=wi("monotoneY",i,t);return function(t,e){_i(t,e)}(new Mi(s,n),t),s}let Ii=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 n=this._x*(1-this._t)+e*this._t;.5===this._t?this.context.lineTo(n,this._y,!1!==this._lastDefined,this.lastPoint):this.context.lineTo(n,this._y,!1!==this._lastDefined&&!1!==t.defined,this.lastPoint),this.context.lineTo(n,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()}};class Fi extends Ii{lineEnd(){this.context.closePath()}}function Ni(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const{direction:n,startPoint:s}=i;if(t.length<2-Number(!!s))return null;const r=new yi("step",null!=n?n:Wt(t[t.length-1].x-t[0].x)>Wt(t[t.length-1].y-t[0].y)?ei.ROW:ei.COLUMN);return Hi(new Ii(r,e,s),t),r}function Hi(t,e){return _i(t,e)}class zi extends Ti{lineEnd(){this.context.closePath()}}function Wi(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{direction:i,startPoint:n}=e;if(t.length<2-Number(!!n))return null;const s=wi("linear",i,t);return function(t,e){_i(t,e)}(new zi(s,n),t),s}function Ui(t,e,i,n,s){let r=t._x1,a=t._y1,o=t._x2,l=t._y2;if(t._l01_a>It){const e=2*t._l01_2a+3*t._l01_a*t._l12_a+t._l12_2a,i=3*t._l01_a*(t._l01_a+t._l12_a);r=(r*e-t._x0*t._l12_2a+t._x2*t._l01_2a)/i,a=(a*e-t._y0*t._l12_2a+t._y2*t._l01_2a)/i}if(t._l23_a>It){const n=2*t._l23_2a+3*t._l23_a*t._l12_a+t._l12_2a,s=3*t._l23_a*(t._l23_a+t._l12_a);o=(o*n+t._x1*t._l23_2a-e*t._l12_2a)/s,l=(l*n+t._y1*t._l23_2a-i*t._l12_2a)/s}t.context.bezierCurveTo(r,a,o,l,t._x2,t._y2,n,t.lastPoint1)}function ji(t,e){return function(i,n){let s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const{direction:r,startPoint:a}=s;if(i.length<2-Number(!!a))return null;if(i.length<3-Number(!!a))return Si(i,s);const o=wi(t,r,i);return _i(new e(o,n,a),i),o}}const Gi=ji("catmullRom",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.startPoint=i,this._alpha=e}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0}lineEnd(){switch(this._point){case 2:this.context.lineTo(this._x2,this._y2,!1!==this._lastDefined1&&!1!==this._lastDefined2,this.lastPoint1);break;case 3:this.point({x:this._x2,y:this._y2})}(this._line||0!==this._line&&1===this._point)&&this.context.closePath(),this._line=1-this._line}point(t){const{x:e,y:i}=t;if(this._point){const t=this._x2-e,n=this._y2-i;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(t*t+n*n,this._alpha))}switch(this._point){case 0:this._point=1,this._line?this.context.lineTo(e,i,!1!==this._lastDefined1&&!1!==this._lastDefined2):this.context.moveTo(e,i);break;case 1:this._point=2;break;case 2:this._point=3;default:Ui(this,e,i,!1!==this._lastDefined1&&!1!==this._lastDefined2)}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=i,this._lastDefined1=this._lastDefined2,this._lastDefined2=t.defined,this.lastPoint0=this.lastPoint1,this.lastPoint1=t}tryUpdateLength(){return this.context.tryUpdateLength()}});const Yi=ji("catmullRomClosed",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.startPoint=i,this._alpha=e}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._x0=this._x1=this._x2=this._x3=this._x4=this._x5=this._y0=this._y1=this._y2=this._y3=this._y4=this._y5=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0}lineEnd(){switch(this._point){case 1:this.context.moveTo(this._x3,this._y3,this.lastPoint1),this.context.closePath();break;case 2:this.context.lineTo(this._x3,this._y3,!1!==this._lastDefined1&&!1!==this._lastDefined2,this.lastPoint1),this.context.closePath();break;case 3:this.point({x:this._x3,y:this._y3}),this.point({x:this._x4,y:this._y4}),this.point({x:this._x5,y:this._y5})}}point(t){const{x:e,y:i}=t;if(this._point){const t=this._x2-e,n=this._y2-i;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(t*t+n*n,this._alpha))}switch(this._point){case 0:this._point=1,this._x3=e,this._y3=i;break;case 1:this._point=2,this.context.moveTo(this._x4=e,this._y4=i,t);break;case 2:this._point=3,this._x5=e,this._y5=i;break;default:Ui(this,e,i,!1!==this._lastDefined1&&!1!==this._lastDefined2)}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=i,this._lastDefined1=this._lastDefined2,this._lastDefined2=t.defined,this.lastPoint0=this.lastPoint1,this.lastPoint1=t}tryUpdateLength(){return this.context.tryUpdateLength()}});class Vi{constructor(t){this.path=t,this._lastX=this._lastY=this._startX=this._startY=0}moveTo(t,e){return this._lastX=this._startX=t,this._lastY=this._startY=e,this}lineTo(t,e){const i=this.addLinearCurve(t,e);this.path.addCurve(i),this._lastX=t,this._lastY=e}addLinearCurve(t,e){return new bi(new qt(this._lastX,this._lastY),new qt(t,e))}quadraticCurveTo(t,e,i,n){const s=new gi(new qt(this._lastX,this._lastY),new qt(t,e),new qt(i,n));this.path.addCurve(s),this._lastX=i,this._lastY=n}bezierCurveTo(t,e,i,n,s,r){const a=new vi(new qt(this._lastX,this._lastY),new qt(t,e),new qt(i,n),new qt(s,r));this.path.addCurve(a),this._lastX=s,this._lastY=r}arcTo(t,e,i,n,s){throw new Error("CurveContext不支持调用arcTo")}ellipse(t,e,i,n,s,r,a,o){throw new Error("CurveContext不支持调用ellipse")}rect(t,e,i,n){throw new Error("CurveContext不支持调用rect")}arc(t,e,i,n,s,r){throw new Error("CurveContext不支持调用arc")}closePath(){this.path.curves.length<2||this.lineTo(this._startX,this._startY)}}function Xi(t,e,i){var n,s;switch(e){case"linear":default:return Si(t,i);case"basis":return Ai(t,i);case"monotoneX":return Pi(t,i);case"monotoneY":return Di(t,i);case"step":return Ni(t,.5,i);case"stepClosed":return function(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const{direction:n,startPoint:s}=i;if(t.length<2-Number(!!s))return null;const r=new yi("step",null!=n?n:Wt(t[t.length-1].x-t[0].x)>Wt(t[t.length-1].y-t[0].y)?ei.ROW:ei.COLUMN);return Hi(new Fi(r,e,s),t),r}(t,.5,i);case"stepBefore":return Ni(t,0,i);case"stepAfter":return Ni(t,1,i);case"catmullRom":return Gi(t,null!==(n=null==i?void 0:i.curveTension)&&void 0!==n?n:.5,i);case"catmullRomClosed":return Yi(t,null!==(s=null==i?void 0:i.curveTension)&&void 0!==s?s:.5,i);case"linearClosed":return Wi(t,i)}}class Ki extends Ee{constructor(t){super(),this.commandList=[],t&&(this._ctx=t),this._boundsContext=new Oe(this.bounds)}get curves(){return this.tryBuildCurves()}setCtx(t){this._ctx=t}moveTo(t,e){return this.commandList.push([ze,t,e]),this._ctx&&this._ctx.moveTo(t,e),this}lineTo(t,e){return this.commandList.push([He,t,e]),this._ctx&&this._ctx.lineTo(t,e),this}quadraticCurveTo(t,e,i,n){return this.commandList.push([We,t,e,i,n]),this._ctx&&this._ctx.quadraticCurveTo(t,e,i,n),this}bezierCurveTo(t,e,i,n,s,r){return this.commandList.push([Ie,t,e,i,n,s,r]),this._ctx&&this._ctx.bezierCurveTo(t,e,i,n,s,r),this}arcTo(t,e,i,n,s){return this.commandList.push([De,t,e,i,n,s]),this._ctx&&this._ctx.arcTo(t,e,i,n,s),this}ellipse(t,e,i,n,s,r,a,o){return this.commandList.push([Ne,t,e,i,n,s,r,a,o]),this._ctx&&this._ctx.ellipse(t,e,i,n,s,r,a,o),this}rect(t,e,i,n){return this.commandList.push([Ue,t,e,i,n]),this._ctx&&this._ctx.rect(t,e,i,n),this}arc(t,e,i,n,s,r){return this.commandList.push([Pe,t,e,i,n,s,r]),this._ctx&&this._ctx.arc(t,e,i,n,s,r),this}closePath(){return this.commandList.push([Fe]),this._ctx&&this._ctx.closePath(),this}addCurve(t){this._curves.push(t)}clear(){this.transformCbList=null,this.commandList.length=0,this._curves.length=0}beginPath(){this.clear()}tryBuildCurves(){if(!this._curves||!this._curves.length){const t=new Vi(this);oi(this.commandList,t,0,0,1,1)}return this._curves}toString(){if(!this.toStringCbList){const t=[];t[ze]=t=>`M${t[1]} ${t[2]}`,t[He]=t=>`L${t[1]} ${t[2]}`,t[We]=t=>`Q${t[1]} ${t[2]} ${t[3]} ${t[4]}`,t[Ie]=t=>`C${t[1]} ${t[2]} ${t[3]} ${t[4]} ${t[5]} ${t[6]}`,t[Pe]=t=>{const e=[];((t,e,i,n,s,r,a)=>{const o=Math.abs(i-e),l=o>.5*Math.PI?Math.ceil(2*o/Math.PI):1,h=(i-e)/l;for(let i=0;i<l;i++){const o=e+h*i,l=e+h*(i+1),d=4*Math.tan(Math.abs(h)/4)/3,c=l<o?-1:1,u=Math.cos(o),p=Math.sin(o),g=Math.cos(l),f=Math.sin(l),v=u*r+n,m=p*a+s,b=g*r+n,y=f*a+s,x=r*d*c,_=a*d*c;t.push(v-x*p,m+_*u,b+x*f,y-_*g,b,y)}})(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[Ue]=t=>`M${t[1]} ${t[2]} h${t[3]} v${t[4]} H${t[1]}Z`,t[Fe]=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,n,s){this.clear();const r=function(t){if(!t)return[];const e=t.match(/[mzlhvcsqta][^mzlhvcsqta]*/gi);if(null===e)return[];let i,n;const s=[];for(let t=0,r=e.length;t<r;t++)if(je=e[t],Ge=je.slice(1),Ye=je[0],i=[Ye],n=Ge.match(Re),null!==n){for(let t=0,e=n.length;t<e;t++)Ve=n[t],Xe=parseFloat(Ve),Number.isNaN(Xe)||i.push(Xe);if(Ke=Me[Ye],i.length-1>Ke){let t,e=Ye;for(let n=1,r=i.length;n<r;n+=Ke){t=[e];for(let e=n,s=n+Ke;e<s;e++)t.push(i[e]);s.push(t),"m"===e?e="l":"M"===e&&(e="L")}}else s.push(i)}else s.push(i);return s}(t);return this._runCommandStrList(r,e,i,n,s),this._updateBounds(),this}fromLine(t){const{points:e,curveType:i,clipRangeByDimension:n}=t.attribute;if(!e)return;const s=Xi(e,i);"x"===n?this.direction=ei.ROW:"y"===n?this.direction=ei.COLUMN:"auto"===n&&(this.direction=s.direction),this._curves=s.curves}fromCustomPath2D(t,e,i,n,s){return this.clear(),this._runCommandList(t.commandList,e,i,n,s),this._updateBounds(),this}transform(t,e,i,n){const s=this.commandList;if(!this.transformCbList){const t=[];t[ze]=this.moveToTransform,t[He]=this.lineToTransform,t[We]=this.quadraticCurveToTransform,t[Ie]=this.bezierCurveToTransform,t[De]=this.arcToTransform,t[Ne]=this.ellipseTransform,t[Ue]=this.rectTransform,t[Pe]=this.arcTransform,t[Fe]=this.closePathTransform,this.transformCbList=t}s.forEach((s=>{this.transformCbList[s[0]](s,t,e,i,n)})),this._updateBounds()}moveToTransform(t,e,i,n,s){t[1]=t[1]*n+e,t[2]=t[2]*s+i}lineToTransform(t,e,i,n,s){t[1]=t[1]*n+e,t[2]=t[2]*s+i}quadraticCurveToTransform(t,e,i,n,s){t[1]=t[1]*n+e,t[2]=t[2]*s+i,t[3]=t[3]*n+e,t[4]=t[4]*s+i}bezierCurveToTransform(t,e,i,n,s){t[1]=t[1]*n+e,t[2]=t[2]*s+i,t[3]=t[3]*n+e,t[4]=t[4]*s+i,t[5]=t[5]*n+e,t[6]=t[6]*s+i}arcToTransform(t,e,i,n,s){t[1]=t[1]*n+e,t[2]=t[2]*s+i,t[3]=t[3]*n+e,t[4]=t[4]*s+i,t[5]=t[5]*(n+s)/2}ellipseTransform(t,e,i,n,s){t[1]=t[1]*n+e,t[2]=t[2]*s+i,t[3]=t[3]*n,t[4]=t[4]*s}rectTransform(t,e,i,n,s){t[1]=t[1]*n+e,t[2]=t[2]*s+i,t[3]=t[3]*n,t[4]=t[4]*s}arcTransform(t,e,i,n,s){t[1]=t[1]*n+e,t[2]=t[2]*s+i,t[3]=t[3]*(n+s)/2}closePathTransform(){}_runCommandStrList(t){let e,i,n,s,r,a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,o=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,d=null,c=0,u=0,p=0,g=0;for(let f=0,v=t.length;f<v;++f){switch(e=t[f],1===l&&1===h||(e=qi(e,l,h)),e[0]){case"l":c+=e[1],u+=e[2],this.lineTo(c+a,u+o);break;case"L":c=e[1],u=e[2],this.lineTo(c+a,u+o);break;case"h":c+=e[1],this.lineTo(c+a,u+o);break;case"H":c=e[1],this.lineTo(c+a,u+o);break;case"v":u+=e[1],this.lineTo(c+a,u+o);break;case"V":u=e[1],this.lineTo(c+a,u+o);break;case"m":c+=e[1],u+=e[2],this.moveTo(c+a,u+o);break;case"M":c=e[1],u=e[2],this.moveTo(c+a,u+o);break;case"c":i=c+e[5],n=u+e[6],p=c+e[3],g=u+e[4],this.bezierCurveTo(c+e[1]+a,u+e[2]+o,p+a,g+o,i+a,n+o),c=i,u=n;break;case"C":c=e[5],u=e[6],p=e[3],g=e[4],this.bezierCurveTo(e[1]+a,e[2]+o,p+a,g+o,c+a,u+o);break;case"s":i=c+e[3],n=u+e[4],null===d[0].match(/[CcSs]/)?(p=c,g=u):(p=2*c-p,g=2*u-g),s=c+e[1],r=u+e[2],this.bezierCurveTo(p+a,g+o,s+a,r+o,i+a,n+o),p=s,g=r,c=i,u=n;break;case"S":i=e[3],n=e[4],null===d[0].match(/[CcSs]/)?(p=c,g=u):(p=2*c-p,g=2*u-g),s=e[1],r=e[2],this.bezierCurveTo(p+a,g+o,s+a,r+o,i+a,n+o),p=s,g=r,c=i,u=n;break;case"q":i=c+e[3],n=u+e[4],p=c+e[1],g=u+e[2],this.quadraticCurveTo(p+a,g+o,i+a,n+o),c=i,u=n;break;case"Q":i=e[3],n=e[4],this.quadraticCurveTo(e[1]+a,e[2]+o,i+a,n+o),c=i,u=n,p=e[1],g=e[2];break;case"t":i=c+e[1],n=u+e[2],null===d[0].match(/[QqTt]/)?(p=c,g=u):"t"===d[0]?(p=2*c-s,g=2*u-r):"q"===d[0]&&(p=2*c-p,g=2*u-g),s=p,r=g,this.quadraticCurveTo(p+a,g+o,i+a,n+o),c=i,u=n,p=c+e[1],g=u+e[2];break;case"T":i=e[1],n=e[2],p=2*c-p,g=2*u-g,this.quadraticCurveTo(p+a,g+o,i+a,n+o),c=i,u=n;break;case"a":ri(this,c+a,u+o,[e[1],e[2],e[3],e[4],e[5],e[6]+c+a,e[7]+u+o]),c+=e[6],u+=e[7];break;case"A":ri(this,c+a,u+o,[e[1],e[2],e[3],e[4],e[5],e[6]+a,e[7]+o]),c=e[6],u=e[7];break;case"z":case"Z":this.closePath()}d=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,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1,s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1;if(0!==e||0!==i||1!==n||1!==s)for(let r=0,a=t.length;r<a;++r){const a=t[r].slice();switch(a[0]){case He:this.lineToTransform(a,e,i,n,s);break;case ze:this.moveToTransform(a,e,i,n,s);break;case Ie:this.bezierCurveToTransform(a,e,i,n,s);break;case We:this.quadraticCurveToTransform(a,e,i,n,s);break;case Pe:this.arcToTransform(a,e,i,n,s);break;case Ne:this.ellipseTransform(a,e,i,n,s);break;case Ue:this.rectTransform(a,e,i,n,s);break;case De:this.arcToTransform(a,e,i,n,s);break;case Fe:this.closePath()}}else this.commandList=t.map((t=>t.slice()))}_updateBounds(){this.bounds.clear(),oi(this.commandList,this._boundsContext)}release(){this.commandList=[],this._boundsContext=null,this._ctx=null}getLength(){if(this.direction===ei.COLUMN){if(!this._curves.length)return 0;const t=this._curves[0],e=this._curves[this._curves.length-1];return Wt(t.p0.y-e.p1.y)}if(this.direction===ei.ROW){if(!this._curves.length)return 0;const t=this._curves[0],e=this._curves[this._curves.length-1];return Wt(t.p0.x-e.p1.x)}return this._curves.reduce(((t,e)=>t+e.getLength()),0)}getYAt(t){if(!this.curves)return 1/0;for(let e=0;e<this.curves.length;e++){const i=this.curves[e];if(i.includeX(t))return i.getYAt(t)}return 1/0}getAttrAt(t){if(!this._curves)return{pos:{x:0,y:0},angle:0};let e,i=0;for(let n=0;n<this._curves.length;n++){e=this._curves[n];const s=e.getLength(this.direction);if(i+s>=t)break;i+=s}const n=(t-i)/e.getLength(this.direction);return{pos:e.getPointAt(n),angle:e.getAngleAt(n)}}drawWithClipRange(t,e,i,n,s){this.tryBuildCurves();const r=this.getLength()*s;let a=0;for(let s=0;s<this._curves.length;s++){const o=this._curves[s],l=o.getLength(this.direction);if(!(a+l<=r)){const s=1-(a+l-r)/l;o.draw(t,i,n,e,e,s);break}o.draw(t,i,n,e,e,1),a+=l}}}const $i=["l",0,0,0,0,0,0,0];function qi(t,e,i){const n=$i[0]=t[0];if("a"===n||"A"===n)$i[1]=e*t[1],$i[2]=i*t[2],$i[3]=t[3],$i[4]=t[4],$i[5]=t[5],$i[6]=e*t[6],$i[7]=i*t[7];else if("h"===n||"H"===n)$i[1]=e*t[1];else if("v"===n||"V"===n)$i[1]=i*t[1];else for(let n=1,s=t.length;n<s;++n)$i[n]=(n%2==1?e:i)*t[n];return $i}const Zi={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 fe},Ji={strokeOpacity:1,lineDash:[],lineDashOffset:0,lineWidth:1,lineCap:"butt",lineJoin:"miter",miterLimit:10,strokeBoundsBuffer:2,stroke:!1},Qi=Object.assign({outerBorder:Object.assign(Object.assign({},Ji),{distance:0}),innerBorder:Object.assign(Object.assign({},Ji),{distance:0})},Ji),tn={text:"",maxLineWidth:1/0,maxWidth: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",underlineDash:[],underlineOffset:0,disableAutoClipedPoptip:void 0,measureMode:$.fontBounding,keepCenterInLine:!1},en=Object.assign(Object.assign(Object.assign(Object.assign({forceBoundsWidth:void 0,forceBoundsHeight:void 0,opacity:1,background:null,autoAnimateTexture:!1,textureRatio:1,textureOptions:null,backgroundOpacity:1,backgroundCornerRadius:0,texture:null,textureColor:"black",textureSize:10,texturePadding:2,backgroundMode:"no-repeat",backgroundFit:!0,backgroundKeepAspectRatio:!1,backgroundClip:!0,backgroundScale:1,backgroundOffsetX:0,backgroundOffsetY:0,blur:0,filter:"",cursor:null,html:null,react:null,vue:null},{fillOpacity:1,fill:!1,shadowBlur:0,shadowColor:"black",shadowOffsetX:0,shadowOffsetY:0}),Qi),{alignSelf:"auto"}),{pickStrokeBuffer:0}),nn={connectedType:"none",connectedStyle:{},connectedX:NaN,connectedY:NaN},sn=Object.assign(Object.assign(Object.assign({strokeSeg:null,renderable:!0,pickable:!0,shadowGraphic:void 0,childrenPickable:!0,fillPickable:!0,strokePickable:!0,visible:!0,zIndex:0,layout:null,boundsPadding:0,fillStrokeOrder:0,renderStyle:"default",pickMode:"accurate",customPickShape:null,boundsMode:"accurate",keepDirIn3d:!0,shadowRootIdx:1,globalZIndex:1,globalCompositeOperation:"",overflow:"hidden",shadowPickMode:"graphic",keepStrokeScale:!1,clipConfig:null},{_debug_bounds:!1}),en),Zi),rn=Object.assign(Object.assign({},sn),{startAngle:0,endAngle:zt,innerRadius:0,outerRadius:1,innerPadding:0,outerPadding:0,cornerRadius:0,padRadius:0,padAngle:0,cap:!1,forceShowCap:!1}),an=Object.assign(Object.assign(Object.assign({},sn),nn),{points:[],segments:[],curveType:"linear",clipRange:1,closePath:!1,curveTension:1}),on=Object.assign(Object.assign({},sn),{radius:1,startAngle:0,endAngle:zt}),ln=Object.assign(Object.assign({},sn),{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",baseOpacity:1,cornerType:"round"}),hn=Object.assign(Object.assign({},sn),{path:"",width:0,height:0,cornerRadius:0,clip:!1}),dn=Object.assign(Object.assign(Object.assign({},sn),nn),{points:[],segments:[],curveType:"linear",clipRange:1,clipRangeByDimension:"default",closePath:!1,curveTension:1}),cn=Object.assign(Object.assign({},sn),{path:new Ki,fillStrokeOrder:1,clipRange:1,customPath:()=>{Ot.getInstance().warn("空函数")}}),un=Object.assign(Object.assign({},sn),{points:[],cornerRadius:0,closePath:!0}),pn=Object.assign(Object.assign({},sn),{width:100,height:100,spikes:5,thickness:.5}),gn=Object.assign(Object.assign({},sn),{width:0,height:0,x1:0,y1:0,strokeBoundsBuffer:0,cornerRadius:0,cornerType:"round"});Object.assign(Object.assign({},sn),{width:0,height:0,x1:0,y1:0,cornerRadius:0,length:0,cornerType:"round"});const fn=Object.assign(Object.assign({},sn),{symbolType:"circle",size:10,keepDirIn3d:!0,clipRange:1}),vn=Object.assign(Object.assign(Object.assign({},sn),tn),{strokeBoundsBuffer:0,keepDirIn3d:!0}),mn=Object.assign(Object.assign(Object.assign({},sn),tn),{upgradeAttrs:null,editable:!1,editOptions:null,ascentDescentMode:"actual",width:300,height:300,ellipsis:!0,wordBreak:"break-word",verticalDirection:"top",textAlign:"left",textBaseline:"top",layoutDirection:"horizontal",textConfig:[],disableAutoWrapLine:!1,maxHeight:void 0,maxWidth:void 0,singleLine:!1}),bn=Object.assign(Object.assign({repeatX:"no-repeat",repeatY:"no-repeat",image:"",width:0,height:0,maxWidth:500,maxHeight:500},sn),{fill:!0,cornerRadius:0,cornerType:"round"}),yn=Object.assign(Object.assign({},bn),{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 xn=new class{},_n=function(){const t={linearGradient:/^(linear\-gradient)/i,radialGradient:/^(radial\-gradient)/i,conicGradient:/^(conic\-gradient)/i,sideOrCorner:/^to (left (top|bottom)|right (top|bottom)|top (left|right)|bottom (left|right)|left|right|top|bottom)/i,extentKeywords:/^(closest\-side|closest\-corner|farthest\-side|farthest\-corner|contain|cover)/,positionKeywords:/^(left|center|right|top|bottom)/i,pixelValue:/^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))px/,percentageValue:/^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))\%/,emValue:/^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))em/,angleValue:/^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))deg/,fromAngleValue:/^from\s*(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))deg/,startCall:/^\(/,endCall:/^\)/,comma:/^,/,hexColor:/(^\#[0-9a-fA-F]+)/,literalColor:/^([a-zA-Z]+)/,rgbColor:/^(rgb\(\d{1,3},\s*\d{1,3},\s*\d{1,3}\))/i,rgbaColor:/^(rgba\(\d{1,3},\s*\d{1,3},\s*\d{1,3},\s*((\d\.\d+)|\d{1,3})\))/i,number:/^(([0-9]*\.[0-9]+)|([0-9]+\.?))/};let e="";function i(t){const i=new Error(e+": "+t);throw i.source=e,i}function n(){return s("linear",t.linearGradient,r)||s("radial",t.radialGradient,o)||s("conic",t.conicGradient,a)}function s(e,n,s){return function(n,r){const a=m(n);if(a){m(t.startCall)||i("Missing (");const n=function(n){const r=s();return r&&(m(t.comma)||i("Missing comma before color stops")),{type:e,orientation:r,colorStops:u(p)}}();return m(t.endCall)||i("Missing )"),n}}(n)}function r(){return v("directional",t.sideOrCorner,1)||v("angular",t.angleValue,1)}function a(){return v("angular",t.fromAngleValue,1)}function o(){let i,n,s=l();return s&&(i=[],i.push(s),n=e,m(t.comma)&&(s=l(),s?i.push(s):e=n)),i}function l(){let t=function(){const t=v("shape",/^(circle)/i,0);return t&&(t.style=f()||h()),t}()||function(){const t=v("shape",/^(ellipse)/i,0);return t&&(t.style=g()||h()),t}();if(t)t.at=d();else{const e=h();if(e){t=e;const i=d();i&&(t.at=i)}else{const e=c();e&&(t={type:"default-radial",at:e})}}return t}function h(){return v("extent-keyword",t.extentKeywords,1)}function d(){if(v("position",/^at/,0)){const t=c();return t||i("Missing positioning value"),t}}function c(){const t={x:g(),y:g()};if(t.x||t.y)return{type:"position",value:t}}function u(e){let n=e();const s=[];if(n)for(s.push(n);m(t.comma);)n=e(),n?s.push(n):i("One extra comma");return s}function p(){const e=v("hex",t.hexColor,1)||v("rgba",t.rgbaColor,1)||v("rgb",t.rgbColor,1)||v("literal",t.literalColor,0);return e||i("Expected color definition"),e.length=g(),e}function g(){return v("%",t.percentageValue,1)||v("position-keyword",t.positionKeywords,1)||f()}function f(){return v("px",t.pixelValue,1)||v("em",t.emValue,1)}function v(t,e,i){const n=m(e);if(n)return{type:t,value:n[i]}}function m(t){const i=/^[\n\r\t\s]+/.exec(e);i&&b(i[0].length);const n=t.exec(e);return n&&b(n[0].length),n}function b(t){e=e.substr(t)}return function(t){return e=t.toString(),function(){const t=u(n);return e.length>0&&i("Invalid input not EOF"),t}()}}();class wn{static IsGradient(t){return!("string"==typeof t&&!t.includes("gradient"))}static IsGradientStr(t){return"string"==typeof t&&t.includes("gradient")}static Parse(t){if(wn.IsGradientStr(t))try{const e=_n(t)[0];if(e){if("linear"===e.type)return wn.ParseLinear(e);if("radial"===e.type)return wn.ParseRadial(e);if("conic"===e.type)return wn.ParseConic(e)}}catch(e){return t}return t}static ParseConic(t){const{orientation:e,colorStops:i=[]}=t,n=Ft/2,s=parseFloat(e.value)/180*Ft-n;return{gradient:"conical",x:.5,y:.5,startAngle:s,endAngle:s+zt,stops:i.map((t=>({color:t.value,offset:parseFloat(t.length.value)/100})))}}static ParseRadial(t){const{colorStops:e=[]}=t;return{gradient:"radial",x0:.5,y0:.5,x1:.5,y1:.5,r0:0,r1:1,stops:e.map((t=>({color:t.value,offset:parseFloat(t.length.value)/100})))}}static ParseLinear(t){const{orientation:e,colorStops:i=[]}=t,n=Ft/2;let s="angular"===e.type?parseFloat(e.value)/180*Ft:0;for(;s<0;)s+=zt;for(;s>=zt;)s-=zt;let r=0,a=0,o=0,l=0;return s<n?(r=0,a=1,o=Math.sin(s),l=a-Math.cos(s)):s<Ft?(r=0,a=0,o=Math.cos(s-n),l=Math.sin(s-n)):s<Ft+n?(r=1,a=0,o=r-Math.sin(s-Ft),l=Math.cos(s-Ft)):(r=1,o=r-Math.cos(s-n-Ft),l-=Math.sin(s-n-Ft)),{gradient:"linear",x0:r,y0:a,x1:o,y1:l,stops:i.map((t=>({color:t.value,offset:parseFloat(t.length.value)/100})))}}}function Tn(t,e,i){let n=e;const{a:s,b:r,c:a,d:o}=t.currentMatrix,l=Math.sign(s)*Math.sqrt(s*s+r*r),h=Math.sign(o)*Math.sqrt(a*a+o*o);return l+h===0?0:(n=n/Math.abs(l+h)*2*i,n)}function Sn(t,e,i){let n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0;var r,a,o,l;if(!e||!0===e)return"black";let h,d;if(ht(e))for(let t=0;t<e.length&&(d=e[t],!d);t++);else d=e;if(d=wn.Parse(d),"string"==typeof d)return d;if(i.AABBBounds&&(!i.attribute||0!==i.attribute.scaleX||0!==i.attribute.scaleY)){const e=i.AABBBounds;let c=e.x2-e.x1,u=e.y2-e.y1,p=e.x1-n,g=e.y1-s;if(i.attribute){const{scaleX:t=1,scaleY:e=1,angle:n=0}=i.attribute;c/=t,u/=e,p/=t,g/=e,(n||1!==t||1!==e)&&(p=null!==(r=i.x1WithoutTransform)&&void 0!==r?r:0,g=null!==(a=i.y1WithoutTransform)&&void 0!==a?a:0,c=null!==(o=i.widthWithoutTransform)&&void 0!==o?o:c,u=null!==(l=i.heightWithoutTransform)&&void 0!==l?l:u)}"linear"===d.gradient?h=function(t,e,i,n,s,r){var a,o,l,h;const d=t.createLinearGradient(i+(null!==(a=e.x0)&&void 0!==a?a:0)*s,n+(null!==(o=e.y0)&&void 0!==o?o:0)*r,i+(null!==(l=e.x1)&&void 0!==l?l:1)*s,n+(null!==(h=e.y1)&&void 0!==h?h:0)*r);return e.stops.forEach((t=>{d.addColorStop(t.offset,t.color)})),d}(t,d,p,g,c,u):"conical"===d.gradient?h=function(t,e,i,n,s,r){var a,o;const l=t.createConicGradient(i+(null!==(a=e.x)&&void 0!==a?a:0)*s,n+(null!==(o=e.y)&&void 0!==o?o:0)*r,e.startAngle,e.endAngle);return e.stops.forEach((t=>{l.addColorStop(t.offset,t.color)})),l.GetPattern?l.GetPattern(s+i,r+n,void 0):l}(t,d,p,g,c,u):"radial"===d.gradient&&(h=function(t,e,i,n,s,r){var a,o,l,h,d,c;const u=t.createRadialGradient(i+(null!==(a=e.x0)&&void 0!==a?a:.5)*s,n+(null!==(o=e.y0)&&void 0!==o?o:.5)*r,Math.max(s,r)*(null!==(l=e.r0)&&void 0!==l?l:0),i+(null!==(h=e.x1)&&void 0!==h?h:.5)*s,n+(null!==(d=e.y1)&&void 0!==d?d:.5)*r,Math.max(s,r)*(null!==(c=e.r1)&&void 0!==c?c:.5));return e.stops.forEach((t=>{u.addColorStop(t.offset,t.color)})),u}(t,d,p,g,c,u))}return h||"orange"}const kn=/\w|\(|\)|-/,Bn=/[.?!,;:/,。?!、;:]/;function An(t,e){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2],n=e;for(;kn.test(t[n-1])&&kn.test(t[n])||Bn.test(t[n]);)if(n--,n<=0)return i?Cn(t,e):e;return n}function Cn(t,e){let i=e;for(;kn.test(t[i+1])&&kn.test(t[i])||Bn.test(t[i]);)if(i++,i>=t.length)return i;return i+1}var Ln=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let On=class{configure(t,e){this.canvas=t.canvas,this.context=t.context,t.bindTextMeasure(this)}_measureTextWithoutAlignBaseline(t,e,i){this.context.setTextStyleWithoutAlignBaseline(e);const n=this.context.measureText(t);return i?this.compatibleMetrics(n,e):n}_measureTextWithAlignBaseline(t,e,i){this.context.setTextStyle(e);const n=this.context.measureText(t);return i?this.compatibleMetrics(n,e):n}compatibleMetrics(t,e){if(null==t.actualBoundingBoxAscent||null==t.actualBoundingBoxDescent||null==t.fontBoundingBoxAscent||null==t.fontBoundingBoxDescent){t={width:t.width};const{ascent:i,descent:n}=this.measureTextBoundADscentEstimate(e);t.actualBoundingBoxAscent=i,t.actualBoundingBoxDescent=n,t.fontBoundingBoxAscent=i,t.fontBoundingBoxDescent=n}if(null==t.actualBoundingBoxLeft||null==t.actualBoundingBoxRight){t={width:t.width,actualBoundingBoxAscent:t.actualBoundingBoxAscent,actualBoundingBoxDescent:t.actualBoundingBoxDescent,fontBoundingBoxAscent:t.fontBoundingBoxAscent,fontBoundingBoxDescent:t.fontBoundingBoxDescent};const{left:i,right:n}=this.measureTextBoundLeftRightEstimate(e);t.actualBoundingBoxLeft=i,t.actualBoundingBoxRight=n}return t}estimate(t,e){let{fontSize:i=vn.fontSize}=e,n=0,s=0;for(let e=0;e<t.length;e++)t.charCodeAt(e)<128?n++:s++;return{width:~~(.8*n*i+s*i),height:i}}measureTextWidth(t,e,i){return this.context?(i=null!=i?i:this._measureTextWithoutAlignBaseline(t,e)).width:this.estimate(t,e).width}measureTextBoundsWidth(t,e,i){return this.context?(i=null!=i?i:this._measureTextWithoutAlignBaseline(t,e)).width:this.estimate(t,e).width}measureTextBoundsLeftRight(t,e,i){return this.context?{left:(i=null!=i?i:this._measureTextWithAlignBaseline(t,e,!0)).actualBoundingBoxLeft,right:i.actualBoundingBoxRight}:this.measureTextBoundLeftRightEstimate(e)}measureTextPixelHeight(t,e,i){var n;return this.context?(i=null!=i?i:this._measureTextWithoutAlignBaseline(t,e,!0),Math.abs(i.actualBoundingBoxAscent-i.actualBoundingBoxDescent)):null!==(n=e.fontSize)&&void 0!==n?n:tn.fontSize}measureTextPixelADscent(t,e,i){return this.context?{ascent:(i=null!=i?i:this._measureTextWithAlignBaseline(t,e,!0)).actualBoundingBoxAscent,descent:i.actualBoundingBoxDescent}:this.measureTextBoundADscentEstimate(e)}measureTextBoundHieght(t,e,i){var n;return this.context?(i=null!=i?i:this._measureTextWithoutAlignBaseline(t,e,!0),Math.abs(i.fontBoundingBoxAscent-i.fontBoundingBoxDescent)):null!==(n=e.fontSize)&&void 0!==n?n:tn.fontSize}measureTextBoundADscent(t,e,i){return this.context?{ascent:(i=null!=i?i:this._measureTextWithAlignBaseline(t,e,!0)).fontBoundingBoxAscent,descent:i.fontBoundingBoxDescent}:this.measureTextBoundADscentEstimate(e)}measureTextBoundADscentEstimate(t){var e;const i=null!==(e=t.fontSize)&&void 0!==e?e:tn.fontSize;return{ascent:.79*i,descent:.21*i}}measureTextBoundLeftRightEstimate(t){var e;const i=null!==(e=t.fontSize)&&void 0!==e?e:tn.fontSize,{textAlign:n}=t;return"center"===n?{left:i/2,right:i/2}:"right"===n||"end"===n?{left:i,right:0}:{left:0,right:i}}measureTextPixelADscentAndWidth(t,e,i){if(!this.context)return Object.assign(Object.assign({},this.measureTextBoundADscentEstimate(e)),{width:this.estimate(t,e).width});const n=this._measureTextWithoutAlignBaseline(t,e,!0);if(i===$.actualBounding)return{ascent:n.actualBoundingBoxAscent,descent:n.actualBoundingBoxDescent,width:n.width};if(i===$.estimate)return Object.assign(Object.assign({},this.measureTextBoundADscentEstimate(e)),{width:n.width});if(i===$.fontBounding){let t=n.fontBoundingBoxAscent,e=n.fontBoundingBoxDescent;if(n.actualBoundingBoxDescent&&e<n.actualBoundingBoxDescent){const i=n.actualBoundingBoxDescent-e;e+=i,t-=i}else if(n.actualBoundingBoxAscent&&t<n.actualBoundingBoxAscent){const i=n.actualBoundingBoxAscent-t;t+=i,e-=i}return{ascent:t,descent:e,width:n.width}}return{ascent:n.actualBoundingBoxAscent,descent:n.actualBoundingBoxDescent,width:n.width}}measureText(t,e){return this.context?(this.context.setTextStyleWithoutAlignBaseline(e),this.context.measureText(t)):this.estimate(t,e)}clipTextVertical(t,e,i,n){if(0===t.length)return{verticalList:t,width:0};const{fontSize:s=12}=e;t.forEach((t=>{t.width=0===t.direction?s:this.measureTextWidth(t.text,e)}));const r=[];let a=0,o=0;for(;o<t.length&&a+t[o].width<i;o++)a+=t[o].width,r.push(t[o]);if(t[o]&&t[o].text.length>1){const s=this._clipText(t[o].text,e,i-a,0,t[o].text.length-1,"end",!1);if(n&&s.str!==t[o].text){let i="",n=0;for(let e=0;e<o;e++){const s=t[e];i+=s.text,n+=s.text.length}i+=t[o].text;let r=An(i,n+s.str.length);r-=n,r!==s.str.length-1&&(s.str=s.str.substring(0,r),s.width=this.measureTextWidth(s.str,e))}r.push(Object.assign(Object.assign({},t[o]),{text:s.str,width:s.width})),a+=s.width}return{verticalList:r,width:a}}clipText(t,e,i,n,s){if(0===t.length)return{str:"",width:0};let r=this.measureTextWidth(t,e);if(r<=i)return{str:t,width:r};if(r=this.measureTextWidth(t[0],e),r>i)return{str:"",width:0};const a=this._clipText(t,e,i,0,t.length-1,"end",!1);if(n&&a.str!==t){let i=An(t,a.str.length,s);i!==a.str.length&&(i>a.str.length&&(a.wordBreaked=i,i=a.str.length),a.str=t.substring(0,i),a.width=this.measureTextWidth(a.str,e))}return a}_clipText(t,e,i,n,s,r,a){let o;if("start"===r)o=this._clipTextStart(t,e,i,n,s),a&&(o.result=a+o.str);else if("middle"===r){const n=this._clipTextMiddle(t,e,i,"","",0,0,1);o={str:"none",width:n.width,result:n.left+a+n.right}}else o=this._clipTextEnd(t,e,i,n,s),a&&(o.result=o.str+a);return o}_clipTextEnd(t,e,i,n,s){if(n===s){Ot.getInstance().warn(`【_clipTextEnd】不应该走到这里${t}, ${n}, ${s}`);const i=t.substring(0,s+1);return{str:i,width:this.measureTextWidth(i,e)}}const r=Math.floor((n+s)/2),a=t.substring(0,r+1),o=this.measureTextWidth(a,e);let l;if(o>i){if(a.length<=1)return{str:"",width:0};const s=t.substring(0,r);return l=this.measureTextWidth(s,e),l<=i?{str:s,width:l}:this._clipTextEnd(t,e,i,n,r)}if(o<i){if(r>=t.length-1)return{str:t,width:this.measureTextWidth(t,e)};const n=t.substring(0,r+2);return l=this.measureTextWidth(n,e),l>=i?{str:a,width:o}:this._clipTextEnd(t,e,i,r,s)}return{str:a,width:o}}_clipTextStart(t,e,i,n,s){const r=Math.ceil((n+s)/2),a=t.substring(r-1,t.length),o=this.measureTextWidth(a,e);let l;if(o>i){if(a.length<=1)return{str:"",width:0};const n=t.substring(r,t.length);return l=this.measureTextWidth(n,e),l<=i?{str:n,width:l}:this._clipTextStart(t,e,i,r,t.length)}if(o<i){if(r<=0)return{str:t,width:this.measureTextWidth(t,e)};const s=t.substring(r-2,t.length);return l=this.measureTextWidth(s,e),l>=i?{str:a,width:o}:this._clipTextStart(t,e,i,n,r)}return{str:a,width:o}}_clipTextMiddle(t,e,i,n,s,r,a,o){const l=t.substring(0,o),h=this.measureTextWidth(l,e);if(h+a>i)return{left:n,right:s,width:r+a};const d=t.substring(t.length-o,t.length),c=this.measureTextWidth(d,e);return h+c>i?{left:l,right:s,width:h+a}:this._clipTextMiddle(t,e,i,l,d,h,c,o+1)}clipTextWithSuffixVertical(t,e,i,n,s,r){if(""===n)return this.clipTextVertical(t,e,i,s);if(0===t.length)return{verticalList:t,width:0};const a=this.clipTextVertical(t,e,i,s);if(a.verticalList.length===t.length&&a.verticalList[a.verticalList.length-1].width===t[t.length-1].width)return a;const o=this.measureTextWidth(n,e);if(o>i)return a;let l;if(i-=o,"start"===r){const r=this.revertVerticalList(t);l=this.clipTextVertical(r,e,i,s);const a=this.revertVerticalList(l.verticalList);a.unshift({text:n,direction:1,width:o}),l.verticalList=a}else if("middle"===r){const r=this.clipTextVertical(t,e,i/2,s),a=this.revertVerticalList(t),h=this.clipTextVertical(a,e,i/2,s);r.verticalList.push({text:n,direction:1,width:o}),this.revertVerticalList(h.verticalList).forEach((t=>r.verticalList.push(t))),l={verticalList:r.verticalList,width:r.width+h.width}}else l=this.clipTextVertical(t,e,i,s),l.verticalList.push({text:n,direction:1,width:o});return l.width+=o,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,n,s,r){let a=arguments.length>6&&void 0!==arguments[6]&&arguments[6];if(""===n)return this.clipText(t,e,i,s);if(0===t.length)return{str:"",width:0};const o=this.measureTextWidth(t,e);if(!a&&o<=i)return{str:t,width:o};const l=this.measureTextWidth(n,e);if(l>i)return{str:"",width:0};if(a&&o+l<=i)return{str:t+n,width:o+l};i-=l;const h=this._clipText(t,e,i,0,t.length-1,r,n);if(s&&h.str!==t){const i=An(t,h.str.length);i!==h.str.length&&(h.result=t.substring(0,i),h.width=this.measureTextWidth(h.str,e))}else a&&h.str===t&&(h.result=t+n);return h.str=h.result,h.width+=l,h}};On=Ln([y()],On);var En=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};const Rn=Symbol.for("TextMeasureContribution");let Mn=class extends On{};Mn=En([y()],Mn);const Pn=new class{constructor(t){const e=t||{};e.defaultScope=e.defaultScope||w,this.options=e,this.id=r.GenAutoIncrementId(),this._bindingDictionary=new Map,this._metadataReader=new O}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 n=this._getNotAllArgs(t,!1,e,i);return this._get(n)}getNamed(t,e){return this.getTagged(t,o,e)}isBound(t){return this._bindingDictionary.has(t)}bind(t){const e=this.options.defaultScope,i=new L(t,e),n=this._bindingDictionary.get(t)||[];return n.push(i),this._bindingDictionary.set(t,n),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 n=this.bind(i);return t(n,e),n},i=()=>t=>this.unbind(t),n=()=>t=>this.isBound(t),s=e=>i=>{const n=this.rebind(i);return t(n,e),n};return t=>({bindFunction:e(t),isboundFunction:n(),rebindFunction:s(t),unbindFunction:i(),unbindAsyncFunction:t=>null})}_getNotAllArgs(t,e,i,n){return{avoidConstraints:!1,isMultiInject:e,serviceIdentifier:t,key:i,value:n}}_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),n=Object.keys(i),s=[];for(let t=0;t<n.length;t++){const e=i[t],n={};e.forEach((t=>{n[t.key]=t.value}));const r={inject:n[l],multiInject:n[h]},a=r.inject||r.multiInject,o={serviceIdentifier:a,constructorArgsMetadata:e},d=(this._bindingDictionary.get(a)||[]).filter((t=>t.constraint(o)));if(d.length){const t={injectIdentifier:a,metadata:e,bindings:d};s.push(t)}}return s}_resolveFromBinding(t){const e=this._getResolvedFromBinding(t);return this._saveToScope(t,e),e}_getResolvedFromBinding(t){let e;switch(t.type){case T:case B:e=t.cache;break;case A: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===_&&(t.cache=e,t.activated=!0)}},Dn=Symbol.for("CanvasFactory");function In(t){return Pn.getNamed(Dn,xn.global.env)(t)}function Fn(t){return"number"==typeof t&&Number.isFinite(t)}const Nn=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=In(Object.assign({nativeCanvas:xn.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=In(Object.assign({nativeCanvas:xn.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 Hn=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},zn=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const Wn=Symbol.for("VWindow"),Un=Symbol.for("WindowHandlerContribution");let jn=class extends j{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(){super(),this.hooks={onChange:new z(["x","y","width","height"])},this.active=()=>{const t=this.global;t.env&&!this.actived&&(Pn.getNamed(Un,t.env).configure(this,t),this.actived=!0)},this._uid=r.GenAutoIncrementId(),this.global=xn.global,this.postInit()}_nativeAddEventListener(t,e,i){return this._handler.addEventListener(t,e,i)}_nativeRemoveEventListener(t,e,i){return this._handler.removeEventListener(t,e,i)}_nativeDispatchEvent(t){return this._handler.dispatchEvent(t)}postInit(){this.global.hooks.onSetEnv.tap("window",this.active),this.active()}get style(){var t;return null!==(t=this._handler.getStyle())&&void 0!==t?t:{}}set style(t){this._handler.setStyle(t)}create(t){var e,i;this._handler.createWindow(t);const n=this._handler.getWH();this._width=n.width,this._height=n.height,t.viewBox?this.setViewBox(t.viewBox):!1!==t.canvasControled?this.setViewBox({x1:0,y1:0,x2:this._width,y2:this._height}):this.setViewBox({x1:0,y1:0,x2:null!==(e=t.width)&&void 0!==e?e:this._width,y2:null!==(i=t.height)&&void 0!==i?i:this._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.global.hooks.onSetEnv.unTap("window",this.active),this.clearAllEventListeners(),this._handler.releaseWindow()}getContext(){return this._handler.getContext()}getNativeHandler(){return this._handler.getNativeHandler()}getImageBuffer(t){return this._handler.getImageBuffer?this._handler.getImageBuffer(t):null}getBoundingClientRect(){return this._handler.getBoundingClientRect()}getContainer(){return this._handler.container}clearViewBox(t){this._handler.clearViewBox(t)}setViewBox(t){this._handler.setViewBox(t)}setViewBoxTransform(t,e,i,n,s,r){this._handler.setViewBoxTransform(t,e,i,n,s,r)}getViewBox(){return this._handler.getViewBox()}getViewBoxTransform(){return this._handler.getViewBoxTransform()}pointTransform(t,e){const i=this._handler.getViewBox(),n={x:t,y:e};return this._handler.getViewBoxTransform().transformPoint({x:t,y:e},n),n.x-=i.x1,n.y-=i.y1,n}hasSubView(){const t=this._handler.getViewBox();return!(0===t.x1&&0===t.y1&&Et(this.width,t.width())&&Et(this.height,t.height()))}isVisible(t){return this._handler.isVisible(t)}onVisibleChange(t){return this._handler.onVisibleChange(t)}getTopLeft(t){return this._handler.getTopLeft(t)}};jn=Hn([y(),zn("design:paramtypes",[])],jn);var Gn=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Yn=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Vn=function(t,e){return function(i,n){e(i,n,t)}};let Xn=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=xn.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=Nn.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 n;this.configure(this.global,this.global.env);const s=this.global.measureTextMethod;this.global.measureTextMethod=i;const r={width:this._textMeasure.measureTextWidth(t,e),height:null!==(n=e.fontSize)&&void 0!==n?n:tn.fontSize};return this.global.measureTextMethod=s,r}createTextMeasureInstance(t,e,i){return this.configure(this.global,this.global.env),new de(Object.assign({defaultFontParams:{fontFamily:tn.fontFamily,fontSize:tn.fontSize},getCanvasForMeasure:i||(()=>this.canvas),getTextBounds:void 0,specialCharSet:"-/: .,@%'\"~"+de.ALPHABET_CHAR_SET+de.ALPHABET_CHAR_SET.toUpperCase()},null!=e?e:{}),t)}drawGraphicToCanvas(t,e,i){if(!e.defaultLayer)return null;const n=Pn.get(Wn),s=t.AABBBounds,r=s.width(),a=s.height(),o=-s.x1,l=-s.y1;n.create({viewBox:{x1:o,y1:l,x2:s.x2,y2:s.y2},width:r,height:a,canvas:i,dpr:e.window.dpr,canvasControled:!0,offscreen:!0,title:""});const h=e.params.optimize.disableCheckGraphicWidthOutRange;e.params.optimize.disableCheckGraphicWidthOutRange=!0,e.defaultLayer.getNativeHandler().drawTo(n,[t],{transMatrix:n.getViewBoxTransform(),viewBox:n.getViewBox(),stage:e,layer:e.defaultLayer,renderService:e.renderService,background:"transparent",clear:!0,updateBounds:!1}),e.params.optimize.disableCheckGraphicWidthOutRange=h;const d=n.getNativeHandler();return d.nativeCanvas?d.nativeCanvas:null}};var Kn;Xn=Gn([y(),Vn(0,m(D)),Vn(0,x(Rn)),Yn("design:paramtypes",[Object])],Xn),function(t){t[t.transform=0]="transform",t[t.matrix=1]="matrix"}(Kn||(Kn={}));const $n=new fe;let qn=class{constructor(){this.matrix=new fe}init(t){return this.mode=Kn.transform,this.originTransform=t,this.matrix.reset(),this}fromMatrix(t,e){return this.mode=Kn.matrix,this.outSourceMatrix=t,this.outTargetMatrix=e,this}scaleMatrix(t,e,i){const n=this.outSourceMatrix;if($n.setValue(n.a,n.b,n.c,n.d,n.e,n.f),this.outTargetMatrix.reset(),i){const{x:n,y:s}=i;this.outTargetMatrix.translate(n,s),this.outTargetMatrix.scale(t,e),this.outTargetMatrix.translate(-n,-s)}else this.outTargetMatrix.scale(t,e);return this.outTargetMatrix.multiply($n.a,$n.b,$n.c,$n.d,$n.e,$n.f),this}rotateMatrix(t,e){const i=this.outSourceMatrix;if($n.setValue(i.a,i.b,i.c,i.d,i.e,i.f),this.outTargetMatrix.reset(),e){const{x:i,y:n}=e;this.outTargetMatrix.translate(i,n),this.outTargetMatrix.rotate(t),this.outTargetMatrix.translate(-i,-n)}else this.outTargetMatrix.rotate(t);return this.outTargetMatrix.multiply($n.a,$n.b,$n.c,$n.d,$n.e,$n.f),this}scale(t,e,i){return this.mode===Kn.matrix?this.scaleMatrix(t,e,i):this}rotate(t,e){return this.mode===Kn.matrix?this.rotateMatrix(t,e):this}translateMatrix(t,e){const i=this.outSourceMatrix;return $n.setValue(i.a,i.b,i.c,i.d,i.e,i.f),this.outTargetMatrix.reset(),this.outTargetMatrix.translate(t,e),this.outTargetMatrix.multiply($n.a,$n.b,$n.c,$n.d,$n.e,$n.f),this}translate(t,e){return this.mode===Kn.matrix?this.translateMatrix(t,e):this}simplify(t){return this.mode===Kn.matrix?this.simplifyMatrix(t):this}simplifyMatrix(t){return this}};qn=Gn([y(),Yn("design:paramtypes",[])],qn);const Zn={arc:rn,area:an,circle:on,line:dn,path:cn,symbol:fn,text:vn,rect:gn,polygon:un,star:pn,richtext:mn,richtextIcon:yn,image:bn,group:ln,glyph:hn},Jn=Object.keys(Zn);function Qn(t,e){Object.keys(e).forEach((i=>{t[i]=e[i]}))}const ts={arc:Object.assign({},Zn.arc),area:Object.assign({},Zn.area),circle:Object.assign({},Zn.circle),line:Object.assign({},Zn.line),path:Object.assign({},Zn.path),symbol:Object.assign({},Zn.symbol),text:Object.assign({},Zn.text),rect:Object.assign({},Zn.rect),polygon:Object.assign({},Zn.polygon),star:Object.assign({},Zn.star),richtext:Object.assign({},Zn.richtext),richtextIcon:Object.assign({},Zn.richtextIcon),image:Object.assign({},Zn.image),group:Object.assign({},Zn.group),glyph:Object.assign({},Zn.glyph)};class es{constructor(){this.initTheme(),this.dirty=!1}initTheme(){this._defaultTheme={},Jn.forEach((t=>{this._defaultTheme[t]=Object.create(ts[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 n=this.getParentWithTheme(t);if(n){const t=n.theme;(t.dirty||i)&&t.applyTheme(n,e,!0)}this.userTheme?this.doCombine(n&&n.theme.combinedTheme):(n?this.combinedTheme=n.theme.combinedTheme:(this.combinedTheme=this._defaultTheme,Ot.getInstance().warn("未知错误,走到不应该走的区域里")),this.dirty=!1)}return this.combinedTheme}doCombine(t){const e=this.userTheme,i=this.combinedTheme;Jn.forEach((n=>{const s=Object.create(ts[n]);t&&t[n]&&Qn(s,t[n]),i[n]&&Qn(s,i[n]),e[n]&&Qn(s,e[n]),this.combinedTheme[n]=s})),e.common&&Jn.forEach((t=>{Qn(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 is=new es;function ns(t,e){return t.glyphHost?ns(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)):is.getTheme()}return null}(t)||t.attachedThemeGraphic&&ns(t.attachedThemeGraphic)||is.getTheme()}var ss=function(t,e,i,n){return new(i||(i=Promise))((function(s,r){function a(t){try{l(n.next(t))}catch(t){r(t)}}function o(t){try{l(n.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?s(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((n=n.apply(t,e||[])).next())}))};class rs extends J{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=r.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 ss(this,void 0,void 0,(function*(){if(e){let e=this._lastChild,i=0;for(;e;){let n=t(e,i++);if(n.then&&(n=yield n),n)return;e=e._prev}}else{let e=this._firstChild,i=0;for(;e;){let n=t(e,i++);if(n.then&&(n=yield n),n)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===t||t===e)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===t||t===e)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&&Ot.getInstance().warn("insertIntoKeepIdx和insertInto混用可能会存在错误"),e>=this.childrenCount)return this.appendChild(t);if(this===t)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 n=this.insertInto(t,0);return this._ignoreWarn=!1,n}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(t){if(!this._idMap)return;this._nodeList&&(this._nodeList.length=0);let e=this._firstChild;for(;e;){const t=e._next;e.parent=null,e._prev=null,e._next=null,e=e._next,e=t}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,n)=>!(e===this||!t(e,n)||(i=e,0)))),e&&this.forEachChildren((e=>{if(e.isContainer){const n=e.find(t,!0);if(n)return i=n,!0}return!1})),i}findAll(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=[];return this.forEachChildren(((e,n)=>{e!==this&&t(e,n)&&i.push(e)})),e&&this.forEachChildren((e=>{if(e.isContainer){const n=e.findAll(t,!0);n.length&&(i=i.concat(n))}})),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 n=tt(i,!0)&&i||st(i)&&i.capture,s=st(i)&&i.once,r=et(e)?void 0:e;return t=n?`${t}capture`:t,e=et(e)?e:e.handleEvent,s?super.once(t,e,r):super.on(t,e,r),this}on(t,e,i){return this.addEventListener(t,e,i)}removeEventListener(t,e,i){const n=tt(i,!0)&&i||st(i)&&i.capture,s=et(e)?void 0:e;t=n?`${t}capture`:t,e=et(e)?e:e.handleEvent;const r=st(i)&&i.once;return super.off(t,e,s,r),this}off(t,e,i){return this.removeEventListener(t,e,i)}once(t,e,i){return st(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),n=1;n<e;n++)i[n-1]=arguments[n];return super.emit(t.type,t,...i),!t.defaultPrevented}emit(t,e){return this.dispatchEvent(t,e)}release(){this.removeAllListeners()}}class as{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=as.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.composedDetailPath(),this.path}composedDetailPath(){return this.pickParams&&this.pickParams.graphic?(this.detailPath=this.path.slice(),this._composedDetailPath(this.pickParams)):this.detailPath=this.path.slice(),this.detailPath}_composedDetailPath(t){if(t&&t.graphic){const e=t.graphic;if(e.stage){const i=e.stage.eventSystem.manager.propagationPath(e);this.detailPath.push(i),this._composedDetailPath(t.params)}}}preventDefault(){try{this.nativeEvent instanceof Event&&this.nativeEvent.cancelable&&this.nativeEvent.preventDefault()}catch(t){this.nativeEvent.preventDefault&&et(this.nativeEvent.preventDefault)&&this.nativeEvent.preventDefault()}this.defaultPrevented=!0}stopImmediatePropagation(){this.propagationImmediatelyStopped=!0}stopPropagation(){try{this.nativeEvent instanceof Event&&this.nativeEvent.cancelable&&this.nativeEvent.stopPropagation()}catch(t){this.nativeEvent.stopPropagation&&et(this.nativeEvent.stopPropagation)&&this.nativeEvent.stopPropagation()}this.propagationStopped=!0}initEvent(){}initUIEvent(){}clone(){throw new Error("Method not implemented.")}}class os extends as{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,n,s,r,a,o,l,h,d,c,u,p,g){throw new Error("Method not implemented.")}}class ls extends os{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 n=new ls(this.manager);n.eventPhase=n.NONE,n.currentTarget=null,n.path=[],n.detailPath=[],n.target=null,n.nativeEvent=this.nativeEvent,n.originalEvent=this.originalEvent,null===(t=this.manager)||void 0===t||t.copyPointerData(this,n),null===(e=this.manager)||void 0===e||e.copyMouseData(this,n),null===(i=this.manager)||void 0===i||i.copyData(this,n),n.target=this.target,n.path=this.composedPath().slice();const s=this.composedDetailPath();return n.detailPath=s&&s.slice(),n.type=this.type,n}}class hs extends os{constructor(){super(...arguments),this.DOM_DELTA_PIXEL=0,this.DOM_DELTA_LINE=1,this.DOM_DELTA_PAGE=2}clone(){var t,e,i;const n=new hs(this.manager);n.eventPhase=n.NONE,n.currentTarget=null,n.path=[],n.detailPath=[],n.target=null,n.nativeEvent=this.nativeEvent,n.originalEvent=this.originalEvent,null===(t=this.manager)||void 0===t||t.copyWheelData(this,n),null===(e=this.manager)||void 0===e||e.copyMouseData(this,n),null===(i=this.manager)||void 0===i||i.copyData(this,n),n.target=this.target,n.path=this.composedPath().slice();const s=this.composedDetailPath();return n.detailPath=s&&s.slice(),n.type=this.type,n}}hs.DOM_DELTA_PIXEL=0,hs.DOM_DELTA_LINE=1,hs.DOM_DELTA_PAGE=2;class ds extends as{constructor(t,e){super(),this.type=t,this.detail=e}}const cs="object"==typeof performance&&performance.now?performance:Date;function us(t){return"mouse"===t||"pen"===t}const ps={dispatchEvent(t){var e;if(!(t instanceof as))throw new Error("DisplayObject cannot propagate events outside of the Federated Events API");return t.defaultPrevented=!1,t.path=[],t.detailPath&&(t.detailPath=[]),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 ds(t,e))}},gs={touchstart:"pointerdown",touchend:"pointerup",touchendoutside:"pointerupoutside",touchmove:"pointermove",touchcancel:"pointercancel"};class fs{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],n=this.bootstrapEvent(this.rootPointerEvent,i);this.manager.mapEvent(n)}this.setCursor(this.manager.cursor,this.manager.cursorTarget),this.rootPointerEvent.nativeEvent=null},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.rootPointerEvent.nativeEvent=null},this.onPointerUp=t=>{if(this.supportsTouchEvents&&"touch"===t.pointerType)return;const e=this.isEventOutsideOfTargetViewPort(t)?"outside":"",i=this.normalizeToPointerData(t);for(let t=0,n=i.length;t<n;t++){const n=this.bootstrapEvent(this.rootPointerEvent,i[t]);n.type+=e,this.manager.mapEvent(n)}this.setCursor(this.manager.cursor,this.manager.cursorTarget),this.rootPointerEvent.nativeEvent=null},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.rootPointerEvent.nativeEvent=null},this.onWheel=t=>{const e=this.normalizeWheelEvent(t);this.manager.mapEvent(e)};const{targetElement:e,resolution:i,rootNode:n,global:s,autoPreventDefault:r=!1,clickInterval:a,supportsTouchEvents:o=s.supportsTouchEvents,supportsPointerEvents:l=s.supportsPointerEvents}=t;this.manager=new class{constructor(t,e){this.dispatch=new J,this.cursorTarget=null,this.pauseNotify=!1,this.mappingState={trackingData:{}},this.eventPool=new Map,this.onPointerDown=(t,e)=>{if(!(t instanceof ls))return void Ot.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(us(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,n;if(!(t instanceof ls))return void Ot.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const s=this.createPointerEvent(t,t.type,e),r=us(s.pointerType),a=this.trackingData(t.pointerId),o=this.findMountedTarget(a.overTargets);if(a.overTargets&&o&&o!==this.rootTarget&&o!==s.target){const e="mousemove"===t.type?"mouseout":"pointerout",i=this.createPointerEvent(t,e,o||void 0);if(this.dispatchEvent(i,"pointerout"),r&&this.dispatchEvent(i,"mouseout"),!s.composedPath().includes(o)){const e=this.createPointerEvent(t,"pointerleave",o||void 0);for(e.eventPhase=e.AT_TARGET;e.target&&!s.composedPath().includes(e.target);)e.currentTarget=e.target,this.notifyTarget(e),r&&this.notifyTarget(e,"mouseleave"),e.target=e.target.parent;this.freeEvent(e)}this.freeEvent(i)}if(o!==s.target){const e="mousemove"===t.type?"mouseover":"pointerover",i=this.clonePointerEvent(s,e);this.dispatchEvent(i,"pointerover"),r&&this.dispatchEvent(i,"mouseover");let n=null==o?void 0:o.parent;for(;n&&n!==this.rootTarget.parent&&n!==s.target;)n=n.parent;if(!n||n===this.rootTarget.parent){const t=this.clonePointerEvent(s,"pointerenter");t.eventPhase=t.AT_TARGET;let e=t.target;const i=new Set;let n=o;for(;n&&n!==this.rootTarget;)i.add(n),n=n.parent;for(;e&&e!==o&&e!==this.rootTarget.parent;)i.has(e)||(t.currentTarget=e,this.notifyTarget(t),r&&this.notifyTarget(t,"mouseenter")),e=e.parent;this.freeEvent(t)}this.freeEvent(i)}this.dispatchEvent(s,"pointermove"),"touch"===s.pointerType&&this.dispatchEvent(s,"touchmove"),r&&(this.dispatchEvent(s,"mousemove"),this.cursorTarget=s.target,this.cursor=(null===(n=null===(i=s.target)||void 0===i?void 0:i.attribute)||void 0===n?void 0:n.cursor)||this.rootTarget.getCursor()),a.overTargets=s.composedPath(),this.freeEvent(s)},this.onPointerOver=(t,e)=>{var i,n;if(!(t instanceof ls))return void Ot.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const s=this.trackingData(t.pointerId),r=this.createPointerEvent(t,t.type,e),a=us(r.pointerType);this.dispatchEvent(r,"pointerover"),a&&this.dispatchEvent(r,"mouseover"),"mouse"===r.pointerType&&(this.cursorTarget=r.target,this.cursor=(null===(n=null===(i=r.target)||void 0===i?void 0:i.attribute)||void 0===n?void 0:n.cursor)||this.rootTarget.getCursor());const o=this.clonePointerEvent(r,"pointerenter");for(o.eventPhase=o.AT_TARGET;o.target&&o.target!==this.rootTarget.parent;)o.currentTarget=o.target,this.notifyTarget(o),a&&this.notifyTarget(o,"mouseenter"),o.target=o.target.parent;s.overTargets=r.composedPath(),this.freeEvent(r),this.freeEvent(o)},this.onPointerOut=(t,e)=>{if(!(t instanceof ls))return void Ot.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const i=this.trackingData(t.pointerId);if(i.overTargets){const e=us(t.pointerType),n=this.findMountedTarget(i.overTargets),s=this.createPointerEvent(t,"pointerout",n||void 0);this.dispatchEvent(s),e&&this.dispatchEvent(s,"mouseout");const r=this.createPointerEvent(t,"pointerleave",n||void 0);for(r.eventPhase=r.AT_TARGET;r.target&&r.target!==this.rootTarget.parent;)r.currentTarget=r.target,this.notifyTarget(r),e&&this.notifyTarget(r,"mouseleave"),r.target=r.target.parent;i.overTargets=[],this.freeEvent(s),this.freeEvent(r)}this.cursorTarget=null,this.cursor=""},this.onPointerUp=(t,e)=>{var i;if(!(t instanceof ls))return void Ot.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const n=cs.now(),s=this.createPointerEvent(t,t.type,e);if(this.dispatchEvent(s,"pointerup"),"touch"===s.pointerType)this.dispatchEvent(s,"touchend");else if(us(s.pointerType)){const t=2===s.button;this.dispatchEvent(s,t?"rightup":"mouseup")}const r=this.trackingData(t.pointerId),a=this.findMountedTarget(r.pressTargetsByButton[t.button]);let o=a;if(a&&!s.composedPath().includes(a)){let e=a;for(;e&&!s.composedPath().includes(e);){if(s.currentTarget=e,this.notifyTarget(s,"pointerupoutside"),"touch"===s.pointerType)this.notifyTarget(s,"touchendoutside");else if(us(s.pointerType)){const t=2===s.button;this.notifyTarget(s,t?"rightupoutside":"mouseupoutside")}e=e.parent}delete r.pressTargetsByButton[t.button],o=e}if(o){const e=this.clonePointerEvent(s,"click");e.target=o,e.path=[],e.detailPath=[],r.clicksByButton[t.button]||(r.clicksByButton[t.button]={clickCount:0,target:e.target,timeStamp:n});const a=r.clicksByButton[t.button];a.target===e.target&&n-a.timeStamp<(null!==(i=this._config.clickInterval)&&void 0!==i?i:200)?++a.clickCount:a.clickCount=1,a.target=e.target,a.timeStamp=n,e.detail=a.clickCount,us(e.pointerType)?(this.dispatchEvent(e,"click"),2===a.clickCount&&this.dispatchEvent(e,"dblclick")):"touch"===e.pointerType&&this._config.supportsTouchEvents&&(this.dispatchEvent(e,"tap"),2===a.clickCount&&this.dispatchEvent(e,"dbltap")),this.dispatchEvent(e,"pointertap"),this.freeEvent(e)}this.freeEvent(s)},this.onPointerUpOutside=(t,e)=>{if(!(t instanceof ls))return void Ot.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const i=this.trackingData(t.pointerId),n=this.findMountedTarget(i.pressTargetsByButton[t.button]),s=this.createPointerEvent(t,t.type,e);if(n){let e=n;for(;e;)s.currentTarget=e,this.notifyTarget(s,"pointerupoutside"),"touch"===s.pointerType?this.notifyTarget(s,"touchendoutside"):us(s.pointerType)&&this.notifyTarget(s,2===s.button?"rightupoutside":"mouseupoutside"),e=e.parent;delete i.pressTargetsByButton[t.button]}this.freeEvent(s)},this.onWheel=(t,e)=>{if(!(t instanceof hs))return void Ot.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,n,s,r,a,o;if(!this.rootTarget)return;const l=this.mappingTable[t.type];let h;const d=`${t.canvasX}-${t.canvasY}`;if((null===(e=this._prePointTargetCache)||void 0===e?void 0:e[d])&&(null===(n=null===(i=this._prePointTargetCache)||void 0===i?void 0:i[d])||void 0===n?void 0:n.stage)&&(null===(r=null===(s=this._prePointTargetCache)||void 0===s?void 0:s[d])||void 0===r?void 0:r.stage.renderCount)===(null===(a=this._prePointTargetCache)||void 0===a?void 0:a.stageRenderCount)?h=this._prePointTargetCache[d]:(h=this.pickTarget(t.viewX,t.viewY,t),t.pickParams||(this._prePointTargetCache={[d]:h,stageRenderCount:null!==(o=null==h?void 0:h.stage.renderCount)&&void 0!==o?o:-1})),l)for(let e=0,i=l.length;e<i;e++)l[e].fn(t,h);else Ot.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 n=0,s=i.length-1;n<s;n++)if(t.currentTarget=i[n],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 n=i.length-2;n>=0;n--)if(t.currentTarget=i[n],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){if(this.pauseNotify)return;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){var n,s;const r=this.allocateEvent(ls);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(null!==(n=r.viewX)&&void 0!==n?n:r.global.x,null!==(s=r.viewY)&&void 0!==s?s:r.global.y,r),"string"==typeof e&&(r.type=e),r}createWheelEvent(t,e){var i,n;const s=this.allocateEvent(hs);return this.copyWheelData(t,s),this.copyMouseData(t,s),this.copyData(t,s),s.nativeEvent=t.nativeEvent,s.originalEvent=t,s.target=e||this.pickTarget(null!==(i=s.viewX)&&void 0!==i?i:s.global.x,null!==(n=s.viewY)&&void 0!==n?n:s.global.y,s),s}clonePointerEvent(t,e){const i=this.allocateEvent(ls);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();const n=t.composedDetailPath();return i.detailPath=n&&n.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 ls&&e instanceof ls&&(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 os&&e instanceof os&&(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=cs.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.detailPath=[],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 n=0,s=i.length;n<s&&!t.propagationImmediatelyStopped;n++)i[n].once&&t.currentTarget.removeEventListener(e,i[n].fn,{once:!0}),i[n].fn.call(i[n].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 n=0,s=i.length;n<s&&!t.propagationImmediatelyStopped;n++)i[n].fn.call(i[n].context,t,e)}pickTarget(t,e,i){let n;const s=this.rootTarget.pick(t,e);return n=s&&s.graphic?s.graphic:s&&s.group?s.group:this.rootTarget.AABBBounds.contains(t,e)?this.rootTarget:null,i&&(i.pickParams=s.params),n}release(){this.dispatch.removeAllListeners(),this.eventPool.clear(),this.rootTarget=null,this.mappingTable=null,this.mappingState=null,this.cursorTarget=null}}(n,{clickInterval:a,supportsTouchEvents:o}),this.globalObj=s,this.supportsPointerEvents=l,this.supportsTouchEvents=o,this.supportsMouseEvents=s.supportsMouseEvents,this.applyStyles=s.applyStyles,this.autoPreventDefault=r,this.eventsAdded=!1,this.rootPointerEvent=new ls,this.rootWheelEvent=new hs,this.cursorStyles={default:"inherit",pointer:"pointer"},this.resolution=i,this.setTargetElement(e)}release(){this.removeEvents(),this.manager&&this.manager.release(),this.domElement=null,this.manager=null,this.globalObj=null}setCursor(t,e){if(!e&&!this.manager.rootTarget.window._handler.canvas.controled)return;t||(t="default");const{applyStyles:i,domElement:n}=this;if(this.currentCursor===t)return;this.currentCursor=t;const s=this.cursorStyles[t];s?"string"==typeof s&&i?n.style.cursor=s:"function"==typeof s?s(t):"object"==typeof s&&i&&Object.assign(n.style,s):i&&lt(t)&&!_t(this.cursorStyles,t)&&(n.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.addEventListener("pointermove",this.onPointerMove,!0),t.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.addEventListener("mousemove",this.onPointerMove,!0),t.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.removeEventListener("pointermove",this.onPointerMove,!0),t.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.removeEventListener("mousemove",this.onPointerMove,!0),t.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){return this.domElement.pointTransform?this.domElement.pointTransform(t.x,t.y):t}mapToCanvasPoint(t){var e,i;const n=null===(e=this.globalObj)||void 0===e?void 0:e.mapToCanvasPoint(t,this.domElement);if(n)return n;let s=0,r=0;if(t.changedTouches){const e=null!==(i=t.changedTouches[0])&&void 0!==i?i:{};s=e.clientX||0,r=e.clientY||0}else s=t.clientX||0,r=t.clientY||0;const a=this.domElement.getBoundingClientRect();return{x:s-a.left,y:r-a.top}}normalizeToPointerData(t){const e=[];if(this.supportsTouchEvents&&t.changedTouches&&t.changedTouches.length)for(let i=0,n=t.changedTouches.length;i<n;i++){const n=t.changedTouches[i];ot(n.button)&&(n.button=0),ot(n.buttons)&&(n.buttons=1),ot(n.isPrimary)&&(n.isPrimary=1===t.touches.length&&"touchstart"===t.type),ot(n.width)&&(n.width=n.radiusX||1),ot(n.height)&&(n.height=n.radiusY||1),ot(n.tiltX)&&(n.tiltX=0),ot(n.tiltY)&&(n.tiltY=0),ot(n.pointerType)&&(n.pointerType="touch"),ot(n.pointerId)&&(n.pointerId=n.identifier||0),ot(n.pressure)&&(n.pressure=n.force||.5),ot(n.twist)&&(n.twist=0),ot(n.tangentialPressure)&&(n.tangentialPressure=0),ot(n.layerX)&&(n.layerX=n.offsetX=n.clientX),ot(n.layerY)&&(n.layerY=n.offsetY=n.clientY),n.isNormalized=!0,n.type=t.type,e.push(n)}else if(!this.globalObj.supportsMouseEvents||t instanceof MouseEvent&&!(this.supportsPointerEvents&&t instanceof PointerEvent)){const i=t;ot(i.isPrimary)&&(i.isPrimary=!0),ot(i.width)&&(i.width=1),ot(i.height)&&(i.height=1),ot(i.tiltX)&&(i.tiltX=0),ot(i.tiltY)&&(i.tiltY=0),ot(i.pointerType)&&(i.pointerType="mouse"),ot(i.pointerId)&&(i.pointerId=1),ot(i.pressure)&&(i.pressure=.5),ot(i.twist)&&(i.twist=0),ot(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:n}=this.mapToCanvasPoint(t);e.canvas.x=i,e.canvas.y=n,e.global.x=i,e.global.y=n,e.offset.x=i,e.offset.y=n;const{x:s,y:r}=this.mapToViewportPoint(e);return e.viewport.x=s,e.viewport.y=r,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:n}=this.mapToCanvasPoint(e);t.canvas.x=i,t.canvas.y=n,t.global.x=i,t.global.y=n,t.offset.x=i,t.offset.y=n;const{x:s,y:r}=this.mapToViewportPoint(t);return t.viewport.x=s,t.viewport.y=r,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=gs[t.type]||t.type),t}transferMouseData(t,e){t.isTrusted=e.isTrusted,t.srcElement=e.srcElement,t.timeStamp=cs.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}isEventOutsideOfTargetViewPort(t){if(this.isEventOutsideOfTargetElement(t))return!0;if(this.domElement.getViewBox){const e=this.mapToViewportPoint(this.mapToCanvasPoint(t)),i=this.domElement.getViewBox(),n=i.width(),s=i.height();return!(e.x<n&&e.y<s&&e.x>0&&e.y>0)}return!1}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)}pauseTriggerEvent(){this.manager.pauseNotify=!0}resumeTriggerEvent(){this.manager.pauseNotify=!1}}var vs;!function(t){t[t.INITIAL=0]="INITIAL",t[t.RUNNING=1]="RUNNING",t[t.PAUSE=2]="PAUSE"}(vs||(vs={}));class ms{static Avaliable(){return!!xn.global.getRequestAnimationFrame()}avaliable(){return ms.Avaliable()}tick(t,e){xn.global.getRequestAnimationFrame()((()=>{this.released||e(this)}))}release(){this.released=!0}getTime(){return Date.now()}}class bs{static Avaliable(){return!0}avaliable(){return bs.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 ys{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-ys.bounceOut(1-t)}static bounceInOut(t){return t<.5?.5*ys.bounceIn(2*t):.5*ys.bounceOut(2*t-1)+.5}static getElasticIn(t,e){return function(i){if(0===i||1===i)return i;const n=e/zt*Math.asin(1/t);return-t*Math.pow(2,10*(i-=1))*Math.sin((i-n)*zt/e)}}static getElasticOut(t,e){return function(i){if(0===i||1===i)return i;const n=e/zt*Math.asin(1/t);return t*Math.pow(2,-10*i)*Math.sin((i-n)*zt/e)+1}}static getElasticInOut(t,e){return function(i){const n=e/zt*Math.asin(1/t);return(i*=2)<1?t*Math.pow(2,10*(i-=1))*Math.sin((i-n)*zt/e)*-.5:t*Math.pow(2,-10*(i-=1))*Math.sin((i-n)*zt/e)*.5+1}}static registerFunc(t,e){ys[t]=e}}function xs(t,e){const i=1/e;let n=1;for(;t>i;)t-=i,n*=-1;const s=n*t/i;return s>0?s:1+s}ys.quadIn=ys.getPowIn(2),ys.quadOut=ys.getPowOut(2),ys.quadInOut=ys.getPowInOut(2),ys.cubicIn=ys.getPowIn(3),ys.cubicOut=ys.getPowOut(3),ys.cubicInOut=ys.getPowInOut(3),ys.quartIn=ys.getPowIn(4),ys.quartOut=ys.getPowOut(4),ys.quartInOut=ys.getPowInOut(4),ys.quintIn=ys.getPowIn(5),ys.quintOut=ys.getPowOut(5),ys.quintInOut=ys.getPowInOut(5),ys.backIn=ys.getBackIn(1.7),ys.backOut=ys.getBackOut(1.7),ys.backInOut=ys.getBackInOut(1.7),ys.elasticIn=ys.getElasticIn(1,.3),ys.elasticOut=ys.getElasticOut(1,.3),ys.elasticInOut=ys.getElasticInOut(1,.3*1.5),ys.easeInOutQuad=t=>(t/=.5)<1?.5*Math.pow(t,2):-.5*((t-=2)*t-2),ys.easeOutElastic=t=>{const e=2*Math.PI/3;return 0===t?0:1===t?1:Math.pow(2,-10*t)*Math.sin((10*t-.75)*e)+1},ys.easeInOutElastic=t=>{const e=2*Math.PI/4.5;return 0===t?0:1===t?1:t<.5?-Math.pow(2,20*t-10)*Math.sin((20*t-11.125)*e)/2:Math.pow(2,-20*t+10)*Math.sin((20*t-11.125)*e)/2+1};for(let t=0;t<10;t++)ys[`flicker${t}`]=e=>xs(e,t);for(let t=2;t<10;t++)ys[`aIn${t}`]=e=>t*e*e+(1-t)*e;class _s{constructor(){this.id=r.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===Je.END?this.removeAnimate(e):e.status===Je.RUNNING||e.status===Je.INITIAL?(this.animateCount++,e.advance(t)):e.status===Je.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 ws=new _s;class Ts{constructor(t,e,i,n,s){this.from=t,this.to=e,this.duration=i,this.easing=n,this.params=s,this.updateCount=0}bind(t,e){this.target=t,this.subAnimate=e,this.onBind()}onBind(){}onFirstRun(){}onStart(){}onEnd(){}getEndProps(){return this.to}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 Ss extends Ts{constructor(t){super(null,null,0,"linear"),this.cb=t}onUpdate(t,e,i){}onStart(){this.cb()}}class ks{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:r.GenAutoIncrementId(),e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:ws,i=arguments.length>2?arguments[2]:void 0;this.id=t,this.timeline=e||ws,this.status=Je.INITIAL,this.tailAnimate=new Bs(this),this.subAnimates=[this.tailAnimate],this.timeScale=1,this.rawPosition=-1,this._startTime=0,this._duringTime=0,this.timeline.addAnimate(this),this.slience=i}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=Gt(t.getDuration(),e)})),this._startTime=e,this}parallel(t){return this._startTime=t.getStartTime(),this}static AddInterpolate(t,e){ks.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.totalDuration===t.duration&&this.trySetAttribute(t.getFromProps(),t.mode),this}trySetAttribute(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:ks.mode;t&&e&Qe.SET_ATTR_IMMEDIATELY&&this.target.setAttributes&&this.target.setAttributes(t,!1,{type:Ze.ANIMATE_PLAY})}runCb(t){const e=new Ss((()=>{t(this,e.step.prev)}));return this.tailAnimate.play(e),this}customInterpolate(t,e,i,n,s,r){const a=ks.interpolateMap.get(t)||ks.interpolateMap.get("");return!!a&&a(t,e,i,n,s,r)}pause(){this.status===Je.RUNNING&&(this.status=Je.PAUSED)}resume(){this.status===Je.PAUSED&&(this.status=Je.RUNNING)}to(t,e,i,n){if(this.tailAnimate.to(t,e,i,n),this.target){const t=this.target.stage;t&&t.renderNextFrame()}return this}from(t,e,i,n){if(this.tailAnimate.from(t,e,i,n),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 Bs(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.slience&&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===Je.INITIAL&&(this.status=Je.RUNNING,this._onStart&&this._onStart.forEach((t=>t()))),this.setPosition(Math.max(this.rawPosition,0)+t*this.timeScale)&&this.status===Je.RUNNING&&(this.status=Je.END,this._onEnd&&this._onEnd.forEach((t=>t())))}setPosition(t){let e,i=0;const n=this.rawPosition,s=this.subAnimates.reduce(((t,e)=>t+e.totalDuration),0);t<0&&(t=0);const r=t>=s;if(r&&(t=s),t===n)return r;for(let n=0;n<this.subAnimates.length&&(e=this.subAnimates[n],!(i+e.totalDuration>=t));n++)i+=e.totalDuration,e=void 0;return this.rawPosition=t,e.setPosition(t-i),r}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=Je.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()}}ks.mode=Qe.NORMAL,ks.interpolateMap=new Map;class Bs{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 As(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,n="string"==typeof i?ys[i]:i,s=this._addStep(e,null,n);return s.type=ti.customAnimate,this._appendProps(t.getEndProps(),s,!1),this._appendCustomAnimate(t,s),this}to(t,e,i,n){(null==e||e<0)&&(e=0);const s="string"==typeof i?ys[i]:i,r=this._addStep(e,null,s);return r.type=ti.to,this._appendProps(t,r,!!n&&n.tempProps),r.propKeys||(r.propKeys=Object.keys(r.props)),n&&n.noPreventAttrs||this.target.animates&&this.target.animates.forEach((t=>{t.id!==this.animate.id&&t.preventAttrs(r.propKeys)})),this}from(t,e,i,n){this.to(t,0,i,n);const s={};this.stepTail.propKeys||(this.stepTail.propKeys=Object.keys(this.stepTail.props)),this.stepTail.propKeys.forEach((t=>{s[t]=this.getLastPropByName(t,this.stepTail)})),this.to(s,e,i,n),this.stepTail.type=ti.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=ti.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 n=new As(this.duration,t,e,i);return this.duration+=t,this.stepTail.append(n),this.stepTail=n,n}_appendProps(t,e,i){e.props=i?t:Object.assign({},t);let n=e.prev;const s=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))}));n.prev;)n.props&&(n.propKeys||(n.propKeys=Object.keys(n.props)),n.propKeys.forEach((t=>{void 0===s[t]&&(s[t]=n.props[t])}))),e.propKeys=Object.keys(e.props),n=n.prev;const r=this.stepHead.props;e.propKeys||(e.propKeys=Object.keys(s)),e.propKeys.forEach((t=>{if(void 0===r[t]){const e=this.animate.getStartProps();r[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,n=this.loop,s=this.rawPosition;let r,a,o=!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&&(o=!0,i<0))return o;if(r=Math.floor(t/i),a=t-r*i,o=t>=n*i+i,o&&(a=i,r=n,t=a*r+i),t===s)return o;const h=!this.reversed!=!(this.bounce&&r%2);return h&&(a=i-a),this._deltaPosition=a-this.position,this.position=a,this.rawPosition=t+l,this.updatePosition(o,h),o}updatePosition(t,e){if(!this.stepHead)return;let i=this.stepHead.next;const n=this.position,s=this.duration;if(this.target&&i){let r=i.next;for(;r&&r.position<=n;)i=r,r=i.next;let a=t?0===s?1:n/s:(n-i.position)/i.duration;i.easing&&(a=i.easing(a)),this.tryCallCustomAnimateLifeCycle(i,this._lastStep||(e?this.stepTail:this.stepHead),e),this.updateTarget(i,a,t),this._lastStep=i,this.animate._onFrame&&this.animate._onFrame.forEach((t=>t(i,a)))}}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 Ot.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 As{constructor(t,e,i,n){this.duration=e,this.position=t,this.props=i,this.easing=n}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 Cs=200,Ls="cubicOut";var Os;!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"}(Os||(Os={}));const Es=[0,0,0,0],Rs=[{x:0,y:0},{x:0,y:0},{x:0,y:0},{x:0,y:0}],Ms=[1,2,3,0,1,2,3,0];function Ps(t,e,i){const{x:n,y:s}=$t(t.x,t.y,e.x,e.y,i),{x:r,y:a}=$t(t.x1,t.y1,e.x1,e.y1,i),o=new qt(n,s,r,a);return o.defined=e.defined,o}function Ds(t,e,i){if(!t||!e)return[];Array.isArray(t)||(t=[t]),Array.isArray(e)||(e=[e]);let n=[];if(t.length>e.length){n=e.map((t=>{const e=new qt(t.x,t.y,t.x1,t.y1);return e.defined=t.defined,e}));for(let s=0;s<e.length;s++)n[s]=Ps(t[s],e[s],i)}else{n=e.map((t=>{const e=new qt(t.x,t.y,t.x1,t.y1);return e.defined=t.defined,e}));for(let s=0;s<t.length;s++)n[s]=Ps(t[s],e[s],i)}return n}function Is(t,e){if(ht(t)){let i;for(let n=0;n<t.length&&void 0===i;n++)i=t[n][e];return i}return t[e]}const Fs=(t,e)=>{const i=((t,e)=>lt(t)&&"%"===t[t.length-1]?e*(Number.parseFloat(t.substring(0,t.length-1))/100):t)(t,e);return isNaN(i)?i:Math.max(e,i)};var Ns;!function(t){t[t.LEFT_TO_RIGHT=0]="LEFT_TO_RIGHT",t[t.RIGHT_TO_LEFT=1]="RIGHT_TO_LEFT",t[t.TOP_TO_BOTTOM=2]="TOP_TO_BOTTOM",t[t.BOTTOM_TO_TOP=3]="BOTTOM_TO_TOP",t[t.STROKE=4]="STROKE"}(Ns||(Ns={}));class Hs extends Ts{constructor(){super(...arguments),this.fromText="",this.toText=""}getEndProps(){return!1===this.valid?{}:{text:this.to}}onBind(){var t,e,i;this.fromText=null!==(e=null===(t=this.from)||void 0===t?void 0:t.text)&&void 0!==e?e:"",this.toText=(null===(i=this.to)||void 0===i?void 0:i.text)||"",(!this.toText||ht(this.toText)&&0===this.toText.length)&&(this.valid=!1),ht(this.toText)&&(this.toText=this.toText.map((t=>(t||"").toString())))}onEnd(){this.target.detachShadow()}onUpdate(t,e,i){if(!1===this.valid)return;const n=this.fromText.length,s=ht(this.toText),r=s?this.toText.reduce(((t,e)=>t+(e||"").length),0):this.toText.length,a=Math.ceil(n+(r-n)*e);if(s){i.text=[];let t=0;this.toText.forEach((e=>{t+e.length>a?(i.text.push(e.substr(0,a-t)),t=a):(i.text.push(e),t+=e.length)}))}else i.text=this.toText.substr(0,a)}}var zs;!function(t){t[t.Color255=0]="Color255",t[t.Color1=1]="Color1"}(zs||(zs={}));class Ws{static Get(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:zs.Color1,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[0,0,0,1];if(e===zs.Color1){const e=Ws.store1[t];if(e)return i[0]=e[0],i[1]=e[1],i[2]=e[2],i[3]=e[3],i;const n=Be.parseColorString(t);if(n){const e=[n.r/255,n.g/255,n.b/255,n.opacity];Ws.store1[t]=e,Ws.store255[t]=[n.r,n.g,n.b,n.opacity],i[0]=e[0],i[1]=e[1],i[2]=e[2],i[3]=e[3]}return i}const n=Ws.store255[t];if(n)return i[0]=n[0],i[1]=n[1],i[2]=n[2],i[3]=n[3],i;const s=Be.parseColorString(t);return s&&(Ws.store1[t]=[s.r/255,s.g/255,s.b/255,s.opacity],Ws.store255[t]=[s.r,s.g,s.b,s.opacity],i[0]=s.r,i[1]=s.g,i[2]=s.b,i[3]=s.opacity),i}static Set(t,e,i){if(e===zs.Color1){if(Ws.store1[t])return;Ws.store1[t]=i,Ws.store255[t]=[Math.floor(255*i[0]),Math.floor(255*i[1]),Math.floor(255*i[2]),Math.floor(255*i[3])]}else{if(Ws.store255[t])return;Ws.store255[t]=i,Ws.store1[t]=[i[0]/255,i[1]/255,i[2]/255,i[3]]}}}function Us(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return Array.isArray(t)&&ct(t[0])?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 js(t,e,i,n,s){return Array.isArray(t)&&!ct(t[0])||Array.isArray(e)&&!ct(e[0])?new Array(4).fill(0).map(((s,r)=>Gs(ht(t)?t[r]:t,ht(e)?e[r]:e,i,n))):Gs(t,e,i,n,s)}function Gs(t,e,i,n,s){if(!t||!e)return t&&Us(t)||e&&Us(e)||!1;let r,a,o=!1,l=!1;if(Array.isArray(t)?r=t:"string"==typeof t?r=Ws.Get(t,zs.Color255):o=!0,Array.isArray(e)?a=e:"string"==typeof e?a=Ws.Get(e,zs.Color255):l=!0,o!==l){const r=o?t:e,a=o?e:t,l=Object.assign(Object.assign({},r),{stops:r.stops.map((t=>Object.assign(Object.assign({},t),{color:Us(a)})))});return o?js(r,l,i,n,s):js(l,r,i,n,s)}if(o){if(t.gradient===e.gradient){const n=t,s=e,r=n.stops,a=s.stops;if(r.length!==a.length)return!1;if("linear"===n.gradient)return function(t,e,i){const n=t.stops,s=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(n.length).fill(0).map(((t,e)=>({color:Xs(n[e].color,s[e].color,i),offset:n[e].offset+(s[e].offset-n[e].offset)*i})))}}(n,s,i);if("radial"===n.gradient)return function(t,e,i){const n=t.stops,s=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(n.length).fill(0).map(((t,e)=>({color:Xs(n[e].color,s[e].color,i),offset:n[e].offset+(s[e].offset-n[e].offset)*i})))}}(n,s,i);if("conical"===n.gradient)return function(t,e,i){const n=t.stops,s=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(n.length).fill(0).map(((t,e)=>({color:Xs(n[e].color,s[e].color,i),offset:n[e].offset+(s[e].offset-n[e].offset)*i})))}}(n,s,i)}return!1}return s&&s(r,a),Us(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]}(r,a,i),n)}Ws.store255={},Ws.store1={};const Ys=[0,0,0,0],Vs=[0,0,0,0];function Xs(t,e,i){return Ws.Get(t,zs.Color255,Ys),Ws.Get(e,zs.Color255,Vs),`rgba(${Math.round(Ys[0]+(Vs[0]-Ys[0])*i)},${Math.round(Ys[1]+(Vs[1]-Ys[1])*i)},${Math.round(Ys[2]+(Vs[2]-Ys[2])*i)},${Ys[3]+(Vs[3]-Ys[3])*i})`}class Ks{static GetImage(t,e){var i;const n=Ks.cache.get(t);n?"fail"===n.loadState?xn.global.getRequestAnimationFrame()((()=>{e.imageLoadFail(t)})):"init"===n.loadState||"loading"===n.loadState?null===(i=n.waitingMark)||void 0===i||i.push(e):e&&e.imageLoadSuccess(t,n.data):Ks.loadImage(t,e)}static GetSvg(t,e){var i;let n=Ks.cache.get(t);n?"fail"===n.loadState?xn.global.getRequestAnimationFrame()((()=>{e.imageLoadFail(t)})):"init"===n.loadState||"loading"===n.loadState?null===(i=n.waitingMark)||void 0===i||i.push(e):e&&e.imageLoadSuccess(t,n.data):(n={type:"image",loadState:"init"},Ks.cache.set(t,n),n.dataPromise=xn.global.loadSvg(t),n.dataPromise?(n.waitingMark=[e],n.dataPromise.then((e=>{var i;n.loadState=(null==e?void 0:e.data)?"success":"fail",n.data=null==e?void 0:e.data,null===(i=n.waitingMark)||void 0===i||i.map(((i,s)=>{(null==e?void 0:e.data)?(n.loadState="success",n.data=e.data,i.imageLoadSuccess(t,e.data)):(n.loadState="fail",i.imageLoadFail(t))})),n.waitingMark&&(n.waitingMark=[])}))):(n.loadState="fail",e.imageLoadFail(t)))}static GetFile(t,e){let i=Ks.cache.get(t);return i?"fail"===i.loadState?Promise.reject():"init"===i.loadState||"loading"===i.loadState?i.dataPromise.then((t=>t.data)):Promise.resolve(i.data):(i={type:e,loadState:"init"},Ks.cache.set(t,i),"arrayBuffer"===e?i.dataPromise=xn.global.loadArrayBuffer(t):"blob"===e?i.dataPromise=xn.global.loadBlob(t):"json"===e&&(i.dataPromise=xn.global.loadJson(t)),i.dataPromise.then((t=>t.data)))}static loading(){setTimeout((()=>{if(!Ks.isLoading&&Ks.toLoadAueue.length){Ks.isLoading=!0;const t=Ks.toLoadAueue.splice(0,10),e=[];t.forEach((t=>{const{url:i,marks:n}=t,s={type:"image",loadState:"init"};if(Ks.cache.set(i,s),s.dataPromise=xn.global.loadImage(i),s.dataPromise){s.waitingMark=n;const t=s.dataPromise.then((t=>{var e;s.loadState=(null==t?void 0:t.data)?"success":"fail",s.data=null==t?void 0:t.data,null===(e=s.waitingMark)||void 0===e||e.map(((e,n)=>{(null==t?void 0:t.data)?(s.loadState="success",s.data=t.data,e.imageLoadSuccess(i,t.data)):(s.loadState="fail",e.imageLoadFail(i))})),s.waitingMark&&(s.waitingMark=[])}));e.push(t)}else s.loadState="fail",n.forEach((t=>t.imageLoadFail(i)))})),Promise.all(e).then((()=>{Ks.isLoading=!1,this.onLoadSuccessCb.forEach((t=>t())),Ks.loading()})).catch((t=>{Ks.isLoading=!1,this.onLoadSuccessCb.forEach((t=>t())),Ks.loading()}))}}),0)}static loadImage(t,e){const i=$s(t,Ks.toLoadAueue);if(-1!==i)return Ks.toLoadAueue[i].marks.push(e),void Ks.loading();Ks.toLoadAueue.push({url:t,marks:[e]}),Ks.loading()}static improveImageLoading(t){const e=$s(t,Ks.toLoadAueue);if(-1!==e){const t=Ks.toLoadAueue.splice(e,1);Ks.toLoadAueue.unshift(t[0])}}static onLoadSuccess(t){this.onLoadSuccessCb.push(t)}}function $s(t,e){for(let i=0;i<e.length;i++)if(e[i].url===t)return i;return-1}Ks.cache=new Map,Ks.isLoading=!1,Ks.toLoadAueue=[],Ks.onLoadSuccessCb=[];class qs{bounds(t,e){if(ct(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}parseSize(t){return ct(t)?t:Math.min(t[0],t[1])}}function Zs(t,e,i,n,s){return s?t.arc(i,n,e,0,Ht,!1,s):t.arc(i,n,e,0,Ht),!1}var Js=new class extends qs{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,n,s){return Zs(t,this.parseSize(e)/2,i,n,s)}drawOffset(t,e,i,n,s,r){return Zs(t,this.parseSize(e)/2+s,i,n,r)}drawToSvgPath(t,e,i,n){const s=this.parseSize(t)/2;return`M ${e-s}, ${i} a ${s},${s} 0 1,0 ${2*s},0 a ${s},${s} 0 1,0 -${2*s},0`}};var Qs=new class extends qs{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,n,s){return function(t,e,i,n,s){return t.moveTo(-3*e+i,-e+n,s),t.lineTo(-e+i,-e+n,s),t.lineTo(-e+i,-3*e+n,s),t.lineTo(e+i,-3*e+n,s),t.lineTo(e+i,-e+n,s),t.lineTo(3*e+i,-e+n,s),t.lineTo(3*e+i,e+n,s),t.lineTo(e+i,e+n,s),t.lineTo(e+i,3*e+n,s),t.lineTo(-e+i,3*e+n,s),t.lineTo(-e+i,e+n,s),t.lineTo(-3*e+i,e+n,s),t.closePath(),!0}(t,this.parseSize(e)/6,i,n,s)}drawOffset(t,e,i,n,s,r){return function(t,e,i,n,s,r){return t.moveTo(-3*e+i-s,-e+n-s,r),t.lineTo(-e+i-s,-e+n-s,r),t.lineTo(-e+i-s,-3*e+n-s,r),t.lineTo(e+i+s,-3*e+n-s,r),t.lineTo(e+i+s,-e+n-s,r),t.lineTo(3*e+i+s,-e+n-s,r),t.lineTo(3*e+i+s,e+n+s,r),t.lineTo(e+i+s,e+n+s,r),t.lineTo(e+i+s,3*e+n+s,r),t.lineTo(-e+i-s,3*e+n+s,r),t.lineTo(-e+i-s,e+n+s,r),t.lineTo(-3*e+i-s,e+n+s,r),t.closePath(),!0}(t,this.parseSize(e)/6,i,n,s,r)}};function tr(t,e,i,n,s){return t.moveTo(i,n-e,s),t.lineTo(e+i,n,s),t.lineTo(i,n+e,s),t.lineTo(i-e,n,s),t.closePath(),!0}var er=new class extends qs{constructor(){super(...arguments),this.type="diamond",this.pathStr="M-0.5,0L0,-0.5L0.5,0L0,0.5Z"}draw(t,e,i,n,s){return tr(t,this.parseSize(e)/2,i,n,s)}drawFitDir(t,e,i,n,s){return tr(t,this.parseSize(e)/2,i,n,s)}drawOffset(t,e,i,n,s,r){return tr(t,this.parseSize(e)/2+s,i,n,r)}};function ir(t,e,i,n){const s=2*e;return t.rect(i-e,n-e,s,s),!1}var nr=new class extends qs{constructor(){super(...arguments),this.type="square",this.pathStr="M-0.5,-0.5h1v1h-1Z"}draw(t,e,i,n){return ir(t,this.parseSize(e)/2,i,n)}drawOffset(t,e,i,n,s){return ir(t,this.parseSize(e)/2+s,i,n)}};function sr(t,e,i,n){let s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0;return t.moveTo(i+e+2*s,e+n+s),t.lineTo(i-e-2*s,e+n+s),t.lineTo(i,n-e-2*s),t.closePath(),!0}class rr extends qs{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,n){return sr(t,this.parseSize(e)/2,i,n)}drawOffset(t,e,i,n,s){return sr(t,this.parseSize(e)/2,i,n,s)}}var ar=new rr;var or=new class extends rr{constructor(){super(...arguments),this.type="triangle"}};const lr=Math.sin(Math.PI/10)/Math.sin(7*Math.PI/10),hr=Math.sin(Ht/10)*lr,dr=-Math.cos(Ht/10)*lr;function cr(t,e,i,n){const s=hr*e,r=dr*e;t.moveTo(i,-e+n),t.lineTo(s+i,r+n);for(let a=1;a<5;++a){const o=Ht*a/5,l=Math.cos(o),h=Math.sin(o);t.lineTo(h*e+i,-l*e+n),t.lineTo(l*s-h*r+i,h*s+l*r+n)}return t.closePath(),!0}var ur=new class extends qs{constructor(){super(...arguments),this.type="star",this.pathStr="M0 -1L0.22451398828979266 -0.3090169943749474L0.9510565162951535 -0.30901699437494745L0.3632712640026804 0.1180339887498948L0.5877852522924732 0.8090169943749473L8.326672684688674e-17 0.3819660112501051L-0.587785252292473 0.8090169943749476L-0.3632712640026804 0.11803398874989487L-0.9510565162951536 -0.30901699437494723L-0.22451398828979274 -0.30901699437494734Z"}draw(t,e,i,n){return cr(t,this.parseSize(e)/2,i,n)}drawOffset(t,e,i,n,s){return cr(t,this.parseSize(e)/2+s,i,n)}};const pr=Xt(3);function gr(t,e,i,n){const s=e,r=s/pr,a=r/5,o=e;return t.moveTo(0+i,-s+n),t.lineTo(r/2+i,n),t.lineTo(a/2+i,n),t.lineTo(a/2+i,o+n),t.lineTo(-a/2+i,o+n),t.lineTo(-a/2+i,n),t.lineTo(-r/2+i,n),t.closePath(),!0}var fr=new class extends qs{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,n){return gr(t,this.parseSize(e)/2,i,n)}drawOffset(t,e,i,n,s){return gr(t,this.parseSize(e)/2+s,i,n)}};function vr(t,e,i,n){const s=2*e;return t.moveTo(i,-e+n),t.lineTo(s/3/2+i,e+n),t.lineTo(-s/3/2+i,e+n),t.closePath(),!0}var mr=new class extends qs{constructor(){super(...arguments),this.type="wedge",this.pathStr="M0,-0.5773502691896257L-0.125,0.28867513459481287L0.125,0.28867513459481287Z"}draw(t,e,i,n){return vr(t,this.parseSize(e)/2,i,n)}drawOffset(t,e,i,n,s){return vr(t,this.parseSize(e)/2+s,i,n)}};function br(t,e,i,n){return t.moveTo(-e+i,n),t.lineTo(i,e+n),!1}var yr=new class extends qs{constructor(){super(...arguments),this.type="stroke",this.pathStr=""}draw(t,e,i,n){return br(t,this.parseSize(e)/2,i,n)}drawOffset(t,e,i,n,s){return br(t,this.parseSize(e)/2+s,i,n)}};const xr=-.5,_r=Xt(3)/2,wr=1/Xt(12);function Tr(t,e,i,n){const s=e/2,r=e*wr,a=s,o=e*wr+e,l=-a,h=o;return t.moveTo(s+i,r+n),t.lineTo(a+i,o+n),t.lineTo(l+i,h+n),t.lineTo(xr*s-_r*r+i,_r*s+xr*r+n),t.lineTo(xr*a-_r*o+i,_r*a+xr*o+n),t.lineTo(xr*l-_r*h+i,_r*l+xr*h+n),t.lineTo(xr*s+_r*r+i,xr*r-_r*s+n),t.lineTo(xr*a+_r*o+i,xr*o-_r*a+n),t.lineTo(xr*l+_r*h+i,xr*h-_r*l+n),t.closePath(),!1}var Sr=new class extends qs{constructor(){super(...arguments),this.type="wye",this.pathStr="M0.25 0.14433756729740646L0.25 0.6443375672974064L-0.25 0.6443375672974064L-0.25 0.14433756729740643L-0.6830127018922193 -0.10566243270259357L-0.4330127018922193 -0.5386751345948129L0 -0.28867513459481287L0.4330127018922193 -0.5386751345948129L0.6830127018922193 -0.10566243270259357Z"}draw(t,e,i,n){return Tr(t,this.parseSize(e)/2,i,n)}drawOffset(t,e,i,n,s){return Tr(t,this.parseSize(e)/2+s,i,n)}};function kr(t,e,i,n,s){return t.moveTo(-e+i-2*s,n),t.lineTo(e+i+s,e+n+2*s),t.lineTo(e+i+s,n-e-2*s),t.closePath(),!0}var Br=new class extends qs{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,n){return kr(t,this.parseSize(e)/2,i,n,0)}drawOffset(t,e,i,n,s){return kr(t,this.parseSize(e)/2,i,n,s)}};function Ar(t,e,i,n){let s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0;return t.moveTo(i-e-s,e+n+2*s),t.lineTo(e+i+2*s,n),t.lineTo(i-e-s,n-e-2*s),t.closePath(),!0}var Cr=new class extends qs{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,n){return Ar(t,this.parseSize(e)/2,i,n)}drawOffset(t,e,i,n,s){return Ar(t,this.parseSize(e)/2,i,n,s)}};function Lr(t,e,i,n){let s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0;return t.moveTo(i-e-2*s,n-e-s),t.lineTo(i+e+2*s,n-e-s),t.lineTo(i,n+e+2*s),t.closePath(),!0}var Or=new class extends qs{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,n){return Lr(t,this.parseSize(e)/2,i,n)}drawOffset(t,e,i,n,s){return Lr(t,this.parseSize(e)/2,i,n,s)}};const Er=Xt(3);function Rr(t,e,i,n){const s=e*Er;return t.moveTo(i,n+-s/3*2),t.lineTo(e+i,n+s),t.lineTo(i-e,n+s),t.closePath(),!0}var Mr=new class extends qs{constructor(){super(...arguments),this.type="thinTriangle",this.pathStr="M0,-0.5773502691896257L-0.5,0.28867513459481287L0.5,0.28867513459481287Z"}draw(t,e,i,n){return Rr(t,this.parseSize(e)/2/Er,i,n)}drawOffset(t,e,i,n,s){return Rr(t,this.parseSize(e)/2/Er+s,i,n)}};function Pr(t,e,i,n){const s=2*e;return t.moveTo(e+i,n-s),t.lineTo(i-e,n),t.lineTo(e+i,s+n),!0}var Dr=new class extends qs{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,n){return Pr(t,this.parseSize(e)/4,i,n)}drawOffset(t,e,i,n,s){return Pr(t,this.parseSize(e)/4+s,i,n)}};function Ir(t,e,i,n){const s=2*e;return t.moveTo(i-e,n-s),t.lineTo(i+e,n),t.lineTo(i-e,s+n),!0}var Fr=new class extends qs{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,n){return Ir(t,this.parseSize(e)/4,i,n)}drawOffset(t,e,i,n,s){return Ir(t,this.parseSize(e)/4+s,i,n)}};function Nr(t,e,i,n){const s=2*e;return t.moveTo(i-s,n+e),t.lineTo(i,n-e),t.lineTo(i+s,n+e),!0}var Hr=new class extends qs{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,n){return Nr(t,this.parseSize(e)/4,i,n)}drawOffset(t,e,i,n,s){return Nr(t,this.parseSize(e)/4+s,i,n)}};function zr(t,e,i,n){const s=2*e;return t.moveTo(i-s,n-e),t.lineTo(i,n+e),t.lineTo(i+s,n-e),!0}var Wr=new class extends qs{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,n){return zr(t,this.parseSize(e)/4,i,n)}drawOffset(t,e,i,n,s){return zr(t,this.parseSize(e)/4+s,i,n)}};function Ur(t,e,i,n,s){return t.moveTo(i,n-e),t.lineTo(i,n+e),!0}var jr=new class extends qs{constructor(){super(...arguments),this.type="lineV",this.pathStr="M0,-0.5L0,0.5"}draw(t,e,i,n,s){return Ur(t,this.parseSize(e)/2,i,n)}drawOffset(t,e,i,n,s,r){return Ur(t,this.parseSize(e)/2+s,i,n)}drawToSvgPath(t,e,i,n){const s=this.parseSize(t)/2;return`M ${e}, ${i-s} L ${e},${i+s}`}};function Gr(t,e,i,n,s){return t.moveTo(i-e,n),t.lineTo(i+e,n),!0}var Yr=new class extends qs{constructor(){super(...arguments),this.type="lineH",this.pathStr="M-0.5,0L0.5,0"}draw(t,e,i,n,s){return Gr(t,this.parseSize(e)/2,i,n)}drawOffset(t,e,i,n,s,r){return Gr(t,this.parseSize(e)/2+s,i,n)}drawToSvgPath(t,e,i,n){const s=this.parseSize(t)/2;return`M ${e-s}, ${i} L ${e+s},${i}`}};function Vr(t,e,i,n,s){return t.moveTo(i-e,n-e),t.lineTo(i+e,n+e),t.moveTo(i+e,n-e),t.lineTo(i-e,n+e),!0}var Xr=new class extends qs{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,n,s){return Vr(t,this.parseSize(e)/2,i,n)}drawOffset(t,e,i,n,s,r){return Vr(t,this.parseSize(e)/2+s,i,n)}drawToSvgPath(t,e,i,n){const s=this.parseSize(t)/2;return`M ${e-s}, ${i-s} L ${e+s},${i+s} M ${e+s}, ${i-s} L ${e-s},${i+s}`}};function Kr(t,e,i,n){return t.rect(i-e[0]/2,n-e[1]/2,e[0],e[1]),!1}function $r(t,e,i,n){const s=e,r=e/2;return t.rect(i-s/2,n-r/2,s,r),!1}var qr=new class extends qs{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,n){return ct(e)?$r(t,e,i,n):Kr(t,e,i,n)}drawWithClipRange(t,e,i,n,s,r,a){ct(e)&&(e=[e,e/2]);const o=2*(e[0]+e[1])*s,l=[{x:i+e[0]/2,y:n-e[1]/2},{x:i+e[0]/2,y:n+e[1]/2},{x:i-e[0]/2,y:n+e[1]/2},{x:i-e[0]/2,y:n-e[1]/2}];let h=0,d=l[3];t.moveTo(d.x,d.y);for(let e=0;e<l.length;e++){const i=l[e],n=Math.sqrt((i.x-d.x)*(i.x-d.x)+(i.y-d.y)*(i.y-d.y));if(h+n>o){const e=(i.x-d.x)*(o-h)/n,s=(i.y-d.y)*(o-h)/n;t.lineTo(d.x+e,d.y+s);break}t.lineTo(i.x,i.y),d=i,h+=n}return!1}drawOffset(t,e,i,n,s){return ct(e)?$r(t,e+2*s,i,n):Kr(t,[e[0]+2*s,e[1]+2*s],i,n)}};const Zr=new pe;class Jr{constructor(t,e){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];this.pathStr="",this.type=t,ht(e)?this.svgCache=e:this.path=e,this.isSvg=i}drawOffset(t,e,i,n,s,r,a){return e=this.parseSize(e),this.isSvg?!!this.svgCache&&(this.svgCache.forEach((s=>{t.beginPath(),oi(s.path.commandList,t,i,n,e,e),a&&a(s.path,s.attribute)})),!1):(oi(this.path.commandList,t,i,n,e+s,e+s),!1)}draw(t,e,i,n,s,r){return e=this.parseSize(e),this.drawOffset(t,e,i,n,0,s,r)}parseSize(t){return ct(t)?t:Math.min(t[0],t[1])}drawWithClipRange(t,e,i,n,s,r,a){return e=this.parseSize(e),this.isSvg?!!this.svgCache&&(this.svgCache.forEach((r=>{r.path.drawWithClipRange(t,e,i,n,s),a&&a(r.path,r.attribute)})),!1):(this.path.drawWithClipRange(t,e,i,n,s),!1)}bounds(t,e){if(t=this.parseSize(t),this.isSvg){if(!this.svgCache)return;return e.clear(),void this.svgCache.forEach((i=>{let{path:n}=i;Zr.x1=n.bounds.x1*t,Zr.y1=n.bounds.y1*t,Zr.x2=n.bounds.x2*t,Zr.y2=n.bounds.y2*t,e.union(Zr)}))}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 Qr={};[Js,Qs,er,nr,Mr,or,ur,fr,mr,yr,Sr,Br,Cr,ar,Or,Dr,Fr,Hr,Wr,qr,jr,Yr,Xr].forEach((t=>{Qr[t.type]=t}));const ta={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"};class ea{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 ia(t,e,i,n){const s=t.indexOf(e,i);if(-1===s)throw new Error(n);return s+e.length-1}function na(t,e,i){const n=function(t,e){let i,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:">",s="";for(let r=e;r<t.length;r++){let e=t[r];if(i)e===i&&(i="");else if('"'===e||"'"===e)i=e;else if(e===n[0]){if(!n[1])return{data:s,index:r};if(t[r+1]===n[1])return{data:s,index:r}}else"\t"===e&&(e=" ");s+=e}}(t,e+1,arguments.length>3&&void 0!==arguments[3]?arguments[3]:">");if(!n)return;let s=n.data;const r=n.index,a=s.search(/\s/);let o=s,l=!0;-1!==a&&(o=s.substr(0,a).replace(/\s\s*$/,""),s=s.substr(a+1));const h=o;if(i){const t=o.indexOf(":");-1!==t&&(o=o.substr(t+1),l=o!==n.data.substr(t+1))}return{tagName:o,tagExp:s,closeIndex:r,attrExpPresent:l,rawTagName:h}}const sa=new RegExp("([^\\s=]+)\\s*(=\\s*(['\"])([\\s\\S]*?)\\3)?","gm");class ra{constructor(t){this.currentNode=null,this.options=t,this.tagsNodeStack=[],this.docTypeEntities={}}addChild(t,e,i){const n=e.tagname;"string"==typeof n?(e.tagname=n,t.addChild(e)):t.addChild(e)}buildAttributesMap(t,e,i){const n={};if(!t)return;const s=function(t,e){const i=[];let n=e.exec(t);for(;n;){const s=[];s.startIndex=e.lastIndex-n[0].length;const r=n.length;for(let t=0;t<r;t++)s.push(n[t]);i.push(s),n=e.exec(t)}return i}(t,sa),r=s.length;for(let t=0;t<r;t++){const e=s[t][1],i=s[t][4];e&&(n[e]=void 0===i||(isNaN(i)?i:Number(i)))}return n}parseXml(t){t=t.replace(/\r\n?/g,"\n");const e=new ea("!xml");let i=e,n="",s="";for(let r=0;r<t.length;r++)if("<"===t[r])if("/"===t[r+1]){const e=ia(t,">",r,"Closing Tag is not closed."),a=s.lastIndexOf(".");s=s.substring(0,a),i=this.tagsNodeStack.pop(),i&&i.child&&n&&i.child[i.child.length-1][":@"]&&(i.child[i.child.length-1][":@"].text=n),n="",r=e}else if("?"===t[r+1])r=na(t,r,!1,"?>").closeIndex+1;else if("!--"===t.substr(r+1,3))r=ia(t,"--\x3e",r+4,"Comment is not closed.");else{const a=na(t,r,!1);let o=a.tagName,l=a.tagExp;const h=a.attrExpPresent,d=a.closeIndex;if(o!==e.tagname&&(s+=s?"."+o:o),l.length>0&&l.lastIndexOf("/")===l.length-1){"/"===o[o.length-1]?(o=o.substr(0,o.length-1),s=s.substr(0,s.length-1),l=o):l=l.substr(0,l.length-1);const t=new ea(o);o!==l&&h&&(t[":@"]=this.buildAttributesMap(l,s,o)),this.addChild(i,t,s),s=s.substr(0,s.lastIndexOf("."))}else{const t=new ea(o);this.tagsNodeStack.push(i),o!==l&&h&&(t[":@"]=this.buildAttributesMap(l,s,o)),this.addChild(i,t,s),i=t}n="",r=d}else n+=t[r];return e.child}}function aa(t,e){return oa(t)}function oa(t,e){const i={};for(let e=0;e<t.length;e++){const s=t[e],r=la(s);if(void 0!==r&&s[r]){const t=oa(s[r]);n=t,Object.keys(n).length,s[":@"]&&ha(t,s[":@"]),void 0!==i[r]&&i.hasOwnProperty(r)?(Array.isArray(i[r])||(i[r]=[i[r]]),i[r].push(t)):i[r]=t}}var n;return i}function la(t){const e=Object.keys(t);for(let t=0;t<e.length;t++){const i=e[t];if(":@"!==i)return i}}function ha(t,e,i){if(e){const i=Object.keys(e),n=i.length;for(let s=0;s<n;s++){const n=i[s];t[n]=e[n]}}}class da{constructor(t){this.options=Object.assign({},da.defaultOptions,t)}valid(t){return t.startsWith("<")}parse(t){if(!this.valid)return!1;return aa(new ra(this.options).parseXml(t),this.options)}}function ca(t,e,i){let n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;return t.expand(e+(n/2+(i?function(t,e){return t?e:0}(i,e):0))),t}da.defaultOptions={};let ua=0;function pa(){return ua++}var ga;!function(t){t[t.HORIZONTAL=0]="HORIZONTAL",t[t.VERTICAL=1]="VERTICAL"}(ga||(ga={}));const fa=new Map;["…","(",")","—","【","】","「","」","《","》"].forEach((t=>fa.set(t,!0)));const va=new Map;function ma(t){if(fa.has(t))return!0;if(va.has(t))return!1;let e=!1;return t.codePointAt(0)<256&&(e=!0),e}[""].forEach((t=>va.set(t,!0))),pa();const ba=pa(),ya=pa(),xa=pa();pa();const _a=pa(),wa=pa(),Ta=pa();pa();const Sa=pa();pa();const ka=pa();pa(),pa(),pa();const Ba=pa(),Aa=pa(),Ca=Symbol.for("GraphicService"),La=Symbol.for("GraphicCreator"),Oa={"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"},Ea=Object.keys(Oa),Ra=new pe,Ma=new fe;new pe;const Pa=["lineWidth","scaleX","scaleY","angle","anchor","visible"],Da=["x","y"],Ia=["scaleX","scaleY"],Fa=["angle"],Na=new qt,Ha={strokeSeg:1,boundsPadding:2,pickMode:1,boundsMode:1,customPickShape:1,pickable:1,childrenPickable:1,visible:1,zIndex:1,layout:1,keepDirIn3d:1,globalZIndex: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 za extends rs{static mixin(t){const e=Object.keys(t);for(let i=0;i<e.length;++i){const n=e[i];Object.defineProperty(za.prototype,n,Object.getOwnPropertyDescriptor(t,n))}}get AABBBounds(){return this.tryUpdateAABBBounds()}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]:{};var e;super(),this._AABBBounds=new pe,this._updateTag=$e.INIT,this.attribute=t,this.valid=this.isValid(),this.updateAABBBoundsStamp=0,t.background?this.loadImage(null!==(e=t.background.background)&&void 0!==e?e:t.background,!0):t.shadowGraphic&&this.setShadowGraphic(t.shadowGraphic)}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,n;const{dx:s=t.dx,dy:r=t.dy}=this.attribute;if(e&&this.parent){const t=this.parent.attribute;Na.x=s+(null!==(i=t.scrollX)&&void 0!==i?i:0),Na.y=r+(null!==(n=t.scrollY)&&void 0!==n?n:0)}else Na.x=s,Na.y=r;return Na}onAnimateBind(t){this._emitCustomEvent("animate-bind",t)}tryUpdateAABBBounds(){const t="imprecise"===this.attribute.boundsMode;if(!this.shouldUpdateAABBBounds())return this._AABBBounds;if(!this.valid)return this._AABBBounds.clear(),this._AABBBounds;xn.graphicService.beforeUpdateAABBBounds(this,this.stage,!0,this._AABBBounds);const e=this.doUpdateAABBBounds(t);return xn.graphicService.afterUpdateAABBBounds(this,this.stage,this._AABBBounds,this,!0),"empty"===this.attribute.boundsMode&&e.clear(),e}tryUpdateOBBBounds(){return this._OBBBounds||(this._OBBBounds=new ge),this.tryUpdateAABBBounds(),this.updateOBBBoundsStamp===this.updateAABBBoundsStamp?this._OBBBounds:(this.updateOBBBoundsStamp=this.updateAABBBoundsStamp,this.valid?this.doUpdateOBBBounds():(this._OBBBounds.clear(),this._OBBBounds))}combindShadowAABBBounds(t){if(this.shadowRoot){const e=this.shadowRoot.AABBBounds.clone();t.union(e)}}doUpdateOBBBounds(){return this._OBBBounds}getClipPath(){const{clipConfig:t}=this.attribute;if(!t)return null;this.clipPathMap||(this.clipPathMap=new Map);const{shape:e}=t;let i=this.clipPathMap.get(e)||null;return i||(this.clipPathMap.size>10&&this.clipPathMap.clear(),i=this.parsePath(e),i&&this.clipPathMap.set(e,i)),i}parsePath(t){if(!t)return null;let e=Qr[t];if(e)return e;if(e=za.userSymbolMap[t],e)return e;if(!0===((i=t=ta[t]||t).startsWith("<svg")||i.startsWith("<?xml"))){const e=new da,{svg:i}=e.parse(t);if(!i)return null;const n=ht(i.path)?i.path:[i.path];Ra.clear();const s=[];n.forEach((t=>{const e=(new Ki).fromString(t.d),i={};Ea.forEach((e=>{t[e]&&(i[Oa[e]]=t[e])})),s.push({path:e,attribute:i}),Ra.union(e.bounds)}));const r=Ra.width(),a=Ra.height(),o=1/Gt(r,a);s.forEach((t=>t.path.transform(0,0,o,o)));const l=new Jr(t,s,!0);return za.userSymbolMap[t]=l,l}var i;const n=(new Ki).fromString(t),s=n.bounds.width(),r=n.bounds.height(),a=1/Gt(s,r);n.transform(0,0,a,a);const o=new Jr(t,n);return za.userSymbolMap[t]=o,o}doUpdateAABBBounds(t){this.updateAABBBoundsStamp++;const e=this.getGraphicTheme();this._AABBBounds.clear();const i=this.attribute,n=this.updateAABBBounds(i,e,this._AABBBounds,t),{boundsPadding:s=e.boundsPadding}=i,r=(a=s)?ht(a)?0===a.length?0:1===a.length?a[0]:2===a.length?(Es[0]=a[0],Es[2]=a[0],Es[1]=a[1],Es[3]=a[1],Es):a:a:0;var a;return r&&n.expand(r),this.clearUpdateBoundTag(),n}updatePathProxyAABBBounds(t){const e="function"==typeof this.pathProxy?this.pathProxy(this.attribute):this.pathProxy;if(!e)return!1;const i=new Oe(t);return oi(e.commandList,i,0,0),!0}tryUpdateGlobalAABBBounds(){const t=this.AABBBounds;return this._globalAABBBounds?this._globalAABBBounds.setValue(t.x1,t.y1,t.x2,t.y2):this._globalAABBBounds=t.clone(),this._globalAABBBounds.empty()||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 fe),this.shouldUpdateLocalMatrix()&&(this.doUpdateLocalMatrix(),t&&this.clearUpdateLocalPositionTag()),this._transMatrix}shouldUpdateAABBBounds(){return this.shadowRoot?(!!(this._updateTag&$e.UPDATE_BOUNDS)||this.shadowRoot.shouldUpdateAABBBounds())&&xn.graphicService.validCheck(this.attribute,this.getGraphicTheme(),this._AABBBounds,this):!!(this._updateTag&$e.UPDATE_BOUNDS)&&xn.graphicService.validCheck(this.attribute,this.getGraphicTheme(),this._AABBBounds,this)}shouldSelfChangeUpdateAABBBounds(){return this.shadowRoot?!!(this._updateTag&$e.UPDATE_BOUNDS)||this.shadowRoot.shouldUpdateAABBBounds():!!(this._updateTag&$e.UPDATE_BOUNDS)}shouldUpdateLocalMatrix(){return!!(this._updateTag&$e.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&$e.UPDATE_SHAPE)}clearUpdateShapeTag(){this._updateTag&=$e.CLEAR_SHAPE}containsPoint(t,e,i,n){if(!n)return!1;if(i===qe.GLOBAL){const i=new qt(t,e);this.parent&&this.parent.globalTransMatrix.transformPoint(i,i),t=i.x,e=i.y}return n.containsPoint(this,{x:t,y:e})}setWidthHeightWithoutTransform(t){this.widthWithoutTransform=t.x2-t.x1,this.heightWithoutTransform=t.y2-t.y1}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):t.shadowGraphic&&this.setShadowGraphic(t.shadowGraphic),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 n=Object.keys(t);for(let e=0;e<n.length;e++){const i=n[e];this.attribute[i]=t[i]}this.valid=this.isValid(),this.updateShapeAndBoundsTagSetted()||!e&&!this.needUpdateTags(n)?this.addUpdateBoundTag():this.addUpdateShapeAndBoundsTag(),this.addUpdatePositionTag(),this.addUpdateLayoutTag(),this.onAttributeUpdate(i)}setAttribute(t,e,i,n){var s;const r=this.onBeforeAttributeUpdate&&this.onBeforeAttributeUpdate({[t]:e},this.attribute,t,n);r?this._setAttributes(r,i,n):it(null===(s=this.normalAttrs)||void 0===s?void 0:s[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(n)):this.normalAttrs[t]=e,"background"===t?this.loadImage(e,!0):"shadowGraphic"===t&&this.setShadowGraphic(e)}needUpdateTags(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Pa;for(let i=0;i<e.length;i++){const n=e[i];if(-1!==t.indexOf(n))return!0}return!1}needUpdateTag(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Pa;for(let i=0;i<e.length;i++)if(t===e[i])return!0;return!1}initAttributes(t){const e={type:Ze.INIT};t=this.onBeforeAttributeUpdate&&this.onBeforeAttributeUpdate(t,this.attribute,null,e)||t,this.attribute=t,t.background?this.loadImage(t.background,!0):t.shadowGraphic&&this.setShadowGraphic(t.shadowGraphic),this._updateTag=$e.INIT,this.valid=this.isValid(),this.onAttributeUpdate(e)}translate(t,e){var i,n;if(0===t&&0===e)return this;const s={type:Ze.TRANSLATE},r=this.onBeforeAttributeUpdate&&this.onBeforeAttributeUpdate({x:t,y:e},this.attribute,Da,s);r&&(t=r.x,e=r.y,delete r.x,delete r.y,this._setAttributes(r));const a=this.attribute,o=a.postMatrix;return o?xn.transformUtil.fromMatrix(o,o).translate(t,e):(a.x=(null!==(i=a.x)&&void 0!==i?i:Zi.x)+t,a.y=(null!==(n=a.y)&&void 0!==n?n:Zi.y)+e),this.addUpdatePositionTag(),this.addUpdateBoundTag(),this.addUpdateLayoutTag(),this.onAttributeUpdate(s),this}translateTo(t,e){const i=this.attribute;if(i.x===t&&i.y===e)return this;const n={type:Ze.TRANSLATE_TO},s=this.onBeforeAttributeUpdate&&this.onBeforeAttributeUpdate({x:t,y:e},this.attribute,Da,n);return s?(this._setAttributes(s,!1,n),this):(i.x=t,i.y=e,this.addUpdatePositionTag(),this.addUpdateBoundTag(),this.addUpdateLayoutTag(),this.onAttributeUpdate(n),this)}scale(t,e,i){var n,s;if(1===t&&1===e)return this;const r={type:Ze.SCALE},a=this.onBeforeAttributeUpdate&&this.onBeforeAttributeUpdate({scaleX:t,scaleY:e,scaleCenter:i},this.attribute,Ia,r);a&&(t=a.scaleX,e=a.scaleY,delete a.scaleX,delete a.scaleY,this._setAttributes(a));const o=this.attribute;if(i){let{postMatrix:n}=this.attribute;n||(n=new fe,o.postMatrix=n),xn.transformUtil.fromMatrix(n,n).scale(t,e,i)}else o.scaleX=(null!==(n=o.scaleX)&&void 0!==n?n:Zi.scaleX)*t,o.scaleY=(null!==(s=o.scaleY)&&void 0!==s?s:Zi.scaleY)*e;return this.addUpdatePositionTag(),this.addUpdateBoundTag(),this.addUpdateLayoutTag(),this.onAttributeUpdate(r),this}scaleTo(t,e){const i=this.attribute;if(i.scaleX===t&&i.scaleY===e)return this;const n={type:Ze.SCALE_TO},s=this.onBeforeAttributeUpdate&&this.onBeforeAttributeUpdate({scaleX:t,scaleY:e},this.attribute,Ia,n);return s?(this._setAttributes(s,!1,n),this):(i.scaleX=t,i.scaleY=e,this.addUpdatePositionTag(),this.addUpdateBoundTag(),this.addUpdateLayoutTag(),this.onAttributeUpdate(n),this)}rotate(t,e){var i;if(0===t)return this;const n={type:Ze.ROTATE},s=this.onBeforeAttributeUpdate&&this.onBeforeAttributeUpdate({angle:t,rotateCenter:e},this.attribute,Fa,n);s&&(delete s.angle,this._setAttributes(s,!1,n));const r=this.attribute;if(e){let{postMatrix:i}=this.attribute;i||(i=new fe,r.postMatrix=i),xn.transformUtil.fromMatrix(i,i).rotate(t,e)}else r.angle=(null!==(i=r.angle)&&void 0!==i?i:Zi.angle)+t;return this.addUpdatePositionTag(),this.addUpdateBoundTag(),this.addUpdateLayoutTag(),this.onAttributeUpdate(n),this}rotateTo(t){const e=this.attribute;if(e.angle===t)return this;const i={type:Ze.ROTATE_TO},n=this.onBeforeAttributeUpdate&&this.onBeforeAttributeUpdate(t,this.attribute,Fa,i);return n?(this._setAttributes(n,!1,i),this):(e.angle=t,this.addUpdatePositionTag(),this.addUpdateBoundTag(),this.addUpdateLayoutTag(),this.onAttributeUpdate(i),this)}skewTo(t,e){return this}animate(t){var e;this.animates||(this.animates=new Map);const i=new ks(null==t?void 0:t.id,null!==(e=null==t?void 0:t.timeline)&&void 0!==e?e:this.stage&&this.stage.getTimeline(),null==t?void 0:t.slience);if(i.bind(this),t){const{onStart:e,onFrame:n,onEnd:s,onRemove:r}=t;null!=e&&i.onStart(e),null!=n&&i.onFrame(n),null!=s&&i.onEnd(s),null!=r&&i.onRemove(r),i.interpolateFunc=t.interpolate}return this.animates.set(i.id,i),i.onRemove((()=>{i.stop(),this.animates.delete(i.id)})),i}onAttributeUpdate(t){t&&t.skipUpdateCallback||(xn.graphicService.onAttributeUpdate(this),this._emitCustomEvent("afterAttributeUpdate",t))}update(t){t?(t.bounds&&this.tryUpdateAABBBounds(),t.trans&&this.tryUpdateLocalTransMatrix()):(this.tryUpdateAABBBounds(),this.tryUpdateLocalTransMatrix())}hasState(t){return!(!this.currentStates||!this.currentStates.length)&&(!!it(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,n){var s,r,a,o;if(i){const i=Object.keys(t),l=this.getNoWorkAnimateAttr(),h={};let d;i.forEach((e=>{l[e]?(d||(d={}),d[e]=t[e]):h[e]=n&&void 0===t[e]?this.getDefaultAttribute(e):t[e]}));const c=this.animate({slience:!0});c.stateNames=e,c.to(h,null!==(r=null===(s=this.stateAnimateConfig)||void 0===s?void 0:s.duration)&&void 0!==r?r:Cs,null!==(o=null===(a=this.stateAnimateConfig)||void 0===a?void 0:a.easing)&&void 0!==o?o:Ls),d&&this.setAttributes(d,!1,{type:Ze.STATE})}else this.stopStateAnimates(),this.setAttributes(t,!1,{type:Ze.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}stopStateAnimates(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"end";this.animates&&this.animates.forEach((e=>{e.stateNames&&(e.stop(t),this.animates.delete(e.id))}))}getNormalAttribute(t){let e=this.attribute[t];return this.animates&&this.animates.forEach((i=>{if(i.stateNames){const n=i.getEndProps();_t(n,t)&&(e=n[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){const i=ht(t)?e=>!t.includes(e):e=>e!==t,n=this.currentStates.filter(i);n.length!==this.currentStates.length&&this.useStates(n,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 n;if(this.currentStates&&this.currentStates.includes(t)&&(e||1===this.currentStates.length))return;const s=e&&(null===(n=this.currentStates)||void 0===n?void 0:n.length)?this.currentStates.concat([t]):[t];this.useStates(s,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 n={};t.forEach((e=>{var i;const s=this.stateProxy?this.stateProxy(e,t):null===(i=this.states)||void 0===i?void 0:i[e];s&&Object.assign(n,s)})),this.updateNormalAttrs(n),this.currentStates=t,this.applyStateAttrs(n,t,e)}addUpdateBoundTag(){this._updateTag|=$e.UPDATE_BOUNDS,this.parent&&this.parent.addChildUpdateBoundTag(),this.glyphHost&&this.glyphHost.addUpdateBoundTag()}addUpdateShapeTag(){this._updateTag|=$e.UPDATE_SHAPE}addUpdateShapeAndBoundsTag(){this._updateTag|=$e.UPDATE_SHAPE_AND_BOUNDS,this.parent&&this.parent.addChildUpdateBoundTag(),this.glyphHost&&this.glyphHost.addUpdateBoundTag()}updateShapeAndBoundsTagSetted(){return(this._updateTag&$e.UPDATE_SHAPE_AND_BOUNDS)===$e.UPDATE_SHAPE_AND_BOUNDS}clearUpdateBoundTag(){this._updateTag&=$e.CLEAR_BOUNDS}addUpdatePositionTag(){this.shadowRoot&&this.shadowRoot.addUpdateGlobalPositionTag(),this._updateTag|=$e.UPDATE_GLOBAL_LOCAL_MATRIX}addUpdateGlobalPositionTag(){this.shadowRoot&&this.shadowRoot.addUpdateGlobalPositionTag(),this._updateTag|=$e.UPDATE_GLOBAL_MATRIX}clearUpdateLocalPositionTag(){this._updateTag&=$e.CLEAR_LOCAL_MATRIX}clearUpdateGlobalPositionTag(){this._updateTag&=$e.CLEAR_GLOBAL_MATRIX}addUpdateLayoutTag(){this._updateTag|=$e.UPDATE_LAYOUT}clearUpdateLayoutTag(){this._updateTag&=$e.CLEAR_LAYOUT}needUpdateLayout(){return!!(this._updateTag&$e.UPDATE_LAYOUT)}getAnchor(t,e,i){const n=[0,0],s=()=>{if(e.b)return e.b;const t=this.clone();return t.attribute.angle=0,t.attribute.scaleCenter=null,i&&(t.attribute.scaleX=1,t.attribute.scaleY=1),e.b=t.AABBBounds,e.b};if("string"==typeof t[0]){const e=parseFloat(t[0])/100,i=s();n[0]=i.x1+(i.x2-i.x1)*e}else n[0]=t[0];if("string"==typeof t[1]){const e=parseFloat(t[1])/100,i=s();n[1]=i.y1+(i.y2-i.y1)*e}else n[1]=t[1];return n}doUpdateLocalMatrix(){const{x:t=Zi.x,y:e=Zi.y,scaleX:i=Zi.scaleX,scaleY:n=Zi.scaleY,angle:s=Zi.angle,scaleCenter:r,anchor:a,postMatrix:o}=this.attribute;let l=[0,0];const h={};if(a&&s&&(l=this.getAnchor(a,h)),!r||1===i&&1===n)!function(t,e,i,n,s,r,a,o){const l=e.a,h=e.b,d=e.c,c=e.d,u=e.e,p=e.f,g=jt(a),f=Vt(a);let v,m;o?(v=o[0],m=o[1]):(v=i,m=n);const b=v-i,y=m-n,x=l*g+d*f,_=h*g+c*f,w=d*g-l*f,T=c*g-h*f;t.a=s*x,t.b=s*_,t.c=r*w,t.d=r*T,t.e=u+l*v+d*m-x*b-w*y,t.f=p+h*v+c*m-_*b-T*y}(this._transMatrix,this._transMatrix.reset(),t,e,i,n,s,a&&l);else{const a=this._transMatrix;a.reset(),a.translate(l[0],l[1]),a.rotate(s),a.translate(-l[0],-l[1]),a.translate(t,e),l=this.getAnchor(r,h,!0),xn.transformUtil.fromMatrix(a,a).scale(i,n,{x:l[0],y:l[1]})}const d=this.getOffsetXY(Zi);if(this._transMatrix.e+=d.x,this._transMatrix.f+=d.y,o){const t=Ma.setValue(o.a,o.b,o.c,o.d,o.e,o.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.timeline===ws&&t.setTimeline(e)}))}this._onSetStage&&this._onSetStage(this,t,e),xn.graphicService.onSetStage(this,t)}}setStageToShadowRoot(t,e){this.shadowRoot&&this.shadowRoot.setStage(t,e)}onAddStep(t){}onStop(t){t&&this.setAttributes(t,!1,{type:Ze.ANIMATE_END})}onStep(t,e,i,n,s){const r={};if(i.customAnimate)i.customAnimate.update(s,n,r);else{const a=i.props,o=i.parsedProps,l=i.propKeys;this.stepInterpolate(t,e,r,i,n,s,a,void 0,o,l)}this.setAttributes(r,!1,{type:Ze.ANIMATE_UPDATE,animationState:{ratio:n,end:s,step:i,isFirstFrameOfStep:t.getLastStep()!==i}}),this.stage&&this.stage.renderNextFrame()}stepInterpolate(t,e,i,n,s,r,a,o,l,h){h||(h=Object.keys(a),n.propKeys=h),r?n.propKeys.forEach((t=>{e.validAttr(t)&&(i[t]=a[t])})):h.forEach((r=>{var h;if(!e.validAttr(r))return;const d=a[r],c=null!==(h=o&&o[r])&&void 0!==h?h:t.getLastPropByName(r,n);if(null==d||null==c||d===c)return void(i[r]=d);let u;u=e.interpolateFunc&&e.interpolateFunc(r,s,c,d,i),u||(u=e.customInterpolate(r,s,c,d,this,i),u||this.defaultInterpolate(d,c,r,i,l,s)||this._interpolate(r,s,c,d,i))})),n.parsedProps=l}defaultInterpolate(t,e,i,n,s,r){if(Number.isFinite(t)&&Number.isFinite(e))return n[i]=e+(t-e)*r,!0;if("fill"===i){s||(s={});const a=s.fillColorArray,o=js(e,null!=a?a:t,r,!1,((t,e)=>{s.fillColorArray=e}));return o&&(n[i]=o),!0}if("stroke"===i){s||(s={});const a=s.strokeColorArray,o=js(e,null!=a?a:t,r,!1,((t,e)=>{s.strokeColorArray=e}));return o&&(n[i]=o),!0}if("shadowColor"===i){s||(s={});const a=s.shadowColorArray,o=js(e,null!=a?a:t,r,!0,((t,e)=>{s.shadowColorArray=e}));return o&&(n[i]=o),!0}if(Array.isArray(t)&&t.length===e.length){const s=[];let a=!0;for(let i=0;i<t.length;i++){const n=e[i],o=n+(t[i]-n)*r;if(!Number.isFinite(o)){a=!1;break}s.push(o)}a&&(n[i]=s)}return!1}_interpolate(t,e,i,n,s){}getDefaultAttribute(t){return this.getGraphicTheme()[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:xn.graphicService.creator.shadowRoot(this),this.addUpdateBoundTag(),this.shadowRoot.setStage(this.stage,this.layer),this.shadowRoot}detachShadow(){this.shadowRoot&&(this.addUpdateBoundTag(),this.shadowRoot.release(!0),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 lt(t,!0)?this.pathProxy=(new Ki).fromString(t):this.pathProxy=new Ki,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 n={data:"init",state:null};this.resources.set(i,n),"string"==typeof t?(n.state="loading",t.startsWith("<svg")?(Ks.GetSvg(t,this),this.backgroundImg=this.backgroundImg||e):(pt(t)||t.includes("/")||gt(t))&&(Ks.GetImage(t,this),this.backgroundImg=this.backgroundImg||e)):st(t)?(n.state="success",n.data=t,this.backgroundImg=this.backgroundImg||e):n.state="fail"}setShadowGraphic(t){t?this.attachShadow().add(t):this.detachShadow()}imageLoadSuccess(t,e,i){if(!this.resources)return;const n=this.resources.get(t);n&&(n.state="success",n.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",this.stopAnimates(),xn.graphicService.onRelease(this)}_emitCustomEvent(t,e){var i,n;if(this._events&&t in this._events){const s=new ds(t,e);s.bubbles=!1,s.manager=null===(n=null===(i=this.stage)||void 0===i?void 0:i.eventSystem)||void 0===n?void 0:n.manager,this.dispatchEvent(s)}}}var Wa;za.userSymbolMap={},za.mixin(ps),function(t){t[t.LESS_GROUP=0]="LESS_GROUP",t[t.MORE_GROUP=1]="MORE_GROUP"}(Wa||(Wa={}));class Ua extends za{constructor(t){super(t),this.type="group",this.parent=null,this.isContainer=!0,this.numberType=_a,this._childUpdateTag=$e.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 es),this.theme.setTheme(t,this)}createTheme(){this.theme||(this.theme=new es)}visibleAll(t){this.setAttribute("visible",t),this.forEachChildren((e=>{e.isContainer&&e.visibleAll?e.visibleAll(t):e.setAttribute("visible",t)}))}hideAll(){this.visibleAll(!1)}showAll(){this.visibleAll(!0)}containsPoint(t,e,i){if(i===qe.GLOBAL){const i=new qt(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&$e.UPDATE_BOUNDS)}tryUpdateAABBBounds(){if(!this.shouldUpdateAABBBounds())return this._AABBBounds;xn.graphicService.beforeUpdateAABBBounds(this,this.stage,!0,this._AABBBounds);const t=this.shouldSelfChangeUpdateAABBBounds(),e=this.doUpdateAABBBounds();return this.addUpdateLayoutTag(),xn.graphicService.afterUpdateAABBBounds(this,this.stage,this._AABBBounds,this,t),"empty"===this.attribute.boundsMode&&e.clear(),e}doUpdateLocalMatrix(){const{x:t=Zi.x,y:e=Zi.y,dx:i=Zi.dx,dy:n=Zi.dy,scaleX:s=Zi.scaleX,scaleY:r=Zi.scaleY,angle:a=Zi.angle,postMatrix:o}=this.attribute;if(0!==t||0!==e||0!==i||0!==n||1!==s||1!==r||0!==a||o)return super.doUpdateLocalMatrix();this._transMatrix.reset()}getGraphicTheme(){return ns(this).group}updateAABBBounds(t,e,i){const n=i;i=i.clone();const{width:s,height:r,path:a,clip:o=e.clip}=t;if(a&&a.length?a.forEach((t=>{i.union(t.AABBBounds)})):null!=s&&null!=r&&i.set(0,0,Math.max(0,s),Math.max(0,r)),!o){this.forEachChildren((t=>{i.union(t.AABBBounds)}));const{scrollX:e=0,scrollY:n=0}=t;i.translate(e,n)}return xn.graphicService.updateTempAABBBounds(i),xn.graphicService.transformAABBBounds(t,i,e,!1,this),n.copy(i),n}doUpdateAABBBounds(){this.updateAABBBoundsStamp++;const t=super.doUpdateAABBBounds();return this.parent&&this.parent.addChildUpdateBoundTag(),this._emitCustomEvent("AAABBBoundsChange"),t}clearUpdateBoundTag(){this._updateTag&=$e.CLEAR_BOUNDS,this._childUpdateTag&=$e.CLEAR_BOUNDS}addUpdateBoundTag(){this._updateTag|=$e.UPDATE_BOUNDS,this.parent&&this.parent.addChildUpdateBoundTag()}addChildUpdateBoundTag(){this._childUpdateTag&$e.UPDATE_BOUNDS||(this._childUpdateTag|=$e.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(),xn.graphicService.onAddIncremental(t,this,this.stage),e}incrementalClearChild(){super.removeAllChild(),this.addUpdateBoundTag(),xn.graphicService.onClearIncremental(this,this.stage)}_updateChildToStage(t){return this.stage&&t&&t.setStage(this.stage,this.layer),this.addUpdateBoundTag(),t}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){return this._updateChildToStage(super.insertBefore(t,e))}insertAfter(t,e){return this._updateChildToStage(super.insertAfter(t,e))}insertInto(t,e){return this._updateChildToStage(super.insertInto(t,e))}removeChild(t){const e=super.removeChild(t);return t.stage=null,xn.graphicService.onRemove(t),this.addUpdateBoundTag(),e}removeAllChild(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];this.forEachChildren((e=>{xn.graphicService.onRemove(e),t&&e.isContainer&&e.removeAllChild(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),xn.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&$e.UPDATE_GLOBAL_MATRIX)}_getChildByName(t,e){return this.find((e=>e.name===t),e)}createOrUpdateChild(t,e,i){let n=this._getChildByName(t);return n?n.setAttributes(e):(n=xn.graphicService.creator[i](e),n.name=t,this.add(n)),n}clone(){return new Ua(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return Ua.NOWORK_ANIMATE_ATTR}release(t){t&&this.forEachChildren((e=>{e.release(t)})),super.release()}}function ja(t){return new Ua(t)}Ua.NOWORK_ANIMATE_ATTR=Ha;class Ga extends Ua{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,n){var s;super({}),this.stage=t,this.global=e,this.window=i,this.main=n.main,this.layerHandler=n.layerHandler,this.layerHandler.init(this,i,{main:n.main,canvasId:n.canvasId,width:this.viewWidth,height:this.viewHeight,zIndex:null!==(s=n.zIndex)&&void 0!==s?s:0}),this.layer=this,this.subLayers=new Map,this.theme=new es,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=>{xn.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;this.layerHandler.render([this],{renderService:t.renderService,stage:this.stage,layer:this,viewBox:t.viewBox,transMatrix:t.transMatrix,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){}release(){super.release(),this.layerHandler.release(),this.subLayers&&this.subLayers.forEach((t=>{xn.layerService.releaseLayer(this.stage,t.layer)}))}drawTo(t,e){var i;this.layerHandler.drawTo(t,[this],Object.assign({background:null!==(i=e.background)&&void 0!==i?i:this.background,renderService:e.renderService,viewBox:e.viewBox,transMatrix:e.transMatrix,stage:this.stage,layer:this},e)),this.afterDrawCbs.forEach((t=>t(this)))}}const Ya=Symbol.for("TransformUtil"),Va=Symbol.for("GraphicUtil"),Xa=Symbol.for("LayerService"),Ka=Symbol.for("StaticLayerHandlerContribution"),$a=Symbol.for("DynamicLayerHandlerContribution"),qa=Symbol.for("VirtualLayerHandlerContribution");var Za,Ja=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Qa=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let to=Za=class{static GenerateLayerId(){return`${Za.idprefix}_${Za.prefix_count++}`}constructor(){this.layerMap=new Map,this.global=xn.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?Pn.get(Ka):"dynamic"===t?Pn.get($a):Pn.get(qa),e}createLayer(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{main:!1};var i;this.tryInit();let n=this.getRecommendedLayerType(e.layerMode);n=e.main||e.canvasId?"static":n;const s=this.getLayerHandler(n),r=new Ga(t,this.global,t.window,Object.assign(Object.assign({main:!1},e),{layerMode:n,canvasId:null!==(i=e.canvasId)&&void 0!==i?i:Za.GenerateLayerId(),layerHandler:s})),a=this.layerMap.get(t)||[];return a.push(r),this.layerMap.set(t,a),this.staticLayerCountInEnv--,r}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}releaseStage(t){this.layerMap.delete(t)}};to.idprefix="visactor_layer",to.prefix_count=0,to=Za=Ja([y(),Qa("design:paramtypes",[])],to);var eo=new a((t=>{t(U).to(K).inSingletonScope(),t(Wn).to(jn),t(Va).to(Xn).inSingletonScope(),t(Ya).to(qn).inSingletonScope(),t(Xa).to(to).inSingletonScope()}));function io(t,e){return!(!t&&!e)}function no(t,e){let i;return i=ht(t)?t.some((t=>t||void 0===t)):!!t,i&&e>0}function so(t,e,i){return i&&t*e>0}function ro(t,e,i,n,s){return s&&t*e>0&&0!==i&&0!==n}function ao(t,e){return t*e>0}function oo(t,e,i,n){return t*e>0&&0!==i&&0!==n}const lo=Symbol.for("AreaRenderContribution"),ho=Symbol.for("GroupRenderContribution"),co=Symbol.for("RectRenderContribution"),uo=Symbol.for("SymbolRenderContribution"),po=Symbol.for("TextRenderContribution"),go=Symbol.for("InteractiveSubRenderContribution");function fo(t,e){return"end"===t||"right"===t?-e:"center"===t?-e/2:0}function vo(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)}function mo(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}function bo(t,e,i){const n=i[0],s=i[1],r=i[2];let a,o,l,h,d,c,u,p,g,f,v,m;return e===t?(t[12]=e[0]*n+e[4]*s+e[8]*r+e[12],t[13]=e[1]*n+e[5]*s+e[9]*r+e[13],t[14]=e[2]*n+e[6]*s+e[10]*r+e[14],t[15]=e[3]*n+e[7]*s+e[11]*r+e[15]):(a=e[0],o=e[1],l=e[2],h=e[3],d=e[4],c=e[5],u=e[6],p=e[7],g=e[8],f=e[9],v=e[10],m=e[11],t[0]=a,t[1]=o,t[2]=l,t[3]=h,t[4]=d,t[5]=c,t[6]=u,t[7]=p,t[8]=g,t[9]=f,t[10]=v,t[11]=m,t[12]=a*n+d*s+g*r+e[12],t[13]=o*n+c*s+f*r+e[13],t[14]=l*n+u*s+v*r+e[14],t[15]=h*n+p*s+m*r+e[15]),t}function yo(t,e,i){const n=e[0],s=e[1],r=e[2],a=e[3],o=e[4],l=e[5],h=e[6],d=e[7],c=e[8],u=e[9],p=e[10],g=e[11],f=e[12],v=e[13],m=e[14],b=e[15];let y=i[0],x=i[1],_=i[2],w=i[3];return t[0]=y*n+x*o+_*c+w*f,t[1]=y*s+x*l+_*u+w*v,t[2]=y*r+x*h+_*p+w*m,t[3]=y*a+x*d+_*g+w*b,y=i[4],x=i[5],_=i[6],w=i[7],t[4]=y*n+x*o+_*c+w*f,t[5]=y*s+x*l+_*u+w*v,t[6]=y*r+x*h+_*p+w*m,t[7]=y*a+x*d+_*g+w*b,y=i[8],x=i[9],_=i[10],w=i[11],t[8]=y*n+x*o+_*c+w*f,t[9]=y*s+x*l+_*u+w*v,t[10]=y*r+x*h+_*p+w*m,t[11]=y*a+x*d+_*g+w*b,y=i[12],x=i[13],_=i[14],w=i[15],t[12]=y*n+x*o+_*c+w*f,t[13]=y*s+x*l+_*u+w*v,t[14]=y*r+x*h+_*p+w*m,t[15]=y*a+x*d+_*g+w*b,t}class xo{constructor(){this.pools=[]}static identity(t){return mo(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 xo.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 _o=new class{constructor(){this.pools=[]}allocate(t,e,i,n,s,r){if(!this.pools.length)return new fe(t,e,i,n,s,r);const a=this.pools.pop();return a.a=t,a.b=e,a.c=i,a.d=n,a.e=s,a.f=r,a}allocateByObj(t){if(!this.pools.length)return new fe(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=[]}},wo=new xo;var To=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},So=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},ko=function(t,e){return function(i,n){e(i,n,t)}};function Bo(t,e,i){var n;const{x:s=i.x,y:r=i.y,z:a=i.z,dx:o=i.dx,dy:l=i.dy,dz:h=i.dz,scaleX:d=i.scaleX,scaleY:c=i.scaleY,scaleZ:u=i.scaleZ,alpha:p=i.alpha,beta:g=i.beta,angle:f=i.angle,anchor3d:v=e.attribute.anchor,anchor:m}=e.attribute,b=[0,0,0];if(v){if("string"==typeof v[0]){const t=parseFloat(v[0])/100,i=e.AABBBounds;b[0]=i.x1+(i.x2-i.x1)*t}else b[0]=v[0];if("string"==typeof v[1]){const t=parseFloat(v[1])/100,i=e.AABBBounds;b[1]=i.x1+(i.x2-i.x1)*t}else b[1]=v[1];b[2]=null!==(n=v[2])&&void 0!==n?n:0}if(mo(t),bo(t,t,[s+o,r+l,a+h]),bo(t,t,[b[0],b[1],b[2]]),function(t,e,i){const n=Math.sin(i),s=Math.cos(i),r=e[4],a=e[5],o=e[6],l=e[7],h=e[8],d=e[9],c=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]=r*s+h*n,t[5]=a*s+d*n,t[6]=o*s+c*n,t[7]=l*s+u*n,t[8]=h*s-r*n,t[9]=d*s-a*n,t[10]=c*s-o*n,t[11]=u*s-l*n}(t,t,g),function(t,e,i){const n=Math.sin(i),s=Math.cos(i),r=e[0],a=e[1],o=e[2],l=e[3],h=e[8],d=e[9],c=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]=r*s-h*n,t[1]=a*s-d*n,t[2]=o*s-c*n,t[3]=l*s-u*n,t[8]=r*n+h*s,t[9]=a*n+d*s,t[10]=o*n+c*s,t[11]=l*n+u*s}(t,t,p),bo(t,t,[-b[0],-b[1],b[2]]),function(t,e,i){const n=i[0],s=i[1],r=i[2];t[0]=e[0]*n,t[1]=e[1]*n,t[2]=e[2]*n,t[3]=e[3]*n,t[4]=e[4]*s,t[5]=e[5]*s,t[6]=e[6]*s,t[7]=e[7]*s,t[8]=e[8]*r,t[9]=e[9]*r,t[10]=e[10]*r,t[11]=e[11]*r,t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]}(t,t,[d,c,u]),f){const i=wo.allocate(),n=[0,0];if(m){if("string"==typeof v[0]){const t=parseFloat(v[0])/100,i=e.AABBBounds;n[0]=i.x1+(i.x2-i.x1)*t}else n[0]=v[0];if("string"==typeof v[1]){const t=parseFloat(v[1])/100,i=e.AABBBounds;n[1]=i.x1+(i.x2-i.x1)*t}else n[1]=v[1]}bo(i,i,[n[0],n[1],0]),function(t,e,i){const n=Math.sin(i),s=Math.cos(i),r=e[0],a=e[1],o=e[2],l=e[3],h=e[4],d=e[5],c=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]=r*s+h*n,t[1]=a*s+d*n,t[2]=o*s+c*n,t[3]=l*s+u*n,t[4]=h*s-r*n,t[5]=d*s-a*n,t[6]=c*s-o*n,t[7]=u*s-l*n}(i,i,f),bo(i,i,[-n[0],-n[1],0]),yo(t,t,i)}}let Ao=class{constructor(t){this.creator=t,this.hooks={onAttributeUpdate:new z(["graphic"]),onSetStage:new z(["graphic","stage"]),onRemove:new z(["graphic"]),onRelease:new z(["graphic"]),onAddIncremental:new z(["graphic","group","stage"]),onClearIncremental:new z(["graphic","group","stage"]),beforeUpdateAABBBounds:new z(["graphic","stage","willUpdate","aabbBounds"]),afterUpdateAABBBounds:new z(["graphic","stage","aabbBounds","globalAABBBounds","selfChange"]),clearAABBBounds:new z(["graphic","stage","aabbBounds"])},this.tempAABBBounds1=new pe,this.tempAABBBounds2=new pe}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,n){this.hooks.beforeUpdateAABBBounds.taps.length&&this.hooks.beforeUpdateAABBBounds.call(t,e,i,n)}afterUpdateAABBBounds(t,e,i,n,s){this.hooks.afterUpdateAABBBounds.taps.length&&this.hooks.afterUpdateAABBBounds.call(t,e,i,n,s)}clearAABBBounds(t,e,i){this.hooks.clearAABBBounds.taps.length&&this.hooks.clearAABBBounds.call(t,e,i)}updatePathProxyAABBBounds(t,e){const i="function"==typeof e.pathProxy?e.pathProxy(e.attribute):e.pathProxy;if(!i)return!1;const n=new Oe(t);return oi(i.commandList,n,0,0),!0}updateHTMLTextAABBBounds(t,e,i,n){const{textAlign:s,textBaseline:r}=t;if(null!=t.forceBoundsHeight){const e=ct(t.forceBoundsHeight)?t.forceBoundsHeight:t.forceBoundsHeight(),n=vo(r,e,e);i.set(i.x1,n,i.x2,n+e)}if(null!=t.forceBoundsWidth){const e=ct(t.forceBoundsWidth)?t.forceBoundsWidth:t.forceBoundsWidth(),n=fo(s,e);i.set(n,i.y1,n+e,i.y2)}}combindShadowAABBBounds(t,e){if(e&&e.shadowRoot){const i=e.shadowRoot.AABBBounds;t.union(i)}}transformAABBBounds(t,e,i,n,s){if(!e.empty()){const{scaleX:s=i.scaleX,scaleY:r=i.scaleY,stroke:a=i.stroke,shadowBlur:o=i.shadowBlur,lineWidth:l=i.lineWidth,pickStrokeBuffer:h=i.pickStrokeBuffer,strokeBoundsBuffer:d=i.strokeBoundsBuffer}=t,c=this.tempAABBBounds1,u=this.tempAABBBounds2;if(a&&l){ca(c,(l+h)/Math.abs(s+r),n,d),e.union(c),c.setValue(u.x1,u.y1,u.x2,u.y2)}if(o){const{shadowOffsetX:n=i.shadowOffsetX,shadowOffsetY:a=i.shadowOffsetY}=t;ca(c,o/Math.abs(s+r)*2,!1,d+1),c.translate(n,a),e.union(c)}}if(this.combindShadowAABBBounds(e,s),e.empty())return;let r=!0;const a=s.transMatrix;s&&s.isContainer&&(r=!(1===a.a&&0===a.b&&0===a.c&&1===a.d&&0===a.e&&0===a.f)),r&&ce(e,e,a)}validCheck(t,e,i,n){if(!n)return!0;if(null!=t.forceBoundsHeight||null!=t.forceBoundsWidth)return!0;if(n.shadowRoot||n.isContainer)return!0;const{visible:s=e.visible}=t;return!(!n.valid||!s)||(i.empty()||(n.parent&&i.transformWithMatrix(n.parent.globalTransMatrix),xn.graphicService.clearAABBBounds(n,n.stage,i),i.clear()),!1)}updateTempAABBBounds(t){const e=this.tempAABBBounds1,i=this.tempAABBBounds2;return e.setValue(t.x1,t.y1,t.x2,t.y2),i.setValue(t.x1,t.y1,t.x2,t.y2),{tb1:e,tb2:i}}};Ao=To([y(),ko(0,m(La)),So("design:paramtypes",[Object])],Ao);const Co=(t,e,i)=>{const{outerBorder:n,shadowBlur:s=e.shadowBlur}=t;if(n){const t=e.outerBorder,{distance:r=t.distance,lineWidth:a=t.lineWidth}=n;i.expand(r+(s+a)/2)}return i},Lo=["radius","startAngle","endAngle",...Pa];class Oo extends za{constructor(){super(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{radius:1}),this.type="circle",this.numberType=xa}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)}getGraphicTheme(){return ns(this).circle}updateAABBBounds(t,e,i,n){this.updatePathProxyAABBBounds(i)||(n?this.updateCircleAABBBoundsImprecise(t,e,i):this.updateCircleAABBBoundsAccurate(t,e,i));const{tb1:s,tb2:r}=xn.graphicService.updateTempAABBBounds(i);return Co(t,e,s),i.union(s),s.setValue(r.x1,r.y1,r.x2,r.y2),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1,xn.graphicService.transformAABBBounds(t,i,e,!1,this),i}updateCircleAABBBoundsImprecise(t,e,i){const{radius:n=e.radius}=t;return i.set(-n,-n,n,n),i}updateCircleAABBBoundsAccurate(t,e,i){const{startAngle:n=e.startAngle,endAngle:s=e.endAngle,radius:r=e.radius}=t;return s-n>zt-It?i.set(-r,-r,r,r):function(t,e,i,n){for(;t>=zt;)t-=zt;for(;t<0;)t+=zt;for(;t>e;)e+=zt;Rs[0].x=i,Rs[1].y=i,Rs[2].x=-i,Rs[3].y=-i;const s=Math.ceil(t/Nt)%4,r=Math.ceil(e/Nt)%4;if(n.add(jt(t)*i,Vt(t)*i),n.add(jt(e)*i,Vt(e)*i),s!==r||e-t>Ft){let t=!1;for(let e=0;e<Ms.length;e++)if(t||s!==Ms[e]){if(t&&r===Ms[e])break;if(t){const t=Rs[Ms[e]];n.add(t.x,t.y)}}else{t=!0;const e=Rs[s];n.add(e.x,e.y)}}}(n,s,r,i),i}needUpdateTags(t){return super.needUpdateTags(t,Lo)}needUpdateTag(t){return super.needUpdateTag(t,Lo)}toCustomPath(){var t,e,i;const n=this.attribute,s=null!==(t=n.radius)&&void 0!==t?t:this.getDefaultAttribute("radius"),r=null!==(e=n.startAngle)&&void 0!==e?e:this.getDefaultAttribute("startAngle"),a=null!==(i=n.endAngle)&&void 0!==i?i:this.getDefaultAttribute("endAngle"),o=new Ki;return o.arc(0,0,s,r,a),o}clone(){return new Oo(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return Oo.NOWORK_ANIMATE_ATTR}}Oo.NOWORK_ANIMATE_ATTR=Ha;class Eo{constructor(t,e,i){this.fontFamily=t,this.textOptions=e,this.textMeasure=i}LayoutBBox(t,e,i,n){if(t.xOffset="left"===e||"start"===e?0:"center"===e?t.width/-2:"right"===e||"end"===e?-t.width:0,"top"===i)t.yOffset=0;else if("middle"===i)t.yOffset=t.height/-2;else if("alphabetic"===i){let e=.79;if(1===n.length){const t=n[0];e=t.ascent/(t.ascent+t.descent)}t.yOffset=t.height*-e}else t.yOffset=-t.height;return t}GetLayoutByLines(t,e,i,n){let s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:"",r=arguments.length>5?arguments[5]:void 0,a=arguments.length>6?arguments[6]:void 0;const{lineWidth:o,suffixPosition:l="end",measureMode:h=$.actualBounding,keepCenterInLine:d=!1}=null!=a?a:{};t=t.map((t=>t.toString()));const c=[],u=[0,0];if("number"==typeof o&&o!==1/0){let e;for(let i=0,n=t.length;i<n;i++){const n=this.textMeasure.measureTextPixelADscentAndWidth(t[i],this.textOptions,h);let a=t[i].toString();if(n.width>o){const n=this.textMeasure.clipTextWithSuffix(t[i],this.textOptions,o,s,r,l);a=n.str,e=n.width}else e=n.width;c.push({str:a,width:e,ascent:n.ascent,descent:n.descent,keepCenterInLine:d})}u[0]=o}else{let e,i,n=0;for(let s=0,r=t.length;s<r;s++){i=t[s];const r=this.textMeasure.measureTextPixelADscentAndWidth(t[s],this.textOptions,h);e=r.width,n=Math.max(n,e),c.push({str:i,width:e,ascent:r.ascent,descent:r.descent,keepCenterInLine:d})}u[0]=n}u[1]=c.length*n,u[0]=c.reduce(((t,e)=>Math.max(t,e.width)),0);const p={xOffset:0,yOffset:0,width:u[0],height:u[1]};return this.LayoutBBox(p,e,i,c),this.layoutWithBBox(p,c,e,i,n)}layoutWithBBox(t,e,i,n,s){const r=[0,0],a=e.length*s;"top"===n||("middle"===n?r[1]=(t.height-a)/2:"bottom"===n&&(r[1]=t.height-a));for(let a=0;a<e.length;a++)this.lineOffset(t,e[a],i,n,s,r);return{bbox:t,lines:e,fontFamily:this.fontFamily,fontSize:this.textOptions.fontSize,fontWeight:this.textOptions.fontWeight,lineHeight:s,textAlign:i,textBaseline:n}}lineOffset(t,e,i,n,s,r){if("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=s/2+(e.ascent-e.descent)/2+r[1],!e.keepCenterInLine){const t=0,i=e.ascent+e.descent+t;if(i<s-t&&("bottom"===n?e.topOffset+=(s-i)/2:"top"===n&&(e.topOffset-=(s-i)/2)),"alphabetic"===n){const t=s/(e.ascent+e.descent);e.topOffset=s/2+(e.ascent-e.descent)/2*t+r[1]}}return r[1]+=s,e}}const Ro=["text","maxLineWidth","maxWidth","textAlign","textBaseline","heightLimit","lineClamp","fontSize","fontFamily","fontWeight","ellipsis","lineHeight","direction","wordBreak","heightLimit","lineClamp",...Pa];class Mo extends za{get font(){const t=this.getGraphicTheme();return this._font||(this._font=he(this.attribute,t)),this._font}get clipedText(){var t;const e=this.attribute,i=this.getGraphicTheme(),n=this.getMaxWidth(i);return Number.isFinite(n)?(this.tryUpdateAABBBounds(),this.cache.clipedText):(null!==(t=e.text)&&void 0!==t?t:i.text).toString()}get clipedWidth(){return this.tryUpdateAABBBounds(),this.cache.clipedWidth}get cliped(){var t,e;const i=this.getGraphicTheme(),n=this.attribute,s=this.getMaxWidth(i);if(!Number.isFinite(s))return!1;const{text:r}=this.attribute;if(this.tryUpdateAABBBounds(),null===(e=null===(t=this.cache)||void 0===t?void 0:t.layoutData)||void 0===e?void 0:e.lines){let t="";return this.cache.layoutData.lines.forEach((e=>{t+=e.str})),(Array.isArray(r)?r.join(""):r)!==t}return"vertical"===n.direction&&this.cache.verticalList&&this.cache.verticalList[0]?this.cache.verticalList[0].map((t=>t.text)).join("")!==n.text.toString():null!=this.clipedText&&this.clipedText!==n.text.toString()}get multilineLayout(){return this.tryUpdateAABBBounds(),this.cache.layoutData}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=Aa,this.cache={}}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{text:t}=this.attribute;return ht(t)?!t.every((t=>null==t||""===t)):null!=t&&""!==t}getGraphicTheme(){return ns(this).text}doUpdateOBBBounds(){const t=this.getGraphicTheme();this._OBBBounds.clear();const e=this.attribute,{angle:i=t.angle}=e;if(!i){const t=this.AABBBounds;return this._OBBBounds.setValue(t.x1,t.y1,t.x2,t.y2),this._OBBBounds}this.obbText||(this.obbText=new Mo({})),this.obbText.setAttributes(Object.assign(Object.assign({},e),{angle:0}));const n=this.obbText.AABBBounds,{x:s,y:r}=e,a={x:(n.x1+n.x2)/2,y:(n.y1+n.y2)/2},o=re(a,i,{x:s,y:r});return this._OBBBounds.copy(n),this._OBBBounds.translate(o.x-a.x,o.y-a.y),this._OBBBounds.angle=i,this._OBBBounds}updateAABBBounds(t,e,i){const{text:n=e.text}=this.attribute;Array.isArray(n)?this.updateMultilineAABBBounds(n):this.updateSingallineAABBBounds(n);const{tb1:s}=xn.graphicService.updateTempAABBBounds(i),{scaleX:r=e.scaleX,scaleY:a=e.scaleY,shadowBlur:o=e.shadowBlur,strokeBoundsBuffer:l=e.strokeBoundsBuffer}=t;if(o){ca(s,o/Math.abs(r+a),!0,l),i.union(s)}return xn.graphicService.combindShadowAABBBounds(i,this),null==t.forceBoundsHeight&&null==t.forceBoundsWidth||xn.graphicService.updateHTMLTextAABBBounds(t,e,i),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1,ce(i,i,this.transMatrix),i}updateSingallineAABBBounds(t){this.updateMultilineAABBBounds([t]);const e=this.cache.layoutData;if(e&&e.lines&&e.lines.length){const t=e.lines[0];this.cache.clipedText=t.str,this.cache.clipedWidth=t.width}return this._AABBBounds}updateMultilineAABBBounds(t){const e=this.getGraphicTheme(),{direction:i=e.direction,underlineOffset:n=e.underlineOffset}=this.attribute,s="horizontal"===i?this.updateHorizontalMultilineAABBBounds(t):this.updateVerticalMultilineAABBBounds(t);return"horizontal"===i&&n&&this._AABBBounds.add(this._AABBBounds.x1,this._AABBBounds.y2+n),s}guessLineHeightBuf(t){return t?.1*t:0}updateHorizontalMultilineAABBBounds(t){var e;const i=this.getGraphicTheme(),n=this.attribute,{fontFamily:s=i.fontFamily,textAlign:r=i.textAlign,textBaseline:a=i.textBaseline,fontSize:o=i.fontSize,fontWeight:l=i.fontWeight,ellipsis:h=i.ellipsis,maxLineWidth:d,stroke:c=i.stroke,wrap:u=i.wrap,measureMode:p=i.measureMode,lineWidth:g=i.lineWidth,whiteSpace:f=i.whiteSpace,suffixPosition:v=i.suffixPosition,ignoreBuf:m=i.ignoreBuf,keepCenterInLine:b=i.keepCenterInLine}=n,y=m?0:this.guessLineHeightBuf(o),x=this.getLineHeight(n,i,y);if("normal"===f||u)return this.updateWrapAABBBounds(t);if(!this.shouldUpdateShape()&&(null===(e=this.cache)||void 0===e?void 0:e.layoutData)){const t=this.cache.layoutData.bbox;return this._AABBBounds.set(t.xOffset,t.yOffset,t.xOffset+t.width,t.yOffset+t.height),c&&this._AABBBounds.expand(g/2),this._AABBBounds}const _=xn.graphicUtil.textMeasure,w=new Eo(s,{fontSize:o,fontWeight:l,fontFamily:s,lineHeight:x},_).GetLayoutByLines(t,r,a,x,!0===h?i.ellipsis:h||void 0,!1,{lineWidth:d,suffixPosition:v,measureMode:p,keepCenterInLine:b}),{bbox:T}=w;return this.cache.layoutData=w,this.clearUpdateShapeTag(),this._AABBBounds.set(T.xOffset,T.yOffset,T.xOffset+T.width,T.yOffset+T.height),c&&this._AABBBounds.expand(g/2),this._AABBBounds}updateWrapAABBBounds(t){var e,i,n;const s=this.getGraphicTheme(),{fontFamily:r=s.fontFamily,textAlign:a=s.textAlign,textBaseline:o=s.textBaseline,fontSize:l=s.fontSize,ellipsis:h=s.ellipsis,maxLineWidth:d,stroke:c=s.stroke,lineWidth:u=s.lineWidth,wordBreak:p=s.wordBreak,fontWeight:g=s.fontWeight,ignoreBuf:f=s.ignoreBuf,measureMode:v=s.measureMode,suffixPosition:m=s.suffixPosition,heightLimit:b=0,lineClamp:y,keepCenterInLine:x=s.keepCenterInLine}=this.attribute,_=f?0:this.guessLineHeightBuf(l),w=this.getLineHeight(this.attribute,s,_);if(!this.shouldUpdateShape()&&(null===(e=this.cache)||void 0===e?void 0:e.layoutData)){const t=this.cache.layoutData.bbox;return this._AABBBounds.set(t.xOffset,t.yOffset,t.xOffset+t.width,t.yOffset+t.height),c&&this._AABBBounds.expand(u/2),this._AABBBounds}const T=xn.graphicUtil.textMeasure,S={fontSize:l,fontWeight:g,fontFamily:r,lineHeight:w},k=new Eo(r,S,T),B=ht(t)?t.map((t=>t.toString())):[t.toString()],A=[],C=[0,0];let L=1/0;if(b>0&&(L=Math.max(Math.floor(b/w),1)),y&&(L=Math.min(L,y)),"number"==typeof d&&d!==1/0){if(d>0)for(let t=0;t<B.length;t++){const e=B[t];let s=!0;if(t===L-1){const i=T.clipTextWithSuffix(e,S,d,h,!1,m,t!==B.length-1),n=T.measureTextPixelADscentAndWidth(i.str,S,v);A.push({str:i.str,width:i.width,ascent:n.ascent,descent:n.descent,keepCenterInLine:x});break}const r=T.clipText(e,S,d,"break-all"!==p,"keep-all"===p);if(""!==e&&""===r.str||r.wordBreaked){if(h){const t=T.clipTextWithSuffix(e,S,d,h,!1,m);r.str=null!==(i=t.str)&&void 0!==i?i:"",r.width=null!==(n=t.width)&&void 0!==n?n:0}else r.str="",r.width=0;s=!1}const a=T.measureTextPixelADscentAndWidth(r.str,S,v);A.push({str:r.str,width:r.width,ascent:a.ascent,descent:a.descent,keepCenterInLine:x});let o=r.str.length;if(!r.wordBreaked||""!==e&&""===r.str||(s=!0,o=r.wordBreaked),r.str.length===e.length);else if(s){let i=e.substring(o);"keep-all"===p&&(i=i.replace(/^\s+/g,"")),B.splice(t+1,0,i)}}let t=0;A.forEach((e=>{t=Math.max(t,e.width)})),C[0]=t}else{let t,e,i=0;for(let n=0,s=B.length;n<s;n++){if(n===L-1){const t=T.clipTextWithSuffix(B[n],S,d,h,!1,m),e=T.measureTextPixelADscentAndWidth(t.str,S,v);A.push({str:t.str,width:t.width,ascent:e.ascent,descent:e.descent,keepCenterInLine:x}),i=Math.max(i,t.width);break}e=B[n],t=T.measureTextWidth(e,S),i=Math.max(i,t);const s=T.measureTextPixelADscentAndWidth(e,S,v);A.push({str:e,width:t,ascent:s.ascent,descent:s.descent,keepCenterInLine:x})}C[0]=i}C[1]=A.length*w;const O={xOffset:0,yOffset:0,width:C[0],height:C[1]};k.LayoutBBox(O,a,o,A);const E=k.layoutWithBBox(O,A,a,o,w);return this.cache.layoutData=E,this.clearUpdateShapeTag(),this._AABBBounds.set(O.xOffset,O.yOffset,O.xOffset+O.width,O.yOffset+O.height),c&&this._AABBBounds.expand(u/2),this._AABBBounds}updateVerticalMultilineAABBBounds(t){var e,i;const n=this.getGraphicTheme(),s=xn.graphicUtil.textMeasure;let r;const a=this.attribute,{maxLineWidth:o=n.maxLineWidth,ellipsis:l=n.ellipsis,fontFamily:h=n.fontFamily,fontSize:d=n.fontSize,fontWeight:c=n.fontWeight,stroke:u=n.stroke,lineWidth:p=n.lineWidth,verticalMode:g=n.verticalMode,suffixPosition:f=n.suffixPosition}=a,v=this.getLineHeight(a,n,0);let{textAlign:m=n.textAlign,textBaseline:b=n.textBaseline}=a;if(!g){const t=m;m=null!==(e=Mo.baselineMapAlign[b])&&void 0!==e?e:"left",b=null!==(i=Mo.alignMapBaseline[t])&&void 0!==i?i:"top"}if(r=0,!this.shouldUpdateShape()&&this.cache){this.cache.verticalList.forEach((t=>{const e=t.reduce(((t,e)=>t+e.width),0);r=Gt(e,r)}));const t=fo(m,r),e=this.cache.verticalList.length*v,i=vo(b,e,d);return this._AABBBounds.set(i,t,i+e,t+r),u&&this._AABBBounds.expand(p/2),this._AABBBounds}const y=t.map((t=>function(t){const e=[];let i=0,n="";for(let s=0;s<t.length;s++)ma(t[s])?i?n+=t[s]:(i=1,n=t[s]):(i&&(e.push({text:n,direction:ga.VERTICAL}),n="",i=0),e.push({text:t[s],direction:ga.HORIZONTAL}));return n&&e.push({text:n,direction:ga.VERTICAL}),e}(t.toString())));y.forEach(((t,e)=>{if(Number.isFinite(o))if(l){const i=!0===l?n.ellipsis:l,a=s.clipTextWithSuffixVertical(t,{fontSize:d,fontWeight:c,fontFamily:h},o,i,!1,f);y[e]=a.verticalList,r=a.width}else{const i=s.clipTextVertical(t,{fontSize:d,fontWeight:c,fontFamily:h},o,!1);y[e]=i.verticalList,r=i.width}else r=0,t.forEach((t=>{const e=t.direction===ga.HORIZONTAL?d:s.measureTextWidth(t.text,{fontSize:d,fontWeight:c,fontFamily:h});r+=e,t.width=e}))})),this.cache.verticalList=y,this.clearUpdateShapeTag(),this.cache.verticalList.forEach((t=>{const e=t.reduce(((t,e)=>t+e.width),0);r=Gt(e,r)}));const x=fo(m,r),_=this.cache.verticalList.length*v,w=vo(b,_,d);return this._AABBBounds.set(w,x,w+_,x+r),u&&this._AABBBounds.expand(p/2),this._AABBBounds}getMaxWidth(t){var e,i;const n=this.attribute;return null!==(i=null!==(e=n.maxLineWidth)&&void 0!==e?e:n.maxWidth)&&void 0!==i?i:t.maxWidth}getLineHeight(t,e,i){var n;return null!==(n=Fs(t.lineHeight,t.fontSize||e.fontSize))&&void 0!==n?n:(t.fontSize||e.fontSize)+i}needUpdateTags(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Ro;return super.needUpdateTags(t,e)}needUpdateTag(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Ro;return super.needUpdateTag(t,e)}_interpolate(t,e,i,n,s){"text"===t&&(s.text=n)}clone(){return new Mo(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return Mo.NOWORK_ANIMATE_ATTR}getBaselineMapAlign(){return Mo.baselineMapAlign}getAlignMapBaseline(){return Mo.alignMapBaseline}}function Po(t){return new Mo(t)}Mo.NOWORK_ANIMATE_ATTR=Object.assign({ellipsis:1,wordBreak:1,direction:1,textAlign:1,textBaseline:1,fontFamily:1,fontWeight:1},Ha),Mo.baselineMapAlign={top:"left",bottom:"right",middle:"center"},Mo.alignMapBaseline={left:"top",right:"bottom",center:"middle"};const Do=["symbolType","size",...Pa];let Io=class t extends za{constructor(){super(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{symbolType:"circle"}),this.type="symbol",this.numberType=Ba}getParsedPath(){return this.shouldUpdateShape()&&(this._parsedPath=this.doUpdateParsedPath(),this.clearUpdateShapeTag()),this._parsedPath}getParsedPath2D(){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]:1,n=null;try{n=new Path2D}catch(t){return null}const s=this.getParsedPath();if(!s)return null;s.draw(n,i,t,e)}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{size:t}=this.attribute;return ht(t)?2===t.length&&t.every(this._validNumber):this._validNumber(t)}doUpdateParsedPath(){const{symbolType:t="circle"}=this.attribute;return super.parsePath(t)}getGraphicTheme(){return ns(this).symbol}updateAABBBounds(t,e,i,n){this.updatePathProxyAABBBounds(i)||(n?this.updateSymbolAABBBoundsImprecise(t,e,i):this.updateSymbolAABBBoundsAccurate(t,e,i));const{tb1:s,tb2:r}=xn.graphicService.updateTempAABBBounds(i);((t,e,i)=>{const{outerBorder:n,shadowBlur:s=e.shadowBlur,strokeBoundsBuffer:r=e.strokeBoundsBuffer}=t;if(n){const t=e.outerBorder,{distance:a=t.distance,lineWidth:o=t.lineWidth}=n;ca(i,a+(s+o)/2,!0,r)}})(t,e,s),i.union(s),s.setValue(r.x1,r.y1,r.x2,r.y2),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1,this.x1WithoutTransform=i.x1,this.y1WithoutTransform=i.y1;const{lineJoin:a=e.lineJoin}=t;return xn.graphicService.transformAABBBounds(t,i,e,"miter"===a,this),i}updateSymbolAABBBoundsImprecise(t,e,i){const{size:n=e.size}=t;if(ht(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){const{size:n=e.size}=t;return this.getParsedPath().bounds(n,i),i}needUpdateTags(t){return super.needUpdateTags(t,Do)}needUpdateTag(t){return super.needUpdateTag(t,Do)}toCustomPath(){const t=this.getParsedPath(),e=this.attribute.size,i=ht(e)?e:[e,e];return t.path?(new Ki).fromCustomPath2D(t.path,0,0,i[0],i[1]):(new Ki).fromString(t.pathStr,0,0,i[0],i[1])}clone(){return new t(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return t.NOWORK_ANIMATE_ATTR}};function Fo(t){return new Io(t)}Io.NOWORK_ANIMATE_ATTR=Object.assign({symbolType:1},Ha);const No=["segments","points","curveType","curveTension",...Pa];class Ho extends za{constructor(){super(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}),this.type="line",this.numberType=Ta}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,n,s){"points"===t&&(s.points=Ds(i,n,e))}getGraphicTheme(){return ns(this).line}updateAABBBounds(t,e,i){this.updatePathProxyAABBBounds(i)||(t.segments?this.updateLineAABBBoundsBySegments(t,e,i):this.updateLineAABBBoundsByPoints(t,e,i)),xn.graphicService.updateTempAABBBounds(i),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1;const{lineJoin:n=e.lineJoin}=t;return xn.graphicService.transformAABBBounds(t,i,e,"miter"===n,this),i}updateLineAABBBoundsByPoints(t,e,i,n){const{points:s=e.points,connectedType:r}=t,a=i;return s.forEach((t=>{!1===t.defined&&"connect"!==r||a.add(t.x,t.y)})),a}updateLineAABBBoundsBySegments(t,e,i,n){const{segments:s=e.segments,connectedType:r}=t,a=i;return s.forEach((t=>{t.points.forEach((t=>{!1===t.defined&&"connect"!==r||a.add(t.x,t.y)}))})),a}needUpdateTags(t){return super.needUpdateTags(t,No)}needUpdateTag(t){return super.needUpdateTag(t,No)}toCustomPath(){const t=this.attribute,e=new Ki,i=t.segments,n=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=>{n(t.points)})):t.points&&n(t.points),e}clone(){return new Ho(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return Ho.NOWORK_ANIMATE_ATTR}}function zo(t){return new Ho(t)}Ho.NOWORK_ANIMATE_ATTR=Object.assign({segments:1,curveType:1},Ha);const Wo=["width","x1","y1","height","cornerRadius",...Pa];class Uo extends za{constructor(t){super(t),this.type="rect",this.numberType=ka}isValid(){return super.isValid()&&this._isValid()}_isValid(){return!0}getGraphicTheme(){return ns(this).rect}updateAABBBounds(t,e,i){if(!this.updatePathProxyAABBBounds(i)){let{width:e,height:n}=t;const{x1:s,y1:r,x:a,y:o}=t;e=null!=e?e:s-a,n=null!=n?n:r-o,(isFinite(e)||isFinite(n)||isFinite(a)||isFinite(o))&&i.set(0,0,e||0,n||0)}const{tb1:n,tb2:s}=xn.graphicService.updateTempAABBBounds(i);return Co(t,e,n),i.union(n),n.setValue(s.x1,s.y1,s.x2,s.y2),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1,xn.graphicService.transformAABBBounds(t,i,e,!1,this),i}needUpdateTags(t){return super.needUpdateTags(t,Wo)}needUpdateTag(t){return super.needUpdateTag(t,Wo)}toCustomPath(){const t=this.attribute,{x:e,y:i,width:n,height:s}=(t=>{if(!t)return{x:0,y:0,width:0,height:0};let e=it(t.width)?t.x1-t.x:t.width,i=it(t.height)?t.y1-t.y:t.height,n=0,s=0;return e<0?(n=e,e=-e):Number.isNaN(e)&&(e=0),i<0?(s=i,i=-i):Number.isNaN(i)&&(i=0),{x:n,y:s,width:e,height:i}})(t),r=new Ki;return r.moveTo(e,i),r.rect(e,i,n,s),r}clone(){return new Uo(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return Uo.NOWORK_ANIMATE_ATTR}}function jo(t){return new Uo(t)}Uo.NOWORK_ANIMATE_ATTR=Ha;const Go=["width","height","image",...Pa];class Yo extends za{constructor(t){super(t),this.type="image",this.numberType=wa,this.loadImage(this.attribute.image)}getImageElement(){const{image:t}=this.attribute;if(!t||!this.resources)return null;const e=this.resources.get(t);return"success"!==e.state?null:e.data}get width(){return this.tryUpdateAABBBounds(),this._actualWidth}get height(){return this.tryUpdateAABBBounds(),this._actualHeight}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()})),this.addUpdateBoundTag()}imageLoadFail(t,e){super.imageLoadFail(t,(()=>{this.failCallback&&this.failCallback()}))}setAttributes(t,e,i){return t.image&&this.loadImage(t.image),super.setAttributes(t,e,i)}setAttribute(t,e,i,n){return"image"===t&&this.loadImage(e),super.setAttribute(t,e,i,n)}getGraphicTheme(){return ns(this).image}updateAABBBounds(t,e,i){if(!this.updatePathProxyAABBBounds(i)){const{maxWidth:n=e.maxWidth,maxHeight:s=e.maxHeight}=t;let{width:r,height:a}=t;if(null==r||null==a){const t=this.getImageElement();if(t){const e=t.width,i=t.height;if(null!=r)a=r*(i/e);else if(null!=a)r=a*(e/i);else{const t=e/i;t>n/s?(r=n,a=n/t):(a=s,r=s*t)}}else r=n,a=s}this._actualWidth=r,this._actualHeight=a,i.set(0,0,r,a)}const{tb1:n,tb2:s}=xn.graphicService.updateTempAABBBounds(i);return Co(t,e,n),i.union(n),n.setValue(s.x1,s.y1,s.x2,s.y2),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1,xn.graphicService.transformAABBBounds(t,i,e,!1,this),i}getDefaultAttribute(t){return bn[t]}needUpdateTags(t){return super.needUpdateTags(t,Go)}needUpdateTag(t){return super.needUpdateTag(t,Go)}clone(){return new Yo(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return Yo.NOWORK_ANIMATE_ATTR}}Yo.NOWORK_ANIMATE_ATTR=Object.assign({image:1,repeatX:1,repeatY:1},Ha);const Vo=["points","cornerRadius",...Pa];class Xo extends za{constructor(t){super(t),this.type="polygon",this.numberType=Sa}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{points:t}=this.attribute;return t&&t.length>=2}getGraphicTheme(){return ns(this).polygon}updateAABBBounds(t,e,i){this.updatePathProxyAABBBounds(i)||this.updatePolygonAABBBoundsImprecise(t,e,i),xn.graphicService.updateTempAABBBounds(i),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1;const{lineJoin:n=e.lineJoin}=t;return xn.graphicService.transformAABBBounds(t,i,e,"miter"===n,this),i}updatePolygonAABBBoundsImprecise(t,e,i){const{points:n=e.points}=t;return n.forEach((t=>{i.add(t.x,t.y)})),i}_interpolate(t,e,i,n,s){"points"===t&&(s.points=Ds(i,n,e))}needUpdateTags(t){return super.needUpdateTags(t,Vo)}needUpdateTag(t){return super.needUpdateTag(t,Vo)}toCustomPath(){const t=this.attribute.points,e=new Ki;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 Xo(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return Xo.NOWORK_ANIMATE_ATTR}}Xo.NOWORK_ANIMATE_ATTR=Ha;const Ko=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 $o;var qo=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Zo=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Jo=function(t,e){return function(i,n){e(i,n,t)}};class Qo{constructor(){this.time=ni.beforeFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,n,s,r,a,o,l,h,d,c,u){var p;const{background:g,backgroundOpacity:f=(null!==(p=t.attribute.fillOpacity)&&void 0!==p?p:l.backgroundOpacity),opacity:v=l.opacity,backgroundMode:m=l.backgroundMode,backgroundFit:b=l.backgroundFit,backgroundKeepAspectRatio:y=l.backgroundKeepAspectRatio,backgroundScale:x=l.backgroundScale,backgroundOffsetX:_=l.backgroundOffsetX,backgroundOffsetY:w=l.backgroundOffsetY,backgroundClip:T=l.backgroundClip}=t.attribute;if(g)if(t.backgroundImg&&t.resources){const s=t.resources.get(g);if("success"!==s.state||!s.data)return;if(e.save(),t.parent&&!t.transMatrix.onlyTranslate()){const i=ns(t.parent).group,{scrollX:n=i.scrollX,scrollY:s=i.scrollY}=t.parent.attribute;e.setTransformFromMatrix(t.parent.globalTransMatrix,!0),e.translate(n,s)}T&&e.clip();const r=t.AABBBounds;e.setCommonStyle(t,t.attribute,i,n,l),e.globalAlpha=f*v,this.doDrawImage(e,s.data,r,{backgroundMode:m,backgroundFit:b,backgroundKeepAspectRatio:y,backgroundScale:x,backgroundOffsetX:_,backgroundOffsetY:w}),e.restore(),t.transMatrix.onlyTranslate()||e.setTransformForCurrent()}else e.highPerformanceSave(),e.setCommonStyle(t,t.attribute,i,n,l),e.globalAlpha=f*v,e.fillStyle=g,e.fill(),e.highPerformanceRestore()}doDrawImage(t,e,i,n){const{backgroundMode:s,backgroundFit:r,backgroundKeepAspectRatio:a,backgroundScale:o=1,backgroundOffsetX:l=0,backgroundOffsetY:h=0}=n,d=i.width(),c=i.height();let u=d,p=c;if("no-repeat"===s)if(r)if(a){const n=Math.max(d/e.width,c/e.height);t.drawImage(e,i.x1+l,i.y1+h,e.width*n*o,e.height*n*o)}else t.drawImage(e,i.x1,i.y1,i.width(),i.height());else{const n=e.width*o,s=e.height*o;t.drawImage(e,i.x1+l,i.y1+h,n,s)}else{if(r&&"repeat"!==s&&(e.width||e.height)){const i=e.width,n=e.height;"repeat-x"===s?(u=i*(c/n),p=c):"repeat-y"===s&&(p=n*(d/i),u=d);const r=t.dpr,a=Nn.allocate({width:u,height:p,dpr:r}),o=a.getContext("2d");o&&(o.inuse=!0,o.clearMatrix(),o.setTransformForCurrent(!0),o.clearRect(0,0,u,p),o.drawImage(e,0,0,u,p),e=a.nativeCanvas),Nn.free(a)}const n=t.dpr,a=t.createPattern(e,s);a.setTransform&&a.setTransform(new DOMMatrix([1/n,0,0,1/n,0,0])),t.fillStyle=a,t.translate(i.x1,i.y1),t.fillRect(0,0,d,c),t.translate(-i.x1,-i.y1)}}}const tl=new Qo;let el=class{constructor(t){this.subRenderContribitions=t,this.time=ni.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,n,s,r,a,o,l,h,d,c,u){this._subRenderContribitions||(this._subRenderContribitions=this.subRenderContribitions.getContributions()),this._subRenderContribitions.forEach((p=>{p.render(t,e,i,n,s,r,a,o,l,h,d,c,u)}))}};el=qo([y(),Jo(0,m(D)),Jo(0,x(go)),Zo("design:paramtypes",[Object])],el);const il=new class{constructor(){this.time=ni.beforeFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,n,s,r,a,o,l,h,d,c,u){var p,g;const{clipConfig:f}=t.attribute;if(!f)return;const v=t.getClipPath();if(!v)return;const m=!(d||c),b=t.AABBBounds,y=null!==(p=t.attribute.width)&&void 0!==p?p:b.width(),x=null!==(g=t.attribute.height)&&void 0!==g?g:b.height();m&&e.save(),e.beginPath(),!1===v.draw(e,[y,x],i+y/2,n+x/2,0)&&e.closePath(),d&&d(e,t.attribute,l,!0),m&&e.clip()}};const nl=new class{constructor(){this.time=ni.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,n,s,r,a,o,l,h,d,c,u){const{clipConfig:p}=t.attribute;p&&t.getClipPath()&&(d||c||e.restore())}};class sl{constructor(){this.time=ni.afterFillStroke,this.useStyle=!0,this.order=10,this._tempSymbolGraphic=null}createCommonPattern(t,e,i,n,s){const r=(t-2*e)/2,a=n.dpr,o=Nn.allocate({width:t,height:t,dpr:a}),l=o.getContext("2d");if(!l)return null;l.inuse=!0,l.clearMatrix(),l.setTransformForCurrent(!0),l.clearRect(0,0,t,t),s(r,l);const h=n.createPattern(o.nativeCanvas,"repeat");return h.setTransform&&h.setTransform(new DOMMatrix([1/a,0,0,1/a,0,0])),Nn.free(o),h}createCirclePattern(t,e,i,n){return this.createCommonPattern(t,e,i,n,((t,e)=>{e.fillStyle=i,e.arc(t,t,t,0,zt),e.fill()}))}createDiamondPattern(t,e,i,n){return this.createCommonPattern(t,e,i,n,((e,n)=>{const s=t/2,r=s;n.fillStyle=i,n.moveTo(s,r-e),n.lineTo(e+s,r),n.lineTo(s,r+e),n.lineTo(s-e,r),n.closePath(),n.fill()}))}createRectPattern(t,e,i,n){return this.createCommonPattern(t,e,i,n,((t,n)=>{const s=e,r=s;n.fillStyle=i,n.fillRect(s,r,2*t,2*t)}))}createVerticalLinePattern(t,e,i,n){return this.createCommonPattern(t,e,i,n,((n,s)=>{const r=e;s.fillStyle=i,s.fillRect(r,0,2*n,t)}))}createHorizontalLinePattern(t,e,i,n){return this.createCommonPattern(t,e,i,n,((n,s)=>{const r=e;s.fillStyle=i,s.fillRect(0,r,t,2*n)}))}createBiasLRLinePattern(t,e,i,n){return this.createCommonPattern(t,e,i,n,((e,n)=>{n.strokeStyle=i,n.lineWidth=e,n.moveTo(0,0),n.lineTo(t,t);const s=t/2,r=-s;n.moveTo(s,r),n.lineTo(s+t,r+t),n.moveTo(-s,-r),n.lineTo(-s+t,-r+t),n.stroke()}))}createBiasRLLinePattern(t,e,i,n){return this.createCommonPattern(t,e,i,n,((e,n)=>{n.strokeStyle=i,n.lineWidth=e,n.moveTo(t,0),n.lineTo(0,t);const s=t/2,r=s;n.moveTo(t+s,r),n.lineTo(s,r+t),n.moveTo(t-s,-r),n.lineTo(-s,-r+t),n.stroke()}))}createGridPattern(t,e,i,n){return this.createCommonPattern(t,e,i,n,((t,n)=>{const s=e,r=s;n.fillStyle=i,n.fillRect(s,r,t,t),n.fillRect(s+t,r+t,t,t)}))}initTextureMap(t,e){this.textureMap=new Map}drawShape(t,e,i,n,s,r,a,o,l,h,d,c,u){this.textureMap||this.initTextureMap(e,t.stage);const{texture:p=l.texture,textureColor:g=l.textureColor,textureSize:f=l.textureSize,texturePadding:v=l.texturePadding}=t.attribute;p&&this.drawTexture(p,t,e,i,n,l,g,f,v)}drawTexture(t,e,i,n,s,r,a,o,l){var h;const{textureRatio:d=r.textureRatio,textureOptions:c=null}=e.attribute;let u=this.textureMap.get(t);if(!u)switch(t){case"circle":u=this.createCirclePattern(o,l,a,i);break;case"diamond":u=this.createDiamondPattern(o,l,a,i);break;case"rect":u=this.createRectPattern(o,l,a,i);break;case"vertical-line":u=this.createVerticalLinePattern(o,l,a,i);break;case"horizontal-line":u=this.createHorizontalLinePattern(o,l,a,i);break;case"bias-lr":u=this.createBiasLRLinePattern(o,l,a,i);break;case"bias-rl":u=this.createBiasRLLinePattern(o,l,a,i);break;case"grid":u=this.createGridPattern(o,l,a,i)}if(c&&c.dynamicTexture){const{gridConfig:u={},useNewCanvas:p}=c,g=e.AABBBounds;n=g.x1,s=g.y1;const f=i;let v;if(p){v=Nn.allocate({width:g.width(),height:g.height(),dpr:i.dpr});const t=v.getContext("2d");t.clearRect(0,0,g.width(),g.height()),n=0,s=0,i=t}if(f.save(),e.parent&&!e.transMatrix.onlyTranslate()){const{scrollX:t=0,scrollY:i=0}=e.parent.attribute;f.setTransformFromMatrix(e.parent.globalTransMatrix),f.translate(t,i,!0)}f.setCommonStyle(e,e.attribute,n,s,r),f.clip();const m=g.width(),b=g.height(),y=l,x=o,_=u.columns?u.columns:Math.ceil(m/x),w=u.rows?u.rows:Math.ceil(b/x),T=u.gutterColumn?u.gutterColumn:2*y,S=u.gutterRow?u.gutterRow:2*y;this._tempSymbolGraphic||(this._tempSymbolGraphic=Fo({}));const k=u.columns?m/u.columns:x,B=u.rows?b/u.rows:x;this._tempSymbolGraphic.setAttributes({size:[k-T,B-S],symbolType:t});const A=this._tempSymbolGraphic.getParsedPath();for(let t=0;t<w;t++)for(let r=0;r<_;r++){const o=n+x/2+r*x,l=s+x/2+t*x;null===(h=c.beforeDynamicTexture)||void 0===h||h.call(c,i,t,r,w,_,d,e,g.width(),g.height()),i.beginPath(),!1===A.draw(i,Math.min(k-T,B-S),o,l,0)&&i.closePath(),i.fillStyle=a,c.dynamicTexture(i,t,r,w,_,d,e,g.width(),g.height())}p&&(f.globalAlpha=1,f.drawImage(v.nativeCanvas,0,0,v.nativeCanvas.width,v.nativeCanvas.height,g.x1,g.y1,g.width()*f.dpr,g.height()*f.dpr)),f.restore()}else if(u)i.highPerformanceSave(),i.setCommonStyle(e,e.attribute,n,s,r),i.fillStyle=u,i.fill(),i.highPerformanceRestore();else if("wave"===t){i.save(),i.setCommonStyle(e,e.attribute,n,s,r),i.clip();const t=e.AABBBounds;(function(t,e,i,n,s,r,a){const{fill:o="orange",percent:l=.6,frequency:h=4,opacity:d,phi:c=0}=s;let{amplitude:u=10}=s;u*=function(t){return t<=.5?4*t-1:-4*t+3}(e);const p=n*(1-l),g=i,f=Math.max(Math.round(g/70),2);t.beginPath(),t.moveTo(0+r,n+a),t.lineTo(0+r,p+a);const v=g/h*e,m=g/Math.PI/(2*h);for(let e=0;e<g;e+=f){const i=u*Math.sin((e+v+c)/m+c);t.lineTo(e+r,p+i+a)}t.lineTo(g+r,n+a),t.closePath(),t.fillStyle=o,isFinite(d)&&(t.globalAlpha=d),t.fill()})(i,d,t.width(),t.height(),Object.assign(Object.assign({},c||{}),{fill:a}),n+t.x1-n,s+t.y1-s),i.restore()}}}const rl=new sl;const al=new class extends Qo{constructor(){super(...arguments),this.time=ni.beforeFillStroke}drawShape(t,e,i,n,s,r,a,o,l,h,d,c){const{background:u,backgroundMode:p=l.backgroundMode,backgroundFit:g=l.backgroundFit,backgroundKeepAspectRatio:f=l.backgroundKeepAspectRatio,backgroundScale:v=l.backgroundScale,backgroundOffsetX:m=l.backgroundOffsetX,backgroundOffsetY:b=l.backgroundOffsetY}=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 n=t.AABBBounds;this.doDrawImage(e,i.data,n,{backgroundMode:p,backgroundFit:g,backgroundKeepAspectRatio:f,backgroundScale:v,backgroundOffsetX:m,backgroundOffsetY:b}),e.highPerformanceRestore(),e.setTransformForCurrent()}else e.highPerformanceSave(),e.fillStyle=u,e.fill(),e.highPerformanceRestore()}},ol=Ft/2;function ll(t,e,i,n,s,r){let a,o=!(arguments.length>6&&void 0!==arguments[6])||arguments[6],l=arguments.length>7?arguments[7]:void 0;if(Array.isArray(o)&&(l=o,o=!0),n<0&&(e+=n,n=-n),s<0&&(i+=s,s=-s),ct(r,!0))a=[r=Wt(r),r,r,r];else if(Array.isArray(r)){const t=r;let e,i;switch(t.length){case 0:a=[0,0,0,0];break;case 1:e=Wt(t[0]),a=[e,e,e,e];break;case 2:case 3:e=Wt(t[0]),i=Wt(t[1]),a=[e,i,e,i];break;default:a=t,a[0]=Wt(a[0]),a[1]=Wt(a[1]),a[2]=Wt(a[2]),a[3]=Wt(a[3])}}else a=[0,0,0,0];if(n<0||a[0]+a[1]+a[2]+a[3]<1e-12)return t.rect(e,i,n,s);const[h,d,c,u]=[[e,i],[e+n,i],[e+n,i+s],[e,i+s]],p=Math.min(n/2,s/2),g=[Math.min(p,a[0]),Math.min(p,a[1]),Math.min(p,a[2]),Math.min(p,a[3])],f=[h[0]+g[0],h[1]],v=[h[0],h[1]+g[0]],m=[d[0]-g[1],d[1]],b=[d[0],d[1]+g[1]],y=[c[0]-g[2],c[1]],x=[c[0],c[1]-g[2]],_=[u[0]+g[3],u[1]],w=[u[0],u[1]-g[3]];if(t.moveTo(f[0],f[1]),o){if(l&&l[0]?l[0](f[0],f[1],m[0],m[1]):t.lineTo(m[0],m[1]),!Bt(m,b)){l&&l[0]&&t.moveTo(m[0],m[1]);const e=m[0],i=m[1]+g[1];t.arc(e,i,g[1],-ol,0,!1)}if(l&&l[1]?l[1](b[0],b[1],x[0],x[1]):t.lineTo(x[0],x[1]),!Bt(y,x)){const e=x[0]-g[2],i=x[1];l&&l[1]&&t.moveTo(x[0],x[1]),t.arc(e,i,g[2],0,ol,!1)}if(l&&l[2]?l[2](y[0],y[1],_[0],_[1]):t.lineTo(_[0],_[1]),!Bt(_,w)){const e=_[0],i=_[1]-g[3];l&&l[2]&&t.moveTo(_[0],_[1]),t.arc(e,i,g[3],ol,Ft,!1)}if(l&&l[3]?l[3](w[0],w[1],v[0],v[1]):t.lineTo(v[0],v[1]),!Bt(f,v)){const e=f[0],i=f[1]+g[0];l&&l[3]&&t.moveTo(v[0],v[1]),t.arc(e,i,g[0],Ft,Ft+ol,!1)}}else l&&l[0]?l[0](f[0],f[1],m[0],m[1]):t.lineTo(m[0],m[1]),l&&l[1]?l[1](m[0],m[1],y[0],y[1]):t.lineTo(y[0],y[1]),l&&l[2]?l[2](y[0],y[1],_[0],_[1]):t.lineTo(_[0],_[1]),l&&l[2]?l[2](_[0],_[1],f[0],f[1]):t.lineTo(f[0],f[1]);return!l&&t.closePath(),t}var hl=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let dl=class{constructor(){this.time=ni.beforeFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,n,s,r,a,o,l,h,d,c,u){const{stroke:p=l.stroke}=t.attribute;Array.isArray(p)&&p.some((t=>!1===t))&&(u.doStroke=!1)}};dl=hl([y()],dl);let cl=class{constructor(){this.time=ni.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,n,s,r,a,o,l,h,d,c){const{x1:u,y1:p,x:g=l.x,y:f=l.y,stroke:v=l.stroke,cornerRadius:m=l.cornerRadius,cornerType:b=l.cornerType}=t.attribute;let{width:y,height:x}=t.attribute;if(y=(null!=y?y:u-g)||0,x=(null!=x?x:p-f)||0,Array.isArray(v)&&v.some((t=>!1===t))){if(e.setStrokeStyle(t,t.attribute,i,n,l),!(0===m||ht(m)&&m.every((t=>0===t)))){let s,r=0;return ll(e,i,n,y,x,m,"bevel"!==b,new Array(4).fill(0).map(((a,o)=>(a,h,d,c)=>{v[o]&&(r===o-1&&v[o]===s||(e.setStrokeStyle(t,Object.assign(Object.assign({},t.attribute),{stroke:v[o]}),i,n,l),e.beginPath(),e.moveTo(a,h),s=v[o]),r=o,e.lineTo(d,c),e.stroke(),3===o&&e.beginPath())}))),void e.stroke()}if(e.beginPath(),e.moveTo(i,n),v[0]?e.lineTo(i+y,n):e.moveTo(i+y,n),v[1]?e.lineTo(i+y,n+x):e.moveTo(i+y,n+x),v[2]?e.lineTo(i,n+x):e.moveTo(i,n+x),v[3]){const t=v[0]?n-e.lineWidth/2:n;e.lineTo(i,t)}else e.moveTo(i,n);e.stroke()}}};cl=hl([y()],cl);const ul=new class{constructor(){this.time=ni.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,n,s,r,a,o,l,h,d,c){const{outerBorder:u,innerBorder:p}=t.attribute,g=u&&!1!==u.visible,f=p&&!1!==p.visible;if(!g&&!f)return;const{cornerRadius:v=l.cornerRadius,cornerType:m=l.cornerType,opacity:b=l.opacity,x:y=l.x,y:x=l.y,scaleX:_=l.scaleX,scaleY:w=l.scaleY,x1:T,y1:S,keepStrokeScale:k=l.keepStrokeScale}=t.attribute;let{width:B,height:A}=t.attribute;B=(null!=B?B:T-i)||0,A=(null!=A?A:S-n)||0;const C=(s,r)=>{const a=!(!s||!s.stroke),o="outerBorder"===r?-1:1,{distance:h=l[r].distance}=s,d=k?h:Tn(e,h,e.dpr),u=i+o*d,p=n+o*d,g=2*d;if(0===v||ht(v)&&v.every((t=>0===t))?(e.beginPath(),e.rect(u,p,B-o*g,A-o*g)):(e.beginPath(),ll(e,u,p,B-o*g,A-o*g,v,"bevel"!==m)),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),c)c(e,s,l[r]);else if(a){const a=l[r].opacity;l[r].opacity=b,e.setStrokeStyle(t,s,(y-i)/_,(x-n)/w,l[r]),l[r].opacity=a,e.stroke()}};g&&C(u,"outerBorder"),f&&C(p,"innerBorder")}},pl=rl,gl=tl;const fl=new class{constructor(){this.time=ni.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,n,s,r,a,o,l,h,d,c){const u=t.getParsedPath();if(!u)return;const{outerBorder:p,innerBorder:g}=t.attribute,f=p&&!1!==p.visible,v=g&&!1!==g.visible;if(!f&&!v)return;const{size:m=l.size,opacity:b=l.opacity,x:y=l.x,y:x=l.y,scaleX:_=l.scaleX,scaleY:w=l.scaleY,keepStrokeScale:T=l.keepStrokeScale}=t.attribute,S=(s,r)=>{const a=!(!s||!s.stroke),{distance:o=l[r].distance}=s,h=T?o:Tn(e,o,e.dpr),d="outerBorder"===r?1:-1;if(e.beginPath(),!1===u.drawOffset(e,m,i,n,d*h)&&e.closePath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),c)c(e,s,l[r]);else if(a){const a=l[r].opacity;l[r].opacity=b,e.setStrokeStyle(t,s,(y-i)/_,(x-n)/w,l[r]),l[r].opacity=a,e.stroke()}};f&&S(p,"outerBorder"),v&&S(g,"innerBorder")}},vl=new class{constructor(){this.time=ni.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,n,s,r,a,o,l,h,d,c,u){const{clipRange:p=l.clipRange,x:g=l.x,y:f=l.y,z:v=l.z,size:m=l.size,scaleX:b=l.scaleX,scaleY:y=l.scaleY}=t.attribute,x=t.getParsedPath();x&&p<1&&p>0&&(e.beginPath(),x.drawWithClipRange&&x.drawWithClipRange(e,m,i,n,p,v,((s,r)=>{var a,h,d,u;if(t._parsedPath.svgCache){const e=Object.assign({},r);e.fill=null!==(a=r.fill)&&void 0!==a?a:t.attribute.fill,e.opacity=null!==(h=r.opacity)&&void 0!==h?h:t.attribute.opacity,e.fillOpacity=t.attribute.fillOpacity,e.stroke=null!==(d=r.stroke)&&void 0!==d?d:t.attribute.stroke,e.lineWidth=null!==(u=r.lineWidth)&&void 0!==u?u:t.attribute.lineWidth,r=e}r.stroke&&(c?c(e,t.attribute,l):o&&(e.setStrokeStyle(t,r,(g-i)/b,(f-n)/y,l),e.stroke()))})),r&&!x.isSvg&&(c?c(e,t.attribute,l):o&&(e.setStrokeStyle(t,t.attribute,(g-i)/b,(f-n)/y,l),e.stroke())))}},ml=rl,bl=tl;const yl={x:0,y:0,z:0,lastModelMatrix:null};class xl{init(t){t&&(this._renderContribitions=t.getContributions()),this._renderContribitions||(this._renderContribitions=[]),this.builtinContributions||(this.builtinContributions=[]),this.builtinContributions.push(il),this.builtinContributions.push(nl),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===ni.beforeFillStroke)),this._afterRenderContribitions=this._renderContribitions.filter((t=>t.time===ni.afterFillStroke)))}reInit(){this.init(this.graphicRenderContributions)}beforeRenderStep(t,e,i,n,s,r,a,o,l,h,d,c,u){this._beforeRenderContribitions&&this._beforeRenderContribitions.forEach((p=>{p.supportedAppName&&t.stage&&t.stage.params&&t.stage.params.context&&t.stage.params.context.appName&&!(Array.isArray(p.supportedAppName)?p.supportedAppName:[p.supportedAppName]).includes(t.stage.params.context.appName)||p.drawShape(t,e,i,n,s,r,a,o,l,h,d,c,u)}))}afterRenderStep(t,e,i,n,s,r,a,o,l,h,d,c,u){this._afterRenderContribitions&&this._afterRenderContribitions.forEach((p=>{p.supportedAppName&&t.stage&&t.stage.params&&t.stage.params.context&&t.stage.params.context.appName&&!(Array.isArray(p.supportedAppName)?p.supportedAppName:[p.supportedAppName]).includes(t.stage.params.context.appName)||p.drawShape(t,e,i,n,s,r,a,o,l,h,d,c,u)}))}drawPathProxy(t,e,i,n,s,r,a,o){if(!t.pathProxy)return!1;const l=ns(t,null==r?void 0:r.theme)[t.type.replace("3d","")],{fill:h=l.fill,stroke:d=l.stroke,opacity:c=l.opacity,fillOpacity:u=l.fillOpacity,lineWidth:p=l.lineWidth,strokeOpacity:g=l.strokeOpacity,visible:f=l.visible,x:v=l.x,y:m=l.y}=t.attribute,b=so(c,u,h),y=ao(c,g),x=io(h),_=no(d,p);if(!f)return!0;if(!x&&!_)return!0;if(!(b||y||a||o))return!0;e.beginPath();return oi(("function"==typeof t.pathProxy?t.pathProxy(t.attribute):t.pathProxy).commandList,e,i,n),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,i,n,x,_,b,y,l,s,a,o),_&&(o?o(e,t.attribute,l):y&&(e.setStrokeStyle(t,t.attribute,i-v,n-m,l),e.stroke())),x&&(a?a(e,t.attribute,l):b&&(e.setCommonStyle(t,t.attribute,i-v,n-m,l),e.fill())),this.afterRenderStep(t,e,i,n,x,_,b,y,l,s,a,o),!0}valid(t,e,i,n){const{fill:s=e.fill,background:r,stroke:a=e.stroke,opacity:o=e.opacity,fillOpacity:l=e.fillOpacity,lineWidth:h=e.lineWidth,strokeOpacity:d=e.strokeOpacity,visible:c=e.visible}=t.attribute,u=so(o,l,s),p=ao(o,d),g=io(s,r),f=no(a,h);return!(!t.valid||!c)&&!(!g&&!f)&&!!(u||p||i||n||r)&&{fVisible:u,sVisible:p,doFill:g,doStroke:f}}transform(t,e,i){let n=arguments.length>3&&void 0!==arguments[3]&&arguments[3];const{x:s=e.x,y:r=e.y,z:a=e.z,scaleX:o=e.scaleX,scaleY:l=e.scaleY,angle:h=e.angle,postMatrix:d}=t.attribute,c=i.modelMatrix,u=i.camera;yl.x=s,yl.y=r,yl.z=a,yl.lastModelMatrix=c;const p=u&&(n||function(t){const{alpha:e,beta:i}=t.attribute;return e||i}(t)),g=p?t.transMatrix.onlyTranslate()&&!d:1===o&&1===l&&0===h&&!d;if(p){const n=wo.allocate(),s=wo.allocate();Bo(s,t,e),yo(n,c||n,s),yl.x=0,yl.y=0,yl.z=0,i.modelMatrix=n,i.setTransform(1,0,0,1,0,0,!0),wo.free(s)}if(g&&!c){const n=t.getOffsetXY(e);yl.x+=n.x,yl.y+=n.y,yl.z=a,i.setTransformForCurrent()}else if(p)yl.x=0,yl.y=0,yl.z=0,i.setTransform(1,0,0,1,0,0,!0);else if(u&&i.project){const n=t.getOffsetXY(e);yl.x+=n.x,yl.y+=n.y,this.transformWithoutTranslate(i,yl.x,yl.y,yl.z,o,l,h)}else i.transformFromMatrix(t.transMatrix,!0),yl.x=0,yl.y=0,yl.z=0;return yl}transformUseContext2d(t,e,i,n){const s=n.camera;if(this.camera=s,s){const e=t.AABBBounds,s=e.x2-e.x1,r=e.y2-e.y1,a=n.project(0,0,i),o=n.project(s,0,i),l=n.project(s,r,i),h={x:0,y:0},d={x:s,y:0},c={x:s,y:r};n.camera=null;const u=1/(h.x*(c.y-d.y)-d.x*c.y+c.x*d.y+(d.x-c.x)*h.y),p=-(h.y*(l.x-o.x)-d.y*l.x+c.y*o.x+(d.y-c.y)*a.x)*u,g=(d.y*l.y+h.y*(o.y-l.y)-c.y*o.y+(c.y-d.y)*a.y)*u,f=(h.x*(l.x-o.x)-d.x*l.x+c.x*o.x+(d.x-c.x)*a.x)*u,v=-(d.x*l.y+h.x*(o.y-l.y)-c.x*o.y+(c.x-d.x)*a.y)*u,m=(h.x*(c.y*o.x-d.y*l.x)+h.y*(d.x*l.x-c.x*o.x)+(c.x*d.y-d.x*c.y)*a.x)*u,b=(h.x*(c.y*o.y-d.y*l.y)+h.y*(d.x*l.y-c.x*o.y)+(c.x*d.y-d.x*c.y)*a.y)*u;n.setTransform(p,g,f,v,m,b,!0)}}restoreTransformUseContext2d(t,e,i,n){this.camera&&(n.camera=this.camera)}transformWithoutTranslate(t,e,i,n,s,r,a){const o=t.project(e,i,n);t.translate(o.x,o.y,!1),t.scale(s,r,!1),t.rotate(a,!1),t.translate(-o.x,-o.y,!1),t.setTransformForCurrent()}_draw(t,e,i,n,s){const{context:r}=n;if(!r)return;const{renderable:a}=t.attribute;if(!1===a)return;r.highPerformanceSave();const o=this.transform(t,e,r,i),{x:l,y:h,z:d,lastModelMatrix:c}=o;this.z=d,this.drawPathProxy(t,r,l,h,n,s)||(this.drawShape(t,r,l,h,n,s),this.z=0,r.modelMatrix!==c&&wo.free(r.modelMatrix),r.modelMatrix=c),r.highPerformanceRestore()}}function _l(t,e,i,n){if(!e.p1)return;const{offsetX:s=0,offsetY:r=0,offsetZ:a=0}=n||{};if(1===i)e.p2&&e.p3?t.bezierCurveTo(s+e.p1.x,r+e.p1.y,s+e.p2.x,r+e.p2.y,s+e.p3.x,r+e.p3.y,a):t.lineTo(s+e.p1.x,r+e.p1.y,a);else if(e.p2&&e.p3){const[n]=fi(e,i);t.bezierCurveTo(s+n.p1.x,r+n.p1.y,s+n.p2.x,r+n.p2.y,s+n.p3.x,r+n.p3.y,a)}else{const n=e.getPointAt(i);t.lineTo(s+n.x,r+n.y,a)}}function wl(t,e,i,n,s,r,a){var o;let l=e.p0,h=n;if(i&&i.originP1===i.originP2&&(l=i.p0),e.defined)n||(t.lineTo(l.x+s,l.y+r,a),h=!n);else{const{originP1:d,originP2:c}=e;let u;if(d&&!1!==d.defined&&!i?u=l:d&&!1!==c.defined&&(u=null!==(o=e.p3)&&void 0!==o?o:e.p1),n){h=!n;const i=u?u.x:e.p0.x,o=u?u.y:e.p0.y;t.moveTo(i+s,o+r,a)}else u&&(h=!n,t.lineTo(u.x+s,u.y+r,a))}return h}function Tl(t,e,i,n,s){const{offsetX:r=0,offsetY:a=0,offsetZ:o=0,mode:l="none",drawConnect:h=!1}=s||{};if(h&&"none"===l)return;if(!e)return;let d=!0;const{curves:c}=e;if(i>=1){if(h){let e,i=!0;c.forEach(((n,s)=>{n.originP1!==n.originP2?(i=wl(t,n,e,i,r,a,o),e=n):e=n}))}else c.forEach((e=>{e.defined?(d&&t.moveTo(e.p0.x+r,e.p0.y+a,o),_l(t,e,1,s),d=!1):d=!0}));return}if(i<=0)return;let u;"x"===n?u=ei.ROW:"y"===n?u=ei.COLUMN:"auto"===n&&(u=e.direction);const p=i*e.tryUpdateLength(u);let g=0,f=!0,v=null;for(let e=0,i=c.length;e<i;e++){const i=c[e],n=i.getLength(u),l=(p-g)/n;if(g+=n,l<0)break;if(h){if(i.originP1===i.originP2){v=i;continue}f=wl(t,i,v,f,r,a,o),v=i}else{if(!i.defined){d=!0;continue}d&&t.moveTo(i.p0.x+r,i.p0.y+a,o),_l(t,i,Yt(l,1),s),d=!1}}}var Sl=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let kl=class extends xl{constructor(){super(...arguments),this.numberType=Ta}draw(t,e,i,n){const s=ns(t,null==n?void 0:n.theme).line;this._draw(t,s,!1,i,n)}drawSegmentItem(t,e,i,n,s,r,a,o,l,h,d,c,u,p,g){var f;if(!e)return;t.beginPath();const v=null!==(f=this.z)&&void 0!==f?f:0;Tl(t.camera?t:t.nativeContext,e,l,h,{offsetX:d,offsetY:c,offsetZ:v}),u.cache&&!ht(u.cache)&&u.cache.curves.every((t=>t.defined))&&u.attribute.curveType&&u.attribute.curveType.includes("Closed")&&t.closePath(),t.setShadowBlendStyle&&t.setShadowBlendStyle(u,a,o);const{x:m=0,x:b=0}=a;return!1!==i&&(p?p(t,a,o):s&&(t.setCommonStyle(u,a,m-d,b-c,o),t.fill())),!1!==n&&(g?g(t,a,o):r&&(t.setStrokeStyle(u,a,m-d,b-c,o),t.stroke())),!1}drawLinearLineHighPerformance(t,e,i,n,s,r,a,o,l,h,d,c,u){var p;e.beginPath();const g=null!==(p=this.z)&&void 0!==p?p:0,{points:f}=t.attribute,v=f[0];e.moveTo(v.x+a,v.y+o,g);for(let t=1;t<f.length;t++){const i=f[t];e.lineTo(i.x+a,i.y+o,g)}e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l);const{x:m=0,x:b=0}=t.attribute;!1!==i&&(c?c(e,t.attribute,l):s&&(e.setCommonStyle(t,t.attribute,m-a,b-o,l),e.fill())),!1!==n&&(u?u(e,t.attribute,l):r&&(e.setStrokeStyle(t,t.attribute,m-a,b-o,l),e.stroke()))}drawShape(t,e,i,n,s,r,a,o){const l=ns(t,null==r?void 0:r.theme).line,{fill:h=l.fill,stroke:d=l.stroke,fillOpacity:c=l.fillOpacity,strokeOpacity:u=l.strokeOpacity,segments:p,points:g,closePath:f,curveTension:v=l.curveTension,connectedType:m=l.connectedType}=t.attribute;if(!this.valid(t,l,a,o))return;let{curveType:b=l.curveType}=t.attribute;f&&"linear"===b&&(b="linearClosed");const{clipRange:y=l.clipRange,clipRangeByDimension:x=l.clipRangeByDimension}=t.attribute;if(1===y&&!p&&!g.some((t=>!1===t.defined))&&"linear"===b)return this.drawLinearLineHighPerformance(t,e,!!h,!!d,c,u,i,n,l,s,r,a,o);function _(t,e){return"none"===e?t:t.filter((t=>!1!==t.defined))}if(t.shouldUpdateShape()){const{points:e,segments:i}=t.attribute,n=e;if(i&&i.length){let e,n;if(t.cache=i.map(((t,i)=>{if(t.points.length<=1&&0===i)return t.points[0]&&(n={endX:t.points[0].x,endY:t.points[0].y,curves:[{defined:!1!==t.points[0].defined}]}),null;1===i?e={x:n.endX,y:n.endY,defined:n.curves[n.curves.length-1].defined}:i>1&&(e.x=n.endX,e.y=n.endY,e.defined=n.curves[n.curves.length-1].defined);const s=Xi(_(t.points,m),b,{startPoint:e,curveTension:v});return n=s,s})).filter((t=>!!t)),"linearClosed"===b){let e;for(let i=0;i<t.cache.length;i++){const n=t.cache[i];for(let t=0;t<n.curves.length;t++)if(n.curves[t].defined){e=n.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=Xi(_(n,m),b,{curveTension:v})}t.clearUpdateShapeTag()}if(Array.isArray(t.cache)){const s=t.attribute.segments.filter((t=>t.points.length));if(1===s[0].points.length&&s.shift(),1===y){let r=!1;t.cache.forEach(((p,g)=>{r||(r=this.drawSegmentItem(e,p,!!h,!!d,c,u,s[g],[l,t.attribute],y,x,i,n,t,a,o))}))}else{const r=t.cache.reduce(((t,e)=>t+e.getLength()),0),p=y*r;let g=0,f=!1;t.cache.forEach(((r,v)=>{if(f)return;const m=r.getLength(),b=(p-g)/m;g+=m,b>0&&(f=this.drawSegmentItem(e,r,!!h,!!d,c,u,s[v],[l,t.attribute],Yt(b,1),x,i,n,t,a,o))}))}}else this.drawSegmentItem(e,t.cache,!!h,!!d,c,u,t.attribute,l,y,x,i,n,t,a,o)}};function Bl(t,e,i,n){const{offsetX:s=0,offsetY:r=0,offsetZ:a=0}=n||{};let o=!0;e.forEach((e=>{e.defined?(o&&t.moveTo(e.p0.x+s,e.p0.y+r,a),_l(t,e,1,n),o=!1):o=!0})),o=!0;for(let e=i.length-1;e>=0;e--){const l=i[e];l.defined?(o&&t.lineTo(l.p0.x+s,l.p0.y+r,a),_l(t,l,1,n),o=!1):o=!0}t.closePath()}kl=Sl([y()],kl);const Al=new class extends sl{constructor(){super(...arguments),this.time=ni.afterFillStroke}drawShape(t,e,i,n,s,r,a,o,l,h,d,c,u){var p,g,f,v;this.textureMap||this.initTextureMap(e,t.stage);const{attribute:m=t.attribute}=u||{},{texture:b=(null!==(p=t.attribute.texture)&&void 0!==p?p:Is(l,"texture")),textureColor:y=(null!==(g=t.attribute.textureColor)&&void 0!==g?g:Is(l,"textureColor")),textureSize:x=(null!==(f=t.attribute.textureSize)&&void 0!==f?f:Is(l,"textureSize")),texturePadding:_=(null!==(v=t.attribute.texturePadding)&&void 0!==v?v:Is(l,"texturePadding"))}=m;b&&this.drawTexture(b,t,e,i,n,l,y,x,_)}},Cl=tl;var Ll=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Ol=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},El=function(t,e){return function(i,n){e(i,n,t)}};let Rl=class extends xl{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=ya,this.builtinContributions=[Al,Cl],this.init(t)}drawLinearAreaHighPerformance(t,e,i,n,s,r,a,o,l,h,d,c,u){var p,g,f;const{points:v}=t.attribute;if(v.length<2)return;e.beginPath();const m=null!==(p=this.z)&&void 0!==p?p:0,b=v[0];e.moveTo(b.x+a,b.y+o,m);for(let t=1;t<v.length;t++){const i=v[t];e.lineTo(i.x+a,i.y+o,m)}for(let t=v.length-1;t>=0;t--){const i=v[t];e.lineTo((null!==(g=i.x1)&&void 0!==g?g:i.x)+a,(null!==(f=i.y1)&&void 0!==f?f:i.y)+o,m)}e.closePath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,a,o,!!s,!1,i,!1,l,h,c,null,{attribute:t.attribute});const{x:y=0,x:x=0}=t.attribute;!1!==i&&(c?c(e,t.attribute,l):s&&(e.setCommonStyle(t,t.attribute,y-a,x-o,l),e.fill())),this.afterRenderStep(t,e,a,o,!!s,!1,i,!1,l,h,c,null,{attribute:t.attribute}),(()=>{var i,s;if(n){const{stroke:n=l&&l.stroke}=t.attribute;if(ht(n)&&(n[0]||n[2])&&!1===n[1])if(e.beginPath(),n[0]){e.moveTo(b.x+a,b.y+o,m);for(let t=1;t<v.length;t++){const i=v[t];e.lineTo(i.x+a,i.y+o,m)}}else if(n[2]){const t=v[v.length-1];e.moveTo(t.x+a,t.y+o,m);for(let t=v.length-2;t>=0;t--){const n=v[t];e.lineTo((null!==(i=n.x1)&&void 0!==i?i:n.x)+a,(null!==(s=n.y1)&&void 0!==s?s:n.y)+o,m)}}u?u(e,t.attribute,l):(e.setStrokeStyle(t,t.attribute,y-a,x-o,l),e.stroke())}})()}drawShape(t,e,i,n,s,r,a,o){var l,h,d,c,u,p;const g=ns(t,null==r?void 0:r.theme).area,{fill:f=g.fill,stroke:v=g.stroke,fillOpacity:m=g.fillOpacity,z:b=g.z,strokeOpacity:y=g.strokeOpacity,curveTension:x=g.curveTension,connectedType:_=g.connectedType}=t.attribute,w=this.valid(t,g,a,o);if(!w)return;const{doFill:T}=w,S=w.doStroke&&w.sVisible,{clipRange:k=g.clipRange,closePath:B,points:A,segments:C}=t.attribute;let{curveType:L=g.curveType}=t.attribute;function O(t,e){return"connect"!==e?t:t.filter((t=>!1!==t.defined))}if(B&&"linear"===L&&(L="linearClosed"),1===k&&!C&&!A.some((t=>!1===t.defined))&&"linear"===L)return this.drawLinearAreaHighPerformance(t,e,!!f,S,m,y,i,n,g,s,r,a,o);if(t.shouldUpdateShape()){if(C&&C.length){let e,i;const n=C.map(((t,n)=>{if(t.points.length<=1&&0===n)return t.points[0]&&(i={endX:t.points[0].x,endY:t.points[0].y}),null;1===n?e={x:i.endX,y:i.endY}:n>1&&(e.x=i.endX,e.y=i.endY);const s=Xi(O(t.points,_),L,{startPoint:e,curveTension:x});return i=s,s})).filter((t=>!!t));let s;const r=[];for(let t=C.length-1;t>=0;t--){const e=C[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=C[t-1].points,n=e[e.length-1];n&&i.push({x:null!==(d=n.x1)&&void 0!==d?d:n.x,y:null!==(c=n.y1)&&void 0!==c?c:n.y})}i.length>1&&(s=Xi(O(i,_),"stepBefore"===L?"stepAfter":"stepAfter"===L?"stepBefore":L,{curveTension:x}),r.unshift(s))}t.cacheArea=r.map(((t,e)=>({top:n[e],bottom:t})))}else{if(!A||!A.length)return t.cacheArea=null,void t.clearUpdateShapeTag();{const e=O(A,_),i=[];for(let t=e.length-1;t>=0;t--)i.push({x:null!==(u=e[t].x1)&&void 0!==u?u:e[t].x,y:null!==(p=e[t].y1)&&void 0!==p?p:e[t].y});const n=Xi(e,L,{curveTension:x}),s=Xi(i,"stepBefore"===L?"stepAfter":"stepAfter"===L?"stepBefore":L,{curveTension:x});t.cacheArea={top:n,bottom:s}}}t.clearUpdateShapeTag()}if(Array.isArray(t.cacheArea)){const r=t.attribute.segments.filter((t=>t.points.length));if(1===r[0].points.length&&r.shift(),1===k){let l=!1;t.cacheArea.forEach(((h,d)=>{l||(l=this.drawSegmentItem(e,h,T,m,S,y,r[d],[g,t.attribute],k,i,n,b,t,s,a,o))}))}else{const l=t.cacheArea.reduce(((t,e)=>t+e.top.getLength()),0),h=k*l;let d=0,c=!1;t.cacheArea.forEach(((l,u)=>{if(c)return;const p=l.top.getLength(),f=(h-d)/p;d+=p,f>0&&(c=this.drawSegmentItem(e,l,T,m,S,y,r[u],[g,t.attribute],Yt(f,1),i,n,b,t,s,a,o))}))}}else this.drawSegmentItem(e,t.cacheArea,T,m,S,y,t.attribute,g,k,i,n,b,t,s,a,o)}draw(t,e,i,n){const s=ns(t,null==n?void 0:n.theme).area;this._draw(t,s,!1,i,n)}drawSegmentItem(t,e,i,n,s,r,a,o,l,h,d,c,u,p,g,f){return this._drawSegmentItem(t,e,i,n,s,r,a,o,l,h,d,c,u,p,g,f)}_drawSegmentItem(t,e,i,n,s,r,a,o,l,h,d,c,u,p,g,f){if(!(e&&e.top&&e.bottom&&e.top.curves&&e.top.curves.length&&e.bottom.curves&&e.bottom.curves.length))return;t.beginPath();const{points:v,segments:m}=u.attribute;let b,y,x=ei.ROW;if(m){const t=m[m.length-1];y=m[0].points[0],b=t.points[t.points.length-1]}else y=v[0],b=v[v.length-1];const _=Wt(b.x-y.x),w=Wt(b.y-y.y);x=null==b.x1?ei.ROW:null==b.y1?ei.COLUMN:Number.isFinite(_+w)?_>w?ei.ROW:ei.COLUMN:ei.ROW,function(t,e,i,n){var s;const{top:r,bottom:a}=e;if(r.curves.length!==a.curves.length)return;if(i>=1){const e=[],i=[];let s=!0;for(let o=0,l=r.curves.length;o<l;o++){const h=r.curves[o];s!==h.defined?(s?(Bl(t,e,i,n),e.length=0,i.length=0):(e.push(h),i.push(a.curves[l-o-1])),s=!s):s&&(e.push(h),i.push(a.curves[l-o-1]))}return void Bl(t,e,i,n)}if(i<=0)return;let{direction:o}=n||{};const{curves:l}=r,h=null!==(s=l[l.length-1].p3)&&void 0!==s?s:l[l.length-1].p1,d=Wt(h.x-l[0].p0.x),c=Wt(h.y-l[0].p0.y);o=null!=o?o:d>c?ei.ROW:ei.COLUMN,Number.isFinite(d)||(o=ei.COLUMN),Number.isFinite(c)||(o=ei.ROW);const u=i*(o===ei.ROW?d:c);let p=0,g=!0;const f=[],v=[];for(let e=0,i=r.curves.length;e<i;e++){const s=r.curves[e],l=s.getLength(o),h=(u-p)/l;if(h<0)break;p+=l;let d=null,c=null;g!==s.defined?(g?(Bl(t,f,v,n),f.length=0,v.length=0):(d=s,c=a.curves[i-e-1]),g=!g):g&&(d=s,c=a.curves[i-e-1]),d&&c&&(h<1&&(d=d.p2&&d.p3?fi(d,h)[0]:mi(d,h)[0],c=c.p2&&c.p3?fi(c,1-h)[1]:mi(c,1-h)[1]),d.defined=g,c.defined=g,f.push(d),v.push(c)),d=null,c=null}Bl(t,f,v,n)}(t.camera?t:t.nativeContext,e,l,{offsetX:h,offsetY:d,offsetZ:c,direction:x}),this.beforeRenderStep(u,t,h,d,!!n,!1,i,!1,o,p,g,null,{attribute:a}),t.setShadowBlendStyle&&t.setShadowBlendStyle(u,a,o);const{x:T=0,x:S=0}=a;return!1!==i&&(g?g(t,a,o):n&&(t.setCommonStyle(u,a,T-h,S-d,o),t.fill())),this.afterRenderStep(u,t,h,d,!!n,!1,i,!1,o,p,g,null,{attribute:a}),(()=>{if(!1!==s)if(f)f(t,a,o);else{const{stroke:i=o&&o[1]&&o[1].stroke}=a;ht(i)&&(i[0]||i[2])&&!1===i[1]&&(t.beginPath(),Tl(t.camera?t:t.nativeContext,i[0]?e.top:e.bottom,l,x===ei.ROW?"x":"y",{offsetX:h,offsetY:d,offsetZ:c})),t.setStrokeStyle(u,a,T-h,S-d,o),t.stroke()}})(),!1}};Rl=Ll([y(),El(0,m(D)),El(0,x(lo)),Ol("design:paramtypes",[Object])],Rl);var Ml=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Pl=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Dl=function(t,e){return function(i,n){e(i,n,t)}};let Il=class extends xl{constructor(t){super(),this.graphicRenderContributions=t,this.type="rect",this.numberType=ka,this.builtinContributions=[ul,gl,pl],this.init(t)}drawShape(t,e,i,n,s,r,a,o){var l;const h=null!==(l=this.tempTheme)&&void 0!==l?l:ns(t,null==r?void 0:r.theme).rect,{fill:d=h.fill,background:c,stroke:u=h.stroke,cornerRadius:p=h.cornerRadius,cornerType:g=h.cornerType,opacity:f=h.opacity,fillOpacity:v=h.fillOpacity,lineWidth:m=h.lineWidth,strokeOpacity:b=h.strokeOpacity,visible:y=h.visible,x1:x,y1:_,x:w=h.x,y:T=h.y,fillStrokeOrder:S=h.fillStrokeOrder}=t.attribute;let{width:k,height:B}=t.attribute;k=(null!=k?k:x-w)||0,B=(null!=B?B:_-T)||0;const A=ro(f,v,k,B,d),C=oo(f,b,k,B),L=io(d,c),O=no(u,m);if(!t.valid||!y)return;if(!L&&!O)return;if(!(A||C||a||o||c))return;0===p||ht(p)&&p.every((t=>0===t))?(e.beginPath(),e.rect(i,n,k,B)):(e.beginPath(),ll(e,i,n,k,B,p,"bevel"!==g));const E={doFill:L,doStroke:O};e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,h),this.beforeRenderStep(t,e,i,n,L,O,A,C,h,s,a,o,E);const R=()=>{E.doFill&&(a?a(e,t.attribute,h):A&&(e.setCommonStyle(t,t.attribute,w-i,T-n,h),e.fill()))},M=()=>{E.doStroke&&(o?o(e,t.attribute,h):C&&(e.setStrokeStyle(t,t.attribute,w-i,T-n,h),e.stroke()))};S?(M(),R()):(R(),M()),this.afterRenderStep(t,e,i,n,L,O,A,C,h,s,a,o)}draw(t,e,i,n){const s=ns(t,null==n?void 0:n.theme).rect;this.tempTheme=s,this._draw(t,s,!1,i,n),this.tempTheme=null}};Il=Ml([y(),Dl(0,m(D)),Dl(0,x(co)),Pl("design:paramtypes",[Object])],Il);var Fl=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Nl=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Hl=function(t,e){return function(i,n){e(i,n,t)}};let zl=class extends xl{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=Ba,this.builtinContributions=[fl,bl,ml,vl],this.init(t)}drawShape(t,e,i,n,s,r,a,o){var l;const h=ns(t,null==r?void 0:r.theme).symbol,{size:d=h.size,x:c=h.x,y:u=h.y,scaleX:p=h.scaleX,scaleY:g=h.scaleY,fillStrokeOrder:f=h.fillStrokeOrder,clipRange:v=h.clipRange}=t.attribute,m=this.valid(t,h,a,o);if(!m)return;const{fVisible:b,sVisible:y,doFill:x,doStroke:_}=m,w=t.getParsedPath();if(!w)return;const{keepDirIn3d:T=h.keepDirIn3d}=t.attribute,S=null!==(l=this.z)&&void 0!==l?l:0;e.beginPath();let k=i,B=n,A=S;const C=e.camera;if(T&&C&&e.project){const t=e.project(i,n,S);e.camera=null,ht(d)&&(d[0],d[1]),k=t.x,B=t.y,A=void 0}!1===w.draw(e,d,k,B,A,((s,r)=>{var l,d,m,b;if(t._parsedPath.svgCache){const e=Object.assign({},r);e.fill=null!==(l=r.fill)&&void 0!==l?l:t.attribute.fill,e.opacity=null!==(d=r.opacity)&&void 0!==d?d:t.attribute.opacity,e.fillOpacity=t.attribute.fillOpacity,e.stroke=null!==(m=r.stroke)&&void 0!==m?m:t.attribute.stroke,e.lineWidth=null!==(b=r.lineWidth)&&void 0!==b?b:t.attribute.lineWidth,r=e}const x=()=>{r.fill&&(a?a(e,t.attribute,h):(e.setCommonStyle(t,r,c-i,u-n,h),e.fill()))},_=()=>{r.stroke&&(o?o(e,t.attribute,h):y&&v>=1&&(e.setStrokeStyle(t,r,(c-i)/p,(u-n)/g,h),e.stroke()))};f?(_(),x()):(x(),_())}))&&e.closePath(),e.camera=C,e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,h),this.beforeRenderStep(t,e,i,n,x,_,b,y,h,s,a,o);const L=()=>{x&&!w.isSvg&&(a?a(e,t.attribute,h):b&&(e.setCommonStyle(t,t.attribute,c-i,u-n,h),e.fill()))},O=()=>{_&&!w.isSvg&&(o?o(e,t.attribute,h):y&&v>=1&&(e.setStrokeStyle(t,t.attribute,(c-i)/p,(u-n)/g,h),e.stroke()))};f?(O(),L()):(L(),O()),this.afterRenderStep(t,e,i,n,x,_,b,y,h,s,a,o)}draw(t,e,i,n){const s=ns(t,null==n?void 0:n.theme).symbol;this._draw(t,s,!1,i,n)}};zl=Fl([y(),Hl(0,m(D)),Hl(0,x(uo)),Nl("design:paramtypes",[Object])],zl);const Wl=new class{constructor(){this.pools=[];for(let t=0;t<10;t++)this.pools.push(new pe)}allocate(t,e,i,n){if(!this.pools.length)return(new pe).setValue(t,e,i,n);const s=this.pools.pop();return s.x1=t,s.y1=e,s.x2=i,s.y2=n,s}allocateByObj(t){if(!this.pools.length)return new pe(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=[]}};const Ul=new class extends Qo{constructor(){super(...arguments),this.time=ni.beforeFillStroke}drawShape(t,e,i,n,s,r,a,o,l,h,d,c){var u,p,g,f,v,m,b,y,x,_;const{backgroundMode:w=l.backgroundMode,backgroundFit:T=l.backgroundFit,backgroundKeepAspectRatio:S=l.backgroundKeepAspectRatio}=t.attribute;let k,{background:B}=t.attribute;if(!B)return;const A=()=>{"richtext"===t.type&&(e.restore(),e.save(),k&&e.setTransformFromMatrix(k,!0,1))};let C;"richtext"===t.type&&(k=e.currentMatrix.clone(),e.restore(),e.save(),e.setTransformForCurrent());const L=st(B)&&B.background,O=t.transMatrix.onlyTranslate();if(L){const e=t.AABBBounds,i=(null!==(u=B.x)&&void 0!==u?u:e.x1)+(null!==(p=B.dx)&&void 0!==p?p:0),n=(null!==(g=B.y)&&void 0!==g?g:e.y1)+(null!==(f=B.dy)&&void 0!==f?f:0),s=null!==(v=B.width)&&void 0!==v?v:e.width(),r=null!==(m=B.height)&&void 0!==m?m:e.height();if(C=Wl.allocate(i,n,i+s,n+r),B=B.background,!O){const t=C.width(),e=C.height();C.set((null!==(b=B.x)&&void 0!==b?b:0)+(null!==(y=B.dx)&&void 0!==y?y:0),(null!==(x=B.y)&&void 0!==x?x:0)+(null!==(_=B.dy)&&void 0!==_?_:0),t,e)}}else C=t.AABBBounds,O||(C=(E=Object.assign(Object.assign({},t.attribute),{angle:0,scaleX:1,scaleY:1,x:0,y:0,dx:0,dy:0}),$o||($o=Ko.CreateGraphic("text",{})),$o.initAttributes(E),$o.AABBBounds).clone());var E;if(t.backgroundImg&&t.resources){const s=t.resources.get(B);if("success"!==s.state||!s.data)return void A();e.highPerformanceSave(),O&&e.setTransformFromMatrix(t.parent.globalTransMatrix,!0),e.setCommonStyle(t,t.attribute,i,n,l),this.doDrawImage(e,s.data,C,{backgroundMode:w,backgroundFit:T,backgroundKeepAspectRatio:S}),e.highPerformanceRestore(),e.setTransformForCurrent()}else{const{backgroundCornerRadius:s}=t.attribute;e.highPerformanceSave(),e.setCommonStyle(t,t.attribute,i,n,l),e.fillStyle=B,s?(ll(e,C.x1,C.y1,C.width(),C.height(),s,!0),e.fill()):e.fillRect(C.x1,C.y1,C.width(),C.height()),e.highPerformanceRestore()}L&&Wl.free(C),A()}};var jl=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Gl=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Yl=function(t,e){return function(i,n){e(i,n,t)}};let Vl=class extends xl{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=Aa,this.builtinContributions=[Ul],this.init(t)}drawShape(t,e,i,n,s,r,a,o){var l,h,d;const c=ns(t,null==r?void 0:r.theme).text,{text:u,underline:p=c.underline,lineThrough:g=c.lineThrough,keepDirIn3d:f=c.keepDirIn3d,direction:v=c.direction,fontSize:m=c.fontSize,verticalMode:b=c.verticalMode,x:y=c.x,y:x=c.y}=t.attribute,_=null!==(l=Fs(t.attribute.lineHeight,m))&&void 0!==l?l:m,w=this.valid(t,c,a,o);if(!w)return;const{fVisible:T,sVisible:S,doFill:k,doStroke:B}=w,A=!f,C=this.z||0;e.beginPath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,c),this.beforeRenderStep(t,e,i,n,k,B,T,S,c,s,a,o),A&&this.transformUseContext2d(t,c,C,e);const L=(s,r,l,h)=>{let d=i+r;const u=n+l;if(h){e.highPerformanceSave(),d+=m;const t=_o.allocate(1,0,0,1,0,0);t.rotateByCenter(Math.PI/2,d,u),e.transformFromMatrix(t,!0),_o.free(t)}B&&(o?o(e,t.attribute,c):S&&(e.setStrokeStyle(t,t.attribute,y-i,x-n,c),e.strokeText(s,d,u,C))),k&&(a?a(e,t.attribute,c):T&&(e.setCommonStyle(t,t.attribute,y-i,x-n,c),e.fillText(s,d,u,C))),h&&(e.highPerformanceRestore(),e.setTransformForCurrent())};if(e.setTextStyleWithoutAlignBaseline(t.attribute,c,C),"horizontal"===v){const{multilineLayout:s}=t;if(!s)return void e.highPerformanceRestore();const{xOffset:r,yOffset:l}=s.bbox;B&&(o?o(e,t.attribute,c):S&&(e.setStrokeStyle(t,t.attribute,y-i,x-n,c),s.lines.forEach((t=>{e.strokeText(t.str,(t.leftOffset||0)+r+i,(t.topOffset||0)+l+n,C)})))),k&&(a?a(e,t.attribute,c):T&&(e.setCommonStyle(t,t.attribute,y-i,x-n,c),s.lines.forEach((s=>{e.fillText(s.str,(s.leftOffset||0)+r+i,(s.topOffset||0)+l+n,C),this.drawUnderLine(p,g,t,(s.leftOffset||0)+r+i,(s.topOffset||0)+l+n,s.descent,(s.descent-s.ascent)/2,C,c,e,{width:s.width})}))))}else{let{textAlign:i=c.textAlign,textBaseline:n=c.textBaseline}=t.attribute;if(!b){const e=i;i=null!==(h=t.getBaselineMapAlign()[n])&&void 0!==h?h:"left",n=null!==(d=t.getAlignMapBaseline()[e])&&void 0!==d?d:"top"}t.tryUpdateAABBBounds();const s=t.cache,{verticalList:r}=s;e.textAlign="left",e.textBaseline="top";const a=_*r.length;let o=0;r.forEach((t=>{const e=t.reduce(((t,e)=>t+(e.width||0)),0);o=Gt(e,o)}));let l=0,u=0;"bottom"===n?u=-a:"middle"===n&&(u=-a/2),"center"===i?l-=o/2:"right"===i&&(l-=o),r.forEach(((t,e)=>{const n=t.reduce(((t,e)=>t+(e.width||0)),0),s=o-n;let r=l;"center"===i?r+=s/2:"right"===i&&(r+=s),t.forEach((t=>{const{text:i,width:n,direction:s}=t;L(i,a-(e+1)*_+u,r,s),r+=n}))}))}A&&this.restoreTransformUseContext2d(t,c,C,e),this.afterRenderStep(t,e,i,n,k,B,T,S,c,s,a,o)}draw(t,e,i,n){const s=ns(t,null==n?void 0:n.theme).text,{keepDirIn3d:r=s.keepDirIn3d}=t.attribute,a=!r;this._draw(t,s,a,i,n)}drawUnderLine(t,e,i,n,s,r,a,o,l,h,d){if(e+t<=0)return;const{textAlign:c=l.textAlign,fill:u=l.fill,opacity:p=l.opacity,underlineOffset:g=l.underlineOffset,underlineDash:f=l.underlineDash,fillOpacity:v=l.fillOpacity}=i.attribute,m=!it(d),b=m?d.width:i.clipedWidth,y=m?0:fo(c,b),x={lineWidth:0,stroke:u,opacity:p,strokeOpacity:v};if(t){x.lineWidth=t,h.setStrokeStyle(i,x,n,s,l),f&&h.setLineDash(f),h.beginPath();const e=s+r+g;h.moveTo(n+y,e,o),h.lineTo(n+y+b,e,o),h.stroke()}if(e){x.lineWidth=e,h.setStrokeStyle(i,x,n,s,l),h.beginPath();const t=s+a;h.moveTo(n+y,t,o),h.lineTo(n+y+b,t,o),h.stroke()}}};Vl=jl([y(),Yl(0,m(D)),Yl(0,x(po)),Gl("design:paramtypes",[Object])],Vl);var Xl=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Kl=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},$l=function(t,e){return function(i,n){e(i,n,t)}};let ql=class{constructor(t){this.groupRenderContribitions=t,this.numberType=_a}reInit(){this._groupRenderContribitions=this.groupRenderContribitions.getContributions()||[],this._groupRenderContribitions.push(al)}drawShape(t,e,i,n,s,r,a,o){const l=ns(t,null==r?void 0:r.theme).group,{fill:h=l.fill,background:d,stroke:c=l.stroke,opacity:u=l.opacity,width:p=l.width,height:g=l.height,clip:f=l.clip,fillOpacity:v=l.fillOpacity,strokeOpacity:m=l.strokeOpacity,cornerRadius:b=l.cornerRadius,path:y=l.path,lineWidth:x=l.lineWidth,visible:_=l.visible,fillStrokeOrder:w=l.fillStrokeOrder,cornerType:T=l.cornerType,x:S=l.x,y:k=l.y}=t.attribute,B=ro(u,v,p,g,h),A=oo(u,m,p,g),C=io(h,d),L=no(c,x);if(!t.valid||!_)return;if(!f){if(!C&&!L)return;if(!(B||A||a||o||d))return}if(y&&y.length&&s.drawContribution){const t=e.disableFill,i=e.disableStroke,n=e.disableBeginPath;e.disableFill=!0,e.disableStroke=!0,e.disableBeginPath=!0,y.forEach((t=>{s.drawContribution.getRenderContribution(t).draw(t,s.renderService,s,r)})),e.disableFill=t,e.disableStroke=i,e.disableBeginPath=n}else 0===b||ht(b)&&b.every((t=>0===t))?(e.beginPath(),e.rect(i,n,p,g)):(e.beginPath(),ll(e,i,n,p,g,b,"bevel"!==T));this._groupRenderContribitions||(this._groupRenderContribitions=this.groupRenderContribitions.getContributions()||[],this._groupRenderContribitions.push(al));const O={doFill:C,doStroke:L};e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this._groupRenderContribitions.forEach((r=>{r.time===ni.beforeFillStroke&&r.drawShape(t,e,i,n,C,L,B,A,l,s,a,o,O)})),f&&e.clip();const E=()=>{O.doFill&&(a?a(e,t.attribute,l):B&&(e.setCommonStyle(t,t.attribute,S-i,k-n,l),e.fill()))},R=()=>{O.doStroke&&(o?o(e,t.attribute,l):A&&(e.setStrokeStyle(t,t.attribute,S-i,k-n,l),e.stroke()))};w?(R(),E()):(E(),R()),this._groupRenderContribitions.forEach((r=>{r.time===ni.afterFillStroke&&r.drawShape(t,e,i,n,C,L,B,A,l,s,a,o)}))}draw(t,e,i,n){const{context:s}=i;if(!s)return;const{clip:r,baseOpacity:a=1,drawMode:o,x:l,y:h,width:d,height:c}=t.attribute,u=s.nativeContext,p=s.canvas.nativeCanvas;if(o>0){const t=s.canvas,e=cd.createCanvas({width:t.width,height:t.height,dpr:1}),i=e.getContext("2d"),n=s.nativeContext.getTransform();i.setTransform(n.a,n.b,n.c,n.d,n.e,n.f),1===o&&(i.save(),i.clearRect(0,0,t.width,t.height),i.beginPath(),i.rect(l,h,d,c),i.clip(),i.drawImage(t.nativeCanvas,0,0,t.width,t.height,0,0,t.displayWidth,t.displayHeight),i.restore()),s.nativeContext=i,t.nativeCanvas=e}r?s.save():s.highPerformanceSave();const g=s.baseGlobalAlpha;s.baseGlobalAlpha*=a;const f=ns(t,null==n?void 0:n.theme).group,v=s.modelMatrix;if(s.camera){const e=wo.allocate(),i=wo.allocate();Bo(i,t,f),yo(e,v||e,i),s.modelMatrix=e,wo.free(i),s.setTransform(1,0,0,1,0,0,!0)}else s.transformFromMatrix(t.transMatrix,!0);s.beginPath(),n.skipDraw?this.drawShape(t,s,0,0,i,n,(()=>!1),(()=>!1)):this.drawShape(t,s,0,0,i);const{scrollX:m=f.scrollX,scrollY:b=f.scrollY}=t.attribute;let y;if((m||b)&&s.translate(m,b),n&&n.drawingCb&&(y=n.drawingCb()),s.modelMatrix!==v&&wo.free(s.modelMatrix),s.modelMatrix=v,s.baseGlobalAlpha=g,o>0){const t=s.nativeContext,e=s.canvas.nativeCanvas;u.save(),u.setTransform(s.dpr,0,0,s.dpr,0,0,!0),1===o&&t.rect(l,h,d,c),u.drawImage(e,0,0,e.width,e.height,0,0,s.canvas.displayWidth,s.canvas.displayHeight);const i=t.getTransform();u.setTransform(i.a,i.b,i.c,i.d,i.e,i.f),s.nativeContext=u,s.canvas.nativeCanvas=p,u.restore()}y&&y.then?y.then((()=>{r?s.restore():s.highPerformanceRestore()})):r?s.restore():s.highPerformanceRestore()}};ql=Xl([y(),$l(0,m(D)),$l(0,x(ho)),Kl("design:paramtypes",[Object])],ql);const Zl=Symbol.for("IncrementalDrawContribution"),Jl=Symbol.for("GraphicRender"),Ql=Symbol.for("GroupRender"),th=Symbol.for("RectRender"),eh=Symbol.for("SymbolRender"),ih=Symbol.for("TextRender"),nh=Symbol.for("DrawContribution"),sh=(t,e,i,n)=>{let s,r=!1,a=!1;if(e.forEachChildren((t=>(r=t.numberType===ba,!r))),e.forEachChildren((t=>(a=!!t.findFace,!a))),r){const t=e.getChildren(),o=[...t];o.sort(((t,e)=>{var i,n,s,r;let a=(null!==(n=null!==(i=t.attribute.startAngle)&&void 0!==i?i:0+t.attribute.endAngle)&&void 0!==n?n:0)/2,o=(null!==(r=null!==(s=e.attribute.startAngle)&&void 0!==s?s:0+e.attribute.endAngle)&&void 0!==r?r:0)/2;for(;a<0;)a+=zt;for(;o<0;)o+=zt;return o-a})),o.forEach((t=>{t._next=null,t._prev=null})),e.removeAllChild(),e.update(),o.forEach((t=>{e.appendChild(t)})),n.hack_pieFace="outside",s=i(r,a),s&&s.graphic||(n.hack_pieFace="inside",s=i(r,a)),s&&s.graphic||(n.hack_pieFace="top",s=i(r,a)),e.removeAllChild(),t.forEach((t=>{t._next=null,t._prev=null})),t.forEach((t=>{e.appendChild(t)}))}else if(a){const n=e.getChildren(),o=n.map((e=>({ave_z:e.findFace().vertices.map((i=>{var n;return t.view(i[0],i[1],null!==(n=i[2]+e.attribute.z)&&void 0!==n?n:0)[2]})).reduce(((t,e)=>t+e),0),g:e})));o.sort(((t,e)=>e.ave_z-t.ave_z)),e.removeAllChild(),o.forEach((t=>{t.g._next=null,t.g._prev=null})),e.update(),o.forEach((t=>{e.add(t.g)})),s=i(r,a),e.removeAllChild(),n.forEach((t=>{t._next=null,t._prev=null})),e.update(),n.forEach((t=>{e.add(t)}))}else s=i(r,a);return s};var rh=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},ah=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const oh=Symbol.for("DrawItemInterceptor"),lh=new pe,hh=new pe;class dh{constructor(){this.order=1}afterDrawItem(t,e,i,n,s){return null==t.attribute.shadowRootIdx&&t.shadowRoot&&t.shadowRoot.attribute.shadowRootIdx<0||(t.attribute.shadowRootIdx>0||!t.attribute.shadowRootIdx||t.shadowRoot&&t.shadowRoot.attribute.shadowRootIdx>0)&&this.drawItem(t,e,i,n,s),!1}beforeDrawItem(t,e,i,n,s){return null==t.attribute.shadowRootIdx&&t.shadowRoot&&t.shadowRoot.attribute.shadowRootIdx>0||(t.attribute.shadowRootIdx<0||t.shadowRoot&&t.shadowRoot.attribute.shadowRootIdx<0)&&this.drawItem(t,e,i,n,s),!1}drawItem(t,e,i,n,s){if(!t.shadowRoot)return!1;const{context:r}=i;if(r.highPerformanceSave(),r.transformFromMatrix(t.transMatrix,!0),n.dirtyBounds&&n.backupDirtyBounds){lh.copy(n.dirtyBounds),hh.copy(n.backupDirtyBounds);const e=t.globalTransMatrix.getInverse();n.dirtyBounds.copy(n.backupDirtyBounds).transformWithMatrix(e),n.backupDirtyBounds.copy(n.dirtyBounds)}return n.renderGroup(t.shadowRoot,i,_o.allocate(1,0,0,1,0,0)),r.highPerformanceRestore(),n.dirtyBounds&&n.backupDirtyBounds&&(n.dirtyBounds.copy(lh),n.backupDirtyBounds.copy(hh)),!0}}class ch{constructor(){this.order=1}afterDrawItem(t,e,i,n,s){return t.attribute._debug_bounds&&this.drawItem(t,e,i,n,s),!1}drawItem(t,e,i,n,s){if(!t.attribute._debug_bounds)return!1;const{context:r}=i;r.highPerformanceSave(),t.parent&&r.setTransformFromMatrix(t.parent.globalTransMatrix,!0),t.glyphHost&&t.glyphHost.parent&&r.setTransformFromMatrix(t.glyphHost.parent.globalTransMatrix,!0);const a=t.AABBBounds;return!0!==t.attribute._debug_bounds&&t.attribute._debug_bounds(r,t),r.strokeRect(a.x1,a.y1,a.width(),a.height()),r.highPerformanceRestore(),!0}}let uh=class{constructor(){this.order=1,this.interceptors=[new dh,new gh,new ph,new ch]}afterDrawItem(t,e,i,n,s){for(let r=0;r<this.interceptors.length;r++)if(this.interceptors[r].afterDrawItem&&this.interceptors[r].afterDrawItem(t,e,i,n,s))return!0;return!1}beforeDrawItem(t,e,i,n,s){if((!t.in3dMode||i.in3dInterceptor)&&!t.shadowRoot&&!(t.baseGraphic||t.attribute.globalZIndex||t.interactiveGraphic))return!1;for(let r=0;r<this.interceptors.length;r++)if(this.interceptors[r].beforeDrawItem&&this.interceptors[r].beforeDrawItem(t,e,i,n,s))return!0;return!1}};uh=rh([y(),ah("design:paramtypes",[])],uh);class ph{constructor(){this.order=1}beforeDrawItem(t,e,i,n,s){return!this.processing&&(t.baseGraphic?this.beforeDrawInteractive(t,e,i,n,s):this.beforeSetInteractive(t,e,i,n,s))}beforeSetInteractive(t,e,i,n,s){let r=t.interactiveGraphic;if(t.attribute.globalZIndex){r||(r=t.clone(),t.interactiveGraphic=r,r.baseGraphic=t),r.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(r),!0}if(r){i.stage.tryInitInteractiveLayer();const e=i.stage.getLayer("_builtin_interactive");e&&this.getShadowRoot(e).removeChild(r),t.interactiveGraphic=null,r.baseGraphic=null}return!1}beforeDrawInteractive(t,e,i,n,s){const r=t.baseGraphic;let a=!!r.stage,o=r.parent;for(;a&&o&&o.stage!==o;)a=!!o.stage,o=o.parent;if(!a){const e=i.stage.getLayer("_builtin_interactive");return e&&this.getShadowRoot(e).removeChild(t),!0}if(r){this.processing=!0;const{context:t}=i;return t.highPerformanceSave(),t.setTransformFromMatrix(r.parent.globalTransMatrix,!0),r.isContainer?n.renderGroup(r,i,r.parent.globalTransMatrix):n.renderItem(r,i),t.highPerformanceRestore(),this.processing=!1,!0}return!1}getShadowRoot(t){var e;let i=t.getElementById("_interactive_group");return i||(i=Ko.CreateGraphic("group",{}),i.id="_interactive_group",t.add(i)),null!==(e=i.shadowRoot)&&void 0!==e?e:i.attachShadow()}}class gh{constructor(){this.order=1}beforeDrawItem(t,e,i,n,s){if(!t.in3dMode||i.in3dInterceptor)return!1;i.in3dInterceptor=!0;const{context:r,stage:a}=e.drawParams;r.canvas,r.save(),this.initCanvasCtx(r),r.camera=a.camera;const o=r.currentMatrix;o.a/=r.dpr,o.b/=r.dpr,o.c/=r.dpr,o.d/=r.dpr,o.e/=r.dpr,o.f/=r.dpr;const l=wo.allocate();var h,d;d=o,(h=l)[0]=d.a,h[1]=d.b,h[2]=0,h[3]=0,h[4]=d.c,h[5]=d.d,h[6]=0,h[7]=0,h[8]=0,h[9]=0,h[10]=1,h[11]=0,h[12]=d.e,h[13]=d.f,h[14]=0,h[15]=1;const c=r.modelMatrix;if(c){if(l){const t=wo.allocate();r.modelMatrix=yo(t,c,l)}}else r.modelMatrix=l;return r.setTransform(1,0,0,1,0,0,!0),t.isContainer?sh(r,t,((e,s)=>n.renderGroup(t,i,t.parent.globalTransMatrix,!e&&s)),i):n.renderItem(t,i),r.camera=null,r.restore(),r.modelMatrix!==c&&wo.free(r.modelMatrix),r.modelMatrix=c,i.in3dInterceptor=!1,!0}initCanvasCtx(t){t.setTransformForCurrent()}}var fh=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},vh=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},mh=function(t,e){return function(i,n){e(i,n,t)}};const bh=Symbol.for("RenderService");let yh=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))}reInit(){this.drawContribution.reInit()}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),this.drawParams=null}};yh=fh([y(),mh(0,m(nh)),vh("design:paramtypes",[Object])],yh);var xh=new a((t=>{t(bh).to(yh)}));const _h=Symbol.for("PickerService"),wh=Symbol.for("GlobalPickerService"),Th=Symbol.for("PickItemInterceptor"),Sh=Symbol.for("PickServiceInterceptor");var kh=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let Bh=class{constructor(){this.order=1}afterPickItem(t,e,i,n,s){if(t.graphic){let e=t.graphic;for(;e.parent;)e=e.parent;e.shadowHost&&(t.params={shadowTarget:t.graphic},t.graphic=e.shadowHost)}return t}};Bh=kh([y()],Bh);let Ah=class{constructor(){this.order=1}afterPickItem(t,e,i,n,s){return t.attribute.shadowRootIdx>0||!t.attribute.shadowRootIdx?this._pickItem(t,e,i,n,s):null}beforePickItem(t,e,i,n,s){return t.attribute.shadowRootIdx<0?this._pickItem(t,e,i,n,s):null}_pickItem(t,e,i,n,s){var r;if(!t.shadowRoot)return null;const{parentMatrix:a}=s||{};if(!a)return null;const o=e.pickContext;o.highPerformanceSave();const l=null===(r=ns(t))||void 0===r?void 0:r[t.type],{shadowPickMode:h=(null==l?void 0:l.shadowPickMode)}=t.attribute,d=t.shadowRoot,c=_o.allocateByObj(a),u=new qt(c.a*i.x+c.c*i.y+c.e,c.b*i.x+c.d*i.y+c.f),p=e.pickGroup(d,u,c,n);return o.highPerformanceRestore(),!p.graphic&&p.group&&"full"===h&&(p.graphic=p.group),p}};Ah=kh([y()],Ah);let Ch=class{constructor(){this.order=1}beforePickItem(t,e,i,n,s){const r=t.baseGraphic;if(r&&r.parent){const t=new qt(i.x,i.y),s=e.pickContext;s.highPerformanceSave();const a=r.parent.globalTransMatrix;a.transformPoint(t,t);const o=r.isContainer?e.pickGroup(r,t.clone(),a,n):e.pickItem(r,t.clone(),a,n);return s.highPerformanceRestore(),o}return null}};Ch=kh([y()],Ch);let Lh=class{constructor(){this.order=1}beforePickItem(t,e,i,n,s){if(!t.in3dMode||n.in3dInterceptor)return null;const r=e.pickContext,a=t.stage;if(!r||!a)return null;if(n.in3dInterceptor=!0,r.save(),this.initCanvasCtx(r),r.camera=a.camera,t.isContainer){const a=sh(r,t,(()=>e.pickGroup(t,i,s.parentMatrix,n)),n);return r.camera=null,n.in3dInterceptor=!1,r.restore(),a}return r.restore(),null}initCanvasCtx(t){t.setTransformForCurrent()}};Lh=kh([y()],Lh);var Oh=new a(((t,e,i)=>{i(_h)||(t(wh).toSelf(),t(_h).toService(wh)),t(Lh).toSelf().inSingletonScope(),t(Th).toService(Lh),t(Ah).toSelf().inSingletonScope(),t(Th).toService(Ah),t(Ch).toSelf().inSingletonScope(),t(Th).toService(Ch),F(t,Th),t(Bh).toSelf().inSingletonScope(),t(Sh).toService(Bh),F(t,Sh)})),Eh=new a((t=>{t(Ca).to(Ao).inSingletonScope(),t(La).toConstantValue(Ko)}));const Rh=Symbol.for("AutoEnablePlugins"),Mh=Symbol.for("PluginService");var Ph=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Dh=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Ih=function(t,e){return function(i,n){e(i,n,t)}};let Fh=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&&Pn.isBound(Rh)&&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=[]}};Fh=Ph([y(),Ih(0,m(D)),Ih(0,x(Rh)),Dh("design:paramtypes",[Object])],Fh);var Nh=new a((t=>{t(Mh).to(Fh),function(t,e){t(D).toDynamicValue((t=>{let{container:i}=t;return new I(e,i)})).whenTargetNamed(e)}(t,Rh)})),Hh=new a((t=>{F(t,W)})),zh=new a((t=>{t(Rn).to(Mn).inSingletonScope(),F(t,Rn)})),Wh=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Uh=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let jh=class{constructor(){this.type="static",this.offscreen=!1,this.global=xn.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 n=e.getContext().getCanvas().nativeCanvas,s=In({nativeCanvas:t,width:e.width,height:e.height,dpr:e.dpr,id:i.canvasId,canvasControled:!0,container:e.getContainer(),x:n.offsetLeft,y:n.offsetTop});s.applyPosition(),this.canvas=s,this.context=s.getContext()}}resize(t,e){this.canvas.resize(t,e)}resizeView(t,e){}render(t,e,i){var n;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!==(n=e.background)&&void 0!==n?n:"#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 n;const s=t.getContext();i.renderService.render(e,Object.assign(Object.assign({context:s},i),{clear:i.clear?null!==(n=i.background)&&void 0!==n?n:"#fff":void 0}))}getContext(){return this.context}release(){this.canvas.release()}};jh=Wh([y(),Uh("design:paramtypes",[])],jh);var Gh=new a((t=>{t(jh).toSelf(),t(Ka).toService(jh)}));var Yh=function(t,e,i,n){return new(i||(i=Promise))((function(s,r){function a(t){try{l(n.next(t))}catch(t){r(t)}}function o(t){try{l(n.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?s(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((n=n.apply(t,e||[])).next())}))};function Vh(t,e,i){const n={},s=[];return t.forEachChildren((t=>{const{zIndex:i=e}=t.attribute;n[i]?n[i].push(t):(n[i]=[t],s.push(i))}),i),s.sort(((t,e)=>i?e-t:t-e)),{childMap:n,zIdxArray:s}}function Xh(t,e,i){let n=arguments.length>3&&void 0!==arguments[3]&&arguments[3];return Yh(this,void 0,void 0,(function*(){yield t.forEachChildrenAsync(i,n)}))}function Kh(t,e,i){let n=arguments.length>3&&void 0!==arguments[3]&&arguments[3],s=!1;t.forEachChildren(((t,e)=>{const{zIndex:n=i}=t.attribute;if(0===e);else if(void 0!==n)return s=!0,!0;return!1}),n);let r=null,a=!1;if(s){const{childMap:s,zIdxArray:o}=Vh(t,i,n);let l=!1;for(let t=0;t<o.length&&!l;t++){const i=s[o[t]];for(let t=0;t<i.length;t++){if(a){l=!0,r=i[t];break}i[t]._uid!==e||(a=!0)}}}else t.forEachChildren((t=>a?(r=t,!0):(t._uid===e&&(a=!0),!1)),n);return r}var $h=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},qh=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Zh=function(t,e){return function(i,n){e(i,n,t)}};let Jh=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=xn.global,this.layerService=xn.layerService,ht(this.contributions)||(this.contributions=[this.contributions]),this.init()}reInit(){this.init(),this.contributions.forEach((t=>{t.reInit()}))}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:n,viewBox:s,transMatrix:r}=e;if(!i)return;const a=this.dirtyBounds.setValue(0,0,s.width(),s.height());if(n.dirtyBounds&&!n.dirtyBounds.empty()){const t=Qt(a,n.dirtyBounds,!1);a.x1=Math.floor(t.x1),a.y1=Math.floor(t.y1),a.x2=Math.ceil(t.x2),a.y2=Math.ceil(t.y2)}const o=i.dpr%1;(o||.5!==o)&&(a.x1=Math.floor(a.x1*i.dpr)/i.dpr,a.y1=Math.floor(a.y1*i.dpr)/i.dpr,a.x2=Math.ceil(a.x2*i.dpr)/i.dpr,a.y2=Math.ceil(a.y2*i.dpr)/i.dpr),this.backupDirtyBounds.copy(a),i.inuse=!0,i.setClearMatrix(r.a,r.b,r.c,r.d,r.e,r.f),i.clearMatrix(),i.setTransformForCurrent(!0),i.translate(s.x1,s.y1,!0),i.beginPath(),i.rect(a.x1,a.y1,a.width(),a.height()),i.clip(),n.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,n;return(null!==(i=t.attribute.zIndex)&&void 0!==i?i:sn.zIndex)-(null!==(n=e.attribute.zIndex)&&void 0!==n?n:sn.zIndex)})).forEach((t=>{t.isContainer?this.renderGroup(t,e,_o.allocate(1,0,0,1,0,0)):this.renderItem(t,e)})),i.restore(),i.setClearMatrix(1,0,0,1,0,0),i.inuse=!1,i.draw()}doRegister(){throw new Error("暂不支持")}_findNextGraphic(t){let e=t.parent,i=t._uid;for(;e;){const t=Kh(e,i,sn.zIndex);if(t)return t;i=e._uid,e=e.parent}return null}renderGroup(t,e,i,n){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&&!ne(t.AABBBounds,this.dirtyBounds,!1)&&"empty"!==t.attribute.boundsMode)return;let s,r=i;if(this.useDirtyBounds){s=Wl.allocateByObj(this.dirtyBounds);const e=t.transMatrix;r=_o.allocateByObj(i).multiply(e.a,e.b,e.c,e.d,e.e,e.f),this.dirtyBounds.copy(this.backupDirtyBounds).transformWithMatrix(r.getInverse())}this.renderItem(t,e,{drawingCb:()=>{var i;n?t.forEachChildren((t=>{e.break||(t.isContainer?this.renderGroup(t,e,r):this.renderItem(t,e))})):function(t,e,i){let n=arguments.length>3&&void 0!==arguments[3]&&arguments[3],s=arguments.length>4&&void 0!==arguments[4]&&arguments[4],r=!1;if(s)r=!0;else{let i;t.forEachChildren(((t,n)=>{const{zIndex:s=e}=t.attribute;if(0===n)i=s;else if(i!==s)return r=!0,!0;return!1}),n)}if(r){const{childMap:r,zIdxArray:a}=Vh(t,e,n);let o=!1;for(let t=0;t<a.length&&!o;t++){const e=r[a[t]];s&&e.sort(((t,e)=>{var i,s;return(n?-1:1)*((null!==(i=e.attribute.z)&&void 0!==i?i:0)-(null!==(s=t.attribute.z)&&void 0!==s?s:0))}));for(let t=0;t<e.length;t++)if(i(e[t],t)){o=!0;break}}}else t.forEachChildren(i,n)}(t,sn.zIndex,(t=>{e.break||(t.isContainer?this.renderGroup(t,e,r):this.renderItem(t,e))}),!1,!!(null===(i=e.context)||void 0===i?void 0:i.camera))}}),this.useDirtyBounds&&(this.dirtyBounds.copy(s),Wl.free(s),_o.free(r))}_increaseRender(t,e){const{layer:i,stage:n}=e,{subLayers:s}=i;let r=s.get(t._uid);r||(r={layer:this.layerService.createLayer(n),zIndex:s.size,group:t},s.set(t._uid,r));const a=r.layer.getNativeHandler().getContext(),o=r.drawContribution||Pn.get(Zl);o.dirtyBounds.setValue(-1/0,-1/0,1/0,1/0),o.backupDirtyBounds.setValue(-1/0,-1/0,1/0,1/0),o.draw(this.currentRenderService,Object.assign(Object.assign({},e),{drawContribution:o,clear:"transparent",layer:r.layer,context:a,startAtId:t._uid,break:!1})),r.drawContribution=o;const l=this._findNextGraphic(t);if(l)if(l.isContainer&&l.incremental)this._increaseRender(l,e);else{let t=s.get(l._uid);t||(t={layer:this.layerService.createLayer(n),zIndex:s.size},s.set(l._uid,t));const i=t.layer.getNativeHandler().getContext();this.draw(this.currentRenderService,Object.assign(Object.assign({},e),{drawContribution:o,clear:"transparent",layer:t.layer,context:i,startAtId:l._uid,break:!1}))}}getRenderContribution(t){let e;return e||(e=this.selectRenderByNumberType(t.numberType,t)),e||(e=this.selectRenderByType(t.type)),e}renderItem(t,e,i){if(this.InterceptorContributions.length)for(let n=0;n<this.InterceptorContributions.length;n++){const s=this.InterceptorContributions[n];if(s.beforeDrawItem&&s.beforeDrawItem(t,this.currentRenderService,e,this,i))return}const n=this.getRenderContribution(t);if(!n)return;let s,r=this.scrollMatrix&&(0!==this.scrollMatrix.e||0!==this.scrollMatrix.f);if(t.parent){const{scrollX:e=0,scrollY:i=0}=t.parent.attribute;(e||i)&&(r=!0,this.scrollMatrix||(this.scrollMatrix=_o.allocate(1,0,0,1,0,0)),this.scrollMatrix.translate(-e,-i))}if(r&&(s=this.dirtyBounds.clone().transformWithMatrix(this.scrollMatrix)),this.useDirtyBounds&&!t.isContainer&&"empty"!==t.attribute.boundsMode&&!ne(t.AABBBounds,null!=s?s:this.dirtyBounds,!1)){if(r&&t.parent){const{scrollX:e=0,scrollY:i=0}=t.parent.attribute;this.scrollMatrix&&this.scrollMatrix.translate(e,i)}return}const a=null!=e.startAtId&&t._uid!==e.startAtId;if(t._uid===e.startAtId&&(e.startAtId=null),i&&(i.skipDraw=a),a?t.isContainer&&n.draw(t,this.currentRenderService,e,i):n.draw(t,this.currentRenderService,e,i),r&&t.parent){const{scrollX:e=0,scrollY:i=0}=t.parent.attribute;this.scrollMatrix&&this.scrollMatrix.translate(e,i)}if(this.InterceptorContributions.length)for(let i=0;i<this.InterceptorContributions.length;i++){const n=this.InterceptorContributions[i];if(n.afterDrawItem&&n.afterDrawItem(t,this.currentRenderService,e,this))return}}selectRenderByType(t){return Ot.getInstance().warn("未知错误,不应该走到这里"),null}selectRenderByNumberType(t,e){let i;if(e.attribute.renderStyle){const n=this.styleRenderMap.get(e.attribute.renderStyle);i=n&&n.get(t)}return i||this.currentRenderMap.get(t)||this.defaultRenderMap.get(t)}clearScreen(t,e,i){var n,s;const{clear:r,viewBox:a}=i,o=a.width(),l=a.height();if(r){e.clearRect(0,0,o,l);const i=null===(n=t.drawParams)||void 0===n?void 0:n.stage;if(i&&(e.globalAlpha=null!==(s=i.attribute.opacity)&&void 0!==s?s:1),i&&i.backgroundImg&&i.resources){const t=i.resources.get(r);t&&"success"===t.state&&t.data&&e.drawImage(t.data,0,0,o,l)}else e.fillStyle=Sn(e,r,{AABBBounds:{x1:0,y1:0,x2:0+o,y2:0+l}},0,0),e.fillRect(0,0,o,l)}}afterDraw(t,e){}};Jh=$h([y(),Zh(0,b(Jl)),Zh(1,m(D)),Zh(1,x(oh)),qh("design:paramtypes",[Array,Object])],Jh);var Qh=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let td=class extends kl{constructor(){super(...arguments),this.numberType=Ta}drawShape(t,e,i,n,s,r,a,o){if(t.incremental&&s.multiGraphicOptions){const{startAtIdx:e,length:r}=s.multiGraphicOptions,{segments:l=[]}=t.attribute;if(e>l.length)return;const h=ns(t).line,{fill:d=h.fill,stroke:c=h.stroke,opacity:u=h.opacity,fillOpacity:p=h.fillOpacity,strokeOpacity:g=h.strokeOpacity,lineWidth:f=h.lineWidth,visible:v=h.visible}=t.attribute,m=so(u,p,d),b=ao(u,g),y=io(d),x=no(c,f);if(!t.valid||!v)return;if(!y&&!x)return;if(!(m||b||a||o))return;const{context:_}=s;for(let s=e;s<e+r;s++)this.drawIncreaseSegment(t,_,l[s-1],l[s],t.attribute.segments[s],[h,t.attribute],i,n)}else super.drawShape(t,e,i,n,s,r,a,o)}drawIncreaseSegment(t,e,i,n,s,r,a,o){n&&(e.beginPath(),function(t,e,i,n){const{offsetX:s=0,offsetY:r=0}=n||{},a=e?e.points[e.points.length-1]:i.points[0];t.moveTo(a.x+s,a.y+r),i.points.forEach((e=>{!1!==e.defined?t.lineTo(e.x+s,e.y+r):t.moveTo(e.x+s,e.y+r)}))}(e.nativeContext,i,n,{offsetX:a,offsetY:o}),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,s,r),e.setStrokeStyle(t,s,a,o,r),e.stroke())}};td=Qh([y()],td);var ed=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let id=class extends Rl{constructor(){super(...arguments),this.numberType=ya}drawShape(t,e,i,n,s,r,a){if(t.incremental&&s.multiGraphicOptions){const{startAtIdx:r,length:o}=s.multiGraphicOptions,{segments:l=[]}=t.attribute;if(r>l.length)return;const h=ns(t).area,{fill:d=h.fill,fillOpacity:c=h.fillOpacity,opacity:u=h.opacity,visible:p=h.visible}=t.attribute,g=so(u,c,d),f=io(d);if(!t.valid||!p)return;if(!f)return;if(!g&&!a)return;for(let s=r;s<r+o;s++)this.drawIncreaseSegment(t,e,l[s-1],l[s],t.attribute.segments[s],[h,t.attribute],i,n)}else super.drawShape(t,e,i,n,s,r,a)}drawIncreaseSegment(t,e,i,n,s,r,a,o){n&&(e.beginPath(),function(t,e,i,n){const{offsetX:s=0,offsetY:r=0}=n||{},{points:a}=i,o=[];for(let t=0;t<a.length;t++)a[t].defined;o.push(a),o.forEach(((i,n)=>{var a,o,l,h;const d=e&&0===n?e.points[e.points.length-1]:i[0];t.moveTo(d.x+s,d.y+r),i.forEach((e=>{!1!==e.defined?t.lineTo(e.x+s,e.y+r):t.moveTo(e.x+s,e.y+r)}));for(let e=i.length-1;e>=0;e--){const n=i[e];t.lineTo(null!==(a=n.x1)&&void 0!==a?a:n.x,null!==(o=n.y1)&&void 0!==o?o:n.y)}t.lineTo(null!==(l=d.x1)&&void 0!==l?l:d.x,null!==(h=d.y1)&&void 0!==h?h:d.y),t.closePath()}))}(e.camera?e:e.nativeContext,i,n,{offsetX:a,offsetY:o}),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,s,r),e.setCommonStyle(t,s,a,o,r),e.fill())}};id=ed([y()],id);var nd,sd=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},rd=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},ad=function(t,e){return function(i,n){e(i,n,t)}},od=function(t,e,i,n){return new(i||(i=Promise))((function(s,r){function a(t){try{l(n.next(t))}catch(t){r(t)}}function o(t){try{l(n.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?s(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((n=n.apply(t,e||[])).next())}))};!function(t){t[t.NORMAL=0]="NORMAL",t[t.STOP=1]="STOP"}(nd||(nd={}));let ld=class extends Jh{constructor(t,e,i,n){super(t,n),this.contributions=t,this.lineRender=e,this.areaRender=i,this.drawItemInterceptorContributions=n,this.rendering=!1,this.currFrameStartAt=0,this.currentIdx=0,this.status=nd.NORMAL,this.checkingForDrawPromise=null,this.hooks={completeDraw:new z([])},this.defaultRenderMap.set(this.lineRender.numberType,this.lineRender),this.defaultRenderMap.set(this.areaRender.numberType,this.areaRender)}draw(t,e){return od(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:n,viewBox:s}=e;n&&(n.inuse=!0,n.clearMatrix(),n.setTransformForCurrent(!0),n.save(),e.restartIncremental&&this.clearScreen(this.currentRenderService,n,e),n.translate(s.x1,s.y1,!0),n.save(),t.renderTreeRoots.sort(((t,e)=>{var i,n;return(null!==(i=t.attribute.zIndex)&&void 0!==i?i:sn.zIndex)-(null!==(n=e.attribute.zIndex)&&void 0!==n?n:sn.zIndex)})).forEach((t=>{this.renderGroup(t,e)})),this.hooks.completeDraw.tap("top-draw",(()=>{n.restore(),n.restore(),n.draw(),n.inuse=!1,this.rendering=!1})))}))}_increaseRender(t,e){return od(this,void 0,void 0,(function*(){this.rendering=!0,yield this._renderIncrementalGroup(t,e)}))}_renderIncrementalGroup(t,e){return od(this,void 0,void 0,(function*(){this.count=t.count,yield new Promise((i=>{this.renderItem(t,e,{drawingCb:()=>od(this,void 0,void 0,(function*(){if(2!==t.count)yield Xh(t,sn.zIndex,((i,n)=>{if(this.status===nd.STOP)return!0;if(i.isContainer)return!1;if(n<this.currentIdx)return!1;const s=this.currFrameStartAt+t.incremental;return n<s&&(this.currentIdx=n+1,this.renderItem(i,e)),n===s-1&&(this.currFrameStartAt=this.currentIdx,this.waitToNextFrame())})),i(!1);else{const n=t.getChildAt(0);if(n.incremental&&n.attribute.segments)for(n.incrementalAt||(n.incrementalAt=0);n.incrementalAt<n.attribute.segments.length;)e.multiGraphicOptions={startAtIdx:n.incrementalAt,length:n.incremental},this.renderItem(n,e),n.incrementalAt+=n.incremental,yield this.waitToNextFrame();else this.renderItem(n,e);i(!1)}}))})})),this.hooks.completeDraw.call()}))}waitToNextFrame(){return od(this,void 0,void 0,(function*(){return new Promise((t=>{this.global.getRequestAnimationFrame()((()=>{t(!1)}))}))}))}checkForDraw(t){return od(this,void 0,void 0,(function*(){let e=this.rendering;return t.restartIncremental&&(e=!1,yield this.forceStop(),this.resetToInit()),e}))}forceStop(){return od(this,void 0,void 0,(function*(){this.rendering&&(this.status=nd.STOP,yield new Promise((t=>{this.hooks.completeDraw.tap("stopCb",(()=>{this.status=nd.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 od(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:()=>od(this,void 0,void 0,(function*(){yield Xh(t,sn.zIndex,(t=>od(this,void 0,void 0,(function*(){e.break||t.isContainer&&(yield this.renderGroup(t,e))})))),i(!1)}))})})))}))}};ld=sd([y(),ad(0,b(Jl)),ad(1,m(td)),ad(2,m(id)),ad(3,m(D)),ad(3,x(oh)),rd("design:paramtypes",[Array,Object,Object,Object])],ld);var hd=new a((t=>{t(Qo).toSelf().inSingletonScope(),t(sl).toSelf().inSingletonScope(),t(nh).to(Jh),t(Zl).to(ld),t(Ql).to(ql).inSingletonScope(),t(Jl).toService(Ql),F(t,ho),t(el).toSelf().inSingletonScope(),F(t,go),F(t,Jl),t(uh).toSelf().inSingletonScope(),t(oh).toService(uh),F(t,oh)}));function dd(){dd.__loaded||(dd.__loaded=!0,Pn.load(eo),Pn.load(Eh),Pn.load(xh),Pn.load(Oh),Pn.load(Nh),function(t){t.load(Hh),t.load(zh),t.load(Gh)}(Pn),function(t){t.load(hd)}(Pn))}dd.__loaded=!1,dd();const cd=Pn.get(U);xn.global=cd;const ud=Pn.get(Va);xn.graphicUtil=ud;const pd=Pn.get(Ya);xn.transformUtil=pd;const gd=Pn.get(Ca);xn.graphicService=gd;const fd=Pn.get(Xa);xn.layerService=fd;class vd{constructor(){this.name="AutoRenderPlugin",this.activeEvent="onRegister",this._uid=r.GenAutoIncrementId(),this.key=this.name+this._uid,this.handleChange=t=>{t.glyphHost&&(t=t.glyphHost),t.stage===this.pluginService.stage&&null!=t.stage&&t.stage.renderNextFrame()}}activate(t){this.pluginService=t,xn.graphicService.hooks.onAttributeUpdate.tap(this.key,this.handleChange),xn.graphicService.hooks.onSetStage.tap(this.key,this.handleChange),xn.graphicService.hooks.onRemove.tap(this.key,this.handleChange)}deactivate(t){const e=t=>t.filter((t=>t.name!==this.key));xn.graphicService.hooks.onAttributeUpdate.taps=e(xn.graphicService.hooks.onAttributeUpdate.taps),xn.graphicService.hooks.onSetStage.taps=e(xn.graphicService.hooks.onSetStage.taps),xn.graphicService.hooks.onRemove.taps=e(xn.graphicService.hooks.onRemove.taps)}}class md{constructor(){this.name="AutoRefreshPlugin",this.activeEvent="onRegister",this._uid=r.GenAutoIncrementId(),this.key=this.name+this._uid,this.handleChange=t=>{t.glyphHost&&(t=t.glyphHost),t.stage===this.pluginService.stage&&null!=t.stage&&t.stage.renderNextFrame()}}activate(t){this.pluginService=t,this.dpr=xn.global.devicePixelRatio,this.refresh()}refresh(){this._refreshByMediaQuery()||this._refreshByRaf()}_refreshByRaf(){const t=xn.global.getRequestAnimationFrame();this.rafId=t((()=>{xn.global.devicePixelRatio!==this.dpr&&(this.dpr=xn.global.devicePixelRatio,this.pluginService.stage.setDpr(this.dpr,!0)),this.refresh()}))}_refreshByMediaQuery(){try{const t=`(resolution: ${window.devicePixelRatio}dppx)`,e=()=>{window.devicePixelRatio!==this.dpr&&(this.dpr=window.devicePixelRatio,this.pluginService.stage.setDpr(this.dpr,!0))},i=matchMedia(t);i&&i.addEventListener("change",e),this.autoRefreshCbs||(this.autoRefreshCbs=[]),this.autoRefreshCbs.push((()=>{i&&i.removeEventListener("change",e)}))}catch(t){return!1}return!0}deactivate(t){var e;const i=xn.global.getCancelAnimationFrame();i&&this.rafId&&i(this.rafId),null===(e=this.autoRefreshCbs)||void 0===e||e.forEach((t=>{t()})),this.autoRefreshCbs=void 0}}class bd{constructor(){this.name="IncrementalAutoRenderPlugin",this.activeEvent="onRegister",this.nextFrameRenderGroupSet=new Set,this.willNextFrameRender=!1,this.nextUserParams={},this._uid=r.GenAutoIncrementId(),this.key=this.name+this._uid}activate(t){this.pluginService=t,xn.graphicService.hooks.onAddIncremental.tap(this.key,((e,i,n)=>{e.glyphHost&&(e=e.glyphHost),e.stage===t.stage&&null!=e.stage&&(this.nextUserParams.startAtId=i._uid,this.renderNextFrame(i))})),xn.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){xn.graphicService.hooks.onAddIncremental.taps=xn.graphicService.hooks.onAddIncremental.taps.filter((t=>t.name!==this.key)),xn.graphicService.hooks.onClearIncremental.taps=xn.graphicService.hooks.onClearIncremental.taps.filter((t=>t.name!==this.key))}renderNextFrame(t){this.nextFrameRenderGroupSet.add(t),this.willNextFrameRender||(this.willNextFrameRender=!0,xn.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 n=e.layer.subLayers.get(e._uid);n&&n.drawContribution&&n.drawContribution.draw(t.renderService,Object.assign({stage:t,layer:i,viewBox:t.window.getViewBox(),transMatrix:t.window.getViewBoxTransform(),clear:"transparent",renderService:t.renderService,updateBounds:!1,startAtId:e._uid,context:n.layer.getNativeHandler().getContext()},this.nextUserParams))})),this.nextUserParams={},this.nextFrameRenderGroupSet.clear())}}const yd=new pe;class xd{constructor(){this.name="DirtyBoundsPlugin",this.activeEvent="onRegister",this._uid=r.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()})),xn.graphicService.hooks.beforeUpdateAABBBounds.tap(this.key,((t,e,i,n)=>{t.glyphHost&&(t=t.glyphHost),e&&e===this.pluginService.stage&&e.renderCount&&(t.isContainer&&!t.shouldSelfChangeUpdateAABBBounds()||i&&(yd.setValue(n.x1,n.y1,n.x2,n.y2),e.dirty(yd,t.parent&&t.parent.globalTransMatrix)))})),xn.graphicService.hooks.afterUpdateAABBBounds.tap(this.key,((t,e,i,n,s)=>{e&&e===this.pluginService.stage&&e.renderCount&&(t.isContainer&&!s||e.dirty(n.globalAABBBounds))})),xn.graphicService.hooks.clearAABBBounds.tap(this.key,((t,e,i)=>{e&&e===this.pluginService.stage&&e.renderCount&&e&&e.dirty(i)})),xn.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){xn.graphicService.hooks.beforeUpdateAABBBounds.taps=xn.graphicService.hooks.beforeUpdateAABBBounds.taps.filter((t=>t.name!==this.key)),xn.graphicService.hooks.afterUpdateAABBBounds.taps=xn.graphicService.hooks.afterUpdateAABBBounds.taps.filter((t=>t.name!==this.key)),xn.graphicService.hooks.clearAABBBounds.taps=xn.graphicService.hooks.clearAABBBounds.taps.filter((t=>t.name!==this.key)),t.stage.hooks.afterRender.taps=t.stage.hooks.afterRender.taps.filter((t=>t.name!==this.key)),xn.graphicService.hooks.onRemove.taps=xn.graphicService.hooks.onRemove.taps.filter((t=>t.name!==this.key))}}const _d=new class extends J{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]:[];super(),this.handleTick=(t,e)=>{const{once:i=!1}=null!=e?e:{};this.ifCanStop()?this.stop():(this._handlerTick(),i||t.tick(this.interval,this.handleTick))},this._handlerTick=()=>{const t=this.tickerHandler.getTime();let e=0;this.lastFrameTime>=0&&(e=t-this.lastFrameTime),this.lastFrameTime=t,this.status===vs.RUNNING&&(this.tickCounts++,this.timelines.forEach((t=>{t.tick(e)})),this.emit("tick"))},this.init(),this.lastFrameTime=-1,this.tickCounts=0,this.timelines=t,this.autoStop=!0}init(){this.interval=NaN,this.status=vs.INITIAL,xn.global.hooks.onSetEnv.tap("default-ticker",(()=>{this.initHandler()})),xn.global.env&&this.initHandler()}addTimeline(t){this.timelines.push(t)}remTimeline(t){this.timelines=this.timelines.filter((e=>e!==t))}getTimelines(){return this.timelines}initHandler(){if(this._mode)return null;const t=[{mode:"raf",cons:ms},{mode:"timeout",cons:bs}];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 ms;break;case"timeout":t=new bs;break;default:Ot.getInstance().warn("非法的计时器模式"),t=new ms}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!==vs.INITIAL&&(this.status=vs.PAUSE,!0)}resume(){return this.status!==vs.INITIAL&&(this.status=vs.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===vs.RUNNING)return!1;if(!this.tickerHandler)return!1;if(!t){if(this.status===vs.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=vs.RUNNING,this.tickerHandler.tick(0,this.handleTick),!0}stop(){this.status=vs.INITIAL,this.setupTickHandler(),this.lastFrameTime=-1}release(){this.stop(),this.timelines=[],this.tickerHandler.release(),this.emit("afterTick")}trySyncTickStatus(){this.status===vs.RUNNING&&this._handlerTick()}};let wd;function Td(){!function(){if(null==wd)try{const t=document.createElement("canvas"),e=t.getContext("2d");wd=!!(window&&t.getBoundingClientRect&&requestAnimationFrame&&window.devicePixelRatio&&e&&e.isPointInPath&&e.isPointInStroke),wd&&(wd=!!document.createElement)}catch(t){wd=!1}}();const t=xn.global&&xn.global.env;return t?"browser"===t:wd}_d.addTimeline(ws),_d.setFPS(60);class Sd{static registerPlugin(t,e){Sd._pluginClasses[t]=e}static getPlugin(t){return Sd._pluginClasses[t]}}Sd._pluginClasses={};const kd="white";class Bd extends Ua{set viewBox(t){this.window.setViewBox(t)}get viewBox(){return this.window.getViewBox()}get x(){return this.window.getViewBox().x1}set x(t){const e=this.window.getViewBox();e.translate(t-e.x1,0),this.window.setViewBox(e)}get y(){return this.window.getViewBox().y1}set y(t){const e=this.window.getViewBox();e.translate(0,t-e.y1),this.window.setViewBox(e)}get width(){return this.window.width}set width(t){this.resize(t,this.height)}get viewWidth(){return this.window.getViewBox().width()}set viewWidth(t){this.resizeView(t,this.viewHeight)}get viewHeight(){return this.window.getViewBox().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:kd}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.tickedBeforeRender=!0,this._onVisibleChange=t=>{if(!(this._skipRender<0))if(t){if(this.dirtyBounds){const t=this.window.getViewBox();this.dirtyBounds.setValue(t.x1,t.y1,t.width(),t.height())}this._skipRender>1&&this.renderNextFrame(),this._skipRender=0}else 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.tickedBeforeRender=!1},this.afterTickCb=()=>{var t;this.tickedBeforeRender=!0,"performance"===(null===(t=this.params.optimize)||void 0===t?void 0:t.tickRenderMode)||"rendering"!==this.state&&this.render()},this.params=t,this.theme=new es,this.hooks={beforeRender:new z(["stage"]),afterRender:new z(["stage"])},this.global=xn.global,!this.global.env&&Td()&&this.global.setEnv("browser"),this.window=Pn.get(Wn),this.renderService=Pn.get(bh),this.pluginService=Pn.get(Mh),this.layerService=Pn.get(Xa),this.pluginService.active(this,t),this.window.create({width:t.width,height:t.height,viewBox:t.viewBox,container:t.container,dpr:t.dpr||this.global.devicePixelRatio,canvasControled:!1!==t.canvasControled,title:t.title||"",canvas:t.canvas}),this.state="normal",this.renderCount=0,this.tryInitEventSystem(),this._background=null!==(e=t.background)&&void 0!==e?e:kd,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(),t.autoRefresh&&this.enableAutoRefresh(),!1===t.disableDirtyBounds&&this.enableDirtyBounds(),t.enableHtmlAttribute&&this.enableHtmlAttribute(t.enableHtmlAttribute),t.ReactDOM&&this.enableReactAttribute(t.ReactDOM),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||_d,this.supportInteractiveLayer=!1!==t.interactiveLayer,this.timeline=new _s,this.ticker.addTimeline(this.timeline),this.timeline.pause(),t.optimize||(t.optimize={}),this.optmize(t.optimize),t.background&&lt(this._background)&&this._background.includes("/")&&this.setAttributes({background:this._background}),this.ticker.on("afterTick",this.afterTickCb)}pauseRender(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:-1;this._skipRender=t}resumeRender(){this._skipRender=0}tryInitEventSystem(){this.global.supportEvent&&!this._eventSystem&&(this._eventSystem=new fs(Object.assign({targetElement:this.window,resolution:this.window.dpr||this.global.devicePixelRatio,rootNode:this,global:this.global,supportsPointerEvents:this.params.supportsPointerEvents,supportsTouchEvents:this.params.supportsTouchEvents},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:n=0,beta:s=0,camera:r,fieldRatio:a=1,fieldDepth:o}=t;return Object.assign(Object.assign({},t),{center:e,light:i,alpha:n,beta:s,camera:r,fieldRatio:a,fieldDepth:o})}set3dOptions(t){var e,i,n,s,r,a;this.option3d=t;const o=this.get3dOptions(t),{light:l,center:h,camera:d,alpha:c,beta:u,fieldRatio:p,fieldDepth:g}=o,{dir:f=[1,1,-1],color:v="white",ambient:m}=l,b=(null!==(e=h.x)&&void 0!==e?e:this.width/2)+(null!==(i=h.dx)&&void 0!==i?i:0),y=(null!==(n=h.y)&&void 0!==n?n:this.height/2)+(null!==(s=h.dy)&&void 0!==s?s:0),x=[b,y,(null!==(r=h.z)&&void 0!==r?r:0)+(null!==(a=h.dz)&&void 0!==a?a:0)];let _=0,w=0,T=0;d||(_=Math.sin(c)+b,w=Math.sin(u)+y,T=Math.cos(c)*Math.cos(u)*1);const S=Sd.getPlugin("DirectionalLight");S&&(this.light=new S(f,v,m));const k={left:0,right:this.width,top:0,bottom:this.height,fieldRatio:p,fieldDepth:g,viewParams:{pos:[_,w,T],center:x,up:[0,1,0]}};if(this.camera)this.camera.params=k;else{const t=Sd.getPlugin("OrthoCamera");t&&(this.camera=new t(k))}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(){if(this.view3dTranform)return;this.view3dTranform=!0;const t=Sd.getPlugin("ViewTransform3dPlugin");t&&this.pluginService.register(new t)}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 vd))}disableAutoRender(){this.autoRender&&(this.autoRender=!1,this.pluginService.findPluginsByName("AutoRenderPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableAutoRefresh(){this.autoRefresh||(this.autoRefresh=!0,this.pluginService.register(new md))}disableAutoRefresh(){this.autoRefresh&&(this.autoRefresh=!1,this.pluginService.findPluginsByName("AutoRefreshPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableIncrementalAutoRender(){this.increaseAutoRender||(this.increaseAutoRender=!0,this.pluginService.register(new bd))}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 xd,this.pluginService.register(t))}disableDirtyBounds(){this.dirtyBounds&&(this.dirtyBounds=null,this.pluginService.findPluginsByName("DirtyBoundsPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableLayout(){if(this._enableLayout)return;this._enableLayout=!0;const t=Sd.getPlugin("FlexLayoutPlugin");t&&this.pluginService.register(new t)}disableLayout(){this._enableLayout&&(this._enableLayout=!1,this.pluginService.findPluginsByName("FlexLayoutPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableHtmlAttribute(t){if(this.htmlAttribute)return;const e=Sd.getPlugin("HtmlAttributePlugin");e&&(this.htmlAttribute=t,this.pluginService.register(new e))}disableHtmlAttribute(){this.htmlAttribute&&(this.htmlAttribute=!1,this.pluginService.findPluginsByName("HtmlAttributePlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableReactAttribute(t){if(this.reactAttribute)return;const e=Sd.getPlugin("ReactAttributePlugin");e&&(this.reactAttribute=t,this.pluginService.register(new e))}disableReactAttribute(){this.reactAttribute&&(this.reactAttribute=!1,this.pluginService.findPluginsByName("ReactAttributePlugin").forEach((t=>{this.pluginService.unRegister(t)})))}getPluginsByName(t){return this.pluginService.findPluginsByName(t)}tryUpdateAABBBounds(){const t=this.window.getViewBox();return this._AABBBounds.setValue(t.x1,t.y1,t.x2,t.y2),this._AABBBounds}combineLayer(t,e){throw new Error("暂不支持")}createLayer(t,e){if("released"===this.releaseStatus)return;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(){"released"!==this.releaseStatus&&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(t)}render(t,e){if("released"===this.releaseStatus)return;this.ticker.start(),this.timeline.resume();const i=this.state;this.state="rendering",this.tickedBeforeRender||this.ticker.trySyncTickStatus(),this.layerService.prepareStageLayer(this),this._skipRender||(this.lastRenderparams=e,this.hooks.beforeRender.call(this),this._skipRender||(this.renderLayerList(this.children),this.combineLayersToWindow(),this.nextFrameRenderLayerSet.clear()),this.hooks.afterRender.call(this)),this.state=i,this._skipRender&&this._skipRender++}combineLayersToWindow(){if("harmony"===this.global.env){const t=this.window.getContext().nativeContext;this.forEachChildren(((e,i)=>{if(i>0){const i=e.getNativeHandler().getContext().canvas.nativeCanvas.nativeCanvas._c.transferToImageBitmap();t.transferFromImageBitmap(i)}}))}}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(){if("released"===this.releaseStatus)return;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._skipRender||(this.renderLayerList(Array.from(this.nextFrameRenderLayerSet.values()),this.lastRenderparams||{}),this.combineLayersToWindow(),this.nextFrameRenderLayerSet.clear()),this.hooks.afterRender.call(this)),this.state=t,this._skipRender&&this._skipRender++}renderLayerList(t,e){const i=[];for(let e=0;e<t.length;e++){let n=t[e];"virtual"===n.layerMode&&(n=n.getNativeHandler().mainHandler.layer),i.includes(n)||i.push(n)}i.forEach((t=>{t.renderCount>this.renderCount||(t.renderCount=this.renderCount+1,t===this.interactiveLayer&&this.dirtyBounds&&this.dirtyBounds.clear(),t.render({renderService:this.renderService,background:t===this.defaultLayer?this.background:void 0,updateBounds:!(!this.dirtyBounds||this.dirtyBounds.empty()),viewBox:this.window.getViewBox(),transMatrix:this.window.getViewBoxTransform()},Object.assign({renderStyle:this.renderStyle},e)))})),this.interactiveLayer&&!t.includes(this.interactiveLayer)&&(this.dirtyBounds&&this.dirtyBounds.clear(),this.interactiveLayer.render({renderService:this.renderService,updateBounds:!(!this.dirtyBounds||this.dirtyBounds.empty()),viewBox:this.window.getViewBox(),transMatrix:this.window.getViewBoxTransform()},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];"released"!==this.releaseStatus&&(this.window.hasSubView()||this.viewBox.setValue(this.viewBox.x1,this.viewBox.y1,this.viewBox.x1+t,this.viewBox.y1+e),this.window.resize(t,e),this.forEachChildren((i=>{i.resize(t,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];"released"!==this.releaseStatus&&(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,n,s){let r=!0;"object"==typeof t?(this.viewBox.setValue(t.x1,t.y1,t.x2,t.y2),!1===e&&(r=!1)):(this.viewBox.setValue(t,e,t+i,e+n),!1===s&&(r=!1)),this.forEachChildren((t=>{t.resizeView(this.viewBox.width(),this.viewBox.height())})),r&&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){if("released"===this.releaseStatus)return;const i=this.getPickerService().pick(this.children,new qt(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.hooks.beforeRender.unTap("constructor",this.beforeRender),this.hooks.afterRender.unTap("constructor",this.afterRender),this.eventSystem&&this.eventSystem.release(),this.layerService.releaseStage(this),this.pluginService.release(),this.forEach((t=>{t.release()})),this.interactiveLayer&&(this.interactiveLayer.forEachChildren((t=>{t.setStage&&t.setStage(null,null),this.interactiveLayer.removeChild(t)})),this.interactiveLayer.release()),this.window.release(),this.ticker.remTimeline(this.timeline),this.ticker.removeListener("afterTick",this.afterTickCb),this.renderService.renderTreeRoots=[]}setStage(t){}dirty(t,e){"released"!==this.releaseStatus&&(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){"released"!==this.releaseStatus&&this.forEachChildren(((e,i)=>{e.drawTo(t,{renderService:this.renderService,viewBox:t.getViewBox(),transMatrix:t.getViewBoxTransform(),background:e===this.defaultLayer?this.background:void 0,clear:0===i,updateBounds:!(!this.dirtyBounds||this.dirtyBounds.empty())})}))}renderToNewWindow(){let t=arguments.length>1?arguments[1]:void 0;if("released"===this.releaseStatus)return;const e=Pn.get(Wn),i=t?-t.x1:0,n=t?-t.y1:0,s=t?t.x2:this.viewWidth,r=t?t.y2:this.viewHeight,a=t?t.width():this.viewWidth,o=t?t.height():this.viewHeight;return e.create({viewBox:{x1:i,y1:n,x2:s,y2:r},width:a,height:o,dpr:this.window.dpr,canvasControled:!0,offscreen:!0,title:""}),this.renderTo(e),e}toCanvas(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],e=arguments.length>1?arguments[1]:void 0;if("released"===this.releaseStatus)return;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}eventPointTransform(t){const e=this.global.mapToCanvasPoint(t,this.window.getContext().canvas.nativeCanvas);return this.stage.window.pointTransform(e.x,e.y)}pauseTriggerEvent(){this._eventSystem&&this._eventSystem.pauseTriggerEvent()}resumeTriggerEvent(){this._eventSystem&&this._eventSystem.resumeTriggerEvent()}getPickerService(){return this.pickerService||(this.pickerService=Pn.get(_h)),this.pickerService}reInit(){this.renderService.reInit(),this.pickerService.reInit()}}function Ad(t,e,i,n){return t=>{if(!(t instanceof MouseEvent||t instanceof TouchEvent||t instanceof PointerEvent))return t;const s=e();if(1===(r=s).a&&0===r.b&&0===r.c&&1===r.d&&0===r.e&&0===r.f)return t;var r;const a=i(),o=new t.constructor(t.type,t);if(Object.defineProperties(o,{target:{value:t.target},currentTarget:{value:t.currentTarget}}),t instanceof MouseEvent||t instanceof PointerEvent)n(t.clientX,t.clientY,s,a,o);else if(t instanceof TouchEvent){if(t.touches.length>0){const t=o.touches[0];n(t.clientX,t.clientY,s,a,t)}if(t.changedTouches.length>0){const t=o.changedTouches[0];n(t.clientX,t.clientY,s,a,t)}}return o}}function Cd(t,e,i,n,s){const r=Ad(0,i,n,s);t.setEventListenerTransformer(r)}function Ld(t,e,i,n,s){const r=Ad(0,i,n,s);t.setEventListenerTransformer(r)}function Od(t,e,i,n,s){const r={x:t,y:e};i.transformPoint(r,r),Object.defineProperties(s,{_canvasX:{value:r.x},_canvasY:{value:r.y}})}function Ed(t){var e;if(Fn(t._canvasX)&&Fn(t._canvasY))return{x:t._canvasX,y:t._canvasY};if(t.changedTouches){const i=null!==(e=t.changedTouches[0])&&void 0!==e?e:{};return{x:i._canvasX,y:i._canvasY}}return{x:t._canvasX||0,y:t._canvasY||0}}let Rd=!1;const Md=new a((t=>{Rd||(Rd=!0,t(Il).toSelf().inSingletonScope(),t(th).to(Il).inSingletonScope(),t(Jl).toService(th),t(cl).toSelf(),t(dl).toSelf(),t(co).toService(cl),t(co).toService(dl),t(co).toService(el),F(t,co))}));let Pd=!1;const Dd=new a((t=>{Pd||(Pd=!0,t(zl).toSelf().inSingletonScope(),t(eh).to(zl).inSingletonScope(),t(Jl).toService(eh),t(uo).toService(el),F(t,uo))}));let Id=!1;const Fd=new a((t=>{Id||(Id=!0,t(ih).to(Vl).inSingletonScope(),t(Jl).toService(ih),t(po).toService(el),F(t,po))}));const Nd=["x","y","dx","dy","scaleX","scaleY","angle","anchor","postMatrix","visible","clip","pickable","childrenPickable","zIndex","cursor"];class Hd extends Ua{constructor(t,e){super(t),this._skipRenderAttributes=Nd,(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,n){const s=this.onBeforeAttributeUpdate&&this.onBeforeAttributeUpdate({[t]:e},this.attribute,t,n);if(s)return this._setAttributes(s,i);at(this.attribute[t])&&at(e)&&!et(this.attribute[t])&&!et(e)?kt(this.attribute[t],e):this.attribute[t]=e,this._skipRenderAttributes.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,i){return t=this.onBeforeAttributeUpdate&&this.onBeforeAttributeUpdate(t,this.attribute,null,i)||t,this._setAttributes(t,e)}_setAttributes(t,e){const i=Object.keys(t);this._mergeAttributes(t,i),i.every((t=>this._skipRenderAttributes.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){it(e)&&(e=Object.keys(t));for(let i=0;i<e.length;i++){const n=e[i];!at(this.attribute[n])||et(this.attribute[n])||et(t[n])?this.attribute[n]=t[n]:kt(this.attribute[n],t[n])}}bindEvents(){}_getNodeId(t){var e;return`${null!==(e=this.id)&&void 0!==e?e:this._uid}-${this.name}-${t}`}_dispatchEvent(t,e){var i;const n=new ds(t,e);n.manager=null===(i=this.stage)||void 0===i?void 0:i.eventSystem.manager,this.dispatchEvent(n)}}const zd=Symbol.for("MathPickerContribution"),Wd=Symbol.for("MathRectPicker"),Ud=Symbol.for("MathSymbolPicker"),jd=Symbol.for("MathTextPicker"),Gd=Symbol.for("CanvasRectPicker"),Yd=Symbol.for("CanvasSymbolPicker"),Vd=Symbol.for("CanvasTextPicker"),Xd=Symbol.for("CanvasPickerContribution");class Kd{contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;if(!this.canvasRenderer)return!0;const{pickContext:n}=null!=i?i:{};if(!n)return!1;const s=t.getGraphicTheme();n.highPerformanceSave();let{x:r=s.x,y:a=s.y}=t.attribute;if(t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(s);r+=e.x,a+=e.y,n.setTransformForCurrent()}else r=0,a=0,n.transformFromMatrix(t.transMatrix,!0);let o=!1,l=!1;return this.canvasRenderer.drawShape(t,n,r,a,{},null,((t,i,n,s)=>!(!o&&!l)||(o=t.isPointInPath(e.x,e.y),l=s||l,o)),((t,i,s,r)=>{if(o||l)return!0;const a=i.lineWidth||s.lineWidth,h=i.pickStrokeBuffer||s.pickStrokeBuffer,d=i.keepStrokeScale||s.keepStrokeScale;return n.lineWidth=d?a+h:Tn(n,a+h,n.dpr),o=t.isPointInStroke(e.x,e.y),l=r||l,o})),n.highPerformanceRestore(),o}}const $d=new pe;class qd{constructor(){this.type="rect",this.numberType=ka}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:n}=null!=i?i:{};if(!n)return!1;const s=t.getGraphicTheme(),{cornerRadius:r=s.cornerRadius}=t.attribute;let{x:a=s.x,y:o=s.y}=t.attribute;n.highPerformanceSave();let l=!0;if(t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(s);a+=e.x,o+=e.y,n.setTransformForCurrent()}else a=0,o=0,l=!1,n.transformFromMatrix(t.transMatrix,!0);let h=!0;if(!l||t.shadowRoot||ct(r,!0)&&0!==r||ht(r)&&r.some((t=>0!==t)))h=!1,this.canvasRenderer.drawShape(t,n,a,o,{},null,((t,i,n)=>!!h||(h=t.isPointInPath(e.x,e.y),h)),((t,i,s)=>{if(h)return!0;const r=i.lineWidth||s.lineWidth,a=i.pickStrokeBuffer||s.pickStrokeBuffer,o=i.keepStrokeScale||s.keepStrokeScale;return n.lineWidth=o?r+a:Tn(n,r+a,n.dpr),h=t.isPointInStroke(e.x,e.y),h}));else{const{fill:i=s.fill,stroke:n=s.stroke,lineWidth:r=s.lineWidth}=t.attribute;if(i)h=!0;else if(n){const i=t.AABBBounds;$d.setValue(i.x1,i.y1,i.x2,i.y2),$d.expand(-r/2),h=!$d.containsPoint(e)}}return n.highPerformanceRestore(),h}}var Zd=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Jd=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Qd=function(t,e){return function(i,n){e(i,n,t)}};let tc=class extends qd{constructor(t){super(),this.canvasRenderer=t}};tc=Zd([y(),Qd(0,m(th)),Jd("design:paramtypes",[Object])],tc);let ec=!1;const ic=new a(((t,e,i,n)=>{ec||(ec=!0,t(Wd).to(tc).inSingletonScope(),t(zd).toService(Wd))}));var nc=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},sc=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},rc=function(t,e){return function(i,n){e(i,n,t)}};let ac=class extends Kd{constructor(t){super(),this.canvasRenderer=t,this.type="symbol",this.numberType=Ba}};ac=nc([y(),rc(0,m(eh)),sc("design:paramtypes",[Object])],ac);let oc=!1;const lc=new a(((t,e,i,n)=>{oc||(oc=!0,t(Ud).to(ac).inSingletonScope(),t(zd).toService(Ud))}));var hc=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let dc=class{constructor(){this.type="text",this.numberType=Aa}contains(t,e,i){return!!t.AABBBounds.containsPoint(e)}};dc=hc([y()],dc);let cc=!1;const uc=new a(((t,e,i,n)=>{cc||(cc=!0,t(jd).to(dc).inSingletonScope(),t(zd).toService(jd))}));var pc=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},gc=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},fc=function(t,e){return function(i,n){e(i,n,t)}};let vc=class extends qd{constructor(t){super(),this.canvasRenderer=t}};vc=pc([y(),fc(0,m(th)),gc("design:paramtypes",[Object])],vc);let mc=!1;const bc=new a(((t,e,i,n)=>{mc||(mc=!0,t(Gd).to(vc).inSingletonScope(),t(Xd).toService(Gd))}));class yc extends xl{contains(t,e,i){const{pickContext:n}=null!=i?i:{};if(!n)return!1;const s=t.getGraphicTheme();n.highPerformanceSave();const r=this.transform(t,s,n),{x:a,y:o,z:l,lastModelMatrix:h}=r;let d=e;if(n.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=l;let c=!1;return this.canvasRenderer.drawShape(t,n,a,o,i,null,((t,e,i)=>!!c||(c=t.isPointInPath(d.x,d.y),c))),this.canvasRenderer.z=0,n.modelMatrix!==h&&wo.free(n.modelMatrix),n.modelMatrix=h,n.highPerformanceRestore(),c}}var xc=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},_c=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},wc=function(t,e){return function(i,n){e(i,n,t)}};let Tc=class extends yc{constructor(t){super(),this.canvasRenderer=t,this.type="symbol",this.numberType=Ba}contains(t,e,i){const{pickContext:n}=null!=i?i:{};if(!n)return!1;const s=t.getParsedPath();if(!n.camera){if(!t.AABBBounds.containsPoint(e))return!1;if(s.isSvg||"imprecise"===t.attribute.pickMode)return!0}n.highPerformanceSave();const r=t.getGraphicTheme(),a=this.transform(t,r,n),{x:o,y:l,z:h,lastModelMatrix:d}=a;let c=e;if(n.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=h;let u=!1;return this.canvasRenderer.drawShape(t,n,o,l,{},null,((t,e,i)=>!!u||(u=t.isPointInPath(c.x,c.y),u)),((t,e,i)=>{if(u)return!0;const s=e.lineWidth||i.lineWidth,r=e.pickStrokeBuffer||i.pickStrokeBuffer,a=e.keepStrokeScale||i.keepStrokeScale;return n.lineWidth=a?s+r:Tn(n,s+r,n.dpr),u=t.isPointInStroke(c.x,c.y),u})),this.canvasRenderer.z=0,n.modelMatrix!==d&&wo.free(n.modelMatrix),n.modelMatrix=d,n.highPerformanceRestore(),u}};Tc=xc([y(),wc(0,m(eh)),_c("design:paramtypes",[Object])],Tc);let Sc=!1;const kc=new a(((t,e,i,n)=>{Sc||(Sc=!0,t(Yd).to(Tc).inSingletonScope(),t(Xd).toService(Yd))}));var Bc=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Ac=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Cc=function(t,e){return function(i,n){e(i,n,t)}};let Lc=class extends yc{constructor(t){super(),this.canvasRenderer=t,this.type="text",this.numberType=Aa}contains(t,e,i){const{pickContext:n}=null!=i?i:{};if(!n)return!1;const s=t.AABBBounds;if(!n.camera)return!!s.containsPoint(e);n.highPerformanceSave();const r=t.getGraphicTheme(),{keepDirIn3d:a=r.keepDirIn3d}=t.attribute,o=!a,l=this.transform(t,r,n,o),{x:h,y:d,z:c,lastModelMatrix:u}=l;this.canvasRenderer.z=c;let p=e;if(n.camera){p=e.clone();const i=t.parent.globalTransMatrix;p.x=i.a*e.x+i.c*e.y+i.e,p.y=i.b*e.x+i.d*e.y+i.f}let g=!1;return this.canvasRenderer.drawShape(t,n,h,d,{},null,((e,i,n)=>{if(g)return!0;const{fontSize:s=r.fontSize,textBaseline:a=r.textBaseline,textAlign:o=r.textAlign}=t.attribute,l=t.AABBBounds,u=l.height(),f=l.width(),v=vo(a,u,s),m=fo(o,f);return e.rect(m+h,v+d,f,u,c),g=e.isPointInPath(p.x,p.y),g}),((t,e,i)=>g)),this.canvasRenderer.z=0,n.modelMatrix!==u&&wo.free(n.modelMatrix),n.modelMatrix=u,n.highPerformanceRestore(),g}};Lc=Bc([y(),Cc(0,m(ih)),Ac("design:paramtypes",[Object])],Lc);let Oc=!1;const Ec=new a(((t,e,i,n)=>{Oc||(Oc=!0,t(Vd).to(Lc).inSingletonScope(),t(Xd).toService(Vd))})),Rc=Td();function Mc(){Mc.__loaded||(Mc.__loaded=!0,Ko.RegisterGraphicCreator("group",ja))}Mc.__loaded=!1;const Pc=Mc;function Dc(){Dc.__loaded||(Dc.__loaded=!0,Ko.RegisterGraphicCreator("rect",jo),Pn.load(Md),Pn.load(Rc?bc:ic))}Dc.__loaded=!1;const Ic=Dc;function Fc(){Fc.__loaded||(Fc.__loaded=!0,Ko.RegisterGraphicCreator("symbol",Fo),Pn.load(Dd),Pn.load(Rc?kc:lc))}Fc.__loaded=!1;const Nc=Fc;function Hc(){Hc.__loaded||(Hc.__loaded=!0,Ko.RegisterGraphicCreator("text",Po),Pn.load(Fd),Pn.load(Rc?Ec:uc))}Hc.__loaded=!1;const zc=Hc;var Wc;!function(t){t.selected="selected",t.selectedReverse="selected_reverse",t.hover="hover",t.hoverReverse="hover_reverse"}(Wc||(Wc={})),Wc.selectedReverse,Wc.selected,Wc.hover,Wc.hoverReverse;function Uc(){return"browser"===cd.env?["pointerup","pointerleave","pointercancel"]:["pointerup","pointerleave","pointerupoutside"]}const jc={debounce:Dt,throttle:function(t,e,i){let n=!0,s=!0;if("function"!=typeof t)throw new TypeError("Expected a function");return st(i)&&(n="leading"in i?!!i.leading:n,s="trailing"in i?!!i.trailing:s),Dt(t,e,{leading:n,trailing:s,maxWait:e})}};Pc(),Ic();class Gc extends Hd{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:kt({},Gc.defaultAttributes,t)),this.name="scrollbar",this._handleTouchMove=t=>{nt(this._prePos)&&t.preventDefault()},this._onRailPointerDown=t=>{const{viewX:e,viewY:i}=t,{direction:n,width:s,height:r,range:a}=this.attribute,o=this._sliderSize,[l,h]=this._getScrollRange();let d;if("vertical"===n){const t=i-this._viewPosition.y,e=Rt(t-o/2,l,h);d=t/r,this._slider.setAttribute("y",e,!0)}else{const t=e-this._viewPosition.x,i=Rt(t-o/2,l,h);d=t/s,this._slider.setAttribute("x",i,!0)}this.setScrollRange([d-(a[1]-a[0])/2,d+(a[1]-a[0])/2],!1),this.stage&&!this.stage.autoRender&&this.stage.renderNextFrame()},this._onSliderPointerDown=t=>{this._clearDragEvents();const{stopSliderDownPropagation:e=!0}=this.attribute;e&&t.stopPropagation();const{direction:i}=this.attribute,{x:n,y:s}=this.stage.eventPointTransform(t);this._prePos="horizontal"===i?n:s,this._dispatchEvent("scrollDown",{pos:this._prePos,event:t});const r=Uc(),a="browser"===cd.env?cd:this.stage;a.addEventListener("pointermove",this._onSliderPointerMoveWithDelay,{capture:!0}),r.forEach((t=>{a.addEventListener(t,this._onSliderPointerUp)}))},this._computeScrollValue=t=>{const{direction:e}=this.attribute,{x:i,y:n}=this.stage.eventPointTransform(t);let s,r,a=0;const{width:o,height:l}=this.getSliderRenderBounds();return"vertical"===e?(r=n,a=r-this._prePos,s=a/l):(r=i,a=r-this._prePos,s=a/o),[r,s]},this._onSliderPointerMove=t=>{const{stopSliderMovePropagation:e=!0}=this.attribute;e&&t.stopPropagation();const i=this.getScrollRange(),[n,s]=this._computeScrollValue(t);this.setScrollRange([i[0]+s,i[1]+s],!0),this._prePos=n},this._onSliderPointerMoveWithDelay=0===this.attribute.delayTime?this._onSliderPointerMove:jc[this.attribute.delayType](this._onSliderPointerMove,this.attribute.delayTime),this._onSliderPointerUp=t=>{const{range:e,limitRange:i=[0,1]}=this.attribute,n=this.getScrollRange(),[s,r]=this._computeScrollValue(t),a=[n[0]+r,n[1]+r];this._prePos=null,this._dispatchEvent("scrollUp",{pre:e,value:Mt(a,i[0],i[1])}),this._clearDragEvents()}}setScrollRange(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];const{direction:i="horizontal",limitRange:n=[0,1],range:s,realTime:r=!0}=this.attribute,a=Mt(t,n[0],n[1]);if(e){const t=this._getSliderPos(a);if(this._slider){const e=t[1]-t[0];this._sliderSize=e,"horizontal"===i?this._slider.setAttributes({x:t[0],width:e},!0):this._slider.setAttributes({y:t[0],height:e},!0),this.stage&&!this.stage.autoRender&&this.stage.renderNextFrame()}}this.attribute.range=a,r&&this._dispatchEvent("scrollDrag",{pre:s,value:a})}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",jc[t](this._onRailPointerDown,e)),this._slider&&this._slider.addEventListener("pointerdown",this._onSliderPointerDown),("browser"===cd.env?cd:this.stage).addEventListener("touchmove",this._handleTouchMove,{passive:!1})}render(){this._reset();const{direction:t="horizontal",width:e,height:i,range:n,limitRange:s=[0,1],railStyle:r,sliderStyle:a,padding:o=2}=this.attribute,l=this.createOrUpdateChild("scrollbar-container",{},"group"),h=l.createOrUpdateChild("scrollbar-rail",Object.assign({x:0,y:0,width:e,height:i},r),"rect");this._rail=h;const d=this.getSliderRenderBounds(),c=this._getSliderPos(Mt(n,s[0],s[1])),u=c[1]-c[0];let p;this._sliderSize=u,p="horizontal"===t?{x:c[0],y:d.y1,width:u,height:d.height}:{x:d.x1,y:c[0],width:d.width,height:u};const g=l.createOrUpdateChild("slider",Object.assign(Object.assign(Object.assign(Object.assign({},p),{cornerRadius:this._getDefaultSliderCornerRadius()}),a),{boundsPadding:Ce(o),pickMode:"imprecise"}),"rect");this._slider=g,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,[n,s,r,a]=Ce(i),o={x1:a,y1:n,x2:t-s,y2:e-r,width:Math.max(0,t-(a+s)),height:Math.max(0,e-(n+r))};return this._sliderRenderBounds=o,o}_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:n,x1:s,y1:r}=this.getSliderRenderBounds();return"horizontal"===e?[i*t[0]+s,i*t[1]+s]:[n*t[0]+r,n*t[1]+r]}_getScrollRange(){if(this._sliderLimitRange)return this._sliderLimitRange;const{limitRange:t=[0,1],direction:e}=this.attribute,[i,n]=Mt(t,0,1),{width:s,height:r,x1:a,y1:o}=this.getSliderRenderBounds(),l=this._sliderSize;return"horizontal"===e?Mt([a+i*s,a+n*s],a,s-l):Mt([o+i*r,o+n*r],o,r-l)}_clearDragEvents(){const t=Uc(),e="browser"===cd.env?cd:this.stage;e.removeEventListener("pointermove",this._onSliderPointerMoveWithDelay,{capture:!0}),t.forEach((t=>{e.removeEventListener(t,this._onSliderPointerUp)}))}_reset(){this._sliderRenderBounds=null,this._sliderLimitRange=null}release(t){super.release(t),("browser"===cd.env?cd:this.stage).addEventListener("touchmove",this._handleTouchMove,{passive:!1}),this._clearDragEvents()}}Gc.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};var Yc=function(t,e){var i={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(i[n]=t[n]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var s=0;for(n=Object.getOwnPropertySymbols(t);s<n.length;s++)e.indexOf(n[s])<0&&Object.prototype.propertyIsEnumerable.call(t,n[s])&&(i[n[s]]=t[n[s]])}return i};const Vc=new pe;Pc(),zc(),Nc(),Ic();const Xc="M -0.5 -0.5, L -0.5 0.5, L 0.5 -0.5, Z",Kc="M -0.5 -0.5, L -0.5 0.5, L 0.5 0.5, Z",$c="M -0.5 -0.5, L 0.5 -0.5, L 0.5 0.5, Z",qc="M 0.5 -0.5, L 0.5 0.5, L -0.5 0.5, Z",Zc={tl:Xc,tr:$c,bl:Kc,br:qc,lt:Xc,lb:Kc,rt:$c,rb:qc};class Jc extends Hd{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:kt({},Jc.defaultAttributes,t)),this.name="poptip",this.positionList=["top","tl","tr","bottom","bl","br","left","lt","lb","right","rt","rb"]}render(){var t,e,i,n,s,r,a,o,l;const{titleStyle:h={},position:d,contentStyle:c={},panel:u,logoSymbol:p,poptipAnchor:g="position",logoText:f,logoTextStyle:v={},triangleMode:m="default",space:b=4,minWidth:y=0,maxWidth:x=1/0,padding:_=4,maxWidthPercent:w,visible:T,state:S,dx:k=0,dy:B=0,positionBounds:A}=this.attribute;let{title:C="",content:L=""}=this.attribute;C=this.attribute.titleFormatMethod?this.attribute.titleFormatMethod(C):C,L=this.attribute.contentFormatMethod?this.attribute.contentFormatMethod(L):L;const O=Ce(_),E=this.createOrUpdateChild("poptip-content",{x:0,y:0,zIndex:1},"group");this.group=E;const R=x-O[1]-O[3],M=nt(C)&&!1!==T,P=Object.assign(Object.assign({text:ht(C)?C:[C],visible:M,wrap:!0},h),{x:O[3],y:O[0],maxLineWidth:R,textAlign:"left",textBaseline:"top"}),D=E.createOrUpdateChild("poptip-title",P,"text");yt(null==S?void 0:S.title)||(D.states=S.title);const I=D.AABBBounds,F=I.height(),N=I.width();let H=F+b;M||(H=0);const z=nt(L)&&!1!==T,W=Object.assign(Object.assign({text:ht(L)?L:[L],visible:z,wrap:!0},c),{x:O[3],y:O[0]+H,maxLineWidth:R,textAlign:"left",textBaseline:"top"}),U=E.createOrUpdateChild("poptip-content",W,"text");yt(null==S?void 0:S.content)||(U.states=S.content);const j=U.AABBBounds,G=j.height(),Y=j.width();z&&(H+=G),this.titleShape=D,this.contentShape=U;let V=Gt(N+O[1]+O[3],Y+O[1]+O[3]);V>x?V=x:V<y&&(V=y);let X=O[0]+O[2]+H;const{visible:K,square:$}=u,q=Yc(u,["visible","square"]);if($){const t=Gt(V,X);V=t;const e=t-X;X=t,D.setAttributes({dy:e/2}),U.setAttributes({dy:e/2})}const Z=null!==(t=q.size)&&void 0!==t?t:12,J=ht(Z)?[Z[0]+(null!==(e=q.space)&&void 0!==e?e:0),Z[1]+(null!==(i=q.space)&&void 0!==i?i:0)]:Z+(null!==(n=q.space)&&void 0!==n?n:0),Q=null!==(s=q.lineWidth)&&void 0!==s?s:1,et=this.stage?[null!==(r=this.stage.viewWidth)&&void 0!==r?r:this.stage.width,null!==(a=this.stage.viewHeight)&&void 0!==a?a:this.stage.height]:void 0;if(et){const t=this.AABBBounds,e=null!==(o=this.attribute.x)&&void 0!==o?o:t.x1,i=et[0]-t.x1;let n=Math.max(e,i);const s=(ht(Z)?Z[0]:12)+3;if(n=Math.min(n-s,n*w),n<V){V=n;const t=O[1]+O[3];D.setAttribute("maxLineWidth",n-t),U.setAttribute("maxLineWidth",n-t),X=O[0]+O[2],M&&(X+=D.AABBBounds.height()+b),X+=U.AABBBounds.height()}}const it="auto"===d||ht(d),st=ht(d)?d:this.positionList;let rt,at=-1/0;for(let t=0;t<st.length+1;t++){const e=it?st[t===st.length?rt:t]:d;let i="arrow2Left",n=(ht(Z)?Z[0]:Z)/4,s=0;"top"===e||"bottom"===e||"left"===e||"right"===e?i="arrow2Left":"concise"===m&&(i=Zc[e],n=["tl","bl","rt","rb"].includes(e)?(ht(Z)?Z[0]:Z)/2:-(ht(Z)?Z[0]:Z)/2,s=["tl","tr","lb","rb"].includes(e)?-(ht(Z)?Z[1]:Z)/2:(ht(Z)?Z[1]:Z)/2);const{angle:r,offset:a}=this.getAngleAndOffset(e,V,X,ht(J)?J:[J,J-Q],i);let o,h={x:0,y:0};if("bounds"===g&&A&&(h=this.calculateAnchorPoint(e,A)),tt(K)){let t;o=E.createOrUpdateChild("poptip-symbol-panel",Object.assign(Object.assign({},q),{visible:K&&(z||M),x:n,y:s,strokeBoundsBuffer:-1,boundsPadding:-2,anchor:[0,0],symbolType:i,angle:r,dx:a[0],dy:a[1]-(null!==(l=q.space)&&void 0!==l?l:0),size:Z,zIndex:9}),"symbol"),yt(null==S?void 0:S.panel)||(o.states=S.panel),t=u.panelSymbolType?E.createOrUpdateChild("poptip-rect-panel",Object.assign(Object.assign({},q),{visible:K&&(z||M),x:0,y:0,symbolType:"rect",size:[V,X],zIndex:-8}),"symbol"):E.createOrUpdateChild("poptip-rect-panel",Object.assign(Object.assign({},q),{visible:K&&(z||M),x:0,y:0,width:V,height:X,zIndex:-8}),"rect"),yt(null==S?void 0:S.panel)||(t.states=S.panel)}if(E.setAttributes({x:-a[0]+k+h.x,y:-a[1]+B+h.y,anchor:[n,s]}),p){const{size:t=12}=p,e=ht(t)?t:[t,t];"auto"===e[1]&&(e[1]=X),"auto"===e[0]&&(e[0]=X);const i=e[0];E.createOrUpdateChild("poptip-logo",Object.assign(Object.assign({},p),{x:0,y:X/2,visible:K&&(z||M),zIndex:10,size:e}),"symbol"),E.setAttributes({x:-a[0]+k+i/2,y:-a[1]+B}),f&&E.createOrUpdateChild("poptip-logo-text",Object.assign(Object.assign({},v),{x:0,y:X/2,visible:K&&(z||M),text:f,textAlign:"center",textBaseline:"middle",zIndex:10}),"text")}if(!et)break;{Vc.setValue(0,0,V,X).transformWithMatrix(E.globalTransMatrix);const i=Vc,n=(new ue).setValue(0,0,et[0],et[1]);if(it){if(ie(i,n,!1))break;{const e=Qt(i,n,!1),s=(e.x2-e.x1)*(e.y2-e.y1);s>at&&(at=s,rt=t)}}if(["top","bottom","left","right"].includes(e)){const t="top"===e||"bottom"===e,s="left"===e||"right"===e;let r=!1;if(t?r="top"===e&&i.y1<0||"bottom"===e&&i.y2>n.y2:s&&(r="left"===e&&i.x1<0||"right"===e&&i.x2>n.x2),!r){let e=0;const r=(ht(Z)?Z[1]:Z)/2;t?(i.x1<0?e=-i.x1:i.x2>n.x2&&(e=n.x2-i.x2),E.setAttribute("x",E.attribute.x+e),o.setAttribute("dx",Yt(Gt(o.attribute.dx-e,r),i.width()-r))):s&&(i.y1<0?e=-i.y1:i.y2>n.y2&&(e=n.y2-i.y2),E.setAttribute("y",E.attribute.y+e),o.setAttribute("dy",Yt(Gt(o.attribute.dy-e,r),i.height()-r)));break}}if(!it)break}}}calculateAnchorPoint(t,e){if(!e)return{x:0,y:0};const{x:i,y:n}=this.attribute,{x1:s,y1:r,x2:a,y2:o}=e,l=a-s,h=o-r;switch(t){case"top":case"tl":case"tr":return{x:s+l/2-i,y:r-n};case"bottom":case"bl":case"br":return{x:s+l/2-i,y:o-n};case"left":case"lt":case"lb":return{x:s-i,y:r+h/2-n};case"right":case"rt":case"rb":return{x:a-i,y:r+h/2-n};default:return{x:0,y:0}}}getAngleAndOffset(t,e,i,n,s){const r="arrow2Left"===s?n[1]/2:n[1];switch(t){case"tl":return{angle:"arrow2Left"===s?Ft/2*3:0,offset:"arrow2Left"===s?[e/4,i+r]:[0,i+r]};case"top":return{angle:Ft/2*3,offset:[e/2,i+r]};case"tr":return{angle:"arrow2Left"===s?Ft/2*3:0,offset:"arrow2Left"===s?[e/4*3,i+r]:[e,i+r]};case"rt":return{angle:0,offset:"arrow2Left"===s?[-r,i/5]:[-r,0]};case"right":return{angle:0,offset:[-r,i/2]};case"rb":return{angle:0,offset:"arrow2Left"===s?[-r,i/5*4]:[-r,i]};case"bl":return{angle:"arrow2Left"===s?Ft/2:0,offset:"arrow2Left"===s?[e/4,-r]:[0,-r]};case"bottom":return{angle:Ft/2,offset:[e/2,-r]};case"br":return{angle:"arrow2Left"===s?Ft/2:0,offset:"arrow2Left"===s?[e/4*3,-r]:[e,-r]};case"lt":return{angle:"arrow2Left"===s?Ft:0,offset:"arrow2Left"===s?[e+r,i/5]:[e+r,0]};case"left":return{angle:Ft,offset:[e+r,i/2]};case"lb":return{angle:"arrow2Left"===s?Ft:0,offset:"arrow2Left"===s?[e+r,i/5*4]:[e+r,i]}}}appearAnimate(t){const{duration:e=1e3,easing:i="quadOut"}=t;if(this.setAttributes({scaleX:0,scaleY:0}),this.animate().to({scaleX:1,scaleY:1},e/3*2,i),this.titleShape&&this.titleShape.animate().play(new Hs({text:""},{text:this.titleShape.attribute.text},e,i)),this.contentShape&&this.contentShape.animate().play(new Hs({text:""},{text:this.contentShape.attribute.text},e,i)),t.wave){const n=e/6;this.group.animate().to({angle:t.wave},n,i).to({angle:-t.wave},2*n,i).to({angle:t.wave},2*n,i).to({angle:0},n,i)}}disappearAnimate(t){const{duration:e=1e3,easing:i="quadOut"}=t;this.animate().to({scaleX:0,scaleY:0},e,i)}}function Qc(t,e){var i,n,s,r,a,o,l,h;return!t&&!e||!(!t||!e)&&(null===(i=t.start)||void 0===i?void 0:i.col)===(null===(n=e.start)||void 0===n?void 0:n.col)&&(null===(s=t.start)||void 0===s?void 0:s.row)===(null===(r=e.start)||void 0===r?void 0:r.row)&&(null===(a=t.end)||void 0===a?void 0:a.col)===(null===(o=e.end)||void 0===o?void 0:o.col)&&(null===(l=t.end)||void 0===l?void 0:l.row)===(null===(h=e.end)||void 0===h?void 0:h.row)}Jc.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"},panel:{},maxWidthPercent:.8,space:8,padding:10};var tu=t=>null!=t;const eu="undefined"==typeof window||void 0===window.window;function iu(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||t.end.col<=e&&e<=t.start.col&&t.start.row<=i&&i<=t.end.row||t.start.col<=e&&e<=t.end.col&&t.end.row<=i&&i<=t.start.row}!function(){if(eu)return{IE:!1,Edge:!1,Chrome:!1,Firefox:!1,Safari:!1};const t=window.navigator.userAgent.toLowerCase();/(msie|trident)/.exec(t),t.indexOf("edge"),t.indexOf("chrome")>-1&&t.indexOf("edge"),t.indexOf("firefox"),t.indexOf("safari")>-1&&t.indexOf("edge")}();function nu(t,e){return void 0===t&&void 0===e||void 0!==t&&void 0!==e&&(t.start.col===e.start.col&&t.start.row===e.start.row&&t.end.col===e.end.col&&t.end.row===e.end.row)}function su(t,e){return void 0===t&&void 0===e||void 0!==t&&void 0!==e&&(t.start.col===e.start.col&&t.start.row===e.start.row&&t.end.col===e.end.col&&t.end.row===e.end.row)}function ru(t){return Math.floor(t)===t}function au(t){this.rotateDegree=90;const e=t.clientWidth<t.clientHeight?Math.max(t.clientWidth,t.clientHeight)/2:Math.min(t.clientWidth,t.clientHeight)/2,i=this.getElement().getBoundingClientRect(),n=i.left,s=i.top,r=i.right,a=i.bottom;t.style.transform="rotate(90deg)",t.style.transformOrigin=`${e}px ${e}px`;const o=()=>({x1:n,y1:s,x2:r,y2:a}),l=()=>{const i=("undefined"!=typeof window?{width:window.innerWidth||document.documentElement.clientWidth,height:window.innerHeight||document.documentElement.clientHeight}:cd&&cd.getViewportSize?cd.getViewportSize():t.getBoundingClientRect()).width,n=this.getElement().getBoundingClientRect(),s=n.top,r=i-n.right,a=_o.allocate(1,0,0,1,0,0);a.translate(s,r);const o=e-s,l=e-r;a.translate(o,l),a.rotate(Math.PI/2),a.translate(-o,-l);const h=this.pluginManager.getPluginByName("Rotate Table");return h&&(h.matrix=a),a};Ld(cd,this.getElement(),l,o,Od),Cd(this.scenegraph.stage.window,this.getElement(),l,o,Od);const h=this.pluginManager.getPluginByName("Rotate Table");h&&(h.vglobal_mapToCanvasPoint=cd.mapToCanvasPoint),cd.mapToCanvasPoint=Ed}function ou(t){this.rotateDegree=0,t.style.transform="none",t.style.transformOrigin="none";const e=this.getElement().getBoundingClientRect(),i=e.left,n=e.top,s=e.right,r=e.bottom,a=()=>({x1:i,y1:n,x2:s,y2:r}),o=()=>{const t=_o.allocate(1,0,0,1,0,0);return t.translate(i,n),t};Ld(cd,this.getElement(),o,a,Od),Cd(this.scenegraph.stage.window,this.getElement(),o,a,Od);const l=this.pluginManager.getPluginByName("Rotate Table");l&&(cd.mapToCanvasPoint=l.vglobal_mapToCanvasPoint)}var lu,hu,du,cu;!function(t){t.default="default",t.grabing="grabing",t.scrolling="scrolling"}(lu||(lu={})),function(t){t.FinishToStart="finish_to_start",t.StartToStart="start_to_start",t.FinishToFinish="finish_to_finish",t.StartToFinish="start_to_finish"}(hu||(hu={})),function(t){t.Tasks_Separate="tasks_separate",t.Sub_Tasks_Inline="sub_tasks_inline",t.Sub_Tasks_Separate="sub_tasks_separate",t.Sub_Tasks_Arrange="sub_tasks_arrange",t.Sub_Tasks_Compact="sub_tasks_compact",t.Project_Sub_Tasks_Inline="project_sub_tasks_inline"}(du||(du={})),function(t){t.TASK="task",t.PROJECT="project",t.MILESTONE="milestone"}(cu||(cu={}));const uu={SCROLL:"scroll",CHANGE_DATE_RANGE:"change_date_range",CLICK_TASK_BAR:"click_task_bar",CONTEXTMENU_TASK_BAR:"contextmenu_task_bar",MOUSEENTER_TASK_BAR:"mouseenter_task_bar",MOUSELEAVE_TASK_BAR:"mouseleave_task_bar",CREATE_TASK_SCHEDULE:"create_task_schedule",CREATE_DEPENDENCY_LINK:"create_dependency_link",DELETE_DEPENDENCY_LINK:"delete_dependency_link",CLICK_DEPENDENCY_LINK_POINT:"click_dependency_link_point",CONTEXTMENU_DEPENDENCY_LINK:"contextmenu_dependency_link",CLICK_MARKLINE_CREATE:"click_markline_create",CLICK_MARKLINE_CONTENT:"click_markline_content"};function pu(t,e){let i=null;return function(){for(var n=arguments.length,s=new Array(n),r=0;r<n;r++)s[r]=arguments[r];i||(t.apply(this,s),i=setTimeout((()=>{i=null}),e))}}function gu(t,e){const i=t.getFullYear().toString(),n=(t.getMonth()+1).toString().padStart(2,"0"),s=t.getDate().toString().padStart(2,"0");if((e=(e=(e=e.replace("yyyy",i)).replace("mm",n)).replace("dd",s)).length>10){const i=t.getHours().toString().padStart(2,"0"),n=t.getMinutes().toString().padStart(2,"0"),s=t.getSeconds().toString().padStart(2,"0");e=(e=(e=e.replace("hh",i)).replace("mm",n)).replace("ss",s)}return e}function fu(t,e){const i=e.indexOf("yyyy"),n=e.indexOf("mm"),s=e.indexOf("dd"),r=n<i?n<s?0:1:n<s?1:2,a=s<i?s<n?0:1:s<n?1:2,o=parseInt(t[i<n?i<s?0:1:n<s?1:2],10),l=parseInt(t[r],10)-1,h=parseInt(t[a],10);if(isNaN(o)||o<1)return!1;if(isNaN(l)||l<0||l>11)return!1;const d=[31,mu(o)?29:28,31,30,31,30,31,31,30,31,30,31];return!(isNaN(h)||h<1||h>d[l])}function vu(t,e){if(e.includes("hh")||e.includes("mm")||e.includes("ss")){const i=e.indexOf("hh")>-1?e.indexOf("hh"):e.indexOf("HH"),n=parseInt(t[i],10),s=parseInt(t[i+1],10),r=t.length>i+2?parseInt(t[i+2],10):0;if(isNaN(n)||n<0||n>23)return!1;if(isNaN(s)||s<0||s>59)return!1;if(isNaN(r)||r<0||r>59)return!1}return!0}function mu(t){return t%4==0&&t%100!=0||t%400==0}function bu(t){const e=["yyyy-mm-dd","dd-mm-yyyy","mm/dd/yyyy","yyyy/mm/dd","dd/mm/yyyy","yyyy.mm.dd","mm.dd.yyyy","dd.mm.yyyy"],i=["hh:mm:ss","hh:mm"],n=(t=t.trim()).split(" "),s=n[0],r=n[1];let a,o;if(s)for(let t=0;t<e.length;t++){const i=e[t],n=s.split(yu(i)),r=fu(n,i);if(3===n.length&&r){a=i;break}}if(a&&r)for(let t=0;t<i.length;t++){const e=i[t],n=r.split(yu(e)),s=e.split(yu(e));if(vu(n,e)&&n.length===s.length){o=e;break}}return s&&r&&a&&o?a+" "+o:s&&!r?a:"yyyy-mm-dd hh:mm:ss"}function yu(t){const e=t.match(/[^\w]/g);if(e){const t=e.map((t=>"\\"+t)).join("|");return new RegExp(t,"g")}return/[^\w]/}function xu(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]}function _u(t){const e=new Date(t.getFullYear(),0,1);return Math.ceil(((t.getTime()+1-e.getTime())/864e5+1)/7)}function wu(t){let e,i=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(t){if(e=new Date(t),"string"==typeof t){if(t.length>10)return i&&e.setHours(0,0,0,0),e;e.setHours(0,0,0,0)}}else e=new Date;return i&&e.setHours(0,0,0,0),e}function Tu(t){let e,i=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(t){if(e=new Date(t),"string"==typeof t){if(t.length>10)return i&&e.setMinutes(59,59,999),e;e.setMinutes(59,59,999)}}else e=new Date;return i&&e.setMinutes(59,59,999),e}function Su(t){let e,i=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(t){if(e=new Date(t),"string"==typeof t){if(t.length>10)return i&&e.setSeconds(59,999),e;e.setSeconds(59,999)}}else e=new Date;return i&&e.setSeconds(59,999),e}function ku(t){let e,i=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(t){if(e=new Date(t),"string"==typeof t){if(t.length>10)return i&&e.setMilliseconds(999),e;e.setMilliseconds(999)}}else e=new Date;return i&&e.setMilliseconds(999),e}function Bu(t){let e,i=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(t){if(e=new Date(t),"string"==typeof t){if(t.length>10)return i&&e.setHours(23,59,59,999),e;e.setHours(23,59,59,999)}}else e=new Date;return i&&e.setHours(23,59,59,999),e}function Au(t,e,i,n){let s=new Date(e);switch(i){case"second":s.setMilliseconds(999);break;case"minute":s.setSeconds(59,999);break;case"hour":s.setMinutes(59,59,999);break;case"day":s.setHours(23,59,59,999);break;case"week":const t=6-s.getDay();s.setDate(s.getDate()+t),s.setHours(23,59,59,999);break;case"month":const e=new Date(s.getFullYear(),s.getMonth()+1,0).getDate();s.setDate(e),s.setHours(23,59,59,999);break;case"quarter":const i=s.getMonth(),n=i-i%3+2,r=new Date(s.getFullYear(),n+1,0).getDate();s.setMonth(n,r),s.setHours(23,59,59,999);break;case"year":s.setMonth(11,31),s.setHours(23,59,59,999);break;default:throw new Error("Invalid time scale")}const r=Lu(s,t,i,n,1),a=Math.ceil(r);if(a>r){const t=(a-r)*n,e=1e3,o=60*e,l=60*o,h=24*l,d=7*h;switch(new Date(s.getTime()+1),i){case"second":s.setTime(s.getTime()+t*e);break;case"minute":s.setTime(s.getTime()+t*o);break;case"hour":s.setTime(s.getTime()+t*l);break;case"day":s.setTime(s.getTime()+t*h);break;case"week":s.setTime(s.getTime()+t*d);break;case"month":s=new Date(s.getFullYear(),s.getMonth()+1+Math.round(t),0),s.setHours(23,59,59,999);break;case"quarter":const i=s.getMonth(),n=i-i%3+2;s=new Date(s.getFullYear(),n+Math.round(3*t)+1,0),s.setHours(23,59,59,999);break;case"year":s.setFullYear(s.getFullYear()+Math.floor(t)),s.setHours(23,59,59,999);break;default:throw new Error("Invalid time scale")}}return s}function Cu(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"monday";const n=new Date(t);switch(e){case"second":n.setMilliseconds(0);break;case"minute":n.setSeconds(0,0);break;case"hour":n.setMinutes(0,0,0);break;case"day":n.setHours(0,0,0,0);break;case"week":const t=n.getDay();let e=t;e="monday"===i?0===t?-6:1-t:-t,n.setDate(n.getDate()+e),n.setHours(0,0,0,0);break;case"month":n.setDate(1),n.setHours(0,0,0,0);break;case"quarter":const s=n.getMonth(),r=s-s%3;n.setMonth(r,1),n.setHours(0,0,0,0);break;case"year":n.setMonth(0,1),n.setHours(0,0,0,0);break;default:throw new Error("Invalid time scale")}return n}function Lu(t,e,i,n){let s,r=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0;const a=new Date(t.getTime()+r);switch(i){case"second":s=(a.getTime()-e.getTime())/1e3;break;case"minute":s=(a.getTime()-e.getTime())/6e4;break;case"hour":s=(a.getTime()-e.getTime())/36e5;break;case"day":s=(a.getTime()-e.getTime())/864e5;break;case"week":s=(a.getTime()-e.getTime())/6048e5;break;case"month":s=12*(a.getFullYear()-e.getFullYear())+(a.getMonth()-e.getMonth()),s+=(a.getDate()-e.getDate())/new Date(a.getFullYear(),a.getMonth()+1,0).getDate();break;case"quarter":s=4*(a.getFullYear()-e.getFullYear())+(a.getMonth()-e.getMonth())/3,s+=(a.getDate()-e.getDate())/(3*new Date(a.getFullYear(),a.getMonth()+1,0).getDate());break;case"year":s=a.getFullYear()-e.getFullYear(),s+=(a.getMonth()-e.getMonth())/12;break;default:throw new Error("Invalid time scale")}return s/n}class Ou{constructor(t){var e;this._scene=t,this.scrollLeft=0,this.scrollTop=0,this.x=0,this.y=t._gantt.getAllHeaderRowsHeight(),this.width=t.ganttGroup.attribute.width,this.height=t.ganttGroup.attribute.height-t.timelineHeader.group.attribute.height,this.rowHeight=t._gantt.parsedOptions.rowHeight,this.rowCount=t._gantt.itemCount,this.allGridWidth=t._gantt.getAllDateColsWidth(),this.allGridHeight=t._gantt.getAllTaskBarsHeight(),this.group=new Ua({x:this.x,y:this.y,width:this.width,height:this.height,clip:!0,fill:null===(e=t._gantt.parsedOptions.grid)||void 0===e?void 0:e.backgroundColor}),this.group.name="grid-container",t.ganttGroup.addChild(this.group),this.createVerticalBackgroundRects(),this.createHorizontalBackgroundRects(),this.createVerticalLines(),this.createHorizontalLines(),this.createTimeLineHeaderBottomLine()}createTimeLineHeaderBottomLine(){var t,e,i,n,s,r;const a=this._scene._gantt.parsedOptions,o=null!==(e=null===(t=a.horizontalSplitLine)||void 0===t?void 0:t.lineWidth)&&void 0!==e?e:null===(i=a.timelineHeaderHorizontalLineStyle)||void 0===i?void 0:i.lineWidth,l=(1&o?-.5:0)+o/2,h=zo({pickable:!1,stroke:null!==(s=null===(n=a.horizontalSplitLine)||void 0===n?void 0:n.lineColor)&&void 0!==s?s:null===(r=a.timelineHeaderHorizontalLineStyle)||void 0===r?void 0:r.lineColor,lineWidth:o+(1&o?1:0),points:[{x:0,y:l},{x:this._scene._gantt.getAllDateColsWidth(),y:l}]});h.name="timeLine-header-bottom-line",this.group.addChild(h)}createVerticalLines(){var t,e;const i=this._scene._gantt.parsedOptions.grid,n=null!==(t=i.verticalLineDependenceOnTimeScale)&&void 0!==t?t:this._scene._gantt.parsedOptions.reverseSortedTimelineScales[0].unit;if(i.verticalLine){this.verticalLineGroup=new Ua({x:0,y:0,width:this.allGridWidth,height:this.allGridHeight}),this.verticalLineGroup.name="grid-vertical",this.group.appendChild(this.verticalLineGroup);const t=null!==(e=this._scene._gantt.parsedOptions.reverseSortedTimelineScales.find((t=>t.unit===n)))&&void 0!==e?e:this._scene._gantt.parsedOptions.reverseSortedTimelineScales[0],{unit:s,step:r}=this._scene._gantt.parsedOptions.reverseSortedTimelineScales[0],{timelineDates:a}=t,o=this._scene._gantt.parsedOptions.timelineColWidth;if("function"==typeof i.verticalLine)for(let t=0;t<(null==a?void 0:a.length)-1;t++){const{endDate:e}=a[t],n=i.verticalLine({index:t,dateIndex:a[t].dateIndex,date:a[t].endDate,ganttInstance:this._scene._gantt}),l=Math.ceil(Lu(e,this._scene._gantt.parsedOptions.minDate,s,r,1)*o)+(1&n.lineWidth?.5:0),h=zo({pickable:!1,stroke:n.lineColor,lineWidth:n.lineWidth,points:[{x:l,y:0},{x:l,y:this.allGridHeight}]});this.verticalLineGroup.appendChild(h)}else{const t=i.verticalLine;for(let e=0;e<(null==a?void 0:a.length)-1;e++){const{endDate:i}=a[e],n=Math.ceil(Lu(i,this._scene._gantt.parsedOptions.minDate,s,r,1)*o)+(1&t.lineWidth?.5:0),l=zo({pickable:!1,stroke:t.lineColor,lineWidth:t.lineWidth,points:[{x:n,y:0},{x:n,y:this.allGridHeight}]});this.verticalLineGroup.appendChild(l)}}}}createHorizontalLines(){const t=this._scene._gantt.parsedOptions.grid;if(t.horizontalLine)if(this.horizontalLineGroup=new Ua({x:0,y:0,width:this.allGridWidth,height:this.allGridHeight}),this.horizontalLineGroup.name="grid-horizontal",this.group.appendChild(this.horizontalLineGroup),"function"==typeof t.horizontalLine){let e=.5;for(let i=0;i<this.rowCount-1;i++){const n=t.horizontalLine({index:i,ganttInstance:this._scene._gantt});e+=this._scene._gantt.getRowHeightByIndex(i);const s=zo({pickable:!1,stroke:n.lineColor,lineWidth:n.lineWidth,points:[{x:0,y:e},{x:this.allGridWidth,y:e}]});this.horizontalLineGroup.appendChild(s)}}else{const e=t.horizontalLine;let i=0;1&e.lineWidth&&(i+=.5);for(let t=0;t<this.rowCount-1;t++){i+=this._scene._gantt.getRowHeightByIndex(t);const n=zo({pickable:!1,stroke:e.lineColor,lineWidth:e.lineWidth,points:[{x:0,y:i},{x:this.allGridWidth,y:i}]});this.horizontalLineGroup.appendChild(n)}}}createVerticalBackgroundRects(){const t=this._scene._gantt.parsedOptions.grid.verticalBackgroundColor,e=this._scene._gantt.parsedOptions.grid.weekendBackgroundColor;if(t||e){this.verticalBackgroundRectsGroup=new Ua({x:0,y:0,width:this.allGridWidth,height:this.allGridHeight}),this.verticalBackgroundRectsGroup.name="grid-vertical-background",this.group.appendChild(this.verticalBackgroundRectsGroup);const{timelineDates:i,unit:n,step:s}=this._scene._gantt.parsedOptions.reverseSortedTimelineScales[0],r=this._scene._gantt.parsedOptions.timelineColWidth;if(t||e)for(let a=0;a<=(null==i?void 0:i.length)-1;a++){let o;if(!e||"day"!==n||1!==s||0!==i[a].startDate.getDay()&&6!==i[a].startDate.getDay()?"function"==typeof t?o=t({index:a,dateIndex:i[a].dateIndex,date:i[a].endDate,ganttInstance:this._scene._gantt}):t&&(o=t[a%t.length]):o=e,o){const t=jo({pickable:!1,fill:o,x:Math.ceil(r*a),y:0,width:r,height:this.allGridHeight});this.verticalBackgroundRectsGroup.appendChild(t)}}}}createHorizontalBackgroundRects(){const t=this._scene._gantt.parsedOptions.grid.horizontalBackgroundColor;if(t){this.horizontalBackgroundRectsGroup=new Ua({x:0,y:0,width:this.allGridWidth,height:this.allGridHeight}),this.horizontalBackgroundRectsGroup.name="grid-horizontal-background",this.group.appendChild(this.horizontalBackgroundRectsGroup);let e=0;for(let i=0;i<=this.rowCount-1;i++){let n;n="function"==typeof t?t({index:i,ganttInstance:this._scene._gantt}):t[i%t.length];const s=jo({pickable:!1,fill:n,x:0,y:e,width:this.allGridWidth,height:this._scene._gantt.getRowHeightByIndex(i)});this.horizontalBackgroundRectsGroup.appendChild(s),e+=this._scene._gantt.getRowHeightByIndex(i)}}}refresh(){this.width=this._scene.ganttGroup.attribute.width,this.height=this._scene.ganttGroup.attribute.height-this._scene.timelineHeader.group.attribute.height,this.group.setAttributes({width:this.width,height:this.height,y:this._scene._gantt.getAllHeaderRowsHeight()}),this.rowCount=this._scene._gantt.itemCount,this.allGridWidth=this._scene._gantt.getAllDateColsWidth(),this.allGridHeight=this._scene._gantt.getAllTaskBarsHeight(),this.group.removeAllChild(),this.createVerticalBackgroundRects(),this.createHorizontalBackgroundRects(),this.createVerticalLines(),this.createHorizontalLines(),this.createTimeLineHeaderBottomLine()}setX(t){var e,i,n,s;null===(e=this.verticalLineGroup)||void 0===e||e.setAttribute("x",t),null===(i=this.horizontalLineGroup)||void 0===i||i.setAttribute("x",t),null===(n=this.verticalBackgroundRectsGroup)||void 0===n||n.setAttribute("x",t),null===(s=this.horizontalBackgroundRectsGroup)||void 0===s||s.setAttribute("x",t)}setY(t){var e,i,n,s;null===(e=this.verticalLineGroup)||void 0===e||e.setAttribute("y",t),null===(i=this.horizontalLineGroup)||void 0===i||i.setAttribute("y",t),null===(n=this.verticalBackgroundRectsGroup)||void 0===n||n.setAttribute("y",t),null===(s=this.horizontalBackgroundRectsGroup)||void 0===s||s.setAttribute("y",t)}resize(){this.width=this._scene.ganttGroup.attribute.width,this.height=this._scene.ganttGroup.attribute.height-this._scene.timelineHeader.group.attribute.height,this.group.setAttribute("width",this.width),this.group.setAttribute("height",this.height)}}class Eu{static get mode(){return Eu._mode||(Eu._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}()),Eu._mode}static set mode(t){Eu._mode=t}static RegisterCreateCanvas(t){Eu.CreateCanvas=t}static RegisterLoadImage(t){Eu.LoadImage=t}static GetCreateCanvasFunc(){return Eu.CreateCanvas?Eu.CreateCanvas:"worker"===Eu.mode?function(){return new OffscreenCanvas(arguments.length>0&&void 0!==arguments[0]?arguments[0]:200,arguments.length>1&&void 0!==arguments[1]?arguments[1]:200)}:void 0}static RegisterRequestAnimationFrame(t){Eu.RequestAnimationFrame=t()}static GetRequestAnimationFrame(){if(Eu.RequestAnimationFrame)return Eu.RequestAnimationFrame}static RegisterCancelAnimationFrame(t){Eu.CancelAnimationFrame=t()}static GetCancelAnimationFrame(){if(Eu.CancelAnimationFrame)return Eu.CancelAnimationFrame}}Eu.dpr=0;class Ru{constructor(t){this._gantt=t,this.createScrollBar(t.tableNoFrameWidth,t.tableNoFrameHeight-t.getAllHeaderRowsHeight())}createScrollBar(t,e){var i,n;const s=this._gantt.parsedOptions.scrollStyle.scrollRailColor,r=this._gantt.parsedOptions.scrollStyle.scrollSliderColor,a=this._gantt.parsedOptions.scrollStyle.scrollSliderCornerRadius,o=this._gantt.parsedOptions.scrollStyle.width;let l;l=tu(a)?{cornerRadius:a,fill:r}:{fill:r},null===(i=this._gantt.parsedOptions.scrollStyle)||void 0===i||i.visible,null===(n=this._gantt.parsedOptions.scrollStyle)||void 0===n||n.hoverOn,this.hScrollBar=new Gc({direction:"horizontal",x:2*-t,y:2*-e,width:t,height:o,padding:0,railStyle:{fill:s},sliderStyle:l,range:[0,.1],visible:!1}),this.hScrollBar.render(),this.hScrollBar.hideAll(),this.vScrollBar=new Gc({direction:"vertical",x:2*-t,y:2*-e,width:o,height:e,padding:0,railStyle:{fill:s},sliderStyle:l,range:[0,.1],visible:!1}),this.vScrollBar.render(),this.vScrollBar.hideAll()}refresh(){}hideVerticalScrollBar(){const t=this._gantt.parsedOptions.scrollStyle.visible;"focus"!==t&&"scrolling"!==t||(this.vScrollBar.setAttribute("visible",!1),this.vScrollBar.hideAll(),this._gantt.scenegraph.updateNextFrame())}showVerticalScrollBar(t){const e=this._gantt.parsedOptions.scrollStyle.visible;"focus"!==e&&"scrolling"!==e||(this.vScrollBar.setAttribute("visible",!0),this.vScrollBar.showAll(),this._gantt.scenegraph.updateNextFrame(),t&&(clearTimeout(this._clearVerticalScrollBar),this._clearVerticalScrollBar=setTimeout((()=>{this.hideVerticalScrollBar()}),1e3)))}hideHorizontalScrollBar(){const t=this._gantt.parsedOptions.scrollStyle.visible;"focus"!==t&&"scrolling"!==t||(this.hScrollBar.setAttribute("visible",!1),this.hScrollBar.hideAll(),this._gantt.scenegraph.updateNextFrame())}showHorizontalScrollBar(t){const e=this._gantt.parsedOptions.scrollStyle.visible;"focus"!==e&&"scrolling"!==e||(this.hScrollBar.setAttribute("visible",!0),this.hScrollBar.showAll(),this._gantt.scenegraph.updateNextFrame(),t&&(clearTimeout(this._clearHorizontalScrollBar),this._clearHorizontalScrollBar=setTimeout((()=>{this.hideHorizontalScrollBar()}),1e3)))}updateVerticalScrollBarPos(t){const e=this.vScrollBar.attribute.range,i=e[1]-e[0],n=t*(1-i);this.vScrollBar.setAttribute("range",[n,n+i]);const s=this.vScrollBar.AABBBounds&&this.vScrollBar.globalAABBBounds;this.vScrollBar._viewPosition={x:s.x1,y:s.y1}}updateHorizontalScrollBarPos(t){const e=this.hScrollBar.attribute.range,i=e[1]-e[0],n=t*(1-i);this.hScrollBar.setAttribute("range",[n,n+i]);const s=this.hScrollBar.AABBBounds&&this.hScrollBar.globalAABBBounds;this.hScrollBar._viewPosition={x:s.x1,y:s.y1}}updateScrollBar(){const t=this._gantt.stateManager.scroll.horizontalBarPos,e=this._gantt.stateManager.scroll.verticalBarPos,i=this._gantt.parsedOptions.scrollStyle,n=null==i?void 0:i.width,s=null==i?void 0:i.visible,r=Math.ceil(this._gantt.scenegraph.ganttGroup.attribute.width),a=Math.ceil(this._gantt.scenegraph.ganttGroup.attribute.height),o=this._gantt.getAllRowsHeight(),l=this._gantt.getAllDateColsWidth(),h=this._gantt.getAllHeaderRowsHeight();if(l>r){const t=Math.min(a,o),e=Math.max(.05,r/l),h=i.hoverOn;let d=0;d=i.barToSide?this._gantt.tableNoFrameHeight-(h?n:-this._gantt.scenegraph.ganttGroup.attribute.y)+this._gantt.tableY:t-(h?n:-this._gantt.scenegraph.ganttGroup.attribute.y)+this._gantt.tableY,this.hScrollBar.setAttributes({x:this._gantt.scenegraph.ganttGroup.attribute.x,y:d,width:r,range:[0,e],visible:"always"===s});const c=this.hScrollBar.AABBBounds&&this.hScrollBar.globalAABBBounds;this.hScrollBar._viewPosition={x:c.x1,y:c.y1},"always"===s&&this.hScrollBar.showAll()}else this.hScrollBar.setAttributes({x:2*-this._gantt.tableNoFrameWidth,y:2*-this._gantt.tableNoFrameHeight,width:0,visible:!1});if(o>a){const t=Math.min(r,l)+this._gantt.scenegraph.ganttGroup.attribute.x,e=Math.max(.05,(a-h)/(o-h));let i=0;const d=this._gantt.parsedOptions.scrollStyle.hoverOn;i=this._gantt.parsedOptions.scrollStyle.barToSide?this._gantt.tableNoFrameWidth-(d?n:-this._gantt.scenegraph.ganttGroup.attribute.x):t-(d?n:-this._gantt.scenegraph.ganttGroup.attribute.x),this.vScrollBar.setAttributes({x:i,y:h+(d?0:this._gantt.scenegraph.ganttGroup.attribute.y)+this._gantt.tableY,height:a-h,range:[0,e],visible:"always"===s});const c=this.vScrollBar.AABBBounds&&this.vScrollBar.globalAABBBounds;this.vScrollBar._viewPosition={x:c.x1,y:c.y1},"always"===s&&this.vScrollBar.showAll()}else this.vScrollBar.setAttributes({x:2*-this._gantt.tableNoFrameWidth,y:2*-this._gantt.tableNoFrameHeight,height:0,visible:!1});this._gantt.stateManager.setScrollLeft(t),this._gantt.stateManager.setScrollTop(e)}}function Mu(t,e,i){let n=!(arguments.length>3&&void 0!==arguments[3])||arguments[3];var s;let{deltaX:r,deltaY:a}=t;t.shiftKey&&t.deltaY&&(r=a,a=0);const[o,l]=function(t,e,i){var n,s;const r=Math.abs(t/e),a=r<=.5?0:t,o=r>2?0:e;return[Math.ceil(a*(null!==(n=i.horizontal)&&void 0!==n?n:0)),Math.ceil(o*(null!==(s=i.vertical)&&void 0!==s?s:0))]}(r,a,{horizontal:1,vertical:1});o&&(e.setScrollLeft(e.scroll.horizontalBarPos+o),i.scenegraph.scrollbarComponent.showHorizontalScrollBar(!0)),l&&(e.setScrollTop(e.scroll.verticalBarPos+l),i.scenegraph.scrollbarComponent.showVerticalScrollBar(!0)),n&&e.resetInteractionState(),(null===(s=t.nativeEvent)||void 0===s?void 0:s.cancelable)&&("none"===e._gantt.parsedOptions.overscrollBehavior||Math.abs(a)>=Math.abs(r)&&0!==a&&Pu(a,e)||Math.abs(a)<=Math.abs(r)&&0!==r&&Du(r,e))&&t.preventDefault()}function Pu(t,e){return 0!=e._gantt.getAllRowsHeight()-e._gantt.scenegraph.height&&!function(t,e){return 0!=e._gantt.getAllRowsHeight()-e._gantt.scenegraph.height&&t<=0&&e.scroll.verticalBarPos<1}(t,e)&&!function(t,e){const i=e._gantt.getAllRowsHeight()-e._gantt.scenegraph.height;return 0!==i&&t>=0&&Math.abs(e.scroll.verticalBarPos-i)<1}(t,e)}function Du(t,e){return 0!=e._gantt.getAllDateColsWidth()-e._gantt.scenegraph.width&&!function(t,e){return 0!=e._gantt.getAllDateColsWidth()-e._gantt.scenegraph.width&&t<=0&&e.scroll.horizontalBarPos<1}(t,e)&&!function(t,e){const i=e._gantt.getAllDateColsWidth()-e._gantt.scenegraph.width;return 0!==i&&t>=0&&Math.abs(e.scroll.horizontalBarPos-i)<1}(t,e)}const Iu={barColor:"blue",completedBarColor:"gray",width:30,cornerRadius:3,borderWidth:0,fontFamily:"Arial",fontSize:14};const Fu="undefined"==typeof window||void 0===window.window;function Nu(t,e){const i=t+e.stateManager.scroll.horizontalBarPos,n=e.getDateColWidth(0);return Math.floor((i-n)/e.parsedOptions.timelineColWidth)+1}function Hu(t){var e,i,n,s,r;return t?!0===t?[{date:wu().toLocaleDateString(),content:"",scrollToMarkLine:!0,position:"left",style:{lineColor:"red",lineWidth:1}}]:Array.isArray(t)?t.map(((t,e)=>{var i,n,s,r;return Object.assign(Object.assign({},t),{date:t.date,scrollToMarkLine:t.scrollToMarkLine,position:null!==(i=t.position)&&void 0!==i?i:"left",style:{lineColor:(null===(n=t.style)||void 0===n?void 0:n.lineColor)||"red",lineWidth:(null===(s=t.style)||void 0===s?void 0:s.lineWidth)||1,lineDash:null===(r=t.style)||void 0===r?void 0:r.lineDash}})})):[Object.assign(Object.assign({},t),{date:t.date,scrollToMarkLine:null===(e=t.scrollToMarkLine)||void 0===e||e,position:null!==(i=t.position)&&void 0!==i?i:"left",style:{lineColor:(null===(n=t.style)||void 0===n?void 0:n.lineColor)||"red",lineWidth:(null===(s=t.style)||void 0===s?void 0:s.lineWidth)||1,lineDash:null===(r=t.style)||void 0===r?void 0:r.lineDash}})]:[]}function zu(t){var e,i,n,s,r,a,o,l,h,d,c,u,p,g,f,v,m,b,y,x,_,w,T,S,k,B,A,C,L,O,E,R,M,P,D,I,F,N,H,z,W,U,j,G,Y,V,X,K,$,q,Z,J,Q,tt,et,it,nt,st,rt,at,ot,lt,ht,dt,ct,ut,pt,gt,ft,vt,mt,bt,yt,xt,_t,wt,Tt,St,kt,Bt,At,Ct,Lt,Ot,Et,Rt,Mt,Pt,Dt,It,Ft,Nt,Ht,zt,Wt,Ut,jt,Gt,Yt,Vt,Xt,Kt,$t,qt,Zt,Jt,Qt,te,ee,ie;const ne=t.options;t.parsedOptions.tasksShowMode=null!==(e=null==ne?void 0:ne.tasksShowMode)&&void 0!==e?e:du.Tasks_Separate,t.parsedOptions.pixelRatio=null!==(i=null==ne?void 0:ne.pixelRatio)&&void 0!==i?i:1,t.parsedOptions.rowHeight=null!==(n=null==ne?void 0:ne.rowHeight)&&void 0!==n?n:40,t.parsedOptions.timelineColWidth=null!==(r=null===(s=null==ne?void 0:ne.timelineHeader)||void 0===s?void 0:s.colWidth)&&void 0!==r?r:60,t.parsedOptions.startDateField=null!==(o=null===(a=ne.taskBar)||void 0===a?void 0:a.startDateField)&&void 0!==o?o:"startDate",t.parsedOptions.endDateField=null!==(h=null===(l=ne.taskBar)||void 0===l?void 0:l.endDateField)&&void 0!==h?h:"endDate",t.parsedOptions.progressField=null!==(c=null===(d=ne.taskBar)||void 0===d?void 0:d.progressField)&&void 0!==c?c:"progress",t.parsedOptions.projectSubTasksExpandable=null===(u=null==ne?void 0:ne.projectSubTasksExpandable)||void 0===u||u;const{unit:se,startOfWeek:re,step:ae}=t.parsedOptions.reverseSortedTimelineScales[0];t.parsedOptions.minDate=(null==ne?void 0:ne.minDate)?Cu(new Date(ne.minDate),se,re):void 0,t.parsedOptions.maxDate=(null==ne?void 0:ne.maxDate)&&(null===(p=t.parsedOptions)||void 0===p?void 0:p.minDate)?Au(null===(g=t.parsedOptions)||void 0===g?void 0:g.minDate,new Date(ne.maxDate),se,ae):void 0,t.parsedOptions._minDateTime=null===(f=t.parsedOptions.minDate)||void 0===f?void 0:f.getTime(),t.parsedOptions._maxDateTime=null===(v=t.parsedOptions.maxDate)||void 0===v?void 0:v.getTime(),t.parsedOptions.overscrollBehavior=null!==(m=null==ne?void 0:ne.overscrollBehavior)&&void 0!==m?m:"auto",t.parsedOptions.underlayBackgroundColor=null!==(b=null==ne?void 0:ne.underlayBackgroundColor)&&void 0!==b?b:"#FFF",t.parsedOptions.scrollStyle=Object.assign({},{scrollRailColor:"rgba(100, 100, 100, 0.2)",scrollSliderColor:"rgba(100, 100, 100, 0.5)",scrollSliderCornerRadius:4,width:10,visible:"always",hoverOn:!0,barToSide:!1},null==ne?void 0:ne.scrollStyle),t.parsedOptions.timelineHeaderHorizontalLineStyle=null===(y=null==ne?void 0:ne.timelineHeader)||void 0===y?void 0:y.horizontalLine,t.parsedOptions.timelineHeaderVerticalLineStyle=null===(x=null==ne?void 0:ne.timelineHeader)||void 0===x?void 0:x.verticalLine,t.parsedOptions.timelineHeaderBackgroundColor=null===(_=null==ne?void 0:ne.timelineHeader)||void 0===_?void 0:_.backgroundColor,t.parsedOptions.timeLineHeaderRowHeights=[],t.parsedOptions.timelineHeaderStyles=[];for(let e=0;e<t.parsedOptions.sortedTimelineScales.length;e++){const i=t.parsedOptions.sortedTimelineScales[e].style;t.parsedOptions.timelineHeaderStyles.push(Object.assign({fontSize:20,fontWeight:"bold",textAlign:"center",textBaseline:"middle",color:"#000",backgroundColor:"#fff"},i)),t.parsedOptions.timeLineHeaderRowHeights.push(null!==(T=null!==(w=t.parsedOptions.sortedTimelineScales[e].rowHeight)&&void 0!==w?w:null==ne?void 0:ne.headerRowHeight)&&void 0!==T?T:40)}var oe;t.parsedOptions.grid=Object.assign({},null==ne?void 0:ne.grid),oe=3*t.parsedOptions.rowHeight/4,Iu.width=oe,t.parsedOptions.taskBarStyle=(null===(S=null==ne?void 0:ne.taskBar)||void 0===S?void 0:S.barStyle)&&"function"==typeof(null===(k=null==ne?void 0:ne.taskBar)||void 0===k?void 0:k.barStyle)?ne.taskBar.barStyle:Object.assign({},Iu,null===(B=null==ne?void 0:ne.taskBar)||void 0===B?void 0:B.barStyle),t.parsedOptions.projectBarStyle=(null===(A=null==ne?void 0:ne.taskBar)||void 0===A?void 0:A.projectStyle)&&"function"==typeof(null===(C=null==ne?void 0:ne.taskBar)||void 0===C?void 0:C.projectStyle)?ne.taskBar.projectStyle:(null===(L=null==ne?void 0:ne.taskBar)||void 0===L?void 0:L.projectStyle)?Object.assign({},Iu,null===(O=null==ne?void 0:ne.taskBar)||void 0===O?void 0:O.projectStyle):t.parsedOptions.taskBarStyle,t.parsedOptions.taskBarMilestoneStyle=Object.assign("function"==typeof t.parsedOptions.taskBarStyle?{}:{width:t.parsedOptions.taskBarStyle.width,borderColor:t.parsedOptions.taskBarStyle.borderColor,borderLineWidth:null!==(E=t.parsedOptions.taskBarStyle.borderLineWidth)&&void 0!==E?E:1,fillColor:t.parsedOptions.taskBarStyle.barColor,cornerRadius:0},{labelTextStyle:{fontSize:16,color:"red",fontFamily:"Arial",padding:4}},null===(R=null==ne?void 0:ne.taskBar)||void 0===R?void 0:R.milestoneStyle),t.parsedOptions.taskBarMilestoneHypotenuse=t.parsedOptions.taskBarMilestoneStyle.width*Math.sqrt(2),t.parsedOptions.dateFormat=null==ne?void 0:ne.dateFormat,t.parsedOptions.taskBarHoverStyle=Object.assign({barOverlayColor:"rgba(99, 144, 0, 0.4)"},null===(M=null==ne?void 0:ne.taskBar)||void 0===M?void 0:M.hoverBarStyle),t.parsedOptions.taskBarSelectable=null===(D=null===(P=null==ne?void 0:ne.taskBar)||void 0===P?void 0:P.selectable)||void 0===D||D,t.parsedOptions.taskBarSelectedStyle=Object.assign("function"==typeof t.parsedOptions.taskBarStyle?{shadowBlur:6,shadowOffsetX:0,shadowOffsetY:0,borderLineWidth:1}:{shadowBlur:6,shadowOffsetX:0,shadowOffsetY:0,shadowColor:t.parsedOptions.taskBarStyle.barColor,borderColor:t.parsedOptions.taskBarStyle.barColor,borderLineWidth:1},null===(I=null==ne?void 0:ne.taskBar)||void 0===I?void 0:I.selectedBarStyle),t.parsedOptions.taskBarLabelText=null!==(N=null===(F=null==ne?void 0:ne.taskBar)||void 0===F?void 0:F.labelText)&&void 0!==N?N:"",t.parsedOptions.taskBarMoveable=null===(z=null===(H=null==ne?void 0:ne.taskBar)||void 0===H?void 0:H.moveable)||void 0===z||z,t.parsedOptions.moveTaskBarToExtendDateRange=null===(U=null===(W=null==ne?void 0:ne.taskBar)||void 0===W?void 0:W.moveToExtendDateRange)||void 0===U||U,t.parsedOptions.taskBarResizable=null===(G=null===(j=null==ne?void 0:ne.taskBar)||void 0===j?void 0:j.resizable)||void 0===G||G,t.parsedOptions.taskBarDragOrder=null===(V=null===(Y=null==ne?void 0:ne.taskBar)||void 0===Y?void 0:Y.dragOrder)||void 0===V||V,t.parsedOptions.taskBarLabelStyle={fontFamily:null!==($=null===(K=null===(X=null==ne?void 0:ne.taskBar)||void 0===X?void 0:X.labelTextStyle)||void 0===K?void 0:K.fontFamily)&&void 0!==$?$:"Arial",fontSize:null!==(J=null===(Z=null===(q=null==ne?void 0:ne.taskBar)||void 0===q?void 0:q.labelTextStyle)||void 0===Z?void 0:Z.fontSize)&&void 0!==J?J:20,color:null!==(et=null===(tt=null===(Q=null==ne?void 0:ne.taskBar)||void 0===Q?void 0:Q.labelTextStyle)||void 0===tt?void 0:tt.color)&&void 0!==et?et:"#F01",outsideColor:null!==(st=null===(nt=null===(it=null==ne?void 0:ne.taskBar)||void 0===it?void 0:it.labelTextStyle)||void 0===nt?void 0:nt.outsideColor)&&void 0!==st?st:"#333333",textAlign:null!==(ot=null===(at=null===(rt=null==ne?void 0:ne.taskBar)||void 0===rt?void 0:rt.labelTextStyle)||void 0===at?void 0:at.textAlign)&&void 0!==ot?ot:"left",textBaseline:null!==(dt=null===(ht=null===(lt=null==ne?void 0:ne.taskBar)||void 0===lt?void 0:lt.labelTextStyle)||void 0===ht?void 0:ht.textBaseline)&&void 0!==dt?dt:"middle",padding:null!==(pt=null===(ut=null===(ct=null==ne?void 0:ne.taskBar)||void 0===ct?void 0:ct.labelTextStyle)||void 0===ut?void 0:ut.padding)&&void 0!==pt?pt:[0,0,0,10],textOverflow:null===(ft=null===(gt=null==ne?void 0:ne.taskBar)||void 0===gt?void 0:gt.labelTextStyle)||void 0===ft?void 0:ft.textOverflow,orient:null===(mt=null===(vt=null==ne?void 0:ne.taskBar)||void 0===vt?void 0:vt.labelTextStyle)||void 0===mt?void 0:mt.orient,orientHandleWithOverflow:null===(yt=null===(bt=null==ne?void 0:ne.taskBar)||void 0===bt?void 0:bt.labelTextStyle)||void 0===yt?void 0:yt.orientHandleWithOverflow},t.parsedOptions.taskBarCustomLayout=null===(xt=null==ne?void 0:ne.taskBar)||void 0===xt?void 0:xt.customLayout,t.parsedOptions.taskBarCreatable=null!==(wt=null===(_t=null==ne?void 0:ne.taskBar)||void 0===_t?void 0:_t.scheduleCreatable)&&void 0!==wt?wt:!(t.parsedOptions.tasksShowMode!==du.Sub_Tasks_Separate&&t.parsedOptions.tasksShowMode!==du.Tasks_Separate),t.parsedOptions.taskBarCreationButtonStyle=Object.assign({lineColor:"rgb(99, 144, 0)",lineWidth:1,lineDash:[5,5],cornerRadius:4,backgroundColor:"#FFF"},null===(St=null===(Tt=null==ne?void 0:ne.taskBar)||void 0===Tt?void 0:Tt.scheduleCreation)||void 0===St?void 0:St.buttonStyle),t.parsedOptions.taskBarCreationCustomLayout=null===(Bt=null===(kt=null==ne?void 0:ne.taskBar)||void 0===kt?void 0:kt.scheduleCreation)||void 0===Bt?void 0:Bt.customLayout,t.parsedOptions.taskBarCreationMaxWidth=null===(Ct=null===(At=null==ne?void 0:ne.taskBar)||void 0===At?void 0:At.scheduleCreation)||void 0===Ct?void 0:Ct.maxWidth,t.parsedOptions.taskBarCreationMinWidth=null===(Ot=null===(Lt=null==ne?void 0:ne.taskBar)||void 0===Lt?void 0:Lt.scheduleCreation)||void 0===Ot?void 0:Ot.minWidth,t.parsedOptions.outerFrameStyle=Object.assign({borderColor:"#e1e4e8",borderLineWidth:1,cornerRadius:4},null===(Et=ne.frame)||void 0===Et?void 0:Et.outerFrameStyle),t.parsedOptions.markLine=Hu(null==ne?void 0:ne.markLine),null!==(Mt=null===(Rt=t.parsedOptions.markLine)||void 0===Rt?void 0:Rt.length)&&void 0!==Mt&&Mt&&((null===(Pt=t.parsedOptions.markLine)||void 0===Pt?void 0:Pt.every((t=>void 0===t.scrollToMarkLine)))&&(t.parsedOptions.markLine[0].scrollToMarkLine=!0),(null===(Dt=t.parsedOptions.markLine)||void 0===Dt?void 0:Dt.find((t=>t.scrollToMarkLine)))&&(t.parsedOptions.scrollToMarkLineDate=Cu(new Date(null===(It=t.parsedOptions.markLine)||void 0===It?void 0:It.find((t=>t.scrollToMarkLine)).date),se,re))),t.parsedOptions.verticalSplitLineHighlight=null===(Ft=ne.frame)||void 0===Ft?void 0:Ft.verticalSplitLineHighlight,t.parsedOptions.verticalSplitLine=Object.assign({lineColor:null===(Nt=t.parsedOptions.outerFrameStyle)||void 0===Nt?void 0:Nt.borderColor,lineWidth:null===(Ht=t.parsedOptions.outerFrameStyle)||void 0===Ht?void 0:Ht.borderLineWidth},null===(zt=ne.frame)||void 0===zt?void 0:zt.verticalSplitLine),t.parsedOptions.horizontalSplitLine=null===(Wt=ne.frame)||void 0===Wt?void 0:Wt.horizontalSplitLine,t.parsedOptions.verticalSplitLineMoveable=null===(Ut=ne.frame)||void 0===Ut?void 0:Ut.verticalSplitLineMoveable,t.parsedOptions.taskKeyField=null!==(jt=ne.taskKeyField)&&void 0!==jt?jt:"id",t.parsedOptions.dependencyLinks=null!==(Yt=null===(Gt=ne.dependency)||void 0===Gt?void 0:Gt.links)&&void 0!==Yt?Yt:[],t.parsedOptions.dependencyLinkCreatable=null!==(Xt=null===(Vt=ne.dependency)||void 0===Vt?void 0:Vt.linkCreatable)&&void 0!==Xt&&Xt,t.parsedOptions.dependencyLinkSelectable=null===($t=null===(Kt=ne.dependency)||void 0===Kt?void 0:Kt.linkSelectable)||void 0===$t||$t,t.parsedOptions.dependencyLinkDeletable=null!==(Zt=null===(qt=ne.dependency)||void 0===qt?void 0:qt.linkDeletable)&&void 0!==Zt&&Zt,t.parsedOptions.dependencyLinkLineStyle=Object.assign({lineColor:"red",lineWidth:1},null===(Jt=ne.dependency)||void 0===Jt?void 0:Jt.linkLineStyle),t.parsedOptions.dependencyLinkSelectedLineStyle=Object.assign({shadowBlur:4,shadowOffset:0,shadowColor:t.parsedOptions.dependencyLinkLineStyle.lineColor,lineColor:t.parsedOptions.dependencyLinkLineStyle.lineColor,lineWidth:t.parsedOptions.dependencyLinkLineStyle.lineWidth},null===(Qt=null==ne?void 0:ne.dependency)||void 0===Qt?void 0:Qt.linkSelectedLineStyle),t.parsedOptions.dependencyLinkLineCreatePointStyle=Object.assign({strokeColor:"red",fillColor:"white",radius:5,strokeWidth:1},null===(te=null==ne?void 0:ne.dependency)||void 0===te?void 0:te.linkCreatePointStyle),t.parsedOptions.dependencyLinkLineCreatingPointStyle=Object.assign({strokeColor:"red",fillColor:"red",radius:5,strokeWidth:1},null===(ee=null==ne?void 0:ne.dependency)||void 0===ee?void 0:ee.linkCreatingPointStyle),t.parsedOptions.dependencyLinkLineCreatingStyle=Object.assign({lineColor:"red",lineWidth:1,lineDash:[5,5]},null===(ie=null==ne?void 0:ne.dependency)||void 0===ie?void 0:ie.linkCreatingLineStyle),t.parsedOptions.eventOptions=null==ne?void 0:ne.eventOptions,t.parsedOptions.keyboardOptions=null==ne?void 0:ne.keyboardOptions,t.parsedOptions.markLineCreateOptions=null==ne?void 0:ne.markLineCreateOptions}function Wu(t,e,i){var n;const{unit:s,step:r,format:a}=i,o=[];for(;t<e;)if("day"===s){const i=t.getFullYear(),n=t.getMonth(),s=t.getDate(),l=Bu(new Date(i,n,s+r-1),!0);l.getTime()>e.getTime()&&l.setTime(e.getTime());const h=t,d=(null==a?void 0:a({dateIndex:s,startDate:h,endDate:l}))||s.toString(),c={days:Math.abs(l.getTime()-t.getTime()+1)/864e5,startDate:h,endDate:l,step:r,unit:"day",title:d,dateIndex:s};o.push(c),t=new Date(i,n,s+r)}else if("month"===s){const i=t.getFullYear(),n=t.getMonth(),s=Bu(new Date(i,n+r,0),!0);s.getTime()>e.getTime()&&s.setTime(e.getTime());const l=t,h=(null==a?void 0:a({dateIndex:n+1,startDate:l,endDate:s}))||(n+1).toString(),d={days:Math.abs(s.getTime()-t.getTime()+1)/864e5,startDate:l,step:r,unit:"month",endDate:s,title:h,dateIndex:n+1};o.push(d),t=new Date(i,n+r,1)}else if("quarter"===s){const i=t.getFullYear(),n=Math.floor(t.getMonth()/3),s=Bu(new Date(i,3*(n+r),0),!0);s.getTime()>e.getTime()&&s.setTime(e.getTime());const l=t,h=(null==a?void 0:a({dateIndex:n+1,startDate:l,endDate:s}))||(n+1).toString(),d={days:Math.abs(s.getTime()-t.getTime()+1)/864e5,startDate:l,step:r,unit:"quarter",endDate:s,title:h,dateIndex:n+1};o.push(d),t=new Date(i,3*(n+r),1)}else if("year"===s){const i=t.getFullYear(),n=Bu(new Date(i+r-1,11,31),!0);n.getTime()>e.getTime()&&n.setTime(e.getTime());const s=t,l=(null==a?void 0:a({dateIndex:i,startDate:s,endDate:n}))||i.toString(),h={days:Math.abs(n.getTime()-t.getTime()+1)/864e5,startDate:s,endDate:n,step:r,unit:"year",title:l,dateIndex:i};o.push(h),t=new Date(i+r,0,1)}else if("week"===s){const s=null!==(n=i.startOfWeek)&&void 0!==n?n:"monday";let l=t.getDay();"monday"===s&&(l=0===l?6:l-1);const h=wu(t),d=Bu(t.getTime()+24*(7*r-l)*60*60*1e3-1,!0);d>e&&d.setTime(e.getTime());const c=_u(h),u=(null==a?void 0:a({dateIndex:c,startDate:h,endDate:d}))||c.toString(),p={days:(d.getTime()-h.getTime()+1)/864e5,startDate:h,endDate:d,step:r,unit:"week",title:u,dateIndex:c};o.push(p),t.setTime(wu(t.getTime()+24*(7*r-l)*60*60*1e3,!0).getTime())}else if("hour"===s){const i=t.getFullYear(),n=t.getMonth(),s=t.getDate(),l=t.getHours(),h=Tu(new Date(i,n,s,l+r-1),!0);h.getTime()>e.getTime()&&h.setTime(e.getTime());const d=t,c=(null==a?void 0:a({dateIndex:l,startDate:d,endDate:h}))||l.toString(),u={days:Math.abs(h.getTime()-t.getTime()+1)/864e5,startDate:d,endDate:h,step:r,unit:"hour",title:c,dateIndex:t.getHours()};o.push(u),t=new Date(i,n,s,l+r)}else if("minute"===s){const i=t.getFullYear(),n=t.getMonth(),s=t.getDate(),l=t.getHours(),h=t.getMinutes(),d=Su(new Date(i,n,s,l,h+r-1),!0);d.getTime()>e.getTime()&&d.setTime(e.getTime());const c=t,u=(null==a?void 0:a({dateIndex:h,startDate:c,endDate:d}))||h.toString(),p={days:Math.abs(d.getTime()-t.getTime()+1)/864e5,startDate:c,endDate:d,step:r,unit:"minute",title:u,dateIndex:t.getMinutes()};o.push(p),t=new Date(i,n,s,l,h+r)}else if("second"===s){const i=t.getFullYear(),n=t.getMonth(),s=t.getDate(),l=t.getHours(),h=t.getMinutes(),d=t.getSeconds(),c=ku(new Date(i,n,s,l,h,d+r-1),!0);c.getTime()>e.getTime()&&c.setTime(e.getTime());const u=t,p=(null==a?void 0:a({dateIndex:d,startDate:u,endDate:c}))||d.toString(),g={days:Math.abs(c.getTime()-t.getTime()+1)/864e5,startDate:u,endDate:c,step:r,unit:"second",title:p,dateIndex:t.getSeconds()};o.push(g),t=new Date(i,n,s,l,h,d+r)}return o}function Uu(t,e,i,n,s){var r,a,o,l,h,d,c,u,p;let g=null!==(r=t[3])&&void 0!==r?r:10;"right"===e||"end"===e?g=n-0-(null!==(a=t[1])&&void 0!==a?a:10):"center"===e&&(g=0+(n-0+(null!==(o=t[3])&&void 0!==o?o:10)-(null!==(l=t[1])&&void 0!==l?l:10))/2);let f=0+(null!==(h=t[0])&&void 0!==h?h:10);return"bottom"===i||"alphabetic"===i||"ideographic"===i?f=s-0-(null!==(d=t[2])&&void 0!==d?d:10):"middle"===i&&(f=0+(s-0-(null!==(c=t[0])&&void 0!==c?c:10)-(null!==(u=t[2])&&void 0!==u?u:10))/2+(null!==(p=t[0])&&void 0!==p?p:10)),{x:g,y:f}}function ju(t){if(t.verticalSplitResizeLine){t.verticalSplitResizeLine.style.position="absolute",t.verticalSplitResizeLine.style.top=t.tableY+"px",t.verticalSplitResizeLine.style.left=t.taskTableWidth?t.taskTableWidth-7+t.parsedOptions.verticalSplitLine.lineWidth/2+"px":"0px",t.verticalSplitResizeLine.style.width="14px",t.verticalSplitResizeLine.style.height=t.drawHeight+"px",t.verticalSplitResizeLine.style.backgroundColor="rgba(0,0,0,0)",t.verticalSplitResizeLine.style.zIndex="100",t.parsedOptions.verticalSplitLineMoveable&&(t.verticalSplitResizeLine.style.cursor="col-resize"),t.verticalSplitResizeLine.style.userSelect="none",t.verticalSplitResizeLine.style.opacity="1";const e=t.verticalSplitResizeLine.childNodes[0];if(e.style.position="absolute",e.style.top="0px",e.style.left=(14-t.parsedOptions.verticalSplitLine.lineWidth)/2+"px",e.style.width=t.parsedOptions.verticalSplitLine.lineWidth+"px",e.style.height="100%",e.style.backgroundColor=t.parsedOptions.verticalSplitLine.lineColor,e.style.zIndex="100",e.style.userSelect="none",e.style.pointerEvents="none",e.style.transition="background-color 0.3s",t.verticalSplitResizeLine.childNodes[1]){const e=t.verticalSplitResizeLine.childNodes[1];e.style.position="absolute",e.style.top="0px",e.style.left=(14-t.parsedOptions.verticalSplitLineHighlight.lineWidth)/2+"px",e.style.width=t.parsedOptions.verticalSplitLineHighlight.lineWidth+"px",e.style.height="100%",e.style.backgroundColor=t.parsedOptions.verticalSplitLineHighlight.lineColor,e.style.zIndex="100",e.style.cursor="col-resize",e.style.userSelect="none",e.style.pointerEvents="none",e.style.opacity="0",e.style.transition="background-color 0.3s"}}}function Gu(t,e,i){let n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"children";var s;for(let r=0;r<t.length;r++){if(Array.isArray(i)&&1===i.length&&t[r][e]===i[0]||t[r][e]===i)return{record:t[r],index:[r]};if(null===(s=t[r][n])||void 0===s?void 0:s.length)if(Array.isArray(i)&&i[0]===t[r][e]){const s=Gu(t[r][n],e,i.slice(1));if(s)return s.index.unshift(r),s}else if(!Array.isArray(i)){const s=Gu(t[r][n],e,i);if(s)return s.index.unshift(r),s}}}function Yu(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"children";var i;for(let n=0;n<t.length;n++)(null===(i=t[n][e])||void 0===i?void 0:i.length)?Yu(t[n][e],e):(delete t[n].vtable_gantt_linkedTo,delete t[n].vtable_gantt_linkedFrom)}function Vu(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"children";var i;for(let n=0;n<t.length;n++)(null===(i=t[n][e])||void 0===i?void 0:i.length)?Vu(t[n][e],e):delete t[n].vtable_gantt_showIndex}function Xu(t,e){var i;let n,s;if(e.taskListTableInstance){const r=e.taskListTableInstance.getTargetRowAt(t+e.headerHeight);if(r){const{row:a}=r;n=a-e.taskListTableInstance.columnHeaderLevelCount;const o=e.getRowsHeightByIndex(0,n-1);if(e.parsedOptions.tasksShowMode===du.Sub_Tasks_Inline||e.parsedOptions.tasksShowMode===du.Sub_Tasks_Arrange||e.parsedOptions.tasksShowMode===du.Sub_Tasks_Compact||e.parsedOptions.tasksShowMode===du.Sub_Tasks_Separate)s=Math.floor((t-o)/e.parsedOptions.rowHeight);else if(e.parsedOptions.tasksShowMode===du.Project_Sub_Tasks_Inline){const r=e.getRecordByIndex(n);r&&r.type===cu.PROJECT&&(null===(i=r.children)||void 0===i?void 0:i.length)>0&&("expand"===r.hierarchyState||!1===e.parsedOptions.projectSubTasksExpandable||(s=Math.floor((t-o)/e.parsedOptions.rowHeight)))}}}else n=Math.floor(t/e.parsedOptions.rowHeight);return{task_index:n,sub_task_index:s}}function Ku(t,e,i,n){return i.some((i=>{const{startDate:s,endDate:r}=$u(n,i);return t<=r&&s<=e}))}function $u(t,e){const{timeScaleIncludeHour:i,startDateField:n,endDateField:s}=t.parsedOptions,r=e[n],a=e[s];return i?{startDate:wu(r),endDate:Bu(a)}:{startDate:wu(r,!0),endDate:Bu(a,!0)}}function qu(t){const e=t.options;t.parsedOptions.markLine=Hu(null==e?void 0:e.markLine)}function Zu(t,e){return{left:t.globalTransMatrix.e+e.taskListTableInstance.tableNoFrameWidth+e.taskListTableInstance.tableX+e.tableX,top:t.globalTransMatrix.f,width:t.attribute.width,height:t.attribute.height}}class Ju{constructor(t){this._scene=t,this.initNodes()}initNodes(){var t,e,i,n,s,r,a,o,l;const{_scene:h}=this,d=new Ua({x:0,y:0,width:h._gantt.getAllDateColsWidth(),height:h._gantt.getAllHeaderRowsHeight(),clip:!0,pickable:!1});this.group=d,d.name="date-header-container",h.ganttGroup.addChild(this.group);const{unit:c,step:u}=h._gantt.parsedOptions.reverseSortedTimelineScales[0];let p=0;for(let g=0;g<h._gantt.timeLineHeaderLevel;g++){const{timelineDates:f,customLayout:v,visible:m}=h._gantt.parsedOptions.sortedTimelineScales[g];if(!1===m)continue;const b=new Ua({x:0,y:p,width:h._gantt.getAllDateColsWidth(),height:h._gantt.parsedOptions.timeLineHeaderRowHeights[g],clip:!1});p+=b.attribute.height,b.name="row-header",d.addChild(b);for(let r=0;r<(null==f?void 0:f.length);r++){const{days:a,endDate:o,startDate:l,title:d,dateIndex:p,unit:m}=f[r],y=Math.ceil(Lu(l,h._gantt.parsedOptions.minDate,c,u)*h._gantt.parsedOptions.timelineColWidth),x=Math.ceil(Lu(o,h._gantt.parsedOptions.minDate,c,u,1)*h._gantt.parsedOptions.timelineColWidth)-y,_=new Ua({x:y,y:0,width:x,height:b.attribute.height,clip:!1,fill:h._gantt.parsedOptions.timelineHeaderBackgroundColor});let w;_.name="date-header-cell";let T=!0;const S=b.attribute.height;if(v){let e;e="function"==typeof v?v({width:x,height:S,index:r,startDate:l,endDate:o,days:a,dateIndex:p,title:d,ganttInstance:this._scene._gantt}):v,e&&(w=e.rootContainer,T=null!==(t=e.renderDefaultText)&&void 0!==t&&t,w.name="task-bar-custom-render"),w&&_.appendChild(w)}if(T){const{padding:t,textAlign:e,textBaseline:i,textOverflow:n,fontSize:s,fontWeight:r,color:a,strokeColor:o,textStick:l}=h._gantt.parsedOptions.timelineHeaderStyles[g],c=Uu(xu(t),e,i,x,S),u=new Mo({x:c.x,y:c.y,maxLineWidth:x,heightLimit:S,pickable:!0,text:d.toLocaleString(),fontSize:s,fontWeight:r,fill:a,stroke:o,lineWidth:2,textAlign:e,textBaseline:i,ellipsis:"clip"===n?"":"ellipsis"===n?"...":tu(n)?n:void 0});u.attribute.textStick=l,_.appendChild(u),u.name="date-header-cell-text"}if(g===h._gantt.timeLineHeaderLevel-1&&h._gantt.parsedOptions.markLineCreateOptions&&h._gantt.parsedOptions.markLineCreateOptions.markLineCreatable){const t=h._gantt.parsedOptions.markLineCreateOptions.markLineCreationStyle||{},e=t.size||24,i=t.iconSize||18,n=t.svg||'<svg viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="1471" width="24" height="24"> <path d="M840.05 153.35a27.61875 27.61875 0 0 0-22.95-4.95c-56.25 13.05-218.25 39.6-289.8 2.25-115.65-60.75-241.65-31.95-299.7-13.05V95.75a27.05625 27.05625 0 0 0-27-27 27.05625 27.05625 0 0 0-27 27v834.75c0 14.85 12.15 27 27 27s27-12.15 27-27V611.9c44.1-13.95 199.35-56.25 293.85 1.8 45.9 28.35 96.75 37.8 143.55 37.8 89.1 0 164.7-34.2 169.65-36.45a27.9 27.9 0 0 0 15.75-24.75V174.5a27.5625 27.5625 0 0 0-10.35-21.15z" fill="#f54319" p-id="1472"></path></svg>',s=new Ua({x:x/2-e/2,y:S/2-e/2,width:e,height:e,visiable:!0});s.name="markline-hover-group",s.data=f[r];const a=new Ua({x:0,y:0,width:e,height:e,cornerRadius:e/2,fill:t.fill||"#ccc",cursor:"pointer",display:"flex",justifyContent:"center",alignItems:"center",visibleAll:!1});a.name="markline-hover-inner-group",s.add(a);const o=new Yo({width:i,height:i,image:n,cursor:"pointer",pickable:!0});o.name="markline-hover-icon",a.appendChild(o),_.add(s)}if(b.addChild(_),r>0){const t=zo({pickable:!1,stroke:null===(e=h._gantt.parsedOptions.timelineHeaderVerticalLineStyle)||void 0===e?void 0:e.lineColor,lineWidth:null===(i=h._gantt.parsedOptions.timelineHeaderVerticalLineStyle)||void 0===i?void 0:i.lineWidth,points:[{x:1&(null===(n=h._gantt.parsedOptions.timelineHeaderVerticalLineStyle)||void 0===n?void 0:n.lineWidth)?.5:0,y:0},{x:1&(null===(s=h._gantt.parsedOptions.timelineHeaderVerticalLineStyle)||void 0===s?void 0:s.lineWidth)?.5:0,y:b.attribute.height}]});_.appendChild(t)}}if(g>0){const t=zo({pickable:!1,stroke:null===(r=h._gantt.parsedOptions.timelineHeaderHorizontalLineStyle)||void 0===r?void 0:r.lineColor,lineWidth:null===(a=h._gantt.parsedOptions.timelineHeaderHorizontalLineStyle)||void 0===a?void 0:a.lineWidth,points:[{x:0,y:1&(null===(o=h._gantt.parsedOptions.timelineHeaderHorizontalLineStyle)||void 0===o?void 0:o.lineWidth)?.5:0},{x:h._gantt.getAllDateColsWidth(),y:1&(null===(l=h._gantt.parsedOptions.timelineHeaderHorizontalLineStyle)||void 0===l?void 0:l.lineWidth)?.5:0}]});b.addChild(t)}}}setX(t){this.group.setAttribute("x",t)}setY(t){this.group.setAttribute("y",t)}resize(){var t,e,i,n;this.group.setAttribute("width",null!==(e=null===(t=this.group.attribute)||void 0===t?void 0:t.width)&&void 0!==e?e:0),this.group.setAttribute("height",null!==(n=null===(i=this.group.attribute)||void 0===i?void 0:i.height)&&void 0!==n?n:0)}refresh(){var t;null===(t=this.group)||void 0===t||t.parent.removeChild(this.group),this.initNodes()}showMarklineIcon(t){let e;return t.children.forEach((t=>{"date-header-cell-text"===t.name&&t.setAttribute("visible",!1),"markline-hover-group"===t.name&&(e=t.firstChild,e.setAttribute("visibleAll",!0))})),e}hideMarklineIconHover(t){let e;return t.children.forEach((t=>{"date-header-cell-text"===t.name&&t.setAttribute("visible",!0),"markline-hover-group"===t.name&&(e=t.firstChild,e.setAttribute("visibleAll",!1))})),e}}class Qu extends Ua{constructor(t){super(t),this._lastWidth=t.width,this._lastHeight=t.height,this._lastX=t.x,this._lastY=t.y}updateTextPosition(){var t,i,n;if(!this.textLabel||!this.barRect)return;const s=this.labelStyle||{},{textAlign:r="left",textBaseline:a="middle",textOverflow:o,color:l="#333333",outsideColor:h="#333333",padding:d=8}=s,c=Array.isArray(d)?d[3]:d,u=this.barRect.attribute.width,p=this.barRect.attribute.height,g=this.textLabel.attribute.fontSize||12,f=this.textLabel.attribute.fontFamily||"Arial",v=String(this.textLabel.attribute.text||""),m=e.textMeasure.measureTextWidth(v,{fontSize:g,fontFamily:f})+2*c<=u,b=Uu(xu(c),r,a,u,p),y=s.orient||(!m&&s.orientHandleWithOverflow?s.orientHandleWithOverflow:null);if(this.textLabel.setAttribute("visible",!0),this.textLabel.setAttribute("textBaseline",a),y){null===(t=this.textLabel.parent)||void 0===t||t.removeChild(this.textLabel),this.appendChild(this.textLabel),this.textLabel.setAttribute("fill",h),this.textLabel.setAttribute("ellipsis",void 0),this.textLabel.setAttribute("maxLineWidth",void 0),this.textLabel.setAttribute("zIndex",1e4),this.setAttribute("zIndex",1e4);const e={left:{x:-c,y:p/2,align:"right",baseline:"middle"},right:{x:u+c,y:p/2,align:"left",baseline:"middle"},top:{x:u/2,y:-c,align:"center",baseline:"bottom"},bottom:{x:u/2,y:p+c,align:"center",baseline:"top"}}[y];e&&(this.textLabel.setAttribute("x",e.x),this.textLabel.setAttribute("y",e.y),this.textLabel.setAttribute("textAlign",e.align),this.textLabel.setAttribute("textBaseline",e.baseline))}else null===(i=this.textLabel.parent)||void 0===i||i.removeChild(this.textLabel),null===(n=this.clipGroupBox)||void 0===n||n.appendChild(this.textLabel),this.textLabel.setAttribute("x",b.x),this.textLabel.setAttribute("y",b.y),this.textLabel.setAttribute("textAlign",r),this.textLabel.setAttribute("fill",l),this.textLabel.setAttribute("maxLineWidth",u-c),this.textLabel.setAttribute("ellipsis","clip"===o?"":"ellipsis"===o?"...":tu(o)?o:void 0)}}const tp='<svg width="100" height="200" xmlns="http://www.w3.org/2000/svg">\n <line x1="30" y1="10" x2="30" y2="190" stroke="black" stroke-width="4"/>\n <line x1="70" y1="10" x2="70" y2="190" stroke="black" stroke-width="4"/>\n</svg>';class ep{formatMilestoneText(t,e){if(!t)return"";const i=t.match(/{([^}]+)}/g);return i&&i.forEach((i=>{const n=i.substring(1,i.length-1),s=e[n];void 0!==s&&(t=t.replace(i,String(s)))})),t}calculateMilestoneTextPosition(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:4;const n="number"==typeof i?i:4;let s=0,r=0,a="left",o="middle";const l=e/2;switch(t){case"left":s=-n,r=l,a="end",o="middle";break;case"right":default:s=e+n,r=l,a="start",o="middle";break;case"top":s=l,r=-n,a="center",o="bottom";break;case"bottom":s=l,r=e+n,a="center",o="top"}return{textX:s,textY:r,textAlignValue:a,textBaselineValue:o}}constructor(t){this.selectedBorders=[],this._scene=t,this.width=t._gantt.tableNoFrameWidth,this.height=t._gantt.gridHeight,this.group=new Ua({x:0,y:t._gantt.getAllHeaderRowsHeight(),width:this.width,height:this.height,pickable:!1,clip:!0}),this.group.name="task-bar-container",t.ganttGroup.addChild(this.group),this.initBars(),this.initHoverBarIcons()}initBars(){var t,e,i;this.barContainer=new Ua({x:0,y:0,width:this._scene._gantt.getAllDateColsWidth(),height:this._scene._gantt.getAllTaskBarsHeight(),pickable:!1,clip:!0}),this.group.appendChild(this.barContainer);for(let n=0;n<this._scene._gantt.itemCount;n++)if(this._scene._gantt.parsedOptions.tasksShowMode!==du.Sub_Tasks_Inline&&this._scene._gantt.parsedOptions.tasksShowMode!==du.Sub_Tasks_Separate&&this._scene._gantt.parsedOptions.tasksShowMode!==du.Sub_Tasks_Arrange&&this._scene._gantt.parsedOptions.tasksShowMode!==du.Sub_Tasks_Compact)if(this._scene._gantt.parsedOptions.tasksShowMode!==du.Project_Sub_Tasks_Inline){const t=this.initBar(n);t&&this.barContainer.appendChild(t)}else{const t=this._scene._gantt.getRecordByIndex(n),e="expand"===t.hierarchyState;if(t.type===cu.PROJECT&&(null===(i=t.children)||void 0===i?void 0:i.length)>0&&!e){const e=this._scene._gantt.getRecordIndexByTaskShowIndex(n),i=Array.isArray(e)?[...e]:[e],s=(t,e)=>{var i,r;if((null===(i=t.children)||void 0===i?void 0:i.length)>0)for(let i=0;i<(null===(r=t.children)||void 0===r?void 0:r.length);i++){const r=t.children[i];if(r.type!==cu.PROJECT){const s=this.initBar(n,[...e,i],t.children.length);s&&this.barContainer.appendChild(s)}else s(r,[...e,i])}};s(t,i)}else{const t=this.initBar(n);t&&this.barContainer.appendChild(t)}}else{const i=this._scene._gantt.getRecordByIndex(n);if((null===(t=i.children)||void 0===t?void 0:t.length)>0)for(let t=0;t<(null===(e=i.children)||void 0===e?void 0:e.length);t++){const e=this.initBar(n,t,i.children.length);e&&this.barContainer.appendChild(e)}else{const t=this.initBar(n);t&&this.barContainer.appendChild(t)}}}initBar(t,e,i){var n,s,r,a,o;const l=this._scene._gantt.parsedOptions.taskBarCustomLayout,{startDate:h,endDate:d,taskDays:c,progress:u,taskRecord:p}=this._scene._gantt.getTaskInfoByTaskListIndex(t,e),g=p.type===cu.MILESTONE;if(g&&!h||!g&&(c<=0||!h||!d||h.getTime()>d.getTime()))return null;const{unit:f,step:v}=this._scene._gantt.parsedOptions.reverseSortedTimelineScales[0],m=Lu(d,h,f,v,1)*this._scene._gantt.parsedOptions.timelineColWidth,b=this._scene._gantt.getTaskBarStyle(t,e),y=b.width,x=this._scene._gantt.parsedOptions.rowHeight,_=this._scene._gantt.parsedOptions.taskBarMilestoneStyle.width,w=Lu(h,this._scene._gantt.parsedOptions.minDate,f,v)*this._scene._gantt.parsedOptions.timelineColWidth-(g?_/2:0),T=this._scene._gantt.getRowsHeightByIndex(0,t-1)+(this._scene._gantt.parsedOptions.tasksShowMode===du.Sub_Tasks_Separate?(null!==(n=e)&&void 0!==n?n:0)*x:this._scene._gantt.parsedOptions.tasksShowMode===du.Sub_Tasks_Arrange||this._scene._gantt.parsedOptions.tasksShowMode===du.Sub_Tasks_Compact?p.vtable_gantt_showIndex*x:0)+(x-(g?_:y))/2,S=new Qu({x:w,y:T,width:g?_:m,height:g?_:y,cornerRadius:g?this._scene._gantt.parsedOptions.taskBarMilestoneStyle.cornerRadius:b.cornerRadius,lineWidth:g?2*this._scene._gantt.parsedOptions.taskBarMilestoneStyle.borderLineWidth:2*(null!==(s=b.borderLineWidth)&&void 0!==s?s:b.borderWidth),stroke:g?this._scene._gantt.parsedOptions.taskBarMilestoneStyle.borderColor:b.borderColor,angle:g?.25*Math.PI:0,anchor:g?[w+_/2,T+_/2]:void 0});S.name="task-bar",S.task_index=t,S.sub_task_index=e,S.record=p;const k=new Ua({x:0,y:0,width:S.attribute.width,height:S.attribute.height,cornerRadius:g?this._scene._gantt.parsedOptions.taskBarMilestoneStyle.cornerRadius:b.cornerRadius,clip:!0});let B;k.name="task-bar-group",S.appendChild(k),S.clipGroupBox=k;let A=!0,C=!0;if(l){let e;e="function"==typeof l?l({width:m,height:y,index:t,startDate:h,endDate:d,taskDays:c,progress:u,taskRecord:p,ganttInstance:this._scene._gantt}):l,e&&(B=e.rootContainer,A=null!==(r=e.renderDefaultBar)&&void 0!==r&&r,C=null!==(a=e.renderDefaultText)&&void 0!==a&&a,B&&(B.name="task-bar-custom-render"))}if(A){const t=jo({x:0,y:0,width:S.attribute.width,height:S.attribute.height,fill:g?this._scene._gantt.parsedOptions.taskBarMilestoneStyle.fillColor:b.barColor,pickable:!1});if(t.name="task-bar-rect",k.appendChild(t),S.barRect=t,p.type!==cu.MILESTONE){const t=jo({x:0,y:0,width:m*u/100,height:y,fill:b.completedBarColor,pickable:!1});t.name="task-bar-progress-rect",k.appendChild(t),S.progressRect=t}}if(B&&k.appendChild(B),C&&p.type!==cu.MILESTONE){const{textAlign:t,textBaseline:e,fontSize:i,fontFamily:n,textOverflow:s,color:r,padding:a}=this._scene._gantt.parsedOptions.taskBarLabelStyle,o=Uu(xu(a),t,e,m,y),l=Po({x:o.x,y:o.y,fontSize:i,fill:r,fontFamily:n,text:(L=this._scene._gantt.parsedOptions.taskBarLabelText,O=p,L.replace(/\{([^}]+)\}/g,((t,e)=>{const i=e.split(".");let n=O;for(const e of i){if(!n.hasOwnProperty(e)){n=t;break}n=n[e]}return n}))),maxLineWidth:m-10,textBaseline:e,textAlign:t,ellipsis:"clip"===s?"":"ellipsis"===s?"...":tu(s)?s:void 0,poptip:{position:"bottom"}});k.appendChild(l),S.textLabel=l,S.labelStyle=this._scene._gantt.parsedOptions.taskBarLabelStyle,S.updateTextPosition()}var L,O;if(C&&"milestone"===p.type&&this._scene._gantt.parsedOptions.taskBarMilestoneStyle.labelText){const t=this._scene._gantt.parsedOptions.taskBarMilestoneStyle,e=t.labelTextStyle||{},i=this.calculateMilestoneTextPosition(t.textOrient||"right",t.width,null!==(o=e.padding)&&void 0!==o?o:4),n=new Ua({x:w,y:T,width:t.width,height:t.width,angle:0,pickable:!1}),s=Po({x:i.textX,y:i.textY,fontSize:e.fontSize||16,fontFamily:e.fontFamily||"Arial",fill:e.color||"#ff0000",textBaseline:e.textBaseline||i.textBaselineValue,textAlign:e.textAlign||i.textAlignValue,text:this.formatMilestoneText(t.labelText,p),pickable:!1});n.appendChild(s),this.barContainer.appendChild(n),S.milestoneTextLabel=s,S.milestoneTextContainer=n}return S}updateTaskBarNode(t,e){const i=this.getTaskBarNodeByIndex(t,e);i&&this.barContainer.removeChild(i);const n=this.initBar(t,e);n&&(this.barContainer.insertInto(n,t),n.updateTextPosition())}initHoverBarIcons(){var t,e;const i=new Ua({x:0,y:0,width:100,height:100,clip:!0,pickable:!1,cornerRadius:null!==(e=null!==(t=this._scene._gantt.parsedOptions.taskBarHoverStyle.cornerRadius)&&void 0!==t?t:Iu.cornerRadius)&&void 0!==e?e:0,fill:this._scene._gantt.parsedOptions.taskBarHoverStyle.barOverlayColor,visibleAll:!1});if(this.hoverBarGroup=i,i.name="task-bar-hover-shadow",this._scene._gantt.parsedOptions.taskBarResizable){const t=new Yo({x:0,y:0,width:10,height:20,image:tp,pickable:!0,cursor:"col-resize"});t.name="task-bar-hover-shadow-left-icon",this.hoverBarLeftIcon=t,i.appendChild(t);const e=new Yo({x:0,y:0,width:10,height:20,image:tp,pickable:!0,cursor:"col-resize"});e.name="task-bar-hover-shadow-right-icon",this.hoverBarRightIcon=e,i.appendChild(e)}}setX(t){this.barContainer.setAttribute("x",t)}setY(t){this.barContainer.setAttribute("y",t)}refresh(){this.width=this._scene._gantt.tableNoFrameWidth,this.height=this._scene._gantt.gridHeight,this.group.setAttributes({height:this.height,width:this.width,y:this._scene._gantt.getAllHeaderRowsHeight()});const t=this.barContainer.attribute.x,e=this.barContainer.attribute.y;this.barContainer.removeAllChild(),this.group.removeChild(this.barContainer),this.initBars(),this.setX(t),this.setY(e)}resize(){this.width=this._scene._gantt.tableNoFrameWidth,this.height=this._scene._gantt.gridHeight,this.group.setAttribute("width",this.width),this.group.setAttribute("height",this.height)}showHoverBar(t,e,i,n,s){var r,a,o,l;const{startDate:h,endDate:d,taskRecord:c}=this._scene._gantt.getTaskInfoByTaskListIndex(s.task_index,s.sub_task_index);s&&"task-bar"===s.name&&s.appendChild(this.hoverBarGroup),this.hoverBarGroup.setAttribute("x",0),this.hoverBarGroup.setAttribute("y",0),this.hoverBarGroup.setAttribute("width",i),this.hoverBarGroup.setAttribute("height",n),this.hoverBarGroup.setAttribute("visibleAll",!0);const u=this._scene._gantt.getTaskBarStyle(s.task_index,s.sub_task_index);if(c.type===cu.MILESTONE)this.hoverBarGroup.setAttribute("cornerRadius",s.attribute.cornerRadius);else{const t=null!==(a=null!==(r=this._scene._gantt.parsedOptions.taskBarHoverStyle.cornerRadius)&&void 0!==r?r:u.cornerRadius)&&void 0!==a?a:0;this.hoverBarGroup.setAttribute("cornerRadius",t)}null===(o=this.hoverBarLeftIcon)||void 0===o||o.setAttribute("visible",!1),null===(l=this.hoverBarRightIcon)||void 0===l||l.setAttribute("visible",!1);let p=!0,g=!0;if(c.type===cu.MILESTONE)p=!1,g=!1;else if("function"==typeof this._scene._gantt.parsedOptions.taskBarResizable){const t={index:s.task_index,startDate:h,endDate:d,taskRecord:c,ganttInstance:this._scene._gantt},e=this._scene._gantt.parsedOptions.taskBarResizable(t);Array.isArray(e)?[p,g]=e:(p=e,g=e)}else Array.isArray(this._scene._gantt.parsedOptions.taskBarResizable)?[p,g]=this._scene._gantt.parsedOptions.taskBarResizable:(p=this._scene._gantt.parsedOptions.taskBarResizable,g=this._scene._gantt.parsedOptions.taskBarResizable);p&&this.hoverBarLeftIcon.setAttribute("visible",!0),g&&this.hoverBarRightIcon.setAttribute("visible",!0),this.hoverBarLeftIcon&&(this.hoverBarLeftIcon.setAttribute("x",0),this.hoverBarLeftIcon.setAttribute("y",Math.ceil(n/10)),this.hoverBarLeftIcon.setAttribute("width",10),this.hoverBarLeftIcon.setAttribute("height",n-2*Math.ceil(n/10)),this.hoverBarRightIcon.setAttribute("x",i-10),this.hoverBarRightIcon.setAttribute("y",Math.ceil(n/10)),this.hoverBarRightIcon.setAttribute("width",10),this.hoverBarRightIcon.setAttribute("height",n-2*Math.ceil(n/10)))}hideHoverBar(){this.hoverBarGroup.setAttribute("visibleAll",!1)}createSelectedBorder(t,e,i,n,s){let r=arguments.length>5&&void 0!==arguments[5]&&arguments[5];const a=s.record,o=new Ua({x:t,y:e,width:i,height:n,pickable:!1,attachedToTaskBarNode:s,zIndex:1e4});o.name="task-bar-select-border",this.barContainer.appendChild(o),this.selectedBorders.push(o);const l=new Ua({x:0,y:0,width:i,height:n,lineWidth:this._scene._gantt.parsedOptions.taskBarSelectedStyle.borderLineWidth,pickable:!1,cornerRadius:s.attribute.cornerRadius,fill:!1,stroke:this._scene._gantt.parsedOptions.taskBarSelectedStyle.borderColor,shadowColor:this._scene._gantt.parsedOptions.taskBarSelectedStyle.shadowColor,shadowOffsetX:this._scene._gantt.parsedOptions.taskBarSelectedStyle.shadowOffsetX,shadowOffsetY:this._scene._gantt.parsedOptions.taskBarSelectedStyle.shadowOffsetY,shadowBlur:this._scene._gantt.parsedOptions.taskBarSelectedStyle.shadowBlur,angle:s.attribute.angle,anchor:[i/2,n/2]});if(o.appendChild(l),r){const t=a.type===cu.MILESTONE?15:10,e=new Ua({x:-t,y:0,width:10,height:n,pickable:!0}),s=new Oo({x:5,y:n/2,radius:this._scene._gantt.parsedOptions.dependencyLinkLineCreatePointStyle.radius,fill:this._scene._gantt.parsedOptions.dependencyLinkLineCreatePointStyle.fillColor,stroke:this._scene._gantt.parsedOptions.dependencyLinkLineCreatePointStyle.strokeColor,lineWidth:this._scene._gantt.parsedOptions.dependencyLinkLineCreatePointStyle.strokeWidth,pickable:!1});e.appendChild(s),e.name="task-bar-link-point-left",o.appendChild(e);const r=new Ua({x:i+(t-10),y:0,width:10,height:n,pickable:!0}),l=new Oo({x:5,y:n/2,radius:this._scene._gantt.parsedOptions.dependencyLinkLineCreatePointStyle.radius,fill:this._scene._gantt.parsedOptions.dependencyLinkLineCreatePointStyle.fillColor,stroke:this._scene._gantt.parsedOptions.dependencyLinkLineCreatePointStyle.strokeColor,lineWidth:this._scene._gantt.parsedOptions.dependencyLinkLineCreatePointStyle.strokeWidth,pickable:!1,pickStrokeBuffer:10});r.appendChild(l),r.name="task-bar-link-point-right",o.appendChild(r)}}removeSelectedBorder(){this.selectedBorders.forEach((t=>{t.delete()})),this.selectedBorders=[]}removeSecondSelectedBorder(){2===this.selectedBorders.length&&this.selectedBorders.pop().delete()}updateCreatingDependencyLine(t,e,i,n){this.creatingDependencyLine&&(this.creatingDependencyLine.delete(),this.creatingDependencyLine=void 0);const s=new Ho({points:[{x:t,y:e},{x:i,y:n}],stroke:this._scene._gantt.parsedOptions.dependencyLinkLineCreatingStyle.lineColor,lineWidth:this._scene._gantt.parsedOptions.dependencyLinkLineCreatingStyle.lineWidth,lineDash:this._scene._gantt.parsedOptions.dependencyLinkLineCreatingStyle.lineDash,pickable:!1});this.creatingDependencyLine=s,this.selectedBorders[0].appendChild(s)}getTaskBarNodeByIndex(t,e){let i=this.barContainer.firstChild;if(!i)return null;for(let n=0;n<this.barContainer.childrenCount;n++){if(i.task_index===t&&(!tu(e)||tu(e)&&i.sub_task_index===e))return i;i=i._next}return null}}class ip{constructor(t){this.markLineContainerWidth=20,this._scene=t,this.height=Math.min(t._gantt.tableNoFrameHeight,t._gantt.drawHeight)-t._gantt.getAllHeaderRowsHeight(),this.group=new Ua({x:0,y:t._gantt.getAllHeaderRowsHeight(),width:t._gantt.tableNoFrameWidth,height:this.height,pickable:!1,clip:!0}),this.group.name="mark-line-container",t.ganttGroup.addChild(this.group),this.markLIneContainer=new Ua({x:0,y:0,width:this._scene._gantt.getAllDateColsWidth(),height:this.height,pickable:!1,clip:!0}),this.group.appendChild(this.markLIneContainer),this.initMarkLines()}initMarkLines(){this._scene._gantt.parsedOptions.markLine.forEach((t=>{const e=t.style,i=t.contentStyle||{},n=this._scene._gantt.parsedOptions.timeScaleIncludeHour?wu(t.date):wu(t.date,!0),s=this._scene._gantt.parsedOptions.minDate,{unit:r,step:a}=this._scene._gantt.parsedOptions.reverseSortedTimelineScales[0],o=Lu(n,s,r,a);let l=0;if("right"===t.position)l=1;else if("middle"===t.position)l=.5;else if("date"===t.position){const e=Lu(wu(t.date),s,r,a);l=e-Math.floor(e)}const h=this._scene._gantt.parsedOptions.timelineColWidth*(Math.floor(o)+l),d=new Ua({pickable:!1,x:h-this.markLineContainerWidth/2,y:0,width:this.markLineContainerWidth,height:this.height});d.name="mark-line",this.markLIneContainer.appendChild(d);const c=zo({pickable:!1,stroke:e.lineColor,lineWidth:e.lineWidth,lineDash:e.lineDash,points:[{x:this.markLineContainerWidth/2,y:0},{x:this.markLineContainerWidth/2,y:this.height}]});if(d.appendChild(c),t.content){const n=this._scene._gantt.parsedOptions.timelineColWidth,s=i.lineHeight||18,r=new Ua({x:this.markLineContainerWidth/2,y:0,cursor:"pointer",height:s,clip:!1,fill:i.backgroundColor||e.lineColor,display:"flex",cornerRadius:i.cornerRadius||[0,2,2,0]});r.name="mark-line-content",r.data=t,d.appendChild(r);const a=new Mo({maxLineWidth:n,text:t.content,cursor:"pointer",lineHeight:s,fontWeight:i.fontWeight||"normal",fill:i.color||e.lineColor,fontSize:i.fontSize||12,poptip:{position:"top",dx:n/4,dy:-s/4}});r.appendChild(a)}}))}refresh(){this.height=Math.min(this._scene._gantt.tableNoFrameHeight,this._scene._gantt.drawHeight)-this._scene._gantt.getAllHeaderRowsHeight(),this.markLIneContainer.removeAllChild(),this.group.setAttribute("height",this.height),this.markLIneContainer.setAttribute("height",this.height),this.initMarkLines()}setX(t){this.markLIneContainer.setAttribute("x",t)}}class np{constructor(t){this._scene=t,this.createFrameBorder()}createFrameBorder(){var t,e,i,n,s,r;const a=this._scene.ganttGroup,o=this._scene._gantt.parsedOptions.outerFrameStyle;if(!o)return;const{cornerRadius:l,borderColor:h,borderLineWidth:d,borderLineDash:c}=o,u={},p={pickable:!1};if(d&&(p.stroke=!0,p.fill=!1,p.stroke=h,p.lineWidth=d,c&&(p.lineDash=c),p.lineCap="butt"),l&&(this._scene._gantt.taskListTableInstance?(p.cornerRadius=[0,null!==(t=this._scene._gantt.parsedOptions.outerFrameStyle.cornerRadius)&&void 0!==t?t:0,null!==(e=this._scene._gantt.parsedOptions.outerFrameStyle.cornerRadius)&&void 0!==e?e:0,0],u.cornerRadius=[0,null!==(i=this._scene._gantt.parsedOptions.outerFrameStyle.cornerRadius)&&void 0!==i?i:0,null!==(n=this._scene._gantt.parsedOptions.outerFrameStyle.cornerRadius)&&void 0!==n?n:0,0]):(p.cornerRadius=null!==(s=this._scene._gantt.parsedOptions.outerFrameStyle.cornerRadius)&&void 0!==s?s:0,u.cornerRadius=null!==(r=this._scene._gantt.parsedOptions.outerFrameStyle.cornerRadius)&&void 0!==r?r:0)),a.setAttributes(u),p.stroke){p.x=this._scene._gantt.taskListTableInstance?-d/2:d/2,p.y=d/2,p.pickable=!1,p.width=a.attribute.width+d+(this._scene._gantt.taskListTableInstance?this._scene._gantt.parsedOptions.verticalSplitLine.lineWidth:0),p.height=a.attribute.height+d/2+d/2;const t=jo(p);t.name="border-rect",a.parent.insertAfter(t,a),a.border=t,this.border=t}}refresh(){this.border&&this.border.parent&&this.border.parent.removeChild(this.border),this.createFrameBorder()}resize(){var t;const{cornerRadius:e,borderColor:i,borderLineWidth:n,borderLineDash:s}=this._scene._gantt.parsedOptions.outerFrameStyle;null===(t=this.border)||void 0===t||t.setAttributes({width:this._scene.ganttGroup.attribute.width+n+(this._scene._gantt.taskListTableInstance?this._scene._gantt.parsedOptions.verticalSplitLine.lineWidth:0),height:this._scene._gantt.drawHeight+n})}}var sp=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let rp=class{constructor(){this.time=ni.beforeFillStroke,this.useStyle=!0,this.order=0,this.supportedAppName="vtable"}drawShape(t,e,i,n,s,r,a,o,l,h,d,c,u){"date-header-cell"===t.name&&t.forEachChildren((t=>{var e;if("date-header-cell-text"===t.name&&!0===t.attribute.textStick){const i=t;i.setAttribute("dx",0);const n=i.globalAABBBounds,s=i.stage.globalAABBBounds,r=i.parent.globalAABBBounds,a=s.intersect(r);s.intersect(r)&&(n.width()>=a.width()&&i.attribute.last_dx?i.setAttribute("dx",null!==(e=i.attribute.last_dx)&&void 0!==e?e:0):s.x1>=n.x1?(i.setAttribute("dx",s.x1-n.x1),i.setAttribute("last_dx",s.x1-n.x1)):s.x2<=n.x2&&(i.setAttribute("dx",s.x2-n.x2),i.setAttribute("last_dx",s.x1-n.x1)))}}))}};rp=sp([y()],rp);var ap=new a(((t,e,i,n)=>{t(rp).toSelf().inSingletonScope(),t(ho).toService(rp)}));class op{constructor(t){this._scene=t,this.createAddButton()}createAddButton(){var t;this._scene._gantt.parsedOptions.taskBarCreationCustomLayout?this.group=new Ua({x:0,y:0,width:100,height:100}):(this.group=new Ua({x:0,y:0,width:100,height:100,lineDash:this._scene._gantt.parsedOptions.taskBarCreationButtonStyle.lineDash,cursor:"pointer",lineWidth:this._scene._gantt.parsedOptions.taskBarCreationButtonStyle.lineWidth,stroke:this._scene._gantt.parsedOptions.taskBarCreationButtonStyle.lineColor,cornerRadius:null!==(t=this._scene._gantt.parsedOptions.taskBarCreationButtonStyle.cornerRadius)&&void 0!==t?t:0,fill:this._scene._gantt.parsedOptions.taskBarCreationButtonStyle.backgroundColor}),this.lineVertical=zo({pickable:!1,stroke:this._scene._gantt.parsedOptions.taskBarCreationButtonStyle.lineColor,lineWidth:this._scene._gantt.parsedOptions.taskBarCreationButtonStyle.lineWidth,points:[{x:50,y:0},{x:50,y:100}]}),this.group.appendChild(this.lineVertical),this.lineHorizontal=zo({pickable:!1,stroke:this._scene._gantt.parsedOptions.taskBarCreationButtonStyle.lineColor,lineWidth:this._scene._gantt.parsedOptions.taskBarCreationButtonStyle.lineWidth,points:[{x:0,y:50},{x:100,y:50}]}),this.group.appendChild(this.lineHorizontal)),this.group.name="task-creation-button",this._scene.taskBar.group.addChild(this.group)}show(t,e,i,n){if(this._scene._gantt.parsedOptions.taskBarCreationCustomLayout)this.group.appendChild(this._scene._gantt.parsedOptions.taskBarCreationCustomLayout({width:i,height:n,ganttInstance:this._scene._gantt}).rootContainer);else{const t=Math.min(i,n)/6;this.lineHorizontal.setAttribute("points",[{x:(i-4*t)/2,y:n/2},{x:(i-4*t)/2+4*t,y:n/2}]),this.lineVertical.setAttribute("points",[{x:i/2,y:(n-4*t)/2},{x:i/2,y:(n-4*t)/2+4*t}])}this.group.setAttribute("x",t),this.group.setAttribute("y",e),this.group.setAttribute("width",i),this.group.setAttribute("height",n),this.group.setAttribute("visibleAll",!0)}hide(){this.group.setAttribute("visibleAll",!1),this._scene._gantt.parsedOptions.taskBarCreationCustomLayout&&this.group.removeAllChild()}}class lp{constructor(t){this._scene=t,this.group=new Jc({position:"top",content:"",contentStyle:{fill:"#fff"},visible:!1,panel:{background:"#14161c",cornerRadius:4}}),t.ganttGroup.addChild(this.group)}show(t){var e,i,n;const s=(null===(e=this._scene._gantt.parsedOptions.markLineCreateOptions)||void 0===e?void 0:e.markLineCreationHoverToolTip)||{},r=t.globalTransMatrix,a=t.attribute.width,o=t.attribute.height;let l,h;const d=s.position||"top";"top"===d?(l=r.e+a/2-2,h=r.f):"bottom"===d&&(l=r.e+a/2-2,h=r.f+o);const c=(null===(i=s.style)||void 0===i?void 0:i.contentStyle)||{fill:"#fff"},u=(null===(n=s.style)||void 0===n?void 0:n.panelStyle)||{background:"#14161c",cornerRadius:4};this.group.setAttributes({content:s.tipContent,position:d,visibleAll:!0,visible:!0,contentStyle:c,panel:Object.assign(Object.assign({},u),{visible:!0}),x:l,y:h})}hide(){this.group.setAttributes({visibleAll:!1,visible:!1})}}class hp{constructor(t){this._scene=t,this.width=t._gantt.tableNoFrameWidth,this.height=t._gantt.gridHeight,this.group=new Ua({x:0,y:t._gantt.getAllHeaderRowsHeight(),width:this.width,height:this.height,pickable:!1,clip:!0}),this.group.name="dependency-link-container",t.ganttGroup.addChild(this.group),this.initLinkLines()}initLinkLines(){var t;if(Yu(this._scene._gantt.records),this.linkLinesContainer=new Ua({x:0,y:0,width:this._scene._gantt.getAllDateColsWidth(),height:this._scene._gantt.getAllTaskBarsHeight(),pickable:!1,clip:!0}),this.group.appendChild(this.linkLinesContainer),null===(t=this._scene._gantt.records)||void 0===t?void 0:t.length)for(let t=0;t<this._scene._gantt.parsedOptions.dependencyLinks.length;t++)this.initLinkLine(t)}initLinkLine(t){var e,i;const{taskKeyField:n,dependencyLinks:s}=this._scene._gantt.parsedOptions,r=s[t],{linkedToTaskKey:a,linkedFromTaskKey:o,type:l}=r,h=Gu(this._scene._gantt.records,n,a),d=Gu(this._scene._gantt.records,n,o);if(!h||!d)return;let c,u,p,g,f,v,m,b;if(h.record.vtable_gantt_linkedTo||(h.record.vtable_gantt_linkedTo=[]),h.record.vtable_gantt_linkedTo.push(r),d.record.vtable_gantt_linkedFrom||(d.record.vtable_gantt_linkedFrom=[]),d.record.vtable_gantt_linkedFrom.push(r),this._scene._gantt.parsedOptions.tasksShowMode===du.Sub_Tasks_Inline)b=d.index[0],m=h.index[0],({startDate:c,endDate:u,taskDays:p}=this._scene._gantt.getTaskInfoByTaskListIndex(h.index[0],h.index[1])),({startDate:g,endDate:f,taskDays:v}=this._scene._gantt.getTaskInfoByTaskListIndex(d.index[0],d.index[1]));else if(this._scene._gantt.parsedOptions.tasksShowMode===du.Project_Sub_Tasks_Inline){const t=this._scene._gantt.getTaskShowIndexByRecordIndex(d.index.slice(0,-1)),e=this._scene._gantt.getTaskShowIndexByRecordIndex(h.index.slice(0,-1)),i=this._scene._gantt.getRecordByIndex(t),n=this._scene._gantt.getRecordByIndex(e);b=i.type===cu.PROJECT&&"expand"!==i.hierarchyState&&!1!==this._scene._gantt.parsedOptions.projectSubTasksExpandable?t:this._scene._gantt.getTaskShowIndexByRecordIndex(d.index),m=n.type===cu.PROJECT&&"expand"!==n.hierarchyState&&!1!==this._scene._gantt.parsedOptions.projectSubTasksExpandable?e:this._scene._gantt.getTaskShowIndexByRecordIndex(h.index),({startDate:c,endDate:u,taskDays:p}=this._scene._gantt.getTaskInfoByTaskListIndex(m,h.index)),({startDate:g,endDate:f,taskDays:v}=this._scene._gantt.getTaskInfoByTaskListIndex(b,d.index))}else this._scene._gantt.parsedOptions.tasksShowMode===du.Sub_Tasks_Separate||this._scene._gantt.parsedOptions.tasksShowMode===du.Sub_Tasks_Arrange||this._scene._gantt.parsedOptions.tasksShowMode===du.Sub_Tasks_Compact?(b=this._scene._gantt.getRowsHeightByIndex(0,d.index[0]-1)/this._scene._gantt.parsedOptions.rowHeight+(this._scene._gantt.parsedOptions.tasksShowMode===du.Sub_Tasks_Arrange||this._scene._gantt.parsedOptions.tasksShowMode===du.Sub_Tasks_Compact?d.record.vtable_gantt_showIndex:null!==(e=d.index[1])&&void 0!==e?e:0),m=this._scene._gantt.getRowsHeightByIndex(0,h.index[0]-1)/this._scene._gantt.parsedOptions.rowHeight+(this._scene._gantt.parsedOptions.tasksShowMode===du.Sub_Tasks_Arrange||this._scene._gantt.parsedOptions.tasksShowMode===du.Sub_Tasks_Compact?h.record.vtable_gantt_showIndex:null!==(i=h.index[1])&&void 0!==i?i:0),({startDate:c,endDate:u,taskDays:p}=this._scene._gantt.getTaskInfoByTaskListIndex(h.index[0],h.index[1])),({startDate:g,endDate:f,taskDays:v}=this._scene._gantt.getTaskInfoByTaskListIndex(d.index[0],d.index[1]))):(b=this._scene._gantt.getTaskShowIndexByRecordIndex(d.index),m=this._scene._gantt.getTaskShowIndexByRecordIndex(h.index),({startDate:c,endDate:u,taskDays:p}=this._scene._gantt.getTaskInfoByTaskListIndex(m)),({startDate:g,endDate:f,taskDays:v}=this._scene._gantt.getTaskInfoByTaskListIndex(b)));if(!v||!p)return;wu(this._scene._gantt.parsedOptions.minDate);const{arrowPoints:y,linePoints:x}=function(t,e,i,n,s,r,a,o,l,h,d,c){const{unit:u,step:p}=c.parsedOptions.reverseSortedTimelineScales[0],{minDate:g,rowHeight:f,timelineColWidth:v}=c.parsedOptions,m=c.parsedOptions.taskBarMilestoneHypotenuse;let b=[],y=[];if(t===hu.FinishToStart){let t=Lu(i,g,u,p,1)*v;r&&(t=Lu(e,g,u,p,1)*v+m/2);let s=Lu(a,g,u,p)*v;d&&(s-=m/2),b=[{x:t,y:f*(n+.5)},{x:t+20,y:f*(n+.5)},{x:t+20,y:f*(n+(n>l?0:1))},{x:s-20,y:f*(n+(n>l?0:1))},{x:s-20,y:f*(l+.5)},{x:s,y:f*(l+.5)}],t+20<=s-20&&b.splice(2,3,{x:t+20,y:f*(l+.5)});const o=b[b.length-1];y=[{x:o.x,y:o.y},{x:o.x-10,y:o.y-5},{x:o.x-10,y:o.y+5},{x:o.x,y:o.y}]}else if(t===hu.StartToFinish){let t=Lu(e,g,u,p)*v;r&&(t-=m/2);let i=Lu(o,g,u,p,1)*v;d&&(i=Lu(a,g,u,p,1)*v+m/2),b=[{x:t,y:f*(n+.5)},{x:t-20,y:f*(n+.5)},{x:t-20,y:f*(n+(n>l?0:1))},{x:i+20,y:f*(n+(n>l?0:1))},{x:i+20,y:f*(l+.5)},{x:i,y:f*(l+.5)}],t-20>=i+20&&b.splice(2,3,{x:t-20,y:f*(l+.5)});const s=b[b.length-1];y=[{x:s.x,y:s.y},{x:s.x+10,y:s.y-5},{x:s.x+10,y:s.y+5},{x:s.x,y:s.y}]}else if(t===hu.StartToStart){let t=Lu(e,g,u,p)*v;r&&(t-=m/2);let i=Lu(a,g,u,p)*v;d&&(i-=m/2),b=[{x:t,y:f*(n+.5)},{x:(n===l?t:Math.min(t,i))-20,y:f*(n+.5)},{x:(n===l?t:Math.min(t,i))-20,y:f*(l+(n===l?1:.5))},{x:i-20,y:f*(l+(n===l?1:.5))},{x:(n===l?i:Math.min(t,i))-20,y:f*(l+.5)},{x:i,y:f*(l+.5)}];const s=b[b.length-1];y=[{x:s.x,y:s.y},{x:s.x-10,y:s.y-5},{x:s.x-10,y:s.y+5},{x:s.x,y:s.y}]}else if(t===hu.FinishToFinish){let t=Lu(i,g,u,p,1)*v;r&&(t=Lu(e,g,u,p,1)*v+m/2);let s=Lu(o,g,u,p,1)*v;d&&(s=Lu(a,g,u,p,1)*v+m/2),b=[{x:t,y:f*(n+.5)},{x:(n===l?t:Math.max(t,s))+20,y:f*(n+.5)},{x:(n===l?t:Math.max(t,s))+20,y:f*(l+(n===l?1:.5))},{x:s+20,y:f*(l+(n===l?1:.5))},{x:s+20,y:f*(l+.5)},{x:s,y:f*(l+.5)}];const h=b[b.length-1];y=[{x:h.x,y:h.y},{x:h.x+10,y:h.y-5},{x:h.x+10,y:h.y+5},{x:h.x,y:h.y}]}return{linePoints:b,arrowPoints:y}}(l,g,f,b,0,d.record.type===cu.MILESTONE,c,u,m,0,h.record.type===cu.MILESTONE,this._scene._gantt),_=this._scene._gantt.parsedOptions.dependencyLinkLineStyle,w=zo({pickable:!0,stroke:_.lineColor,lineWidth:_.lineWidth,lineDash:_.lineDash,points:x,pickStrokeBuffer:3,vtable_link:r});this.linkLinesContainer.appendChild(w),r.vtable_gantt_linkLineNode=w;const T=new Xo({fill:_.lineColor,points:y});this.linkLinesContainer.appendChild(T),r.vtable_gantt_linkArrowNode=T}setX(t){this.linkLinesContainer.setAttribute("x",t)}setY(t){this.linkLinesContainer.setAttribute("y",t)}refresh(){this.width=this._scene._gantt.tableNoFrameWidth,this.height=this._scene._gantt.gridHeight,this.group.setAttributes({height:this.height,width:this.width,y:this._scene._gantt.getAllHeaderRowsHeight()});const t=this.linkLinesContainer.attribute.x,e=this.linkLinesContainer.attribute.y;this.linkLinesContainer.removeAllChild(),this.group.removeChild(this.linkLinesContainer),this.initLinkLines(),this.setX(t),this.setY(e)}resize(){this.width=this._scene._gantt.tableNoFrameWidth,this.height=this._scene._gantt.gridHeight,this.group.setAttribute("width",this.width),this.group.setAttribute("height",this.height)}createSelectedLinkLine(t){const e=t.vtable_gantt_linkLineNode,i=t.vtable_gantt_linkArrowNode,n=e.clone(),s=i.clone();n.setAttribute("stroke",this._scene._gantt.parsedOptions.dependencyLinkSelectedLineStyle.lineColor),n.setAttribute("lineWidth",this._scene._gantt.parsedOptions.dependencyLinkSelectedLineStyle.lineWidth),n.setAttribute("shadowColor",this._scene._gantt.parsedOptions.dependencyLinkSelectedLineStyle.shadowColor),n.setAttribute("shadowOffsetX",this._scene._gantt.parsedOptions.dependencyLinkSelectedLineStyle.shadowOffset),n.setAttribute("shadowOffsetY",this._scene._gantt.parsedOptions.dependencyLinkSelectedLineStyle.shadowOffset),n.setAttribute("shadowBlur",this._scene._gantt.parsedOptions.dependencyLinkSelectedLineStyle.shadowBlur),this.linkLinesContainer.appendChild(n),s.setAttribute("fill",this._scene._gantt.parsedOptions.dependencyLinkSelectedLineStyle.lineColor),this.linkLinesContainer.appendChild(s),this.selectedEffectNodes=[n,s]}removeSelectedLinkLine(){var t;null===(t=this.selectedEffectNodes)||void 0===t||t.forEach((t=>{t.delete()})),this.selectedEffectNodes=[]}deleteLink(t){const e=t.vtable_gantt_linkLineNode,i=t.vtable_gantt_linkArrowNode;e.delete(),i.delete()}}function dp(t,e,i,n,s,r,a,o,l,h,d,c,u,p,g,f){const{unit:v,step:m}=f.parsedOptions.reverseSortedTimelineScales[0],{minDate:b,rowHeight:y,timelineColWidth:x}=f.parsedOptions,_=f.parsedOptions.taskBarMilestoneHypotenuse,w=f.parsedOptions.taskBarMilestoneStyle.width;let T=[],S=[];if(t===hu.FinishToStart){let t=a?a.attribute.x+a.attribute.width:Lu(i,b,v,m,1)*x;r&&(t=a?a.attribute.x+a.attribute.width+(_-w)/2:Lu(e,b,v,m,1)*x+_/2);let s=p?p.attribute.x:Lu(l,b,v,m)*x;u&&(s-=(_-w)/2),T=[{x:t,y:y*(n+.5)+o},{x:t+20,y:y*(n+.5)+o},{x:t+20,y:y*(n+(n>d?0:1))+o},{x:s-20,y:y*(n+(n>d?0:1))+o},{x:s-20,y:y*(d+.5)+g},{x:s,y:y*(d+.5)+g}],t+20<=s-20&&T.splice(2,3,{x:t+20,y:y*(d+.5)+g});const h=T[T.length-1];S=[{x:h.x,y:h.y},{x:h.x-10,y:h.y-5},{x:h.x-10,y:h.y+5},{x:h.x,y:h.y}]}else if(t===hu.StartToFinish){let t=a?a.attribute.x:Lu(e,b,v,m)*x;r&&(t-=(_-w)/2);let i=p?p.attribute.x+p.attribute.width:Lu(h,b,v,m,1)*x;u&&(i=p?p.attribute.x+p.attribute.width+(_-w)/2:Lu(l,b,v,m,1)*x+_/2),T=[{x:t,y:y*(n+.5)+o},{x:t-20,y:y*(n+.5)+o},{x:t-20,y:y*(n+(n>d?0:1))+o},{x:i+20,y:y*(n+(n>d?0:1))+o},{x:i+20,y:y*(d+.5)+g},{x:i,y:y*(d+.5)+g}],t-20>=i+20&&T.splice(2,3,{x:t-20,y:y*(d+.5)+g});const s=T[T.length-1];S=[{x:s.x,y:s.y},{x:s.x+10,y:s.y-5},{x:s.x+10,y:s.y+5},{x:s.x,y:s.y}]}else if(t===hu.StartToStart){let t=a?a.attribute.x:Lu(e,b,v,m)*x;r&&(t-=(_-w)/2);let i=p?p.attribute.x:Lu(l,b,v,m)*x;u&&(i-=(_-w)/2),T=[{x:t,y:y*(n+.5)+o},{x:(n===d?t:Math.min(t,i))-20,y:y*(n+.5)+o},{x:(n===d?t:Math.min(t,i))-20,y:y*(d+(n===d?1:.5))+g},{x:i-20,y:y*(d+(n===d?1:.5))+g},{x:(n===d?i:Math.min(t,i))-20,y:y*(d+.5)+g},{x:i,y:y*(d+.5)+g}];const s=T[T.length-1];S=[{x:s.x,y:s.y},{x:s.x-10,y:s.y-5},{x:s.x-10,y:s.y+5},{x:s.x,y:s.y}]}else if(t===hu.FinishToFinish){let t=a?a.attribute.x+a.attribute.width:Lu(i,b,v,m,1)*x;r&&(t=a?a.attribute.x+a.attribute.width+(_-w)/2:Lu(e,b,v,m,1)*x+_/2);let s=p?p.attribute.x+p.attribute.width:Lu(h,b,v,m,1)*x;u&&(s=p?p.attribute.x+p.attribute.width+(_-w)/2:Lu(l,b,v,m,1)*x+_/2),T=[{x:t,y:y*(n+.5)+o},{x:(n===d?t:Math.max(t,s))+20,y:y*(n+.5)+o},{x:(n===d?t:Math.max(t,s))+20,y:y*(d+(n===d?1:.5))+g},{x:s+20,y:y*(d+(n===d?1:.5))+g},{x:s+20,y:y*(d+.5)+g},{x:s,y:y*(d+.5)+g}];const c=T[T.length-1];S=[{x:c.x,y:c.y},{x:c.x+10,y:c.y-5},{x:c.x+10,y:c.y+5},{x:c.x,y:c.y}]}return{linePoints:T,arrowPoints:S}}class cp{constructor(t){this._scene=t,this.dragLineContainer=new Ua({x:0,y:0,width:t._gantt.tableNoFrameWidth,height:Math.min(t._gantt.tableNoFrameHeight,t._gantt.drawHeight),pickable:!1,clip:!0,visible:!1}),this.dragLineContainer.name="drag-order-line-container",t.ganttGroup.addChild(this.dragLineContainer),this.initDragLine()}initDragLine(){if(this._scene._gantt.taskListTableInstance){const t=this._scene._gantt.taskListTableInstance.theme.dragHeaderSplitLine,e=zo({pickable:!1,stroke:t.lineColor,lineWidth:t.lineWidth,points:[]});this.dragLine=e,this.dragLineContainer.appendChild(e)}}showDragLine(t){this.dragLineContainer.showAll(),this.dragLine.setAttribute("points",[{x:0,y:t},{x:this._scene._gantt.tableNoFrameWidth,y:t}])}hideDragLine(){this.dragLineContainer.hideAll()}}Pn.load(ap);class up{constructor(t){let e,i;var n;this._gantt=t,this.tableGroupWidth=t.tableNoFrameWidth,this.tableGroupHeight=Math.min(t.tableNoFrameHeight,t.drawHeight),"node"===Eu.mode||(cd.setEnv("browser"),e=t.canvas.width,i=t.canvas.height),this.stage=(n={canvas:t.canvas,width:e,height:i,disableDirtyBounds:!1,background:t.parsedOptions.underlayBackgroundColor,enableLayout:!0,autoRender:!1,context:{appName:"vtable"},pluginList:["poptipForText"]},new Bd(n)),this.stage.gantt=this._gantt,this.stage.table=this._gantt,this.stage.defaultLayer.setTheme({group:{boundsPadding:0,strokeBoundsBuffer:0,lineJoin:"round"},text:{ignoreBuf:!0}}),this.initSceneGraph()}initSceneGraph(){this.ganttGroup=new Ua({x:this._gantt.tableX,y:this._gantt.tableY,width:this.tableGroupWidth,height:this.tableGroupHeight,clip:!0,pickable:!1}),this.stage.defaultLayer.add(this.ganttGroup),this.ganttGroup.name="table",this.timelineHeader=new Ju(this),this.grid=new Ou(this),this.dependencyLink=new hp(this),this.taskBar=new ep(this),this.markLine=new ip(this),this.toolTip=new lp(this),this.frameBorder=new np(this),this.scrollbarComponent=new Ru(this._gantt),this.stage.defaultLayer.addChild(this.scrollbarComponent.hScrollBar),this.stage.defaultLayer.addChild(this.scrollbarComponent.vScrollBar),this.dragOrderLine=new cp(this)}updateSceneGraph(){const t=this._gantt;let e,i;this.tableGroupWidth=t.tableNoFrameWidth,this.tableGroupHeight=Math.min(t.tableNoFrameHeight,t.drawHeight),"node"===Eu.mode||(cd.setEnv("browser"),e=t.canvas.width,i=t.canvas.height),this.stage.resize(e,i),this.refreshAll()}afterCreateSceneGraph(){this.scrollbarComponent.updateScrollBar(),function(t){const e=t._gantt,i=e.stateManager,n=e.scenegraph;n.scrollbarComponent.vScrollBar.addEventListener("pointerover",(t=>{n.scrollbarComponent.showVerticalScrollBar()})),n.scrollbarComponent.hScrollBar.addEventListener("pointerover",(t=>{n.scrollbarComponent.showHorizontalScrollBar()})),n.scrollbarComponent.vScrollBar.addEventListener("pointerout",(t=>{i.interactionState!==lu.scrolling&&n.scrollbarComponent.hideVerticalScrollBar()})),n.scrollbarComponent.hScrollBar.addEventListener("pointerout",(t=>{i.interactionState!==lu.scrolling&&n.scrollbarComponent.hideHorizontalScrollBar()})),n.scrollbarComponent.vScrollBar.addEventListener("pointermove",(t=>{t.stopPropagation()})),n.scrollbarComponent.vScrollBar.addEventListener("scrollDown",(t=>{n._gantt.eventManager.isDown=!0})),n.scrollbarComponent.vScrollBar.addEventListener("pointerup",(()=>{n._gantt.eventManager.isDraging=!1,i.interactionState===lu.scrolling&&i.updateInteractionState(lu.default)})),n.scrollbarComponent.vScrollBar.addEventListener("pointerupoutside",(()=>{i.interactionState===lu.scrolling&&i.updateInteractionState(lu.default)})),n.scrollbarComponent.vScrollBar.addEventListener("scrollUp",(t=>{n._gantt.eventManager.isDraging=!1})),n.scrollbarComponent.hScrollBar.addEventListener("pointermove",(t=>{t.stopPropagation()})),n.scrollbarComponent.hScrollBar.addEventListener("pointerdown",(t=>{t.stopPropagation()})),n.scrollbarComponent.hScrollBar.addEventListener("scrollDown",(t=>{n._gantt.eventManager.isDown=!0,i.interactionState!==lu.scrolling&&i.updateInteractionState(lu.scrolling)})),n.scrollbarComponent.hScrollBar.addEventListener("pointerup",(()=>{i.interactionState===lu.scrolling&&i.updateInteractionState(lu.default)})),n.scrollbarComponent.hScrollBar.addEventListener("pointerupoutside",(()=>{i.interactionState===lu.scrolling&&i.updateInteractionState(lu.default)})),n.scrollbarComponent.hScrollBar.addEventListener("scrollUp",(t=>{n._gantt.eventManager.isDraging=!1}));const s=pu(i.updateVerticalScrollBar,20),r=pu(i.updateHorizontalScrollBar,20);n.scrollbarComponent.vScrollBar.addEventListener("scrollDrag",(t=>{n._gantt.eventManager.isDown&&(n._gantt.eventManager.isDraging=!0),i.interactionState!==lu.scrolling&&i.updateInteractionState(lu.scrolling);const e=t.detail.value[0]/(1-t.detail.value[1]+t.detail.value[0]);s(e,t)})),n.scrollbarComponent.hScrollBar.addEventListener("scrollDrag",(t=>{n._gantt.eventManager.isDown&&(n._gantt.eventManager.isDraging=!0),i.fastScrolling=!0,i.interactionState!==lu.scrolling&&i.updateInteractionState(lu.scrolling);const e=t.detail.value[0]/(1-t.detail.value[1]+t.detail.value[0]);r(e)}))}(this._gantt.eventManager)}refreshAll(){this.tableGroupHeight=Math.min(this._gantt.tableNoFrameHeight,this._gantt.drawHeight),this.tableGroupWidth=this._gantt.tableNoFrameWidth,this.ganttGroup.setAttribute("height",this.tableGroupHeight),this.ganttGroup.setAttribute("width",this.tableGroupWidth),this.timelineHeader.refresh(),this.grid.refresh(),this.taskBar.refresh(),this.dependencyLink.refresh(),this.markLine.refresh(),this.dependencyLink.refresh(),this.frameBorder.refresh(),this.scrollbarComponent.updateScrollBar(),this.updateNextFrame()}refreshTaskBars(){this.dependencyLink.refresh(),this.taskBar.refresh(),this.updateNextFrame()}refreshTaskBarsAndGrid(){this._gantt.verticalSplitResizeLine.style.height=this._gantt.drawHeight+"px",this.tableGroupHeight=Math.min(this._gantt.tableNoFrameHeight,this._gantt.drawHeight),this.ganttGroup.setAttribute("height",this.tableGroupHeight),this.grid.refresh(),this.taskBar.refresh(),this.dependencyLink.refresh(),this.markLine.refresh(),this.frameBorder.resize(),this.scrollbarComponent.updateScrollBar(),this.updateNextFrame()}updateTableSize(){this.tableGroupHeight=Math.min(this._gantt.tableNoFrameHeight,this._gantt.drawHeight),this.tableGroupWidth=this._gantt.tableNoFrameWidth,this.ganttGroup.setAttributes({x:this._gantt.tableX,y:this._gantt.tableY,width:this._gantt.tableNoFrameWidth,height:this.tableGroupHeight}),this.grid.resize(),this.taskBar.resize(),this.dependencyLink.resize(),this.markLine.refresh(),this.frameBorder.resize()}updateStageBackground(){this.stage.background=this._gantt.parsedOptions.underlayBackgroundColor,this.updateNextFrame()}renderSceneGraph(){this.stage.render()}updateNextFrame(){this.stage.renderNextFrame()}get width(){var t,e;return null!==(e=null===(t=this.ganttGroup.attribute)||void 0===t?void 0:t.width)&&void 0!==e?e:0}get height(){var t,e;return null!==(e=null===(t=this.ganttGroup.attribute)||void 0===t?void 0:t.height)&&void 0!==e?e:0}get x(){var t,e;return null!==(e=null===(t=this.ganttGroup.attribute)||void 0===t?void 0:t.x)&&void 0!==e?e:0}get y(){var t,e;return null!==(e=null===(t=this.ganttGroup.attribute)||void 0===t?void 0:t.y)&&void 0!==e?e:0}setX(t){this.timelineHeader.setX(t),this.grid.setX(t),this.taskBar.setX(t),this.dependencyLink.setX(t),this.markLine.setX(t),this.updateNextFrame()}setY(t){this.grid.setY(t),this.taskBar.setY(t),this.dependencyLink.setY(t),this.updateNextFrame()}setPixelRatio(t){this.stage.disableDirtyBounds(),this.stage.window.setDpr(t),this.stage.render(),this.stage.enableDirtyBounds()}resize(){this.updateTableSize(),this.scrollbarComponent.updateScrollBar(),this.updateNextFrame()}release(){this.stage.release()}showTaskCreationButton(t,e,i){this.taskCreationButton||(this.taskCreationButton=new op(this._gantt.scenegraph));const n=this._gantt.parsedOptions.taskBarCreationMaxWidth,s=this._gantt.parsedOptions.taskBarCreationMinWidth,r=this._gantt.getDateColWidth(i),a=n?Math.min(n,s?Math.max(s,r):r):s?Math.max(s,r):r,o=t-(a-r)/2;this.taskCreationButton.show(o,e,a,this._gantt.parsedOptions.rowHeight),this.updateNextFrame()}hideTaskCreationButton(){this.taskCreationButton&&(this.taskCreationButton.hide(),this.updateNextFrame())}showToolTip(t){this.toolTip||(this.toolTip=new lp(this._gantt.scenegraph)),this.toolTip.show(t)}hideToolTip(){this.toolTip.hide()}refreshRecordLinkNodes(t,e,i){let n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;const s=this._gantt,r=s.getRecordByIndex(t,e),a=r.vtable_gantt_linkedTo,o=r.vtable_gantt_linkedFrom;for(let r=0;r<(null==a?void 0:a.length);r++){const o=a[r],l=o.vtable_gantt_linkLineNode,h=o.vtable_gantt_linkArrowNode,{linkedToTaskKey:d,linkedFromTaskKey:c,type:u}=o,{taskKeyField:p,minDate:g}=s.parsedOptions,f=Gu(s.records,p,c),v=Gu(s.records,p,d);let m,b,y,x,_,w,T,S,k;const B=this._gantt.getTaskBarStyle(t,e);if(s.parsedOptions.tasksShowMode===du.Sub_Tasks_Inline){const t=Xu(i.attribute.y+n,s);S=f.index[0],T=s.getRowsHeightByIndex(0,t.task_index-1)/s.parsedOptions.rowHeight,({startDate:m,endDate:b,taskDays:y}=s.getTaskInfoByTaskListIndex(v.index[0],v.index[1])),({startDate:x,endDate:_,taskDays:w}=s.getTaskInfoByTaskListIndex(f.index[0],f.index[1]));const e=B.width;k=i.attribute.y+e/2-(T+.5)*s.parsedOptions.rowHeight}else if(s.parsedOptions.tasksShowMode===du.Project_Sub_Tasks_Inline){const t=s.getTaskShowIndexByRecordIndex(f.index.slice(0,-1)),e=s.getTaskShowIndexByRecordIndex(v.index.slice(0,-1)),i=s.getRecordByIndex(t),n=s.getRecordByIndex(e);S=i.type===cu.PROJECT&&"expand"!==i.hierarchyState&&!1!==s.parsedOptions.projectSubTasksExpandable?t:s.getTaskShowIndexByRecordIndex(f.index),T=n.type===cu.PROJECT&&"expand"!==n.hierarchyState&&!1!==s.parsedOptions.projectSubTasksExpandable?e:s.getTaskShowIndexByRecordIndex(v.index),({startDate:m,endDate:b,taskDays:y}=s.getTaskInfoByTaskListIndex(T,v.index)),({startDate:x,endDate:_,taskDays:w}=s.getTaskInfoByTaskListIndex(S,f.index))}else if(s.parsedOptions.tasksShowMode===du.Sub_Tasks_Separate||s.parsedOptions.tasksShowMode===du.Sub_Tasks_Arrange||s.parsedOptions.tasksShowMode===du.Sub_Tasks_Compact){const t=Xu(i.attribute.y+n,s);S=s.getRowsHeightByIndex(0,f.index[0]-1)/s.parsedOptions.rowHeight+(s.parsedOptions.tasksShowMode===du.Sub_Tasks_Arrange||s.parsedOptions.tasksShowMode===du.Sub_Tasks_Compact?f.record.vtable_gantt_showIndex:f.index[1]),T=s.getRowsHeightByIndex(0,t.task_index-1)/s.parsedOptions.rowHeight+(s.parsedOptions.tasksShowMode===du.Sub_Tasks_Arrange||s.parsedOptions.tasksShowMode===du.Sub_Tasks_Compact?v.record.vtable_gantt_showIndex:t.sub_task_index),({startDate:m,endDate:b,taskDays:y}=s.getTaskInfoByTaskListIndex(v.index[0],v.index[1])),({startDate:x,endDate:_,taskDays:w}=s.getTaskInfoByTaskListIndex(f.index[0],f.index[1]));const e=B.width;k=i.attribute.y+e/2-(T+.5)*s.parsedOptions.rowHeight}else{if(S=s.getTaskShowIndexByRecordIndex(f.index),T=s.getTaskShowIndexByRecordIndex(v.index),-1===S||-1===T)continue;({startDate:m,endDate:b,taskDays:y}=s.getTaskInfoByTaskListIndex(T)),({startDate:x,endDate:_,taskDays:w}=s.getTaskInfoByTaskListIndex(S))}if(!(x&&_&&m&&b&&l&&h))return;const{linePoints:A,arrowPoints:C}=dp(u,x,_,S,0,f.record.type===cu.MILESTONE,null,0,m,b,T,0,v.record.type===cu.MILESTONE,i,null!=k?k:0,this._gantt);l.setAttribute("points",A),h.setAttribute("points",C)}for(let r=0;r<(null==o?void 0:o.length);r++){const a=o[r],l=a.vtable_gantt_linkLineNode,h=a.vtable_gantt_linkArrowNode,{linkedToTaskKey:d,linkedFromTaskKey:c,type:u}=a,{taskKeyField:p,minDate:g}=s.parsedOptions,f=Gu(s.records,p,d),v=Gu(s.records,p,c);let m,b,y,x,_,w,T,S,k;const B=this._gantt.getTaskBarStyle(t,e);if(s.parsedOptions.tasksShowMode===du.Sub_Tasks_Inline){const t=Xu(i.attribute.y+n,s);S=s.getRowsHeightByIndex(0,t.task_index-1)/s.parsedOptions.rowHeight,T=f.index[0],({startDate:m,endDate:b,taskDays:y}=s.getTaskInfoByTaskListIndex(f.index[0],f.index[1])),({startDate:x,endDate:_,taskDays:w}=s.getTaskInfoByTaskListIndex(v.index[0],v.index[1]));const e=B.width;k=i.attribute.y+e/2-(S+.5)*s.parsedOptions.rowHeight}else if(s.parsedOptions.tasksShowMode===du.Project_Sub_Tasks_Inline){const t=s.getTaskShowIndexByRecordIndex(v.index.slice(0,-1)),e=s.getTaskShowIndexByRecordIndex(f.index.slice(0,-1)),i=s.getRecordByIndex(t),n=s.getRecordByIndex(e);S=i.type===cu.PROJECT&&"expand"!==i.hierarchyState&&!1!==s.parsedOptions.projectSubTasksExpandable?t:s.getTaskShowIndexByRecordIndex(v.index),T=n.type===cu.PROJECT&&"expand"!==n.hierarchyState&&!1!==s.parsedOptions.projectSubTasksExpandable?e:s.getTaskShowIndexByRecordIndex(f.index),({startDate:m,endDate:b,taskDays:y}=s.getTaskInfoByTaskListIndex(T,f.index)),({startDate:x,endDate:_,taskDays:w}=s.getTaskInfoByTaskListIndex(S,v.index))}else if(s.parsedOptions.tasksShowMode===du.Sub_Tasks_Separate||s.parsedOptions.tasksShowMode===du.Sub_Tasks_Arrange||s.parsedOptions.tasksShowMode===du.Sub_Tasks_Compact){const t=Xu(i.attribute.y+n,s);S=s.getRowsHeightByIndex(0,t.task_index-1)/s.parsedOptions.rowHeight+(s.parsedOptions.tasksShowMode===du.Sub_Tasks_Arrange||s.parsedOptions.tasksShowMode===du.Sub_Tasks_Compact?v.record.vtable_gantt_showIndex:t.sub_task_index),T=s.getRowsHeightByIndex(0,f.index[0]-1)/s.parsedOptions.rowHeight+(s.parsedOptions.tasksShowMode===du.Sub_Tasks_Arrange||s.parsedOptions.tasksShowMode===du.Sub_Tasks_Compact?f.record.vtable_gantt_showIndex:f.index[1]),({startDate:m,endDate:b,taskDays:y}=s.getTaskInfoByTaskListIndex(f.index[0],f.index[1])),({startDate:x,endDate:_,taskDays:w}=s.getTaskInfoByTaskListIndex(v.index[0],v.index[1]));const e=B.width;k=i.attribute.y+e/2-(S+.5)*s.parsedOptions.rowHeight}else{if(S=s.getTaskShowIndexByRecordIndex(v.index),T=s.getTaskShowIndexByRecordIndex(f.index),-1===S||-1===T)continue;({startDate:m,endDate:b,taskDays:y}=s.getTaskInfoByTaskListIndex(T)),({startDate:x,endDate:_,taskDays:w}=s.getTaskInfoByTaskListIndex(S))}if(!(x&&_&&m&&b&&l&&h))return;const{linePoints:A,arrowPoints:C}=dp(u,x,_,S,0,v.record.type===cu.MILESTONE,i,null!=k?k:0,m,b,T,0,f.record.type===cu.MILESTONE,null,0,this._gantt);l.setAttribute("points",A),h.setAttribute("points",C)}}}const pp=(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 gp(t,e,i){let n,s,r,a,o,l,h=0,d=!1,c=!1,u=!0;const p=!e&&0!==e&&"function"==typeof requestAnimationFrame;if("function"!=typeof t)throw new TypeError("Expected a function");function g(e){const i=n,r=s;return s=void 0,n=void 0,h=e,a=t.apply(r,i),a}function f(t,e){return p?requestAnimationFrame(t):setTimeout(t,e)}function v(t){const i=t-l;return void 0===l||i>=e||i<0||d&&t-h>=r}function m(){const t=Date.now();if(v(t))return function(t){return o=void 0,u&&n?g(t):(s=void 0,n=void 0,a)}(t);o=f(m,function(t){const i=t-h,n=e&&-(t-l);return d?Math.min(n,r-i):n}(t))}return e=+e||0,pp(i,"object")&&(c=!!i.leading,d="maxWait"in i,d&&(r=Math.max(+i.maxWait||0,e)),u="trailing"in i?!!i.trailing:u),function(){const t=Date.now(),i=v(t);for(var r=arguments.length,u=new Array(r),p=0;p<r;p++)u[p]=arguments[p];if(n=u,s=this,l=t,i){if(void 0===o)return function(t){return h=t,o=f(m,e),c?g(t):a}(l);if(d)return o=f(m,e),g(l)}return void 0===o&&(o=f(m,e)),a}}let fp=1;class vp{constructor(t,e,i){var n;if(this.resizeTime=100,this.lastSize={width:0,height:0},this.mutationResize=()=>{this.onResize()},this.callBack=()=>{const t=this.getSize();let e=!1;t.width===this.lastSize.width&&t.height===this.lastSize.height&&(e=!0),this.lastSize=t,this.cb&&this.cb(Object.assign(Object.assign({},this.lastSize),{windowSizeNotChange:e}))},this.onResize=()=>{this.callBackDebounce()},this.element=t,this.cb=e,this.lastSize=this.getSize(),i&&(this.resizeTime=Math.max(i,16)),this.callBackDebounce=gp(this.callBack,this.resizeTime),null===window||void 0===window||window.addEventListener("resize",this.onResize),"ResizeObserver"in window){const t=window.ResizeObserver;this.observer=new t(this.mutationResize),null===(n=this.observer)||void 0===n||n.observe(this.element)}else"MutationObserver"in window&&(this.observer=new MutationObserver(this.mutationResize),this.observer.observe(this.element,{attributes:!0,attributeFilter:["style"]}))}disConnect(){window.removeEventListener("resize",this.onResize),this.observer&&(this.observer.disconnect(),this.observer=void 0)}setSize(t){this.lastSize=t}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)}:Object.assign({},this.lastSize)}}class mp{constructor(){this.listeners={},this.reseizeListeners={}}on(t,e,i){if("node"===Eu.mode)return-1;const n=fp++;for(var s=arguments.length,r=new Array(s>3?s-3:0),a=3;a<s;a++)r[a-3]=arguments[a];if(null==t?void 0:t.addEventListener)if("resize"!==e||t===window)null==t||t.addEventListener(e,i,...r);else{const e=new vp(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){var n=this;if("node"===Eu.mode)return-1;for(var s=arguments.length,r=new Array(s>3?s-3:0),a=3;a<s;a++)r[a-3]=arguments[a];const o=this.on(t,e,(function(){n.off(o),i(...arguments)}),...r);return o}off(t){var e;if("node"===Eu.mode)return;if(null==t)return;const i=null===(e=this.listeners)||void 0===e?void 0:e[t];i&&(delete this.listeners[t],i.target.removeEventListener&&i.target.removeEventListener(i.type,i.listener,...i.options))}fire(t,e){if("node"!==Eu.mode){for(var i=arguments.length,n=new Array(i>2?i-2:0),s=2;s<i;s++)n[s-2]=arguments[s];for(const i in this.listeners){const s=this.listeners[i];s.target===t&&s.type===e&&s.listener.call(s.target,...n)}}}hasListener(t,e){if("node"===Eu.mode)return!1;let i=!1;for(const n in this.listeners){const s=this.listeners[n];s.target===t&&s.type===e&&(i=!0)}return i}clear(){if("node"!==Eu.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];null==e||e.disConnect()}this.listeners={}}}release(){"node"!==Eu.mode&&(this.clear(),this.listeners={})}}let bp=1;function yp(){return Fu?bp=1:(bp=Math.ceil(window.devicePixelRatio||1),bp>1&&bp%2!=0&&(bp+=1)),bp}function xp(t){return!!t.changedTouches}yp();class _p{constructor(){}setScrollHandle(t){this.scrollHandle=t}startInertia(t,e,i){this.stopped=!1,this.lastTime=Date.now(),this.speedX=t,this.speedY=e,this.friction=i,this.runingId||(this.runingId=requestAnimationFrame(this.inertia.bind(this)))}inertia(){var t;if(this.stopped)return;const e=Date.now(),i=e-this.lastTime;let n=!0;const s=Math.pow(this.friction,i/16),r=s*this.speedX,a=s*this.speedY;let o=0,l=0;Math.abs(r)>.05&&(n=!1,o=(this.speedX+r)/2*i),Math.abs(a)>.05&&(n=!1,l=(this.speedY+a)/2*i),null===(t=this.scrollHandle)||void 0===t||t.call(this,o,l),n?this.runingId=null:(this.lastTime=e,this.speedX=r,this.speedY=a,this.runingId=requestAnimationFrame(this.inertia.bind(this)))}endInertia(){cancelAnimationFrame(this.runingId),this.runingId=null,this.stopped=!0}isInertiaScrolling(){return!!this.runingId}}class wp{constructor(t){this.isDown=!1,this.isDraging=!1,this.globalEventListeners=[],this._enableTableScroll=!0,this._gantt=t,this.inertiaScroll=new _p,this._eventHandler=new mp,this.bindEvent()}release(){this._eventHandler.release(),this.globalEventListeners.forEach((t=>{"document"===t.env?document.removeEventListener(t.name,t.callback):"body"===t.env?document.body.removeEventListener(t.name,t.callback):"window"===t.env&&window.removeEventListener(t.name,t.callback)})),this.globalEventListeners=[],this.inertiaScroll.endInertia()}bindEvent(){(function(t){const e=t._gantt.scenegraph,i=t._gantt,n=i.stateManager;e.ganttGroup.addEventListener("pointerdown",(s=>{if(0!==s.button)return;let r,a,o;if(s.detailPath.find((t=>"task-bar"===t.name?(r=t,!0):"task-creation-button"===t.name||("task-bar-link-point-left"===t.name?(a=t,!0):"task-bar-link-point-right"===t.name?(o=t,!0):!!t.attribute.vtable_link&&(t.attribute.vtable_link,!0)))),r){const a=r.record;if((null==a?void 0:a.type)!==cu.PROJECT)if("task-bar-hover-shadow-left-icon"===s.target.name)n.startResizeTaskBar(r,s.nativeEvent.x,s.nativeEvent.y,s.offset.y,"left"),n.updateInteractionState(lu.grabing);else if("task-bar-hover-shadow-right-icon"===s.target.name)n.startResizeTaskBar(r,s.nativeEvent.x,s.nativeEvent.y,s.offset.y,"right"),n.updateInteractionState(lu.grabing);else if(i.parsedOptions.taskBarMoveable){const a=()=>{let t=!0;if("function"==typeof i.parsedOptions.taskBarMoveable){const{startDate:n,endDate:s,taskRecord:a}=e._gantt.getTaskInfoByTaskListIndex(r.task_index,r.sub_task_index),o={index:r.task_index,startDate:n,endDate:s,taskRecord:a,ganttInstance:e._gantt};t=i.parsedOptions.taskBarMoveable(o)}else t=i.parsedOptions.taskBarMoveable;t&&(n.startMoveTaskBar(r,s.nativeEvent.x,s.nativeEvent.y,s.offset.y),n.updateInteractionState(lu.grabing))};"touch"===s.pointerType?(t.touchEnd=!1,t.touchSetTimeout=setTimeout((()=>{t.isTouchdown=!1,t.isLongTouch=!0,a()}),100)):a()}}else a?(n.startCreateDependencyLine(a,s.nativeEvent.x,s.nativeEvent.y,s.offset.y,"left"),n.updateInteractionState(lu.grabing)):o&&(n.startCreateDependencyLine(o,s.nativeEvent.x,s.nativeEvent.y,s.offset.y,"right"),n.updateInteractionState(lu.grabing))})),e.ganttGroup.addEventListener("pointermove",(s=>{var r,a,o,l,h;if(t.touchSetTimeout&&(clearTimeout(t.touchSetTimeout),t.touchSetTimeout=void 0),n.interactionState===lu.default){const t=s.detailPath.find((t=>"task-bar"===t.name)),o=s.detailPath.find((t=>"markline-hover-group"===t.name)),l=s.detailPath.find((t=>"mark-line-content"===t.name));if((null===(r=i.parsedOptions.markLineCreateOptions)||void 0===r?void 0:r.markLineCreatable)&&(o&&!function(t,e){const i=t.startDate.getTime(),n=t.endDate.getTime();return e.some((t=>{const e=new Date(t.date).getTime();return e>=i&&e<=n}))}(o.data,i.parsedOptions.markLine)?e._gantt.stateManager.marklineIcon.target!==o&&(e._gantt.stateManager.marklineIcon.target=o,n.showMarklineIconHover()):e._gantt.stateManager.marklineIcon.target&&n.hideMarklineIconHover()),t){if(e._gantt.stateManager.hoverTaskBar.target!==t){e._gantt.stateManager.hoverTaskBar.target=t;const i=t.task_index,r=t.sub_task_index,a=t.record;a.type!==cu.PROJECT&&n.showTaskBarHover(),e._gantt.hasListeners(uu.MOUSEENTER_TASK_BAR)&&e._gantt.fireListeners(uu.MOUSEENTER_TASK_BAR,{federatedEvent:s,event:s.nativeEvent,index:i,sub_task_index:r,record:a})}}else{if(e._gantt.stateManager.hoverTaskBar.target){if(e._gantt.hasListeners(uu.MOUSELEAVE_TASK_BAR)){const t=e._gantt.stateManager.hoverTaskBar.target.task_index,i=e._gantt.stateManager.hoverTaskBar.target.sub_task_index,n=e._gantt.getRecordByIndex(t,i);e._gantt.fireListeners(uu.MOUSELEAVE_TASK_BAR,{federatedEvent:s,event:s.nativeEvent,index:t,sub_task_index:i,record:n})}n.hideTaskBarHover(s)}if(i.parsedOptions.taskBarCreatable&&!l){const t=Xu(s.offset.y-i.headerHeight+i.stateManager.scrollTop,i),e=i.getTaskInfoByTaskListIndex(t.task_index,t.sub_task_index);let n=!0;if("function"==typeof i.parsedOptions.taskBarCreatable){const{startDate:s,endDate:r,taskRecord:a}=e,o={index:t.task_index,sub_task_index:t.sub_task_index,startDate:s,endDate:r,taskRecord:a,ganttInstance:i};n=i.parsedOptions.taskBarCreatable(o)}else n=i.parsedOptions.taskBarCreatable;if(n){const n=function(t,e,i){const n=Xu(e-i.headerHeight+i.stateManager.scrollTop,i),s=i.getRecordByIndex(n.task_index),r=Nu(t,i),a=i.getDateRangeByIndex(r);if(null==s?void 0:s.children){const t=Xu(e-i.headerHeight+i.stateManager.scrollTop,i);for(let e=0;e<s.children.length;e++){const{startDate:n,endDate:r,taskDays:o,progress:l,taskRecord:h}=i.getTaskInfoByTaskListIndex(t.task_index,e);if(((i.parsedOptions.tasksShowMode===du.Sub_Tasks_Compact||i.parsedOptions.tasksShowMode===du.Sub_Tasks_Arrange)&&h.vtable_gantt_showIndex===t.sub_task_index||i.parsedOptions.tasksShowMode===du.Sub_Tasks_Inline||i.parsedOptions.tasksShowMode===du.Project_Sub_Tasks_Inline&&s.type===cu.PROJECT&&"expand"!==s.hierarchyState&&!1!==i.parsedOptions.projectSubTasksExpandable)&&a.startDate.getTime()>=n.getTime()&&a.endDate.getTime()<=r.getTime())return{startDate:n,endDate:r,taskDays:o,progress:l,taskRecord:h}}}}(s.offset.x,s.offset.y,i);if((i.parsedOptions.tasksShowMode===du.Sub_Tasks_Separate||i.parsedOptions.tasksShowMode===du.Tasks_Separate)&&!e.taskDays&&e.taskRecord&&!e.taskRecord.vtableMerge||(i.parsedOptions.tasksShowMode===du.Sub_Tasks_Inline||i.parsedOptions.tasksShowMode===du.Sub_Tasks_Arrange||i.parsedOptions.tasksShowMode===du.Sub_Tasks_Compact)&&!n){const e=Nu(s.offset.x,i),n=(e>=1?i.getDateColsWidth(0,e-1):0)-i.stateManager.scroll.horizontalBarPos,r=i.taskListTableInstance.getRowsHeight(i.taskListTableInstance.columnHeaderLevelCount,t.task_index+i.taskListTableInstance.columnHeaderLevelCount-1)+(null!==(a=t.sub_task_index)&&void 0!==a?a:0)*i.parsedOptions.rowHeight-i.stateManager.scroll.verticalBarPos;return void i.scenegraph.showTaskCreationButton(n,r,e)}}}}i.scenegraph.hideTaskCreationButton()}else if(n.interactionState===lu.grabing){let t,i,r;s.detailPath.find((e=>"task-bar"===e.name?(t=e,!0):"task-creation-button"===e.name||("task-bar-link-point-left"===e.name?(i=e,!0):"task-bar-link-point-right"===e.name?(r=e,!0):!!e.attribute.vtable_link&&(e.attribute.vtable_link,!0)))),t=null!==(l=null!=t?t:null===(o=null==i?void 0:i.parent)||void 0===o?void 0:o.attribute.attachedToTaskBarNode)&&void 0!==l?l:null===(h=null==r?void 0:r.parent)||void 0===h?void 0:h.attribute.attachedToTaskBarNode,e._gantt.stateManager.isCreatingDependencyLine()&&!t?n.hideSecondTaskBarSelectedBorder():e._gantt.stateManager.isCreatingDependencyLine()&&i&&e._gantt.stateManager.selectedTaskBar.target!==t?(n.highlightLinkPointNode(i),n.creatingDenpendencyLink.lastHighLightLinkPoint=i,n.creatingDenpendencyLink.secondTaskBarPosition="left"):e._gantt.stateManager.isCreatingDependencyLine()&&r&&e._gantt.stateManager.selectedTaskBar.target!==t?(n.highlightLinkPointNode(r),n.creatingDenpendencyLink.lastHighLightLinkPoint=r,n.creatingDenpendencyLink.secondTaskBarPosition="right"):e._gantt.stateManager.isCreatingDependencyLine()&&t&&e._gantt.stateManager.selectedTaskBar.target!==t&&(n.unhighlightLinkPointNode(n.creatingDenpendencyLink.lastHighLightLinkPoint),n.creatingDenpendencyLink.secondTaskBarNode&&n.creatingDenpendencyLink.secondTaskBarNode===t||(n.creatingDenpendencyLink.secondTaskBarNode&&n.creatingDenpendencyLink.secondTaskBarNode!==t&&n.hideSecondTaskBarSelectedBorder(),n.creatingDenpendencyLink.secondTaskBarNode=t,n.showSecondTaskBarSelectedBorder()))}})),e.ganttGroup.addEventListener("pointerup",(s=>{var r,a;if(t.touchSetTimeout&&(clearTimeout(t.touchSetTimeout),t.touchSetTimeout=void 0),0===s.button){let o,l,h,d=!1,c=!1,u=!1,p=!1,g=!1,f=!1,v=!1;const m=s.detailPath.find((t=>"task-bar"===t.name?(d=!0,!0):"task-creation-button"===t.name?(c=!0,!1):"task-bar-link-point-left"===t.name?(p=!0,!1):"task-bar-link-point-right"===t.name?(g=!0,!1):t.attribute.vtable_link?(u=!0,o=t.attribute.vtable_link,!1):"markline-hover-group"===t.name?(f=!0,h=t,!1):"mark-line-content"===t.name&&(v=!0,l=t,!1)));if(d&&e._gantt.parsedOptions.taskBarSelectable&&"down"===t.poniterState){if(n.hideDependencyLinkSelectedLine(),n.showTaskBarSelectedBorder(m),i.hasListeners(uu.CLICK_TASK_BAR)){const t=m.task_index,e=m.sub_task_index,n=i.getRecordByIndex(t,e);i.fireListeners(uu.CLICK_TASK_BAR,{federatedEvent:s,event:s.nativeEvent,index:t,sub_task_index:e,record:n})}}else if(c&&"down"===t.poniterState){n.hideDependencyLinkSelectedLine(),n.hideTaskBarSelectedBorder();const t=Xu(s.offset.y-i.headerHeight+i.stateManager.scrollTop,i);if(i.parsedOptions.tasksShowMode===du.Sub_Tasks_Arrange||i.parsedOptions.tasksShowMode===du.Sub_Tasks_Inline||i.parsedOptions.tasksShowMode===du.Sub_Tasks_Compact){if(i.hasListeners(uu.CREATE_TASK_SCHEDULE)){const e=Nu(s.offset.x,i),n=i.getDateRangeByIndex(e),a=null!==(r=i.parsedOptions.dateFormat)&&void 0!==r?r:i.parsedOptions.timeScaleIncludeHour?"yyyy-mm-dd hh:mm:ss":"yyyy-mm-dd";i.fireListeners(uu.CREATE_TASK_SCHEDULE,{federatedEvent:s,event:s.nativeEvent,index:t.task_index,sub_task_index:t.sub_task_index,startDate:gu(n.startDate,a),endDate:gu(n.endDate,a),record:void 0,parentRecord:i.getRecordByIndex(t.task_index)})}}else{const e=i.getTaskInfoByTaskListIndex(t.task_index,t.sub_task_index);if(e.taskRecord){const n=null!==(a=i.parsedOptions.dateFormat)&&void 0!==a?a:i.parsedOptions.timeScaleIncludeHour?"yyyy-mm-dd hh:mm:ss":"yyyy-mm-dd",r=Nu(s.offset.x,i),o=i.getDateRangeByIndex(r);e.taskRecord[i.parsedOptions.startDateField]=gu(o.startDate,n),e.taskRecord[i.parsedOptions.endDateField]=gu(o.endDate,n),i.scenegraph.hideTaskCreationButton(),i.updateTaskRecord(e.taskRecord,t.task_index,t.sub_task_index),i.hasListeners(uu.CREATE_TASK_SCHEDULE)&&i.fireListeners(uu.CREATE_TASK_SCHEDULE,{federatedEvent:s,event:s.nativeEvent,index:t.task_index,sub_task_index:t.sub_task_index,startDate:e.taskRecord[i.parsedOptions.startDateField],endDate:e.taskRecord[i.parsedOptions.endDateField],record:e.taskRecord})}}}else if(u&&e._gantt.parsedOptions.dependencyLinkSelectable&&"down"===t.poniterState)n.hideDependencyLinkSelectedLine(),n.hideTaskBarSelectedBorder(),e._gantt.stateManager.selectedDenpendencyLink.link=o,n.showDependencyLinkSelectedLine();else if((p||g)&&"down"===t.poniterState){if(i.hasListeners(uu.CLICK_DEPENDENCY_LINK_POINT)){const t=Xu(s.offset.y-i.headerHeight+i.stateManager.scrollTop,i),e=i.getRecordByIndex(t.task_index,t.sub_task_index);i.fireListeners(uu.CLICK_DEPENDENCY_LINK_POINT,{event:s.nativeEvent,index:t.task_index,sub_task_index:t.sub_task_index,point:p?"start":"end",record:e})}n.hideTaskBarSelectedBorder()}else if(f&&"down"===t.poniterState)i.hasListeners(uu.CLICK_MARKLINE_CREATE)&&i.fireListeners(uu.CLICK_MARKLINE_CREATE,{event:s.nativeEvent,position:Zu(h,e._gantt),data:e._gantt.stateManager.marklineIcon.target.data});else if(v&&"down"===t.poniterState)i.hasListeners(uu.CLICK_MARKLINE_CONTENT)&&i.fireListeners(uu.CLICK_MARKLINE_CONTENT,{event:s.nativeEvent,position:Zu(l,e._gantt),data:l.data});else if(p&&"draging"===t.poniterState){if(n.isCreatingDependencyLine()){const t=n.endCreateDependencyLine(s.offset.y);i.hasListeners(uu.CREATE_DEPENDENCY_LINK)&&i.fireListeners(uu.CREATE_DEPENDENCY_LINK,{federatedEvent:s,event:s.nativeEvent,link:t})}}else if(g&&"draging"===t.poniterState){if(n.isCreatingDependencyLine()){const t=n.endCreateDependencyLine(s.offset.y);i.hasListeners(uu.CREATE_DEPENDENCY_LINK)&&i.fireListeners(uu.CREATE_DEPENDENCY_LINK,{federatedEvent:s,event:s.nativeEvent,link:t})}}else n.hideDependencyLinkSelectedLine(),n.hideTaskBarSelectedBorder()}})),e.ganttGroup.addEventListener("rightdown",(t=>{let e,n=!1,s=!1;const r=t.detailPath.find((t=>"task-bar"===t.name?(n=!0,!0):!!t.attribute.vtable_link&&(s=!0,e=t.attribute.vtable_link,!1)));if(n){if(i.hasListeners(uu.CONTEXTMENU_TASK_BAR)){const e=r.task_index,n=r.sub_task_index,s=i.getRecordByIndex(e,n);i.fireListeners(uu.CONTEXTMENU_TASK_BAR,{federatedEvent:t,event:t.nativeEvent,index:e,sub_task_index:n,record:s})}}else s&&i.hasListeners(uu.CONTEXTMENU_DEPENDENCY_LINK)&&i.fireListeners(uu.CONTEXTMENU_DEPENDENCY_LINK,{federatedEvent:t,event:t.nativeEvent,link:e})})),e.ganttGroup.addEventListener("pointerenter",(t=>{(i.parsedOptions.scrollStyle.horizontalVisible&&"focus"===i.parsedOptions.scrollStyle.horizontalVisible||!i.parsedOptions.scrollStyle.horizontalVisible&&"focus"===i.parsedOptions.scrollStyle.visible)&&e.scrollbarComponent.showHorizontalScrollBar(),(i.parsedOptions.scrollStyle.verticalVisible&&"focus"===i.parsedOptions.scrollStyle.verticalVisible||!i.parsedOptions.scrollStyle.verticalVisible&&"focus"===i.parsedOptions.scrollStyle.visible)&&e.scrollbarComponent.showVerticalScrollBar()})),e.ganttGroup.addEventListener("pointerleave",(t=>{if((i.parsedOptions.scrollStyle.horizontalVisible&&"focus"===i.parsedOptions.scrollStyle.horizontalVisible||!i.parsedOptions.scrollStyle.horizontalVisible&&"focus"===i.parsedOptions.scrollStyle.visible)&&e.scrollbarComponent.hideHorizontalScrollBar(),(i.parsedOptions.scrollStyle.verticalVisible&&"focus"===i.parsedOptions.scrollStyle.verticalVisible||!i.parsedOptions.scrollStyle.verticalVisible&&"focus"===i.parsedOptions.scrollStyle.visible)&&e.scrollbarComponent.hideVerticalScrollBar(),e._gantt.stateManager.hoverTaskBar.target){if(e._gantt.hasListeners(uu.MOUSELEAVE_TASK_BAR)){const i=e._gantt.stateManager.hoverTaskBar.target.task_index,n=e._gantt.stateManager.hoverTaskBar.target.sub_task_index,s=e._gantt.getRecordByIndex(i,n);e._gantt.fireListeners(uu.MOUSELEAVE_TASK_BAR,{federatedEvent:t,event:t.nativeEvent,index:i,sub_task_index:n,record:s})}n.hideTaskBarHover(t)}})),e.ganttGroup.addEventListener("wheel",(t=>{Mu(t,n,i)}))})(this),function(t){const e=t._gantt,i=(t._gantt.scenegraph,e.stateManager),n=t._eventHandler;n.on(e.getElement(),"contextmenu",(t=>{var i;!1!==(null===(i=e.parsedOptions.eventOptions)||void 0===i?void 0:i.preventDefaultContextMenu)&&t.preventDefault()})),n.on(e.getContainer(),"resize",(t=>{0===t.width&&0===t.height||(tu(e.options.pixelRatio)||e.setPixelRatio(yp()),t.windowSizeNotChange||e._resize())})),e.taskListTableInstance&&e.parsedOptions.verticalSplitLineMoveable&&n.on(e.verticalSplitResizeLine,"mousedown",(t=>{i.updateInteractionState(lu.grabing),i.startResizeTableWidth(t)})),e.parsedOptions.verticalSplitLineHighlight&&(e.verticalSplitResizeLine&&n.on(e.verticalSplitResizeLine,"mouseover",(t=>{e.verticalSplitResizeLine.childNodes[1].style.opacity="1"})),e.verticalSplitResizeLine&&n.on(e.verticalSplitResizeLine,"mouseout",(t=>{e.verticalSplitResizeLine.childNodes[1].style.opacity="0"})));const s=t=>{e.eventManager.lastDragPointerXYOnWindow={x:t.x,y:t.y},e.eventManager.poniterState="down"};t.globalEventListeners.push({name:"pointerdown",env:"document",callback:s}),cd.addEventListener("pointerdown",s);const r=t=>{var n,s,r,a,o,l;if("down"===e.eventManager.poniterState){const i=null!==(n=e.eventManager.lastDragPointerXYOnWindow.x)&&void 0!==n?n:t.x,r=t.x-i,a=null!==(s=e.eventManager.lastDragPointerXYOnWindow.y)&&void 0!==s?s:t.y,o=t.y-a;(Math.abs(r)>=1||Math.abs(o)>=1)&&(e.eventManager.poniterState="draging")}if(i.interactionState===lu.grabing&&"draging"===e.eventManager.poniterState){const n=null!==(a=null===(r=e.eventManager.lastDragPointerXYOnWindow)||void 0===r?void 0:r.x)&&void 0!==a?a:t.x,s=null!==(l=null===(o=e.eventManager.lastDragPointerXYOnWindow)||void 0===o?void 0:o.y)&&void 0!==l?l:t.y;(Math.abs(n-t.x)>=1||Math.abs(s-t.y)>=1)&&(i.isResizingTableWidth()?(i.hideDependencyLinkSelectedLine(),i.hideTaskBarSelectedBorder(),i.dealResizeTableWidth(t)):i.isMoveingTaskBar()?(i.hideDependencyLinkSelectedLine(),i.hideTaskBarSelectedBorder(),i.dealTaskBarMove(t)):i.isResizingTaskBar()?(i.hideDependencyLinkSelectedLine(),i.hideTaskBarSelectedBorder(),i.dealTaskBarResize(t)):i.isCreatingDependencyLine()&&i.dealCreateDependencyLine(t),e.eventManager.lastDragPointerXYOnWindow={x:t.x,y:t.y})}};t.globalEventListeners.push({name:"pointermove",env:"document",callback:r}),cd.addEventListener("pointermove",r);const a=t=>{"grabing"===i.interactionState&&(i.updateInteractionState(lu.default),i.isResizingTableWidth()?i.endResizeTableWidth():i.isMoveingTaskBar()?i.endMoveTaskBar():i.isResizingTaskBar()&&i.endResizeTaskBar(t.x)),setTimeout((()=>{e.eventManager.lastDragPointerXYOnWindow=void 0,e.eventManager.poniterState="up"}),0)};t.globalEventListeners.push({name:"pointerup",env:"document",callback:a}),cd.addEventListener("pointerup",a);const o=t=>{var n,s;if(e.parsedOptions.dependencyLinkDeletable&&("Delete"===t.key&&(null===(n=e.parsedOptions.keyboardOptions)||void 0===n?void 0:n.deleteLinkOnDel)||"Backspace"===t.key&&(null===(s=e.parsedOptions.keyboardOptions)||void 0===s?void 0:s.deleteLinkOnBack))&&e.stateManager.selectedDenpendencyLink.link){const n=e.stateManager.selectedDenpendencyLink.link;e.deleteLink(e.stateManager.selectedDenpendencyLink.link),i.hideDependencyLinkSelectedLine(),i.hideTaskBarSelectedBorder(),e.hasListeners(uu.DELETE_DEPENDENCY_LINK)&&e.fireListeners(uu.DELETE_DEPENDENCY_LINK,{event:t,link:n})}};t.globalEventListeners.push({name:"keydown",env:"document",callback:o}),cd.addEventListener("keydown",o)}(this),function(t){const e=t._gantt,i=e.stateManager,n=e.scenegraph;if(!1===cd.envContribution.supportsTouchEvents)return;cd.addEventListener("contextmenu",(t=>{t.stopPropagation(),t.preventDefault()}),{capture:!0}),t.touchMovePoints=[],e.scenegraph.ganttGroup.addEventListener("touchstart",(e=>{e.target.isChildOf(n.scrollbarComponent.vScrollBar)||e.target.isChildOf(n.scrollbarComponent.hScrollBar)||(t.isTouchdown=!0,t.touchMovePoints.push({x:e.page.x,y:e.page.y,timestamp:Date.now()}))}));const s=n=>{if(t.isLongTouch&&n.preventDefault(),t.isTouchdown&&xp(n)&&(t.isTouchMove=!0,t.touchMovePoints.length>4&&t.touchMovePoints.shift(),t.touchMovePoints.push({x:n.changedTouches[0].pageX,y:n.changedTouches[0].pageY,timestamp:Date.now()}),t._enableTableScroll)){const s=-t.touchMovePoints[t.touchMovePoints.length-1].x+t.touchMovePoints[t.touchMovePoints.length-2].x,r=-t.touchMovePoints[t.touchMovePoints.length-1].y+t.touchMovePoints[t.touchMovePoints.length-2].y;Mu(n,i,e),n.cancelable&&("none"===e.parsedOptions.overscrollBehavior||Math.abs(r)>=Math.abs(s)&&0!==r&&Pu(r,i)||Math.abs(r)<=Math.abs(s)&&0!==s&&Du(s,i))&&n.preventDefault()}};cd.addEventListener("touchmove",s,{passive:!1}),t.globalEventListeners.push({name:"touchmove",env:"vglobal",callback:s});const r=i=>{var n,s;if(t.touchEnd=!0,t.isLongTouch=!1,t.isTouchdown&&xp(i)){if((null===(n=t.touchMovePoints)||void 0===n?void 0:n.length)&&(t.touchMovePoints.length>4&&t.touchMovePoints.shift(),t.touchMovePoints.push({x:i.changedTouches[0].pageX,y:i.changedTouches[0].pageY,timestamp:Date.now()}),t._enableTableScroll)){const i=t.touchMovePoints[0],n=t.touchMovePoints[(null===(s=t.touchMovePoints)||void 0===s?void 0:s.length)-1],r=(n.x-i.x)/(n.timestamp-i.timestamp),a=(n.y-i.y)/(n.timestamp-i.timestamp);t.inertiaScroll.startInertia(r,a,.95),e.eventManager.inertiaScroll.setScrollHandle(((t,i)=>{Mu({deltaX:-t,deltaY:-i},e.stateManager,e)}))}t.isTouchdown=!1,t.isTouchMove=!1,t.isDraging=!1,t.touchMovePoints=[]}};cd.addEventListener("touchend",r),t.globalEventListeners.push({name:"touchend",env:"vglobal",callback:r});const a=e=>{t.touchEnd=!0,t.isLongTouch=!1,t.isTouchdown&&(t.isTouchdown=!1,t.isTouchMove=!1,t.touchMovePoints=[],t.isDraging=!1)};cd.addEventListener("touchcancel",a),t.globalEventListeners.push({name:"touchcancel",env:"vglobal",callback:a})}(this)}}function Tp(t){const{scroll:e}=t.stateManager,{verticalBarPos:i}=e;t.taskListTableInstance.stateManager.setScrollTop(i,void 0,!1)}function Sp(t){var e,i,n,s,r,a,o,l;const h=t.taskTableWidth;t.taskTableWidth=t.taskListTableInstance.getAllColsWidth()+t.parsedOptions.outerFrameStyle.borderLineWidth,(null===(i=null===(e=t.options)||void 0===e?void 0:e.taskListTable)||void 0===i?void 0:i.maxTableWidth)&&(t.taskTableWidth=Math.min(null===(s=null===(n=t.options)||void 0===n?void 0:n.taskListTable)||void 0===s?void 0:s.maxTableWidth,t.taskTableWidth)),(null===(a=null===(r=t.options)||void 0===r?void 0:r.taskListTable)||void 0===a?void 0:a.minTableWidth)&&(t.taskTableWidth=Math.max(null===(l=null===(o=t.options)||void 0===o?void 0:o.taskListTable)||void 0===l?void 0:l.minTableWidth,t.taskTableWidth)),h!==t.taskTableWidth&&(t.element.style.left=t.taskTableWidth?`${t.taskTableWidth}px`:"0px",t.taskListTableInstance.setCanvasSize(t.taskTableWidth,t.tableNoFrameHeight+2*t.parsedOptions.outerFrameStyle.borderLineWidth),t._updateSize(),ju(t))}class kp{constructor(t){var e;this.interactionState=lu.default,this.resetInteractionState=gp((()=>{this.updateInteractionState(lu.default)}),100),this._gantt=t,this.scroll={horizontalBarPos:0,verticalBarPos:0},this.moveTaskBar={targetStartX:null,targetStartY:null,deltaX:0,deltaY:0,startOffsetY:null,startX:null,startY:null,moving:!1,target:null,moveTaskBarXSpeed:0,moveTaskBarXInertia:new _p},this.hoverTaskBar={targetStartX:null,startX:null,target:null},this.marklineIcon={target:null},this.selectedTaskBar={target:null},this.resizeTaskBar={startOffsetY:null,targetStartX:null,targetEndX:null,startX:null,startY:null,target:null,resizing:!1,onIconName:""},this.resizeTableWidth={lastX:null,resizing:!1},this.selectedDenpendencyLink={link:null},this.creatingDenpendencyLink={startClickedPoint:null,startX:null,startY:null,startOffsetY:null,targetStartX:null,creating:!1,secondTaskBarNode:null},this.updateVerticalScrollBar=this.updateVerticalScrollBar.bind(this),this.updateHorizontalScrollBar=this.updateHorizontalScrollBar.bind(this),function(t){var e;t.taskListTableInstance&&(null===(e=t.taskListTableInstance)||void 0===e||e.on("scroll",(e=>{if("vertical"===e.scrollDirection){const{scroll:e}=t.taskListTableInstance.stateManager,{verticalBarPos:i}=e;t.stateManager.scroll.verticalBarPos!==i&&t.stateManager.setScrollTop(i,!1)}})))}(this._gantt),function(t){var e;null===(e=t.taskListTableInstance)||void 0===e||e.on("change_cell_value",(e=>{const{col:i,row:n}=e;t.taskListTableInstance.isHeader(i,n)||t._refreshTaskBar(n-t.taskListTableInstance.columnHeaderLevelCount)}))}(this._gantt),function(t){var e,i,n,s;null===(e=t.taskListTableInstance)||void 0===e||e.on("change_header_position",(e=>{t.parsedOptions.tasksShowMode===du.Sub_Tasks_Arrange||t.parsedOptions.tasksShowMode===du.Sub_Tasks_Compact||t.parsedOptions.tasksShowMode===du.Sub_Tasks_Separate||t.parsedOptions.tasksShowMode===du.Project_Sub_Tasks_Inline?t.scenegraph.refreshTaskBarsAndGrid():t.scenegraph.refreshTaskBars(),t.scenegraph.dragOrderLine.hideDragLine();const i=t.stateManager.scroll.horizontalBarPos,n=t.stateManager.scroll.verticalBarPos;t.scenegraph.setX(-i),t.scenegraph.setY(-n)})),null===(i=t.taskListTableInstance)||void 0===i||i.on("change_header_position_start",(e=>{const{col:i,row:n,x:s,y:r,backX:a,lineX:o,backY:l,lineY:h,event:d}=e;t.scenegraph.dragOrderLine.showDragLine(h),t.scenegraph.updateNextFrame()})),null===(n=t.taskListTableInstance)||void 0===n||n.on("changing_header_position",(e=>{const{col:i,row:n,x:s,y:r,backX:a,lineX:o,backY:l,lineY:h,event:d}=e;t.scenegraph.dragOrderLine.showDragLine(h),t.scenegraph.updateNextFrame()})),null===(s=t.taskListTableInstance)||void 0===s||s.on("change_header_position_fail",(e=>{t.scenegraph.dragOrderLine.hideDragLine(),t.scenegraph.updateNextFrame()}))}(this._gantt),function(t){var e;null===(e=t.taskListTableInstance)||void 0===e||e.on("tree_hierarchy_state_change",(e=>{var i,n;const{row:s,hierarchyState:r}=e;if(t.parsedOptions.tasksShowMode===du.Project_Sub_Tasks_Inline){const e=s-t.taskListTableInstance.columnHeaderLevelCount,n=t.getRecordByIndex(e);n&&n.type===cu.PROJECT&&(null===(i=n.children)||void 0===i?void 0:i.length)>0&&(n.hierarchyState=r)}t._syncPropsFromTable(),t.scenegraph.refreshTaskBarsAndGrid(),!t.taskListTableInstance.checkHasColumnAutoWidth()||"auto"!==(null===(n=t.options.taskListTable)||void 0===n?void 0:n.tableWidth)&&-1!==t.taskTableWidth||Sp(t);const a=t.stateManager.scroll.horizontalBarPos,o=t.stateManager.scroll.verticalBarPos;t.scenegraph.setX(-a),t.scenegraph.setY(-o)}))}(this._gantt),function(t){var e;null===(e=t.taskListTableInstance)||void 0===e||e.on("after_sort",(e=>{t.scenegraph.refreshTaskBars();const i=t.stateManager.scroll.horizontalBarPos,n=t.stateManager.scroll.verticalBarPos;t.scenegraph.setX(-i),t.scenegraph.setY(-n)}))}(this._gantt),"auto"!==(null===(e=this._gantt.options.taskListTable)||void 0===e?void 0:e.tableWidth)&&-1!==this._gantt.taskTableWidth||function(t){var e;null===(e=t.taskListTableInstance)||void 0===e||e.on("resize_column",(e=>{Sp(t)}))}(this._gantt)}setScrollTop(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];const i=this._gantt.getAllRowsHeight();t=Math.max(0,Math.min(t,i-this._gantt.scenegraph.height)),t=Math.ceil(t);const n=this.scroll.verticalBarPos;this.scroll.verticalBarPos=t,tu(this.scroll.verticalBarPos)&&!isNaN(this.scroll.verticalBarPos)||(this.scroll.verticalBarPos=0),this._gantt.scenegraph.setY(-t);const s=t/(i-this._gantt.scenegraph.height);this._gantt.scenegraph.scrollbarComponent.updateVerticalScrollBarPos(s),n!==t&&e&&(Tp(this._gantt),this._gantt.fireListeners(uu.SCROLL,{scrollTop:this.scroll.verticalBarPos,scrollLeft:this.scroll.horizontalBarPos,scrollDirection:"vertical",scrollRatioY:s}))}get scrollLeft(){return this.scroll.horizontalBarPos}get scrollTop(){return this.scroll.verticalBarPos}setScrollLeft(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];const i=this._gantt.getAllDateColsWidth();t=Math.max(0,Math.min(t,i-this._gantt.scenegraph.width)),t=Math.ceil(t);const n=this.scroll.horizontalBarPos;this.scroll.horizontalBarPos=t,tu(this.scroll.horizontalBarPos)&&!isNaN(this.scroll.horizontalBarPos)||(this.scroll.horizontalBarPos=0),this._gantt.scenegraph.setX(-t);const s=t/(i-this._gantt.scenegraph.width);this._gantt.scenegraph.scrollbarComponent.updateHorizontalScrollBarPos(s),n!==t&&e&&this._gantt.fireListeners(uu.SCROLL,{scrollTop:this.scroll.verticalBarPos,scrollLeft:this.scroll.horizontalBarPos,scrollDirection:"horizontal",scrollRatioX:s})}updateInteractionState(t){if(this.interactionState===t)return;const e=this.interactionState;this.interactionState=t,e===lu.scrolling&&lu.default}updateVerticalScrollBar(t){const e=this._gantt.getAllRowsHeight();this.scroll.verticalBarPos,this.scroll.verticalBarPos=Math.ceil(t*(e-this._gantt.scenegraph.height)),tu(this.scroll.verticalBarPos)&&!isNaN(this.scroll.verticalBarPos)||(this.scroll.verticalBarPos=0),this._gantt.scenegraph.setY(-this.scroll.verticalBarPos,1===t),Tp(this._gantt),this._gantt.fireListeners(uu.SCROLL,{scrollTop:this.scroll.verticalBarPos,scrollLeft:this.scroll.horizontalBarPos,scrollDirection:"vertical",scrollRatioY:t})}updateHorizontalScrollBar(t){const e=this._gantt.getAllDateColsWidth();this.scroll.horizontalBarPos,this.scroll.horizontalBarPos=Math.ceil(t*(e-this._gantt.scenegraph.width)),tu(this.scroll.horizontalBarPos)&&!isNaN(this.scroll.horizontalBarPos)||(this.scroll.horizontalBarPos=0),this._gantt.scenegraph.setX(-this.scroll.horizontalBarPos,1===t),this._gantt.fireListeners(uu.SCROLL,{scrollTop:this.scroll.verticalBarPos,scrollLeft:this.scroll.horizontalBarPos,scrollDirection:"horizontal",scrollRatioY:t})}startMoveTaskBar(t,e,i,n){"task-bar-hover-shadow"===t.name&&(t=t.parent),this.moveTaskBar.moving=!0,this.moveTaskBar.target=t,this.moveTaskBar.targetStartX=t.attribute.x,this.moveTaskBar.targetStartY=t.attribute.y,this.moveTaskBar.startX=e,this.moveTaskBar.startY=i,this.moveTaskBar.startOffsetY=n,t.setAttribute("zIndex",1e4)}isMoveingTaskBar(){return this.moveTaskBar.moving}endMoveTaskBar(){this.moveTaskBar.moveTaskBarXInertia.isInertiaScrolling()&&this.moveTaskBar.moveTaskBarXInertia.endInertia();const t=this.moveTaskBar.deltaX,e=this.moveTaskBar.deltaY,i=this.moveTaskBar.target;if(Math.abs(t)>=1||Math.abs(e)>=1){const t=i.task_index,n=i.sub_task_index,{startDate:s,endDate:r}=this._gantt.getTaskInfoByTaskListIndex(t,n),a=this.moveTaskBar.targetStartY+this._gantt.parsedOptions.rowHeight*Math.round(e/this._gantt.parsedOptions.rowHeight),o=this._gantt.parsedOptions.taskBarMilestoneStyle.width,l=Nu(this.moveTaskBar.target.attribute.x+(i.record.type===cu.MILESTONE?o/2:0)-this._gantt.stateManager.scroll.horizontalBarPos,this._gantt),h=this._gantt.parsedOptions.reverseSortedTimelineScales[0].timelineDates[l];if(!h)return;const d=h.startDate,c=new Date(d.getTime()+(wu(r).getTime()-wu(s).getTime()));let u;if(wu(s).getTime()!==d.getTime()){u=wu(s).getTime()>d.getTime()?"left":"right",this._gantt._updateStartEndDateToTaskRecord(d,c,t,n);const e=this._gantt.getRecordByIndex(t,n);this._gantt.hasListeners(uu.CHANGE_DATE_RANGE)&&this._gantt.fireListeners(uu.CHANGE_DATE_RANGE,{startDate:e[this._gantt.parsedOptions.startDateField],endDate:e[this._gantt.parsedOptions.endDateField],oldStartDate:s,oldEndDate:r,index:t,record:e})}if(this._gantt.parsedOptions.tasksShowMode===du.Sub_Tasks_Arrange||this._gantt.parsedOptions.tasksShowMode===du.Sub_Tasks_Compact){const t=Xu(a,this._gantt);this._gantt._dragOrderTaskRecord(i.task_index,i.sub_task_index,t.task_index,t.sub_task_index),Vu(this._gantt.records),this._gantt.taskListTableInstance.renderWithRecreateCells(),this._gantt._syncPropsFromTable(),this._gantt.scenegraph.refreshTaskBarsAndGrid()}else if(this._gantt.parsedOptions.tasksShowMode!==du.Tasks_Separate&&Math.abs(Math.round(e/this._gantt.parsedOptions.rowHeight))>=1){const t=Xu(a,this._gantt);this._gantt._dragOrderTaskRecord(i.task_index,i.sub_task_index,t.task_index,t.sub_task_index),this._gantt.parsedOptions.tasksShowMode===du.Sub_Tasks_Separate?(this._gantt.taskListTableInstance.renderWithRecreateCells(),this._gantt.scenegraph.refreshTaskBarsAndGrid()):(this._gantt.scenegraph.taskBar.refresh(),this._gantt.scenegraph.dependencyLink.refresh())}else{let t=l>=1?this._gantt.getDateColsWidth(0,l-1):0;if(i.record.type===cu.MILESTONE&&(t-=this._gantt.parsedOptions.taskBarMilestoneStyle.width/2),Ap(i,t-i.attribute.x,a-i.attribute.y,this),"right"===u){let t=i;for(;t.nextSibling&&t.nextSibling.attribute.y===i.attribute.y&&t.nextSibling.record[this._gantt.parsedOptions.startDateField]<=i.record[this._gantt.parsedOptions.startDateField];)t=t.nextSibling;t!==i&&t.parent.insertAfter(i,t)}else if("left"===u){let t=i;for(;t.previousSibling&&t.previousSibling.attribute.y===i.attribute.y&&t.previousSibling.record[this._gantt.parsedOptions.startDateField]>=i.record[this._gantt.parsedOptions.startDateField];)t=t.previousSibling;t!==i&&t.parent.insertBefore(i,t)}}this._gantt.scenegraph.updateNextFrame()}this.moveTaskBar.moving=!1,this.selectedTaskBar.target!==i&&i.setAttribute("zIndex",0),i.updateTextPosition(),this.moveTaskBar.target=null,this.moveTaskBar.deltaX=0,this.moveTaskBar.deltaY=0,this.moveTaskBar.moveTaskBarXSpeed=0}dealTaskBarMove(t){var e,i,n,s,r,a;const o=this._gantt;let l=this.moveTaskBar.target;l.setAttribute("zIndex",1e4);const h=o.eventManager.lastDragPointerXYOnWindow.x,d=t.x-h,c=o.eventManager.lastDragPointerXYOnWindow.y,u=t.y-c;if(this.moveTaskBar.deltaX+=d,this.moveTaskBar.deltaY+=u,Ap(l,d,u,this),l.attribute.x<=o.stateManager.scrollLeft&&d<0)if(o.parsedOptions.moveTaskBarToExtendDateRange&&0===o.stateManager.scrollLeft){null===(e=this.moveTaskBar.moveTaskBarXInertia)||void 0===e||e.endInertia();const s=o.parsedOptions.reverseSortedTimelineScales[0].timelineDates[1].startDate.getTime()-o.parsedOptions.reverseSortedTimelineScales[0].timelineDates[0].startDate.getTime(),{unit:r,startOfWeek:a}=o.parsedOptions.reverseSortedTimelineScales[0];o.parsedOptions.minDate=Cu(new Date(o.parsedOptions.reverseSortedTimelineScales[0].timelineDates[0].startDate.getTime()-s/2),r,a),o.parsedOptions._minDateTime=null===(i=o.parsedOptions.minDate)||void 0===i?void 0:i.getTime(),o._generateTimeLineDateMap(),o._updateSize(),o.scenegraph.refreshAll(),l=this.moveTaskBar.target=o.scenegraph.taskBar.getTaskBarNodeByIndex(this.moveTaskBar.target.task_index,this.moveTaskBar.target.sub_task_index),o.scrollLeft=o.parsedOptions.timelineColWidth-1,o.eventManager.lastDragPointerXYOnWindow.x=t.x,"milestone"===(null===(n=l.record)||void 0===n?void 0:n.type)?Ap(l,o.scrollLeft-l.attribute.x,0,this):l.setAttribute("x",o.scrollLeft)}else this.moveTaskBar.moveTaskBarXSpeed=-o.parsedOptions.timelineColWidth/100,this.moveTaskBar.moveTaskBarXInertia.startInertia(this.moveTaskBar.moveTaskBarXSpeed,0,1),this.moveTaskBar.moveTaskBarXInertia.setScrollHandle(((t,e)=>{this.moveTaskBar.deltaX+=t,this.moveTaskBar.deltaY+=e,Ap(l,t,e,this),o.stateManager.setScrollLeft(l.attribute.x),0===o.stateManager.scrollLeft&&this.moveTaskBar.moveTaskBarXInertia.endInertia()}));else if(l.attribute.x+l.attribute.width>=o.stateManager.scrollLeft+o.tableNoFrameWidth&&d>0)if(o.parsedOptions.moveTaskBarToExtendDateRange&&o.stateManager.scrollLeft+o.tableNoFrameWidth===o.getAllDateColsWidth()){null===(s=this.moveTaskBar.moveTaskBarXInertia)||void 0===s||s.endInertia();const e=o.parsedOptions.reverseSortedTimelineScales[0].timelineDates,i=e[1].startDate.getTime()-e[0].startDate.getTime(),{unit:n,startOfWeek:h,step:d}=o.parsedOptions.reverseSortedTimelineScales[0];if(o.parsedOptions.maxDate=Au(o.parsedOptions.minDate,new Date(e[e.length-1].endDate.getTime()+i/2),n,d),o.parsedOptions._maxDateTime=null===(r=o.parsedOptions.maxDate)||void 0===r?void 0:r.getTime(),o._generateTimeLineDateMap(),o._updateSize(),o.scenegraph.refreshAll(),l=this.moveTaskBar.target=o.scenegraph.taskBar.getTaskBarNodeByIndex(this.moveTaskBar.target.task_index,this.moveTaskBar.target.sub_task_index),o.scrollLeft+=1,o.eventManager.lastDragPointerXYOnWindow.x=t.x,"milestone"===(null===(a=l.record)||void 0===a?void 0:a.type)){const t=o.scrollLeft+o.tableNoFrameWidth-l.attribute.width;Ap(l,t-l.attribute.x,0,this)}else l.setAttribute("x",o.scrollLeft+o.tableNoFrameWidth-l.attribute.width)}else this.moveTaskBar.moveTaskBarXSpeed=o.parsedOptions.timelineColWidth/100,this.moveTaskBar.moveTaskBarXInertia.startInertia(this.moveTaskBar.moveTaskBarXSpeed,0,1),this.moveTaskBar.moveTaskBarXInertia.setScrollHandle(((t,e)=>{this.moveTaskBar.deltaX+=t,this.moveTaskBar.deltaY+=e,Ap(l,t,e,this),o.stateManager.setScrollLeft(l.attribute.x+l.attribute.width-o.tableNoFrameWidth),o.stateManager.scrollLeft===o.getAllDateColsWidth()-o.tableNoFrameWidth&&this.moveTaskBar.moveTaskBarXInertia.endInertia()}));else this.moveTaskBar.moveTaskBarXInertia.isInertiaScrolling()?this.moveTaskBar.moveTaskBarXInertia.endInertia():this.moveTaskBar.moveTaskBarXSpeed=0;o.scenegraph.updateNextFrame()}startResizeTaskBar(t,e,i,n,s){this.resizeTaskBar.onIconName=s,this.resizeTaskBar.resizing=!0,this.resizeTaskBar.target=t,this.resizeTaskBar.targetStartX=t.attribute.x,this.resizeTaskBar.targetEndX=t.attribute.x+t.attribute.width,this.resizeTaskBar.startX=e,this.resizeTaskBar.startY=i,this.resizeTaskBar.startOffsetY=n}isResizingTaskBar(){return this.resizeTaskBar.resizing}endResizeTaskBar(t){const e=this._gantt.stateManager.resizeTaskBar.onIconName,i=t-this.resizeTaskBar.startX;if(Math.abs(i)>=1){const t=Nu(("left"===e?this.resizeTaskBar.target.attribute.x:this.resizeTaskBar.target.attribute.x+this.resizeTaskBar.target.attribute.width)-this._gantt.stateManager.scroll.horizontalBarPos,this._gantt),i=this._gantt.parsedOptions.reverseSortedTimelineScales[0].timelineDates[t];if(!i)return;const n="left"===e?i.startDate:i.endDate,s=this.resizeTaskBar.target,r=s.clipGroupBox,a=s.barRect,o=s.progressRect,l=s.textLabel,h=s.task_index,d=s.sub_task_index,{taskDays:c,progress:u,startDate:p,endDate:g}=this._gantt.getTaskInfoByTaskListIndex(h,d);let f=!1;if("left"===e?(this._gantt._updateStartDateToTaskRecord(n,h,d),n.getTime()!==new Date(p).getTime()&&(f=!0)):(this._gantt._updateEndDateToTaskRecord(n,h,d),n.getTime()!==new Date(g).getTime()&&(f=!0)),this._gantt.parsedOptions.tasksShowMode===du.Sub_Tasks_Arrange||this._gantt.parsedOptions.tasksShowMode===du.Sub_Tasks_Compact)this._gantt.taskListTableInstance.renderWithRecreateCells(),this._gantt._syncPropsFromTable(),this._gantt.scenegraph.refreshTaskBarsAndGrid();else{if("left"===e){const e=t>=1?this._gantt.getDateColsWidth(0,t-1):0;s.setAttribute("x",e),s.setAttribute("width",this.resizeTaskBar.targetEndX-e)}else if("right"===e){const e=this._gantt.getDateColsWidth(0,t);s.setAttribute("width",e-this.resizeTaskBar.targetStartX)}if(r.setAttribute("width",s.attribute.width),null==a||a.setAttribute("width",s.attribute.width),null==o||o.setAttribute("width",u/100*s.attribute.width),l){const{textAlign:t,textBaseline:e,padding:i}=this._gantt.parsedOptions.taskBarLabelStyle,n=Uu(xu(i),t,e,s.attribute.width,s.attribute.height);l.setAttribute("maxLineWidth",s.attribute.width-20),l.setAttribute("x",n.x)}this._gantt.scenegraph.refreshRecordLinkNodes(h,d,s,0),this.showTaskBarHover(),Bp(this._gantt,s,h,d),s.setAttribute("zIndex",0)}if(s.updateTextPosition(),this.resizeTaskBar.resizing=!1,this.resizeTaskBar.target=null,f&&this._gantt.hasListeners(uu.CHANGE_DATE_RANGE)){const t=this._gantt.getRecordByIndex(h,d);this._gantt.fireListeners(uu.CHANGE_DATE_RANGE,{startDate:t[this._gantt.parsedOptions.startDateField],endDate:t[this._gantt.parsedOptions.endDateField],oldStartDate:p,oldEndDate:g,index:h,record:t})}this._gantt.scenegraph.updateNextFrame()}}dealTaskBarResize(t){const e=this._gantt.eventManager.lastDragPointerXYOnWindow.x,i=t.x-e,n=this._gantt.stateManager.resizeTaskBar.target;let s="left"===this._gantt.stateManager.resizeTaskBar.onIconName?-i:i;const r=Math.max(1,n.attribute.width+s);s=r-n.attribute.width,function(t,e,i,n){const s=n._gantt.parsedOptions.progressField,r=t.clipGroupBox,a=t.barRect,o=t.progressRect,l=t.textLabel,h=t.task_index,d=t.sub_task_index,c=t.record,u=c[s],p=c.type===cu.MILESTONE;if(t.setAttribute("zIndex",1e4),e&&t.setAttribute("x",t.attribute.x+e),p&&t.setAttribute("anchor",[t.attribute.x+t.attribute.width/2,t.attribute.y+t.attribute.height/2]),i&&t.setAttribute("width",i),r.setAttribute("width",t.attribute.width),null==a||a.setAttribute("width",t.attribute.width),null==o||o.setAttribute("width",u/100*t.attribute.width),l){const{textAlign:e,textBaseline:s,padding:r}=n._gantt.parsedOptions.taskBarLabelStyle,a=Uu(xu(r),e,s,i,t.attribute.height);l.setAttribute("maxLineWidth",i-20),l.setAttribute("x",a.x)}t.updateTextPosition(),n.showTaskBarHover(),Bp(n._gantt,t,h,d),n._gantt.scenegraph.refreshRecordLinkNodes(h,d,t,0)}(n,"left"===this._gantt.stateManager.resizeTaskBar.onIconName?-s:0,r,this),this._gantt.scenegraph.updateNextFrame()}startCreateDependencyLine(t,e,i,n,s){this.resizeTaskBar.resizing=!1,this.creatingDenpendencyLink.creating=!0,this.creatingDenpendencyLink.startClickedPoint=t,this.creatingDenpendencyLink.startX=e,this.creatingDenpendencyLink.startY=i,this.creatingDenpendencyLink.startOffsetY=n,this.creatingDenpendencyLink.firstTaskBarPosition=s,this.highlightLinkPointNode(t)}isCreatingDependencyLine(){return this.creatingDenpendencyLink.creating}endCreateDependencyLine(t){const e=this._gantt.parsedOptions.taskKeyField,i=this.selectedTaskBar.target.task_index,n=this.selectedTaskBar.target.sub_task_index,s=this.creatingDenpendencyLink.secondTaskBarNode.task_index,r=this.creatingDenpendencyLink.secondTaskBarNode.sub_task_index,a={linkedFromTaskKey:this._gantt.getRecordByIndex(i,n)[e],linkedToTaskKey:this._gantt.getRecordByIndex(s,r)[e],type:"left"===this.creatingDenpendencyLink.firstTaskBarPosition&&"left"===this.creatingDenpendencyLink.secondTaskBarPosition?hu.StartToStart:"right"===this.creatingDenpendencyLink.firstTaskBarPosition&&"left"===this.creatingDenpendencyLink.secondTaskBarPosition?hu.FinishToStart:"right"===this.creatingDenpendencyLink.firstTaskBarPosition&&"right"===this.creatingDenpendencyLink.secondTaskBarPosition?hu.FinishToFinish:hu.StartToFinish};return this._gantt.addLink(a),this.hideTaskBarSelectedBorder(),this._gantt.scenegraph.updateNextFrame(),this.creatingDenpendencyLink.creating=!1,a}dealCreateDependencyLine(t){const e=this.creatingDenpendencyLink.startX,i=this.creatingDenpendencyLink.startY,n=t.x-e,s=t.y-i,r=this.creatingDenpendencyLink.startClickedPoint,a=r.attribute.x+r.attribute.width/2,o=r.attribute.y+r.attribute.height/2;this._gantt.scenegraph.taskBar.updateCreatingDependencyLine(a,o,a+n,o+s),this._gantt.scenegraph.updateNextFrame()}startResizeTableWidth(t){this.resizeTableWidth.resizing=!0,this.resizeTableWidth.lastX=t.pageX}isResizingTableWidth(){return this.resizeTableWidth.resizing}endResizeTableWidth(){this.resizeTableWidth.resizing=!1}dealResizeTableWidth(t){var e,i;if(!this.resizeTableWidth.resizing)return;const n=t.pageX-this.resizeTableWidth.lastX;if(Math.abs(n)>=1){let s=this._gantt.taskTableWidth+n;const r=Math.min(this._gantt.taskListTableInstance.getAllColsWidth()+this._gantt.parsedOptions.outerFrameStyle.borderLineWidth,null!==(e=this._gantt.options.taskListTable.maxTableWidth)&&void 0!==e?e:1e5),a=Math.max(this._gantt.parsedOptions.outerFrameStyle.borderLineWidth,null!==(i=this._gantt.options.taskListTable.minTableWidth)&&void 0!==i?i:0);n>0&&s>r&&(s=r),n<0&&s<a&&(s=a),this._gantt.taskTableWidth=s,this._gantt.element.style.left=this._gantt.taskTableWidth?`${this._gantt.taskTableWidth}px`:"0px",this._gantt.verticalSplitResizeLine.style.left=this._gantt.taskTableWidth?this._gantt.taskTableWidth-7+"px":"0px",this._gantt._resize(),this.resizeTableWidth.lastX=t.pageX}}showTaskBarHover(){const t=this._gantt.stateManager.hoverTaskBar.target;if(t){const e=t.attribute.x,i=t.attribute.y,n=t.attribute.width,s=t.attribute.height;this._gantt.scenegraph.taskBar.showHoverBar(e,i,n,s,t),this._gantt.scenegraph.updateNextFrame()}}hideTaskBarHover(t){this._gantt.stateManager.hoverTaskBar.target=null,this._gantt.scenegraph.taskBar.hideHoverBar(),this._gantt.scenegraph.updateNextFrame()}showTaskBarSelectedBorder(t){var e;null===(e=this._gantt.stateManager.selectedTaskBar.target)||void 0===e||e.setAttribute("zIndex",0),this._gantt.stateManager.selectedTaskBar.target=t;const i=this._gantt.parsedOptions.dependencyLinkCreatable;t.setAttribute("zIndex",1e4);const n=t.attribute.x,s=t.attribute.y,r=t.attribute.width,a=t.attribute.height;this._gantt.scenegraph.taskBar.createSelectedBorder(n,s,r,a,t,i),this._gantt.scenegraph.updateNextFrame()}hideTaskBarSelectedBorder(){var t;null===(t=this._gantt.stateManager.selectedTaskBar.target)||void 0===t||t.setAttribute("zIndex",0),this._gantt.stateManager.selectedTaskBar.target=null,this._gantt.scenegraph.taskBar.removeSelectedBorder(),this._gantt.scenegraph.updateNextFrame()}showSecondTaskBarSelectedBorder(){const t=this._gantt.stateManager.creatingDenpendencyLink.secondTaskBarNode,e=t.attribute.x,i=t.attribute.y,n=t.attribute.width,s=t.attribute.height;this._gantt.scenegraph.taskBar.createSelectedBorder(e,i,n,s,t,!0),this._gantt.scenegraph.updateNextFrame()}hideSecondTaskBarSelectedBorder(){this._gantt.stateManager.creatingDenpendencyLink.secondTaskBarNode=null,this._gantt.scenegraph.taskBar.removeSecondSelectedBorder(),this._gantt.scenegraph.updateNextFrame()}showDependencyLinkSelectedLine(){const t=this._gantt.stateManager.selectedDenpendencyLink.link;this._gantt.scenegraph.dependencyLink.createSelectedLinkLine(t);const{taskKeyField:e,dependencyLinks:i}=this._gantt.parsedOptions,{linkedToTaskKey:n,linkedFromTaskKey:s,type:r}=t;let a,o,l,h;const d=Gu(this._gantt.records,e,n),c=Gu(this._gantt.records,e,s);this._gantt.parsedOptions.tasksShowMode===du.Sub_Tasks_Inline||this._gantt.parsedOptions.tasksShowMode===du.Sub_Tasks_Separate||this._gantt.parsedOptions.tasksShowMode===du.Sub_Tasks_Arrange||this._gantt.parsedOptions.tasksShowMode===du.Sub_Tasks_Compact?(a=c.index[0],o=c.index[1],l=d.index[0],h=d.index[1]):(a=this._gantt.getTaskShowIndexByRecordIndex(c.index),l=this._gantt.getTaskShowIndexByRecordIndex(d.index));const u=this._gantt.scenegraph.taskBar.getTaskBarNodeByIndex(a,o);this._gantt.scenegraph.taskBar.createSelectedBorder(u.attribute.x,u.attribute.y,u.attribute.width,u.attribute.height,u,!1);const p=this._gantt.scenegraph.taskBar.getTaskBarNodeByIndex(l,h);this._gantt.scenegraph.taskBar.createSelectedBorder(p.attribute.x,p.attribute.y,p.attribute.width,p.attribute.height,p,!1),this._gantt.scenegraph.updateNextFrame()}hideDependencyLinkSelectedLine(){this._gantt.stateManager.selectedDenpendencyLink.link=null,this._gantt.scenegraph.dependencyLink.removeSelectedLinkLine(),this._gantt.scenegraph.taskBar.removeSelectedBorder(),this._gantt.scenegraph.updateNextFrame()}highlightLinkPointNode(t){if((null==t?void 0:t.children.length)>0){const e=t.children[0];e.setAttribute("fill",this._gantt.parsedOptions.dependencyLinkLineCreatingPointStyle.fillColor),e.setAttribute("stroke",this._gantt.parsedOptions.dependencyLinkLineCreatingPointStyle.strokeColor),e.setAttribute("radius",this._gantt.parsedOptions.dependencyLinkLineCreatingPointStyle.radius),e.setAttribute("lineWidth",this._gantt.parsedOptions.dependencyLinkLineCreatingPointStyle.strokeWidth),this._gantt.scenegraph.updateNextFrame()}}unhighlightLinkPointNode(t){if((null==t?void 0:t.children.length)>0){const e=t.children[0];e.setAttribute("fill",this._gantt.parsedOptions.dependencyLinkLineCreatePointStyle.fillColor),e.setAttribute("stroke",this._gantt.parsedOptions.dependencyLinkLineCreatePointStyle.strokeColor),e.setAttribute("radius",this._gantt.parsedOptions.dependencyLinkLineCreatePointStyle.radius),e.setAttribute("lineWidth",this._gantt.parsedOptions.dependencyLinkLineCreatePointStyle.strokeWidth),this._gantt.scenegraph.updateNextFrame()}}showMarklineIconHover(){var t,e;const i=this._gantt.stateManager.marklineIcon.target;if(i){const n=this._gantt.scenegraph.timelineHeader.showMarklineIcon(i.parent);n&&(null===(e=null===(t=this._gantt.parsedOptions.markLineCreateOptions)||void 0===t?void 0:t.markLineCreationHoverToolTip)||void 0===e?void 0:e.tipContent)&&this._gantt.scenegraph.showToolTip(n),this._gantt.scenegraph.updateNextFrame()}}hideMarklineIconHover(){this._gantt.scenegraph.timelineHeader.hideMarklineIconHover(this._gantt.stateManager.marklineIcon.target.parent),this._gantt.scenegraph.hideToolTip(),this._gantt.stateManager.marklineIcon.target=null,this._gantt.scenegraph.updateNextFrame()}updateProjectTaskTimes(t){var e,i;if(!t||0===t.length||!this._gantt||!this._gantt.records)return;const n=this._gantt.parsedOptions.startDateField,s=this._gantt.parsedOptions.endDateField,r=[...t];for(;r.length>0;){const t=[...r],i=t.pop();let a=this._gantt.records;for(const e of t){if(!a[e]||!a[e].children)return;a=a[e].children}const o=0===t.length?this._gantt.records[i]:a[i];if(o&&o.type===cu.PROJECT&&o.children&&o.children.length>0){let t=null,i=null;for(const e of o.children)if(e[n]&&e[s]){const r=new Date(e[n]),a=new Date(e[s]);(!t||r<t)&&(t=r),(!i||a>i)&&(i=a)}if(t&&i){const r=o[n]?new Date(o[n]):null,a=o[s]?new Date(o[s]):null;if(!r||!a||t.getTime()!==r.getTime()||i.getTime()!==a.getTime()){const r=null!==(e=this._gantt.parsedOptions.dateFormat)&&void 0!==e?e:this._gantt.parseTimeFormat(o[n]||o.children[0][n]),a=t=>this._gantt.formatDate?this._gantt.formatDate(t,r):t.toISOString().split("T")[0];o[n]=a(t),o[s]=a(i)}}}r.pop()}null===(i=this._gantt.scenegraph)||void 0===i||i.refreshAll()}}function Bp(t,e,i,n){const s=t.parsedOptions.taskBarCustomLayout;if(s){let r;if("function"==typeof s){const{startDate:a,endDate:o,taskDays:l,progress:h,taskRecord:d}=t.getTaskInfoByTaskListIndex(i,n);r=s({width:e.attribute.width,height:e.attribute.height,index:i,startDate:a,endDate:o,taskDays:l,progress:h,taskRecord:d,ganttInstance:t})}else r=s;if(r){const t=r.rootContainer;t.name="task-bar-custom-render";const i=e.children.find((t=>"task-bar-group"===t.name));if(i){const e=i.children.findIndex((t=>"task-bar-custom-render"===t.name)),n=i.children[e];n&&(i.removeChild(n),i.insertInto(t,e))}}}}function Ap(t,e,i,n){const s=t.task_index,r=t.sub_task_index,a=t.record.type===cu.MILESTONE,o=t.attribute.x,l=t.attribute.y;if(e&&t.setAttribute("x",Math.max(0,t.attribute.x+e)),n._gantt.parsedOptions.tasksShowMode!==du.Tasks_Separate&&n._gantt.parsedOptions.tasksShowMode!==du.Project_Sub_Tasks_Inline?i&&t.setAttribute("y",t.attribute.y+i):i=0,a&&(t.setAttribute("anchor",[t.attribute.x+t.attribute.width/2,t.attribute.y+t.attribute.height/2]),t.milestoneTextContainer)){const e=t.attribute.x-o,i=t.attribute.y-l,n=t.milestoneTextContainer.attribute.x,s=t.milestoneTextContainer.attribute.y;t.milestoneTextContainer.setAttribute("x",n+e),t.milestoneTextContainer.setAttribute("y",s+i)}t.updateTextPosition(),n._gantt.scenegraph.refreshRecordLinkNodes(s,r,t,i)}let Cp=1;class Lp{constructor(){this.listenersData={listeners:{},listenerData:{}}}on(t,e){const i=this.listenersData.listeners[t]||(this.listenersData.listeners[t]=[]);i.push(e);const n=Cp++;return this.listenersData.listenerData[n]={type:t,listener:e,remove:()=>{delete this.listenersData.listenerData[n];const s=i.indexOf(e);i.splice(s,1),this.listenersData.listeners[t].length||delete this.listenersData.listeners[t]}},n}off(t,e){var i;if(e){const i=t;this.removeEventListener(i,e)}else{const e=t;if(!this.listenersData)return;null===(i=this.listenersData.listenerData[e])||void 0===i||i.remove()}}addEventListener(t,e,i){this.on(t,e)}removeEventListener(t,e){if(this.listenersData)for(const i in this.listenersData.listenerData){const n=this.listenersData.listenerData[i];n.type===t&&n.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=>tu(t))):[]}release(){delete this.listenersData}}class Op{constructor(t){this._gantt=t,this.records=t.records,this.processRecords()}processRecords(){const t=!this._gantt.options.minDate,e=!this._gantt.options.maxDate;let i=Number.MAX_SAFE_INTEGER,n=Number.MIN_SAFE_INTEGER;if((t||e||this._gantt.parsedOptions.tasksShowMode===du.Sub_Tasks_Inline||this._gantt.parsedOptions.tasksShowMode===du.Sub_Tasks_Compact)&&this.records.length){for(let s=0;s<this.records.length;s++){const r=this.records[s];if(t&&r[this._gantt.parsedOptions.startDateField]){const t=wu(r[this._gantt.parsedOptions.startDateField]);i=Math.min(i,t.getTime())}if(e&&r[this._gantt.parsedOptions.endDateField]){const t=wu(r[this._gantt.parsedOptions.endDateField]);n=Math.max(n,t.getTime())}this._gantt.parsedOptions.tasksShowMode!==du.Sub_Tasks_Inline&&this._gantt.parsedOptions.tasksShowMode!==du.Sub_Tasks_Compact||r.children&&r.children.sort(((t,e)=>wu(t[this._gantt.parsedOptions.startDateField]).getTime()-wu(e[this._gantt.parsedOptions.startDateField]).getTime()))}const{unit:s,startOfWeek:r,step:a}=this._gantt.parsedOptions.reverseSortedTimelineScales[0];t&&(this._gantt.parsedOptions.minDate=Cu(new Date(i),s,r),this._gantt.parsedOptions._minDateTime=this._gantt.parsedOptions.minDate.getTime()),t&&!e&&(this._gantt.parsedOptions.maxDate=Au(this._gantt.parsedOptions.minDate,new Date(this._gantt.options.maxDate),s,a),this._gantt.parsedOptions._maxDateTime=this._gantt.parsedOptions.maxDate.getTime()),e&&(this._gantt.parsedOptions.maxDate=Au(this._gantt.parsedOptions.minDate,new Date(n),s,a),this._gantt.parsedOptions._maxDateTime=this._gantt.parsedOptions.maxDate.getTime())}}adjustOrder(t,e,i,n){var s,r,a,o;if(this._gantt.parsedOptions.tasksShowMode!==du.Sub_Tasks_Arrange&&this._gantt.parsedOptions.tasksShowMode!==du.Sub_Tasks_Compact||t!==i)if(this._gantt.parsedOptions.tasksShowMode===du.Sub_Tasks_Inline){if(tu(e)&&tu(n)&&tu(t)&&tu(i)){const s=this.records[t].children[e];this.records[t].children.splice(e,1),this.records[i].children||(this.records[i].children=[]),this.records[i].children.splice(n,0,s)}null===(r=null===(s=this.records[i])||void 0===s?void 0:s.children)||void 0===r||r.sort(((t,e)=>wu(t[this._gantt.parsedOptions.startDateField]).getTime()-wu(e[this._gantt.parsedOptions.startDateField]).getTime()))}else if(this._gantt.parsedOptions.tasksShowMode===du.Project_Sub_Tasks_Inline){if(tu(e)&&tu(n)&&tu(t)&&tu(i)){this.records[t].type,cu.PROJECT;const s=this.records[i].type===cu.PROJECT,r=this.records[t].children[e];this.records[t].children.splice(e,1),this.records[i].children||(this.records[i].children=[]),this.records[i].children.splice(n,0,r),s&&(null===(o=null===(a=this.records[i])||void 0===a?void 0:a.children)||void 0===o||o.sort(((t,e)=>wu(t[this._gantt.parsedOptions.startDateField]).getTime()-wu(e[this._gantt.parsedOptions.startDateField]).getTime())))}}else if(tu(e)&&tu(n)&&tu(t)&&tu(i)){const s=this.records[t].children[e];this.records[t].children.splice(e,1),this.records[i].children||(this.records[i].children=[]),this.records[i].children.splice(n,0,s)}}setRecords(t){this.records=t,this.processRecords()}}class Ep{constructor(t,e){var i;this.plugins=new Map,this.gantt=t,null===(i=e.plugins)||void 0===i||i.forEach((t=>{this.register(t),this._initializePluginRun(t)}))}_initializePluginRun(t){if(void 0===t.runTime)try{t.run(this.gantt)}catch(t){}else this._bindGanttEventForPlugin(t)}register(t){this.plugins.set(t.id,t)}registerAll(t){t.forEach((t=>this.register(t)))}getPlugin(t){return this.plugins.get(t)}getPluginByName(t){return Array.from(this.plugins.values()).find((e=>e.name===t))}_bindGanttEventForPlugin(t){var e=this;t.runTime&&t.runTime.forEach((i=>{this.gantt.on(i,(function(){var n;try{for(var s=arguments.length,r=new Array(s),a=0;a<s;a++)r[a]=arguments[a];null===(n=t.run)||void 0===n||n.call(t,...r,i,e.gantt)}catch(t){}}))}))}updatePlugins(t){Array.from(this.plugins.values()).filter((e=>!(null==t?void 0:t.some((t=>t.id===e.id))))).forEach((t=>{this.release(),this.plugins.delete(t.id)})),this.plugins.forEach((t=>{t.update&&t.update()}));const e=null==t?void 0:t.filter((t=>!this.plugins.has(t.id)));null==e||e.forEach((t=>{this.register(t),this._initializePluginRun(t)}))}release(){this.plugins.forEach((t=>{var e;try{null===(e=t.release)||void 0===e||e.call(t,this.gantt)}catch(t){}}))}}class Rp extends Lp{constructor(t,e){var i,n,s,r,a;super(),this.parsedOptions={},this.container=t,this.options=e,this.taskTableWidth="number"==typeof(null===(i=null==e?void 0:e.taskListTable)||void 0===i?void 0:i.tableWidth)?null===(n=null==e?void 0:e.taskListTable)||void 0===n?void 0:n.tableWidth:-1,this.taskTableColumns=null!==(r=null===(s=null==e?void 0:e.taskListTable)||void 0===s?void 0:s.columns)&&void 0!==r?r:[],this.records=null!==(a=null==e?void 0:e.records)&&void 0!==a?a:[],this._sortScales(),zu(this),function(t){if(!t.records||0===t.records.length)return;const e=t.parsedOptions.startDateField,i=t.parsedOptions.endDateField,n=(s,r,a)=>{let o=null,l=null;return s.forEach(((r,a)=>{var h;if(!r)return;let d=null,c=null;if(r.children&&r.children.length>0&&r.type===cu.PROJECT){const[o,l]=n(r.children);if(o&&l&&(d=o,c=l,r.type===cu.PROJECT)){const n=null!==(h=t.parsedOptions.dateFormat)&&void 0!==h?h:t.parseTimeFormat(r[e]||r.children[0][e]||""),o=e=>t.formatDate?t.formatDate(e,n):e.toISOString().split("T")[0],l=Object.assign({},r);l[e]=o(d),l[i]=o(c),s[a]=l}}else r[e]&&r[i]&&(d=new Date(r[e]),c=new Date(r[i]));d&&(!o||d<o)&&(o=d),c&&(!l||c>l)&&(l=c)})),[o,l]};n(t.records)}(this),this.data=new Op(this),this._generateTimeLineDateMap(),this.timeLineHeaderLevel=this.parsedOptions.sortedTimelineScales.length,this.element=function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"vtable-gantt";var i,n;const s=document.createElement("div");s.setAttribute("tabindex","0"),s.classList.add(e),s.style.outline="none",s.style.margin=`${t.top}px ${t.right}px ${t.bottom}px ${t.left}px`;const r=(s.offsetWidth||(null===(i=s.parentElement)||void 0===i?void 0:i.offsetWidth)||1)-1,a=(s.offsetHeight||(null===(n=s.parentElement)||void 0===n?void 0:n.offsetHeight)||1)-1;return s.style.width=r&&r-t.left-t.right+"px"||"0px",s.style.height=a&&a-t.top-t.bottom+"px"||"0px",s}({top:0,right:0,left:0,bottom:0},"vtable-gantt"),this.element.style.left=this.taskTableWidth?`${this.taskTableWidth}px`:"0px",this.canvas=document.createElement("canvas"),this.element.appendChild(this.canvas),this.context=this.canvas.getContext("2d"),t?(t.appendChild(this.element),this._updateSize()):this._updateSize(),this._generateListTable(),this._syncPropsFromTable(),function(t){if(t.taskListTableInstance){t.verticalSplitResizeLine=document.createElement("div"),t.verticalSplitResizeLine.style.position="absolute",t.verticalSplitResizeLine.style.top=t.tableY+"px",t.verticalSplitResizeLine.style.left=(t.taskTableWidth?t.taskTableWidth-7+t.parsedOptions.verticalSplitLine.lineWidth/2:0)+"px",t.verticalSplitResizeLine.style.width="14px",t.verticalSplitResizeLine.style.height=t.drawHeight+"px",t.verticalSplitResizeLine.style.backgroundColor="rgba(0,0,0,0)",t.verticalSplitResizeLine.style.zIndex="100",t.parsedOptions.verticalSplitLineMoveable&&(t.verticalSplitResizeLine.style.cursor="col-resize"),t.verticalSplitResizeLine.style.userSelect="none",t.verticalSplitResizeLine.style.opacity="1";const e=document.createElement("div");if(e.style.position="absolute",e.style.top="0px",e.style.left=(14-t.parsedOptions.verticalSplitLine.lineWidth)/2+"px",e.style.width=t.parsedOptions.verticalSplitLine.lineWidth+"px",e.style.height="100%",e.style.backgroundColor=t.parsedOptions.verticalSplitLine.lineColor,e.style.zIndex="100",e.style.userSelect="none",e.style.pointerEvents="none",e.style.transition="background-color 0.3s",t.verticalSplitResizeLine.appendChild(e),t.parsedOptions.verticalSplitLineHighlight){const e=document.createElement("div");e.style.position="absolute",e.style.top="0px",e.style.left=(14-t.parsedOptions.verticalSplitLineHighlight.lineWidth)/2+"px",e.style.width=t.parsedOptions.verticalSplitLineHighlight.lineWidth+"px",e.style.height="100%",e.style.backgroundColor=t.parsedOptions.verticalSplitLineHighlight.lineColor,e.style.zIndex="100",e.style.cursor="col-resize",e.style.userSelect="none",e.style.pointerEvents="none",e.style.opacity="0",e.style.transition="background-color 0.3s",t.verticalSplitResizeLine.appendChild(e)}t.container.appendChild(t.verticalSplitResizeLine)}}(this),this.scenegraph=new up(this),this.stateManager=new kp(this),this.eventManager=new wp(this),this.scenegraph.afterCreateSceneGraph(),this._scrollToMarkLine(),this.pluginManager=new Ep(this,e)}renderTaskBarsTable(){this.scenegraph.updateNextFrame()}_updateSize(){var t,e,i,n,s,r,a,o;let l=0,h=0;if("browser"===Eu.mode){const r=this.getElement();let a=0,o=0;if(r.parentElement){const t=r.parentElement.style||window.getComputedStyle(r.parentElement);a=r.parentElement.offsetWidth-parseInt(t.paddingLeft||"0px",10)-parseInt(t.paddingRight||"0px",10),o=r.parentElement.offsetHeight-parseInt(t.paddingTop||"0px",10)-parseInt(t.paddingBottom||"0px",20)}const d=(null!=a?a:1)-1-this.taskTableWidth,c=(null!=o?o:1)-1;r.style.width=d&&`${d}px`||"0px",r.style.height=c&&`${c}px`||"0px";const{canvas:u}=this;l=null!==(e=null===(t=u.parentElement)||void 0===t?void 0:t.offsetWidth)&&void 0!==e?e:1,h=null!==(n=null===(i=u.parentElement)||void 0===i?void 0:i.offsetHeight)&&void 0!==n?n:1,(null===(s=null==this?void 0:this.scenegraph)||void 0===s?void 0:s.stage)?this.scenegraph.stage.resize(l,h):(u.style.width="",u.style.height="",u.width=l,u.height=h,u.style.width=`${l}px`,u.style.height=`${h}px`)}else Eu.mode;const d=Math.floor(l-function(t){var e;return(null==t?void 0:t.hoverOn)||(null==t?void 0:t.verticalVisible)&&"none"===(null==t?void 0:t.verticalVisible)||!(null==t?void 0:t.verticalVisible)&&"none"===(null==t?void 0:t.visible)?0:null!==(e=null==t?void 0:t.width)&&void 0!==e?e:7}(this.parsedOptions.scrollStyle)),c=Math.floor(h-function(t){var e;return(null==t?void 0:t.hoverOn)||(null==t?void 0:t.horizontalVisible)&&"none"===(null==t?void 0:t.horizontalVisible)||!(null==t?void 0:t.horizontalVisible)&&"none"===(null==t?void 0:t.visible)?0:null!==(e=null==t?void 0:t.width)&&void 0!==e?e:7}(this.parsedOptions.scrollStyle));if(this.tableNoFrameWidth=l,this.tableNoFrameHeight=Math.floor(h),this.parsedOptions.outerFrameStyle){const t=null===(r=this.parsedOptions.outerFrameStyle)||void 0===r?void 0:r.borderLineWidth;this.tableX=this.taskTableColumns.length>=1||(null===(a=this.options)||void 0===a?void 0:a.rowSeriesNumber)?null!==(o=this.parsedOptions.verticalSplitLine.lineWidth)&&void 0!==o?o:0:t,this.tableY=t,this.tableNoFrameWidth=Math.min(d-t-this.tableX,this.getAllDateColsWidth()),this.tableNoFrameHeight=c-2*t}}_updateListTableSize(t){var e,i,n,s,r,a,o,l,h,d;if(t&&("auto"!==(null===(i=null===(e=this.options)||void 0===e?void 0:e.taskListTable)||void 0===i?void 0:i.tableWidth)&&-1!==this.taskTableWidth||(this.taskTableWidth=t.getAllColsWidth()+this.parsedOptions.outerFrameStyle.borderLineWidth,(null===(s=null===(n=this.options)||void 0===n?void 0:n.taskListTable)||void 0===s?void 0:s.maxTableWidth)&&(this.taskTableWidth=Math.min(null===(a=null===(r=this.options)||void 0===r?void 0:r.taskListTable)||void 0===a?void 0:a.maxTableWidth,this.taskTableWidth)),(null===(l=null===(o=this.options)||void 0===o?void 0:o.taskListTable)||void 0===l?void 0:l.minTableWidth)&&(this.taskTableWidth=Math.max(null===(d=null===(h=this.options)||void 0===h?void 0:h.taskListTable)||void 0===d?void 0:d.minTableWidth,this.taskTableWidth)),this.element.style.left=this.taskTableWidth?`${this.taskTableWidth}px`:"0px",t.setCanvasSize(this.taskTableWidth,this.tableNoFrameHeight+2*this.parsedOptions.outerFrameStyle.borderLineWidth),this._updateSize()),t.columnHeaderLevelCount>1))if(t.columnHeaderLevelCount===this.parsedOptions.timeLineHeaderRowHeights.length)for(let e=0;e<t.columnHeaderLevelCount;e++)t.setRowHeight(e,this.parsedOptions.timeLineHeaderRowHeights[e]);else{const e=this.getAllHeaderRowsHeight()/t.columnHeaderLevelCount;for(let i=0;i<t.columnHeaderLevelCount;i++)t.setRowHeight(i,e)}}_generateListTable(){var t;if(this.taskTableColumns.length>=1||(null===(t=this.options)||void 0===t?void 0:t.rowSeriesNumber)){const t=this._generateListTableOptions();this.taskListTableInstance=new e.ListTable(this.container,t),this._updateListTableSize(this.taskListTableInstance)}}_generateListTableOptions(){var t,i,n,s,r,a,o,l,h,d,c,u,p,g,f,v,m,b,y,x,_,w,T,S,k,B,A,C,L,O,E,R,M,P,D,I,F,N,H,z,W,U,j,G,Y,V,X,K,$,q,Z,J,Q,tt,et,it,nt,st,rt,at,ot,lt,ht,dt,ct,ut;const pt={},gt=["container","records","rowSeriesNumber","overscrollBehavior","pixelRatio","eventOptions"];for(const t in this.options)gt.indexOf(t)>=0&&(pt[t]=this.options[t]);for(const t in this.options.taskListTable){if(pt[t]=this.options.taskListTable[t],"columns"===t&&(pt[t][pt[t].length-1].disableColumnResize=!0,this.parsedOptions.tasksShowMode===du.Sub_Tasks_Inline||this.parsedOptions.tasksShowMode===du.Sub_Tasks_Separate||this.parsedOptions.tasksShowMode===du.Sub_Tasks_Arrange||this.parsedOptions.tasksShowMode===du.Sub_Tasks_Compact))for(let t=0;t<pt.columns.length;t++)pt.columns[t].tree&&(pt.columns[t].tree=!1);"hierarchyExpandLevel"!==t||this.parsedOptions.tasksShowMode!==du.Sub_Tasks_Inline&&this.parsedOptions.tasksShowMode!==du.Sub_Tasks_Separate&&this.parsedOptions.tasksShowMode!==du.Sub_Tasks_Arrange&&this.parsedOptions.tasksShowMode!==du.Sub_Tasks_Compact||delete pt[t]}if(null===(t=this.options.taskListTable)||void 0===t?void 0:t.theme)if(pt.theme=null===(i=this.options.taskListTable)||void 0===i?void 0:i.theme,pt.theme.bodyStyle&&!function(t,e){const i=Object.getOwnPropertyDescriptor(t,e);return!(!i||!i.set&&!0!==i.writable)}(pt.theme,"bodyStyle")){pt.theme=(null===(n=this.options.taskListTable)||void 0===n?void 0:n.theme).extends((null===(s=this.options.taskListTable)||void 0===s?void 0:s.theme).getExtendTheme());const t=pt.theme.getExtendTheme();pt.theme.clearBodyStyleCache(),(null===(r=pt.theme.headerStyle)||void 0===r?void 0:r.bgColor)||(t.headerStyle?t.headerStyle.bgColor||(t.headerStyle.bgColor=this.parsedOptions.timelineHeaderBackgroundColor):t.headerStyle={bgColor:this.parsedOptions.timelineHeaderBackgroundColor}),t.bodyStyle?t.bodyStyle.frameStyle={borderLineWidth:[null!==(o=null===(a=this.parsedOptions.horizontalSplitLine)||void 0===a?void 0:a.lineWidth)&&void 0!==o?o:0,0,0,0],borderColor:null===(l=this.parsedOptions.horizontalSplitLine)||void 0===l?void 0:l.lineColor}:t.bodyStyle={frameStyle:{borderLineWidth:[null!==(d=null===(h=this.parsedOptions.horizontalSplitLine)||void 0===h?void 0:h.lineWidth)&&void 0!==d?d:0,0,0,0],borderColor:null===(c=this.parsedOptions.horizontalSplitLine)||void 0===c?void 0:c.lineColor}},t.cellInnerBorder=!1,t.frameStyle=Object.assign({},this.parsedOptions.outerFrameStyle,{shadowBlur:0,cornerRadius:[null!==(p=null===(u=this.parsedOptions.outerFrameStyle)||void 0===u?void 0:u.cornerRadius)&&void 0!==p?p:0,0,0,null!==(f=null===(g=this.parsedOptions.outerFrameStyle)||void 0===g?void 0:g.cornerRadius)&&void 0!==f?f:0],borderLineWidth:[null!==(m=null===(v=this.parsedOptions.outerFrameStyle)||void 0===v?void 0:v.borderLineWidth)&&void 0!==m?m:0,0,null!==(y=null===(b=this.parsedOptions.outerFrameStyle)||void 0===b?void 0:b.borderLineWidth)&&void 0!==y?y:0,null!==(_=null===(x=this.parsedOptions.outerFrameStyle)||void 0===x?void 0:x.borderLineWidth)&&void 0!==_?_:0]}),t.scrollStyle=Object.assign({},null===(T=null===(w=this.options.taskListTable)||void 0===w?void 0:w.theme)||void 0===T?void 0:T.scrollStyle,this.parsedOptions.scrollStyle,{verticalVisible:"none"}),t.columnResize=Object.assign({labelColor:"rgba(0,0,0,0)",labelBackgroundFill:"rgba(0,0,0,0)"},null==t?void 0:t.columnResize),t.underlayBackgroundColor||(t.underlayBackgroundColor=this.parsedOptions.underlayBackgroundColor)}else pt.theme.headerStyle?pt.theme.headerStyle.bgColor||(pt.theme.headerStyle.bgColor=this.parsedOptions.timelineHeaderBackgroundColor):pt.theme.headerStyle={bgColor:this.parsedOptions.timelineHeaderBackgroundColor},pt.theme.headerStyle=Object.assign({},e.themes.DEFAULT.headerStyle,{bgColor:this.parsedOptions.timelineHeaderBackgroundColor},null===(k=null===(S=this.options.taskListTable)||void 0===S?void 0:S.theme)||void 0===k?void 0:k.headerStyle),pt.theme.bodyStyle=Object.assign({},e.themes.DEFAULT.bodyStyle,null===(A=null===(B=this.options.taskListTable)||void 0===B?void 0:B.theme)||void 0===A?void 0:A.bodyStyle,{frameStyle:{borderLineWidth:[null!==(L=null===(C=this.parsedOptions.horizontalSplitLine)||void 0===C?void 0:C.lineWidth)&&void 0!==L?L:0,0,0,0],borderColor:null===(O=this.parsedOptions.horizontalSplitLine)||void 0===O?void 0:O.lineColor}}),pt.theme.cellInnerBorder=!1,pt.theme.frameStyle=Object.assign({},this.parsedOptions.outerFrameStyle,{cornerRadius:[null!==(R=null===(E=this.parsedOptions.outerFrameStyle)||void 0===E?void 0:E.cornerRadius)&&void 0!==R?R:0,0,0,null!==(P=null===(M=this.parsedOptions.outerFrameStyle)||void 0===M?void 0:M.cornerRadius)&&void 0!==P?P:0],borderLineWidth:[null!==(I=null===(D=this.parsedOptions.outerFrameStyle)||void 0===D?void 0:D.borderLineWidth)&&void 0!==I?I:0,0,null!==(N=null===(F=this.parsedOptions.outerFrameStyle)||void 0===F?void 0:F.borderLineWidth)&&void 0!==N?N:0,null!==(z=null===(H=this.parsedOptions.outerFrameStyle)||void 0===H?void 0:H.borderLineWidth)&&void 0!==z?z:0]}),pt.theme.scrollStyle=Object.assign({},null===(U=null===(W=this.options.taskListTable)||void 0===W?void 0:W.theme)||void 0===U?void 0:U.scrollStyle,this.parsedOptions.scrollStyle,{verticalVisible:"none"}),pt.theme.columnResize=Object.assign({labelColor:"rgba(0,0,0,0)",labelBackgroundFill:"rgba(0,0,0,0)"},null===(G=null===(j=this.options.taskListTable)||void 0===j?void 0:j.theme)||void 0===G?void 0:G.columnResize),pt.theme.underlayBackgroundColor||(pt.theme.underlayBackgroundColor=this.parsedOptions.underlayBackgroundColor);else pt.theme={scrollStyle:Object.assign({},null===(V=null===(Y=this.options.taskListTable)||void 0===Y?void 0:Y.theme)||void 0===V?void 0:V.scrollStyle,this.parsedOptions.scrollStyle,{verticalVisible:"none"}),headerStyle:Object.assign({},e.themes.DEFAULT.headerStyle,{bgColor:this.parsedOptions.timelineHeaderBackgroundColor},null===(K=null===(X=this.options.taskListTable)||void 0===X?void 0:X.theme)||void 0===K?void 0:K.headerStyle),bodyStyle:Object.assign({},e.themes.DEFAULT.bodyStyle,null===(q=null===($=this.options.taskListTable)||void 0===$?void 0:$.theme)||void 0===q?void 0:q.bodyStyle,{frameStyle:{borderLineWidth:[null!==(J=null===(Z=this.parsedOptions.horizontalSplitLine)||void 0===Z?void 0:Z.lineWidth)&&void 0!==J?J:0,0,0,0],borderColor:null===(Q=this.parsedOptions.horizontalSplitLine)||void 0===Q?void 0:Q.lineColor}}),cellInnerBorder:!1,frameStyle:Object.assign({},this.parsedOptions.outerFrameStyle,{cornerRadius:[null!==(et=null===(tt=this.parsedOptions.outerFrameStyle)||void 0===tt?void 0:tt.cornerRadius)&&void 0!==et?et:0,0,0,null!==(nt=null===(it=this.parsedOptions.outerFrameStyle)||void 0===it?void 0:it.cornerRadius)&&void 0!==nt?nt:0],borderLineWidth:[null!==(rt=null===(st=this.parsedOptions.outerFrameStyle)||void 0===st?void 0:st.borderLineWidth)&&void 0!==rt?rt:0,0,null!==(ot=null===(at=this.parsedOptions.outerFrameStyle)||void 0===at?void 0:at.borderLineWidth)&&void 0!==ot?ot:0,null!==(ht=null===(lt=this.parsedOptions.outerFrameStyle)||void 0===lt?void 0:lt.borderLineWidth)&&void 0!==ht?ht:0]}),columnResize:Object.assign({labelColor:"rgba(0,0,0,0)",labelBackgroundFill:"rgba(0,0,0,0)"},null===(ct=null===(dt=this.options.taskListTable)||void 0===dt?void 0:dt.theme)||void 0===ct?void 0:ct.columnResize),underlayBackgroundColor:this.parsedOptions.underlayBackgroundColor};return pt.canvasWidth=this.taskTableWidth,pt.canvasHeight=this.canvas.height,pt.defaultHeaderRowHeight=this.getAllHeaderRowsHeight(),this.parsedOptions.tasksShowMode===du.Sub_Tasks_Separate?(pt.customComputeRowHeight=t=>{var e;const{row:i,table:n}=t,s=n.getRecordByRowCol(0,i);if(s)return((null===(e=s.children)||void 0===e?void 0:e.length)||1)*this.parsedOptions.rowHeight},pt.defaultRowHeight="auto"):this.parsedOptions.tasksShowMode===du.Sub_Tasks_Compact?(pt.customComputeRowHeight=t=>{const{row:e,table:i}=t,n=i.getRecordByRowCol(0,e);if(n)return function(t,e){var i;if(!e.children||1===e.children.length)return 1===(null===(i=e.children)||void 0===i?void 0:i.length)?e.children[0].vtable_gantt_showIndex=0:e.vtable_gantt_showIndex=0,1;const n=e.children.slice().sort(((e,i)=>{const{startDate:n}=$u(t,e),{startDate:s}=$u(t,i);return n.getTime()-s.getTime()})),s=[];for(let e=0;e<=n.length-1;e++){const i=n[e],{startDate:r,endDate:a}=$u(t,i);let o=!1;for(let t=0;t<s.length;t++)if(r.getTime()>s[t]){s[t]=a.getTime(),o=!0,i.vtable_gantt_showIndex=t;break}o||(s.push(a.getTime()),i.vtable_gantt_showIndex=s.length-1)}return s.length}(this,n)*this.parsedOptions.rowHeight},pt.defaultRowHeight="auto"):this.parsedOptions.tasksShowMode===du.Sub_Tasks_Arrange?(pt.customComputeRowHeight=t=>{const{row:e,table:i}=t,n=i.getRecordByRowCol(0,e);if(n)return function(t,e){var i;if(!e.children||1===e.children.length)return 1===(null===(i=e.children)||void 0===i?void 0:i.length)?e.children[0].vtable_gantt_showIndex=0:e.vtable_gantt_showIndex=0,1;const n=[];for(let i=0;i<=e.children.length-1;i++){const s=e.children[i],{startDate:r,endDate:a}=$u(t,s);let o=!1;for(let i=0;i<n.length;i++)if(!Ku(r,a,e.children.filter((t=>t!==s&&t.vtable_gantt_showIndex===i)),t)){n[i]=a.getTime(),o=!0,s.vtable_gantt_showIndex=i;break}o||(n.push(a.getTime()),s.vtable_gantt_showIndex=n.length-1)}return n.length}(this,n)*this.parsedOptions.rowHeight},pt.defaultRowHeight="auto"):pt.defaultRowHeight=null!==(ut=this.options.rowHeight)&&void 0!==ut?ut:40,pt.clearDOM=!1,pt}getElement(){return this.element}getContainer(){return this.element.parentElement}_sortScales(){const{timelineHeader:t}=this.options;if(t){const e=t.scales,i=["year","quarter","month","week","day","hour","minute","second"];1===e.length&&("hour"!==e[0].unit&&"minute"!==e[0].unit&&"second"!==e[0].unit||(this.parsedOptions.timeScaleIncludeHour=!0));const n=e.slice().sort(((t,e)=>{"hour"!==t.unit&&"minute"!==t.unit&&"second"!==t.unit||(this.parsedOptions.timeScaleIncludeHour=!0);const n=i.indexOf(t.unit),s=i.indexOf(e.unit);return-1===n?1:-1===s?-1:n-s})),s=e.slice().sort(((t,e)=>{const n=i.indexOf(t.unit),s=i.indexOf(e.unit);return-1===n?1:-1===s?-1:s-n}));this.parsedOptions.sortedTimelineScales=n,this.parsedOptions.reverseSortedTimelineScales=s}}_generateTimeLineDateMap(){if(this.parsedOptions.minDate&&this.parsedOptions.maxDate)for(const t of this.parsedOptions.reverseSortedTimelineScales)t.timelineDates=Wu(new Date(this.parsedOptions.minDate),this.parsedOptions.maxDate,t)}getRowHeightByIndex(t){return this.taskListTableInstance?this.taskListTableInstance.getRowHeight(t+this.taskListTableInstance.columnHeaderLevelCount):this.parsedOptions.rowHeight}getRowsHeightByIndex(t,e){return this.taskListTableInstance?this.taskListTableInstance.getRowsHeight(t+this.taskListTableInstance.columnHeaderLevelCount,e+this.taskListTableInstance.columnHeaderLevelCount):this.parsedOptions.rowHeight*(e-t+1)}getAllRowsHeight(){return this.taskListTableInstance?this.taskListTableInstance.getAllRowsHeight():this.getAllHeaderRowsHeight()+this.itemCount*this.parsedOptions.rowHeight}getAllHeaderRowsHeight(){return this.parsedOptions.timeLineHeaderRowHeights.reduce(((t,e,i)=>!1===this.parsedOptions.sortedTimelineScales[i].visible?t:t+e),0)}getAllDateColsWidth(){var t,e;return this.parsedOptions.timelineColWidth*(null!==(e=null===(t=this.parsedOptions.reverseSortedTimelineScales[0].timelineDates)||void 0===t?void 0:t.length)&&void 0!==e?e:0)}getAllTaskBarsHeight(){return this.taskListTableInstance?this.taskListTableInstance.getRowsHeight(this.taskListTableInstance.columnHeaderLevelCount,this.taskListTableInstance.rowCount-1):this.itemCount*this.parsedOptions.rowHeight}getRecordIndexByTaskShowIndex(t){return this.taskListTableInstance?this.taskListTableInstance.getRecordIndexByCell(0,this.taskListTableInstance.columnHeaderLevelCount+t):t}getTaskShowIndexByRecordIndex(t){return this.taskListTableInstance.getBodyRowIndexByRecordIndex(t)}getRecordByIndex(t,e){var i,n;if(this.taskListTableInstance){if(tu(e)){const s=this.taskListTableInstance.getRecordByCell(0,t+this.taskListTableInstance.columnHeaderLevelCount);if(Array.isArray(e)){const n=this.getRecordIndexByTaskShowIndex(t),r=Array.isArray(n)?n.length:1,a=[...e];a.splice(0,r);let o=s;for(;a.length>0;){const t=a.shift();o=null===(i=null==o?void 0:o.children)||void 0===i?void 0:i[t]}return o}return null===(n=null==s?void 0:s.children)||void 0===n?void 0:n[e]}return this.taskListTableInstance.getRecordByCell(0,t+this.taskListTableInstance.columnHeaderLevelCount)}return this.records[t]}_refreshTaskBar(t,e){this.scenegraph.taskBar.updateTaskBarNode(t,e),this.scenegraph.refreshRecordLinkNodes(t,void 0,this.scenegraph.taskBar.getTaskBarNodeByIndex(t,e)),this.scenegraph.updateNextFrame()}_updateRecordToListTable(t,e){this.taskListTableInstance.updateRecords([t],[e])}getTaskInfoByTaskListIndex(t,e){const i=this.getRecordByIndex(t,e),n=null==i?void 0:i.type,s=this.parsedOptions.startDateField,r=this.parsedOptions.endDateField,a=this.parsedOptions.progressField,o=wu(null==i?void 0:i[s]).getTime(),l=wu(null==i?void 0:i[r]).getTime();if(n&&!(null==i?void 0:i[s])||!n&&(l<this.parsedOptions._minDateTime||o>this.parsedOptions._maxDateTime||!(null==i?void 0:i[s])||!(null==i?void 0:i[r])))return{taskDays:0,progress:0,startDate:null,endDate:null,taskRecord:i};const h=function(t){return"string"==typeof t&&(t=t.replace("%",""),t=parseFloat(t)),Math.round(t)}(i[a]);let d,c;return this.parsedOptions.timeScaleIncludeHour?(d=wu(Math.min(Math.max(this.parsedOptions._minDateTime,o),this.parsedOptions._maxDateTime)),c=ku(Math.max(Math.min(this.parsedOptions._maxDateTime,l),this.parsedOptions._minDateTime),!0)):(d=wu(Math.min(Math.max(this.parsedOptions._minDateTime,o),this.parsedOptions._maxDateTime),!0),c=Bu(Math.max(Math.min(this.parsedOptions._maxDateTime,l),this.parsedOptions._minDateTime),!0)),{taskRecord:i,taskDays:(c.getTime()-d.getTime()+1)/864e5,startDate:d,endDate:c,progress:h}}_updateStartDateToTaskRecord(t,e,i){var n;const s=this.getRecordByIndex(e,i),r=this.parsedOptions.startDateField,a=gu(t,null!==(n=this.parsedOptions.dateFormat)&&void 0!==n?n:bu(s[r]));if(s[r]=a,tu(i))Array.isArray(i)&&this.stateManager.updateProjectTaskTimes(i);else{const t=this.getRecordIndexByTaskShowIndex(e);this._updateRecordToListTable(s,t),Array.isArray(t)&&this.stateManager.updateProjectTaskTimes(t)}}_updateEndDateToTaskRecord(t,e,i){var n;const s=this.getRecordByIndex(e,i),r=this.parsedOptions.endDateField,a=gu(t,null!==(n=this.parsedOptions.dateFormat)&&void 0!==n?n:bu(s[r]));if(s[r]=a,tu(i))Array.isArray(i)&&this.stateManager.updateProjectTaskTimes(i);else{const t=this.getRecordIndexByTaskShowIndex(e);this._updateRecordToListTable(s,t),Array.isArray(t)&&this.stateManager.updateProjectTaskTimes(t)}}_updateStartEndDateToTaskRecord(t,e,i,n){var s;const r=this.getRecordByIndex(i,n),a=this.parsedOptions.startDateField,o=this.parsedOptions.endDateField,l=null!==(s=this.parsedOptions.dateFormat)&&void 0!==s?s:bu(r[a]),h=gu(t,l);r[a]=h;const d=gu(e,l);if(r[o]=d,tu(n))Array.isArray(n)&&this.stateManager.updateProjectTaskTimes(n);else{const t=this.getRecordIndexByTaskShowIndex(i);this._updateRecordToListTable(r,t),Array.isArray(t)&&this.stateManager.updateProjectTaskTimes(t)}}_dragOrderTaskRecord(t,e,i,n){this.data.adjustOrder(t,e,i,n)}updateTaskRecord(t,e,i){if(tu(i)){const n="number"==typeof e?e:e[0];return this._updateRecordToListTable(t,[n,i]),void this._refreshTaskBar(n,i)}if(Array.isArray(e)){const i=e[0],n=e[1];return this._updateRecordToListTable(t,e),void this._refreshTaskBar(i,n)}let n=e;"tree"===this.taskListTableInstance.rowHierarchyType&&(n=this.taskListTableInstance.getRecordIndexByCell(0,e+this.taskListTableInstance.columnHeaderLevelCount)),this._updateRecordToListTable(t,n),this._refreshTaskBar(e,void 0)}setPixelRatio(t){var e;null===(e=this.taskListTableInstance)||void 0===e||e.setPixelRatio(t),this.parsedOptions.pixelRatio=t,this.scenegraph.setPixelRatio(t)}updateTasksShowMode(t){this.options.tasksShowMode=t,this.updateOption(this.options)}_resize(){var t;this._updateSize(),null===(t=this.taskListTableInstance)||void 0===t||t.setCanvasSize(this.taskTableWidth,this.tableNoFrameHeight+2*this.parsedOptions.outerFrameStyle.borderLineWidth),this._syncPropsFromTable(),this.scenegraph.resize(),ju(this)}_syncPropsFromTable(){this.itemCount=this.taskListTableInstance?this.taskListTableInstance.rowCount-this.taskListTableInstance.columnHeaderLevelCount:this.records.length,this.headerHeight=this.getAllHeaderRowsHeight(),this.drawHeight=Math.min(this.getAllRowsHeight(),this.tableNoFrameHeight),this.gridHeight=this.drawHeight-this.headerHeight}getContext(){return this.context}release(){var t,e;null===(t=super.release)||void 0===t||t.call(this),this.eventManager.release(),null===(e=this.taskListTableInstance)||void 0===e||e.release();const{parentElement:i}=this.element;i&&(i.removeChild(this.element),this.verticalSplitResizeLine&&i.removeChild(this.verticalSplitResizeLine),this.horizontalSplitLine&&i.removeChild(this.horizontalSplitLine)),this.scenegraph=null,this.pluginManager.release()}updateOption(t){var e,i,n,s,r;if(this.parsedOptions={},this.options=t,this.taskTableWidth="number"==typeof(null===(e=null==t?void 0:t.taskListTable)||void 0===e?void 0:e.tableWidth)?null===(i=null==t?void 0:t.taskListTable)||void 0===i?void 0:i.tableWidth:-1,this.taskTableColumns=null!==(s=null===(n=null==t?void 0:t.taskListTable)||void 0===n?void 0:n.columns)&&void 0!==s?s:[],this.records=null!==(r=null==t?void 0:t.records)&&void 0!==r?r:[],this._sortScales(),zu(this),this.data.setRecords(this.records),this._generateTimeLineDateMap(),this.timeLineHeaderLevel=this.parsedOptions.sortedTimelineScales.length,this._updateSize(),this.taskListTableInstance){const t=this._generateListTableOptions();this.taskListTableInstance.updateOption(t),this._updateListTableSize(this.taskListTableInstance)}this._syncPropsFromTable(),this.scenegraph.updateStageBackground(),this.element.style.left=this.taskTableWidth?`${this.taskTableWidth}px`:"0px",ju(this),this.scenegraph.updateSceneGraph(),this.scenegraph.afterCreateSceneGraph(),this._scrollToMarkLine()}setRecords(t){this.records=t,this.data.setRecords(t),function(t){var e,i,n,s,r,a,o;const l=t.options,{unit:h,startOfWeek:d}=t.parsedOptions.reverseSortedTimelineScales[0];t.parsedOptions.markLine=Hu(null==l?void 0:l.markLine),null!==(i=null===(e=t.parsedOptions.markLine)||void 0===e?void 0:e.length)&&void 0!==i&&i&&((null===(n=t.parsedOptions.markLine)||void 0===n?void 0:n.every((t=>void 0===t.scrollToMarkLine)))&&(t.parsedOptions.markLine[0].scrollToMarkLine=!0),(null===(s=t.parsedOptions.markLine)||void 0===s?void 0:s.find((t=>t.scrollToMarkLine)))&&(t.parsedOptions.scrollToMarkLineDate=Cu(new Date(null===(r=t.parsedOptions.markLine)||void 0===r?void 0:r.find((t=>t.scrollToMarkLine)).date),h,d))),t.parsedOptions.dependencyLinks=null!==(o=null===(a=l.dependency)||void 0===a?void 0:a.links)&&void 0!==o?o:[]}(this),this.taskListTableInstance.setRecords(t),this._syncPropsFromTable(),this._generateTimeLineDateMap(),this.timeLineHeaderLevel=this.parsedOptions.sortedTimelineScales.length,this._updateSize(),this.scenegraph.refreshAll(),this.verticalSplitResizeLine.style.height=this.drawHeight+"px";const e=this.stateManager.scroll.horizontalBarPos,i=this.stateManager.scroll.verticalBarPos;this.scenegraph.setX(-e),this.scenegraph.setY(-i)}updateScales(t){const e=this.parsedOptions.sortedTimelineScales.length;if(this.options.timelineHeader.scales=t,this._sortScales(),function(t){var e,i,n,s;const r=t.options,{unit:a,startOfWeek:o,step:l}=t.parsedOptions.reverseSortedTimelineScales[0];t.parsedOptions.minDate=Cu(new Date(t.parsedOptions.minDate),a,o),t.parsedOptions.maxDate=Au(t.parsedOptions.minDate,new Date(t.parsedOptions.maxDate),a,l),t.parsedOptions._minDateTime=null===(e=t.parsedOptions.minDate)||void 0===e?void 0:e.getTime(),t.parsedOptions._maxDateTime=null===(i=t.parsedOptions.maxDate)||void 0===i?void 0:i.getTime(),t.parsedOptions.timeLineHeaderRowHeights=[],t.parsedOptions.timelineHeaderStyles=[];for(let e=0;e<t.parsedOptions.sortedTimelineScales.length;e++){const i=t.parsedOptions.sortedTimelineScales[e].style;t.parsedOptions.timelineHeaderStyles.push(Object.assign({fontSize:20,fontWeight:"bold",textAlign:"center",textBaseline:"middle",color:"#000",backgroundColor:"#fff"},i)),t.parsedOptions.timeLineHeaderRowHeights.push(null!==(s=null!==(n=t.parsedOptions.sortedTimelineScales[e].rowHeight)&&void 0!==n?n:null==r?void 0:r.headerRowHeight)&&void 0!==s?s:40)}}(this),this._generateTimeLineDateMap(),this.timeLineHeaderLevel=this.parsedOptions.sortedTimelineScales.length,this.scenegraph.refreshAll(),ju(this),this.taskListTableInstance)if(this.taskListTableInstance.columnHeaderLevelCount===this.parsedOptions.timeLineHeaderRowHeights.length)for(let t=0;t<this.taskListTableInstance.columnHeaderLevelCount;t++)this.taskListTableInstance.setRowHeight(t,this.parsedOptions.timeLineHeaderRowHeights[t]);else{const t=this.getAllHeaderRowsHeight()/this.taskListTableInstance.columnHeaderLevelCount;for(let e=0;e<this.taskListTableInstance.columnHeaderLevelCount;e++)this.taskListTableInstance.setRowHeight(e,t)}e!==t.length&&this._resize()}updateDateRange(t,e){this.options.minDate=t,this.options.maxDate=e,function(t){var e,i;const n=t.options,{unit:s,startOfWeek:r,step:a}=t.parsedOptions.reverseSortedTimelineScales[0];t.parsedOptions.minDate=(null==n?void 0:n.minDate)?Cu(new Date(n.minDate),s,r):void 0,t.parsedOptions.maxDate=(null==n?void 0:n.maxDate)?Au(t.parsedOptions.minDate,new Date(n.maxDate),s,a):void 0,t.parsedOptions._minDateTime=null===(e=t.parsedOptions.minDate)||void 0===e?void 0:e.getTime(),t.parsedOptions._maxDateTime=null===(i=t.parsedOptions.maxDate)||void 0===i?void 0:i.getTime()}(this),this._generateTimeLineDateMap(),this._updateSize(),this.scenegraph.refreshAll(),this._scrollToMarkLine()}updateMarkLine(t){this.options.markLine=t,qu(this),this.scenegraph.markLine.refresh(),this.scenegraph.renderSceneGraph()}addMarkLine(t){this.options.markLine=[...this.parsedOptions.markLine,t],qu(this),this.scenegraph.markLine.refresh(),this.scenegraph.renderSceneGraph(),this.scenegraph.updateNextFrame()}updateCurrentMarkLine(t){const e=this.parsedOptions.markLine.findIndex((e=>e.date===t.date));-1!==e&&(this.options.markLine=[...this.parsedOptions.markLine.slice(0,e),Object.assign(Object.assign({},this.options.markLine[e]),t),...this.parsedOptions.markLine.slice(e+1)],qu(this),this.scenegraph.markLine.refresh(),this.scenegraph.renderSceneGraph(),this.scenegraph.updateNextFrame())}_scrollToMarkLine(){if(this.parsedOptions.scrollToMarkLineDate&&this.parsedOptions.minDate){const t=this.parsedOptions.minDate,{unit:e,step:i}=this.parsedOptions.reverseSortedTimelineScales[0],n=Lu(this.parsedOptions.scrollToMarkLineDate,t,e,i)*this.parsedOptions.timelineColWidth-this.tableNoFrameWidth/2;this.stateManager.setScrollLeft(n)}}scrollToMarkLine(t){if(!t||!this.parsedOptions.minDate)return;const e=this.parsedOptions.minDate,{unit:i,step:n}=this.parsedOptions.reverseSortedTimelineScales[0],s=Lu(t,e,i,n)*this.parsedOptions.timelineColWidth-this.tableNoFrameWidth/2;this.stateManager.setScrollLeft(s)}addLink(t){this.parsedOptions.dependencyLinks.push(t),this.scenegraph.dependencyLink.initLinkLine(this.parsedOptions.dependencyLinks.length-1),this.scenegraph.updateNextFrame()}deleteLink(t){if(this.parsedOptions.dependencyLinkDeletable){const e=this.parsedOptions.dependencyLinks.findIndex((e=>e.type===t.type&&e.linkedFromTaskKey===t.linkedFromTaskKey&&e.linkedToTaskKey===t.linkedToTaskKey));if(-1!==e){const t=this.parsedOptions.dependencyLinks[e];this.parsedOptions.dependencyLinks.splice(e,1),this.scenegraph.dependencyLink.deleteLink(t),this.scenegraph.updateNextFrame()}}}get scrollTop(){return this.stateManager.scrollTop}set scrollTop(t){this.stateManager.setScrollTop(t)}get scrollLeft(){return this.stateManager.scrollLeft}set scrollLeft(t){this.stateManager.setScrollLeft(t)}getTaskBarRelativeRect(t){const e=this.scenegraph.taskBar.getTaskBarNodeByIndex(t);return{left:e.attribute.x+this.taskListTableInstance.tableNoFrameWidth+this.taskListTableInstance.tableX+this.tableX-this.scrollLeft,top:e.attribute.y+this.tableY+this.headerHeight-this.scrollTop,width:e.attribute.width,height:e.attribute.height}}getDateColWidth(t){return this.parsedOptions.timelineColWidth}getDateColsWidth(t,e){return(e-t+1)*this.parsedOptions.timelineColWidth}getDateRangeByIndex(t){const e=this.parsedOptions.reverseSortedTimelineScales[0];return t<e.timelineDates.length?{startDate:e.timelineDates[t].startDate,endDate:e.timelineDates[t].endDate}:null}parseTimeFormat(t){return bu(t)}getTaskBarStyle(t,e){const{startDate:i,endDate:n,taskRecord:s}=this.getTaskInfoByTaskListIndex(t,e);let r;return r=s.type===cu.PROJECT?this.parsedOptions.projectBarStyle:this.parsedOptions.taskBarStyle,"function"==typeof r?r({index:t,startDate:i,endDate:n,taskRecord:s,ganttInstance:this}):r}formatDate(t,e){return gu(t,e)}}t.AddRowColumnPlugin=class{id=`add-row-column-${Date.now()}`;name="Add Row Column";runTime=[n.TABLE_EVENT_TYPE.MOUSEENTER_CELL,n.TABLE_EVENT_TYPE.MOUSELEAVE_CELL,n.TABLE_EVENT_TYPE.MOUSELEAVE_TABLE];pluginOptions;table;hoverCell;hideAllTimeoutId_addColumn;hideAllTimeoutId_addRow;leftDotForAddColumn;rightDotForAddColumn;addIconForAddColumn;addLineForAddColumn;topDotForAddRow;bottomDotForAddRow;addIconForAddRow;addLineForAddRow;constructor(t={addColumnEnable:!0,addRowEnable:!0}){this.id=t.id??this.id,this.pluginOptions=t,this.pluginOptions.addColumnEnable=this.pluginOptions.addColumnEnable??!0,this.pluginOptions.addRowEnable=this.pluginOptions.addRowEnable??!0,this.pluginOptions.addColumnEnable&&(this.initAddColumnDomElement(),this.bindEventForAddColumn()),this.pluginOptions.addRowEnable&&(this.initAddRowDomElement(),this.bindEventForAddRow())}run(...t){const e=t[0],i=t[1],s=t[2];if(this.table=s,i===n.TABLE_EVENT_TYPE.MOUSEENTER_CELL){clearTimeout(this.hideAllTimeoutId_addColumn),clearTimeout(this.hideAllTimeoutId_addRow);const t=s.canvas.getBoundingClientRect(),i=s.getCellAtRelativePosition(e.event.clientX-t.left,e.event.clientY-t.top);this.hoverCell=i;const n=s.getCellRelativeRect(i.col,i.row);if(this.pluginOptions.addColumnEnable){const e=s.isSeriesNumber(i.col,0);this.showDotForAddColumn(t.top-6,n.left+t.left,n.right+t.left,!e)}if(this.pluginOptions.addRowEnable){const e=s.isHeader(i.col,i.row);this.showDotForAddRow(n.top+t.top,t.left-6,n.bottom+t.top,!e,!e)}}else i===n.TABLE_EVENT_TYPE.MOUSELEAVE_CELL||i===n.TABLE_EVENT_TYPE.MOUSELEAVE_TABLE&&(this.pluginOptions.addColumnEnable&&this.delayHideAllForAddColumn(),this.pluginOptions.addRowEnable&&this.delayHideAllForAddRow())}initAddColumnDomElement(){this.leftDotForAddColumn=document.createElement("div"),this.leftDotForAddColumn.style.width="6px",this.leftDotForAddColumn.style.height="6px",this.leftDotForAddColumn.style.backgroundColor="#4A90E2",this.leftDotForAddColumn.style.position="absolute",this.leftDotForAddColumn.style.cursor="pointer",this.leftDotForAddColumn.style.zIndex="1000",this.leftDotForAddColumn.style.borderRadius="50%",this.leftDotForAddColumn.style.border="1px solid white",this.leftDotForAddColumn.style.boxShadow="0 1px 3px rgba(0,0,0,0.2)",document.body.appendChild(this.leftDotForAddColumn),this.rightDotForAddColumn=document.createElement("div"),this.rightDotForAddColumn.style.width="6px",this.rightDotForAddColumn.style.height="6px",this.rightDotForAddColumn.style.backgroundColor="#4A90E2",this.rightDotForAddColumn.style.position="absolute",this.rightDotForAddColumn.style.cursor="pointer",this.rightDotForAddColumn.style.zIndex="1000",this.rightDotForAddColumn.style.borderRadius="50%",this.rightDotForAddColumn.style.border="1px solid white",this.rightDotForAddColumn.style.boxShadow="0 1px 3px rgba(0,0,0,0.2)",document.body.appendChild(this.rightDotForAddColumn),this.addIconForAddColumn=document.createElement("div"),this.addIconForAddColumn.style.width="18px",this.addIconForAddColumn.style.height="18px",this.addIconForAddColumn.style.backgroundColor="#4A90E2",this.addIconForAddColumn.style.position="absolute",this.addIconForAddColumn.style.zIndex="1001",this.addIconForAddColumn.style.display="none",this.addIconForAddColumn.style.borderRadius="50%",this.addIconForAddColumn.style.boxShadow="0 2px 5px rgba(0,0,0,0.2)",this.addIconForAddColumn.style.display="flex",this.addIconForAddColumn.style.justifyContent="center",this.addIconForAddColumn.style.alignItems="center",this.addIconForAddColumn.style.border="1px solid white",document.body.appendChild(this.addIconForAddColumn);const t=document.createElement("div");t.textContent="+",t.style.color="white",t.style.fontSize="18px",t.style.fontWeight="bold",t.style.lineHeight="15px",t.style.userSelect="none",t.style.cursor="pointer",t.style.verticalAlign="top",t.style.textAlign="center",this.addIconForAddColumn.appendChild(t),this.addLineForAddColumn=document.createElement("div"),this.addLineForAddColumn.style.width="2px",this.addLineForAddColumn.style.height="10px",this.addLineForAddColumn.style.backgroundColor="#4A90E2",this.addLineForAddColumn.style.position="absolute",this.addLineForAddColumn.style.zIndex="1001",this.addLineForAddColumn.style.display="none",document.body.appendChild(this.addLineForAddColumn)}bindEventForAddColumn(){this.leftDotForAddColumn.addEventListener("mouseenter",(()=>{clearTimeout(this.hideAllTimeoutId_addColumn),this.addIconForAddColumn.style.display="block";const t=this.leftDotForAddColumn.offsetWidth,e=this.leftDotForAddColumn.offsetHeight;this.showAddIconForAddColumn(this.leftDotForAddColumn.offsetLeft+t/2,this.leftDotForAddColumn.offsetTop+e/2,!0),this.showSplitLineForAddColumn(this.leftDotForAddColumn.offsetLeft+t/2-1,this.leftDotForAddColumn.offsetTop+e/2+2,this.table.getDrawRange().height)})),this.rightDotForAddColumn.addEventListener("mouseenter",(()=>{clearTimeout(this.hideAllTimeoutId_addColumn),this.addIconForAddColumn.style.display="block";const t=this.rightDotForAddColumn.offsetWidth,e=this.rightDotForAddColumn.offsetHeight;this.showAddIconForAddColumn(this.rightDotForAddColumn.offsetLeft+t/2,this.rightDotForAddColumn.offsetTop+e/2,!1),this.showSplitLineForAddColumn(this.rightDotForAddColumn.offsetLeft+t/2-1,this.rightDotForAddColumn.offsetTop+e/2+2,this.table.getDrawRange().height)})),this.addIconForAddColumn.addEventListener("mouseleave",(()=>{this.addIconForAddColumn.style.display="none",this.addLineForAddColumn.style.display="none",this.delayHideAllForAddColumn()})),this.addIconForAddColumn.addEventListener("click",(t=>{const e="left"===this.addIconForAddColumn.dataset.addIconType,i=this.table.options.columns,n=this.hoverCell.col,s=e?n:n+1;this.pluginOptions.addColumnCallback?this.pluginOptions.addColumnCallback(s):(i.splice(s,0,{field:"",title:`New Column ${n}`,width:100}),this.table.updateColumns(i)),this.delayHideAllForAddColumn(0)}))}showDotForAddColumn(t,e,i,n=!0,s=!0){const r=this.leftDotForAddColumn.offsetWidth,a=this.leftDotForAddColumn.offsetHeight;this.leftDotForAddColumn.style.left=e-r/2+"px",this.leftDotForAddColumn.style.top=t-a/2+"px",this.rightDotForAddColumn.style.left=i-r/2+"px",this.rightDotForAddColumn.style.top=t-a/2+"px",this.leftDotForAddColumn.style.display=n?"block":"none",this.rightDotForAddColumn.style.display=s?"block":"none"}showAddIconForAddColumn(t,e,i){const n=this.addIconForAddColumn.offsetWidth,s=this.addIconForAddColumn.offsetHeight,r=this.leftDotForAddColumn.offsetHeight;this.addIconForAddColumn.style.left=t-n/2+"px",this.addIconForAddColumn.style.top=e-s/2-r/2+"px",this.addIconForAddColumn.dataset.addIconType=i?"left":"right"}showSplitLineForAddColumn(t,e,i){this.addLineForAddColumn.style.left=`${t}px`,this.addLineForAddColumn.style.top=`${e}px`,this.addLineForAddColumn.style.height=`${i}px`,this.addLineForAddColumn.style.display="block"}delayHideAllForAddColumn(t=1e3){this.hideAllTimeoutId_addColumn=setTimeout((()=>{this.addIconForAddColumn.style.display="none",this.addLineForAddColumn.style.display="none",this.leftDotForAddColumn.style.display="none",this.rightDotForAddColumn.style.display="none"}),t)}initAddRowDomElement(){this.topDotForAddRow=document.createElement("div"),this.topDotForAddRow.style.width="6px",this.topDotForAddRow.style.height="6px",this.topDotForAddRow.style.backgroundColor="#4A90E2",this.topDotForAddRow.style.position="absolute",this.topDotForAddRow.style.cursor="pointer",this.topDotForAddRow.style.zIndex="1000",this.topDotForAddRow.style.borderRadius="50%",this.topDotForAddRow.style.border="1px solid white",this.topDotForAddRow.style.boxShadow="0 1px 3px rgba(0,0,0,0.2)",document.body.appendChild(this.topDotForAddRow),this.bottomDotForAddRow=document.createElement("div"),this.bottomDotForAddRow.style.width="6px",this.bottomDotForAddRow.style.height="6px",this.bottomDotForAddRow.style.backgroundColor="#4A90E2",this.bottomDotForAddRow.style.position="absolute",this.bottomDotForAddRow.style.cursor="pointer",this.bottomDotForAddRow.style.zIndex="1000",this.bottomDotForAddRow.style.borderRadius="50%",this.bottomDotForAddRow.style.border="1px solid white",this.bottomDotForAddRow.style.boxShadow="0 1px 3px rgba(0,0,0,0.2)",document.body.appendChild(this.bottomDotForAddRow),this.addIconForAddRow=document.createElement("div"),this.addIconForAddRow.style.width="18px",this.addIconForAddRow.style.height="18px",this.addIconForAddRow.style.backgroundColor="#4A90E2",this.addIconForAddRow.style.position="absolute",this.addIconForAddRow.style.zIndex="1001",this.addIconForAddRow.style.display="none",this.addIconForAddRow.style.borderRadius="50%",this.addIconForAddRow.style.boxShadow="0 2px 5px rgba(0,0,0,0.2)",this.addIconForAddRow.style.display="flex",this.addIconForAddRow.style.justifyContent="center",this.addIconForAddRow.style.alignItems="center",this.addIconForAddRow.style.border="1px solid white",document.body.appendChild(this.addIconForAddRow);const t=document.createElement("div");t.textContent="+",t.style.color="white",t.style.fontSize="18px",t.style.fontWeight="bold",t.style.lineHeight="15px",t.style.userSelect="none",t.style.cursor="pointer",t.style.verticalAlign="top",t.style.textAlign="center",this.addIconForAddRow.appendChild(t),this.addLineForAddRow=document.createElement("div"),this.addLineForAddRow.style.width="10px",this.addLineForAddRow.style.height="2px",this.addLineForAddRow.style.backgroundColor="#4A90E2",this.addLineForAddRow.style.position="absolute",this.addLineForAddRow.style.zIndex="1001",this.addLineForAddRow.style.display="none",document.body.appendChild(this.addLineForAddRow)}bindEventForAddRow(){this.topDotForAddRow.addEventListener("mouseenter",(()=>{clearTimeout(this.hideAllTimeoutId_addRow),this.addIconForAddRow.style.display="block";const t=this.topDotForAddRow.offsetWidth,e=this.topDotForAddRow.offsetHeight;this.showAddIconForAddRow(this.topDotForAddRow.offsetLeft+t/2,this.topDotForAddRow.offsetTop+e/2,!0),this.showSplitLineForAddRow(this.topDotForAddRow.offsetLeft+t+2,this.topDotForAddRow.offsetTop+e/2-1,this.table.getDrawRange().width)})),this.bottomDotForAddRow.addEventListener("mouseenter",(()=>{clearTimeout(this.hideAllTimeoutId_addRow),this.addIconForAddRow.style.display="block";const t=this.bottomDotForAddRow.offsetWidth,e=this.bottomDotForAddRow.offsetHeight;this.showAddIconForAddRow(this.bottomDotForAddRow.offsetLeft+t/2,this.bottomDotForAddRow.offsetTop+e/2,!1),this.showSplitLineForAddRow(this.bottomDotForAddRow.offsetLeft+t+2,this.bottomDotForAddRow.offsetTop+e/2-1,this.table.getDrawRange().height)})),this.addIconForAddRow.addEventListener("mouseleave",(()=>{this.addIconForAddRow.style.display="none",this.addLineForAddRow.style.display="none",this.delayHideAllForAddRow()})),this.addIconForAddRow.addEventListener("click",(t=>{const e="top"===this.addIconForAddRow.dataset.addIconType,i=this.hoverCell.row,n=e?i:i+1;if(this.pluginOptions.addRowCallback)this.pluginOptions.addRowCallback(n);else{const t=this.table.getRecordIndexByCell(0,n);this.table.addRecord({},t)}this.delayHideAllForAddRow(0)}))}showDotForAddRow(t,e,i,n=!0,s=!0){const r=this.topDotForAddRow.offsetWidth,a=this.topDotForAddRow.offsetHeight;this.topDotForAddRow.style.left=e-r/2+"px",this.topDotForAddRow.style.top=t-a/2+"px",this.bottomDotForAddRow.style.left=e-r/2+"px",this.bottomDotForAddRow.style.top=i-a/2+"px",this.topDotForAddRow.style.display=n?"block":"none",this.bottomDotForAddRow.style.display=s?"block":"none"}showAddIconForAddRow(t,e,i){const n=this.addIconForAddRow.offsetWidth,s=this.addIconForAddRow.offsetHeight,r=this.topDotForAddRow.offsetWidth;this.addIconForAddRow.style.left=t-n/2-r/2+"px",this.addIconForAddRow.style.top=e-s/2+"px",this.addIconForAddRow.dataset.addIconType=i?"top":"bottom"}showSplitLineForAddRow(t,e,i){this.addLineForAddRow.style.left=`${t}px`,this.addLineForAddRow.style.top=`${e}px`,this.addLineForAddRow.style.width=`${i}px`,this.addLineForAddRow.style.display="block"}delayHideAllForAddRow(t=1e3){this.hideAllTimeoutId_addRow=setTimeout((()=>{this.addIconForAddRow.style.display="none",this.addLineForAddRow.style.display="none",this.topDotForAddRow.style.display="none",this.bottomDotForAddRow.style.display="none"}),t)}release(){this.leftDotForAddColumn.remove(),this.rightDotForAddColumn.remove(),this.addIconForAddColumn.remove(),this.addLineForAddColumn.remove(),this.topDotForAddRow.remove(),this.bottomDotForAddRow.remove(),this.addIconForAddRow.remove(),this.addLineForAddRow.remove()}},t.CarouselAnimationPlugin=class{table;rowCount;colCount;animationDuration;animationDelay;animationEasing;replaceScrollAction;playing;row;col;willUpdateRow=!1;willUpdateCol=!1;customDistRowFunction;customDistColFunction;constructor(t,e){this.table=t,this.rowCount=e?.rowCount??void 0,this.colCount=e?.colCount??void 0,this.animationDuration=e?.animationDuration??500,this.animationDelay=e?.animationDelay??1e3,this.animationEasing=e?.animationEasing??"linear",this.replaceScrollAction=e?.replaceScrollAction??!1,this.customDistColFunction=e.customDistColFunction,this.customDistRowFunction=e.customDistRowFunction,this.reset(),this.init()}init(){this.replaceScrollAction&&(this.table.disableScroll(),this.table.scenegraph.stage.addEventListener("wheel",this.onScrollEnd.bind(this)))}reset(){this.playing=!1,this.row=this.table.frozenRowCount,this.col=this.table.frozenColCount}onScrollEnd(t){this.rowCount?(t.deltaY>0?(this.row+=this.rowCount,this.row=Math.min(this.row,this.table.rowCount-this.table.frozenRowCount)):t.deltaY<0&&(this.row-=this.rowCount,this.row=Math.max(this.row,this.table.frozenRowCount)),this.table.scrollToRow(this.row,{duration:this.animationDuration,easing:this.animationEasing})):this.colCount&&(t.deltaX>0?(this.col+=this.colCount,this.col=Math.min(this.col,this.table.colCount-this.table.frozenColCount)):t.deltaX<0&&(this.col-=this.colCount,this.col=Math.max(this.col,this.table.frozenColCount)),this.table.scrollToCol(this.col,{duration:this.animationDuration,easing:this.animationEasing}))}play(){this.playing=!0,this.rowCount&&!this.willUpdateRow?this.updateRow():this.colCount&&!this.willUpdateCol&&this.updateCol()}pause(){this.playing=!1}updateRow(){if(!this.playing||this.table.isReleased)return;let t=!0;const e=this.customDistRowFunction&&this.customDistRowFunction(this.row,this.table);e?(this.row=e.distRow,t=e.animation??!0):s(this.row)&&this.table.scenegraph.proxy.screenTopRow!==this.row?(this.row=this.table.frozenRowCount,t=!1):s(this.row)||this.table.scenegraph.proxy.screenTopRow===Math.floor(this.row)?this.row+=this.rowCount:(this.row=this.table.frozenRowCount,t=!1),this.table.scrollToRow(this.row,t?{duration:this.animationDuration,easing:this.animationEasing}:void 0),this.willUpdateRow=!0,setTimeout((()=>{this.willUpdateRow=!1,this.updateRow()}),this.animationDuration+this.animationDelay)}updateCol(){if(!this.playing||this.table.isReleased)return;let t=!0;const e=this.customDistColFunction&&this.customDistColFunction(this.col,this.table);e?(this.col=e.distCol,t=e.animation??!0):s(this.col)&&this.table.scenegraph.proxy.screenLeftCol!==this.col?(this.col=this.table.frozenColCount,t=!1):s(this.col)||this.table.scenegraph.proxy.screenLeftCol===Math.floor(this.col)?this.col+=this.colCount:(this.col=this.table.frozenColCount,t=!1),this.table.scrollToCol(this.col,t?{duration:this.animationDuration,easing:this.animationEasing}:void 0),this.willUpdateCol=!0,setTimeout((()=>{this.willUpdateCol=!1,this.updateCol()}),this.animationDuration+this.animationDelay)}},t.ColumnSeriesPlugin=class{id=`column-series-${Date.now()}`;name="Column Series";runTime=[n.TABLE_EVENT_TYPE.BEFORE_INIT,n.TABLE_EVENT_TYPE.BEFORE_KEYDOWN];pluginOptions;table;columns=[];constructor(t){this.id=t.id??this.id,this.pluginOptions=Object.assign({columnCount:100},t)}run(...t){if(t[1]===n.TABLE_EVENT_TYPE.BEFORE_INIT){const e=t[0],i=t[2];this.table=i;const n=e.options;this.columns=this.generateColumns(this.pluginOptions.columnCount),n.columns=this.columns}else if(t[1]===n.TABLE_EVENT_TYPE.BEFORE_KEYDOWN){const e=t[0].event;this.pluginOptions.autoExtendColumnTriggerKeys?.includes(e.key)&&this.table.stateManager.select.cellPos.col===this.table.colCount-1&&this.table.addColumn(this.generateColumn(this.table.colCount-1))}}generateColumns(t){const e=[];for(let i=0;i<t;i++)e.push(this.generateColumn(i));return e}generateColumn(t){return{title:this.pluginOptions.generateColumnTitle?this.pluginOptions.generateColumnTitle(t):this.generateColumnField(t)}}generateColumnField(t){if(t<26)return String.fromCharCode(65+t);const e=[];for(t++;t>0;)t--,e.unshift(String.fromCharCode(65+t%26)),t=Math.floor(t/26);return e.join("")}resetColumnCount(t){this.pluginOptions.columnCount=t,this.columns=this.generateColumns(t),this.table.updateColumns(this.columns)}},t.ExcelEditCellKeyboardPlugin=class{id=`excel-edit-cell-keyboard-${Date.now()}`;name="Excel Edit Cell Keyboard";runTime=[n.TABLE_EVENT_TYPE.INITIALIZED];table;pluginOptions;constructor(t){this.id=t?.id??this.id,this.pluginOptions=t,this.bindEvent()}run(...t){const e=t[2];this.table=e}bindEvent(){document.addEventListener("keydown",this.handleKeyDown.bind(this),!0)}handleKeyDown(t){if(this.table.editorManager)if("keydown"===this.table.editorManager.beginTriggerEditCellMode){if(this.table.editorManager.editingEditor&&this.isExcelShortcutKey(t)){const{col:e,row:i}=this.table.editorManager.editCell;this.table.editorManager.completeEdit(),this.table.getElement().focus(),t.shiftKey||t.ctrlKey||t.metaKey||("Enter"===t.key?this.table.selectCell(e,i+1):"Tab"===t.key?this.table.selectCell(e+1,i):"ArrowLeft"===t.key?this.table.selectCell(e-1,i):"ArrowRight"===t.key?this.table.selectCell(e+1,i):"ArrowDown"===t.key?this.table.selectCell(e,i+1):"ArrowUp"===t.key&&this.table.selectCell(e,i-1),t.stopPropagation(),t.preventDefault())}}else{const{col:e,row:i}=this.table.stateManager.select.cellPos;if(!this.table.editorManager.editingEditor||"Enter"!==t.key&&"Tab"!==t.key){if("Delete"===t.key){const e=this.table.getSelectedCellInfos();e?.length>0&&function(t,e){for(let i=0;i<t.length;i++)for(let n=0;n<t[i].length;n++)e.changeCellValue(t[i][n].col,t[i][n].row,"")}(e,this.table),t.stopPropagation(),t.preventDefault()}}else this.table.editorManager.completeEdit(),this.table.getElement().focus(),"Enter"===t.key?this.table.selectCell(e,i+1):"Tab"===t.key&&this.table.selectCell(e+1,i),t.stopPropagation(),t.preventDefault()}}isExcelShortcutKey(t){return"Enter"===t.key||"Tab"===t.key||"ArrowLeft"===t.key||"ArrowRight"===t.key||"ArrowDown"===t.key||"ArrowUp"===t.key}release(){document.removeEventListener("keydown",this.handleKeyDown,!0)}},t.ExportGanttPlugin=class{id="gantt-export-helper";name="Gantt Export Helper";_gantt=null;run(...t){const e=t[0];e&&(this._gantt=e)}async exportToImage(t={}){if(!this._gantt)return;const{fileName:e="gantt-export",type:i="png",quality:n=1,backgroundColor:s="#ffffff",scale:r=window.devicePixelRatio||1}=t;try{const{tempContainer:t,clonedGantt:a}=this.createFullSizeContainer(r);try{await new Promise((t=>requestAnimationFrame(t)));const t=(a.taskListTableInstance.getAllColsWidth()+a.getAllDateColsWidth())*r,o=a.getAllRowsHeight()*r,l=document.createElement("canvas");l.width=t,l.height=o;const h=l.getContext("2d");h.fillStyle=s,h.fillRect(0,0,t,o),a.taskListTableInstance?.canvas&&h.drawImage(a.taskListTableInstance.canvas,0,0,a.taskListTableInstance.getAllColsWidth()*r,o);const d=3*r,c=a.taskListTableInstance.getAllColsWidth()*r;h.fillStyle="rgb(225, 228, 232)",h.fillRect(c-d/2,0,d,o);const u=4*r,p=a.canvas.width-u;return a.canvas&&h.drawImage(a.canvas,u,0,p,a.canvas.height,(a.taskListTableInstance.getAllColsWidth()+1.5)*r,0,(a.getAllDateColsWidth()-1.5)*r,o),this.finalizeExport(l,e,i,n)}finally{t.remove(),a.release()}}catch(t){throw new Error(`甘特图导出失败: ${t instanceof Error?t.message:"未知错误"}`)}}createFullSizeContainer(t){if(!this._gantt)throw new Error("ExportGanttPlugin: Gantt instance not available to create container.");const e=document.createElement("div");e.style.position="fixed",e.style.left="-9999px",e.style.overflow="hidden",e.style.width=`${window.innerWidth+100}px`,e.style.height=`${window.innerHeight+100}px`,document.body.appendChild(e);const i=document.createElement("div"),n=this._gantt.taskListTableInstance.getAllColsWidth()+this._gantt.getAllDateColsWidth(),s=this._gantt.getAllRowsHeight();i.style.width=`${n}px`,i.style.height=`${s}px`,e.appendChild(i);const r=new Rp(i,{...this._gantt.options,records:JSON.parse(JSON.stringify(this._gantt.records)),taskListTable:{...this._gantt.options.taskListTable,tableWidth:void 0,minTableWidth:void 0,maxTableWidth:void 0}});return r.setPixelRatio(t),r.scenegraph?.ganttGroup&&r.scenegraph.ganttGroup.setAttribute("clip",!1),r.taskListTableInstance?.scenegraph?.tableGroup&&r.taskListTableInstance.scenegraph.tableGroup.setAttribute("clip",!1),r.scenegraph.stage.render(),{tempContainer:e,clonedGantt:r}}finalizeExport(t,e,i,n){const s=t.toDataURL(`image/${i}`,n),r=document.createElement("a");return r.download=`${e}.${i}`,r.href=s,document.body.appendChild(r),r.click(),document.body.removeChild(r),s}release(){this._gantt=null}},t.FocusHighlightPlugin=class{id=`focus-highlight-${Date.now()}`;name="Focus Highlight";runTime=[e.TABLE_EVENT_TYPE.INITIALIZED,e.TABLE_EVENT_TYPE.SELECTED_CELL,e.TABLE_EVENT_TYPE.SELECTED_CLEAR];table;range;pluginOptions;constructor(t={fill:"#000",opacity:.5,highlightRange:void 0}){this.id=t.id??this.id,this.pluginOptions=Object.assign({fill:"#000",opacity:.5},t)}run(...t){if(this.table||(this.table=t[2]),t[1]===e.TABLE_EVENT_TYPE.INITIALIZED)this.pluginOptions.highlightRange&&this.setFocusHighlightRange(this.pluginOptions.highlightRange);else if(t[1]===e.TABLE_EVENT_TYPE.SELECTED_CELL){const t=this.table.stateManager.select.cellPos;if(this.table.isHeader(t.col,t.row))this.setFocusHighlightRange(void 0);else{const t=this.table.stateManager.select.ranges,e=0,i=this.table.colCount-1,n=Math.min(t[0].start.row,t[0].end.row),s=Math.max(t[0].start.row,t[0].end.row);this.setFocusHighlightRange({start:{col:e,row:n},end:{col:i,row:s}})}}else t[1]===e.TABLE_EVENT_TYPE.SELECTED_CLEAR&&this.setFocusHighlightRange(void 0)}setFocusHighlightRange(t,e=!1){let i;t&&"start"in t&&"end"in t?i=t:t&&(i={start:t,end:t}),Qc(this.range,i)&&!e||(this.range=i,t?this.updateCellGroupShadow():this.deleteAllCellGroupShadow(),this.table.scenegraph.updateNextFrame())}deleteAllCellGroupShadow(){this.table.isPivotTable()||(this.updateCellGroupShadowInContainer(this.table.scenegraph.rowHeaderGroup),this.updateCellGroupShadowInContainer(this.table.scenegraph.leftBottomCornerGroup)),this.updateCellGroupShadowInContainer(this.table.scenegraph.bodyGroup),this.updateCellGroupShadowInContainer(this.table.scenegraph.rightFrozenGroup),this.updateCellGroupShadowInContainer(this.table.scenegraph.bottomFrozenGroup),this.updateCellGroupShadowInContainer(this.table.scenegraph.rightBottomCornerGroup)}updateCellGroupShadow(){this.table.isPivotTable()||(this.updateCellGroupShadowInContainer(this.table.scenegraph.rowHeaderGroup,this.range),this.updateCellGroupShadowInContainer(this.table.scenegraph.leftBottomCornerGroup,this.range)),this.updateCellGroupShadowInContainer(this.table.scenegraph.bodyGroup,this.range),this.updateCellGroupShadowInContainer(this.table.scenegraph.rightFrozenGroup,this.range),this.updateCellGroupShadowInContainer(this.table.scenegraph.bottomFrozenGroup),this.range,this.updateCellGroupShadowInContainer(this.table.scenegraph.rightBottomCornerGroup,this.range)}updateCellGroupShadowInContainer(t,e){let i;e&&"start"in e&&"end"in e?i=e:e&&(i={start:e,end:e}),t.forEachChildrenSkipChild((t=>{const e=t;"column"===e.role&&e.forEachChildrenSkipChild((t=>{const e=t;if("cell"!==e.role)return;e.attachShadow(e.shadowRoot);const n=e.shadowRoot;if(i){if(iu(i,e.col,e.row))n.removeAllChild();else if(!n.firstChild){const t=jo({x:0,y:0,width:e.attribute.width,height:e.attribute.height,fill:this.pluginOptions.fill,opacity:this.pluginOptions.opacity});t.name="shadow-rect",n.appendChild(t)}}else n.removeAllChild()}))}))}update(){this.setFocusHighlightRange(this.range,!0)}},t.HeaderHighlightPlugin=class{table;options;colHeaderRange;rowHeaderRange;constructor(t,e){this.table=t,this.options=e,this.registerStyle(),this.bindEvent()}registerStyle(){this.table.registerCustomCellStyle("col-highlight",{bgColor:this.options?.colHighlightBGColor??"#82b2f5",color:this.options?.colHighlightColor??"#FFF"}),this.table.registerCustomCellStyle("row-highlight",{bgColor:this.options?.rowHighlightBGColor??"#82b2f5",color:this.options?.rowHighlightColor??"#FFF"})}bindEvent(){this.table.on("selected_cell",(()=>{this.updateHighlight()})),this.table.on("selected_clear",(()=>{this.clearHighlight()})),this.table.on("mousemove_table",(()=>{this.table.stateManager.select.selecting&&this.updateHighlight()}))}clearHighlight(){this.colHeaderRange&&this.table.arrangeCustomCellStyle({range:this.colHeaderRange},void 0,!0),this.rowHeaderRange&&this.table.arrangeCustomCellStyle({range:this.rowHeaderRange},void 0,!0),this.colHeaderRange=void 0,this.rowHeaderRange=void 0}updateHighlight(){if(!1===this.options?.colHighlight&&!1===this.options?.rowHighlight)return;const t=this.table.getSelectedCellRanges();if(0===t.length)return void this.clearHighlight();const e=t[0],i=[e.start.row,e.end.row];i.sort(((t,e)=>t-e));const n=[e.start.col,e.end.col];let s,r;n.sort(((t,e)=>t-e)),this.table.isPivotTable()?(s={start:{col:n[0],row:0},end:{col:n[1],row:this.table.columnHeaderLevelCount-1}},r={start:{col:0,row:i[0]},end:{col:this.table.rowHeaderLevelCount-1,row:i[1]}}):this.table.internalProps.transpose?r={start:{col:0,row:i[0]},end:{col:this.table.rowHeaderLevelCount-1,row:i[1]}}:(s={start:{col:n[0],row:0},end:{col:n[1],row:this.table.columnHeaderLevelCount-1}},this.table.internalProps.rowSeriesNumber&&(r={start:{col:0,row:i[0]},end:{col:0,row:i[1]}})),!1===this.options?.colHighlight||nu(this.colHeaderRange,s)||(this.colHeaderRange&&this.table.arrangeCustomCellStyle({range:this.colHeaderRange},void 0),s&&this.table.arrangeCustomCellStyle({range:s},"col-highlight"),this.colHeaderRange=s),!1===this.options?.rowHighlight||nu(this.rowHeaderRange,r)||(this.rowHeaderRange&&this.table.arrangeCustomCellStyle({range:this.rowHeaderRange},void 0),r&&this.table.arrangeCustomCellStyle({range:r},"row-highlight"),this.rowHeaderRange=r)}},t.HighlightHeaderWhenSelectCellPlugin=class{id=`highlight-header-when-select-cell-${Date.now()}`;name="Highlight Header When Select Cell";runTime=[e.TABLE_EVENT_TYPE.INITIALIZED,e.TABLE_EVENT_TYPE.SELECTED_CLEAR,e.TABLE_EVENT_TYPE.SELECTED_CELL,e.TABLE_EVENT_TYPE.MOUSEMOVE_TABLE];table;pluginOptions;colHeaderRanges=[];rowHeaderRanges=[];constructor(t){this.id=t.id??this.id,this.pluginOptions=t}run(...t){const i=t[1],n=t[2];this.table=n,i===e.TABLE_EVENT_TYPE.SELECTED_CLEAR?this.clearHighlight():i===e.TABLE_EVENT_TYPE.SELECTED_CELL||i===e.TABLE_EVENT_TYPE.MOUSEMOVE_TABLE?this.updateHighlight():i===e.TABLE_EVENT_TYPE.INITIALIZED&&this.registerStyle()}registerStyle(){this.table.registerCustomCellStyle("col-highlight",{bgColor:this.pluginOptions?.colHighlightBGColor??"#82b2f5",color:this.pluginOptions?.colHighlightColor??"#FFF"}),this.table.registerCustomCellStyle("row-highlight",{bgColor:this.pluginOptions?.rowHighlightBGColor??"#82b2f5",color:this.pluginOptions?.rowHighlightColor??"yellow"})}clearHighlight(){this.colHeaderRanges&&this.colHeaderRanges.forEach((t=>{this.table.arrangeCustomCellStyle({range:t},void 0)})),this.rowHeaderRanges&&this.rowHeaderRanges.forEach((t=>{this.table.arrangeCustomCellStyle({range:t},void 0)})),this.colHeaderRanges=[],this.rowHeaderRanges=[]}updateHighlight(){if(!1===this.pluginOptions?.colHighlight&&!1===this.pluginOptions?.rowHighlight)return;const t=this.table.getSelectedCellRanges();t.length<2&&this.clearHighlight();for(let e=0;e<t.length;e++){const i=t[e],n=[i.start.row,i.end.row];n.sort(((t,e)=>t-e));const s=[i.start.col,i.end.col];let r,a;s.sort(((t,e)=>t-e)),this.table.isPivotTable()?(r={start:{col:s[0],row:0},end:{col:s[1],row:this.table.columnHeaderLevelCount-1}},a={start:{col:0,row:n[0]},end:{col:this.table.rowHeaderLevelCount-1,row:n[1]}}):this.table.internalProps.transpose?a={start:{col:0,row:n[0]},end:{col:this.table.rowHeaderLevelCount-1,row:n[1]}}:(r={start:{col:s[0],row:0},end:{col:s[1],row:this.table.columnHeaderLevelCount-1}},this.table.internalProps.rowSeriesNumber&&(a={start:{col:0,row:n[0]},end:{col:0,row:n[1]}})),!1===this.pluginOptions?.colHighlight||this.colHeaderRanges.find((t=>su(t,r)))||(r&&this.table.arrangeCustomCellStyle({range:r},"col-highlight"),this.colHeaderRanges.push(r)),!1===this.pluginOptions?.rowHighlight||this.rowHeaderRanges.find((t=>su(t,a)))||(a&&this.table.arrangeCustomCellStyle({range:a},"row-highlight"),this.rowHeaderRanges.push(a))}}update(){this.registerStyle(),this.updateHighlight()}release(){this.rowHeaderRanges=[],this.colHeaderRanges=[]}},t.InvertHighlightPlugin=class{table;range;_fill;_opacity;constructor(t,e){this.table=t,this._fill=e?.fill??"#000",this._opacity=e?.opacity??.5}setInvertHighlightRange(t){Qc(this.range,t)||(this.range=t,t?this.updateCellGroupShadow():this.deleteAllCellGroupShadow(),this.table.scenegraph.updateNextFrame())}deleteAllCellGroupShadow(){this.table.isPivotTable()||(this.updateCellGroupShadowInContainer(this.table.scenegraph.rowHeaderGroup),this.updateCellGroupShadowInContainer(this.table.scenegraph.leftBottomCornerGroup)),this.updateCellGroupShadowInContainer(this.table.scenegraph.bodyGroup),this.updateCellGroupShadowInContainer(this.table.scenegraph.rightFrozenGroup),this.updateCellGroupShadowInContainer(this.table.scenegraph.bottomFrozenGroup),this.updateCellGroupShadowInContainer(this.table.scenegraph.rightBottomCornerGroup)}updateCellGroupShadow(){this.table.isPivotTable()||(this.updateCellGroupShadowInContainer(this.table.scenegraph.rowHeaderGroup,this.range),this.updateCellGroupShadowInContainer(this.table.scenegraph.leftBottomCornerGroup,this.range)),this.updateCellGroupShadowInContainer(this.table.scenegraph.bodyGroup,this.range),this.updateCellGroupShadowInContainer(this.table.scenegraph.rightFrozenGroup,this.range),this.updateCellGroupShadowInContainer(this.table.scenegraph.bottomFrozenGroup),this.range,this.updateCellGroupShadowInContainer(this.table.scenegraph.rightBottomCornerGroup,this.range)}updateCellGroupShadowInContainer(t,e){t.forEachChildrenSkipChild((t=>{const i=t;"column"===i.role&&i.forEachChildrenSkipChild((t=>{const i=t;if("cell"!==i.role)return;i.attachShadow(i.shadowRoot);const n=i.shadowRoot;if(e){if(iu(e,i.col,i.row))n.removeAllChild();else if(!n.firstChild){const t=jo({x:0,y:0,width:i.attribute.width,height:i.attribute.height,fill:this._fill,opacity:this._opacity});t.name="shadow-rect",n.appendChild(t)}}else n.removeAllChild()}))}))}},t.RotateTablePlugin=class{id=`rotate-table-${Date.now()}`;name="Rotate Table";runTime=[n.TABLE_EVENT_TYPE.INITIALIZED];table;matrix;vglobal_mapToCanvasPoint;constructor(t){this.id=t?.id??this.id}run(...t){const e=t[2];this.table=e,this.table.rotate90WithTransform=au.bind(this.table),this.table.cancelTransform=ou.bind(this.table)}release(){}},t.RowSeriesPlugin=class{id=`row-series-${Date.now()}`;name="Row Series";runTime=[e.TABLE_EVENT_TYPE.BEFORE_INIT,e.TABLE_EVENT_TYPE.BEFORE_KEYDOWN];pluginOptions;table;constructor(t){this.id=t.id??this.id,this.pluginOptions=Object.assign({rowCount:100},t)}run(...t){if(t[1]===e.TABLE_EVENT_TYPE.BEFORE_INIT){const e=t[0],i=t[2];this.table=i;const n=e.options,s=n.records??[];for(let t=s.length;t<this.pluginOptions.rowCount;t++)s.push(this.pluginOptions.fillRowRecord?this.pluginOptions.fillRowRecord(t):{});n.records=s,this.pluginOptions.rowSeriesNumber?(n.rowSeriesNumber=this.pluginOptions.rowSeriesNumber,this.pluginOptions.rowSeriesNumber.width||(n.rowSeriesNumber.width="auto")):n.rowSeriesNumber||(n.rowSeriesNumber={width:"auto"})}else if(t[1]===e.TABLE_EVENT_TYPE.BEFORE_KEYDOWN){const e=t[0].event;this.pluginOptions.autoExtendRowTriggerKeys?.includes(e.key)&&this.table.stateManager.select.cellPos.row===this.table.rowCount-1&&this.table.addRecord(this.pluginOptions.fillRowRecord?this.pluginOptions.fillRowRecord(this.table.rowCount-this.table.columnHeaderLevelCount):{})}}},t.TableCarouselAnimationPlugin=class{id=`table-carousel-animation-${Date.now()}`;name="Table Carousel Animation";runTime=[e.TABLE_EVENT_TYPE.INITIALIZED];table;rowCount;colCount;animationDuration;animationDelay;animationEasing;playing;row;col;willUpdateRow=!1;willUpdateCol=!1;autoPlay;autoPlayDelay;customDistRowFunction;customDistColFunction;constructor(t={}){this.id=t.id??this.id,this.rowCount=t?.rowCount??void 0,this.colCount=t?.colCount??void 0,this.animationDuration=t?.animationDuration??500,this.animationDelay=t?.animationDelay??1e3,this.animationEasing=t?.animationEasing??"linear",this.autoPlay=t?.autoPlay??!1,this.autoPlayDelay=t?.autoPlayDelay??0,this.customDistColFunction=t.customDistColFunction,this.customDistRowFunction=t.customDistRowFunction}run(...t){this.table||(this.table=t[2]),this.reset(),this.autoPlay&&setTimeout((()=>{this.play()}),this.autoPlayDelay)}reset(){this.playing=!1,this.row=this.table.frozenRowCount,this.col=this.table.frozenColCount}play(){if(!this.table)throw new Error("table is not initialized");this.playing=!0,this.rowCount&&!this.willUpdateRow?this.updateRow():this.colCount&&!this.willUpdateCol&&this.updateCol()}pause(){this.playing=!1}updateRow(){if(!this.playing||this.table.isReleased)return;let t=!0;const e=this.customDistRowFunction&&this.customDistRowFunction(this.row,this.table);e?(this.row=e.distRow,t=e.animation??!0):ru(this.row)&&this.table.scenegraph.proxy.screenTopRow!==this.row?(this.row=this.table.frozenRowCount,t=!1):ru(this.row)||this.table.scenegraph.proxy.screenTopRow===Math.floor(this.row)?this.row+=this.rowCount:(this.row=this.table.frozenRowCount,t=!1),this.table.scrollToRow(this.row,t?{duration:this.animationDuration,easing:this.animationEasing}:void 0),this.willUpdateRow=!0,setTimeout((()=>{this.willUpdateRow=!1,this.updateRow()}),this.animationDuration+this.animationDelay)}updateCol(){if(!this.playing||this.table.isReleased)return;let t=!0;const e=this.customDistColFunction&&this.customDistColFunction(this.col,this.table);e?(this.col=e.distCol,t=e.animation??!0):ru(this.col)&&this.table.scenegraph.proxy.screenLeftCol!==this.col?(this.col=this.table.frozenColCount,t=!1):ru(this.col)||this.table.scenegraph.proxy.screenLeftCol===Math.floor(this.col)?this.col+=this.colCount:(this.col=this.table.frozenColCount,t=!1),this.table.scrollToCol(this.col,t?{duration:this.animationDuration,easing:this.animationEasing}:void 0),this.willUpdateCol=!0,setTimeout((()=>{this.willUpdateCol=!1,this.updateCol()}),this.animationDuration+this.animationDelay)}release(){}},t.cancelTransform=ou,t.rotate90WithTransform=au}));
1
+ !function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("@visactor/vtable")):"function"==typeof define&&define.amd?define(["exports","@visactor/vtable"],e):e(((t="undefined"!=typeof globalThis?globalThis:t||self).VTable=t.VTable||{},t.VTable.plugins={}),t.VTable)}(this,(function(t,e){"use strict";function i(t){var e=Object.create(null);return t&&Object.keys(t).forEach((function(i){if("default"!==i){var n=Object.getOwnPropertyDescriptor(t,i);Object.defineProperty(e,i,n.get?n:{enumerable:!0,get:function(){return t[i]}})}})),e.default=t,Object.freeze(e)}var n=i(e);function s(t){return Math.floor(t)===t}class r{static GenAutoIncrementId(){return r.auto_increment_id++}}r.auto_increment_id=0;class a{constructor(t){this.id=r.GenAutoIncrementId(),this.registry=t}}const o="named",l="inject",h="multi_inject",d="inversify:tagged",c="inversify:paramtypes";class u{constructor(t,e){this.key=t,this.value=e}toString(){return this.key===o?`named: ${String(this.value).toString()} `:`tagged: { key:${this.key.toString()}, value: ${String(this.value)} }`}}var p=function(t){var e;return function(t){const e="function"==typeof Symbol&&void 0!==Symbol.toPrimitive?Symbol.toPrimitive:"@@toPrimitive",i=Object.getPrototypeOf(Function),n=("object"==typeof process&&process.env&&process.env.REFLECT_METADATA_USE_MAP_POLYFILL,Map),s=new WeakMap;function r(t,e,i){let r=s.get(t);if(h(r)){if(!i)return;r=new n,s.set(t,r)}let a=r.get(e);if(h(a)){if(!i)return;a=new n,r.set(e,a)}return a}function a(t,e,i){if(o(t,e,i))return!0;const n=f(e);return!d(n)&&a(t,n,i)}function o(t,e,i){const n=r(e,i,!1);return!h(n)&&!!n.has(t)}function l(t,e,i){if(o(t,e,i))return function(t,e,i){const n=r(e,i,!1);if(!h(n))return n.get(t)}(t,e,i);const n=f(e);return d(n)?void 0:l(t,n,i)}function h(t){return void 0===t}function d(t){return null===t}function c(t){return"object"==typeof t?null!==t:"function"==typeof t}function u(t,i){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 n=3===i?"string":5===i?"number":"default",s=function(t,e){const i=t[e];if(null!=i){if(!g(i))throw new TypeError;return i}}(t,e);if(void 0!==s){const e=s.call(t,n);if(c(e))throw new TypeError;return e}return function(t,e){if("string"===e){const e=t.toString;if(g(e)){const i=e.call(t);if(!c(i))return i}const i=t.valueOf;if(g(i)){const e=i.call(t);if(!c(e))return e}}else{const e=t.valueOf;if(g(e)){const i=e.call(t);if(!c(i))return i}const i=t.toString;if(g(i)){const e=i.call(t);if(!c(e))return e}}throw new TypeError}(t,"default"===n?"number":n)}function p(t){const e=u(t,3);return"symbol"==typeof e?e:function(t){return""+t}(e)}function g(t){return"function"==typeof t}function f(t){const e=Object.getPrototypeOf(t);if("function"!=typeof t||t===i)return e;if(e!==i)return e;const n=t.prototype,s=n&&Object.getPrototypeOf(n);if(null==s||s===Object.prototype)return e;const r=s.constructor;return"function"!=typeof r||r===t?e:r}t("defineMetadata",(function(t,e,i,n){if(!c(i))throw new TypeError;return s=t,a=e,void r(i,n,!0).set(s,a);var s,a})),t("hasMetadata",(function(t,e,i){if(!c(e))throw new TypeError;return h(i)||(i=p(i)),a(t,e,i)})),t("hasOwnMetadata",(function(t,e,i){if(!c(e))throw new TypeError;return h(i)||(i=p(i)),o(t,e,i)})),t("getMetadata",(function(t,e,i){if(!c(e))throw new TypeError;return h(i)||(i=p(i)),l(t,e,i)}))}((e=t,function(t,i){"function"!=typeof e[t]&&Object.defineProperty(e,t,{configurable:!0,writable:!0,value:i})})),t}({});function g(t,e,i,n){!function(t,e,i,n){const s=[n];let r={};p.hasOwnMetadata(t,e)&&(r=p.getMetadata(t,e));let a=r[i];void 0===a&&(a=[]),a.push(...s),r[i]=a,p.defineMetadata(t,r,e)}(d,t,i.toString(),n)}function f(t){return(e,i,n)=>{g(e,0,n,t)}}function v(t){return e=>(i,n,s)=>f(new u(t,e))(i,n,s)}const m=v(l),b=v(h);function y(){return function(t){return p.defineMetadata(c,null,t),t}}function x(t){return f(new u(o,t))}const _="Singleton",w="Transient",T="ConstantValue",S="DynamicValue",k="Factory",B="Function",A="Instance",C="Invalid";class L{constructor(t,e){this.id=r.GenAutoIncrementId(),this.activated=!1,this.serviceIdentifier=t,this.scope=e,this.type=C,this.constraint=t=>!0,this.implementationType=null,this.cache=null,this.factory=null,this.provider=null,this.dynamicValue=null}clone(){const t=new L(this.serviceIdentifier,this.scope);return t.activated=t.scope===_&&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 O{getConstructorMetadata(t){return{compilerGeneratedMetadata:p.getMetadata(c,t),userGeneratedMetadata:p.getMetadata(d,t)||{}}}getPropertiesMetadata(t){throw new Error("暂未实现")}}const E=(R=o,t=>{const e=e=>{if(null==e)return!1;if(e.key===R&&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===R&&i[e].value===t)return!0;return!1};return e.metaData=new u(R,t),e});var R;class M{constructor(t){this._binding=t}inRequestScope(){throw new Error("暂未实现")}inSingletonScope(){return this._binding.scope=_,this}inTransientScope(){return this._binding.scope=w,this}whenTargetNamed(t){return this._binding.constraint=E(t),this}}class P{constructor(t){this._binding=t}to(t){return this._binding.type=A,this._binding.implementationType=t,new M(this._binding)}toSelf(){const t=this._binding.serviceIdentifier;return this.to(t)}toDynamicValue(t){return this._binding.type=S,this._binding.cache=null,this._binding.dynamicValue=t,this._binding.implementationType=null,new M(this._binding)}toConstantValue(t){return this._binding.type=T,this._binding.cache=t,this._binding.dynamicValue=null,this._binding.implementationType=null,this._binding.scope=_,new M(this._binding)}toFactory(t){return this._binding.type=k,this._binding.factory=t,this._binding.scope=_,new M(this._binding)}toService(t){this.toDynamicValue((e=>e.container.get(t)))}}const D=Symbol("ContributionProvider");class I{constructor(t,e){this.serviceIdentifier=t,this.container=e,N.setStore(this.serviceIdentifier,this)}getContributions(){return this.caches||(this.caches=[],this.container&&this.container.isBound(this.serviceIdentifier)&&this.caches.push(...this.container.getAll(this.serviceIdentifier))),this.caches}refresh(){this.caches&&(this.caches.length=0,this.container&&this.container.isBound(this.serviceIdentifier)&&this.caches.push(...this.container.getAll(this.serviceIdentifier)))}}function F(t,e){t(D).toDynamicValue((t=>{let{container:i}=t;return new I(e,i)})).inSingletonScope().whenTargetNamed(e)}class N{static getStore(t){return this.store.get(t)}static setStore(t,e){this.store.set(t,e)}static refreshAllContributions(){this.store.forEach((t=>{t.refresh()}))}}N.store=new Map;class H{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 n;if("string"==typeof e)n={name:e.trim()};else if("object"!=typeof e||null===e)throw new Error("Invalid tap options");if("string"!=typeof n.name||""===n.name)throw new Error("Missing name for tap");return n=Object.assign({type:t,fn:i},n),n}_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 n=this.taps.length;for(;n>0;){n--;const t=this.taps[n];this.taps[n+1]=t;const s=t.stage||0;if(e){if(e.has(t.name)){e.delete(t.name);continue}if(e.size>0)continue}if(!(s>i)){n++;break}}this.taps[n]=t}}class z extends H{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 W=Symbol.for("EnvContribution"),U=Symbol.for("VGlobal");class j{constructor(){this._listenerMap=new Map,this._eventListenerTransformer=t=>t}setEventListenerTransformer(t){this._eventListenerTransformer=t||(t=>t)}addEventListener(t,e,i){if(!e)return;const n=t=>{const i=this._eventListenerTransformer(t);"function"==typeof e?e(i):e.handleEvent&&e.handleEvent(i)};this._listenerMap.has(t)||this._listenerMap.set(t,new Map),this._listenerMap.get(t).set(e,n),this._nativeAddEventListener(t,n,i)}removeEventListener(t,e,i){var n;if(!e)return;const s=null===(n=this._listenerMap.get(t))||void 0===n?void 0:n.get(e);s&&(this._nativeRemoveEventListener(t,s,i),this._listenerMap.get(t).delete(e),0===this._listenerMap.get(t).size&&this._listenerMap.delete(t))}dispatchEvent(t){return this._nativeDispatchEvent(t)}clearAllEventListeners(){this._listenerMap.forEach(((t,e)=>{t.forEach(((t,i)=>{this._nativeRemoveEventListener(e,t,void 0)}))})),this._listenerMap.clear()}_nativeAddEventListener(t,e,i){throw new Error("_nativeAddEventListener must be implemented by derived classes")}_nativeRemoveEventListener(t,e,i){throw new Error("_nativeRemoveEventListener must be implemented by derived classes")}_nativeDispatchEvent(t){throw new Error("_nativeDispatchEvent must be implemented by derived classes")}}var G=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Y=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},V=function(t,e){return function(i,n){e(i,n,t)}},X=function(t,e,i,n){return new(i||(i=Promise))((function(s,r){function a(t){try{l(n.next(t))}catch(t){r(t)}}function o(t){try{l(n.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?s(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((n=n.apply(t,e||[])).next())}))};let K=class extends j{get env(){return this._env}get isImageAnonymous(){return this._isImageAnonymous}set isImageAnonymous(t){this._isImageAnonymous=t}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){super(),this.contributions=t,this._isImageAnonymous=!0,this.eventListenerTransformer=t=>t,this.id=r.GenAutoIncrementId(),this.hooks={onSetEnv:new z(["lastEnv","env","global"])},this.measureTextMethod="native",this.optimizeVisible=!1}_nativeAddEventListener(t,e,i){return this._env||this.setEnv("browser"),this.envContribution.addEventListener(t,e,i)}_nativeRemoveEventListener(t,e,i){return this._env||this.setEnv("browser"),this.envContribution.removeEventListener(t,e,i)}_nativeDispatchEvent(t){return this._env||this.setEnv("browser"),this.envContribution.dispatchEvent(t)}bindContribution(t){const e=[];if(this.contributions.getContributions().forEach((i=>{const n=i.configure(this,t);n&&n.then&&e.push(n)})),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 n=this.bindContribution(e);if(n&&n.then)return n.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)}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)}loadFont(t,e,i){return X(this,void 0,void 0,(function*(){return this._env||this.setEnv("browser"),this.envContribution.loadFont(t,e,i)}))}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)}updateDom(t,e){return this._env||this.setEnv("browser"),this.envContribution.updateDom(t,e)}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)}isMacOS(){return this._env||this.setEnv("browser"),this.envContribution.isMacOS()}copyToClipBoard(t){return this._env||this.setEnv("browser"),this.envContribution.copyToClipBoard(t)}};var $;function q(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}K=G([y(),V(0,m(D)),V(0,x(W)),Y("design:paramtypes",[Object])],K),function(t){t[t.estimate=0]="estimate",t[t.actualBounding=1]="actualBounding",t[t.fontBounding=2]="fontBounding"}($||($={}));var Z={exports:{}};!function(t){var e=Object.prototype.hasOwnProperty,i="~";function n(){}function s(t,e,i){this.fn=t,this.context=e,this.once=i||!1}function r(t,e,n,r,a){if("function"!=typeof n)throw new TypeError("The listener must be a function");var o=new s(n,r||t,a),l=i?i+e:e;return t._events[l]?t._events[l].fn?t._events[l]=[t._events[l],o]:t._events[l].push(o):(t._events[l]=o,t._eventsCount++),t}function a(t,e){0==--t._eventsCount?t._events=new n:delete t._events[e]}function o(){this._events=new n,this._eventsCount=0}Object.create&&(n.prototype=Object.create(null),(new n).__proto__||(i=!1)),o.prototype.eventNames=function(){var t,n,s=[];if(0===this._eventsCount)return s;for(n in t=this._events)e.call(t,n)&&s.push(i?n.slice(1):n);return Object.getOwnPropertySymbols?s.concat(Object.getOwnPropertySymbols(t)):s},o.prototype.listeners=function(t){var e=i?i+t:t,n=this._events[e];if(!n)return[];if(n.fn)return[n.fn];for(var s=0,r=n.length,a=new Array(r);s<r;s++)a[s]=n[s].fn;return a},o.prototype.listenerCount=function(t){var e=i?i+t:t,n=this._events[e];return n?n.fn?1:n.length:0},o.prototype.emit=function(t,e,n,s,r,a){var o=i?i+t:t;if(!this._events[o])return!1;var l,h,d=this._events[o],c=arguments.length;if(d.fn){switch(d.once&&this.removeListener(t,d.fn,void 0,!0),c){case 1:return d.fn.call(d.context),!0;case 2:return d.fn.call(d.context,e),!0;case 3:return d.fn.call(d.context,e,n),!0;case 4:return d.fn.call(d.context,e,n,s),!0;case 5:return d.fn.call(d.context,e,n,s,r),!0;case 6:return d.fn.call(d.context,e,n,s,r,a),!0}for(h=1,l=new Array(c-1);h<c;h++)l[h-1]=arguments[h];d.fn.apply(d.context,l)}else{var u,p=d.length;for(h=0;h<p;h++)switch(d[h].once&&this.removeListener(t,d[h].fn,void 0,!0),c){case 1:d[h].fn.call(d[h].context);break;case 2:d[h].fn.call(d[h].context,e);break;case 3:d[h].fn.call(d[h].context,e,n);break;case 4:d[h].fn.call(d[h].context,e,n,s);break;default:if(!l)for(u=1,l=new Array(c-1);u<c;u++)l[u-1]=arguments[u];d[h].fn.apply(d[h].context,l)}}return!0},o.prototype.on=function(t,e,i){return r(this,t,e,i,!1)},o.prototype.once=function(t,e,i){return r(this,t,e,i,!0)},o.prototype.removeListener=function(t,e,n,s){var r=i?i+t:t;if(!this._events[r])return this;if(!e)return a(this,r),this;var o=this._events[r];if(o.fn)o.fn!==e||s&&!o.once||n&&o.context!==n||a(this,r);else{for(var l=0,h=[],d=o.length;l<d;l++)(o[l].fn!==e||s&&!o[l].once||n&&o[l].context!==n)&&h.push(o[l]);h.length?this._events[r]=1===h.length?h[0]:h:a(this,r)}return this},o.prototype.removeAllListeners=function(t){var e;return t?(e=i?i+t:t,this._events[e]&&a(this,e)):(this._events=new n,this._eventsCount=0),this},o.prototype.off=o.prototype.removeListener,o.prototype.addListener=o.prototype.on,o.prefixed=i,o.EventEmitter=o,t.exports=o}(Z);var J=q(Z.exports);var Q=(t,e)=>Object.prototype.toString.call(t)===`[object ${e}]`;var tt=function(t){return arguments.length>1&&void 0!==arguments[1]&&arguments[1]?"boolean"==typeof t:!0===t||!1===t||Q(t,"Boolean")};var et=t=>"function"==typeof t;var it=t=>null==t;var nt=t=>null!=t;var st=t=>{const e=typeof t;return null!==t&&"object"===e||"function"===e};var rt=t=>"object"==typeof t&&null!==t;var at=function(t){if(!rt(t)||!Q(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 ot=t=>void 0===t;var lt=function(t){const e=typeof t;return arguments.length>1&&void 0!==arguments[1]&&arguments[1]?"string"===e:"string"===e||Q(t,"String")};var ht=t=>Array.isArray?Array.isArray(t):Q(t,"Array");var dt=function(t){return null!==t&&"function"!=typeof t&&Number.isFinite(t.length)};var ct=function(t){const e=typeof t;return arguments.length>1&&void 0!==arguments[1]&&arguments[1]?"number"===e:"number"===e||Q(t,"Number")};var ut=t=>ct(t)&&Number.isFinite(t);var pt=t=>new RegExp(/^(http(s)?:\/\/)\w+[^\s]+(\.[^\s]+){1,}$/).test(t);var gt=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 ft=t=>({}.toString.call(t).replace(/^\[object /,"").replace(/]$/,""));const vt=Object.prototype;var mt=function(t){const e=t&&t.constructor;return t===("function"==typeof e&&e.prototype||vt)};const bt=Object.prototype.hasOwnProperty;function yt(t){if(it(t))return!0;if(dt(t))return!t.length;const e=ft(t);if("Map"===e||"Set"===e)return!t.size;if(mt(t))return!Object.keys(t).length;for(const e in t)if(bt.call(t,e))return!1;return!0}const xt=Object.prototype.hasOwnProperty;var _t=(t,e)=>null!=t&&xt.call(t,e);function wt(t,e){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2],n=arguments.length>3&&void 0!==arguments[3]&&arguments[3];if(e){if(t===e)return;if(nt(e)&&"object"==typeof e){const s=Object(e),r=[];for(const t in s)r.push(t);let{length:a}=r,o=-1;for(;a--;){const a=r[++o];!nt(s[a])||"object"!=typeof s[a]||n&&ht(t[a])?St(t,a,s[a]):Tt(t,e,a,i,n)}}}}function Tt(t,e,i){let n=arguments.length>3&&void 0!==arguments[3]&&arguments[3],s=arguments.length>4&&void 0!==arguments[4]&&arguments[4];const r=t[i],a=e[i];let o=e[i],l=!0;if(ht(a)){if(n)o=[];else if(ht(r))o=r;else if(dt(r)){o=new Array(r.length);let t=-1;const e=r.length;for(;++t<e;)o[t]=r[t]}}else at(a)?(o=null!=r?r:{},"function"!=typeof r&&"object"==typeof r||(o={})):l=!1;l&&wt(o,a,n,s),St(t,i,o)}function St(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 kt(t){let e=-1;const i=arguments.length<=1?0:arguments.length-1;for(;++e<i;)wt(t,e+1<1||arguments.length<=e+1?void 0:arguments[e+1],!0);return t}function Bt(t,e){if(!ht(t)||!ht(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}const At="undefined"!=typeof console;function Ct(t,e,i){const n=[e].concat([].slice.call(i));At&&console[t].apply(console,n)}var Lt;!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"}(Lt||(Lt={}));class Ot{static getInstance(t,e){return Ot._instance&&ct(t)?Ot._instance.level(t):Ot._instance||(Ot._instance=new Ot(t,e)),Ot._instance}static setInstance(t){return Ot._instance=t}static setInstanceLevel(t){Ot._instance?Ot._instance.level(t):Ot._instance=new Ot(t)}static clearInstance(){Ot._instance=null}constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Lt.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>=Lt.Info}canLogDebug(){return this._level>=Lt.Debug}canLogError(){return this._level>=Lt.Error}canLogWarn(){return this._level>=Lt.Warn}level(t){return arguments.length?(this._level=+t,this):this._level}error(){for(var t,e=arguments.length,i=new Array(e),n=0;n<e;n++)i[n]=arguments[n];return this._level>=Lt.Error&&(this._onErrorHandler.length?this.callErrorHandler(...i):Ct(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>=Lt.Warn&&Ct(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>=Lt.Info&&Ct(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>=Lt.Debug&&Ct(this._method||"log","DEBUG",e),this}}Ot._instance=null;function Et(t,e){const i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1e-10,n=(arguments.length>2&&void 0!==arguments[2]?arguments[2]:1e-10)*Math.max(t,e);return Math.abs(t-e)<=Math.max(i,n)}var Rt=function(t,e,i){return t<e?e:t>i?i:t};var Mt=(t,e,i)=>{let[n,s]=t;s<n&&(n=t[1],s=t[0]);const r=s-n;return r>=i-e?[e,i]:(n=Math.min(Math.max(n,e),i-r),[n,n+r])};let Pt=!1;try{Pt="function"==typeof requestAnimationFrame&&"function"==typeof cancelAnimationFrame}catch(t){Pt=!1}function Dt(t,e,i){let n,s,r,a,o,l,h=0,d=!1,c=!1,u=!0;const p=!e&&0!==e&&Pt;if("function"!=typeof t)throw new TypeError("Expected a function");function g(e){const i=n,r=s;return n=s=void 0,h=e,a=t.apply(r,i),a}function f(t,e){return p?(cancelAnimationFrame(o),requestAnimationFrame(t)):setTimeout(t,e)}function v(t){const i=t-l;return void 0===l||i>=e||i<0||c&&t-h>=r}function m(){const t=Date.now();if(v(t))return b(t);o=f(m,function(t){const i=t-h,n=e-(t-l);return c?Math.min(n,r-i):n}(t))}function b(t){return o=void 0,u&&n?g(t):(n=s=void 0,a)}function y(){const t=Date.now(),i=v(t);for(var r=arguments.length,u=new Array(r),p=0;p<r;p++)u[p]=arguments[p];if(n=u,s=this,l=t,i){if(void 0===o)return function(t){return h=t,o=f(m,e),d?g(t):a}(l);if(c)return o=f(m,e),g(l)}return void 0===o&&(o=f(m,e)),a}return e=+e||0,st(i)&&(d=!!i.leading,c="maxWait"in i,c&&(r=Math.max(ut(i.maxWait)?i.maxWait:0,e)),u="trailing"in i?!!i.trailing:u),y.cancel=function(){void 0!==o&&function(t){if(p)return cancelAnimationFrame(t);clearTimeout(t)}(o),h=0,n=l=s=o=void 0},y.flush=function(){return void 0===o?a:b(Date.now())},y.pending=function(){return void 0!==o},y}Pt=!1;const It=1e-12,Ft=Math.PI,Nt=Ft/2,Ht=2*Ft,zt=2*Math.PI,Wt=Math.abs,Ut=Math.atan2,jt=Math.cos,Gt=Math.max,Yt=Math.min,Vt=Math.sin,Xt=Math.sqrt,Kt=Math.pow;function $t(t,e,i,n,s){let r=i,a=n;return"number"==typeof t&&"number"==typeof i&&(r=(1-s)*t+s*i),"number"==typeof e&&"number"==typeof n&&(a=(1-s)*e+s*n),{x:r,y:a}}class qt{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,n=arguments.length>3?arguments[3]:void 0;this.x=0,this.y=0,this.x=t,this.y=e,this.x1=i,this.y1=n}clone(){return new qt(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 ct(t)?(this.x+=t,void(this.y+=t)):(this.x+=t.x,this.y+=t.y,this)}sub(t){return ct(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 Zt{static distancePP(t,e){return Xt(Kt(t.x-e.x,2)+Kt(t.y-e.y,2))}static distanceNN(t,e,i,n){return Xt(Kt(t-i,2)+Kt(e-n,2))}static distancePN(t,e,i){return Xt(Kt(e-t.x,2)+Kt(i-t.y,2))}static pointAtPP(t,e,i){return new qt((e.x-t.x)*i+t.x,(e.y-t.y)*i+t.y)}}function Jt(t){return t*(Math.PI/180)}function Qt(t,e,i){if(null===t)return e;if(null===e)return t;const{x11:n,x12:s,y11:r,y12:a,x21:o,x22:l,y21:h,y22:d}=ee(t,e,i);return n>=l||s<=o||r>=d||a<=h?{x1:0,y1:0,x2:0,y2:0}:{x1:Math.max(n,o),y1:Math.max(r,h),x2:Math.min(s,l),y2:Math.min(a,d)}}var te;!function(t){t[t.NONE=0]="NONE",t[t.BBOX1=1]="BBOX1",t[t.BBOX2=2]="BBOX2"}(te||(te={}));const ee=(t,e,i)=>{let n=t.x1,s=t.x2,r=t.y1,a=t.y2,o=e.x1,l=e.x2,h=e.y1,d=e.y2;return i&&(n>s&&([n,s]=[s,n]),r>a&&([r,a]=[a,r]),o>l&&([o,l]=[l,o]),h>d&&([h,d]=[d,h])),{x11:n,x12:s,y11:r,y12:a,x21:o,x22:l,y21:h,y22:d}};function ie(t,e,i){if(!t||!e)return te.NONE;const{x11:n,x12:s,y11:r,y12:a,x21:o,x22:l,y21:h,y22:d}=ee(t,e,i);return n>o&&s<l&&r>h&&a<d?te.BBOX1:o>n&&l<s&&h>r&&d<a?te.BBOX2:te.NONE}function ne(t,e,i){if(t&&e){if(!i)return!(t.x1>e.x2||t.x2<e.x1||t.y1>e.y2||t.y2<e.y1);const{x11:n,x12:s,y11:r,y12:a,x21:o,x22:l,y21:h,y22:d}=ee(t,e,!0);return!(n>l||s<o||r>d||a<h)}return!0}function se(t,e){return Math.abs(e[0]*t[0]+e[1]*t[1])}function re(t,e){let{x:i,y:n}=t,s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{x:0,y:0};return{x:(i-s.x)*Math.cos(e)-(n-s.y)*Math.sin(e)+s.x,y:(i-s.x)*Math.sin(e)+(n-s.y)*Math.cos(e)+s.y}}function ae(t){return{x:(t.x1+t.x2)/2,y:(t.y1+t.y2)/2}}function oe(t,e){const i=e?Jt(t.angle):t.angle,n=ae(t);return[re({x:t.x1,y:t.y1},i,n),re({x:t.x2,y:t.y1},i,n),re({x:t.x2,y:t.y2},i,n),re({x:t.x1,y:t.y2},i,n)]}const le=t=>{let e=t.charCodeAt(0),i=2===t.length?t.charCodeAt(1):0,n=e;return 55296<=e&&e<=56319&&56320<=i&&i<=57343&&(e&=1023,i&=1023,n=e<<10|i,n+=65536),12288===n||65281<=n&&n<=65376||65504<=n&&n<=65510?"F":8361===n||65377<=n&&n<=65470||65474<=n&&n<=65479||65482<=n&&n<=65487||65490<=n&&n<=65495||65498<=n&&n<=65500||65512<=n&&n<=65518?"H":4352<=n&&n<=4447||4515<=n&&n<=4519||4602<=n&&n<=4607||9001<=n&&n<=9002||11904<=n&&n<=11929||11931<=n&&n<=12019||12032<=n&&n<=12245||12272<=n&&n<=12283||12289<=n&&n<=12350||12353<=n&&n<=12438||12441<=n&&n<=12543||12549<=n&&n<=12589||12593<=n&&n<=12686||12688<=n&&n<=12730||12736<=n&&n<=12771||12784<=n&&n<=12830||12832<=n&&n<=12871||12880<=n&&n<=13054||13056<=n&&n<=19903||19968<=n&&n<=42124||42128<=n&&n<=42182||43360<=n&&n<=43388||44032<=n&&n<=55203||55216<=n&&n<=55238||55243<=n&&n<=55291||63744<=n&&n<=64255||65040<=n&&n<=65049||65072<=n&&n<=65106||65108<=n&&n<=65126||65128<=n&&n<=65131||110592<=n&&n<=110593||127488<=n&&n<=127490||127504<=n&&n<=127546||127552<=n&&n<=127560||127568<=n&&n<=127569||131072<=n&&n<=194367||177984<=n&&n<=196605||196608<=n&&n<=262141?"W":32<=n&&n<=126||162<=n&&n<=163||165<=n&&n<=166||172===n||175===n||10214<=n&&n<=10221||10629<=n&&n<=10630?"Na":161===n||164===n||167<=n&&n<=168||170===n||173<=n&&n<=174||176<=n&&n<=180||182<=n&&n<=186||188<=n&&n<=191||198===n||208===n||215<=n&&n<=216||222<=n&&n<=225||230===n||232<=n&&n<=234||236<=n&&n<=237||240===n||242<=n&&n<=243||247<=n&&n<=250||252===n||254===n||257===n||273===n||275===n||283===n||294<=n&&n<=295||299===n||305<=n&&n<=307||312===n||319<=n&&n<=322||324===n||328<=n&&n<=331||333===n||338<=n&&n<=339||358<=n&&n<=359||363===n||462===n||464===n||466===n||468===n||470===n||472===n||474===n||476===n||593===n||609===n||708===n||711===n||713<=n&&n<=715||717===n||720===n||728<=n&&n<=731||733===n||735===n||768<=n&&n<=879||913<=n&&n<=929||931<=n&&n<=937||945<=n&&n<=961||963<=n&&n<=969||1025===n||1040<=n&&n<=1103||1105===n||8208===n||8211<=n&&n<=8214||8216<=n&&n<=8217||8220<=n&&n<=8221||8224<=n&&n<=8226||8228<=n&&n<=8231||8240===n||8242<=n&&n<=8243||8245===n||8251===n||8254===n||8308===n||8319===n||8321<=n&&n<=8324||8364===n||8451===n||8453===n||8457===n||8467===n||8470===n||8481<=n&&n<=8482||8486===n||8491===n||8531<=n&&n<=8532||8539<=n&&n<=8542||8544<=n&&n<=8555||8560<=n&&n<=8569||8585===n||8592<=n&&n<=8601||8632<=n&&n<=8633||8658===n||8660===n||8679===n||8704===n||8706<=n&&n<=8707||8711<=n&&n<=8712||8715===n||8719===n||8721===n||8725===n||8730===n||8733<=n&&n<=8736||8739===n||8741===n||8743<=n&&n<=8748||8750===n||8756<=n&&n<=8759||8764<=n&&n<=8765||8776===n||8780===n||8786===n||8800<=n&&n<=8801||8804<=n&&n<=8807||8810<=n&&n<=8811||8814<=n&&n<=8815||8834<=n&&n<=8835||8838<=n&&n<=8839||8853===n||8857===n||8869===n||8895===n||8978===n||9312<=n&&n<=9449||9451<=n&&n<=9547||9552<=n&&n<=9587||9600<=n&&n<=9615||9618<=n&&n<=9621||9632<=n&&n<=9633||9635<=n&&n<=9641||9650<=n&&n<=9651||9654<=n&&n<=9655||9660<=n&&n<=9661||9664<=n&&n<=9665||9670<=n&&n<=9672||9675===n||9678<=n&&n<=9681||9698<=n&&n<=9701||9711===n||9733<=n&&n<=9734||9737===n||9742<=n&&n<=9743||9748<=n&&n<=9749||9756===n||9758===n||9792===n||9794===n||9824<=n&&n<=9825||9827<=n&&n<=9829||9831<=n&&n<=9834||9836<=n&&n<=9837||9839===n||9886<=n&&n<=9887||9918<=n&&n<=9919||9924<=n&&n<=9933||9935<=n&&n<=9953||9955===n||9960<=n&&n<=9983||10045===n||10071===n||10102<=n&&n<=10111||11093<=n&&n<=11097||12872<=n&&n<=12879||57344<=n&&n<=63743||65024<=n&&n<=65039||65533===n||127232<=n&&n<=127242||127248<=n&&n<=127277||127280<=n&&n<=127337||127344<=n&&n<=127386||917760<=n&&n<=917999||983040<=n&&n<=1048573||1048576<=n&&n<=1114109?"A":"N"};function he(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:n=e.fontStyle,fontVariant:s=e.fontVariant,fontWeight:r=e.fontWeight,fontSize:a=e.fontSize,fontFamily:o=e.fontFamily}=t;return(n?n+" ":"")+(s?s+" ":"")+(r?r+" ":"")+a*i+"px "+(o||"sans-serif")}class de{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(),nt(t.specialCharSet)&&(this.specialCharSet=t.specialCharSet),this._standardMethod=nt(t.getTextBounds)?this.fullMeasure.bind(this):this.measureWithNaiveCanvas.bind(this)}initContext(){if(this._notSupportCanvas)return!1;if(it(this._canvas)&&(nt(this._option.getCanvasForMeasure)&&(this._canvas=this._option.getCanvasForMeasure()),it(this._canvas)&&"undefined"!=typeof window&&void 0!==window.document&&globalThis&&nt(globalThis.document)&&(this._canvas=globalThis.document.createElement("canvas"))),it(this._context)&&nt(this._canvas)){const t=this._canvas.getContext("2d");nt(t)&&(t.save(),t.font=he(this.textSpec),this._contextSaved=!0,this._context=t)}return!it(this._context)||(this._notSupportCanvas=!0,!1)}_initSpec(){var t,e,i;const{defaultFontParams:n={}}=this._option,{fontStyle:s=n.fontStyle,fontVariant:r=n.fontVariant,fontWeight:a=(null!==(t=n.fontWeight)&&void 0!==t?t:"normal"),fontSize:o=(null!==(e=n.fontSize)&&void 0!==e?e:12),fontFamily:l=(null!==(i=n.fontFamily)&&void 0!==i?i:"sans-serif"),align:h,textAlign:d=(null!=h?h:"center"),baseline:c,textBaseline:u=(null!=c?c:"middle"),ellipsis:p,limit:g}=this._userSpec;let{lineHeight:f=o}=this._userSpec;if(lt(f)&&"%"===f[f.length-1]){const t=Number.parseFloat(f.substring(0,f.length-1))/100;f=o*t}return{fontStyle:s,fontVariant:r,fontFamily:l,fontSize:o,fontWeight:a,textAlign:d,textBaseline:u,ellipsis:p,limit:g,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(it(t))return{width:0,height:0};if(it(this._option.getTextBounds)||!this._notSupportVRender)return this.measureWithNaiveCanvas(t);const{fontFamily:e,fontSize:i,fontWeight:n,textAlign:s,textBaseline:r,ellipsis:a,limit:o,lineHeight:l}=this.textSpec;let h;try{const d=this._option.getTextBounds({text:t,fontFamily:e,fontSize:i,fontWeight:n,textAlign:s,textBaseline:r,ellipsis:!!a,maxLineWidth:o||1/0,lineHeight:l});h={width:d.width(),height:d.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:n,lineHeight:s}=this.textSpec;return{width:i.width,height:null!==(e=s)&&void 0!==e?e:n,fontBoundingBoxAscent:i.fontBoundingBoxAscent,fontBoundingBoxDescent:i.fontBoundingBoxDescent}}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 n=t[i];let s=this._measureSpecialChar(n);it(s)&&de.NUMBERS_CHAR_SET.includes(n)&&(s=this._measureNumberChar()),it(s)&&["F","W"].includes(le(n))&&(s=this._measureFullSizeChar()),it(s)&&(s=this._measureLetterChar()),e.width+=s.width,e.height=Math.max(e.height,s.height),!it(s.fontBoundingBoxAscent)&&(e.fontBoundingBoxAscent=s.fontBoundingBoxAscent),!it(s.fontBoundingBoxDescent)&&(e.fontBoundingBoxDescent=s.fontBoundingBoxDescent)}return e}quickMeasureWithoutCanvas(t){return this._measureReduce(t,this._quickMeasureWithoutCanvas.bind(this))}_quickMeasureWithoutCanvas(t){var e;const i={width:0,height:0},{fontSize:n,lineHeight:s}=this.textSpec;for(let e=0;e<t.length;e++){const s=t[e],r=["F","W"].includes(le(s))?1:.53;i.width+=r*n}return i.height=null!==(e=s)&&void 0!==e?e:n,i}_measureReduce(t,e){var i;const{fontSize:n,lineHeight:s}=this.textSpec,r={width:0,height:0};if(it(t))return r;if(ht(t)){const a=t.filter(nt).map((t=>t.toString()));return 0===a.length?r:1===a.length?e(a[0]):{width:a.reduce(((t,i)=>Math.max(t,e(i).width)),0),height:a.length*((null!==(i=s)&&void 0!==i?i:n)+1)+1}}return e(t.toString())}_measureNumberChar(){if(it(this._numberCharSize)){const t=this._standardMethod(de.NUMBERS_CHAR_SET);this._numberCharSize={width:t.width/de.NUMBERS_CHAR_SET.length,height:t.height,fontBoundingBoxAscent:t.fontBoundingBoxAscent,fontBoundingBoxDescent:t.fontBoundingBoxDescent}}return this._numberCharSize}_measureFullSizeChar(){return it(this._fullCharSize)&&(this._fullCharSize=this._standardMethod(de.FULL_SIZE_CHAR)),this._fullCharSize}_measureLetterChar(){if(it(this._letterCharSize)){const t=this._standardMethod(de.ALPHABET_CHAR_SET);this._letterCharSize={width:t.width/de.ALPHABET_CHAR_SET.length,height:t.height,fontBoundingBoxAscent:t.fontBoundingBoxAscent,fontBoundingBoxDescent:t.fontBoundingBoxDescent}}return this._letterCharSize}_measureSpecialChar(t){return nt(this._specialCharSizeMap[t])?this._specialCharSizeMap[t]:this.specialCharSet.includes(t)?(this._specialCharSizeMap[t]=this._standardMethod(t),this._specialCharSizeMap[t]):null}release(){nt(this._canvas)&&(this._canvas=null),nt(this._context)&&(this._contextSaved&&(this._context.restore(),this._contextSaved=!1),this._context=null)}}function ce(t,e,i){const{x1:n,y1:s,x2:r,y2:a}=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*n+i.c*s+i.e,i.b*n+i.d*s+i.f),t.add(i.a*r+i.c*s+i.e,i.b*r+i.d*s+i.f),t.add(i.a*r+i.c*a+i.e,i.b*r+i.d*a+i.f),t.add(i.a*n+i.c*a+i.e,i.b*n+i.d*a+i.f),e)}de.ALPHABET_CHAR_SET="abcdefghijklmnopqrstuvwxyz",de.NUMBERS_CHAR_SET="0123456789",de.FULL_SIZE_CHAR="字";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,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;return this.x1=t,this.y1=e,this.x2=i,this.y2=n,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,n=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),n<e?(this.y2=e,this.y1=n):(this.y1=e,this.y2=n),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 ht(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 n=this.rotatedPoints(t,e,i);return this.clear().add(n[0],n[1]).add(n[2],n[3]).add(n[4],n[5]).add(n[6],n[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,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;const s=this.scalePoints(t,e,i,n);return this.clear().add(s[0],s[1]).add(s[2],s[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 ce(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:n,y1:s,x2:r,y2:a}=this,o=Math.cos(t),l=Math.sin(t),h=e-e*o+i*l,d=i-e*l-i*o;return[o*n-l*s+h,l*n+o*s+d,o*n-l*a+h,l*n+o*a+d,o*r-l*s+h,l*r+o*s+d,o*r-l*a+h,l*r+o*a+d]}scalePoints(t,e,i,n){const{x1:s,y1:r,x2:a,y2:o}=this;return[t*s+(1-t)*i,e*r+(1-e)*n,t*a+(1-t)*i,e*o+(1-e)*n]}}class pe extends ue{}class ge extends ue{constructor(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;var i;super(t),t&&(this.angle=null!==(i=t.angle)&&void 0!==i?i:e)}intersects(t){return function(t,e){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];const n=oe(t,i),s=oe(e,i),r=(t,e)=>[e.x-t.x,e.y-t.y],a=r(ae(t),ae(e)),o=r(n[0],n[1]),l=r(n[1],n[2]),h=r(s[0],s[1]),d=r(s[1],s[2]),c=i?Jt(t.angle):t.angle;let u=i?Jt(90-t.angle):t.angle+Nt;const p=i?Jt(e.angle):e.angle;let g=i?Jt(90-e.angle):e.angle+Nt;u>zt&&(u-=zt),g>zt&&(g-=zt);const f=(t,e,i,n)=>{const s=[Math.cos(e),Math.sin(e)];return t+(se(s,i)+se(s,n))/2>se(s,a)};return f((t.x2-t.x1)/2,c,h,d)&&f((t.y2-t.y1)/2,u,h,d)&&f((e.x2-e.x1)/2,p,o,l)&&f((e.y2-e.y1)/2,g,o,l)}(this,t)}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,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0;return super.setValue(t,e,i,n),this.angle=s,this}clone(){return new ge(this)}getRotatedCorners(){const t={x:(this.x1+this.x2)/2,y:(this.y1+this.y2)/2};return[re({x:this.x1,y:this.y1},this.angle,t),re({x:this.x2,y:this.y1},this.angle,t),re({x:this.x1,y:this.y2},this.angle,t),re({x:this.x2,y:this.y2},this.angle,t)]}}class fe{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,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1,s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0,r=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0;this.a=t,this.b=e,this.c=i,this.d=n,this.e=s,this.f=r}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,n,s,r){return!(this.e!==s||this.f!==r||this.a!==t||this.d!==n||this.b!==e||this.c!==i)}setValue(t,e,i,n,s,r){return this.a=t,this.b=e,this.c=i,this.d=n,this.e=s,this.f=r,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,n=this.d,s=this.e,r=this.f,a=new fe,o=t*n-e*i;return a.a=n/o,a.b=-e/o,a.c=-i/o,a.d=t/o,a.e=(i*r-n*s)/o,a.f=-(t*r-e*s)/o,a}rotate(t){const e=Math.cos(t),i=Math.sin(t),n=this.a*e+this.c*i,s=this.b*e+this.d*i,r=this.a*-i+this.c*e,a=this.b*-i+this.d*e;return this.a=n,this.b=s,this.c=r,this.d=a,this}rotateByCenter(t,e,i){const n=Math.cos(t),s=Math.sin(t),r=(1-n)*e+s*i,a=(1-n)*i-s*e,o=n*this.a-s*this.b,l=s*this.a+n*this.b,h=n*this.c-s*this.d,d=s*this.c+n*this.d,c=n*this.e-s*this.f+r,u=s*this.e+n*this.f+a;return this.a=o,this.b=l,this.c=h,this.d=d,this.e=c,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,n,s,r){return this.multiply(t,e,i,n,s,r),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:n,e:s,f:r}=this;return this.a=e,this.b=t,this.c=n,this.d=i,this.e=r,this.f=s,this}multiply(t,e,i,n,s,r){const a=this.a,o=this.b,l=this.c,h=this.d,d=a*t+l*e,c=o*t+h*e,u=a*i+l*n,p=o*i+h*n,g=a*s+l*r+this.e,f=o*s+h*r+this.f;return this.a=d,this.b=c,this.c=u,this.d=p,this.e=g,this.f=f,this}interpolate(t,e){const i=new fe;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:n,c:s,d:r,e:a,f:o}=this,l=i*r-n*s,h=r/l,d=-n/l,c=-s/l,u=i/l,p=(s*o-r*a)/l,g=-(i*o-n*a)/l,{x:f,y:v}=t;e.x=f*h+v*c+p,e.y=f*d+v*u+g}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 fe(this.a,this.b,this.c,this.d,this.e,this.f)}toTransformAttrs(){const t=this.a,e=this.b,i=this.c,n=this.d,s=t*n-e*i,r={x:this.e,y:this.f,rotateDeg:0,scaleX:0,scaleY:0,skewX:0,skewY:0};if(0!==t||0!==e){const a=Math.sqrt(t*t+e*e);r.rotateDeg=e>0?Math.acos(t/a):-Math.acos(t/a),r.scaleX=a,r.scaleY=s/a,r.skewX=(t*i+e*n)/s,r.skewY=0}else if(0!==i||0!==n){const a=Math.sqrt(i*i+n*n);r.rotateDeg=Math.PI/2-(n>0?Math.acos(-i/a):-Math.acos(i/a)),r.scaleX=s/a,r.scaleY=a,r.skewX=0,r.skewY=(t*i+e*n)/s}return r.rotateDeg=180*r.rotateDeg/Math.PI,r}}function ve(t,e,i){e/=100,i/=100;const n=(1-Math.abs(2*i-1))*e,s=n*(1-Math.abs(t/60%2-1)),r=i-n/2;let a=0,o=0,l=0;return 0<=t&&t<60?(a=n,o=s,l=0):60<=t&&t<120?(a=s,o=n,l=0):120<=t&&t<180?(a=0,o=n,l=s):180<=t&&t<240?(a=0,o=s,l=n):240<=t&&t<300?(a=s,o=0,l=n):300<=t&&t<360&&(a=n,o=0,l=s),a=Math.round(255*(a+r)),o=Math.round(255*(o+r)),l=Math.round(255*(l+r)),{r:a,g:o,b:l}}function me(t,e,i){t/=255,e/=255,i/=255;const n=Math.min(t,e,i),s=Math.max(t,e,i),r=s-n;let a=0,o=0,l=0;return a=0===r?0:s===t?(e-i)/r%6:s===e?(i-t)/r+2:(t-e)/r+4,a=Math.round(60*a),a<0&&(a+=360),l=(s+n)/2,o=0===r?0:r/(1-Math.abs(2*l-1)),o=+(100*o).toFixed(1),l=+(100*l).toFixed(1),{h:a,s:o,l:l}}const be=/^#([0-9a-f]{3,8})$/,ye={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 we(t){return ct(t)?new Ae(t>>16,t>>8&255,255&t,1):ht(t)?new Ae(t[0],t[1],t[2]):new Ae(255,255,255)}function Te(t){return t<.04045?.0773993808*t:Math.pow(.9478672986*t+.0521327014,2.4)}function Se(t){return t<.0031308?12.92*t:1.055*Math.pow(t,.41666)-.055}const ke=(t,e)=>{const i=be.exec(t);if(e||i){const t=parseInt(i[1],16),e=i[1].length;return 3===e?new Ae((t>>8&15)+((t>>8&15)<<4),(t>>4&15)+((t>>4&15)<<4),(15&t)+((15&t)<<4),1):6===e?we(t):8===e?new Ae(t>>24&255,t>>16&255,t>>8&255,(255&t)/255):null}};class Be{static Brighter(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;return 1===e?t:new Be(t).brighter(e).toRGBA()}static SetOpacity(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;return 1===e?t:new Be(t).setOpacity(e).toRGBA()}static getColorBrightness(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"hsl";const i=t instanceof Be?t:new Be(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();case"wcag":return i.getLuminanceWCAG()}}static parseColorString(t){if(nt(ye[t]))return function(t){return ct(t)?new Ae(t>>>24,t>>>16&255,t>>>8&255,255&t):ht(t)?new Ae(t[0],t[1],t[2],t[3]):new Ae(255,255,255,1)}(ye[t]);if(nt(xe[t]))return we(xe[t]);const e=`${t}`.trim().toLowerCase(),i=ke(e);if(void 0!==i)return i;if(/^(rgb|RGB|rgba|RGBA)/.test(e)){const t=e.replace(/(?:\(|\)|rgba|RGBA|rgb|RGB)*/g,"").split(",");return new Ae(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=ve(parseInt(t[0],10),parseInt(t[1],10),parseInt(t[2],10));return new Ae(i.r,i.g,i.b,parseFloat(t[3]))}}constructor(t){const e=Be.parseColorString(t);this.color=e||new Ae(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:n}=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(n*t))),this}add(t){const{r:e,g:i,b:n}=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,n+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:n}=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(n*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 n=this.color.opacity,s=me(this.color.r,this.color.g,this.color.b),r=ve(it(t)?s.h:Rt(t,0,360),it(e)?s.s:e>=0&&e<=1?100*e:e,it(i)?s.l:i<=1&&i>=0?100*i:i);return this.color=new Ae(r.r,r.g,r.b,n),this}setRGB(t,e,i){return!it(t)&&(this.color.r=t),!it(e)&&(this.color.g=e),!it(i)&&(this.color.b=i),this}setHex(t){const e=`${t}`.trim().toLowerCase(),i=ke(e,!0);return null!=i?i: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}getLuminanceWCAG(){const t=this.color.r/255,e=this.color.g/255,i=this.color.b/255;let n,s,r;return n=t<=.03928?t/12.92:Math.pow((t+.055)/1.055,2.4),s=e<=.03928?e/12.92:Math.pow((e+.055)/1.055,2.4),r=i<=.03928?i/12.92:Math.pow((i+.055)/1.055,2.4),.2126*n+.7152*s+.0722*r}clone(){return new Be(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=Te(t.color.r),this.color.g=Te(t.color.g),this.color.b=Te(t.color.b),this}copyLinearToSRGB(t){return this.color.r=Se(t.color.r),this.color.g=Se(t.color.g),this.color.b=Se(t.color.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}}class Ae{constructor(t,e,i,n){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)),nt(n)?this.opacity=isNaN(+n)?1:Math.max(0,Math.min(1,+n)):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:n}=me(this.r,this.g,this.b);return`${1===t?"hsl(":"hsla("}${e},${i}%,${n}%${1===t?")":`,${t})`}`}toString(){return this.formatHex()}}function Ce(t){if(ut(t))return[t,t,t,t];if(ht(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,n]=t;return[e,i,n,i]}if(4===e)return t}if(st(t)){const{top:e=0,right:i=0,bottom:n=0,left:s=0}=t;return[e,i,n,s]}return[0,0,0,0]}const Le=Ht-1e-8;class Oe{constructor(t){this.init(t)}init(t){this.bounds=t}arc(t,e,i,n,s,r){if(Math.abs(s-n)>Le)return this.bounds.add(t-i,e-i),void this.bounds.add(t+i,e+i);let a,o,l,h,d=1/0,c=-1/0,u=1/0,p=-1/0;function g(t){l=i*Math.cos(t),h=i*Math.sin(t),l<d&&(d=l),l>c&&(c=l),h<u&&(u=h),h>p&&(p=h)}if(g(n),g(s),s!==n)if((n%=Ht)<0&&(n+=Ht),(s%=Ht)<0&&(s+=Ht),s<n&&(r=!r,a=n,n=s,s=a),r)for(s-=Ht,a=n-n%Nt,o=0;o<4&&a>s;++o,a-=Nt)g(a);else for(a=n-n%Nt+Nt,o=0;o<4&&a<s;++o,a+=Nt)g(a);this.bounds.add(t+d,e+u),this.bounds.add(t+c,e+p)}arcTo(t,e,i,n,s){this.bounds.add(t,e)}bezierCurveTo(t,e,i,n,s,r){this.bounds.add(t,e),this.bounds.add(i,n),this.bounds.add(s,r)}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,n){this.bounds.add(t,e),this.bounds.add(i,n)}rect(t,e,i,n){this.bounds.add(t,e),this.bounds.add(t+i,e+n)}clear(){this.bounds.clear()}release(){}}class Ee{constructor(){this._curves=[],this.bounds=new pe}get curves(){return this._curves}getCurveLengths(){return this._curves.map((t=>t.getLength()))}getPointAt(t){return{x:0,y:0}}getLength(){return 0}getBounds(){return this.bounds}}const Re=/([-+]?((\d+\.\d+)|((\d+)|(\.\d+)))(?:[eE][-+]?\d+)?)/gi,Me={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},Pe=0,De=1,Ie=2,Fe=3,Ne=4,He=5,ze=6,We=7,Ue=8;let je,Ge,Ye,Ve,Xe,Ke;var $e,qe,Ze,Je,Qe,ti,ei,ii,ni;function si(t){const e=t[0],i=t[1],n=t[2],s=t[3],r=t[4],a=t[5],o=t[6],l=t[7],h=l*r,d=-o*a,c=o*r,u=l*a,p=Math.cos(n),g=Math.sin(n),f=Math.cos(s),v=Math.sin(s),m=.5*(s-n),b=Math.sin(.5*m),y=8/3*b*b/Math.sin(m),x=e+p-y*g,_=i+g+y*p,w=e+f,T=i+v,S=w+y*v,k=T-y*f;return[h*x+d*_,c*x+u*_,h*S+d*k,c*S+u*k,h*w+d*T,c*w+u*T]}function ri(t,e,i,n){const s=function(t,e,i,n,s,r,a,o,l){const h=Jt(a),d=Math.sin(h),c=Math.cos(h),u=c*(o-t)*.5+d*(l-e)*.5,p=c*(l-e)*.5-d*(o-t)*.5;let g=u*u/((i=Math.abs(i))*i)+p*p/((n=Math.abs(n))*n);g>1&&(g=Math.sqrt(g),i*=g,n*=g);const f=c/i,v=d/i,m=-d/n,b=c/n,y=f*o+v*l,x=m*o+b*l,_=f*t+v*e,w=m*t+b*e;let T=1/((_-y)*(_-y)+(w-x)*(w-x))-.25;T<0&&(T=0);let S=Math.sqrt(T);r===s&&(S=-S);const k=.5*(y+_)-S*(w-x),B=.5*(x+w)+S*(_-y),A=Math.atan2(x-B,y-k);let C=Math.atan2(w-B,_-k)-A;C<0&&1===r?C+=Ht:C>0&&0===r&&(C-=Ht);const L=Math.ceil(Math.abs(C/(Nt+.001))),O=[];for(let t=0;t<L;++t){const e=A+t*C/L,s=A+(t+1)*C/L;O[t]=[k,B,e,s,i,n,d,c]}return O}(n[5],n[6],n[0],n[1],n[3],n[4],n[2],e,i);for(let e=0;e<s.length;++e){const i=si(s[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"}($e||($e={})),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"}(qe||(qe={})),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"}(Ze||(Ze={})),function(t){t[t.INITIAL=0]="INITIAL",t[t.RUNNING=1]="RUNNING",t[t.PAUSED=2]="PAUSED",t[t.END=3]="END"}(Je||(Je={})),function(t){t[t.NORMAL=0]="NORMAL",t[t.SET_ATTR_IMMEDIATELY=1]="SET_ATTR_IMMEDIATELY"}(Qe||(Qe={})),function(t){t.wait="wait",t.from="from",t.to="to",t.customAnimate="customAnimate"}(ti||(ti={})),function(t){t[t.ROW=1]="ROW",t[t.COLUMN=2]="COLUMN"}(ei||(ei={})),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"}(ii||(ii={})),function(t){t[t.beforeFillStroke=0]="beforeFillStroke",t[t.afterFillStroke=1]="afterFillStroke"}(ni||(ni={}));const ai=[(t,e,i,n,s,r,a)=>e.arc(t[1]*s+i,t[2]*r+n,t[3]*(s+r)/2,t[4],t[5],t[6],a),(t,e,i,n,s,r,a)=>e.arcTo(t[1]*s+i,t[2]*r+n,t[3]*s+i,t[4]*r+n,t[5]*(s+r)/2,a),(t,e,i,n,s,r,a)=>e.bezierCurveTo(t[1]*s+i,t[2]*r+n,t[3]*s+i,t[4]*r+n,t[5]*s+i,t[6]*r+n,a),(t,e,i,n)=>e.closePath(),(t,e,i,n,s,r)=>e.ellipse(t[1]*s+i,t[2]*r+n,t[3]*s,t[4]*r,t[5],t[6],t[7],t[8]),(t,e,i,n,s,r,a)=>e.lineTo(t[1]*s+i,t[2]*r+n,a),(t,e,i,n,s,r,a)=>e.moveTo(t[1]*s+i,t[2]*r+n,a),(t,e,i,n,s,r,a)=>e.quadraticCurveTo(t[1]*s+i,t[2]*r+n,t[3]*s+i,t[4]*r+n,a),(t,e,i,n,s,r,a)=>e.rect(t[1]*s+i,t[2]*r+n,t[3]*s,t[4]*r,a)];function oi(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1,r=arguments.length>5&&void 0!==arguments[5]?arguments[5]:1,a=arguments.length>6?arguments[6]:void 0;for(let o=0;o<t.length;o++){const l=t[o];ai[l[0]](l,e,i,n,s,r,a)}}class li{getLength(t){return null!=t?this.calcProjLength(t):(Number.isFinite(this.length)||(this.length=this.calcLength()),this.length)}}function hi(t,e){let i=0;const n=t.length;for(let s=0;s<n;s++){const r=t[s],a=e[s],o=t[(s+1)%n],l=e[(s+1)%n];i+=Zt.distanceNN(r,a,o,l)}return i/2}function di(t,e,i,n,s){const r=1-s;return r*r*r*t+3*e*s*r*r+3*i*s*s*r+n*s*s*s}function ci(t,e,i,n,s){const r=di(t.x,e.x,i.x,n.x,s),a=di(t.y,e.y,i.y,n.y,s);return new qt(r,a)}function ui(t,e,i,n){const s=1-n;return s*s*t+2*s*n*e+n*n*i}function pi(t,e,i,n){const s=ui(t.x,e.x,i.x,n),r=ui(t.y,e.y,i.y,n);return new qt(s,r)}class gi extends li{constructor(t,e,i){super(),this.type=ii.QuadraticBezierCurve,this.p0=t,this.p1=e,this.p2=i}_validPoint(){return Number.isFinite(this.p0.x+this.p0.y+this.p1.x+this.p1.y+this.p2.x+this.p2.y)}getPointAt(t){if(!1!==this.defined)return pi(this.p0,this.p1,this.p2,t);throw new Error("defined为false的点不能getPointAt")}calcLength(){return this._validPoint()?(t=this.p0,e=this.p1,i=this.p2,hi([t.x,e.x,i.x],[t.y,e.y,i.y])):60;var t,e,i}calcProjLength(t){return t===ei.ROW?Wt(this.p0.x-this.p2.x):t===ei.COLUMN?Wt(this.p0.y-this.p2.y):0}getAngleAt(t){const e=Gt(t-.01,0),i=Yt(t+.01,1),n=this.getPointAt(e),s=this.getPointAt(i);return Ut(s.y-n.y,s.x-n.x)}draw(t,e,i,n,s,r){if(t.moveTo(this.p0.x*n+e,this.p0.y*s+i),r>=1)t.quadraticCurveTo(this.p1.x*n+e,this.p1.y*s+i,this.p2.x*n+e,this.p2.y*s+i);else if(r>0){const[a]=function(t,e){const{p0:i,p1:n,p2:s}=t,r=pi(i,n,s,e),a=Zt.pointAtPP(i,n,e),o=Zt.pointAtPP(n,s,e);return[new gi(i,a,r),new gi(r,o,s)]}(this,r);t.quadraticCurveTo(a.p1.x*n+e,a.p1.y*s+i,a.p2.x*n+e,a.p2.y*s+i)}}getYAt(t){throw new Error("QuadraticBezierCurve暂不支持getYAt")}includeX(t){throw new Error("QuadraticBezierCurve暂不支持includeX")}}function fi(t,e){const{p0:i,p1:n,p2:s,p3:r}=t,a=ci(i,n,s,r,e),o=Zt.pointAtPP(i,n,e),l=Zt.pointAtPP(n,s,e),h=Zt.pointAtPP(s,r,e),d=Zt.pointAtPP(o,l,e),c=Zt.pointAtPP(l,h,e);return[new vi(i,o,d,a),new vi(a,c,h,r)]}class vi extends li{constructor(t,e,i,n){super(),this.type=ii.CubicBezierCurve,this.p0=t,this.p1=e,this.p2=i,this.p3=n}_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 ci(this.p0,this.p1,this.p2,this.p3,t);throw new Error("defined为false的点不能getPointAt")}calcLength(){return this._validPoint()?(t=this.p0,e=this.p1,i=this.p2,n=this.p3,hi([t.x,e.x,i.x,n.x],[t.y,e.y,i.y,n.y])):60;var t,e,i,n}calcProjLength(t){return t===ei.ROW?Wt(this.p0.x-this.p3.x):t===ei.COLUMN?Wt(this.p0.y-this.p3.y):0}getAngleAt(t){const e=Gt(t-.01,0),i=Yt(t+.01,1),n=this.getPointAt(e),s=this.getPointAt(i);return Ut(s.y-n.y,s.x-n.x)}draw(t,e,i,n,s,r){if(t.moveTo(this.p0.x*n+e,this.p0.y*s+i),r>=1)t.bezierCurveTo(this.p1.x*n+e,this.p1.y*s+i,this.p2.x*n+e,this.p2.y*s+i,this.p3.x*n+e,this.p3.y*s+i);else if(r>0){const[a]=fi(this,r);t.bezierCurveTo(a.p1.x*n+e,a.p1.y*s+i,a.p2.x*n+e,a.p2.y*s+i,a.p3.x*n+e,a.p3.y*s+i)}}includeX(t){const e=Yt(this.p0.x,this.p1.x,this.p2.x,this.p3.x),i=Gt(this.p0.x,this.p1.x,this.p2.x,this.p3.x);return t>=e&&t<=i}getYAt(t){const e=Yt(this.p0.x,this.p1.x,this.p2.x,this.p3.x),i=(t-e)/(Gt(this.p0.x,this.p1.x,this.p2.x,this.p3.x)-e);return this.getPointAt(i).y}}function mi(t,e){const{p0:i,p1:n}=t,s=Zt.pointAtPP(i,n,e);return[new bi(i,s),new bi(s,n)]}class bi extends li{constructor(t,e){super(),this.type=ii.LineCurve,this.p0=t,this.p1=e}getPointAt(t){if(!1!==this.defined)return Zt.pointAtPP(this.p0,this.p1,t);throw new Error("defined为false的点不能getPointAt")}getAngleAt(t){return null==this.angle&&(this.angle=Ut(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()?Zt.distancePP(this.p0,this.p1):60}calcProjLength(t){return t===ei.ROW?Wt(this.p0.x-this.p1.x):t===ei.COLUMN?Wt(this.p0.y-this.p1.y):0}draw(t,e,i,n,s,r){if(t.moveTo(this.p0.x*n+e,this.p0.y*s+i),r>=1)t.lineTo(this.p1.x*n+e,this.p1.y*s+i);else if(r>0){const a=this.getPointAt(r);t.lineTo(a.x*n+e,a.y*s+i)}}includeX(t){return t>=this.p0.x&&t<=this.p1.x||t>=this.p1.x&&t<=this.p0.x}getYAt(t){if(this.includeX(t)){let e=this.p0,i=this.p1;this.p0.x>this.p1.x&&(e=this.p1,i=this.p0);const n=(t-e.x)/(i.x-e.x);return e.y+n*(i.y-e.y)}return 1/0}}class yi{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,n,s,r,a,o){const l=new vi(new qt(this._lastX,this._lastY),new qt(t,e),new qt(i,n),new qt(s,r));l.originP1=this._lastOriginP,l.originP2=o,l.defined=a,this.curves.push(l),this._lastX=s,this._lastY=r,this._lastOriginP=o}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,n){const s=this.addLinearCurve(t,e,i,this._lastOriginP,n);this.curves.push(s),this._lastX=t,this._lastY=e,this._lastOriginP=n}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,n){throw new Error("SegContext不支持调用quadraticCurveTo")}clear(){this.curves=[],this.length=NaN}tryUpdateLength(t){return this.getLength(t)}addLinearCurve(t,e,i,n,s){const r=new bi(new qt(this._lastX,this._lastY),new qt(t,e));return r.originP1=n,r.originP2=s,r.defined=i,r}getPointAt(t){throw new Error("暂未实现")}getCurveLengths(){return[]}getLength(t){var e,i;if(t===ei.COLUMN){if(!this.curves.length)return 0;const t=this.curves[0],i=this.curves[this.curves.length-1],n=null!==(e=i.p3)&&void 0!==e?e:i.p1;return Wt(t.p0.y-n.y)}if(t===ei.ROW){if(!this.curves.length)return 0;const t=this.curves[0],e=this.curves[this.curves.length-1],n=null!==(i=e.p3)&&void 0!==i?i:e.p1;return Wt(t.p0.x-n.x)}return Number.isFinite(this.length)||(this.length=this.curves.reduce(((t,e)=>t+e.getLength()),0)),this.length}}class xi extends yi{bezierCurveTo(t,e,i,n,s,r,a,o){return super.bezierCurveTo(e,t,n,i,r,s,a,o)}lineTo(t,e,i,n){return super.lineTo(e,t,i,n)}moveTo(t,e,i){return super.moveTo(e,t,i)}clear(){return super.clear()}}function _i(t,e){let i=!1;for(let n=0,s=e.length;n<=s;n++)n>=s===i&&((i=!i)?t.lineStart():t.lineEnd()),i&&t.point(e[n])}function wi(t,e,i){const n=null!=e?e:Wt(i[i.length-1].x-i[0].x)>Wt(i[i.length-1].y-i[0].y)?ei.ROW:ei.COLUMN;return"monotoneY"===t?new xi(t,n):new yi(t,n)}class Ti{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 Si(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{direction:i,startPoint:n}=e;if(t.length<2-Number(!!n))return null;const s=wi("linear",i,t);return function(t,e){_i(t,e)}(new Ti(s,n),t),s}function ki(t,e,i,n,s){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,n,t.lastPoint1)}class Bi{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 Ai(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{direction:i,startPoint:n}=e;if(t.length<2-Number(!!n))return null;if(t.length<3-Number(!!n))return Si(t,e);const s=wi("basis",i,t);return function(t,e){_i(t,e)}(new Bi(s,n),t),s}function Ci(t){return t<0?-1:1}function Li(t,e,i){const n=t._x1-t._x0,s=e-t._x1,r=(t._y1-t._y0)/(n||Number(s<0&&-0)),a=(i-t._y1)/(s||Number(n<0&&-0)),o=(r*s+a*n)/(n+s);return(Ci(r)+Ci(a))*Math.min(Math.abs(r),Math.abs(a),.5*Math.abs(o))||0}function Oi(t,e){const i=t._x1-t._x0;return i?(3*(t._y1-t._y0)/i-e)/2:e}function Ei(t,e,i,n,s){const r=t._x0,a=t._y0,o=t._x1,l=t._y1,h=(o-r)/3;t.context.bezierCurveTo(r+h,a+h*e,o-h,l-h*i,o,l,n,t.lastPoint1)}class Ri{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:Ei(this,this._t0,Oi(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,n=t.y;switch(this._point){case 0:this._point=1,this._line?this.context.lineTo(i,n,!1!==this._lastDefined1&&!1!==this._lastDefined2,t):this.context.moveTo(i,n,t);break;case 1:this._point=2;break;case 2:this._point=3,Ei(this,Oi(this,e=Li(this,i,n)),e,!1!==this._lastDefined1&&!1!==this._lastDefined2);break;default:Ei(this,this._t0,e=Li(this,i,n),!1!==this._lastDefined1&&!1!==this._lastDefined2)}this._x0=this._x1,this._x1=i,this._y0=this._y1,this._y1=n,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 Mi extends Ri{constructor(t,e){super(t,e)}point(t){return super.point({y:t.x,x:t.y,defined:t.defined})}}function Pi(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{direction:i,startPoint:n}=e;if(t.length<2-Number(!!n))return null;if(t.length<3-Number(!!n))return Si(t,e);const s=wi("monotoneX",i,t);return function(t,e){_i(t,e)}(new Ri(s,n),t),s}function Di(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{direction:i,startPoint:n}=e;if(t.length<2-Number(!!n))return null;if(t.length<3-Number(!!n))return Si(t,e);const s=wi("monotoneY",i,t);return function(t,e){_i(t,e)}(new Mi(s,n),t),s}let Ii=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 n=this._x*(1-this._t)+e*this._t;.5===this._t?this.context.lineTo(n,this._y,!1!==this._lastDefined,this.lastPoint):this.context.lineTo(n,this._y,!1!==this._lastDefined&&!1!==t.defined,this.lastPoint),this.context.lineTo(n,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()}};class Fi extends Ii{lineEnd(){this.context.closePath()}}function Ni(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const{direction:n,startPoint:s}=i;if(t.length<2-Number(!!s))return null;const r=new yi("step",null!=n?n:Wt(t[t.length-1].x-t[0].x)>Wt(t[t.length-1].y-t[0].y)?ei.ROW:ei.COLUMN);return Hi(new Ii(r,e,s),t),r}function Hi(t,e){return _i(t,e)}class zi extends Ti{lineEnd(){this.context.closePath()}}function Wi(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{direction:i,startPoint:n}=e;if(t.length<2-Number(!!n))return null;const s=wi("linear",i,t);return function(t,e){_i(t,e)}(new zi(s,n),t),s}function Ui(t,e,i,n,s){let r=t._x1,a=t._y1,o=t._x2,l=t._y2;if(t._l01_a>It){const e=2*t._l01_2a+3*t._l01_a*t._l12_a+t._l12_2a,i=3*t._l01_a*(t._l01_a+t._l12_a);r=(r*e-t._x0*t._l12_2a+t._x2*t._l01_2a)/i,a=(a*e-t._y0*t._l12_2a+t._y2*t._l01_2a)/i}if(t._l23_a>It){const n=2*t._l23_2a+3*t._l23_a*t._l12_a+t._l12_2a,s=3*t._l23_a*(t._l23_a+t._l12_a);o=(o*n+t._x1*t._l23_2a-e*t._l12_2a)/s,l=(l*n+t._y1*t._l23_2a-i*t._l12_2a)/s}t.context.bezierCurveTo(r,a,o,l,t._x2,t._y2,n,t.lastPoint1)}function ji(t,e){return function(i,n){let s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const{direction:r,startPoint:a}=s;if(i.length<2-Number(!!a))return null;if(i.length<3-Number(!!a))return Si(i,s);const o=wi(t,r,i);return _i(new e(o,n,a),i),o}}const Gi=ji("catmullRom",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.startPoint=i,this._alpha=e}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0}lineEnd(){switch(this._point){case 2:this.context.lineTo(this._x2,this._y2,!1!==this._lastDefined1&&!1!==this._lastDefined2,this.lastPoint1);break;case 3:this.point({x:this._x2,y:this._y2})}(this._line||0!==this._line&&1===this._point)&&this.context.closePath(),this._line=1-this._line}point(t){const{x:e,y:i}=t;if(this._point){const t=this._x2-e,n=this._y2-i;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(t*t+n*n,this._alpha))}switch(this._point){case 0:this._point=1,this._line?this.context.lineTo(e,i,!1!==this._lastDefined1&&!1!==this._lastDefined2):this.context.moveTo(e,i);break;case 1:this._point=2;break;case 2:this._point=3;default:Ui(this,e,i,!1!==this._lastDefined1&&!1!==this._lastDefined2)}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=i,this._lastDefined1=this._lastDefined2,this._lastDefined2=t.defined,this.lastPoint0=this.lastPoint1,this.lastPoint1=t}tryUpdateLength(){return this.context.tryUpdateLength()}});const Yi=ji("catmullRomClosed",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.startPoint=i,this._alpha=e}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._x0=this._x1=this._x2=this._x3=this._x4=this._x5=this._y0=this._y1=this._y2=this._y3=this._y4=this._y5=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0}lineEnd(){switch(this._point){case 1:this.context.moveTo(this._x3,this._y3,this.lastPoint1),this.context.closePath();break;case 2:this.context.lineTo(this._x3,this._y3,!1!==this._lastDefined1&&!1!==this._lastDefined2,this.lastPoint1),this.context.closePath();break;case 3:this.point({x:this._x3,y:this._y3}),this.point({x:this._x4,y:this._y4}),this.point({x:this._x5,y:this._y5})}}point(t){const{x:e,y:i}=t;if(this._point){const t=this._x2-e,n=this._y2-i;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(t*t+n*n,this._alpha))}switch(this._point){case 0:this._point=1,this._x3=e,this._y3=i;break;case 1:this._point=2,this.context.moveTo(this._x4=e,this._y4=i,t);break;case 2:this._point=3,this._x5=e,this._y5=i;break;default:Ui(this,e,i,!1!==this._lastDefined1&&!1!==this._lastDefined2)}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=i,this._lastDefined1=this._lastDefined2,this._lastDefined2=t.defined,this.lastPoint0=this.lastPoint1,this.lastPoint1=t}tryUpdateLength(){return this.context.tryUpdateLength()}});class Vi{constructor(t){this.path=t,this._lastX=this._lastY=this._startX=this._startY=0}moveTo(t,e){return this._lastX=this._startX=t,this._lastY=this._startY=e,this}lineTo(t,e){const i=this.addLinearCurve(t,e);this.path.addCurve(i),this._lastX=t,this._lastY=e}addLinearCurve(t,e){return new bi(new qt(this._lastX,this._lastY),new qt(t,e))}quadraticCurveTo(t,e,i,n){const s=new gi(new qt(this._lastX,this._lastY),new qt(t,e),new qt(i,n));this.path.addCurve(s),this._lastX=i,this._lastY=n}bezierCurveTo(t,e,i,n,s,r){const a=new vi(new qt(this._lastX,this._lastY),new qt(t,e),new qt(i,n),new qt(s,r));this.path.addCurve(a),this._lastX=s,this._lastY=r}arcTo(t,e,i,n,s){throw new Error("CurveContext不支持调用arcTo")}ellipse(t,e,i,n,s,r,a,o){throw new Error("CurveContext不支持调用ellipse")}rect(t,e,i,n){throw new Error("CurveContext不支持调用rect")}arc(t,e,i,n,s,r){throw new Error("CurveContext不支持调用arc")}closePath(){this.path.curves.length<2||this.lineTo(this._startX,this._startY)}}function Xi(t,e,i){var n,s;switch(e){case"linear":default:return Si(t,i);case"basis":return Ai(t,i);case"monotoneX":return Pi(t,i);case"monotoneY":return Di(t,i);case"step":return Ni(t,.5,i);case"stepClosed":return function(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const{direction:n,startPoint:s}=i;if(t.length<2-Number(!!s))return null;const r=new yi("step",null!=n?n:Wt(t[t.length-1].x-t[0].x)>Wt(t[t.length-1].y-t[0].y)?ei.ROW:ei.COLUMN);return Hi(new Fi(r,e,s),t),r}(t,.5,i);case"stepBefore":return Ni(t,0,i);case"stepAfter":return Ni(t,1,i);case"catmullRom":return Gi(t,null!==(n=null==i?void 0:i.curveTension)&&void 0!==n?n:.5,i);case"catmullRomClosed":return Yi(t,null!==(s=null==i?void 0:i.curveTension)&&void 0!==s?s:.5,i);case"linearClosed":return Wi(t,i)}}class Ki extends Ee{constructor(t){super(),this.commandList=[],t&&(this._ctx=t),this._boundsContext=new Oe(this.bounds)}get curves(){return this.tryBuildCurves()}setCtx(t){this._ctx=t}moveTo(t,e){return this.commandList.push([ze,t,e]),this._ctx&&this._ctx.moveTo(t,e),this}lineTo(t,e){return this.commandList.push([He,t,e]),this._ctx&&this._ctx.lineTo(t,e),this}quadraticCurveTo(t,e,i,n){return this.commandList.push([We,t,e,i,n]),this._ctx&&this._ctx.quadraticCurveTo(t,e,i,n),this}bezierCurveTo(t,e,i,n,s,r){return this.commandList.push([Ie,t,e,i,n,s,r]),this._ctx&&this._ctx.bezierCurveTo(t,e,i,n,s,r),this}arcTo(t,e,i,n,s){return this.commandList.push([De,t,e,i,n,s]),this._ctx&&this._ctx.arcTo(t,e,i,n,s),this}ellipse(t,e,i,n,s,r,a,o){return this.commandList.push([Ne,t,e,i,n,s,r,a,o]),this._ctx&&this._ctx.ellipse(t,e,i,n,s,r,a,o),this}rect(t,e,i,n){return this.commandList.push([Ue,t,e,i,n]),this._ctx&&this._ctx.rect(t,e,i,n),this}arc(t,e,i,n,s,r){return this.commandList.push([Pe,t,e,i,n,s,r]),this._ctx&&this._ctx.arc(t,e,i,n,s,r),this}closePath(){return this.commandList.push([Fe]),this._ctx&&this._ctx.closePath(),this}addCurve(t){this._curves.push(t)}clear(){this.transformCbList=null,this.commandList.length=0,this._curves.length=0}beginPath(){this.clear()}tryBuildCurves(){if(!this._curves||!this._curves.length){const t=new Vi(this);oi(this.commandList,t,0,0,1,1)}return this._curves}toString(){if(!this.toStringCbList){const t=[];t[ze]=t=>`M${t[1]} ${t[2]}`,t[He]=t=>`L${t[1]} ${t[2]}`,t[We]=t=>`Q${t[1]} ${t[2]} ${t[3]} ${t[4]}`,t[Ie]=t=>`C${t[1]} ${t[2]} ${t[3]} ${t[4]} ${t[5]} ${t[6]}`,t[Pe]=t=>{const e=[];((t,e,i,n,s,r,a)=>{const o=Math.abs(i-e),l=o>.5*Math.PI?Math.ceil(2*o/Math.PI):1,h=(i-e)/l;for(let i=0;i<l;i++){const o=e+h*i,l=e+h*(i+1),d=4*Math.tan(Math.abs(h)/4)/3,c=l<o?-1:1,u=Math.cos(o),p=Math.sin(o),g=Math.cos(l),f=Math.sin(l),v=u*r+n,m=p*a+s,b=g*r+n,y=f*a+s,x=r*d*c,_=a*d*c;t.push(v-x*p,m+_*u,b+x*f,y-_*g,b,y)}})(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[Ue]=t=>`M${t[1]} ${t[2]} h${t[3]} v${t[4]} H${t[1]}Z`,t[Fe]=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,n,s){this.clear();const r=function(t){if(!t)return[];const e=t.match(/[mzlhvcsqta][^mzlhvcsqta]*/gi);if(null===e)return[];let i,n;const s=[];for(let t=0,r=e.length;t<r;t++)if(je=e[t],Ge=je.slice(1),Ye=je[0],i=[Ye],n=Ge.match(Re),null!==n){for(let t=0,e=n.length;t<e;t++)Ve=n[t],Xe=parseFloat(Ve),Number.isNaN(Xe)||i.push(Xe);if(Ke=Me[Ye],i.length-1>Ke){let t,e=Ye;for(let n=1,r=i.length;n<r;n+=Ke){t=[e];for(let e=n,s=n+Ke;e<s;e++)t.push(i[e]);s.push(t),"m"===e?e="l":"M"===e&&(e="L")}}else s.push(i)}else s.push(i);return s}(t);return this._runCommandStrList(r,e,i,n,s),this._updateBounds(),this}fromLine(t){const{points:e,curveType:i,clipRangeByDimension:n}=t.attribute;if(!e)return;const s=Xi(e,i);"x"===n?this.direction=ei.ROW:"y"===n?this.direction=ei.COLUMN:"auto"===n&&(this.direction=s.direction),this._curves=s.curves}fromCustomPath2D(t,e,i,n,s){return this.clear(),this._runCommandList(t.commandList,e,i,n,s),this._updateBounds(),this}transform(t,e,i,n){const s=this.commandList;if(!this.transformCbList){const t=[];t[ze]=this.moveToTransform,t[He]=this.lineToTransform,t[We]=this.quadraticCurveToTransform,t[Ie]=this.bezierCurveToTransform,t[De]=this.arcToTransform,t[Ne]=this.ellipseTransform,t[Ue]=this.rectTransform,t[Pe]=this.arcTransform,t[Fe]=this.closePathTransform,this.transformCbList=t}s.forEach((s=>{this.transformCbList[s[0]](s,t,e,i,n)})),this._updateBounds()}moveToTransform(t,e,i,n,s){t[1]=t[1]*n+e,t[2]=t[2]*s+i}lineToTransform(t,e,i,n,s){t[1]=t[1]*n+e,t[2]=t[2]*s+i}quadraticCurveToTransform(t,e,i,n,s){t[1]=t[1]*n+e,t[2]=t[2]*s+i,t[3]=t[3]*n+e,t[4]=t[4]*s+i}bezierCurveToTransform(t,e,i,n,s){t[1]=t[1]*n+e,t[2]=t[2]*s+i,t[3]=t[3]*n+e,t[4]=t[4]*s+i,t[5]=t[5]*n+e,t[6]=t[6]*s+i}arcToTransform(t,e,i,n,s){t[1]=t[1]*n+e,t[2]=t[2]*s+i,t[3]=t[3]*n+e,t[4]=t[4]*s+i,t[5]=t[5]*(n+s)/2}ellipseTransform(t,e,i,n,s){t[1]=t[1]*n+e,t[2]=t[2]*s+i,t[3]=t[3]*n,t[4]=t[4]*s}rectTransform(t,e,i,n,s){t[1]=t[1]*n+e,t[2]=t[2]*s+i,t[3]=t[3]*n,t[4]=t[4]*s}arcTransform(t,e,i,n,s){t[1]=t[1]*n+e,t[2]=t[2]*s+i,t[3]=t[3]*(n+s)/2}closePathTransform(){}_runCommandStrList(t){let e,i,n,s,r,a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,o=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,d=null,c=0,u=0,p=0,g=0;for(let f=0,v=t.length;f<v;++f){switch(e=t[f],1===l&&1===h||(e=qi(e,l,h)),e[0]){case"l":c+=e[1],u+=e[2],this.lineTo(c+a,u+o);break;case"L":c=e[1],u=e[2],this.lineTo(c+a,u+o);break;case"h":c+=e[1],this.lineTo(c+a,u+o);break;case"H":c=e[1],this.lineTo(c+a,u+o);break;case"v":u+=e[1],this.lineTo(c+a,u+o);break;case"V":u=e[1],this.lineTo(c+a,u+o);break;case"m":c+=e[1],u+=e[2],this.moveTo(c+a,u+o);break;case"M":c=e[1],u=e[2],this.moveTo(c+a,u+o);break;case"c":i=c+e[5],n=u+e[6],p=c+e[3],g=u+e[4],this.bezierCurveTo(c+e[1]+a,u+e[2]+o,p+a,g+o,i+a,n+o),c=i,u=n;break;case"C":c=e[5],u=e[6],p=e[3],g=e[4],this.bezierCurveTo(e[1]+a,e[2]+o,p+a,g+o,c+a,u+o);break;case"s":i=c+e[3],n=u+e[4],null===d[0].match(/[CcSs]/)?(p=c,g=u):(p=2*c-p,g=2*u-g),s=c+e[1],r=u+e[2],this.bezierCurveTo(p+a,g+o,s+a,r+o,i+a,n+o),p=s,g=r,c=i,u=n;break;case"S":i=e[3],n=e[4],null===d[0].match(/[CcSs]/)?(p=c,g=u):(p=2*c-p,g=2*u-g),s=e[1],r=e[2],this.bezierCurveTo(p+a,g+o,s+a,r+o,i+a,n+o),p=s,g=r,c=i,u=n;break;case"q":i=c+e[3],n=u+e[4],p=c+e[1],g=u+e[2],this.quadraticCurveTo(p+a,g+o,i+a,n+o),c=i,u=n;break;case"Q":i=e[3],n=e[4],this.quadraticCurveTo(e[1]+a,e[2]+o,i+a,n+o),c=i,u=n,p=e[1],g=e[2];break;case"t":i=c+e[1],n=u+e[2],null===d[0].match(/[QqTt]/)?(p=c,g=u):"t"===d[0]?(p=2*c-s,g=2*u-r):"q"===d[0]&&(p=2*c-p,g=2*u-g),s=p,r=g,this.quadraticCurveTo(p+a,g+o,i+a,n+o),c=i,u=n,p=c+e[1],g=u+e[2];break;case"T":i=e[1],n=e[2],p=2*c-p,g=2*u-g,this.quadraticCurveTo(p+a,g+o,i+a,n+o),c=i,u=n;break;case"a":ri(this,c+a,u+o,[e[1],e[2],e[3],e[4],e[5],e[6]+c+a,e[7]+u+o]),c+=e[6],u+=e[7];break;case"A":ri(this,c+a,u+o,[e[1],e[2],e[3],e[4],e[5],e[6]+a,e[7]+o]),c=e[6],u=e[7];break;case"z":case"Z":this.closePath()}d=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,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1,s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1;if(0!==e||0!==i||1!==n||1!==s)for(let r=0,a=t.length;r<a;++r){const a=t[r].slice();switch(a[0]){case He:this.lineToTransform(a,e,i,n,s);break;case ze:this.moveToTransform(a,e,i,n,s);break;case Ie:this.bezierCurveToTransform(a,e,i,n,s);break;case We:this.quadraticCurveToTransform(a,e,i,n,s);break;case Pe:this.arcToTransform(a,e,i,n,s);break;case Ne:this.ellipseTransform(a,e,i,n,s);break;case Ue:this.rectTransform(a,e,i,n,s);break;case De:this.arcToTransform(a,e,i,n,s);break;case Fe:this.closePath()}}else this.commandList=t.map((t=>t.slice()))}_updateBounds(){this.bounds.clear(),oi(this.commandList,this._boundsContext)}release(){this.commandList=[],this._boundsContext=null,this._ctx=null}getLength(){if(this.direction===ei.COLUMN){if(!this._curves.length)return 0;const t=this._curves[0],e=this._curves[this._curves.length-1];return Wt(t.p0.y-e.p1.y)}if(this.direction===ei.ROW){if(!this._curves.length)return 0;const t=this._curves[0],e=this._curves[this._curves.length-1];return Wt(t.p0.x-e.p1.x)}return this._curves.reduce(((t,e)=>t+e.getLength()),0)}getYAt(t){if(!this.curves)return 1/0;for(let e=0;e<this.curves.length;e++){const i=this.curves[e];if(i.includeX(t))return i.getYAt(t)}return 1/0}getAttrAt(t){if(!this._curves)return{pos:{x:0,y:0},angle:0};let e,i=0;for(let n=0;n<this._curves.length;n++){e=this._curves[n];const s=e.getLength(this.direction);if(i+s>=t)break;i+=s}const n=(t-i)/e.getLength(this.direction);return{pos:e.getPointAt(n),angle:e.getAngleAt(n)}}drawWithClipRange(t,e,i,n,s){this.tryBuildCurves();const r=this.getLength()*s;let a=0;for(let s=0;s<this._curves.length;s++){const o=this._curves[s],l=o.getLength(this.direction);if(!(a+l<=r)){const s=1-(a+l-r)/l;o.draw(t,i,n,e,e,s);break}o.draw(t,i,n,e,e,1),a+=l}}}const $i=["l",0,0,0,0,0,0,0];function qi(t,e,i){const n=$i[0]=t[0];if("a"===n||"A"===n)$i[1]=e*t[1],$i[2]=i*t[2],$i[3]=t[3],$i[4]=t[4],$i[5]=t[5],$i[6]=e*t[6],$i[7]=i*t[7];else if("h"===n||"H"===n)$i[1]=e*t[1];else if("v"===n||"V"===n)$i[1]=i*t[1];else for(let n=1,s=t.length;n<s;++n)$i[n]=(n%2==1?e:i)*t[n];return $i}const Zi={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 fe},Ji={strokeOpacity:1,lineDash:[],lineDashOffset:0,lineWidth:1,lineCap:"butt",lineJoin:"miter",miterLimit:10,strokeBoundsBuffer:2,stroke:!1},Qi=Object.assign({outerBorder:Object.assign(Object.assign({},Ji),{distance:0}),innerBorder:Object.assign(Object.assign({},Ji),{distance:0})},Ji),tn={text:"",maxLineWidth:1/0,maxWidth: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",underlineDash:[],underlineOffset:0,disableAutoClipedPoptip:void 0,measureMode:$.fontBounding,keepCenterInLine:!1},en=Object.assign(Object.assign(Object.assign(Object.assign({forceBoundsWidth:void 0,forceBoundsHeight:void 0,opacity:1,background:null,autoAnimateTexture:!1,textureRatio:1,textureOptions:null,backgroundOpacity:1,backgroundCornerRadius:0,texture:null,textureColor:"black",textureSize:10,texturePadding:2,backgroundMode:"no-repeat",backgroundFit:!0,backgroundKeepAspectRatio:!1,backgroundClip:!0,backgroundScale:1,backgroundOffsetX:0,backgroundOffsetY:0,blur:0,filter:"",cursor:null,html:null,react:null,vue:null},{fillOpacity:1,fill:!1,shadowBlur:0,shadowColor:"black",shadowOffsetX:0,shadowOffsetY:0}),Qi),{alignSelf:"auto"}),{pickStrokeBuffer:0}),nn={connectedType:"none",connectedStyle:{},connectedX:NaN,connectedY:NaN},sn=Object.assign(Object.assign(Object.assign({strokeSeg:null,renderable:!0,pickable:!0,shadowGraphic:void 0,childrenPickable:!0,fillPickable:!0,strokePickable:!0,visible:!0,zIndex:0,layout:null,boundsPadding:0,fillStrokeOrder:0,renderStyle:"default",pickMode:"accurate",customPickShape:null,boundsMode:"accurate",keepDirIn3d:!0,shadowRootIdx:1,globalZIndex:1,globalCompositeOperation:"",overflow:"hidden",shadowPickMode:"graphic",keepStrokeScale:!1,clipConfig:null},{_debug_bounds:!1}),en),Zi),rn=Object.assign(Object.assign({},sn),{startAngle:0,endAngle:zt,innerRadius:0,outerRadius:1,innerPadding:0,outerPadding:0,cornerRadius:0,padRadius:0,padAngle:0,cap:!1,forceShowCap:!1}),an=Object.assign(Object.assign(Object.assign({},sn),nn),{points:[],segments:[],curveType:"linear",clipRange:1,closePath:!1,curveTension:1}),on=Object.assign(Object.assign({},sn),{radius:1,startAngle:0,endAngle:zt}),ln=Object.assign(Object.assign({},sn),{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",baseOpacity:1,cornerType:"round"}),hn=Object.assign(Object.assign({},sn),{path:"",width:0,height:0,cornerRadius:0,clip:!1}),dn=Object.assign(Object.assign(Object.assign({},sn),nn),{points:[],segments:[],curveType:"linear",clipRange:1,clipRangeByDimension:"default",closePath:!1,curveTension:1}),cn=Object.assign(Object.assign({},sn),{path:new Ki,fillStrokeOrder:1,clipRange:1,customPath:()=>{Ot.getInstance().warn("空函数")}}),un=Object.assign(Object.assign({},sn),{points:[],cornerRadius:0,closePath:!0}),pn=Object.assign(Object.assign({},sn),{width:100,height:100,spikes:5,thickness:.5}),gn=Object.assign(Object.assign({},sn),{width:0,height:0,x1:0,y1:0,strokeBoundsBuffer:0,cornerRadius:0,cornerType:"round"});Object.assign(Object.assign({},sn),{width:0,height:0,x1:0,y1:0,cornerRadius:0,length:0,cornerType:"round"});const fn=Object.assign(Object.assign({},sn),{symbolType:"circle",size:10,keepDirIn3d:!0,clipRange:1}),vn=Object.assign(Object.assign(Object.assign({},sn),tn),{strokeBoundsBuffer:0,keepDirIn3d:!0}),mn=Object.assign(Object.assign(Object.assign({},sn),tn),{upgradeAttrs:null,editable:!1,editOptions:null,ascentDescentMode:"actual",width:300,height:300,ellipsis:!0,wordBreak:"break-word",verticalDirection:"top",textAlign:"left",textBaseline:"top",layoutDirection:"horizontal",textConfig:[],disableAutoWrapLine:!1,maxHeight:void 0,maxWidth:void 0,singleLine:!1}),bn=Object.assign(Object.assign({repeatX:"no-repeat",repeatY:"no-repeat",image:"",width:0,height:0,maxWidth:500,maxHeight:500},sn),{fill:!0,cornerRadius:0,cornerType:"round"}),yn=Object.assign(Object.assign({},bn),{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 xn=new class{},_n=function(){const t={linearGradient:/^(linear\-gradient)/i,radialGradient:/^(radial\-gradient)/i,conicGradient:/^(conic\-gradient)/i,sideOrCorner:/^to (left (top|bottom)|right (top|bottom)|top (left|right)|bottom (left|right)|left|right|top|bottom)/i,extentKeywords:/^(closest\-side|closest\-corner|farthest\-side|farthest\-corner|contain|cover)/,positionKeywords:/^(left|center|right|top|bottom)/i,pixelValue:/^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))px/,percentageValue:/^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))\%/,emValue:/^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))em/,angleValue:/^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))deg/,fromAngleValue:/^from\s*(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))deg/,startCall:/^\(/,endCall:/^\)/,comma:/^,/,hexColor:/(^\#[0-9a-fA-F]+)/,literalColor:/^([a-zA-Z]+)/,rgbColor:/^(rgb\(\d{1,3},\s*\d{1,3},\s*\d{1,3}\))/i,rgbaColor:/^(rgba\(\d{1,3},\s*\d{1,3},\s*\d{1,3},\s*((\d\.\d+)|\d{1,3})\))/i,number:/^(([0-9]*\.[0-9]+)|([0-9]+\.?))/};let e="";function i(t){const i=new Error(e+": "+t);throw i.source=e,i}function n(){return s("linear",t.linearGradient,r)||s("radial",t.radialGradient,o)||s("conic",t.conicGradient,a)}function s(e,n,s){return function(n,r){const a=m(n);if(a){m(t.startCall)||i("Missing (");const n=function(n){const r=s();return r&&(m(t.comma)||i("Missing comma before color stops")),{type:e,orientation:r,colorStops:u(p)}}();return m(t.endCall)||i("Missing )"),n}}(n)}function r(){return v("directional",t.sideOrCorner,1)||v("angular",t.angleValue,1)}function a(){return v("angular",t.fromAngleValue,1)}function o(){let i,n,s=l();return s&&(i=[],i.push(s),n=e,m(t.comma)&&(s=l(),s?i.push(s):e=n)),i}function l(){let t=function(){const t=v("shape",/^(circle)/i,0);return t&&(t.style=f()||h()),t}()||function(){const t=v("shape",/^(ellipse)/i,0);return t&&(t.style=g()||h()),t}();if(t)t.at=d();else{const e=h();if(e){t=e;const i=d();i&&(t.at=i)}else{const e=c();e&&(t={type:"default-radial",at:e})}}return t}function h(){return v("extent-keyword",t.extentKeywords,1)}function d(){if(v("position",/^at/,0)){const t=c();return t||i("Missing positioning value"),t}}function c(){const t={x:g(),y:g()};if(t.x||t.y)return{type:"position",value:t}}function u(e){let n=e();const s=[];if(n)for(s.push(n);m(t.comma);)n=e(),n?s.push(n):i("One extra comma");return s}function p(){const e=v("hex",t.hexColor,1)||v("rgba",t.rgbaColor,1)||v("rgb",t.rgbColor,1)||v("literal",t.literalColor,0);return e||i("Expected color definition"),e.length=g(),e}function g(){return v("%",t.percentageValue,1)||v("position-keyword",t.positionKeywords,1)||f()}function f(){return v("px",t.pixelValue,1)||v("em",t.emValue,1)}function v(t,e,i){const n=m(e);if(n)return{type:t,value:n[i]}}function m(t){const i=/^[\n\r\t\s]+/.exec(e);i&&b(i[0].length);const n=t.exec(e);return n&&b(n[0].length),n}function b(t){e=e.substr(t)}return function(t){return e=t.toString(),function(){const t=u(n);return e.length>0&&i("Invalid input not EOF"),t}()}}();class wn{static IsGradient(t){return!("string"==typeof t&&!t.includes("gradient"))}static IsGradientStr(t){return"string"==typeof t&&t.includes("gradient")}static Parse(t){if(wn.IsGradientStr(t))try{const e=_n(t)[0];if(e){if("linear"===e.type)return wn.ParseLinear(e);if("radial"===e.type)return wn.ParseRadial(e);if("conic"===e.type)return wn.ParseConic(e)}}catch(e){return t}return t}static ParseConic(t){const{orientation:e,colorStops:i=[]}=t,n=Ft/2,s=parseFloat(e.value)/180*Ft-n;return{gradient:"conical",x:.5,y:.5,startAngle:s,endAngle:s+zt,stops:i.map((t=>({color:t.value,offset:parseFloat(t.length.value)/100})))}}static ParseRadial(t){const{colorStops:e=[]}=t;return{gradient:"radial",x0:.5,y0:.5,x1:.5,y1:.5,r0:0,r1:1,stops:e.map((t=>({color:t.value,offset:parseFloat(t.length.value)/100})))}}static ParseLinear(t){const{orientation:e,colorStops:i=[]}=t,n=Ft/2;let s="angular"===e.type?parseFloat(e.value)/180*Ft:0;for(;s<0;)s+=zt;for(;s>=zt;)s-=zt;let r=0,a=0,o=0,l=0;return s<n?(r=0,a=1,o=Math.sin(s),l=a-Math.cos(s)):s<Ft?(r=0,a=0,o=Math.cos(s-n),l=Math.sin(s-n)):s<Ft+n?(r=1,a=0,o=r-Math.sin(s-Ft),l=Math.cos(s-Ft)):(r=1,o=r-Math.cos(s-n-Ft),l-=Math.sin(s-n-Ft)),{gradient:"linear",x0:r,y0:a,x1:o,y1:l,stops:i.map((t=>({color:t.value,offset:parseFloat(t.length.value)/100})))}}}function Tn(t,e,i){let n=e;const{a:s,b:r,c:a,d:o}=t.currentMatrix,l=Math.sign(s)*Math.sqrt(s*s+r*r),h=Math.sign(o)*Math.sqrt(a*a+o*o);return l+h===0?0:(n=n/Math.abs(l+h)*2*i,n)}function Sn(t,e,i){let n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0;var r,a,o,l;if(!e||!0===e)return"black";let h,d;if(ht(e))for(let t=0;t<e.length&&(d=e[t],!d);t++);else d=e;if(d=wn.Parse(d),"string"==typeof d)return d;if(i.AABBBounds&&(!i.attribute||0!==i.attribute.scaleX||0!==i.attribute.scaleY)){const e=i.AABBBounds;let c=e.x2-e.x1,u=e.y2-e.y1,p=e.x1-n,g=e.y1-s;if(i.attribute){const{scaleX:t=1,scaleY:e=1,angle:n=0}=i.attribute;c/=t,u/=e,p/=t,g/=e,(n||1!==t||1!==e)&&(p=null!==(r=i.x1WithoutTransform)&&void 0!==r?r:0,g=null!==(a=i.y1WithoutTransform)&&void 0!==a?a:0,c=null!==(o=i.widthWithoutTransform)&&void 0!==o?o:c,u=null!==(l=i.heightWithoutTransform)&&void 0!==l?l:u)}"linear"===d.gradient?h=function(t,e,i,n,s,r){var a,o,l,h;const d=t.createLinearGradient(i+(null!==(a=e.x0)&&void 0!==a?a:0)*s,n+(null!==(o=e.y0)&&void 0!==o?o:0)*r,i+(null!==(l=e.x1)&&void 0!==l?l:1)*s,n+(null!==(h=e.y1)&&void 0!==h?h:0)*r);return e.stops.forEach((t=>{d.addColorStop(t.offset,t.color)})),d}(t,d,p,g,c,u):"conical"===d.gradient?h=function(t,e,i,n,s,r){var a,o;const l=t.createConicGradient(i+(null!==(a=e.x)&&void 0!==a?a:0)*s,n+(null!==(o=e.y)&&void 0!==o?o:0)*r,e.startAngle,e.endAngle);return e.stops.forEach((t=>{l.addColorStop(t.offset,t.color)})),l.GetPattern?l.GetPattern(s+i,r+n,void 0):l}(t,d,p,g,c,u):"radial"===d.gradient&&(h=function(t,e,i,n,s,r){var a,o,l,h,d,c;const u=t.createRadialGradient(i+(null!==(a=e.x0)&&void 0!==a?a:.5)*s,n+(null!==(o=e.y0)&&void 0!==o?o:.5)*r,Math.max(s,r)*(null!==(l=e.r0)&&void 0!==l?l:0),i+(null!==(h=e.x1)&&void 0!==h?h:.5)*s,n+(null!==(d=e.y1)&&void 0!==d?d:.5)*r,Math.max(s,r)*(null!==(c=e.r1)&&void 0!==c?c:.5));return e.stops.forEach((t=>{u.addColorStop(t.offset,t.color)})),u}(t,d,p,g,c,u))}return h||"orange"}const kn=/\w|\(|\)|-/,Bn=/[.?!,;:/,。?!、;:]/;function An(t,e){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2],n=e;for(;kn.test(t[n-1])&&kn.test(t[n])||Bn.test(t[n]);)if(n--,n<=0)return i?Cn(t,e):e;return n}function Cn(t,e){let i=e;for(;kn.test(t[i+1])&&kn.test(t[i])||Bn.test(t[i]);)if(i++,i>=t.length)return i;return i+1}var Ln=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let On=class{configure(t,e){this.canvas=t.canvas,this.context=t.context,t.bindTextMeasure(this)}_measureTextWithoutAlignBaseline(t,e,i){this.context.setTextStyleWithoutAlignBaseline(e);const n=this.context.measureText(t);return i?this.compatibleMetrics(n,e):n}_measureTextWithAlignBaseline(t,e,i){this.context.setTextStyle(e);const n=this.context.measureText(t);return i?this.compatibleMetrics(n,e):n}compatibleMetrics(t,e){if(null==t.actualBoundingBoxAscent||null==t.actualBoundingBoxDescent||null==t.fontBoundingBoxAscent||null==t.fontBoundingBoxDescent){t={width:t.width};const{ascent:i,descent:n}=this.measureTextBoundADscentEstimate(e);t.actualBoundingBoxAscent=i,t.actualBoundingBoxDescent=n,t.fontBoundingBoxAscent=i,t.fontBoundingBoxDescent=n}if(null==t.actualBoundingBoxLeft||null==t.actualBoundingBoxRight){t={width:t.width,actualBoundingBoxAscent:t.actualBoundingBoxAscent,actualBoundingBoxDescent:t.actualBoundingBoxDescent,fontBoundingBoxAscent:t.fontBoundingBoxAscent,fontBoundingBoxDescent:t.fontBoundingBoxDescent};const{left:i,right:n}=this.measureTextBoundLeftRightEstimate(e);t.actualBoundingBoxLeft=i,t.actualBoundingBoxRight=n}return t}estimate(t,e){let{fontSize:i=vn.fontSize}=e,n=0,s=0;for(let e=0;e<t.length;e++)t.charCodeAt(e)<128?n++:s++;return{width:~~(.8*n*i+s*i),height:i}}measureTextWidth(t,e,i){return this.context?(i=null!=i?i:this._measureTextWithoutAlignBaseline(t,e)).width:this.estimate(t,e).width}measureTextBoundsWidth(t,e,i){return this.context?(i=null!=i?i:this._measureTextWithoutAlignBaseline(t,e)).width:this.estimate(t,e).width}measureTextBoundsLeftRight(t,e,i){return this.context?{left:(i=null!=i?i:this._measureTextWithAlignBaseline(t,e,!0)).actualBoundingBoxLeft,right:i.actualBoundingBoxRight}:this.measureTextBoundLeftRightEstimate(e)}measureTextPixelHeight(t,e,i){var n;return this.context?(i=null!=i?i:this._measureTextWithoutAlignBaseline(t,e,!0),Math.abs(i.actualBoundingBoxAscent-i.actualBoundingBoxDescent)):null!==(n=e.fontSize)&&void 0!==n?n:tn.fontSize}measureTextPixelADscent(t,e,i){return this.context?{ascent:(i=null!=i?i:this._measureTextWithAlignBaseline(t,e,!0)).actualBoundingBoxAscent,descent:i.actualBoundingBoxDescent}:this.measureTextBoundADscentEstimate(e)}measureTextBoundHieght(t,e,i){var n;return this.context?(i=null!=i?i:this._measureTextWithoutAlignBaseline(t,e,!0),Math.abs(i.fontBoundingBoxAscent-i.fontBoundingBoxDescent)):null!==(n=e.fontSize)&&void 0!==n?n:tn.fontSize}measureTextBoundADscent(t,e,i){return this.context?{ascent:(i=null!=i?i:this._measureTextWithAlignBaseline(t,e,!0)).fontBoundingBoxAscent,descent:i.fontBoundingBoxDescent}:this.measureTextBoundADscentEstimate(e)}measureTextBoundADscentEstimate(t){var e;const i=null!==(e=t.fontSize)&&void 0!==e?e:tn.fontSize;return{ascent:.79*i,descent:.21*i}}measureTextBoundLeftRightEstimate(t){var e;const i=null!==(e=t.fontSize)&&void 0!==e?e:tn.fontSize,{textAlign:n}=t;return"center"===n?{left:i/2,right:i/2}:"right"===n||"end"===n?{left:i,right:0}:{left:0,right:i}}measureTextPixelADscentAndWidth(t,e,i){if(!this.context)return Object.assign(Object.assign({},this.measureTextBoundADscentEstimate(e)),{width:this.estimate(t,e).width});const n=this._measureTextWithoutAlignBaseline(t,e,!0);if(i===$.actualBounding)return{ascent:n.actualBoundingBoxAscent,descent:n.actualBoundingBoxDescent,width:n.width};if(i===$.estimate)return Object.assign(Object.assign({},this.measureTextBoundADscentEstimate(e)),{width:n.width});if(i===$.fontBounding){let t=n.fontBoundingBoxAscent,e=n.fontBoundingBoxDescent;if(n.actualBoundingBoxDescent&&e<n.actualBoundingBoxDescent){const i=n.actualBoundingBoxDescent-e;e+=i,t-=i}else if(n.actualBoundingBoxAscent&&t<n.actualBoundingBoxAscent){const i=n.actualBoundingBoxAscent-t;t+=i,e-=i}return{ascent:t,descent:e,width:n.width}}return{ascent:n.actualBoundingBoxAscent,descent:n.actualBoundingBoxDescent,width:n.width}}measureText(t,e){return this.context?(this.context.setTextStyleWithoutAlignBaseline(e),this.context.measureText(t)):this.estimate(t,e)}clipTextVertical(t,e,i,n){if(0===t.length)return{verticalList:t,width:0};const{fontSize:s=12}=e;t.forEach((t=>{t.width=0===t.direction?s:this.measureTextWidth(t.text,e)}));const r=[];let a=0,o=0;for(;o<t.length&&a+t[o].width<i;o++)a+=t[o].width,r.push(t[o]);if(t[o]&&t[o].text.length>1){const s=this._clipText(t[o].text,e,i-a,0,t[o].text.length-1,"end",!1);if(n&&s.str!==t[o].text){let i="",n=0;for(let e=0;e<o;e++){const s=t[e];i+=s.text,n+=s.text.length}i+=t[o].text;let r=An(i,n+s.str.length);r-=n,r!==s.str.length-1&&(s.str=s.str.substring(0,r),s.width=this.measureTextWidth(s.str,e))}r.push(Object.assign(Object.assign({},t[o]),{text:s.str,width:s.width})),a+=s.width}return{verticalList:r,width:a}}clipText(t,e,i,n,s){if(0===t.length)return{str:"",width:0};let r=this.measureTextWidth(t,e);if(r<=i)return{str:t,width:r};if(r=this.measureTextWidth(t[0],e),r>i)return{str:"",width:0};const a=this._clipText(t,e,i,0,t.length-1,"end",!1);if(n&&a.str!==t){let i=An(t,a.str.length,s);i!==a.str.length&&(i>a.str.length&&(a.wordBreaked=i,i=a.str.length),a.str=t.substring(0,i),a.width=this.measureTextWidth(a.str,e))}return a}_clipText(t,e,i,n,s,r,a){let o;if("start"===r)o=this._clipTextStart(t,e,i,n,s),a&&(o.result=a+o.str);else if("middle"===r){const n=this._clipTextMiddle(t,e,i,"","",0,0,1);o={str:"none",width:n.width,result:n.left+a+n.right}}else o=this._clipTextEnd(t,e,i,n,s),a&&(o.result=o.str+a);return o}_clipTextEnd(t,e,i,n,s){if(n===s){Ot.getInstance().warn(`【_clipTextEnd】不应该走到这里${t}, ${n}, ${s}`);const i=t.substring(0,s+1);return{str:i,width:this.measureTextWidth(i,e)}}const r=Math.floor((n+s)/2),a=t.substring(0,r+1),o=this.measureTextWidth(a,e);let l;if(o>i){if(a.length<=1)return{str:"",width:0};const s=t.substring(0,r);return l=this.measureTextWidth(s,e),l<=i?{str:s,width:l}:this._clipTextEnd(t,e,i,n,r)}if(o<i){if(r>=t.length-1)return{str:t,width:this.measureTextWidth(t,e)};const n=t.substring(0,r+2);return l=this.measureTextWidth(n,e),l>=i?{str:a,width:o}:this._clipTextEnd(t,e,i,r,s)}return{str:a,width:o}}_clipTextStart(t,e,i,n,s){const r=Math.ceil((n+s)/2),a=t.substring(r-1,t.length),o=this.measureTextWidth(a,e);let l;if(o>i){if(a.length<=1)return{str:"",width:0};const n=t.substring(r,t.length);return l=this.measureTextWidth(n,e),l<=i?{str:n,width:l}:this._clipTextStart(t,e,i,r,t.length)}if(o<i){if(r<=0)return{str:t,width:this.measureTextWidth(t,e)};const s=t.substring(r-2,t.length);return l=this.measureTextWidth(s,e),l>=i?{str:a,width:o}:this._clipTextStart(t,e,i,n,r)}return{str:a,width:o}}_clipTextMiddle(t,e,i,n,s,r,a,o){const l=t.substring(0,o),h=this.measureTextWidth(l,e);if(h+a>i)return{left:n,right:s,width:r+a};const d=t.substring(t.length-o,t.length),c=this.measureTextWidth(d,e);return h+c>i?{left:l,right:s,width:h+a}:this._clipTextMiddle(t,e,i,l,d,h,c,o+1)}clipTextWithSuffixVertical(t,e,i,n,s,r){if(""===n)return this.clipTextVertical(t,e,i,s);if(0===t.length)return{verticalList:t,width:0};const a=this.clipTextVertical(t,e,i,s);if(a.verticalList.length===t.length&&a.verticalList[a.verticalList.length-1].width===t[t.length-1].width)return a;const o=this.measureTextWidth(n,e);if(o>i)return a;let l;if(i-=o,"start"===r){const r=this.revertVerticalList(t);l=this.clipTextVertical(r,e,i,s);const a=this.revertVerticalList(l.verticalList);a.unshift({text:n,direction:1,width:o}),l.verticalList=a}else if("middle"===r){const r=this.clipTextVertical(t,e,i/2,s),a=this.revertVerticalList(t),h=this.clipTextVertical(a,e,i/2,s);r.verticalList.push({text:n,direction:1,width:o}),this.revertVerticalList(h.verticalList).forEach((t=>r.verticalList.push(t))),l={verticalList:r.verticalList,width:r.width+h.width}}else l=this.clipTextVertical(t,e,i,s),l.verticalList.push({text:n,direction:1,width:o});return l.width+=o,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,n,s,r){let a=arguments.length>6&&void 0!==arguments[6]&&arguments[6];if(""===n)return this.clipText(t,e,i,s);if(0===t.length)return{str:"",width:0};const o=this.measureTextWidth(t,e);if(!a&&o<=i)return{str:t,width:o};const l=this.measureTextWidth(n,e);if(l>i)return{str:"",width:0};if(a&&o+l<=i)return{str:t+n,width:o+l};i-=l;const h=this._clipText(t,e,i,0,t.length-1,r,n);if(s&&h.str!==t){const i=An(t,h.str.length);i!==h.str.length&&(h.result=t.substring(0,i),h.width=this.measureTextWidth(h.str,e))}else a&&h.str===t&&(h.result=t+n);return h.str=h.result,h.width+=l,h}};On=Ln([y()],On);var En=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};const Rn=Symbol.for("TextMeasureContribution");let Mn=class extends On{};Mn=En([y()],Mn);const Pn=new class{constructor(t){const e=t||{};e.defaultScope=e.defaultScope||w,this.options=e,this.id=r.GenAutoIncrementId(),this._bindingDictionary=new Map,this._metadataReader=new O}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 n=this._getNotAllArgs(t,!1,e,i);return this._get(n)}getNamed(t,e){return this.getTagged(t,o,e)}isBound(t){return this._bindingDictionary.has(t)}bind(t){const e=this.options.defaultScope,i=new L(t,e),n=this._bindingDictionary.get(t)||[];return n.push(i),this._bindingDictionary.set(t,n),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 n=this.bind(i);return t(n,e),n},i=()=>t=>this.unbind(t),n=()=>t=>this.isBound(t),s=e=>i=>{const n=this.rebind(i);return t(n,e),n};return t=>({bindFunction:e(t),isboundFunction:n(),rebindFunction:s(t),unbindFunction:i(),unbindAsyncFunction:t=>null})}_getNotAllArgs(t,e,i,n){return{avoidConstraints:!1,isMultiInject:e,serviceIdentifier:t,key:i,value:n}}_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),n=Object.keys(i),s=[];for(let t=0;t<n.length;t++){const e=i[t],n={};e.forEach((t=>{n[t.key]=t.value}));const r={inject:n[l],multiInject:n[h]},a=r.inject||r.multiInject,o={serviceIdentifier:a,constructorArgsMetadata:e},d=(this._bindingDictionary.get(a)||[]).filter((t=>t.constraint(o)));if(d.length){const t={injectIdentifier:a,metadata:e,bindings:d};s.push(t)}}return s}_resolveFromBinding(t){const e=this._getResolvedFromBinding(t);return this._saveToScope(t,e),e}_getResolvedFromBinding(t){let e;switch(t.type){case T:case B:e=t.cache;break;case A: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===_&&(t.cache=e,t.activated=!0)}},Dn=Symbol.for("CanvasFactory");function In(t){return Pn.getNamed(Dn,xn.global.env)(t)}function Fn(t){return"number"==typeof t&&Number.isFinite(t)}const Nn=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=In(Object.assign({nativeCanvas:xn.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=In(Object.assign({nativeCanvas:xn.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 Hn=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},zn=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const Wn=Symbol.for("VWindow"),Un=Symbol.for("WindowHandlerContribution");let jn=class extends j{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(){super(),this.hooks={onChange:new z(["x","y","width","height"])},this.active=()=>{const t=this.global;t.env&&!this.actived&&(Pn.getNamed(Un,t.env).configure(this,t),this.actived=!0)},this._uid=r.GenAutoIncrementId(),this.global=xn.global,this.postInit()}_nativeAddEventListener(t,e,i){return this._handler.addEventListener(t,e,i)}_nativeRemoveEventListener(t,e,i){return this._handler.removeEventListener(t,e,i)}_nativeDispatchEvent(t){return this._handler.dispatchEvent(t)}postInit(){this.global.hooks.onSetEnv.tap("window",this.active),this.active()}get style(){var t;return null!==(t=this._handler.getStyle())&&void 0!==t?t:{}}set style(t){this._handler.setStyle(t)}create(t){var e,i;this._handler.createWindow(t);const n=this._handler.getWH();this._width=n.width,this._height=n.height,t.viewBox?this.setViewBox(t.viewBox):!1!==t.canvasControled?this.setViewBox({x1:0,y1:0,x2:this._width,y2:this._height}):this.setViewBox({x1:0,y1:0,x2:null!==(e=t.width)&&void 0!==e?e:this._width,y2:null!==(i=t.height)&&void 0!==i?i:this._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.global.hooks.onSetEnv.unTap("window",this.active),this.clearAllEventListeners(),this._handler.releaseWindow()}getContext(){return this._handler.getContext()}getNativeHandler(){return this._handler.getNativeHandler()}getImageBuffer(t){return this._handler.getImageBuffer?this._handler.getImageBuffer(t):null}getBoundingClientRect(){return this._handler.getBoundingClientRect()}getContainer(){return this._handler.container}clearViewBox(t){this._handler.clearViewBox(t)}setViewBox(t){this._handler.setViewBox(t)}setViewBoxTransform(t,e,i,n,s,r){this._handler.setViewBoxTransform(t,e,i,n,s,r)}getViewBox(){return this._handler.getViewBox()}getViewBoxTransform(){return this._handler.getViewBoxTransform()}pointTransform(t,e){const i=this._handler.getViewBox(),n={x:t,y:e};return this._handler.getViewBoxTransform().transformPoint({x:t,y:e},n),n.x-=i.x1,n.y-=i.y1,n}hasSubView(){const t=this._handler.getViewBox();return!(0===t.x1&&0===t.y1&&Et(this.width,t.width())&&Et(this.height,t.height()))}isVisible(t){return this._handler.isVisible(t)}onVisibleChange(t){return this._handler.onVisibleChange(t)}getTopLeft(t){return this._handler.getTopLeft(t)}};jn=Hn([y(),zn("design:paramtypes",[])],jn);var Gn=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Yn=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Vn=function(t,e){return function(i,n){e(i,n,t)}};let Xn=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=xn.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=Nn.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 n;this.configure(this.global,this.global.env);const s=this.global.measureTextMethod;this.global.measureTextMethod=i;const r={width:this._textMeasure.measureTextWidth(t,e),height:null!==(n=e.fontSize)&&void 0!==n?n:tn.fontSize};return this.global.measureTextMethod=s,r}createTextMeasureInstance(t,e,i){return this.configure(this.global,this.global.env),new de(Object.assign({defaultFontParams:{fontFamily:tn.fontFamily,fontSize:tn.fontSize},getCanvasForMeasure:i||(()=>this.canvas),getTextBounds:void 0,specialCharSet:"-/: .,@%'\"~"+de.ALPHABET_CHAR_SET+de.ALPHABET_CHAR_SET.toUpperCase()},null!=e?e:{}),t)}drawGraphicToCanvas(t,e,i){if(!e.defaultLayer)return null;const n=Pn.get(Wn),s=t.AABBBounds,r=s.width(),a=s.height(),o=-s.x1,l=-s.y1;n.create({viewBox:{x1:o,y1:l,x2:s.x2,y2:s.y2},width:r,height:a,canvas:i,dpr:e.window.dpr,canvasControled:!0,offscreen:!0,title:""});const h=e.params.optimize.disableCheckGraphicWidthOutRange;e.params.optimize.disableCheckGraphicWidthOutRange=!0,e.defaultLayer.getNativeHandler().drawTo(n,[t],{transMatrix:n.getViewBoxTransform(),viewBox:n.getViewBox(),stage:e,layer:e.defaultLayer,renderService:e.renderService,background:"transparent",clear:!0,updateBounds:!1}),e.params.optimize.disableCheckGraphicWidthOutRange=h;const d=n.getNativeHandler();return d.nativeCanvas?d.nativeCanvas:null}};var Kn;Xn=Gn([y(),Vn(0,m(D)),Vn(0,x(Rn)),Yn("design:paramtypes",[Object])],Xn),function(t){t[t.transform=0]="transform",t[t.matrix=1]="matrix"}(Kn||(Kn={}));const $n=new fe;let qn=class{constructor(){this.matrix=new fe}init(t){return this.mode=Kn.transform,this.originTransform=t,this.matrix.reset(),this}fromMatrix(t,e){return this.mode=Kn.matrix,this.outSourceMatrix=t,this.outTargetMatrix=e,this}scaleMatrix(t,e,i){const n=this.outSourceMatrix;if($n.setValue(n.a,n.b,n.c,n.d,n.e,n.f),this.outTargetMatrix.reset(),i){const{x:n,y:s}=i;this.outTargetMatrix.translate(n,s),this.outTargetMatrix.scale(t,e),this.outTargetMatrix.translate(-n,-s)}else this.outTargetMatrix.scale(t,e);return this.outTargetMatrix.multiply($n.a,$n.b,$n.c,$n.d,$n.e,$n.f),this}rotateMatrix(t,e){const i=this.outSourceMatrix;if($n.setValue(i.a,i.b,i.c,i.d,i.e,i.f),this.outTargetMatrix.reset(),e){const{x:i,y:n}=e;this.outTargetMatrix.translate(i,n),this.outTargetMatrix.rotate(t),this.outTargetMatrix.translate(-i,-n)}else this.outTargetMatrix.rotate(t);return this.outTargetMatrix.multiply($n.a,$n.b,$n.c,$n.d,$n.e,$n.f),this}scale(t,e,i){return this.mode===Kn.matrix?this.scaleMatrix(t,e,i):this}rotate(t,e){return this.mode===Kn.matrix?this.rotateMatrix(t,e):this}translateMatrix(t,e){const i=this.outSourceMatrix;return $n.setValue(i.a,i.b,i.c,i.d,i.e,i.f),this.outTargetMatrix.reset(),this.outTargetMatrix.translate(t,e),this.outTargetMatrix.multiply($n.a,$n.b,$n.c,$n.d,$n.e,$n.f),this}translate(t,e){return this.mode===Kn.matrix?this.translateMatrix(t,e):this}simplify(t){return this.mode===Kn.matrix?this.simplifyMatrix(t):this}simplifyMatrix(t){return this}};qn=Gn([y(),Yn("design:paramtypes",[])],qn);const Zn={arc:rn,area:an,circle:on,line:dn,path:cn,symbol:fn,text:vn,rect:gn,polygon:un,star:pn,richtext:mn,richtextIcon:yn,image:bn,group:ln,glyph:hn},Jn=Object.keys(Zn);function Qn(t,e){Object.keys(e).forEach((i=>{t[i]=e[i]}))}const ts={arc:Object.assign({},Zn.arc),area:Object.assign({},Zn.area),circle:Object.assign({},Zn.circle),line:Object.assign({},Zn.line),path:Object.assign({},Zn.path),symbol:Object.assign({},Zn.symbol),text:Object.assign({},Zn.text),rect:Object.assign({},Zn.rect),polygon:Object.assign({},Zn.polygon),star:Object.assign({},Zn.star),richtext:Object.assign({},Zn.richtext),richtextIcon:Object.assign({},Zn.richtextIcon),image:Object.assign({},Zn.image),group:Object.assign({},Zn.group),glyph:Object.assign({},Zn.glyph)};class es{constructor(){this.initTheme(),this.dirty=!1}initTheme(){this._defaultTheme={},Jn.forEach((t=>{this._defaultTheme[t]=Object.create(ts[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 n=this.getParentWithTheme(t);if(n){const t=n.theme;(t.dirty||i)&&t.applyTheme(n,e,!0)}this.userTheme?this.doCombine(n&&n.theme.combinedTheme):(n?this.combinedTheme=n.theme.combinedTheme:(this.combinedTheme=this._defaultTheme,Ot.getInstance().warn("未知错误,走到不应该走的区域里")),this.dirty=!1)}return this.combinedTheme}doCombine(t){const e=this.userTheme,i=this.combinedTheme;Jn.forEach((n=>{const s=Object.create(ts[n]);t&&t[n]&&Qn(s,t[n]),i[n]&&Qn(s,i[n]),e[n]&&Qn(s,e[n]),this.combinedTheme[n]=s})),e.common&&Jn.forEach((t=>{Qn(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 is=new es;function ns(t,e){return t.glyphHost?ns(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)):is.getTheme()}return null}(t)||t.attachedThemeGraphic&&ns(t.attachedThemeGraphic)||is.getTheme()}var ss=function(t,e,i,n){return new(i||(i=Promise))((function(s,r){function a(t){try{l(n.next(t))}catch(t){r(t)}}function o(t){try{l(n.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?s(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((n=n.apply(t,e||[])).next())}))};class rs extends J{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=r.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 ss(this,void 0,void 0,(function*(){if(e){let e=this._lastChild,i=0;for(;e;){let n=t(e,i++);if(n.then&&(n=yield n),n)return;e=e._prev}}else{let e=this._firstChild,i=0;for(;e;){let n=t(e,i++);if(n.then&&(n=yield n),n)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===t||t===e)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===t||t===e)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&&Ot.getInstance().warn("insertIntoKeepIdx和insertInto混用可能会存在错误"),e>=this.childrenCount)return this.appendChild(t);if(this===t)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 n=this.insertInto(t,0);return this._ignoreWarn=!1,n}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(t){if(!this._idMap)return;this._nodeList&&(this._nodeList.length=0);let e=this._firstChild;for(;e;){const t=e._next;e.parent=null,e._prev=null,e._next=null,e=e._next,e=t}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,n)=>!(e===this||!t(e,n)||(i=e,0)))),e&&this.forEachChildren((e=>{if(e.isContainer){const n=e.find(t,!0);if(n)return i=n,!0}return!1})),i}findAll(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=[];return this.forEachChildren(((e,n)=>{e!==this&&t(e,n)&&i.push(e)})),e&&this.forEachChildren((e=>{if(e.isContainer){const n=e.findAll(t,!0);n.length&&(i=i.concat(n))}})),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 n=tt(i,!0)&&i||st(i)&&i.capture,s=st(i)&&i.once,r=et(e)?void 0:e;return t=n?`${t}capture`:t,e=et(e)?e:e.handleEvent,s?super.once(t,e,r):super.on(t,e,r),this}on(t,e,i){return this.addEventListener(t,e,i)}removeEventListener(t,e,i){const n=tt(i,!0)&&i||st(i)&&i.capture,s=et(e)?void 0:e;t=n?`${t}capture`:t,e=et(e)?e:e.handleEvent;const r=st(i)&&i.once;return super.off(t,e,s,r),this}off(t,e,i){return this.removeEventListener(t,e,i)}once(t,e,i){return st(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),n=1;n<e;n++)i[n-1]=arguments[n];return super.emit(t.type,t,...i),!t.defaultPrevented}emit(t,e){return this.dispatchEvent(t,e)}release(){this.removeAllListeners()}}class as{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=as.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.composedDetailPath(),this.path}composedDetailPath(){return this.pickParams&&this.pickParams.graphic?(this.detailPath=this.path.slice(),this._composedDetailPath(this.pickParams)):this.detailPath=this.path.slice(),this.detailPath}_composedDetailPath(t){if(t&&t.graphic){const e=t.graphic;if(e.stage){const i=e.stage.eventSystem.manager.propagationPath(e);this.detailPath.push(i),this._composedDetailPath(t.params)}}}preventDefault(){try{this.nativeEvent instanceof Event&&this.nativeEvent.cancelable&&this.nativeEvent.preventDefault()}catch(t){this.nativeEvent.preventDefault&&et(this.nativeEvent.preventDefault)&&this.nativeEvent.preventDefault()}this.defaultPrevented=!0}stopImmediatePropagation(){this.propagationImmediatelyStopped=!0}stopPropagation(){try{this.nativeEvent instanceof Event&&this.nativeEvent.cancelable&&this.nativeEvent.stopPropagation()}catch(t){this.nativeEvent.stopPropagation&&et(this.nativeEvent.stopPropagation)&&this.nativeEvent.stopPropagation()}this.propagationStopped=!0}initEvent(){}initUIEvent(){}clone(){throw new Error("Method not implemented.")}}class os extends as{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,n,s,r,a,o,l,h,d,c,u,p,g){throw new Error("Method not implemented.")}}class ls extends os{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 n=new ls(this.manager);n.eventPhase=n.NONE,n.currentTarget=null,n.path=[],n.detailPath=[],n.target=null,n.nativeEvent=this.nativeEvent,n.originalEvent=this.originalEvent,null===(t=this.manager)||void 0===t||t.copyPointerData(this,n),null===(e=this.manager)||void 0===e||e.copyMouseData(this,n),null===(i=this.manager)||void 0===i||i.copyData(this,n),n.target=this.target,n.path=this.composedPath().slice();const s=this.composedDetailPath();return n.detailPath=s&&s.slice(),n.type=this.type,n}}class hs extends os{constructor(){super(...arguments),this.DOM_DELTA_PIXEL=0,this.DOM_DELTA_LINE=1,this.DOM_DELTA_PAGE=2}clone(){var t,e,i;const n=new hs(this.manager);n.eventPhase=n.NONE,n.currentTarget=null,n.path=[],n.detailPath=[],n.target=null,n.nativeEvent=this.nativeEvent,n.originalEvent=this.originalEvent,null===(t=this.manager)||void 0===t||t.copyWheelData(this,n),null===(e=this.manager)||void 0===e||e.copyMouseData(this,n),null===(i=this.manager)||void 0===i||i.copyData(this,n),n.target=this.target,n.path=this.composedPath().slice();const s=this.composedDetailPath();return n.detailPath=s&&s.slice(),n.type=this.type,n}}hs.DOM_DELTA_PIXEL=0,hs.DOM_DELTA_LINE=1,hs.DOM_DELTA_PAGE=2;class ds extends as{constructor(t,e){super(),this.type=t,this.detail=e}}const cs="object"==typeof performance&&performance.now?performance:Date;function us(t){return"mouse"===t||"pen"===t}const ps={dispatchEvent(t){var e;if(!(t instanceof as))throw new Error("DisplayObject cannot propagate events outside of the Federated Events API");return t.defaultPrevented=!1,t.path=[],t.detailPath&&(t.detailPath=[]),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 ds(t,e))}},gs={touchstart:"pointerdown",touchend:"pointerup",touchendoutside:"pointerupoutside",touchmove:"pointermove",touchcancel:"pointercancel"};class fs{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],n=this.bootstrapEvent(this.rootPointerEvent,i);this.manager.mapEvent(n)}this.setCursor(this.manager.cursor,this.manager.cursorTarget),this.rootPointerEvent.nativeEvent=null},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.rootPointerEvent.nativeEvent=null},this.onPointerUp=t=>{if(this.supportsTouchEvents&&"touch"===t.pointerType)return;const e=this.isEventOutsideOfTargetViewPort(t)?"outside":"",i=this.normalizeToPointerData(t);for(let t=0,n=i.length;t<n;t++){const n=this.bootstrapEvent(this.rootPointerEvent,i[t]);n.type+=e,this.manager.mapEvent(n)}this.setCursor(this.manager.cursor,this.manager.cursorTarget),this.rootPointerEvent.nativeEvent=null},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.rootPointerEvent.nativeEvent=null},this.onWheel=t=>{const e=this.normalizeWheelEvent(t);this.manager.mapEvent(e)};const{targetElement:e,resolution:i,rootNode:n,global:s,autoPreventDefault:r=!1,clickInterval:a,supportsTouchEvents:o=s.supportsTouchEvents,supportsPointerEvents:l=s.supportsPointerEvents}=t;this.manager=new class{constructor(t,e){this.dispatch=new J,this.cursorTarget=null,this.pauseNotify=!1,this.mappingState={trackingData:{}},this.eventPool=new Map,this.onPointerDown=(t,e)=>{if(!(t instanceof ls))return void Ot.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(us(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,n;if(!(t instanceof ls))return void Ot.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const s=this.createPointerEvent(t,t.type,e),r=us(s.pointerType),a=this.trackingData(t.pointerId),o=this.findMountedTarget(a.overTargets);if(a.overTargets&&o&&o!==this.rootTarget&&o!==s.target){const e="mousemove"===t.type?"mouseout":"pointerout",i=this.createPointerEvent(t,e,o||void 0);if(this.dispatchEvent(i,"pointerout"),r&&this.dispatchEvent(i,"mouseout"),!s.composedPath().includes(o)){const e=this.createPointerEvent(t,"pointerleave",o||void 0);for(e.eventPhase=e.AT_TARGET;e.target&&!s.composedPath().includes(e.target);)e.currentTarget=e.target,this.notifyTarget(e),r&&this.notifyTarget(e,"mouseleave"),e.target=e.target.parent;this.freeEvent(e)}this.freeEvent(i)}if(o!==s.target){const e="mousemove"===t.type?"mouseover":"pointerover",i=this.clonePointerEvent(s,e);this.dispatchEvent(i,"pointerover"),r&&this.dispatchEvent(i,"mouseover");let n=null==o?void 0:o.parent;for(;n&&n!==this.rootTarget.parent&&n!==s.target;)n=n.parent;if(!n||n===this.rootTarget.parent){const t=this.clonePointerEvent(s,"pointerenter");t.eventPhase=t.AT_TARGET;let e=t.target;const i=new Set;let n=o;for(;n&&n!==this.rootTarget;)i.add(n),n=n.parent;for(;e&&e!==o&&e!==this.rootTarget.parent;)i.has(e)||(t.currentTarget=e,this.notifyTarget(t),r&&this.notifyTarget(t,"mouseenter")),e=e.parent;this.freeEvent(t)}this.freeEvent(i)}this.dispatchEvent(s,"pointermove"),"touch"===s.pointerType&&this.dispatchEvent(s,"touchmove"),r&&(this.dispatchEvent(s,"mousemove"),this.cursorTarget=s.target,this.cursor=(null===(n=null===(i=s.target)||void 0===i?void 0:i.attribute)||void 0===n?void 0:n.cursor)||this.rootTarget.getCursor()),a.overTargets=s.composedPath(),this.freeEvent(s)},this.onPointerOver=(t,e)=>{var i,n;if(!(t instanceof ls))return void Ot.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const s=this.trackingData(t.pointerId),r=this.createPointerEvent(t,t.type,e),a=us(r.pointerType);this.dispatchEvent(r,"pointerover"),a&&this.dispatchEvent(r,"mouseover"),"mouse"===r.pointerType&&(this.cursorTarget=r.target,this.cursor=(null===(n=null===(i=r.target)||void 0===i?void 0:i.attribute)||void 0===n?void 0:n.cursor)||this.rootTarget.getCursor());const o=this.clonePointerEvent(r,"pointerenter");for(o.eventPhase=o.AT_TARGET;o.target&&o.target!==this.rootTarget.parent;)o.currentTarget=o.target,this.notifyTarget(o),a&&this.notifyTarget(o,"mouseenter"),o.target=o.target.parent;s.overTargets=r.composedPath(),this.freeEvent(r),this.freeEvent(o)},this.onPointerOut=(t,e)=>{if(!(t instanceof ls))return void Ot.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const i=this.trackingData(t.pointerId);if(i.overTargets){const e=us(t.pointerType),n=this.findMountedTarget(i.overTargets),s=this.createPointerEvent(t,"pointerout",n||void 0);this.dispatchEvent(s),e&&this.dispatchEvent(s,"mouseout");const r=this.createPointerEvent(t,"pointerleave",n||void 0);for(r.eventPhase=r.AT_TARGET;r.target&&r.target!==this.rootTarget.parent;)r.currentTarget=r.target,this.notifyTarget(r),e&&this.notifyTarget(r,"mouseleave"),r.target=r.target.parent;i.overTargets=[],this.freeEvent(s),this.freeEvent(r)}this.cursorTarget=null,this.cursor=""},this.onPointerUp=(t,e)=>{var i;if(!(t instanceof ls))return void Ot.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const n=cs.now(),s=this.createPointerEvent(t,t.type,e);if(this.dispatchEvent(s,"pointerup"),"touch"===s.pointerType)this.dispatchEvent(s,"touchend");else if(us(s.pointerType)){const t=2===s.button;this.dispatchEvent(s,t?"rightup":"mouseup")}const r=this.trackingData(t.pointerId),a=this.findMountedTarget(r.pressTargetsByButton[t.button]);let o=a;if(a&&!s.composedPath().includes(a)){let e=a;for(;e&&!s.composedPath().includes(e);){if(s.currentTarget=e,this.notifyTarget(s,"pointerupoutside"),"touch"===s.pointerType)this.notifyTarget(s,"touchendoutside");else if(us(s.pointerType)){const t=2===s.button;this.notifyTarget(s,t?"rightupoutside":"mouseupoutside")}e=e.parent}delete r.pressTargetsByButton[t.button],o=e}if(o){const e=this.clonePointerEvent(s,"click");e.target=o,e.path=[],e.detailPath=[],r.clicksByButton[t.button]||(r.clicksByButton[t.button]={clickCount:0,target:e.target,timeStamp:n});const a=r.clicksByButton[t.button];a.target===e.target&&n-a.timeStamp<(null!==(i=this._config.clickInterval)&&void 0!==i?i:200)?++a.clickCount:a.clickCount=1,a.target=e.target,a.timeStamp=n,e.detail=a.clickCount,us(e.pointerType)?(this.dispatchEvent(e,"click"),2===a.clickCount&&this.dispatchEvent(e,"dblclick")):"touch"===e.pointerType&&this._config.supportsTouchEvents&&(this.dispatchEvent(e,"tap"),2===a.clickCount&&this.dispatchEvent(e,"dbltap")),this.dispatchEvent(e,"pointertap"),this.freeEvent(e)}this.freeEvent(s)},this.onPointerUpOutside=(t,e)=>{if(!(t instanceof ls))return void Ot.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const i=this.trackingData(t.pointerId),n=this.findMountedTarget(i.pressTargetsByButton[t.button]),s=this.createPointerEvent(t,t.type,e);if(n){let e=n;for(;e;)s.currentTarget=e,this.notifyTarget(s,"pointerupoutside"),"touch"===s.pointerType?this.notifyTarget(s,"touchendoutside"):us(s.pointerType)&&this.notifyTarget(s,2===s.button?"rightupoutside":"mouseupoutside"),e=e.parent;delete i.pressTargetsByButton[t.button]}this.freeEvent(s)},this.onWheel=(t,e)=>{if(!(t instanceof hs))return void Ot.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,n,s,r,a,o;if(!this.rootTarget)return;const l=this.mappingTable[t.type];let h;const d=`${t.canvasX}-${t.canvasY}`;if((null===(e=this._prePointTargetCache)||void 0===e?void 0:e[d])&&(null===(n=null===(i=this._prePointTargetCache)||void 0===i?void 0:i[d])||void 0===n?void 0:n.stage)&&(null===(r=null===(s=this._prePointTargetCache)||void 0===s?void 0:s[d])||void 0===r?void 0:r.stage.renderCount)===(null===(a=this._prePointTargetCache)||void 0===a?void 0:a.stageRenderCount)?h=this._prePointTargetCache[d]:(h=this.pickTarget(t.viewX,t.viewY,t),t.pickParams||(this._prePointTargetCache={[d]:h,stageRenderCount:null!==(o=null==h?void 0:h.stage.renderCount)&&void 0!==o?o:-1})),l)for(let e=0,i=l.length;e<i;e++)l[e].fn(t,h);else Ot.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 n=0,s=i.length-1;n<s;n++)if(t.currentTarget=i[n],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 n=i.length-2;n>=0;n--)if(t.currentTarget=i[n],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){if(this.pauseNotify)return;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){var n,s;const r=this.allocateEvent(ls);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(null!==(n=r.viewX)&&void 0!==n?n:r.global.x,null!==(s=r.viewY)&&void 0!==s?s:r.global.y,r),"string"==typeof e&&(r.type=e),r}createWheelEvent(t,e){var i,n;const s=this.allocateEvent(hs);return this.copyWheelData(t,s),this.copyMouseData(t,s),this.copyData(t,s),s.nativeEvent=t.nativeEvent,s.originalEvent=t,s.target=e||this.pickTarget(null!==(i=s.viewX)&&void 0!==i?i:s.global.x,null!==(n=s.viewY)&&void 0!==n?n:s.global.y,s),s}clonePointerEvent(t,e){const i=this.allocateEvent(ls);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();const n=t.composedDetailPath();return i.detailPath=n&&n.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 ls&&e instanceof ls&&(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 os&&e instanceof os&&(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=cs.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.detailPath=[],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 n=0,s=i.length;n<s&&!t.propagationImmediatelyStopped;n++)i[n].once&&t.currentTarget.removeEventListener(e,i[n].fn,{once:!0}),i[n].fn.call(i[n].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 n=0,s=i.length;n<s&&!t.propagationImmediatelyStopped;n++)i[n].fn.call(i[n].context,t,e)}pickTarget(t,e,i){let n;const s=this.rootTarget.pick(t,e);return n=s&&s.graphic?s.graphic:s&&s.group?s.group:this.rootTarget.AABBBounds.contains(t,e)?this.rootTarget:null,i&&(i.pickParams=s.params),n}release(){this.dispatch.removeAllListeners(),this.eventPool.clear(),this.rootTarget=null,this.mappingTable=null,this.mappingState=null,this.cursorTarget=null}}(n,{clickInterval:a,supportsTouchEvents:o}),this.globalObj=s,this.supportsPointerEvents=l,this.supportsTouchEvents=o,this.supportsMouseEvents=s.supportsMouseEvents,this.applyStyles=s.applyStyles,this.autoPreventDefault=r,this.eventsAdded=!1,this.rootPointerEvent=new ls,this.rootWheelEvent=new hs,this.cursorStyles={default:"inherit",pointer:"pointer"},this.resolution=i,this.setTargetElement(e)}release(){this.removeEvents(),this.manager&&this.manager.release(),this.domElement=null,this.manager=null,this.globalObj=null}setCursor(t,e){if(!e&&!this.manager.rootTarget.window._handler.canvas.controled)return;t||(t="default");const{applyStyles:i,domElement:n}=this;if(this.currentCursor===t)return;this.currentCursor=t;const s=this.cursorStyles[t];s?"string"==typeof s&&i?n.style.cursor=s:"function"==typeof s?s(t):"object"==typeof s&&i&&Object.assign(n.style,s):i&&lt(t)&&!_t(this.cursorStyles,t)&&(n.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.addEventListener("pointermove",this.onPointerMove,!0),t.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.addEventListener("mousemove",this.onPointerMove,!0),t.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.removeEventListener("pointermove",this.onPointerMove,!0),t.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.removeEventListener("mousemove",this.onPointerMove,!0),t.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){return this.domElement.pointTransform?this.domElement.pointTransform(t.x,t.y):t}mapToCanvasPoint(t){var e,i;const n=null===(e=this.globalObj)||void 0===e?void 0:e.mapToCanvasPoint(t,this.domElement);if(n)return n;let s=0,r=0;if(t.changedTouches){const e=null!==(i=t.changedTouches[0])&&void 0!==i?i:{};s=e.clientX||0,r=e.clientY||0}else s=t.clientX||0,r=t.clientY||0;const a=this.domElement.getBoundingClientRect();return{x:s-a.left,y:r-a.top}}normalizeToPointerData(t){const e=[];if(this.supportsTouchEvents&&t.changedTouches&&t.changedTouches.length)for(let i=0,n=t.changedTouches.length;i<n;i++){const n=t.changedTouches[i];ot(n.button)&&(n.button=0),ot(n.buttons)&&(n.buttons=1),ot(n.isPrimary)&&(n.isPrimary=1===t.touches.length&&"touchstart"===t.type),ot(n.width)&&(n.width=n.radiusX||1),ot(n.height)&&(n.height=n.radiusY||1),ot(n.tiltX)&&(n.tiltX=0),ot(n.tiltY)&&(n.tiltY=0),ot(n.pointerType)&&(n.pointerType="touch"),ot(n.pointerId)&&(n.pointerId=n.identifier||0),ot(n.pressure)&&(n.pressure=n.force||.5),ot(n.twist)&&(n.twist=0),ot(n.tangentialPressure)&&(n.tangentialPressure=0),ot(n.layerX)&&(n.layerX=n.offsetX=n.clientX),ot(n.layerY)&&(n.layerY=n.offsetY=n.clientY),n.isNormalized=!0,n.type=t.type,e.push(n)}else if(!this.globalObj.supportsMouseEvents||t instanceof MouseEvent&&!(this.supportsPointerEvents&&t instanceof PointerEvent)){const i=t;ot(i.isPrimary)&&(i.isPrimary=!0),ot(i.width)&&(i.width=1),ot(i.height)&&(i.height=1),ot(i.tiltX)&&(i.tiltX=0),ot(i.tiltY)&&(i.tiltY=0),ot(i.pointerType)&&(i.pointerType="mouse"),ot(i.pointerId)&&(i.pointerId=1),ot(i.pressure)&&(i.pressure=.5),ot(i.twist)&&(i.twist=0),ot(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:n}=this.mapToCanvasPoint(t);e.canvas.x=i,e.canvas.y=n,e.global.x=i,e.global.y=n,e.offset.x=i,e.offset.y=n;const{x:s,y:r}=this.mapToViewportPoint(e);return e.viewport.x=s,e.viewport.y=r,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:n}=this.mapToCanvasPoint(e);t.canvas.x=i,t.canvas.y=n,t.global.x=i,t.global.y=n,t.offset.x=i,t.offset.y=n;const{x:s,y:r}=this.mapToViewportPoint(t);return t.viewport.x=s,t.viewport.y=r,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=gs[t.type]||t.type),t}transferMouseData(t,e){t.isTrusted=e.isTrusted,t.srcElement=e.srcElement,t.timeStamp=cs.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}isEventOutsideOfTargetViewPort(t){if(this.isEventOutsideOfTargetElement(t))return!0;if(this.domElement.getViewBox){const e=this.mapToViewportPoint(this.mapToCanvasPoint(t)),i=this.domElement.getViewBox(),n=i.width(),s=i.height();return!(e.x<n&&e.y<s&&e.x>0&&e.y>0)}return!1}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)}pauseTriggerEvent(){this.manager.pauseNotify=!0}resumeTriggerEvent(){this.manager.pauseNotify=!1}}var vs;!function(t){t[t.INITIAL=0]="INITIAL",t[t.RUNNING=1]="RUNNING",t[t.PAUSE=2]="PAUSE"}(vs||(vs={}));class ms{static Avaliable(){return!!xn.global.getRequestAnimationFrame()}avaliable(){return ms.Avaliable()}tick(t,e){xn.global.getRequestAnimationFrame()((()=>{this.released||e(this)}))}release(){this.released=!0}getTime(){return Date.now()}}class bs{static Avaliable(){return!0}avaliable(){return bs.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 ys{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-ys.bounceOut(1-t)}static bounceInOut(t){return t<.5?.5*ys.bounceIn(2*t):.5*ys.bounceOut(2*t-1)+.5}static getElasticIn(t,e){return function(i){if(0===i||1===i)return i;const n=e/zt*Math.asin(1/t);return-t*Math.pow(2,10*(i-=1))*Math.sin((i-n)*zt/e)}}static getElasticOut(t,e){return function(i){if(0===i||1===i)return i;const n=e/zt*Math.asin(1/t);return t*Math.pow(2,-10*i)*Math.sin((i-n)*zt/e)+1}}static getElasticInOut(t,e){return function(i){const n=e/zt*Math.asin(1/t);return(i*=2)<1?t*Math.pow(2,10*(i-=1))*Math.sin((i-n)*zt/e)*-.5:t*Math.pow(2,-10*(i-=1))*Math.sin((i-n)*zt/e)*.5+1}}static registerFunc(t,e){ys[t]=e}}function xs(t,e){const i=1/e;let n=1;for(;t>i;)t-=i,n*=-1;const s=n*t/i;return s>0?s:1+s}ys.quadIn=ys.getPowIn(2),ys.quadOut=ys.getPowOut(2),ys.quadInOut=ys.getPowInOut(2),ys.cubicIn=ys.getPowIn(3),ys.cubicOut=ys.getPowOut(3),ys.cubicInOut=ys.getPowInOut(3),ys.quartIn=ys.getPowIn(4),ys.quartOut=ys.getPowOut(4),ys.quartInOut=ys.getPowInOut(4),ys.quintIn=ys.getPowIn(5),ys.quintOut=ys.getPowOut(5),ys.quintInOut=ys.getPowInOut(5),ys.backIn=ys.getBackIn(1.7),ys.backOut=ys.getBackOut(1.7),ys.backInOut=ys.getBackInOut(1.7),ys.elasticIn=ys.getElasticIn(1,.3),ys.elasticOut=ys.getElasticOut(1,.3),ys.elasticInOut=ys.getElasticInOut(1,.3*1.5),ys.easeInOutQuad=t=>(t/=.5)<1?.5*Math.pow(t,2):-.5*((t-=2)*t-2),ys.easeOutElastic=t=>{const e=2*Math.PI/3;return 0===t?0:1===t?1:Math.pow(2,-10*t)*Math.sin((10*t-.75)*e)+1},ys.easeInOutElastic=t=>{const e=2*Math.PI/4.5;return 0===t?0:1===t?1:t<.5?-Math.pow(2,20*t-10)*Math.sin((20*t-11.125)*e)/2:Math.pow(2,-20*t+10)*Math.sin((20*t-11.125)*e)/2+1};for(let t=0;t<10;t++)ys[`flicker${t}`]=e=>xs(e,t);for(let t=2;t<10;t++)ys[`aIn${t}`]=e=>t*e*e+(1-t)*e;class _s{constructor(){this.id=r.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===Je.END?this.removeAnimate(e):e.status===Je.RUNNING||e.status===Je.INITIAL?(this.animateCount++,e.advance(t)):e.status===Je.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 ws=new _s;class Ts{constructor(t,e,i,n,s){this.from=t,this.to=e,this.duration=i,this.easing=n,this.params=s,this.updateCount=0}bind(t,e){this.target=t,this.subAnimate=e,this.onBind()}onBind(){}onFirstRun(){}onStart(){}onEnd(){}getEndProps(){return this.to}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 Ss extends Ts{constructor(t){super(null,null,0,"linear"),this.cb=t}onUpdate(t,e,i){}onStart(){this.cb()}}class ks{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:r.GenAutoIncrementId(),e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:ws,i=arguments.length>2?arguments[2]:void 0;this.id=t,this.timeline=e||ws,this.status=Je.INITIAL,this.tailAnimate=new Bs(this),this.subAnimates=[this.tailAnimate],this.timeScale=1,this.rawPosition=-1,this._startTime=0,this._duringTime=0,this.timeline.addAnimate(this),this.slience=i}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=Gt(t.getDuration(),e)})),this._startTime=e,this}parallel(t){return this._startTime=t.getStartTime(),this}static AddInterpolate(t,e){ks.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.totalDuration===t.duration&&this.trySetAttribute(t.getFromProps(),t.mode),this}trySetAttribute(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:ks.mode;t&&e&Qe.SET_ATTR_IMMEDIATELY&&this.target.setAttributes&&this.target.setAttributes(t,!1,{type:Ze.ANIMATE_PLAY})}runCb(t){const e=new Ss((()=>{t(this,e.step.prev)}));return this.tailAnimate.play(e),this}customInterpolate(t,e,i,n,s,r){const a=ks.interpolateMap.get(t)||ks.interpolateMap.get("");return!!a&&a(t,e,i,n,s,r)}pause(){this.status===Je.RUNNING&&(this.status=Je.PAUSED)}resume(){this.status===Je.PAUSED&&(this.status=Je.RUNNING)}to(t,e,i,n){if(this.tailAnimate.to(t,e,i,n),this.target){const t=this.target.stage;t&&t.renderNextFrame()}return this}from(t,e,i,n){if(this.tailAnimate.from(t,e,i,n),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 Bs(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.slience&&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===Je.INITIAL&&(this.status=Je.RUNNING,this._onStart&&this._onStart.forEach((t=>t()))),this.setPosition(Math.max(this.rawPosition,0)+t*this.timeScale)&&this.status===Je.RUNNING&&(this.status=Je.END,this._onEnd&&this._onEnd.forEach((t=>t())))}setPosition(t){let e,i=0;const n=this.rawPosition,s=this.subAnimates.reduce(((t,e)=>t+e.totalDuration),0);t<0&&(t=0);const r=t>=s;if(r&&(t=s),t===n)return r;for(let n=0;n<this.subAnimates.length&&(e=this.subAnimates[n],!(i+e.totalDuration>=t));n++)i+=e.totalDuration,e=void 0;return this.rawPosition=t,e.setPosition(t-i),r}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=Je.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()}}ks.mode=Qe.NORMAL,ks.interpolateMap=new Map;class Bs{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 As(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,n="string"==typeof i?ys[i]:i,s=this._addStep(e,null,n);return s.type=ti.customAnimate,this._appendProps(t.getEndProps(),s,!1),this._appendCustomAnimate(t,s),this}to(t,e,i,n){(null==e||e<0)&&(e=0);const s="string"==typeof i?ys[i]:i,r=this._addStep(e,null,s);return r.type=ti.to,this._appendProps(t,r,!!n&&n.tempProps),r.propKeys||(r.propKeys=Object.keys(r.props)),n&&n.noPreventAttrs||this.target.animates&&this.target.animates.forEach((t=>{t.id!==this.animate.id&&t.preventAttrs(r.propKeys)})),this}from(t,e,i,n){this.to(t,0,i,n);const s={};this.stepTail.propKeys||(this.stepTail.propKeys=Object.keys(this.stepTail.props)),this.stepTail.propKeys.forEach((t=>{s[t]=this.getLastPropByName(t,this.stepTail)})),this.to(s,e,i,n),this.stepTail.type=ti.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=ti.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 n=new As(this.duration,t,e,i);return this.duration+=t,this.stepTail.append(n),this.stepTail=n,n}_appendProps(t,e,i){e.props=i?t:Object.assign({},t);let n=e.prev;const s=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))}));n.prev;)n.props&&(n.propKeys||(n.propKeys=Object.keys(n.props)),n.propKeys.forEach((t=>{void 0===s[t]&&(s[t]=n.props[t])}))),e.propKeys=Object.keys(e.props),n=n.prev;const r=this.stepHead.props;e.propKeys||(e.propKeys=Object.keys(s)),e.propKeys.forEach((t=>{if(void 0===r[t]){const e=this.animate.getStartProps();r[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,n=this.loop,s=this.rawPosition;let r,a,o=!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&&(o=!0,i<0))return o;if(r=Math.floor(t/i),a=t-r*i,o=t>=n*i+i,o&&(a=i,r=n,t=a*r+i),t===s)return o;const h=!this.reversed!=!(this.bounce&&r%2);return h&&(a=i-a),this._deltaPosition=a-this.position,this.position=a,this.rawPosition=t+l,this.updatePosition(o,h),o}updatePosition(t,e){if(!this.stepHead)return;let i=this.stepHead.next;const n=this.position,s=this.duration;if(this.target&&i){let r=i.next;for(;r&&r.position<=n;)i=r,r=i.next;let a=t?0===s?1:n/s:(n-i.position)/i.duration;i.easing&&(a=i.easing(a)),this.tryCallCustomAnimateLifeCycle(i,this._lastStep||(e?this.stepTail:this.stepHead),e),this.updateTarget(i,a,t),this._lastStep=i,this.animate._onFrame&&this.animate._onFrame.forEach((t=>t(i,a)))}}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 Ot.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 As{constructor(t,e,i,n){this.duration=e,this.position=t,this.props=i,this.easing=n}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 Cs=200,Ls="cubicOut";var Os;!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"}(Os||(Os={}));const Es=[0,0,0,0],Rs=[{x:0,y:0},{x:0,y:0},{x:0,y:0},{x:0,y:0}],Ms=[1,2,3,0,1,2,3,0];function Ps(t,e,i){const{x:n,y:s}=$t(t.x,t.y,e.x,e.y,i),{x:r,y:a}=$t(t.x1,t.y1,e.x1,e.y1,i),o=new qt(n,s,r,a);return o.defined=e.defined,o}function Ds(t,e,i){if(!t||!e)return[];Array.isArray(t)||(t=[t]),Array.isArray(e)||(e=[e]);let n=[];if(t.length>e.length){n=e.map((t=>{const e=new qt(t.x,t.y,t.x1,t.y1);return e.defined=t.defined,e}));for(let s=0;s<e.length;s++)n[s]=Ps(t[s],e[s],i)}else{n=e.map((t=>{const e=new qt(t.x,t.y,t.x1,t.y1);return e.defined=t.defined,e}));for(let s=0;s<t.length;s++)n[s]=Ps(t[s],e[s],i)}return n}function Is(t,e){if(ht(t)){let i;for(let n=0;n<t.length&&void 0===i;n++)i=t[n][e];return i}return t[e]}const Fs=(t,e)=>{const i=((t,e)=>lt(t)&&"%"===t[t.length-1]?e*(Number.parseFloat(t.substring(0,t.length-1))/100):t)(t,e);return isNaN(i)?i:Math.max(e,i)};var Ns;!function(t){t[t.LEFT_TO_RIGHT=0]="LEFT_TO_RIGHT",t[t.RIGHT_TO_LEFT=1]="RIGHT_TO_LEFT",t[t.TOP_TO_BOTTOM=2]="TOP_TO_BOTTOM",t[t.BOTTOM_TO_TOP=3]="BOTTOM_TO_TOP",t[t.STROKE=4]="STROKE"}(Ns||(Ns={}));class Hs extends Ts{constructor(){super(...arguments),this.fromText="",this.toText=""}getEndProps(){return!1===this.valid?{}:{text:this.to}}onBind(){var t,e,i;this.fromText=null!==(e=null===(t=this.from)||void 0===t?void 0:t.text)&&void 0!==e?e:"",this.toText=(null===(i=this.to)||void 0===i?void 0:i.text)||"",(!this.toText||ht(this.toText)&&0===this.toText.length)&&(this.valid=!1),ht(this.toText)&&(this.toText=this.toText.map((t=>(t||"").toString())))}onEnd(){this.target.detachShadow()}onUpdate(t,e,i){if(!1===this.valid)return;const n=this.fromText.length,s=ht(this.toText),r=s?this.toText.reduce(((t,e)=>t+(e||"").length),0):this.toText.length,a=Math.ceil(n+(r-n)*e);if(s){i.text=[];let t=0;this.toText.forEach((e=>{t+e.length>a?(i.text.push(e.substr(0,a-t)),t=a):(i.text.push(e),t+=e.length)}))}else i.text=this.toText.substr(0,a)}}var zs;!function(t){t[t.Color255=0]="Color255",t[t.Color1=1]="Color1"}(zs||(zs={}));class Ws{static Get(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:zs.Color1,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[0,0,0,1];if(e===zs.Color1){const e=Ws.store1[t];if(e)return i[0]=e[0],i[1]=e[1],i[2]=e[2],i[3]=e[3],i;const n=Be.parseColorString(t);if(n){const e=[n.r/255,n.g/255,n.b/255,n.opacity];Ws.store1[t]=e,Ws.store255[t]=[n.r,n.g,n.b,n.opacity],i[0]=e[0],i[1]=e[1],i[2]=e[2],i[3]=e[3]}return i}const n=Ws.store255[t];if(n)return i[0]=n[0],i[1]=n[1],i[2]=n[2],i[3]=n[3],i;const s=Be.parseColorString(t);return s&&(Ws.store1[t]=[s.r/255,s.g/255,s.b/255,s.opacity],Ws.store255[t]=[s.r,s.g,s.b,s.opacity],i[0]=s.r,i[1]=s.g,i[2]=s.b,i[3]=s.opacity),i}static Set(t,e,i){if(e===zs.Color1){if(Ws.store1[t])return;Ws.store1[t]=i,Ws.store255[t]=[Math.floor(255*i[0]),Math.floor(255*i[1]),Math.floor(255*i[2]),Math.floor(255*i[3])]}else{if(Ws.store255[t])return;Ws.store255[t]=i,Ws.store1[t]=[i[0]/255,i[1]/255,i[2]/255,i[3]]}}}function Us(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return Array.isArray(t)&&ct(t[0])?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 js(t,e,i,n,s){return Array.isArray(t)&&!ct(t[0])||Array.isArray(e)&&!ct(e[0])?new Array(4).fill(0).map(((s,r)=>Gs(ht(t)?t[r]:t,ht(e)?e[r]:e,i,n))):Gs(t,e,i,n,s)}function Gs(t,e,i,n,s){if(!t||!e)return t&&Us(t)||e&&Us(e)||!1;let r,a,o=!1,l=!1;if(Array.isArray(t)?r=t:"string"==typeof t?r=Ws.Get(t,zs.Color255):o=!0,Array.isArray(e)?a=e:"string"==typeof e?a=Ws.Get(e,zs.Color255):l=!0,o!==l){const r=o?t:e,a=o?e:t,l=Object.assign(Object.assign({},r),{stops:r.stops.map((t=>Object.assign(Object.assign({},t),{color:Us(a)})))});return o?js(r,l,i,n,s):js(l,r,i,n,s)}if(o){if(t.gradient===e.gradient){const n=t,s=e,r=n.stops,a=s.stops;if(r.length!==a.length)return!1;if("linear"===n.gradient)return function(t,e,i){const n=t.stops,s=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(n.length).fill(0).map(((t,e)=>({color:Xs(n[e].color,s[e].color,i),offset:n[e].offset+(s[e].offset-n[e].offset)*i})))}}(n,s,i);if("radial"===n.gradient)return function(t,e,i){const n=t.stops,s=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(n.length).fill(0).map(((t,e)=>({color:Xs(n[e].color,s[e].color,i),offset:n[e].offset+(s[e].offset-n[e].offset)*i})))}}(n,s,i);if("conical"===n.gradient)return function(t,e,i){const n=t.stops,s=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(n.length).fill(0).map(((t,e)=>({color:Xs(n[e].color,s[e].color,i),offset:n[e].offset+(s[e].offset-n[e].offset)*i})))}}(n,s,i)}return!1}return s&&s(r,a),Us(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]}(r,a,i),n)}Ws.store255={},Ws.store1={};const Ys=[0,0,0,0],Vs=[0,0,0,0];function Xs(t,e,i){return Ws.Get(t,zs.Color255,Ys),Ws.Get(e,zs.Color255,Vs),`rgba(${Math.round(Ys[0]+(Vs[0]-Ys[0])*i)},${Math.round(Ys[1]+(Vs[1]-Ys[1])*i)},${Math.round(Ys[2]+(Vs[2]-Ys[2])*i)},${Ys[3]+(Vs[3]-Ys[3])*i})`}class Ks{static GetImage(t,e){var i;const n=Ks.cache.get(t);n?"fail"===n.loadState?xn.global.getRequestAnimationFrame()((()=>{e.imageLoadFail(t)})):"init"===n.loadState||"loading"===n.loadState?null===(i=n.waitingMark)||void 0===i||i.push(e):e&&e.imageLoadSuccess(t,n.data):Ks.loadImage(t,e)}static GetSvg(t,e){var i;let n=Ks.cache.get(t);n?"fail"===n.loadState?xn.global.getRequestAnimationFrame()((()=>{e.imageLoadFail(t)})):"init"===n.loadState||"loading"===n.loadState?null===(i=n.waitingMark)||void 0===i||i.push(e):e&&e.imageLoadSuccess(t,n.data):(n={type:"image",loadState:"init"},Ks.cache.set(t,n),n.dataPromise=xn.global.loadSvg(t),n.dataPromise?(n.waitingMark=[e],n.dataPromise.then((e=>{var i;n.loadState=(null==e?void 0:e.data)?"success":"fail",n.data=null==e?void 0:e.data,null===(i=n.waitingMark)||void 0===i||i.map(((i,s)=>{(null==e?void 0:e.data)?(n.loadState="success",n.data=e.data,i.imageLoadSuccess(t,e.data)):(n.loadState="fail",i.imageLoadFail(t))})),n.waitingMark&&(n.waitingMark=[])}))):(n.loadState="fail",e.imageLoadFail(t)))}static GetFile(t,e){let i=Ks.cache.get(t);return i?"fail"===i.loadState?Promise.reject():"init"===i.loadState||"loading"===i.loadState?i.dataPromise.then((t=>t.data)):Promise.resolve(i.data):(i={type:e,loadState:"init"},Ks.cache.set(t,i),"arrayBuffer"===e?i.dataPromise=xn.global.loadArrayBuffer(t):"blob"===e?i.dataPromise=xn.global.loadBlob(t):"json"===e&&(i.dataPromise=xn.global.loadJson(t)),i.dataPromise.then((t=>t.data)))}static loading(){setTimeout((()=>{if(!Ks.isLoading&&Ks.toLoadAueue.length){Ks.isLoading=!0;const t=Ks.toLoadAueue.splice(0,10),e=[];t.forEach((t=>{const{url:i,marks:n}=t,s={type:"image",loadState:"init"};if(Ks.cache.set(i,s),s.dataPromise=xn.global.loadImage(i),s.dataPromise){s.waitingMark=n;const t=s.dataPromise.then((t=>{var e;s.loadState=(null==t?void 0:t.data)?"success":"fail",s.data=null==t?void 0:t.data,null===(e=s.waitingMark)||void 0===e||e.map(((e,n)=>{(null==t?void 0:t.data)?(s.loadState="success",s.data=t.data,e.imageLoadSuccess(i,t.data)):(s.loadState="fail",e.imageLoadFail(i))})),s.waitingMark&&(s.waitingMark=[])}));e.push(t)}else s.loadState="fail",n.forEach((t=>t.imageLoadFail(i)))})),Promise.all(e).then((()=>{Ks.isLoading=!1,this.onLoadSuccessCb.forEach((t=>t())),Ks.loading()})).catch((t=>{Ks.isLoading=!1,this.onLoadSuccessCb.forEach((t=>t())),Ks.loading()}))}}),0)}static loadImage(t,e){const i=$s(t,Ks.toLoadAueue);if(-1!==i)return Ks.toLoadAueue[i].marks.push(e),void Ks.loading();Ks.toLoadAueue.push({url:t,marks:[e]}),Ks.loading()}static improveImageLoading(t){const e=$s(t,Ks.toLoadAueue);if(-1!==e){const t=Ks.toLoadAueue.splice(e,1);Ks.toLoadAueue.unshift(t[0])}}static onLoadSuccess(t){this.onLoadSuccessCb.push(t)}}function $s(t,e){for(let i=0;i<e.length;i++)if(e[i].url===t)return i;return-1}Ks.cache=new Map,Ks.isLoading=!1,Ks.toLoadAueue=[],Ks.onLoadSuccessCb=[];class qs{bounds(t,e){if(ct(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}parseSize(t){return ct(t)?t:Math.min(t[0],t[1])}}function Zs(t,e,i,n,s){return s?t.arc(i,n,e,0,Ht,!1,s):t.arc(i,n,e,0,Ht),!1}var Js=new class extends qs{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,n,s){return Zs(t,this.parseSize(e)/2,i,n,s)}drawOffset(t,e,i,n,s,r){return Zs(t,this.parseSize(e)/2+s,i,n,r)}drawToSvgPath(t,e,i,n){const s=this.parseSize(t)/2;return`M ${e-s}, ${i} a ${s},${s} 0 1,0 ${2*s},0 a ${s},${s} 0 1,0 -${2*s},0`}};var Qs=new class extends qs{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,n,s){return function(t,e,i,n,s){return t.moveTo(-3*e+i,-e+n,s),t.lineTo(-e+i,-e+n,s),t.lineTo(-e+i,-3*e+n,s),t.lineTo(e+i,-3*e+n,s),t.lineTo(e+i,-e+n,s),t.lineTo(3*e+i,-e+n,s),t.lineTo(3*e+i,e+n,s),t.lineTo(e+i,e+n,s),t.lineTo(e+i,3*e+n,s),t.lineTo(-e+i,3*e+n,s),t.lineTo(-e+i,e+n,s),t.lineTo(-3*e+i,e+n,s),t.closePath(),!0}(t,this.parseSize(e)/6,i,n,s)}drawOffset(t,e,i,n,s,r){return function(t,e,i,n,s,r){return t.moveTo(-3*e+i-s,-e+n-s,r),t.lineTo(-e+i-s,-e+n-s,r),t.lineTo(-e+i-s,-3*e+n-s,r),t.lineTo(e+i+s,-3*e+n-s,r),t.lineTo(e+i+s,-e+n-s,r),t.lineTo(3*e+i+s,-e+n-s,r),t.lineTo(3*e+i+s,e+n+s,r),t.lineTo(e+i+s,e+n+s,r),t.lineTo(e+i+s,3*e+n+s,r),t.lineTo(-e+i-s,3*e+n+s,r),t.lineTo(-e+i-s,e+n+s,r),t.lineTo(-3*e+i-s,e+n+s,r),t.closePath(),!0}(t,this.parseSize(e)/6,i,n,s,r)}};function tr(t,e,i,n,s){return t.moveTo(i,n-e,s),t.lineTo(e+i,n,s),t.lineTo(i,n+e,s),t.lineTo(i-e,n,s),t.closePath(),!0}var er=new class extends qs{constructor(){super(...arguments),this.type="diamond",this.pathStr="M-0.5,0L0,-0.5L0.5,0L0,0.5Z"}draw(t,e,i,n,s){return tr(t,this.parseSize(e)/2,i,n,s)}drawFitDir(t,e,i,n,s){return tr(t,this.parseSize(e)/2,i,n,s)}drawOffset(t,e,i,n,s,r){return tr(t,this.parseSize(e)/2+s,i,n,r)}};function ir(t,e,i,n){const s=2*e;return t.rect(i-e,n-e,s,s),!1}var nr=new class extends qs{constructor(){super(...arguments),this.type="square",this.pathStr="M-0.5,-0.5h1v1h-1Z"}draw(t,e,i,n){return ir(t,this.parseSize(e)/2,i,n)}drawOffset(t,e,i,n,s){return ir(t,this.parseSize(e)/2+s,i,n)}};function sr(t,e,i,n){let s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0;return t.moveTo(i+e+2*s,e+n+s),t.lineTo(i-e-2*s,e+n+s),t.lineTo(i,n-e-2*s),t.closePath(),!0}class rr extends qs{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,n){return sr(t,this.parseSize(e)/2,i,n)}drawOffset(t,e,i,n,s){return sr(t,this.parseSize(e)/2,i,n,s)}}var ar=new rr;var or=new class extends rr{constructor(){super(...arguments),this.type="triangle"}};const lr=Math.sin(Math.PI/10)/Math.sin(7*Math.PI/10),hr=Math.sin(Ht/10)*lr,dr=-Math.cos(Ht/10)*lr;function cr(t,e,i,n){const s=hr*e,r=dr*e;t.moveTo(i,-e+n),t.lineTo(s+i,r+n);for(let a=1;a<5;++a){const o=Ht*a/5,l=Math.cos(o),h=Math.sin(o);t.lineTo(h*e+i,-l*e+n),t.lineTo(l*s-h*r+i,h*s+l*r+n)}return t.closePath(),!0}var ur=new class extends qs{constructor(){super(...arguments),this.type="star",this.pathStr="M0 -1L0.22451398828979266 -0.3090169943749474L0.9510565162951535 -0.30901699437494745L0.3632712640026804 0.1180339887498948L0.5877852522924732 0.8090169943749473L8.326672684688674e-17 0.3819660112501051L-0.587785252292473 0.8090169943749476L-0.3632712640026804 0.11803398874989487L-0.9510565162951536 -0.30901699437494723L-0.22451398828979274 -0.30901699437494734Z"}draw(t,e,i,n){return cr(t,this.parseSize(e)/2,i,n)}drawOffset(t,e,i,n,s){return cr(t,this.parseSize(e)/2+s,i,n)}};const pr=Xt(3);function gr(t,e,i,n){const s=e,r=s/pr,a=r/5,o=e;return t.moveTo(0+i,-s+n),t.lineTo(r/2+i,n),t.lineTo(a/2+i,n),t.lineTo(a/2+i,o+n),t.lineTo(-a/2+i,o+n),t.lineTo(-a/2+i,n),t.lineTo(-r/2+i,n),t.closePath(),!0}var fr=new class extends qs{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,n){return gr(t,this.parseSize(e)/2,i,n)}drawOffset(t,e,i,n,s){return gr(t,this.parseSize(e)/2+s,i,n)}};function vr(t,e,i,n){const s=2*e;return t.moveTo(i,-e+n),t.lineTo(s/3/2+i,e+n),t.lineTo(-s/3/2+i,e+n),t.closePath(),!0}var mr=new class extends qs{constructor(){super(...arguments),this.type="wedge",this.pathStr="M0,-0.5773502691896257L-0.125,0.28867513459481287L0.125,0.28867513459481287Z"}draw(t,e,i,n){return vr(t,this.parseSize(e)/2,i,n)}drawOffset(t,e,i,n,s){return vr(t,this.parseSize(e)/2+s,i,n)}};function br(t,e,i,n){return t.moveTo(-e+i,n),t.lineTo(i,e+n),!1}var yr=new class extends qs{constructor(){super(...arguments),this.type="stroke",this.pathStr=""}draw(t,e,i,n){return br(t,this.parseSize(e)/2,i,n)}drawOffset(t,e,i,n,s){return br(t,this.parseSize(e)/2+s,i,n)}};const xr=-.5,_r=Xt(3)/2,wr=1/Xt(12);function Tr(t,e,i,n){const s=e/2,r=e*wr,a=s,o=e*wr+e,l=-a,h=o;return t.moveTo(s+i,r+n),t.lineTo(a+i,o+n),t.lineTo(l+i,h+n),t.lineTo(xr*s-_r*r+i,_r*s+xr*r+n),t.lineTo(xr*a-_r*o+i,_r*a+xr*o+n),t.lineTo(xr*l-_r*h+i,_r*l+xr*h+n),t.lineTo(xr*s+_r*r+i,xr*r-_r*s+n),t.lineTo(xr*a+_r*o+i,xr*o-_r*a+n),t.lineTo(xr*l+_r*h+i,xr*h-_r*l+n),t.closePath(),!1}var Sr=new class extends qs{constructor(){super(...arguments),this.type="wye",this.pathStr="M0.25 0.14433756729740646L0.25 0.6443375672974064L-0.25 0.6443375672974064L-0.25 0.14433756729740643L-0.6830127018922193 -0.10566243270259357L-0.4330127018922193 -0.5386751345948129L0 -0.28867513459481287L0.4330127018922193 -0.5386751345948129L0.6830127018922193 -0.10566243270259357Z"}draw(t,e,i,n){return Tr(t,this.parseSize(e)/2,i,n)}drawOffset(t,e,i,n,s){return Tr(t,this.parseSize(e)/2+s,i,n)}};function kr(t,e,i,n,s){return t.moveTo(-e+i-2*s,n),t.lineTo(e+i+s,e+n+2*s),t.lineTo(e+i+s,n-e-2*s),t.closePath(),!0}var Br=new class extends qs{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,n){return kr(t,this.parseSize(e)/2,i,n,0)}drawOffset(t,e,i,n,s){return kr(t,this.parseSize(e)/2,i,n,s)}};function Ar(t,e,i,n){let s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0;return t.moveTo(i-e-s,e+n+2*s),t.lineTo(e+i+2*s,n),t.lineTo(i-e-s,n-e-2*s),t.closePath(),!0}var Cr=new class extends qs{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,n){return Ar(t,this.parseSize(e)/2,i,n)}drawOffset(t,e,i,n,s){return Ar(t,this.parseSize(e)/2,i,n,s)}};function Lr(t,e,i,n){let s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0;return t.moveTo(i-e-2*s,n-e-s),t.lineTo(i+e+2*s,n-e-s),t.lineTo(i,n+e+2*s),t.closePath(),!0}var Or=new class extends qs{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,n){return Lr(t,this.parseSize(e)/2,i,n)}drawOffset(t,e,i,n,s){return Lr(t,this.parseSize(e)/2,i,n,s)}};const Er=Xt(3);function Rr(t,e,i,n){const s=e*Er;return t.moveTo(i,n+-s/3*2),t.lineTo(e+i,n+s),t.lineTo(i-e,n+s),t.closePath(),!0}var Mr=new class extends qs{constructor(){super(...arguments),this.type="thinTriangle",this.pathStr="M0,-0.5773502691896257L-0.5,0.28867513459481287L0.5,0.28867513459481287Z"}draw(t,e,i,n){return Rr(t,this.parseSize(e)/2/Er,i,n)}drawOffset(t,e,i,n,s){return Rr(t,this.parseSize(e)/2/Er+s,i,n)}};function Pr(t,e,i,n){const s=2*e;return t.moveTo(e+i,n-s),t.lineTo(i-e,n),t.lineTo(e+i,s+n),!0}var Dr=new class extends qs{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,n){return Pr(t,this.parseSize(e)/4,i,n)}drawOffset(t,e,i,n,s){return Pr(t,this.parseSize(e)/4+s,i,n)}};function Ir(t,e,i,n){const s=2*e;return t.moveTo(i-e,n-s),t.lineTo(i+e,n),t.lineTo(i-e,s+n),!0}var Fr=new class extends qs{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,n){return Ir(t,this.parseSize(e)/4,i,n)}drawOffset(t,e,i,n,s){return Ir(t,this.parseSize(e)/4+s,i,n)}};function Nr(t,e,i,n){const s=2*e;return t.moveTo(i-s,n+e),t.lineTo(i,n-e),t.lineTo(i+s,n+e),!0}var Hr=new class extends qs{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,n){return Nr(t,this.parseSize(e)/4,i,n)}drawOffset(t,e,i,n,s){return Nr(t,this.parseSize(e)/4+s,i,n)}};function zr(t,e,i,n){const s=2*e;return t.moveTo(i-s,n-e),t.lineTo(i,n+e),t.lineTo(i+s,n-e),!0}var Wr=new class extends qs{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,n){return zr(t,this.parseSize(e)/4,i,n)}drawOffset(t,e,i,n,s){return zr(t,this.parseSize(e)/4+s,i,n)}};function Ur(t,e,i,n,s){return t.moveTo(i,n-e),t.lineTo(i,n+e),!0}var jr=new class extends qs{constructor(){super(...arguments),this.type="lineV",this.pathStr="M0,-0.5L0,0.5"}draw(t,e,i,n,s){return Ur(t,this.parseSize(e)/2,i,n)}drawOffset(t,e,i,n,s,r){return Ur(t,this.parseSize(e)/2+s,i,n)}drawToSvgPath(t,e,i,n){const s=this.parseSize(t)/2;return`M ${e}, ${i-s} L ${e},${i+s}`}};function Gr(t,e,i,n,s){return t.moveTo(i-e,n),t.lineTo(i+e,n),!0}var Yr=new class extends qs{constructor(){super(...arguments),this.type="lineH",this.pathStr="M-0.5,0L0.5,0"}draw(t,e,i,n,s){return Gr(t,this.parseSize(e)/2,i,n)}drawOffset(t,e,i,n,s,r){return Gr(t,this.parseSize(e)/2+s,i,n)}drawToSvgPath(t,e,i,n){const s=this.parseSize(t)/2;return`M ${e-s}, ${i} L ${e+s},${i}`}};function Vr(t,e,i,n,s){return t.moveTo(i-e,n-e),t.lineTo(i+e,n+e),t.moveTo(i+e,n-e),t.lineTo(i-e,n+e),!0}var Xr=new class extends qs{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,n,s){return Vr(t,this.parseSize(e)/2,i,n)}drawOffset(t,e,i,n,s,r){return Vr(t,this.parseSize(e)/2+s,i,n)}drawToSvgPath(t,e,i,n){const s=this.parseSize(t)/2;return`M ${e-s}, ${i-s} L ${e+s},${i+s} M ${e+s}, ${i-s} L ${e-s},${i+s}`}};function Kr(t,e,i,n){return t.rect(i-e[0]/2,n-e[1]/2,e[0],e[1]),!1}function $r(t,e,i,n){const s=e,r=e/2;return t.rect(i-s/2,n-r/2,s,r),!1}var qr=new class extends qs{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,n){return ct(e)?$r(t,e,i,n):Kr(t,e,i,n)}drawWithClipRange(t,e,i,n,s,r,a){ct(e)&&(e=[e,e/2]);const o=2*(e[0]+e[1])*s,l=[{x:i+e[0]/2,y:n-e[1]/2},{x:i+e[0]/2,y:n+e[1]/2},{x:i-e[0]/2,y:n+e[1]/2},{x:i-e[0]/2,y:n-e[1]/2}];let h=0,d=l[3];t.moveTo(d.x,d.y);for(let e=0;e<l.length;e++){const i=l[e],n=Math.sqrt((i.x-d.x)*(i.x-d.x)+(i.y-d.y)*(i.y-d.y));if(h+n>o){const e=(i.x-d.x)*(o-h)/n,s=(i.y-d.y)*(o-h)/n;t.lineTo(d.x+e,d.y+s);break}t.lineTo(i.x,i.y),d=i,h+=n}return!1}drawOffset(t,e,i,n,s){return ct(e)?$r(t,e+2*s,i,n):Kr(t,[e[0]+2*s,e[1]+2*s],i,n)}};const Zr=new pe;class Jr{constructor(t,e){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];this.pathStr="",this.type=t,ht(e)?this.svgCache=e:this.path=e,this.isSvg=i}drawOffset(t,e,i,n,s,r,a){return e=this.parseSize(e),this.isSvg?!!this.svgCache&&(this.svgCache.forEach((s=>{t.beginPath(),oi(s.path.commandList,t,i,n,e,e),a&&a(s.path,s.attribute)})),!1):(oi(this.path.commandList,t,i,n,e+s,e+s),!1)}draw(t,e,i,n,s,r){return e=this.parseSize(e),this.drawOffset(t,e,i,n,0,s,r)}parseSize(t){return ct(t)?t:Math.min(t[0],t[1])}drawWithClipRange(t,e,i,n,s,r,a){return e=this.parseSize(e),this.isSvg?!!this.svgCache&&(this.svgCache.forEach((r=>{r.path.drawWithClipRange(t,e,i,n,s),a&&a(r.path,r.attribute)})),!1):(this.path.drawWithClipRange(t,e,i,n,s),!1)}bounds(t,e){if(t=this.parseSize(t),this.isSvg){if(!this.svgCache)return;return e.clear(),void this.svgCache.forEach((i=>{let{path:n}=i;Zr.x1=n.bounds.x1*t,Zr.y1=n.bounds.y1*t,Zr.x2=n.bounds.x2*t,Zr.y2=n.bounds.y2*t,e.union(Zr)}))}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 Qr={};[Js,Qs,er,nr,Mr,or,ur,fr,mr,yr,Sr,Br,Cr,ar,Or,Dr,Fr,Hr,Wr,qr,jr,Yr,Xr].forEach((t=>{Qr[t.type]=t}));const ta={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"};class ea{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 ia(t,e,i,n){const s=t.indexOf(e,i);if(-1===s)throw new Error(n);return s+e.length-1}function na(t,e,i){const n=function(t,e){let i,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:">",s="";for(let r=e;r<t.length;r++){let e=t[r];if(i)e===i&&(i="");else if('"'===e||"'"===e)i=e;else if(e===n[0]){if(!n[1])return{data:s,index:r};if(t[r+1]===n[1])return{data:s,index:r}}else"\t"===e&&(e=" ");s+=e}}(t,e+1,arguments.length>3&&void 0!==arguments[3]?arguments[3]:">");if(!n)return;let s=n.data;const r=n.index,a=s.search(/\s/);let o=s,l=!0;-1!==a&&(o=s.substr(0,a).replace(/\s\s*$/,""),s=s.substr(a+1));const h=o;if(i){const t=o.indexOf(":");-1!==t&&(o=o.substr(t+1),l=o!==n.data.substr(t+1))}return{tagName:o,tagExp:s,closeIndex:r,attrExpPresent:l,rawTagName:h}}const sa=new RegExp("([^\\s=]+)\\s*(=\\s*(['\"])([\\s\\S]*?)\\3)?","gm");class ra{constructor(t){this.currentNode=null,this.options=t,this.tagsNodeStack=[],this.docTypeEntities={}}addChild(t,e,i){const n=e.tagname;"string"==typeof n?(e.tagname=n,t.addChild(e)):t.addChild(e)}buildAttributesMap(t,e,i){const n={};if(!t)return;const s=function(t,e){const i=[];let n=e.exec(t);for(;n;){const s=[];s.startIndex=e.lastIndex-n[0].length;const r=n.length;for(let t=0;t<r;t++)s.push(n[t]);i.push(s),n=e.exec(t)}return i}(t,sa),r=s.length;for(let t=0;t<r;t++){const e=s[t][1],i=s[t][4];e&&(n[e]=void 0===i||(isNaN(i)?i:Number(i)))}return n}parseXml(t){t=t.replace(/\r\n?/g,"\n");const e=new ea("!xml");let i=e,n="",s="";for(let r=0;r<t.length;r++)if("<"===t[r])if("/"===t[r+1]){const e=ia(t,">",r,"Closing Tag is not closed."),a=s.lastIndexOf(".");s=s.substring(0,a),i=this.tagsNodeStack.pop(),i&&i.child&&n&&i.child[i.child.length-1][":@"]&&(i.child[i.child.length-1][":@"].text=n),n="",r=e}else if("?"===t[r+1])r=na(t,r,!1,"?>").closeIndex+1;else if("!--"===t.substr(r+1,3))r=ia(t,"--\x3e",r+4,"Comment is not closed.");else{const a=na(t,r,!1);let o=a.tagName,l=a.tagExp;const h=a.attrExpPresent,d=a.closeIndex;if(o!==e.tagname&&(s+=s?"."+o:o),l.length>0&&l.lastIndexOf("/")===l.length-1){"/"===o[o.length-1]?(o=o.substr(0,o.length-1),s=s.substr(0,s.length-1),l=o):l=l.substr(0,l.length-1);const t=new ea(o);o!==l&&h&&(t[":@"]=this.buildAttributesMap(l,s,o)),this.addChild(i,t,s),s=s.substr(0,s.lastIndexOf("."))}else{const t=new ea(o);this.tagsNodeStack.push(i),o!==l&&h&&(t[":@"]=this.buildAttributesMap(l,s,o)),this.addChild(i,t,s),i=t}n="",r=d}else n+=t[r];return e.child}}function aa(t,e){return oa(t)}function oa(t,e){const i={};for(let e=0;e<t.length;e++){const s=t[e],r=la(s);if(void 0!==r&&s[r]){const t=oa(s[r]);n=t,Object.keys(n).length,s[":@"]&&ha(t,s[":@"]),void 0!==i[r]&&i.hasOwnProperty(r)?(Array.isArray(i[r])||(i[r]=[i[r]]),i[r].push(t)):i[r]=t}}var n;return i}function la(t){const e=Object.keys(t);for(let t=0;t<e.length;t++){const i=e[t];if(":@"!==i)return i}}function ha(t,e,i){if(e){const i=Object.keys(e),n=i.length;for(let s=0;s<n;s++){const n=i[s];t[n]=e[n]}}}class da{constructor(t){this.options=Object.assign({},da.defaultOptions,t)}valid(t){return t.startsWith("<")}parse(t){if(!this.valid)return!1;return aa(new ra(this.options).parseXml(t),this.options)}}function ca(t,e,i){let n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;return t.expand(e+(n/2+(i?function(t,e){return t?e:0}(i,e):0))),t}da.defaultOptions={};let ua=0;function pa(){return ua++}var ga;!function(t){t[t.HORIZONTAL=0]="HORIZONTAL",t[t.VERTICAL=1]="VERTICAL"}(ga||(ga={}));const fa=new Map;["…","(",")","—","【","】","「","」","《","》"].forEach((t=>fa.set(t,!0)));const va=new Map;function ma(t){if(fa.has(t))return!0;if(va.has(t))return!1;let e=!1;return t.codePointAt(0)<256&&(e=!0),e}[""].forEach((t=>va.set(t,!0))),pa();const ba=pa(),ya=pa(),xa=pa();pa();const _a=pa(),wa=pa(),Ta=pa();pa();const Sa=pa();pa();const ka=pa();pa(),pa(),pa();const Ba=pa(),Aa=pa(),Ca=Symbol.for("GraphicService"),La=Symbol.for("GraphicCreator"),Oa={"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"},Ea=Object.keys(Oa),Ra=new pe,Ma=new fe;new pe;const Pa=["lineWidth","scaleX","scaleY","angle","anchor","visible"],Da=["x","y"],Ia=["scaleX","scaleY"],Fa=["angle"],Na=new qt,Ha={strokeSeg:1,boundsPadding:2,pickMode:1,boundsMode:1,customPickShape:1,pickable:1,childrenPickable:1,visible:1,zIndex:1,layout:1,keepDirIn3d:1,globalZIndex: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 za extends rs{static mixin(t){const e=Object.keys(t);for(let i=0;i<e.length;++i){const n=e[i];Object.defineProperty(za.prototype,n,Object.getOwnPropertyDescriptor(t,n))}}get AABBBounds(){return this.tryUpdateAABBBounds()}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]:{};var e;super(),this._AABBBounds=new pe,this._updateTag=$e.INIT,this.attribute=t,this.valid=this.isValid(),this.updateAABBBoundsStamp=0,t.background?this.loadImage(null!==(e=t.background.background)&&void 0!==e?e:t.background,!0):t.shadowGraphic&&this.setShadowGraphic(t.shadowGraphic)}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,n;const{dx:s=t.dx,dy:r=t.dy}=this.attribute;if(e&&this.parent){const t=this.parent.attribute;Na.x=s+(null!==(i=t.scrollX)&&void 0!==i?i:0),Na.y=r+(null!==(n=t.scrollY)&&void 0!==n?n:0)}else Na.x=s,Na.y=r;return Na}onAnimateBind(t){this._emitCustomEvent("animate-bind",t)}tryUpdateAABBBounds(){const t="imprecise"===this.attribute.boundsMode;if(!this.shouldUpdateAABBBounds())return this._AABBBounds;if(!this.valid)return this._AABBBounds.clear(),this._AABBBounds;xn.graphicService.beforeUpdateAABBBounds(this,this.stage,!0,this._AABBBounds);const e=this.doUpdateAABBBounds(t);return xn.graphicService.afterUpdateAABBBounds(this,this.stage,this._AABBBounds,this,!0),"empty"===this.attribute.boundsMode&&e.clear(),e}tryUpdateOBBBounds(){return this._OBBBounds||(this._OBBBounds=new ge),this.tryUpdateAABBBounds(),this.updateOBBBoundsStamp===this.updateAABBBoundsStamp?this._OBBBounds:(this.updateOBBBoundsStamp=this.updateAABBBoundsStamp,this.valid?this.doUpdateOBBBounds():(this._OBBBounds.clear(),this._OBBBounds))}combindShadowAABBBounds(t){if(this.shadowRoot){const e=this.shadowRoot.AABBBounds.clone();t.union(e)}}doUpdateOBBBounds(){return this._OBBBounds}getClipPath(){const{clipConfig:t}=this.attribute;if(!t)return null;this.clipPathMap||(this.clipPathMap=new Map);const{shape:e}=t;let i=this.clipPathMap.get(e)||null;return i||(this.clipPathMap.size>10&&this.clipPathMap.clear(),i=this.parsePath(e),i&&this.clipPathMap.set(e,i)),i}parsePath(t){if(!t)return null;let e=Qr[t];if(e)return e;if(e=za.userSymbolMap[t],e)return e;if(!0===((i=t=ta[t]||t).startsWith("<svg")||i.startsWith("<?xml"))){const e=new da,{svg:i}=e.parse(t);if(!i)return null;const n=ht(i.path)?i.path:[i.path];Ra.clear();const s=[];n.forEach((t=>{const e=(new Ki).fromString(t.d),i={};Ea.forEach((e=>{t[e]&&(i[Oa[e]]=t[e])})),s.push({path:e,attribute:i}),Ra.union(e.bounds)}));const r=Ra.width(),a=Ra.height(),o=1/Gt(r,a);s.forEach((t=>t.path.transform(0,0,o,o)));const l=new Jr(t,s,!0);return za.userSymbolMap[t]=l,l}var i;const n=(new Ki).fromString(t),s=n.bounds.width(),r=n.bounds.height(),a=1/Gt(s,r);n.transform(0,0,a,a);const o=new Jr(t,n);return za.userSymbolMap[t]=o,o}doUpdateAABBBounds(t){this.updateAABBBoundsStamp++;const e=this.getGraphicTheme();this._AABBBounds.clear();const i=this.attribute,n=this.updateAABBBounds(i,e,this._AABBBounds,t),{boundsPadding:s=e.boundsPadding}=i,r=(a=s)?ht(a)?0===a.length?0:1===a.length?a[0]:2===a.length?(Es[0]=a[0],Es[2]=a[0],Es[1]=a[1],Es[3]=a[1],Es):a:a:0;var a;return r&&n.expand(r),this.clearUpdateBoundTag(),n}updatePathProxyAABBBounds(t){const e="function"==typeof this.pathProxy?this.pathProxy(this.attribute):this.pathProxy;if(!e)return!1;const i=new Oe(t);return oi(e.commandList,i,0,0),!0}tryUpdateGlobalAABBBounds(){const t=this.AABBBounds;return this._globalAABBBounds?this._globalAABBBounds.setValue(t.x1,t.y1,t.x2,t.y2):this._globalAABBBounds=t.clone(),this._globalAABBBounds.empty()||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 fe),this.shouldUpdateLocalMatrix()&&(this.doUpdateLocalMatrix(),t&&this.clearUpdateLocalPositionTag()),this._transMatrix}shouldUpdateAABBBounds(){return this.shadowRoot?(!!(this._updateTag&$e.UPDATE_BOUNDS)||this.shadowRoot.shouldUpdateAABBBounds())&&xn.graphicService.validCheck(this.attribute,this.getGraphicTheme(),this._AABBBounds,this):!!(this._updateTag&$e.UPDATE_BOUNDS)&&xn.graphicService.validCheck(this.attribute,this.getGraphicTheme(),this._AABBBounds,this)}shouldSelfChangeUpdateAABBBounds(){return this.shadowRoot?!!(this._updateTag&$e.UPDATE_BOUNDS)||this.shadowRoot.shouldUpdateAABBBounds():!!(this._updateTag&$e.UPDATE_BOUNDS)}shouldUpdateLocalMatrix(){return!!(this._updateTag&$e.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&$e.UPDATE_SHAPE)}clearUpdateShapeTag(){this._updateTag&=$e.CLEAR_SHAPE}containsPoint(t,e,i,n){if(!n)return!1;if(i===qe.GLOBAL){const i=new qt(t,e);this.parent&&this.parent.globalTransMatrix.transformPoint(i,i),t=i.x,e=i.y}return n.containsPoint(this,{x:t,y:e})}setWidthHeightWithoutTransform(t){this.widthWithoutTransform=t.x2-t.x1,this.heightWithoutTransform=t.y2-t.y1}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):t.shadowGraphic&&this.setShadowGraphic(t.shadowGraphic),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 n=Object.keys(t);for(let e=0;e<n.length;e++){const i=n[e];this.attribute[i]=t[i]}this.valid=this.isValid(),this.updateShapeAndBoundsTagSetted()||!e&&!this.needUpdateTags(n)?this.addUpdateBoundTag():this.addUpdateShapeAndBoundsTag(),this.addUpdatePositionTag(),this.addUpdateLayoutTag(),this.onAttributeUpdate(i)}setAttribute(t,e,i,n){var s;const r=this.onBeforeAttributeUpdate&&this.onBeforeAttributeUpdate({[t]:e},this.attribute,t,n);r?this._setAttributes(r,i,n):it(null===(s=this.normalAttrs)||void 0===s?void 0:s[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(n)):this.normalAttrs[t]=e,"background"===t?this.loadImage(e,!0):"shadowGraphic"===t&&this.setShadowGraphic(e)}needUpdateTags(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Pa;for(let i=0;i<e.length;i++){const n=e[i];if(-1!==t.indexOf(n))return!0}return!1}needUpdateTag(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Pa;for(let i=0;i<e.length;i++)if(t===e[i])return!0;return!1}initAttributes(t){const e={type:Ze.INIT};t=this.onBeforeAttributeUpdate&&this.onBeforeAttributeUpdate(t,this.attribute,null,e)||t,this.attribute=t,t.background?this.loadImage(t.background,!0):t.shadowGraphic&&this.setShadowGraphic(t.shadowGraphic),this._updateTag=$e.INIT,this.valid=this.isValid(),this.onAttributeUpdate(e)}translate(t,e){var i,n;if(0===t&&0===e)return this;const s={type:Ze.TRANSLATE},r=this.onBeforeAttributeUpdate&&this.onBeforeAttributeUpdate({x:t,y:e},this.attribute,Da,s);r&&(t=r.x,e=r.y,delete r.x,delete r.y,this._setAttributes(r));const a=this.attribute,o=a.postMatrix;return o?xn.transformUtil.fromMatrix(o,o).translate(t,e):(a.x=(null!==(i=a.x)&&void 0!==i?i:Zi.x)+t,a.y=(null!==(n=a.y)&&void 0!==n?n:Zi.y)+e),this.addUpdatePositionTag(),this.addUpdateBoundTag(),this.addUpdateLayoutTag(),this.onAttributeUpdate(s),this}translateTo(t,e){const i=this.attribute;if(i.x===t&&i.y===e)return this;const n={type:Ze.TRANSLATE_TO},s=this.onBeforeAttributeUpdate&&this.onBeforeAttributeUpdate({x:t,y:e},this.attribute,Da,n);return s?(this._setAttributes(s,!1,n),this):(i.x=t,i.y=e,this.addUpdatePositionTag(),this.addUpdateBoundTag(),this.addUpdateLayoutTag(),this.onAttributeUpdate(n),this)}scale(t,e,i){var n,s;if(1===t&&1===e)return this;const r={type:Ze.SCALE},a=this.onBeforeAttributeUpdate&&this.onBeforeAttributeUpdate({scaleX:t,scaleY:e,scaleCenter:i},this.attribute,Ia,r);a&&(t=a.scaleX,e=a.scaleY,delete a.scaleX,delete a.scaleY,this._setAttributes(a));const o=this.attribute;if(i){let{postMatrix:n}=this.attribute;n||(n=new fe,o.postMatrix=n),xn.transformUtil.fromMatrix(n,n).scale(t,e,i)}else o.scaleX=(null!==(n=o.scaleX)&&void 0!==n?n:Zi.scaleX)*t,o.scaleY=(null!==(s=o.scaleY)&&void 0!==s?s:Zi.scaleY)*e;return this.addUpdatePositionTag(),this.addUpdateBoundTag(),this.addUpdateLayoutTag(),this.onAttributeUpdate(r),this}scaleTo(t,e){const i=this.attribute;if(i.scaleX===t&&i.scaleY===e)return this;const n={type:Ze.SCALE_TO},s=this.onBeforeAttributeUpdate&&this.onBeforeAttributeUpdate({scaleX:t,scaleY:e},this.attribute,Ia,n);return s?(this._setAttributes(s,!1,n),this):(i.scaleX=t,i.scaleY=e,this.addUpdatePositionTag(),this.addUpdateBoundTag(),this.addUpdateLayoutTag(),this.onAttributeUpdate(n),this)}rotate(t,e){var i;if(0===t)return this;const n={type:Ze.ROTATE},s=this.onBeforeAttributeUpdate&&this.onBeforeAttributeUpdate({angle:t,rotateCenter:e},this.attribute,Fa,n);s&&(delete s.angle,this._setAttributes(s,!1,n));const r=this.attribute;if(e){let{postMatrix:i}=this.attribute;i||(i=new fe,r.postMatrix=i),xn.transformUtil.fromMatrix(i,i).rotate(t,e)}else r.angle=(null!==(i=r.angle)&&void 0!==i?i:Zi.angle)+t;return this.addUpdatePositionTag(),this.addUpdateBoundTag(),this.addUpdateLayoutTag(),this.onAttributeUpdate(n),this}rotateTo(t){const e=this.attribute;if(e.angle===t)return this;const i={type:Ze.ROTATE_TO},n=this.onBeforeAttributeUpdate&&this.onBeforeAttributeUpdate(t,this.attribute,Fa,i);return n?(this._setAttributes(n,!1,i),this):(e.angle=t,this.addUpdatePositionTag(),this.addUpdateBoundTag(),this.addUpdateLayoutTag(),this.onAttributeUpdate(i),this)}skewTo(t,e){return this}animate(t){var e;this.animates||(this.animates=new Map);const i=new ks(null==t?void 0:t.id,null!==(e=null==t?void 0:t.timeline)&&void 0!==e?e:this.stage&&this.stage.getTimeline(),null==t?void 0:t.slience);if(i.bind(this),t){const{onStart:e,onFrame:n,onEnd:s,onRemove:r}=t;null!=e&&i.onStart(e),null!=n&&i.onFrame(n),null!=s&&i.onEnd(s),null!=r&&i.onRemove(r),i.interpolateFunc=t.interpolate}return this.animates.set(i.id,i),i.onRemove((()=>{i.stop(),this.animates.delete(i.id)})),i}onAttributeUpdate(t){t&&t.skipUpdateCallback||(xn.graphicService.onAttributeUpdate(this),this._emitCustomEvent("afterAttributeUpdate",t))}update(t){t?(t.bounds&&this.tryUpdateAABBBounds(),t.trans&&this.tryUpdateLocalTransMatrix()):(this.tryUpdateAABBBounds(),this.tryUpdateLocalTransMatrix())}hasState(t){return!(!this.currentStates||!this.currentStates.length)&&(!!it(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,n){var s,r,a,o;if(i){const i=Object.keys(t),l=this.getNoWorkAnimateAttr(),h={};let d;i.forEach((e=>{l[e]?(d||(d={}),d[e]=t[e]):h[e]=n&&void 0===t[e]?this.getDefaultAttribute(e):t[e]}));const c=this.animate({slience:!0});c.stateNames=e,c.to(h,null!==(r=null===(s=this.stateAnimateConfig)||void 0===s?void 0:s.duration)&&void 0!==r?r:Cs,null!==(o=null===(a=this.stateAnimateConfig)||void 0===a?void 0:a.easing)&&void 0!==o?o:Ls),d&&this.setAttributes(d,!1,{type:Ze.STATE})}else this.stopStateAnimates(),this.setAttributes(t,!1,{type:Ze.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}stopStateAnimates(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"end";this.animates&&this.animates.forEach((e=>{e.stateNames&&(e.stop(t),this.animates.delete(e.id))}))}getNormalAttribute(t){let e=this.attribute[t];return this.animates&&this.animates.forEach((i=>{if(i.stateNames){const n=i.getEndProps();_t(n,t)&&(e=n[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){const i=ht(t)?e=>!t.includes(e):e=>e!==t,n=this.currentStates.filter(i);n.length!==this.currentStates.length&&this.useStates(n,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 n;if(this.currentStates&&this.currentStates.includes(t)&&(e||1===this.currentStates.length))return;const s=e&&(null===(n=this.currentStates)||void 0===n?void 0:n.length)?this.currentStates.concat([t]):[t];this.useStates(s,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 n={};t.forEach((e=>{var i;const s=this.stateProxy?this.stateProxy(e,t):null===(i=this.states)||void 0===i?void 0:i[e];s&&Object.assign(n,s)})),this.updateNormalAttrs(n),this.currentStates=t,this.applyStateAttrs(n,t,e)}addUpdateBoundTag(){this._updateTag|=$e.UPDATE_BOUNDS,this.parent&&this.parent.addChildUpdateBoundTag(),this.glyphHost&&this.glyphHost.addUpdateBoundTag()}addUpdateShapeTag(){this._updateTag|=$e.UPDATE_SHAPE}addUpdateShapeAndBoundsTag(){this._updateTag|=$e.UPDATE_SHAPE_AND_BOUNDS,this.parent&&this.parent.addChildUpdateBoundTag(),this.glyphHost&&this.glyphHost.addUpdateBoundTag()}updateShapeAndBoundsTagSetted(){return(this._updateTag&$e.UPDATE_SHAPE_AND_BOUNDS)===$e.UPDATE_SHAPE_AND_BOUNDS}clearUpdateBoundTag(){this._updateTag&=$e.CLEAR_BOUNDS}addUpdatePositionTag(){this.shadowRoot&&this.shadowRoot.addUpdateGlobalPositionTag(),this._updateTag|=$e.UPDATE_GLOBAL_LOCAL_MATRIX}addUpdateGlobalPositionTag(){this.shadowRoot&&this.shadowRoot.addUpdateGlobalPositionTag(),this._updateTag|=$e.UPDATE_GLOBAL_MATRIX}clearUpdateLocalPositionTag(){this._updateTag&=$e.CLEAR_LOCAL_MATRIX}clearUpdateGlobalPositionTag(){this._updateTag&=$e.CLEAR_GLOBAL_MATRIX}addUpdateLayoutTag(){this._updateTag|=$e.UPDATE_LAYOUT}clearUpdateLayoutTag(){this._updateTag&=$e.CLEAR_LAYOUT}needUpdateLayout(){return!!(this._updateTag&$e.UPDATE_LAYOUT)}getAnchor(t,e,i){const n=[0,0],s=()=>{if(e.b)return e.b;const t=this.clone();return t.attribute.angle=0,t.attribute.scaleCenter=null,i&&(t.attribute.scaleX=1,t.attribute.scaleY=1),e.b=t.AABBBounds,e.b};if("string"==typeof t[0]){const e=parseFloat(t[0])/100,i=s();n[0]=i.x1+(i.x2-i.x1)*e}else n[0]=t[0];if("string"==typeof t[1]){const e=parseFloat(t[1])/100,i=s();n[1]=i.y1+(i.y2-i.y1)*e}else n[1]=t[1];return n}doUpdateLocalMatrix(){const{x:t=Zi.x,y:e=Zi.y,scaleX:i=Zi.scaleX,scaleY:n=Zi.scaleY,angle:s=Zi.angle,scaleCenter:r,anchor:a,postMatrix:o}=this.attribute;let l=[0,0];const h={};if(a&&s&&(l=this.getAnchor(a,h)),!r||1===i&&1===n)!function(t,e,i,n,s,r,a,o){const l=e.a,h=e.b,d=e.c,c=e.d,u=e.e,p=e.f,g=jt(a),f=Vt(a);let v,m;o?(v=o[0],m=o[1]):(v=i,m=n);const b=v-i,y=m-n,x=l*g+d*f,_=h*g+c*f,w=d*g-l*f,T=c*g-h*f;t.a=s*x,t.b=s*_,t.c=r*w,t.d=r*T,t.e=u+l*v+d*m-x*b-w*y,t.f=p+h*v+c*m-_*b-T*y}(this._transMatrix,this._transMatrix.reset(),t,e,i,n,s,a&&l);else{const a=this._transMatrix;a.reset(),a.translate(l[0],l[1]),a.rotate(s),a.translate(-l[0],-l[1]),a.translate(t,e),l=this.getAnchor(r,h,!0),xn.transformUtil.fromMatrix(a,a).scale(i,n,{x:l[0],y:l[1]})}const d=this.getOffsetXY(Zi);if(this._transMatrix.e+=d.x,this._transMatrix.f+=d.y,o){const t=Ma.setValue(o.a,o.b,o.c,o.d,o.e,o.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.timeline===ws&&t.setTimeline(e)}))}this._onSetStage&&this._onSetStage(this,t,e),xn.graphicService.onSetStage(this,t)}}setStageToShadowRoot(t,e){this.shadowRoot&&this.shadowRoot.setStage(t,e)}onAddStep(t){}onStop(t){t&&this.setAttributes(t,!1,{type:Ze.ANIMATE_END})}onStep(t,e,i,n,s){const r={};if(i.customAnimate)i.customAnimate.update(s,n,r);else{const a=i.props,o=i.parsedProps,l=i.propKeys;this.stepInterpolate(t,e,r,i,n,s,a,void 0,o,l)}this.setAttributes(r,!1,{type:Ze.ANIMATE_UPDATE,animationState:{ratio:n,end:s,step:i,isFirstFrameOfStep:t.getLastStep()!==i}}),this.stage&&this.stage.renderNextFrame()}stepInterpolate(t,e,i,n,s,r,a,o,l,h){h||(h=Object.keys(a),n.propKeys=h),r?n.propKeys.forEach((t=>{e.validAttr(t)&&(i[t]=a[t])})):h.forEach((r=>{var h;if(!e.validAttr(r))return;const d=a[r],c=null!==(h=o&&o[r])&&void 0!==h?h:t.getLastPropByName(r,n);if(null==d||null==c||d===c)return void(i[r]=d);let u;u=e.interpolateFunc&&e.interpolateFunc(r,s,c,d,i),u||(u=e.customInterpolate(r,s,c,d,this,i),u||this.defaultInterpolate(d,c,r,i,l,s)||this._interpolate(r,s,c,d,i))})),n.parsedProps=l}defaultInterpolate(t,e,i,n,s,r){if(Number.isFinite(t)&&Number.isFinite(e))return n[i]=e+(t-e)*r,!0;if("fill"===i){s||(s={});const a=s.fillColorArray,o=js(e,null!=a?a:t,r,!1,((t,e)=>{s.fillColorArray=e}));return o&&(n[i]=o),!0}if("stroke"===i){s||(s={});const a=s.strokeColorArray,o=js(e,null!=a?a:t,r,!1,((t,e)=>{s.strokeColorArray=e}));return o&&(n[i]=o),!0}if("shadowColor"===i){s||(s={});const a=s.shadowColorArray,o=js(e,null!=a?a:t,r,!0,((t,e)=>{s.shadowColorArray=e}));return o&&(n[i]=o),!0}if(Array.isArray(t)&&t.length===e.length){const s=[];let a=!0;for(let i=0;i<t.length;i++){const n=e[i],o=n+(t[i]-n)*r;if(!Number.isFinite(o)){a=!1;break}s.push(o)}a&&(n[i]=s)}return!1}_interpolate(t,e,i,n,s){}getDefaultAttribute(t){return this.getGraphicTheme()[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:xn.graphicService.creator.shadowRoot(this),this.addUpdateBoundTag(),this.shadowRoot.setStage(this.stage,this.layer),this.shadowRoot}detachShadow(){this.shadowRoot&&(this.addUpdateBoundTag(),this.shadowRoot.release(!0),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 lt(t,!0)?this.pathProxy=(new Ki).fromString(t):this.pathProxy=new Ki,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 n={data:"init",state:null};this.resources.set(i,n),"string"==typeof t?(n.state="loading",t.startsWith("<svg")?(Ks.GetSvg(t,this),this.backgroundImg=this.backgroundImg||e):(pt(t)||t.includes("/")||gt(t))&&(Ks.GetImage(t,this),this.backgroundImg=this.backgroundImg||e)):st(t)?(n.state="success",n.data=t,this.backgroundImg=this.backgroundImg||e):n.state="fail"}setShadowGraphic(t){t?this.attachShadow().add(t):this.detachShadow()}imageLoadSuccess(t,e,i){if(!this.resources)return;const n=this.resources.get(t);n&&(n.state="success",n.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",this.stopAnimates(),xn.graphicService.onRelease(this)}_emitCustomEvent(t,e){var i,n;if(this._events&&t in this._events){const s=new ds(t,e);s.bubbles=!1,s.manager=null===(n=null===(i=this.stage)||void 0===i?void 0:i.eventSystem)||void 0===n?void 0:n.manager,this.dispatchEvent(s)}}}var Wa;za.userSymbolMap={},za.mixin(ps),function(t){t[t.LESS_GROUP=0]="LESS_GROUP",t[t.MORE_GROUP=1]="MORE_GROUP"}(Wa||(Wa={}));class Ua extends za{constructor(t){super(t),this.type="group",this.parent=null,this.isContainer=!0,this.numberType=_a,this._childUpdateTag=$e.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 es),this.theme.setTheme(t,this)}createTheme(){this.theme||(this.theme=new es)}visibleAll(t){this.setAttribute("visible",t),this.forEachChildren((e=>{e.isContainer&&e.visibleAll?e.visibleAll(t):e.setAttribute("visible",t)}))}hideAll(){this.visibleAll(!1)}showAll(){this.visibleAll(!0)}containsPoint(t,e,i){if(i===qe.GLOBAL){const i=new qt(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&$e.UPDATE_BOUNDS)}tryUpdateAABBBounds(){if(!this.shouldUpdateAABBBounds())return this._AABBBounds;xn.graphicService.beforeUpdateAABBBounds(this,this.stage,!0,this._AABBBounds);const t=this.shouldSelfChangeUpdateAABBBounds(),e=this.doUpdateAABBBounds();return this.addUpdateLayoutTag(),xn.graphicService.afterUpdateAABBBounds(this,this.stage,this._AABBBounds,this,t),"empty"===this.attribute.boundsMode&&e.clear(),e}doUpdateLocalMatrix(){const{x:t=Zi.x,y:e=Zi.y,dx:i=Zi.dx,dy:n=Zi.dy,scaleX:s=Zi.scaleX,scaleY:r=Zi.scaleY,angle:a=Zi.angle,postMatrix:o}=this.attribute;if(0!==t||0!==e||0!==i||0!==n||1!==s||1!==r||0!==a||o)return super.doUpdateLocalMatrix();this._transMatrix.reset()}getGraphicTheme(){return ns(this).group}updateAABBBounds(t,e,i){const n=i;i=i.clone();const{width:s,height:r,path:a,clip:o=e.clip}=t;if(a&&a.length?a.forEach((t=>{i.union(t.AABBBounds)})):null!=s&&null!=r&&i.set(0,0,Math.max(0,s),Math.max(0,r)),!o){this.forEachChildren((t=>{i.union(t.AABBBounds)}));const{scrollX:e=0,scrollY:n=0}=t;i.translate(e,n)}return xn.graphicService.updateTempAABBBounds(i),xn.graphicService.transformAABBBounds(t,i,e,!1,this),n.copy(i),n}doUpdateAABBBounds(){this.updateAABBBoundsStamp++;const t=super.doUpdateAABBBounds();return this.parent&&this.parent.addChildUpdateBoundTag(),this._emitCustomEvent("AAABBBoundsChange"),t}clearUpdateBoundTag(){this._updateTag&=$e.CLEAR_BOUNDS,this._childUpdateTag&=$e.CLEAR_BOUNDS}addUpdateBoundTag(){this._updateTag|=$e.UPDATE_BOUNDS,this.parent&&this.parent.addChildUpdateBoundTag()}addChildUpdateBoundTag(){this._childUpdateTag&$e.UPDATE_BOUNDS||(this._childUpdateTag|=$e.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(),xn.graphicService.onAddIncremental(t,this,this.stage),e}incrementalClearChild(){super.removeAllChild(),this.addUpdateBoundTag(),xn.graphicService.onClearIncremental(this,this.stage)}_updateChildToStage(t){return this.stage&&t&&t.setStage(this.stage,this.layer),this.addUpdateBoundTag(),t}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){return this._updateChildToStage(super.insertBefore(t,e))}insertAfter(t,e){return this._updateChildToStage(super.insertAfter(t,e))}insertInto(t,e){return this._updateChildToStage(super.insertInto(t,e))}removeChild(t){const e=super.removeChild(t);return t.stage=null,xn.graphicService.onRemove(t),this.addUpdateBoundTag(),e}removeAllChild(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];this.forEachChildren((e=>{xn.graphicService.onRemove(e),t&&e.isContainer&&e.removeAllChild(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),xn.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&$e.UPDATE_GLOBAL_MATRIX)}_getChildByName(t,e){return this.find((e=>e.name===t),e)}createOrUpdateChild(t,e,i){let n=this._getChildByName(t);return n?n.setAttributes(e):(n=xn.graphicService.creator[i](e),n.name=t,this.add(n)),n}clone(){return new Ua(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return Ua.NOWORK_ANIMATE_ATTR}release(t){t&&this.forEachChildren((e=>{e.release(t)})),super.release()}}function ja(t){return new Ua(t)}Ua.NOWORK_ANIMATE_ATTR=Ha;class Ga extends Ua{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,n){var s;super({}),this.stage=t,this.global=e,this.window=i,this.main=n.main,this.layerHandler=n.layerHandler,this.layerHandler.init(this,i,{main:n.main,canvasId:n.canvasId,width:this.viewWidth,height:this.viewHeight,zIndex:null!==(s=n.zIndex)&&void 0!==s?s:0}),this.layer=this,this.subLayers=new Map,this.theme=new es,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=>{xn.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;this.layerHandler.render([this],{renderService:t.renderService,stage:this.stage,layer:this,viewBox:t.viewBox,transMatrix:t.transMatrix,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){}release(){super.release(),this.layerHandler.release(),this.subLayers&&this.subLayers.forEach((t=>{xn.layerService.releaseLayer(this.stage,t.layer)}))}drawTo(t,e){var i;this.layerHandler.drawTo(t,[this],Object.assign({background:null!==(i=e.background)&&void 0!==i?i:this.background,renderService:e.renderService,viewBox:e.viewBox,transMatrix:e.transMatrix,stage:this.stage,layer:this},e)),this.afterDrawCbs.forEach((t=>t(this)))}}const Ya=Symbol.for("TransformUtil"),Va=Symbol.for("GraphicUtil"),Xa=Symbol.for("LayerService"),Ka=Symbol.for("StaticLayerHandlerContribution"),$a=Symbol.for("DynamicLayerHandlerContribution"),qa=Symbol.for("VirtualLayerHandlerContribution");var Za,Ja=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Qa=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let to=Za=class{static GenerateLayerId(){return`${Za.idprefix}_${Za.prefix_count++}`}constructor(){this.layerMap=new Map,this.global=xn.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?Pn.get(Ka):"dynamic"===t?Pn.get($a):Pn.get(qa),e}createLayer(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{main:!1};var i;this.tryInit();let n=this.getRecommendedLayerType(e.layerMode);n=e.main||e.canvasId?"static":n;const s=this.getLayerHandler(n),r=new Ga(t,this.global,t.window,Object.assign(Object.assign({main:!1},e),{layerMode:n,canvasId:null!==(i=e.canvasId)&&void 0!==i?i:Za.GenerateLayerId(),layerHandler:s})),a=this.layerMap.get(t)||[];return a.push(r),this.layerMap.set(t,a),this.staticLayerCountInEnv--,r}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}releaseStage(t){this.layerMap.delete(t)}};to.idprefix="visactor_layer",to.prefix_count=0,to=Za=Ja([y(),Qa("design:paramtypes",[])],to);var eo=new a((t=>{t(U).to(K).inSingletonScope(),t(Wn).to(jn),t(Va).to(Xn).inSingletonScope(),t(Ya).to(qn).inSingletonScope(),t(Xa).to(to).inSingletonScope()}));function io(t,e){return!(!t&&!e)}function no(t,e){let i;return i=ht(t)?t.some((t=>t||void 0===t)):!!t,i&&e>0}function so(t,e,i){return i&&t*e>0}function ro(t,e,i,n,s){return s&&t*e>0&&0!==i&&0!==n}function ao(t,e){return t*e>0}function oo(t,e,i,n){return t*e>0&&0!==i&&0!==n}const lo=Symbol.for("AreaRenderContribution"),ho=Symbol.for("GroupRenderContribution"),co=Symbol.for("RectRenderContribution"),uo=Symbol.for("SymbolRenderContribution"),po=Symbol.for("TextRenderContribution"),go=Symbol.for("InteractiveSubRenderContribution");function fo(t,e){return"end"===t||"right"===t?-e:"center"===t?-e/2:0}function vo(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)}function mo(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}function bo(t,e,i){const n=i[0],s=i[1],r=i[2];let a,o,l,h,d,c,u,p,g,f,v,m;return e===t?(t[12]=e[0]*n+e[4]*s+e[8]*r+e[12],t[13]=e[1]*n+e[5]*s+e[9]*r+e[13],t[14]=e[2]*n+e[6]*s+e[10]*r+e[14],t[15]=e[3]*n+e[7]*s+e[11]*r+e[15]):(a=e[0],o=e[1],l=e[2],h=e[3],d=e[4],c=e[5],u=e[6],p=e[7],g=e[8],f=e[9],v=e[10],m=e[11],t[0]=a,t[1]=o,t[2]=l,t[3]=h,t[4]=d,t[5]=c,t[6]=u,t[7]=p,t[8]=g,t[9]=f,t[10]=v,t[11]=m,t[12]=a*n+d*s+g*r+e[12],t[13]=o*n+c*s+f*r+e[13],t[14]=l*n+u*s+v*r+e[14],t[15]=h*n+p*s+m*r+e[15]),t}function yo(t,e,i){const n=e[0],s=e[1],r=e[2],a=e[3],o=e[4],l=e[5],h=e[6],d=e[7],c=e[8],u=e[9],p=e[10],g=e[11],f=e[12],v=e[13],m=e[14],b=e[15];let y=i[0],x=i[1],_=i[2],w=i[3];return t[0]=y*n+x*o+_*c+w*f,t[1]=y*s+x*l+_*u+w*v,t[2]=y*r+x*h+_*p+w*m,t[3]=y*a+x*d+_*g+w*b,y=i[4],x=i[5],_=i[6],w=i[7],t[4]=y*n+x*o+_*c+w*f,t[5]=y*s+x*l+_*u+w*v,t[6]=y*r+x*h+_*p+w*m,t[7]=y*a+x*d+_*g+w*b,y=i[8],x=i[9],_=i[10],w=i[11],t[8]=y*n+x*o+_*c+w*f,t[9]=y*s+x*l+_*u+w*v,t[10]=y*r+x*h+_*p+w*m,t[11]=y*a+x*d+_*g+w*b,y=i[12],x=i[13],_=i[14],w=i[15],t[12]=y*n+x*o+_*c+w*f,t[13]=y*s+x*l+_*u+w*v,t[14]=y*r+x*h+_*p+w*m,t[15]=y*a+x*d+_*g+w*b,t}class xo{constructor(){this.pools=[]}static identity(t){return mo(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 xo.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 _o=new class{constructor(){this.pools=[]}allocate(t,e,i,n,s,r){if(!this.pools.length)return new fe(t,e,i,n,s,r);const a=this.pools.pop();return a.a=t,a.b=e,a.c=i,a.d=n,a.e=s,a.f=r,a}allocateByObj(t){if(!this.pools.length)return new fe(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=[]}},wo=new xo;var To=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},So=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},ko=function(t,e){return function(i,n){e(i,n,t)}};function Bo(t,e,i){var n;const{x:s=i.x,y:r=i.y,z:a=i.z,dx:o=i.dx,dy:l=i.dy,dz:h=i.dz,scaleX:d=i.scaleX,scaleY:c=i.scaleY,scaleZ:u=i.scaleZ,alpha:p=i.alpha,beta:g=i.beta,angle:f=i.angle,anchor3d:v=e.attribute.anchor,anchor:m}=e.attribute,b=[0,0,0];if(v){if("string"==typeof v[0]){const t=parseFloat(v[0])/100,i=e.AABBBounds;b[0]=i.x1+(i.x2-i.x1)*t}else b[0]=v[0];if("string"==typeof v[1]){const t=parseFloat(v[1])/100,i=e.AABBBounds;b[1]=i.x1+(i.x2-i.x1)*t}else b[1]=v[1];b[2]=null!==(n=v[2])&&void 0!==n?n:0}if(mo(t),bo(t,t,[s+o,r+l,a+h]),bo(t,t,[b[0],b[1],b[2]]),function(t,e,i){const n=Math.sin(i),s=Math.cos(i),r=e[4],a=e[5],o=e[6],l=e[7],h=e[8],d=e[9],c=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]=r*s+h*n,t[5]=a*s+d*n,t[6]=o*s+c*n,t[7]=l*s+u*n,t[8]=h*s-r*n,t[9]=d*s-a*n,t[10]=c*s-o*n,t[11]=u*s-l*n}(t,t,g),function(t,e,i){const n=Math.sin(i),s=Math.cos(i),r=e[0],a=e[1],o=e[2],l=e[3],h=e[8],d=e[9],c=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]=r*s-h*n,t[1]=a*s-d*n,t[2]=o*s-c*n,t[3]=l*s-u*n,t[8]=r*n+h*s,t[9]=a*n+d*s,t[10]=o*n+c*s,t[11]=l*n+u*s}(t,t,p),bo(t,t,[-b[0],-b[1],b[2]]),function(t,e,i){const n=i[0],s=i[1],r=i[2];t[0]=e[0]*n,t[1]=e[1]*n,t[2]=e[2]*n,t[3]=e[3]*n,t[4]=e[4]*s,t[5]=e[5]*s,t[6]=e[6]*s,t[7]=e[7]*s,t[8]=e[8]*r,t[9]=e[9]*r,t[10]=e[10]*r,t[11]=e[11]*r,t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]}(t,t,[d,c,u]),f){const i=wo.allocate(),n=[0,0];if(m){if("string"==typeof v[0]){const t=parseFloat(v[0])/100,i=e.AABBBounds;n[0]=i.x1+(i.x2-i.x1)*t}else n[0]=v[0];if("string"==typeof v[1]){const t=parseFloat(v[1])/100,i=e.AABBBounds;n[1]=i.x1+(i.x2-i.x1)*t}else n[1]=v[1]}bo(i,i,[n[0],n[1],0]),function(t,e,i){const n=Math.sin(i),s=Math.cos(i),r=e[0],a=e[1],o=e[2],l=e[3],h=e[4],d=e[5],c=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]=r*s+h*n,t[1]=a*s+d*n,t[2]=o*s+c*n,t[3]=l*s+u*n,t[4]=h*s-r*n,t[5]=d*s-a*n,t[6]=c*s-o*n,t[7]=u*s-l*n}(i,i,f),bo(i,i,[-n[0],-n[1],0]),yo(t,t,i)}}let Ao=class{constructor(t){this.creator=t,this.hooks={onAttributeUpdate:new z(["graphic"]),onSetStage:new z(["graphic","stage"]),onRemove:new z(["graphic"]),onRelease:new z(["graphic"]),onAddIncremental:new z(["graphic","group","stage"]),onClearIncremental:new z(["graphic","group","stage"]),beforeUpdateAABBBounds:new z(["graphic","stage","willUpdate","aabbBounds"]),afterUpdateAABBBounds:new z(["graphic","stage","aabbBounds","globalAABBBounds","selfChange"]),clearAABBBounds:new z(["graphic","stage","aabbBounds"])},this.tempAABBBounds1=new pe,this.tempAABBBounds2=new pe}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,n){this.hooks.beforeUpdateAABBBounds.taps.length&&this.hooks.beforeUpdateAABBBounds.call(t,e,i,n)}afterUpdateAABBBounds(t,e,i,n,s){this.hooks.afterUpdateAABBBounds.taps.length&&this.hooks.afterUpdateAABBBounds.call(t,e,i,n,s)}clearAABBBounds(t,e,i){this.hooks.clearAABBBounds.taps.length&&this.hooks.clearAABBBounds.call(t,e,i)}updatePathProxyAABBBounds(t,e){const i="function"==typeof e.pathProxy?e.pathProxy(e.attribute):e.pathProxy;if(!i)return!1;const n=new Oe(t);return oi(i.commandList,n,0,0),!0}updateHTMLTextAABBBounds(t,e,i,n){const{textAlign:s,textBaseline:r}=t;if(null!=t.forceBoundsHeight){const e=ct(t.forceBoundsHeight)?t.forceBoundsHeight:t.forceBoundsHeight(),n=vo(r,e,e);i.set(i.x1,n,i.x2,n+e)}if(null!=t.forceBoundsWidth){const e=ct(t.forceBoundsWidth)?t.forceBoundsWidth:t.forceBoundsWidth(),n=fo(s,e);i.set(n,i.y1,n+e,i.y2)}}combindShadowAABBBounds(t,e){if(e&&e.shadowRoot){const i=e.shadowRoot.AABBBounds;t.union(i)}}transformAABBBounds(t,e,i,n,s){if(!e.empty()){const{scaleX:s=i.scaleX,scaleY:r=i.scaleY,stroke:a=i.stroke,shadowBlur:o=i.shadowBlur,lineWidth:l=i.lineWidth,pickStrokeBuffer:h=i.pickStrokeBuffer,strokeBoundsBuffer:d=i.strokeBoundsBuffer}=t,c=this.tempAABBBounds1,u=this.tempAABBBounds2;if(a&&l){ca(c,(l+h)/Math.abs(s+r),n,d),e.union(c),c.setValue(u.x1,u.y1,u.x2,u.y2)}if(o){const{shadowOffsetX:n=i.shadowOffsetX,shadowOffsetY:a=i.shadowOffsetY}=t;ca(c,o/Math.abs(s+r)*2,!1,d+1),c.translate(n,a),e.union(c)}}if(this.combindShadowAABBBounds(e,s),e.empty())return;let r=!0;const a=s.transMatrix;s&&s.isContainer&&(r=!(1===a.a&&0===a.b&&0===a.c&&1===a.d&&0===a.e&&0===a.f)),r&&ce(e,e,a)}validCheck(t,e,i,n){if(!n)return!0;if(null!=t.forceBoundsHeight||null!=t.forceBoundsWidth)return!0;if(n.shadowRoot||n.isContainer)return!0;const{visible:s=e.visible}=t;return!(!n.valid||!s)||(i.empty()||(n.parent&&i.transformWithMatrix(n.parent.globalTransMatrix),xn.graphicService.clearAABBBounds(n,n.stage,i),i.clear()),!1)}updateTempAABBBounds(t){const e=this.tempAABBBounds1,i=this.tempAABBBounds2;return e.setValue(t.x1,t.y1,t.x2,t.y2),i.setValue(t.x1,t.y1,t.x2,t.y2),{tb1:e,tb2:i}}};Ao=To([y(),ko(0,m(La)),So("design:paramtypes",[Object])],Ao);const Co=(t,e,i)=>{const{outerBorder:n,shadowBlur:s=e.shadowBlur}=t;if(n){const t=e.outerBorder,{distance:r=t.distance,lineWidth:a=t.lineWidth}=n;i.expand(r+(s+a)/2)}return i},Lo=["radius","startAngle","endAngle",...Pa];class Oo extends za{constructor(){super(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{radius:1}),this.type="circle",this.numberType=xa}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)}getGraphicTheme(){return ns(this).circle}updateAABBBounds(t,e,i,n){this.updatePathProxyAABBBounds(i)||(n?this.updateCircleAABBBoundsImprecise(t,e,i):this.updateCircleAABBBoundsAccurate(t,e,i));const{tb1:s,tb2:r}=xn.graphicService.updateTempAABBBounds(i);return Co(t,e,s),i.union(s),s.setValue(r.x1,r.y1,r.x2,r.y2),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1,xn.graphicService.transformAABBBounds(t,i,e,!1,this),i}updateCircleAABBBoundsImprecise(t,e,i){const{radius:n=e.radius}=t;return i.set(-n,-n,n,n),i}updateCircleAABBBoundsAccurate(t,e,i){const{startAngle:n=e.startAngle,endAngle:s=e.endAngle,radius:r=e.radius}=t;return s-n>zt-It?i.set(-r,-r,r,r):function(t,e,i,n){for(;t>=zt;)t-=zt;for(;t<0;)t+=zt;for(;t>e;)e+=zt;Rs[0].x=i,Rs[1].y=i,Rs[2].x=-i,Rs[3].y=-i;const s=Math.ceil(t/Nt)%4,r=Math.ceil(e/Nt)%4;if(n.add(jt(t)*i,Vt(t)*i),n.add(jt(e)*i,Vt(e)*i),s!==r||e-t>Ft){let t=!1;for(let e=0;e<Ms.length;e++)if(t||s!==Ms[e]){if(t&&r===Ms[e])break;if(t){const t=Rs[Ms[e]];n.add(t.x,t.y)}}else{t=!0;const e=Rs[s];n.add(e.x,e.y)}}}(n,s,r,i),i}needUpdateTags(t){return super.needUpdateTags(t,Lo)}needUpdateTag(t){return super.needUpdateTag(t,Lo)}toCustomPath(){var t,e,i;const n=this.attribute,s=null!==(t=n.radius)&&void 0!==t?t:this.getDefaultAttribute("radius"),r=null!==(e=n.startAngle)&&void 0!==e?e:this.getDefaultAttribute("startAngle"),a=null!==(i=n.endAngle)&&void 0!==i?i:this.getDefaultAttribute("endAngle"),o=new Ki;return o.arc(0,0,s,r,a),o}clone(){return new Oo(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return Oo.NOWORK_ANIMATE_ATTR}}Oo.NOWORK_ANIMATE_ATTR=Ha;class Eo{constructor(t,e,i){this.fontFamily=t,this.textOptions=e,this.textMeasure=i}LayoutBBox(t,e,i,n){if(t.xOffset="left"===e||"start"===e?0:"center"===e?t.width/-2:"right"===e||"end"===e?-t.width:0,"top"===i)t.yOffset=0;else if("middle"===i)t.yOffset=t.height/-2;else if("alphabetic"===i){let e=.79;if(1===n.length){const t=n[0];e=t.ascent/(t.ascent+t.descent)}t.yOffset=t.height*-e}else t.yOffset=-t.height;return t}GetLayoutByLines(t,e,i,n){let s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:"",r=arguments.length>5?arguments[5]:void 0,a=arguments.length>6?arguments[6]:void 0;const{lineWidth:o,suffixPosition:l="end",measureMode:h=$.actualBounding,keepCenterInLine:d=!1}=null!=a?a:{};t=t.map((t=>t.toString()));const c=[],u=[0,0];if("number"==typeof o&&o!==1/0){let e;for(let i=0,n=t.length;i<n;i++){const n=this.textMeasure.measureTextPixelADscentAndWidth(t[i],this.textOptions,h);let a=t[i].toString();if(n.width>o){const n=this.textMeasure.clipTextWithSuffix(t[i],this.textOptions,o,s,r,l);a=n.str,e=n.width}else e=n.width;c.push({str:a,width:e,ascent:n.ascent,descent:n.descent,keepCenterInLine:d})}u[0]=o}else{let e,i,n=0;for(let s=0,r=t.length;s<r;s++){i=t[s];const r=this.textMeasure.measureTextPixelADscentAndWidth(t[s],this.textOptions,h);e=r.width,n=Math.max(n,e),c.push({str:i,width:e,ascent:r.ascent,descent:r.descent,keepCenterInLine:d})}u[0]=n}u[1]=c.length*n,u[0]=c.reduce(((t,e)=>Math.max(t,e.width)),0);const p={xOffset:0,yOffset:0,width:u[0],height:u[1]};return this.LayoutBBox(p,e,i,c),this.layoutWithBBox(p,c,e,i,n)}layoutWithBBox(t,e,i,n,s){const r=[0,0],a=e.length*s;"top"===n||("middle"===n?r[1]=(t.height-a)/2:"bottom"===n&&(r[1]=t.height-a));for(let a=0;a<e.length;a++)this.lineOffset(t,e[a],i,n,s,r);return{bbox:t,lines:e,fontFamily:this.fontFamily,fontSize:this.textOptions.fontSize,fontWeight:this.textOptions.fontWeight,lineHeight:s,textAlign:i,textBaseline:n}}lineOffset(t,e,i,n,s,r){if("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=s/2+(e.ascent-e.descent)/2+r[1],!e.keepCenterInLine){const t=0,i=e.ascent+e.descent+t;if(i<s-t&&("bottom"===n?e.topOffset+=(s-i)/2:"top"===n&&(e.topOffset-=(s-i)/2)),"alphabetic"===n){const t=s/(e.ascent+e.descent);e.topOffset=s/2+(e.ascent-e.descent)/2*t+r[1]}}return r[1]+=s,e}}const Ro=["text","maxLineWidth","maxWidth","textAlign","textBaseline","heightLimit","lineClamp","fontSize","fontFamily","fontWeight","ellipsis","lineHeight","direction","wordBreak","heightLimit","lineClamp",...Pa];class Mo extends za{get font(){const t=this.getGraphicTheme();return this._font||(this._font=he(this.attribute,t)),this._font}get clipedText(){var t;const e=this.attribute,i=this.getGraphicTheme(),n=this.getMaxWidth(i);return Number.isFinite(n)?(this.tryUpdateAABBBounds(),this.cache.clipedText):(null!==(t=e.text)&&void 0!==t?t:i.text).toString()}get clipedWidth(){return this.tryUpdateAABBBounds(),this.cache.clipedWidth}get cliped(){var t,e;const i=this.getGraphicTheme(),n=this.attribute,s=this.getMaxWidth(i);if(!Number.isFinite(s))return!1;const{text:r}=this.attribute;if(this.tryUpdateAABBBounds(),null===(e=null===(t=this.cache)||void 0===t?void 0:t.layoutData)||void 0===e?void 0:e.lines){let t="";return this.cache.layoutData.lines.forEach((e=>{t+=e.str})),(Array.isArray(r)?r.join(""):r)!==t}return"vertical"===n.direction&&this.cache.verticalList&&this.cache.verticalList[0]?this.cache.verticalList[0].map((t=>t.text)).join("")!==n.text.toString():null!=this.clipedText&&this.clipedText!==n.text.toString()}get multilineLayout(){return this.tryUpdateAABBBounds(),this.cache.layoutData}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=Aa,this.cache={}}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{text:t}=this.attribute;return ht(t)?!t.every((t=>null==t||""===t)):null!=t&&""!==t}getGraphicTheme(){return ns(this).text}doUpdateOBBBounds(){const t=this.getGraphicTheme();this._OBBBounds.clear();const e=this.attribute,{angle:i=t.angle}=e;if(!i){const t=this.AABBBounds;return this._OBBBounds.setValue(t.x1,t.y1,t.x2,t.y2),this._OBBBounds}this.obbText||(this.obbText=new Mo({})),this.obbText.setAttributes(Object.assign(Object.assign({},e),{angle:0}));const n=this.obbText.AABBBounds,{x:s,y:r}=e,a={x:(n.x1+n.x2)/2,y:(n.y1+n.y2)/2},o=re(a,i,{x:s,y:r});return this._OBBBounds.copy(n),this._OBBBounds.translate(o.x-a.x,o.y-a.y),this._OBBBounds.angle=i,this._OBBBounds}updateAABBBounds(t,e,i){const{text:n=e.text}=this.attribute;Array.isArray(n)?this.updateMultilineAABBBounds(n):this.updateSingallineAABBBounds(n);const{tb1:s}=xn.graphicService.updateTempAABBBounds(i),{scaleX:r=e.scaleX,scaleY:a=e.scaleY,shadowBlur:o=e.shadowBlur,strokeBoundsBuffer:l=e.strokeBoundsBuffer}=t;if(o){ca(s,o/Math.abs(r+a),!0,l),i.union(s)}return xn.graphicService.combindShadowAABBBounds(i,this),null==t.forceBoundsHeight&&null==t.forceBoundsWidth||xn.graphicService.updateHTMLTextAABBBounds(t,e,i),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1,ce(i,i,this.transMatrix),i}updateSingallineAABBBounds(t){this.updateMultilineAABBBounds([t]);const e=this.cache.layoutData;if(e&&e.lines&&e.lines.length){const t=e.lines[0];this.cache.clipedText=t.str,this.cache.clipedWidth=t.width}return this._AABBBounds}updateMultilineAABBBounds(t){const e=this.getGraphicTheme(),{direction:i=e.direction,underlineOffset:n=e.underlineOffset}=this.attribute,s="horizontal"===i?this.updateHorizontalMultilineAABBBounds(t):this.updateVerticalMultilineAABBBounds(t);return"horizontal"===i&&n&&this._AABBBounds.add(this._AABBBounds.x1,this._AABBBounds.y2+n),s}guessLineHeightBuf(t){return t?.1*t:0}updateHorizontalMultilineAABBBounds(t){var e;const i=this.getGraphicTheme(),n=this.attribute,{fontFamily:s=i.fontFamily,textAlign:r=i.textAlign,textBaseline:a=i.textBaseline,fontSize:o=i.fontSize,fontWeight:l=i.fontWeight,ellipsis:h=i.ellipsis,maxLineWidth:d,stroke:c=i.stroke,wrap:u=i.wrap,measureMode:p=i.measureMode,lineWidth:g=i.lineWidth,whiteSpace:f=i.whiteSpace,suffixPosition:v=i.suffixPosition,ignoreBuf:m=i.ignoreBuf,keepCenterInLine:b=i.keepCenterInLine}=n,y=m?0:this.guessLineHeightBuf(o),x=this.getLineHeight(n,i,y);if("normal"===f||u)return this.updateWrapAABBBounds(t);if(!this.shouldUpdateShape()&&(null===(e=this.cache)||void 0===e?void 0:e.layoutData)){const t=this.cache.layoutData.bbox;return this._AABBBounds.set(t.xOffset,t.yOffset,t.xOffset+t.width,t.yOffset+t.height),c&&this._AABBBounds.expand(g/2),this._AABBBounds}const _=xn.graphicUtil.textMeasure,w=new Eo(s,{fontSize:o,fontWeight:l,fontFamily:s,lineHeight:x},_).GetLayoutByLines(t,r,a,x,!0===h?i.ellipsis:h||void 0,!1,{lineWidth:d,suffixPosition:v,measureMode:p,keepCenterInLine:b}),{bbox:T}=w;return this.cache.layoutData=w,this.clearUpdateShapeTag(),this._AABBBounds.set(T.xOffset,T.yOffset,T.xOffset+T.width,T.yOffset+T.height),c&&this._AABBBounds.expand(g/2),this._AABBBounds}updateWrapAABBBounds(t){var e,i,n;const s=this.getGraphicTheme(),{fontFamily:r=s.fontFamily,textAlign:a=s.textAlign,textBaseline:o=s.textBaseline,fontSize:l=s.fontSize,ellipsis:h=s.ellipsis,maxLineWidth:d,stroke:c=s.stroke,lineWidth:u=s.lineWidth,wordBreak:p=s.wordBreak,fontWeight:g=s.fontWeight,ignoreBuf:f=s.ignoreBuf,measureMode:v=s.measureMode,suffixPosition:m=s.suffixPosition,heightLimit:b=0,lineClamp:y,keepCenterInLine:x=s.keepCenterInLine}=this.attribute,_=f?0:this.guessLineHeightBuf(l),w=this.getLineHeight(this.attribute,s,_);if(!this.shouldUpdateShape()&&(null===(e=this.cache)||void 0===e?void 0:e.layoutData)){const t=this.cache.layoutData.bbox;return this._AABBBounds.set(t.xOffset,t.yOffset,t.xOffset+t.width,t.yOffset+t.height),c&&this._AABBBounds.expand(u/2),this._AABBBounds}const T=xn.graphicUtil.textMeasure,S={fontSize:l,fontWeight:g,fontFamily:r,lineHeight:w},k=new Eo(r,S,T),B=ht(t)?t.map((t=>t.toString())):[t.toString()],A=[],C=[0,0];let L=1/0;if(b>0&&(L=Math.max(Math.floor(b/w),1)),y&&(L=Math.min(L,y)),"number"==typeof d&&d!==1/0){if(d>0)for(let t=0;t<B.length;t++){const e=B[t];let s=!0;if(t===L-1){const i=T.clipTextWithSuffix(e,S,d,h,!1,m,t!==B.length-1),n=T.measureTextPixelADscentAndWidth(i.str,S,v);A.push({str:i.str,width:i.width,ascent:n.ascent,descent:n.descent,keepCenterInLine:x});break}const r=T.clipText(e,S,d,"break-all"!==p,"keep-all"===p);if(""!==e&&""===r.str||r.wordBreaked){if(h){const t=T.clipTextWithSuffix(e,S,d,h,!1,m);r.str=null!==(i=t.str)&&void 0!==i?i:"",r.width=null!==(n=t.width)&&void 0!==n?n:0}else r.str="",r.width=0;s=!1}const a=T.measureTextPixelADscentAndWidth(r.str,S,v);A.push({str:r.str,width:r.width,ascent:a.ascent,descent:a.descent,keepCenterInLine:x});let o=r.str.length;if(!r.wordBreaked||""!==e&&""===r.str||(s=!0,o=r.wordBreaked),r.str.length===e.length);else if(s){let i=e.substring(o);"keep-all"===p&&(i=i.replace(/^\s+/g,"")),B.splice(t+1,0,i)}}let t=0;A.forEach((e=>{t=Math.max(t,e.width)})),C[0]=t}else{let t,e,i=0;for(let n=0,s=B.length;n<s;n++){if(n===L-1){const t=T.clipTextWithSuffix(B[n],S,d,h,!1,m),e=T.measureTextPixelADscentAndWidth(t.str,S,v);A.push({str:t.str,width:t.width,ascent:e.ascent,descent:e.descent,keepCenterInLine:x}),i=Math.max(i,t.width);break}e=B[n],t=T.measureTextWidth(e,S),i=Math.max(i,t);const s=T.measureTextPixelADscentAndWidth(e,S,v);A.push({str:e,width:t,ascent:s.ascent,descent:s.descent,keepCenterInLine:x})}C[0]=i}C[1]=A.length*w;const O={xOffset:0,yOffset:0,width:C[0],height:C[1]};k.LayoutBBox(O,a,o,A);const E=k.layoutWithBBox(O,A,a,o,w);return this.cache.layoutData=E,this.clearUpdateShapeTag(),this._AABBBounds.set(O.xOffset,O.yOffset,O.xOffset+O.width,O.yOffset+O.height),c&&this._AABBBounds.expand(u/2),this._AABBBounds}updateVerticalMultilineAABBBounds(t){var e,i;const n=this.getGraphicTheme(),s=xn.graphicUtil.textMeasure;let r;const a=this.attribute,{maxLineWidth:o=n.maxLineWidth,ellipsis:l=n.ellipsis,fontFamily:h=n.fontFamily,fontSize:d=n.fontSize,fontWeight:c=n.fontWeight,stroke:u=n.stroke,lineWidth:p=n.lineWidth,verticalMode:g=n.verticalMode,suffixPosition:f=n.suffixPosition}=a,v=this.getLineHeight(a,n,0);let{textAlign:m=n.textAlign,textBaseline:b=n.textBaseline}=a;if(!g){const t=m;m=null!==(e=Mo.baselineMapAlign[b])&&void 0!==e?e:"left",b=null!==(i=Mo.alignMapBaseline[t])&&void 0!==i?i:"top"}if(r=0,!this.shouldUpdateShape()&&this.cache){this.cache.verticalList.forEach((t=>{const e=t.reduce(((t,e)=>t+e.width),0);r=Gt(e,r)}));const t=fo(m,r),e=this.cache.verticalList.length*v,i=vo(b,e,d);return this._AABBBounds.set(i,t,i+e,t+r),u&&this._AABBBounds.expand(p/2),this._AABBBounds}const y=t.map((t=>function(t){const e=[];let i=0,n="";for(let s=0;s<t.length;s++)ma(t[s])?i?n+=t[s]:(i=1,n=t[s]):(i&&(e.push({text:n,direction:ga.VERTICAL}),n="",i=0),e.push({text:t[s],direction:ga.HORIZONTAL}));return n&&e.push({text:n,direction:ga.VERTICAL}),e}(t.toString())));y.forEach(((t,e)=>{if(Number.isFinite(o))if(l){const i=!0===l?n.ellipsis:l,a=s.clipTextWithSuffixVertical(t,{fontSize:d,fontWeight:c,fontFamily:h},o,i,!1,f);y[e]=a.verticalList,r=a.width}else{const i=s.clipTextVertical(t,{fontSize:d,fontWeight:c,fontFamily:h},o,!1);y[e]=i.verticalList,r=i.width}else r=0,t.forEach((t=>{const e=t.direction===ga.HORIZONTAL?d:s.measureTextWidth(t.text,{fontSize:d,fontWeight:c,fontFamily:h});r+=e,t.width=e}))})),this.cache.verticalList=y,this.clearUpdateShapeTag(),this.cache.verticalList.forEach((t=>{const e=t.reduce(((t,e)=>t+e.width),0);r=Gt(e,r)}));const x=fo(m,r),_=this.cache.verticalList.length*v,w=vo(b,_,d);return this._AABBBounds.set(w,x,w+_,x+r),u&&this._AABBBounds.expand(p/2),this._AABBBounds}getMaxWidth(t){var e,i;const n=this.attribute;return null!==(i=null!==(e=n.maxLineWidth)&&void 0!==e?e:n.maxWidth)&&void 0!==i?i:t.maxWidth}getLineHeight(t,e,i){var n;return null!==(n=Fs(t.lineHeight,t.fontSize||e.fontSize))&&void 0!==n?n:(t.fontSize||e.fontSize)+i}needUpdateTags(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Ro;return super.needUpdateTags(t,e)}needUpdateTag(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Ro;return super.needUpdateTag(t,e)}_interpolate(t,e,i,n,s){"text"===t&&(s.text=n)}clone(){return new Mo(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return Mo.NOWORK_ANIMATE_ATTR}getBaselineMapAlign(){return Mo.baselineMapAlign}getAlignMapBaseline(){return Mo.alignMapBaseline}}function Po(t){return new Mo(t)}Mo.NOWORK_ANIMATE_ATTR=Object.assign({ellipsis:1,wordBreak:1,direction:1,textAlign:1,textBaseline:1,fontFamily:1,fontWeight:1},Ha),Mo.baselineMapAlign={top:"left",bottom:"right",middle:"center"},Mo.alignMapBaseline={left:"top",right:"bottom",center:"middle"};const Do=["symbolType","size",...Pa];let Io=class t extends za{constructor(){super(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{symbolType:"circle"}),this.type="symbol",this.numberType=Ba}getParsedPath(){return this.shouldUpdateShape()&&(this._parsedPath=this.doUpdateParsedPath(),this.clearUpdateShapeTag()),this._parsedPath}getParsedPath2D(){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]:1,n=null;try{n=new Path2D}catch(t){return null}const s=this.getParsedPath();if(!s)return null;s.draw(n,i,t,e)}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{size:t}=this.attribute;return ht(t)?2===t.length&&t.every(this._validNumber):this._validNumber(t)}doUpdateParsedPath(){const{symbolType:t="circle"}=this.attribute;return super.parsePath(t)}getGraphicTheme(){return ns(this).symbol}updateAABBBounds(t,e,i,n){this.updatePathProxyAABBBounds(i)||(n?this.updateSymbolAABBBoundsImprecise(t,e,i):this.updateSymbolAABBBoundsAccurate(t,e,i));const{tb1:s,tb2:r}=xn.graphicService.updateTempAABBBounds(i);((t,e,i)=>{const{outerBorder:n,shadowBlur:s=e.shadowBlur,strokeBoundsBuffer:r=e.strokeBoundsBuffer}=t;if(n){const t=e.outerBorder,{distance:a=t.distance,lineWidth:o=t.lineWidth}=n;ca(i,a+(s+o)/2,!0,r)}})(t,e,s),i.union(s),s.setValue(r.x1,r.y1,r.x2,r.y2),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1,this.x1WithoutTransform=i.x1,this.y1WithoutTransform=i.y1;const{lineJoin:a=e.lineJoin}=t;return xn.graphicService.transformAABBBounds(t,i,e,"miter"===a,this),i}updateSymbolAABBBoundsImprecise(t,e,i){const{size:n=e.size}=t;if(ht(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){const{size:n=e.size}=t;return this.getParsedPath().bounds(n,i),i}needUpdateTags(t){return super.needUpdateTags(t,Do)}needUpdateTag(t){return super.needUpdateTag(t,Do)}toCustomPath(){const t=this.getParsedPath(),e=this.attribute.size,i=ht(e)?e:[e,e];return t.path?(new Ki).fromCustomPath2D(t.path,0,0,i[0],i[1]):(new Ki).fromString(t.pathStr,0,0,i[0],i[1])}clone(){return new t(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return t.NOWORK_ANIMATE_ATTR}};function Fo(t){return new Io(t)}Io.NOWORK_ANIMATE_ATTR=Object.assign({symbolType:1},Ha);const No=["segments","points","curveType","curveTension",...Pa];class Ho extends za{constructor(){super(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}),this.type="line",this.numberType=Ta}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,n,s){"points"===t&&(s.points=Ds(i,n,e))}getGraphicTheme(){return ns(this).line}updateAABBBounds(t,e,i){this.updatePathProxyAABBBounds(i)||(t.segments?this.updateLineAABBBoundsBySegments(t,e,i):this.updateLineAABBBoundsByPoints(t,e,i)),xn.graphicService.updateTempAABBBounds(i),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1;const{lineJoin:n=e.lineJoin}=t;return xn.graphicService.transformAABBBounds(t,i,e,"miter"===n,this),i}updateLineAABBBoundsByPoints(t,e,i,n){const{points:s=e.points,connectedType:r}=t,a=i;return s.forEach((t=>{!1===t.defined&&"connect"!==r||a.add(t.x,t.y)})),a}updateLineAABBBoundsBySegments(t,e,i,n){const{segments:s=e.segments,connectedType:r}=t,a=i;return s.forEach((t=>{t.points.forEach((t=>{!1===t.defined&&"connect"!==r||a.add(t.x,t.y)}))})),a}needUpdateTags(t){return super.needUpdateTags(t,No)}needUpdateTag(t){return super.needUpdateTag(t,No)}toCustomPath(){const t=this.attribute,e=new Ki,i=t.segments,n=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=>{n(t.points)})):t.points&&n(t.points),e}clone(){return new Ho(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return Ho.NOWORK_ANIMATE_ATTR}}function zo(t){return new Ho(t)}Ho.NOWORK_ANIMATE_ATTR=Object.assign({segments:1,curveType:1},Ha);const Wo=["width","x1","y1","height","cornerRadius",...Pa];class Uo extends za{constructor(t){super(t),this.type="rect",this.numberType=ka}isValid(){return super.isValid()&&this._isValid()}_isValid(){return!0}getGraphicTheme(){return ns(this).rect}updateAABBBounds(t,e,i){if(!this.updatePathProxyAABBBounds(i)){let{width:e,height:n}=t;const{x1:s,y1:r,x:a,y:o}=t;e=null!=e?e:s-a,n=null!=n?n:r-o,(isFinite(e)||isFinite(n)||isFinite(a)||isFinite(o))&&i.set(0,0,e||0,n||0)}const{tb1:n,tb2:s}=xn.graphicService.updateTempAABBBounds(i);return Co(t,e,n),i.union(n),n.setValue(s.x1,s.y1,s.x2,s.y2),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1,xn.graphicService.transformAABBBounds(t,i,e,!1,this),i}needUpdateTags(t){return super.needUpdateTags(t,Wo)}needUpdateTag(t){return super.needUpdateTag(t,Wo)}toCustomPath(){const t=this.attribute,{x:e,y:i,width:n,height:s}=(t=>{if(!t)return{x:0,y:0,width:0,height:0};let e=it(t.width)?t.x1-t.x:t.width,i=it(t.height)?t.y1-t.y:t.height,n=0,s=0;return e<0?(n=e,e=-e):Number.isNaN(e)&&(e=0),i<0?(s=i,i=-i):Number.isNaN(i)&&(i=0),{x:n,y:s,width:e,height:i}})(t),r=new Ki;return r.moveTo(e,i),r.rect(e,i,n,s),r}clone(){return new Uo(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return Uo.NOWORK_ANIMATE_ATTR}}function jo(t){return new Uo(t)}Uo.NOWORK_ANIMATE_ATTR=Ha;const Go=["width","height","image",...Pa];class Yo extends za{constructor(t){super(t),this.type="image",this.numberType=wa,this.loadImage(this.attribute.image)}getImageElement(){const{image:t}=this.attribute;if(!t||!this.resources)return null;const e=this.resources.get(t);return"success"!==e.state?null:e.data}get width(){return this.tryUpdateAABBBounds(),this._actualWidth}get height(){return this.tryUpdateAABBBounds(),this._actualHeight}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()})),this.addUpdateBoundTag()}imageLoadFail(t,e){super.imageLoadFail(t,(()=>{this.failCallback&&this.failCallback()}))}setAttributes(t,e,i){return t.image&&this.loadImage(t.image),super.setAttributes(t,e,i)}setAttribute(t,e,i,n){return"image"===t&&this.loadImage(e),super.setAttribute(t,e,i,n)}getGraphicTheme(){return ns(this).image}updateAABBBounds(t,e,i){if(!this.updatePathProxyAABBBounds(i)){const{maxWidth:n=e.maxWidth,maxHeight:s=e.maxHeight}=t;let{width:r,height:a}=t;if(null==r||null==a){const t=this.getImageElement();if(t){const e=t.width,i=t.height;if(null!=r)a=r*(i/e);else if(null!=a)r=a*(e/i);else{const t=e/i;t>n/s?(r=n,a=n/t):(a=s,r=s*t)}}else r=n,a=s}this._actualWidth=r,this._actualHeight=a,i.set(0,0,r,a)}const{tb1:n,tb2:s}=xn.graphicService.updateTempAABBBounds(i);return Co(t,e,n),i.union(n),n.setValue(s.x1,s.y1,s.x2,s.y2),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1,xn.graphicService.transformAABBBounds(t,i,e,!1,this),i}getDefaultAttribute(t){return bn[t]}needUpdateTags(t){return super.needUpdateTags(t,Go)}needUpdateTag(t){return super.needUpdateTag(t,Go)}clone(){return new Yo(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return Yo.NOWORK_ANIMATE_ATTR}}Yo.NOWORK_ANIMATE_ATTR=Object.assign({image:1,repeatX:1,repeatY:1},Ha);const Vo=["points","cornerRadius",...Pa];class Xo extends za{constructor(t){super(t),this.type="polygon",this.numberType=Sa}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{points:t}=this.attribute;return t&&t.length>=2}getGraphicTheme(){return ns(this).polygon}updateAABBBounds(t,e,i){this.updatePathProxyAABBBounds(i)||this.updatePolygonAABBBoundsImprecise(t,e,i),xn.graphicService.updateTempAABBBounds(i),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1;const{lineJoin:n=e.lineJoin}=t;return xn.graphicService.transformAABBBounds(t,i,e,"miter"===n,this),i}updatePolygonAABBBoundsImprecise(t,e,i){const{points:n=e.points}=t;return n.forEach((t=>{i.add(t.x,t.y)})),i}_interpolate(t,e,i,n,s){"points"===t&&(s.points=Ds(i,n,e))}needUpdateTags(t){return super.needUpdateTags(t,Vo)}needUpdateTag(t){return super.needUpdateTag(t,Vo)}toCustomPath(){const t=this.attribute.points,e=new Ki;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 Xo(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return Xo.NOWORK_ANIMATE_ATTR}}Xo.NOWORK_ANIMATE_ATTR=Ha;const Ko=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 $o;var qo=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Zo=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Jo=function(t,e){return function(i,n){e(i,n,t)}};class Qo{constructor(){this.time=ni.beforeFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,n,s,r,a,o,l,h,d,c,u){var p;const{background:g,backgroundOpacity:f=(null!==(p=t.attribute.fillOpacity)&&void 0!==p?p:l.backgroundOpacity),opacity:v=l.opacity,backgroundMode:m=l.backgroundMode,backgroundFit:b=l.backgroundFit,backgroundKeepAspectRatio:y=l.backgroundKeepAspectRatio,backgroundScale:x=l.backgroundScale,backgroundOffsetX:_=l.backgroundOffsetX,backgroundOffsetY:w=l.backgroundOffsetY,backgroundClip:T=l.backgroundClip}=t.attribute;if(g)if(t.backgroundImg&&t.resources){const s=t.resources.get(g);if("success"!==s.state||!s.data)return;if(e.save(),t.parent&&!t.transMatrix.onlyTranslate()){const i=ns(t.parent).group,{scrollX:n=i.scrollX,scrollY:s=i.scrollY}=t.parent.attribute;e.setTransformFromMatrix(t.parent.globalTransMatrix,!0),e.translate(n,s)}T&&e.clip();const r=t.AABBBounds;e.setCommonStyle(t,t.attribute,i,n,l),e.globalAlpha=f*v,this.doDrawImage(e,s.data,r,{backgroundMode:m,backgroundFit:b,backgroundKeepAspectRatio:y,backgroundScale:x,backgroundOffsetX:_,backgroundOffsetY:w}),e.restore(),t.transMatrix.onlyTranslate()||e.setTransformForCurrent()}else e.highPerformanceSave(),e.setCommonStyle(t,t.attribute,i,n,l),e.globalAlpha=f*v,e.fillStyle=g,e.fill(),e.highPerformanceRestore()}doDrawImage(t,e,i,n){const{backgroundMode:s,backgroundFit:r,backgroundKeepAspectRatio:a,backgroundScale:o=1,backgroundOffsetX:l=0,backgroundOffsetY:h=0}=n,d=i.width(),c=i.height();let u=d,p=c;if("no-repeat"===s)if(r)if(a){const n=Math.max(d/e.width,c/e.height);t.drawImage(e,i.x1+l,i.y1+h,e.width*n*o,e.height*n*o)}else t.drawImage(e,i.x1,i.y1,i.width(),i.height());else{const n=e.width*o,s=e.height*o;t.drawImage(e,i.x1+l,i.y1+h,n,s)}else{if(r&&"repeat"!==s&&(e.width||e.height)){const i=e.width,n=e.height;"repeat-x"===s?(u=i*(c/n),p=c):"repeat-y"===s&&(p=n*(d/i),u=d);const r=t.dpr,a=Nn.allocate({width:u,height:p,dpr:r}),o=a.getContext("2d");o&&(o.inuse=!0,o.clearMatrix(),o.setTransformForCurrent(!0),o.clearRect(0,0,u,p),o.drawImage(e,0,0,u,p),e=a.nativeCanvas),Nn.free(a)}const n=t.dpr,a=t.createPattern(e,s);a.setTransform&&a.setTransform(new DOMMatrix([1/n,0,0,1/n,0,0])),t.fillStyle=a,t.translate(i.x1,i.y1),t.fillRect(0,0,d,c),t.translate(-i.x1,-i.y1)}}}const tl=new Qo;let el=class{constructor(t){this.subRenderContribitions=t,this.time=ni.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,n,s,r,a,o,l,h,d,c,u){this._subRenderContribitions||(this._subRenderContribitions=this.subRenderContribitions.getContributions()),this._subRenderContribitions.forEach((p=>{p.render(t,e,i,n,s,r,a,o,l,h,d,c,u)}))}};el=qo([y(),Jo(0,m(D)),Jo(0,x(go)),Zo("design:paramtypes",[Object])],el);const il=new class{constructor(){this.time=ni.beforeFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,n,s,r,a,o,l,h,d,c,u){var p,g;const{clipConfig:f}=t.attribute;if(!f)return;const v=t.getClipPath();if(!v)return;const m=!(d||c),b=t.AABBBounds,y=null!==(p=t.attribute.width)&&void 0!==p?p:b.width(),x=null!==(g=t.attribute.height)&&void 0!==g?g:b.height();m&&e.save(),e.beginPath(),!1===v.draw(e,[y,x],i+y/2,n+x/2,0)&&e.closePath(),d&&d(e,t.attribute,l,!0),m&&e.clip()}};const nl=new class{constructor(){this.time=ni.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,n,s,r,a,o,l,h,d,c,u){const{clipConfig:p}=t.attribute;p&&t.getClipPath()&&(d||c||e.restore())}};class sl{constructor(){this.time=ni.afterFillStroke,this.useStyle=!0,this.order=10,this._tempSymbolGraphic=null}createCommonPattern(t,e,i,n,s){const r=(t-2*e)/2,a=n.dpr,o=Nn.allocate({width:t,height:t,dpr:a}),l=o.getContext("2d");if(!l)return null;l.inuse=!0,l.clearMatrix(),l.setTransformForCurrent(!0),l.clearRect(0,0,t,t),s(r,l);const h=n.createPattern(o.nativeCanvas,"repeat");return h.setTransform&&h.setTransform(new DOMMatrix([1/a,0,0,1/a,0,0])),Nn.free(o),h}createCirclePattern(t,e,i,n){return this.createCommonPattern(t,e,i,n,((t,e)=>{e.fillStyle=i,e.arc(t,t,t,0,zt),e.fill()}))}createDiamondPattern(t,e,i,n){return this.createCommonPattern(t,e,i,n,((e,n)=>{const s=t/2,r=s;n.fillStyle=i,n.moveTo(s,r-e),n.lineTo(e+s,r),n.lineTo(s,r+e),n.lineTo(s-e,r),n.closePath(),n.fill()}))}createRectPattern(t,e,i,n){return this.createCommonPattern(t,e,i,n,((t,n)=>{const s=e,r=s;n.fillStyle=i,n.fillRect(s,r,2*t,2*t)}))}createVerticalLinePattern(t,e,i,n){return this.createCommonPattern(t,e,i,n,((n,s)=>{const r=e;s.fillStyle=i,s.fillRect(r,0,2*n,t)}))}createHorizontalLinePattern(t,e,i,n){return this.createCommonPattern(t,e,i,n,((n,s)=>{const r=e;s.fillStyle=i,s.fillRect(0,r,t,2*n)}))}createBiasLRLinePattern(t,e,i,n){return this.createCommonPattern(t,e,i,n,((e,n)=>{n.strokeStyle=i,n.lineWidth=e,n.moveTo(0,0),n.lineTo(t,t);const s=t/2,r=-s;n.moveTo(s,r),n.lineTo(s+t,r+t),n.moveTo(-s,-r),n.lineTo(-s+t,-r+t),n.stroke()}))}createBiasRLLinePattern(t,e,i,n){return this.createCommonPattern(t,e,i,n,((e,n)=>{n.strokeStyle=i,n.lineWidth=e,n.moveTo(t,0),n.lineTo(0,t);const s=t/2,r=s;n.moveTo(t+s,r),n.lineTo(s,r+t),n.moveTo(t-s,-r),n.lineTo(-s,-r+t),n.stroke()}))}createGridPattern(t,e,i,n){return this.createCommonPattern(t,e,i,n,((t,n)=>{const s=e,r=s;n.fillStyle=i,n.fillRect(s,r,t,t),n.fillRect(s+t,r+t,t,t)}))}initTextureMap(t,e){this.textureMap=new Map}drawShape(t,e,i,n,s,r,a,o,l,h,d,c,u){this.textureMap||this.initTextureMap(e,t.stage);const{texture:p=l.texture,textureColor:g=l.textureColor,textureSize:f=l.textureSize,texturePadding:v=l.texturePadding}=t.attribute;p&&this.drawTexture(p,t,e,i,n,l,g,f,v)}drawTexture(t,e,i,n,s,r,a,o,l){var h;const{textureRatio:d=r.textureRatio,textureOptions:c=null}=e.attribute;let u=this.textureMap.get(t);if(!u)switch(t){case"circle":u=this.createCirclePattern(o,l,a,i);break;case"diamond":u=this.createDiamondPattern(o,l,a,i);break;case"rect":u=this.createRectPattern(o,l,a,i);break;case"vertical-line":u=this.createVerticalLinePattern(o,l,a,i);break;case"horizontal-line":u=this.createHorizontalLinePattern(o,l,a,i);break;case"bias-lr":u=this.createBiasLRLinePattern(o,l,a,i);break;case"bias-rl":u=this.createBiasRLLinePattern(o,l,a,i);break;case"grid":u=this.createGridPattern(o,l,a,i)}if(c&&c.dynamicTexture){const{gridConfig:u={},useNewCanvas:p}=c,g=e.AABBBounds;n=g.x1,s=g.y1;const f=i;let v;if(p){v=Nn.allocate({width:g.width(),height:g.height(),dpr:i.dpr});const t=v.getContext("2d");t.clearRect(0,0,g.width(),g.height()),n=0,s=0,i=t}if(f.save(),e.parent&&!e.transMatrix.onlyTranslate()){const{scrollX:t=0,scrollY:i=0}=e.parent.attribute;f.setTransformFromMatrix(e.parent.globalTransMatrix),f.translate(t,i,!0)}f.setCommonStyle(e,e.attribute,n,s,r),f.clip();const m=g.width(),b=g.height(),y=l,x=o,_=u.columns?u.columns:Math.ceil(m/x),w=u.rows?u.rows:Math.ceil(b/x),T=u.gutterColumn?u.gutterColumn:2*y,S=u.gutterRow?u.gutterRow:2*y;this._tempSymbolGraphic||(this._tempSymbolGraphic=Fo({}));const k=u.columns?m/u.columns:x,B=u.rows?b/u.rows:x;this._tempSymbolGraphic.setAttributes({size:[k-T,B-S],symbolType:t});const A=this._tempSymbolGraphic.getParsedPath();for(let t=0;t<w;t++)for(let r=0;r<_;r++){const o=n+x/2+r*x,l=s+x/2+t*x;null===(h=c.beforeDynamicTexture)||void 0===h||h.call(c,i,t,r,w,_,d,e,g.width(),g.height()),i.beginPath(),!1===A.draw(i,Math.min(k-T,B-S),o,l,0)&&i.closePath(),i.fillStyle=a,c.dynamicTexture(i,t,r,w,_,d,e,g.width(),g.height())}p&&(f.globalAlpha=1,f.drawImage(v.nativeCanvas,0,0,v.nativeCanvas.width,v.nativeCanvas.height,g.x1,g.y1,g.width()*f.dpr,g.height()*f.dpr)),f.restore()}else if(u)i.highPerformanceSave(),i.setCommonStyle(e,e.attribute,n,s,r),i.fillStyle=u,i.fill(),i.highPerformanceRestore();else if("wave"===t){i.save(),i.setCommonStyle(e,e.attribute,n,s,r),i.clip();const t=e.AABBBounds;(function(t,e,i,n,s,r,a){const{fill:o="orange",percent:l=.6,frequency:h=4,opacity:d,phi:c=0}=s;let{amplitude:u=10}=s;u*=function(t){return t<=.5?4*t-1:-4*t+3}(e);const p=n*(1-l),g=i,f=Math.max(Math.round(g/70),2);t.beginPath(),t.moveTo(0+r,n+a),t.lineTo(0+r,p+a);const v=g/h*e,m=g/Math.PI/(2*h);for(let e=0;e<g;e+=f){const i=u*Math.sin((e+v+c)/m+c);t.lineTo(e+r,p+i+a)}t.lineTo(g+r,n+a),t.closePath(),t.fillStyle=o,isFinite(d)&&(t.globalAlpha=d),t.fill()})(i,d,t.width(),t.height(),Object.assign(Object.assign({},c||{}),{fill:a}),n+t.x1-n,s+t.y1-s),i.restore()}}}const rl=new sl;const al=new class extends Qo{constructor(){super(...arguments),this.time=ni.beforeFillStroke}drawShape(t,e,i,n,s,r,a,o,l,h,d,c){const{background:u,backgroundMode:p=l.backgroundMode,backgroundFit:g=l.backgroundFit,backgroundKeepAspectRatio:f=l.backgroundKeepAspectRatio,backgroundScale:v=l.backgroundScale,backgroundOffsetX:m=l.backgroundOffsetX,backgroundOffsetY:b=l.backgroundOffsetY}=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 n=t.AABBBounds;this.doDrawImage(e,i.data,n,{backgroundMode:p,backgroundFit:g,backgroundKeepAspectRatio:f,backgroundScale:v,backgroundOffsetX:m,backgroundOffsetY:b}),e.highPerformanceRestore(),e.setTransformForCurrent()}else e.highPerformanceSave(),e.fillStyle=u,e.fill(),e.highPerformanceRestore()}},ol=Ft/2;function ll(t,e,i,n,s,r){let a,o=!(arguments.length>6&&void 0!==arguments[6])||arguments[6],l=arguments.length>7?arguments[7]:void 0;if(Array.isArray(o)&&(l=o,o=!0),n<0&&(e+=n,n=-n),s<0&&(i+=s,s=-s),ct(r,!0))a=[r=Wt(r),r,r,r];else if(Array.isArray(r)){const t=r;let e,i;switch(t.length){case 0:a=[0,0,0,0];break;case 1:e=Wt(t[0]),a=[e,e,e,e];break;case 2:case 3:e=Wt(t[0]),i=Wt(t[1]),a=[e,i,e,i];break;default:a=t,a[0]=Wt(a[0]),a[1]=Wt(a[1]),a[2]=Wt(a[2]),a[3]=Wt(a[3])}}else a=[0,0,0,0];if(n<0||a[0]+a[1]+a[2]+a[3]<1e-12)return t.rect(e,i,n,s);const[h,d,c,u]=[[e,i],[e+n,i],[e+n,i+s],[e,i+s]],p=Math.min(n/2,s/2),g=[Math.min(p,a[0]),Math.min(p,a[1]),Math.min(p,a[2]),Math.min(p,a[3])],f=[h[0]+g[0],h[1]],v=[h[0],h[1]+g[0]],m=[d[0]-g[1],d[1]],b=[d[0],d[1]+g[1]],y=[c[0]-g[2],c[1]],x=[c[0],c[1]-g[2]],_=[u[0]+g[3],u[1]],w=[u[0],u[1]-g[3]];if(t.moveTo(f[0],f[1]),o){if(l&&l[0]?l[0](f[0],f[1],m[0],m[1]):t.lineTo(m[0],m[1]),!Bt(m,b)){l&&l[0]&&t.moveTo(m[0],m[1]);const e=m[0],i=m[1]+g[1];t.arc(e,i,g[1],-ol,0,!1)}if(l&&l[1]?l[1](b[0],b[1],x[0],x[1]):t.lineTo(x[0],x[1]),!Bt(y,x)){const e=x[0]-g[2],i=x[1];l&&l[1]&&t.moveTo(x[0],x[1]),t.arc(e,i,g[2],0,ol,!1)}if(l&&l[2]?l[2](y[0],y[1],_[0],_[1]):t.lineTo(_[0],_[1]),!Bt(_,w)){const e=_[0],i=_[1]-g[3];l&&l[2]&&t.moveTo(_[0],_[1]),t.arc(e,i,g[3],ol,Ft,!1)}if(l&&l[3]?l[3](w[0],w[1],v[0],v[1]):t.lineTo(v[0],v[1]),!Bt(f,v)){const e=f[0],i=f[1]+g[0];l&&l[3]&&t.moveTo(v[0],v[1]),t.arc(e,i,g[0],Ft,Ft+ol,!1)}}else l&&l[0]?l[0](f[0],f[1],m[0],m[1]):t.lineTo(m[0],m[1]),l&&l[1]?l[1](m[0],m[1],y[0],y[1]):t.lineTo(y[0],y[1]),l&&l[2]?l[2](y[0],y[1],_[0],_[1]):t.lineTo(_[0],_[1]),l&&l[2]?l[2](_[0],_[1],f[0],f[1]):t.lineTo(f[0],f[1]);return!l&&t.closePath(),t}var hl=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let dl=class{constructor(){this.time=ni.beforeFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,n,s,r,a,o,l,h,d,c,u){const{stroke:p=l.stroke}=t.attribute;Array.isArray(p)&&p.some((t=>!1===t))&&(u.doStroke=!1)}};dl=hl([y()],dl);let cl=class{constructor(){this.time=ni.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,n,s,r,a,o,l,h,d,c){const{x1:u,y1:p,x:g=l.x,y:f=l.y,stroke:v=l.stroke,cornerRadius:m=l.cornerRadius,cornerType:b=l.cornerType}=t.attribute;let{width:y,height:x}=t.attribute;if(y=(null!=y?y:u-g)||0,x=(null!=x?x:p-f)||0,Array.isArray(v)&&v.some((t=>!1===t))){if(e.setStrokeStyle(t,t.attribute,i,n,l),!(0===m||ht(m)&&m.every((t=>0===t)))){let s,r=0;return ll(e,i,n,y,x,m,"bevel"!==b,new Array(4).fill(0).map(((a,o)=>(a,h,d,c)=>{v[o]&&(r===o-1&&v[o]===s||(e.setStrokeStyle(t,Object.assign(Object.assign({},t.attribute),{stroke:v[o]}),i,n,l),e.beginPath(),e.moveTo(a,h),s=v[o]),r=o,e.lineTo(d,c),e.stroke(),3===o&&e.beginPath())}))),void e.stroke()}if(e.beginPath(),e.moveTo(i,n),v[0]?e.lineTo(i+y,n):e.moveTo(i+y,n),v[1]?e.lineTo(i+y,n+x):e.moveTo(i+y,n+x),v[2]?e.lineTo(i,n+x):e.moveTo(i,n+x),v[3]){const t=v[0]?n-e.lineWidth/2:n;e.lineTo(i,t)}else e.moveTo(i,n);e.stroke()}}};cl=hl([y()],cl);const ul=new class{constructor(){this.time=ni.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,n,s,r,a,o,l,h,d,c){const{outerBorder:u,innerBorder:p}=t.attribute,g=u&&!1!==u.visible,f=p&&!1!==p.visible;if(!g&&!f)return;const{cornerRadius:v=l.cornerRadius,cornerType:m=l.cornerType,opacity:b=l.opacity,x:y=l.x,y:x=l.y,scaleX:_=l.scaleX,scaleY:w=l.scaleY,x1:T,y1:S,keepStrokeScale:k=l.keepStrokeScale}=t.attribute;let{width:B,height:A}=t.attribute;B=(null!=B?B:T-i)||0,A=(null!=A?A:S-n)||0;const C=(s,r)=>{const a=!(!s||!s.stroke),o="outerBorder"===r?-1:1,{distance:h=l[r].distance}=s,d=k?h:Tn(e,h,e.dpr),u=i+o*d,p=n+o*d,g=2*d;if(0===v||ht(v)&&v.every((t=>0===t))?(e.beginPath(),e.rect(u,p,B-o*g,A-o*g)):(e.beginPath(),ll(e,u,p,B-o*g,A-o*g,v,"bevel"!==m)),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),c)c(e,s,l[r]);else if(a){const a=l[r].opacity;l[r].opacity=b,e.setStrokeStyle(t,s,(y-i)/_,(x-n)/w,l[r]),l[r].opacity=a,e.stroke()}};g&&C(u,"outerBorder"),f&&C(p,"innerBorder")}},pl=rl,gl=tl;const fl=new class{constructor(){this.time=ni.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,n,s,r,a,o,l,h,d,c){const u=t.getParsedPath();if(!u)return;const{outerBorder:p,innerBorder:g}=t.attribute,f=p&&!1!==p.visible,v=g&&!1!==g.visible;if(!f&&!v)return;const{size:m=l.size,opacity:b=l.opacity,x:y=l.x,y:x=l.y,scaleX:_=l.scaleX,scaleY:w=l.scaleY,keepStrokeScale:T=l.keepStrokeScale}=t.attribute,S=(s,r)=>{const a=!(!s||!s.stroke),{distance:o=l[r].distance}=s,h=T?o:Tn(e,o,e.dpr),d="outerBorder"===r?1:-1;if(e.beginPath(),!1===u.drawOffset(e,m,i,n,d*h)&&e.closePath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),c)c(e,s,l[r]);else if(a){const a=l[r].opacity;l[r].opacity=b,e.setStrokeStyle(t,s,(y-i)/_,(x-n)/w,l[r]),l[r].opacity=a,e.stroke()}};f&&S(p,"outerBorder"),v&&S(g,"innerBorder")}},vl=new class{constructor(){this.time=ni.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,n,s,r,a,o,l,h,d,c,u){const{clipRange:p=l.clipRange,x:g=l.x,y:f=l.y,z:v=l.z,size:m=l.size,scaleX:b=l.scaleX,scaleY:y=l.scaleY}=t.attribute,x=t.getParsedPath();x&&p<1&&p>0&&(e.beginPath(),x.drawWithClipRange&&x.drawWithClipRange(e,m,i,n,p,v,((s,r)=>{var a,h,d,u;if(t._parsedPath.svgCache){const e=Object.assign({},r);e.fill=null!==(a=r.fill)&&void 0!==a?a:t.attribute.fill,e.opacity=null!==(h=r.opacity)&&void 0!==h?h:t.attribute.opacity,e.fillOpacity=t.attribute.fillOpacity,e.stroke=null!==(d=r.stroke)&&void 0!==d?d:t.attribute.stroke,e.lineWidth=null!==(u=r.lineWidth)&&void 0!==u?u:t.attribute.lineWidth,r=e}r.stroke&&(c?c(e,t.attribute,l):o&&(e.setStrokeStyle(t,r,(g-i)/b,(f-n)/y,l),e.stroke()))})),r&&!x.isSvg&&(c?c(e,t.attribute,l):o&&(e.setStrokeStyle(t,t.attribute,(g-i)/b,(f-n)/y,l),e.stroke())))}},ml=rl,bl=tl;const yl={x:0,y:0,z:0,lastModelMatrix:null};class xl{init(t){t&&(this._renderContribitions=t.getContributions()),this._renderContribitions||(this._renderContribitions=[]),this.builtinContributions||(this.builtinContributions=[]),this.builtinContributions.push(il),this.builtinContributions.push(nl),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===ni.beforeFillStroke)),this._afterRenderContribitions=this._renderContribitions.filter((t=>t.time===ni.afterFillStroke)))}reInit(){this.init(this.graphicRenderContributions)}beforeRenderStep(t,e,i,n,s,r,a,o,l,h,d,c,u){this._beforeRenderContribitions&&this._beforeRenderContribitions.forEach((p=>{p.supportedAppName&&t.stage&&t.stage.params&&t.stage.params.context&&t.stage.params.context.appName&&!(Array.isArray(p.supportedAppName)?p.supportedAppName:[p.supportedAppName]).includes(t.stage.params.context.appName)||p.drawShape(t,e,i,n,s,r,a,o,l,h,d,c,u)}))}afterRenderStep(t,e,i,n,s,r,a,o,l,h,d,c,u){this._afterRenderContribitions&&this._afterRenderContribitions.forEach((p=>{p.supportedAppName&&t.stage&&t.stage.params&&t.stage.params.context&&t.stage.params.context.appName&&!(Array.isArray(p.supportedAppName)?p.supportedAppName:[p.supportedAppName]).includes(t.stage.params.context.appName)||p.drawShape(t,e,i,n,s,r,a,o,l,h,d,c,u)}))}drawPathProxy(t,e,i,n,s,r,a,o){if(!t.pathProxy)return!1;const l=ns(t,null==r?void 0:r.theme)[t.type.replace("3d","")],{fill:h=l.fill,stroke:d=l.stroke,opacity:c=l.opacity,fillOpacity:u=l.fillOpacity,lineWidth:p=l.lineWidth,strokeOpacity:g=l.strokeOpacity,visible:f=l.visible,x:v=l.x,y:m=l.y}=t.attribute,b=so(c,u,h),y=ao(c,g),x=io(h),_=no(d,p);if(!f)return!0;if(!x&&!_)return!0;if(!(b||y||a||o))return!0;e.beginPath();return oi(("function"==typeof t.pathProxy?t.pathProxy(t.attribute):t.pathProxy).commandList,e,i,n),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,i,n,x,_,b,y,l,s,a,o),_&&(o?o(e,t.attribute,l):y&&(e.setStrokeStyle(t,t.attribute,i-v,n-m,l),e.stroke())),x&&(a?a(e,t.attribute,l):b&&(e.setCommonStyle(t,t.attribute,i-v,n-m,l),e.fill())),this.afterRenderStep(t,e,i,n,x,_,b,y,l,s,a,o),!0}valid(t,e,i,n){const{fill:s=e.fill,background:r,stroke:a=e.stroke,opacity:o=e.opacity,fillOpacity:l=e.fillOpacity,lineWidth:h=e.lineWidth,strokeOpacity:d=e.strokeOpacity,visible:c=e.visible}=t.attribute,u=so(o,l,s),p=ao(o,d),g=io(s,r),f=no(a,h);return!(!t.valid||!c)&&!(!g&&!f)&&!!(u||p||i||n||r)&&{fVisible:u,sVisible:p,doFill:g,doStroke:f}}transform(t,e,i){let n=arguments.length>3&&void 0!==arguments[3]&&arguments[3];const{x:s=e.x,y:r=e.y,z:a=e.z,scaleX:o=e.scaleX,scaleY:l=e.scaleY,angle:h=e.angle,postMatrix:d}=t.attribute,c=i.modelMatrix,u=i.camera;yl.x=s,yl.y=r,yl.z=a,yl.lastModelMatrix=c;const p=u&&(n||function(t){const{alpha:e,beta:i}=t.attribute;return e||i}(t)),g=p?t.transMatrix.onlyTranslate()&&!d:1===o&&1===l&&0===h&&!d;if(p){const n=wo.allocate(),s=wo.allocate();Bo(s,t,e),yo(n,c||n,s),yl.x=0,yl.y=0,yl.z=0,i.modelMatrix=n,i.setTransform(1,0,0,1,0,0,!0),wo.free(s)}if(g&&!c){const n=t.getOffsetXY(e);yl.x+=n.x,yl.y+=n.y,yl.z=a,i.setTransformForCurrent()}else if(p)yl.x=0,yl.y=0,yl.z=0,i.setTransform(1,0,0,1,0,0,!0);else if(u&&i.project){const n=t.getOffsetXY(e);yl.x+=n.x,yl.y+=n.y,this.transformWithoutTranslate(i,yl.x,yl.y,yl.z,o,l,h)}else i.transformFromMatrix(t.transMatrix,!0),yl.x=0,yl.y=0,yl.z=0;return yl}transformUseContext2d(t,e,i,n){const s=n.camera;if(this.camera=s,s){const e=t.AABBBounds,s=e.x2-e.x1,r=e.y2-e.y1,a=n.project(0,0,i),o=n.project(s,0,i),l=n.project(s,r,i),h={x:0,y:0},d={x:s,y:0},c={x:s,y:r};n.camera=null;const u=1/(h.x*(c.y-d.y)-d.x*c.y+c.x*d.y+(d.x-c.x)*h.y),p=-(h.y*(l.x-o.x)-d.y*l.x+c.y*o.x+(d.y-c.y)*a.x)*u,g=(d.y*l.y+h.y*(o.y-l.y)-c.y*o.y+(c.y-d.y)*a.y)*u,f=(h.x*(l.x-o.x)-d.x*l.x+c.x*o.x+(d.x-c.x)*a.x)*u,v=-(d.x*l.y+h.x*(o.y-l.y)-c.x*o.y+(c.x-d.x)*a.y)*u,m=(h.x*(c.y*o.x-d.y*l.x)+h.y*(d.x*l.x-c.x*o.x)+(c.x*d.y-d.x*c.y)*a.x)*u,b=(h.x*(c.y*o.y-d.y*l.y)+h.y*(d.x*l.y-c.x*o.y)+(c.x*d.y-d.x*c.y)*a.y)*u;n.setTransform(p,g,f,v,m,b,!0)}}restoreTransformUseContext2d(t,e,i,n){this.camera&&(n.camera=this.camera)}transformWithoutTranslate(t,e,i,n,s,r,a){const o=t.project(e,i,n);t.translate(o.x,o.y,!1),t.scale(s,r,!1),t.rotate(a,!1),t.translate(-o.x,-o.y,!1),t.setTransformForCurrent()}_draw(t,e,i,n,s){const{context:r}=n;if(!r)return;const{renderable:a}=t.attribute;if(!1===a)return;r.highPerformanceSave();const o=this.transform(t,e,r,i),{x:l,y:h,z:d,lastModelMatrix:c}=o;this.z=d,this.drawPathProxy(t,r,l,h,n,s)||(this.drawShape(t,r,l,h,n,s),this.z=0,r.modelMatrix!==c&&wo.free(r.modelMatrix),r.modelMatrix=c),r.highPerformanceRestore()}}function _l(t,e,i,n){if(!e.p1)return;const{offsetX:s=0,offsetY:r=0,offsetZ:a=0}=n||{};if(1===i)e.p2&&e.p3?t.bezierCurveTo(s+e.p1.x,r+e.p1.y,s+e.p2.x,r+e.p2.y,s+e.p3.x,r+e.p3.y,a):t.lineTo(s+e.p1.x,r+e.p1.y,a);else if(e.p2&&e.p3){const[n]=fi(e,i);t.bezierCurveTo(s+n.p1.x,r+n.p1.y,s+n.p2.x,r+n.p2.y,s+n.p3.x,r+n.p3.y,a)}else{const n=e.getPointAt(i);t.lineTo(s+n.x,r+n.y,a)}}function wl(t,e,i,n,s,r,a){var o;let l=e.p0,h=n;if(i&&i.originP1===i.originP2&&(l=i.p0),e.defined)n||(t.lineTo(l.x+s,l.y+r,a),h=!n);else{const{originP1:d,originP2:c}=e;let u;if(d&&!1!==d.defined&&!i?u=l:d&&!1!==c.defined&&(u=null!==(o=e.p3)&&void 0!==o?o:e.p1),n){h=!n;const i=u?u.x:e.p0.x,o=u?u.y:e.p0.y;t.moveTo(i+s,o+r,a)}else u&&(h=!n,t.lineTo(u.x+s,u.y+r,a))}return h}function Tl(t,e,i,n,s){const{offsetX:r=0,offsetY:a=0,offsetZ:o=0,mode:l="none",drawConnect:h=!1}=s||{};if(h&&"none"===l)return;if(!e)return;let d=!0;const{curves:c}=e;if(i>=1){if(h){let e,i=!0;c.forEach(((n,s)=>{n.originP1!==n.originP2?(i=wl(t,n,e,i,r,a,o),e=n):e=n}))}else c.forEach((e=>{e.defined?(d&&t.moveTo(e.p0.x+r,e.p0.y+a,o),_l(t,e,1,s),d=!1):d=!0}));return}if(i<=0)return;let u;"x"===n?u=ei.ROW:"y"===n?u=ei.COLUMN:"auto"===n&&(u=e.direction);const p=i*e.tryUpdateLength(u);let g=0,f=!0,v=null;for(let e=0,i=c.length;e<i;e++){const i=c[e],n=i.getLength(u),l=(p-g)/n;if(g+=n,l<0)break;if(h){if(i.originP1===i.originP2){v=i;continue}f=wl(t,i,v,f,r,a,o),v=i}else{if(!i.defined){d=!0;continue}d&&t.moveTo(i.p0.x+r,i.p0.y+a,o),_l(t,i,Yt(l,1),s),d=!1}}}var Sl=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let kl=class extends xl{constructor(){super(...arguments),this.numberType=Ta}draw(t,e,i,n){const s=ns(t,null==n?void 0:n.theme).line;this._draw(t,s,!1,i,n)}drawSegmentItem(t,e,i,n,s,r,a,o,l,h,d,c,u,p,g){var f;if(!e)return;t.beginPath();const v=null!==(f=this.z)&&void 0!==f?f:0;Tl(t.camera?t:t.nativeContext,e,l,h,{offsetX:d,offsetY:c,offsetZ:v}),u.cache&&!ht(u.cache)&&u.cache.curves.every((t=>t.defined))&&u.attribute.curveType&&u.attribute.curveType.includes("Closed")&&t.closePath(),t.setShadowBlendStyle&&t.setShadowBlendStyle(u,a,o);const{x:m=0,x:b=0}=a;return!1!==i&&(p?p(t,a,o):s&&(t.setCommonStyle(u,a,m-d,b-c,o),t.fill())),!1!==n&&(g?g(t,a,o):r&&(t.setStrokeStyle(u,a,m-d,b-c,o),t.stroke())),!1}drawLinearLineHighPerformance(t,e,i,n,s,r,a,o,l,h,d,c,u){var p;e.beginPath();const g=null!==(p=this.z)&&void 0!==p?p:0,{points:f}=t.attribute,v=f[0];e.moveTo(v.x+a,v.y+o,g);for(let t=1;t<f.length;t++){const i=f[t];e.lineTo(i.x+a,i.y+o,g)}e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l);const{x:m=0,x:b=0}=t.attribute;!1!==i&&(c?c(e,t.attribute,l):s&&(e.setCommonStyle(t,t.attribute,m-a,b-o,l),e.fill())),!1!==n&&(u?u(e,t.attribute,l):r&&(e.setStrokeStyle(t,t.attribute,m-a,b-o,l),e.stroke()))}drawShape(t,e,i,n,s,r,a,o){const l=ns(t,null==r?void 0:r.theme).line,{fill:h=l.fill,stroke:d=l.stroke,fillOpacity:c=l.fillOpacity,strokeOpacity:u=l.strokeOpacity,segments:p,points:g,closePath:f,curveTension:v=l.curveTension,connectedType:m=l.connectedType}=t.attribute;if(!this.valid(t,l,a,o))return;let{curveType:b=l.curveType}=t.attribute;f&&"linear"===b&&(b="linearClosed");const{clipRange:y=l.clipRange,clipRangeByDimension:x=l.clipRangeByDimension}=t.attribute;if(1===y&&!p&&!g.some((t=>!1===t.defined))&&"linear"===b)return this.drawLinearLineHighPerformance(t,e,!!h,!!d,c,u,i,n,l,s,r,a,o);function _(t,e){return"none"===e?t:t.filter((t=>!1!==t.defined))}if(t.shouldUpdateShape()){const{points:e,segments:i}=t.attribute,n=e;if(i&&i.length){let e,n;if(t.cache=i.map(((t,i)=>{if(t.points.length<=1&&0===i)return t.points[0]&&(n={endX:t.points[0].x,endY:t.points[0].y,curves:[{defined:!1!==t.points[0].defined}]}),null;1===i?e={x:n.endX,y:n.endY,defined:n.curves[n.curves.length-1].defined}:i>1&&(e.x=n.endX,e.y=n.endY,e.defined=n.curves[n.curves.length-1].defined);const s=Xi(_(t.points,m),b,{startPoint:e,curveTension:v});return n=s,s})).filter((t=>!!t)),"linearClosed"===b){let e;for(let i=0;i<t.cache.length;i++){const n=t.cache[i];for(let t=0;t<n.curves.length;t++)if(n.curves[t].defined){e=n.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=Xi(_(n,m),b,{curveTension:v})}t.clearUpdateShapeTag()}if(Array.isArray(t.cache)){const s=t.attribute.segments.filter((t=>t.points.length));if(1===s[0].points.length&&s.shift(),1===y){let r=!1;t.cache.forEach(((p,g)=>{r||(r=this.drawSegmentItem(e,p,!!h,!!d,c,u,s[g],[l,t.attribute],y,x,i,n,t,a,o))}))}else{const r=t.cache.reduce(((t,e)=>t+e.getLength()),0),p=y*r;let g=0,f=!1;t.cache.forEach(((r,v)=>{if(f)return;const m=r.getLength(),b=(p-g)/m;g+=m,b>0&&(f=this.drawSegmentItem(e,r,!!h,!!d,c,u,s[v],[l,t.attribute],Yt(b,1),x,i,n,t,a,o))}))}}else this.drawSegmentItem(e,t.cache,!!h,!!d,c,u,t.attribute,l,y,x,i,n,t,a,o)}};function Bl(t,e,i,n){const{offsetX:s=0,offsetY:r=0,offsetZ:a=0}=n||{};let o=!0;e.forEach((e=>{e.defined?(o&&t.moveTo(e.p0.x+s,e.p0.y+r,a),_l(t,e,1,n),o=!1):o=!0})),o=!0;for(let e=i.length-1;e>=0;e--){const l=i[e];l.defined?(o&&t.lineTo(l.p0.x+s,l.p0.y+r,a),_l(t,l,1,n),o=!1):o=!0}t.closePath()}kl=Sl([y()],kl);const Al=new class extends sl{constructor(){super(...arguments),this.time=ni.afterFillStroke}drawShape(t,e,i,n,s,r,a,o,l,h,d,c,u){var p,g,f,v;this.textureMap||this.initTextureMap(e,t.stage);const{attribute:m=t.attribute}=u||{},{texture:b=(null!==(p=t.attribute.texture)&&void 0!==p?p:Is(l,"texture")),textureColor:y=(null!==(g=t.attribute.textureColor)&&void 0!==g?g:Is(l,"textureColor")),textureSize:x=(null!==(f=t.attribute.textureSize)&&void 0!==f?f:Is(l,"textureSize")),texturePadding:_=(null!==(v=t.attribute.texturePadding)&&void 0!==v?v:Is(l,"texturePadding"))}=m;b&&this.drawTexture(b,t,e,i,n,l,y,x,_)}},Cl=tl;var Ll=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Ol=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},El=function(t,e){return function(i,n){e(i,n,t)}};let Rl=class extends xl{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=ya,this.builtinContributions=[Al,Cl],this.init(t)}drawLinearAreaHighPerformance(t,e,i,n,s,r,a,o,l,h,d,c,u){var p,g,f;const{points:v}=t.attribute;if(v.length<2)return;e.beginPath();const m=null!==(p=this.z)&&void 0!==p?p:0,b=v[0];e.moveTo(b.x+a,b.y+o,m);for(let t=1;t<v.length;t++){const i=v[t];e.lineTo(i.x+a,i.y+o,m)}for(let t=v.length-1;t>=0;t--){const i=v[t];e.lineTo((null!==(g=i.x1)&&void 0!==g?g:i.x)+a,(null!==(f=i.y1)&&void 0!==f?f:i.y)+o,m)}e.closePath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,a,o,!!s,!1,i,!1,l,h,c,null,{attribute:t.attribute});const{x:y=0,x:x=0}=t.attribute;!1!==i&&(c?c(e,t.attribute,l):s&&(e.setCommonStyle(t,t.attribute,y-a,x-o,l),e.fill())),this.afterRenderStep(t,e,a,o,!!s,!1,i,!1,l,h,c,null,{attribute:t.attribute}),(()=>{var i,s;if(n){const{stroke:n=l&&l.stroke}=t.attribute;if(ht(n)&&(n[0]||n[2])&&!1===n[1])if(e.beginPath(),n[0]){e.moveTo(b.x+a,b.y+o,m);for(let t=1;t<v.length;t++){const i=v[t];e.lineTo(i.x+a,i.y+o,m)}}else if(n[2]){const t=v[v.length-1];e.moveTo(t.x+a,t.y+o,m);for(let t=v.length-2;t>=0;t--){const n=v[t];e.lineTo((null!==(i=n.x1)&&void 0!==i?i:n.x)+a,(null!==(s=n.y1)&&void 0!==s?s:n.y)+o,m)}}u?u(e,t.attribute,l):(e.setStrokeStyle(t,t.attribute,y-a,x-o,l),e.stroke())}})()}drawShape(t,e,i,n,s,r,a,o){var l,h,d,c,u,p;const g=ns(t,null==r?void 0:r.theme).area,{fill:f=g.fill,stroke:v=g.stroke,fillOpacity:m=g.fillOpacity,z:b=g.z,strokeOpacity:y=g.strokeOpacity,curveTension:x=g.curveTension,connectedType:_=g.connectedType}=t.attribute,w=this.valid(t,g,a,o);if(!w)return;const{doFill:T}=w,S=w.doStroke&&w.sVisible,{clipRange:k=g.clipRange,closePath:B,points:A,segments:C}=t.attribute;let{curveType:L=g.curveType}=t.attribute;function O(t,e){return"connect"!==e?t:t.filter((t=>!1!==t.defined))}if(B&&"linear"===L&&(L="linearClosed"),1===k&&!C&&!A.some((t=>!1===t.defined))&&"linear"===L)return this.drawLinearAreaHighPerformance(t,e,!!f,S,m,y,i,n,g,s,r,a,o);if(t.shouldUpdateShape()){if(C&&C.length){let e,i;const n=C.map(((t,n)=>{if(t.points.length<=1&&0===n)return t.points[0]&&(i={endX:t.points[0].x,endY:t.points[0].y}),null;1===n?e={x:i.endX,y:i.endY}:n>1&&(e.x=i.endX,e.y=i.endY);const s=Xi(O(t.points,_),L,{startPoint:e,curveTension:x});return i=s,s})).filter((t=>!!t));let s;const r=[];for(let t=C.length-1;t>=0;t--){const e=C[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=C[t-1].points,n=e[e.length-1];n&&i.push({x:null!==(d=n.x1)&&void 0!==d?d:n.x,y:null!==(c=n.y1)&&void 0!==c?c:n.y})}i.length>1&&(s=Xi(O(i,_),"stepBefore"===L?"stepAfter":"stepAfter"===L?"stepBefore":L,{curveTension:x}),r.unshift(s))}t.cacheArea=r.map(((t,e)=>({top:n[e],bottom:t})))}else{if(!A||!A.length)return t.cacheArea=null,void t.clearUpdateShapeTag();{const e=O(A,_),i=[];for(let t=e.length-1;t>=0;t--)i.push({x:null!==(u=e[t].x1)&&void 0!==u?u:e[t].x,y:null!==(p=e[t].y1)&&void 0!==p?p:e[t].y});const n=Xi(e,L,{curveTension:x}),s=Xi(i,"stepBefore"===L?"stepAfter":"stepAfter"===L?"stepBefore":L,{curveTension:x});t.cacheArea={top:n,bottom:s}}}t.clearUpdateShapeTag()}if(Array.isArray(t.cacheArea)){const r=t.attribute.segments.filter((t=>t.points.length));if(1===r[0].points.length&&r.shift(),1===k){let l=!1;t.cacheArea.forEach(((h,d)=>{l||(l=this.drawSegmentItem(e,h,T,m,S,y,r[d],[g,t.attribute],k,i,n,b,t,s,a,o))}))}else{const l=t.cacheArea.reduce(((t,e)=>t+e.top.getLength()),0),h=k*l;let d=0,c=!1;t.cacheArea.forEach(((l,u)=>{if(c)return;const p=l.top.getLength(),f=(h-d)/p;d+=p,f>0&&(c=this.drawSegmentItem(e,l,T,m,S,y,r[u],[g,t.attribute],Yt(f,1),i,n,b,t,s,a,o))}))}}else this.drawSegmentItem(e,t.cacheArea,T,m,S,y,t.attribute,g,k,i,n,b,t,s,a,o)}draw(t,e,i,n){const s=ns(t,null==n?void 0:n.theme).area;this._draw(t,s,!1,i,n)}drawSegmentItem(t,e,i,n,s,r,a,o,l,h,d,c,u,p,g,f){return this._drawSegmentItem(t,e,i,n,s,r,a,o,l,h,d,c,u,p,g,f)}_drawSegmentItem(t,e,i,n,s,r,a,o,l,h,d,c,u,p,g,f){if(!(e&&e.top&&e.bottom&&e.top.curves&&e.top.curves.length&&e.bottom.curves&&e.bottom.curves.length))return;t.beginPath();const{points:v,segments:m}=u.attribute;let b,y,x=ei.ROW;if(m){const t=m[m.length-1];y=m[0].points[0],b=t.points[t.points.length-1]}else y=v[0],b=v[v.length-1];const _=Wt(b.x-y.x),w=Wt(b.y-y.y);x=null==b.x1?ei.ROW:null==b.y1?ei.COLUMN:Number.isFinite(_+w)?_>w?ei.ROW:ei.COLUMN:ei.ROW,function(t,e,i,n){var s;const{top:r,bottom:a}=e;if(r.curves.length!==a.curves.length)return;if(i>=1){const e=[],i=[];let s=!0;for(let o=0,l=r.curves.length;o<l;o++){const h=r.curves[o];s!==h.defined?(s?(Bl(t,e,i,n),e.length=0,i.length=0):(e.push(h),i.push(a.curves[l-o-1])),s=!s):s&&(e.push(h),i.push(a.curves[l-o-1]))}return void Bl(t,e,i,n)}if(i<=0)return;let{direction:o}=n||{};const{curves:l}=r,h=null!==(s=l[l.length-1].p3)&&void 0!==s?s:l[l.length-1].p1,d=Wt(h.x-l[0].p0.x),c=Wt(h.y-l[0].p0.y);o=null!=o?o:d>c?ei.ROW:ei.COLUMN,Number.isFinite(d)||(o=ei.COLUMN),Number.isFinite(c)||(o=ei.ROW);const u=i*(o===ei.ROW?d:c);let p=0,g=!0;const f=[],v=[];for(let e=0,i=r.curves.length;e<i;e++){const s=r.curves[e],l=s.getLength(o),h=(u-p)/l;if(h<0)break;p+=l;let d=null,c=null;g!==s.defined?(g?(Bl(t,f,v,n),f.length=0,v.length=0):(d=s,c=a.curves[i-e-1]),g=!g):g&&(d=s,c=a.curves[i-e-1]),d&&c&&(h<1&&(d=d.p2&&d.p3?fi(d,h)[0]:mi(d,h)[0],c=c.p2&&c.p3?fi(c,1-h)[1]:mi(c,1-h)[1]),d.defined=g,c.defined=g,f.push(d),v.push(c)),d=null,c=null}Bl(t,f,v,n)}(t.camera?t:t.nativeContext,e,l,{offsetX:h,offsetY:d,offsetZ:c,direction:x}),this.beforeRenderStep(u,t,h,d,!!n,!1,i,!1,o,p,g,null,{attribute:a}),t.setShadowBlendStyle&&t.setShadowBlendStyle(u,a,o);const{x:T=0,x:S=0}=a;return!1!==i&&(g?g(t,a,o):n&&(t.setCommonStyle(u,a,T-h,S-d,o),t.fill())),this.afterRenderStep(u,t,h,d,!!n,!1,i,!1,o,p,g,null,{attribute:a}),(()=>{if(!1!==s)if(f)f(t,a,o);else{const{stroke:i=o&&o[1]&&o[1].stroke}=a;ht(i)&&(i[0]||i[2])&&!1===i[1]&&(t.beginPath(),Tl(t.camera?t:t.nativeContext,i[0]?e.top:e.bottom,l,x===ei.ROW?"x":"y",{offsetX:h,offsetY:d,offsetZ:c})),t.setStrokeStyle(u,a,T-h,S-d,o),t.stroke()}})(),!1}};Rl=Ll([y(),El(0,m(D)),El(0,x(lo)),Ol("design:paramtypes",[Object])],Rl);var Ml=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Pl=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Dl=function(t,e){return function(i,n){e(i,n,t)}};let Il=class extends xl{constructor(t){super(),this.graphicRenderContributions=t,this.type="rect",this.numberType=ka,this.builtinContributions=[ul,gl,pl],this.init(t)}drawShape(t,e,i,n,s,r,a,o){var l;const h=null!==(l=this.tempTheme)&&void 0!==l?l:ns(t,null==r?void 0:r.theme).rect,{fill:d=h.fill,background:c,stroke:u=h.stroke,cornerRadius:p=h.cornerRadius,cornerType:g=h.cornerType,opacity:f=h.opacity,fillOpacity:v=h.fillOpacity,lineWidth:m=h.lineWidth,strokeOpacity:b=h.strokeOpacity,visible:y=h.visible,x1:x,y1:_,x:w=h.x,y:T=h.y,fillStrokeOrder:S=h.fillStrokeOrder}=t.attribute;let{width:k,height:B}=t.attribute;k=(null!=k?k:x-w)||0,B=(null!=B?B:_-T)||0;const A=ro(f,v,k,B,d),C=oo(f,b,k,B),L=io(d,c),O=no(u,m);if(!t.valid||!y)return;if(!L&&!O)return;if(!(A||C||a||o||c))return;0===p||ht(p)&&p.every((t=>0===t))?(e.beginPath(),e.rect(i,n,k,B)):(e.beginPath(),ll(e,i,n,k,B,p,"bevel"!==g));const E={doFill:L,doStroke:O};e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,h),this.beforeRenderStep(t,e,i,n,L,O,A,C,h,s,a,o,E);const R=()=>{E.doFill&&(a?a(e,t.attribute,h):A&&(e.setCommonStyle(t,t.attribute,w-i,T-n,h),e.fill()))},M=()=>{E.doStroke&&(o?o(e,t.attribute,h):C&&(e.setStrokeStyle(t,t.attribute,w-i,T-n,h),e.stroke()))};S?(M(),R()):(R(),M()),this.afterRenderStep(t,e,i,n,L,O,A,C,h,s,a,o)}draw(t,e,i,n){const s=ns(t,null==n?void 0:n.theme).rect;this.tempTheme=s,this._draw(t,s,!1,i,n),this.tempTheme=null}};Il=Ml([y(),Dl(0,m(D)),Dl(0,x(co)),Pl("design:paramtypes",[Object])],Il);var Fl=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Nl=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Hl=function(t,e){return function(i,n){e(i,n,t)}};let zl=class extends xl{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=Ba,this.builtinContributions=[fl,bl,ml,vl],this.init(t)}drawShape(t,e,i,n,s,r,a,o){var l;const h=ns(t,null==r?void 0:r.theme).symbol,{size:d=h.size,x:c=h.x,y:u=h.y,scaleX:p=h.scaleX,scaleY:g=h.scaleY,fillStrokeOrder:f=h.fillStrokeOrder,clipRange:v=h.clipRange}=t.attribute,m=this.valid(t,h,a,o);if(!m)return;const{fVisible:b,sVisible:y,doFill:x,doStroke:_}=m,w=t.getParsedPath();if(!w)return;const{keepDirIn3d:T=h.keepDirIn3d}=t.attribute,S=null!==(l=this.z)&&void 0!==l?l:0;e.beginPath();let k=i,B=n,A=S;const C=e.camera;if(T&&C&&e.project){const t=e.project(i,n,S);e.camera=null,ht(d)&&(d[0],d[1]),k=t.x,B=t.y,A=void 0}!1===w.draw(e,d,k,B,A,((s,r)=>{var l,d,m,b;if(t._parsedPath.svgCache){const e=Object.assign({},r);e.fill=null!==(l=r.fill)&&void 0!==l?l:t.attribute.fill,e.opacity=null!==(d=r.opacity)&&void 0!==d?d:t.attribute.opacity,e.fillOpacity=t.attribute.fillOpacity,e.stroke=null!==(m=r.stroke)&&void 0!==m?m:t.attribute.stroke,e.lineWidth=null!==(b=r.lineWidth)&&void 0!==b?b:t.attribute.lineWidth,r=e}const x=()=>{r.fill&&(a?a(e,t.attribute,h):(e.setCommonStyle(t,r,c-i,u-n,h),e.fill()))},_=()=>{r.stroke&&(o?o(e,t.attribute,h):y&&v>=1&&(e.setStrokeStyle(t,r,(c-i)/p,(u-n)/g,h),e.stroke()))};f?(_(),x()):(x(),_())}))&&e.closePath(),e.camera=C,e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,h),this.beforeRenderStep(t,e,i,n,x,_,b,y,h,s,a,o);const L=()=>{x&&!w.isSvg&&(a?a(e,t.attribute,h):b&&(e.setCommonStyle(t,t.attribute,c-i,u-n,h),e.fill()))},O=()=>{_&&!w.isSvg&&(o?o(e,t.attribute,h):y&&v>=1&&(e.setStrokeStyle(t,t.attribute,(c-i)/p,(u-n)/g,h),e.stroke()))};f?(O(),L()):(L(),O()),this.afterRenderStep(t,e,i,n,x,_,b,y,h,s,a,o)}draw(t,e,i,n){const s=ns(t,null==n?void 0:n.theme).symbol;this._draw(t,s,!1,i,n)}};zl=Fl([y(),Hl(0,m(D)),Hl(0,x(uo)),Nl("design:paramtypes",[Object])],zl);const Wl=new class{constructor(){this.pools=[];for(let t=0;t<10;t++)this.pools.push(new pe)}allocate(t,e,i,n){if(!this.pools.length)return(new pe).setValue(t,e,i,n);const s=this.pools.pop();return s.x1=t,s.y1=e,s.x2=i,s.y2=n,s}allocateByObj(t){if(!this.pools.length)return new pe(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=[]}};const Ul=new class extends Qo{constructor(){super(...arguments),this.time=ni.beforeFillStroke}drawShape(t,e,i,n,s,r,a,o,l,h,d,c){var u,p,g,f,v,m,b,y,x,_;const{backgroundMode:w=l.backgroundMode,backgroundFit:T=l.backgroundFit,backgroundKeepAspectRatio:S=l.backgroundKeepAspectRatio}=t.attribute;let k,{background:B}=t.attribute;if(!B)return;const A=()=>{"richtext"===t.type&&(e.restore(),e.save(),k&&e.setTransformFromMatrix(k,!0,1))};let C;"richtext"===t.type&&(k=e.currentMatrix.clone(),e.restore(),e.save(),e.setTransformForCurrent());const L=st(B)&&B.background,O=t.transMatrix.onlyTranslate();if(L){const e=t.AABBBounds,i=(null!==(u=B.x)&&void 0!==u?u:e.x1)+(null!==(p=B.dx)&&void 0!==p?p:0),n=(null!==(g=B.y)&&void 0!==g?g:e.y1)+(null!==(f=B.dy)&&void 0!==f?f:0),s=null!==(v=B.width)&&void 0!==v?v:e.width(),r=null!==(m=B.height)&&void 0!==m?m:e.height();if(C=Wl.allocate(i,n,i+s,n+r),B=B.background,!O){const t=C.width(),e=C.height();C.set((null!==(b=B.x)&&void 0!==b?b:0)+(null!==(y=B.dx)&&void 0!==y?y:0),(null!==(x=B.y)&&void 0!==x?x:0)+(null!==(_=B.dy)&&void 0!==_?_:0),t,e)}}else C=t.AABBBounds,O||(C=(E=Object.assign(Object.assign({},t.attribute),{angle:0,scaleX:1,scaleY:1,x:0,y:0,dx:0,dy:0}),$o||($o=Ko.CreateGraphic("text",{})),$o.initAttributes(E),$o.AABBBounds).clone());var E;if(t.backgroundImg&&t.resources){const s=t.resources.get(B);if("success"!==s.state||!s.data)return void A();e.highPerformanceSave(),O&&e.setTransformFromMatrix(t.parent.globalTransMatrix,!0),e.setCommonStyle(t,t.attribute,i,n,l),this.doDrawImage(e,s.data,C,{backgroundMode:w,backgroundFit:T,backgroundKeepAspectRatio:S}),e.highPerformanceRestore(),e.setTransformForCurrent()}else{const{backgroundCornerRadius:s}=t.attribute;e.highPerformanceSave(),e.setCommonStyle(t,t.attribute,i,n,l),e.fillStyle=B,s?(ll(e,C.x1,C.y1,C.width(),C.height(),s,!0),e.fill()):e.fillRect(C.x1,C.y1,C.width(),C.height()),e.highPerformanceRestore()}L&&Wl.free(C),A()}};var jl=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Gl=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Yl=function(t,e){return function(i,n){e(i,n,t)}};let Vl=class extends xl{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=Aa,this.builtinContributions=[Ul],this.init(t)}drawShape(t,e,i,n,s,r,a,o){var l,h,d;const c=ns(t,null==r?void 0:r.theme).text,{text:u,underline:p=c.underline,lineThrough:g=c.lineThrough,keepDirIn3d:f=c.keepDirIn3d,direction:v=c.direction,fontSize:m=c.fontSize,verticalMode:b=c.verticalMode,x:y=c.x,y:x=c.y}=t.attribute,_=null!==(l=Fs(t.attribute.lineHeight,m))&&void 0!==l?l:m,w=this.valid(t,c,a,o);if(!w)return;const{fVisible:T,sVisible:S,doFill:k,doStroke:B}=w,A=!f,C=this.z||0;e.beginPath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,c),this.beforeRenderStep(t,e,i,n,k,B,T,S,c,s,a,o),A&&this.transformUseContext2d(t,c,C,e);const L=(s,r,l,h)=>{let d=i+r;const u=n+l;if(h){e.highPerformanceSave(),d+=m;const t=_o.allocate(1,0,0,1,0,0);t.rotateByCenter(Math.PI/2,d,u),e.transformFromMatrix(t,!0),_o.free(t)}B&&(o?o(e,t.attribute,c):S&&(e.setStrokeStyle(t,t.attribute,y-i,x-n,c),e.strokeText(s,d,u,C))),k&&(a?a(e,t.attribute,c):T&&(e.setCommonStyle(t,t.attribute,y-i,x-n,c),e.fillText(s,d,u,C))),h&&(e.highPerformanceRestore(),e.setTransformForCurrent())};if(e.setTextStyleWithoutAlignBaseline(t.attribute,c,C),"horizontal"===v){const{multilineLayout:s}=t;if(!s)return void e.highPerformanceRestore();const{xOffset:r,yOffset:l}=s.bbox;B&&(o?o(e,t.attribute,c):S&&(e.setStrokeStyle(t,t.attribute,y-i,x-n,c),s.lines.forEach((t=>{e.strokeText(t.str,(t.leftOffset||0)+r+i,(t.topOffset||0)+l+n,C)})))),k&&(a?a(e,t.attribute,c):T&&(e.setCommonStyle(t,t.attribute,y-i,x-n,c),s.lines.forEach((s=>{e.fillText(s.str,(s.leftOffset||0)+r+i,(s.topOffset||0)+l+n,C),this.drawUnderLine(p,g,t,(s.leftOffset||0)+r+i,(s.topOffset||0)+l+n,s.descent,(s.descent-s.ascent)/2,C,c,e,{width:s.width})}))))}else{let{textAlign:i=c.textAlign,textBaseline:n=c.textBaseline}=t.attribute;if(!b){const e=i;i=null!==(h=t.getBaselineMapAlign()[n])&&void 0!==h?h:"left",n=null!==(d=t.getAlignMapBaseline()[e])&&void 0!==d?d:"top"}t.tryUpdateAABBBounds();const s=t.cache,{verticalList:r}=s;e.textAlign="left",e.textBaseline="top";const a=_*r.length;let o=0;r.forEach((t=>{const e=t.reduce(((t,e)=>t+(e.width||0)),0);o=Gt(e,o)}));let l=0,u=0;"bottom"===n?u=-a:"middle"===n&&(u=-a/2),"center"===i?l-=o/2:"right"===i&&(l-=o),r.forEach(((t,e)=>{const n=t.reduce(((t,e)=>t+(e.width||0)),0),s=o-n;let r=l;"center"===i?r+=s/2:"right"===i&&(r+=s),t.forEach((t=>{const{text:i,width:n,direction:s}=t;L(i,a-(e+1)*_+u,r,s),r+=n}))}))}A&&this.restoreTransformUseContext2d(t,c,C,e),this.afterRenderStep(t,e,i,n,k,B,T,S,c,s,a,o)}draw(t,e,i,n){const s=ns(t,null==n?void 0:n.theme).text,{keepDirIn3d:r=s.keepDirIn3d}=t.attribute,a=!r;this._draw(t,s,a,i,n)}drawUnderLine(t,e,i,n,s,r,a,o,l,h,d){if(e+t<=0)return;const{textAlign:c=l.textAlign,fill:u=l.fill,opacity:p=l.opacity,underlineOffset:g=l.underlineOffset,underlineDash:f=l.underlineDash,fillOpacity:v=l.fillOpacity}=i.attribute,m=!it(d),b=m?d.width:i.clipedWidth,y=m?0:fo(c,b),x={lineWidth:0,stroke:u,opacity:p,strokeOpacity:v};if(t){x.lineWidth=t,h.setStrokeStyle(i,x,n,s,l),f&&h.setLineDash(f),h.beginPath();const e=s+r+g;h.moveTo(n+y,e,o),h.lineTo(n+y+b,e,o),h.stroke()}if(e){x.lineWidth=e,h.setStrokeStyle(i,x,n,s,l),h.beginPath();const t=s+a;h.moveTo(n+y,t,o),h.lineTo(n+y+b,t,o),h.stroke()}}};Vl=jl([y(),Yl(0,m(D)),Yl(0,x(po)),Gl("design:paramtypes",[Object])],Vl);var Xl=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Kl=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},$l=function(t,e){return function(i,n){e(i,n,t)}};let ql=class{constructor(t){this.groupRenderContribitions=t,this.numberType=_a}reInit(){this._groupRenderContribitions=this.groupRenderContribitions.getContributions()||[],this._groupRenderContribitions.push(al)}drawShape(t,e,i,n,s,r,a,o){const l=ns(t,null==r?void 0:r.theme).group,{fill:h=l.fill,background:d,stroke:c=l.stroke,opacity:u=l.opacity,width:p=l.width,height:g=l.height,clip:f=l.clip,fillOpacity:v=l.fillOpacity,strokeOpacity:m=l.strokeOpacity,cornerRadius:b=l.cornerRadius,path:y=l.path,lineWidth:x=l.lineWidth,visible:_=l.visible,fillStrokeOrder:w=l.fillStrokeOrder,cornerType:T=l.cornerType,x:S=l.x,y:k=l.y}=t.attribute,B=ro(u,v,p,g,h),A=oo(u,m,p,g),C=io(h,d),L=no(c,x);if(!t.valid||!_)return;if(!f){if(!C&&!L)return;if(!(B||A||a||o||d))return}if(y&&y.length&&s.drawContribution){const t=e.disableFill,i=e.disableStroke,n=e.disableBeginPath;e.disableFill=!0,e.disableStroke=!0,e.disableBeginPath=!0,y.forEach((t=>{s.drawContribution.getRenderContribution(t).draw(t,s.renderService,s,r)})),e.disableFill=t,e.disableStroke=i,e.disableBeginPath=n}else 0===b||ht(b)&&b.every((t=>0===t))?(e.beginPath(),e.rect(i,n,p,g)):(e.beginPath(),ll(e,i,n,p,g,b,"bevel"!==T));this._groupRenderContribitions||(this._groupRenderContribitions=this.groupRenderContribitions.getContributions()||[],this._groupRenderContribitions.push(al));const O={doFill:C,doStroke:L};e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this._groupRenderContribitions.forEach((r=>{r.time===ni.beforeFillStroke&&r.drawShape(t,e,i,n,C,L,B,A,l,s,a,o,O)})),f&&e.clip();const E=()=>{O.doFill&&(a?a(e,t.attribute,l):B&&(e.setCommonStyle(t,t.attribute,S-i,k-n,l),e.fill()))},R=()=>{O.doStroke&&(o?o(e,t.attribute,l):A&&(e.setStrokeStyle(t,t.attribute,S-i,k-n,l),e.stroke()))};w?(R(),E()):(E(),R()),this._groupRenderContribitions.forEach((r=>{r.time===ni.afterFillStroke&&r.drawShape(t,e,i,n,C,L,B,A,l,s,a,o)}))}draw(t,e,i,n){const{context:s}=i;if(!s)return;const{clip:r,baseOpacity:a=1,drawMode:o,x:l,y:h,width:d,height:c}=t.attribute,u=s.nativeContext,p=s.canvas.nativeCanvas;if(o>0){const t=s.canvas,e=cd.createCanvas({width:t.width,height:t.height,dpr:1}),i=e.getContext("2d"),n=s.nativeContext.getTransform();i.setTransform(n.a,n.b,n.c,n.d,n.e,n.f),1===o&&(i.save(),i.clearRect(0,0,t.width,t.height),i.beginPath(),i.rect(l,h,d,c),i.clip(),i.drawImage(t.nativeCanvas,0,0,t.width,t.height,0,0,t.displayWidth,t.displayHeight),i.restore()),s.nativeContext=i,t.nativeCanvas=e}r?s.save():s.highPerformanceSave();const g=s.baseGlobalAlpha;s.baseGlobalAlpha*=a;const f=ns(t,null==n?void 0:n.theme).group,v=s.modelMatrix;if(s.camera){const e=wo.allocate(),i=wo.allocate();Bo(i,t,f),yo(e,v||e,i),s.modelMatrix=e,wo.free(i),s.setTransform(1,0,0,1,0,0,!0)}else s.transformFromMatrix(t.transMatrix,!0);s.beginPath(),n.skipDraw?this.drawShape(t,s,0,0,i,n,(()=>!1),(()=>!1)):this.drawShape(t,s,0,0,i);const{scrollX:m=f.scrollX,scrollY:b=f.scrollY}=t.attribute;let y;if((m||b)&&s.translate(m,b),n&&n.drawingCb&&(y=n.drawingCb()),s.modelMatrix!==v&&wo.free(s.modelMatrix),s.modelMatrix=v,s.baseGlobalAlpha=g,o>0){const t=s.nativeContext,e=s.canvas.nativeCanvas;u.save(),u.setTransform(s.dpr,0,0,s.dpr,0,0,!0),1===o&&t.rect(l,h,d,c),u.drawImage(e,0,0,e.width,e.height,0,0,s.canvas.displayWidth,s.canvas.displayHeight);const i=t.getTransform();u.setTransform(i.a,i.b,i.c,i.d,i.e,i.f),s.nativeContext=u,s.canvas.nativeCanvas=p,u.restore()}y&&y.then?y.then((()=>{r?s.restore():s.highPerformanceRestore()})):r?s.restore():s.highPerformanceRestore()}};ql=Xl([y(),$l(0,m(D)),$l(0,x(ho)),Kl("design:paramtypes",[Object])],ql);const Zl=Symbol.for("IncrementalDrawContribution"),Jl=Symbol.for("GraphicRender"),Ql=Symbol.for("GroupRender"),th=Symbol.for("RectRender"),eh=Symbol.for("SymbolRender"),ih=Symbol.for("TextRender"),nh=Symbol.for("DrawContribution"),sh=(t,e,i,n)=>{let s,r=!1,a=!1;if(e.forEachChildren((t=>(r=t.numberType===ba,!r))),e.forEachChildren((t=>(a=!!t.findFace,!a))),r){const t=e.getChildren(),o=[...t];o.sort(((t,e)=>{var i,n,s,r;let a=(null!==(n=null!==(i=t.attribute.startAngle)&&void 0!==i?i:0+t.attribute.endAngle)&&void 0!==n?n:0)/2,o=(null!==(r=null!==(s=e.attribute.startAngle)&&void 0!==s?s:0+e.attribute.endAngle)&&void 0!==r?r:0)/2;for(;a<0;)a+=zt;for(;o<0;)o+=zt;return o-a})),o.forEach((t=>{t._next=null,t._prev=null})),e.removeAllChild(),e.update(),o.forEach((t=>{e.appendChild(t)})),n.hack_pieFace="outside",s=i(r,a),s&&s.graphic||(n.hack_pieFace="inside",s=i(r,a)),s&&s.graphic||(n.hack_pieFace="top",s=i(r,a)),e.removeAllChild(),t.forEach((t=>{t._next=null,t._prev=null})),t.forEach((t=>{e.appendChild(t)}))}else if(a){const n=e.getChildren(),o=n.map((e=>({ave_z:e.findFace().vertices.map((i=>{var n;return t.view(i[0],i[1],null!==(n=i[2]+e.attribute.z)&&void 0!==n?n:0)[2]})).reduce(((t,e)=>t+e),0),g:e})));o.sort(((t,e)=>e.ave_z-t.ave_z)),e.removeAllChild(),o.forEach((t=>{t.g._next=null,t.g._prev=null})),e.update(),o.forEach((t=>{e.add(t.g)})),s=i(r,a),e.removeAllChild(),n.forEach((t=>{t._next=null,t._prev=null})),e.update(),n.forEach((t=>{e.add(t)}))}else s=i(r,a);return s};var rh=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},ah=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const oh=Symbol.for("DrawItemInterceptor"),lh=new pe,hh=new pe;class dh{constructor(){this.order=1}afterDrawItem(t,e,i,n,s){return null==t.attribute.shadowRootIdx&&t.shadowRoot&&t.shadowRoot.attribute.shadowRootIdx<0||(t.attribute.shadowRootIdx>0||!t.attribute.shadowRootIdx||t.shadowRoot&&t.shadowRoot.attribute.shadowRootIdx>0)&&this.drawItem(t,e,i,n,s),!1}beforeDrawItem(t,e,i,n,s){return null==t.attribute.shadowRootIdx&&t.shadowRoot&&t.shadowRoot.attribute.shadowRootIdx>0||(t.attribute.shadowRootIdx<0||t.shadowRoot&&t.shadowRoot.attribute.shadowRootIdx<0)&&this.drawItem(t,e,i,n,s),!1}drawItem(t,e,i,n,s){if(!t.shadowRoot)return!1;const{context:r}=i;if(r.highPerformanceSave(),r.transformFromMatrix(t.transMatrix,!0),n.dirtyBounds&&n.backupDirtyBounds){lh.copy(n.dirtyBounds),hh.copy(n.backupDirtyBounds);const e=t.globalTransMatrix.getInverse();n.dirtyBounds.copy(n.backupDirtyBounds).transformWithMatrix(e),n.backupDirtyBounds.copy(n.dirtyBounds)}return n.renderGroup(t.shadowRoot,i,_o.allocate(1,0,0,1,0,0)),r.highPerformanceRestore(),n.dirtyBounds&&n.backupDirtyBounds&&(n.dirtyBounds.copy(lh),n.backupDirtyBounds.copy(hh)),!0}}class ch{constructor(){this.order=1}afterDrawItem(t,e,i,n,s){return t.attribute._debug_bounds&&this.drawItem(t,e,i,n,s),!1}drawItem(t,e,i,n,s){if(!t.attribute._debug_bounds)return!1;const{context:r}=i;r.highPerformanceSave(),t.parent&&r.setTransformFromMatrix(t.parent.globalTransMatrix,!0),t.glyphHost&&t.glyphHost.parent&&r.setTransformFromMatrix(t.glyphHost.parent.globalTransMatrix,!0);const a=t.AABBBounds;return!0!==t.attribute._debug_bounds&&t.attribute._debug_bounds(r,t),r.strokeRect(a.x1,a.y1,a.width(),a.height()),r.highPerformanceRestore(),!0}}let uh=class{constructor(){this.order=1,this.interceptors=[new dh,new gh,new ph,new ch]}afterDrawItem(t,e,i,n,s){for(let r=0;r<this.interceptors.length;r++)if(this.interceptors[r].afterDrawItem&&this.interceptors[r].afterDrawItem(t,e,i,n,s))return!0;return!1}beforeDrawItem(t,e,i,n,s){if((!t.in3dMode||i.in3dInterceptor)&&!t.shadowRoot&&!(t.baseGraphic||t.attribute.globalZIndex||t.interactiveGraphic))return!1;for(let r=0;r<this.interceptors.length;r++)if(this.interceptors[r].beforeDrawItem&&this.interceptors[r].beforeDrawItem(t,e,i,n,s))return!0;return!1}};uh=rh([y(),ah("design:paramtypes",[])],uh);class ph{constructor(){this.order=1}beforeDrawItem(t,e,i,n,s){return!this.processing&&(t.baseGraphic?this.beforeDrawInteractive(t,e,i,n,s):this.beforeSetInteractive(t,e,i,n,s))}beforeSetInteractive(t,e,i,n,s){let r=t.interactiveGraphic;if(t.attribute.globalZIndex){r||(r=t.clone(),t.interactiveGraphic=r,r.baseGraphic=t),r.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(r),!0}if(r){i.stage.tryInitInteractiveLayer();const e=i.stage.getLayer("_builtin_interactive");e&&this.getShadowRoot(e).removeChild(r),t.interactiveGraphic=null,r.baseGraphic=null}return!1}beforeDrawInteractive(t,e,i,n,s){const r=t.baseGraphic;let a=!!r.stage,o=r.parent;for(;a&&o&&o.stage!==o;)a=!!o.stage,o=o.parent;if(!a){const e=i.stage.getLayer("_builtin_interactive");return e&&this.getShadowRoot(e).removeChild(t),!0}if(r){this.processing=!0;const{context:t}=i;return t.highPerformanceSave(),t.setTransformFromMatrix(r.parent.globalTransMatrix,!0),r.isContainer?n.renderGroup(r,i,r.parent.globalTransMatrix):n.renderItem(r,i),t.highPerformanceRestore(),this.processing=!1,!0}return!1}getShadowRoot(t){var e;let i=t.getElementById("_interactive_group");return i||(i=Ko.CreateGraphic("group",{}),i.id="_interactive_group",t.add(i)),null!==(e=i.shadowRoot)&&void 0!==e?e:i.attachShadow()}}class gh{constructor(){this.order=1}beforeDrawItem(t,e,i,n,s){if(!t.in3dMode||i.in3dInterceptor)return!1;i.in3dInterceptor=!0;const{context:r,stage:a}=e.drawParams;r.canvas,r.save(),this.initCanvasCtx(r),r.camera=a.camera;const o=r.currentMatrix;o.a/=r.dpr,o.b/=r.dpr,o.c/=r.dpr,o.d/=r.dpr,o.e/=r.dpr,o.f/=r.dpr;const l=wo.allocate();var h,d;d=o,(h=l)[0]=d.a,h[1]=d.b,h[2]=0,h[3]=0,h[4]=d.c,h[5]=d.d,h[6]=0,h[7]=0,h[8]=0,h[9]=0,h[10]=1,h[11]=0,h[12]=d.e,h[13]=d.f,h[14]=0,h[15]=1;const c=r.modelMatrix;if(c){if(l){const t=wo.allocate();r.modelMatrix=yo(t,c,l)}}else r.modelMatrix=l;return r.setTransform(1,0,0,1,0,0,!0),t.isContainer?sh(r,t,((e,s)=>n.renderGroup(t,i,t.parent.globalTransMatrix,!e&&s)),i):n.renderItem(t,i),r.camera=null,r.restore(),r.modelMatrix!==c&&wo.free(r.modelMatrix),r.modelMatrix=c,i.in3dInterceptor=!1,!0}initCanvasCtx(t){t.setTransformForCurrent()}}var fh=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},vh=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},mh=function(t,e){return function(i,n){e(i,n,t)}};const bh=Symbol.for("RenderService");let yh=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))}reInit(){this.drawContribution.reInit()}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),this.drawParams=null}};yh=fh([y(),mh(0,m(nh)),vh("design:paramtypes",[Object])],yh);var xh=new a((t=>{t(bh).to(yh)}));const _h=Symbol.for("PickerService"),wh=Symbol.for("GlobalPickerService"),Th=Symbol.for("PickItemInterceptor"),Sh=Symbol.for("PickServiceInterceptor");var kh=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let Bh=class{constructor(){this.order=1}afterPickItem(t,e,i,n,s){if(t.graphic){let e=t.graphic;for(;e.parent;)e=e.parent;e.shadowHost&&(t.params={shadowTarget:t.graphic},t.graphic=e.shadowHost)}return t}};Bh=kh([y()],Bh);let Ah=class{constructor(){this.order=1}afterPickItem(t,e,i,n,s){return t.attribute.shadowRootIdx>0||!t.attribute.shadowRootIdx?this._pickItem(t,e,i,n,s):null}beforePickItem(t,e,i,n,s){return t.attribute.shadowRootIdx<0?this._pickItem(t,e,i,n,s):null}_pickItem(t,e,i,n,s){var r;if(!t.shadowRoot)return null;const{parentMatrix:a}=s||{};if(!a)return null;const o=e.pickContext;o.highPerformanceSave();const l=null===(r=ns(t))||void 0===r?void 0:r[t.type],{shadowPickMode:h=(null==l?void 0:l.shadowPickMode)}=t.attribute,d=t.shadowRoot,c=_o.allocateByObj(a),u=new qt(c.a*i.x+c.c*i.y+c.e,c.b*i.x+c.d*i.y+c.f),p=e.pickGroup(d,u,c,n);return o.highPerformanceRestore(),!p.graphic&&p.group&&"full"===h&&(p.graphic=p.group),p}};Ah=kh([y()],Ah);let Ch=class{constructor(){this.order=1}beforePickItem(t,e,i,n,s){const r=t.baseGraphic;if(r&&r.parent){const t=new qt(i.x,i.y),s=e.pickContext;s.highPerformanceSave();const a=r.parent.globalTransMatrix;a.transformPoint(t,t);const o=r.isContainer?e.pickGroup(r,t.clone(),a,n):e.pickItem(r,t.clone(),a,n);return s.highPerformanceRestore(),o}return null}};Ch=kh([y()],Ch);let Lh=class{constructor(){this.order=1}beforePickItem(t,e,i,n,s){if(!t.in3dMode||n.in3dInterceptor)return null;const r=e.pickContext,a=t.stage;if(!r||!a)return null;if(n.in3dInterceptor=!0,r.save(),this.initCanvasCtx(r),r.camera=a.camera,t.isContainer){const a=sh(r,t,(()=>e.pickGroup(t,i,s.parentMatrix,n)),n);return r.camera=null,n.in3dInterceptor=!1,r.restore(),a}return r.restore(),null}initCanvasCtx(t){t.setTransformForCurrent()}};Lh=kh([y()],Lh);var Oh=new a(((t,e,i)=>{i(_h)||(t(wh).toSelf(),t(_h).toService(wh)),t(Lh).toSelf().inSingletonScope(),t(Th).toService(Lh),t(Ah).toSelf().inSingletonScope(),t(Th).toService(Ah),t(Ch).toSelf().inSingletonScope(),t(Th).toService(Ch),F(t,Th),t(Bh).toSelf().inSingletonScope(),t(Sh).toService(Bh),F(t,Sh)})),Eh=new a((t=>{t(Ca).to(Ao).inSingletonScope(),t(La).toConstantValue(Ko)}));const Rh=Symbol.for("AutoEnablePlugins"),Mh=Symbol.for("PluginService");var Ph=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Dh=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Ih=function(t,e){return function(i,n){e(i,n,t)}};let Fh=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&&Pn.isBound(Rh)&&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=[]}};Fh=Ph([y(),Ih(0,m(D)),Ih(0,x(Rh)),Dh("design:paramtypes",[Object])],Fh);var Nh=new a((t=>{t(Mh).to(Fh),function(t,e){t(D).toDynamicValue((t=>{let{container:i}=t;return new I(e,i)})).whenTargetNamed(e)}(t,Rh)})),Hh=new a((t=>{F(t,W)})),zh=new a((t=>{t(Rn).to(Mn).inSingletonScope(),F(t,Rn)})),Wh=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Uh=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let jh=class{constructor(){this.type="static",this.offscreen=!1,this.global=xn.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 n=e.getContext().getCanvas().nativeCanvas,s=In({nativeCanvas:t,width:e.width,height:e.height,dpr:e.dpr,id:i.canvasId,canvasControled:!0,container:e.getContainer(),x:n.offsetLeft,y:n.offsetTop});s.applyPosition(),this.canvas=s,this.context=s.getContext()}}resize(t,e){this.canvas.resize(t,e)}resizeView(t,e){}render(t,e,i){var n;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!==(n=e.background)&&void 0!==n?n:"#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 n;const s=t.getContext();i.renderService.render(e,Object.assign(Object.assign({context:s},i),{clear:i.clear?null!==(n=i.background)&&void 0!==n?n:"#fff":void 0}))}getContext(){return this.context}release(){this.canvas.release()}};jh=Wh([y(),Uh("design:paramtypes",[])],jh);var Gh=new a((t=>{t(jh).toSelf(),t(Ka).toService(jh)}));var Yh=function(t,e,i,n){return new(i||(i=Promise))((function(s,r){function a(t){try{l(n.next(t))}catch(t){r(t)}}function o(t){try{l(n.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?s(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((n=n.apply(t,e||[])).next())}))};function Vh(t,e,i){const n={},s=[];return t.forEachChildren((t=>{const{zIndex:i=e}=t.attribute;n[i]?n[i].push(t):(n[i]=[t],s.push(i))}),i),s.sort(((t,e)=>i?e-t:t-e)),{childMap:n,zIdxArray:s}}function Xh(t,e,i){let n=arguments.length>3&&void 0!==arguments[3]&&arguments[3];return Yh(this,void 0,void 0,(function*(){yield t.forEachChildrenAsync(i,n)}))}function Kh(t,e,i){let n=arguments.length>3&&void 0!==arguments[3]&&arguments[3],s=!1;t.forEachChildren(((t,e)=>{const{zIndex:n=i}=t.attribute;if(0===e);else if(void 0!==n)return s=!0,!0;return!1}),n);let r=null,a=!1;if(s){const{childMap:s,zIdxArray:o}=Vh(t,i,n);let l=!1;for(let t=0;t<o.length&&!l;t++){const i=s[o[t]];for(let t=0;t<i.length;t++){if(a){l=!0,r=i[t];break}i[t]._uid!==e||(a=!0)}}}else t.forEachChildren((t=>a?(r=t,!0):(t._uid===e&&(a=!0),!1)),n);return r}var $h=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},qh=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Zh=function(t,e){return function(i,n){e(i,n,t)}};let Jh=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=xn.global,this.layerService=xn.layerService,ht(this.contributions)||(this.contributions=[this.contributions]),this.init()}reInit(){this.init(),this.contributions.forEach((t=>{t.reInit()}))}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:n,viewBox:s,transMatrix:r}=e;if(!i)return;const a=this.dirtyBounds.setValue(0,0,s.width(),s.height());if(n.dirtyBounds&&!n.dirtyBounds.empty()){const t=Qt(a,n.dirtyBounds,!1);a.x1=Math.floor(t.x1),a.y1=Math.floor(t.y1),a.x2=Math.ceil(t.x2),a.y2=Math.ceil(t.y2)}const o=i.dpr%1;(o||.5!==o)&&(a.x1=Math.floor(a.x1*i.dpr)/i.dpr,a.y1=Math.floor(a.y1*i.dpr)/i.dpr,a.x2=Math.ceil(a.x2*i.dpr)/i.dpr,a.y2=Math.ceil(a.y2*i.dpr)/i.dpr),this.backupDirtyBounds.copy(a),i.inuse=!0,i.setClearMatrix(r.a,r.b,r.c,r.d,r.e,r.f),i.clearMatrix(),i.setTransformForCurrent(!0),i.translate(s.x1,s.y1,!0),i.beginPath(),i.rect(a.x1,a.y1,a.width(),a.height()),i.clip(),n.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,n;return(null!==(i=t.attribute.zIndex)&&void 0!==i?i:sn.zIndex)-(null!==(n=e.attribute.zIndex)&&void 0!==n?n:sn.zIndex)})).forEach((t=>{t.isContainer?this.renderGroup(t,e,_o.allocate(1,0,0,1,0,0)):this.renderItem(t,e)})),i.restore(),i.setClearMatrix(1,0,0,1,0,0),i.inuse=!1,i.draw()}doRegister(){throw new Error("暂不支持")}_findNextGraphic(t){let e=t.parent,i=t._uid;for(;e;){const t=Kh(e,i,sn.zIndex);if(t)return t;i=e._uid,e=e.parent}return null}renderGroup(t,e,i,n){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&&!ne(t.AABBBounds,this.dirtyBounds,!1)&&"empty"!==t.attribute.boundsMode)return;let s,r=i;if(this.useDirtyBounds){s=Wl.allocateByObj(this.dirtyBounds);const e=t.transMatrix;r=_o.allocateByObj(i).multiply(e.a,e.b,e.c,e.d,e.e,e.f),this.dirtyBounds.copy(this.backupDirtyBounds).transformWithMatrix(r.getInverse())}this.renderItem(t,e,{drawingCb:()=>{var i;n?t.forEachChildren((t=>{e.break||(t.isContainer?this.renderGroup(t,e,r):this.renderItem(t,e))})):function(t,e,i){let n=arguments.length>3&&void 0!==arguments[3]&&arguments[3],s=arguments.length>4&&void 0!==arguments[4]&&arguments[4],r=!1;if(s)r=!0;else{let i;t.forEachChildren(((t,n)=>{const{zIndex:s=e}=t.attribute;if(0===n)i=s;else if(i!==s)return r=!0,!0;return!1}),n)}if(r){const{childMap:r,zIdxArray:a}=Vh(t,e,n);let o=!1;for(let t=0;t<a.length&&!o;t++){const e=r[a[t]];s&&e.sort(((t,e)=>{var i,s;return(n?-1:1)*((null!==(i=e.attribute.z)&&void 0!==i?i:0)-(null!==(s=t.attribute.z)&&void 0!==s?s:0))}));for(let t=0;t<e.length;t++)if(i(e[t],t)){o=!0;break}}}else t.forEachChildren(i,n)}(t,sn.zIndex,(t=>{e.break||(t.isContainer?this.renderGroup(t,e,r):this.renderItem(t,e))}),!1,!!(null===(i=e.context)||void 0===i?void 0:i.camera))}}),this.useDirtyBounds&&(this.dirtyBounds.copy(s),Wl.free(s),_o.free(r))}_increaseRender(t,e){const{layer:i,stage:n}=e,{subLayers:s}=i;let r=s.get(t._uid);r||(r={layer:this.layerService.createLayer(n),zIndex:s.size,group:t},s.set(t._uid,r));const a=r.layer.getNativeHandler().getContext(),o=r.drawContribution||Pn.get(Zl);o.dirtyBounds.setValue(-1/0,-1/0,1/0,1/0),o.backupDirtyBounds.setValue(-1/0,-1/0,1/0,1/0),o.draw(this.currentRenderService,Object.assign(Object.assign({},e),{drawContribution:o,clear:"transparent",layer:r.layer,context:a,startAtId:t._uid,break:!1})),r.drawContribution=o;const l=this._findNextGraphic(t);if(l)if(l.isContainer&&l.incremental)this._increaseRender(l,e);else{let t=s.get(l._uid);t||(t={layer:this.layerService.createLayer(n),zIndex:s.size},s.set(l._uid,t));const i=t.layer.getNativeHandler().getContext();this.draw(this.currentRenderService,Object.assign(Object.assign({},e),{drawContribution:o,clear:"transparent",layer:t.layer,context:i,startAtId:l._uid,break:!1}))}}getRenderContribution(t){let e;return e||(e=this.selectRenderByNumberType(t.numberType,t)),e||(e=this.selectRenderByType(t.type)),e}renderItem(t,e,i){if(this.InterceptorContributions.length)for(let n=0;n<this.InterceptorContributions.length;n++){const s=this.InterceptorContributions[n];if(s.beforeDrawItem&&s.beforeDrawItem(t,this.currentRenderService,e,this,i))return}const n=this.getRenderContribution(t);if(!n)return;let s,r=this.scrollMatrix&&(0!==this.scrollMatrix.e||0!==this.scrollMatrix.f);if(t.parent){const{scrollX:e=0,scrollY:i=0}=t.parent.attribute;(e||i)&&(r=!0,this.scrollMatrix||(this.scrollMatrix=_o.allocate(1,0,0,1,0,0)),this.scrollMatrix.translate(-e,-i))}if(r&&(s=this.dirtyBounds.clone().transformWithMatrix(this.scrollMatrix)),this.useDirtyBounds&&!t.isContainer&&"empty"!==t.attribute.boundsMode&&!ne(t.AABBBounds,null!=s?s:this.dirtyBounds,!1)){if(r&&t.parent){const{scrollX:e=0,scrollY:i=0}=t.parent.attribute;this.scrollMatrix&&this.scrollMatrix.translate(e,i)}return}const a=null!=e.startAtId&&t._uid!==e.startAtId;if(t._uid===e.startAtId&&(e.startAtId=null),i&&(i.skipDraw=a),a?t.isContainer&&n.draw(t,this.currentRenderService,e,i):n.draw(t,this.currentRenderService,e,i),r&&t.parent){const{scrollX:e=0,scrollY:i=0}=t.parent.attribute;this.scrollMatrix&&this.scrollMatrix.translate(e,i)}if(this.InterceptorContributions.length)for(let i=0;i<this.InterceptorContributions.length;i++){const n=this.InterceptorContributions[i];if(n.afterDrawItem&&n.afterDrawItem(t,this.currentRenderService,e,this))return}}selectRenderByType(t){return Ot.getInstance().warn("未知错误,不应该走到这里"),null}selectRenderByNumberType(t,e){let i;if(e.attribute.renderStyle){const n=this.styleRenderMap.get(e.attribute.renderStyle);i=n&&n.get(t)}return i||this.currentRenderMap.get(t)||this.defaultRenderMap.get(t)}clearScreen(t,e,i){var n,s;const{clear:r,viewBox:a}=i,o=a.width(),l=a.height();if(r){e.clearRect(0,0,o,l);const i=null===(n=t.drawParams)||void 0===n?void 0:n.stage;if(i&&(e.globalAlpha=null!==(s=i.attribute.opacity)&&void 0!==s?s:1),i&&i.backgroundImg&&i.resources){const t=i.resources.get(r);t&&"success"===t.state&&t.data&&e.drawImage(t.data,0,0,o,l)}else e.fillStyle=Sn(e,r,{AABBBounds:{x1:0,y1:0,x2:0+o,y2:0+l}},0,0),e.fillRect(0,0,o,l)}}afterDraw(t,e){}};Jh=$h([y(),Zh(0,b(Jl)),Zh(1,m(D)),Zh(1,x(oh)),qh("design:paramtypes",[Array,Object])],Jh);var Qh=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let td=class extends kl{constructor(){super(...arguments),this.numberType=Ta}drawShape(t,e,i,n,s,r,a,o){if(t.incremental&&s.multiGraphicOptions){const{startAtIdx:e,length:r}=s.multiGraphicOptions,{segments:l=[]}=t.attribute;if(e>l.length)return;const h=ns(t).line,{fill:d=h.fill,stroke:c=h.stroke,opacity:u=h.opacity,fillOpacity:p=h.fillOpacity,strokeOpacity:g=h.strokeOpacity,lineWidth:f=h.lineWidth,visible:v=h.visible}=t.attribute,m=so(u,p,d),b=ao(u,g),y=io(d),x=no(c,f);if(!t.valid||!v)return;if(!y&&!x)return;if(!(m||b||a||o))return;const{context:_}=s;for(let s=e;s<e+r;s++)this.drawIncreaseSegment(t,_,l[s-1],l[s],t.attribute.segments[s],[h,t.attribute],i,n)}else super.drawShape(t,e,i,n,s,r,a,o)}drawIncreaseSegment(t,e,i,n,s,r,a,o){n&&(e.beginPath(),function(t,e,i,n){const{offsetX:s=0,offsetY:r=0}=n||{},a=e?e.points[e.points.length-1]:i.points[0];t.moveTo(a.x+s,a.y+r),i.points.forEach((e=>{!1!==e.defined?t.lineTo(e.x+s,e.y+r):t.moveTo(e.x+s,e.y+r)}))}(e.nativeContext,i,n,{offsetX:a,offsetY:o}),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,s,r),e.setStrokeStyle(t,s,a,o,r),e.stroke())}};td=Qh([y()],td);var ed=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let id=class extends Rl{constructor(){super(...arguments),this.numberType=ya}drawShape(t,e,i,n,s,r,a){if(t.incremental&&s.multiGraphicOptions){const{startAtIdx:r,length:o}=s.multiGraphicOptions,{segments:l=[]}=t.attribute;if(r>l.length)return;const h=ns(t).area,{fill:d=h.fill,fillOpacity:c=h.fillOpacity,opacity:u=h.opacity,visible:p=h.visible}=t.attribute,g=so(u,c,d),f=io(d);if(!t.valid||!p)return;if(!f)return;if(!g&&!a)return;for(let s=r;s<r+o;s++)this.drawIncreaseSegment(t,e,l[s-1],l[s],t.attribute.segments[s],[h,t.attribute],i,n)}else super.drawShape(t,e,i,n,s,r,a)}drawIncreaseSegment(t,e,i,n,s,r,a,o){n&&(e.beginPath(),function(t,e,i,n){const{offsetX:s=0,offsetY:r=0}=n||{},{points:a}=i,o=[];for(let t=0;t<a.length;t++)a[t].defined;o.push(a),o.forEach(((i,n)=>{var a,o,l,h;const d=e&&0===n?e.points[e.points.length-1]:i[0];t.moveTo(d.x+s,d.y+r),i.forEach((e=>{!1!==e.defined?t.lineTo(e.x+s,e.y+r):t.moveTo(e.x+s,e.y+r)}));for(let e=i.length-1;e>=0;e--){const n=i[e];t.lineTo(null!==(a=n.x1)&&void 0!==a?a:n.x,null!==(o=n.y1)&&void 0!==o?o:n.y)}t.lineTo(null!==(l=d.x1)&&void 0!==l?l:d.x,null!==(h=d.y1)&&void 0!==h?h:d.y),t.closePath()}))}(e.camera?e:e.nativeContext,i,n,{offsetX:a,offsetY:o}),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,s,r),e.setCommonStyle(t,s,a,o,r),e.fill())}};id=ed([y()],id);var nd,sd=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},rd=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},ad=function(t,e){return function(i,n){e(i,n,t)}},od=function(t,e,i,n){return new(i||(i=Promise))((function(s,r){function a(t){try{l(n.next(t))}catch(t){r(t)}}function o(t){try{l(n.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?s(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((n=n.apply(t,e||[])).next())}))};!function(t){t[t.NORMAL=0]="NORMAL",t[t.STOP=1]="STOP"}(nd||(nd={}));let ld=class extends Jh{constructor(t,e,i,n){super(t,n),this.contributions=t,this.lineRender=e,this.areaRender=i,this.drawItemInterceptorContributions=n,this.rendering=!1,this.currFrameStartAt=0,this.currentIdx=0,this.status=nd.NORMAL,this.checkingForDrawPromise=null,this.hooks={completeDraw:new z([])},this.defaultRenderMap.set(this.lineRender.numberType,this.lineRender),this.defaultRenderMap.set(this.areaRender.numberType,this.areaRender)}draw(t,e){return od(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:n,viewBox:s}=e;n&&(n.inuse=!0,n.clearMatrix(),n.setTransformForCurrent(!0),n.save(),e.restartIncremental&&this.clearScreen(this.currentRenderService,n,e),n.translate(s.x1,s.y1,!0),n.save(),t.renderTreeRoots.sort(((t,e)=>{var i,n;return(null!==(i=t.attribute.zIndex)&&void 0!==i?i:sn.zIndex)-(null!==(n=e.attribute.zIndex)&&void 0!==n?n:sn.zIndex)})).forEach((t=>{this.renderGroup(t,e)})),this.hooks.completeDraw.tap("top-draw",(()=>{n.restore(),n.restore(),n.draw(),n.inuse=!1,this.rendering=!1})))}))}_increaseRender(t,e){return od(this,void 0,void 0,(function*(){this.rendering=!0,yield this._renderIncrementalGroup(t,e)}))}_renderIncrementalGroup(t,e){return od(this,void 0,void 0,(function*(){this.count=t.count,yield new Promise((i=>{this.renderItem(t,e,{drawingCb:()=>od(this,void 0,void 0,(function*(){if(2!==t.count)yield Xh(t,sn.zIndex,((i,n)=>{if(this.status===nd.STOP)return!0;if(i.isContainer)return!1;if(n<this.currentIdx)return!1;const s=this.currFrameStartAt+t.incremental;return n<s&&(this.currentIdx=n+1,this.renderItem(i,e)),n===s-1&&(this.currFrameStartAt=this.currentIdx,this.waitToNextFrame())})),i(!1);else{const n=t.getChildAt(0);if(n.incremental&&n.attribute.segments)for(n.incrementalAt||(n.incrementalAt=0);n.incrementalAt<n.attribute.segments.length;)e.multiGraphicOptions={startAtIdx:n.incrementalAt,length:n.incremental},this.renderItem(n,e),n.incrementalAt+=n.incremental,yield this.waitToNextFrame();else this.renderItem(n,e);i(!1)}}))})})),this.hooks.completeDraw.call()}))}waitToNextFrame(){return od(this,void 0,void 0,(function*(){return new Promise((t=>{this.global.getRequestAnimationFrame()((()=>{t(!1)}))}))}))}checkForDraw(t){return od(this,void 0,void 0,(function*(){let e=this.rendering;return t.restartIncremental&&(e=!1,yield this.forceStop(),this.resetToInit()),e}))}forceStop(){return od(this,void 0,void 0,(function*(){this.rendering&&(this.status=nd.STOP,yield new Promise((t=>{this.hooks.completeDraw.tap("stopCb",(()=>{this.status=nd.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 od(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:()=>od(this,void 0,void 0,(function*(){yield Xh(t,sn.zIndex,(t=>od(this,void 0,void 0,(function*(){e.break||t.isContainer&&(yield this.renderGroup(t,e))})))),i(!1)}))})})))}))}};ld=sd([y(),ad(0,b(Jl)),ad(1,m(td)),ad(2,m(id)),ad(3,m(D)),ad(3,x(oh)),rd("design:paramtypes",[Array,Object,Object,Object])],ld);var hd=new a((t=>{t(Qo).toSelf().inSingletonScope(),t(sl).toSelf().inSingletonScope(),t(nh).to(Jh),t(Zl).to(ld),t(Ql).to(ql).inSingletonScope(),t(Jl).toService(Ql),F(t,ho),t(el).toSelf().inSingletonScope(),F(t,go),F(t,Jl),t(uh).toSelf().inSingletonScope(),t(oh).toService(uh),F(t,oh)}));function dd(){dd.__loaded||(dd.__loaded=!0,Pn.load(eo),Pn.load(Eh),Pn.load(xh),Pn.load(Oh),Pn.load(Nh),function(t){t.load(Hh),t.load(zh),t.load(Gh)}(Pn),function(t){t.load(hd)}(Pn))}dd.__loaded=!1,dd();const cd=Pn.get(U);xn.global=cd;const ud=Pn.get(Va);xn.graphicUtil=ud;const pd=Pn.get(Ya);xn.transformUtil=pd;const gd=Pn.get(Ca);xn.graphicService=gd;const fd=Pn.get(Xa);xn.layerService=fd;class vd{constructor(){this.name="AutoRenderPlugin",this.activeEvent="onRegister",this._uid=r.GenAutoIncrementId(),this.key=this.name+this._uid,this.handleChange=t=>{t.glyphHost&&(t=t.glyphHost),t.stage===this.pluginService.stage&&null!=t.stage&&t.stage.renderNextFrame()}}activate(t){this.pluginService=t,xn.graphicService.hooks.onAttributeUpdate.tap(this.key,this.handleChange),xn.graphicService.hooks.onSetStage.tap(this.key,this.handleChange),xn.graphicService.hooks.onRemove.tap(this.key,this.handleChange)}deactivate(t){const e=t=>t.filter((t=>t.name!==this.key));xn.graphicService.hooks.onAttributeUpdate.taps=e(xn.graphicService.hooks.onAttributeUpdate.taps),xn.graphicService.hooks.onSetStage.taps=e(xn.graphicService.hooks.onSetStage.taps),xn.graphicService.hooks.onRemove.taps=e(xn.graphicService.hooks.onRemove.taps)}}class md{constructor(){this.name="AutoRefreshPlugin",this.activeEvent="onRegister",this._uid=r.GenAutoIncrementId(),this.key=this.name+this._uid,this.handleChange=t=>{t.glyphHost&&(t=t.glyphHost),t.stage===this.pluginService.stage&&null!=t.stage&&t.stage.renderNextFrame()}}activate(t){this.pluginService=t,this.dpr=xn.global.devicePixelRatio,this.refresh()}refresh(){this._refreshByMediaQuery()||this._refreshByRaf()}_refreshByRaf(){const t=xn.global.getRequestAnimationFrame();this.rafId=t((()=>{xn.global.devicePixelRatio!==this.dpr&&(this.dpr=xn.global.devicePixelRatio,this.pluginService.stage.setDpr(this.dpr,!0)),this.refresh()}))}_refreshByMediaQuery(){try{const t=`(resolution: ${window.devicePixelRatio}dppx)`,e=()=>{window.devicePixelRatio!==this.dpr&&(this.dpr=window.devicePixelRatio,this.pluginService.stage.setDpr(this.dpr,!0))},i=matchMedia(t);i&&i.addEventListener("change",e),this.autoRefreshCbs||(this.autoRefreshCbs=[]),this.autoRefreshCbs.push((()=>{i&&i.removeEventListener("change",e)}))}catch(t){return!1}return!0}deactivate(t){var e;const i=xn.global.getCancelAnimationFrame();i&&this.rafId&&i(this.rafId),null===(e=this.autoRefreshCbs)||void 0===e||e.forEach((t=>{t()})),this.autoRefreshCbs=void 0}}class bd{constructor(){this.name="IncrementalAutoRenderPlugin",this.activeEvent="onRegister",this.nextFrameRenderGroupSet=new Set,this.willNextFrameRender=!1,this.nextUserParams={},this._uid=r.GenAutoIncrementId(),this.key=this.name+this._uid}activate(t){this.pluginService=t,xn.graphicService.hooks.onAddIncremental.tap(this.key,((e,i,n)=>{e.glyphHost&&(e=e.glyphHost),e.stage===t.stage&&null!=e.stage&&(this.nextUserParams.startAtId=i._uid,this.renderNextFrame(i))})),xn.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){xn.graphicService.hooks.onAddIncremental.taps=xn.graphicService.hooks.onAddIncremental.taps.filter((t=>t.name!==this.key)),xn.graphicService.hooks.onClearIncremental.taps=xn.graphicService.hooks.onClearIncremental.taps.filter((t=>t.name!==this.key))}renderNextFrame(t){this.nextFrameRenderGroupSet.add(t),this.willNextFrameRender||(this.willNextFrameRender=!0,xn.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 n=e.layer.subLayers.get(e._uid);n&&n.drawContribution&&n.drawContribution.draw(t.renderService,Object.assign({stage:t,layer:i,viewBox:t.window.getViewBox(),transMatrix:t.window.getViewBoxTransform(),clear:"transparent",renderService:t.renderService,updateBounds:!1,startAtId:e._uid,context:n.layer.getNativeHandler().getContext()},this.nextUserParams))})),this.nextUserParams={},this.nextFrameRenderGroupSet.clear())}}const yd=new pe;class xd{constructor(){this.name="DirtyBoundsPlugin",this.activeEvent="onRegister",this._uid=r.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()})),xn.graphicService.hooks.beforeUpdateAABBBounds.tap(this.key,((t,e,i,n)=>{t.glyphHost&&(t=t.glyphHost),e&&e===this.pluginService.stage&&e.renderCount&&(t.isContainer&&!t.shouldSelfChangeUpdateAABBBounds()||i&&(yd.setValue(n.x1,n.y1,n.x2,n.y2),e.dirty(yd,t.parent&&t.parent.globalTransMatrix)))})),xn.graphicService.hooks.afterUpdateAABBBounds.tap(this.key,((t,e,i,n,s)=>{e&&e===this.pluginService.stage&&e.renderCount&&(t.isContainer&&!s||e.dirty(n.globalAABBBounds))})),xn.graphicService.hooks.clearAABBBounds.tap(this.key,((t,e,i)=>{e&&e===this.pluginService.stage&&e.renderCount&&e&&e.dirty(i)})),xn.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){xn.graphicService.hooks.beforeUpdateAABBBounds.taps=xn.graphicService.hooks.beforeUpdateAABBBounds.taps.filter((t=>t.name!==this.key)),xn.graphicService.hooks.afterUpdateAABBBounds.taps=xn.graphicService.hooks.afterUpdateAABBBounds.taps.filter((t=>t.name!==this.key)),xn.graphicService.hooks.clearAABBBounds.taps=xn.graphicService.hooks.clearAABBBounds.taps.filter((t=>t.name!==this.key)),t.stage.hooks.afterRender.taps=t.stage.hooks.afterRender.taps.filter((t=>t.name!==this.key)),xn.graphicService.hooks.onRemove.taps=xn.graphicService.hooks.onRemove.taps.filter((t=>t.name!==this.key))}}const _d=new class extends J{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]:[];super(),this.handleTick=(t,e)=>{const{once:i=!1}=null!=e?e:{};this.ifCanStop()?this.stop():(this._handlerTick(),i||t.tick(this.interval,this.handleTick))},this._handlerTick=()=>{const t=this.tickerHandler.getTime();let e=0;this.lastFrameTime>=0&&(e=t-this.lastFrameTime),this.lastFrameTime=t,this.status===vs.RUNNING&&(this.tickCounts++,this.timelines.forEach((t=>{t.tick(e)})),this.emit("tick"))},this.init(),this.lastFrameTime=-1,this.tickCounts=0,this.timelines=t,this.autoStop=!0}init(){this.interval=NaN,this.status=vs.INITIAL,xn.global.hooks.onSetEnv.tap("default-ticker",(()=>{this.initHandler()})),xn.global.env&&this.initHandler()}addTimeline(t){this.timelines.push(t)}remTimeline(t){this.timelines=this.timelines.filter((e=>e!==t))}getTimelines(){return this.timelines}initHandler(){if(this._mode)return null;const t=[{mode:"raf",cons:ms},{mode:"timeout",cons:bs}];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 ms;break;case"timeout":t=new bs;break;default:Ot.getInstance().warn("非法的计时器模式"),t=new ms}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!==vs.INITIAL&&(this.status=vs.PAUSE,!0)}resume(){return this.status!==vs.INITIAL&&(this.status=vs.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===vs.RUNNING)return!1;if(!this.tickerHandler)return!1;if(!t){if(this.status===vs.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=vs.RUNNING,this.tickerHandler.tick(0,this.handleTick),!0}stop(){this.status=vs.INITIAL,this.setupTickHandler(),this.lastFrameTime=-1}release(){this.stop(),this.timelines=[],this.tickerHandler.release(),this.emit("afterTick")}trySyncTickStatus(){this.status===vs.RUNNING&&this._handlerTick()}};let wd;function Td(){!function(){if(null==wd)try{const t=document.createElement("canvas"),e=t.getContext("2d");wd=!!(window&&t.getBoundingClientRect&&requestAnimationFrame&&window.devicePixelRatio&&e&&e.isPointInPath&&e.isPointInStroke),wd&&(wd=!!document.createElement)}catch(t){wd=!1}}();const t=xn.global&&xn.global.env;return t?"browser"===t:wd}_d.addTimeline(ws),_d.setFPS(60);class Sd{static registerPlugin(t,e){Sd._pluginClasses[t]=e}static getPlugin(t){return Sd._pluginClasses[t]}}Sd._pluginClasses={};const kd="white";class Bd extends Ua{set viewBox(t){this.window.setViewBox(t)}get viewBox(){return this.window.getViewBox()}get x(){return this.window.getViewBox().x1}set x(t){const e=this.window.getViewBox();e.translate(t-e.x1,0),this.window.setViewBox(e)}get y(){return this.window.getViewBox().y1}set y(t){const e=this.window.getViewBox();e.translate(0,t-e.y1),this.window.setViewBox(e)}get width(){return this.window.width}set width(t){this.resize(t,this.height)}get viewWidth(){return this.window.getViewBox().width()}set viewWidth(t){this.resizeView(t,this.viewHeight)}get viewHeight(){return this.window.getViewBox().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:kd}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.tickedBeforeRender=!0,this._onVisibleChange=t=>{if(!(this._skipRender<0))if(t){if(this.dirtyBounds){const t=this.window.getViewBox();this.dirtyBounds.setValue(t.x1,t.y1,t.width(),t.height())}this._skipRender>1&&this.renderNextFrame(),this._skipRender=0}else 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.tickedBeforeRender=!1},this.afterTickCb=()=>{var t;this.tickedBeforeRender=!0,"performance"===(null===(t=this.params.optimize)||void 0===t?void 0:t.tickRenderMode)||"rendering"!==this.state&&this.render()},this.params=t,this.theme=new es,this.hooks={beforeRender:new z(["stage"]),afterRender:new z(["stage"])},this.global=xn.global,!this.global.env&&Td()&&this.global.setEnv("browser"),this.window=Pn.get(Wn),this.renderService=Pn.get(bh),this.pluginService=Pn.get(Mh),this.layerService=Pn.get(Xa),this.pluginService.active(this,t),this.window.create({width:t.width,height:t.height,viewBox:t.viewBox,container:t.container,dpr:t.dpr||this.global.devicePixelRatio,canvasControled:!1!==t.canvasControled,title:t.title||"",canvas:t.canvas}),this.state="normal",this.renderCount=0,this.tryInitEventSystem(),this._background=null!==(e=t.background)&&void 0!==e?e:kd,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(),t.autoRefresh&&this.enableAutoRefresh(),!1===t.disableDirtyBounds&&this.enableDirtyBounds(),t.enableHtmlAttribute&&this.enableHtmlAttribute(t.enableHtmlAttribute),t.ReactDOM&&this.enableReactAttribute(t.ReactDOM),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||_d,this.supportInteractiveLayer=!1!==t.interactiveLayer,this.timeline=new _s,this.ticker.addTimeline(this.timeline),this.timeline.pause(),t.optimize||(t.optimize={}),this.optmize(t.optimize),t.background&&lt(this._background)&&this._background.includes("/")&&this.setAttributes({background:this._background}),this.ticker.on("afterTick",this.afterTickCb)}pauseRender(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:-1;this._skipRender=t}resumeRender(){this._skipRender=0}tryInitEventSystem(){this.global.supportEvent&&!this._eventSystem&&(this._eventSystem=new fs(Object.assign({targetElement:this.window,resolution:this.window.dpr||this.global.devicePixelRatio,rootNode:this,global:this.global,supportsPointerEvents:this.params.supportsPointerEvents,supportsTouchEvents:this.params.supportsTouchEvents},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:n=0,beta:s=0,camera:r,fieldRatio:a=1,fieldDepth:o}=t;return Object.assign(Object.assign({},t),{center:e,light:i,alpha:n,beta:s,camera:r,fieldRatio:a,fieldDepth:o})}set3dOptions(t){var e,i,n,s,r,a;this.option3d=t;const o=this.get3dOptions(t),{light:l,center:h,camera:d,alpha:c,beta:u,fieldRatio:p,fieldDepth:g}=o,{dir:f=[1,1,-1],color:v="white",ambient:m}=l,b=(null!==(e=h.x)&&void 0!==e?e:this.width/2)+(null!==(i=h.dx)&&void 0!==i?i:0),y=(null!==(n=h.y)&&void 0!==n?n:this.height/2)+(null!==(s=h.dy)&&void 0!==s?s:0),x=[b,y,(null!==(r=h.z)&&void 0!==r?r:0)+(null!==(a=h.dz)&&void 0!==a?a:0)];let _=0,w=0,T=0;d||(_=Math.sin(c)+b,w=Math.sin(u)+y,T=Math.cos(c)*Math.cos(u)*1);const S=Sd.getPlugin("DirectionalLight");S&&(this.light=new S(f,v,m));const k={left:0,right:this.width,top:0,bottom:this.height,fieldRatio:p,fieldDepth:g,viewParams:{pos:[_,w,T],center:x,up:[0,1,0]}};if(this.camera)this.camera.params=k;else{const t=Sd.getPlugin("OrthoCamera");t&&(this.camera=new t(k))}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(){if(this.view3dTranform)return;this.view3dTranform=!0;const t=Sd.getPlugin("ViewTransform3dPlugin");t&&this.pluginService.register(new t)}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 vd))}disableAutoRender(){this.autoRender&&(this.autoRender=!1,this.pluginService.findPluginsByName("AutoRenderPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableAutoRefresh(){this.autoRefresh||(this.autoRefresh=!0,this.pluginService.register(new md))}disableAutoRefresh(){this.autoRefresh&&(this.autoRefresh=!1,this.pluginService.findPluginsByName("AutoRefreshPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableIncrementalAutoRender(){this.increaseAutoRender||(this.increaseAutoRender=!0,this.pluginService.register(new bd))}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 xd,this.pluginService.register(t))}disableDirtyBounds(){this.dirtyBounds&&(this.dirtyBounds=null,this.pluginService.findPluginsByName("DirtyBoundsPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableLayout(){if(this._enableLayout)return;this._enableLayout=!0;const t=Sd.getPlugin("FlexLayoutPlugin");t&&this.pluginService.register(new t)}disableLayout(){this._enableLayout&&(this._enableLayout=!1,this.pluginService.findPluginsByName("FlexLayoutPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableHtmlAttribute(t){if(this.htmlAttribute)return;const e=Sd.getPlugin("HtmlAttributePlugin");e&&(this.htmlAttribute=t,this.pluginService.register(new e))}disableHtmlAttribute(){this.htmlAttribute&&(this.htmlAttribute=!1,this.pluginService.findPluginsByName("HtmlAttributePlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableReactAttribute(t){if(this.reactAttribute)return;const e=Sd.getPlugin("ReactAttributePlugin");e&&(this.reactAttribute=t,this.pluginService.register(new e))}disableReactAttribute(){this.reactAttribute&&(this.reactAttribute=!1,this.pluginService.findPluginsByName("ReactAttributePlugin").forEach((t=>{this.pluginService.unRegister(t)})))}getPluginsByName(t){return this.pluginService.findPluginsByName(t)}tryUpdateAABBBounds(){const t=this.window.getViewBox();return this._AABBBounds.setValue(t.x1,t.y1,t.x2,t.y2),this._AABBBounds}combineLayer(t,e){throw new Error("暂不支持")}createLayer(t,e){if("released"===this.releaseStatus)return;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(){"released"!==this.releaseStatus&&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(t)}render(t,e){if("released"===this.releaseStatus)return;this.ticker.start(),this.timeline.resume();const i=this.state;this.state="rendering",this.tickedBeforeRender||this.ticker.trySyncTickStatus(),this.layerService.prepareStageLayer(this),this._skipRender||(this.lastRenderparams=e,this.hooks.beforeRender.call(this),this._skipRender||(this.renderLayerList(this.children),this.combineLayersToWindow(),this.nextFrameRenderLayerSet.clear()),this.hooks.afterRender.call(this)),this.state=i,this._skipRender&&this._skipRender++}combineLayersToWindow(){if("harmony"===this.global.env){const t=this.window.getContext().nativeContext;this.forEachChildren(((e,i)=>{if(i>0){const i=e.getNativeHandler().getContext().canvas.nativeCanvas.nativeCanvas._c.transferToImageBitmap();t.transferFromImageBitmap(i)}}))}}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(){if("released"===this.releaseStatus)return;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._skipRender||(this.renderLayerList(Array.from(this.nextFrameRenderLayerSet.values()),this.lastRenderparams||{}),this.combineLayersToWindow(),this.nextFrameRenderLayerSet.clear()),this.hooks.afterRender.call(this)),this.state=t,this._skipRender&&this._skipRender++}renderLayerList(t,e){const i=[];for(let e=0;e<t.length;e++){let n=t[e];"virtual"===n.layerMode&&(n=n.getNativeHandler().mainHandler.layer),i.includes(n)||i.push(n)}i.forEach((t=>{t.renderCount>this.renderCount||(t.renderCount=this.renderCount+1,t===this.interactiveLayer&&this.dirtyBounds&&this.dirtyBounds.clear(),t.render({renderService:this.renderService,background:t===this.defaultLayer?this.background:void 0,updateBounds:!(!this.dirtyBounds||this.dirtyBounds.empty()),viewBox:this.window.getViewBox(),transMatrix:this.window.getViewBoxTransform()},Object.assign({renderStyle:this.renderStyle},e)))})),this.interactiveLayer&&!t.includes(this.interactiveLayer)&&(this.dirtyBounds&&this.dirtyBounds.clear(),this.interactiveLayer.render({renderService:this.renderService,updateBounds:!(!this.dirtyBounds||this.dirtyBounds.empty()),viewBox:this.window.getViewBox(),transMatrix:this.window.getViewBoxTransform()},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];"released"!==this.releaseStatus&&(this.window.hasSubView()||this.viewBox.setValue(this.viewBox.x1,this.viewBox.y1,this.viewBox.x1+t,this.viewBox.y1+e),this.window.resize(t,e),this.forEachChildren((i=>{i.resize(t,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];"released"!==this.releaseStatus&&(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,n,s){let r=!0;"object"==typeof t?(this.viewBox.setValue(t.x1,t.y1,t.x2,t.y2),!1===e&&(r=!1)):(this.viewBox.setValue(t,e,t+i,e+n),!1===s&&(r=!1)),this.forEachChildren((t=>{t.resizeView(this.viewBox.width(),this.viewBox.height())})),r&&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){if("released"===this.releaseStatus)return;const i=this.getPickerService().pick(this.children,new qt(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.hooks.beforeRender.unTap("constructor",this.beforeRender),this.hooks.afterRender.unTap("constructor",this.afterRender),this.eventSystem&&this.eventSystem.release(),this.layerService.releaseStage(this),this.pluginService.release(),this.forEach((t=>{t.release()})),this.interactiveLayer&&(this.interactiveLayer.forEachChildren((t=>{t.setStage&&t.setStage(null,null),this.interactiveLayer.removeChild(t)})),this.interactiveLayer.release()),this.window.release(),this.ticker.remTimeline(this.timeline),this.ticker.removeListener("afterTick",this.afterTickCb),this.renderService.renderTreeRoots=[]}setStage(t){}dirty(t,e){"released"!==this.releaseStatus&&(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){"released"!==this.releaseStatus&&this.forEachChildren(((e,i)=>{e.drawTo(t,{renderService:this.renderService,viewBox:t.getViewBox(),transMatrix:t.getViewBoxTransform(),background:e===this.defaultLayer?this.background:void 0,clear:0===i,updateBounds:!(!this.dirtyBounds||this.dirtyBounds.empty())})}))}renderToNewWindow(){let t=arguments.length>1?arguments[1]:void 0;if("released"===this.releaseStatus)return;const e=Pn.get(Wn),i=t?-t.x1:0,n=t?-t.y1:0,s=t?t.x2:this.viewWidth,r=t?t.y2:this.viewHeight,a=t?t.width():this.viewWidth,o=t?t.height():this.viewHeight;return e.create({viewBox:{x1:i,y1:n,x2:s,y2:r},width:a,height:o,dpr:this.window.dpr,canvasControled:!0,offscreen:!0,title:""}),this.renderTo(e),e}toCanvas(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],e=arguments.length>1?arguments[1]:void 0;if("released"===this.releaseStatus)return;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}eventPointTransform(t){const e=this.global.mapToCanvasPoint(t,this.window.getContext().canvas.nativeCanvas);return this.stage.window.pointTransform(e.x,e.y)}pauseTriggerEvent(){this._eventSystem&&this._eventSystem.pauseTriggerEvent()}resumeTriggerEvent(){this._eventSystem&&this._eventSystem.resumeTriggerEvent()}getPickerService(){return this.pickerService||(this.pickerService=Pn.get(_h)),this.pickerService}reInit(){this.renderService.reInit(),this.pickerService.reInit()}}function Ad(t,e,i,n){return t=>{if(!(t instanceof MouseEvent||t instanceof TouchEvent||t instanceof PointerEvent))return t;const s=e();if(1===(r=s).a&&0===r.b&&0===r.c&&1===r.d&&0===r.e&&0===r.f)return t;var r;const a=i(),o=new t.constructor(t.type,t);if(Object.defineProperties(o,{target:{value:t.target},currentTarget:{value:t.currentTarget}}),t instanceof MouseEvent||t instanceof PointerEvent)n(t.clientX,t.clientY,s,a,o);else if(t instanceof TouchEvent){if(t.touches.length>0){const t=o.touches[0];n(t.clientX,t.clientY,s,a,t)}if(t.changedTouches.length>0){const t=o.changedTouches[0];n(t.clientX,t.clientY,s,a,t)}}return o}}function Cd(t,e,i,n,s){const r=Ad(0,i,n,s);t.setEventListenerTransformer(r)}function Ld(t,e,i,n,s){const r=Ad(0,i,n,s);t.setEventListenerTransformer(r)}function Od(t,e,i,n,s){const r={x:t,y:e};i.transformPoint(r,r),Object.defineProperties(s,{_canvasX:{value:r.x},_canvasY:{value:r.y}})}function Ed(t){var e;if(Fn(t._canvasX)&&Fn(t._canvasY))return{x:t._canvasX,y:t._canvasY};if(t.changedTouches){const i=null!==(e=t.changedTouches[0])&&void 0!==e?e:{};return{x:i._canvasX,y:i._canvasY}}return{x:t._canvasX||0,y:t._canvasY||0}}let Rd=!1;const Md=new a((t=>{Rd||(Rd=!0,t(Il).toSelf().inSingletonScope(),t(th).to(Il).inSingletonScope(),t(Jl).toService(th),t(cl).toSelf(),t(dl).toSelf(),t(co).toService(cl),t(co).toService(dl),t(co).toService(el),F(t,co))}));let Pd=!1;const Dd=new a((t=>{Pd||(Pd=!0,t(zl).toSelf().inSingletonScope(),t(eh).to(zl).inSingletonScope(),t(Jl).toService(eh),t(uo).toService(el),F(t,uo))}));let Id=!1;const Fd=new a((t=>{Id||(Id=!0,t(ih).to(Vl).inSingletonScope(),t(Jl).toService(ih),t(po).toService(el),F(t,po))}));const Nd=["x","y","dx","dy","scaleX","scaleY","angle","anchor","postMatrix","visible","clip","pickable","childrenPickable","zIndex","cursor"];class Hd extends Ua{constructor(t,e){super(t),this._skipRenderAttributes=Nd,(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,n){const s=this.onBeforeAttributeUpdate&&this.onBeforeAttributeUpdate({[t]:e},this.attribute,t,n);if(s)return this._setAttributes(s,i);at(this.attribute[t])&&at(e)&&!et(this.attribute[t])&&!et(e)?kt(this.attribute[t],e):this.attribute[t]=e,this._skipRenderAttributes.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,i){return t=this.onBeforeAttributeUpdate&&this.onBeforeAttributeUpdate(t,this.attribute,null,i)||t,this._setAttributes(t,e)}_setAttributes(t,e){const i=Object.keys(t);this._mergeAttributes(t,i),i.every((t=>this._skipRenderAttributes.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){it(e)&&(e=Object.keys(t));for(let i=0;i<e.length;i++){const n=e[i];!at(this.attribute[n])||et(this.attribute[n])||et(t[n])?this.attribute[n]=t[n]:kt(this.attribute[n],t[n])}}bindEvents(){}_getNodeId(t){var e;return`${null!==(e=this.id)&&void 0!==e?e:this._uid}-${this.name}-${t}`}_dispatchEvent(t,e){var i;const n=new ds(t,e);n.manager=null===(i=this.stage)||void 0===i?void 0:i.eventSystem.manager,this.dispatchEvent(n)}eventPosToStagePos(t){var e,i;const n={x:0,y:0},s=null!==(i=null===(e=this.stage)||void 0===e?void 0:e.eventPointTransform(t))&&void 0!==i?i:{x:0,y:0};return this.globalTransMatrix.transformPoint(s,n),n}}const zd=Symbol.for("MathPickerContribution"),Wd=Symbol.for("MathRectPicker"),Ud=Symbol.for("MathSymbolPicker"),jd=Symbol.for("MathTextPicker"),Gd=Symbol.for("CanvasRectPicker"),Yd=Symbol.for("CanvasSymbolPicker"),Vd=Symbol.for("CanvasTextPicker"),Xd=Symbol.for("CanvasPickerContribution");class Kd{contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;if(!this.canvasRenderer)return!0;const{pickContext:n}=null!=i?i:{};if(!n)return!1;const s=t.getGraphicTheme();n.highPerformanceSave();let{x:r=s.x,y:a=s.y}=t.attribute;if(t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(s);r+=e.x,a+=e.y,n.setTransformForCurrent()}else r=0,a=0,n.transformFromMatrix(t.transMatrix,!0);let o=!1,l=!1;return this.canvasRenderer.drawShape(t,n,r,a,{},null,((t,i,n,s)=>!(!o&&!l)||(o=t.isPointInPath(e.x,e.y),l=s||l,o)),((t,i,s,r)=>{if(o||l)return!0;const a=i.lineWidth||s.lineWidth,h=i.pickStrokeBuffer||s.pickStrokeBuffer,d=i.keepStrokeScale||s.keepStrokeScale;return n.lineWidth=d?a+h:Tn(n,a+h,n.dpr),o=t.isPointInStroke(e.x,e.y),l=r||l,o})),n.highPerformanceRestore(),o}}const $d=new pe;class qd{constructor(){this.type="rect",this.numberType=ka}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:n}=null!=i?i:{};if(!n)return!1;const s=t.getGraphicTheme(),{cornerRadius:r=s.cornerRadius}=t.attribute;let{x:a=s.x,y:o=s.y}=t.attribute;n.highPerformanceSave();let l=!0;if(t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(s);a+=e.x,o+=e.y,n.setTransformForCurrent()}else a=0,o=0,l=!1,n.transformFromMatrix(t.transMatrix,!0);let h=!0;if(!l||t.shadowRoot||ct(r,!0)&&0!==r||ht(r)&&r.some((t=>0!==t)))h=!1,this.canvasRenderer.drawShape(t,n,a,o,{},null,((t,i,n)=>!!h||(h=t.isPointInPath(e.x,e.y),h)),((t,i,s)=>{if(h)return!0;const r=i.lineWidth||s.lineWidth,a=i.pickStrokeBuffer||s.pickStrokeBuffer,o=i.keepStrokeScale||s.keepStrokeScale;return n.lineWidth=o?r+a:Tn(n,r+a,n.dpr),h=t.isPointInStroke(e.x,e.y),h}));else{const{fill:i=s.fill,stroke:n=s.stroke,lineWidth:r=s.lineWidth}=t.attribute;if(i)h=!0;else if(n){const i=t.AABBBounds;$d.setValue(i.x1,i.y1,i.x2,i.y2),$d.expand(-r/2),h=!$d.containsPoint(e)}}return n.highPerformanceRestore(),h}}var Zd=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Jd=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Qd=function(t,e){return function(i,n){e(i,n,t)}};let tc=class extends qd{constructor(t){super(),this.canvasRenderer=t}};tc=Zd([y(),Qd(0,m(th)),Jd("design:paramtypes",[Object])],tc);let ec=!1;const ic=new a(((t,e,i,n)=>{ec||(ec=!0,t(Wd).to(tc).inSingletonScope(),t(zd).toService(Wd))}));var nc=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},sc=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},rc=function(t,e){return function(i,n){e(i,n,t)}};let ac=class extends Kd{constructor(t){super(),this.canvasRenderer=t,this.type="symbol",this.numberType=Ba}};ac=nc([y(),rc(0,m(eh)),sc("design:paramtypes",[Object])],ac);let oc=!1;const lc=new a(((t,e,i,n)=>{oc||(oc=!0,t(Ud).to(ac).inSingletonScope(),t(zd).toService(Ud))}));var hc=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let dc=class{constructor(){this.type="text",this.numberType=Aa}contains(t,e,i){return!!t.AABBBounds.containsPoint(e)}};dc=hc([y()],dc);let cc=!1;const uc=new a(((t,e,i,n)=>{cc||(cc=!0,t(jd).to(dc).inSingletonScope(),t(zd).toService(jd))}));var pc=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},gc=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},fc=function(t,e){return function(i,n){e(i,n,t)}};let vc=class extends qd{constructor(t){super(),this.canvasRenderer=t}};vc=pc([y(),fc(0,m(th)),gc("design:paramtypes",[Object])],vc);let mc=!1;const bc=new a(((t,e,i,n)=>{mc||(mc=!0,t(Gd).to(vc).inSingletonScope(),t(Xd).toService(Gd))}));class yc extends xl{contains(t,e,i){const{pickContext:n}=null!=i?i:{};if(!n)return!1;const s=t.getGraphicTheme();n.highPerformanceSave();const r=this.transform(t,s,n),{x:a,y:o,z:l,lastModelMatrix:h}=r;let d=e;if(n.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=l;let c=!1;return this.canvasRenderer.drawShape(t,n,a,o,i,null,((t,e,i)=>!!c||(c=t.isPointInPath(d.x,d.y),c))),this.canvasRenderer.z=0,n.modelMatrix!==h&&wo.free(n.modelMatrix),n.modelMatrix=h,n.highPerformanceRestore(),c}}var xc=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},_c=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},wc=function(t,e){return function(i,n){e(i,n,t)}};let Tc=class extends yc{constructor(t){super(),this.canvasRenderer=t,this.type="symbol",this.numberType=Ba}contains(t,e,i){const{pickContext:n}=null!=i?i:{};if(!n)return!1;const s=t.getParsedPath();if(!n.camera){if(!t.AABBBounds.containsPoint(e))return!1;if(s.isSvg||"imprecise"===t.attribute.pickMode)return!0}n.highPerformanceSave();const r=t.getGraphicTheme(),a=this.transform(t,r,n),{x:o,y:l,z:h,lastModelMatrix:d}=a;let c=e;if(n.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=h;let u=!1;return this.canvasRenderer.drawShape(t,n,o,l,{},null,((t,e,i)=>!!u||(u=t.isPointInPath(c.x,c.y),u)),((t,e,i)=>{if(u)return!0;const s=e.lineWidth||i.lineWidth,r=e.pickStrokeBuffer||i.pickStrokeBuffer,a=e.keepStrokeScale||i.keepStrokeScale;return n.lineWidth=a?s+r:Tn(n,s+r,n.dpr),u=t.isPointInStroke(c.x,c.y),u})),this.canvasRenderer.z=0,n.modelMatrix!==d&&wo.free(n.modelMatrix),n.modelMatrix=d,n.highPerformanceRestore(),u}};Tc=xc([y(),wc(0,m(eh)),_c("design:paramtypes",[Object])],Tc);let Sc=!1;const kc=new a(((t,e,i,n)=>{Sc||(Sc=!0,t(Yd).to(Tc).inSingletonScope(),t(Xd).toService(Yd))}));var Bc=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Ac=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Cc=function(t,e){return function(i,n){e(i,n,t)}};let Lc=class extends yc{constructor(t){super(),this.canvasRenderer=t,this.type="text",this.numberType=Aa}contains(t,e,i){const{pickContext:n}=null!=i?i:{};if(!n)return!1;const s=t.AABBBounds;if(!n.camera)return!!s.containsPoint(e);n.highPerformanceSave();const r=t.getGraphicTheme(),{keepDirIn3d:a=r.keepDirIn3d}=t.attribute,o=!a,l=this.transform(t,r,n,o),{x:h,y:d,z:c,lastModelMatrix:u}=l;this.canvasRenderer.z=c;let p=e;if(n.camera){p=e.clone();const i=t.parent.globalTransMatrix;p.x=i.a*e.x+i.c*e.y+i.e,p.y=i.b*e.x+i.d*e.y+i.f}let g=!1;return this.canvasRenderer.drawShape(t,n,h,d,{},null,((e,i,n)=>{if(g)return!0;const{fontSize:s=r.fontSize,textBaseline:a=r.textBaseline,textAlign:o=r.textAlign}=t.attribute,l=t.AABBBounds,u=l.height(),f=l.width(),v=vo(a,u,s),m=fo(o,f);return e.rect(m+h,v+d,f,u,c),g=e.isPointInPath(p.x,p.y),g}),((t,e,i)=>g)),this.canvasRenderer.z=0,n.modelMatrix!==u&&wo.free(n.modelMatrix),n.modelMatrix=u,n.highPerformanceRestore(),g}};Lc=Bc([y(),Cc(0,m(ih)),Ac("design:paramtypes",[Object])],Lc);let Oc=!1;const Ec=new a(((t,e,i,n)=>{Oc||(Oc=!0,t(Vd).to(Lc).inSingletonScope(),t(Xd).toService(Vd))})),Rc=Td();function Mc(){Mc.__loaded||(Mc.__loaded=!0,Ko.RegisterGraphicCreator("group",ja))}Mc.__loaded=!1;const Pc=Mc;function Dc(){Dc.__loaded||(Dc.__loaded=!0,Ko.RegisterGraphicCreator("rect",jo),Pn.load(Md),Pn.load(Rc?bc:ic))}Dc.__loaded=!1;const Ic=Dc;function Fc(){Fc.__loaded||(Fc.__loaded=!0,Ko.RegisterGraphicCreator("symbol",Fo),Pn.load(Dd),Pn.load(Rc?kc:lc))}Fc.__loaded=!1;const Nc=Fc;function Hc(){Hc.__loaded||(Hc.__loaded=!0,Ko.RegisterGraphicCreator("text",Po),Pn.load(Fd),Pn.load(Rc?Ec:uc))}Hc.__loaded=!1;const zc=Hc;var Wc;!function(t){t.selected="selected",t.selectedReverse="selected_reverse",t.hover="hover",t.hoverReverse="hover_reverse"}(Wc||(Wc={})),Wc.selectedReverse,Wc.selected,Wc.hover,Wc.hoverReverse;function Uc(){return"browser"===cd.env?["pointerup","pointerleave","pointercancel"]:["pointerup","pointerleave","pointerupoutside"]}const jc={debounce:Dt,throttle:function(t,e,i){let n=!0,s=!0;if("function"!=typeof t)throw new TypeError("Expected a function");return st(i)&&(n="leading"in i?!!i.leading:n,s="trailing"in i?!!i.trailing:s),Dt(t,e,{leading:n,trailing:s,maxWait:e})}};Pc(),Ic();class Gc extends Hd{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:kt({},Gc.defaultAttributes,t)),this.name="scrollbar",this._handleTouchMove=t=>{nt(this._prePos)&&t.preventDefault()},this._onRailPointerDown=t=>{const{viewX:e,viewY:i}=t,{direction:n,width:s,height:r,range:a}=this.attribute,o=this._sliderSize,[l,h]=this._getScrollRange();let d;if("vertical"===n){const t=i-this._viewPosition.y,e=Rt(t-o/2,l,h);d=t/r,this._slider.setAttribute("y",e,!0)}else{const t=e-this._viewPosition.x,i=Rt(t-o/2,l,h);d=t/s,this._slider.setAttribute("x",i,!0)}this.setScrollRange([d-(a[1]-a[0])/2,d+(a[1]-a[0])/2],!1),this.stage&&!this.stage.autoRender&&this.stage.renderNextFrame()},this._onSliderPointerDown=t=>{this._clearDragEvents();const{stopSliderDownPropagation:e=!0}=this.attribute;e&&t.stopPropagation();const{direction:i}=this.attribute,{x:n,y:s}=this.stage.eventPointTransform(t);this._prePos="horizontal"===i?n:s,this._dispatchEvent("scrollDown",{pos:this._prePos,event:t});const r=Uc(),a="browser"===cd.env?cd:this.stage;a.addEventListener("pointermove",this._onSliderPointerMoveWithDelay,{capture:!0}),r.forEach((t=>{a.addEventListener(t,this._onSliderPointerUp)}))},this._computeScrollValue=t=>{const{direction:e}=this.attribute,{x:i,y:n}=this.stage.eventPointTransform(t);let s,r,a=0;const{width:o,height:l}=this.getSliderRenderBounds();return"vertical"===e?(r=n,a=r-this._prePos,s=a/l):(r=i,a=r-this._prePos,s=a/o),[r,s]},this._onSliderPointerMove=t=>{const{stopSliderMovePropagation:e=!0}=this.attribute;e&&t.stopPropagation();const i=this.getScrollRange(),[n,s]=this._computeScrollValue(t);this.setScrollRange([i[0]+s,i[1]+s],!0),this._prePos=n},this._onSliderPointerMoveWithDelay=0===this.attribute.delayTime?this._onSliderPointerMove:jc[this.attribute.delayType](this._onSliderPointerMove,this.attribute.delayTime),this._onSliderPointerUp=t=>{const{range:e,limitRange:i=[0,1]}=this.attribute,n=this.getScrollRange(),[s,r]=this._computeScrollValue(t),a=[n[0]+r,n[1]+r];this._prePos=null,this._dispatchEvent("scrollUp",{pre:e,value:Mt(a,i[0],i[1])}),this._clearDragEvents()}}setScrollRange(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];const{direction:i="horizontal",limitRange:n=[0,1],range:s,realTime:r=!0}=this.attribute,a=Mt(t,n[0],n[1]);if(e){const t=this._getSliderPos(a);if(this._slider){const e=t[1]-t[0];this._sliderSize=e,"horizontal"===i?this._slider.setAttributes({x:t[0],width:e},!0):this._slider.setAttributes({y:t[0],height:e},!0),this.stage&&!this.stage.autoRender&&this.stage.renderNextFrame()}}this.attribute.range=a,r&&this._dispatchEvent("scrollDrag",{pre:s,value:a})}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",jc[t](this._onRailPointerDown,e)),this._slider&&this._slider.addEventListener("pointerdown",this._onSliderPointerDown),("browser"===cd.env?cd:this.stage).addEventListener("touchmove",this._handleTouchMove,{passive:!1})}render(){this._reset();const{direction:t="horizontal",width:e,height:i,range:n,limitRange:s=[0,1],railStyle:r,sliderStyle:a,padding:o=2}=this.attribute,l=this.createOrUpdateChild("scrollbar-container",{},"group"),h=l.createOrUpdateChild("scrollbar-rail",Object.assign({x:0,y:0,width:e,height:i},r),"rect");this._rail=h;const d=this.getSliderRenderBounds(),c=this._getSliderPos(Mt(n,s[0],s[1])),u=c[1]-c[0];let p;this._sliderSize=u,p="horizontal"===t?{x:c[0],y:d.y1,width:u,height:d.height}:{x:d.x1,y:c[0],width:d.width,height:u};const g=l.createOrUpdateChild("slider",Object.assign(Object.assign(Object.assign(Object.assign({},p),{cornerRadius:this._getDefaultSliderCornerRadius()}),a),{boundsPadding:Ce(o),pickMode:"imprecise"}),"rect");this._slider=g,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,[n,s,r,a]=Ce(i),o={x1:a,y1:n,x2:t-s,y2:e-r,width:Math.max(0,t-(a+s)),height:Math.max(0,e-(n+r))};return this._sliderRenderBounds=o,o}_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:n,x1:s,y1:r}=this.getSliderRenderBounds();return"horizontal"===e?[i*t[0]+s,i*t[1]+s]:[n*t[0]+r,n*t[1]+r]}_getScrollRange(){if(this._sliderLimitRange)return this._sliderLimitRange;const{limitRange:t=[0,1],direction:e}=this.attribute,[i,n]=Mt(t,0,1),{width:s,height:r,x1:a,y1:o}=this.getSliderRenderBounds(),l=this._sliderSize;return"horizontal"===e?Mt([a+i*s,a+n*s],a,s-l):Mt([o+i*r,o+n*r],o,r-l)}_clearDragEvents(){const t=Uc(),e="browser"===cd.env?cd:this.stage;e.removeEventListener("pointermove",this._onSliderPointerMoveWithDelay,{capture:!0}),t.forEach((t=>{e.removeEventListener(t,this._onSliderPointerUp)}))}_reset(){this._sliderRenderBounds=null,this._sliderLimitRange=null}release(t){super.release(t),("browser"===cd.env?cd:this.stage).addEventListener("touchmove",this._handleTouchMove,{passive:!1}),this._clearDragEvents()}}Gc.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};var Yc=function(t,e){var i={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(i[n]=t[n]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var s=0;for(n=Object.getOwnPropertySymbols(t);s<n.length;s++)e.indexOf(n[s])<0&&Object.prototype.propertyIsEnumerable.call(t,n[s])&&(i[n[s]]=t[n[s]])}return i};const Vc=new pe;Pc(),zc(),Nc(),Ic();const Xc="M -0.5 -0.5, L -0.5 0.5, L 0.5 -0.5, Z",Kc="M -0.5 -0.5, L -0.5 0.5, L 0.5 0.5, Z",$c="M -0.5 -0.5, L 0.5 -0.5, L 0.5 0.5, Z",qc="M 0.5 -0.5, L 0.5 0.5, L -0.5 0.5, Z",Zc={tl:Xc,tr:$c,bl:Kc,br:qc,lt:Xc,lb:Kc,rt:$c,rb:qc};class Jc extends Hd{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:kt({},Jc.defaultAttributes,t)),this.name="poptip",this.positionList=["top","tl","tr","bottom","bl","br","left","lt","lb","right","rt","rb"]}render(){var t,e,i,n,s,r,a,o,l;const{titleStyle:h={},position:d,contentStyle:c={},panel:u,logoSymbol:p,poptipAnchor:g="position",logoText:f,logoTextStyle:v={},triangleMode:m="default",space:b=4,minWidth:y=0,maxWidth:x=1/0,padding:_=4,maxWidthPercent:w,visible:T,state:S,dx:k=0,dy:B=0,positionBounds:A}=this.attribute;let{title:C="",content:L=""}=this.attribute;C=this.attribute.titleFormatMethod?this.attribute.titleFormatMethod(C):C,L=this.attribute.contentFormatMethod?this.attribute.contentFormatMethod(L):L;const O=Ce(_),E=this.createOrUpdateChild("poptip-content",{x:0,y:0,zIndex:1},"group");this.group=E;const R=x-O[1]-O[3],M=nt(C)&&!1!==T,P=Object.assign(Object.assign({text:ht(C)?C:[C],visible:M,wrap:!0},h),{x:O[3],y:O[0],maxLineWidth:R,textAlign:"left",textBaseline:"top"}),D=E.createOrUpdateChild("poptip-title",P,"text");yt(null==S?void 0:S.title)||(D.states=S.title);const I=D.AABBBounds,F=I.height(),N=I.width();let H=F+b;M||(H=0);const z=nt(L)&&!1!==T,W=Object.assign(Object.assign({text:ht(L)?L:[L],visible:z,wrap:!0},c),{x:O[3],y:O[0]+H,maxLineWidth:R,textAlign:"left",textBaseline:"top"}),U=E.createOrUpdateChild("poptip-content",W,"text");yt(null==S?void 0:S.content)||(U.states=S.content);const j=U.AABBBounds,G=j.height(),Y=j.width();z&&(H+=G),this.titleShape=D,this.contentShape=U;let V=Gt(N+O[1]+O[3],Y+O[1]+O[3]);V>x?V=x:V<y&&(V=y);let X=O[0]+O[2]+H;const{visible:K,square:$}=u,q=Yc(u,["visible","square"]);if($){const t=Gt(V,X);V=t;const e=t-X;X=t,D.setAttributes({dy:e/2}),U.setAttributes({dy:e/2})}const Z=null!==(t=q.size)&&void 0!==t?t:12,J=ht(Z)?[Z[0]+(null!==(e=q.space)&&void 0!==e?e:0),Z[1]+(null!==(i=q.space)&&void 0!==i?i:0)]:Z+(null!==(n=q.space)&&void 0!==n?n:0),Q=null!==(s=q.lineWidth)&&void 0!==s?s:1,et=this.stage?[null!==(r=this.stage.viewWidth)&&void 0!==r?r:this.stage.width,null!==(a=this.stage.viewHeight)&&void 0!==a?a:this.stage.height]:void 0;if(et){const t=this.AABBBounds,e=null!==(o=this.attribute.x)&&void 0!==o?o:t.x1,i=et[0]-t.x1;let n=Math.max(e,i);const s=(ht(Z)?Z[0]:12)+3;if(n=Math.min(n-s,n*w),n<V){V=n;const t=O[1]+O[3];D.setAttribute("maxLineWidth",n-t),U.setAttribute("maxLineWidth",n-t),X=O[0]+O[2],M&&(X+=D.AABBBounds.height()+b),X+=U.AABBBounds.height()}}const it="auto"===d||ht(d),st=ht(d)?d:this.positionList;let rt,at=-1/0;for(let t=0;t<st.length+1;t++){const e=it?st[t===st.length?rt:t]:d;let i="arrow2Left",n=(ht(Z)?Z[0]:Z)/4,s=0;"top"===e||"bottom"===e||"left"===e||"right"===e?i="arrow2Left":"concise"===m&&(i=Zc[e],n=["tl","bl","rt","rb"].includes(e)?(ht(Z)?Z[0]:Z)/2:-(ht(Z)?Z[0]:Z)/2,s=["tl","tr","lb","rb"].includes(e)?-(ht(Z)?Z[1]:Z)/2:(ht(Z)?Z[1]:Z)/2);const{angle:r,offset:a}=this.getAngleAndOffset(e,V,X,ht(J)?J:[J,J-Q],i);let o,h={x:0,y:0};if("bounds"===g&&A&&(h=this.calculateAnchorPoint(e,A)),tt(K)){let t;o=E.createOrUpdateChild("poptip-symbol-panel",Object.assign(Object.assign({},q),{visible:K&&(z||M),x:n,y:s,strokeBoundsBuffer:-1,boundsPadding:-2,anchor:[0,0],symbolType:i,angle:r,dx:a[0],dy:a[1]-(null!==(l=q.space)&&void 0!==l?l:0),size:Z,zIndex:9}),"symbol"),yt(null==S?void 0:S.panel)||(o.states=S.panel),t=u.panelSymbolType?E.createOrUpdateChild("poptip-rect-panel",Object.assign(Object.assign({},q),{visible:K&&(z||M),x:0,y:0,symbolType:"rect",size:[V,X],zIndex:-8}),"symbol"):E.createOrUpdateChild("poptip-rect-panel",Object.assign(Object.assign({},q),{visible:K&&(z||M),x:0,y:0,width:V,height:X,zIndex:-8}),"rect"),yt(null==S?void 0:S.panel)||(t.states=S.panel)}if(E.setAttributes({x:-a[0]+k+h.x,y:-a[1]+B+h.y,anchor:[n,s]}),p){const{size:t=12}=p,e=ht(t)?t:[t,t];"auto"===e[1]&&(e[1]=X),"auto"===e[0]&&(e[0]=X);const i=e[0];E.createOrUpdateChild("poptip-logo",Object.assign(Object.assign({},p),{x:0,y:X/2,visible:K&&(z||M),zIndex:10,size:e}),"symbol"),E.setAttributes({x:-a[0]+k+i/2,y:-a[1]+B}),f&&E.createOrUpdateChild("poptip-logo-text",Object.assign(Object.assign({},v),{x:0,y:X/2,visible:K&&(z||M),text:f,textAlign:"center",textBaseline:"middle",zIndex:10}),"text")}if(!et)break;{Vc.setValue(0,0,V,X).transformWithMatrix(E.globalTransMatrix);const i=Vc,n=(new ue).setValue(0,0,et[0],et[1]);if(it){if(ie(i,n,!1))break;{const e=Qt(i,n,!1),s=(e.x2-e.x1)*(e.y2-e.y1);s>at&&(at=s,rt=t)}}if(["top","bottom","left","right"].includes(e)){const t="top"===e||"bottom"===e,s="left"===e||"right"===e;let r=!1;if(t?r="top"===e&&i.y1<0||"bottom"===e&&i.y2>n.y2:s&&(r="left"===e&&i.x1<0||"right"===e&&i.x2>n.x2),!r){let e=0;const r=(ht(Z)?Z[1]:Z)/2;t?(i.x1<0?e=-i.x1:i.x2>n.x2&&(e=n.x2-i.x2),E.setAttribute("x",E.attribute.x+e),o.setAttribute("dx",Yt(Gt(o.attribute.dx-e,r),i.width()-r))):s&&(i.y1<0?e=-i.y1:i.y2>n.y2&&(e=n.y2-i.y2),E.setAttribute("y",E.attribute.y+e),o.setAttribute("dy",Yt(Gt(o.attribute.dy-e,r),i.height()-r)));break}}if(!it)break}}}calculateAnchorPoint(t,e){if(!e)return{x:0,y:0};const{x:i,y:n}=this.attribute,{x1:s,y1:r,x2:a,y2:o}=e,l=a-s,h=o-r;switch(t){case"top":case"tl":case"tr":return{x:s+l/2-i,y:r-n};case"bottom":case"bl":case"br":return{x:s+l/2-i,y:o-n};case"left":case"lt":case"lb":return{x:s-i,y:r+h/2-n};case"right":case"rt":case"rb":return{x:a-i,y:r+h/2-n};default:return{x:0,y:0}}}getAngleAndOffset(t,e,i,n,s){const r="arrow2Left"===s?n[1]/2:n[1];switch(t){case"tl":return{angle:"arrow2Left"===s?Ft/2*3:0,offset:"arrow2Left"===s?[e/4,i+r]:[0,i+r]};case"top":return{angle:Ft/2*3,offset:[e/2,i+r]};case"tr":return{angle:"arrow2Left"===s?Ft/2*3:0,offset:"arrow2Left"===s?[e/4*3,i+r]:[e,i+r]};case"rt":return{angle:0,offset:"arrow2Left"===s?[-r,i/5]:[-r,0]};case"right":return{angle:0,offset:[-r,i/2]};case"rb":return{angle:0,offset:"arrow2Left"===s?[-r,i/5*4]:[-r,i]};case"bl":return{angle:"arrow2Left"===s?Ft/2:0,offset:"arrow2Left"===s?[e/4,-r]:[0,-r]};case"bottom":return{angle:Ft/2,offset:[e/2,-r]};case"br":return{angle:"arrow2Left"===s?Ft/2:0,offset:"arrow2Left"===s?[e/4*3,-r]:[e,-r]};case"lt":return{angle:"arrow2Left"===s?Ft:0,offset:"arrow2Left"===s?[e+r,i/5]:[e+r,0]};case"left":return{angle:Ft,offset:[e+r,i/2]};case"lb":return{angle:"arrow2Left"===s?Ft:0,offset:"arrow2Left"===s?[e+r,i/5*4]:[e+r,i]}}}appearAnimate(t){const{duration:e=1e3,easing:i="quadOut"}=t;if(this.setAttributes({scaleX:0,scaleY:0}),this.animate().to({scaleX:1,scaleY:1},e/3*2,i),this.titleShape&&this.titleShape.animate().play(new Hs({text:""},{text:this.titleShape.attribute.text},e,i)),this.contentShape&&this.contentShape.animate().play(new Hs({text:""},{text:this.contentShape.attribute.text},e,i)),t.wave){const n=e/6;this.group.animate().to({angle:t.wave},n,i).to({angle:-t.wave},2*n,i).to({angle:t.wave},2*n,i).to({angle:0},n,i)}}disappearAnimate(t){const{duration:e=1e3,easing:i="quadOut"}=t;this.animate().to({scaleX:0,scaleY:0},e,i)}}function Qc(t,e){var i,n,s,r,a,o,l,h;return!t&&!e||!(!t||!e)&&(null===(i=t.start)||void 0===i?void 0:i.col)===(null===(n=e.start)||void 0===n?void 0:n.col)&&(null===(s=t.start)||void 0===s?void 0:s.row)===(null===(r=e.start)||void 0===r?void 0:r.row)&&(null===(a=t.end)||void 0===a?void 0:a.col)===(null===(o=e.end)||void 0===o?void 0:o.col)&&(null===(l=t.end)||void 0===l?void 0:l.row)===(null===(h=e.end)||void 0===h?void 0:h.row)}Jc.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"},panel:{},maxWidthPercent:.8,space:8,padding:10};var tu=t=>null!=t;const eu="undefined"==typeof window||void 0===window.window;function iu(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||t.end.col<=e&&e<=t.start.col&&t.start.row<=i&&i<=t.end.row||t.start.col<=e&&e<=t.end.col&&t.end.row<=i&&i<=t.start.row}!function(){if(eu)return{IE:!1,Edge:!1,Chrome:!1,Firefox:!1,Safari:!1};const t=window.navigator.userAgent.toLowerCase();/(msie|trident)/.exec(t),t.indexOf("edge"),t.indexOf("chrome")>-1&&t.indexOf("edge"),t.indexOf("firefox"),t.indexOf("safari")>-1&&t.indexOf("edge")}();function nu(t,e){return void 0===t&&void 0===e||void 0!==t&&void 0!==e&&(t.start.col===e.start.col&&t.start.row===e.start.row&&t.end.col===e.end.col&&t.end.row===e.end.row)}function su(t,e){return void 0===t&&void 0===e||void 0!==t&&void 0!==e&&(t.start.col===e.start.col&&t.start.row===e.start.row&&t.end.col===e.end.col&&t.end.row===e.end.row)}function ru(t){return Math.floor(t)===t}function au(t){this.rotateDegree=90;const e=t.clientWidth<t.clientHeight?Math.max(t.clientWidth,t.clientHeight)/2:Math.min(t.clientWidth,t.clientHeight)/2,i=this.getElement().getBoundingClientRect(),n=i.left,s=i.top,r=i.right,a=i.bottom;t.style.transform="rotate(90deg)",t.style.transformOrigin=`${e}px ${e}px`;const o=()=>({x1:n,y1:s,x2:r,y2:a}),l=()=>{const i=("undefined"!=typeof window?{width:window.innerWidth||document.documentElement.clientWidth,height:window.innerHeight||document.documentElement.clientHeight}:cd&&cd.getViewportSize?cd.getViewportSize():t.getBoundingClientRect()).width,n=this.getElement().getBoundingClientRect(),s=n.top,r=i-n.right,a=_o.allocate(1,0,0,1,0,0);a.translate(s,r);const o=e-s,l=e-r;a.translate(o,l),a.rotate(Math.PI/2),a.translate(-o,-l);const h=this.pluginManager.getPluginByName("Rotate Table");return h&&(h.matrix=a),a};Ld(cd,this.getElement(),l,o,Od),Cd(this.scenegraph.stage.window,this.getElement(),l,o,Od);const h=this.pluginManager.getPluginByName("Rotate Table");h&&(h.vglobal_mapToCanvasPoint=cd.mapToCanvasPoint),cd.mapToCanvasPoint=Ed}function ou(t){this.rotateDegree=0,t.style.transform="none",t.style.transformOrigin="none";const e=this.getElement().getBoundingClientRect(),i=e.left,n=e.top,s=e.right,r=e.bottom,a=()=>({x1:i,y1:n,x2:s,y2:r}),o=()=>{const t=_o.allocate(1,0,0,1,0,0);return t.translate(i,n),t};Ld(cd,this.getElement(),o,a,Od),Cd(this.scenegraph.stage.window,this.getElement(),o,a,Od);const l=this.pluginManager.getPluginByName("Rotate Table");l&&(cd.mapToCanvasPoint=l.vglobal_mapToCanvasPoint)}var lu,hu,du,cu;!function(t){t.default="default",t.grabing="grabing",t.scrolling="scrolling"}(lu||(lu={})),function(t){t.FinishToStart="finish_to_start",t.StartToStart="start_to_start",t.FinishToFinish="finish_to_finish",t.StartToFinish="start_to_finish"}(hu||(hu={})),function(t){t.Tasks_Separate="tasks_separate",t.Sub_Tasks_Inline="sub_tasks_inline",t.Sub_Tasks_Separate="sub_tasks_separate",t.Sub_Tasks_Arrange="sub_tasks_arrange",t.Sub_Tasks_Compact="sub_tasks_compact",t.Project_Sub_Tasks_Inline="project_sub_tasks_inline"}(du||(du={})),function(t){t.TASK="task",t.PROJECT="project",t.MILESTONE="milestone"}(cu||(cu={}));const uu={SCROLL:"scroll",CHANGE_DATE_RANGE:"change_date_range",CLICK_TASK_BAR:"click_task_bar",CONTEXTMENU_TASK_BAR:"contextmenu_task_bar",MOUSEENTER_TASK_BAR:"mouseenter_task_bar",MOUSELEAVE_TASK_BAR:"mouseleave_task_bar",CREATE_TASK_SCHEDULE:"create_task_schedule",CREATE_DEPENDENCY_LINK:"create_dependency_link",DELETE_DEPENDENCY_LINK:"delete_dependency_link",CLICK_DEPENDENCY_LINK_POINT:"click_dependency_link_point",CONTEXTMENU_DEPENDENCY_LINK:"contextmenu_dependency_link",CLICK_MARKLINE_CREATE:"click_markline_create",CLICK_MARKLINE_CONTENT:"click_markline_content"};function pu(t,e){let i=null;return function(){for(var n=arguments.length,s=new Array(n),r=0;r<n;r++)s[r]=arguments[r];i||(t.apply(this,s),i=setTimeout((()=>{i=null}),e))}}function gu(t,e){const i=t.getFullYear().toString(),n=(t.getMonth()+1).toString().padStart(2,"0"),s=t.getDate().toString().padStart(2,"0");if((e=(e=(e=e.replace("yyyy",i)).replace("mm",n)).replace("dd",s)).length>10){const i=t.getHours().toString().padStart(2,"0"),n=t.getMinutes().toString().padStart(2,"0"),s=t.getSeconds().toString().padStart(2,"0");e=(e=(e=e.replace("hh",i)).replace("mm",n)).replace("ss",s)}return e}function fu(t,e){const i=e.indexOf("yyyy"),n=e.indexOf("mm"),s=e.indexOf("dd"),r=n<i?n<s?0:1:n<s?1:2,a=s<i?s<n?0:1:s<n?1:2,o=parseInt(t[i<n?i<s?0:1:n<s?1:2],10),l=parseInt(t[r],10)-1,h=parseInt(t[a],10);if(isNaN(o)||o<1)return!1;if(isNaN(l)||l<0||l>11)return!1;const d=[31,mu(o)?29:28,31,30,31,30,31,31,30,31,30,31];return!(isNaN(h)||h<1||h>d[l])}function vu(t,e){if(e.includes("hh")||e.includes("mm")||e.includes("ss")){const i=e.indexOf("hh")>-1?e.indexOf("hh"):e.indexOf("HH"),n=parseInt(t[i],10),s=parseInt(t[i+1],10),r=t.length>i+2?parseInt(t[i+2],10):0;if(isNaN(n)||n<0||n>23)return!1;if(isNaN(s)||s<0||s>59)return!1;if(isNaN(r)||r<0||r>59)return!1}return!0}function mu(t){return t%4==0&&t%100!=0||t%400==0}function bu(t){const e=["yyyy-mm-dd","dd-mm-yyyy","mm/dd/yyyy","yyyy/mm/dd","dd/mm/yyyy","yyyy.mm.dd","mm.dd.yyyy","dd.mm.yyyy"],i=["hh:mm:ss","hh:mm"],n=(t=t.trim()).split(" "),s=n[0],r=n[1];let a,o;if(s)for(let t=0;t<e.length;t++){const i=e[t],n=s.split(yu(i)),r=fu(n,i);if(3===n.length&&r){a=i;break}}if(a&&r)for(let t=0;t<i.length;t++){const e=i[t],n=r.split(yu(e)),s=e.split(yu(e));if(vu(n,e)&&n.length===s.length){o=e;break}}return s&&r&&a&&o?a+" "+o:s&&!r?a:"yyyy-mm-dd hh:mm:ss"}function yu(t){const e=t.match(/[^\w]/g);if(e){const t=e.map((t=>"\\"+t)).join("|");return new RegExp(t,"g")}return/[^\w]/}function xu(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]}function _u(t){const e=new Date(t.getFullYear(),0,1);return Math.ceil(((t.getTime()+1-e.getTime())/864e5+1)/7)}function wu(t){let e,i=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(t){if(e=new Date(t),"string"==typeof t){if(t.length>10)return i&&e.setHours(0,0,0,0),e;e.setHours(0,0,0,0)}}else e=new Date;return i&&e.setHours(0,0,0,0),e}function Tu(t){let e,i=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(t){if(e=new Date(t),"string"==typeof t){if(t.length>10)return i&&e.setMinutes(59,59,999),e;e.setMinutes(59,59,999)}}else e=new Date;return i&&e.setMinutes(59,59,999),e}function Su(t){let e,i=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(t){if(e=new Date(t),"string"==typeof t){if(t.length>10)return i&&e.setSeconds(59,999),e;e.setSeconds(59,999)}}else e=new Date;return i&&e.setSeconds(59,999),e}function ku(t){let e,i=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(t){if(e=new Date(t),"string"==typeof t){if(t.length>10)return i&&e.setMilliseconds(999),e;e.setMilliseconds(999)}}else e=new Date;return i&&e.setMilliseconds(999),e}function Bu(t){let e,i=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(t){if(e=new Date(t),"string"==typeof t){if(t.length>10)return i&&e.setHours(23,59,59,999),e;e.setHours(23,59,59,999)}}else e=new Date;return i&&e.setHours(23,59,59,999),e}function Au(t,e,i,n){let s=new Date(e);switch(i){case"second":s.setMilliseconds(999);break;case"minute":s.setSeconds(59,999);break;case"hour":s.setMinutes(59,59,999);break;case"day":s.setHours(23,59,59,999);break;case"week":const t=6-s.getDay();s.setDate(s.getDate()+t),s.setHours(23,59,59,999);break;case"month":const e=new Date(s.getFullYear(),s.getMonth()+1,0).getDate();s.setDate(e),s.setHours(23,59,59,999);break;case"quarter":const i=s.getMonth(),n=i-i%3+2,r=new Date(s.getFullYear(),n+1,0).getDate();s.setMonth(n,r),s.setHours(23,59,59,999);break;case"year":s.setMonth(11,31),s.setHours(23,59,59,999);break;default:throw new Error("Invalid time scale")}const r=Lu(s,t,i,n,1),a=Math.ceil(r);if(a>r){const t=(a-r)*n,e=1e3,o=60*e,l=60*o,h=24*l,d=7*h;switch(new Date(s.getTime()+1),i){case"second":s.setTime(s.getTime()+t*e);break;case"minute":s.setTime(s.getTime()+t*o);break;case"hour":s.setTime(s.getTime()+t*l);break;case"day":s.setTime(s.getTime()+t*h);break;case"week":s.setTime(s.getTime()+t*d);break;case"month":s=new Date(s.getFullYear(),s.getMonth()+1+Math.round(t),0),s.setHours(23,59,59,999);break;case"quarter":const i=s.getMonth(),n=i-i%3+2;s=new Date(s.getFullYear(),n+Math.round(3*t)+1,0),s.setHours(23,59,59,999);break;case"year":s.setFullYear(s.getFullYear()+Math.floor(t)),s.setHours(23,59,59,999);break;default:throw new Error("Invalid time scale")}}return s}function Cu(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"monday";const n=new Date(t);switch(e){case"second":n.setMilliseconds(0);break;case"minute":n.setSeconds(0,0);break;case"hour":n.setMinutes(0,0,0);break;case"day":n.setHours(0,0,0,0);break;case"week":const t=n.getDay();let e=t;e="monday"===i?0===t?-6:1-t:-t,n.setDate(n.getDate()+e),n.setHours(0,0,0,0);break;case"month":n.setDate(1),n.setHours(0,0,0,0);break;case"quarter":const s=n.getMonth(),r=s-s%3;n.setMonth(r,1),n.setHours(0,0,0,0);break;case"year":n.setMonth(0,1),n.setHours(0,0,0,0);break;default:throw new Error("Invalid time scale")}return n}function Lu(t,e,i,n){let s,r=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0;const a=new Date(t.getTime()+r);switch(i){case"second":s=(a.getTime()-e.getTime())/1e3;break;case"minute":s=(a.getTime()-e.getTime())/6e4;break;case"hour":s=(a.getTime()-e.getTime())/36e5;break;case"day":s=(a.getTime()-e.getTime())/864e5;break;case"week":s=(a.getTime()-e.getTime())/6048e5;break;case"month":s=12*(a.getFullYear()-e.getFullYear())+(a.getMonth()-e.getMonth()),s+=(a.getDate()-e.getDate())/new Date(a.getFullYear(),a.getMonth()+1,0).getDate();break;case"quarter":s=4*(a.getFullYear()-e.getFullYear())+(a.getMonth()-e.getMonth())/3,s+=(a.getDate()-e.getDate())/(3*new Date(a.getFullYear(),a.getMonth()+1,0).getDate());break;case"year":s=a.getFullYear()-e.getFullYear(),s+=(a.getMonth()-e.getMonth())/12;break;default:throw new Error("Invalid time scale")}return s/n}class Ou{constructor(t){var e;this._scene=t,this.scrollLeft=0,this.scrollTop=0,this.x=0,this.y=t._gantt.getAllHeaderRowsHeight(),this.width=t.ganttGroup.attribute.width,this.height=t.ganttGroup.attribute.height-t.timelineHeader.group.attribute.height,this.rowHeight=t._gantt.parsedOptions.rowHeight,this.rowCount=t._gantt.itemCount,this.allGridWidth=t._gantt.getAllDateColsWidth(),this.allGridHeight=t._gantt.getAllTaskBarsHeight(),this.group=new Ua({x:this.x,y:this.y,width:this.width,height:this.height,clip:!0,fill:null===(e=t._gantt.parsedOptions.grid)||void 0===e?void 0:e.backgroundColor}),this.group.name="grid-container",t.ganttGroup.addChild(this.group),this.createVerticalBackgroundRects(),this.createHorizontalBackgroundRects(),this.createVerticalLines(),this.createHorizontalLines(),this.createTimeLineHeaderBottomLine()}createTimeLineHeaderBottomLine(){var t,e,i,n,s,r;const a=this._scene._gantt.parsedOptions,o=null!==(e=null===(t=a.horizontalSplitLine)||void 0===t?void 0:t.lineWidth)&&void 0!==e?e:null===(i=a.timelineHeaderHorizontalLineStyle)||void 0===i?void 0:i.lineWidth,l=(1&o?-.5:0)+o/2,h=zo({pickable:!1,stroke:null!==(s=null===(n=a.horizontalSplitLine)||void 0===n?void 0:n.lineColor)&&void 0!==s?s:null===(r=a.timelineHeaderHorizontalLineStyle)||void 0===r?void 0:r.lineColor,lineWidth:o+(1&o?1:0),points:[{x:0,y:l},{x:this._scene._gantt.getAllDateColsWidth(),y:l}]});h.name="timeLine-header-bottom-line",this.group.addChild(h)}createVerticalLines(){var t,e;const i=this._scene._gantt.parsedOptions.grid,n=null!==(t=i.verticalLineDependenceOnTimeScale)&&void 0!==t?t:this._scene._gantt.parsedOptions.reverseSortedTimelineScales[0].unit;if(i.verticalLine){this.verticalLineGroup=new Ua({x:0,y:0,width:this.allGridWidth,height:this.allGridHeight}),this.verticalLineGroup.name="grid-vertical",this.group.appendChild(this.verticalLineGroup);const t=null!==(e=this._scene._gantt.parsedOptions.reverseSortedTimelineScales.find((t=>t.unit===n)))&&void 0!==e?e:this._scene._gantt.parsedOptions.reverseSortedTimelineScales[0],{unit:s,step:r}=this._scene._gantt.parsedOptions.reverseSortedTimelineScales[0],{timelineDates:a}=t,o=this._scene._gantt.parsedOptions.timelineColWidth;if("function"==typeof i.verticalLine)for(let t=0;t<(null==a?void 0:a.length)-1;t++){const{endDate:e}=a[t],n=i.verticalLine({index:t,dateIndex:a[t].dateIndex,date:a[t].endDate,ganttInstance:this._scene._gantt}),l=Math.ceil(Lu(e,this._scene._gantt.parsedOptions.minDate,s,r,1)*o)+(1&n.lineWidth?.5:0),h=zo({pickable:!1,stroke:n.lineColor,lineWidth:n.lineWidth,points:[{x:l,y:0},{x:l,y:this.allGridHeight}]});this.verticalLineGroup.appendChild(h)}else{const t=i.verticalLine;for(let e=0;e<(null==a?void 0:a.length)-1;e++){const{endDate:i}=a[e],n=Math.ceil(Lu(i,this._scene._gantt.parsedOptions.minDate,s,r,1)*o)+(1&t.lineWidth?.5:0),l=zo({pickable:!1,stroke:t.lineColor,lineWidth:t.lineWidth,points:[{x:n,y:0},{x:n,y:this.allGridHeight}]});this.verticalLineGroup.appendChild(l)}}}}createHorizontalLines(){const t=this._scene._gantt.parsedOptions.grid;if(t.horizontalLine)if(this.horizontalLineGroup=new Ua({x:0,y:0,width:this.allGridWidth,height:this.allGridHeight}),this.horizontalLineGroup.name="grid-horizontal",this.group.appendChild(this.horizontalLineGroup),"function"==typeof t.horizontalLine){let e=.5;for(let i=0;i<this.rowCount-1;i++){const n=t.horizontalLine({index:i,ganttInstance:this._scene._gantt});e+=this._scene._gantt.getRowHeightByIndex(i);const s=zo({pickable:!1,stroke:n.lineColor,lineWidth:n.lineWidth,points:[{x:0,y:e},{x:this.allGridWidth,y:e}]});this.horizontalLineGroup.appendChild(s)}}else{const e=t.horizontalLine;let i=0;1&e.lineWidth&&(i+=.5);for(let t=0;t<this.rowCount-1;t++){i+=this._scene._gantt.getRowHeightByIndex(t);const n=zo({pickable:!1,stroke:e.lineColor,lineWidth:e.lineWidth,points:[{x:0,y:i},{x:this.allGridWidth,y:i}]});this.horizontalLineGroup.appendChild(n)}}}createVerticalBackgroundRects(){const t=this._scene._gantt.parsedOptions.grid.verticalBackgroundColor,e=this._scene._gantt.parsedOptions.grid.weekendBackgroundColor;if(t||e){this.verticalBackgroundRectsGroup=new Ua({x:0,y:0,width:this.allGridWidth,height:this.allGridHeight}),this.verticalBackgroundRectsGroup.name="grid-vertical-background",this.group.appendChild(this.verticalBackgroundRectsGroup);const{timelineDates:i,unit:n,step:s}=this._scene._gantt.parsedOptions.reverseSortedTimelineScales[0],r=this._scene._gantt.parsedOptions.timelineColWidth;if(t||e)for(let a=0;a<=(null==i?void 0:i.length)-1;a++){let o;if(!e||"day"!==n||1!==s||0!==i[a].startDate.getDay()&&6!==i[a].startDate.getDay()?"function"==typeof t?o=t({index:a,dateIndex:i[a].dateIndex,date:i[a].endDate,ganttInstance:this._scene._gantt}):t&&(o=t[a%t.length]):o=e,o){const t=jo({pickable:!1,fill:o,x:Math.ceil(r*a),y:0,width:r,height:this.allGridHeight});this.verticalBackgroundRectsGroup.appendChild(t)}}}}createHorizontalBackgroundRects(){const t=this._scene._gantt.parsedOptions.grid.horizontalBackgroundColor;if(t){this.horizontalBackgroundRectsGroup=new Ua({x:0,y:0,width:this.allGridWidth,height:this.allGridHeight}),this.horizontalBackgroundRectsGroup.name="grid-horizontal-background",this.group.appendChild(this.horizontalBackgroundRectsGroup);let e=0;for(let i=0;i<=this.rowCount-1;i++){let n;n="function"==typeof t?t({index:i,ganttInstance:this._scene._gantt}):t[i%t.length];const s=jo({pickable:!1,fill:n,x:0,y:e,width:this.allGridWidth,height:this._scene._gantt.getRowHeightByIndex(i)});this.horizontalBackgroundRectsGroup.appendChild(s),e+=this._scene._gantt.getRowHeightByIndex(i)}}}refresh(){this.width=this._scene.ganttGroup.attribute.width,this.height=this._scene.ganttGroup.attribute.height-this._scene.timelineHeader.group.attribute.height,this.group.setAttributes({width:this.width,height:this.height,y:this._scene._gantt.getAllHeaderRowsHeight()}),this.rowCount=this._scene._gantt.itemCount,this.allGridWidth=this._scene._gantt.getAllDateColsWidth(),this.allGridHeight=this._scene._gantt.getAllTaskBarsHeight(),this.group.removeAllChild(),this.createVerticalBackgroundRects(),this.createHorizontalBackgroundRects(),this.createVerticalLines(),this.createHorizontalLines(),this.createTimeLineHeaderBottomLine()}setX(t){var e,i,n,s;null===(e=this.verticalLineGroup)||void 0===e||e.setAttribute("x",t),null===(i=this.horizontalLineGroup)||void 0===i||i.setAttribute("x",t),null===(n=this.verticalBackgroundRectsGroup)||void 0===n||n.setAttribute("x",t),null===(s=this.horizontalBackgroundRectsGroup)||void 0===s||s.setAttribute("x",t)}setY(t){var e,i,n,s;null===(e=this.verticalLineGroup)||void 0===e||e.setAttribute("y",t),null===(i=this.horizontalLineGroup)||void 0===i||i.setAttribute("y",t),null===(n=this.verticalBackgroundRectsGroup)||void 0===n||n.setAttribute("y",t),null===(s=this.horizontalBackgroundRectsGroup)||void 0===s||s.setAttribute("y",t)}resize(){this.width=this._scene.ganttGroup.attribute.width,this.height=this._scene.ganttGroup.attribute.height-this._scene.timelineHeader.group.attribute.height,this.group.setAttribute("width",this.width),this.group.setAttribute("height",this.height)}}class Eu{static get mode(){return Eu._mode||(Eu._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}()),Eu._mode}static set mode(t){Eu._mode=t}static RegisterCreateCanvas(t){Eu.CreateCanvas=t}static RegisterLoadImage(t){Eu.LoadImage=t}static GetCreateCanvasFunc(){return Eu.CreateCanvas?Eu.CreateCanvas:"worker"===Eu.mode?function(){return new OffscreenCanvas(arguments.length>0&&void 0!==arguments[0]?arguments[0]:200,arguments.length>1&&void 0!==arguments[1]?arguments[1]:200)}:void 0}static RegisterRequestAnimationFrame(t){Eu.RequestAnimationFrame=t()}static GetRequestAnimationFrame(){if(Eu.RequestAnimationFrame)return Eu.RequestAnimationFrame}static RegisterCancelAnimationFrame(t){Eu.CancelAnimationFrame=t()}static GetCancelAnimationFrame(){if(Eu.CancelAnimationFrame)return Eu.CancelAnimationFrame}}Eu.dpr=0;class Ru{constructor(t){this._gantt=t,this.createScrollBar(t.tableNoFrameWidth,t.tableNoFrameHeight-t.getAllHeaderRowsHeight())}createScrollBar(t,e){var i,n;const s=this._gantt.parsedOptions.scrollStyle.scrollRailColor,r=this._gantt.parsedOptions.scrollStyle.scrollSliderColor,a=this._gantt.parsedOptions.scrollStyle.scrollSliderCornerRadius,o=this._gantt.parsedOptions.scrollStyle.width;let l;l=tu(a)?{cornerRadius:a,fill:r}:{fill:r},null===(i=this._gantt.parsedOptions.scrollStyle)||void 0===i||i.visible,null===(n=this._gantt.parsedOptions.scrollStyle)||void 0===n||n.hoverOn,this.hScrollBar=new Gc({direction:"horizontal",x:2*-t,y:2*-e,width:t,height:o,padding:0,railStyle:{fill:s},sliderStyle:l,range:[0,.1],visible:!1}),this.hScrollBar.render(),this.hScrollBar.hideAll(),this.vScrollBar=new Gc({direction:"vertical",x:2*-t,y:2*-e,width:o,height:e,padding:0,railStyle:{fill:s},sliderStyle:l,range:[0,.1],visible:!1}),this.vScrollBar.render(),this.vScrollBar.hideAll()}refresh(){}hideVerticalScrollBar(){const t=this._gantt.parsedOptions.scrollStyle.visible;"focus"!==t&&"scrolling"!==t||(this.vScrollBar.setAttribute("visible",!1),this.vScrollBar.hideAll(),this._gantt.scenegraph.updateNextFrame())}showVerticalScrollBar(t){const e=this._gantt.parsedOptions.scrollStyle.visible;"focus"!==e&&"scrolling"!==e||(this.vScrollBar.setAttribute("visible",!0),this.vScrollBar.showAll(),this._gantt.scenegraph.updateNextFrame(),t&&(clearTimeout(this._clearVerticalScrollBar),this._clearVerticalScrollBar=setTimeout((()=>{this.hideVerticalScrollBar()}),1e3)))}hideHorizontalScrollBar(){const t=this._gantt.parsedOptions.scrollStyle.visible;"focus"!==t&&"scrolling"!==t||(this.hScrollBar.setAttribute("visible",!1),this.hScrollBar.hideAll(),this._gantt.scenegraph.updateNextFrame())}showHorizontalScrollBar(t){const e=this._gantt.parsedOptions.scrollStyle.visible;"focus"!==e&&"scrolling"!==e||(this.hScrollBar.setAttribute("visible",!0),this.hScrollBar.showAll(),this._gantt.scenegraph.updateNextFrame(),t&&(clearTimeout(this._clearHorizontalScrollBar),this._clearHorizontalScrollBar=setTimeout((()=>{this.hideHorizontalScrollBar()}),1e3)))}updateVerticalScrollBarPos(t){const e=this.vScrollBar.attribute.range,i=e[1]-e[0],n=t*(1-i);this.vScrollBar.setAttribute("range",[n,n+i]);const s=this.vScrollBar.AABBBounds&&this.vScrollBar.globalAABBBounds;this.vScrollBar._viewPosition={x:s.x1,y:s.y1}}updateHorizontalScrollBarPos(t){const e=this.hScrollBar.attribute.range,i=e[1]-e[0],n=t*(1-i);this.hScrollBar.setAttribute("range",[n,n+i]);const s=this.hScrollBar.AABBBounds&&this.hScrollBar.globalAABBBounds;this.hScrollBar._viewPosition={x:s.x1,y:s.y1}}updateScrollBar(){const t=this._gantt.stateManager.scroll.horizontalBarPos,e=this._gantt.stateManager.scroll.verticalBarPos,i=this._gantt.parsedOptions.scrollStyle,n=null==i?void 0:i.width,s=null==i?void 0:i.visible,r=Math.ceil(this._gantt.scenegraph.ganttGroup.attribute.width),a=Math.ceil(this._gantt.scenegraph.ganttGroup.attribute.height),o=this._gantt.getAllRowsHeight(),l=this._gantt.getAllDateColsWidth(),h=this._gantt.getAllHeaderRowsHeight();if(l>r){const t=Math.min(a,o),e=Math.max(.05,r/l),h=i.hoverOn;let d=0;d=i.barToSide?this._gantt.tableNoFrameHeight-(h?n:-this._gantt.scenegraph.ganttGroup.attribute.y)+this._gantt.tableY:t-(h?n:-this._gantt.scenegraph.ganttGroup.attribute.y)+this._gantt.tableY,this.hScrollBar.setAttributes({x:this._gantt.scenegraph.ganttGroup.attribute.x,y:d,width:r,range:[0,e],visible:"always"===s});const c=this.hScrollBar.AABBBounds&&this.hScrollBar.globalAABBBounds;this.hScrollBar._viewPosition={x:c.x1,y:c.y1},"always"===s&&this.hScrollBar.showAll()}else this.hScrollBar.setAttributes({x:2*-this._gantt.tableNoFrameWidth,y:2*-this._gantt.tableNoFrameHeight,width:0,visible:!1});if(o>a){const t=Math.min(r,l)+this._gantt.scenegraph.ganttGroup.attribute.x,e=Math.max(.05,(a-h)/(o-h));let i=0;const d=this._gantt.parsedOptions.scrollStyle.hoverOn;i=this._gantt.parsedOptions.scrollStyle.barToSide?this._gantt.tableNoFrameWidth-(d?n:-this._gantt.scenegraph.ganttGroup.attribute.x):t-(d?n:-this._gantt.scenegraph.ganttGroup.attribute.x),this.vScrollBar.setAttributes({x:i,y:h+(d?0:this._gantt.scenegraph.ganttGroup.attribute.y)+this._gantt.tableY,height:a-h,range:[0,e],visible:"always"===s});const c=this.vScrollBar.AABBBounds&&this.vScrollBar.globalAABBBounds;this.vScrollBar._viewPosition={x:c.x1,y:c.y1},"always"===s&&this.vScrollBar.showAll()}else this.vScrollBar.setAttributes({x:2*-this._gantt.tableNoFrameWidth,y:2*-this._gantt.tableNoFrameHeight,height:0,visible:!1});this._gantt.stateManager.setScrollLeft(t),this._gantt.stateManager.setScrollTop(e)}}function Mu(t,e,i){let n=!(arguments.length>3&&void 0!==arguments[3])||arguments[3];var s;let{deltaX:r,deltaY:a}=t;t.shiftKey&&t.deltaY&&(r=a,a=0);const[o,l]=function(t,e,i){var n,s;const r=Math.abs(t/e),a=r<=.5?0:t,o=r>2?0:e;return[Math.ceil(a*(null!==(n=i.horizontal)&&void 0!==n?n:0)),Math.ceil(o*(null!==(s=i.vertical)&&void 0!==s?s:0))]}(r,a,{horizontal:1,vertical:1});o&&(e.setScrollLeft(e.scroll.horizontalBarPos+o),i.scenegraph.scrollbarComponent.showHorizontalScrollBar(!0)),l&&(e.setScrollTop(e.scroll.verticalBarPos+l),i.scenegraph.scrollbarComponent.showVerticalScrollBar(!0)),n&&e.resetInteractionState(),(null===(s=t.nativeEvent)||void 0===s?void 0:s.cancelable)&&("none"===e._gantt.parsedOptions.overscrollBehavior||Math.abs(a)>=Math.abs(r)&&0!==a&&Pu(a,e)||Math.abs(a)<=Math.abs(r)&&0!==r&&Du(r,e))&&t.preventDefault()}function Pu(t,e){return 0!=e._gantt.getAllRowsHeight()-e._gantt.scenegraph.height&&!function(t,e){return 0!=e._gantt.getAllRowsHeight()-e._gantt.scenegraph.height&&t<=0&&e.scroll.verticalBarPos<1}(t,e)&&!function(t,e){const i=e._gantt.getAllRowsHeight()-e._gantt.scenegraph.height;return 0!==i&&t>=0&&Math.abs(e.scroll.verticalBarPos-i)<1}(t,e)}function Du(t,e){return 0!=e._gantt.getAllDateColsWidth()-e._gantt.scenegraph.width&&!function(t,e){return 0!=e._gantt.getAllDateColsWidth()-e._gantt.scenegraph.width&&t<=0&&e.scroll.horizontalBarPos<1}(t,e)&&!function(t,e){const i=e._gantt.getAllDateColsWidth()-e._gantt.scenegraph.width;return 0!==i&&t>=0&&Math.abs(e.scroll.horizontalBarPos-i)<1}(t,e)}const Iu={barColor:"blue",completedBarColor:"gray",width:30,cornerRadius:3,borderWidth:0,fontFamily:"Arial",fontSize:14};const Fu="undefined"==typeof window||void 0===window.window;function Nu(t,e){const i=t+e.stateManager.scroll.horizontalBarPos,n=e.getDateColWidth(0);return Math.floor((i-n)/e.parsedOptions.timelineColWidth)+1}function Hu(t){var e,i,n,s,r;return t?!0===t?[{date:wu().toLocaleDateString(),content:"",scrollToMarkLine:!0,position:"left",style:{lineColor:"red",lineWidth:1}}]:Array.isArray(t)?t.map(((t,e)=>{var i,n,s,r;return Object.assign(Object.assign({},t),{date:t.date,scrollToMarkLine:t.scrollToMarkLine,position:null!==(i=t.position)&&void 0!==i?i:"left",style:{lineColor:(null===(n=t.style)||void 0===n?void 0:n.lineColor)||"red",lineWidth:(null===(s=t.style)||void 0===s?void 0:s.lineWidth)||1,lineDash:null===(r=t.style)||void 0===r?void 0:r.lineDash}})})):[Object.assign(Object.assign({},t),{date:t.date,scrollToMarkLine:null===(e=t.scrollToMarkLine)||void 0===e||e,position:null!==(i=t.position)&&void 0!==i?i:"left",style:{lineColor:(null===(n=t.style)||void 0===n?void 0:n.lineColor)||"red",lineWidth:(null===(s=t.style)||void 0===s?void 0:s.lineWidth)||1,lineDash:null===(r=t.style)||void 0===r?void 0:r.lineDash}})]:[]}function zu(t){var e,i,n,s,r,a,o,l,h,d,c,u,p,g,f,v,m,b,y,x,_,w,T,S,k,B,A,C,L,O,E,R,M,P,D,I,F,N,H,z,W,U,j,G,Y,V,X,K,$,q,Z,J,Q,tt,et,it,nt,st,rt,at,ot,lt,ht,dt,ct,ut,pt,gt,ft,vt,mt,bt,yt,xt,_t,wt,Tt,St,kt,Bt,At,Ct,Lt,Ot,Et,Rt,Mt,Pt,Dt,It,Ft,Nt,Ht,zt,Wt,Ut,jt,Gt,Yt,Vt,Xt,Kt,$t,qt,Zt,Jt,Qt,te,ee,ie;const ne=t.options;t.parsedOptions.tasksShowMode=null!==(e=null==ne?void 0:ne.tasksShowMode)&&void 0!==e?e:du.Tasks_Separate,t.parsedOptions.pixelRatio=null!==(i=null==ne?void 0:ne.pixelRatio)&&void 0!==i?i:1,t.parsedOptions.rowHeight=null!==(n=null==ne?void 0:ne.rowHeight)&&void 0!==n?n:40,t.parsedOptions.timelineColWidth=null!==(r=null===(s=null==ne?void 0:ne.timelineHeader)||void 0===s?void 0:s.colWidth)&&void 0!==r?r:60,t.parsedOptions.startDateField=null!==(o=null===(a=ne.taskBar)||void 0===a?void 0:a.startDateField)&&void 0!==o?o:"startDate",t.parsedOptions.endDateField=null!==(h=null===(l=ne.taskBar)||void 0===l?void 0:l.endDateField)&&void 0!==h?h:"endDate",t.parsedOptions.progressField=null!==(c=null===(d=ne.taskBar)||void 0===d?void 0:d.progressField)&&void 0!==c?c:"progress",t.parsedOptions.projectSubTasksExpandable=null===(u=null==ne?void 0:ne.projectSubTasksExpandable)||void 0===u||u;const{unit:se,startOfWeek:re,step:ae}=t.parsedOptions.reverseSortedTimelineScales[0];t.parsedOptions.minDate=(null==ne?void 0:ne.minDate)?Cu(new Date(ne.minDate),se,re):void 0,t.parsedOptions.maxDate=(null==ne?void 0:ne.maxDate)&&(null===(p=t.parsedOptions)||void 0===p?void 0:p.minDate)?Au(null===(g=t.parsedOptions)||void 0===g?void 0:g.minDate,new Date(ne.maxDate),se,ae):void 0,t.parsedOptions._minDateTime=null===(f=t.parsedOptions.minDate)||void 0===f?void 0:f.getTime(),t.parsedOptions._maxDateTime=null===(v=t.parsedOptions.maxDate)||void 0===v?void 0:v.getTime(),t.parsedOptions.overscrollBehavior=null!==(m=null==ne?void 0:ne.overscrollBehavior)&&void 0!==m?m:"auto",t.parsedOptions.underlayBackgroundColor=null!==(b=null==ne?void 0:ne.underlayBackgroundColor)&&void 0!==b?b:"#FFF",t.parsedOptions.scrollStyle=Object.assign({},{scrollRailColor:"rgba(100, 100, 100, 0.2)",scrollSliderColor:"rgba(100, 100, 100, 0.5)",scrollSliderCornerRadius:4,width:10,visible:"always",hoverOn:!0,barToSide:!1},null==ne?void 0:ne.scrollStyle),t.parsedOptions.timelineHeaderHorizontalLineStyle=null===(y=null==ne?void 0:ne.timelineHeader)||void 0===y?void 0:y.horizontalLine,t.parsedOptions.timelineHeaderVerticalLineStyle=null===(x=null==ne?void 0:ne.timelineHeader)||void 0===x?void 0:x.verticalLine,t.parsedOptions.timelineHeaderBackgroundColor=null===(_=null==ne?void 0:ne.timelineHeader)||void 0===_?void 0:_.backgroundColor,t.parsedOptions.timeLineHeaderRowHeights=[],t.parsedOptions.timelineHeaderStyles=[];for(let e=0;e<t.parsedOptions.sortedTimelineScales.length;e++){const i=t.parsedOptions.sortedTimelineScales[e].style;t.parsedOptions.timelineHeaderStyles.push(Object.assign({fontSize:20,fontWeight:"bold",textAlign:"center",textBaseline:"middle",color:"#000",backgroundColor:"#fff"},i)),t.parsedOptions.timeLineHeaderRowHeights.push(null!==(T=null!==(w=t.parsedOptions.sortedTimelineScales[e].rowHeight)&&void 0!==w?w:null==ne?void 0:ne.headerRowHeight)&&void 0!==T?T:40)}var oe;t.parsedOptions.grid=Object.assign({},null==ne?void 0:ne.grid),oe=3*t.parsedOptions.rowHeight/4,Iu.width=oe,t.parsedOptions.taskBarStyle=(null===(S=null==ne?void 0:ne.taskBar)||void 0===S?void 0:S.barStyle)&&"function"==typeof(null===(k=null==ne?void 0:ne.taskBar)||void 0===k?void 0:k.barStyle)?ne.taskBar.barStyle:Object.assign({},Iu,null===(B=null==ne?void 0:ne.taskBar)||void 0===B?void 0:B.barStyle),t.parsedOptions.projectBarStyle=(null===(A=null==ne?void 0:ne.taskBar)||void 0===A?void 0:A.projectStyle)&&"function"==typeof(null===(C=null==ne?void 0:ne.taskBar)||void 0===C?void 0:C.projectStyle)?ne.taskBar.projectStyle:(null===(L=null==ne?void 0:ne.taskBar)||void 0===L?void 0:L.projectStyle)?Object.assign({},Iu,null===(O=null==ne?void 0:ne.taskBar)||void 0===O?void 0:O.projectStyle):t.parsedOptions.taskBarStyle,t.parsedOptions.taskBarMilestoneStyle=Object.assign("function"==typeof t.parsedOptions.taskBarStyle?{}:{width:t.parsedOptions.taskBarStyle.width,borderColor:t.parsedOptions.taskBarStyle.borderColor,borderLineWidth:null!==(E=t.parsedOptions.taskBarStyle.borderLineWidth)&&void 0!==E?E:1,fillColor:t.parsedOptions.taskBarStyle.barColor,cornerRadius:0},{labelTextStyle:{fontSize:16,color:"red",fontFamily:"Arial",padding:4}},null===(R=null==ne?void 0:ne.taskBar)||void 0===R?void 0:R.milestoneStyle),t.parsedOptions.taskBarMilestoneHypotenuse=t.parsedOptions.taskBarMilestoneStyle.width*Math.sqrt(2),t.parsedOptions.dateFormat=null==ne?void 0:ne.dateFormat,t.parsedOptions.taskBarHoverStyle=Object.assign({barOverlayColor:"rgba(99, 144, 0, 0.4)"},null===(M=null==ne?void 0:ne.taskBar)||void 0===M?void 0:M.hoverBarStyle),t.parsedOptions.taskBarSelectable=null===(D=null===(P=null==ne?void 0:ne.taskBar)||void 0===P?void 0:P.selectable)||void 0===D||D,t.parsedOptions.taskBarSelectedStyle=Object.assign("function"==typeof t.parsedOptions.taskBarStyle?{shadowBlur:6,shadowOffsetX:0,shadowOffsetY:0,borderLineWidth:1}:{shadowBlur:6,shadowOffsetX:0,shadowOffsetY:0,shadowColor:t.parsedOptions.taskBarStyle.barColor,borderColor:t.parsedOptions.taskBarStyle.barColor,borderLineWidth:1},null===(I=null==ne?void 0:ne.taskBar)||void 0===I?void 0:I.selectedBarStyle),t.parsedOptions.taskBarLabelText=null!==(N=null===(F=null==ne?void 0:ne.taskBar)||void 0===F?void 0:F.labelText)&&void 0!==N?N:"",t.parsedOptions.taskBarMoveable=null===(z=null===(H=null==ne?void 0:ne.taskBar)||void 0===H?void 0:H.moveable)||void 0===z||z,t.parsedOptions.moveTaskBarToExtendDateRange=null===(U=null===(W=null==ne?void 0:ne.taskBar)||void 0===W?void 0:W.moveToExtendDateRange)||void 0===U||U,t.parsedOptions.taskBarResizable=null===(G=null===(j=null==ne?void 0:ne.taskBar)||void 0===j?void 0:j.resizable)||void 0===G||G,t.parsedOptions.taskBarDragOrder=null===(V=null===(Y=null==ne?void 0:ne.taskBar)||void 0===Y?void 0:Y.dragOrder)||void 0===V||V,t.parsedOptions.taskBarLabelStyle={fontFamily:null!==($=null===(K=null===(X=null==ne?void 0:ne.taskBar)||void 0===X?void 0:X.labelTextStyle)||void 0===K?void 0:K.fontFamily)&&void 0!==$?$:"Arial",fontSize:null!==(J=null===(Z=null===(q=null==ne?void 0:ne.taskBar)||void 0===q?void 0:q.labelTextStyle)||void 0===Z?void 0:Z.fontSize)&&void 0!==J?J:20,color:null!==(et=null===(tt=null===(Q=null==ne?void 0:ne.taskBar)||void 0===Q?void 0:Q.labelTextStyle)||void 0===tt?void 0:tt.color)&&void 0!==et?et:"#F01",outsideColor:null!==(st=null===(nt=null===(it=null==ne?void 0:ne.taskBar)||void 0===it?void 0:it.labelTextStyle)||void 0===nt?void 0:nt.outsideColor)&&void 0!==st?st:"#333333",textAlign:null!==(ot=null===(at=null===(rt=null==ne?void 0:ne.taskBar)||void 0===rt?void 0:rt.labelTextStyle)||void 0===at?void 0:at.textAlign)&&void 0!==ot?ot:"left",textBaseline:null!==(dt=null===(ht=null===(lt=null==ne?void 0:ne.taskBar)||void 0===lt?void 0:lt.labelTextStyle)||void 0===ht?void 0:ht.textBaseline)&&void 0!==dt?dt:"middle",padding:null!==(pt=null===(ut=null===(ct=null==ne?void 0:ne.taskBar)||void 0===ct?void 0:ct.labelTextStyle)||void 0===ut?void 0:ut.padding)&&void 0!==pt?pt:[0,0,0,10],textOverflow:null===(ft=null===(gt=null==ne?void 0:ne.taskBar)||void 0===gt?void 0:gt.labelTextStyle)||void 0===ft?void 0:ft.textOverflow,orient:null===(mt=null===(vt=null==ne?void 0:ne.taskBar)||void 0===vt?void 0:vt.labelTextStyle)||void 0===mt?void 0:mt.orient,orientHandleWithOverflow:null===(yt=null===(bt=null==ne?void 0:ne.taskBar)||void 0===bt?void 0:bt.labelTextStyle)||void 0===yt?void 0:yt.orientHandleWithOverflow},t.parsedOptions.taskBarCustomLayout=null===(xt=null==ne?void 0:ne.taskBar)||void 0===xt?void 0:xt.customLayout,t.parsedOptions.taskBarCreatable=null!==(wt=null===(_t=null==ne?void 0:ne.taskBar)||void 0===_t?void 0:_t.scheduleCreatable)&&void 0!==wt?wt:!(t.parsedOptions.tasksShowMode!==du.Sub_Tasks_Separate&&t.parsedOptions.tasksShowMode!==du.Tasks_Separate),t.parsedOptions.taskBarCreationButtonStyle=Object.assign({lineColor:"rgb(99, 144, 0)",lineWidth:1,lineDash:[5,5],cornerRadius:4,backgroundColor:"#FFF"},null===(St=null===(Tt=null==ne?void 0:ne.taskBar)||void 0===Tt?void 0:Tt.scheduleCreation)||void 0===St?void 0:St.buttonStyle),t.parsedOptions.taskBarCreationCustomLayout=null===(Bt=null===(kt=null==ne?void 0:ne.taskBar)||void 0===kt?void 0:kt.scheduleCreation)||void 0===Bt?void 0:Bt.customLayout,t.parsedOptions.taskBarCreationMaxWidth=null===(Ct=null===(At=null==ne?void 0:ne.taskBar)||void 0===At?void 0:At.scheduleCreation)||void 0===Ct?void 0:Ct.maxWidth,t.parsedOptions.taskBarCreationMinWidth=null===(Ot=null===(Lt=null==ne?void 0:ne.taskBar)||void 0===Lt?void 0:Lt.scheduleCreation)||void 0===Ot?void 0:Ot.minWidth,t.parsedOptions.outerFrameStyle=Object.assign({borderColor:"#e1e4e8",borderLineWidth:1,cornerRadius:4},null===(Et=ne.frame)||void 0===Et?void 0:Et.outerFrameStyle),t.parsedOptions.markLine=Hu(null==ne?void 0:ne.markLine),null!==(Mt=null===(Rt=t.parsedOptions.markLine)||void 0===Rt?void 0:Rt.length)&&void 0!==Mt&&Mt&&((null===(Pt=t.parsedOptions.markLine)||void 0===Pt?void 0:Pt.every((t=>void 0===t.scrollToMarkLine)))&&(t.parsedOptions.markLine[0].scrollToMarkLine=!0),(null===(Dt=t.parsedOptions.markLine)||void 0===Dt?void 0:Dt.find((t=>t.scrollToMarkLine)))&&(t.parsedOptions.scrollToMarkLineDate=Cu(new Date(null===(It=t.parsedOptions.markLine)||void 0===It?void 0:It.find((t=>t.scrollToMarkLine)).date),se,re))),t.parsedOptions.verticalSplitLineHighlight=null===(Ft=ne.frame)||void 0===Ft?void 0:Ft.verticalSplitLineHighlight,t.parsedOptions.verticalSplitLine=Object.assign({lineColor:null===(Nt=t.parsedOptions.outerFrameStyle)||void 0===Nt?void 0:Nt.borderColor,lineWidth:null===(Ht=t.parsedOptions.outerFrameStyle)||void 0===Ht?void 0:Ht.borderLineWidth},null===(zt=ne.frame)||void 0===zt?void 0:zt.verticalSplitLine),t.parsedOptions.horizontalSplitLine=null===(Wt=ne.frame)||void 0===Wt?void 0:Wt.horizontalSplitLine,t.parsedOptions.verticalSplitLineMoveable=null===(Ut=ne.frame)||void 0===Ut?void 0:Ut.verticalSplitLineMoveable,t.parsedOptions.taskKeyField=null!==(jt=ne.taskKeyField)&&void 0!==jt?jt:"id",t.parsedOptions.dependencyLinks=null!==(Yt=null===(Gt=ne.dependency)||void 0===Gt?void 0:Gt.links)&&void 0!==Yt?Yt:[],t.parsedOptions.dependencyLinkCreatable=null!==(Xt=null===(Vt=ne.dependency)||void 0===Vt?void 0:Vt.linkCreatable)&&void 0!==Xt&&Xt,t.parsedOptions.dependencyLinkSelectable=null===($t=null===(Kt=ne.dependency)||void 0===Kt?void 0:Kt.linkSelectable)||void 0===$t||$t,t.parsedOptions.dependencyLinkDeletable=null!==(Zt=null===(qt=ne.dependency)||void 0===qt?void 0:qt.linkDeletable)&&void 0!==Zt&&Zt,t.parsedOptions.dependencyLinkLineStyle=Object.assign({lineColor:"red",lineWidth:1},null===(Jt=ne.dependency)||void 0===Jt?void 0:Jt.linkLineStyle),t.parsedOptions.dependencyLinkSelectedLineStyle=Object.assign({shadowBlur:4,shadowOffset:0,shadowColor:t.parsedOptions.dependencyLinkLineStyle.lineColor,lineColor:t.parsedOptions.dependencyLinkLineStyle.lineColor,lineWidth:t.parsedOptions.dependencyLinkLineStyle.lineWidth},null===(Qt=null==ne?void 0:ne.dependency)||void 0===Qt?void 0:Qt.linkSelectedLineStyle),t.parsedOptions.dependencyLinkLineCreatePointStyle=Object.assign({strokeColor:"red",fillColor:"white",radius:5,strokeWidth:1},null===(te=null==ne?void 0:ne.dependency)||void 0===te?void 0:te.linkCreatePointStyle),t.parsedOptions.dependencyLinkLineCreatingPointStyle=Object.assign({strokeColor:"red",fillColor:"red",radius:5,strokeWidth:1},null===(ee=null==ne?void 0:ne.dependency)||void 0===ee?void 0:ee.linkCreatingPointStyle),t.parsedOptions.dependencyLinkLineCreatingStyle=Object.assign({lineColor:"red",lineWidth:1,lineDash:[5,5]},null===(ie=null==ne?void 0:ne.dependency)||void 0===ie?void 0:ie.linkCreatingLineStyle),t.parsedOptions.eventOptions=null==ne?void 0:ne.eventOptions,t.parsedOptions.keyboardOptions=null==ne?void 0:ne.keyboardOptions,t.parsedOptions.markLineCreateOptions=null==ne?void 0:ne.markLineCreateOptions}function Wu(t,e,i){var n;const{unit:s,step:r,format:a}=i,o=[];for(;t<e;)if("day"===s){const i=t.getFullYear(),n=t.getMonth(),s=t.getDate(),l=Bu(new Date(i,n,s+r-1),!0);l.getTime()>e.getTime()&&l.setTime(e.getTime());const h=t,d=(null==a?void 0:a({dateIndex:s,startDate:h,endDate:l}))||s.toString(),c={days:Math.abs(l.getTime()-t.getTime()+1)/864e5,startDate:h,endDate:l,step:r,unit:"day",title:d,dateIndex:s};o.push(c),t=new Date(i,n,s+r)}else if("month"===s){const i=t.getFullYear(),n=t.getMonth(),s=Bu(new Date(i,n+r,0),!0);s.getTime()>e.getTime()&&s.setTime(e.getTime());const l=t,h=(null==a?void 0:a({dateIndex:n+1,startDate:l,endDate:s}))||(n+1).toString(),d={days:Math.abs(s.getTime()-t.getTime()+1)/864e5,startDate:l,step:r,unit:"month",endDate:s,title:h,dateIndex:n+1};o.push(d),t=new Date(i,n+r,1)}else if("quarter"===s){const i=t.getFullYear(),n=Math.floor(t.getMonth()/3),s=Bu(new Date(i,3*(n+r),0),!0);s.getTime()>e.getTime()&&s.setTime(e.getTime());const l=t,h=(null==a?void 0:a({dateIndex:n+1,startDate:l,endDate:s}))||(n+1).toString(),d={days:Math.abs(s.getTime()-t.getTime()+1)/864e5,startDate:l,step:r,unit:"quarter",endDate:s,title:h,dateIndex:n+1};o.push(d),t=new Date(i,3*(n+r),1)}else if("year"===s){const i=t.getFullYear(),n=Bu(new Date(i+r-1,11,31),!0);n.getTime()>e.getTime()&&n.setTime(e.getTime());const s=t,l=(null==a?void 0:a({dateIndex:i,startDate:s,endDate:n}))||i.toString(),h={days:Math.abs(n.getTime()-t.getTime()+1)/864e5,startDate:s,endDate:n,step:r,unit:"year",title:l,dateIndex:i};o.push(h),t=new Date(i+r,0,1)}else if("week"===s){const s=null!==(n=i.startOfWeek)&&void 0!==n?n:"monday";let l=t.getDay();"monday"===s&&(l=0===l?6:l-1);const h=wu(t),d=Bu(t.getTime()+24*(7*r-l)*60*60*1e3-1,!0);d>e&&d.setTime(e.getTime());const c=_u(h),u=(null==a?void 0:a({dateIndex:c,startDate:h,endDate:d}))||c.toString(),p={days:(d.getTime()-h.getTime()+1)/864e5,startDate:h,endDate:d,step:r,unit:"week",title:u,dateIndex:c};o.push(p),t.setTime(wu(t.getTime()+24*(7*r-l)*60*60*1e3,!0).getTime())}else if("hour"===s){const i=t.getFullYear(),n=t.getMonth(),s=t.getDate(),l=t.getHours(),h=Tu(new Date(i,n,s,l+r-1),!0);h.getTime()>e.getTime()&&h.setTime(e.getTime());const d=t,c=(null==a?void 0:a({dateIndex:l,startDate:d,endDate:h}))||l.toString(),u={days:Math.abs(h.getTime()-t.getTime()+1)/864e5,startDate:d,endDate:h,step:r,unit:"hour",title:c,dateIndex:t.getHours()};o.push(u),t=new Date(i,n,s,l+r)}else if("minute"===s){const i=t.getFullYear(),n=t.getMonth(),s=t.getDate(),l=t.getHours(),h=t.getMinutes(),d=Su(new Date(i,n,s,l,h+r-1),!0);d.getTime()>e.getTime()&&d.setTime(e.getTime());const c=t,u=(null==a?void 0:a({dateIndex:h,startDate:c,endDate:d}))||h.toString(),p={days:Math.abs(d.getTime()-t.getTime()+1)/864e5,startDate:c,endDate:d,step:r,unit:"minute",title:u,dateIndex:t.getMinutes()};o.push(p),t=new Date(i,n,s,l,h+r)}else if("second"===s){const i=t.getFullYear(),n=t.getMonth(),s=t.getDate(),l=t.getHours(),h=t.getMinutes(),d=t.getSeconds(),c=ku(new Date(i,n,s,l,h,d+r-1),!0);c.getTime()>e.getTime()&&c.setTime(e.getTime());const u=t,p=(null==a?void 0:a({dateIndex:d,startDate:u,endDate:c}))||d.toString(),g={days:Math.abs(c.getTime()-t.getTime()+1)/864e5,startDate:u,endDate:c,step:r,unit:"second",title:p,dateIndex:t.getSeconds()};o.push(g),t=new Date(i,n,s,l,h,d+r)}return o}function Uu(t,e,i,n,s){var r,a,o,l,h,d,c,u,p;let g=null!==(r=t[3])&&void 0!==r?r:10;"right"===e||"end"===e?g=n-0-(null!==(a=t[1])&&void 0!==a?a:10):"center"===e&&(g=0+(n-0+(null!==(o=t[3])&&void 0!==o?o:10)-(null!==(l=t[1])&&void 0!==l?l:10))/2);let f=0+(null!==(h=t[0])&&void 0!==h?h:10);return"bottom"===i||"alphabetic"===i||"ideographic"===i?f=s-0-(null!==(d=t[2])&&void 0!==d?d:10):"middle"===i&&(f=0+(s-0-(null!==(c=t[0])&&void 0!==c?c:10)-(null!==(u=t[2])&&void 0!==u?u:10))/2+(null!==(p=t[0])&&void 0!==p?p:10)),{x:g,y:f}}function ju(t){if(t.verticalSplitResizeLine){t.verticalSplitResizeLine.style.position="absolute",t.verticalSplitResizeLine.style.top=t.tableY+"px",t.verticalSplitResizeLine.style.left=t.taskTableWidth?t.taskTableWidth-7+t.parsedOptions.verticalSplitLine.lineWidth/2+"px":"0px",t.verticalSplitResizeLine.style.width="14px",t.verticalSplitResizeLine.style.height=t.drawHeight+"px",t.verticalSplitResizeLine.style.backgroundColor="rgba(0,0,0,0)",t.verticalSplitResizeLine.style.zIndex="100",t.parsedOptions.verticalSplitLineMoveable&&(t.verticalSplitResizeLine.style.cursor="col-resize"),t.verticalSplitResizeLine.style.userSelect="none",t.verticalSplitResizeLine.style.opacity="1";const e=t.verticalSplitResizeLine.childNodes[0];if(e.style.position="absolute",e.style.top="0px",e.style.left=(14-t.parsedOptions.verticalSplitLine.lineWidth)/2+"px",e.style.width=t.parsedOptions.verticalSplitLine.lineWidth+"px",e.style.height="100%",e.style.backgroundColor=t.parsedOptions.verticalSplitLine.lineColor,e.style.zIndex="100",e.style.userSelect="none",e.style.pointerEvents="none",e.style.transition="background-color 0.3s",t.verticalSplitResizeLine.childNodes[1]){const e=t.verticalSplitResizeLine.childNodes[1];e.style.position="absolute",e.style.top="0px",e.style.left=(14-t.parsedOptions.verticalSplitLineHighlight.lineWidth)/2+"px",e.style.width=t.parsedOptions.verticalSplitLineHighlight.lineWidth+"px",e.style.height="100%",e.style.backgroundColor=t.parsedOptions.verticalSplitLineHighlight.lineColor,e.style.zIndex="100",e.style.cursor="col-resize",e.style.userSelect="none",e.style.pointerEvents="none",e.style.opacity="0",e.style.transition="background-color 0.3s"}}}function Gu(t,e,i){let n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"children";var s;for(let r=0;r<t.length;r++){if(Array.isArray(i)&&1===i.length&&t[r][e]===i[0]||t[r][e]===i)return{record:t[r],index:[r]};if(null===(s=t[r][n])||void 0===s?void 0:s.length)if(Array.isArray(i)&&i[0]===t[r][e]){const s=Gu(t[r][n],e,i.slice(1));if(s)return s.index.unshift(r),s}else if(!Array.isArray(i)){const s=Gu(t[r][n],e,i);if(s)return s.index.unshift(r),s}}}function Yu(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"children";var i;for(let n=0;n<t.length;n++)(null===(i=t[n][e])||void 0===i?void 0:i.length)?Yu(t[n][e],e):(delete t[n].vtable_gantt_linkedTo,delete t[n].vtable_gantt_linkedFrom)}function Vu(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"children";var i;for(let n=0;n<t.length;n++)(null===(i=t[n][e])||void 0===i?void 0:i.length)?Vu(t[n][e],e):delete t[n].vtable_gantt_showIndex}function Xu(t,e){var i;let n,s;if(e.taskListTableInstance){const r=e.taskListTableInstance.getTargetRowAt(t+e.headerHeight);if(r){const{row:a}=r;n=a-e.taskListTableInstance.columnHeaderLevelCount;const o=e.getRowsHeightByIndex(0,n-1);if(e.parsedOptions.tasksShowMode===du.Sub_Tasks_Inline||e.parsedOptions.tasksShowMode===du.Sub_Tasks_Arrange||e.parsedOptions.tasksShowMode===du.Sub_Tasks_Compact||e.parsedOptions.tasksShowMode===du.Sub_Tasks_Separate)s=Math.floor((t-o)/e.parsedOptions.rowHeight);else if(e.parsedOptions.tasksShowMode===du.Project_Sub_Tasks_Inline){const r=e.getRecordByIndex(n);r&&r.type===cu.PROJECT&&(null===(i=r.children)||void 0===i?void 0:i.length)>0&&("expand"===r.hierarchyState||!1===e.parsedOptions.projectSubTasksExpandable||(s=Math.floor((t-o)/e.parsedOptions.rowHeight)))}}}else n=Math.floor(t/e.parsedOptions.rowHeight);return{task_index:n,sub_task_index:s}}function Ku(t,e,i,n){return i.some((i=>{const{startDate:s,endDate:r}=$u(n,i);return t<=r&&s<=e}))}function $u(t,e){const{timeScaleIncludeHour:i,startDateField:n,endDateField:s}=t.parsedOptions,r=e[n],a=e[s];return i?{startDate:wu(r),endDate:Bu(a)}:{startDate:wu(r,!0),endDate:Bu(a,!0)}}function qu(t){const e=t.options;t.parsedOptions.markLine=Hu(null==e?void 0:e.markLine)}function Zu(t,e){return{left:t.globalTransMatrix.e+e.taskListTableInstance.tableNoFrameWidth+e.taskListTableInstance.tableX+e.tableX,top:t.globalTransMatrix.f,width:t.attribute.width,height:t.attribute.height}}class Ju{constructor(t){this._scene=t,this.initNodes()}initNodes(){var t,e,i,n,s,r,a,o,l;const{_scene:h}=this,d=new Ua({x:0,y:0,width:h._gantt.getAllDateColsWidth(),height:h._gantt.getAllHeaderRowsHeight(),clip:!0,pickable:!1});this.group=d,d.name="date-header-container",h.ganttGroup.addChild(this.group);const{unit:c,step:u}=h._gantt.parsedOptions.reverseSortedTimelineScales[0];let p=0;for(let g=0;g<h._gantt.timeLineHeaderLevel;g++){const{timelineDates:f,customLayout:v,visible:m}=h._gantt.parsedOptions.sortedTimelineScales[g];if(!1===m)continue;const b=new Ua({x:0,y:p,width:h._gantt.getAllDateColsWidth(),height:h._gantt.parsedOptions.timeLineHeaderRowHeights[g],clip:!1});p+=b.attribute.height,b.name="row-header",d.addChild(b);for(let r=0;r<(null==f?void 0:f.length);r++){const{days:a,endDate:o,startDate:l,title:d,dateIndex:p,unit:m}=f[r],y=Math.ceil(Lu(l,h._gantt.parsedOptions.minDate,c,u)*h._gantt.parsedOptions.timelineColWidth),x=Math.ceil(Lu(o,h._gantt.parsedOptions.minDate,c,u,1)*h._gantt.parsedOptions.timelineColWidth)-y,_=new Ua({x:y,y:0,width:x,height:b.attribute.height,clip:!1,fill:h._gantt.parsedOptions.timelineHeaderBackgroundColor});let w;_.name="date-header-cell";let T=!0;const S=b.attribute.height;if(v){let e;e="function"==typeof v?v({width:x,height:S,index:r,startDate:l,endDate:o,days:a,dateIndex:p,title:d,ganttInstance:this._scene._gantt}):v,e&&(w=e.rootContainer,T=null!==(t=e.renderDefaultText)&&void 0!==t&&t,w.name="task-bar-custom-render"),w&&_.appendChild(w)}if(T){const{padding:t,textAlign:e,textBaseline:i,textOverflow:n,fontSize:s,fontWeight:r,color:a,strokeColor:o,textStick:l}=h._gantt.parsedOptions.timelineHeaderStyles[g],c=Uu(xu(t),e,i,x,S),u=new Mo({x:c.x,y:c.y,maxLineWidth:x,heightLimit:S,pickable:!0,text:d.toLocaleString(),fontSize:s,fontWeight:r,fill:a,stroke:o,lineWidth:2,textAlign:e,textBaseline:i,ellipsis:"clip"===n?"":"ellipsis"===n?"...":tu(n)?n:void 0});u.attribute.textStick=l,_.appendChild(u),u.name="date-header-cell-text"}if(g===h._gantt.timeLineHeaderLevel-1&&h._gantt.parsedOptions.markLineCreateOptions&&h._gantt.parsedOptions.markLineCreateOptions.markLineCreatable){const t=h._gantt.parsedOptions.markLineCreateOptions.markLineCreationStyle||{},e=t.size||24,i=t.iconSize||18,n=t.svg||'<svg viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="1471" width="24" height="24"> <path d="M840.05 153.35a27.61875 27.61875 0 0 0-22.95-4.95c-56.25 13.05-218.25 39.6-289.8 2.25-115.65-60.75-241.65-31.95-299.7-13.05V95.75a27.05625 27.05625 0 0 0-27-27 27.05625 27.05625 0 0 0-27 27v834.75c0 14.85 12.15 27 27 27s27-12.15 27-27V611.9c44.1-13.95 199.35-56.25 293.85 1.8 45.9 28.35 96.75 37.8 143.55 37.8 89.1 0 164.7-34.2 169.65-36.45a27.9 27.9 0 0 0 15.75-24.75V174.5a27.5625 27.5625 0 0 0-10.35-21.15z" fill="#f54319" p-id="1472"></path></svg>',s=new Ua({x:x/2-e/2,y:S/2-e/2,width:e,height:e,visiable:!0});s.name="markline-hover-group",s.data=f[r];const a=new Ua({x:0,y:0,width:e,height:e,cornerRadius:e/2,fill:t.fill||"#ccc",cursor:"pointer",display:"flex",justifyContent:"center",alignItems:"center",visibleAll:!1});a.name="markline-hover-inner-group",s.add(a);const o=new Yo({width:i,height:i,image:n,cursor:"pointer",pickable:!0});o.name="markline-hover-icon",a.appendChild(o),_.add(s)}if(b.addChild(_),r>0){const t=zo({pickable:!1,stroke:null===(e=h._gantt.parsedOptions.timelineHeaderVerticalLineStyle)||void 0===e?void 0:e.lineColor,lineWidth:null===(i=h._gantt.parsedOptions.timelineHeaderVerticalLineStyle)||void 0===i?void 0:i.lineWidth,points:[{x:1&(null===(n=h._gantt.parsedOptions.timelineHeaderVerticalLineStyle)||void 0===n?void 0:n.lineWidth)?.5:0,y:0},{x:1&(null===(s=h._gantt.parsedOptions.timelineHeaderVerticalLineStyle)||void 0===s?void 0:s.lineWidth)?.5:0,y:b.attribute.height}]});_.appendChild(t)}}if(g>0){const t=zo({pickable:!1,stroke:null===(r=h._gantt.parsedOptions.timelineHeaderHorizontalLineStyle)||void 0===r?void 0:r.lineColor,lineWidth:null===(a=h._gantt.parsedOptions.timelineHeaderHorizontalLineStyle)||void 0===a?void 0:a.lineWidth,points:[{x:0,y:1&(null===(o=h._gantt.parsedOptions.timelineHeaderHorizontalLineStyle)||void 0===o?void 0:o.lineWidth)?.5:0},{x:h._gantt.getAllDateColsWidth(),y:1&(null===(l=h._gantt.parsedOptions.timelineHeaderHorizontalLineStyle)||void 0===l?void 0:l.lineWidth)?.5:0}]});b.addChild(t)}}}setX(t){this.group.setAttribute("x",t)}setY(t){this.group.setAttribute("y",t)}resize(){var t,e,i,n;this.group.setAttribute("width",null!==(e=null===(t=this.group.attribute)||void 0===t?void 0:t.width)&&void 0!==e?e:0),this.group.setAttribute("height",null!==(n=null===(i=this.group.attribute)||void 0===i?void 0:i.height)&&void 0!==n?n:0)}refresh(){var t;null===(t=this.group)||void 0===t||t.parent.removeChild(this.group),this.initNodes()}showMarklineIcon(t){let e;return t.children.forEach((t=>{"date-header-cell-text"===t.name&&t.setAttribute("visible",!1),"markline-hover-group"===t.name&&(e=t.firstChild,e.setAttribute("visibleAll",!0))})),e}hideMarklineIconHover(t){let e;return t.children.forEach((t=>{"date-header-cell-text"===t.name&&t.setAttribute("visible",!0),"markline-hover-group"===t.name&&(e=t.firstChild,e.setAttribute("visibleAll",!1))})),e}}class Qu extends Ua{constructor(t){super(t),this._lastWidth=t.width,this._lastHeight=t.height,this._lastX=t.x,this._lastY=t.y}updateTextPosition(){var t,i,n;if(!this.textLabel||!this.barRect)return;const s=this.labelStyle||{},{textAlign:r="left",textBaseline:a="middle",textOverflow:o,color:l="#333333",outsideColor:h="#333333",padding:d=8}=s,c=Array.isArray(d)?d[3]:d,u=this.barRect.attribute.width,p=this.barRect.attribute.height,g=this.textLabel.attribute.fontSize||12,f=this.textLabel.attribute.fontFamily||"Arial",v=String(this.textLabel.attribute.text||""),m=e.textMeasure.measureTextWidth(v,{fontSize:g,fontFamily:f})+2*c<=u,b=Uu(xu(c),r,a,u,p),y=s.orient||(!m&&s.orientHandleWithOverflow?s.orientHandleWithOverflow:null);if(this.textLabel.setAttribute("visible",!0),this.textLabel.setAttribute("textBaseline",a),y){null===(t=this.textLabel.parent)||void 0===t||t.removeChild(this.textLabel),this.appendChild(this.textLabel),this.textLabel.setAttribute("fill",h),this.textLabel.setAttribute("ellipsis",void 0),this.textLabel.setAttribute("maxLineWidth",void 0),this.textLabel.setAttribute("zIndex",1e4),this.setAttribute("zIndex",1e4);const e={left:{x:-c,y:p/2,align:"right",baseline:"middle"},right:{x:u+c,y:p/2,align:"left",baseline:"middle"},top:{x:u/2,y:-c,align:"center",baseline:"bottom"},bottom:{x:u/2,y:p+c,align:"center",baseline:"top"}}[y];e&&(this.textLabel.setAttribute("x",e.x),this.textLabel.setAttribute("y",e.y),this.textLabel.setAttribute("textAlign",e.align),this.textLabel.setAttribute("textBaseline",e.baseline))}else null===(i=this.textLabel.parent)||void 0===i||i.removeChild(this.textLabel),null===(n=this.clipGroupBox)||void 0===n||n.appendChild(this.textLabel),this.textLabel.setAttribute("x",b.x),this.textLabel.setAttribute("y",b.y),this.textLabel.setAttribute("textAlign",r),this.textLabel.setAttribute("fill",l),this.textLabel.setAttribute("maxLineWidth",u-c),this.textLabel.setAttribute("ellipsis","clip"===o?"":"ellipsis"===o?"...":tu(o)?o:void 0)}}const tp='<svg width="100" height="200" xmlns="http://www.w3.org/2000/svg">\n <line x1="30" y1="10" x2="30" y2="190" stroke="black" stroke-width="4"/>\n <line x1="70" y1="10" x2="70" y2="190" stroke="black" stroke-width="4"/>\n</svg>';class ep{formatMilestoneText(t,e){if(!t)return"";const i=t.match(/{([^}]+)}/g);return i&&i.forEach((i=>{const n=i.substring(1,i.length-1),s=e[n];void 0!==s&&(t=t.replace(i,String(s)))})),t}calculateMilestoneTextPosition(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:4;const n="number"==typeof i?i:4;let s=0,r=0,a="left",o="middle";const l=e/2;switch(t){case"left":s=-n,r=l,a="end",o="middle";break;case"right":default:s=e+n,r=l,a="start",o="middle";break;case"top":s=l,r=-n,a="center",o="bottom";break;case"bottom":s=l,r=e+n,a="center",o="top"}return{textX:s,textY:r,textAlignValue:a,textBaselineValue:o}}constructor(t){this.selectedBorders=[],this._scene=t,this.width=t._gantt.tableNoFrameWidth,this.height=t._gantt.gridHeight,this.group=new Ua({x:0,y:t._gantt.getAllHeaderRowsHeight(),width:this.width,height:this.height,pickable:!1,clip:!0}),this.group.name="task-bar-container",t.ganttGroup.addChild(this.group),this.initBars(),this.initHoverBarIcons()}initBars(){var t,e,i;this.barContainer=new Ua({x:0,y:0,width:this._scene._gantt.getAllDateColsWidth(),height:this._scene._gantt.getAllTaskBarsHeight(),pickable:!1,clip:!0}),this.group.appendChild(this.barContainer);for(let n=0;n<this._scene._gantt.itemCount;n++)if(this._scene._gantt.parsedOptions.tasksShowMode!==du.Sub_Tasks_Inline&&this._scene._gantt.parsedOptions.tasksShowMode!==du.Sub_Tasks_Separate&&this._scene._gantt.parsedOptions.tasksShowMode!==du.Sub_Tasks_Arrange&&this._scene._gantt.parsedOptions.tasksShowMode!==du.Sub_Tasks_Compact)if(this._scene._gantt.parsedOptions.tasksShowMode!==du.Project_Sub_Tasks_Inline){const t=this.initBar(n);t&&this.barContainer.appendChild(t)}else{const t=this._scene._gantt.getRecordByIndex(n),e="expand"===t.hierarchyState;if(t.type===cu.PROJECT&&(null===(i=t.children)||void 0===i?void 0:i.length)>0&&!e){const e=this._scene._gantt.getRecordIndexByTaskShowIndex(n),i=Array.isArray(e)?[...e]:[e],s=(t,e)=>{var i,r;if((null===(i=t.children)||void 0===i?void 0:i.length)>0)for(let i=0;i<(null===(r=t.children)||void 0===r?void 0:r.length);i++){const r=t.children[i];if(r.type!==cu.PROJECT){const s=this.initBar(n,[...e,i],t.children.length);s&&this.barContainer.appendChild(s)}else s(r,[...e,i])}};s(t,i)}else{const t=this.initBar(n);t&&this.barContainer.appendChild(t)}}else{const i=this._scene._gantt.getRecordByIndex(n);if((null===(t=i.children)||void 0===t?void 0:t.length)>0)for(let t=0;t<(null===(e=i.children)||void 0===e?void 0:e.length);t++){const e=this.initBar(n,t,i.children.length);e&&this.barContainer.appendChild(e)}else{const t=this.initBar(n);t&&this.barContainer.appendChild(t)}}}initBar(t,e,i){var n,s,r,a,o;const l=this._scene._gantt.parsedOptions.taskBarCustomLayout,{startDate:h,endDate:d,taskDays:c,progress:u,taskRecord:p}=this._scene._gantt.getTaskInfoByTaskListIndex(t,e),g=p.type===cu.MILESTONE;if(g&&!h||!g&&(c<=0||!h||!d||h.getTime()>d.getTime()))return null;const{unit:f,step:v}=this._scene._gantt.parsedOptions.reverseSortedTimelineScales[0],m=Lu(d,h,f,v,1)*this._scene._gantt.parsedOptions.timelineColWidth,b=this._scene._gantt.getTaskBarStyle(t,e),y=b.width,x=this._scene._gantt.parsedOptions.rowHeight,_=this._scene._gantt.parsedOptions.taskBarMilestoneStyle.width,w=Lu(h,this._scene._gantt.parsedOptions.minDate,f,v)*this._scene._gantt.parsedOptions.timelineColWidth-(g?_/2:0),T=this._scene._gantt.getRowsHeightByIndex(0,t-1)+(this._scene._gantt.parsedOptions.tasksShowMode===du.Sub_Tasks_Separate?(null!==(n=e)&&void 0!==n?n:0)*x:this._scene._gantt.parsedOptions.tasksShowMode===du.Sub_Tasks_Arrange||this._scene._gantt.parsedOptions.tasksShowMode===du.Sub_Tasks_Compact?p.vtable_gantt_showIndex*x:0)+(x-(g?_:y))/2,S=new Qu({x:w,y:T,width:g?_:m,height:g?_:y,cornerRadius:g?this._scene._gantt.parsedOptions.taskBarMilestoneStyle.cornerRadius:b.cornerRadius,lineWidth:g?2*this._scene._gantt.parsedOptions.taskBarMilestoneStyle.borderLineWidth:2*(null!==(s=b.borderLineWidth)&&void 0!==s?s:b.borderWidth),stroke:g?this._scene._gantt.parsedOptions.taskBarMilestoneStyle.borderColor:b.borderColor,angle:g?.25*Math.PI:0,anchor:g?[w+_/2,T+_/2]:void 0});S.name="task-bar",S.task_index=t,S.sub_task_index=e,S.record=p;const k=new Ua({x:0,y:0,width:S.attribute.width,height:S.attribute.height,cornerRadius:g?this._scene._gantt.parsedOptions.taskBarMilestoneStyle.cornerRadius:b.cornerRadius,clip:!0});let B;k.name="task-bar-group",S.appendChild(k),S.clipGroupBox=k;let A=!0,C=!0;if(l){let e;e="function"==typeof l?l({width:m,height:y,index:t,startDate:h,endDate:d,taskDays:c,progress:u,taskRecord:p,ganttInstance:this._scene._gantt}):l,e&&(B=e.rootContainer,A=null!==(r=e.renderDefaultBar)&&void 0!==r&&r,C=null!==(a=e.renderDefaultText)&&void 0!==a&&a,B&&(B.name="task-bar-custom-render"))}if(A){const t=jo({x:0,y:0,width:S.attribute.width,height:S.attribute.height,fill:g?this._scene._gantt.parsedOptions.taskBarMilestoneStyle.fillColor:b.barColor,pickable:!1});if(t.name="task-bar-rect",k.appendChild(t),S.barRect=t,p.type!==cu.MILESTONE){const t=jo({x:0,y:0,width:m*u/100,height:y,fill:b.completedBarColor,pickable:!1});t.name="task-bar-progress-rect",k.appendChild(t),S.progressRect=t}}if(B&&k.appendChild(B),C&&p.type!==cu.MILESTONE){const{textAlign:t,textBaseline:e,fontSize:i,fontFamily:n,textOverflow:s,color:r,padding:a}=this._scene._gantt.parsedOptions.taskBarLabelStyle,o=Uu(xu(a),t,e,m,y),l=Po({x:o.x,y:o.y,fontSize:i,fill:r,fontFamily:n,text:(L=this._scene._gantt.parsedOptions.taskBarLabelText,O=p,L.replace(/\{([^}]+)\}/g,((t,e)=>{const i=e.split(".");let n=O;for(const e of i){if(!n.hasOwnProperty(e)){n=t;break}n=n[e]}return n}))),maxLineWidth:m-10,textBaseline:e,textAlign:t,ellipsis:"clip"===s?"":"ellipsis"===s?"...":tu(s)?s:void 0,poptip:{position:"bottom"}});k.appendChild(l),S.textLabel=l,S.labelStyle=this._scene._gantt.parsedOptions.taskBarLabelStyle,S.updateTextPosition()}var L,O;if(C&&"milestone"===p.type&&this._scene._gantt.parsedOptions.taskBarMilestoneStyle.labelText){const t=this._scene._gantt.parsedOptions.taskBarMilestoneStyle,e=t.labelTextStyle||{},i=this.calculateMilestoneTextPosition(t.textOrient||"right",t.width,null!==(o=e.padding)&&void 0!==o?o:4),n=new Ua({x:w,y:T,width:t.width,height:t.width,angle:0,pickable:!1}),s=Po({x:i.textX,y:i.textY,fontSize:e.fontSize||16,fontFamily:e.fontFamily||"Arial",fill:e.color||"#ff0000",textBaseline:e.textBaseline||i.textBaselineValue,textAlign:e.textAlign||i.textAlignValue,text:this.formatMilestoneText(t.labelText,p),pickable:!1});n.appendChild(s),this.barContainer.appendChild(n),S.milestoneTextLabel=s,S.milestoneTextContainer=n}return S}updateTaskBarNode(t,e){const i=this.getTaskBarNodeByIndex(t,e);i&&this.barContainer.removeChild(i);const n=this.initBar(t,e);n&&(this.barContainer.insertInto(n,t),n.updateTextPosition())}initHoverBarIcons(){var t,e;const i=new Ua({x:0,y:0,width:100,height:100,clip:!0,pickable:!1,cornerRadius:null!==(e=null!==(t=this._scene._gantt.parsedOptions.taskBarHoverStyle.cornerRadius)&&void 0!==t?t:Iu.cornerRadius)&&void 0!==e?e:0,fill:this._scene._gantt.parsedOptions.taskBarHoverStyle.barOverlayColor,visibleAll:!1});if(this.hoverBarGroup=i,i.name="task-bar-hover-shadow",this._scene._gantt.parsedOptions.taskBarResizable){const t=new Yo({x:0,y:0,width:10,height:20,image:tp,pickable:!0,cursor:"col-resize"});t.name="task-bar-hover-shadow-left-icon",this.hoverBarLeftIcon=t,i.appendChild(t);const e=new Yo({x:0,y:0,width:10,height:20,image:tp,pickable:!0,cursor:"col-resize"});e.name="task-bar-hover-shadow-right-icon",this.hoverBarRightIcon=e,i.appendChild(e)}}setX(t){this.barContainer.setAttribute("x",t)}setY(t){this.barContainer.setAttribute("y",t)}refresh(){this.width=this._scene._gantt.tableNoFrameWidth,this.height=this._scene._gantt.gridHeight,this.group.setAttributes({height:this.height,width:this.width,y:this._scene._gantt.getAllHeaderRowsHeight()});const t=this.barContainer.attribute.x,e=this.barContainer.attribute.y;this.barContainer.removeAllChild(),this.group.removeChild(this.barContainer),this.initBars(),this.setX(t),this.setY(e)}resize(){this.width=this._scene._gantt.tableNoFrameWidth,this.height=this._scene._gantt.gridHeight,this.group.setAttribute("width",this.width),this.group.setAttribute("height",this.height)}showHoverBar(t,e,i,n,s){var r,a,o,l;const{startDate:h,endDate:d,taskRecord:c}=this._scene._gantt.getTaskInfoByTaskListIndex(s.task_index,s.sub_task_index);s&&"task-bar"===s.name&&s.appendChild(this.hoverBarGroup),this.hoverBarGroup.setAttribute("x",0),this.hoverBarGroup.setAttribute("y",0),this.hoverBarGroup.setAttribute("width",i),this.hoverBarGroup.setAttribute("height",n),this.hoverBarGroup.setAttribute("visibleAll",!0);const u=this._scene._gantt.getTaskBarStyle(s.task_index,s.sub_task_index);if(c.type===cu.MILESTONE)this.hoverBarGroup.setAttribute("cornerRadius",s.attribute.cornerRadius);else{const t=null!==(a=null!==(r=this._scene._gantt.parsedOptions.taskBarHoverStyle.cornerRadius)&&void 0!==r?r:u.cornerRadius)&&void 0!==a?a:0;this.hoverBarGroup.setAttribute("cornerRadius",t)}null===(o=this.hoverBarLeftIcon)||void 0===o||o.setAttribute("visible",!1),null===(l=this.hoverBarRightIcon)||void 0===l||l.setAttribute("visible",!1);let p=!0,g=!0;if(c.type===cu.MILESTONE)p=!1,g=!1;else if("function"==typeof this._scene._gantt.parsedOptions.taskBarResizable){const t={index:s.task_index,startDate:h,endDate:d,taskRecord:c,ganttInstance:this._scene._gantt},e=this._scene._gantt.parsedOptions.taskBarResizable(t);Array.isArray(e)?[p,g]=e:(p=e,g=e)}else Array.isArray(this._scene._gantt.parsedOptions.taskBarResizable)?[p,g]=this._scene._gantt.parsedOptions.taskBarResizable:(p=this._scene._gantt.parsedOptions.taskBarResizable,g=this._scene._gantt.parsedOptions.taskBarResizable);p&&this.hoverBarLeftIcon.setAttribute("visible",!0),g&&this.hoverBarRightIcon.setAttribute("visible",!0),this.hoverBarLeftIcon&&(this.hoverBarLeftIcon.setAttribute("x",0),this.hoverBarLeftIcon.setAttribute("y",Math.ceil(n/10)),this.hoverBarLeftIcon.setAttribute("width",10),this.hoverBarLeftIcon.setAttribute("height",n-2*Math.ceil(n/10)),this.hoverBarRightIcon.setAttribute("x",i-10),this.hoverBarRightIcon.setAttribute("y",Math.ceil(n/10)),this.hoverBarRightIcon.setAttribute("width",10),this.hoverBarRightIcon.setAttribute("height",n-2*Math.ceil(n/10)))}hideHoverBar(){this.hoverBarGroup.setAttribute("visibleAll",!1)}createSelectedBorder(t,e,i,n,s){let r=arguments.length>5&&void 0!==arguments[5]&&arguments[5];const a=s.record,o=new Ua({x:t,y:e,width:i,height:n,pickable:!1,attachedToTaskBarNode:s,zIndex:1e4});o.name="task-bar-select-border",this.barContainer.appendChild(o),this.selectedBorders.push(o);const l=new Ua({x:0,y:0,width:i,height:n,lineWidth:this._scene._gantt.parsedOptions.taskBarSelectedStyle.borderLineWidth,pickable:!1,cornerRadius:s.attribute.cornerRadius,fill:!1,stroke:this._scene._gantt.parsedOptions.taskBarSelectedStyle.borderColor,shadowColor:this._scene._gantt.parsedOptions.taskBarSelectedStyle.shadowColor,shadowOffsetX:this._scene._gantt.parsedOptions.taskBarSelectedStyle.shadowOffsetX,shadowOffsetY:this._scene._gantt.parsedOptions.taskBarSelectedStyle.shadowOffsetY,shadowBlur:this._scene._gantt.parsedOptions.taskBarSelectedStyle.shadowBlur,angle:s.attribute.angle,anchor:[i/2,n/2]});if(o.appendChild(l),r){const t=a.type===cu.MILESTONE?15:10,e=new Ua({x:-t,y:0,width:10,height:n,pickable:!0}),s=new Oo({x:5,y:n/2,radius:this._scene._gantt.parsedOptions.dependencyLinkLineCreatePointStyle.radius,fill:this._scene._gantt.parsedOptions.dependencyLinkLineCreatePointStyle.fillColor,stroke:this._scene._gantt.parsedOptions.dependencyLinkLineCreatePointStyle.strokeColor,lineWidth:this._scene._gantt.parsedOptions.dependencyLinkLineCreatePointStyle.strokeWidth,pickable:!1});e.appendChild(s),e.name="task-bar-link-point-left",o.appendChild(e);const r=new Ua({x:i+(t-10),y:0,width:10,height:n,pickable:!0}),l=new Oo({x:5,y:n/2,radius:this._scene._gantt.parsedOptions.dependencyLinkLineCreatePointStyle.radius,fill:this._scene._gantt.parsedOptions.dependencyLinkLineCreatePointStyle.fillColor,stroke:this._scene._gantt.parsedOptions.dependencyLinkLineCreatePointStyle.strokeColor,lineWidth:this._scene._gantt.parsedOptions.dependencyLinkLineCreatePointStyle.strokeWidth,pickable:!1,pickStrokeBuffer:10});r.appendChild(l),r.name="task-bar-link-point-right",o.appendChild(r)}}removeSelectedBorder(){this.selectedBorders.forEach((t=>{t.delete()})),this.selectedBorders=[]}removeSecondSelectedBorder(){2===this.selectedBorders.length&&this.selectedBorders.pop().delete()}updateCreatingDependencyLine(t,e,i,n){this.creatingDependencyLine&&(this.creatingDependencyLine.delete(),this.creatingDependencyLine=void 0);const s=new Ho({points:[{x:t,y:e},{x:i,y:n}],stroke:this._scene._gantt.parsedOptions.dependencyLinkLineCreatingStyle.lineColor,lineWidth:this._scene._gantt.parsedOptions.dependencyLinkLineCreatingStyle.lineWidth,lineDash:this._scene._gantt.parsedOptions.dependencyLinkLineCreatingStyle.lineDash,pickable:!1});this.creatingDependencyLine=s,this.selectedBorders[0].appendChild(s)}getTaskBarNodeByIndex(t,e){let i=this.barContainer.firstChild;if(!i)return null;for(let n=0;n<this.barContainer.childrenCount;n++){if(i.task_index===t&&(!tu(e)||tu(e)&&i.sub_task_index===e))return i;i=i._next}return null}}class ip{constructor(t){this.markLineContainerWidth=20,this._scene=t,this.height=Math.min(t._gantt.tableNoFrameHeight,t._gantt.drawHeight)-t._gantt.getAllHeaderRowsHeight(),this.group=new Ua({x:0,y:t._gantt.getAllHeaderRowsHeight(),width:t._gantt.tableNoFrameWidth,height:this.height,pickable:!1,clip:!0}),this.group.name="mark-line-container",t.ganttGroup.addChild(this.group),this.markLIneContainer=new Ua({x:0,y:0,width:this._scene._gantt.getAllDateColsWidth(),height:this.height,pickable:!1,clip:!0}),this.group.appendChild(this.markLIneContainer),this.initMarkLines()}initMarkLines(){this._scene._gantt.parsedOptions.markLine.forEach((t=>{const e=t.style,i=t.contentStyle||{},n=this._scene._gantt.parsedOptions.timeScaleIncludeHour?wu(t.date):wu(t.date,!0),s=this._scene._gantt.parsedOptions.minDate,{unit:r,step:a}=this._scene._gantt.parsedOptions.reverseSortedTimelineScales[0],o=Lu(n,s,r,a);let l=0;if("right"===t.position)l=1;else if("middle"===t.position)l=.5;else if("date"===t.position){const e=Lu(wu(t.date),s,r,a);l=e-Math.floor(e)}const h=this._scene._gantt.parsedOptions.timelineColWidth*(Math.floor(o)+l),d=new Ua({pickable:!1,x:h-this.markLineContainerWidth/2,y:0,width:this.markLineContainerWidth,height:this.height});d.name="mark-line",this.markLIneContainer.appendChild(d);const c=zo({pickable:!1,stroke:e.lineColor,lineWidth:e.lineWidth,lineDash:e.lineDash,points:[{x:this.markLineContainerWidth/2,y:0},{x:this.markLineContainerWidth/2,y:this.height}]});if(d.appendChild(c),t.content){const n=this._scene._gantt.parsedOptions.timelineColWidth,s=i.lineHeight||18,r=new Ua({x:this.markLineContainerWidth/2,y:0,cursor:"pointer",height:s,clip:!1,fill:i.backgroundColor||e.lineColor,display:"flex",cornerRadius:i.cornerRadius||[0,2,2,0]});r.name="mark-line-content",r.data=t,d.appendChild(r);const a=new Mo({maxLineWidth:n,text:t.content,cursor:"pointer",lineHeight:s,fontWeight:i.fontWeight||"normal",fill:i.color||e.lineColor,fontSize:i.fontSize||12,poptip:{position:"top",dx:n/4,dy:-s/4}});r.appendChild(a)}}))}refresh(){this.height=Math.min(this._scene._gantt.tableNoFrameHeight,this._scene._gantt.drawHeight)-this._scene._gantt.getAllHeaderRowsHeight(),this.markLIneContainer.removeAllChild(),this.group.setAttribute("height",this.height),this.markLIneContainer.setAttribute("height",this.height),this.initMarkLines()}setX(t){this.markLIneContainer.setAttribute("x",t)}}class np{constructor(t){this._scene=t,this.createFrameBorder()}createFrameBorder(){var t,e,i,n,s,r;const a=this._scene.ganttGroup,o=this._scene._gantt.parsedOptions.outerFrameStyle;if(!o)return;const{cornerRadius:l,borderColor:h,borderLineWidth:d,borderLineDash:c}=o,u={},p={pickable:!1};if(d&&(p.stroke=!0,p.fill=!1,p.stroke=h,p.lineWidth=d,c&&(p.lineDash=c),p.lineCap="butt"),l&&(this._scene._gantt.taskListTableInstance?(p.cornerRadius=[0,null!==(t=this._scene._gantt.parsedOptions.outerFrameStyle.cornerRadius)&&void 0!==t?t:0,null!==(e=this._scene._gantt.parsedOptions.outerFrameStyle.cornerRadius)&&void 0!==e?e:0,0],u.cornerRadius=[0,null!==(i=this._scene._gantt.parsedOptions.outerFrameStyle.cornerRadius)&&void 0!==i?i:0,null!==(n=this._scene._gantt.parsedOptions.outerFrameStyle.cornerRadius)&&void 0!==n?n:0,0]):(p.cornerRadius=null!==(s=this._scene._gantt.parsedOptions.outerFrameStyle.cornerRadius)&&void 0!==s?s:0,u.cornerRadius=null!==(r=this._scene._gantt.parsedOptions.outerFrameStyle.cornerRadius)&&void 0!==r?r:0)),a.setAttributes(u),p.stroke){p.x=this._scene._gantt.taskListTableInstance?-d/2:d/2,p.y=d/2,p.pickable=!1,p.width=a.attribute.width+d+(this._scene._gantt.taskListTableInstance?this._scene._gantt.parsedOptions.verticalSplitLine.lineWidth:0),p.height=a.attribute.height+d/2+d/2;const t=jo(p);t.name="border-rect",a.parent.insertAfter(t,a),a.border=t,this.border=t}}refresh(){this.border&&this.border.parent&&this.border.parent.removeChild(this.border),this.createFrameBorder()}resize(){var t;const{cornerRadius:e,borderColor:i,borderLineWidth:n,borderLineDash:s}=this._scene._gantt.parsedOptions.outerFrameStyle;null===(t=this.border)||void 0===t||t.setAttributes({width:this._scene.ganttGroup.attribute.width+n+(this._scene._gantt.taskListTableInstance?this._scene._gantt.parsedOptions.verticalSplitLine.lineWidth:0),height:this._scene._gantt.drawHeight+n})}}var sp=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let rp=class{constructor(){this.time=ni.beforeFillStroke,this.useStyle=!0,this.order=0,this.supportedAppName="vtable"}drawShape(t,e,i,n,s,r,a,o,l,h,d,c,u){"date-header-cell"===t.name&&t.forEachChildren((t=>{var e;if("date-header-cell-text"===t.name&&!0===t.attribute.textStick){const i=t;i.setAttribute("dx",0);const n=i.globalAABBBounds,s=i.stage.globalAABBBounds,r=i.parent.globalAABBBounds,a=s.intersect(r);s.intersect(r)&&(n.width()>=a.width()&&i.attribute.last_dx?i.setAttribute("dx",null!==(e=i.attribute.last_dx)&&void 0!==e?e:0):s.x1>=n.x1?(i.setAttribute("dx",s.x1-n.x1),i.setAttribute("last_dx",s.x1-n.x1)):s.x2<=n.x2&&(i.setAttribute("dx",s.x2-n.x2),i.setAttribute("last_dx",s.x1-n.x1)))}}))}};rp=sp([y()],rp);var ap=new a(((t,e,i,n)=>{t(rp).toSelf().inSingletonScope(),t(ho).toService(rp)}));class op{constructor(t){this._scene=t,this.createAddButton()}createAddButton(){var t;this._scene._gantt.parsedOptions.taskBarCreationCustomLayout?this.group=new Ua({x:0,y:0,width:100,height:100}):(this.group=new Ua({x:0,y:0,width:100,height:100,lineDash:this._scene._gantt.parsedOptions.taskBarCreationButtonStyle.lineDash,cursor:"pointer",lineWidth:this._scene._gantt.parsedOptions.taskBarCreationButtonStyle.lineWidth,stroke:this._scene._gantt.parsedOptions.taskBarCreationButtonStyle.lineColor,cornerRadius:null!==(t=this._scene._gantt.parsedOptions.taskBarCreationButtonStyle.cornerRadius)&&void 0!==t?t:0,fill:this._scene._gantt.parsedOptions.taskBarCreationButtonStyle.backgroundColor}),this.lineVertical=zo({pickable:!1,stroke:this._scene._gantt.parsedOptions.taskBarCreationButtonStyle.lineColor,lineWidth:this._scene._gantt.parsedOptions.taskBarCreationButtonStyle.lineWidth,points:[{x:50,y:0},{x:50,y:100}]}),this.group.appendChild(this.lineVertical),this.lineHorizontal=zo({pickable:!1,stroke:this._scene._gantt.parsedOptions.taskBarCreationButtonStyle.lineColor,lineWidth:this._scene._gantt.parsedOptions.taskBarCreationButtonStyle.lineWidth,points:[{x:0,y:50},{x:100,y:50}]}),this.group.appendChild(this.lineHorizontal)),this.group.name="task-creation-button",this._scene.taskBar.group.addChild(this.group)}show(t,e,i,n){if(this._scene._gantt.parsedOptions.taskBarCreationCustomLayout)this.group.appendChild(this._scene._gantt.parsedOptions.taskBarCreationCustomLayout({width:i,height:n,ganttInstance:this._scene._gantt}).rootContainer);else{const t=Math.min(i,n)/6;this.lineHorizontal.setAttribute("points",[{x:(i-4*t)/2,y:n/2},{x:(i-4*t)/2+4*t,y:n/2}]),this.lineVertical.setAttribute("points",[{x:i/2,y:(n-4*t)/2},{x:i/2,y:(n-4*t)/2+4*t}])}this.group.setAttribute("x",t),this.group.setAttribute("y",e),this.group.setAttribute("width",i),this.group.setAttribute("height",n),this.group.setAttribute("visibleAll",!0)}hide(){this.group.setAttribute("visibleAll",!1),this._scene._gantt.parsedOptions.taskBarCreationCustomLayout&&this.group.removeAllChild()}}class lp{constructor(t){this._scene=t,this.group=new Jc({position:"top",content:"",contentStyle:{fill:"#fff"},visible:!1,panel:{background:"#14161c",cornerRadius:4}}),t.ganttGroup.addChild(this.group)}show(t){var e,i,n;const s=(null===(e=this._scene._gantt.parsedOptions.markLineCreateOptions)||void 0===e?void 0:e.markLineCreationHoverToolTip)||{},r=t.globalTransMatrix,a=t.attribute.width,o=t.attribute.height;let l,h;const d=s.position||"top";"top"===d?(l=r.e+a/2-2,h=r.f):"bottom"===d&&(l=r.e+a/2-2,h=r.f+o);const c=(null===(i=s.style)||void 0===i?void 0:i.contentStyle)||{fill:"#fff"},u=(null===(n=s.style)||void 0===n?void 0:n.panelStyle)||{background:"#14161c",cornerRadius:4};this.group.setAttributes({content:s.tipContent,position:d,visibleAll:!0,visible:!0,contentStyle:c,panel:Object.assign(Object.assign({},u),{visible:!0}),x:l,y:h})}hide(){this.group.setAttributes({visibleAll:!1,visible:!1})}}class hp{constructor(t){this._scene=t,this.width=t._gantt.tableNoFrameWidth,this.height=t._gantt.gridHeight,this.group=new Ua({x:0,y:t._gantt.getAllHeaderRowsHeight(),width:this.width,height:this.height,pickable:!1,clip:!0}),this.group.name="dependency-link-container",t.ganttGroup.addChild(this.group),this.initLinkLines()}initLinkLines(){var t;if(Yu(this._scene._gantt.records),this.linkLinesContainer=new Ua({x:0,y:0,width:this._scene._gantt.getAllDateColsWidth(),height:this._scene._gantt.getAllTaskBarsHeight(),pickable:!1,clip:!0}),this.group.appendChild(this.linkLinesContainer),null===(t=this._scene._gantt.records)||void 0===t?void 0:t.length)for(let t=0;t<this._scene._gantt.parsedOptions.dependencyLinks.length;t++)this.initLinkLine(t)}initLinkLine(t){var e,i;const{taskKeyField:n,dependencyLinks:s}=this._scene._gantt.parsedOptions,r=s[t],{linkedToTaskKey:a,linkedFromTaskKey:o,type:l}=r,h=Gu(this._scene._gantt.records,n,a),d=Gu(this._scene._gantt.records,n,o);if(!h||!d)return;let c,u,p,g,f,v,m,b;if(h.record.vtable_gantt_linkedTo||(h.record.vtable_gantt_linkedTo=[]),h.record.vtable_gantt_linkedTo.push(r),d.record.vtable_gantt_linkedFrom||(d.record.vtable_gantt_linkedFrom=[]),d.record.vtable_gantt_linkedFrom.push(r),this._scene._gantt.parsedOptions.tasksShowMode===du.Sub_Tasks_Inline)b=d.index[0],m=h.index[0],({startDate:c,endDate:u,taskDays:p}=this._scene._gantt.getTaskInfoByTaskListIndex(h.index[0],h.index[1])),({startDate:g,endDate:f,taskDays:v}=this._scene._gantt.getTaskInfoByTaskListIndex(d.index[0],d.index[1]));else if(this._scene._gantt.parsedOptions.tasksShowMode===du.Project_Sub_Tasks_Inline){const t=this._scene._gantt.getTaskShowIndexByRecordIndex(d.index.slice(0,-1)),e=this._scene._gantt.getTaskShowIndexByRecordIndex(h.index.slice(0,-1)),i=this._scene._gantt.getRecordByIndex(t),n=this._scene._gantt.getRecordByIndex(e);b=i.type===cu.PROJECT&&"expand"!==i.hierarchyState&&!1!==this._scene._gantt.parsedOptions.projectSubTasksExpandable?t:this._scene._gantt.getTaskShowIndexByRecordIndex(d.index),m=n.type===cu.PROJECT&&"expand"!==n.hierarchyState&&!1!==this._scene._gantt.parsedOptions.projectSubTasksExpandable?e:this._scene._gantt.getTaskShowIndexByRecordIndex(h.index),({startDate:c,endDate:u,taskDays:p}=this._scene._gantt.getTaskInfoByTaskListIndex(m,h.index)),({startDate:g,endDate:f,taskDays:v}=this._scene._gantt.getTaskInfoByTaskListIndex(b,d.index))}else this._scene._gantt.parsedOptions.tasksShowMode===du.Sub_Tasks_Separate||this._scene._gantt.parsedOptions.tasksShowMode===du.Sub_Tasks_Arrange||this._scene._gantt.parsedOptions.tasksShowMode===du.Sub_Tasks_Compact?(b=this._scene._gantt.getRowsHeightByIndex(0,d.index[0]-1)/this._scene._gantt.parsedOptions.rowHeight+(this._scene._gantt.parsedOptions.tasksShowMode===du.Sub_Tasks_Arrange||this._scene._gantt.parsedOptions.tasksShowMode===du.Sub_Tasks_Compact?d.record.vtable_gantt_showIndex:null!==(e=d.index[1])&&void 0!==e?e:0),m=this._scene._gantt.getRowsHeightByIndex(0,h.index[0]-1)/this._scene._gantt.parsedOptions.rowHeight+(this._scene._gantt.parsedOptions.tasksShowMode===du.Sub_Tasks_Arrange||this._scene._gantt.parsedOptions.tasksShowMode===du.Sub_Tasks_Compact?h.record.vtable_gantt_showIndex:null!==(i=h.index[1])&&void 0!==i?i:0),({startDate:c,endDate:u,taskDays:p}=this._scene._gantt.getTaskInfoByTaskListIndex(h.index[0],h.index[1])),({startDate:g,endDate:f,taskDays:v}=this._scene._gantt.getTaskInfoByTaskListIndex(d.index[0],d.index[1]))):(b=this._scene._gantt.getTaskShowIndexByRecordIndex(d.index),m=this._scene._gantt.getTaskShowIndexByRecordIndex(h.index),({startDate:c,endDate:u,taskDays:p}=this._scene._gantt.getTaskInfoByTaskListIndex(m)),({startDate:g,endDate:f,taskDays:v}=this._scene._gantt.getTaskInfoByTaskListIndex(b)));if(!v||!p)return;wu(this._scene._gantt.parsedOptions.minDate);const{arrowPoints:y,linePoints:x}=function(t,e,i,n,s,r,a,o,l,h,d,c){const{unit:u,step:p}=c.parsedOptions.reverseSortedTimelineScales[0],{minDate:g,rowHeight:f,timelineColWidth:v}=c.parsedOptions,m=c.parsedOptions.taskBarMilestoneHypotenuse;let b=[],y=[];if(t===hu.FinishToStart){let t=Lu(i,g,u,p,1)*v;r&&(t=Lu(e,g,u,p,1)*v+m/2);let s=Lu(a,g,u,p)*v;d&&(s-=m/2),b=[{x:t,y:f*(n+.5)},{x:t+20,y:f*(n+.5)},{x:t+20,y:f*(n+(n>l?0:1))},{x:s-20,y:f*(n+(n>l?0:1))},{x:s-20,y:f*(l+.5)},{x:s,y:f*(l+.5)}],t+20<=s-20&&b.splice(2,3,{x:t+20,y:f*(l+.5)});const o=b[b.length-1];y=[{x:o.x,y:o.y},{x:o.x-10,y:o.y-5},{x:o.x-10,y:o.y+5},{x:o.x,y:o.y}]}else if(t===hu.StartToFinish){let t=Lu(e,g,u,p)*v;r&&(t-=m/2);let i=Lu(o,g,u,p,1)*v;d&&(i=Lu(a,g,u,p,1)*v+m/2),b=[{x:t,y:f*(n+.5)},{x:t-20,y:f*(n+.5)},{x:t-20,y:f*(n+(n>l?0:1))},{x:i+20,y:f*(n+(n>l?0:1))},{x:i+20,y:f*(l+.5)},{x:i,y:f*(l+.5)}],t-20>=i+20&&b.splice(2,3,{x:t-20,y:f*(l+.5)});const s=b[b.length-1];y=[{x:s.x,y:s.y},{x:s.x+10,y:s.y-5},{x:s.x+10,y:s.y+5},{x:s.x,y:s.y}]}else if(t===hu.StartToStart){let t=Lu(e,g,u,p)*v;r&&(t-=m/2);let i=Lu(a,g,u,p)*v;d&&(i-=m/2),b=[{x:t,y:f*(n+.5)},{x:(n===l?t:Math.min(t,i))-20,y:f*(n+.5)},{x:(n===l?t:Math.min(t,i))-20,y:f*(l+(n===l?1:.5))},{x:i-20,y:f*(l+(n===l?1:.5))},{x:(n===l?i:Math.min(t,i))-20,y:f*(l+.5)},{x:i,y:f*(l+.5)}];const s=b[b.length-1];y=[{x:s.x,y:s.y},{x:s.x-10,y:s.y-5},{x:s.x-10,y:s.y+5},{x:s.x,y:s.y}]}else if(t===hu.FinishToFinish){let t=Lu(i,g,u,p,1)*v;r&&(t=Lu(e,g,u,p,1)*v+m/2);let s=Lu(o,g,u,p,1)*v;d&&(s=Lu(a,g,u,p,1)*v+m/2),b=[{x:t,y:f*(n+.5)},{x:(n===l?t:Math.max(t,s))+20,y:f*(n+.5)},{x:(n===l?t:Math.max(t,s))+20,y:f*(l+(n===l?1:.5))},{x:s+20,y:f*(l+(n===l?1:.5))},{x:s+20,y:f*(l+.5)},{x:s,y:f*(l+.5)}];const h=b[b.length-1];y=[{x:h.x,y:h.y},{x:h.x+10,y:h.y-5},{x:h.x+10,y:h.y+5},{x:h.x,y:h.y}]}return{linePoints:b,arrowPoints:y}}(l,g,f,b,0,d.record.type===cu.MILESTONE,c,u,m,0,h.record.type===cu.MILESTONE,this._scene._gantt),_=this._scene._gantt.parsedOptions.dependencyLinkLineStyle,w=zo({pickable:!0,stroke:_.lineColor,lineWidth:_.lineWidth,lineDash:_.lineDash,points:x,pickStrokeBuffer:3,vtable_link:r});this.linkLinesContainer.appendChild(w),r.vtable_gantt_linkLineNode=w;const T=new Xo({fill:_.lineColor,points:y});this.linkLinesContainer.appendChild(T),r.vtable_gantt_linkArrowNode=T}setX(t){this.linkLinesContainer.setAttribute("x",t)}setY(t){this.linkLinesContainer.setAttribute("y",t)}refresh(){this.width=this._scene._gantt.tableNoFrameWidth,this.height=this._scene._gantt.gridHeight,this.group.setAttributes({height:this.height,width:this.width,y:this._scene._gantt.getAllHeaderRowsHeight()});const t=this.linkLinesContainer.attribute.x,e=this.linkLinesContainer.attribute.y;this.linkLinesContainer.removeAllChild(),this.group.removeChild(this.linkLinesContainer),this.initLinkLines(),this.setX(t),this.setY(e)}resize(){this.width=this._scene._gantt.tableNoFrameWidth,this.height=this._scene._gantt.gridHeight,this.group.setAttribute("width",this.width),this.group.setAttribute("height",this.height)}createSelectedLinkLine(t){const e=t.vtable_gantt_linkLineNode,i=t.vtable_gantt_linkArrowNode,n=e.clone(),s=i.clone();n.setAttribute("stroke",this._scene._gantt.parsedOptions.dependencyLinkSelectedLineStyle.lineColor),n.setAttribute("lineWidth",this._scene._gantt.parsedOptions.dependencyLinkSelectedLineStyle.lineWidth),n.setAttribute("shadowColor",this._scene._gantt.parsedOptions.dependencyLinkSelectedLineStyle.shadowColor),n.setAttribute("shadowOffsetX",this._scene._gantt.parsedOptions.dependencyLinkSelectedLineStyle.shadowOffset),n.setAttribute("shadowOffsetY",this._scene._gantt.parsedOptions.dependencyLinkSelectedLineStyle.shadowOffset),n.setAttribute("shadowBlur",this._scene._gantt.parsedOptions.dependencyLinkSelectedLineStyle.shadowBlur),this.linkLinesContainer.appendChild(n),s.setAttribute("fill",this._scene._gantt.parsedOptions.dependencyLinkSelectedLineStyle.lineColor),this.linkLinesContainer.appendChild(s),this.selectedEffectNodes=[n,s]}removeSelectedLinkLine(){var t;null===(t=this.selectedEffectNodes)||void 0===t||t.forEach((t=>{t.delete()})),this.selectedEffectNodes=[]}deleteLink(t){const e=t.vtable_gantt_linkLineNode,i=t.vtable_gantt_linkArrowNode;e.delete(),i.delete()}}function dp(t,e,i,n,s,r,a,o,l,h,d,c,u,p,g,f){const{unit:v,step:m}=f.parsedOptions.reverseSortedTimelineScales[0],{minDate:b,rowHeight:y,timelineColWidth:x}=f.parsedOptions,_=f.parsedOptions.taskBarMilestoneHypotenuse,w=f.parsedOptions.taskBarMilestoneStyle.width;let T=[],S=[];if(t===hu.FinishToStart){let t=a?a.attribute.x+a.attribute.width:Lu(i,b,v,m,1)*x;r&&(t=a?a.attribute.x+a.attribute.width+(_-w)/2:Lu(e,b,v,m,1)*x+_/2);let s=p?p.attribute.x:Lu(l,b,v,m)*x;u&&(s-=(_-w)/2),T=[{x:t,y:y*(n+.5)+o},{x:t+20,y:y*(n+.5)+o},{x:t+20,y:y*(n+(n>d?0:1))+o},{x:s-20,y:y*(n+(n>d?0:1))+o},{x:s-20,y:y*(d+.5)+g},{x:s,y:y*(d+.5)+g}],t+20<=s-20&&T.splice(2,3,{x:t+20,y:y*(d+.5)+g});const h=T[T.length-1];S=[{x:h.x,y:h.y},{x:h.x-10,y:h.y-5},{x:h.x-10,y:h.y+5},{x:h.x,y:h.y}]}else if(t===hu.StartToFinish){let t=a?a.attribute.x:Lu(e,b,v,m)*x;r&&(t-=(_-w)/2);let i=p?p.attribute.x+p.attribute.width:Lu(h,b,v,m,1)*x;u&&(i=p?p.attribute.x+p.attribute.width+(_-w)/2:Lu(l,b,v,m,1)*x+_/2),T=[{x:t,y:y*(n+.5)+o},{x:t-20,y:y*(n+.5)+o},{x:t-20,y:y*(n+(n>d?0:1))+o},{x:i+20,y:y*(n+(n>d?0:1))+o},{x:i+20,y:y*(d+.5)+g},{x:i,y:y*(d+.5)+g}],t-20>=i+20&&T.splice(2,3,{x:t-20,y:y*(d+.5)+g});const s=T[T.length-1];S=[{x:s.x,y:s.y},{x:s.x+10,y:s.y-5},{x:s.x+10,y:s.y+5},{x:s.x,y:s.y}]}else if(t===hu.StartToStart){let t=a?a.attribute.x:Lu(e,b,v,m)*x;r&&(t-=(_-w)/2);let i=p?p.attribute.x:Lu(l,b,v,m)*x;u&&(i-=(_-w)/2),T=[{x:t,y:y*(n+.5)+o},{x:(n===d?t:Math.min(t,i))-20,y:y*(n+.5)+o},{x:(n===d?t:Math.min(t,i))-20,y:y*(d+(n===d?1:.5))+g},{x:i-20,y:y*(d+(n===d?1:.5))+g},{x:(n===d?i:Math.min(t,i))-20,y:y*(d+.5)+g},{x:i,y:y*(d+.5)+g}];const s=T[T.length-1];S=[{x:s.x,y:s.y},{x:s.x-10,y:s.y-5},{x:s.x-10,y:s.y+5},{x:s.x,y:s.y}]}else if(t===hu.FinishToFinish){let t=a?a.attribute.x+a.attribute.width:Lu(i,b,v,m,1)*x;r&&(t=a?a.attribute.x+a.attribute.width+(_-w)/2:Lu(e,b,v,m,1)*x+_/2);let s=p?p.attribute.x+p.attribute.width:Lu(h,b,v,m,1)*x;u&&(s=p?p.attribute.x+p.attribute.width+(_-w)/2:Lu(l,b,v,m,1)*x+_/2),T=[{x:t,y:y*(n+.5)+o},{x:(n===d?t:Math.max(t,s))+20,y:y*(n+.5)+o},{x:(n===d?t:Math.max(t,s))+20,y:y*(d+(n===d?1:.5))+g},{x:s+20,y:y*(d+(n===d?1:.5))+g},{x:s+20,y:y*(d+.5)+g},{x:s,y:y*(d+.5)+g}];const c=T[T.length-1];S=[{x:c.x,y:c.y},{x:c.x+10,y:c.y-5},{x:c.x+10,y:c.y+5},{x:c.x,y:c.y}]}return{linePoints:T,arrowPoints:S}}class cp{constructor(t){this._scene=t,this.dragLineContainer=new Ua({x:0,y:0,width:t._gantt.tableNoFrameWidth,height:Math.min(t._gantt.tableNoFrameHeight,t._gantt.drawHeight),pickable:!1,clip:!0,visible:!1}),this.dragLineContainer.name="drag-order-line-container",t.ganttGroup.addChild(this.dragLineContainer),this.initDragLine()}initDragLine(){if(this._scene._gantt.taskListTableInstance){const t=this._scene._gantt.taskListTableInstance.theme.dragHeaderSplitLine,e=zo({pickable:!1,stroke:t.lineColor,lineWidth:t.lineWidth,points:[]});this.dragLine=e,this.dragLineContainer.appendChild(e)}}showDragLine(t){this.dragLineContainer.showAll(),this.dragLine.setAttribute("points",[{x:0,y:t},{x:this._scene._gantt.tableNoFrameWidth,y:t}])}hideDragLine(){this.dragLineContainer.hideAll()}}Pn.load(ap);class up{constructor(t){let e,i;var n;this._gantt=t,this.tableGroupWidth=t.tableNoFrameWidth,this.tableGroupHeight=Math.min(t.tableNoFrameHeight,t.drawHeight),"node"===Eu.mode||(cd.setEnv("browser"),e=t.canvas.width,i=t.canvas.height),this.stage=(n={canvas:t.canvas,width:e,height:i,disableDirtyBounds:!1,background:t.parsedOptions.underlayBackgroundColor,enableLayout:!0,autoRender:!1,context:{appName:"vtable"},pluginList:["poptipForText"]},new Bd(n)),this.stage.gantt=this._gantt,this.stage.table=this._gantt,this.stage.defaultLayer.setTheme({group:{boundsPadding:0,strokeBoundsBuffer:0,lineJoin:"round"},text:{ignoreBuf:!0}}),this.initSceneGraph()}initSceneGraph(){this.ganttGroup=new Ua({x:this._gantt.tableX,y:this._gantt.tableY,width:this.tableGroupWidth,height:this.tableGroupHeight,clip:!0,pickable:!1}),this.stage.defaultLayer.add(this.ganttGroup),this.ganttGroup.name="table",this.timelineHeader=new Ju(this),this.grid=new Ou(this),this.dependencyLink=new hp(this),this.taskBar=new ep(this),this.markLine=new ip(this),this.toolTip=new lp(this),this.frameBorder=new np(this),this.scrollbarComponent=new Ru(this._gantt),this.stage.defaultLayer.addChild(this.scrollbarComponent.hScrollBar),this.stage.defaultLayer.addChild(this.scrollbarComponent.vScrollBar),this.dragOrderLine=new cp(this)}updateSceneGraph(){const t=this._gantt;let e,i;this.tableGroupWidth=t.tableNoFrameWidth,this.tableGroupHeight=Math.min(t.tableNoFrameHeight,t.drawHeight),"node"===Eu.mode||(cd.setEnv("browser"),e=t.canvas.width,i=t.canvas.height),this.stage.resize(e,i),this.refreshAll()}afterCreateSceneGraph(){this.scrollbarComponent.updateScrollBar(),function(t){const e=t._gantt,i=e.stateManager,n=e.scenegraph;n.scrollbarComponent.vScrollBar.addEventListener("pointerover",(t=>{n.scrollbarComponent.showVerticalScrollBar()})),n.scrollbarComponent.hScrollBar.addEventListener("pointerover",(t=>{n.scrollbarComponent.showHorizontalScrollBar()})),n.scrollbarComponent.vScrollBar.addEventListener("pointerout",(t=>{i.interactionState!==lu.scrolling&&n.scrollbarComponent.hideVerticalScrollBar()})),n.scrollbarComponent.hScrollBar.addEventListener("pointerout",(t=>{i.interactionState!==lu.scrolling&&n.scrollbarComponent.hideHorizontalScrollBar()})),n.scrollbarComponent.vScrollBar.addEventListener("pointermove",(t=>{t.stopPropagation()})),n.scrollbarComponent.vScrollBar.addEventListener("scrollDown",(t=>{n._gantt.eventManager.isDown=!0})),n.scrollbarComponent.vScrollBar.addEventListener("pointerup",(()=>{n._gantt.eventManager.isDraging=!1,i.interactionState===lu.scrolling&&i.updateInteractionState(lu.default)})),n.scrollbarComponent.vScrollBar.addEventListener("pointerupoutside",(()=>{i.interactionState===lu.scrolling&&i.updateInteractionState(lu.default)})),n.scrollbarComponent.vScrollBar.addEventListener("scrollUp",(t=>{n._gantt.eventManager.isDraging=!1})),n.scrollbarComponent.hScrollBar.addEventListener("pointermove",(t=>{t.stopPropagation()})),n.scrollbarComponent.hScrollBar.addEventListener("pointerdown",(t=>{t.stopPropagation()})),n.scrollbarComponent.hScrollBar.addEventListener("scrollDown",(t=>{n._gantt.eventManager.isDown=!0,i.interactionState!==lu.scrolling&&i.updateInteractionState(lu.scrolling)})),n.scrollbarComponent.hScrollBar.addEventListener("pointerup",(()=>{i.interactionState===lu.scrolling&&i.updateInteractionState(lu.default)})),n.scrollbarComponent.hScrollBar.addEventListener("pointerupoutside",(()=>{i.interactionState===lu.scrolling&&i.updateInteractionState(lu.default)})),n.scrollbarComponent.hScrollBar.addEventListener("scrollUp",(t=>{n._gantt.eventManager.isDraging=!1}));const s=pu(i.updateVerticalScrollBar,20),r=pu(i.updateHorizontalScrollBar,20);n.scrollbarComponent.vScrollBar.addEventListener("scrollDrag",(t=>{n._gantt.eventManager.isDown&&(n._gantt.eventManager.isDraging=!0),i.interactionState!==lu.scrolling&&i.updateInteractionState(lu.scrolling);const e=t.detail.value[0]/(1-t.detail.value[1]+t.detail.value[0]);s(e,t)})),n.scrollbarComponent.hScrollBar.addEventListener("scrollDrag",(t=>{n._gantt.eventManager.isDown&&(n._gantt.eventManager.isDraging=!0),i.fastScrolling=!0,i.interactionState!==lu.scrolling&&i.updateInteractionState(lu.scrolling);const e=t.detail.value[0]/(1-t.detail.value[1]+t.detail.value[0]);r(e)}))}(this._gantt.eventManager)}refreshAll(){this.tableGroupHeight=Math.min(this._gantt.tableNoFrameHeight,this._gantt.drawHeight),this.tableGroupWidth=this._gantt.tableNoFrameWidth,this.ganttGroup.setAttribute("height",this.tableGroupHeight),this.ganttGroup.setAttribute("width",this.tableGroupWidth),this.timelineHeader.refresh(),this.grid.refresh(),this.taskBar.refresh(),this.dependencyLink.refresh(),this.markLine.refresh(),this.dependencyLink.refresh(),this.frameBorder.refresh(),this.scrollbarComponent.updateScrollBar(),this.updateNextFrame()}refreshTaskBars(){this.dependencyLink.refresh(),this.taskBar.refresh(),this.updateNextFrame()}refreshTaskBarsAndGrid(){this._gantt.verticalSplitResizeLine.style.height=this._gantt.drawHeight+"px",this.tableGroupHeight=Math.min(this._gantt.tableNoFrameHeight,this._gantt.drawHeight),this.ganttGroup.setAttribute("height",this.tableGroupHeight),this.grid.refresh(),this.taskBar.refresh(),this.dependencyLink.refresh(),this.markLine.refresh(),this.frameBorder.resize(),this.scrollbarComponent.updateScrollBar(),this.updateNextFrame()}updateTableSize(){this.tableGroupHeight=Math.min(this._gantt.tableNoFrameHeight,this._gantt.drawHeight),this.tableGroupWidth=this._gantt.tableNoFrameWidth,this.ganttGroup.setAttributes({x:this._gantt.tableX,y:this._gantt.tableY,width:this._gantt.tableNoFrameWidth,height:this.tableGroupHeight}),this.grid.resize(),this.taskBar.resize(),this.dependencyLink.resize(),this.markLine.refresh(),this.frameBorder.resize()}updateStageBackground(){this.stage.background=this._gantt.parsedOptions.underlayBackgroundColor,this.updateNextFrame()}renderSceneGraph(){this.stage.render()}updateNextFrame(){this.stage.renderNextFrame()}get width(){var t,e;return null!==(e=null===(t=this.ganttGroup.attribute)||void 0===t?void 0:t.width)&&void 0!==e?e:0}get height(){var t,e;return null!==(e=null===(t=this.ganttGroup.attribute)||void 0===t?void 0:t.height)&&void 0!==e?e:0}get x(){var t,e;return null!==(e=null===(t=this.ganttGroup.attribute)||void 0===t?void 0:t.x)&&void 0!==e?e:0}get y(){var t,e;return null!==(e=null===(t=this.ganttGroup.attribute)||void 0===t?void 0:t.y)&&void 0!==e?e:0}setX(t){this.timelineHeader.setX(t),this.grid.setX(t),this.taskBar.setX(t),this.dependencyLink.setX(t),this.markLine.setX(t),this.updateNextFrame()}setY(t){this.grid.setY(t),this.taskBar.setY(t),this.dependencyLink.setY(t),this.updateNextFrame()}setPixelRatio(t){this.stage.disableDirtyBounds(),this.stage.window.setDpr(t),this.stage.render(),this.stage.enableDirtyBounds()}resize(){this.updateTableSize(),this.scrollbarComponent.updateScrollBar(),this.updateNextFrame()}release(){this.stage.release()}showTaskCreationButton(t,e,i){this.taskCreationButton||(this.taskCreationButton=new op(this._gantt.scenegraph));const n=this._gantt.parsedOptions.taskBarCreationMaxWidth,s=this._gantt.parsedOptions.taskBarCreationMinWidth,r=this._gantt.getDateColWidth(i),a=n?Math.min(n,s?Math.max(s,r):r):s?Math.max(s,r):r,o=t-(a-r)/2;this.taskCreationButton.show(o,e,a,this._gantt.parsedOptions.rowHeight),this.updateNextFrame()}hideTaskCreationButton(){this.taskCreationButton&&(this.taskCreationButton.hide(),this.updateNextFrame())}showToolTip(t){this.toolTip||(this.toolTip=new lp(this._gantt.scenegraph)),this.toolTip.show(t)}hideToolTip(){this.toolTip.hide()}refreshRecordLinkNodes(t,e,i){let n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;const s=this._gantt,r=s.getRecordByIndex(t,e),a=r.vtable_gantt_linkedTo,o=r.vtable_gantt_linkedFrom;for(let r=0;r<(null==a?void 0:a.length);r++){const o=a[r],l=o.vtable_gantt_linkLineNode,h=o.vtable_gantt_linkArrowNode,{linkedToTaskKey:d,linkedFromTaskKey:c,type:u}=o,{taskKeyField:p,minDate:g}=s.parsedOptions,f=Gu(s.records,p,c),v=Gu(s.records,p,d);let m,b,y,x,_,w,T,S,k;const B=this._gantt.getTaskBarStyle(t,e);if(s.parsedOptions.tasksShowMode===du.Sub_Tasks_Inline){const t=Xu(i.attribute.y+n,s);S=f.index[0],T=s.getRowsHeightByIndex(0,t.task_index-1)/s.parsedOptions.rowHeight,({startDate:m,endDate:b,taskDays:y}=s.getTaskInfoByTaskListIndex(v.index[0],v.index[1])),({startDate:x,endDate:_,taskDays:w}=s.getTaskInfoByTaskListIndex(f.index[0],f.index[1]));const e=B.width;k=i.attribute.y+e/2-(T+.5)*s.parsedOptions.rowHeight}else if(s.parsedOptions.tasksShowMode===du.Project_Sub_Tasks_Inline){const t=s.getTaskShowIndexByRecordIndex(f.index.slice(0,-1)),e=s.getTaskShowIndexByRecordIndex(v.index.slice(0,-1)),i=s.getRecordByIndex(t),n=s.getRecordByIndex(e);S=i.type===cu.PROJECT&&"expand"!==i.hierarchyState&&!1!==s.parsedOptions.projectSubTasksExpandable?t:s.getTaskShowIndexByRecordIndex(f.index),T=n.type===cu.PROJECT&&"expand"!==n.hierarchyState&&!1!==s.parsedOptions.projectSubTasksExpandable?e:s.getTaskShowIndexByRecordIndex(v.index),({startDate:m,endDate:b,taskDays:y}=s.getTaskInfoByTaskListIndex(T,v.index)),({startDate:x,endDate:_,taskDays:w}=s.getTaskInfoByTaskListIndex(S,f.index))}else if(s.parsedOptions.tasksShowMode===du.Sub_Tasks_Separate||s.parsedOptions.tasksShowMode===du.Sub_Tasks_Arrange||s.parsedOptions.tasksShowMode===du.Sub_Tasks_Compact){const t=Xu(i.attribute.y+n,s);S=s.getRowsHeightByIndex(0,f.index[0]-1)/s.parsedOptions.rowHeight+(s.parsedOptions.tasksShowMode===du.Sub_Tasks_Arrange||s.parsedOptions.tasksShowMode===du.Sub_Tasks_Compact?f.record.vtable_gantt_showIndex:f.index[1]),T=s.getRowsHeightByIndex(0,t.task_index-1)/s.parsedOptions.rowHeight+(s.parsedOptions.tasksShowMode===du.Sub_Tasks_Arrange||s.parsedOptions.tasksShowMode===du.Sub_Tasks_Compact?v.record.vtable_gantt_showIndex:t.sub_task_index),({startDate:m,endDate:b,taskDays:y}=s.getTaskInfoByTaskListIndex(v.index[0],v.index[1])),({startDate:x,endDate:_,taskDays:w}=s.getTaskInfoByTaskListIndex(f.index[0],f.index[1]));const e=B.width;k=i.attribute.y+e/2-(T+.5)*s.parsedOptions.rowHeight}else{if(S=s.getTaskShowIndexByRecordIndex(f.index),T=s.getTaskShowIndexByRecordIndex(v.index),-1===S||-1===T)continue;({startDate:m,endDate:b,taskDays:y}=s.getTaskInfoByTaskListIndex(T)),({startDate:x,endDate:_,taskDays:w}=s.getTaskInfoByTaskListIndex(S))}if(!(x&&_&&m&&b&&l&&h))return;const{linePoints:A,arrowPoints:C}=dp(u,x,_,S,0,f.record.type===cu.MILESTONE,null,0,m,b,T,0,v.record.type===cu.MILESTONE,i,null!=k?k:0,this._gantt);l.setAttribute("points",A),h.setAttribute("points",C)}for(let r=0;r<(null==o?void 0:o.length);r++){const a=o[r],l=a.vtable_gantt_linkLineNode,h=a.vtable_gantt_linkArrowNode,{linkedToTaskKey:d,linkedFromTaskKey:c,type:u}=a,{taskKeyField:p,minDate:g}=s.parsedOptions,f=Gu(s.records,p,d),v=Gu(s.records,p,c);let m,b,y,x,_,w,T,S,k;const B=this._gantt.getTaskBarStyle(t,e);if(s.parsedOptions.tasksShowMode===du.Sub_Tasks_Inline){const t=Xu(i.attribute.y+n,s);S=s.getRowsHeightByIndex(0,t.task_index-1)/s.parsedOptions.rowHeight,T=f.index[0],({startDate:m,endDate:b,taskDays:y}=s.getTaskInfoByTaskListIndex(f.index[0],f.index[1])),({startDate:x,endDate:_,taskDays:w}=s.getTaskInfoByTaskListIndex(v.index[0],v.index[1]));const e=B.width;k=i.attribute.y+e/2-(S+.5)*s.parsedOptions.rowHeight}else if(s.parsedOptions.tasksShowMode===du.Project_Sub_Tasks_Inline){const t=s.getTaskShowIndexByRecordIndex(v.index.slice(0,-1)),e=s.getTaskShowIndexByRecordIndex(f.index.slice(0,-1)),i=s.getRecordByIndex(t),n=s.getRecordByIndex(e);S=i.type===cu.PROJECT&&"expand"!==i.hierarchyState&&!1!==s.parsedOptions.projectSubTasksExpandable?t:s.getTaskShowIndexByRecordIndex(v.index),T=n.type===cu.PROJECT&&"expand"!==n.hierarchyState&&!1!==s.parsedOptions.projectSubTasksExpandable?e:s.getTaskShowIndexByRecordIndex(f.index),({startDate:m,endDate:b,taskDays:y}=s.getTaskInfoByTaskListIndex(T,f.index)),({startDate:x,endDate:_,taskDays:w}=s.getTaskInfoByTaskListIndex(S,v.index))}else if(s.parsedOptions.tasksShowMode===du.Sub_Tasks_Separate||s.parsedOptions.tasksShowMode===du.Sub_Tasks_Arrange||s.parsedOptions.tasksShowMode===du.Sub_Tasks_Compact){const t=Xu(i.attribute.y+n,s);S=s.getRowsHeightByIndex(0,t.task_index-1)/s.parsedOptions.rowHeight+(s.parsedOptions.tasksShowMode===du.Sub_Tasks_Arrange||s.parsedOptions.tasksShowMode===du.Sub_Tasks_Compact?v.record.vtable_gantt_showIndex:t.sub_task_index),T=s.getRowsHeightByIndex(0,f.index[0]-1)/s.parsedOptions.rowHeight+(s.parsedOptions.tasksShowMode===du.Sub_Tasks_Arrange||s.parsedOptions.tasksShowMode===du.Sub_Tasks_Compact?f.record.vtable_gantt_showIndex:f.index[1]),({startDate:m,endDate:b,taskDays:y}=s.getTaskInfoByTaskListIndex(f.index[0],f.index[1])),({startDate:x,endDate:_,taskDays:w}=s.getTaskInfoByTaskListIndex(v.index[0],v.index[1]));const e=B.width;k=i.attribute.y+e/2-(S+.5)*s.parsedOptions.rowHeight}else{if(S=s.getTaskShowIndexByRecordIndex(v.index),T=s.getTaskShowIndexByRecordIndex(f.index),-1===S||-1===T)continue;({startDate:m,endDate:b,taskDays:y}=s.getTaskInfoByTaskListIndex(T)),({startDate:x,endDate:_,taskDays:w}=s.getTaskInfoByTaskListIndex(S))}if(!(x&&_&&m&&b&&l&&h))return;const{linePoints:A,arrowPoints:C}=dp(u,x,_,S,0,v.record.type===cu.MILESTONE,i,null!=k?k:0,m,b,T,0,f.record.type===cu.MILESTONE,null,0,this._gantt);l.setAttribute("points",A),h.setAttribute("points",C)}}}const pp=(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 gp(t,e,i){let n,s,r,a,o,l,h=0,d=!1,c=!1,u=!0;const p=!e&&0!==e&&"function"==typeof requestAnimationFrame;if("function"!=typeof t)throw new TypeError("Expected a function");function g(e){const i=n,r=s;return s=void 0,n=void 0,h=e,a=t.apply(r,i),a}function f(t,e){return p?requestAnimationFrame(t):setTimeout(t,e)}function v(t){const i=t-l;return void 0===l||i>=e||i<0||d&&t-h>=r}function m(){const t=Date.now();if(v(t))return function(t){return o=void 0,u&&n?g(t):(s=void 0,n=void 0,a)}(t);o=f(m,function(t){const i=t-h,n=e&&-(t-l);return d?Math.min(n,r-i):n}(t))}return e=+e||0,pp(i,"object")&&(c=!!i.leading,d="maxWait"in i,d&&(r=Math.max(+i.maxWait||0,e)),u="trailing"in i?!!i.trailing:u),function(){const t=Date.now(),i=v(t);for(var r=arguments.length,u=new Array(r),p=0;p<r;p++)u[p]=arguments[p];if(n=u,s=this,l=t,i){if(void 0===o)return function(t){return h=t,o=f(m,e),c?g(t):a}(l);if(d)return o=f(m,e),g(l)}return void 0===o&&(o=f(m,e)),a}}let fp=1;class vp{constructor(t,e,i){var n;if(this.resizeTime=100,this.lastSize={width:0,height:0},this.mutationResize=()=>{this.onResize()},this.callBack=()=>{const t=this.getSize();let e=!1;t.width===this.lastSize.width&&t.height===this.lastSize.height&&(e=!0),this.lastSize=t,this.cb&&this.cb(Object.assign(Object.assign({},this.lastSize),{windowSizeNotChange:e}))},this.onResize=()=>{this.callBackDebounce()},this.element=t,this.cb=e,this.lastSize=this.getSize(),i&&(this.resizeTime=Math.max(i,16)),this.callBackDebounce=gp(this.callBack,this.resizeTime),null===window||void 0===window||window.addEventListener("resize",this.onResize),"ResizeObserver"in window){const t=window.ResizeObserver;this.observer=new t(this.mutationResize),null===(n=this.observer)||void 0===n||n.observe(this.element)}else"MutationObserver"in window&&(this.observer=new MutationObserver(this.mutationResize),this.observer.observe(this.element,{attributes:!0,attributeFilter:["style"]}))}disConnect(){window.removeEventListener("resize",this.onResize),this.observer&&(this.observer.disconnect(),this.observer=void 0)}setSize(t){this.lastSize=t}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)}:Object.assign({},this.lastSize)}}class mp{constructor(){this.listeners={},this.reseizeListeners={}}on(t,e,i){if("node"===Eu.mode)return-1;const n=fp++;for(var s=arguments.length,r=new Array(s>3?s-3:0),a=3;a<s;a++)r[a-3]=arguments[a];if(null==t?void 0:t.addEventListener)if("resize"!==e||t===window)null==t||t.addEventListener(e,i,...r);else{const e=new vp(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){var n=this;if("node"===Eu.mode)return-1;for(var s=arguments.length,r=new Array(s>3?s-3:0),a=3;a<s;a++)r[a-3]=arguments[a];const o=this.on(t,e,(function(){n.off(o),i(...arguments)}),...r);return o}off(t){var e;if("node"===Eu.mode)return;if(null==t)return;const i=null===(e=this.listeners)||void 0===e?void 0:e[t];i&&(delete this.listeners[t],i.target.removeEventListener&&i.target.removeEventListener(i.type,i.listener,...i.options))}fire(t,e){if("node"!==Eu.mode){for(var i=arguments.length,n=new Array(i>2?i-2:0),s=2;s<i;s++)n[s-2]=arguments[s];for(const i in this.listeners){const s=this.listeners[i];s.target===t&&s.type===e&&s.listener.call(s.target,...n)}}}hasListener(t,e){if("node"===Eu.mode)return!1;let i=!1;for(const n in this.listeners){const s=this.listeners[n];s.target===t&&s.type===e&&(i=!0)}return i}clear(){if("node"!==Eu.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];null==e||e.disConnect()}this.listeners={}}}release(){"node"!==Eu.mode&&(this.clear(),this.listeners={})}}let bp=1;function yp(){return Fu?bp=1:(bp=Math.ceil(window.devicePixelRatio||1),bp>1&&bp%2!=0&&(bp+=1)),bp}function xp(t){return!!t.changedTouches}yp();class _p{constructor(){}setScrollHandle(t){this.scrollHandle=t}startInertia(t,e,i){this.stopped=!1,this.lastTime=Date.now(),this.speedX=t,this.speedY=e,this.friction=i,this.runingId||(this.runingId=requestAnimationFrame(this.inertia.bind(this)))}inertia(){var t;if(this.stopped)return;const e=Date.now(),i=e-this.lastTime;let n=!0;const s=Math.pow(this.friction,i/16),r=s*this.speedX,a=s*this.speedY;let o=0,l=0;Math.abs(r)>.05&&(n=!1,o=(this.speedX+r)/2*i),Math.abs(a)>.05&&(n=!1,l=(this.speedY+a)/2*i),null===(t=this.scrollHandle)||void 0===t||t.call(this,o,l),n?this.runingId=null:(this.lastTime=e,this.speedX=r,this.speedY=a,this.runingId=requestAnimationFrame(this.inertia.bind(this)))}endInertia(){cancelAnimationFrame(this.runingId),this.runingId=null,this.stopped=!0}isInertiaScrolling(){return!!this.runingId}}class wp{constructor(t){this.isDown=!1,this.isDraging=!1,this.globalEventListeners=[],this._enableTableScroll=!0,this._gantt=t,this.inertiaScroll=new _p,this._eventHandler=new mp,this.bindEvent()}release(){this._eventHandler.release(),this.globalEventListeners.forEach((t=>{"document"===t.env?document.removeEventListener(t.name,t.callback):"body"===t.env?document.body.removeEventListener(t.name,t.callback):"window"===t.env&&window.removeEventListener(t.name,t.callback)})),this.globalEventListeners=[],this.inertiaScroll.endInertia()}bindEvent(){(function(t){const e=t._gantt.scenegraph,i=t._gantt,n=i.stateManager;e.ganttGroup.addEventListener("pointerdown",(s=>{if(0!==s.button)return;let r,a,o;if(s.detailPath.find((t=>"task-bar"===t.name?(r=t,!0):"task-creation-button"===t.name||("task-bar-link-point-left"===t.name?(a=t,!0):"task-bar-link-point-right"===t.name?(o=t,!0):!!t.attribute.vtable_link&&(t.attribute.vtable_link,!0)))),r){const a=r.record;if((null==a?void 0:a.type)!==cu.PROJECT)if("task-bar-hover-shadow-left-icon"===s.target.name)n.startResizeTaskBar(r,s.nativeEvent.x,s.nativeEvent.y,s.offset.y,"left"),n.updateInteractionState(lu.grabing);else if("task-bar-hover-shadow-right-icon"===s.target.name)n.startResizeTaskBar(r,s.nativeEvent.x,s.nativeEvent.y,s.offset.y,"right"),n.updateInteractionState(lu.grabing);else if(i.parsedOptions.taskBarMoveable){const a=()=>{let t=!0;if("function"==typeof i.parsedOptions.taskBarMoveable){const{startDate:n,endDate:s,taskRecord:a}=e._gantt.getTaskInfoByTaskListIndex(r.task_index,r.sub_task_index),o={index:r.task_index,startDate:n,endDate:s,taskRecord:a,ganttInstance:e._gantt};t=i.parsedOptions.taskBarMoveable(o)}else t=i.parsedOptions.taskBarMoveable;t&&(n.startMoveTaskBar(r,s.nativeEvent.x,s.nativeEvent.y,s.offset.y),n.updateInteractionState(lu.grabing))};"touch"===s.pointerType?(t.touchEnd=!1,t.touchSetTimeout=setTimeout((()=>{t.isTouchdown=!1,t.isLongTouch=!0,a()}),100)):a()}}else a?(n.startCreateDependencyLine(a,s.nativeEvent.x,s.nativeEvent.y,s.offset.y,"left"),n.updateInteractionState(lu.grabing)):o&&(n.startCreateDependencyLine(o,s.nativeEvent.x,s.nativeEvent.y,s.offset.y,"right"),n.updateInteractionState(lu.grabing))})),e.ganttGroup.addEventListener("pointermove",(s=>{var r,a,o,l,h;if(t.touchSetTimeout&&(clearTimeout(t.touchSetTimeout),t.touchSetTimeout=void 0),n.interactionState===lu.default){const t=s.detailPath.find((t=>"task-bar"===t.name)),o=s.detailPath.find((t=>"markline-hover-group"===t.name)),l=s.detailPath.find((t=>"mark-line-content"===t.name));if((null===(r=i.parsedOptions.markLineCreateOptions)||void 0===r?void 0:r.markLineCreatable)&&(o&&!function(t,e){const i=t.startDate.getTime(),n=t.endDate.getTime();return e.some((t=>{const e=new Date(t.date).getTime();return e>=i&&e<=n}))}(o.data,i.parsedOptions.markLine)?e._gantt.stateManager.marklineIcon.target!==o&&(e._gantt.stateManager.marklineIcon.target=o,n.showMarklineIconHover()):e._gantt.stateManager.marklineIcon.target&&n.hideMarklineIconHover()),t){if(e._gantt.stateManager.hoverTaskBar.target!==t){e._gantt.stateManager.hoverTaskBar.target=t;const i=t.task_index,r=t.sub_task_index,a=t.record;a.type!==cu.PROJECT&&n.showTaskBarHover(),e._gantt.hasListeners(uu.MOUSEENTER_TASK_BAR)&&e._gantt.fireListeners(uu.MOUSEENTER_TASK_BAR,{federatedEvent:s,event:s.nativeEvent,index:i,sub_task_index:r,record:a})}}else{if(e._gantt.stateManager.hoverTaskBar.target){if(e._gantt.hasListeners(uu.MOUSELEAVE_TASK_BAR)){const t=e._gantt.stateManager.hoverTaskBar.target.task_index,i=e._gantt.stateManager.hoverTaskBar.target.sub_task_index,n=e._gantt.getRecordByIndex(t,i);e._gantt.fireListeners(uu.MOUSELEAVE_TASK_BAR,{federatedEvent:s,event:s.nativeEvent,index:t,sub_task_index:i,record:n})}n.hideTaskBarHover(s)}if(i.parsedOptions.taskBarCreatable&&!l){const t=Xu(s.offset.y-i.headerHeight+i.stateManager.scrollTop,i),e=i.getTaskInfoByTaskListIndex(t.task_index,t.sub_task_index);let n=!0;if("function"==typeof i.parsedOptions.taskBarCreatable){const{startDate:s,endDate:r,taskRecord:a}=e,o={index:t.task_index,sub_task_index:t.sub_task_index,startDate:s,endDate:r,taskRecord:a,ganttInstance:i};n=i.parsedOptions.taskBarCreatable(o)}else n=i.parsedOptions.taskBarCreatable;if(n){const n=function(t,e,i){const n=Xu(e-i.headerHeight+i.stateManager.scrollTop,i),s=i.getRecordByIndex(n.task_index),r=Nu(t,i),a=i.getDateRangeByIndex(r);if(null==s?void 0:s.children){const t=Xu(e-i.headerHeight+i.stateManager.scrollTop,i);for(let e=0;e<s.children.length;e++){const{startDate:n,endDate:r,taskDays:o,progress:l,taskRecord:h}=i.getTaskInfoByTaskListIndex(t.task_index,e);if(((i.parsedOptions.tasksShowMode===du.Sub_Tasks_Compact||i.parsedOptions.tasksShowMode===du.Sub_Tasks_Arrange)&&h.vtable_gantt_showIndex===t.sub_task_index||i.parsedOptions.tasksShowMode===du.Sub_Tasks_Inline||i.parsedOptions.tasksShowMode===du.Project_Sub_Tasks_Inline&&s.type===cu.PROJECT&&"expand"!==s.hierarchyState&&!1!==i.parsedOptions.projectSubTasksExpandable)&&a.startDate.getTime()>=n.getTime()&&a.endDate.getTime()<=r.getTime())return{startDate:n,endDate:r,taskDays:o,progress:l,taskRecord:h}}}}(s.offset.x,s.offset.y,i);if((i.parsedOptions.tasksShowMode===du.Sub_Tasks_Separate||i.parsedOptions.tasksShowMode===du.Tasks_Separate)&&!e.taskDays&&e.taskRecord&&!e.taskRecord.vtableMerge||(i.parsedOptions.tasksShowMode===du.Sub_Tasks_Inline||i.parsedOptions.tasksShowMode===du.Sub_Tasks_Arrange||i.parsedOptions.tasksShowMode===du.Sub_Tasks_Compact)&&!n){const e=Nu(s.offset.x,i),n=(e>=1?i.getDateColsWidth(0,e-1):0)-i.stateManager.scroll.horizontalBarPos,r=i.taskListTableInstance.getRowsHeight(i.taskListTableInstance.columnHeaderLevelCount,t.task_index+i.taskListTableInstance.columnHeaderLevelCount-1)+(null!==(a=t.sub_task_index)&&void 0!==a?a:0)*i.parsedOptions.rowHeight-i.stateManager.scroll.verticalBarPos;return void i.scenegraph.showTaskCreationButton(n,r,e)}}}}i.scenegraph.hideTaskCreationButton()}else if(n.interactionState===lu.grabing){let t,i,r;s.detailPath.find((e=>"task-bar"===e.name?(t=e,!0):"task-creation-button"===e.name||("task-bar-link-point-left"===e.name?(i=e,!0):"task-bar-link-point-right"===e.name?(r=e,!0):!!e.attribute.vtable_link&&(e.attribute.vtable_link,!0)))),t=null!==(l=null!=t?t:null===(o=null==i?void 0:i.parent)||void 0===o?void 0:o.attribute.attachedToTaskBarNode)&&void 0!==l?l:null===(h=null==r?void 0:r.parent)||void 0===h?void 0:h.attribute.attachedToTaskBarNode,e._gantt.stateManager.isCreatingDependencyLine()&&!t?n.hideSecondTaskBarSelectedBorder():e._gantt.stateManager.isCreatingDependencyLine()&&i&&e._gantt.stateManager.selectedTaskBar.target!==t?(n.highlightLinkPointNode(i),n.creatingDenpendencyLink.lastHighLightLinkPoint=i,n.creatingDenpendencyLink.secondTaskBarPosition="left"):e._gantt.stateManager.isCreatingDependencyLine()&&r&&e._gantt.stateManager.selectedTaskBar.target!==t?(n.highlightLinkPointNode(r),n.creatingDenpendencyLink.lastHighLightLinkPoint=r,n.creatingDenpendencyLink.secondTaskBarPosition="right"):e._gantt.stateManager.isCreatingDependencyLine()&&t&&e._gantt.stateManager.selectedTaskBar.target!==t&&(n.unhighlightLinkPointNode(n.creatingDenpendencyLink.lastHighLightLinkPoint),n.creatingDenpendencyLink.secondTaskBarNode&&n.creatingDenpendencyLink.secondTaskBarNode===t||(n.creatingDenpendencyLink.secondTaskBarNode&&n.creatingDenpendencyLink.secondTaskBarNode!==t&&n.hideSecondTaskBarSelectedBorder(),n.creatingDenpendencyLink.secondTaskBarNode=t,n.showSecondTaskBarSelectedBorder()))}})),e.ganttGroup.addEventListener("pointerup",(s=>{var r,a;if(t.touchSetTimeout&&(clearTimeout(t.touchSetTimeout),t.touchSetTimeout=void 0),0===s.button){let o,l,h,d=!1,c=!1,u=!1,p=!1,g=!1,f=!1,v=!1;const m=s.detailPath.find((t=>"task-bar"===t.name?(d=!0,!0):"task-creation-button"===t.name?(c=!0,!1):"task-bar-link-point-left"===t.name?(p=!0,!1):"task-bar-link-point-right"===t.name?(g=!0,!1):t.attribute.vtable_link?(u=!0,o=t.attribute.vtable_link,!1):"markline-hover-group"===t.name?(f=!0,h=t,!1):"mark-line-content"===t.name&&(v=!0,l=t,!1)));if(d&&e._gantt.parsedOptions.taskBarSelectable&&"down"===t.poniterState){if(n.hideDependencyLinkSelectedLine(),n.showTaskBarSelectedBorder(m),i.hasListeners(uu.CLICK_TASK_BAR)){const t=m.task_index,e=m.sub_task_index,n=i.getRecordByIndex(t,e);i.fireListeners(uu.CLICK_TASK_BAR,{federatedEvent:s,event:s.nativeEvent,index:t,sub_task_index:e,record:n})}}else if(c&&"down"===t.poniterState){n.hideDependencyLinkSelectedLine(),n.hideTaskBarSelectedBorder();const t=Xu(s.offset.y-i.headerHeight+i.stateManager.scrollTop,i);if(i.parsedOptions.tasksShowMode===du.Sub_Tasks_Arrange||i.parsedOptions.tasksShowMode===du.Sub_Tasks_Inline||i.parsedOptions.tasksShowMode===du.Sub_Tasks_Compact){if(i.hasListeners(uu.CREATE_TASK_SCHEDULE)){const e=Nu(s.offset.x,i),n=i.getDateRangeByIndex(e),a=null!==(r=i.parsedOptions.dateFormat)&&void 0!==r?r:i.parsedOptions.timeScaleIncludeHour?"yyyy-mm-dd hh:mm:ss":"yyyy-mm-dd";i.fireListeners(uu.CREATE_TASK_SCHEDULE,{federatedEvent:s,event:s.nativeEvent,index:t.task_index,sub_task_index:t.sub_task_index,startDate:gu(n.startDate,a),endDate:gu(n.endDate,a),record:void 0,parentRecord:i.getRecordByIndex(t.task_index)})}}else{const e=i.getTaskInfoByTaskListIndex(t.task_index,t.sub_task_index);if(e.taskRecord){const n=null!==(a=i.parsedOptions.dateFormat)&&void 0!==a?a:i.parsedOptions.timeScaleIncludeHour?"yyyy-mm-dd hh:mm:ss":"yyyy-mm-dd",r=Nu(s.offset.x,i),o=i.getDateRangeByIndex(r);e.taskRecord[i.parsedOptions.startDateField]=gu(o.startDate,n),e.taskRecord[i.parsedOptions.endDateField]=gu(o.endDate,n),i.scenegraph.hideTaskCreationButton(),i.updateTaskRecord(e.taskRecord,t.task_index,t.sub_task_index),i.hasListeners(uu.CREATE_TASK_SCHEDULE)&&i.fireListeners(uu.CREATE_TASK_SCHEDULE,{federatedEvent:s,event:s.nativeEvent,index:t.task_index,sub_task_index:t.sub_task_index,startDate:e.taskRecord[i.parsedOptions.startDateField],endDate:e.taskRecord[i.parsedOptions.endDateField],record:e.taskRecord})}}}else if(u&&e._gantt.parsedOptions.dependencyLinkSelectable&&"down"===t.poniterState)n.hideDependencyLinkSelectedLine(),n.hideTaskBarSelectedBorder(),e._gantt.stateManager.selectedDenpendencyLink.link=o,n.showDependencyLinkSelectedLine();else if((p||g)&&"down"===t.poniterState){if(i.hasListeners(uu.CLICK_DEPENDENCY_LINK_POINT)){const t=Xu(s.offset.y-i.headerHeight+i.stateManager.scrollTop,i),e=i.getRecordByIndex(t.task_index,t.sub_task_index);i.fireListeners(uu.CLICK_DEPENDENCY_LINK_POINT,{event:s.nativeEvent,index:t.task_index,sub_task_index:t.sub_task_index,point:p?"start":"end",record:e})}n.hideTaskBarSelectedBorder()}else if(f&&"down"===t.poniterState)i.hasListeners(uu.CLICK_MARKLINE_CREATE)&&i.fireListeners(uu.CLICK_MARKLINE_CREATE,{event:s.nativeEvent,position:Zu(h,e._gantt),data:e._gantt.stateManager.marklineIcon.target.data});else if(v&&"down"===t.poniterState)i.hasListeners(uu.CLICK_MARKLINE_CONTENT)&&i.fireListeners(uu.CLICK_MARKLINE_CONTENT,{event:s.nativeEvent,position:Zu(l,e._gantt),data:l.data});else if(p&&"draging"===t.poniterState){if(n.isCreatingDependencyLine()){const t=n.endCreateDependencyLine(s.offset.y);i.hasListeners(uu.CREATE_DEPENDENCY_LINK)&&i.fireListeners(uu.CREATE_DEPENDENCY_LINK,{federatedEvent:s,event:s.nativeEvent,link:t})}}else if(g&&"draging"===t.poniterState){if(n.isCreatingDependencyLine()){const t=n.endCreateDependencyLine(s.offset.y);i.hasListeners(uu.CREATE_DEPENDENCY_LINK)&&i.fireListeners(uu.CREATE_DEPENDENCY_LINK,{federatedEvent:s,event:s.nativeEvent,link:t})}}else n.hideDependencyLinkSelectedLine(),n.hideTaskBarSelectedBorder()}})),e.ganttGroup.addEventListener("rightdown",(t=>{let e,n=!1,s=!1;const r=t.detailPath.find((t=>"task-bar"===t.name?(n=!0,!0):!!t.attribute.vtable_link&&(s=!0,e=t.attribute.vtable_link,!1)));if(n){if(i.hasListeners(uu.CONTEXTMENU_TASK_BAR)){const e=r.task_index,n=r.sub_task_index,s=i.getRecordByIndex(e,n);i.fireListeners(uu.CONTEXTMENU_TASK_BAR,{federatedEvent:t,event:t.nativeEvent,index:e,sub_task_index:n,record:s})}}else s&&i.hasListeners(uu.CONTEXTMENU_DEPENDENCY_LINK)&&i.fireListeners(uu.CONTEXTMENU_DEPENDENCY_LINK,{federatedEvent:t,event:t.nativeEvent,link:e})})),e.ganttGroup.addEventListener("pointerenter",(t=>{(i.parsedOptions.scrollStyle.horizontalVisible&&"focus"===i.parsedOptions.scrollStyle.horizontalVisible||!i.parsedOptions.scrollStyle.horizontalVisible&&"focus"===i.parsedOptions.scrollStyle.visible)&&e.scrollbarComponent.showHorizontalScrollBar(),(i.parsedOptions.scrollStyle.verticalVisible&&"focus"===i.parsedOptions.scrollStyle.verticalVisible||!i.parsedOptions.scrollStyle.verticalVisible&&"focus"===i.parsedOptions.scrollStyle.visible)&&e.scrollbarComponent.showVerticalScrollBar()})),e.ganttGroup.addEventListener("pointerleave",(t=>{if((i.parsedOptions.scrollStyle.horizontalVisible&&"focus"===i.parsedOptions.scrollStyle.horizontalVisible||!i.parsedOptions.scrollStyle.horizontalVisible&&"focus"===i.parsedOptions.scrollStyle.visible)&&e.scrollbarComponent.hideHorizontalScrollBar(),(i.parsedOptions.scrollStyle.verticalVisible&&"focus"===i.parsedOptions.scrollStyle.verticalVisible||!i.parsedOptions.scrollStyle.verticalVisible&&"focus"===i.parsedOptions.scrollStyle.visible)&&e.scrollbarComponent.hideVerticalScrollBar(),e._gantt.stateManager.hoverTaskBar.target){if(e._gantt.hasListeners(uu.MOUSELEAVE_TASK_BAR)){const i=e._gantt.stateManager.hoverTaskBar.target.task_index,n=e._gantt.stateManager.hoverTaskBar.target.sub_task_index,s=e._gantt.getRecordByIndex(i,n);e._gantt.fireListeners(uu.MOUSELEAVE_TASK_BAR,{federatedEvent:t,event:t.nativeEvent,index:i,sub_task_index:n,record:s})}n.hideTaskBarHover(t)}})),e.ganttGroup.addEventListener("wheel",(t=>{Mu(t,n,i)}))})(this),function(t){const e=t._gantt,i=(t._gantt.scenegraph,e.stateManager),n=t._eventHandler;n.on(e.getElement(),"contextmenu",(t=>{var i;!1!==(null===(i=e.parsedOptions.eventOptions)||void 0===i?void 0:i.preventDefaultContextMenu)&&t.preventDefault()})),n.on(e.getContainer(),"resize",(t=>{0===t.width&&0===t.height||(tu(e.options.pixelRatio)||e.setPixelRatio(yp()),t.windowSizeNotChange||e._resize())})),e.taskListTableInstance&&e.parsedOptions.verticalSplitLineMoveable&&n.on(e.verticalSplitResizeLine,"mousedown",(t=>{i.updateInteractionState(lu.grabing),i.startResizeTableWidth(t)})),e.parsedOptions.verticalSplitLineHighlight&&(e.verticalSplitResizeLine&&n.on(e.verticalSplitResizeLine,"mouseover",(t=>{e.verticalSplitResizeLine.childNodes[1].style.opacity="1"})),e.verticalSplitResizeLine&&n.on(e.verticalSplitResizeLine,"mouseout",(t=>{e.verticalSplitResizeLine.childNodes[1].style.opacity="0"})));const s=t=>{e.eventManager.lastDragPointerXYOnWindow={x:t.x,y:t.y},e.eventManager.poniterState="down"};t.globalEventListeners.push({name:"pointerdown",env:"document",callback:s}),cd.addEventListener("pointerdown",s);const r=t=>{var n,s,r,a,o,l;if("down"===e.eventManager.poniterState){const i=null!==(n=e.eventManager.lastDragPointerXYOnWindow.x)&&void 0!==n?n:t.x,r=t.x-i,a=null!==(s=e.eventManager.lastDragPointerXYOnWindow.y)&&void 0!==s?s:t.y,o=t.y-a;(Math.abs(r)>=1||Math.abs(o)>=1)&&(e.eventManager.poniterState="draging")}if(i.interactionState===lu.grabing&&"draging"===e.eventManager.poniterState){const n=null!==(a=null===(r=e.eventManager.lastDragPointerXYOnWindow)||void 0===r?void 0:r.x)&&void 0!==a?a:t.x,s=null!==(l=null===(o=e.eventManager.lastDragPointerXYOnWindow)||void 0===o?void 0:o.y)&&void 0!==l?l:t.y;(Math.abs(n-t.x)>=1||Math.abs(s-t.y)>=1)&&(i.isResizingTableWidth()?(i.hideDependencyLinkSelectedLine(),i.hideTaskBarSelectedBorder(),i.dealResizeTableWidth(t)):i.isMoveingTaskBar()?(i.hideDependencyLinkSelectedLine(),i.hideTaskBarSelectedBorder(),i.dealTaskBarMove(t)):i.isResizingTaskBar()?(i.hideDependencyLinkSelectedLine(),i.hideTaskBarSelectedBorder(),i.dealTaskBarResize(t)):i.isCreatingDependencyLine()&&i.dealCreateDependencyLine(t),e.eventManager.lastDragPointerXYOnWindow={x:t.x,y:t.y})}};t.globalEventListeners.push({name:"pointermove",env:"document",callback:r}),cd.addEventListener("pointermove",r);const a=t=>{"grabing"===i.interactionState&&(i.updateInteractionState(lu.default),i.isResizingTableWidth()?i.endResizeTableWidth():i.isMoveingTaskBar()?i.endMoveTaskBar():i.isResizingTaskBar()&&i.endResizeTaskBar(t.x)),setTimeout((()=>{e.eventManager.lastDragPointerXYOnWindow=void 0,e.eventManager.poniterState="up"}),0)};t.globalEventListeners.push({name:"pointerup",env:"document",callback:a}),cd.addEventListener("pointerup",a);const o=t=>{var n,s;if(e.parsedOptions.dependencyLinkDeletable&&("Delete"===t.key&&(null===(n=e.parsedOptions.keyboardOptions)||void 0===n?void 0:n.deleteLinkOnDel)||"Backspace"===t.key&&(null===(s=e.parsedOptions.keyboardOptions)||void 0===s?void 0:s.deleteLinkOnBack))&&e.stateManager.selectedDenpendencyLink.link){const n=e.stateManager.selectedDenpendencyLink.link;e.deleteLink(e.stateManager.selectedDenpendencyLink.link),i.hideDependencyLinkSelectedLine(),i.hideTaskBarSelectedBorder(),e.hasListeners(uu.DELETE_DEPENDENCY_LINK)&&e.fireListeners(uu.DELETE_DEPENDENCY_LINK,{event:t,link:n})}};t.globalEventListeners.push({name:"keydown",env:"document",callback:o}),cd.addEventListener("keydown",o)}(this),function(t){const e=t._gantt,i=e.stateManager,n=e.scenegraph;if(!1===cd.envContribution.supportsTouchEvents)return;cd.addEventListener("contextmenu",(t=>{t.stopPropagation(),t.preventDefault()}),{capture:!0}),t.touchMovePoints=[],e.scenegraph.ganttGroup.addEventListener("touchstart",(e=>{e.target.isChildOf(n.scrollbarComponent.vScrollBar)||e.target.isChildOf(n.scrollbarComponent.hScrollBar)||(t.isTouchdown=!0,t.touchMovePoints.push({x:e.page.x,y:e.page.y,timestamp:Date.now()}))}));const s=n=>{if(t.isLongTouch&&n.preventDefault(),t.isTouchdown&&xp(n)&&(t.isTouchMove=!0,t.touchMovePoints.length>4&&t.touchMovePoints.shift(),t.touchMovePoints.push({x:n.changedTouches[0].pageX,y:n.changedTouches[0].pageY,timestamp:Date.now()}),t._enableTableScroll)){const s=-t.touchMovePoints[t.touchMovePoints.length-1].x+t.touchMovePoints[t.touchMovePoints.length-2].x,r=-t.touchMovePoints[t.touchMovePoints.length-1].y+t.touchMovePoints[t.touchMovePoints.length-2].y;Mu(n,i,e),n.cancelable&&("none"===e.parsedOptions.overscrollBehavior||Math.abs(r)>=Math.abs(s)&&0!==r&&Pu(r,i)||Math.abs(r)<=Math.abs(s)&&0!==s&&Du(s,i))&&n.preventDefault()}};cd.addEventListener("touchmove",s,{passive:!1}),t.globalEventListeners.push({name:"touchmove",env:"vglobal",callback:s});const r=i=>{var n,s;if(t.touchEnd=!0,t.isLongTouch=!1,t.isTouchdown&&xp(i)){if((null===(n=t.touchMovePoints)||void 0===n?void 0:n.length)&&(t.touchMovePoints.length>4&&t.touchMovePoints.shift(),t.touchMovePoints.push({x:i.changedTouches[0].pageX,y:i.changedTouches[0].pageY,timestamp:Date.now()}),t._enableTableScroll)){const i=t.touchMovePoints[0],n=t.touchMovePoints[(null===(s=t.touchMovePoints)||void 0===s?void 0:s.length)-1],r=(n.x-i.x)/(n.timestamp-i.timestamp),a=(n.y-i.y)/(n.timestamp-i.timestamp);t.inertiaScroll.startInertia(r,a,.95),e.eventManager.inertiaScroll.setScrollHandle(((t,i)=>{Mu({deltaX:-t,deltaY:-i},e.stateManager,e)}))}t.isTouchdown=!1,t.isTouchMove=!1,t.isDraging=!1,t.touchMovePoints=[]}};cd.addEventListener("touchend",r),t.globalEventListeners.push({name:"touchend",env:"vglobal",callback:r});const a=e=>{t.touchEnd=!0,t.isLongTouch=!1,t.isTouchdown&&(t.isTouchdown=!1,t.isTouchMove=!1,t.touchMovePoints=[],t.isDraging=!1)};cd.addEventListener("touchcancel",a),t.globalEventListeners.push({name:"touchcancel",env:"vglobal",callback:a})}(this)}}function Tp(t){const{scroll:e}=t.stateManager,{verticalBarPos:i}=e;t.taskListTableInstance.stateManager.setScrollTop(i,void 0,!1)}function Sp(t){var e,i,n,s,r,a,o,l;const h=t.taskTableWidth;t.taskTableWidth=t.taskListTableInstance.getAllColsWidth()+t.parsedOptions.outerFrameStyle.borderLineWidth,(null===(i=null===(e=t.options)||void 0===e?void 0:e.taskListTable)||void 0===i?void 0:i.maxTableWidth)&&(t.taskTableWidth=Math.min(null===(s=null===(n=t.options)||void 0===n?void 0:n.taskListTable)||void 0===s?void 0:s.maxTableWidth,t.taskTableWidth)),(null===(a=null===(r=t.options)||void 0===r?void 0:r.taskListTable)||void 0===a?void 0:a.minTableWidth)&&(t.taskTableWidth=Math.max(null===(l=null===(o=t.options)||void 0===o?void 0:o.taskListTable)||void 0===l?void 0:l.minTableWidth,t.taskTableWidth)),h!==t.taskTableWidth&&(t.element.style.left=t.taskTableWidth?`${t.taskTableWidth}px`:"0px",t.taskListTableInstance.setCanvasSize(t.taskTableWidth,t.tableNoFrameHeight+2*t.parsedOptions.outerFrameStyle.borderLineWidth),t._updateSize(),ju(t))}class kp{constructor(t){var e;this.interactionState=lu.default,this.resetInteractionState=gp((()=>{this.updateInteractionState(lu.default)}),100),this._gantt=t,this.scroll={horizontalBarPos:0,verticalBarPos:0},this.moveTaskBar={targetStartX:null,targetStartY:null,deltaX:0,deltaY:0,startOffsetY:null,startX:null,startY:null,moving:!1,target:null,moveTaskBarXSpeed:0,moveTaskBarXInertia:new _p},this.hoverTaskBar={targetStartX:null,startX:null,target:null},this.marklineIcon={target:null},this.selectedTaskBar={target:null},this.resizeTaskBar={startOffsetY:null,targetStartX:null,targetEndX:null,startX:null,startY:null,target:null,resizing:!1,onIconName:""},this.resizeTableWidth={lastX:null,resizing:!1},this.selectedDenpendencyLink={link:null},this.creatingDenpendencyLink={startClickedPoint:null,startX:null,startY:null,startOffsetY:null,targetStartX:null,creating:!1,secondTaskBarNode:null},this.updateVerticalScrollBar=this.updateVerticalScrollBar.bind(this),this.updateHorizontalScrollBar=this.updateHorizontalScrollBar.bind(this),function(t){var e;t.taskListTableInstance&&(null===(e=t.taskListTableInstance)||void 0===e||e.on("scroll",(e=>{if("vertical"===e.scrollDirection){const{scroll:e}=t.taskListTableInstance.stateManager,{verticalBarPos:i}=e;t.stateManager.scroll.verticalBarPos!==i&&t.stateManager.setScrollTop(i,!1)}})))}(this._gantt),function(t){var e;null===(e=t.taskListTableInstance)||void 0===e||e.on("change_cell_value",(e=>{const{col:i,row:n}=e;t.taskListTableInstance.isHeader(i,n)||t._refreshTaskBar(n-t.taskListTableInstance.columnHeaderLevelCount)}))}(this._gantt),function(t){var e,i,n,s;null===(e=t.taskListTableInstance)||void 0===e||e.on("change_header_position",(e=>{t.parsedOptions.tasksShowMode===du.Sub_Tasks_Arrange||t.parsedOptions.tasksShowMode===du.Sub_Tasks_Compact||t.parsedOptions.tasksShowMode===du.Sub_Tasks_Separate||t.parsedOptions.tasksShowMode===du.Project_Sub_Tasks_Inline?t.scenegraph.refreshTaskBarsAndGrid():t.scenegraph.refreshTaskBars(),t.scenegraph.dragOrderLine.hideDragLine();const i=t.stateManager.scroll.horizontalBarPos,n=t.stateManager.scroll.verticalBarPos;t.scenegraph.setX(-i),t.scenegraph.setY(-n)})),null===(i=t.taskListTableInstance)||void 0===i||i.on("change_header_position_start",(e=>{const{col:i,row:n,x:s,y:r,backX:a,lineX:o,backY:l,lineY:h,event:d}=e;t.scenegraph.dragOrderLine.showDragLine(h),t.scenegraph.updateNextFrame()})),null===(n=t.taskListTableInstance)||void 0===n||n.on("changing_header_position",(e=>{const{col:i,row:n,x:s,y:r,backX:a,lineX:o,backY:l,lineY:h,event:d}=e;t.scenegraph.dragOrderLine.showDragLine(h),t.scenegraph.updateNextFrame()})),null===(s=t.taskListTableInstance)||void 0===s||s.on("change_header_position_fail",(e=>{t.scenegraph.dragOrderLine.hideDragLine(),t.scenegraph.updateNextFrame()}))}(this._gantt),function(t){var e;null===(e=t.taskListTableInstance)||void 0===e||e.on("tree_hierarchy_state_change",(e=>{var i,n;const{row:s,hierarchyState:r}=e;if(t.parsedOptions.tasksShowMode===du.Project_Sub_Tasks_Inline){const e=s-t.taskListTableInstance.columnHeaderLevelCount,n=t.getRecordByIndex(e);n&&n.type===cu.PROJECT&&(null===(i=n.children)||void 0===i?void 0:i.length)>0&&(n.hierarchyState=r)}t._syncPropsFromTable(),t.scenegraph.refreshTaskBarsAndGrid(),!t.taskListTableInstance.checkHasColumnAutoWidth()||"auto"!==(null===(n=t.options.taskListTable)||void 0===n?void 0:n.tableWidth)&&-1!==t.taskTableWidth||Sp(t);const a=t.stateManager.scroll.horizontalBarPos,o=t.stateManager.scroll.verticalBarPos;t.scenegraph.setX(-a),t.scenegraph.setY(-o)}))}(this._gantt),function(t){var e;null===(e=t.taskListTableInstance)||void 0===e||e.on("after_sort",(e=>{t.scenegraph.refreshTaskBars();const i=t.stateManager.scroll.horizontalBarPos,n=t.stateManager.scroll.verticalBarPos;t.scenegraph.setX(-i),t.scenegraph.setY(-n)}))}(this._gantt),"auto"!==(null===(e=this._gantt.options.taskListTable)||void 0===e?void 0:e.tableWidth)&&-1!==this._gantt.taskTableWidth||function(t){var e;null===(e=t.taskListTableInstance)||void 0===e||e.on("resize_column",(e=>{Sp(t)}))}(this._gantt)}setScrollTop(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];const i=this._gantt.getAllRowsHeight();t=Math.max(0,Math.min(t,i-this._gantt.scenegraph.height)),t=Math.ceil(t);const n=this.scroll.verticalBarPos;this.scroll.verticalBarPos=t,tu(this.scroll.verticalBarPos)&&!isNaN(this.scroll.verticalBarPos)||(this.scroll.verticalBarPos=0),this._gantt.scenegraph.setY(-t);const s=t/(i-this._gantt.scenegraph.height);this._gantt.scenegraph.scrollbarComponent.updateVerticalScrollBarPos(s),n!==t&&e&&(Tp(this._gantt),this._gantt.fireListeners(uu.SCROLL,{scrollTop:this.scroll.verticalBarPos,scrollLeft:this.scroll.horizontalBarPos,scrollDirection:"vertical",scrollRatioY:s}))}get scrollLeft(){return this.scroll.horizontalBarPos}get scrollTop(){return this.scroll.verticalBarPos}setScrollLeft(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];const i=this._gantt.getAllDateColsWidth();t=Math.max(0,Math.min(t,i-this._gantt.scenegraph.width)),t=Math.ceil(t);const n=this.scroll.horizontalBarPos;this.scroll.horizontalBarPos=t,tu(this.scroll.horizontalBarPos)&&!isNaN(this.scroll.horizontalBarPos)||(this.scroll.horizontalBarPos=0),this._gantt.scenegraph.setX(-t);const s=t/(i-this._gantt.scenegraph.width);this._gantt.scenegraph.scrollbarComponent.updateHorizontalScrollBarPos(s),n!==t&&e&&this._gantt.fireListeners(uu.SCROLL,{scrollTop:this.scroll.verticalBarPos,scrollLeft:this.scroll.horizontalBarPos,scrollDirection:"horizontal",scrollRatioX:s})}updateInteractionState(t){if(this.interactionState===t)return;const e=this.interactionState;this.interactionState=t,e===lu.scrolling&&lu.default}updateVerticalScrollBar(t){const e=this._gantt.getAllRowsHeight();this.scroll.verticalBarPos,this.scroll.verticalBarPos=Math.ceil(t*(e-this._gantt.scenegraph.height)),tu(this.scroll.verticalBarPos)&&!isNaN(this.scroll.verticalBarPos)||(this.scroll.verticalBarPos=0),this._gantt.scenegraph.setY(-this.scroll.verticalBarPos,1===t),Tp(this._gantt),this._gantt.fireListeners(uu.SCROLL,{scrollTop:this.scroll.verticalBarPos,scrollLeft:this.scroll.horizontalBarPos,scrollDirection:"vertical",scrollRatioY:t})}updateHorizontalScrollBar(t){const e=this._gantt.getAllDateColsWidth();this.scroll.horizontalBarPos,this.scroll.horizontalBarPos=Math.ceil(t*(e-this._gantt.scenegraph.width)),tu(this.scroll.horizontalBarPos)&&!isNaN(this.scroll.horizontalBarPos)||(this.scroll.horizontalBarPos=0),this._gantt.scenegraph.setX(-this.scroll.horizontalBarPos,1===t),this._gantt.fireListeners(uu.SCROLL,{scrollTop:this.scroll.verticalBarPos,scrollLeft:this.scroll.horizontalBarPos,scrollDirection:"horizontal",scrollRatioY:t})}startMoveTaskBar(t,e,i,n){"task-bar-hover-shadow"===t.name&&(t=t.parent),this.moveTaskBar.moving=!0,this.moveTaskBar.target=t,this.moveTaskBar.targetStartX=t.attribute.x,this.moveTaskBar.targetStartY=t.attribute.y,this.moveTaskBar.startX=e,this.moveTaskBar.startY=i,this.moveTaskBar.startOffsetY=n,t.setAttribute("zIndex",1e4)}isMoveingTaskBar(){return this.moveTaskBar.moving}endMoveTaskBar(){this.moveTaskBar.moveTaskBarXInertia.isInertiaScrolling()&&this.moveTaskBar.moveTaskBarXInertia.endInertia();const t=this.moveTaskBar.deltaX,e=this.moveTaskBar.deltaY,i=this.moveTaskBar.target;if(Math.abs(t)>=1||Math.abs(e)>=1){const t=i.task_index,n=i.sub_task_index,{startDate:s,endDate:r}=this._gantt.getTaskInfoByTaskListIndex(t,n),a=this.moveTaskBar.targetStartY+this._gantt.parsedOptions.rowHeight*Math.round(e/this._gantt.parsedOptions.rowHeight),o=this._gantt.parsedOptions.taskBarMilestoneStyle.width,l=Nu(this.moveTaskBar.target.attribute.x+(i.record.type===cu.MILESTONE?o/2:0)-this._gantt.stateManager.scroll.horizontalBarPos,this._gantt),h=this._gantt.parsedOptions.reverseSortedTimelineScales[0].timelineDates[l];if(!h)return;const d=h.startDate,c=new Date(d.getTime()+(wu(r).getTime()-wu(s).getTime()));let u;if(wu(s).getTime()!==d.getTime()){u=wu(s).getTime()>d.getTime()?"left":"right",this._gantt._updateStartEndDateToTaskRecord(d,c,t,n);const e=this._gantt.getRecordByIndex(t,n);this._gantt.hasListeners(uu.CHANGE_DATE_RANGE)&&this._gantt.fireListeners(uu.CHANGE_DATE_RANGE,{startDate:e[this._gantt.parsedOptions.startDateField],endDate:e[this._gantt.parsedOptions.endDateField],oldStartDate:s,oldEndDate:r,index:t,record:e})}if(this._gantt.parsedOptions.tasksShowMode===du.Sub_Tasks_Arrange||this._gantt.parsedOptions.tasksShowMode===du.Sub_Tasks_Compact){const t=Xu(a,this._gantt);this._gantt._dragOrderTaskRecord(i.task_index,i.sub_task_index,t.task_index,t.sub_task_index),Vu(this._gantt.records),this._gantt.taskListTableInstance.renderWithRecreateCells(),this._gantt._syncPropsFromTable(),this._gantt.scenegraph.refreshTaskBarsAndGrid()}else if(this._gantt.parsedOptions.tasksShowMode!==du.Tasks_Separate&&Math.abs(Math.round(e/this._gantt.parsedOptions.rowHeight))>=1){const t=Xu(a,this._gantt);this._gantt._dragOrderTaskRecord(i.task_index,i.sub_task_index,t.task_index,t.sub_task_index),this._gantt.parsedOptions.tasksShowMode===du.Sub_Tasks_Separate?(this._gantt.taskListTableInstance.renderWithRecreateCells(),this._gantt.scenegraph.refreshTaskBarsAndGrid()):(this._gantt.scenegraph.taskBar.refresh(),this._gantt.scenegraph.dependencyLink.refresh())}else{let t=l>=1?this._gantt.getDateColsWidth(0,l-1):0;if(i.record.type===cu.MILESTONE&&(t-=this._gantt.parsedOptions.taskBarMilestoneStyle.width/2),Ap(i,t-i.attribute.x,a-i.attribute.y,this),"right"===u){let t=i;for(;t.nextSibling&&t.nextSibling.attribute.y===i.attribute.y&&t.nextSibling.record[this._gantt.parsedOptions.startDateField]<=i.record[this._gantt.parsedOptions.startDateField];)t=t.nextSibling;t!==i&&t.parent.insertAfter(i,t)}else if("left"===u){let t=i;for(;t.previousSibling&&t.previousSibling.attribute.y===i.attribute.y&&t.previousSibling.record[this._gantt.parsedOptions.startDateField]>=i.record[this._gantt.parsedOptions.startDateField];)t=t.previousSibling;t!==i&&t.parent.insertBefore(i,t)}}this._gantt.scenegraph.updateNextFrame()}this.moveTaskBar.moving=!1,this.selectedTaskBar.target!==i&&i.setAttribute("zIndex",0),i.updateTextPosition(),this.moveTaskBar.target=null,this.moveTaskBar.deltaX=0,this.moveTaskBar.deltaY=0,this.moveTaskBar.moveTaskBarXSpeed=0}dealTaskBarMove(t){var e,i,n,s,r,a;const o=this._gantt;let l=this.moveTaskBar.target;l.setAttribute("zIndex",1e4);const h=o.eventManager.lastDragPointerXYOnWindow.x,d=t.x-h,c=o.eventManager.lastDragPointerXYOnWindow.y,u=t.y-c;if(this.moveTaskBar.deltaX+=d,this.moveTaskBar.deltaY+=u,Ap(l,d,u,this),l.attribute.x<=o.stateManager.scrollLeft&&d<0)if(o.parsedOptions.moveTaskBarToExtendDateRange&&0===o.stateManager.scrollLeft){null===(e=this.moveTaskBar.moveTaskBarXInertia)||void 0===e||e.endInertia();const s=o.parsedOptions.reverseSortedTimelineScales[0].timelineDates[1].startDate.getTime()-o.parsedOptions.reverseSortedTimelineScales[0].timelineDates[0].startDate.getTime(),{unit:r,startOfWeek:a}=o.parsedOptions.reverseSortedTimelineScales[0];o.parsedOptions.minDate=Cu(new Date(o.parsedOptions.reverseSortedTimelineScales[0].timelineDates[0].startDate.getTime()-s/2),r,a),o.parsedOptions._minDateTime=null===(i=o.parsedOptions.minDate)||void 0===i?void 0:i.getTime(),o._generateTimeLineDateMap(),o._updateSize(),o.scenegraph.refreshAll(),l=this.moveTaskBar.target=o.scenegraph.taskBar.getTaskBarNodeByIndex(this.moveTaskBar.target.task_index,this.moveTaskBar.target.sub_task_index),o.scrollLeft=o.parsedOptions.timelineColWidth-1,o.eventManager.lastDragPointerXYOnWindow.x=t.x,"milestone"===(null===(n=l.record)||void 0===n?void 0:n.type)?Ap(l,o.scrollLeft-l.attribute.x,0,this):l.setAttribute("x",o.scrollLeft)}else this.moveTaskBar.moveTaskBarXSpeed=-o.parsedOptions.timelineColWidth/100,this.moveTaskBar.moveTaskBarXInertia.startInertia(this.moveTaskBar.moveTaskBarXSpeed,0,1),this.moveTaskBar.moveTaskBarXInertia.setScrollHandle(((t,e)=>{this.moveTaskBar.deltaX+=t,this.moveTaskBar.deltaY+=e,Ap(l,t,e,this),o.stateManager.setScrollLeft(l.attribute.x),0===o.stateManager.scrollLeft&&this.moveTaskBar.moveTaskBarXInertia.endInertia()}));else if(l.attribute.x+l.attribute.width>=o.stateManager.scrollLeft+o.tableNoFrameWidth&&d>0)if(o.parsedOptions.moveTaskBarToExtendDateRange&&o.stateManager.scrollLeft+o.tableNoFrameWidth===o.getAllDateColsWidth()){null===(s=this.moveTaskBar.moveTaskBarXInertia)||void 0===s||s.endInertia();const e=o.parsedOptions.reverseSortedTimelineScales[0].timelineDates,i=e[1].startDate.getTime()-e[0].startDate.getTime(),{unit:n,startOfWeek:h,step:d}=o.parsedOptions.reverseSortedTimelineScales[0];if(o.parsedOptions.maxDate=Au(o.parsedOptions.minDate,new Date(e[e.length-1].endDate.getTime()+i/2),n,d),o.parsedOptions._maxDateTime=null===(r=o.parsedOptions.maxDate)||void 0===r?void 0:r.getTime(),o._generateTimeLineDateMap(),o._updateSize(),o.scenegraph.refreshAll(),l=this.moveTaskBar.target=o.scenegraph.taskBar.getTaskBarNodeByIndex(this.moveTaskBar.target.task_index,this.moveTaskBar.target.sub_task_index),o.scrollLeft+=1,o.eventManager.lastDragPointerXYOnWindow.x=t.x,"milestone"===(null===(a=l.record)||void 0===a?void 0:a.type)){const t=o.scrollLeft+o.tableNoFrameWidth-l.attribute.width;Ap(l,t-l.attribute.x,0,this)}else l.setAttribute("x",o.scrollLeft+o.tableNoFrameWidth-l.attribute.width)}else this.moveTaskBar.moveTaskBarXSpeed=o.parsedOptions.timelineColWidth/100,this.moveTaskBar.moveTaskBarXInertia.startInertia(this.moveTaskBar.moveTaskBarXSpeed,0,1),this.moveTaskBar.moveTaskBarXInertia.setScrollHandle(((t,e)=>{this.moveTaskBar.deltaX+=t,this.moveTaskBar.deltaY+=e,Ap(l,t,e,this),o.stateManager.setScrollLeft(l.attribute.x+l.attribute.width-o.tableNoFrameWidth),o.stateManager.scrollLeft===o.getAllDateColsWidth()-o.tableNoFrameWidth&&this.moveTaskBar.moveTaskBarXInertia.endInertia()}));else this.moveTaskBar.moveTaskBarXInertia.isInertiaScrolling()?this.moveTaskBar.moveTaskBarXInertia.endInertia():this.moveTaskBar.moveTaskBarXSpeed=0;o.scenegraph.updateNextFrame()}startResizeTaskBar(t,e,i,n,s){this.resizeTaskBar.onIconName=s,this.resizeTaskBar.resizing=!0,this.resizeTaskBar.target=t,this.resizeTaskBar.targetStartX=t.attribute.x,this.resizeTaskBar.targetEndX=t.attribute.x+t.attribute.width,this.resizeTaskBar.startX=e,this.resizeTaskBar.startY=i,this.resizeTaskBar.startOffsetY=n}isResizingTaskBar(){return this.resizeTaskBar.resizing}endResizeTaskBar(t){const e=this._gantt.stateManager.resizeTaskBar.onIconName,i=t-this.resizeTaskBar.startX;if(Math.abs(i)>=1){const t=Nu(("left"===e?this.resizeTaskBar.target.attribute.x:this.resizeTaskBar.target.attribute.x+this.resizeTaskBar.target.attribute.width)-this._gantt.stateManager.scroll.horizontalBarPos,this._gantt),i=this._gantt.parsedOptions.reverseSortedTimelineScales[0].timelineDates[t];if(!i)return;const n="left"===e?i.startDate:i.endDate,s=this.resizeTaskBar.target,r=s.clipGroupBox,a=s.barRect,o=s.progressRect,l=s.textLabel,h=s.task_index,d=s.sub_task_index,{taskDays:c,progress:u,startDate:p,endDate:g}=this._gantt.getTaskInfoByTaskListIndex(h,d);let f=!1;if("left"===e?(this._gantt._updateStartDateToTaskRecord(n,h,d),n.getTime()!==new Date(p).getTime()&&(f=!0)):(this._gantt._updateEndDateToTaskRecord(n,h,d),n.getTime()!==new Date(g).getTime()&&(f=!0)),this._gantt.parsedOptions.tasksShowMode===du.Sub_Tasks_Arrange||this._gantt.parsedOptions.tasksShowMode===du.Sub_Tasks_Compact)this._gantt.taskListTableInstance.renderWithRecreateCells(),this._gantt._syncPropsFromTable(),this._gantt.scenegraph.refreshTaskBarsAndGrid();else{if("left"===e){const e=t>=1?this._gantt.getDateColsWidth(0,t-1):0;s.setAttribute("x",e),s.setAttribute("width",this.resizeTaskBar.targetEndX-e)}else if("right"===e){const e=this._gantt.getDateColsWidth(0,t);s.setAttribute("width",e-this.resizeTaskBar.targetStartX)}if(r.setAttribute("width",s.attribute.width),null==a||a.setAttribute("width",s.attribute.width),null==o||o.setAttribute("width",u/100*s.attribute.width),l){const{textAlign:t,textBaseline:e,padding:i}=this._gantt.parsedOptions.taskBarLabelStyle,n=Uu(xu(i),t,e,s.attribute.width,s.attribute.height);l.setAttribute("maxLineWidth",s.attribute.width-20),l.setAttribute("x",n.x)}this._gantt.scenegraph.refreshRecordLinkNodes(h,d,s,0),this.showTaskBarHover(),Bp(this._gantt,s,h,d),s.setAttribute("zIndex",0)}if(s.updateTextPosition(),this.resizeTaskBar.resizing=!1,this.resizeTaskBar.target=null,f&&this._gantt.hasListeners(uu.CHANGE_DATE_RANGE)){const t=this._gantt.getRecordByIndex(h,d);this._gantt.fireListeners(uu.CHANGE_DATE_RANGE,{startDate:t[this._gantt.parsedOptions.startDateField],endDate:t[this._gantt.parsedOptions.endDateField],oldStartDate:p,oldEndDate:g,index:h,record:t})}this._gantt.scenegraph.updateNextFrame()}}dealTaskBarResize(t){const e=this._gantt.eventManager.lastDragPointerXYOnWindow.x,i=t.x-e,n=this._gantt.stateManager.resizeTaskBar.target;let s="left"===this._gantt.stateManager.resizeTaskBar.onIconName?-i:i;const r=Math.max(1,n.attribute.width+s);s=r-n.attribute.width,function(t,e,i,n){const s=n._gantt.parsedOptions.progressField,r=t.clipGroupBox,a=t.barRect,o=t.progressRect,l=t.textLabel,h=t.task_index,d=t.sub_task_index,c=t.record,u=c[s],p=c.type===cu.MILESTONE;if(t.setAttribute("zIndex",1e4),e&&t.setAttribute("x",t.attribute.x+e),p&&t.setAttribute("anchor",[t.attribute.x+t.attribute.width/2,t.attribute.y+t.attribute.height/2]),i&&t.setAttribute("width",i),r.setAttribute("width",t.attribute.width),null==a||a.setAttribute("width",t.attribute.width),null==o||o.setAttribute("width",u/100*t.attribute.width),l){const{textAlign:e,textBaseline:s,padding:r}=n._gantt.parsedOptions.taskBarLabelStyle,a=Uu(xu(r),e,s,i,t.attribute.height);l.setAttribute("maxLineWidth",i-20),l.setAttribute("x",a.x)}t.updateTextPosition(),n.showTaskBarHover(),Bp(n._gantt,t,h,d),n._gantt.scenegraph.refreshRecordLinkNodes(h,d,t,0)}(n,"left"===this._gantt.stateManager.resizeTaskBar.onIconName?-s:0,r,this),this._gantt.scenegraph.updateNextFrame()}startCreateDependencyLine(t,e,i,n,s){this.resizeTaskBar.resizing=!1,this.creatingDenpendencyLink.creating=!0,this.creatingDenpendencyLink.startClickedPoint=t,this.creatingDenpendencyLink.startX=e,this.creatingDenpendencyLink.startY=i,this.creatingDenpendencyLink.startOffsetY=n,this.creatingDenpendencyLink.firstTaskBarPosition=s,this.highlightLinkPointNode(t)}isCreatingDependencyLine(){return this.creatingDenpendencyLink.creating}endCreateDependencyLine(t){const e=this._gantt.parsedOptions.taskKeyField,i=this.selectedTaskBar.target.task_index,n=this.selectedTaskBar.target.sub_task_index,s=this.creatingDenpendencyLink.secondTaskBarNode.task_index,r=this.creatingDenpendencyLink.secondTaskBarNode.sub_task_index,a={linkedFromTaskKey:this._gantt.getRecordByIndex(i,n)[e],linkedToTaskKey:this._gantt.getRecordByIndex(s,r)[e],type:"left"===this.creatingDenpendencyLink.firstTaskBarPosition&&"left"===this.creatingDenpendencyLink.secondTaskBarPosition?hu.StartToStart:"right"===this.creatingDenpendencyLink.firstTaskBarPosition&&"left"===this.creatingDenpendencyLink.secondTaskBarPosition?hu.FinishToStart:"right"===this.creatingDenpendencyLink.firstTaskBarPosition&&"right"===this.creatingDenpendencyLink.secondTaskBarPosition?hu.FinishToFinish:hu.StartToFinish};return this._gantt.addLink(a),this.hideTaskBarSelectedBorder(),this._gantt.scenegraph.updateNextFrame(),this.creatingDenpendencyLink.creating=!1,a}dealCreateDependencyLine(t){const e=this.creatingDenpendencyLink.startX,i=this.creatingDenpendencyLink.startY,n=t.x-e,s=t.y-i,r=this.creatingDenpendencyLink.startClickedPoint,a=r.attribute.x+r.attribute.width/2,o=r.attribute.y+r.attribute.height/2;this._gantt.scenegraph.taskBar.updateCreatingDependencyLine(a,o,a+n,o+s),this._gantt.scenegraph.updateNextFrame()}startResizeTableWidth(t){this.resizeTableWidth.resizing=!0,this.resizeTableWidth.lastX=t.pageX}isResizingTableWidth(){return this.resizeTableWidth.resizing}endResizeTableWidth(){this.resizeTableWidth.resizing=!1}dealResizeTableWidth(t){var e,i;if(!this.resizeTableWidth.resizing)return;const n=t.pageX-this.resizeTableWidth.lastX;if(Math.abs(n)>=1){let s=this._gantt.taskTableWidth+n;const r=Math.min(this._gantt.taskListTableInstance.getAllColsWidth()+this._gantt.parsedOptions.outerFrameStyle.borderLineWidth,null!==(e=this._gantt.options.taskListTable.maxTableWidth)&&void 0!==e?e:1e5),a=Math.max(this._gantt.parsedOptions.outerFrameStyle.borderLineWidth,null!==(i=this._gantt.options.taskListTable.minTableWidth)&&void 0!==i?i:0);n>0&&s>r&&(s=r),n<0&&s<a&&(s=a),this._gantt.taskTableWidth=s,this._gantt.element.style.left=this._gantt.taskTableWidth?`${this._gantt.taskTableWidth}px`:"0px",this._gantt.verticalSplitResizeLine.style.left=this._gantt.taskTableWidth?this._gantt.taskTableWidth-7+"px":"0px",this._gantt._resize(),this.resizeTableWidth.lastX=t.pageX}}showTaskBarHover(){const t=this._gantt.stateManager.hoverTaskBar.target;if(t){const e=t.attribute.x,i=t.attribute.y,n=t.attribute.width,s=t.attribute.height;this._gantt.scenegraph.taskBar.showHoverBar(e,i,n,s,t),this._gantt.scenegraph.updateNextFrame()}}hideTaskBarHover(t){this._gantt.stateManager.hoverTaskBar.target=null,this._gantt.scenegraph.taskBar.hideHoverBar(),this._gantt.scenegraph.updateNextFrame()}showTaskBarSelectedBorder(t){var e;null===(e=this._gantt.stateManager.selectedTaskBar.target)||void 0===e||e.setAttribute("zIndex",0),this._gantt.stateManager.selectedTaskBar.target=t;const i=this._gantt.parsedOptions.dependencyLinkCreatable;t.setAttribute("zIndex",1e4);const n=t.attribute.x,s=t.attribute.y,r=t.attribute.width,a=t.attribute.height;this._gantt.scenegraph.taskBar.createSelectedBorder(n,s,r,a,t,i),this._gantt.scenegraph.updateNextFrame()}hideTaskBarSelectedBorder(){var t;null===(t=this._gantt.stateManager.selectedTaskBar.target)||void 0===t||t.setAttribute("zIndex",0),this._gantt.stateManager.selectedTaskBar.target=null,this._gantt.scenegraph.taskBar.removeSelectedBorder(),this._gantt.scenegraph.updateNextFrame()}showSecondTaskBarSelectedBorder(){const t=this._gantt.stateManager.creatingDenpendencyLink.secondTaskBarNode,e=t.attribute.x,i=t.attribute.y,n=t.attribute.width,s=t.attribute.height;this._gantt.scenegraph.taskBar.createSelectedBorder(e,i,n,s,t,!0),this._gantt.scenegraph.updateNextFrame()}hideSecondTaskBarSelectedBorder(){this._gantt.stateManager.creatingDenpendencyLink.secondTaskBarNode=null,this._gantt.scenegraph.taskBar.removeSecondSelectedBorder(),this._gantt.scenegraph.updateNextFrame()}showDependencyLinkSelectedLine(){const t=this._gantt.stateManager.selectedDenpendencyLink.link;this._gantt.scenegraph.dependencyLink.createSelectedLinkLine(t);const{taskKeyField:e,dependencyLinks:i}=this._gantt.parsedOptions,{linkedToTaskKey:n,linkedFromTaskKey:s,type:r}=t;let a,o,l,h;const d=Gu(this._gantt.records,e,n),c=Gu(this._gantt.records,e,s);this._gantt.parsedOptions.tasksShowMode===du.Sub_Tasks_Inline||this._gantt.parsedOptions.tasksShowMode===du.Sub_Tasks_Separate||this._gantt.parsedOptions.tasksShowMode===du.Sub_Tasks_Arrange||this._gantt.parsedOptions.tasksShowMode===du.Sub_Tasks_Compact?(a=c.index[0],o=c.index[1],l=d.index[0],h=d.index[1]):(a=this._gantt.getTaskShowIndexByRecordIndex(c.index),l=this._gantt.getTaskShowIndexByRecordIndex(d.index));const u=this._gantt.scenegraph.taskBar.getTaskBarNodeByIndex(a,o);this._gantt.scenegraph.taskBar.createSelectedBorder(u.attribute.x,u.attribute.y,u.attribute.width,u.attribute.height,u,!1);const p=this._gantt.scenegraph.taskBar.getTaskBarNodeByIndex(l,h);this._gantt.scenegraph.taskBar.createSelectedBorder(p.attribute.x,p.attribute.y,p.attribute.width,p.attribute.height,p,!1),this._gantt.scenegraph.updateNextFrame()}hideDependencyLinkSelectedLine(){this._gantt.stateManager.selectedDenpendencyLink.link=null,this._gantt.scenegraph.dependencyLink.removeSelectedLinkLine(),this._gantt.scenegraph.taskBar.removeSelectedBorder(),this._gantt.scenegraph.updateNextFrame()}highlightLinkPointNode(t){if((null==t?void 0:t.children.length)>0){const e=t.children[0];e.setAttribute("fill",this._gantt.parsedOptions.dependencyLinkLineCreatingPointStyle.fillColor),e.setAttribute("stroke",this._gantt.parsedOptions.dependencyLinkLineCreatingPointStyle.strokeColor),e.setAttribute("radius",this._gantt.parsedOptions.dependencyLinkLineCreatingPointStyle.radius),e.setAttribute("lineWidth",this._gantt.parsedOptions.dependencyLinkLineCreatingPointStyle.strokeWidth),this._gantt.scenegraph.updateNextFrame()}}unhighlightLinkPointNode(t){if((null==t?void 0:t.children.length)>0){const e=t.children[0];e.setAttribute("fill",this._gantt.parsedOptions.dependencyLinkLineCreatePointStyle.fillColor),e.setAttribute("stroke",this._gantt.parsedOptions.dependencyLinkLineCreatePointStyle.strokeColor),e.setAttribute("radius",this._gantt.parsedOptions.dependencyLinkLineCreatePointStyle.radius),e.setAttribute("lineWidth",this._gantt.parsedOptions.dependencyLinkLineCreatePointStyle.strokeWidth),this._gantt.scenegraph.updateNextFrame()}}showMarklineIconHover(){var t,e;const i=this._gantt.stateManager.marklineIcon.target;if(i){const n=this._gantt.scenegraph.timelineHeader.showMarklineIcon(i.parent);n&&(null===(e=null===(t=this._gantt.parsedOptions.markLineCreateOptions)||void 0===t?void 0:t.markLineCreationHoverToolTip)||void 0===e?void 0:e.tipContent)&&this._gantt.scenegraph.showToolTip(n),this._gantt.scenegraph.updateNextFrame()}}hideMarklineIconHover(){this._gantt.scenegraph.timelineHeader.hideMarklineIconHover(this._gantt.stateManager.marklineIcon.target.parent),this._gantt.scenegraph.hideToolTip(),this._gantt.stateManager.marklineIcon.target=null,this._gantt.scenegraph.updateNextFrame()}updateProjectTaskTimes(t){var e,i;if(!t||0===t.length||!this._gantt||!this._gantt.records)return;const n=this._gantt.parsedOptions.startDateField,s=this._gantt.parsedOptions.endDateField,r=[...t];for(;r.length>0;){const t=[...r],i=t.pop();let a=this._gantt.records;for(const e of t){if(!a[e]||!a[e].children)return;a=a[e].children}const o=0===t.length?this._gantt.records[i]:a[i];if(o&&o.type===cu.PROJECT&&o.children&&o.children.length>0){let t=null,i=null;for(const e of o.children)if(e[n]&&e[s]){const r=new Date(e[n]),a=new Date(e[s]);(!t||r<t)&&(t=r),(!i||a>i)&&(i=a)}if(t&&i){const r=o[n]?new Date(o[n]):null,a=o[s]?new Date(o[s]):null;if(!r||!a||t.getTime()!==r.getTime()||i.getTime()!==a.getTime()){const r=null!==(e=this._gantt.parsedOptions.dateFormat)&&void 0!==e?e:this._gantt.parseTimeFormat(o[n]||o.children[0][n]),a=t=>this._gantt.formatDate?this._gantt.formatDate(t,r):t.toISOString().split("T")[0];o[n]=a(t),o[s]=a(i)}}}r.pop()}null===(i=this._gantt.scenegraph)||void 0===i||i.refreshAll()}}function Bp(t,e,i,n){const s=t.parsedOptions.taskBarCustomLayout;if(s){let r;if("function"==typeof s){const{startDate:a,endDate:o,taskDays:l,progress:h,taskRecord:d}=t.getTaskInfoByTaskListIndex(i,n);r=s({width:e.attribute.width,height:e.attribute.height,index:i,startDate:a,endDate:o,taskDays:l,progress:h,taskRecord:d,ganttInstance:t})}else r=s;if(r){const t=r.rootContainer;t.name="task-bar-custom-render";const i=e.children.find((t=>"task-bar-group"===t.name));if(i){const e=i.children.findIndex((t=>"task-bar-custom-render"===t.name)),n=i.children[e];n&&(i.removeChild(n),i.insertInto(t,e))}}}}function Ap(t,e,i,n){const s=t.task_index,r=t.sub_task_index,a=t.record.type===cu.MILESTONE,o=t.attribute.x,l=t.attribute.y;if(e&&t.setAttribute("x",Math.max(0,t.attribute.x+e)),n._gantt.parsedOptions.tasksShowMode!==du.Tasks_Separate&&n._gantt.parsedOptions.tasksShowMode!==du.Project_Sub_Tasks_Inline?i&&t.setAttribute("y",t.attribute.y+i):i=0,a&&(t.setAttribute("anchor",[t.attribute.x+t.attribute.width/2,t.attribute.y+t.attribute.height/2]),t.milestoneTextContainer)){const e=t.attribute.x-o,i=t.attribute.y-l,n=t.milestoneTextContainer.attribute.x,s=t.milestoneTextContainer.attribute.y;t.milestoneTextContainer.setAttribute("x",n+e),t.milestoneTextContainer.setAttribute("y",s+i)}t.updateTextPosition(),n._gantt.scenegraph.refreshRecordLinkNodes(s,r,t,i)}let Cp=1;class Lp{constructor(){this.listenersData={listeners:{},listenerData:{}}}on(t,e){const i=this.listenersData.listeners[t]||(this.listenersData.listeners[t]=[]);i.push(e);const n=Cp++;return this.listenersData.listenerData[n]={type:t,listener:e,remove:()=>{delete this.listenersData.listenerData[n];const s=i.indexOf(e);i.splice(s,1),this.listenersData.listeners[t].length||delete this.listenersData.listeners[t]}},n}off(t,e){var i;if(e){const i=t;this.removeEventListener(i,e)}else{const e=t;if(!this.listenersData)return;null===(i=this.listenersData.listenerData[e])||void 0===i||i.remove()}}addEventListener(t,e,i){this.on(t,e)}removeEventListener(t,e){if(this.listenersData)for(const i in this.listenersData.listenerData){const n=this.listenersData.listenerData[i];n.type===t&&n.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=>tu(t))):[]}release(){delete this.listenersData}}class Op{constructor(t){this._gantt=t,this.records=t.records,this.processRecords()}processRecords(){const t=!this._gantt.options.minDate,e=!this._gantt.options.maxDate;let i=Number.MAX_SAFE_INTEGER,n=Number.MIN_SAFE_INTEGER;if((t||e||this._gantt.parsedOptions.tasksShowMode===du.Sub_Tasks_Inline||this._gantt.parsedOptions.tasksShowMode===du.Sub_Tasks_Compact)&&this.records.length){for(let s=0;s<this.records.length;s++){const r=this.records[s];if(t&&r[this._gantt.parsedOptions.startDateField]){const t=wu(r[this._gantt.parsedOptions.startDateField]);i=Math.min(i,t.getTime())}if(e&&r[this._gantt.parsedOptions.endDateField]){const t=wu(r[this._gantt.parsedOptions.endDateField]);n=Math.max(n,t.getTime())}this._gantt.parsedOptions.tasksShowMode!==du.Sub_Tasks_Inline&&this._gantt.parsedOptions.tasksShowMode!==du.Sub_Tasks_Compact||r.children&&r.children.sort(((t,e)=>wu(t[this._gantt.parsedOptions.startDateField]).getTime()-wu(e[this._gantt.parsedOptions.startDateField]).getTime()))}const{unit:s,startOfWeek:r,step:a}=this._gantt.parsedOptions.reverseSortedTimelineScales[0];t&&(this._gantt.parsedOptions.minDate=Cu(new Date(i),s,r),this._gantt.parsedOptions._minDateTime=this._gantt.parsedOptions.minDate.getTime()),t&&!e&&(this._gantt.parsedOptions.maxDate=Au(this._gantt.parsedOptions.minDate,new Date(this._gantt.options.maxDate),s,a),this._gantt.parsedOptions._maxDateTime=this._gantt.parsedOptions.maxDate.getTime()),e&&(this._gantt.parsedOptions.maxDate=Au(this._gantt.parsedOptions.minDate,new Date(n),s,a),this._gantt.parsedOptions._maxDateTime=this._gantt.parsedOptions.maxDate.getTime())}}adjustOrder(t,e,i,n){var s,r,a,o;if(this._gantt.parsedOptions.tasksShowMode!==du.Sub_Tasks_Arrange&&this._gantt.parsedOptions.tasksShowMode!==du.Sub_Tasks_Compact||t!==i)if(this._gantt.parsedOptions.tasksShowMode===du.Sub_Tasks_Inline){if(tu(e)&&tu(n)&&tu(t)&&tu(i)){const s=this.records[t].children[e];this.records[t].children.splice(e,1),this.records[i].children||(this.records[i].children=[]),this.records[i].children.splice(n,0,s)}null===(r=null===(s=this.records[i])||void 0===s?void 0:s.children)||void 0===r||r.sort(((t,e)=>wu(t[this._gantt.parsedOptions.startDateField]).getTime()-wu(e[this._gantt.parsedOptions.startDateField]).getTime()))}else if(this._gantt.parsedOptions.tasksShowMode===du.Project_Sub_Tasks_Inline){if(tu(e)&&tu(n)&&tu(t)&&tu(i)){this.records[t].type,cu.PROJECT;const s=this.records[i].type===cu.PROJECT,r=this.records[t].children[e];this.records[t].children.splice(e,1),this.records[i].children||(this.records[i].children=[]),this.records[i].children.splice(n,0,r),s&&(null===(o=null===(a=this.records[i])||void 0===a?void 0:a.children)||void 0===o||o.sort(((t,e)=>wu(t[this._gantt.parsedOptions.startDateField]).getTime()-wu(e[this._gantt.parsedOptions.startDateField]).getTime())))}}else if(tu(e)&&tu(n)&&tu(t)&&tu(i)){const s=this.records[t].children[e];this.records[t].children.splice(e,1),this.records[i].children||(this.records[i].children=[]),this.records[i].children.splice(n,0,s)}}setRecords(t){this.records=t,this.processRecords()}}class Ep{constructor(t,e){var i;this.plugins=new Map,this.gantt=t,null===(i=e.plugins)||void 0===i||i.forEach((t=>{this.register(t),this._initializePluginRun(t)}))}_initializePluginRun(t){if(void 0===t.runTime)try{t.run(this.gantt)}catch(t){}else this._bindGanttEventForPlugin(t)}register(t){this.plugins.set(t.id,t)}registerAll(t){t.forEach((t=>this.register(t)))}getPlugin(t){return this.plugins.get(t)}getPluginByName(t){return Array.from(this.plugins.values()).find((e=>e.name===t))}_bindGanttEventForPlugin(t){var e=this;t.runTime&&t.runTime.forEach((i=>{this.gantt.on(i,(function(){var n;try{for(var s=arguments.length,r=new Array(s),a=0;a<s;a++)r[a]=arguments[a];null===(n=t.run)||void 0===n||n.call(t,...r,i,e.gantt)}catch(t){}}))}))}updatePlugins(t){Array.from(this.plugins.values()).filter((e=>!(null==t?void 0:t.some((t=>t.id===e.id))))).forEach((t=>{this.release(),this.plugins.delete(t.id)})),this.plugins.forEach((t=>{t.update&&t.update()}));const e=null==t?void 0:t.filter((t=>!this.plugins.has(t.id)));null==e||e.forEach((t=>{this.register(t),this._initializePluginRun(t)}))}release(){this.plugins.forEach((t=>{var e;try{null===(e=t.release)||void 0===e||e.call(t,this.gantt)}catch(t){}}))}}class Rp extends Lp{constructor(t,e){var i,n,s,r,a;super(),this.parsedOptions={},this.container=t,this.options=e,this.taskTableWidth="number"==typeof(null===(i=null==e?void 0:e.taskListTable)||void 0===i?void 0:i.tableWidth)?null===(n=null==e?void 0:e.taskListTable)||void 0===n?void 0:n.tableWidth:-1,this.taskTableColumns=null!==(r=null===(s=null==e?void 0:e.taskListTable)||void 0===s?void 0:s.columns)&&void 0!==r?r:[],this.records=null!==(a=null==e?void 0:e.records)&&void 0!==a?a:[],this._sortScales(),zu(this),function(t){if(!t.records||0===t.records.length)return;const e=t.parsedOptions.startDateField,i=t.parsedOptions.endDateField,n=(s,r,a)=>{let o=null,l=null;return s.forEach(((r,a)=>{var h;if(!r)return;let d=null,c=null;if(r.children&&r.children.length>0&&r.type===cu.PROJECT){const[o,l]=n(r.children);if(o&&l&&(d=o,c=l,r.type===cu.PROJECT)){const n=null!==(h=t.parsedOptions.dateFormat)&&void 0!==h?h:t.parseTimeFormat(r[e]||r.children[0][e]||""),o=e=>t.formatDate?t.formatDate(e,n):e.toISOString().split("T")[0],l=Object.assign({},r);l[e]=o(d),l[i]=o(c),s[a]=l}}else r[e]&&r[i]&&(d=new Date(r[e]),c=new Date(r[i]));d&&(!o||d<o)&&(o=d),c&&(!l||c>l)&&(l=c)})),[o,l]};n(t.records)}(this),this.data=new Op(this),this._generateTimeLineDateMap(),this.timeLineHeaderLevel=this.parsedOptions.sortedTimelineScales.length,this.element=function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"vtable-gantt";var i,n;const s=document.createElement("div");s.setAttribute("tabindex","0"),s.classList.add(e),s.style.outline="none",s.style.margin=`${t.top}px ${t.right}px ${t.bottom}px ${t.left}px`;const r=(s.offsetWidth||(null===(i=s.parentElement)||void 0===i?void 0:i.offsetWidth)||1)-1,a=(s.offsetHeight||(null===(n=s.parentElement)||void 0===n?void 0:n.offsetHeight)||1)-1;return s.style.width=r&&r-t.left-t.right+"px"||"0px",s.style.height=a&&a-t.top-t.bottom+"px"||"0px",s}({top:0,right:0,left:0,bottom:0},"vtable-gantt"),this.element.style.left=this.taskTableWidth?`${this.taskTableWidth}px`:"0px",this.canvas=document.createElement("canvas"),this.element.appendChild(this.canvas),this.context=this.canvas.getContext("2d"),t?(t.appendChild(this.element),this._updateSize()):this._updateSize(),this._generateListTable(),this._syncPropsFromTable(),function(t){if(t.taskListTableInstance){t.verticalSplitResizeLine=document.createElement("div"),t.verticalSplitResizeLine.style.position="absolute",t.verticalSplitResizeLine.style.top=t.tableY+"px",t.verticalSplitResizeLine.style.left=(t.taskTableWidth?t.taskTableWidth-7+t.parsedOptions.verticalSplitLine.lineWidth/2:0)+"px",t.verticalSplitResizeLine.style.width="14px",t.verticalSplitResizeLine.style.height=t.drawHeight+"px",t.verticalSplitResizeLine.style.backgroundColor="rgba(0,0,0,0)",t.verticalSplitResizeLine.style.zIndex="100",t.parsedOptions.verticalSplitLineMoveable&&(t.verticalSplitResizeLine.style.cursor="col-resize"),t.verticalSplitResizeLine.style.userSelect="none",t.verticalSplitResizeLine.style.opacity="1";const e=document.createElement("div");if(e.style.position="absolute",e.style.top="0px",e.style.left=(14-t.parsedOptions.verticalSplitLine.lineWidth)/2+"px",e.style.width=t.parsedOptions.verticalSplitLine.lineWidth+"px",e.style.height="100%",e.style.backgroundColor=t.parsedOptions.verticalSplitLine.lineColor,e.style.zIndex="100",e.style.userSelect="none",e.style.pointerEvents="none",e.style.transition="background-color 0.3s",t.verticalSplitResizeLine.appendChild(e),t.parsedOptions.verticalSplitLineHighlight){const e=document.createElement("div");e.style.position="absolute",e.style.top="0px",e.style.left=(14-t.parsedOptions.verticalSplitLineHighlight.lineWidth)/2+"px",e.style.width=t.parsedOptions.verticalSplitLineHighlight.lineWidth+"px",e.style.height="100%",e.style.backgroundColor=t.parsedOptions.verticalSplitLineHighlight.lineColor,e.style.zIndex="100",e.style.cursor="col-resize",e.style.userSelect="none",e.style.pointerEvents="none",e.style.opacity="0",e.style.transition="background-color 0.3s",t.verticalSplitResizeLine.appendChild(e)}t.container.appendChild(t.verticalSplitResizeLine)}}(this),this.scenegraph=new up(this),this.stateManager=new kp(this),this.eventManager=new wp(this),this.scenegraph.afterCreateSceneGraph(),this._scrollToMarkLine(),this.pluginManager=new Ep(this,e)}renderTaskBarsTable(){this.scenegraph.updateNextFrame()}_updateSize(){var t,e,i,n,s,r,a,o;let l=0,h=0;if("browser"===Eu.mode){const r=this.getElement();let a=0,o=0;if(r.parentElement){const t=r.parentElement.style||window.getComputedStyle(r.parentElement);a=r.parentElement.offsetWidth-parseInt(t.paddingLeft||"0px",10)-parseInt(t.paddingRight||"0px",10),o=r.parentElement.offsetHeight-parseInt(t.paddingTop||"0px",10)-parseInt(t.paddingBottom||"0px",20)}const d=(null!=a?a:1)-1-this.taskTableWidth,c=(null!=o?o:1)-1;r.style.width=d&&`${d}px`||"0px",r.style.height=c&&`${c}px`||"0px";const{canvas:u}=this;l=null!==(e=null===(t=u.parentElement)||void 0===t?void 0:t.offsetWidth)&&void 0!==e?e:1,h=null!==(n=null===(i=u.parentElement)||void 0===i?void 0:i.offsetHeight)&&void 0!==n?n:1,(null===(s=null==this?void 0:this.scenegraph)||void 0===s?void 0:s.stage)?this.scenegraph.stage.resize(l,h):(u.style.width="",u.style.height="",u.width=l,u.height=h,u.style.width=`${l}px`,u.style.height=`${h}px`)}else Eu.mode;const d=Math.floor(l-function(t){var e;return(null==t?void 0:t.hoverOn)||(null==t?void 0:t.verticalVisible)&&"none"===(null==t?void 0:t.verticalVisible)||!(null==t?void 0:t.verticalVisible)&&"none"===(null==t?void 0:t.visible)?0:null!==(e=null==t?void 0:t.width)&&void 0!==e?e:7}(this.parsedOptions.scrollStyle)),c=Math.floor(h-function(t){var e;return(null==t?void 0:t.hoverOn)||(null==t?void 0:t.horizontalVisible)&&"none"===(null==t?void 0:t.horizontalVisible)||!(null==t?void 0:t.horizontalVisible)&&"none"===(null==t?void 0:t.visible)?0:null!==(e=null==t?void 0:t.width)&&void 0!==e?e:7}(this.parsedOptions.scrollStyle));if(this.tableNoFrameWidth=l,this.tableNoFrameHeight=Math.floor(h),this.parsedOptions.outerFrameStyle){const t=null===(r=this.parsedOptions.outerFrameStyle)||void 0===r?void 0:r.borderLineWidth;this.tableX=this.taskTableColumns.length>=1||(null===(a=this.options)||void 0===a?void 0:a.rowSeriesNumber)?null!==(o=this.parsedOptions.verticalSplitLine.lineWidth)&&void 0!==o?o:0:t,this.tableY=t,this.tableNoFrameWidth=Math.min(d-t-this.tableX,this.getAllDateColsWidth()),this.tableNoFrameHeight=c-2*t}}_updateListTableSize(t){var e,i,n,s,r,a,o,l,h,d;if(t&&("auto"!==(null===(i=null===(e=this.options)||void 0===e?void 0:e.taskListTable)||void 0===i?void 0:i.tableWidth)&&-1!==this.taskTableWidth||(this.taskTableWidth=t.getAllColsWidth()+this.parsedOptions.outerFrameStyle.borderLineWidth,(null===(s=null===(n=this.options)||void 0===n?void 0:n.taskListTable)||void 0===s?void 0:s.maxTableWidth)&&(this.taskTableWidth=Math.min(null===(a=null===(r=this.options)||void 0===r?void 0:r.taskListTable)||void 0===a?void 0:a.maxTableWidth,this.taskTableWidth)),(null===(l=null===(o=this.options)||void 0===o?void 0:o.taskListTable)||void 0===l?void 0:l.minTableWidth)&&(this.taskTableWidth=Math.max(null===(d=null===(h=this.options)||void 0===h?void 0:h.taskListTable)||void 0===d?void 0:d.minTableWidth,this.taskTableWidth)),this.element.style.left=this.taskTableWidth?`${this.taskTableWidth}px`:"0px",t.setCanvasSize(this.taskTableWidth,this.tableNoFrameHeight+2*this.parsedOptions.outerFrameStyle.borderLineWidth),this._updateSize()),t.columnHeaderLevelCount>1))if(t.columnHeaderLevelCount===this.parsedOptions.timeLineHeaderRowHeights.length)for(let e=0;e<t.columnHeaderLevelCount;e++)t.setRowHeight(e,this.parsedOptions.timeLineHeaderRowHeights[e]);else{const e=this.getAllHeaderRowsHeight()/t.columnHeaderLevelCount;for(let i=0;i<t.columnHeaderLevelCount;i++)t.setRowHeight(i,e)}}_generateListTable(){var t;if(this.taskTableColumns.length>=1||(null===(t=this.options)||void 0===t?void 0:t.rowSeriesNumber)){const t=this._generateListTableOptions();this.taskListTableInstance=new e.ListTable(this.container,t),this._updateListTableSize(this.taskListTableInstance)}}_generateListTableOptions(){var t,i,n,s,r,a,o,l,h,d,c,u,p,g,f,v,m,b,y,x,_,w,T,S,k,B,A,C,L,O,E,R,M,P,D,I,F,N,H,z,W,U,j,G,Y,V,X,K,$,q,Z,J,Q,tt,et,it,nt,st,rt,at,ot,lt,ht,dt,ct,ut;const pt={},gt=["container","records","rowSeriesNumber","overscrollBehavior","pixelRatio","eventOptions"];for(const t in this.options)gt.indexOf(t)>=0&&(pt[t]=this.options[t]);for(const t in this.options.taskListTable){if(pt[t]=this.options.taskListTable[t],"columns"===t&&(pt[t][pt[t].length-1].disableColumnResize=!0,this.parsedOptions.tasksShowMode===du.Sub_Tasks_Inline||this.parsedOptions.tasksShowMode===du.Sub_Tasks_Separate||this.parsedOptions.tasksShowMode===du.Sub_Tasks_Arrange||this.parsedOptions.tasksShowMode===du.Sub_Tasks_Compact))for(let t=0;t<pt.columns.length;t++)pt.columns[t].tree&&(pt.columns[t].tree=!1);"hierarchyExpandLevel"!==t||this.parsedOptions.tasksShowMode!==du.Sub_Tasks_Inline&&this.parsedOptions.tasksShowMode!==du.Sub_Tasks_Separate&&this.parsedOptions.tasksShowMode!==du.Sub_Tasks_Arrange&&this.parsedOptions.tasksShowMode!==du.Sub_Tasks_Compact||delete pt[t]}if(null===(t=this.options.taskListTable)||void 0===t?void 0:t.theme)if(pt.theme=null===(i=this.options.taskListTable)||void 0===i?void 0:i.theme,pt.theme.bodyStyle&&!function(t,e){const i=Object.getOwnPropertyDescriptor(t,e);return!(!i||!i.set&&!0!==i.writable)}(pt.theme,"bodyStyle")){pt.theme=(null===(n=this.options.taskListTable)||void 0===n?void 0:n.theme).extends((null===(s=this.options.taskListTable)||void 0===s?void 0:s.theme).getExtendTheme());const t=pt.theme.getExtendTheme();pt.theme.clearBodyStyleCache(),(null===(r=pt.theme.headerStyle)||void 0===r?void 0:r.bgColor)||(t.headerStyle?t.headerStyle.bgColor||(t.headerStyle.bgColor=this.parsedOptions.timelineHeaderBackgroundColor):t.headerStyle={bgColor:this.parsedOptions.timelineHeaderBackgroundColor}),t.bodyStyle?t.bodyStyle.frameStyle={borderLineWidth:[null!==(o=null===(a=this.parsedOptions.horizontalSplitLine)||void 0===a?void 0:a.lineWidth)&&void 0!==o?o:0,0,0,0],borderColor:null===(l=this.parsedOptions.horizontalSplitLine)||void 0===l?void 0:l.lineColor}:t.bodyStyle={frameStyle:{borderLineWidth:[null!==(d=null===(h=this.parsedOptions.horizontalSplitLine)||void 0===h?void 0:h.lineWidth)&&void 0!==d?d:0,0,0,0],borderColor:null===(c=this.parsedOptions.horizontalSplitLine)||void 0===c?void 0:c.lineColor}},t.cellInnerBorder=!1,t.frameStyle=Object.assign({},this.parsedOptions.outerFrameStyle,{shadowBlur:0,cornerRadius:[null!==(p=null===(u=this.parsedOptions.outerFrameStyle)||void 0===u?void 0:u.cornerRadius)&&void 0!==p?p:0,0,0,null!==(f=null===(g=this.parsedOptions.outerFrameStyle)||void 0===g?void 0:g.cornerRadius)&&void 0!==f?f:0],borderLineWidth:[null!==(m=null===(v=this.parsedOptions.outerFrameStyle)||void 0===v?void 0:v.borderLineWidth)&&void 0!==m?m:0,0,null!==(y=null===(b=this.parsedOptions.outerFrameStyle)||void 0===b?void 0:b.borderLineWidth)&&void 0!==y?y:0,null!==(_=null===(x=this.parsedOptions.outerFrameStyle)||void 0===x?void 0:x.borderLineWidth)&&void 0!==_?_:0]}),t.scrollStyle=Object.assign({},null===(T=null===(w=this.options.taskListTable)||void 0===w?void 0:w.theme)||void 0===T?void 0:T.scrollStyle,this.parsedOptions.scrollStyle,{verticalVisible:"none"}),t.columnResize=Object.assign({labelColor:"rgba(0,0,0,0)",labelBackgroundFill:"rgba(0,0,0,0)"},null==t?void 0:t.columnResize),t.underlayBackgroundColor||(t.underlayBackgroundColor=this.parsedOptions.underlayBackgroundColor)}else pt.theme.headerStyle?pt.theme.headerStyle.bgColor||(pt.theme.headerStyle.bgColor=this.parsedOptions.timelineHeaderBackgroundColor):pt.theme.headerStyle={bgColor:this.parsedOptions.timelineHeaderBackgroundColor},pt.theme.headerStyle=Object.assign({},e.themes.DEFAULT.headerStyle,{bgColor:this.parsedOptions.timelineHeaderBackgroundColor},null===(k=null===(S=this.options.taskListTable)||void 0===S?void 0:S.theme)||void 0===k?void 0:k.headerStyle),pt.theme.bodyStyle=Object.assign({},e.themes.DEFAULT.bodyStyle,null===(A=null===(B=this.options.taskListTable)||void 0===B?void 0:B.theme)||void 0===A?void 0:A.bodyStyle,{frameStyle:{borderLineWidth:[null!==(L=null===(C=this.parsedOptions.horizontalSplitLine)||void 0===C?void 0:C.lineWidth)&&void 0!==L?L:0,0,0,0],borderColor:null===(O=this.parsedOptions.horizontalSplitLine)||void 0===O?void 0:O.lineColor}}),pt.theme.cellInnerBorder=!1,pt.theme.frameStyle=Object.assign({},this.parsedOptions.outerFrameStyle,{cornerRadius:[null!==(R=null===(E=this.parsedOptions.outerFrameStyle)||void 0===E?void 0:E.cornerRadius)&&void 0!==R?R:0,0,0,null!==(P=null===(M=this.parsedOptions.outerFrameStyle)||void 0===M?void 0:M.cornerRadius)&&void 0!==P?P:0],borderLineWidth:[null!==(I=null===(D=this.parsedOptions.outerFrameStyle)||void 0===D?void 0:D.borderLineWidth)&&void 0!==I?I:0,0,null!==(N=null===(F=this.parsedOptions.outerFrameStyle)||void 0===F?void 0:F.borderLineWidth)&&void 0!==N?N:0,null!==(z=null===(H=this.parsedOptions.outerFrameStyle)||void 0===H?void 0:H.borderLineWidth)&&void 0!==z?z:0]}),pt.theme.scrollStyle=Object.assign({},null===(U=null===(W=this.options.taskListTable)||void 0===W?void 0:W.theme)||void 0===U?void 0:U.scrollStyle,this.parsedOptions.scrollStyle,{verticalVisible:"none"}),pt.theme.columnResize=Object.assign({labelColor:"rgba(0,0,0,0)",labelBackgroundFill:"rgba(0,0,0,0)"},null===(G=null===(j=this.options.taskListTable)||void 0===j?void 0:j.theme)||void 0===G?void 0:G.columnResize),pt.theme.underlayBackgroundColor||(pt.theme.underlayBackgroundColor=this.parsedOptions.underlayBackgroundColor);else pt.theme={scrollStyle:Object.assign({},null===(V=null===(Y=this.options.taskListTable)||void 0===Y?void 0:Y.theme)||void 0===V?void 0:V.scrollStyle,this.parsedOptions.scrollStyle,{verticalVisible:"none"}),headerStyle:Object.assign({},e.themes.DEFAULT.headerStyle,{bgColor:this.parsedOptions.timelineHeaderBackgroundColor},null===(K=null===(X=this.options.taskListTable)||void 0===X?void 0:X.theme)||void 0===K?void 0:K.headerStyle),bodyStyle:Object.assign({},e.themes.DEFAULT.bodyStyle,null===(q=null===($=this.options.taskListTable)||void 0===$?void 0:$.theme)||void 0===q?void 0:q.bodyStyle,{frameStyle:{borderLineWidth:[null!==(J=null===(Z=this.parsedOptions.horizontalSplitLine)||void 0===Z?void 0:Z.lineWidth)&&void 0!==J?J:0,0,0,0],borderColor:null===(Q=this.parsedOptions.horizontalSplitLine)||void 0===Q?void 0:Q.lineColor}}),cellInnerBorder:!1,frameStyle:Object.assign({},this.parsedOptions.outerFrameStyle,{cornerRadius:[null!==(et=null===(tt=this.parsedOptions.outerFrameStyle)||void 0===tt?void 0:tt.cornerRadius)&&void 0!==et?et:0,0,0,null!==(nt=null===(it=this.parsedOptions.outerFrameStyle)||void 0===it?void 0:it.cornerRadius)&&void 0!==nt?nt:0],borderLineWidth:[null!==(rt=null===(st=this.parsedOptions.outerFrameStyle)||void 0===st?void 0:st.borderLineWidth)&&void 0!==rt?rt:0,0,null!==(ot=null===(at=this.parsedOptions.outerFrameStyle)||void 0===at?void 0:at.borderLineWidth)&&void 0!==ot?ot:0,null!==(ht=null===(lt=this.parsedOptions.outerFrameStyle)||void 0===lt?void 0:lt.borderLineWidth)&&void 0!==ht?ht:0]}),columnResize:Object.assign({labelColor:"rgba(0,0,0,0)",labelBackgroundFill:"rgba(0,0,0,0)"},null===(ct=null===(dt=this.options.taskListTable)||void 0===dt?void 0:dt.theme)||void 0===ct?void 0:ct.columnResize),underlayBackgroundColor:this.parsedOptions.underlayBackgroundColor};return pt.canvasWidth=this.taskTableWidth,pt.canvasHeight=this.canvas.height,pt.defaultHeaderRowHeight=this.getAllHeaderRowsHeight(),this.parsedOptions.tasksShowMode===du.Sub_Tasks_Separate?(pt.customComputeRowHeight=t=>{var e;const{row:i,table:n}=t,s=n.getRecordByRowCol(0,i);if(s)return((null===(e=s.children)||void 0===e?void 0:e.length)||1)*this.parsedOptions.rowHeight},pt.defaultRowHeight="auto"):this.parsedOptions.tasksShowMode===du.Sub_Tasks_Compact?(pt.customComputeRowHeight=t=>{const{row:e,table:i}=t,n=i.getRecordByRowCol(0,e);if(n)return function(t,e){var i;if(!e.children||1===e.children.length)return 1===(null===(i=e.children)||void 0===i?void 0:i.length)?e.children[0].vtable_gantt_showIndex=0:e.vtable_gantt_showIndex=0,1;const n=e.children.slice().sort(((e,i)=>{const{startDate:n}=$u(t,e),{startDate:s}=$u(t,i);return n.getTime()-s.getTime()})),s=[];for(let e=0;e<=n.length-1;e++){const i=n[e],{startDate:r,endDate:a}=$u(t,i);let o=!1;for(let t=0;t<s.length;t++)if(r.getTime()>s[t]){s[t]=a.getTime(),o=!0,i.vtable_gantt_showIndex=t;break}o||(s.push(a.getTime()),i.vtable_gantt_showIndex=s.length-1)}return s.length}(this,n)*this.parsedOptions.rowHeight},pt.defaultRowHeight="auto"):this.parsedOptions.tasksShowMode===du.Sub_Tasks_Arrange?(pt.customComputeRowHeight=t=>{const{row:e,table:i}=t,n=i.getRecordByRowCol(0,e);if(n)return function(t,e){var i;if(!e.children||1===e.children.length)return 1===(null===(i=e.children)||void 0===i?void 0:i.length)?e.children[0].vtable_gantt_showIndex=0:e.vtable_gantt_showIndex=0,1;const n=[];for(let i=0;i<=e.children.length-1;i++){const s=e.children[i],{startDate:r,endDate:a}=$u(t,s);let o=!1;for(let i=0;i<n.length;i++)if(!Ku(r,a,e.children.filter((t=>t!==s&&t.vtable_gantt_showIndex===i)),t)){n[i]=a.getTime(),o=!0,s.vtable_gantt_showIndex=i;break}o||(n.push(a.getTime()),s.vtable_gantt_showIndex=n.length-1)}return n.length}(this,n)*this.parsedOptions.rowHeight},pt.defaultRowHeight="auto"):pt.defaultRowHeight=null!==(ut=this.options.rowHeight)&&void 0!==ut?ut:40,pt.clearDOM=!1,pt}getElement(){return this.element}getContainer(){return this.element.parentElement}_sortScales(){const{timelineHeader:t}=this.options;if(t){const e=t.scales,i=["year","quarter","month","week","day","hour","minute","second"];1===e.length&&("hour"!==e[0].unit&&"minute"!==e[0].unit&&"second"!==e[0].unit||(this.parsedOptions.timeScaleIncludeHour=!0));const n=e.slice().sort(((t,e)=>{"hour"!==t.unit&&"minute"!==t.unit&&"second"!==t.unit||(this.parsedOptions.timeScaleIncludeHour=!0);const n=i.indexOf(t.unit),s=i.indexOf(e.unit);return-1===n?1:-1===s?-1:n-s})),s=e.slice().sort(((t,e)=>{const n=i.indexOf(t.unit),s=i.indexOf(e.unit);return-1===n?1:-1===s?-1:s-n}));this.parsedOptions.sortedTimelineScales=n,this.parsedOptions.reverseSortedTimelineScales=s}}_generateTimeLineDateMap(){if(this.parsedOptions.minDate&&this.parsedOptions.maxDate)for(const t of this.parsedOptions.reverseSortedTimelineScales)t.timelineDates=Wu(new Date(this.parsedOptions.minDate),this.parsedOptions.maxDate,t)}getRowHeightByIndex(t){return this.taskListTableInstance?this.taskListTableInstance.getRowHeight(t+this.taskListTableInstance.columnHeaderLevelCount):this.parsedOptions.rowHeight}getRowsHeightByIndex(t,e){return this.taskListTableInstance?this.taskListTableInstance.getRowsHeight(t+this.taskListTableInstance.columnHeaderLevelCount,e+this.taskListTableInstance.columnHeaderLevelCount):this.parsedOptions.rowHeight*(e-t+1)}getAllRowsHeight(){return this.taskListTableInstance?this.taskListTableInstance.getAllRowsHeight():this.getAllHeaderRowsHeight()+this.itemCount*this.parsedOptions.rowHeight}getAllHeaderRowsHeight(){return this.parsedOptions.timeLineHeaderRowHeights.reduce(((t,e,i)=>!1===this.parsedOptions.sortedTimelineScales[i].visible?t:t+e),0)}getAllDateColsWidth(){var t,e;return this.parsedOptions.timelineColWidth*(null!==(e=null===(t=this.parsedOptions.reverseSortedTimelineScales[0].timelineDates)||void 0===t?void 0:t.length)&&void 0!==e?e:0)}getAllTaskBarsHeight(){return this.taskListTableInstance?this.taskListTableInstance.getRowsHeight(this.taskListTableInstance.columnHeaderLevelCount,this.taskListTableInstance.rowCount-1):this.itemCount*this.parsedOptions.rowHeight}getRecordIndexByTaskShowIndex(t){return this.taskListTableInstance?this.taskListTableInstance.getRecordIndexByCell(0,this.taskListTableInstance.columnHeaderLevelCount+t):t}getTaskShowIndexByRecordIndex(t){return this.taskListTableInstance.getBodyRowIndexByRecordIndex(t)}getRecordByIndex(t,e){var i,n;if(this.taskListTableInstance){if(tu(e)){const s=this.taskListTableInstance.getRecordByCell(0,t+this.taskListTableInstance.columnHeaderLevelCount);if(Array.isArray(e)){const n=this.getRecordIndexByTaskShowIndex(t),r=Array.isArray(n)?n.length:1,a=[...e];a.splice(0,r);let o=s;for(;a.length>0;){const t=a.shift();o=null===(i=null==o?void 0:o.children)||void 0===i?void 0:i[t]}return o}return null===(n=null==s?void 0:s.children)||void 0===n?void 0:n[e]}return this.taskListTableInstance.getRecordByCell(0,t+this.taskListTableInstance.columnHeaderLevelCount)}return this.records[t]}_refreshTaskBar(t,e){this.scenegraph.taskBar.updateTaskBarNode(t,e),this.scenegraph.refreshRecordLinkNodes(t,void 0,this.scenegraph.taskBar.getTaskBarNodeByIndex(t,e)),this.scenegraph.updateNextFrame()}_updateRecordToListTable(t,e){this.taskListTableInstance.updateRecords([t],[e])}getTaskInfoByTaskListIndex(t,e){const i=this.getRecordByIndex(t,e),n=null==i?void 0:i.type,s=this.parsedOptions.startDateField,r=this.parsedOptions.endDateField,a=this.parsedOptions.progressField,o=wu(null==i?void 0:i[s]).getTime(),l=wu(null==i?void 0:i[r]).getTime();if(n&&!(null==i?void 0:i[s])||!n&&(l<this.parsedOptions._minDateTime||o>this.parsedOptions._maxDateTime||!(null==i?void 0:i[s])||!(null==i?void 0:i[r])))return{taskDays:0,progress:0,startDate:null,endDate:null,taskRecord:i};const h=function(t){return"string"==typeof t&&(t=t.replace("%",""),t=parseFloat(t)),Math.round(t)}(i[a]);let d,c;return this.parsedOptions.timeScaleIncludeHour?(d=wu(Math.min(Math.max(this.parsedOptions._minDateTime,o),this.parsedOptions._maxDateTime)),c=ku(Math.max(Math.min(this.parsedOptions._maxDateTime,l),this.parsedOptions._minDateTime),!0)):(d=wu(Math.min(Math.max(this.parsedOptions._minDateTime,o),this.parsedOptions._maxDateTime),!0),c=Bu(Math.max(Math.min(this.parsedOptions._maxDateTime,l),this.parsedOptions._minDateTime),!0)),{taskRecord:i,taskDays:(c.getTime()-d.getTime()+1)/864e5,startDate:d,endDate:c,progress:h}}_updateStartDateToTaskRecord(t,e,i){var n;const s=this.getRecordByIndex(e,i),r=this.parsedOptions.startDateField,a=gu(t,null!==(n=this.parsedOptions.dateFormat)&&void 0!==n?n:bu(s[r]));if(s[r]=a,tu(i))Array.isArray(i)&&this.stateManager.updateProjectTaskTimes(i);else{const t=this.getRecordIndexByTaskShowIndex(e);this._updateRecordToListTable(s,t),Array.isArray(t)&&this.stateManager.updateProjectTaskTimes(t)}}_updateEndDateToTaskRecord(t,e,i){var n;const s=this.getRecordByIndex(e,i),r=this.parsedOptions.endDateField,a=gu(t,null!==(n=this.parsedOptions.dateFormat)&&void 0!==n?n:bu(s[r]));if(s[r]=a,tu(i))Array.isArray(i)&&this.stateManager.updateProjectTaskTimes(i);else{const t=this.getRecordIndexByTaskShowIndex(e);this._updateRecordToListTable(s,t),Array.isArray(t)&&this.stateManager.updateProjectTaskTimes(t)}}_updateStartEndDateToTaskRecord(t,e,i,n){var s;const r=this.getRecordByIndex(i,n),a=this.parsedOptions.startDateField,o=this.parsedOptions.endDateField,l=null!==(s=this.parsedOptions.dateFormat)&&void 0!==s?s:bu(r[a]),h=gu(t,l);r[a]=h;const d=gu(e,l);if(r[o]=d,tu(n))Array.isArray(n)&&this.stateManager.updateProjectTaskTimes(n);else{const t=this.getRecordIndexByTaskShowIndex(i);this._updateRecordToListTable(r,t),Array.isArray(t)&&this.stateManager.updateProjectTaskTimes(t)}}_dragOrderTaskRecord(t,e,i,n){this.data.adjustOrder(t,e,i,n)}updateTaskRecord(t,e,i){if(tu(i)){const n="number"==typeof e?e:e[0];return this._updateRecordToListTable(t,[n,i]),void this._refreshTaskBar(n,i)}if(Array.isArray(e)){const i=e[0],n=e[1];return this._updateRecordToListTable(t,e),void this._refreshTaskBar(i,n)}let n=e;"tree"===this.taskListTableInstance.rowHierarchyType&&(n=this.taskListTableInstance.getRecordIndexByCell(0,e+this.taskListTableInstance.columnHeaderLevelCount)),this._updateRecordToListTable(t,n),this._refreshTaskBar(e,void 0)}setPixelRatio(t){var e;null===(e=this.taskListTableInstance)||void 0===e||e.setPixelRatio(t),this.parsedOptions.pixelRatio=t,this.scenegraph.setPixelRatio(t)}updateTasksShowMode(t){this.options.tasksShowMode=t,this.updateOption(this.options)}_resize(){var t;this._updateSize(),null===(t=this.taskListTableInstance)||void 0===t||t.setCanvasSize(this.taskTableWidth,this.tableNoFrameHeight+2*this.parsedOptions.outerFrameStyle.borderLineWidth),this._syncPropsFromTable(),this.scenegraph.resize(),ju(this)}_syncPropsFromTable(){this.itemCount=this.taskListTableInstance?this.taskListTableInstance.rowCount-this.taskListTableInstance.columnHeaderLevelCount:this.records.length,this.headerHeight=this.getAllHeaderRowsHeight(),this.drawHeight=Math.min(this.getAllRowsHeight(),this.tableNoFrameHeight),this.gridHeight=this.drawHeight-this.headerHeight}getContext(){return this.context}release(){var t,e;null===(t=super.release)||void 0===t||t.call(this),this.eventManager.release(),null===(e=this.taskListTableInstance)||void 0===e||e.release();const{parentElement:i}=this.element;i&&(i.removeChild(this.element),this.verticalSplitResizeLine&&i.removeChild(this.verticalSplitResizeLine),this.horizontalSplitLine&&i.removeChild(this.horizontalSplitLine)),this.scenegraph=null,this.pluginManager.release()}updateOption(t){var e,i,n,s,r;if(this.parsedOptions={},this.options=t,this.taskTableWidth="number"==typeof(null===(e=null==t?void 0:t.taskListTable)||void 0===e?void 0:e.tableWidth)?null===(i=null==t?void 0:t.taskListTable)||void 0===i?void 0:i.tableWidth:-1,this.taskTableColumns=null!==(s=null===(n=null==t?void 0:t.taskListTable)||void 0===n?void 0:n.columns)&&void 0!==s?s:[],this.records=null!==(r=null==t?void 0:t.records)&&void 0!==r?r:[],this._sortScales(),zu(this),this.data.setRecords(this.records),this._generateTimeLineDateMap(),this.timeLineHeaderLevel=this.parsedOptions.sortedTimelineScales.length,this._updateSize(),this.taskListTableInstance){const t=this._generateListTableOptions();this.taskListTableInstance.updateOption(t),this._updateListTableSize(this.taskListTableInstance)}this._syncPropsFromTable(),this.scenegraph.updateStageBackground(),this.element.style.left=this.taskTableWidth?`${this.taskTableWidth}px`:"0px",ju(this),this.scenegraph.updateSceneGraph(),this.scenegraph.afterCreateSceneGraph(),this._scrollToMarkLine()}setRecords(t){this.records=t,this.data.setRecords(t),function(t){var e,i,n,s,r,a,o;const l=t.options,{unit:h,startOfWeek:d}=t.parsedOptions.reverseSortedTimelineScales[0];t.parsedOptions.markLine=Hu(null==l?void 0:l.markLine),null!==(i=null===(e=t.parsedOptions.markLine)||void 0===e?void 0:e.length)&&void 0!==i&&i&&((null===(n=t.parsedOptions.markLine)||void 0===n?void 0:n.every((t=>void 0===t.scrollToMarkLine)))&&(t.parsedOptions.markLine[0].scrollToMarkLine=!0),(null===(s=t.parsedOptions.markLine)||void 0===s?void 0:s.find((t=>t.scrollToMarkLine)))&&(t.parsedOptions.scrollToMarkLineDate=Cu(new Date(null===(r=t.parsedOptions.markLine)||void 0===r?void 0:r.find((t=>t.scrollToMarkLine)).date),h,d))),t.parsedOptions.dependencyLinks=null!==(o=null===(a=l.dependency)||void 0===a?void 0:a.links)&&void 0!==o?o:[]}(this),this.taskListTableInstance.setRecords(t),this._syncPropsFromTable(),this._generateTimeLineDateMap(),this.timeLineHeaderLevel=this.parsedOptions.sortedTimelineScales.length,this._updateSize(),this.scenegraph.refreshAll(),this.verticalSplitResizeLine.style.height=this.drawHeight+"px";const e=this.stateManager.scroll.horizontalBarPos,i=this.stateManager.scroll.verticalBarPos;this.scenegraph.setX(-e),this.scenegraph.setY(-i)}updateScales(t){const e=this.parsedOptions.sortedTimelineScales.length;if(this.options.timelineHeader.scales=t,this._sortScales(),function(t){var e,i,n,s;const r=t.options,{unit:a,startOfWeek:o,step:l}=t.parsedOptions.reverseSortedTimelineScales[0];t.parsedOptions.minDate=Cu(new Date(t.parsedOptions.minDate),a,o),t.parsedOptions.maxDate=Au(t.parsedOptions.minDate,new Date(t.parsedOptions.maxDate),a,l),t.parsedOptions._minDateTime=null===(e=t.parsedOptions.minDate)||void 0===e?void 0:e.getTime(),t.parsedOptions._maxDateTime=null===(i=t.parsedOptions.maxDate)||void 0===i?void 0:i.getTime(),t.parsedOptions.timeLineHeaderRowHeights=[],t.parsedOptions.timelineHeaderStyles=[];for(let e=0;e<t.parsedOptions.sortedTimelineScales.length;e++){const i=t.parsedOptions.sortedTimelineScales[e].style;t.parsedOptions.timelineHeaderStyles.push(Object.assign({fontSize:20,fontWeight:"bold",textAlign:"center",textBaseline:"middle",color:"#000",backgroundColor:"#fff"},i)),t.parsedOptions.timeLineHeaderRowHeights.push(null!==(s=null!==(n=t.parsedOptions.sortedTimelineScales[e].rowHeight)&&void 0!==n?n:null==r?void 0:r.headerRowHeight)&&void 0!==s?s:40)}}(this),this._generateTimeLineDateMap(),this.timeLineHeaderLevel=this.parsedOptions.sortedTimelineScales.length,this.scenegraph.refreshAll(),ju(this),this.taskListTableInstance)if(this.taskListTableInstance.columnHeaderLevelCount===this.parsedOptions.timeLineHeaderRowHeights.length)for(let t=0;t<this.taskListTableInstance.columnHeaderLevelCount;t++)this.taskListTableInstance.setRowHeight(t,this.parsedOptions.timeLineHeaderRowHeights[t]);else{const t=this.getAllHeaderRowsHeight()/this.taskListTableInstance.columnHeaderLevelCount;for(let e=0;e<this.taskListTableInstance.columnHeaderLevelCount;e++)this.taskListTableInstance.setRowHeight(e,t)}e!==t.length&&this._resize()}updateDateRange(t,e){this.options.minDate=t,this.options.maxDate=e,function(t){var e,i;const n=t.options,{unit:s,startOfWeek:r,step:a}=t.parsedOptions.reverseSortedTimelineScales[0];t.parsedOptions.minDate=(null==n?void 0:n.minDate)?Cu(new Date(n.minDate),s,r):void 0,t.parsedOptions.maxDate=(null==n?void 0:n.maxDate)?Au(t.parsedOptions.minDate,new Date(n.maxDate),s,a):void 0,t.parsedOptions._minDateTime=null===(e=t.parsedOptions.minDate)||void 0===e?void 0:e.getTime(),t.parsedOptions._maxDateTime=null===(i=t.parsedOptions.maxDate)||void 0===i?void 0:i.getTime()}(this),this._generateTimeLineDateMap(),this._updateSize(),this.scenegraph.refreshAll(),this._scrollToMarkLine()}updateMarkLine(t){this.options.markLine=t,qu(this),this.scenegraph.markLine.refresh(),this.scenegraph.renderSceneGraph()}addMarkLine(t){this.options.markLine=[...this.parsedOptions.markLine,t],qu(this),this.scenegraph.markLine.refresh(),this.scenegraph.renderSceneGraph(),this.scenegraph.updateNextFrame()}updateCurrentMarkLine(t){const e=this.parsedOptions.markLine.findIndex((e=>e.date===t.date));-1!==e&&(this.options.markLine=[...this.parsedOptions.markLine.slice(0,e),Object.assign(Object.assign({},this.options.markLine[e]),t),...this.parsedOptions.markLine.slice(e+1)],qu(this),this.scenegraph.markLine.refresh(),this.scenegraph.renderSceneGraph(),this.scenegraph.updateNextFrame())}_scrollToMarkLine(){if(this.parsedOptions.scrollToMarkLineDate&&this.parsedOptions.minDate){const t=this.parsedOptions.minDate,{unit:e,step:i}=this.parsedOptions.reverseSortedTimelineScales[0],n=Lu(this.parsedOptions.scrollToMarkLineDate,t,e,i)*this.parsedOptions.timelineColWidth-this.tableNoFrameWidth/2;this.stateManager.setScrollLeft(n)}}scrollToMarkLine(t){if(!t||!this.parsedOptions.minDate)return;const e=this.parsedOptions.minDate,{unit:i,step:n}=this.parsedOptions.reverseSortedTimelineScales[0],s=Lu(t,e,i,n)*this.parsedOptions.timelineColWidth-this.tableNoFrameWidth/2;this.stateManager.setScrollLeft(s)}addLink(t){this.parsedOptions.dependencyLinks.push(t),this.scenegraph.dependencyLink.initLinkLine(this.parsedOptions.dependencyLinks.length-1),this.scenegraph.updateNextFrame()}deleteLink(t){if(this.parsedOptions.dependencyLinkDeletable){const e=this.parsedOptions.dependencyLinks.findIndex((e=>e.type===t.type&&e.linkedFromTaskKey===t.linkedFromTaskKey&&e.linkedToTaskKey===t.linkedToTaskKey));if(-1!==e){const t=this.parsedOptions.dependencyLinks[e];this.parsedOptions.dependencyLinks.splice(e,1),this.scenegraph.dependencyLink.deleteLink(t),this.scenegraph.updateNextFrame()}}}get scrollTop(){return this.stateManager.scrollTop}set scrollTop(t){this.stateManager.setScrollTop(t)}get scrollLeft(){return this.stateManager.scrollLeft}set scrollLeft(t){this.stateManager.setScrollLeft(t)}getTaskBarRelativeRect(t){const e=this.scenegraph.taskBar.getTaskBarNodeByIndex(t);return{left:e.attribute.x+this.taskListTableInstance.tableNoFrameWidth+this.taskListTableInstance.tableX+this.tableX-this.scrollLeft,top:e.attribute.y+this.tableY+this.headerHeight-this.scrollTop,width:e.attribute.width,height:e.attribute.height}}getDateColWidth(t){return this.parsedOptions.timelineColWidth}getDateColsWidth(t,e){return(e-t+1)*this.parsedOptions.timelineColWidth}getDateRangeByIndex(t){const e=this.parsedOptions.reverseSortedTimelineScales[0];return t<e.timelineDates.length?{startDate:e.timelineDates[t].startDate,endDate:e.timelineDates[t].endDate}:null}parseTimeFormat(t){return bu(t)}getTaskBarStyle(t,e){const{startDate:i,endDate:n,taskRecord:s}=this.getTaskInfoByTaskListIndex(t,e);let r;return r=s.type===cu.PROJECT?this.parsedOptions.projectBarStyle:this.parsedOptions.taskBarStyle,"function"==typeof r?r({index:t,startDate:i,endDate:n,taskRecord:s,ganttInstance:this}):r}formatDate(t,e){return gu(t,e)}}t.AddRowColumnPlugin=class{id=`add-row-column-${Date.now()}`;name="Add Row Column";runTime=[n.TABLE_EVENT_TYPE.MOUSEENTER_CELL,n.TABLE_EVENT_TYPE.MOUSELEAVE_CELL,n.TABLE_EVENT_TYPE.MOUSELEAVE_TABLE];pluginOptions;table;hoverCell;hideAllTimeoutId_addColumn;hideAllTimeoutId_addRow;leftDotForAddColumn;rightDotForAddColumn;addIconForAddColumn;addLineForAddColumn;topDotForAddRow;bottomDotForAddRow;addIconForAddRow;addLineForAddRow;constructor(t={addColumnEnable:!0,addRowEnable:!0}){this.id=t.id??this.id,this.pluginOptions=t,this.pluginOptions.addColumnEnable=this.pluginOptions.addColumnEnable??!0,this.pluginOptions.addRowEnable=this.pluginOptions.addRowEnable??!0,this.pluginOptions.addColumnEnable&&(this.initAddColumnDomElement(),this.bindEventForAddColumn()),this.pluginOptions.addRowEnable&&(this.initAddRowDomElement(),this.bindEventForAddRow())}run(...t){const e=t[0],i=t[1],s=t[2];if(this.table=s,i===n.TABLE_EVENT_TYPE.MOUSEENTER_CELL){clearTimeout(this.hideAllTimeoutId_addColumn),clearTimeout(this.hideAllTimeoutId_addRow);const t=s.canvas.getBoundingClientRect(),i=s.getCellAtRelativePosition(e.event.clientX-t.left,e.event.clientY-t.top);this.hoverCell=i;const n=s.getCellRelativeRect(i.col,i.row);if(this.pluginOptions.addColumnEnable){const e=s.isSeriesNumber(i.col,0);this.showDotForAddColumn(t.top-6,n.left+t.left,n.right+t.left,!e)}if(this.pluginOptions.addRowEnable){const e=s.isHeader(i.col,i.row);this.showDotForAddRow(n.top+t.top,t.left-6,n.bottom+t.top,!e,!e)}}else i===n.TABLE_EVENT_TYPE.MOUSELEAVE_CELL||i===n.TABLE_EVENT_TYPE.MOUSELEAVE_TABLE&&(this.pluginOptions.addColumnEnable&&this.delayHideAllForAddColumn(),this.pluginOptions.addRowEnable&&this.delayHideAllForAddRow())}initAddColumnDomElement(){this.leftDotForAddColumn=document.createElement("div"),this.leftDotForAddColumn.style.width="6px",this.leftDotForAddColumn.style.height="6px",this.leftDotForAddColumn.style.backgroundColor="#4A90E2",this.leftDotForAddColumn.style.position="absolute",this.leftDotForAddColumn.style.cursor="pointer",this.leftDotForAddColumn.style.zIndex="1000",this.leftDotForAddColumn.style.borderRadius="50%",this.leftDotForAddColumn.style.border="1px solid white",this.leftDotForAddColumn.style.boxShadow="0 1px 3px rgba(0,0,0,0.2)",document.body.appendChild(this.leftDotForAddColumn),this.rightDotForAddColumn=document.createElement("div"),this.rightDotForAddColumn.style.width="6px",this.rightDotForAddColumn.style.height="6px",this.rightDotForAddColumn.style.backgroundColor="#4A90E2",this.rightDotForAddColumn.style.position="absolute",this.rightDotForAddColumn.style.cursor="pointer",this.rightDotForAddColumn.style.zIndex="1000",this.rightDotForAddColumn.style.borderRadius="50%",this.rightDotForAddColumn.style.border="1px solid white",this.rightDotForAddColumn.style.boxShadow="0 1px 3px rgba(0,0,0,0.2)",document.body.appendChild(this.rightDotForAddColumn),this.addIconForAddColumn=document.createElement("div"),this.addIconForAddColumn.style.width="18px",this.addIconForAddColumn.style.height="18px",this.addIconForAddColumn.style.backgroundColor="#4A90E2",this.addIconForAddColumn.style.position="absolute",this.addIconForAddColumn.style.zIndex="1001",this.addIconForAddColumn.style.display="none",this.addIconForAddColumn.style.borderRadius="50%",this.addIconForAddColumn.style.boxShadow="0 2px 5px rgba(0,0,0,0.2)",this.addIconForAddColumn.style.display="flex",this.addIconForAddColumn.style.justifyContent="center",this.addIconForAddColumn.style.alignItems="center",this.addIconForAddColumn.style.border="1px solid white",document.body.appendChild(this.addIconForAddColumn);const t=document.createElement("div");t.textContent="+",t.style.color="white",t.style.fontSize="18px",t.style.fontWeight="bold",t.style.lineHeight="15px",t.style.userSelect="none",t.style.cursor="pointer",t.style.verticalAlign="top",t.style.textAlign="center",this.addIconForAddColumn.appendChild(t),this.addLineForAddColumn=document.createElement("div"),this.addLineForAddColumn.style.width="2px",this.addLineForAddColumn.style.height="10px",this.addLineForAddColumn.style.backgroundColor="#4A90E2",this.addLineForAddColumn.style.position="absolute",this.addLineForAddColumn.style.zIndex="1001",this.addLineForAddColumn.style.display="none",document.body.appendChild(this.addLineForAddColumn)}bindEventForAddColumn(){this.leftDotForAddColumn.addEventListener("mouseenter",(()=>{clearTimeout(this.hideAllTimeoutId_addColumn),this.addIconForAddColumn.style.display="block";const t=this.leftDotForAddColumn.offsetWidth,e=this.leftDotForAddColumn.offsetHeight;this.showAddIconForAddColumn(this.leftDotForAddColumn.offsetLeft+t/2,this.leftDotForAddColumn.offsetTop+e/2,!0),this.showSplitLineForAddColumn(this.leftDotForAddColumn.offsetLeft+t/2-1,this.leftDotForAddColumn.offsetTop+e/2+2,this.table.getDrawRange().height)})),this.rightDotForAddColumn.addEventListener("mouseenter",(()=>{clearTimeout(this.hideAllTimeoutId_addColumn),this.addIconForAddColumn.style.display="block";const t=this.rightDotForAddColumn.offsetWidth,e=this.rightDotForAddColumn.offsetHeight;this.showAddIconForAddColumn(this.rightDotForAddColumn.offsetLeft+t/2,this.rightDotForAddColumn.offsetTop+e/2,!1),this.showSplitLineForAddColumn(this.rightDotForAddColumn.offsetLeft+t/2-1,this.rightDotForAddColumn.offsetTop+e/2+2,this.table.getDrawRange().height)})),this.addIconForAddColumn.addEventListener("mouseleave",(()=>{this.addIconForAddColumn.style.display="none",this.addLineForAddColumn.style.display="none",this.delayHideAllForAddColumn()})),this.addIconForAddColumn.addEventListener("click",(t=>{const e="left"===this.addIconForAddColumn.dataset.addIconType,i=this.table.options.columns,n=this.hoverCell.col,s=e?n:n+1;this.pluginOptions.addColumnCallback?this.pluginOptions.addColumnCallback(s):(i.splice(s,0,{field:"",title:`New Column ${n}`,width:100}),this.table.updateColumns(i)),this.delayHideAllForAddColumn(0)}))}showDotForAddColumn(t,e,i,n=!0,s=!0){const r=this.leftDotForAddColumn.offsetWidth,a=this.leftDotForAddColumn.offsetHeight;this.leftDotForAddColumn.style.left=e-r/2+"px",this.leftDotForAddColumn.style.top=t-a/2+"px",this.rightDotForAddColumn.style.left=i-r/2+"px",this.rightDotForAddColumn.style.top=t-a/2+"px",this.leftDotForAddColumn.style.display=n?"block":"none",this.rightDotForAddColumn.style.display=s?"block":"none"}showAddIconForAddColumn(t,e,i){const n=this.addIconForAddColumn.offsetWidth,s=this.addIconForAddColumn.offsetHeight,r=this.leftDotForAddColumn.offsetHeight;this.addIconForAddColumn.style.left=t-n/2+"px",this.addIconForAddColumn.style.top=e-s/2-r/2+"px",this.addIconForAddColumn.dataset.addIconType=i?"left":"right"}showSplitLineForAddColumn(t,e,i){this.addLineForAddColumn.style.left=`${t}px`,this.addLineForAddColumn.style.top=`${e}px`,this.addLineForAddColumn.style.height=`${i}px`,this.addLineForAddColumn.style.display="block"}delayHideAllForAddColumn(t=1e3){this.hideAllTimeoutId_addColumn=setTimeout((()=>{this.addIconForAddColumn.style.display="none",this.addLineForAddColumn.style.display="none",this.leftDotForAddColumn.style.display="none",this.rightDotForAddColumn.style.display="none"}),t)}initAddRowDomElement(){this.topDotForAddRow=document.createElement("div"),this.topDotForAddRow.style.width="6px",this.topDotForAddRow.style.height="6px",this.topDotForAddRow.style.backgroundColor="#4A90E2",this.topDotForAddRow.style.position="absolute",this.topDotForAddRow.style.cursor="pointer",this.topDotForAddRow.style.zIndex="1000",this.topDotForAddRow.style.borderRadius="50%",this.topDotForAddRow.style.border="1px solid white",this.topDotForAddRow.style.boxShadow="0 1px 3px rgba(0,0,0,0.2)",document.body.appendChild(this.topDotForAddRow),this.bottomDotForAddRow=document.createElement("div"),this.bottomDotForAddRow.style.width="6px",this.bottomDotForAddRow.style.height="6px",this.bottomDotForAddRow.style.backgroundColor="#4A90E2",this.bottomDotForAddRow.style.position="absolute",this.bottomDotForAddRow.style.cursor="pointer",this.bottomDotForAddRow.style.zIndex="1000",this.bottomDotForAddRow.style.borderRadius="50%",this.bottomDotForAddRow.style.border="1px solid white",this.bottomDotForAddRow.style.boxShadow="0 1px 3px rgba(0,0,0,0.2)",document.body.appendChild(this.bottomDotForAddRow),this.addIconForAddRow=document.createElement("div"),this.addIconForAddRow.style.width="18px",this.addIconForAddRow.style.height="18px",this.addIconForAddRow.style.backgroundColor="#4A90E2",this.addIconForAddRow.style.position="absolute",this.addIconForAddRow.style.zIndex="1001",this.addIconForAddRow.style.display="none",this.addIconForAddRow.style.borderRadius="50%",this.addIconForAddRow.style.boxShadow="0 2px 5px rgba(0,0,0,0.2)",this.addIconForAddRow.style.display="flex",this.addIconForAddRow.style.justifyContent="center",this.addIconForAddRow.style.alignItems="center",this.addIconForAddRow.style.border="1px solid white",document.body.appendChild(this.addIconForAddRow);const t=document.createElement("div");t.textContent="+",t.style.color="white",t.style.fontSize="18px",t.style.fontWeight="bold",t.style.lineHeight="15px",t.style.userSelect="none",t.style.cursor="pointer",t.style.verticalAlign="top",t.style.textAlign="center",this.addIconForAddRow.appendChild(t),this.addLineForAddRow=document.createElement("div"),this.addLineForAddRow.style.width="10px",this.addLineForAddRow.style.height="2px",this.addLineForAddRow.style.backgroundColor="#4A90E2",this.addLineForAddRow.style.position="absolute",this.addLineForAddRow.style.zIndex="1001",this.addLineForAddRow.style.display="none",document.body.appendChild(this.addLineForAddRow)}bindEventForAddRow(){this.topDotForAddRow.addEventListener("mouseenter",(()=>{clearTimeout(this.hideAllTimeoutId_addRow),this.addIconForAddRow.style.display="block";const t=this.topDotForAddRow.offsetWidth,e=this.topDotForAddRow.offsetHeight;this.showAddIconForAddRow(this.topDotForAddRow.offsetLeft+t/2,this.topDotForAddRow.offsetTop+e/2,!0),this.showSplitLineForAddRow(this.topDotForAddRow.offsetLeft+t+2,this.topDotForAddRow.offsetTop+e/2-1,this.table.getDrawRange().width)})),this.bottomDotForAddRow.addEventListener("mouseenter",(()=>{clearTimeout(this.hideAllTimeoutId_addRow),this.addIconForAddRow.style.display="block";const t=this.bottomDotForAddRow.offsetWidth,e=this.bottomDotForAddRow.offsetHeight;this.showAddIconForAddRow(this.bottomDotForAddRow.offsetLeft+t/2,this.bottomDotForAddRow.offsetTop+e/2,!1),this.showSplitLineForAddRow(this.bottomDotForAddRow.offsetLeft+t+2,this.bottomDotForAddRow.offsetTop+e/2-1,this.table.getDrawRange().height)})),this.addIconForAddRow.addEventListener("mouseleave",(()=>{this.addIconForAddRow.style.display="none",this.addLineForAddRow.style.display="none",this.delayHideAllForAddRow()})),this.addIconForAddRow.addEventListener("click",(t=>{const e="top"===this.addIconForAddRow.dataset.addIconType,i=this.hoverCell.row,n=e?i:i+1;if(this.pluginOptions.addRowCallback)this.pluginOptions.addRowCallback(n);else{const t=this.table.getRecordIndexByCell(0,n);this.table.addRecord({},t)}this.delayHideAllForAddRow(0)}))}showDotForAddRow(t,e,i,n=!0,s=!0){const r=this.topDotForAddRow.offsetWidth,a=this.topDotForAddRow.offsetHeight;this.topDotForAddRow.style.left=e-r/2+"px",this.topDotForAddRow.style.top=t-a/2+"px",this.bottomDotForAddRow.style.left=e-r/2+"px",this.bottomDotForAddRow.style.top=i-a/2+"px",this.topDotForAddRow.style.display=n?"block":"none",this.bottomDotForAddRow.style.display=s?"block":"none"}showAddIconForAddRow(t,e,i){const n=this.addIconForAddRow.offsetWidth,s=this.addIconForAddRow.offsetHeight,r=this.topDotForAddRow.offsetWidth;this.addIconForAddRow.style.left=t-n/2-r/2+"px",this.addIconForAddRow.style.top=e-s/2+"px",this.addIconForAddRow.dataset.addIconType=i?"top":"bottom"}showSplitLineForAddRow(t,e,i){this.addLineForAddRow.style.left=`${t}px`,this.addLineForAddRow.style.top=`${e}px`,this.addLineForAddRow.style.width=`${i}px`,this.addLineForAddRow.style.display="block"}delayHideAllForAddRow(t=1e3){this.hideAllTimeoutId_addRow=setTimeout((()=>{this.addIconForAddRow.style.display="none",this.addLineForAddRow.style.display="none",this.topDotForAddRow.style.display="none",this.bottomDotForAddRow.style.display="none"}),t)}release(){this.leftDotForAddColumn.remove(),this.rightDotForAddColumn.remove(),this.addIconForAddColumn.remove(),this.addLineForAddColumn.remove(),this.topDotForAddRow.remove(),this.bottomDotForAddRow.remove(),this.addIconForAddRow.remove(),this.addLineForAddRow.remove()}},t.CarouselAnimationPlugin=class{table;rowCount;colCount;animationDuration;animationDelay;animationEasing;replaceScrollAction;playing;row;col;willUpdateRow=!1;willUpdateCol=!1;customDistRowFunction;customDistColFunction;constructor(t,e){this.table=t,this.rowCount=e?.rowCount??void 0,this.colCount=e?.colCount??void 0,this.animationDuration=e?.animationDuration??500,this.animationDelay=e?.animationDelay??1e3,this.animationEasing=e?.animationEasing??"linear",this.replaceScrollAction=e?.replaceScrollAction??!1,this.customDistColFunction=e.customDistColFunction,this.customDistRowFunction=e.customDistRowFunction,this.reset(),this.init()}init(){this.replaceScrollAction&&(this.table.disableScroll(),this.table.scenegraph.stage.addEventListener("wheel",this.onScrollEnd.bind(this)))}reset(){this.playing=!1,this.row=this.table.frozenRowCount,this.col=this.table.frozenColCount}onScrollEnd(t){this.rowCount?(t.deltaY>0?(this.row+=this.rowCount,this.row=Math.min(this.row,this.table.rowCount-this.table.frozenRowCount)):t.deltaY<0&&(this.row-=this.rowCount,this.row=Math.max(this.row,this.table.frozenRowCount)),this.table.scrollToRow(this.row,{duration:this.animationDuration,easing:this.animationEasing})):this.colCount&&(t.deltaX>0?(this.col+=this.colCount,this.col=Math.min(this.col,this.table.colCount-this.table.frozenColCount)):t.deltaX<0&&(this.col-=this.colCount,this.col=Math.max(this.col,this.table.frozenColCount)),this.table.scrollToCol(this.col,{duration:this.animationDuration,easing:this.animationEasing}))}play(){this.playing=!0,this.rowCount&&!this.willUpdateRow?this.updateRow():this.colCount&&!this.willUpdateCol&&this.updateCol()}pause(){this.playing=!1}updateRow(){if(!this.playing||this.table.isReleased)return;let t=!0;const e=this.customDistRowFunction&&this.customDistRowFunction(this.row,this.table);e?(this.row=e.distRow,t=e.animation??!0):s(this.row)&&this.table.scenegraph.proxy.screenTopRow!==this.row?(this.row=this.table.frozenRowCount,t=!1):s(this.row)||this.table.scenegraph.proxy.screenTopRow===Math.floor(this.row)?this.row+=this.rowCount:(this.row=this.table.frozenRowCount,t=!1),this.table.scrollToRow(this.row,t?{duration:this.animationDuration,easing:this.animationEasing}:void 0),this.willUpdateRow=!0,setTimeout((()=>{this.willUpdateRow=!1,this.updateRow()}),this.animationDuration+this.animationDelay)}updateCol(){if(!this.playing||this.table.isReleased)return;let t=!0;const e=this.customDistColFunction&&this.customDistColFunction(this.col,this.table);e?(this.col=e.distCol,t=e.animation??!0):s(this.col)&&this.table.scenegraph.proxy.screenLeftCol!==this.col?(this.col=this.table.frozenColCount,t=!1):s(this.col)||this.table.scenegraph.proxy.screenLeftCol===Math.floor(this.col)?this.col+=this.colCount:(this.col=this.table.frozenColCount,t=!1),this.table.scrollToCol(this.col,t?{duration:this.animationDuration,easing:this.animationEasing}:void 0),this.willUpdateCol=!0,setTimeout((()=>{this.willUpdateCol=!1,this.updateCol()}),this.animationDuration+this.animationDelay)}},t.ColumnSeriesPlugin=class{id=`column-series-${Date.now()}`;name="Column Series";runTime=[n.TABLE_EVENT_TYPE.BEFORE_INIT,n.TABLE_EVENT_TYPE.BEFORE_KEYDOWN];pluginOptions;table;columns=[];constructor(t){this.id=t.id??this.id,this.pluginOptions=Object.assign({columnCount:100},t)}run(...t){if(t[1]===n.TABLE_EVENT_TYPE.BEFORE_INIT){const e=t[0],i=t[2];this.table=i;const n=e.options;this.columns=this.generateColumns(this.pluginOptions.columnCount),n.columns=this.columns}else if(t[1]===n.TABLE_EVENT_TYPE.BEFORE_KEYDOWN){const e=t[0].event;this.pluginOptions.autoExtendColumnTriggerKeys?.includes(e.key)&&this.table.stateManager.select.cellPos.col===this.table.colCount-1&&this.table.addColumn(this.generateColumn(this.table.colCount-1))}}generateColumns(t){const e=[];for(let i=0;i<t;i++)e.push(this.generateColumn(i));return e}generateColumn(t){return{title:this.pluginOptions.generateColumnTitle?this.pluginOptions.generateColumnTitle(t):this.generateColumnField(t)}}generateColumnField(t){if(t<26)return String.fromCharCode(65+t);const e=[];for(t++;t>0;)t--,e.unshift(String.fromCharCode(65+t%26)),t=Math.floor(t/26);return e.join("")}resetColumnCount(t){this.pluginOptions.columnCount=t,this.columns=this.generateColumns(t),this.table.updateColumns(this.columns)}},t.ExcelEditCellKeyboardPlugin=class{id=`excel-edit-cell-keyboard-${Date.now()}`;name="Excel Edit Cell Keyboard";runTime=[n.TABLE_EVENT_TYPE.INITIALIZED];table;pluginOptions;constructor(t){this.id=t?.id??this.id,this.pluginOptions=t,this.bindEvent()}run(...t){const e=t[2];this.table=e}bindEvent(){document.addEventListener("keydown",this.handleKeyDown.bind(this),!0)}handleKeyDown(t){if(this.table.editorManager)if("keydown"===this.table.editorManager.beginTriggerEditCellMode){if(this.table.editorManager.editingEditor&&this.isExcelShortcutKey(t)){const{col:e,row:i}=this.table.editorManager.editCell;this.table.editorManager.completeEdit(),this.table.getElement().focus(),t.shiftKey||t.ctrlKey||t.metaKey||("Enter"===t.key?this.table.selectCell(e,i+1):"Tab"===t.key?this.table.selectCell(e+1,i):"ArrowLeft"===t.key?this.table.selectCell(e-1,i):"ArrowRight"===t.key?this.table.selectCell(e+1,i):"ArrowDown"===t.key?this.table.selectCell(e,i+1):"ArrowUp"===t.key&&this.table.selectCell(e,i-1),t.stopPropagation(),t.preventDefault())}}else{const{col:e,row:i}=this.table.stateManager.select.cellPos;if(!this.table.editorManager.editingEditor||"Enter"!==t.key&&"Tab"!==t.key){if("Delete"===t.key){const e=this.table.getSelectedCellInfos();e?.length>0&&function(t,e){for(let i=0;i<t.length;i++)for(let n=0;n<t[i].length;n++)e.changeCellValue(t[i][n].col,t[i][n].row,"")}(e,this.table),t.stopPropagation(),t.preventDefault()}}else this.table.editorManager.completeEdit(),this.table.getElement().focus(),"Enter"===t.key?this.table.selectCell(e,i+1):"Tab"===t.key&&this.table.selectCell(e+1,i),t.stopPropagation(),t.preventDefault()}}isExcelShortcutKey(t){return"Enter"===t.key||"Tab"===t.key||"ArrowLeft"===t.key||"ArrowRight"===t.key||"ArrowDown"===t.key||"ArrowUp"===t.key}release(){document.removeEventListener("keydown",this.handleKeyDown,!0)}},t.ExportGanttPlugin=class{id="gantt-export-helper";name="Gantt Export Helper";_gantt=null;run(...t){const e=t[0];e&&(this._gantt=e)}async exportToImage(t={}){if(!this._gantt)return;const{fileName:e="gantt-export",type:i="png",quality:n=1,backgroundColor:s="#ffffff",scale:r=window.devicePixelRatio||1}=t;try{const{tempContainer:t,clonedGantt:a}=this.createFullSizeContainer(r);try{await new Promise((t=>requestAnimationFrame(t)));const t=(a.taskListTableInstance.getAllColsWidth()+a.getAllDateColsWidth())*r,o=a.getAllRowsHeight()*r,l=document.createElement("canvas");l.width=t,l.height=o;const h=l.getContext("2d");h.fillStyle=s,h.fillRect(0,0,t,o),a.taskListTableInstance?.canvas&&h.drawImage(a.taskListTableInstance.canvas,0,0,a.taskListTableInstance.getAllColsWidth()*r,o);const d=3*r,c=a.taskListTableInstance.getAllColsWidth()*r;h.fillStyle="rgb(225, 228, 232)",h.fillRect(c-d/2,0,d,o);const u=4*r,p=a.canvas.width-u;return a.canvas&&h.drawImage(a.canvas,u,0,p,a.canvas.height,(a.taskListTableInstance.getAllColsWidth()+1.5)*r,0,(a.getAllDateColsWidth()-1.5)*r,o),this.finalizeExport(l,e,i,n)}finally{t.remove(),a.release()}}catch(t){throw new Error(`甘特图导出失败: ${t instanceof Error?t.message:"未知错误"}`)}}createFullSizeContainer(t){if(!this._gantt)throw new Error("ExportGanttPlugin: Gantt instance not available to create container.");const e=document.createElement("div");e.style.position="fixed",e.style.left="-9999px",e.style.overflow="hidden",e.style.width=`${window.innerWidth+100}px`,e.style.height=`${window.innerHeight+100}px`,document.body.appendChild(e);const i=document.createElement("div"),n=this._gantt.taskListTableInstance.getAllColsWidth()+this._gantt.getAllDateColsWidth(),s=this._gantt.getAllRowsHeight();i.style.width=`${n}px`,i.style.height=`${s}px`,e.appendChild(i);const r=new Rp(i,{...this._gantt.options,records:JSON.parse(JSON.stringify(this._gantt.records)),taskListTable:{...this._gantt.options.taskListTable,tableWidth:void 0,minTableWidth:void 0,maxTableWidth:void 0}});return r.setPixelRatio(t),r.scenegraph?.ganttGroup&&r.scenegraph.ganttGroup.setAttribute("clip",!1),r.taskListTableInstance?.scenegraph?.tableGroup&&r.taskListTableInstance.scenegraph.tableGroup.setAttribute("clip",!1),r.scenegraph.stage.render(),{tempContainer:e,clonedGantt:r}}finalizeExport(t,e,i,n){const s=t.toDataURL(`image/${i}`,n),r=document.createElement("a");return r.download=`${e}.${i}`,r.href=s,document.body.appendChild(r),r.click(),document.body.removeChild(r),s}release(){this._gantt=null}},t.FocusHighlightPlugin=class{id=`focus-highlight-${Date.now()}`;name="Focus Highlight";runTime=[e.TABLE_EVENT_TYPE.INITIALIZED,e.TABLE_EVENT_TYPE.SELECTED_CELL,e.TABLE_EVENT_TYPE.SELECTED_CLEAR];table;range;pluginOptions;constructor(t={fill:"#000",opacity:.5,highlightRange:void 0}){this.id=t.id??this.id,this.pluginOptions=Object.assign({fill:"#000",opacity:.5},t)}run(...t){if(this.table||(this.table=t[2]),t[1]===e.TABLE_EVENT_TYPE.INITIALIZED)this.pluginOptions.highlightRange&&this.setFocusHighlightRange(this.pluginOptions.highlightRange);else if(t[1]===e.TABLE_EVENT_TYPE.SELECTED_CELL){const t=this.table.stateManager.select.cellPos;if(this.table.isHeader(t.col,t.row))this.setFocusHighlightRange(void 0);else{const t=this.table.stateManager.select.ranges,e=0,i=this.table.colCount-1,n=Math.min(t[0].start.row,t[0].end.row),s=Math.max(t[0].start.row,t[0].end.row);this.setFocusHighlightRange({start:{col:e,row:n},end:{col:i,row:s}})}}else t[1]===e.TABLE_EVENT_TYPE.SELECTED_CLEAR&&this.setFocusHighlightRange(void 0)}setFocusHighlightRange(t,e=!1){let i;t&&"start"in t&&"end"in t?i=t:t&&(i={start:t,end:t}),Qc(this.range,i)&&!e||(this.range=i,t?this.updateCellGroupShadow():this.deleteAllCellGroupShadow(),this.table.scenegraph.updateNextFrame())}deleteAllCellGroupShadow(){this.table.isPivotTable()||(this.updateCellGroupShadowInContainer(this.table.scenegraph.rowHeaderGroup),this.updateCellGroupShadowInContainer(this.table.scenegraph.leftBottomCornerGroup)),this.updateCellGroupShadowInContainer(this.table.scenegraph.bodyGroup),this.updateCellGroupShadowInContainer(this.table.scenegraph.rightFrozenGroup),this.updateCellGroupShadowInContainer(this.table.scenegraph.bottomFrozenGroup),this.updateCellGroupShadowInContainer(this.table.scenegraph.rightBottomCornerGroup)}updateCellGroupShadow(){this.table.isPivotTable()||(this.updateCellGroupShadowInContainer(this.table.scenegraph.rowHeaderGroup,this.range),this.updateCellGroupShadowInContainer(this.table.scenegraph.leftBottomCornerGroup,this.range)),this.updateCellGroupShadowInContainer(this.table.scenegraph.bodyGroup,this.range),this.updateCellGroupShadowInContainer(this.table.scenegraph.rightFrozenGroup,this.range),this.updateCellGroupShadowInContainer(this.table.scenegraph.bottomFrozenGroup),this.range,this.updateCellGroupShadowInContainer(this.table.scenegraph.rightBottomCornerGroup,this.range)}updateCellGroupShadowInContainer(t,e){let i;e&&"start"in e&&"end"in e?i=e:e&&(i={start:e,end:e}),t.forEachChildrenSkipChild((t=>{const e=t;"column"===e.role&&e.forEachChildrenSkipChild((t=>{const e=t;if("cell"!==e.role)return;e.attachShadow(e.shadowRoot);const n=e.shadowRoot;if(i){if(iu(i,e.col,e.row))n.removeAllChild();else if(!n.firstChild){const t=jo({x:0,y:0,width:e.attribute.width,height:e.attribute.height,fill:this.pluginOptions.fill,opacity:this.pluginOptions.opacity});t.name="shadow-rect",n.appendChild(t)}}else n.removeAllChild()}))}))}update(){this.setFocusHighlightRange(this.range,!0)}},t.HeaderHighlightPlugin=class{table;options;colHeaderRange;rowHeaderRange;constructor(t,e){this.table=t,this.options=e,this.registerStyle(),this.bindEvent()}registerStyle(){this.table.registerCustomCellStyle("col-highlight",{bgColor:this.options?.colHighlightBGColor??"#82b2f5",color:this.options?.colHighlightColor??"#FFF"}),this.table.registerCustomCellStyle("row-highlight",{bgColor:this.options?.rowHighlightBGColor??"#82b2f5",color:this.options?.rowHighlightColor??"#FFF"})}bindEvent(){this.table.on("selected_cell",(()=>{this.updateHighlight()})),this.table.on("selected_clear",(()=>{this.clearHighlight()})),this.table.on("mousemove_table",(()=>{this.table.stateManager.select.selecting&&this.updateHighlight()}))}clearHighlight(){this.colHeaderRange&&this.table.arrangeCustomCellStyle({range:this.colHeaderRange},void 0,!0),this.rowHeaderRange&&this.table.arrangeCustomCellStyle({range:this.rowHeaderRange},void 0,!0),this.colHeaderRange=void 0,this.rowHeaderRange=void 0}updateHighlight(){if(!1===this.options?.colHighlight&&!1===this.options?.rowHighlight)return;const t=this.table.getSelectedCellRanges();if(0===t.length)return void this.clearHighlight();const e=t[0],i=[e.start.row,e.end.row];i.sort(((t,e)=>t-e));const n=[e.start.col,e.end.col];let s,r;n.sort(((t,e)=>t-e)),this.table.isPivotTable()?(s={start:{col:n[0],row:0},end:{col:n[1],row:this.table.columnHeaderLevelCount-1}},r={start:{col:0,row:i[0]},end:{col:this.table.rowHeaderLevelCount-1,row:i[1]}}):this.table.internalProps.transpose?r={start:{col:0,row:i[0]},end:{col:this.table.rowHeaderLevelCount-1,row:i[1]}}:(s={start:{col:n[0],row:0},end:{col:n[1],row:this.table.columnHeaderLevelCount-1}},this.table.internalProps.rowSeriesNumber&&(r={start:{col:0,row:i[0]},end:{col:0,row:i[1]}})),!1===this.options?.colHighlight||nu(this.colHeaderRange,s)||(this.colHeaderRange&&this.table.arrangeCustomCellStyle({range:this.colHeaderRange},void 0),s&&this.table.arrangeCustomCellStyle({range:s},"col-highlight"),this.colHeaderRange=s),!1===this.options?.rowHighlight||nu(this.rowHeaderRange,r)||(this.rowHeaderRange&&this.table.arrangeCustomCellStyle({range:this.rowHeaderRange},void 0),r&&this.table.arrangeCustomCellStyle({range:r},"row-highlight"),this.rowHeaderRange=r)}},t.HighlightHeaderWhenSelectCellPlugin=class{id=`highlight-header-when-select-cell-${Date.now()}`;name="Highlight Header When Select Cell";runTime=[e.TABLE_EVENT_TYPE.INITIALIZED,e.TABLE_EVENT_TYPE.SELECTED_CLEAR,e.TABLE_EVENT_TYPE.SELECTED_CELL,e.TABLE_EVENT_TYPE.MOUSEMOVE_TABLE];table;pluginOptions;colHeaderRanges=[];rowHeaderRanges=[];constructor(t){this.id=t.id??this.id,this.pluginOptions=t}run(...t){const i=t[1],n=t[2];this.table=n,i===e.TABLE_EVENT_TYPE.SELECTED_CLEAR?this.clearHighlight():i===e.TABLE_EVENT_TYPE.SELECTED_CELL||i===e.TABLE_EVENT_TYPE.MOUSEMOVE_TABLE?this.updateHighlight():i===e.TABLE_EVENT_TYPE.INITIALIZED&&this.registerStyle()}registerStyle(){this.table.registerCustomCellStyle("col-highlight",{bgColor:this.pluginOptions?.colHighlightBGColor??"#82b2f5",color:this.pluginOptions?.colHighlightColor??"#FFF"}),this.table.registerCustomCellStyle("row-highlight",{bgColor:this.pluginOptions?.rowHighlightBGColor??"#82b2f5",color:this.pluginOptions?.rowHighlightColor??"yellow"})}clearHighlight(){this.colHeaderRanges&&this.colHeaderRanges.forEach((t=>{this.table.arrangeCustomCellStyle({range:t},void 0)})),this.rowHeaderRanges&&this.rowHeaderRanges.forEach((t=>{this.table.arrangeCustomCellStyle({range:t},void 0)})),this.colHeaderRanges=[],this.rowHeaderRanges=[]}updateHighlight(){if(!1===this.pluginOptions?.colHighlight&&!1===this.pluginOptions?.rowHighlight)return;const t=this.table.getSelectedCellRanges();t.length<2&&this.clearHighlight();for(let e=0;e<t.length;e++){const i=t[e],n=[i.start.row,i.end.row];n.sort(((t,e)=>t-e));const s=[i.start.col,i.end.col];let r,a;s.sort(((t,e)=>t-e)),this.table.isPivotTable()?(r={start:{col:s[0],row:0},end:{col:s[1],row:this.table.columnHeaderLevelCount-1}},a={start:{col:0,row:n[0]},end:{col:this.table.rowHeaderLevelCount-1,row:n[1]}}):this.table.internalProps.transpose?a={start:{col:0,row:n[0]},end:{col:this.table.rowHeaderLevelCount-1,row:n[1]}}:(r={start:{col:s[0],row:0},end:{col:s[1],row:this.table.columnHeaderLevelCount-1}},this.table.internalProps.rowSeriesNumber&&(a={start:{col:0,row:n[0]},end:{col:0,row:n[1]}})),!1===this.pluginOptions?.colHighlight||this.colHeaderRanges.find((t=>su(t,r)))||(r&&this.table.arrangeCustomCellStyle({range:r},"col-highlight"),this.colHeaderRanges.push(r)),!1===this.pluginOptions?.rowHighlight||this.rowHeaderRanges.find((t=>su(t,a)))||(a&&this.table.arrangeCustomCellStyle({range:a},"row-highlight"),this.rowHeaderRanges.push(a))}}update(){this.registerStyle(),this.updateHighlight()}release(){this.rowHeaderRanges=[],this.colHeaderRanges=[]}},t.InvertHighlightPlugin=class{table;range;_fill;_opacity;constructor(t,e){this.table=t,this._fill=e?.fill??"#000",this._opacity=e?.opacity??.5}setInvertHighlightRange(t){Qc(this.range,t)||(this.range=t,t?this.updateCellGroupShadow():this.deleteAllCellGroupShadow(),this.table.scenegraph.updateNextFrame())}deleteAllCellGroupShadow(){this.table.isPivotTable()||(this.updateCellGroupShadowInContainer(this.table.scenegraph.rowHeaderGroup),this.updateCellGroupShadowInContainer(this.table.scenegraph.leftBottomCornerGroup)),this.updateCellGroupShadowInContainer(this.table.scenegraph.bodyGroup),this.updateCellGroupShadowInContainer(this.table.scenegraph.rightFrozenGroup),this.updateCellGroupShadowInContainer(this.table.scenegraph.bottomFrozenGroup),this.updateCellGroupShadowInContainer(this.table.scenegraph.rightBottomCornerGroup)}updateCellGroupShadow(){this.table.isPivotTable()||(this.updateCellGroupShadowInContainer(this.table.scenegraph.rowHeaderGroup,this.range),this.updateCellGroupShadowInContainer(this.table.scenegraph.leftBottomCornerGroup,this.range)),this.updateCellGroupShadowInContainer(this.table.scenegraph.bodyGroup,this.range),this.updateCellGroupShadowInContainer(this.table.scenegraph.rightFrozenGroup,this.range),this.updateCellGroupShadowInContainer(this.table.scenegraph.bottomFrozenGroup),this.range,this.updateCellGroupShadowInContainer(this.table.scenegraph.rightBottomCornerGroup,this.range)}updateCellGroupShadowInContainer(t,e){t.forEachChildrenSkipChild((t=>{const i=t;"column"===i.role&&i.forEachChildrenSkipChild((t=>{const i=t;if("cell"!==i.role)return;i.attachShadow(i.shadowRoot);const n=i.shadowRoot;if(e){if(iu(e,i.col,i.row))n.removeAllChild();else if(!n.firstChild){const t=jo({x:0,y:0,width:i.attribute.width,height:i.attribute.height,fill:this._fill,opacity:this._opacity});t.name="shadow-rect",n.appendChild(t)}}else n.removeAllChild()}))}))}},t.RotateTablePlugin=class{id=`rotate-table-${Date.now()}`;name="Rotate Table";runTime=[n.TABLE_EVENT_TYPE.INITIALIZED];table;matrix;vglobal_mapToCanvasPoint;constructor(t){this.id=t?.id??this.id}run(...t){const e=t[2];this.table=e,this.table.rotate90WithTransform=au.bind(this.table),this.table.cancelTransform=ou.bind(this.table)}release(){}},t.RowSeriesPlugin=class{id=`row-series-${Date.now()}`;name="Row Series";runTime=[e.TABLE_EVENT_TYPE.BEFORE_INIT,e.TABLE_EVENT_TYPE.BEFORE_KEYDOWN];pluginOptions;table;constructor(t){this.id=t.id??this.id,this.pluginOptions=Object.assign({rowCount:100},t)}run(...t){if(t[1]===e.TABLE_EVENT_TYPE.BEFORE_INIT){const e=t[0],i=t[2];this.table=i;const n=e.options,s=n.records??[];for(let t=s.length;t<this.pluginOptions.rowCount;t++)s.push(this.pluginOptions.fillRowRecord?this.pluginOptions.fillRowRecord(t):{});n.records=s,this.pluginOptions.rowSeriesNumber?(n.rowSeriesNumber=this.pluginOptions.rowSeriesNumber,this.pluginOptions.rowSeriesNumber.width||(n.rowSeriesNumber.width="auto")):n.rowSeriesNumber||(n.rowSeriesNumber={width:"auto"})}else if(t[1]===e.TABLE_EVENT_TYPE.BEFORE_KEYDOWN){const e=t[0].event;this.pluginOptions.autoExtendRowTriggerKeys?.includes(e.key)&&this.table.stateManager.select.cellPos.row===this.table.rowCount-1&&this.table.addRecord(this.pluginOptions.fillRowRecord?this.pluginOptions.fillRowRecord(this.table.rowCount-this.table.columnHeaderLevelCount):{})}}},t.TableCarouselAnimationPlugin=class{id=`table-carousel-animation-${Date.now()}`;name="Table Carousel Animation";runTime=[e.TABLE_EVENT_TYPE.INITIALIZED];table;rowCount;colCount;animationDuration;animationDelay;animationEasing;playing;row;col;willUpdateRow=!1;willUpdateCol=!1;autoPlay;autoPlayDelay;customDistRowFunction;customDistColFunction;constructor(t={}){this.id=t.id??this.id,this.rowCount=t?.rowCount??void 0,this.colCount=t?.colCount??void 0,this.animationDuration=t?.animationDuration??500,this.animationDelay=t?.animationDelay??1e3,this.animationEasing=t?.animationEasing??"linear",this.autoPlay=t?.autoPlay??!1,this.autoPlayDelay=t?.autoPlayDelay??0,this.customDistColFunction=t.customDistColFunction,this.customDistRowFunction=t.customDistRowFunction}run(...t){this.table||(this.table=t[2]),this.reset(),this.autoPlay&&setTimeout((()=>{this.play()}),this.autoPlayDelay)}reset(){this.playing=!1,this.row=this.table.frozenRowCount,this.col=this.table.frozenColCount}play(){if(!this.table)throw new Error("table is not initialized");this.playing=!0,this.rowCount&&!this.willUpdateRow?this.updateRow():this.colCount&&!this.willUpdateCol&&this.updateCol()}pause(){this.playing=!1}updateRow(){if(!this.playing||this.table.isReleased)return;let t=!0;const e=this.customDistRowFunction&&this.customDistRowFunction(this.row,this.table);e?(this.row=e.distRow,t=e.animation??!0):ru(this.row)&&this.table.scenegraph.proxy.screenTopRow!==this.row?(this.row=this.table.frozenRowCount,t=!1):ru(this.row)||this.table.scenegraph.proxy.screenTopRow===Math.floor(this.row)?this.row+=this.rowCount:(this.row=this.table.frozenRowCount,t=!1),this.table.scrollToRow(this.row,t?{duration:this.animationDuration,easing:this.animationEasing}:void 0),this.willUpdateRow=!0,setTimeout((()=>{this.willUpdateRow=!1,this.updateRow()}),this.animationDuration+this.animationDelay)}updateCol(){if(!this.playing||this.table.isReleased)return;let t=!0;const e=this.customDistColFunction&&this.customDistColFunction(this.col,this.table);e?(this.col=e.distCol,t=e.animation??!0):ru(this.col)&&this.table.scenegraph.proxy.screenLeftCol!==this.col?(this.col=this.table.frozenColCount,t=!1):ru(this.col)||this.table.scenegraph.proxy.screenLeftCol===Math.floor(this.col)?this.col+=this.colCount:(this.col=this.table.frozenColCount,t=!1),this.table.scrollToCol(this.col,t?{duration:this.animationDuration,easing:this.animationEasing}:void 0),this.willUpdateCol=!0,setTimeout((()=>{this.willUpdateCol=!1,this.updateCol()}),this.animationDuration+this.animationDelay)}release(){}},t.cancelTransform=ou,t.rotate90WithTransform=au}));