@visactor/vtable-plugins 1.19.6 → 1.19.7
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,4 +1,4 @@
|
|
|
1
|
-
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("@visactor/vtable"),require("crypto"),require("fs"),require("stream"),require("events"),require("buffer"),require("util"),require("string_decoder"),require("path"),require("constants"),require("assert"),require("zlib"),require("os")):"function"==typeof define&&define.amd?define(["exports","@visactor/vtable","crypto","fs","stream","events","buffer","util","string_decoder","path","constants","assert","zlib","os"],e):e(((t="undefined"!=typeof globalThis?globalThis:t||self).VTable=t.VTable||{},t.VTable.plugins={}),t.VTable,t.require$$0$1,t.require$$0$6,t.require$$0$2,t.require$$0$5,t.require$$0$3,t.require$$0$4,t.require$$0$7,t.require$$1,t.require$$0$8,t.require$$5,t.require$$0$9,t.require$$1$1)}(this,(function(t,e,r,i,n,s,o,a,l,h,c,u,d,p){"use strict";function f(t){var e=Object.create(null);return t&&Object.keys(t).forEach((function(r){if("default"!==r){var i=Object.getOwnPropertyDescriptor(t,r);Object.defineProperty(e,r,i.get?i:{enumerable:!0,get:function(){return t[r]}})}})),e.default=t,Object.freeze(e)}var g=f(e);function m(t){return Math.floor(t)===t}class y{static GenAutoIncrementId(){return y.auto_increment_id++}}y.auto_increment_id=0;class v{constructor(t){this.id=y.GenAutoIncrementId(),this.registry=t}}const b="named",w="inject",x="multi_inject",S="inversify:tagged",T="inversify:paramtypes";class k{constructor(t,e){this.key=t,this.value=e}toString(){return this.key===b?`named: ${String(this.value).toString()} `:`tagged: { key:${this.key.toString()}, value: ${String(this.value)} }`}}var C=function(t){var e;return function(t){const e="function"==typeof Symbol&&void 0!==Symbol.toPrimitive?Symbol.toPrimitive:"@@toPrimitive",r=Object.getPrototypeOf(Function),i=("object"==typeof process&&process.env&&process.env.REFLECT_METADATA_USE_MAP_POLYFILL,Map),n=new WeakMap;function s(t,e,r){let s=n.get(t);if(h(s)){if(!r)return;s=new i,n.set(t,s)}let o=s.get(e);if(h(o)){if(!r)return;o=new i,s.set(e,o)}return o}function o(t,e,r){if(a(t,e,r))return!0;const i=g(e);return!c(i)&&o(t,i,r)}function a(t,e,r){const i=s(e,r,!1);return!h(i)&&!!i.has(t)}function l(t,e,r){if(a(t,e,r))return function(t,e,r){const i=s(e,r,!1);if(!h(i))return i.get(t)}(t,e,r);const i=g(e);return c(i)?void 0:l(t,i,r)}function h(t){return void 0===t}function c(t){return null===t}function u(t){return"object"==typeof t?null!==t:"function"==typeof t}function d(t,r){switch(function(t){if(null===t)return 1;switch(typeof t){case"undefined":return 0;case"boolean":return 2;case"string":return 3;case"symbol":return 4;case"number":return 5;case"object":return null===t?1:6;default:return 6}}(t)){case 0:case 1:case 2:case 3:case 4:case 5:return t}const i=3===r?"string":5===r?"number":"default",n=function(t,e){const r=t[e];if(null!=r){if(!f(r))throw new TypeError;return r}}(t,e);if(void 0!==n){const e=n.call(t,i);if(u(e))throw new TypeError;return e}return function(t,e){if("string"===e){const e=t.toString;if(f(e)){const r=e.call(t);if(!u(r))return r}const r=t.valueOf;if(f(r)){const e=r.call(t);if(!u(e))return e}}else{const e=t.valueOf;if(f(e)){const r=e.call(t);if(!u(r))return r}const r=t.toString;if(f(r)){const e=r.call(t);if(!u(e))return e}}throw new TypeError}(t,"default"===i?"number":i)}function p(t){const e=d(t,3);return"symbol"==typeof e?e:function(t){return""+t}(e)}function f(t){return"function"==typeof t}function g(t){const e=Object.getPrototypeOf(t);if("function"!=typeof t||t===r)return e;if(e!==r)return e;const i=t.prototype,n=i&&Object.getPrototypeOf(i);if(null==n||n===Object.prototype)return e;const s=n.constructor;return"function"!=typeof s||s===t?e:s}t("defineMetadata",(function(t,e,r,i){if(!u(r))throw new TypeError;return function(t,e,r,i){s(r,i,!0).set(t,e)}(t,e,r,i)})),t("hasMetadata",(function(t,e,r){if(!u(e))throw new TypeError;return h(r)||(r=p(r)),o(t,e,r)})),t("hasOwnMetadata",(function(t,e,r){if(!u(e))throw new TypeError;return h(r)||(r=p(r)),a(t,e,r)})),t("getMetadata",(function(t,e,r){if(!u(e))throw new TypeError;return h(r)||(r=p(r)),l(t,e,r)}))}((e=t,function(t,r){"function"!=typeof e[t]&&Object.defineProperty(e,t,{configurable:!0,writable:!0,value:r})})),t}({});function E(t,e,r,i){!function(t,e,r,i){const n=[i];let s={};C.hasOwnMetadata(t,e)&&(s=C.getMetadata(t,e));let o=s[r];void 0===o&&(o=[]),o.push(...n),s[r]=o,C.defineMetadata(t,s,e)}(S,t,r.toString(),i)}function A(t){return(e,r,i)=>{E(e,0,i,t)}}function O(t){return e=>(r,i,n)=>A(new k(t,e))(r,i,n)}const B=O(w),R=O(x);function L(){return function(t){return C.defineMetadata(T,null,t),t}}function P(t){return A(new k(b,t))}const D="Singleton",M="Transient",I="ConstantValue",N="DynamicValue",F="Factory",j="Function",z="Instance",H="Invalid";class W{constructor(t,e){this.id=y.GenAutoIncrementId(),this.activated=!1,this.serviceIdentifier=t,this.scope=e,this.type=H,this.constraint=t=>!0,this.implementationType=null,this.cache=null,this.factory=null,this.provider=null,this.dynamicValue=null}clone(){const t=new W(this.serviceIdentifier,this.scope);return t.activated=t.scope===D&&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 U{getConstructorMetadata(t){return{compilerGeneratedMetadata:C.getMetadata(T,t),userGeneratedMetadata:C.getMetadata(S,t)||{}}}getPropertiesMetadata(t){throw new Error("暂未实现")}}const $=(V=b,t=>{const e=e=>{if(null==e)return!1;if(e.key===V&&e.value===t)return!0;if(null==e.constructorArgsMetadata)return!1;const r=e.constructorArgsMetadata;for(let e=0;e<r.length;e++)if(r[e].key===V&&r[e].value===t)return!0;return!1};return e.metaData=new k(V,t),e});var V;class G{constructor(t){this._binding=t}inRequestScope(){throw new Error("暂未实现")}inSingletonScope(){return this._binding.scope=D,this}inTransientScope(){return this._binding.scope=M,this}whenTargetNamed(t){return this._binding.constraint=$(t),this}}class X{constructor(t){this._binding=t}to(t){return this._binding.type=z,this._binding.implementationType=t,new G(this._binding)}toSelf(){const t=this._binding.serviceIdentifier;return this.to(t)}toDynamicValue(t){return this._binding.type=N,this._binding.cache=null,this._binding.dynamicValue=t,this._binding.implementationType=null,new G(this._binding)}toConstantValue(t){return this._binding.type=I,this._binding.cache=t,this._binding.dynamicValue=null,this._binding.implementationType=null,this._binding.scope=D,new G(this._binding)}toFactory(t){return this._binding.type=F,this._binding.factory=t,this._binding.scope=D,new G(this._binding)}toService(t){this.toDynamicValue((e=>e.container.get(t)))}}const Y=Symbol("ContributionProvider");class q{constructor(t,e){this.serviceIdentifier=t,this.container=e,K.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 Z(t,e){t(Y).toDynamicValue((({container:t})=>new q(e,t))).inSingletonScope().whenTargetNamed(e)}class K{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()}))}}K.store=new Map;class Q{constructor(t,e){this._args=t,this.name=e,this.taps=[]}tap(t,e){this._tap("sync",t,e)}unTap(t,e){const r="string"==typeof t?t.trim():t.name;r&&(this.taps=this.taps.filter((t=>!(t.name===r&&(!e||t.fn===e)))))}_parseOptions(t,e,r){let i;if("string"==typeof e)i={name:e.trim()};else if("object"!=typeof e||null===e)throw new Error("Invalid tap options");if("string"!=typeof i.name||""===i.name)throw new Error("Missing name for tap");return i=Object.assign({type:t,fn:r},i),i}_tap(t,e,r){this._insert(this._parseOptions(t,e,r))}_insert(t){let e;"string"==typeof t.before?e=new Set([t.before]):Array.isArray(t.before)&&(e=new Set(t.before));let r=0;"number"==typeof t.stage&&(r=t.stage);let i=this.taps.length;for(;i>0;){i--;const t=this.taps[i];this.taps[i+1]=t;const n=t.stage||0;if(e){if(e.has(t.name)){e.delete(t.name);continue}if(e.size>0)continue}if(!(n>r)){i++;break}}this.taps[i]=t}}class J extends Q{call(...t){this.taps.map((t=>t.fn)).forEach((e=>e(...t)))}}const tt=Symbol.for("EnvContribution"),et=Symbol.for("VGlobal");const rt=new class{};let it=0;class nt{constructor(){this.nextAnimationFrameCbs=new Map,this._rafHandle=null,this.runAnimationFrame=t=>{this._rafHandle=null;const e=this.nextAnimationFrameCbs;this.nextAnimationFrameCbs=new Map,e.forEach((e=>e(t)))},this.tryRunAnimationFrameNextFrame=()=>{null===this._rafHandle&&0!==this.nextAnimationFrameCbs.size&&(this._rafHandle=rt.global.getRequestAnimationFrame()(this.runAnimationFrame))}}addAnimationFrameCb(t){return this.nextAnimationFrameCbs.set(++it,t),this.tryRunAnimationFrameNextFrame(),it}removeAnimationFrameCb(t){return!!this.nextAnimationFrameCbs.has(t)&&(this.nextAnimationFrameCbs.delete(t),!0)}}class st{constructor(){this._listenerMap=new Map,this._eventListenerTransformer=t=>t}setEventListenerTransformer(t){this._eventListenerTransformer=t||(t=>t)}addEventListener(t,e,r){if(!e)return;const i=t=>{const r=this._eventListenerTransformer(t);"function"==typeof e?e(r):e.handleEvent&&e.handleEvent(r)};this._listenerMap.has(t)||this._listenerMap.set(t,new Map),this._listenerMap.get(t).set(e,i),this._nativeAddEventListener(t,i,r)}removeEventListener(t,e,r){var i;if(!e)return;const n=null===(i=this._listenerMap.get(t))||void 0===i?void 0:i.get(e);n&&(this._nativeRemoveEventListener(t,n,r),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,r)=>{this._nativeRemoveEventListener(e,t,void 0)}))})),this._listenerMap.clear()}_nativeAddEventListener(t,e,r){throw new Error("_nativeAddEventListener must be implemented by derived classes")}_nativeRemoveEventListener(t,e,r){throw new Error("_nativeRemoveEventListener must be implemented by derived classes")}_nativeDispatchEvent(t){throw new Error("_nativeDispatchEvent must be implemented by derived classes")}}var ot=function(t,e,r,i){var n,s=arguments.length,o=s<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,e,r,i);else for(var a=t.length-1;a>=0;a--)(n=t[a])&&(o=(s<3?n(o):s>3?n(e,r,o):n(e,r))||o);return s>3&&o&&Object.defineProperty(e,r,o),o},at=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},lt=function(t,e){return function(r,i){e(r,i,t)}},ht=function(t,e,r,i){return new(r||(r=Promise))((function(n,s){function o(t){try{l(i.next(t))}catch(t){s(t)}}function a(t){try{l(i.throw(t))}catch(t){s(t)}}function l(t){var e;t.done?n(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(o,a)}l((i=i.apply(t,e||[])).next())}))};let ct=class extends st{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._performanceRAFList=[],this.eventListenerTransformer=t=>t,this.id=y.GenAutoIncrementId(),this.hooks={onSetEnv:new J(["lastEnv","env","global"])},this.measureTextMethod="native",this.optimizeVisible=!1}_nativeAddEventListener(t,e,r){return this._env||this.setEnv("browser"),this.envContribution.addEventListener(t,e,r)}_nativeRemoveEventListener(t,e,r){return this._env||this.setEnv("browser"),this.envContribution.removeEventListener(t,e,r)}_nativeDispatchEvent(t){return this._env||this.setEnv("browser"),this.envContribution.dispatchEvent(t)}bindContribution(t){const e=[];if(this.contributions.getContributions().forEach((r=>{const i=r.configure(this,t);i&&i.then&&e.push(i)})),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 r=this._env;this._env=t;const i=this.bindContribution(e);if(i&&i.then)return i.then((()=>{this.envParams=e,this.hooks.onSetEnv.call(r,t,this)}));this.envParams=e,this.hooks.onSetEnv.call(r,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()}getSpecifiedRequestAnimationFrame(t){this._env||this.setEnv("browser"),this._performanceRAFList[t]||(this._performanceRAFList[t]=new nt);const e=this._performanceRAFList[t];return t=>e.addAnimationFrameCb(t)}getSpecifiedCancelAnimationFrame(t){if(this._env||this.setEnv("browser"),!this._performanceRAFList[t])return()=>!1;const e=this._performanceRAFList[t];return t=>e.removeAnimationFrameCb(t)}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,r){return ht(this,void 0,void 0,(function*(){return this._env||this.setEnv("browser"),this.envContribution.loadFont(t,e,r)}))}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,e=!1){return this._env||this.setEnv("browser"),this.envContribution.getElementTop(t,e)}getElementLeft(t,e=!1){return this._env||this.setEnv("browser"),this.envContribution.getElementLeft(t,e)}getElementTopLeft(t,e=!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 ut;ct=ot([L(),lt(0,B(Y)),lt(0,P(tt)),at("design:paramtypes",[Object])],ct),function(t){t[t.estimate=0]="estimate",t[t.actualBounding=1]="actualBounding",t[t.fontBounding=2]="fontBounding"}(ut||(ut={}));var dt="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function pt(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function ft(t){if(t.__esModule)return t;var e=t.default;if("function"==typeof e){var r=function t(){if(this instanceof t){var r=[null];return r.push.apply(r,arguments),new(Function.bind.apply(e,r))}return e.apply(this,arguments)};r.prototype=e.prototype}else r={};return Object.defineProperty(r,"__esModule",{value:!0}),Object.keys(t).forEach((function(e){var i=Object.getOwnPropertyDescriptor(t,e);Object.defineProperty(r,e,i.get?i:{enumerable:!0,get:function(){return t[e]}})})),r}var gt={exports:{}};!function(t){var e=Object.prototype.hasOwnProperty,r="~";function i(){}function n(t,e,r){this.fn=t,this.context=e,this.once=r||!1}function s(t,e,i,s,o){if("function"!=typeof i)throw new TypeError("The listener must be a function");var a=new n(i,s||t,o),l=r?r+e:e;return t._events[l]?t._events[l].fn?t._events[l]=[t._events[l],a]:t._events[l].push(a):(t._events[l]=a,t._eventsCount++),t}function o(t,e){0==--t._eventsCount?t._events=new i:delete t._events[e]}function a(){this._events=new i,this._eventsCount=0}Object.create&&(i.prototype=Object.create(null),(new i).__proto__||(r=!1)),a.prototype.eventNames=function(){var t,i,n=[];if(0===this._eventsCount)return n;for(i in t=this._events)e.call(t,i)&&n.push(r?i.slice(1):i);return Object.getOwnPropertySymbols?n.concat(Object.getOwnPropertySymbols(t)):n},a.prototype.listeners=function(t){var e=r?r+t:t,i=this._events[e];if(!i)return[];if(i.fn)return[i.fn];for(var n=0,s=i.length,o=new Array(s);n<s;n++)o[n]=i[n].fn;return o},a.prototype.listenerCount=function(t){var e=r?r+t:t,i=this._events[e];return i?i.fn?1:i.length:0},a.prototype.emit=function(t,e,i,n,s,o){var a=r?r+t:t;if(!this._events[a])return!1;var l,h,c=this._events[a],u=arguments.length;if(c.fn){switch(c.once&&this.removeListener(t,c.fn,void 0,!0),u){case 1:return c.fn.call(c.context),!0;case 2:return c.fn.call(c.context,e),!0;case 3:return c.fn.call(c.context,e,i),!0;case 4:return c.fn.call(c.context,e,i,n),!0;case 5:return c.fn.call(c.context,e,i,n,s),!0;case 6:return c.fn.call(c.context,e,i,n,s,o),!0}for(h=1,l=new Array(u-1);h<u;h++)l[h-1]=arguments[h];c.fn.apply(c.context,l)}else{var d,p=c.length;for(h=0;h<p;h++)switch(c[h].once&&this.removeListener(t,c[h].fn,void 0,!0),u){case 1:c[h].fn.call(c[h].context);break;case 2:c[h].fn.call(c[h].context,e);break;case 3:c[h].fn.call(c[h].context,e,i);break;case 4:c[h].fn.call(c[h].context,e,i,n);break;default:if(!l)for(d=1,l=new Array(u-1);d<u;d++)l[d-1]=arguments[d];c[h].fn.apply(c[h].context,l)}}return!0},a.prototype.on=function(t,e,r){return s(this,t,e,r,!1)},a.prototype.once=function(t,e,r){return s(this,t,e,r,!0)},a.prototype.removeListener=function(t,e,i,n){var s=r?r+t:t;if(!this._events[s])return this;if(!e)return o(this,s),this;var a=this._events[s];if(a.fn)a.fn!==e||n&&!a.once||i&&a.context!==i||o(this,s);else{for(var l=0,h=[],c=a.length;l<c;l++)(a[l].fn!==e||n&&!a[l].once||i&&a[l].context!==i)&&h.push(a[l]);h.length?this._events[s]=1===h.length?h[0]:h:o(this,s)}return this},a.prototype.removeAllListeners=function(t){var e;return t?(e=r?r+t:t,this._events[e]&&o(this,e)):(this._events=new i,this._eventsCount=0),this},a.prototype.off=a.prototype.removeListener,a.prototype.addListener=a.prototype.on,a.prefixed=r,a.EventEmitter=a,t.exports=a}(gt);var mt=pt(gt.exports);var yt=(t,e)=>Object.prototype.toString.call(t)===`[object ${e}]`;var vt=(t,e=!1)=>e?"boolean"==typeof t:!0===t||!1===t||yt(t,"Boolean");var bt=t=>"function"==typeof t;var _t=t=>null==t;var wt=t=>null!=t;var xt=t=>{const e=typeof t;return null!==t&&"object"===e||"function"===e};var St=t=>"object"==typeof t&&null!==t;var Tt=function(t){if(!St(t)||!yt(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 kt=t=>void 0===t;var Ct=(t,e=!1)=>{const r=typeof t;return e?"string"===r:"string"===r||yt(t,"String")};var Et=t=>Array.isArray?Array.isArray(t):yt(t,"Array");var At=function(t){return null!==t&&"function"!=typeof t&&Number.isFinite(t.length)};var Ot=(t,e=!1)=>{const r=typeof t;return e?"number"===r:"number"===r||yt(t,"Number")};var Bt=t=>Ot(t)&&Number.isFinite(t);var Rt=t=>new RegExp(/^(http(s)?:\/\/)\w+[^\s]+(\.[^\s]+){1,}$/).test(t);var Lt=t=>new RegExp(/^data:image\/(?:gif|png|jpeg|bmp|webp|svg\+xml)(?:;charset=utf-8)?;base64,(?:[A-Za-z0-9]|[+/])+={0,2}/g).test(t);var Pt=t=>({}.toString.call(t).replace(/^\[object /,"").replace(/]$/,""));const Dt=Object.prototype;var Mt=function(t){const e=t&&t.constructor;return t===("function"==typeof e&&e.prototype||Dt)};const It=Object.prototype.hasOwnProperty;function Nt(t){if(_t(t))return!0;if(At(t))return!t.length;const e=Pt(t);if("Map"===e||"Set"===e)return!t.size;if(Mt(t))return!Object.keys(t).length;for(const e in t)if(It.call(t,e))return!1;return!0}const Ft=Object.prototype.hasOwnProperty;var jt=(t,e)=>null!=t&&Ft.call(t,e);function zt(t,e,r=!1,i=!1){if(e){if(t===e)return;if(wt(e)&&"object"==typeof e){const n=Object(e),s=[];for(const t in n)s.push(t);let{length:o}=s,a=-1;for(;o--;){const o=s[++a];!wt(n[o])||"object"!=typeof n[o]||i&&Et(t[o])?Wt(t,o,n[o]):Ht(t,e,o,r,i)}}}}function Ht(t,e,r,i=!1,n=!1){const s=t[r],o=e[r];let a=e[r],l=!0;if(Et(o)){if(i)a=[];else if(Et(s))a=s;else if(At(s)){a=new Array(s.length);let t=-1;const e=s.length;for(;++t<e;)a[t]=s[t]}}else Tt(o)?(a=null!=s?s:{},"function"!=typeof s&&"object"==typeof s||(a={})):l=!1;l&&zt(a,o,i,n),Wt(t,r,a)}function Wt(t,e,r){(void 0!==r&&!function(t,e){return t===e||Number.isNaN(t)&&Number.isNaN(e)}(t[e],r)||void 0===r&&!(e in t))&&(t[e]=r)}function Ut(t,...e){let r=-1;const i=e.length;for(;++r<i;)zt(t,e[r],!0);return t}function $t(t,e){if(!Et(t)||!Et(e))return!1;if(t.length!==e.length)return!1;for(let r=0;r<t.length;r++)if(t[r]!==e[r])return!1;return!0}const Vt="undefined"!=typeof console;function Gt(t,e,r){const i=[e].concat([].slice.call(r));Vt&&console[t].apply(console,i)}var Xt;!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"}(Xt||(Xt={}));class Yt{static getInstance(t,e){return Yt._instance&&Ot(t)?Yt._instance.level(t):Yt._instance||(Yt._instance=new Yt(t,e)),Yt._instance}static setInstance(t){return Yt._instance=t}static setInstanceLevel(t){Yt._instance?Yt._instance.level(t):Yt._instance=new Yt(t)}static clearInstance(){Yt._instance=null}constructor(t=Xt.None,e){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(...t){this._onErrorHandler.forEach((e=>e(...t)))}canLogInfo(){return this._level>=Xt.Info}canLogDebug(){return this._level>=Xt.Debug}canLogError(){return this._level>=Xt.Error}canLogWarn(){return this._level>=Xt.Warn}level(t){return arguments.length?(this._level=+t,this):this._level}error(...t){var e;return this._level>=Xt.Error&&(this._onErrorHandler.length?this.callErrorHandler(...t):Gt(null!==(e=this._method)&&void 0!==e?e:"error","ERROR",t)),this}warn(...t){return this._level>=Xt.Warn&&Gt(this._method||"warn","WARN",t),this}info(...t){return this._level>=Xt.Info&&Gt(this._method||"log","INFO",t),this}debug(...t){return this._level>=Xt.Debug&&Gt(this._method||"log","DEBUG",t),this}}Yt._instance=null;function qt(t,e,r=1e-10,i=1e-10){const n=i,s=r*Math.max(t,e);return Math.abs(t-e)<=Math.max(n,s)}var Zt=function(t,e,r){return t<e?e:t>r?r:t};var Kt=(t,e,r)=>{let[i,n]=t;n<i&&(i=t[1],n=t[0]);const s=n-i;return s>=r-e?[e,r]:(i=Math.min(Math.max(i,e),r-s),[i,i+s])};let Qt=!1;try{Qt="function"==typeof requestAnimationFrame&&"function"==typeof cancelAnimationFrame}catch(WS){Qt=!1}function Jt(t,e,r){let i,n,s,o,a,l,h=0,c=!1,u=!1,d=!0;const p=!e&&0!==e&&Qt;if("function"!=typeof t)throw new TypeError("Expected a function");function f(e){const r=i,s=n;return i=n=void 0,h=e,o=t.apply(s,r),o}function g(t,e){return p?(cancelAnimationFrame(a),requestAnimationFrame(t)):setTimeout(t,e)}function m(t){const r=t-l;return void 0===l||r>=e||r<0||u&&t-h>=s}function y(){const t=Date.now();if(m(t))return v(t);a=g(y,function(t){const r=t-h,i=e-(t-l);return u?Math.min(i,s-r):i}(t))}function v(t){return a=void 0,d&&i?f(t):(i=n=void 0,o)}function b(...t){const r=Date.now(),s=m(r);if(i=t,n=this,l=r,s){if(void 0===a)return function(t){return h=t,a=g(y,e),c?f(t):o}(l);if(u)return a=g(y,e),f(l)}return void 0===a&&(a=g(y,e)),o}return e=+e||0,xt(r)&&(c=!!r.leading,u="maxWait"in r,u&&(s=Math.max(Bt(r.maxWait)?r.maxWait:0,e)),d="trailing"in r?!!r.trailing:d),b.cancel=function(){void 0!==a&&function(t){if(p)return cancelAnimationFrame(t);clearTimeout(t)}(a),h=0,i=l=n=a=void 0},b.flush=function(){return void 0===a?o:v(Date.now())},b.pending=function(){return void 0!==a},b}Qt=!1;const te=1e-12,ee=Math.PI,re=ee/2,ie=2*ee,ne=2*Math.PI,se=Math.abs,oe=Math.atan2,ae=Math.cos,le=Math.max,he=Math.min,ce=Math.sin,ue=Math.sqrt,de=Math.pow;function pe(t,e,r,i,n){let s=r,o=i;return"number"==typeof t&&"number"==typeof r&&(s=(1-n)*t+n*r),"number"==typeof e&&"number"==typeof i&&(o=(1-n)*e+n*i),{x:s,y:o}}class fe{constructor(t=0,e=0,r,i){this.x=0,this.y=0,this.x=t,this.y=e,this.x1=r,this.y1=i}clone(){return new fe(this.x,this.y)}copyFrom(t){return this.x=t.x,this.y=t.y,this.x1=t.x1,this.y1=t.y1,this.defined=t.defined,this.context=t.context,this}set(t,e){return this.x=t,this.y=e,this}add(t){return Ot(t)?(this.x+=t,void(this.y+=t)):(this.x+=t.x,this.y+=t.y,this)}sub(t){return Ot(t)?(this.x-=t,void(this.y-=t)):(this.x-=t.x,this.y-=t.y,this)}multi(t){throw new Error("暂不支持")}div(t){throw new Error("暂不支持")}}class ge{static distancePP(t,e){return ue(de(t.x-e.x,2)+de(t.y-e.y,2))}static distanceNN(t,e,r,i){return ue(de(t-r,2)+de(e-i,2))}static distancePN(t,e,r){return ue(de(e-t.x,2)+de(r-t.y,2))}static pointAtPP(t,e,r){return new fe((e.x-t.x)*r+t.x,(e.y-t.y)*r+t.y)}}function me(t){return t*(Math.PI/180)}function ye(t,e,r){if(null===t)return e;if(null===e)return t;const{x11:i,x12:n,y11:s,y12:o,x21:a,x22:l,y21:h,y22:c}=be(t,e,r);return i>=l||n<=a||s>=c||o<=h?{x1:0,y1:0,x2:0,y2:0}:{x1:Math.max(i,a),y1:Math.max(s,h),x2:Math.min(n,l),y2:Math.min(o,c)}}var ve;!function(t){t[t.NONE=0]="NONE",t[t.BBOX1=1]="BBOX1",t[t.BBOX2=2]="BBOX2"}(ve||(ve={}));const be=(t,e,r)=>{let i=t.x1,n=t.x2,s=t.y1,o=t.y2,a=e.x1,l=e.x2,h=e.y1,c=e.y2;return r&&(i>n&&([i,n]=[n,i]),s>o&&([s,o]=[o,s]),a>l&&([a,l]=[l,a]),h>c&&([h,c]=[c,h])),{x11:i,x12:n,y11:s,y12:o,x21:a,x22:l,y21:h,y22:c}};function _e(t,e,r){if(!t||!e)return ve.NONE;const{x11:i,x12:n,y11:s,y12:o,x21:a,x22:l,y21:h,y22:c}=be(t,e,r);return i>a&&n<l&&s>h&&o<c?ve.BBOX1:a>i&&l<n&&h>s&&c<o?ve.BBOX2:ve.NONE}function we(t,e,r){if(t&&e){if(!r)return!(t.x1>e.x2||t.x2<e.x1||t.y1>e.y2||t.y2<e.y1);const{x11:i,x12:n,y11:s,y12:o,x21:a,x22:l,y21:h,y22:c}=be(t,e,!0);return!(i>l||n<a||s>c||o<h)}return!0}function xe(t,e){return Math.abs(e[0]*t[0]+e[1]*t[1])}function Se({x:t,y:e},r,i={x:0,y:0}){return{x:(t-i.x)*Math.cos(r)-(e-i.y)*Math.sin(r)+i.x,y:(t-i.x)*Math.sin(r)+(e-i.y)*Math.cos(r)+i.y}}function Te(t){return{x:(t.x1+t.x2)/2,y:(t.y1+t.y2)/2}}function ke(t,e){const r=e?me(t.angle):t.angle,i=Te(t);return[Se({x:t.x1,y:t.y1},r,i),Se({x:t.x2,y:t.y1},r,i),Se({x:t.x2,y:t.y2},r,i),Se({x:t.x1,y:t.y2},r,i)]}function Ce(t,e,r,i,n,s){if(s>e&&s>i||s<e&&s<i)return 0;if(i===e)return 0;const o=(s-e)/(i-e);let a=i<e?1:-1;1!==o&&0!==o||(a=i<e?.5:-.5);const l=o*(r-t)+t;return l===n?1/0:l>n?a:0}const Ee=t=>{let e=t.charCodeAt(0),r=2===t.length?t.charCodeAt(1):0,i=e;return 55296<=e&&e<=56319&&56320<=r&&r<=57343&&(e&=1023,r&=1023,i=e<<10|r,i+=65536),12288===i||65281<=i&&i<=65376||65504<=i&&i<=65510?"F":8361===i||65377<=i&&i<=65470||65474<=i&&i<=65479||65482<=i&&i<=65487||65490<=i&&i<=65495||65498<=i&&i<=65500||65512<=i&&i<=65518?"H":4352<=i&&i<=4447||4515<=i&&i<=4519||4602<=i&&i<=4607||9001<=i&&i<=9002||11904<=i&&i<=11929||11931<=i&&i<=12019||12032<=i&&i<=12245||12272<=i&&i<=12283||12289<=i&&i<=12350||12353<=i&&i<=12438||12441<=i&&i<=12543||12549<=i&&i<=12589||12593<=i&&i<=12686||12688<=i&&i<=12730||12736<=i&&i<=12771||12784<=i&&i<=12830||12832<=i&&i<=12871||12880<=i&&i<=13054||13056<=i&&i<=19903||19968<=i&&i<=42124||42128<=i&&i<=42182||43360<=i&&i<=43388||44032<=i&&i<=55203||55216<=i&&i<=55238||55243<=i&&i<=55291||63744<=i&&i<=64255||65040<=i&&i<=65049||65072<=i&&i<=65106||65108<=i&&i<=65126||65128<=i&&i<=65131||110592<=i&&i<=110593||127488<=i&&i<=127490||127504<=i&&i<=127546||127552<=i&&i<=127560||127568<=i&&i<=127569||131072<=i&&i<=194367||177984<=i&&i<=196605||196608<=i&&i<=262141?"W":32<=i&&i<=126||162<=i&&i<=163||165<=i&&i<=166||172===i||175===i||10214<=i&&i<=10221||10629<=i&&i<=10630?"Na":161===i||164===i||167<=i&&i<=168||170===i||173<=i&&i<=174||176<=i&&i<=180||182<=i&&i<=186||188<=i&&i<=191||198===i||208===i||215<=i&&i<=216||222<=i&&i<=225||230===i||232<=i&&i<=234||236<=i&&i<=237||240===i||242<=i&&i<=243||247<=i&&i<=250||252===i||254===i||257===i||273===i||275===i||283===i||294<=i&&i<=295||299===i||305<=i&&i<=307||312===i||319<=i&&i<=322||324===i||328<=i&&i<=331||333===i||338<=i&&i<=339||358<=i&&i<=359||363===i||462===i||464===i||466===i||468===i||470===i||472===i||474===i||476===i||593===i||609===i||708===i||711===i||713<=i&&i<=715||717===i||720===i||728<=i&&i<=731||733===i||735===i||768<=i&&i<=879||913<=i&&i<=929||931<=i&&i<=937||945<=i&&i<=961||963<=i&&i<=969||1025===i||1040<=i&&i<=1103||1105===i||8208===i||8211<=i&&i<=8214||8216<=i&&i<=8217||8220<=i&&i<=8221||8224<=i&&i<=8226||8228<=i&&i<=8231||8240===i||8242<=i&&i<=8243||8245===i||8251===i||8254===i||8308===i||8319===i||8321<=i&&i<=8324||8364===i||8451===i||8453===i||8457===i||8467===i||8470===i||8481<=i&&i<=8482||8486===i||8491===i||8531<=i&&i<=8532||8539<=i&&i<=8542||8544<=i&&i<=8555||8560<=i&&i<=8569||8585===i||8592<=i&&i<=8601||8632<=i&&i<=8633||8658===i||8660===i||8679===i||8704===i||8706<=i&&i<=8707||8711<=i&&i<=8712||8715===i||8719===i||8721===i||8725===i||8730===i||8733<=i&&i<=8736||8739===i||8741===i||8743<=i&&i<=8748||8750===i||8756<=i&&i<=8759||8764<=i&&i<=8765||8776===i||8780===i||8786===i||8800<=i&&i<=8801||8804<=i&&i<=8807||8810<=i&&i<=8811||8814<=i&&i<=8815||8834<=i&&i<=8835||8838<=i&&i<=8839||8853===i||8857===i||8869===i||8895===i||8978===i||9312<=i&&i<=9449||9451<=i&&i<=9547||9552<=i&&i<=9587||9600<=i&&i<=9615||9618<=i&&i<=9621||9632<=i&&i<=9633||9635<=i&&i<=9641||9650<=i&&i<=9651||9654<=i&&i<=9655||9660<=i&&i<=9661||9664<=i&&i<=9665||9670<=i&&i<=9672||9675===i||9678<=i&&i<=9681||9698<=i&&i<=9701||9711===i||9733<=i&&i<=9734||9737===i||9742<=i&&i<=9743||9748<=i&&i<=9749||9756===i||9758===i||9792===i||9794===i||9824<=i&&i<=9825||9827<=i&&i<=9829||9831<=i&&i<=9834||9836<=i&&i<=9837||9839===i||9886<=i&&i<=9887||9918<=i&&i<=9919||9924<=i&&i<=9933||9935<=i&&i<=9953||9955===i||9960<=i&&i<=9983||10045===i||10071===i||10102<=i&&i<=10111||11093<=i&&i<=11097||12872<=i&&i<=12879||57344<=i&&i<=63743||65024<=i&&i<=65039||65533===i||127232<=i&&i<=127242||127248<=i&&i<=127277||127280<=i&&i<=127337||127344<=i&&i<=127386||917760<=i&&i<=917999||983040<=i&&i<=1048573||1048576<=i&&i<=1114109?"A":"N"};function Ae(t,e={},r){r||(r=1);const{fontStyle:i=e.fontStyle,fontVariant:n=e.fontVariant,fontWeight:s=e.fontWeight,fontSize:o=e.fontSize,fontFamily:a=e.fontFamily}=t;return(i?i+" ":"")+(n?n+" ":"")+(s?s+" ":"")+o*r+"px "+(a||"sans-serif")}class Oe{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(),wt(t.specialCharSet)&&(this.specialCharSet=t.specialCharSet),this._standardMethod=wt(t.getTextBounds)?this.fullMeasure.bind(this):this.measureWithNaiveCanvas.bind(this)}initContext(){if(this._notSupportCanvas)return!1;if(_t(this._canvas)&&(wt(this._option.getCanvasForMeasure)&&(this._canvas=this._option.getCanvasForMeasure()),_t(this._canvas)&&"undefined"!=typeof window&&void 0!==window.document&&globalThis&&wt(globalThis.document)&&(this._canvas=globalThis.document.createElement("canvas"))),_t(this._context)&&wt(this._canvas)){const t=this._canvas.getContext("2d");wt(t)&&(t.save(),t.font=Ae(this.textSpec),this._contextSaved=!0,this._context=t)}return!_t(this._context)||(this._notSupportCanvas=!0,!1)}_initSpec(){var t,e,r;const{defaultFontParams:i={}}=this._option,{fontStyle:n=i.fontStyle,fontVariant:s=i.fontVariant,fontWeight:o=(null!==(t=i.fontWeight)&&void 0!==t?t:"normal"),fontSize:a=(null!==(e=i.fontSize)&&void 0!==e?e:12),fontFamily:l=(null!==(r=i.fontFamily)&&void 0!==r?r:"sans-serif"),align:h,textAlign:c=(null!=h?h:"center"),baseline:u,textBaseline:d=(null!=u?u:"middle"),ellipsis:p,limit:f}=this._userSpec;let{lineHeight:g=a}=this._userSpec;if(Ct(g)&&"%"===g[g.length-1]){const t=Number.parseFloat(g.substring(0,g.length-1))/100;g=a*t}return{fontStyle:n,fontVariant:s,fontFamily:l,fontSize:a,fontWeight:o,textAlign:c,textBaseline:d,ellipsis:p,limit:f,lineHeight:g}}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(_t(t))return{width:0,height:0};if(_t(this._option.getTextBounds)||!this._notSupportVRender)return this.measureWithNaiveCanvas(t);const{fontFamily:e,fontSize:r,fontWeight:i,textAlign:n,textBaseline:s,ellipsis:o,limit:a,lineHeight:l}=this.textSpec;let h;try{const c=this._option.getTextBounds({text:t,fontFamily:e,fontSize:r,fontWeight:i,textAlign:n,textBaseline:s,ellipsis:!!o,maxLineWidth:a||1/0,lineHeight:l});h={width:c.width(),height:c.height()}}catch(e){this._notSupportVRender=!0,h=this.measureWithNaiveCanvas(t)}return h}measureWithNaiveCanvas(t){return this._measureReduce(t,this._measureWithNaiveCanvas.bind(this))}_measureWithNaiveCanvas(t){var e;if(!this.initContext())return this._quickMeasureWithoutCanvas(t);const r=this._context.measureText(t),{fontSize:i,lineHeight:n}=this.textSpec;return{width:r.width,height:null!==(e=n)&&void 0!==e?e:i,fontBoundingBoxAscent:r.fontBoundingBoxAscent,fontBoundingBoxDescent:r.fontBoundingBoxDescent}}quickMeasure(t){return this._measureReduce(t,this._quickMeasure.bind(this))}_quickMeasure(t){const e={width:0,height:0};for(let r=0;r<t.length;r++){const i=t[r];let n=this._measureSpecialChar(i);_t(n)&&Oe.NUMBERS_CHAR_SET.includes(i)&&(n=this._measureNumberChar()),_t(n)&&["F","W"].includes(Ee(i))&&(n=this._measureFullSizeChar()),_t(n)&&(n=this._measureLetterChar()),e.width+=n.width,e.height=Math.max(e.height,n.height),!_t(n.fontBoundingBoxAscent)&&(e.fontBoundingBoxAscent=n.fontBoundingBoxAscent),!_t(n.fontBoundingBoxDescent)&&(e.fontBoundingBoxDescent=n.fontBoundingBoxDescent)}return e}quickMeasureWithoutCanvas(t){return this._measureReduce(t,this._quickMeasureWithoutCanvas.bind(this))}_quickMeasureWithoutCanvas(t){var e;const r={width:0,height:0},{fontSize:i,lineHeight:n}=this.textSpec;for(let e=0;e<t.length;e++){const n=t[e],s=["F","W"].includes(Ee(n))?1:.53;r.width+=s*i}return r.height=null!==(e=n)&&void 0!==e?e:i,r}_measureReduce(t,e){var r;const{fontSize:i,lineHeight:n}=this.textSpec,s={width:0,height:0};if(_t(t))return s;if(Et(t)){const o=t.filter(wt).map((t=>t.toString()));return 0===o.length?s:1===o.length?e(o[0]):{width:o.reduce(((t,r)=>Math.max(t,e(r).width)),0),height:o.length*((null!==(r=n)&&void 0!==r?r:i)+1)+1}}return e(t.toString())}_measureNumberChar(){if(_t(this._numberCharSize)){const t=this._standardMethod(Oe.NUMBERS_CHAR_SET);this._numberCharSize={width:t.width/Oe.NUMBERS_CHAR_SET.length,height:t.height,fontBoundingBoxAscent:t.fontBoundingBoxAscent,fontBoundingBoxDescent:t.fontBoundingBoxDescent}}return this._numberCharSize}_measureFullSizeChar(){return _t(this._fullCharSize)&&(this._fullCharSize=this._standardMethod(Oe.FULL_SIZE_CHAR)),this._fullCharSize}_measureLetterChar(){if(_t(this._letterCharSize)){const t=this._standardMethod(Oe.ALPHABET_CHAR_SET);this._letterCharSize={width:t.width/Oe.ALPHABET_CHAR_SET.length,height:t.height,fontBoundingBoxAscent:t.fontBoundingBoxAscent,fontBoundingBoxDescent:t.fontBoundingBoxDescent}}return this._letterCharSize}_measureSpecialChar(t){return wt(this._specialCharSizeMap[t])?this._specialCharSizeMap[t]:this.specialCharSet.includes(t)?(this._specialCharSizeMap[t]=this._standardMethod(t),this._specialCharSizeMap[t]):null}release(){wt(this._canvas)&&(this._canvas=null),wt(this._context)&&(this._contextSaved&&(this._context.restore(),this._contextSaved=!1),this._context=null)}}function Be(t,e,r){const{x1:i,y1:n,x2:s,y2:o}=e;return r.onlyTranslate()?(t!==e&&t.setValue(e.x1,e.y1,e.x2,e.y2),t.translate(r.e,r.f),e):(t.clear(),t.add(r.a*i+r.c*n+r.e,r.b*i+r.d*n+r.f),t.add(r.a*s+r.c*n+r.e,r.b*s+r.d*n+r.f),t.add(r.a*s+r.c*o+r.e,r.b*s+r.d*o+r.f),t.add(r.a*i+r.c*o+r.e,r.b*i+r.d*o+r.f),e)}Oe.ALPHABET_CHAR_SET="abcdefghijklmnopqrstuvwxyz",Oe.NUMBERS_CHAR_SET="0123456789",Oe.FULL_SIZE_CHAR="字";class Re{constructor(t){t?this.setValue(t.x1,t.y1,t.x2,t.y2):this.clear()}clone(){return new Re(this)}clear(){return this.x1=+Number.MAX_VALUE,this.y1=+Number.MAX_VALUE,this.x2=-Number.MAX_VALUE,this.y2=-Number.MAX_VALUE,this}empty(){return this.x1===+Number.MAX_VALUE&&this.y1===+Number.MAX_VALUE&&this.x2===-Number.MAX_VALUE&&this.y2===-Number.MAX_VALUE}equals(t){return this.x1===t.x1&&this.y1===t.y1&&this.x2===t.x2&&this.y2===t.y2}setValue(t=0,e=0,r=0,i=0){return this.x1=t,this.y1=e,this.x2=r,this.y2=i,this}set(t=0,e=0,r=0,i=0){return r<t?(this.x2=t,this.x1=r):(this.x1=t,this.x2=r),i<e?(this.y2=e,this.y1=i):(this.y1=e,this.y2=i),this}add(t=0,e=0){return t<this.x1&&(this.x1=t),e<this.y1&&(this.y1=e),t>this.x2&&(this.x2=t),e>this.y2&&(this.y2=e),this}expand(t=0){return Et(t)?(this.y1-=t[0],this.x2+=t[1],this.y2+=t[2],this.x1-=t[3]):(this.x1-=t,this.y1-=t,this.x2+=t,this.y2+=t),this}round(){return this.x1=Math.floor(this.x1),this.y1=Math.floor(this.y1),this.x2=Math.ceil(this.x2),this.y2=Math.ceil(this.y2),this}translate(t=0,e=0){return this.x1+=t,this.x2+=t,this.y1+=e,this.y2+=e,this}rotate(t=0,e=0,r=0){const i=this.rotatedPoints(t,e,r);return this.clear().add(i[0],i[1]).add(i[2],i[3]).add(i[4],i[5]).add(i[6],i[7])}scale(t=0,e=0,r=0,i=0){const n=this.scalePoints(t,e,r,i);return this.clear().add(n[0],n[1]).add(n[2],n[3])}union(t){return t.x1<this.x1&&(this.x1=t.x1),t.y1<this.y1&&(this.y1=t.y1),t.x2>this.x2&&(this.x2=t.x2),t.y2>this.y2&&(this.y2=t.y2),this}intersect(t){return t.x1>this.x1&&(this.x1=t.x1),t.y1>this.y1&&(this.y1=t.y1),t.x2<this.x2&&(this.x2=t.x2),t.y2<this.y2&&(this.y2=t.y2),this}encloses(t){return t&&this.x1<=t.x1&&this.x2>=t.x2&&this.y1<=t.y1&&this.y2>=t.y2}alignsWith(t){return t&&(this.x1===t.x1||this.x2===t.x2||this.y1===t.y1||this.y2===t.y2)}intersects(t){return t&&!(this.x2<t.x1||this.x1>t.x2||this.y2<t.y1||this.y1>t.y2)}contains(t=0,e=0){return!(t<this.x1||t>this.x2||e<this.y1||e>this.y2)}containsPoint(t){return!(t.x<this.x1||t.x>this.x2||t.y<this.y1||t.y>this.y2)}width(){return this.empty()?0:this.x2-this.x1}height(){return this.empty()?0:this.y2-this.y1}scaleX(t=0){return this.x1*=t,this.x2*=t,this}scaleY(t=0){return this.y1*=t,this.y2*=t,this}transformWithMatrix(t){return Be(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,r){const{x1:i,y1:n,x2:s,y2:o}=this,a=Math.cos(t),l=Math.sin(t),h=e-e*a+r*l,c=r-e*l-r*a;return[a*i-l*n+h,l*i+a*n+c,a*i-l*o+h,l*i+a*o+c,a*s-l*n+h,l*s+a*n+c,a*s-l*o+h,l*s+a*o+c]}scalePoints(t,e,r,i){const{x1:n,y1:s,x2:o,y2:a}=this;return[t*n+(1-t)*r,e*s+(1-e)*i,t*o+(1-t)*r,e*a+(1-e)*i]}}class Le extends Re{}class Pe extends Re{constructor(t,e=0){var r;super(t),t&&(this.angle=null!==(r=t.angle)&&void 0!==r?r:e)}intersects(t){return function(t,e,r=!1){const i=ke(t,r),n=ke(e,r),s=(t,e)=>[e.x-t.x,e.y-t.y],o=s(Te(t),Te(e)),a=s(i[0],i[1]),l=s(i[1],i[2]),h=s(n[0],n[1]),c=s(n[1],n[2]),u=r?me(t.angle):t.angle;let d=r?me(90-t.angle):t.angle+re;const p=r?me(e.angle):e.angle;let f=r?me(90-e.angle):e.angle+re;d>ne&&(d-=ne),f>ne&&(f-=ne);const g=(t,e,r,i)=>{const n=[Math.cos(e),Math.sin(e)];return t+(xe(n,r)+xe(n,i))/2>xe(n,o)};return g((t.x2-t.x1)/2,u,h,c)&&g((t.y2-t.y1)/2,d,h,c)&&g((e.x2-e.x1)/2,p,a,l)&&g((e.y2-e.y1)/2,f,a,l)}(this,t)}setValue(t=0,e=0,r=0,i=0,n=0){return super.setValue(t,e,r,i),this.angle=n,this}clone(){return new Pe(this)}getRotatedCorners(){const t={x:(this.x1+this.x2)/2,y:(this.y1+this.y2)/2};return[Se({x:this.x1,y:this.y1},this.angle,t),Se({x:this.x2,y:this.y1},this.angle,t),Se({x:this.x1,y:this.y2},this.angle,t),Se({x:this.x2,y:this.y2},this.angle,t)]}}class De{constructor(t=1,e=0,r=0,i=1,n=0,s=0){this.a=t,this.b=e,this.c=r,this.d=i,this.e=n,this.f=s}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,r,i,n,s){return!(this.e!==n||this.f!==s||this.a!==t||this.d!==i||this.b!==e||this.c!==r)}setValue(t,e,r,i,n,s){return this.a=t,this.b=e,this.c=r,this.d=i,this.e=n,this.f=s,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,r=this.c,i=this.d,n=this.e,s=this.f,o=new De,a=t*i-e*r;return o.a=i/a,o.b=-e/a,o.c=-r/a,o.d=t/a,o.e=(r*s-i*n)/a,o.f=-(t*s-e*n)/a,o}rotate(t){const e=Math.cos(t),r=Math.sin(t),i=this.a*e+this.c*r,n=this.b*e+this.d*r,s=this.a*-r+this.c*e,o=this.b*-r+this.d*e;return this.a=i,this.b=n,this.c=s,this.d=o,this}rotateByCenter(t,e,r){const i=Math.cos(t),n=Math.sin(t),s=(1-i)*e+n*r,o=(1-i)*r-n*e,a=i*this.a-n*this.b,l=n*this.a+i*this.b,h=i*this.c-n*this.d,c=n*this.c+i*this.d,u=i*this.e-n*this.f+s,d=n*this.e+i*this.f+o;return this.a=a,this.b=l,this.c=h,this.d=c,this.e=u,this.f=d,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,r,i,n,s){return this.multiply(t,e,r,i,n,s),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:r,d:i,e:n,f:s}=this;return this.a=e,this.b=t,this.c=i,this.d=r,this.e=s,this.f=n,this}multiply(t,e,r,i,n,s){const o=this.a,a=this.b,l=this.c,h=this.d,c=o*t+l*e,u=a*t+h*e,d=o*r+l*i,p=a*r+h*i,f=o*n+l*s+this.e,g=a*n+h*s+this.f;return this.a=c,this.b=u,this.c=d,this.d=p,this.e=f,this.f=g,this}interpolate(t,e){const r=new De;return r.a=this.a+(t.a-this.a)*e,r.b=this.b+(t.b-this.b)*e,r.c=this.c+(t.c-this.c)*e,r.d=this.d+(t.d-this.d)*e,r.e=this.e+(t.e-this.e)*e,r.f=this.f+(t.f-this.f)*e,r}transformPoint(t,e){const{a:r,b:i,c:n,d:s,e:o,f:a}=this,l=r*s-i*n,h=s/l,c=-i/l,u=-n/l,d=r/l,p=(n*a-s*o)/l,f=-(r*a-i*o)/l,{x:g,y:m}=t;e.x=g*h+m*u+p,e.y=g*c+m*d+f}onlyTranslate(t=1){return this.a===t&&0===this.b&&0===this.c&&this.d===t}clone(){return new De(this.a,this.b,this.c,this.d,this.e,this.f)}toTransformAttrs(){const t=this.a,e=this.b,r=this.c,i=this.d,n=t*i-e*r,s={x:this.e,y:this.f,rotateDeg:0,scaleX:0,scaleY:0,skewX:0,skewY:0};if(0!==t||0!==e){const o=Math.sqrt(t*t+e*e);s.rotateDeg=e>0?Math.acos(t/o):-Math.acos(t/o),s.scaleX=o,s.scaleY=n/o,s.skewX=(t*r+e*i)/n,s.skewY=0}else if(0!==r||0!==i){const o=Math.sqrt(r*r+i*i);s.rotateDeg=Math.PI/2-(i>0?Math.acos(-r/o):-Math.acos(r/o)),s.scaleX=n/o,s.scaleY=o,s.skewX=0,s.skewY=(t*r+e*i)/n}return s.rotateDeg=180*s.rotateDeg/Math.PI,s}}function Me(t){if(Bt(t))return[t,t,t,t];if(Et(t)){const e=t.length;if(1===e){const e=t[0];return[e,e,e,e]}if(2===e){const[e,r]=t;return[e,r,e,r]}if(3===e){const[e,r,i]=t;return[e,r,i,r]}if(4===e)return t}if(xt(t)){const{top:e=0,right:r=0,bottom:i=0,left:n=0}=t;return[e,r,i,n]}return[0,0,0,0]}const Ie=ie-1e-8;class Ne{constructor(t){this.init(t)}init(t){this.bounds=t}arc(t,e,r,i,n,s){if(Math.abs(n-i)>Ie)return this.bounds.add(t-r,e-r),void this.bounds.add(t+r,e+r);let o,a,l,h,c=1/0,u=-1/0,d=1/0,p=-1/0;function f(t){l=r*Math.cos(t),h=r*Math.sin(t),l<c&&(c=l),l>u&&(u=l),h<d&&(d=h),h>p&&(p=h)}if(f(i),f(n),n!==i)if((i%=ie)<0&&(i+=ie),(n%=ie)<0&&(n+=ie),n<i&&(s=!s,o=i,i=n,n=o),s)for(n-=ie,o=i-i%re,a=0;a<4&&o>n;++a,o-=re)f(o);else for(o=i-i%re+re,a=0;a<4&&o<n;++a,o+=re)f(o);this.bounds.add(t+c,e+d),this.bounds.add(t+u,e+p)}arcTo(t,e,r,i,n){this.bounds.add(t,e)}bezierCurveTo(t,e,r,i,n,s){this.bounds.add(t,e),this.bounds.add(r,i),this.bounds.add(n,s)}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,r,i){this.bounds.add(t,e),this.bounds.add(r,i)}rect(t,e,r,i){this.bounds.add(t,e),this.bounds.add(t+r,e+i)}clear(){this.bounds.clear()}release(...t){}}class Fe{constructor(){this._curves=[],this.bounds=new Le}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 je=/([-+]?((\d+\.\d+)|((\d+)|(\.\d+)))(?:[eE][-+]?\d+)?)/gi,ze={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},He={A:0,AT:1,C:2,Z:3,E:4,L:5,M:6,Q:7,R:8};let We,Ue,$e,Ve,Ge,Xe;var Ye,qe,Ze,Ke,Qe,Je;function tr(t){const e=t[0],r=t[1],i=t[2],n=t[3],s=t[4],o=t[5],a=t[6],l=t[7],h=l*s,c=-a*o,u=a*s,d=l*o,p=Math.cos(i),f=Math.sin(i),g=Math.cos(n),m=Math.sin(n),y=.5*(n-i),v=Math.sin(.5*y),b=8/3*v*v/Math.sin(y),_=e+p-b*f,w=r+f+b*p,x=e+g,S=r+m,T=x+b*m,k=S-b*g;return[h*_+c*w,u*_+d*w,h*T+c*k,u*T+d*k,h*x+c*S,u*x+d*S]}function er(t,e,r,i){const n=function(t,e,r,i,n,s,o,a,l){const h=me(o),c=Math.sin(h),u=Math.cos(h),d=u*(a-t)*.5+c*(l-e)*.5,p=u*(l-e)*.5-c*(a-t)*.5;let f=d*d/((r=Math.abs(r))*r)+p*p/((i=Math.abs(i))*i);f>1&&(f=Math.sqrt(f),r*=f,i*=f);const g=u/r,m=c/r,y=-c/i,v=u/i,b=g*a+m*l,_=y*a+v*l,w=g*t+m*e,x=y*t+v*e;let S=1/((w-b)*(w-b)+(x-_)*(x-_))-.25;S<0&&(S=0);let T=Math.sqrt(S);s===n&&(T=-T);const k=.5*(b+w)-T*(x-_),C=.5*(_+x)+T*(w-b),E=Math.atan2(_-C,b-k);let A=Math.atan2(x-C,w-k)-E;A<0&&1===s?A+=ie:A>0&&0===s&&(A-=ie);const O=Math.ceil(Math.abs(A/(re+.001))),B=[];for(let t=0;t<O;++t){const e=E+t*A/O,n=E+(t+1)*A/O;B[t]=[k,C,e,n,r,i,c,u]}return B}(i[5],i[6],i[0],i[1],i[3],i[4],i[2],e,r);for(let e=0;e<n.length;++e){const r=tr(n[e]);t.bezierCurveTo(r[0],r[1],r[2],r[3],r[4],r[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"}(Ye||(Ye={})),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.ROW=1]="ROW",t[t.COLUMN=2]="COLUMN"}(Ke||(Ke={})),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"}(Qe||(Qe={})),function(t){t[t.beforeFillStroke=0]="beforeFillStroke",t[t.afterFillStroke=1]="afterFillStroke"}(Je||(Je={}));const rr=[(t,e,r,i,n,s,o)=>e.arc(t[1]*n+r,t[2]*s+i,t[3]*(n+s)/2,t[4],t[5],t[6],o),(t,e,r,i,n,s,o)=>e.arcTo(t[1]*n+r,t[2]*s+i,t[3]*n+r,t[4]*s+i,t[5]*(n+s)/2,o),(t,e,r,i,n,s,o)=>e.bezierCurveTo(t[1]*n+r,t[2]*s+i,t[3]*n+r,t[4]*s+i,t[5]*n+r,t[6]*s+i,o),(t,e,r,i)=>e.closePath(),(t,e,r,i,n,s)=>e.ellipse(t[1]*n+r,t[2]*s+i,t[3]*n,t[4]*s,t[5],t[6],t[7],t[8]),(t,e,r,i,n,s,o)=>e.lineTo(t[1]*n+r,t[2]*s+i,o),(t,e,r,i,n,s,o)=>e.moveTo(t[1]*n+r,t[2]*s+i,o),(t,e,r,i,n,s,o)=>e.quadraticCurveTo(t[1]*n+r,t[2]*s+i,t[3]*n+r,t[4]*s+i,o),(t,e,r,i,n,s,o)=>e.rect(t[1]*n+r,t[2]*s+i,t[3]*n,t[4]*s,o)];function ir(t,e,r=0,i=0,n=1,s=1,o){for(let a=0;a<t.length;a++){const l=t[a];rr[l[0]](l,e,r,i,n,s,o)}}class nr{getLength(t){return null!=t?this.calcProjLength(t):(Number.isFinite(this.length)||(this.length=this.calcLength()),this.length)}}function sr(t,e){let r=0;const i=t.length;for(let n=0;n<i;n++){const s=t[n],o=e[n],a=t[(n+1)%i],l=e[(n+1)%i];r+=ge.distanceNN(s,o,a,l)}return r/2}function or(t,e,r,i,n){const s=1-n;return s*s*s*t+3*e*n*s*s+3*r*n*n*s+i*n*n*n}function ar(t,e,r,i,n){const s=or(t.x,e.x,r.x,i.x,n),o=or(t.y,e.y,r.y,i.y,n);return new fe(s,o)}function lr(t,e,r,i){const n=1-i;return n*n*t+2*n*i*e+i*i*r}function hr(t,e,r,i){const n=lr(t.x,e.x,r.x,i),s=lr(t.y,e.y,r.y,i);return new fe(n,s)}function cr(t,e){const{p0:r,p1:i,p2:n,p3:s}=t,o=ar(r,i,n,s,e),a=ge.pointAtPP(r,i,e),l=ge.pointAtPP(i,n,e),h=ge.pointAtPP(n,s,e),c=ge.pointAtPP(a,l,e),u=ge.pointAtPP(l,h,e);return[new ur(r,a,c,o),new ur(o,u,h,s)]}class ur extends nr{constructor(t,e,r,i){super(),this.type=Qe.CubicBezierCurve,this.p0=t,this.p1=e,this.p2=r,this.p3=i}_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 ar(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,r=this.p2,i=this.p3,sr([t.x,e.x,r.x,i.x],[t.y,e.y,r.y,i.y])):60;var t,e,r,i}calcProjLength(t){return t===Ke.ROW?se(this.p0.x-this.p3.x):t===Ke.COLUMN?se(this.p0.y-this.p3.y):0}getAngleAt(t){const e=le(t-.01,0),r=he(t+.01,1),i=this.getPointAt(e),n=this.getPointAt(r);return oe(n.y-i.y,n.x-i.x)}draw(t,e,r,i,n,s){if(t.moveTo(this.p0.x*i+e,this.p0.y*n+r),s>=1)t.bezierCurveTo(this.p1.x*i+e,this.p1.y*n+r,this.p2.x*i+e,this.p2.y*n+r,this.p3.x*i+e,this.p3.y*n+r);else if(s>0){const[o]=cr(this,s);t.bezierCurveTo(o.p1.x*i+e,o.p1.y*n+r,o.p2.x*i+e,o.p2.y*n+r,o.p3.x*i+e,o.p3.y*n+r)}}includeX(t){const e=he(this.p0.x,this.p1.x,this.p2.x,this.p3.x),r=le(this.p0.x,this.p1.x,this.p2.x,this.p3.x);return t>=e&&t<=r}getYAt(t){const e=he(this.p0.x,this.p1.x,this.p2.x,this.p3.x),r=(t-e)/(le(this.p0.x,this.p1.x,this.p2.x,this.p3.x)-e);return this.getPointAt(r).y}}function dr(t,e){const{p0:r,p1:i}=t,n=ge.pointAtPP(r,i,e);return[new pr(r,n),new pr(n,i)]}class pr extends nr{constructor(t,e){super(),this.type=Qe.LineCurve,this.p0=t,this.p1=e}getPointAt(t){if(!1!==this.defined)return ge.pointAtPP(this.p0,this.p1,t);throw new Error("defined为false的点不能getPointAt")}getAngleAt(t){return null==this.angle&&(this.angle=oe(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()?ge.distancePP(this.p0,this.p1):60}calcProjLength(t){return t===Ke.ROW?se(this.p0.x-this.p1.x):t===Ke.COLUMN?se(this.p0.y-this.p1.y):0}draw(t,e,r,i,n,s){if(t.moveTo(this.p0.x*i+e,this.p0.y*n+r),s>=1)t.lineTo(this.p1.x*i+e,this.p1.y*n+r);else if(s>0){const o=this.getPointAt(s);t.lineTo(o.x*i+e,o.y*n+r)}}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,r=this.p1;this.p0.x>this.p1.x&&(e=this.p1,r=this.p0);const i=(t-e.x)/(r.x-e.x);return e.y+i*(r.y-e.y)}return 1/0}}class fr{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,r,i,n,s,o,a){const l=new ur(new fe(this._lastX,this._lastY),new fe(t,e),new fe(r,i),new fe(n,s));l.originP1=this._lastOriginP,l.originP2=a,l.defined=o,this.curves.push(l),this._lastX=n,this._lastY=s,this._lastOriginP=a}closePath(){if(this.curves.length<2)return;const t=this.curves[this.curves.length-1];this.lineTo(this._startX,this._startY,t.defined,this._startOriginP)}ellipse(){throw new Error("SegContext不支持调用ellipse")}lineTo(t,e,r,i){const n=this.addLinearCurve(t,e,r,this._lastOriginP,i);this.curves.push(n),this._lastX=t,this._lastY=e,this._lastOriginP=i}moveTo(t,e,r){return this._lastX=this._startX=t,this._lastY=this._startY=e,this._lastOriginP=r,this._startOriginP=r,this}quadraticCurveTo(t,e,r,i){throw new Error("SegContext不支持调用quadraticCurveTo")}clear(){this.curves=[],this.length=NaN}tryUpdateLength(t){return this.getLength(t)}addLinearCurve(t,e,r,i,n){const s=new pr(new fe(this._lastX,this._lastY),new fe(t,e));return s.originP1=i,s.originP2=n,s.defined=r,s}getPointAt(t){throw new Error("暂未实现")}getCurveLengths(){return[]}getLength(t){var e,r;if(t===Ke.COLUMN){if(!this.curves.length)return 0;const t=this.curves[0],r=this.curves[this.curves.length-1],i=null!==(e=r.p3)&&void 0!==e?e:r.p1;return se(t.p0.y-i.y)}if(t===Ke.ROW){if(!this.curves.length)return 0;const t=this.curves[0],e=this.curves[this.curves.length-1],i=null!==(r=e.p3)&&void 0!==r?r:e.p1;return se(t.p0.x-i.x)}return Number.isFinite(this.length)||(this.length=this.curves.reduce(((t,e)=>t+e.getLength()),0)),this.length}}class gr extends fr{bezierCurveTo(t,e,r,i,n,s,o,a){return super.bezierCurveTo(e,t,i,r,s,n,o,a)}lineTo(t,e,r,i){return super.lineTo(e,t,r,i)}moveTo(t,e,r){return super.moveTo(e,t,r)}clear(){return super.clear()}}function mr(t,e,r=1){let i=!1;for(let r=0,n=e.length;r<=n;r++)r>=n===i&&((i=!i)?t.lineStart():t.lineEnd()),i&&t.point(e[r])}function yr(t,e,r){const i=null!=e?e:se(r[r.length-1].x-r[0].x)>se(r[r.length-1].y-r[0].y)?Ke.ROW:Ke.COLUMN;return"monotoneY"===t?new gr(t,i):new fr(t,i)}class vr{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,r=t.y;switch(this._point){case 0:this._point=1,this._line?this.context.lineTo(e,r,!1!==this._lastDefined&&!1!==t.defined,t):this.context.moveTo(e,r,t);break;case 1:this._point=2;default:this.context.lineTo(e,r,!1!==this._lastDefined&&!1!==t.defined,t)}this._lastDefined=t.defined}tryUpdateLength(){return this.context.tryUpdateLength()}}function br(t,e={}){const{direction:r,startPoint:i}=e;if(t.length<2-Number(!!i))return null;const n=yr("linear",r,t);return function(t,e){mr(t,e,1)}(new vr(n,i),t),n}function _r(t,e,r,i,n){t.context.bezierCurveTo((2*t._x0+t._x1)/3,(2*t._y0+t._y1)/3,(t._x0+2*t._x1)/3,(t._y0+2*t._y1)/3,(t._x0+4*t._x1+e)/6,(t._y0+4*t._y1+r)/6,i,t.lastPoint1)}class wr{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&&_r(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,r=t.y;switch(this._point){case 0:this._point=1,this._line?this.context.lineTo(e,r,!1!==this._lastDefined1&&!1!==this._lastDefined2,t):this.context.moveTo(e,r,t);break;case 1:this._point=2;break;default:_r(this,e,r,!1!==this._lastDefined1&&!1!==this._lastDefined2)}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=r,this._lastDefined1=this._lastDefined2,this._lastDefined2=t.defined,this.lastPoint0=this.lastPoint1,this.lastPoint1=t}tryUpdateLength(){return this.context.tryUpdateLength()}}function xr(t,e={}){const{direction:r,startPoint:i}=e;if(t.length<2-Number(!!i))return null;if(t.length<3-Number(!!i))return br(t,e);const n=yr("basis",r,t);return function(t,e){mr(t,e,2)}(new wr(n,i),t),n}function Sr(t){return t<0?-1:1}function Tr(t,e,r){const i=t._x1-t._x0,n=e-t._x1,s=(t._y1-t._y0)/(i||Number(n<0&&-0)),o=(r-t._y1)/(n||Number(i<0&&-0)),a=(s*n+o*i)/(i+n);return(Sr(s)+Sr(o))*Math.min(Math.abs(s),Math.abs(o),.5*Math.abs(a))||0}function kr(t,e){const r=t._x1-t._x0;return r?(3*(t._y1-t._y0)/r-e)/2:e}function Cr(t,e,r,i,n){const s=t._x0,o=t._y0,a=t._x1,l=t._y1,h=(a-s)/3;t.context.bezierCurveTo(s+h,o+h*e,a-h,l-h*r,a,l,i,t.lastPoint1)}class Er{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:Cr(this,this._t0,kr(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 r=t.x,i=t.y;switch(this._point){case 0:this._point=1,this._line?this.context.lineTo(r,i,!1!==this._lastDefined1&&!1!==this._lastDefined2,t):this.context.moveTo(r,i,t);break;case 1:this._point=2;break;case 2:this._point=3,Cr(this,kr(this,e=Tr(this,r,i)),e,!1!==this._lastDefined1&&!1!==this._lastDefined2);break;default:Cr(this,this._t0,e=Tr(this,r,i),!1!==this._lastDefined1&&!1!==this._lastDefined2)}this._x0=this._x1,this._x1=r,this._y0=this._y1,this._y1=i,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 Ar extends Er{constructor(t,e){super(t,e)}point(t){return super.point({y:t.x,x:t.y,defined:t.defined})}}function Or(t,e={}){const{direction:r,startPoint:i}=e;if(t.length<2-Number(!!i))return null;if(t.length<3-Number(!!i))return br(t,e);const n=yr("monotoneX",r,t);return function(t,e){mr(t,e,2)}(new Er(n,i),t),n}function Br(t,e={}){const{direction:r,startPoint:i}=e;if(t.length<2-Number(!!i))return null;if(t.length<3-Number(!!i))return br(t,e);const n=yr("monotoneY",r,t);return function(t,e){mr(t,e,2)}(new Ar(n,i),t),n}class Rr{constructor(t,e=.5,r){this.context=t,this._t=e,this.startPoint=r}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,r=t.y;switch(this._point){case 0:this._point=1,this._line?this.context.lineTo(e,r,!1!==this._lastDefined&&!1!==t.defined,t):this.context.moveTo(e,r,t);break;case 1:this._point=2;default:if(this._t<=0)this.context.lineTo(this._x,r,!1!==this._lastDefined&&!1!==t.defined,this.lastPoint),this.context.lineTo(e,r,!1!==this._lastDefined&&!1!==t.defined,t);else{const i=this._x*(1-this._t)+e*this._t;.5===this._t?this.context.lineTo(i,this._y,!1!==this._lastDefined,this.lastPoint):this.context.lineTo(i,this._y,!1!==this._lastDefined&&!1!==t.defined,this.lastPoint),this.context.lineTo(i,r,!1!==this._lastDefined&&!1!==t.defined,t)}}this._lastDefined=t.defined,this._x=e,this._y=r,this.lastPoint=t}tryUpdateLength(){return this.context.tryUpdateLength()}}class Lr extends Rr{lineEnd(){this.context.closePath()}}function Pr(t,e,r={}){const{direction:i,startPoint:n}=r;if(t.length<2-Number(!!n))return null;const s=new fr("step",null!=i?i:se(t[t.length-1].x-t[0].x)>se(t[t.length-1].y-t[0].y)?Ke.ROW:Ke.COLUMN);return Dr(new Rr(s,e,n),t),s}function Dr(t,e){return mr(t,e,1)}class Mr extends vr{lineEnd(){this.context.closePath()}}function Ir(t,e={}){const{direction:r,startPoint:i}=e;if(t.length<2-Number(!!i))return null;const n=yr("linear",r,t);return function(t,e){mr(t,e,1)}(new Mr(n,i),t),n}function Nr(t,e,r,i,n){let s=t._x1,o=t._y1,a=t._x2,l=t._y2;if(t._l01_a>te){const e=2*t._l01_2a+3*t._l01_a*t._l12_a+t._l12_2a,r=3*t._l01_a*(t._l01_a+t._l12_a);s=(s*e-t._x0*t._l12_2a+t._x2*t._l01_2a)/r,o=(o*e-t._y0*t._l12_2a+t._y2*t._l01_2a)/r}if(t._l23_a>te){const i=2*t._l23_2a+3*t._l23_a*t._l12_a+t._l12_2a,n=3*t._l23_a*(t._l23_a+t._l12_a);a=(a*i+t._x1*t._l23_2a-e*t._l12_2a)/n,l=(l*i+t._y1*t._l23_2a-r*t._l12_2a)/n}t.context.bezierCurveTo(s,o,a,l,t._x2,t._y2,i,t.lastPoint1)}function Fr(t,e){return function(r,i,n={}){const{direction:s,startPoint:o}=n;if(r.length<2-Number(!!o))return null;if(r.length<3-Number(!!o))return br(r,n);const a=yr(t,s,r);return mr(new e(a,i,o),r,2),a}}const jr=Fr("catmullRom",class{constructor(t,e=.5,r){this.context=t,this.startPoint=r,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:r}=t;if(this._point){const t=this._x2-e,i=this._y2-r;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(t*t+i*i,this._alpha))}switch(this._point){case 0:this._point=1,this._line?this.context.lineTo(e,r,!1!==this._lastDefined1&&!1!==this._lastDefined2):this.context.moveTo(e,r);break;case 1:this._point=2;break;case 2:this._point=3;default:Nr(this,e,r,!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=r,this._lastDefined1=this._lastDefined2,this._lastDefined2=t.defined,this.lastPoint0=this.lastPoint1,this.lastPoint1=t}tryUpdateLength(){return this.context.tryUpdateLength()}});const zr=Fr("catmullRomClosed",class{constructor(t,e=.5,r){this.context=t,this.startPoint=r,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:r}=t;if(this._point){const t=this._x2-e,i=this._y2-r;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(t*t+i*i,this._alpha))}switch(this._point){case 0:this._point=1,this._x3=e,this._y3=r;break;case 1:this._point=2,this.context.moveTo(this._x4=e,this._y4=r,t);break;case 2:this._point=3,this._x5=e,this._y5=r;break;default:Nr(this,e,r,!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=r,this._lastDefined1=this._lastDefined2,this._lastDefined2=t.defined,this.lastPoint0=this.lastPoint1,this.lastPoint1=t}tryUpdateLength(){return this.context.tryUpdateLength()}});class Hr extends nr{constructor(t,e,r){super(),this.type=Qe.QuadraticBezierCurve,this.p0=t,this.p1=e,this.p2=r}_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 hr(this.p0,this.p1,this.p2,t);throw new Error("defined为false的点不能getPointAt")}calcLength(){return this._validPoint()?(t=this.p0,e=this.p1,r=this.p2,sr([t.x,e.x,r.x],[t.y,e.y,r.y])):60;var t,e,r}calcProjLength(t){return t===Ke.ROW?se(this.p0.x-this.p2.x):t===Ke.COLUMN?se(this.p0.y-this.p2.y):0}getAngleAt(t){const e=le(t-.01,0),r=he(t+.01,1),i=this.getPointAt(e),n=this.getPointAt(r);return oe(n.y-i.y,n.x-i.x)}draw(t,e,r,i,n,s){if(t.moveTo(this.p0.x*i+e,this.p0.y*n+r),s>=1)t.quadraticCurveTo(this.p1.x*i+e,this.p1.y*n+r,this.p2.x*i+e,this.p2.y*n+r);else if(s>0){const[o]=function(t,e){const{p0:r,p1:i,p2:n}=t,s=hr(r,i,n,e),o=ge.pointAtPP(r,i,e),a=ge.pointAtPP(i,n,e);return[new Hr(r,o,s),new Hr(s,a,n)]}(this,s);t.quadraticCurveTo(o.p1.x*i+e,o.p1.y*n+r,o.p2.x*i+e,o.p2.y*n+r)}}getYAt(t){throw new Error("QuadraticBezierCurve暂不支持getYAt")}includeX(t){throw new Error("QuadraticBezierCurve暂不支持includeX")}}class Wr{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 r=this.addLinearCurve(t,e);this.path.addCurve(r),this._lastX=t,this._lastY=e}addLinearCurve(t,e){return new pr(new fe(this._lastX,this._lastY),new fe(t,e))}quadraticCurveTo(t,e,r,i){const n=new Hr(new fe(this._lastX,this._lastY),new fe(t,e),new fe(r,i));this.path.addCurve(n),this._lastX=r,this._lastY=i}bezierCurveTo(t,e,r,i,n,s){const o=new ur(new fe(this._lastX,this._lastY),new fe(t,e),new fe(r,i),new fe(n,s));this.path.addCurve(o),this._lastX=n,this._lastY=s}arcTo(t,e,r,i,n){throw new Error("CurveContext不支持调用arcTo")}ellipse(t,e,r,i,n,s,o,a){throw new Error("CurveContext不支持调用ellipse")}rect(t,e,r,i){throw new Error("CurveContext不支持调用rect")}arc(t,e,r,i,n,s){throw new Error("CurveContext不支持调用arc")}closePath(){this.path.curves.length<2||this.lineTo(this._startX,this._startY)}}function Ur(t,e,r){var i,n;switch(e){case"linear":default:return br(t,r);case"basis":return xr(t,r);case"monotoneX":return Or(t,r);case"monotoneY":return Br(t,r);case"step":return Pr(t,.5,r);case"stepClosed":return function(t,e,r={}){const{direction:i,startPoint:n}=r;if(t.length<2-Number(!!n))return null;const s=new fr("step",null!=i?i:se(t[t.length-1].x-t[0].x)>se(t[t.length-1].y-t[0].y)?Ke.ROW:Ke.COLUMN);return Dr(new Lr(s,e,n),t),s}(t,.5,r);case"stepBefore":return Pr(t,0,r);case"stepAfter":return Pr(t,1,r);case"catmullRom":return jr(t,null!==(i=null==r?void 0:r.curveTension)&&void 0!==i?i:.5,r);case"catmullRomClosed":return zr(t,null!==(n=null==r?void 0:r.curveTension)&&void 0!==n?n:.5,r);case"linearClosed":return Ir(t,r)}}class $r extends Fe{constructor(t){super(),this.commandList=[],t&&(this._ctx=t),this._boundsContext=new Ne(this.bounds)}get curves(){return this.tryBuildCurves()}setCtx(t){this._ctx=t}moveTo(t,e){return this.commandList.push([He.M,t,e]),this._ctx&&this._ctx.moveTo(t,e),this}lineTo(t,e){return this.commandList.push([He.L,t,e]),this._ctx&&this._ctx.lineTo(t,e),this}quadraticCurveTo(t,e,r,i){return this.commandList.push([He.Q,t,e,r,i]),this._ctx&&this._ctx.quadraticCurveTo(t,e,r,i),this}bezierCurveTo(t,e,r,i,n,s){return this.commandList.push([He.C,t,e,r,i,n,s]),this._ctx&&this._ctx.bezierCurveTo(t,e,r,i,n,s),this}arcTo(t,e,r,i,n){return this.commandList.push([He.AT,t,e,r,i,n]),this._ctx&&this._ctx.arcTo(t,e,r,i,n),this}ellipse(t,e,r,i,n,s,o,a){return this.commandList.push([He.E,t,e,r,i,n,s,o,a]),this._ctx&&this._ctx.ellipse(t,e,r,i,n,s,o,a),this}rect(t,e,r,i){return this.commandList.push([He.R,t,e,r,i]),this._ctx&&this._ctx.rect(t,e,r,i),this}arc(t,e,r,i,n,s){return this.commandList.push([He.A,t,e,r,i,n,s]),this._ctx&&this._ctx.arc(t,e,r,i,n,s),this}closePath(){return this.commandList.push([He.Z]),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 Wr(this);ir(this.commandList,t,0,0,1,1)}return this._curves}toString(){if(!this.toStringCbList){const t=[];t[He.M]=t=>`M${t[1]} ${t[2]}`,t[He.L]=t=>`L${t[1]} ${t[2]}`,t[He.Q]=t=>`Q${t[1]} ${t[2]} ${t[3]} ${t[4]}`,t[He.C]=t=>`C${t[1]} ${t[2]} ${t[3]} ${t[4]} ${t[5]} ${t[6]}`,t[He.A]=t=>{const e=[],r=t[1],i=t[2],n=t[3];((t,e,r,i,n,s,o,a=!1)=>{const l=2*Math.PI,h=(e%l+l)%l;let c,u=(r%l+l)%l;a?(u>=h&&(u-=l),c=u-h):(u<=h&&(u+=l),c=u-h);const d=Math.ceil(Math.abs(c)/(.5*Math.PI)),p=c/d;for(let e=0;e<d;e++){const r=h+p*e,l=h+p*(e+1),c=4/3*Math.tan(Math.abs(p)/4),u=Math.cos(r),d=Math.sin(r),f=Math.cos(l),g=Math.sin(l),m=u*s+i,y=d*o+n,v=f*s+i,b=g*o+n,_=a?-1:1,w=s*c*_,x=o*c*_;t.push(m-w*d,y+x*u,v+w*g,b-x*f,v,b)}})(e,t[4],t[5],r,i,n,n,t[6]);let s="";for(let t=0;t<e.length;t+=6)s+=`C${e[t]} ${e[t+1]} ${e[t+2]} ${e[t+3]} ${e[t+4]} ${e[t+5]}`;return s},t[He.R]=t=>`M${t[1]} ${t[2]} h${t[3]} v${t[4]} H${t[1]}Z`,t[He.Z]=t=>"Z",this.toStringCbList=t}const t=this.toStringCbList;let e="";return this.commandList.forEach((r=>{e+=t[r[0]](r)})),e}fromString(t,e,r,i,n){this.clear();const s=function(t){if(!t)return[];const e=t.match(/[mzlhvcsqta][^mzlhvcsqta]*/gi);if(null===e)return[];let r,i;const n=[];for(let t=0,s=e.length;t<s;t++)if(We=e[t],Ue=We.slice(1),$e=We[0],r=[$e],i=Ue.match(je),null!==i){for(let t=0,e=i.length;t<e;t++)Ve=i[t],Ge=parseFloat(Ve),Number.isNaN(Ge)||r.push(Ge);if(Xe=ze[$e],r.length-1>Xe){let t,e=$e;for(let i=1,s=r.length;i<s;i+=Xe){t=[e];for(let e=i,n=i+Xe;e<n;e++)t.push(r[e]);n.push(t),"m"===e?e="l":"M"===e&&(e="L")}}else n.push(r)}else n.push(r);return n}(t);return this._runCommandStrList(s,e,r,i,n),this._updateBounds(),this}fromLine(t){const{points:e,curveType:r,clipRangeByDimension:i}=t.attribute;if(!e)return;const n=Ur(e,r);"x"===i?this.direction=Ke.ROW:"y"===i?this.direction=Ke.COLUMN:"auto"===i&&(this.direction=n.direction),this._curves=n.curves}fromCustomPath2D(t,e,r,i,n){return this.clear(),this._runCommandList(t.commandList,e,r,i,n),this._updateBounds(),this}transform(t,e,r,i){const n=this.commandList;if(!this.transformCbList){const t=[];t[He.M]=this.moveToTransform,t[He.L]=this.lineToTransform,t[He.Q]=this.quadraticCurveToTransform,t[He.C]=this.bezierCurveToTransform,t[He.AT]=this.arcToTransform,t[He.E]=this.ellipseTransform,t[He.R]=this.rectTransform,t[He.A]=this.arcTransform,t[He.Z]=this.closePathTransform,this.transformCbList=t}n.forEach((n=>{this.transformCbList[n[0]](n,t,e,r,i)})),this._updateBounds()}moveToTransform(t,e,r,i,n){t[1]=t[1]*i+e,t[2]=t[2]*n+r}lineToTransform(t,e,r,i,n){t[1]=t[1]*i+e,t[2]=t[2]*n+r}quadraticCurveToTransform(t,e,r,i,n){t[1]=t[1]*i+e,t[2]=t[2]*n+r,t[3]=t[3]*i+e,t[4]=t[4]*n+r}bezierCurveToTransform(t,e,r,i,n){t[1]=t[1]*i+e,t[2]=t[2]*n+r,t[3]=t[3]*i+e,t[4]=t[4]*n+r,t[5]=t[5]*i+e,t[6]=t[6]*n+r}arcToTransform(t,e,r,i,n){t[1]=t[1]*i+e,t[2]=t[2]*n+r,t[3]=t[3]*i+e,t[4]=t[4]*n+r,t[5]=t[5]*(i+n)/2}ellipseTransform(t,e,r,i,n){t[1]=t[1]*i+e,t[2]=t[2]*n+r,t[3]=t[3]*i,t[4]=t[4]*n}rectTransform(t,e,r,i,n){t[1]=t[1]*i+e,t[2]=t[2]*n+r,t[3]=t[3]*i,t[4]=t[4]*n}arcTransform(t,e,r,i,n){t[1]=t[1]*i+e,t[2]=t[2]*n+r,t[3]=t[3]*(i+n)/2}closePathTransform(){}_runCommandStrList(t,e=0,r=0,i=1,n=1){let s,o,a,l,h,c=null,u=0,d=0,p=0,f=0;for(let g=0,m=t.length;g<m;++g){switch(s=t[g],1===i&&1===n||(s=Gr(s,i,n)),s[0]){case"l":u+=s[1],d+=s[2],this.lineTo(u+e,d+r);break;case"L":u=s[1],d=s[2],this.lineTo(u+e,d+r);break;case"h":u+=s[1],this.lineTo(u+e,d+r);break;case"H":u=s[1],this.lineTo(u+e,d+r);break;case"v":d+=s[1],this.lineTo(u+e,d+r);break;case"V":d=s[1],this.lineTo(u+e,d+r);break;case"m":u+=s[1],d+=s[2],this.moveTo(u+e,d+r);break;case"M":u=s[1],d=s[2],this.moveTo(u+e,d+r);break;case"c":o=u+s[5],a=d+s[6],p=u+s[3],f=d+s[4],this.bezierCurveTo(u+s[1]+e,d+s[2]+r,p+e,f+r,o+e,a+r),u=o,d=a;break;case"C":u=s[5],d=s[6],p=s[3],f=s[4],this.bezierCurveTo(s[1]+e,s[2]+r,p+e,f+r,u+e,d+r);break;case"s":o=u+s[3],a=d+s[4],null===c[0].match(/[CcSs]/)?(p=u,f=d):(p=2*u-p,f=2*d-f),l=u+s[1],h=d+s[2],this.bezierCurveTo(p+e,f+r,l+e,h+r,o+e,a+r),p=l,f=h,u=o,d=a;break;case"S":o=s[3],a=s[4],null===c[0].match(/[CcSs]/)?(p=u,f=d):(p=2*u-p,f=2*d-f),l=s[1],h=s[2],this.bezierCurveTo(p+e,f+r,l+e,h+r,o+e,a+r),p=l,f=h,u=o,d=a;break;case"q":o=u+s[3],a=d+s[4],p=u+s[1],f=d+s[2],this.quadraticCurveTo(p+e,f+r,o+e,a+r),u=o,d=a;break;case"Q":o=s[3],a=s[4],this.quadraticCurveTo(s[1]+e,s[2]+r,o+e,a+r),u=o,d=a,p=s[1],f=s[2];break;case"t":o=u+s[1],a=d+s[2],null===c[0].match(/[QqTt]/)?(p=u,f=d):"t"===c[0]?(p=2*u-l,f=2*d-h):"q"===c[0]&&(p=2*u-p,f=2*d-f),l=p,h=f,this.quadraticCurveTo(p+e,f+r,o+e,a+r),u=o,d=a,p=u+s[1],f=d+s[2];break;case"T":o=s[1],a=s[2],p=2*u-p,f=2*d-f,this.quadraticCurveTo(p+e,f+r,o+e,a+r),u=o,d=a;break;case"a":er(this,u+e,d+r,[s[1],s[2],s[3],s[4],s[5],s[6]+u+e,s[7]+d+r]),u+=s[6],d+=s[7];break;case"A":er(this,u+e,d+r,[s[1],s[2],s[3],s[4],s[5],s[6]+e,s[7]+r]),u=s[6],d=s[7];break;case"z":case"Z":this.closePath()}c=s}}_runCommandList(t,e=0,r=0,i=1,n=1){if(0!==e||0!==r||1!==i||1!==n)for(let s=0,o=t.length;s<o;++s){const o=t[s].slice();switch(o[0]){case He.L:this.lineToTransform(o,e,r,i,n);break;case He.M:this.moveToTransform(o,e,r,i,n);break;case He.C:this.bezierCurveToTransform(o,e,r,i,n);break;case He.Q:this.quadraticCurveToTransform(o,e,r,i,n);break;case He.A:this.arcToTransform(o,e,r,i,n);break;case He.E:this.ellipseTransform(o,e,r,i,n);break;case He.R:this.rectTransform(o,e,r,i,n);break;case He.AT:this.arcToTransform(o,e,r,i,n);break;case He.Z:this.closePath()}}else this.commandList=t.map((t=>t.slice()))}_updateBounds(){this.bounds.clear(),ir(this.commandList,this._boundsContext)}release(){this.commandList=[],this._boundsContext=null,this._ctx=null}getLength(){if(this.direction===Ke.COLUMN){if(!this._curves.length)return 0;const t=this._curves[0],e=this._curves[this._curves.length-1];return se(t.p0.y-e.p1.y)}if(this.direction===Ke.ROW){if(!this._curves.length)return 0;const t=this._curves[0],e=this._curves[this._curves.length-1];return se(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 r=this.curves[e];if(r.includeX(t))return r.getYAt(t)}return 1/0}getAttrAt(t){if(!this._curves)return{pos:{x:0,y:0},angle:0};let e,r=0;for(let i=0;i<this._curves.length;i++){e=this._curves[i];const n=e.getLength(this.direction);if(r+n>=t)break;r+=n}const i=(t-r)/e.getLength(this.direction);return{pos:e.getPointAt(i),angle:e.getAngleAt(i)}}drawWithClipRange(t,e,r,i,n){this.tryBuildCurves();const s=this.getLength()*n;let o=0;for(let n=0;n<this._curves.length;n++){const a=this._curves[n],l=a.getLength(this.direction);if(!(o+l<=s)){const n=1-(o+l-s)/l;a.draw(t,r,i,e,e,n);break}a.draw(t,r,i,e,e,1),o+=l}}}const Vr=["l",0,0,0,0,0,0,0];function Gr(t,e,r){const i=Vr[0]=t[0];if("a"===i||"A"===i)Vr[1]=e*t[1],Vr[2]=r*t[2],Vr[3]=t[3],Vr[4]=t[4],Vr[5]=t[5],Vr[6]=e*t[6],Vr[7]=r*t[7];else if("h"===i||"H"===i)Vr[1]=e*t[1];else if("v"===i||"V"===i)Vr[1]=r*t[1];else for(let i=1,n=t.length;i<n;++i)Vr[i]=(i%2==1?e:r)*t[i];return Vr}const Xr={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 De},Yr={strokeOpacity:1,lineDash:[],lineDashOffset:0,lineWidth:1,lineCap:"butt",lineJoin:"miter",miterLimit:10,strokeBoundsBuffer:2,stroke:!1},qr=Object.assign({outerBorder:Object.assign(Object.assign({},Yr),{distance:0}),innerBorder:Object.assign(Object.assign({},Yr),{distance:0})},Yr),Zr={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:ut.fontBounding,keepCenterInLine:!1},Kr=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}),qr),{alignSelf:"auto"}),{pickStrokeBuffer:0}),Qr={connectedType:"none",connectedStyle:{},connectedX:NaN,connectedY:NaN},Jr=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,roughStyle:null},{_debug_bounds:!1}),Kr),Xr),ti=Object.assign(Object.assign({},Jr),{startAngle:0,endAngle:ne,innerRadius:0,outerRadius:1,innerPadding:0,outerPadding:0,cornerRadius:0,padRadius:0,padAngle:0,cap:!1,forceShowCap:!1}),ei=Object.assign(Object.assign(Object.assign({},Jr),Qr),{points:[],segments:[],curveType:"linear",clipRange:1,closePath:!1,curveTension:1}),ri=Object.assign(Object.assign({},Jr),{radius:1,startAngle:0,endAngle:ne}),ii=Object.assign(Object.assign({},Jr),{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"}),ni=Object.assign(Object.assign({},Jr),{path:"",width:0,height:0,cornerRadius:0,clip:!1}),si=Object.assign(Object.assign(Object.assign({},Jr),Qr),{points:[],segments:[],curveType:"linear",clipRange:1,clipRangeByDimension:"default",closePath:!1,curveTension:1}),oi=Object.assign(Object.assign({},Jr),{path:new $r,fillStrokeOrder:1,clipRange:1,customPath:()=>{Yt.getInstance().warn("空函数")}}),ai=Object.assign(Object.assign({},Jr),{points:[],cornerRadius:0,closePath:!0}),li=Object.assign(Object.assign({},Jr),{width:100,height:100,spikes:5,thickness:.5}),hi=Object.assign(Object.assign({},Jr),{width:0,height:0,x1:0,y1:0,strokeBoundsBuffer:0,cornerRadius:0,cornerType:"round"});Object.assign(Object.assign({},Jr),{width:0,height:0,x1:0,y1:0,cornerRadius:0,length:0,cornerType:"round"});const ci=Object.assign(Object.assign({},Jr),{symbolType:"circle",size:10,keepDirIn3d:!0,clipRange:1}),ui=Object.assign(Object.assign(Object.assign({},Jr),Zr),{strokeBoundsBuffer:0,keepDirIn3d:!0}),di=Object.assign(Object.assign(Object.assign({},Jr),Zr),{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}),pi=Object.assign(Object.assign({repeatX:"no-repeat",repeatY:"no-repeat",image:"",width:0,height:0,maxWidth:500,maxHeight:500},Jr),{fill:!0,cornerRadius:0,cornerType:"round"}),fi=Object.assign(Object.assign({},pi),{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}),gi=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 r(t){const r=new Error(e+": "+t);throw r.source=e,r}function i(){return n("linear",t.linearGradient,s)||n("radial",t.radialGradient,a)||n("conic",t.conicGradient,o)}function n(e,i,n){return function(i,s){const o=y(i);if(o){y(t.startCall)||r("Missing (");const i=function(i){const s=n();return s&&(y(t.comma)||r("Missing comma before color stops")),{type:e,orientation:s,colorStops:d(p)}}();return y(t.endCall)||r("Missing )"),i}}(i)}function s(){return m("directional",t.sideOrCorner,1)||m("angular",t.angleValue,1)}function o(){return m("angular",t.fromAngleValue,1)}function a(){let r,i,n=l();return n&&(r=[],r.push(n),i=e,y(t.comma)&&(n=l(),n?r.push(n):e=i)),r}function l(){let t=function(){const t=m("shape",/^(circle)/i,0);return t&&(t.style=g()||h()),t}()||function(){const t=m("shape",/^(ellipse)/i,0);return t&&(t.style=f()||h()),t}();if(t)t.at=c();else{const e=h();if(e){t=e;const r=c();r&&(t.at=r)}else{const e=u();e&&(t={type:"default-radial",at:e})}}return t}function h(){return m("extent-keyword",t.extentKeywords,1)}function c(){if(m("position",/^at/,0)){const t=u();return t||r("Missing positioning value"),t}}function u(){const t={x:f(),y:f()};if(t.x||t.y)return{type:"position",value:t}}function d(e){let i=e();const n=[];if(i)for(n.push(i);y(t.comma);)i=e(),i?n.push(i):r("One extra comma");return n}function p(){const e=m("hex",t.hexColor,1)||m("rgba",t.rgbaColor,1)||m("rgb",t.rgbColor,1)||m("literal",t.literalColor,0);return e||r("Expected color definition"),e.length=f(),e}function f(){return m("%",t.percentageValue,1)||m("position-keyword",t.positionKeywords,1)||g()}function g(){return m("px",t.pixelValue,1)||m("em",t.emValue,1)}function m(t,e,r){const i=y(e);if(i)return{type:t,value:i[r]}}function y(t){const r=/^[\n\r\t\s]+/.exec(e);r&&v(r[0].length);const i=t.exec(e);return i&&v(i[0].length),i}function v(t){e=e.substr(t)}return function(t){return e=t.toString(),function(){const t=d(i);return e.length>0&&r("Invalid input not EOF"),t}()}}();class mi{static IsGradient(t){return!("string"==typeof t&&!t.includes("gradient"))}static IsGradientStr(t){return"string"==typeof t&&t.includes("gradient")}static Parse(t){if(mi.IsGradientStr(t))try{const e=gi(t)[0];if(e){if("linear"===e.type)return mi.ParseLinear(e);if("radial"===e.type)return mi.ParseRadial(e);if("conic"===e.type)return mi.ParseConic(e)}}catch(e){return t}return t}static ParseConic(t){const{orientation:e,colorStops:r=[]}=t,i=ee/2,n=parseFloat(e.value)/180*ee-i;return{gradient:"conical",x:.5,y:.5,startAngle:n,endAngle:n+ne,stops:r.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:r=[]}=t,i=ee/2;let n="angular"===e.type?parseFloat(e.value)/180*ee:0;for(;n<0;)n+=ne;for(;n>=ne;)n-=ne;let s=0,o=0,a=0,l=0;return n<i?(s=0,o=1,a=Math.sin(n),l=o-Math.cos(n)):n<ee?(s=0,o=0,a=Math.cos(n-i),l=Math.sin(n-i)):n<ee+i?(s=1,o=0,a=s-Math.sin(n-ee),l=Math.cos(n-ee)):(s=1,a=s-Math.cos(n-i-ee),l-=Math.sin(n-i-ee)),{gradient:"linear",x0:s,y0:o,x1:a,y1:l,stops:r.map((t=>({color:t.value,offset:parseFloat(t.length.value)/100})))}}}function yi(t,e,r){let i=e;const{a:n,b:s,c:o,d:a}=t.currentMatrix,l=Math.sign(n)*Math.sqrt(n*n+s*s),h=Math.sign(a)*Math.sqrt(o*o+a*a);return l+h===0?0:(i=i/Math.abs(l+h)*2*r,i)}function vi(t,e,r,i=0,n=0){var s,o,a,l;if(!e||!0===e)return"black";let h,c;if(Et(e))for(let t=0;t<e.length&&(c=e[t],!c);t++);else c=e;if(c=mi.Parse(c),"string"==typeof c)return c;if(r.AABBBounds&&(!r.attribute||0!==r.attribute.scaleX||0!==r.attribute.scaleY)){const e=r.AABBBounds;let u=e.x2-e.x1,d=e.y2-e.y1,p=e.x1-i,f=e.y1-n;if(r.attribute){const{scaleX:t=1,scaleY:e=1,angle:i=0}=r.attribute;u/=t,d/=e,p/=t,f/=e,(i||1!==t||1!==e)&&(p=null!==(s=r.x1WithoutTransform)&&void 0!==s?s:0,f=null!==(o=r.y1WithoutTransform)&&void 0!==o?o:0,u=null!==(a=r.widthWithoutTransform)&&void 0!==a?a:u,d=null!==(l=r.heightWithoutTransform)&&void 0!==l?l:d)}"linear"===c.gradient?h=function(t,e,r,i,n,s){var o,a,l,h;const c=t.createLinearGradient(r+(null!==(o=e.x0)&&void 0!==o?o:0)*n,i+(null!==(a=e.y0)&&void 0!==a?a:0)*s,r+(null!==(l=e.x1)&&void 0!==l?l:1)*n,i+(null!==(h=e.y1)&&void 0!==h?h:0)*s);return e.stops.forEach((t=>{c.addColorStop(t.offset,t.color)})),c}(t,c,p,f,u,d):"conical"===c.gradient?h=function(t,e,r,i,n,s){var o,a;const l=t.createConicGradient(r+(null!==(o=e.x)&&void 0!==o?o:0)*n,i+(null!==(a=e.y)&&void 0!==a?a:0)*s,e.startAngle,e.endAngle);return e.stops.forEach((t=>{l.addColorStop(t.offset,t.color)})),l.GetPattern?l.GetPattern(n+r,s+i,void 0):l}(t,c,p,f,u,d):"radial"===c.gradient&&(h=function(t,e,r,i,n,s){var o,a,l,h,c,u;const d=t.createRadialGradient(r+(null!==(o=e.x0)&&void 0!==o?o:.5)*n,i+(null!==(a=e.y0)&&void 0!==a?a:.5)*s,Math.max(n,s)*(null!==(l=e.r0)&&void 0!==l?l:0),r+(null!==(h=e.x1)&&void 0!==h?h:.5)*n,i+(null!==(c=e.y1)&&void 0!==c?c:.5)*s,Math.max(n,s)*(null!==(u=e.r1)&&void 0!==u?u:.5));return e.stops.forEach((t=>{d.addColorStop(t.offset,t.color)})),d}(t,c,p,f,u,d))}return h||"orange"}const bi=/\w|\(|\)|-/,_i=/[.?!,;:/,。?!、;:]/;function wi(t,e,r=!1){let i=e;for(;bi.test(t[i-1])&&bi.test(t[i])||_i.test(t[i]);)if(i--,i<=0)return r?xi(t,e):e;return i}function xi(t,e){let r=e;for(;bi.test(t[r+1])&&bi.test(t[r])||_i.test(t[r]);)if(r++,r>=t.length)return r;return r+1}var Si=function(t,e,r,i){var n,s=arguments.length,o=s<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,e,r,i);else for(var a=t.length-1;a>=0;a--)(n=t[a])&&(o=(s<3?n(o):s>3?n(e,r,o):n(e,r))||o);return s>3&&o&&Object.defineProperty(e,r,o),o};let Ti=class{configure(t,e){this.canvas=t.canvas,this.context=t.context,t.bindTextMeasure(this)}_measureTextWithoutAlignBaseline(t,e,r){this.context.setTextStyleWithoutAlignBaseline(e);const i=this.context.measureText(t);return r?this.compatibleMetrics(i,e):i}_measureTextWithAlignBaseline(t,e,r){this.context.setTextStyle(e);const i=this.context.measureText(t);return r?this.compatibleMetrics(i,e):i}compatibleMetrics(t,e){if(null==t.actualBoundingBoxAscent||null==t.actualBoundingBoxDescent||null==t.fontBoundingBoxAscent||null==t.fontBoundingBoxDescent){t={width:t.width};const{ascent:r,descent:i}=this.measureTextBoundADscentEstimate(e);t.actualBoundingBoxAscent=r,t.actualBoundingBoxDescent=i,t.fontBoundingBoxAscent=r,t.fontBoundingBoxDescent=i}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:r,right:i}=this.measureTextBoundLeftRightEstimate(e);t.actualBoundingBoxLeft=r,t.actualBoundingBoxRight=i}return t}estimate(t,{fontSize:e=ui.fontSize}){let r=0,i=0;for(let e=0;e<t.length;e++)t.charCodeAt(e)<128?r++:i++;return{width:~~(.8*r*e+i*e),height:e}}measureTextWidth(t,e,r){return this.context?(r=null!=r?r:this._measureTextWithoutAlignBaseline(t,e)).width:this.estimate(t,e).width}measureTextBoundsWidth(t,e,r){return this.context?(r=null!=r?r:this._measureTextWithoutAlignBaseline(t,e)).width:this.estimate(t,e).width}measureTextBoundsLeftRight(t,e,r){return this.context?{left:(r=null!=r?r:this._measureTextWithAlignBaseline(t,e,!0)).actualBoundingBoxLeft,right:r.actualBoundingBoxRight}:this.measureTextBoundLeftRightEstimate(e)}measureTextPixelHeight(t,e,r){var i;return this.context?(r=null!=r?r:this._measureTextWithoutAlignBaseline(t,e,!0),Math.abs(r.actualBoundingBoxAscent-r.actualBoundingBoxDescent)):null!==(i=e.fontSize)&&void 0!==i?i:Zr.fontSize}measureTextPixelADscent(t,e,r){return this.context?{ascent:(r=null!=r?r:this._measureTextWithAlignBaseline(t,e,!0)).actualBoundingBoxAscent,descent:r.actualBoundingBoxDescent}:this.measureTextBoundADscentEstimate(e)}measureTextBoundHieght(t,e,r){var i;return this.context?(r=null!=r?r:this._measureTextWithoutAlignBaseline(t,e,!0),Math.abs(r.fontBoundingBoxAscent-r.fontBoundingBoxDescent)):null!==(i=e.fontSize)&&void 0!==i?i:Zr.fontSize}measureTextBoundADscent(t,e,r){return this.context?{ascent:(r=null!=r?r:this._measureTextWithAlignBaseline(t,e,!0)).fontBoundingBoxAscent,descent:r.fontBoundingBoxDescent}:this.measureTextBoundADscentEstimate(e)}measureTextBoundADscentEstimate(t){var e;const r=null!==(e=t.fontSize)&&void 0!==e?e:Zr.fontSize;return{ascent:.79*r,descent:.21*r}}measureTextBoundLeftRightEstimate(t){var e;const r=null!==(e=t.fontSize)&&void 0!==e?e:Zr.fontSize,{textAlign:i}=t;return"center"===i?{left:r/2,right:r/2}:"right"===i||"end"===i?{left:r,right:0}:{left:0,right:r}}measureTextPixelADscentAndWidth(t,e,r){if(!this.context)return Object.assign(Object.assign({},this.measureTextBoundADscentEstimate(e)),{width:this.estimate(t,e).width});const i=this._measureTextWithoutAlignBaseline(t,e,!0);if(r===ut.actualBounding)return{ascent:i.actualBoundingBoxAscent,descent:i.actualBoundingBoxDescent,width:i.width};if(r===ut.estimate)return Object.assign(Object.assign({},this.measureTextBoundADscentEstimate(e)),{width:i.width});if(r===ut.fontBounding){let t=i.fontBoundingBoxAscent,e=i.fontBoundingBoxDescent;if(i.actualBoundingBoxDescent&&e<i.actualBoundingBoxDescent){const r=i.actualBoundingBoxDescent-e;e+=r,t-=r}else if(i.actualBoundingBoxAscent&&t<i.actualBoundingBoxAscent){const r=i.actualBoundingBoxAscent-t;t+=r,e-=r}return{ascent:t,descent:e,width:i.width}}return{ascent:i.actualBoundingBoxAscent,descent:i.actualBoundingBoxDescent,width:i.width}}measureText(t,e){return this.context?(this.context.setTextStyleWithoutAlignBaseline(e),this.context.measureText(t)):this.estimate(t,e)}clipTextVertical(t,e,r,i){if(0===t.length)return{verticalList:t,width:0};const{fontSize:n=12}=e;t.forEach((t=>{t.width=0===t.direction?n:this.measureTextWidth(t.text,e)}));const s=[];let o=0,a=0;for(;a<t.length&&o+t[a].width<r;a++)o+=t[a].width,s.push(t[a]);if(t[a]&&t[a].text.length>1){const n=this._clipText(t[a].text,e,r-o,0,t[a].text.length-1,"end",!1);if(i&&n.str!==t[a].text){let r="",i=0;for(let e=0;e<a;e++){const n=t[e];r+=n.text,i+=n.text.length}r+=t[a].text;let s=wi(r,i+n.str.length);s-=i,s!==n.str.length-1&&(n.str=n.str.substring(0,s),n.width=this.measureTextWidth(n.str,e))}s.push(Object.assign(Object.assign({},t[a]),{text:n.str,width:n.width})),o+=n.width}return{verticalList:s,width:o}}clipText(t,e,r,i,n){if(0===t.length)return{str:"",width:0};let s=this.measureTextWidth(t,e);if(s<=r)return{str:t,width:s};if(s=this.measureTextWidth(t[0],e),s>r)return{str:"",width:0};const o=this._clipText(t,e,r,0,t.length-1,"end",!1);if(i&&o.str!==t){let r=wi(t,o.str.length,n);r!==o.str.length&&(r>o.str.length&&(o.wordBreaked=r,r=o.str.length),o.str=t.substring(0,r),o.width=this.measureTextWidth(o.str,e))}return o}_clipText(t,e,r,i,n,s,o){let a;if("start"===s)a=this._clipTextStart(t,e,r,i,n),o&&(a.result=o+a.str);else if("middle"===s){const i=this._clipTextMiddle(t,e,r,"","",0,0,1);a={str:"none",width:i.width,result:i.left+o+i.right}}else a=this._clipTextEnd(t,e,r,i,n),o&&(a.result=a.str+o);return a}_clipTextEnd(t,e,r,i,n){if(i===n){Yt.getInstance().warn(`【_clipTextEnd】不应该走到这里${t}, ${i}, ${n}`);const r=t.substring(0,n+1);return{str:r,width:this.measureTextWidth(r,e)}}const s=Math.floor((i+n)/2),o=t.substring(0,s+1),a=this.measureTextWidth(o,e);let l;if(a>r){if(o.length<=1)return{str:"",width:0};const n=t.substring(0,s);return l=this.measureTextWidth(n,e),l<=r?{str:n,width:l}:this._clipTextEnd(t,e,r,i,s)}if(a<r){if(s>=t.length-1)return{str:t,width:this.measureTextWidth(t,e)};const i=t.substring(0,s+2);return l=this.measureTextWidth(i,e),l>=r?{str:o,width:a}:this._clipTextEnd(t,e,r,s,n)}return{str:o,width:a}}_clipTextStart(t,e,r,i,n){const s=Math.ceil((i+n)/2),o=t.substring(s-1,t.length),a=this.measureTextWidth(o,e);let l;if(a>r){if(o.length<=1)return{str:"",width:0};const i=t.substring(s,t.length);return l=this.measureTextWidth(i,e),l<=r?{str:i,width:l}:this._clipTextStart(t,e,r,s,t.length)}if(a<r){if(s<=0)return{str:t,width:this.measureTextWidth(t,e)};const n=t.substring(s-2,t.length);return l=this.measureTextWidth(n,e),l>=r?{str:o,width:a}:this._clipTextStart(t,e,r,i,s)}return{str:o,width:a}}_clipTextMiddle(t,e,r,i,n,s,o,a){const l=t.substring(0,a),h=this.measureTextWidth(l,e);if(h+o>r)return{left:i,right:n,width:s+o};const c=t.substring(t.length-a,t.length),u=this.measureTextWidth(c,e);return h+u>r?{left:l,right:n,width:h+o}:this._clipTextMiddle(t,e,r,l,c,h,u,a+1)}clipTextWithSuffixVertical(t,e,r,i,n,s){if(""===i)return this.clipTextVertical(t,e,r,n);if(0===t.length)return{verticalList:t,width:0};const o=this.clipTextVertical(t,e,r,n);if(o.verticalList.length===t.length&&o.verticalList[o.verticalList.length-1].width===t[t.length-1].width)return o;const a=this.measureTextWidth(i,e);if(a>r)return o;let l;if(r-=a,"start"===s){const s=this.revertVerticalList(t);l=this.clipTextVertical(s,e,r,n);const o=this.revertVerticalList(l.verticalList);o.unshift({text:i,direction:1,width:a}),l.verticalList=o}else if("middle"===s){const s=this.clipTextVertical(t,e,r/2,n),o=this.revertVerticalList(t),h=this.clipTextVertical(o,e,r/2,n);s.verticalList.push({text:i,direction:1,width:a}),this.revertVerticalList(h.verticalList).forEach((t=>s.verticalList.push(t))),l={verticalList:s.verticalList,width:s.width+h.width}}else l=this.clipTextVertical(t,e,r,n),l.verticalList.push({text:i,direction:1,width:a});return l.width+=a,l}revertVerticalList(t){return t.reverse().map((t=>{const e=t.text.split("").reverse().join("");return Object.assign(Object.assign({},t),{text:e})}))}clipTextWithSuffix(t,e,r,i,n,s,o=!1){if(""===i)return this.clipText(t,e,r,n);if(0===t.length)return{str:"",width:0};const a=this.measureTextWidth(t,e);if(!o&&a<=r)return{str:t,width:a};const l=this.measureTextWidth(i,e);if(l>r)return{str:"",width:0};if(o&&a+l<=r)return{str:t+i,width:a+l};r-=l;const h=this._clipText(t,e,r,0,t.length-1,s,i);if(n&&h.str!==t){const r=wi(t,h.str.length);r!==h.str.length&&(h.result=t.substring(0,r),h.width=this.measureTextWidth(h.str,e))}else o&&h.str===t&&(h.result=t+i);return h.str=h.result,h.width+=l,h}};Ti=Si([L()],Ti);var ki=function(t,e,r,i){var n,s=arguments.length,o=s<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,e,r,i);else for(var a=t.length-1;a>=0;a--)(n=t[a])&&(o=(s<3?n(o):s>3?n(e,r,o):n(e,r))||o);return s>3&&o&&Object.defineProperty(e,r,o),o};const Ci=Symbol.for("TextMeasureContribution");let Ei=class extends Ti{};Ei=ki([L()],Ei);const Ai=new class{constructor(t){const e=t||{};e.defaultScope=e.defaultScope||M,this.options=e,this.id=y.GenAutoIncrementId(),this._bindingDictionary=new Map,this._metadataReader=new U}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,r){const i=this._getNotAllArgs(t,!1,e,r);return this._get(i)}getNamed(t,e){return this.getTagged(t,b,e)}isBound(t){return this._bindingDictionary.has(t)}bind(t){const e=this.options.defaultScope,r=new W(t,e),i=this._bindingDictionary.get(t)||[];return i.push(r),this._bindingDictionary.set(t,i),new X(r)}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=>r=>{const i=this.bind(r);return t(i,e),i},r=()=>t=>this.unbind(t),i=()=>t=>this.isBound(t),n=e=>r=>{const i=this.rebind(r);return t(i,e),i};return t=>({bindFunction:e(t),isboundFunction:i(),rebindFunction:n(t),unbindFunction:r(),unbindAsyncFunction:t=>null})}_getNotAllArgs(t,e,r,i){return{avoidConstraints:!1,isMultiInject:e,serviceIdentifier:t,key:r,value:i}}_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:r}=this._metadataReader.getConstructorMetadata(e),i=Object.keys(r),n=[];for(let t=0;t<i.length;t++){const e=r[t],i={};e.forEach((t=>{i[t.key]=t.value}));const s={inject:i[w],multiInject:i[x]},o=s.inject||s.multiInject,a={serviceIdentifier:o,constructorArgsMetadata:e},l=(this._bindingDictionary.get(o)||[]).filter((t=>t.constraint(a)));if(l.length){const t={injectIdentifier:o,metadata:e,bindings:l};n.push(t)}}return n}_resolveFromBinding(t){const e=this._getResolvedFromBinding(t);return this._saveToScope(t,e),e}_getResolvedFromBinding(t){let e;switch(t.type){case I:case j:e=t.cache;break;case z: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 r=this._getChildRequest(t);return this._createInstance(e,r)}_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===D&&(t.cache=e,t.activated=!0)}},Oi=Symbol.for("CanvasFactory");function Bi(t){return Ai.getNamed(Oi,rt.global.env)(t)}const Ri=1e-4,Li=Math.sqrt(3),Pi=1/3;function Di(t){return t>-Yi&&t<Yi}function Mi(t){return t>Yi||t<-Yi}function Ii(t){return"number"==typeof t&&Number.isFinite(t)}const Ni=[0,0],Fi=[0,0],ji=[0,0];function zi(t,e){return(t[0]-e[0])*(t[0]-e[0])+(t[1]-e[1])*(t[1]-e[1])}function Hi(t,e,r,i){const n=1-i;return n*(n*t+2*i*e)+i*i*r}function Wi(t,e,r,i,n){const s=1-n;return s*s*(s*t+3*n*e)+n*n*(n*i+3*s*r)}function Ui(t){return(t%=ne)<0&&(t+=ne),t}function $i(t,e,r,i,n,s,o,a,l){if(0===o)return!1;const h=o;return!(l>e+h&&l>i+h&&l>s+h||l<e-h&&l<i-h&&l<s-h||a>t+h&&a>r+h&&a>n+h||a<t-h&&a<r-h&&a<n-h)&&function(t,e,r,i,n,s,o,a,l){let h=0,c=.005,u=1/0;Ni[0]=o,Ni[1]=a;for(let o=0;o<1;o+=.05){Fi[0]=Hi(t,r,n,o),Fi[1]=Hi(e,i,s,o);const a=zi(Ni,Fi);a<u&&(h=o,u=a)}u=1/0;for(let o=0;o<32&&!(c<Ri);o++){const o=h-c,a=h+c;Fi[0]=Hi(t,r,n,o),Fi[1]=Hi(e,i,s,o);const l=zi(Fi,Ni);if(o>=0&&l<u)h=o,u=l;else{ji[0]=Hi(t,r,n,a),ji[1]=Hi(e,i,s,a);const o=zi(ji,Ni);a<=1&&o<u?(h=a,u=o):c*=.5}}return l&&(l[0]=Hi(t,r,n,h),l[1]=Hi(e,i,s,h)),Math.sqrt(u)}(t,e,r,i,n,s,a,l,null)<=h/2}function Vi(t,e,r,i,n,s,o,a,l,h,c){if(0===l)return!1;const u=l;return!(c>e+u&&c>i+u&&c>s+u&&c>a+u||c<e-u&&c<i-u&&c<s-u&&c<a-u||h>t+u&&h>r+u&&h>n+u&&h>o+u||h<t-u&&h<r-u&&h<n-u&&h<o-u)&&function(t,e,r,i,n,s,o,a,l,h,c){let u,d,p,f,g=0,m=.005,y=1/0;Ni[0]=l,Ni[1]=h;for(let l=0;l<1;l+=.05)Fi[0]=Wi(t,r,n,o,l),Fi[1]=Wi(e,i,s,a,l),p=zi(Ni,Fi),p<y&&(g=l,y=p);y=1/0;for(let l=0;l<32&&!(m<Ri);l++)u=g-m,d=g+m,Fi[0]=Wi(t,r,n,o,u),Fi[1]=Wi(e,i,s,a,u),p=zi(Fi,Ni),u>=0&&p<y?(g=u,y=p):(ji[0]=Wi(t,r,n,o,d),ji[1]=Wi(e,i,s,a,d),f=zi(ji,Ni),d<=1&&f<y?(g=d,y=f):m*=.5);return c&&(c[0]=Wi(t,r,n,o,g),c[1]=Wi(e,i,s,a,g)),Math.sqrt(y)}(t,e,r,i,n,s,o,a,h,c,null)<=u/2}function Gi(t,e,r,i,n,s,o,a,l){if(0===o)return!1;const h=o;a-=t,l-=e;const c=Math.sqrt(a*a+l*l);if(c-h>r||c+h<r)return!1;if(Math.abs(i-n)%ne<1e-4)return!0;if(s){const t=i;i=Ui(n),n=Ui(t)}else i=Ui(i),n=Ui(n);i>n&&(n+=ne);let u=Math.atan2(l,a);return u<0&&(u+=ne),u>=i&&u<=n||u+ne>=i&&u+ne<=n}function Xi(t,e,r,i,n,s,o){if(0===n)return!1;const a=n,l=n/2;let h=0,c=t;if(o>e+l&&o>i+l||o<e-l&&o<i-l||s>t+l&&s>r+l||s<t-l&&s<r-l)return!1;if(t===r)return Math.abs(s-t)<=a/2;h=(e-i)/(t-r),c=(t*i-r*e)/(t-r);const u=h*s-o+c;return u*u/(h*h+1)<=a/2*a/2}const Yi=1e-4;function qi(t,e,r,i,n){const s=6*r-12*e+6*t,o=9*e+3*i-3*t-9*r,a=3*e-3*t;let l=0;if(Di(o)){if(Mi(s)){const t=-a/s;t>=0&&t<=1&&(n[l++]=t)}}else{const t=s*s-4*o*a;if(Di(t))n[0]=-s/(2*o);else if(t>0){const e=Math.sqrt(t),r=(-s+e)/(2*o),i=(-s-e)/(2*o);r>=0&&r<=1&&(n[l++]=r),i>=0&&i<=1&&(n[l++]=i)}}return l}const Zi=[-1,-1,-1],Ki=[-1,-1];function Qi(){const t=Ki[0];Ki[0]=Ki[1],Ki[1]=t}function Ji(t,e,r,i,n,s,o,a,l,h){if(h>e&&h>i&&h>s&&h>a||h<e&&h<i&&h<s&&h<a)return 0;const c=function(t,e,r,i,n,s){const o=i+3*(e-r)-t,a=3*(r-2*e+t),l=3*(e-t),h=t-n,c=a*a-3*o*l,u=a*l-9*o*h,d=l*l-3*a*h;let p=0;if(Di(c)&&Di(u))if(Di(a))s[0]=0;else{const t=-l/a;t>=0&&t<=1&&(s[p++]=t)}else{const t=u*u-4*c*d;if(Di(t)){const t=u/c,e=-a/o+t,r=-t/2;e>=0&&e<=1&&(s[p++]=e),r>=0&&r<=1&&(s[p++]=r)}else if(t>0){const e=Math.sqrt(t);let r=c*a+1.5*o*(-u+e),i=c*a+1.5*o*(-u-e);r=r<0?-Math.pow(-r,Pi):Math.pow(r,Pi),i=i<0?-Math.pow(-i,Pi):Math.pow(i,Pi);const n=(-a-(r+i))/(3*o);n>=0&&n<=1&&(s[p++]=n)}else{const t=(2*c*a-3*o*u)/(2*Math.sqrt(c*c*c)),e=Math.acos(t)/3,r=Math.sqrt(c),i=Math.cos(e),n=(-a-2*r*i)/(3*o),l=(-a+r*(i+Li*Math.sin(e)))/(3*o),h=(-a+r*(i-Li*Math.sin(e)))/(3*o);n>=0&&n<=1&&(s[p++]=n),l>=0&&l<=1&&(s[p++]=l),h>=0&&h<=1&&(s[p++]=h)}}return p}(e,i,s,a,h,Zi);if(0===c)return 0;let u=0,d=-1,p=0,f=0;for(let h=0;h<c;h++){const c=Zi[h],g=0===c||1===c?.5:1;Wi(t,r,n,o,c)<l||(d<0&&(d=qi(e,i,s,a,Ki),Ki[1]<Ki[0]&&d>1&&Qi(),p=Wi(e,i,s,a,Ki[0]),d>1&&(f=Wi(e,i,s,a,Ki[1]))),2===d?c<Ki[0]?u+=p<e?g:-g:c<Ki[1]?u+=f<p?g:-g:u+=a<f?g:-g:c<Ki[0]?u+=p<e?g:-g:u+=a<p?g:-g)}return u}function tn(t,e,r,i,n,s,o,a){if(a>e&&a>i&&a>s||a<e&&a<i&&a<s)return 0;const l=function(t,e,r,i,n){const s=t-2*e+r,o=2*(e-t),a=t-i;let l=0;if(Di(s)){if(Mi(o)){const t=-a/o;t>=0&&t<=1&&(n[l++]=t)}}else{const t=o*o-4*s*a;if(Di(t)){const t=-o/(2*s);t>=0&&t<=1&&(n[l++]=t)}else if(t>0){const e=Math.sqrt(t),r=(-o+e)/(2*s),i=(-o-e)/(2*s);r>=0&&r<=1&&(n[l++]=r),i>=0&&i<=1&&(n[l++]=i)}}return l}(e,i,s,a,Zi);if(0===l)return 0;const h=function(t,e,r){const i=t+r-2*e;return 0===i?.5:(t-e)/i}(e,i,s);if(h>=0&&h<=1){let a=0;const c=Hi(e,i,s,h);for(let i=0;i<l;i++){const l=0===Zi[i]||1===Zi[i]?.5:1;Hi(t,r,n,Zi[i])<o||(Zi[i]<h?a+=c<e?l:-l:a+=s<c?l:-l)}return a}const c=0===Zi[0]||1===Zi[0]?.5:1;return Hi(t,r,n,Zi[0])<o?0:s<e?c:-c}function en(t,e,r,i,n,s,o,a){if((a-=e)>r||a<-r)return 0;const l=Math.sqrt(r*r-a*a);Zi[0]=-l,Zi[1]=l;const h=Math.abs(i-n);if(h<1e-4)return 0;if(h>=ne-1e-4){i=0,n=ne;const e=s?1:-1;return o>=Zi[0]+t&&o<=Zi[1]+t?e:0}if(i>n){const t=i;i=n,n=t}i<0&&(i+=ne,n+=ne);let c=0;for(let e=0;e<2;e++){const r=Zi[e];if(r+t>o){let t=Math.atan2(a,r),e=s?1:-1;t<0&&(t=ne+t),(t>=i&&t<=n||t+ne>=i&&t+ne<=n)&&(t>ee/2&&t<1.5*ee&&(e=-e),c+=e)}}return c}function rn(t){return Math.round(t/ee*1e8)/1e8%2*ee}function nn(t,e){let r=rn(t[0]);r<0&&(r+=ne);const i=r-t[0];let n=t[1];n+=i,!e&&n-r>=ne?n=r+ne:e&&r-n>=ne?n=r-ne:!e&&r>n?n=r+(ne-rn(r-n)):e&&r<n&&(n=r-(ne-rn(n-r))),t[0]=r,t[1]=n}const sn=[0,0];function on(t,e,r,i,n){const s=t,o=t.length;let a,l,h=0,c=0,u=0,d=0,p=0;for(let t=0;t<o;t++){const o=s[t],f=0===t;o[0]===He.M&&t>1&&(r||(h+=Ce(c,u,d,p,i,n))),f&&(c=o[1],u=o[2],d=c,p=u);const g=o[0],m=o[1],y=o[2],v=o[3],b=o[4],_=o[5],w=o[6];let x=b,S=_;sn[0]=x,sn[1]=S,nn(sn,Boolean(o[6])),x=sn[0],S=sn[1];const T=x,k=S-x,C=!!(1-(o[6]?0:1)),E=(i-m)*v/v+m;switch(g){case He.M:d=m,p=y,c=d,u=p;break;case He.L:if(r){if(Xi(c,u,m,y,e,i,n))return!0}else h+=Ce(c,u,m,y,i,n)||0;c=m,u=y;break;case He.C:if(r){if(Vi(c,u,m,y,v,b,_,w,e,i,n))return!0}else h+=Ji(c,u,m,y,v,b,_,w,i,n)||0;c=_,u=w;break;case He.Q:if(r){if($i(c,u,m,y,v,b,e,i,n))return!0}else h+=tn(c,u,m,y,v,b,i,n)||0;c=v,u=b;break;case He.A:if(a=Math.cos(T)*v+m,l=Math.sin(T)*v+y,f?(d=a,p=l):h+=Ce(c,u,a,l,i,n),r){if(Gi(m,y,v,T,T+k,C,e,E,n))return!0}else h+=en(m,y,v,T,T+k,C,E,n);c=Math.cos(T+k)*v+m,u=Math.sin(T+k)*v+y;break;case He.R:if(d=c=m,p=u=y,a=d+v,l=p+b,r){if(Xi(d,p,a,p,e,i,n)||Xi(a,p,a,l,e,i,n)||Xi(a,l,d,l,e,i,n)||Xi(d,l,d,p,e,i,n))return!0}else h+=Ce(a,p,a,l,i,n),h+=Ce(d,l,d,p,i,n);break;case He.Z:if(r){if(Xi(c,u,d,p,e,i,n))return!0}else h+=Ce(c,u,d,p,i,n);c=d,u=p}}return r||(f=u,g=p,Math.abs(f-g)<Yi)||(h+=Ce(c,u,d,p,i,n)||0),0!==h;var f,g}const an=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=Bi(Object.assign({nativeCanvas:rt.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},r=Bi(Object.assign({nativeCanvas:rt.global.createCanvas(e)},e));return this.allocatedCanvas.push(r),r}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(...t){this.pools=[]}};var ln=function(t,e,r,i){var n,s=arguments.length,o=s<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,e,r,i);else for(var a=t.length-1;a>=0;a--)(n=t[a])&&(o=(s<3?n(o):s>3?n(e,r,o):n(e,r))||o);return s>3&&o&&Object.defineProperty(e,r,o),o},hn=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const cn=Symbol.for("VWindow"),un=Symbol.for("WindowHandlerContribution");let dn=class extends st{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 J(["x","y","width","height"])},this.active=()=>{const t=this.global;t.env&&!this.actived&&(Ai.getNamed(un,t.env).configure(this,t),this.actived=!0)},this._uid=y.GenAutoIncrementId(),this.global=rt.global,this.postInit()}_nativeAddEventListener(t,e,r){return this._handler.addEventListener(t,e,r)}_nativeRemoveEventListener(t,e,r){return this._handler.removeEventListener(t,e,r)}_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,r;this._handler.createWindow(t);const i=this._handler.getWH();this._width=i.width,this._height=i.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!==(r=t.height)&&void 0!==r?r: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,r,i,n,s){this._handler.setViewBoxTransform(t,e,r,i,n,s)}getViewBox(){return this._handler.getViewBox()}getViewBoxTransform(){return this._handler.getViewBoxTransform()}pointTransform(t,e){const r=this._handler.getViewBox(),i={x:t,y:e};return this._handler.getViewBoxTransform().transformPoint({x:t,y:e},i),i.x-=r.x1,i.y-=r.y1,i}hasSubView(){const t=this._handler.getViewBox();return!(0===t.x1&&0===t.y1&&qt(this.width,t.width())&&qt(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)}};dn=ln([L(),hn("design:paramtypes",[])],dn);var pn=function(t,e,r,i){var n,s=arguments.length,o=s<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,e,r,i);else for(var a=t.length-1;a>=0;a--)(n=t[a])&&(o=(s<3?n(o):s>3?n(e,r,o):n(e,r))||o);return s>3&&o&&Object.defineProperty(e,r,o),o},fn=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},gn=function(t,e){return function(r,i){e(r,i,t)}};let mn=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=rt.global,this.global.hooks.onSetEnv.tap("graphic-util",((t,e,r)=>{this.configured=!1,this.configure(r,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=an.shareCanvas();this._canvas=t,this._context=t.getContext("2d")}}bindTextMeasure(t){this._textMeasure=t}measureText(t,e,r="native"){var i;this.configure(this.global,this.global.env);const n=this.global.measureTextMethod;this.global.measureTextMethod=r;const s={width:this._textMeasure.measureTextWidth(t,e),height:null!==(i=e.fontSize)&&void 0!==i?i:Zr.fontSize};return this.global.measureTextMethod=n,s}createTextMeasureInstance(t,e,r){return this.configure(this.global,this.global.env),new Oe(Object.assign({defaultFontParams:{fontFamily:Zr.fontFamily,fontSize:Zr.fontSize},getCanvasForMeasure:r||(()=>this.canvas),getTextBounds:void 0,specialCharSet:"-/: .,@%'\"~"+Oe.ALPHABET_CHAR_SET+Oe.ALPHABET_CHAR_SET.toUpperCase()},null!=e?e:{}),t)}drawGraphicToCanvas(t,e,r){if(!e.defaultLayer)return null;const i=Ai.get(cn),n=t.AABBBounds,s=n.width(),o=n.height(),a=-n.x1,l=-n.y1;i.create({viewBox:{x1:a,y1:l,x2:n.x2,y2:n.y2},width:s,height:o,canvas:r,dpr:e.window.dpr,canvasControled:!0,offscreen:!0,title:""});const h=e.params.optimize.disableCheckGraphicWidthOutRange;e.params.optimize.disableCheckGraphicWidthOutRange=!0,e.defaultLayer.getNativeHandler().drawTo(i,[t],{transMatrix:i.getViewBoxTransform(),viewBox:i.getViewBox(),stage:e,layer:e.defaultLayer,renderService:e.renderService,background:"transparent",clear:!0,updateBounds:!1}),e.params.optimize.disableCheckGraphicWidthOutRange=h;const c=i.getNativeHandler();return c.nativeCanvas?c.nativeCanvas:null}};var yn;mn=pn([L(),gn(0,B(Y)),gn(0,P(Ci)),fn("design:paramtypes",[Object])],mn),function(t){t[t.transform=0]="transform",t[t.matrix=1]="matrix"}(yn||(yn={}));const vn=new De;let bn=class{constructor(){this.matrix=new De}init(t){return this.mode=yn.transform,this.originTransform=t,this.matrix.reset(),this}fromMatrix(t,e){return this.mode=yn.matrix,this.outSourceMatrix=t,this.outTargetMatrix=e,this}scaleMatrix(t,e,r){const i=this.outSourceMatrix;if(vn.setValue(i.a,i.b,i.c,i.d,i.e,i.f),this.outTargetMatrix.reset(),r){const{x:i,y:n}=r;this.outTargetMatrix.translate(i,n),this.outTargetMatrix.scale(t,e),this.outTargetMatrix.translate(-i,-n)}else this.outTargetMatrix.scale(t,e);return this.outTargetMatrix.multiply(vn.a,vn.b,vn.c,vn.d,vn.e,vn.f),this}rotateMatrix(t,e){const r=this.outSourceMatrix;if(vn.setValue(r.a,r.b,r.c,r.d,r.e,r.f),this.outTargetMatrix.reset(),e){const{x:r,y:i}=e;this.outTargetMatrix.translate(r,i),this.outTargetMatrix.rotate(t),this.outTargetMatrix.translate(-r,-i)}else this.outTargetMatrix.rotate(t);return this.outTargetMatrix.multiply(vn.a,vn.b,vn.c,vn.d,vn.e,vn.f),this}scale(t,e,r){return this.mode===yn.matrix?this.scaleMatrix(t,e,r):this}rotate(t,e){return this.mode===yn.matrix?this.rotateMatrix(t,e):this}translateMatrix(t,e){const r=this.outSourceMatrix;return vn.setValue(r.a,r.b,r.c,r.d,r.e,r.f),this.outTargetMatrix.reset(),this.outTargetMatrix.translate(t,e),this.outTargetMatrix.multiply(vn.a,vn.b,vn.c,vn.d,vn.e,vn.f),this}translate(t,e){return this.mode===yn.matrix?this.translateMatrix(t,e):this}simplify(t){return this.mode===yn.matrix?this.simplifyMatrix(t):this}simplifyMatrix(t){return this}};bn=pn([L(),fn("design:paramtypes",[])],bn);const _n={arc:ti,area:ei,circle:ri,line:si,path:oi,symbol:ci,text:ui,rect:hi,polygon:ai,star:li,richtext:di,richtextIcon:fi,image:pi,group:ii,glyph:ni},wn=Object.keys(_n);function xn(t,e){Object.keys(e).forEach((r=>{t[r]=e[r]}))}const Sn={arc:Object.assign({},_n.arc),area:Object.assign({},_n.area),circle:Object.assign({},_n.circle),line:Object.assign({},_n.line),path:Object.assign({},_n.path),symbol:Object.assign({},_n.symbol),text:Object.assign({},_n.text),rect:Object.assign({},_n.rect),polygon:Object.assign({},_n.polygon),star:Object.assign({},_n.star),richtext:Object.assign({},_n.richtext),richtextIcon:Object.assign({},_n.richtextIcon),image:Object.assign({},_n.image),group:Object.assign({},_n.group),glyph:Object.assign({},_n.glyph)};class Tn{constructor(){this.initTheme(),this.dirty=!1}initTheme(){this._defaultTheme={},wn.forEach((t=>{this._defaultTheme[t]=Object.create(Sn[t])})),this.combinedTheme=this._defaultTheme}getTheme(t){if(!t)return this.combinedTheme;if(!this.dirty)return this.combinedTheme;let e={};const r=this.getParentWithTheme(t);return r&&(e=r.theme),this.applyTheme(t,e),this.combinedTheme}getParentWithTheme(t){for(;t.parent;)if((t=t.parent).theme)return t;return null}applyTheme(t,e,r=!1){if(this.dirty){const i=this.getParentWithTheme(t);if(i){const t=i.theme;(t.dirty||r)&&t.applyTheme(i,e,!0)}this.userTheme?this.doCombine(i&&i.theme.combinedTheme):(i?this.combinedTheme=i.theme.combinedTheme:(this.combinedTheme=this._defaultTheme,Yt.getInstance().warn("未知错误,走到不应该走的区域里")),this.dirty=!1)}return this.combinedTheme}doCombine(t){const e=this.userTheme,r=this.combinedTheme;wn.forEach((i=>{const n=Object.create(Sn[i]);t&&t[i]&&xn(n,t[i]),r[i]&&xn(n,r[i]),e[i]&&xn(n,e[i]),this.combinedTheme[i]=n})),e.common&&wn.forEach((t=>{xn(this.combinedTheme[t],e.common)})),this.dirty=!1}setTheme(t,e){let r=this.userTheme;r?Object.keys(t).forEach((e=>{r[e]?Object.assign(r[e],t[e]):r[e]=Object.assign({},t[e])})):r=t,this.userTheme=r,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 kn=new Tn;function Cn(t,e){return t.glyphHost?Cn(t.glyphHost):e?(t.isContainer,e):function(t){let e;if(e=t.isContainer?t:t.parent,e){for(;e&&!e.theme;)e=e.parent;return e?(e.theme||e.createTheme(),e.theme.getTheme(e)):kn.getTheme()}return null}(t)||t.attachedThemeGraphic&&Cn(t.attachedThemeGraphic)||kn.getTheme()}var En=function(t,e,r,i){return new(r||(r=Promise))((function(n,s){function o(t){try{l(i.next(t))}catch(t){s(t)}}function a(t){try{l(i.throw(t))}catch(t){s(t)}}function l(t){var e;t.done?n(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(o,a)}l((i=i.apply(t,e||[])).next())}))};class An extends mt{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=y.GenAutoIncrementId(),this._firstChild=null,this._lastChild=null,this.parent=null,this._count=1}forEachChildren(t,e=!1){if(e){let e=this._lastChild,r=0;for(;e;){if(t(e,r++))return;e=e._prev}}else{let e=this._firstChild,r=0;for(;e;){if(t(e,r++))return;e=e._next}}}forEachChildrenAsync(t,e=!1){return En(this,void 0,void 0,(function*(){if(e){let e=this._lastChild,r=0;for(;e;){let i=t(e,r++);if(i.then&&(i=yield i),i)return;e=e._prev}}else{let e=this._firstChild,r=0;for(;e;){let i=t(e,r++);if(i.then&&(i=yield i),i)return;e=e._next}}}))}forEach(t){return this.forEachChildren(t)}appendChild(t,e=!0){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,e=!1){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&&Yt.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 r=this._firstChild;for(let t=0;t<e;t++){if(!r)return null;t>0&&(r=r._next)}if(!r)return null;t._next=r._next,t._prev=r,r._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 r=this._nodeList[e];return this._nodeList.splice(e,0,t),this.insertBefore(t,r)}let r;this._nodeList[e]=t;for(let t=e-1;t>=0&&(r=this._nodeList[t],!r);t--);if(r)return r._next?this.insertBefore(t,r._next):this.appendChild(t);this._ignoreWarn=!0;const i=this.insertInto(t,0);return this._ignoreWarn=!1,i}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,e=!1){let r=null;return this.forEachChildren(((e,i)=>!(e===this||!t(e,i)||(r=e,0)))),e&&this.forEachChildren((e=>{if(e.isContainer){const i=e.find(t,!0);if(i)return r=i,!0}return!1})),r}findAll(t,e=!1){let r=[];return this.forEachChildren(((e,i)=>{e!==this&&t(e,i)&&r.push(e)})),e&&this.forEachChildren((e=>{if(e.isContainer){const i=e.findAll(t,!0);i.length&&(r=r.concat(i))}})),r}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,e=!1){return this.find((e=>e.name===t),e)}getChildAt(t){let e=this._firstChild;if(!e)return null;for(let r=0;r<t;r++){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 r=this._firstChild;for(;r;)r[t]=e,r.setAllDescendantsProps(t,e),r=r._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,r){const i=vt(r,!0)&&r||xt(r)&&r.capture,n=xt(r)&&r.once,s=bt(e)?void 0:e;return t=i?`${t}capture`:t,e=bt(e)?e:e.handleEvent,n?super.once(t,e,s):super.on(t,e,s),this}on(t,e,r){return this.addEventListener(t,e,r)}removeEventListener(t,e,r){const i=vt(r,!0)&&r||xt(r)&&r.capture,n=bt(e)?void 0:e;t=i?`${t}capture`:t,e=bt(e)?e:e.handleEvent;const s=xt(r)&&r.once;return super.off(t,e,n,s),this}off(t,e,r){return this.removeEventListener(t,e,r)}once(t,e,r){return xt(r)?(r.once=!0,this.addEventListener(t,e,r)):this.addEventListener(t,e,{once:!0})}removeAllEventListeners(){return super.removeAllListeners(),this}removeAllListeners(){return this.removeAllEventListeners()}dispatchEvent(t,...e){return super.emit(t.type,t,...e),!t.defaultPrevented}emit(t,e){return this.dispatchEvent(t,e)}release(){this.removeAllListeners()}}class On{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=On.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 r=e.stage.eventSystem.manager.propagationPath(e);this.detailPath.push(r),this._composedDetailPath(t.params)}}}preventDefault(){try{this.nativeEvent instanceof Event&&this.nativeEvent.cancelable&&this.nativeEvent.preventDefault()}catch(t){this.nativeEvent.preventDefault&&bt(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&&bt(this.nativeEvent.stopPropagation)&&this.nativeEvent.stopPropagation()}this.propagationStopped=!0}initEvent(){}initUIEvent(){}clone(){throw new Error("Method not implemented.")}}class Bn extends On{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,r,i,n,s,o,a,l,h,c,u,d,p,f){throw new Error("Method not implemented.")}}class Rn extends Bn{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,r;const i=new Rn(this.manager);i.eventPhase=i.NONE,i.currentTarget=null,i.path=[],i.detailPath=[],i.target=null,i.nativeEvent=this.nativeEvent,i.originalEvent=this.originalEvent,null===(t=this.manager)||void 0===t||t.copyPointerData(this,i),null===(e=this.manager)||void 0===e||e.copyMouseData(this,i),null===(r=this.manager)||void 0===r||r.copyData(this,i),i.target=this.target,i.path=this.composedPath().slice();const n=this.composedDetailPath();return i.detailPath=n&&n.slice(),i.type=this.type,i}}class Ln extends Bn{constructor(){super(...arguments),this.DOM_DELTA_PIXEL=0,this.DOM_DELTA_LINE=1,this.DOM_DELTA_PAGE=2}clone(){var t,e,r;const i=new Ln(this.manager);i.eventPhase=i.NONE,i.currentTarget=null,i.path=[],i.detailPath=[],i.target=null,i.nativeEvent=this.nativeEvent,i.originalEvent=this.originalEvent,null===(t=this.manager)||void 0===t||t.copyWheelData(this,i),null===(e=this.manager)||void 0===e||e.copyMouseData(this,i),null===(r=this.manager)||void 0===r||r.copyData(this,i),i.target=this.target,i.path=this.composedPath().slice();const n=this.composedDetailPath();return i.detailPath=n&&n.slice(),i.type=this.type,i}}Ln.DOM_DELTA_PIXEL=0,Ln.DOM_DELTA_LINE=1,Ln.DOM_DELTA_PAGE=2;let Pn=class extends On{constructor(t,e){super(),this.type=t,this.detail=e}};const Dn="object"==typeof performance&&performance.now?performance:Date;function Mn(t){return"mouse"===t||"pen"===t}const In={dispatchEvent(t){var e;if(!(t instanceof On))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 Pn(t,e))}},Nn={touchstart:"pointerdown",touchend:"pointerup",touchendoutside:"pointerupoutside",touchmove:"pointermove",touchcancel:"pointercancel"};class Fn{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,r=e.length;t<r;t++){const r=e[t],i=this.bootstrapEvent(this.rootPointerEvent,r);this.manager.mapEvent(i)}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,r=e.length;t<r;t++){const r=this.bootstrapEvent(this.rootPointerEvent,e[t]);this.manager.mapEvent(r)}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":"",r=this.normalizeToPointerData(t);for(let t=0,i=r.length;t<i;t++){const i=this.bootstrapEvent(this.rootPointerEvent,r[t]);i.type+=e,this.manager.mapEvent(i)}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,r=e.length;t<r;t++){const r=this.bootstrapEvent(this.rootPointerEvent,e[t]);this.manager.mapEvent(r)}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:r,rootNode:i,global:n,autoPreventDefault:s=!1,clickInterval:o,supportsTouchEvents:a=n.supportsTouchEvents,supportsPointerEvents:l=n.supportsPointerEvents}=t;this.manager=new class{constructor(t,e){this.dispatch=new mt,this.cursorTarget=null,this.pauseNotify=!1,this.mappingState={trackingData:{}},this.eventPool=new Map,this.onPointerDown=(t,e)=>{if(!(t instanceof Rn))return void Yt.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const r=this.createPointerEvent(t,t.type,e);if(this.dispatchEvent(r,"pointerdown"),"touch"===r.pointerType)this.dispatchEvent(r,"touchstart");else if(Mn(r.pointerType)){const t=2===r.button;this.dispatchEvent(r,t?"rightdown":"mousedown")}this.trackingData(t.pointerId).pressTargetsByButton[t.button]=r.composedPath(),this.freeEvent(r)},this.onPointerMove=(t,e)=>{var r,i;if(!(t instanceof Rn))return void Yt.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const n=this.createPointerEvent(t,t.type,e),s=Mn(n.pointerType),o=this.trackingData(t.pointerId),a=this.findMountedTarget(o.overTargets);if(o.overTargets&&a&&a!==this.rootTarget&&a!==n.target){const e="mousemove"===t.type?"mouseout":"pointerout",r=this.createPointerEvent(t,e,a||void 0);if(this.dispatchEvent(r,"pointerout"),s&&this.dispatchEvent(r,"mouseout"),!n.composedPath().includes(a)){const e=this.createPointerEvent(t,"pointerleave",a||void 0);for(e.eventPhase=e.AT_TARGET;e.target&&!n.composedPath().includes(e.target);)e.currentTarget=e.target,this.notifyTarget(e),s&&this.notifyTarget(e,"mouseleave"),e.target=e.target.parent;this.freeEvent(e)}this.freeEvent(r)}if(a!==n.target){const e="mousemove"===t.type?"mouseover":"pointerover",r=this.clonePointerEvent(n,e);this.dispatchEvent(r,"pointerover"),s&&this.dispatchEvent(r,"mouseover");let i=null==a?void 0:a.parent;for(;i&&i!==this.rootTarget.parent&&i!==n.target;)i=i.parent;if(!i||i===this.rootTarget.parent){const t=this.clonePointerEvent(n,"pointerenter");t.eventPhase=t.AT_TARGET;let e=t.target;const r=new Set;let i=a;for(;i&&i!==this.rootTarget;)r.add(i),i=i.parent;for(;e&&e!==a&&e!==this.rootTarget.parent;)r.has(e)||(t.currentTarget=e,this.notifyTarget(t),s&&this.notifyTarget(t,"mouseenter")),e=e.parent;this.freeEvent(t)}this.freeEvent(r)}this.dispatchEvent(n,"pointermove"),"touch"===n.pointerType&&this.dispatchEvent(n,"touchmove"),s&&(this.dispatchEvent(n,"mousemove"),this.cursorTarget=n.target,this.cursor=(null===(i=null===(r=n.target)||void 0===r?void 0:r.attribute)||void 0===i?void 0:i.cursor)||this.rootTarget.getCursor()),o.overTargets=n.composedPath(),this.freeEvent(n)},this.onPointerOver=(t,e)=>{var r,i;if(!(t instanceof Rn))return void Yt.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const n=this.trackingData(t.pointerId),s=this.createPointerEvent(t,t.type,e),o=Mn(s.pointerType);this.dispatchEvent(s,"pointerover"),o&&this.dispatchEvent(s,"mouseover"),"mouse"===s.pointerType&&(this.cursorTarget=s.target,this.cursor=(null===(i=null===(r=s.target)||void 0===r?void 0:r.attribute)||void 0===i?void 0:i.cursor)||this.rootTarget.getCursor());const a=this.clonePointerEvent(s,"pointerenter");for(a.eventPhase=a.AT_TARGET;a.target&&a.target!==this.rootTarget.parent;)a.currentTarget=a.target,this.notifyTarget(a),o&&this.notifyTarget(a,"mouseenter"),a.target=a.target.parent;n.overTargets=s.composedPath(),this.freeEvent(s),this.freeEvent(a)},this.onPointerOut=(t,e)=>{if(!(t instanceof Rn))return void Yt.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const r=this.trackingData(t.pointerId);if(r.overTargets){const e=Mn(t.pointerType),i=this.findMountedTarget(r.overTargets),n=this.createPointerEvent(t,"pointerout",i||void 0);this.dispatchEvent(n),e&&this.dispatchEvent(n,"mouseout");const s=this.createPointerEvent(t,"pointerleave",i||void 0);for(s.eventPhase=s.AT_TARGET;s.target&&s.target!==this.rootTarget.parent;)s.currentTarget=s.target,this.notifyTarget(s),e&&this.notifyTarget(s,"mouseleave"),s.target=s.target.parent;r.overTargets=[],this.freeEvent(n),this.freeEvent(s)}this.cursorTarget=null,this.cursor=""},this.onPointerUp=(t,e)=>{var r;if(!(t instanceof Rn))return void Yt.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const i=Dn.now(),n=this.createPointerEvent(t,t.type,e);if(this.dispatchEvent(n,"pointerup"),"touch"===n.pointerType)this.dispatchEvent(n,"touchend");else if(Mn(n.pointerType)){const t=2===n.button;this.dispatchEvent(n,t?"rightup":"mouseup")}const s=this.trackingData(t.pointerId),o=this.findMountedTarget(s.pressTargetsByButton[t.button]);let a=o;if(o&&!n.composedPath().includes(o)){let e=o;for(;e&&!n.composedPath().includes(e);){if(n.currentTarget=e,this.notifyTarget(n,"pointerupoutside"),"touch"===n.pointerType)this.notifyTarget(n,"touchendoutside");else if(Mn(n.pointerType)){const t=2===n.button;this.notifyTarget(n,t?"rightupoutside":"mouseupoutside")}e=e.parent}delete s.pressTargetsByButton[t.button],a=e}if(a){const e=this.clonePointerEvent(n,"click");e.target=a,e.path=[],e.detailPath=[],s.clicksByButton[t.button]||(s.clicksByButton[t.button]={clickCount:0,target:e.target,timeStamp:i});const o=s.clicksByButton[t.button];o.target===e.target&&i-o.timeStamp<(null!==(r=this._config.clickInterval)&&void 0!==r?r:200)?++o.clickCount:o.clickCount=1,o.target=e.target,o.timeStamp=i,e.detail=o.clickCount,Mn(e.pointerType)?(this.dispatchEvent(e,"click"),2===o.clickCount&&this.dispatchEvent(e,"dblclick")):"touch"===e.pointerType&&this._config.supportsTouchEvents&&(this.dispatchEvent(e,"tap"),2===o.clickCount&&this.dispatchEvent(e,"dbltap")),this.dispatchEvent(e,"pointertap"),this.freeEvent(e)}this.freeEvent(n)},this.onPointerUpOutside=(t,e)=>{if(!(t instanceof Rn))return void Yt.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const r=this.trackingData(t.pointerId),i=this.findMountedTarget(r.pressTargetsByButton[t.button]),n=this.createPointerEvent(t,t.type,e);if(i){let e=i;for(;e;)n.currentTarget=e,this.notifyTarget(n,"pointerupoutside"),"touch"===n.pointerType?this.notifyTarget(n,"touchendoutside"):Mn(n.pointerType)&&this.notifyTarget(n,2===n.button?"rightupoutside":"mouseupoutside"),e=e.parent;delete r.pressTargetsByButton[t.button]}this.freeEvent(n)},this.onWheel=(t,e)=>{if(!(t instanceof Ln))return void Yt.getInstance().warn("EventManager cannot map a non-wheel event as a wheel event");const r=this.createWheelEvent(t,e);this.dispatchEvent(r),this.freeEvent(r)},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,r,i,n,s,o,a;if(!this.rootTarget)return;const l=this.mappingTable[t.type];let h;const c=`${t.canvasX}-${t.canvasY}`;if((null===(e=this._prePointTargetCache)||void 0===e?void 0:e[c])&&(null===(i=null===(r=this._prePointTargetCache)||void 0===r?void 0:r[c])||void 0===i?void 0:i.stage)&&(null===(s=null===(n=this._prePointTargetCache)||void 0===n?void 0:n[c])||void 0===s?void 0:s.stage.renderCount)===(null===(o=this._prePointTargetCache)||void 0===o?void 0:o.stageRenderCount)?h=this._prePointTargetCache[c]:(h=this.pickTarget(t.viewX,t.viewY,t),t.pickParams||(this._prePointTargetCache={[c]:h,stageRenderCount:null!==(a=null==h?void 0:h.stage.renderCount)&&void 0!==a?a:-1})),l)for(let e=0,r=l.length;e<r;e++)l[e].fn(t,h);else Yt.getInstance().warn(`[EventManager]: Event mapping not defined for ${t.type}`)}propagate(t,e){if(!t.target)return;const r=t.composedPath();t.eventPhase=t.CAPTURING_PHASE;for(let i=0,n=r.length-1;i<n;i++)if(t.currentTarget=r[i],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 i=r.length-2;i>=0;i--)if(t.currentTarget=r[i],this.notifyTarget(t,e),t.propagationStopped||t.propagationImmediatelyStopped)return}}propagationPath(t){const e=[t];for(let r=0;r<2048&&t!==this.rootTarget&&t.parent;r++){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 r=t.eventPhase===t.CAPTURING_PHASE||t.eventPhase===t.AT_TARGET?`${e}capture`:e;this.notifyListeners(t,r),t.eventPhase===t.AT_TARGET&&this.notifyListeners(t,e)}findMountedTarget(t){if(!t)return null;let e=t[0];for(let r=1;r<t.length&&t[r].parent===e;r++)e=t[r];return e}createPointerEvent(t,e,r){var i,n;const s=this.allocateEvent(Rn);return this.copyPointerData(t,s),this.copyMouseData(t,s),this.copyData(t,s),s.nativeEvent=t.nativeEvent,s.originalEvent=t,s.target=r||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),"string"==typeof e&&(s.type=e),s}createWheelEvent(t,e){var r,i;const n=this.allocateEvent(Ln);return this.copyWheelData(t,n),this.copyMouseData(t,n),this.copyData(t,n),n.nativeEvent=t.nativeEvent,n.originalEvent=t,n.target=e||this.pickTarget(null!==(r=n.viewX)&&void 0!==r?r:n.global.x,null!==(i=n.viewY)&&void 0!==i?i:n.global.y,n),n}clonePointerEvent(t,e){const r=this.allocateEvent(Rn);r.nativeEvent=t.nativeEvent,r.originalEvent=t.originalEvent,this.copyPointerData(t,r),this.copyMouseData(t,r),this.copyData(t,r),r.target=t.target,r.path=t.composedPath().slice();const i=t.composedDetailPath();return r.detailPath=i&&i.slice(),r.type=null!=e?e:r.type,r}copyWheelData(t,e){e.deltaMode=t.deltaMode,e.deltaX=t.deltaX,e.deltaY=t.deltaY,e.deltaZ=t.deltaZ}copyPointerData(t,e){t instanceof Rn&&e instanceof Rn&&(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 Bn&&e instanceof Bn&&(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((r=>{e[r].x=t[r].x,e[r].y=t[r].y})))}copyData(t,e){e.isTrusted=t.isTrusted,e.srcElement=t.srcElement,e.timeStamp=Dn.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 r=(null===(e=this.eventPool.get(t))||void 0===e?void 0:e.pop())||new t(this);return r.eventPhase=r.NONE,r.currentTarget=null,r.path=[],r.detailPath=[],r.target=null,r}freeEvent(t){var e;if(t.manager!==this)throw new Error("It is illegal to free an event not managed by this EventManager!");const r=t.constructor;this.eventPool.has(r)||this.eventPool.set(r,[]),null===(e=this.eventPool.get(r))||void 0===e||e.push(t)}notifyListeners(t,e){const r=t.currentTarget._events[e];if(r)if("fn"in r)r.once&&t.currentTarget.removeEventListener(e,r.fn,{once:!0}),r.fn.call(r.context,t);else for(let i=0,n=r.length;i<n&&!t.propagationImmediatelyStopped;i++)r[i].once&&t.currentTarget.removeEventListener(e,r[i].fn,{once:!0}),r[i].fn.call(r[i].context,t);this.emitDelegation(t,e)}emitDelegation(t,e){const r=t.currentTarget._events["*"];if(r)if("fn"in r)r.fn.call(r.context,t,e);else for(let i=0,n=r.length;i<n&&!t.propagationImmediatelyStopped;i++)r[i].fn.call(r[i].context,t,e)}pickTarget(t,e,r){let i;const n=this.rootTarget.pick(t,e);return i=n&&n.graphic?n.graphic:n&&n.group?n.group:this.rootTarget.AABBBounds.contains(t,e)?this.rootTarget:null,r&&(r.pickParams=n.params),i}release(){this.dispatch.removeAllListeners(),this.eventPool.clear(),this.rootTarget=null,this.mappingTable=null,this.mappingState=null,this.cursorTarget=null}}(i,{clickInterval:o,supportsTouchEvents:a}),this.globalObj=n,this.supportsPointerEvents=l,this.supportsTouchEvents=a,this.supportsMouseEvents=n.supportsMouseEvents,this.applyStyles=n.applyStyles,this.autoPreventDefault=s,this.eventsAdded=!1,this.rootPointerEvent=new Rn,this.rootWheelEvent=new Ln,this.cursorStyles={default:"inherit",pointer:"pointer"},this.resolution=r,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:r,domElement:i}=this;if(this.currentCursor===t)return;this.currentCursor=t;const n=this.cursorStyles[t];n?"string"==typeof n&&r?i.style.cursor=n:"function"==typeof n?n(t):"object"==typeof n&&r&&Object.assign(i.style,n):r&&Ct(t)&&!jt(this.cursorStyles,t)&&(i.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,r;const i=null===(e=this.globalObj)||void 0===e?void 0:e.mapToCanvasPoint(t,this.domElement);if(i)return i;let n=0,s=0;if(t.changedTouches){const e=null!==(r=t.changedTouches[0])&&void 0!==r?r:{};n=e.clientX||0,s=e.clientY||0}else n=t.clientX||0,s=t.clientY||0;const o=this.domElement.getBoundingClientRect();return{x:n-o.left,y:s-o.top}}normalizeToPointerData(t){const e=[];if(this.supportsTouchEvents&&t.changedTouches&&t.changedTouches.length)for(let r=0,i=t.changedTouches.length;r<i;r++){const i=t.changedTouches[r];kt(i.button)&&(i.button=0),kt(i.buttons)&&(i.buttons=1),kt(i.isPrimary)&&(i.isPrimary=1===t.touches.length&&"touchstart"===t.type),kt(i.width)&&(i.width=i.radiusX||1),kt(i.height)&&(i.height=i.radiusY||1),kt(i.tiltX)&&(i.tiltX=0),kt(i.tiltY)&&(i.tiltY=0),kt(i.pointerType)&&(i.pointerType="touch"),kt(i.pointerId)&&(i.pointerId=i.identifier||0),kt(i.pressure)&&(i.pressure=i.force||.5),kt(i.twist)&&(i.twist=0),kt(i.tangentialPressure)&&(i.tangentialPressure=0),kt(i.layerX)&&(i.layerX=i.offsetX=i.clientX),kt(i.layerY)&&(i.layerY=i.offsetY=i.clientY),i.isNormalized=!0,i.type=t.type,e.push(i)}else if(!this.globalObj.supportsMouseEvents||t instanceof MouseEvent&&!(this.supportsPointerEvents&&t instanceof PointerEvent)){const r=t;kt(r.isPrimary)&&(r.isPrimary=!0),kt(r.width)&&(r.width=1),kt(r.height)&&(r.height=1),kt(r.tiltX)&&(r.tiltX=0),kt(r.tiltY)&&(r.tiltY=0),kt(r.pointerType)&&(r.pointerType="mouse"),kt(r.pointerId)&&(r.pointerId=1),kt(r.pressure)&&(r.pressure=.5),kt(r.twist)&&(r.twist=0),kt(r.tangentialPressure)&&(r.tangentialPressure=0),r.isNormalized=!0,e.push(r)}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:r,y:i}=this.mapToCanvasPoint(t);e.canvas.x=r,e.canvas.y=i,e.global.x=r,e.global.y=i,e.offset.x=r,e.offset.y=i;const{x:n,y:s}=this.mapToViewportPoint(e);return e.viewport.x=n,e.viewport.y=s,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:r,y:i}=this.mapToCanvasPoint(e);t.canvas.x=r,t.canvas.y=i,t.global.x=r,t.global.y=i,t.offset.x=r,t.offset.y=i;const{x:n,y:s}=this.mapToViewportPoint(t);return t.viewport.x=n,t.viewport.y=s,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=Nn[t.type]||t.type),t}transferMouseData(t,e){t.isTrusted=e.isTrusted,t.srcElement=e.srcElement,t.timeStamp=Dn.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)),r=this.domElement.getViewBox(),i=r.width(),n=r.height();return!(e.x<i&&e.y<n&&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}}class jn{static GetImage(t,e){var r;const i=jn.cache.get(t);i?"fail"===i.loadState?rt.global.getRequestAnimationFrame()((()=>{e.imageLoadFail(t)})):"init"===i.loadState||"loading"===i.loadState?null===(r=i.waitingMark)||void 0===r||r.push(e):e&&e.imageLoadSuccess(t,i.data):jn.loadImage(t,e)}static GetSvg(t,e){var r;let i=jn.cache.get(t);i?"fail"===i.loadState?rt.global.getRequestAnimationFrame()((()=>{e.imageLoadFail(t)})):"init"===i.loadState||"loading"===i.loadState?null===(r=i.waitingMark)||void 0===r||r.push(e):e&&e.imageLoadSuccess(t,i.data):(i={type:"image",loadState:"init"},jn.cache.set(t,i),i.dataPromise=rt.global.loadSvg(t),i.dataPromise?(i.waitingMark=[e],i.dataPromise.then((e=>{var r;i.loadState=(null==e?void 0:e.data)?"success":"fail",i.data=null==e?void 0:e.data,null===(r=i.waitingMark)||void 0===r||r.map(((r,n)=>{(null==e?void 0:e.data)?(i.loadState="success",i.data=e.data,r.imageLoadSuccess(t,e.data)):(i.loadState="fail",r.imageLoadFail(t))})),i.waitingMark&&(i.waitingMark=[])}))):(i.loadState="fail",e.imageLoadFail(t)))}static GetFile(t,e){let r=jn.cache.get(t);return r?"fail"===r.loadState?Promise.reject():"init"===r.loadState||"loading"===r.loadState?r.dataPromise.then((t=>t.data)):Promise.resolve(r.data):(r={type:e,loadState:"init"},jn.cache.set(t,r),"arrayBuffer"===e?r.dataPromise=rt.global.loadArrayBuffer(t):"blob"===e?r.dataPromise=rt.global.loadBlob(t):"json"===e&&(r.dataPromise=rt.global.loadJson(t)),r.dataPromise.then((t=>t.data)))}static loading(){setTimeout((()=>{if(!jn.isLoading&&jn.toLoadAueue.length){jn.isLoading=!0;const t=jn.toLoadAueue.splice(0,10),e=[];t.forEach((t=>{const{url:r,marks:i}=t,n={type:"image",loadState:"init"};if(jn.cache.set(r,n),n.dataPromise=rt.global.loadImage(r),n.dataPromise){n.waitingMark=i;const t=n.dataPromise.then((t=>{var e;n.loadState=(null==t?void 0:t.data)?"success":"fail",n.data=null==t?void 0:t.data,null===(e=n.waitingMark)||void 0===e||e.map(((e,i)=>{(null==t?void 0:t.data)?(n.loadState="success",n.data=t.data,e.imageLoadSuccess(r,t.data)):(n.loadState="fail",e.imageLoadFail(r))})),n.waitingMark&&(n.waitingMark=[])}));e.push(t)}else n.loadState="fail",i.forEach((t=>t.imageLoadFail(r)))})),Promise.all(e).then((()=>{jn.isLoading=!1,this.onLoadSuccessCb.forEach((t=>t())),jn.loading()})).catch((t=>{jn.isLoading=!1,this.onLoadSuccessCb.forEach((t=>t())),jn.loading()}))}}),0)}static loadImage(t,e){const r=zn(t,jn.toLoadAueue);if(-1!==r)return jn.toLoadAueue[r].marks.push(e),void jn.loading();jn.toLoadAueue.push({url:t,marks:[e]}),jn.loading()}static improveImageLoading(t){const e=zn(t,jn.toLoadAueue);if(-1!==e){const t=jn.toLoadAueue.splice(e,1);jn.toLoadAueue.unshift(t[0])}}static onLoadSuccess(t){this.onLoadSuccessCb.push(t)}}function zn(t,e){for(let r=0;r<e.length;r++)if(e[r].url===t)return r;return-1}var Hn;jn.cache=new Map,jn.isLoading=!1,jn.toLoadAueue=[],jn.onLoadSuccessCb=[],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"}(Hn||(Hn={}));const Wn=[0,0,0,0],Un=[{x:0,y:0},{x:0,y:0},{x:0,y:0},{x:0,y:0}],$n=[1,2,3,0,1,2,3,0];function Vn(t,e,r){const{x:i,y:n}=pe(t.x,t.y,e.x,e.y,r),{x:s,y:o}=pe(t.x1,t.y1,e.x1,e.y1,r),a=new fe(i,n,s,o);return a.defined=e.defined,a}function Gn(t,e,r){if(!t||!e)return[];Array.isArray(t)||(t=[t]),Array.isArray(e)||(e=[e]);let i=[];if(t.length>e.length){i=e.map((t=>{const e=new fe(t.x,t.y,t.x1,t.y1);return e.defined=t.defined,e}));for(let n=0;n<e.length;n++)i[n]=Vn(t[n],e[n],r)}else{i=e.map((t=>{const e=new fe(t.x,t.y,t.x1,t.y1);return e.defined=t.defined,e}));for(let n=0;n<t.length;n++)i[n]=Vn(t[n],e[n],r)}return i}function Xn(t,e){if(Et(t)){let r;for(let i=0;i<t.length&&void 0===r;i++)r=t[i][e];return r}return t[e]}const Yn=(t,e)=>{const r=((t,e)=>Ct(t)&&"%"===t[t.length-1]?e*(Number.parseFloat(t.substring(0,t.length-1))/100):t)(t,e);return isNaN(r)?r:Math.max(e,r)};class qn{bounds(t,e){if(Ot(t)){const r=t/2;e.x1=-r,e.x2=r,e.y1=-r,e.y2=r}else e.x1=-t[0]/2,e.x2=t[0]/2,e.y1=-t[1]/2,e.y2=t[1]/2}parseSize(t){return Ot(t)?t:Math.min(t[0],t[1])}}function Zn(t,e,r,i,n){return n?t.arc(r,i,e,0,ie,!1,n):t.arc(r,i,e,0,ie),!1}var Kn=new class extends qn{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,r,i,n){return Zn(t,this.parseSize(e)/2,r,i,n)}drawOffset(t,e,r,i,n,s){return Zn(t,this.parseSize(e)/2+n,r,i,s)}drawToSvgPath(t,e,r,i){const n=this.parseSize(t)/2;return`M ${e-n}, ${r} a ${n},${n} 0 1,0 ${2*n},0 a ${n},${n} 0 1,0 -${2*n},0`}};var Qn=new class extends qn{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,r,i,n){return function(t,e,r,i,n){return t.moveTo(-3*e+r,-e+i,n),t.lineTo(-e+r,-e+i,n),t.lineTo(-e+r,-3*e+i,n),t.lineTo(e+r,-3*e+i,n),t.lineTo(e+r,-e+i,n),t.lineTo(3*e+r,-e+i,n),t.lineTo(3*e+r,e+i,n),t.lineTo(e+r,e+i,n),t.lineTo(e+r,3*e+i,n),t.lineTo(-e+r,3*e+i,n),t.lineTo(-e+r,e+i,n),t.lineTo(-3*e+r,e+i,n),t.closePath(),!0}(t,this.parseSize(e)/6,r,i,n)}drawOffset(t,e,r,i,n,s){return function(t,e,r,i,n,s){return t.moveTo(-3*e+r-n,-e+i-n,s),t.lineTo(-e+r-n,-e+i-n,s),t.lineTo(-e+r-n,-3*e+i-n,s),t.lineTo(e+r+n,-3*e+i-n,s),t.lineTo(e+r+n,-e+i-n,s),t.lineTo(3*e+r+n,-e+i-n,s),t.lineTo(3*e+r+n,e+i+n,s),t.lineTo(e+r+n,e+i+n,s),t.lineTo(e+r+n,3*e+i+n,s),t.lineTo(-e+r-n,3*e+i+n,s),t.lineTo(-e+r-n,e+i+n,s),t.lineTo(-3*e+r-n,e+i+n,s),t.closePath(),!0}(t,this.parseSize(e)/6,r,i,n,s)}};function Jn(t,e,r,i,n){return t.moveTo(r,i-e,n),t.lineTo(e+r,i,n),t.lineTo(r,i+e,n),t.lineTo(r-e,i,n),t.closePath(),!0}var ts=new class extends qn{constructor(){super(...arguments),this.type="diamond",this.pathStr="M-0.5,0L0,-0.5L0.5,0L0,0.5Z"}draw(t,e,r,i,n){return Jn(t,this.parseSize(e)/2,r,i,n)}drawFitDir(t,e,r,i,n){return Jn(t,this.parseSize(e)/2,r,i,n)}drawOffset(t,e,r,i,n,s){return Jn(t,this.parseSize(e)/2+n,r,i,s)}};function es(t,e,r,i){const n=2*e;return t.rect(r-e,i-e,n,n),!1}var rs=new class extends qn{constructor(){super(...arguments),this.type="square",this.pathStr="M-0.5,-0.5h1v1h-1Z"}draw(t,e,r,i){return es(t,this.parseSize(e)/2,r,i)}drawOffset(t,e,r,i,n){return es(t,this.parseSize(e)/2+n,r,i)}};function is(t,e,r,i,n=0){return t.moveTo(r+e+2*n,e+i+n),t.lineTo(r-e-2*n,e+i+n),t.lineTo(r,i-e-2*n),t.closePath(),!0}class ns extends qn{constructor(){super(...arguments),this.type="triangleUp",this.pathStr="M0.5,0.5 L-0.5,0.5 L0,-0.5 Z"}draw(t,e,r,i){return is(t,this.parseSize(e)/2,r,i)}drawOffset(t,e,r,i,n){return is(t,this.parseSize(e)/2,r,i,n)}}var ss=new ns;var os=new class extends ns{constructor(){super(...arguments),this.type="triangle"}};const as=Math.sin(Math.PI/10)/Math.sin(7*Math.PI/10),ls=Math.sin(ie/10)*as,hs=-Math.cos(ie/10)*as;function cs(t,e,r,i){const n=ls*e,s=hs*e;t.moveTo(r,-e+i),t.lineTo(n+r,s+i);for(let o=1;o<5;++o){const a=ie*o/5,l=Math.cos(a),h=Math.sin(a);t.lineTo(h*e+r,-l*e+i),t.lineTo(l*n-h*s+r,h*n+l*s+i)}return t.closePath(),!0}var us=new class extends qn{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,r,i){return cs(t,this.parseSize(e)/2,r,i)}drawOffset(t,e,r,i,n){return cs(t,this.parseSize(e)/2+n,r,i)}};const ds=ue(3);function ps(t,e,r,i){const n=e,s=n/ds,o=s/5,a=e;return t.moveTo(0+r,-n+i),t.lineTo(s/2+r,i),t.lineTo(o/2+r,i),t.lineTo(o/2+r,a+i),t.lineTo(-o/2+r,a+i),t.lineTo(-o/2+r,i),t.lineTo(-s/2+r,i),t.closePath(),!0}var fs=new class extends qn{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,r,i){return ps(t,this.parseSize(e)/2,r,i)}drawOffset(t,e,r,i,n){return ps(t,this.parseSize(e)/2+n,r,i)}};function gs(t,e,r,i){const n=2*e;return t.moveTo(r,-e+i),t.lineTo(n/3/2+r,e+i),t.lineTo(-n/3/2+r,e+i),t.closePath(),!0}var ms=new class extends qn{constructor(){super(...arguments),this.type="wedge",this.pathStr="M0,-0.5773502691896257L-0.125,0.28867513459481287L0.125,0.28867513459481287Z"}draw(t,e,r,i){return gs(t,this.parseSize(e)/2,r,i)}drawOffset(t,e,r,i,n){return gs(t,this.parseSize(e)/2+n,r,i)}};function ys(t,e,r,i){return t.moveTo(-e+r,i),t.lineTo(r,e+i),!1}var vs=new class extends qn{constructor(){super(...arguments),this.type="stroke",this.pathStr=""}draw(t,e,r,i){return ys(t,this.parseSize(e)/2,r,i)}drawOffset(t,e,r,i,n){return ys(t,this.parseSize(e)/2+n,r,i)}};const bs=-.5,_s=ue(3)/2,ws=1/ue(12);function xs(t,e,r,i){const n=e/2,s=e*ws,o=n,a=e*ws+e,l=-o,h=a;return t.moveTo(n+r,s+i),t.lineTo(o+r,a+i),t.lineTo(l+r,h+i),t.lineTo(bs*n-_s*s+r,_s*n+bs*s+i),t.lineTo(bs*o-_s*a+r,_s*o+bs*a+i),t.lineTo(bs*l-_s*h+r,_s*l+bs*h+i),t.lineTo(bs*n+_s*s+r,bs*s-_s*n+i),t.lineTo(bs*o+_s*a+r,bs*a-_s*o+i),t.lineTo(bs*l+_s*h+r,bs*h-_s*l+i),t.closePath(),!1}var Ss=new class extends qn{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,r,i){return xs(t,this.parseSize(e)/2,r,i)}drawOffset(t,e,r,i,n){return xs(t,this.parseSize(e)/2+n,r,i)}};function Ts(t,e,r,i,n){return t.moveTo(-e+r-2*n,i),t.lineTo(e+r+n,e+i+2*n),t.lineTo(e+r+n,i-e-2*n),t.closePath(),!0}var ks=new class extends qn{constructor(){super(...arguments),this.type="triangleLeft",this.pathStr="M-0.5,0 L0.5,0.5 L0.5,-0.5 Z"}draw(t,e,r,i){return Ts(t,this.parseSize(e)/2,r,i,0)}drawOffset(t,e,r,i,n){return Ts(t,this.parseSize(e)/2,r,i,n)}};function Cs(t,e,r,i,n=0){return t.moveTo(r-e-n,e+i+2*n),t.lineTo(e+r+2*n,i),t.lineTo(r-e-n,i-e-2*n),t.closePath(),!0}var Es=new class extends qn{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,r,i){return Cs(t,this.parseSize(e)/2,r,i)}drawOffset(t,e,r,i,n){return Cs(t,this.parseSize(e)/2,r,i,n)}};function As(t,e,r,i,n=0){return t.moveTo(r-e-2*n,i-e-n),t.lineTo(r+e+2*n,i-e-n),t.lineTo(r,i+e+2*n),t.closePath(),!0}var Os=new class extends qn{constructor(){super(...arguments),this.type="triangleDown",this.pathStr="M-0.5,-0.5 L0.5,-0.5 L0,0.5 Z"}draw(t,e,r,i){return As(t,this.parseSize(e)/2,r,i)}drawOffset(t,e,r,i,n){return As(t,this.parseSize(e)/2,r,i,n)}};const Bs=ue(3);function Rs(t,e,r,i){const n=e*Bs;return t.moveTo(r,i+-n/3*2),t.lineTo(e+r,i+n),t.lineTo(r-e,i+n),t.closePath(),!0}var Ls=new class extends qn{constructor(){super(...arguments),this.type="thinTriangle",this.pathStr="M0,-0.5773502691896257L-0.5,0.28867513459481287L0.5,0.28867513459481287Z"}draw(t,e,r,i){return Rs(t,this.parseSize(e)/2/Bs,r,i)}drawOffset(t,e,r,i,n){return Rs(t,this.parseSize(e)/2/Bs+n,r,i)}};function Ps(t,e,r,i){const n=2*e;return t.moveTo(e+r,i-n),t.lineTo(r-e,i),t.lineTo(e+r,n+i),!0}var Ds=new class extends qn{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,r,i){return Ps(t,this.parseSize(e)/4,r,i)}drawOffset(t,e,r,i,n){return Ps(t,this.parseSize(e)/4+n,r,i)}};function Ms(t,e,r,i){const n=2*e;return t.moveTo(r-e,i-n),t.lineTo(r+e,i),t.lineTo(r-e,n+i),!0}var Is=new class extends qn{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,r,i){return Ms(t,this.parseSize(e)/4,r,i)}drawOffset(t,e,r,i,n){return Ms(t,this.parseSize(e)/4+n,r,i)}};function Ns(t,e,r,i){const n=2*e;return t.moveTo(r-n,i+e),t.lineTo(r,i-e),t.lineTo(r+n,i+e),!0}var Fs=new class extends qn{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,r,i){return Ns(t,this.parseSize(e)/4,r,i)}drawOffset(t,e,r,i,n){return Ns(t,this.parseSize(e)/4+n,r,i)}};function js(t,e,r,i){const n=2*e;return t.moveTo(r-n,i-e),t.lineTo(r,i+e),t.lineTo(r+n,i-e),!0}var zs=new class extends qn{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,r,i){return js(t,this.parseSize(e)/4,r,i)}drawOffset(t,e,r,i,n){return js(t,this.parseSize(e)/4+n,r,i)}};function Hs(t,e,r,i,n){return t.moveTo(r,i-e),t.lineTo(r,i+e),!0}var Ws=new class extends qn{constructor(){super(...arguments),this.type="lineV",this.pathStr="M0,-0.5L0,0.5"}draw(t,e,r,i,n){return Hs(t,this.parseSize(e)/2,r,i)}drawOffset(t,e,r,i,n,s){return Hs(t,this.parseSize(e)/2+n,r,i)}drawToSvgPath(t,e,r,i){const n=this.parseSize(t)/2;return`M ${e}, ${r-n} L ${e},${r+n}`}};function Us(t,e,r,i,n){return t.moveTo(r-e,i),t.lineTo(r+e,i),!0}var $s=new class extends qn{constructor(){super(...arguments),this.type="lineH",this.pathStr="M-0.5,0L0.5,0"}draw(t,e,r,i,n){return Us(t,this.parseSize(e)/2,r,i)}drawOffset(t,e,r,i,n,s){return Us(t,this.parseSize(e)/2+n,r,i)}drawToSvgPath(t,e,r,i){const n=this.parseSize(t)/2;return`M ${e-n}, ${r} L ${e+n},${r}`}};function Vs(t,e,r,i,n){return t.moveTo(r-e,i-e),t.lineTo(r+e,i+e),t.moveTo(r+e,i-e),t.lineTo(r-e,i+e),!0}var Gs=new class extends qn{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,r,i,n){return Vs(t,this.parseSize(e)/2,r,i)}drawOffset(t,e,r,i,n,s){return Vs(t,this.parseSize(e)/2+n,r,i)}drawToSvgPath(t,e,r,i){const n=this.parseSize(t)/2;return`M ${e-n}, ${r-n} L ${e+n},${r+n} M ${e+n}, ${r-n} L ${e-n},${r+n}`}};function Xs(t,e,r,i){return t.rect(r-e[0]/2,i-e[1]/2,e[0],e[1]),!1}function Ys(t,e,r,i){const n=e,s=e/2;return t.rect(r-n/2,i-s/2,n,s),!1}var qs=new class extends qn{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,r,i){return Ot(e)?Ys(t,e,r,i):Xs(t,e,r,i)}drawWithClipRange(t,e,r,i,n,s,o){Ot(e)&&(e=[e,e/2]);const a=2*(e[0]+e[1])*n,l=[{x:r+e[0]/2,y:i-e[1]/2},{x:r+e[0]/2,y:i+e[1]/2},{x:r-e[0]/2,y:i+e[1]/2},{x:r-e[0]/2,y:i-e[1]/2}];let h=0,c=l[3];t.moveTo(c.x,c.y);for(let e=0;e<l.length;e++){const r=l[e],i=Math.sqrt((r.x-c.x)*(r.x-c.x)+(r.y-c.y)*(r.y-c.y));if(h+i>a){const e=(r.x-c.x)*(a-h)/i,n=(r.y-c.y)*(a-h)/i;t.lineTo(c.x+e,c.y+n);break}t.lineTo(r.x,r.y),c=r,h+=i}return!1}drawOffset(t,e,r,i,n){return Ot(e)?Ys(t,e+2*n,r,i):Xs(t,[e[0]+2*n,e[1]+2*n],r,i)}};const Zs=new Le;class Ks{constructor(t,e,r=!1){this.pathStr="",this.type=t,Et(e)?this.svgCache=e:this.path=e,this.isSvg=r}drawOffset(t,e,r,i,n,s,o){return e=this.parseSize(e),this.isSvg?!!this.svgCache&&(this.svgCache.forEach((n=>{t.beginPath(),ir(n.path.commandList,t,r,i,e,e),o&&o(n.path,n.attribute)})),!1):(ir(this.path.commandList,t,r,i,e+n,e+n),!1)}draw(t,e,r,i,n,s){return e=this.parseSize(e),this.drawOffset(t,e,r,i,0,n,s)}parseSize(t){return Ot(t)?t:Math.min(t[0],t[1])}drawWithClipRange(t,e,r,i,n,s,o){return e=this.parseSize(e),this.isSvg?!!this.svgCache&&(this.svgCache.forEach((s=>{s.path.drawWithClipRange(t,e,r,i,n),o&&o(s.path,s.attribute)})),!1):(this.path.drawWithClipRange(t,e,r,i,n),!1)}bounds(t,e){if(t=this.parseSize(t),this.isSvg){if(!this.svgCache)return;return e.clear(),void this.svgCache.forEach((({path:r})=>{Zs.x1=r.bounds.x1*t,Zs.y1=r.bounds.y1*t,Zs.x2=r.bounds.x2*t,Zs.y2=r.bounds.y2*t,e.union(Zs)}))}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 Qs={};[Kn,Qn,ts,rs,Ls,os,us,fs,ms,vs,Ss,ks,Es,ss,Os,Ds,Is,Fs,zs,qs,Ws,$s,Gs].forEach((t=>{Qs[t.type]=t}));const Js={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 to{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 eo(t,e,r,i){const n=t.indexOf(e,r);if(-1===n)throw new Error(i);return n+e.length-1}function ro(t,e,r,i=">"){const n=function(t,e,r=">"){let i,n="";for(let s=e;s<t.length;s++){let e=t[s];if(i)e===i&&(i="");else if('"'===e||"'"===e)i=e;else if(e===r[0]){if(!r[1])return{data:n,index:s};if(t[s+1]===r[1])return{data:n,index:s}}else"\t"===e&&(e=" ");n+=e}}(t,e+1,i);if(!n)return;let s=n.data;const o=n.index,a=s.search(/\s/);let l=s,h=!0;-1!==a&&(l=s.substr(0,a).replace(/\s\s*$/,""),s=s.substr(a+1));const c=l;if(r){const t=l.indexOf(":");-1!==t&&(l=l.substr(t+1),h=l!==n.data.substr(t+1))}return{tagName:l,tagExp:s,closeIndex:o,attrExpPresent:h,rawTagName:c}}const io=new RegExp("([^\\s=]+)\\s*(=\\s*(['\"])([\\s\\S]*?)\\3)?","gm");class no{constructor(t){this.currentNode=null,this.options=t,this.tagsNodeStack=[],this.docTypeEntities={}}addChild(t,e,r){const i=e.tagname;"string"==typeof i?(e.tagname=i,t.addChild(e)):t.addChild(e)}buildAttributesMap(t,e,r){const i={};if(!t)return;const n=function(t,e){const r=[];let i=e.exec(t);for(;i;){const n=[];n.startIndex=e.lastIndex-i[0].length;const s=i.length;for(let t=0;t<s;t++)n.push(i[t]);r.push(n),i=e.exec(t)}return r}(t,io),s=n.length;for(let t=0;t<s;t++){const e=n[t][1],r=n[t][4];e&&(i[e]=void 0===r||(isNaN(r)?r:Number(r)))}return i}parseXml(t){t=t.replace(/\r\n?/g,"\n");const e=new to("!xml");let r=e,i="",n="";for(let s=0;s<t.length;s++)if("<"===t[s])if("/"===t[s+1]){const e=eo(t,">",s,"Closing Tag is not closed."),o=n.lastIndexOf(".");n=n.substring(0,o),r=this.tagsNodeStack.pop(),r&&r.child&&i&&r.child[r.child.length-1][":@"]&&(r.child[r.child.length-1][":@"].text=i),i="",s=e}else if("?"===t[s+1])s=ro(t,s,!1,"?>").closeIndex+1;else if("!--"===t.substr(s+1,3))s=eo(t,"--\x3e",s+4,"Comment is not closed.");else{const o=ro(t,s,!1);let a=o.tagName,l=o.tagExp;const h=o.attrExpPresent,c=o.closeIndex;if(a!==e.tagname&&(n+=n?"."+a:a),l.length>0&&l.lastIndexOf("/")===l.length-1){"/"===a[a.length-1]?(a=a.substr(0,a.length-1),n=n.substr(0,n.length-1),l=a):l=l.substr(0,l.length-1);const t=new to(a);a!==l&&h&&(t[":@"]=this.buildAttributesMap(l,n,a)),this.addChild(r,t,n),n=n.substr(0,n.lastIndexOf("."))}else{const t=new to(a);this.tagsNodeStack.push(r),a!==l&&h&&(t[":@"]=this.buildAttributesMap(l,n,a)),this.addChild(r,t,n),r=t}i="",s=c}else i+=t[s];return e.child}}function so(t,e){return oo(t)}function oo(t,e){const r={};for(let e=0;e<t.length;e++){const n=t[e],s=ao(n);if(void 0!==s&&n[s]){const t=oo(n[s]);i=t,Object.keys(i).length,n[":@"]&&lo(t,n[":@"]),void 0!==r[s]&&r.hasOwnProperty(s)?(Array.isArray(r[s])||(r[s]=[r[s]]),r[s].push(t)):r[s]=t}}var i;return r}function ao(t){const e=Object.keys(t);for(let t=0;t<e.length;t++){const r=e[t];if(":@"!==r)return r}}function lo(t,e,r){if(e){const r=Object.keys(e),i=r.length;for(let n=0;n<i;n++){const i=r[n];t[i]=e[i]}}}class ho{constructor(t){this.options=Object.assign({},ho.defaultOptions,t)}valid(t){return t.startsWith("<")}parse(t){if(!this.valid)return!1;return so(new no(this.options).parseXml(t),this.options)}}function co(t,e,r,i=0){return t.expand(e+(i/2+(r?function(t,e){return t?e:0}(r,e):0))),t}ho.defaultOptions={};let uo=0;function po(){return uo++}var fo;!function(t){t[t.HORIZONTAL=0]="HORIZONTAL",t[t.VERTICAL=1]="VERTICAL"}(fo||(fo={}));const go=new Map;["…","(",")","—","【","】","「","」","《","》"].forEach((t=>go.set(t,!0)));const mo=new Map;function yo(t){if(go.has(t))return!0;if(mo.has(t))return!1;let e=!1;return t.codePointAt(0)<256&&(e=!0),e}[""].forEach((t=>mo.set(t,!0))),po();const vo=po(),bo=po(),_o=po();po();const wo=po(),xo=po(),So=po();po();const To=po();po();const ko=po();po(),po(),po();const Co=po(),Eo=po(),Ao=Symbol.for("GraphicService"),Oo=Symbol.for("GraphicCreator"),Bo={"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"},Ro=Object.keys(Bo),Lo={duration:200,easing:"cubicOut"};function Po(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 Do(t,e,r){const i=r[0],n=r[1],s=r[2];let o,a,l,h,c,u,d,p,f,g,m,y;return e===t?(t[12]=e[0]*i+e[4]*n+e[8]*s+e[12],t[13]=e[1]*i+e[5]*n+e[9]*s+e[13],t[14]=e[2]*i+e[6]*n+e[10]*s+e[14],t[15]=e[3]*i+e[7]*n+e[11]*s+e[15]):(o=e[0],a=e[1],l=e[2],h=e[3],c=e[4],u=e[5],d=e[6],p=e[7],f=e[8],g=e[9],m=e[10],y=e[11],t[0]=o,t[1]=a,t[2]=l,t[3]=h,t[4]=c,t[5]=u,t[6]=d,t[7]=p,t[8]=f,t[9]=g,t[10]=m,t[11]=y,t[12]=o*i+c*n+f*s+e[12],t[13]=a*i+u*n+g*s+e[13],t[14]=l*i+d*n+m*s+e[14],t[15]=h*i+p*n+y*s+e[15]),t}function Mo(t,e,r){const i=e[0],n=e[1],s=e[2],o=e[3],a=e[4],l=e[5],h=e[6],c=e[7],u=e[8],d=e[9],p=e[10],f=e[11],g=e[12],m=e[13],y=e[14],v=e[15];let b=r[0],_=r[1],w=r[2],x=r[3];return t[0]=b*i+_*a+w*u+x*g,t[1]=b*n+_*l+w*d+x*m,t[2]=b*s+_*h+w*p+x*y,t[3]=b*o+_*c+w*f+x*v,b=r[4],_=r[5],w=r[6],x=r[7],t[4]=b*i+_*a+w*u+x*g,t[5]=b*n+_*l+w*d+x*m,t[6]=b*s+_*h+w*p+x*y,t[7]=b*o+_*c+w*f+x*v,b=r[8],_=r[9],w=r[10],x=r[11],t[8]=b*i+_*a+w*u+x*g,t[9]=b*n+_*l+w*d+x*m,t[10]=b*s+_*h+w*p+x*y,t[11]=b*o+_*c+w*f+x*v,b=r[12],_=r[13],w=r[14],x=r[15],t[12]=b*i+_*a+w*u+x*g,t[13]=b*n+_*l+w*d+x*m,t[14]=b*s+_*h+w*p+x*y,t[15]=b*o+_*c+w*f+x*v,t}class Io{constructor(){this.pools=[]}static identity(t){return Po(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 Io.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 r=0;r<e.length;r++)e[r]=t[r];return e}free(t){t&&this.pools.push(t)}get length(){return this.pools.length}release(...t){this.pools=[]}}const No=new class{constructor(){this.pools=[]}allocate(t,e,r,i,n,s){if(!this.pools.length)return new De(t,e,r,i,n,s);const o=this.pools.pop();return o.a=t,o.b=e,o.c=r,o.d=i,o.e=n,o.f=s,o}allocateByObj(t){if(!this.pools.length)return new De(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(...t){this.pools=[]}},Fo=new Io;var jo=function(t,e,r,i){var n,s=arguments.length,o=s<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,e,r,i);else for(var a=t.length-1;a>=0;a--)(n=t[a])&&(o=(s<3?n(o):s>3?n(e,r,o):n(e,r))||o);return s>3&&o&&Object.defineProperty(e,r,o),o},zo=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const Ho=new De(1,0,0,1,0,0),Wo={x:0,y:0};let Uo=class{get nativeContext(){return this.path}constructor(t,e){this.matrix=new De(1,0,0,1,0,0),this.stack=[],this.dpr=e,this.applyedMatrix=new De(1,0,0,1,0,0),this.path=new $r,this._clearMatrix=new De(1,0,0,1,0,0)}getCanvas(){throw new Error("不支持getCanvas")}getContext(){throw new Error("不支持getContext")}setTransformForCurrent(t=!1){!t&&this.applyedMatrix.equalToMatrix(this.matrix)||(this.applyedMatrix=this.cloneMatrix(this.matrix))}get currentMatrix(){return this.matrix}cloneMatrix(t){return No.allocateByObj(t)}clear(){this.save(),this.resetTransform(),this.restore()}reset(){this.matrix.setValue(1,0,0,1,0,0),this.applyedMatrix=new De(1,0,0,1,0,0),this.stack.length=0}restore(){this.stack.length>0&&(No.free(this.matrix),this.matrix=this.stack.pop(),this.setTransformForCurrent())}highPerformanceRestore(){this.stack.length>0&&(No.free(this.matrix),this.matrix=this.stack.pop())}rotate(t,e=!0){this.matrix.rotate(t),e&&this.setTransformForCurrent()}save(){const t=this.cloneMatrix(this.matrix);this.stack.push(t)}highPerformanceSave(){const t=this.cloneMatrix(this.matrix);this.stack.push(t)}scale(t,e,r=!0){this.matrix.scale(t,e),r&&this.setTransformForCurrent()}setScale(t,e,r=!0){this.matrix.setScale(t,e),r&&this.setTransformForCurrent()}scalePoint(t,e,r,i,n=!0){this.translate(r,i,!1),this.scale(t,e,!1),this.translate(-r,-i,!1),n&&this.setTransformForCurrent()}setTransform(t,e,r,i,n,s,o=!0,a=this.dpr){this.matrix.setValue(a*t,a*e,a*r,a*i,a*n,a*s),o&&this.setTransformForCurrent()}setTransformFromMatrix(t,e=!0,r=this.dpr){this.matrix.setValue(t.a*r,t.b*r,t.c*r,t.d*r,t.e*r,t.f*r),e&&this.setTransformForCurrent()}resetTransform(t=!0,e=this.dpr){this.setTransform(e,0,0,e,0,0),t&&this.setTransformForCurrent()}transform(t,e,r,i,n,s,o=!0){this.matrix.multiply(t,e,r,i,n,s),o&&this.setTransformForCurrent()}transformFromMatrix(t,e){this.matrix.multiply(t.a,t.b,t.c,t.d,t.e,t.f),e&&this.setTransformForCurrent()}translate(t,e,r=!0){this.matrix.translate(t,e),r&&this.setTransformForCurrent()}rotateDegrees(t,e=!0){const r=t*Math.PI/180;this.rotate(r,e)}rotateAbout(t,e,r,i=!0){this.translate(e,r,!1),this.rotate(t,!1),this.translate(-e,-r,!1),i&&this.setTransformForCurrent()}rotateDegreesAbout(t,e,r,i=!0){this.translate(e,r,!1),this.rotateDegrees(t,!1),this.translate(-e,-r,!1),i&&this.setTransformForCurrent()}beginPath(){this.path.clear()}clip(t,e){}arc(t,e,r,i,n,s){this.path.arc(t,e,r,i,n,s)}arcTo(t,e,r,i,n){this.path.arcTo(t,e,r,i,n)}bezierCurveTo(t,e,r,i,n,s){this.path.bezierCurveTo(t,e,r,i,n,s)}closePath(){this.path.closePath()}ellipse(t,e,r,i,n,s,o,a){}lineTo(t,e){this.path.lineTo(t,e)}moveTo(t,e){this.path.moveTo(t,e)}quadraticCurveTo(t,e,r,i){this.path.quadraticCurveTo(t,e,r,i)}rect(t,e,r,i){this.path.rect(t,e,r,i)}createImageData(t,e){return null}createLinearGradient(t,e,r,i){throw new Error("不支持createLinearGradient")}createPattern(t,e){throw new Error("不支持createPattern")}createRadialGradient(t,e,r,i,n,s){throw new Error("不支持createRadialGradient")}createConicGradient(t,e,r,i){return null}fill(t,e){}fillRect(t,e,r,i){this.path.rect(t,e,r,i)}clearRect(t,e,r,i){}fillText(t,e,r){}getImageData(t,e,r,i){return null}getLineDash(){return[]}isPointInPath(t,e){return this.matrix.transformPoint({x:t,y:e},Wo),function(t,e,r){return on(t,0,!1,e,r)}(this.path.commandList,Wo.x,Wo.y)}isPointInStroke(t,e){if(!this.lineWidth)return!1;this.matrix.transformPoint({x:t,y:e},Wo);const r=yi(this,this.lineWidth,this.dpr);return function(t,e,r,i){return on(t,e,!0,r,i)}(this.path.commandList,r,Wo.x,Wo.y)}measureText(t){throw new Error("不支持measureText")}putImageData(t,e,r){throw new Error("不支持measureText")}setLineDash(t){}stroke(t){}strokeRect(t,e,r,i){this.path.rect(t,e,r,i)}strokeText(t,e,r){}drawImage(){}setCommonStyle(t,e,r,i,n){}_setCommonStyle(t,e,r,i){}setStrokeStyle(t,e,r,i,n){}_setStrokeStyle(t,e,r,i){}setTextStyleWithoutAlignBaseline(t,e){}setTextStyle(t,e){}draw(){}clearMatrix(t=!0,e=this.dpr){this.setTransformFromMatrix(Ho,t,e)}setClearMatrix(t,e,r,i,n,s){this._clearMatrix.setValue(t,e,r,i,n,s)}onlyTranslate(t=this.dpr){return this.matrix.a===t&&0===this.matrix.b&&0===this.matrix.c&&this.matrix.d===t}release(...t){this.stack.forEach((t=>No.free(t))),this.stack.length=0}};Uo=jo([L(),zo("design:paramtypes",[Object,Number])],Uo);const $o=new Le,Vo=new De;new Le;const Go=["lineWidth","scaleX","scaleY","angle","anchor","visible"],Xo=["x","y"],Yo=["scaleX","scaleY"],qo=["angle"],Zo=new fe,Ko={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 Qo extends An{static mixin(t){const e=Object.keys(t);for(let r=0;r<e.length;++r){const i=e[r];Object.defineProperty(Qo.prototype,i,Object.getOwnPropertyDescriptor(t,i))}}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(t={}){var e;super(),this._AABBBounds=new Le,this._updateTag=Ye.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)}getGraphicService(){var t,e;return null!==(e=null===(t=this.stage)||void 0===t?void 0:t.graphicService)&&void 0!==e?e:rt.graphicService}getAttributes(){return this.attribute}setMode(t){"3d"===t?this.set3dMode():this.set2dMode()}set3dMode(){this.in3dMode=!0}set2dMode(){this.in3dMode=!1}getOffsetXY(t,e=!1){var r,i;const{dx:n=t.dx,dy:s=t.dy}=this.attribute;if(e&&this.parent){const t=this.parent.attribute;Zo.x=n+(null!==(r=t.scrollX)&&void 0!==r?r:0),Zo.y=s+(null!==(i=t.scrollY)&&void 0!==i?i:0)}else Zo.x=n,Zo.y=s;return Zo}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;this.getGraphicService().beforeUpdateAABBBounds(this,this.stage,!0,this._AABBBounds);const e=this.doUpdateAABBBounds(t);return this.getGraphicService().afterUpdateAABBBounds(this,this.stage,this._AABBBounds,this,!0),"empty"===this.attribute.boundsMode&&e.clear(),e}tryUpdateOBBBounds(){return this._OBBBounds||(this._OBBBounds=new Pe),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 r=this.clipPathMap.get(e)||null;return r||(this.clipPathMap.size>10&&this.clipPathMap.clear(),r=this.parsePath(e),r&&this.clipPathMap.set(e,r)),r}parsePath(t){if(!t)return null;let e=Qs[t];if(e)return e;if(e=Qo.userSymbolMap[t],e)return e;if(!0===((r=t=Js[t]||t).startsWith("<svg")||r.startsWith("<?xml"))){const e=new ho,{svg:r}=e.parse(t);if(!r)return null;const i=Et(r.path)?r.path:[r.path];$o.clear();const n=[];i.forEach((t=>{const e=(new $r).fromString(t.d),r={};Ro.forEach((e=>{t[e]&&(r[Bo[e]]=t[e])})),n.push({path:e,attribute:r}),$o.union(e.bounds)}));const s=$o.width(),o=$o.height(),a=1/le(s,o);n.forEach((t=>t.path.transform(0,0,a,a)));const l=new Ks(t,n,!0);return Qo.userSymbolMap[t]=l,l}var r;const i=(new $r).fromString(t),n=i.bounds.width(),s=i.bounds.height(),o=1/le(n,s);i.transform(0,0,o,o);const a=new Ks(t,i);return Qo.userSymbolMap[t]=a,a}doUpdateAABBBounds(t){this.updateAABBBoundsStamp++;const e=this.getGraphicTheme();this._AABBBounds.clear();const r=this.attribute,i=this.updateAABBBounds(r,e,this._AABBBounds,t),{boundsPadding:n=e.boundsPadding}=r,s=(o=n)?Et(o)?0===o.length?0:1===o.length?o[0]:2===o.length?(Wn[0]=o[0],Wn[2]=o[0],Wn[1]=o[1],Wn[3]=o[1],Wn):o:o:0;var o;return s&&i.expand(s),this.clearUpdateBoundTag(),i}updatePathProxyAABBBounds(t){const e="function"==typeof this.pathProxy?this.pathProxy(this.attribute):this.pathProxy;if(!e)return!1;const r=new Ne(t);return ir(e.commandList,r,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(t=!0){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(t=!0){return this._transMatrix||(this._transMatrix=new De),this.shouldUpdateLocalMatrix()&&(this.doUpdateLocalMatrix(),t&&this.clearUpdateLocalPositionTag()),this._transMatrix}shouldUpdateAABBBounds(){return this.shadowRoot?(!!(this._updateTag&Ye.UPDATE_BOUNDS)||this.shadowRoot.shouldUpdateAABBBounds())&&this.getGraphicService().validCheck(this.attribute,this.getGraphicTheme(),this._AABBBounds,this):!!(this._updateTag&Ye.UPDATE_BOUNDS)&&this.getGraphicService().validCheck(this.attribute,this.getGraphicTheme(),this._AABBBounds,this)}shouldSelfChangeUpdateAABBBounds(){return this.shadowRoot?!!(this._updateTag&Ye.UPDATE_BOUNDS)||this.shadowRoot.shouldUpdateAABBBounds():!!(this._updateTag&Ye.UPDATE_BOUNDS)}shouldUpdateLocalMatrix(){return!!(this._updateTag&Ye.UPDATE_LOCAL_MATRIX)}isValid(){var t,e;const r=this.attribute;return Number.isFinite((null!==(t=r.x)&&void 0!==t?t:0)+(null!==(e=r.y)&&void 0!==e?e:0))}_validNumber(t){return null==t||Number.isFinite(t)}shouldUpdateShape(){return!!(this._updateTag&Ye.UPDATE_SHAPE)}clearUpdateShapeTag(){this._updateTag&=Ye.CLEAR_SHAPE}containsPoint(t,e,r,i){if(!i)return!1;if(r===qe.GLOBAL){const r=new fe(t,e);this.parent&&this.parent.globalTransMatrix.transformPoint(r,r),t=r.x,e=r.y}return i.containsPoint(this,{x:t,y:e})}setWidthHeightWithoutTransform(t){this.widthWithoutTransform=t.x2-t.x1,this.heightWithoutTransform=t.y2-t.y1}setAttributesAndPreventAnimate(t,e=!1,r,i){this.setAttributes(t,e,r),this.animates&&this.animates.forEach((e=>{(e.priority!==1/0||i)&&Object.keys(t).forEach((t=>{e.preventAttr(t)}))}))}setAttributes(t,e=!1,r){(t=this.onBeforeAttributeUpdate&&this.onBeforeAttributeUpdate(t,this.attribute,null,r)||t).background?this.loadImage(t.background,!0):t.shadowGraphic&&this.setShadowGraphic(t.shadowGraphic),this._setAttributes(t,e,r)}_setAttributes(t,e=!1,r){const i=Object.keys(t);for(let e=0;e<i.length;e++){const r=i[e];this.attribute[r]=t[r]}this.valid=this.isValid(),this.updateShapeAndBoundsTagSetted()||!e&&!this.needUpdateTags(i)?this.addUpdateBoundTag():this.addUpdateShapeAndBoundsTag(),this.addUpdatePositionTag(),this.addUpdateLayoutTag(),this.onAttributeUpdate(r)}setAttribute(t,e,r,i){var n;const s=this.onBeforeAttributeUpdate&&this.onBeforeAttributeUpdate({[t]:e},this.attribute,t,i);s?this._setAttributes(s,r,i):_t(null===(n=this.normalAttrs)||void 0===n?void 0:n[t])?(this.attribute[t]=e,this.valid=this.isValid(),this.updateShapeAndBoundsTagSetted()||!r&&!this.needUpdateTag(t)?this.addUpdateBoundTag():this.addUpdateShapeAndBoundsTag(),this.addUpdatePositionTag(),this.addUpdateLayoutTag(),this.onAttributeUpdate(i)):this.normalAttrs[t]=e,"background"===t?this.loadImage(e,!0):"shadowGraphic"===t&&this.setShadowGraphic(e)}needUpdateTags(t,e=Go){for(let r=0;r<e.length;r++){const i=e[r];if(-1!==t.indexOf(i))return!0}return!1}needUpdateTag(t,e=Go){for(let r=0;r<e.length;r++)if(t===e[r])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=Ye.INIT,this.valid=this.isValid(),this.onAttributeUpdate(e)}translate(t,e){var r,i;if(0===t&&0===e)return this;const n={type:Ze.TRANSLATE},s=this.onBeforeAttributeUpdate&&this.onBeforeAttributeUpdate({x:t,y:e},this.attribute,Xo,n);s&&(t=s.x,e=s.y,delete s.x,delete s.y,this._setAttributes(s));const o=this.attribute,a=o.postMatrix;return a?rt.transformUtil.fromMatrix(a,a).translate(t,e):(o.x=(null!==(r=o.x)&&void 0!==r?r:Xr.x)+t,o.y=(null!==(i=o.y)&&void 0!==i?i:Xr.y)+e),this.addUpdatePositionTag(),this.addUpdateBoundTag(),this.addUpdateLayoutTag(),this.onAttributeUpdate(n),this}translateTo(t,e){const r=this.attribute;if(r.x===t&&r.y===e)return this;const i={type:Ze.TRANSLATE_TO},n=this.onBeforeAttributeUpdate&&this.onBeforeAttributeUpdate({x:t,y:e},this.attribute,Xo,i);return n?(this._setAttributes(n,!1,i),this):(r.x=t,r.y=e,this.addUpdatePositionTag(),this.addUpdateBoundTag(),this.addUpdateLayoutTag(),this.onAttributeUpdate(i),this)}scale(t,e,r){var i,n;if(1===t&&1===e)return this;const s={type:Ze.SCALE},o=this.onBeforeAttributeUpdate&&this.onBeforeAttributeUpdate({scaleX:t,scaleY:e,scaleCenter:r},this.attribute,Yo,s);o&&(t=o.scaleX,e=o.scaleY,delete o.scaleX,delete o.scaleY,this._setAttributes(o));const a=this.attribute;if(r){let{postMatrix:i}=this.attribute;i||(i=new De,a.postMatrix=i),rt.transformUtil.fromMatrix(i,i).scale(t,e,r)}else a.scaleX=(null!==(i=a.scaleX)&&void 0!==i?i:Xr.scaleX)*t,a.scaleY=(null!==(n=a.scaleY)&&void 0!==n?n:Xr.scaleY)*e;return this.addUpdatePositionTag(),this.addUpdateBoundTag(),this.addUpdateLayoutTag(),this.onAttributeUpdate(s),this}scaleTo(t,e){const r=this.attribute;if(r.scaleX===t&&r.scaleY===e)return this;const i={type:Ze.SCALE_TO},n=this.onBeforeAttributeUpdate&&this.onBeforeAttributeUpdate({scaleX:t,scaleY:e},this.attribute,Yo,i);return n?(this._setAttributes(n,!1,i),this):(r.scaleX=t,r.scaleY=e,this.addUpdatePositionTag(),this.addUpdateBoundTag(),this.addUpdateLayoutTag(),this.onAttributeUpdate(i),this)}rotate(t,e){var r;if(0===t)return this;const i={type:Ze.ROTATE},n=this.onBeforeAttributeUpdate&&this.onBeforeAttributeUpdate({angle:t,rotateCenter:e},this.attribute,qo,i);n&&(delete n.angle,this._setAttributes(n,!1,i));const s=this.attribute;if(e){let{postMatrix:r}=this.attribute;r||(r=new De,s.postMatrix=r),rt.transformUtil.fromMatrix(r,r).rotate(t,e)}else s.angle=(null!==(r=s.angle)&&void 0!==r?r:Xr.angle)+t;return this.addUpdatePositionTag(),this.addUpdateBoundTag(),this.addUpdateLayoutTag(),this.onAttributeUpdate(i),this}rotateTo(t){const e=this.attribute;if(e.angle===t)return this;const r={type:Ze.ROTATE_TO},i=this.onBeforeAttributeUpdate&&this.onBeforeAttributeUpdate(t,this.attribute,qo,r);return i?(this._setAttributes(i,!1,r),this):(e.angle=t,this.addUpdatePositionTag(),this.addUpdateBoundTag(),this.addUpdateLayoutTag(),this.onAttributeUpdate(r),this)}skewTo(t,e){return this}onAttributeUpdate(t){t&&t.skipUpdateCallback||(this.getGraphicService().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)&&(!!_t(t)||this.currentStates.includes(t))}getState(t){var e;return null===(e=this.states)||void 0===e?void 0:e[t]}applyStateAttrs(t,e,r,i){var n,s;if(r){const e=Object.keys(t),r=this.getNoWorkAnimateAttr(),o={};let a;e.forEach((e=>{r[e]?(a||(a={}),a[e]=t[e]):o[e]=i&&void 0===t[e]?this.getDefaultAttribute(e):t[e]}));const l=null!==(s=null!==(n=this.context&&this.context.stateAnimateConfig)&&void 0!==n?n:this.stateAnimateConfig)&&void 0!==s?s:Lo;this.applyAnimationState(["state"],[{name:"state",animation:{type:"state",to:o,duration:l.duration,easing:l.easing}}]),a&&this.setAttributesAndPreventAnimate(a,!1,{type:Ze.STATE})}else this.stopStateAnimates(),this.setAttributesAndPreventAnimate(t,!1,{type:Ze.STATE}),this.finalAttribute&&Object.assign(this.finalAttribute,t);this._emitCustomEvent("afterStateUpdate",{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(t="end"){this.animates&&this.animates.forEach((e=>{e.stateNames&&(e.stop(t),this.animates.delete(e.id))}))}getNormalAttribute(t){var e,r;const i=this.attribute[t];return this.animates?null===(e=this.finalAttribute)||void 0===e?void 0:e[t]:null!=i?i:null===(r=this.finalAttribute)||void 0===r?void 0:r[t]}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 r=Et(t)?e=>!t.includes(e):e=>e!==t,i=this.currentStates.filter(r);i.length!==this.currentStates.length&&this.useStates(i,e)}}toggleState(t,e){if(this.hasState(t))this.removeState(t,e);else if((this.currentStates?this.currentStates.indexOf(t):-1)<0){const r=this.currentStates?this.currentStates.slice():[];r.push(t),this.useStates(r,e)}}addState(t,e,r){var i;if(this.currentStates&&this.currentStates.includes(t)&&(e||1===this.currentStates.length))return;const n=e&&(null===(i=this.currentStates)||void 0===i?void 0:i.length)?this.currentStates.concat([t]):[t];this.useStates(n,r)}useStates(t,e){var r;if(!t.length)return void this.clearStates(e);if((null===(r=this.currentStates)||void 0===r?void 0:r.length)===t.length&&!t.some(((t,e)=>this.currentStates[e]!==t)))return;const i={};t.forEach((e=>{var r;const n=this.stateProxy?this.stateProxy(e,t):null===(r=this.states)||void 0===r?void 0:r[e];n&&Object.assign(i,n)})),this.updateNormalAttrs(i),this.currentStates=t,this.applyStateAttrs(i,t,e)}addUpdateBoundTag(){this._updateTag|=Ye.UPDATE_BOUNDS,this.parent&&this.parent.addChildUpdateBoundTag(),this.glyphHost&&this.glyphHost.addUpdateBoundTag()}addUpdateShapeTag(){this._updateTag|=Ye.UPDATE_SHAPE}addUpdateShapeAndBoundsTag(){this._updateTag|=Ye.UPDATE_SHAPE_AND_BOUNDS,this.parent&&this.parent.addChildUpdateBoundTag(),this.glyphHost&&this.glyphHost.addUpdateBoundTag()}updateShapeAndBoundsTagSetted(){return(this._updateTag&Ye.UPDATE_SHAPE_AND_BOUNDS)===Ye.UPDATE_SHAPE_AND_BOUNDS}clearUpdateBoundTag(){this._updateTag&=Ye.CLEAR_BOUNDS}addUpdatePositionTag(){this.shadowRoot&&this.shadowRoot.addUpdateGlobalPositionTag(),this._updateTag|=Ye.UPDATE_GLOBAL_LOCAL_MATRIX}addUpdateGlobalPositionTag(){this.shadowRoot&&this.shadowRoot.addUpdateGlobalPositionTag(),this._updateTag|=Ye.UPDATE_GLOBAL_MATRIX}clearUpdateLocalPositionTag(){this._updateTag&=Ye.CLEAR_LOCAL_MATRIX}clearUpdateGlobalPositionTag(){this._updateTag&=Ye.CLEAR_GLOBAL_MATRIX}addUpdateLayoutTag(){this._updateTag|=Ye.UPDATE_LAYOUT}clearUpdateLayoutTag(){this._updateTag&=Ye.CLEAR_LAYOUT}needUpdateLayout(){return!!(this._updateTag&Ye.UPDATE_LAYOUT)}getAnchor(t,e,r){const i=[0,0],n=()=>{if(e.b)return e.b;const t=this.clone();return t.attribute.angle=0,t.attribute.scaleCenter=null,r&&(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,r=n();i[0]=r.x1+(r.x2-r.x1)*e}else i[0]=t[0];if("string"==typeof t[1]){const e=parseFloat(t[1])/100,r=n();i[1]=r.y1+(r.y2-r.y1)*e}else i[1]=t[1];return i}doUpdateLocalMatrix(){const{x:t=Xr.x,y:e=Xr.y,scaleX:r=Xr.scaleX,scaleY:i=Xr.scaleY,angle:n=Xr.angle,scaleCenter:s,anchor:o,postMatrix:a}=this.attribute;let l=[0,0];const h={};if(o&&n&&(l=this.getAnchor(o,h)),!s||1===r&&1===i)!function(t,e,r,i,n,s,o,a){const l=e.a,h=e.b,c=e.c,u=e.d,d=e.e,p=e.f,f=ae(o),g=ce(o);let m,y;a?(m=a[0],y=a[1]):(m=r,y=i);const v=m-r,b=y-i,_=l*f+c*g,w=h*f+u*g,x=c*f-l*g,S=u*f-h*g;t.a=n*_,t.b=n*w,t.c=s*x,t.d=s*S,t.e=d+l*m+c*y-_*v-x*b,t.f=p+h*m+u*y-w*v-S*b}(this._transMatrix,this._transMatrix.reset(),t,e,r,i,n,o&&l);else{const o=this._transMatrix;o.reset(),o.translate(l[0],l[1]),o.rotate(n),o.translate(-l[0],-l[1]),o.translate(t,e),l=this.getAnchor(s,h,!0),rt.transformUtil.fromMatrix(o,o).scale(r,i,{x:l[0],y:l[1]})}const c=this.getOffsetXY(Xr);if(this._transMatrix.e+=c.x,this._transMatrix.f+=c.y,a){const t=Vo.setValue(a.a,a.b,a.c,a.d,a.e,a.f),e=this._transMatrix;t.multiply(e.a,e.b,e.c,e.d,e.e,e.f),e.setValue(t.a,t.b,t.c,t.d,t.e,t.f)}}doUpdateGlobalMatrix(){if(this.parent){this._globalTransMatrix.multiply(this.transMatrix.a,this.transMatrix.b,this.transMatrix.c,this.transMatrix.d,this.transMatrix.e,this.transMatrix.f);const{scrollX:t=0,scrollY:e=0}=this.parent.attribute;this._globalTransMatrix.translate(t,e)}}setStage(t,e){if(this.stage!==t){if(this.stage=t,this.layer=e,this.setStageToShadowRoot(t,e),this.animates&&this.animates.size){const e=t.getTimeline();this.animates.forEach((t=>{t.timeline.isGlobal&&(t.setTimeline(e),e.addAnimate(t))}))}this._onSetStage&&this._onSetStage(this,t,e),this.getGraphicService().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})}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,e=!1){this._onSetStage=t,e&&this.stage&&t(this,this.stage)}attachShadow(t){return t&&(t.shadowHost=this),this.shadowRoot=null!=t?t:rt.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 Ct(t,!0)?this.pathProxy=(new $r).fromString(t):this.pathProxy=new $r,this.pathProxy}loadImage(t,e=!1){if(!t||e&&function(t){return!(!t.fill&&!t.stroke)}(t))return;const r=t;this.resources||(this.resources=new Map);const i={data:"init",state:null};this.resources.set(r,i),"string"==typeof t?(i.state="loading",t.startsWith("<svg")?(jn.GetSvg(t,this),this.backgroundImg=this.backgroundImg||e):(Rt(t)||t.includes("/")||Lt(t))&&(jn.GetImage(t,this),this.backgroundImg=this.backgroundImg||e)):xt(t)?(i.state="success",i.data=t,this.backgroundImg=this.backgroundImg||e):i.state="fail"}setShadowGraphic(t){t?this.attachShadow().add(t):this.detachShadow()}imageLoadSuccess(t,e,r){if(!this.resources)return;const i=this.resources.get(t);i&&(i.state="success",i.data=e,r&&r(),this.addUpdateBoundTag(),this.stage&&this.stage.renderNextFrame())}imageLoadFail(t,e){if(!this.resources)return;const r=this.resources.get(t);r&&(r.state="fail",e&&e())}_stopAnimates(t){t&&t.forEach((t=>{t.stop()}))}stopAnimates(t=!1){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(),rt.graphicService.onRelease(this)}_emitCustomEvent(t,e){var r,i;if(this._events&&t in this._events){const n=new Pn(t,e);n.bubbles=!1,n.manager=null===(i=null===(r=this.stage)||void 0===r?void 0:r.eventSystem)||void 0===i?void 0:i.manager,this.dispatchEvent(n)}}toCustomPath(){var t,e,r;const i=null===(r=null===(e=(null===(t=this.stage)||void 0===t?void 0:t.renderService)||rt.renderService)||void 0===e?void 0:e.drawContribution)||void 0===r?void 0:r.getRenderContribution(this);if(i){const t=new Uo(null,1);return i.drawShape(this,t,0,0,{},{}),t.path}return null}}var Jo;Qo.userSymbolMap={},Qo.mixin(In),function(t){t[t.LESS_GROUP=0]="LESS_GROUP",t[t.MORE_GROUP=1]="MORE_GROUP"}(Jo||(Jo={}));class ta extends Qo{constructor(t){super(t),this.type="group",this.parent=null,this.isContainer=!0,this.numberType=wo,this._childUpdateTag=Ye.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 Tn),this.theme.setTheme(t,this)}createTheme(){this.theme||(this.theme=new Tn)}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,r){if(r===qe.GLOBAL){const r=new fe(t,e);return this.parent&&this.parent.globalTransMatrix.transformPoint(r,r),this.AABBBounds.contains(r.x,r.y)}return this.AABBBounds.contains(t,e)}shouldUpdateAABBBounds(){return!!super.shouldUpdateAABBBounds()||!!(this._childUpdateTag&Ye.UPDATE_BOUNDS)}tryUpdateAABBBounds(){if(!this.shouldUpdateAABBBounds())return this._AABBBounds;this.getGraphicService().beforeUpdateAABBBounds(this,this.stage,!0,this._AABBBounds);const t=this.shouldSelfChangeUpdateAABBBounds(),e=this.doUpdateAABBBounds();return this.addUpdateLayoutTag(),this.getGraphicService().afterUpdateAABBBounds(this,this.stage,this._AABBBounds,this,t),"empty"===this.attribute.boundsMode&&e.clear(),e}doUpdateLocalMatrix(){const{x:t=Xr.x,y:e=Xr.y,dx:r=Xr.dx,dy:i=Xr.dy,scaleX:n=Xr.scaleX,scaleY:s=Xr.scaleY,angle:o=Xr.angle,postMatrix:a}=this.attribute;if(0!==t||0!==e||0!==r||0!==i||1!==n||1!==s||0!==o||a)return super.doUpdateLocalMatrix();this._transMatrix.reset()}getGraphicTheme(){return Cn(this).group}updateAABBBounds(t,e,r){const i=r;r=r.clone();const{width:n,height:s,path:o,clip:a=e.clip}=t;if(o&&o.length?o.forEach((t=>{r.union(t.AABBBounds)})):null!=n&&null!=s&&r.set(0,0,Math.max(0,n),Math.max(0,s)),!a){this.forEachChildren((t=>{r.union(t.AABBBounds)}));const{scrollX:e=0,scrollY:i=0}=t;r.translate(e,i)}return rt.graphicService.updateTempAABBBounds(r),rt.graphicService.transformAABBBounds(t,r,e,!1,this),i.copy(r),i}doUpdateAABBBounds(){this.updateAABBBoundsStamp++;const t=super.doUpdateAABBBounds();return this.parent&&this.parent.addChildUpdateBoundTag(),this._emitCustomEvent("AAABBBoundsChange"),t}clearUpdateBoundTag(){this._updateTag&=Ye.CLEAR_BOUNDS,this._childUpdateTag&=Ye.CLEAR_BOUNDS}addUpdateBoundTag(){this._updateTag|=Ye.UPDATE_BOUNDS,this.parent&&this.parent.addChildUpdateBoundTag()}addChildUpdateBoundTag(){this._childUpdateTag&Ye.UPDATE_BOUNDS||(this._childUpdateTag|=Ye.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(),this.getGraphicService().onAddIncremental(t,this,this.stage),e}incrementalClearChild(){super.removeAllChild(),this.addUpdateBoundTag(),this.getGraphicService().onClearIncremental(this,this.stage)}_updateChildToStage(t){return this.stage&&t&&t.setStage(this.stage,this.layer),this.addUpdateBoundTag(),t}appendChild(t,e=!0){const r=super.appendChild(t);return e&&this.stage&&r&&r.setStage(this.stage,this.layer),this.addUpdateBoundTag(),r}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 this.getGraphicService().onRemove(t),t.stage=null,this.addUpdateBoundTag(),e}removeAllChild(t=!1){this.forEachChildren((e=>{this.getGraphicService().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),this.getGraphicService().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(t=!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&Ye.UPDATE_GLOBAL_MATRIX)}_getChildByName(t,e){return this.find((e=>e.name===t),e)}createOrUpdateChild(t,e,r){let i=this._getChildByName(t);return i?i.setAttributes(e):(i=rt.graphicService.creator[r](e),i.name=t,this.add(i)),i}clone(){return new ta(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return ta.NOWORK_ANIMATE_ATTR}release(t){t&&this.forEachChildren((e=>{e.release(t)})),super.release()}}function ea(t){return new ta(t)}ta.NOWORK_ANIMATE_ATTR=Ko;class ra extends ta{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,r,i){var n;super({}),this.stage=t,this.global=e,this.window=r,this.main=i.main,this.layerHandler=i.layerHandler,this.layerHandler.init(this,r,{main:i.main,canvasId:i.canvasId,width:this.viewWidth,height:this.viewHeight,zIndex:null!==(n=i.zIndex)&&void 0!==n?n:0}),this.layer=this,this.subLayers=new Map,this.theme=new Tn,this.background="rgba(0, 0, 0, 0)",this.afterDrawCbs=[]}combineSubLayer(t=!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=>{rt.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((r=>{r.layer.renderCount=this.renderCount,r.layer.render(t,e)}))}render(t,e){var r;this.layerHandler.render([this],{renderService:t.renderService,stage:this.stage,layer:this,viewBox:t.viewBox,transMatrix:t.transMatrix,background:null!==(r=t.background)&&void 0!==r?r: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=>{rt.layerService.releaseLayer(this.stage,t.layer)}))}drawTo(t,e){var r;this.layerHandler.drawTo(t,[this],Object.assign({background:null!==(r=e.background)&&void 0!==r?r:this.background,renderService:e.renderService,viewBox:e.viewBox,transMatrix:e.transMatrix,stage:this.stage,layer:this},e)),this.afterDrawCbs.forEach((t=>t(this)))}}const ia=Symbol.for("TransformUtil"),na=Symbol.for("GraphicUtil"),sa=Symbol.for("LayerService"),oa=Symbol.for("StaticLayerHandlerContribution"),aa=Symbol.for("DynamicLayerHandlerContribution"),la=Symbol.for("VirtualLayerHandlerContribution");var ha,ca=function(t,e,r,i){var n,s=arguments.length,o=s<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,e,r,i);else for(var a=t.length-1;a>=0;a--)(n=t[a])&&(o=(s<3?n(o):s>3?n(e,r,o):n(e,r))||o);return s>3&&o&&Object.defineProperty(e,r,o),o},ua=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let da=ha=class{static GenerateLayerId(){return`${ha.idprefix}_${ha.prefix_count++}`}constructor(){this.layerMap=new Map,this.global=rt.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?Ai.get(oa):"dynamic"===t?Ai.get(aa):Ai.get(la),e}createLayer(t,e={main:!1}){var r;this.tryInit();let i=this.getRecommendedLayerType(e.layerMode);i=e.main||e.canvasId?"static":i;const n=this.getLayerHandler(i),s=new ra(t,this.global,t.window,Object.assign(Object.assign({main:!1},e),{layerMode:i,canvasId:null!==(r=e.canvasId)&&void 0!==r?r:ha.GenerateLayerId(),layerHandler:n})),o=this.layerMap.get(t)||[];return o.push(s),this.layerMap.set(t,o),this.staticLayerCountInEnv--,s}prepareStageLayer(t){let e;t.forEachChildren((t=>{const r=t.getNativeHandler();"virtual"===r.type?(r.mainHandler=e,e.secondaryHandlers.push(r)):(e=r,e.secondaryHandlers=[])}))}releaseLayer(t,e){e.release();const r=this.layerMap.get(t)||[];this.layerMap.set(t,r.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)}};da.idprefix="visactor_layer",da.prefix_count=0,da=ha=ca([L(),ua("design:paramtypes",[])],da);var pa=new v((t=>{t(et).to(ct).inSingletonScope(),t(cn).to(dn),t(na).to(mn).inSingletonScope(),t(ia).to(bn).inSingletonScope(),t(sa).to(da).inSingletonScope()}));function fa(t,e){return!(!t&&!e)}function ga(t,e){let r;return r=Et(t)?t.some((t=>t||void 0===t)):!!t,r&&e>0}function ma(t,e,r){return r&&t*e>0}function ya(t,e,r,i,n){return n&&t*e>0&&0!==r&&0!==i}function va(t,e){return t*e>0}function ba(t,e,r,i){return t*e>0&&0!==r&&0!==i}const _a=Symbol.for("AreaRenderContribution"),wa=Symbol.for("GroupRenderContribution"),xa=Symbol.for("RectRenderContribution"),Sa=Symbol.for("SymbolRenderContribution"),Ta=Symbol.for("TextRenderContribution"),ka=Symbol.for("InteractiveSubRenderContribution");function Ca(t,e){return"end"===t||"right"===t?-e:"center"===t?-e/2:0}function Ea(t,e,r,i=0){return"middle"===t?-e/2:"top"===t?0:"bottom"===t?i-e:t&&"alphabetic"!==t?0:(r||(r=e),-(e-r)/2-.79*r)}var Aa=function(t,e,r,i){var n,s=arguments.length,o=s<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,e,r,i);else for(var a=t.length-1;a>=0;a--)(n=t[a])&&(o=(s<3?n(o):s>3?n(e,r,o):n(e,r))||o);return s>3&&o&&Object.defineProperty(e,r,o),o},Oa=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Ba=function(t,e){return function(r,i){e(r,i,t)}};function Ra(t,e,r){var i;const{x:n=r.x,y:s=r.y,z:o=r.z,dx:a=r.dx,dy:l=r.dy,dz:h=r.dz,scaleX:c=r.scaleX,scaleY:u=r.scaleY,scaleZ:d=r.scaleZ,alpha:p=r.alpha,beta:f=r.beta,angle:g=r.angle,anchor3d:m=e.attribute.anchor,anchor:y}=e.attribute,v=[0,0,0];if(m){if("string"==typeof m[0]){const t=parseFloat(m[0])/100,r=e.AABBBounds;v[0]=r.x1+(r.x2-r.x1)*t}else v[0]=m[0];if("string"==typeof m[1]){const t=parseFloat(m[1])/100,r=e.AABBBounds;v[1]=r.x1+(r.x2-r.x1)*t}else v[1]=m[1];v[2]=null!==(i=m[2])&&void 0!==i?i:0}if(Po(t),Do(t,t,[n+a,s+l,o+h]),Do(t,t,[v[0],v[1],v[2]]),function(t,e,r){const i=Math.sin(r),n=Math.cos(r),s=e[4],o=e[5],a=e[6],l=e[7],h=e[8],c=e[9],u=e[10],d=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]=s*n+h*i,t[5]=o*n+c*i,t[6]=a*n+u*i,t[7]=l*n+d*i,t[8]=h*n-s*i,t[9]=c*n-o*i,t[10]=u*n-a*i,t[11]=d*n-l*i}(t,t,f),function(t,e,r){const i=Math.sin(r),n=Math.cos(r),s=e[0],o=e[1],a=e[2],l=e[3],h=e[8],c=e[9],u=e[10],d=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]=s*n-h*i,t[1]=o*n-c*i,t[2]=a*n-u*i,t[3]=l*n-d*i,t[8]=s*i+h*n,t[9]=o*i+c*n,t[10]=a*i+u*n,t[11]=l*i+d*n}(t,t,p),Do(t,t,[-v[0],-v[1],v[2]]),function(t,e,r){const i=r[0],n=r[1],s=r[2];t[0]=e[0]*i,t[1]=e[1]*i,t[2]=e[2]*i,t[3]=e[3]*i,t[4]=e[4]*n,t[5]=e[5]*n,t[6]=e[6]*n,t[7]=e[7]*n,t[8]=e[8]*s,t[9]=e[9]*s,t[10]=e[10]*s,t[11]=e[11]*s,t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]}(t,t,[c,u,d]),g){const r=Fo.allocate(),i=[0,0];if(y){if("string"==typeof m[0]){const t=parseFloat(m[0])/100,r=e.AABBBounds;i[0]=r.x1+(r.x2-r.x1)*t}else i[0]=m[0];if("string"==typeof m[1]){const t=parseFloat(m[1])/100,r=e.AABBBounds;i[1]=r.x1+(r.x2-r.x1)*t}else i[1]=m[1]}Do(r,r,[i[0],i[1],0]),function(t,e,r){const i=Math.sin(r),n=Math.cos(r),s=e[0],o=e[1],a=e[2],l=e[3],h=e[4],c=e[5],u=e[6],d=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]=s*n+h*i,t[1]=o*n+c*i,t[2]=a*n+u*i,t[3]=l*n+d*i,t[4]=h*n-s*i,t[5]=c*n-o*i,t[6]=u*n-a*i,t[7]=d*n-l*i}(r,r,g),Do(r,r,[-i[0],-i[1],0]),Mo(t,t,r)}}let La=class{constructor(t){this.creator=t,this.hooks={onAttributeUpdate:new J(["graphic"]),onSetStage:new J(["graphic","stage"]),onRemove:new J(["graphic"]),onRelease:new J(["graphic"]),onAddIncremental:new J(["graphic","group","stage"]),onClearIncremental:new J(["graphic","group","stage"]),beforeUpdateAABBBounds:new J(["graphic","stage","willUpdate","aabbBounds"]),afterUpdateAABBBounds:new J(["graphic","stage","aabbBounds","globalAABBBounds","selfChange"]),clearAABBBounds:new J(["graphic","stage","aabbBounds"])},this.tempAABBBounds1=new Le,this.tempAABBBounds2=new Le}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,r){this.hooks.onAddIncremental.taps.length&&this.hooks.onAddIncremental.call(t,e,r)}onClearIncremental(t,e){this.hooks.onClearIncremental.taps.length&&this.hooks.onClearIncremental.call(t,e)}beforeUpdateAABBBounds(t,e,r,i){this.hooks.beforeUpdateAABBBounds.taps.length&&this.hooks.beforeUpdateAABBBounds.call(t,e,r,i)}afterUpdateAABBBounds(t,e,r,i,n){this.hooks.afterUpdateAABBBounds.taps.length&&this.hooks.afterUpdateAABBBounds.call(t,e,r,i,n)}clearAABBBounds(t,e,r){this.hooks.clearAABBBounds.taps.length&&this.hooks.clearAABBBounds.call(t,e,r)}updatePathProxyAABBBounds(t,e){const r="function"==typeof e.pathProxy?e.pathProxy(e.attribute):e.pathProxy;if(!r)return!1;const i=new Ne(t);return ir(r.commandList,i,0,0),!0}updateHTMLTextAABBBounds(t,e,r,i){const{textAlign:n,textBaseline:s}=t;if(null!=t.forceBoundsHeight){const e=Ot(t.forceBoundsHeight)?t.forceBoundsHeight:t.forceBoundsHeight(),i=Ea(s,e,e);r.set(r.x1,i,r.x2,i+e)}if(null!=t.forceBoundsWidth){const e=Ot(t.forceBoundsWidth)?t.forceBoundsWidth:t.forceBoundsWidth(),i=Ca(n,e);r.set(i,r.y1,i+e,r.y2)}}combindShadowAABBBounds(t,e){if(e&&e.shadowRoot){const r=e.shadowRoot.AABBBounds;t.union(r)}}transformAABBBounds(t,e,r,i,n){if(!e.empty()){const{scaleX:n=r.scaleX,scaleY:s=r.scaleY,stroke:o=r.stroke,shadowBlur:a=r.shadowBlur,lineWidth:l=r.lineWidth,pickStrokeBuffer:h=r.pickStrokeBuffer,strokeBoundsBuffer:c=r.strokeBoundsBuffer}=t,u=this.tempAABBBounds1,d=this.tempAABBBounds2;if(o&&l){co(u,(l+h)/Math.abs(n+s),i,c),e.union(u),u.setValue(d.x1,d.y1,d.x2,d.y2)}if(a){const{shadowOffsetX:i=r.shadowOffsetX,shadowOffsetY:o=r.shadowOffsetY}=t;co(u,a/Math.abs(n+s)*2,!1,c+1),u.translate(i,o),e.union(u)}}if(this.combindShadowAABBBounds(e,n),e.empty())return;let s=!0;const o=n.transMatrix;n&&n.isContainer&&(s=!(1===o.a&&0===o.b&&0===o.c&&1===o.d&&0===o.e&&0===o.f)),s&&Be(e,e,o)}validCheck(t,e,r,i){if(!i)return!0;if(null!=t.forceBoundsHeight||null!=t.forceBoundsWidth)return!0;if(i.shadowRoot||i.isContainer)return!0;const{visible:n=e.visible}=t;return!(!i.valid||!n)||(r.empty()||(i.parent&&r.transformWithMatrix(i.parent.globalTransMatrix),this.clearAABBBounds(i,i.stage,r),r.clear()),!1)}updateTempAABBBounds(t){const e=this.tempAABBBounds1,r=this.tempAABBBounds2;return e.setValue(t.x1,t.y1,t.x2,t.y2),r.setValue(t.x1,t.y1,t.x2,t.y2),{tb1:e,tb2:r}}};La=Aa([L(),Ba(0,B(Oo)),Oa("design:paramtypes",[Object])],La);const Pa=(t,e,r)=>{const{outerBorder:i,shadowBlur:n=e.shadowBlur}=t;if(i){const t=e.outerBorder,{distance:s=t.distance,lineWidth:o=t.lineWidth}=i;r.expand(s+(n+o)/2)}return r},Da=["radius","startAngle","endAngle",...Go];class Ma extends Qo{constructor(t={radius:1}){super(t),this.type="circle",this.numberType=_o}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{startAngle:t,endAngle:e,radius:r}=this.attribute;return this._validNumber(t)&&this._validNumber(e)&&this._validNumber(r)}getGraphicTheme(){return Cn(this).circle}updateAABBBounds(t,e,r,i){this.updatePathProxyAABBBounds(r)||(i?this.updateCircleAABBBoundsImprecise(t,e,r):this.updateCircleAABBBoundsAccurate(t,e,r));const{tb1:n,tb2:s}=rt.graphicService.updateTempAABBBounds(r);return Pa(t,e,n),r.union(n),n.setValue(s.x1,s.y1,s.x2,s.y2),this.widthWithoutTransform=r.x2-r.x1,this.heightWithoutTransform=r.y2-r.y1,rt.graphicService.transformAABBBounds(t,r,e,!1,this),r}updateCircleAABBBoundsImprecise(t,e,r){const{radius:i=e.radius}=t;return r.set(-i,-i,i,i),r}updateCircleAABBBoundsAccurate(t,e,r){const{startAngle:i=e.startAngle,endAngle:n=e.endAngle,radius:s=e.radius}=t;return n-i>ne-te?r.set(-s,-s,s,s):function(t,e,r,i){for(;t>=ne;)t-=ne;for(;t<0;)t+=ne;for(;t>e;)e+=ne;Un[0].x=r,Un[1].y=r,Un[2].x=-r,Un[3].y=-r;const n=Math.ceil(t/re)%4,s=Math.ceil(e/re)%4;if(i.add(ae(t)*r,ce(t)*r),i.add(ae(e)*r,ce(e)*r),n!==s||e-t>ee){let t=!1;for(let e=0;e<$n.length;e++)if(t||n!==$n[e]){if(t&&s===$n[e])break;if(t){const t=Un[$n[e]];i.add(t.x,t.y)}}else{t=!0;const e=Un[n];i.add(e.x,e.y)}}}(i,n,s,r),r}needUpdateTags(t){return super.needUpdateTags(t,Da)}needUpdateTag(t){return super.needUpdateTag(t,Da)}toCustomPath(){var t,e,r;let i=super.toCustomPath();if(i)return i;const n=this.attribute,s=null!==(t=n.radius)&&void 0!==t?t:this.getDefaultAttribute("radius"),o=null!==(e=n.startAngle)&&void 0!==e?e:this.getDefaultAttribute("startAngle"),a=null!==(r=n.endAngle)&&void 0!==r?r:this.getDefaultAttribute("endAngle");return i=new $r,i.arc(0,0,s,o,a),i}clone(){return new Ma(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return Ma.NOWORK_ANIMATE_ATTR}}Ma.NOWORK_ANIMATE_ATTR=Ko;class Ia{constructor(t,e,r){this.fontFamily=t,this.textOptions=e,this.textMeasure=r}LayoutBBox(t,e,r,i){if(t.xOffset="left"===e||"start"===e?0:"center"===e?t.width/-2:"right"===e||"end"===e?-t.width:0,"top"===r)t.yOffset=0;else if("middle"===r)t.yOffset=t.height/-2;else if("alphabetic"===r){let e=.79;if(1===i.length){const t=i[0];e=t.ascent/(t.ascent+t.descent)}t.yOffset=t.height*-e}else t.yOffset=-t.height;return t}GetLayoutByLines(t,e,r,i,n="",s,o){const{lineWidth:a,suffixPosition:l="end",measureMode:h=ut.actualBounding,keepCenterInLine:c=!1}=null!=o?o:{};t=t.map((t=>t.toString()));const u=[],d=[0,0];if("number"==typeof a&&a!==1/0){let e;for(let r=0,i=t.length;r<i;r++){const i=this.textMeasure.measureTextPixelADscentAndWidth(t[r],this.textOptions,h);let o=t[r].toString();if(i.width>a){const i=this.textMeasure.clipTextWithSuffix(t[r],this.textOptions,a,n,s,l);o=i.str,e=i.width}else e=i.width;u.push({str:o,width:e,ascent:i.ascent,descent:i.descent,keepCenterInLine:c})}d[0]=a}else{let e,r,i=0;for(let n=0,s=t.length;n<s;n++){r=t[n];const s=this.textMeasure.measureTextPixelADscentAndWidth(t[n],this.textOptions,h);e=s.width,i=Math.max(i,e),u.push({str:r,width:e,ascent:s.ascent,descent:s.descent,keepCenterInLine:c})}d[0]=i}d[1]=u.length*i,d[0]=u.reduce(((t,e)=>Math.max(t,e.width)),0);const p={xOffset:0,yOffset:0,width:d[0],height:d[1]};return this.LayoutBBox(p,e,r,u),this.layoutWithBBox(p,u,e,r,i)}layoutWithBBox(t,e,r,i,n){const s=[0,0],o=e.length*n;"top"===i||("middle"===i?s[1]=(t.height-o)/2:"bottom"===i&&(s[1]=t.height-o));for(let o=0;o<e.length;o++)this.lineOffset(t,e[o],r,i,n,s);return{bbox:t,lines:e,fontFamily:this.fontFamily,fontSize:this.textOptions.fontSize,fontWeight:this.textOptions.fontWeight,lineHeight:n,textAlign:r,textBaseline:i}}lineOffset(t,e,r,i,n,s){if("left"===r||"start"===r?e.leftOffset=0:"center"===r?e.leftOffset=(t.width-e.width)/2:"right"!==r&&"end"!==r||(e.leftOffset=t.width-e.width),e.topOffset=n/2+(e.ascent-e.descent)/2+s[1],!e.keepCenterInLine){const t=0,r=e.ascent+e.descent+t;if(r<n-t&&("bottom"===i?e.topOffset+=(n-r)/2:"top"===i&&(e.topOffset-=(n-r)/2)),"alphabetic"===i){const t=n/(e.ascent+e.descent);e.topOffset=n/2+(e.ascent-e.descent)/2*t+s[1]}}return s[1]+=n,e}}const Na=["text","maxLineWidth","maxWidth","textAlign","textBaseline","heightLimit","lineClamp","fontSize","fontFamily","fontWeight","ellipsis","lineHeight","direction","wordBreak","heightLimit","lineClamp",...Go];class Fa extends Qo{get font(){const t=this.getGraphicTheme();return this._font||(this._font=Ae(this.attribute,t)),this._font}get clipedText(){var t;const e=this.attribute,r=this.getGraphicTheme(),i=this.getMaxWidth(r);return Number.isFinite(i)?(this.tryUpdateAABBBounds(),this.cache.clipedText):(null!==(t=e.text)&&void 0!==t?t:r.text).toString()}get clipedWidth(){return this.tryUpdateAABBBounds(),this.cache.clipedWidth}get cliped(){var t,e;const r=this.getGraphicTheme(),i=this.attribute,n=this.getMaxWidth(r);if(!Number.isFinite(n))return!1;const{text:s}=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(s)?s.join(""):s)!==t}return"vertical"===i.direction&&this.cache.verticalList&&this.cache.verticalList[0]?this.cache.verticalList[0].map((t=>t.text)).join("")!==i.text.toString():null!=this.clipedText&&this.clipedText!==i.text.toString()}get multilineLayout(){return this.tryUpdateAABBBounds(),this.cache.layoutData}get isMultiLine(){return Array.isArray(this.attribute.text)||"normal"===this.attribute.whiteSpace}constructor(t={text:"",fontSize:16}){super(t),this.type="text",this.numberType=Eo,this.cache={}}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{text:t}=this.attribute;return Et(t)?!t.every((t=>null==t||""===t)):null!=t&&""!==t}getGraphicTheme(){return Cn(this).text}doUpdateOBBBounds(){const t=this.getGraphicTheme();this._OBBBounds.clear();const e=this.attribute,{angle:r=t.angle}=e;if(!r){const t=this.AABBBounds;return this._OBBBounds.setValue(t.x1,t.y1,t.x2,t.y2),this._OBBBounds}this.obbText||(this.obbText=new Fa({})),this.obbText.setAttributes(Object.assign(Object.assign({},e),{angle:0}));const i=this.obbText.AABBBounds,{x:n,y:s}=e,o={x:(i.x1+i.x2)/2,y:(i.y1+i.y2)/2},a=Se(o,r,{x:n,y:s});return this._OBBBounds.copy(i),this._OBBBounds.translate(a.x-o.x,a.y-o.y),this._OBBBounds.angle=r,this._OBBBounds}updateAABBBounds(t,e,r){const{text:i=e.text}=this.attribute;Array.isArray(i)?this.updateMultilineAABBBounds(i):this.updateSingallineAABBBounds(i);const{tb1:n}=rt.graphicService.updateTempAABBBounds(r),{scaleX:s=e.scaleX,scaleY:o=e.scaleY,shadowBlur:a=e.shadowBlur,strokeBoundsBuffer:l=e.strokeBoundsBuffer}=t;if(a){co(n,a/Math.abs(s+o),!0,l),r.union(n)}return rt.graphicService.combindShadowAABBBounds(r,this),null==t.forceBoundsHeight&&null==t.forceBoundsWidth||rt.graphicService.updateHTMLTextAABBBounds(t,e,r),this.widthWithoutTransform=r.x2-r.x1,this.heightWithoutTransform=r.y2-r.y1,Be(r,r,this.transMatrix),r}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:r=e.direction,underlineOffset:i=e.underlineOffset}=this.attribute,n="horizontal"===r?this.updateHorizontalMultilineAABBBounds(t):this.updateVerticalMultilineAABBBounds(t);return"horizontal"===r&&i&&this._AABBBounds.add(this._AABBBounds.x1,this._AABBBounds.y2+i),n}guessLineHeightBuf(t){return t?.1*t:0}updateHorizontalMultilineAABBBounds(t){var e;const r=this.getGraphicTheme(),i=this.attribute,{fontFamily:n=r.fontFamily,textAlign:s=r.textAlign,textBaseline:o=r.textBaseline,fontSize:a=r.fontSize,fontWeight:l=r.fontWeight,ellipsis:h=r.ellipsis,maxLineWidth:c,stroke:u=r.stroke,wrap:d=r.wrap,measureMode:p=r.measureMode,lineWidth:f=r.lineWidth,whiteSpace:g=r.whiteSpace,suffixPosition:m=r.suffixPosition,ignoreBuf:y=r.ignoreBuf,keepCenterInLine:v=r.keepCenterInLine}=i,b=y?0:this.guessLineHeightBuf(a),_=this.getLineHeight(i,r,b);if("normal"===g||d)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),u&&this._AABBBounds.expand(f/2),this._AABBBounds}const w=rt.graphicUtil.textMeasure,x=new Ia(n,{fontSize:a,fontWeight:l,fontFamily:n,lineHeight:_},w).GetLayoutByLines(t,s,o,_,!0===h?r.ellipsis:h||void 0,!1,{lineWidth:c,suffixPosition:m,measureMode:p,keepCenterInLine:v}),{bbox:S}=x;return this.cache.layoutData=x,this.clearUpdateShapeTag(),this._AABBBounds.set(S.xOffset,S.yOffset,S.xOffset+S.width,S.yOffset+S.height),u&&this._AABBBounds.expand(f/2),this._AABBBounds}updateWrapAABBBounds(t){var e,r,i;const n=this.getGraphicTheme(),{fontFamily:s=n.fontFamily,textAlign:o=n.textAlign,textBaseline:a=n.textBaseline,fontSize:l=n.fontSize,ellipsis:h=n.ellipsis,maxLineWidth:c,stroke:u=n.stroke,lineWidth:d=n.lineWidth,wordBreak:p=n.wordBreak,fontWeight:f=n.fontWeight,ignoreBuf:g=n.ignoreBuf,measureMode:m=n.measureMode,suffixPosition:y=n.suffixPosition,heightLimit:v=0,lineClamp:b,keepCenterInLine:_=n.keepCenterInLine}=this.attribute,w=g?0:this.guessLineHeightBuf(l),x=this.getLineHeight(this.attribute,n,w);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),u&&this._AABBBounds.expand(d/2),this._AABBBounds}const S=rt.graphicUtil.textMeasure,T={fontSize:l,fontWeight:f,fontFamily:s,lineHeight:x},k=new Ia(s,T,S),C=Et(t)?t.map((t=>t.toString())):[t.toString()],E=[],A=[0,0];let O=1/0;if(v>0&&(O=Math.max(Math.floor(v/x),1)),b&&(O=Math.min(O,b)),"number"==typeof c&&c!==1/0){if(c>0)for(let t=0;t<C.length;t++){const e=C[t];let n=!0;if(t===O-1){const r=S.clipTextWithSuffix(e,T,c,h,!1,y,t!==C.length-1),i=S.measureTextPixelADscentAndWidth(r.str,T,m);E.push({str:r.str,width:r.width,ascent:i.ascent,descent:i.descent,keepCenterInLine:_});break}const s=S.clipText(e,T,c,"break-all"!==p,"keep-all"===p);if(""!==e&&""===s.str||s.wordBreaked){if(h){const t=S.clipTextWithSuffix(e,T,c,h,!1,y);s.str=null!==(r=t.str)&&void 0!==r?r:"",s.width=null!==(i=t.width)&&void 0!==i?i:0}else s.str="",s.width=0;n=!1}const o=S.measureTextPixelADscentAndWidth(s.str,T,m);E.push({str:s.str,width:s.width,ascent:o.ascent,descent:o.descent,keepCenterInLine:_});let a=s.str.length;if(!s.wordBreaked||""!==e&&""===s.str||(n=!0,a=s.wordBreaked),s.str.length===e.length);else if(n){let r=e.substring(a);"keep-all"===p&&(r=r.replace(/^\s+/g,"")),C.splice(t+1,0,r)}}let t=0;E.forEach((e=>{t=Math.max(t,e.width)})),A[0]=t}else{let t,e,r=0;for(let i=0,n=C.length;i<n;i++){if(i===O-1){const t=S.clipTextWithSuffix(C[i],T,c,h,!1,y),e=S.measureTextPixelADscentAndWidth(t.str,T,m);E.push({str:t.str,width:t.width,ascent:e.ascent,descent:e.descent,keepCenterInLine:_}),r=Math.max(r,t.width);break}e=C[i],t=S.measureTextWidth(e,T),r=Math.max(r,t);const n=S.measureTextPixelADscentAndWidth(e,T,m);E.push({str:e,width:t,ascent:n.ascent,descent:n.descent,keepCenterInLine:_})}A[0]=r}A[1]=E.length*x;const B={xOffset:0,yOffset:0,width:A[0],height:A[1]};k.LayoutBBox(B,o,a,E);const R=k.layoutWithBBox(B,E,o,a,x);return this.cache.layoutData=R,this.clearUpdateShapeTag(),this._AABBBounds.set(B.xOffset,B.yOffset,B.xOffset+B.width,B.yOffset+B.height),u&&this._AABBBounds.expand(d/2),this._AABBBounds}updateVerticalMultilineAABBBounds(t){var e,r;const i=this.getGraphicTheme(),n=rt.graphicUtil.textMeasure;let s;const o=this.attribute,{maxLineWidth:a=i.maxLineWidth,ellipsis:l=i.ellipsis,fontFamily:h=i.fontFamily,fontSize:c=i.fontSize,fontWeight:u=i.fontWeight,stroke:d=i.stroke,lineWidth:p=i.lineWidth,verticalMode:f=i.verticalMode,suffixPosition:g=i.suffixPosition}=o,m=this.getLineHeight(o,i,0);let{textAlign:y=i.textAlign,textBaseline:v=i.textBaseline}=o;if(!f){const t=y;y=null!==(e=Fa.baselineMapAlign[v])&&void 0!==e?e:"left",v=null!==(r=Fa.alignMapBaseline[t])&&void 0!==r?r:"top"}if(s=0,!this.shouldUpdateShape()&&this.cache){this.cache.verticalList.forEach((t=>{const e=t.reduce(((t,e)=>t+e.width),0);s=le(e,s)}));const t=Ca(y,s),e=this.cache.verticalList.length*m,r=Ea(v,e,c);return this._AABBBounds.set(r,t,r+e,t+s),d&&this._AABBBounds.expand(p/2),this._AABBBounds}const b=t.map((t=>function(t){const e=[];let r=0,i="";for(let n=0;n<t.length;n++)yo(t[n])?r?i+=t[n]:(r=1,i=t[n]):(r&&(e.push({text:i,direction:fo.VERTICAL}),i="",r=0),e.push({text:t[n],direction:fo.HORIZONTAL}));return i&&e.push({text:i,direction:fo.VERTICAL}),e}(t.toString())));b.forEach(((t,e)=>{if(Number.isFinite(a))if(l){const r=!0===l?i.ellipsis:l,o=n.clipTextWithSuffixVertical(t,{fontSize:c,fontWeight:u,fontFamily:h},a,r,!1,g);b[e]=o.verticalList,s=o.width}else{const r=n.clipTextVertical(t,{fontSize:c,fontWeight:u,fontFamily:h},a,!1);b[e]=r.verticalList,s=r.width}else s=0,t.forEach((t=>{const e=t.direction===fo.HORIZONTAL?c:n.measureTextWidth(t.text,{fontSize:c,fontWeight:u,fontFamily:h});s+=e,t.width=e}))})),this.cache.verticalList=b,this.clearUpdateShapeTag(),this.cache.verticalList.forEach((t=>{const e=t.reduce(((t,e)=>t+e.width),0);s=le(e,s)}));const _=Ca(y,s),w=this.cache.verticalList.length*m,x=Ea(v,w,c);return this._AABBBounds.set(x,_,x+w,_+s),d&&this._AABBBounds.expand(p/2),this._AABBBounds}getMaxWidth(t){var e,r;const i=this.attribute;return null!==(r=null!==(e=i.maxLineWidth)&&void 0!==e?e:i.maxWidth)&&void 0!==r?r:t.maxWidth}getLineHeight(t,e,r){var i;return null!==(i=Yn(t.lineHeight,t.fontSize||e.fontSize))&&void 0!==i?i:(t.fontSize||e.fontSize)+r}needUpdateTags(t,e=Na){return super.needUpdateTags(t,e)}needUpdateTag(t,e=Na){return super.needUpdateTag(t,e)}_interpolate(t,e,r,i,n){"text"===t&&(n.text=i)}clone(){return new Fa(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return Fa.NOWORK_ANIMATE_ATTR}getBaselineMapAlign(){return Fa.baselineMapAlign}getAlignMapBaseline(){return Fa.alignMapBaseline}}function ja(t){return new Fa(t)}Fa.NOWORK_ANIMATE_ATTR=Object.assign({ellipsis:1,wordBreak:1,direction:1,textAlign:1,textBaseline:1,fontFamily:1,fontWeight:1},Ko),Fa.baselineMapAlign={top:"left",bottom:"right",middle:"center"},Fa.alignMapBaseline={left:"top",right:"bottom",center:"middle"};const za=["symbolType","size",...Go];let Ha=class t extends Qo{constructor(t={symbolType:"circle"}){super(t),this.type="symbol",this.numberType=Co}getParsedPath(){return this.shouldUpdateShape()&&(this._parsedPath=this.doUpdateParsedPath(),this.clearUpdateShapeTag()),this._parsedPath}getParsedPath2D(t=0,e=0,r=1){let i=null;try{i=new Path2D}catch(t){return null}const n=this.getParsedPath();if(!n)return null;n.draw(i,r,t,e)}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{size:t}=this.attribute;return Et(t)?2===t.length&&t.every(this._validNumber):this._validNumber(t)}doUpdateParsedPath(){const{symbolType:t="circle"}=this.attribute;return super.parsePath(t)}getGraphicTheme(){return Cn(this).symbol}updateAABBBounds(t,e,r,i){this.updatePathProxyAABBBounds(r)||(i?this.updateSymbolAABBBoundsImprecise(t,e,r):this.updateSymbolAABBBoundsAccurate(t,e,r));const{tb1:n,tb2:s}=rt.graphicService.updateTempAABBBounds(r);((t,e,r)=>{const{outerBorder:i,shadowBlur:n=e.shadowBlur,strokeBoundsBuffer:s=e.strokeBoundsBuffer}=t;if(i){const t=e.outerBorder,{distance:o=t.distance,lineWidth:a=t.lineWidth}=i;co(r,o+(n+a)/2,!0,s)}})(t,e,n),r.union(n),n.setValue(s.x1,s.y1,s.x2,s.y2),this.widthWithoutTransform=r.x2-r.x1,this.heightWithoutTransform=r.y2-r.y1,this.x1WithoutTransform=r.x1,this.y1WithoutTransform=r.y1;const{lineJoin:o=e.lineJoin}=t;return rt.graphicService.transformAABBBounds(t,r,e,"miter"===o,this),r}updateSymbolAABBBoundsImprecise(t,e,r){const{size:i=e.size}=t;if(Et(i))r.set(-i[0]/2,-i[1]/2,i[0]/2,i[1]/2);else{const t=i/2;r.set(-t,-t,t,t)}return r}updateSymbolAABBBoundsAccurate(t,e,r){const{size:i=e.size}=t;return this.getParsedPath().bounds(i,r),r}needUpdateTags(t){return super.needUpdateTags(t,za)}needUpdateTag(t){return super.needUpdateTag(t,za)}toCustomPath(){const t=this.getParsedPath(),e=this.attribute.size,r=Et(e)?e:[e,e];return t.path?(new $r).fromCustomPath2D(t.path,0,0,r[0],r[1]):(new $r).fromString(t.pathStr,0,0,r[0],r[1])}clone(){return new t(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return t.NOWORK_ANIMATE_ATTR}};function Wa(t){return new Ha(t)}Ha.NOWORK_ANIMATE_ATTR=Object.assign({symbolType:1},Ko);const Ua=["segments","points","curveType","curveTension",...Go];class $a extends Qo{constructor(t={}){super(t),this.type="line",this.numberType=So}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,r,i,n){"points"===t&&(n.points=Gn(r,i,e))}getGraphicTheme(){return Cn(this).line}updateAABBBounds(t,e,r){this.updatePathProxyAABBBounds(r)||(t.segments?this.updateLineAABBBoundsBySegments(t,e,r):this.updateLineAABBBoundsByPoints(t,e,r)),rt.graphicService.updateTempAABBBounds(r),this.widthWithoutTransform=r.x2-r.x1,this.heightWithoutTransform=r.y2-r.y1;const{lineJoin:i=e.lineJoin}=t;return rt.graphicService.transformAABBBounds(t,r,e,"miter"===i,this),r}updateLineAABBBoundsByPoints(t,e,r,i){const{points:n=e.points,connectedType:s}=t,o=r;return n.forEach((t=>{!1===t.defined&&"connect"!==s||o.add(t.x,t.y)})),o}updateLineAABBBoundsBySegments(t,e,r,i){const{segments:n=e.segments,connectedType:s}=t,o=r;return n.forEach((t=>{t.points.forEach((t=>{!1===t.defined&&"connect"!==s||o.add(t.x,t.y)}))})),o}needUpdateTags(t){return super.needUpdateTags(t,Ua)}needUpdateTag(t){return super.needUpdateTag(t,Ua)}toCustomPath(){let t=super.toCustomPath();if(t)return t;const e=this.attribute;t=new $r;const r=e.segments,i=e=>{if(e&&e.length){let r=!0;e.forEach((e=>{!1!==e.defined&&(r?t.moveTo(e.x,e.y):t.lineTo(e.x,e.y),r=!1)}))}};return r&&r.length?r.forEach((t=>{i(t.points)})):e.points&&i(e.points),t}clone(){return new $a(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return $a.NOWORK_ANIMATE_ATTR}}function Va(t){return new $a(t)}$a.NOWORK_ANIMATE_ATTR=Object.assign({segments:1,curveType:1},Ko);const Ga=["width","x1","y1","height","cornerRadius",...Go];class Xa extends Qo{constructor(t){super(t),this.type="rect",this.numberType=ko}isValid(){return super.isValid()&&this._isValid()}_isValid(){return!0}getGraphicTheme(){return Cn(this).rect}updateAABBBounds(t,e,r){if(!this.updatePathProxyAABBBounds(r)){let{width:e,height:i}=t;const{x1:n,y1:s,x:o,y:a}=t;e=null!=e?e:n-o,i=null!=i?i:s-a,(isFinite(e)||isFinite(i)||isFinite(o)||isFinite(a))&&r.set(0,0,e||0,i||0)}const{tb1:i,tb2:n}=rt.graphicService.updateTempAABBBounds(r);return Pa(t,e,i),r.union(i),i.setValue(n.x1,n.y1,n.x2,n.y2),this.widthWithoutTransform=r.x2-r.x1,this.heightWithoutTransform=r.y2-r.y1,rt.graphicService.transformAABBBounds(t,r,e,!1,this),r}needUpdateTags(t){return super.needUpdateTags(t,Ga)}needUpdateTag(t){return super.needUpdateTag(t,Ga)}toCustomPath(){let t=super.toCustomPath();if(t)return t;const e=this.attribute,{x:r,y:i,width:n,height:s}=(t=>{if(!t)return{x:0,y:0,width:0,height:0};let e=_t(t.width)?t.x1-t.x:t.width,r=_t(t.height)?t.y1-t.y:t.height,i=0,n=0;return e<0?(i=e,e=-e):Number.isNaN(e)&&(e=0),r<0?(n=r,r=-r):Number.isNaN(r)&&(r=0),{x:i,y:n,width:e,height:r}})(e);return t=new $r,t.moveTo(r,i),t.rect(r,i,n,s),t}clone(){return new Xa(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return Xa.NOWORK_ANIMATE_ATTR}}function Ya(t){return new Xa(t)}Xa.NOWORK_ANIMATE_ATTR=Ko;const qa=["width","height","image",...Go];let Za=class t extends Qo{constructor(t){super(t),this.type="image",this.numberType=xo,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,r){super.imageLoadSuccess(t,e,(()=>{this.successCallback&&this.successCallback()})),this.addUpdateBoundTag()}imageLoadFail(t,e){super.imageLoadFail(t,(()=>{this.failCallback&&this.failCallback()}))}setAttributes(t,e,r){return t.image&&this.loadImage(t.image),super.setAttributes(t,e,r)}setAttribute(t,e,r,i){return"image"===t&&this.loadImage(e),super.setAttribute(t,e,r,i)}getGraphicTheme(){return Cn(this).image}updateAABBBounds(t,e,r){if(!this.updatePathProxyAABBBounds(r)){const{maxWidth:i=e.maxWidth,maxHeight:n=e.maxHeight}=t;let{width:s,height:o}=t;if(null==s||null==o){const t=this.getImageElement();if(t){const e=t.width,r=t.height;if(null!=s)o=s*(r/e);else if(null!=o)s=o*(e/r);else{const t=e/r;t>i/n?(s=i,o=i/t):(o=n,s=n*t)}}else s=i,o=n}this._actualWidth=s,this._actualHeight=o,r.set(0,0,s,o)}const{tb1:i,tb2:n}=rt.graphicService.updateTempAABBBounds(r);return Pa(t,e,i),r.union(i),i.setValue(n.x1,n.y1,n.x2,n.y2),this.widthWithoutTransform=r.x2-r.x1,this.heightWithoutTransform=r.y2-r.y1,rt.graphicService.transformAABBBounds(t,r,e,!1,this),r}getDefaultAttribute(t){return pi[t]}needUpdateTags(t){return super.needUpdateTags(t,qa)}needUpdateTag(t){return super.needUpdateTag(t,qa)}clone(){return new t(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return t.NOWORK_ANIMATE_ATTR}};Za.NOWORK_ANIMATE_ATTR=Object.assign({image:1,repeatX:1,repeatY:1},Ko);const Ka=["points","cornerRadius",...Go];class Qa extends Qo{constructor(t){super(t),this.type="polygon",this.numberType=To}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{points:t}=this.attribute;return t&&t.length>=2}getGraphicTheme(){return Cn(this).polygon}updateAABBBounds(t,e,r){this.updatePathProxyAABBBounds(r)||this.updatePolygonAABBBoundsImprecise(t,e,r),rt.graphicService.updateTempAABBBounds(r),this.widthWithoutTransform=r.x2-r.x1,this.heightWithoutTransform=r.y2-r.y1;const{lineJoin:i=e.lineJoin}=t;return rt.graphicService.transformAABBBounds(t,r,e,"miter"===i,this),r}updatePolygonAABBBoundsImprecise(t,e,r){const{points:i=e.points}=t;return i.forEach((t=>{r.add(t.x,t.y)})),r}_interpolate(t,e,r,i,n){"points"===t&&(n.points=Gn(r,i,e))}needUpdateTags(t){return super.needUpdateTags(t,Ka)}needUpdateTag(t){return super.needUpdateTag(t,Ka)}toCustomPath(){let t=super.toCustomPath();if(t)return t;const e=this.attribute.points;return t=new $r,e.forEach(((e,r)=>{0===r?t.moveTo(e.x,e.y):t.lineTo(e.x,e.y)})),t.closePath(),t}clone(){return new Qa(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return Qa.NOWORK_ANIMATE_ATTR}}Qa.NOWORK_ANIMATE_ATTR=Ko;const Ja=new class{constructor(){this.store=new Map}RegisterGraphicCreator(t,e){this.store.set(t,e),this[t]=e}CreateGraphic(t,e){const r=this.store.get(t);return r?r(e):null}};let tl;var el=function(t,e,r,i){var n,s=arguments.length,o=s<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,e,r,i);else for(var a=t.length-1;a>=0;a--)(n=t[a])&&(o=(s<3?n(o):s>3?n(e,r,o):n(e,r))||o);return s>3&&o&&Object.defineProperty(e,r,o),o},rl=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},il=function(t,e){return function(r,i){e(r,i,t)}};class nl{constructor(){this.time=Je.beforeFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,r,i,n,s,o,a,l,h,c,u,d){var p;const{background:f,backgroundOpacity:g=(null!==(p=t.attribute.fillOpacity)&&void 0!==p?p:l.backgroundOpacity),opacity:m=l.opacity,backgroundMode:y=l.backgroundMode,backgroundFit:v=l.backgroundFit,backgroundKeepAspectRatio:b=l.backgroundKeepAspectRatio,backgroundScale:_=l.backgroundScale,backgroundOffsetX:w=l.backgroundOffsetX,backgroundOffsetY:x=l.backgroundOffsetY,backgroundClip:S=l.backgroundClip}=t.attribute;if(f)if(t.backgroundImg&&t.resources){const n=t.resources.get(f);if("success"!==n.state||!n.data)return;if(e.save(),t.parent&&!t.transMatrix.onlyTranslate()){const r=Cn(t.parent).group,{scrollX:i=r.scrollX,scrollY:n=r.scrollY}=t.parent.attribute;e.setTransformFromMatrix(t.parent.globalTransMatrix,!0),e.translate(i,n)}S&&e.clip();const s=t.AABBBounds;e.setCommonStyle(t,t.attribute,r,i,l),e.globalAlpha=g*m,this.doDrawImage(e,n.data,s,{backgroundMode:y,backgroundFit:v,backgroundKeepAspectRatio:b,backgroundScale:_,backgroundOffsetX:w,backgroundOffsetY:x}),e.restore(),t.transMatrix.onlyTranslate()||e.setTransformForCurrent()}else e.highPerformanceSave(),e.setCommonStyle(t,t.attribute,r,i,l),e.globalAlpha=g*m,e.fillStyle=f,e.fill(),e.highPerformanceRestore()}doDrawImage(t,e,r,i){const{backgroundMode:n,backgroundFit:s,backgroundKeepAspectRatio:o,backgroundScale:a=1,backgroundOffsetX:l=0,backgroundOffsetY:h=0}=i,c=r.width(),u=r.height();let d=c,p=u;if("no-repeat"===n)if(s)if(o){const i=Math.max(c/e.width,u/e.height);t.drawImage(e,r.x1+l,r.y1+h,e.width*i*a,e.height*i*a)}else t.drawImage(e,r.x1,r.y1,r.width(),r.height());else{const i=e.width*a,n=e.height*a;t.drawImage(e,r.x1+l,r.y1+h,i,n)}else{if(s&&"repeat"!==n&&(e.width||e.height)){const r=e.width,i=e.height;"repeat-x"===n?(d=r*(u/i),p=u):"repeat-y"===n&&(p=i*(c/r),d=c);const s=t.dpr,o=an.allocate({width:d,height:p,dpr:s}),a=o.getContext("2d");a&&(a.inuse=!0,a.clearMatrix(),a.setTransformForCurrent(!0),a.clearRect(0,0,d,p),a.drawImage(e,0,0,d,p),e=o.nativeCanvas),an.free(o)}const i=t.dpr,o=t.createPattern(e,n);o.setTransform&&o.setTransform(new DOMMatrix([1/i,0,0,1/i,0,0])),t.fillStyle=o,t.translate(r.x1,r.y1),t.fillRect(0,0,c,u),t.translate(-r.x1,-r.y1)}}}const sl=new nl;let ol=class{constructor(t){this.subRenderContribitions=t,this.time=Je.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,r,i,n,s,o,a,l,h,c,u,d){this._subRenderContribitions||(this._subRenderContribitions=this.subRenderContribitions.getContributions()),this._subRenderContribitions.forEach((p=>{p.render(t,e,r,i,n,s,o,a,l,h,c,u,d)}))}};ol=el([L(),il(0,B(Y)),il(0,P(ka)),rl("design:paramtypes",[Object])],ol);const al=new class{constructor(){this.time=Je.beforeFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,r,i,n,s,o,a,l,h,c,u,d){var p,f;const{clipConfig:g}=t.attribute;if(!g)return;const m=t.getClipPath();if(!m)return;const y=!(c||u),v=t.AABBBounds,b=null!==(p=t.attribute.width)&&void 0!==p?p:v.width(),_=null!==(f=t.attribute.height)&&void 0!==f?f:v.height();y&&e.save(),e.beginPath(),!1===m.draw(e,[b,_],r+b/2,i+_/2,0)&&e.closePath(),c&&c(e,t.attribute,l,!0),y&&e.clip()}};const ll=new class{constructor(){this.time=Je.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,r,i,n,s,o,a,l,h,c,u,d){const{clipConfig:p}=t.attribute;p&&t.getClipPath()&&(c||u||e.restore())}};class hl{constructor(){this.time=Je.afterFillStroke,this.useStyle=!0,this.order=10,this._tempSymbolGraphic=null}createCommonPattern(t,e,r,i,n){const s=(t-2*e)/2,o=i.dpr,a=an.allocate({width:t,height:t,dpr:o}),l=a.getContext("2d");if(!l)return null;l.inuse=!0,l.clearMatrix(),l.setTransformForCurrent(!0),l.clearRect(0,0,t,t),n(s,l);const h=i.createPattern(a.nativeCanvas,"repeat");return h.setTransform&&h.setTransform(new DOMMatrix([1/o,0,0,1/o,0,0])),an.free(a),h}createCirclePattern(t,e,r,i){return this.createCommonPattern(t,e,r,i,((t,e)=>{e.fillStyle=r,e.arc(t,t,t,0,ne),e.fill()}))}createDiamondPattern(t,e,r,i){return this.createCommonPattern(t,e,r,i,((e,i)=>{const n=t/2,s=n;i.fillStyle=r,i.moveTo(n,s-e),i.lineTo(e+n,s),i.lineTo(n,s+e),i.lineTo(n-e,s),i.closePath(),i.fill()}))}createRectPattern(t,e,r,i){return this.createCommonPattern(t,e,r,i,((t,i)=>{const n=e,s=n;i.fillStyle=r,i.fillRect(n,s,2*t,2*t)}))}createVerticalLinePattern(t,e,r,i){return this.createCommonPattern(t,e,r,i,((i,n)=>{const s=e;n.fillStyle=r,n.fillRect(s,0,2*i,t)}))}createHorizontalLinePattern(t,e,r,i){return this.createCommonPattern(t,e,r,i,((i,n)=>{const s=e;n.fillStyle=r,n.fillRect(0,s,t,2*i)}))}createBiasLRLinePattern(t,e,r,i){return this.createCommonPattern(t,e,r,i,((e,i)=>{i.strokeStyle=r,i.lineWidth=e,i.moveTo(0,0),i.lineTo(t,t);const n=t/2,s=-n;i.moveTo(n,s),i.lineTo(n+t,s+t),i.moveTo(-n,-s),i.lineTo(-n+t,-s+t),i.stroke()}))}createBiasRLLinePattern(t,e,r,i){return this.createCommonPattern(t,e,r,i,((e,i)=>{i.strokeStyle=r,i.lineWidth=e,i.moveTo(t,0),i.lineTo(0,t);const n=t/2,s=n;i.moveTo(t+n,s),i.lineTo(n,s+t),i.moveTo(t-n,-s),i.lineTo(-n,-s+t),i.stroke()}))}createGridPattern(t,e,r,i){return this.createCommonPattern(t,e,r,i,((t,i)=>{const n=e,s=n;i.fillStyle=r,i.fillRect(n,s,t,t),i.fillRect(n+t,s+t,t,t)}))}initTextureMap(t,e){this.textureMap=new Map}drawShape(t,e,r,i,n,s,o,a,l,h,c,u,d){this.textureMap||this.initTextureMap(e,t.stage);const{texture:p=l.texture,textureColor:f=l.textureColor,textureSize:g=l.textureSize,texturePadding:m=l.texturePadding}=t.attribute;p&&this.drawTexture(p,t,e,r,i,l,f,g,m)}drawTexture(t,e,r,i,n,s,o,a,l){var h;const{textureRatio:c=s.textureRatio,textureOptions:u=null}=e.attribute;let d=this.textureMap.get(t);if(!d)switch(t){case"circle":d=this.createCirclePattern(a,l,o,r);break;case"diamond":d=this.createDiamondPattern(a,l,o,r);break;case"rect":d=this.createRectPattern(a,l,o,r);break;case"vertical-line":d=this.createVerticalLinePattern(a,l,o,r);break;case"horizontal-line":d=this.createHorizontalLinePattern(a,l,o,r);break;case"bias-lr":d=this.createBiasLRLinePattern(a,l,o,r);break;case"bias-rl":d=this.createBiasRLLinePattern(a,l,o,r);break;case"grid":d=this.createGridPattern(a,l,o,r)}if(u&&u.dynamicTexture){const{gridConfig:d={},useNewCanvas:p}=u,f=e.AABBBounds;i=f.x1,n=f.y1;const g=r;let m;if(p){m=an.allocate({width:f.width(),height:f.height(),dpr:r.dpr});const t=m.getContext("2d");t.clearRect(0,0,f.width(),f.height()),i=0,n=0,r=t}if(g.save(),e.parent&&!e.transMatrix.onlyTranslate()){const{scrollX:t=0,scrollY:r=0}=e.parent.attribute;g.setTransformFromMatrix(e.parent.globalTransMatrix),g.translate(t,r,!0)}g.setCommonStyle(e,e.attribute,i,n,s),g.clip();const y=f.width(),v=f.height(),b=l,_=a,w=d.columns?d.columns:Math.ceil(y/_),x=d.rows?d.rows:Math.ceil(v/_),S=d.gutterColumn?d.gutterColumn:2*b,T=d.gutterRow?d.gutterRow:2*b;this._tempSymbolGraphic||(this._tempSymbolGraphic=Wa({}));const k=d.columns?y/d.columns:_,C=d.rows?v/d.rows:_;this._tempSymbolGraphic.setAttributes({size:[k-S,C-T],symbolType:t});const E=this._tempSymbolGraphic.getParsedPath();for(let t=0;t<x;t++)for(let s=0;s<w;s++){const a=i+_/2+s*_,l=n+_/2+t*_;null===(h=u.beforeDynamicTexture)||void 0===h||h.call(u,r,t,s,x,w,c,e,f.width(),f.height()),r.beginPath(),!1===E.draw(r,Math.min(k-S,C-T),a,l,0)&&r.closePath(),r.fillStyle=o,u.dynamicTexture(r,t,s,x,w,c,e,f.width(),f.height())}p&&(g.globalAlpha=1,g.drawImage(m.nativeCanvas,0,0,m.nativeCanvas.width,m.nativeCanvas.height,f.x1,f.y1,f.width()*g.dpr,f.height()*g.dpr)),g.restore()}else if(d)r.highPerformanceSave(),r.setCommonStyle(e,e.attribute,i,n,s),r.fillStyle=d,r.fill(),r.highPerformanceRestore();else if("wave"===t){r.save(),r.setCommonStyle(e,e.attribute,i,n,s),r.clip();const t=e.AABBBounds;(function(t,e,r,i,n,s,o){const{fill:a="orange",percent:l=.6,frequency:h=4,opacity:c,phi:u=0}=n;let{amplitude:d=10}=n;d*=function(t){return t<=.5?4*t-1:-4*t+3}(e);const p=i*(1-l),f=r,g=Math.max(Math.round(f/70),2);t.beginPath(),t.moveTo(0+s,i+o),t.lineTo(0+s,p+o);const m=f/h*e,y=f/Math.PI/(2*h);for(let e=0;e<f;e+=g){const r=d*Math.sin((e+m+u)/y+u);t.lineTo(e+s,p+r+o)}t.lineTo(f+s,i+o),t.closePath(),t.fillStyle=a,isFinite(c)&&(t.globalAlpha=c),t.fill()})(r,c,t.width(),t.height(),Object.assign(Object.assign({},u||{}),{fill:o}),i+t.x1-i,n+t.y1-n),r.restore()}}}const cl=new hl;const ul=new class extends nl{constructor(){super(...arguments),this.time=Je.beforeFillStroke}drawShape(t,e,r,i,n,s,o,a,l,h,c,u){const{background:d,backgroundMode:p=l.backgroundMode,backgroundFit:f=l.backgroundFit,backgroundKeepAspectRatio:g=l.backgroundKeepAspectRatio,backgroundScale:m=l.backgroundScale,backgroundOffsetX:y=l.backgroundOffsetX,backgroundOffsetY:v=l.backgroundOffsetY}=t.attribute;if(d)if(t.backgroundImg&&t.resources){const r=t.resources.get(d);if("success"!==r.state||!r.data)return;e.highPerformanceSave(),e.setTransformFromMatrix(t.parent.globalTransMatrix,!0);const i=t.AABBBounds;this.doDrawImage(e,r.data,i,{backgroundMode:p,backgroundFit:f,backgroundKeepAspectRatio:g,backgroundScale:m,backgroundOffsetX:y,backgroundOffsetY:v}),e.highPerformanceRestore(),e.setTransformForCurrent()}else e.highPerformanceSave(),e.fillStyle=d,e.fill(),e.highPerformanceRestore()}},dl=ee/2;function pl(t,e,r,i,n,s,o=!0,a){let l;if(Array.isArray(o)&&(a=o,o=!0),i<0&&(e+=i,i=-i),n<0&&(r+=n,n=-n),Ot(s,!0))l=[s=se(s),s,s,s];else if(Array.isArray(s)){const t=s;let e,r;switch(t.length){case 0:l=[0,0,0,0];break;case 1:e=se(t[0]),l=[e,e,e,e];break;case 2:case 3:e=se(t[0]),r=se(t[1]),l=[e,r,e,r];break;default:l=t,l[0]=se(l[0]),l[1]=se(l[1]),l[2]=se(l[2]),l[3]=se(l[3])}}else l=[0,0,0,0];if(i<0||l[0]+l[1]+l[2]+l[3]<1e-12)return t.rect(e,r,i,n);const[h,c,u,d]=[[e,r],[e+i,r],[e+i,r+n],[e,r+n]],p=Math.min(i/2,n/2),f=[Math.min(p,l[0]),Math.min(p,l[1]),Math.min(p,l[2]),Math.min(p,l[3])],g=[h[0]+f[0],h[1]],m=[h[0],h[1]+f[0]],y=[c[0]-f[1],c[1]],v=[c[0],c[1]+f[1]],b=[u[0]-f[2],u[1]],_=[u[0],u[1]-f[2]],w=[d[0]+f[3],d[1]],x=[d[0],d[1]-f[3]];if(t.moveTo(g[0],g[1]),o){if(a&&a[0]?a[0](g[0],g[1],y[0],y[1]):t.lineTo(y[0],y[1]),!$t(y,v)){a&&a[0]&&t.moveTo(y[0],y[1]);const e=y[0],r=y[1]+f[1];t.arc(e,r,f[1],-dl,0,!1)}if(a&&a[1]?a[1](v[0],v[1],_[0],_[1]):t.lineTo(_[0],_[1]),!$t(b,_)){const e=_[0]-f[2],r=_[1];a&&a[1]&&t.moveTo(_[0],_[1]),t.arc(e,r,f[2],0,dl,!1)}if(a&&a[2]?a[2](b[0],b[1],w[0],w[1]):t.lineTo(w[0],w[1]),!$t(w,x)){const e=w[0],r=w[1]-f[3];a&&a[2]&&t.moveTo(w[0],w[1]),t.arc(e,r,f[3],dl,ee,!1)}if(a&&a[3]?a[3](x[0],x[1],m[0],m[1]):t.lineTo(m[0],m[1]),!$t(g,m)){const e=g[0],r=g[1]+f[0];a&&a[3]&&t.moveTo(m[0],m[1]),t.arc(e,r,f[0],ee,ee+dl,!1)}}else a&&a[0]?a[0](g[0],g[1],y[0],y[1]):t.lineTo(y[0],y[1]),a&&a[1]?a[1](y[0],y[1],b[0],b[1]):t.lineTo(b[0],b[1]),a&&a[2]?a[2](b[0],b[1],w[0],w[1]):t.lineTo(w[0],w[1]),a&&a[2]?a[2](w[0],w[1],g[0],g[1]):t.lineTo(g[0],g[1]);return!a&&t.closePath(),t}var fl=function(t,e,r,i){var n,s=arguments.length,o=s<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,e,r,i);else for(var a=t.length-1;a>=0;a--)(n=t[a])&&(o=(s<3?n(o):s>3?n(e,r,o):n(e,r))||o);return s>3&&o&&Object.defineProperty(e,r,o),o};let gl=class{constructor(){this.time=Je.beforeFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,r,i,n,s,o,a,l,h,c,u,d){const{stroke:p=l.stroke}=t.attribute;Array.isArray(p)&&p.some((t=>!1===t))&&(d.doStroke=!1)}};gl=fl([L()],gl);let ml=class{constructor(){this.time=Je.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,r,i,n,s,o,a,l,h,c,u){const{x1:d,y1:p,x:f=l.x,y:g=l.y,stroke:m=l.stroke,cornerRadius:y=l.cornerRadius,cornerType:v=l.cornerType}=t.attribute;let{width:b,height:_}=t.attribute;if(b=(null!=b?b:d-f)||0,_=(null!=_?_:p-g)||0,Array.isArray(m)&&m.some((t=>!1===t))){if(e.setStrokeStyle(t,t.attribute,r,i,l),!(0===y||Et(y)&&y.every((t=>0===t)))){let n,s=0;return pl(e,r,i,b,_,y,"bevel"!==v,new Array(4).fill(0).map(((o,a)=>(o,h,c,u)=>{m[a]&&(s===a-1&&m[a]===n||(e.setStrokeStyle(t,Object.assign(Object.assign({},t.attribute),{stroke:m[a]}),r,i,l),e.beginPath(),e.moveTo(o,h),n=m[a]),s=a,e.lineTo(c,u),e.stroke(),3===a&&e.beginPath())}))),void e.stroke()}if(e.beginPath(),e.moveTo(r,i),m[0]?e.lineTo(r+b,i):e.moveTo(r+b,i),m[1]?e.lineTo(r+b,i+_):e.moveTo(r+b,i+_),m[2]?e.lineTo(r,i+_):e.moveTo(r,i+_),m[3]){const t=m[0]?i-e.lineWidth/2:i;e.lineTo(r,t)}else e.moveTo(r,i);e.stroke()}}};ml=fl([L()],ml);const yl=new class{constructor(){this.time=Je.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,r,i,n,s,o,a,l,h,c,u){const{outerBorder:d,innerBorder:p}=t.attribute,f=d&&!1!==d.visible,g=p&&!1!==p.visible;if(!f&&!g)return;const{cornerRadius:m=l.cornerRadius,cornerType:y=l.cornerType,opacity:v=l.opacity,x:b=l.x,y:_=l.y,scaleX:w=l.scaleX,scaleY:x=l.scaleY,x1:S,y1:T,keepStrokeScale:k=l.keepStrokeScale}=t.attribute;let{width:C,height:E}=t.attribute;C=(null!=C?C:S-r)||0,E=(null!=E?E:T-i)||0;const A=(n,s)=>{const o=!(!n||!n.stroke),a="outerBorder"===s?-1:1,{distance:h=l[s].distance}=n,c=k?h:yi(e,h,e.dpr),d=r+a*c,p=i+a*c,f=2*c;if(0===m||Et(m)&&m.every((t=>0===t))?(e.beginPath(),e.rect(d,p,C-a*f,E-a*f)):(e.beginPath(),pl(e,d,p,C-a*f,E-a*f,m,"bevel"!==y)),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),u)u(e,n,l[s]);else if(o){const o=l[s].opacity;l[s].opacity=v,e.setStrokeStyle(t,n,(b-r)/w,(_-i)/x,l[s]),l[s].opacity=o,e.stroke()}};f&&A(d,"outerBorder"),g&&A(p,"innerBorder")}},vl=cl,bl=sl;const _l=new class{constructor(){this.time=Je.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,r,i,n,s,o,a,l,h,c,u){const d=t.getParsedPath();if(!d)return;const{outerBorder:p,innerBorder:f}=t.attribute,g=p&&!1!==p.visible,m=f&&!1!==f.visible;if(!g&&!m)return;const{size:y=l.size,opacity:v=l.opacity,x:b=l.x,y:_=l.y,scaleX:w=l.scaleX,scaleY:x=l.scaleY,keepStrokeScale:S=l.keepStrokeScale}=t.attribute,T=(n,s)=>{const o=!(!n||!n.stroke),{distance:a=l[s].distance}=n,h=S?a:yi(e,a,e.dpr),c="outerBorder"===s?1:-1;if(e.beginPath(),!1===d.drawOffset(e,y,r,i,c*h)&&e.closePath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),u)u(e,n,l[s]);else if(o){const o=l[s].opacity;l[s].opacity=v,e.setStrokeStyle(t,n,(b-r)/w,(_-i)/x,l[s]),l[s].opacity=o,e.stroke()}};g&&T(p,"outerBorder"),m&&T(f,"innerBorder")}},wl=new class{constructor(){this.time=Je.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,r,i,n,s,o,a,l,h,c,u,d){const{clipRange:p=l.clipRange,x:f=l.x,y:g=l.y,z:m=l.z,size:y=l.size,scaleX:v=l.scaleX,scaleY:b=l.scaleY}=t.attribute,_=t.getParsedPath();_&&p<1&&p>0&&(e.beginPath(),_.drawWithClipRange&&_.drawWithClipRange(e,y,r,i,p,m,((n,s)=>{var o,h,c,d;if(t._parsedPath.svgCache){const e=Object.assign({},s);e.fill=null!==(o=s.fill)&&void 0!==o?o:t.attribute.fill,e.opacity=null!==(h=s.opacity)&&void 0!==h?h:t.attribute.opacity,e.fillOpacity=t.attribute.fillOpacity,e.stroke=null!==(c=s.stroke)&&void 0!==c?c:t.attribute.stroke,e.lineWidth=null!==(d=s.lineWidth)&&void 0!==d?d:t.attribute.lineWidth,s=e}s.stroke&&(u?u(e,t.attribute,l):a&&(e.setStrokeStyle(t,s,(f-r)/v,(g-i)/b,l),e.stroke()))})),s&&!_.isSvg&&(u?u(e,t.attribute,l):a&&(e.setStrokeStyle(t,t.attribute,(f-r)/v,(g-i)/b,l),e.stroke())))}},xl=cl,Sl=sl;const Tl={x:0,y:0,z:0,lastModelMatrix:null};class kl{init(t){t&&(this._renderContribitions=t.getContributions()),this._renderContribitions||(this._renderContribitions=[]),this.builtinContributions||(this.builtinContributions=[]),this.builtinContributions.push(al),this.builtinContributions.push(ll),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===Je.beforeFillStroke)),this._afterRenderContribitions=this._renderContribitions.filter((t=>t.time===Je.afterFillStroke)))}reInit(){this.init(this.graphicRenderContributions)}beforeRenderStep(t,e,r,i,n,s,o,a,l,h,c,u,d){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,r,i,n,s,o,a,l,h,c,u,d)}))}afterRenderStep(t,e,r,i,n,s,o,a,l,h,c,u,d){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,r,i,n,s,o,a,l,h,c,u,d)}))}drawPathProxy(t,e,r,i,n,s,o,a){if(!t.pathProxy)return!1;const l=Cn(t,null==s?void 0:s.theme)[t.type.replace("3d","")],{fill:h=l.fill,stroke:c=l.stroke,opacity:u=l.opacity,fillOpacity:d=l.fillOpacity,lineWidth:p=l.lineWidth,strokeOpacity:f=l.strokeOpacity,visible:g=l.visible,x:m=l.x,y:y=l.y}=t.attribute,v=ma(u,d,h),b=va(u,f),_=fa(h),w=ga(c,p);if(!g)return!0;if(!_&&!w)return!0;if(!(v||b||o||a))return!0;e.beginPath();return ir(("function"==typeof t.pathProxy?t.pathProxy(t.attribute):t.pathProxy).commandList,e,r,i),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,r,i,_,w,v,b,l,n,o,a),w&&(a?a(e,t.attribute,l):b&&(e.setStrokeStyle(t,t.attribute,r-m,i-y,l),e.stroke())),_&&(o?o(e,t.attribute,l):v&&(e.setCommonStyle(t,t.attribute,r-m,i-y,l),e.fill())),this.afterRenderStep(t,e,r,i,_,w,v,b,l,n,o,a),!0}valid(t,e,r,i){const{fill:n=e.fill,background:s,stroke:o=e.stroke,opacity:a=e.opacity,fillOpacity:l=e.fillOpacity,lineWidth:h=e.lineWidth,strokeOpacity:c=e.strokeOpacity,visible:u=e.visible}=t.attribute,d=ma(a,l,n),p=va(a,c),f=fa(n,s),g=ga(o,h);return!(!t.valid||!u)&&!(!f&&!g)&&!!(d||p||r||i||s)&&{fVisible:d,sVisible:p,doFill:f,doStroke:g}}transform(t,e,r,i=!1){const{x:n=e.x,y:s=e.y,z:o=e.z,scaleX:a=e.scaleX,scaleY:l=e.scaleY,angle:h=e.angle,postMatrix:c}=t.attribute,u=r.modelMatrix,d=r.camera;Tl.x=n,Tl.y=s,Tl.z=o,Tl.lastModelMatrix=u;const p=d&&(i||function(t){const{alpha:e,beta:r}=t.attribute;return e||r}(t)),f=p?t.transMatrix.onlyTranslate()&&!c:1===a&&1===l&&0===h&&!c;if(p){const i=Fo.allocate(),n=Fo.allocate();Ra(n,t,e),Mo(i,u||i,n),Tl.x=0,Tl.y=0,Tl.z=0,r.modelMatrix=i,r.setTransform(1,0,0,1,0,0,!0),Fo.free(n)}if(f&&!u){const i=t.getOffsetXY(e);Tl.x+=i.x,Tl.y+=i.y,Tl.z=o,r.setTransformForCurrent()}else if(p)Tl.x=0,Tl.y=0,Tl.z=0,r.setTransform(1,0,0,1,0,0,!0);else if(d&&r.project){const i=t.getOffsetXY(e);Tl.x+=i.x,Tl.y+=i.y,this.transformWithoutTranslate(r,Tl.x,Tl.y,Tl.z,a,l,h)}else r.transformFromMatrix(t.transMatrix,!0),Tl.x=0,Tl.y=0,Tl.z=0;return Tl}transformUseContext2d(t,e,r,i){const n=i.camera;if(this.camera=n,n){const e=t.AABBBounds,n=e.x2-e.x1,s=e.y2-e.y1,o=i.project(0,0,r),a=i.project(n,0,r),l=i.project(n,s,r),h={x:0,y:0},c={x:n,y:0},u={x:n,y:s};i.camera=null;const d=1/(h.x*(u.y-c.y)-c.x*u.y+u.x*c.y+(c.x-u.x)*h.y),p=-(h.y*(l.x-a.x)-c.y*l.x+u.y*a.x+(c.y-u.y)*o.x)*d,f=(c.y*l.y+h.y*(a.y-l.y)-u.y*a.y+(u.y-c.y)*o.y)*d,g=(h.x*(l.x-a.x)-c.x*l.x+u.x*a.x+(c.x-u.x)*o.x)*d,m=-(c.x*l.y+h.x*(a.y-l.y)-u.x*a.y+(u.x-c.x)*o.y)*d,y=(h.x*(u.y*a.x-c.y*l.x)+h.y*(c.x*l.x-u.x*a.x)+(u.x*c.y-c.x*u.y)*o.x)*d,v=(h.x*(u.y*a.y-c.y*l.y)+h.y*(c.x*l.y-u.x*a.y)+(u.x*c.y-c.x*u.y)*o.y)*d;i.setTransform(p,f,g,m,y,v,!0)}}restoreTransformUseContext2d(t,e,r,i){this.camera&&(i.camera=this.camera)}transformWithoutTranslate(t,e,r,i,n,s,o){const a=t.project(e,r,i);t.translate(a.x,a.y,!1),t.scale(n,s,!1),t.rotate(o,!1),t.translate(-a.x,-a.y,!1),t.setTransformForCurrent()}_draw(t,e,r,i,n,s){const{context:o}=i;if(!o)return;const{renderable:a}=t.attribute;if(!1===a)return;o.highPerformanceSave();const l=this.transform(t,e,o,r),{x:h,y:c,z:u,lastModelMatrix:d}=l;this.z=u,this.drawPathProxy(t,o,h,c,i,n)||(this.drawShape(t,o,h,c,i,n,null,null,s),this.z=0,o.modelMatrix!==d&&Fo.free(o.modelMatrix),o.modelMatrix=d),o.highPerformanceRestore()}}function Cl(t,e,r,i){if(!e.p1)return;const{offsetX:n=0,offsetY:s=0,offsetZ:o=0}=i||{};if(1===r)e.p2&&e.p3?t.bezierCurveTo(n+e.p1.x,s+e.p1.y,n+e.p2.x,s+e.p2.y,n+e.p3.x,s+e.p3.y,o):t.lineTo(n+e.p1.x,s+e.p1.y,o);else if(e.p2&&e.p3){const[i]=cr(e,r);t.bezierCurveTo(n+i.p1.x,s+i.p1.y,n+i.p2.x,s+i.p2.y,n+i.p3.x,s+i.p3.y,o)}else{const i=e.getPointAt(r);t.lineTo(n+i.x,s+i.y,o)}}function El(t,e,r,i,n,s,o){var a;let l=e.p0,h=i;if(r&&r.originP1===r.originP2&&(l=r.p0),e.defined)i||(t.lineTo(l.x+n,l.y+s,o),h=!i);else{const{originP1:c,originP2:u}=e;let d;if(c&&!1!==c.defined&&!r?d=l:c&&!1!==u.defined&&(d=null!==(a=e.p3)&&void 0!==a?a:e.p1),i){h=!i;const r=d?d.x:e.p0.x,a=d?d.y:e.p0.y;t.moveTo(r+n,a+s,o)}else d&&(h=!i,t.lineTo(d.x+n,d.y+s,o))}return h}function Al(t,e,r,i,n){const{offsetX:s=0,offsetY:o=0,offsetZ:a=0,mode:l="none",drawConnect:h=!1}=n||{};if(h&&"none"===l)return;if(!e)return;let c=!0;const{curves:u}=e;if(r>=1){if(h){let e,r=!0;u.forEach(((i,n)=>{i.originP1!==i.originP2?(r=El(t,i,e,r,s,o,a),e=i):e=i}))}else u.forEach((e=>{e.defined?(c&&t.moveTo(e.p0.x+s,e.p0.y+o,a),Cl(t,e,1,n),c=!1):c=!0}));return}if(r<=0)return;let d;"x"===i?d=Ke.ROW:"y"===i?d=Ke.COLUMN:"auto"===i&&(d=e.direction);const p=r*e.tryUpdateLength(d);let f=0,g=!0,m=null;for(let e=0,r=u.length;e<r;e++){const r=u[e],i=r.getLength(d),l=(p-f)/i;if(f+=i,l<0)break;if(h){if(r.originP1===r.originP2){m=r;continue}g=El(t,r,m,g,s,o,a),m=r}else{if(!r.defined){c=!0;continue}c&&t.moveTo(r.p0.x+s,r.p0.y+o,a),Cl(t,r,he(l,1),n),c=!1}}}var Ol=function(t,e,r,i){var n,s=arguments.length,o=s<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,e,r,i);else for(var a=t.length-1;a>=0;a--)(n=t[a])&&(o=(s<3?n(o):s>3?n(e,r,o):n(e,r))||o);return s>3&&o&&Object.defineProperty(e,r,o),o};let Bl=class extends kl{constructor(){super(...arguments),this.numberType=So}draw(t,e,r,i){const n=Cn(t,null==i?void 0:i.theme).line;this._draw(t,n,!1,r,i)}drawSegmentItem(t,e,r,i,n,s,o,a,l,h,c,u,d,p,f){var g;if(!e)return;t.beginPath();Al(t,e,l,h,{offsetX:c,offsetY:u,offsetZ:null!==(g=this.z)&&void 0!==g?g:0}),d.cache&&!Et(d.cache)&&d.cache.curves.every((t=>t.defined))&&d.attribute.curveType&&d.attribute.curveType.includes("Closed")&&t.closePath(),t.setShadowBlendStyle&&t.setShadowBlendStyle(d,o,a);const{x:m=0,x:y=0}=o;return!1!==r&&(p?p(t,o,a):n&&(t.setCommonStyle(d,o,m-c,y-u,a),t.fill())),!1!==i&&(f?f(t,o,a):s&&(t.setStrokeStyle(d,o,m-c,y-u,a),t.stroke())),!1}drawLinearLineHighPerformance(t,e,r,i,n,s,o,a,l,h,c,u,d){var p;e.beginPath();const f=null!==(p=this.z)&&void 0!==p?p:0,{points:g}=t.attribute,m=g[0];e.moveTo(m.x+o,m.y+a,f);for(let t=1;t<g.length;t++){const r=g[t];e.lineTo(r.x+o,r.y+a,f)}e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l);const{x:y=0,x:v=0}=t.attribute;!1!==r&&(u?u(e,t.attribute,l):n&&(e.setCommonStyle(t,t.attribute,y-o,v-a,l),e.fill())),!1!==i&&(d?d(e,t.attribute,l):s&&(e.setStrokeStyle(t,t.attribute,y-o,v-a,l),e.stroke()))}drawShape(t,e,r,i,n,s,o,a){const l=Cn(t,null==s?void 0:s.theme).line,{fill:h=l.fill,stroke:c=l.stroke,fillOpacity:u=l.fillOpacity,strokeOpacity:d=l.strokeOpacity,segments:p,points:f,closePath:g,curveTension:m=l.curveTension,connectedType:y=l.connectedType}=t.attribute;if(!this.valid(t,l,o,a))return;let{curveType:v=l.curveType}=t.attribute;g&&"linear"===v&&(v="linearClosed");const{clipRange:b=l.clipRange,clipRangeByDimension:_=l.clipRangeByDimension}=t.attribute;if(1===b&&!p&&!f.some((t=>!1===t.defined))&&"linear"===v)return this.drawLinearLineHighPerformance(t,e,!!h,!!c,u,d,r,i,l,n,s,o,a);function w(t,e){return"none"===e?t:t.filter((t=>!1!==t.defined))}if(t.shouldUpdateShape()){const{points:e,segments:r}=t.attribute,i=e;if(r&&r.length){let e,i;if(t.cache=r.map(((t,r)=>{if(t.points.length<=1&&0===r)return t.points[0]&&(i={endX:t.points[0].x,endY:t.points[0].y,curves:[{defined:!1!==t.points[0].defined}]}),null;1===r?e={x:i.endX,y:i.endY,defined:i.curves[i.curves.length-1].defined}:r>1&&(e.x=i.endX,e.y=i.endY,e.defined=i.curves[i.curves.length-1].defined);const n=Ur(w(t.points,y),v,{startPoint:e,curveTension:m});return i=n,n})).filter((t=>!!t)),"linearClosed"===v){let e;for(let r=0;r<t.cache.length;r++){const i=t.cache[r];for(let t=0;t<i.curves.length;t++)if(i.curves[t].defined){e=i.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=Ur(w(i,y),v,{curveTension:m})}t.clearUpdateShapeTag()}if(Array.isArray(t.cache)){const n=t.attribute.segments.filter((t=>t.points.length));if(1===n[0].points.length&&n.shift(),1===b){let s=!1;t.cache.forEach(((p,f)=>{s||(s=this.drawSegmentItem(e,p,!!h,!!c,u,d,n[f],[l,t.attribute],b,_,r,i,t,o,a))}))}else{const s=t.cache.reduce(((t,e)=>t+e.getLength()),0),p=b*s;let f=0,g=!1;t.cache.forEach(((s,m)=>{if(g)return;const y=s.getLength(),v=(p-f)/y;f+=y,v>0&&(g=this.drawSegmentItem(e,s,!!h,!!c,u,d,n[m],[l,t.attribute],he(v,1),_,r,i,t,o,a))}))}}else this.drawSegmentItem(e,t.cache,!!h,!!c,u,d,t.attribute,l,b,_,r,i,t,o,a)}};function Rl(t,e,r,i){const{offsetX:n=0,offsetY:s=0,offsetZ:o=0}=i||{};let a=!0;e.forEach((e=>{e.defined?(a&&t.moveTo(e.p0.x+n,e.p0.y+s,o),Cl(t,e,1,i),a=!1):a=!0})),a=!0;for(let e=r.length-1;e>=0;e--){const l=r[e];l.defined?(a&&t.lineTo(l.p0.x+n,l.p0.y+s,o),Cl(t,l,1,i),a=!1):a=!0}t.closePath()}Bl=Ol([L()],Bl);const Ll=new class extends hl{constructor(){super(...arguments),this.time=Je.afterFillStroke}drawShape(t,e,r,i,n,s,o,a,l,h,c,u,d){var p,f,g,m;this.textureMap||this.initTextureMap(e,t.stage);const{attribute:y=t.attribute}=d||{},{texture:v=(null!==(p=t.attribute.texture)&&void 0!==p?p:Xn(l,"texture")),textureColor:b=(null!==(f=t.attribute.textureColor)&&void 0!==f?f:Xn(l,"textureColor")),textureSize:_=(null!==(g=t.attribute.textureSize)&&void 0!==g?g:Xn(l,"textureSize")),texturePadding:w=(null!==(m=t.attribute.texturePadding)&&void 0!==m?m:Xn(l,"texturePadding"))}=y;v&&this.drawTexture(v,t,e,r,i,l,b,_,w)}},Pl=sl;var Dl=function(t,e,r,i){var n,s=arguments.length,o=s<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,e,r,i);else for(var a=t.length-1;a>=0;a--)(n=t[a])&&(o=(s<3?n(o):s>3?n(e,r,o):n(e,r))||o);return s>3&&o&&Object.defineProperty(e,r,o),o},Ml=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Il=function(t,e){return function(r,i){e(r,i,t)}};let Nl=class extends kl{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=bo,this.builtinContributions=[Ll,Pl],this.init(t)}drawLinearAreaHighPerformance(t,e,r,i,n,s,o,a,l,h,c,u,d){var p,f,g;const{points:m}=t.attribute;if(m.length<2)return;e.beginPath();const y=null!==(p=this.z)&&void 0!==p?p:0,v=m[0];e.moveTo(v.x+o,v.y+a,y);for(let t=1;t<m.length;t++){const r=m[t];e.lineTo(r.x+o,r.y+a,y)}for(let t=m.length-1;t>=0;t--){const r=m[t];e.lineTo((null!==(f=r.x1)&&void 0!==f?f:r.x)+o,(null!==(g=r.y1)&&void 0!==g?g:r.y)+a,y)}e.closePath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,o,a,!!n,!1,r,!1,l,h,u,null,{attribute:t.attribute});const{x:b=0,x:_=0}=t.attribute;!1!==r&&(u?u(e,t.attribute,l):n&&(e.setCommonStyle(t,t.attribute,b-o,_-a,l),e.fill())),this.afterRenderStep(t,e,o,a,!!n,!1,r,!1,l,h,u,null,{attribute:t.attribute}),(()=>{var r,n;if(i){const{stroke:i=l&&l.stroke}=t.attribute;if(Et(i)&&(i[0]||i[2])&&!1===i[1])if(e.beginPath(),i[0]){e.moveTo(v.x+o,v.y+a,y);for(let t=1;t<m.length;t++){const r=m[t];e.lineTo(r.x+o,r.y+a,y)}}else if(i[2]){const t=m[m.length-1];e.moveTo(t.x+o,t.y+a,y);for(let t=m.length-2;t>=0;t--){const i=m[t];e.lineTo((null!==(r=i.x1)&&void 0!==r?r:i.x)+o,(null!==(n=i.y1)&&void 0!==n?n:i.y)+a,y)}}d?d(e,t.attribute,l):(e.setStrokeStyle(t,t.attribute,b-o,_-a,l),e.stroke())}})()}drawShape(t,e,r,i,n,s,o,a){var l,h,c,u,d,p;const f=Cn(t,null==s?void 0:s.theme).area,{fill:g=f.fill,stroke:m=f.stroke,fillOpacity:y=f.fillOpacity,z:v=f.z,strokeOpacity:b=f.strokeOpacity,curveTension:_=f.curveTension,connectedType:w=f.connectedType}=t.attribute,x=this.valid(t,f,o,a);if(!x)return;const{doFill:S}=x,T=x.doStroke&&x.sVisible,{clipRange:k=f.clipRange,closePath:C,points:E,segments:A}=t.attribute;let{curveType:O=f.curveType}=t.attribute;function B(t,e){return"connect"!==e?t:t.filter((t=>!1!==t.defined))}if(C&&"linear"===O&&(O="linearClosed"),1===k&&!A&&!E.some((t=>!1===t.defined))&&"linear"===O)return this.drawLinearAreaHighPerformance(t,e,!!g,T,y,b,r,i,f,n,s,o,a);if(t.shouldUpdateShape()){if(A&&A.length){let e,r;const i=A.map(((t,i)=>{if(t.points.length<=1&&0===i)return t.points[0]&&(r={endX:t.points[0].x,endY:t.points[0].y}),null;1===i?e={x:r.endX,y:r.endY}:i>1&&(e.x=r.endX,e.y=r.endY);const n=Ur(B(t.points,w),O,{startPoint:e,curveTension:_});return r=n,n})).filter((t=>!!t));let n;const s=[];for(let t=A.length-1;t>=0;t--){const e=A[t].points,r=[];for(let t=e.length-1;t>=0;t--)r.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=A[t-1].points,i=e[e.length-1];i&&r.push({x:null!==(c=i.x1)&&void 0!==c?c:i.x,y:null!==(u=i.y1)&&void 0!==u?u:i.y})}r.length>1&&(n=Ur(B(r,w),"stepBefore"===O?"stepAfter":"stepAfter"===O?"stepBefore":O,{curveTension:_}),s.unshift(n))}t.cacheArea=s.map(((t,e)=>({top:i[e],bottom:t})))}else{if(!E||!E.length)return t.cacheArea=null,void t.clearUpdateShapeTag();{const e=B(E,w),r=[];for(let t=e.length-1;t>=0;t--)r.push({x:null!==(d=e[t].x1)&&void 0!==d?d:e[t].x,y:null!==(p=e[t].y1)&&void 0!==p?p:e[t].y});const i=Ur(e,O,{curveTension:_}),n=Ur(r,"stepBefore"===O?"stepAfter":"stepAfter"===O?"stepBefore":O,{curveTension:_});t.cacheArea={top:i,bottom:n}}}t.clearUpdateShapeTag()}if(Array.isArray(t.cacheArea)){const s=t.attribute.segments.filter((t=>t.points.length));if(1===s[0].points.length&&s.shift(),1===k){let l=!1;t.cacheArea.forEach(((h,c)=>{l||(l=this.drawSegmentItem(e,h,S,y,T,b,s[c],[f,t.attribute],k,r,i,v,t,n,o,a))}))}else{const l=t.cacheArea.reduce(((t,e)=>t+e.top.getLength()),0),h=k*l;let c=0,u=!1;t.cacheArea.forEach(((l,d)=>{if(u)return;const p=l.top.getLength(),g=(h-c)/p;c+=p,g>0&&(u=this.drawSegmentItem(e,l,S,y,T,b,s[d],[f,t.attribute],he(g,1),r,i,v,t,n,o,a))}))}}else this.drawSegmentItem(e,t.cacheArea,S,y,T,b,t.attribute,f,k,r,i,v,t,n,o,a)}draw(t,e,r,i){const n=Cn(t,null==i?void 0:i.theme).area;this._draw(t,n,!1,r,i)}drawSegmentItem(t,e,r,i,n,s,o,a,l,h,c,u,d,p,f,g){return this._drawSegmentItem(t,e,r,i,n,s,o,a,l,h,c,u,d,p,f,g)}_drawSegmentItem(t,e,r,i,n,s,o,a,l,h,c,u,d,p,f,g){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:m,segments:y}=d.attribute;let v,b,_=Ke.ROW;if(y){const t=y[y.length-1];b=y[0].points[0],v=t.points[t.points.length-1]}else b=m[0],v=m[m.length-1];const w=se(v.x-b.x),x=se(v.y-b.y);_=null==v.x1?Ke.ROW:null==v.y1?Ke.COLUMN:Number.isFinite(w+x)?w>x?Ke.ROW:Ke.COLUMN:Ke.ROW,function(t,e,r,i){var n;const{top:s,bottom:o}=e;if(s.curves.length!==o.curves.length)return;if(r>=1){const e=[],r=[];let n=!0;for(let a=0,l=s.curves.length;a<l;a++){const h=s.curves[a];n!==h.defined?(n?(Rl(t,e,r,i),e.length=0,r.length=0):(e.push(h),r.push(o.curves[l-a-1])),n=!n):n&&(e.push(h),r.push(o.curves[l-a-1]))}return void Rl(t,e,r,i)}if(r<=0)return;let{direction:a}=i||{};const{curves:l}=s,h=null!==(n=l[l.length-1].p3)&&void 0!==n?n:l[l.length-1].p1,c=se(h.x-l[0].p0.x),u=se(h.y-l[0].p0.y);a=null!=a?a:c>u?Ke.ROW:Ke.COLUMN,Number.isFinite(c)||(a=Ke.COLUMN),Number.isFinite(u)||(a=Ke.ROW);const d=r*(a===Ke.ROW?c:u);let p=0,f=!0;const g=[],m=[];for(let e=0,r=s.curves.length;e<r;e++){const n=s.curves[e],l=n.getLength(a),h=(d-p)/l;if(h<0)break;p+=l;let c=null,u=null;f!==n.defined?(f?(Rl(t,g,m,i),g.length=0,m.length=0):(c=n,u=o.curves[r-e-1]),f=!f):f&&(c=n,u=o.curves[r-e-1]),c&&u&&(h<1&&(c=c.p2&&c.p3?cr(c,h)[0]:dr(c,h)[0],u=u.p2&&u.p3?cr(u,1-h)[1]:dr(u,1-h)[1]),c.defined=f,u.defined=f,g.push(c),m.push(u)),c=null,u=null}Rl(t,g,m,i)}(t,e,l,{offsetX:h,offsetY:c,offsetZ:u,direction:_}),this.beforeRenderStep(d,t,h,c,!!i,!1,r,!1,a,p,f,null,{attribute:o}),t.setShadowBlendStyle&&t.setShadowBlendStyle(d,o,a);const{x:S=0,x:T=0}=o;return!1!==r&&(f?f(t,o,a):i&&(t.setCommonStyle(d,o,S-h,T-c,a),t.fill())),this.afterRenderStep(d,t,h,c,!!i,!1,r,!1,a,p,f,null,{attribute:o}),(()=>{if(!1!==n)if(g)g(t,o,a);else{const{stroke:r=a&&a[1]&&a[1].stroke}=o;Et(r)&&(r[0]||r[2])&&!1===r[1]&&(t.beginPath(),Al(t,r[0]?e.top:e.bottom,l,_===Ke.ROW?"x":"y",{offsetX:h,offsetY:c,offsetZ:u})),t.setStrokeStyle(d,o,S-h,T-c,a),t.stroke()}})(),!1}};Nl=Dl([L(),Il(0,B(Y)),Il(0,P(_a)),Ml("design:paramtypes",[Object])],Nl);var Fl=function(t,e,r,i){var n,s=arguments.length,o=s<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,e,r,i);else for(var a=t.length-1;a>=0;a--)(n=t[a])&&(o=(s<3?n(o):s>3?n(e,r,o):n(e,r))||o);return s>3&&o&&Object.defineProperty(e,r,o),o},jl=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},zl=function(t,e){return function(r,i){e(r,i,t)}};let Hl=class extends kl{constructor(t){super(),this.graphicRenderContributions=t,this.type="rect",this.numberType=ko,this.builtinContributions=[yl,bl,vl],this.init(t)}drawShape(t,e,r,i,n,s,o,a,l){l=null!=l?l:Cn(t,null==s?void 0:s.theme).rect;const{fill:h=l.fill,background:c,stroke:u=l.stroke,cornerRadius:d=l.cornerRadius,cornerType:p=l.cornerType,opacity:f=l.opacity,fillOpacity:g=l.fillOpacity,lineWidth:m=l.lineWidth,strokeOpacity:y=l.strokeOpacity,visible:v=l.visible,x1:b,y1:_,x:w=l.x,y:x=l.y,fillStrokeOrder:S=l.fillStrokeOrder}=t.attribute;let{width:T,height:k}=t.attribute;T=(null!=T?T:b-w)||0,k=(null!=k?k:_-x)||0;const C=ya(f,g,T,k,h),E=ba(f,y,T,k),A=fa(h,c),O=ga(u,m);if(!t.valid||!v)return;if(!A&&!O)return;if(!(C||E||o||a||c))return;0===d||Et(d)&&d.every((t=>0===t))?(e.beginPath(),e.rect(r,i,T,k)):(e.beginPath(),pl(e,r,i,T,k,d,"bevel"!==p));const B={doFill:A,doStroke:O};e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,r,i,A,O,C,E,l,n,o,a,B),S?(this._runStroke(t,e,r,i,l,B,E,w,x,a),this._runFill(t,e,r,i,l,B,C,w,x,o)):(this._runFill(t,e,r,i,l,B,C,w,x,o),this._runStroke(t,e,r,i,l,B,E,w,x,a)),this.afterRenderStep(t,e,r,i,A,O,C,E,l,n,o,a)}_runFill(t,e,r,i,n,s,o,a,l,h){s.doFill&&(h?h(e,t.attribute,n):o&&(e.setCommonStyle(t,t.attribute,a-r,l-i,n),e.fill()))}_runStroke(t,e,r,i,n,s,o,a,l,h){s.doStroke&&(h?h(e,t.attribute,n):o&&(e.setStrokeStyle(t,t.attribute,a-r,l-i,n),e.stroke()))}draw(t,e,r,i){const n=Cn(t,null==i?void 0:i.theme).rect;this._draw(t,n,!1,r,i,n)}};Hl=Fl([L(),zl(0,B(Y)),zl(0,P(xa)),jl("design:paramtypes",[Object])],Hl);var Wl=function(t,e,r,i){var n,s=arguments.length,o=s<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,e,r,i);else for(var a=t.length-1;a>=0;a--)(n=t[a])&&(o=(s<3?n(o):s>3?n(e,r,o):n(e,r))||o);return s>3&&o&&Object.defineProperty(e,r,o),o},Ul=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},$l=function(t,e){return function(r,i){e(r,i,t)}};let Vl=class extends kl{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=Co,this.builtinContributions=[_l,Sl,xl,wl],this.init(t)}drawShape(t,e,r,i,n,s,o,a,l){var h;l=null!=l?l:Cn(t,null==s?void 0:s.theme).symbol;const{size:c=l.size,x:u=l.x,y:d=l.y,scaleX:p=l.scaleX,scaleY:f=l.scaleY,fillStrokeOrder:g=l.fillStrokeOrder,clipRange:m=l.clipRange}=t.attribute,y=this.valid(t,l,o,a);if(!y)return;const{fVisible:v,sVisible:b,doFill:_,doStroke:w}=y,x=t.getParsedPath();if(!x)return;const{keepDirIn3d:S=l.keepDirIn3d}=t.attribute,T=null!==(h=this.z)&&void 0!==h?h:0;e.beginPath();let k=r,C=i,E=T;const A=e.camera;if(S&&A&&e.project){const t=e.project(r,i,T);e.camera=null,Et(c)&&(c[0],c[1]),k=t.x,C=t.y,E=void 0}!1===x.draw(e,c,k,C,E,((n,s)=>{var h,c,y,v;if(t._parsedPath.svgCache){const e=Object.assign({},s);e.fill=null!==(h=s.fill)&&void 0!==h?h:t.attribute.fill,e.opacity=null!==(c=s.opacity)&&void 0!==c?c:t.attribute.opacity,e.fillOpacity=t.attribute.fillOpacity,e.stroke=null!==(y=s.stroke)&&void 0!==y?y:t.attribute.stroke,e.lineWidth=null!==(v=s.lineWidth)&&void 0!==v?v:t.attribute.lineWidth,s=e}const _=()=>{s.fill&&(o?o(e,t.attribute,l):(e.setCommonStyle(t,s,u-r,d-i,l),e.fill()))},w=()=>{s.stroke&&(a?a(e,t.attribute,l):b&&m>=1&&(e.setStrokeStyle(t,s,(u-r)/p,(d-i)/f,l),e.stroke()))};g?(w(),_()):(_(),w())}))&&e.closePath(),e.camera=A,e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,r,i,_,w,v,b,l,n,o,a),g?(this._runStroke(t,e,r,i,l,w,b,u,d,x,m,p,f,a),this._runFill(t,e,r,i,l,_,v,u,d,x,o)):(this._runFill(t,e,r,i,l,_,v,u,d,x,o),this._runStroke(t,e,r,i,l,w,b,u,d,x,m,p,f,a)),this.afterRenderStep(t,e,r,i,_,w,v,b,l,n,o,a)}_runFill(t,e,r,i,n,s,o,a,l,h,c){s&&!h.isSvg&&(c?c(e,t.attribute,n):o&&(e.setCommonStyle(t,t.attribute,a-r,l-i,n),e.fill()))}_runStroke(t,e,r,i,n,s,o,a,l,h,c,u,d,p){s&&!h.isSvg&&(p?p(e,t.attribute,n):o&&c>=1&&(e.setStrokeStyle(t,t.attribute,(a-r)/u,(l-i)/d,n),e.stroke()))}draw(t,e,r,i){const n=Cn(t,null==i?void 0:i.theme).symbol;this._draw(t,n,!1,r,i)}};Vl=Wl([L(),$l(0,B(Y)),$l(0,P(Sa)),Ul("design:paramtypes",[Object])],Vl);const Gl=new class{constructor(){this.pools=[];for(let t=0;t<10;t++)this.pools.push(new Le)}allocate(t,e,r,i){if(!this.pools.length)return(new Le).setValue(t,e,r,i);const n=this.pools.pop();return n.x1=t,n.y1=e,n.x2=r,n.y2=i,n}allocateByObj(t){if(!this.pools.length)return new Le(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(...t){this.pools=[]}};const Xl=new class extends nl{constructor(){super(...arguments),this.time=Je.beforeFillStroke}drawShape(t,e,r,i,n,s,o,a,l,h,c,u){var d,p,f,g,m,y,v,b,_,w;const{backgroundMode:x=l.backgroundMode,backgroundFit:S=l.backgroundFit,backgroundKeepAspectRatio:T=l.backgroundKeepAspectRatio}=t.attribute;let k,{background:C}=t.attribute;if(!C)return;const E=()=>{"richtext"===t.type&&(e.restore(),e.save(),k&&e.setTransformFromMatrix(k,!0,1))};let A;"richtext"===t.type&&(k=e.currentMatrix.clone(),e.restore(),e.save(),e.setTransformForCurrent());const O=xt(C)&&C.background,B=t.transMatrix.onlyTranslate();if(O){const e=t.AABBBounds,r=(null!==(d=C.x)&&void 0!==d?d:e.x1)+(null!==(p=C.dx)&&void 0!==p?p:0),i=(null!==(f=C.y)&&void 0!==f?f:e.y1)+(null!==(g=C.dy)&&void 0!==g?g:0),n=null!==(m=C.width)&&void 0!==m?m:e.width(),s=null!==(y=C.height)&&void 0!==y?y:e.height();if(A=Gl.allocate(r,i,r+n,i+s),C=C.background,!B){const t=A.width(),e=A.height();A.set((null!==(v=C.x)&&void 0!==v?v:0)+(null!==(b=C.dx)&&void 0!==b?b:0),(null!==(_=C.y)&&void 0!==_?_:0)+(null!==(w=C.dy)&&void 0!==w?w:0),t,e)}}else A=t.AABBBounds,B||(A=(R=Object.assign(Object.assign({},t.attribute),{angle:0,scaleX:1,scaleY:1,x:0,y:0,dx:0,dy:0}),tl||(tl=Ja.CreateGraphic("text",{})),tl.initAttributes(R),tl.AABBBounds).clone());var R;if(t.backgroundImg&&t.resources){const n=t.resources.get(C);if("success"!==n.state||!n.data)return void E();e.highPerformanceSave(),B&&e.setTransformFromMatrix(t.parent.globalTransMatrix,!0),e.setCommonStyle(t,t.attribute,r,i,l),this.doDrawImage(e,n.data,A,{backgroundMode:x,backgroundFit:S,backgroundKeepAspectRatio:T}),e.highPerformanceRestore(),e.setTransformForCurrent()}else{const{backgroundCornerRadius:n}=t.attribute;e.highPerformanceSave(),e.setCommonStyle(t,t.attribute,r,i,l),e.fillStyle=C,n?(pl(e,A.x1,A.y1,A.width(),A.height(),n,!0),e.fill()):e.fillRect(A.x1,A.y1,A.width(),A.height()),e.highPerformanceRestore()}O&&Gl.free(A),E()}};var Yl=function(t,e,r,i){var n,s=arguments.length,o=s<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,e,r,i);else for(var a=t.length-1;a>=0;a--)(n=t[a])&&(o=(s<3?n(o):s>3?n(e,r,o):n(e,r))||o);return s>3&&o&&Object.defineProperty(e,r,o),o},ql=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Zl=function(t,e){return function(r,i){e(r,i,t)}};let Kl=class extends kl{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=Eo,this.builtinContributions=[Xl],this.init(t)}drawShape(t,e,r,i,n,s,o,a){var l,h,c;const u=Cn(t,null==s?void 0:s.theme).text,{text:d,underline:p=u.underline,lineThrough:f=u.lineThrough,keepDirIn3d:g=u.keepDirIn3d,direction:m=u.direction,fontSize:y=u.fontSize,verticalMode:v=u.verticalMode,x:b=u.x,y:_=u.y}=t.attribute,w=null!==(l=Yn(t.attribute.lineHeight,y))&&void 0!==l?l:y,x=this.valid(t,u,o,a);if(!x)return;const{fVisible:S,sVisible:T,doFill:k,doStroke:C}=x,E=!g,A=this.z||0;e.beginPath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,u),this.beforeRenderStep(t,e,r,i,k,C,S,T,u,n,o,a),E&&this.transformUseContext2d(t,u,A,e);const O=(n,s,l,h)=>{let c=r+s;const d=i+l;if(h){e.highPerformanceSave(),c+=y;const t=No.allocate(1,0,0,1,0,0);t.rotateByCenter(Math.PI/2,c,d),e.transformFromMatrix(t,!0),No.free(t)}C&&(a?a(e,t.attribute,u):T&&(e.setStrokeStyle(t,t.attribute,b-r,_-i,u),e.strokeText(n,c,d,A))),k&&(o?o(e,t.attribute,u):S&&(e.setCommonStyle(t,t.attribute,b-r,_-i,u),e.fillText(n,c,d,A))),h&&(e.highPerformanceRestore(),e.setTransformForCurrent())};if(e.setTextStyleWithoutAlignBaseline(t.attribute,u,A),"horizontal"===m){const{multilineLayout:n}=t;if(!n)return void e.highPerformanceRestore();const{xOffset:s,yOffset:l}=n.bbox;C&&(a?a(e,t.attribute,u):T&&(e.setStrokeStyle(t,t.attribute,b-r,_-i,u),n.lines.forEach((t=>{e.strokeText(t.str,(t.leftOffset||0)+s+r,(t.topOffset||0)+l+i,A)})))),k&&(o?o(e,t.attribute,u):S&&(e.setCommonStyle(t,t.attribute,b-r,_-i,u),n.lines.forEach((n=>{e.fillText(n.str,(n.leftOffset||0)+s+r,(n.topOffset||0)+l+i,A),this.drawUnderLine(p,f,t,(n.leftOffset||0)+s+r,(n.topOffset||0)+l+i,n.descent,(n.descent-n.ascent)/2,A,u,e,{width:n.width})}))))}else{let{textAlign:r=u.textAlign,textBaseline:i=u.textBaseline}=t.attribute;if(!v){const e=r;r=null!==(h=t.getBaselineMapAlign()[i])&&void 0!==h?h:"left",i=null!==(c=t.getAlignMapBaseline()[e])&&void 0!==c?c:"top"}t.tryUpdateAABBBounds();const n=t.cache,{verticalList:s}=n;e.textAlign="left",e.textBaseline="top";const o=w*s.length;let a=0;s.forEach((t=>{const e=t.reduce(((t,e)=>t+(e.width||0)),0);a=le(e,a)}));let l=0,d=0;"bottom"===i?d=-o:"middle"===i&&(d=-o/2),"center"===r?l-=a/2:"right"===r&&(l-=a),s.forEach(((t,e)=>{const i=t.reduce(((t,e)=>t+(e.width||0)),0),n=a-i;let s=l;"center"===r?s+=n/2:"right"===r&&(s+=n),t.forEach((t=>{const{text:r,width:i,direction:n}=t;O(r,o-(e+1)*w+d,s,n),s+=i}))}))}E&&this.restoreTransformUseContext2d(t,u,A,e),this.afterRenderStep(t,e,r,i,k,C,S,T,u,n,o,a)}draw(t,e,r,i){const n=Cn(t,null==i?void 0:i.theme).text,{keepDirIn3d:s=n.keepDirIn3d}=t.attribute,o=!s;this._draw(t,n,o,r,i)}drawUnderLine(t,e,r,i,n,s,o,a,l,h,c){if(e+t<=0)return;const{textAlign:u=l.textAlign,fill:d=l.fill,opacity:p=l.opacity,underlineOffset:f=l.underlineOffset,underlineDash:g=l.underlineDash,fillOpacity:m=l.fillOpacity}=r.attribute,y=!_t(c),v=y?c.width:r.clipedWidth,b=y?0:Ca(u,v),_={lineWidth:0,stroke:d,opacity:p,strokeOpacity:m};if(t){_.lineWidth=t,h.setStrokeStyle(r,_,i,n,l),g&&h.setLineDash(g),h.beginPath();const e=n+s+f;h.moveTo(i+b,e,a),h.lineTo(i+b+v,e,a),h.stroke()}if(e){_.lineWidth=e,h.setStrokeStyle(r,_,i,n,l),h.beginPath();const t=n+o;h.moveTo(i+b,t,a),h.lineTo(i+b+v,t,a),h.stroke()}}};Kl=Yl([L(),Zl(0,B(Y)),Zl(0,P(Ta)),ql("design:paramtypes",[Object])],Kl);var Ql=function(t,e,r,i){var n,s=arguments.length,o=s<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,e,r,i);else for(var a=t.length-1;a>=0;a--)(n=t[a])&&(o=(s<3?n(o):s>3?n(e,r,o):n(e,r))||o);return s>3&&o&&Object.defineProperty(e,r,o),o},Jl=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},th=function(t,e){return function(r,i){e(r,i,t)}};let eh=class{constructor(t){this.groupRenderContribitions=t,this.numberType=wo}reInit(){this._groupRenderContribitions=this.groupRenderContribitions.getContributions()||[],this._groupRenderContribitions.push(ul)}drawShape(t,e,r,i,n,s,o,a,l){const{clip:h,fill:c,stroke:u,background:d}=t.attribute;if(!(h||c||u||d))return;l=null!=l?l:Cn(t,null==s?void 0:s.theme).group;const{opacity:p=l.opacity,width:f=l.width,height:g=l.height,fillOpacity:m=l.fillOpacity,strokeOpacity:y=l.strokeOpacity,cornerRadius:v=l.cornerRadius,path:b=l.path,lineWidth:_=l.lineWidth,visible:w=l.visible,fillStrokeOrder:x=l.fillStrokeOrder,cornerType:S=l.cornerType,x:T=l.x,y:k=l.y}=t.attribute,C=ya(p,m,f,g,c),E=ba(p,y,f,g),A=fa(c,d),O=ga(u,_);if(!t.valid||!w)return;if(!h){if(!A&&!O)return;if(!(C||E||o||a||d))return}if(b&&b.length&&n.drawContribution){const t=e.disableFill,r=e.disableStroke,i=e.disableBeginPath;e.disableFill=!0,e.disableStroke=!0,e.disableBeginPath=!0,b.forEach((t=>{n.drawContribution.getRenderContribution(t).draw(t,n.renderService,n,s)})),e.disableFill=t,e.disableStroke=r,e.disableBeginPath=i}else 0===v||Et(v)&&v.every((t=>0===t))?(e.beginPath(),e.rect(r,i,f,g)):(e.beginPath(),pl(e,r,i,f,g,v,"bevel"!==S));this._groupRenderContribitions||(this._groupRenderContribitions=this.groupRenderContribitions.getContributions()||[],this._groupRenderContribitions.push(ul));const B={doFill:A,doStroke:O};e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this._groupRenderContribitions.forEach((s=>{s.time===Je.beforeFillStroke&&s.drawShape(t,e,r,i,A,O,C,E,l,n,o,a,B)})),h&&e.clip();const R=()=>{B.doFill&&(o?o(e,t.attribute,l):C&&(e.setCommonStyle(t,t.attribute,T-r,k-i,l),e.fill()))},L=()=>{B.doStroke&&(a?a(e,t.attribute,l):E&&(e.setStrokeStyle(t,t.attribute,T-r,k-i,l),e.stroke()))};x?(L(),R()):(R(),L()),this._groupRenderContribitions.forEach((s=>{s.time===Je.afterFillStroke&&s.drawShape(t,e,r,i,A,O,C,E,l,n,o,a)}))}draw(t,e,r,i){var n,s;const{context:o}=r;if(!o)return;const{clip:a,baseOpacity:l=1,drawMode:h}=t.attribute,c=o.nativeContext,u=o.canvas.nativeCanvas;if(h>0){const{x:e,y:r,width:i,height:n}=t.attribute,s=o.canvas,a=rt.global.createCanvas({width:s.width,height:s.height,dpr:1}),l=a.getContext("2d"),c=o.nativeContext.getTransform();l.setTransform(c.a,c.b,c.c,c.d,c.e,c.f),1===h&&(l.save(),l.clearRect(0,0,s.width,s.height),l.beginPath(),l.rect(e,r,i,n),l.clip(),l.drawImage(s.nativeCanvas,0,0,s.width,s.height,0,0,s.displayWidth,s.displayHeight),l.restore()),o.nativeContext=l,s.nativeCanvas=a}a?o.save():o.highPerformanceSave();const d=o.baseGlobalAlpha;o.baseGlobalAlpha*=l;const p=o.modelMatrix;if(o.camera){const e=Cn(t,null==i?void 0:i.theme).group,r=Fo.allocate(),n=Fo.allocate();Ra(n,t,e),Mo(r,p||r,n),o.modelMatrix=r,Fo.free(n),o.setTransform(1,0,0,1,0,0,!0)}else o.transformFromMatrix(t.transMatrix,!0);o.beginPath(),i.skipDraw?this.drawShape(t,o,0,0,r,i,(()=>!1),(()=>!1)):this.drawShape(t,o,0,0,r,null,null,null);const{scrollX:f,scrollY:g}=t.attribute;let m;if((f||g)&&o.translate(f,g),i&&i.renderInGroup&&(m=i.renderInGroup(null===(n=i.renderInGroupParams)||void 0===n?void 0:n.skipSort,t,r,null===(s=i.renderInGroupParams)||void 0===s?void 0:s.nextM)),o.modelMatrix!==p&&Fo.free(o.modelMatrix),o.modelMatrix=p,o.baseGlobalAlpha=d,h>0){const{x:e,y:r,width:i,height:n}=t.attribute,s=o.nativeContext,a=o.canvas.nativeCanvas;c.save(),c.setTransform(o.dpr,0,0,o.dpr,0,0,!0),1===h&&s.rect(e,r,i,n),c.drawImage(a,0,0,a.width,a.height,0,0,o.canvas.displayWidth,o.canvas.displayHeight);const l=s.getTransform();c.setTransform(l.a,l.b,l.c,l.d,l.e,l.f),o.nativeContext=c,o.canvas.nativeCanvas=u,c.restore()}m&&m.then?m.then((()=>{a?o.restore():o.highPerformanceRestore()})):a?o.restore():o.highPerformanceRestore()}};eh=Ql([L(),th(0,B(Y)),th(0,P(wa)),Jl("design:paramtypes",[Object])],eh);const rh=Symbol.for("IncrementalDrawContribution"),ih=Symbol.for("GraphicRender"),nh=Symbol.for("GroupRender"),sh=Symbol.for("RectRender"),oh=Symbol.for("SymbolRender"),ah=Symbol.for("TextRender"),lh=Symbol.for("DrawContribution"),hh=(t,e,r,i)=>{let n,s=!1,o=!1;if(e.forEachChildren((t=>(s=t.numberType===vo,!s))),e.forEachChildren((t=>(o=!!t.findFace,!o))),s){const t=e.getChildren(),a=[...t];a.sort(((t,e)=>{var r,i,n,s;let o=(null!==(i=null!==(r=t.attribute.startAngle)&&void 0!==r?r:0+t.attribute.endAngle)&&void 0!==i?i:0)/2,a=(null!==(s=null!==(n=e.attribute.startAngle)&&void 0!==n?n:0+e.attribute.endAngle)&&void 0!==s?s:0)/2;for(;o<0;)o+=ne;for(;a<0;)a+=ne;return a-o})),a.forEach((t=>{t._next=null,t._prev=null})),e.removeAllChild(),e.update(),a.forEach((t=>{e.appendChild(t)})),i.hack_pieFace="outside",n=r(s,o),n&&n.graphic||(i.hack_pieFace="inside",n=r(s,o)),n&&n.graphic||(i.hack_pieFace="top",n=r(s,o)),e.removeAllChild(),t.forEach((t=>{t._next=null,t._prev=null})),t.forEach((t=>{e.appendChild(t)}))}else if(o){const i=e.getChildren(),a=i.map((e=>({ave_z:e.findFace().vertices.map((r=>{var i;return t.view(r[0],r[1],null!==(i=r[2]+e.attribute.z)&&void 0!==i?i:0)[2]})).reduce(((t,e)=>t+e),0),g:e})));a.sort(((t,e)=>e.ave_z-t.ave_z)),e.removeAllChild(),a.forEach((t=>{t.g._next=null,t.g._prev=null})),e.update(),a.forEach((t=>{e.add(t.g)})),n=r(s,o),e.removeAllChild(),i.forEach((t=>{t._next=null,t._prev=null})),e.update(),i.forEach((t=>{e.add(t)}))}else n=r(s,o);return n};var ch=function(t,e,r,i){var n,s=arguments.length,o=s<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,e,r,i);else for(var a=t.length-1;a>=0;a--)(n=t[a])&&(o=(s<3?n(o):s>3?n(e,r,o):n(e,r))||o);return s>3&&o&&Object.defineProperty(e,r,o),o},uh=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const dh=Symbol.for("DrawItemInterceptor"),ph=new Le,fh=new Le;class gh{constructor(){this.order=1}afterDrawItem(t,e,r,i,n){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,r,i,n),!1}beforeDrawItem(t,e,r,i,n){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,r,i,n),!1}drawItem(t,e,r,i,n){if(!t.shadowRoot)return!1;const{context:s}=r;if(s.highPerformanceSave(),s.transformFromMatrix(t.transMatrix,!0),i.dirtyBounds&&i.backupDirtyBounds){ph.copy(i.dirtyBounds),fh.copy(i.backupDirtyBounds);const e=t.globalTransMatrix.getInverse();i.dirtyBounds.copy(i.backupDirtyBounds).transformWithMatrix(e),i.backupDirtyBounds.copy(i.dirtyBounds)}return i.renderGroup(t.shadowRoot,r,No.allocate(1,0,0,1,0,0)),s.highPerformanceRestore(),i.dirtyBounds&&i.backupDirtyBounds&&(i.dirtyBounds.copy(ph),i.backupDirtyBounds.copy(fh)),!0}}class mh{constructor(){this.order=1}afterDrawItem(t,e,r,i,n){return t.attribute._debug_bounds&&this.drawItem(t,e,r,i,n),!1}drawItem(t,e,r,i,n){if(!t.attribute._debug_bounds)return!1;const{context:s}=r;s.highPerformanceSave(),t.parent&&s.setTransformFromMatrix(t.parent.globalTransMatrix,!0),t.glyphHost&&t.glyphHost.parent&&s.setTransformFromMatrix(t.glyphHost.parent.globalTransMatrix,!0);const o=t.AABBBounds;return!0!==t.attribute._debug_bounds&&t.attribute._debug_bounds(s,t),s.strokeRect(o.x1,o.y1,o.width(),o.height()),s.highPerformanceRestore(),!0}}let yh=class{constructor(){this.order=1,this.interceptors=[new gh,new bh,new vh,new mh]}afterDrawItem(t,e,r,i,n){if((!t.in3dMode||r.in3dInterceptor)&&!t.shadowRoot&&!t.attribute._debug_bounds&&!(t.baseGraphic||t.attribute.globalZIndex||t.interactiveGraphic))return!1;for(let s=0;s<this.interceptors.length;s++)if(this.interceptors[s].afterDrawItem&&this.interceptors[s].afterDrawItem(t,e,r,i,n))return!0;return!1}beforeDrawItem(t,e,r,i,n){if((!t.in3dMode||r.in3dInterceptor)&&!t.shadowRoot&&!t.attribute._debug_bounds&&!(t.baseGraphic||t.attribute.globalZIndex||t.interactiveGraphic))return!1;for(let s=0;s<this.interceptors.length;s++)if(this.interceptors[s].beforeDrawItem&&this.interceptors[s].beforeDrawItem(t,e,r,i,n))return!0;return!1}};yh=ch([L(),uh("design:paramtypes",[])],yh);class vh{constructor(){this.order=1}beforeDrawItem(t,e,r,i,n){return!this.processing&&(t.baseGraphic?this.beforeDrawInteractive(t,e,r,i,n):this.beforeSetInteractive(t,e,r,i,n))}beforeSetInteractive(t,e,r,i,n){let s=t.interactiveGraphic;if(t.attribute.globalZIndex){s||(s=t.clone(),t.interactiveGraphic=s,s.baseGraphic=t),s.setAttributes({globalZIndex:0,zIndex:t.attribute.globalZIndex},!1,{skipUpdateCallback:!0}),r.stage.tryInitInteractiveLayer();const e=r.stage.getLayer("_builtin_interactive");return e&&this.getShadowRoot(e).add(s),!0}if(s){r.stage.tryInitInteractiveLayer();const e=r.stage.getLayer("_builtin_interactive");e&&this.getShadowRoot(e).removeChild(s),t.interactiveGraphic=null,s.baseGraphic=null}return!1}beforeDrawInteractive(t,e,r,i,n){const s=t.baseGraphic;let o=!!s.stage,a=s.parent;for(;o&&a&&a.stage!==a;)o=!!a.stage,a=a.parent;if(!o){const e=r.stage.getLayer("_builtin_interactive");return e&&this.getShadowRoot(e).removeChild(t),!0}if(s){this.processing=!0;const{context:t}=r;return t.highPerformanceSave(),t.setTransformFromMatrix(s.parent.globalTransMatrix,!0),s.isContainer?i.renderGroup(s,r,s.parent.globalTransMatrix):i.renderItem(s,r),t.highPerformanceRestore(),this.processing=!1,!0}return!1}getShadowRoot(t){var e;let r=t.getElementById("_interactive_group");return r||(r=Ja.CreateGraphic("group",{}),r.id="_interactive_group",t.add(r)),null!==(e=r.shadowRoot)&&void 0!==e?e:r.attachShadow()}}class bh{constructor(){this.order=1}beforeDrawItem(t,e,r,i,n){if(!t.in3dMode||r.in3dInterceptor)return!1;r.in3dInterceptor=!0;const{context:s,stage:o}=e.drawParams;s.canvas,s.save(),this.initCanvasCtx(s),s.camera=o.camera;const a=s.currentMatrix;a.a/=s.dpr,a.b/=s.dpr,a.c/=s.dpr,a.d/=s.dpr,a.e/=s.dpr,a.f/=s.dpr;const l=Fo.allocate();!function(t,e){t[0]=e.a,t[1]=e.b,t[2]=0,t[3]=0,t[4]=e.c,t[5]=e.d,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=e.e,t[13]=e.f,t[14]=0,t[15]=1}(l,a);const h=s.modelMatrix;if(h){if(l){const t=Fo.allocate();s.modelMatrix=Mo(t,h,l)}}else s.modelMatrix=l;return s.setTransform(1,0,0,1,0,0,!0),t.isContainer?hh(s,t,((e,n)=>i.renderGroup(t,r,t.parent.globalTransMatrix,!e&&n)),r):i.renderItem(t,r),s.camera=null,s.restore(),s.modelMatrix!==h&&Fo.free(s.modelMatrix),s.modelMatrix=h,r.in3dInterceptor=!1,!0}initCanvasCtx(t){t.setTransformForCurrent()}}var _h=function(t,e,r,i){var n,s=arguments.length,o=s<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,e,r,i);else for(var a=t.length-1;a>=0;a--)(n=t[a])&&(o=(s<3?n(o):s>3?n(e,r,o):n(e,r))||o);return s>3&&o&&Object.defineProperty(e,r,o),o},wh=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},xh=function(t,e){return function(r,i){e(r,i,t)}};const Sh=Symbol.for("RenderService");let Th=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 r=e.updateBounds;this.prepare(r),this.prepareRenderList(),this.beforeDraw(e),this.draw(e),this.afterDraw(e),this.drawParams=null}};Th=_h([L(),xh(0,B(lh)),wh("design:paramtypes",[Object])],Th);var kh=new v((t=>{t(Sh).to(Th)}));const Ch=Symbol.for("PickerService"),Eh=Symbol.for("GlobalPickerService"),Ah=Symbol.for("PickItemInterceptor"),Oh=Symbol.for("PickServiceInterceptor");var Bh=function(t,e,r,i){var n,s=arguments.length,o=s<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,e,r,i);else for(var a=t.length-1;a>=0;a--)(n=t[a])&&(o=(s<3?n(o):s>3?n(e,r,o):n(e,r))||o);return s>3&&o&&Object.defineProperty(e,r,o),o};let Rh=class{constructor(){this.order=1}afterPickItem(t,e,r,i,n){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}};Rh=Bh([L()],Rh);let Lh=class{constructor(){this.order=1}afterPickItem(t,e,r,i,n){return t.attribute.shadowRootIdx>0||!t.attribute.shadowRootIdx?this._pickItem(t,e,r,i,n):null}beforePickItem(t,e,r,i,n){return t.attribute.shadowRootIdx<0?this._pickItem(t,e,r,i,n):null}_pickItem(t,e,r,i,n){var s;if(!t.shadowRoot)return null;const{parentMatrix:o}=n||{};if(!o)return null;const a=e.pickContext;a.highPerformanceSave();const l=null===(s=Cn(t))||void 0===s?void 0:s[t.type],{shadowPickMode:h=(null==l?void 0:l.shadowPickMode)}=t.attribute,c=t.shadowRoot,u=No.allocateByObj(o),d=new fe(u.a*r.x+u.c*r.y+u.e,u.b*r.x+u.d*r.y+u.f),p=e.pickGroup(c,d,u,i);return a.highPerformanceRestore(),!p.graphic&&p.group&&"full"===h&&(p.graphic=p.group),p}};Lh=Bh([L()],Lh);let Ph=class{constructor(){this.order=1}beforePickItem(t,e,r,i,n){const s=t.baseGraphic;if(s&&s.parent){const t=new fe(r.x,r.y),n=e.pickContext;n.highPerformanceSave();const o=s.parent.globalTransMatrix;o.transformPoint(t,t);const a=s.isContainer?e.pickGroup(s,t.clone(),o,i):e.pickItem(s,t.clone(),o,i);return n.highPerformanceRestore(),a}return null}};Ph=Bh([L()],Ph);let Dh=class{constructor(){this.order=1}beforePickItem(t,e,r,i,n){if(!t.in3dMode||i.in3dInterceptor)return null;const s=e.pickContext,o=t.stage;if(!s||!o)return null;if(i.in3dInterceptor=!0,s.save(),this.initCanvasCtx(s),s.camera=o.camera,t.isContainer){const o=hh(s,t,(()=>e.pickGroup(t,r,n.parentMatrix,i)),i);return s.camera=null,i.in3dInterceptor=!1,s.restore(),o}return s.restore(),null}initCanvasCtx(t){t.setTransformForCurrent()}};Dh=Bh([L()],Dh);var Mh=new v(((t,e,r)=>{r(Ch)||(t(Eh).toSelf(),t(Ch).toService(Eh)),t(Dh).toSelf().inSingletonScope(),t(Ah).toService(Dh),t(Lh).toSelf().inSingletonScope(),t(Ah).toService(Lh),t(Ph).toSelf().inSingletonScope(),t(Ah).toService(Ph),Z(t,Ah),t(Rh).toSelf().inSingletonScope(),t(Oh).toService(Rh),Z(t,Oh)})),Ih=new v((t=>{t(Ao).to(La),t(Oo).toConstantValue(Ja)}));const Nh=Symbol.for("AutoEnablePlugins"),Fh=Symbol.for("PluginService");var jh=function(t,e,r,i){var n,s=arguments.length,o=s<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,e,r,i);else for(var a=t.length-1;a>=0;a--)(n=t[a])&&(o=(s<3?n(o):s>3?n(e,r,o):n(e,r))||o);return s>3&&o&&Object.defineProperty(e,r,o),o},zh=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Hh=function(t,e){return function(r,i){e(r,i,t)}};let Wh=class{constructor(t){this.autoEnablePlugins=t,this.onStartupFinishedPlugin=[],this.onRegisterPlugin=[],this.actived=!1}active(t,e){this.stage=t,this.actived=!0;const{pluginList:r}=e;r&&Ai.isBound(Nh)&&this.autoEnablePlugins.getContributions().forEach((t=>{r.includes(t.name)&&this.register(t)}))}findPluginsByName(t){const e=[];return this.onStartupFinishedPlugin.forEach((r=>{r.name===t&&e.push(r)})),this.onRegisterPlugin.forEach((r=>{r.name===t&&e.push(r)})),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(...t){this.onStartupFinishedPlugin.forEach((t=>{t.deactivate(this)})),this.onStartupFinishedPlugin=[],this.onRegisterPlugin.forEach((t=>{t.deactivate(this)})),this.onRegisterPlugin=[]}};Wh=jh([L(),Hh(0,B(Y)),Hh(0,P(Nh)),zh("design:paramtypes",[Object])],Wh);var Uh=new v((t=>{t(Fh).to(Wh),function(t,e){t(Y).toDynamicValue((({container:t})=>new q(e,t))).whenTargetNamed(e)}(t,Nh)})),$h=new v((t=>{Z(t,tt)})),Vh=new v((t=>{t(Ci).to(Ei).inSingletonScope(),Z(t,Ci)})),Gh=function(t,e,r,i){var n,s=arguments.length,o=s<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,e,r,i);else for(var a=t.length-1;a>=0;a--)(n=t[a])&&(o=(s<3?n(o):s>3?n(e,r,o):n(e,r))||o);return s>3&&o&&Object.defineProperty(e,r,o),o},Xh=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let Yh=class{constructor(){this.type="static",this.offscreen=!1,this.global=rt.global}setDpr(t){this.canvas.dpr=t}init(t,e,r){if(this.layer=t,this.window=e,r.main)this.main=!0,this.context=e.getContext(),this.canvas=this.context.getCanvas();else{let t;this.main=!1,r.canvasId&&(t=this.global.getElementById(r.canvasId)),t||(t=this.global.createCanvas({width:e.width,height:e.height})),t.style&&(t.style["pointer-events"]="none");const i=e.getContext().getCanvas().nativeCanvas,n=Bi({nativeCanvas:t,width:e.width,height:e.height,dpr:e.dpr,id:r.canvasId,canvasControled:!0,container:e.getContainer(),x:i.offsetLeft,y:i.offsetTop});n.applyPosition(),this.canvas=n,this.context=n.getContext()}}resize(t,e){this.canvas.resize(t,e)}resizeView(t,e){}render(t,e,r){var i;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!==(i=e.background)&&void 0!==i?i:"#ffffff"},e),r))}merge(t){t.forEach((t=>{const e=t.getContext().canvas.nativeCanvas;this.context.drawImage(e,0,0)}))}prepare(t,e){}drawTo(t,e,r){var i;const n=t.getContext();r.renderService.render(e,Object.assign(Object.assign({context:n},r),{clear:r.clear?null!==(i=r.background)&&void 0!==i?i:"#fff":void 0}))}getContext(){return this.context}release(){this.canvas.release()}};Yh=Gh([L(),Xh("design:paramtypes",[])],Yh);var qh=new v((t=>{t(Yh).toSelf(),t(oa).toService(Yh)}));var Zh=function(t,e,r,i){return new(r||(r=Promise))((function(n,s){function o(t){try{l(i.next(t))}catch(t){s(t)}}function a(t){try{l(i.throw(t))}catch(t){s(t)}}function l(t){var e;t.done?n(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(o,a)}l((i=i.apply(t,e||[])).next())}))};function Kh(t,e,r){const i={},n=[];return t.forEachChildren((t=>{const{zIndex:r=e}=t.attribute;i[r]?i[r].push(t):(i[r]=[t],n.push(r))}),r),n.sort(((t,e)=>r?e-t:t-e)),{childMap:i,zIdxArray:n}}function Qh(t,e,r,i=!1){return Zh(this,void 0,void 0,(function*(){yield t.forEachChildrenAsync(r,i)}))}function Jh(t,e,r,i=!1){let n=!1;t.forEachChildren(((t,e)=>{const{zIndex:i=r}=t.attribute;if(0===e);else if(void 0!==i)return n=!0,!0;return!1}),i);let s=null,o=!1;if(n){const{childMap:n,zIdxArray:a}=Kh(t,r,i);let l=!1;for(let t=0;t<a.length&&!l;t++){const r=n[a[t]];for(let t=0;t<r.length;t++){if(o){l=!0,s=r[t];break}r[t]._uid!==e||(o=!0)}}}else t.forEachChildren((t=>o?(s=t,!0):(t._uid===e&&(o=!0),!1)),i);return s}var tc=function(t,e,r,i){var n,s=arguments.length,o=s<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,e,r,i);else for(var a=t.length-1;a>=0;a--)(n=t[a])&&(o=(s<3?n(o):s>3?n(e,r,o):n(e,r))||o);return s>3&&o&&Object.defineProperty(e,r,o),o},ec=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},rc=function(t,e){return function(r,i){e(r,i,t)}};let ic=class{constructor(t,e){this.contributions=t,this.drawItemInterceptorContributions=e,this._renderInGroup=(t,e,r,i)=>{var n;t?e.forEachChildren((t=>{r.break||(t.isContainer?this.renderGroup(t,r,i):this.renderItem(t,r))})):function(t,e,r,i=!1,n=!1){let s=!1;if(n)s=!0;else{let r;t.forEachChildren(((t,i)=>{const{zIndex:n=e}=t.attribute;if(0===i)r=n;else if(r!==n)return s=!0,!0;return!1}),i)}if(s){const{childMap:s,zIdxArray:o}=Kh(t,e,i);let a=!1;for(let t=0;t<o.length&&!a;t++){const e=s[o[t]];n&&e.sort(((t,e)=>{var r,n;return(i?-1:1)*((null!==(r=e.attribute.z)&&void 0!==r?r:0)-(null!==(n=t.attribute.z)&&void 0!==n?n:0))}));for(let t=0;t<e.length;t++)if(r(e[t],t)){a=!0;break}}}else t.forEachChildren(r,i)}(e,Jr.zIndex,(t=>{r.break||(t.isContainer?this.renderGroup(t,r,i):this.renderItem(t,r))}),!1,!!(null===(n=r.context)||void 0===n?void 0:n.camera))},this.currentRenderMap=new Map,this.defaultRenderMap=new Map,this.styleRenderMap=new Map,this.dirtyBounds=new Re,this.backupDirtyBounds=new Re,this.global=rt.global,this.layerService=rt.layerService,Et(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){var r;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:o}=e;if(!i)return;const a=this.dirtyBounds.setValue(0,0,s.width(),s.height());if(n.dirtyBounds&&!n.dirtyBounds.empty()){const t=ye(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 l=i.dpr%1;(l||.5!==l)&&(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.reset(!1),i.save(),i.setClearMatrix(o.a,o.b,o.c,o.d,o.e,o.f),i.clearMatrix(!1),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),(null===(r=t.drawParams)||void 0===r?void 0:r.stage)&&t.drawParams.stage.hooks.afterClearScreen.call(t.drawParams),t.renderTreeRoots.sort(((t,e)=>{var r,i;return(null!==(r=t.attribute.zIndex)&&void 0!==r?r:Jr.zIndex)-(null!==(i=e.attribute.zIndex)&&void 0!==i?i:Jr.zIndex)})).forEach((t=>{t.isContainer?this.renderGroup(t,e,No.allocate(1,0,0,1,0,0)):this.renderItem(t,e)})),i.restore(),i.draw()}doRegister(){throw new Error("暂不支持")}_findNextGraphic(t){let e=t.parent,r=t._uid;for(;e;){const t=Jh(e,r,Jr.zIndex);if(t)return t;r=e._uid,e=e.parent}return null}renderGroup(t,e,r,i){if(e.break||!1===t.attribute.visibleAll)return;if(t.incremental&&(null==e.startAtId||e.startAtId===t._uid))return e.break=!0,void this._increaseRender(t,e);if(this.useDirtyBounds&&!we(t.AABBBounds,this.dirtyBounds,!1)&&"empty"!==t.attribute.boundsMode)return;let n,s=r;if(this.useDirtyBounds){n=Gl.allocateByObj(this.dirtyBounds);const e=t.transMatrix;s=No.allocateByObj(r).multiply(e.a,e.b,e.c,e.d,e.e,e.f),this.dirtyBounds.copy(this.backupDirtyBounds).transformWithMatrix(s.getInverse())}e.isGroupScroll=!(!t.attribute.scrollX&&!t.attribute.scrollY),this.renderItem(t,e,{renderInGroupParams:{skipSort:i,nextM:s},renderInGroup:this._renderInGroup}),this.useDirtyBounds&&(this.dirtyBounds.copy(n),Gl.free(n),No.free(s))}_increaseRender(t,e){const{layer:r,stage:i}=e,{subLayers:n}=r;let s=n.get(t._uid);s||(s={layer:this.layerService.createLayer(i),zIndex:n.size,group:t},n.set(t._uid,s));const o=s.layer.getNativeHandler().getContext(),a=s.drawContribution||Ai.get(rh);a.dirtyBounds.setValue(-1/0,-1/0,1/0,1/0),a.backupDirtyBounds.setValue(-1/0,-1/0,1/0,1/0),a.draw(this.currentRenderService,Object.assign(Object.assign({},e),{drawContribution:a,clear:"transparent",layer:s.layer,context:o,startAtId:t._uid,break:!1})),s.drawContribution=a;const l=this._findNextGraphic(t);if(l)if(l.isContainer&&l.incremental)this._increaseRender(l,e);else{let t=n.get(l._uid);t||(t={layer:this.layerService.createLayer(i),zIndex:n.size},n.set(l._uid,t));const r=t.layer.getNativeHandler().getContext();this.draw(this.currentRenderService,Object.assign(Object.assign({},e),{drawContribution:a,clear:"transparent",layer:t.layer,context:r,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,r){if(this.InterceptorContributions.length)for(let i=0;i<this.InterceptorContributions.length;i++){const n=this.InterceptorContributions[i];if(n.beforeDrawItem&&n.beforeDrawItem(t,this.currentRenderService,e,this,r))return}const i=this.getRenderContribution(t);if(!i)return;let n,s=!1;if(e.isGroupScroll){const{scrollX:e=0,scrollY:r=0}=t.parent.attribute;s=!0,this.scrollMatrix||(this.scrollMatrix=No.allocate(1,0,0,1,0,0)),this.scrollMatrix.translate(-e,-r)}if(s&&(n=this.dirtyBounds.clone().transformWithMatrix(this.scrollMatrix)),this.useDirtyBounds&&!t.isContainer&&"empty"!==t.attribute.boundsMode&&!we(t.AABBBounds,null!=n?n:this.dirtyBounds,!1)){if(s&&t.parent){const{scrollX:e=0,scrollY:r=0}=t.parent.attribute;this.scrollMatrix&&this.scrollMatrix.translate(e,r)}return}const o=null!=e.startAtId&&t._uid!==e.startAtId;if(t._uid===e.startAtId&&(e.startAtId=null),r&&(r.skipDraw=o),o?t.isContainer&&i.draw(t,this.currentRenderService,e,r):i.draw(t,this.currentRenderService,e,r),s&&t.parent){const{scrollX:e=0,scrollY:r=0}=t.parent.attribute;this.scrollMatrix&&this.scrollMatrix.translate(e,r)}if(this.InterceptorContributions.length)for(let r=0;r<this.InterceptorContributions.length;r++){const i=this.InterceptorContributions[r];if(i.afterDrawItem&&i.afterDrawItem(t,this.currentRenderService,e,this))return}}selectRenderByType(t){return Yt.getInstance().warn("未知错误,不应该走到这里"),null}selectRenderByNumberType(t,e){let r;if(e.attribute.renderStyle){const i=this.styleRenderMap.get(e.attribute.renderStyle);r=i&&i.get(t)}return r||this.currentRenderMap.get(t)||this.defaultRenderMap.get(t)}clearScreen(t,e,r){var i,n,s;const{clear:o,viewBox:a}=r,l=a.width(),h=a.height();if(o){e.clearRect(0,0,l,h),(null===(i=t.drawParams)||void 0===i?void 0:i.stage)&&t.drawParams.stage.hooks.afterClearRect.call(t.drawParams);const r=null===(n=t.drawParams)||void 0===n?void 0:n.stage;if(r&&(e.globalAlpha=null!==(s=r.attribute.opacity)&&void 0!==s?s:1),r&&r.backgroundImg&&r.resources){const t=r.resources.get(o);t&&"success"===t.state&&t.data&&e.drawImage(t.data,0,0,l,h)}else e.fillStyle=vi(e,o,{AABBBounds:{x1:0,y1:0,x2:0+l,y2:0+h}},0,0),e.fillRect(0,0,l,h)}}afterDraw(t,e){}};ic=tc([L(),rc(0,R(ih)),rc(1,B(Y)),rc(1,P(dh)),ec("design:paramtypes",[Array,Object])],ic);var nc=function(t,e,r,i){var n,s=arguments.length,o=s<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,e,r,i);else for(var a=t.length-1;a>=0;a--)(n=t[a])&&(o=(s<3?n(o):s>3?n(e,r,o):n(e,r))||o);return s>3&&o&&Object.defineProperty(e,r,o),o};let sc=class extends Bl{constructor(){super(...arguments),this.numberType=So}drawShape(t,e,r,i,n,s,o,a){if(t.incremental&&n.multiGraphicOptions){const{startAtIdx:e,length:s}=n.multiGraphicOptions,{segments:l=[]}=t.attribute;if(e>l.length)return;const h=Cn(t).line,{fill:c=h.fill,stroke:u=h.stroke,opacity:d=h.opacity,fillOpacity:p=h.fillOpacity,strokeOpacity:f=h.strokeOpacity,lineWidth:g=h.lineWidth,visible:m=h.visible}=t.attribute,y=ma(d,p,c),v=va(d,f),b=fa(c),_=ga(u,g);if(!t.valid||!m)return;if(!b&&!_)return;if(!(y||v||o||a))return;const{context:w}=n;for(let n=e;n<e+s;n++)this.drawIncreaseSegment(t,w,l[n-1],l[n],t.attribute.segments[n],[h,t.attribute],r,i)}else super.drawShape(t,e,r,i,n,s,o,a)}drawIncreaseSegment(t,e,r,i,n,s,o,a){i&&(e.beginPath(),function(t,e,r,i){const{offsetX:n=0,offsetY:s=0}=i||{},o=e?e.points[e.points.length-1]:r.points[0];t.moveTo(o.x+n,o.y+s),r.points.forEach((e=>{!1!==e.defined?t.lineTo(e.x+n,e.y+s):t.moveTo(e.x+n,e.y+s)}))}(e.nativeContext,r,i,{offsetX:o,offsetY:a}),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,n,s),e.setStrokeStyle(t,n,o,a,s),e.stroke())}};sc=nc([L()],sc);var oc=function(t,e,r,i){var n,s=arguments.length,o=s<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,e,r,i);else for(var a=t.length-1;a>=0;a--)(n=t[a])&&(o=(s<3?n(o):s>3?n(e,r,o):n(e,r))||o);return s>3&&o&&Object.defineProperty(e,r,o),o};let ac=class extends Nl{constructor(){super(...arguments),this.numberType=bo}drawShape(t,e,r,i,n,s,o){if(t.incremental&&n.multiGraphicOptions){const{startAtIdx:s,length:a}=n.multiGraphicOptions,{segments:l=[]}=t.attribute;if(s>l.length)return;const h=Cn(t).area,{fill:c=h.fill,fillOpacity:u=h.fillOpacity,opacity:d=h.opacity,visible:p=h.visible}=t.attribute,f=ma(d,u,c),g=fa(c);if(!t.valid||!p)return;if(!g)return;if(!f&&!o)return;for(let n=s;n<s+a;n++)this.drawIncreaseSegment(t,e,l[n-1],l[n],t.attribute.segments[n],[h,t.attribute],r,i)}else super.drawShape(t,e,r,i,n,s,o)}drawIncreaseSegment(t,e,r,i,n,s,o,a){i&&(e.beginPath(),function(t,e,r,i){const{offsetX:n=0,offsetY:s=0}=i||{},{points:o}=r,a=[];for(let t=0;t<o.length;t++)o[t].defined;a.push(o),a.forEach(((r,i)=>{var o,a,l,h;const c=e&&0===i?e.points[e.points.length-1]:r[0];t.moveTo(c.x+n,c.y+s),r.forEach((e=>{!1!==e.defined?t.lineTo(e.x+n,e.y+s):t.moveTo(e.x+n,e.y+s)}));for(let e=r.length-1;e>=0;e--){const i=r[e];t.lineTo(null!==(o=i.x1)&&void 0!==o?o:i.x,null!==(a=i.y1)&&void 0!==a?a:i.y)}t.lineTo(null!==(l=c.x1)&&void 0!==l?l:c.x,null!==(h=c.y1)&&void 0!==h?h:c.y),t.closePath()}))}(e.camera?e:e.nativeContext,r,i,{offsetX:o,offsetY:a}),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,n,s),e.setCommonStyle(t,n,o,a,s),e.fill())}};ac=oc([L()],ac);var lc,hc=function(t,e,r,i){var n,s=arguments.length,o=s<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,e,r,i);else for(var a=t.length-1;a>=0;a--)(n=t[a])&&(o=(s<3?n(o):s>3?n(e,r,o):n(e,r))||o);return s>3&&o&&Object.defineProperty(e,r,o),o},cc=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},uc=function(t,e){return function(r,i){e(r,i,t)}},dc=function(t,e,r,i){return new(r||(r=Promise))((function(n,s){function o(t){try{l(i.next(t))}catch(t){s(t)}}function a(t){try{l(i.throw(t))}catch(t){s(t)}}function l(t){var e;t.done?n(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(o,a)}l((i=i.apply(t,e||[])).next())}))};!function(t){t[t.NORMAL=0]="NORMAL",t[t.STOP=1]="STOP"}(lc||(lc={}));let pc=class extends ic{constructor(t,e,r,i){super(t,i),this.contributions=t,this.lineRender=e,this.areaRender=r,this.drawItemInterceptorContributions=i,this.rendering=!1,this.currFrameStartAt=0,this.currentIdx=0,this.status=lc.NORMAL,this.checkingForDrawPromise=null,this.hooks={completeDraw:new J([])},this.defaultRenderMap.set(this.lineRender.numberType,this.lineRender),this.defaultRenderMap.set(this.areaRender.numberType,this.areaRender)}draw(t,e){return dc(this,void 0,void 0,(function*(){if(this.checkingForDrawPromise)return;this.lastRenderService=t,this.lastDrawContext=e,this.checkingForDrawPromise=this.checkForDraw(e);const r=yield this.checkingForDrawPromise;if(this.checkingForDrawPromise=null,r)return;this.currentRenderService=t;const{context:i,viewBox:n}=e;i&&(i.inuse=!0,i.clearMatrix(),i.setTransformForCurrent(!0),i.save(),e.restartIncremental&&this.clearScreen(this.currentRenderService,i,e),i.translate(n.x1,n.y1,!0),i.save(),t.renderTreeRoots.sort(((t,e)=>{var r,i;return(null!==(r=t.attribute.zIndex)&&void 0!==r?r:Jr.zIndex)-(null!==(i=e.attribute.zIndex)&&void 0!==i?i:Jr.zIndex)})).forEach((t=>{this.renderGroup(t,e)})),this.hooks.completeDraw.tap("top-draw",(()=>{i.restore(),i.restore(),i.draw(),i.inuse=!1,this.rendering=!1})))}))}_increaseRender(t,e){return dc(this,void 0,void 0,(function*(){this.rendering=!0,yield this._renderIncrementalGroup(t,e)}))}_renderIncrementalGroup(t,e){return dc(this,void 0,void 0,(function*(){this.count=t.count,yield new Promise((r=>{this.renderItem(t,e,{drawingCb:()=>dc(this,void 0,void 0,(function*(){if(2!==t.count)yield Qh(t,Jr.zIndex,((r,i)=>{if(this.status===lc.STOP)return!0;if(r.isContainer)return!1;if(i<this.currentIdx)return!1;const n=this.currFrameStartAt+t.incremental;return i<n&&(this.currentIdx=i+1,this.renderItem(r,e)),i===n-1&&(this.currFrameStartAt=this.currentIdx,this.waitToNextFrame())})),r(!1);else{const i=t.getChildAt(0);if(i.incremental&&i.attribute.segments)for(i.incrementalAt||(i.incrementalAt=0);i.incrementalAt<i.attribute.segments.length;)e.multiGraphicOptions={startAtIdx:i.incrementalAt,length:i.incremental},this.renderItem(i,e),i.incrementalAt+=i.incremental,yield this.waitToNextFrame();else this.renderItem(i,e);r(!1)}}))})})),this.hooks.completeDraw.call()}))}waitToNextFrame(){return dc(this,void 0,void 0,(function*(){return new Promise((t=>{this.global.getRequestAnimationFrame()((()=>{t(!1)}))}))}))}checkForDraw(t){return dc(this,void 0,void 0,(function*(){let e=this.rendering;return t.restartIncremental&&(e=!1,yield this.forceStop(),this.resetToInit()),e}))}forceStop(){return dc(this,void 0,void 0,(function*(){this.rendering&&(this.status=lc.STOP,yield new Promise((t=>{this.hooks.completeDraw.tap("stopCb",(()=>{this.status=lc.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 dc(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((r=>{this.renderItem(t,e,{drawingCb:()=>dc(this,void 0,void 0,(function*(){yield Qh(t,Jr.zIndex,(t=>dc(this,void 0,void 0,(function*(){e.break||t.isContainer&&(yield this.renderGroup(t,e))})))),r(!1)}))})})))}))}};pc=hc([L(),uc(0,R(ih)),uc(1,B(sc)),uc(2,B(ac)),uc(3,B(Y)),uc(3,P(dh)),cc("design:paramtypes",[Array,Object,Object,Object])],pc);var fc=new v((t=>{t(nl).toSelf().inSingletonScope(),t(hl).toSelf().inSingletonScope(),t(lh).to(ic),t(rh).to(pc),t(nh).to(eh).inSingletonScope(),t(ih).toService(nh),Z(t,wa),t(ol).toSelf().inSingletonScope(),Z(t,ka),Z(t,ih),t(yh).toSelf().inSingletonScope(),t(dh).toService(yh),Z(t,dh)}));function gc(){gc.__loaded||(gc.__loaded=!0,Ai.load(pa),Ai.load(Ih),Ai.load(kh),Ai.load(Mh),Ai.load(Uh),function(t){t.load($h),t.load(Vh),t.load(qh)}(Ai),function(t){t.load(fc)}(Ai))}gc.__loaded=!1,gc();const mc=Ai.get(et);rt.global=mc;const yc=Ai.get(na);rt.graphicUtil=yc;const vc=Ai.get(ia);rt.transformUtil=vc;const bc=Ai.get(Ao);rt.graphicService=bc;const _c=Ai.get(Sh);rt.renderService=_c;const wc=Ai.get(sa);rt.layerService=wc;class xc{constructor(){this.name="AutoRenderPlugin",this.activeEvent="onRegister",this._uid=y.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;const e=this.pluginService.stage;e&&(e.graphicService.hooks.onAttributeUpdate.tap(this.key,this.handleChange),e.graphicService.hooks.onSetStage.tap(this.key,this.handleChange),e.graphicService.hooks.onRemove.tap(this.key,this.handleChange))}deactivate(t){const e=t=>t.filter((t=>t.name!==this.key)),r=this.pluginService.stage;r&&(r.graphicService.hooks.onAttributeUpdate.taps=e(r.graphicService.hooks.onAttributeUpdate.taps),r.graphicService.hooks.onSetStage.taps=e(r.graphicService.hooks.onSetStage.taps),r.graphicService.hooks.onRemove.taps=e(r.graphicService.hooks.onRemove.taps))}}class Sc{constructor(){this.name="AutoRefreshPlugin",this.activeEvent="onRegister",this._uid=y.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=rt.global.devicePixelRatio,this.refresh()}refresh(){this._refreshByMediaQuery()||this._refreshByRaf()}_refreshByRaf(){const t=rt.global.getRequestAnimationFrame();this.rafId=t((()=>{rt.global.devicePixelRatio!==this.dpr&&(this.dpr=rt.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))},r=matchMedia(t);r&&r.addEventListener("change",e),this.autoRefreshCbs||(this.autoRefreshCbs=[]),this.autoRefreshCbs.push((()=>{r&&r.removeEventListener("change",e)}))}catch(t){return!1}return!0}deactivate(t){var e;const r=rt.global.getCancelAnimationFrame();r&&this.rafId&&r(this.rafId),null===(e=this.autoRefreshCbs)||void 0===e||e.forEach((t=>{t()})),this.autoRefreshCbs=void 0}}class Tc{constructor(){this.name="IncrementalAutoRenderPlugin",this.activeEvent="onRegister",this.nextFrameRenderGroupSet=new Set,this.willNextFrameRender=!1,this.nextUserParams={},this._uid=y.GenAutoIncrementId(),this.key=this.name+this._uid}activate(t){this.pluginService=t;const e=this.pluginService.stage;e&&(e.graphicService.hooks.onAddIncremental.tap(this.key,((e,r,i)=>{e.glyphHost&&(e=e.glyphHost),e.stage===t.stage&&null!=e.stage&&(this.nextUserParams.startAtId=r._uid,this.renderNextFrame(r))})),e.graphicService.hooks.onClearIncremental.tap(this.key,((e,r)=>{e.stage===t.stage&&null!=e.stage&&(this.nextUserParams.startAtId=e._uid,this.nextUserParams.restartIncremental=!0,this.renderNextFrame(e))})))}deactivate(t){const e=this.pluginService.stage;e&&(e.graphicService.hooks.onAddIncremental.taps=e.graphicService.hooks.onAddIncremental.taps.filter((t=>t.name!==this.key)),e.graphicService.hooks.onClearIncremental.taps=e.graphicService.hooks.onClearIncremental.taps.filter((t=>t.name!==this.key)))}renderNextFrame(t){this.nextFrameRenderGroupSet.add(t),this.willNextFrameRender||(this.willNextFrameRender=!0,rt.global.getRequestAnimationFrame()((()=>{this._doRenderInThisFrame(),this.willNextFrameRender=!1})))}_doRenderInThisFrame(){const t=this.pluginService.stage;this.nextFrameRenderGroupSet.size&&(this.nextFrameRenderGroupSet.forEach((e=>{const r=e.layer;if(!r||!e.layer.subLayers)return;const i=e.layer.subLayers.get(e._uid);i&&i.drawContribution&&i.drawContribution.draw(t.renderService,Object.assign({stage:t,layer:r,viewBox:t.window.getViewBox(),transMatrix:t.window.getViewBoxTransform(),clear:"transparent",renderService:t.renderService,updateBounds:!1,startAtId:e._uid,context:i.layer.getNativeHandler().getContext()},this.nextUserParams))})),this.nextUserParams={},this.nextFrameRenderGroupSet.clear())}}const kc=new Le;class Cc{constructor(){this.name="DirtyBoundsPlugin",this.activeEvent="onRegister",this._uid=y.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()}));const e=this.pluginService.stage;e&&(e.graphicService.hooks.beforeUpdateAABBBounds.tap(this.key,((t,e,r,i)=>{t.glyphHost&&(t=t.glyphHost),e&&e===this.pluginService.stage&&e.renderCount&&(t.isContainer&&!t.shouldSelfChangeUpdateAABBBounds()||r&&(kc.setValue(i.x1,i.y1,i.x2,i.y2),e.dirty(kc,t.parent&&t.parent.globalTransMatrix)))})),e.graphicService.hooks.afterUpdateAABBBounds.tap(this.key,((t,e,r,i,n)=>{e&&e===this.pluginService.stage&&e.renderCount&&(t.isContainer&&!n||e.dirty(i.globalAABBBounds))})),e.graphicService.hooks.clearAABBBounds.tap(this.key,((t,e,r)=>{e&&e===this.pluginService.stage&&e.renderCount&&e&&e.dirty(r)})),e.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){const e=this.pluginService.stage;e&&(e.graphicService.hooks.beforeUpdateAABBBounds.taps=e.graphicService.hooks.beforeUpdateAABBBounds.taps.filter((t=>t.name!==this.key)),e.graphicService.hooks.afterUpdateAABBBounds.taps=e.graphicService.hooks.afterUpdateAABBBounds.taps.filter((t=>t.name!==this.key)),e.graphicService.hooks.clearAABBBounds.taps=e.graphicService.hooks.clearAABBBounds.taps.filter((t=>t.name!==this.key)),e.hooks.afterRender.taps=e.hooks.afterRender.taps.filter((t=>t.name!==this.key)),e.graphicService.hooks.onRemove.taps=e.graphicService.hooks.onRemove.taps.filter((t=>t.name!==this.key)))}}let Ec;function Ac(){!function(){if(null==Ec)try{const t=document.createElement("canvas"),e=t.getContext("2d");Ec=!!(window&&t.getBoundingClientRect&&requestAnimationFrame&&window.devicePixelRatio&&e&&e.isPointInPath&&e.isPointInStroke),Ec&&(Ec=!!document.createElement)}catch(t){Ec=!1}}();const t=rt.global&&rt.global.env;return t?"browser"===t:Ec}class Oc{static registerPlugin(t,e){Oc._pluginClasses[t]=e}static getPlugin(t){return Oc._pluginClasses[t]}}Oc._pluginClasses={};const Bc="white";class Rc extends ta{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:Bc}set background(t){this._background=t}get defaultLayer(){return this.at(0)}get eventSystem(){return this._eventSystem}get ticker(){return this._ticker}set ticker(t){t.bindStage(this),this._ticker&&this._ticker.removeListener("tick",this.afterTickCb),t.addTimeline(this.timeline),this._ticker=t,this._ticker.on("tick",this.afterTickCb)}constructor(t={}){var e,r;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.afterClearScreen=t=>{this._afterClearScreen&&this._afterClearScreen(t)},this.afterClearRect=t=>{this._afterClearRect&&this._afterClearRect(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=()=>{this.tickedBeforeRender=!0,"rendering"!==this.state&&this.renderNextFrame()},this.params=t,this.theme=new Tn,this.hooks={beforeRender:new J(["stage"]),afterRender:new J(["stage"]),afterClearScreen:new J(["stage"]),afterClearRect:new J(["stage"])},this.global=rt.global,!this.global.env&&Ac()&&this.global.setEnv("browser"),this.window=Ai.get(cn),this.renderService=Ai.get(Sh),this.pluginService=Ai.get(Fh),this.layerService=Ai.get(sa),this.graphicService=Ai.get(Ao),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:Bc,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.hooks.afterClearScreen.tap("constructor",this.afterClearScreen),this.hooks.afterClearRect.tap("constructor",this.afterClearRect),this._beforeRender=t.beforeRender,this._afterRender=t.afterRender,this._afterClearScreen=t.afterClearScreen,this._afterClearRect=t.afterClearRect,this.supportInteractiveLayer=!1!==t.interactiveLayer,t.optimize||(t.optimize={tickRenderMode:"effect"}),this.optmize(t.optimize),t.background&&Ct(this._background)&&this._background.includes("/")&&this.setAttributes({background:this._background}),this.initAnimate(t),this.rafId=null!==(r=t.rafId)&&void 0!==r?r:Math.floor(6*Math.random())}initAnimate(t){var e;this.createTicker&&this.createTimeline&&(this._ticker=t.ticker||this.createTicker(this),this._ticker.bindStage(this),"performance"===(null===(e=this.params.optimize)||void 0===e?void 0:e.tickRenderMode)&&this._ticker.setFPS(30),this.timeline=this.createTimeline(),this._ticker.addTimeline(this.timeline),this._ticker.on("tick",this.afterTickCb))}startAnimate(){this._ticker&&this.timeline&&(this._ticker.start(),this.timeline.resume())}pauseRender(t=-1){this._skipRender=t}resumeRender(){this._skipRender=0}tryInitEventSystem(){this.global.supportEvent&&!this._eventSystem&&(this._eventSystem=new Fn(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(t=!1){t&&(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:r={},alpha:i=0,beta:n=0,camera:s,fieldRatio:o=1,fieldDepth:a}=t;return Object.assign(Object.assign({},t),{center:e,light:r,alpha:i,beta:n,camera:s,fieldRatio:o,fieldDepth:a})}set3dOptions(t){var e,r,i,n,s,o;this.option3d=t;const a=this.get3dOptions(t),{light:l,center:h,camera:c,alpha:u,beta:d,fieldRatio:p,fieldDepth:f}=a,{dir:g=[1,1,-1],color:m="white",ambient:y}=l,v=(null!==(e=h.x)&&void 0!==e?e:this.width/2)+(null!==(r=h.dx)&&void 0!==r?r:0),b=(null!==(i=h.y)&&void 0!==i?i:this.height/2)+(null!==(n=h.dy)&&void 0!==n?n:0),_=[v,b,(null!==(s=h.z)&&void 0!==s?s:0)+(null!==(o=h.dz)&&void 0!==o?o:0)];let w=0,x=0,S=0;c||(w=Math.sin(u)+v,x=Math.sin(d)+b,S=Math.cos(u)*Math.cos(d)*1);const T=Oc.getPlugin("DirectionalLight");T&&(this.light=new T(g,m,y));const k={left:0,right:this.width,top:0,bottom:this.height,fieldRatio:p,fieldDepth:f,viewParams:{pos:[w,x,S],center:_,up:[0,1,0]}};if(this.camera)this.camera.params=k;else{const t=Oc.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=Oc.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 xc))}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 Sc))}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 Tc))}disableIncrementalAutoRender(){this.increaseAutoRender&&(this.increaseAutoRender=!1,this.pluginService.findPluginsByName("IncrementalAutoRenderPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableDirtyBounds(){if(this.dirtyBounds)return;this.dirtyBounds=new Re;let t=this.pluginService.findPluginsByName("DirtyBoundsPlugin")[0];t?t.activate(this.pluginService):(t=new Cc,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=Oc.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=Oc.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=Oc.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 r=this.layerService.createLayer(this,{main:!1,layerMode:e,canvasId:t});return this.appendChild(r),r}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.startAnimate();const r=this.state;this.state="rendering",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=r,this._skipRender&&this._skipRender++}combineLayersToWindow(){if("harmony"===this.global.env){const t=this.window.getContext().nativeContext;this.forEachChildren(((e,r)=>{if(r>0){const r=e.getNativeHandler().getContext().canvas.nativeCanvas.nativeCanvas._c.transferToImageBitmap();t.transferFromImageBitmap(r)}}))}}renderNextFrame(t,e){this.nextFrameRenderLayerSet.size!==this.childrenCount&&(t||this).forEach((t=>{this.nextFrameRenderLayerSet.add(t)})),this.willNextFrameRender||(this.willNextFrameRender=!0,this.global.getSpecifiedRequestAnimationFrame(this.rafId)((()=>{this._doRenderInThisFrame(),this.willNextFrameRender=!1})))}_doRenderInThisFrame(){if("released"===this.releaseStatus)return;this.startAnimate();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 r=[];for(let e=0;e<t.length;e++){let i=t[e];"virtual"===i.layerMode&&(i=i.getNativeHandler().mainHandler.layer),r.includes(i)||r.push(i)}r.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,r=!0){this.window.resize(t,e),r&&this.render()}resize(t,e,r=!0){"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((r=>{r.resize(t,e)})),this.camera&&this.option3d&&this.set3dOptions(this.option3d),r&&this.render())}resizeView(t,e,r=!0){"released"!==this.releaseStatus&&(this.viewBox.setValue(this.viewBox.x1,this.viewBox.y1,this.viewBox.x1+t,this.viewBox.y1+e),this.forEachChildren((r=>{r.resizeView(t,e)})),this.camera&&(this.camera.params=Object.assign(Object.assign({},this.camera.params),{right:this.width,bottom:this.height})),r&&this.render())}setViewBox(t,e,r,i,n){let s=!0;"object"==typeof t?(this.viewBox.setValue(t.x1,t.y1,t.x2,t.y2),!1===e&&(s=!1)):(this.viewBox.setValue(t,e,t+r,e+i),!1===n&&(s=!1)),this.forEachChildren((t=>{t.resizeView(this.viewBox.width(),this.viewBox.height())})),s&&this.render()}setDpr(t,e=!0){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 r=this.getPickerService().pick(this.children,new fe(t,e),{bounds:this.AABBBounds});return!(!(null==r?void 0:r.graphic)&&!(null==r?void 0:r.group))&&r}setToFrame(t){throw new Error("暂不支持")}release(){var t,e;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(),null===(t=this._ticker)||void 0===t||t.remTimeline(null==this?void 0:this.timeline),null===(e=this._ticker)||void 0===e||e.removeListener("tick",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,r)=>{e.drawTo(t,{renderService:this.renderService,viewBox:t.getViewBox(),transMatrix:t.getViewBoxTransform(),background:e===this.defaultLayer?this.background:void 0,clear:0===r,updateBounds:!(!this.dirtyBounds||this.dirtyBounds.empty())})}))}renderToNewWindow(t=!0,e){if("released"===this.releaseStatus)return;const r=Ai.get(cn),i=e?-e.x1:0,n=e?-e.y1:0,s=e?e.x2:this.viewWidth,o=e?e.y2:this.viewHeight,a=e?e.width():this.viewWidth,l=e?e.height():this.viewHeight;return r.create({viewBox:{x1:i,y1:n,x2:s,y2:o},width:a,height:l,dpr:this.window.dpr,canvasControled:!0,offscreen:!0,title:""}),this.renderTo(r),r}toCanvas(t=!0,e){if("released"===this.releaseStatus)return;const r=this.renderToNewWindow(t,e).getNativeHandler();return r.nativeCanvas?r.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);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=Ai.get(Ch)),this.pickerService}reInit(){this.renderService.reInit(),this.pickerService.reInit()}}function Lc(t,e,r,i){return t=>{if(!(t instanceof MouseEvent||t instanceof TouchEvent||t instanceof PointerEvent))return t;const n=e();if(1===(s=n).a&&0===s.b&&0===s.c&&1===s.d&&0===s.e&&0===s.f)return t;var s;const o=r(),a=new t.constructor(t.type,t);if(Object.defineProperties(a,{target:{value:t.target},currentTarget:{value:t.currentTarget}}),t instanceof MouseEvent||t instanceof PointerEvent)i(t.clientX,t.clientY,n,o,a);else if(t instanceof TouchEvent){if(t.touches.length>0){const t=a.touches[0];i(t.clientX,t.clientY,n,o,t)}if(t.changedTouches.length>0){const t=a.changedTouches[0];i(t.clientX,t.clientY,n,o,t)}}return a}}function Pc(t,e,r,i,n){const s=Lc(0,r,i,n);t.setEventListenerTransformer(s)}function Dc(t,e,r,i,n){const s=Lc(0,r,i,n);t.setEventListenerTransformer(s)}function Mc(t,e,r,i,n){const s={x:t,y:e};r.transformPoint(s,s),Object.defineProperties(n,{_canvasX:{value:s.x},_canvasY:{value:s.y}})}function Ic(t){var e;if(Ii(t._canvasX)&&Ii(t._canvasY))return{x:t._canvasX,y:t._canvasY};if(t.changedTouches){const r=null!==(e=t.changedTouches[0])&&void 0!==e?e:{};return{x:r._canvasX,y:r._canvasY}}return{x:t._canvasX||0,y:t._canvasY||0}}let Nc=!1;const Fc=new v((t=>{Nc||(Nc=!0,t(Hl).toSelf().inSingletonScope(),t(sh).to(Hl).inSingletonScope(),t(ih).toService(sh),t(ml).toSelf(),t(gl).toSelf(),t(xa).toService(ml),t(xa).toService(gl),t(xa).toService(ol),Z(t,xa))}));let jc=!1;const zc=new v((t=>{jc||(jc=!0,t(Vl).toSelf().inSingletonScope(),t(oh).to(Vl).inSingletonScope(),t(ih).toService(oh),t(Sa).toService(ol),Z(t,Sa))}));let Hc=!1;const Wc=new v((t=>{Hc||(Hc=!0,t(ah).to(Kl).inSingletonScope(),t(ih).toService(ah),t(Ta).toService(ol),Z(t,Ta))}));const Uc=["x","y","dx","dy","scaleX","scaleY","angle","anchor","postMatrix","visible","clip","pickable","childrenPickable","zIndex","cursor"];class $c extends ta{constructor(t,e){super(t),this._skipRenderAttributes=Uc,(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,r,i){const n=this.onBeforeAttributeUpdate&&this.onBeforeAttributeUpdate({[t]:e},this.attribute,t,i);if(n)return this._setAttributes(n,r);Tt(this.attribute[t])&&Tt(e)&&!bt(this.attribute[t])&&!bt(e)?Ut(this.attribute[t],e):this.attribute[t]=e,this._skipRenderAttributes.includes(t)||this.render(),this.valid=this.isValid(),this.updateShapeAndBoundsTagSetted()||!r&&!this.needUpdateTag(t)?this.addUpdateBoundTag():this.addUpdateShapeAndBoundsTag(),this.addUpdatePositionTag(),this.onAttributeUpdate()}setAttributes(t,e,r){return t=this.onBeforeAttributeUpdate&&this.onBeforeAttributeUpdate(t,this.attribute,null,r)||t,this._setAttributes(t,e)}_setAttributes(t,e){const r=Object.keys(t);this._mergeAttributes(t,r),r.every((t=>this._skipRenderAttributes.includes(t)))||this.render(),this.valid=this.isValid(),this.updateShapeAndBoundsTagSetted()||!e&&!this.needUpdateTags(r)?this.addUpdateBoundTag():this.addUpdateShapeAndBoundsTag(),this.addUpdatePositionTag(),this.onAttributeUpdate()}_mergeAttributes(t,e){_t(e)&&(e=Object.keys(t));for(let r=0;r<e.length;r++){const i=e[r];!Tt(this.attribute[i])||bt(this.attribute[i])||bt(t[i])?this.attribute[i]=t[i]:Ut(this.attribute[i],t[i])}}bindEvents(){}_getNodeId(t){var e;return`${null!==(e=this.id)&&void 0!==e?e:this._uid}-${this.name}-${t}`}_dispatchEvent(t,e){var r;const i=new Pn(t,e);i.manager=null===(r=this.stage)||void 0===r?void 0:r.eventSystem.manager,this.dispatchEvent(i)}eventPosToStagePos(t){var e,r;const i={x:0,y:0},n=null!==(r=null===(e=this.stage)||void 0===e?void 0:e.eventPointTransform(t))&&void 0!==r?r:{x:0,y:0};return this.globalTransMatrix.transformPoint(n,i),i}}const Vc=Symbol.for("MathPickerContribution"),Gc=Symbol.for("MathRectPicker"),Xc=Symbol.for("MathSymbolPicker"),Yc=Symbol.for("MathTextPicker"),qc=Symbol.for("CanvasRectPicker"),Zc=Symbol.for("CanvasSymbolPicker"),Kc=Symbol.for("CanvasTextPicker"),Qc=Symbol.for("CanvasPickerContribution");class Jc{contains(t,e,r){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;if(!this.canvasRenderer)return!0;const{pickContext:i}=null!=r?r:{};if(!i)return!1;const n=t.getGraphicTheme();i.highPerformanceSave();let{x:s=n.x,y:o=n.y}=t.attribute;if(t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(n);s+=e.x,o+=e.y,i.setTransformForCurrent()}else s=0,o=0,i.transformFromMatrix(t.transMatrix,!0);let a=!1,l=!1;return this.canvasRenderer.drawShape(t,i,s,o,{},null,((t,r,i,n)=>!(!a&&!l)||(a=t.isPointInPath(e.x,e.y),l=n||l,a)),((t,r,n,s)=>{if(a||l)return!0;const o=r.lineWidth||n.lineWidth,h=r.pickStrokeBuffer||n.pickStrokeBuffer,c=r.keepStrokeScale||n.keepStrokeScale;return i.lineWidth=c?o+h:yi(i,o+h,i.dpr),a=t.isPointInStroke(e.x,e.y),l=s||l,a})),i.highPerformanceRestore(),a}}const tu=new Le;class eu{constructor(){this.type="rect",this.numberType=ko}contains(t,e,r){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:i}=null!=r?r:{};if(!i)return!1;const n=t.getGraphicTheme(),{cornerRadius:s=n.cornerRadius}=t.attribute;let{x:o=n.x,y:a=n.y}=t.attribute;i.highPerformanceSave();let l=!0;if(t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(n);o+=e.x,a+=e.y,i.setTransformForCurrent()}else o=0,a=0,l=!1,i.transformFromMatrix(t.transMatrix,!0);let h=!0;if(!l||t.shadowRoot||Ot(s,!0)&&0!==s||Et(s)&&s.some((t=>0!==t)))h=!1,this.canvasRenderer.drawShape(t,i,o,a,{},null,((t,r,i)=>!!h||(h=t.isPointInPath(e.x,e.y),h)),((t,r,n)=>{if(h)return!0;const s=r.lineWidth||n.lineWidth,o=r.pickStrokeBuffer||n.pickStrokeBuffer,a=r.keepStrokeScale||n.keepStrokeScale;return i.lineWidth=a?s+o:yi(i,s+o,i.dpr),h=t.isPointInStroke(e.x,e.y),h}));else{const{fill:r=n.fill,stroke:i=n.stroke,lineWidth:s=n.lineWidth}=t.attribute;if(r)h=!0;else if(i){const r=t.AABBBounds;tu.setValue(r.x1,r.y1,r.x2,r.y2),tu.expand(-s/2),h=!tu.containsPoint(e)}}return i.highPerformanceRestore(),h}}var ru=function(t,e,r,i){var n,s=arguments.length,o=s<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,e,r,i);else for(var a=t.length-1;a>=0;a--)(n=t[a])&&(o=(s<3?n(o):s>3?n(e,r,o):n(e,r))||o);return s>3&&o&&Object.defineProperty(e,r,o),o},iu=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},nu=function(t,e){return function(r,i){e(r,i,t)}};let su=class extends eu{constructor(t){super(),this.canvasRenderer=t}};su=ru([L(),nu(0,B(sh)),iu("design:paramtypes",[Object])],su);let ou=!1;const au=new v(((t,e,r,i)=>{ou||(ou=!0,t(Gc).to(su).inSingletonScope(),t(Vc).toService(Gc))}));var lu=function(t,e,r,i){var n,s=arguments.length,o=s<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,e,r,i);else for(var a=t.length-1;a>=0;a--)(n=t[a])&&(o=(s<3?n(o):s>3?n(e,r,o):n(e,r))||o);return s>3&&o&&Object.defineProperty(e,r,o),o},hu=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},cu=function(t,e){return function(r,i){e(r,i,t)}};let uu=class extends Jc{constructor(t){super(),this.canvasRenderer=t,this.type="symbol",this.numberType=Co}};uu=lu([L(),cu(0,B(oh)),hu("design:paramtypes",[Object])],uu);let du=!1;const pu=new v(((t,e,r,i)=>{du||(du=!0,t(Xc).to(uu).inSingletonScope(),t(Vc).toService(Xc))}));var fu=function(t,e,r,i){var n,s=arguments.length,o=s<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,e,r,i);else for(var a=t.length-1;a>=0;a--)(n=t[a])&&(o=(s<3?n(o):s>3?n(e,r,o):n(e,r))||o);return s>3&&o&&Object.defineProperty(e,r,o),o};let gu=class{constructor(){this.type="text",this.numberType=Eo}contains(t,e,r){return!!t.AABBBounds.containsPoint(e)}};gu=fu([L()],gu);let mu=!1;const yu=new v(((t,e,r,i)=>{mu||(mu=!0,t(Yc).to(gu).inSingletonScope(),t(Vc).toService(Yc))}));var vu=function(t,e,r,i){var n,s=arguments.length,o=s<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,e,r,i);else for(var a=t.length-1;a>=0;a--)(n=t[a])&&(o=(s<3?n(o):s>3?n(e,r,o):n(e,r))||o);return s>3&&o&&Object.defineProperty(e,r,o),o},bu=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},_u=function(t,e){return function(r,i){e(r,i,t)}};let wu=class extends eu{constructor(t){super(),this.canvasRenderer=t}};wu=vu([L(),_u(0,B(sh)),bu("design:paramtypes",[Object])],wu);let xu=!1;const Su=new v(((t,e,r,i)=>{xu||(xu=!0,t(qc).to(wu).inSingletonScope(),t(Qc).toService(qc))}));class Tu extends kl{contains(t,e,r){const{pickContext:i}=null!=r?r:{};if(!i)return!1;const n=t.getGraphicTheme();i.highPerformanceSave();const s=this.transform(t,n,i),{x:o,y:a,z:l,lastModelMatrix:h}=s;let c=e;if(i.camera){c=e.clone();const r=t.parent.globalTransMatrix;c.x=r.a*e.x+r.c*e.y+r.e,c.y=r.b*e.x+r.d*e.y+r.f}this.canvasRenderer.z=l;let u=!1;return this.canvasRenderer.drawShape(t,i,o,a,r,null,((t,e,r)=>!!u||(u=t.isPointInPath(c.x,c.y),u))),this.canvasRenderer.z=0,i.modelMatrix!==h&&Fo.free(i.modelMatrix),i.modelMatrix=h,i.highPerformanceRestore(),u}}var ku=function(t,e,r,i){var n,s=arguments.length,o=s<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,e,r,i);else for(var a=t.length-1;a>=0;a--)(n=t[a])&&(o=(s<3?n(o):s>3?n(e,r,o):n(e,r))||o);return s>3&&o&&Object.defineProperty(e,r,o),o},Cu=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Eu=function(t,e){return function(r,i){e(r,i,t)}};let Au=class extends Tu{constructor(t){super(),this.canvasRenderer=t,this.type="symbol",this.numberType=Co}contains(t,e,r){const{pickContext:i}=null!=r?r:{};if(!i)return!1;const n=t.getParsedPath();if(!i.camera){if(!t.AABBBounds.containsPoint(e))return!1;if(n.isSvg||"imprecise"===t.attribute.pickMode)return!0}i.highPerformanceSave();const s=t.getGraphicTheme(),o=this.transform(t,s,i),{x:a,y:l,z:h,lastModelMatrix:c}=o;let u=e;if(i.camera){u=e.clone();const r=t.parent.globalTransMatrix;u.x=r.a*e.x+r.c*e.y+r.e,u.y=r.b*e.x+r.d*e.y+r.f}this.canvasRenderer.z=h;let d=!1;return this.canvasRenderer.drawShape(t,i,a,l,{},null,((t,e,r)=>!!d||(d=t.isPointInPath(u.x,u.y),d)),((t,e,r)=>{if(d)return!0;const n=e.lineWidth||r.lineWidth,s=e.pickStrokeBuffer||r.pickStrokeBuffer,o=e.keepStrokeScale||r.keepStrokeScale;return i.lineWidth=o?n+s:yi(i,n+s,i.dpr),d=t.isPointInStroke(u.x,u.y),d})),this.canvasRenderer.z=0,i.modelMatrix!==c&&Fo.free(i.modelMatrix),i.modelMatrix=c,i.highPerformanceRestore(),d}};Au=ku([L(),Eu(0,B(oh)),Cu("design:paramtypes",[Object])],Au);let Ou=!1;const Bu=new v(((t,e,r,i)=>{Ou||(Ou=!0,t(Zc).to(Au).inSingletonScope(),t(Qc).toService(Zc))}));var Ru=function(t,e,r,i){var n,s=arguments.length,o=s<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,e,r,i);else for(var a=t.length-1;a>=0;a--)(n=t[a])&&(o=(s<3?n(o):s>3?n(e,r,o):n(e,r))||o);return s>3&&o&&Object.defineProperty(e,r,o),o},Lu=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Pu=function(t,e){return function(r,i){e(r,i,t)}};let Du=class extends Tu{constructor(t){super(),this.canvasRenderer=t,this.type="text",this.numberType=Eo}contains(t,e,r){const{pickContext:i}=null!=r?r:{};if(!i)return!1;const n=t.AABBBounds;if(!i.camera)return!!n.containsPoint(e);i.highPerformanceSave();const s=t.getGraphicTheme(),{keepDirIn3d:o=s.keepDirIn3d}=t.attribute,a=!o,l=this.transform(t,s,i,a),{x:h,y:c,z:u,lastModelMatrix:d}=l;this.canvasRenderer.z=u;let p=e;if(i.camera){p=e.clone();const r=t.parent.globalTransMatrix;p.x=r.a*e.x+r.c*e.y+r.e,p.y=r.b*e.x+r.d*e.y+r.f}let f=!1;return this.canvasRenderer.drawShape(t,i,h,c,{},null,((e,r,i)=>{if(f)return!0;const{fontSize:n=s.fontSize,textBaseline:o=s.textBaseline,textAlign:a=s.textAlign}=t.attribute,l=t.AABBBounds,d=l.height(),g=l.width(),m=Ea(o,d,n),y=Ca(a,g);return e.rect(y+h,m+c,g,d,u),f=e.isPointInPath(p.x,p.y),f}),((t,e,r)=>f)),this.canvasRenderer.z=0,i.modelMatrix!==d&&Fo.free(i.modelMatrix),i.modelMatrix=d,i.highPerformanceRestore(),f}};Du=Ru([L(),Pu(0,B(ah)),Lu("design:paramtypes",[Object])],Du);let Mu=!1;const Iu=new v(((t,e,r,i)=>{Mu||(Mu=!0,t(Kc).to(Du).inSingletonScope(),t(Qc).toService(Kc))})),Nu=Ac();function Fu(){Fu.__loaded||(Fu.__loaded=!0,Ja.RegisterGraphicCreator("group",ea))}Fu.__loaded=!1;const ju=Fu;function zu(){zu.__loaded||(zu.__loaded=!0,Ja.RegisterGraphicCreator("rect",Ya),Ai.load(Fc),Ai.load(Nu?Su:au))}zu.__loaded=!1;const Hu=zu;function Wu(){Wu.__loaded||(Wu.__loaded=!0,Ja.RegisterGraphicCreator("symbol",Wa),Ai.load(zc),Ai.load(Nu?Bu:pu))}Wu.__loaded=!1;const Uu=Wu;function $u(){$u.__loaded||($u.__loaded=!0,Ja.RegisterGraphicCreator("text",ja),Ai.load(Wc),Ai.load(Nu?Iu:yu))}$u.__loaded=!1;const Vu=$u;var Gu;!function(t){t.selected="selected",t.selectedReverse="selected_reverse",t.hover="hover",t.hoverReverse="hover_reverse"}(Gu||(Gu={})),Gu.selectedReverse,Gu.selected,Gu.hover,Gu.hoverReverse;function Xu(){return"browser"===mc.env?["pointerup","pointerleave","pointercancel"]:["pointerup","pointerleave","pointerupoutside"]}const Yu={debounce:Jt,throttle:function(t,e,r){let i=!0,n=!0;if("function"!=typeof t)throw new TypeError("Expected a function");return xt(r)&&(i="leading"in r?!!r.leading:i,n="trailing"in r?!!r.trailing:n),Jt(t,e,{leading:i,trailing:n,maxWait:e})}};ju(),Hu();class qu extends $c{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:Ut({},qu.defaultAttributes,t)),this.name="scrollbar",this._handleTouchMove=t=>{wt(this._prePos)&&t.preventDefault()},this._onRailPointerDown=t=>{const{viewX:e,viewY:r}=t,{direction:i,width:n,height:s,range:o}=this.attribute,a=this._sliderSize,[l,h]=this._getScrollRange();let c;if("vertical"===i){const t=r-this._viewPosition.y,e=Zt(t-a/2,l,h);c=t/s,this._slider.setAttribute("y",e,!0)}else{const t=e-this._viewPosition.x,r=Zt(t-a/2,l,h);c=t/n,this._slider.setAttribute("x",r,!0)}this.setScrollRange([c-(o[1]-o[0])/2,c+(o[1]-o[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:r}=this.attribute,{x:i,y:n}=this.stage.eventPointTransform(t);this._prePos="horizontal"===r?i:n,this._dispatchEvent("scrollDown",{pos:this._prePos,event:t});const s=Xu(),o="browser"===mc.env?mc:this.stage;o.addEventListener("pointermove",this._onSliderPointerMoveWithDelay,{capture:!0}),s.forEach((t=>{o.addEventListener(t,this._onSliderPointerUp)}))},this._computeScrollValue=t=>{const{direction:e}=this.attribute,{x:r,y:i}=this.stage.eventPointTransform(t);let n,s,o=0;const{width:a,height:l}=this.getSliderRenderBounds();return"vertical"===e?(s=i,o=s-this._prePos,n=o/l):(s=r,o=s-this._prePos,n=o/a),[s,n]},this._onSliderPointerMove=t=>{const{stopSliderMovePropagation:e=!0}=this.attribute;e&&t.stopPropagation();const r=this.getScrollRange(),[i,n]=this._computeScrollValue(t);this.setScrollRange([r[0]+n,r[1]+n],!0),this._prePos=i},this._onSliderPointerMoveWithDelay=0===this.attribute.delayTime?this._onSliderPointerMove:Yu[this.attribute.delayType](this._onSliderPointerMove,this.attribute.delayTime),this._onSliderPointerUp=t=>{const{range:e,limitRange:r=[0,1]}=this.attribute,i=this.getScrollRange(),[n,s]=this._computeScrollValue(t),o=[i[0]+s,i[1]+s];this._prePos=null,this._dispatchEvent("scrollUp",{pre:e,value:Kt(o,r[0],r[1])}),this._clearDragEvents()}}setScrollRange(t,e=!0){const{direction:r="horizontal",limitRange:i=[0,1],range:n,realTime:s=!0}=this.attribute,o=Kt(t,i[0],i[1]);if(e){const t=this._getSliderPos(o);if(this._slider){const e=t[1]-t[0];this._sliderSize=e,"horizontal"===r?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=o,s&&this._dispatchEvent("scrollDrag",{pre:n,value:o})}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",Yu[t](this._onRailPointerDown,e)),this._slider&&this._slider.addEventListener("pointerdown",this._onSliderPointerDown),("browser"===mc.env?mc:this.stage).addEventListener("touchmove",this._handleTouchMove,{passive:!1})}render(){this._reset();const{direction:t="horizontal",width:e,height:r,range:i,limitRange:n=[0,1],railStyle:s,sliderStyle:o,padding:a=2}=this.attribute,l=this.createOrUpdateChild("scrollbar-container",{},"group"),h=l.createOrUpdateChild("scrollbar-rail",Object.assign({x:0,y:0,width:e,height:r},s),"rect");this._rail=h;const c=this.getSliderRenderBounds(),u=this._getSliderPos(Kt(i,n[0],n[1])),d=u[1]-u[0];let p;this._sliderSize=d,p="horizontal"===t?{x:u[0],y:c.y1,width:d,height:c.height}:{x:c.x1,y:u[0],width:c.width,height:d};const f=l.createOrUpdateChild("slider",Object.assign(Object.assign(Object.assign(Object.assign({},p),{cornerRadius:this._getDefaultSliderCornerRadius()}),o),{boundsPadding:Me(a),pickMode:"imprecise"}),"rect");this._slider=f,this._container=l;const g=this._container.AABBBounds;this._viewPosition={x:g.x1,y:g.y1}}getSliderRenderBounds(){if(this._sliderRenderBounds)return this._sliderRenderBounds;const{width:t,height:e,padding:r=2}=this.attribute,[i,n,s,o]=Me(r),a={x1:o,y1:i,x2:t-n,y2:e-s,width:Math.max(0,t-(o+n)),height:Math.max(0,e-(i+s))};return this._sliderRenderBounds=a,a}_getDefaultSliderCornerRadius(){const{direction:t,round:e}=this.attribute;if(e){const{width:e,height:r}=this.getSliderRenderBounds();return"horizontal"===t?r:e}return 0}_getSliderPos(t){const{direction:e}=this.attribute,{width:r,height:i,x1:n,y1:s}=this.getSliderRenderBounds();return"horizontal"===e?[r*t[0]+n,r*t[1]+n]:[i*t[0]+s,i*t[1]+s]}_getScrollRange(){if(this._sliderLimitRange)return this._sliderLimitRange;const{limitRange:t=[0,1],direction:e}=this.attribute,[r,i]=Kt(t,0,1),{width:n,height:s,x1:o,y1:a}=this.getSliderRenderBounds(),l=this._sliderSize;return"horizontal"===e?Kt([o+r*n,o+i*n],o,n-l):Kt([a+r*s,a+i*s],a,s-l)}_clearDragEvents(){const t=Xu(),e="browser"===mc.env?mc: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"===mc.env?mc:this.stage).addEventListener("touchmove",this._handleTouchMove,{passive:!1}),this._clearDragEvents()}}qu.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 Zu=function(t,e){var r={};for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&e.indexOf(i)<0&&(r[i]=t[i]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(i=Object.getOwnPropertySymbols(t);n<i.length;n++)e.indexOf(i[n])<0&&Object.prototype.propertyIsEnumerable.call(t,i[n])&&(r[i[n]]=t[i[n]])}return r};const Ku=new Le;ju(),Vu(),Uu(),Hu();const Qu="M -0.5 -0.5, L -0.5 0.5, L 0.5 -0.5, Z",Ju="M -0.5 -0.5, L -0.5 0.5, L 0.5 0.5, Z",td="M -0.5 -0.5, L 0.5 -0.5, L 0.5 0.5, Z",ed="M 0.5 -0.5, L 0.5 0.5, L -0.5 0.5, Z",rd={tl:Qu,tr:td,bl:Ju,br:ed,lt:Qu,lb:Ju,rt:td,rb:ed};class id extends $c{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:Ut({},id.defaultAttributes,t)),this.name="poptip",this.positionList=["top","tl","tr","bottom","bl","br","left","lt","lb","right","rt","rb"]}render(){var t,e,r,i,n,s,o,a,l;const{titleStyle:h={},position:c,contentStyle:u={},panel:d,logoSymbol:p,poptipAnchor:f="position",logoText:g,logoTextStyle:m={},triangleMode:y="default",space:v=4,minWidth:b=0,maxWidth:_=1/0,padding:w=4,maxWidthPercent:x,visible:S,state:T,dx:k=0,dy:C=0,positionBounds:E}=this.attribute;let{title:A="",content:O=""}=this.attribute;A=this.attribute.titleFormatMethod?this.attribute.titleFormatMethod(A):A,O=this.attribute.contentFormatMethod?this.attribute.contentFormatMethod(O):O;const B=Me(w),R=this.createOrUpdateChild("poptip-content",{x:0,y:0,zIndex:1},"group");this.group=R;const L=_-B[1]-B[3],P=wt(A)&&!1!==S,D=Object.assign(Object.assign({text:Et(A)?A:[A],visible:P,wrap:!0},h),{x:B[3],y:B[0],maxLineWidth:L,textAlign:"left",textBaseline:"top"}),M=R.createOrUpdateChild("poptip-title",D,"text");Nt(null==T?void 0:T.title)||(M.states=T.title);const I=M.AABBBounds,N=I.height(),F=I.width();let j=N+v;P||(j=0);const z=wt(O)&&!1!==S,H=Object.assign(Object.assign({text:Et(O)?O:[O],visible:z,wrap:!0},u),{x:B[3],y:B[0]+j,maxLineWidth:L,textAlign:"left",textBaseline:"top"}),W=R.createOrUpdateChild("poptip-content",H,"text");Nt(null==T?void 0:T.content)||(W.states=T.content);const U=W.AABBBounds,$=U.height(),V=U.width();z&&(j+=$),this.titleShape=M,this.contentShape=W;let G=le(F+B[1]+B[3],V+B[1]+B[3]);G>_?G=_:G<b&&(G=b);let X=B[0]+B[2]+j;const{visible:Y,square:q}=d,Z=Zu(d,["visible","square"]);if(q){const t=le(G,X);G=t;const e=t-X;X=t,M.setAttributes({dy:e/2}),W.setAttributes({dy:e/2})}const K=null!==(t=Z.size)&&void 0!==t?t:12,Q=Et(K)?[K[0]+(null!==(e=Z.space)&&void 0!==e?e:0),K[1]+(null!==(r=Z.space)&&void 0!==r?r:0)]:K+(null!==(i=Z.space)&&void 0!==i?i:0),J=null!==(n=Z.lineWidth)&&void 0!==n?n:1,tt=this.stage?[null!==(s=this.stage.viewWidth)&&void 0!==s?s:this.stage.width,null!==(o=this.stage.viewHeight)&&void 0!==o?o:this.stage.height]:void 0;if(tt){const t=this.AABBBounds,e=null!==(a=this.attribute.x)&&void 0!==a?a:t.x1,r=tt[0]-t.x1;let i=Math.max(e,r);const n=(Et(K)?K[0]:12)+3;if(i=Math.min(i-n,i*x),i<G){G=i;const t=B[1]+B[3];M.setAttribute("maxLineWidth",i-t),W.setAttribute("maxLineWidth",i-t),X=B[0]+B[2],P&&(X+=M.AABBBounds.height()+v),X+=W.AABBBounds.height()}}const et="auto"===c||Et(c),rt=Et(c)?c:this.positionList;let it,nt=-1/0;for(let t=0;t<rt.length+1;t++){const e=et?rt[t===rt.length?it:t]:c;let r="arrow2Left",i=(Et(K)?K[0]:K)/4,n=0;"top"===e||"bottom"===e||"left"===e||"right"===e?r="arrow2Left":"concise"===y&&(r=rd[e],i=["tl","bl","rt","rb"].includes(e)?(Et(K)?K[0]:K)/2:-(Et(K)?K[0]:K)/2,n=["tl","tr","lb","rb"].includes(e)?-(Et(K)?K[1]:K)/2:(Et(K)?K[1]:K)/2);const{angle:s,offset:o}=this.getAngleAndOffset(e,G,X,Et(Q)?Q:[Q,Q-J],r);let a,h={x:0,y:0};if("bounds"===f&&E&&(h=this.calculateAnchorPoint(e,E)),vt(Y)){let t;a=R.createOrUpdateChild("poptip-symbol-panel",Object.assign(Object.assign({},Z),{visible:Y&&(z||P),x:i,y:n,strokeBoundsBuffer:-1,boundsPadding:-2,anchor:[0,0],symbolType:r,angle:s,dx:o[0],dy:o[1]-(null!==(l=Z.space)&&void 0!==l?l:0),size:K,zIndex:9}),"symbol"),Nt(null==T?void 0:T.panel)||(a.states=T.panel),t=d.panelSymbolType?R.createOrUpdateChild("poptip-rect-panel",Object.assign(Object.assign({},Z),{visible:Y&&(z||P),x:0,y:0,symbolType:"rect",size:[G,X],zIndex:-8}),"symbol"):R.createOrUpdateChild("poptip-rect-panel",Object.assign(Object.assign({},Z),{visible:Y&&(z||P),x:0,y:0,width:G,height:X,zIndex:-8}),"rect"),Nt(null==T?void 0:T.panel)||(t.states=T.panel)}if(R.setAttributes({x:-o[0]+k+h.x,y:-o[1]+C+h.y,anchor:[i,n]}),p){const{size:t=12}=p,e=Et(t)?t:[t,t];"auto"===e[1]&&(e[1]=X),"auto"===e[0]&&(e[0]=X);const r=e[0];R.createOrUpdateChild("poptip-logo",Object.assign(Object.assign({},p),{x:0,y:X/2,visible:Y&&(z||P),zIndex:10,size:e}),"symbol"),R.setAttributes({x:-o[0]+k+r/2,y:-o[1]+C}),g&&R.createOrUpdateChild("poptip-logo-text",Object.assign(Object.assign({},m),{x:0,y:X/2,visible:Y&&(z||P),text:g,textAlign:"center",textBaseline:"middle",zIndex:10}),"text")}if(!tt)break;{Ku.setValue(0,0,G,X).transformWithMatrix(R.globalTransMatrix);const r=Ku,i=(new Re).setValue(0,0,tt[0],tt[1]);if(et){if(_e(r,i,!1))break;{const e=ye(r,i,!1),n=(e.x2-e.x1)*(e.y2-e.y1);n>nt&&(nt=n,it=t)}}if(["top","bottom","left","right"].includes(e)){const t="top"===e||"bottom"===e,n="left"===e||"right"===e;let s=!1;if(t?s="top"===e&&r.y1<0||"bottom"===e&&r.y2>i.y2:n&&(s="left"===e&&r.x1<0||"right"===e&&r.x2>i.x2),!s){let e=0;const s=(Et(K)?K[1]:K)/2;t?(r.x1<0?e=-r.x1:r.x2>i.x2&&(e=i.x2-r.x2),R.setAttribute("x",R.attribute.x+e),a.setAttribute("dx",he(le(a.attribute.dx-e,s),r.width()-s))):n&&(r.y1<0?e=-r.y1:r.y2>i.y2&&(e=i.y2-r.y2),R.setAttribute("y",R.attribute.y+e),a.setAttribute("dy",he(le(a.attribute.dy-e,s),r.height()-s)));break}}if(!et)break}}}calculateAnchorPoint(t,e){if(!e)return{x:0,y:0};const{x:r,y:i}=this.attribute,{x1:n,y1:s,x2:o,y2:a}=e,l=o-n,h=a-s;switch(t){case"top":case"tl":case"tr":return{x:n+l/2-r,y:s-i};case"bottom":case"bl":case"br":return{x:n+l/2-r,y:a-i};case"left":case"lt":case"lb":return{x:n-r,y:s+h/2-i};case"right":case"rt":case"rb":return{x:o-r,y:s+h/2-i};default:return{x:0,y:0}}}getAngleAndOffset(t,e,r,i,n){const s="arrow2Left"===n?i[1]/2:i[1];switch(t){case"tl":return{angle:"arrow2Left"===n?ee/2*3:0,offset:"arrow2Left"===n?[e/4,r+s]:[0,r+s]};case"top":return{angle:ee/2*3,offset:[e/2,r+s]};case"tr":return{angle:"arrow2Left"===n?ee/2*3:0,offset:"arrow2Left"===n?[e/4*3,r+s]:[e,r+s]};case"rt":return{angle:0,offset:"arrow2Left"===n?[-s,r/5]:[-s,0]};case"right":return{angle:0,offset:[-s,r/2]};case"rb":return{angle:0,offset:"arrow2Left"===n?[-s,r/5*4]:[-s,r]};case"bl":return{angle:"arrow2Left"===n?ee/2:0,offset:"arrow2Left"===n?[e/4,-s]:[0,-s]};case"bottom":return{angle:ee/2,offset:[e/2,-s]};case"br":return{angle:"arrow2Left"===n?ee/2:0,offset:"arrow2Left"===n?[e/4*3,-s]:[e,-s]};case"lt":return{angle:"arrow2Left"===n?ee:0,offset:"arrow2Left"===n?[e+s,r/5]:[e+s,0]};case"left":return{angle:ee,offset:[e+s,r/2]};case"lb":return{angle:"arrow2Left"===n?ee:0,offset:"arrow2Left"===n?[e+s,r/5*4]:[e+s,r]}}}}function nd(t,e){var r,i,n,s,o,a,l,h;return!t&&!e||!(!t||!e)&&(null===(r=t.start)||void 0===r?void 0:r.col)===(null===(i=e.start)||void 0===i?void 0:i.col)&&(null===(n=t.start)||void 0===n?void 0:n.row)===(null===(s=e.start)||void 0===s?void 0:s.row)&&(null===(o=t.end)||void 0===o?void 0:o.col)===(null===(a=e.end)||void 0===a?void 0:a.col)&&(null===(l=t.end)||void 0===l?void 0:l.row)===(null===(h=e.end)||void 0===h?void 0:h.row)}id.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 sd=(t,e)=>Object.prototype.toString.call(t)===`[object ${e}]`;var od=(t,e=!1)=>e?"boolean"==typeof t:!0===t||!1===t||sd(t,"Boolean");var ad=t=>"function"==typeof t;var ld=t=>null!=t;var hd=(t,e=!1)=>{const r=typeof t;return e?"string"===r:"string"===r||sd(t,"String")};var cd=t=>Array.isArray?Array.isArray(t):sd(t,"Array");var ud=t=>sd(t,"Date");var dd=(t,e=!1)=>{const r=typeof t;return e?"number"===r:"number"===r||sd(t,"Number")};function pd(t,e,r){let i;if(!ld(t)||"object"!=typeof t||e&&e(t))return t;const n=cd(t),s=t.length;i=n?new Array(s):"object"==typeof t?{}:od(t)||dd(t)||hd(t)?t:ud(t)?new Date(+t):void 0;const o=n?void 0:Object.keys(Object(t));let a=-1;if(i)for(;++a<(o||t).length;){const n=o?o[a]:a,s=t[n];r&&r.includes(n.toString())?i[n]=s:i[n]=pd(s,e,r)}return i}const fd="undefined"==typeof window||void 0===window.window;function gd(t,e,r){return t.start.col<=e&&e<=t.end.col&&t.start.row<=r&&r<=t.end.row||t.end.col<=e&&e<=t.start.col&&t.end.row<=r&&r<=t.start.row||t.end.col<=e&&e<=t.start.col&&t.start.row<=r&&r<=t.end.row||t.start.col<=e&&e<=t.end.col&&t.end.row<=r&&r<=t.start.row}!function(){if(fd)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 md(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 yd(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 vd(t){return Math.floor(t)===t}function bd(t){this.rotateDegree=90;const e=t.clientWidth<t.clientHeight?Math.max(t.clientWidth,t.clientHeight)/2:Math.min(t.clientWidth,t.clientHeight)/2,r=this.getElement().getBoundingClientRect(),i=r.left,n=r.top,s=r.right,o=r.bottom;t.style.transform="rotate(90deg)",t.style.transformOrigin=`${e}px ${e}px`;const a=()=>({x1:i,y1:n,x2:s,y2:o}),l=()=>{const r=("undefined"!=typeof window?{width:window.innerWidth||document.documentElement.clientWidth,height:window.innerHeight||document.documentElement.clientHeight}:mc&&mc.getViewportSize?mc.getViewportSize():t.getBoundingClientRect()).width,i=this.getElement().getBoundingClientRect(),n=i.top,s=r-i.right,o=No.allocate(1,0,0,1,0,0);o.translate(n,s);const a=e-n,l=e-s;o.translate(a,l),o.rotate(Math.PI/2),o.translate(-a,-l);const h=this.pluginManager.getPluginByName("Rotate Table");return h&&(h.matrix=o),o};Dc(mc,this.getElement(),l,a,Mc),Pc(this.scenegraph.stage.window,this.getElement(),l,a,Mc);const h=this.pluginManager.getPluginByName("Rotate Table");h&&(h.vglobal_mapToCanvasPoint=mc.mapToCanvasPoint),mc.mapToCanvasPoint=Ic}function _d(t){this.rotateDegree=0,t.style.transform="none",t.style.transformOrigin="none";const e=this.getElement().getBoundingClientRect(),r=e.left,i=e.top,n=e.right,s=e.bottom,o=()=>({x1:r,y1:i,x2:n,y2:s}),a=()=>{const t=No.allocate(1,0,0,1,0,0);return t.translate(r,i),t};Dc(mc,this.getElement(),a,o,Mc),Pc(this.scenegraph.stage.window,this.getElement(),a,o,Mc);const l=this.pluginManager.getPluginByName("Rotate Table");l&&(mc.mapToCanvasPoint=l.vglobal_mapToCanvasPoint)}var wd,xd,Sd,Td;!function(t){t.default="default",t.grabing="grabing",t.scrolling="scrolling"}(wd||(wd={})),function(t){t.FinishToStart="finish_to_start",t.StartToStart="start_to_start",t.FinishToFinish="finish_to_finish",t.StartToFinish="start_to_finish"}(xd||(xd={})),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"}(Sd||(Sd={})),function(t){t.TASK="task",t.PROJECT="project",t.MILESTONE="milestone"}(Td||(Td={}));const kd={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",MOVE_END_TASK_BAR:"move_end_task_bar"};function Cd(t,e){let r=null;return function(...i){r||(t.apply(this,i),r=setTimeout((()=>{r=null}),e))}}function Ed(t,e){const r=t.getFullYear().toString(),i=(t.getMonth()+1).toString().padStart(2,"0"),n=t.getDate().toString().padStart(2,"0");if((e=(e=(e=e.replace("yyyy",r)).replace("mm",i)).replace("dd",n)).length>10){const r=t.getHours().toString().padStart(2,"0"),i=t.getMinutes().toString().padStart(2,"0"),n=t.getSeconds().toString().padStart(2,"0");e=(e=(e=e.replace("hh",r)).replace("mm",i)).replace("ss",n)}return e}function Ad(t,e){const r=e.indexOf("yyyy"),i=e.indexOf("mm"),n=e.indexOf("dd"),s=i<r?i<n?0:1:i<n?1:2,o=n<r?n<i?0:1:n<i?1:2,a=parseInt(t[r<i?r<n?0:1:i<n?1:2],10),l=parseInt(t[s],10)-1,h=parseInt(t[o],10);if(isNaN(a)||a<1)return!1;if(isNaN(l)||l<0||l>11)return!1;const c=[31,Bd(a)?29:28,31,30,31,30,31,31,30,31,30,31];return!(isNaN(h)||h<1||h>c[l])}function Od(t,e){if(e.includes("hh")||e.includes("mm")||e.includes("ss")){const r=e.indexOf("hh")>-1?e.indexOf("hh"):e.indexOf("HH"),i=parseInt(t[r],10),n=parseInt(t[r+1],10),s=t.length>r+2?parseInt(t[r+2],10):0;if(isNaN(i)||i<0||i>23)return!1;if(isNaN(n)||n<0||n>59)return!1;if(isNaN(s)||s<0||s>59)return!1}return!0}function Bd(t){return t%4==0&&t%100!=0||t%400==0}function Rd(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"],r=["hh:mm:ss","hh:mm"],i=(t=t.trim()).split(" "),n=i[0],s=i[1];let o,a;if(n)for(let t=0;t<e.length;t++){const r=e[t],i=n.split(Ld(r)),s=Ad(i,r);if(3===i.length&&s){o=r;break}}if(o&&s)for(let t=0;t<r.length;t++){const e=r[t],i=s.split(Ld(e)),n=e.split(Ld(e));if(Od(i,e)&&i.length===n.length){a=e;break}}return n&&s&&o&&a?o+" "+a:n&&!s?o:"yyyy-mm-dd hh:mm:ss"}function Ld(t){const e=t.match(/[^\w]/g);if(e){const t=e.map((t=>"\\"+t)).join("|");return new RegExp(t,"g")}return/[^\w]/}function Pd(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 Dd(t){const e=new Date(t.getFullYear(),0,1);return Math.ceil(((t.getTime()+1-e.getTime())/864e5+1)/7)}function Md(t,e=!1){let r;if(t){if(r=new Date(t),"string"==typeof t){if(t.length>10)return e&&r.setHours(0,0,0,0),r;r.setHours(0,0,0,0)}}else r=new Date;return e&&r.setHours(0,0,0,0),r}function Id(t,e=!1){let r;if(t){if(r=new Date(t),"string"==typeof t){if(t.length>10)return e&&r.setMinutes(59,59,999),r;r.setMinutes(59,59,999)}}else r=new Date;return e&&r.setMinutes(59,59,999),r}function Nd(t,e=!1){let r;if(t){if(r=new Date(t),"string"==typeof t){if(t.length>10)return e&&r.setSeconds(59,999),r;r.setSeconds(59,999)}}else r=new Date;return e&&r.setSeconds(59,999),r}function Fd(t,e=!1){let r;if(t){if(r=new Date(t),"string"==typeof t){if(t.length>10)return e&&r.setMilliseconds(999),r;r.setMilliseconds(999)}}else r=new Date;return e&&r.setMilliseconds(999),r}function jd(t,e=!1){let r;if(t){if(r=new Date(t),"string"==typeof t){if(t.length>10)return e&&r.setHours(23,59,59,999),r;r.setHours(23,59,59,999)}}else r=new Date;return e&&r.setHours(23,59,59,999),r}function zd(t,e,r,i){let n=new Date(e);switch(r){case"second":n.setMilliseconds(999);break;case"minute":n.setSeconds(59,999);break;case"hour":n.setMinutes(59,59,999);break;case"day":n.setHours(23,59,59,999);break;case"week":const t=6-n.getDay();n.setDate(n.getDate()+t),n.setHours(23,59,59,999);break;case"month":const e=new Date(n.getFullYear(),n.getMonth()+1,0).getDate();n.setDate(e),n.setHours(23,59,59,999);break;case"quarter":const r=n.getMonth(),i=r-r%3+2,s=new Date(n.getFullYear(),i+1,0).getDate();n.setMonth(i,s),n.setHours(23,59,59,999);break;case"year":n.setMonth(11,31),n.setHours(23,59,59,999);break;default:throw new Error("Invalid time scale")}const s=Wd(n,t,r,i,1),o=Math.ceil(s);if(o>s){const t=(o-s)*i,e=1e3,a=60*e,l=60*a,h=24*l,c=7*h;switch(new Date(n.getTime()+1),r){case"second":n.setTime(n.getTime()+t*e);break;case"minute":n.setTime(n.getTime()+t*a);break;case"hour":n.setTime(n.getTime()+t*l);break;case"day":n.setTime(n.getTime()+t*h);break;case"week":n.setTime(n.getTime()+t*c);break;case"month":n=new Date(n.getFullYear(),n.getMonth()+1+Math.round(t),0),n.setHours(23,59,59,999);break;case"quarter":const r=n.getMonth(),i=r-r%3+2;n=new Date(n.getFullYear(),i+Math.round(3*t)+1,0),n.setHours(23,59,59,999);break;case"year":n.setFullYear(n.getFullYear()+Math.floor(t)),n.setHours(23,59,59,999);break;default:throw new Error("Invalid time scale")}}return n}function Hd(t,e,r="monday"){const i=new Date(t);switch(e){case"second":i.setMilliseconds(0);break;case"minute":i.setSeconds(0,0);break;case"hour":i.setMinutes(0,0,0);break;case"day":i.setHours(0,0,0,0);break;case"week":const t=i.getDay();let e=t;e="monday"===r?0===t?-6:1-t:-t,i.setDate(i.getDate()+e),i.setHours(0,0,0,0);break;case"month":i.setDate(1),i.setHours(0,0,0,0);break;case"quarter":const n=i.getMonth(),s=n-n%3;i.setMonth(s,1),i.setHours(0,0,0,0);break;case"year":i.setMonth(0,1),i.setHours(0,0,0,0);break;default:throw new Error("Invalid time scale")}return i}function Wd(t,e,r,i,n=0){let s;const o=new Date(t.getTime()+n);switch(r){case"second":s=(o.getTime()-e.getTime())/1e3;break;case"minute":s=(o.getTime()-e.getTime())/6e4;break;case"hour":s=(o.getTime()-e.getTime())/36e5;break;case"day":s=(o.getTime()-e.getTime())/864e5;break;case"week":s=(o.getTime()-e.getTime())/6048e5;break;case"month":s=12*(o.getFullYear()-e.getFullYear())+(o.getMonth()-e.getMonth()),s+=(o.getDate()-e.getDate())/new Date(o.getFullYear(),o.getMonth()+1,0).getDate();break;case"quarter":s=4*(o.getFullYear()-e.getFullYear())+(o.getMonth()-e.getMonth())/3,s+=(o.getDate()-e.getDate())/(3*new Date(o.getFullYear(),o.getMonth()+1,0).getDate());break;case"year":s=o.getFullYear()-e.getFullYear(),s+=(o.getMonth()-e.getMonth())/12;break;default:throw new Error("Invalid time scale")}return s/i}class Ud{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 ta({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,r,i,n,s;const o=this._scene._gantt.parsedOptions,a=null!==(e=null===(t=o.horizontalSplitLine)||void 0===t?void 0:t.lineWidth)&&void 0!==e?e:null===(r=o.timelineHeaderHorizontalLineStyle)||void 0===r?void 0:r.lineWidth,l=(1&a?-.5:0)+a/2,h=Va({pickable:!1,stroke:null!==(n=null===(i=o.horizontalSplitLine)||void 0===i?void 0:i.lineColor)&&void 0!==n?n:null===(s=o.timelineHeaderHorizontalLineStyle)||void 0===s?void 0:s.lineColor,lineWidth:a+(1&a?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 r=this._scene._gantt.parsedOptions.grid,i=null!==(t=r.verticalLineDependenceOnTimeScale)&&void 0!==t?t:this._scene._gantt.parsedOptions.reverseSortedTimelineScales[0].unit;if(r.verticalLine){this.verticalLineGroup=new ta({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===i)))&&void 0!==e?e:this._scene._gantt.parsedOptions.reverseSortedTimelineScales[0],{unit:n,step:s}=this._scene._gantt.parsedOptions.reverseSortedTimelineScales[0],{timelineDates:o}=t,a=this._scene._gantt.parsedOptions.timelineColWidth;if("function"==typeof r.verticalLine)for(let t=0;t<(null==o?void 0:o.length)-1;t++){const{endDate:e}=o[t],i=r.verticalLine({index:t,dateIndex:o[t].dateIndex,date:o[t].endDate,ganttInstance:this._scene._gantt}),l=Math.ceil(Wd(e,this._scene._gantt.parsedOptions.minDate,n,s,1)*a)+(1&i.lineWidth?.5:0),h=Va({pickable:!1,stroke:i.lineColor,lineWidth:i.lineWidth,points:[{x:l,y:0},{x:l,y:this.allGridHeight}]});this.verticalLineGroup.appendChild(h)}else{const t=r.verticalLine;for(let e=0;e<(null==o?void 0:o.length)-1;e++){const{endDate:r}=o[e],i=Math.ceil(Wd(r,this._scene._gantt.parsedOptions.minDate,n,s,1)*a)+(1&t.lineWidth?.5:0),l=Va({pickable:!1,stroke:t.lineColor,lineWidth:t.lineWidth,points:[{x:i,y:0},{x:i,y:this.allGridHeight}]});this.verticalLineGroup.appendChild(l)}}}}createHorizontalLines(){const t=this._scene._gantt.parsedOptions.grid;if(t.horizontalLine)if(this.horizontalLineGroup=new ta({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 r=0;r<this.rowCount-1;r++){const i=t.horizontalLine({index:r,ganttInstance:this._scene._gantt});e+=this._scene._gantt.getRowHeightByIndex(r);const n=Va({pickable:!1,stroke:i.lineColor,lineWidth:i.lineWidth,points:[{x:0,y:e},{x:this.allGridWidth,y:e}]});this.horizontalLineGroup.appendChild(n)}}else{const e=t.horizontalLine;let r=0;1&e.lineWidth&&(r+=.5);for(let t=0;t<this.rowCount-1;t++){r+=this._scene._gantt.getRowHeightByIndex(t);const i=Va({pickable:!1,stroke:e.lineColor,lineWidth:e.lineWidth,points:[{x:0,y:r},{x:this.allGridWidth,y:r}]});this.horizontalLineGroup.appendChild(i)}}}createVerticalBackgroundRects(){const t=this._scene._gantt.parsedOptions.grid.verticalBackgroundColor,e=this._scene._gantt.parsedOptions.grid.weekendBackgroundColor;if(t||e){this.verticalBackgroundRectsGroup=new ta({x:0,y:0,width:this.allGridWidth,height:this.allGridHeight}),this.verticalBackgroundRectsGroup.name="grid-vertical-background",this.group.appendChild(this.verticalBackgroundRectsGroup);const{timelineDates:r,unit:i,step:n}=this._scene._gantt.parsedOptions.reverseSortedTimelineScales[0],s=this._scene._gantt.parsedOptions.timelineColWidth;if(t||e)for(let o=0;o<=(null==r?void 0:r.length)-1;o++){let a;if(!e||"day"!==i||1!==n||0!==r[o].startDate.getDay()&&6!==r[o].startDate.getDay()?"function"==typeof t?a=t({index:o,dateIndex:r[o].dateIndex,date:r[o].endDate,ganttInstance:this._scene._gantt}):t&&(a=t[o%t.length]):a=e,a){const t=Ya({pickable:!1,fill:a,x:Math.ceil(s*o),y:0,width:s,height:this.allGridHeight});this.verticalBackgroundRectsGroup.appendChild(t)}}}}createHorizontalBackgroundRects(){const t=this._scene._gantt.parsedOptions.grid.horizontalBackgroundColor;if(t){this.horizontalBackgroundRectsGroup=new ta({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 r=0;r<=this.rowCount-1;r++){let i;i="function"==typeof t?t({index:r,ganttInstance:this._scene._gantt}):t[r%t.length];const n=Ya({pickable:!1,fill:i,x:0,y:e,width:this.allGridWidth,height:this._scene._gantt.getRowHeightByIndex(r)});this.horizontalBackgroundRectsGroup.appendChild(n),e+=this._scene._gantt.getRowHeightByIndex(r)}}}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,r,i,n;null===(e=this.verticalLineGroup)||void 0===e||e.setAttribute("x",t),null===(r=this.horizontalLineGroup)||void 0===r||r.setAttribute("x",t),null===(i=this.verticalBackgroundRectsGroup)||void 0===i||i.setAttribute("x",t),null===(n=this.horizontalBackgroundRectsGroup)||void 0===n||n.setAttribute("x",t)}setY(t){var e,r,i,n;null===(e=this.verticalLineGroup)||void 0===e||e.setAttribute("y",t),null===(r=this.horizontalLineGroup)||void 0===r||r.setAttribute("y",t),null===(i=this.verticalBackgroundRectsGroup)||void 0===i||i.setAttribute("y",t),null===(n=this.horizontalBackgroundRectsGroup)||void 0===n||n.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 $d{static get mode(){return $d._mode||($d._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}()),$d._mode}static set mode(t){$d._mode=t}static RegisterCreateCanvas(t){$d.CreateCanvas=t}static RegisterLoadImage(t){$d.LoadImage=t}static GetCreateCanvasFunc(){return $d.CreateCanvas?$d.CreateCanvas:"worker"===$d.mode?(t=200,e=200)=>new OffscreenCanvas(t,e):void 0}static RegisterRequestAnimationFrame(t){$d.RequestAnimationFrame=t()}static GetRequestAnimationFrame(){if($d.RequestAnimationFrame)return $d.RequestAnimationFrame}static RegisterCancelAnimationFrame(t){$d.CancelAnimationFrame=t()}static GetCancelAnimationFrame(){if($d.CancelAnimationFrame)return $d.CancelAnimationFrame}}$d.dpr=0;class Vd{constructor(t){this._gantt=t,this.createScrollBar(t.tableNoFrameWidth,t.tableNoFrameHeight-t.getAllHeaderRowsHeight())}createScrollBar(t,e){var r,i;const n=this._gantt.parsedOptions.scrollStyle.scrollRailColor,s=this._gantt.parsedOptions.scrollStyle.scrollSliderColor,o=this._gantt.parsedOptions.scrollStyle.scrollSliderCornerRadius,a=this._gantt.parsedOptions.scrollStyle.width;let l;l=ld(o)?{cornerRadius:o,fill:s}:{fill:s},null===(r=this._gantt.parsedOptions.scrollStyle)||void 0===r||r.visible,null===(i=this._gantt.parsedOptions.scrollStyle)||void 0===i||i.hoverOn,this.hScrollBar=new qu({direction:"horizontal",x:2*-t,y:2*-e,width:t,height:a,padding:0,railStyle:{fill:n},sliderStyle:l,range:[0,.1],visible:!1}),this.hScrollBar.render(),this.hScrollBar.hideAll(),this.vScrollBar=new qu({direction:"vertical",x:2*-t,y:2*-e,width:a,height:e,padding:0,railStyle:{fill:n},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,r=e[1]-e[0],i=t*(1-r);this.vScrollBar.setAttribute("range",[i,i+r]);const n=this.vScrollBar.AABBBounds&&this.vScrollBar.globalAABBBounds;this.vScrollBar._viewPosition={x:n.x1,y:n.y1}}updateHorizontalScrollBarPos(t){const e=this.hScrollBar.attribute.range,r=e[1]-e[0],i=t*(1-r);this.hScrollBar.setAttribute("range",[i,i+r]);const n=this.hScrollBar.AABBBounds&&this.hScrollBar.globalAABBBounds;this.hScrollBar._viewPosition={x:n.x1,y:n.y1}}updateScrollBar(){const t=this._gantt.stateManager.scroll.horizontalBarPos,e=this._gantt.stateManager.scroll.verticalBarPos,r=this._gantt.parsedOptions.scrollStyle,i=null==r?void 0:r.width,n=null==r?void 0:r.visible,s=Math.ceil(this._gantt.scenegraph.ganttGroup.attribute.width),o=Math.ceil(this._gantt.scenegraph.ganttGroup.attribute.height),a=this._gantt.getAllRowsHeight(),l=this._gantt.getAllDateColsWidth(),h=this._gantt.getAllHeaderRowsHeight();if(l>s){const t=Math.min(o,a),e=Math.max(.05,s/l),h=r.hoverOn;let c=0;c=r.barToSide?this._gantt.tableNoFrameHeight-(h?i:-this._gantt.scenegraph.ganttGroup.attribute.y)+this._gantt.tableY:t-(h?i:-this._gantt.scenegraph.ganttGroup.attribute.y)+this._gantt.tableY,this.hScrollBar.setAttributes({x:this._gantt.scenegraph.ganttGroup.attribute.x,y:c,width:s,range:[0,e],visible:"always"===n});const u=this.hScrollBar.AABBBounds&&this.hScrollBar.globalAABBBounds;this.hScrollBar._viewPosition={x:u.x1,y:u.y1},"always"===n&&this.hScrollBar.showAll()}else this.hScrollBar.setAttributes({x:2*-this._gantt.tableNoFrameWidth,y:2*-this._gantt.tableNoFrameHeight,width:0,visible:!1});if(a>o){const t=Math.min(s,l)+this._gantt.scenegraph.ganttGroup.attribute.x,e=Math.max(.05,(o-h)/(a-h));let r=0;const c=this._gantt.parsedOptions.scrollStyle.hoverOn;r=this._gantt.parsedOptions.scrollStyle.barToSide?this._gantt.tableNoFrameWidth-(c?i:-this._gantt.scenegraph.ganttGroup.attribute.x):t-(c?i:-this._gantt.scenegraph.ganttGroup.attribute.x),this.vScrollBar.setAttributes({x:r,y:h+(c?0:this._gantt.scenegraph.ganttGroup.attribute.y)+this._gantt.tableY,height:o-h,range:[0,e],visible:"always"===n});const u=this.vScrollBar.AABBBounds&&this.vScrollBar.globalAABBBounds;this.vScrollBar._viewPosition={x:u.x1,y:u.y1},"always"===n&&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 Gd(t,e,r,i=!0){var n;let{deltaX:s,deltaY:o}=t;t.shiftKey&&t.deltaY&&(s=o,o=0);const[a,l]=function(t,e,r){var i,n;const s=Math.abs(t/e),o=s<=.5?0:t,a=s>2?0:e;return[Math.ceil(o*(null!==(i=r.horizontal)&&void 0!==i?i:0)),Math.ceil(a*(null!==(n=r.vertical)&&void 0!==n?n:0))]}(s,o,{horizontal:1,vertical:1});a&&(e.setScrollLeft(e.scroll.horizontalBarPos+a),r.scenegraph.scrollbarComponent.showHorizontalScrollBar(!0)),l&&(e.setScrollTop(e.scroll.verticalBarPos+l),r.scenegraph.scrollbarComponent.showVerticalScrollBar(!0)),i&&e.resetInteractionState(),(null===(n=t.nativeEvent)||void 0===n?void 0:n.cancelable)&&("none"===e._gantt.parsedOptions.overscrollBehavior||Math.abs(o)>=Math.abs(s)&&0!==o&&Xd(o,e)||Math.abs(o)<=Math.abs(s)&&0!==s&&Yd(s,e))&&t.preventDefault()}function Xd(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 r=e._gantt.getAllRowsHeight()-e._gantt.scenegraph.height;return 0!==r&&t>=0&&Math.abs(e.scroll.verticalBarPos-r)<1}(t,e)}function Yd(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 r=e._gantt.getAllDateColsWidth()-e._gantt.scenegraph.width;return 0!==r&&t>=0&&Math.abs(e.scroll.horizontalBarPos-r)<1}(t,e)}const qd={barColor:"blue",completedBarColor:"gray",width:30,cornerRadius:3,borderWidth:0,fontFamily:"Arial",fontSize:14};const Zd="undefined"==typeof window||void 0===window.window;function Kd(t,e){const r=t+e.stateManager.scroll.horizontalBarPos,i=e.getDateColWidth(0);return Math.floor((r-i)/e.parsedOptions.timelineColWidth)+1}function Qd(t){var e,r,i,n,s;return t?!0===t?[{date:Md().toLocaleDateString(),content:"",scrollToMarkLine:!0,position:"left",style:{lineColor:"red",lineWidth:1}}]:Array.isArray(t)?t.map(((t,e)=>{var r,i,n,s;return Object.assign(Object.assign({},t),{date:t.date,scrollToMarkLine:t.scrollToMarkLine,position:null!==(r=t.position)&&void 0!==r?r:"left",style:{lineColor:(null===(i=t.style)||void 0===i?void 0:i.lineColor)||"red",lineWidth:(null===(n=t.style)||void 0===n?void 0:n.lineWidth)||1,lineDash:null===(s=t.style)||void 0===s?void 0:s.lineDash}})})):[Object.assign(Object.assign({},t),{date:t.date,scrollToMarkLine:null===(e=t.scrollToMarkLine)||void 0===e||e,position:null!==(r=t.position)&&void 0!==r?r:"left",style:{lineColor:(null===(i=t.style)||void 0===i?void 0:i.lineColor)||"red",lineWidth:(null===(n=t.style)||void 0===n?void 0:n.lineWidth)||1,lineDash:null===(s=t.style)||void 0===s?void 0:s.lineDash}})]:[]}function Jd(t){var e,r,i,n,s,o,a,l,h,c,u,d,p,f,g,m,y,v,b,_,w,x,S,T,k,C,E,A,O,B,R,L,P,D,M,I,N,F,j,z,H,W,U,$,V,G,X,Y,q,Z,K,Q,J,tt,et,rt,it,nt,st,ot,at,lt,ht,ct,ut,dt,pt,ft,gt,mt,yt,vt,bt,_t,wt,xt,St,Tt,kt,Ct,Et,At,Ot,Bt,Rt,Lt,Pt,Dt,Mt,It,Nt,Ft,jt,zt,Ht,Wt,Ut,$t,Vt,Gt,Xt,Yt,qt,Zt,Kt,Qt,Jt,te,ee,re;const ie=t.options;t.parsedOptions.tasksShowMode=null!==(e=null==ie?void 0:ie.tasksShowMode)&&void 0!==e?e:Sd.Tasks_Separate,t.parsedOptions.pixelRatio=null!==(r=null==ie?void 0:ie.pixelRatio)&&void 0!==r?r:1,t.parsedOptions.rowHeight=null!==(i=null==ie?void 0:ie.rowHeight)&&void 0!==i?i:40,t.parsedOptions.timelineColWidth=null!==(s=null===(n=null==ie?void 0:ie.timelineHeader)||void 0===n?void 0:n.colWidth)&&void 0!==s?s:60,t.parsedOptions.startDateField=null!==(a=null===(o=ie.taskBar)||void 0===o?void 0:o.startDateField)&&void 0!==a?a:"startDate",t.parsedOptions.endDateField=null!==(h=null===(l=ie.taskBar)||void 0===l?void 0:l.endDateField)&&void 0!==h?h:"endDate",t.parsedOptions.progressField=null!==(u=null===(c=ie.taskBar)||void 0===c?void 0:c.progressField)&&void 0!==u?u:"progress",t.parsedOptions.projectSubTasksExpandable=null===(d=null==ie?void 0:ie.projectSubTasksExpandable)||void 0===d||d;const{unit:ne,startOfWeek:se,step:oe}=t.parsedOptions.reverseSortedTimelineScales[0];t.parsedOptions.minDate=(null==ie?void 0:ie.minDate)?Hd(new Date(ie.minDate),ne,se):void 0,t.parsedOptions.maxDate=(null==ie?void 0:ie.maxDate)&&(null===(p=t.parsedOptions)||void 0===p?void 0:p.minDate)?zd(null===(f=t.parsedOptions)||void 0===f?void 0:f.minDate,new Date(ie.maxDate),ne,oe):void 0,t.parsedOptions._minDateTime=null===(g=t.parsedOptions.minDate)||void 0===g?void 0:g.getTime(),t.parsedOptions._maxDateTime=null===(m=t.parsedOptions.maxDate)||void 0===m?void 0:m.getTime(),t.parsedOptions.overscrollBehavior=null!==(y=null==ie?void 0:ie.overscrollBehavior)&&void 0!==y?y:"auto",t.parsedOptions.underlayBackgroundColor=null!==(v=null==ie?void 0:ie.underlayBackgroundColor)&&void 0!==v?v:"#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==ie?void 0:ie.scrollStyle),t.parsedOptions.timelineHeaderHorizontalLineStyle=null===(b=null==ie?void 0:ie.timelineHeader)||void 0===b?void 0:b.horizontalLine,t.parsedOptions.timelineHeaderVerticalLineStyle=null===(_=null==ie?void 0:ie.timelineHeader)||void 0===_?void 0:_.verticalLine,t.parsedOptions.timelineHeaderBackgroundColor=null===(w=null==ie?void 0:ie.timelineHeader)||void 0===w?void 0:w.backgroundColor,t.parsedOptions.timeLineHeaderRowHeights=[],t.parsedOptions.timelineHeaderStyles=[];for(let e=0;e<t.parsedOptions.sortedTimelineScales.length;e++){const r=t.parsedOptions.sortedTimelineScales[e].style;t.parsedOptions.timelineHeaderStyles.push(Object.assign({fontSize:20,fontWeight:"bold",textAlign:"center",textBaseline:"middle",color:"#000",backgroundColor:"#fff"},r)),t.parsedOptions.timeLineHeaderRowHeights.push(null!==(S=null!==(x=t.parsedOptions.sortedTimelineScales[e].rowHeight)&&void 0!==x?x:null==ie?void 0:ie.headerRowHeight)&&void 0!==S?S:40)}var ae;t.parsedOptions.grid=Object.assign({},null==ie?void 0:ie.grid),ae=3*t.parsedOptions.rowHeight/4,qd.width=ae,t.parsedOptions.taskBarStyle=(null===(T=null==ie?void 0:ie.taskBar)||void 0===T?void 0:T.barStyle)&&"function"==typeof(null===(k=null==ie?void 0:ie.taskBar)||void 0===k?void 0:k.barStyle)?ie.taskBar.barStyle:Object.assign({},qd,null===(C=null==ie?void 0:ie.taskBar)||void 0===C?void 0:C.barStyle),t.parsedOptions.projectBarStyle=(null===(E=null==ie?void 0:ie.taskBar)||void 0===E?void 0:E.projectStyle)&&"function"==typeof(null===(A=null==ie?void 0:ie.taskBar)||void 0===A?void 0:A.projectStyle)?ie.taskBar.projectStyle:(null===(O=null==ie?void 0:ie.taskBar)||void 0===O?void 0:O.projectStyle)?Object.assign({},qd,null===(B=null==ie?void 0:ie.taskBar)||void 0===B?void 0:B.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!==(R=t.parsedOptions.taskBarStyle.borderLineWidth)&&void 0!==R?R:1,fillColor:t.parsedOptions.taskBarStyle.barColor,cornerRadius:0},{labelTextStyle:{fontSize:16,color:"red",fontFamily:"Arial",padding:4}},null===(L=null==ie?void 0:ie.taskBar)||void 0===L?void 0:L.milestoneStyle),t.parsedOptions.taskBarMilestoneHypotenuse=t.parsedOptions.taskBarMilestoneStyle.width*Math.sqrt(2),t.parsedOptions.dateFormat=null==ie?void 0:ie.dateFormat,t.parsedOptions.taskBarHoverStyle=Object.assign({barOverlayColor:"rgba(99, 144, 0, 0.4)"},null===(P=null==ie?void 0:ie.taskBar)||void 0===P?void 0:P.hoverBarStyle),t.parsedOptions.taskBarSelectable=null===(M=null===(D=null==ie?void 0:ie.taskBar)||void 0===D?void 0:D.selectable)||void 0===M||M,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==ie?void 0:ie.taskBar)||void 0===I?void 0:I.selectedBarStyle),t.parsedOptions.taskBarLabelText=null!==(F=null===(N=null==ie?void 0:ie.taskBar)||void 0===N?void 0:N.labelText)&&void 0!==F?F:"",t.parsedOptions.taskBarMoveable=null===(z=null===(j=null==ie?void 0:ie.taskBar)||void 0===j?void 0:j.moveable)||void 0===z||z,t.parsedOptions.moveTaskBarToExtendDateRange=null===(W=null===(H=null==ie?void 0:ie.taskBar)||void 0===H?void 0:H.moveToExtendDateRange)||void 0===W||W,t.parsedOptions.taskBarResizable=null===($=null===(U=null==ie?void 0:ie.taskBar)||void 0===U?void 0:U.resizable)||void 0===$||$,t.parsedOptions.taskBarDragOrder=null===(G=null===(V=null==ie?void 0:ie.taskBar)||void 0===V?void 0:V.dragOrder)||void 0===G||G,t.parsedOptions.taskBarLabelStyle={fontFamily:null!==(q=null===(Y=null===(X=null==ie?void 0:ie.taskBar)||void 0===X?void 0:X.labelTextStyle)||void 0===Y?void 0:Y.fontFamily)&&void 0!==q?q:"Arial",fontSize:null!==(Q=null===(K=null===(Z=null==ie?void 0:ie.taskBar)||void 0===Z?void 0:Z.labelTextStyle)||void 0===K?void 0:K.fontSize)&&void 0!==Q?Q:20,color:null!==(et=null===(tt=null===(J=null==ie?void 0:ie.taskBar)||void 0===J?void 0:J.labelTextStyle)||void 0===tt?void 0:tt.color)&&void 0!==et?et:"#F01",outsideColor:null!==(nt=null===(it=null===(rt=null==ie?void 0:ie.taskBar)||void 0===rt?void 0:rt.labelTextStyle)||void 0===it?void 0:it.outsideColor)&&void 0!==nt?nt:"#333333",textAlign:null!==(at=null===(ot=null===(st=null==ie?void 0:ie.taskBar)||void 0===st?void 0:st.labelTextStyle)||void 0===ot?void 0:ot.textAlign)&&void 0!==at?at:"left",textBaseline:null!==(ct=null===(ht=null===(lt=null==ie?void 0:ie.taskBar)||void 0===lt?void 0:lt.labelTextStyle)||void 0===ht?void 0:ht.textBaseline)&&void 0!==ct?ct:"middle",padding:null!==(pt=null===(dt=null===(ut=null==ie?void 0:ie.taskBar)||void 0===ut?void 0:ut.labelTextStyle)||void 0===dt?void 0:dt.padding)&&void 0!==pt?pt:[0,0,0,10],textOverflow:null===(gt=null===(ft=null==ie?void 0:ie.taskBar)||void 0===ft?void 0:ft.labelTextStyle)||void 0===gt?void 0:gt.textOverflow,orient:null===(yt=null===(mt=null==ie?void 0:ie.taskBar)||void 0===mt?void 0:mt.labelTextStyle)||void 0===yt?void 0:yt.orient,orientHandleWithOverflow:null===(bt=null===(vt=null==ie?void 0:ie.taskBar)||void 0===vt?void 0:vt.labelTextStyle)||void 0===bt?void 0:bt.orientHandleWithOverflow},t.parsedOptions.taskBarCustomLayout=null===(_t=null==ie?void 0:ie.taskBar)||void 0===_t?void 0:_t.customLayout,t.parsedOptions.taskBarCreatable=null!==(xt=null===(wt=null==ie?void 0:ie.taskBar)||void 0===wt?void 0:wt.scheduleCreatable)&&void 0!==xt?xt:!(t.parsedOptions.tasksShowMode!==Sd.Sub_Tasks_Separate&&t.parsedOptions.tasksShowMode!==Sd.Tasks_Separate),t.parsedOptions.taskBarCreationButtonStyle=Object.assign({lineColor:"rgb(99, 144, 0)",lineWidth:1,lineDash:[5,5],cornerRadius:4,backgroundColor:"#FFF"},null===(Tt=null===(St=null==ie?void 0:ie.taskBar)||void 0===St?void 0:St.scheduleCreation)||void 0===Tt?void 0:Tt.buttonStyle),t.parsedOptions.taskBarCreationCustomLayout=null===(Ct=null===(kt=null==ie?void 0:ie.taskBar)||void 0===kt?void 0:kt.scheduleCreation)||void 0===Ct?void 0:Ct.customLayout,t.parsedOptions.taskBarCreationMaxWidth=null===(At=null===(Et=null==ie?void 0:ie.taskBar)||void 0===Et?void 0:Et.scheduleCreation)||void 0===At?void 0:At.maxWidth,t.parsedOptions.taskBarCreationMinWidth=null===(Bt=null===(Ot=null==ie?void 0:ie.taskBar)||void 0===Ot?void 0:Ot.scheduleCreation)||void 0===Bt?void 0:Bt.minWidth,t.parsedOptions.outerFrameStyle=Object.assign({borderColor:"#e1e4e8",borderLineWidth:1,cornerRadius:4},null===(Rt=ie.frame)||void 0===Rt?void 0:Rt.outerFrameStyle),t.parsedOptions.markLine=Qd(null==ie?void 0:ie.markLine),null!==(Pt=null===(Lt=t.parsedOptions.markLine)||void 0===Lt?void 0:Lt.length)&&void 0!==Pt&&Pt&&((null===(Dt=t.parsedOptions.markLine)||void 0===Dt?void 0:Dt.every((t=>void 0===t.scrollToMarkLine)))&&(t.parsedOptions.markLine[0].scrollToMarkLine=!0),(null===(Mt=t.parsedOptions.markLine)||void 0===Mt?void 0:Mt.find((t=>t.scrollToMarkLine)))&&(t.parsedOptions.scrollToMarkLineDate=Hd(new Date(null===(It=t.parsedOptions.markLine)||void 0===It?void 0:It.find((t=>t.scrollToMarkLine)).date),ne,se))),t.parsedOptions.verticalSplitLineHighlight=null===(Nt=ie.frame)||void 0===Nt?void 0:Nt.verticalSplitLineHighlight,t.parsedOptions.verticalSplitLine=Object.assign({lineColor:null===(Ft=t.parsedOptions.outerFrameStyle)||void 0===Ft?void 0:Ft.borderColor,lineWidth:null===(jt=t.parsedOptions.outerFrameStyle)||void 0===jt?void 0:jt.borderLineWidth},null===(zt=ie.frame)||void 0===zt?void 0:zt.verticalSplitLine),t.parsedOptions.horizontalSplitLine=null===(Ht=ie.frame)||void 0===Ht?void 0:Ht.horizontalSplitLine,t.parsedOptions.verticalSplitLineMoveable=null===(Wt=ie.frame)||void 0===Wt?void 0:Wt.verticalSplitLineMoveable,t.parsedOptions.taskKeyField=null!==(Ut=ie.taskKeyField)&&void 0!==Ut?Ut:"id",t.parsedOptions.dependencyLinks=null!==(Vt=null===($t=ie.dependency)||void 0===$t?void 0:$t.links)&&void 0!==Vt?Vt:[],t.parsedOptions.dependencyLinkCreatable=null!==(Xt=null===(Gt=ie.dependency)||void 0===Gt?void 0:Gt.linkCreatable)&&void 0!==Xt&&Xt,t.parsedOptions.dependencyLinkSelectable=null===(qt=null===(Yt=ie.dependency)||void 0===Yt?void 0:Yt.linkSelectable)||void 0===qt||qt,t.parsedOptions.dependencyLinkDeletable=null!==(Kt=null===(Zt=ie.dependency)||void 0===Zt?void 0:Zt.linkDeletable)&&void 0!==Kt&&Kt,t.parsedOptions.dependencyLinkLineStyle=Object.assign({lineColor:"red",lineWidth:1},null===(Qt=ie.dependency)||void 0===Qt?void 0:Qt.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===(Jt=null==ie?void 0:ie.dependency)||void 0===Jt?void 0:Jt.linkSelectedLineStyle),t.parsedOptions.dependencyLinkLineCreatePointStyle=Object.assign({strokeColor:"red",fillColor:"white",radius:5,strokeWidth:1},null===(te=null==ie?void 0:ie.dependency)||void 0===te?void 0:te.linkCreatePointStyle),t.parsedOptions.dependencyLinkLineCreatingPointStyle=Object.assign({strokeColor:"red",fillColor:"red",radius:5,strokeWidth:1},null===(ee=null==ie?void 0:ie.dependency)||void 0===ee?void 0:ee.linkCreatingPointStyle),t.parsedOptions.dependencyLinkLineCreatingStyle=Object.assign({lineColor:"red",lineWidth:1,lineDash:[5,5]},null===(re=null==ie?void 0:ie.dependency)||void 0===re?void 0:re.linkCreatingLineStyle),t.parsedOptions.eventOptions=null==ie?void 0:ie.eventOptions,t.parsedOptions.keyboardOptions=null==ie?void 0:ie.keyboardOptions,t.parsedOptions.markLineCreateOptions=null==ie?void 0:ie.markLineCreateOptions}function tp(t,e,r){var i;const{unit:n,step:s,format:o}=r,a=[];for(;t<e;)if("day"===n){const r=t.getFullYear(),i=t.getMonth(),n=t.getDate(),l=jd(new Date(r,i,n+s-1),!0);l.getTime()>e.getTime()&&l.setTime(e.getTime());const h=t,c=(null==o?void 0:o({dateIndex:n,startDate:h,endDate:l}))||n.toString(),u={days:Math.abs(l.getTime()-t.getTime()+1)/864e5,startDate:h,endDate:l,step:s,unit:"day",title:c,dateIndex:n};a.push(u),t=new Date(r,i,n+s)}else if("month"===n){const r=t.getFullYear(),i=t.getMonth(),n=jd(new Date(r,i+s,0),!0);n.getTime()>e.getTime()&&n.setTime(e.getTime());const l=t,h=(null==o?void 0:o({dateIndex:i+1,startDate:l,endDate:n}))||(i+1).toString(),c={days:Math.abs(n.getTime()-t.getTime()+1)/864e5,startDate:l,step:s,unit:"month",endDate:n,title:h,dateIndex:i+1};a.push(c),t=new Date(r,i+s,1)}else if("quarter"===n){const r=t.getFullYear(),i=Math.floor(t.getMonth()/3),n=jd(new Date(r,3*(i+s),0),!0);n.getTime()>e.getTime()&&n.setTime(e.getTime());const l=t,h=(null==o?void 0:o({dateIndex:i+1,startDate:l,endDate:n}))||(i+1).toString(),c={days:Math.abs(n.getTime()-t.getTime()+1)/864e5,startDate:l,step:s,unit:"quarter",endDate:n,title:h,dateIndex:i+1};a.push(c),t=new Date(r,3*(i+s),1)}else if("year"===n){const r=t.getFullYear(),i=jd(new Date(r+s-1,11,31),!0);i.getTime()>e.getTime()&&i.setTime(e.getTime());const n=t,l=(null==o?void 0:o({dateIndex:r,startDate:n,endDate:i}))||r.toString(),h={days:Math.abs(i.getTime()-t.getTime()+1)/864e5,startDate:n,endDate:i,step:s,unit:"year",title:l,dateIndex:r};a.push(h),t=new Date(r+s,0,1)}else if("week"===n){const n=null!==(i=r.startOfWeek)&&void 0!==i?i:"monday";let l=t.getDay();"monday"===n&&(l=0===l?6:l-1);const h=Md(t),c=jd(t.getTime()+24*(7*s-l)*60*60*1e3-1,!0);c>e&&c.setTime(e.getTime());const u=Dd(h),d=(null==o?void 0:o({dateIndex:u,startDate:h,endDate:c}))||u.toString(),p={days:(c.getTime()-h.getTime()+1)/864e5,startDate:h,endDate:c,step:s,unit:"week",title:d,dateIndex:u};a.push(p),t.setTime(Md(t.getTime()+24*(7*s-l)*60*60*1e3,!0).getTime())}else if("hour"===n){const r=t.getFullYear(),i=t.getMonth(),n=t.getDate(),l=t.getHours(),h=Id(new Date(r,i,n,l+s-1),!0);h.getTime()>e.getTime()&&h.setTime(e.getTime());const c=t,u=(null==o?void 0:o({dateIndex:l,startDate:c,endDate:h}))||l.toString(),d={days:Math.abs(h.getTime()-t.getTime()+1)/864e5,startDate:c,endDate:h,step:s,unit:"hour",title:u,dateIndex:t.getHours()};a.push(d),t=new Date(r,i,n,l+s)}else if("minute"===n){const r=t.getFullYear(),i=t.getMonth(),n=t.getDate(),l=t.getHours(),h=t.getMinutes(),c=Nd(new Date(r,i,n,l,h+s-1),!0);c.getTime()>e.getTime()&&c.setTime(e.getTime());const u=t,d=(null==o?void 0:o({dateIndex:h,startDate:u,endDate:c}))||h.toString(),p={days:Math.abs(c.getTime()-t.getTime()+1)/864e5,startDate:u,endDate:c,step:s,unit:"minute",title:d,dateIndex:t.getMinutes()};a.push(p),t=new Date(r,i,n,l,h+s)}else if("second"===n){const r=t.getFullYear(),i=t.getMonth(),n=t.getDate(),l=t.getHours(),h=t.getMinutes(),c=t.getSeconds(),u=Fd(new Date(r,i,n,l,h,c+s-1),!0);u.getTime()>e.getTime()&&u.setTime(e.getTime());const d=t,p=(null==o?void 0:o({dateIndex:c,startDate:d,endDate:u}))||c.toString(),f={days:Math.abs(u.getTime()-t.getTime()+1)/864e5,startDate:d,endDate:u,step:s,unit:"second",title:p,dateIndex:t.getSeconds()};a.push(f),t=new Date(r,i,n,l,h,c+s)}return a}function ep(t,e,r,i,n){var s,o,a,l,h,c,u,d,p;let f=null!==(s=t[3])&&void 0!==s?s:10;"right"===e||"end"===e?f=i-0-(null!==(o=t[1])&&void 0!==o?o:10):"center"===e&&(f=0+(i-0+(null!==(a=t[3])&&void 0!==a?a:10)-(null!==(l=t[1])&&void 0!==l?l:10))/2);let g=0+(null!==(h=t[0])&&void 0!==h?h:10);return"bottom"===r||"alphabetic"===r||"ideographic"===r?g=n-0-(null!==(c=t[2])&&void 0!==c?c:10):"middle"===r&&(g=0+(n-0-(null!==(u=t[0])&&void 0!==u?u:10)-(null!==(d=t[2])&&void 0!==d?d:10))/2+(null!==(p=t[0])&&void 0!==p?p:10)),{x:f,y:g}}function rp(t){if(t.verticalSplitResizeLine){t.verticalSplitResizeLine.style.position="absolute",t.verticalSplitResizeLine.style.top=t.tableY+"px",t.verticalSplitResizeLine.style.left=-1!==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 ip(t,e,r,i="children"){var n;for(let s=0;s<t.length;s++){if(Array.isArray(r)&&1===r.length&&t[s][e]===r[0]||t[s][e]===r)return{record:t[s],index:[s]};if(null===(n=t[s][i])||void 0===n?void 0:n.length)if(Array.isArray(r)&&r[0]===t[s][e]){const n=ip(t[s][i],e,r.slice(1));if(n)return n.index.unshift(s),n}else if(!Array.isArray(r)){const n=ip(t[s][i],e,r);if(n)return n.index.unshift(s),n}}}function np(t,e="children"){var r;for(let i=0;i<t.length;i++)(null===(r=t[i][e])||void 0===r?void 0:r.length)?np(t[i][e],e):(delete t[i].vtable_gantt_linkedTo,delete t[i].vtable_gantt_linkedFrom)}function sp(t,e="children"){var r;for(let i=0;i<t.length;i++)(null===(r=t[i][e])||void 0===r?void 0:r.length)?sp(t[i][e],e):delete t[i].vtable_gantt_showIndex}function op(t,e){var r;let i,n;if(e.taskListTableInstance){const s=e.taskListTableInstance.getTargetRowAt(t+e.headerHeight);if(s){const{row:o}=s;i=o-e.taskListTableInstance.columnHeaderLevelCount;const a=e.getRowsHeightByIndex(0,i-1);if(e.parsedOptions.tasksShowMode===Sd.Sub_Tasks_Inline||e.parsedOptions.tasksShowMode===Sd.Sub_Tasks_Arrange||e.parsedOptions.tasksShowMode===Sd.Sub_Tasks_Compact||e.parsedOptions.tasksShowMode===Sd.Sub_Tasks_Separate)n=Math.floor((t-a)/e.parsedOptions.rowHeight);else if(e.parsedOptions.tasksShowMode===Sd.Project_Sub_Tasks_Inline){const s=e.getRecordByIndex(i);s&&s.type===Td.PROJECT&&(null===(r=s.children)||void 0===r?void 0:r.length)>0&&("expand"===s.hierarchyState||!1===e.parsedOptions.projectSubTasksExpandable||(n=Math.floor((t-a)/e.parsedOptions.rowHeight)))}}}else i=Math.floor(t/e.parsedOptions.rowHeight);return{task_index:i,sub_task_index:n}}function ap(t,e,r,i){return r.some((r=>{const{startDate:n,endDate:s}=lp(i,r);return t<=s&&n<=e}))}function lp(t,e){const{timeScaleIncludeHour:r,startDateField:i,endDateField:n}=t.parsedOptions,s=e[i],o=e[n];return r?{startDate:Md(s),endDate:jd(o)}:{startDate:Md(s,!0),endDate:jd(o,!0)}}function hp(t){const e=t.options;t.parsedOptions.markLine=Qd(null==e?void 0:e.markLine)}function cp(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 up{constructor(t){this._scene=t,this.initNodes()}initNodes(){var t,e,r,i,n,s,o,a,l;const{_scene:h}=this,c=new ta({x:0,y:0,width:h._gantt.getAllDateColsWidth(),height:h._gantt.getAllHeaderRowsHeight(),clip:!0,pickable:!1});this.group=c,c.name="date-header-container",h.ganttGroup.addChild(this.group);const{unit:u,step:d}=h._gantt.parsedOptions.reverseSortedTimelineScales[0];let p=0;for(let f=0;f<h._gantt.timeLineHeaderLevel;f++){const{timelineDates:g,customLayout:m,visible:y}=h._gantt.parsedOptions.sortedTimelineScales[f];if(!1===y)continue;const v=new ta({x:0,y:p,width:h._gantt.getAllDateColsWidth(),height:h._gantt.parsedOptions.timeLineHeaderRowHeights[f],clip:!1});p+=v.attribute.height,v.name="row-header",c.addChild(v);for(let s=0;s<(null==g?void 0:g.length);s++){const{days:o,endDate:a,startDate:l,title:c,dateIndex:p,unit:y}=g[s],b=Math.ceil(Wd(l,h._gantt.parsedOptions.minDate,u,d)*h._gantt.parsedOptions.timelineColWidth),_=Math.ceil(Wd(a,h._gantt.parsedOptions.minDate,u,d,1)*h._gantt.parsedOptions.timelineColWidth)-b,w=new ta({x:b,y:0,width:_,height:v.attribute.height,clip:!1,fill:h._gantt.parsedOptions.timelineHeaderBackgroundColor});let x;w.name="date-header-cell";let S=!0;const T=v.attribute.height;if(m){let e;e="function"==typeof m?m({width:_,height:T,index:s,startDate:l,endDate:a,days:o,dateIndex:p,title:c,ganttInstance:this._scene._gantt}):m,e&&(x=e.rootContainer,S=null!==(t=e.renderDefaultText)&&void 0!==t&&t,x.name="task-bar-custom-render"),x&&w.appendChild(x)}if(S){const{padding:t,textAlign:e,textBaseline:r,textOverflow:i,fontSize:n,fontWeight:s,color:o,strokeColor:a,textStick:l}=h._gantt.parsedOptions.timelineHeaderStyles[f],u=ep(Pd(t),e,r,_,T),d=new Fa({x:u.x,y:u.y,maxLineWidth:_,heightLimit:T,pickable:!0,text:c.toLocaleString(),fontSize:n,fontWeight:s,fill:o,stroke:a,lineWidth:2,textAlign:e,textBaseline:r,ellipsis:"clip"===i?"":"ellipsis"===i?"...":ld(i)?i:void 0});d.attribute.textStick=l,w.appendChild(d),d.name="date-header-cell-text"}if(f===h._gantt.timeLineHeaderLevel-1&&h._gantt.parsedOptions.markLineCreateOptions&&h._gantt.parsedOptions.markLineCreateOptions.markLineCreatable){const t=h._gantt.parsedOptions.markLineCreateOptions.markLineCreationStyle||{},e=t.size||24,r=t.iconSize||18,i=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>',n=new ta({x:_/2-e/2,y:T/2-e/2,width:e,height:e,visiable:!0});n.name="markline-hover-group",n.data=g[s];const o=new ta({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});o.name="markline-hover-inner-group",n.add(o);const a=new Za({width:r,height:r,image:i,cursor:"pointer",pickable:!0});a.name="markline-hover-icon",o.appendChild(a),w.add(n)}if(v.addChild(w),s>0){const t=Va({pickable:!1,stroke:null===(e=h._gantt.parsedOptions.timelineHeaderVerticalLineStyle)||void 0===e?void 0:e.lineColor,lineWidth:null===(r=h._gantt.parsedOptions.timelineHeaderVerticalLineStyle)||void 0===r?void 0:r.lineWidth,points:[{x:1&(null===(i=h._gantt.parsedOptions.timelineHeaderVerticalLineStyle)||void 0===i?void 0:i.lineWidth)?.5:0,y:0},{x:1&(null===(n=h._gantt.parsedOptions.timelineHeaderVerticalLineStyle)||void 0===n?void 0:n.lineWidth)?.5:0,y:v.attribute.height}]});w.appendChild(t)}}if(f>0){const t=Va({pickable:!1,stroke:null===(s=h._gantt.parsedOptions.timelineHeaderHorizontalLineStyle)||void 0===s?void 0:s.lineColor,lineWidth:null===(o=h._gantt.parsedOptions.timelineHeaderHorizontalLineStyle)||void 0===o?void 0:o.lineWidth,points:[{x:0,y:1&(null===(a=h._gantt.parsedOptions.timelineHeaderHorizontalLineStyle)||void 0===a?void 0:a.lineWidth)?.5:0},{x:h._gantt.getAllDateColsWidth(),y:1&(null===(l=h._gantt.parsedOptions.timelineHeaderHorizontalLineStyle)||void 0===l?void 0:l.lineWidth)?.5:0}]});v.addChild(t)}}}setX(t){this.group.setAttribute("x",t)}setY(t){this.group.setAttribute("y",t)}resize(){var t,e,r,i;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!==(i=null===(r=this.group.attribute)||void 0===r?void 0:r.height)&&void 0!==i?i: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 dp extends ta{constructor(t){super(t),this._lastWidth=t.width,this._lastHeight=t.height,this._lastX=t.x,this._lastY=t.y}updateTextPosition(){var t,r,i;if(!this.textLabel||!this.barRect)return;const n=this.labelStyle||{},{textAlign:s="left",textBaseline:o="middle",textOverflow:a,color:l="#333333",outsideColor:h="#333333",padding:c=8}=n,u=Array.isArray(c)?c[3]:c,d=this.barRect.attribute.width,p=this.barRect.attribute.height,f=this.textLabel.attribute.fontSize||12,g=this.textLabel.attribute.fontFamily||"Arial",m=String(this.textLabel.attribute.text||""),y=e.textMeasure.measureTextWidth(m,{fontSize:f,fontFamily:g})+2*u<=d,v=ep(Pd(u),s,o,d,p),b=n.orient||(!y&&n.orientHandleWithOverflow?n.orientHandleWithOverflow:null);if(this.textLabel.setAttribute("visible",!0),this.textLabel.setAttribute("textBaseline",o),b){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:-u,y:p/2,align:"right",baseline:"middle"},right:{x:d+u,y:p/2,align:"left",baseline:"middle"},top:{x:d/2,y:-u,align:"center",baseline:"bottom"},bottom:{x:d/2,y:p+u,align:"center",baseline:"top"}}[b];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===(r=this.textLabel.parent)||void 0===r||r.removeChild(this.textLabel),null===(i=this.clipGroupBox)||void 0===i||i.appendChild(this.textLabel),this.textLabel.setAttribute("x",v.x),this.textLabel.setAttribute("y",v.y),this.textLabel.setAttribute("textAlign",s),this.textLabel.setAttribute("fill",l),this.textLabel.setAttribute("maxLineWidth",d-u),this.textLabel.setAttribute("ellipsis","clip"===a?"":"ellipsis"===a?"...":ld(a)?a:void 0)}}const pp='<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 fp{formatMilestoneText(t,e){if(!t)return"";const r=t.match(/{([^}]+)}/g);return r&&r.forEach((r=>{const i=r.substring(1,r.length-1),n=e[i];void 0!==n&&(t=t.replace(r,String(n)))})),t}calculateMilestoneTextPosition(t,e,r=4){const i="number"==typeof r?r:4;let n=0,s=0,o="left",a="middle";const l=e/2;switch(t){case"left":n=-i,s=l,o="end",a="middle";break;case"right":default:n=e+i,s=l,o="start",a="middle";break;case"top":n=l,s=-i,o="center",a="bottom";break;case"bottom":n=l,s=e+i,o="center",a="top"}return{textX:n,textY:s,textAlignValue:o,textBaselineValue:a}}constructor(t){this.selectedBorders=[],this._scene=t,this.width=t._gantt.tableNoFrameWidth,this.height=t._gantt.gridHeight,this.group=new ta({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,r;this.barContainer=new ta({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 i=0;i<this._scene._gantt.itemCount;i++)if(this._scene._gantt.parsedOptions.tasksShowMode!==Sd.Sub_Tasks_Inline&&this._scene._gantt.parsedOptions.tasksShowMode!==Sd.Sub_Tasks_Separate&&this._scene._gantt.parsedOptions.tasksShowMode!==Sd.Sub_Tasks_Arrange&&this._scene._gantt.parsedOptions.tasksShowMode!==Sd.Sub_Tasks_Compact)if(this._scene._gantt.parsedOptions.tasksShowMode!==Sd.Project_Sub_Tasks_Inline){const t=this.initBar(i);t&&this.barContainer.appendChild(t)}else{const t=this._scene._gantt.getRecordByIndex(i),e="expand"===t.hierarchyState;if(t.type===Td.PROJECT&&(null===(r=t.children)||void 0===r?void 0:r.length)>0&&!e){const e=this._scene._gantt.getRecordIndexByTaskShowIndex(i),r=Array.isArray(e)?[...e]:[e],n=(t,e)=>{var r,s;if((null===(r=t.children)||void 0===r?void 0:r.length)>0)for(let r=0;r<(null===(s=t.children)||void 0===s?void 0:s.length);r++){const s=t.children[r];if(s.type!==Td.PROJECT){const n=this.initBar(i,[...e,r],t.children.length);n&&this.barContainer.appendChild(n)}else n(s,[...e,r])}};n(t,r)}else{const t=this.initBar(i);t&&this.barContainer.appendChild(t)}}else{const r=this._scene._gantt.getRecordByIndex(i);if((null===(t=r.children)||void 0===t?void 0:t.length)>0)for(let t=0;t<(null===(e=r.children)||void 0===e?void 0:e.length);t++){const e=this.initBar(i,t,r.children.length);e&&this.barContainer.appendChild(e)}else{const t=this.initBar(i);t&&this.barContainer.appendChild(t)}}}initBar(t,e,r){var i,n,s,o,a;const l=this._scene._gantt.parsedOptions.taskBarCustomLayout,{startDate:h,endDate:c,taskDays:u,progress:d,taskRecord:p}=this._scene._gantt.getTaskInfoByTaskListIndex(t,e),f=p.type===Td.MILESTONE;if(f&&!h||!f&&(u<=0||!h||!c||h.getTime()>c.getTime()))return null;const{unit:g,step:m}=this._scene._gantt.parsedOptions.reverseSortedTimelineScales[0];let y=Wd(c,h,g,m,1)*this._scene._gantt.parsedOptions.timelineColWidth;const v=this._scene._gantt.getTaskBarStyle(t,e),b=v.width;ld(v.minSize)&&(y=Math.max(y,v.minSize));const _=this._scene._gantt.parsedOptions.rowHeight,w=this._scene._gantt.parsedOptions.taskBarMilestoneStyle.width,x=Wd(h,this._scene._gantt.parsedOptions.minDate,g,m)*this._scene._gantt.parsedOptions.timelineColWidth-(f?w/2:0),S=this._scene._gantt.getRowsHeightByIndex(0,t-1)+(this._scene._gantt.parsedOptions.tasksShowMode===Sd.Sub_Tasks_Separate?(null!==(i=e)&&void 0!==i?i:0)*_:this._scene._gantt.parsedOptions.tasksShowMode===Sd.Sub_Tasks_Arrange||this._scene._gantt.parsedOptions.tasksShowMode===Sd.Sub_Tasks_Compact?p.vtable_gantt_showIndex*_:0)+(_-(f?w:b))/2,T=new dp({x:x,y:S,width:f?w:y,height:f?w:b,cornerRadius:f?this._scene._gantt.parsedOptions.taskBarMilestoneStyle.cornerRadius:v.cornerRadius,lineWidth:f?2*this._scene._gantt.parsedOptions.taskBarMilestoneStyle.borderLineWidth:2*(null!==(n=v.borderLineWidth)&&void 0!==n?n:v.borderWidth),stroke:f?this._scene._gantt.parsedOptions.taskBarMilestoneStyle.borderColor:v.borderColor,angle:f?.25*Math.PI:0,anchor:f?[x+w/2,S+w/2]:void 0});T.name="task-bar",T.task_index=t,T.sub_task_index=e,T.record=p;const k=new ta({x:0,y:0,width:T.attribute.width,height:T.attribute.height,cornerRadius:f?this._scene._gantt.parsedOptions.taskBarMilestoneStyle.cornerRadius:v.cornerRadius,clip:!0});let C;k.name="task-bar-group",T.appendChild(k),T.clipGroupBox=k;let E=!0,A=!0;if(l){let e;e="function"==typeof l?l({width:y,height:b,index:t,startDate:h,endDate:c,taskDays:u,progress:d,taskRecord:p,ganttInstance:this._scene._gantt}):l,e&&(C=e.rootContainer,E=null!==(s=e.renderDefaultBar)&&void 0!==s&&s,A=null!==(o=e.renderDefaultText)&&void 0!==o&&o,C&&(C.name="task-bar-custom-render"))}if(E){const t=Ya({x:0,y:0,width:T.attribute.width,height:T.attribute.height,fill:f?this._scene._gantt.parsedOptions.taskBarMilestoneStyle.fillColor:v.barColor,pickable:!1});if(t.name="task-bar-rect",k.appendChild(t),T.barRect=t,p.type!==Td.MILESTONE){const t=Ya({x:0,y:0,width:y*d/100,height:b,fill:v.completedBarColor,pickable:!1});t.name="task-bar-progress-rect",k.appendChild(t),T.progressRect=t}}if(C&&k.appendChild(C),A&&p.type!==Td.MILESTONE){const{textAlign:t,textBaseline:e,fontSize:r,fontFamily:i,textOverflow:n,color:s,padding:o}=this._scene._gantt.parsedOptions.taskBarLabelStyle,a=ep(Pd(o),t,e,y,b),l=ja({x:a.x,y:a.y,fontSize:r,fill:s,fontFamily:i,text:(O=this._scene._gantt.parsedOptions.taskBarLabelText,B=p,O.replace(/\{([^}]+)\}/g,((t,e)=>{const r=e.split(".");let i=B;for(const e of r){if(!i.hasOwnProperty(e)){i=t;break}i=i[e]}return i}))),maxLineWidth:y-10,textBaseline:e,textAlign:t,ellipsis:"clip"===n?"":"ellipsis"===n?"...":ld(n)?n:void 0,poptip:{position:"bottom"}});k.appendChild(l),T.textLabel=l,T.labelStyle=this._scene._gantt.parsedOptions.taskBarLabelStyle,T.updateTextPosition()}var O,B;if(A&&"milestone"===p.type&&this._scene._gantt.parsedOptions.taskBarMilestoneStyle.labelText){const t=this._scene._gantt.parsedOptions.taskBarMilestoneStyle,e=t.labelTextStyle||{},r=this.calculateMilestoneTextPosition(t.textOrient||"right",t.width,null!==(a=e.padding)&&void 0!==a?a:4),i=new ta({x:x,y:S,width:t.width,height:t.width,angle:0,pickable:!1}),n=ja({x:r.textX,y:r.textY,fontSize:e.fontSize||16,fontFamily:e.fontFamily||"Arial",fill:e.color||"#ff0000",textBaseline:e.textBaseline||r.textBaselineValue,textAlign:e.textAlign||r.textAlignValue,text:this.formatMilestoneText(t.labelText,p),pickable:!1});i.appendChild(n),this.barContainer.appendChild(i),T.milestoneTextLabel=n,T.milestoneTextContainer=i}return T}updateTaskBarNode(t,e){const r=this.getTaskBarNodeByIndex(t,e);r&&this.barContainer.removeChild(r);const i=this.initBar(t,e);i&&(this.barContainer.insertInto(i,t),i.updateTextPosition())}initHoverBarIcons(){var t,e;const r=new ta({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:qd.cornerRadius)&&void 0!==e?e:0,fill:this._scene._gantt.parsedOptions.taskBarHoverStyle.barOverlayColor,visibleAll:!1});if(this.hoverBarGroup=r,r.name="task-bar-hover-shadow",this._scene._gantt.parsedOptions.taskBarResizable){const t=new Za({x:0,y:0,width:10,height:20,image:pp,pickable:!0,cursor:"col-resize"});t.name="task-bar-hover-shadow-left-icon",this.hoverBarLeftIcon=t,r.appendChild(t);const e=new Za({x:0,y:0,width:10,height:20,image:pp,pickable:!0,cursor:"col-resize"});e.name="task-bar-hover-shadow-right-icon",this.hoverBarRightIcon=e,r.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,r,i,n){var s,o,a,l;const{startDate:h,endDate:c,taskRecord:u}=this._scene._gantt.getTaskInfoByTaskListIndex(n.task_index,n.sub_task_index);n&&"task-bar"===n.name&&n.appendChild(this.hoverBarGroup),this.hoverBarGroup.setAttribute("x",0),this.hoverBarGroup.setAttribute("y",0),this.hoverBarGroup.setAttribute("width",r),this.hoverBarGroup.setAttribute("height",i),this.hoverBarGroup.setAttribute("visibleAll",!0);const d=this._scene._gantt.getTaskBarStyle(n.task_index,n.sub_task_index);if(u.type===Td.MILESTONE)this.hoverBarGroup.setAttribute("cornerRadius",n.attribute.cornerRadius);else{const t=null!==(o=null!==(s=this._scene._gantt.parsedOptions.taskBarHoverStyle.cornerRadius)&&void 0!==s?s:d.cornerRadius)&&void 0!==o?o:0;this.hoverBarGroup.setAttribute("cornerRadius",t)}null===(a=this.hoverBarLeftIcon)||void 0===a||a.setAttribute("visible",!1),null===(l=this.hoverBarRightIcon)||void 0===l||l.setAttribute("visible",!1);let p=!0,f=!0;if(u.type===Td.MILESTONE)p=!1,f=!1;else if("function"==typeof this._scene._gantt.parsedOptions.taskBarResizable){const t={index:n.task_index,startDate:h,endDate:c,taskRecord:u,ganttInstance:this._scene._gantt},e=this._scene._gantt.parsedOptions.taskBarResizable(t);Array.isArray(e)?[p,f]=e:(p=e,f=e)}else Array.isArray(this._scene._gantt.parsedOptions.taskBarResizable)?[p,f]=this._scene._gantt.parsedOptions.taskBarResizable:(p=this._scene._gantt.parsedOptions.taskBarResizable,f=this._scene._gantt.parsedOptions.taskBarResizable);p&&this.hoverBarLeftIcon.setAttribute("visible",!0),f&&this.hoverBarRightIcon.setAttribute("visible",!0),this.hoverBarLeftIcon&&(this.hoverBarLeftIcon.setAttribute("x",0),this.hoverBarLeftIcon.setAttribute("y",Math.ceil(i/10)),this.hoverBarLeftIcon.setAttribute("width",10),this.hoverBarLeftIcon.setAttribute("height",i-2*Math.ceil(i/10)),this.hoverBarRightIcon.setAttribute("x",r-10),this.hoverBarRightIcon.setAttribute("y",Math.ceil(i/10)),this.hoverBarRightIcon.setAttribute("width",10),this.hoverBarRightIcon.setAttribute("height",i-2*Math.ceil(i/10)))}hideHoverBar(){this.hoverBarGroup.setAttribute("visibleAll",!1)}createSelectedBorder(t,e,r,i,n,s=!1){const o=n.record,a=new ta({x:t,y:e,width:r,height:i,pickable:!1,attachedToTaskBarNode:n,zIndex:1e4});a.name="task-bar-select-border",this.barContainer.appendChild(a),this.selectedBorders.push(a);const l=new ta({x:0,y:0,width:r,height:i,lineWidth:this._scene._gantt.parsedOptions.taskBarSelectedStyle.borderLineWidth,pickable:!1,cornerRadius:n.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:n.attribute.angle,anchor:[r/2,i/2]});if(a.appendChild(l),s){const t=o.type===Td.MILESTONE?15:10,e=new ta({x:-t,y:0,width:10,height:i,pickable:!0}),n=new Ma({x:5,y:i/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(n),e.name="task-bar-link-point-left",a.appendChild(e);const s=new ta({x:r+(t-10),y:0,width:10,height:i,pickable:!0}),l=new Ma({x:5,y:i/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});s.appendChild(l),s.name="task-bar-link-point-right",a.appendChild(s)}}removeSelectedBorder(){this.selectedBorders.forEach((t=>{t.delete()})),this.selectedBorders=[]}removeSecondSelectedBorder(){2===this.selectedBorders.length&&this.selectedBorders.pop().delete()}updateCreatingDependencyLine(t,e,r,i){this.creatingDependencyLine&&(this.creatingDependencyLine.delete(),this.creatingDependencyLine=void 0);const n=new $a({points:[{x:t,y:e},{x:r,y:i}],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=n,this.selectedBorders[0].appendChild(n)}getTaskBarNodeByIndex(t,e){let r=this.barContainer.firstChild;if(!r)return null;for(let i=0;i<this.barContainer.childrenCount;i++){if(r.task_index===t&&(!ld(e)||ld(e)&&r.sub_task_index===e))return r;r=r._next}return null}}class gp{constructor(t){this.markLineContainerWidth=20,this._scene=t,this.height=Math.min(t._gantt.tableNoFrameHeight,t._gantt.drawHeight)-t._gantt.getAllHeaderRowsHeight(),this.group=new ta({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 ta({x:0,y:0,width:this._scene._gantt.getAllDateColsWidth(),height:this.height,pickable:!1,clip:!0}),this.group.appendChild(this.markLIneContainer),this.initMarkLines()}initMarkLines(){const t=this._scene._gantt.parsedOptions.markLine,e=this._scene._gantt.parsedOptions.minDate;e&&t.forEach((t=>{const r=t.style,i=t.contentStyle||{},n=this._scene._gantt.parsedOptions.timeScaleIncludeHour?Md(t.date):Md(t.date,!0),{unit:s,step:o}=this._scene._gantt.parsedOptions.reverseSortedTimelineScales[0],a=Wd(n,e,s,o);let l=0;if("right"===t.position)l=1;else if("middle"===t.position)l=.5;else if("date"===t.position){const r=Wd(Md(t.date),e,s,o);l=r-Math.floor(r)}const h=this._scene._gantt.parsedOptions.timelineColWidth*(Math.floor(a)+l),c=new ta({pickable:!1,x:h-this.markLineContainerWidth/2,y:0,width:this.markLineContainerWidth,height:this.height});c.name="mark-line",this.markLIneContainer.appendChild(c);const u=Va({pickable:!1,stroke:r.lineColor,lineWidth:r.lineWidth,lineDash:r.lineDash,points:[{x:this.markLineContainerWidth/2,y:0},{x:this.markLineContainerWidth/2,y:this.height}]});if(c.appendChild(u),t.content){const e=this._scene._gantt.parsedOptions.timelineColWidth,n=i.lineHeight||18,s=new ta({x:this.markLineContainerWidth/2,y:0,cursor:"pointer",height:n,clip:!1,fill:i.backgroundColor||r.lineColor,display:"flex",cornerRadius:i.cornerRadius||[0,2,2,0]});s.name="mark-line-content",s.data=t,c.appendChild(s);const o=new Fa({maxLineWidth:e,text:t.content,cursor:"pointer",lineHeight:n,fontWeight:i.fontWeight||"normal",fill:i.color||r.lineColor,fontSize:i.fontSize||12,poptip:{position:"top",dx:e/4,dy:-n/4}});s.appendChild(o)}}))}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 mp{constructor(t){this._scene=t,this.createFrameBorder()}createFrameBorder(){var t,r,i,n,s,o;const a=this._scene.ganttGroup,l=this._scene._gantt.parsedOptions.outerFrameStyle;if(!l)return;const{cornerRadius:h,borderColor:c,borderLineWidth:u,borderLineDash:d}=l,p={},f={pickable:!1},g=e.toBoxArray(null!=u?u:0),m=[g[0],g[1],g[2],this._scene._gantt.taskListTableInstance?0:g[3]];f.stroke=!0,f.fill=!1,f.stroke=c,f.lineWidth=Math.max(...m),f.strokeArrayWidth=m,d&&(f.lineDash=d),f.lineCap="butt";const y=!!this._scene._gantt.taskListTableInstance;f.x=y?0:m[3]/2,f.y=m[0]/2;const v=null!==(r=null===(t=this._scene._gantt.parsedOptions.verticalSplitLine)||void 0===t?void 0:t.lineWidth)&&void 0!==r?r:0;if(f.width=a.attribute.width+m[3]/2+m[1]/2+(y?v:0),f.height=a.attribute.height+m[0]/2+m[2]/2,h){const t=Array.isArray(h)?h:[h,h,h,h];this._scene._gantt.taskListTableInstance?(f.cornerRadius=[0,null!==(i=t[1])&&void 0!==i?i:0,null!==(n=t[2])&&void 0!==n?n:0,0],p.cornerRadius=[0,null!==(s=t[1])&&void 0!==s?s:0,null!==(o=t[2])&&void 0!==o?o:0,0]):(f.cornerRadius=t,p.cornerRadius=t)}if(a.setAttributes(p),f.stroke){const t=Ya(f);t.name="border-rect",a.parent.insertAfter(t,a),this.border=t,a.border=t}}refresh(){this.border&&this.border.parent&&this.border.parent.removeChild(this.border),this.createFrameBorder()}resize(){var t,r,i;const{borderLineWidth:n}=this._scene._gantt.parsedOptions.outerFrameStyle,s=e.toBoxArray(null!=n?n:0),o=[s[0],s[1],s[2],this._scene._gantt.taskListTableInstance?0:s[3]],a=null!==(r=null===(t=this._scene._gantt.parsedOptions.verticalSplitLine)||void 0===t?void 0:t.lineWidth)&&void 0!==r?r:0,l=!!this._scene._gantt.taskListTableInstance;null===(i=this.border)||void 0===i||i.setAttributes({x:l?0:o[3]/2,y:o[0]/2,width:this._scene.ganttGroup.attribute.width+o[3]/2+o[1]/2+(l?a:0),height:this._scene.ganttGroup.attribute.height+o[0]/2+o[2]/2}),this.border.strokeArrayWidth=o}}var yp=function(t,e,r,i){var n,s=arguments.length,o=s<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,e,r,i);else for(var a=t.length-1;a>=0;a--)(n=t[a])&&(o=(s<3?n(o):s>3?n(e,r,o):n(e,r))||o);return s>3&&o&&Object.defineProperty(e,r,o),o};let vp=class{constructor(){this.time=Je.beforeFillStroke,this.useStyle=!0,this.order=0,this.supportedAppName="vtable"}drawShape(t,e,r,i,n,s,o,a,l,h,c,u,d){"date-header-cell"===t.name&&t.forEachChildren((t=>{var e;if("date-header-cell-text"===t.name&&!0===t.attribute.textStick){const r=t;r.setAttribute("dx",0);const i=r.globalAABBBounds,n=r.stage.globalAABBBounds,s=r.parent.globalAABBBounds,o=n.intersect(s);n.intersect(s)&&(i.width()>=o.width()&&r.attribute.last_dx?r.setAttribute("dx",null!==(e=r.attribute.last_dx)&&void 0!==e?e:0):n.x1>=i.x1?(r.setAttribute("dx",n.x1-i.x1),r.setAttribute("last_dx",n.x1-i.x1)):n.x2<=i.x2&&(r.setAttribute("dx",n.x2-i.x2),r.setAttribute("last_dx",n.x1-i.x1)))}}))}};vp=yp([L()],vp);var bp=new v(((t,e,r,i)=>{t(vp).toSelf().inSingletonScope(),t(wa).toService(vp)}));class _p{constructor(t){this._scene=t,this.createAddButton()}createAddButton(){var t;this._scene._gantt.parsedOptions.taskBarCreationCustomLayout?this.group=new ta({x:0,y:0,width:100,height:100}):(this.group=new ta({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=Va({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=Va({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,r,i){if(this._scene._gantt.parsedOptions.taskBarCreationCustomLayout)this.group.appendChild(this._scene._gantt.parsedOptions.taskBarCreationCustomLayout({width:r,height:i,ganttInstance:this._scene._gantt}).rootContainer);else{const t=Math.min(r,i)/6;this.lineHorizontal.setAttribute("points",[{x:(r-4*t)/2,y:i/2},{x:(r-4*t)/2+4*t,y:i/2}]),this.lineVertical.setAttribute("points",[{x:r/2,y:(i-4*t)/2},{x:r/2,y:(i-4*t)/2+4*t}])}this.group.setAttribute("x",t),this.group.setAttribute("y",e),this.group.setAttribute("width",r),this.group.setAttribute("height",i),this.group.setAttribute("visibleAll",!0)}hide(){this.group.setAttribute("visibleAll",!1),this._scene._gantt.parsedOptions.taskBarCreationCustomLayout&&this.group.removeAllChild()}}class wp{constructor(t){this._scene=t,this.group=new id({position:"top",content:"",contentStyle:{fill:"#fff"},visible:!1,panel:{background:"#14161c",cornerRadius:4}}),t.ganttGroup.addChild(this.group)}show(t){var e,r,i;const n=(null===(e=this._scene._gantt.parsedOptions.markLineCreateOptions)||void 0===e?void 0:e.markLineCreationHoverToolTip)||{},s=t.globalTransMatrix,o=t.attribute.width,a=t.attribute.height;let l,h;const c=n.position||"top";"top"===c?(l=s.e+o/2-2,h=s.f):"bottom"===c&&(l=s.e+o/2-2,h=s.f+a);const u=(null===(r=n.style)||void 0===r?void 0:r.contentStyle)||{fill:"#fff"},d=(null===(i=n.style)||void 0===i?void 0:i.panelStyle)||{background:"#14161c",cornerRadius:4};this.group.setAttributes({content:n.tipContent,position:c,visibleAll:!0,visible:!0,contentStyle:u,panel:Object.assign(Object.assign({},d),{visible:!0}),x:l,y:h})}hide(){this.group.setAttributes({visibleAll:!1,visible:!1})}}class xp{constructor(t){this._scene=t,this.width=t._gantt.tableNoFrameWidth,this.height=t._gantt.gridHeight,this.group=new ta({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(np(this._scene._gantt.records),this.linkLinesContainer=new ta({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,r,i,n,s,o,a,l,h,c;const{taskKeyField:u,dependencyLinks:d}=this._scene._gantt.parsedOptions,p=d[t],{linkedToTaskKey:f,linkedFromTaskKey:g,type:m}=p,y=ip(this._scene._gantt.records,u,f),v=ip(this._scene._gantt.records,u,g);if(!y||!v)return;let b,_,w,x,S,T,k,C;if(y.record.vtable_gantt_linkedTo||(y.record.vtable_gantt_linkedTo=[]),y.record.vtable_gantt_linkedTo.push(p),v.record.vtable_gantt_linkedFrom||(v.record.vtable_gantt_linkedFrom=[]),v.record.vtable_gantt_linkedFrom.push(p),this._scene._gantt.parsedOptions.tasksShowMode===Sd.Sub_Tasks_Inline)C=v.index[0],k=y.index[0],({startDate:b,endDate:_,taskDays:w}=this._scene._gantt.getTaskInfoByTaskListIndex(y.index[0],y.index[1])),({startDate:x,endDate:S,taskDays:T}=this._scene._gantt.getTaskInfoByTaskListIndex(v.index[0],v.index[1]));else if(this._scene._gantt.parsedOptions.tasksShowMode===Sd.Project_Sub_Tasks_Inline){const t=this._scene._gantt.getTaskShowIndexByRecordIndex(v.index.slice(0,-1)),e=this._scene._gantt.getTaskShowIndexByRecordIndex(y.index.slice(0,-1)),r=this._scene._gantt.getRecordByIndex(t),i=this._scene._gantt.getRecordByIndex(e);C=r.type===Td.PROJECT&&"expand"!==r.hierarchyState&&!1!==this._scene._gantt.parsedOptions.projectSubTasksExpandable?t:this._scene._gantt.getTaskShowIndexByRecordIndex(v.index),k=i.type===Td.PROJECT&&"expand"!==i.hierarchyState&&!1!==this._scene._gantt.parsedOptions.projectSubTasksExpandable?e:this._scene._gantt.getTaskShowIndexByRecordIndex(y.index),({startDate:b,endDate:_,taskDays:w}=this._scene._gantt.getTaskInfoByTaskListIndex(k,y.index)),({startDate:x,endDate:S,taskDays:T}=this._scene._gantt.getTaskInfoByTaskListIndex(C,v.index))}else this._scene._gantt.parsedOptions.tasksShowMode===Sd.Sub_Tasks_Separate||this._scene._gantt.parsedOptions.tasksShowMode===Sd.Sub_Tasks_Arrange||this._scene._gantt.parsedOptions.tasksShowMode===Sd.Sub_Tasks_Compact?(C=this._scene._gantt.getRowsHeightByIndex(0,v.index[0]-1)/this._scene._gantt.parsedOptions.rowHeight+(this._scene._gantt.parsedOptions.tasksShowMode===Sd.Sub_Tasks_Arrange||this._scene._gantt.parsedOptions.tasksShowMode===Sd.Sub_Tasks_Compact?v.record.vtable_gantt_showIndex:null!==(e=v.index[1])&&void 0!==e?e:0),k=this._scene._gantt.getRowsHeightByIndex(0,y.index[0]-1)/this._scene._gantt.parsedOptions.rowHeight+(this._scene._gantt.parsedOptions.tasksShowMode===Sd.Sub_Tasks_Arrange||this._scene._gantt.parsedOptions.tasksShowMode===Sd.Sub_Tasks_Compact?y.record.vtable_gantt_showIndex:null!==(r=y.index[1])&&void 0!==r?r:0),({startDate:b,endDate:_,taskDays:w}=this._scene._gantt.getTaskInfoByTaskListIndex(y.index[0],y.index[1])),({startDate:x,endDate:S,taskDays:T}=this._scene._gantt.getTaskInfoByTaskListIndex(v.index[0],v.index[1]))):(C=this._scene._gantt.getTaskShowIndexByRecordIndex(v.index),k=this._scene._gantt.getTaskShowIndexByRecordIndex(y.index),({startDate:b,endDate:_,taskDays:w}=this._scene._gantt.getTaskInfoByTaskListIndex(k)),({startDate:x,endDate:S,taskDays:T}=this._scene._gantt.getTaskInfoByTaskListIndex(C)));if(!T||!w)return;Md(this._scene._gantt.parsedOptions.minDate);const{arrowPoints:E,linePoints:A}=function(t,e,r,i,n,s,o,a,l,h,c,u){const{unit:d,step:p}=u.parsedOptions.reverseSortedTimelineScales[0],{minDate:f,rowHeight:g,timelineColWidth:m}=u.parsedOptions,y=u.parsedOptions.taskBarMilestoneHypotenuse;let v=[],b=[];if(t===xd.FinishToStart){let t=Wd(r,f,d,p,1)*m;s&&(t=Wd(e,f,d,p,1)*m+y/2);let n=Wd(o,f,d,p)*m;c&&(n-=y/2),v=[{x:t,y:g*(i+.5)},{x:t+20,y:g*(i+.5)},{x:t+20,y:g*(i+(i>l?0:1))},{x:n-20,y:g*(i+(i>l?0:1))},{x:n-20,y:g*(l+.5)},{x:n,y:g*(l+.5)}],t+20<=n-20&&v.splice(2,3,{x:t+20,y:g*(l+.5)});const a=v[v.length-1];b=[{x:a.x,y:a.y},{x:a.x-10,y:a.y-5},{x:a.x-10,y:a.y+5},{x:a.x,y:a.y}]}else if(t===xd.StartToFinish){let t=Wd(e,f,d,p)*m;s&&(t-=y/2);let r=Wd(a,f,d,p,1)*m;c&&(r=Wd(o,f,d,p,1)*m+y/2),v=[{x:t,y:g*(i+.5)},{x:t-20,y:g*(i+.5)},{x:t-20,y:g*(i+(i>l?0:1))},{x:r+20,y:g*(i+(i>l?0:1))},{x:r+20,y:g*(l+.5)},{x:r,y:g*(l+.5)}],t-20>=r+20&&v.splice(2,3,{x:t-20,y:g*(l+.5)});const n=v[v.length-1];b=[{x:n.x,y:n.y},{x:n.x+10,y:n.y-5},{x:n.x+10,y:n.y+5},{x:n.x,y:n.y}]}else if(t===xd.StartToStart){let t=Wd(e,f,d,p)*m;s&&(t-=y/2);let r=Wd(o,f,d,p)*m;c&&(r-=y/2),v=[{x:t,y:g*(i+.5)},{x:(i===l?t:Math.min(t,r))-20,y:g*(i+.5)},{x:(i===l?t:Math.min(t,r))-20,y:g*(l+(i===l?1:.5))},{x:r-20,y:g*(l+(i===l?1:.5))},{x:(i===l?r:Math.min(t,r))-20,y:g*(l+.5)},{x:r,y:g*(l+.5)}];const n=v[v.length-1];b=[{x:n.x,y:n.y},{x:n.x-10,y:n.y-5},{x:n.x-10,y:n.y+5},{x:n.x,y:n.y}]}else if(t===xd.FinishToFinish){let t=Wd(r,f,d,p,1)*m;s&&(t=Wd(e,f,d,p,1)*m+y/2);let n=Wd(a,f,d,p,1)*m;c&&(n=Wd(o,f,d,p,1)*m+y/2),v=[{x:t,y:g*(i+.5)},{x:(i===l?t:Math.max(t,n))+20,y:g*(i+.5)},{x:(i===l?t:Math.max(t,n))+20,y:g*(l+(i===l?1:.5))},{x:n+20,y:g*(l+(i===l?1:.5))},{x:n+20,y:g*(l+.5)},{x:n,y:g*(l+.5)}];const h=v[v.length-1];b=[{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:v,arrowPoints:b}}(m,x,S,C,0,v.record.type===Td.MILESTONE,b,_,k,0,y.record.type===Td.MILESTONE,this._scene._gantt),O=this._scene._gantt.parsedOptions.dependencyLinkLineStyle,B=Va({pickable:!0,stroke:null!==(n=null===(i=p.linkLineStyle)||void 0===i?void 0:i.lineColor)&&void 0!==n?n:O.lineColor,lineWidth:null!==(o=null===(s=p.linkLineStyle)||void 0===s?void 0:s.lineWidth)&&void 0!==o?o:O.lineWidth,lineDash:null!==(l=null===(a=p.linkLineStyle)||void 0===a?void 0:a.lineDash)&&void 0!==l?l:O.lineDash,points:A,pickStrokeBuffer:3,vtable_link:p});this.linkLinesContainer.appendChild(B),p.vtable_gantt_linkLineNode=B;const R=new Qa({fill:null!==(c=null===(h=p.linkLineStyle)||void 0===h?void 0:h.lineColor)&&void 0!==c?c:O.lineColor,points:E});this.linkLinesContainer.appendChild(R),p.vtable_gantt_linkArrowNode=R}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,r=t.vtable_gantt_linkArrowNode,i=e.clone(),n=r.clone();i.setAttribute("stroke",this._scene._gantt.parsedOptions.dependencyLinkSelectedLineStyle.lineColor),i.setAttribute("lineWidth",this._scene._gantt.parsedOptions.dependencyLinkSelectedLineStyle.lineWidth),i.setAttribute("shadowColor",this._scene._gantt.parsedOptions.dependencyLinkSelectedLineStyle.shadowColor),i.setAttribute("shadowOffsetX",this._scene._gantt.parsedOptions.dependencyLinkSelectedLineStyle.shadowOffset),i.setAttribute("shadowOffsetY",this._scene._gantt.parsedOptions.dependencyLinkSelectedLineStyle.shadowOffset),i.setAttribute("shadowBlur",this._scene._gantt.parsedOptions.dependencyLinkSelectedLineStyle.shadowBlur),this.linkLinesContainer.appendChild(i),n.setAttribute("fill",this._scene._gantt.parsedOptions.dependencyLinkSelectedLineStyle.lineColor),this.linkLinesContainer.appendChild(n),this.selectedEffectNodes=[i,n]}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,r=t.vtable_gantt_linkArrowNode;e.delete(),r.delete()}}function Sp(t,e,r,i,n,s,o,a,l,h,c,u,d,p,f,g){const{unit:m,step:y}=g.parsedOptions.reverseSortedTimelineScales[0],{minDate:v,rowHeight:b,timelineColWidth:_}=g.parsedOptions,w=g.parsedOptions.taskBarMilestoneHypotenuse,x=g.parsedOptions.taskBarMilestoneStyle.width;let S=[],T=[];if(t===xd.FinishToStart){let t=o?o.attribute.x+o.attribute.width:Wd(r,v,m,y,1)*_;s&&(t=o?o.attribute.x+o.attribute.width+(w-x)/2:Wd(e,v,m,y,1)*_+w/2);let n=p?p.attribute.x:Wd(l,v,m,y)*_;d&&(n-=(w-x)/2),S=[{x:t,y:b*(i+.5)+a},{x:t+20,y:b*(i+.5)+a},{x:t+20,y:b*(i+(i>c?0:1))+a},{x:n-20,y:b*(i+(i>c?0:1))+a},{x:n-20,y:b*(c+.5)+f},{x:n,y:b*(c+.5)+f}],t+20<=n-20&&S.splice(2,3,{x:t+20,y:b*(c+.5)+f});const h=S[S.length-1];T=[{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===xd.StartToFinish){let t=o?o.attribute.x:Wd(e,v,m,y)*_;s&&(t-=(w-x)/2);let r=p?p.attribute.x+p.attribute.width:Wd(h,v,m,y,1)*_;d&&(r=p?p.attribute.x+p.attribute.width+(w-x)/2:Wd(l,v,m,y,1)*_+w/2),S=[{x:t,y:b*(i+.5)+a},{x:t-20,y:b*(i+.5)+a},{x:t-20,y:b*(i+(i>c?0:1))+a},{x:r+20,y:b*(i+(i>c?0:1))+a},{x:r+20,y:b*(c+.5)+f},{x:r,y:b*(c+.5)+f}],t-20>=r+20&&S.splice(2,3,{x:t-20,y:b*(c+.5)+f});const n=S[S.length-1];T=[{x:n.x,y:n.y},{x:n.x+10,y:n.y-5},{x:n.x+10,y:n.y+5},{x:n.x,y:n.y}]}else if(t===xd.StartToStart){let t=o?o.attribute.x:Wd(e,v,m,y)*_;s&&(t-=(w-x)/2);let r=p?p.attribute.x:Wd(l,v,m,y)*_;d&&(r-=(w-x)/2),S=[{x:t,y:b*(i+.5)+a},{x:(i===c?t:Math.min(t,r))-20,y:b*(i+.5)+a},{x:(i===c?t:Math.min(t,r))-20,y:b*(c+(i===c?1:.5))+f},{x:r-20,y:b*(c+(i===c?1:.5))+f},{x:(i===c?r:Math.min(t,r))-20,y:b*(c+.5)+f},{x:r,y:b*(c+.5)+f}];const n=S[S.length-1];T=[{x:n.x,y:n.y},{x:n.x-10,y:n.y-5},{x:n.x-10,y:n.y+5},{x:n.x,y:n.y}]}else if(t===xd.FinishToFinish){let t=o?o.attribute.x+o.attribute.width:Wd(r,v,m,y,1)*_;s&&(t=o?o.attribute.x+o.attribute.width+(w-x)/2:Wd(e,v,m,y,1)*_+w/2);let n=p?p.attribute.x+p.attribute.width:Wd(h,v,m,y,1)*_;d&&(n=p?p.attribute.x+p.attribute.width+(w-x)/2:Wd(l,v,m,y,1)*_+w/2),S=[{x:t,y:b*(i+.5)+a},{x:(i===c?t:Math.max(t,n))+20,y:b*(i+.5)+a},{x:(i===c?t:Math.max(t,n))+20,y:b*(c+(i===c?1:.5))+f},{x:n+20,y:b*(c+(i===c?1:.5))+f},{x:n+20,y:b*(c+.5)+f},{x:n,y:b*(c+.5)+f}];const u=S[S.length-1];T=[{x:u.x,y:u.y},{x:u.x+10,y:u.y-5},{x:u.x+10,y:u.y+5},{x:u.x,y:u.y}]}return{linePoints:S,arrowPoints:T}}class Tp{constructor(t){this._scene=t,this.dragLineContainer=new ta({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=Va({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()}}Ai.load(bp);class kp{constructor(t){let e,r;var i;this._gantt=t,this.tableGroupWidth=t.tableNoFrameWidth,this.tableGroupHeight=Math.min(t.tableNoFrameHeight,t.drawHeight),"node"===$d.mode||(mc.setEnv("browser"),e=t.canvas.width,r=t.canvas.height),this.stage=(i={canvas:t.canvas,width:e,height:r,disableDirtyBounds:!1,background:t.parsedOptions.underlayBackgroundColor,enableLayout:!0,autoRender:!1,context:{appName:"vtable"},pluginList:["poptipForText"]},new Rc(i)),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 ta({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 up(this),this.grid=new Ud(this),this.dependencyLink=new xp(this),this.taskBar=new fp(this),this.markLine=new gp(this),this.toolTip=new wp(this),this.frameBorder=new mp(this),this.scrollbarComponent=new Vd(this._gantt),this.stage.defaultLayer.addChild(this.scrollbarComponent.hScrollBar),this.stage.defaultLayer.addChild(this.scrollbarComponent.vScrollBar),this.dragOrderLine=new Tp(this)}updateSceneGraph(){const t=this._gantt;let e,r;this.tableGroupWidth=t.tableNoFrameWidth,this.tableGroupHeight=Math.min(t.tableNoFrameHeight,t.drawHeight),"node"===$d.mode||(mc.setEnv("browser"),e=t.canvas.width,r=t.canvas.height),this.stage.resize(e,r),this.refreshAll()}afterCreateSceneGraph(){this.scrollbarComponent.updateScrollBar(),function(t){const e=t._gantt,r=e.stateManager,i=e.scenegraph;i.scrollbarComponent.vScrollBar.addEventListener("pointerover",(t=>{i.scrollbarComponent.showVerticalScrollBar()})),i.scrollbarComponent.hScrollBar.addEventListener("pointerover",(t=>{i.scrollbarComponent.showHorizontalScrollBar()})),i.scrollbarComponent.vScrollBar.addEventListener("pointerout",(t=>{r.interactionState!==wd.scrolling&&i.scrollbarComponent.hideVerticalScrollBar()})),i.scrollbarComponent.hScrollBar.addEventListener("pointerout",(t=>{r.interactionState!==wd.scrolling&&i.scrollbarComponent.hideHorizontalScrollBar()})),i.scrollbarComponent.vScrollBar.addEventListener("pointermove",(t=>{t.stopPropagation()})),i.scrollbarComponent.vScrollBar.addEventListener("scrollDown",(t=>{i._gantt.eventManager.isDown=!0})),i.scrollbarComponent.vScrollBar.addEventListener("pointerup",(()=>{i._gantt.eventManager.isDraging=!1,r.interactionState===wd.scrolling&&r.updateInteractionState(wd.default)})),i.scrollbarComponent.vScrollBar.addEventListener("pointerupoutside",(()=>{r.interactionState===wd.scrolling&&r.updateInteractionState(wd.default)})),i.scrollbarComponent.vScrollBar.addEventListener("scrollUp",(t=>{i._gantt.eventManager.isDraging=!1})),i.scrollbarComponent.hScrollBar.addEventListener("pointermove",(t=>{t.stopPropagation()})),i.scrollbarComponent.hScrollBar.addEventListener("pointerdown",(t=>{t.stopPropagation()})),i.scrollbarComponent.hScrollBar.addEventListener("scrollDown",(t=>{i._gantt.eventManager.isDown=!0,r.interactionState!==wd.scrolling&&r.updateInteractionState(wd.scrolling)})),i.scrollbarComponent.hScrollBar.addEventListener("pointerup",(()=>{r.interactionState===wd.scrolling&&r.updateInteractionState(wd.default)})),i.scrollbarComponent.hScrollBar.addEventListener("pointerupoutside",(()=>{r.interactionState===wd.scrolling&&r.updateInteractionState(wd.default)})),i.scrollbarComponent.hScrollBar.addEventListener("scrollUp",(t=>{i._gantt.eventManager.isDraging=!1}));const n=Cd(r.updateVerticalScrollBar,20),s=Cd(r.updateHorizontalScrollBar,20);i.scrollbarComponent.vScrollBar.addEventListener("scrollDrag",(t=>{i._gantt.eventManager.isDown&&(i._gantt.eventManager.isDraging=!0),r.interactionState!==wd.scrolling&&r.updateInteractionState(wd.scrolling);const e=t.detail.value[0]/(1-t.detail.value[1]+t.detail.value[0]);n(e,t)})),i.scrollbarComponent.hScrollBar.addEventListener("scrollDrag",(t=>{i._gantt.eventManager.isDown&&(i._gantt.eventManager.isDraging=!0),r.fastScrolling=!0,r.interactionState!==wd.scrolling&&r.updateInteractionState(wd.scrolling);const e=t.detail.value[0]/(1-t.detail.value[1]+t.detail.value[0]);s(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,e=!1){this.timelineHeader.setX(t),this.grid.setX(t),this.taskBar.setX(t),this.dependencyLink.setX(t),this.markLine.setX(t),this.updateNextFrame()}setY(t,e=!1){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,r){this.taskCreationButton||(this.taskCreationButton=new _p(this._gantt.scenegraph));const i=this._gantt.parsedOptions.taskBarCreationMaxWidth,n=this._gantt.parsedOptions.taskBarCreationMinWidth,s=this._gantt.getDateColWidth(r),o=i?Math.min(i,n?Math.max(n,s):s):n?Math.max(n,s):s,a=t-(o-s)/2;this.taskCreationButton.show(a,e,o,this._gantt.parsedOptions.rowHeight),this.updateNextFrame()}hideTaskCreationButton(){this.taskCreationButton&&(this.taskCreationButton.hide(),this.updateNextFrame())}showToolTip(t){this.toolTip||(this.toolTip=new wp(this._gantt.scenegraph)),this.toolTip.show(t)}hideToolTip(){this.toolTip.hide()}refreshRecordLinkNodes(t,e,r,i=0){const n=this._gantt,s=n.getRecordByIndex(t,e),o=s.vtable_gantt_linkedTo,a=s.vtable_gantt_linkedFrom;for(let s=0;s<(null==o?void 0:o.length);s++){const a=o[s],l=a.vtable_gantt_linkLineNode,h=a.vtable_gantt_linkArrowNode,{linkedToTaskKey:c,linkedFromTaskKey:u,type:d}=a,{taskKeyField:p,minDate:f}=n.parsedOptions,g=ip(n.records,p,u),m=ip(n.records,p,c);let y,v,b,_,w,x,S,T,k;const C=this._gantt.getTaskBarStyle(t,e);if(n.parsedOptions.tasksShowMode===Sd.Sub_Tasks_Inline){const t=op(r.attribute.y+i,n);T=g.index[0],S=n.getRowsHeightByIndex(0,t.task_index-1)/n.parsedOptions.rowHeight,({startDate:y,endDate:v,taskDays:b}=n.getTaskInfoByTaskListIndex(m.index[0],m.index[1])),({startDate:_,endDate:w,taskDays:x}=n.getTaskInfoByTaskListIndex(g.index[0],g.index[1]));const e=C.width;k=r.attribute.y+e/2-(S+.5)*n.parsedOptions.rowHeight}else if(n.parsedOptions.tasksShowMode===Sd.Project_Sub_Tasks_Inline){const t=n.getTaskShowIndexByRecordIndex(g.index.slice(0,-1)),e=n.getTaskShowIndexByRecordIndex(m.index.slice(0,-1)),r=n.getRecordByIndex(t),i=n.getRecordByIndex(e);T=r.type===Td.PROJECT&&"expand"!==r.hierarchyState&&!1!==n.parsedOptions.projectSubTasksExpandable?t:n.getTaskShowIndexByRecordIndex(g.index),S=i.type===Td.PROJECT&&"expand"!==i.hierarchyState&&!1!==n.parsedOptions.projectSubTasksExpandable?e:n.getTaskShowIndexByRecordIndex(m.index),({startDate:y,endDate:v,taskDays:b}=n.getTaskInfoByTaskListIndex(S,m.index)),({startDate:_,endDate:w,taskDays:x}=n.getTaskInfoByTaskListIndex(T,g.index))}else if(n.parsedOptions.tasksShowMode===Sd.Sub_Tasks_Separate||n.parsedOptions.tasksShowMode===Sd.Sub_Tasks_Arrange||n.parsedOptions.tasksShowMode===Sd.Sub_Tasks_Compact){const t=op(r.attribute.y+i,n);T=n.getRowsHeightByIndex(0,g.index[0]-1)/n.parsedOptions.rowHeight+(n.parsedOptions.tasksShowMode===Sd.Sub_Tasks_Arrange||n.parsedOptions.tasksShowMode===Sd.Sub_Tasks_Compact?g.record.vtable_gantt_showIndex:g.index[1]),S=n.getRowsHeightByIndex(0,t.task_index-1)/n.parsedOptions.rowHeight+(n.parsedOptions.tasksShowMode===Sd.Sub_Tasks_Arrange||n.parsedOptions.tasksShowMode===Sd.Sub_Tasks_Compact?m.record.vtable_gantt_showIndex:t.sub_task_index),({startDate:y,endDate:v,taskDays:b}=n.getTaskInfoByTaskListIndex(m.index[0],m.index[1])),({startDate:_,endDate:w,taskDays:x}=n.getTaskInfoByTaskListIndex(g.index[0],g.index[1]));const e=C.width;k=r.attribute.y+e/2-(S+.5)*n.parsedOptions.rowHeight}else{if(T=n.getTaskShowIndexByRecordIndex(g.index),S=n.getTaskShowIndexByRecordIndex(m.index),-1===T||-1===S)continue;({startDate:y,endDate:v,taskDays:b}=n.getTaskInfoByTaskListIndex(S)),({startDate:_,endDate:w,taskDays:x}=n.getTaskInfoByTaskListIndex(T))}if(!(_&&w&&y&&v&&l&&h))return;const{linePoints:E,arrowPoints:A}=Sp(d,_,w,T,0,g.record.type===Td.MILESTONE,null,0,y,v,S,0,m.record.type===Td.MILESTONE,r,null!=k?k:0,this._gantt);l.setAttribute("points",E),h.setAttribute("points",A)}for(let s=0;s<(null==a?void 0:a.length);s++){const o=a[s],l=o.vtable_gantt_linkLineNode,h=o.vtable_gantt_linkArrowNode,{linkedToTaskKey:c,linkedFromTaskKey:u,type:d}=o,{taskKeyField:p,minDate:f}=n.parsedOptions,g=ip(n.records,p,c),m=ip(n.records,p,u);let y,v,b,_,w,x,S,T,k;const C=this._gantt.getTaskBarStyle(t,e);if(n.parsedOptions.tasksShowMode===Sd.Sub_Tasks_Inline){const t=op(r.attribute.y+i,n);T=n.getRowsHeightByIndex(0,t.task_index-1)/n.parsedOptions.rowHeight,S=g.index[0],({startDate:y,endDate:v,taskDays:b}=n.getTaskInfoByTaskListIndex(g.index[0],g.index[1])),({startDate:_,endDate:w,taskDays:x}=n.getTaskInfoByTaskListIndex(m.index[0],m.index[1]));const e=C.width;k=r.attribute.y+e/2-(T+.5)*n.parsedOptions.rowHeight}else if(n.parsedOptions.tasksShowMode===Sd.Project_Sub_Tasks_Inline){const t=n.getTaskShowIndexByRecordIndex(m.index.slice(0,-1)),e=n.getTaskShowIndexByRecordIndex(g.index.slice(0,-1)),r=n.getRecordByIndex(t),i=n.getRecordByIndex(e);T=r.type===Td.PROJECT&&"expand"!==r.hierarchyState&&!1!==n.parsedOptions.projectSubTasksExpandable?t:n.getTaskShowIndexByRecordIndex(m.index),S=i.type===Td.PROJECT&&"expand"!==i.hierarchyState&&!1!==n.parsedOptions.projectSubTasksExpandable?e:n.getTaskShowIndexByRecordIndex(g.index),({startDate:y,endDate:v,taskDays:b}=n.getTaskInfoByTaskListIndex(S,g.index)),({startDate:_,endDate:w,taskDays:x}=n.getTaskInfoByTaskListIndex(T,m.index))}else if(n.parsedOptions.tasksShowMode===Sd.Sub_Tasks_Separate||n.parsedOptions.tasksShowMode===Sd.Sub_Tasks_Arrange||n.parsedOptions.tasksShowMode===Sd.Sub_Tasks_Compact){const t=op(r.attribute.y+i,n);T=n.getRowsHeightByIndex(0,t.task_index-1)/n.parsedOptions.rowHeight+(n.parsedOptions.tasksShowMode===Sd.Sub_Tasks_Arrange||n.parsedOptions.tasksShowMode===Sd.Sub_Tasks_Compact?m.record.vtable_gantt_showIndex:t.sub_task_index),S=n.getRowsHeightByIndex(0,g.index[0]-1)/n.parsedOptions.rowHeight+(n.parsedOptions.tasksShowMode===Sd.Sub_Tasks_Arrange||n.parsedOptions.tasksShowMode===Sd.Sub_Tasks_Compact?g.record.vtable_gantt_showIndex:g.index[1]),({startDate:y,endDate:v,taskDays:b}=n.getTaskInfoByTaskListIndex(g.index[0],g.index[1])),({startDate:_,endDate:w,taskDays:x}=n.getTaskInfoByTaskListIndex(m.index[0],m.index[1]));const e=C.width;k=r.attribute.y+e/2-(T+.5)*n.parsedOptions.rowHeight}else{if(T=n.getTaskShowIndexByRecordIndex(m.index),S=n.getTaskShowIndexByRecordIndex(g.index),-1===T||-1===S)continue;({startDate:y,endDate:v,taskDays:b}=n.getTaskInfoByTaskListIndex(S)),({startDate:_,endDate:w,taskDays:x}=n.getTaskInfoByTaskListIndex(T))}if(!(_&&w&&y&&v&&l&&h))return;const{linePoints:E,arrowPoints:A}=Sp(d,_,w,T,0,m.record.type===Td.MILESTONE,r,null!=k?k:0,y,v,S,0,g.record.type===Td.MILESTONE,null,0,this._gantt);l.setAttribute("points",E),h.setAttribute("points",A)}}}const Cp=(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 Ep(t,e,r){let i,n,s,o,a,l,h=0,c=!1,u=!1,d=!0;const p=!e&&0!==e&&"function"==typeof requestAnimationFrame;if("function"!=typeof t)throw new TypeError("Expected a function");function f(e){const r=i,s=n;return n=void 0,i=void 0,h=e,o=t.apply(s,r),o}function g(t,e){return p?requestAnimationFrame(t):setTimeout(t,e)}function m(t){const r=t-l;return void 0===l||r>=e||r<0||c&&t-h>=s}function y(){const t=Date.now();if(m(t))return function(t){return a=void 0,d&&i?f(t):(n=void 0,i=void 0,o)}(t);a=g(y,function(t){const r=t-h,i=e&&-(t-l);return c?Math.min(i,s-r):i}(t))}return e=+e||0,Cp(r,"object")&&(u=!!r.leading,c="maxWait"in r,c&&(s=Math.max(+r.maxWait||0,e)),d="trailing"in r?!!r.trailing:d),function(...t){const r=Date.now(),s=m(r);if(i=t,n=this,l=r,s){if(void 0===a)return function(t){return h=t,a=g(y,e),u?f(t):o}(l);if(c)return a=g(y,e),f(l)}return void 0===a&&(a=g(y,e)),o}}let Ap=1;class Op{constructor(t,e,r){var i;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(),r&&(this.resizeTime=Math.max(r,16)),this.callBackDebounce=Ep(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===(i=this.observer)||void 0===i||i.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 Bp{constructor(){this.listeners={},this.reseizeListeners={}}on(t,e,r,...i){if("node"===$d.mode)return-1;const n=Ap++;if(null==t?void 0:t.addEventListener)if("resize"!==e||t===window)null==t||t.addEventListener(e,r,...i);else{const e=new Op(t,r,this.resizeTime);this.reseizeListeners[n]=e}const s={target:t,type:e,listener:r,options:i};return this.listeners[n]=s,n}once(t,e,r,...i){if("node"===$d.mode)return-1;const n=this.on(t,e,((...t)=>{this.off(n),r(...t)}),...i);return n}off(t){var e;if("node"===$d.mode)return;if(null==t)return;const r=null===(e=this.listeners)||void 0===e?void 0:e[t];r&&(delete this.listeners[t],r.target.removeEventListener&&r.target.removeEventListener(r.type,r.listener,...r.options))}fire(t,e,...r){if("node"!==$d.mode)for(const i in this.listeners){const n=this.listeners[i];n.target===t&&n.type===e&&n.listener.call(n.target,...r)}}hasListener(t,e){if("node"===$d.mode)return!1;let r=!1;for(const i in this.listeners){const n=this.listeners[i];n.target===t&&n.type===e&&(r=!0)}return r}clear(){if("node"!==$d.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"!==$d.mode&&(this.clear(),this.listeners={})}}let Rp=1;function Lp(){return Zd?Rp=1:(Rp=Math.ceil(window.devicePixelRatio||1),Rp>1&&Rp%2!=0&&(Rp+=1)),Rp}function Pp(t){return!!t.changedTouches}Lp();class Dp{constructor(){}setScrollHandle(t){this.scrollHandle=t}startInertia(t,e,r){this.stopped=!1,this.lastTime=Date.now(),this.speedX=t,this.speedY=e,this.friction=r,this.runingId||(this.runingId=requestAnimationFrame(this.inertia.bind(this)))}inertia(){var t;if(this.stopped)return;const e=Date.now(),r=e-this.lastTime;let i=!0;const n=Math.pow(this.friction,r/16),s=n*this.speedX,o=n*this.speedY;let a=0,l=0;Math.abs(s)>.05&&(i=!1,a=(this.speedX+s)/2*r),Math.abs(o)>.05&&(i=!1,l=(this.speedY+o)/2*r),null===(t=this.scrollHandle)||void 0===t||t.call(this,a,l),i?this.runingId=null:(this.lastTime=e,this.speedX=s,this.speedY=o,this.runingId=requestAnimationFrame(this.inertia.bind(this)))}endInertia(){cancelAnimationFrame(this.runingId),this.runingId=null,this.stopped=!0}isInertiaScrolling(){return!!this.runingId}}class Mp{constructor(t){this.isDown=!1,this.isDraging=!1,this.globalEventListeners=[],this._enableTableScroll=!0,this._gantt=t,this.inertiaScroll=new Dp,this._eventHandler=new Bp,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,r=t._gantt,i=r.stateManager;e.ganttGroup.addEventListener("pointerdown",(n=>{if(0!==n.button)return;let s,o,a;if(n.detailPath.find((t=>"task-bar"===t.name?(s=t,!0):"task-creation-button"===t.name||("task-bar-link-point-left"===t.name?(o=t,!0):"task-bar-link-point-right"===t.name?(a=t,!0):!!t.attribute.vtable_link&&(t.attribute.vtable_link,!0)))),s){const o=s.record;if((null==o?void 0:o.type)!==Td.PROJECT)if("task-bar-hover-shadow-left-icon"===n.target.name)i.startResizeTaskBar(s,n.nativeEvent.x,n.nativeEvent.y,n.offset.y,"left"),i.updateInteractionState(wd.grabing);else if("task-bar-hover-shadow-right-icon"===n.target.name)i.startResizeTaskBar(s,n.nativeEvent.x,n.nativeEvent.y,n.offset.y,"right"),i.updateInteractionState(wd.grabing);else if(r.parsedOptions.taskBarMoveable){const o=()=>{let t=!0;if("function"==typeof r.parsedOptions.taskBarMoveable){const{startDate:i,endDate:n,taskRecord:o}=e._gantt.getTaskInfoByTaskListIndex(s.task_index,s.sub_task_index),a={index:s.task_index,startDate:i,endDate:n,taskRecord:o,ganttInstance:e._gantt};t=r.parsedOptions.taskBarMoveable(a)}else t=r.parsedOptions.taskBarMoveable;t&&(i.startMoveTaskBar(s,n.nativeEvent.x,n.nativeEvent.y,n.offset.y),i.updateInteractionState(wd.grabing))};"touch"===n.pointerType?(t.touchEnd=!1,t.touchSetTimeout=setTimeout((()=>{t.isTouchdown=!1,t.isLongTouch=!0,o()}),100)):o()}}else o?(i.startCreateDependencyLine(o,n.nativeEvent.x,n.nativeEvent.y,n.offset.y,"left"),i.updateInteractionState(wd.grabing)):a&&(i.startCreateDependencyLine(a,n.nativeEvent.x,n.nativeEvent.y,n.offset.y,"right"),i.updateInteractionState(wd.grabing))})),e.ganttGroup.addEventListener("pointermove",(n=>{var s,o,a,l,h;if(t.touchSetTimeout&&(clearTimeout(t.touchSetTimeout),t.touchSetTimeout=void 0),i.interactionState===wd.default){const t=n.detailPath.find((t=>"task-bar"===t.name)),a=n.detailPath.find((t=>"markline-hover-group"===t.name)),l=n.detailPath.find((t=>"mark-line-content"===t.name));if((null===(s=r.parsedOptions.markLineCreateOptions)||void 0===s?void 0:s.markLineCreatable)&&(a&&!function(t,e){const r=t.startDate.getTime(),i=t.endDate.getTime();return e.some((t=>{const e=new Date(t.date).getTime();return e>=r&&e<=i}))}(a.data,r.parsedOptions.markLine)?e._gantt.stateManager.marklineIcon.target!==a&&(e._gantt.stateManager.marklineIcon.target=a,i.showMarklineIconHover()):e._gantt.stateManager.marklineIcon.target&&i.hideMarklineIconHover()),t){if(e._gantt.stateManager.hoverTaskBar.target!==t){e._gantt.stateManager.hoverTaskBar.target=t;const r=t.task_index,s=t.sub_task_index,o=t.record;o.type!==Td.PROJECT&&i.showTaskBarHover(),e._gantt.hasListeners(kd.MOUSEENTER_TASK_BAR)&&e._gantt.fireListeners(kd.MOUSEENTER_TASK_BAR,{federatedEvent:n,event:n.nativeEvent,index:r,sub_task_index:s,record:o})}}else{if(e._gantt.stateManager.hoverTaskBar.target){if(e._gantt.hasListeners(kd.MOUSELEAVE_TASK_BAR)){const t=e._gantt.stateManager.hoverTaskBar.target.task_index,r=e._gantt.stateManager.hoverTaskBar.target.sub_task_index,i=e._gantt.getRecordByIndex(t,r);e._gantt.fireListeners(kd.MOUSELEAVE_TASK_BAR,{federatedEvent:n,event:n.nativeEvent,index:t,sub_task_index:r,record:i})}i.hideTaskBarHover(n)}if(r.parsedOptions.taskBarCreatable&&!l){const t=op(n.offset.y-r.headerHeight+r.stateManager.scrollTop,r),e=r.getTaskInfoByTaskListIndex(t.task_index,t.sub_task_index);let i=!0;if("function"==typeof r.parsedOptions.taskBarCreatable){const{startDate:n,endDate:s,taskRecord:o}=e,a={index:t.task_index,sub_task_index:t.sub_task_index,startDate:n,endDate:s,taskRecord:o,ganttInstance:r};i=r.parsedOptions.taskBarCreatable(a)}else i=r.parsedOptions.taskBarCreatable;if(i){const i=function(t,e,r){const i=op(e-r.headerHeight+r.stateManager.scrollTop,r),n=r.getRecordByIndex(i.task_index),s=Kd(t,r),o=r.getDateRangeByIndex(s);if(null==n?void 0:n.children){const t=op(e-r.headerHeight+r.stateManager.scrollTop,r);for(let e=0;e<n.children.length;e++){const{startDate:i,endDate:s,taskDays:a,progress:l,taskRecord:h}=r.getTaskInfoByTaskListIndex(t.task_index,e);if(((r.parsedOptions.tasksShowMode===Sd.Sub_Tasks_Compact||r.parsedOptions.tasksShowMode===Sd.Sub_Tasks_Arrange)&&h.vtable_gantt_showIndex===t.sub_task_index||r.parsedOptions.tasksShowMode===Sd.Sub_Tasks_Inline||r.parsedOptions.tasksShowMode===Sd.Project_Sub_Tasks_Inline&&n.type===Td.PROJECT&&"expand"!==n.hierarchyState&&!1!==r.parsedOptions.projectSubTasksExpandable)&&i&&s&&o.startDate.getTime()>=i.getTime()&&o.endDate.getTime()<=s.getTime())return{startDate:i,endDate:s,taskDays:a,progress:l,taskRecord:h}}}}(n.offset.x,n.offset.y,r);if((r.parsedOptions.tasksShowMode===Sd.Sub_Tasks_Separate||r.parsedOptions.tasksShowMode===Sd.Tasks_Separate)&&!e.taskDays&&e.taskRecord&&!e.taskRecord.vtableMerge||(r.parsedOptions.tasksShowMode===Sd.Sub_Tasks_Inline||r.parsedOptions.tasksShowMode===Sd.Sub_Tasks_Arrange||r.parsedOptions.tasksShowMode===Sd.Sub_Tasks_Compact)&&!i){const e=Kd(n.offset.x,r),i=(e>=1?r.getDateColsWidth(0,e-1):0)-r.stateManager.scroll.horizontalBarPos,s=r.taskListTableInstance.getRowsHeight(r.taskListTableInstance.columnHeaderLevelCount,t.task_index+r.taskListTableInstance.columnHeaderLevelCount-1)+(null!==(o=t.sub_task_index)&&void 0!==o?o:0)*r.parsedOptions.rowHeight-r.stateManager.scroll.verticalBarPos;return void r.scenegraph.showTaskCreationButton(i,s,e)}}}}r.scenegraph.hideTaskCreationButton()}else if(i.interactionState===wd.grabing){let t,r,s;n.detailPath.find((e=>"task-bar"===e.name?(t=e,!0):"task-creation-button"===e.name||("task-bar-link-point-left"===e.name?(r=e,!0):"task-bar-link-point-right"===e.name?(s=e,!0):!!e.attribute.vtable_link&&(e.attribute.vtable_link,!0)))),t=null!==(l=null!=t?t:null===(a=null==r?void 0:r.parent)||void 0===a?void 0:a.attribute.attachedToTaskBarNode)&&void 0!==l?l:null===(h=null==s?void 0:s.parent)||void 0===h?void 0:h.attribute.attachedToTaskBarNode,e._gantt.stateManager.isCreatingDependencyLine()&&!t?i.hideSecondTaskBarSelectedBorder():e._gantt.stateManager.isCreatingDependencyLine()&&r&&e._gantt.stateManager.selectedTaskBar.target!==t?(i.highlightLinkPointNode(r),i.creatingDenpendencyLink.lastHighLightLinkPoint=r,i.creatingDenpendencyLink.secondTaskBarPosition="left"):e._gantt.stateManager.isCreatingDependencyLine()&&s&&e._gantt.stateManager.selectedTaskBar.target!==t?(i.highlightLinkPointNode(s),i.creatingDenpendencyLink.lastHighLightLinkPoint=s,i.creatingDenpendencyLink.secondTaskBarPosition="right"):e._gantt.stateManager.isCreatingDependencyLine()&&t&&e._gantt.stateManager.selectedTaskBar.target!==t&&(i.unhighlightLinkPointNode(i.creatingDenpendencyLink.lastHighLightLinkPoint),i.creatingDenpendencyLink.secondTaskBarNode&&i.creatingDenpendencyLink.secondTaskBarNode===t||(i.creatingDenpendencyLink.secondTaskBarNode&&i.creatingDenpendencyLink.secondTaskBarNode!==t&&i.hideSecondTaskBarSelectedBorder(),i.creatingDenpendencyLink.secondTaskBarNode=t,i.showSecondTaskBarSelectedBorder()))}})),e.ganttGroup.addEventListener("pointerup",(n=>{var s,o;if(t.touchSetTimeout&&(clearTimeout(t.touchSetTimeout),t.touchSetTimeout=void 0),0===n.button){let a,l,h,c=!1,u=!1,d=!1,p=!1,f=!1,g=!1,m=!1;const y=n.detailPath.find((t=>"task-bar"===t.name?(c=!0,!0):"task-creation-button"===t.name?(u=!0,!1):"task-bar-link-point-left"===t.name?(p=!0,!1):"task-bar-link-point-right"===t.name?(f=!0,!1):t.attribute.vtable_link?(d=!0,a=t.attribute.vtable_link,!1):"markline-hover-group"===t.name?(g=!0,h=t,!1):"mark-line-content"===t.name&&(m=!0,l=t,!1)));if(c&&e._gantt.parsedOptions.taskBarSelectable&&"down"===t.poniterState){if(i.hideDependencyLinkSelectedLine(),i.showTaskBarSelectedBorder(y),r.hasListeners(kd.CLICK_TASK_BAR)){const t=y.task_index,e=y.sub_task_index,i=r.getRecordByIndex(t,e);r.fireListeners(kd.CLICK_TASK_BAR,{federatedEvent:n,event:n.nativeEvent,index:t,sub_task_index:e,record:i})}}else if(u&&"down"===t.poniterState){i.hideDependencyLinkSelectedLine(),i.hideTaskBarSelectedBorder();const t=op(n.offset.y-r.headerHeight+r.stateManager.scrollTop,r);if(r.parsedOptions.tasksShowMode===Sd.Sub_Tasks_Arrange||r.parsedOptions.tasksShowMode===Sd.Sub_Tasks_Inline||r.parsedOptions.tasksShowMode===Sd.Sub_Tasks_Compact){if(r.hasListeners(kd.CREATE_TASK_SCHEDULE)){const e=Kd(n.offset.x,r),i=r.getDateRangeByIndex(e),o=null!==(s=r.parsedOptions.dateFormat)&&void 0!==s?s:r.parsedOptions.timeScaleIncludeHour?"yyyy-mm-dd hh:mm:ss":"yyyy-mm-dd";r.fireListeners(kd.CREATE_TASK_SCHEDULE,{federatedEvent:n,event:n.nativeEvent,index:t.task_index,sub_task_index:t.sub_task_index,startDate:Ed(i.startDate,o),endDate:Ed(i.endDate,o),record:void 0,parentRecord:r.getRecordByIndex(t.task_index)})}}else{const e=r.getTaskInfoByTaskListIndex(t.task_index,t.sub_task_index);if(e.taskRecord){const i=null!==(o=r.parsedOptions.dateFormat)&&void 0!==o?o:r.parsedOptions.timeScaleIncludeHour?"yyyy-mm-dd hh:mm:ss":"yyyy-mm-dd",s=Kd(n.offset.x,r),a=r.getDateRangeByIndex(s);e.taskRecord[r.parsedOptions.startDateField]=Ed(a.startDate,i),e.taskRecord[r.parsedOptions.endDateField]=Ed(a.endDate,i),r.scenegraph.hideTaskCreationButton(),r.updateTaskRecord(e.taskRecord,t.task_index,t.sub_task_index),r.hasListeners(kd.CREATE_TASK_SCHEDULE)&&r.fireListeners(kd.CREATE_TASK_SCHEDULE,{federatedEvent:n,event:n.nativeEvent,index:t.task_index,sub_task_index:t.sub_task_index,startDate:e.taskRecord[r.parsedOptions.startDateField],endDate:e.taskRecord[r.parsedOptions.endDateField],record:e.taskRecord})}}}else if(d&&e._gantt.parsedOptions.dependencyLinkSelectable&&"down"===t.poniterState)i.hideDependencyLinkSelectedLine(),i.hideTaskBarSelectedBorder(),e._gantt.stateManager.selectedDenpendencyLink.link=a,i.showDependencyLinkSelectedLine();else if((p||f)&&"down"===t.poniterState){if(r.hasListeners(kd.CLICK_DEPENDENCY_LINK_POINT)){const t=op(n.offset.y-r.headerHeight+r.stateManager.scrollTop,r),e=r.getRecordByIndex(t.task_index,t.sub_task_index);r.fireListeners(kd.CLICK_DEPENDENCY_LINK_POINT,{event:n.nativeEvent,index:t.task_index,sub_task_index:t.sub_task_index,point:p?"start":"end",record:e})}i.hideTaskBarSelectedBorder()}else if(g&&"down"===t.poniterState)r.hasListeners(kd.CLICK_MARKLINE_CREATE)&&r.fireListeners(kd.CLICK_MARKLINE_CREATE,{event:n.nativeEvent,position:cp(h,e._gantt),data:e._gantt.stateManager.marklineIcon.target.data});else if(m&&"down"===t.poniterState)r.hasListeners(kd.CLICK_MARKLINE_CONTENT)&&r.fireListeners(kd.CLICK_MARKLINE_CONTENT,{event:n.nativeEvent,position:cp(l,e._gantt),data:l.data});else if(p&&"draging"===t.poniterState){if(i.isCreatingDependencyLine()){const t=i.endCreateDependencyLine(n.offset.y);r.hasListeners(kd.CREATE_DEPENDENCY_LINK)&&r.fireListeners(kd.CREATE_DEPENDENCY_LINK,{federatedEvent:n,event:n.nativeEvent,link:t})}}else if(f&&"draging"===t.poniterState){if(i.isCreatingDependencyLine()){const t=i.endCreateDependencyLine(n.offset.y);r.hasListeners(kd.CREATE_DEPENDENCY_LINK)&&r.fireListeners(kd.CREATE_DEPENDENCY_LINK,{federatedEvent:n,event:n.nativeEvent,link:t})}}else i.hideDependencyLinkSelectedLine(),i.hideTaskBarSelectedBorder()}})),e.ganttGroup.addEventListener("rightdown",(t=>{let e,i=!1,n=!1;const s=t.detailPath.find((t=>"task-bar"===t.name?(i=!0,!0):!!t.attribute.vtable_link&&(n=!0,e=t.attribute.vtable_link,!1)));if(i){if(r.hasListeners(kd.CONTEXTMENU_TASK_BAR)){const e=s.task_index,i=s.sub_task_index,n=r.getRecordByIndex(e,i);r.fireListeners(kd.CONTEXTMENU_TASK_BAR,{federatedEvent:t,event:t.nativeEvent,index:e,sub_task_index:i,record:n})}}else n&&r.hasListeners(kd.CONTEXTMENU_DEPENDENCY_LINK)&&r.fireListeners(kd.CONTEXTMENU_DEPENDENCY_LINK,{federatedEvent:t,event:t.nativeEvent,link:e})})),e.ganttGroup.addEventListener("pointerenter",(t=>{(r.parsedOptions.scrollStyle.horizontalVisible&&"focus"===r.parsedOptions.scrollStyle.horizontalVisible||!r.parsedOptions.scrollStyle.horizontalVisible&&"focus"===r.parsedOptions.scrollStyle.visible)&&e.scrollbarComponent.showHorizontalScrollBar(),(r.parsedOptions.scrollStyle.verticalVisible&&"focus"===r.parsedOptions.scrollStyle.verticalVisible||!r.parsedOptions.scrollStyle.verticalVisible&&"focus"===r.parsedOptions.scrollStyle.visible)&&e.scrollbarComponent.showVerticalScrollBar()})),e.ganttGroup.addEventListener("pointerleave",(t=>{if((r.parsedOptions.scrollStyle.horizontalVisible&&"focus"===r.parsedOptions.scrollStyle.horizontalVisible||!r.parsedOptions.scrollStyle.horizontalVisible&&"focus"===r.parsedOptions.scrollStyle.visible)&&e.scrollbarComponent.hideHorizontalScrollBar(),(r.parsedOptions.scrollStyle.verticalVisible&&"focus"===r.parsedOptions.scrollStyle.verticalVisible||!r.parsedOptions.scrollStyle.verticalVisible&&"focus"===r.parsedOptions.scrollStyle.visible)&&e.scrollbarComponent.hideVerticalScrollBar(),e._gantt.stateManager.hoverTaskBar.target){if(e._gantt.hasListeners(kd.MOUSELEAVE_TASK_BAR)){const r=e._gantt.stateManager.hoverTaskBar.target.task_index,i=e._gantt.stateManager.hoverTaskBar.target.sub_task_index,n=e._gantt.getRecordByIndex(r,i);e._gantt.fireListeners(kd.MOUSELEAVE_TASK_BAR,{federatedEvent:t,event:t.nativeEvent,index:r,sub_task_index:i,record:n})}i.hideTaskBarHover(t)}})),e.ganttGroup.addEventListener("wheel",(t=>{Gd(t,i,r)}))})(this),function(t){const e=t._gantt,r=(t._gantt.scenegraph,e.stateManager),i=t._eventHandler;i.on(e.getElement(),"contextmenu",(t=>{var r;!1!==(null===(r=e.parsedOptions.eventOptions)||void 0===r?void 0:r.preventDefaultContextMenu)&&t.preventDefault()})),i.on(e.getContainer(),"resize",(t=>{0===t.width&&0===t.height||(ld(e.options.pixelRatio)||e.setPixelRatio(Lp()),t.windowSizeNotChange||e._resize())})),e.taskListTableInstance&&e.parsedOptions.verticalSplitLineMoveable&&i.on(e.verticalSplitResizeLine,"mousedown",(t=>{r.updateInteractionState(wd.grabing),r.startResizeTableWidth(t)})),e.parsedOptions.verticalSplitLineHighlight&&(e.verticalSplitResizeLine&&i.on(e.verticalSplitResizeLine,"mouseover",(t=>{e.verticalSplitResizeLine.childNodes[1].style.opacity="1"})),e.verticalSplitResizeLine&&i.on(e.verticalSplitResizeLine,"mouseout",(t=>{e.verticalSplitResizeLine.childNodes[1].style.opacity="0"})));const n=t=>{e.eventManager.lastDragPointerXYOnWindow={x:t.x,y:t.y},e.eventManager.poniterState="down"};t.globalEventListeners.push({name:"pointerdown",env:"document",callback:n}),mc.addEventListener("pointerdown",n);const s=t=>{var i,n,s,o,a,l;if("down"===e.eventManager.poniterState){const r=null!==(i=e.eventManager.lastDragPointerXYOnWindow.x)&&void 0!==i?i:t.x,s=t.x-r,o=null!==(n=e.eventManager.lastDragPointerXYOnWindow.y)&&void 0!==n?n:t.y,a=t.y-o;(Math.abs(s)>=1||Math.abs(a)>=1)&&(e.eventManager.poniterState="draging")}if(r.interactionState===wd.grabing&&"draging"===e.eventManager.poniterState){const i=null!==(o=null===(s=e.eventManager.lastDragPointerXYOnWindow)||void 0===s?void 0:s.x)&&void 0!==o?o:t.x,n=null!==(l=null===(a=e.eventManager.lastDragPointerXYOnWindow)||void 0===a?void 0:a.y)&&void 0!==l?l:t.y;(Math.abs(i-t.x)>=1||Math.abs(n-t.y)>=1)&&(r.isResizingTableWidth()?(r.hideDependencyLinkSelectedLine(),r.hideTaskBarSelectedBorder(),r.dealResizeTableWidth(t)):r.isMoveingTaskBar()?(r.hideDependencyLinkSelectedLine(),r.hideTaskBarSelectedBorder(),r.dealTaskBarMove(t)):r.isResizingTaskBar()?(r.hideDependencyLinkSelectedLine(),r.hideTaskBarSelectedBorder(),r.dealTaskBarResize(t)):r.isCreatingDependencyLine()&&r.dealCreateDependencyLine(t),e.eventManager.lastDragPointerXYOnWindow={x:t.x,y:t.y})}};t.globalEventListeners.push({name:"pointermove",env:"document",callback:s}),mc.addEventListener("pointermove",s);const o=t=>{"grabing"===r.interactionState&&(r.updateInteractionState(wd.default),r.isResizingTableWidth()?r.endResizeTableWidth():r.isMoveingTaskBar()?r.endMoveTaskBar():r.isResizingTaskBar()&&r.endResizeTaskBar(t.x)),setTimeout((()=>{e.eventManager.lastDragPointerXYOnWindow=void 0,e.eventManager.poniterState="up"}),0)};t.globalEventListeners.push({name:"pointerup",env:"document",callback:o}),mc.addEventListener("pointerup",o);const a=t=>{var i,n;if(e.parsedOptions.dependencyLinkDeletable&&("Delete"===t.key&&(null===(i=e.parsedOptions.keyboardOptions)||void 0===i?void 0:i.deleteLinkOnDel)||"Backspace"===t.key&&(null===(n=e.parsedOptions.keyboardOptions)||void 0===n?void 0:n.deleteLinkOnBack))&&e.stateManager.selectedDenpendencyLink.link){const i=e.stateManager.selectedDenpendencyLink.link;e.deleteLink(e.stateManager.selectedDenpendencyLink.link),r.hideDependencyLinkSelectedLine(),r.hideTaskBarSelectedBorder(),e.hasListeners(kd.DELETE_DEPENDENCY_LINK)&&e.fireListeners(kd.DELETE_DEPENDENCY_LINK,{event:t,link:i})}};t.globalEventListeners.push({name:"keydown",env:"document",callback:a}),mc.addEventListener("keydown",a)}(this),function(t){const e=t._gantt,r=e.stateManager,i=e.scenegraph;if(!1===mc.envContribution.supportsTouchEvents)return;mc.addEventListener("contextmenu",(t=>{t.stopPropagation(),t.preventDefault()}),{capture:!0}),t.touchMovePoints=[],e.scenegraph.ganttGroup.addEventListener("touchstart",(e=>{e.target.isChildOf(i.scrollbarComponent.vScrollBar)||e.target.isChildOf(i.scrollbarComponent.hScrollBar)||(t.isTouchdown=!0,t.touchMovePoints.push({x:e.page.x,y:e.page.y,timestamp:Date.now()}))}));const n=i=>{if(t.isLongTouch&&i.preventDefault(),t.isTouchdown&&Pp(i)&&(t.isTouchMove=!0,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 n=-t.touchMovePoints[t.touchMovePoints.length-1].x+t.touchMovePoints[t.touchMovePoints.length-2].x,s=-t.touchMovePoints[t.touchMovePoints.length-1].y+t.touchMovePoints[t.touchMovePoints.length-2].y;Gd(i,r,e),i.cancelable&&("none"===e.parsedOptions.overscrollBehavior||Math.abs(s)>=Math.abs(n)&&0!==s&&Xd(s,r)||Math.abs(s)<=Math.abs(n)&&0!==n&&Yd(n,r))&&i.preventDefault()}};mc.addEventListener("touchmove",n,{passive:!1}),t.globalEventListeners.push({name:"touchmove",env:"vglobal",callback:n});const s=r=>{var i,n;if(t.touchEnd=!0,t.isLongTouch=!1,t.isTouchdown&&Pp(r)){if((null===(i=t.touchMovePoints)||void 0===i?void 0:i.length)&&(t.touchMovePoints.length>4&&t.touchMovePoints.shift(),t.touchMovePoints.push({x:r.changedTouches[0].pageX,y:r.changedTouches[0].pageY,timestamp:Date.now()}),t._enableTableScroll)){const r=t.touchMovePoints[0],i=t.touchMovePoints[(null===(n=t.touchMovePoints)||void 0===n?void 0:n.length)-1],s=(i.x-r.x)/(i.timestamp-r.timestamp),o=(i.y-r.y)/(i.timestamp-r.timestamp);t.inertiaScroll.startInertia(s,o,.95),e.eventManager.inertiaScroll.setScrollHandle(((t,r)=>{Gd({deltaX:-t,deltaY:-r},e.stateManager,e)}))}t.isTouchdown=!1,t.isTouchMove=!1,t.isDraging=!1,t.touchMovePoints=[]}};mc.addEventListener("touchend",s),t.globalEventListeners.push({name:"touchend",env:"vglobal",callback:s});const o=e=>{t.touchEnd=!0,t.isLongTouch=!1,t.isTouchdown&&(t.isTouchdown=!1,t.isTouchMove=!1,t.touchMovePoints=[],t.isDraging=!1)};mc.addEventListener("touchcancel",o),t.globalEventListeners.push({name:"touchcancel",env:"vglobal",callback:o})}(this)}}function Ip(t){const{scroll:e}=t.stateManager,{verticalBarPos:r}=e;t.taskListTableInstance.stateManager.setScrollTop(r,void 0,!1)}function Np(t){var e,r,i,n,s,o,a,l;const h=t.taskTableWidth;t.taskTableWidth=t.taskListTableInstance.getAllColsWidth()+t.parsedOptions.outerFrameStyle.borderLineWidth,(null===(r=null===(e=t.options)||void 0===e?void 0:e.taskListTable)||void 0===r?void 0:r.maxTableWidth)&&(t.taskTableWidth=Math.min(null===(n=null===(i=t.options)||void 0===i?void 0:i.taskListTable)||void 0===n?void 0:n.maxTableWidth,t.taskTableWidth)),(null===(o=null===(s=t.options)||void 0===s?void 0:s.taskListTable)||void 0===o?void 0:o.minTableWidth)&&(t.taskTableWidth=Math.max(null===(l=null===(a=t.options)||void 0===a?void 0:a.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(),rp(t))}class Fp{constructor(t){var e;this.interactionState=wd.default,this.resetInteractionState=Ep((()=>{this.updateInteractionState(wd.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 Dp},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:r}=e;t.stateManager.scroll.verticalBarPos!==r&&t.stateManager.setScrollTop(r,!1)}})))}(this._gantt),function(t){var e;null===(e=t.taskListTableInstance)||void 0===e||e.on("change_cell_value",(e=>{const{col:r,row:i}=e;t.taskListTableInstance.isHeader(r,i)||t._refreshTaskBar(i-t.taskListTableInstance.columnHeaderLevelCount)}))}(this._gantt),function(t){var e,r,i,n;null===(e=t.taskListTableInstance)||void 0===e||e.on("change_header_position",(e=>{t.parsedOptions.tasksShowMode===Sd.Sub_Tasks_Arrange||t.parsedOptions.tasksShowMode===Sd.Sub_Tasks_Compact||t.parsedOptions.tasksShowMode===Sd.Sub_Tasks_Separate||t.parsedOptions.tasksShowMode===Sd.Project_Sub_Tasks_Inline?t.scenegraph.refreshTaskBarsAndGrid():t.scenegraph.refreshTaskBars(),t.scenegraph.dragOrderLine.hideDragLine();const r=t.stateManager.scroll.horizontalBarPos,i=t.stateManager.scroll.verticalBarPos;t.scenegraph.setX(-r),t.scenegraph.setY(-i)})),null===(r=t.taskListTableInstance)||void 0===r||r.on("change_header_position_start",(e=>{const{col:r,row:i,x:n,y:s,backX:o,lineX:a,backY:l,lineY:h,event:c}=e;t.scenegraph.dragOrderLine.showDragLine(h),t.scenegraph.updateNextFrame()})),null===(i=t.taskListTableInstance)||void 0===i||i.on("changing_header_position",(e=>{const{col:r,row:i,x:n,y:s,backX:o,lineX:a,backY:l,lineY:h,event:c}=e;t.scenegraph.dragOrderLine.showDragLine(h),t.scenegraph.updateNextFrame()})),null===(n=t.taskListTableInstance)||void 0===n||n.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 r,i;const{row:n,hierarchyState:s}=e;if(t.parsedOptions.tasksShowMode===Sd.Project_Sub_Tasks_Inline){const e=n-t.taskListTableInstance.columnHeaderLevelCount,i=t.getRecordByIndex(e);i&&i.type===Td.PROJECT&&(null===(r=i.children)||void 0===r?void 0:r.length)>0&&(i.hierarchyState=s)}t._syncPropsFromTable(),t.scenegraph.refreshTaskBarsAndGrid(),!t.taskListTableInstance.checkHasColumnAutoWidth()||"auto"!==(null===(i=t.options.taskListTable)||void 0===i?void 0:i.tableWidth)&&-1!==t.taskTableWidth||Np(t);const o=t.stateManager.scroll.horizontalBarPos,a=t.stateManager.scroll.verticalBarPos;t.scenegraph.setX(-o),t.scenegraph.setY(-a)}))}(this._gantt),function(t){var e;null===(e=t.taskListTableInstance)||void 0===e||e.on("after_sort",(e=>{t.scenegraph.refreshTaskBars();const r=t.stateManager.scroll.horizontalBarPos,i=t.stateManager.scroll.verticalBarPos;t.scenegraph.setX(-r),t.scenegraph.setY(-i)}))}(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=>{Np(t)}))}(this._gantt)}setScrollTop(t,e=!0){const r=this._gantt.getAllRowsHeight();t=Math.max(0,Math.min(t,r-this._gantt.scenegraph.height)),t=Math.ceil(t);const i=this.scroll.verticalBarPos;this.scroll.verticalBarPos=t,ld(this.scroll.verticalBarPos)&&!isNaN(this.scroll.verticalBarPos)||(this.scroll.verticalBarPos=0),this._gantt.scenegraph.setY(-t);const n=t/(r-this._gantt.scenegraph.height);this._gantt.scenegraph.scrollbarComponent.updateVerticalScrollBarPos(n),i!==t&&e&&(Ip(this._gantt),this._gantt.fireListeners(kd.SCROLL,{scrollTop:this.scroll.verticalBarPos,scrollLeft:this.scroll.horizontalBarPos,scrollDirection:"vertical",scrollRatioY:n}))}get scrollLeft(){return this.scroll.horizontalBarPos}get scrollTop(){return this.scroll.verticalBarPos}setScrollLeft(t,e=!0){const r=this._gantt.getAllDateColsWidth();t=Math.max(0,Math.min(t,r-this._gantt.scenegraph.width)),t=Math.ceil(t);const i=this.scroll.horizontalBarPos;this.scroll.horizontalBarPos=t,ld(this.scroll.horizontalBarPos)&&!isNaN(this.scroll.horizontalBarPos)||(this.scroll.horizontalBarPos=0),this._gantt.scenegraph.setX(-t);const n=t/(r-this._gantt.scenegraph.width);this._gantt.scenegraph.scrollbarComponent.updateHorizontalScrollBarPos(n),i!==t&&e&&this._gantt.fireListeners(kd.SCROLL,{scrollTop:this.scroll.verticalBarPos,scrollLeft:this.scroll.horizontalBarPos,scrollDirection:"horizontal",scrollRatioX:n})}updateInteractionState(t){if(this.interactionState===t)return;const e=this.interactionState;this.interactionState=t,e===wd.scrolling&&wd.default}updateVerticalScrollBar(t){const e=this._gantt.getAllRowsHeight();this.scroll.verticalBarPos,this.scroll.verticalBarPos=Math.ceil(t*(e-this._gantt.scenegraph.height)),ld(this.scroll.verticalBarPos)&&!isNaN(this.scroll.verticalBarPos)||(this.scroll.verticalBarPos=0),this._gantt.scenegraph.setY(-this.scroll.verticalBarPos,1===t),Ip(this._gantt),this._gantt.fireListeners(kd.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)),ld(this.scroll.horizontalBarPos)&&!isNaN(this.scroll.horizontalBarPos)||(this.scroll.horizontalBarPos=0),this._gantt.scenegraph.setX(-this.scroll.horizontalBarPos,1===t),this._gantt.fireListeners(kd.SCROLL,{scrollTop:this.scroll.verticalBarPos,scrollLeft:this.scroll.horizontalBarPos,scrollDirection:"horizontal",scrollRatioY:t})}startMoveTaskBar(t,e,r,i){"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=r,this.moveTaskBar.startOffsetY=i,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,r=this.moveTaskBar.target;if(Math.abs(t)>=1||Math.abs(e)>=1){const t=r.task_index,i=r.task_index,n=r.sub_task_index,{startDate:s,endDate:o}=this._gantt.getTaskInfoByTaskListIndex(i,n),a=this.moveTaskBar.targetStartY+this._gantt.parsedOptions.rowHeight*Math.round(e/this._gantt.parsedOptions.rowHeight),l=this._gantt.parsedOptions.taskBarMilestoneStyle.width,h=Kd(this.moveTaskBar.target.attribute.x+(r.record.type===Td.MILESTONE?l/2:0)-this._gantt.stateManager.scroll.horizontalBarPos,this._gantt),c=this._gantt.parsedOptions.reverseSortedTimelineScales[0].timelineDates[h];if(!c)return;const u=c.startDate,d=new Date(u.getTime()+(Md(o).getTime()-Md(s).getTime()));let p;if(Md(s).getTime()!==u.getTime()){p=Md(s).getTime()>u.getTime()?"left":"right",this._gantt._updateStartEndDateToTaskRecord(u,d,i,n);const e=this._gantt.getRecordByIndex(i,n);this._gantt.hasListeners(kd.CHANGE_DATE_RANGE)&&this._gantt.fireListeners(kd.CHANGE_DATE_RANGE,{startDate:e[this._gantt.parsedOptions.startDateField],endDate:e[this._gantt.parsedOptions.endDateField],oldStartDate:s,oldEndDate:o,index:i,record:e});const r=op(a,this._gantt).task_index;this._gantt.hasListeners(kd.MOVE_END_TASK_BAR)&&this._gantt.fireListeners(kd.MOVE_END_TASK_BAR,{startDate:e[this._gantt.parsedOptions.startDateField],endDate:e[this._gantt.parsedOptions.endDateField],oldStartDate:s,oldEndDate:o,oldRowIndex:t,newRowIndex:r,index:i,record:e})}else{const e=this._gantt.getRecordByIndex(i,n),r=op(a,this._gantt).task_index;this._gantt.hasListeners(kd.MOVE_END_TASK_BAR)&&this._gantt.fireListeners(kd.MOVE_END_TASK_BAR,{startDate:e[this._gantt.parsedOptions.startDateField],endDate:e[this._gantt.parsedOptions.endDateField],oldStartDate:s,oldEndDate:o,oldRowIndex:t,newRowIndex:r,index:r,record:e})}if(this._gantt.parsedOptions.tasksShowMode===Sd.Sub_Tasks_Arrange||this._gantt.parsedOptions.tasksShowMode===Sd.Sub_Tasks_Compact){const t=op(a,this._gantt);this._gantt._dragOrderTaskRecord(r.task_index,r.sub_task_index,t.task_index,t.sub_task_index),sp(this._gantt.records),this._gantt.taskListTableInstance.renderWithRecreateCells(),this._gantt._syncPropsFromTable(),this._gantt.scenegraph.refreshTaskBarsAndGrid()}else if(this._gantt.parsedOptions.tasksShowMode!==Sd.Tasks_Separate&&Math.abs(Math.round(e/this._gantt.parsedOptions.rowHeight))>=1){const t=op(a,this._gantt);this._gantt._dragOrderTaskRecord(r.task_index,r.sub_task_index,t.task_index,t.sub_task_index),this._gantt.parsedOptions.tasksShowMode===Sd.Sub_Tasks_Separate?(this._gantt.taskListTableInstance.renderWithRecreateCells(),this._gantt.scenegraph.refreshTaskBarsAndGrid()):(this._gantt.scenegraph.taskBar.refresh(),this._gantt.scenegraph.dependencyLink.refresh())}else{let t=h>=1?this._gantt.getDateColsWidth(0,h-1):0;if(r.record.type===Td.MILESTONE&&(t-=this._gantt.parsedOptions.taskBarMilestoneStyle.width/2),zp(r,t-r.attribute.x,a-r.attribute.y,this),"right"===p){let t=r;for(;t.nextSibling&&t.nextSibling.attribute.y===r.attribute.y&&t.nextSibling.record[this._gantt.parsedOptions.startDateField]<=r.record[this._gantt.parsedOptions.startDateField];)t=t.nextSibling;t!==r&&t.parent.insertAfter(r,t)}else if("left"===p){let t=r;for(;t.previousSibling&&t.previousSibling.attribute.y===r.attribute.y&&t.previousSibling.record[this._gantt.parsedOptions.startDateField]>=r.record[this._gantt.parsedOptions.startDateField];)t=t.previousSibling;t!==r&&t.parent.insertBefore(r,t)}}this._gantt.scenegraph.updateNextFrame()}this.moveTaskBar.moving=!1,this.selectedTaskBar.target!==r&&r.setAttribute("zIndex",0),r.updateTextPosition(),this.moveTaskBar.target=null,this.moveTaskBar.deltaX=0,this.moveTaskBar.deltaY=0,this.moveTaskBar.moveTaskBarXSpeed=0}dealTaskBarMove(t){var e,r,i,n,s,o;const a=this._gantt;let l=this.moveTaskBar.target;l.setAttribute("zIndex",1e4);const h=a.eventManager.lastDragPointerXYOnWindow.x,c=t.x-h,u=a.eventManager.lastDragPointerXYOnWindow.y,d=t.y-u;if(this.moveTaskBar.deltaX+=c,this.moveTaskBar.deltaY+=d,zp(l,c,d,this),l.attribute.x<=a.stateManager.scrollLeft&&c<0)if(a.parsedOptions.moveTaskBarToExtendDateRange&&0===a.stateManager.scrollLeft){null===(e=this.moveTaskBar.moveTaskBarXInertia)||void 0===e||e.endInertia();const n=a.parsedOptions.reverseSortedTimelineScales[0].timelineDates[1].startDate.getTime()-a.parsedOptions.reverseSortedTimelineScales[0].timelineDates[0].startDate.getTime(),{unit:s,startOfWeek:o}=a.parsedOptions.reverseSortedTimelineScales[0];a.parsedOptions.minDate=Hd(new Date(a.parsedOptions.reverseSortedTimelineScales[0].timelineDates[0].startDate.getTime()-n/2),s,o),a.parsedOptions._minDateTime=null===(r=a.parsedOptions.minDate)||void 0===r?void 0:r.getTime(),a._generateTimeLineDateMap(),a._updateSize(),a.scenegraph.refreshAll(),l=this.moveTaskBar.target=a.scenegraph.taskBar.getTaskBarNodeByIndex(this.moveTaskBar.target.task_index,this.moveTaskBar.target.sub_task_index),a.scrollLeft=a.parsedOptions.timelineColWidth-1,a.eventManager.lastDragPointerXYOnWindow.x=t.x,"milestone"===(null===(i=l.record)||void 0===i?void 0:i.type)?zp(l,a.scrollLeft-l.attribute.x,0,this):l.setAttribute("x",a.scrollLeft)}else this.moveTaskBar.moveTaskBarXSpeed=-a.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,zp(l,t,e,this),a.stateManager.setScrollLeft(l.attribute.x),0===a.stateManager.scrollLeft&&this.moveTaskBar.moveTaskBarXInertia.endInertia()}));else if(l.attribute.x+l.attribute.width>=a.stateManager.scrollLeft+a.tableNoFrameWidth&&c>0)if(a.parsedOptions.moveTaskBarToExtendDateRange&&a.stateManager.scrollLeft+a.tableNoFrameWidth===a.getAllDateColsWidth()){null===(n=this.moveTaskBar.moveTaskBarXInertia)||void 0===n||n.endInertia();const e=a.parsedOptions.reverseSortedTimelineScales[0].timelineDates,r=e[1].startDate.getTime()-e[0].startDate.getTime(),{unit:i,startOfWeek:h,step:c}=a.parsedOptions.reverseSortedTimelineScales[0];if(a.parsedOptions.maxDate=zd(a.parsedOptions.minDate,new Date(e[e.length-1].endDate.getTime()+r/2),i,c),a.parsedOptions._maxDateTime=null===(s=a.parsedOptions.maxDate)||void 0===s?void 0:s.getTime(),a._generateTimeLineDateMap(),a._updateSize(),a.scenegraph.refreshAll(),l=this.moveTaskBar.target=a.scenegraph.taskBar.getTaskBarNodeByIndex(this.moveTaskBar.target.task_index,this.moveTaskBar.target.sub_task_index),a.scrollLeft+=1,a.eventManager.lastDragPointerXYOnWindow.x=t.x,"milestone"===(null===(o=l.record)||void 0===o?void 0:o.type)){const t=a.scrollLeft+a.tableNoFrameWidth-l.attribute.width;zp(l,t-l.attribute.x,0,this)}else l.setAttribute("x",a.scrollLeft+a.tableNoFrameWidth-l.attribute.width)}else this.moveTaskBar.moveTaskBarXSpeed=a.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,zp(l,t,e,this),a.stateManager.setScrollLeft(l.attribute.x+l.attribute.width-a.tableNoFrameWidth),a.stateManager.scrollLeft===a.getAllDateColsWidth()-a.tableNoFrameWidth&&this.moveTaskBar.moveTaskBarXInertia.endInertia()}));else this.moveTaskBar.moveTaskBarXInertia.isInertiaScrolling()?this.moveTaskBar.moveTaskBarXInertia.endInertia():this.moveTaskBar.moveTaskBarXSpeed=0;a.scenegraph.updateNextFrame()}startResizeTaskBar(t,e,r,i,n){this.resizeTaskBar.onIconName=n,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=r,this.resizeTaskBar.startOffsetY=i}isResizingTaskBar(){return this.resizeTaskBar.resizing}endResizeTaskBar(t){const e=this._gantt.stateManager.resizeTaskBar.onIconName,r=t-this.resizeTaskBar.startX;if(Math.abs(r)>=1){const t=Kd(("left"===e?this.resizeTaskBar.target.attribute.x:this.resizeTaskBar.target.attribute.x+this.resizeTaskBar.target.attribute.width)-this._gantt.stateManager.scroll.horizontalBarPos,this._gantt),r=this._gantt.parsedOptions.reverseSortedTimelineScales[0].timelineDates[t];if(!r)return;const i="left"===e?r.startDate:r.endDate,n=this.resizeTaskBar.target,s=n.clipGroupBox,o=n.barRect,a=n.progressRect,l=n.textLabel,h=n.task_index,c=n.sub_task_index,{taskDays:u,progress:d,startDate:p,endDate:f}=this._gantt.getTaskInfoByTaskListIndex(h,c);let g=!1;if("left"===e?(this._gantt._updateStartDateToTaskRecord(i,h,c),i.getTime()!==new Date(p).getTime()&&(g=!0)):(this._gantt._updateEndDateToTaskRecord(i,h,c),i.getTime()!==new Date(f).getTime()&&(g=!0)),this._gantt.parsedOptions.tasksShowMode===Sd.Sub_Tasks_Arrange||this._gantt.parsedOptions.tasksShowMode===Sd.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;n.setAttribute("x",e),n.setAttribute("width",this.resizeTaskBar.targetEndX-e)}else if("right"===e){const e=this._gantt.getDateColsWidth(0,t);n.setAttribute("width",e-this.resizeTaskBar.targetStartX)}if(s.setAttribute("width",n.attribute.width),null==o||o.setAttribute("width",n.attribute.width),null==a||a.setAttribute("width",d/100*n.attribute.width),l){const{textAlign:t,textBaseline:e,padding:r}=this._gantt.parsedOptions.taskBarLabelStyle,i=ep(Pd(r),t,e,n.attribute.width,n.attribute.height);l.setAttribute("maxLineWidth",n.attribute.width-20),l.setAttribute("x",i.x)}this._gantt.scenegraph.refreshRecordLinkNodes(h,c,n,0),this.showTaskBarHover(),jp(this._gantt,n,h,c),n.setAttribute("zIndex",0)}if(n.updateTextPosition(),this.resizeTaskBar.resizing=!1,this.resizeTaskBar.target=null,g&&this._gantt.hasListeners(kd.CHANGE_DATE_RANGE)){const t=this._gantt.getRecordByIndex(h,c);this._gantt.fireListeners(kd.CHANGE_DATE_RANGE,{startDate:t[this._gantt.parsedOptions.startDateField],endDate:t[this._gantt.parsedOptions.endDateField],oldStartDate:p,oldEndDate:f,index:h,record:t})}this._gantt.scenegraph.updateNextFrame()}}dealTaskBarResize(t){const e=this._gantt.eventManager.lastDragPointerXYOnWindow.x,r=t.x-e,i=this._gantt.stateManager.resizeTaskBar.target;let n="left"===this._gantt.stateManager.resizeTaskBar.onIconName?-r:r;const s=Math.max(1,i.attribute.width+n);n=s-i.attribute.width,function(t,e,r,i){const n=i._gantt.parsedOptions.progressField,s=t.clipGroupBox,o=t.barRect,a=t.progressRect,l=t.textLabel,h=t.task_index,c=t.sub_task_index,u=t.record,d=u[n],p=u.type===Td.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]),r&&t.setAttribute("width",r),s.setAttribute("width",t.attribute.width),null==o||o.setAttribute("width",t.attribute.width),null==a||a.setAttribute("width",d/100*t.attribute.width),l){const{textAlign:e,textBaseline:n,padding:s}=i._gantt.parsedOptions.taskBarLabelStyle,o=ep(Pd(s),e,n,r,t.attribute.height);l.setAttribute("maxLineWidth",r-20),l.setAttribute("x",o.x)}t.updateTextPosition(),i.showTaskBarHover(),jp(i._gantt,t,h,c),i._gantt.scenegraph.refreshRecordLinkNodes(h,c,t,0)}(i,"left"===this._gantt.stateManager.resizeTaskBar.onIconName?-n:0,s,this),this._gantt.scenegraph.updateNextFrame()}startCreateDependencyLine(t,e,r,i,n){this.resizeTaskBar.resizing=!1,this.creatingDenpendencyLink.creating=!0,this.creatingDenpendencyLink.startClickedPoint=t,this.creatingDenpendencyLink.startX=e,this.creatingDenpendencyLink.startY=r,this.creatingDenpendencyLink.startOffsetY=i,this.creatingDenpendencyLink.firstTaskBarPosition=n,this.highlightLinkPointNode(t)}isCreatingDependencyLine(){return this.creatingDenpendencyLink.creating}endCreateDependencyLine(t){const e=this._gantt.parsedOptions.taskKeyField,r=this.selectedTaskBar.target.task_index,i=this.selectedTaskBar.target.sub_task_index,n=this.creatingDenpendencyLink.secondTaskBarNode.task_index,s=this.creatingDenpendencyLink.secondTaskBarNode.sub_task_index,o={linkedFromTaskKey:this._gantt.getRecordByIndex(r,i)[e],linkedToTaskKey:this._gantt.getRecordByIndex(n,s)[e],type:"left"===this.creatingDenpendencyLink.firstTaskBarPosition&&"left"===this.creatingDenpendencyLink.secondTaskBarPosition?xd.StartToStart:"right"===this.creatingDenpendencyLink.firstTaskBarPosition&&"left"===this.creatingDenpendencyLink.secondTaskBarPosition?xd.FinishToStart:"right"===this.creatingDenpendencyLink.firstTaskBarPosition&&"right"===this.creatingDenpendencyLink.secondTaskBarPosition?xd.FinishToFinish:xd.StartToFinish};return this._gantt.addLink(o),this.hideTaskBarSelectedBorder(),this._gantt.scenegraph.updateNextFrame(),this.creatingDenpendencyLink.creating=!1,o}dealCreateDependencyLine(t){const e=this.creatingDenpendencyLink.startX,r=this.creatingDenpendencyLink.startY,i=t.x-e,n=t.y-r,s=this.creatingDenpendencyLink.startClickedPoint,o=s.attribute.x+s.attribute.width/2,a=s.attribute.y+s.attribute.height/2;this._gantt.scenegraph.taskBar.updateCreatingDependencyLine(o,a,o+i,a+n),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,r;if(!this.resizeTableWidth.resizing)return;const i=t.pageX-this.resizeTableWidth.lastX;if(Math.abs(i)>=1){let n=this._gantt.taskTableWidth+i;const s=Math.min(this._gantt.taskListTableInstance.getAllColsWidth()+this._gantt.parsedOptions.outerFrameStyle.borderLineWidth,null!==(e=this._gantt.options.taskListTable.maxTableWidth)&&void 0!==e?e:1e5),o=Math.max(this._gantt.parsedOptions.outerFrameStyle.borderLineWidth,null!==(r=this._gantt.options.taskListTable.minTableWidth)&&void 0!==r?r:0);i>0&&n>s&&(n=s),i<0&&n<o&&(n=o),this._gantt.taskTableWidth=n,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,r=t.attribute.y,i=t.attribute.width,n=t.attribute.height;this._gantt.scenegraph.taskBar.showHoverBar(e,r,i,n,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 r=this._gantt.parsedOptions.dependencyLinkCreatable;t.setAttribute("zIndex",1e4);const i=t.attribute.x,n=t.attribute.y,s=t.attribute.width,o=t.attribute.height;this._gantt.scenegraph.taskBar.createSelectedBorder(i,n,s,o,t,r),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,r=t.attribute.y,i=t.attribute.width,n=t.attribute.height;this._gantt.scenegraph.taskBar.createSelectedBorder(e,r,i,n,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:r}=this._gantt.parsedOptions,{linkedToTaskKey:i,linkedFromTaskKey:n,type:s}=t;let o,a,l,h;const c=ip(this._gantt.records,e,i),u=ip(this._gantt.records,e,n);this._gantt.parsedOptions.tasksShowMode===Sd.Sub_Tasks_Inline||this._gantt.parsedOptions.tasksShowMode===Sd.Sub_Tasks_Separate||this._gantt.parsedOptions.tasksShowMode===Sd.Sub_Tasks_Arrange||this._gantt.parsedOptions.tasksShowMode===Sd.Sub_Tasks_Compact?(o=u.index[0],a=u.index[1],l=c.index[0],h=c.index[1]):(o=this._gantt.getTaskShowIndexByRecordIndex(u.index),l=this._gantt.getTaskShowIndexByRecordIndex(c.index));const d=this._gantt.scenegraph.taskBar.getTaskBarNodeByIndex(o,a);this._gantt.scenegraph.taskBar.createSelectedBorder(d.attribute.x,d.attribute.y,d.attribute.width,d.attribute.height,d,!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 r=this._gantt.stateManager.marklineIcon.target;if(r){const i=this._gantt.scenegraph.timelineHeader.showMarklineIcon(r.parent);i&&(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(i),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,r;if(!t||0===t.length||!this._gantt||!this._gantt.records)return;const i=this._gantt.parsedOptions.startDateField,n=this._gantt.parsedOptions.endDateField,s=[...t];for(;s.length>0;){const t=[...s],r=t.pop();let o=this._gantt.records;for(const e of t){if(!o[e]||!o[e].children)return;o=o[e].children}const a=0===t.length?this._gantt.records[r]:o[r];if(a&&a.type===Td.PROJECT&&a.children&&a.children.length>0){let t=null,r=null;for(const e of a.children)if(e[i]&&e[n]){const s=new Date(e[i]),o=new Date(e[n]);(!t||s<t)&&(t=s),(!r||o>r)&&(r=o)}if(t&&r){const s=a[i]?new Date(a[i]):null,o=a[n]?new Date(a[n]):null;if(!s||!o||t.getTime()!==s.getTime()||r.getTime()!==o.getTime()){const s=null!==(e=this._gantt.parsedOptions.dateFormat)&&void 0!==e?e:this._gantt.parseTimeFormat(a[i]||a.children[0][i]),o=t=>this._gantt.formatDate?this._gantt.formatDate(t,s):t.toISOString().split("T")[0];a[i]=o(t),a[n]=o(r)}}}s.pop()}null===(r=this._gantt.scenegraph)||void 0===r||r.refreshAll()}}function jp(t,e,r,i){const n=t.parsedOptions.taskBarCustomLayout;if(n){let s;if("function"==typeof n){const{startDate:o,endDate:a,taskDays:l,progress:h,taskRecord:c}=t.getTaskInfoByTaskListIndex(r,i);s=n({width:e.attribute.width,height:e.attribute.height,index:r,startDate:o,endDate:a,taskDays:l,progress:h,taskRecord:c,ganttInstance:t})}else s=n;if(s){const t=s.rootContainer;t.name="task-bar-custom-render";const r=e.children.find((t=>"task-bar-group"===t.name));if(r){const e=r.children.findIndex((t=>"task-bar-custom-render"===t.name)),i=r.children[e];i&&(r.removeChild(i),r.insertInto(t,e))}}}}function zp(t,e,r,i){const n=t.task_index,s=t.sub_task_index,o=t.record.type===Td.MILESTONE,a=t.attribute.x,l=t.attribute.y;if(e&&t.setAttribute("x",Math.max(0,t.attribute.x+e)),i._gantt.parsedOptions.tasksShowMode!==Sd.Tasks_Separate&&i._gantt.parsedOptions.tasksShowMode!==Sd.Project_Sub_Tasks_Inline?r&&t.setAttribute("y",t.attribute.y+r):r=0,o&&(t.setAttribute("anchor",[t.attribute.x+t.attribute.width/2,t.attribute.y+t.attribute.height/2]),t.milestoneTextContainer)){const e=t.attribute.x-a,r=t.attribute.y-l,i=t.milestoneTextContainer.attribute.x,n=t.milestoneTextContainer.attribute.y;t.milestoneTextContainer.setAttribute("x",i+e),t.milestoneTextContainer.setAttribute("y",n+r)}t.updateTextPosition(),i._gantt.scenegraph.refreshRecordLinkNodes(n,s,t,r)}let Hp=1;class Wp{constructor(){this.listenersData={listeners:{},listenerData:{}}}on(t,e){const r=this.listenersData.listeners[t]||(this.listenersData.listeners[t]=[]);r.push(e);const i=Hp++;return this.listenersData.listenerData[i]={type:t,listener:e,remove:()=>{delete this.listenersData.listenerData[i];const n=r.indexOf(e);r.splice(n,1),this.listenersData.listeners[t].length||delete this.listenersData.listeners[t]}},i}off(t,e){var r;if(e){const r=t;this.removeEventListener(r,e)}else{const e=t;if(!this.listenersData)return;null===(r=this.listenersData.listenerData[e])||void 0===r||r.remove()}}addEventListener(t,e,r){this.on(t,e)}removeEventListener(t,e){if(this.listenersData)for(const r in this.listenersData.listenerData){const i=this.listenersData.listenerData[r];i.type===t&&i.listener===e&&this.off(r)}}hasListeners(t){return!!this.listenersData&&!!this.listenersData.listeners[t]}fireListeners(t,e){if(!this.listenersData)return[];const r=this.listenersData.listeners[t];return r?r.map((t=>t.call(this,e))).filter((t=>ld(t))):[]}release(){delete this.listenersData}}class Up{constructor(t){this._gantt=t,this.records=t.records,this.processRecords()}processRecords(){const t=!this._gantt.options.minDate,e=!this._gantt.options.maxDate;let r=Number.MAX_SAFE_INTEGER,i=Number.MIN_SAFE_INTEGER;if((t||e||this._gantt.parsedOptions.tasksShowMode===Sd.Sub_Tasks_Inline||this._gantt.parsedOptions.tasksShowMode===Sd.Sub_Tasks_Compact)&&this.records.length){for(let n=0;n<this.records.length;n++){const s=this.records[n];if(t&&s[this._gantt.parsedOptions.startDateField]){const t=Md(s[this._gantt.parsedOptions.startDateField]);r=Math.min(r,t.getTime())}if(e&&s[this._gantt.parsedOptions.endDateField]){const t=Md(s[this._gantt.parsedOptions.endDateField]);i=Math.max(i,t.getTime())}this._gantt.parsedOptions.tasksShowMode!==Sd.Sub_Tasks_Inline&&this._gantt.parsedOptions.tasksShowMode!==Sd.Sub_Tasks_Compact||s.children&&s.children.sort(((t,e)=>Md(t[this._gantt.parsedOptions.startDateField]).getTime()-Md(e[this._gantt.parsedOptions.startDateField]).getTime()))}const{unit:n,startOfWeek:s,step:o}=this._gantt.parsedOptions.reverseSortedTimelineScales[0];t&&(this._gantt.parsedOptions.minDate=Hd(new Date(r),n,s),this._gantt.parsedOptions._minDateTime=this._gantt.parsedOptions.minDate.getTime()),t&&!e&&(this._gantt.parsedOptions.maxDate=zd(this._gantt.parsedOptions.minDate,new Date(this._gantt.options.maxDate),n,o),this._gantt.parsedOptions._maxDateTime=this._gantt.parsedOptions.maxDate.getTime()),e&&(this._gantt.parsedOptions.maxDate=zd(this._gantt.parsedOptions.minDate,new Date(i),n,o),this._gantt.parsedOptions._maxDateTime=this._gantt.parsedOptions.maxDate.getTime())}}adjustOrder(t,e,r,i){var n,s,o,a;if(this._gantt.parsedOptions.tasksShowMode!==Sd.Sub_Tasks_Arrange&&this._gantt.parsedOptions.tasksShowMode!==Sd.Sub_Tasks_Compact||t!==r)if(this._gantt.parsedOptions.tasksShowMode===Sd.Sub_Tasks_Inline){if(ld(e)&&ld(i)&&ld(t)&&ld(r)){const n=this.records[t].children[e];this.records[t].children.splice(e,1),this.records[r].children||(this.records[r].children=[]),this.records[r].children.splice(i,0,n)}null===(s=null===(n=this.records[r])||void 0===n?void 0:n.children)||void 0===s||s.sort(((t,e)=>Md(t[this._gantt.parsedOptions.startDateField]).getTime()-Md(e[this._gantt.parsedOptions.startDateField]).getTime()))}else if(this._gantt.parsedOptions.tasksShowMode===Sd.Project_Sub_Tasks_Inline){if(ld(e)&&ld(i)&&ld(t)&&ld(r)){this.records[t].type,Td.PROJECT;const n=this.records[r].type===Td.PROJECT,s=this.records[t].children[e];this.records[t].children.splice(e,1),this.records[r].children||(this.records[r].children=[]),this.records[r].children.splice(i,0,s),n&&(null===(a=null===(o=this.records[r])||void 0===o?void 0:o.children)||void 0===a||a.sort(((t,e)=>Md(t[this._gantt.parsedOptions.startDateField]).getTime()-Md(e[this._gantt.parsedOptions.startDateField]).getTime())))}}else if(ld(e)&&ld(i)&&ld(t)&&ld(r)){const n=this.records[t].children[e];this.records[t].children.splice(e,1),this.records[r].children||(this.records[r].children=[]),this.records[r].children.splice(i,0,n)}}setRecords(t){this.records=t,this.processRecords()}}class $p{constructor(t,e){var r;this.plugins=new Map,this.gantt=t,null===(r=e.plugins)||void 0===r||r.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){t.runTime&&t.runTime.forEach((e=>{this.gantt.on(e,((...r)=>{var i;try{null===(i=t.run)||void 0===i||i.call(t,...r,e,this.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 Vp extends Wp{constructor(t,e){var r,i,n,s,o;super(),this.parsedOptions={},this.container=t,this.options=e,this.taskTableWidth="number"==typeof(null===(r=null==e?void 0:e.taskListTable)||void 0===r?void 0:r.tableWidth)?null===(i=null==e?void 0:e.taskListTable)||void 0===i?void 0:i.tableWidth:-1,this.taskTableColumns=null!==(s=null===(n=null==e?void 0:e.taskListTable)||void 0===n?void 0:n.columns)&&void 0!==s?s:[],this.records=null!==(o=null==e?void 0:e.records)&&void 0!==o?o:[],this._sortScales(),Jd(this),function(t){if(!t.records||0===t.records.length)return;const e=t.parsedOptions.startDateField,r=t.parsedOptions.endDateField,i=(n,s,o)=>{let a=null,l=null;return n.forEach(((s,o)=>{var h;if(!s)return;let c=null,u=null;if(s.children&&s.children.length>0&&s.type===Td.PROJECT){const[a,l]=i(s.children);if(a&&l&&(c=a,u=l,s.type===Td.PROJECT)){const i=null!==(h=t.parsedOptions.dateFormat)&&void 0!==h?h:t.parseTimeFormat(s[e]||s.children[0][e]||""),a=e=>t.formatDate?t.formatDate(e,i):e.toISOString().split("T")[0],l=Object.assign({},s);l[e]=a(c),l[r]=a(u),n[o]=l}}else s[e]&&s[r]&&(c=new Date(s[e]),u=new Date(s[r]));c&&(!a||c<a)&&(a=c),u&&(!l||u>l)&&(l=u)})),[a,l]};i(t.records)}(this),this.data=new Up(this),this._generateTimeLineDateMap(),this.timeLineHeaderLevel=this.parsedOptions.sortedTimelineScales.length,this.element=function(t,e="vtable-gantt"){var r,i;const n=document.createElement("div");n.setAttribute("tabindex","0"),n.classList.add(e),n.style.outline="none",n.style.margin=`${t.top}px ${t.right}px ${t.bottom}px ${t.left}px`;const s=(n.offsetWidth||(null===(r=n.parentElement)||void 0===r?void 0:r.offsetWidth)||1)-1,o=(n.offsetHeight||(null===(i=n.parentElement)||void 0===i?void 0:i.offsetHeight)||1)-1;return n.style.width=s&&s-t.left-t.right+"px"||"0px",n.style.height=o&&o-t.top-t.bottom+"px"||"0px",n}({top:0,right:0,left:0,bottom:0},"vtable-gantt"),this.element.style.left=-1!==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=(-1!==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 kp(this),this.stateManager=new Fp(this),this.eventManager=new Mp(this),this.scenegraph.afterCreateSceneGraph(),this._scrollToMarkLine(),this.pluginManager=new $p(this,e)}renderTaskBarsTable(){this.scenegraph.updateNextFrame()}_updateSize(){var t,r,i,n,s,o,a,l,h;let c=0,u=0;if("browser"===$d.mode){const e=this.getElement();let o=0,a=0;if(e.parentElement){const t=e.parentElement.style||window.getComputedStyle(e.parentElement);o=e.parentElement.offsetWidth-parseInt(t.paddingLeft||"0px",10)-parseInt(t.paddingRight||"0px",10),a=e.parentElement.offsetHeight-parseInt(t.paddingTop||"0px",10)-parseInt(t.paddingBottom||"0px",20)}const l=(null!=o?o:1)-1-this.taskTableWidth,h=(null!=a?a:1)-1;e.style.width=l&&`${l}px`||"0px",e.style.height=h&&`${h}px`||"0px";const{canvas:d}=this;c=null!==(r=null===(t=d.parentElement)||void 0===t?void 0:t.offsetWidth)&&void 0!==r?r:1,u=null!==(n=null===(i=d.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(c,u):(d.style.width="",d.style.height="",d.width=c,d.height=u,d.style.width=`${c}px`,d.style.height=`${u}px`)}else $d.mode;const d=Math.floor(c-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)),p=Math.floor(u-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=c,this.tableNoFrameHeight=Math.floor(u),this.parsedOptions.outerFrameStyle){const[t,r,i,n]=e.toBoxArray(null!==(a=null===(o=this.parsedOptions.outerFrameStyle)||void 0===o?void 0:o.borderLineWidth)&&void 0!==a?a:0);this.tableX=this.taskTableColumns.length>=1||(null===(l=this.options)||void 0===l?void 0:l.rowSeriesNumber)?null!==(h=this.parsedOptions.verticalSplitLine.lineWidth)&&void 0!==h?h:0:n,this.tableY=t,this.tableNoFrameWidth=Math.min(d-r-this.tableX,this.getAllDateColsWidth()),this.tableNoFrameHeight=p-t-i}}_updateListTableSize(t){var r,i,n,s,o,a,l,h,c,u,d,p;if(t){if("auto"===(null===(i=null===(r=this.options)||void 0===r?void 0:r.taskListTable)||void 0===i?void 0:i.tableWidth)||-1===this.taskTableWidth){const[r,i,f,g]=e.toBoxArray(null!==(s=null===(n=this.parsedOptions.outerFrameStyle)||void 0===n?void 0:n.borderLineWidth)&&void 0!==s?s:0);this.taskTableWidth=t.getAllColsWidth()+i,(null===(a=null===(o=this.options)||void 0===o?void 0:o.taskListTable)||void 0===a?void 0:a.maxTableWidth)&&(this.taskTableWidth=Math.min(null===(h=null===(l=this.options)||void 0===l?void 0:l.taskListTable)||void 0===h?void 0:h.maxTableWidth,this.taskTableWidth)),(null===(u=null===(c=this.options)||void 0===c?void 0:c.taskListTable)||void 0===u?void 0:u.minTableWidth)&&(this.taskTableWidth=Math.max(null===(p=null===(d=this.options)||void 0===d?void 0:d.taskListTable)||void 0===p?void 0:p.minTableWidth,this.taskTableWidth)),this.element.style.left=-1!==this.taskTableWidth?`${this.taskTableWidth}px`:"0px",t.setCanvasSize(this.taskTableWidth,this.tableNoFrameHeight+r+f),this._updateSize()}if(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 r=0;r<t.columnHeaderLevelCount;r++)t.setRowHeight(r,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,r,i,n,s,o,a,l,h,c,u,d,p,f,g,m,y,v,b,_,w,x,S,T,k,C,E,A,O,B,R,L,P,D,M,I,N,F,j,z,H,W,U,$,V,G,X,Y,q,Z,K,Q,J,tt;const et={},rt=["container","records","rowSeriesNumber","overscrollBehavior","pixelRatio","eventOptions"];for(const t of rt)t in this.options&&(et[t]=this.options[t]);if(et.defaultRowHeight=this.options.rowHeight,this.options.taskListTable)for(const t in this.options.taskListTable){if(et[t]=this.options.taskListTable[t],"columns"===t&&(et[t][et[t].length-1].disableColumnResize=!0,this.parsedOptions.tasksShowMode===Sd.Sub_Tasks_Inline||this.parsedOptions.tasksShowMode===Sd.Sub_Tasks_Separate||this.parsedOptions.tasksShowMode===Sd.Sub_Tasks_Arrange||this.parsedOptions.tasksShowMode===Sd.Sub_Tasks_Compact))for(let t=0;t<et.columns.length;t++)et.columns[t].tree&&(et.columns[t].tree=!1);"hierarchyExpandLevel"!==t||this.parsedOptions.tasksShowMode!==Sd.Sub_Tasks_Inline&&this.parsedOptions.tasksShowMode!==Sd.Sub_Tasks_Separate&&this.parsedOptions.tasksShowMode!==Sd.Sub_Tasks_Arrange&&this.parsedOptions.tasksShowMode!==Sd.Sub_Tasks_Compact||delete et[t]}if(null===(t=this.options.taskListTable)||void 0===t?void 0:t.theme)if(et.theme=null===(r=this.options.taskListTable)||void 0===r?void 0:r.theme,et.theme.bodyStyle&&!function(t,e){const r=Object.getOwnPropertyDescriptor(t,e);return!(!r||!r.set&&!0!==r.writable)}(et.theme,"bodyStyle")){et.theme=(null===(i=this.options.taskListTable)||void 0===i?void 0:i.theme).extends((null===(n=this.options.taskListTable)||void 0===n?void 0:n.theme).getExtendTheme());const t=et.theme.getExtendTheme();et.theme.clearBodyStyleCache(),(null===(s=et.theme.headerStyle)||void 0===s?void 0:s.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!==(a=null===(o=this.parsedOptions.horizontalSplitLine)||void 0===o?void 0:o.lineWidth)&&void 0!==a?a:0,0,0,0],borderColor:null===(l=this.parsedOptions.horizontalSplitLine)||void 0===l?void 0:l.lineColor}:t.bodyStyle={frameStyle:{borderLineWidth:[null!==(c=null===(h=this.parsedOptions.horizontalSplitLine)||void 0===h?void 0:h.lineWidth)&&void 0!==c?c:0,0,0,0],borderColor:null===(u=this.parsedOptions.horizontalSplitLine)||void 0===u?void 0:u.lineColor}},t.cellInnerBorder=!1;const[r,_,w,x]=e.toBoxArray(null!==(p=null===(d=this.parsedOptions.outerFrameStyle)||void 0===d?void 0:d.borderLineWidth)&&void 0!==p?p:0);t.frameStyle=Object.assign({},this.parsedOptions.outerFrameStyle,{shadowBlur:0,cornerRadius:[null!==(g=null===(f=this.parsedOptions.outerFrameStyle)||void 0===f?void 0:f.cornerRadius)&&void 0!==g?g:0,0,0,null!==(y=null===(m=this.parsedOptions.outerFrameStyle)||void 0===m?void 0:m.cornerRadius)&&void 0!==y?y:0],borderLineWidth:[r,0,w,x]}),t.scrollStyle=Object.assign({},null===(b=null===(v=this.options.taskListTable)||void 0===v?void 0:v.theme)||void 0===b?void 0:b.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{et.theme.headerStyle?et.theme.headerStyle.bgColor||(et.theme.headerStyle.bgColor=this.parsedOptions.timelineHeaderBackgroundColor):et.theme.headerStyle={bgColor:this.parsedOptions.timelineHeaderBackgroundColor},et.theme.headerStyle=Object.assign({},e.themes.DEFAULT.headerStyle,{bgColor:this.parsedOptions.timelineHeaderBackgroundColor},null===(w=null===(_=this.options.taskListTable)||void 0===_?void 0:_.theme)||void 0===w?void 0:w.headerStyle),et.theme.bodyStyle=Object.assign({},e.themes.DEFAULT.bodyStyle,null===(S=null===(x=this.options.taskListTable)||void 0===x?void 0:x.theme)||void 0===S?void 0:S.bodyStyle,{frameStyle:{borderLineWidth:[null!==(k=null===(T=this.parsedOptions.horizontalSplitLine)||void 0===T?void 0:T.lineWidth)&&void 0!==k?k:0,0,0,0],borderColor:null===(C=this.parsedOptions.horizontalSplitLine)||void 0===C?void 0:C.lineColor}}),et.theme.cellInnerBorder=!1;const[t,r,i,n]=e.toBoxArray(null!==(A=null===(E=this.parsedOptions.outerFrameStyle)||void 0===E?void 0:E.borderLineWidth)&&void 0!==A?A:0);et.theme.frameStyle=Object.assign({},this.parsedOptions.outerFrameStyle,{cornerRadius:[null!==(B=null===(O=this.parsedOptions.outerFrameStyle)||void 0===O?void 0:O.cornerRadius)&&void 0!==B?B:0,0,0,null!==(L=null===(R=this.parsedOptions.outerFrameStyle)||void 0===R?void 0:R.cornerRadius)&&void 0!==L?L:0],borderLineWidth:[t,0,i,n]}),et.theme.scrollStyle=Object.assign({},null===(D=null===(P=this.options.taskListTable)||void 0===P?void 0:P.theme)||void 0===D?void 0:D.scrollStyle,this.parsedOptions.scrollStyle,{verticalVisible:"none"}),et.theme.columnResize=Object.assign({labelColor:"rgba(0,0,0,0)",labelBackgroundFill:"rgba(0,0,0,0)"},null===(I=null===(M=this.options.taskListTable)||void 0===M?void 0:M.theme)||void 0===I?void 0:I.columnResize),et.theme.underlayBackgroundColor||(et.theme.underlayBackgroundColor=this.parsedOptions.underlayBackgroundColor)}else{const[t,r,i,n]=e.toBoxArray(null!==(F=null===(N=this.parsedOptions.outerFrameStyle)||void 0===N?void 0:N.borderLineWidth)&&void 0!==F?F:0);et.theme={scrollStyle:Object.assign({},null===(z=null===(j=this.options.taskListTable)||void 0===j?void 0:j.theme)||void 0===z?void 0:z.scrollStyle,this.parsedOptions.scrollStyle,{verticalVisible:"none"}),headerStyle:Object.assign({},e.themes.DEFAULT.headerStyle,{bgColor:this.parsedOptions.timelineHeaderBackgroundColor},null===(W=null===(H=this.options.taskListTable)||void 0===H?void 0:H.theme)||void 0===W?void 0:W.headerStyle),bodyStyle:Object.assign({},e.themes.DEFAULT.bodyStyle,null===($=null===(U=this.options.taskListTable)||void 0===U?void 0:U.theme)||void 0===$?void 0:$.bodyStyle,{frameStyle:{borderLineWidth:[null!==(G=null===(V=this.parsedOptions.horizontalSplitLine)||void 0===V?void 0:V.lineWidth)&&void 0!==G?G:0,0,0,0],borderColor:null===(X=this.parsedOptions.horizontalSplitLine)||void 0===X?void 0:X.lineColor}}),cellInnerBorder:!1,frameStyle:Object.assign({},this.parsedOptions.outerFrameStyle,{cornerRadius:[null!==(q=null===(Y=this.parsedOptions.outerFrameStyle)||void 0===Y?void 0:Y.cornerRadius)&&void 0!==q?q:0,0,0,null!==(K=null===(Z=this.parsedOptions.outerFrameStyle)||void 0===Z?void 0:Z.cornerRadius)&&void 0!==K?K:0],borderLineWidth:[t,0,i,n]}),columnResize:Object.assign({labelColor:"rgba(0,0,0,0)",labelBackgroundFill:"rgba(0,0,0,0)"},null===(J=null===(Q=this.options.taskListTable)||void 0===Q?void 0:Q.theme)||void 0===J?void 0:J.columnResize),underlayBackgroundColor:this.parsedOptions.underlayBackgroundColor}}return et.canvasWidth=this.taskTableWidth,et.canvasHeight=this.canvas.height,et.defaultHeaderRowHeight=this.getAllHeaderRowsHeight(),this.parsedOptions.tasksShowMode===Sd.Sub_Tasks_Separate?(et.customComputeRowHeight=t=>{var e;const{row:r,table:i}=t,n=i.getRecordByRowCol(0,r);if(n)return((null===(e=n.children)||void 0===e?void 0:e.length)||1)*this.parsedOptions.rowHeight},et.defaultRowHeight="auto",et.customConfig={forceComputeAllRowHeight:!0}):this.parsedOptions.tasksShowMode===Sd.Sub_Tasks_Compact?(et.customComputeRowHeight=t=>{const{row:e,table:r}=t,i=r.getRecordByRowCol(0,e);if(i)return function(t,e){var r;if(!e.children||e.children.length<=1)return 1===(null===(r=e.children)||void 0===r?void 0:r.length)?e.children[0].vtable_gantt_showIndex=0:e.vtable_gantt_showIndex=0,1;const i=e.children.slice().sort(((e,r)=>{const{startDate:i}=lp(t,e),{startDate:n}=lp(t,r);return i.getTime()-n.getTime()})),n=[];for(let e=0;e<=i.length-1;e++){const r=i[e],{startDate:s,endDate:o}=lp(t,r);let a=!1;for(let t=0;t<n.length;t++)if(s.getTime()>n[t]){n[t]=o.getTime(),a=!0,r.vtable_gantt_showIndex=t;break}a||(n.push(o.getTime()),r.vtable_gantt_showIndex=n.length-1)}return n.length}(this,i)*this.parsedOptions.rowHeight},et.defaultRowHeight="auto",et.customConfig={forceComputeAllRowHeight:!0}):this.parsedOptions.tasksShowMode===Sd.Sub_Tasks_Arrange?(et.customComputeRowHeight=t=>{const{row:e,table:r}=t,i=r.getRecordByRowCol(0,e);if(i)return function(t,e){var r;if(!e.children||e.children.length<=1)return 1===(null===(r=e.children)||void 0===r?void 0:r.length)?e.children[0].vtable_gantt_showIndex=0:e.vtable_gantt_showIndex=0,1;const i=[];for(let r=0;r<=e.children.length-1;r++){const n=e.children[r],{startDate:s,endDate:o}=lp(t,n);let a=!1;for(let r=0;r<i.length;r++)if(!ap(s,o,e.children.filter((t=>t!==n&&t.vtable_gantt_showIndex===r)),t)){i[r]=o.getTime(),a=!0,n.vtable_gantt_showIndex=r;break}a||(i.push(o.getTime()),n.vtable_gantt_showIndex=i.length-1)}return i.length}(this,i)*this.parsedOptions.rowHeight},et.defaultRowHeight="auto",et.customConfig={forceComputeAllRowHeight:!0}):et.defaultRowHeight=null!==(tt=this.options.rowHeight)&&void 0!==tt?tt:40,et.clearDOM=!1,et}getElement(){return this.element}getContainer(){return this.element.parentElement}_sortScales(){const{timelineHeader:t}=this.options;if(t){const e=t.scales,r=["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 i=e.slice().sort(((t,e)=>{"hour"!==t.unit&&"minute"!==t.unit&&"second"!==t.unit||(this.parsedOptions.timeScaleIncludeHour=!0);const i=r.indexOf(t.unit),n=r.indexOf(e.unit);return-1===i?1:-1===n?-1:i-n})),n=e.slice().sort(((t,e)=>{const i=r.indexOf(t.unit),n=r.indexOf(e.unit);return-1===i?1:-1===n?-1:n-i}));this.parsedOptions.sortedTimelineScales=i,this.parsedOptions.reverseSortedTimelineScales=n}}_generateTimeLineDateMap(){if(this.parsedOptions.minDate&&this.parsedOptions.maxDate)for(const t of this.parsedOptions.reverseSortedTimelineScales)t.timelineDates=tp(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,r)=>!1===this.parsedOptions.sortedTimelineScales[r].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 r,i;if(this.taskListTableInstance){if(ld(e)){const n=this.taskListTableInstance.getRecordByCell(0,t+this.taskListTableInstance.columnHeaderLevelCount);if(Array.isArray(e)){const i=this.getRecordIndexByTaskShowIndex(t),s=Array.isArray(i)?i.length:1,o=[...e];o.splice(0,s);let a=n;for(;o.length>0;){const t=o.shift();a=null===(r=null==a?void 0:a.children)||void 0===r?void 0:r[t]}return a}return null===(i=null==n?void 0:n.children)||void 0===i?void 0:i[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 r=this.getRecordByIndex(t,e),i=null==r?void 0:r.type,n=this.parsedOptions.startDateField,s=this.parsedOptions.endDateField,o=this.parsedOptions.progressField,a=Md(null==r?void 0:r[n]).getTime(),l=Md(null==r?void 0:r[s]).getTime();if(i&&!(null==r?void 0:r[n])||!i&&(l<this.parsedOptions._minDateTime||a>this.parsedOptions._maxDateTime||!(null==r?void 0:r[n])||!(null==r?void 0:r[s])))return{taskDays:0,progress:0,startDate:null,endDate:null,taskRecord:r};const h=function(t){return"string"==typeof t&&(t=t.replace("%",""),t=parseFloat(t)),Math.round(t)}(r[o]);let c,u;return this.parsedOptions.timeScaleIncludeHour?(c=Md(Math.min(Math.max(this.parsedOptions._minDateTime,a),this.parsedOptions._maxDateTime)),u=Fd(Math.max(Math.min(this.parsedOptions._maxDateTime,l),this.parsedOptions._minDateTime),!0)):(c=Md(Math.min(Math.max(this.parsedOptions._minDateTime,a),this.parsedOptions._maxDateTime),!0),u=jd(Math.max(Math.min(this.parsedOptions._maxDateTime,l),this.parsedOptions._minDateTime),!0)),{taskRecord:r,taskDays:(u.getTime()-c.getTime()+1)/864e5,startDate:c,endDate:u,progress:h}}_updateStartDateToTaskRecord(t,e,r){var i;const n=this.getRecordByIndex(e,r),s=this.parsedOptions.startDateField,o=Ed(t,null!==(i=this.parsedOptions.dateFormat)&&void 0!==i?i:Rd(n[s]));if(n[s]=o,ld(r))Array.isArray(r)&&this.stateManager.updateProjectTaskTimes(r);else{const t=this.getRecordIndexByTaskShowIndex(e);this._updateRecordToListTable(n,t),Array.isArray(t)&&this.stateManager.updateProjectTaskTimes(t)}}_updateEndDateToTaskRecord(t,e,r){var i;const n=this.getRecordByIndex(e,r),s=this.parsedOptions.endDateField,o=Ed(t,null!==(i=this.parsedOptions.dateFormat)&&void 0!==i?i:Rd(n[s]));if(n[s]=o,ld(r))Array.isArray(r)&&this.stateManager.updateProjectTaskTimes(r);else{const t=this.getRecordIndexByTaskShowIndex(e);this._updateRecordToListTable(n,t),Array.isArray(t)&&this.stateManager.updateProjectTaskTimes(t)}}_updateStartEndDateToTaskRecord(t,e,r,i){var n;const s=this.getRecordByIndex(r,i),o=this.parsedOptions.startDateField,a=this.parsedOptions.endDateField,l=null!==(n=this.parsedOptions.dateFormat)&&void 0!==n?n:Rd(s[o]),h=Ed(t,l);s[o]=h;const c=Ed(e,l);if(s[a]=c,ld(i))Array.isArray(i)&&this.stateManager.updateProjectTaskTimes(i);else{const t=this.getRecordIndexByTaskShowIndex(r);this._updateRecordToListTable(s,t),Array.isArray(t)&&this.stateManager.updateProjectTaskTimes(t)}}_dragOrderTaskRecord(t,e,r,i){this.data.adjustOrder(t,e,r,i)}updateTaskRecord(t,e,r){if(ld(r)){const i="number"==typeof e?e:e[0];return this._updateRecordToListTable(t,[i,r]),void this._refreshTaskBar(i,r)}if(Array.isArray(e)){const r=e[0],i=e[1];return this._updateRecordToListTable(t,e),void this._refreshTaskBar(r,i)}let i=e;"tree"===this.taskListTableInstance.rowHierarchyType&&(i=this.taskListTableInstance.getRecordIndexByCell(0,e+this.taskListTableInstance.columnHeaderLevelCount)),this._updateRecordToListTable(t,i),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,r,i,n,s;this._updateSize(),null===(t=this.taskListTableInstance)||void 0===t||t.setCanvasSize(this.taskTableWidth,this.tableNoFrameHeight+e.toBoxArray(null!==(i=null===(r=this.parsedOptions.outerFrameStyle)||void 0===r?void 0:r.borderLineWidth)&&void 0!==i?i:0)[0]+e.toBoxArray(null!==(s=null===(n=this.parsedOptions.outerFrameStyle)||void 0===n?void 0:n.borderLineWidth)&&void 0!==s?s:0)[2]),this._syncPropsFromTable(),this.scenegraph.resize(),rp(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:r}=this.element;r&&(r.removeChild(this.element),this.verticalSplitResizeLine&&r.removeChild(this.verticalSplitResizeLine),this.horizontalSplitLine&&r.removeChild(this.horizontalSplitLine)),this.scenegraph=null,this.pluginManager.release()}updateOption(t){var e,r,i,n,s;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===(r=null==t?void 0:t.taskListTable)||void 0===r?void 0:r.tableWidth:-1,this.taskTableColumns=null!==(n=null===(i=null==t?void 0:t.taskListTable)||void 0===i?void 0:i.columns)&&void 0!==n?n:[],this.records=null!==(s=null==t?void 0:t.records)&&void 0!==s?s:[],this._sortScales(),Jd(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=-1!==this.taskTableWidth?`${this.taskTableWidth}px`:"0px",rp(this),this.scenegraph.updateSceneGraph(),this.scenegraph.afterCreateSceneGraph(),this._scrollToMarkLine()}setRecords(t){this.records=t,this.data.setRecords(t),function(t){var e,r,i,n,s,o,a;const l=t.options,{unit:h,startOfWeek:c}=t.parsedOptions.reverseSortedTimelineScales[0];t.parsedOptions.markLine=Qd(null==l?void 0:l.markLine),null!==(r=null===(e=t.parsedOptions.markLine)||void 0===e?void 0:e.length)&&void 0!==r&&r&&((null===(i=t.parsedOptions.markLine)||void 0===i?void 0:i.every((t=>void 0===t.scrollToMarkLine)))&&(t.parsedOptions.markLine[0].scrollToMarkLine=!0),(null===(n=t.parsedOptions.markLine)||void 0===n?void 0:n.find((t=>t.scrollToMarkLine)))&&(t.parsedOptions.scrollToMarkLineDate=Hd(new Date(null===(s=t.parsedOptions.markLine)||void 0===s?void 0:s.find((t=>t.scrollToMarkLine)).date),h,c))),t.parsedOptions.dependencyLinks=null!==(a=null===(o=l.dependency)||void 0===o?void 0:o.links)&&void 0!==a?a:[]}(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,r=this.stateManager.scroll.verticalBarPos;this.scenegraph.setX(-e),this.scenegraph.setY(-r)}updateScales(t){const e=this.parsedOptions.sortedTimelineScales.length;if(this.options.timelineHeader.scales=t,this._sortScales(),function(t){var e,r,i,n;const s=t.options,{unit:o,startOfWeek:a,step:l}=t.parsedOptions.reverseSortedTimelineScales[0];t.parsedOptions.minDate=Hd(new Date(t.parsedOptions.minDate),o,a),t.parsedOptions.maxDate=zd(t.parsedOptions.minDate,new Date(t.parsedOptions.maxDate),o,l),t.parsedOptions._minDateTime=null===(e=t.parsedOptions.minDate)||void 0===e?void 0:e.getTime(),t.parsedOptions._maxDateTime=null===(r=t.parsedOptions.maxDate)||void 0===r?void 0:r.getTime(),t.parsedOptions.timeLineHeaderRowHeights=[],t.parsedOptions.timelineHeaderStyles=[];for(let e=0;e<t.parsedOptions.sortedTimelineScales.length;e++){const r=t.parsedOptions.sortedTimelineScales[e].style;t.parsedOptions.timelineHeaderStyles.push(Object.assign({fontSize:20,fontWeight:"bold",textAlign:"center",textBaseline:"middle",color:"#000",backgroundColor:"#fff"},r)),t.parsedOptions.timeLineHeaderRowHeights.push(null!==(n=null!==(i=t.parsedOptions.sortedTimelineScales[e].rowHeight)&&void 0!==i?i:null==s?void 0:s.headerRowHeight)&&void 0!==n?n:40)}}(this),this._generateTimeLineDateMap(),this.timeLineHeaderLevel=this.parsedOptions.sortedTimelineScales.length,this.scenegraph.refreshAll(),rp(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,r;const i=t.options,{unit:n,startOfWeek:s,step:o}=t.parsedOptions.reverseSortedTimelineScales[0];t.parsedOptions.minDate=(null==i?void 0:i.minDate)?Hd(new Date(i.minDate),n,s):void 0,t.parsedOptions.maxDate=(null==i?void 0:i.maxDate)?zd(t.parsedOptions.minDate,new Date(i.maxDate),n,o):void 0,t.parsedOptions._minDateTime=null===(e=t.parsedOptions.minDate)||void 0===e?void 0:e.getTime(),t.parsedOptions._maxDateTime=null===(r=t.parsedOptions.maxDate)||void 0===r?void 0:r.getTime()}(this),this._generateTimeLineDateMap(),this._updateSize(),this.scenegraph.refreshAll(),this._scrollToMarkLine()}updateMarkLine(t){this.options.markLine=t,hp(this),this.scenegraph.markLine.refresh(),this.scenegraph.renderSceneGraph()}addMarkLine(t){this.options.markLine=[...this.parsedOptions.markLine,t],hp(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)],hp(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:r}=this.parsedOptions.reverseSortedTimelineScales[0],i=Wd(this.parsedOptions.scrollToMarkLineDate,t,e,r)*this.parsedOptions.timelineColWidth-this.tableNoFrameWidth/2;this.stateManager.setScrollLeft(i)}}scrollToMarkLine(t){if(!t||!this.parsedOptions.minDate)return;const e=this.parsedOptions.minDate,{unit:r,step:i}=this.parsedOptions.reverseSortedTimelineScales[0],n=Wd(t,e,r,i)*this.parsedOptions.timelineColWidth-this.tableNoFrameWidth/2;this.stateManager.setScrollLeft(n)}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 Rd(t)}getTaskBarStyle(t,e){const{startDate:r,endDate:i,taskRecord:n}=this.getTaskInfoByTaskListIndex(t,e);let s;return s=n.type===Td.PROJECT?this.parsedOptions.projectBarStyle:this.parsedOptions.taskBarStyle,"function"==typeof s?s({index:t,startDate:r,endDate:i,taskRecord:n,ganttInstance:this}):s}formatDate(t,e){return Ed(t,e)}}var Gp=1e6,Xp=1e6,Yp="[big.js] ",qp=Yp+"Invalid ",Zp=qp+"decimal places",Kp=qp+"rounding mode",Qp=Yp+"Division by zero",Jp={},tf=void 0,ef=/^-?(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i;function rf(t,e,r,i){var n=t.c;if(r===tf&&(r=t.constructor.RM),0!==r&&1!==r&&2!==r&&3!==r)throw Error(Kp);if(e<1)i=3===r&&(i||!!n[0])||0===e&&(1===r&&n[0]>=5||2===r&&(n[0]>5||5===n[0]&&(i||n[1]!==tf))),n.length=1,i?(t.e=t.e-e+1,n[0]=1):n[0]=t.e=0;else if(e<n.length){if(i=1===r&&n[e]>=5||2===r&&(n[e]>5||5===n[e]&&(i||n[e+1]!==tf||1&n[e-1]))||3===r&&(i||!!n[0]),n.length=e,i)for(;++n[--e]>9;)if(n[e]=0,0===e){++t.e,n.unshift(1);break}for(e=n.length;!n[--e];)n.pop()}return t}function nf(t,e,r){var i=t.e,n=t.c.join(""),s=n.length;if(e)n=n.charAt(0)+(s>1?"."+n.slice(1):"")+(i<0?"e":"e+")+i;else if(i<0){for(;++i;)n="0"+n;n="0."+n}else if(i>0)if(++i>s)for(i-=s;i--;)n+="0";else i<s&&(n=n.slice(0,i)+"."+n.slice(i));else s>1&&(n=n.charAt(0)+"."+n.slice(1));return t.s<0&&r?"-"+n:n}Jp.abs=function(){var t=new this.constructor(this);return t.s=1,t},Jp.cmp=function(t){var e,r=this,i=r.c,n=(t=new r.constructor(t)).c,s=r.s,o=t.s,a=r.e,l=t.e;if(!i[0]||!n[0])return i[0]?s:n[0]?-o:0;if(s!=o)return s;if(e=s<0,a!=l)return a>l^e?1:-1;for(o=(a=i.length)<(l=n.length)?a:l,s=-1;++s<o;)if(i[s]!=n[s])return i[s]>n[s]^e?1:-1;return a==l?0:a>l^e?1:-1},Jp.div=function(t){var e=this,r=e.constructor,i=e.c,n=(t=new r(t)).c,s=e.s==t.s?1:-1,o=r.DP;if(o!==~~o||o<0||o>Gp)throw Error(Zp);if(!n[0])throw Error(Qp);if(!i[0])return t.s=s,t.c=[t.e=0],t;var a,l,h,c,u,d=n.slice(),p=a=n.length,f=i.length,g=i.slice(0,a),m=g.length,y=t,v=y.c=[],b=0,_=o+(y.e=e.e-t.e)+1;for(y.s=s,s=_<0?0:_,d.unshift(0);m++<a;)g.push(0);do{for(h=0;h<10;h++){if(a!=(m=g.length))c=a>m?1:-1;else for(u=-1,c=0;++u<a;)if(n[u]!=g[u]){c=n[u]>g[u]?1:-1;break}if(!(c<0))break;for(l=m==a?n:d;m;){if(g[--m]<l[m]){for(u=m;u&&!g[--u];)g[u]=9;--g[u],g[m]+=10}g[m]-=l[m]}for(;!g[0];)g.shift()}v[b++]=c?h:++h,g[0]&&c?g[m]=i[p]||0:g=[i[p]]}while((p++<f||g[0]!==tf)&&s--);return v[0]||1==b||(v.shift(),y.e--,_--),b>_&&rf(y,_,r.RM,g[0]!==tf),y},Jp.eq=function(t){return 0===this.cmp(t)},Jp.gt=function(t){return this.cmp(t)>0},Jp.gte=function(t){return this.cmp(t)>-1},Jp.lt=function(t){return this.cmp(t)<0},Jp.lte=function(t){return this.cmp(t)<1},Jp.minus=Jp.sub=function(t){var e,r,i,n,s=this,o=s.constructor,a=s.s,l=(t=new o(t)).s;if(a!=l)return t.s=-l,s.plus(t);var h=s.c.slice(),c=s.e,u=t.c,d=t.e;if(!h[0]||!u[0])return u[0]?t.s=-l:h[0]?t=new o(s):t.s=1,t;if(a=c-d){for((n=a<0)?(a=-a,i=h):(d=c,i=u),i.reverse(),l=a;l--;)i.push(0);i.reverse()}else for(r=((n=h.length<u.length)?h:u).length,a=l=0;l<r;l++)if(h[l]!=u[l]){n=h[l]<u[l];break}if(n&&(i=h,h=u,u=i,t.s=-t.s),(l=(r=u.length)-(e=h.length))>0)for(;l--;)h[e++]=0;for(l=e;r>a;){if(h[--r]<u[r]){for(e=r;e&&!h[--e];)h[e]=9;--h[e],h[r]+=10}h[r]-=u[r]}for(;0===h[--l];)h.pop();for(;0===h[0];)h.shift(),--d;return h[0]||(t.s=1,h=[d=0]),t.c=h,t.e=d,t},Jp.mod=function(t){var e,r=this,i=r.constructor,n=r.s,s=(t=new i(t)).s;if(!t.c[0])throw Error(Qp);return r.s=t.s=1,e=1==t.cmp(r),r.s=n,t.s=s,e?new i(r):(n=i.DP,s=i.RM,i.DP=i.RM=0,r=r.div(t),i.DP=n,i.RM=s,this.minus(r.times(t)))},Jp.neg=function(){var t=new this.constructor(this);return t.s=-t.s,t},Jp.plus=Jp.add=function(t){var e,r,i,n=this,s=n.constructor;if(t=new s(t),n.s!=t.s)return t.s=-t.s,n.minus(t);var o=n.e,a=n.c,l=t.e,h=t.c;if(!a[0]||!h[0])return h[0]||(a[0]?t=new s(n):t.s=n.s),t;if(a=a.slice(),e=o-l){for(e>0?(l=o,i=h):(e=-e,i=a),i.reverse();e--;)i.push(0);i.reverse()}for(a.length-h.length<0&&(i=h,h=a,a=i),e=h.length,r=0;e;a[e]%=10)r=(a[--e]=a[e]+h[e]+r)/10|0;for(r&&(a.unshift(r),++l),e=a.length;0===a[--e];)a.pop();return t.c=a,t.e=l,t},Jp.pow=function(t){var e=this,r=new e.constructor("1"),i=r,n=t<0;if(t!==~~t||t<-1e6||t>Xp)throw Error(qp+"exponent");for(n&&(t=-t);1&t&&(i=i.times(e)),t>>=1;)e=e.times(e);return n?r.div(i):i},Jp.prec=function(t,e){if(t!==~~t||t<1||t>Gp)throw Error(qp+"precision");return rf(new this.constructor(this),t,e)},Jp.round=function(t,e){if(t===tf)t=0;else if(t!==~~t||t<-Gp||t>Gp)throw Error(Zp);return rf(new this.constructor(this),t+this.e+1,e)},Jp.sqrt=function(){var t,e,r,i=this,n=i.constructor,s=i.s,o=i.e,a=new n("0.5");if(!i.c[0])return new n(i);if(s<0)throw Error(Yp+"No square root");0===(s=Math.sqrt(+nf(i,!0,!0)))||s===1/0?((e=i.c.join("")).length+o&1||(e+="0"),o=((o+1)/2|0)-(o<0||1&o),t=new n(((s=Math.sqrt(e))==1/0?"5e":(s=s.toExponential()).slice(0,s.indexOf("e")+1))+o)):t=new n(s+""),o=t.e+(n.DP+=4);do{r=t,t=a.times(r.plus(i.div(r)))}while(r.c.slice(0,o).join("")!==t.c.slice(0,o).join(""));return rf(t,(n.DP-=4)+t.e+1,n.RM)},Jp.times=Jp.mul=function(t){var e,r=this,i=r.constructor,n=r.c,s=(t=new i(t)).c,o=n.length,a=s.length,l=r.e,h=t.e;if(t.s=r.s==t.s?1:-1,!n[0]||!s[0])return t.c=[t.e=0],t;for(t.e=l+h,o<a&&(e=n,n=s,s=e,h=o,o=a,a=h),e=new Array(h=o+a);h--;)e[h]=0;for(l=a;l--;){for(a=0,h=o+l;h>l;)a=e[h]+s[l]*n[h-l-1]+a,e[h--]=a%10,a=a/10|0;e[h]=a}for(a?++t.e:e.shift(),l=e.length;!e[--l];)e.pop();return t.c=e,t},Jp.toExponential=function(t,e){var r=this,i=r.c[0];if(t!==tf){if(t!==~~t||t<0||t>Gp)throw Error(Zp);for(r=rf(new r.constructor(r),++t,e);r.c.length<t;)r.c.push(0)}return nf(r,!0,!!i)},Jp.toFixed=function(t,e){var r=this,i=r.c[0];if(t!==tf){if(t!==~~t||t<0||t>Gp)throw Error(Zp);for(t=t+(r=rf(new r.constructor(r),t+r.e+1,e)).e+1;r.c.length<t;)r.c.push(0)}return nf(r,!1,!!i)},Jp[Symbol.for("nodejs.util.inspect.custom")]=Jp.toJSON=Jp.toString=function(){var t=this,e=t.constructor;return nf(t,t.e<=e.NE||t.e>=e.PE,!!t.c[0])},Jp.toNumber=function(){var t=+nf(this,!0,!0);if(!0===this.constructor.strict&&!this.eq(t.toString()))throw Error(Yp+"Imprecise conversion");return t},Jp.toPrecision=function(t,e){var r=this,i=r.constructor,n=r.c[0];if(t!==tf){if(t!==~~t||t<1||t>Gp)throw Error(qp+"precision");for(r=rf(new i(r),t,e);r.c.length<t;)r.c.push(0)}return nf(r,t<=r.e||r.e<=i.NE||r.e>=i.PE,!!n)},Jp.valueOf=function(){var t=this,e=t.constructor;if(!0===e.strict)throw Error(Yp+"valueOf disallowed");return nf(t,t.e<=e.NE||t.e>=e.PE,!0)};var sf=function t(){function e(r){var i=this;if(!(i instanceof e))return r===tf?t():new e(r);if(r instanceof e)i.s=r.s,i.e=r.e,i.c=r.c.slice();else{if("string"!=typeof r){if(!0===e.strict&&"bigint"!=typeof r)throw TypeError(qp+"value");r=0===r&&1/r<0?"-0":String(r)}!function(t,e){var r,i,n;if(!ef.test(e))throw Error(qp+"number");t.s="-"==e.charAt(0)?(e=e.slice(1),-1):1,(r=e.indexOf("."))>-1&&(e=e.replace(".",""));(i=e.search(/e/i))>0?(r<0&&(r=i),r+=+e.slice(i+1),e=e.substring(0,i)):r<0&&(r=e.length);for(n=e.length,i=0;i<n&&"0"==e.charAt(i);)++i;if(i==n)t.c=[t.e=0];else{for(;n>0&&"0"==e.charAt(--n););for(t.e=r-i-1,t.c=[],r=0;i<=n;)t.c[r++]=+e.charAt(i++)}}(i,r)}i.constructor=e}return e.prototype=Jp,e.DP=20,e.RM=1,e.NE=-7,e.PE=21,e.strict=false,e.roundDown=0,e.roundHalfUp=1,e.roundHalfEven=2,e.roundUp=3,e}();var of=function(){this.__data__=[],this.size=0};var af=function(t,e){return t===e||t!=t&&e!=e},lf=af;var hf=function(t,e){for(var r=t.length;r--;)if(lf(t[r][0],e))return r;return-1},cf=hf,uf=Array.prototype.splice;var df=function(t){var e=this.__data__,r=cf(e,t);return!(r<0)&&(r==e.length-1?e.pop():uf.call(e,r,1),--this.size,!0)},pf=hf;var ff=function(t){var e=this.__data__,r=pf(e,t);return r<0?void 0:e[r][1]},gf=hf;var mf=function(t){return gf(this.__data__,t)>-1},yf=hf;var vf=function(t,e){var r=this.__data__,i=yf(r,t);return i<0?(++this.size,r.push([t,e])):r[i][1]=e,this},bf=of,_f=df,wf=ff,xf=mf,Sf=vf;function Tf(t){var e=-1,r=null==t?0:t.length;for(this.clear();++e<r;){var i=t[e];this.set(i[0],i[1])}}Tf.prototype.clear=bf,Tf.prototype.delete=_f,Tf.prototype.get=wf,Tf.prototype.has=xf,Tf.prototype.set=Sf;var kf=Tf,Cf=kf;var Ef=function(){this.__data__=new Cf,this.size=0};var Af=function(t){var e=this.__data__,r=e.delete(t);return this.size=e.size,r};var Of=function(t){return this.__data__.get(t)};var Bf=function(t){return this.__data__.has(t)},Rf="object"==typeof dt&&dt&&dt.Object===Object&&dt,Lf=Rf,Pf="object"==typeof self&&self&&self.Object===Object&&self,Df=Lf||Pf||Function("return this")(),Mf=Df.Symbol,If=Mf,Nf=Object.prototype,Ff=Nf.hasOwnProperty,jf=Nf.toString,zf=If?If.toStringTag:void 0;var Hf=function(t){var e=Ff.call(t,zf),r=t[zf];try{t[zf]=void 0;var i=!0}catch(t){}var n=jf.call(t);return i&&(e?t[zf]=r:delete t[zf]),n},Wf=Object.prototype.toString;var Uf=Hf,$f=function(t){return Wf.call(t)},Vf=Mf?Mf.toStringTag:void 0;var Gf=function(t){return null==t?void 0===t?"[object Undefined]":"[object Null]":Vf&&Vf in Object(t)?Uf(t):$f(t)};var Xf=function(t){var e=typeof t;return null!=t&&("object"==e||"function"==e)},Yf=pt(Xf),qf=Gf,Zf=Xf;var Kf,Qf=function(t){if(!Zf(t))return!1;var e=qf(t);return"[object Function]"==e||"[object GeneratorFunction]"==e||"[object AsyncFunction]"==e||"[object Proxy]"==e},Jf=Df["__core-js_shared__"],tg=(Kf=/[^.]+$/.exec(Jf&&Jf.keys&&Jf.keys.IE_PROTO||""))?"Symbol(src)_1."+Kf:"";var eg=function(t){return!!tg&&tg in t},rg=Function.prototype.toString;var ig=function(t){if(null!=t){try{return rg.call(t)}catch(t){}try{return t+""}catch(t){}}return""},ng=Qf,sg=eg,og=Xf,ag=ig,lg=/^\[object .+?Constructor\]$/,hg=Function.prototype,cg=Object.prototype,ug=hg.toString,dg=cg.hasOwnProperty,pg=RegExp("^"+ug.call(dg).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");var fg=function(t,e){return null==t?void 0:t[e]},gg=function(t){return!(!og(t)||sg(t))&&(ng(t)?pg:lg).test(ag(t))},mg=fg;var yg=function(t,e){var r=mg(t,e);return gg(r)?r:void 0},vg=yg(Df,"Map"),bg=yg(Object,"create"),_g=bg;var wg=function(){this.__data__=_g?_g(null):{},this.size=0};var xg=function(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e},Sg=bg,Tg=Object.prototype.hasOwnProperty;var kg=function(t){var e=this.__data__;if(Sg){var r=e[t];return"__lodash_hash_undefined__"===r?void 0:r}return Tg.call(e,t)?e[t]:void 0},Cg=bg,Eg=Object.prototype.hasOwnProperty;var Ag=function(t){var e=this.__data__;return Cg?void 0!==e[t]:Eg.call(e,t)},Og=bg;var Bg=function(t,e){var r=this.__data__;return this.size+=this.has(t)?0:1,r[t]=Og&&void 0===e?"__lodash_hash_undefined__":e,this},Rg=wg,Lg=xg,Pg=kg,Dg=Ag,Mg=Bg;function Ig(t){var e=-1,r=null==t?0:t.length;for(this.clear();++e<r;){var i=t[e];this.set(i[0],i[1])}}Ig.prototype.clear=Rg,Ig.prototype.delete=Lg,Ig.prototype.get=Pg,Ig.prototype.has=Dg,Ig.prototype.set=Mg;var Ng=Ig,Fg=kf,jg=vg;var zg=function(t){var e=typeof t;return"string"==e||"number"==e||"symbol"==e||"boolean"==e?"__proto__"!==t:null===t};var Hg=function(t,e){var r=t.__data__;return zg(e)?r["string"==typeof e?"string":"hash"]:r.map},Wg=Hg;var Ug=function(t){var e=Wg(this,t).delete(t);return this.size-=e?1:0,e},$g=Hg;var Vg=function(t){return $g(this,t).get(t)},Gg=Hg;var Xg=function(t){return Gg(this,t).has(t)},Yg=Hg;var qg=function(t,e){var r=Yg(this,t),i=r.size;return r.set(t,e),this.size+=r.size==i?0:1,this},Zg=function(){this.size=0,this.__data__={hash:new Ng,map:new(jg||Fg),string:new Ng}},Kg=Ug,Qg=Vg,Jg=Xg,tm=qg;function em(t){var e=-1,r=null==t?0:t.length;for(this.clear();++e<r;){var i=t[e];this.set(i[0],i[1])}}em.prototype.clear=Zg,em.prototype.delete=Kg,em.prototype.get=Qg,em.prototype.has=Jg,em.prototype.set=tm;var rm=em,im=kf,nm=vg,sm=rm;var om=function(t,e){var r=this.__data__;if(r instanceof im){var i=r.__data__;if(!nm||i.length<199)return i.push([t,e]),this.size=++r.size,this;r=this.__data__=new sm(i)}return r.set(t,e),this.size=r.size,this},am=kf,lm=Ef,hm=Af,cm=Of,um=Bf,dm=om;function pm(t){var e=this.__data__=new am(t);this.size=e.size}pm.prototype.clear=lm,pm.prototype.delete=hm,pm.prototype.get=cm,pm.prototype.has=um,pm.prototype.set=dm;var fm=pm;var gm=rm,mm=function(t){return this.__data__.set(t,"__lodash_hash_undefined__"),this},ym=function(t){return this.__data__.has(t)};function vm(t){var e=-1,r=null==t?0:t.length;for(this.__data__=new gm;++e<r;)this.add(t[e])}vm.prototype.add=vm.prototype.push=mm,vm.prototype.has=ym;var bm=function(t,e){for(var r=-1,i=null==t?0:t.length;++r<i;)if(e(t[r],r,t))return!0;return!1};var _m=function(t,e){return t.has(e)},wm=vm,xm=bm,Sm=_m;var Tm=function(t,e,r,i,n,s){var o=1&r,a=t.length,l=e.length;if(a!=l&&!(o&&l>a))return!1;var h=s.get(t),c=s.get(e);if(h&&c)return h==e&&c==t;var u=-1,d=!0,p=2&r?new wm:void 0;for(s.set(t,e),s.set(e,t);++u<a;){var f=t[u],g=e[u];if(i)var m=o?i(g,f,u,e,t,s):i(f,g,u,t,e,s);if(void 0!==m){if(m)continue;d=!1;break}if(p){if(!xm(e,(function(t,e){if(!Sm(p,e)&&(f===t||n(f,t,r,i,s)))return p.push(e)}))){d=!1;break}}else if(f!==g&&!n(f,g,r,i,s)){d=!1;break}}return s.delete(t),s.delete(e),d};var km=function(t){var e=-1,r=Array(t.size);return t.forEach((function(t,i){r[++e]=[i,t]})),r};var Cm=function(t){var e=-1,r=Array(t.size);return t.forEach((function(t){r[++e]=t})),r},Em=Df.Uint8Array,Am=af,Om=Tm,Bm=km,Rm=Cm,Lm=Mf?Mf.prototype:void 0,Pm=Lm?Lm.valueOf:void 0;var Dm=function(t,e,r,i,n,s,o){switch(r){case"[object DataView]":if(t.byteLength!=e.byteLength||t.byteOffset!=e.byteOffset)return!1;t=t.buffer,e=e.buffer;case"[object ArrayBuffer]":return!(t.byteLength!=e.byteLength||!s(new Em(t),new Em(e)));case"[object Boolean]":case"[object Date]":case"[object Number]":return Am(+t,+e);case"[object Error]":return t.name==e.name&&t.message==e.message;case"[object RegExp]":case"[object String]":return t==e+"";case"[object Map]":var a=Bm;case"[object Set]":var l=1&i;if(a||(a=Rm),t.size!=e.size&&!l)return!1;var h=o.get(t);if(h)return h==e;i|=2,o.set(t,e);var c=Om(a(t),a(e),i,n,s,o);return o.delete(t),c;case"[object Symbol]":if(Pm)return Pm.call(t)==Pm.call(e)}return!1};var Mm=function(t,e){for(var r=-1,i=e.length,n=t.length;++r<i;)t[n+r]=e[r];return t},Im=Array.isArray,Nm=Mm,Fm=Im;var jm=function(t,e,r){var i=e(t);return Fm(t)?i:Nm(i,r(t))};var zm=function(t,e){for(var r=-1,i=null==t?0:t.length,n=0,s=[];++r<i;){var o=t[r];e(o,r,t)&&(s[n++]=o)}return s};var Hm=zm,Wm=function(){return[]},Um=Object.prototype.propertyIsEnumerable,$m=Object.getOwnPropertySymbols,Vm=$m?function(t){return null==t?[]:(t=Object(t),Hm($m(t),(function(e){return Um.call(t,e)})))}:Wm,Gm=Vm;var Xm=function(t,e){for(var r=-1,i=Array(t);++r<t;)i[r]=e(r);return i};var Ym=function(t){return null!=t&&"object"==typeof t},qm=Gf,Zm=Ym;var Km=function(t){return Zm(t)&&"[object Arguments]"==qm(t)},Qm=Ym,Jm=Object.prototype,ty=Jm.hasOwnProperty,ey=Jm.propertyIsEnumerable,ry=Km(function(){return arguments}())?Km:function(t){return Qm(t)&&ty.call(t,"callee")&&!ey.call(t,"callee")},iy=ry,ny={exports:{}};var sy=function(){return!1};!function(t,e){var r=Df,i=sy,n=e&&!e.nodeType&&e,s=n&&t&&!t.nodeType&&t,o=s&&s.exports===n?r.Buffer:void 0,a=(o?o.isBuffer:void 0)||i;t.exports=a}(ny,ny.exports);var oy=ny.exports,ay=/^(?:0|[1-9]\d*)$/;var ly=function(t,e){var r=typeof t;return!!(e=null==e?9007199254740991:e)&&("number"==r||"symbol"!=r&&ay.test(t))&&t>-1&&t%1==0&&t<e};var hy=function(t){return"number"==typeof t&&t>-1&&t%1==0&&t<=9007199254740991},cy=Gf,uy=hy,dy=Ym,py={};py["[object Float32Array]"]=py["[object Float64Array]"]=py["[object Int8Array]"]=py["[object Int16Array]"]=py["[object Int32Array]"]=py["[object Uint8Array]"]=py["[object Uint8ClampedArray]"]=py["[object Uint16Array]"]=py["[object Uint32Array]"]=!0,py["[object Arguments]"]=py["[object Array]"]=py["[object ArrayBuffer]"]=py["[object Boolean]"]=py["[object DataView]"]=py["[object Date]"]=py["[object Error]"]=py["[object Function]"]=py["[object Map]"]=py["[object Number]"]=py["[object Object]"]=py["[object RegExp]"]=py["[object Set]"]=py["[object String]"]=py["[object WeakMap]"]=!1;var fy=function(t){return dy(t)&&uy(t.length)&&!!py[cy(t)]};var gy=function(t){return function(e){return t(e)}},my={exports:{}};!function(t,e){var r=Rf,i=e&&!e.nodeType&&e,n=i&&t&&!t.nodeType&&t,s=n&&n.exports===i&&r.process,o=function(){try{var t=n&&n.require&&n.require("util").types;return t||s&&s.binding&&s.binding("util")}catch(t){}}();t.exports=o}(my,my.exports);var yy=my.exports,vy=fy,by=gy,_y=yy&&yy.isTypedArray,wy=_y?by(_y):vy,xy=Xm,Sy=iy,Ty=Im,ky=oy,Cy=ly,Ey=wy,Ay=Object.prototype.hasOwnProperty;var Oy=function(t,e){var r=Ty(t),i=!r&&Sy(t),n=!r&&!i&&ky(t),s=!r&&!i&&!n&&Ey(t),o=r||i||n||s,a=o?xy(t.length,String):[],l=a.length;for(var h in t)!e&&!Ay.call(t,h)||o&&("length"==h||n&&("offset"==h||"parent"==h)||s&&("buffer"==h||"byteLength"==h||"byteOffset"==h)||Cy(h,l))||a.push(h);return a},By=Object.prototype;var Ry=function(t){var e=t&&t.constructor;return t===("function"==typeof e&&e.prototype||By)};var Ly=function(t,e){return function(r){return t(e(r))}},Py=Ly(Object.keys,Object),Dy=Ry,My=Py,Iy=Object.prototype.hasOwnProperty;var Ny=function(t){if(!Dy(t))return My(t);var e=[];for(var r in Object(t))Iy.call(t,r)&&"constructor"!=r&&e.push(r);return e},Fy=Qf,jy=hy;var zy=Oy,Hy=Ny,Wy=function(t){return null!=t&&jy(t.length)&&!Fy(t)};var Uy=function(t){return Wy(t)?zy(t):Hy(t)},$y=jm,Vy=Gm,Gy=Uy;var Xy=function(t){return $y(t,Gy,Vy)},Yy=Xy,qy=Object.prototype.hasOwnProperty;var Zy=function(t,e,r,i,n,s){var o=1&r,a=Yy(t),l=a.length;if(l!=Yy(e).length&&!o)return!1;for(var h=l;h--;){var c=a[h];if(!(o?c in e:qy.call(e,c)))return!1}var u=s.get(t),d=s.get(e);if(u&&d)return u==e&&d==t;var p=!0;s.set(t,e),s.set(e,t);for(var f=o;++h<l;){var g=t[c=a[h]],m=e[c];if(i)var y=o?i(m,g,c,e,t,s):i(g,m,c,t,e,s);if(!(void 0===y?g===m||n(g,m,r,i,s):y)){p=!1;break}f||(f="constructor"==c)}if(p&&!f){var v=t.constructor,b=e.constructor;v==b||!("constructor"in t)||!("constructor"in e)||"function"==typeof v&&v instanceof v&&"function"==typeof b&&b instanceof b||(p=!1)}return s.delete(t),s.delete(e),p},Ky=yg(Df,"DataView"),Qy=vg,Jy=yg(Df,"Promise"),tv=yg(Df,"Set"),ev=yg(Df,"WeakMap"),rv=Gf,iv=ig,nv="[object Map]",sv="[object Promise]",ov="[object Set]",av="[object WeakMap]",lv="[object DataView]",hv=iv(Ky),cv=iv(Qy),uv=iv(Jy),dv=iv(tv),pv=iv(ev),fv=rv;(Ky&&fv(new Ky(new ArrayBuffer(1)))!=lv||Qy&&fv(new Qy)!=nv||Jy&&fv(Jy.resolve())!=sv||tv&&fv(new tv)!=ov||ev&&fv(new ev)!=av)&&(fv=function(t){var e=rv(t),r="[object Object]"==e?t.constructor:void 0,i=r?iv(r):"";if(i)switch(i){case hv:return lv;case cv:return nv;case uv:return sv;case dv:return ov;case pv:return av}return e});var gv=fm,mv=Tm,yv=Dm,vv=Zy,bv=fv,_v=Im,wv=oy,xv=wy,Sv="[object Arguments]",Tv="[object Array]",kv="[object Object]",Cv=Object.prototype.hasOwnProperty;var Ev=function(t,e,r,i,n,s){var o=_v(t),a=_v(e),l=o?Tv:bv(t),h=a?Tv:bv(e),c=(l=l==Sv?kv:l)==kv,u=(h=h==Sv?kv:h)==kv,d=l==h;if(d&&wv(t)){if(!wv(e))return!1;o=!0,c=!1}if(d&&!c)return s||(s=new gv),o||xv(t)?mv(t,e,r,i,n,s):yv(t,e,l,r,i,n,s);if(!(1&r)){var p=c&&Cv.call(t,"__wrapped__"),f=u&&Cv.call(e,"__wrapped__");if(p||f){var g=p?t.value():t,m=f?e.value():e;return s||(s=new gv),n(g,m,r,i,s)}}return!!d&&(s||(s=new gv),vv(t,e,r,i,n,s))},Av=Ev,Ov=Ym;var Bv=function t(e,r,i,n,s){return e===r||(null==e||null==r||!Ov(e)&&!Ov(r)?e!=e&&r!=r:Av(e,r,i,n,t,s))},Rv=Bv;var Lv=pt((function(t,e){return Rv(t,e)})),Pv=Gf,Dv=Ym;var Mv=pt((function(t){return"number"==typeof t||Dv(t)&&"[object Number]"==Pv(t)}));const Iv=(t,e,r)=>{if("number"!=typeof t&&(t=Number(t)),"number"!=typeof e&&(e=Number(e)),Number.isNaN(t)||Number.isNaN(e))throw new Error(`${r}(a, b), a or b is NaN`);return new sf(t)[r](e).toNumber()},Nv=(t=0,e=0)=>Iv(t,e,"plus");const Fv=t=>{if("number"==typeof t)return{prefix:"",number:t,full:t};const e=function(t){const e=t.match(/((\d+)(\.\d+)?)(?!.*(\d+)(\.\d+)?)/);if(!e||void 0===e.index)return[t];const r=e.index,i=e[0];return[t.slice(0,r),i,t.slice(r+i.length)].filter((t=>""!==t))}(t),r=e.findIndex((t=>!isNaN(Number(t))&&""!==t&&!isNaN(parseFloat(t))&&isFinite(Number(t))));return 1===e.length?0===r?{prefix:"",number:Number(e[0]),suffix:"",full:t}:{prefix:t,number:null,suffix:"",full:t}:e.length>1?0===r?{prefix:"",number:Number(e[0]),suffix:e[1],full:t}:{prefix:e[0],number:Number(e[1]),suffix:e?.[2],full:t}:{prefix:null,number:null,suffix:null,full:t}},jv=(t,e,r,i)=>{if(!t||t.length<r.endRow-1)return[];let n=[];if(Array.isArray(t?.[0])?n=t.map((t=>[...t])):e.length&&Yf(t?.[0])&&(n=function(t,e){return t.map((t=>e.map((e=>t[e.field]))))}(t,e)),!n?.length)return t;const s=i.row-r.endRow,o=i.col-r.endCol,a=Math.abs(s)>=Math.abs(o),l=a?s:o,[h,c]=[r.startRow,r.endRow].sort(((t,e)=>t-e)),[u,d]=[r.startCol,r.endCol].sort(((t,e)=>t-e)),p=[];for(let t=h;t<=c;t++)for(let e=u;e<=d;e++)p.push(n[t][e]);const f=p.map(Fv),g=f.every((t=>null!==t.number))&&f.slice(1).every(((t,e)=>t.prefix===f[e].prefix))&&f.length<3&&!(2===f.length&&Lv(f[0],f[1]));let m;if(1===f.length&&null!==f[0].number)m=1;else if(g&&f.length>1){const t=f.map((t=>t.number));m=((t=0,e=0)=>Iv(t,e,"minus"))(t[t.length-1],t[t.length-2])}const y=t=>a&&s>0?t.row<=i.row:a&&s<0?t.row>=i.row:!a&&o>0?t.col<=i.col:!a&&o<0&&t.col>=i.col,v=Math.abs(l),b=l>0?1:-1,_=f.length;if(1===f.length){const t=f[0];for(let e=1;e<=v;e++){const i={row:a?r.endRow+b*e:r.startRow,col:a?r.startCol:r.endCol+b*e};if(i.row>=0&&i.col>=0&&y(i)){let r=Mv(t.number)?`${t.prefix||""}${(t?.number||0)+(b>0?e:-e)}${t.suffix||""}`:t.full;Mv(t.full)&&(r=(t?.number||0)+(b>0?e:-e)),n[i.row][i.col]=r}}}else if(f.length>=2)for(let t=1;t<=v;t++){let e;const i={row:0,col:0};if(1===b?(i.row=a?r.endRow+b*t:r.endRow,i.col=a?r.endCol:r.endCol+b*t,e=f[(t-1)%_]):(i.row=a?r.startRow+b*t:r.startRow,i.col=a?r.startCol:r.startCol+b*t,e=f[Math.abs(_-t)%_]),i.row>=0&&i.col>=0&&y(i)){let r;if(Mv(e.full)||Number(e.full)===Number(e.number)&&2===_){const i=_+Math.floor((t-1)/_)*_;r=Nv(e?.number||0,b>0?(m||1)*i:-(m||1)*i)}else r=g?`${e.prefix||""}${Nv(e?.number||0,b>0?(m||1)*_:-(m||1)*_)}${e.suffix||""}`:Mv(e?.number)?`${e.prefix||""}${Nv(e?.number||0,b>0?Math.floor((t-1)/_)+1:-(Math.floor((t-1)/_)+1))}${e.suffix||""}`:e.full;n[i.row][i.col]=r}}return Array.isArray(t?.[0])?n:function(t,e){return t.map((t=>e.reduce(((e,r,i)=>(e[r.field]=t[i],e)),{})))}(n,e)};const{toString:zv}=Object.prototype,Hv=/["&<>]/,Wv={each:function(t,e){t&&(Array.isArray(t)?t.forEach(e):Object.keys(t).forEach((r=>{e(t[r],r)})))},some:function(t,e){return!!t&&(Array.isArray(t)?t.some(e):Object.keys(t).some((r=>e(t[r],r))))},every:function(t,e){return!t||(Array.isArray(t)?t.every(e):Object.keys(t).every((r=>e(t[r],r))))},map:function(t,e){return t?Array.isArray(t)?t.map(e):Object.keys(t).map((r=>e(t[r],r))):[]},keyBy:(t,e)=>t.reduce(((t,r)=>(t[r[e]]=r,t)),{}),isEqual:function(t,e){const r=typeof t,i=typeof e,n=Array.isArray(t),s=Array.isArray(e);let o;if(r!==i)return!1;if("object"==typeof t){if(n||s)return!(!n||!s)&&(t.length===e.length&&t.every(((t,r)=>{const i=e[r];return Wv.isEqual(t,i)})));if(null===t||null===e)return t===e;if(o=Object.keys(t),Object.keys(e).length!==o.length)return!1;for(const t of o)if(!e.hasOwnProperty(t))return!1;return Wv.every(t,((t,r)=>{const i=e[r];return Wv.isEqual(t,i)}))}return t===e},escapeHtml(t){const e=Hv.exec(t);if(!e)return t;let r="",i="",n=0,s=e.index;for(;s<t.length;s++){switch(t.charAt(s)){case'"':i=""";break;case"&":i="&";break;case"'":i="'";break;case"<":i="<";break;case">":i=">";break;default:continue}n!==s&&(r+=t.substring(n,s)),n=s+1,r+=i}return n!==s?r+t.substring(n,s):r},strcmp:(t,e)=>t<e?-1:t>e?1:0,isUndefined:t=>"[object Undefined]"===zv.call(t),isObject:t=>"[object Object]"===zv.call(t),deepMerge(){const t=arguments[0]||{},{length:e}=arguments;let r,i,n;function s(e,s){r=t[s],n=Array.isArray(e),Wv.isObject(e)||n?(n?(n=!1,i=r&&Array.isArray(r)?r:[]):i=r&&Wv.isObject(r)?r:{},t[s]=Wv.deepMerge(i,e)):Wv.isUndefined(e)||(t[s]=e)}for(let t=0;t<e;t++)Wv.each(arguments[t],s);return t}};var Uv=Wv;const $v=/^[A-Z]+\d+$/,Vv={_dictionary:["A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"],_l2nFill:0,_l2n:{},_n2l:[],_level:t=>t<=26?1:t<=676?2:3,_fill(t){let e,r,i,n,s,o=1;if(t>=4)throw new Error("Out of bounds. Excel supports columns from 1 to 16384");if(this._l2nFill<1&&t>=1){for(;o<=26;)e=this._dictionary[o-1],this._n2l[o]=e,this._l2n[e]=o,o++;this._l2nFill=1}if(this._l2nFill<2&&t>=2){for(o=27;o<=702;)r=o-27,i=r%26,n=Math.floor(r/26),e=this._dictionary[n]+this._dictionary[i],this._n2l[o]=e,this._l2n[e]=o,o++;this._l2nFill=2}if(this._l2nFill<3&&t>=3){for(o=703;o<=16384;)r=o-703,i=r%26,n=Math.floor(r/26)%26,s=Math.floor(r/676),e=this._dictionary[s]+this._dictionary[n]+this._dictionary[i],this._n2l[o]=e,this._l2n[e]=o,o++;this._l2nFill=3}},l2n(t){if(this._l2n[t]||this._fill(t.length),!this._l2n[t])throw new Error(`Out of bounds. Invalid column letter: ${t}`);return this._l2n[t]},n2l(t){if(t<1||t>16384)throw new Error(`${t} is out of bounds. Excel supports columns from 1 to 16384`);return this._n2l[t]||this._fill(this._level(t)),this._n2l[t]},_hash:{},validateAddress(t){if(!$v.test(t))throw new Error(`Invalid Address: ${t}`);return!0},decodeAddress(t){const e=t.length<5&&this._hash[t];if(e)return e;let r=!1,i="",n=0,s=!1,o="",a=0;for(let e,l=0;l<t.length;l++)if(e=t.charCodeAt(l),!s&&e>=65&&e<=90)r=!0,i+=t[l],n=26*n+e-64;else if(e>=48&&e<=57)s=!0,o+=t[l],a=10*a+e-48;else if(s&&r&&36!==e)break;if(r){if(n>16384)throw new Error(`Out of bounds. Invalid column letter: ${i}`)}else n=void 0;s||(a=void 0);const l={address:t=i+o,col:n,row:a,$col$row:`$${i}$${o}`};return n<=100&&a<=100&&(this._hash[t]=l,this._hash[l.$col$row]=l),l},getAddress(t,e){if(e){const r=this.n2l(e)+t;return this.decodeAddress(r)}return this.decodeAddress(t)},decode(t){const e=t.split(":");if(2===e.length){const t=this.decodeAddress(e[0]),r=this.decodeAddress(e[1]),i={top:Math.min(t.row,r.row),left:Math.min(t.col,r.col),bottom:Math.max(t.row,r.row),right:Math.max(t.col,r.col)};return i.tl=this.n2l(i.left)+i.top,i.br=this.n2l(i.right)+i.bottom,i.dimensions=`${i.tl}:${i.br}`,i}return this.decodeAddress(t)},decodeEx(t){const e=t.match(/(?:(?:(?:'((?:[^']|'')*)')|([^'^ !]*))!)?(.*)/),r=e[1]||e[2],i=e[3],n=i.split(":");if(n.length>1){let t=this.decodeAddress(n[0]),e=this.decodeAddress(n[1]);const i=Math.min(t.row,e.row),s=Math.min(t.col,e.col),o=Math.max(t.row,e.row),a=Math.max(t.col,e.col);return t=this.n2l(s)+i,e=this.n2l(a)+o,{top:i,left:s,bottom:o,right:a,sheetName:r,tl:{address:t,col:s,row:i,$col$row:`$${this.n2l(s)}$${i}`,sheetName:r},br:{address:e,col:a,row:o,$col$row:`$${this.n2l(a)}$${o}`,sheetName:r},dimensions:`${t}:${e}`}}if(i.startsWith("#"))return r?{sheetName:r,error:i}:{error:i};const s=this.decodeAddress(i);return r?{sheetName:r,...s}:s},encodeAddress:(t,e)=>Vv.n2l(e)+t,encode(){switch(arguments.length){case 2:return Vv.encodeAddress(arguments[0],arguments[1]);case 4:return`${Vv.encodeAddress(arguments[0],arguments[1])}:${Vv.encodeAddress(arguments[2],arguments[3])}`;default:throw new Error("Can only encode with 2 or 4 arguments")}},inRange(t,e){const[r,i,,n,s]=t,[o,a]=e;return o>=r&&o<=n&&a>=i&&a<=s}};var Gv=Vv;const Xv=Gv;var Yv=class t{constructor(){this.decode(arguments)}setTLBR(t,e,r,i,n){if(arguments.length<4){const i=Xv.decodeAddress(t),s=Xv.decodeAddress(e);this.model={top:Math.min(i.row,s.row),left:Math.min(i.col,s.col),bottom:Math.max(i.row,s.row),right:Math.max(i.col,s.col),sheetName:r},this.setTLBR(i.row,i.col,s.row,s.col,n)}else this.model={top:Math.min(t,r),left:Math.min(e,i),bottom:Math.max(t,r),right:Math.max(e,i),sheetName:n}}decode(e){switch(e.length){case 5:this.setTLBR(e[0],e[1],e[2],e[3],e[4]);break;case 4:this.setTLBR(e[0],e[1],e[2],e[3]);break;case 3:this.setTLBR(e[0],e[1],e[2]);break;case 2:this.setTLBR(e[0],e[1]);break;case 1:{const r=e[0];if(r instanceof t)this.model={top:r.model.top,left:r.model.left,bottom:r.model.bottom,right:r.model.right,sheetName:r.sheetName};else if(r instanceof Array)this.decode(r);else if(r.top&&r.left&&r.bottom&&r.right)this.model={top:r.top,left:r.left,bottom:r.bottom,right:r.right,sheetName:r.sheetName};else{const t=Xv.decodeEx(r);t.top?this.model={top:t.top,left:t.left,bottom:t.bottom,right:t.right,sheetName:t.sheetName}:this.model={top:t.row,left:t.col,bottom:t.row,right:t.col,sheetName:t.sheetName}}break}case 0:this.model={top:0,left:0,bottom:0,right:0};break;default:throw new Error(`Invalid number of arguments to _getDimensions() - ${e.length}`)}}get top(){return this.model.top||1}set top(t){this.model.top=t}get left(){return this.model.left||1}set left(t){this.model.left=t}get bottom(){return this.model.bottom||1}set bottom(t){this.model.bottom=t}get right(){return this.model.right||1}set right(t){this.model.right=t}get sheetName(){return this.model.sheetName}set sheetName(t){this.model.sheetName=t}get _serialisedSheetName(){const{sheetName:t}=this.model;return t?/^[a-zA-Z0-9]*$/.test(t)?`${t}!`:`'${t}'!`:""}expand(t,e,r,i){(!this.model.top||t<this.top)&&(this.top=t),(!this.model.left||e<this.left)&&(this.left=e),(!this.model.bottom||r>this.bottom)&&(this.bottom=r),(!this.model.right||i>this.right)&&(this.right=i)}expandRow(t){if(t){const{dimensions:e,number:r}=t;e&&this.expand(r,e.min,r,e.max)}}expandToAddress(t){const e=Xv.decodeEx(t);this.expand(e.row,e.col,e.row,e.col)}get tl(){return Xv.n2l(this.left)+this.top}get $t$l(){return`$${Xv.n2l(this.left)}$${this.top}`}get br(){return Xv.n2l(this.right)+this.bottom}get $b$r(){return`$${Xv.n2l(this.right)}$${this.bottom}`}get range(){return`${this._serialisedSheetName+this.tl}:${this.br}`}get $range(){return`${this._serialisedSheetName+this.$t$l}:${this.$b$r}`}get shortRange(){return this.count>1?this.range:this._serialisedSheetName+this.tl}get $shortRange(){return this.count>1?this.$range:this._serialisedSheetName+this.$t$l}get count(){return(1+this.bottom-this.top)*(1+this.right-this.left)}toString(){return this.range}intersects(t){return(!t.sheetName||!this.sheetName||t.sheetName===this.sheetName)&&(!(t.bottom<this.top)&&(!(t.top>this.bottom)&&(!(t.right<this.left)&&!(t.left>this.right))))}contains(t){const e=Xv.decodeEx(t);return this.containsEx(e)}containsEx(t){return(!t.sheetName||!this.sheetName||t.sheetName===this.sheetName)&&(t.row>=this.top&&t.row<=this.bottom&&t.col>=this.left&&t.col<=this.right)}forEachAddress(t){for(let e=this.left;e<=this.right;e++)for(let r=this.top;r<=this.bottom;r++)t(Xv.encodeAddress(r,e),r,e)}},qv={ValueType:{Null:0,Merge:1,Number:2,String:3,Date:4,Hyperlink:5,Formula:6,SharedString:7,RichText:8,Boolean:9,Error:10},FormulaType:{None:0,Master:1,Shared:2},RelationshipType:{None:0,OfficeDocument:1,Worksheet:2,CalcChain:3,SharedStrings:4,Styles:5,Theme:6,Hyperlink:7},DocumentType:{Xlsx:1},ReadingOrder:{LeftToRight:1,RightToLeft:2},ErrorValue:{NotApplicable:"#N/A",Ref:"#REF!",Name:"#NAME?",DivZero:"#DIV/0!",Null:"#NULL!",Value:"#VALUE!",Num:"#NUM!"}};const Zv=Gv,Kv=/(([a-z_\-0-9]*)!)?([a-z0-9_$]{2,})([(])?/gi,Qv=/^([$])?([a-z]+)([$])?([1-9][0-9]*)$/i;var Jv={slideFormula:function(t,e,r){const i=Zv.decode(e),n=Zv.decode(r);return t.replace(Kv,((t,e,r,s,o)=>{if(o)return t;const a=Qv.exec(s);if(a){const r=a[1],s=a[2].toUpperCase(),o=a[3],l=a[4];if(s.length>3||3===s.length&&s>"XFD")return t;let h=Zv.l2n(s),c=parseInt(l,10);r||(h+=n.col-i.col),o||(c+=n.row-i.row);return(e||"")+(r||"")+Zv.n2l(h)+(o||"")+c}return t}))}};const tb=Uv;let eb=class t{constructor(t){this.note=t}get model(){let e=null;if("string"==typeof this.note)e={type:"note",note:{texts:[{text:this.note}]}};else e={type:"note",note:this.note};return tb.deepMerge({},t.DEFAULT_CONFIGS,e)}set model(t){const{note:e}=t,{texts:r}=e;1===r.length&&1===Object.keys(r[0]).length?this.note=r[0].text:this.note=e}static fromModel(e){const r=new t;return r.model=e,r}};eb.DEFAULT_CONFIGS={note:{margins:{insetmode:"auto",inset:[.13,.13,.25,.25]},protection:{locked:"True",lockText:"True"},editAs:"absolute"}};var rb=eb;const ib=Gv,nb=Uv,sb=qv,{slideFormula:ob}=Jv,ab=rb;let lb=class t{constructor(e,r,i){if(!e||!r)throw new Error("A Cell needs a Row");this._row=e,this._column=r,ib.validateAddress(i),this._address=i,this._value=hb.create(t.Types.Null,this),this.style=this._mergeStyle(e.style,r.style,{}),this._mergeCount=0}get worksheet(){return this._row.worksheet}get workbook(){return this._row.worksheet.workbook}destroy(){delete this.style,delete this._value,delete this._row,delete this._column,delete this._address}get numFmt(){return this.style.numFmt}set numFmt(t){this.style.numFmt=t}get font(){return this.style.font}set font(t){this.style.font=t}get alignment(){return this.style.alignment}set alignment(t){this.style.alignment=t}get border(){return this.style.border}set border(t){this.style.border=t}get fill(){return this.style.fill}set fill(t){this.style.fill=t}get protection(){return this.style.protection}set protection(t){this.style.protection=t}_mergeStyle(t,e,r){const i=t&&t.numFmt||e&&e.numFmt;i&&(r.numFmt=i);const n=t&&t.font||e&&e.font;n&&(r.font=n);const s=t&&t.alignment||e&&e.alignment;s&&(r.alignment=s);const o=t&&t.border||e&&e.border;o&&(r.border=o);const a=t&&t.fill||e&&e.fill;a&&(r.fill=a);const l=t&&t.protection||e&&e.protection;return l&&(r.protection=l),r}get address(){return this._address}get row(){return this._row.number}get col(){return this._column.number}get $col$row(){return`$${this._column.letter}$${this.row}`}get type(){return this._value.type}get effectiveType(){return this._value.effectiveType}toCsvString(){return this._value.toCsvString()}addMergeRef(){this._mergeCount++}releaseMergeRef(){this._mergeCount--}get isMerged(){return this._mergeCount>0||this.type===t.Types.Merge}merge(e,r){this._value.release(),this._value=hb.create(t.Types.Merge,this,e),r||(this.style=e.style)}unmerge(){this.type===t.Types.Merge&&(this._value.release(),this._value=hb.create(t.Types.Null,this),this.style=this._mergeStyle(this._row.style,this._column.style,{}))}isMergedTo(e){return this._value.type===t.Types.Merge&&this._value.isMergedTo(e)}get master(){return this.type===t.Types.Merge?this._value.master:this}get isHyperlink(){return this._value.type===t.Types.Hyperlink}get hyperlink(){return this._value.hyperlink}get value(){return this._value.value}set value(e){this.type!==t.Types.Merge?(this._value.release(),this._value=hb.create(hb.getType(e),this,e)):this._value.master.value=e}get note(){return this._comment&&this._comment.note}set note(t){this._comment=new ab(t)}get text(){return this._value.toString()}get html(){return nb.escapeHtml(this.text)}toString(){return this.text}_upgradeToHyperlink(e){this.type===t.Types.String&&(this._value=hb.create(t.Types.Hyperlink,this,{text:this._value.value,hyperlink:e}))}get formula(){return this._value.formula}get result(){return this._value.result}get formulaType(){return this._value.formulaType}get fullAddress(){const{worksheet:t}=this._row;return{sheetName:t.name,address:this.address,row:this.row,col:this.col}}get name(){return this.names[0]}set name(t){this.names=[t]}get names(){return this.workbook.definedNames.getNamesEx(this.fullAddress)}set names(t){const{definedNames:e}=this.workbook;e.removeAllNames(this.fullAddress),t.forEach((t=>{e.addEx(this.fullAddress,t)}))}addName(t){this.workbook.definedNames.addEx(this.fullAddress,t)}removeName(t){this.workbook.definedNames.removeEx(this.fullAddress,t)}removeAllNames(){this.workbook.definedNames.removeAllNames(this.fullAddress)}get _dataValidations(){return this.worksheet.dataValidations}get dataValidation(){return this._dataValidations.find(this.address)}set dataValidation(t){this._dataValidations.add(this.address,t)}get model(){const{model:t}=this._value;return t.style=this.style,this._comment&&(t.comment=this._comment.model),t}set model(t){if(this._value.release(),this._value=hb.create(t.type,this),this._value.model=t,t.comment&&"note"===t.comment.type)this._comment=ab.fromModel(t.comment);t.style?this.style=t.style:this.style={}}};lb.Types=sb.ValueType;const hb={getType:t=>null==t?lb.Types.Null:t instanceof String||"string"==typeof t?lb.Types.String:"number"==typeof t?lb.Types.Number:"boolean"==typeof t?lb.Types.Boolean:t instanceof Date?lb.Types.Date:t.text&&t.hyperlink?lb.Types.Hyperlink:t.formula||t.sharedFormula?lb.Types.Formula:t.richText?lb.Types.RichText:t.sharedString?lb.Types.SharedString:t.error?lb.Types.Error:lb.Types.JSON,types:[{t:lb.Types.Null,f:class{constructor(t){this.model={address:t.address,type:lb.Types.Null}}get value(){return null}set value(t){}get type(){return lb.Types.Null}get effectiveType(){return lb.Types.Null}get address(){return this.model.address}set address(t){this.model.address=t}toCsvString(){return""}release(){}toString(){return""}}},{t:lb.Types.Number,f:class{constructor(t,e){this.model={address:t.address,type:lb.Types.Number,value:e}}get value(){return this.model.value}set value(t){this.model.value=t}get type(){return lb.Types.Number}get effectiveType(){return lb.Types.Number}get address(){return this.model.address}set address(t){this.model.address=t}toCsvString(){return this.model.value.toString()}release(){}toString(){return this.model.value.toString()}}},{t:lb.Types.String,f:class{constructor(t,e){this.model={address:t.address,type:lb.Types.String,value:e}}get value(){return this.model.value}set value(t){this.model.value=t}get type(){return lb.Types.String}get effectiveType(){return lb.Types.String}get address(){return this.model.address}set address(t){this.model.address=t}toCsvString(){return`"${this.model.value.replace(/"/g,'""')}"`}release(){}toString(){return this.model.value}}},{t:lb.Types.Date,f:class{constructor(t,e){this.model={address:t.address,type:lb.Types.Date,value:e}}get value(){return this.model.value}set value(t){this.model.value=t}get type(){return lb.Types.Date}get effectiveType(){return lb.Types.Date}get address(){return this.model.address}set address(t){this.model.address=t}toCsvString(){return this.model.value.toISOString()}release(){}toString(){return this.model.value.toString()}}},{t:lb.Types.Hyperlink,f:class{constructor(t,e){this.model={address:t.address,type:lb.Types.Hyperlink,text:e?e.text:void 0,hyperlink:e?e.hyperlink:void 0},e&&e.tooltip&&(this.model.tooltip=e.tooltip)}get value(){const t={text:this.model.text,hyperlink:this.model.hyperlink};return this.model.tooltip&&(t.tooltip=this.model.tooltip),t}set value(t){this.model={text:t.text,hyperlink:t.hyperlink},t.tooltip&&(this.model.tooltip=t.tooltip)}get text(){return this.model.text}set text(t){this.model.text=t}get hyperlink(){return this.model.hyperlink}set hyperlink(t){this.model.hyperlink=t}get type(){return lb.Types.Hyperlink}get effectiveType(){return lb.Types.Hyperlink}get address(){return this.model.address}set address(t){this.model.address=t}toCsvString(){return this.model.hyperlink}release(){}toString(){return this.model.text}}},{t:lb.Types.Formula,f:class{constructor(t,e){this.cell=t,this.model={address:t.address,type:lb.Types.Formula,shareType:e?e.shareType:void 0,ref:e?e.ref:void 0,formula:e?e.formula:void 0,sharedFormula:e?e.sharedFormula:void 0,result:e?e.result:void 0}}_copyModel(t){const e={},r=r=>{const i=t[r];i&&(e[r]=i)};return r("formula"),r("result"),r("ref"),r("shareType"),r("sharedFormula"),e}get value(){return this._copyModel(this.model)}set value(t){this.model=this._copyModel(t)}validate(t){switch(hb.getType(t)){case lb.Types.Null:case lb.Types.String:case lb.Types.Number:case lb.Types.Date:break;case lb.Types.Hyperlink:case lb.Types.Formula:default:throw new Error("Cannot process that type of result value")}}get dependencies(){return{ranges:this.formula.match(/([a-zA-Z0-9]+!)?[A-Z]{1,3}\d{1,4}:[A-Z]{1,3}\d{1,4}/g),cells:this.formula.replace(/([a-zA-Z0-9]+!)?[A-Z]{1,3}\d{1,4}:[A-Z]{1,3}\d{1,4}/g,"").match(/([a-zA-Z0-9]+!)?[A-Z]{1,3}\d{1,4}/g)}}get formula(){return this.model.formula||this._getTranslatedFormula()}set formula(t){this.model.formula=t}get formulaType(){return this.model.formula?sb.FormulaType.Master:this.model.sharedFormula?sb.FormulaType.Shared:sb.FormulaType.None}get result(){return this.model.result}set result(t){this.model.result=t}get type(){return lb.Types.Formula}get effectiveType(){const t=this.model.result;return null==t?sb.ValueType.Null:t instanceof String||"string"==typeof t?sb.ValueType.String:"number"==typeof t?sb.ValueType.Number:t instanceof Date?sb.ValueType.Date:t.text&&t.hyperlink?sb.ValueType.Hyperlink:t.formula?sb.ValueType.Formula:sb.ValueType.Null}get address(){return this.model.address}set address(t){this.model.address=t}_getTranslatedFormula(){if(!this._translatedFormula&&this.model.sharedFormula){const{worksheet:t}=this.cell,e=t.findCell(this.model.sharedFormula);this._translatedFormula=e&&ob(e.formula,e.address,this.model.address)}return this._translatedFormula}toCsvString(){return`${this.model.result||""}`}release(){}toString(){return this.model.result?this.model.result.toString():""}}},{t:lb.Types.Merge,f:class{constructor(t,e){this.model={address:t.address,type:lb.Types.Merge,master:e?e.address:void 0},this._master=e,e&&e.addMergeRef()}get value(){return this._master.value}set value(t){t instanceof lb?(this._master&&this._master.releaseMergeRef(),t.addMergeRef(),this._master=t):this._master.value=t}isMergedTo(t){return t===this._master}get master(){return this._master}get type(){return lb.Types.Merge}get effectiveType(){return this._master.effectiveType}get address(){return this.model.address}set address(t){this.model.address=t}toCsvString(){return""}release(){this._master.releaseMergeRef()}toString(){return this.value.toString()}}},{t:lb.Types.JSON,f:class{constructor(t,e){this.model={address:t.address,type:lb.Types.String,value:JSON.stringify(e),rawValue:e}}get value(){return this.model.rawValue}set value(t){this.model.rawValue=t,this.model.value=JSON.stringify(t)}get type(){return lb.Types.String}get effectiveType(){return lb.Types.String}get address(){return this.model.address}set address(t){this.model.address=t}toCsvString(){return this.model.value}release(){}toString(){return this.model.value}}},{t:lb.Types.SharedString,f:class{constructor(t,e){this.model={address:t.address,type:lb.Types.SharedString,value:e}}get value(){return this.model.value}set value(t){this.model.value=t}get type(){return lb.Types.SharedString}get effectiveType(){return lb.Types.SharedString}get address(){return this.model.address}set address(t){this.model.address=t}toCsvString(){return this.model.value.toString()}release(){}toString(){return this.model.value.toString()}}},{t:lb.Types.RichText,f:class{constructor(t,e){this.model={address:t.address,type:lb.Types.String,value:e}}get value(){return this.model.value}set value(t){this.model.value=t}toString(){return this.model.value.richText.map((t=>t.text)).join("")}get type(){return lb.Types.RichText}get effectiveType(){return lb.Types.RichText}get address(){return this.model.address}set address(t){this.model.address=t}toCsvString(){return`"${this.text.replace(/"/g,'""')}"`}release(){}}},{t:lb.Types.Boolean,f:class{constructor(t,e){this.model={address:t.address,type:lb.Types.Boolean,value:e}}get value(){return this.model.value}set value(t){this.model.value=t}get type(){return lb.Types.Boolean}get effectiveType(){return lb.Types.Boolean}get address(){return this.model.address}set address(t){this.model.address=t}toCsvString(){return this.model.value?1:0}release(){}toString(){return this.model.value.toString()}}},{t:lb.Types.Error,f:class{constructor(t,e){this.model={address:t.address,type:lb.Types.Error,value:e}}get value(){return this.model.value}set value(t){this.model.value=t}get type(){return lb.Types.Error}get effectiveType(){return lb.Types.Error}get address(){return this.model.address}set address(t){this.model.address=t}toCsvString(){return this.toString()}release(){}toString(){return this.model.value.error.toString()}}}].reduce(((t,e)=>(t[e.t]=e.f,t)),[]),create(t,e,r){const i=this.types[t];if(!i)throw new Error(`Could not create Value of type ${t}`);return new i(e,r)}};const cb=Uv,ub=qv,db=Gv,pb=lb;var fb=class{constructor(t,e){this._worksheet=t,this._number=e,this._cells=[],this.style={},this.outlineLevel=0}get number(){return this._number}get worksheet(){return this._worksheet}commit(){this._worksheet._commitRow(this)}destroy(){delete this._worksheet,delete this._cells,delete this.style}findCell(t){return this._cells[t-1]}getCellEx(t){let e=this._cells[t.col-1];if(!e){const r=this._worksheet.getColumn(t.col);e=new pb(this,r,t.address),this._cells[t.col-1]=e}return e}getCell(t){if("string"==typeof t){const e=this._worksheet.getColumnKey(t);t=e?e.number:db.l2n(t)}return this._cells[t-1]||this.getCellEx({address:db.encodeAddress(this._number,t),row:this._number,col:t})}splice(t,e,...r){const i=t+e,n=r.length-e,s=this._cells.length;let o,a,l;if(n<0)for(o=t+r.length;o<=s;o++)l=this._cells[o-1],a=this._cells[o-n-1],a?(l=this.getCell(o),l.value=a.value,l.style=a.style,l._comment=a._comment):l&&(l.value=null,l.style={},l._comment=void 0);else if(n>0)for(o=s;o>=i;o--)a=this._cells[o-1],a?(l=this.getCell(o+n),l.value=a.value,l.style=a.style,l._comment=a._comment):this._cells[o+n-1]=void 0;for(o=0;o<r.length;o++)l=this.getCell(t+o),l.value=r[o],l.style={},l._comment=void 0}eachCell(t,e){if(e||(e=t,t=null),t&&t.includeEmpty){const t=this._cells.length;for(let r=1;r<=t;r++)e(this.getCell(r),r)}else this._cells.forEach(((t,r)=>{t&&t.type!==ub.ValueType.Null&&e(t,r+1)}))}addPageBreak(t,e){const r=this._worksheet,i=Math.max(0,t-1)||0,n=Math.max(0,e-1)||16838,s={id:this._number,max:n,man:1};i&&(s.min=i),r.rowBreaks.push(s)}get values(){const t=[];return this._cells.forEach((e=>{e&&e.type!==ub.ValueType.Null&&(t[e.col]=e.value)})),t}set values(t){if(this._cells=[],t)if(t instanceof Array){let e=0;t.hasOwnProperty("0")&&(e=1),t.forEach(((t,r)=>{void 0!==t&&(this.getCellEx({address:db.encodeAddress(this._number,r+e),row:this._number,col:r+e}).value=t)}))}else this._worksheet.eachColumnKey(((e,r)=>{void 0!==t[r]&&(this.getCellEx({address:db.encodeAddress(this._number,e.number),row:this._number,col:e.number}).value=t[r])}));else;}get hasValues(){return cb.some(this._cells,(t=>t&&t.type!==ub.ValueType.Null))}get cellCount(){return this._cells.length}get actualCellCount(){let t=0;return this.eachCell((()=>{t++})),t}get dimensions(){let t=0,e=0;return this._cells.forEach((r=>{r&&r.type!==ub.ValueType.Null&&((!t||t>r.col)&&(t=r.col),e<r.col&&(e=r.col))})),t>0?{min:t,max:e}:null}_applyStyle(t,e){return this.style[t]=e,this._cells.forEach((r=>{r&&(r[t]=e)})),e}get numFmt(){return this.style.numFmt}set numFmt(t){this._applyStyle("numFmt",t)}get font(){return this.style.font}set font(t){this._applyStyle("font",t)}get alignment(){return this.style.alignment}set alignment(t){this._applyStyle("alignment",t)}get protection(){return this.style.protection}set protection(t){this._applyStyle("protection",t)}get border(){return this.style.border}set border(t){this._applyStyle("border",t)}get fill(){return this.style.fill}set fill(t){this._applyStyle("fill",t)}get hidden(){return!!this._hidden}set hidden(t){this._hidden=t}get outlineLevel(){return this._outlineLevel||0}set outlineLevel(t){this._outlineLevel=t}get collapsed(){return!!(this._outlineLevel&&this._outlineLevel>=this._worksheet.properties.outlineLevelRow)}get model(){const t=[];let e=0,r=0;return this._cells.forEach((i=>{if(i){const n=i.model;n&&((!e||e>i.col)&&(e=i.col),r<i.col&&(r=i.col),t.push(n))}})),this.height||t.length?{cells:t,number:this.number,min:e,max:r,height:this.height,style:this.style,hidden:this.hidden,outlineLevel:this.outlineLevel,collapsed:this.collapsed}:null}set model(t){if(t.number!==this._number)throw new Error("Invalid row number in model");let e;this._cells=[],t.cells.forEach((t=>{switch(t.type){case pb.Types.Merge:break;default:{let r;if(t.address)r=db.decodeAddress(t.address);else if(e){const{row:t}=e,i=e.col+1;r={row:t,col:i,address:db.encodeAddress(t,i),$col$row:`$${db.n2l(i)}$${t}`}}e=r;this.getCellEx(r).model=t;break}}})),t.height?this.height=t.height:delete this.height,this.hidden=t.hidden,this.outlineLevel=t.outlineLevel||0,this.style=t.style&&JSON.parse(JSON.stringify(t.style))||{}}};const gb=Uv,mb=qv,yb=Gv;var vb=class t{constructor(t,e,r){this._worksheet=t,this._number=e,!1!==r&&(this.defn=r)}get number(){return this._number}get worksheet(){return this._worksheet}get letter(){return yb.n2l(this._number)}get isCustomWidth(){return void 0!==this.width&&9!==this.width}get defn(){return{header:this._header,key:this.key,width:this.width,style:this.style,hidden:this.hidden,outlineLevel:this.outlineLevel}}set defn(t){t?(this.key=t.key,this.width=void 0!==t.width?t.width:9,this.outlineLevel=t.outlineLevel,t.style?this.style=t.style:this.style={},this.header=t.header,this._hidden=!!t.hidden):(delete this._header,delete this._key,delete this.width,this.style={},this.outlineLevel=0)}get headers(){return this._header&&this._header instanceof Array?this._header:[this._header]}get header(){return this._header}set header(t){void 0!==t?(this._header=t,this.headers.forEach(((t,e)=>{this._worksheet.getCell(e+1,this.number).value=t}))):this._header=void 0}get key(){return this._key}set key(t){(this._key&&this._worksheet.getColumnKey(this._key))===this&&this._worksheet.deleteColumnKey(this._key),this._key=t,t&&this._worksheet.setColumnKey(this._key,this)}get hidden(){return!!this._hidden}set hidden(t){this._hidden=t}get outlineLevel(){return this._outlineLevel||0}set outlineLevel(t){this._outlineLevel=t}get collapsed(){return!!(this._outlineLevel&&this._outlineLevel>=this._worksheet.properties.outlineLevelCol)}toString(){return JSON.stringify({key:this.key,width:this.width,headers:this.headers.length?this.headers:void 0})}equivalentTo(t){return this.width===t.width&&this.hidden===t.hidden&&this.outlineLevel===t.outlineLevel&&gb.isEqual(this.style,t.style)}get isDefault(){if(this.isCustomWidth)return!1;if(this.hidden)return!1;if(this.outlineLevel)return!1;const t=this.style;return!t||!(t.font||t.numFmt||t.alignment||t.border||t.fill||t.protection)}get headerCount(){return this.headers.length}eachCell(t,e){const r=this.number;e||(e=t,t=null),this._worksheet.eachRow(t,((t,i)=>{e(t.getCell(r),i)}))}get values(){const t=[];return this.eachCell(((e,r)=>{e&&e.type!==mb.ValueType.Null&&(t[r]=e.value)})),t}set values(t){if(!t)return;const e=this.number;let r=0;t.hasOwnProperty("0")&&(r=1),t.forEach(((t,i)=>{this._worksheet.getCell(i+r,e).value=t}))}_applyStyle(t,e){return this.style[t]=e,this.eachCell((r=>{r[t]=e})),e}get numFmt(){return this.style.numFmt}set numFmt(t){this._applyStyle("numFmt",t)}get font(){return this.style.font}set font(t){this._applyStyle("font",t)}get alignment(){return this.style.alignment}set alignment(t){this._applyStyle("alignment",t)}get protection(){return this.style.protection}set protection(t){this._applyStyle("protection",t)}get border(){return this.style.border}set border(t){this._applyStyle("border",t)}get fill(){return this.style.fill}set fill(t){this._applyStyle("fill",t)}static toModel(t){const e=[];let r=null;return t&&t.forEach(((t,i)=>{t.isDefault?r&&(r=null):r&&t.equivalentTo(r)?r.max=i+1:(r={min:i+1,max:i+1,width:void 0!==t.width?t.width:9,style:t.style,isCustomWidth:t.isCustomWidth,hidden:t.hidden,outlineLevel:t.outlineLevel,collapsed:t.collapsed},e.push(r))})),e.length?e:void 0}static fromModel(e,r){const i=[];let n=1,s=0;for(r=(r=r||[]).sort((function(t,e){return t.min-e.min}));s<r.length;){const o=r[s++];for(;n<o.min;)i.push(new t(e,n++));for(;n<=o.max;)i.push(new t(e,n++,o))}return i.length?i:null}};const bb=Gv;var _b=class t{constructor(t,e,r=0){if(this.worksheet=t,e)if("string"==typeof e){const t=bb.decodeAddress(e);this.nativeCol=t.col+r,this.nativeColOff=0,this.nativeRow=t.row+r,this.nativeRowOff=0}else void 0!==e.nativeCol?(this.nativeCol=e.nativeCol||0,this.nativeColOff=e.nativeColOff||0,this.nativeRow=e.nativeRow||0,this.nativeRowOff=e.nativeRowOff||0):void 0!==e.col?(this.col=e.col+r,this.row=e.row+r):(this.nativeCol=0,this.nativeColOff=0,this.nativeRow=0,this.nativeRowOff=0);else this.nativeCol=0,this.nativeColOff=0,this.nativeRow=0,this.nativeRowOff=0}static asInstance(e){return e instanceof t||null==e?e:new t(e)}get col(){return this.nativeCol+Math.min(this.colWidth-1,this.nativeColOff)/this.colWidth}set col(t){this.nativeCol=Math.floor(t),this.nativeColOff=Math.floor((t-this.nativeCol)*this.colWidth)}get row(){return this.nativeRow+Math.min(this.rowHeight-1,this.nativeRowOff)/this.rowHeight}set row(t){this.nativeRow=Math.floor(t),this.nativeRowOff=Math.floor((t-this.nativeRow)*this.rowHeight)}get colWidth(){return this.worksheet&&this.worksheet.getColumn(this.nativeCol+1)&&this.worksheet.getColumn(this.nativeCol+1).isCustomWidth?Math.floor(1e4*this.worksheet.getColumn(this.nativeCol+1).width):64e4}get rowHeight(){return this.worksheet&&this.worksheet.getRow(this.nativeRow+1)&&this.worksheet.getRow(this.nativeRow+1).height?Math.floor(1e4*this.worksheet.getRow(this.nativeRow+1).height):18e4}get model(){return{nativeCol:this.nativeCol,nativeColOff:this.nativeColOff,nativeRow:this.nativeRow,nativeRowOff:this.nativeRowOff}}set model(t){this.nativeCol=t.nativeCol,this.nativeColOff=t.nativeColOff,this.nativeRow=t.nativeRow,this.nativeRowOff=t.nativeRowOff}};const wb=Gv,xb=_b;var Sb=class{constructor(t,e){this.worksheet=t,this.model=e}get model(){switch(this.type){case"background":return{type:this.type,imageId:this.imageId};case"image":return{type:this.type,imageId:this.imageId,hyperlinks:this.range.hyperlinks,range:{tl:this.range.tl.model,br:this.range.br&&this.range.br.model,ext:this.range.ext,editAs:this.range.editAs}};default:throw new Error("Invalid Image Type")}}set model({type:t,imageId:e,range:r,hyperlinks:i}){if(this.type=t,this.imageId=e,"image"===t)if("string"==typeof r){const t=wb.decode(r);this.range={tl:new xb(this.worksheet,{col:t.left,row:t.top},-1),br:new xb(this.worksheet,{col:t.right,row:t.bottom},0),editAs:"oneCell"}}else this.range={tl:new xb(this.worksheet,r.tl,0),br:r.br&&new xb(this.worksheet,r.br,0),ext:r.ext,editAs:r.editAs,hyperlinks:i||r.hyperlinks}}};const Tb=Gv;var kb=class{constructor(t,e){this.worksheet=t,e&&(this.table=e,this.validate(),this.store())}getFormula(t){switch(t.totalsRowFunction){case"none":return null;case"average":return`SUBTOTAL(101,${this.table.name}[${t.name}])`;case"countNums":return`SUBTOTAL(102,${this.table.name}[${t.name}])`;case"count":return`SUBTOTAL(103,${this.table.name}[${t.name}])`;case"max":return`SUBTOTAL(104,${this.table.name}[${t.name}])`;case"min":return`SUBTOTAL(105,${this.table.name}[${t.name}])`;case"stdDev":return`SUBTOTAL(106,${this.table.name}[${t.name}])`;case"var":return`SUBTOTAL(107,${this.table.name}[${t.name}])`;case"sum":return`SUBTOTAL(109,${this.table.name}[${t.name}])`;case"custom":return t.totalsRowFormula;default:throw new Error(`Invalid Totals Row Function: ${t.totalsRowFunction}`)}}get width(){return this.table.columns.length}get height(){return this.table.rows.length}get filterHeight(){return this.height+(this.table.headerRow?1:0)}get tableHeight(){return this.filterHeight+(this.table.totalsRow?1:0)}validate(){const{table:t}=this,e=(t,e,r)=>{void 0===t[e]&&(t[e]=r)};e(t,"headerRow",!0),e(t,"totalsRow",!1),e(t,"style",{}),e(t.style,"theme","TableStyleMedium2"),e(t.style,"showFirstColumn",!1),e(t.style,"showLastColumn",!1),e(t.style,"showRowStripes",!1),e(t.style,"showColumnStripes",!1);const r=(t,e)=>{if(!t)throw new Error(e)};r(t.ref,"Table must have ref"),r(t.columns,"Table must have column definitions"),r(t.rows,"Table must have row definitions"),t.tl=Tb.decodeAddress(t.ref);const{row:i,col:n}=t.tl;r(i>0,"Table must be on valid row"),r(n>0,"Table must be on valid col");const{width:s,filterHeight:o,tableHeight:a}=this;t.autoFilterRef=Tb.encode(i,n,i+o-1,n+s-1),t.tableRef=Tb.encode(i,n,i+a-1,n+s-1),t.columns.forEach(((t,i)=>{r(t.name,`Column ${i} must have a name`),0===i?e(t,"totalsRowLabel","Total"):(e(t,"totalsRowFunction","none"),t.totalsRowFormula=this.getFormula(t))}))}store(){const t=(t,e)=>{e&&Object.keys(e).forEach((r=>{t[r]=e[r]}))},{worksheet:e,table:r}=this,{row:i,col:n}=r.tl;let s=0;if(r.headerRow){const o=e.getRow(i+s++);r.columns.forEach(((e,r)=>{const{style:i,name:s}=e,a=o.getCell(n+r);a.value=s,t(a,i)}))}if(r.rows.forEach((o=>{const a=e.getRow(i+s++);o.forEach(((e,i)=>{const s=a.getCell(n+i);s.value=e,t(s,r.columns[i].style)}))})),r.totalsRow){const o=e.getRow(i+s++);r.columns.forEach(((e,r)=>{const i=o.getCell(n+r);if(0===r)i.value=e.totalsRowLabel;else{const t=this.getFormula(e);i.value=t?{formula:e.totalsRowFormula,result:e.totalsRowResult}:null}t(i,e.style)}))}}load(t){const{table:e}=this,{row:r,col:i}=e.tl;let n=0;if(e.headerRow){const s=t.getRow(r+n++);e.columns.forEach(((t,e)=>{s.getCell(i+e).value=t.name}))}if(e.rows.forEach((e=>{const s=t.getRow(r+n++);e.forEach(((t,e)=>{s.getCell(i+e).value=t}))})),e.totalsRow){const s=t.getRow(r+n++);e.columns.forEach(((t,e)=>{const r=s.getCell(i+e);if(0===e)r.value=t.totalsRowLabel;else{this.getFormula(t)&&(r.value={formula:t.totalsRowFormula,result:t.totalsRowResult})}}))}}get model(){return this.table}set model(t){this.table=t}cacheState(){this._cache||(this._cache={ref:this.ref,width:this.width,tableHeight:this.tableHeight})}commit(){if(!this._cache)return;this.validate();const t=Tb.decodeAddress(this._cache.ref);if(this.ref!==this._cache.ref)for(let e=0;e<this._cache.tableHeight;e++){const r=this.worksheet.getRow(t.row+e);for(let e=0;e<this._cache.width;e++){r.getCell(t.col+e).value=null}}else{for(let e=this.tableHeight;e<this._cache.tableHeight;e++){const r=this.worksheet.getRow(t.row+e);for(let e=0;e<this._cache.width;e++){r.getCell(t.col+e).value=null}}for(let e=0;e<this.tableHeight;e++){const r=this.worksheet.getRow(t.row+e);for(let e=this.width;e<this._cache.width;e++){r.getCell(t.col+e).value=null}}}this.store()}addRow(t,e){this.cacheState(),void 0===e?this.table.rows.push(t):this.table.rows.splice(e,0,t)}removeRows(t,e=1){this.cacheState(),this.table.rows.splice(t,e)}getColumn(t){const e=this.table.columns[t];return new class{constructor(t,e,r){this.table=t,this.column=e,this.index=r}_set(t,e){this.table.cacheState(),this.column[t]=e}get name(){return this.column.name}set name(t){this._set("name",t)}get filterButton(){return this.column.filterButton}set filterButton(t){this.column.filterButton=t}get style(){return this.column.style}set style(t){this.column.style=t}get totalsRowLabel(){return this.column.totalsRowLabel}set totalsRowLabel(t){this._set("totalsRowLabel",t)}get totalsRowFunction(){return this.column.totalsRowFunction}set totalsRowFunction(t){this._set("totalsRowFunction",t)}get totalsRowResult(){return this.column.totalsRowResult}set totalsRowResult(t){this._set("totalsRowResult",t)}get totalsRowFormula(){return this.column.totalsRowFormula}set totalsRowFormula(t){this._set("totalsRowFormula",t)}}(this,e,t)}addColumn(t,e,r){this.cacheState(),void 0===r?(this.table.columns.push(t),this.table.rows.forEach(((t,r)=>{t.push(e[r])}))):(this.table.columns.splice(r,0,t),this.table.rows.forEach(((t,i)=>{t.splice(r,0,e[i])})))}removeColumns(t,e=1){this.cacheState(),this.table.columns.splice(t,e),this.table.rows.forEach((r=>{r.splice(t,e)}))}_assign(t,e,r){this.cacheState(),t[e]=r}get ref(){return this.table.ref}set ref(t){this._assign(this.table,"ref",t)}get name(){return this.table.name}set name(t){this.table.name=t}get displayName(){return this.table.displyName||this.table.name}set displayNamename(t){this.table.displayName=t}get headerRow(){return this.table.headerRow}set headerRow(t){this._assign(this.table,"headerRow",t)}get totalsRow(){return this.table.totalsRow}set totalsRow(t){this._assign(this.table,"totalsRow",t)}get theme(){return this.table.style.name}set theme(t){this.table.style.name=t}get showFirstColumn(){return this.table.style.showFirstColumn}set showFirstColumn(t){this.table.style.showFirstColumn=t}get showLastColumn(){return this.table.style.showLastColumn}set showLastColumn(t){this.table.style.showLastColumn=t}get showRowStripes(){return this.table.style.showRowStripes}set showRowStripes(t){this.table.style.showRowStripes=t}get showColumnStripes(){return this.table.style.showColumnStripes}set showColumnStripes(t){this.table.style.showColumnStripes=t}};var Cb=class{constructor(t){this.model=t||{}}add(t,e){return this.model[t]=e}find(t){return this.model[t]}remove(t){this.model[t]=void 0}};const Eb=r,Ab={hash(t,...e){const r=Eb.createHash(t);return r.update(Buffer.concat(e)),r.digest()},convertPasswordToHash(t,e,r,i){e=e.toLowerCase();if(Eb.getHashes().indexOf(e)<0)throw new Error(`Hash algorithm '${e}' not supported!`);const n=Buffer.from(t,"utf16le");let s=this.hash(e,Buffer.from(r,"base64"),n);for(let t=0;t<i;t++){const r=Buffer.alloc(4);r.writeUInt32LE(t,0),s=this.hash(e,s,r)}return s.toString("base64")},randomBytes:t=>Eb.randomBytes(t)};var Ob=Ab,Bb={};const Rb=(t,e)=>({...t,...e.reduce(((e,r)=>(t[r]&&(e[r]={...t[r]}),e)),{})}),Lb=(t,e,r,i=[])=>{t[r]&&(e[r]=Rb(t[r],i))};Bb.copyStyle=t=>{if(!t)return t;if(e=t,0===Object.keys(e).length)return{};var e;const r={...t};return Lb(t,r,"font",["color"]),Lb(t,r,"alignment"),Lb(t,r,"protection"),t.border&&(Lb(t,r,"border"),Lb(t.border,r.border,"top",["color"]),Lb(t.border,r.border,"left",["color"]),Lb(t.border,r.border,"bottom",["color"]),Lb(t.border,r.border,"right",["color"]),Lb(t.border,r.border,"diagonal",["color"])),t.fill&&(Lb(t,r,"fill",["fgColor","bgColor","center"]),t.fill.stops&&(r.fill.stops=t.fill.stops.map((t=>Rb(t,["color"]))))),r};const Pb=Uv,Db=Gv,Mb=Yv,Ib=fb,Nb=vb,Fb=qv,jb=Sb,zb=kb,Hb=Cb,Wb=Ob,{copyStyle:Ub}=Bb;var $b=class{constructor(t){t=t||{},this._workbook=t.workbook,this.id=t.id,this.orderNo=t.orderNo,this.name=t.name,this.state=t.state||"visible",this._rows=[],this._columns=null,this._keys={},this._merges={},this.rowBreaks=[],this.properties=Object.assign({},{defaultRowHeight:15,dyDescent:55,outlineLevelCol:0,outlineLevelRow:0},t.properties),this.pageSetup=Object.assign({},{margins:{left:.7,right:.7,top:.75,bottom:.75,header:.3,footer:.3},orientation:"portrait",horizontalDpi:4294967295,verticalDpi:4294967295,fitToPage:!(!t.pageSetup||!t.pageSetup.fitToWidth&&!t.pageSetup.fitToHeight||t.pageSetup.scale),pageOrder:"downThenOver",blackAndWhite:!1,draft:!1,cellComments:"None",errors:"displayed",scale:100,fitToWidth:1,fitToHeight:1,paperSize:void 0,showRowColHeaders:!1,showGridLines:!1,firstPageNumber:void 0,horizontalCentered:!1,verticalCentered:!1,rowBreaks:null,colBreaks:null},t.pageSetup),this.headerFooter=Object.assign({},{differentFirst:!1,differentOddEven:!1,oddHeader:null,oddFooter:null,evenHeader:null,evenFooter:null,firstHeader:null,firstFooter:null},t.headerFooter),this.dataValidations=new Hb,this.views=t.views||[],this.autoFilter=t.autoFilter||null,this._media=[],this.sheetProtection=null,this.tables={},this.conditionalFormattings=[]}get name(){return this._name}set name(t){if(void 0===t&&(t=`sheet${this.id}`),this._name!==t){if("string"!=typeof t)throw new Error("The name has to be a string.");if(""===t)throw new Error("The name can't be empty.");if("History"===t)throw new Error('The name "History" is protected. Please use a different name.');if(/[*?:/\\[\]]/.test(t))throw new Error(`Worksheet name ${t} cannot include any of the following characters: * ? : \\ / [ ]`);if(/(^')|('$)/.test(t))throw new Error(`The first or last character of worksheet name cannot be a single quotation mark: ${t}`);if(t&&t.length>31&&(t=t.substring(0,31)),this._workbook._worksheets.find((e=>e&&e.name.toLowerCase()===t.toLowerCase())))throw new Error(`Worksheet name already exists: ${t}`);this._name=t}}get workbook(){return this._workbook}destroy(){this._workbook.removeWorksheetEx(this)}get dimensions(){const t=new Mb;return this._rows.forEach((e=>{if(e){const r=e.dimensions;r&&t.expand(e.number,r.min,e.number,r.max)}})),t}get columns(){return this._columns}set columns(t){this._headerRowCount=t.reduce(((t,e)=>{const r=(e.header?1:e.headers&&e.headers.length)||0;return Math.max(t,r)}),0);let e=1;const r=this._columns=[];t.forEach((t=>{const i=new Nb(this,e++,!1);r.push(i),i.defn=t}))}getColumnKey(t){return this._keys[t]}setColumnKey(t,e){this._keys[t]=e}deleteColumnKey(t){delete this._keys[t]}eachColumnKey(t){Pb.each(this._keys,t)}getColumn(t){if("string"==typeof t){const e=this._keys[t];if(e)return e;t=Db.l2n(t)}if(this._columns||(this._columns=[]),t>this._columns.length){let e=this._columns.length+1;for(;e<=t;)this._columns.push(new Nb(this,e++))}return this._columns[t-1]}spliceColumns(t,e,...r){const i=this._rows.length;if(r.length>0)for(let n=0;n<i;n++){const i=[t,e];r.forEach((t=>{i.push(t[n]||null)}));const s=this.getRow(n+1);s.splice.apply(s,i)}else this._rows.forEach((r=>{r&&r.splice(t,e)}));const n=r.length-e,s=t+e,o=this._columns.length;if(n<0)for(let e=t+r.length;e<=o;e++)this.getColumn(e).defn=this.getColumn(e-n).defn;else if(n>0)for(let t=o;t>=s;t--)this.getColumn(t+n).defn=this.getColumn(t).defn;for(let e=t;e<t+r.length;e++)this.getColumn(e).defn=null;this.workbook.definedNames.spliceColumns(this.name,t,e,r.length)}get lastColumn(){return this.getColumn(this.columnCount)}get columnCount(){let t=0;return this.eachRow((e=>{t=Math.max(t,e.cellCount)})),t}get actualColumnCount(){const t=[];let e=0;return this.eachRow((r=>{r.eachCell((({col:r})=>{t[r]||(t[r]=!0,e++)}))})),e}_commitRow(){}get _lastRowNumber(){const t=this._rows;let e=t.length;for(;e>0&&void 0===t[e-1];)e--;return e}get _nextRow(){return this._lastRowNumber+1}get lastRow(){if(this._rows.length)return this._rows[this._rows.length-1]}findRow(t){return this._rows[t-1]}findRows(t,e){return this._rows.slice(t-1,t-1+e)}get rowCount(){return this._lastRowNumber}get actualRowCount(){let t=0;return this.eachRow((()=>{t++})),t}getRow(t){let e=this._rows[t-1];return e||(e=this._rows[t-1]=new Ib(this,t)),e}getRows(t,e){if(e<1)return;const r=[];for(let i=t;i<t+e;i++)r.push(this.getRow(i));return r}addRow(t,e="n"){const r=this._nextRow,i=this.getRow(r);return i.values=t,this._setStyleOption(r,"i"===e[0]?e:"n"),i}addRows(t,e="n"){const r=[];return t.forEach((t=>{r.push(this.addRow(t,e))})),r}insertRow(t,e,r="n"){return this.spliceRows(t,0,e),this._setStyleOption(t,r),this.getRow(t)}insertRows(t,e,r="n"){if(this.spliceRows(t,0,...e),"n"!==r)for(let i=0;i<e.length;i++)"o"===r[0]&&void 0!==this.findRow(e.length+t+i)?this._copyStyle(e.length+t+i,t+i,"+"===r[1]):"i"===r[0]&&void 0!==this.findRow(t-1)&&this._copyStyle(t-1,t+i,"+"===r[1]);return this.getRows(t,e.length)}_setStyleOption(t,e="n"){"o"===e[0]&&void 0!==this.findRow(t+1)?this._copyStyle(t+1,t,"+"===e[1]):"i"===e[0]&&void 0!==this.findRow(t-1)&&this._copyStyle(t-1,t,"+"===e[1])}_copyStyle(t,e,r=!1){const i=this.getRow(t),n=this.getRow(e);n.style=Ub(i.style),i.eachCell({includeEmpty:r},((t,e)=>{n.getCell(e).style=Ub(t.style)})),n.height=i.height}duplicateRow(t,e,r=!1){const i=this._rows[t-1],n=new Array(e).fill(i.values);this.spliceRows(t+1,r?0:e,...n);for(let r=0;r<e;r++){const e=this._rows[t+r];e.style=i.style,e.height=i.height,i.eachCell({includeEmpty:!0},((t,r)=>{e.getCell(r).style=t.style}))}}spliceRows(t,e,...r){const i=t+e,n=r.length,s=n-e,o=this._rows.length;let a,l;if(s<0)for(t===o&&(this._rows[o-1]=void 0),a=i;a<=o;a++)if(l=this._rows[a-1],l){const t=this.getRow(a+s);t.values=l.values,t.style=l.style,t.height=l.height,l.eachCell({includeEmpty:!0},((e,r)=>{t.getCell(r).style=e.style})),this._rows[a-1]=void 0}else this._rows[a+s-1]=void 0;else if(s>0)for(a=o;a>=i;a--)if(l=this._rows[a-1],l){const t=this.getRow(a+s);t.values=l.values,t.style=l.style,t.height=l.height,l.eachCell({includeEmpty:!0},((e,r)=>{if(t.getCell(r).style=e.style,"MergeValue"===e._value.constructor.name){const t=this.getRow(e._row._number+n).getCell(r),i=e._value._master,s=this.getRow(i._row._number+n).getCell(i._column._number);t.merge(s)}}))}else this._rows[a+s-1]=void 0;for(a=0;a<n;a++){const e=this.getRow(t+a);e.style={},e.values=r[a]}this.workbook.definedNames.spliceRows(this.name,t,e,n)}eachRow(t,e){if(e||(e=t,t=void 0),t&&t.includeEmpty){const t=this._rows.length;for(let r=1;r<=t;r++)e(this.getRow(r),r)}else this._rows.forEach((t=>{t&&t.hasValues&&e(t,t.number)}))}getSheetValues(){const t=[];return this._rows.forEach((e=>{e&&(t[e.number]=e.values)})),t}findCell(t,e){const r=Db.getAddress(t,e),i=this._rows[r.row-1];return i?i.findCell(r.col):void 0}getCell(t,e){const r=Db.getAddress(t,e);return this.getRow(r.row).getCellEx(r)}mergeCells(...t){const e=new Mb(t);this._mergeCellsInternal(e)}mergeCellsWithoutStyle(...t){const e=new Mb(t);this._mergeCellsInternal(e,!0)}_mergeCellsInternal(t,e){Pb.each(this._merges,(e=>{if(e.intersects(t))throw new Error("Cannot merge already merged cells")}));const r=this.getCell(t.top,t.left);for(let i=t.top;i<=t.bottom;i++)for(let n=t.left;n<=t.right;n++)(i>t.top||n>t.left)&&this.getCell(i,n).merge(r,e);this._merges[r.address]=t}_unMergeMaster(t){const e=this._merges[t.address];if(e){for(let t=e.top;t<=e.bottom;t++)for(let r=e.left;r<=e.right;r++)this.getCell(t,r).unmerge();delete this._merges[t.address]}}get hasMerges(){return Pb.some(this._merges,Boolean)}unMergeCells(...t){const e=new Mb(t);for(let t=e.top;t<=e.bottom;t++)for(let r=e.left;r<=e.right;r++){const e=this.findCell(t,r);e&&(e.type===Fb.ValueType.Merge?this._unMergeMaster(e.master):this._merges[e.address]&&this._unMergeMaster(e))}}fillFormula(t,e,r,i="shared"){const n=Db.decode(t),{top:s,left:o,bottom:a,right:l}=n,h=l-o+1,c=Db.encodeAddress(s,o),u="shared"===i;let d;d="function"==typeof r?r:Array.isArray(r)?Array.isArray(r[0])?(t,e)=>r[t-s][e-o]:(t,e)=>r[(t-s)*h+(e-o)]:()=>{};let p=!0;for(let r=s;r<=a;r++)for(let n=o;n<=l;n++)p?(this.getCell(r,n).value={shareType:i,formula:e,ref:t,result:d(r,n)},p=!1):this.getCell(r,n).value=u?{sharedFormula:c,result:d(r,n)}:d(r,n)}addImage(t,e){const r={type:"image",imageId:t,range:e};this._media.push(new jb(this,r))}getImages(){return this._media.filter((t=>"image"===t.type))}addBackgroundImage(t){const e={type:"background",imageId:t};this._media.push(new jb(this,e))}getBackgroundImageId(){const t=this._media.find((t=>"background"===t.type));return t&&t.imageId}protect(t,e){return new Promise((r=>{this.sheetProtection={sheet:!0},e&&"spinCount"in e&&(e.spinCount=Number.isFinite(e.spinCount)?Math.round(Math.max(0,e.spinCount)):1e5),t&&(this.sheetProtection.algorithmName="SHA-512",this.sheetProtection.saltValue=Wb.randomBytes(16).toString("base64"),this.sheetProtection.spinCount=e&&"spinCount"in e?e.spinCount:1e5,this.sheetProtection.hashValue=Wb.convertPasswordToHash(t,"SHA512",this.sheetProtection.saltValue,this.sheetProtection.spinCount)),e&&(this.sheetProtection=Object.assign(this.sheetProtection,e),!t&&"spinCount"in e&&delete this.sheetProtection.spinCount),r()}))}unprotect(){this.sheetProtection=null}addTable(t){const e=new zb(this,t);return this.tables[t.name]=e,e}getTable(t){return this.tables[t]}removeTable(t){delete this.tables[t]}getTables(){return Object.values(this.tables)}addConditionalFormatting(t){this.conditionalFormattings.push(t)}removeConditionalFormatting(t){"number"==typeof t?this.conditionalFormattings.splice(t,1):this.conditionalFormattings=t instanceof Function?this.conditionalFormattings.filter(t):[]}get tabColor(){return this.properties.tabColor}set tabColor(t){this.properties.tabColor=t}get model(){const t={id:this.id,name:this.name,dataValidations:this.dataValidations.model,properties:this.properties,state:this.state,pageSetup:this.pageSetup,headerFooter:this.headerFooter,rowBreaks:this.rowBreaks,views:this.views,autoFilter:this.autoFilter,media:this._media.map((t=>t.model)),sheetProtection:this.sheetProtection,tables:Object.values(this.tables).map((t=>t.model)),conditionalFormattings:this.conditionalFormattings};t.cols=Nb.toModel(this.columns);const e=t.rows=[],r=t.dimensions=new Mb;return this._rows.forEach((t=>{const i=t&&t.model;i&&(r.expand(i.number,i.min,i.number,i.max),e.push(i))})),t.merges=[],Pb.each(this._merges,(e=>{t.merges.push(e.range)})),t}_parseRows(t){this._rows=[],t.rows.forEach((t=>{const e=new Ib(this,t.number);this._rows[e.number-1]=e,e.model=t}))}_parseMergeCells(t){Pb.each(t.mergeCells,(t=>{this.mergeCellsWithoutStyle(t)}))}set model(t){this.name=t.name,this._columns=Nb.fromModel(this,t.cols),this._parseRows(t),this._parseMergeCells(t),this.dataValidations=new Hb(t.dataValidations),this.properties=t.properties,this.pageSetup=t.pageSetup,this.headerFooter=t.headerFooter,this.views=t.views,this.autoFilter=t.autoFilter,this._media=t.media.map((t=>new jb(this,t))),this.sheetProtection=t.sheetProtection,this.tables=t.tables.reduce(((t,e)=>{const r=new zb;return r.model=e,t[e.name]=r,t}),{}),this.conditionalFormattings=t.conditionalFormattings}};const Vb=Uv,Gb=Gv;var Xb=class{constructor(t){this.template=t,this.sheets={}}addCell(t){this.addCellEx(Gb.decodeEx(t))}getCell(t){return this.findCellEx(Gb.decodeEx(t),!0)}findCell(t){return this.findCellEx(Gb.decodeEx(t),!1)}findCellAt(t,e,r){const i=this.sheets[t],n=i&&i[e];return n&&n[r]}addCellEx(t){if(t.top)for(let e=t.top;e<=t.bottom;e++)for(let r=t.left;r<=t.right;r++)this.getCellAt(t.sheetName,e,r);else this.findCellEx(t,!0)}getCellEx(t){return this.findCellEx(t,!0)}findCellEx(t,e){const r=this.findSheet(t,e),i=this.findSheetRow(r,t,e);return this.findRowCell(i,t,e)}getCellAt(t,e,r){const i=this.sheets[t]||(this.sheets[t]=[]),n=i[e]||(i[e]=[]);return n[r]||(n[r]={sheetName:t,address:Gb.n2l(r)+e,row:e,col:r})}removeCellEx(t){const e=this.findSheet(t);if(!e)return;const r=this.findSheetRow(e,t);r&&delete r[t.col]}forEachInSheet(t,e){const r=this.sheets[t];r&&r.forEach(((t,r)=>{t&&t.forEach(((t,i)=>{t&&e(t,r,i)}))}))}forEach(t){Vb.each(this.sheets,((e,r)=>{this.forEachInSheet(r,t)}))}map(t){const e=[];return this.forEach((r=>{e.push(t(r))})),e}findSheet(t,e){const r=t.sheetName;return this.sheets[r]?this.sheets[r]:e?this.sheets[r]=[]:void 0}findSheetRow(t,e,r){const{row:i}=e;return t&&t[i]?t[i]:r?t[i]=[]:void 0}findRowCell(t,e,r){const{col:i}=e;return t&&t[i]?t[i]:r?t[i]=this.template?Object.assign(e,JSON.parse(JSON.stringify(this.template))):e:void 0}spliceRows(t,e,r,i){const n=this.sheets[t];if(n){const t=[];for(let e=0;e<i;e++)t.push([]);n.splice(e,r,...t)}}spliceColumns(t,e,r,i){const n=this.sheets[t];if(n){const t=[];for(let e=0;e<i;e++)t.push(null);Vb.each(n,(i=>{i.splice(e,r,...t)}))}}};const Yb=Uv,qb=Gv,Zb=Xb,Kb=Yv,Qb=/[$](\w+)[$](\d+)(:[$](\w+)[$](\d+))?/;var Jb,t_,e_,r_,i_,n_=class{constructor(){this.matrixMap={}}getMatrix(t){return this.matrixMap[t]||(this.matrixMap[t]=new Zb)}add(t,e){const r=qb.decodeEx(t);this.addEx(r,e)}addEx(t,e){const r=this.getMatrix(e);if(t.top)for(let e=t.left;e<=t.right;e++)for(let i=t.top;i<=t.bottom;i++){const n={sheetName:t.sheetName,address:qb.n2l(e)+i,row:i,col:e};r.addCellEx(n)}else r.addCellEx(t)}remove(t,e){const r=qb.decodeEx(t);this.removeEx(r,e)}removeEx(t,e){this.getMatrix(e).removeCellEx(t)}removeAllNames(t){Yb.each(this.matrixMap,(e=>{e.removeCellEx(t)}))}forEach(t){Yb.each(this.matrixMap,((e,r)=>{e.forEach((e=>{t(r,e)}))}))}getNames(t){return this.getNamesEx(qb.decodeEx(t))}getNamesEx(t){return Yb.map(this.matrixMap,((e,r)=>e.findCellEx(t)&&r)).filter(Boolean)}_explore(t,e){e.mark=!1;const{sheetName:r}=e,i=new Kb(e.row,e.col,e.row,e.col,r);let n,s;function o(n,s){const o=t.findCellAt(r,n,e.col);return!(!o||!o.mark)&&(i[s]=n,o.mark=!1,!0)}for(s=e.row-1;o(s,"top");s--);for(s=e.row+1;o(s,"bottom");s++);function a(e,n){const o=[];for(s=i.top;s<=i.bottom;s++){const i=t.findCellAt(r,s,e);if(!i||!i.mark)return!1;o.push(i)}i[n]=e;for(let t=0;t<o.length;t++)o[t].mark=!1;return!0}for(n=e.col-1;a(n,"left");n--);for(n=e.col+1;a(n,"right");n++);return i}getRanges(t,e){if(!(e=e||this.matrixMap[t]))return{name:t,ranges:[]};e.forEach((t=>{t.mark=!0}));const r=e.map((t=>t.mark&&this._explore(e,t))).filter(Boolean).map((t=>t.$shortRange));return{name:t,ranges:r}}normaliseMatrix(t,e){t.forEachInSheet(e,((t,e,r)=>{t&&(t.row===e&&t.col===r||(t.row=e,t.col=r,t.address=qb.n2l(r)+e))}))}spliceRows(t,e,r,i){Yb.each(this.matrixMap,(n=>{n.spliceRows(t,e,r,i),this.normaliseMatrix(n,t)}))}spliceColumns(t,e,r,i){Yb.each(this.matrixMap,(n=>{n.spliceColumns(t,e,r,i),this.normaliseMatrix(n,t)}))}get model(){return Yb.map(this.matrixMap,((t,e)=>this.getRanges(e,t))).filter((t=>t.ranges.length))}set model(t){const e=this.matrixMap={};t.forEach((t=>{const r=e[t.name]=new Zb;t.ranges.forEach((t=>{Qb.test(t.split("!").pop()||"")&&r.addCell(t)}))}))}},s_={},o_={},a_={},l_={exports:{}},h_={exports:{}};function c_(){if(Jb)return h_.exports;return Jb=1,"undefined"==typeof process||!process.version||0===process.version.indexOf("v0.")||0===process.version.indexOf("v1.")&&0!==process.version.indexOf("v1.8.")?h_.exports={nextTick:function(t,e,r,i){if("function"!=typeof t)throw new TypeError('"callback" argument must be a function');var n,s,o=arguments.length;switch(o){case 0:case 1:return process.nextTick(t);case 2:return process.nextTick((function(){t.call(null,e)}));case 3:return process.nextTick((function(){t.call(null,e,r)}));case 4:return process.nextTick((function(){t.call(null,e,r,i)}));default:for(n=new Array(o-1),s=0;s<n.length;)n[s++]=arguments[s];return process.nextTick((function(){t.apply(null,n)}))}}}:h_.exports=process,h_.exports}function u_(){return i_?r_:(i_=1,r_=n)}var d_,p_={exports:{}};function f_(){return d_||(d_=1,function(t,e){var r=o,i=r.Buffer;function n(t,e){for(var r in t)e[r]=t[r]}function s(t,e,r){return i(t,e,r)}i.from&&i.alloc&&i.allocUnsafe&&i.allocUnsafeSlow?t.exports=r:(n(r,e),e.Buffer=s),n(i,s),s.from=function(t,e,r){if("number"==typeof t)throw new TypeError("Argument must not be a number");return i(t,e,r)},s.alloc=function(t,e,r){if("number"!=typeof t)throw new TypeError("Argument must be a number");var n=i(t);return void 0!==e?"string"==typeof r?n.fill(e,r):n.fill(e):n.fill(0),n},s.allocUnsafe=function(t){if("number"!=typeof t)throw new TypeError("Argument must be a number");return i(t)},s.allocUnsafeSlow=function(t){if("number"!=typeof t)throw new TypeError("Argument must be a number");return r.SlowBuffer(t)}}(p_,p_.exports)),p_.exports}var g_,m_={};function y_(){if(g_)return m_;function t(t){return Object.prototype.toString.call(t)}return g_=1,m_.isArray=function(e){return Array.isArray?Array.isArray(e):"[object Array]"===t(e)},m_.isBoolean=function(t){return"boolean"==typeof t},m_.isNull=function(t){return null===t},m_.isNullOrUndefined=function(t){return null==t},m_.isNumber=function(t){return"number"==typeof t},m_.isString=function(t){return"string"==typeof t},m_.isSymbol=function(t){return"symbol"==typeof t},m_.isUndefined=function(t){return void 0===t},m_.isRegExp=function(e){return"[object RegExp]"===t(e)},m_.isObject=function(t){return"object"==typeof t&&null!==t},m_.isDate=function(e){return"[object Date]"===t(e)},m_.isError=function(e){return"[object Error]"===t(e)||e instanceof Error},m_.isFunction=function(t){return"function"==typeof t},m_.isPrimitive=function(t){return null===t||"boolean"==typeof t||"number"==typeof t||"string"==typeof t||"symbol"==typeof t||void 0===t},m_.isBuffer=o.Buffer.isBuffer,m_}var v_,b_,__={exports:{}},w_={exports:{}};function x_(){if(b_)return __.exports;b_=1;try{var t=require("util");if("function"!=typeof t.inherits)throw"";__.exports=t.inherits}catch(t){__.exports=(v_||(v_=1,"function"==typeof Object.create?w_.exports=function(t,e){e&&(t.super_=e,t.prototype=Object.create(e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}))}:w_.exports=function(t,e){if(e){t.super_=e;var r=function(){};r.prototype=e.prototype,t.prototype=new r,t.prototype.constructor=t}}),w_.exports)}return __.exports}var S_,T_,k_,C_,E_,A_,O_,B_,R_,L_={exports:{}};function P_(){return S_||(S_=1,function(t){var e=f_().Buffer,r=a;function i(t,e,r){t.copy(e,r)}t.exports=function(){function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.head=null,this.tail=null,this.length=0}return t.prototype.push=function(t){var e={data:t,next:null};this.length>0?this.tail.next=e:this.head=e,this.tail=e,++this.length},t.prototype.unshift=function(t){var e={data:t,next:this.head};0===this.length&&(this.tail=e),this.head=e,++this.length},t.prototype.shift=function(){if(0!==this.length){var t=this.head.data;return 1===this.length?this.head=this.tail=null:this.head=this.head.next,--this.length,t}},t.prototype.clear=function(){this.head=this.tail=null,this.length=0},t.prototype.join=function(t){if(0===this.length)return"";for(var e=this.head,r=""+e.data;e=e.next;)r+=t+e.data;return r},t.prototype.concat=function(t){if(0===this.length)return e.alloc(0);for(var r=e.allocUnsafe(t>>>0),n=this.head,s=0;n;)i(n.data,r,s),s+=n.data.length,n=n.next;return r},t}(),r&&r.inspect&&r.inspect.custom&&(t.exports.prototype[r.inspect.custom]=function(){var t=r.inspect({length:this.length});return this.constructor.name+" "+t})}(L_)),L_.exports}function D_(){if(k_)return T_;k_=1;var t=c_();function e(t,e){t.emit("error",e)}return T_={destroy:function(r,i){var n=this,s=this._readableState&&this._readableState.destroyed,o=this._writableState&&this._writableState.destroyed;return s||o?(i?i(r):r&&(this._writableState?this._writableState.errorEmitted||(this._writableState.errorEmitted=!0,t.nextTick(e,this,r)):t.nextTick(e,this,r)),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(r||null,(function(r){!i&&r?n._writableState?n._writableState.errorEmitted||(n._writableState.errorEmitted=!0,t.nextTick(e,n,r)):t.nextTick(e,n,r):i&&i(r)})),this)},undestroy:function(){this._readableState&&(this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1),this._writableState&&(this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finalCalled=!1,this._writableState.prefinished=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1)}},T_}function M_(){return E_?C_:(E_=1,C_=a.deprecate)}function I_(){if(O_)return A_;O_=1;var t=c_();function e(t){var e=this;this.next=null,this.entry=null,this.finish=function(){!function(t,e,r){var i=t.entry;t.entry=null;for(;i;){var n=i.callback;e.pendingcb--,n(r),i=i.next}e.corkedRequestsFree.next=t}(e,t)}}A_=p;var r,i=!process.browser&&["v0.10","v0.9."].indexOf(process.version.slice(0,5))>-1?setImmediate:t.nextTick;p.WritableState=d;var n=Object.create(y_());n.inherits=x_();var s={deprecate:M_()},o=u_(),a=f_().Buffer,l=(void 0!==dt?dt:"undefined"!=typeof window?window:"undefined"!=typeof self?self:{}).Uint8Array||function(){};var h,c=D_();function u(){}function d(n,s){r=r||N_(),n=n||{};var o=s instanceof r;this.objectMode=!!n.objectMode,o&&(this.objectMode=this.objectMode||!!n.writableObjectMode);var a=n.highWaterMark,l=n.writableHighWaterMark,h=this.objectMode?16:16384;this.highWaterMark=a||0===a?a:o&&(l||0===l)?l:h,this.highWaterMark=Math.floor(this.highWaterMark),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var c=!1===n.decodeStrings;this.decodeStrings=!c,this.defaultEncoding=n.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(e){!function(e,r){var n=e._writableState,s=n.sync,o=n.writecb;if(function(t){t.writing=!1,t.writecb=null,t.length-=t.writelen,t.writelen=0}(n),r)!function(e,r,i,n,s){--r.pendingcb,i?(t.nextTick(s,n),t.nextTick(b,e,r),e._writableState.errorEmitted=!0,e.emit("error",n)):(s(n),e._writableState.errorEmitted=!0,e.emit("error",n),b(e,r))}(e,n,s,r,o);else{var a=y(n);a||n.corked||n.bufferProcessing||!n.bufferedRequest||m(e,n),s?i(g,e,n,a,o):g(e,n,a,o)}}(s,e)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.bufferedRequestCount=0,this.corkedRequestsFree=new e(this)}function p(t){if(r=r||N_(),!(h.call(p,this)||this instanceof r))return new p(t);this._writableState=new d(t,this),this.writable=!0,t&&("function"==typeof t.write&&(this._write=t.write),"function"==typeof t.writev&&(this._writev=t.writev),"function"==typeof t.destroy&&(this._destroy=t.destroy),"function"==typeof t.final&&(this._final=t.final)),o.call(this)}function f(t,e,r,i,n,s,o){e.writelen=i,e.writecb=o,e.writing=!0,e.sync=!0,r?t._writev(n,e.onwrite):t._write(n,s,e.onwrite),e.sync=!1}function g(t,e,r,i){r||function(t,e){0===e.length&&e.needDrain&&(e.needDrain=!1,t.emit("drain"))}(t,e),e.pendingcb--,i(),b(t,e)}function m(t,r){r.bufferProcessing=!0;var i=r.bufferedRequest;if(t._writev&&i&&i.next){var n=r.bufferedRequestCount,s=new Array(n),o=r.corkedRequestsFree;o.entry=i;for(var a=0,l=!0;i;)s[a]=i,i.isBuf||(l=!1),i=i.next,a+=1;s.allBuffers=l,f(t,r,!0,r.length,s,"",o.finish),r.pendingcb++,r.lastBufferedRequest=null,o.next?(r.corkedRequestsFree=o.next,o.next=null):r.corkedRequestsFree=new e(r),r.bufferedRequestCount=0}else{for(;i;){var h=i.chunk,c=i.encoding,u=i.callback;if(f(t,r,!1,r.objectMode?1:h.length,h,c,u),i=i.next,r.bufferedRequestCount--,r.writing)break}null===i&&(r.lastBufferedRequest=null)}r.bufferedRequest=i,r.bufferProcessing=!1}function y(t){return t.ending&&0===t.length&&null===t.bufferedRequest&&!t.finished&&!t.writing}function v(t,e){t._final((function(r){e.pendingcb--,r&&t.emit("error",r),e.prefinished=!0,t.emit("prefinish"),b(t,e)}))}function b(e,r){var i=y(r);return i&&(!function(e,r){r.prefinished||r.finalCalled||("function"==typeof e._final?(r.pendingcb++,r.finalCalled=!0,t.nextTick(v,e,r)):(r.prefinished=!0,e.emit("prefinish")))}(e,r),0===r.pendingcb&&(r.finished=!0,e.emit("finish"))),i}return n.inherits(p,o),d.prototype.getBuffer=function(){for(var t=this.bufferedRequest,e=[];t;)e.push(t),t=t.next;return e},function(){try{Object.defineProperty(d.prototype,"buffer",{get:s.deprecate((function(){return this.getBuffer()}),"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch(t){}}(),"function"==typeof Symbol&&Symbol.hasInstance&&"function"==typeof Function.prototype[Symbol.hasInstance]?(h=Function.prototype[Symbol.hasInstance],Object.defineProperty(p,Symbol.hasInstance,{value:function(t){return!!h.call(this,t)||this===p&&(t&&t._writableState instanceof d)}})):h=function(t){return t instanceof this},p.prototype.pipe=function(){this.emit("error",new Error("Cannot pipe, not readable"))},p.prototype.write=function(e,r,i){var n,s=this._writableState,o=!1,h=!s.objectMode&&(n=e,a.isBuffer(n)||n instanceof l);return h&&!a.isBuffer(e)&&(e=function(t){return a.from(t)}(e)),"function"==typeof r&&(i=r,r=null),h?r="buffer":r||(r=s.defaultEncoding),"function"!=typeof i&&(i=u),s.ended?function(e,r){var i=new Error("write after end");e.emit("error",i),t.nextTick(r,i)}(this,i):(h||function(e,r,i,n){var s=!0,o=!1;return null===i?o=new TypeError("May not write null values to stream"):"string"==typeof i||void 0===i||r.objectMode||(o=new TypeError("Invalid non-string/buffer chunk")),o&&(e.emit("error",o),t.nextTick(n,o),s=!1),s}(this,s,e,i))&&(s.pendingcb++,o=function(t,e,r,i,n,s){if(!r){var o=function(t,e,r){t.objectMode||!1===t.decodeStrings||"string"!=typeof e||(e=a.from(e,r));return e}(e,i,n);i!==o&&(r=!0,n="buffer",i=o)}var l=e.objectMode?1:i.length;e.length+=l;var h=e.length<e.highWaterMark;h||(e.needDrain=!0);if(e.writing||e.corked){var c=e.lastBufferedRequest;e.lastBufferedRequest={chunk:i,encoding:n,isBuf:r,callback:s,next:null},c?c.next=e.lastBufferedRequest:e.bufferedRequest=e.lastBufferedRequest,e.bufferedRequestCount+=1}else f(t,e,!1,l,i,n,s);return h}(this,s,h,e,r,i)),o},p.prototype.cork=function(){this._writableState.corked++},p.prototype.uncork=function(){var t=this._writableState;t.corked&&(t.corked--,t.writing||t.corked||t.bufferProcessing||!t.bufferedRequest||m(this,t))},p.prototype.setDefaultEncoding=function(t){if("string"==typeof t&&(t=t.toLowerCase()),!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((t+"").toLowerCase())>-1))throw new TypeError("Unknown encoding: "+t);return this._writableState.defaultEncoding=t,this},Object.defineProperty(p.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),p.prototype._write=function(t,e,r){r(new Error("_write() is not implemented"))},p.prototype._writev=null,p.prototype.end=function(e,r,i){var n=this._writableState;"function"==typeof e?(i=e,e=null,r=null):"function"==typeof r&&(i=r,r=null),null!=e&&this.write(e,r),n.corked&&(n.corked=1,this.uncork()),n.ending||function(e,r,i){r.ending=!0,b(e,r),i&&(r.finished?t.nextTick(i):e.once("finish",i));r.ended=!0,e.writable=!1}(this,n,i)},Object.defineProperty(p.prototype,"destroyed",{get:function(){return void 0!==this._writableState&&this._writableState.destroyed},set:function(t){this._writableState&&(this._writableState.destroyed=t)}}),p.prototype.destroy=c.destroy,p.prototype._undestroy=c.undestroy,p.prototype._destroy=function(t,e){this.end(),e(t)},A_}function N_(){if(R_)return B_;R_=1;var t=c_(),e=Object.keys||function(t){var e=[];for(var r in t)e.push(r);return e};B_=l;var r=Object.create(y_());r.inherits=x_();var i=Y_(),n=I_();r.inherits(l,i);for(var s=e(n.prototype),o=0;o<s.length;o++){var a=s[o];l.prototype[a]||(l.prototype[a]=n.prototype[a])}function l(t){if(!(this instanceof l))return new l(t);i.call(this,t),n.call(this,t),t&&!1===t.readable&&(this.readable=!1),t&&!1===t.writable&&(this.writable=!1),this.allowHalfOpen=!0,t&&!1===t.allowHalfOpen&&(this.allowHalfOpen=!1),this.once("end",h)}function h(){this.allowHalfOpen||this._writableState.ended||t.nextTick(c,this)}function c(t){t.end()}return Object.defineProperty(l.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),Object.defineProperty(l.prototype,"destroyed",{get:function(){return void 0!==this._readableState&&void 0!==this._writableState&&(this._readableState.destroyed&&this._writableState.destroyed)},set:function(t){void 0!==this._readableState&&void 0!==this._writableState&&(this._readableState.destroyed=t,this._writableState.destroyed=t)}}),l.prototype._destroy=function(e,r){this.push(null),this.end(),t.nextTick(r,e)},B_}var F_,j_,z_,H_,W_,U_,$_,V_,G_={};function X_(){if(F_)return G_;F_=1;var t=f_().Buffer,e=t.isEncoding||function(t){switch((t=""+t)&&t.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};function r(r){var i;switch(this.encoding=function(r){var i=function(t){if(!t)return"utf8";for(var e;;)switch(t){case"utf8":case"utf-8":return"utf8";case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return"utf16le";case"latin1":case"binary":return"latin1";case"base64":case"ascii":case"hex":return t;default:if(e)return;t=(""+t).toLowerCase(),e=!0}}(r);if("string"!=typeof i&&(t.isEncoding===e||!e(r)))throw new Error("Unknown encoding: "+r);return i||r}(r),this.encoding){case"utf16le":this.text=s,this.end=o,i=4;break;case"utf8":this.fillLast=n,i=4;break;case"base64":this.text=a,this.end=l,i=3;break;default:return this.write=h,void(this.end=c)}this.lastNeed=0,this.lastTotal=0,this.lastChar=t.allocUnsafe(i)}function i(t){return t<=127?0:t>>5==6?2:t>>4==14?3:t>>3==30?4:t>>6==2?-1:-2}function n(t){var e=this.lastTotal-this.lastNeed,r=function(t,e,r){if(128!=(192&e[0]))return t.lastNeed=0,"�";if(t.lastNeed>1&&e.length>1){if(128!=(192&e[1]))return t.lastNeed=1,"�";if(t.lastNeed>2&&e.length>2&&128!=(192&e[2]))return t.lastNeed=2,"�"}}(this,t);return void 0!==r?r:this.lastNeed<=t.length?(t.copy(this.lastChar,e,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal)):(t.copy(this.lastChar,e,0,t.length),void(this.lastNeed-=t.length))}function s(t,e){if((t.length-e)%2==0){var r=t.toString("utf16le",e);if(r){var i=r.charCodeAt(r.length-1);if(i>=55296&&i<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=t[t.length-2],this.lastChar[1]=t[t.length-1],r.slice(0,-1)}return r}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=t[t.length-1],t.toString("utf16le",e,t.length-1)}function o(t){var e=t&&t.length?this.write(t):"";if(this.lastNeed){var r=this.lastTotal-this.lastNeed;return e+this.lastChar.toString("utf16le",0,r)}return e}function a(t,e){var r=(t.length-e)%3;return 0===r?t.toString("base64",e):(this.lastNeed=3-r,this.lastTotal=3,1===r?this.lastChar[0]=t[t.length-1]:(this.lastChar[0]=t[t.length-2],this.lastChar[1]=t[t.length-1]),t.toString("base64",e,t.length-r))}function l(t){var e=t&&t.length?this.write(t):"";return this.lastNeed?e+this.lastChar.toString("base64",0,3-this.lastNeed):e}function h(t){return t.toString(this.encoding)}function c(t){return t&&t.length?this.write(t):""}return G_.StringDecoder=r,r.prototype.write=function(t){if(0===t.length)return"";var e,r;if(this.lastNeed){if(void 0===(e=this.fillLast(t)))return"";r=this.lastNeed,this.lastNeed=0}else r=0;return r<t.length?e?e+this.text(t,r):this.text(t,r):e||""},r.prototype.end=function(t){var e=t&&t.length?this.write(t):"";return this.lastNeed?e+"�":e},r.prototype.text=function(t,e){var r=function(t,e,r){var n=e.length-1;if(n<r)return 0;var s=i(e[n]);if(s>=0)return s>0&&(t.lastNeed=s-1),s;if(--n<r||-2===s)return 0;if(s=i(e[n]),s>=0)return s>0&&(t.lastNeed=s-2),s;if(--n<r||-2===s)return 0;if(s=i(e[n]),s>=0)return s>0&&(2===s?s=0:t.lastNeed=s-3),s;return 0}(this,t,e);if(!this.lastNeed)return t.toString("utf8",e);this.lastTotal=r;var n=t.length-(r-this.lastNeed);return t.copy(this.lastChar,0,n),t.toString("utf8",e,n)},r.prototype.fillLast=function(t){if(this.lastNeed<=t.length)return t.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);t.copy(this.lastChar,this.lastTotal-this.lastNeed,0,t.length),this.lastNeed-=t.length},G_}function Y_(){if(z_)return j_;z_=1;var t=c_();j_=y;var e,r=function(){if(e_)return t_;e_=1;var t={}.toString;return t_=Array.isArray||function(e){return"[object Array]"==t.call(e)}}();y.ReadableState=m,s.EventEmitter;var i=function(t,e){return t.listeners(e).length},n=u_(),o=f_().Buffer,l=(void 0!==dt?dt:"undefined"!=typeof window?window:"undefined"!=typeof self?self:{}).Uint8Array||function(){};var h=Object.create(y_());h.inherits=x_();var c=a,u=void 0;u=c&&c.debuglog?c.debuglog("stream"):function(){};var d,p=P_(),f=D_();h.inherits(y,n);var g=["error","close","destroy","pause","resume"];function m(t,r){t=t||{};var i=r instanceof(e=e||N_());this.objectMode=!!t.objectMode,i&&(this.objectMode=this.objectMode||!!t.readableObjectMode);var n=t.highWaterMark,s=t.readableHighWaterMark,o=this.objectMode?16:16384;this.highWaterMark=n||0===n?n:i&&(s||0===s)?s:o,this.highWaterMark=Math.floor(this.highWaterMark),this.buffer=new p,this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this.destroyed=!1,this.defaultEncoding=t.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,t.encoding&&(d||(d=X_().StringDecoder),this.decoder=new d(t.encoding),this.encoding=t.encoding)}function y(t){if(e=e||N_(),!(this instanceof y))return new y(t);this._readableState=new m(t,this),this.readable=!0,t&&("function"==typeof t.read&&(this._read=t.read),"function"==typeof t.destroy&&(this._destroy=t.destroy)),n.call(this)}function v(t,e,r,i,n){var s,a=t._readableState;null===e?(a.reading=!1,function(t,e){if(e.ended)return;if(e.decoder){var r=e.decoder.end();r&&r.length&&(e.buffer.push(r),e.length+=e.objectMode?1:r.length)}e.ended=!0,x(t)}(t,a)):(n||(s=function(t,e){var r;i=e,o.isBuffer(i)||i instanceof l||"string"==typeof e||void 0===e||t.objectMode||(r=new TypeError("Invalid non-string/buffer chunk"));var i;return r}(a,e)),s?t.emit("error",s):a.objectMode||e&&e.length>0?("string"==typeof e||a.objectMode||Object.getPrototypeOf(e)===o.prototype||(e=function(t){return o.from(t)}(e)),i?a.endEmitted?t.emit("error",new Error("stream.unshift() after end event")):b(t,a,e,!0):a.ended?t.emit("error",new Error("stream.push() after EOF")):(a.reading=!1,a.decoder&&!r?(e=a.decoder.write(e),a.objectMode||0!==e.length?b(t,a,e,!1):T(t,a)):b(t,a,e,!1))):i||(a.reading=!1));return function(t){return!t.ended&&(t.needReadable||t.length<t.highWaterMark||0===t.length)}(a)}function b(t,e,r,i){e.flowing&&0===e.length&&!e.sync?(t.emit("data",r),t.read(0)):(e.length+=e.objectMode?1:r.length,i?e.buffer.unshift(r):e.buffer.push(r),e.needReadable&&x(t)),T(t,e)}Object.defineProperty(y.prototype,"destroyed",{get:function(){return void 0!==this._readableState&&this._readableState.destroyed},set:function(t){this._readableState&&(this._readableState.destroyed=t)}}),y.prototype.destroy=f.destroy,y.prototype._undestroy=f.undestroy,y.prototype._destroy=function(t,e){this.push(null),e(t)},y.prototype.push=function(t,e){var r,i=this._readableState;return i.objectMode?r=!0:"string"==typeof t&&((e=e||i.defaultEncoding)!==i.encoding&&(t=o.from(t,e),e=""),r=!0),v(this,t,e,!1,r)},y.prototype.unshift=function(t){return v(this,t,null,!0,!1)},y.prototype.isPaused=function(){return!1===this._readableState.flowing},y.prototype.setEncoding=function(t){return d||(d=X_().StringDecoder),this._readableState.decoder=new d(t),this._readableState.encoding=t,this};var _=8388608;function w(t,e){return t<=0||0===e.length&&e.ended?0:e.objectMode?1:t!=t?e.flowing&&e.length?e.buffer.head.data.length:e.length:(t>e.highWaterMark&&(e.highWaterMark=function(t){return t>=_?t=_:(t--,t|=t>>>1,t|=t>>>2,t|=t>>>4,t|=t>>>8,t|=t>>>16,t++),t}(t)),t<=e.length?t:e.ended?e.length:(e.needReadable=!0,0))}function x(e){var r=e._readableState;r.needReadable=!1,r.emittedReadable||(u("emitReadable",r.flowing),r.emittedReadable=!0,r.sync?t.nextTick(S,e):S(e))}function S(t){u("emit readable"),t.emit("readable"),A(t)}function T(e,r){r.readingMore||(r.readingMore=!0,t.nextTick(k,e,r))}function k(t,e){for(var r=e.length;!e.reading&&!e.flowing&&!e.ended&&e.length<e.highWaterMark&&(u("maybeReadMore read 0"),t.read(0),r!==e.length);)r=e.length;e.readingMore=!1}function C(t){u("readable nexttick read 0"),t.read(0)}function E(t,e){e.reading||(u("resume read 0"),t.read(0)),e.resumeScheduled=!1,e.awaitDrain=0,t.emit("resume"),A(t),e.flowing&&!e.reading&&t.read(0)}function A(t){var e=t._readableState;for(u("flow",e.flowing);e.flowing&&null!==t.read(););}function O(t,e){return 0===e.length?null:(e.objectMode?r=e.buffer.shift():!t||t>=e.length?(r=e.decoder?e.buffer.join(""):1===e.buffer.length?e.buffer.head.data:e.buffer.concat(e.length),e.buffer.clear()):r=function(t,e,r){var i;t<e.head.data.length?(i=e.head.data.slice(0,t),e.head.data=e.head.data.slice(t)):i=t===e.head.data.length?e.shift():r?function(t,e){var r=e.head,i=1,n=r.data;t-=n.length;for(;r=r.next;){var s=r.data,o=t>s.length?s.length:t;if(o===s.length?n+=s:n+=s.slice(0,t),0===(t-=o)){o===s.length?(++i,r.next?e.head=r.next:e.head=e.tail=null):(e.head=r,r.data=s.slice(o));break}++i}return e.length-=i,n}(t,e):function(t,e){var r=o.allocUnsafe(t),i=e.head,n=1;i.data.copy(r),t-=i.data.length;for(;i=i.next;){var s=i.data,a=t>s.length?s.length:t;if(s.copy(r,r.length-t,0,a),0===(t-=a)){a===s.length?(++n,i.next?e.head=i.next:e.head=e.tail=null):(e.head=i,i.data=s.slice(a));break}++n}return e.length-=n,r}(t,e);return i}(t,e.buffer,e.decoder),r);var r}function B(e){var r=e._readableState;if(r.length>0)throw new Error('"endReadable()" called on non-empty stream');r.endEmitted||(r.ended=!0,t.nextTick(R,r,e))}function R(t,e){t.endEmitted||0!==t.length||(t.endEmitted=!0,e.readable=!1,e.emit("end"))}function L(t,e){for(var r=0,i=t.length;r<i;r++)if(t[r]===e)return r;return-1}return y.prototype.read=function(t){u("read",t),t=parseInt(t,10);var e=this._readableState,r=t;if(0!==t&&(e.emittedReadable=!1),0===t&&e.needReadable&&(e.length>=e.highWaterMark||e.ended))return u("read: emitReadable",e.length,e.ended),0===e.length&&e.ended?B(this):x(this),null;if(0===(t=w(t,e))&&e.ended)return 0===e.length&&B(this),null;var i,n=e.needReadable;return u("need readable",n),(0===e.length||e.length-t<e.highWaterMark)&&u("length less than watermark",n=!0),e.ended||e.reading?u("reading or ended",n=!1):n&&(u("do read"),e.reading=!0,e.sync=!0,0===e.length&&(e.needReadable=!0),this._read(e.highWaterMark),e.sync=!1,e.reading||(t=w(r,e))),null===(i=t>0?O(t,e):null)?(e.needReadable=!0,t=0):e.length-=t,0===e.length&&(e.ended||(e.needReadable=!0),r!==t&&e.ended&&B(this)),null!==i&&this.emit("data",i),i},y.prototype._read=function(t){this.emit("error",new Error("_read() is not implemented"))},y.prototype.pipe=function(e,n){var s=this,o=this._readableState;switch(o.pipesCount){case 0:o.pipes=e;break;case 1:o.pipes=[o.pipes,e];break;default:o.pipes.push(e)}o.pipesCount+=1,u("pipe count=%d opts=%j",o.pipesCount,n);var a=(!n||!1!==n.end)&&e!==process.stdout&&e!==process.stderr?h:v;function l(t,r){u("onunpipe"),t===s&&r&&!1===r.hasUnpiped&&(r.hasUnpiped=!0,u("cleanup"),e.removeListener("close",m),e.removeListener("finish",y),e.removeListener("drain",c),e.removeListener("error",g),e.removeListener("unpipe",l),s.removeListener("end",h),s.removeListener("end",v),s.removeListener("data",f),d=!0,!o.awaitDrain||e._writableState&&!e._writableState.needDrain||c())}function h(){u("onend"),e.end()}o.endEmitted?t.nextTick(a):s.once("end",a),e.on("unpipe",l);var c=function(t){return function(){var e=t._readableState;u("pipeOnDrain",e.awaitDrain),e.awaitDrain&&e.awaitDrain--,0===e.awaitDrain&&i(t,"data")&&(e.flowing=!0,A(t))}}(s);e.on("drain",c);var d=!1;var p=!1;function f(t){u("ondata"),p=!1,!1!==e.write(t)||p||((1===o.pipesCount&&o.pipes===e||o.pipesCount>1&&-1!==L(o.pipes,e))&&!d&&(u("false write response, pause",o.awaitDrain),o.awaitDrain++,p=!0),s.pause())}function g(t){u("onerror",t),v(),e.removeListener("error",g),0===i(e,"error")&&e.emit("error",t)}function m(){e.removeListener("finish",y),v()}function y(){u("onfinish"),e.removeListener("close",m),v()}function v(){u("unpipe"),s.unpipe(e)}return s.on("data",f),function(t,e,i){if("function"==typeof t.prependListener)return t.prependListener(e,i);t._events&&t._events[e]?r(t._events[e])?t._events[e].unshift(i):t._events[e]=[i,t._events[e]]:t.on(e,i)}(e,"error",g),e.once("close",m),e.once("finish",y),e.emit("pipe",s),o.flowing||(u("pipe resume"),s.resume()),e},y.prototype.unpipe=function(t){var e=this._readableState,r={hasUnpiped:!1};if(0===e.pipesCount)return this;if(1===e.pipesCount)return t&&t!==e.pipes||(t||(t=e.pipes),e.pipes=null,e.pipesCount=0,e.flowing=!1,t&&t.emit("unpipe",this,r)),this;if(!t){var i=e.pipes,n=e.pipesCount;e.pipes=null,e.pipesCount=0,e.flowing=!1;for(var s=0;s<n;s++)i[s].emit("unpipe",this,{hasUnpiped:!1});return this}var o=L(e.pipes,t);return-1===o||(e.pipes.splice(o,1),e.pipesCount-=1,1===e.pipesCount&&(e.pipes=e.pipes[0]),t.emit("unpipe",this,r)),this},y.prototype.on=function(e,r){var i=n.prototype.on.call(this,e,r);if("data"===e)!1!==this._readableState.flowing&&this.resume();else if("readable"===e){var s=this._readableState;s.endEmitted||s.readableListening||(s.readableListening=s.needReadable=!0,s.emittedReadable=!1,s.reading?s.length&&x(this):t.nextTick(C,this))}return i},y.prototype.addListener=y.prototype.on,y.prototype.resume=function(){var e=this._readableState;return e.flowing||(u("resume"),e.flowing=!0,function(e,r){r.resumeScheduled||(r.resumeScheduled=!0,t.nextTick(E,e,r))}(this,e)),this},y.prototype.pause=function(){return u("call pause flowing=%j",this._readableState.flowing),!1!==this._readableState.flowing&&(u("pause"),this._readableState.flowing=!1,this.emit("pause")),this},y.prototype.wrap=function(t){var e=this,r=this._readableState,i=!1;for(var n in t.on("end",(function(){if(u("wrapped end"),r.decoder&&!r.ended){var t=r.decoder.end();t&&t.length&&e.push(t)}e.push(null)})),t.on("data",(function(n){(u("wrapped data"),r.decoder&&(n=r.decoder.write(n)),r.objectMode&&null==n)||(r.objectMode||n&&n.length)&&(e.push(n)||(i=!0,t.pause()))})),t)void 0===this[n]&&"function"==typeof t[n]&&(this[n]=function(e){return function(){return t[e].apply(t,arguments)}}(n));for(var s=0;s<g.length;s++)t.on(g[s],this.emit.bind(this,g[s]));return this._read=function(e){u("wrapped _read",e),i&&(i=!1,t.resume())},this},Object.defineProperty(y.prototype,"readableHighWaterMark",{enumerable:!1,get:function(){return this._readableState.highWaterMark}}),y._fromList=O,j_}function q_(){if(W_)return H_;W_=1,H_=i;var t=N_(),e=Object.create(y_());function r(t,e){var r=this._transformState;r.transforming=!1;var i=r.writecb;if(!i)return this.emit("error",new Error("write callback called multiple times"));r.writechunk=null,r.writecb=null,null!=e&&this.push(e),i(t);var n=this._readableState;n.reading=!1,(n.needReadable||n.length<n.highWaterMark)&&this._read(n.highWaterMark)}function i(e){if(!(this instanceof i))return new i(e);t.call(this,e),this._transformState={afterTransform:r.bind(this),needTransform:!1,transforming:!1,writecb:null,writechunk:null,writeencoding:null},this._readableState.needReadable=!0,this._readableState.sync=!1,e&&("function"==typeof e.transform&&(this._transform=e.transform),"function"==typeof e.flush&&(this._flush=e.flush)),this.on("prefinish",n)}function n(){var t=this;"function"==typeof this._flush?this._flush((function(e,r){s(t,e,r)})):s(this,null,null)}function s(t,e,r){if(e)return t.emit("error",e);if(null!=r&&t.push(r),t._writableState.length)throw new Error("Calling transform done when ws.length != 0");if(t._transformState.transforming)throw new Error("Calling transform done when still transforming");return t.push(null)}return e.inherits=x_(),e.inherits(i,t),i.prototype.push=function(e,r){return this._transformState.needTransform=!1,t.prototype.push.call(this,e,r)},i.prototype._transform=function(t,e,r){throw new Error("_transform() is not implemented")},i.prototype._write=function(t,e,r){var i=this._transformState;if(i.writecb=r,i.writechunk=t,i.writeencoding=e,!i.transforming){var n=this._readableState;(i.needTransform||n.needReadable||n.length<n.highWaterMark)&&this._read(n.highWaterMark)}},i.prototype._read=function(t){var e=this._transformState;null!==e.writechunk&&e.writecb&&!e.transforming?(e.transforming=!0,this._transform(e.writechunk,e.writeencoding,e.afterTransform)):e.needTransform=!0},i.prototype._destroy=function(e,r){var i=this;t.prototype._destroy.call(this,e,(function(t){r(t),i.emit("close")}))},H_}function Z_(){return V_||(V_=1,function(t,e){var r=n;"disable"===process.env.READABLE_STREAM&&r?(t.exports=r,(e=t.exports=r.Readable).Readable=r.Readable,e.Writable=r.Writable,e.Duplex=r.Duplex,e.Transform=r.Transform,e.PassThrough=r.PassThrough,e.Stream=r):((e=t.exports=Y_()).Stream=r||e,e.Readable=e,e.Writable=I_(),e.Duplex=N_(),e.Transform=q_(),e.PassThrough=function(){if($_)return U_;$_=1,U_=r;var t=q_(),e=Object.create(y_());function r(e){if(!(this instanceof r))return new r(e);t.call(this,e)}return e.inherits=x_(),e.inherits(r,t),r.prototype._transform=function(t,e,r){r(null,t)},U_}())}(l_,l_.exports)),l_.exports}if(a_.base64=!0,a_.array=!0,a_.string=!0,a_.arraybuffer="undefined"!=typeof ArrayBuffer&&"undefined"!=typeof Uint8Array,a_.nodebuffer="undefined"!=typeof Buffer,a_.uint8array="undefined"!=typeof Uint8Array,"undefined"==typeof ArrayBuffer)a_.blob=!1;else{var K_=new ArrayBuffer(0);try{a_.blob=0===new Blob([K_],{type:"application/zip"}).size}catch(t){try{var Q_=new(self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder);Q_.append(K_),a_.blob=0===Q_.getBlob("application/zip").size}catch(t){a_.blob=!1}}}try{a_.nodestream=!!Z_().Readable}catch(t){a_.nodestream=!1}var J_,tw={};function ew(){if(J_)return tw;J_=1;var t=cw(),e=a_,r="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";return tw.encode=function(e){for(var i,n,s,o,a,l,h,c=[],u=0,d=e.length,p=d,f="string"!==t.getTypeOf(e);u<e.length;)p=d-u,f?(i=e[u++],n=u<d?e[u++]:0,s=u<d?e[u++]:0):(i=e.charCodeAt(u++),n=u<d?e.charCodeAt(u++):0,s=u<d?e.charCodeAt(u++):0),o=i>>2,a=(3&i)<<4|n>>4,l=p>1?(15&n)<<2|s>>6:64,h=p>2?63&s:64,c.push(r.charAt(o)+r.charAt(a)+r.charAt(l)+r.charAt(h));return c.join("")},tw.decode=function(t){var i,n,s,o,a,l,h=0,c=0,u="data:";if(t.substr(0,5)===u)throw new Error("Invalid base64 input, it looks like a data url.");var d,p=3*(t=t.replace(/[^A-Za-z0-9+/=]/g,"")).length/4;if(t.charAt(t.length-1)===r.charAt(64)&&p--,t.charAt(t.length-2)===r.charAt(64)&&p--,p%1!=0)throw new Error("Invalid base64 input, bad content length.");for(d=e.uint8array?new Uint8Array(0|p):new Array(0|p);h<t.length;)i=r.indexOf(t.charAt(h++))<<2|(o=r.indexOf(t.charAt(h++)))>>4,n=(15&o)<<4|(a=r.indexOf(t.charAt(h++)))>>2,s=(3&a)<<6|(l=r.indexOf(t.charAt(h++))),d[c++]=i,64!==a&&(d[c++]=n),64!==l&&(d[c++]=s);return d},tw}var rw,iw,nw,sw,ow={isNode:"undefined"!=typeof Buffer,newBufferFrom:function(t,e){if(Buffer.from&&Buffer.from!==Uint8Array.from)return Buffer.from(t,e);if("number"==typeof t)throw new Error('The "data" argument must not be a number');return new Buffer(t,e)},allocBuffer:function(t){if(Buffer.alloc)return Buffer.alloc(t);var e=new Buffer(t);return e.fill(0),e},isBuffer:function(t){return Buffer.isBuffer(t)},isStream:function(t){return t&&"function"==typeof t.on&&"function"==typeof t.pause&&"function"==typeof t.resume}};var aw=null;aw="undefined"!=typeof Promise?Promise:function(){if(sw)return nw;sw=1;var t=function(){if(iw)return rw;iw=1;var t,e,r=dt.MutationObserver||dt.WebKitMutationObserver;if(process.browser)if(r){var i=0,n=new r(l),s=dt.document.createTextNode("");n.observe(s,{characterData:!0}),t=function(){s.data=i=++i%2}}else if(dt.setImmediate||void 0===dt.MessageChannel)t="document"in dt&&"onreadystatechange"in dt.document.createElement("script")?function(){var t=dt.document.createElement("script");t.onreadystatechange=function(){l(),t.onreadystatechange=null,t.parentNode.removeChild(t),t=null},dt.document.documentElement.appendChild(t)}:function(){setTimeout(l,0)};else{var o=new dt.MessageChannel;o.port1.onmessage=l,t=function(){o.port2.postMessage(0)}}else t=function(){process.nextTick(l)};var a=[];function l(){var t,r;e=!0;for(var i=a.length;i;){for(r=a,a=[],t=-1;++t<i;)r[t]();i=a.length}e=!1}return rw=function(r){1!==a.push(r)||e||t()}}();function e(){}var r={},i=["REJECTED"],n=["FULFILLED"],s=["PENDING"];if(!process.browser)var o=["UNHANDLED"];function a(t){if("function"!=typeof t)throw new TypeError("resolver must be a function");this.state=s,this.queue=[],this.outcome=void 0,process.browser||(this.handled=o),t!==e&&u(this,t)}function l(t,e,r){this.promise=t,"function"==typeof e&&(this.onFulfilled=e,this.callFulfilled=this.otherCallFulfilled),"function"==typeof r&&(this.onRejected=r,this.callRejected=this.otherCallRejected)}function h(e,i,n){t((function(){var t;try{t=i(n)}catch(t){return r.reject(e,t)}t===e?r.reject(e,new TypeError("Cannot resolve promise with itself")):r.resolve(e,t)}))}function c(t){var e=t&&t.then;if(t&&("object"==typeof t||"function"==typeof t)&&"function"==typeof e)return function(){e.apply(t,arguments)}}function u(t,e){var i=!1;function n(e){i||(i=!0,r.reject(t,e))}function s(e){i||(i=!0,r.resolve(t,e))}var o=d((function(){e(s,n)}));"error"===o.status&&n(o.value)}function d(t,e){var r={};try{r.value=t(e),r.status="success"}catch(t){r.status="error",r.value=t}return r}return nw=a,a.prototype.finally=function(t){if("function"!=typeof t)return this;var e=this.constructor;return this.then((function(r){return e.resolve(t()).then((function(){return r}))}),(function(r){return e.resolve(t()).then((function(){throw r}))}))},a.prototype.catch=function(t){return this.then(null,t)},a.prototype.then=function(t,r){if("function"!=typeof t&&this.state===n||"function"!=typeof r&&this.state===i)return this;var a=new this.constructor(e);return process.browser||this.handled===o&&(this.handled=null),this.state!==s?h(a,this.state===n?t:r,this.outcome):this.queue.push(new l(a,t,r)),a},l.prototype.callFulfilled=function(t){r.resolve(this.promise,t)},l.prototype.otherCallFulfilled=function(t){h(this.promise,this.onFulfilled,t)},l.prototype.callRejected=function(t){r.reject(this.promise,t)},l.prototype.otherCallRejected=function(t){h(this.promise,this.onRejected,t)},r.resolve=function(t,e){var i=d(c,e);if("error"===i.status)return r.reject(t,i.value);var s=i.value;if(s)u(t,s);else{t.state=n,t.outcome=e;for(var o=-1,a=t.queue.length;++o<a;)t.queue[o].callFulfilled(e)}return t},r.reject=function(e,r){e.state=i,e.outcome=r,process.browser||e.handled===o&&t((function(){e.handled===o&&process.emit("unhandledRejection",r,e)}));for(var n=-1,s=e.queue.length;++n<s;)e.queue[n].callRejected(r);return e},a.resolve=function(t){return t instanceof this?t:r.resolve(new this(e),t)},a.reject=function(t){var i=new this(e);return r.reject(i,t)},a.all=function(t){var i=this;if("[object Array]"!==Object.prototype.toString.call(t))return this.reject(new TypeError("must be an array"));var n=t.length,s=!1;if(!n)return this.resolve([]);for(var o=new Array(n),a=0,l=-1,h=new this(e);++l<n;)c(t[l],l);return h;function c(t,e){i.resolve(t).then((function(t){o[e]=t,++a!==n||s||(s=!0,r.resolve(h,o))}),(function(t){s||(s=!0,r.reject(h,t))}))}},a.race=function(t){var i=this;if("[object Array]"!==Object.prototype.toString.call(t))return this.reject(new TypeError("must be an array"));var n=t.length,s=!1;if(!n)return this.resolve([]);for(var o,a=-1,l=new this(e);++a<n;)o=t[a],i.resolve(o).then((function(t){s||(s=!0,r.resolve(l,t))}),(function(t){s||(s=!0,r.reject(l,t))}));return l},nw}();var lw,hw={Promise:aw};function cw(){return lw||(lw=1,function(t){var e=a_,r=ew(),i=ow,n=hw;function s(t){return t}function o(t,e){for(var r=0;r<t.length;++r)e[r]=255&t.charCodeAt(r);return e}t.newBlob=function(e,r){t.checkSupport("blob");try{return new Blob([e],{type:r})}catch(t){try{var i=new(self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder);return i.append(e),i.getBlob(r)}catch(t){throw new Error("Bug : can't construct the Blob.")}}};var a={stringifyByChunk:function(t,e,r){var i=[],n=0,s=t.length;if(s<=r)return String.fromCharCode.apply(null,t);for(;n<s;)"array"===e||"nodebuffer"===e?i.push(String.fromCharCode.apply(null,t.slice(n,Math.min(n+r,s)))):i.push(String.fromCharCode.apply(null,t.subarray(n,Math.min(n+r,s)))),n+=r;return i.join("")},stringifyByChar:function(t){for(var e="",r=0;r<t.length;r++)e+=String.fromCharCode(t[r]);return e},applyCanBeUsed:{uint8array:function(){try{return e.uint8array&&1===String.fromCharCode.apply(null,new Uint8Array(1)).length}catch(t){return!1}}(),nodebuffer:function(){try{return e.nodebuffer&&1===String.fromCharCode.apply(null,i.allocBuffer(1)).length}catch(t){return!1}}()}};function l(e){var r=65536,i=t.getTypeOf(e),n=!0;if("uint8array"===i?n=a.applyCanBeUsed.uint8array:"nodebuffer"===i&&(n=a.applyCanBeUsed.nodebuffer),n)for(;r>1;)try{return a.stringifyByChunk(e,i,r)}catch(t){r=Math.floor(r/2)}return a.stringifyByChar(e)}function h(t,e){for(var r=0;r<t.length;r++)e[r]=t[r];return e}t.applyFromCharCode=l;var c={};c.string={string:s,array:function(t){return o(t,new Array(t.length))},arraybuffer:function(t){return c.string.uint8array(t).buffer},uint8array:function(t){return o(t,new Uint8Array(t.length))},nodebuffer:function(t){return o(t,i.allocBuffer(t.length))}},c.array={string:l,array:s,arraybuffer:function(t){return new Uint8Array(t).buffer},uint8array:function(t){return new Uint8Array(t)},nodebuffer:function(t){return i.newBufferFrom(t)}},c.arraybuffer={string:function(t){return l(new Uint8Array(t))},array:function(t){return h(new Uint8Array(t),new Array(t.byteLength))},arraybuffer:s,uint8array:function(t){return new Uint8Array(t)},nodebuffer:function(t){return i.newBufferFrom(new Uint8Array(t))}},c.uint8array={string:l,array:function(t){return h(t,new Array(t.length))},arraybuffer:function(t){return t.buffer},uint8array:s,nodebuffer:function(t){return i.newBufferFrom(t)}},c.nodebuffer={string:l,array:function(t){return h(t,new Array(t.length))},arraybuffer:function(t){return c.nodebuffer.uint8array(t).buffer},uint8array:function(t){return h(t,new Uint8Array(t.length))},nodebuffer:s},t.transformTo=function(e,r){if(r||(r=""),!e)return r;t.checkSupport(e);var i=t.getTypeOf(r);return c[i][e](r)},t.resolve=function(t){for(var e=t.split("/"),r=[],i=0;i<e.length;i++){var n=e[i];"."===n||""===n&&0!==i&&i!==e.length-1||(".."===n?r.pop():r.push(n))}return r.join("/")},t.getTypeOf=function(t){return"string"==typeof t?"string":"[object Array]"===Object.prototype.toString.call(t)?"array":e.nodebuffer&&i.isBuffer(t)?"nodebuffer":e.uint8array&&t instanceof Uint8Array?"uint8array":e.arraybuffer&&t instanceof ArrayBuffer?"arraybuffer":void 0},t.checkSupport=function(t){if(!e[t.toLowerCase()])throw new Error(t+" is not supported by this platform")},t.MAX_VALUE_16BITS=65535,t.MAX_VALUE_32BITS=-1,t.pretty=function(t){var e,r,i="";for(r=0;r<(t||"").length;r++)i+="\\x"+((e=t.charCodeAt(r))<16?"0":"")+e.toString(16).toUpperCase();return i},t.delay=function(t,e,r){setImmediate((function(){t.apply(r||null,e||[])}))},t.inherits=function(t,e){var r=function(){};r.prototype=e.prototype,t.prototype=new r},t.extend=function(){var t,e,r={};for(t=0;t<arguments.length;t++)for(e in arguments[t])Object.prototype.hasOwnProperty.call(arguments[t],e)&&void 0===r[e]&&(r[e]=arguments[t][e]);return r},t.prepareContent=function(i,s,a,l,h){var c=n.Promise.resolve(s).then((function(t){return e.blob&&(t instanceof Blob||-1!==["[object File]","[object Blob]"].indexOf(Object.prototype.toString.call(t)))&&"undefined"!=typeof FileReader?new n.Promise((function(e,r){var i=new FileReader;i.onload=function(t){e(t.target.result)},i.onerror=function(t){r(t.target.error)},i.readAsArrayBuffer(t)})):t}));return c.then((function(s){var c,u=t.getTypeOf(s);return u?("arraybuffer"===u?s=t.transformTo("uint8array",s):"string"===u&&(h?s=r.decode(s):a&&!0!==l&&(s=o(c=s,e.uint8array?new Uint8Array(c.length):new Array(c.length)))),s):n.Promise.reject(new Error("Can't read the data of '"+i+"'. Is it in a supported JavaScript type (String, Blob, ArrayBuffer, etc) ?"))}))}}(o_)),o_}function uw(t){this.name=t||"default",this.streamInfo={},this.generatedError=null,this.extraStreamInfo={},this.isPaused=!0,this.isFinished=!1,this.isLocked=!1,this._listeners={data:[],end:[],error:[]},this.previous=null}!function(t,e){if(!t.setImmediate){var r,i,n,s,o,a=1,l={},h=!1,c=t.document,u=Object.getPrototypeOf&&Object.getPrototypeOf(t);u=u&&u.setTimeout?u:t,"[object process]"==={}.toString.call(t.process)?r=function(t){process.nextTick((function(){p(t)}))}:!function(){if(t.postMessage&&!t.importScripts){var e=!0,r=t.onmessage;return t.onmessage=function(){e=!1},t.postMessage("","*"),t.onmessage=r,e}}()?t.MessageChannel?((n=new MessageChannel).port1.onmessage=function(t){p(t.data)},r=function(t){n.port2.postMessage(t)}):c&&"onreadystatechange"in c.createElement("script")?(i=c.documentElement,r=function(t){var e=c.createElement("script");e.onreadystatechange=function(){p(t),e.onreadystatechange=null,i.removeChild(e),e=null},i.appendChild(e)}):r=function(t){setTimeout(p,0,t)}:(s="setImmediate$"+Math.random()+"$",o=function(e){e.source===t&&"string"==typeof e.data&&0===e.data.indexOf(s)&&p(+e.data.slice(s.length))},t.addEventListener?t.addEventListener("message",o,!1):t.attachEvent("onmessage",o),r=function(e){t.postMessage(s+e,"*")}),u.setImmediate=function(t){"function"!=typeof t&&(t=new Function(""+t));for(var e=new Array(arguments.length-1),i=0;i<e.length;i++)e[i]=arguments[i+1];var n={callback:t,args:e};return l[a]=n,r(a),a++},u.clearImmediate=d}function d(t){delete l[t]}function p(t){if(h)setTimeout(p,0,t);else{var r=l[t];if(r){h=!0;try{!function(t){var r=t.callback,i=t.args;switch(i.length){case 0:r();break;case 1:r(i[0]);break;case 2:r(i[0],i[1]);break;case 3:r(i[0],i[1],i[2]);break;default:r.apply(e,i)}}(r)}finally{d(t),h=!1}}}}}("undefined"==typeof self?dt:self),uw.prototype={push:function(t){this.emit("data",t)},end:function(){if(this.isFinished)return!1;this.flush();try{this.emit("end"),this.cleanUp(),this.isFinished=!0}catch(t){this.emit("error",t)}return!0},error:function(t){return!this.isFinished&&(this.isPaused?this.generatedError=t:(this.isFinished=!0,this.emit("error",t),this.previous&&this.previous.error(t),this.cleanUp()),!0)},on:function(t,e){return this._listeners[t].push(e),this},cleanUp:function(){this.streamInfo=this.generatedError=this.extraStreamInfo=null,this._listeners=[]},emit:function(t,e){if(this._listeners[t])for(var r=0;r<this._listeners[t].length;r++)this._listeners[t][r].call(this,e)},pipe:function(t){return t.registerPrevious(this)},registerPrevious:function(t){if(this.isLocked)throw new Error("The stream '"+this+"' has already been used.");this.streamInfo=t.streamInfo,this.mergeStreamInfo(),this.previous=t;var e=this;return t.on("data",(function(t){e.processChunk(t)})),t.on("end",(function(){e.end()})),t.on("error",(function(t){e.error(t)})),this},pause:function(){return!this.isPaused&&!this.isFinished&&(this.isPaused=!0,this.previous&&this.previous.pause(),!0)},resume:function(){if(!this.isPaused||this.isFinished)return!1;this.isPaused=!1;var t=!1;return this.generatedError&&(this.error(this.generatedError),t=!0),this.previous&&this.previous.resume(),!t},flush:function(){},processChunk:function(t){this.push(t)},withStreamInfo:function(t,e){return this.extraStreamInfo[t]=e,this.mergeStreamInfo(),this},mergeStreamInfo:function(){for(var t in this.extraStreamInfo)Object.prototype.hasOwnProperty.call(this.extraStreamInfo,t)&&(this.streamInfo[t]=this.extraStreamInfo[t])},lock:function(){if(this.isLocked)throw new Error("The stream '"+this+"' has already been used.");this.isLocked=!0,this.previous&&this.previous.lock()},toString:function(){var t="Worker "+this.name;return this.previous?this.previous+" -> "+t:t}};var dw=uw;!function(t){for(var e=cw(),r=a_,i=ow,n=dw,s=new Array(256),o=0;o<256;o++)s[o]=o>=252?6:o>=248?5:o>=240?4:o>=224?3:o>=192?2:1;s[254]=s[254]=1;function a(){n.call(this,"utf-8 decode"),this.leftOver=null}function l(){n.call(this,"utf-8 encode")}t.utf8encode=function(t){return r.nodebuffer?i.newBufferFrom(t,"utf-8"):function(t){var e,i,n,s,o,a=t.length,l=0;for(s=0;s<a;s++)55296==(64512&(i=t.charCodeAt(s)))&&s+1<a&&56320==(64512&(n=t.charCodeAt(s+1)))&&(i=65536+(i-55296<<10)+(n-56320),s++),l+=i<128?1:i<2048?2:i<65536?3:4;for(e=r.uint8array?new Uint8Array(l):new Array(l),o=0,s=0;o<l;s++)55296==(64512&(i=t.charCodeAt(s)))&&s+1<a&&56320==(64512&(n=t.charCodeAt(s+1)))&&(i=65536+(i-55296<<10)+(n-56320),s++),i<128?e[o++]=i:i<2048?(e[o++]=192|i>>>6,e[o++]=128|63&i):i<65536?(e[o++]=224|i>>>12,e[o++]=128|i>>>6&63,e[o++]=128|63&i):(e[o++]=240|i>>>18,e[o++]=128|i>>>12&63,e[o++]=128|i>>>6&63,e[o++]=128|63&i);return e}(t)},t.utf8decode=function(t){return r.nodebuffer?e.transformTo("nodebuffer",t).toString("utf-8"):function(t){var r,i,n,o,a=t.length,l=new Array(2*a);for(i=0,r=0;r<a;)if((n=t[r++])<128)l[i++]=n;else if((o=s[n])>4)l[i++]=65533,r+=o-1;else{for(n&=2===o?31:3===o?15:7;o>1&&r<a;)n=n<<6|63&t[r++],o--;o>1?l[i++]=65533:n<65536?l[i++]=n:(n-=65536,l[i++]=55296|n>>10&1023,l[i++]=56320|1023&n)}return l.length!==i&&(l.subarray?l=l.subarray(0,i):l.length=i),e.applyFromCharCode(l)}(t=e.transformTo(r.uint8array?"uint8array":"array",t))},e.inherits(a,n),a.prototype.processChunk=function(i){var n=e.transformTo(r.uint8array?"uint8array":"array",i.data);if(this.leftOver&&this.leftOver.length){if(r.uint8array){var o=n;(n=new Uint8Array(o.length+this.leftOver.length)).set(this.leftOver,0),n.set(o,this.leftOver.length)}else n=this.leftOver.concat(n);this.leftOver=null}var a=function(t,e){var r;for((e=e||t.length)>t.length&&(e=t.length),r=e-1;r>=0&&128==(192&t[r]);)r--;return r<0||0===r?e:r+s[t[r]]>e?r:e}(n),l=n;a!==n.length&&(r.uint8array?(l=n.subarray(0,a),this.leftOver=n.subarray(a,n.length)):(l=n.slice(0,a),this.leftOver=n.slice(a,n.length))),this.push({data:t.utf8decode(l),meta:i.meta})},a.prototype.flush=function(){this.leftOver&&this.leftOver.length&&(this.push({data:t.utf8decode(this.leftOver),meta:{}}),this.leftOver=null)},t.Utf8DecodeWorker=a,e.inherits(l,n),l.prototype.processChunk=function(e){this.push({data:t.utf8encode(e.data),meta:e.meta})},t.Utf8EncodeWorker=l}(s_);var pw=dw,fw=cw();function gw(t){pw.call(this,"ConvertWorker to "+t),this.destType=t}fw.inherits(gw,pw),gw.prototype.processChunk=function(t){this.push({data:fw.transformTo(this.destType,t.data),meta:t.meta})};var mw,yw,vw=gw;var bw=cw(),_w=vw,ww=dw,xw=ew(),Sw=hw,Tw=null;if(a_.nodestream)try{Tw=function(){if(yw)return mw;yw=1;var t=Z_().Readable;function e(e,r,i){t.call(this,r),this._helper=e;var n=this;e.on("data",(function(t,e){n.push(t)||n._helper.pause(),i&&i(e)})).on("error",(function(t){n.emit("error",t)})).on("end",(function(){n.push(null)}))}return cw().inherits(e,t),e.prototype._read=function(){this._helper.resume()},mw=e}()}catch(t){}function kw(t,e){return new Sw.Promise((function(r,i){var n=[],s=t._internalType,o=t._outputType,a=t._mimeType;t.on("data",(function(t,r){n.push(t),e&&e(r)})).on("error",(function(t){n=[],i(t)})).on("end",(function(){try{var t=function(t,e,r){switch(t){case"blob":return bw.newBlob(bw.transformTo("arraybuffer",e),r);case"base64":return xw.encode(e);default:return bw.transformTo(t,e)}}(o,function(t,e){var r,i=0,n=null,s=0;for(r=0;r<e.length;r++)s+=e[r].length;switch(t){case"string":return e.join("");case"array":return Array.prototype.concat.apply([],e);case"uint8array":for(n=new Uint8Array(s),r=0;r<e.length;r++)n.set(e[r],i),i+=e[r].length;return n;case"nodebuffer":return Buffer.concat(e);default:throw new Error("concat : unsupported type '"+t+"'")}}(s,n),a);r(t)}catch(t){i(t)}n=[]})).resume()}))}function Cw(t,e,r){var i=e;switch(e){case"blob":case"arraybuffer":i="uint8array";break;case"base64":i="string"}try{this._internalType=i,this._outputType=e,this._mimeType=r,bw.checkSupport(i),this._worker=t.pipe(new _w(i)),t.lock()}catch(t){this._worker=new ww("error"),this._worker.error(t)}}Cw.prototype={accumulate:function(t){return kw(this,t)},on:function(t,e){var r=this;return"data"===t?this._worker.on(t,(function(t){e.call(r,t.data,t.meta)})):this._worker.on(t,(function(){bw.delay(e,arguments,r)})),this},resume:function(){return bw.delay(this._worker.resume,[],this._worker),this},pause:function(){return this._worker.pause(),this},toNodejsStream:function(t){if(bw.checkSupport("nodestream"),"nodebuffer"!==this._outputType)throw new Error(this._outputType+" is not supported by this method");return new Tw(this,{objectMode:"nodebuffer"!==this._outputType},t)}};var Ew=Cw,Aw={base64:!1,binary:!1,dir:!1,createFolders:!0,date:null,compression:null,compressionOptions:null,comment:null,unixPermissions:null,dosPermissions:null},Ow=cw(),Bw=dw;function Rw(t){Bw.call(this,"DataWorker");var e=this;this.dataIsReady=!1,this.index=0,this.max=0,this.data=null,this.type="",this._tickScheduled=!1,t.then((function(t){e.dataIsReady=!0,e.data=t,e.max=t&&t.length||0,e.type=Ow.getTypeOf(t),e.isPaused||e._tickAndRepeat()}),(function(t){e.error(t)}))}Ow.inherits(Rw,Bw),Rw.prototype.cleanUp=function(){Bw.prototype.cleanUp.call(this),this.data=null},Rw.prototype.resume=function(){return!!Bw.prototype.resume.call(this)&&(!this._tickScheduled&&this.dataIsReady&&(this._tickScheduled=!0,Ow.delay(this._tickAndRepeat,[],this)),!0)},Rw.prototype._tickAndRepeat=function(){this._tickScheduled=!1,this.isPaused||this.isFinished||(this._tick(),this.isFinished||(Ow.delay(this._tickAndRepeat,[],this),this._tickScheduled=!0))},Rw.prototype._tick=function(){if(this.isPaused||this.isFinished)return!1;var t=null,e=Math.min(this.max,this.index+16384);if(this.index>=this.max)return this.end();switch(this.type){case"string":t=this.data.substring(this.index,e);break;case"uint8array":t=this.data.subarray(this.index,e);break;case"array":case"nodebuffer":t=this.data.slice(this.index,e)}return this.index=e,this.push({data:t,meta:{percent:this.max?this.index/this.max*100:0}})};var Lw=Rw,Pw=cw();var Dw=function(){for(var t,e=[],r=0;r<256;r++){t=r;for(var i=0;i<8;i++)t=1&t?3988292384^t>>>1:t>>>1;e[r]=t}return e}();var Mw=function(t,e){return void 0!==t&&t.length?"string"!==Pw.getTypeOf(t)?function(t,e,r,i){var n=Dw,s=i+r;t^=-1;for(var o=i;o<s;o++)t=t>>>8^n[255&(t^e[o])];return-1^t}(0|e,t,t.length,0):function(t,e,r,i){var n=Dw,s=i+r;t^=-1;for(var o=i;o<s;o++)t=t>>>8^n[255&(t^e.charCodeAt(o))];return-1^t}(0|e,t,t.length,0):0},Iw=dw,Nw=Mw;function Fw(){Iw.call(this,"Crc32Probe"),this.withStreamInfo("crc32",0)}cw().inherits(Fw,Iw),Fw.prototype.processChunk=function(t){this.streamInfo.crc32=Nw(t.data,this.streamInfo.crc32||0),this.push(t)};var jw=Fw,zw=cw(),Hw=dw;function Ww(t){Hw.call(this,"DataLengthProbe for "+t),this.propName=t,this.withStreamInfo(t,0)}zw.inherits(Ww,Hw),Ww.prototype.processChunk=function(t){if(t){var e=this.streamInfo[this.propName]||0;this.streamInfo[this.propName]=e+t.data.length}Hw.prototype.processChunk.call(this,t)};var Uw=hw,$w=Lw,Vw=jw,Gw=Ww;function Xw(t,e,r,i,n){this.compressedSize=t,this.uncompressedSize=e,this.crc32=r,this.compression=i,this.compressedContent=n}Xw.prototype={getContentWorker:function(){var t=new $w(Uw.Promise.resolve(this.compressedContent)).pipe(this.compression.uncompressWorker()).pipe(new Gw("data_length")),e=this;return t.on("end",(function(){if(this.streamInfo.data_length!==e.uncompressedSize)throw new Error("Bug : uncompressed data size mismatch")})),t},getCompressedWorker:function(){return new $w(Uw.Promise.resolve(this.compressedContent)).withStreamInfo("compressedSize",this.compressedSize).withStreamInfo("uncompressedSize",this.uncompressedSize).withStreamInfo("crc32",this.crc32).withStreamInfo("compression",this.compression)}},Xw.createWorkerFrom=function(t,e,r){return t.pipe(new Vw).pipe(new Gw("uncompressedSize")).pipe(e.compressWorker(r)).pipe(new Gw("compressedSize")).withStreamInfo("compression",e)};var Yw=Xw,qw=Ew,Zw=Lw,Kw=s_,Qw=Yw,Jw=dw,tx=function(t,e,r){this.name=t,this.dir=r.dir,this.date=r.date,this.comment=r.comment,this.unixPermissions=r.unixPermissions,this.dosPermissions=r.dosPermissions,this._data=e,this._dataBinary=r.binary,this.options={compression:r.compression,compressionOptions:r.compressionOptions}};tx.prototype={internalStream:function(t){var e=null,r="string";try{if(!t)throw new Error("No output type specified.");var i="string"===(r=t.toLowerCase())||"text"===r;"binarystring"!==r&&"text"!==r||(r="string"),e=this._decompressWorker();var n=!this._dataBinary;n&&!i&&(e=e.pipe(new Kw.Utf8EncodeWorker)),!n&&i&&(e=e.pipe(new Kw.Utf8DecodeWorker))}catch(t){(e=new Jw("error")).error(t)}return new qw(e,r,"")},async:function(t,e){return this.internalStream(t).accumulate(e)},nodeStream:function(t,e){return this.internalStream(t||"nodebuffer").toNodejsStream(e)},_compressWorker:function(t,e){if(this._data instanceof Qw&&this._data.compression.magic===t.magic)return this._data.getCompressedWorker();var r=this._decompressWorker();return this._dataBinary||(r=r.pipe(new Kw.Utf8EncodeWorker)),Qw.createWorkerFrom(r,t,e)},_decompressWorker:function(){return this._data instanceof Qw?this._data.getContentWorker():this._data instanceof Jw?this._data:new Zw(this._data)}};for(var ex=["asText","asBinary","asNodeBuffer","asUint8Array","asArrayBuffer"],rx=function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},ix=0;ix<ex.length;ix++)tx.prototype[ex[ix]]=rx;var nx=tx,sx={},ox={},ax={},lx={};!function(t){var e="undefined"!=typeof Uint8Array&&"undefined"!=typeof Uint16Array&&"undefined"!=typeof Int32Array;function r(t,e){return Object.prototype.hasOwnProperty.call(t,e)}t.assign=function(t){for(var e=Array.prototype.slice.call(arguments,1);e.length;){var i=e.shift();if(i){if("object"!=typeof i)throw new TypeError(i+"must be non-object");for(var n in i)r(i,n)&&(t[n]=i[n])}}return t},t.shrinkBuf=function(t,e){return t.length===e?t:t.subarray?t.subarray(0,e):(t.length=e,t)};var i={arraySet:function(t,e,r,i,n){if(e.subarray&&t.subarray)t.set(e.subarray(r,r+i),n);else for(var s=0;s<i;s++)t[n+s]=e[r+s]},flattenChunks:function(t){var e,r,i,n,s,o;for(i=0,e=0,r=t.length;e<r;e++)i+=t[e].length;for(o=new Uint8Array(i),n=0,e=0,r=t.length;e<r;e++)s=t[e],o.set(s,n),n+=s.length;return o}},n={arraySet:function(t,e,r,i,n){for(var s=0;s<i;s++)t[n+s]=e[r+s]},flattenChunks:function(t){return[].concat.apply([],t)}};t.setTyped=function(e){e?(t.Buf8=Uint8Array,t.Buf16=Uint16Array,t.Buf32=Int32Array,t.assign(t,i)):(t.Buf8=Array,t.Buf16=Array,t.Buf32=Array,t.assign(t,n))},t.setTyped(e)}(lx);var hx={},cx={},ux={},dx=lx,px=0,fx=1;function gx(t){for(var e=t.length;--e>=0;)t[e]=0}var mx=0,yx=29,vx=256,bx=vx+1+yx,_x=30,wx=19,xx=2*bx+1,Sx=15,Tx=16,kx=7,Cx=256,Ex=16,Ax=17,Ox=18,Bx=[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0],Rx=[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13],Lx=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],Px=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],Dx=new Array(2*(bx+2));gx(Dx);var Mx=new Array(2*_x);gx(Mx);var Ix=new Array(512);gx(Ix);var Nx=new Array(256);gx(Nx);var Fx=new Array(yx);gx(Fx);var jx,zx,Hx,Wx=new Array(_x);function Ux(t,e,r,i,n){this.static_tree=t,this.extra_bits=e,this.extra_base=r,this.elems=i,this.max_length=n,this.has_stree=t&&t.length}function $x(t,e){this.dyn_tree=t,this.max_code=0,this.stat_desc=e}function Vx(t){return t<256?Ix[t]:Ix[256+(t>>>7)]}function Gx(t,e){t.pending_buf[t.pending++]=255&e,t.pending_buf[t.pending++]=e>>>8&255}function Xx(t,e,r){t.bi_valid>Tx-r?(t.bi_buf|=e<<t.bi_valid&65535,Gx(t,t.bi_buf),t.bi_buf=e>>Tx-t.bi_valid,t.bi_valid+=r-Tx):(t.bi_buf|=e<<t.bi_valid&65535,t.bi_valid+=r)}function Yx(t,e,r){Xx(t,r[2*e],r[2*e+1])}function qx(t,e){var r=0;do{r|=1&t,t>>>=1,r<<=1}while(--e>0);return r>>>1}function Zx(t,e,r){var i,n,s=new Array(Sx+1),o=0;for(i=1;i<=Sx;i++)s[i]=o=o+r[i-1]<<1;for(n=0;n<=e;n++){var a=t[2*n+1];0!==a&&(t[2*n]=qx(s[a]++,a))}}function Kx(t){var e;for(e=0;e<bx;e++)t.dyn_ltree[2*e]=0;for(e=0;e<_x;e++)t.dyn_dtree[2*e]=0;for(e=0;e<wx;e++)t.bl_tree[2*e]=0;t.dyn_ltree[2*Cx]=1,t.opt_len=t.static_len=0,t.last_lit=t.matches=0}function Qx(t){t.bi_valid>8?Gx(t,t.bi_buf):t.bi_valid>0&&(t.pending_buf[t.pending++]=t.bi_buf),t.bi_buf=0,t.bi_valid=0}function Jx(t,e,r,i){var n=2*e,s=2*r;return t[n]<t[s]||t[n]===t[s]&&i[e]<=i[r]}function tS(t,e,r){for(var i=t.heap[r],n=r<<1;n<=t.heap_len&&(n<t.heap_len&&Jx(e,t.heap[n+1],t.heap[n],t.depth)&&n++,!Jx(e,i,t.heap[n],t.depth));)t.heap[r]=t.heap[n],r=n,n<<=1;t.heap[r]=i}function eS(t,e,r){var i,n,s,o,a=0;if(0!==t.last_lit)do{i=t.pending_buf[t.d_buf+2*a]<<8|t.pending_buf[t.d_buf+2*a+1],n=t.pending_buf[t.l_buf+a],a++,0===i?Yx(t,n,e):(Yx(t,(s=Nx[n])+vx+1,e),0!==(o=Bx[s])&&Xx(t,n-=Fx[s],o),Yx(t,s=Vx(--i),r),0!==(o=Rx[s])&&Xx(t,i-=Wx[s],o))}while(a<t.last_lit);Yx(t,Cx,e)}function rS(t,e){var r,i,n,s=e.dyn_tree,o=e.stat_desc.static_tree,a=e.stat_desc.has_stree,l=e.stat_desc.elems,h=-1;for(t.heap_len=0,t.heap_max=xx,r=0;r<l;r++)0!==s[2*r]?(t.heap[++t.heap_len]=h=r,t.depth[r]=0):s[2*r+1]=0;for(;t.heap_len<2;)s[2*(n=t.heap[++t.heap_len]=h<2?++h:0)]=1,t.depth[n]=0,t.opt_len--,a&&(t.static_len-=o[2*n+1]);for(e.max_code=h,r=t.heap_len>>1;r>=1;r--)tS(t,s,r);n=l;do{r=t.heap[1],t.heap[1]=t.heap[t.heap_len--],tS(t,s,1),i=t.heap[1],t.heap[--t.heap_max]=r,t.heap[--t.heap_max]=i,s[2*n]=s[2*r]+s[2*i],t.depth[n]=(t.depth[r]>=t.depth[i]?t.depth[r]:t.depth[i])+1,s[2*r+1]=s[2*i+1]=n,t.heap[1]=n++,tS(t,s,1)}while(t.heap_len>=2);t.heap[--t.heap_max]=t.heap[1],function(t,e){var r,i,n,s,o,a,l=e.dyn_tree,h=e.max_code,c=e.stat_desc.static_tree,u=e.stat_desc.has_stree,d=e.stat_desc.extra_bits,p=e.stat_desc.extra_base,f=e.stat_desc.max_length,g=0;for(s=0;s<=Sx;s++)t.bl_count[s]=0;for(l[2*t.heap[t.heap_max]+1]=0,r=t.heap_max+1;r<xx;r++)(s=l[2*l[2*(i=t.heap[r])+1]+1]+1)>f&&(s=f,g++),l[2*i+1]=s,i>h||(t.bl_count[s]++,o=0,i>=p&&(o=d[i-p]),a=l[2*i],t.opt_len+=a*(s+o),u&&(t.static_len+=a*(c[2*i+1]+o)));if(0!==g){do{for(s=f-1;0===t.bl_count[s];)s--;t.bl_count[s]--,t.bl_count[s+1]+=2,t.bl_count[f]--,g-=2}while(g>0);for(s=f;0!==s;s--)for(i=t.bl_count[s];0!==i;)(n=t.heap[--r])>h||(l[2*n+1]!==s&&(t.opt_len+=(s-l[2*n+1])*l[2*n],l[2*n+1]=s),i--)}}(t,e),Zx(s,h,t.bl_count)}function iS(t,e,r){var i,n,s=-1,o=e[1],a=0,l=7,h=4;for(0===o&&(l=138,h=3),e[2*(r+1)+1]=65535,i=0;i<=r;i++)n=o,o=e[2*(i+1)+1],++a<l&&n===o||(a<h?t.bl_tree[2*n]+=a:0!==n?(n!==s&&t.bl_tree[2*n]++,t.bl_tree[2*Ex]++):a<=10?t.bl_tree[2*Ax]++:t.bl_tree[2*Ox]++,a=0,s=n,0===o?(l=138,h=3):n===o?(l=6,h=3):(l=7,h=4))}function nS(t,e,r){var i,n,s=-1,o=e[1],a=0,l=7,h=4;for(0===o&&(l=138,h=3),i=0;i<=r;i++)if(n=o,o=e[2*(i+1)+1],!(++a<l&&n===o)){if(a<h)do{Yx(t,n,t.bl_tree)}while(0!=--a);else 0!==n?(n!==s&&(Yx(t,n,t.bl_tree),a--),Yx(t,Ex,t.bl_tree),Xx(t,a-3,2)):a<=10?(Yx(t,Ax,t.bl_tree),Xx(t,a-3,3)):(Yx(t,Ox,t.bl_tree),Xx(t,a-11,7));a=0,s=n,0===o?(l=138,h=3):n===o?(l=6,h=3):(l=7,h=4)}}gx(Wx);var sS=!1;function oS(t,e,r,i){Xx(t,(mx<<1)+(i?1:0),3),function(t,e,r,i){Qx(t),i&&(Gx(t,r),Gx(t,~r)),dx.arraySet(t.pending_buf,t.window,e,r,t.pending),t.pending+=r}(t,e,r,!0)}ux._tr_init=function(t){sS||(!function(){var t,e,r,i,n,s=new Array(Sx+1);for(r=0,i=0;i<yx-1;i++)for(Fx[i]=r,t=0;t<1<<Bx[i];t++)Nx[r++]=i;for(Nx[r-1]=i,n=0,i=0;i<16;i++)for(Wx[i]=n,t=0;t<1<<Rx[i];t++)Ix[n++]=i;for(n>>=7;i<_x;i++)for(Wx[i]=n<<7,t=0;t<1<<Rx[i]-7;t++)Ix[256+n++]=i;for(e=0;e<=Sx;e++)s[e]=0;for(t=0;t<=143;)Dx[2*t+1]=8,t++,s[8]++;for(;t<=255;)Dx[2*t+1]=9,t++,s[9]++;for(;t<=279;)Dx[2*t+1]=7,t++,s[7]++;for(;t<=287;)Dx[2*t+1]=8,t++,s[8]++;for(Zx(Dx,bx+1,s),t=0;t<_x;t++)Mx[2*t+1]=5,Mx[2*t]=qx(t,5);jx=new Ux(Dx,Bx,vx+1,bx,Sx),zx=new Ux(Mx,Rx,0,_x,Sx),Hx=new Ux(new Array(0),Lx,0,wx,kx)}(),sS=!0),t.l_desc=new $x(t.dyn_ltree,jx),t.d_desc=new $x(t.dyn_dtree,zx),t.bl_desc=new $x(t.bl_tree,Hx),t.bi_buf=0,t.bi_valid=0,Kx(t)},ux._tr_stored_block=oS,ux._tr_flush_block=function(t,e,r,i){var n,s,o=0;t.level>0?(2===t.strm.data_type&&(t.strm.data_type=function(t){var e,r=4093624447;for(e=0;e<=31;e++,r>>>=1)if(1&r&&0!==t.dyn_ltree[2*e])return px;if(0!==t.dyn_ltree[18]||0!==t.dyn_ltree[20]||0!==t.dyn_ltree[26])return fx;for(e=32;e<vx;e++)if(0!==t.dyn_ltree[2*e])return fx;return px}(t)),rS(t,t.l_desc),rS(t,t.d_desc),o=function(t){var e;for(iS(t,t.dyn_ltree,t.l_desc.max_code),iS(t,t.dyn_dtree,t.d_desc.max_code),rS(t,t.bl_desc),e=wx-1;e>=3&&0===t.bl_tree[2*Px[e]+1];e--);return t.opt_len+=3*(e+1)+5+5+4,e}(t),n=t.opt_len+3+7>>>3,(s=t.static_len+3+7>>>3)<=n&&(n=s)):n=s=r+5,r+4<=n&&-1!==e?oS(t,e,r,i):4===t.strategy||s===n?(Xx(t,2+(i?1:0),3),eS(t,Dx,Mx)):(Xx(t,4+(i?1:0),3),function(t,e,r,i){var n;for(Xx(t,e-257,5),Xx(t,r-1,5),Xx(t,i-4,4),n=0;n<i;n++)Xx(t,t.bl_tree[2*Px[n]+1],3);nS(t,t.dyn_ltree,e-1),nS(t,t.dyn_dtree,r-1)}(t,t.l_desc.max_code+1,t.d_desc.max_code+1,o+1),eS(t,t.dyn_ltree,t.dyn_dtree)),Kx(t),i&&Qx(t)},ux._tr_tally=function(t,e,r){return t.pending_buf[t.d_buf+2*t.last_lit]=e>>>8&255,t.pending_buf[t.d_buf+2*t.last_lit+1]=255&e,t.pending_buf[t.l_buf+t.last_lit]=255&r,t.last_lit++,0===e?t.dyn_ltree[2*r]++:(t.matches++,e--,t.dyn_ltree[2*(Nx[r]+vx+1)]++,t.dyn_dtree[2*Vx(e)]++),t.last_lit===t.lit_bufsize-1},ux._tr_align=function(t){Xx(t,2,3),Yx(t,Cx,Dx),function(t){16===t.bi_valid?(Gx(t,t.bi_buf),t.bi_buf=0,t.bi_valid=0):t.bi_valid>=8&&(t.pending_buf[t.pending++]=255&t.bi_buf,t.bi_buf>>=8,t.bi_valid-=8)}(t)};var aS=function(t,e,r,i){for(var n=65535&t|0,s=t>>>16&65535|0,o=0;0!==r;){r-=o=r>2e3?2e3:r;do{s=s+(n=n+e[i++]|0)|0}while(--o);n%=65521,s%=65521}return n|s<<16|0};var lS=function(){for(var t,e=[],r=0;r<256;r++){t=r;for(var i=0;i<8;i++)t=1&t?3988292384^t>>>1:t>>>1;e[r]=t}return e}();var hS,cS=function(t,e,r,i){var n=lS,s=i+r;t^=-1;for(var o=i;o<s;o++)t=t>>>8^n[255&(t^e[o])];return-1^t},uS={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"},dS=lx,pS=ux,fS=aS,gS=cS,mS=uS,yS=0,vS=4,bS=0,_S=-2,wS=-1,xS=4,SS=2,TS=8,kS=9,CS=286,ES=30,AS=19,OS=2*CS+1,BS=15,RS=3,LS=258,PS=LS+RS+1,DS=42,MS=103,IS=113,NS=666,FS=1,jS=2,zS=3,HS=4;function WS(t,e){return t.msg=mS[e],e}function US(t){return(t<<1)-(t>4?9:0)}function $S(t){for(var e=t.length;--e>=0;)t[e]=0}function VS(t){var e=t.state,r=e.pending;r>t.avail_out&&(r=t.avail_out),0!==r&&(dS.arraySet(t.output,e.pending_buf,e.pending_out,r,t.next_out),t.next_out+=r,e.pending_out+=r,t.total_out+=r,t.avail_out-=r,e.pending-=r,0===e.pending&&(e.pending_out=0))}function GS(t,e){pS._tr_flush_block(t,t.block_start>=0?t.block_start:-1,t.strstart-t.block_start,e),t.block_start=t.strstart,VS(t.strm)}function XS(t,e){t.pending_buf[t.pending++]=e}function YS(t,e){t.pending_buf[t.pending++]=e>>>8&255,t.pending_buf[t.pending++]=255&e}function qS(t,e){var r,i,n=t.max_chain_length,s=t.strstart,o=t.prev_length,a=t.nice_match,l=t.strstart>t.w_size-PS?t.strstart-(t.w_size-PS):0,h=t.window,c=t.w_mask,u=t.prev,d=t.strstart+LS,p=h[s+o-1],f=h[s+o];t.prev_length>=t.good_match&&(n>>=2),a>t.lookahead&&(a=t.lookahead);do{if(h[(r=e)+o]===f&&h[r+o-1]===p&&h[r]===h[s]&&h[++r]===h[s+1]){s+=2,r++;do{}while(h[++s]===h[++r]&&h[++s]===h[++r]&&h[++s]===h[++r]&&h[++s]===h[++r]&&h[++s]===h[++r]&&h[++s]===h[++r]&&h[++s]===h[++r]&&h[++s]===h[++r]&&s<d);if(i=LS-(d-s),s=d-LS,i>o){if(t.match_start=e,o=i,i>=a)break;p=h[s+o-1],f=h[s+o]}}}while((e=u[e&c])>l&&0!=--n);return o<=t.lookahead?o:t.lookahead}function ZS(t){var e,r,i,n,s,o,a,l,h,c,u=t.w_size;do{if(n=t.window_size-t.lookahead-t.strstart,t.strstart>=u+(u-PS)){dS.arraySet(t.window,t.window,u,u,0),t.match_start-=u,t.strstart-=u,t.block_start-=u,e=r=t.hash_size;do{i=t.head[--e],t.head[e]=i>=u?i-u:0}while(--r);e=r=u;do{i=t.prev[--e],t.prev[e]=i>=u?i-u:0}while(--r);n+=u}if(0===t.strm.avail_in)break;if(o=t.strm,a=t.window,l=t.strstart+t.lookahead,h=n,c=void 0,(c=o.avail_in)>h&&(c=h),r=0===c?0:(o.avail_in-=c,dS.arraySet(a,o.input,o.next_in,c,l),1===o.state.wrap?o.adler=fS(o.adler,a,c,l):2===o.state.wrap&&(o.adler=gS(o.adler,a,c,l)),o.next_in+=c,o.total_in+=c,c),t.lookahead+=r,t.lookahead+t.insert>=RS)for(s=t.strstart-t.insert,t.ins_h=t.window[s],t.ins_h=(t.ins_h<<t.hash_shift^t.window[s+1])&t.hash_mask;t.insert&&(t.ins_h=(t.ins_h<<t.hash_shift^t.window[s+RS-1])&t.hash_mask,t.prev[s&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=s,s++,t.insert--,!(t.lookahead+t.insert<RS)););}while(t.lookahead<PS&&0!==t.strm.avail_in)}function KS(t,e){for(var r,i;;){if(t.lookahead<PS){if(ZS(t),t.lookahead<PS&&e===yS)return FS;if(0===t.lookahead)break}if(r=0,t.lookahead>=RS&&(t.ins_h=(t.ins_h<<t.hash_shift^t.window[t.strstart+RS-1])&t.hash_mask,r=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart),0!==r&&t.strstart-r<=t.w_size-PS&&(t.match_length=qS(t,r)),t.match_length>=RS)if(i=pS._tr_tally(t,t.strstart-t.match_start,t.match_length-RS),t.lookahead-=t.match_length,t.match_length<=t.max_lazy_match&&t.lookahead>=RS){t.match_length--;do{t.strstart++,t.ins_h=(t.ins_h<<t.hash_shift^t.window[t.strstart+RS-1])&t.hash_mask,r=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart}while(0!=--t.match_length);t.strstart++}else t.strstart+=t.match_length,t.match_length=0,t.ins_h=t.window[t.strstart],t.ins_h=(t.ins_h<<t.hash_shift^t.window[t.strstart+1])&t.hash_mask;else i=pS._tr_tally(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++;if(i&&(GS(t,!1),0===t.strm.avail_out))return FS}return t.insert=t.strstart<RS-1?t.strstart:RS-1,e===vS?(GS(t,!0),0===t.strm.avail_out?zS:HS):t.last_lit&&(GS(t,!1),0===t.strm.avail_out)?FS:jS}function QS(t,e){for(var r,i,n;;){if(t.lookahead<PS){if(ZS(t),t.lookahead<PS&&e===yS)return FS;if(0===t.lookahead)break}if(r=0,t.lookahead>=RS&&(t.ins_h=(t.ins_h<<t.hash_shift^t.window[t.strstart+RS-1])&t.hash_mask,r=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart),t.prev_length=t.match_length,t.prev_match=t.match_start,t.match_length=RS-1,0!==r&&t.prev_length<t.max_lazy_match&&t.strstart-r<=t.w_size-PS&&(t.match_length=qS(t,r),t.match_length<=5&&(1===t.strategy||t.match_length===RS&&t.strstart-t.match_start>4096)&&(t.match_length=RS-1)),t.prev_length>=RS&&t.match_length<=t.prev_length){n=t.strstart+t.lookahead-RS,i=pS._tr_tally(t,t.strstart-1-t.prev_match,t.prev_length-RS),t.lookahead-=t.prev_length-1,t.prev_length-=2;do{++t.strstart<=n&&(t.ins_h=(t.ins_h<<t.hash_shift^t.window[t.strstart+RS-1])&t.hash_mask,r=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart)}while(0!=--t.prev_length);if(t.match_available=0,t.match_length=RS-1,t.strstart++,i&&(GS(t,!1),0===t.strm.avail_out))return FS}else if(t.match_available){if((i=pS._tr_tally(t,0,t.window[t.strstart-1]))&&GS(t,!1),t.strstart++,t.lookahead--,0===t.strm.avail_out)return FS}else t.match_available=1,t.strstart++,t.lookahead--}return t.match_available&&(i=pS._tr_tally(t,0,t.window[t.strstart-1]),t.match_available=0),t.insert=t.strstart<RS-1?t.strstart:RS-1,e===vS?(GS(t,!0),0===t.strm.avail_out?zS:HS):t.last_lit&&(GS(t,!1),0===t.strm.avail_out)?FS:jS}function JS(t,e,r,i,n){this.good_length=t,this.max_lazy=e,this.nice_length=r,this.max_chain=i,this.func=n}function tT(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=TS,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new dS.Buf16(2*OS),this.dyn_dtree=new dS.Buf16(2*(2*ES+1)),this.bl_tree=new dS.Buf16(2*(2*AS+1)),$S(this.dyn_ltree),$S(this.dyn_dtree),$S(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new dS.Buf16(BS+1),this.heap=new dS.Buf16(2*CS+1),$S(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new dS.Buf16(2*CS+1),$S(this.depth),this.l_buf=0,this.lit_bufsize=0,this.last_lit=0,this.d_buf=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}function eT(t){var e;return t&&t.state?(t.total_in=t.total_out=0,t.data_type=SS,(e=t.state).pending=0,e.pending_out=0,e.wrap<0&&(e.wrap=-e.wrap),e.status=e.wrap?DS:IS,t.adler=2===e.wrap?0:1,e.last_flush=yS,pS._tr_init(e),bS):WS(t,_S)}function rT(t){var e=eT(t);return e===bS&&function(t){t.window_size=2*t.w_size,$S(t.head),t.max_lazy_match=hS[t.level].max_lazy,t.good_match=hS[t.level].good_length,t.nice_match=hS[t.level].nice_length,t.max_chain_length=hS[t.level].max_chain,t.strstart=0,t.block_start=0,t.lookahead=0,t.insert=0,t.match_length=t.prev_length=RS-1,t.match_available=0,t.ins_h=0}(t.state),e}function iT(t,e,r,i,n,s){if(!t)return _S;var o=1;if(e===wS&&(e=6),i<0?(o=0,i=-i):i>15&&(o=2,i-=16),n<1||n>kS||r!==TS||i<8||i>15||e<0||e>9||s<0||s>xS)return WS(t,_S);8===i&&(i=9);var a=new tT;return t.state=a,a.strm=t,a.wrap=o,a.gzhead=null,a.w_bits=i,a.w_size=1<<a.w_bits,a.w_mask=a.w_size-1,a.hash_bits=n+7,a.hash_size=1<<a.hash_bits,a.hash_mask=a.hash_size-1,a.hash_shift=~~((a.hash_bits+RS-1)/RS),a.window=new dS.Buf8(2*a.w_size),a.head=new dS.Buf16(a.hash_size),a.prev=new dS.Buf16(a.w_size),a.lit_bufsize=1<<n+6,a.pending_buf_size=4*a.lit_bufsize,a.pending_buf=new dS.Buf8(a.pending_buf_size),a.d_buf=1*a.lit_bufsize,a.l_buf=3*a.lit_bufsize,a.level=e,a.strategy=s,a.method=r,rT(t)}hS=[new JS(0,0,0,0,(function(t,e){var r=65535;for(r>t.pending_buf_size-5&&(r=t.pending_buf_size-5);;){if(t.lookahead<=1){if(ZS(t),0===t.lookahead&&e===yS)return FS;if(0===t.lookahead)break}t.strstart+=t.lookahead,t.lookahead=0;var i=t.block_start+r;if((0===t.strstart||t.strstart>=i)&&(t.lookahead=t.strstart-i,t.strstart=i,GS(t,!1),0===t.strm.avail_out))return FS;if(t.strstart-t.block_start>=t.w_size-PS&&(GS(t,!1),0===t.strm.avail_out))return FS}return t.insert=0,e===vS?(GS(t,!0),0===t.strm.avail_out?zS:HS):(t.strstart>t.block_start&&(GS(t,!1),t.strm.avail_out),FS)})),new JS(4,4,8,4,KS),new JS(4,5,16,8,KS),new JS(4,6,32,32,KS),new JS(4,4,16,16,QS),new JS(8,16,32,32,QS),new JS(8,16,128,128,QS),new JS(8,32,128,256,QS),new JS(32,128,258,1024,QS),new JS(32,258,258,4096,QS)],cx.deflateInit=function(t,e){return iT(t,e,TS,15,8,0)},cx.deflateInit2=iT,cx.deflateReset=rT,cx.deflateResetKeep=eT,cx.deflateSetHeader=function(t,e){return t&&t.state?2!==t.state.wrap?_S:(t.state.gzhead=e,bS):_S},cx.deflate=function(t,e){var r,i,n,s;if(!t||!t.state||e>5||e<0)return t?WS(t,_S):_S;if(i=t.state,!t.output||!t.input&&0!==t.avail_in||i.status===NS&&e!==vS)return WS(t,0===t.avail_out?-5:_S);if(i.strm=t,r=i.last_flush,i.last_flush=e,i.status===DS)if(2===i.wrap)t.adler=0,XS(i,31),XS(i,139),XS(i,8),i.gzhead?(XS(i,(i.gzhead.text?1:0)+(i.gzhead.hcrc?2:0)+(i.gzhead.extra?4:0)+(i.gzhead.name?8:0)+(i.gzhead.comment?16:0)),XS(i,255&i.gzhead.time),XS(i,i.gzhead.time>>8&255),XS(i,i.gzhead.time>>16&255),XS(i,i.gzhead.time>>24&255),XS(i,9===i.level?2:i.strategy>=2||i.level<2?4:0),XS(i,255&i.gzhead.os),i.gzhead.extra&&i.gzhead.extra.length&&(XS(i,255&i.gzhead.extra.length),XS(i,i.gzhead.extra.length>>8&255)),i.gzhead.hcrc&&(t.adler=gS(t.adler,i.pending_buf,i.pending,0)),i.gzindex=0,i.status=69):(XS(i,0),XS(i,0),XS(i,0),XS(i,0),XS(i,0),XS(i,9===i.level?2:i.strategy>=2||i.level<2?4:0),XS(i,3),i.status=IS);else{var o=TS+(i.w_bits-8<<4)<<8;o|=(i.strategy>=2||i.level<2?0:i.level<6?1:6===i.level?2:3)<<6,0!==i.strstart&&(o|=32),o+=31-o%31,i.status=IS,YS(i,o),0!==i.strstart&&(YS(i,t.adler>>>16),YS(i,65535&t.adler)),t.adler=1}if(69===i.status)if(i.gzhead.extra){for(n=i.pending;i.gzindex<(65535&i.gzhead.extra.length)&&(i.pending!==i.pending_buf_size||(i.gzhead.hcrc&&i.pending>n&&(t.adler=gS(t.adler,i.pending_buf,i.pending-n,n)),VS(t),n=i.pending,i.pending!==i.pending_buf_size));)XS(i,255&i.gzhead.extra[i.gzindex]),i.gzindex++;i.gzhead.hcrc&&i.pending>n&&(t.adler=gS(t.adler,i.pending_buf,i.pending-n,n)),i.gzindex===i.gzhead.extra.length&&(i.gzindex=0,i.status=73)}else i.status=73;if(73===i.status)if(i.gzhead.name){n=i.pending;do{if(i.pending===i.pending_buf_size&&(i.gzhead.hcrc&&i.pending>n&&(t.adler=gS(t.adler,i.pending_buf,i.pending-n,n)),VS(t),n=i.pending,i.pending===i.pending_buf_size)){s=1;break}s=i.gzindex<i.gzhead.name.length?255&i.gzhead.name.charCodeAt(i.gzindex++):0,XS(i,s)}while(0!==s);i.gzhead.hcrc&&i.pending>n&&(t.adler=gS(t.adler,i.pending_buf,i.pending-n,n)),0===s&&(i.gzindex=0,i.status=91)}else i.status=91;if(91===i.status)if(i.gzhead.comment){n=i.pending;do{if(i.pending===i.pending_buf_size&&(i.gzhead.hcrc&&i.pending>n&&(t.adler=gS(t.adler,i.pending_buf,i.pending-n,n)),VS(t),n=i.pending,i.pending===i.pending_buf_size)){s=1;break}s=i.gzindex<i.gzhead.comment.length?255&i.gzhead.comment.charCodeAt(i.gzindex++):0,XS(i,s)}while(0!==s);i.gzhead.hcrc&&i.pending>n&&(t.adler=gS(t.adler,i.pending_buf,i.pending-n,n)),0===s&&(i.status=MS)}else i.status=MS;if(i.status===MS&&(i.gzhead.hcrc?(i.pending+2>i.pending_buf_size&&VS(t),i.pending+2<=i.pending_buf_size&&(XS(i,255&t.adler),XS(i,t.adler>>8&255),t.adler=0,i.status=IS)):i.status=IS),0!==i.pending){if(VS(t),0===t.avail_out)return i.last_flush=-1,bS}else if(0===t.avail_in&&US(e)<=US(r)&&e!==vS)return WS(t,-5);if(i.status===NS&&0!==t.avail_in)return WS(t,-5);if(0!==t.avail_in||0!==i.lookahead||e!==yS&&i.status!==NS){var a=2===i.strategy?function(t,e){for(var r;;){if(0===t.lookahead&&(ZS(t),0===t.lookahead)){if(e===yS)return FS;break}if(t.match_length=0,r=pS._tr_tally(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++,r&&(GS(t,!1),0===t.strm.avail_out))return FS}return t.insert=0,e===vS?(GS(t,!0),0===t.strm.avail_out?zS:HS):t.last_lit&&(GS(t,!1),0===t.strm.avail_out)?FS:jS}(i,e):3===i.strategy?function(t,e){for(var r,i,n,s,o=t.window;;){if(t.lookahead<=LS){if(ZS(t),t.lookahead<=LS&&e===yS)return FS;if(0===t.lookahead)break}if(t.match_length=0,t.lookahead>=RS&&t.strstart>0&&(i=o[n=t.strstart-1])===o[++n]&&i===o[++n]&&i===o[++n]){s=t.strstart+LS;do{}while(i===o[++n]&&i===o[++n]&&i===o[++n]&&i===o[++n]&&i===o[++n]&&i===o[++n]&&i===o[++n]&&i===o[++n]&&n<s);t.match_length=LS-(s-n),t.match_length>t.lookahead&&(t.match_length=t.lookahead)}if(t.match_length>=RS?(r=pS._tr_tally(t,1,t.match_length-RS),t.lookahead-=t.match_length,t.strstart+=t.match_length,t.match_length=0):(r=pS._tr_tally(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++),r&&(GS(t,!1),0===t.strm.avail_out))return FS}return t.insert=0,e===vS?(GS(t,!0),0===t.strm.avail_out?zS:HS):t.last_lit&&(GS(t,!1),0===t.strm.avail_out)?FS:jS}(i,e):hS[i.level].func(i,e);if(a!==zS&&a!==HS||(i.status=NS),a===FS||a===zS)return 0===t.avail_out&&(i.last_flush=-1),bS;if(a===jS&&(1===e?pS._tr_align(i):5!==e&&(pS._tr_stored_block(i,0,0,!1),3===e&&($S(i.head),0===i.lookahead&&(i.strstart=0,i.block_start=0,i.insert=0))),VS(t),0===t.avail_out))return i.last_flush=-1,bS}return e!==vS?bS:i.wrap<=0?1:(2===i.wrap?(XS(i,255&t.adler),XS(i,t.adler>>8&255),XS(i,t.adler>>16&255),XS(i,t.adler>>24&255),XS(i,255&t.total_in),XS(i,t.total_in>>8&255),XS(i,t.total_in>>16&255),XS(i,t.total_in>>24&255)):(YS(i,t.adler>>>16),YS(i,65535&t.adler)),VS(t),i.wrap>0&&(i.wrap=-i.wrap),0!==i.pending?bS:1)},cx.deflateEnd=function(t){var e;return t&&t.state?(e=t.state.status)!==DS&&69!==e&&73!==e&&91!==e&&e!==MS&&e!==IS&&e!==NS?WS(t,_S):(t.state=null,e===IS?WS(t,-3):bS):_S},cx.deflateSetDictionary=function(t,e){var r,i,n,s,o,a,l,h,c=e.length;if(!t||!t.state)return _S;if(2===(s=(r=t.state).wrap)||1===s&&r.status!==DS||r.lookahead)return _S;for(1===s&&(t.adler=fS(t.adler,e,c,0)),r.wrap=0,c>=r.w_size&&(0===s&&($S(r.head),r.strstart=0,r.block_start=0,r.insert=0),h=new dS.Buf8(r.w_size),dS.arraySet(h,e,c-r.w_size,r.w_size,0),e=h,c=r.w_size),o=t.avail_in,a=t.next_in,l=t.input,t.avail_in=c,t.next_in=0,t.input=e,ZS(r);r.lookahead>=RS;){i=r.strstart,n=r.lookahead-(RS-1);do{r.ins_h=(r.ins_h<<r.hash_shift^r.window[i+RS-1])&r.hash_mask,r.prev[i&r.w_mask]=r.head[r.ins_h],r.head[r.ins_h]=i,i++}while(--n);r.strstart=i,r.lookahead=RS-1,ZS(r)}return r.strstart+=r.lookahead,r.block_start=r.strstart,r.insert=r.lookahead,r.lookahead=0,r.match_length=r.prev_length=RS-1,r.match_available=0,t.next_in=a,t.input=l,t.avail_in=o,r.wrap=s,bS},cx.deflateInfo="pako deflate (from Nodeca project)";var nT={},sT=lx,oT=!0,aT=!0;try{String.fromCharCode.apply(null,[0])}catch(t){oT=!1}try{String.fromCharCode.apply(null,new Uint8Array(1))}catch(t){aT=!1}for(var lT=new sT.Buf8(256),hT=0;hT<256;hT++)lT[hT]=hT>=252?6:hT>=248?5:hT>=240?4:hT>=224?3:hT>=192?2:1;function cT(t,e){if(e<65534&&(t.subarray&&aT||!t.subarray&&oT))return String.fromCharCode.apply(null,sT.shrinkBuf(t,e));for(var r="",i=0;i<e;i++)r+=String.fromCharCode(t[i]);return r}lT[254]=lT[254]=1,nT.string2buf=function(t){var e,r,i,n,s,o=t.length,a=0;for(n=0;n<o;n++)55296==(64512&(r=t.charCodeAt(n)))&&n+1<o&&56320==(64512&(i=t.charCodeAt(n+1)))&&(r=65536+(r-55296<<10)+(i-56320),n++),a+=r<128?1:r<2048?2:r<65536?3:4;for(e=new sT.Buf8(a),s=0,n=0;s<a;n++)55296==(64512&(r=t.charCodeAt(n)))&&n+1<o&&56320==(64512&(i=t.charCodeAt(n+1)))&&(r=65536+(r-55296<<10)+(i-56320),n++),r<128?e[s++]=r:r<2048?(e[s++]=192|r>>>6,e[s++]=128|63&r):r<65536?(e[s++]=224|r>>>12,e[s++]=128|r>>>6&63,e[s++]=128|63&r):(e[s++]=240|r>>>18,e[s++]=128|r>>>12&63,e[s++]=128|r>>>6&63,e[s++]=128|63&r);return e},nT.buf2binstring=function(t){return cT(t,t.length)},nT.binstring2buf=function(t){for(var e=new sT.Buf8(t.length),r=0,i=e.length;r<i;r++)e[r]=t.charCodeAt(r);return e},nT.buf2string=function(t,e){var r,i,n,s,o=e||t.length,a=new Array(2*o);for(i=0,r=0;r<o;)if((n=t[r++])<128)a[i++]=n;else if((s=lT[n])>4)a[i++]=65533,r+=s-1;else{for(n&=2===s?31:3===s?15:7;s>1&&r<o;)n=n<<6|63&t[r++],s--;s>1?a[i++]=65533:n<65536?a[i++]=n:(n-=65536,a[i++]=55296|n>>10&1023,a[i++]=56320|1023&n)}return cT(a,i)},nT.utf8border=function(t,e){var r;for((e=e||t.length)>t.length&&(e=t.length),r=e-1;r>=0&&128==(192&t[r]);)r--;return r<0||0===r?e:r+lT[t[r]]>e?r:e};var uT=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0},dT=cx,pT=lx,fT=nT,gT=uS,mT=uT,yT=Object.prototype.toString,vT=0,bT=-1,_T=0,wT=8;function xT(t){if(!(this instanceof xT))return new xT(t);this.options=pT.assign({level:bT,method:wT,chunkSize:16384,windowBits:15,memLevel:8,strategy:_T,to:""},t||{});var e=this.options;e.raw&&e.windowBits>0?e.windowBits=-e.windowBits:e.gzip&&e.windowBits>0&&e.windowBits<16&&(e.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new mT,this.strm.avail_out=0;var r=dT.deflateInit2(this.strm,e.level,e.method,e.windowBits,e.memLevel,e.strategy);if(r!==vT)throw new Error(gT[r]);if(e.header&&dT.deflateSetHeader(this.strm,e.header),e.dictionary){var i;if(i="string"==typeof e.dictionary?fT.string2buf(e.dictionary):"[object ArrayBuffer]"===yT.call(e.dictionary)?new Uint8Array(e.dictionary):e.dictionary,(r=dT.deflateSetDictionary(this.strm,i))!==vT)throw new Error(gT[r]);this._dict_set=!0}}function ST(t,e){var r=new xT(e);if(r.push(t,!0),r.err)throw r.msg||gT[r.err];return r.result}xT.prototype.push=function(t,e){var r,i,n=this.strm,s=this.options.chunkSize;if(this.ended)return!1;i=e===~~e?e:!0===e?4:0,"string"==typeof t?n.input=fT.string2buf(t):"[object ArrayBuffer]"===yT.call(t)?n.input=new Uint8Array(t):n.input=t,n.next_in=0,n.avail_in=n.input.length;do{if(0===n.avail_out&&(n.output=new pT.Buf8(s),n.next_out=0,n.avail_out=s),1!==(r=dT.deflate(n,i))&&r!==vT)return this.onEnd(r),this.ended=!0,!1;0!==n.avail_out&&(0!==n.avail_in||4!==i&&2!==i)||("string"===this.options.to?this.onData(fT.buf2binstring(pT.shrinkBuf(n.output,n.next_out))):this.onData(pT.shrinkBuf(n.output,n.next_out)))}while((n.avail_in>0||0===n.avail_out)&&1!==r);return 4===i?(r=dT.deflateEnd(this.strm),this.onEnd(r),this.ended=!0,r===vT):2!==i||(this.onEnd(vT),n.avail_out=0,!0)},xT.prototype.onData=function(t){this.chunks.push(t)},xT.prototype.onEnd=function(t){t===vT&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=pT.flattenChunks(this.chunks)),this.chunks=[],this.err=t,this.msg=this.strm.msg},hx.Deflate=xT,hx.deflate=ST,hx.deflateRaw=function(t,e){return(e=e||{}).raw=!0,ST(t,e)},hx.gzip=function(t,e){return(e=e||{}).gzip=!0,ST(t,e)};var TT={},kT={},CT=lx,ET=15,AT=[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0],OT=[16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78],BT=[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0],RT=[16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64],LT=lx,PT=aS,DT=cS,MT=function(t,e){var r,i,n,s,o,a,l,h,c,u,d,p,f,g,m,y,v,b,_,w,x,S,T,k,C;r=t.state,i=t.next_in,k=t.input,n=i+(t.avail_in-5),s=t.next_out,C=t.output,o=s-(e-t.avail_out),a=s+(t.avail_out-257),l=r.dmax,h=r.wsize,c=r.whave,u=r.wnext,d=r.window,p=r.hold,f=r.bits,g=r.lencode,m=r.distcode,y=(1<<r.lenbits)-1,v=(1<<r.distbits)-1;t:do{f<15&&(p+=k[i++]<<f,f+=8,p+=k[i++]<<f,f+=8),b=g[p&y];e:for(;;){if(p>>>=_=b>>>24,f-=_,0===(_=b>>>16&255))C[s++]=65535&b;else{if(!(16&_)){if(0==(64&_)){b=g[(65535&b)+(p&(1<<_)-1)];continue e}if(32&_){r.mode=12;break t}t.msg="invalid literal/length code",r.mode=30;break t}w=65535&b,(_&=15)&&(f<_&&(p+=k[i++]<<f,f+=8),w+=p&(1<<_)-1,p>>>=_,f-=_),f<15&&(p+=k[i++]<<f,f+=8,p+=k[i++]<<f,f+=8),b=m[p&v];r:for(;;){if(p>>>=_=b>>>24,f-=_,!(16&(_=b>>>16&255))){if(0==(64&_)){b=m[(65535&b)+(p&(1<<_)-1)];continue r}t.msg="invalid distance code",r.mode=30;break t}if(x=65535&b,f<(_&=15)&&(p+=k[i++]<<f,(f+=8)<_&&(p+=k[i++]<<f,f+=8)),(x+=p&(1<<_)-1)>l){t.msg="invalid distance too far back",r.mode=30;break t}if(p>>>=_,f-=_,x>(_=s-o)){if((_=x-_)>c&&r.sane){t.msg="invalid distance too far back",r.mode=30;break t}if(S=0,T=d,0===u){if(S+=h-_,_<w){w-=_;do{C[s++]=d[S++]}while(--_);S=s-x,T=C}}else if(u<_){if(S+=h+u-_,(_-=u)<w){w-=_;do{C[s++]=d[S++]}while(--_);if(S=0,u<w){w-=_=u;do{C[s++]=d[S++]}while(--_);S=s-x,T=C}}}else if(S+=u-_,_<w){w-=_;do{C[s++]=d[S++]}while(--_);S=s-x,T=C}for(;w>2;)C[s++]=T[S++],C[s++]=T[S++],C[s++]=T[S++],w-=3;w&&(C[s++]=T[S++],w>1&&(C[s++]=T[S++]))}else{S=s-x;do{C[s++]=C[S++],C[s++]=C[S++],C[s++]=C[S++],w-=3}while(w>2);w&&(C[s++]=C[S++],w>1&&(C[s++]=C[S++]))}break}}break}}while(i<n&&s<a);i-=w=f>>3,p&=(1<<(f-=w<<3))-1,t.next_in=i,t.next_out=s,t.avail_in=i<n?n-i+5:5-(i-n),t.avail_out=s<a?a-s+257:257-(s-a),r.hold=p,r.bits=f},IT=function(t,e,r,i,n,s,o,a){var l,h,c,u,d,p,f,g,m,y=a.bits,v=0,b=0,_=0,w=0,x=0,S=0,T=0,k=0,C=0,E=0,A=null,O=0,B=new CT.Buf16(16),R=new CT.Buf16(16),L=null,P=0;for(v=0;v<=ET;v++)B[v]=0;for(b=0;b<i;b++)B[e[r+b]]++;for(x=y,w=ET;w>=1&&0===B[w];w--);if(x>w&&(x=w),0===w)return n[s++]=20971520,n[s++]=20971520,a.bits=1,0;for(_=1;_<w&&0===B[_];_++);for(x<_&&(x=_),k=1,v=1;v<=ET;v++)if(k<<=1,(k-=B[v])<0)return-1;if(k>0&&(0===t||1!==w))return-1;for(R[1]=0,v=1;v<ET;v++)R[v+1]=R[v]+B[v];for(b=0;b<i;b++)0!==e[r+b]&&(o[R[e[r+b]]++]=b);if(0===t?(A=L=o,p=19):1===t?(A=AT,O-=257,L=OT,P-=257,p=256):(A=BT,L=RT,p=-1),E=0,b=0,v=_,d=s,S=x,T=0,c=-1,u=(C=1<<x)-1,1===t&&C>852||2===t&&C>592)return 1;for(;;){f=v-T,o[b]<p?(g=0,m=o[b]):o[b]>p?(g=L[P+o[b]],m=A[O+o[b]]):(g=96,m=0),l=1<<v-T,_=h=1<<S;do{n[d+(E>>T)+(h-=l)]=f<<24|g<<16|m|0}while(0!==h);for(l=1<<v-1;E&l;)l>>=1;if(0!==l?(E&=l-1,E+=l):E=0,b++,0==--B[v]){if(v===w)break;v=e[r+o[b]]}if(v>x&&(E&u)!==c){for(0===T&&(T=x),d+=_,k=1<<(S=v-T);S+T<w&&!((k-=B[S+T])<=0);)S++,k<<=1;if(C+=1<<S,1===t&&C>852||2===t&&C>592)return 1;n[c=E&u]=x<<24|S<<16|d-s|0}}return 0!==E&&(n[d+E]=v-T<<24|64<<16|0),a.bits=x,0},NT=1,FT=2,jT=0,zT=-2,HT=1,WT=12,UT=30,$T=852,VT=592;function GT(t){return(t>>>24&255)+(t>>>8&65280)+((65280&t)<<8)+((255&t)<<24)}function XT(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new LT.Buf16(320),this.work=new LT.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function YT(t){var e;return t&&t.state?(e=t.state,t.total_in=t.total_out=e.total=0,t.msg="",e.wrap&&(t.adler=1&e.wrap),e.mode=HT,e.last=0,e.havedict=0,e.dmax=32768,e.head=null,e.hold=0,e.bits=0,e.lencode=e.lendyn=new LT.Buf32($T),e.distcode=e.distdyn=new LT.Buf32(VT),e.sane=1,e.back=-1,jT):zT}function qT(t){var e;return t&&t.state?((e=t.state).wsize=0,e.whave=0,e.wnext=0,YT(t)):zT}function ZT(t,e){var r,i;return t&&t.state?(i=t.state,e<0?(r=0,e=-e):(r=1+(e>>4),e<48&&(e&=15)),e&&(e<8||e>15)?zT:(null!==i.window&&i.wbits!==e&&(i.window=null),i.wrap=r,i.wbits=e,qT(t))):zT}function KT(t,e){var r,i;return t?(i=new XT,t.state=i,i.window=null,(r=ZT(t,e))!==jT&&(t.state=null),r):zT}var QT,JT,tk=!0;function ek(t){if(tk){var e;for(QT=new LT.Buf32(512),JT=new LT.Buf32(32),e=0;e<144;)t.lens[e++]=8;for(;e<256;)t.lens[e++]=9;for(;e<280;)t.lens[e++]=7;for(;e<288;)t.lens[e++]=8;for(IT(NT,t.lens,0,288,QT,0,t.work,{bits:9}),e=0;e<32;)t.lens[e++]=5;IT(FT,t.lens,0,32,JT,0,t.work,{bits:5}),tk=!1}t.lencode=QT,t.lenbits=9,t.distcode=JT,t.distbits=5}function rk(t,e,r,i){var n,s=t.state;return null===s.window&&(s.wsize=1<<s.wbits,s.wnext=0,s.whave=0,s.window=new LT.Buf8(s.wsize)),i>=s.wsize?(LT.arraySet(s.window,e,r-s.wsize,s.wsize,0),s.wnext=0,s.whave=s.wsize):((n=s.wsize-s.wnext)>i&&(n=i),LT.arraySet(s.window,e,r-i,n,s.wnext),(i-=n)?(LT.arraySet(s.window,e,r-i,i,0),s.wnext=i,s.whave=s.wsize):(s.wnext+=n,s.wnext===s.wsize&&(s.wnext=0),s.whave<s.wsize&&(s.whave+=n))),0}kT.inflateReset=qT,kT.inflateReset2=ZT,kT.inflateResetKeep=YT,kT.inflateInit=function(t){return KT(t,15)},kT.inflateInit2=KT,kT.inflate=function(t,e){var r,i,n,s,o,a,l,h,c,u,d,p,f,g,m,y,v,b,_,w,x,S,T,k,C=0,E=new LT.Buf8(4),A=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];if(!t||!t.state||!t.output||!t.input&&0!==t.avail_in)return zT;(r=t.state).mode===WT&&(r.mode=13),o=t.next_out,n=t.output,l=t.avail_out,s=t.next_in,i=t.input,a=t.avail_in,h=r.hold,c=r.bits,u=a,d=l,S=jT;t:for(;;)switch(r.mode){case HT:if(0===r.wrap){r.mode=13;break}for(;c<16;){if(0===a)break t;a--,h+=i[s++]<<c,c+=8}if(2&r.wrap&&35615===h){r.check=0,E[0]=255&h,E[1]=h>>>8&255,r.check=DT(r.check,E,2,0),h=0,c=0,r.mode=2;break}if(r.flags=0,r.head&&(r.head.done=!1),!(1&r.wrap)||(((255&h)<<8)+(h>>8))%31){t.msg="incorrect header check",r.mode=UT;break}if(8!=(15&h)){t.msg="unknown compression method",r.mode=UT;break}if(c-=4,x=8+(15&(h>>>=4)),0===r.wbits)r.wbits=x;else if(x>r.wbits){t.msg="invalid window size",r.mode=UT;break}r.dmax=1<<x,t.adler=r.check=1,r.mode=512&h?10:WT,h=0,c=0;break;case 2:for(;c<16;){if(0===a)break t;a--,h+=i[s++]<<c,c+=8}if(r.flags=h,8!=(255&r.flags)){t.msg="unknown compression method",r.mode=UT;break}if(57344&r.flags){t.msg="unknown header flags set",r.mode=UT;break}r.head&&(r.head.text=h>>8&1),512&r.flags&&(E[0]=255&h,E[1]=h>>>8&255,r.check=DT(r.check,E,2,0)),h=0,c=0,r.mode=3;case 3:for(;c<32;){if(0===a)break t;a--,h+=i[s++]<<c,c+=8}r.head&&(r.head.time=h),512&r.flags&&(E[0]=255&h,E[1]=h>>>8&255,E[2]=h>>>16&255,E[3]=h>>>24&255,r.check=DT(r.check,E,4,0)),h=0,c=0,r.mode=4;case 4:for(;c<16;){if(0===a)break t;a--,h+=i[s++]<<c,c+=8}r.head&&(r.head.xflags=255&h,r.head.os=h>>8),512&r.flags&&(E[0]=255&h,E[1]=h>>>8&255,r.check=DT(r.check,E,2,0)),h=0,c=0,r.mode=5;case 5:if(1024&r.flags){for(;c<16;){if(0===a)break t;a--,h+=i[s++]<<c,c+=8}r.length=h,r.head&&(r.head.extra_len=h),512&r.flags&&(E[0]=255&h,E[1]=h>>>8&255,r.check=DT(r.check,E,2,0)),h=0,c=0}else r.head&&(r.head.extra=null);r.mode=6;case 6:if(1024&r.flags&&((p=r.length)>a&&(p=a),p&&(r.head&&(x=r.head.extra_len-r.length,r.head.extra||(r.head.extra=new Array(r.head.extra_len)),LT.arraySet(r.head.extra,i,s,p,x)),512&r.flags&&(r.check=DT(r.check,i,p,s)),a-=p,s+=p,r.length-=p),r.length))break t;r.length=0,r.mode=7;case 7:if(2048&r.flags){if(0===a)break t;p=0;do{x=i[s+p++],r.head&&x&&r.length<65536&&(r.head.name+=String.fromCharCode(x))}while(x&&p<a);if(512&r.flags&&(r.check=DT(r.check,i,p,s)),a-=p,s+=p,x)break t}else r.head&&(r.head.name=null);r.length=0,r.mode=8;case 8:if(4096&r.flags){if(0===a)break t;p=0;do{x=i[s+p++],r.head&&x&&r.length<65536&&(r.head.comment+=String.fromCharCode(x))}while(x&&p<a);if(512&r.flags&&(r.check=DT(r.check,i,p,s)),a-=p,s+=p,x)break t}else r.head&&(r.head.comment=null);r.mode=9;case 9:if(512&r.flags){for(;c<16;){if(0===a)break t;a--,h+=i[s++]<<c,c+=8}if(h!==(65535&r.check)){t.msg="header crc mismatch",r.mode=UT;break}h=0,c=0}r.head&&(r.head.hcrc=r.flags>>9&1,r.head.done=!0),t.adler=r.check=0,r.mode=WT;break;case 10:for(;c<32;){if(0===a)break t;a--,h+=i[s++]<<c,c+=8}t.adler=r.check=GT(h),h=0,c=0,r.mode=11;case 11:if(0===r.havedict)return t.next_out=o,t.avail_out=l,t.next_in=s,t.avail_in=a,r.hold=h,r.bits=c,2;t.adler=r.check=1,r.mode=WT;case WT:if(5===e||6===e)break t;case 13:if(r.last){h>>>=7&c,c-=7&c,r.mode=27;break}for(;c<3;){if(0===a)break t;a--,h+=i[s++]<<c,c+=8}switch(r.last=1&h,c-=1,3&(h>>>=1)){case 0:r.mode=14;break;case 1:if(ek(r),r.mode=20,6===e){h>>>=2,c-=2;break t}break;case 2:r.mode=17;break;case 3:t.msg="invalid block type",r.mode=UT}h>>>=2,c-=2;break;case 14:for(h>>>=7&c,c-=7&c;c<32;){if(0===a)break t;a--,h+=i[s++]<<c,c+=8}if((65535&h)!=(h>>>16^65535)){t.msg="invalid stored block lengths",r.mode=UT;break}if(r.length=65535&h,h=0,c=0,r.mode=15,6===e)break t;case 15:r.mode=16;case 16:if(p=r.length){if(p>a&&(p=a),p>l&&(p=l),0===p)break t;LT.arraySet(n,i,s,p,o),a-=p,s+=p,l-=p,o+=p,r.length-=p;break}r.mode=WT;break;case 17:for(;c<14;){if(0===a)break t;a--,h+=i[s++]<<c,c+=8}if(r.nlen=257+(31&h),h>>>=5,c-=5,r.ndist=1+(31&h),h>>>=5,c-=5,r.ncode=4+(15&h),h>>>=4,c-=4,r.nlen>286||r.ndist>30){t.msg="too many length or distance symbols",r.mode=UT;break}r.have=0,r.mode=18;case 18:for(;r.have<r.ncode;){for(;c<3;){if(0===a)break t;a--,h+=i[s++]<<c,c+=8}r.lens[A[r.have++]]=7&h,h>>>=3,c-=3}for(;r.have<19;)r.lens[A[r.have++]]=0;if(r.lencode=r.lendyn,r.lenbits=7,T={bits:r.lenbits},S=IT(0,r.lens,0,19,r.lencode,0,r.work,T),r.lenbits=T.bits,S){t.msg="invalid code lengths set",r.mode=UT;break}r.have=0,r.mode=19;case 19:for(;r.have<r.nlen+r.ndist;){for(;y=(C=r.lencode[h&(1<<r.lenbits)-1])>>>16&255,v=65535&C,!((m=C>>>24)<=c);){if(0===a)break t;a--,h+=i[s++]<<c,c+=8}if(v<16)h>>>=m,c-=m,r.lens[r.have++]=v;else{if(16===v){for(k=m+2;c<k;){if(0===a)break t;a--,h+=i[s++]<<c,c+=8}if(h>>>=m,c-=m,0===r.have){t.msg="invalid bit length repeat",r.mode=UT;break}x=r.lens[r.have-1],p=3+(3&h),h>>>=2,c-=2}else if(17===v){for(k=m+3;c<k;){if(0===a)break t;a--,h+=i[s++]<<c,c+=8}c-=m,x=0,p=3+(7&(h>>>=m)),h>>>=3,c-=3}else{for(k=m+7;c<k;){if(0===a)break t;a--,h+=i[s++]<<c,c+=8}c-=m,x=0,p=11+(127&(h>>>=m)),h>>>=7,c-=7}if(r.have+p>r.nlen+r.ndist){t.msg="invalid bit length repeat",r.mode=UT;break}for(;p--;)r.lens[r.have++]=x}}if(r.mode===UT)break;if(0===r.lens[256]){t.msg="invalid code -- missing end-of-block",r.mode=UT;break}if(r.lenbits=9,T={bits:r.lenbits},S=IT(NT,r.lens,0,r.nlen,r.lencode,0,r.work,T),r.lenbits=T.bits,S){t.msg="invalid literal/lengths set",r.mode=UT;break}if(r.distbits=6,r.distcode=r.distdyn,T={bits:r.distbits},S=IT(FT,r.lens,r.nlen,r.ndist,r.distcode,0,r.work,T),r.distbits=T.bits,S){t.msg="invalid distances set",r.mode=UT;break}if(r.mode=20,6===e)break t;case 20:r.mode=21;case 21:if(a>=6&&l>=258){t.next_out=o,t.avail_out=l,t.next_in=s,t.avail_in=a,r.hold=h,r.bits=c,MT(t,d),o=t.next_out,n=t.output,l=t.avail_out,s=t.next_in,i=t.input,a=t.avail_in,h=r.hold,c=r.bits,r.mode===WT&&(r.back=-1);break}for(r.back=0;y=(C=r.lencode[h&(1<<r.lenbits)-1])>>>16&255,v=65535&C,!((m=C>>>24)<=c);){if(0===a)break t;a--,h+=i[s++]<<c,c+=8}if(y&&0==(240&y)){for(b=m,_=y,w=v;y=(C=r.lencode[w+((h&(1<<b+_)-1)>>b)])>>>16&255,v=65535&C,!(b+(m=C>>>24)<=c);){if(0===a)break t;a--,h+=i[s++]<<c,c+=8}h>>>=b,c-=b,r.back+=b}if(h>>>=m,c-=m,r.back+=m,r.length=v,0===y){r.mode=26;break}if(32&y){r.back=-1,r.mode=WT;break}if(64&y){t.msg="invalid literal/length code",r.mode=UT;break}r.extra=15&y,r.mode=22;case 22:if(r.extra){for(k=r.extra;c<k;){if(0===a)break t;a--,h+=i[s++]<<c,c+=8}r.length+=h&(1<<r.extra)-1,h>>>=r.extra,c-=r.extra,r.back+=r.extra}r.was=r.length,r.mode=23;case 23:for(;y=(C=r.distcode[h&(1<<r.distbits)-1])>>>16&255,v=65535&C,!((m=C>>>24)<=c);){if(0===a)break t;a--,h+=i[s++]<<c,c+=8}if(0==(240&y)){for(b=m,_=y,w=v;y=(C=r.distcode[w+((h&(1<<b+_)-1)>>b)])>>>16&255,v=65535&C,!(b+(m=C>>>24)<=c);){if(0===a)break t;a--,h+=i[s++]<<c,c+=8}h>>>=b,c-=b,r.back+=b}if(h>>>=m,c-=m,r.back+=m,64&y){t.msg="invalid distance code",r.mode=UT;break}r.offset=v,r.extra=15&y,r.mode=24;case 24:if(r.extra){for(k=r.extra;c<k;){if(0===a)break t;a--,h+=i[s++]<<c,c+=8}r.offset+=h&(1<<r.extra)-1,h>>>=r.extra,c-=r.extra,r.back+=r.extra}if(r.offset>r.dmax){t.msg="invalid distance too far back",r.mode=UT;break}r.mode=25;case 25:if(0===l)break t;if(p=d-l,r.offset>p){if((p=r.offset-p)>r.whave&&r.sane){t.msg="invalid distance too far back",r.mode=UT;break}p>r.wnext?(p-=r.wnext,f=r.wsize-p):f=r.wnext-p,p>r.length&&(p=r.length),g=r.window}else g=n,f=o-r.offset,p=r.length;p>l&&(p=l),l-=p,r.length-=p;do{n[o++]=g[f++]}while(--p);0===r.length&&(r.mode=21);break;case 26:if(0===l)break t;n[o++]=r.length,l--,r.mode=21;break;case 27:if(r.wrap){for(;c<32;){if(0===a)break t;a--,h|=i[s++]<<c,c+=8}if(d-=l,t.total_out+=d,r.total+=d,d&&(t.adler=r.check=r.flags?DT(r.check,n,d,o-d):PT(r.check,n,d,o-d)),d=l,(r.flags?h:GT(h))!==r.check){t.msg="incorrect data check",r.mode=UT;break}h=0,c=0}r.mode=28;case 28:if(r.wrap&&r.flags){for(;c<32;){if(0===a)break t;a--,h+=i[s++]<<c,c+=8}if(h!==(4294967295&r.total)){t.msg="incorrect length check",r.mode=UT;break}h=0,c=0}r.mode=29;case 29:S=1;break t;case UT:S=-3;break t;case 31:return-4;default:return zT}return t.next_out=o,t.avail_out=l,t.next_in=s,t.avail_in=a,r.hold=h,r.bits=c,(r.wsize||d!==t.avail_out&&r.mode<UT&&(r.mode<27||4!==e))&&rk(t,t.output,t.next_out,d-t.avail_out),u-=t.avail_in,d-=t.avail_out,t.total_in+=u,t.total_out+=d,r.total+=d,r.wrap&&d&&(t.adler=r.check=r.flags?DT(r.check,n,d,t.next_out-d):PT(r.check,n,d,t.next_out-d)),t.data_type=r.bits+(r.last?64:0)+(r.mode===WT?128:0)+(20===r.mode||15===r.mode?256:0),(0===u&&0===d||4===e)&&S===jT&&(S=-5),S},kT.inflateEnd=function(t){if(!t||!t.state)return zT;var e=t.state;return e.window&&(e.window=null),t.state=null,jT},kT.inflateGetHeader=function(t,e){var r;return t&&t.state?0==(2&(r=t.state).wrap)?zT:(r.head=e,e.done=!1,jT):zT},kT.inflateSetDictionary=function(t,e){var r,i=e.length;return t&&t.state?0!==(r=t.state).wrap&&11!==r.mode?zT:11===r.mode&&PT(1,e,i,0)!==r.check?-3:rk(t,e,i,i)?(r.mode=31,-4):(r.havedict=1,jT):zT},kT.inflateInfo="pako inflate (from Nodeca project)";var ik={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8};var nk=kT,sk=lx,ok=nT,ak=ik,lk=uS,hk=uT,ck=function(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1},uk=Object.prototype.toString;function dk(t){if(!(this instanceof dk))return new dk(t);this.options=sk.assign({chunkSize:16384,windowBits:0,to:""},t||{});var e=this.options;e.raw&&e.windowBits>=0&&e.windowBits<16&&(e.windowBits=-e.windowBits,0===e.windowBits&&(e.windowBits=-15)),!(e.windowBits>=0&&e.windowBits<16)||t&&t.windowBits||(e.windowBits+=32),e.windowBits>15&&e.windowBits<48&&0==(15&e.windowBits)&&(e.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new hk,this.strm.avail_out=0;var r=nk.inflateInit2(this.strm,e.windowBits);if(r!==ak.Z_OK)throw new Error(lk[r]);if(this.header=new ck,nk.inflateGetHeader(this.strm,this.header),e.dictionary&&("string"==typeof e.dictionary?e.dictionary=ok.string2buf(e.dictionary):"[object ArrayBuffer]"===uk.call(e.dictionary)&&(e.dictionary=new Uint8Array(e.dictionary)),e.raw&&(r=nk.inflateSetDictionary(this.strm,e.dictionary))!==ak.Z_OK))throw new Error(lk[r])}function pk(t,e){var r=new dk(e);if(r.push(t,!0),r.err)throw r.msg||lk[r.err];return r.result}dk.prototype.push=function(t,e){var r,i,n,s,o,a=this.strm,l=this.options.chunkSize,h=this.options.dictionary,c=!1;if(this.ended)return!1;i=e===~~e?e:!0===e?ak.Z_FINISH:ak.Z_NO_FLUSH,"string"==typeof t?a.input=ok.binstring2buf(t):"[object ArrayBuffer]"===uk.call(t)?a.input=new Uint8Array(t):a.input=t,a.next_in=0,a.avail_in=a.input.length;do{if(0===a.avail_out&&(a.output=new sk.Buf8(l),a.next_out=0,a.avail_out=l),(r=nk.inflate(a,ak.Z_NO_FLUSH))===ak.Z_NEED_DICT&&h&&(r=nk.inflateSetDictionary(this.strm,h)),r===ak.Z_BUF_ERROR&&!0===c&&(r=ak.Z_OK,c=!1),r!==ak.Z_STREAM_END&&r!==ak.Z_OK)return this.onEnd(r),this.ended=!0,!1;a.next_out&&(0!==a.avail_out&&r!==ak.Z_STREAM_END&&(0!==a.avail_in||i!==ak.Z_FINISH&&i!==ak.Z_SYNC_FLUSH)||("string"===this.options.to?(n=ok.utf8border(a.output,a.next_out),s=a.next_out-n,o=ok.buf2string(a.output,n),a.next_out=s,a.avail_out=l-s,s&&sk.arraySet(a.output,a.output,n,s,0),this.onData(o)):this.onData(sk.shrinkBuf(a.output,a.next_out)))),0===a.avail_in&&0===a.avail_out&&(c=!0)}while((a.avail_in>0||0===a.avail_out)&&r!==ak.Z_STREAM_END);return r===ak.Z_STREAM_END&&(i=ak.Z_FINISH),i===ak.Z_FINISH?(r=nk.inflateEnd(this.strm),this.onEnd(r),this.ended=!0,r===ak.Z_OK):i!==ak.Z_SYNC_FLUSH||(this.onEnd(ak.Z_OK),a.avail_out=0,!0)},dk.prototype.onData=function(t){this.chunks.push(t)},dk.prototype.onEnd=function(t){t===ak.Z_OK&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=sk.flattenChunks(this.chunks)),this.chunks=[],this.err=t,this.msg=this.strm.msg},TT.Inflate=dk,TT.inflate=pk,TT.inflateRaw=function(t,e){return(e=e||{}).raw=!0,pk(t,e)},TT.ungzip=pk;var fk={};(0,lx.assign)(fk,hx,TT,ik);var gk="undefined"!=typeof Uint8Array&&"undefined"!=typeof Uint16Array&&"undefined"!=typeof Uint32Array,mk=fk,yk=cw(),vk=dw,bk=gk?"uint8array":"array";function _k(t,e){vk.call(this,"FlateWorker/"+t),this._pako=null,this._pakoAction=t,this._pakoOptions=e,this.meta={}}ax.magic="\b\0",yk.inherits(_k,vk),_k.prototype.processChunk=function(t){this.meta=t.meta,null===this._pako&&this._createPako(),this._pako.push(yk.transformTo(bk,t.data),!1)},_k.prototype.flush=function(){vk.prototype.flush.call(this),null===this._pako&&this._createPako(),this._pako.push([],!0)},_k.prototype.cleanUp=function(){vk.prototype.cleanUp.call(this),this._pako=null},_k.prototype._createPako=function(){this._pako=new mk[this._pakoAction]({raw:!0,level:this._pakoOptions.level||-1});var t=this;this._pako.onData=function(e){t.push({data:e,meta:t.meta})}},ax.compressWorker=function(t){return new _k("Deflate",t)},ax.uncompressWorker=function(){return new _k("Inflate",{})};var wk=dw;ox.STORE={magic:"\0\0",compressWorker:function(){return new wk("STORE compression")},uncompressWorker:function(){return new wk("STORE decompression")}},ox.DEFLATE=ax;var xk={LOCAL_FILE_HEADER:"PK",CENTRAL_FILE_HEADER:"PK",CENTRAL_DIRECTORY_END:"PK",ZIP64_CENTRAL_DIRECTORY_LOCATOR:"PK",ZIP64_CENTRAL_DIRECTORY_END:"PK",DATA_DESCRIPTOR:"PK\b"},Sk=cw(),Tk=dw,kk=s_,Ck=Mw,Ek=xk,Ak=function(t,e){var r,i="";for(r=0;r<e;r++)i+=String.fromCharCode(255&t),t>>>=8;return i},Ok=function(t,e,r,i,n,s){var o,a,l=t.file,h=t.compression,c=s!==kk.utf8encode,u=Sk.transformTo("string",s(l.name)),d=Sk.transformTo("string",kk.utf8encode(l.name)),p=l.comment,f=Sk.transformTo("string",s(p)),g=Sk.transformTo("string",kk.utf8encode(p)),m=d.length!==l.name.length,y=g.length!==p.length,v="",b="",_="",w=l.dir,x=l.date,S={crc32:0,compressedSize:0,uncompressedSize:0};e&&!r||(S.crc32=t.crc32,S.compressedSize=t.compressedSize,S.uncompressedSize=t.uncompressedSize);var T=0;e&&(T|=8),c||!m&&!y||(T|=2048);var k=0,C=0;w&&(k|=16),"UNIX"===n?(C=798,k|=function(t,e){var r=t;return t||(r=e?16893:33204),(65535&r)<<16}(l.unixPermissions,w)):(C=20,k|=63&(l.dosPermissions||0)),o=x.getUTCHours(),o<<=6,o|=x.getUTCMinutes(),o<<=5,o|=x.getUTCSeconds()/2,a=x.getUTCFullYear()-1980,a<<=4,a|=x.getUTCMonth()+1,a<<=5,a|=x.getUTCDate(),m&&(b=Ak(1,1)+Ak(Ck(u),4)+d,v+="up"+Ak(b.length,2)+b),y&&(_=Ak(1,1)+Ak(Ck(f),4)+g,v+="uc"+Ak(_.length,2)+_);var E="";return E+="\n\0",E+=Ak(T,2),E+=h.magic,E+=Ak(o,2),E+=Ak(a,2),E+=Ak(S.crc32,4),E+=Ak(S.compressedSize,4),E+=Ak(S.uncompressedSize,4),E+=Ak(u.length,2),E+=Ak(v.length,2),{fileRecord:Ek.LOCAL_FILE_HEADER+E+u+v,dirRecord:Ek.CENTRAL_FILE_HEADER+Ak(C,2)+E+Ak(f.length,2)+"\0\0\0\0"+Ak(k,4)+Ak(i,4)+u+v+f}},Bk=function(t){return Ek.DATA_DESCRIPTOR+Ak(t.crc32,4)+Ak(t.compressedSize,4)+Ak(t.uncompressedSize,4)};function Rk(t,e,r,i){Tk.call(this,"ZipFileWorker"),this.bytesWritten=0,this.zipComment=e,this.zipPlatform=r,this.encodeFileName=i,this.streamFiles=t,this.accumulate=!1,this.contentBuffer=[],this.dirRecords=[],this.currentSourceOffset=0,this.entriesCount=0,this.currentFile=null,this._sources=[]}Sk.inherits(Rk,Tk),Rk.prototype.push=function(t){var e=t.meta.percent||0,r=this.entriesCount,i=this._sources.length;this.accumulate?this.contentBuffer.push(t):(this.bytesWritten+=t.data.length,Tk.prototype.push.call(this,{data:t.data,meta:{currentFile:this.currentFile,percent:r?(e+100*(r-i-1))/r:100}}))},Rk.prototype.openedSource=function(t){this.currentSourceOffset=this.bytesWritten,this.currentFile=t.file.name;var e=this.streamFiles&&!t.file.dir;if(e){var r=Ok(t,e,!1,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);this.push({data:r.fileRecord,meta:{percent:0}})}else this.accumulate=!0},Rk.prototype.closedSource=function(t){this.accumulate=!1;var e=this.streamFiles&&!t.file.dir,r=Ok(t,e,!0,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);if(this.dirRecords.push(r.dirRecord),e)this.push({data:Bk(t),meta:{percent:100}});else for(this.push({data:r.fileRecord,meta:{percent:0}});this.contentBuffer.length;)this.push(this.contentBuffer.shift());this.currentFile=null},Rk.prototype.flush=function(){for(var t=this.bytesWritten,e=0;e<this.dirRecords.length;e++)this.push({data:this.dirRecords[e],meta:{percent:100}});var r=this.bytesWritten-t,i=function(t,e,r,i,n){var s=Sk.transformTo("string",n(i));return Ek.CENTRAL_DIRECTORY_END+"\0\0\0\0"+Ak(t,2)+Ak(t,2)+Ak(e,4)+Ak(r,4)+Ak(s.length,2)+s}(this.dirRecords.length,r,t,this.zipComment,this.encodeFileName);this.push({data:i,meta:{percent:100}})},Rk.prototype.prepareNextSource=function(){this.previous=this._sources.shift(),this.openedSource(this.previous.streamInfo),this.isPaused?this.previous.pause():this.previous.resume()},Rk.prototype.registerPrevious=function(t){this._sources.push(t);var e=this;return t.on("data",(function(t){e.processChunk(t)})),t.on("end",(function(){e.closedSource(e.previous.streamInfo),e._sources.length?e.prepareNextSource():e.end()})),t.on("error",(function(t){e.error(t)})),this},Rk.prototype.resume=function(){return!!Tk.prototype.resume.call(this)&&(!this.previous&&this._sources.length?(this.prepareNextSource(),!0):this.previous||this._sources.length||this.generatedError?void 0:(this.end(),!0))},Rk.prototype.error=function(t){var e=this._sources;if(!Tk.prototype.error.call(this,t))return!1;for(var r=0;r<e.length;r++)try{e[r].error(t)}catch(t){}return!0},Rk.prototype.lock=function(){Tk.prototype.lock.call(this);for(var t=this._sources,e=0;e<t.length;e++)t[e].lock()};var Lk=ox,Pk=Rk;sx.generateWorker=function(t,e,r){var i=new Pk(e.streamFiles,r,e.platform,e.encodeFileName),n=0;try{t.forEach((function(t,r){n++;var s=function(t,e){var r=t||e,i=Lk[r];if(!i)throw new Error(r+" is not a valid compression method !");return i}(r.options.compression,e.compression),o=r.options.compressionOptions||e.compressionOptions||{},a=r.dir,l=r.date;r._compressWorker(s,o).withStreamInfo("file",{name:t,dir:a,date:l,comment:r.comment||"",unixPermissions:r.unixPermissions,dosPermissions:r.dosPermissions}).pipe(i)})),i.entriesCount=n}catch(t){i.error(t)}return i};var Dk=cw(),Mk=dw;function Ik(t,e){Mk.call(this,"Nodejs stream input adapter for "+t),this._upstreamEnded=!1,this._bindStream(e)}Dk.inherits(Ik,Mk),Ik.prototype._bindStream=function(t){var e=this;this._stream=t,t.pause(),t.on("data",(function(t){e.push({data:t,meta:{percent:0}})})).on("error",(function(t){e.isPaused?this.generatedError=t:e.error(t)})).on("end",(function(){e.isPaused?e._upstreamEnded=!0:e.end()}))},Ik.prototype.pause=function(){return!!Mk.prototype.pause.call(this)&&(this._stream.pause(),!0)},Ik.prototype.resume=function(){return!!Mk.prototype.resume.call(this)&&(this._upstreamEnded?this.end():this._stream.resume(),!0)};var Nk=Ik,Fk=s_,jk=cw(),zk=dw,Hk=Ew,Wk=Aw,Uk=Yw,$k=nx,Vk=sx,Gk=ow,Xk=Nk,Yk=function(t,e,r){var i,n=jk.getTypeOf(e),s=jk.extend(r||{},Wk);s.date=s.date||new Date,null!==s.compression&&(s.compression=s.compression.toUpperCase()),"string"==typeof s.unixPermissions&&(s.unixPermissions=parseInt(s.unixPermissions,8)),s.unixPermissions&&16384&s.unixPermissions&&(s.dir=!0),s.dosPermissions&&16&s.dosPermissions&&(s.dir=!0),s.dir&&(t=Zk(t)),s.createFolders&&(i=qk(t))&&Kk.call(this,i,!0);var o="string"===n&&!1===s.binary&&!1===s.base64;r&&void 0!==r.binary||(s.binary=!o),(e instanceof Uk&&0===e.uncompressedSize||s.dir||!e||0===e.length)&&(s.base64=!1,s.binary=!0,e="",s.compression="STORE",n="string");var a=null;a=e instanceof Uk||e instanceof zk?e:Gk.isNode&&Gk.isStream(e)?new Xk(t,e):jk.prepareContent(t,e,s.binary,s.optimizedBinaryString,s.base64);var l=new $k(t,a,s);this.files[t]=l},qk=function(t){"/"===t.slice(-1)&&(t=t.substring(0,t.length-1));var e=t.lastIndexOf("/");return e>0?t.substring(0,e):""},Zk=function(t){return"/"!==t.slice(-1)&&(t+="/"),t},Kk=function(t,e){return e=void 0!==e?e:Wk.createFolders,t=Zk(t),this.files[t]||Yk.call(this,t,null,{dir:!0,createFolders:e}),this.files[t]};function Qk(t){return"[object RegExp]"===Object.prototype.toString.call(t)}var Jk={load:function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},forEach:function(t){var e,r,i;for(e in this.files)i=this.files[e],(r=e.slice(this.root.length,e.length))&&e.slice(0,this.root.length)===this.root&&t(r,i)},filter:function(t){var e=[];return this.forEach((function(r,i){t(r,i)&&e.push(i)})),e},file:function(t,e,r){if(1===arguments.length){if(Qk(t)){var i=t;return this.filter((function(t,e){return!e.dir&&i.test(t)}))}var n=this.files[this.root+t];return n&&!n.dir?n:null}return t=this.root+t,Yk.call(this,t,e,r),this},folder:function(t){if(!t)return this;if(Qk(t))return this.filter((function(e,r){return r.dir&&t.test(e)}));var e=this.root+t,r=Kk.call(this,e),i=this.clone();return i.root=r.name,i},remove:function(t){t=this.root+t;var e=this.files[t];if(e||("/"!==t.slice(-1)&&(t+="/"),e=this.files[t]),e&&!e.dir)delete this.files[t];else for(var r=this.filter((function(e,r){return r.name.slice(0,t.length)===t})),i=0;i<r.length;i++)delete this.files[r[i].name];return this},generate:function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},generateInternalStream:function(t){var e,r={};try{if((r=jk.extend(t||{},{streamFiles:!1,compression:"STORE",compressionOptions:null,type:"",platform:"DOS",comment:null,mimeType:"application/zip",encodeFileName:Fk.utf8encode})).type=r.type.toLowerCase(),r.compression=r.compression.toUpperCase(),"binarystring"===r.type&&(r.type="string"),!r.type)throw new Error("No output type specified.");jk.checkSupport(r.type),"darwin"!==r.platform&&"freebsd"!==r.platform&&"linux"!==r.platform&&"sunos"!==r.platform||(r.platform="UNIX"),"win32"===r.platform&&(r.platform="DOS");var i=r.comment||this.comment||"";e=Vk.generateWorker(this,r,i)}catch(t){(e=new zk("error")).error(t)}return new Hk(e,r.type||"string",r.mimeType)},generateAsync:function(t,e){return this.generateInternalStream(t).accumulate(e)},generateNodeStream:function(t,e){return(t=t||{}).type||(t.type="nodebuffer"),this.generateInternalStream(t).toNodejsStream(e)}},tC=Jk,eC=cw();function rC(t){this.data=t,this.length=t.length,this.index=0,this.zero=0}rC.prototype={checkOffset:function(t){this.checkIndex(this.index+t)},checkIndex:function(t){if(this.length<this.zero+t||t<0)throw new Error("End of data reached (data length = "+this.length+", asked index = "+t+"). Corrupted zip ?")},setIndex:function(t){this.checkIndex(t),this.index=t},skip:function(t){this.setIndex(this.index+t)},byteAt:function(){},readInt:function(t){var e,r=0;for(this.checkOffset(t),e=this.index+t-1;e>=this.index;e--)r=(r<<8)+this.byteAt(e);return this.index+=t,r},readString:function(t){return eC.transformTo("string",this.readData(t))},readData:function(){},lastIndexOfSignature:function(){},readAndCheckSignature:function(){},readDate:function(){var t=this.readInt(4);return new Date(Date.UTC(1980+(t>>25&127),(t>>21&15)-1,t>>16&31,t>>11&31,t>>5&63,(31&t)<<1))}};var iC=rC,nC=iC;function sC(t){nC.call(this,t);for(var e=0;e<this.data.length;e++)t[e]=255&t[e]}cw().inherits(sC,nC),sC.prototype.byteAt=function(t){return this.data[this.zero+t]},sC.prototype.lastIndexOfSignature=function(t){for(var e=t.charCodeAt(0),r=t.charCodeAt(1),i=t.charCodeAt(2),n=t.charCodeAt(3),s=this.length-4;s>=0;--s)if(this.data[s]===e&&this.data[s+1]===r&&this.data[s+2]===i&&this.data[s+3]===n)return s-this.zero;return-1},sC.prototype.readAndCheckSignature=function(t){var e=t.charCodeAt(0),r=t.charCodeAt(1),i=t.charCodeAt(2),n=t.charCodeAt(3),s=this.readData(4);return e===s[0]&&r===s[1]&&i===s[2]&&n===s[3]},sC.prototype.readData=function(t){if(this.checkOffset(t),0===t)return[];var e=this.data.slice(this.zero+this.index,this.zero+this.index+t);return this.index+=t,e};var oC=sC,aC=iC;function lC(t){aC.call(this,t)}cw().inherits(lC,aC),lC.prototype.byteAt=function(t){return this.data.charCodeAt(this.zero+t)},lC.prototype.lastIndexOfSignature=function(t){return this.data.lastIndexOf(t)-this.zero},lC.prototype.readAndCheckSignature=function(t){return t===this.readData(4)},lC.prototype.readData=function(t){this.checkOffset(t);var e=this.data.slice(this.zero+this.index,this.zero+this.index+t);return this.index+=t,e};var hC=lC,cC=oC;function uC(t){cC.call(this,t)}cw().inherits(uC,cC),uC.prototype.readData=function(t){if(this.checkOffset(t),0===t)return new Uint8Array(0);var e=this.data.subarray(this.zero+this.index,this.zero+this.index+t);return this.index+=t,e};var dC=uC,pC=dC;function fC(t){pC.call(this,t)}cw().inherits(fC,pC),fC.prototype.readData=function(t){this.checkOffset(t);var e=this.data.slice(this.zero+this.index,this.zero+this.index+t);return this.index+=t,e};var gC=fC,mC=cw(),yC=a_,vC=oC,bC=hC,_C=gC,wC=dC,xC=function(t){var e=mC.getTypeOf(t);return mC.checkSupport(e),"string"!==e||yC.uint8array?"nodebuffer"===e?new _C(t):yC.uint8array?new wC(mC.transformTo("uint8array",t)):new vC(mC.transformTo("array",t)):new bC(t)},SC=xC,TC=cw(),kC=Yw,CC=Mw,EC=s_,AC=ox,OC=a_;function BC(t,e){this.options=t,this.loadOptions=e}BC.prototype={isEncrypted:function(){return 1==(1&this.bitFlag)},useUTF8:function(){return 2048==(2048&this.bitFlag)},readLocalPart:function(t){var e,r;if(t.skip(22),this.fileNameLength=t.readInt(2),r=t.readInt(2),this.fileName=t.readData(this.fileNameLength),t.skip(r),-1===this.compressedSize||-1===this.uncompressedSize)throw new Error("Bug or corrupted zip : didn't get enough information from the central directory (compressedSize === -1 || uncompressedSize === -1)");if(e=function(t){for(var e in AC)if(Object.prototype.hasOwnProperty.call(AC,e)&&AC[e].magic===t)return AC[e];return null}(this.compressionMethod),null===e)throw new Error("Corrupted zip : compression "+TC.pretty(this.compressionMethod)+" unknown (inner file : "+TC.transformTo("string",this.fileName)+")");this.decompressed=new kC(this.compressedSize,this.uncompressedSize,this.crc32,e,t.readData(this.compressedSize))},readCentralPart:function(t){this.versionMadeBy=t.readInt(2),t.skip(2),this.bitFlag=t.readInt(2),this.compressionMethod=t.readString(2),this.date=t.readDate(),this.crc32=t.readInt(4),this.compressedSize=t.readInt(4),this.uncompressedSize=t.readInt(4);var e=t.readInt(2);if(this.extraFieldsLength=t.readInt(2),this.fileCommentLength=t.readInt(2),this.diskNumberStart=t.readInt(2),this.internalFileAttributes=t.readInt(2),this.externalFileAttributes=t.readInt(4),this.localHeaderOffset=t.readInt(4),this.isEncrypted())throw new Error("Encrypted zip are not supported");t.skip(e),this.readExtraFields(t),this.parseZIP64ExtraField(t),this.fileComment=t.readData(this.fileCommentLength)},processAttributes:function(){this.unixPermissions=null,this.dosPermissions=null;var t=this.versionMadeBy>>8;this.dir=!!(16&this.externalFileAttributes),0===t&&(this.dosPermissions=63&this.externalFileAttributes),3===t&&(this.unixPermissions=this.externalFileAttributes>>16&65535),this.dir||"/"!==this.fileNameStr.slice(-1)||(this.dir=!0)},parseZIP64ExtraField:function(){if(this.extraFields[1]){var t=SC(this.extraFields[1].value);this.uncompressedSize===TC.MAX_VALUE_32BITS&&(this.uncompressedSize=t.readInt(8)),this.compressedSize===TC.MAX_VALUE_32BITS&&(this.compressedSize=t.readInt(8)),this.localHeaderOffset===TC.MAX_VALUE_32BITS&&(this.localHeaderOffset=t.readInt(8)),this.diskNumberStart===TC.MAX_VALUE_32BITS&&(this.diskNumberStart=t.readInt(4))}},readExtraFields:function(t){var e,r,i,n=t.index+this.extraFieldsLength;for(this.extraFields||(this.extraFields={});t.index+4<n;)e=t.readInt(2),r=t.readInt(2),i=t.readData(r),this.extraFields[e]={id:e,length:r,value:i};t.setIndex(n)},handleUTF8:function(){var t=OC.uint8array?"uint8array":"array";if(this.useUTF8())this.fileNameStr=EC.utf8decode(this.fileName),this.fileCommentStr=EC.utf8decode(this.fileComment);else{var e=this.findExtraFieldUnicodePath();if(null!==e)this.fileNameStr=e;else{var r=TC.transformTo(t,this.fileName);this.fileNameStr=this.loadOptions.decodeFileName(r)}var i=this.findExtraFieldUnicodeComment();if(null!==i)this.fileCommentStr=i;else{var n=TC.transformTo(t,this.fileComment);this.fileCommentStr=this.loadOptions.decodeFileName(n)}}},findExtraFieldUnicodePath:function(){var t=this.extraFields[28789];if(t){var e=SC(t.value);return 1!==e.readInt(1)||CC(this.fileName)!==e.readInt(4)?null:EC.utf8decode(e.readData(t.length-5))}return null},findExtraFieldUnicodeComment:function(){var t=this.extraFields[25461];if(t){var e=SC(t.value);return 1!==e.readInt(1)||CC(this.fileComment)!==e.readInt(4)?null:EC.utf8decode(e.readData(t.length-5))}return null}};var RC=BC,LC=xC,PC=cw(),DC=xk,MC=RC,IC=a_;function NC(t){this.files=[],this.loadOptions=t}NC.prototype={checkSignature:function(t){if(!this.reader.readAndCheckSignature(t)){this.reader.index-=4;var e=this.reader.readString(4);throw new Error("Corrupted zip or bug: unexpected signature ("+PC.pretty(e)+", expected "+PC.pretty(t)+")")}},isSignature:function(t,e){var r=this.reader.index;this.reader.setIndex(t);var i=this.reader.readString(4)===e;return this.reader.setIndex(r),i},readBlockEndOfCentral:function(){this.diskNumber=this.reader.readInt(2),this.diskWithCentralDirStart=this.reader.readInt(2),this.centralDirRecordsOnThisDisk=this.reader.readInt(2),this.centralDirRecords=this.reader.readInt(2),this.centralDirSize=this.reader.readInt(4),this.centralDirOffset=this.reader.readInt(4),this.zipCommentLength=this.reader.readInt(2);var t=this.reader.readData(this.zipCommentLength),e=IC.uint8array?"uint8array":"array",r=PC.transformTo(e,t);this.zipComment=this.loadOptions.decodeFileName(r)},readBlockZip64EndOfCentral:function(){this.zip64EndOfCentralSize=this.reader.readInt(8),this.reader.skip(4),this.diskNumber=this.reader.readInt(4),this.diskWithCentralDirStart=this.reader.readInt(4),this.centralDirRecordsOnThisDisk=this.reader.readInt(8),this.centralDirRecords=this.reader.readInt(8),this.centralDirSize=this.reader.readInt(8),this.centralDirOffset=this.reader.readInt(8),this.zip64ExtensibleData={};for(var t,e,r,i=this.zip64EndOfCentralSize-44;0<i;)t=this.reader.readInt(2),e=this.reader.readInt(4),r=this.reader.readData(e),this.zip64ExtensibleData[t]={id:t,length:e,value:r}},readBlockZip64EndOfCentralLocator:function(){if(this.diskWithZip64CentralDirStart=this.reader.readInt(4),this.relativeOffsetEndOfZip64CentralDir=this.reader.readInt(8),this.disksCount=this.reader.readInt(4),this.disksCount>1)throw new Error("Multi-volumes zip are not supported")},readLocalFiles:function(){var t,e;for(t=0;t<this.files.length;t++)e=this.files[t],this.reader.setIndex(e.localHeaderOffset),this.checkSignature(DC.LOCAL_FILE_HEADER),e.readLocalPart(this.reader),e.handleUTF8(),e.processAttributes()},readCentralDir:function(){var t;for(this.reader.setIndex(this.centralDirOffset);this.reader.readAndCheckSignature(DC.CENTRAL_FILE_HEADER);)(t=new MC({zip64:this.zip64},this.loadOptions)).readCentralPart(this.reader),this.files.push(t);if(this.centralDirRecords!==this.files.length&&0!==this.centralDirRecords&&0===this.files.length)throw new Error("Corrupted zip or bug: expected "+this.centralDirRecords+" records in central dir, got "+this.files.length)},readEndOfCentral:function(){var t=this.reader.lastIndexOfSignature(DC.CENTRAL_DIRECTORY_END);if(t<0)throw!this.isSignature(0,DC.LOCAL_FILE_HEADER)?new Error("Can't find end of central directory : is this a zip file ? If it is, see https://stuk.github.io/jszip/documentation/howto/read_zip.html"):new Error("Corrupted zip: can't find end of central directory");this.reader.setIndex(t);var e=t;if(this.checkSignature(DC.CENTRAL_DIRECTORY_END),this.readBlockEndOfCentral(),this.diskNumber===PC.MAX_VALUE_16BITS||this.diskWithCentralDirStart===PC.MAX_VALUE_16BITS||this.centralDirRecordsOnThisDisk===PC.MAX_VALUE_16BITS||this.centralDirRecords===PC.MAX_VALUE_16BITS||this.centralDirSize===PC.MAX_VALUE_32BITS||this.centralDirOffset===PC.MAX_VALUE_32BITS){if(this.zip64=!0,(t=this.reader.lastIndexOfSignature(DC.ZIP64_CENTRAL_DIRECTORY_LOCATOR))<0)throw new Error("Corrupted zip: can't find the ZIP64 end of central directory locator");if(this.reader.setIndex(t),this.checkSignature(DC.ZIP64_CENTRAL_DIRECTORY_LOCATOR),this.readBlockZip64EndOfCentralLocator(),!this.isSignature(this.relativeOffsetEndOfZip64CentralDir,DC.ZIP64_CENTRAL_DIRECTORY_END)&&(this.relativeOffsetEndOfZip64CentralDir=this.reader.lastIndexOfSignature(DC.ZIP64_CENTRAL_DIRECTORY_END),this.relativeOffsetEndOfZip64CentralDir<0))throw new Error("Corrupted zip: can't find the ZIP64 end of central directory");this.reader.setIndex(this.relativeOffsetEndOfZip64CentralDir),this.checkSignature(DC.ZIP64_CENTRAL_DIRECTORY_END),this.readBlockZip64EndOfCentral()}var r=this.centralDirOffset+this.centralDirSize;this.zip64&&(r+=20,r+=12+this.zip64EndOfCentralSize);var i=e-r;if(i>0)this.isSignature(e,DC.CENTRAL_FILE_HEADER)||(this.reader.zero=i);else if(i<0)throw new Error("Corrupted zip: missing "+Math.abs(i)+" bytes.")},prepareReader:function(t){this.reader=LC(t)},load:function(t){this.prepareReader(t),this.readEndOfCentral(),this.readCentralDir(),this.readLocalFiles()}};var FC=NC,jC=cw(),zC=hw,HC=s_,WC=FC,UC=jw,$C=ow;function VC(t){return new zC.Promise((function(e,r){var i=t.decompressed.getContentWorker().pipe(new UC);i.on("error",(function(t){r(t)})).on("end",(function(){i.streamInfo.crc32!==t.decompressed.crc32?r(new Error("Corrupted zip : CRC32 mismatch")):e()})).resume()}))}function GC(){if(!(this instanceof GC))return new GC;if(arguments.length)throw new Error("The constructor with parameters has been removed in JSZip 3.0, please check the upgrade guide.");this.files=Object.create(null),this.comment=null,this.root="",this.clone=function(){var t=new GC;for(var e in this)"function"!=typeof this[e]&&(t[e]=this[e]);return t}}GC.prototype=tC,GC.prototype.loadAsync=function(t,e){var r=this;return e=jC.extend(e||{},{base64:!1,checkCRC32:!1,optimizedBinaryString:!1,createFolders:!1,decodeFileName:HC.utf8decode}),$C.isNode&&$C.isStream(t)?zC.Promise.reject(new Error("JSZip can't accept a stream when loading a zip file.")):jC.prepareContent("the loaded zip file",t,!0,e.optimizedBinaryString,e.base64).then((function(t){var r=new WC(e);return r.load(t),r})).then((function(t){var r=[zC.Promise.resolve(t)],i=t.files;if(e.checkCRC32)for(var n=0;n<i.length;n++)r.push(VC(i[n]));return zC.Promise.all(r)})).then((function(t){for(var i=t.shift(),n=i.files,s=0;s<n.length;s++){var o=n[s],a=o.fileNameStr,l=jC.resolve(o.fileNameStr);r.file(l,o.decompressed,{binary:!0,optimizedBinaryString:!0,date:o.date,dir:o.dir,comment:o.fileCommentStr.length?o.fileCommentStr:null,unixPermissions:o.unixPermissions,dosPermissions:o.dosPermissions,createFolders:e.createFolders}),o.dir||(r.file(l).unsafeOriginalName=a)}return i.zipComment.length&&(r.comment=i.zipComment),r}))},GC.support=a_,GC.defaults=Aw,GC.version="3.10.1",GC.loadAsync=function(t,e){return(new GC).loadAsync(t,e)},GC.external=hw;var XC,YC,qC,ZC,KC,QC,JC=GC,tE={exports:{}};function eE(){return YC?XC:(YC=1,XC=n)}function rE(){if(ZC)return qC;function t(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);e&&(i=i.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,i)}return r}function e(e){for(var i=1;i<arguments.length;i++){var n=null!=arguments[i]?arguments[i]:{};i%2?t(Object(n),!0).forEach((function(t){r(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):t(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function r(t,e,r){return(e=n(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function i(t,e){for(var r=0;r<e.length;r++){var i=e[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,n(i.key),i)}}function n(t){var e=function(t,e){if("object"!=typeof t||null===t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var i=r.call(t,e||"default");if("object"!=typeof i)return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==typeof e?e:String(e)}ZC=1;var s=o.Buffer,l=a.inspect,h=l&&l.custom||"inspect";function c(t,e,r){s.prototype.copy.call(t,e,r)}return qC=function(){function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.head=null,this.tail=null,this.length=0}var r,n,o;return r=t,n=[{key:"push",value:function(t){var e={data:t,next:null};this.length>0?this.tail.next=e:this.head=e,this.tail=e,++this.length}},{key:"unshift",value:function(t){var e={data:t,next:this.head};0===this.length&&(this.tail=e),this.head=e,++this.length}},{key:"shift",value:function(){if(0!==this.length){var t=this.head.data;return 1===this.length?this.head=this.tail=null:this.head=this.head.next,--this.length,t}}},{key:"clear",value:function(){this.head=this.tail=null,this.length=0}},{key:"join",value:function(t){if(0===this.length)return"";for(var e=this.head,r=""+e.data;e=e.next;)r+=t+e.data;return r}},{key:"concat",value:function(t){if(0===this.length)return s.alloc(0);for(var e=s.allocUnsafe(t>>>0),r=this.head,i=0;r;)c(r.data,e,i),i+=r.data.length,r=r.next;return e}},{key:"consume",value:function(t,e){var r;return t<this.head.data.length?(r=this.head.data.slice(0,t),this.head.data=this.head.data.slice(t)):r=t===this.head.data.length?this.shift():e?this._getString(t):this._getBuffer(t),r}},{key:"first",value:function(){return this.head.data}},{key:"_getString",value:function(t){var e=this.head,r=1,i=e.data;for(t-=i.length;e=e.next;){var n=e.data,s=t>n.length?n.length:t;if(s===n.length?i+=n:i+=n.slice(0,t),0==(t-=s)){s===n.length?(++r,e.next?this.head=e.next:this.head=this.tail=null):(this.head=e,e.data=n.slice(s));break}++r}return this.length-=r,i}},{key:"_getBuffer",value:function(t){var e=s.allocUnsafe(t),r=this.head,i=1;for(r.data.copy(e),t-=r.data.length;r=r.next;){var n=r.data,o=t>n.length?n.length:t;if(n.copy(e,e.length-t,0,o),0==(t-=o)){o===n.length?(++i,r.next?this.head=r.next:this.head=this.tail=null):(this.head=r,r.data=n.slice(o));break}++i}return this.length-=i,e}},{key:h,value:function(t,r){return l(this,e(e({},r),{},{depth:0,customInspect:!1}))}}],n&&i(r.prototype,n),o&&i(r,o),Object.defineProperty(r,"prototype",{writable:!1}),t}(),qC}function iE(){if(QC)return KC;function t(t,i){r(t,i),e(t)}function e(t){t._writableState&&!t._writableState.emitClose||t._readableState&&!t._readableState.emitClose||t.emit("close")}function r(t,e){t.emit("error",e)}return QC=1,KC={destroy:function(i,n){var s=this,o=this._readableState&&this._readableState.destroyed,a=this._writableState&&this._writableState.destroyed;return o||a?(n?n(i):i&&(this._writableState?this._writableState.errorEmitted||(this._writableState.errorEmitted=!0,process.nextTick(r,this,i)):process.nextTick(r,this,i)),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(i||null,(function(r){!n&&r?s._writableState?s._writableState.errorEmitted?process.nextTick(e,s):(s._writableState.errorEmitted=!0,process.nextTick(t,s,r)):process.nextTick(t,s,r):n?(process.nextTick(e,s),n(r)):process.nextTick(e,s)})),this)},undestroy:function(){this._readableState&&(this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1),this._writableState&&(this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finalCalled=!1,this._writableState.prefinished=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1)},errorOrDestroy:function(t,e){var r=t._readableState,i=t._writableState;r&&r.autoDestroy||i&&i.autoDestroy?t.destroy(e):t.emit("error",e)}},KC}var nE,sE,oE,aE,lE,hE,cE,uE={};function dE(){if(nE)return uE;nE=1;const t={};function e(e,r,i){i||(i=Error);class n extends i{constructor(t,e,i){super(function(t,e,i){return"string"==typeof r?r:r(t,e,i)}(t,e,i))}}n.prototype.name=i.name,n.prototype.code=e,t[e]=n}function r(t,e){if(Array.isArray(t)){const r=t.length;return t=t.map((t=>String(t))),r>2?`one of ${e} ${t.slice(0,r-1).join(", ")}, or `+t[r-1]:2===r?`one of ${e} ${t[0]} or ${t[1]}`:`of ${e} ${t[0]}`}return`of ${e} ${String(t)}`}return e("ERR_INVALID_OPT_VALUE",(function(t,e){return'The value "'+e+'" is invalid for option "'+t+'"'}),TypeError),e("ERR_INVALID_ARG_TYPE",(function(t,e,i){let n;var s,o;let a;if("string"==typeof e&&(s="not ",e.substr(!o||o<0?0:+o,s.length)===s)?(n="must not be",e=e.replace(/^not /,"")):n="must be",function(t,e,r){return(void 0===r||r>t.length)&&(r=t.length),t.substring(r-e.length,r)===e}(t," argument"))a=`The ${t} ${n} ${r(e,"type")}`;else{const i=function(t,e,r){return"number"!=typeof r&&(r=0),!(r+e.length>t.length)&&-1!==t.indexOf(e,r)}(t,".")?"property":"argument";a=`The "${t}" ${i} ${n} ${r(e,"type")}`}return a+=". Received type "+typeof i,a}),TypeError),e("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF"),e("ERR_METHOD_NOT_IMPLEMENTED",(function(t){return"The "+t+" method is not implemented"})),e("ERR_STREAM_PREMATURE_CLOSE","Premature close"),e("ERR_STREAM_DESTROYED",(function(t){return"Cannot call "+t+" after a stream was destroyed"})),e("ERR_MULTIPLE_CALLBACK","Callback called multiple times"),e("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable"),e("ERR_STREAM_WRITE_AFTER_END","write after end"),e("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError),e("ERR_UNKNOWN_ENCODING",(function(t){return"Unknown encoding: "+t}),TypeError),e("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event"),uE.codes=t,uE}function pE(){if(oE)return sE;oE=1;var t=dE().codes.ERR_INVALID_OPT_VALUE;return sE={getHighWaterMark:function(e,r,i,n){var s=function(t,e,r){return null!=t.highWaterMark?t.highWaterMark:e?t[r]:null}(r,n,i);if(null!=s){if(!isFinite(s)||Math.floor(s)!==s||s<0)throw new t(n?i:"highWaterMark",s);return Math.floor(s)}return e.objectMode?16:16384}}}function fE(){if(lE)return aE;function t(t){var e=this;this.next=null,this.entry=null,this.finish=function(){!function(t,e,r){var i=t.entry;t.entry=null;for(;i;){var n=i.callback;e.pendingcb--,n(r),i=i.next}e.corkedRequestsFree.next=t}(e,t)}}var e;lE=1,aE=x,x.WritableState=w;var r={deprecate:M_()},i=eE(),n=o.Buffer,s=(void 0!==dt?dt:"undefined"!=typeof window?window:"undefined"!=typeof self?self:{}).Uint8Array||function(){};var a,l=iE(),h=pE().getHighWaterMark,c=dE().codes,u=c.ERR_INVALID_ARG_TYPE,d=c.ERR_METHOD_NOT_IMPLEMENTED,p=c.ERR_MULTIPLE_CALLBACK,f=c.ERR_STREAM_CANNOT_PIPE,g=c.ERR_STREAM_DESTROYED,m=c.ERR_STREAM_NULL_VALUES,y=c.ERR_STREAM_WRITE_AFTER_END,v=c.ERR_UNKNOWN_ENCODING,b=l.errorOrDestroy;function _(){}function w(r,i,n){e=e||gE(),r=r||{},"boolean"!=typeof n&&(n=i instanceof e),this.objectMode=!!r.objectMode,n&&(this.objectMode=this.objectMode||!!r.writableObjectMode),this.highWaterMark=h(this,r,"writableHighWaterMark",n),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var s=!1===r.decodeStrings;this.decodeStrings=!s,this.defaultEncoding=r.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(t){!function(t,e){var r=t._writableState,i=r.sync,n=r.writecb;if("function"!=typeof n)throw new p;if(function(t){t.writing=!1,t.writecb=null,t.length-=t.writelen,t.writelen=0}(r),e)!function(t,e,r,i,n){--e.pendingcb,r?(process.nextTick(n,i),process.nextTick(A,t,e),t._writableState.errorEmitted=!0,b(t,i)):(n(i),t._writableState.errorEmitted=!0,b(t,i),A(t,e))}(t,r,i,e,n);else{var s=C(r)||t.destroyed;s||r.corked||r.bufferProcessing||!r.bufferedRequest||k(t,r),i?process.nextTick(T,t,r,s,n):T(t,r,s,n)}}(i,t)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.emitClose=!1!==r.emitClose,this.autoDestroy=!!r.autoDestroy,this.bufferedRequestCount=0,this.corkedRequestsFree=new t(this)}function x(t){var r=this instanceof(e=e||gE());if(!r&&!a.call(x,this))return new x(t);this._writableState=new w(t,this,r),this.writable=!0,t&&("function"==typeof t.write&&(this._write=t.write),"function"==typeof t.writev&&(this._writev=t.writev),"function"==typeof t.destroy&&(this._destroy=t.destroy),"function"==typeof t.final&&(this._final=t.final)),i.call(this)}function S(t,e,r,i,n,s,o){e.writelen=i,e.writecb=o,e.writing=!0,e.sync=!0,e.destroyed?e.onwrite(new g("write")):r?t._writev(n,e.onwrite):t._write(n,s,e.onwrite),e.sync=!1}function T(t,e,r,i){r||function(t,e){0===e.length&&e.needDrain&&(e.needDrain=!1,t.emit("drain"))}(t,e),e.pendingcb--,i(),A(t,e)}function k(e,r){r.bufferProcessing=!0;var i=r.bufferedRequest;if(e._writev&&i&&i.next){var n=r.bufferedRequestCount,s=new Array(n),o=r.corkedRequestsFree;o.entry=i;for(var a=0,l=!0;i;)s[a]=i,i.isBuf||(l=!1),i=i.next,a+=1;s.allBuffers=l,S(e,r,!0,r.length,s,"",o.finish),r.pendingcb++,r.lastBufferedRequest=null,o.next?(r.corkedRequestsFree=o.next,o.next=null):r.corkedRequestsFree=new t(r),r.bufferedRequestCount=0}else{for(;i;){var h=i.chunk,c=i.encoding,u=i.callback;if(S(e,r,!1,r.objectMode?1:h.length,h,c,u),i=i.next,r.bufferedRequestCount--,r.writing)break}null===i&&(r.lastBufferedRequest=null)}r.bufferedRequest=i,r.bufferProcessing=!1}function C(t){return t.ending&&0===t.length&&null===t.bufferedRequest&&!t.finished&&!t.writing}function E(t,e){t._final((function(r){e.pendingcb--,r&&b(t,r),e.prefinished=!0,t.emit("prefinish"),A(t,e)}))}function A(t,e){var r=C(e);if(r&&(function(t,e){e.prefinished||e.finalCalled||("function"!=typeof t._final||e.destroyed?(e.prefinished=!0,t.emit("prefinish")):(e.pendingcb++,e.finalCalled=!0,process.nextTick(E,t,e)))}(t,e),0===e.pendingcb&&(e.finished=!0,t.emit("finish"),e.autoDestroy))){var i=t._readableState;(!i||i.autoDestroy&&i.endEmitted)&&t.destroy()}return r}return x_()(x,i),w.prototype.getBuffer=function(){for(var t=this.bufferedRequest,e=[];t;)e.push(t),t=t.next;return e},function(){try{Object.defineProperty(w.prototype,"buffer",{get:r.deprecate((function(){return this.getBuffer()}),"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch(t){}}(),"function"==typeof Symbol&&Symbol.hasInstance&&"function"==typeof Function.prototype[Symbol.hasInstance]?(a=Function.prototype[Symbol.hasInstance],Object.defineProperty(x,Symbol.hasInstance,{value:function(t){return!!a.call(this,t)||this===x&&(t&&t._writableState instanceof w)}})):a=function(t){return t instanceof this},x.prototype.pipe=function(){b(this,new f)},x.prototype.write=function(t,e,r){var i,o=this._writableState,a=!1,l=!o.objectMode&&(i=t,n.isBuffer(i)||i instanceof s);return l&&!n.isBuffer(t)&&(t=function(t){return n.from(t)}(t)),"function"==typeof e&&(r=e,e=null),l?e="buffer":e||(e=o.defaultEncoding),"function"!=typeof r&&(r=_),o.ending?function(t,e){var r=new y;b(t,r),process.nextTick(e,r)}(this,r):(l||function(t,e,r,i){var n;return null===r?n=new m:"string"==typeof r||e.objectMode||(n=new u("chunk",["string","Buffer"],r)),!n||(b(t,n),process.nextTick(i,n),!1)}(this,o,t,r))&&(o.pendingcb++,a=function(t,e,r,i,s,o){if(!r){var a=function(t,e,r){t.objectMode||!1===t.decodeStrings||"string"!=typeof e||(e=n.from(e,r));return e}(e,i,s);i!==a&&(r=!0,s="buffer",i=a)}var l=e.objectMode?1:i.length;e.length+=l;var h=e.length<e.highWaterMark;h||(e.needDrain=!0);if(e.writing||e.corked){var c=e.lastBufferedRequest;e.lastBufferedRequest={chunk:i,encoding:s,isBuf:r,callback:o,next:null},c?c.next=e.lastBufferedRequest:e.bufferedRequest=e.lastBufferedRequest,e.bufferedRequestCount+=1}else S(t,e,!1,l,i,s,o);return h}(this,o,l,t,e,r)),a},x.prototype.cork=function(){this._writableState.corked++},x.prototype.uncork=function(){var t=this._writableState;t.corked&&(t.corked--,t.writing||t.corked||t.bufferProcessing||!t.bufferedRequest||k(this,t))},x.prototype.setDefaultEncoding=function(t){if("string"==typeof t&&(t=t.toLowerCase()),!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((t+"").toLowerCase())>-1))throw new v(t);return this._writableState.defaultEncoding=t,this},Object.defineProperty(x.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(x.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),x.prototype._write=function(t,e,r){r(new d("_write()"))},x.prototype._writev=null,x.prototype.end=function(t,e,r){var i=this._writableState;return"function"==typeof t?(r=t,t=null,e=null):"function"==typeof e&&(r=e,e=null),null!=t&&this.write(t,e),i.corked&&(i.corked=1,this.uncork()),i.ending||function(t,e,r){e.ending=!0,A(t,e),r&&(e.finished?process.nextTick(r):t.once("finish",r));e.ended=!0,t.writable=!1}(this,i,r),this},Object.defineProperty(x.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}}),Object.defineProperty(x.prototype,"destroyed",{enumerable:!1,get:function(){return void 0!==this._writableState&&this._writableState.destroyed},set:function(t){this._writableState&&(this._writableState.destroyed=t)}}),x.prototype.destroy=l.destroy,x.prototype._undestroy=l.undestroy,x.prototype._destroy=function(t,e){e(t)},aE}function gE(){if(cE)return hE;cE=1;var t=Object.keys||function(t){var e=[];for(var r in t)e.push(r);return e};hE=o;var e=FE(),r=fE();x_()(o,e);for(var i=t(r.prototype),n=0;n<i.length;n++){var s=i[n];o.prototype[s]||(o.prototype[s]=r.prototype[s])}function o(t){if(!(this instanceof o))return new o(t);e.call(this,t),r.call(this,t),this.allowHalfOpen=!0,t&&(!1===t.readable&&(this.readable=!1),!1===t.writable&&(this.writable=!1),!1===t.allowHalfOpen&&(this.allowHalfOpen=!1,this.once("end",a)))}function a(){this._writableState.ended||process.nextTick(l,this)}function l(t){t.end()}return Object.defineProperty(o.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),Object.defineProperty(o.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(o.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}}),Object.defineProperty(o.prototype,"destroyed",{enumerable:!1,get:function(){return void 0!==this._readableState&&void 0!==this._writableState&&(this._readableState.destroyed&&this._writableState.destroyed)},set:function(t){void 0!==this._readableState&&void 0!==this._writableState&&(this._readableState.destroyed=t,this._writableState.destroyed=t)}}),hE}var mE,yE,vE,bE,_E,wE,xE,SE,TE,kE,CE,EE,AE,OE,BE,RE,LE={},PE={exports:{}};function DE(){if(yE)return LE;yE=1;var t=(mE||(mE=1,function(t,e){var r=o,i=r.Buffer;function n(t,e){for(var r in t)e[r]=t[r]}function s(t,e,r){return i(t,e,r)}i.from&&i.alloc&&i.allocUnsafe&&i.allocUnsafeSlow?t.exports=r:(n(r,e),e.Buffer=s),s.prototype=Object.create(i.prototype),n(i,s),s.from=function(t,e,r){if("number"==typeof t)throw new TypeError("Argument must not be a number");return i(t,e,r)},s.alloc=function(t,e,r){if("number"!=typeof t)throw new TypeError("Argument must be a number");var n=i(t);return void 0!==e?"string"==typeof r?n.fill(e,r):n.fill(e):n.fill(0),n},s.allocUnsafe=function(t){if("number"!=typeof t)throw new TypeError("Argument must be a number");return i(t)},s.allocUnsafeSlow=function(t){if("number"!=typeof t)throw new TypeError("Argument must be a number");return r.SlowBuffer(t)}}(PE,PE.exports)),PE.exports).Buffer,e=t.isEncoding||function(t){switch((t=""+t)&&t.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};function r(r){var i;switch(this.encoding=function(r){var i=function(t){if(!t)return"utf8";for(var e;;)switch(t){case"utf8":case"utf-8":return"utf8";case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return"utf16le";case"latin1":case"binary":return"latin1";case"base64":case"ascii":case"hex":return t;default:if(e)return;t=(""+t).toLowerCase(),e=!0}}(r);if("string"!=typeof i&&(t.isEncoding===e||!e(r)))throw new Error("Unknown encoding: "+r);return i||r}(r),this.encoding){case"utf16le":this.text=s,this.end=a,i=4;break;case"utf8":this.fillLast=n,i=4;break;case"base64":this.text=l,this.end=h,i=3;break;default:return this.write=c,void(this.end=u)}this.lastNeed=0,this.lastTotal=0,this.lastChar=t.allocUnsafe(i)}function i(t){return t<=127?0:t>>5==6?2:t>>4==14?3:t>>3==30?4:t>>6==2?-1:-2}function n(t){var e=this.lastTotal-this.lastNeed,r=function(t,e,r){if(128!=(192&e[0]))return t.lastNeed=0,"�";if(t.lastNeed>1&&e.length>1){if(128!=(192&e[1]))return t.lastNeed=1,"�";if(t.lastNeed>2&&e.length>2&&128!=(192&e[2]))return t.lastNeed=2,"�"}}(this,t);return void 0!==r?r:this.lastNeed<=t.length?(t.copy(this.lastChar,e,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal)):(t.copy(this.lastChar,e,0,t.length),void(this.lastNeed-=t.length))}function s(t,e){if((t.length-e)%2==0){var r=t.toString("utf16le",e);if(r){var i=r.charCodeAt(r.length-1);if(i>=55296&&i<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=t[t.length-2],this.lastChar[1]=t[t.length-1],r.slice(0,-1)}return r}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=t[t.length-1],t.toString("utf16le",e,t.length-1)}function a(t){var e=t&&t.length?this.write(t):"";if(this.lastNeed){var r=this.lastTotal-this.lastNeed;return e+this.lastChar.toString("utf16le",0,r)}return e}function l(t,e){var r=(t.length-e)%3;return 0===r?t.toString("base64",e):(this.lastNeed=3-r,this.lastTotal=3,1===r?this.lastChar[0]=t[t.length-1]:(this.lastChar[0]=t[t.length-2],this.lastChar[1]=t[t.length-1]),t.toString("base64",e,t.length-r))}function h(t){var e=t&&t.length?this.write(t):"";return this.lastNeed?e+this.lastChar.toString("base64",0,3-this.lastNeed):e}function c(t){return t.toString(this.encoding)}function u(t){return t&&t.length?this.write(t):""}return LE.StringDecoder=r,r.prototype.write=function(t){if(0===t.length)return"";var e,r;if(this.lastNeed){if(void 0===(e=this.fillLast(t)))return"";r=this.lastNeed,this.lastNeed=0}else r=0;return r<t.length?e?e+this.text(t,r):this.text(t,r):e||""},r.prototype.end=function(t){var e=t&&t.length?this.write(t):"";return this.lastNeed?e+"�":e},r.prototype.text=function(t,e){var r=function(t,e,r){var n=e.length-1;if(n<r)return 0;var s=i(e[n]);if(s>=0)return s>0&&(t.lastNeed=s-1),s;if(--n<r||-2===s)return 0;if(s=i(e[n]),s>=0)return s>0&&(t.lastNeed=s-2),s;if(--n<r||-2===s)return 0;if(s=i(e[n]),s>=0)return s>0&&(2===s?s=0:t.lastNeed=s-3),s;return 0}(this,t,e);if(!this.lastNeed)return t.toString("utf8",e);this.lastTotal=r;var n=t.length-(r-this.lastNeed);return t.copy(this.lastChar,0,n),t.toString("utf8",e,n)},r.prototype.fillLast=function(t){if(this.lastNeed<=t.length)return t.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);t.copy(this.lastChar,this.lastTotal-this.lastNeed,0,t.length),this.lastNeed-=t.length},LE}function ME(){if(bE)return vE;bE=1;var t=dE().codes.ERR_STREAM_PREMATURE_CLOSE;function e(){}return vE=function r(i,n,s){if("function"==typeof n)return r(i,null,n);n||(n={}),s=function(t){var e=!1;return function(){if(!e){e=!0;for(var r=arguments.length,i=new Array(r),n=0;n<r;n++)i[n]=arguments[n];t.apply(this,i)}}}(s||e);var o=n.readable||!1!==n.readable&&i.readable,a=n.writable||!1!==n.writable&&i.writable,l=function(){i.writable||c()},h=i._writableState&&i._writableState.finished,c=function(){a=!1,h=!0,o||s.call(i)},u=i._readableState&&i._readableState.endEmitted,d=function(){o=!1,u=!0,a||s.call(i)},p=function(t){s.call(i,t)},f=function(){var e;return o&&!u?(i._readableState&&i._readableState.ended||(e=new t),s.call(i,e)):a&&!h?(i._writableState&&i._writableState.ended||(e=new t),s.call(i,e)):void 0},g=function(){i.req.on("finish",c)};return!function(t){return t.setHeader&&"function"==typeof t.abort}(i)?a&&!i._writableState&&(i.on("end",l),i.on("close",l)):(i.on("complete",c),i.on("abort",f),i.req?g():i.on("request",g)),i.on("end",d),i.on("finish",c),!1!==n.error&&i.on("error",p),i.on("close",f),function(){i.removeListener("complete",c),i.removeListener("abort",f),i.removeListener("request",g),i.req&&i.req.removeListener("finish",c),i.removeListener("end",l),i.removeListener("close",l),i.removeListener("finish",c),i.removeListener("end",d),i.removeListener("error",p),i.removeListener("close",f)}},vE}function IE(){if(wE)return _E;var t;function e(t,e,r){return(e=function(t){var e=function(t,e){if("object"!=typeof t||null===t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var i=r.call(t,e||"default");if("object"!=typeof i)return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==typeof e?e:String(e)}(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}wE=1;var r=ME(),i=Symbol("lastResolve"),n=Symbol("lastReject"),s=Symbol("error"),o=Symbol("ended"),a=Symbol("lastPromise"),l=Symbol("handlePromise"),h=Symbol("stream");function c(t,e){return{value:t,done:e}}function u(t){var e=t[i];if(null!==e){var r=t[h].read();null!==r&&(t[a]=null,t[i]=null,t[n]=null,e(c(r,!1)))}}function d(t){process.nextTick(u,t)}var p=Object.getPrototypeOf((function(){})),f=Object.setPrototypeOf((t={get stream(){return this[h]},next:function(){var t=this,e=this[s];if(null!==e)return Promise.reject(e);if(this[o])return Promise.resolve(c(void 0,!0));if(this[h].destroyed)return new Promise((function(e,r){process.nextTick((function(){t[s]?r(t[s]):e(c(void 0,!0))}))}));var r,i=this[a];if(i)r=new Promise(function(t,e){return function(r,i){t.then((function(){e[o]?r(c(void 0,!0)):e[l](r,i)}),i)}}(i,this));else{var n=this[h].read();if(null!==n)return Promise.resolve(c(n,!1));r=new Promise(this[l])}return this[a]=r,r}},e(t,Symbol.asyncIterator,(function(){return this})),e(t,"return",(function(){var t=this;return new Promise((function(e,r){t[h].destroy(null,(function(t){t?r(t):e(c(void 0,!0))}))}))})),t),p);return _E=function(t){var u,p=Object.create(f,(e(u={},h,{value:t,writable:!0}),e(u,i,{value:null,writable:!0}),e(u,n,{value:null,writable:!0}),e(u,s,{value:null,writable:!0}),e(u,o,{value:t._readableState.endEmitted,writable:!0}),e(u,l,{value:function(t,e){var r=p[h].read();r?(p[a]=null,p[i]=null,p[n]=null,t(c(r,!1))):(p[i]=t,p[n]=e)},writable:!0}),u));return p[a]=null,r(t,(function(t){if(t&&"ERR_STREAM_PREMATURE_CLOSE"!==t.code){var e=p[n];return null!==e&&(p[a]=null,p[i]=null,p[n]=null,e(t)),void(p[s]=t)}var r=p[i];null!==r&&(p[a]=null,p[i]=null,p[n]=null,r(c(void 0,!0))),p[o]=!0})),t.on("readable",d.bind(null,p)),p},_E}function NE(){if(SE)return xE;function t(t,e,r,i,n,s,o){try{var a=t[s](o),l=a.value}catch(t){return void r(t)}a.done?e(l):Promise.resolve(l).then(i,n)}function e(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);e&&(i=i.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,i)}return r}function r(t,e,r){return(e=function(t){var e=function(t,e){if("object"!=typeof t||null===t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var i=r.call(t,e||"default");if("object"!=typeof i)return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==typeof e?e:String(e)}(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}SE=1;var i=dE().codes.ERR_INVALID_ARG_TYPE;return xE=function(n,s,o){var a;if(s&&"function"==typeof s.next)a=s;else if(s&&s[Symbol.asyncIterator])a=s[Symbol.asyncIterator]();else{if(!s||!s[Symbol.iterator])throw new i("iterable",["Iterable"],s);a=s[Symbol.iterator]()}var l=new n(function(t){for(var i=1;i<arguments.length;i++){var n=null!=arguments[i]?arguments[i]:{};i%2?e(Object(n),!0).forEach((function(e){r(t,e,n[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):e(Object(n)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}))}return t}({objectMode:!0},o)),h=!1;function c(){return u.apply(this,arguments)}function u(){var e;return e=function*(){try{var t=yield a.next(),e=t.value;t.done?l.push(null):l.push(yield e)?c():h=!1}catch(t){l.destroy(t)}},u=function(){var r=this,i=arguments;return new Promise((function(n,s){var o=e.apply(r,i);function a(e){t(o,n,s,a,l,"next",e)}function l(e){t(o,n,s,a,l,"throw",e)}a(void 0)}))},u.apply(this,arguments)}return l._read=function(){h||(h=!0,c())},l},xE}function FE(){if(kE)return TE;var t;kE=1,TE=T,T.ReadableState=S,s.EventEmitter;var e=function(t,e){return t.listeners(e).length},r=eE(),i=o.Buffer,n=(void 0!==dt?dt:"undefined"!=typeof window?window:"undefined"!=typeof self?self:{}).Uint8Array||function(){};var l,h=a;l=h&&h.debuglog?h.debuglog("stream"):function(){};var c,u,d,p=rE(),f=iE(),g=pE().getHighWaterMark,m=dE().codes,y=m.ERR_INVALID_ARG_TYPE,v=m.ERR_STREAM_PUSH_AFTER_EOF,b=m.ERR_METHOD_NOT_IMPLEMENTED,_=m.ERR_STREAM_UNSHIFT_AFTER_END_EVENT;x_()(T,r);var w=f.errorOrDestroy,x=["error","close","destroy","pause","resume"];function S(e,r,i){t=t||gE(),e=e||{},"boolean"!=typeof i&&(i=r instanceof t),this.objectMode=!!e.objectMode,i&&(this.objectMode=this.objectMode||!!e.readableObjectMode),this.highWaterMark=g(this,e,"readableHighWaterMark",i),this.buffer=new p,this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this.paused=!0,this.emitClose=!1!==e.emitClose,this.autoDestroy=!!e.autoDestroy,this.destroyed=!1,this.defaultEncoding=e.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,e.encoding&&(c||(c=DE().StringDecoder),this.decoder=new c(e.encoding),this.encoding=e.encoding)}function T(e){if(t=t||gE(),!(this instanceof T))return new T(e);var i=this instanceof t;this._readableState=new S(e,this,i),this.readable=!0,e&&("function"==typeof e.read&&(this._read=e.read),"function"==typeof e.destroy&&(this._destroy=e.destroy)),r.call(this)}function k(t,e,r,s,o){l("readableAddChunk",e);var a,h=t._readableState;if(null===e)h.reading=!1,function(t,e){if(l("onEofChunk"),e.ended)return;if(e.decoder){var r=e.decoder.end();r&&r.length&&(e.buffer.push(r),e.length+=e.objectMode?1:r.length)}e.ended=!0,e.sync?O(t):(e.needReadable=!1,e.emittedReadable||(e.emittedReadable=!0,B(t)))}(t,h);else if(o||(a=function(t,e){var r;s=e,i.isBuffer(s)||s instanceof n||"string"==typeof e||void 0===e||t.objectMode||(r=new y("chunk",["string","Buffer","Uint8Array"],e));var s;return r}(h,e)),a)w(t,a);else if(h.objectMode||e&&e.length>0)if("string"==typeof e||h.objectMode||Object.getPrototypeOf(e)===i.prototype||(e=function(t){return i.from(t)}(e)),s)h.endEmitted?w(t,new _):C(t,h,e,!0);else if(h.ended)w(t,new v);else{if(h.destroyed)return!1;h.reading=!1,h.decoder&&!r?(e=h.decoder.write(e),h.objectMode||0!==e.length?C(t,h,e,!1):R(t,h)):C(t,h,e,!1)}else s||(h.reading=!1,R(t,h));return!h.ended&&(h.length<h.highWaterMark||0===h.length)}function C(t,e,r,i){e.flowing&&0===e.length&&!e.sync?(e.awaitDrain=0,t.emit("data",r)):(e.length+=e.objectMode?1:r.length,i?e.buffer.unshift(r):e.buffer.push(r),e.needReadable&&O(t)),R(t,e)}Object.defineProperty(T.prototype,"destroyed",{enumerable:!1,get:function(){return void 0!==this._readableState&&this._readableState.destroyed},set:function(t){this._readableState&&(this._readableState.destroyed=t)}}),T.prototype.destroy=f.destroy,T.prototype._undestroy=f.undestroy,T.prototype._destroy=function(t,e){e(t)},T.prototype.push=function(t,e){var r,n=this._readableState;return n.objectMode?r=!0:"string"==typeof t&&((e=e||n.defaultEncoding)!==n.encoding&&(t=i.from(t,e),e=""),r=!0),k(this,t,e,!1,r)},T.prototype.unshift=function(t){return k(this,t,null,!0,!1)},T.prototype.isPaused=function(){return!1===this._readableState.flowing},T.prototype.setEncoding=function(t){c||(c=DE().StringDecoder);var e=new c(t);this._readableState.decoder=e,this._readableState.encoding=this._readableState.decoder.encoding;for(var r=this._readableState.buffer.head,i="";null!==r;)i+=e.write(r.data),r=r.next;return this._readableState.buffer.clear(),""!==i&&this._readableState.buffer.push(i),this._readableState.length=i.length,this};var E=1073741824;function A(t,e){return t<=0||0===e.length&&e.ended?0:e.objectMode?1:t!=t?e.flowing&&e.length?e.buffer.head.data.length:e.length:(t>e.highWaterMark&&(e.highWaterMark=function(t){return t>=E?t=E:(t--,t|=t>>>1,t|=t>>>2,t|=t>>>4,t|=t>>>8,t|=t>>>16,t++),t}(t)),t<=e.length?t:e.ended?e.length:(e.needReadable=!0,0))}function O(t){var e=t._readableState;l("emitReadable",e.needReadable,e.emittedReadable),e.needReadable=!1,e.emittedReadable||(l("emitReadable",e.flowing),e.emittedReadable=!0,process.nextTick(B,t))}function B(t){var e=t._readableState;l("emitReadable_",e.destroyed,e.length,e.ended),e.destroyed||!e.length&&!e.ended||(t.emit("readable"),e.emittedReadable=!1),e.needReadable=!e.flowing&&!e.ended&&e.length<=e.highWaterMark,I(t)}function R(t,e){e.readingMore||(e.readingMore=!0,process.nextTick(L,t,e))}function L(t,e){for(;!e.reading&&!e.ended&&(e.length<e.highWaterMark||e.flowing&&0===e.length);){var r=e.length;if(l("maybeReadMore read 0"),t.read(0),r===e.length)break}e.readingMore=!1}function P(t){var e=t._readableState;e.readableListening=t.listenerCount("readable")>0,e.resumeScheduled&&!e.paused?e.flowing=!0:t.listenerCount("data")>0&&t.resume()}function D(t){l("readable nexttick read 0"),t.read(0)}function M(t,e){l("resume",e.reading),e.reading||t.read(0),e.resumeScheduled=!1,t.emit("resume"),I(t),e.flowing&&!e.reading&&t.read(0)}function I(t){var e=t._readableState;for(l("flow",e.flowing);e.flowing&&null!==t.read(););}function N(t,e){return 0===e.length?null:(e.objectMode?r=e.buffer.shift():!t||t>=e.length?(r=e.decoder?e.buffer.join(""):1===e.buffer.length?e.buffer.first():e.buffer.concat(e.length),e.buffer.clear()):r=e.buffer.consume(t,e.decoder),r);var r}function F(t){var e=t._readableState;l("endReadable",e.endEmitted),e.endEmitted||(e.ended=!0,process.nextTick(j,e,t))}function j(t,e){if(l("endReadableNT",t.endEmitted,t.length),!t.endEmitted&&0===t.length&&(t.endEmitted=!0,e.readable=!1,e.emit("end"),t.autoDestroy)){var r=e._writableState;(!r||r.autoDestroy&&r.finished)&&e.destroy()}}function z(t,e){for(var r=0,i=t.length;r<i;r++)if(t[r]===e)return r;return-1}return T.prototype.read=function(t){l("read",t),t=parseInt(t,10);var e=this._readableState,r=t;if(0!==t&&(e.emittedReadable=!1),0===t&&e.needReadable&&((0!==e.highWaterMark?e.length>=e.highWaterMark:e.length>0)||e.ended))return l("read: emitReadable",e.length,e.ended),0===e.length&&e.ended?F(this):O(this),null;if(0===(t=A(t,e))&&e.ended)return 0===e.length&&F(this),null;var i,n=e.needReadable;return l("need readable",n),(0===e.length||e.length-t<e.highWaterMark)&&l("length less than watermark",n=!0),e.ended||e.reading?l("reading or ended",n=!1):n&&(l("do read"),e.reading=!0,e.sync=!0,0===e.length&&(e.needReadable=!0),this._read(e.highWaterMark),e.sync=!1,e.reading||(t=A(r,e))),null===(i=t>0?N(t,e):null)?(e.needReadable=e.length<=e.highWaterMark,t=0):(e.length-=t,e.awaitDrain=0),0===e.length&&(e.ended||(e.needReadable=!0),r!==t&&e.ended&&F(this)),null!==i&&this.emit("data",i),i},T.prototype._read=function(t){w(this,new b("_read()"))},T.prototype.pipe=function(t,r){var i=this,n=this._readableState;switch(n.pipesCount){case 0:n.pipes=t;break;case 1:n.pipes=[n.pipes,t];break;default:n.pipes.push(t)}n.pipesCount+=1,l("pipe count=%d opts=%j",n.pipesCount,r);var s=(!r||!1!==r.end)&&t!==process.stdout&&t!==process.stderr?a:g;function o(e,r){l("onunpipe"),e===i&&r&&!1===r.hasUnpiped&&(r.hasUnpiped=!0,l("cleanup"),t.removeListener("close",p),t.removeListener("finish",f),t.removeListener("drain",h),t.removeListener("error",d),t.removeListener("unpipe",o),i.removeListener("end",a),i.removeListener("end",g),i.removeListener("data",u),c=!0,!n.awaitDrain||t._writableState&&!t._writableState.needDrain||h())}function a(){l("onend"),t.end()}n.endEmitted?process.nextTick(s):i.once("end",s),t.on("unpipe",o);var h=function(t){return function(){var r=t._readableState;l("pipeOnDrain",r.awaitDrain),r.awaitDrain&&r.awaitDrain--,0===r.awaitDrain&&e(t,"data")&&(r.flowing=!0,I(t))}}(i);t.on("drain",h);var c=!1;function u(e){l("ondata");var r=t.write(e);l("dest.write",r),!1===r&&((1===n.pipesCount&&n.pipes===t||n.pipesCount>1&&-1!==z(n.pipes,t))&&!c&&(l("false write response, pause",n.awaitDrain),n.awaitDrain++),i.pause())}function d(r){l("onerror",r),g(),t.removeListener("error",d),0===e(t,"error")&&w(t,r)}function p(){t.removeListener("finish",f),g()}function f(){l("onfinish"),t.removeListener("close",p),g()}function g(){l("unpipe"),i.unpipe(t)}return i.on("data",u),function(t,e,r){if("function"==typeof t.prependListener)return t.prependListener(e,r);t._events&&t._events[e]?Array.isArray(t._events[e])?t._events[e].unshift(r):t._events[e]=[r,t._events[e]]:t.on(e,r)}(t,"error",d),t.once("close",p),t.once("finish",f),t.emit("pipe",i),n.flowing||(l("pipe resume"),i.resume()),t},T.prototype.unpipe=function(t){var e=this._readableState,r={hasUnpiped:!1};if(0===e.pipesCount)return this;if(1===e.pipesCount)return t&&t!==e.pipes||(t||(t=e.pipes),e.pipes=null,e.pipesCount=0,e.flowing=!1,t&&t.emit("unpipe",this,r)),this;if(!t){var i=e.pipes,n=e.pipesCount;e.pipes=null,e.pipesCount=0,e.flowing=!1;for(var s=0;s<n;s++)i[s].emit("unpipe",this,{hasUnpiped:!1});return this}var o=z(e.pipes,t);return-1===o||(e.pipes.splice(o,1),e.pipesCount-=1,1===e.pipesCount&&(e.pipes=e.pipes[0]),t.emit("unpipe",this,r)),this},T.prototype.on=function(t,e){var i=r.prototype.on.call(this,t,e),n=this._readableState;return"data"===t?(n.readableListening=this.listenerCount("readable")>0,!1!==n.flowing&&this.resume()):"readable"===t&&(n.endEmitted||n.readableListening||(n.readableListening=n.needReadable=!0,n.flowing=!1,n.emittedReadable=!1,l("on readable",n.length,n.reading),n.length?O(this):n.reading||process.nextTick(D,this))),i},T.prototype.addListener=T.prototype.on,T.prototype.removeListener=function(t,e){var i=r.prototype.removeListener.call(this,t,e);return"readable"===t&&process.nextTick(P,this),i},T.prototype.removeAllListeners=function(t){var e=r.prototype.removeAllListeners.apply(this,arguments);return"readable"!==t&&void 0!==t||process.nextTick(P,this),e},T.prototype.resume=function(){var t=this._readableState;return t.flowing||(l("resume"),t.flowing=!t.readableListening,function(t,e){e.resumeScheduled||(e.resumeScheduled=!0,process.nextTick(M,t,e))}(this,t)),t.paused=!1,this},T.prototype.pause=function(){return l("call pause flowing=%j",this._readableState.flowing),!1!==this._readableState.flowing&&(l("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState.paused=!0,this},T.prototype.wrap=function(t){var e=this,r=this._readableState,i=!1;for(var n in t.on("end",(function(){if(l("wrapped end"),r.decoder&&!r.ended){var t=r.decoder.end();t&&t.length&&e.push(t)}e.push(null)})),t.on("data",(function(n){(l("wrapped data"),r.decoder&&(n=r.decoder.write(n)),r.objectMode&&null==n)||(r.objectMode||n&&n.length)&&(e.push(n)||(i=!0,t.pause()))})),t)void 0===this[n]&&"function"==typeof t[n]&&(this[n]=function(e){return function(){return t[e].apply(t,arguments)}}(n));for(var s=0;s<x.length;s++)t.on(x[s],this.emit.bind(this,x[s]));return this._read=function(e){l("wrapped _read",e),i&&(i=!1,t.resume())},this},"function"==typeof Symbol&&(T.prototype[Symbol.asyncIterator]=function(){return void 0===u&&(u=IE()),u(this)}),Object.defineProperty(T.prototype,"readableHighWaterMark",{enumerable:!1,get:function(){return this._readableState.highWaterMark}}),Object.defineProperty(T.prototype,"readableBuffer",{enumerable:!1,get:function(){return this._readableState&&this._readableState.buffer}}),Object.defineProperty(T.prototype,"readableFlowing",{enumerable:!1,get:function(){return this._readableState.flowing},set:function(t){this._readableState&&(this._readableState.flowing=t)}}),T._fromList=N,Object.defineProperty(T.prototype,"readableLength",{enumerable:!1,get:function(){return this._readableState.length}}),"function"==typeof Symbol&&(T.from=function(t,e){return void 0===d&&(d=NE()),d(T,t,e)}),TE}function jE(){if(EE)return CE;EE=1,CE=a;var t=dE().codes,e=t.ERR_METHOD_NOT_IMPLEMENTED,r=t.ERR_MULTIPLE_CALLBACK,i=t.ERR_TRANSFORM_ALREADY_TRANSFORMING,n=t.ERR_TRANSFORM_WITH_LENGTH_0,s=gE();function o(t,e){var i=this._transformState;i.transforming=!1;var n=i.writecb;if(null===n)return this.emit("error",new r);i.writechunk=null,i.writecb=null,null!=e&&this.push(e),n(t);var s=this._readableState;s.reading=!1,(s.needReadable||s.length<s.highWaterMark)&&this._read(s.highWaterMark)}function a(t){if(!(this instanceof a))return new a(t);s.call(this,t),this._transformState={afterTransform:o.bind(this),needTransform:!1,transforming:!1,writecb:null,writechunk:null,writeencoding:null},this._readableState.needReadable=!0,this._readableState.sync=!1,t&&("function"==typeof t.transform&&(this._transform=t.transform),"function"==typeof t.flush&&(this._flush=t.flush)),this.on("prefinish",l)}function l(){var t=this;"function"!=typeof this._flush||this._readableState.destroyed?h(this,null,null):this._flush((function(e,r){h(t,e,r)}))}function h(t,e,r){if(e)return t.emit("error",e);if(null!=r&&t.push(r),t._writableState.length)throw new n;if(t._transformState.transforming)throw new i;return t.push(null)}return x_()(a,s),a.prototype.push=function(t,e){return this._transformState.needTransform=!1,s.prototype.push.call(this,t,e)},a.prototype._transform=function(t,r,i){i(new e("_transform()"))},a.prototype._write=function(t,e,r){var i=this._transformState;if(i.writecb=r,i.writechunk=t,i.writeencoding=e,!i.transforming){var n=this._readableState;(i.needTransform||n.needReadable||n.length<n.highWaterMark)&&this._read(n.highWaterMark)}},a.prototype._read=function(t){var e=this._transformState;null===e.writechunk||e.transforming?e.needTransform=!0:(e.transforming=!0,this._transform(e.writechunk,e.writeencoding,e.afterTransform))},a.prototype._destroy=function(t,e){s.prototype._destroy.call(this,t,(function(t){e(t)}))},CE}function zE(){if(RE)return BE;var t;RE=1;var e=dE().codes,r=e.ERR_MISSING_ARGS,i=e.ERR_STREAM_DESTROYED;function n(t){if(t)throw t}function s(t){t()}function o(t,e){return t.pipe(e)}return BE=function(){for(var e=arguments.length,a=new Array(e),l=0;l<e;l++)a[l]=arguments[l];var h,c=function(t){return t.length?"function"!=typeof t[t.length-1]?n:t.pop():n}(a);if(Array.isArray(a[0])&&(a=a[0]),a.length<2)throw new r("streams");var u=a.map((function(e,r){var n=r<a.length-1;return function(e,r,n,s){s=function(t){var e=!1;return function(){e||(e=!0,t.apply(void 0,arguments))}}(s);var o=!1;e.on("close",(function(){o=!0})),void 0===t&&(t=ME()),t(e,{readable:r,writable:n},(function(t){if(t)return s(t);o=!0,s()}));var a=!1;return function(t){if(!o&&!a)return a=!0,function(t){return t.setHeader&&"function"==typeof t.abort}(e)?e.abort():"function"==typeof e.destroy?e.destroy():void s(t||new i("pipe"))}}(e,n,r>0,(function(t){h||(h=t),t&&u.forEach(s),n||(u.forEach(s),c(h))}))}));return a.reduce(o)},BE}!function(t,e){var r=n;"disable"===process.env.READABLE_STREAM&&r?(t.exports=r.Readable,Object.assign(t.exports,r),t.exports.Stream=r):((e=t.exports=FE()).Stream=r||e,e.Readable=e,e.Writable=fE(),e.Duplex=gE(),e.Transform=jE(),e.PassThrough=function(){if(OE)return AE;OE=1,AE=e;var t=jE();function e(r){if(!(this instanceof e))return new e(r);t.call(this,r)}return x_()(e,t),e.prototype._transform=function(t,e,r){r(null,t)},AE}(),e.finished=ME(),e.pipeline=zE())}(tE,tE.exports);var HE=tE.exports;const WE=i,UE=/[<>&'"\x7F\x00-\x08\x0B-\x0C\x0E-\x1F]/,$E={nop(){},promiseImmediate:t=>new Promise((e=>{dt.setImmediate?setImmediate((()=>{e(t)})):setTimeout((()=>{e(t)}),1)})),inherits:function(t,e,r,i){t.super_=e,i||(i=r,r=null),r&&Object.keys(r).forEach((e=>{Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}));const n={constructor:{value:t,enumerable:!1,writable:!1,configurable:!0}};i&&Object.keys(i).forEach((t=>{n[t]=Object.getOwnPropertyDescriptor(i,t)})),t.prototype=Object.create(e.prototype,n)},dateToExcel:(t,e)=>25569+t.getTime()/864e5-(e?1462:0),excelToDate(t,e){const r=Math.round(24*(t-25569+(e?1462:0))*3600*1e3);return new Date(r)},parsePath(t){const e=t.lastIndexOf("/");return{path:t.substring(0,e),name:t.substring(e+1)}},getRelsPath(t){const e=$E.parsePath(t);return`${e.path}/_rels/${e.name}.rels`},xmlEncode(t){const e=UE.exec(t);if(!e)return t;let r="",i="",n=0,s=e.index;for(;s<t.length;s++){const e=t.charCodeAt(s);switch(e){case 34:i=""";break;case 38:i="&";break;case 39:i="'";break;case 60:i="<";break;case 62:i=">";break;case 127:i="";break;default:if(e<=31&&(e<=8||e>=11&&13!==e)){i="";break}continue}n!==s&&(r+=t.substring(n,s)),n=s+1,i&&(r+=i)}return n!==s?r+t.substring(n,s):r},xmlDecode:t=>t.replace(/&([a-z]*);/g,(t=>{switch(t){case"<":return"<";case">":return">";case"&":return"&";case"'":return"'";case""":return'"';default:return t}})),validInt(t){const e=parseInt(t,10);return Number.isNaN(e)?0:e},isDateFmt(t){if(!t)return!1;return null!==(t=(t=t.replace(/\[[^\]]*]/g,"")).replace(/"[^"]*"/g,"")).match(/[ymdhMsb]+/)},fs:{exists:t=>new Promise((e=>{WE.access(t,WE.constants.F_OK,(t=>{e(!t)}))}))},toIsoDateString:t=>t.toIsoString().subsstr(0,10),parseBoolean:t=>!0===t||"true"===t||1===t||"1"===t};var VE=$E;var GE=class{constructor(t){this._buf=Buffer.alloc(t&&t.size||16384),this._encoding=t&&t.encoding||"utf8",this._inPos=0,this._buffer=void 0}get length(){return this._inPos}get capacity(){return this._buf.length}get buffer(){return this._buf}toBuffer(){return this._buffer||(this._buffer=Buffer.alloc(this.length),this._buf.copy(this._buffer,0,0,this.length)),this._buffer}reset(t){t=t||0,this._buffer=void 0,this._inPos=t}_grow(t){let e=2*this._buf.length;for(;e<t;)e*=2;const r=Buffer.alloc(e);this._buf.copy(r,0),this._buf=r}addText(t){this._buffer=void 0;let e=this._inPos+this._buf.write(t,this._inPos,this._encoding);for(;e>=this._buf.length-4;)this._grow(this._inPos+t.length),e=this._inPos+this._buf.write(t,this._inPos,this._encoding);this._inPos=e}addStringBuf(t){t.length&&(this._buffer=void 0,this.length+t.length>this.capacity&&this._grow(this.length+t.length),t._buf.copy(this._buf,this._inPos,0,t.length),this._inPos+=t.length)}};const XE=HE,YE=VE,qE=GE;class ZE{constructor(t,e){this._data=t,this._encoding=e}get length(){return this.toBuffer().length}copy(t,e,r,i){return this.toBuffer().copy(t,e,r,i)}toBuffer(){return this._buffer||(this._buffer=Buffer.from(this._data,this._encoding)),this._buffer}}class KE{constructor(t){this._data=t}get length(){return this._data.length}copy(t,e,r,i){return this._data._buf.copy(t,e,r,i)}toBuffer(){return this._data.toBuffer()}}class QE{constructor(t){this._data=t}get length(){return this._data.length}copy(t,e,r,i){this._data.copy(t,e,r,i)}toBuffer(){return this._data}}class JE{constructor(t){this.size=t,this.buffer=Buffer.alloc(t),this.iRead=0,this.iWrite=0}toBuffer(){if(0===this.iRead&&this.iWrite===this.size)return this.buffer;const t=Buffer.alloc(this.iWrite-this.iRead);return this.buffer.copy(t,0,this.iRead,this.iWrite),t}get length(){return this.iWrite-this.iRead}get eod(){return this.iRead===this.iWrite}get full(){return this.iWrite===this.size}read(t){let e;return 0===t?null:void 0===t||t>=this.length?(e=this.toBuffer(),this.iRead=this.iWrite,e):(e=Buffer.alloc(t),this.buffer.copy(e,0,this.iRead,t),this.iRead+=t,e)}write(t,e,r){const i=Math.min(r,this.size-this.iWrite);return t.copy(this.buffer,this.iWrite,e,e+i),this.iWrite+=i,i}}const tA=function(t){t=t||{},this.bufSize=t.bufSize||1048576,this.buffers=[],this.batch=t.batch||!1,this.corked=!1,this.inPos=0,this.outPos=0,this.pipes=[],this.paused=!1,this.encoding=null};YE.inherits(tA,XE.Duplex,{toBuffer(){switch(this.buffers.length){case 0:return null;case 1:return this.buffers[0].toBuffer();default:return Buffer.concat(this.buffers.map((t=>t.toBuffer())))}},_getWritableBuffer(){if(this.buffers.length){const t=this.buffers[this.buffers.length-1];if(!t.full)return t}const t=new JE(this.bufSize);return this.buffers.push(t),t},async _pipe(t){await Promise.all(this.pipes.map((function(e){return new Promise((r=>{e.write(t.toBuffer(),(()=>{r()}))}))})))},_writeToBuffers(t){let e=0;const r=t.length;for(;e<r;){e+=this._getWritableBuffer().write(t,e,r-e)}},async write(t,e,r){let i;if(e instanceof Function&&(r=e,e="utf8"),r=r||YE.nop,t instanceof qE)i=new KE(t);else if(t instanceof Buffer)i=new QE(t);else{if(!("string"==typeof t||t instanceof String||t instanceof ArrayBuffer))throw new Error("Chunk must be one of type String, Buffer or StringBuf.");i=new ZE(t,e)}if(this.pipes.length)if(this.batch)for(this._writeToBuffers(i);!this.corked&&this.buffers.length>1;)this._pipe(this.buffers.shift());else this.corked?(this._writeToBuffers(i),process.nextTick(r)):(await this._pipe(i),r());else this.paused||this.emit("data",i.toBuffer()),this._writeToBuffers(i),this.emit("readable");return!0},cork(){this.corked=!0},_flush(){if(this.pipes.length)for(;this.buffers.length;)this._pipe(this.buffers.shift())},uncork(){this.corked=!1,this._flush()},end(t,e,r){const i=t=>{t?r(t):(this._flush(),this.pipes.forEach((t=>{t.end()})),this.emit("finish"))};t?this.write(t,e,i):i()},read(t){let e;if(t){for(e=[];t&&this.buffers.length&&!this.buffers[0].eod;){const r=this.buffers[0],i=r.read(t);t-=i.length,e.push(i),r.eod&&r.full&&this.buffers.shift()}return Buffer.concat(e)}return e=this.buffers.map((t=>t.toBuffer())).filter(Boolean),this.buffers=[],Buffer.concat(e)},setEncoding(t){this.encoding=t},pause(){this.paused=!0},resume(){this.paused=!1},isPaused(){return!!this.paused},pipe(t){this.pipes.push(t),!this.paused&&this.buffers.length&&this.end()},unpipe(t){this.pipes=this.pipes.filter((e=>e!==t))},unshift(){throw new Error("Not Implemented")},wrap(){throw new Error("Not Implemented")}});var eA=tA,rA={};const iA="undefined"==typeof TextEncoder?null:new TextEncoder("utf-8"),{Buffer:nA}=o;rA.stringToBuffer=function(t){return"string"!=typeof t?t:iA?nA.from(iA.encode(t).buffer):nA.from(t)};const sA=s,oA=JC,aA=eA,{stringToBuffer:lA}=rA;class hA extends sA.EventEmitter{constructor(t){super(),this.options=Object.assign({type:"nodebuffer",compression:"DEFLATE"},t),this.zip=new oA,this.stream=new aA}append(t,e){e.hasOwnProperty("base64")&&e.base64?this.zip.file(e.name,t,{base64:!0}):(process.browser&&"string"==typeof t&&(t=lA(t)),this.zip.file(e.name,t))}async finalize(){const t=await this.zip.generateAsync(this.options);this.stream.end(t),this.emit("finish")}read(t){return this.stream.read(t)}setEncoding(t){return this.stream.setEncoding(t)}pause(){return this.stream.pause()}resume(){return this.stream.resume()}isPaused(){return this.stream.isPaused()}pipe(t,e){return this.stream.pipe(t,e)}unpipe(t){return this.stream.unpipe(t)}unshift(t){return this.stream.unshift(t)}wrap(t){return this.stream.wrap(t)}}var cA={ZipWriter:hA};const uA=Uv,dA=VE,pA=">";function fA(t,e,r){t.push(` ${e}="${dA.xmlEncode(r.toString())}"`)}function gA(t,e){if(e){const r=[];uA.each(e,((t,e)=>{void 0!==t&&fA(r,e,t)})),t.push(r.join(""))}}let mA=class{constructor(){this._xml=[],this._stack=[],this._rollbacks=[]}get tos(){return this._stack.length?this._stack[this._stack.length-1]:void 0}get cursor(){return this._xml.length}openXml(t){const e=this._xml;e.push("<?xml"),gA(e,t),e.push("?>\n")}openNode(t,e){const r=this.tos,i=this._xml;r&&this.open&&i.push(pA),this._stack.push(t),i.push("<"),i.push(t),gA(i,e),this.leaf=!0,this.open=!0}addAttribute(t,e){if(!this.open)throw new Error("Cannot write attributes to node if it is not open");void 0!==e&&fA(this._xml,t,e)}addAttributes(t){if(!this.open)throw new Error("Cannot write attributes to node if it is not open");gA(this._xml,t)}writeText(t){const e=this._xml;this.open&&(e.push(pA),this.open=!1),this.leaf=!1,e.push(dA.xmlEncode(t.toString()))}writeXml(t){this.open&&(this._xml.push(pA),this.open=!1),this.leaf=!1,this._xml.push(t)}closeNode(){const t=this._stack.pop(),e=this._xml;this.leaf?e.push("/>"):(e.push("</"),e.push(t),e.push(pA)),this.open=!1,this.leaf=!1}leafNode(t,e,r){this.openNode(t,e),void 0!==r&&this.writeText(r),this.closeNode()}closeAll(){for(;this._stack.length;)this.closeNode()}addRollback(){return this._rollbacks.push({xml:this._xml.length,stack:this._stack.length,leaf:this.leaf,open:this.open}),this.cursor}commit(){this._rollbacks.pop()}rollback(){const t=this._rollbacks.pop();this._xml.length>t.xml&&this._xml.splice(t.xml,this._xml.length-t.xml),this._stack.length>t.stack&&this._stack.splice(t.stack,this._stack.length-t.stack),this.leaf=t.leaf,this.open=t.open}get xml(){return this.closeAll(),this._xml.join("")}};mA.StdDocAttributes={version:"1.0",encoding:"UTF-8",standalone:"yes"};var yA=mA,vA={};const bA="undefined"==typeof TextDecoder?null:new TextDecoder("utf-8");vA.bufferToString=function(t){return"string"==typeof t?t:bA?bA.decode(t):t.toString()};var _A={},wA={};!function(t){
|
|
1
|
+
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("@visactor/vtable"),require("crypto"),require("fs"),require("stream"),require("events"),require("buffer"),require("util"),require("string_decoder"),require("path"),require("constants"),require("assert"),require("zlib"),require("os")):"function"==typeof define&&define.amd?define(["exports","@visactor/vtable","crypto","fs","stream","events","buffer","util","string_decoder","path","constants","assert","zlib","os"],e):e(((t="undefined"!=typeof globalThis?globalThis:t||self).VTable=t.VTable||{},t.VTable.plugins={}),t.VTable,t.require$$0$1,t.require$$0$6,t.require$$0$2,t.require$$0$5,t.require$$0$3,t.require$$0$4,t.require$$0$7,t.require$$1,t.require$$0$8,t.require$$5,t.require$$0$9,t.require$$1$1)}(this,(function(t,e,r,i,n,s,o,a,l,h,c,u,d,p){"use strict";function f(t){var e=Object.create(null);return t&&Object.keys(t).forEach((function(r){if("default"!==r){var i=Object.getOwnPropertyDescriptor(t,r);Object.defineProperty(e,r,i.get?i:{enumerable:!0,get:function(){return t[r]}})}})),e.default=t,Object.freeze(e)}var g=f(e);function m(t){return Math.floor(t)===t}class y{static GenAutoIncrementId(){return y.auto_increment_id++}}y.auto_increment_id=0;class v{constructor(t){this.id=y.GenAutoIncrementId(),this.registry=t}}const b="named",w="inject",x="multi_inject",S="inversify:tagged",T="inversify:paramtypes";class k{constructor(t,e){this.key=t,this.value=e}toString(){return this.key===b?`named: ${String(this.value).toString()} `:`tagged: { key:${this.key.toString()}, value: ${String(this.value)} }`}}var C=function(t){var e;return function(t){const e="function"==typeof Symbol&&void 0!==Symbol.toPrimitive?Symbol.toPrimitive:"@@toPrimitive",r=Object.getPrototypeOf(Function),i=("object"==typeof process&&process.env&&process.env.REFLECT_METADATA_USE_MAP_POLYFILL,Map),n=new WeakMap;function s(t,e,r){let s=n.get(t);if(h(s)){if(!r)return;s=new i,n.set(t,s)}let o=s.get(e);if(h(o)){if(!r)return;o=new i,s.set(e,o)}return o}function o(t,e,r){if(a(t,e,r))return!0;const i=g(e);return!c(i)&&o(t,i,r)}function a(t,e,r){const i=s(e,r,!1);return!h(i)&&!!i.has(t)}function l(t,e,r){if(a(t,e,r))return function(t,e,r){const i=s(e,r,!1);if(!h(i))return i.get(t)}(t,e,r);const i=g(e);return c(i)?void 0:l(t,i,r)}function h(t){return void 0===t}function c(t){return null===t}function u(t){return"object"==typeof t?null!==t:"function"==typeof t}function d(t,r){switch(function(t){if(null===t)return 1;switch(typeof t){case"undefined":return 0;case"boolean":return 2;case"string":return 3;case"symbol":return 4;case"number":return 5;case"object":return null===t?1:6;default:return 6}}(t)){case 0:case 1:case 2:case 3:case 4:case 5:return t}const i=3===r?"string":5===r?"number":"default",n=function(t,e){const r=t[e];if(null!=r){if(!f(r))throw new TypeError;return r}}(t,e);if(void 0!==n){const e=n.call(t,i);if(u(e))throw new TypeError;return e}return function(t,e){if("string"===e){const e=t.toString;if(f(e)){const r=e.call(t);if(!u(r))return r}const r=t.valueOf;if(f(r)){const e=r.call(t);if(!u(e))return e}}else{const e=t.valueOf;if(f(e)){const r=e.call(t);if(!u(r))return r}const r=t.toString;if(f(r)){const e=r.call(t);if(!u(e))return e}}throw new TypeError}(t,"default"===i?"number":i)}function p(t){const e=d(t,3);return"symbol"==typeof e?e:function(t){return""+t}(e)}function f(t){return"function"==typeof t}function g(t){const e=Object.getPrototypeOf(t);if("function"!=typeof t||t===r)return e;if(e!==r)return e;const i=t.prototype,n=i&&Object.getPrototypeOf(i);if(null==n||n===Object.prototype)return e;const s=n.constructor;return"function"!=typeof s||s===t?e:s}t("defineMetadata",(function(t,e,r,i){if(!u(r))throw new TypeError;return function(t,e,r,i){s(r,i,!0).set(t,e)}(t,e,r,i)})),t("hasMetadata",(function(t,e,r){if(!u(e))throw new TypeError;return h(r)||(r=p(r)),o(t,e,r)})),t("hasOwnMetadata",(function(t,e,r){if(!u(e))throw new TypeError;return h(r)||(r=p(r)),a(t,e,r)})),t("getMetadata",(function(t,e,r){if(!u(e))throw new TypeError;return h(r)||(r=p(r)),l(t,e,r)}))}((e=t,function(t,r){"function"!=typeof e[t]&&Object.defineProperty(e,t,{configurable:!0,writable:!0,value:r})})),t}({});function E(t,e,r,i){!function(t,e,r,i){const n=[i];let s={};C.hasOwnMetadata(t,e)&&(s=C.getMetadata(t,e));let o=s[r];void 0===o&&(o=[]),o.push(...n),s[r]=o,C.defineMetadata(t,s,e)}(S,t,r.toString(),i)}function A(t){return(e,r,i)=>{E(e,0,i,t)}}function O(t){return e=>(r,i,n)=>A(new k(t,e))(r,i,n)}const B=O(w),R=O(x);function L(){return function(t){return C.defineMetadata(T,null,t),t}}function P(t){return A(new k(b,t))}const D="Singleton",M="Transient",I="ConstantValue",N="DynamicValue",F="Factory",j="Function",z="Instance",H="Invalid";class W{constructor(t,e){this.id=y.GenAutoIncrementId(),this.activated=!1,this.serviceIdentifier=t,this.scope=e,this.type=H,this.constraint=t=>!0,this.implementationType=null,this.cache=null,this.factory=null,this.provider=null,this.dynamicValue=null}clone(){const t=new W(this.serviceIdentifier,this.scope);return t.activated=t.scope===D&&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 U{getConstructorMetadata(t){return{compilerGeneratedMetadata:C.getMetadata(T,t),userGeneratedMetadata:C.getMetadata(S,t)||{}}}getPropertiesMetadata(t){throw new Error("暂未实现")}}const $=(V=b,t=>{const e=e=>{if(null==e)return!1;if(e.key===V&&e.value===t)return!0;if(null==e.constructorArgsMetadata)return!1;const r=e.constructorArgsMetadata;for(let e=0;e<r.length;e++)if(r[e].key===V&&r[e].value===t)return!0;return!1};return e.metaData=new k(V,t),e});var V;class G{constructor(t){this._binding=t}inRequestScope(){throw new Error("暂未实现")}inSingletonScope(){return this._binding.scope=D,this}inTransientScope(){return this._binding.scope=M,this}whenTargetNamed(t){return this._binding.constraint=$(t),this}}class X{constructor(t){this._binding=t}to(t){return this._binding.type=z,this._binding.implementationType=t,new G(this._binding)}toSelf(){const t=this._binding.serviceIdentifier;return this.to(t)}toDynamicValue(t){return this._binding.type=N,this._binding.cache=null,this._binding.dynamicValue=t,this._binding.implementationType=null,new G(this._binding)}toConstantValue(t){return this._binding.type=I,this._binding.cache=t,this._binding.dynamicValue=null,this._binding.implementationType=null,this._binding.scope=D,new G(this._binding)}toFactory(t){return this._binding.type=F,this._binding.factory=t,this._binding.scope=D,new G(this._binding)}toService(t){this.toDynamicValue((e=>e.container.get(t)))}}const Y=Symbol("ContributionProvider");class q{constructor(t,e){this.serviceIdentifier=t,this.container=e,K.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 Z(t,e){t(Y).toDynamicValue((({container:t})=>new q(e,t))).inSingletonScope().whenTargetNamed(e)}class K{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()}))}}K.store=new Map;class Q{constructor(t,e){this._args=t,this.name=e,this.taps=[]}tap(t,e){this._tap("sync",t,e)}unTap(t,e){const r="string"==typeof t?t.trim():t.name;r&&(this.taps=this.taps.filter((t=>!(t.name===r&&(!e||t.fn===e)))))}_parseOptions(t,e,r){let i;if("string"==typeof e)i={name:e.trim()};else if("object"!=typeof e||null===e)throw new Error("Invalid tap options");if("string"!=typeof i.name||""===i.name)throw new Error("Missing name for tap");return i=Object.assign({type:t,fn:r},i),i}_tap(t,e,r){this._insert(this._parseOptions(t,e,r))}_insert(t){let e;"string"==typeof t.before?e=new Set([t.before]):Array.isArray(t.before)&&(e=new Set(t.before));let r=0;"number"==typeof t.stage&&(r=t.stage);let i=this.taps.length;for(;i>0;){i--;const t=this.taps[i];this.taps[i+1]=t;const n=t.stage||0;if(e){if(e.has(t.name)){e.delete(t.name);continue}if(e.size>0)continue}if(!(n>r)){i++;break}}this.taps[i]=t}}class J extends Q{call(...t){this.taps.map((t=>t.fn)).forEach((e=>e(...t)))}}const tt=Symbol.for("EnvContribution"),et=Symbol.for("VGlobal");const rt=new class{};let it=0;class nt{constructor(){this.nextAnimationFrameCbs=new Map,this._rafHandle=null,this.runAnimationFrame=t=>{this._rafHandle=null;const e=this.nextAnimationFrameCbs;this.nextAnimationFrameCbs=new Map,e.forEach((e=>e(t)))},this.tryRunAnimationFrameNextFrame=()=>{null===this._rafHandle&&0!==this.nextAnimationFrameCbs.size&&(this._rafHandle=rt.global.getRequestAnimationFrame()(this.runAnimationFrame))}}addAnimationFrameCb(t){return this.nextAnimationFrameCbs.set(++it,t),this.tryRunAnimationFrameNextFrame(),it}removeAnimationFrameCb(t){return!!this.nextAnimationFrameCbs.has(t)&&(this.nextAnimationFrameCbs.delete(t),!0)}}class st{constructor(){this._listenerMap=new Map,this._eventListenerTransformer=t=>t}setEventListenerTransformer(t){this._eventListenerTransformer=t||(t=>t)}addEventListener(t,e,r){if(!e)return;const i=t=>{const r=this._eventListenerTransformer(t);"function"==typeof e?e(r):e.handleEvent&&e.handleEvent(r)};this._listenerMap.has(t)||this._listenerMap.set(t,new Map),this._listenerMap.get(t).set(e,i),this._nativeAddEventListener(t,i,r)}removeEventListener(t,e,r){var i;if(!e)return;const n=null===(i=this._listenerMap.get(t))||void 0===i?void 0:i.get(e);n&&(this._nativeRemoveEventListener(t,n,r),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,r)=>{this._nativeRemoveEventListener(e,t,void 0)}))})),this._listenerMap.clear()}_nativeAddEventListener(t,e,r){throw new Error("_nativeAddEventListener must be implemented by derived classes")}_nativeRemoveEventListener(t,e,r){throw new Error("_nativeRemoveEventListener must be implemented by derived classes")}_nativeDispatchEvent(t){throw new Error("_nativeDispatchEvent must be implemented by derived classes")}}var ot=function(t,e,r,i){var n,s=arguments.length,o=s<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,e,r,i);else for(var a=t.length-1;a>=0;a--)(n=t[a])&&(o=(s<3?n(o):s>3?n(e,r,o):n(e,r))||o);return s>3&&o&&Object.defineProperty(e,r,o),o},at=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},lt=function(t,e){return function(r,i){e(r,i,t)}},ht=function(t,e,r,i){return new(r||(r=Promise))((function(n,s){function o(t){try{l(i.next(t))}catch(t){s(t)}}function a(t){try{l(i.throw(t))}catch(t){s(t)}}function l(t){var e;t.done?n(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(o,a)}l((i=i.apply(t,e||[])).next())}))};let ct=class extends st{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._performanceRAFList=[],this.eventListenerTransformer=t=>t,this.id=y.GenAutoIncrementId(),this.hooks={onSetEnv:new J(["lastEnv","env","global"])},this.measureTextMethod="native",this.optimizeVisible=!1}_nativeAddEventListener(t,e,r){return this._env||this.setEnv("browser"),this.envContribution.addEventListener(t,e,r)}_nativeRemoveEventListener(t,e,r){return this._env||this.setEnv("browser"),this.envContribution.removeEventListener(t,e,r)}_nativeDispatchEvent(t){return this._env||this.setEnv("browser"),this.envContribution.dispatchEvent(t)}bindContribution(t){const e=[];if(this.contributions.getContributions().forEach((r=>{const i=r.configure(this,t);i&&i.then&&e.push(i)})),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 r=this._env;this._env=t;const i=this.bindContribution(e);if(i&&i.then)return i.then((()=>{this.envParams=e,this.hooks.onSetEnv.call(r,t,this)}));this.envParams=e,this.hooks.onSetEnv.call(r,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()}getSpecifiedRequestAnimationFrame(t){this._env||this.setEnv("browser"),this._performanceRAFList[t]||(this._performanceRAFList[t]=new nt);const e=this._performanceRAFList[t];return t=>e.addAnimationFrameCb(t)}getSpecifiedCancelAnimationFrame(t){if(this._env||this.setEnv("browser"),!this._performanceRAFList[t])return()=>!1;const e=this._performanceRAFList[t];return t=>e.removeAnimationFrameCb(t)}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,r){return ht(this,void 0,void 0,(function*(){return this._env||this.setEnv("browser"),this.envContribution.loadFont(t,e,r)}))}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,e=!1){return this._env||this.setEnv("browser"),this.envContribution.getElementTop(t,e)}getElementLeft(t,e=!1){return this._env||this.setEnv("browser"),this.envContribution.getElementLeft(t,e)}getElementTopLeft(t,e=!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 ut;ct=ot([L(),lt(0,B(Y)),lt(0,P(tt)),at("design:paramtypes",[Object])],ct),function(t){t[t.estimate=0]="estimate",t[t.actualBounding=1]="actualBounding",t[t.fontBounding=2]="fontBounding"}(ut||(ut={}));var dt="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function pt(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function ft(t){if(t.__esModule)return t;var e=t.default;if("function"==typeof e){var r=function t(){if(this instanceof t){var r=[null];return r.push.apply(r,arguments),new(Function.bind.apply(e,r))}return e.apply(this,arguments)};r.prototype=e.prototype}else r={};return Object.defineProperty(r,"__esModule",{value:!0}),Object.keys(t).forEach((function(e){var i=Object.getOwnPropertyDescriptor(t,e);Object.defineProperty(r,e,i.get?i:{enumerable:!0,get:function(){return t[e]}})})),r}var gt={exports:{}};!function(t){var e=Object.prototype.hasOwnProperty,r="~";function i(){}function n(t,e,r){this.fn=t,this.context=e,this.once=r||!1}function s(t,e,i,s,o){if("function"!=typeof i)throw new TypeError("The listener must be a function");var a=new n(i,s||t,o),l=r?r+e:e;return t._events[l]?t._events[l].fn?t._events[l]=[t._events[l],a]:t._events[l].push(a):(t._events[l]=a,t._eventsCount++),t}function o(t,e){0==--t._eventsCount?t._events=new i:delete t._events[e]}function a(){this._events=new i,this._eventsCount=0}Object.create&&(i.prototype=Object.create(null),(new i).__proto__||(r=!1)),a.prototype.eventNames=function(){var t,i,n=[];if(0===this._eventsCount)return n;for(i in t=this._events)e.call(t,i)&&n.push(r?i.slice(1):i);return Object.getOwnPropertySymbols?n.concat(Object.getOwnPropertySymbols(t)):n},a.prototype.listeners=function(t){var e=r?r+t:t,i=this._events[e];if(!i)return[];if(i.fn)return[i.fn];for(var n=0,s=i.length,o=new Array(s);n<s;n++)o[n]=i[n].fn;return o},a.prototype.listenerCount=function(t){var e=r?r+t:t,i=this._events[e];return i?i.fn?1:i.length:0},a.prototype.emit=function(t,e,i,n,s,o){var a=r?r+t:t;if(!this._events[a])return!1;var l,h,c=this._events[a],u=arguments.length;if(c.fn){switch(c.once&&this.removeListener(t,c.fn,void 0,!0),u){case 1:return c.fn.call(c.context),!0;case 2:return c.fn.call(c.context,e),!0;case 3:return c.fn.call(c.context,e,i),!0;case 4:return c.fn.call(c.context,e,i,n),!0;case 5:return c.fn.call(c.context,e,i,n,s),!0;case 6:return c.fn.call(c.context,e,i,n,s,o),!0}for(h=1,l=new Array(u-1);h<u;h++)l[h-1]=arguments[h];c.fn.apply(c.context,l)}else{var d,p=c.length;for(h=0;h<p;h++)switch(c[h].once&&this.removeListener(t,c[h].fn,void 0,!0),u){case 1:c[h].fn.call(c[h].context);break;case 2:c[h].fn.call(c[h].context,e);break;case 3:c[h].fn.call(c[h].context,e,i);break;case 4:c[h].fn.call(c[h].context,e,i,n);break;default:if(!l)for(d=1,l=new Array(u-1);d<u;d++)l[d-1]=arguments[d];c[h].fn.apply(c[h].context,l)}}return!0},a.prototype.on=function(t,e,r){return s(this,t,e,r,!1)},a.prototype.once=function(t,e,r){return s(this,t,e,r,!0)},a.prototype.removeListener=function(t,e,i,n){var s=r?r+t:t;if(!this._events[s])return this;if(!e)return o(this,s),this;var a=this._events[s];if(a.fn)a.fn!==e||n&&!a.once||i&&a.context!==i||o(this,s);else{for(var l=0,h=[],c=a.length;l<c;l++)(a[l].fn!==e||n&&!a[l].once||i&&a[l].context!==i)&&h.push(a[l]);h.length?this._events[s]=1===h.length?h[0]:h:o(this,s)}return this},a.prototype.removeAllListeners=function(t){var e;return t?(e=r?r+t:t,this._events[e]&&o(this,e)):(this._events=new i,this._eventsCount=0),this},a.prototype.off=a.prototype.removeListener,a.prototype.addListener=a.prototype.on,a.prefixed=r,a.EventEmitter=a,t.exports=a}(gt);var mt=pt(gt.exports);var yt=(t,e)=>Object.prototype.toString.call(t)===`[object ${e}]`;var vt=(t,e=!1)=>e?"boolean"==typeof t:!0===t||!1===t||yt(t,"Boolean");var bt=t=>"function"==typeof t;var _t=t=>null==t;var wt=t=>null!=t;var xt=t=>{const e=typeof t;return null!==t&&"object"===e||"function"===e};var St=t=>"object"==typeof t&&null!==t;var Tt=function(t){if(!St(t)||!yt(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 kt=t=>void 0===t;var Ct=(t,e=!1)=>{const r=typeof t;return e?"string"===r:"string"===r||yt(t,"String")};var Et=t=>Array.isArray?Array.isArray(t):yt(t,"Array");var At=function(t){return null!==t&&"function"!=typeof t&&Number.isFinite(t.length)};var Ot=(t,e=!1)=>{const r=typeof t;return e?"number"===r:"number"===r||yt(t,"Number")};var Bt=t=>Ot(t)&&Number.isFinite(t);var Rt=t=>new RegExp(/^(http(s)?:\/\/)\w+[^\s]+(\.[^\s]+){1,}$/).test(t);var Lt=t=>new RegExp(/^data:image\/(?:gif|png|jpeg|bmp|webp|svg\+xml)(?:;charset=utf-8)?;base64,(?:[A-Za-z0-9]|[+/])+={0,2}/g).test(t);var Pt=t=>({}.toString.call(t).replace(/^\[object /,"").replace(/]$/,""));const Dt=Object.prototype;var Mt=function(t){const e=t&&t.constructor;return t===("function"==typeof e&&e.prototype||Dt)};const It=Object.prototype.hasOwnProperty;function Nt(t){if(_t(t))return!0;if(At(t))return!t.length;const e=Pt(t);if("Map"===e||"Set"===e)return!t.size;if(Mt(t))return!Object.keys(t).length;for(const e in t)if(It.call(t,e))return!1;return!0}const Ft=Object.prototype.hasOwnProperty;var jt=(t,e)=>null!=t&&Ft.call(t,e);function zt(t,e,r=!1,i=!1){if(e){if(t===e)return;if(wt(e)&&"object"==typeof e){const n=Object(e),s=[];for(const t in n)s.push(t);let{length:o}=s,a=-1;for(;o--;){const o=s[++a];!wt(n[o])||"object"!=typeof n[o]||i&&Et(t[o])?Wt(t,o,n[o]):Ht(t,e,o,r,i)}}}}function Ht(t,e,r,i=!1,n=!1){const s=t[r],o=e[r];let a=e[r],l=!0;if(Et(o)){if(i)a=[];else if(Et(s))a=s;else if(At(s)){a=new Array(s.length);let t=-1;const e=s.length;for(;++t<e;)a[t]=s[t]}}else Tt(o)?(a=null!=s?s:{},"function"!=typeof s&&"object"==typeof s||(a={})):l=!1;l&&zt(a,o,i,n),Wt(t,r,a)}function Wt(t,e,r){(void 0!==r&&!function(t,e){return t===e||Number.isNaN(t)&&Number.isNaN(e)}(t[e],r)||void 0===r&&!(e in t))&&(t[e]=r)}function Ut(t,...e){let r=-1;const i=e.length;for(;++r<i;)zt(t,e[r],!0);return t}function $t(t,e){if(!Et(t)||!Et(e))return!1;if(t.length!==e.length)return!1;for(let r=0;r<t.length;r++)if(t[r]!==e[r])return!1;return!0}const Vt="undefined"!=typeof console;function Gt(t,e,r){const i=[e].concat([].slice.call(r));Vt&&console[t].apply(console,i)}var Xt;!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"}(Xt||(Xt={}));class Yt{static getInstance(t,e){return Yt._instance&&Ot(t)?Yt._instance.level(t):Yt._instance||(Yt._instance=new Yt(t,e)),Yt._instance}static setInstance(t){return Yt._instance=t}static setInstanceLevel(t){Yt._instance?Yt._instance.level(t):Yt._instance=new Yt(t)}static clearInstance(){Yt._instance=null}constructor(t=Xt.None,e){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(...t){this._onErrorHandler.forEach((e=>e(...t)))}canLogInfo(){return this._level>=Xt.Info}canLogDebug(){return this._level>=Xt.Debug}canLogError(){return this._level>=Xt.Error}canLogWarn(){return this._level>=Xt.Warn}level(t){return arguments.length?(this._level=+t,this):this._level}error(...t){var e;return this._level>=Xt.Error&&(this._onErrorHandler.length?this.callErrorHandler(...t):Gt(null!==(e=this._method)&&void 0!==e?e:"error","ERROR",t)),this}warn(...t){return this._level>=Xt.Warn&&Gt(this._method||"warn","WARN",t),this}info(...t){return this._level>=Xt.Info&&Gt(this._method||"log","INFO",t),this}debug(...t){return this._level>=Xt.Debug&&Gt(this._method||"log","DEBUG",t),this}}Yt._instance=null;function qt(t,e,r=1e-10,i=1e-10){const n=i,s=r*Math.max(t,e);return Math.abs(t-e)<=Math.max(n,s)}var Zt=function(t,e,r){return t<e?e:t>r?r:t};var Kt=(t,e,r)=>{let[i,n]=t;n<i&&(i=t[1],n=t[0]);const s=n-i;return s>=r-e?[e,r]:(i=Math.min(Math.max(i,e),r-s),[i,i+s])};let Qt=!1;try{Qt="function"==typeof requestAnimationFrame&&"function"==typeof cancelAnimationFrame}catch(WS){Qt=!1}function Jt(t,e,r){let i,n,s,o,a,l,h=0,c=!1,u=!1,d=!0;const p=!e&&0!==e&&Qt;if("function"!=typeof t)throw new TypeError("Expected a function");function f(e){const r=i,s=n;return i=n=void 0,h=e,o=t.apply(s,r),o}function g(t,e){return p?(cancelAnimationFrame(a),requestAnimationFrame(t)):setTimeout(t,e)}function m(t){const r=t-l;return void 0===l||r>=e||r<0||u&&t-h>=s}function y(){const t=Date.now();if(m(t))return v(t);a=g(y,function(t){const r=t-h,i=e-(t-l);return u?Math.min(i,s-r):i}(t))}function v(t){return a=void 0,d&&i?f(t):(i=n=void 0,o)}function b(...t){const r=Date.now(),s=m(r);if(i=t,n=this,l=r,s){if(void 0===a)return function(t){return h=t,a=g(y,e),c?f(t):o}(l);if(u)return a=g(y,e),f(l)}return void 0===a&&(a=g(y,e)),o}return e=+e||0,xt(r)&&(c=!!r.leading,u="maxWait"in r,u&&(s=Math.max(Bt(r.maxWait)?r.maxWait:0,e)),d="trailing"in r?!!r.trailing:d),b.cancel=function(){void 0!==a&&function(t){if(p)return cancelAnimationFrame(t);clearTimeout(t)}(a),h=0,i=l=n=a=void 0},b.flush=function(){return void 0===a?o:v(Date.now())},b.pending=function(){return void 0!==a},b}Qt=!1;const te=1e-12,ee=Math.PI,re=ee/2,ie=2*ee,ne=2*Math.PI,se=Math.abs,oe=Math.atan2,ae=Math.cos,le=Math.max,he=Math.min,ce=Math.sin,ue=Math.sqrt,de=Math.pow;function pe(t,e,r,i,n){let s=r,o=i;return"number"==typeof t&&"number"==typeof r&&(s=(1-n)*t+n*r),"number"==typeof e&&"number"==typeof i&&(o=(1-n)*e+n*i),{x:s,y:o}}class fe{constructor(t=0,e=0,r,i){this.x=0,this.y=0,this.x=t,this.y=e,this.x1=r,this.y1=i}clone(){return new fe(this.x,this.y)}copyFrom(t){return this.x=t.x,this.y=t.y,this.x1=t.x1,this.y1=t.y1,this.defined=t.defined,this.context=t.context,this}set(t,e){return this.x=t,this.y=e,this}add(t){return Ot(t)?(this.x+=t,void(this.y+=t)):(this.x+=t.x,this.y+=t.y,this)}sub(t){return Ot(t)?(this.x-=t,void(this.y-=t)):(this.x-=t.x,this.y-=t.y,this)}multi(t){throw new Error("暂不支持")}div(t){throw new Error("暂不支持")}}class ge{static distancePP(t,e){return ue(de(t.x-e.x,2)+de(t.y-e.y,2))}static distanceNN(t,e,r,i){return ue(de(t-r,2)+de(e-i,2))}static distancePN(t,e,r){return ue(de(e-t.x,2)+de(r-t.y,2))}static pointAtPP(t,e,r){return new fe((e.x-t.x)*r+t.x,(e.y-t.y)*r+t.y)}}function me(t){return t*(Math.PI/180)}function ye(t,e,r){if(null===t)return e;if(null===e)return t;const{x11:i,x12:n,y11:s,y12:o,x21:a,x22:l,y21:h,y22:c}=be(t,e,r);return i>=l||n<=a||s>=c||o<=h?{x1:0,y1:0,x2:0,y2:0}:{x1:Math.max(i,a),y1:Math.max(s,h),x2:Math.min(n,l),y2:Math.min(o,c)}}var ve;!function(t){t[t.NONE=0]="NONE",t[t.BBOX1=1]="BBOX1",t[t.BBOX2=2]="BBOX2"}(ve||(ve={}));const be=(t,e,r)=>{let i=t.x1,n=t.x2,s=t.y1,o=t.y2,a=e.x1,l=e.x2,h=e.y1,c=e.y2;return r&&(i>n&&([i,n]=[n,i]),s>o&&([s,o]=[o,s]),a>l&&([a,l]=[l,a]),h>c&&([h,c]=[c,h])),{x11:i,x12:n,y11:s,y12:o,x21:a,x22:l,y21:h,y22:c}};function _e(t,e,r){if(!t||!e)return ve.NONE;const{x11:i,x12:n,y11:s,y12:o,x21:a,x22:l,y21:h,y22:c}=be(t,e,r);return i>a&&n<l&&s>h&&o<c?ve.BBOX1:a>i&&l<n&&h>s&&c<o?ve.BBOX2:ve.NONE}function we(t,e,r){if(t&&e){if(!r)return!(t.x1>e.x2||t.x2<e.x1||t.y1>e.y2||t.y2<e.y1);const{x11:i,x12:n,y11:s,y12:o,x21:a,x22:l,y21:h,y22:c}=be(t,e,!0);return!(i>l||n<a||s>c||o<h)}return!0}function xe(t,e){return Math.abs(e[0]*t[0]+e[1]*t[1])}function Se({x:t,y:e},r,i={x:0,y:0}){return{x:(t-i.x)*Math.cos(r)-(e-i.y)*Math.sin(r)+i.x,y:(t-i.x)*Math.sin(r)+(e-i.y)*Math.cos(r)+i.y}}function Te(t){return{x:(t.x1+t.x2)/2,y:(t.y1+t.y2)/2}}function ke(t,e){const r=e?me(t.angle):t.angle,i=Te(t);return[Se({x:t.x1,y:t.y1},r,i),Se({x:t.x2,y:t.y1},r,i),Se({x:t.x2,y:t.y2},r,i),Se({x:t.x1,y:t.y2},r,i)]}function Ce(t,e,r,i,n,s){if(s>e&&s>i||s<e&&s<i)return 0;if(i===e)return 0;const o=(s-e)/(i-e);let a=i<e?1:-1;1!==o&&0!==o||(a=i<e?.5:-.5);const l=o*(r-t)+t;return l===n?1/0:l>n?a:0}const Ee=t=>{let e=t.charCodeAt(0),r=2===t.length?t.charCodeAt(1):0,i=e;return 55296<=e&&e<=56319&&56320<=r&&r<=57343&&(e&=1023,r&=1023,i=e<<10|r,i+=65536),12288===i||65281<=i&&i<=65376||65504<=i&&i<=65510?"F":8361===i||65377<=i&&i<=65470||65474<=i&&i<=65479||65482<=i&&i<=65487||65490<=i&&i<=65495||65498<=i&&i<=65500||65512<=i&&i<=65518?"H":4352<=i&&i<=4447||4515<=i&&i<=4519||4602<=i&&i<=4607||9001<=i&&i<=9002||11904<=i&&i<=11929||11931<=i&&i<=12019||12032<=i&&i<=12245||12272<=i&&i<=12283||12289<=i&&i<=12350||12353<=i&&i<=12438||12441<=i&&i<=12543||12549<=i&&i<=12589||12593<=i&&i<=12686||12688<=i&&i<=12730||12736<=i&&i<=12771||12784<=i&&i<=12830||12832<=i&&i<=12871||12880<=i&&i<=13054||13056<=i&&i<=19903||19968<=i&&i<=42124||42128<=i&&i<=42182||43360<=i&&i<=43388||44032<=i&&i<=55203||55216<=i&&i<=55238||55243<=i&&i<=55291||63744<=i&&i<=64255||65040<=i&&i<=65049||65072<=i&&i<=65106||65108<=i&&i<=65126||65128<=i&&i<=65131||110592<=i&&i<=110593||127488<=i&&i<=127490||127504<=i&&i<=127546||127552<=i&&i<=127560||127568<=i&&i<=127569||131072<=i&&i<=194367||177984<=i&&i<=196605||196608<=i&&i<=262141?"W":32<=i&&i<=126||162<=i&&i<=163||165<=i&&i<=166||172===i||175===i||10214<=i&&i<=10221||10629<=i&&i<=10630?"Na":161===i||164===i||167<=i&&i<=168||170===i||173<=i&&i<=174||176<=i&&i<=180||182<=i&&i<=186||188<=i&&i<=191||198===i||208===i||215<=i&&i<=216||222<=i&&i<=225||230===i||232<=i&&i<=234||236<=i&&i<=237||240===i||242<=i&&i<=243||247<=i&&i<=250||252===i||254===i||257===i||273===i||275===i||283===i||294<=i&&i<=295||299===i||305<=i&&i<=307||312===i||319<=i&&i<=322||324===i||328<=i&&i<=331||333===i||338<=i&&i<=339||358<=i&&i<=359||363===i||462===i||464===i||466===i||468===i||470===i||472===i||474===i||476===i||593===i||609===i||708===i||711===i||713<=i&&i<=715||717===i||720===i||728<=i&&i<=731||733===i||735===i||768<=i&&i<=879||913<=i&&i<=929||931<=i&&i<=937||945<=i&&i<=961||963<=i&&i<=969||1025===i||1040<=i&&i<=1103||1105===i||8208===i||8211<=i&&i<=8214||8216<=i&&i<=8217||8220<=i&&i<=8221||8224<=i&&i<=8226||8228<=i&&i<=8231||8240===i||8242<=i&&i<=8243||8245===i||8251===i||8254===i||8308===i||8319===i||8321<=i&&i<=8324||8364===i||8451===i||8453===i||8457===i||8467===i||8470===i||8481<=i&&i<=8482||8486===i||8491===i||8531<=i&&i<=8532||8539<=i&&i<=8542||8544<=i&&i<=8555||8560<=i&&i<=8569||8585===i||8592<=i&&i<=8601||8632<=i&&i<=8633||8658===i||8660===i||8679===i||8704===i||8706<=i&&i<=8707||8711<=i&&i<=8712||8715===i||8719===i||8721===i||8725===i||8730===i||8733<=i&&i<=8736||8739===i||8741===i||8743<=i&&i<=8748||8750===i||8756<=i&&i<=8759||8764<=i&&i<=8765||8776===i||8780===i||8786===i||8800<=i&&i<=8801||8804<=i&&i<=8807||8810<=i&&i<=8811||8814<=i&&i<=8815||8834<=i&&i<=8835||8838<=i&&i<=8839||8853===i||8857===i||8869===i||8895===i||8978===i||9312<=i&&i<=9449||9451<=i&&i<=9547||9552<=i&&i<=9587||9600<=i&&i<=9615||9618<=i&&i<=9621||9632<=i&&i<=9633||9635<=i&&i<=9641||9650<=i&&i<=9651||9654<=i&&i<=9655||9660<=i&&i<=9661||9664<=i&&i<=9665||9670<=i&&i<=9672||9675===i||9678<=i&&i<=9681||9698<=i&&i<=9701||9711===i||9733<=i&&i<=9734||9737===i||9742<=i&&i<=9743||9748<=i&&i<=9749||9756===i||9758===i||9792===i||9794===i||9824<=i&&i<=9825||9827<=i&&i<=9829||9831<=i&&i<=9834||9836<=i&&i<=9837||9839===i||9886<=i&&i<=9887||9918<=i&&i<=9919||9924<=i&&i<=9933||9935<=i&&i<=9953||9955===i||9960<=i&&i<=9983||10045===i||10071===i||10102<=i&&i<=10111||11093<=i&&i<=11097||12872<=i&&i<=12879||57344<=i&&i<=63743||65024<=i&&i<=65039||65533===i||127232<=i&&i<=127242||127248<=i&&i<=127277||127280<=i&&i<=127337||127344<=i&&i<=127386||917760<=i&&i<=917999||983040<=i&&i<=1048573||1048576<=i&&i<=1114109?"A":"N"};function Ae(t,e={},r){r||(r=1);const{fontStyle:i=e.fontStyle,fontVariant:n=e.fontVariant,fontWeight:s=e.fontWeight,fontSize:o=e.fontSize,fontFamily:a=e.fontFamily}=t;return(i?i+" ":"")+(n?n+" ":"")+(s?s+" ":"")+o*r+"px "+(a||"sans-serif")}class Oe{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(),wt(t.specialCharSet)&&(this.specialCharSet=t.specialCharSet),this._standardMethod=wt(t.getTextBounds)?this.fullMeasure.bind(this):this.measureWithNaiveCanvas.bind(this)}initContext(){if(this._notSupportCanvas)return!1;if(_t(this._canvas)&&(wt(this._option.getCanvasForMeasure)&&(this._canvas=this._option.getCanvasForMeasure()),_t(this._canvas)&&"undefined"!=typeof window&&void 0!==window.document&&globalThis&&wt(globalThis.document)&&(this._canvas=globalThis.document.createElement("canvas"))),_t(this._context)&&wt(this._canvas)){const t=this._canvas.getContext("2d");wt(t)&&(t.save(),t.font=Ae(this.textSpec),this._contextSaved=!0,this._context=t)}return!_t(this._context)||(this._notSupportCanvas=!0,!1)}_initSpec(){var t,e,r;const{defaultFontParams:i={}}=this._option,{fontStyle:n=i.fontStyle,fontVariant:s=i.fontVariant,fontWeight:o=(null!==(t=i.fontWeight)&&void 0!==t?t:"normal"),fontSize:a=(null!==(e=i.fontSize)&&void 0!==e?e:12),fontFamily:l=(null!==(r=i.fontFamily)&&void 0!==r?r:"sans-serif"),align:h,textAlign:c=(null!=h?h:"center"),baseline:u,textBaseline:d=(null!=u?u:"middle"),ellipsis:p,limit:f}=this._userSpec;let{lineHeight:g=a}=this._userSpec;if(Ct(g)&&"%"===g[g.length-1]){const t=Number.parseFloat(g.substring(0,g.length-1))/100;g=a*t}return{fontStyle:n,fontVariant:s,fontFamily:l,fontSize:a,fontWeight:o,textAlign:c,textBaseline:d,ellipsis:p,limit:f,lineHeight:g}}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(_t(t))return{width:0,height:0};if(_t(this._option.getTextBounds)||!this._notSupportVRender)return this.measureWithNaiveCanvas(t);const{fontFamily:e,fontSize:r,fontWeight:i,textAlign:n,textBaseline:s,ellipsis:o,limit:a,lineHeight:l}=this.textSpec;let h;try{const c=this._option.getTextBounds({text:t,fontFamily:e,fontSize:r,fontWeight:i,textAlign:n,textBaseline:s,ellipsis:!!o,maxLineWidth:a||1/0,lineHeight:l});h={width:c.width(),height:c.height()}}catch(e){this._notSupportVRender=!0,h=this.measureWithNaiveCanvas(t)}return h}measureWithNaiveCanvas(t){return this._measureReduce(t,this._measureWithNaiveCanvas.bind(this))}_measureWithNaiveCanvas(t){var e;if(!this.initContext())return this._quickMeasureWithoutCanvas(t);const r=this._context.measureText(t),{fontSize:i,lineHeight:n}=this.textSpec;return{width:r.width,height:null!==(e=n)&&void 0!==e?e:i,fontBoundingBoxAscent:r.fontBoundingBoxAscent,fontBoundingBoxDescent:r.fontBoundingBoxDescent}}quickMeasure(t){return this._measureReduce(t,this._quickMeasure.bind(this))}_quickMeasure(t){const e={width:0,height:0};for(let r=0;r<t.length;r++){const i=t[r];let n=this._measureSpecialChar(i);_t(n)&&Oe.NUMBERS_CHAR_SET.includes(i)&&(n=this._measureNumberChar()),_t(n)&&["F","W"].includes(Ee(i))&&(n=this._measureFullSizeChar()),_t(n)&&(n=this._measureLetterChar()),e.width+=n.width,e.height=Math.max(e.height,n.height),!_t(n.fontBoundingBoxAscent)&&(e.fontBoundingBoxAscent=n.fontBoundingBoxAscent),!_t(n.fontBoundingBoxDescent)&&(e.fontBoundingBoxDescent=n.fontBoundingBoxDescent)}return e}quickMeasureWithoutCanvas(t){return this._measureReduce(t,this._quickMeasureWithoutCanvas.bind(this))}_quickMeasureWithoutCanvas(t){var e;const r={width:0,height:0},{fontSize:i,lineHeight:n}=this.textSpec;for(let e=0;e<t.length;e++){const n=t[e],s=["F","W"].includes(Ee(n))?1:.53;r.width+=s*i}return r.height=null!==(e=n)&&void 0!==e?e:i,r}_measureReduce(t,e){var r;const{fontSize:i,lineHeight:n}=this.textSpec,s={width:0,height:0};if(_t(t))return s;if(Et(t)){const o=t.filter(wt).map((t=>t.toString()));return 0===o.length?s:1===o.length?e(o[0]):{width:o.reduce(((t,r)=>Math.max(t,e(r).width)),0),height:o.length*((null!==(r=n)&&void 0!==r?r:i)+1)+1}}return e(t.toString())}_measureNumberChar(){if(_t(this._numberCharSize)){const t=this._standardMethod(Oe.NUMBERS_CHAR_SET);this._numberCharSize={width:t.width/Oe.NUMBERS_CHAR_SET.length,height:t.height,fontBoundingBoxAscent:t.fontBoundingBoxAscent,fontBoundingBoxDescent:t.fontBoundingBoxDescent}}return this._numberCharSize}_measureFullSizeChar(){return _t(this._fullCharSize)&&(this._fullCharSize=this._standardMethod(Oe.FULL_SIZE_CHAR)),this._fullCharSize}_measureLetterChar(){if(_t(this._letterCharSize)){const t=this._standardMethod(Oe.ALPHABET_CHAR_SET);this._letterCharSize={width:t.width/Oe.ALPHABET_CHAR_SET.length,height:t.height,fontBoundingBoxAscent:t.fontBoundingBoxAscent,fontBoundingBoxDescent:t.fontBoundingBoxDescent}}return this._letterCharSize}_measureSpecialChar(t){return wt(this._specialCharSizeMap[t])?this._specialCharSizeMap[t]:this.specialCharSet.includes(t)?(this._specialCharSizeMap[t]=this._standardMethod(t),this._specialCharSizeMap[t]):null}release(){wt(this._canvas)&&(this._canvas=null),wt(this._context)&&(this._contextSaved&&(this._context.restore(),this._contextSaved=!1),this._context=null)}}function Be(t,e,r){const{x1:i,y1:n,x2:s,y2:o}=e;return r.onlyTranslate()?(t!==e&&t.setValue(e.x1,e.y1,e.x2,e.y2),t.translate(r.e,r.f),e):(t.clear(),t.add(r.a*i+r.c*n+r.e,r.b*i+r.d*n+r.f),t.add(r.a*s+r.c*n+r.e,r.b*s+r.d*n+r.f),t.add(r.a*s+r.c*o+r.e,r.b*s+r.d*o+r.f),t.add(r.a*i+r.c*o+r.e,r.b*i+r.d*o+r.f),e)}Oe.ALPHABET_CHAR_SET="abcdefghijklmnopqrstuvwxyz",Oe.NUMBERS_CHAR_SET="0123456789",Oe.FULL_SIZE_CHAR="字";class Re{constructor(t){t?this.setValue(t.x1,t.y1,t.x2,t.y2):this.clear()}clone(){return new Re(this)}clear(){return this.x1=+Number.MAX_VALUE,this.y1=+Number.MAX_VALUE,this.x2=-Number.MAX_VALUE,this.y2=-Number.MAX_VALUE,this}empty(){return this.x1===+Number.MAX_VALUE&&this.y1===+Number.MAX_VALUE&&this.x2===-Number.MAX_VALUE&&this.y2===-Number.MAX_VALUE}equals(t){return this.x1===t.x1&&this.y1===t.y1&&this.x2===t.x2&&this.y2===t.y2}setValue(t=0,e=0,r=0,i=0){return this.x1=t,this.y1=e,this.x2=r,this.y2=i,this}set(t=0,e=0,r=0,i=0){return r<t?(this.x2=t,this.x1=r):(this.x1=t,this.x2=r),i<e?(this.y2=e,this.y1=i):(this.y1=e,this.y2=i),this}add(t=0,e=0){return t<this.x1&&(this.x1=t),e<this.y1&&(this.y1=e),t>this.x2&&(this.x2=t),e>this.y2&&(this.y2=e),this}expand(t=0){return Et(t)?(this.y1-=t[0],this.x2+=t[1],this.y2+=t[2],this.x1-=t[3]):(this.x1-=t,this.y1-=t,this.x2+=t,this.y2+=t),this}round(){return this.x1=Math.floor(this.x1),this.y1=Math.floor(this.y1),this.x2=Math.ceil(this.x2),this.y2=Math.ceil(this.y2),this}translate(t=0,e=0){return this.x1+=t,this.x2+=t,this.y1+=e,this.y2+=e,this}rotate(t=0,e=0,r=0){const i=this.rotatedPoints(t,e,r);return this.clear().add(i[0],i[1]).add(i[2],i[3]).add(i[4],i[5]).add(i[6],i[7])}scale(t=0,e=0,r=0,i=0){const n=this.scalePoints(t,e,r,i);return this.clear().add(n[0],n[1]).add(n[2],n[3])}union(t){return t.x1<this.x1&&(this.x1=t.x1),t.y1<this.y1&&(this.y1=t.y1),t.x2>this.x2&&(this.x2=t.x2),t.y2>this.y2&&(this.y2=t.y2),this}intersect(t){return t.x1>this.x1&&(this.x1=t.x1),t.y1>this.y1&&(this.y1=t.y1),t.x2<this.x2&&(this.x2=t.x2),t.y2<this.y2&&(this.y2=t.y2),this}encloses(t){return t&&this.x1<=t.x1&&this.x2>=t.x2&&this.y1<=t.y1&&this.y2>=t.y2}alignsWith(t){return t&&(this.x1===t.x1||this.x2===t.x2||this.y1===t.y1||this.y2===t.y2)}intersects(t){return t&&!(this.x2<t.x1||this.x1>t.x2||this.y2<t.y1||this.y1>t.y2)}contains(t=0,e=0){return!(t<this.x1||t>this.x2||e<this.y1||e>this.y2)}containsPoint(t){return!(t.x<this.x1||t.x>this.x2||t.y<this.y1||t.y>this.y2)}width(){return this.empty()?0:this.x2-this.x1}height(){return this.empty()?0:this.y2-this.y1}scaleX(t=0){return this.x1*=t,this.x2*=t,this}scaleY(t=0){return this.y1*=t,this.y2*=t,this}transformWithMatrix(t){return Be(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,r){const{x1:i,y1:n,x2:s,y2:o}=this,a=Math.cos(t),l=Math.sin(t),h=e-e*a+r*l,c=r-e*l-r*a;return[a*i-l*n+h,l*i+a*n+c,a*i-l*o+h,l*i+a*o+c,a*s-l*n+h,l*s+a*n+c,a*s-l*o+h,l*s+a*o+c]}scalePoints(t,e,r,i){const{x1:n,y1:s,x2:o,y2:a}=this;return[t*n+(1-t)*r,e*s+(1-e)*i,t*o+(1-t)*r,e*a+(1-e)*i]}}class Le extends Re{}class Pe extends Re{constructor(t,e=0){var r;super(t),t&&(this.angle=null!==(r=t.angle)&&void 0!==r?r:e)}intersects(t){return function(t,e,r=!1){const i=ke(t,r),n=ke(e,r),s=(t,e)=>[e.x-t.x,e.y-t.y],o=s(Te(t),Te(e)),a=s(i[0],i[1]),l=s(i[1],i[2]),h=s(n[0],n[1]),c=s(n[1],n[2]),u=r?me(t.angle):t.angle;let d=r?me(90-t.angle):t.angle+re;const p=r?me(e.angle):e.angle;let f=r?me(90-e.angle):e.angle+re;d>ne&&(d-=ne),f>ne&&(f-=ne);const g=(t,e,r,i)=>{const n=[Math.cos(e),Math.sin(e)];return t+(xe(n,r)+xe(n,i))/2>xe(n,o)};return g((t.x2-t.x1)/2,u,h,c)&&g((t.y2-t.y1)/2,d,h,c)&&g((e.x2-e.x1)/2,p,a,l)&&g((e.y2-e.y1)/2,f,a,l)}(this,t)}setValue(t=0,e=0,r=0,i=0,n=0){return super.setValue(t,e,r,i),this.angle=n,this}clone(){return new Pe(this)}getRotatedCorners(){const t={x:(this.x1+this.x2)/2,y:(this.y1+this.y2)/2};return[Se({x:this.x1,y:this.y1},this.angle,t),Se({x:this.x2,y:this.y1},this.angle,t),Se({x:this.x1,y:this.y2},this.angle,t),Se({x:this.x2,y:this.y2},this.angle,t)]}}class De{constructor(t=1,e=0,r=0,i=1,n=0,s=0){this.a=t,this.b=e,this.c=r,this.d=i,this.e=n,this.f=s}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,r,i,n,s){return!(this.e!==n||this.f!==s||this.a!==t||this.d!==i||this.b!==e||this.c!==r)}setValue(t,e,r,i,n,s){return this.a=t,this.b=e,this.c=r,this.d=i,this.e=n,this.f=s,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,r=this.c,i=this.d,n=this.e,s=this.f,o=new De,a=t*i-e*r;return o.a=i/a,o.b=-e/a,o.c=-r/a,o.d=t/a,o.e=(r*s-i*n)/a,o.f=-(t*s-e*n)/a,o}rotate(t){const e=Math.cos(t),r=Math.sin(t),i=this.a*e+this.c*r,n=this.b*e+this.d*r,s=this.a*-r+this.c*e,o=this.b*-r+this.d*e;return this.a=i,this.b=n,this.c=s,this.d=o,this}rotateByCenter(t,e,r){const i=Math.cos(t),n=Math.sin(t),s=(1-i)*e+n*r,o=(1-i)*r-n*e,a=i*this.a-n*this.b,l=n*this.a+i*this.b,h=i*this.c-n*this.d,c=n*this.c+i*this.d,u=i*this.e-n*this.f+s,d=n*this.e+i*this.f+o;return this.a=a,this.b=l,this.c=h,this.d=c,this.e=u,this.f=d,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,r,i,n,s){return this.multiply(t,e,r,i,n,s),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:r,d:i,e:n,f:s}=this;return this.a=e,this.b=t,this.c=i,this.d=r,this.e=s,this.f=n,this}multiply(t,e,r,i,n,s){const o=this.a,a=this.b,l=this.c,h=this.d,c=o*t+l*e,u=a*t+h*e,d=o*r+l*i,p=a*r+h*i,f=o*n+l*s+this.e,g=a*n+h*s+this.f;return this.a=c,this.b=u,this.c=d,this.d=p,this.e=f,this.f=g,this}interpolate(t,e){const r=new De;return r.a=this.a+(t.a-this.a)*e,r.b=this.b+(t.b-this.b)*e,r.c=this.c+(t.c-this.c)*e,r.d=this.d+(t.d-this.d)*e,r.e=this.e+(t.e-this.e)*e,r.f=this.f+(t.f-this.f)*e,r}transformPoint(t,e){const{a:r,b:i,c:n,d:s,e:o,f:a}=this,l=r*s-i*n,h=s/l,c=-i/l,u=-n/l,d=r/l,p=(n*a-s*o)/l,f=-(r*a-i*o)/l,{x:g,y:m}=t;e.x=g*h+m*u+p,e.y=g*c+m*d+f}onlyTranslate(t=1){return this.a===t&&0===this.b&&0===this.c&&this.d===t}clone(){return new De(this.a,this.b,this.c,this.d,this.e,this.f)}toTransformAttrs(){const t=this.a,e=this.b,r=this.c,i=this.d,n=t*i-e*r,s={x:this.e,y:this.f,rotateDeg:0,scaleX:0,scaleY:0,skewX:0,skewY:0};if(0!==t||0!==e){const o=Math.sqrt(t*t+e*e);s.rotateDeg=e>0?Math.acos(t/o):-Math.acos(t/o),s.scaleX=o,s.scaleY=n/o,s.skewX=(t*r+e*i)/n,s.skewY=0}else if(0!==r||0!==i){const o=Math.sqrt(r*r+i*i);s.rotateDeg=Math.PI/2-(i>0?Math.acos(-r/o):-Math.acos(r/o)),s.scaleX=n/o,s.scaleY=o,s.skewX=0,s.skewY=(t*r+e*i)/n}return s.rotateDeg=180*s.rotateDeg/Math.PI,s}}function Me(t){if(Bt(t))return[t,t,t,t];if(Et(t)){const e=t.length;if(1===e){const e=t[0];return[e,e,e,e]}if(2===e){const[e,r]=t;return[e,r,e,r]}if(3===e){const[e,r,i]=t;return[e,r,i,r]}if(4===e)return t}if(xt(t)){const{top:e=0,right:r=0,bottom:i=0,left:n=0}=t;return[e,r,i,n]}return[0,0,0,0]}const Ie=ie-1e-8;class Ne{constructor(t){this.init(t)}init(t){this.bounds=t}arc(t,e,r,i,n,s){if(Math.abs(n-i)>Ie)return this.bounds.add(t-r,e-r),void this.bounds.add(t+r,e+r);let o,a,l,h,c=1/0,u=-1/0,d=1/0,p=-1/0;function f(t){l=r*Math.cos(t),h=r*Math.sin(t),l<c&&(c=l),l>u&&(u=l),h<d&&(d=h),h>p&&(p=h)}if(f(i),f(n),n!==i)if((i%=ie)<0&&(i+=ie),(n%=ie)<0&&(n+=ie),n<i&&(s=!s,o=i,i=n,n=o),s)for(n-=ie,o=i-i%re,a=0;a<4&&o>n;++a,o-=re)f(o);else for(o=i-i%re+re,a=0;a<4&&o<n;++a,o+=re)f(o);this.bounds.add(t+c,e+d),this.bounds.add(t+u,e+p)}arcTo(t,e,r,i,n){this.bounds.add(t,e)}bezierCurveTo(t,e,r,i,n,s){this.bounds.add(t,e),this.bounds.add(r,i),this.bounds.add(n,s)}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,r,i){this.bounds.add(t,e),this.bounds.add(r,i)}rect(t,e,r,i){this.bounds.add(t,e),this.bounds.add(t+r,e+i)}clear(){this.bounds.clear()}release(...t){}}class Fe{constructor(){this._curves=[],this.bounds=new Le}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 je=/([-+]?((\d+\.\d+)|((\d+)|(\.\d+)))(?:[eE][-+]?\d+)?)/gi,ze={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},He={A:0,AT:1,C:2,Z:3,E:4,L:5,M:6,Q:7,R:8};let We,Ue,$e,Ve,Ge,Xe;var Ye,qe,Ze,Ke,Qe,Je;function tr(t){const e=t[0],r=t[1],i=t[2],n=t[3],s=t[4],o=t[5],a=t[6],l=t[7],h=l*s,c=-a*o,u=a*s,d=l*o,p=Math.cos(i),f=Math.sin(i),g=Math.cos(n),m=Math.sin(n),y=.5*(n-i),v=Math.sin(.5*y),b=8/3*v*v/Math.sin(y),_=e+p-b*f,w=r+f+b*p,x=e+g,S=r+m,T=x+b*m,k=S-b*g;return[h*_+c*w,u*_+d*w,h*T+c*k,u*T+d*k,h*x+c*S,u*x+d*S]}function er(t,e,r,i){const n=function(t,e,r,i,n,s,o,a,l){const h=me(o),c=Math.sin(h),u=Math.cos(h),d=u*(a-t)*.5+c*(l-e)*.5,p=u*(l-e)*.5-c*(a-t)*.5;let f=d*d/((r=Math.abs(r))*r)+p*p/((i=Math.abs(i))*i);f>1&&(f=Math.sqrt(f),r*=f,i*=f);const g=u/r,m=c/r,y=-c/i,v=u/i,b=g*a+m*l,_=y*a+v*l,w=g*t+m*e,x=y*t+v*e;let S=1/((w-b)*(w-b)+(x-_)*(x-_))-.25;S<0&&(S=0);let T=Math.sqrt(S);s===n&&(T=-T);const k=.5*(b+w)-T*(x-_),C=.5*(_+x)+T*(w-b),E=Math.atan2(_-C,b-k);let A=Math.atan2(x-C,w-k)-E;A<0&&1===s?A+=ie:A>0&&0===s&&(A-=ie);const O=Math.ceil(Math.abs(A/(re+.001))),B=[];for(let t=0;t<O;++t){const e=E+t*A/O,n=E+(t+1)*A/O;B[t]=[k,C,e,n,r,i,c,u]}return B}(i[5],i[6],i[0],i[1],i[3],i[4],i[2],e,r);for(let e=0;e<n.length;++e){const r=tr(n[e]);t.bezierCurveTo(r[0],r[1],r[2],r[3],r[4],r[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"}(Ye||(Ye={})),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.ROW=1]="ROW",t[t.COLUMN=2]="COLUMN"}(Ke||(Ke={})),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"}(Qe||(Qe={})),function(t){t[t.beforeFillStroke=0]="beforeFillStroke",t[t.afterFillStroke=1]="afterFillStroke"}(Je||(Je={}));const rr=[(t,e,r,i,n,s,o)=>e.arc(t[1]*n+r,t[2]*s+i,t[3]*(n+s)/2,t[4],t[5],t[6],o),(t,e,r,i,n,s,o)=>e.arcTo(t[1]*n+r,t[2]*s+i,t[3]*n+r,t[4]*s+i,t[5]*(n+s)/2,o),(t,e,r,i,n,s,o)=>e.bezierCurveTo(t[1]*n+r,t[2]*s+i,t[3]*n+r,t[4]*s+i,t[5]*n+r,t[6]*s+i,o),(t,e,r,i)=>e.closePath(),(t,e,r,i,n,s)=>e.ellipse(t[1]*n+r,t[2]*s+i,t[3]*n,t[4]*s,t[5],t[6],t[7],t[8]),(t,e,r,i,n,s,o)=>e.lineTo(t[1]*n+r,t[2]*s+i,o),(t,e,r,i,n,s,o)=>e.moveTo(t[1]*n+r,t[2]*s+i,o),(t,e,r,i,n,s,o)=>e.quadraticCurveTo(t[1]*n+r,t[2]*s+i,t[3]*n+r,t[4]*s+i,o),(t,e,r,i,n,s,o)=>e.rect(t[1]*n+r,t[2]*s+i,t[3]*n,t[4]*s,o)];function ir(t,e,r=0,i=0,n=1,s=1,o){for(let a=0;a<t.length;a++){const l=t[a];rr[l[0]](l,e,r,i,n,s,o)}}class nr{getLength(t){return null!=t?this.calcProjLength(t):(Number.isFinite(this.length)||(this.length=this.calcLength()),this.length)}}function sr(t,e){let r=0;const i=t.length;for(let n=0;n<i;n++){const s=t[n],o=e[n],a=t[(n+1)%i],l=e[(n+1)%i];r+=ge.distanceNN(s,o,a,l)}return r/2}function or(t,e,r,i,n){const s=1-n;return s*s*s*t+3*e*n*s*s+3*r*n*n*s+i*n*n*n}function ar(t,e,r,i,n){const s=or(t.x,e.x,r.x,i.x,n),o=or(t.y,e.y,r.y,i.y,n);return new fe(s,o)}function lr(t,e,r,i){const n=1-i;return n*n*t+2*n*i*e+i*i*r}function hr(t,e,r,i){const n=lr(t.x,e.x,r.x,i),s=lr(t.y,e.y,r.y,i);return new fe(n,s)}function cr(t,e){const{p0:r,p1:i,p2:n,p3:s}=t,o=ar(r,i,n,s,e),a=ge.pointAtPP(r,i,e),l=ge.pointAtPP(i,n,e),h=ge.pointAtPP(n,s,e),c=ge.pointAtPP(a,l,e),u=ge.pointAtPP(l,h,e);return[new ur(r,a,c,o),new ur(o,u,h,s)]}class ur extends nr{constructor(t,e,r,i){super(),this.type=Qe.CubicBezierCurve,this.p0=t,this.p1=e,this.p2=r,this.p3=i}_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 ar(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,r=this.p2,i=this.p3,sr([t.x,e.x,r.x,i.x],[t.y,e.y,r.y,i.y])):60;var t,e,r,i}calcProjLength(t){return t===Ke.ROW?se(this.p0.x-this.p3.x):t===Ke.COLUMN?se(this.p0.y-this.p3.y):0}getAngleAt(t){const e=le(t-.01,0),r=he(t+.01,1),i=this.getPointAt(e),n=this.getPointAt(r);return oe(n.y-i.y,n.x-i.x)}draw(t,e,r,i,n,s){if(t.moveTo(this.p0.x*i+e,this.p0.y*n+r),s>=1)t.bezierCurveTo(this.p1.x*i+e,this.p1.y*n+r,this.p2.x*i+e,this.p2.y*n+r,this.p3.x*i+e,this.p3.y*n+r);else if(s>0){const[o]=cr(this,s);t.bezierCurveTo(o.p1.x*i+e,o.p1.y*n+r,o.p2.x*i+e,o.p2.y*n+r,o.p3.x*i+e,o.p3.y*n+r)}}includeX(t){const e=he(this.p0.x,this.p1.x,this.p2.x,this.p3.x),r=le(this.p0.x,this.p1.x,this.p2.x,this.p3.x);return t>=e&&t<=r}getYAt(t){const e=he(this.p0.x,this.p1.x,this.p2.x,this.p3.x),r=(t-e)/(le(this.p0.x,this.p1.x,this.p2.x,this.p3.x)-e);return this.getPointAt(r).y}}function dr(t,e){const{p0:r,p1:i}=t,n=ge.pointAtPP(r,i,e);return[new pr(r,n),new pr(n,i)]}class pr extends nr{constructor(t,e){super(),this.type=Qe.LineCurve,this.p0=t,this.p1=e}getPointAt(t){if(!1!==this.defined)return ge.pointAtPP(this.p0,this.p1,t);throw new Error("defined为false的点不能getPointAt")}getAngleAt(t){return null==this.angle&&(this.angle=oe(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()?ge.distancePP(this.p0,this.p1):60}calcProjLength(t){return t===Ke.ROW?se(this.p0.x-this.p1.x):t===Ke.COLUMN?se(this.p0.y-this.p1.y):0}draw(t,e,r,i,n,s){if(t.moveTo(this.p0.x*i+e,this.p0.y*n+r),s>=1)t.lineTo(this.p1.x*i+e,this.p1.y*n+r);else if(s>0){const o=this.getPointAt(s);t.lineTo(o.x*i+e,o.y*n+r)}}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,r=this.p1;this.p0.x>this.p1.x&&(e=this.p1,r=this.p0);const i=(t-e.x)/(r.x-e.x);return e.y+i*(r.y-e.y)}return 1/0}}class fr{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,r,i,n,s,o,a){const l=new ur(new fe(this._lastX,this._lastY),new fe(t,e),new fe(r,i),new fe(n,s));l.originP1=this._lastOriginP,l.originP2=a,l.defined=o,this.curves.push(l),this._lastX=n,this._lastY=s,this._lastOriginP=a}closePath(){if(this.curves.length<2)return;const t=this.curves[this.curves.length-1];this.lineTo(this._startX,this._startY,t.defined,this._startOriginP)}ellipse(){throw new Error("SegContext不支持调用ellipse")}lineTo(t,e,r,i){const n=this.addLinearCurve(t,e,r,this._lastOriginP,i);this.curves.push(n),this._lastX=t,this._lastY=e,this._lastOriginP=i}moveTo(t,e,r){return this._lastX=this._startX=t,this._lastY=this._startY=e,this._lastOriginP=r,this._startOriginP=r,this}quadraticCurveTo(t,e,r,i){throw new Error("SegContext不支持调用quadraticCurveTo")}clear(){this.curves=[],this.length=NaN}tryUpdateLength(t){return this.getLength(t)}addLinearCurve(t,e,r,i,n){const s=new pr(new fe(this._lastX,this._lastY),new fe(t,e));return s.originP1=i,s.originP2=n,s.defined=r,s}getPointAt(t){throw new Error("暂未实现")}getCurveLengths(){return[]}getLength(t){var e,r;if(t===Ke.COLUMN){if(!this.curves.length)return 0;const t=this.curves[0],r=this.curves[this.curves.length-1],i=null!==(e=r.p3)&&void 0!==e?e:r.p1;return se(t.p0.y-i.y)}if(t===Ke.ROW){if(!this.curves.length)return 0;const t=this.curves[0],e=this.curves[this.curves.length-1],i=null!==(r=e.p3)&&void 0!==r?r:e.p1;return se(t.p0.x-i.x)}return Number.isFinite(this.length)||(this.length=this.curves.reduce(((t,e)=>t+e.getLength()),0)),this.length}}class gr extends fr{bezierCurveTo(t,e,r,i,n,s,o,a){return super.bezierCurveTo(e,t,i,r,s,n,o,a)}lineTo(t,e,r,i){return super.lineTo(e,t,r,i)}moveTo(t,e,r){return super.moveTo(e,t,r)}clear(){return super.clear()}}function mr(t,e,r=1){let i=!1;for(let r=0,n=e.length;r<=n;r++)r>=n===i&&((i=!i)?t.lineStart():t.lineEnd()),i&&t.point(e[r])}function yr(t,e,r){const i=null!=e?e:se(r[r.length-1].x-r[0].x)>se(r[r.length-1].y-r[0].y)?Ke.ROW:Ke.COLUMN;return"monotoneY"===t?new gr(t,i):new fr(t,i)}class vr{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,r=t.y;switch(this._point){case 0:this._point=1,this._line?this.context.lineTo(e,r,!1!==this._lastDefined&&!1!==t.defined,t):this.context.moveTo(e,r,t);break;case 1:this._point=2;default:this.context.lineTo(e,r,!1!==this._lastDefined&&!1!==t.defined,t)}this._lastDefined=t.defined}tryUpdateLength(){return this.context.tryUpdateLength()}}function br(t,e={}){const{direction:r,startPoint:i}=e;if(t.length<2-Number(!!i))return null;const n=yr("linear",r,t);return function(t,e){mr(t,e,1)}(new vr(n,i),t),n}function _r(t,e,r,i,n){t.context.bezierCurveTo((2*t._x0+t._x1)/3,(2*t._y0+t._y1)/3,(t._x0+2*t._x1)/3,(t._y0+2*t._y1)/3,(t._x0+4*t._x1+e)/6,(t._y0+4*t._y1+r)/6,i,t.lastPoint1)}class wr{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&&_r(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,r=t.y;switch(this._point){case 0:this._point=1,this._line?this.context.lineTo(e,r,!1!==this._lastDefined1&&!1!==this._lastDefined2,t):this.context.moveTo(e,r,t);break;case 1:this._point=2;break;default:_r(this,e,r,!1!==this._lastDefined1&&!1!==this._lastDefined2)}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=r,this._lastDefined1=this._lastDefined2,this._lastDefined2=t.defined,this.lastPoint0=this.lastPoint1,this.lastPoint1=t}tryUpdateLength(){return this.context.tryUpdateLength()}}function xr(t,e={}){const{direction:r,startPoint:i}=e;if(t.length<2-Number(!!i))return null;if(t.length<3-Number(!!i))return br(t,e);const n=yr("basis",r,t);return function(t,e){mr(t,e,2)}(new wr(n,i),t),n}function Sr(t){return t<0?-1:1}function Tr(t,e,r){const i=t._x1-t._x0,n=e-t._x1,s=(t._y1-t._y0)/(i||Number(n<0&&-0)),o=(r-t._y1)/(n||Number(i<0&&-0)),a=(s*n+o*i)/(i+n);return(Sr(s)+Sr(o))*Math.min(Math.abs(s),Math.abs(o),.5*Math.abs(a))||0}function kr(t,e){const r=t._x1-t._x0;return r?(3*(t._y1-t._y0)/r-e)/2:e}function Cr(t,e,r,i,n){const s=t._x0,o=t._y0,a=t._x1,l=t._y1,h=(a-s)/3;t.context.bezierCurveTo(s+h,o+h*e,a-h,l-h*r,a,l,i,t.lastPoint1)}class Er{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:Cr(this,this._t0,kr(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 r=t.x,i=t.y;switch(this._point){case 0:this._point=1,this._line?this.context.lineTo(r,i,!1!==this._lastDefined1&&!1!==this._lastDefined2,t):this.context.moveTo(r,i,t);break;case 1:this._point=2;break;case 2:this._point=3,Cr(this,kr(this,e=Tr(this,r,i)),e,!1!==this._lastDefined1&&!1!==this._lastDefined2);break;default:Cr(this,this._t0,e=Tr(this,r,i),!1!==this._lastDefined1&&!1!==this._lastDefined2)}this._x0=this._x1,this._x1=r,this._y0=this._y1,this._y1=i,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 Ar extends Er{constructor(t,e){super(t,e)}point(t){return super.point({y:t.x,x:t.y,defined:t.defined})}}function Or(t,e={}){const{direction:r,startPoint:i}=e;if(t.length<2-Number(!!i))return null;if(t.length<3-Number(!!i))return br(t,e);const n=yr("monotoneX",r,t);return function(t,e){mr(t,e,2)}(new Er(n,i),t),n}function Br(t,e={}){const{direction:r,startPoint:i}=e;if(t.length<2-Number(!!i))return null;if(t.length<3-Number(!!i))return br(t,e);const n=yr("monotoneY",r,t);return function(t,e){mr(t,e,2)}(new Ar(n,i),t),n}class Rr{constructor(t,e=.5,r){this.context=t,this._t=e,this.startPoint=r}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,r=t.y;switch(this._point){case 0:this._point=1,this._line?this.context.lineTo(e,r,!1!==this._lastDefined&&!1!==t.defined,t):this.context.moveTo(e,r,t);break;case 1:this._point=2;default:if(this._t<=0)this.context.lineTo(this._x,r,!1!==this._lastDefined&&!1!==t.defined,this.lastPoint),this.context.lineTo(e,r,!1!==this._lastDefined&&!1!==t.defined,t);else{const i=this._x*(1-this._t)+e*this._t;.5===this._t?this.context.lineTo(i,this._y,!1!==this._lastDefined,this.lastPoint):this.context.lineTo(i,this._y,!1!==this._lastDefined&&!1!==t.defined,this.lastPoint),this.context.lineTo(i,r,!1!==this._lastDefined&&!1!==t.defined,t)}}this._lastDefined=t.defined,this._x=e,this._y=r,this.lastPoint=t}tryUpdateLength(){return this.context.tryUpdateLength()}}class Lr extends Rr{lineEnd(){this.context.closePath()}}function Pr(t,e,r={}){const{direction:i,startPoint:n}=r;if(t.length<2-Number(!!n))return null;const s=new fr("step",null!=i?i:se(t[t.length-1].x-t[0].x)>se(t[t.length-1].y-t[0].y)?Ke.ROW:Ke.COLUMN);return Dr(new Rr(s,e,n),t),s}function Dr(t,e){return mr(t,e,1)}class Mr extends vr{lineEnd(){this.context.closePath()}}function Ir(t,e={}){const{direction:r,startPoint:i}=e;if(t.length<2-Number(!!i))return null;const n=yr("linear",r,t);return function(t,e){mr(t,e,1)}(new Mr(n,i),t),n}function Nr(t,e,r,i,n){let s=t._x1,o=t._y1,a=t._x2,l=t._y2;if(t._l01_a>te){const e=2*t._l01_2a+3*t._l01_a*t._l12_a+t._l12_2a,r=3*t._l01_a*(t._l01_a+t._l12_a);s=(s*e-t._x0*t._l12_2a+t._x2*t._l01_2a)/r,o=(o*e-t._y0*t._l12_2a+t._y2*t._l01_2a)/r}if(t._l23_a>te){const i=2*t._l23_2a+3*t._l23_a*t._l12_a+t._l12_2a,n=3*t._l23_a*(t._l23_a+t._l12_a);a=(a*i+t._x1*t._l23_2a-e*t._l12_2a)/n,l=(l*i+t._y1*t._l23_2a-r*t._l12_2a)/n}t.context.bezierCurveTo(s,o,a,l,t._x2,t._y2,i,t.lastPoint1)}function Fr(t,e){return function(r,i,n={}){const{direction:s,startPoint:o}=n;if(r.length<2-Number(!!o))return null;if(r.length<3-Number(!!o))return br(r,n);const a=yr(t,s,r);return mr(new e(a,i,o),r,2),a}}const jr=Fr("catmullRom",class{constructor(t,e=.5,r){this.context=t,this.startPoint=r,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:r}=t;if(this._point){const t=this._x2-e,i=this._y2-r;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(t*t+i*i,this._alpha))}switch(this._point){case 0:this._point=1,this._line?this.context.lineTo(e,r,!1!==this._lastDefined1&&!1!==this._lastDefined2):this.context.moveTo(e,r);break;case 1:this._point=2;break;case 2:this._point=3;default:Nr(this,e,r,!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=r,this._lastDefined1=this._lastDefined2,this._lastDefined2=t.defined,this.lastPoint0=this.lastPoint1,this.lastPoint1=t}tryUpdateLength(){return this.context.tryUpdateLength()}});const zr=Fr("catmullRomClosed",class{constructor(t,e=.5,r){this.context=t,this.startPoint=r,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:r}=t;if(this._point){const t=this._x2-e,i=this._y2-r;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(t*t+i*i,this._alpha))}switch(this._point){case 0:this._point=1,this._x3=e,this._y3=r;break;case 1:this._point=2,this.context.moveTo(this._x4=e,this._y4=r,t);break;case 2:this._point=3,this._x5=e,this._y5=r;break;default:Nr(this,e,r,!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=r,this._lastDefined1=this._lastDefined2,this._lastDefined2=t.defined,this.lastPoint0=this.lastPoint1,this.lastPoint1=t}tryUpdateLength(){return this.context.tryUpdateLength()}});class Hr extends nr{constructor(t,e,r){super(),this.type=Qe.QuadraticBezierCurve,this.p0=t,this.p1=e,this.p2=r}_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 hr(this.p0,this.p1,this.p2,t);throw new Error("defined为false的点不能getPointAt")}calcLength(){return this._validPoint()?(t=this.p0,e=this.p1,r=this.p2,sr([t.x,e.x,r.x],[t.y,e.y,r.y])):60;var t,e,r}calcProjLength(t){return t===Ke.ROW?se(this.p0.x-this.p2.x):t===Ke.COLUMN?se(this.p0.y-this.p2.y):0}getAngleAt(t){const e=le(t-.01,0),r=he(t+.01,1),i=this.getPointAt(e),n=this.getPointAt(r);return oe(n.y-i.y,n.x-i.x)}draw(t,e,r,i,n,s){if(t.moveTo(this.p0.x*i+e,this.p0.y*n+r),s>=1)t.quadraticCurveTo(this.p1.x*i+e,this.p1.y*n+r,this.p2.x*i+e,this.p2.y*n+r);else if(s>0){const[o]=function(t,e){const{p0:r,p1:i,p2:n}=t,s=hr(r,i,n,e),o=ge.pointAtPP(r,i,e),a=ge.pointAtPP(i,n,e);return[new Hr(r,o,s),new Hr(s,a,n)]}(this,s);t.quadraticCurveTo(o.p1.x*i+e,o.p1.y*n+r,o.p2.x*i+e,o.p2.y*n+r)}}getYAt(t){throw new Error("QuadraticBezierCurve暂不支持getYAt")}includeX(t){throw new Error("QuadraticBezierCurve暂不支持includeX")}}class Wr{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 r=this.addLinearCurve(t,e);this.path.addCurve(r),this._lastX=t,this._lastY=e}addLinearCurve(t,e){return new pr(new fe(this._lastX,this._lastY),new fe(t,e))}quadraticCurveTo(t,e,r,i){const n=new Hr(new fe(this._lastX,this._lastY),new fe(t,e),new fe(r,i));this.path.addCurve(n),this._lastX=r,this._lastY=i}bezierCurveTo(t,e,r,i,n,s){const o=new ur(new fe(this._lastX,this._lastY),new fe(t,e),new fe(r,i),new fe(n,s));this.path.addCurve(o),this._lastX=n,this._lastY=s}arcTo(t,e,r,i,n){throw new Error("CurveContext不支持调用arcTo")}ellipse(t,e,r,i,n,s,o,a){throw new Error("CurveContext不支持调用ellipse")}rect(t,e,r,i){throw new Error("CurveContext不支持调用rect")}arc(t,e,r,i,n,s){throw new Error("CurveContext不支持调用arc")}closePath(){this.path.curves.length<2||this.lineTo(this._startX,this._startY)}}function Ur(t,e,r){var i,n;switch(e){case"linear":default:return br(t,r);case"basis":return xr(t,r);case"monotoneX":return Or(t,r);case"monotoneY":return Br(t,r);case"step":return Pr(t,.5,r);case"stepClosed":return function(t,e,r={}){const{direction:i,startPoint:n}=r;if(t.length<2-Number(!!n))return null;const s=new fr("step",null!=i?i:se(t[t.length-1].x-t[0].x)>se(t[t.length-1].y-t[0].y)?Ke.ROW:Ke.COLUMN);return Dr(new Lr(s,e,n),t),s}(t,.5,r);case"stepBefore":return Pr(t,0,r);case"stepAfter":return Pr(t,1,r);case"catmullRom":return jr(t,null!==(i=null==r?void 0:r.curveTension)&&void 0!==i?i:.5,r);case"catmullRomClosed":return zr(t,null!==(n=null==r?void 0:r.curveTension)&&void 0!==n?n:.5,r);case"linearClosed":return Ir(t,r)}}class $r extends Fe{constructor(t){super(),this.commandList=[],t&&(this._ctx=t),this._boundsContext=new Ne(this.bounds)}get curves(){return this.tryBuildCurves()}setCtx(t){this._ctx=t}moveTo(t,e){return this.commandList.push([He.M,t,e]),this._ctx&&this._ctx.moveTo(t,e),this}lineTo(t,e){return this.commandList.push([He.L,t,e]),this._ctx&&this._ctx.lineTo(t,e),this}quadraticCurveTo(t,e,r,i){return this.commandList.push([He.Q,t,e,r,i]),this._ctx&&this._ctx.quadraticCurveTo(t,e,r,i),this}bezierCurveTo(t,e,r,i,n,s){return this.commandList.push([He.C,t,e,r,i,n,s]),this._ctx&&this._ctx.bezierCurveTo(t,e,r,i,n,s),this}arcTo(t,e,r,i,n){return this.commandList.push([He.AT,t,e,r,i,n]),this._ctx&&this._ctx.arcTo(t,e,r,i,n),this}ellipse(t,e,r,i,n,s,o,a){return this.commandList.push([He.E,t,e,r,i,n,s,o,a]),this._ctx&&this._ctx.ellipse(t,e,r,i,n,s,o,a),this}rect(t,e,r,i){return this.commandList.push([He.R,t,e,r,i]),this._ctx&&this._ctx.rect(t,e,r,i),this}arc(t,e,r,i,n,s){return this.commandList.push([He.A,t,e,r,i,n,s]),this._ctx&&this._ctx.arc(t,e,r,i,n,s),this}closePath(){return this.commandList.push([He.Z]),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 Wr(this);ir(this.commandList,t,0,0,1,1)}return this._curves}toString(){if(!this.toStringCbList){const t=[];t[He.M]=t=>`M${t[1]} ${t[2]}`,t[He.L]=t=>`L${t[1]} ${t[2]}`,t[He.Q]=t=>`Q${t[1]} ${t[2]} ${t[3]} ${t[4]}`,t[He.C]=t=>`C${t[1]} ${t[2]} ${t[3]} ${t[4]} ${t[5]} ${t[6]}`,t[He.A]=t=>{const e=[],r=t[1],i=t[2],n=t[3];((t,e,r,i,n,s,o,a=!1)=>{const l=2*Math.PI,h=(e%l+l)%l;let c,u=(r%l+l)%l;a?(u>=h&&(u-=l),c=u-h):(u<=h&&(u+=l),c=u-h);const d=Math.ceil(Math.abs(c)/(.5*Math.PI)),p=c/d;for(let e=0;e<d;e++){const r=h+p*e,l=h+p*(e+1),c=4/3*Math.tan(Math.abs(p)/4),u=Math.cos(r),d=Math.sin(r),f=Math.cos(l),g=Math.sin(l),m=u*s+i,y=d*o+n,v=f*s+i,b=g*o+n,_=a?-1:1,w=s*c*_,x=o*c*_;t.push(m-w*d,y+x*u,v+w*g,b-x*f,v,b)}})(e,t[4],t[5],r,i,n,n,t[6]);let s="";for(let t=0;t<e.length;t+=6)s+=`C${e[t]} ${e[t+1]} ${e[t+2]} ${e[t+3]} ${e[t+4]} ${e[t+5]}`;return s},t[He.R]=t=>`M${t[1]} ${t[2]} h${t[3]} v${t[4]} H${t[1]}Z`,t[He.Z]=t=>"Z",this.toStringCbList=t}const t=this.toStringCbList;let e="";return this.commandList.forEach((r=>{e+=t[r[0]](r)})),e}fromString(t,e,r,i,n){this.clear();const s=function(t){if(!t)return[];const e=t.match(/[mzlhvcsqta][^mzlhvcsqta]*/gi);if(null===e)return[];let r,i;const n=[];for(let t=0,s=e.length;t<s;t++)if(We=e[t],Ue=We.slice(1),$e=We[0],r=[$e],i=Ue.match(je),null!==i){for(let t=0,e=i.length;t<e;t++)Ve=i[t],Ge=parseFloat(Ve),Number.isNaN(Ge)||r.push(Ge);if(Xe=ze[$e],r.length-1>Xe){let t,e=$e;for(let i=1,s=r.length;i<s;i+=Xe){t=[e];for(let e=i,n=i+Xe;e<n;e++)t.push(r[e]);n.push(t),"m"===e?e="l":"M"===e&&(e="L")}}else n.push(r)}else n.push(r);return n}(t);return this._runCommandStrList(s,e,r,i,n),this._updateBounds(),this}fromLine(t){const{points:e,curveType:r,clipRangeByDimension:i}=t.attribute;if(!e)return;const n=Ur(e,r);"x"===i?this.direction=Ke.ROW:"y"===i?this.direction=Ke.COLUMN:"auto"===i&&(this.direction=n.direction),this._curves=n.curves}fromCustomPath2D(t,e,r,i,n){return this.clear(),this._runCommandList(t.commandList,e,r,i,n),this._updateBounds(),this}transform(t,e,r,i){const n=this.commandList;if(!this.transformCbList){const t=[];t[He.M]=this.moveToTransform,t[He.L]=this.lineToTransform,t[He.Q]=this.quadraticCurveToTransform,t[He.C]=this.bezierCurveToTransform,t[He.AT]=this.arcToTransform,t[He.E]=this.ellipseTransform,t[He.R]=this.rectTransform,t[He.A]=this.arcTransform,t[He.Z]=this.closePathTransform,this.transformCbList=t}n.forEach((n=>{this.transformCbList[n[0]](n,t,e,r,i)})),this._updateBounds()}moveToTransform(t,e,r,i,n){t[1]=t[1]*i+e,t[2]=t[2]*n+r}lineToTransform(t,e,r,i,n){t[1]=t[1]*i+e,t[2]=t[2]*n+r}quadraticCurveToTransform(t,e,r,i,n){t[1]=t[1]*i+e,t[2]=t[2]*n+r,t[3]=t[3]*i+e,t[4]=t[4]*n+r}bezierCurveToTransform(t,e,r,i,n){t[1]=t[1]*i+e,t[2]=t[2]*n+r,t[3]=t[3]*i+e,t[4]=t[4]*n+r,t[5]=t[5]*i+e,t[6]=t[6]*n+r}arcToTransform(t,e,r,i,n){t[1]=t[1]*i+e,t[2]=t[2]*n+r,t[3]=t[3]*i+e,t[4]=t[4]*n+r,t[5]=t[5]*(i+n)/2}ellipseTransform(t,e,r,i,n){t[1]=t[1]*i+e,t[2]=t[2]*n+r,t[3]=t[3]*i,t[4]=t[4]*n}rectTransform(t,e,r,i,n){t[1]=t[1]*i+e,t[2]=t[2]*n+r,t[3]=t[3]*i,t[4]=t[4]*n}arcTransform(t,e,r,i,n){t[1]=t[1]*i+e,t[2]=t[2]*n+r,t[3]=t[3]*(i+n)/2}closePathTransform(){}_runCommandStrList(t,e=0,r=0,i=1,n=1){let s,o,a,l,h,c=null,u=0,d=0,p=0,f=0;for(let g=0,m=t.length;g<m;++g){switch(s=t[g],1===i&&1===n||(s=Gr(s,i,n)),s[0]){case"l":u+=s[1],d+=s[2],this.lineTo(u+e,d+r);break;case"L":u=s[1],d=s[2],this.lineTo(u+e,d+r);break;case"h":u+=s[1],this.lineTo(u+e,d+r);break;case"H":u=s[1],this.lineTo(u+e,d+r);break;case"v":d+=s[1],this.lineTo(u+e,d+r);break;case"V":d=s[1],this.lineTo(u+e,d+r);break;case"m":u+=s[1],d+=s[2],this.moveTo(u+e,d+r);break;case"M":u=s[1],d=s[2],this.moveTo(u+e,d+r);break;case"c":o=u+s[5],a=d+s[6],p=u+s[3],f=d+s[4],this.bezierCurveTo(u+s[1]+e,d+s[2]+r,p+e,f+r,o+e,a+r),u=o,d=a;break;case"C":u=s[5],d=s[6],p=s[3],f=s[4],this.bezierCurveTo(s[1]+e,s[2]+r,p+e,f+r,u+e,d+r);break;case"s":o=u+s[3],a=d+s[4],null===c[0].match(/[CcSs]/)?(p=u,f=d):(p=2*u-p,f=2*d-f),l=u+s[1],h=d+s[2],this.bezierCurveTo(p+e,f+r,l+e,h+r,o+e,a+r),p=l,f=h,u=o,d=a;break;case"S":o=s[3],a=s[4],null===c[0].match(/[CcSs]/)?(p=u,f=d):(p=2*u-p,f=2*d-f),l=s[1],h=s[2],this.bezierCurveTo(p+e,f+r,l+e,h+r,o+e,a+r),p=l,f=h,u=o,d=a;break;case"q":o=u+s[3],a=d+s[4],p=u+s[1],f=d+s[2],this.quadraticCurveTo(p+e,f+r,o+e,a+r),u=o,d=a;break;case"Q":o=s[3],a=s[4],this.quadraticCurveTo(s[1]+e,s[2]+r,o+e,a+r),u=o,d=a,p=s[1],f=s[2];break;case"t":o=u+s[1],a=d+s[2],null===c[0].match(/[QqTt]/)?(p=u,f=d):"t"===c[0]?(p=2*u-l,f=2*d-h):"q"===c[0]&&(p=2*u-p,f=2*d-f),l=p,h=f,this.quadraticCurveTo(p+e,f+r,o+e,a+r),u=o,d=a,p=u+s[1],f=d+s[2];break;case"T":o=s[1],a=s[2],p=2*u-p,f=2*d-f,this.quadraticCurveTo(p+e,f+r,o+e,a+r),u=o,d=a;break;case"a":er(this,u+e,d+r,[s[1],s[2],s[3],s[4],s[5],s[6]+u+e,s[7]+d+r]),u+=s[6],d+=s[7];break;case"A":er(this,u+e,d+r,[s[1],s[2],s[3],s[4],s[5],s[6]+e,s[7]+r]),u=s[6],d=s[7];break;case"z":case"Z":this.closePath()}c=s}}_runCommandList(t,e=0,r=0,i=1,n=1){if(0!==e||0!==r||1!==i||1!==n)for(let s=0,o=t.length;s<o;++s){const o=t[s].slice();switch(o[0]){case He.L:this.lineToTransform(o,e,r,i,n);break;case He.M:this.moveToTransform(o,e,r,i,n);break;case He.C:this.bezierCurveToTransform(o,e,r,i,n);break;case He.Q:this.quadraticCurveToTransform(o,e,r,i,n);break;case He.A:this.arcToTransform(o,e,r,i,n);break;case He.E:this.ellipseTransform(o,e,r,i,n);break;case He.R:this.rectTransform(o,e,r,i,n);break;case He.AT:this.arcToTransform(o,e,r,i,n);break;case He.Z:this.closePath()}}else this.commandList=t.map((t=>t.slice()))}_updateBounds(){this.bounds.clear(),ir(this.commandList,this._boundsContext)}release(){this.commandList=[],this._boundsContext=null,this._ctx=null}getLength(){if(this.direction===Ke.COLUMN){if(!this._curves.length)return 0;const t=this._curves[0],e=this._curves[this._curves.length-1];return se(t.p0.y-e.p1.y)}if(this.direction===Ke.ROW){if(!this._curves.length)return 0;const t=this._curves[0],e=this._curves[this._curves.length-1];return se(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 r=this.curves[e];if(r.includeX(t))return r.getYAt(t)}return 1/0}getAttrAt(t){if(!this._curves)return{pos:{x:0,y:0},angle:0};let e,r=0;for(let i=0;i<this._curves.length;i++){e=this._curves[i];const n=e.getLength(this.direction);if(r+n>=t)break;r+=n}const i=(t-r)/e.getLength(this.direction);return{pos:e.getPointAt(i),angle:e.getAngleAt(i)}}drawWithClipRange(t,e,r,i,n){this.tryBuildCurves();const s=this.getLength()*n;let o=0;for(let n=0;n<this._curves.length;n++){const a=this._curves[n],l=a.getLength(this.direction);if(!(o+l<=s)){const n=1-(o+l-s)/l;a.draw(t,r,i,e,e,n);break}a.draw(t,r,i,e,e,1),o+=l}}}const Vr=["l",0,0,0,0,0,0,0];function Gr(t,e,r){const i=Vr[0]=t[0];if("a"===i||"A"===i)Vr[1]=e*t[1],Vr[2]=r*t[2],Vr[3]=t[3],Vr[4]=t[4],Vr[5]=t[5],Vr[6]=e*t[6],Vr[7]=r*t[7];else if("h"===i||"H"===i)Vr[1]=e*t[1];else if("v"===i||"V"===i)Vr[1]=r*t[1];else for(let i=1,n=t.length;i<n;++i)Vr[i]=(i%2==1?e:r)*t[i];return Vr}const Xr={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 De},Yr={strokeOpacity:1,lineDash:[],lineDashOffset:0,lineWidth:1,lineCap:"butt",lineJoin:"miter",miterLimit:10,strokeBoundsBuffer:2,stroke:!1},qr=Object.assign({outerBorder:Object.assign(Object.assign({},Yr),{distance:0}),innerBorder:Object.assign(Object.assign({},Yr),{distance:0})},Yr),Zr={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:ut.fontBounding,keepCenterInLine:!1},Kr=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}),qr),{alignSelf:"auto"}),{pickStrokeBuffer:0}),Qr={connectedType:"none",connectedStyle:{},connectedX:NaN,connectedY:NaN},Jr=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,roughStyle:null},{_debug_bounds:!1}),Kr),Xr),ti=Object.assign(Object.assign({},Jr),{startAngle:0,endAngle:ne,innerRadius:0,outerRadius:1,innerPadding:0,outerPadding:0,cornerRadius:0,padRadius:0,padAngle:0,cap:!1,forceShowCap:!1}),ei=Object.assign(Object.assign(Object.assign({},Jr),Qr),{points:[],segments:[],curveType:"linear",clipRange:1,closePath:!1,curveTension:1}),ri=Object.assign(Object.assign({},Jr),{radius:1,startAngle:0,endAngle:ne}),ii=Object.assign(Object.assign({},Jr),{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"}),ni=Object.assign(Object.assign({},Jr),{path:"",width:0,height:0,cornerRadius:0,clip:!1}),si=Object.assign(Object.assign(Object.assign({},Jr),Qr),{points:[],segments:[],curveType:"linear",clipRange:1,clipRangeByDimension:"default",closePath:!1,curveTension:1}),oi=Object.assign(Object.assign({},Jr),{path:new $r,fillStrokeOrder:1,clipRange:1,customPath:()=>{Yt.getInstance().warn("空函数")}}),ai=Object.assign(Object.assign({},Jr),{points:[],cornerRadius:0,closePath:!0}),li=Object.assign(Object.assign({},Jr),{width:100,height:100,spikes:5,thickness:.5}),hi=Object.assign(Object.assign({},Jr),{width:0,height:0,x1:0,y1:0,strokeBoundsBuffer:0,cornerRadius:0,cornerType:"round"});Object.assign(Object.assign({},Jr),{width:0,height:0,x1:0,y1:0,cornerRadius:0,length:0,cornerType:"round"});const ci=Object.assign(Object.assign({},Jr),{symbolType:"circle",size:10,keepDirIn3d:!0,clipRange:1}),ui=Object.assign(Object.assign(Object.assign({},Jr),Zr),{strokeBoundsBuffer:0,keepDirIn3d:!0}),di=Object.assign(Object.assign(Object.assign({},Jr),Zr),{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}),pi=Object.assign(Object.assign({repeatX:"no-repeat",repeatY:"no-repeat",image:"",width:0,height:0,maxWidth:500,maxHeight:500},Jr),{fill:!0,cornerRadius:0,cornerType:"round"}),fi=Object.assign(Object.assign({},pi),{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}),gi=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 r(t){const r=new Error(e+": "+t);throw r.source=e,r}function i(){return n("linear",t.linearGradient,s)||n("radial",t.radialGradient,a)||n("conic",t.conicGradient,o)}function n(e,i,n){return function(i,s){const o=y(i);if(o){y(t.startCall)||r("Missing (");const i=function(i){const s=n();return s&&(y(t.comma)||r("Missing comma before color stops")),{type:e,orientation:s,colorStops:d(p)}}();return y(t.endCall)||r("Missing )"),i}}(i)}function s(){return m("directional",t.sideOrCorner,1)||m("angular",t.angleValue,1)}function o(){return m("angular",t.fromAngleValue,1)}function a(){let r,i,n=l();return n&&(r=[],r.push(n),i=e,y(t.comma)&&(n=l(),n?r.push(n):e=i)),r}function l(){let t=function(){const t=m("shape",/^(circle)/i,0);return t&&(t.style=g()||h()),t}()||function(){const t=m("shape",/^(ellipse)/i,0);return t&&(t.style=f()||h()),t}();if(t)t.at=c();else{const e=h();if(e){t=e;const r=c();r&&(t.at=r)}else{const e=u();e&&(t={type:"default-radial",at:e})}}return t}function h(){return m("extent-keyword",t.extentKeywords,1)}function c(){if(m("position",/^at/,0)){const t=u();return t||r("Missing positioning value"),t}}function u(){const t={x:f(),y:f()};if(t.x||t.y)return{type:"position",value:t}}function d(e){let i=e();const n=[];if(i)for(n.push(i);y(t.comma);)i=e(),i?n.push(i):r("One extra comma");return n}function p(){const e=m("hex",t.hexColor,1)||m("rgba",t.rgbaColor,1)||m("rgb",t.rgbColor,1)||m("literal",t.literalColor,0);return e||r("Expected color definition"),e.length=f(),e}function f(){return m("%",t.percentageValue,1)||m("position-keyword",t.positionKeywords,1)||g()}function g(){return m("px",t.pixelValue,1)||m("em",t.emValue,1)}function m(t,e,r){const i=y(e);if(i)return{type:t,value:i[r]}}function y(t){const r=/^[\n\r\t\s]+/.exec(e);r&&v(r[0].length);const i=t.exec(e);return i&&v(i[0].length),i}function v(t){e=e.substr(t)}return function(t){return e=t.toString(),function(){const t=d(i);return e.length>0&&r("Invalid input not EOF"),t}()}}();class mi{static IsGradient(t){return!("string"==typeof t&&!t.includes("gradient"))}static IsGradientStr(t){return"string"==typeof t&&t.includes("gradient")}static Parse(t){if(mi.IsGradientStr(t))try{const e=gi(t)[0];if(e){if("linear"===e.type)return mi.ParseLinear(e);if("radial"===e.type)return mi.ParseRadial(e);if("conic"===e.type)return mi.ParseConic(e)}}catch(e){return t}return t}static ParseConic(t){const{orientation:e,colorStops:r=[]}=t,i=ee/2,n=parseFloat(e.value)/180*ee-i;return{gradient:"conical",x:.5,y:.5,startAngle:n,endAngle:n+ne,stops:r.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:r=[]}=t,i=ee/2;let n="angular"===e.type?parseFloat(e.value)/180*ee:0;for(;n<0;)n+=ne;for(;n>=ne;)n-=ne;let s=0,o=0,a=0,l=0;return n<i?(s=0,o=1,a=Math.sin(n),l=o-Math.cos(n)):n<ee?(s=0,o=0,a=Math.cos(n-i),l=Math.sin(n-i)):n<ee+i?(s=1,o=0,a=s-Math.sin(n-ee),l=Math.cos(n-ee)):(s=1,a=s-Math.cos(n-i-ee),l-=Math.sin(n-i-ee)),{gradient:"linear",x0:s,y0:o,x1:a,y1:l,stops:r.map((t=>({color:t.value,offset:parseFloat(t.length.value)/100})))}}}function yi(t,e,r){let i=e;const{a:n,b:s,c:o,d:a}=t.currentMatrix,l=Math.sign(n)*Math.sqrt(n*n+s*s),h=Math.sign(a)*Math.sqrt(o*o+a*a);return l+h===0?0:(i=i/Math.abs(l+h)*2*r,i)}function vi(t,e,r,i=0,n=0){var s,o,a,l;if(!e||!0===e)return"black";let h,c;if(Et(e))for(let t=0;t<e.length&&(c=e[t],!c);t++);else c=e;if(c=mi.Parse(c),"string"==typeof c)return c;if(r.AABBBounds&&(!r.attribute||0!==r.attribute.scaleX||0!==r.attribute.scaleY)){const e=r.AABBBounds;let u=e.x2-e.x1,d=e.y2-e.y1,p=e.x1-i,f=e.y1-n;if(r.attribute){const{scaleX:t=1,scaleY:e=1,angle:i=0}=r.attribute;u/=t,d/=e,p/=t,f/=e,(i||1!==t||1!==e)&&(p=null!==(s=r.x1WithoutTransform)&&void 0!==s?s:0,f=null!==(o=r.y1WithoutTransform)&&void 0!==o?o:0,u=null!==(a=r.widthWithoutTransform)&&void 0!==a?a:u,d=null!==(l=r.heightWithoutTransform)&&void 0!==l?l:d)}"linear"===c.gradient?h=function(t,e,r,i,n,s){var o,a,l,h;const c=t.createLinearGradient(r+(null!==(o=e.x0)&&void 0!==o?o:0)*n,i+(null!==(a=e.y0)&&void 0!==a?a:0)*s,r+(null!==(l=e.x1)&&void 0!==l?l:1)*n,i+(null!==(h=e.y1)&&void 0!==h?h:0)*s);return e.stops.forEach((t=>{c.addColorStop(t.offset,t.color)})),c}(t,c,p,f,u,d):"conical"===c.gradient?h=function(t,e,r,i,n,s){var o,a;const l=t.createConicGradient(r+(null!==(o=e.x)&&void 0!==o?o:0)*n,i+(null!==(a=e.y)&&void 0!==a?a:0)*s,e.startAngle,e.endAngle);return e.stops.forEach((t=>{l.addColorStop(t.offset,t.color)})),l.GetPattern?l.GetPattern(n+r,s+i,void 0):l}(t,c,p,f,u,d):"radial"===c.gradient&&(h=function(t,e,r,i,n,s){var o,a,l,h,c,u;const d=t.createRadialGradient(r+(null!==(o=e.x0)&&void 0!==o?o:.5)*n,i+(null!==(a=e.y0)&&void 0!==a?a:.5)*s,Math.max(n,s)*(null!==(l=e.r0)&&void 0!==l?l:0),r+(null!==(h=e.x1)&&void 0!==h?h:.5)*n,i+(null!==(c=e.y1)&&void 0!==c?c:.5)*s,Math.max(n,s)*(null!==(u=e.r1)&&void 0!==u?u:.5));return e.stops.forEach((t=>{d.addColorStop(t.offset,t.color)})),d}(t,c,p,f,u,d))}return h||"orange"}const bi=/\w|\(|\)|-/,_i=/[.?!,;:/,。?!、;:]/;function wi(t,e,r=!1){let i=e;for(;bi.test(t[i-1])&&bi.test(t[i])||_i.test(t[i]);)if(i--,i<=0)return r?xi(t,e):e;return i}function xi(t,e){let r=e;for(;bi.test(t[r+1])&&bi.test(t[r])||_i.test(t[r]);)if(r++,r>=t.length)return r;return r+1}var Si=function(t,e,r,i){var n,s=arguments.length,o=s<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,e,r,i);else for(var a=t.length-1;a>=0;a--)(n=t[a])&&(o=(s<3?n(o):s>3?n(e,r,o):n(e,r))||o);return s>3&&o&&Object.defineProperty(e,r,o),o};let Ti=class{configure(t,e){this.canvas=t.canvas,this.context=t.context,t.bindTextMeasure(this)}_measureTextWithoutAlignBaseline(t,e,r){this.context.setTextStyleWithoutAlignBaseline(e);const i=this.context.measureText(t);return r?this.compatibleMetrics(i,e):i}_measureTextWithAlignBaseline(t,e,r){this.context.setTextStyle(e);const i=this.context.measureText(t);return r?this.compatibleMetrics(i,e):i}compatibleMetrics(t,e){if(null==t.actualBoundingBoxAscent||null==t.actualBoundingBoxDescent||null==t.fontBoundingBoxAscent||null==t.fontBoundingBoxDescent){t={width:t.width};const{ascent:r,descent:i}=this.measureTextBoundADscentEstimate(e);t.actualBoundingBoxAscent=r,t.actualBoundingBoxDescent=i,t.fontBoundingBoxAscent=r,t.fontBoundingBoxDescent=i}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:r,right:i}=this.measureTextBoundLeftRightEstimate(e);t.actualBoundingBoxLeft=r,t.actualBoundingBoxRight=i}return t}estimate(t,{fontSize:e=ui.fontSize}){let r=0,i=0;for(let e=0;e<t.length;e++)t.charCodeAt(e)<128?r++:i++;return{width:~~(.8*r*e+i*e),height:e}}measureTextWidth(t,e,r){return this.context?(r=null!=r?r:this._measureTextWithoutAlignBaseline(t,e)).width:this.estimate(t,e).width}measureTextBoundsWidth(t,e,r){return this.context?(r=null!=r?r:this._measureTextWithoutAlignBaseline(t,e)).width:this.estimate(t,e).width}measureTextBoundsLeftRight(t,e,r){return this.context?{left:(r=null!=r?r:this._measureTextWithAlignBaseline(t,e,!0)).actualBoundingBoxLeft,right:r.actualBoundingBoxRight}:this.measureTextBoundLeftRightEstimate(e)}measureTextPixelHeight(t,e,r){var i;return this.context?(r=null!=r?r:this._measureTextWithoutAlignBaseline(t,e,!0),Math.abs(r.actualBoundingBoxAscent-r.actualBoundingBoxDescent)):null!==(i=e.fontSize)&&void 0!==i?i:Zr.fontSize}measureTextPixelADscent(t,e,r){return this.context?{ascent:(r=null!=r?r:this._measureTextWithAlignBaseline(t,e,!0)).actualBoundingBoxAscent,descent:r.actualBoundingBoxDescent}:this.measureTextBoundADscentEstimate(e)}measureTextBoundHieght(t,e,r){var i;return this.context?(r=null!=r?r:this._measureTextWithoutAlignBaseline(t,e,!0),Math.abs(r.fontBoundingBoxAscent-r.fontBoundingBoxDescent)):null!==(i=e.fontSize)&&void 0!==i?i:Zr.fontSize}measureTextBoundADscent(t,e,r){return this.context?{ascent:(r=null!=r?r:this._measureTextWithAlignBaseline(t,e,!0)).fontBoundingBoxAscent,descent:r.fontBoundingBoxDescent}:this.measureTextBoundADscentEstimate(e)}measureTextBoundADscentEstimate(t){var e;const r=null!==(e=t.fontSize)&&void 0!==e?e:Zr.fontSize;return{ascent:.79*r,descent:.21*r}}measureTextBoundLeftRightEstimate(t){var e;const r=null!==(e=t.fontSize)&&void 0!==e?e:Zr.fontSize,{textAlign:i}=t;return"center"===i?{left:r/2,right:r/2}:"right"===i||"end"===i?{left:r,right:0}:{left:0,right:r}}measureTextPixelADscentAndWidth(t,e,r){if(!this.context)return Object.assign(Object.assign({},this.measureTextBoundADscentEstimate(e)),{width:this.estimate(t,e).width});const i=this._measureTextWithoutAlignBaseline(t,e,!0);if(r===ut.actualBounding)return{ascent:i.actualBoundingBoxAscent,descent:i.actualBoundingBoxDescent,width:i.width};if(r===ut.estimate)return Object.assign(Object.assign({},this.measureTextBoundADscentEstimate(e)),{width:i.width});if(r===ut.fontBounding){let t=i.fontBoundingBoxAscent,e=i.fontBoundingBoxDescent;if(i.actualBoundingBoxDescent&&e<i.actualBoundingBoxDescent){const r=i.actualBoundingBoxDescent-e;e+=r,t-=r}else if(i.actualBoundingBoxAscent&&t<i.actualBoundingBoxAscent){const r=i.actualBoundingBoxAscent-t;t+=r,e-=r}return{ascent:t,descent:e,width:i.width}}return{ascent:i.actualBoundingBoxAscent,descent:i.actualBoundingBoxDescent,width:i.width}}measureText(t,e){return this.context?(this.context.setTextStyleWithoutAlignBaseline(e),this.context.measureText(t)):this.estimate(t,e)}clipTextVertical(t,e,r,i){if(0===t.length)return{verticalList:t,width:0};const{fontSize:n=12}=e;t.forEach((t=>{t.width=0===t.direction?n:this.measureTextWidth(t.text,e)}));const s=[];let o=0,a=0;for(;a<t.length&&o+t[a].width<r;a++)o+=t[a].width,s.push(t[a]);if(t[a]&&t[a].text.length>1){const n=this._clipText(t[a].text,e,r-o,0,t[a].text.length-1,"end",!1);if(i&&n.str!==t[a].text){let r="",i=0;for(let e=0;e<a;e++){const n=t[e];r+=n.text,i+=n.text.length}r+=t[a].text;let s=wi(r,i+n.str.length);s-=i,s!==n.str.length-1&&(n.str=n.str.substring(0,s),n.width=this.measureTextWidth(n.str,e))}s.push(Object.assign(Object.assign({},t[a]),{text:n.str,width:n.width})),o+=n.width}return{verticalList:s,width:o}}clipText(t,e,r,i,n){if(0===t.length)return{str:"",width:0};let s=this.measureTextWidth(t,e);if(s<=r)return{str:t,width:s};if(s=this.measureTextWidth(t[0],e),s>r)return{str:"",width:0};const o=this._clipText(t,e,r,0,t.length-1,"end",!1);if(i&&o.str!==t){let r=wi(t,o.str.length,n);r!==o.str.length&&(r>o.str.length&&(o.wordBreaked=r,r=o.str.length),o.str=t.substring(0,r),o.width=this.measureTextWidth(o.str,e))}return o}_clipText(t,e,r,i,n,s,o){let a;if("start"===s)a=this._clipTextStart(t,e,r,i,n),o&&(a.result=o+a.str);else if("middle"===s){const i=this._clipTextMiddle(t,e,r,"","",0,0,1);a={str:"none",width:i.width,result:i.left+o+i.right}}else a=this._clipTextEnd(t,e,r,i,n),o&&(a.result=a.str+o);return a}_clipTextEnd(t,e,r,i,n){if(i===n){Yt.getInstance().warn(`【_clipTextEnd】不应该走到这里${t}, ${i}, ${n}`);const r=t.substring(0,n+1);return{str:r,width:this.measureTextWidth(r,e)}}const s=Math.floor((i+n)/2),o=t.substring(0,s+1),a=this.measureTextWidth(o,e);let l;if(a>r){if(o.length<=1)return{str:"",width:0};const n=t.substring(0,s);return l=this.measureTextWidth(n,e),l<=r?{str:n,width:l}:this._clipTextEnd(t,e,r,i,s)}if(a<r){if(s>=t.length-1)return{str:t,width:this.measureTextWidth(t,e)};const i=t.substring(0,s+2);return l=this.measureTextWidth(i,e),l>=r?{str:o,width:a}:this._clipTextEnd(t,e,r,s,n)}return{str:o,width:a}}_clipTextStart(t,e,r,i,n){const s=Math.ceil((i+n)/2),o=t.substring(s-1,t.length),a=this.measureTextWidth(o,e);let l;if(a>r){if(o.length<=1)return{str:"",width:0};const i=t.substring(s,t.length);return l=this.measureTextWidth(i,e),l<=r?{str:i,width:l}:this._clipTextStart(t,e,r,s,t.length)}if(a<r){if(s<=0)return{str:t,width:this.measureTextWidth(t,e)};const n=t.substring(s-2,t.length);return l=this.measureTextWidth(n,e),l>=r?{str:o,width:a}:this._clipTextStart(t,e,r,i,s)}return{str:o,width:a}}_clipTextMiddle(t,e,r,i,n,s,o,a){const l=t.substring(0,a),h=this.measureTextWidth(l,e);if(h+o>r)return{left:i,right:n,width:s+o};const c=t.substring(t.length-a,t.length),u=this.measureTextWidth(c,e);return h+u>r?{left:l,right:n,width:h+o}:this._clipTextMiddle(t,e,r,l,c,h,u,a+1)}clipTextWithSuffixVertical(t,e,r,i,n,s){if(""===i)return this.clipTextVertical(t,e,r,n);if(0===t.length)return{verticalList:t,width:0};const o=this.clipTextVertical(t,e,r,n);if(o.verticalList.length===t.length&&o.verticalList[o.verticalList.length-1].width===t[t.length-1].width)return o;const a=this.measureTextWidth(i,e);if(a>r)return o;let l;if(r-=a,"start"===s){const s=this.revertVerticalList(t);l=this.clipTextVertical(s,e,r,n);const o=this.revertVerticalList(l.verticalList);o.unshift({text:i,direction:1,width:a}),l.verticalList=o}else if("middle"===s){const s=this.clipTextVertical(t,e,r/2,n),o=this.revertVerticalList(t),h=this.clipTextVertical(o,e,r/2,n);s.verticalList.push({text:i,direction:1,width:a}),this.revertVerticalList(h.verticalList).forEach((t=>s.verticalList.push(t))),l={verticalList:s.verticalList,width:s.width+h.width}}else l=this.clipTextVertical(t,e,r,n),l.verticalList.push({text:i,direction:1,width:a});return l.width+=a,l}revertVerticalList(t){return t.reverse().map((t=>{const e=t.text.split("").reverse().join("");return Object.assign(Object.assign({},t),{text:e})}))}clipTextWithSuffix(t,e,r,i,n,s,o=!1){if(""===i)return this.clipText(t,e,r,n);if(0===t.length)return{str:"",width:0};const a=this.measureTextWidth(t,e);if(!o&&a<=r)return{str:t,width:a};const l=this.measureTextWidth(i,e);if(l>r)return{str:"",width:0};if(o&&a+l<=r)return{str:t+i,width:a+l};r-=l;const h=this._clipText(t,e,r,0,t.length-1,s,i);if(n&&h.str!==t){const r=wi(t,h.str.length);r!==h.str.length&&(h.result=t.substring(0,r),h.width=this.measureTextWidth(h.str,e))}else o&&h.str===t&&(h.result=t+i);return h.str=h.result,h.width+=l,h}};Ti=Si([L()],Ti);var ki=function(t,e,r,i){var n,s=arguments.length,o=s<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,e,r,i);else for(var a=t.length-1;a>=0;a--)(n=t[a])&&(o=(s<3?n(o):s>3?n(e,r,o):n(e,r))||o);return s>3&&o&&Object.defineProperty(e,r,o),o};const Ci=Symbol.for("TextMeasureContribution");let Ei=class extends Ti{};Ei=ki([L()],Ei);const Ai=new class{constructor(t){const e=t||{};e.defaultScope=e.defaultScope||M,this.options=e,this.id=y.GenAutoIncrementId(),this._bindingDictionary=new Map,this._metadataReader=new U}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,r){const i=this._getNotAllArgs(t,!1,e,r);return this._get(i)}getNamed(t,e){return this.getTagged(t,b,e)}isBound(t){return this._bindingDictionary.has(t)}bind(t){const e=this.options.defaultScope,r=new W(t,e),i=this._bindingDictionary.get(t)||[];return i.push(r),this._bindingDictionary.set(t,i),new X(r)}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=>r=>{const i=this.bind(r);return t(i,e),i},r=()=>t=>this.unbind(t),i=()=>t=>this.isBound(t),n=e=>r=>{const i=this.rebind(r);return t(i,e),i};return t=>({bindFunction:e(t),isboundFunction:i(),rebindFunction:n(t),unbindFunction:r(),unbindAsyncFunction:t=>null})}_getNotAllArgs(t,e,r,i){return{avoidConstraints:!1,isMultiInject:e,serviceIdentifier:t,key:r,value:i}}_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:r}=this._metadataReader.getConstructorMetadata(e),i=Object.keys(r),n=[];for(let t=0;t<i.length;t++){const e=r[t],i={};e.forEach((t=>{i[t.key]=t.value}));const s={inject:i[w],multiInject:i[x]},o=s.inject||s.multiInject,a={serviceIdentifier:o,constructorArgsMetadata:e},l=(this._bindingDictionary.get(o)||[]).filter((t=>t.constraint(a)));if(l.length){const t={injectIdentifier:o,metadata:e,bindings:l};n.push(t)}}return n}_resolveFromBinding(t){const e=this._getResolvedFromBinding(t);return this._saveToScope(t,e),e}_getResolvedFromBinding(t){let e;switch(t.type){case I:case j:e=t.cache;break;case z: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 r=this._getChildRequest(t);return this._createInstance(e,r)}_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===D&&(t.cache=e,t.activated=!0)}},Oi=Symbol.for("CanvasFactory");function Bi(t){return Ai.getNamed(Oi,rt.global.env)(t)}const Ri=1e-4,Li=Math.sqrt(3),Pi=1/3;function Di(t){return t>-Yi&&t<Yi}function Mi(t){return t>Yi||t<-Yi}function Ii(t){return"number"==typeof t&&Number.isFinite(t)}const Ni=[0,0],Fi=[0,0],ji=[0,0];function zi(t,e){return(t[0]-e[0])*(t[0]-e[0])+(t[1]-e[1])*(t[1]-e[1])}function Hi(t,e,r,i){const n=1-i;return n*(n*t+2*i*e)+i*i*r}function Wi(t,e,r,i,n){const s=1-n;return s*s*(s*t+3*n*e)+n*n*(n*i+3*s*r)}function Ui(t){return(t%=ne)<0&&(t+=ne),t}function $i(t,e,r,i,n,s,o,a,l){if(0===o)return!1;const h=o;return!(l>e+h&&l>i+h&&l>s+h||l<e-h&&l<i-h&&l<s-h||a>t+h&&a>r+h&&a>n+h||a<t-h&&a<r-h&&a<n-h)&&function(t,e,r,i,n,s,o,a,l){let h=0,c=.005,u=1/0;Ni[0]=o,Ni[1]=a;for(let o=0;o<1;o+=.05){Fi[0]=Hi(t,r,n,o),Fi[1]=Hi(e,i,s,o);const a=zi(Ni,Fi);a<u&&(h=o,u=a)}u=1/0;for(let o=0;o<32&&!(c<Ri);o++){const o=h-c,a=h+c;Fi[0]=Hi(t,r,n,o),Fi[1]=Hi(e,i,s,o);const l=zi(Fi,Ni);if(o>=0&&l<u)h=o,u=l;else{ji[0]=Hi(t,r,n,a),ji[1]=Hi(e,i,s,a);const o=zi(ji,Ni);a<=1&&o<u?(h=a,u=o):c*=.5}}return l&&(l[0]=Hi(t,r,n,h),l[1]=Hi(e,i,s,h)),Math.sqrt(u)}(t,e,r,i,n,s,a,l,null)<=h/2}function Vi(t,e,r,i,n,s,o,a,l,h,c){if(0===l)return!1;const u=l;return!(c>e+u&&c>i+u&&c>s+u&&c>a+u||c<e-u&&c<i-u&&c<s-u&&c<a-u||h>t+u&&h>r+u&&h>n+u&&h>o+u||h<t-u&&h<r-u&&h<n-u&&h<o-u)&&function(t,e,r,i,n,s,o,a,l,h,c){let u,d,p,f,g=0,m=.005,y=1/0;Ni[0]=l,Ni[1]=h;for(let l=0;l<1;l+=.05)Fi[0]=Wi(t,r,n,o,l),Fi[1]=Wi(e,i,s,a,l),p=zi(Ni,Fi),p<y&&(g=l,y=p);y=1/0;for(let l=0;l<32&&!(m<Ri);l++)u=g-m,d=g+m,Fi[0]=Wi(t,r,n,o,u),Fi[1]=Wi(e,i,s,a,u),p=zi(Fi,Ni),u>=0&&p<y?(g=u,y=p):(ji[0]=Wi(t,r,n,o,d),ji[1]=Wi(e,i,s,a,d),f=zi(ji,Ni),d<=1&&f<y?(g=d,y=f):m*=.5);return c&&(c[0]=Wi(t,r,n,o,g),c[1]=Wi(e,i,s,a,g)),Math.sqrt(y)}(t,e,r,i,n,s,o,a,h,c,null)<=u/2}function Gi(t,e,r,i,n,s,o,a,l){if(0===o)return!1;const h=o;a-=t,l-=e;const c=Math.sqrt(a*a+l*l);if(c-h>r||c+h<r)return!1;if(Math.abs(i-n)%ne<1e-4)return!0;if(s){const t=i;i=Ui(n),n=Ui(t)}else i=Ui(i),n=Ui(n);i>n&&(n+=ne);let u=Math.atan2(l,a);return u<0&&(u+=ne),u>=i&&u<=n||u+ne>=i&&u+ne<=n}function Xi(t,e,r,i,n,s,o){if(0===n)return!1;const a=n,l=n/2;let h=0,c=t;if(o>e+l&&o>i+l||o<e-l&&o<i-l||s>t+l&&s>r+l||s<t-l&&s<r-l)return!1;if(t===r)return Math.abs(s-t)<=a/2;h=(e-i)/(t-r),c=(t*i-r*e)/(t-r);const u=h*s-o+c;return u*u/(h*h+1)<=a/2*a/2}const Yi=1e-4;function qi(t,e,r,i,n){const s=6*r-12*e+6*t,o=9*e+3*i-3*t-9*r,a=3*e-3*t;let l=0;if(Di(o)){if(Mi(s)){const t=-a/s;t>=0&&t<=1&&(n[l++]=t)}}else{const t=s*s-4*o*a;if(Di(t))n[0]=-s/(2*o);else if(t>0){const e=Math.sqrt(t),r=(-s+e)/(2*o),i=(-s-e)/(2*o);r>=0&&r<=1&&(n[l++]=r),i>=0&&i<=1&&(n[l++]=i)}}return l}const Zi=[-1,-1,-1],Ki=[-1,-1];function Qi(){const t=Ki[0];Ki[0]=Ki[1],Ki[1]=t}function Ji(t,e,r,i,n,s,o,a,l,h){if(h>e&&h>i&&h>s&&h>a||h<e&&h<i&&h<s&&h<a)return 0;const c=function(t,e,r,i,n,s){const o=i+3*(e-r)-t,a=3*(r-2*e+t),l=3*(e-t),h=t-n,c=a*a-3*o*l,u=a*l-9*o*h,d=l*l-3*a*h;let p=0;if(Di(c)&&Di(u))if(Di(a))s[0]=0;else{const t=-l/a;t>=0&&t<=1&&(s[p++]=t)}else{const t=u*u-4*c*d;if(Di(t)){const t=u/c,e=-a/o+t,r=-t/2;e>=0&&e<=1&&(s[p++]=e),r>=0&&r<=1&&(s[p++]=r)}else if(t>0){const e=Math.sqrt(t);let r=c*a+1.5*o*(-u+e),i=c*a+1.5*o*(-u-e);r=r<0?-Math.pow(-r,Pi):Math.pow(r,Pi),i=i<0?-Math.pow(-i,Pi):Math.pow(i,Pi);const n=(-a-(r+i))/(3*o);n>=0&&n<=1&&(s[p++]=n)}else{const t=(2*c*a-3*o*u)/(2*Math.sqrt(c*c*c)),e=Math.acos(t)/3,r=Math.sqrt(c),i=Math.cos(e),n=(-a-2*r*i)/(3*o),l=(-a+r*(i+Li*Math.sin(e)))/(3*o),h=(-a+r*(i-Li*Math.sin(e)))/(3*o);n>=0&&n<=1&&(s[p++]=n),l>=0&&l<=1&&(s[p++]=l),h>=0&&h<=1&&(s[p++]=h)}}return p}(e,i,s,a,h,Zi);if(0===c)return 0;let u=0,d=-1,p=0,f=0;for(let h=0;h<c;h++){const c=Zi[h],g=0===c||1===c?.5:1;Wi(t,r,n,o,c)<l||(d<0&&(d=qi(e,i,s,a,Ki),Ki[1]<Ki[0]&&d>1&&Qi(),p=Wi(e,i,s,a,Ki[0]),d>1&&(f=Wi(e,i,s,a,Ki[1]))),2===d?c<Ki[0]?u+=p<e?g:-g:c<Ki[1]?u+=f<p?g:-g:u+=a<f?g:-g:c<Ki[0]?u+=p<e?g:-g:u+=a<p?g:-g)}return u}function tn(t,e,r,i,n,s,o,a){if(a>e&&a>i&&a>s||a<e&&a<i&&a<s)return 0;const l=function(t,e,r,i,n){const s=t-2*e+r,o=2*(e-t),a=t-i;let l=0;if(Di(s)){if(Mi(o)){const t=-a/o;t>=0&&t<=1&&(n[l++]=t)}}else{const t=o*o-4*s*a;if(Di(t)){const t=-o/(2*s);t>=0&&t<=1&&(n[l++]=t)}else if(t>0){const e=Math.sqrt(t),r=(-o+e)/(2*s),i=(-o-e)/(2*s);r>=0&&r<=1&&(n[l++]=r),i>=0&&i<=1&&(n[l++]=i)}}return l}(e,i,s,a,Zi);if(0===l)return 0;const h=function(t,e,r){const i=t+r-2*e;return 0===i?.5:(t-e)/i}(e,i,s);if(h>=0&&h<=1){let a=0;const c=Hi(e,i,s,h);for(let i=0;i<l;i++){const l=0===Zi[i]||1===Zi[i]?.5:1;Hi(t,r,n,Zi[i])<o||(Zi[i]<h?a+=c<e?l:-l:a+=s<c?l:-l)}return a}const c=0===Zi[0]||1===Zi[0]?.5:1;return Hi(t,r,n,Zi[0])<o?0:s<e?c:-c}function en(t,e,r,i,n,s,o,a){if((a-=e)>r||a<-r)return 0;const l=Math.sqrt(r*r-a*a);Zi[0]=-l,Zi[1]=l;const h=Math.abs(i-n);if(h<1e-4)return 0;if(h>=ne-1e-4){i=0,n=ne;const e=s?1:-1;return o>=Zi[0]+t&&o<=Zi[1]+t?e:0}if(i>n){const t=i;i=n,n=t}i<0&&(i+=ne,n+=ne);let c=0;for(let e=0;e<2;e++){const r=Zi[e];if(r+t>o){let t=Math.atan2(a,r),e=s?1:-1;t<0&&(t=ne+t),(t>=i&&t<=n||t+ne>=i&&t+ne<=n)&&(t>ee/2&&t<1.5*ee&&(e=-e),c+=e)}}return c}function rn(t){return Math.round(t/ee*1e8)/1e8%2*ee}function nn(t,e){let r=rn(t[0]);r<0&&(r+=ne);const i=r-t[0];let n=t[1];n+=i,!e&&n-r>=ne?n=r+ne:e&&r-n>=ne?n=r-ne:!e&&r>n?n=r+(ne-rn(r-n)):e&&r<n&&(n=r-(ne-rn(n-r))),t[0]=r,t[1]=n}const sn=[0,0];function on(t,e,r,i,n){const s=t,o=t.length;let a,l,h=0,c=0,u=0,d=0,p=0;for(let t=0;t<o;t++){const o=s[t],f=0===t;o[0]===He.M&&t>1&&(r||(h+=Ce(c,u,d,p,i,n))),f&&(c=o[1],u=o[2],d=c,p=u);const g=o[0],m=o[1],y=o[2],v=o[3],b=o[4],_=o[5],w=o[6];let x=b,S=_;sn[0]=x,sn[1]=S,nn(sn,Boolean(o[6])),x=sn[0],S=sn[1];const T=x,k=S-x,C=!!(1-(o[6]?0:1)),E=(i-m)*v/v+m;switch(g){case He.M:d=m,p=y,c=d,u=p;break;case He.L:if(r){if(Xi(c,u,m,y,e,i,n))return!0}else h+=Ce(c,u,m,y,i,n)||0;c=m,u=y;break;case He.C:if(r){if(Vi(c,u,m,y,v,b,_,w,e,i,n))return!0}else h+=Ji(c,u,m,y,v,b,_,w,i,n)||0;c=_,u=w;break;case He.Q:if(r){if($i(c,u,m,y,v,b,e,i,n))return!0}else h+=tn(c,u,m,y,v,b,i,n)||0;c=v,u=b;break;case He.A:if(a=Math.cos(T)*v+m,l=Math.sin(T)*v+y,f?(d=a,p=l):h+=Ce(c,u,a,l,i,n),r){if(Gi(m,y,v,T,T+k,C,e,E,n))return!0}else h+=en(m,y,v,T,T+k,C,E,n);c=Math.cos(T+k)*v+m,u=Math.sin(T+k)*v+y;break;case He.R:if(d=c=m,p=u=y,a=d+v,l=p+b,r){if(Xi(d,p,a,p,e,i,n)||Xi(a,p,a,l,e,i,n)||Xi(a,l,d,l,e,i,n)||Xi(d,l,d,p,e,i,n))return!0}else h+=Ce(a,p,a,l,i,n),h+=Ce(d,l,d,p,i,n);break;case He.Z:if(r){if(Xi(c,u,d,p,e,i,n))return!0}else h+=Ce(c,u,d,p,i,n);c=d,u=p}}return r||(f=u,g=p,Math.abs(f-g)<Yi)||(h+=Ce(c,u,d,p,i,n)||0),0!==h;var f,g}const an=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=Bi(Object.assign({nativeCanvas:rt.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},r=Bi(Object.assign({nativeCanvas:rt.global.createCanvas(e)},e));return this.allocatedCanvas.push(r),r}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(...t){this.pools=[]}};var ln=function(t,e,r,i){var n,s=arguments.length,o=s<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,e,r,i);else for(var a=t.length-1;a>=0;a--)(n=t[a])&&(o=(s<3?n(o):s>3?n(e,r,o):n(e,r))||o);return s>3&&o&&Object.defineProperty(e,r,o),o},hn=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const cn=Symbol.for("VWindow"),un=Symbol.for("WindowHandlerContribution");let dn=class extends st{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 J(["x","y","width","height"])},this.active=()=>{const t=this.global;t.env&&!this.actived&&(Ai.getNamed(un,t.env).configure(this,t),this.actived=!0)},this._uid=y.GenAutoIncrementId(),this.global=rt.global,this.postInit()}_nativeAddEventListener(t,e,r){return this._handler.addEventListener(t,e,r)}_nativeRemoveEventListener(t,e,r){return this._handler.removeEventListener(t,e,r)}_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,r;this._handler.createWindow(t);const i=this._handler.getWH();this._width=i.width,this._height=i.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!==(r=t.height)&&void 0!==r?r: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,r,i,n,s){this._handler.setViewBoxTransform(t,e,r,i,n,s)}getViewBox(){return this._handler.getViewBox()}getViewBoxTransform(){return this._handler.getViewBoxTransform()}pointTransform(t,e){const r=this._handler.getViewBox(),i={x:t,y:e};return this._handler.getViewBoxTransform().transformPoint({x:t,y:e},i),i.x-=r.x1,i.y-=r.y1,i}hasSubView(){const t=this._handler.getViewBox();return!(0===t.x1&&0===t.y1&&qt(this.width,t.width())&&qt(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)}};dn=ln([L(),hn("design:paramtypes",[])],dn);var pn=function(t,e,r,i){var n,s=arguments.length,o=s<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,e,r,i);else for(var a=t.length-1;a>=0;a--)(n=t[a])&&(o=(s<3?n(o):s>3?n(e,r,o):n(e,r))||o);return s>3&&o&&Object.defineProperty(e,r,o),o},fn=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},gn=function(t,e){return function(r,i){e(r,i,t)}};let mn=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=rt.global,this.global.hooks.onSetEnv.tap("graphic-util",((t,e,r)=>{this.configured=!1,this.configure(r,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=an.shareCanvas();this._canvas=t,this._context=t.getContext("2d")}}bindTextMeasure(t){this._textMeasure=t}measureText(t,e,r="native"){var i;this.configure(this.global,this.global.env);const n=this.global.measureTextMethod;this.global.measureTextMethod=r;const s={width:this._textMeasure.measureTextWidth(t,e),height:null!==(i=e.fontSize)&&void 0!==i?i:Zr.fontSize};return this.global.measureTextMethod=n,s}createTextMeasureInstance(t,e,r){return this.configure(this.global,this.global.env),new Oe(Object.assign({defaultFontParams:{fontFamily:Zr.fontFamily,fontSize:Zr.fontSize},getCanvasForMeasure:r||(()=>this.canvas),getTextBounds:void 0,specialCharSet:"-/: .,@%'\"~"+Oe.ALPHABET_CHAR_SET+Oe.ALPHABET_CHAR_SET.toUpperCase()},null!=e?e:{}),t)}drawGraphicToCanvas(t,e,r){if(!e.defaultLayer)return null;const i=Ai.get(cn),n=t.AABBBounds,s=n.width(),o=n.height(),a=-n.x1,l=-n.y1;i.create({viewBox:{x1:a,y1:l,x2:n.x2,y2:n.y2},width:s,height:o,canvas:r,dpr:e.window.dpr,canvasControled:!0,offscreen:!0,title:""});const h=e.params.optimize.disableCheckGraphicWidthOutRange;e.params.optimize.disableCheckGraphicWidthOutRange=!0,e.defaultLayer.getNativeHandler().drawTo(i,[t],{transMatrix:i.getViewBoxTransform(),viewBox:i.getViewBox(),stage:e,layer:e.defaultLayer,renderService:e.renderService,background:"transparent",clear:!0,updateBounds:!1}),e.params.optimize.disableCheckGraphicWidthOutRange=h;const c=i.getNativeHandler();return c.nativeCanvas?c.nativeCanvas:null}};var yn;mn=pn([L(),gn(0,B(Y)),gn(0,P(Ci)),fn("design:paramtypes",[Object])],mn),function(t){t[t.transform=0]="transform",t[t.matrix=1]="matrix"}(yn||(yn={}));const vn=new De;let bn=class{constructor(){this.matrix=new De}init(t){return this.mode=yn.transform,this.originTransform=t,this.matrix.reset(),this}fromMatrix(t,e){return this.mode=yn.matrix,this.outSourceMatrix=t,this.outTargetMatrix=e,this}scaleMatrix(t,e,r){const i=this.outSourceMatrix;if(vn.setValue(i.a,i.b,i.c,i.d,i.e,i.f),this.outTargetMatrix.reset(),r){const{x:i,y:n}=r;this.outTargetMatrix.translate(i,n),this.outTargetMatrix.scale(t,e),this.outTargetMatrix.translate(-i,-n)}else this.outTargetMatrix.scale(t,e);return this.outTargetMatrix.multiply(vn.a,vn.b,vn.c,vn.d,vn.e,vn.f),this}rotateMatrix(t,e){const r=this.outSourceMatrix;if(vn.setValue(r.a,r.b,r.c,r.d,r.e,r.f),this.outTargetMatrix.reset(),e){const{x:r,y:i}=e;this.outTargetMatrix.translate(r,i),this.outTargetMatrix.rotate(t),this.outTargetMatrix.translate(-r,-i)}else this.outTargetMatrix.rotate(t);return this.outTargetMatrix.multiply(vn.a,vn.b,vn.c,vn.d,vn.e,vn.f),this}scale(t,e,r){return this.mode===yn.matrix?this.scaleMatrix(t,e,r):this}rotate(t,e){return this.mode===yn.matrix?this.rotateMatrix(t,e):this}translateMatrix(t,e){const r=this.outSourceMatrix;return vn.setValue(r.a,r.b,r.c,r.d,r.e,r.f),this.outTargetMatrix.reset(),this.outTargetMatrix.translate(t,e),this.outTargetMatrix.multiply(vn.a,vn.b,vn.c,vn.d,vn.e,vn.f),this}translate(t,e){return this.mode===yn.matrix?this.translateMatrix(t,e):this}simplify(t){return this.mode===yn.matrix?this.simplifyMatrix(t):this}simplifyMatrix(t){return this}};bn=pn([L(),fn("design:paramtypes",[])],bn);const _n={arc:ti,area:ei,circle:ri,line:si,path:oi,symbol:ci,text:ui,rect:hi,polygon:ai,star:li,richtext:di,richtextIcon:fi,image:pi,group:ii,glyph:ni},wn=Object.keys(_n);function xn(t,e){Object.keys(e).forEach((r=>{t[r]=e[r]}))}const Sn={arc:Object.assign({},_n.arc),area:Object.assign({},_n.area),circle:Object.assign({},_n.circle),line:Object.assign({},_n.line),path:Object.assign({},_n.path),symbol:Object.assign({},_n.symbol),text:Object.assign({},_n.text),rect:Object.assign({},_n.rect),polygon:Object.assign({},_n.polygon),star:Object.assign({},_n.star),richtext:Object.assign({},_n.richtext),richtextIcon:Object.assign({},_n.richtextIcon),image:Object.assign({},_n.image),group:Object.assign({},_n.group),glyph:Object.assign({},_n.glyph)};class Tn{constructor(){this.initTheme(),this.dirty=!1}initTheme(){this._defaultTheme={},wn.forEach((t=>{this._defaultTheme[t]=Object.create(Sn[t])})),this.combinedTheme=this._defaultTheme}getTheme(t){if(!t)return this.combinedTheme;if(!this.dirty)return this.combinedTheme;let e={};const r=this.getParentWithTheme(t);return r&&(e=r.theme),this.applyTheme(t,e),this.combinedTheme}getParentWithTheme(t){for(;t.parent;)if((t=t.parent).theme)return t;return null}applyTheme(t,e,r=!1){if(this.dirty){const i=this.getParentWithTheme(t);if(i){const t=i.theme;(t.dirty||r)&&t.applyTheme(i,e,!0)}this.userTheme?this.doCombine(i&&i.theme.combinedTheme):(i?this.combinedTheme=i.theme.combinedTheme:(this.combinedTheme=this._defaultTheme,Yt.getInstance().warn("未知错误,走到不应该走的区域里")),this.dirty=!1)}return this.combinedTheme}doCombine(t){const e=this.userTheme,r=this.combinedTheme;wn.forEach((i=>{const n=Object.create(Sn[i]);t&&t[i]&&xn(n,t[i]),r[i]&&xn(n,r[i]),e[i]&&xn(n,e[i]),this.combinedTheme[i]=n})),e.common&&wn.forEach((t=>{xn(this.combinedTheme[t],e.common)})),this.dirty=!1}setTheme(t,e){let r=this.userTheme;r?Object.keys(t).forEach((e=>{r[e]?Object.assign(r[e],t[e]):r[e]=Object.assign({},t[e])})):r=t,this.userTheme=r,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 kn=new Tn;function Cn(t,e){return t.glyphHost?Cn(t.glyphHost):e?(t.isContainer,e):function(t){let e;if(e=t.isContainer?t:t.parent,e){for(;e&&!e.theme;)e=e.parent;return e?(e.theme||e.createTheme(),e.theme.getTheme(e)):kn.getTheme()}return null}(t)||t.attachedThemeGraphic&&Cn(t.attachedThemeGraphic)||kn.getTheme()}var En=function(t,e,r,i){return new(r||(r=Promise))((function(n,s){function o(t){try{l(i.next(t))}catch(t){s(t)}}function a(t){try{l(i.throw(t))}catch(t){s(t)}}function l(t){var e;t.done?n(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(o,a)}l((i=i.apply(t,e||[])).next())}))};class An extends mt{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=y.GenAutoIncrementId(),this._firstChild=null,this._lastChild=null,this.parent=null,this._count=1}forEachChildren(t,e=!1){if(e){let e=this._lastChild,r=0;for(;e;){if(t(e,r++))return;e=e._prev}}else{let e=this._firstChild,r=0;for(;e;){if(t(e,r++))return;e=e._next}}}forEachChildrenAsync(t,e=!1){return En(this,void 0,void 0,(function*(){if(e){let e=this._lastChild,r=0;for(;e;){let i=t(e,r++);if(i.then&&(i=yield i),i)return;e=e._prev}}else{let e=this._firstChild,r=0;for(;e;){let i=t(e,r++);if(i.then&&(i=yield i),i)return;e=e._next}}}))}forEach(t){return this.forEachChildren(t)}appendChild(t,e=!0){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,e=!1){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&&Yt.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 r=this._firstChild;for(let t=0;t<e;t++){if(!r)return null;t>0&&(r=r._next)}if(!r)return null;t._next=r._next,t._prev=r,r._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 r=this._nodeList[e];return this._nodeList.splice(e,0,t),this.insertBefore(t,r)}let r;this._nodeList[e]=t;for(let t=e-1;t>=0&&(r=this._nodeList[t],!r);t--);if(r)return r._next?this.insertBefore(t,r._next):this.appendChild(t);this._ignoreWarn=!0;const i=this.insertInto(t,0);return this._ignoreWarn=!1,i}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,e=!1){let r=null;return this.forEachChildren(((e,i)=>!(e===this||!t(e,i)||(r=e,0)))),e&&this.forEachChildren((e=>{if(e.isContainer){const i=e.find(t,!0);if(i)return r=i,!0}return!1})),r}findAll(t,e=!1){let r=[];return this.forEachChildren(((e,i)=>{e!==this&&t(e,i)&&r.push(e)})),e&&this.forEachChildren((e=>{if(e.isContainer){const i=e.findAll(t,!0);i.length&&(r=r.concat(i))}})),r}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,e=!1){return this.find((e=>e.name===t),e)}getChildAt(t){let e=this._firstChild;if(!e)return null;for(let r=0;r<t;r++){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 r=this._firstChild;for(;r;)r[t]=e,r.setAllDescendantsProps(t,e),r=r._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,r){const i=vt(r,!0)&&r||xt(r)&&r.capture,n=xt(r)&&r.once,s=bt(e)?void 0:e;return t=i?`${t}capture`:t,e=bt(e)?e:e.handleEvent,n?super.once(t,e,s):super.on(t,e,s),this}on(t,e,r){return this.addEventListener(t,e,r)}removeEventListener(t,e,r){const i=vt(r,!0)&&r||xt(r)&&r.capture,n=bt(e)?void 0:e;t=i?`${t}capture`:t,e=bt(e)?e:e.handleEvent;const s=xt(r)&&r.once;return super.off(t,e,n,s),this}off(t,e,r){return this.removeEventListener(t,e,r)}once(t,e,r){return xt(r)?(r.once=!0,this.addEventListener(t,e,r)):this.addEventListener(t,e,{once:!0})}removeAllEventListeners(){return super.removeAllListeners(),this}removeAllListeners(){return this.removeAllEventListeners()}dispatchEvent(t,...e){return super.emit(t.type,t,...e),!t.defaultPrevented}emit(t,e){return this.dispatchEvent(t,e)}release(){this.removeAllListeners()}}class On{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=On.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 r=e.stage.eventSystem.manager.propagationPath(e);this.detailPath.push(r),this._composedDetailPath(t.params)}}}preventDefault(){try{this.nativeEvent instanceof Event&&this.nativeEvent.cancelable&&this.nativeEvent.preventDefault()}catch(t){this.nativeEvent.preventDefault&&bt(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&&bt(this.nativeEvent.stopPropagation)&&this.nativeEvent.stopPropagation()}this.propagationStopped=!0}initEvent(){}initUIEvent(){}clone(){throw new Error("Method not implemented.")}}class Bn extends On{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,r,i,n,s,o,a,l,h,c,u,d,p,f){throw new Error("Method not implemented.")}}class Rn extends Bn{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,r;const i=new Rn(this.manager);i.eventPhase=i.NONE,i.currentTarget=null,i.path=[],i.detailPath=[],i.target=null,i.nativeEvent=this.nativeEvent,i.originalEvent=this.originalEvent,null===(t=this.manager)||void 0===t||t.copyPointerData(this,i),null===(e=this.manager)||void 0===e||e.copyMouseData(this,i),null===(r=this.manager)||void 0===r||r.copyData(this,i),i.target=this.target,i.path=this.composedPath().slice();const n=this.composedDetailPath();return i.detailPath=n&&n.slice(),i.type=this.type,i}}class Ln extends Bn{constructor(){super(...arguments),this.DOM_DELTA_PIXEL=0,this.DOM_DELTA_LINE=1,this.DOM_DELTA_PAGE=2}clone(){var t,e,r;const i=new Ln(this.manager);i.eventPhase=i.NONE,i.currentTarget=null,i.path=[],i.detailPath=[],i.target=null,i.nativeEvent=this.nativeEvent,i.originalEvent=this.originalEvent,null===(t=this.manager)||void 0===t||t.copyWheelData(this,i),null===(e=this.manager)||void 0===e||e.copyMouseData(this,i),null===(r=this.manager)||void 0===r||r.copyData(this,i),i.target=this.target,i.path=this.composedPath().slice();const n=this.composedDetailPath();return i.detailPath=n&&n.slice(),i.type=this.type,i}}Ln.DOM_DELTA_PIXEL=0,Ln.DOM_DELTA_LINE=1,Ln.DOM_DELTA_PAGE=2;let Pn=class extends On{constructor(t,e){super(),this.type=t,this.detail=e}};const Dn="object"==typeof performance&&performance.now?performance:Date;function Mn(t){return"mouse"===t||"pen"===t}const In={dispatchEvent(t){var e;if(!(t instanceof On))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 Pn(t,e))}},Nn={touchstart:"pointerdown",touchend:"pointerup",touchendoutside:"pointerupoutside",touchmove:"pointermove",touchcancel:"pointercancel"};class Fn{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,r=e.length;t<r;t++){const r=e[t],i=this.bootstrapEvent(this.rootPointerEvent,r);this.manager.mapEvent(i)}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,r=e.length;t<r;t++){const r=this.bootstrapEvent(this.rootPointerEvent,e[t]);this.manager.mapEvent(r)}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":"",r=this.normalizeToPointerData(t);for(let t=0,i=r.length;t<i;t++){const i=this.bootstrapEvent(this.rootPointerEvent,r[t]);i.type+=e,this.manager.mapEvent(i)}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,r=e.length;t<r;t++){const r=this.bootstrapEvent(this.rootPointerEvent,e[t]);this.manager.mapEvent(r)}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:r,rootNode:i,global:n,autoPreventDefault:s=!1,clickInterval:o,supportsTouchEvents:a=n.supportsTouchEvents,supportsPointerEvents:l=n.supportsPointerEvents}=t;this.manager=new class{constructor(t,e){this.dispatch=new mt,this.cursorTarget=null,this.pauseNotify=!1,this.mappingState={trackingData:{}},this.eventPool=new Map,this.onPointerDown=(t,e)=>{if(!(t instanceof Rn))return void Yt.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const r=this.createPointerEvent(t,t.type,e);if(this.dispatchEvent(r,"pointerdown"),"touch"===r.pointerType)this.dispatchEvent(r,"touchstart");else if(Mn(r.pointerType)){const t=2===r.button;this.dispatchEvent(r,t?"rightdown":"mousedown")}this.trackingData(t.pointerId).pressTargetsByButton[t.button]=r.composedPath(),this.freeEvent(r)},this.onPointerMove=(t,e)=>{var r,i;if(!(t instanceof Rn))return void Yt.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const n=this.createPointerEvent(t,t.type,e),s=Mn(n.pointerType),o=this.trackingData(t.pointerId),a=this.findMountedTarget(o.overTargets);if(o.overTargets&&a&&a!==this.rootTarget&&a!==n.target){const e="mousemove"===t.type?"mouseout":"pointerout",r=this.createPointerEvent(t,e,a||void 0);if(this.dispatchEvent(r,"pointerout"),s&&this.dispatchEvent(r,"mouseout"),!n.composedPath().includes(a)){const e=this.createPointerEvent(t,"pointerleave",a||void 0);for(e.eventPhase=e.AT_TARGET;e.target&&!n.composedPath().includes(e.target);)e.currentTarget=e.target,this.notifyTarget(e),s&&this.notifyTarget(e,"mouseleave"),e.target=e.target.parent;this.freeEvent(e)}this.freeEvent(r)}if(a!==n.target){const e="mousemove"===t.type?"mouseover":"pointerover",r=this.clonePointerEvent(n,e);this.dispatchEvent(r,"pointerover"),s&&this.dispatchEvent(r,"mouseover");let i=null==a?void 0:a.parent;for(;i&&i!==this.rootTarget.parent&&i!==n.target;)i=i.parent;if(!i||i===this.rootTarget.parent){const t=this.clonePointerEvent(n,"pointerenter");t.eventPhase=t.AT_TARGET;let e=t.target;const r=new Set;let i=a;for(;i&&i!==this.rootTarget;)r.add(i),i=i.parent;for(;e&&e!==a&&e!==this.rootTarget.parent;)r.has(e)||(t.currentTarget=e,this.notifyTarget(t),s&&this.notifyTarget(t,"mouseenter")),e=e.parent;this.freeEvent(t)}this.freeEvent(r)}this.dispatchEvent(n,"pointermove"),"touch"===n.pointerType&&this.dispatchEvent(n,"touchmove"),s&&(this.dispatchEvent(n,"mousemove"),this.cursorTarget=n.target,this.cursor=(null===(i=null===(r=n.target)||void 0===r?void 0:r.attribute)||void 0===i?void 0:i.cursor)||this.rootTarget.getCursor()),o.overTargets=n.composedPath(),this.freeEvent(n)},this.onPointerOver=(t,e)=>{var r,i;if(!(t instanceof Rn))return void Yt.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const n=this.trackingData(t.pointerId),s=this.createPointerEvent(t,t.type,e),o=Mn(s.pointerType);this.dispatchEvent(s,"pointerover"),o&&this.dispatchEvent(s,"mouseover"),"mouse"===s.pointerType&&(this.cursorTarget=s.target,this.cursor=(null===(i=null===(r=s.target)||void 0===r?void 0:r.attribute)||void 0===i?void 0:i.cursor)||this.rootTarget.getCursor());const a=this.clonePointerEvent(s,"pointerenter");for(a.eventPhase=a.AT_TARGET;a.target&&a.target!==this.rootTarget.parent;)a.currentTarget=a.target,this.notifyTarget(a),o&&this.notifyTarget(a,"mouseenter"),a.target=a.target.parent;n.overTargets=s.composedPath(),this.freeEvent(s),this.freeEvent(a)},this.onPointerOut=(t,e)=>{if(!(t instanceof Rn))return void Yt.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const r=this.trackingData(t.pointerId);if(r.overTargets){const e=Mn(t.pointerType),i=this.findMountedTarget(r.overTargets),n=this.createPointerEvent(t,"pointerout",i||void 0);this.dispatchEvent(n),e&&this.dispatchEvent(n,"mouseout");const s=this.createPointerEvent(t,"pointerleave",i||void 0);for(s.eventPhase=s.AT_TARGET;s.target&&s.target!==this.rootTarget.parent;)s.currentTarget=s.target,this.notifyTarget(s),e&&this.notifyTarget(s,"mouseleave"),s.target=s.target.parent;r.overTargets=[],this.freeEvent(n),this.freeEvent(s)}this.cursorTarget=null,this.cursor=""},this.onPointerUp=(t,e)=>{var r;if(!(t instanceof Rn))return void Yt.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const i=Dn.now(),n=this.createPointerEvent(t,t.type,e);if(this.dispatchEvent(n,"pointerup"),"touch"===n.pointerType)this.dispatchEvent(n,"touchend");else if(Mn(n.pointerType)){const t=2===n.button;this.dispatchEvent(n,t?"rightup":"mouseup")}const s=this.trackingData(t.pointerId),o=this.findMountedTarget(s.pressTargetsByButton[t.button]);let a=o;if(o&&!n.composedPath().includes(o)){let e=o;for(;e&&!n.composedPath().includes(e);){if(n.currentTarget=e,this.notifyTarget(n,"pointerupoutside"),"touch"===n.pointerType)this.notifyTarget(n,"touchendoutside");else if(Mn(n.pointerType)){const t=2===n.button;this.notifyTarget(n,t?"rightupoutside":"mouseupoutside")}e=e.parent}delete s.pressTargetsByButton[t.button],a=e}if(a){const e=this.clonePointerEvent(n,"click");e.target=a,e.path=[],e.detailPath=[],s.clicksByButton[t.button]||(s.clicksByButton[t.button]={clickCount:0,target:e.target,timeStamp:i});const o=s.clicksByButton[t.button];o.target===e.target&&i-o.timeStamp<(null!==(r=this._config.clickInterval)&&void 0!==r?r:200)?++o.clickCount:o.clickCount=1,o.target=e.target,o.timeStamp=i,e.detail=o.clickCount,Mn(e.pointerType)?(this.dispatchEvent(e,"click"),2===o.clickCount&&this.dispatchEvent(e,"dblclick")):"touch"===e.pointerType&&this._config.supportsTouchEvents&&(this.dispatchEvent(e,"tap"),2===o.clickCount&&this.dispatchEvent(e,"dbltap")),this.dispatchEvent(e,"pointertap"),this.freeEvent(e)}this.freeEvent(n)},this.onPointerUpOutside=(t,e)=>{if(!(t instanceof Rn))return void Yt.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const r=this.trackingData(t.pointerId),i=this.findMountedTarget(r.pressTargetsByButton[t.button]),n=this.createPointerEvent(t,t.type,e);if(i){let e=i;for(;e;)n.currentTarget=e,this.notifyTarget(n,"pointerupoutside"),"touch"===n.pointerType?this.notifyTarget(n,"touchendoutside"):Mn(n.pointerType)&&this.notifyTarget(n,2===n.button?"rightupoutside":"mouseupoutside"),e=e.parent;delete r.pressTargetsByButton[t.button]}this.freeEvent(n)},this.onWheel=(t,e)=>{if(!(t instanceof Ln))return void Yt.getInstance().warn("EventManager cannot map a non-wheel event as a wheel event");const r=this.createWheelEvent(t,e);this.dispatchEvent(r),this.freeEvent(r)},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,r,i,n,s,o,a;if(!this.rootTarget)return;const l=this.mappingTable[t.type];let h;const c=`${t.canvasX}-${t.canvasY}`;if((null===(e=this._prePointTargetCache)||void 0===e?void 0:e[c])&&(null===(i=null===(r=this._prePointTargetCache)||void 0===r?void 0:r[c])||void 0===i?void 0:i.stage)&&(null===(s=null===(n=this._prePointTargetCache)||void 0===n?void 0:n[c])||void 0===s?void 0:s.stage.renderCount)===(null===(o=this._prePointTargetCache)||void 0===o?void 0:o.stageRenderCount)?h=this._prePointTargetCache[c]:(h=this.pickTarget(t.viewX,t.viewY,t),t.pickParams||(this._prePointTargetCache={[c]:h,stageRenderCount:null!==(a=null==h?void 0:h.stage.renderCount)&&void 0!==a?a:-1})),l)for(let e=0,r=l.length;e<r;e++)l[e].fn(t,h);else Yt.getInstance().warn(`[EventManager]: Event mapping not defined for ${t.type}`)}propagate(t,e){if(!t.target)return;const r=t.composedPath();t.eventPhase=t.CAPTURING_PHASE;for(let i=0,n=r.length-1;i<n;i++)if(t.currentTarget=r[i],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 i=r.length-2;i>=0;i--)if(t.currentTarget=r[i],this.notifyTarget(t,e),t.propagationStopped||t.propagationImmediatelyStopped)return}}propagationPath(t){const e=[t];for(let r=0;r<2048&&t!==this.rootTarget&&t.parent;r++){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 r=t.eventPhase===t.CAPTURING_PHASE||t.eventPhase===t.AT_TARGET?`${e}capture`:e;this.notifyListeners(t,r),t.eventPhase===t.AT_TARGET&&this.notifyListeners(t,e)}findMountedTarget(t){if(!t)return null;let e=t[0];for(let r=1;r<t.length&&t[r].parent===e;r++)e=t[r];return e}createPointerEvent(t,e,r){var i,n;const s=this.allocateEvent(Rn);return this.copyPointerData(t,s),this.copyMouseData(t,s),this.copyData(t,s),s.nativeEvent=t.nativeEvent,s.originalEvent=t,s.target=r||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),"string"==typeof e&&(s.type=e),s}createWheelEvent(t,e){var r,i;const n=this.allocateEvent(Ln);return this.copyWheelData(t,n),this.copyMouseData(t,n),this.copyData(t,n),n.nativeEvent=t.nativeEvent,n.originalEvent=t,n.target=e||this.pickTarget(null!==(r=n.viewX)&&void 0!==r?r:n.global.x,null!==(i=n.viewY)&&void 0!==i?i:n.global.y,n),n}clonePointerEvent(t,e){const r=this.allocateEvent(Rn);r.nativeEvent=t.nativeEvent,r.originalEvent=t.originalEvent,this.copyPointerData(t,r),this.copyMouseData(t,r),this.copyData(t,r),r.target=t.target,r.path=t.composedPath().slice();const i=t.composedDetailPath();return r.detailPath=i&&i.slice(),r.type=null!=e?e:r.type,r}copyWheelData(t,e){e.deltaMode=t.deltaMode,e.deltaX=t.deltaX,e.deltaY=t.deltaY,e.deltaZ=t.deltaZ}copyPointerData(t,e){t instanceof Rn&&e instanceof Rn&&(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 Bn&&e instanceof Bn&&(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((r=>{e[r].x=t[r].x,e[r].y=t[r].y})))}copyData(t,e){e.isTrusted=t.isTrusted,e.srcElement=t.srcElement,e.timeStamp=Dn.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 r=(null===(e=this.eventPool.get(t))||void 0===e?void 0:e.pop())||new t(this);return r.eventPhase=r.NONE,r.currentTarget=null,r.path=[],r.detailPath=[],r.target=null,r}freeEvent(t){var e;if(t.manager!==this)throw new Error("It is illegal to free an event not managed by this EventManager!");const r=t.constructor;this.eventPool.has(r)||this.eventPool.set(r,[]),null===(e=this.eventPool.get(r))||void 0===e||e.push(t)}notifyListeners(t,e){const r=t.currentTarget._events[e];if(r)if("fn"in r)r.once&&t.currentTarget.removeEventListener(e,r.fn,{once:!0}),r.fn.call(r.context,t);else for(let i=0,n=r.length;i<n&&!t.propagationImmediatelyStopped;i++)r[i].once&&t.currentTarget.removeEventListener(e,r[i].fn,{once:!0}),r[i].fn.call(r[i].context,t);this.emitDelegation(t,e)}emitDelegation(t,e){const r=t.currentTarget._events["*"];if(r)if("fn"in r)r.fn.call(r.context,t,e);else for(let i=0,n=r.length;i<n&&!t.propagationImmediatelyStopped;i++)r[i].fn.call(r[i].context,t,e)}pickTarget(t,e,r){let i;const n=this.rootTarget.pick(t,e);return i=n&&n.graphic?n.graphic:n&&n.group?n.group:this.rootTarget.AABBBounds.contains(t,e)?this.rootTarget:null,r&&(r.pickParams=n.params),i}release(){this.dispatch.removeAllListeners(),this.eventPool.clear(),this.rootTarget=null,this.mappingTable=null,this.mappingState=null,this.cursorTarget=null}}(i,{clickInterval:o,supportsTouchEvents:a}),this.globalObj=n,this.supportsPointerEvents=l,this.supportsTouchEvents=a,this.supportsMouseEvents=n.supportsMouseEvents,this.applyStyles=n.applyStyles,this.autoPreventDefault=s,this.eventsAdded=!1,this.rootPointerEvent=new Rn,this.rootWheelEvent=new Ln,this.cursorStyles={default:"inherit",pointer:"pointer"},this.resolution=r,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:r,domElement:i}=this;if(this.currentCursor===t)return;this.currentCursor=t;const n=this.cursorStyles[t];n?"string"==typeof n&&r?i.style.cursor=n:"function"==typeof n?n(t):"object"==typeof n&&r&&Object.assign(i.style,n):r&&Ct(t)&&!jt(this.cursorStyles,t)&&(i.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,r;const i=null===(e=this.globalObj)||void 0===e?void 0:e.mapToCanvasPoint(t,this.domElement);if(i)return i;let n=0,s=0;if(t.changedTouches){const e=null!==(r=t.changedTouches[0])&&void 0!==r?r:{};n=e.clientX||0,s=e.clientY||0}else n=t.clientX||0,s=t.clientY||0;const o=this.domElement.getBoundingClientRect();return{x:n-o.left,y:s-o.top}}normalizeToPointerData(t){const e=[];if(this.supportsTouchEvents&&t.changedTouches&&t.changedTouches.length)for(let r=0,i=t.changedTouches.length;r<i;r++){const i=t.changedTouches[r];kt(i.button)&&(i.button=0),kt(i.buttons)&&(i.buttons=1),kt(i.isPrimary)&&(i.isPrimary=1===t.touches.length&&"touchstart"===t.type),kt(i.width)&&(i.width=i.radiusX||1),kt(i.height)&&(i.height=i.radiusY||1),kt(i.tiltX)&&(i.tiltX=0),kt(i.tiltY)&&(i.tiltY=0),kt(i.pointerType)&&(i.pointerType="touch"),kt(i.pointerId)&&(i.pointerId=i.identifier||0),kt(i.pressure)&&(i.pressure=i.force||.5),kt(i.twist)&&(i.twist=0),kt(i.tangentialPressure)&&(i.tangentialPressure=0),kt(i.layerX)&&(i.layerX=i.offsetX=i.clientX),kt(i.layerY)&&(i.layerY=i.offsetY=i.clientY),i.isNormalized=!0,i.type=t.type,e.push(i)}else if(!this.globalObj.supportsMouseEvents||t instanceof MouseEvent&&!(this.supportsPointerEvents&&t instanceof PointerEvent)){const r=t;kt(r.isPrimary)&&(r.isPrimary=!0),kt(r.width)&&(r.width=1),kt(r.height)&&(r.height=1),kt(r.tiltX)&&(r.tiltX=0),kt(r.tiltY)&&(r.tiltY=0),kt(r.pointerType)&&(r.pointerType="mouse"),kt(r.pointerId)&&(r.pointerId=1),kt(r.pressure)&&(r.pressure=.5),kt(r.twist)&&(r.twist=0),kt(r.tangentialPressure)&&(r.tangentialPressure=0),r.isNormalized=!0,e.push(r)}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:r,y:i}=this.mapToCanvasPoint(t);e.canvas.x=r,e.canvas.y=i,e.global.x=r,e.global.y=i,e.offset.x=r,e.offset.y=i;const{x:n,y:s}=this.mapToViewportPoint(e);return e.viewport.x=n,e.viewport.y=s,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:r,y:i}=this.mapToCanvasPoint(e);t.canvas.x=r,t.canvas.y=i,t.global.x=r,t.global.y=i,t.offset.x=r,t.offset.y=i;const{x:n,y:s}=this.mapToViewportPoint(t);return t.viewport.x=n,t.viewport.y=s,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=Nn[t.type]||t.type),t}transferMouseData(t,e){t.isTrusted=e.isTrusted,t.srcElement=e.srcElement,t.timeStamp=Dn.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)),r=this.domElement.getViewBox(),i=r.width(),n=r.height();return!(e.x<i&&e.y<n&&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}}class jn{static GetImage(t,e){var r;const i=jn.cache.get(t);i?"fail"===i.loadState?rt.global.getRequestAnimationFrame()((()=>{e.imageLoadFail(t)})):"init"===i.loadState||"loading"===i.loadState?null===(r=i.waitingMark)||void 0===r||r.push(e):e&&e.imageLoadSuccess(t,i.data):jn.loadImage(t,e)}static GetSvg(t,e){var r;let i=jn.cache.get(t);i?"fail"===i.loadState?rt.global.getRequestAnimationFrame()((()=>{e.imageLoadFail(t)})):"init"===i.loadState||"loading"===i.loadState?null===(r=i.waitingMark)||void 0===r||r.push(e):e&&e.imageLoadSuccess(t,i.data):(i={type:"image",loadState:"init"},jn.cache.set(t,i),i.dataPromise=rt.global.loadSvg(t),i.dataPromise?(i.waitingMark=[e],i.dataPromise.then((e=>{var r;i.loadState=(null==e?void 0:e.data)?"success":"fail",i.data=null==e?void 0:e.data,null===(r=i.waitingMark)||void 0===r||r.map(((r,n)=>{(null==e?void 0:e.data)?(i.loadState="success",i.data=e.data,r.imageLoadSuccess(t,e.data)):(i.loadState="fail",r.imageLoadFail(t))})),i.waitingMark&&(i.waitingMark=[])}))):(i.loadState="fail",e.imageLoadFail(t)))}static GetFile(t,e){let r=jn.cache.get(t);return r?"fail"===r.loadState?Promise.reject():"init"===r.loadState||"loading"===r.loadState?r.dataPromise.then((t=>t.data)):Promise.resolve(r.data):(r={type:e,loadState:"init"},jn.cache.set(t,r),"arrayBuffer"===e?r.dataPromise=rt.global.loadArrayBuffer(t):"blob"===e?r.dataPromise=rt.global.loadBlob(t):"json"===e&&(r.dataPromise=rt.global.loadJson(t)),r.dataPromise.then((t=>t.data)))}static loading(){setTimeout((()=>{if(!jn.isLoading&&jn.toLoadAueue.length){jn.isLoading=!0;const t=jn.toLoadAueue.splice(0,10),e=[];t.forEach((t=>{const{url:r,marks:i}=t,n={type:"image",loadState:"init"};if(jn.cache.set(r,n),n.dataPromise=rt.global.loadImage(r),n.dataPromise){n.waitingMark=i;const t=n.dataPromise.then((t=>{var e;n.loadState=(null==t?void 0:t.data)?"success":"fail",n.data=null==t?void 0:t.data,null===(e=n.waitingMark)||void 0===e||e.map(((e,i)=>{(null==t?void 0:t.data)?(n.loadState="success",n.data=t.data,e.imageLoadSuccess(r,t.data)):(n.loadState="fail",e.imageLoadFail(r))})),n.waitingMark&&(n.waitingMark=[])}));e.push(t)}else n.loadState="fail",i.forEach((t=>t.imageLoadFail(r)))})),Promise.all(e).then((()=>{jn.isLoading=!1,this.onLoadSuccessCb.forEach((t=>t())),jn.loading()})).catch((t=>{jn.isLoading=!1,this.onLoadSuccessCb.forEach((t=>t())),jn.loading()}))}}),0)}static loadImage(t,e){const r=zn(t,jn.toLoadAueue);if(-1!==r)return jn.toLoadAueue[r].marks.push(e),void jn.loading();jn.toLoadAueue.push({url:t,marks:[e]}),jn.loading()}static improveImageLoading(t){const e=zn(t,jn.toLoadAueue);if(-1!==e){const t=jn.toLoadAueue.splice(e,1);jn.toLoadAueue.unshift(t[0])}}static onLoadSuccess(t){this.onLoadSuccessCb.push(t)}}function zn(t,e){for(let r=0;r<e.length;r++)if(e[r].url===t)return r;return-1}var Hn;jn.cache=new Map,jn.isLoading=!1,jn.toLoadAueue=[],jn.onLoadSuccessCb=[],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"}(Hn||(Hn={}));const Wn=[0,0,0,0],Un=[{x:0,y:0},{x:0,y:0},{x:0,y:0},{x:0,y:0}],$n=[1,2,3,0,1,2,3,0];function Vn(t,e,r){const{x:i,y:n}=pe(t.x,t.y,e.x,e.y,r),{x:s,y:o}=pe(t.x1,t.y1,e.x1,e.y1,r),a=new fe(i,n,s,o);return a.defined=e.defined,a}function Gn(t,e,r){if(!t||!e)return[];Array.isArray(t)||(t=[t]),Array.isArray(e)||(e=[e]);let i=[];if(t.length>e.length){i=e.map((t=>{const e=new fe(t.x,t.y,t.x1,t.y1);return e.defined=t.defined,e}));for(let n=0;n<e.length;n++)i[n]=Vn(t[n],e[n],r)}else{i=e.map((t=>{const e=new fe(t.x,t.y,t.x1,t.y1);return e.defined=t.defined,e}));for(let n=0;n<t.length;n++)i[n]=Vn(t[n],e[n],r)}return i}function Xn(t,e){if(Et(t)){let r;for(let i=0;i<t.length&&void 0===r;i++)r=t[i][e];return r}return t[e]}const Yn=(t,e)=>{const r=((t,e)=>Ct(t)&&"%"===t[t.length-1]?e*(Number.parseFloat(t.substring(0,t.length-1))/100):t)(t,e);return isNaN(r)?r:Math.max(e,r)};class qn{bounds(t,e){if(Ot(t)){const r=t/2;e.x1=-r,e.x2=r,e.y1=-r,e.y2=r}else e.x1=-t[0]/2,e.x2=t[0]/2,e.y1=-t[1]/2,e.y2=t[1]/2}parseSize(t){return Ot(t)?t:Math.min(t[0],t[1])}}function Zn(t,e,r,i,n){return n?t.arc(r,i,e,0,ie,!1,n):t.arc(r,i,e,0,ie),!1}var Kn=new class extends qn{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,r,i,n){return Zn(t,this.parseSize(e)/2,r,i,n)}drawOffset(t,e,r,i,n,s){return Zn(t,this.parseSize(e)/2+n,r,i,s)}drawToSvgPath(t,e,r,i){const n=this.parseSize(t)/2;return`M ${e-n}, ${r} a ${n},${n} 0 1,0 ${2*n},0 a ${n},${n} 0 1,0 -${2*n},0`}};var Qn=new class extends qn{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,r,i,n){return function(t,e,r,i,n){return t.moveTo(-3*e+r,-e+i,n),t.lineTo(-e+r,-e+i,n),t.lineTo(-e+r,-3*e+i,n),t.lineTo(e+r,-3*e+i,n),t.lineTo(e+r,-e+i,n),t.lineTo(3*e+r,-e+i,n),t.lineTo(3*e+r,e+i,n),t.lineTo(e+r,e+i,n),t.lineTo(e+r,3*e+i,n),t.lineTo(-e+r,3*e+i,n),t.lineTo(-e+r,e+i,n),t.lineTo(-3*e+r,e+i,n),t.closePath(),!0}(t,this.parseSize(e)/6,r,i,n)}drawOffset(t,e,r,i,n,s){return function(t,e,r,i,n,s){return t.moveTo(-3*e+r-n,-e+i-n,s),t.lineTo(-e+r-n,-e+i-n,s),t.lineTo(-e+r-n,-3*e+i-n,s),t.lineTo(e+r+n,-3*e+i-n,s),t.lineTo(e+r+n,-e+i-n,s),t.lineTo(3*e+r+n,-e+i-n,s),t.lineTo(3*e+r+n,e+i+n,s),t.lineTo(e+r+n,e+i+n,s),t.lineTo(e+r+n,3*e+i+n,s),t.lineTo(-e+r-n,3*e+i+n,s),t.lineTo(-e+r-n,e+i+n,s),t.lineTo(-3*e+r-n,e+i+n,s),t.closePath(),!0}(t,this.parseSize(e)/6,r,i,n,s)}};function Jn(t,e,r,i,n){return t.moveTo(r,i-e,n),t.lineTo(e+r,i,n),t.lineTo(r,i+e,n),t.lineTo(r-e,i,n),t.closePath(),!0}var ts=new class extends qn{constructor(){super(...arguments),this.type="diamond",this.pathStr="M-0.5,0L0,-0.5L0.5,0L0,0.5Z"}draw(t,e,r,i,n){return Jn(t,this.parseSize(e)/2,r,i,n)}drawFitDir(t,e,r,i,n){return Jn(t,this.parseSize(e)/2,r,i,n)}drawOffset(t,e,r,i,n,s){return Jn(t,this.parseSize(e)/2+n,r,i,s)}};function es(t,e,r,i){const n=2*e;return t.rect(r-e,i-e,n,n),!1}var rs=new class extends qn{constructor(){super(...arguments),this.type="square",this.pathStr="M-0.5,-0.5h1v1h-1Z"}draw(t,e,r,i){return es(t,this.parseSize(e)/2,r,i)}drawOffset(t,e,r,i,n){return es(t,this.parseSize(e)/2+n,r,i)}};function is(t,e,r,i,n=0){return t.moveTo(r+e+2*n,e+i+n),t.lineTo(r-e-2*n,e+i+n),t.lineTo(r,i-e-2*n),t.closePath(),!0}class ns extends qn{constructor(){super(...arguments),this.type="triangleUp",this.pathStr="M0.5,0.5 L-0.5,0.5 L0,-0.5 Z"}draw(t,e,r,i){return is(t,this.parseSize(e)/2,r,i)}drawOffset(t,e,r,i,n){return is(t,this.parseSize(e)/2,r,i,n)}}var ss=new ns;var os=new class extends ns{constructor(){super(...arguments),this.type="triangle"}};const as=Math.sin(Math.PI/10)/Math.sin(7*Math.PI/10),ls=Math.sin(ie/10)*as,hs=-Math.cos(ie/10)*as;function cs(t,e,r,i){const n=ls*e,s=hs*e;t.moveTo(r,-e+i),t.lineTo(n+r,s+i);for(let o=1;o<5;++o){const a=ie*o/5,l=Math.cos(a),h=Math.sin(a);t.lineTo(h*e+r,-l*e+i),t.lineTo(l*n-h*s+r,h*n+l*s+i)}return t.closePath(),!0}var us=new class extends qn{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,r,i){return cs(t,this.parseSize(e)/2,r,i)}drawOffset(t,e,r,i,n){return cs(t,this.parseSize(e)/2+n,r,i)}};const ds=ue(3);function ps(t,e,r,i){const n=e,s=n/ds,o=s/5,a=e;return t.moveTo(0+r,-n+i),t.lineTo(s/2+r,i),t.lineTo(o/2+r,i),t.lineTo(o/2+r,a+i),t.lineTo(-o/2+r,a+i),t.lineTo(-o/2+r,i),t.lineTo(-s/2+r,i),t.closePath(),!0}var fs=new class extends qn{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,r,i){return ps(t,this.parseSize(e)/2,r,i)}drawOffset(t,e,r,i,n){return ps(t,this.parseSize(e)/2+n,r,i)}};function gs(t,e,r,i){const n=2*e;return t.moveTo(r,-e+i),t.lineTo(n/3/2+r,e+i),t.lineTo(-n/3/2+r,e+i),t.closePath(),!0}var ms=new class extends qn{constructor(){super(...arguments),this.type="wedge",this.pathStr="M0,-0.5773502691896257L-0.125,0.28867513459481287L0.125,0.28867513459481287Z"}draw(t,e,r,i){return gs(t,this.parseSize(e)/2,r,i)}drawOffset(t,e,r,i,n){return gs(t,this.parseSize(e)/2+n,r,i)}};function ys(t,e,r,i){return t.moveTo(-e+r,i),t.lineTo(r,e+i),!1}var vs=new class extends qn{constructor(){super(...arguments),this.type="stroke",this.pathStr=""}draw(t,e,r,i){return ys(t,this.parseSize(e)/2,r,i)}drawOffset(t,e,r,i,n){return ys(t,this.parseSize(e)/2+n,r,i)}};const bs=-.5,_s=ue(3)/2,ws=1/ue(12);function xs(t,e,r,i){const n=e/2,s=e*ws,o=n,a=e*ws+e,l=-o,h=a;return t.moveTo(n+r,s+i),t.lineTo(o+r,a+i),t.lineTo(l+r,h+i),t.lineTo(bs*n-_s*s+r,_s*n+bs*s+i),t.lineTo(bs*o-_s*a+r,_s*o+bs*a+i),t.lineTo(bs*l-_s*h+r,_s*l+bs*h+i),t.lineTo(bs*n+_s*s+r,bs*s-_s*n+i),t.lineTo(bs*o+_s*a+r,bs*a-_s*o+i),t.lineTo(bs*l+_s*h+r,bs*h-_s*l+i),t.closePath(),!1}var Ss=new class extends qn{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,r,i){return xs(t,this.parseSize(e)/2,r,i)}drawOffset(t,e,r,i,n){return xs(t,this.parseSize(e)/2+n,r,i)}};function Ts(t,e,r,i,n){return t.moveTo(-e+r-2*n,i),t.lineTo(e+r+n,e+i+2*n),t.lineTo(e+r+n,i-e-2*n),t.closePath(),!0}var ks=new class extends qn{constructor(){super(...arguments),this.type="triangleLeft",this.pathStr="M-0.5,0 L0.5,0.5 L0.5,-0.5 Z"}draw(t,e,r,i){return Ts(t,this.parseSize(e)/2,r,i,0)}drawOffset(t,e,r,i,n){return Ts(t,this.parseSize(e)/2,r,i,n)}};function Cs(t,e,r,i,n=0){return t.moveTo(r-e-n,e+i+2*n),t.lineTo(e+r+2*n,i),t.lineTo(r-e-n,i-e-2*n),t.closePath(),!0}var Es=new class extends qn{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,r,i){return Cs(t,this.parseSize(e)/2,r,i)}drawOffset(t,e,r,i,n){return Cs(t,this.parseSize(e)/2,r,i,n)}};function As(t,e,r,i,n=0){return t.moveTo(r-e-2*n,i-e-n),t.lineTo(r+e+2*n,i-e-n),t.lineTo(r,i+e+2*n),t.closePath(),!0}var Os=new class extends qn{constructor(){super(...arguments),this.type="triangleDown",this.pathStr="M-0.5,-0.5 L0.5,-0.5 L0,0.5 Z"}draw(t,e,r,i){return As(t,this.parseSize(e)/2,r,i)}drawOffset(t,e,r,i,n){return As(t,this.parseSize(e)/2,r,i,n)}};const Bs=ue(3);function Rs(t,e,r,i){const n=e*Bs;return t.moveTo(r,i+-n/3*2),t.lineTo(e+r,i+n),t.lineTo(r-e,i+n),t.closePath(),!0}var Ls=new class extends qn{constructor(){super(...arguments),this.type="thinTriangle",this.pathStr="M0,-0.5773502691896257L-0.5,0.28867513459481287L0.5,0.28867513459481287Z"}draw(t,e,r,i){return Rs(t,this.parseSize(e)/2/Bs,r,i)}drawOffset(t,e,r,i,n){return Rs(t,this.parseSize(e)/2/Bs+n,r,i)}};function Ps(t,e,r,i){const n=2*e;return t.moveTo(e+r,i-n),t.lineTo(r-e,i),t.lineTo(e+r,n+i),!0}var Ds=new class extends qn{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,r,i){return Ps(t,this.parseSize(e)/4,r,i)}drawOffset(t,e,r,i,n){return Ps(t,this.parseSize(e)/4+n,r,i)}};function Ms(t,e,r,i){const n=2*e;return t.moveTo(r-e,i-n),t.lineTo(r+e,i),t.lineTo(r-e,n+i),!0}var Is=new class extends qn{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,r,i){return Ms(t,this.parseSize(e)/4,r,i)}drawOffset(t,e,r,i,n){return Ms(t,this.parseSize(e)/4+n,r,i)}};function Ns(t,e,r,i){const n=2*e;return t.moveTo(r-n,i+e),t.lineTo(r,i-e),t.lineTo(r+n,i+e),!0}var Fs=new class extends qn{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,r,i){return Ns(t,this.parseSize(e)/4,r,i)}drawOffset(t,e,r,i,n){return Ns(t,this.parseSize(e)/4+n,r,i)}};function js(t,e,r,i){const n=2*e;return t.moveTo(r-n,i-e),t.lineTo(r,i+e),t.lineTo(r+n,i-e),!0}var zs=new class extends qn{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,r,i){return js(t,this.parseSize(e)/4,r,i)}drawOffset(t,e,r,i,n){return js(t,this.parseSize(e)/4+n,r,i)}};function Hs(t,e,r,i,n){return t.moveTo(r,i-e),t.lineTo(r,i+e),!0}var Ws=new class extends qn{constructor(){super(...arguments),this.type="lineV",this.pathStr="M0,-0.5L0,0.5"}draw(t,e,r,i,n){return Hs(t,this.parseSize(e)/2,r,i)}drawOffset(t,e,r,i,n,s){return Hs(t,this.parseSize(e)/2+n,r,i)}drawToSvgPath(t,e,r,i){const n=this.parseSize(t)/2;return`M ${e}, ${r-n} L ${e},${r+n}`}};function Us(t,e,r,i,n){return t.moveTo(r-e,i),t.lineTo(r+e,i),!0}var $s=new class extends qn{constructor(){super(...arguments),this.type="lineH",this.pathStr="M-0.5,0L0.5,0"}draw(t,e,r,i,n){return Us(t,this.parseSize(e)/2,r,i)}drawOffset(t,e,r,i,n,s){return Us(t,this.parseSize(e)/2+n,r,i)}drawToSvgPath(t,e,r,i){const n=this.parseSize(t)/2;return`M ${e-n}, ${r} L ${e+n},${r}`}};function Vs(t,e,r,i,n){return t.moveTo(r-e,i-e),t.lineTo(r+e,i+e),t.moveTo(r+e,i-e),t.lineTo(r-e,i+e),!0}var Gs=new class extends qn{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,r,i,n){return Vs(t,this.parseSize(e)/2,r,i)}drawOffset(t,e,r,i,n,s){return Vs(t,this.parseSize(e)/2+n,r,i)}drawToSvgPath(t,e,r,i){const n=this.parseSize(t)/2;return`M ${e-n}, ${r-n} L ${e+n},${r+n} M ${e+n}, ${r-n} L ${e-n},${r+n}`}};function Xs(t,e,r,i){return t.rect(r-e[0]/2,i-e[1]/2,e[0],e[1]),!1}function Ys(t,e,r,i){const n=e,s=e/2;return t.rect(r-n/2,i-s/2,n,s),!1}var qs=new class extends qn{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,r,i){return Ot(e)?Ys(t,e,r,i):Xs(t,e,r,i)}drawWithClipRange(t,e,r,i,n,s,o){Ot(e)&&(e=[e,e/2]);const a=2*(e[0]+e[1])*n,l=[{x:r+e[0]/2,y:i-e[1]/2},{x:r+e[0]/2,y:i+e[1]/2},{x:r-e[0]/2,y:i+e[1]/2},{x:r-e[0]/2,y:i-e[1]/2}];let h=0,c=l[3];t.moveTo(c.x,c.y);for(let e=0;e<l.length;e++){const r=l[e],i=Math.sqrt((r.x-c.x)*(r.x-c.x)+(r.y-c.y)*(r.y-c.y));if(h+i>a){const e=(r.x-c.x)*(a-h)/i,n=(r.y-c.y)*(a-h)/i;t.lineTo(c.x+e,c.y+n);break}t.lineTo(r.x,r.y),c=r,h+=i}return!1}drawOffset(t,e,r,i,n){return Ot(e)?Ys(t,e+2*n,r,i):Xs(t,[e[0]+2*n,e[1]+2*n],r,i)}};const Zs=new Le;class Ks{constructor(t,e,r=!1){this.pathStr="",this.type=t,Et(e)?this.svgCache=e:this.path=e,this.isSvg=r}drawOffset(t,e,r,i,n,s,o){return e=this.parseSize(e),this.isSvg?!!this.svgCache&&(this.svgCache.forEach((n=>{t.beginPath(),ir(n.path.commandList,t,r,i,e,e),o&&o(n.path,n.attribute)})),!1):(ir(this.path.commandList,t,r,i,e+n,e+n),!1)}draw(t,e,r,i,n,s){return e=this.parseSize(e),this.drawOffset(t,e,r,i,0,n,s)}parseSize(t){return Ot(t)?t:Math.min(t[0],t[1])}drawWithClipRange(t,e,r,i,n,s,o){return e=this.parseSize(e),this.isSvg?!!this.svgCache&&(this.svgCache.forEach((s=>{s.path.drawWithClipRange(t,e,r,i,n),o&&o(s.path,s.attribute)})),!1):(this.path.drawWithClipRange(t,e,r,i,n),!1)}bounds(t,e){if(t=this.parseSize(t),this.isSvg){if(!this.svgCache)return;return e.clear(),void this.svgCache.forEach((({path:r})=>{Zs.x1=r.bounds.x1*t,Zs.y1=r.bounds.y1*t,Zs.x2=r.bounds.x2*t,Zs.y2=r.bounds.y2*t,e.union(Zs)}))}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 Qs={};[Kn,Qn,ts,rs,Ls,os,us,fs,ms,vs,Ss,ks,Es,ss,Os,Ds,Is,Fs,zs,qs,Ws,$s,Gs].forEach((t=>{Qs[t.type]=t}));const Js={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 to{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 eo(t,e,r,i){const n=t.indexOf(e,r);if(-1===n)throw new Error(i);return n+e.length-1}function ro(t,e,r,i=">"){const n=function(t,e,r=">"){let i,n="";for(let s=e;s<t.length;s++){let e=t[s];if(i)e===i&&(i="");else if('"'===e||"'"===e)i=e;else if(e===r[0]){if(!r[1])return{data:n,index:s};if(t[s+1]===r[1])return{data:n,index:s}}else"\t"===e&&(e=" ");n+=e}}(t,e+1,i);if(!n)return;let s=n.data;const o=n.index,a=s.search(/\s/);let l=s,h=!0;-1!==a&&(l=s.substr(0,a).replace(/\s\s*$/,""),s=s.substr(a+1));const c=l;if(r){const t=l.indexOf(":");-1!==t&&(l=l.substr(t+1),h=l!==n.data.substr(t+1))}return{tagName:l,tagExp:s,closeIndex:o,attrExpPresent:h,rawTagName:c}}const io=new RegExp("([^\\s=]+)\\s*(=\\s*(['\"])([\\s\\S]*?)\\3)?","gm");class no{constructor(t){this.currentNode=null,this.options=t,this.tagsNodeStack=[],this.docTypeEntities={}}addChild(t,e,r){const i=e.tagname;"string"==typeof i?(e.tagname=i,t.addChild(e)):t.addChild(e)}buildAttributesMap(t,e,r){const i={};if(!t)return;const n=function(t,e){const r=[];let i=e.exec(t);for(;i;){const n=[];n.startIndex=e.lastIndex-i[0].length;const s=i.length;for(let t=0;t<s;t++)n.push(i[t]);r.push(n),i=e.exec(t)}return r}(t,io),s=n.length;for(let t=0;t<s;t++){const e=n[t][1],r=n[t][4];e&&(i[e]=void 0===r||(isNaN(r)?r:Number(r)))}return i}parseXml(t){t=t.replace(/\r\n?/g,"\n");const e=new to("!xml");let r=e,i="",n="";for(let s=0;s<t.length;s++)if("<"===t[s])if("/"===t[s+1]){const e=eo(t,">",s,"Closing Tag is not closed."),o=n.lastIndexOf(".");n=n.substring(0,o),r=this.tagsNodeStack.pop(),r&&r.child&&i&&r.child[r.child.length-1][":@"]&&(r.child[r.child.length-1][":@"].text=i),i="",s=e}else if("?"===t[s+1])s=ro(t,s,!1,"?>").closeIndex+1;else if("!--"===t.substr(s+1,3))s=eo(t,"--\x3e",s+4,"Comment is not closed.");else{const o=ro(t,s,!1);let a=o.tagName,l=o.tagExp;const h=o.attrExpPresent,c=o.closeIndex;if(a!==e.tagname&&(n+=n?"."+a:a),l.length>0&&l.lastIndexOf("/")===l.length-1){"/"===a[a.length-1]?(a=a.substr(0,a.length-1),n=n.substr(0,n.length-1),l=a):l=l.substr(0,l.length-1);const t=new to(a);a!==l&&h&&(t[":@"]=this.buildAttributesMap(l,n,a)),this.addChild(r,t,n),n=n.substr(0,n.lastIndexOf("."))}else{const t=new to(a);this.tagsNodeStack.push(r),a!==l&&h&&(t[":@"]=this.buildAttributesMap(l,n,a)),this.addChild(r,t,n),r=t}i="",s=c}else i+=t[s];return e.child}}function so(t,e){return oo(t)}function oo(t,e){const r={};for(let e=0;e<t.length;e++){const n=t[e],s=ao(n);if(void 0!==s&&n[s]){const t=oo(n[s]);i=t,Object.keys(i).length,n[":@"]&&lo(t,n[":@"]),void 0!==r[s]&&r.hasOwnProperty(s)?(Array.isArray(r[s])||(r[s]=[r[s]]),r[s].push(t)):r[s]=t}}var i;return r}function ao(t){const e=Object.keys(t);for(let t=0;t<e.length;t++){const r=e[t];if(":@"!==r)return r}}function lo(t,e,r){if(e){const r=Object.keys(e),i=r.length;for(let n=0;n<i;n++){const i=r[n];t[i]=e[i]}}}class ho{constructor(t){this.options=Object.assign({},ho.defaultOptions,t)}valid(t){return t.startsWith("<")}parse(t){if(!this.valid)return!1;return so(new no(this.options).parseXml(t),this.options)}}function co(t,e,r,i=0){return t.expand(e+(i/2+(r?function(t,e){return t?e:0}(r,e):0))),t}ho.defaultOptions={};let uo=0;function po(){return uo++}var fo;!function(t){t[t.HORIZONTAL=0]="HORIZONTAL",t[t.VERTICAL=1]="VERTICAL"}(fo||(fo={}));const go=new Map;["…","(",")","—","【","】","「","」","《","》"].forEach((t=>go.set(t,!0)));const mo=new Map;function yo(t){if(go.has(t))return!0;if(mo.has(t))return!1;let e=!1;return t.codePointAt(0)<256&&(e=!0),e}[""].forEach((t=>mo.set(t,!0))),po();const vo=po(),bo=po(),_o=po();po();const wo=po(),xo=po(),So=po();po();const To=po();po();const ko=po();po(),po(),po();const Co=po(),Eo=po(),Ao=Symbol.for("GraphicService"),Oo=Symbol.for("GraphicCreator"),Bo={"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"},Ro=Object.keys(Bo),Lo={duration:200,easing:"cubicOut"};function Po(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 Do(t,e,r){const i=r[0],n=r[1],s=r[2];let o,a,l,h,c,u,d,p,f,g,m,y;return e===t?(t[12]=e[0]*i+e[4]*n+e[8]*s+e[12],t[13]=e[1]*i+e[5]*n+e[9]*s+e[13],t[14]=e[2]*i+e[6]*n+e[10]*s+e[14],t[15]=e[3]*i+e[7]*n+e[11]*s+e[15]):(o=e[0],a=e[1],l=e[2],h=e[3],c=e[4],u=e[5],d=e[6],p=e[7],f=e[8],g=e[9],m=e[10],y=e[11],t[0]=o,t[1]=a,t[2]=l,t[3]=h,t[4]=c,t[5]=u,t[6]=d,t[7]=p,t[8]=f,t[9]=g,t[10]=m,t[11]=y,t[12]=o*i+c*n+f*s+e[12],t[13]=a*i+u*n+g*s+e[13],t[14]=l*i+d*n+m*s+e[14],t[15]=h*i+p*n+y*s+e[15]),t}function Mo(t,e,r){const i=e[0],n=e[1],s=e[2],o=e[3],a=e[4],l=e[5],h=e[6],c=e[7],u=e[8],d=e[9],p=e[10],f=e[11],g=e[12],m=e[13],y=e[14],v=e[15];let b=r[0],_=r[1],w=r[2],x=r[3];return t[0]=b*i+_*a+w*u+x*g,t[1]=b*n+_*l+w*d+x*m,t[2]=b*s+_*h+w*p+x*y,t[3]=b*o+_*c+w*f+x*v,b=r[4],_=r[5],w=r[6],x=r[7],t[4]=b*i+_*a+w*u+x*g,t[5]=b*n+_*l+w*d+x*m,t[6]=b*s+_*h+w*p+x*y,t[7]=b*o+_*c+w*f+x*v,b=r[8],_=r[9],w=r[10],x=r[11],t[8]=b*i+_*a+w*u+x*g,t[9]=b*n+_*l+w*d+x*m,t[10]=b*s+_*h+w*p+x*y,t[11]=b*o+_*c+w*f+x*v,b=r[12],_=r[13],w=r[14],x=r[15],t[12]=b*i+_*a+w*u+x*g,t[13]=b*n+_*l+w*d+x*m,t[14]=b*s+_*h+w*p+x*y,t[15]=b*o+_*c+w*f+x*v,t}class Io{constructor(){this.pools=[]}static identity(t){return Po(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 Io.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 r=0;r<e.length;r++)e[r]=t[r];return e}free(t){t&&this.pools.push(t)}get length(){return this.pools.length}release(...t){this.pools=[]}}const No=new class{constructor(){this.pools=[]}allocate(t,e,r,i,n,s){if(!this.pools.length)return new De(t,e,r,i,n,s);const o=this.pools.pop();return o.a=t,o.b=e,o.c=r,o.d=i,o.e=n,o.f=s,o}allocateByObj(t){if(!this.pools.length)return new De(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(...t){this.pools=[]}},Fo=new Io;var jo=function(t,e,r,i){var n,s=arguments.length,o=s<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,e,r,i);else for(var a=t.length-1;a>=0;a--)(n=t[a])&&(o=(s<3?n(o):s>3?n(e,r,o):n(e,r))||o);return s>3&&o&&Object.defineProperty(e,r,o),o},zo=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const Ho=new De(1,0,0,1,0,0),Wo={x:0,y:0};let Uo=class{get nativeContext(){return this.path}constructor(t,e){this.matrix=new De(1,0,0,1,0,0),this.stack=[],this.dpr=e,this.applyedMatrix=new De(1,0,0,1,0,0),this.path=new $r,this._clearMatrix=new De(1,0,0,1,0,0)}getCanvas(){throw new Error("不支持getCanvas")}getContext(){throw new Error("不支持getContext")}setTransformForCurrent(t=!1){!t&&this.applyedMatrix.equalToMatrix(this.matrix)||(this.applyedMatrix=this.cloneMatrix(this.matrix))}get currentMatrix(){return this.matrix}cloneMatrix(t){return No.allocateByObj(t)}clear(){this.save(),this.resetTransform(),this.restore()}reset(){this.matrix.setValue(1,0,0,1,0,0),this.applyedMatrix=new De(1,0,0,1,0,0),this.stack.length=0}restore(){this.stack.length>0&&(No.free(this.matrix),this.matrix=this.stack.pop(),this.setTransformForCurrent())}highPerformanceRestore(){this.stack.length>0&&(No.free(this.matrix),this.matrix=this.stack.pop())}rotate(t,e=!0){this.matrix.rotate(t),e&&this.setTransformForCurrent()}save(){const t=this.cloneMatrix(this.matrix);this.stack.push(t)}highPerformanceSave(){const t=this.cloneMatrix(this.matrix);this.stack.push(t)}scale(t,e,r=!0){this.matrix.scale(t,e),r&&this.setTransformForCurrent()}setScale(t,e,r=!0){this.matrix.setScale(t,e),r&&this.setTransformForCurrent()}scalePoint(t,e,r,i,n=!0){this.translate(r,i,!1),this.scale(t,e,!1),this.translate(-r,-i,!1),n&&this.setTransformForCurrent()}setTransform(t,e,r,i,n,s,o=!0,a=this.dpr){this.matrix.setValue(a*t,a*e,a*r,a*i,a*n,a*s),o&&this.setTransformForCurrent()}setTransformFromMatrix(t,e=!0,r=this.dpr){this.matrix.setValue(t.a*r,t.b*r,t.c*r,t.d*r,t.e*r,t.f*r),e&&this.setTransformForCurrent()}resetTransform(t=!0,e=this.dpr){this.setTransform(e,0,0,e,0,0),t&&this.setTransformForCurrent()}transform(t,e,r,i,n,s,o=!0){this.matrix.multiply(t,e,r,i,n,s),o&&this.setTransformForCurrent()}transformFromMatrix(t,e){this.matrix.multiply(t.a,t.b,t.c,t.d,t.e,t.f),e&&this.setTransformForCurrent()}translate(t,e,r=!0){this.matrix.translate(t,e),r&&this.setTransformForCurrent()}rotateDegrees(t,e=!0){const r=t*Math.PI/180;this.rotate(r,e)}rotateAbout(t,e,r,i=!0){this.translate(e,r,!1),this.rotate(t,!1),this.translate(-e,-r,!1),i&&this.setTransformForCurrent()}rotateDegreesAbout(t,e,r,i=!0){this.translate(e,r,!1),this.rotateDegrees(t,!1),this.translate(-e,-r,!1),i&&this.setTransformForCurrent()}beginPath(){this.path.clear()}clip(t,e){}arc(t,e,r,i,n,s){this.path.arc(t,e,r,i,n,s)}arcTo(t,e,r,i,n){this.path.arcTo(t,e,r,i,n)}bezierCurveTo(t,e,r,i,n,s){this.path.bezierCurveTo(t,e,r,i,n,s)}closePath(){this.path.closePath()}ellipse(t,e,r,i,n,s,o,a){}lineTo(t,e){this.path.lineTo(t,e)}moveTo(t,e){this.path.moveTo(t,e)}quadraticCurveTo(t,e,r,i){this.path.quadraticCurveTo(t,e,r,i)}rect(t,e,r,i){this.path.rect(t,e,r,i)}createImageData(t,e){return null}createLinearGradient(t,e,r,i){throw new Error("不支持createLinearGradient")}createPattern(t,e){throw new Error("不支持createPattern")}createRadialGradient(t,e,r,i,n,s){throw new Error("不支持createRadialGradient")}createConicGradient(t,e,r,i){return null}fill(t,e){}fillRect(t,e,r,i){this.path.rect(t,e,r,i)}clearRect(t,e,r,i){}fillText(t,e,r){}getImageData(t,e,r,i){return null}getLineDash(){return[]}isPointInPath(t,e){return this.matrix.transformPoint({x:t,y:e},Wo),function(t,e,r){return on(t,0,!1,e,r)}(this.path.commandList,Wo.x,Wo.y)}isPointInStroke(t,e){if(!this.lineWidth)return!1;this.matrix.transformPoint({x:t,y:e},Wo);const r=yi(this,this.lineWidth,this.dpr);return function(t,e,r,i){return on(t,e,!0,r,i)}(this.path.commandList,r,Wo.x,Wo.y)}measureText(t){throw new Error("不支持measureText")}putImageData(t,e,r){throw new Error("不支持measureText")}setLineDash(t){}stroke(t){}strokeRect(t,e,r,i){this.path.rect(t,e,r,i)}strokeText(t,e,r){}drawImage(){}setCommonStyle(t,e,r,i,n){}_setCommonStyle(t,e,r,i){}setStrokeStyle(t,e,r,i,n){}_setStrokeStyle(t,e,r,i){}setTextStyleWithoutAlignBaseline(t,e){}setTextStyle(t,e){}draw(){}clearMatrix(t=!0,e=this.dpr){this.setTransformFromMatrix(Ho,t,e)}setClearMatrix(t,e,r,i,n,s){this._clearMatrix.setValue(t,e,r,i,n,s)}onlyTranslate(t=this.dpr){return this.matrix.a===t&&0===this.matrix.b&&0===this.matrix.c&&this.matrix.d===t}release(...t){this.stack.forEach((t=>No.free(t))),this.stack.length=0}};Uo=jo([L(),zo("design:paramtypes",[Object,Number])],Uo);const $o=new Le,Vo=new De;new Le;const Go=["lineWidth","scaleX","scaleY","angle","anchor","visible"],Xo=["x","y"],Yo=["scaleX","scaleY"],qo=["angle"],Zo=new fe,Ko={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 Qo extends An{static mixin(t){const e=Object.keys(t);for(let r=0;r<e.length;++r){const i=e[r];Object.defineProperty(Qo.prototype,i,Object.getOwnPropertyDescriptor(t,i))}}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(t={}){var e;super(),this._AABBBounds=new Le,this._updateTag=Ye.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)}getGraphicService(){var t,e;return null!==(e=null===(t=this.stage)||void 0===t?void 0:t.graphicService)&&void 0!==e?e:rt.graphicService}getAttributes(){return this.attribute}setMode(t){"3d"===t?this.set3dMode():this.set2dMode()}set3dMode(){this.in3dMode=!0}set2dMode(){this.in3dMode=!1}getOffsetXY(t,e=!1){var r,i;const{dx:n=t.dx,dy:s=t.dy}=this.attribute;if(e&&this.parent){const t=this.parent.attribute;Zo.x=n+(null!==(r=t.scrollX)&&void 0!==r?r:0),Zo.y=s+(null!==(i=t.scrollY)&&void 0!==i?i:0)}else Zo.x=n,Zo.y=s;return Zo}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;this.getGraphicService().beforeUpdateAABBBounds(this,this.stage,!0,this._AABBBounds);const e=this.doUpdateAABBBounds(t);return this.getGraphicService().afterUpdateAABBBounds(this,this.stage,this._AABBBounds,this,!0),"empty"===this.attribute.boundsMode&&e.clear(),e}tryUpdateOBBBounds(){return this._OBBBounds||(this._OBBBounds=new Pe),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 r=this.clipPathMap.get(e)||null;return r||(this.clipPathMap.size>10&&this.clipPathMap.clear(),r=this.parsePath(e),r&&this.clipPathMap.set(e,r)),r}parsePath(t){if(!t)return null;let e=Qs[t];if(e)return e;if(e=Qo.userSymbolMap[t],e)return e;if(!0===((r=t=Js[t]||t).startsWith("<svg")||r.startsWith("<?xml"))){const e=new ho,{svg:r}=e.parse(t);if(!r)return null;const i=Et(r.path)?r.path:[r.path];$o.clear();const n=[];i.forEach((t=>{const e=(new $r).fromString(t.d),r={};Ro.forEach((e=>{t[e]&&(r[Bo[e]]=t[e])})),n.push({path:e,attribute:r}),$o.union(e.bounds)}));const s=$o.width(),o=$o.height(),a=1/le(s,o);n.forEach((t=>t.path.transform(0,0,a,a)));const l=new Ks(t,n,!0);return Qo.userSymbolMap[t]=l,l}var r;const i=(new $r).fromString(t),n=i.bounds.width(),s=i.bounds.height(),o=1/le(n,s);i.transform(0,0,o,o);const a=new Ks(t,i);return Qo.userSymbolMap[t]=a,a}doUpdateAABBBounds(t){this.updateAABBBoundsStamp++;const e=this.getGraphicTheme();this._AABBBounds.clear();const r=this.attribute,i=this.updateAABBBounds(r,e,this._AABBBounds,t),{boundsPadding:n=e.boundsPadding}=r,s=(o=n)?Et(o)?0===o.length?0:1===o.length?o[0]:2===o.length?(Wn[0]=o[0],Wn[2]=o[0],Wn[1]=o[1],Wn[3]=o[1],Wn):o:o:0;var o;return s&&i.expand(s),this.clearUpdateBoundTag(),i}updatePathProxyAABBBounds(t){const e="function"==typeof this.pathProxy?this.pathProxy(this.attribute):this.pathProxy;if(!e)return!1;const r=new Ne(t);return ir(e.commandList,r,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(t=!0){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(t=!0){return this._transMatrix||(this._transMatrix=new De),this.shouldUpdateLocalMatrix()&&(this.doUpdateLocalMatrix(),t&&this.clearUpdateLocalPositionTag()),this._transMatrix}shouldUpdateAABBBounds(){return this.shadowRoot?(!!(this._updateTag&Ye.UPDATE_BOUNDS)||this.shadowRoot.shouldUpdateAABBBounds())&&this.getGraphicService().validCheck(this.attribute,this.getGraphicTheme(),this._AABBBounds,this):!!(this._updateTag&Ye.UPDATE_BOUNDS)&&this.getGraphicService().validCheck(this.attribute,this.getGraphicTheme(),this._AABBBounds,this)}shouldSelfChangeUpdateAABBBounds(){return this.shadowRoot?!!(this._updateTag&Ye.UPDATE_BOUNDS)||this.shadowRoot.shouldUpdateAABBBounds():!!(this._updateTag&Ye.UPDATE_BOUNDS)}shouldUpdateLocalMatrix(){return!!(this._updateTag&Ye.UPDATE_LOCAL_MATRIX)}isValid(){var t,e;const r=this.attribute;return Number.isFinite((null!==(t=r.x)&&void 0!==t?t:0)+(null!==(e=r.y)&&void 0!==e?e:0))}_validNumber(t){return null==t||Number.isFinite(t)}shouldUpdateShape(){return!!(this._updateTag&Ye.UPDATE_SHAPE)}clearUpdateShapeTag(){this._updateTag&=Ye.CLEAR_SHAPE}containsPoint(t,e,r,i){if(!i)return!1;if(r===qe.GLOBAL){const r=new fe(t,e);this.parent&&this.parent.globalTransMatrix.transformPoint(r,r),t=r.x,e=r.y}return i.containsPoint(this,{x:t,y:e})}setWidthHeightWithoutTransform(t){this.widthWithoutTransform=t.x2-t.x1,this.heightWithoutTransform=t.y2-t.y1}setAttributesAndPreventAnimate(t,e=!1,r,i){this.setAttributes(t,e,r),this.animates&&this.animates.forEach((e=>{(e.priority!==1/0||i)&&Object.keys(t).forEach((t=>{e.preventAttr(t)}))}))}setAttributes(t,e=!1,r){(t=this.onBeforeAttributeUpdate&&this.onBeforeAttributeUpdate(t,this.attribute,null,r)||t).background?this.loadImage(t.background,!0):t.shadowGraphic&&this.setShadowGraphic(t.shadowGraphic),this._setAttributes(t,e,r)}_setAttributes(t,e=!1,r){const i=Object.keys(t);for(let e=0;e<i.length;e++){const r=i[e];this.attribute[r]=t[r]}this.valid=this.isValid(),this.updateShapeAndBoundsTagSetted()||!e&&!this.needUpdateTags(i)?this.addUpdateBoundTag():this.addUpdateShapeAndBoundsTag(),this.addUpdatePositionTag(),this.addUpdateLayoutTag(),this.onAttributeUpdate(r)}setAttribute(t,e,r,i){var n;const s=this.onBeforeAttributeUpdate&&this.onBeforeAttributeUpdate({[t]:e},this.attribute,t,i);s?this._setAttributes(s,r,i):_t(null===(n=this.normalAttrs)||void 0===n?void 0:n[t])?(this.attribute[t]=e,this.valid=this.isValid(),this.updateShapeAndBoundsTagSetted()||!r&&!this.needUpdateTag(t)?this.addUpdateBoundTag():this.addUpdateShapeAndBoundsTag(),this.addUpdatePositionTag(),this.addUpdateLayoutTag(),this.onAttributeUpdate(i)):this.normalAttrs[t]=e,"background"===t?this.loadImage(e,!0):"shadowGraphic"===t&&this.setShadowGraphic(e)}needUpdateTags(t,e=Go){for(let r=0;r<e.length;r++){const i=e[r];if(-1!==t.indexOf(i))return!0}return!1}needUpdateTag(t,e=Go){for(let r=0;r<e.length;r++)if(t===e[r])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=Ye.INIT,this.valid=this.isValid(),this.onAttributeUpdate(e)}translate(t,e){var r,i;if(0===t&&0===e)return this;const n={type:Ze.TRANSLATE},s=this.onBeforeAttributeUpdate&&this.onBeforeAttributeUpdate({x:t,y:e},this.attribute,Xo,n);s&&(t=s.x,e=s.y,delete s.x,delete s.y,this._setAttributes(s));const o=this.attribute,a=o.postMatrix;return a?rt.transformUtil.fromMatrix(a,a).translate(t,e):(o.x=(null!==(r=o.x)&&void 0!==r?r:Xr.x)+t,o.y=(null!==(i=o.y)&&void 0!==i?i:Xr.y)+e),this.addUpdatePositionTag(),this.addUpdateBoundTag(),this.addUpdateLayoutTag(),this.onAttributeUpdate(n),this}translateTo(t,e){const r=this.attribute;if(r.x===t&&r.y===e)return this;const i={type:Ze.TRANSLATE_TO},n=this.onBeforeAttributeUpdate&&this.onBeforeAttributeUpdate({x:t,y:e},this.attribute,Xo,i);return n?(this._setAttributes(n,!1,i),this):(r.x=t,r.y=e,this.addUpdatePositionTag(),this.addUpdateBoundTag(),this.addUpdateLayoutTag(),this.onAttributeUpdate(i),this)}scale(t,e,r){var i,n;if(1===t&&1===e)return this;const s={type:Ze.SCALE},o=this.onBeforeAttributeUpdate&&this.onBeforeAttributeUpdate({scaleX:t,scaleY:e,scaleCenter:r},this.attribute,Yo,s);o&&(t=o.scaleX,e=o.scaleY,delete o.scaleX,delete o.scaleY,this._setAttributes(o));const a=this.attribute;if(r){let{postMatrix:i}=this.attribute;i||(i=new De,a.postMatrix=i),rt.transformUtil.fromMatrix(i,i).scale(t,e,r)}else a.scaleX=(null!==(i=a.scaleX)&&void 0!==i?i:Xr.scaleX)*t,a.scaleY=(null!==(n=a.scaleY)&&void 0!==n?n:Xr.scaleY)*e;return this.addUpdatePositionTag(),this.addUpdateBoundTag(),this.addUpdateLayoutTag(),this.onAttributeUpdate(s),this}scaleTo(t,e){const r=this.attribute;if(r.scaleX===t&&r.scaleY===e)return this;const i={type:Ze.SCALE_TO},n=this.onBeforeAttributeUpdate&&this.onBeforeAttributeUpdate({scaleX:t,scaleY:e},this.attribute,Yo,i);return n?(this._setAttributes(n,!1,i),this):(r.scaleX=t,r.scaleY=e,this.addUpdatePositionTag(),this.addUpdateBoundTag(),this.addUpdateLayoutTag(),this.onAttributeUpdate(i),this)}rotate(t,e){var r;if(0===t)return this;const i={type:Ze.ROTATE},n=this.onBeforeAttributeUpdate&&this.onBeforeAttributeUpdate({angle:t,rotateCenter:e},this.attribute,qo,i);n&&(delete n.angle,this._setAttributes(n,!1,i));const s=this.attribute;if(e){let{postMatrix:r}=this.attribute;r||(r=new De,s.postMatrix=r),rt.transformUtil.fromMatrix(r,r).rotate(t,e)}else s.angle=(null!==(r=s.angle)&&void 0!==r?r:Xr.angle)+t;return this.addUpdatePositionTag(),this.addUpdateBoundTag(),this.addUpdateLayoutTag(),this.onAttributeUpdate(i),this}rotateTo(t){const e=this.attribute;if(e.angle===t)return this;const r={type:Ze.ROTATE_TO},i=this.onBeforeAttributeUpdate&&this.onBeforeAttributeUpdate(t,this.attribute,qo,r);return i?(this._setAttributes(i,!1,r),this):(e.angle=t,this.addUpdatePositionTag(),this.addUpdateBoundTag(),this.addUpdateLayoutTag(),this.onAttributeUpdate(r),this)}skewTo(t,e){return this}onAttributeUpdate(t){t&&t.skipUpdateCallback||(this.getGraphicService().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)&&(!!_t(t)||this.currentStates.includes(t))}getState(t){var e;return null===(e=this.states)||void 0===e?void 0:e[t]}applyStateAttrs(t,e,r,i){var n,s;if(r){const e=Object.keys(t),r=this.getNoWorkAnimateAttr(),o={};let a;e.forEach((e=>{r[e]?(a||(a={}),a[e]=t[e]):o[e]=i&&void 0===t[e]?this.getDefaultAttribute(e):t[e]}));const l=null!==(s=null!==(n=this.context&&this.context.stateAnimateConfig)&&void 0!==n?n:this.stateAnimateConfig)&&void 0!==s?s:Lo;this.applyAnimationState(["state"],[{name:"state",animation:{type:"state",to:o,duration:l.duration,easing:l.easing}}]),a&&this.setAttributesAndPreventAnimate(a,!1,{type:Ze.STATE})}else this.stopStateAnimates(),this.setAttributesAndPreventAnimate(t,!1,{type:Ze.STATE}),this.finalAttribute&&Object.assign(this.finalAttribute,t);this._emitCustomEvent("afterStateUpdate",{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(t="end"){this.animates&&this.animates.forEach((e=>{e.stateNames&&(e.stop(t),this.animates.delete(e.id))}))}getNormalAttribute(t){var e,r;const i=this.attribute[t];return this.animates?null===(e=this.finalAttribute)||void 0===e?void 0:e[t]:null!=i?i:null===(r=this.finalAttribute)||void 0===r?void 0:r[t]}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 r=Et(t)?e=>!t.includes(e):e=>e!==t,i=this.currentStates.filter(r);i.length!==this.currentStates.length&&this.useStates(i,e)}}toggleState(t,e){if(this.hasState(t))this.removeState(t,e);else if((this.currentStates?this.currentStates.indexOf(t):-1)<0){const r=this.currentStates?this.currentStates.slice():[];r.push(t),this.useStates(r,e)}}addState(t,e,r){var i;if(this.currentStates&&this.currentStates.includes(t)&&(e||1===this.currentStates.length))return;const n=e&&(null===(i=this.currentStates)||void 0===i?void 0:i.length)?this.currentStates.concat([t]):[t];this.useStates(n,r)}useStates(t,e){var r;if(!t.length)return void this.clearStates(e);if((null===(r=this.currentStates)||void 0===r?void 0:r.length)===t.length&&!t.some(((t,e)=>this.currentStates[e]!==t)))return;const i={};t.forEach((e=>{var r;const n=this.stateProxy?this.stateProxy(e,t):null===(r=this.states)||void 0===r?void 0:r[e];n&&Object.assign(i,n)})),this.updateNormalAttrs(i),this.currentStates=t,this.applyStateAttrs(i,t,e)}addUpdateBoundTag(){this._updateTag|=Ye.UPDATE_BOUNDS,this.parent&&this.parent.addChildUpdateBoundTag(),this.glyphHost&&this.glyphHost.addUpdateBoundTag()}addUpdateShapeTag(){this._updateTag|=Ye.UPDATE_SHAPE}addUpdateShapeAndBoundsTag(){this._updateTag|=Ye.UPDATE_SHAPE_AND_BOUNDS,this.parent&&this.parent.addChildUpdateBoundTag(),this.glyphHost&&this.glyphHost.addUpdateBoundTag()}updateShapeAndBoundsTagSetted(){return(this._updateTag&Ye.UPDATE_SHAPE_AND_BOUNDS)===Ye.UPDATE_SHAPE_AND_BOUNDS}clearUpdateBoundTag(){this._updateTag&=Ye.CLEAR_BOUNDS}addUpdatePositionTag(){this.shadowRoot&&this.shadowRoot.addUpdateGlobalPositionTag(),this._updateTag|=Ye.UPDATE_GLOBAL_LOCAL_MATRIX}addUpdateGlobalPositionTag(){this.shadowRoot&&this.shadowRoot.addUpdateGlobalPositionTag(),this._updateTag|=Ye.UPDATE_GLOBAL_MATRIX}clearUpdateLocalPositionTag(){this._updateTag&=Ye.CLEAR_LOCAL_MATRIX}clearUpdateGlobalPositionTag(){this._updateTag&=Ye.CLEAR_GLOBAL_MATRIX}addUpdateLayoutTag(){this._updateTag|=Ye.UPDATE_LAYOUT}clearUpdateLayoutTag(){this._updateTag&=Ye.CLEAR_LAYOUT}needUpdateLayout(){return!!(this._updateTag&Ye.UPDATE_LAYOUT)}getAnchor(t,e,r){const i=[0,0],n=()=>{if(e.b)return e.b;const t=this.clone();return t.attribute.angle=0,t.attribute.scaleCenter=null,r&&(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,r=n();i[0]=r.x1+(r.x2-r.x1)*e}else i[0]=t[0];if("string"==typeof t[1]){const e=parseFloat(t[1])/100,r=n();i[1]=r.y1+(r.y2-r.y1)*e}else i[1]=t[1];return i}doUpdateLocalMatrix(){const{x:t=Xr.x,y:e=Xr.y,scaleX:r=Xr.scaleX,scaleY:i=Xr.scaleY,angle:n=Xr.angle,scaleCenter:s,anchor:o,postMatrix:a}=this.attribute;let l=[0,0];const h={};if(o&&n&&(l=this.getAnchor(o,h)),!s||1===r&&1===i)!function(t,e,r,i,n,s,o,a){const l=e.a,h=e.b,c=e.c,u=e.d,d=e.e,p=e.f,f=ae(o),g=ce(o);let m,y;a?(m=a[0],y=a[1]):(m=r,y=i);const v=m-r,b=y-i,_=l*f+c*g,w=h*f+u*g,x=c*f-l*g,S=u*f-h*g;t.a=n*_,t.b=n*w,t.c=s*x,t.d=s*S,t.e=d+l*m+c*y-_*v-x*b,t.f=p+h*m+u*y-w*v-S*b}(this._transMatrix,this._transMatrix.reset(),t,e,r,i,n,o&&l);else{const o=this._transMatrix;o.reset(),o.translate(l[0],l[1]),o.rotate(n),o.translate(-l[0],-l[1]),o.translate(t,e),l=this.getAnchor(s,h,!0),rt.transformUtil.fromMatrix(o,o).scale(r,i,{x:l[0],y:l[1]})}const c=this.getOffsetXY(Xr);if(this._transMatrix.e+=c.x,this._transMatrix.f+=c.y,a){const t=Vo.setValue(a.a,a.b,a.c,a.d,a.e,a.f),e=this._transMatrix;t.multiply(e.a,e.b,e.c,e.d,e.e,e.f),e.setValue(t.a,t.b,t.c,t.d,t.e,t.f)}}doUpdateGlobalMatrix(){if(this.parent){this._globalTransMatrix.multiply(this.transMatrix.a,this.transMatrix.b,this.transMatrix.c,this.transMatrix.d,this.transMatrix.e,this.transMatrix.f);const{scrollX:t=0,scrollY:e=0}=this.parent.attribute;this._globalTransMatrix.translate(t,e)}}setStage(t,e){if(this.stage!==t){if(this.stage=t,this.layer=e,this.setStageToShadowRoot(t,e),this.animates&&this.animates.size){const e=t.getTimeline();this.animates.forEach((t=>{t.timeline.isGlobal&&(t.setTimeline(e),e.addAnimate(t))}))}this._onSetStage&&this._onSetStage(this,t,e),this.getGraphicService().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})}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,e=!1){this._onSetStage=t,e&&this.stage&&t(this,this.stage)}attachShadow(t){return t&&(t.shadowHost=this),this.shadowRoot=null!=t?t:rt.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 Ct(t,!0)?this.pathProxy=(new $r).fromString(t):this.pathProxy=new $r,this.pathProxy}loadImage(t,e=!1){if(!t||e&&function(t){return!(!t.fill&&!t.stroke)}(t))return;const r=t;this.resources||(this.resources=new Map);const i={data:"init",state:null};this.resources.set(r,i),"string"==typeof t?(i.state="loading",t.startsWith("<svg")?(jn.GetSvg(t,this),this.backgroundImg=this.backgroundImg||e):(Rt(t)||t.includes("/")||Lt(t))&&(jn.GetImage(t,this),this.backgroundImg=this.backgroundImg||e)):xt(t)?(i.state="success",i.data=t,this.backgroundImg=this.backgroundImg||e):i.state="fail"}setShadowGraphic(t){t?this.attachShadow().add(t):this.detachShadow()}imageLoadSuccess(t,e,r){if(!this.resources)return;const i=this.resources.get(t);i&&(i.state="success",i.data=e,r&&r(),this.addUpdateBoundTag(),this.stage&&this.stage.renderNextFrame())}imageLoadFail(t,e){if(!this.resources)return;const r=this.resources.get(t);r&&(r.state="fail",e&&e())}_stopAnimates(t){t&&t.forEach((t=>{t.stop()}))}stopAnimates(t=!1){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(),rt.graphicService.onRelease(this)}_emitCustomEvent(t,e){var r,i;if(this._events&&t in this._events){const n=new Pn(t,e);n.bubbles=!1,n.manager=null===(i=null===(r=this.stage)||void 0===r?void 0:r.eventSystem)||void 0===i?void 0:i.manager,this.dispatchEvent(n)}}toCustomPath(){var t,e,r;const i=null===(r=null===(e=(null===(t=this.stage)||void 0===t?void 0:t.renderService)||rt.renderService)||void 0===e?void 0:e.drawContribution)||void 0===r?void 0:r.getRenderContribution(this);if(i){const t=new Uo(null,1);return i.drawShape(this,t,0,0,{},{}),t.path}return null}}var Jo;Qo.userSymbolMap={},Qo.mixin(In),function(t){t[t.LESS_GROUP=0]="LESS_GROUP",t[t.MORE_GROUP=1]="MORE_GROUP"}(Jo||(Jo={}));class ta extends Qo{constructor(t){super(t),this.type="group",this.parent=null,this.isContainer=!0,this.numberType=wo,this._childUpdateTag=Ye.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 Tn),this.theme.setTheme(t,this)}createTheme(){this.theme||(this.theme=new Tn)}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,r){if(r===qe.GLOBAL){const r=new fe(t,e);return this.parent&&this.parent.globalTransMatrix.transformPoint(r,r),this.AABBBounds.contains(r.x,r.y)}return this.AABBBounds.contains(t,e)}shouldUpdateAABBBounds(){return!!super.shouldUpdateAABBBounds()||!!(this._childUpdateTag&Ye.UPDATE_BOUNDS)}tryUpdateAABBBounds(){if(!this.shouldUpdateAABBBounds())return this._AABBBounds;this.getGraphicService().beforeUpdateAABBBounds(this,this.stage,!0,this._AABBBounds);const t=this.shouldSelfChangeUpdateAABBBounds(),e=this.doUpdateAABBBounds();return this.addUpdateLayoutTag(),this.getGraphicService().afterUpdateAABBBounds(this,this.stage,this._AABBBounds,this,t),"empty"===this.attribute.boundsMode&&e.clear(),e}doUpdateLocalMatrix(){const{x:t=Xr.x,y:e=Xr.y,dx:r=Xr.dx,dy:i=Xr.dy,scaleX:n=Xr.scaleX,scaleY:s=Xr.scaleY,angle:o=Xr.angle,postMatrix:a}=this.attribute;if(0!==t||0!==e||0!==r||0!==i||1!==n||1!==s||0!==o||a)return super.doUpdateLocalMatrix();this._transMatrix.reset()}getGraphicTheme(){return Cn(this).group}updateAABBBounds(t,e,r){const i=r;r=r.clone();const{width:n,height:s,path:o,clip:a=e.clip}=t;if(o&&o.length?o.forEach((t=>{r.union(t.AABBBounds)})):null!=n&&null!=s&&r.set(0,0,Math.max(0,n),Math.max(0,s)),!a){this.forEachChildren((t=>{r.union(t.AABBBounds)}));const{scrollX:e=0,scrollY:i=0}=t;r.translate(e,i)}return rt.graphicService.updateTempAABBBounds(r),rt.graphicService.transformAABBBounds(t,r,e,!1,this),i.copy(r),i}doUpdateAABBBounds(){this.updateAABBBoundsStamp++;const t=super.doUpdateAABBBounds();return this.parent&&this.parent.addChildUpdateBoundTag(),this._emitCustomEvent("AAABBBoundsChange"),t}clearUpdateBoundTag(){this._updateTag&=Ye.CLEAR_BOUNDS,this._childUpdateTag&=Ye.CLEAR_BOUNDS}addUpdateBoundTag(){this._updateTag|=Ye.UPDATE_BOUNDS,this.parent&&this.parent.addChildUpdateBoundTag()}addChildUpdateBoundTag(){this._childUpdateTag&Ye.UPDATE_BOUNDS||(this._childUpdateTag|=Ye.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(),this.getGraphicService().onAddIncremental(t,this,this.stage),e}incrementalClearChild(){super.removeAllChild(),this.addUpdateBoundTag(),this.getGraphicService().onClearIncremental(this,this.stage)}_updateChildToStage(t){return this.stage&&t&&t.setStage(this.stage,this.layer),this.addUpdateBoundTag(),t}appendChild(t,e=!0){const r=super.appendChild(t);return e&&this.stage&&r&&r.setStage(this.stage,this.layer),this.addUpdateBoundTag(),r}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 this.getGraphicService().onRemove(t),t.stage=null,this.addUpdateBoundTag(),e}removeAllChild(t=!1){this.forEachChildren((e=>{this.getGraphicService().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),this.getGraphicService().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(t=!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&Ye.UPDATE_GLOBAL_MATRIX)}_getChildByName(t,e){return this.find((e=>e.name===t),e)}createOrUpdateChild(t,e,r){let i=this._getChildByName(t);return i?i.setAttributes(e):(i=rt.graphicService.creator[r](e),i.name=t,this.add(i)),i}clone(){return new ta(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return ta.NOWORK_ANIMATE_ATTR}release(t){t&&this.forEachChildren((e=>{e.release(t)})),super.release()}}function ea(t){return new ta(t)}ta.NOWORK_ANIMATE_ATTR=Ko;class ra extends ta{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,r,i){var n;super({}),this.stage=t,this.global=e,this.window=r,this.main=i.main,this.layerHandler=i.layerHandler,this.layerHandler.init(this,r,{main:i.main,canvasId:i.canvasId,width:this.viewWidth,height:this.viewHeight,zIndex:null!==(n=i.zIndex)&&void 0!==n?n:0}),this.layer=this,this.subLayers=new Map,this.theme=new Tn,this.background="rgba(0, 0, 0, 0)",this.afterDrawCbs=[]}combineSubLayer(t=!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=>{rt.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((r=>{r.layer.renderCount=this.renderCount,r.layer.render(t,e)}))}render(t,e){var r;this.layerHandler.render([this],{renderService:t.renderService,stage:this.stage,layer:this,viewBox:t.viewBox,transMatrix:t.transMatrix,background:null!==(r=t.background)&&void 0!==r?r: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=>{rt.layerService.releaseLayer(this.stage,t.layer)}))}drawTo(t,e){var r;this.layerHandler.drawTo(t,[this],Object.assign({background:null!==(r=e.background)&&void 0!==r?r:this.background,renderService:e.renderService,viewBox:e.viewBox,transMatrix:e.transMatrix,stage:this.stage,layer:this},e)),this.afterDrawCbs.forEach((t=>t(this)))}}const ia=Symbol.for("TransformUtil"),na=Symbol.for("GraphicUtil"),sa=Symbol.for("LayerService"),oa=Symbol.for("StaticLayerHandlerContribution"),aa=Symbol.for("DynamicLayerHandlerContribution"),la=Symbol.for("VirtualLayerHandlerContribution");var ha,ca=function(t,e,r,i){var n,s=arguments.length,o=s<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,e,r,i);else for(var a=t.length-1;a>=0;a--)(n=t[a])&&(o=(s<3?n(o):s>3?n(e,r,o):n(e,r))||o);return s>3&&o&&Object.defineProperty(e,r,o),o},ua=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let da=ha=class{static GenerateLayerId(){return`${ha.idprefix}_${ha.prefix_count++}`}constructor(){this.layerMap=new Map,this.global=rt.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?Ai.get(oa):"dynamic"===t?Ai.get(aa):Ai.get(la),e}createLayer(t,e={main:!1}){var r;this.tryInit();let i=this.getRecommendedLayerType(e.layerMode);i=e.main||e.canvasId?"static":i;const n=this.getLayerHandler(i),s=new ra(t,this.global,t.window,Object.assign(Object.assign({main:!1},e),{layerMode:i,canvasId:null!==(r=e.canvasId)&&void 0!==r?r:ha.GenerateLayerId(),layerHandler:n})),o=this.layerMap.get(t)||[];return o.push(s),this.layerMap.set(t,o),this.staticLayerCountInEnv--,s}prepareStageLayer(t){let e;t.forEachChildren((t=>{const r=t.getNativeHandler();"virtual"===r.type?(r.mainHandler=e,e.secondaryHandlers.push(r)):(e=r,e.secondaryHandlers=[])}))}releaseLayer(t,e){e.release();const r=this.layerMap.get(t)||[];this.layerMap.set(t,r.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)}};da.idprefix="visactor_layer",da.prefix_count=0,da=ha=ca([L(),ua("design:paramtypes",[])],da);var pa=new v((t=>{t(et).to(ct).inSingletonScope(),t(cn).to(dn),t(na).to(mn).inSingletonScope(),t(ia).to(bn).inSingletonScope(),t(sa).to(da).inSingletonScope()}));function fa(t,e){return!(!t&&!e)}function ga(t,e){let r;return r=Et(t)?t.some((t=>t||void 0===t)):!!t,r&&e>0}function ma(t,e,r){return r&&t*e>0}function ya(t,e,r,i,n){return n&&t*e>0&&0!==r&&0!==i}function va(t,e){return t*e>0}function ba(t,e,r,i){return t*e>0&&0!==r&&0!==i}const _a=Symbol.for("AreaRenderContribution"),wa=Symbol.for("GroupRenderContribution"),xa=Symbol.for("RectRenderContribution"),Sa=Symbol.for("SymbolRenderContribution"),Ta=Symbol.for("TextRenderContribution"),ka=Symbol.for("InteractiveSubRenderContribution");function Ca(t,e){return"end"===t||"right"===t?-e:"center"===t?-e/2:0}function Ea(t,e,r,i=0){return"middle"===t?-e/2:"top"===t?0:"bottom"===t?i-e:t&&"alphabetic"!==t?0:(r||(r=e),-(e-r)/2-.79*r)}var Aa=function(t,e,r,i){var n,s=arguments.length,o=s<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,e,r,i);else for(var a=t.length-1;a>=0;a--)(n=t[a])&&(o=(s<3?n(o):s>3?n(e,r,o):n(e,r))||o);return s>3&&o&&Object.defineProperty(e,r,o),o},Oa=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Ba=function(t,e){return function(r,i){e(r,i,t)}};function Ra(t,e,r){var i;const{x:n=r.x,y:s=r.y,z:o=r.z,dx:a=r.dx,dy:l=r.dy,dz:h=r.dz,scaleX:c=r.scaleX,scaleY:u=r.scaleY,scaleZ:d=r.scaleZ,alpha:p=r.alpha,beta:f=r.beta,angle:g=r.angle,anchor3d:m=e.attribute.anchor,anchor:y}=e.attribute,v=[0,0,0];if(m){if("string"==typeof m[0]){const t=parseFloat(m[0])/100,r=e.AABBBounds;v[0]=r.x1+(r.x2-r.x1)*t}else v[0]=m[0];if("string"==typeof m[1]){const t=parseFloat(m[1])/100,r=e.AABBBounds;v[1]=r.x1+(r.x2-r.x1)*t}else v[1]=m[1];v[2]=null!==(i=m[2])&&void 0!==i?i:0}if(Po(t),Do(t,t,[n+a,s+l,o+h]),Do(t,t,[v[0],v[1],v[2]]),function(t,e,r){const i=Math.sin(r),n=Math.cos(r),s=e[4],o=e[5],a=e[6],l=e[7],h=e[8],c=e[9],u=e[10],d=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]=s*n+h*i,t[5]=o*n+c*i,t[6]=a*n+u*i,t[7]=l*n+d*i,t[8]=h*n-s*i,t[9]=c*n-o*i,t[10]=u*n-a*i,t[11]=d*n-l*i}(t,t,f),function(t,e,r){const i=Math.sin(r),n=Math.cos(r),s=e[0],o=e[1],a=e[2],l=e[3],h=e[8],c=e[9],u=e[10],d=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]=s*n-h*i,t[1]=o*n-c*i,t[2]=a*n-u*i,t[3]=l*n-d*i,t[8]=s*i+h*n,t[9]=o*i+c*n,t[10]=a*i+u*n,t[11]=l*i+d*n}(t,t,p),Do(t,t,[-v[0],-v[1],v[2]]),function(t,e,r){const i=r[0],n=r[1],s=r[2];t[0]=e[0]*i,t[1]=e[1]*i,t[2]=e[2]*i,t[3]=e[3]*i,t[4]=e[4]*n,t[5]=e[5]*n,t[6]=e[6]*n,t[7]=e[7]*n,t[8]=e[8]*s,t[9]=e[9]*s,t[10]=e[10]*s,t[11]=e[11]*s,t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]}(t,t,[c,u,d]),g){const r=Fo.allocate(),i=[0,0];if(y){if("string"==typeof m[0]){const t=parseFloat(m[0])/100,r=e.AABBBounds;i[0]=r.x1+(r.x2-r.x1)*t}else i[0]=m[0];if("string"==typeof m[1]){const t=parseFloat(m[1])/100,r=e.AABBBounds;i[1]=r.x1+(r.x2-r.x1)*t}else i[1]=m[1]}Do(r,r,[i[0],i[1],0]),function(t,e,r){const i=Math.sin(r),n=Math.cos(r),s=e[0],o=e[1],a=e[2],l=e[3],h=e[4],c=e[5],u=e[6],d=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]=s*n+h*i,t[1]=o*n+c*i,t[2]=a*n+u*i,t[3]=l*n+d*i,t[4]=h*n-s*i,t[5]=c*n-o*i,t[6]=u*n-a*i,t[7]=d*n-l*i}(r,r,g),Do(r,r,[-i[0],-i[1],0]),Mo(t,t,r)}}let La=class{constructor(t){this.creator=t,this.hooks={onAttributeUpdate:new J(["graphic"]),onSetStage:new J(["graphic","stage"]),onRemove:new J(["graphic"]),onRelease:new J(["graphic"]),onAddIncremental:new J(["graphic","group","stage"]),onClearIncremental:new J(["graphic","group","stage"]),beforeUpdateAABBBounds:new J(["graphic","stage","willUpdate","aabbBounds"]),afterUpdateAABBBounds:new J(["graphic","stage","aabbBounds","globalAABBBounds","selfChange"]),clearAABBBounds:new J(["graphic","stage","aabbBounds"])},this.tempAABBBounds1=new Le,this.tempAABBBounds2=new Le}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,r){this.hooks.onAddIncremental.taps.length&&this.hooks.onAddIncremental.call(t,e,r)}onClearIncremental(t,e){this.hooks.onClearIncremental.taps.length&&this.hooks.onClearIncremental.call(t,e)}beforeUpdateAABBBounds(t,e,r,i){this.hooks.beforeUpdateAABBBounds.taps.length&&this.hooks.beforeUpdateAABBBounds.call(t,e,r,i)}afterUpdateAABBBounds(t,e,r,i,n){this.hooks.afterUpdateAABBBounds.taps.length&&this.hooks.afterUpdateAABBBounds.call(t,e,r,i,n)}clearAABBBounds(t,e,r){this.hooks.clearAABBBounds.taps.length&&this.hooks.clearAABBBounds.call(t,e,r)}updatePathProxyAABBBounds(t,e){const r="function"==typeof e.pathProxy?e.pathProxy(e.attribute):e.pathProxy;if(!r)return!1;const i=new Ne(t);return ir(r.commandList,i,0,0),!0}updateHTMLTextAABBBounds(t,e,r,i){const{textAlign:n,textBaseline:s}=t;if(null!=t.forceBoundsHeight){const e=Ot(t.forceBoundsHeight)?t.forceBoundsHeight:t.forceBoundsHeight(),i=Ea(s,e,e);r.set(r.x1,i,r.x2,i+e)}if(null!=t.forceBoundsWidth){const e=Ot(t.forceBoundsWidth)?t.forceBoundsWidth:t.forceBoundsWidth(),i=Ca(n,e);r.set(i,r.y1,i+e,r.y2)}}combindShadowAABBBounds(t,e){if(e&&e.shadowRoot){const r=e.shadowRoot.AABBBounds;t.union(r)}}transformAABBBounds(t,e,r,i,n){if(!e.empty()){const{scaleX:n=r.scaleX,scaleY:s=r.scaleY,stroke:o=r.stroke,shadowBlur:a=r.shadowBlur,lineWidth:l=r.lineWidth,pickStrokeBuffer:h=r.pickStrokeBuffer,strokeBoundsBuffer:c=r.strokeBoundsBuffer}=t,u=this.tempAABBBounds1,d=this.tempAABBBounds2;if(o&&l){co(u,(l+h)/Math.abs(n+s),i,c),e.union(u),u.setValue(d.x1,d.y1,d.x2,d.y2)}if(a){const{shadowOffsetX:i=r.shadowOffsetX,shadowOffsetY:o=r.shadowOffsetY}=t;co(u,a/Math.abs(n+s)*2,!1,c+1),u.translate(i,o),e.union(u)}}if(this.combindShadowAABBBounds(e,n),e.empty())return;let s=!0;const o=n.transMatrix;n&&n.isContainer&&(s=!(1===o.a&&0===o.b&&0===o.c&&1===o.d&&0===o.e&&0===o.f)),s&&Be(e,e,o)}validCheck(t,e,r,i){if(!i)return!0;if(null!=t.forceBoundsHeight||null!=t.forceBoundsWidth)return!0;if(i.shadowRoot||i.isContainer)return!0;const{visible:n=e.visible}=t;return!(!i.valid||!n)||(r.empty()||(i.parent&&r.transformWithMatrix(i.parent.globalTransMatrix),this.clearAABBBounds(i,i.stage,r),r.clear()),!1)}updateTempAABBBounds(t){const e=this.tempAABBBounds1,r=this.tempAABBBounds2;return e.setValue(t.x1,t.y1,t.x2,t.y2),r.setValue(t.x1,t.y1,t.x2,t.y2),{tb1:e,tb2:r}}};La=Aa([L(),Ba(0,B(Oo)),Oa("design:paramtypes",[Object])],La);const Pa=(t,e,r)=>{const{outerBorder:i,shadowBlur:n=e.shadowBlur}=t;if(i){const t=e.outerBorder,{distance:s=t.distance,lineWidth:o=t.lineWidth}=i;r.expand(s+(n+o)/2)}return r},Da=["radius","startAngle","endAngle",...Go];class Ma extends Qo{constructor(t={radius:1}){super(t),this.type="circle",this.numberType=_o}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{startAngle:t,endAngle:e,radius:r}=this.attribute;return this._validNumber(t)&&this._validNumber(e)&&this._validNumber(r)}getGraphicTheme(){return Cn(this).circle}updateAABBBounds(t,e,r,i){this.updatePathProxyAABBBounds(r)||(i?this.updateCircleAABBBoundsImprecise(t,e,r):this.updateCircleAABBBoundsAccurate(t,e,r));const{tb1:n,tb2:s}=rt.graphicService.updateTempAABBBounds(r);return Pa(t,e,n),r.union(n),n.setValue(s.x1,s.y1,s.x2,s.y2),this.widthWithoutTransform=r.x2-r.x1,this.heightWithoutTransform=r.y2-r.y1,rt.graphicService.transformAABBBounds(t,r,e,!1,this),r}updateCircleAABBBoundsImprecise(t,e,r){const{radius:i=e.radius}=t;return r.set(-i,-i,i,i),r}updateCircleAABBBoundsAccurate(t,e,r){const{startAngle:i=e.startAngle,endAngle:n=e.endAngle,radius:s=e.radius}=t;return n-i>ne-te?r.set(-s,-s,s,s):function(t,e,r,i){for(;t>=ne;)t-=ne;for(;t<0;)t+=ne;for(;t>e;)e+=ne;Un[0].x=r,Un[1].y=r,Un[2].x=-r,Un[3].y=-r;const n=Math.ceil(t/re)%4,s=Math.ceil(e/re)%4;if(i.add(ae(t)*r,ce(t)*r),i.add(ae(e)*r,ce(e)*r),n!==s||e-t>ee){let t=!1;for(let e=0;e<$n.length;e++)if(t||n!==$n[e]){if(t&&s===$n[e])break;if(t){const t=Un[$n[e]];i.add(t.x,t.y)}}else{t=!0;const e=Un[n];i.add(e.x,e.y)}}}(i,n,s,r),r}needUpdateTags(t){return super.needUpdateTags(t,Da)}needUpdateTag(t){return super.needUpdateTag(t,Da)}toCustomPath(){var t,e,r;let i=super.toCustomPath();if(i)return i;const n=this.attribute,s=null!==(t=n.radius)&&void 0!==t?t:this.getDefaultAttribute("radius"),o=null!==(e=n.startAngle)&&void 0!==e?e:this.getDefaultAttribute("startAngle"),a=null!==(r=n.endAngle)&&void 0!==r?r:this.getDefaultAttribute("endAngle");return i=new $r,i.arc(0,0,s,o,a),i}clone(){return new Ma(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return Ma.NOWORK_ANIMATE_ATTR}}Ma.NOWORK_ANIMATE_ATTR=Ko;class Ia{constructor(t,e,r){this.fontFamily=t,this.textOptions=e,this.textMeasure=r}LayoutBBox(t,e,r,i){if(t.xOffset="left"===e||"start"===e?0:"center"===e?t.width/-2:"right"===e||"end"===e?-t.width:0,"top"===r)t.yOffset=0;else if("middle"===r)t.yOffset=t.height/-2;else if("alphabetic"===r){let e=.79;if(1===i.length){const t=i[0];e=t.ascent/(t.ascent+t.descent)}t.yOffset=t.height*-e}else t.yOffset=-t.height;return t}GetLayoutByLines(t,e,r,i,n="",s,o){const{lineWidth:a,suffixPosition:l="end",measureMode:h=ut.actualBounding,keepCenterInLine:c=!1}=null!=o?o:{};t=t.map((t=>t.toString()));const u=[],d=[0,0];if("number"==typeof a&&a!==1/0){let e;for(let r=0,i=t.length;r<i;r++){const i=this.textMeasure.measureTextPixelADscentAndWidth(t[r],this.textOptions,h);let o=t[r].toString();if(i.width>a){const i=this.textMeasure.clipTextWithSuffix(t[r],this.textOptions,a,n,s,l);o=i.str,e=i.width}else e=i.width;u.push({str:o,width:e,ascent:i.ascent,descent:i.descent,keepCenterInLine:c})}d[0]=a}else{let e,r,i=0;for(let n=0,s=t.length;n<s;n++){r=t[n];const s=this.textMeasure.measureTextPixelADscentAndWidth(t[n],this.textOptions,h);e=s.width,i=Math.max(i,e),u.push({str:r,width:e,ascent:s.ascent,descent:s.descent,keepCenterInLine:c})}d[0]=i}d[1]=u.length*i,d[0]=u.reduce(((t,e)=>Math.max(t,e.width)),0);const p={xOffset:0,yOffset:0,width:d[0],height:d[1]};return this.LayoutBBox(p,e,r,u),this.layoutWithBBox(p,u,e,r,i)}layoutWithBBox(t,e,r,i,n){const s=[0,0],o=e.length*n;"top"===i||("middle"===i?s[1]=(t.height-o)/2:"bottom"===i&&(s[1]=t.height-o));for(let o=0;o<e.length;o++)this.lineOffset(t,e[o],r,i,n,s);return{bbox:t,lines:e,fontFamily:this.fontFamily,fontSize:this.textOptions.fontSize,fontWeight:this.textOptions.fontWeight,lineHeight:n,textAlign:r,textBaseline:i}}lineOffset(t,e,r,i,n,s){if("left"===r||"start"===r?e.leftOffset=0:"center"===r?e.leftOffset=(t.width-e.width)/2:"right"!==r&&"end"!==r||(e.leftOffset=t.width-e.width),e.topOffset=n/2+(e.ascent-e.descent)/2+s[1],!e.keepCenterInLine){const t=0,r=e.ascent+e.descent+t;if(r<n-t&&("bottom"===i?e.topOffset+=(n-r)/2:"top"===i&&(e.topOffset-=(n-r)/2)),"alphabetic"===i){const t=n/(e.ascent+e.descent);e.topOffset=n/2+(e.ascent-e.descent)/2*t+s[1]}}return s[1]+=n,e}}const Na=["text","maxLineWidth","maxWidth","textAlign","textBaseline","heightLimit","lineClamp","fontSize","fontFamily","fontWeight","ellipsis","lineHeight","direction","wordBreak","heightLimit","lineClamp",...Go];class Fa extends Qo{get font(){const t=this.getGraphicTheme();return this._font||(this._font=Ae(this.attribute,t)),this._font}get clipedText(){var t;const e=this.attribute,r=this.getGraphicTheme(),i=this.getMaxWidth(r);return Number.isFinite(i)?(this.tryUpdateAABBBounds(),this.cache.clipedText):(null!==(t=e.text)&&void 0!==t?t:r.text).toString()}get clipedWidth(){return this.tryUpdateAABBBounds(),this.cache.clipedWidth}get cliped(){var t,e;const r=this.getGraphicTheme(),i=this.attribute,n=this.getMaxWidth(r);if(!Number.isFinite(n))return!1;const{text:s}=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(s)?s.join(""):s)!==t}return"vertical"===i.direction&&this.cache.verticalList&&this.cache.verticalList[0]?this.cache.verticalList[0].map((t=>t.text)).join("")!==i.text.toString():null!=this.clipedText&&this.clipedText!==i.text.toString()}get multilineLayout(){return this.tryUpdateAABBBounds(),this.cache.layoutData}get isMultiLine(){return Array.isArray(this.attribute.text)||"normal"===this.attribute.whiteSpace}constructor(t={text:"",fontSize:16}){super(t),this.type="text",this.numberType=Eo,this.cache={}}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{text:t}=this.attribute;return Et(t)?!t.every((t=>null==t||""===t)):null!=t&&""!==t}getGraphicTheme(){return Cn(this).text}doUpdateOBBBounds(){const t=this.getGraphicTheme();this._OBBBounds.clear();const e=this.attribute,{angle:r=t.angle}=e;if(!r){const t=this.AABBBounds;return this._OBBBounds.setValue(t.x1,t.y1,t.x2,t.y2),this._OBBBounds}this.obbText||(this.obbText=new Fa({})),this.obbText.setAttributes(Object.assign(Object.assign({},e),{angle:0}));const i=this.obbText.AABBBounds,{x:n,y:s}=e,o={x:(i.x1+i.x2)/2,y:(i.y1+i.y2)/2},a=Se(o,r,{x:n,y:s});return this._OBBBounds.copy(i),this._OBBBounds.translate(a.x-o.x,a.y-o.y),this._OBBBounds.angle=r,this._OBBBounds}updateAABBBounds(t,e,r){const{text:i=e.text}=this.attribute;Array.isArray(i)?this.updateMultilineAABBBounds(i):this.updateSingallineAABBBounds(i);const{tb1:n}=rt.graphicService.updateTempAABBBounds(r),{scaleX:s=e.scaleX,scaleY:o=e.scaleY,shadowBlur:a=e.shadowBlur,strokeBoundsBuffer:l=e.strokeBoundsBuffer}=t;if(a){co(n,a/Math.abs(s+o),!0,l),r.union(n)}return rt.graphicService.combindShadowAABBBounds(r,this),null==t.forceBoundsHeight&&null==t.forceBoundsWidth||rt.graphicService.updateHTMLTextAABBBounds(t,e,r),this.widthWithoutTransform=r.x2-r.x1,this.heightWithoutTransform=r.y2-r.y1,Be(r,r,this.transMatrix),r}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:r=e.direction,underlineOffset:i=e.underlineOffset}=this.attribute,n="horizontal"===r?this.updateHorizontalMultilineAABBBounds(t):this.updateVerticalMultilineAABBBounds(t);return"horizontal"===r&&i&&this._AABBBounds.add(this._AABBBounds.x1,this._AABBBounds.y2+i),n}guessLineHeightBuf(t){return t?.1*t:0}updateHorizontalMultilineAABBBounds(t){var e;const r=this.getGraphicTheme(),i=this.attribute,{fontFamily:n=r.fontFamily,textAlign:s=r.textAlign,textBaseline:o=r.textBaseline,fontSize:a=r.fontSize,fontWeight:l=r.fontWeight,ellipsis:h=r.ellipsis,maxLineWidth:c,stroke:u=r.stroke,wrap:d=r.wrap,measureMode:p=r.measureMode,lineWidth:f=r.lineWidth,whiteSpace:g=r.whiteSpace,suffixPosition:m=r.suffixPosition,ignoreBuf:y=r.ignoreBuf,keepCenterInLine:v=r.keepCenterInLine}=i,b=y?0:this.guessLineHeightBuf(a),_=this.getLineHeight(i,r,b);if("normal"===g||d)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),u&&this._AABBBounds.expand(f/2),this._AABBBounds}const w=rt.graphicUtil.textMeasure,x=new Ia(n,{fontSize:a,fontWeight:l,fontFamily:n,lineHeight:_},w).GetLayoutByLines(t,s,o,_,!0===h?r.ellipsis:h||void 0,!1,{lineWidth:c,suffixPosition:m,measureMode:p,keepCenterInLine:v}),{bbox:S}=x;return this.cache.layoutData=x,this.clearUpdateShapeTag(),this._AABBBounds.set(S.xOffset,S.yOffset,S.xOffset+S.width,S.yOffset+S.height),u&&this._AABBBounds.expand(f/2),this._AABBBounds}updateWrapAABBBounds(t){var e,r,i;const n=this.getGraphicTheme(),{fontFamily:s=n.fontFamily,textAlign:o=n.textAlign,textBaseline:a=n.textBaseline,fontSize:l=n.fontSize,ellipsis:h=n.ellipsis,maxLineWidth:c,stroke:u=n.stroke,lineWidth:d=n.lineWidth,wordBreak:p=n.wordBreak,fontWeight:f=n.fontWeight,ignoreBuf:g=n.ignoreBuf,measureMode:m=n.measureMode,suffixPosition:y=n.suffixPosition,heightLimit:v=0,lineClamp:b,keepCenterInLine:_=n.keepCenterInLine}=this.attribute,w=g?0:this.guessLineHeightBuf(l),x=this.getLineHeight(this.attribute,n,w);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),u&&this._AABBBounds.expand(d/2),this._AABBBounds}const S=rt.graphicUtil.textMeasure,T={fontSize:l,fontWeight:f,fontFamily:s,lineHeight:x},k=new Ia(s,T,S),C=Et(t)?t.map((t=>t.toString())):[t.toString()],E=[],A=[0,0];let O=1/0;if(v>0&&(O=Math.max(Math.floor(v/x),1)),b&&(O=Math.min(O,b)),"number"==typeof c&&c!==1/0){if(c>0)for(let t=0;t<C.length;t++){const e=C[t];let n=!0;if(t===O-1){const r=S.clipTextWithSuffix(e,T,c,h,!1,y,t!==C.length-1),i=S.measureTextPixelADscentAndWidth(r.str,T,m);E.push({str:r.str,width:r.width,ascent:i.ascent,descent:i.descent,keepCenterInLine:_});break}const s=S.clipText(e,T,c,"break-all"!==p,"keep-all"===p);if(""!==e&&""===s.str||s.wordBreaked){if(h){const t=S.clipTextWithSuffix(e,T,c,h,!1,y);s.str=null!==(r=t.str)&&void 0!==r?r:"",s.width=null!==(i=t.width)&&void 0!==i?i:0}else s.str="",s.width=0;n=!1}const o=S.measureTextPixelADscentAndWidth(s.str,T,m);E.push({str:s.str,width:s.width,ascent:o.ascent,descent:o.descent,keepCenterInLine:_});let a=s.str.length;if(!s.wordBreaked||""!==e&&""===s.str||(n=!0,a=s.wordBreaked),s.str.length===e.length);else if(n){let r=e.substring(a);"keep-all"===p&&(r=r.replace(/^\s+/g,"")),C.splice(t+1,0,r)}}let t=0;E.forEach((e=>{t=Math.max(t,e.width)})),A[0]=t}else{let t,e,r=0;for(let i=0,n=C.length;i<n;i++){if(i===O-1){const t=S.clipTextWithSuffix(C[i],T,c,h,!1,y),e=S.measureTextPixelADscentAndWidth(t.str,T,m);E.push({str:t.str,width:t.width,ascent:e.ascent,descent:e.descent,keepCenterInLine:_}),r=Math.max(r,t.width);break}e=C[i],t=S.measureTextWidth(e,T),r=Math.max(r,t);const n=S.measureTextPixelADscentAndWidth(e,T,m);E.push({str:e,width:t,ascent:n.ascent,descent:n.descent,keepCenterInLine:_})}A[0]=r}A[1]=E.length*x;const B={xOffset:0,yOffset:0,width:A[0],height:A[1]};k.LayoutBBox(B,o,a,E);const R=k.layoutWithBBox(B,E,o,a,x);return this.cache.layoutData=R,this.clearUpdateShapeTag(),this._AABBBounds.set(B.xOffset,B.yOffset,B.xOffset+B.width,B.yOffset+B.height),u&&this._AABBBounds.expand(d/2),this._AABBBounds}updateVerticalMultilineAABBBounds(t){var e,r;const i=this.getGraphicTheme(),n=rt.graphicUtil.textMeasure;let s;const o=this.attribute,{maxLineWidth:a=i.maxLineWidth,ellipsis:l=i.ellipsis,fontFamily:h=i.fontFamily,fontSize:c=i.fontSize,fontWeight:u=i.fontWeight,stroke:d=i.stroke,lineWidth:p=i.lineWidth,verticalMode:f=i.verticalMode,suffixPosition:g=i.suffixPosition}=o,m=this.getLineHeight(o,i,0);let{textAlign:y=i.textAlign,textBaseline:v=i.textBaseline}=o;if(!f){const t=y;y=null!==(e=Fa.baselineMapAlign[v])&&void 0!==e?e:"left",v=null!==(r=Fa.alignMapBaseline[t])&&void 0!==r?r:"top"}if(s=0,!this.shouldUpdateShape()&&this.cache){this.cache.verticalList.forEach((t=>{const e=t.reduce(((t,e)=>t+e.width),0);s=le(e,s)}));const t=Ca(y,s),e=this.cache.verticalList.length*m,r=Ea(v,e,c);return this._AABBBounds.set(r,t,r+e,t+s),d&&this._AABBBounds.expand(p/2),this._AABBBounds}const b=t.map((t=>function(t){const e=[];let r=0,i="";for(let n=0;n<t.length;n++)yo(t[n])?r?i+=t[n]:(r=1,i=t[n]):(r&&(e.push({text:i,direction:fo.VERTICAL}),i="",r=0),e.push({text:t[n],direction:fo.HORIZONTAL}));return i&&e.push({text:i,direction:fo.VERTICAL}),e}(t.toString())));b.forEach(((t,e)=>{if(Number.isFinite(a))if(l){const r=!0===l?i.ellipsis:l,o=n.clipTextWithSuffixVertical(t,{fontSize:c,fontWeight:u,fontFamily:h},a,r,!1,g);b[e]=o.verticalList,s=o.width}else{const r=n.clipTextVertical(t,{fontSize:c,fontWeight:u,fontFamily:h},a,!1);b[e]=r.verticalList,s=r.width}else s=0,t.forEach((t=>{const e=t.direction===fo.HORIZONTAL?c:n.measureTextWidth(t.text,{fontSize:c,fontWeight:u,fontFamily:h});s+=e,t.width=e}))})),this.cache.verticalList=b,this.clearUpdateShapeTag(),this.cache.verticalList.forEach((t=>{const e=t.reduce(((t,e)=>t+e.width),0);s=le(e,s)}));const _=Ca(y,s),w=this.cache.verticalList.length*m,x=Ea(v,w,c);return this._AABBBounds.set(x,_,x+w,_+s),d&&this._AABBBounds.expand(p/2),this._AABBBounds}getMaxWidth(t){var e,r;const i=this.attribute;return null!==(r=null!==(e=i.maxLineWidth)&&void 0!==e?e:i.maxWidth)&&void 0!==r?r:t.maxWidth}getLineHeight(t,e,r){var i;return null!==(i=Yn(t.lineHeight,t.fontSize||e.fontSize))&&void 0!==i?i:(t.fontSize||e.fontSize)+r}needUpdateTags(t,e=Na){return super.needUpdateTags(t,e)}needUpdateTag(t,e=Na){return super.needUpdateTag(t,e)}_interpolate(t,e,r,i,n){"text"===t&&(n.text=i)}clone(){return new Fa(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return Fa.NOWORK_ANIMATE_ATTR}getBaselineMapAlign(){return Fa.baselineMapAlign}getAlignMapBaseline(){return Fa.alignMapBaseline}}function ja(t){return new Fa(t)}Fa.NOWORK_ANIMATE_ATTR=Object.assign({ellipsis:1,wordBreak:1,direction:1,textAlign:1,textBaseline:1,fontFamily:1,fontWeight:1},Ko),Fa.baselineMapAlign={top:"left",bottom:"right",middle:"center"},Fa.alignMapBaseline={left:"top",right:"bottom",center:"middle"};const za=["symbolType","size",...Go];let Ha=class t extends Qo{constructor(t={symbolType:"circle"}){super(t),this.type="symbol",this.numberType=Co}getParsedPath(){return this.shouldUpdateShape()&&(this._parsedPath=this.doUpdateParsedPath(),this.clearUpdateShapeTag()),this._parsedPath}getParsedPath2D(t=0,e=0,r=1){let i=null;try{i=new Path2D}catch(t){return null}const n=this.getParsedPath();if(!n)return null;n.draw(i,r,t,e)}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{size:t}=this.attribute;return Et(t)?2===t.length&&t.every(this._validNumber):this._validNumber(t)}doUpdateParsedPath(){const{symbolType:t="circle"}=this.attribute;return super.parsePath(t)}getGraphicTheme(){return Cn(this).symbol}updateAABBBounds(t,e,r,i){this.updatePathProxyAABBBounds(r)||(i?this.updateSymbolAABBBoundsImprecise(t,e,r):this.updateSymbolAABBBoundsAccurate(t,e,r));const{tb1:n,tb2:s}=rt.graphicService.updateTempAABBBounds(r);((t,e,r)=>{const{outerBorder:i,shadowBlur:n=e.shadowBlur,strokeBoundsBuffer:s=e.strokeBoundsBuffer}=t;if(i){const t=e.outerBorder,{distance:o=t.distance,lineWidth:a=t.lineWidth}=i;co(r,o+(n+a)/2,!0,s)}})(t,e,n),r.union(n),n.setValue(s.x1,s.y1,s.x2,s.y2),this.widthWithoutTransform=r.x2-r.x1,this.heightWithoutTransform=r.y2-r.y1,this.x1WithoutTransform=r.x1,this.y1WithoutTransform=r.y1;const{lineJoin:o=e.lineJoin}=t;return rt.graphicService.transformAABBBounds(t,r,e,"miter"===o,this),r}updateSymbolAABBBoundsImprecise(t,e,r){const{size:i=e.size}=t;if(Et(i))r.set(-i[0]/2,-i[1]/2,i[0]/2,i[1]/2);else{const t=i/2;r.set(-t,-t,t,t)}return r}updateSymbolAABBBoundsAccurate(t,e,r){const{size:i=e.size}=t;return this.getParsedPath().bounds(i,r),r}needUpdateTags(t){return super.needUpdateTags(t,za)}needUpdateTag(t){return super.needUpdateTag(t,za)}toCustomPath(){const t=this.getParsedPath(),e=this.attribute.size,r=Et(e)?e:[e,e];return t.path?(new $r).fromCustomPath2D(t.path,0,0,r[0],r[1]):(new $r).fromString(t.pathStr,0,0,r[0],r[1])}clone(){return new t(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return t.NOWORK_ANIMATE_ATTR}};function Wa(t){return new Ha(t)}Ha.NOWORK_ANIMATE_ATTR=Object.assign({symbolType:1},Ko);const Ua=["segments","points","curveType","curveTension",...Go];class $a extends Qo{constructor(t={}){super(t),this.type="line",this.numberType=So}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,r,i,n){"points"===t&&(n.points=Gn(r,i,e))}getGraphicTheme(){return Cn(this).line}updateAABBBounds(t,e,r){this.updatePathProxyAABBBounds(r)||(t.segments?this.updateLineAABBBoundsBySegments(t,e,r):this.updateLineAABBBoundsByPoints(t,e,r)),rt.graphicService.updateTempAABBBounds(r),this.widthWithoutTransform=r.x2-r.x1,this.heightWithoutTransform=r.y2-r.y1;const{lineJoin:i=e.lineJoin}=t;return rt.graphicService.transformAABBBounds(t,r,e,"miter"===i,this),r}updateLineAABBBoundsByPoints(t,e,r,i){const{points:n=e.points,connectedType:s}=t,o=r;return n.forEach((t=>{!1===t.defined&&"connect"!==s||o.add(t.x,t.y)})),o}updateLineAABBBoundsBySegments(t,e,r,i){const{segments:n=e.segments,connectedType:s}=t,o=r;return n.forEach((t=>{t.points.forEach((t=>{!1===t.defined&&"connect"!==s||o.add(t.x,t.y)}))})),o}needUpdateTags(t){return super.needUpdateTags(t,Ua)}needUpdateTag(t){return super.needUpdateTag(t,Ua)}toCustomPath(){let t=super.toCustomPath();if(t)return t;const e=this.attribute;t=new $r;const r=e.segments,i=e=>{if(e&&e.length){let r=!0;e.forEach((e=>{!1!==e.defined&&(r?t.moveTo(e.x,e.y):t.lineTo(e.x,e.y),r=!1)}))}};return r&&r.length?r.forEach((t=>{i(t.points)})):e.points&&i(e.points),t}clone(){return new $a(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return $a.NOWORK_ANIMATE_ATTR}}function Va(t){return new $a(t)}$a.NOWORK_ANIMATE_ATTR=Object.assign({segments:1,curveType:1},Ko);const Ga=["width","x1","y1","height","cornerRadius",...Go];class Xa extends Qo{constructor(t){super(t),this.type="rect",this.numberType=ko}isValid(){return super.isValid()&&this._isValid()}_isValid(){return!0}getGraphicTheme(){return Cn(this).rect}updateAABBBounds(t,e,r){if(!this.updatePathProxyAABBBounds(r)){let{width:e,height:i}=t;const{x1:n,y1:s,x:o,y:a}=t;e=null!=e?e:n-o,i=null!=i?i:s-a,(isFinite(e)||isFinite(i)||isFinite(o)||isFinite(a))&&r.set(0,0,e||0,i||0)}const{tb1:i,tb2:n}=rt.graphicService.updateTempAABBBounds(r);return Pa(t,e,i),r.union(i),i.setValue(n.x1,n.y1,n.x2,n.y2),this.widthWithoutTransform=r.x2-r.x1,this.heightWithoutTransform=r.y2-r.y1,rt.graphicService.transformAABBBounds(t,r,e,!1,this),r}needUpdateTags(t){return super.needUpdateTags(t,Ga)}needUpdateTag(t){return super.needUpdateTag(t,Ga)}toCustomPath(){let t=super.toCustomPath();if(t)return t;const e=this.attribute,{x:r,y:i,width:n,height:s}=(t=>{if(!t)return{x:0,y:0,width:0,height:0};let e=_t(t.width)?t.x1-t.x:t.width,r=_t(t.height)?t.y1-t.y:t.height,i=0,n=0;return e<0?(i=e,e=-e):Number.isNaN(e)&&(e=0),r<0?(n=r,r=-r):Number.isNaN(r)&&(r=0),{x:i,y:n,width:e,height:r}})(e);return t=new $r,t.moveTo(r,i),t.rect(r,i,n,s),t}clone(){return new Xa(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return Xa.NOWORK_ANIMATE_ATTR}}function Ya(t){return new Xa(t)}Xa.NOWORK_ANIMATE_ATTR=Ko;const qa=["width","height","image",...Go];let Za=class t extends Qo{constructor(t){super(t),this.type="image",this.numberType=xo,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,r){super.imageLoadSuccess(t,e,(()=>{this.successCallback&&this.successCallback()})),this.addUpdateBoundTag()}imageLoadFail(t,e){super.imageLoadFail(t,(()=>{this.failCallback&&this.failCallback()}))}setAttributes(t,e,r){return t.image&&this.loadImage(t.image),super.setAttributes(t,e,r)}setAttribute(t,e,r,i){return"image"===t&&this.loadImage(e),super.setAttribute(t,e,r,i)}getGraphicTheme(){return Cn(this).image}updateAABBBounds(t,e,r){if(!this.updatePathProxyAABBBounds(r)){const{maxWidth:i=e.maxWidth,maxHeight:n=e.maxHeight}=t;let{width:s,height:o}=t;if(null==s||null==o){const t=this.getImageElement();if(t){const e=t.width,r=t.height;if(null!=s)o=s*(r/e);else if(null!=o)s=o*(e/r);else{const t=e/r;t>i/n?(s=i,o=i/t):(o=n,s=n*t)}}else s=i,o=n}this._actualWidth=s,this._actualHeight=o,r.set(0,0,s,o)}const{tb1:i,tb2:n}=rt.graphicService.updateTempAABBBounds(r);return Pa(t,e,i),r.union(i),i.setValue(n.x1,n.y1,n.x2,n.y2),this.widthWithoutTransform=r.x2-r.x1,this.heightWithoutTransform=r.y2-r.y1,rt.graphicService.transformAABBBounds(t,r,e,!1,this),r}getDefaultAttribute(t){return pi[t]}needUpdateTags(t){return super.needUpdateTags(t,qa)}needUpdateTag(t){return super.needUpdateTag(t,qa)}clone(){return new t(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return t.NOWORK_ANIMATE_ATTR}};Za.NOWORK_ANIMATE_ATTR=Object.assign({image:1,repeatX:1,repeatY:1},Ko);const Ka=["points","cornerRadius",...Go];class Qa extends Qo{constructor(t){super(t),this.type="polygon",this.numberType=To}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{points:t}=this.attribute;return t&&t.length>=2}getGraphicTheme(){return Cn(this).polygon}updateAABBBounds(t,e,r){this.updatePathProxyAABBBounds(r)||this.updatePolygonAABBBoundsImprecise(t,e,r),rt.graphicService.updateTempAABBBounds(r),this.widthWithoutTransform=r.x2-r.x1,this.heightWithoutTransform=r.y2-r.y1;const{lineJoin:i=e.lineJoin}=t;return rt.graphicService.transformAABBBounds(t,r,e,"miter"===i,this),r}updatePolygonAABBBoundsImprecise(t,e,r){const{points:i=e.points}=t;return i.forEach((t=>{r.add(t.x,t.y)})),r}_interpolate(t,e,r,i,n){"points"===t&&(n.points=Gn(r,i,e))}needUpdateTags(t){return super.needUpdateTags(t,Ka)}needUpdateTag(t){return super.needUpdateTag(t,Ka)}toCustomPath(){let t=super.toCustomPath();if(t)return t;const e=this.attribute.points;return t=new $r,e.forEach(((e,r)=>{0===r?t.moveTo(e.x,e.y):t.lineTo(e.x,e.y)})),t.closePath(),t}clone(){return new Qa(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return Qa.NOWORK_ANIMATE_ATTR}}Qa.NOWORK_ANIMATE_ATTR=Ko;const Ja=new class{constructor(){this.store=new Map}RegisterGraphicCreator(t,e){this.store.set(t,e),this[t]=e}CreateGraphic(t,e){const r=this.store.get(t);return r?r(e):null}};let tl;var el=function(t,e,r,i){var n,s=arguments.length,o=s<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,e,r,i);else for(var a=t.length-1;a>=0;a--)(n=t[a])&&(o=(s<3?n(o):s>3?n(e,r,o):n(e,r))||o);return s>3&&o&&Object.defineProperty(e,r,o),o},rl=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},il=function(t,e){return function(r,i){e(r,i,t)}};class nl{constructor(){this.time=Je.beforeFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,r,i,n,s,o,a,l,h,c,u,d){var p;const{background:f,backgroundOpacity:g=(null!==(p=t.attribute.fillOpacity)&&void 0!==p?p:l.backgroundOpacity),opacity:m=l.opacity,backgroundMode:y=l.backgroundMode,backgroundFit:v=l.backgroundFit,backgroundKeepAspectRatio:b=l.backgroundKeepAspectRatio,backgroundScale:_=l.backgroundScale,backgroundOffsetX:w=l.backgroundOffsetX,backgroundOffsetY:x=l.backgroundOffsetY,backgroundClip:S=l.backgroundClip}=t.attribute;if(f)if(t.backgroundImg&&t.resources){const n=t.resources.get(f);if("success"!==n.state||!n.data)return;if(e.save(),t.parent&&!t.transMatrix.onlyTranslate()){const r=Cn(t.parent).group,{scrollX:i=r.scrollX,scrollY:n=r.scrollY}=t.parent.attribute;e.setTransformFromMatrix(t.parent.globalTransMatrix,!0),e.translate(i,n)}S&&e.clip();const s=t.AABBBounds;e.setCommonStyle(t,t.attribute,r,i,l),e.globalAlpha=g*m,this.doDrawImage(e,n.data,s,{backgroundMode:y,backgroundFit:v,backgroundKeepAspectRatio:b,backgroundScale:_,backgroundOffsetX:w,backgroundOffsetY:x}),e.restore(),t.transMatrix.onlyTranslate()||e.setTransformForCurrent()}else e.highPerformanceSave(),e.setCommonStyle(t,t.attribute,r,i,l),e.globalAlpha=g*m,e.fillStyle=f,e.fill(),e.highPerformanceRestore()}doDrawImage(t,e,r,i){const{backgroundMode:n,backgroundFit:s,backgroundKeepAspectRatio:o,backgroundScale:a=1,backgroundOffsetX:l=0,backgroundOffsetY:h=0}=i,c=r.width(),u=r.height();let d=c,p=u;if("no-repeat"===n)if(s)if(o){const i=Math.max(c/e.width,u/e.height);t.drawImage(e,r.x1+l,r.y1+h,e.width*i*a,e.height*i*a)}else t.drawImage(e,r.x1,r.y1,r.width(),r.height());else{const i=e.width*a,n=e.height*a;t.drawImage(e,r.x1+l,r.y1+h,i,n)}else{if(s&&"repeat"!==n&&(e.width||e.height)){const r=e.width,i=e.height;"repeat-x"===n?(d=r*(u/i),p=u):"repeat-y"===n&&(p=i*(c/r),d=c);const s=t.dpr,o=an.allocate({width:d,height:p,dpr:s}),a=o.getContext("2d");a&&(a.inuse=!0,a.clearMatrix(),a.setTransformForCurrent(!0),a.clearRect(0,0,d,p),a.drawImage(e,0,0,d,p),e=o.nativeCanvas),an.free(o)}const i=t.dpr,o=t.createPattern(e,n);o.setTransform&&o.setTransform(new DOMMatrix([1/i,0,0,1/i,0,0])),t.fillStyle=o,t.translate(r.x1,r.y1),t.fillRect(0,0,c,u),t.translate(-r.x1,-r.y1)}}}const sl=new nl;let ol=class{constructor(t){this.subRenderContribitions=t,this.time=Je.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,r,i,n,s,o,a,l,h,c,u,d){this._subRenderContribitions||(this._subRenderContribitions=this.subRenderContribitions.getContributions()),this._subRenderContribitions.forEach((p=>{p.render(t,e,r,i,n,s,o,a,l,h,c,u,d)}))}};ol=el([L(),il(0,B(Y)),il(0,P(ka)),rl("design:paramtypes",[Object])],ol);const al=new class{constructor(){this.time=Je.beforeFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,r,i,n,s,o,a,l,h,c,u,d){var p,f;const{clipConfig:g}=t.attribute;if(!g)return;const m=t.getClipPath();if(!m)return;const y=!(c||u),v=t.AABBBounds,b=null!==(p=t.attribute.width)&&void 0!==p?p:v.width(),_=null!==(f=t.attribute.height)&&void 0!==f?f:v.height();y&&e.save(),e.beginPath(),!1===m.draw(e,[b,_],r+b/2,i+_/2,0)&&e.closePath(),c&&c(e,t.attribute,l,!0),y&&e.clip()}};const ll=new class{constructor(){this.time=Je.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,r,i,n,s,o,a,l,h,c,u,d){const{clipConfig:p}=t.attribute;p&&t.getClipPath()&&(c||u||e.restore())}};class hl{constructor(){this.time=Je.afterFillStroke,this.useStyle=!0,this.order=10,this._tempSymbolGraphic=null}createCommonPattern(t,e,r,i,n){const s=(t-2*e)/2,o=i.dpr,a=an.allocate({width:t,height:t,dpr:o}),l=a.getContext("2d");if(!l)return null;l.inuse=!0,l.clearMatrix(),l.setTransformForCurrent(!0),l.clearRect(0,0,t,t),n(s,l);const h=i.createPattern(a.nativeCanvas,"repeat");return h.setTransform&&h.setTransform(new DOMMatrix([1/o,0,0,1/o,0,0])),an.free(a),h}createCirclePattern(t,e,r,i){return this.createCommonPattern(t,e,r,i,((t,e)=>{e.fillStyle=r,e.arc(t,t,t,0,ne),e.fill()}))}createDiamondPattern(t,e,r,i){return this.createCommonPattern(t,e,r,i,((e,i)=>{const n=t/2,s=n;i.fillStyle=r,i.moveTo(n,s-e),i.lineTo(e+n,s),i.lineTo(n,s+e),i.lineTo(n-e,s),i.closePath(),i.fill()}))}createRectPattern(t,e,r,i){return this.createCommonPattern(t,e,r,i,((t,i)=>{const n=e,s=n;i.fillStyle=r,i.fillRect(n,s,2*t,2*t)}))}createVerticalLinePattern(t,e,r,i){return this.createCommonPattern(t,e,r,i,((i,n)=>{const s=e;n.fillStyle=r,n.fillRect(s,0,2*i,t)}))}createHorizontalLinePattern(t,e,r,i){return this.createCommonPattern(t,e,r,i,((i,n)=>{const s=e;n.fillStyle=r,n.fillRect(0,s,t,2*i)}))}createBiasLRLinePattern(t,e,r,i){return this.createCommonPattern(t,e,r,i,((e,i)=>{i.strokeStyle=r,i.lineWidth=e,i.moveTo(0,0),i.lineTo(t,t);const n=t/2,s=-n;i.moveTo(n,s),i.lineTo(n+t,s+t),i.moveTo(-n,-s),i.lineTo(-n+t,-s+t),i.stroke()}))}createBiasRLLinePattern(t,e,r,i){return this.createCommonPattern(t,e,r,i,((e,i)=>{i.strokeStyle=r,i.lineWidth=e,i.moveTo(t,0),i.lineTo(0,t);const n=t/2,s=n;i.moveTo(t+n,s),i.lineTo(n,s+t),i.moveTo(t-n,-s),i.lineTo(-n,-s+t),i.stroke()}))}createGridPattern(t,e,r,i){return this.createCommonPattern(t,e,r,i,((t,i)=>{const n=e,s=n;i.fillStyle=r,i.fillRect(n,s,t,t),i.fillRect(n+t,s+t,t,t)}))}initTextureMap(t,e){this.textureMap=new Map}drawShape(t,e,r,i,n,s,o,a,l,h,c,u,d){this.textureMap||this.initTextureMap(e,t.stage);const{texture:p=l.texture,textureColor:f=l.textureColor,textureSize:g=l.textureSize,texturePadding:m=l.texturePadding}=t.attribute;p&&this.drawTexture(p,t,e,r,i,l,f,g,m)}drawTexture(t,e,r,i,n,s,o,a,l){var h;const{textureRatio:c=s.textureRatio,textureOptions:u=null}=e.attribute;let d=this.textureMap.get(t);if(!d)switch(t){case"circle":d=this.createCirclePattern(a,l,o,r);break;case"diamond":d=this.createDiamondPattern(a,l,o,r);break;case"rect":d=this.createRectPattern(a,l,o,r);break;case"vertical-line":d=this.createVerticalLinePattern(a,l,o,r);break;case"horizontal-line":d=this.createHorizontalLinePattern(a,l,o,r);break;case"bias-lr":d=this.createBiasLRLinePattern(a,l,o,r);break;case"bias-rl":d=this.createBiasRLLinePattern(a,l,o,r);break;case"grid":d=this.createGridPattern(a,l,o,r)}if(u&&u.dynamicTexture){const{gridConfig:d={},useNewCanvas:p}=u,f=e.AABBBounds;i=f.x1,n=f.y1;const g=r;let m;if(p){m=an.allocate({width:f.width(),height:f.height(),dpr:r.dpr});const t=m.getContext("2d");t.clearRect(0,0,f.width(),f.height()),i=0,n=0,r=t}if(g.save(),e.parent&&!e.transMatrix.onlyTranslate()){const{scrollX:t=0,scrollY:r=0}=e.parent.attribute;g.setTransformFromMatrix(e.parent.globalTransMatrix),g.translate(t,r,!0)}g.setCommonStyle(e,e.attribute,i,n,s),g.clip();const y=f.width(),v=f.height(),b=l,_=a,w=d.columns?d.columns:Math.ceil(y/_),x=d.rows?d.rows:Math.ceil(v/_),S=d.gutterColumn?d.gutterColumn:2*b,T=d.gutterRow?d.gutterRow:2*b;this._tempSymbolGraphic||(this._tempSymbolGraphic=Wa({}));const k=d.columns?y/d.columns:_,C=d.rows?v/d.rows:_;this._tempSymbolGraphic.setAttributes({size:[k-S,C-T],symbolType:t});const E=this._tempSymbolGraphic.getParsedPath();for(let t=0;t<x;t++)for(let s=0;s<w;s++){const a=i+_/2+s*_,l=n+_/2+t*_;null===(h=u.beforeDynamicTexture)||void 0===h||h.call(u,r,t,s,x,w,c,e,f.width(),f.height()),r.beginPath(),!1===E.draw(r,Math.min(k-S,C-T),a,l,0)&&r.closePath(),r.fillStyle=o,u.dynamicTexture(r,t,s,x,w,c,e,f.width(),f.height())}p&&(g.globalAlpha=1,g.drawImage(m.nativeCanvas,0,0,m.nativeCanvas.width,m.nativeCanvas.height,f.x1,f.y1,f.width()*g.dpr,f.height()*g.dpr)),g.restore()}else if(d)r.highPerformanceSave(),r.setCommonStyle(e,e.attribute,i,n,s),r.fillStyle=d,r.fill(),r.highPerformanceRestore();else if("wave"===t){r.save(),r.setCommonStyle(e,e.attribute,i,n,s),r.clip();const t=e.AABBBounds;(function(t,e,r,i,n,s,o){const{fill:a="orange",percent:l=.6,frequency:h=4,opacity:c,phi:u=0}=n;let{amplitude:d=10}=n;d*=function(t){return t<=.5?4*t-1:-4*t+3}(e);const p=i*(1-l),f=r,g=Math.max(Math.round(f/70),2);t.beginPath(),t.moveTo(0+s,i+o),t.lineTo(0+s,p+o);const m=f/h*e,y=f/Math.PI/(2*h);for(let e=0;e<f;e+=g){const r=d*Math.sin((e+m+u)/y+u);t.lineTo(e+s,p+r+o)}t.lineTo(f+s,i+o),t.closePath(),t.fillStyle=a,isFinite(c)&&(t.globalAlpha=c),t.fill()})(r,c,t.width(),t.height(),Object.assign(Object.assign({},u||{}),{fill:o}),i+t.x1-i,n+t.y1-n),r.restore()}}}const cl=new hl;const ul=new class extends nl{constructor(){super(...arguments),this.time=Je.beforeFillStroke}drawShape(t,e,r,i,n,s,o,a,l,h,c,u){const{background:d,backgroundMode:p=l.backgroundMode,backgroundFit:f=l.backgroundFit,backgroundKeepAspectRatio:g=l.backgroundKeepAspectRatio,backgroundScale:m=l.backgroundScale,backgroundOffsetX:y=l.backgroundOffsetX,backgroundOffsetY:v=l.backgroundOffsetY}=t.attribute;if(d)if(t.backgroundImg&&t.resources){const r=t.resources.get(d);if("success"!==r.state||!r.data)return;e.highPerformanceSave(),e.setTransformFromMatrix(t.parent.globalTransMatrix,!0);const i=t.AABBBounds;this.doDrawImage(e,r.data,i,{backgroundMode:p,backgroundFit:f,backgroundKeepAspectRatio:g,backgroundScale:m,backgroundOffsetX:y,backgroundOffsetY:v}),e.highPerformanceRestore(),e.setTransformForCurrent()}else e.highPerformanceSave(),e.fillStyle=d,e.fill(),e.highPerformanceRestore()}},dl=ee/2;function pl(t,e,r,i,n,s,o=!0,a){let l;if(Array.isArray(o)&&(a=o,o=!0),i<0&&(e+=i,i=-i),n<0&&(r+=n,n=-n),Ot(s,!0))l=[s=se(s),s,s,s];else if(Array.isArray(s)){const t=s;let e,r;switch(t.length){case 0:l=[0,0,0,0];break;case 1:e=se(t[0]),l=[e,e,e,e];break;case 2:case 3:e=se(t[0]),r=se(t[1]),l=[e,r,e,r];break;default:l=t,l[0]=se(l[0]),l[1]=se(l[1]),l[2]=se(l[2]),l[3]=se(l[3])}}else l=[0,0,0,0];if(i<0||l[0]+l[1]+l[2]+l[3]<1e-12)return t.rect(e,r,i,n);const[h,c,u,d]=[[e,r],[e+i,r],[e+i,r+n],[e,r+n]],p=Math.min(i/2,n/2),f=[Math.min(p,l[0]),Math.min(p,l[1]),Math.min(p,l[2]),Math.min(p,l[3])],g=[h[0]+f[0],h[1]],m=[h[0],h[1]+f[0]],y=[c[0]-f[1],c[1]],v=[c[0],c[1]+f[1]],b=[u[0]-f[2],u[1]],_=[u[0],u[1]-f[2]],w=[d[0]+f[3],d[1]],x=[d[0],d[1]-f[3]];if(t.moveTo(g[0],g[1]),o){if(a&&a[0]?a[0](g[0],g[1],y[0],y[1]):t.lineTo(y[0],y[1]),!$t(y,v)){a&&a[0]&&t.moveTo(y[0],y[1]);const e=y[0],r=y[1]+f[1];t.arc(e,r,f[1],-dl,0,!1)}if(a&&a[1]?a[1](v[0],v[1],_[0],_[1]):t.lineTo(_[0],_[1]),!$t(b,_)){const e=_[0]-f[2],r=_[1];a&&a[1]&&t.moveTo(_[0],_[1]),t.arc(e,r,f[2],0,dl,!1)}if(a&&a[2]?a[2](b[0],b[1],w[0],w[1]):t.lineTo(w[0],w[1]),!$t(w,x)){const e=w[0],r=w[1]-f[3];a&&a[2]&&t.moveTo(w[0],w[1]),t.arc(e,r,f[3],dl,ee,!1)}if(a&&a[3]?a[3](x[0],x[1],m[0],m[1]):t.lineTo(m[0],m[1]),!$t(g,m)){const e=g[0],r=g[1]+f[0];a&&a[3]&&t.moveTo(m[0],m[1]),t.arc(e,r,f[0],ee,ee+dl,!1)}}else a&&a[0]?a[0](g[0],g[1],y[0],y[1]):t.lineTo(y[0],y[1]),a&&a[1]?a[1](y[0],y[1],b[0],b[1]):t.lineTo(b[0],b[1]),a&&a[2]?a[2](b[0],b[1],w[0],w[1]):t.lineTo(w[0],w[1]),a&&a[2]?a[2](w[0],w[1],g[0],g[1]):t.lineTo(g[0],g[1]);return!a&&t.closePath(),t}var fl=function(t,e,r,i){var n,s=arguments.length,o=s<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,e,r,i);else for(var a=t.length-1;a>=0;a--)(n=t[a])&&(o=(s<3?n(o):s>3?n(e,r,o):n(e,r))||o);return s>3&&o&&Object.defineProperty(e,r,o),o};let gl=class{constructor(){this.time=Je.beforeFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,r,i,n,s,o,a,l,h,c,u,d){const{stroke:p=l.stroke}=t.attribute;Array.isArray(p)&&p.some((t=>!1===t))&&(d.doStroke=!1)}};gl=fl([L()],gl);let ml=class{constructor(){this.time=Je.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,r,i,n,s,o,a,l,h,c,u){const{x1:d,y1:p,x:f=l.x,y:g=l.y,stroke:m=l.stroke,cornerRadius:y=l.cornerRadius,cornerType:v=l.cornerType}=t.attribute;let{width:b,height:_}=t.attribute;if(b=(null!=b?b:d-f)||0,_=(null!=_?_:p-g)||0,Array.isArray(m)&&m.some((t=>!1===t))){if(e.setStrokeStyle(t,t.attribute,r,i,l),!(0===y||Et(y)&&y.every((t=>0===t)))){let n,s=0;return pl(e,r,i,b,_,y,"bevel"!==v,new Array(4).fill(0).map(((o,a)=>(o,h,c,u)=>{m[a]&&(s===a-1&&m[a]===n||(e.setStrokeStyle(t,Object.assign(Object.assign({},t.attribute),{stroke:m[a]}),r,i,l),e.beginPath(),e.moveTo(o,h),n=m[a]),s=a,e.lineTo(c,u),e.stroke(),3===a&&e.beginPath())}))),void e.stroke()}if(e.beginPath(),e.moveTo(r,i),m[0]?e.lineTo(r+b,i):e.moveTo(r+b,i),m[1]?e.lineTo(r+b,i+_):e.moveTo(r+b,i+_),m[2]?e.lineTo(r,i+_):e.moveTo(r,i+_),m[3]){const t=m[0]?i-e.lineWidth/2:i;e.lineTo(r,t)}else e.moveTo(r,i);e.stroke()}}};ml=fl([L()],ml);const yl=new class{constructor(){this.time=Je.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,r,i,n,s,o,a,l,h,c,u){const{outerBorder:d,innerBorder:p}=t.attribute,f=d&&!1!==d.visible,g=p&&!1!==p.visible;if(!f&&!g)return;const{cornerRadius:m=l.cornerRadius,cornerType:y=l.cornerType,opacity:v=l.opacity,x:b=l.x,y:_=l.y,scaleX:w=l.scaleX,scaleY:x=l.scaleY,x1:S,y1:T,keepStrokeScale:k=l.keepStrokeScale}=t.attribute;let{width:C,height:E}=t.attribute;C=(null!=C?C:S-r)||0,E=(null!=E?E:T-i)||0;const A=(n,s)=>{const o=!(!n||!n.stroke),a="outerBorder"===s?-1:1,{distance:h=l[s].distance}=n,c=k?h:yi(e,h,e.dpr),d=r+a*c,p=i+a*c,f=2*c;if(0===m||Et(m)&&m.every((t=>0===t))?(e.beginPath(),e.rect(d,p,C-a*f,E-a*f)):(e.beginPath(),pl(e,d,p,C-a*f,E-a*f,m,"bevel"!==y)),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),u)u(e,n,l[s]);else if(o){const o=l[s].opacity;l[s].opacity=v,e.setStrokeStyle(t,n,(b-r)/w,(_-i)/x,l[s]),l[s].opacity=o,e.stroke()}};f&&A(d,"outerBorder"),g&&A(p,"innerBorder")}},vl=cl,bl=sl;const _l=new class{constructor(){this.time=Je.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,r,i,n,s,o,a,l,h,c,u){const d=t.getParsedPath();if(!d)return;const{outerBorder:p,innerBorder:f}=t.attribute,g=p&&!1!==p.visible,m=f&&!1!==f.visible;if(!g&&!m)return;const{size:y=l.size,opacity:v=l.opacity,x:b=l.x,y:_=l.y,scaleX:w=l.scaleX,scaleY:x=l.scaleY,keepStrokeScale:S=l.keepStrokeScale}=t.attribute,T=(n,s)=>{const o=!(!n||!n.stroke),{distance:a=l[s].distance}=n,h=S?a:yi(e,a,e.dpr),c="outerBorder"===s?1:-1;if(e.beginPath(),!1===d.drawOffset(e,y,r,i,c*h)&&e.closePath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),u)u(e,n,l[s]);else if(o){const o=l[s].opacity;l[s].opacity=v,e.setStrokeStyle(t,n,(b-r)/w,(_-i)/x,l[s]),l[s].opacity=o,e.stroke()}};g&&T(p,"outerBorder"),m&&T(f,"innerBorder")}},wl=new class{constructor(){this.time=Je.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,r,i,n,s,o,a,l,h,c,u,d){const{clipRange:p=l.clipRange,x:f=l.x,y:g=l.y,z:m=l.z,size:y=l.size,scaleX:v=l.scaleX,scaleY:b=l.scaleY}=t.attribute,_=t.getParsedPath();_&&p<1&&p>0&&(e.beginPath(),_.drawWithClipRange&&_.drawWithClipRange(e,y,r,i,p,m,((n,s)=>{var o,h,c,d;if(t._parsedPath.svgCache){const e=Object.assign({},s);e.fill=null!==(o=s.fill)&&void 0!==o?o:t.attribute.fill,e.opacity=null!==(h=s.opacity)&&void 0!==h?h:t.attribute.opacity,e.fillOpacity=t.attribute.fillOpacity,e.stroke=null!==(c=s.stroke)&&void 0!==c?c:t.attribute.stroke,e.lineWidth=null!==(d=s.lineWidth)&&void 0!==d?d:t.attribute.lineWidth,s=e}s.stroke&&(u?u(e,t.attribute,l):a&&(e.setStrokeStyle(t,s,(f-r)/v,(g-i)/b,l),e.stroke()))})),s&&!_.isSvg&&(u?u(e,t.attribute,l):a&&(e.setStrokeStyle(t,t.attribute,(f-r)/v,(g-i)/b,l),e.stroke())))}},xl=cl,Sl=sl;const Tl={x:0,y:0,z:0,lastModelMatrix:null};class kl{init(t){t&&(this._renderContribitions=t.getContributions()),this._renderContribitions||(this._renderContribitions=[]),this.builtinContributions||(this.builtinContributions=[]),this.builtinContributions.push(al),this.builtinContributions.push(ll),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===Je.beforeFillStroke)),this._afterRenderContribitions=this._renderContribitions.filter((t=>t.time===Je.afterFillStroke)))}reInit(){this.init(this.graphicRenderContributions)}beforeRenderStep(t,e,r,i,n,s,o,a,l,h,c,u,d){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,r,i,n,s,o,a,l,h,c,u,d)}))}afterRenderStep(t,e,r,i,n,s,o,a,l,h,c,u,d){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,r,i,n,s,o,a,l,h,c,u,d)}))}drawPathProxy(t,e,r,i,n,s,o,a){if(!t.pathProxy)return!1;const l=Cn(t,null==s?void 0:s.theme)[t.type.replace("3d","")],{fill:h=l.fill,stroke:c=l.stroke,opacity:u=l.opacity,fillOpacity:d=l.fillOpacity,lineWidth:p=l.lineWidth,strokeOpacity:f=l.strokeOpacity,visible:g=l.visible,x:m=l.x,y:y=l.y}=t.attribute,v=ma(u,d,h),b=va(u,f),_=fa(h),w=ga(c,p);if(!g)return!0;if(!_&&!w)return!0;if(!(v||b||o||a))return!0;e.beginPath();return ir(("function"==typeof t.pathProxy?t.pathProxy(t.attribute):t.pathProxy).commandList,e,r,i),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,r,i,_,w,v,b,l,n,o,a),w&&(a?a(e,t.attribute,l):b&&(e.setStrokeStyle(t,t.attribute,r-m,i-y,l),e.stroke())),_&&(o?o(e,t.attribute,l):v&&(e.setCommonStyle(t,t.attribute,r-m,i-y,l),e.fill())),this.afterRenderStep(t,e,r,i,_,w,v,b,l,n,o,a),!0}valid(t,e,r,i){const{fill:n=e.fill,background:s,stroke:o=e.stroke,opacity:a=e.opacity,fillOpacity:l=e.fillOpacity,lineWidth:h=e.lineWidth,strokeOpacity:c=e.strokeOpacity,visible:u=e.visible}=t.attribute,d=ma(a,l,n),p=va(a,c),f=fa(n,s),g=ga(o,h);return!(!t.valid||!u)&&!(!f&&!g)&&!!(d||p||r||i||s)&&{fVisible:d,sVisible:p,doFill:f,doStroke:g}}transform(t,e,r,i=!1){const{x:n=e.x,y:s=e.y,z:o=e.z,scaleX:a=e.scaleX,scaleY:l=e.scaleY,angle:h=e.angle,postMatrix:c}=t.attribute,u=r.modelMatrix,d=r.camera;Tl.x=n,Tl.y=s,Tl.z=o,Tl.lastModelMatrix=u;const p=d&&(i||function(t){const{alpha:e,beta:r}=t.attribute;return e||r}(t)),f=p?t.transMatrix.onlyTranslate()&&!c:1===a&&1===l&&0===h&&!c;if(p){const i=Fo.allocate(),n=Fo.allocate();Ra(n,t,e),Mo(i,u||i,n),Tl.x=0,Tl.y=0,Tl.z=0,r.modelMatrix=i,r.setTransform(1,0,0,1,0,0,!0),Fo.free(n)}if(f&&!u){const i=t.getOffsetXY(e);Tl.x+=i.x,Tl.y+=i.y,Tl.z=o,r.setTransformForCurrent()}else if(p)Tl.x=0,Tl.y=0,Tl.z=0,r.setTransform(1,0,0,1,0,0,!0);else if(d&&r.project){const i=t.getOffsetXY(e);Tl.x+=i.x,Tl.y+=i.y,this.transformWithoutTranslate(r,Tl.x,Tl.y,Tl.z,a,l,h)}else r.transformFromMatrix(t.transMatrix,!0),Tl.x=0,Tl.y=0,Tl.z=0;return Tl}transformUseContext2d(t,e,r,i){const n=i.camera;if(this.camera=n,n){const e=t.AABBBounds,n=e.x2-e.x1,s=e.y2-e.y1,o=i.project(0,0,r),a=i.project(n,0,r),l=i.project(n,s,r),h={x:0,y:0},c={x:n,y:0},u={x:n,y:s};i.camera=null;const d=1/(h.x*(u.y-c.y)-c.x*u.y+u.x*c.y+(c.x-u.x)*h.y),p=-(h.y*(l.x-a.x)-c.y*l.x+u.y*a.x+(c.y-u.y)*o.x)*d,f=(c.y*l.y+h.y*(a.y-l.y)-u.y*a.y+(u.y-c.y)*o.y)*d,g=(h.x*(l.x-a.x)-c.x*l.x+u.x*a.x+(c.x-u.x)*o.x)*d,m=-(c.x*l.y+h.x*(a.y-l.y)-u.x*a.y+(u.x-c.x)*o.y)*d,y=(h.x*(u.y*a.x-c.y*l.x)+h.y*(c.x*l.x-u.x*a.x)+(u.x*c.y-c.x*u.y)*o.x)*d,v=(h.x*(u.y*a.y-c.y*l.y)+h.y*(c.x*l.y-u.x*a.y)+(u.x*c.y-c.x*u.y)*o.y)*d;i.setTransform(p,f,g,m,y,v,!0)}}restoreTransformUseContext2d(t,e,r,i){this.camera&&(i.camera=this.camera)}transformWithoutTranslate(t,e,r,i,n,s,o){const a=t.project(e,r,i);t.translate(a.x,a.y,!1),t.scale(n,s,!1),t.rotate(o,!1),t.translate(-a.x,-a.y,!1),t.setTransformForCurrent()}_draw(t,e,r,i,n,s){const{context:o}=i;if(!o)return;const{renderable:a}=t.attribute;if(!1===a)return;o.highPerformanceSave();const l=this.transform(t,e,o,r),{x:h,y:c,z:u,lastModelMatrix:d}=l;this.z=u,this.drawPathProxy(t,o,h,c,i,n)||(this.drawShape(t,o,h,c,i,n,null,null,s),this.z=0,o.modelMatrix!==d&&Fo.free(o.modelMatrix),o.modelMatrix=d),o.highPerformanceRestore()}}function Cl(t,e,r,i){if(!e.p1)return;const{offsetX:n=0,offsetY:s=0,offsetZ:o=0}=i||{};if(1===r)e.p2&&e.p3?t.bezierCurveTo(n+e.p1.x,s+e.p1.y,n+e.p2.x,s+e.p2.y,n+e.p3.x,s+e.p3.y,o):t.lineTo(n+e.p1.x,s+e.p1.y,o);else if(e.p2&&e.p3){const[i]=cr(e,r);t.bezierCurveTo(n+i.p1.x,s+i.p1.y,n+i.p2.x,s+i.p2.y,n+i.p3.x,s+i.p3.y,o)}else{const i=e.getPointAt(r);t.lineTo(n+i.x,s+i.y,o)}}function El(t,e,r,i,n,s,o){var a;let l=e.p0,h=i;if(r&&r.originP1===r.originP2&&(l=r.p0),e.defined)i||(t.lineTo(l.x+n,l.y+s,o),h=!i);else{const{originP1:c,originP2:u}=e;let d;if(c&&!1!==c.defined&&!r?d=l:c&&!1!==u.defined&&(d=null!==(a=e.p3)&&void 0!==a?a:e.p1),i){h=!i;const r=d?d.x:e.p0.x,a=d?d.y:e.p0.y;t.moveTo(r+n,a+s,o)}else d&&(h=!i,t.lineTo(d.x+n,d.y+s,o))}return h}function Al(t,e,r,i,n){const{offsetX:s=0,offsetY:o=0,offsetZ:a=0,mode:l="none",drawConnect:h=!1}=n||{};if(h&&"none"===l)return;if(!e)return;let c=!0;const{curves:u}=e;if(r>=1){if(h){let e,r=!0;u.forEach(((i,n)=>{i.originP1!==i.originP2?(r=El(t,i,e,r,s,o,a),e=i):e=i}))}else u.forEach((e=>{e.defined?(c&&t.moveTo(e.p0.x+s,e.p0.y+o,a),Cl(t,e,1,n),c=!1):c=!0}));return}if(r<=0)return;let d;"x"===i?d=Ke.ROW:"y"===i?d=Ke.COLUMN:"auto"===i&&(d=e.direction);const p=r*e.tryUpdateLength(d);let f=0,g=!0,m=null;for(let e=0,r=u.length;e<r;e++){const r=u[e],i=r.getLength(d),l=(p-f)/i;if(f+=i,l<0)break;if(h){if(r.originP1===r.originP2){m=r;continue}g=El(t,r,m,g,s,o,a),m=r}else{if(!r.defined){c=!0;continue}c&&t.moveTo(r.p0.x+s,r.p0.y+o,a),Cl(t,r,he(l,1),n),c=!1}}}var Ol=function(t,e,r,i){var n,s=arguments.length,o=s<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,e,r,i);else for(var a=t.length-1;a>=0;a--)(n=t[a])&&(o=(s<3?n(o):s>3?n(e,r,o):n(e,r))||o);return s>3&&o&&Object.defineProperty(e,r,o),o};let Bl=class extends kl{constructor(){super(...arguments),this.numberType=So}draw(t,e,r,i){const n=Cn(t,null==i?void 0:i.theme).line;this._draw(t,n,!1,r,i)}drawSegmentItem(t,e,r,i,n,s,o,a,l,h,c,u,d,p,f){var g;if(!e)return;t.beginPath();Al(t,e,l,h,{offsetX:c,offsetY:u,offsetZ:null!==(g=this.z)&&void 0!==g?g:0}),d.cache&&!Et(d.cache)&&d.cache.curves.every((t=>t.defined))&&d.attribute.curveType&&d.attribute.curveType.includes("Closed")&&t.closePath(),t.setShadowBlendStyle&&t.setShadowBlendStyle(d,o,a);const{x:m=0,x:y=0}=o;return!1!==r&&(p?p(t,o,a):n&&(t.setCommonStyle(d,o,m-c,y-u,a),t.fill())),!1!==i&&(f?f(t,o,a):s&&(t.setStrokeStyle(d,o,m-c,y-u,a),t.stroke())),!1}drawLinearLineHighPerformance(t,e,r,i,n,s,o,a,l,h,c,u,d){var p;e.beginPath();const f=null!==(p=this.z)&&void 0!==p?p:0,{points:g}=t.attribute,m=g[0];e.moveTo(m.x+o,m.y+a,f);for(let t=1;t<g.length;t++){const r=g[t];e.lineTo(r.x+o,r.y+a,f)}e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l);const{x:y=0,x:v=0}=t.attribute;!1!==r&&(u?u(e,t.attribute,l):n&&(e.setCommonStyle(t,t.attribute,y-o,v-a,l),e.fill())),!1!==i&&(d?d(e,t.attribute,l):s&&(e.setStrokeStyle(t,t.attribute,y-o,v-a,l),e.stroke()))}drawShape(t,e,r,i,n,s,o,a){const l=Cn(t,null==s?void 0:s.theme).line,{fill:h=l.fill,stroke:c=l.stroke,fillOpacity:u=l.fillOpacity,strokeOpacity:d=l.strokeOpacity,segments:p,points:f,closePath:g,curveTension:m=l.curveTension,connectedType:y=l.connectedType}=t.attribute;if(!this.valid(t,l,o,a))return;let{curveType:v=l.curveType}=t.attribute;g&&"linear"===v&&(v="linearClosed");const{clipRange:b=l.clipRange,clipRangeByDimension:_=l.clipRangeByDimension}=t.attribute;if(1===b&&!p&&!f.some((t=>!1===t.defined))&&"linear"===v)return this.drawLinearLineHighPerformance(t,e,!!h,!!c,u,d,r,i,l,n,s,o,a);function w(t,e){return"none"===e?t:t.filter((t=>!1!==t.defined))}if(t.shouldUpdateShape()){const{points:e,segments:r}=t.attribute,i=e;if(r&&r.length){let e,i;if(t.cache=r.map(((t,r)=>{if(t.points.length<=1&&0===r)return t.points[0]&&(i={endX:t.points[0].x,endY:t.points[0].y,curves:[{defined:!1!==t.points[0].defined}]}),null;1===r?e={x:i.endX,y:i.endY,defined:i.curves[i.curves.length-1].defined}:r>1&&(e.x=i.endX,e.y=i.endY,e.defined=i.curves[i.curves.length-1].defined);const n=Ur(w(t.points,y),v,{startPoint:e,curveTension:m});return i=n,n})).filter((t=>!!t)),"linearClosed"===v){let e;for(let r=0;r<t.cache.length;r++){const i=t.cache[r];for(let t=0;t<i.curves.length;t++)if(i.curves[t].defined){e=i.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=Ur(w(i,y),v,{curveTension:m})}t.clearUpdateShapeTag()}if(Array.isArray(t.cache)){const n=t.attribute.segments.filter((t=>t.points.length));if(1===n[0].points.length&&n.shift(),1===b){let s=!1;t.cache.forEach(((p,f)=>{s||(s=this.drawSegmentItem(e,p,!!h,!!c,u,d,n[f],[l,t.attribute],b,_,r,i,t,o,a))}))}else{const s=t.cache.reduce(((t,e)=>t+e.getLength()),0),p=b*s;let f=0,g=!1;t.cache.forEach(((s,m)=>{if(g)return;const y=s.getLength(),v=(p-f)/y;f+=y,v>0&&(g=this.drawSegmentItem(e,s,!!h,!!c,u,d,n[m],[l,t.attribute],he(v,1),_,r,i,t,o,a))}))}}else this.drawSegmentItem(e,t.cache,!!h,!!c,u,d,t.attribute,l,b,_,r,i,t,o,a)}};function Rl(t,e,r,i){const{offsetX:n=0,offsetY:s=0,offsetZ:o=0}=i||{};let a=!0;e.forEach((e=>{e.defined?(a&&t.moveTo(e.p0.x+n,e.p0.y+s,o),Cl(t,e,1,i),a=!1):a=!0})),a=!0;for(let e=r.length-1;e>=0;e--){const l=r[e];l.defined?(a&&t.lineTo(l.p0.x+n,l.p0.y+s,o),Cl(t,l,1,i),a=!1):a=!0}t.closePath()}Bl=Ol([L()],Bl);const Ll=new class extends hl{constructor(){super(...arguments),this.time=Je.afterFillStroke}drawShape(t,e,r,i,n,s,o,a,l,h,c,u,d){var p,f,g,m;this.textureMap||this.initTextureMap(e,t.stage);const{attribute:y=t.attribute}=d||{},{texture:v=(null!==(p=t.attribute.texture)&&void 0!==p?p:Xn(l,"texture")),textureColor:b=(null!==(f=t.attribute.textureColor)&&void 0!==f?f:Xn(l,"textureColor")),textureSize:_=(null!==(g=t.attribute.textureSize)&&void 0!==g?g:Xn(l,"textureSize")),texturePadding:w=(null!==(m=t.attribute.texturePadding)&&void 0!==m?m:Xn(l,"texturePadding"))}=y;v&&this.drawTexture(v,t,e,r,i,l,b,_,w)}},Pl=sl;var Dl=function(t,e,r,i){var n,s=arguments.length,o=s<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,e,r,i);else for(var a=t.length-1;a>=0;a--)(n=t[a])&&(o=(s<3?n(o):s>3?n(e,r,o):n(e,r))||o);return s>3&&o&&Object.defineProperty(e,r,o),o},Ml=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Il=function(t,e){return function(r,i){e(r,i,t)}};let Nl=class extends kl{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=bo,this.builtinContributions=[Ll,Pl],this.init(t)}drawLinearAreaHighPerformance(t,e,r,i,n,s,o,a,l,h,c,u,d){var p,f,g;const{points:m}=t.attribute;if(m.length<2)return;e.beginPath();const y=null!==(p=this.z)&&void 0!==p?p:0,v=m[0];e.moveTo(v.x+o,v.y+a,y);for(let t=1;t<m.length;t++){const r=m[t];e.lineTo(r.x+o,r.y+a,y)}for(let t=m.length-1;t>=0;t--){const r=m[t];e.lineTo((null!==(f=r.x1)&&void 0!==f?f:r.x)+o,(null!==(g=r.y1)&&void 0!==g?g:r.y)+a,y)}e.closePath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,o,a,!!n,!1,r,!1,l,h,u,null,{attribute:t.attribute});const{x:b=0,x:_=0}=t.attribute;!1!==r&&(u?u(e,t.attribute,l):n&&(e.setCommonStyle(t,t.attribute,b-o,_-a,l),e.fill())),this.afterRenderStep(t,e,o,a,!!n,!1,r,!1,l,h,u,null,{attribute:t.attribute}),(()=>{var r,n;if(i){const{stroke:i=l&&l.stroke}=t.attribute;if(Et(i)&&(i[0]||i[2])&&!1===i[1])if(e.beginPath(),i[0]){e.moveTo(v.x+o,v.y+a,y);for(let t=1;t<m.length;t++){const r=m[t];e.lineTo(r.x+o,r.y+a,y)}}else if(i[2]){const t=m[m.length-1];e.moveTo(t.x+o,t.y+a,y);for(let t=m.length-2;t>=0;t--){const i=m[t];e.lineTo((null!==(r=i.x1)&&void 0!==r?r:i.x)+o,(null!==(n=i.y1)&&void 0!==n?n:i.y)+a,y)}}d?d(e,t.attribute,l):(e.setStrokeStyle(t,t.attribute,b-o,_-a,l),e.stroke())}})()}drawShape(t,e,r,i,n,s,o,a){var l,h,c,u,d,p;const f=Cn(t,null==s?void 0:s.theme).area,{fill:g=f.fill,stroke:m=f.stroke,fillOpacity:y=f.fillOpacity,z:v=f.z,strokeOpacity:b=f.strokeOpacity,curveTension:_=f.curveTension,connectedType:w=f.connectedType}=t.attribute,x=this.valid(t,f,o,a);if(!x)return;const{doFill:S}=x,T=x.doStroke&&x.sVisible,{clipRange:k=f.clipRange,closePath:C,points:E,segments:A}=t.attribute;let{curveType:O=f.curveType}=t.attribute;function B(t,e){return"connect"!==e?t:t.filter((t=>!1!==t.defined))}if(C&&"linear"===O&&(O="linearClosed"),1===k&&!A&&!E.some((t=>!1===t.defined))&&"linear"===O)return this.drawLinearAreaHighPerformance(t,e,!!g,T,y,b,r,i,f,n,s,o,a);if(t.shouldUpdateShape()){if(A&&A.length){let e,r;const i=A.map(((t,i)=>{if(t.points.length<=1&&0===i)return t.points[0]&&(r={endX:t.points[0].x,endY:t.points[0].y}),null;1===i?e={x:r.endX,y:r.endY}:i>1&&(e.x=r.endX,e.y=r.endY);const n=Ur(B(t.points,w),O,{startPoint:e,curveTension:_});return r=n,n})).filter((t=>!!t));let n;const s=[];for(let t=A.length-1;t>=0;t--){const e=A[t].points,r=[];for(let t=e.length-1;t>=0;t--)r.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=A[t-1].points,i=e[e.length-1];i&&r.push({x:null!==(c=i.x1)&&void 0!==c?c:i.x,y:null!==(u=i.y1)&&void 0!==u?u:i.y})}r.length>1&&(n=Ur(B(r,w),"stepBefore"===O?"stepAfter":"stepAfter"===O?"stepBefore":O,{curveTension:_}),s.unshift(n))}t.cacheArea=s.map(((t,e)=>({top:i[e],bottom:t})))}else{if(!E||!E.length)return t.cacheArea=null,void t.clearUpdateShapeTag();{const e=B(E,w),r=[];for(let t=e.length-1;t>=0;t--)r.push({x:null!==(d=e[t].x1)&&void 0!==d?d:e[t].x,y:null!==(p=e[t].y1)&&void 0!==p?p:e[t].y});const i=Ur(e,O,{curveTension:_}),n=Ur(r,"stepBefore"===O?"stepAfter":"stepAfter"===O?"stepBefore":O,{curveTension:_});t.cacheArea={top:i,bottom:n}}}t.clearUpdateShapeTag()}if(Array.isArray(t.cacheArea)){const s=t.attribute.segments.filter((t=>t.points.length));if(1===s[0].points.length&&s.shift(),1===k){let l=!1;t.cacheArea.forEach(((h,c)=>{l||(l=this.drawSegmentItem(e,h,S,y,T,b,s[c],[f,t.attribute],k,r,i,v,t,n,o,a))}))}else{const l=t.cacheArea.reduce(((t,e)=>t+e.top.getLength()),0),h=k*l;let c=0,u=!1;t.cacheArea.forEach(((l,d)=>{if(u)return;const p=l.top.getLength(),g=(h-c)/p;c+=p,g>0&&(u=this.drawSegmentItem(e,l,S,y,T,b,s[d],[f,t.attribute],he(g,1),r,i,v,t,n,o,a))}))}}else this.drawSegmentItem(e,t.cacheArea,S,y,T,b,t.attribute,f,k,r,i,v,t,n,o,a)}draw(t,e,r,i){const n=Cn(t,null==i?void 0:i.theme).area;this._draw(t,n,!1,r,i)}drawSegmentItem(t,e,r,i,n,s,o,a,l,h,c,u,d,p,f,g){return this._drawSegmentItem(t,e,r,i,n,s,o,a,l,h,c,u,d,p,f,g)}_drawSegmentItem(t,e,r,i,n,s,o,a,l,h,c,u,d,p,f,g){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:m,segments:y}=d.attribute;let v,b,_=Ke.ROW;if(y){const t=y[y.length-1];b=y[0].points[0],v=t.points[t.points.length-1]}else b=m[0],v=m[m.length-1];const w=se(v.x-b.x),x=se(v.y-b.y);_=null==v.x1?Ke.ROW:null==v.y1?Ke.COLUMN:Number.isFinite(w+x)?w>x?Ke.ROW:Ke.COLUMN:Ke.ROW,function(t,e,r,i){var n;const{top:s,bottom:o}=e;if(s.curves.length!==o.curves.length)return;if(r>=1){const e=[],r=[];let n=!0;for(let a=0,l=s.curves.length;a<l;a++){const h=s.curves[a];n!==h.defined?(n?(Rl(t,e,r,i),e.length=0,r.length=0):(e.push(h),r.push(o.curves[l-a-1])),n=!n):n&&(e.push(h),r.push(o.curves[l-a-1]))}return void Rl(t,e,r,i)}if(r<=0)return;let{direction:a}=i||{};const{curves:l}=s,h=null!==(n=l[l.length-1].p3)&&void 0!==n?n:l[l.length-1].p1,c=se(h.x-l[0].p0.x),u=se(h.y-l[0].p0.y);a=null!=a?a:c>u?Ke.ROW:Ke.COLUMN,Number.isFinite(c)||(a=Ke.COLUMN),Number.isFinite(u)||(a=Ke.ROW);const d=r*(a===Ke.ROW?c:u);let p=0,f=!0;const g=[],m=[];for(let e=0,r=s.curves.length;e<r;e++){const n=s.curves[e],l=n.getLength(a),h=(d-p)/l;if(h<0)break;p+=l;let c=null,u=null;f!==n.defined?(f?(Rl(t,g,m,i),g.length=0,m.length=0):(c=n,u=o.curves[r-e-1]),f=!f):f&&(c=n,u=o.curves[r-e-1]),c&&u&&(h<1&&(c=c.p2&&c.p3?cr(c,h)[0]:dr(c,h)[0],u=u.p2&&u.p3?cr(u,1-h)[1]:dr(u,1-h)[1]),c.defined=f,u.defined=f,g.push(c),m.push(u)),c=null,u=null}Rl(t,g,m,i)}(t,e,l,{offsetX:h,offsetY:c,offsetZ:u,direction:_}),this.beforeRenderStep(d,t,h,c,!!i,!1,r,!1,a,p,f,null,{attribute:o}),t.setShadowBlendStyle&&t.setShadowBlendStyle(d,o,a);const{x:S=0,x:T=0}=o;return!1!==r&&(f?f(t,o,a):i&&(t.setCommonStyle(d,o,S-h,T-c,a),t.fill())),this.afterRenderStep(d,t,h,c,!!i,!1,r,!1,a,p,f,null,{attribute:o}),(()=>{if(!1!==n)if(g)g(t,o,a);else{const{stroke:r=a&&a[1]&&a[1].stroke}=o;Et(r)&&(r[0]||r[2])&&!1===r[1]&&(t.beginPath(),Al(t,r[0]?e.top:e.bottom,l,_===Ke.ROW?"x":"y",{offsetX:h,offsetY:c,offsetZ:u})),t.setStrokeStyle(d,o,S-h,T-c,a),t.stroke()}})(),!1}};Nl=Dl([L(),Il(0,B(Y)),Il(0,P(_a)),Ml("design:paramtypes",[Object])],Nl);var Fl=function(t,e,r,i){var n,s=arguments.length,o=s<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,e,r,i);else for(var a=t.length-1;a>=0;a--)(n=t[a])&&(o=(s<3?n(o):s>3?n(e,r,o):n(e,r))||o);return s>3&&o&&Object.defineProperty(e,r,o),o},jl=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},zl=function(t,e){return function(r,i){e(r,i,t)}};let Hl=class extends kl{constructor(t){super(),this.graphicRenderContributions=t,this.type="rect",this.numberType=ko,this.builtinContributions=[yl,bl,vl],this.init(t)}drawShape(t,e,r,i,n,s,o,a,l){l=null!=l?l:Cn(t,null==s?void 0:s.theme).rect;const{fill:h=l.fill,background:c,stroke:u=l.stroke,cornerRadius:d=l.cornerRadius,cornerType:p=l.cornerType,opacity:f=l.opacity,fillOpacity:g=l.fillOpacity,lineWidth:m=l.lineWidth,strokeOpacity:y=l.strokeOpacity,visible:v=l.visible,x1:b,y1:_,x:w=l.x,y:x=l.y,fillStrokeOrder:S=l.fillStrokeOrder}=t.attribute;let{width:T,height:k}=t.attribute;T=(null!=T?T:b-w)||0,k=(null!=k?k:_-x)||0;const C=ya(f,g,T,k,h),E=ba(f,y,T,k),A=fa(h,c),O=ga(u,m);if(!t.valid||!v)return;if(!A&&!O)return;if(!(C||E||o||a||c))return;0===d||Et(d)&&d.every((t=>0===t))?(e.beginPath(),e.rect(r,i,T,k)):(e.beginPath(),pl(e,r,i,T,k,d,"bevel"!==p));const B={doFill:A,doStroke:O};e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,r,i,A,O,C,E,l,n,o,a,B),S?(this._runStroke(t,e,r,i,l,B,E,w,x,a),this._runFill(t,e,r,i,l,B,C,w,x,o)):(this._runFill(t,e,r,i,l,B,C,w,x,o),this._runStroke(t,e,r,i,l,B,E,w,x,a)),this.afterRenderStep(t,e,r,i,A,O,C,E,l,n,o,a)}_runFill(t,e,r,i,n,s,o,a,l,h){s.doFill&&(h?h(e,t.attribute,n):o&&(e.setCommonStyle(t,t.attribute,a-r,l-i,n),e.fill()))}_runStroke(t,e,r,i,n,s,o,a,l,h){s.doStroke&&(h?h(e,t.attribute,n):o&&(e.setStrokeStyle(t,t.attribute,a-r,l-i,n),e.stroke()))}draw(t,e,r,i){const n=Cn(t,null==i?void 0:i.theme).rect;this._draw(t,n,!1,r,i,n)}};Hl=Fl([L(),zl(0,B(Y)),zl(0,P(xa)),jl("design:paramtypes",[Object])],Hl);var Wl=function(t,e,r,i){var n,s=arguments.length,o=s<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,e,r,i);else for(var a=t.length-1;a>=0;a--)(n=t[a])&&(o=(s<3?n(o):s>3?n(e,r,o):n(e,r))||o);return s>3&&o&&Object.defineProperty(e,r,o),o},Ul=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},$l=function(t,e){return function(r,i){e(r,i,t)}};let Vl=class extends kl{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=Co,this.builtinContributions=[_l,Sl,xl,wl],this.init(t)}drawShape(t,e,r,i,n,s,o,a,l){var h;l=null!=l?l:Cn(t,null==s?void 0:s.theme).symbol;const{size:c=l.size,x:u=l.x,y:d=l.y,scaleX:p=l.scaleX,scaleY:f=l.scaleY,fillStrokeOrder:g=l.fillStrokeOrder,clipRange:m=l.clipRange}=t.attribute,y=this.valid(t,l,o,a);if(!y)return;const{fVisible:v,sVisible:b,doFill:_,doStroke:w}=y,x=t.getParsedPath();if(!x)return;const{keepDirIn3d:S=l.keepDirIn3d}=t.attribute,T=null!==(h=this.z)&&void 0!==h?h:0;e.beginPath();let k=r,C=i,E=T;const A=e.camera;if(S&&A&&e.project){const t=e.project(r,i,T);e.camera=null,Et(c)&&(c[0],c[1]),k=t.x,C=t.y,E=void 0}!1===x.draw(e,c,k,C,E,((n,s)=>{var h,c,y,v;if(t._parsedPath.svgCache){const e=Object.assign({},s);e.fill=null!==(h=s.fill)&&void 0!==h?h:t.attribute.fill,e.opacity=null!==(c=s.opacity)&&void 0!==c?c:t.attribute.opacity,e.fillOpacity=t.attribute.fillOpacity,e.stroke=null!==(y=s.stroke)&&void 0!==y?y:t.attribute.stroke,e.lineWidth=null!==(v=s.lineWidth)&&void 0!==v?v:t.attribute.lineWidth,s=e}const _=()=>{s.fill&&(o?o(e,t.attribute,l):(e.setCommonStyle(t,s,u-r,d-i,l),e.fill()))},w=()=>{s.stroke&&(a?a(e,t.attribute,l):b&&m>=1&&(e.setStrokeStyle(t,s,(u-r)/p,(d-i)/f,l),e.stroke()))};g?(w(),_()):(_(),w())}))&&e.closePath(),e.camera=A,e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,r,i,_,w,v,b,l,n,o,a),g?(this._runStroke(t,e,r,i,l,w,b,u,d,x,m,p,f,a),this._runFill(t,e,r,i,l,_,v,u,d,x,o)):(this._runFill(t,e,r,i,l,_,v,u,d,x,o),this._runStroke(t,e,r,i,l,w,b,u,d,x,m,p,f,a)),this.afterRenderStep(t,e,r,i,_,w,v,b,l,n,o,a)}_runFill(t,e,r,i,n,s,o,a,l,h,c){s&&!h.isSvg&&(c?c(e,t.attribute,n):o&&(e.setCommonStyle(t,t.attribute,a-r,l-i,n),e.fill()))}_runStroke(t,e,r,i,n,s,o,a,l,h,c,u,d,p){s&&!h.isSvg&&(p?p(e,t.attribute,n):o&&c>=1&&(e.setStrokeStyle(t,t.attribute,(a-r)/u,(l-i)/d,n),e.stroke()))}draw(t,e,r,i){const n=Cn(t,null==i?void 0:i.theme).symbol;this._draw(t,n,!1,r,i)}};Vl=Wl([L(),$l(0,B(Y)),$l(0,P(Sa)),Ul("design:paramtypes",[Object])],Vl);const Gl=new class{constructor(){this.pools=[];for(let t=0;t<10;t++)this.pools.push(new Le)}allocate(t,e,r,i){if(!this.pools.length)return(new Le).setValue(t,e,r,i);const n=this.pools.pop();return n.x1=t,n.y1=e,n.x2=r,n.y2=i,n}allocateByObj(t){if(!this.pools.length)return new Le(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(...t){this.pools=[]}};const Xl=new class extends nl{constructor(){super(...arguments),this.time=Je.beforeFillStroke}drawShape(t,e,r,i,n,s,o,a,l,h,c,u){var d,p,f,g,m,y,v,b,_,w;const{backgroundMode:x=l.backgroundMode,backgroundFit:S=l.backgroundFit,backgroundKeepAspectRatio:T=l.backgroundKeepAspectRatio}=t.attribute;let k,{background:C}=t.attribute;if(!C)return;const E=()=>{"richtext"===t.type&&(e.restore(),e.save(),k&&e.setTransformFromMatrix(k,!0,1))};let A;"richtext"===t.type&&(k=e.currentMatrix.clone(),e.restore(),e.save(),e.setTransformForCurrent());const O=xt(C)&&C.background,B=t.transMatrix.onlyTranslate();if(O){const e=t.AABBBounds,r=(null!==(d=C.x)&&void 0!==d?d:e.x1)+(null!==(p=C.dx)&&void 0!==p?p:0),i=(null!==(f=C.y)&&void 0!==f?f:e.y1)+(null!==(g=C.dy)&&void 0!==g?g:0),n=null!==(m=C.width)&&void 0!==m?m:e.width(),s=null!==(y=C.height)&&void 0!==y?y:e.height();if(A=Gl.allocate(r,i,r+n,i+s),C=C.background,!B){const t=A.width(),e=A.height();A.set((null!==(v=C.x)&&void 0!==v?v:0)+(null!==(b=C.dx)&&void 0!==b?b:0),(null!==(_=C.y)&&void 0!==_?_:0)+(null!==(w=C.dy)&&void 0!==w?w:0),t,e)}}else A=t.AABBBounds,B||(A=(R=Object.assign(Object.assign({},t.attribute),{angle:0,scaleX:1,scaleY:1,x:0,y:0,dx:0,dy:0}),tl||(tl=Ja.CreateGraphic("text",{})),tl.initAttributes(R),tl.AABBBounds).clone());var R;if(t.backgroundImg&&t.resources){const n=t.resources.get(C);if("success"!==n.state||!n.data)return void E();e.highPerformanceSave(),B&&e.setTransformFromMatrix(t.parent.globalTransMatrix,!0),e.setCommonStyle(t,t.attribute,r,i,l),this.doDrawImage(e,n.data,A,{backgroundMode:x,backgroundFit:S,backgroundKeepAspectRatio:T}),e.highPerformanceRestore(),e.setTransformForCurrent()}else{const{backgroundCornerRadius:n}=t.attribute;e.highPerformanceSave(),e.setCommonStyle(t,t.attribute,r,i,l),e.fillStyle=C,n?(pl(e,A.x1,A.y1,A.width(),A.height(),n,!0),e.fill()):e.fillRect(A.x1,A.y1,A.width(),A.height()),e.highPerformanceRestore()}O&&Gl.free(A),E()}};var Yl=function(t,e,r,i){var n,s=arguments.length,o=s<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,e,r,i);else for(var a=t.length-1;a>=0;a--)(n=t[a])&&(o=(s<3?n(o):s>3?n(e,r,o):n(e,r))||o);return s>3&&o&&Object.defineProperty(e,r,o),o},ql=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Zl=function(t,e){return function(r,i){e(r,i,t)}};let Kl=class extends kl{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=Eo,this.builtinContributions=[Xl],this.init(t)}drawShape(t,e,r,i,n,s,o,a){var l,h,c;const u=Cn(t,null==s?void 0:s.theme).text,{text:d,underline:p=u.underline,lineThrough:f=u.lineThrough,keepDirIn3d:g=u.keepDirIn3d,direction:m=u.direction,fontSize:y=u.fontSize,verticalMode:v=u.verticalMode,x:b=u.x,y:_=u.y}=t.attribute,w=null!==(l=Yn(t.attribute.lineHeight,y))&&void 0!==l?l:y,x=this.valid(t,u,o,a);if(!x)return;const{fVisible:S,sVisible:T,doFill:k,doStroke:C}=x,E=!g,A=this.z||0;e.beginPath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,u),this.beforeRenderStep(t,e,r,i,k,C,S,T,u,n,o,a),E&&this.transformUseContext2d(t,u,A,e);const O=(n,s,l,h)=>{let c=r+s;const d=i+l;if(h){e.highPerformanceSave(),c+=y;const t=No.allocate(1,0,0,1,0,0);t.rotateByCenter(Math.PI/2,c,d),e.transformFromMatrix(t,!0),No.free(t)}C&&(a?a(e,t.attribute,u):T&&(e.setStrokeStyle(t,t.attribute,b-r,_-i,u),e.strokeText(n,c,d,A))),k&&(o?o(e,t.attribute,u):S&&(e.setCommonStyle(t,t.attribute,b-r,_-i,u),e.fillText(n,c,d,A))),h&&(e.highPerformanceRestore(),e.setTransformForCurrent())};if(e.setTextStyleWithoutAlignBaseline(t.attribute,u,A),"horizontal"===m){const{multilineLayout:n}=t;if(!n)return void e.highPerformanceRestore();const{xOffset:s,yOffset:l}=n.bbox;C&&(a?a(e,t.attribute,u):T&&(e.setStrokeStyle(t,t.attribute,b-r,_-i,u),n.lines.forEach((t=>{e.strokeText(t.str,(t.leftOffset||0)+s+r,(t.topOffset||0)+l+i,A)})))),k&&(o?o(e,t.attribute,u):S&&(e.setCommonStyle(t,t.attribute,b-r,_-i,u),n.lines.forEach((n=>{e.fillText(n.str,(n.leftOffset||0)+s+r,(n.topOffset||0)+l+i,A),this.drawUnderLine(p,f,t,(n.leftOffset||0)+s+r,(n.topOffset||0)+l+i,n.descent,(n.descent-n.ascent)/2,A,u,e,{width:n.width})}))))}else{let{textAlign:r=u.textAlign,textBaseline:i=u.textBaseline}=t.attribute;if(!v){const e=r;r=null!==(h=t.getBaselineMapAlign()[i])&&void 0!==h?h:"left",i=null!==(c=t.getAlignMapBaseline()[e])&&void 0!==c?c:"top"}t.tryUpdateAABBBounds();const n=t.cache,{verticalList:s}=n;e.textAlign="left",e.textBaseline="top";const o=w*s.length;let a=0;s.forEach((t=>{const e=t.reduce(((t,e)=>t+(e.width||0)),0);a=le(e,a)}));let l=0,d=0;"bottom"===i?d=-o:"middle"===i&&(d=-o/2),"center"===r?l-=a/2:"right"===r&&(l-=a),s.forEach(((t,e)=>{const i=t.reduce(((t,e)=>t+(e.width||0)),0),n=a-i;let s=l;"center"===r?s+=n/2:"right"===r&&(s+=n),t.forEach((t=>{const{text:r,width:i,direction:n}=t;O(r,o-(e+1)*w+d,s,n),s+=i}))}))}E&&this.restoreTransformUseContext2d(t,u,A,e),this.afterRenderStep(t,e,r,i,k,C,S,T,u,n,o,a)}draw(t,e,r,i){const n=Cn(t,null==i?void 0:i.theme).text,{keepDirIn3d:s=n.keepDirIn3d}=t.attribute,o=!s;this._draw(t,n,o,r,i)}drawUnderLine(t,e,r,i,n,s,o,a,l,h,c){if(e+t<=0)return;const{textAlign:u=l.textAlign,fill:d=l.fill,opacity:p=l.opacity,underlineOffset:f=l.underlineOffset,underlineDash:g=l.underlineDash,fillOpacity:m=l.fillOpacity}=r.attribute,y=!_t(c),v=y?c.width:r.clipedWidth,b=y?0:Ca(u,v),_={lineWidth:0,stroke:d,opacity:p,strokeOpacity:m};if(t){_.lineWidth=t,h.setStrokeStyle(r,_,i,n,l),g&&h.setLineDash(g),h.beginPath();const e=n+s+f;h.moveTo(i+b,e,a),h.lineTo(i+b+v,e,a),h.stroke()}if(e){_.lineWidth=e,h.setStrokeStyle(r,_,i,n,l),h.beginPath();const t=n+o;h.moveTo(i+b,t,a),h.lineTo(i+b+v,t,a),h.stroke()}}};Kl=Yl([L(),Zl(0,B(Y)),Zl(0,P(Ta)),ql("design:paramtypes",[Object])],Kl);var Ql=function(t,e,r,i){var n,s=arguments.length,o=s<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,e,r,i);else for(var a=t.length-1;a>=0;a--)(n=t[a])&&(o=(s<3?n(o):s>3?n(e,r,o):n(e,r))||o);return s>3&&o&&Object.defineProperty(e,r,o),o},Jl=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},th=function(t,e){return function(r,i){e(r,i,t)}};let eh=class{constructor(t){this.groupRenderContribitions=t,this.numberType=wo}reInit(){this._groupRenderContribitions=this.groupRenderContribitions.getContributions()||[],this._groupRenderContribitions.push(ul)}drawShape(t,e,r,i,n,s,o,a,l){const{clip:h,fill:c,stroke:u,background:d}=t.attribute;if(!(h||c||u||d))return;l=null!=l?l:Cn(t,null==s?void 0:s.theme).group;const{opacity:p=l.opacity,width:f=l.width,height:g=l.height,fillOpacity:m=l.fillOpacity,strokeOpacity:y=l.strokeOpacity,cornerRadius:v=l.cornerRadius,path:b=l.path,lineWidth:_=l.lineWidth,visible:w=l.visible,fillStrokeOrder:x=l.fillStrokeOrder,cornerType:S=l.cornerType,x:T=l.x,y:k=l.y}=t.attribute,C=ya(p,m,f,g,c),E=ba(p,y,f,g),A=fa(c,d),O=ga(u,_);if(!t.valid||!w)return;if(!h){if(!A&&!O)return;if(!(C||E||o||a||d))return}if(b&&b.length&&n.drawContribution){const t=e.disableFill,r=e.disableStroke,i=e.disableBeginPath;e.disableFill=!0,e.disableStroke=!0,e.disableBeginPath=!0,b.forEach((t=>{n.drawContribution.getRenderContribution(t).draw(t,n.renderService,n,s)})),e.disableFill=t,e.disableStroke=r,e.disableBeginPath=i}else 0===v||Et(v)&&v.every((t=>0===t))?(e.beginPath(),e.rect(r,i,f,g)):(e.beginPath(),pl(e,r,i,f,g,v,"bevel"!==S));this._groupRenderContribitions||(this._groupRenderContribitions=this.groupRenderContribitions.getContributions()||[],this._groupRenderContribitions.push(ul));const B={doFill:A,doStroke:O};e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this._groupRenderContribitions.forEach((s=>{s.time===Je.beforeFillStroke&&s.drawShape(t,e,r,i,A,O,C,E,l,n,o,a,B)})),h&&e.clip();const R=()=>{B.doFill&&(o?o(e,t.attribute,l):C&&(e.setCommonStyle(t,t.attribute,T-r,k-i,l),e.fill()))},L=()=>{B.doStroke&&(a?a(e,t.attribute,l):E&&(e.setStrokeStyle(t,t.attribute,T-r,k-i,l),e.stroke()))};x?(L(),R()):(R(),L()),this._groupRenderContribitions.forEach((s=>{s.time===Je.afterFillStroke&&s.drawShape(t,e,r,i,A,O,C,E,l,n,o,a)}))}draw(t,e,r,i){var n,s;const{context:o}=r;if(!o)return;const{clip:a,baseOpacity:l=1,drawMode:h}=t.attribute,c=o.nativeContext,u=o.canvas.nativeCanvas;if(h>0){const{x:e,y:r,width:i,height:n}=t.attribute,s=o.canvas,a=rt.global.createCanvas({width:s.width,height:s.height,dpr:1}),l=a.getContext("2d"),c=o.nativeContext.getTransform();l.setTransform(c.a,c.b,c.c,c.d,c.e,c.f),1===h&&(l.save(),l.clearRect(0,0,s.width,s.height),l.beginPath(),l.rect(e,r,i,n),l.clip(),l.drawImage(s.nativeCanvas,0,0,s.width,s.height,0,0,s.displayWidth,s.displayHeight),l.restore()),o.nativeContext=l,s.nativeCanvas=a}a?o.save():o.highPerformanceSave();const d=o.baseGlobalAlpha;o.baseGlobalAlpha*=l;const p=o.modelMatrix;if(o.camera){const e=Cn(t,null==i?void 0:i.theme).group,r=Fo.allocate(),n=Fo.allocate();Ra(n,t,e),Mo(r,p||r,n),o.modelMatrix=r,Fo.free(n),o.setTransform(1,0,0,1,0,0,!0)}else o.transformFromMatrix(t.transMatrix,!0);o.beginPath(),i.skipDraw?this.drawShape(t,o,0,0,r,i,(()=>!1),(()=>!1)):this.drawShape(t,o,0,0,r,null,null,null);const{scrollX:f,scrollY:g}=t.attribute;let m;if((f||g)&&o.translate(f,g),i&&i.renderInGroup&&(m=i.renderInGroup(null===(n=i.renderInGroupParams)||void 0===n?void 0:n.skipSort,t,r,null===(s=i.renderInGroupParams)||void 0===s?void 0:s.nextM)),o.modelMatrix!==p&&Fo.free(o.modelMatrix),o.modelMatrix=p,o.baseGlobalAlpha=d,h>0){const{x:e,y:r,width:i,height:n}=t.attribute,s=o.nativeContext,a=o.canvas.nativeCanvas;c.save(),c.setTransform(o.dpr,0,0,o.dpr,0,0,!0),1===h&&s.rect(e,r,i,n),c.drawImage(a,0,0,a.width,a.height,0,0,o.canvas.displayWidth,o.canvas.displayHeight);const l=s.getTransform();c.setTransform(l.a,l.b,l.c,l.d,l.e,l.f),o.nativeContext=c,o.canvas.nativeCanvas=u,c.restore()}m&&m.then?m.then((()=>{a?o.restore():o.highPerformanceRestore()})):a?o.restore():o.highPerformanceRestore()}};eh=Ql([L(),th(0,B(Y)),th(0,P(wa)),Jl("design:paramtypes",[Object])],eh);const rh=Symbol.for("IncrementalDrawContribution"),ih=Symbol.for("GraphicRender"),nh=Symbol.for("GroupRender"),sh=Symbol.for("RectRender"),oh=Symbol.for("SymbolRender"),ah=Symbol.for("TextRender"),lh=Symbol.for("DrawContribution"),hh=(t,e,r,i)=>{let n,s=!1,o=!1;if(e.forEachChildren((t=>(s=t.numberType===vo,!s))),e.forEachChildren((t=>(o=!!t.findFace,!o))),s){const t=e.getChildren(),a=[...t];a.sort(((t,e)=>{var r,i,n,s;let o=(null!==(i=null!==(r=t.attribute.startAngle)&&void 0!==r?r:0+t.attribute.endAngle)&&void 0!==i?i:0)/2,a=(null!==(s=null!==(n=e.attribute.startAngle)&&void 0!==n?n:0+e.attribute.endAngle)&&void 0!==s?s:0)/2;for(;o<0;)o+=ne;for(;a<0;)a+=ne;return a-o})),a.forEach((t=>{t._next=null,t._prev=null})),e.removeAllChild(),e.update(),a.forEach((t=>{e.appendChild(t)})),i.hack_pieFace="outside",n=r(s,o),n&&n.graphic||(i.hack_pieFace="inside",n=r(s,o)),n&&n.graphic||(i.hack_pieFace="top",n=r(s,o)),e.removeAllChild(),t.forEach((t=>{t._next=null,t._prev=null})),t.forEach((t=>{e.appendChild(t)}))}else if(o){const i=e.getChildren(),a=i.map((e=>({ave_z:e.findFace().vertices.map((r=>{var i;return t.view(r[0],r[1],null!==(i=r[2]+e.attribute.z)&&void 0!==i?i:0)[2]})).reduce(((t,e)=>t+e),0),g:e})));a.sort(((t,e)=>e.ave_z-t.ave_z)),e.removeAllChild(),a.forEach((t=>{t.g._next=null,t.g._prev=null})),e.update(),a.forEach((t=>{e.add(t.g)})),n=r(s,o),e.removeAllChild(),i.forEach((t=>{t._next=null,t._prev=null})),e.update(),i.forEach((t=>{e.add(t)}))}else n=r(s,o);return n};var ch=function(t,e,r,i){var n,s=arguments.length,o=s<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,e,r,i);else for(var a=t.length-1;a>=0;a--)(n=t[a])&&(o=(s<3?n(o):s>3?n(e,r,o):n(e,r))||o);return s>3&&o&&Object.defineProperty(e,r,o),o},uh=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const dh=Symbol.for("DrawItemInterceptor"),ph=new Le,fh=new Le;class gh{constructor(){this.order=1}afterDrawItem(t,e,r,i,n){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,r,i,n),!1}beforeDrawItem(t,e,r,i,n){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,r,i,n),!1}drawItem(t,e,r,i,n){if(!t.shadowRoot)return!1;const{context:s}=r;if(s.highPerformanceSave(),s.transformFromMatrix(t.transMatrix,!0),i.dirtyBounds&&i.backupDirtyBounds){ph.copy(i.dirtyBounds),fh.copy(i.backupDirtyBounds);const e=t.globalTransMatrix.getInverse();i.dirtyBounds.copy(i.backupDirtyBounds).transformWithMatrix(e),i.backupDirtyBounds.copy(i.dirtyBounds)}return i.renderGroup(t.shadowRoot,r,No.allocate(1,0,0,1,0,0)),s.highPerformanceRestore(),i.dirtyBounds&&i.backupDirtyBounds&&(i.dirtyBounds.copy(ph),i.backupDirtyBounds.copy(fh)),!0}}class mh{constructor(){this.order=1}afterDrawItem(t,e,r,i,n){return t.attribute._debug_bounds&&this.drawItem(t,e,r,i,n),!1}drawItem(t,e,r,i,n){if(!t.attribute._debug_bounds)return!1;const{context:s}=r;s.highPerformanceSave(),t.parent&&s.setTransformFromMatrix(t.parent.globalTransMatrix,!0),t.glyphHost&&t.glyphHost.parent&&s.setTransformFromMatrix(t.glyphHost.parent.globalTransMatrix,!0);const o=t.AABBBounds;return!0!==t.attribute._debug_bounds&&t.attribute._debug_bounds(s,t),s.strokeRect(o.x1,o.y1,o.width(),o.height()),s.highPerformanceRestore(),!0}}let yh=class{constructor(){this.order=1,this.interceptors=[new gh,new bh,new vh,new mh]}afterDrawItem(t,e,r,i,n){if((!t.in3dMode||r.in3dInterceptor)&&!t.shadowRoot&&!t.attribute._debug_bounds&&!(t.baseGraphic||t.attribute.globalZIndex||t.interactiveGraphic))return!1;for(let s=0;s<this.interceptors.length;s++)if(this.interceptors[s].afterDrawItem&&this.interceptors[s].afterDrawItem(t,e,r,i,n))return!0;return!1}beforeDrawItem(t,e,r,i,n){if((!t.in3dMode||r.in3dInterceptor)&&!t.shadowRoot&&!t.attribute._debug_bounds&&!(t.baseGraphic||t.attribute.globalZIndex||t.interactiveGraphic))return!1;for(let s=0;s<this.interceptors.length;s++)if(this.interceptors[s].beforeDrawItem&&this.interceptors[s].beforeDrawItem(t,e,r,i,n))return!0;return!1}};yh=ch([L(),uh("design:paramtypes",[])],yh);class vh{constructor(){this.order=1}beforeDrawItem(t,e,r,i,n){return!this.processing&&(t.baseGraphic?this.beforeDrawInteractive(t,e,r,i,n):this.beforeSetInteractive(t,e,r,i,n))}beforeSetInteractive(t,e,r,i,n){let s=t.interactiveGraphic;if(t.attribute.globalZIndex){s||(s=t.clone(),t.interactiveGraphic=s,s.baseGraphic=t),s.setAttributes({globalZIndex:0,zIndex:t.attribute.globalZIndex},!1,{skipUpdateCallback:!0}),r.stage.tryInitInteractiveLayer();const e=r.stage.getLayer("_builtin_interactive");return e&&this.getShadowRoot(e).add(s),!0}if(s){r.stage.tryInitInteractiveLayer();const e=r.stage.getLayer("_builtin_interactive");e&&this.getShadowRoot(e).removeChild(s),t.interactiveGraphic=null,s.baseGraphic=null}return!1}beforeDrawInteractive(t,e,r,i,n){const s=t.baseGraphic;let o=!!s.stage,a=s.parent;for(;o&&a&&a.stage!==a;)o=!!a.stage,a=a.parent;if(!o){const e=r.stage.getLayer("_builtin_interactive");return e&&this.getShadowRoot(e).removeChild(t),!0}if(s){this.processing=!0;const{context:t}=r;return t.highPerformanceSave(),t.setTransformFromMatrix(s.parent.globalTransMatrix,!0),s.isContainer?i.renderGroup(s,r,s.parent.globalTransMatrix):i.renderItem(s,r),t.highPerformanceRestore(),this.processing=!1,!0}return!1}getShadowRoot(t){var e;let r=t.getElementById("_interactive_group");return r||(r=Ja.CreateGraphic("group",{}),r.id="_interactive_group",t.add(r)),null!==(e=r.shadowRoot)&&void 0!==e?e:r.attachShadow()}}class bh{constructor(){this.order=1}beforeDrawItem(t,e,r,i,n){if(!t.in3dMode||r.in3dInterceptor)return!1;r.in3dInterceptor=!0;const{context:s,stage:o}=e.drawParams;s.canvas,s.save(),this.initCanvasCtx(s),s.camera=o.camera;const a=s.currentMatrix;a.a/=s.dpr,a.b/=s.dpr,a.c/=s.dpr,a.d/=s.dpr,a.e/=s.dpr,a.f/=s.dpr;const l=Fo.allocate();!function(t,e){t[0]=e.a,t[1]=e.b,t[2]=0,t[3]=0,t[4]=e.c,t[5]=e.d,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=e.e,t[13]=e.f,t[14]=0,t[15]=1}(l,a);const h=s.modelMatrix;if(h){if(l){const t=Fo.allocate();s.modelMatrix=Mo(t,h,l)}}else s.modelMatrix=l;return s.setTransform(1,0,0,1,0,0,!0),t.isContainer?hh(s,t,((e,n)=>i.renderGroup(t,r,t.parent.globalTransMatrix,!e&&n)),r):i.renderItem(t,r),s.camera=null,s.restore(),s.modelMatrix!==h&&Fo.free(s.modelMatrix),s.modelMatrix=h,r.in3dInterceptor=!1,!0}initCanvasCtx(t){t.setTransformForCurrent()}}var _h=function(t,e,r,i){var n,s=arguments.length,o=s<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,e,r,i);else for(var a=t.length-1;a>=0;a--)(n=t[a])&&(o=(s<3?n(o):s>3?n(e,r,o):n(e,r))||o);return s>3&&o&&Object.defineProperty(e,r,o),o},wh=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},xh=function(t,e){return function(r,i){e(r,i,t)}};const Sh=Symbol.for("RenderService");let Th=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 r=e.updateBounds;this.prepare(r),this.prepareRenderList(),this.beforeDraw(e),this.draw(e),this.afterDraw(e),this.drawParams=null}};Th=_h([L(),xh(0,B(lh)),wh("design:paramtypes",[Object])],Th);var kh=new v((t=>{t(Sh).to(Th)}));const Ch=Symbol.for("PickerService"),Eh=Symbol.for("GlobalPickerService"),Ah=Symbol.for("PickItemInterceptor"),Oh=Symbol.for("PickServiceInterceptor");var Bh=function(t,e,r,i){var n,s=arguments.length,o=s<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,e,r,i);else for(var a=t.length-1;a>=0;a--)(n=t[a])&&(o=(s<3?n(o):s>3?n(e,r,o):n(e,r))||o);return s>3&&o&&Object.defineProperty(e,r,o),o};let Rh=class{constructor(){this.order=1}afterPickItem(t,e,r,i,n){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}};Rh=Bh([L()],Rh);let Lh=class{constructor(){this.order=1}afterPickItem(t,e,r,i,n){return t.attribute.shadowRootIdx>0||!t.attribute.shadowRootIdx?this._pickItem(t,e,r,i,n):null}beforePickItem(t,e,r,i,n){return t.attribute.shadowRootIdx<0?this._pickItem(t,e,r,i,n):null}_pickItem(t,e,r,i,n){var s;if(!t.shadowRoot)return null;const{parentMatrix:o}=n||{};if(!o)return null;const a=e.pickContext;a.highPerformanceSave();const l=null===(s=Cn(t))||void 0===s?void 0:s[t.type],{shadowPickMode:h=(null==l?void 0:l.shadowPickMode)}=t.attribute,c=t.shadowRoot,u=No.allocateByObj(o),d=new fe(u.a*r.x+u.c*r.y+u.e,u.b*r.x+u.d*r.y+u.f),p=e.pickGroup(c,d,u,i);return a.highPerformanceRestore(),!p.graphic&&p.group&&"full"===h&&(p.graphic=p.group),p}};Lh=Bh([L()],Lh);let Ph=class{constructor(){this.order=1}beforePickItem(t,e,r,i,n){const s=t.baseGraphic;if(s&&s.parent){const t=new fe(r.x,r.y),n=e.pickContext;n.highPerformanceSave();const o=s.parent.globalTransMatrix;o.transformPoint(t,t);const a=s.isContainer?e.pickGroup(s,t.clone(),o,i):e.pickItem(s,t.clone(),o,i);return n.highPerformanceRestore(),a}return null}};Ph=Bh([L()],Ph);let Dh=class{constructor(){this.order=1}beforePickItem(t,e,r,i,n){if(!t.in3dMode||i.in3dInterceptor)return null;const s=e.pickContext,o=t.stage;if(!s||!o)return null;if(i.in3dInterceptor=!0,s.save(),this.initCanvasCtx(s),s.camera=o.camera,t.isContainer){const o=hh(s,t,(()=>e.pickGroup(t,r,n.parentMatrix,i)),i);return s.camera=null,i.in3dInterceptor=!1,s.restore(),o}return s.restore(),null}initCanvasCtx(t){t.setTransformForCurrent()}};Dh=Bh([L()],Dh);var Mh=new v(((t,e,r)=>{r(Ch)||(t(Eh).toSelf(),t(Ch).toService(Eh)),t(Dh).toSelf().inSingletonScope(),t(Ah).toService(Dh),t(Lh).toSelf().inSingletonScope(),t(Ah).toService(Lh),t(Ph).toSelf().inSingletonScope(),t(Ah).toService(Ph),Z(t,Ah),t(Rh).toSelf().inSingletonScope(),t(Oh).toService(Rh),Z(t,Oh)})),Ih=new v((t=>{t(Ao).to(La),t(Oo).toConstantValue(Ja)}));const Nh=Symbol.for("AutoEnablePlugins"),Fh=Symbol.for("PluginService");var jh=function(t,e,r,i){var n,s=arguments.length,o=s<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,e,r,i);else for(var a=t.length-1;a>=0;a--)(n=t[a])&&(o=(s<3?n(o):s>3?n(e,r,o):n(e,r))||o);return s>3&&o&&Object.defineProperty(e,r,o),o},zh=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Hh=function(t,e){return function(r,i){e(r,i,t)}};let Wh=class{constructor(t){this.autoEnablePlugins=t,this.onStartupFinishedPlugin=[],this.onRegisterPlugin=[],this.actived=!1}active(t,e){this.stage=t,this.actived=!0;const{pluginList:r}=e;r&&Ai.isBound(Nh)&&this.autoEnablePlugins.getContributions().forEach((t=>{r.includes(t.name)&&this.register(t)}))}findPluginsByName(t){const e=[];return this.onStartupFinishedPlugin.forEach((r=>{r.name===t&&e.push(r)})),this.onRegisterPlugin.forEach((r=>{r.name===t&&e.push(r)})),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(...t){this.onStartupFinishedPlugin.forEach((t=>{t.deactivate(this)})),this.onStartupFinishedPlugin=[],this.onRegisterPlugin.forEach((t=>{t.deactivate(this)})),this.onRegisterPlugin=[]}};Wh=jh([L(),Hh(0,B(Y)),Hh(0,P(Nh)),zh("design:paramtypes",[Object])],Wh);var Uh=new v((t=>{t(Fh).to(Wh),function(t,e){t(Y).toDynamicValue((({container:t})=>new q(e,t))).whenTargetNamed(e)}(t,Nh)})),$h=new v((t=>{Z(t,tt)})),Vh=new v((t=>{t(Ci).to(Ei).inSingletonScope(),Z(t,Ci)})),Gh=function(t,e,r,i){var n,s=arguments.length,o=s<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,e,r,i);else for(var a=t.length-1;a>=0;a--)(n=t[a])&&(o=(s<3?n(o):s>3?n(e,r,o):n(e,r))||o);return s>3&&o&&Object.defineProperty(e,r,o),o},Xh=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let Yh=class{constructor(){this.type="static",this.offscreen=!1,this.global=rt.global}setDpr(t){this.canvas.dpr=t}init(t,e,r){if(this.layer=t,this.window=e,r.main)this.main=!0,this.context=e.getContext(),this.canvas=this.context.getCanvas();else{let t;this.main=!1,r.canvasId&&(t=this.global.getElementById(r.canvasId)),t||(t=this.global.createCanvas({width:e.width,height:e.height})),t.style&&(t.style["pointer-events"]="none");const i=e.getContext().getCanvas().nativeCanvas,n=Bi({nativeCanvas:t,width:e.width,height:e.height,dpr:e.dpr,id:r.canvasId,canvasControled:!0,container:e.getContainer(),x:i.offsetLeft,y:i.offsetTop});n.applyPosition(),this.canvas=n,this.context=n.getContext()}}resize(t,e){this.canvas.resize(t,e)}resizeView(t,e){}render(t,e,r){var i;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!==(i=e.background)&&void 0!==i?i:"#ffffff"},e),r))}merge(t){t.forEach((t=>{const e=t.getContext().canvas.nativeCanvas;this.context.drawImage(e,0,0)}))}prepare(t,e){}drawTo(t,e,r){var i;const n=t.getContext();r.renderService.render(e,Object.assign(Object.assign({context:n},r),{clear:r.clear?null!==(i=r.background)&&void 0!==i?i:"#fff":void 0}))}getContext(){return this.context}release(){this.canvas.release()}};Yh=Gh([L(),Xh("design:paramtypes",[])],Yh);var qh=new v((t=>{t(Yh).toSelf(),t(oa).toService(Yh)}));var Zh=function(t,e,r,i){return new(r||(r=Promise))((function(n,s){function o(t){try{l(i.next(t))}catch(t){s(t)}}function a(t){try{l(i.throw(t))}catch(t){s(t)}}function l(t){var e;t.done?n(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(o,a)}l((i=i.apply(t,e||[])).next())}))};function Kh(t,e,r){const i={},n=[];return t.forEachChildren((t=>{const{zIndex:r=e}=t.attribute;i[r]?i[r].push(t):(i[r]=[t],n.push(r))}),r),n.sort(((t,e)=>r?e-t:t-e)),{childMap:i,zIdxArray:n}}function Qh(t,e,r,i=!1){return Zh(this,void 0,void 0,(function*(){yield t.forEachChildrenAsync(r,i)}))}function Jh(t,e,r,i=!1){let n=!1;t.forEachChildren(((t,e)=>{const{zIndex:i=r}=t.attribute;if(0===e);else if(void 0!==i)return n=!0,!0;return!1}),i);let s=null,o=!1;if(n){const{childMap:n,zIdxArray:a}=Kh(t,r,i);let l=!1;for(let t=0;t<a.length&&!l;t++){const r=n[a[t]];for(let t=0;t<r.length;t++){if(o){l=!0,s=r[t];break}r[t]._uid!==e||(o=!0)}}}else t.forEachChildren((t=>o?(s=t,!0):(t._uid===e&&(o=!0),!1)),i);return s}var tc=function(t,e,r,i){var n,s=arguments.length,o=s<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,e,r,i);else for(var a=t.length-1;a>=0;a--)(n=t[a])&&(o=(s<3?n(o):s>3?n(e,r,o):n(e,r))||o);return s>3&&o&&Object.defineProperty(e,r,o),o},ec=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},rc=function(t,e){return function(r,i){e(r,i,t)}};let ic=class{constructor(t,e){this.contributions=t,this.drawItemInterceptorContributions=e,this._renderInGroup=(t,e,r,i)=>{var n;t?e.forEachChildren((t=>{r.break||(t.isContainer?this.renderGroup(t,r,i):this.renderItem(t,r))})):function(t,e,r,i=!1,n=!1){let s=!1;if(n)s=!0;else{let r;t.forEachChildren(((t,i)=>{const{zIndex:n=e}=t.attribute;if(0===i)r=n;else if(r!==n)return s=!0,!0;return!1}),i)}if(s){const{childMap:s,zIdxArray:o}=Kh(t,e,i);let a=!1;for(let t=0;t<o.length&&!a;t++){const e=s[o[t]];n&&e.sort(((t,e)=>{var r,n;return(i?-1:1)*((null!==(r=e.attribute.z)&&void 0!==r?r:0)-(null!==(n=t.attribute.z)&&void 0!==n?n:0))}));for(let t=0;t<e.length;t++)if(r(e[t],t)){a=!0;break}}}else t.forEachChildren(r,i)}(e,Jr.zIndex,(t=>{r.break||(t.isContainer?this.renderGroup(t,r,i):this.renderItem(t,r))}),!1,!!(null===(n=r.context)||void 0===n?void 0:n.camera))},this.currentRenderMap=new Map,this.defaultRenderMap=new Map,this.styleRenderMap=new Map,this.dirtyBounds=new Re,this.backupDirtyBounds=new Re,this.global=rt.global,this.layerService=rt.layerService,Et(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){var r;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:o}=e;if(!i)return;const a=this.dirtyBounds.setValue(0,0,s.width(),s.height());if(n.dirtyBounds&&!n.dirtyBounds.empty()){const t=ye(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 l=i.dpr%1;(l||.5!==l)&&(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.reset(!1),i.save(),i.setClearMatrix(o.a,o.b,o.c,o.d,o.e,o.f),i.clearMatrix(!1),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),(null===(r=t.drawParams)||void 0===r?void 0:r.stage)&&t.drawParams.stage.hooks.afterClearScreen.call(t.drawParams),t.renderTreeRoots.sort(((t,e)=>{var r,i;return(null!==(r=t.attribute.zIndex)&&void 0!==r?r:Jr.zIndex)-(null!==(i=e.attribute.zIndex)&&void 0!==i?i:Jr.zIndex)})).forEach((t=>{t.isContainer?this.renderGroup(t,e,No.allocate(1,0,0,1,0,0)):this.renderItem(t,e)})),i.restore(),i.draw()}doRegister(){throw new Error("暂不支持")}_findNextGraphic(t){let e=t.parent,r=t._uid;for(;e;){const t=Jh(e,r,Jr.zIndex);if(t)return t;r=e._uid,e=e.parent}return null}renderGroup(t,e,r,i){if(e.break||!1===t.attribute.visibleAll)return;if(t.incremental&&(null==e.startAtId||e.startAtId===t._uid))return e.break=!0,void this._increaseRender(t,e);if(this.useDirtyBounds&&!we(t.AABBBounds,this.dirtyBounds,!1)&&"empty"!==t.attribute.boundsMode)return;let n,s=r;if(this.useDirtyBounds){n=Gl.allocateByObj(this.dirtyBounds);const e=t.transMatrix;s=No.allocateByObj(r).multiply(e.a,e.b,e.c,e.d,e.e,e.f),this.dirtyBounds.copy(this.backupDirtyBounds).transformWithMatrix(s.getInverse())}e.isGroupScroll=!(!t.attribute.scrollX&&!t.attribute.scrollY),this.renderItem(t,e,{renderInGroupParams:{skipSort:i,nextM:s},renderInGroup:this._renderInGroup}),this.useDirtyBounds&&(this.dirtyBounds.copy(n),Gl.free(n),No.free(s))}_increaseRender(t,e){const{layer:r,stage:i}=e,{subLayers:n}=r;let s=n.get(t._uid);s||(s={layer:this.layerService.createLayer(i),zIndex:n.size,group:t},n.set(t._uid,s));const o=s.layer.getNativeHandler().getContext(),a=s.drawContribution||Ai.get(rh);a.dirtyBounds.setValue(-1/0,-1/0,1/0,1/0),a.backupDirtyBounds.setValue(-1/0,-1/0,1/0,1/0),a.draw(this.currentRenderService,Object.assign(Object.assign({},e),{drawContribution:a,clear:"transparent",layer:s.layer,context:o,startAtId:t._uid,break:!1})),s.drawContribution=a;const l=this._findNextGraphic(t);if(l)if(l.isContainer&&l.incremental)this._increaseRender(l,e);else{let t=n.get(l._uid);t||(t={layer:this.layerService.createLayer(i),zIndex:n.size},n.set(l._uid,t));const r=t.layer.getNativeHandler().getContext();this.draw(this.currentRenderService,Object.assign(Object.assign({},e),{drawContribution:a,clear:"transparent",layer:t.layer,context:r,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,r){if(this.InterceptorContributions.length)for(let i=0;i<this.InterceptorContributions.length;i++){const n=this.InterceptorContributions[i];if(n.beforeDrawItem&&n.beforeDrawItem(t,this.currentRenderService,e,this,r))return}const i=this.getRenderContribution(t);if(!i)return;let n,s=!1;if(e.isGroupScroll){const{scrollX:e=0,scrollY:r=0}=t.parent.attribute;s=!0,this.scrollMatrix||(this.scrollMatrix=No.allocate(1,0,0,1,0,0)),this.scrollMatrix.translate(-e,-r)}if(s&&(n=this.dirtyBounds.clone().transformWithMatrix(this.scrollMatrix)),this.useDirtyBounds&&!t.isContainer&&"empty"!==t.attribute.boundsMode&&!we(t.AABBBounds,null!=n?n:this.dirtyBounds,!1)){if(s&&t.parent){const{scrollX:e=0,scrollY:r=0}=t.parent.attribute;this.scrollMatrix&&this.scrollMatrix.translate(e,r)}return}const o=null!=e.startAtId&&t._uid!==e.startAtId;if(t._uid===e.startAtId&&(e.startAtId=null),r&&(r.skipDraw=o),o?t.isContainer&&i.draw(t,this.currentRenderService,e,r):i.draw(t,this.currentRenderService,e,r),s&&t.parent){const{scrollX:e=0,scrollY:r=0}=t.parent.attribute;this.scrollMatrix&&this.scrollMatrix.translate(e,r)}if(this.InterceptorContributions.length)for(let r=0;r<this.InterceptorContributions.length;r++){const i=this.InterceptorContributions[r];if(i.afterDrawItem&&i.afterDrawItem(t,this.currentRenderService,e,this))return}}selectRenderByType(t){return Yt.getInstance().warn("未知错误,不应该走到这里"),null}selectRenderByNumberType(t,e){let r;if(e.attribute.renderStyle){const i=this.styleRenderMap.get(e.attribute.renderStyle);r=i&&i.get(t)}return r||this.currentRenderMap.get(t)||this.defaultRenderMap.get(t)}clearScreen(t,e,r){var i,n,s;const{clear:o,viewBox:a}=r,l=a.width(),h=a.height();if(o){e.clearRect(0,0,l,h),(null===(i=t.drawParams)||void 0===i?void 0:i.stage)&&t.drawParams.stage.hooks.afterClearRect.call(t.drawParams);const r=null===(n=t.drawParams)||void 0===n?void 0:n.stage;if(r&&(e.globalAlpha=null!==(s=r.attribute.opacity)&&void 0!==s?s:1),r&&r.backgroundImg&&r.resources){const t=r.resources.get(o);t&&"success"===t.state&&t.data&&e.drawImage(t.data,0,0,l,h)}else e.fillStyle=vi(e,o,{AABBBounds:{x1:0,y1:0,x2:0+l,y2:0+h}},0,0),e.fillRect(0,0,l,h)}}afterDraw(t,e){}};ic=tc([L(),rc(0,R(ih)),rc(1,B(Y)),rc(1,P(dh)),ec("design:paramtypes",[Array,Object])],ic);var nc=function(t,e,r,i){var n,s=arguments.length,o=s<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,e,r,i);else for(var a=t.length-1;a>=0;a--)(n=t[a])&&(o=(s<3?n(o):s>3?n(e,r,o):n(e,r))||o);return s>3&&o&&Object.defineProperty(e,r,o),o};let sc=class extends Bl{constructor(){super(...arguments),this.numberType=So}drawShape(t,e,r,i,n,s,o,a){if(t.incremental&&n.multiGraphicOptions){const{startAtIdx:e,length:s}=n.multiGraphicOptions,{segments:l=[]}=t.attribute;if(e>l.length)return;const h=Cn(t).line,{fill:c=h.fill,stroke:u=h.stroke,opacity:d=h.opacity,fillOpacity:p=h.fillOpacity,strokeOpacity:f=h.strokeOpacity,lineWidth:g=h.lineWidth,visible:m=h.visible}=t.attribute,y=ma(d,p,c),v=va(d,f),b=fa(c),_=ga(u,g);if(!t.valid||!m)return;if(!b&&!_)return;if(!(y||v||o||a))return;const{context:w}=n;for(let n=e;n<e+s;n++)this.drawIncreaseSegment(t,w,l[n-1],l[n],t.attribute.segments[n],[h,t.attribute],r,i)}else super.drawShape(t,e,r,i,n,s,o,a)}drawIncreaseSegment(t,e,r,i,n,s,o,a){i&&(e.beginPath(),function(t,e,r,i){const{offsetX:n=0,offsetY:s=0}=i||{},o=e?e.points[e.points.length-1]:r.points[0];t.moveTo(o.x+n,o.y+s),r.points.forEach((e=>{!1!==e.defined?t.lineTo(e.x+n,e.y+s):t.moveTo(e.x+n,e.y+s)}))}(e.nativeContext,r,i,{offsetX:o,offsetY:a}),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,n,s),e.setStrokeStyle(t,n,o,a,s),e.stroke())}};sc=nc([L()],sc);var oc=function(t,e,r,i){var n,s=arguments.length,o=s<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,e,r,i);else for(var a=t.length-1;a>=0;a--)(n=t[a])&&(o=(s<3?n(o):s>3?n(e,r,o):n(e,r))||o);return s>3&&o&&Object.defineProperty(e,r,o),o};let ac=class extends Nl{constructor(){super(...arguments),this.numberType=bo}drawShape(t,e,r,i,n,s,o){if(t.incremental&&n.multiGraphicOptions){const{startAtIdx:s,length:a}=n.multiGraphicOptions,{segments:l=[]}=t.attribute;if(s>l.length)return;const h=Cn(t).area,{fill:c=h.fill,fillOpacity:u=h.fillOpacity,opacity:d=h.opacity,visible:p=h.visible}=t.attribute,f=ma(d,u,c),g=fa(c);if(!t.valid||!p)return;if(!g)return;if(!f&&!o)return;for(let n=s;n<s+a;n++)this.drawIncreaseSegment(t,e,l[n-1],l[n],t.attribute.segments[n],[h,t.attribute],r,i)}else super.drawShape(t,e,r,i,n,s,o)}drawIncreaseSegment(t,e,r,i,n,s,o,a){i&&(e.beginPath(),function(t,e,r,i){const{offsetX:n=0,offsetY:s=0}=i||{},{points:o}=r,a=[];for(let t=0;t<o.length;t++)o[t].defined;a.push(o),a.forEach(((r,i)=>{var o,a,l,h;const c=e&&0===i?e.points[e.points.length-1]:r[0];t.moveTo(c.x+n,c.y+s),r.forEach((e=>{!1!==e.defined?t.lineTo(e.x+n,e.y+s):t.moveTo(e.x+n,e.y+s)}));for(let e=r.length-1;e>=0;e--){const i=r[e];t.lineTo(null!==(o=i.x1)&&void 0!==o?o:i.x,null!==(a=i.y1)&&void 0!==a?a:i.y)}t.lineTo(null!==(l=c.x1)&&void 0!==l?l:c.x,null!==(h=c.y1)&&void 0!==h?h:c.y),t.closePath()}))}(e.camera?e:e.nativeContext,r,i,{offsetX:o,offsetY:a}),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,n,s),e.setCommonStyle(t,n,o,a,s),e.fill())}};ac=oc([L()],ac);var lc,hc=function(t,e,r,i){var n,s=arguments.length,o=s<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,e,r,i);else for(var a=t.length-1;a>=0;a--)(n=t[a])&&(o=(s<3?n(o):s>3?n(e,r,o):n(e,r))||o);return s>3&&o&&Object.defineProperty(e,r,o),o},cc=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},uc=function(t,e){return function(r,i){e(r,i,t)}},dc=function(t,e,r,i){return new(r||(r=Promise))((function(n,s){function o(t){try{l(i.next(t))}catch(t){s(t)}}function a(t){try{l(i.throw(t))}catch(t){s(t)}}function l(t){var e;t.done?n(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(o,a)}l((i=i.apply(t,e||[])).next())}))};!function(t){t[t.NORMAL=0]="NORMAL",t[t.STOP=1]="STOP"}(lc||(lc={}));let pc=class extends ic{constructor(t,e,r,i){super(t,i),this.contributions=t,this.lineRender=e,this.areaRender=r,this.drawItemInterceptorContributions=i,this.rendering=!1,this.currFrameStartAt=0,this.currentIdx=0,this.status=lc.NORMAL,this.checkingForDrawPromise=null,this.hooks={completeDraw:new J([])},this.defaultRenderMap.set(this.lineRender.numberType,this.lineRender),this.defaultRenderMap.set(this.areaRender.numberType,this.areaRender)}draw(t,e){return dc(this,void 0,void 0,(function*(){if(this.checkingForDrawPromise)return;this.lastRenderService=t,this.lastDrawContext=e,this.checkingForDrawPromise=this.checkForDraw(e);const r=yield this.checkingForDrawPromise;if(this.checkingForDrawPromise=null,r)return;this.currentRenderService=t;const{context:i,viewBox:n}=e;i&&(i.inuse=!0,i.clearMatrix(),i.setTransformForCurrent(!0),i.save(),e.restartIncremental&&this.clearScreen(this.currentRenderService,i,e),i.translate(n.x1,n.y1,!0),i.save(),t.renderTreeRoots.sort(((t,e)=>{var r,i;return(null!==(r=t.attribute.zIndex)&&void 0!==r?r:Jr.zIndex)-(null!==(i=e.attribute.zIndex)&&void 0!==i?i:Jr.zIndex)})).forEach((t=>{this.renderGroup(t,e)})),this.hooks.completeDraw.tap("top-draw",(()=>{i.restore(),i.restore(),i.draw(),i.inuse=!1,this.rendering=!1})))}))}_increaseRender(t,e){return dc(this,void 0,void 0,(function*(){this.rendering=!0,yield this._renderIncrementalGroup(t,e)}))}_renderIncrementalGroup(t,e){return dc(this,void 0,void 0,(function*(){this.count=t.count,yield new Promise((r=>{this.renderItem(t,e,{drawingCb:()=>dc(this,void 0,void 0,(function*(){if(2!==t.count)yield Qh(t,Jr.zIndex,((r,i)=>{if(this.status===lc.STOP)return!0;if(r.isContainer)return!1;if(i<this.currentIdx)return!1;const n=this.currFrameStartAt+t.incremental;return i<n&&(this.currentIdx=i+1,this.renderItem(r,e)),i===n-1&&(this.currFrameStartAt=this.currentIdx,this.waitToNextFrame())})),r(!1);else{const i=t.getChildAt(0);if(i.incremental&&i.attribute.segments)for(i.incrementalAt||(i.incrementalAt=0);i.incrementalAt<i.attribute.segments.length;)e.multiGraphicOptions={startAtIdx:i.incrementalAt,length:i.incremental},this.renderItem(i,e),i.incrementalAt+=i.incremental,yield this.waitToNextFrame();else this.renderItem(i,e);r(!1)}}))})})),this.hooks.completeDraw.call()}))}waitToNextFrame(){return dc(this,void 0,void 0,(function*(){return new Promise((t=>{this.global.getRequestAnimationFrame()((()=>{t(!1)}))}))}))}checkForDraw(t){return dc(this,void 0,void 0,(function*(){let e=this.rendering;return t.restartIncremental&&(e=!1,yield this.forceStop(),this.resetToInit()),e}))}forceStop(){return dc(this,void 0,void 0,(function*(){this.rendering&&(this.status=lc.STOP,yield new Promise((t=>{this.hooks.completeDraw.tap("stopCb",(()=>{this.status=lc.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 dc(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((r=>{this.renderItem(t,e,{drawingCb:()=>dc(this,void 0,void 0,(function*(){yield Qh(t,Jr.zIndex,(t=>dc(this,void 0,void 0,(function*(){e.break||t.isContainer&&(yield this.renderGroup(t,e))})))),r(!1)}))})})))}))}};pc=hc([L(),uc(0,R(ih)),uc(1,B(sc)),uc(2,B(ac)),uc(3,B(Y)),uc(3,P(dh)),cc("design:paramtypes",[Array,Object,Object,Object])],pc);var fc=new v((t=>{t(nl).toSelf().inSingletonScope(),t(hl).toSelf().inSingletonScope(),t(lh).to(ic),t(rh).to(pc),t(nh).to(eh).inSingletonScope(),t(ih).toService(nh),Z(t,wa),t(ol).toSelf().inSingletonScope(),Z(t,ka),Z(t,ih),t(yh).toSelf().inSingletonScope(),t(dh).toService(yh),Z(t,dh)}));function gc(){gc.__loaded||(gc.__loaded=!0,Ai.load(pa),Ai.load(Ih),Ai.load(kh),Ai.load(Mh),Ai.load(Uh),function(t){t.load($h),t.load(Vh),t.load(qh)}(Ai),function(t){t.load(fc)}(Ai))}gc.__loaded=!1,gc();const mc=Ai.get(et);rt.global=mc;const yc=Ai.get(na);rt.graphicUtil=yc;const vc=Ai.get(ia);rt.transformUtil=vc;const bc=Ai.get(Ao);rt.graphicService=bc;const _c=Ai.get(Sh);rt.renderService=_c;const wc=Ai.get(sa);rt.layerService=wc;class xc{constructor(){this.name="AutoRenderPlugin",this.activeEvent="onRegister",this._uid=y.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;const e=this.pluginService.stage;e&&(e.graphicService.hooks.onAttributeUpdate.tap(this.key,this.handleChange),e.graphicService.hooks.onSetStage.tap(this.key,this.handleChange),e.graphicService.hooks.onRemove.tap(this.key,this.handleChange))}deactivate(t){const e=t=>t.filter((t=>t.name!==this.key)),r=this.pluginService.stage;r&&(r.graphicService.hooks.onAttributeUpdate.taps=e(r.graphicService.hooks.onAttributeUpdate.taps),r.graphicService.hooks.onSetStage.taps=e(r.graphicService.hooks.onSetStage.taps),r.graphicService.hooks.onRemove.taps=e(r.graphicService.hooks.onRemove.taps))}}class Sc{constructor(){this.name="AutoRefreshPlugin",this.activeEvent="onRegister",this._uid=y.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=rt.global.devicePixelRatio,this.refresh()}refresh(){this._refreshByMediaQuery()||this._refreshByRaf()}_refreshByRaf(){const t=rt.global.getRequestAnimationFrame();this.rafId=t((()=>{rt.global.devicePixelRatio!==this.dpr&&(this.dpr=rt.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))},r=matchMedia(t);r&&r.addEventListener("change",e),this.autoRefreshCbs||(this.autoRefreshCbs=[]),this.autoRefreshCbs.push((()=>{r&&r.removeEventListener("change",e)}))}catch(t){return!1}return!0}deactivate(t){var e;const r=rt.global.getCancelAnimationFrame();r&&this.rafId&&r(this.rafId),null===(e=this.autoRefreshCbs)||void 0===e||e.forEach((t=>{t()})),this.autoRefreshCbs=void 0}}class Tc{constructor(){this.name="IncrementalAutoRenderPlugin",this.activeEvent="onRegister",this.nextFrameRenderGroupSet=new Set,this.willNextFrameRender=!1,this.nextUserParams={},this._uid=y.GenAutoIncrementId(),this.key=this.name+this._uid}activate(t){this.pluginService=t;const e=this.pluginService.stage;e&&(e.graphicService.hooks.onAddIncremental.tap(this.key,((e,r,i)=>{e.glyphHost&&(e=e.glyphHost),e.stage===t.stage&&null!=e.stage&&(this.nextUserParams.startAtId=r._uid,this.renderNextFrame(r))})),e.graphicService.hooks.onClearIncremental.tap(this.key,((e,r)=>{e.stage===t.stage&&null!=e.stage&&(this.nextUserParams.startAtId=e._uid,this.nextUserParams.restartIncremental=!0,this.renderNextFrame(e))})))}deactivate(t){const e=this.pluginService.stage;e&&(e.graphicService.hooks.onAddIncremental.taps=e.graphicService.hooks.onAddIncremental.taps.filter((t=>t.name!==this.key)),e.graphicService.hooks.onClearIncremental.taps=e.graphicService.hooks.onClearIncremental.taps.filter((t=>t.name!==this.key)))}renderNextFrame(t){this.nextFrameRenderGroupSet.add(t),this.willNextFrameRender||(this.willNextFrameRender=!0,rt.global.getRequestAnimationFrame()((()=>{this._doRenderInThisFrame(),this.willNextFrameRender=!1})))}_doRenderInThisFrame(){const t=this.pluginService.stage;this.nextFrameRenderGroupSet.size&&(this.nextFrameRenderGroupSet.forEach((e=>{const r=e.layer;if(!r||!e.layer.subLayers)return;const i=e.layer.subLayers.get(e._uid);i&&i.drawContribution&&i.drawContribution.draw(t.renderService,Object.assign({stage:t,layer:r,viewBox:t.window.getViewBox(),transMatrix:t.window.getViewBoxTransform(),clear:"transparent",renderService:t.renderService,updateBounds:!1,startAtId:e._uid,context:i.layer.getNativeHandler().getContext()},this.nextUserParams))})),this.nextUserParams={},this.nextFrameRenderGroupSet.clear())}}const kc=new Le;class Cc{constructor(){this.name="DirtyBoundsPlugin",this.activeEvent="onRegister",this._uid=y.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()}));const e=this.pluginService.stage;e&&(e.graphicService.hooks.beforeUpdateAABBBounds.tap(this.key,((t,e,r,i)=>{t.glyphHost&&(t=t.glyphHost),e&&e===this.pluginService.stage&&e.renderCount&&(t.isContainer&&!t.shouldSelfChangeUpdateAABBBounds()||r&&(kc.setValue(i.x1,i.y1,i.x2,i.y2),e.dirty(kc,t.parent&&t.parent.globalTransMatrix)))})),e.graphicService.hooks.afterUpdateAABBBounds.tap(this.key,((t,e,r,i,n)=>{e&&e===this.pluginService.stage&&e.renderCount&&(t.isContainer&&!n||e.dirty(i.globalAABBBounds))})),e.graphicService.hooks.clearAABBBounds.tap(this.key,((t,e,r)=>{e&&e===this.pluginService.stage&&e.renderCount&&e&&e.dirty(r)})),e.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){const e=this.pluginService.stage;e&&(e.graphicService.hooks.beforeUpdateAABBBounds.taps=e.graphicService.hooks.beforeUpdateAABBBounds.taps.filter((t=>t.name!==this.key)),e.graphicService.hooks.afterUpdateAABBBounds.taps=e.graphicService.hooks.afterUpdateAABBBounds.taps.filter((t=>t.name!==this.key)),e.graphicService.hooks.clearAABBBounds.taps=e.graphicService.hooks.clearAABBBounds.taps.filter((t=>t.name!==this.key)),e.hooks.afterRender.taps=e.hooks.afterRender.taps.filter((t=>t.name!==this.key)),e.graphicService.hooks.onRemove.taps=e.graphicService.hooks.onRemove.taps.filter((t=>t.name!==this.key)))}}let Ec;function Ac(){!function(){if(null==Ec)try{const t=document.createElement("canvas"),e=t.getContext("2d");Ec=!!(window&&t.getBoundingClientRect&&requestAnimationFrame&&window.devicePixelRatio&&e&&e.isPointInPath&&e.isPointInStroke),Ec&&(Ec=!!document.createElement)}catch(t){Ec=!1}}();const t=rt.global&&rt.global.env;return t?"browser"===t:Ec}class Oc{static registerPlugin(t,e){Oc._pluginClasses[t]=e}static getPlugin(t){return Oc._pluginClasses[t]}}Oc._pluginClasses={};const Bc="white";class Rc extends ta{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:Bc}set background(t){this._background=t}get defaultLayer(){return this.at(0)}get eventSystem(){return this._eventSystem}get ticker(){return this._ticker}set ticker(t){t.bindStage(this),this._ticker&&this._ticker.removeListener("tick",this.afterTickCb),t.addTimeline(this.timeline),this._ticker=t,this._ticker.on("tick",this.afterTickCb)}constructor(t={}){var e,r;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.afterClearScreen=t=>{this._afterClearScreen&&this._afterClearScreen(t)},this.afterClearRect=t=>{this._afterClearRect&&this._afterClearRect(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=()=>{this.tickedBeforeRender=!0,"rendering"!==this.state&&this.renderNextFrame()},this.params=t,this.theme=new Tn,this.hooks={beforeRender:new J(["stage"]),afterRender:new J(["stage"]),afterClearScreen:new J(["stage"]),afterClearRect:new J(["stage"])},this.global=rt.global,!this.global.env&&Ac()&&this.global.setEnv("browser"),this.window=Ai.get(cn),this.renderService=Ai.get(Sh),this.pluginService=Ai.get(Fh),this.layerService=Ai.get(sa),this.graphicService=Ai.get(Ao),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:Bc,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.hooks.afterClearScreen.tap("constructor",this.afterClearScreen),this.hooks.afterClearRect.tap("constructor",this.afterClearRect),this._beforeRender=t.beforeRender,this._afterRender=t.afterRender,this._afterClearScreen=t.afterClearScreen,this._afterClearRect=t.afterClearRect,this.supportInteractiveLayer=!1!==t.interactiveLayer,t.optimize||(t.optimize={tickRenderMode:"effect"}),this.optmize(t.optimize),t.background&&Ct(this._background)&&this._background.includes("/")&&this.setAttributes({background:this._background}),this.initAnimate(t),this.rafId=null!==(r=t.rafId)&&void 0!==r?r:Math.floor(6*Math.random())}initAnimate(t){var e;this.createTicker&&this.createTimeline&&(this._ticker=t.ticker||this.createTicker(this),this._ticker.bindStage(this),"performance"===(null===(e=this.params.optimize)||void 0===e?void 0:e.tickRenderMode)&&this._ticker.setFPS(30),this.timeline=this.createTimeline(),this._ticker.addTimeline(this.timeline),this._ticker.on("tick",this.afterTickCb))}startAnimate(){this._ticker&&this.timeline&&(this._ticker.start(),this.timeline.resume())}pauseRender(t=-1){this._skipRender=t}resumeRender(){this._skipRender=0}tryInitEventSystem(){this.global.supportEvent&&!this._eventSystem&&(this._eventSystem=new Fn(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(t=!1){t&&(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:r={},alpha:i=0,beta:n=0,camera:s,fieldRatio:o=1,fieldDepth:a}=t;return Object.assign(Object.assign({},t),{center:e,light:r,alpha:i,beta:n,camera:s,fieldRatio:o,fieldDepth:a})}set3dOptions(t){var e,r,i,n,s,o;this.option3d=t;const a=this.get3dOptions(t),{light:l,center:h,camera:c,alpha:u,beta:d,fieldRatio:p,fieldDepth:f}=a,{dir:g=[1,1,-1],color:m="white",ambient:y}=l,v=(null!==(e=h.x)&&void 0!==e?e:this.width/2)+(null!==(r=h.dx)&&void 0!==r?r:0),b=(null!==(i=h.y)&&void 0!==i?i:this.height/2)+(null!==(n=h.dy)&&void 0!==n?n:0),_=[v,b,(null!==(s=h.z)&&void 0!==s?s:0)+(null!==(o=h.dz)&&void 0!==o?o:0)];let w=0,x=0,S=0;c||(w=Math.sin(u)+v,x=Math.sin(d)+b,S=Math.cos(u)*Math.cos(d)*1);const T=Oc.getPlugin("DirectionalLight");T&&(this.light=new T(g,m,y));const k={left:0,right:this.width,top:0,bottom:this.height,fieldRatio:p,fieldDepth:f,viewParams:{pos:[w,x,S],center:_,up:[0,1,0]}};if(this.camera)this.camera.params=k;else{const t=Oc.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=Oc.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 xc))}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 Sc))}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 Tc))}disableIncrementalAutoRender(){this.increaseAutoRender&&(this.increaseAutoRender=!1,this.pluginService.findPluginsByName("IncrementalAutoRenderPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableDirtyBounds(){if(this.dirtyBounds)return;this.dirtyBounds=new Re;let t=this.pluginService.findPluginsByName("DirtyBoundsPlugin")[0];t?t.activate(this.pluginService):(t=new Cc,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=Oc.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=Oc.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=Oc.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 r=this.layerService.createLayer(this,{main:!1,layerMode:e,canvasId:t});return this.appendChild(r),r}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.startAnimate();const r=this.state;this.state="rendering",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=r,this._skipRender&&this._skipRender++}combineLayersToWindow(){if("harmony"===this.global.env){const t=this.window.getContext().nativeContext;this.forEachChildren(((e,r)=>{if(r>0){const r=e.getNativeHandler().getContext().canvas.nativeCanvas.nativeCanvas._c.transferToImageBitmap();t.transferFromImageBitmap(r)}}))}}renderNextFrame(t,e){this.nextFrameRenderLayerSet.size!==this.childrenCount&&(t||this).forEach((t=>{this.nextFrameRenderLayerSet.add(t)})),this.willNextFrameRender||(this.willNextFrameRender=!0,this.global.getSpecifiedRequestAnimationFrame(this.rafId)((()=>{this._doRenderInThisFrame(),this.willNextFrameRender=!1})))}_doRenderInThisFrame(){if("released"===this.releaseStatus)return;this.startAnimate();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 r=[];for(let e=0;e<t.length;e++){let i=t[e];"virtual"===i.layerMode&&(i=i.getNativeHandler().mainHandler.layer),r.includes(i)||r.push(i)}r.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,r=!0){this.window.resize(t,e),r&&this.render()}resize(t,e,r=!0){"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((r=>{r.resize(t,e)})),this.camera&&this.option3d&&this.set3dOptions(this.option3d),r&&this.render())}resizeView(t,e,r=!0){"released"!==this.releaseStatus&&(this.viewBox.setValue(this.viewBox.x1,this.viewBox.y1,this.viewBox.x1+t,this.viewBox.y1+e),this.forEachChildren((r=>{r.resizeView(t,e)})),this.camera&&(this.camera.params=Object.assign(Object.assign({},this.camera.params),{right:this.width,bottom:this.height})),r&&this.render())}setViewBox(t,e,r,i,n){let s=!0;"object"==typeof t?(this.viewBox.setValue(t.x1,t.y1,t.x2,t.y2),!1===e&&(s=!1)):(this.viewBox.setValue(t,e,t+r,e+i),!1===n&&(s=!1)),this.forEachChildren((t=>{t.resizeView(this.viewBox.width(),this.viewBox.height())})),s&&this.render()}setDpr(t,e=!0){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 r=this.getPickerService().pick(this.children,new fe(t,e),{bounds:this.AABBBounds});return!(!(null==r?void 0:r.graphic)&&!(null==r?void 0:r.group))&&r}setToFrame(t){throw new Error("暂不支持")}release(){var t,e;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(),null===(t=this._ticker)||void 0===t||t.remTimeline(null==this?void 0:this.timeline),null===(e=this._ticker)||void 0===e||e.removeListener("tick",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,r)=>{e.drawTo(t,{renderService:this.renderService,viewBox:t.getViewBox(),transMatrix:t.getViewBoxTransform(),background:e===this.defaultLayer?this.background:void 0,clear:0===r,updateBounds:!(!this.dirtyBounds||this.dirtyBounds.empty())})}))}renderToNewWindow(t=!0,e){if("released"===this.releaseStatus)return;const r=Ai.get(cn),i=e?-e.x1:0,n=e?-e.y1:0,s=e?e.x2:this.viewWidth,o=e?e.y2:this.viewHeight,a=e?e.width():this.viewWidth,l=e?e.height():this.viewHeight;return r.create({viewBox:{x1:i,y1:n,x2:s,y2:o},width:a,height:l,dpr:this.window.dpr,canvasControled:!0,offscreen:!0,title:""}),this.renderTo(r),r}toCanvas(t=!0,e){if("released"===this.releaseStatus)return;const r=this.renderToNewWindow(t,e).getNativeHandler();return r.nativeCanvas?r.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);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=Ai.get(Ch)),this.pickerService}reInit(){this.renderService.reInit(),this.pickerService.reInit()}}function Lc(t,e,r,i){return t=>{if(!(t instanceof MouseEvent||t instanceof TouchEvent||t instanceof PointerEvent))return t;const n=e();if(1===(s=n).a&&0===s.b&&0===s.c&&1===s.d&&0===s.e&&0===s.f)return t;var s;const o=r(),a=new t.constructor(t.type,t);if(Object.defineProperties(a,{target:{value:t.target},currentTarget:{value:t.currentTarget}}),t instanceof MouseEvent||t instanceof PointerEvent)i(t.clientX,t.clientY,n,o,a);else if(t instanceof TouchEvent){if(t.touches.length>0){const t=a.touches[0];i(t.clientX,t.clientY,n,o,t)}if(t.changedTouches.length>0){const t=a.changedTouches[0];i(t.clientX,t.clientY,n,o,t)}}return a}}function Pc(t,e,r,i,n){const s=Lc(0,r,i,n);t.setEventListenerTransformer(s)}function Dc(t,e,r,i,n){const s=Lc(0,r,i,n);t.setEventListenerTransformer(s)}function Mc(t,e,r,i,n){const s={x:t,y:e};r.transformPoint(s,s),Object.defineProperties(n,{_canvasX:{value:s.x},_canvasY:{value:s.y}})}function Ic(t){var e;if(Ii(t._canvasX)&&Ii(t._canvasY))return{x:t._canvasX,y:t._canvasY};if(t.changedTouches){const r=null!==(e=t.changedTouches[0])&&void 0!==e?e:{};return{x:r._canvasX,y:r._canvasY}}return{x:t._canvasX||0,y:t._canvasY||0}}let Nc=!1;const Fc=new v((t=>{Nc||(Nc=!0,t(Hl).toSelf().inSingletonScope(),t(sh).to(Hl).inSingletonScope(),t(ih).toService(sh),t(ml).toSelf(),t(gl).toSelf(),t(xa).toService(ml),t(xa).toService(gl),t(xa).toService(ol),Z(t,xa))}));let jc=!1;const zc=new v((t=>{jc||(jc=!0,t(Vl).toSelf().inSingletonScope(),t(oh).to(Vl).inSingletonScope(),t(ih).toService(oh),t(Sa).toService(ol),Z(t,Sa))}));let Hc=!1;const Wc=new v((t=>{Hc||(Hc=!0,t(ah).to(Kl).inSingletonScope(),t(ih).toService(ah),t(Ta).toService(ol),Z(t,Ta))}));const Uc=["x","y","dx","dy","scaleX","scaleY","angle","anchor","postMatrix","visible","clip","pickable","childrenPickable","zIndex","cursor"];class $c extends ta{constructor(t,e){super(t),this._skipRenderAttributes=Uc,(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,r,i){const n=this.onBeforeAttributeUpdate&&this.onBeforeAttributeUpdate({[t]:e},this.attribute,t,i);if(n)return this._setAttributes(n,r);Tt(this.attribute[t])&&Tt(e)&&!bt(this.attribute[t])&&!bt(e)?Ut(this.attribute[t],e):this.attribute[t]=e,this._skipRenderAttributes.includes(t)||this.render(),this.valid=this.isValid(),this.updateShapeAndBoundsTagSetted()||!r&&!this.needUpdateTag(t)?this.addUpdateBoundTag():this.addUpdateShapeAndBoundsTag(),this.addUpdatePositionTag(),this.onAttributeUpdate()}setAttributes(t,e,r){return t=this.onBeforeAttributeUpdate&&this.onBeforeAttributeUpdate(t,this.attribute,null,r)||t,this._setAttributes(t,e)}_setAttributes(t,e){const r=Object.keys(t);this._mergeAttributes(t,r),r.every((t=>this._skipRenderAttributes.includes(t)))||this.render(),this.valid=this.isValid(),this.updateShapeAndBoundsTagSetted()||!e&&!this.needUpdateTags(r)?this.addUpdateBoundTag():this.addUpdateShapeAndBoundsTag(),this.addUpdatePositionTag(),this.onAttributeUpdate()}_mergeAttributes(t,e){_t(e)&&(e=Object.keys(t));for(let r=0;r<e.length;r++){const i=e[r];!Tt(this.attribute[i])||bt(this.attribute[i])||bt(t[i])?this.attribute[i]=t[i]:Ut(this.attribute[i],t[i])}}bindEvents(){}_getNodeId(t){var e;return`${null!==(e=this.id)&&void 0!==e?e:this._uid}-${this.name}-${t}`}_dispatchEvent(t,e){var r;const i=new Pn(t,e);i.manager=null===(r=this.stage)||void 0===r?void 0:r.eventSystem.manager,this.dispatchEvent(i)}eventPosToStagePos(t){var e,r;const i={x:0,y:0},n=null!==(r=null===(e=this.stage)||void 0===e?void 0:e.eventPointTransform(t))&&void 0!==r?r:{x:0,y:0};return this.globalTransMatrix.transformPoint(n,i),i}}const Vc=Symbol.for("MathPickerContribution"),Gc=Symbol.for("MathRectPicker"),Xc=Symbol.for("MathSymbolPicker"),Yc=Symbol.for("MathTextPicker"),qc=Symbol.for("CanvasRectPicker"),Zc=Symbol.for("CanvasSymbolPicker"),Kc=Symbol.for("CanvasTextPicker"),Qc=Symbol.for("CanvasPickerContribution");class Jc{contains(t,e,r){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;if(!this.canvasRenderer)return!0;const{pickContext:i}=null!=r?r:{};if(!i)return!1;const n=t.getGraphicTheme();i.highPerformanceSave();let{x:s=n.x,y:o=n.y}=t.attribute;if(t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(n);s+=e.x,o+=e.y,i.setTransformForCurrent()}else s=0,o=0,i.transformFromMatrix(t.transMatrix,!0);let a=!1,l=!1;return this.canvasRenderer.drawShape(t,i,s,o,{},null,((t,r,i,n)=>!(!a&&!l)||(a=t.isPointInPath(e.x,e.y),l=n||l,a)),((t,r,n,s)=>{if(a||l)return!0;const o=r.lineWidth||n.lineWidth,h=r.pickStrokeBuffer||n.pickStrokeBuffer,c=r.keepStrokeScale||n.keepStrokeScale;return i.lineWidth=c?o+h:yi(i,o+h,i.dpr),a=t.isPointInStroke(e.x,e.y),l=s||l,a})),i.highPerformanceRestore(),a}}const tu=new Le;class eu{constructor(){this.type="rect",this.numberType=ko}contains(t,e,r){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:i}=null!=r?r:{};if(!i)return!1;const n=t.getGraphicTheme(),{cornerRadius:s=n.cornerRadius}=t.attribute;let{x:o=n.x,y:a=n.y}=t.attribute;i.highPerformanceSave();let l=!0;if(t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(n);o+=e.x,a+=e.y,i.setTransformForCurrent()}else o=0,a=0,l=!1,i.transformFromMatrix(t.transMatrix,!0);let h=!0;if(!l||t.shadowRoot||Ot(s,!0)&&0!==s||Et(s)&&s.some((t=>0!==t)))h=!1,this.canvasRenderer.drawShape(t,i,o,a,{},null,((t,r,i)=>!!h||(h=t.isPointInPath(e.x,e.y),h)),((t,r,n)=>{if(h)return!0;const s=r.lineWidth||n.lineWidth,o=r.pickStrokeBuffer||n.pickStrokeBuffer,a=r.keepStrokeScale||n.keepStrokeScale;return i.lineWidth=a?s+o:yi(i,s+o,i.dpr),h=t.isPointInStroke(e.x,e.y),h}));else{const{fill:r=n.fill,stroke:i=n.stroke,lineWidth:s=n.lineWidth}=t.attribute;if(r)h=!0;else if(i){const r=t.AABBBounds;tu.setValue(r.x1,r.y1,r.x2,r.y2),tu.expand(-s/2),h=!tu.containsPoint(e)}}return i.highPerformanceRestore(),h}}var ru=function(t,e,r,i){var n,s=arguments.length,o=s<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,e,r,i);else for(var a=t.length-1;a>=0;a--)(n=t[a])&&(o=(s<3?n(o):s>3?n(e,r,o):n(e,r))||o);return s>3&&o&&Object.defineProperty(e,r,o),o},iu=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},nu=function(t,e){return function(r,i){e(r,i,t)}};let su=class extends eu{constructor(t){super(),this.canvasRenderer=t}};su=ru([L(),nu(0,B(sh)),iu("design:paramtypes",[Object])],su);let ou=!1;const au=new v(((t,e,r,i)=>{ou||(ou=!0,t(Gc).to(su).inSingletonScope(),t(Vc).toService(Gc))}));var lu=function(t,e,r,i){var n,s=arguments.length,o=s<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,e,r,i);else for(var a=t.length-1;a>=0;a--)(n=t[a])&&(o=(s<3?n(o):s>3?n(e,r,o):n(e,r))||o);return s>3&&o&&Object.defineProperty(e,r,o),o},hu=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},cu=function(t,e){return function(r,i){e(r,i,t)}};let uu=class extends Jc{constructor(t){super(),this.canvasRenderer=t,this.type="symbol",this.numberType=Co}};uu=lu([L(),cu(0,B(oh)),hu("design:paramtypes",[Object])],uu);let du=!1;const pu=new v(((t,e,r,i)=>{du||(du=!0,t(Xc).to(uu).inSingletonScope(),t(Vc).toService(Xc))}));var fu=function(t,e,r,i){var n,s=arguments.length,o=s<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,e,r,i);else for(var a=t.length-1;a>=0;a--)(n=t[a])&&(o=(s<3?n(o):s>3?n(e,r,o):n(e,r))||o);return s>3&&o&&Object.defineProperty(e,r,o),o};let gu=class{constructor(){this.type="text",this.numberType=Eo}contains(t,e,r){return!!t.AABBBounds.containsPoint(e)}};gu=fu([L()],gu);let mu=!1;const yu=new v(((t,e,r,i)=>{mu||(mu=!0,t(Yc).to(gu).inSingletonScope(),t(Vc).toService(Yc))}));var vu=function(t,e,r,i){var n,s=arguments.length,o=s<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,e,r,i);else for(var a=t.length-1;a>=0;a--)(n=t[a])&&(o=(s<3?n(o):s>3?n(e,r,o):n(e,r))||o);return s>3&&o&&Object.defineProperty(e,r,o),o},bu=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},_u=function(t,e){return function(r,i){e(r,i,t)}};let wu=class extends eu{constructor(t){super(),this.canvasRenderer=t}};wu=vu([L(),_u(0,B(sh)),bu("design:paramtypes",[Object])],wu);let xu=!1;const Su=new v(((t,e,r,i)=>{xu||(xu=!0,t(qc).to(wu).inSingletonScope(),t(Qc).toService(qc))}));class Tu extends kl{contains(t,e,r){const{pickContext:i}=null!=r?r:{};if(!i)return!1;const n=t.getGraphicTheme();i.highPerformanceSave();const s=this.transform(t,n,i),{x:o,y:a,z:l,lastModelMatrix:h}=s;let c=e;if(i.camera){c=e.clone();const r=t.parent.globalTransMatrix;c.x=r.a*e.x+r.c*e.y+r.e,c.y=r.b*e.x+r.d*e.y+r.f}this.canvasRenderer.z=l;let u=!1;return this.canvasRenderer.drawShape(t,i,o,a,r,null,((t,e,r)=>!!u||(u=t.isPointInPath(c.x,c.y),u))),this.canvasRenderer.z=0,i.modelMatrix!==h&&Fo.free(i.modelMatrix),i.modelMatrix=h,i.highPerformanceRestore(),u}}var ku=function(t,e,r,i){var n,s=arguments.length,o=s<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,e,r,i);else for(var a=t.length-1;a>=0;a--)(n=t[a])&&(o=(s<3?n(o):s>3?n(e,r,o):n(e,r))||o);return s>3&&o&&Object.defineProperty(e,r,o),o},Cu=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Eu=function(t,e){return function(r,i){e(r,i,t)}};let Au=class extends Tu{constructor(t){super(),this.canvasRenderer=t,this.type="symbol",this.numberType=Co}contains(t,e,r){const{pickContext:i}=null!=r?r:{};if(!i)return!1;const n=t.getParsedPath();if(!i.camera){if(!t.AABBBounds.containsPoint(e))return!1;if(n.isSvg||"imprecise"===t.attribute.pickMode)return!0}i.highPerformanceSave();const s=t.getGraphicTheme(),o=this.transform(t,s,i),{x:a,y:l,z:h,lastModelMatrix:c}=o;let u=e;if(i.camera){u=e.clone();const r=t.parent.globalTransMatrix;u.x=r.a*e.x+r.c*e.y+r.e,u.y=r.b*e.x+r.d*e.y+r.f}this.canvasRenderer.z=h;let d=!1;return this.canvasRenderer.drawShape(t,i,a,l,{},null,((t,e,r)=>!!d||(d=t.isPointInPath(u.x,u.y),d)),((t,e,r)=>{if(d)return!0;const n=e.lineWidth||r.lineWidth,s=e.pickStrokeBuffer||r.pickStrokeBuffer,o=e.keepStrokeScale||r.keepStrokeScale;return i.lineWidth=o?n+s:yi(i,n+s,i.dpr),d=t.isPointInStroke(u.x,u.y),d})),this.canvasRenderer.z=0,i.modelMatrix!==c&&Fo.free(i.modelMatrix),i.modelMatrix=c,i.highPerformanceRestore(),d}};Au=ku([L(),Eu(0,B(oh)),Cu("design:paramtypes",[Object])],Au);let Ou=!1;const Bu=new v(((t,e,r,i)=>{Ou||(Ou=!0,t(Zc).to(Au).inSingletonScope(),t(Qc).toService(Zc))}));var Ru=function(t,e,r,i){var n,s=arguments.length,o=s<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,e,r,i);else for(var a=t.length-1;a>=0;a--)(n=t[a])&&(o=(s<3?n(o):s>3?n(e,r,o):n(e,r))||o);return s>3&&o&&Object.defineProperty(e,r,o),o},Lu=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Pu=function(t,e){return function(r,i){e(r,i,t)}};let Du=class extends Tu{constructor(t){super(),this.canvasRenderer=t,this.type="text",this.numberType=Eo}contains(t,e,r){const{pickContext:i}=null!=r?r:{};if(!i)return!1;const n=t.AABBBounds;if(!i.camera)return!!n.containsPoint(e);i.highPerformanceSave();const s=t.getGraphicTheme(),{keepDirIn3d:o=s.keepDirIn3d}=t.attribute,a=!o,l=this.transform(t,s,i,a),{x:h,y:c,z:u,lastModelMatrix:d}=l;this.canvasRenderer.z=u;let p=e;if(i.camera){p=e.clone();const r=t.parent.globalTransMatrix;p.x=r.a*e.x+r.c*e.y+r.e,p.y=r.b*e.x+r.d*e.y+r.f}let f=!1;return this.canvasRenderer.drawShape(t,i,h,c,{},null,((e,r,i)=>{if(f)return!0;const{fontSize:n=s.fontSize,textBaseline:o=s.textBaseline,textAlign:a=s.textAlign}=t.attribute,l=t.AABBBounds,d=l.height(),g=l.width(),m=Ea(o,d,n),y=Ca(a,g);return e.rect(y+h,m+c,g,d,u),f=e.isPointInPath(p.x,p.y),f}),((t,e,r)=>f)),this.canvasRenderer.z=0,i.modelMatrix!==d&&Fo.free(i.modelMatrix),i.modelMatrix=d,i.highPerformanceRestore(),f}};Du=Ru([L(),Pu(0,B(ah)),Lu("design:paramtypes",[Object])],Du);let Mu=!1;const Iu=new v(((t,e,r,i)=>{Mu||(Mu=!0,t(Kc).to(Du).inSingletonScope(),t(Qc).toService(Kc))})),Nu=Ac();function Fu(){Fu.__loaded||(Fu.__loaded=!0,Ja.RegisterGraphicCreator("group",ea))}Fu.__loaded=!1;const ju=Fu;function zu(){zu.__loaded||(zu.__loaded=!0,Ja.RegisterGraphicCreator("rect",Ya),Ai.load(Fc),Ai.load(Nu?Su:au))}zu.__loaded=!1;const Hu=zu;function Wu(){Wu.__loaded||(Wu.__loaded=!0,Ja.RegisterGraphicCreator("symbol",Wa),Ai.load(zc),Ai.load(Nu?Bu:pu))}Wu.__loaded=!1;const Uu=Wu;function $u(){$u.__loaded||($u.__loaded=!0,Ja.RegisterGraphicCreator("text",ja),Ai.load(Wc),Ai.load(Nu?Iu:yu))}$u.__loaded=!1;const Vu=$u;var Gu;!function(t){t.selected="selected",t.selectedReverse="selected_reverse",t.hover="hover",t.hoverReverse="hover_reverse"}(Gu||(Gu={})),Gu.selectedReverse,Gu.selected,Gu.hover,Gu.hoverReverse;function Xu(){return"browser"===mc.env?["pointerup","pointerleave","pointercancel"]:["pointerup","pointerleave","pointerupoutside"]}const Yu={debounce:Jt,throttle:function(t,e,r){let i=!0,n=!0;if("function"!=typeof t)throw new TypeError("Expected a function");return xt(r)&&(i="leading"in r?!!r.leading:i,n="trailing"in r?!!r.trailing:n),Jt(t,e,{leading:i,trailing:n,maxWait:e})}};ju(),Hu();class qu extends $c{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:Ut({},qu.defaultAttributes,t)),this.name="scrollbar",this._handleTouchMove=t=>{wt(this._prePos)&&t.preventDefault()},this._onRailPointerDown=t=>{const{viewX:e,viewY:r}=t,{direction:i,width:n,height:s,range:o}=this.attribute,a=this._sliderSize,[l,h]=this._getScrollRange();let c;if("vertical"===i){const t=r-this._viewPosition.y,e=Zt(t-a/2,l,h);c=t/s,this._slider.setAttribute("y",e,!0)}else{const t=e-this._viewPosition.x,r=Zt(t-a/2,l,h);c=t/n,this._slider.setAttribute("x",r,!0)}this.setScrollRange([c-(o[1]-o[0])/2,c+(o[1]-o[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:r}=this.attribute,{x:i,y:n}=this.stage.eventPointTransform(t);this._prePos="horizontal"===r?i:n,this._dispatchEvent("scrollDown",{pos:this._prePos,event:t});const s=Xu(),o="browser"===mc.env?mc:this.stage;o.addEventListener("pointermove",this._onSliderPointerMoveWithDelay,{capture:!0}),s.forEach((t=>{o.addEventListener(t,this._onSliderPointerUp)}))},this._computeScrollValue=t=>{const{direction:e}=this.attribute,{x:r,y:i}=this.stage.eventPointTransform(t);let n,s,o=0;const{width:a,height:l}=this.getSliderRenderBounds();return"vertical"===e?(s=i,o=s-this._prePos,n=o/l):(s=r,o=s-this._prePos,n=o/a),[s,n]},this._onSliderPointerMove=t=>{const{stopSliderMovePropagation:e=!0}=this.attribute;e&&t.stopPropagation();const r=this.getScrollRange(),[i,n]=this._computeScrollValue(t);this.setScrollRange([r[0]+n,r[1]+n],!0),this._prePos=i},this._onSliderPointerMoveWithDelay=0===this.attribute.delayTime?this._onSliderPointerMove:Yu[this.attribute.delayType](this._onSliderPointerMove,this.attribute.delayTime),this._onSliderPointerUp=t=>{const{range:e,limitRange:r=[0,1]}=this.attribute,i=this.getScrollRange(),[n,s]=this._computeScrollValue(t),o=[i[0]+s,i[1]+s];this._prePos=null,this._dispatchEvent("scrollUp",{pre:e,value:Kt(o,r[0],r[1])}),this._clearDragEvents()}}setScrollRange(t,e=!0){const{direction:r="horizontal",limitRange:i=[0,1],range:n,realTime:s=!0}=this.attribute,o=Kt(t,i[0],i[1]);if(e){const t=this._getSliderPos(o);if(this._slider){const e=t[1]-t[0];this._sliderSize=e,"horizontal"===r?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=o,s&&this._dispatchEvent("scrollDrag",{pre:n,value:o})}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",Yu[t](this._onRailPointerDown,e)),this._slider&&this._slider.addEventListener("pointerdown",this._onSliderPointerDown),("browser"===mc.env?mc:this.stage).addEventListener("touchmove",this._handleTouchMove,{passive:!1})}render(){this._reset();const{direction:t="horizontal",width:e,height:r,range:i,limitRange:n=[0,1],railStyle:s,sliderStyle:o,padding:a=2}=this.attribute,l=this.createOrUpdateChild("scrollbar-container",{},"group"),h=l.createOrUpdateChild("scrollbar-rail",Object.assign({x:0,y:0,width:e,height:r},s),"rect");this._rail=h;const c=this.getSliderRenderBounds(),u=this._getSliderPos(Kt(i,n[0],n[1])),d=u[1]-u[0];let p;this._sliderSize=d,p="horizontal"===t?{x:u[0],y:c.y1,width:d,height:c.height}:{x:c.x1,y:u[0],width:c.width,height:d};const f=l.createOrUpdateChild("slider",Object.assign(Object.assign(Object.assign(Object.assign({},p),{cornerRadius:this._getDefaultSliderCornerRadius()}),o),{boundsPadding:Me(a),pickMode:"imprecise"}),"rect");this._slider=f,this._container=l;const g=this._container.AABBBounds;this._viewPosition={x:g.x1,y:g.y1}}getSliderRenderBounds(){if(this._sliderRenderBounds)return this._sliderRenderBounds;const{width:t,height:e,padding:r=2}=this.attribute,[i,n,s,o]=Me(r),a={x1:o,y1:i,x2:t-n,y2:e-s,width:Math.max(0,t-(o+n)),height:Math.max(0,e-(i+s))};return this._sliderRenderBounds=a,a}_getDefaultSliderCornerRadius(){const{direction:t,round:e}=this.attribute;if(e){const{width:e,height:r}=this.getSliderRenderBounds();return"horizontal"===t?r:e}return 0}_getSliderPos(t){const{direction:e}=this.attribute,{width:r,height:i,x1:n,y1:s}=this.getSliderRenderBounds();return"horizontal"===e?[r*t[0]+n,r*t[1]+n]:[i*t[0]+s,i*t[1]+s]}_getScrollRange(){if(this._sliderLimitRange)return this._sliderLimitRange;const{limitRange:t=[0,1],direction:e}=this.attribute,[r,i]=Kt(t,0,1),{width:n,height:s,x1:o,y1:a}=this.getSliderRenderBounds(),l=this._sliderSize;return"horizontal"===e?Kt([o+r*n,o+i*n],o,n-l):Kt([a+r*s,a+i*s],a,s-l)}_clearDragEvents(){const t=Xu(),e="browser"===mc.env?mc: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"===mc.env?mc:this.stage).addEventListener("touchmove",this._handleTouchMove,{passive:!1}),this._clearDragEvents()}}qu.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 Zu=function(t,e){var r={};for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&e.indexOf(i)<0&&(r[i]=t[i]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(i=Object.getOwnPropertySymbols(t);n<i.length;n++)e.indexOf(i[n])<0&&Object.prototype.propertyIsEnumerable.call(t,i[n])&&(r[i[n]]=t[i[n]])}return r};const Ku=new Le;ju(),Vu(),Uu(),Hu();const Qu="M -0.5 -0.5, L -0.5 0.5, L 0.5 -0.5, Z",Ju="M -0.5 -0.5, L -0.5 0.5, L 0.5 0.5, Z",td="M -0.5 -0.5, L 0.5 -0.5, L 0.5 0.5, Z",ed="M 0.5 -0.5, L 0.5 0.5, L -0.5 0.5, Z",rd={tl:Qu,tr:td,bl:Ju,br:ed,lt:Qu,lb:Ju,rt:td,rb:ed};class id extends $c{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:Ut({},id.defaultAttributes,t)),this.name="poptip",this.positionList=["top","tl","tr","bottom","bl","br","left","lt","lb","right","rt","rb"]}render(){var t,e,r,i,n,s,o,a,l;const{titleStyle:h={},position:c,contentStyle:u={},panel:d,logoSymbol:p,poptipAnchor:f="position",logoText:g,logoTextStyle:m={},triangleMode:y="default",space:v=4,minWidth:b=0,maxWidth:_=1/0,padding:w=4,maxWidthPercent:x,visible:S,state:T,dx:k=0,dy:C=0,positionBounds:E}=this.attribute;let{title:A="",content:O=""}=this.attribute;A=this.attribute.titleFormatMethod?this.attribute.titleFormatMethod(A):A,O=this.attribute.contentFormatMethod?this.attribute.contentFormatMethod(O):O;const B=Me(w),R=this.createOrUpdateChild("poptip-content",{x:0,y:0,zIndex:1},"group");this.group=R;const L=_-B[1]-B[3],P=wt(A)&&!1!==S,D=Object.assign(Object.assign({text:Et(A)?A:[A],visible:P,wrap:!0},h),{x:B[3],y:B[0],maxLineWidth:L,textAlign:"left",textBaseline:"top"}),M=R.createOrUpdateChild("poptip-title",D,"text");Nt(null==T?void 0:T.title)||(M.states=T.title);const I=M.AABBBounds,N=I.height(),F=I.width();let j=N+v;P||(j=0);const z=wt(O)&&!1!==S,H=Object.assign(Object.assign({text:Et(O)?O:[O],visible:z,wrap:!0},u),{x:B[3],y:B[0]+j,maxLineWidth:L,textAlign:"left",textBaseline:"top"}),W=R.createOrUpdateChild("poptip-content",H,"text");Nt(null==T?void 0:T.content)||(W.states=T.content);const U=W.AABBBounds,$=U.height(),V=U.width();z&&(j+=$),this.titleShape=M,this.contentShape=W;let G=le(F+B[1]+B[3],V+B[1]+B[3]);G>_?G=_:G<b&&(G=b);let X=B[0]+B[2]+j;const{visible:Y,square:q}=d,Z=Zu(d,["visible","square"]);if(q){const t=le(G,X);G=t;const e=t-X;X=t,M.setAttributes({dy:e/2}),W.setAttributes({dy:e/2})}const K=null!==(t=Z.size)&&void 0!==t?t:12,Q=Et(K)?[K[0]+(null!==(e=Z.space)&&void 0!==e?e:0),K[1]+(null!==(r=Z.space)&&void 0!==r?r:0)]:K+(null!==(i=Z.space)&&void 0!==i?i:0),J=null!==(n=Z.lineWidth)&&void 0!==n?n:1,tt=this.stage?[null!==(s=this.stage.viewWidth)&&void 0!==s?s:this.stage.width,null!==(o=this.stage.viewHeight)&&void 0!==o?o:this.stage.height]:void 0;if(tt){const t=this.AABBBounds,e=null!==(a=this.attribute.x)&&void 0!==a?a:t.x1,r=tt[0]-t.x1;let i=Math.max(e,r);const n=(Et(K)?K[0]:12)+3;if(i=Math.min(i-n,i*x),i<G){G=i;const t=B[1]+B[3];M.setAttribute("maxLineWidth",i-t),W.setAttribute("maxLineWidth",i-t),X=B[0]+B[2],P&&(X+=M.AABBBounds.height()+v),X+=W.AABBBounds.height()}}const et="auto"===c||Et(c),rt=Et(c)?c:this.positionList;let it,nt=-1/0;for(let t=0;t<rt.length+1;t++){const e=et?rt[t===rt.length?it:t]:c;let r="arrow2Left",i=(Et(K)?K[0]:K)/4,n=0;"top"===e||"bottom"===e||"left"===e||"right"===e?r="arrow2Left":"concise"===y&&(r=rd[e],i=["tl","bl","rt","rb"].includes(e)?(Et(K)?K[0]:K)/2:-(Et(K)?K[0]:K)/2,n=["tl","tr","lb","rb"].includes(e)?-(Et(K)?K[1]:K)/2:(Et(K)?K[1]:K)/2);const{angle:s,offset:o}=this.getAngleAndOffset(e,G,X,Et(Q)?Q:[Q,Q-J],r);let a,h={x:0,y:0};if("bounds"===f&&E&&(h=this.calculateAnchorPoint(e,E)),vt(Y)){let t;a=R.createOrUpdateChild("poptip-symbol-panel",Object.assign(Object.assign({},Z),{visible:Y&&(z||P),x:i,y:n,strokeBoundsBuffer:-1,boundsPadding:-2,anchor:[0,0],symbolType:r,angle:s,dx:o[0],dy:o[1]-(null!==(l=Z.space)&&void 0!==l?l:0),size:K,zIndex:9}),"symbol"),Nt(null==T?void 0:T.panel)||(a.states=T.panel),t=d.panelSymbolType?R.createOrUpdateChild("poptip-rect-panel",Object.assign(Object.assign({},Z),{visible:Y&&(z||P),x:0,y:0,symbolType:"rect",size:[G,X],zIndex:-8}),"symbol"):R.createOrUpdateChild("poptip-rect-panel",Object.assign(Object.assign({},Z),{visible:Y&&(z||P),x:0,y:0,width:G,height:X,zIndex:-8}),"rect"),Nt(null==T?void 0:T.panel)||(t.states=T.panel)}if(R.setAttributes({x:-o[0]+k+h.x,y:-o[1]+C+h.y,anchor:[i,n]}),p){const{size:t=12}=p,e=Et(t)?t:[t,t];"auto"===e[1]&&(e[1]=X),"auto"===e[0]&&(e[0]=X);const r=e[0];R.createOrUpdateChild("poptip-logo",Object.assign(Object.assign({},p),{x:0,y:X/2,visible:Y&&(z||P),zIndex:10,size:e}),"symbol"),R.setAttributes({x:-o[0]+k+r/2,y:-o[1]+C}),g&&R.createOrUpdateChild("poptip-logo-text",Object.assign(Object.assign({},m),{x:0,y:X/2,visible:Y&&(z||P),text:g,textAlign:"center",textBaseline:"middle",zIndex:10}),"text")}if(!tt)break;{Ku.setValue(0,0,G,X).transformWithMatrix(R.globalTransMatrix);const r=Ku,i=(new Re).setValue(0,0,tt[0],tt[1]);if(et){if(_e(r,i,!1))break;{const e=ye(r,i,!1),n=(e.x2-e.x1)*(e.y2-e.y1);n>nt&&(nt=n,it=t)}}if(["top","bottom","left","right"].includes(e)){const t="top"===e||"bottom"===e,n="left"===e||"right"===e;let s=!1;if(t?s="top"===e&&r.y1<0||"bottom"===e&&r.y2>i.y2:n&&(s="left"===e&&r.x1<0||"right"===e&&r.x2>i.x2),!s){let e=0;const s=(Et(K)?K[1]:K)/2;t?(r.x1<0?e=-r.x1:r.x2>i.x2&&(e=i.x2-r.x2),R.setAttribute("x",R.attribute.x+e),a.setAttribute("dx",he(le(a.attribute.dx-e,s),r.width()-s))):n&&(r.y1<0?e=-r.y1:r.y2>i.y2&&(e=i.y2-r.y2),R.setAttribute("y",R.attribute.y+e),a.setAttribute("dy",he(le(a.attribute.dy-e,s),r.height()-s)));break}}if(!et)break}}}calculateAnchorPoint(t,e){if(!e)return{x:0,y:0};const{x:r,y:i}=this.attribute,{x1:n,y1:s,x2:o,y2:a}=e,l=o-n,h=a-s;switch(t){case"top":case"tl":case"tr":return{x:n+l/2-r,y:s-i};case"bottom":case"bl":case"br":return{x:n+l/2-r,y:a-i};case"left":case"lt":case"lb":return{x:n-r,y:s+h/2-i};case"right":case"rt":case"rb":return{x:o-r,y:s+h/2-i};default:return{x:0,y:0}}}getAngleAndOffset(t,e,r,i,n){const s="arrow2Left"===n?i[1]/2:i[1];switch(t){case"tl":return{angle:"arrow2Left"===n?ee/2*3:0,offset:"arrow2Left"===n?[e/4,r+s]:[0,r+s]};case"top":return{angle:ee/2*3,offset:[e/2,r+s]};case"tr":return{angle:"arrow2Left"===n?ee/2*3:0,offset:"arrow2Left"===n?[e/4*3,r+s]:[e,r+s]};case"rt":return{angle:0,offset:"arrow2Left"===n?[-s,r/5]:[-s,0]};case"right":return{angle:0,offset:[-s,r/2]};case"rb":return{angle:0,offset:"arrow2Left"===n?[-s,r/5*4]:[-s,r]};case"bl":return{angle:"arrow2Left"===n?ee/2:0,offset:"arrow2Left"===n?[e/4,-s]:[0,-s]};case"bottom":return{angle:ee/2,offset:[e/2,-s]};case"br":return{angle:"arrow2Left"===n?ee/2:0,offset:"arrow2Left"===n?[e/4*3,-s]:[e,-s]};case"lt":return{angle:"arrow2Left"===n?ee:0,offset:"arrow2Left"===n?[e+s,r/5]:[e+s,0]};case"left":return{angle:ee,offset:[e+s,r/2]};case"lb":return{angle:"arrow2Left"===n?ee:0,offset:"arrow2Left"===n?[e+s,r/5*4]:[e+s,r]}}}}function nd(t,e){var r,i,n,s,o,a,l,h;return!t&&!e||!(!t||!e)&&(null===(r=t.start)||void 0===r?void 0:r.col)===(null===(i=e.start)||void 0===i?void 0:i.col)&&(null===(n=t.start)||void 0===n?void 0:n.row)===(null===(s=e.start)||void 0===s?void 0:s.row)&&(null===(o=t.end)||void 0===o?void 0:o.col)===(null===(a=e.end)||void 0===a?void 0:a.col)&&(null===(l=t.end)||void 0===l?void 0:l.row)===(null===(h=e.end)||void 0===h?void 0:h.row)}id.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 sd=(t,e)=>Object.prototype.toString.call(t)===`[object ${e}]`;var od=(t,e=!1)=>e?"boolean"==typeof t:!0===t||!1===t||sd(t,"Boolean");var ad=t=>"function"==typeof t;var ld=t=>null!=t;var hd=(t,e=!1)=>{const r=typeof t;return e?"string"===r:"string"===r||sd(t,"String")};var cd=t=>Array.isArray?Array.isArray(t):sd(t,"Array");var ud=t=>sd(t,"Date");var dd=(t,e=!1)=>{const r=typeof t;return e?"number"===r:"number"===r||sd(t,"Number")};function pd(t,e,r){let i;if(!ld(t)||"object"!=typeof t||e&&e(t))return t;const n=cd(t),s=t.length;i=n?new Array(s):"object"==typeof t?{}:od(t)||dd(t)||hd(t)?t:ud(t)?new Date(+t):void 0;const o=n?void 0:Object.keys(Object(t));let a=-1;if(i)for(;++a<(o||t).length;){const n=o?o[a]:a,s=t[n];r&&r.includes(n.toString())?i[n]=s:i[n]=pd(s,e,r)}return i}const fd="undefined"==typeof window||void 0===window.window;function gd(t,e,r){return t.start.col<=e&&e<=t.end.col&&t.start.row<=r&&r<=t.end.row||t.end.col<=e&&e<=t.start.col&&t.end.row<=r&&r<=t.start.row||t.end.col<=e&&e<=t.start.col&&t.start.row<=r&&r<=t.end.row||t.start.col<=e&&e<=t.end.col&&t.end.row<=r&&r<=t.start.row}!function(){if(fd)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 md(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 yd(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 vd(t){return Math.floor(t)===t}function bd(t){this.rotateDegree=90;const e=t.clientWidth<t.clientHeight?Math.max(t.clientWidth,t.clientHeight)/2:Math.min(t.clientWidth,t.clientHeight)/2,r=this.getElement().getBoundingClientRect(),i=r.left,n=r.top,s=r.right,o=r.bottom;t.style.transform="rotate(90deg)",t.style.transformOrigin=`${e}px ${e}px`;const a=()=>({x1:i,y1:n,x2:s,y2:o}),l=()=>{const r=("undefined"!=typeof window?{width:window.innerWidth||document.documentElement.clientWidth,height:window.innerHeight||document.documentElement.clientHeight}:mc&&mc.getViewportSize?mc.getViewportSize():t.getBoundingClientRect()).width,i=this.getElement().getBoundingClientRect(),n=i.top,s=r-i.right,o=No.allocate(1,0,0,1,0,0);o.translate(n,s);const a=e-n,l=e-s;o.translate(a,l),o.rotate(Math.PI/2),o.translate(-a,-l);const h=this.pluginManager.getPluginByName("Rotate Table");return h&&(h.matrix=o),o};Dc(mc,this.getElement(),l,a,Mc),Pc(this.scenegraph.stage.window,this.getElement(),l,a,Mc);const h=this.pluginManager.getPluginByName("Rotate Table");h&&(h.vglobal_mapToCanvasPoint=mc.mapToCanvasPoint),mc.mapToCanvasPoint=Ic}function _d(t){this.rotateDegree=0,t.style.transform="none",t.style.transformOrigin="none";const e=this.getElement().getBoundingClientRect(),r=e.left,i=e.top,n=e.right,s=e.bottom,o=()=>({x1:r,y1:i,x2:n,y2:s}),a=()=>{const t=No.allocate(1,0,0,1,0,0);return t.translate(r,i),t};Dc(mc,this.getElement(),a,o,Mc),Pc(this.scenegraph.stage.window,this.getElement(),a,o,Mc);const l=this.pluginManager.getPluginByName("Rotate Table");l&&(mc.mapToCanvasPoint=l.vglobal_mapToCanvasPoint)}var wd,xd,Sd,Td;!function(t){t.default="default",t.grabing="grabing",t.scrolling="scrolling"}(wd||(wd={})),function(t){t.FinishToStart="finish_to_start",t.StartToStart="start_to_start",t.FinishToFinish="finish_to_finish",t.StartToFinish="start_to_finish"}(xd||(xd={})),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"}(Sd||(Sd={})),function(t){t.TASK="task",t.PROJECT="project",t.MILESTONE="milestone"}(Td||(Td={}));const kd={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",MOVE_END_TASK_BAR:"move_end_task_bar"};function Cd(t,e){let r=null;return function(...i){r||(t.apply(this,i),r=setTimeout((()=>{r=null}),e))}}function Ed(t,e){const r=t.getFullYear().toString(),i=(t.getMonth()+1).toString().padStart(2,"0"),n=t.getDate().toString().padStart(2,"0");if((e=(e=(e=e.replace("yyyy",r)).replace("mm",i)).replace("dd",n)).length>10){const r=t.getHours().toString().padStart(2,"0"),i=t.getMinutes().toString().padStart(2,"0"),n=t.getSeconds().toString().padStart(2,"0");e=(e=(e=e.replace("hh",r)).replace("mm",i)).replace("ss",n)}return e}function Ad(t,e){const r=e.indexOf("yyyy"),i=e.indexOf("mm"),n=e.indexOf("dd"),s=i<r?i<n?0:1:i<n?1:2,o=n<r?n<i?0:1:n<i?1:2,a=parseInt(t[r<i?r<n?0:1:i<n?1:2],10),l=parseInt(t[s],10)-1,h=parseInt(t[o],10);if(isNaN(a)||a<1)return!1;if(isNaN(l)||l<0||l>11)return!1;const c=[31,Bd(a)?29:28,31,30,31,30,31,31,30,31,30,31];return!(isNaN(h)||h<1||h>c[l])}function Od(t,e){if(e.includes("hh")||e.includes("mm")||e.includes("ss")){const r=e.indexOf("hh")>-1?e.indexOf("hh"):e.indexOf("HH"),i=parseInt(t[r],10),n=parseInt(t[r+1],10),s=t.length>r+2?parseInt(t[r+2],10):0;if(isNaN(i)||i<0||i>23)return!1;if(isNaN(n)||n<0||n>59)return!1;if(isNaN(s)||s<0||s>59)return!1}return!0}function Bd(t){return t%4==0&&t%100!=0||t%400==0}function Rd(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"],r=["hh:mm:ss","hh:mm"],i=(t=t.trim()).split(" "),n=i[0],s=i[1];let o,a;if(n)for(let t=0;t<e.length;t++){const r=e[t],i=n.split(Ld(r)),s=Ad(i,r);if(3===i.length&&s){o=r;break}}if(o&&s)for(let t=0;t<r.length;t++){const e=r[t],i=s.split(Ld(e)),n=e.split(Ld(e));if(Od(i,e)&&i.length===n.length){a=e;break}}return n&&s&&o&&a?o+" "+a:n&&!s?o:"yyyy-mm-dd hh:mm:ss"}function Ld(t){const e=t.match(/[^\w]/g);if(e){const t=e.map((t=>"\\"+t)).join("|");return new RegExp(t,"g")}return/[^\w]/}function Pd(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 Dd(t){const e=new Date(t.getFullYear(),0,1);return Math.ceil(((t.getTime()+1-e.getTime())/864e5+1)/7)}function Md(t,e=!1){let r;if(t){if(r=new Date(t),"string"==typeof t){if(t.length>10)return e&&r.setHours(0,0,0,0),r;r.setHours(0,0,0,0)}}else r=new Date;return e&&r.setHours(0,0,0,0),r}function Id(t,e=!1){let r;if(t){if(r=new Date(t),"string"==typeof t){if(t.length>10)return e&&r.setMinutes(59,59,999),r;r.setMinutes(59,59,999)}}else r=new Date;return e&&r.setMinutes(59,59,999),r}function Nd(t,e=!1){let r;if(t){if(r=new Date(t),"string"==typeof t){if(t.length>10)return e&&r.setSeconds(59,999),r;r.setSeconds(59,999)}}else r=new Date;return e&&r.setSeconds(59,999),r}function Fd(t,e=!1){let r;if(t){if(r=new Date(t),"string"==typeof t){if(t.length>10)return e&&r.setMilliseconds(999),r;r.setMilliseconds(999)}}else r=new Date;return e&&r.setMilliseconds(999),r}function jd(t,e=!1){let r;if(t){if(r=new Date(t),"string"==typeof t){if(t.length>10)return e&&r.setHours(23,59,59,999),r;r.setHours(23,59,59,999)}}else r=new Date;return e&&r.setHours(23,59,59,999),r}function zd(t,e,r,i){let n=new Date(e);switch(r){case"second":n.setMilliseconds(999);break;case"minute":n.setSeconds(59,999);break;case"hour":n.setMinutes(59,59,999);break;case"day":n.setHours(23,59,59,999);break;case"week":const t=6-n.getDay();n.setDate(n.getDate()+t),n.setHours(23,59,59,999);break;case"month":const e=new Date(n.getFullYear(),n.getMonth()+1,0).getDate();n.setDate(e),n.setHours(23,59,59,999);break;case"quarter":const r=n.getMonth(),i=r-r%3+2,s=new Date(n.getFullYear(),i+1,0).getDate();n.setMonth(i,s),n.setHours(23,59,59,999);break;case"year":n.setMonth(11,31),n.setHours(23,59,59,999);break;default:throw new Error("Invalid time scale")}const s=Wd(n,t,r,i,1),o=Math.ceil(s);if(o>s){const t=(o-s)*i,e=1e3,a=60*e,l=60*a,h=24*l,c=7*h;switch(new Date(n.getTime()+1),r){case"second":n.setTime(n.getTime()+t*e);break;case"minute":n.setTime(n.getTime()+t*a);break;case"hour":n.setTime(n.getTime()+t*l);break;case"day":n.setTime(n.getTime()+t*h);break;case"week":n.setTime(n.getTime()+t*c);break;case"month":n=new Date(n.getFullYear(),n.getMonth()+1+Math.round(t),0),n.setHours(23,59,59,999);break;case"quarter":const r=n.getMonth(),i=r-r%3+2;n=new Date(n.getFullYear(),i+Math.round(3*t)+1,0),n.setHours(23,59,59,999);break;case"year":n.setFullYear(n.getFullYear()+Math.floor(t)),n.setHours(23,59,59,999);break;default:throw new Error("Invalid time scale")}}return n}function Hd(t,e,r="monday"){const i=new Date(t);switch(e){case"second":i.setMilliseconds(0);break;case"minute":i.setSeconds(0,0);break;case"hour":i.setMinutes(0,0,0);break;case"day":i.setHours(0,0,0,0);break;case"week":const t=i.getDay();let e=t;e="monday"===r?0===t?-6:1-t:-t,i.setDate(i.getDate()+e),i.setHours(0,0,0,0);break;case"month":i.setDate(1),i.setHours(0,0,0,0);break;case"quarter":const n=i.getMonth(),s=n-n%3;i.setMonth(s,1),i.setHours(0,0,0,0);break;case"year":i.setMonth(0,1),i.setHours(0,0,0,0);break;default:throw new Error("Invalid time scale")}return i}function Wd(t,e,r,i,n=0){let s;const o=new Date(t.getTime()+n);switch(r){case"second":s=(o.getTime()-e.getTime())/1e3;break;case"minute":s=(o.getTime()-e.getTime())/6e4;break;case"hour":s=(o.getTime()-e.getTime())/36e5;break;case"day":s=(o.getTime()-e.getTime())/864e5;break;case"week":s=(o.getTime()-e.getTime())/6048e5;break;case"month":s=12*(o.getFullYear()-e.getFullYear())+(o.getMonth()-e.getMonth()),s+=(o.getDate()-e.getDate())/new Date(o.getFullYear(),o.getMonth()+1,0).getDate();break;case"quarter":s=4*(o.getFullYear()-e.getFullYear())+(o.getMonth()-e.getMonth())/3,s+=(o.getDate()-e.getDate())/(3*new Date(o.getFullYear(),o.getMonth()+1,0).getDate());break;case"year":s=o.getFullYear()-e.getFullYear(),s+=(o.getMonth()-e.getMonth())/12;break;default:throw new Error("Invalid time scale")}return s/i}class Ud{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 ta({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,r,i,n,s;const o=this._scene._gantt.parsedOptions,a=null!==(e=null===(t=o.horizontalSplitLine)||void 0===t?void 0:t.lineWidth)&&void 0!==e?e:null===(r=o.timelineHeaderHorizontalLineStyle)||void 0===r?void 0:r.lineWidth,l=(1&a?-.5:0)+a/2,h=Va({pickable:!1,stroke:null!==(n=null===(i=o.horizontalSplitLine)||void 0===i?void 0:i.lineColor)&&void 0!==n?n:null===(s=o.timelineHeaderHorizontalLineStyle)||void 0===s?void 0:s.lineColor,lineWidth:a+(1&a?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 r=this._scene._gantt.parsedOptions.grid,i=null!==(t=r.verticalLineDependenceOnTimeScale)&&void 0!==t?t:this._scene._gantt.parsedOptions.reverseSortedTimelineScales[0].unit;if(r.verticalLine){this.verticalLineGroup=new ta({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===i)))&&void 0!==e?e:this._scene._gantt.parsedOptions.reverseSortedTimelineScales[0],{unit:n,step:s}=this._scene._gantt.parsedOptions.reverseSortedTimelineScales[0],{timelineDates:o}=t,a=this._scene._gantt.parsedOptions.timelineColWidth;if("function"==typeof r.verticalLine)for(let t=0;t<(null==o?void 0:o.length)-1;t++){const{endDate:e}=o[t],i=r.verticalLine({index:t,dateIndex:o[t].dateIndex,date:o[t].endDate,ganttInstance:this._scene._gantt}),l=Math.ceil(Wd(e,this._scene._gantt.parsedOptions.minDate,n,s,1)*a)+(1&i.lineWidth?.5:0),h=Va({pickable:!1,stroke:i.lineColor,lineWidth:i.lineWidth,points:[{x:l,y:0},{x:l,y:this.allGridHeight}]});this.verticalLineGroup.appendChild(h)}else{const t=r.verticalLine;for(let e=0;e<(null==o?void 0:o.length)-1;e++){const{endDate:r}=o[e],i=Math.ceil(Wd(r,this._scene._gantt.parsedOptions.minDate,n,s,1)*a)+(1&t.lineWidth?.5:0),l=Va({pickable:!1,stroke:t.lineColor,lineWidth:t.lineWidth,points:[{x:i,y:0},{x:i,y:this.allGridHeight}]});this.verticalLineGroup.appendChild(l)}}}}createHorizontalLines(){const t=this._scene._gantt.parsedOptions.grid;if(t.horizontalLine)if(this.horizontalLineGroup=new ta({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 r=0;r<this.rowCount-1;r++){const i=t.horizontalLine({index:r,ganttInstance:this._scene._gantt});e+=this._scene._gantt.getRowHeightByIndex(r);const n=Va({pickable:!1,stroke:i.lineColor,lineWidth:i.lineWidth,points:[{x:0,y:e},{x:this.allGridWidth,y:e}]});this.horizontalLineGroup.appendChild(n)}}else{const e=t.horizontalLine;let r=0;1&e.lineWidth&&(r+=.5);for(let t=0;t<this.rowCount-1;t++){r+=this._scene._gantt.getRowHeightByIndex(t);const i=Va({pickable:!1,stroke:e.lineColor,lineWidth:e.lineWidth,points:[{x:0,y:r},{x:this.allGridWidth,y:r}]});this.horizontalLineGroup.appendChild(i)}}}createVerticalBackgroundRects(){const t=this._scene._gantt.parsedOptions.grid.verticalBackgroundColor,e=this._scene._gantt.parsedOptions.grid.weekendBackgroundColor;if(t||e){this.verticalBackgroundRectsGroup=new ta({x:0,y:0,width:this.allGridWidth,height:this.allGridHeight}),this.verticalBackgroundRectsGroup.name="grid-vertical-background",this.group.appendChild(this.verticalBackgroundRectsGroup);const{timelineDates:r,unit:i,step:n}=this._scene._gantt.parsedOptions.reverseSortedTimelineScales[0],s=this._scene._gantt.parsedOptions.timelineColWidth;if(t||e)for(let o=0;o<=(null==r?void 0:r.length)-1;o++){let a;if(!e||"day"!==i||1!==n||0!==r[o].startDate.getDay()&&6!==r[o].startDate.getDay()?"function"==typeof t?a=t({index:o,dateIndex:r[o].dateIndex,date:r[o].endDate,ganttInstance:this._scene._gantt}):t&&(a=t[o%t.length]):a=e,a){const t=Ya({pickable:!1,fill:a,x:Math.ceil(s*o),y:0,width:s,height:this.allGridHeight});this.verticalBackgroundRectsGroup.appendChild(t)}}}}createHorizontalBackgroundRects(){const t=this._scene._gantt.parsedOptions.grid.horizontalBackgroundColor;if(t){this.horizontalBackgroundRectsGroup=new ta({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 r=0;r<=this.rowCount-1;r++){let i;i="function"==typeof t?t({index:r,ganttInstance:this._scene._gantt}):t[r%t.length];const n=Ya({pickable:!1,fill:i,x:0,y:e,width:this.allGridWidth,height:this._scene._gantt.getRowHeightByIndex(r)});this.horizontalBackgroundRectsGroup.appendChild(n),e+=this._scene._gantt.getRowHeightByIndex(r)}}}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,r,i,n;null===(e=this.verticalLineGroup)||void 0===e||e.setAttribute("x",t),null===(r=this.horizontalLineGroup)||void 0===r||r.setAttribute("x",t),null===(i=this.verticalBackgroundRectsGroup)||void 0===i||i.setAttribute("x",t),null===(n=this.horizontalBackgroundRectsGroup)||void 0===n||n.setAttribute("x",t)}setY(t){var e,r,i,n;null===(e=this.verticalLineGroup)||void 0===e||e.setAttribute("y",t),null===(r=this.horizontalLineGroup)||void 0===r||r.setAttribute("y",t),null===(i=this.verticalBackgroundRectsGroup)||void 0===i||i.setAttribute("y",t),null===(n=this.horizontalBackgroundRectsGroup)||void 0===n||n.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 $d{static get mode(){return $d._mode||($d._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}()),$d._mode}static set mode(t){$d._mode=t}static RegisterCreateCanvas(t){$d.CreateCanvas=t}static RegisterLoadImage(t){$d.LoadImage=t}static GetCreateCanvasFunc(){return $d.CreateCanvas?$d.CreateCanvas:"worker"===$d.mode?(t=200,e=200)=>new OffscreenCanvas(t,e):void 0}static RegisterRequestAnimationFrame(t){$d.RequestAnimationFrame=t()}static GetRequestAnimationFrame(){if($d.RequestAnimationFrame)return $d.RequestAnimationFrame}static RegisterCancelAnimationFrame(t){$d.CancelAnimationFrame=t()}static GetCancelAnimationFrame(){if($d.CancelAnimationFrame)return $d.CancelAnimationFrame}}$d.dpr=0;class Vd{constructor(t){this._gantt=t,this.createScrollBar(t.tableNoFrameWidth,t.tableNoFrameHeight-t.getAllHeaderRowsHeight())}createScrollBar(t,e){var r,i;const n=this._gantt.parsedOptions.scrollStyle.scrollRailColor,s=this._gantt.parsedOptions.scrollStyle.scrollSliderColor,o=this._gantt.parsedOptions.scrollStyle.scrollSliderCornerRadius,a=this._gantt.parsedOptions.scrollStyle.width;let l;l=ld(o)?{cornerRadius:o,fill:s}:{fill:s},null===(r=this._gantt.parsedOptions.scrollStyle)||void 0===r||r.visible,null===(i=this._gantt.parsedOptions.scrollStyle)||void 0===i||i.hoverOn,this.hScrollBar=new qu({direction:"horizontal",x:2*-t,y:2*-e,width:t,height:a,padding:0,railStyle:{fill:n},sliderStyle:l,range:[0,.1],visible:!1}),this.hScrollBar.render(),this.hScrollBar.hideAll(),this.vScrollBar=new qu({direction:"vertical",x:2*-t,y:2*-e,width:a,height:e,padding:0,railStyle:{fill:n},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,r=e[1]-e[0],i=t*(1-r);this.vScrollBar.setAttribute("range",[i,i+r]);const n=this.vScrollBar.AABBBounds&&this.vScrollBar.globalAABBBounds;this.vScrollBar._viewPosition={x:n.x1,y:n.y1}}updateHorizontalScrollBarPos(t){const e=this.hScrollBar.attribute.range,r=e[1]-e[0],i=t*(1-r);this.hScrollBar.setAttribute("range",[i,i+r]);const n=this.hScrollBar.AABBBounds&&this.hScrollBar.globalAABBBounds;this.hScrollBar._viewPosition={x:n.x1,y:n.y1}}updateScrollBar(){const t=this._gantt.stateManager.scroll.horizontalBarPos,e=this._gantt.stateManager.scroll.verticalBarPos,r=this._gantt.parsedOptions.scrollStyle,i=null==r?void 0:r.width,n=null==r?void 0:r.visible,s=Math.ceil(this._gantt.scenegraph.ganttGroup.attribute.width),o=Math.ceil(this._gantt.scenegraph.ganttGroup.attribute.height),a=this._gantt.getAllRowsHeight(),l=this._gantt.getAllDateColsWidth(),h=this._gantt.getAllHeaderRowsHeight();if(l>s){const t=Math.min(o,a),e=Math.max(.05,s/l),h=r.hoverOn;let c=0;c=r.barToSide?this._gantt.tableNoFrameHeight-(h?i:-this._gantt.scenegraph.ganttGroup.attribute.y)+this._gantt.tableY:t-(h?i:-this._gantt.scenegraph.ganttGroup.attribute.y)+this._gantt.tableY,this.hScrollBar.setAttributes({x:this._gantt.scenegraph.ganttGroup.attribute.x,y:c,width:s,range:[0,e],visible:"always"===n});const u=this.hScrollBar.AABBBounds&&this.hScrollBar.globalAABBBounds;this.hScrollBar._viewPosition={x:u.x1,y:u.y1},"always"===n&&this.hScrollBar.showAll()}else this.hScrollBar.setAttributes({x:2*-this._gantt.tableNoFrameWidth,y:2*-this._gantt.tableNoFrameHeight,width:0,visible:!1});if(a>o){const t=Math.min(s,l)+this._gantt.scenegraph.ganttGroup.attribute.x,e=Math.max(.05,(o-h)/(a-h));let r=0;const c=this._gantt.parsedOptions.scrollStyle.hoverOn;r=this._gantt.parsedOptions.scrollStyle.barToSide?this._gantt.tableNoFrameWidth-(c?i:-this._gantt.scenegraph.ganttGroup.attribute.x):t-(c?i:-this._gantt.scenegraph.ganttGroup.attribute.x),this.vScrollBar.setAttributes({x:r,y:h+(c?0:this._gantt.scenegraph.ganttGroup.attribute.y)+this._gantt.tableY,height:o-h,range:[0,e],visible:"always"===n});const u=this.vScrollBar.AABBBounds&&this.vScrollBar.globalAABBBounds;this.vScrollBar._viewPosition={x:u.x1,y:u.y1},"always"===n&&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 Gd(t,e,r,i=!0){var n;let{deltaX:s,deltaY:o}=t;t.shiftKey&&t.deltaY&&(s=o,o=0);const[a,l]=function(t,e,r){var i,n;const s=Math.abs(t/e),o=s<=.5?0:t,a=s>2?0:e;return[Math.ceil(o*(null!==(i=r.horizontal)&&void 0!==i?i:0)),Math.ceil(a*(null!==(n=r.vertical)&&void 0!==n?n:0))]}(s,o,{horizontal:1,vertical:1});a&&(e.setScrollLeft(e.scroll.horizontalBarPos+a),r.scenegraph.scrollbarComponent.showHorizontalScrollBar(!0)),l&&(e.setScrollTop(e.scroll.verticalBarPos+l),r.scenegraph.scrollbarComponent.showVerticalScrollBar(!0)),i&&e.resetInteractionState(),(null===(n=t.nativeEvent)||void 0===n?void 0:n.cancelable)&&("none"===e._gantt.parsedOptions.overscrollBehavior||Math.abs(o)>=Math.abs(s)&&0!==o&&Xd(o,e)||Math.abs(o)<=Math.abs(s)&&0!==s&&Yd(s,e))&&t.preventDefault()}function Xd(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 r=e._gantt.getAllRowsHeight()-e._gantt.scenegraph.height;return 0!==r&&t>=0&&Math.abs(e.scroll.verticalBarPos-r)<1}(t,e)}function Yd(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 r=e._gantt.getAllDateColsWidth()-e._gantt.scenegraph.width;return 0!==r&&t>=0&&Math.abs(e.scroll.horizontalBarPos-r)<1}(t,e)}const qd={barColor:"blue",completedBarColor:"gray",width:30,cornerRadius:3,borderWidth:0,fontFamily:"Arial",fontSize:14};const Zd="undefined"==typeof window||void 0===window.window;function Kd(t,e){const r=t+e.stateManager.scroll.horizontalBarPos,i=e.getDateColWidth(0);return Math.floor((r-i)/e.parsedOptions.timelineColWidth)+1}function Qd(t){var e,r,i,n,s;return t?!0===t?[{date:Md().toLocaleDateString(),content:"",scrollToMarkLine:!0,position:"left",style:{lineColor:"red",lineWidth:1}}]:Array.isArray(t)?t.map(((t,e)=>{var r,i,n,s;return Object.assign(Object.assign({},t),{date:t.date,scrollToMarkLine:t.scrollToMarkLine,position:null!==(r=t.position)&&void 0!==r?r:"left",style:{lineColor:(null===(i=t.style)||void 0===i?void 0:i.lineColor)||"red",lineWidth:(null===(n=t.style)||void 0===n?void 0:n.lineWidth)||1,lineDash:null===(s=t.style)||void 0===s?void 0:s.lineDash}})})):[Object.assign(Object.assign({},t),{date:t.date,scrollToMarkLine:null===(e=t.scrollToMarkLine)||void 0===e||e,position:null!==(r=t.position)&&void 0!==r?r:"left",style:{lineColor:(null===(i=t.style)||void 0===i?void 0:i.lineColor)||"red",lineWidth:(null===(n=t.style)||void 0===n?void 0:n.lineWidth)||1,lineDash:null===(s=t.style)||void 0===s?void 0:s.lineDash}})]:[]}function Jd(t){var e,r,i,n,s,o,a,l,h,c,u,d,p,f,g,m,y,v,b,_,w,x,S,T,k,C,E,A,O,B,R,L,P,D,M,I,N,F,j,z,H,W,U,$,V,G,X,Y,q,Z,K,Q,J,tt,et,rt,it,nt,st,ot,at,lt,ht,ct,ut,dt,pt,ft,gt,mt,yt,vt,bt,_t,wt,xt,St,Tt,kt,Ct,Et,At,Ot,Bt,Rt,Lt,Pt,Dt,Mt,It,Nt,Ft,jt,zt,Ht,Wt,Ut,$t,Vt,Gt,Xt,Yt,qt,Zt,Kt,Qt,Jt,te,ee,re;const ie=t.options;t.parsedOptions.tasksShowMode=null!==(e=null==ie?void 0:ie.tasksShowMode)&&void 0!==e?e:Sd.Tasks_Separate,t.parsedOptions.pixelRatio=null!==(r=null==ie?void 0:ie.pixelRatio)&&void 0!==r?r:1,t.parsedOptions.rowHeight=null!==(i=null==ie?void 0:ie.rowHeight)&&void 0!==i?i:40,t.parsedOptions.timelineColWidth=null!==(s=null===(n=null==ie?void 0:ie.timelineHeader)||void 0===n?void 0:n.colWidth)&&void 0!==s?s:60,t.parsedOptions.startDateField=null!==(a=null===(o=ie.taskBar)||void 0===o?void 0:o.startDateField)&&void 0!==a?a:"startDate",t.parsedOptions.endDateField=null!==(h=null===(l=ie.taskBar)||void 0===l?void 0:l.endDateField)&&void 0!==h?h:"endDate",t.parsedOptions.progressField=null!==(u=null===(c=ie.taskBar)||void 0===c?void 0:c.progressField)&&void 0!==u?u:"progress",t.parsedOptions.projectSubTasksExpandable=null===(d=null==ie?void 0:ie.projectSubTasksExpandable)||void 0===d||d;const{unit:ne,startOfWeek:se,step:oe}=t.parsedOptions.reverseSortedTimelineScales[0];t.parsedOptions.minDate=(null==ie?void 0:ie.minDate)?Hd(new Date(ie.minDate),ne,se):void 0,t.parsedOptions.maxDate=(null==ie?void 0:ie.maxDate)&&(null===(p=t.parsedOptions)||void 0===p?void 0:p.minDate)?zd(null===(f=t.parsedOptions)||void 0===f?void 0:f.minDate,new Date(ie.maxDate),ne,oe):void 0,t.parsedOptions._minDateTime=null===(g=t.parsedOptions.minDate)||void 0===g?void 0:g.getTime(),t.parsedOptions._maxDateTime=null===(m=t.parsedOptions.maxDate)||void 0===m?void 0:m.getTime(),t.parsedOptions.overscrollBehavior=null!==(y=null==ie?void 0:ie.overscrollBehavior)&&void 0!==y?y:"auto",t.parsedOptions.underlayBackgroundColor=null!==(v=null==ie?void 0:ie.underlayBackgroundColor)&&void 0!==v?v:"#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==ie?void 0:ie.scrollStyle),t.parsedOptions.timelineHeaderHorizontalLineStyle=null===(b=null==ie?void 0:ie.timelineHeader)||void 0===b?void 0:b.horizontalLine,t.parsedOptions.timelineHeaderVerticalLineStyle=null===(_=null==ie?void 0:ie.timelineHeader)||void 0===_?void 0:_.verticalLine,t.parsedOptions.timelineHeaderBackgroundColor=null===(w=null==ie?void 0:ie.timelineHeader)||void 0===w?void 0:w.backgroundColor,t.parsedOptions.timeLineHeaderRowHeights=[],t.parsedOptions.timelineHeaderStyles=[];for(let e=0;e<t.parsedOptions.sortedTimelineScales.length;e++){const r=t.parsedOptions.sortedTimelineScales[e].style;t.parsedOptions.timelineHeaderStyles.push(Object.assign({fontSize:20,fontWeight:"bold",textAlign:"center",textBaseline:"middle",color:"#000",backgroundColor:"#fff"},r)),t.parsedOptions.timeLineHeaderRowHeights.push(null!==(S=null!==(x=t.parsedOptions.sortedTimelineScales[e].rowHeight)&&void 0!==x?x:null==ie?void 0:ie.headerRowHeight)&&void 0!==S?S:40)}var ae;t.parsedOptions.grid=Object.assign({},null==ie?void 0:ie.grid),ae=3*t.parsedOptions.rowHeight/4,qd.width=ae,t.parsedOptions.taskBarStyle=(null===(T=null==ie?void 0:ie.taskBar)||void 0===T?void 0:T.barStyle)&&"function"==typeof(null===(k=null==ie?void 0:ie.taskBar)||void 0===k?void 0:k.barStyle)?ie.taskBar.barStyle:Object.assign({},qd,null===(C=null==ie?void 0:ie.taskBar)||void 0===C?void 0:C.barStyle),t.parsedOptions.projectBarStyle=(null===(E=null==ie?void 0:ie.taskBar)||void 0===E?void 0:E.projectStyle)&&"function"==typeof(null===(A=null==ie?void 0:ie.taskBar)||void 0===A?void 0:A.projectStyle)?ie.taskBar.projectStyle:(null===(O=null==ie?void 0:ie.taskBar)||void 0===O?void 0:O.projectStyle)?Object.assign({},qd,null===(B=null==ie?void 0:ie.taskBar)||void 0===B?void 0:B.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!==(R=t.parsedOptions.taskBarStyle.borderLineWidth)&&void 0!==R?R:1,fillColor:t.parsedOptions.taskBarStyle.barColor,cornerRadius:0},{labelTextStyle:{fontSize:16,color:"red",fontFamily:"Arial",padding:4}},null===(L=null==ie?void 0:ie.taskBar)||void 0===L?void 0:L.milestoneStyle),t.parsedOptions.taskBarMilestoneHypotenuse=t.parsedOptions.taskBarMilestoneStyle.width*Math.sqrt(2),t.parsedOptions.dateFormat=null==ie?void 0:ie.dateFormat,t.parsedOptions.taskBarHoverStyle=Object.assign({barOverlayColor:"rgba(99, 144, 0, 0.4)"},null===(P=null==ie?void 0:ie.taskBar)||void 0===P?void 0:P.hoverBarStyle),t.parsedOptions.taskBarSelectable=null===(M=null===(D=null==ie?void 0:ie.taskBar)||void 0===D?void 0:D.selectable)||void 0===M||M,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==ie?void 0:ie.taskBar)||void 0===I?void 0:I.selectedBarStyle),t.parsedOptions.taskBarLabelText=null!==(F=null===(N=null==ie?void 0:ie.taskBar)||void 0===N?void 0:N.labelText)&&void 0!==F?F:"",t.parsedOptions.taskBarMoveable=null===(z=null===(j=null==ie?void 0:ie.taskBar)||void 0===j?void 0:j.moveable)||void 0===z||z,t.parsedOptions.moveTaskBarToExtendDateRange=null===(W=null===(H=null==ie?void 0:ie.taskBar)||void 0===H?void 0:H.moveToExtendDateRange)||void 0===W||W,t.parsedOptions.taskBarResizable=null===($=null===(U=null==ie?void 0:ie.taskBar)||void 0===U?void 0:U.resizable)||void 0===$||$,t.parsedOptions.taskBarDragOrder=null===(G=null===(V=null==ie?void 0:ie.taskBar)||void 0===V?void 0:V.dragOrder)||void 0===G||G,t.parsedOptions.taskBarLabelStyle={fontFamily:null!==(q=null===(Y=null===(X=null==ie?void 0:ie.taskBar)||void 0===X?void 0:X.labelTextStyle)||void 0===Y?void 0:Y.fontFamily)&&void 0!==q?q:"Arial",fontSize:null!==(Q=null===(K=null===(Z=null==ie?void 0:ie.taskBar)||void 0===Z?void 0:Z.labelTextStyle)||void 0===K?void 0:K.fontSize)&&void 0!==Q?Q:20,color:null!==(et=null===(tt=null===(J=null==ie?void 0:ie.taskBar)||void 0===J?void 0:J.labelTextStyle)||void 0===tt?void 0:tt.color)&&void 0!==et?et:"#F01",outsideColor:null!==(nt=null===(it=null===(rt=null==ie?void 0:ie.taskBar)||void 0===rt?void 0:rt.labelTextStyle)||void 0===it?void 0:it.outsideColor)&&void 0!==nt?nt:"#333333",textAlign:null!==(at=null===(ot=null===(st=null==ie?void 0:ie.taskBar)||void 0===st?void 0:st.labelTextStyle)||void 0===ot?void 0:ot.textAlign)&&void 0!==at?at:"left",textBaseline:null!==(ct=null===(ht=null===(lt=null==ie?void 0:ie.taskBar)||void 0===lt?void 0:lt.labelTextStyle)||void 0===ht?void 0:ht.textBaseline)&&void 0!==ct?ct:"middle",padding:null!==(pt=null===(dt=null===(ut=null==ie?void 0:ie.taskBar)||void 0===ut?void 0:ut.labelTextStyle)||void 0===dt?void 0:dt.padding)&&void 0!==pt?pt:[0,0,0,10],textOverflow:null===(gt=null===(ft=null==ie?void 0:ie.taskBar)||void 0===ft?void 0:ft.labelTextStyle)||void 0===gt?void 0:gt.textOverflow,orient:null===(yt=null===(mt=null==ie?void 0:ie.taskBar)||void 0===mt?void 0:mt.labelTextStyle)||void 0===yt?void 0:yt.orient,orientHandleWithOverflow:null===(bt=null===(vt=null==ie?void 0:ie.taskBar)||void 0===vt?void 0:vt.labelTextStyle)||void 0===bt?void 0:bt.orientHandleWithOverflow},t.parsedOptions.taskBarCustomLayout=null===(_t=null==ie?void 0:ie.taskBar)||void 0===_t?void 0:_t.customLayout,t.parsedOptions.taskBarCreatable=null!==(xt=null===(wt=null==ie?void 0:ie.taskBar)||void 0===wt?void 0:wt.scheduleCreatable)&&void 0!==xt?xt:!(t.parsedOptions.tasksShowMode!==Sd.Sub_Tasks_Separate&&t.parsedOptions.tasksShowMode!==Sd.Tasks_Separate),t.parsedOptions.taskBarCreationButtonStyle=Object.assign({lineColor:"rgb(99, 144, 0)",lineWidth:1,lineDash:[5,5],cornerRadius:4,backgroundColor:"#FFF"},null===(Tt=null===(St=null==ie?void 0:ie.taskBar)||void 0===St?void 0:St.scheduleCreation)||void 0===Tt?void 0:Tt.buttonStyle),t.parsedOptions.taskBarCreationCustomLayout=null===(Ct=null===(kt=null==ie?void 0:ie.taskBar)||void 0===kt?void 0:kt.scheduleCreation)||void 0===Ct?void 0:Ct.customLayout,t.parsedOptions.taskBarCreationMaxWidth=null===(At=null===(Et=null==ie?void 0:ie.taskBar)||void 0===Et?void 0:Et.scheduleCreation)||void 0===At?void 0:At.maxWidth,t.parsedOptions.taskBarCreationMinWidth=null===(Bt=null===(Ot=null==ie?void 0:ie.taskBar)||void 0===Ot?void 0:Ot.scheduleCreation)||void 0===Bt?void 0:Bt.minWidth,t.parsedOptions.outerFrameStyle=Object.assign({borderColor:"#e1e4e8",borderLineWidth:1,cornerRadius:4},null===(Rt=ie.frame)||void 0===Rt?void 0:Rt.outerFrameStyle),t.parsedOptions.markLine=Qd(null==ie?void 0:ie.markLine),null!==(Pt=null===(Lt=t.parsedOptions.markLine)||void 0===Lt?void 0:Lt.length)&&void 0!==Pt&&Pt&&((null===(Dt=t.parsedOptions.markLine)||void 0===Dt?void 0:Dt.every((t=>void 0===t.scrollToMarkLine)))&&(t.parsedOptions.markLine[0].scrollToMarkLine=!0),(null===(Mt=t.parsedOptions.markLine)||void 0===Mt?void 0:Mt.find((t=>t.scrollToMarkLine)))&&(t.parsedOptions.scrollToMarkLineDate=Hd(new Date(null===(It=t.parsedOptions.markLine)||void 0===It?void 0:It.find((t=>t.scrollToMarkLine)).date),ne,se))),t.parsedOptions.verticalSplitLineHighlight=null===(Nt=ie.frame)||void 0===Nt?void 0:Nt.verticalSplitLineHighlight,t.parsedOptions.verticalSplitLine=Object.assign({lineColor:null===(Ft=t.parsedOptions.outerFrameStyle)||void 0===Ft?void 0:Ft.borderColor,lineWidth:null===(jt=t.parsedOptions.outerFrameStyle)||void 0===jt?void 0:jt.borderLineWidth},null===(zt=ie.frame)||void 0===zt?void 0:zt.verticalSplitLine),t.parsedOptions.horizontalSplitLine=null===(Ht=ie.frame)||void 0===Ht?void 0:Ht.horizontalSplitLine,t.parsedOptions.verticalSplitLineMoveable=null===(Wt=ie.frame)||void 0===Wt?void 0:Wt.verticalSplitLineMoveable,t.parsedOptions.taskKeyField=null!==(Ut=ie.taskKeyField)&&void 0!==Ut?Ut:"id",t.parsedOptions.dependencyLinks=null!==(Vt=null===($t=ie.dependency)||void 0===$t?void 0:$t.links)&&void 0!==Vt?Vt:[],t.parsedOptions.dependencyLinkCreatable=null!==(Xt=null===(Gt=ie.dependency)||void 0===Gt?void 0:Gt.linkCreatable)&&void 0!==Xt&&Xt,t.parsedOptions.dependencyLinkSelectable=null===(qt=null===(Yt=ie.dependency)||void 0===Yt?void 0:Yt.linkSelectable)||void 0===qt||qt,t.parsedOptions.dependencyLinkDeletable=null!==(Kt=null===(Zt=ie.dependency)||void 0===Zt?void 0:Zt.linkDeletable)&&void 0!==Kt&&Kt,t.parsedOptions.dependencyLinkLineStyle=Object.assign({lineColor:"red",lineWidth:1},null===(Qt=ie.dependency)||void 0===Qt?void 0:Qt.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===(Jt=null==ie?void 0:ie.dependency)||void 0===Jt?void 0:Jt.linkSelectedLineStyle),t.parsedOptions.dependencyLinkLineCreatePointStyle=Object.assign({strokeColor:"red",fillColor:"white",radius:5,strokeWidth:1},null===(te=null==ie?void 0:ie.dependency)||void 0===te?void 0:te.linkCreatePointStyle),t.parsedOptions.dependencyLinkLineCreatingPointStyle=Object.assign({strokeColor:"red",fillColor:"red",radius:5,strokeWidth:1},null===(ee=null==ie?void 0:ie.dependency)||void 0===ee?void 0:ee.linkCreatingPointStyle),t.parsedOptions.dependencyLinkLineCreatingStyle=Object.assign({lineColor:"red",lineWidth:1,lineDash:[5,5]},null===(re=null==ie?void 0:ie.dependency)||void 0===re?void 0:re.linkCreatingLineStyle),t.parsedOptions.eventOptions=null==ie?void 0:ie.eventOptions,t.parsedOptions.keyboardOptions=null==ie?void 0:ie.keyboardOptions,t.parsedOptions.markLineCreateOptions=null==ie?void 0:ie.markLineCreateOptions}function tp(t,e,r){var i;const{unit:n,step:s,format:o}=r,a=[];for(;t<e;)if("day"===n){const r=t.getFullYear(),i=t.getMonth(),n=t.getDate(),l=jd(new Date(r,i,n+s-1),!0);l.getTime()>e.getTime()&&l.setTime(e.getTime());const h=t,c=(null==o?void 0:o({dateIndex:n,startDate:h,endDate:l}))||n.toString(),u={days:Math.abs(l.getTime()-t.getTime()+1)/864e5,startDate:h,endDate:l,step:s,unit:"day",title:c,dateIndex:n};a.push(u),t=new Date(r,i,n+s)}else if("month"===n){const r=t.getFullYear(),i=t.getMonth(),n=jd(new Date(r,i+s,0),!0);n.getTime()>e.getTime()&&n.setTime(e.getTime());const l=t,h=(null==o?void 0:o({dateIndex:i+1,startDate:l,endDate:n}))||(i+1).toString(),c={days:Math.abs(n.getTime()-t.getTime()+1)/864e5,startDate:l,step:s,unit:"month",endDate:n,title:h,dateIndex:i+1};a.push(c),t=new Date(r,i+s,1)}else if("quarter"===n){const r=t.getFullYear(),i=Math.floor(t.getMonth()/3),n=jd(new Date(r,3*(i+s),0),!0);n.getTime()>e.getTime()&&n.setTime(e.getTime());const l=t,h=(null==o?void 0:o({dateIndex:i+1,startDate:l,endDate:n}))||(i+1).toString(),c={days:Math.abs(n.getTime()-t.getTime()+1)/864e5,startDate:l,step:s,unit:"quarter",endDate:n,title:h,dateIndex:i+1};a.push(c),t=new Date(r,3*(i+s),1)}else if("year"===n){const r=t.getFullYear(),i=jd(new Date(r+s-1,11,31),!0);i.getTime()>e.getTime()&&i.setTime(e.getTime());const n=t,l=(null==o?void 0:o({dateIndex:r,startDate:n,endDate:i}))||r.toString(),h={days:Math.abs(i.getTime()-t.getTime()+1)/864e5,startDate:n,endDate:i,step:s,unit:"year",title:l,dateIndex:r};a.push(h),t=new Date(r+s,0,1)}else if("week"===n){const n=null!==(i=r.startOfWeek)&&void 0!==i?i:"monday";let l=t.getDay();"monday"===n&&(l=0===l?6:l-1);const h=Md(t),c=jd(t.getTime()+24*(7*s-l)*60*60*1e3-1,!0);c>e&&c.setTime(e.getTime());const u=Dd(h),d=(null==o?void 0:o({dateIndex:u,startDate:h,endDate:c}))||u.toString(),p={days:(c.getTime()-h.getTime()+1)/864e5,startDate:h,endDate:c,step:s,unit:"week",title:d,dateIndex:u};a.push(p),t.setTime(Md(t.getTime()+24*(7*s-l)*60*60*1e3,!0).getTime())}else if("hour"===n){const r=t.getFullYear(),i=t.getMonth(),n=t.getDate(),l=t.getHours(),h=Id(new Date(r,i,n,l+s-1),!0);h.getTime()>e.getTime()&&h.setTime(e.getTime());const c=t,u=(null==o?void 0:o({dateIndex:l,startDate:c,endDate:h}))||l.toString(),d={days:Math.abs(h.getTime()-t.getTime()+1)/864e5,startDate:c,endDate:h,step:s,unit:"hour",title:u,dateIndex:t.getHours()};a.push(d),t=new Date(r,i,n,l+s)}else if("minute"===n){const r=t.getFullYear(),i=t.getMonth(),n=t.getDate(),l=t.getHours(),h=t.getMinutes(),c=Nd(new Date(r,i,n,l,h+s-1),!0);c.getTime()>e.getTime()&&c.setTime(e.getTime());const u=t,d=(null==o?void 0:o({dateIndex:h,startDate:u,endDate:c}))||h.toString(),p={days:Math.abs(c.getTime()-t.getTime()+1)/864e5,startDate:u,endDate:c,step:s,unit:"minute",title:d,dateIndex:t.getMinutes()};a.push(p),t=new Date(r,i,n,l,h+s)}else if("second"===n){const r=t.getFullYear(),i=t.getMonth(),n=t.getDate(),l=t.getHours(),h=t.getMinutes(),c=t.getSeconds(),u=Fd(new Date(r,i,n,l,h,c+s-1),!0);u.getTime()>e.getTime()&&u.setTime(e.getTime());const d=t,p=(null==o?void 0:o({dateIndex:c,startDate:d,endDate:u}))||c.toString(),f={days:Math.abs(u.getTime()-t.getTime()+1)/864e5,startDate:d,endDate:u,step:s,unit:"second",title:p,dateIndex:t.getSeconds()};a.push(f),t=new Date(r,i,n,l,h,c+s)}return a}function ep(t,e,r,i,n){var s,o,a,l,h,c,u,d,p;let f=null!==(s=t[3])&&void 0!==s?s:10;"right"===e||"end"===e?f=i-0-(null!==(o=t[1])&&void 0!==o?o:10):"center"===e&&(f=0+(i-0+(null!==(a=t[3])&&void 0!==a?a:10)-(null!==(l=t[1])&&void 0!==l?l:10))/2);let g=0+(null!==(h=t[0])&&void 0!==h?h:10);return"bottom"===r||"alphabetic"===r||"ideographic"===r?g=n-0-(null!==(c=t[2])&&void 0!==c?c:10):"middle"===r&&(g=0+(n-0-(null!==(u=t[0])&&void 0!==u?u:10)-(null!==(d=t[2])&&void 0!==d?d:10))/2+(null!==(p=t[0])&&void 0!==p?p:10)),{x:f,y:g}}function rp(t){if(t.verticalSplitResizeLine){t.verticalSplitResizeLine.style.position="absolute",t.verticalSplitResizeLine.style.top=t.tableY+"px",t.verticalSplitResizeLine.style.left=-1!==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 ip(t,e,r,i="children"){var n;for(let s=0;s<t.length;s++){if(Array.isArray(r)&&1===r.length&&t[s][e]===r[0]||t[s][e]===r)return{record:t[s],index:[s]};if(null===(n=t[s][i])||void 0===n?void 0:n.length)if(Array.isArray(r)&&r[0]===t[s][e]){const n=ip(t[s][i],e,r.slice(1));if(n)return n.index.unshift(s),n}else if(!Array.isArray(r)){const n=ip(t[s][i],e,r);if(n)return n.index.unshift(s),n}}}function np(t,e="children"){var r;for(let i=0;i<t.length;i++)(null===(r=t[i][e])||void 0===r?void 0:r.length)?np(t[i][e],e):(delete t[i].vtable_gantt_linkedTo,delete t[i].vtable_gantt_linkedFrom)}function sp(t,e="children"){var r;for(let i=0;i<t.length;i++)(null===(r=t[i][e])||void 0===r?void 0:r.length)?sp(t[i][e],e):delete t[i].vtable_gantt_showIndex}function op(t,e){var r;let i,n;if(e.taskListTableInstance){const s=e.taskListTableInstance.getTargetRowAt(t+e.headerHeight);if(s){const{row:o}=s;i=o-e.taskListTableInstance.columnHeaderLevelCount;const a=e.getRowsHeightByIndex(0,i-1);if(e.parsedOptions.tasksShowMode===Sd.Sub_Tasks_Inline||e.parsedOptions.tasksShowMode===Sd.Sub_Tasks_Arrange||e.parsedOptions.tasksShowMode===Sd.Sub_Tasks_Compact||e.parsedOptions.tasksShowMode===Sd.Sub_Tasks_Separate)n=Math.floor((t-a)/e.parsedOptions.rowHeight);else if(e.parsedOptions.tasksShowMode===Sd.Project_Sub_Tasks_Inline){const s=e.getRecordByIndex(i);s&&s.type===Td.PROJECT&&(null===(r=s.children)||void 0===r?void 0:r.length)>0&&("expand"===s.hierarchyState||!1===e.parsedOptions.projectSubTasksExpandable||(n=Math.floor((t-a)/e.parsedOptions.rowHeight)))}}}else i=Math.floor(t/e.parsedOptions.rowHeight);return{task_index:i,sub_task_index:n}}function ap(t,e,r,i){return r.some((r=>{const{startDate:n,endDate:s}=lp(i,r);return t<=s&&n<=e}))}function lp(t,e){const{timeScaleIncludeHour:r,startDateField:i,endDateField:n}=t.parsedOptions,s=e[i],o=e[n];return r?{startDate:Md(s),endDate:jd(o)}:{startDate:Md(s,!0),endDate:jd(o,!0)}}function hp(t){const e=t.options;t.parsedOptions.markLine=Qd(null==e?void 0:e.markLine)}function cp(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 up{constructor(t){this._scene=t,this.initNodes()}initNodes(){var t,e,r,i,n,s,o,a,l;const{_scene:h}=this,c=new ta({x:0,y:0,width:h._gantt.getAllDateColsWidth(),height:h._gantt.getAllHeaderRowsHeight(),clip:!0,pickable:!1});this.group=c,c.name="date-header-container",h.ganttGroup.addChild(this.group);const{unit:u,step:d}=h._gantt.parsedOptions.reverseSortedTimelineScales[0];let p=0;for(let f=0;f<h._gantt.timeLineHeaderLevel;f++){const{timelineDates:g,customLayout:m,visible:y}=h._gantt.parsedOptions.sortedTimelineScales[f];if(!1===y)continue;const v=new ta({x:0,y:p,width:h._gantt.getAllDateColsWidth(),height:h._gantt.parsedOptions.timeLineHeaderRowHeights[f],clip:!1});p+=v.attribute.height,v.name="row-header",c.addChild(v);for(let s=0;s<(null==g?void 0:g.length);s++){const{days:o,endDate:a,startDate:l,title:c,dateIndex:p,unit:y}=g[s],b=Math.ceil(Wd(l,h._gantt.parsedOptions.minDate,u,d)*h._gantt.parsedOptions.timelineColWidth),_=Math.ceil(Wd(a,h._gantt.parsedOptions.minDate,u,d,1)*h._gantt.parsedOptions.timelineColWidth)-b,w=new ta({x:b,y:0,width:_,height:v.attribute.height,clip:!1,fill:h._gantt.parsedOptions.timelineHeaderBackgroundColor});let x;w.name="date-header-cell";let S=!0;const T=v.attribute.height;if(m){let e;e="function"==typeof m?m({width:_,height:T,index:s,startDate:l,endDate:a,days:o,dateIndex:p,title:c,ganttInstance:this._scene._gantt}):m,e&&(x=e.rootContainer,S=null!==(t=e.renderDefaultText)&&void 0!==t&&t,x.name="task-bar-custom-render"),x&&w.appendChild(x)}if(S){const{padding:t,textAlign:e,textBaseline:r,textOverflow:i,fontSize:n,fontWeight:s,color:o,strokeColor:a,textStick:l}=h._gantt.parsedOptions.timelineHeaderStyles[f],u=ep(Pd(t),e,r,_,T),d=new Fa({x:u.x,y:u.y,maxLineWidth:_,heightLimit:T,pickable:!0,text:c.toLocaleString(),fontSize:n,fontWeight:s,fill:o,stroke:a,lineWidth:2,textAlign:e,textBaseline:r,ellipsis:"clip"===i?"":"ellipsis"===i?"...":ld(i)?i:void 0});d.attribute.textStick=l,w.appendChild(d),d.name="date-header-cell-text"}if(f===h._gantt.timeLineHeaderLevel-1&&h._gantt.parsedOptions.markLineCreateOptions&&h._gantt.parsedOptions.markLineCreateOptions.markLineCreatable){const t=h._gantt.parsedOptions.markLineCreateOptions.markLineCreationStyle||{},e=t.size||24,r=t.iconSize||18,i=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>',n=new ta({x:_/2-e/2,y:T/2-e/2,width:e,height:e,visiable:!0});n.name="markline-hover-group",n.data=g[s];const o=new ta({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});o.name="markline-hover-inner-group",n.add(o);const a=new Za({width:r,height:r,image:i,cursor:"pointer",pickable:!0});a.name="markline-hover-icon",o.appendChild(a),w.add(n)}if(v.addChild(w),s>0){const t=Va({pickable:!1,stroke:null===(e=h._gantt.parsedOptions.timelineHeaderVerticalLineStyle)||void 0===e?void 0:e.lineColor,lineWidth:null===(r=h._gantt.parsedOptions.timelineHeaderVerticalLineStyle)||void 0===r?void 0:r.lineWidth,points:[{x:1&(null===(i=h._gantt.parsedOptions.timelineHeaderVerticalLineStyle)||void 0===i?void 0:i.lineWidth)?.5:0,y:0},{x:1&(null===(n=h._gantt.parsedOptions.timelineHeaderVerticalLineStyle)||void 0===n?void 0:n.lineWidth)?.5:0,y:v.attribute.height}]});w.appendChild(t)}}if(f>0){const t=Va({pickable:!1,stroke:null===(s=h._gantt.parsedOptions.timelineHeaderHorizontalLineStyle)||void 0===s?void 0:s.lineColor,lineWidth:null===(o=h._gantt.parsedOptions.timelineHeaderHorizontalLineStyle)||void 0===o?void 0:o.lineWidth,points:[{x:0,y:1&(null===(a=h._gantt.parsedOptions.timelineHeaderHorizontalLineStyle)||void 0===a?void 0:a.lineWidth)?.5:0},{x:h._gantt.getAllDateColsWidth(),y:1&(null===(l=h._gantt.parsedOptions.timelineHeaderHorizontalLineStyle)||void 0===l?void 0:l.lineWidth)?.5:0}]});v.addChild(t)}}}setX(t){this.group.setAttribute("x",t)}setY(t){this.group.setAttribute("y",t)}resize(){var t,e,r,i;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!==(i=null===(r=this.group.attribute)||void 0===r?void 0:r.height)&&void 0!==i?i: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 dp extends ta{constructor(t){super(t),this._lastWidth=t.width,this._lastHeight=t.height,this._lastX=t.x,this._lastY=t.y}updateTextPosition(){var t,r,i;if(!this.textLabel||!this.barRect)return;const n=this.labelStyle||{},{textAlign:s="left",textBaseline:o="middle",textOverflow:a,color:l="#333333",outsideColor:h="#333333",padding:c=8}=n,u=Array.isArray(c)?c[3]:c,d=this.barRect.attribute.width,p=this.barRect.attribute.height,f=this.textLabel.attribute.fontSize||12,g=this.textLabel.attribute.fontFamily||"Arial",m=String(this.textLabel.attribute.text||""),y=e.textMeasure.measureTextWidth(m,{fontSize:f,fontFamily:g})+2*u<=d,v=ep(Pd(u),s,o,d,p),b=n.orient||(!y&&n.orientHandleWithOverflow?n.orientHandleWithOverflow:null);if(this.textLabel.setAttribute("visible",!0),this.textLabel.setAttribute("textBaseline",o),b){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:-u,y:p/2,align:"right",baseline:"middle"},right:{x:d+u,y:p/2,align:"left",baseline:"middle"},top:{x:d/2,y:-u,align:"center",baseline:"bottom"},bottom:{x:d/2,y:p+u,align:"center",baseline:"top"}}[b];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===(r=this.textLabel.parent)||void 0===r||r.removeChild(this.textLabel),null===(i=this.clipGroupBox)||void 0===i||i.appendChild(this.textLabel),this.textLabel.setAttribute("x",v.x),this.textLabel.setAttribute("y",v.y),this.textLabel.setAttribute("textAlign",s),this.textLabel.setAttribute("fill",l),this.textLabel.setAttribute("maxLineWidth",d-u),this.textLabel.setAttribute("ellipsis","clip"===a?"":"ellipsis"===a?"...":ld(a)?a:void 0)}}const pp='<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 fp{formatMilestoneText(t,e){if(!t)return"";const r=t.match(/{([^}]+)}/g);return r&&r.forEach((r=>{const i=r.substring(1,r.length-1),n=e[i];void 0!==n&&(t=t.replace(r,String(n)))})),t}calculateMilestoneTextPosition(t,e,r=4){const i="number"==typeof r?r:4;let n=0,s=0,o="left",a="middle";const l=e/2;switch(t){case"left":n=-i,s=l,o="end",a="middle";break;case"right":default:n=e+i,s=l,o="start",a="middle";break;case"top":n=l,s=-i,o="center",a="bottom";break;case"bottom":n=l,s=e+i,o="center",a="top"}return{textX:n,textY:s,textAlignValue:o,textBaselineValue:a}}constructor(t){this.selectedBorders=[],this._scene=t,this.width=t._gantt.tableNoFrameWidth,this.height=t._gantt.gridHeight,this.group=new ta({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,r;this.barContainer=new ta({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 i=0;i<this._scene._gantt.itemCount;i++)if(this._scene._gantt.parsedOptions.tasksShowMode!==Sd.Sub_Tasks_Inline&&this._scene._gantt.parsedOptions.tasksShowMode!==Sd.Sub_Tasks_Separate&&this._scene._gantt.parsedOptions.tasksShowMode!==Sd.Sub_Tasks_Arrange&&this._scene._gantt.parsedOptions.tasksShowMode!==Sd.Sub_Tasks_Compact)if(this._scene._gantt.parsedOptions.tasksShowMode!==Sd.Project_Sub_Tasks_Inline){const t=this.initBar(i);t&&this.barContainer.appendChild(t)}else{const t=this._scene._gantt.getRecordByIndex(i),e="expand"===t.hierarchyState;if(t.type===Td.PROJECT&&(null===(r=t.children)||void 0===r?void 0:r.length)>0&&!e){const e=this._scene._gantt.getRecordIndexByTaskShowIndex(i),r=Array.isArray(e)?[...e]:[e],n=(t,e)=>{var r,s;if((null===(r=t.children)||void 0===r?void 0:r.length)>0)for(let r=0;r<(null===(s=t.children)||void 0===s?void 0:s.length);r++){const s=t.children[r];if(s.type!==Td.PROJECT){const n=this.initBar(i,[...e,r],t.children.length);n&&this.barContainer.appendChild(n)}else n(s,[...e,r])}};n(t,r)}else{const t=this.initBar(i);t&&this.barContainer.appendChild(t)}}else{const r=this._scene._gantt.getRecordByIndex(i);if((null===(t=r.children)||void 0===t?void 0:t.length)>0)for(let t=0;t<(null===(e=r.children)||void 0===e?void 0:e.length);t++){const e=this.initBar(i,t,r.children.length);e&&this.barContainer.appendChild(e)}else{const t=this.initBar(i);t&&this.barContainer.appendChild(t)}}}initBar(t,e,r){var i,n,s,o,a;const l=this._scene._gantt.parsedOptions.taskBarCustomLayout,{startDate:h,endDate:c,taskDays:u,progress:d,taskRecord:p}=this._scene._gantt.getTaskInfoByTaskListIndex(t,e),f=p.type===Td.MILESTONE;if(f&&!h||!f&&(u<=0||!h||!c||h.getTime()>c.getTime()))return null;const{unit:g,step:m}=this._scene._gantt.parsedOptions.reverseSortedTimelineScales[0];let y=Wd(c,h,g,m,1)*this._scene._gantt.parsedOptions.timelineColWidth;const v=this._scene._gantt.getTaskBarStyle(t,e),b=v.width;ld(v.minSize)&&(y=Math.max(y,v.minSize));const _=this._scene._gantt.parsedOptions.rowHeight,w=this._scene._gantt.parsedOptions.taskBarMilestoneStyle.width,x=Wd(h,this._scene._gantt.parsedOptions.minDate,g,m)*this._scene._gantt.parsedOptions.timelineColWidth-(f?w/2:0),S=this._scene._gantt.getRowsHeightByIndex(0,t-1)+(this._scene._gantt.parsedOptions.tasksShowMode===Sd.Sub_Tasks_Separate?(null!==(i=e)&&void 0!==i?i:0)*_:this._scene._gantt.parsedOptions.tasksShowMode===Sd.Sub_Tasks_Arrange||this._scene._gantt.parsedOptions.tasksShowMode===Sd.Sub_Tasks_Compact?p.vtable_gantt_showIndex*_:0)+(_-(f?w:b))/2,T=new dp({x:x,y:S,width:f?w:y,height:f?w:b,cornerRadius:f?this._scene._gantt.parsedOptions.taskBarMilestoneStyle.cornerRadius:v.cornerRadius,lineWidth:f?2*this._scene._gantt.parsedOptions.taskBarMilestoneStyle.borderLineWidth:2*(null!==(n=v.borderLineWidth)&&void 0!==n?n:v.borderWidth),stroke:f?this._scene._gantt.parsedOptions.taskBarMilestoneStyle.borderColor:v.borderColor,angle:f?.25*Math.PI:0,anchor:f?[x+w/2,S+w/2]:void 0});T.name="task-bar",T.task_index=t,T.sub_task_index=e,T.record=p;const k=new ta({x:0,y:0,width:T.attribute.width,height:T.attribute.height,cornerRadius:f?this._scene._gantt.parsedOptions.taskBarMilestoneStyle.cornerRadius:v.cornerRadius,clip:!0});let C;k.name="task-bar-group",T.appendChild(k),T.clipGroupBox=k;let E=!0,A=!0;if(l){let e;e="function"==typeof l?l({width:y,height:b,index:t,startDate:h,endDate:c,taskDays:u,progress:d,taskRecord:p,ganttInstance:this._scene._gantt}):l,e&&(C=e.rootContainer,E=null!==(s=e.renderDefaultBar)&&void 0!==s&&s,A=null!==(o=e.renderDefaultText)&&void 0!==o&&o,C&&(C.name="task-bar-custom-render"))}if(E){const t=Ya({x:0,y:0,width:T.attribute.width,height:T.attribute.height,fill:f?this._scene._gantt.parsedOptions.taskBarMilestoneStyle.fillColor:v.barColor,pickable:!1});if(t.name="task-bar-rect",k.appendChild(t),T.barRect=t,p.type!==Td.MILESTONE){const t=Ya({x:0,y:0,width:y*d/100,height:b,fill:v.completedBarColor,pickable:!1});t.name="task-bar-progress-rect",k.appendChild(t),T.progressRect=t}}if(C&&k.appendChild(C),A&&p.type!==Td.MILESTONE){const{textAlign:t,textBaseline:e,fontSize:r,fontFamily:i,textOverflow:n,color:s,padding:o}=this._scene._gantt.parsedOptions.taskBarLabelStyle,a=ep(Pd(o),t,e,y,b),l=ja({x:a.x,y:a.y,fontSize:r,fill:s,fontFamily:i,text:(O=this._scene._gantt.parsedOptions.taskBarLabelText,B=p,O.replace(/\{([^}]+)\}/g,((t,e)=>{const r=e.split(".");let i=B;for(const e of r){if(!i.hasOwnProperty(e)){i=t;break}i=i[e]}return i}))),maxLineWidth:y-10,textBaseline:e,textAlign:t,ellipsis:"clip"===n?"":"ellipsis"===n?"...":ld(n)?n:void 0,poptip:{position:"bottom"}});k.appendChild(l),T.textLabel=l,T.labelStyle=this._scene._gantt.parsedOptions.taskBarLabelStyle,T.updateTextPosition()}var O,B;if(A&&"milestone"===p.type&&this._scene._gantt.parsedOptions.taskBarMilestoneStyle.labelText){const t=this._scene._gantt.parsedOptions.taskBarMilestoneStyle,e=t.labelTextStyle||{},r=this.calculateMilestoneTextPosition(t.textOrient||"right",t.width,null!==(a=e.padding)&&void 0!==a?a:4),i=new ta({x:x,y:S,width:t.width,height:t.width,angle:0,pickable:!1}),n=ja({x:r.textX,y:r.textY,fontSize:e.fontSize||16,fontFamily:e.fontFamily||"Arial",fill:e.color||"#ff0000",textBaseline:e.textBaseline||r.textBaselineValue,textAlign:e.textAlign||r.textAlignValue,text:this.formatMilestoneText(t.labelText,p),pickable:!1});i.appendChild(n),this.barContainer.appendChild(i),T.milestoneTextLabel=n,T.milestoneTextContainer=i}return T}updateTaskBarNode(t,e){const r=this.getTaskBarNodeByIndex(t,e);r&&this.barContainer.removeChild(r);const i=this.initBar(t,e);i&&(this.barContainer.insertInto(i,t),i.updateTextPosition())}initHoverBarIcons(){var t,e;const r=new ta({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:qd.cornerRadius)&&void 0!==e?e:0,fill:this._scene._gantt.parsedOptions.taskBarHoverStyle.barOverlayColor,visibleAll:!1});if(this.hoverBarGroup=r,r.name="task-bar-hover-shadow",this._scene._gantt.parsedOptions.taskBarResizable){const t=new Za({x:0,y:0,width:10,height:20,image:pp,pickable:!0,cursor:"col-resize"});t.name="task-bar-hover-shadow-left-icon",this.hoverBarLeftIcon=t,r.appendChild(t);const e=new Za({x:0,y:0,width:10,height:20,image:pp,pickable:!0,cursor:"col-resize"});e.name="task-bar-hover-shadow-right-icon",this.hoverBarRightIcon=e,r.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,r,i,n){var s,o,a,l;const{startDate:h,endDate:c,taskRecord:u}=this._scene._gantt.getTaskInfoByTaskListIndex(n.task_index,n.sub_task_index);n&&"task-bar"===n.name&&n.appendChild(this.hoverBarGroup),this.hoverBarGroup.setAttribute("x",0),this.hoverBarGroup.setAttribute("y",0),this.hoverBarGroup.setAttribute("width",r),this.hoverBarGroup.setAttribute("height",i),this.hoverBarGroup.setAttribute("visibleAll",!0);const d=this._scene._gantt.getTaskBarStyle(n.task_index,n.sub_task_index);if(u.type===Td.MILESTONE)this.hoverBarGroup.setAttribute("cornerRadius",n.attribute.cornerRadius);else{const t=null!==(o=null!==(s=this._scene._gantt.parsedOptions.taskBarHoverStyle.cornerRadius)&&void 0!==s?s:d.cornerRadius)&&void 0!==o?o:0;this.hoverBarGroup.setAttribute("cornerRadius",t)}null===(a=this.hoverBarLeftIcon)||void 0===a||a.setAttribute("visible",!1),null===(l=this.hoverBarRightIcon)||void 0===l||l.setAttribute("visible",!1);let p=!0,f=!0;if(u.type===Td.MILESTONE)p=!1,f=!1;else if("function"==typeof this._scene._gantt.parsedOptions.taskBarResizable){const t={index:n.task_index,startDate:h,endDate:c,taskRecord:u,ganttInstance:this._scene._gantt},e=this._scene._gantt.parsedOptions.taskBarResizable(t);Array.isArray(e)?[p,f]=e:(p=e,f=e)}else Array.isArray(this._scene._gantt.parsedOptions.taskBarResizable)?[p,f]=this._scene._gantt.parsedOptions.taskBarResizable:(p=this._scene._gantt.parsedOptions.taskBarResizable,f=this._scene._gantt.parsedOptions.taskBarResizable);p&&this.hoverBarLeftIcon.setAttribute("visible",!0),f&&this.hoverBarRightIcon.setAttribute("visible",!0),this.hoverBarLeftIcon&&(this.hoverBarLeftIcon.setAttribute("x",0),this.hoverBarLeftIcon.setAttribute("y",Math.ceil(i/10)),this.hoverBarLeftIcon.setAttribute("width",10),this.hoverBarLeftIcon.setAttribute("height",i-2*Math.ceil(i/10)),this.hoverBarRightIcon.setAttribute("x",r-10),this.hoverBarRightIcon.setAttribute("y",Math.ceil(i/10)),this.hoverBarRightIcon.setAttribute("width",10),this.hoverBarRightIcon.setAttribute("height",i-2*Math.ceil(i/10)))}hideHoverBar(){this.hoverBarGroup.setAttribute("visibleAll",!1)}createSelectedBorder(t,e,r,i,n,s=!1){const o=n.record,a=new ta({x:t,y:e,width:r,height:i,pickable:!1,attachedToTaskBarNode:n,zIndex:1e4});a.name="task-bar-select-border",this.barContainer.appendChild(a),this.selectedBorders.push(a);const l=new ta({x:0,y:0,width:r,height:i,lineWidth:this._scene._gantt.parsedOptions.taskBarSelectedStyle.borderLineWidth,pickable:!1,cornerRadius:n.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:n.attribute.angle,anchor:[r/2,i/2]});if(a.appendChild(l),s){const t=o.type===Td.MILESTONE?15:10,e=new ta({x:-t,y:0,width:10,height:i,pickable:!0}),n=new Ma({x:5,y:i/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(n),e.name="task-bar-link-point-left",a.appendChild(e);const s=new ta({x:r+(t-10),y:0,width:10,height:i,pickable:!0}),l=new Ma({x:5,y:i/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});s.appendChild(l),s.name="task-bar-link-point-right",a.appendChild(s)}}removeSelectedBorder(){this.selectedBorders.forEach((t=>{t.delete()})),this.selectedBorders=[]}removeSecondSelectedBorder(){2===this.selectedBorders.length&&this.selectedBorders.pop().delete()}updateCreatingDependencyLine(t,e,r,i){this.creatingDependencyLine&&(this.creatingDependencyLine.delete(),this.creatingDependencyLine=void 0);const n=new $a({points:[{x:t,y:e},{x:r,y:i}],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=n,this.selectedBorders[0].appendChild(n)}getTaskBarNodeByIndex(t,e){let r=this.barContainer.firstChild;if(!r)return null;for(let i=0;i<this.barContainer.childrenCount;i++){if(r.task_index===t&&(!ld(e)||ld(e)&&r.sub_task_index===e))return r;r=r._next}return null}}class gp{constructor(t){this.markLineContainerWidth=20,this._scene=t,this.height=Math.min(t._gantt.tableNoFrameHeight,t._gantt.drawHeight)-t._gantt.getAllHeaderRowsHeight(),this.group=new ta({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 ta({x:0,y:0,width:this._scene._gantt.getAllDateColsWidth(),height:this.height,pickable:!1,clip:!0}),this.group.appendChild(this.markLIneContainer),this.initMarkLines()}initMarkLines(){const t=Math.min(this._scene._gantt.tableNoFrameHeight,this._scene._gantt.drawHeight)-this._scene._gantt.getAllHeaderRowsHeight();this.group.setAttributes({y:this._scene._gantt.getAllHeaderRowsHeight(),width:this._scene._gantt.tableNoFrameWidth,height:t}),this.markLIneContainer.setAttribute("width",this._scene._gantt.getAllDateColsWidth()),this.markLIneContainer.setAttribute("height",t);const e=this._scene._gantt.parsedOptions.markLine,r=this._scene._gantt.parsedOptions.minDate;r&&e.forEach((t=>{const e=t.style,i=t.contentStyle||{},n=this._scene._gantt.parsedOptions.timeScaleIncludeHour?Md(t.date):Md(t.date,!0),{unit:s,step:o}=this._scene._gantt.parsedOptions.reverseSortedTimelineScales[0],a=Wd(n,r,s,o);let l=0;if("right"===t.position)l=1;else if("middle"===t.position)l=.5;else if("date"===t.position){const e=Wd(Md(t.date),r,s,o);l=e-Math.floor(e)}const h=this._scene._gantt.parsedOptions.timelineColWidth*(Math.floor(a)+l),c=new ta({pickable:!1,x:h-this.markLineContainerWidth/2,y:0,width:this.markLineContainerWidth,height:this.height});c.name="mark-line",this.markLIneContainer.appendChild(c);const u=Va({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(c.appendChild(u),t.content){const r=this._scene._gantt.parsedOptions.timelineColWidth,n=i.lineHeight||18,s=new ta({x:this.markLineContainerWidth/2,y:0,cursor:"pointer",height:n,clip:!1,fill:i.backgroundColor||e.lineColor,display:"flex",cornerRadius:i.cornerRadius||[0,2,2,0]});s.name="mark-line-content",s.data=t,c.appendChild(s);const o=new Fa({maxLineWidth:r,text:t.content,cursor:"pointer",lineHeight:n,fontWeight:i.fontWeight||"normal",fill:i.color||e.lineColor,fontSize:i.fontSize||12,poptip:{position:"top",dx:r/4,dy:-n/4}});s.appendChild(o)}}))}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 mp{constructor(t){this._scene=t,this.createFrameBorder()}createFrameBorder(){var t,r,i,n,s,o;const a=this._scene.ganttGroup,l=this._scene._gantt.parsedOptions.outerFrameStyle;if(!l)return;const{cornerRadius:h,borderColor:c,borderLineWidth:u,borderLineDash:d}=l,p={},f={pickable:!1},g=e.toBoxArray(null!=u?u:0),m=[g[0],g[1],g[2],this._scene._gantt.taskListTableInstance?0:g[3]];f.stroke=!0,f.fill=!1,f.stroke=c,f.lineWidth=Math.max(...m),f.strokeArrayWidth=m,d&&(f.lineDash=d),f.lineCap="butt";const y=!!this._scene._gantt.taskListTableInstance;f.x=y?0:m[3]/2,f.y=m[0]/2;const v=null!==(r=null===(t=this._scene._gantt.parsedOptions.verticalSplitLine)||void 0===t?void 0:t.lineWidth)&&void 0!==r?r:0;if(f.width=a.attribute.width+m[3]/2+m[1]/2+(y?v:0),f.height=a.attribute.height+m[0]/2+m[2]/2,h){const t=Array.isArray(h)?h:[h,h,h,h];this._scene._gantt.taskListTableInstance?(f.cornerRadius=[0,null!==(i=t[1])&&void 0!==i?i:0,null!==(n=t[2])&&void 0!==n?n:0,0],p.cornerRadius=[0,null!==(s=t[1])&&void 0!==s?s:0,null!==(o=t[2])&&void 0!==o?o:0,0]):(f.cornerRadius=t,p.cornerRadius=t)}if(a.setAttributes(p),f.stroke){const t=Ya(f);t.name="border-rect",a.parent.insertAfter(t,a),this.border=t,a.border=t}}refresh(){this.border&&this.border.parent&&this.border.parent.removeChild(this.border),this.createFrameBorder()}resize(){var t,r,i;const{borderLineWidth:n}=this._scene._gantt.parsedOptions.outerFrameStyle,s=e.toBoxArray(null!=n?n:0),o=[s[0],s[1],s[2],this._scene._gantt.taskListTableInstance?0:s[3]],a=null!==(r=null===(t=this._scene._gantt.parsedOptions.verticalSplitLine)||void 0===t?void 0:t.lineWidth)&&void 0!==r?r:0,l=!!this._scene._gantt.taskListTableInstance;null===(i=this.border)||void 0===i||i.setAttributes({x:l?0:o[3]/2,y:o[0]/2,width:this._scene.ganttGroup.attribute.width+o[3]/2+o[1]/2+(l?a:0),height:this._scene.ganttGroup.attribute.height+o[0]/2+o[2]/2}),this.border.strokeArrayWidth=o}}var yp=function(t,e,r,i){var n,s=arguments.length,o=s<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,e,r,i);else for(var a=t.length-1;a>=0;a--)(n=t[a])&&(o=(s<3?n(o):s>3?n(e,r,o):n(e,r))||o);return s>3&&o&&Object.defineProperty(e,r,o),o};let vp=class{constructor(){this.time=Je.beforeFillStroke,this.useStyle=!0,this.order=0,this.supportedAppName="vtable"}drawShape(t,e,r,i,n,s,o,a,l,h,c,u,d){"date-header-cell"===t.name&&t.forEachChildren((t=>{var e;if("date-header-cell-text"===t.name&&!0===t.attribute.textStick){const r=t;r.setAttribute("dx",0);const i=r.globalAABBBounds,n=r.stage.globalAABBBounds,s=r.parent.globalAABBBounds,o=n.intersect(s);n.intersect(s)&&(i.width()>=o.width()&&r.attribute.last_dx?r.setAttribute("dx",null!==(e=r.attribute.last_dx)&&void 0!==e?e:0):n.x1>=i.x1?(r.setAttribute("dx",n.x1-i.x1),r.setAttribute("last_dx",n.x1-i.x1)):n.x2<=i.x2&&(r.setAttribute("dx",n.x2-i.x2),r.setAttribute("last_dx",n.x1-i.x1)))}}))}};vp=yp([L()],vp);var bp=new v(((t,e,r,i)=>{t(vp).toSelf().inSingletonScope(),t(wa).toService(vp)}));class _p{constructor(t){this._scene=t,this.createAddButton()}createAddButton(){var t;this._scene._gantt.parsedOptions.taskBarCreationCustomLayout?this.group=new ta({x:0,y:0,width:100,height:100}):(this.group=new ta({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=Va({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=Va({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,r,i){if(this._scene._gantt.parsedOptions.taskBarCreationCustomLayout)this.group.appendChild(this._scene._gantt.parsedOptions.taskBarCreationCustomLayout({width:r,height:i,ganttInstance:this._scene._gantt}).rootContainer);else{const t=Math.min(r,i)/6;this.lineHorizontal.setAttribute("points",[{x:(r-4*t)/2,y:i/2},{x:(r-4*t)/2+4*t,y:i/2}]),this.lineVertical.setAttribute("points",[{x:r/2,y:(i-4*t)/2},{x:r/2,y:(i-4*t)/2+4*t}])}this.group.setAttribute("x",t),this.group.setAttribute("y",e),this.group.setAttribute("width",r),this.group.setAttribute("height",i),this.group.setAttribute("visibleAll",!0)}hide(){this.group.setAttribute("visibleAll",!1),this._scene._gantt.parsedOptions.taskBarCreationCustomLayout&&this.group.removeAllChild()}}class wp{constructor(t){this._scene=t,this.group=new id({position:"top",content:"",contentStyle:{fill:"#fff"},visible:!1,panel:{background:"#14161c",cornerRadius:4}}),t.ganttGroup.addChild(this.group)}show(t){var e,r,i;const n=(null===(e=this._scene._gantt.parsedOptions.markLineCreateOptions)||void 0===e?void 0:e.markLineCreationHoverToolTip)||{},s=t.globalTransMatrix,o=t.attribute.width,a=t.attribute.height;let l,h;const c=n.position||"top";"top"===c?(l=s.e+o/2-2,h=s.f):"bottom"===c&&(l=s.e+o/2-2,h=s.f+a);const u=(null===(r=n.style)||void 0===r?void 0:r.contentStyle)||{fill:"#fff"},d=(null===(i=n.style)||void 0===i?void 0:i.panelStyle)||{background:"#14161c",cornerRadius:4};this.group.setAttributes({content:n.tipContent,position:c,visibleAll:!0,visible:!0,contentStyle:u,panel:Object.assign(Object.assign({},d),{visible:!0}),x:l,y:h})}hide(){this.group.setAttributes({visibleAll:!1,visible:!1})}}class xp{constructor(t){this._scene=t,this.width=t._gantt.tableNoFrameWidth,this.height=t._gantt.gridHeight,this.group=new ta({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(np(this._scene._gantt.records),this.linkLinesContainer=new ta({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,r,i,n,s,o,a,l,h,c;const{taskKeyField:u,dependencyLinks:d}=this._scene._gantt.parsedOptions,p=d[t],{linkedToTaskKey:f,linkedFromTaskKey:g,type:m}=p,y=ip(this._scene._gantt.records,u,f),v=ip(this._scene._gantt.records,u,g);if(!y||!v)return;let b,_,w,x,S,T,k,C;if(y.record.vtable_gantt_linkedTo||(y.record.vtable_gantt_linkedTo=[]),y.record.vtable_gantt_linkedTo.push(p),v.record.vtable_gantt_linkedFrom||(v.record.vtable_gantt_linkedFrom=[]),v.record.vtable_gantt_linkedFrom.push(p),this._scene._gantt.parsedOptions.tasksShowMode===Sd.Sub_Tasks_Inline)C=v.index[0],k=y.index[0],({startDate:b,endDate:_,taskDays:w}=this._scene._gantt.getTaskInfoByTaskListIndex(y.index[0],y.index[1])),({startDate:x,endDate:S,taskDays:T}=this._scene._gantt.getTaskInfoByTaskListIndex(v.index[0],v.index[1]));else if(this._scene._gantt.parsedOptions.tasksShowMode===Sd.Project_Sub_Tasks_Inline){const t=this._scene._gantt.getTaskShowIndexByRecordIndex(v.index.slice(0,-1)),e=this._scene._gantt.getTaskShowIndexByRecordIndex(y.index.slice(0,-1)),r=this._scene._gantt.getRecordByIndex(t),i=this._scene._gantt.getRecordByIndex(e);C=r.type===Td.PROJECT&&"expand"!==r.hierarchyState&&!1!==this._scene._gantt.parsedOptions.projectSubTasksExpandable?t:this._scene._gantt.getTaskShowIndexByRecordIndex(v.index),k=i.type===Td.PROJECT&&"expand"!==i.hierarchyState&&!1!==this._scene._gantt.parsedOptions.projectSubTasksExpandable?e:this._scene._gantt.getTaskShowIndexByRecordIndex(y.index),({startDate:b,endDate:_,taskDays:w}=this._scene._gantt.getTaskInfoByTaskListIndex(k,y.index)),({startDate:x,endDate:S,taskDays:T}=this._scene._gantt.getTaskInfoByTaskListIndex(C,v.index))}else this._scene._gantt.parsedOptions.tasksShowMode===Sd.Sub_Tasks_Separate||this._scene._gantt.parsedOptions.tasksShowMode===Sd.Sub_Tasks_Arrange||this._scene._gantt.parsedOptions.tasksShowMode===Sd.Sub_Tasks_Compact?(C=this._scene._gantt.getRowsHeightByIndex(0,v.index[0]-1)/this._scene._gantt.parsedOptions.rowHeight+(this._scene._gantt.parsedOptions.tasksShowMode===Sd.Sub_Tasks_Arrange||this._scene._gantt.parsedOptions.tasksShowMode===Sd.Sub_Tasks_Compact?v.record.vtable_gantt_showIndex:null!==(e=v.index[1])&&void 0!==e?e:0),k=this._scene._gantt.getRowsHeightByIndex(0,y.index[0]-1)/this._scene._gantt.parsedOptions.rowHeight+(this._scene._gantt.parsedOptions.tasksShowMode===Sd.Sub_Tasks_Arrange||this._scene._gantt.parsedOptions.tasksShowMode===Sd.Sub_Tasks_Compact?y.record.vtable_gantt_showIndex:null!==(r=y.index[1])&&void 0!==r?r:0),({startDate:b,endDate:_,taskDays:w}=this._scene._gantt.getTaskInfoByTaskListIndex(y.index[0],y.index[1])),({startDate:x,endDate:S,taskDays:T}=this._scene._gantt.getTaskInfoByTaskListIndex(v.index[0],v.index[1]))):(C=this._scene._gantt.getTaskShowIndexByRecordIndex(v.index),k=this._scene._gantt.getTaskShowIndexByRecordIndex(y.index),({startDate:b,endDate:_,taskDays:w}=this._scene._gantt.getTaskInfoByTaskListIndex(k)),({startDate:x,endDate:S,taskDays:T}=this._scene._gantt.getTaskInfoByTaskListIndex(C)));if(!T||!w)return;Md(this._scene._gantt.parsedOptions.minDate);const{arrowPoints:E,linePoints:A}=function(t,e,r,i,n,s,o,a,l,h,c,u){const{unit:d,step:p}=u.parsedOptions.reverseSortedTimelineScales[0],{minDate:f,rowHeight:g,timelineColWidth:m}=u.parsedOptions,y=u.parsedOptions.taskBarMilestoneHypotenuse;let v=[],b=[];if(t===xd.FinishToStart){let t=Wd(r,f,d,p,1)*m;s&&(t=Wd(e,f,d,p,1)*m+y/2);let n=Wd(o,f,d,p)*m;c&&(n-=y/2),v=[{x:t,y:g*(i+.5)},{x:t+20,y:g*(i+.5)},{x:t+20,y:g*(i+(i>l?0:1))},{x:n-20,y:g*(i+(i>l?0:1))},{x:n-20,y:g*(l+.5)},{x:n,y:g*(l+.5)}],t+20<=n-20&&v.splice(2,3,{x:t+20,y:g*(l+.5)});const a=v[v.length-1];b=[{x:a.x,y:a.y},{x:a.x-10,y:a.y-5},{x:a.x-10,y:a.y+5},{x:a.x,y:a.y}]}else if(t===xd.StartToFinish){let t=Wd(e,f,d,p)*m;s&&(t-=y/2);let r=Wd(a,f,d,p,1)*m;c&&(r=Wd(o,f,d,p,1)*m+y/2),v=[{x:t,y:g*(i+.5)},{x:t-20,y:g*(i+.5)},{x:t-20,y:g*(i+(i>l?0:1))},{x:r+20,y:g*(i+(i>l?0:1))},{x:r+20,y:g*(l+.5)},{x:r,y:g*(l+.5)}],t-20>=r+20&&v.splice(2,3,{x:t-20,y:g*(l+.5)});const n=v[v.length-1];b=[{x:n.x,y:n.y},{x:n.x+10,y:n.y-5},{x:n.x+10,y:n.y+5},{x:n.x,y:n.y}]}else if(t===xd.StartToStart){let t=Wd(e,f,d,p)*m;s&&(t-=y/2);let r=Wd(o,f,d,p)*m;c&&(r-=y/2),v=[{x:t,y:g*(i+.5)},{x:(i===l?t:Math.min(t,r))-20,y:g*(i+.5)},{x:(i===l?t:Math.min(t,r))-20,y:g*(l+(i===l?1:.5))},{x:r-20,y:g*(l+(i===l?1:.5))},{x:(i===l?r:Math.min(t,r))-20,y:g*(l+.5)},{x:r,y:g*(l+.5)}];const n=v[v.length-1];b=[{x:n.x,y:n.y},{x:n.x-10,y:n.y-5},{x:n.x-10,y:n.y+5},{x:n.x,y:n.y}]}else if(t===xd.FinishToFinish){let t=Wd(r,f,d,p,1)*m;s&&(t=Wd(e,f,d,p,1)*m+y/2);let n=Wd(a,f,d,p,1)*m;c&&(n=Wd(o,f,d,p,1)*m+y/2),v=[{x:t,y:g*(i+.5)},{x:(i===l?t:Math.max(t,n))+20,y:g*(i+.5)},{x:(i===l?t:Math.max(t,n))+20,y:g*(l+(i===l?1:.5))},{x:n+20,y:g*(l+(i===l?1:.5))},{x:n+20,y:g*(l+.5)},{x:n,y:g*(l+.5)}];const h=v[v.length-1];b=[{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:v,arrowPoints:b}}(m,x,S,C,0,v.record.type===Td.MILESTONE,b,_,k,0,y.record.type===Td.MILESTONE,this._scene._gantt),O=this._scene._gantt.parsedOptions.dependencyLinkLineStyle,B=Va({pickable:!0,stroke:null!==(n=null===(i=p.linkLineStyle)||void 0===i?void 0:i.lineColor)&&void 0!==n?n:O.lineColor,lineWidth:null!==(o=null===(s=p.linkLineStyle)||void 0===s?void 0:s.lineWidth)&&void 0!==o?o:O.lineWidth,lineDash:null!==(l=null===(a=p.linkLineStyle)||void 0===a?void 0:a.lineDash)&&void 0!==l?l:O.lineDash,points:A,pickStrokeBuffer:3,vtable_link:p});this.linkLinesContainer.appendChild(B),p.vtable_gantt_linkLineNode=B;const R=new Qa({fill:null!==(c=null===(h=p.linkLineStyle)||void 0===h?void 0:h.lineColor)&&void 0!==c?c:O.lineColor,points:E});this.linkLinesContainer.appendChild(R),p.vtable_gantt_linkArrowNode=R}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,r=t.vtable_gantt_linkArrowNode,i=e.clone(),n=r.clone();i.setAttribute("stroke",this._scene._gantt.parsedOptions.dependencyLinkSelectedLineStyle.lineColor),i.setAttribute("lineWidth",this._scene._gantt.parsedOptions.dependencyLinkSelectedLineStyle.lineWidth),i.setAttribute("shadowColor",this._scene._gantt.parsedOptions.dependencyLinkSelectedLineStyle.shadowColor),i.setAttribute("shadowOffsetX",this._scene._gantt.parsedOptions.dependencyLinkSelectedLineStyle.shadowOffset),i.setAttribute("shadowOffsetY",this._scene._gantt.parsedOptions.dependencyLinkSelectedLineStyle.shadowOffset),i.setAttribute("shadowBlur",this._scene._gantt.parsedOptions.dependencyLinkSelectedLineStyle.shadowBlur),this.linkLinesContainer.appendChild(i),n.setAttribute("fill",this._scene._gantt.parsedOptions.dependencyLinkSelectedLineStyle.lineColor),this.linkLinesContainer.appendChild(n),this.selectedEffectNodes=[i,n]}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,r=t.vtable_gantt_linkArrowNode;e.delete(),r.delete()}}function Sp(t,e,r,i,n,s,o,a,l,h,c,u,d,p,f,g){const{unit:m,step:y}=g.parsedOptions.reverseSortedTimelineScales[0],{minDate:v,rowHeight:b,timelineColWidth:_}=g.parsedOptions,w=g.parsedOptions.taskBarMilestoneHypotenuse,x=g.parsedOptions.taskBarMilestoneStyle.width;let S=[],T=[];if(t===xd.FinishToStart){let t=o?o.attribute.x+o.attribute.width:Wd(r,v,m,y,1)*_;s&&(t=o?o.attribute.x+o.attribute.width+(w-x)/2:Wd(e,v,m,y,1)*_+w/2);let n=p?p.attribute.x:Wd(l,v,m,y)*_;d&&(n-=(w-x)/2),S=[{x:t,y:b*(i+.5)+a},{x:t+20,y:b*(i+.5)+a},{x:t+20,y:b*(i+(i>c?0:1))+a},{x:n-20,y:b*(i+(i>c?0:1))+a},{x:n-20,y:b*(c+.5)+f},{x:n,y:b*(c+.5)+f}],t+20<=n-20&&S.splice(2,3,{x:t+20,y:b*(c+.5)+f});const h=S[S.length-1];T=[{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===xd.StartToFinish){let t=o?o.attribute.x:Wd(e,v,m,y)*_;s&&(t-=(w-x)/2);let r=p?p.attribute.x+p.attribute.width:Wd(h,v,m,y,1)*_;d&&(r=p?p.attribute.x+p.attribute.width+(w-x)/2:Wd(l,v,m,y,1)*_+w/2),S=[{x:t,y:b*(i+.5)+a},{x:t-20,y:b*(i+.5)+a},{x:t-20,y:b*(i+(i>c?0:1))+a},{x:r+20,y:b*(i+(i>c?0:1))+a},{x:r+20,y:b*(c+.5)+f},{x:r,y:b*(c+.5)+f}],t-20>=r+20&&S.splice(2,3,{x:t-20,y:b*(c+.5)+f});const n=S[S.length-1];T=[{x:n.x,y:n.y},{x:n.x+10,y:n.y-5},{x:n.x+10,y:n.y+5},{x:n.x,y:n.y}]}else if(t===xd.StartToStart){let t=o?o.attribute.x:Wd(e,v,m,y)*_;s&&(t-=(w-x)/2);let r=p?p.attribute.x:Wd(l,v,m,y)*_;d&&(r-=(w-x)/2),S=[{x:t,y:b*(i+.5)+a},{x:(i===c?t:Math.min(t,r))-20,y:b*(i+.5)+a},{x:(i===c?t:Math.min(t,r))-20,y:b*(c+(i===c?1:.5))+f},{x:r-20,y:b*(c+(i===c?1:.5))+f},{x:(i===c?r:Math.min(t,r))-20,y:b*(c+.5)+f},{x:r,y:b*(c+.5)+f}];const n=S[S.length-1];T=[{x:n.x,y:n.y},{x:n.x-10,y:n.y-5},{x:n.x-10,y:n.y+5},{x:n.x,y:n.y}]}else if(t===xd.FinishToFinish){let t=o?o.attribute.x+o.attribute.width:Wd(r,v,m,y,1)*_;s&&(t=o?o.attribute.x+o.attribute.width+(w-x)/2:Wd(e,v,m,y,1)*_+w/2);let n=p?p.attribute.x+p.attribute.width:Wd(h,v,m,y,1)*_;d&&(n=p?p.attribute.x+p.attribute.width+(w-x)/2:Wd(l,v,m,y,1)*_+w/2),S=[{x:t,y:b*(i+.5)+a},{x:(i===c?t:Math.max(t,n))+20,y:b*(i+.5)+a},{x:(i===c?t:Math.max(t,n))+20,y:b*(c+(i===c?1:.5))+f},{x:n+20,y:b*(c+(i===c?1:.5))+f},{x:n+20,y:b*(c+.5)+f},{x:n,y:b*(c+.5)+f}];const u=S[S.length-1];T=[{x:u.x,y:u.y},{x:u.x+10,y:u.y-5},{x:u.x+10,y:u.y+5},{x:u.x,y:u.y}]}return{linePoints:S,arrowPoints:T}}class Tp{constructor(t){this._scene=t,this.dragLineContainer=new ta({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=Va({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()}}Ai.load(bp);class kp{constructor(t){let e,r;var i;this._gantt=t,this.tableGroupWidth=t.tableNoFrameWidth,this.tableGroupHeight=Math.min(t.tableNoFrameHeight,t.drawHeight),"node"===$d.mode||(mc.setEnv("browser"),e=t.canvas.width,r=t.canvas.height),this.stage=(i={canvas:t.canvas,width:e,height:r,disableDirtyBounds:!1,background:t.parsedOptions.underlayBackgroundColor,enableLayout:!0,autoRender:!1,context:{appName:"vtable"},pluginList:["poptipForText"]},new Rc(i)),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 ta({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 up(this),this.grid=new Ud(this),this.dependencyLink=new xp(this),this.taskBar=new fp(this),this.markLine=new gp(this),this.toolTip=new wp(this),this.frameBorder=new mp(this),this.scrollbarComponent=new Vd(this._gantt),this.stage.defaultLayer.addChild(this.scrollbarComponent.hScrollBar),this.stage.defaultLayer.addChild(this.scrollbarComponent.vScrollBar),this.dragOrderLine=new Tp(this)}updateSceneGraph(){const t=this._gantt;let e,r;this.tableGroupWidth=t.tableNoFrameWidth,this.tableGroupHeight=Math.min(t.tableNoFrameHeight,t.drawHeight),"node"===$d.mode||(mc.setEnv("browser"),e=t.canvas.width,r=t.canvas.height),this.stage.resize(e,r),this.refreshAll()}afterCreateSceneGraph(){this.scrollbarComponent.updateScrollBar(),function(t){const e=t._gantt,r=e.stateManager,i=e.scenegraph;i.scrollbarComponent.vScrollBar.addEventListener("pointerover",(t=>{i.scrollbarComponent.showVerticalScrollBar()})),i.scrollbarComponent.hScrollBar.addEventListener("pointerover",(t=>{i.scrollbarComponent.showHorizontalScrollBar()})),i.scrollbarComponent.vScrollBar.addEventListener("pointerout",(t=>{r.interactionState!==wd.scrolling&&i.scrollbarComponent.hideVerticalScrollBar()})),i.scrollbarComponent.hScrollBar.addEventListener("pointerout",(t=>{r.interactionState!==wd.scrolling&&i.scrollbarComponent.hideHorizontalScrollBar()})),i.scrollbarComponent.vScrollBar.addEventListener("pointermove",(t=>{t.stopPropagation()})),i.scrollbarComponent.vScrollBar.addEventListener("scrollDown",(t=>{i._gantt.eventManager.isDown=!0})),i.scrollbarComponent.vScrollBar.addEventListener("pointerup",(()=>{i._gantt.eventManager.isDraging=!1,r.interactionState===wd.scrolling&&r.updateInteractionState(wd.default)})),i.scrollbarComponent.vScrollBar.addEventListener("pointerupoutside",(()=>{r.interactionState===wd.scrolling&&r.updateInteractionState(wd.default)})),i.scrollbarComponent.vScrollBar.addEventListener("scrollUp",(t=>{i._gantt.eventManager.isDraging=!1})),i.scrollbarComponent.hScrollBar.addEventListener("pointermove",(t=>{t.stopPropagation()})),i.scrollbarComponent.hScrollBar.addEventListener("pointerdown",(t=>{t.stopPropagation()})),i.scrollbarComponent.hScrollBar.addEventListener("scrollDown",(t=>{i._gantt.eventManager.isDown=!0,r.interactionState!==wd.scrolling&&r.updateInteractionState(wd.scrolling)})),i.scrollbarComponent.hScrollBar.addEventListener("pointerup",(()=>{r.interactionState===wd.scrolling&&r.updateInteractionState(wd.default)})),i.scrollbarComponent.hScrollBar.addEventListener("pointerupoutside",(()=>{r.interactionState===wd.scrolling&&r.updateInteractionState(wd.default)})),i.scrollbarComponent.hScrollBar.addEventListener("scrollUp",(t=>{i._gantt.eventManager.isDraging=!1}));const n=Cd(r.updateVerticalScrollBar,20),s=Cd(r.updateHorizontalScrollBar,20);i.scrollbarComponent.vScrollBar.addEventListener("scrollDrag",(t=>{i._gantt.eventManager.isDown&&(i._gantt.eventManager.isDraging=!0),r.interactionState!==wd.scrolling&&r.updateInteractionState(wd.scrolling);const e=t.detail.value[0]/(1-t.detail.value[1]+t.detail.value[0]);n(e,t)})),i.scrollbarComponent.hScrollBar.addEventListener("scrollDrag",(t=>{i._gantt.eventManager.isDown&&(i._gantt.eventManager.isDraging=!0),r.fastScrolling=!0,r.interactionState!==wd.scrolling&&r.updateInteractionState(wd.scrolling);const e=t.detail.value[0]/(1-t.detail.value[1]+t.detail.value[0]);s(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,e=!1){this.timelineHeader.setX(t),this.grid.setX(t),this.taskBar.setX(t),this.dependencyLink.setX(t),this.markLine.setX(t),this.updateNextFrame()}setY(t,e=!1){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,r){this.taskCreationButton||(this.taskCreationButton=new _p(this._gantt.scenegraph));const i=this._gantt.parsedOptions.taskBarCreationMaxWidth,n=this._gantt.parsedOptions.taskBarCreationMinWidth,s=this._gantt.getDateColWidth(r),o=i?Math.min(i,n?Math.max(n,s):s):n?Math.max(n,s):s,a=t-(o-s)/2;this.taskCreationButton.show(a,e,o,this._gantt.parsedOptions.rowHeight),this.updateNextFrame()}hideTaskCreationButton(){this.taskCreationButton&&(this.taskCreationButton.hide(),this.updateNextFrame())}showToolTip(t){this.toolTip||(this.toolTip=new wp(this._gantt.scenegraph)),this.toolTip.show(t)}hideToolTip(){this.toolTip.hide()}refreshRecordLinkNodes(t,e,r,i=0){const n=this._gantt,s=n.getRecordByIndex(t,e),o=s.vtable_gantt_linkedTo,a=s.vtable_gantt_linkedFrom;for(let s=0;s<(null==o?void 0:o.length);s++){const a=o[s],l=a.vtable_gantt_linkLineNode,h=a.vtable_gantt_linkArrowNode,{linkedToTaskKey:c,linkedFromTaskKey:u,type:d}=a,{taskKeyField:p,minDate:f}=n.parsedOptions,g=ip(n.records,p,u),m=ip(n.records,p,c);let y,v,b,_,w,x,S,T,k;const C=this._gantt.getTaskBarStyle(t,e);if(n.parsedOptions.tasksShowMode===Sd.Sub_Tasks_Inline){const t=op(r.attribute.y+i,n);T=g.index[0],S=n.getRowsHeightByIndex(0,t.task_index-1)/n.parsedOptions.rowHeight,({startDate:y,endDate:v,taskDays:b}=n.getTaskInfoByTaskListIndex(m.index[0],m.index[1])),({startDate:_,endDate:w,taskDays:x}=n.getTaskInfoByTaskListIndex(g.index[0],g.index[1]));const e=C.width;k=r.attribute.y+e/2-(S+.5)*n.parsedOptions.rowHeight}else if(n.parsedOptions.tasksShowMode===Sd.Project_Sub_Tasks_Inline){const t=n.getTaskShowIndexByRecordIndex(g.index.slice(0,-1)),e=n.getTaskShowIndexByRecordIndex(m.index.slice(0,-1)),r=n.getRecordByIndex(t),i=n.getRecordByIndex(e);T=r.type===Td.PROJECT&&"expand"!==r.hierarchyState&&!1!==n.parsedOptions.projectSubTasksExpandable?t:n.getTaskShowIndexByRecordIndex(g.index),S=i.type===Td.PROJECT&&"expand"!==i.hierarchyState&&!1!==n.parsedOptions.projectSubTasksExpandable?e:n.getTaskShowIndexByRecordIndex(m.index),({startDate:y,endDate:v,taskDays:b}=n.getTaskInfoByTaskListIndex(S,m.index)),({startDate:_,endDate:w,taskDays:x}=n.getTaskInfoByTaskListIndex(T,g.index))}else if(n.parsedOptions.tasksShowMode===Sd.Sub_Tasks_Separate||n.parsedOptions.tasksShowMode===Sd.Sub_Tasks_Arrange||n.parsedOptions.tasksShowMode===Sd.Sub_Tasks_Compact){const t=op(r.attribute.y+i,n);T=n.getRowsHeightByIndex(0,g.index[0]-1)/n.parsedOptions.rowHeight+(n.parsedOptions.tasksShowMode===Sd.Sub_Tasks_Arrange||n.parsedOptions.tasksShowMode===Sd.Sub_Tasks_Compact?g.record.vtable_gantt_showIndex:g.index[1]),S=n.getRowsHeightByIndex(0,t.task_index-1)/n.parsedOptions.rowHeight+(n.parsedOptions.tasksShowMode===Sd.Sub_Tasks_Arrange||n.parsedOptions.tasksShowMode===Sd.Sub_Tasks_Compact?m.record.vtable_gantt_showIndex:t.sub_task_index),({startDate:y,endDate:v,taskDays:b}=n.getTaskInfoByTaskListIndex(m.index[0],m.index[1])),({startDate:_,endDate:w,taskDays:x}=n.getTaskInfoByTaskListIndex(g.index[0],g.index[1]));const e=C.width;k=r.attribute.y+e/2-(S+.5)*n.parsedOptions.rowHeight}else{if(T=n.getTaskShowIndexByRecordIndex(g.index),S=n.getTaskShowIndexByRecordIndex(m.index),-1===T||-1===S)continue;({startDate:y,endDate:v,taskDays:b}=n.getTaskInfoByTaskListIndex(S)),({startDate:_,endDate:w,taskDays:x}=n.getTaskInfoByTaskListIndex(T))}if(!(_&&w&&y&&v&&l&&h))return;const{linePoints:E,arrowPoints:A}=Sp(d,_,w,T,0,g.record.type===Td.MILESTONE,null,0,y,v,S,0,m.record.type===Td.MILESTONE,r,null!=k?k:0,this._gantt);l.setAttribute("points",E),h.setAttribute("points",A)}for(let s=0;s<(null==a?void 0:a.length);s++){const o=a[s],l=o.vtable_gantt_linkLineNode,h=o.vtable_gantt_linkArrowNode,{linkedToTaskKey:c,linkedFromTaskKey:u,type:d}=o,{taskKeyField:p,minDate:f}=n.parsedOptions,g=ip(n.records,p,c),m=ip(n.records,p,u);let y,v,b,_,w,x,S,T,k;const C=this._gantt.getTaskBarStyle(t,e);if(n.parsedOptions.tasksShowMode===Sd.Sub_Tasks_Inline){const t=op(r.attribute.y+i,n);T=n.getRowsHeightByIndex(0,t.task_index-1)/n.parsedOptions.rowHeight,S=g.index[0],({startDate:y,endDate:v,taskDays:b}=n.getTaskInfoByTaskListIndex(g.index[0],g.index[1])),({startDate:_,endDate:w,taskDays:x}=n.getTaskInfoByTaskListIndex(m.index[0],m.index[1]));const e=C.width;k=r.attribute.y+e/2-(T+.5)*n.parsedOptions.rowHeight}else if(n.parsedOptions.tasksShowMode===Sd.Project_Sub_Tasks_Inline){const t=n.getTaskShowIndexByRecordIndex(m.index.slice(0,-1)),e=n.getTaskShowIndexByRecordIndex(g.index.slice(0,-1)),r=n.getRecordByIndex(t),i=n.getRecordByIndex(e);T=r.type===Td.PROJECT&&"expand"!==r.hierarchyState&&!1!==n.parsedOptions.projectSubTasksExpandable?t:n.getTaskShowIndexByRecordIndex(m.index),S=i.type===Td.PROJECT&&"expand"!==i.hierarchyState&&!1!==n.parsedOptions.projectSubTasksExpandable?e:n.getTaskShowIndexByRecordIndex(g.index),({startDate:y,endDate:v,taskDays:b}=n.getTaskInfoByTaskListIndex(S,g.index)),({startDate:_,endDate:w,taskDays:x}=n.getTaskInfoByTaskListIndex(T,m.index))}else if(n.parsedOptions.tasksShowMode===Sd.Sub_Tasks_Separate||n.parsedOptions.tasksShowMode===Sd.Sub_Tasks_Arrange||n.parsedOptions.tasksShowMode===Sd.Sub_Tasks_Compact){const t=op(r.attribute.y+i,n);T=n.getRowsHeightByIndex(0,t.task_index-1)/n.parsedOptions.rowHeight+(n.parsedOptions.tasksShowMode===Sd.Sub_Tasks_Arrange||n.parsedOptions.tasksShowMode===Sd.Sub_Tasks_Compact?m.record.vtable_gantt_showIndex:t.sub_task_index),S=n.getRowsHeightByIndex(0,g.index[0]-1)/n.parsedOptions.rowHeight+(n.parsedOptions.tasksShowMode===Sd.Sub_Tasks_Arrange||n.parsedOptions.tasksShowMode===Sd.Sub_Tasks_Compact?g.record.vtable_gantt_showIndex:g.index[1]),({startDate:y,endDate:v,taskDays:b}=n.getTaskInfoByTaskListIndex(g.index[0],g.index[1])),({startDate:_,endDate:w,taskDays:x}=n.getTaskInfoByTaskListIndex(m.index[0],m.index[1]));const e=C.width;k=r.attribute.y+e/2-(T+.5)*n.parsedOptions.rowHeight}else{if(T=n.getTaskShowIndexByRecordIndex(m.index),S=n.getTaskShowIndexByRecordIndex(g.index),-1===T||-1===S)continue;({startDate:y,endDate:v,taskDays:b}=n.getTaskInfoByTaskListIndex(S)),({startDate:_,endDate:w,taskDays:x}=n.getTaskInfoByTaskListIndex(T))}if(!(_&&w&&y&&v&&l&&h))return;const{linePoints:E,arrowPoints:A}=Sp(d,_,w,T,0,m.record.type===Td.MILESTONE,r,null!=k?k:0,y,v,S,0,g.record.type===Td.MILESTONE,null,0,this._gantt);l.setAttribute("points",E),h.setAttribute("points",A)}}}const Cp=(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 Ep(t,e,r){let i,n,s,o,a,l,h=0,c=!1,u=!1,d=!0;const p=!e&&0!==e&&"function"==typeof requestAnimationFrame;if("function"!=typeof t)throw new TypeError("Expected a function");function f(e){const r=i,s=n;return n=void 0,i=void 0,h=e,o=t.apply(s,r),o}function g(t,e){return p?requestAnimationFrame(t):setTimeout(t,e)}function m(t){const r=t-l;return void 0===l||r>=e||r<0||c&&t-h>=s}function y(){const t=Date.now();if(m(t))return function(t){return a=void 0,d&&i?f(t):(n=void 0,i=void 0,o)}(t);a=g(y,function(t){const r=t-h,i=e&&-(t-l);return c?Math.min(i,s-r):i}(t))}return e=+e||0,Cp(r,"object")&&(u=!!r.leading,c="maxWait"in r,c&&(s=Math.max(+r.maxWait||0,e)),d="trailing"in r?!!r.trailing:d),function(...t){const r=Date.now(),s=m(r);if(i=t,n=this,l=r,s){if(void 0===a)return function(t){return h=t,a=g(y,e),u?f(t):o}(l);if(c)return a=g(y,e),f(l)}return void 0===a&&(a=g(y,e)),o}}let Ap=1;class Op{constructor(t,e,r){var i;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(),r&&(this.resizeTime=Math.max(r,16)),this.callBackDebounce=Ep(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===(i=this.observer)||void 0===i||i.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 Bp{constructor(){this.listeners={},this.reseizeListeners={}}on(t,e,r,...i){if("node"===$d.mode)return-1;const n=Ap++;if(null==t?void 0:t.addEventListener)if("resize"!==e||t===window)null==t||t.addEventListener(e,r,...i);else{const e=new Op(t,r,this.resizeTime);this.reseizeListeners[n]=e}const s={target:t,type:e,listener:r,options:i};return this.listeners[n]=s,n}once(t,e,r,...i){if("node"===$d.mode)return-1;const n=this.on(t,e,((...t)=>{this.off(n),r(...t)}),...i);return n}off(t){var e;if("node"===$d.mode)return;if(null==t)return;const r=null===(e=this.listeners)||void 0===e?void 0:e[t];r&&(delete this.listeners[t],r.target.removeEventListener&&r.target.removeEventListener(r.type,r.listener,...r.options))}fire(t,e,...r){if("node"!==$d.mode)for(const i in this.listeners){const n=this.listeners[i];n.target===t&&n.type===e&&n.listener.call(n.target,...r)}}hasListener(t,e){if("node"===$d.mode)return!1;let r=!1;for(const i in this.listeners){const n=this.listeners[i];n.target===t&&n.type===e&&(r=!0)}return r}clear(){if("node"!==$d.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"!==$d.mode&&(this.clear(),this.listeners={})}}let Rp=1;function Lp(){return Zd?Rp=1:(Rp=Math.ceil(window.devicePixelRatio||1),Rp>1&&Rp%2!=0&&(Rp+=1)),Rp}function Pp(t){return!!t.changedTouches}Lp();class Dp{constructor(){}setScrollHandle(t){this.scrollHandle=t}startInertia(t,e,r){this.stopped=!1,this.lastTime=Date.now(),this.speedX=t,this.speedY=e,this.friction=r,this.runingId||(this.runingId=requestAnimationFrame(this.inertia.bind(this)))}inertia(){var t;if(this.stopped)return;const e=Date.now(),r=e-this.lastTime;let i=!0;const n=Math.pow(this.friction,r/16),s=n*this.speedX,o=n*this.speedY;let a=0,l=0;Math.abs(s)>.05&&(i=!1,a=(this.speedX+s)/2*r),Math.abs(o)>.05&&(i=!1,l=(this.speedY+o)/2*r),null===(t=this.scrollHandle)||void 0===t||t.call(this,a,l),i?this.runingId=null:(this.lastTime=e,this.speedX=s,this.speedY=o,this.runingId=requestAnimationFrame(this.inertia.bind(this)))}endInertia(){cancelAnimationFrame(this.runingId),this.runingId=null,this.stopped=!0}isInertiaScrolling(){return!!this.runingId}}class Mp{constructor(t){this.isDown=!1,this.isDraging=!1,this.globalEventListeners=[],this._enableTableScroll=!0,this._gantt=t,this.inertiaScroll=new Dp,this._eventHandler=new Bp,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,r=t._gantt,i=r.stateManager;e.ganttGroup.addEventListener("pointerdown",(n=>{if(0!==n.button)return;let s,o,a;if(n.detailPath.find((t=>"task-bar"===t.name?(s=t,!0):"task-creation-button"===t.name||("task-bar-link-point-left"===t.name?(o=t,!0):"task-bar-link-point-right"===t.name?(a=t,!0):!!t.attribute.vtable_link&&(t.attribute.vtable_link,!0)))),s){const o=s.record;if((null==o?void 0:o.type)!==Td.PROJECT)if("task-bar-hover-shadow-left-icon"===n.target.name)i.startResizeTaskBar(s,n.nativeEvent.x,n.nativeEvent.y,n.offset.y,"left"),i.updateInteractionState(wd.grabing);else if("task-bar-hover-shadow-right-icon"===n.target.name)i.startResizeTaskBar(s,n.nativeEvent.x,n.nativeEvent.y,n.offset.y,"right"),i.updateInteractionState(wd.grabing);else if(r.parsedOptions.taskBarMoveable){const o=()=>{let t=!0;if("function"==typeof r.parsedOptions.taskBarMoveable){const{startDate:i,endDate:n,taskRecord:o}=e._gantt.getTaskInfoByTaskListIndex(s.task_index,s.sub_task_index),a={index:s.task_index,startDate:i,endDate:n,taskRecord:o,ganttInstance:e._gantt};t=r.parsedOptions.taskBarMoveable(a)}else t=r.parsedOptions.taskBarMoveable;t&&(i.startMoveTaskBar(s,n.nativeEvent.x,n.nativeEvent.y,n.offset.y),i.updateInteractionState(wd.grabing))};"touch"===n.pointerType?(t.touchEnd=!1,t.touchSetTimeout=setTimeout((()=>{t.isTouchdown=!1,t.isLongTouch=!0,o()}),100)):o()}}else o?(i.startCreateDependencyLine(o,n.nativeEvent.x,n.nativeEvent.y,n.offset.y,"left"),i.updateInteractionState(wd.grabing)):a&&(i.startCreateDependencyLine(a,n.nativeEvent.x,n.nativeEvent.y,n.offset.y,"right"),i.updateInteractionState(wd.grabing))})),e.ganttGroup.addEventListener("pointermove",(n=>{var s,o,a,l,h;if(t.touchSetTimeout&&(clearTimeout(t.touchSetTimeout),t.touchSetTimeout=void 0),i.interactionState===wd.default){const t=n.detailPath.find((t=>"task-bar"===t.name)),a=n.detailPath.find((t=>"markline-hover-group"===t.name)),l=n.detailPath.find((t=>"mark-line-content"===t.name));if((null===(s=r.parsedOptions.markLineCreateOptions)||void 0===s?void 0:s.markLineCreatable)&&(a&&!function(t,e){const r=t.startDate.getTime(),i=t.endDate.getTime();return e.some((t=>{const e=new Date(t.date).getTime();return e>=r&&e<=i}))}(a.data,r.parsedOptions.markLine)?e._gantt.stateManager.marklineIcon.target!==a&&(e._gantt.stateManager.marklineIcon.target=a,i.showMarklineIconHover()):e._gantt.stateManager.marklineIcon.target&&i.hideMarklineIconHover()),t){if(e._gantt.stateManager.hoverTaskBar.target!==t){e._gantt.stateManager.hoverTaskBar.target=t;const r=t.task_index,s=t.sub_task_index,o=t.record;o.type!==Td.PROJECT&&i.showTaskBarHover(),e._gantt.hasListeners(kd.MOUSEENTER_TASK_BAR)&&e._gantt.fireListeners(kd.MOUSEENTER_TASK_BAR,{federatedEvent:n,event:n.nativeEvent,index:r,sub_task_index:s,record:o})}}else{if(e._gantt.stateManager.hoverTaskBar.target){if(e._gantt.hasListeners(kd.MOUSELEAVE_TASK_BAR)){const t=e._gantt.stateManager.hoverTaskBar.target.task_index,r=e._gantt.stateManager.hoverTaskBar.target.sub_task_index,i=e._gantt.getRecordByIndex(t,r);e._gantt.fireListeners(kd.MOUSELEAVE_TASK_BAR,{federatedEvent:n,event:n.nativeEvent,index:t,sub_task_index:r,record:i})}i.hideTaskBarHover(n)}if(r.parsedOptions.taskBarCreatable&&!l){const t=op(n.offset.y-r.headerHeight+r.stateManager.scrollTop,r),e=r.getTaskInfoByTaskListIndex(t.task_index,t.sub_task_index);let i=!0;if("function"==typeof r.parsedOptions.taskBarCreatable){const{startDate:n,endDate:s,taskRecord:o}=e,a={index:t.task_index,sub_task_index:t.sub_task_index,startDate:n,endDate:s,taskRecord:o,ganttInstance:r};i=r.parsedOptions.taskBarCreatable(a)}else i=r.parsedOptions.taskBarCreatable;if(i){const i=function(t,e,r){const i=op(e-r.headerHeight+r.stateManager.scrollTop,r),n=r.getRecordByIndex(i.task_index),s=Kd(t,r),o=r.getDateRangeByIndex(s);if(null==n?void 0:n.children){const t=op(e-r.headerHeight+r.stateManager.scrollTop,r);for(let e=0;e<n.children.length;e++){const{startDate:i,endDate:s,taskDays:a,progress:l,taskRecord:h}=r.getTaskInfoByTaskListIndex(t.task_index,e);if(((r.parsedOptions.tasksShowMode===Sd.Sub_Tasks_Compact||r.parsedOptions.tasksShowMode===Sd.Sub_Tasks_Arrange)&&h.vtable_gantt_showIndex===t.sub_task_index||r.parsedOptions.tasksShowMode===Sd.Sub_Tasks_Inline||r.parsedOptions.tasksShowMode===Sd.Project_Sub_Tasks_Inline&&n.type===Td.PROJECT&&"expand"!==n.hierarchyState&&!1!==r.parsedOptions.projectSubTasksExpandable)&&i&&s&&o.startDate.getTime()>=i.getTime()&&o.endDate.getTime()<=s.getTime())return{startDate:i,endDate:s,taskDays:a,progress:l,taskRecord:h}}}}(n.offset.x,n.offset.y,r);if((r.parsedOptions.tasksShowMode===Sd.Sub_Tasks_Separate||r.parsedOptions.tasksShowMode===Sd.Tasks_Separate)&&!e.taskDays&&e.taskRecord&&!e.taskRecord.vtableMerge||(r.parsedOptions.tasksShowMode===Sd.Sub_Tasks_Inline||r.parsedOptions.tasksShowMode===Sd.Sub_Tasks_Arrange||r.parsedOptions.tasksShowMode===Sd.Sub_Tasks_Compact)&&!i){const e=Kd(n.offset.x,r),i=(e>=1?r.getDateColsWidth(0,e-1):0)-r.stateManager.scroll.horizontalBarPos,s=r.taskListTableInstance.getRowsHeight(r.taskListTableInstance.columnHeaderLevelCount,t.task_index+r.taskListTableInstance.columnHeaderLevelCount-1)+(null!==(o=t.sub_task_index)&&void 0!==o?o:0)*r.parsedOptions.rowHeight-r.stateManager.scroll.verticalBarPos;return void r.scenegraph.showTaskCreationButton(i,s,e)}}}}r.scenegraph.hideTaskCreationButton()}else if(i.interactionState===wd.grabing){let t,r,s;n.detailPath.find((e=>"task-bar"===e.name?(t=e,!0):"task-creation-button"===e.name||("task-bar-link-point-left"===e.name?(r=e,!0):"task-bar-link-point-right"===e.name?(s=e,!0):!!e.attribute.vtable_link&&(e.attribute.vtable_link,!0)))),t=null!==(l=null!=t?t:null===(a=null==r?void 0:r.parent)||void 0===a?void 0:a.attribute.attachedToTaskBarNode)&&void 0!==l?l:null===(h=null==s?void 0:s.parent)||void 0===h?void 0:h.attribute.attachedToTaskBarNode,e._gantt.stateManager.isCreatingDependencyLine()&&!t?i.hideSecondTaskBarSelectedBorder():e._gantt.stateManager.isCreatingDependencyLine()&&r&&e._gantt.stateManager.selectedTaskBar.target!==t?(i.highlightLinkPointNode(r),i.creatingDenpendencyLink.lastHighLightLinkPoint=r,i.creatingDenpendencyLink.secondTaskBarPosition="left"):e._gantt.stateManager.isCreatingDependencyLine()&&s&&e._gantt.stateManager.selectedTaskBar.target!==t?(i.highlightLinkPointNode(s),i.creatingDenpendencyLink.lastHighLightLinkPoint=s,i.creatingDenpendencyLink.secondTaskBarPosition="right"):e._gantt.stateManager.isCreatingDependencyLine()&&t&&e._gantt.stateManager.selectedTaskBar.target!==t&&(i.unhighlightLinkPointNode(i.creatingDenpendencyLink.lastHighLightLinkPoint),i.creatingDenpendencyLink.secondTaskBarNode&&i.creatingDenpendencyLink.secondTaskBarNode===t||(i.creatingDenpendencyLink.secondTaskBarNode&&i.creatingDenpendencyLink.secondTaskBarNode!==t&&i.hideSecondTaskBarSelectedBorder(),i.creatingDenpendencyLink.secondTaskBarNode=t,i.showSecondTaskBarSelectedBorder()))}})),e.ganttGroup.addEventListener("pointerup",(n=>{var s,o;if(t.touchSetTimeout&&(clearTimeout(t.touchSetTimeout),t.touchSetTimeout=void 0),0===n.button){let a,l,h,c=!1,u=!1,d=!1,p=!1,f=!1,g=!1,m=!1;const y=n.detailPath.find((t=>"task-bar"===t.name?(c=!0,!0):"task-creation-button"===t.name?(u=!0,!1):"task-bar-link-point-left"===t.name?(p=!0,!1):"task-bar-link-point-right"===t.name?(f=!0,!1):t.attribute.vtable_link?(d=!0,a=t.attribute.vtable_link,!1):"markline-hover-group"===t.name?(g=!0,h=t,!1):"mark-line-content"===t.name&&(m=!0,l=t,!1)));if(c&&e._gantt.parsedOptions.taskBarSelectable&&"down"===t.poniterState){if(i.hideDependencyLinkSelectedLine(),i.showTaskBarSelectedBorder(y),r.hasListeners(kd.CLICK_TASK_BAR)){const t=y.task_index,e=y.sub_task_index,i=r.getRecordByIndex(t,e);r.fireListeners(kd.CLICK_TASK_BAR,{federatedEvent:n,event:n.nativeEvent,index:t,sub_task_index:e,record:i})}}else if(u&&"down"===t.poniterState){i.hideDependencyLinkSelectedLine(),i.hideTaskBarSelectedBorder();const t=op(n.offset.y-r.headerHeight+r.stateManager.scrollTop,r);if(r.parsedOptions.tasksShowMode===Sd.Sub_Tasks_Arrange||r.parsedOptions.tasksShowMode===Sd.Sub_Tasks_Inline||r.parsedOptions.tasksShowMode===Sd.Sub_Tasks_Compact){if(r.hasListeners(kd.CREATE_TASK_SCHEDULE)){const e=Kd(n.offset.x,r),i=r.getDateRangeByIndex(e),o=null!==(s=r.parsedOptions.dateFormat)&&void 0!==s?s:r.parsedOptions.timeScaleIncludeHour?"yyyy-mm-dd hh:mm:ss":"yyyy-mm-dd";r.fireListeners(kd.CREATE_TASK_SCHEDULE,{federatedEvent:n,event:n.nativeEvent,index:t.task_index,sub_task_index:t.sub_task_index,startDate:Ed(i.startDate,o),endDate:Ed(i.endDate,o),record:void 0,parentRecord:r.getRecordByIndex(t.task_index)})}}else{const e=r.getTaskInfoByTaskListIndex(t.task_index,t.sub_task_index);if(e.taskRecord){const i=null!==(o=r.parsedOptions.dateFormat)&&void 0!==o?o:r.parsedOptions.timeScaleIncludeHour?"yyyy-mm-dd hh:mm:ss":"yyyy-mm-dd",s=Kd(n.offset.x,r),a=r.getDateRangeByIndex(s);e.taskRecord[r.parsedOptions.startDateField]=Ed(a.startDate,i),e.taskRecord[r.parsedOptions.endDateField]=Ed(a.endDate,i),r.scenegraph.hideTaskCreationButton(),r.updateTaskRecord(e.taskRecord,t.task_index,t.sub_task_index),r.hasListeners(kd.CREATE_TASK_SCHEDULE)&&r.fireListeners(kd.CREATE_TASK_SCHEDULE,{federatedEvent:n,event:n.nativeEvent,index:t.task_index,sub_task_index:t.sub_task_index,startDate:e.taskRecord[r.parsedOptions.startDateField],endDate:e.taskRecord[r.parsedOptions.endDateField],record:e.taskRecord})}}}else if(d&&e._gantt.parsedOptions.dependencyLinkSelectable&&"down"===t.poniterState)i.hideDependencyLinkSelectedLine(),i.hideTaskBarSelectedBorder(),e._gantt.stateManager.selectedDenpendencyLink.link=a,i.showDependencyLinkSelectedLine();else if((p||f)&&"down"===t.poniterState){if(r.hasListeners(kd.CLICK_DEPENDENCY_LINK_POINT)){const t=op(n.offset.y-r.headerHeight+r.stateManager.scrollTop,r),e=r.getRecordByIndex(t.task_index,t.sub_task_index);r.fireListeners(kd.CLICK_DEPENDENCY_LINK_POINT,{event:n.nativeEvent,index:t.task_index,sub_task_index:t.sub_task_index,point:p?"start":"end",record:e})}i.hideTaskBarSelectedBorder()}else if(g&&"down"===t.poniterState)r.hasListeners(kd.CLICK_MARKLINE_CREATE)&&r.fireListeners(kd.CLICK_MARKLINE_CREATE,{event:n.nativeEvent,position:cp(h,e._gantt),data:e._gantt.stateManager.marklineIcon.target.data});else if(m&&"down"===t.poniterState)r.hasListeners(kd.CLICK_MARKLINE_CONTENT)&&r.fireListeners(kd.CLICK_MARKLINE_CONTENT,{event:n.nativeEvent,position:cp(l,e._gantt),data:l.data});else if(p&&"draging"===t.poniterState){if(i.isCreatingDependencyLine()){const t=i.endCreateDependencyLine(n.offset.y);r.hasListeners(kd.CREATE_DEPENDENCY_LINK)&&r.fireListeners(kd.CREATE_DEPENDENCY_LINK,{federatedEvent:n,event:n.nativeEvent,link:t})}}else if(f&&"draging"===t.poniterState){if(i.isCreatingDependencyLine()){const t=i.endCreateDependencyLine(n.offset.y);r.hasListeners(kd.CREATE_DEPENDENCY_LINK)&&r.fireListeners(kd.CREATE_DEPENDENCY_LINK,{federatedEvent:n,event:n.nativeEvent,link:t})}}else i.hideDependencyLinkSelectedLine(),i.hideTaskBarSelectedBorder()}})),e.ganttGroup.addEventListener("rightdown",(t=>{let e,i=!1,n=!1;const s=t.detailPath.find((t=>"task-bar"===t.name?(i=!0,!0):!!t.attribute.vtable_link&&(n=!0,e=t.attribute.vtable_link,!1)));if(i){if(r.hasListeners(kd.CONTEXTMENU_TASK_BAR)){const e=s.task_index,i=s.sub_task_index,n=r.getRecordByIndex(e,i);r.fireListeners(kd.CONTEXTMENU_TASK_BAR,{federatedEvent:t,event:t.nativeEvent,index:e,sub_task_index:i,record:n})}}else n&&r.hasListeners(kd.CONTEXTMENU_DEPENDENCY_LINK)&&r.fireListeners(kd.CONTEXTMENU_DEPENDENCY_LINK,{federatedEvent:t,event:t.nativeEvent,link:e})})),e.ganttGroup.addEventListener("pointerenter",(t=>{(r.parsedOptions.scrollStyle.horizontalVisible&&"focus"===r.parsedOptions.scrollStyle.horizontalVisible||!r.parsedOptions.scrollStyle.horizontalVisible&&"focus"===r.parsedOptions.scrollStyle.visible)&&e.scrollbarComponent.showHorizontalScrollBar(),(r.parsedOptions.scrollStyle.verticalVisible&&"focus"===r.parsedOptions.scrollStyle.verticalVisible||!r.parsedOptions.scrollStyle.verticalVisible&&"focus"===r.parsedOptions.scrollStyle.visible)&&e.scrollbarComponent.showVerticalScrollBar()})),e.ganttGroup.addEventListener("pointerleave",(t=>{if((r.parsedOptions.scrollStyle.horizontalVisible&&"focus"===r.parsedOptions.scrollStyle.horizontalVisible||!r.parsedOptions.scrollStyle.horizontalVisible&&"focus"===r.parsedOptions.scrollStyle.visible)&&e.scrollbarComponent.hideHorizontalScrollBar(),(r.parsedOptions.scrollStyle.verticalVisible&&"focus"===r.parsedOptions.scrollStyle.verticalVisible||!r.parsedOptions.scrollStyle.verticalVisible&&"focus"===r.parsedOptions.scrollStyle.visible)&&e.scrollbarComponent.hideVerticalScrollBar(),e._gantt.stateManager.hoverTaskBar.target){if(e._gantt.hasListeners(kd.MOUSELEAVE_TASK_BAR)){const r=e._gantt.stateManager.hoverTaskBar.target.task_index,i=e._gantt.stateManager.hoverTaskBar.target.sub_task_index,n=e._gantt.getRecordByIndex(r,i);e._gantt.fireListeners(kd.MOUSELEAVE_TASK_BAR,{federatedEvent:t,event:t.nativeEvent,index:r,sub_task_index:i,record:n})}i.hideTaskBarHover(t)}})),e.ganttGroup.addEventListener("wheel",(t=>{Gd(t,i,r)}))})(this),function(t){const e=t._gantt,r=(t._gantt.scenegraph,e.stateManager),i=t._eventHandler;i.on(e.getElement(),"contextmenu",(t=>{var r;!1!==(null===(r=e.parsedOptions.eventOptions)||void 0===r?void 0:r.preventDefaultContextMenu)&&t.preventDefault()})),i.on(e.getContainer(),"resize",(t=>{0===t.width&&0===t.height||(ld(e.options.pixelRatio)||e.setPixelRatio(Lp()),t.windowSizeNotChange||e._resize())})),e.taskListTableInstance&&e.parsedOptions.verticalSplitLineMoveable&&i.on(e.verticalSplitResizeLine,"mousedown",(t=>{r.updateInteractionState(wd.grabing),r.startResizeTableWidth(t)})),e.parsedOptions.verticalSplitLineHighlight&&(e.verticalSplitResizeLine&&i.on(e.verticalSplitResizeLine,"mouseover",(t=>{e.verticalSplitResizeLine.childNodes[1].style.opacity="1"})),e.verticalSplitResizeLine&&i.on(e.verticalSplitResizeLine,"mouseout",(t=>{e.verticalSplitResizeLine.childNodes[1].style.opacity="0"})));const n=t=>{e.eventManager.lastDragPointerXYOnWindow={x:t.x,y:t.y},e.eventManager.poniterState="down"};t.globalEventListeners.push({name:"pointerdown",env:"document",callback:n}),mc.addEventListener("pointerdown",n);const s=t=>{var i,n,s,o,a,l;if("down"===e.eventManager.poniterState){const r=null!==(i=e.eventManager.lastDragPointerXYOnWindow.x)&&void 0!==i?i:t.x,s=t.x-r,o=null!==(n=e.eventManager.lastDragPointerXYOnWindow.y)&&void 0!==n?n:t.y,a=t.y-o;(Math.abs(s)>=1||Math.abs(a)>=1)&&(e.eventManager.poniterState="draging")}if(r.interactionState===wd.grabing&&"draging"===e.eventManager.poniterState){const i=null!==(o=null===(s=e.eventManager.lastDragPointerXYOnWindow)||void 0===s?void 0:s.x)&&void 0!==o?o:t.x,n=null!==(l=null===(a=e.eventManager.lastDragPointerXYOnWindow)||void 0===a?void 0:a.y)&&void 0!==l?l:t.y;(Math.abs(i-t.x)>=1||Math.abs(n-t.y)>=1)&&(r.isResizingTableWidth()?(r.hideDependencyLinkSelectedLine(),r.hideTaskBarSelectedBorder(),r.dealResizeTableWidth(t)):r.isMoveingTaskBar()?(r.hideDependencyLinkSelectedLine(),r.hideTaskBarSelectedBorder(),r.dealTaskBarMove(t)):r.isResizingTaskBar()?(r.hideDependencyLinkSelectedLine(),r.hideTaskBarSelectedBorder(),r.dealTaskBarResize(t)):r.isCreatingDependencyLine()&&r.dealCreateDependencyLine(t),e.eventManager.lastDragPointerXYOnWindow={x:t.x,y:t.y})}};t.globalEventListeners.push({name:"pointermove",env:"document",callback:s}),mc.addEventListener("pointermove",s);const o=t=>{"grabing"===r.interactionState&&(r.updateInteractionState(wd.default),r.isResizingTableWidth()?r.endResizeTableWidth():r.isMoveingTaskBar()?r.endMoveTaskBar():r.isResizingTaskBar()&&r.endResizeTaskBar(t.x)),setTimeout((()=>{e.eventManager.lastDragPointerXYOnWindow=void 0,e.eventManager.poniterState="up"}),0)};t.globalEventListeners.push({name:"pointerup",env:"document",callback:o}),mc.addEventListener("pointerup",o);const a=t=>{var i,n;if(e.parsedOptions.dependencyLinkDeletable&&("Delete"===t.key&&(null===(i=e.parsedOptions.keyboardOptions)||void 0===i?void 0:i.deleteLinkOnDel)||"Backspace"===t.key&&(null===(n=e.parsedOptions.keyboardOptions)||void 0===n?void 0:n.deleteLinkOnBack))&&e.stateManager.selectedDenpendencyLink.link){const i=e.stateManager.selectedDenpendencyLink.link;e.deleteLink(e.stateManager.selectedDenpendencyLink.link),r.hideDependencyLinkSelectedLine(),r.hideTaskBarSelectedBorder(),e.hasListeners(kd.DELETE_DEPENDENCY_LINK)&&e.fireListeners(kd.DELETE_DEPENDENCY_LINK,{event:t,link:i})}};t.globalEventListeners.push({name:"keydown",env:"document",callback:a}),mc.addEventListener("keydown",a)}(this),function(t){const e=t._gantt,r=e.stateManager,i=e.scenegraph;if(!1===mc.envContribution.supportsTouchEvents)return;mc.addEventListener("contextmenu",(t=>{t.stopPropagation(),t.preventDefault()}),{capture:!0}),t.touchMovePoints=[],e.scenegraph.ganttGroup.addEventListener("touchstart",(e=>{e.target.isChildOf(i.scrollbarComponent.vScrollBar)||e.target.isChildOf(i.scrollbarComponent.hScrollBar)||(t.isTouchdown=!0,t.touchMovePoints.push({x:e.page.x,y:e.page.y,timestamp:Date.now()}))}));const n=i=>{if(t.isLongTouch&&i.preventDefault(),t.isTouchdown&&Pp(i)&&(t.isTouchMove=!0,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 n=-t.touchMovePoints[t.touchMovePoints.length-1].x+t.touchMovePoints[t.touchMovePoints.length-2].x,s=-t.touchMovePoints[t.touchMovePoints.length-1].y+t.touchMovePoints[t.touchMovePoints.length-2].y;Gd(i,r,e),i.cancelable&&("none"===e.parsedOptions.overscrollBehavior||Math.abs(s)>=Math.abs(n)&&0!==s&&Xd(s,r)||Math.abs(s)<=Math.abs(n)&&0!==n&&Yd(n,r))&&i.preventDefault()}};mc.addEventListener("touchmove",n,{passive:!1}),t.globalEventListeners.push({name:"touchmove",env:"vglobal",callback:n});const s=r=>{var i,n;if(t.touchEnd=!0,t.isLongTouch=!1,t.isTouchdown&&Pp(r)){if((null===(i=t.touchMovePoints)||void 0===i?void 0:i.length)&&(t.touchMovePoints.length>4&&t.touchMovePoints.shift(),t.touchMovePoints.push({x:r.changedTouches[0].pageX,y:r.changedTouches[0].pageY,timestamp:Date.now()}),t._enableTableScroll)){const r=t.touchMovePoints[0],i=t.touchMovePoints[(null===(n=t.touchMovePoints)||void 0===n?void 0:n.length)-1],s=(i.x-r.x)/(i.timestamp-r.timestamp),o=(i.y-r.y)/(i.timestamp-r.timestamp);t.inertiaScroll.startInertia(s,o,.95),e.eventManager.inertiaScroll.setScrollHandle(((t,r)=>{Gd({deltaX:-t,deltaY:-r},e.stateManager,e)}))}t.isTouchdown=!1,t.isTouchMove=!1,t.isDraging=!1,t.touchMovePoints=[]}};mc.addEventListener("touchend",s),t.globalEventListeners.push({name:"touchend",env:"vglobal",callback:s});const o=e=>{t.touchEnd=!0,t.isLongTouch=!1,t.isTouchdown&&(t.isTouchdown=!1,t.isTouchMove=!1,t.touchMovePoints=[],t.isDraging=!1)};mc.addEventListener("touchcancel",o),t.globalEventListeners.push({name:"touchcancel",env:"vglobal",callback:o})}(this)}}function Ip(t){const{scroll:e}=t.stateManager,{verticalBarPos:r}=e;t.taskListTableInstance.stateManager.setScrollTop(r,void 0,!1)}function Np(t){var e,r,i,n,s,o,a,l;const h=t.taskTableWidth;t.taskTableWidth=t.taskListTableInstance.getAllColsWidth()+t.parsedOptions.outerFrameStyle.borderLineWidth,(null===(r=null===(e=t.options)||void 0===e?void 0:e.taskListTable)||void 0===r?void 0:r.maxTableWidth)&&(t.taskTableWidth=Math.min(null===(n=null===(i=t.options)||void 0===i?void 0:i.taskListTable)||void 0===n?void 0:n.maxTableWidth,t.taskTableWidth)),(null===(o=null===(s=t.options)||void 0===s?void 0:s.taskListTable)||void 0===o?void 0:o.minTableWidth)&&(t.taskTableWidth=Math.max(null===(l=null===(a=t.options)||void 0===a?void 0:a.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(),rp(t))}class Fp{constructor(t){var e;this.interactionState=wd.default,this.resetInteractionState=Ep((()=>{this.updateInteractionState(wd.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 Dp},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:r}=e;t.stateManager.scroll.verticalBarPos!==r&&t.stateManager.setScrollTop(r,!1)}})))}(this._gantt),function(t){var e;null===(e=t.taskListTableInstance)||void 0===e||e.on("change_cell_value",(e=>{const{col:r,row:i}=e;t.taskListTableInstance.isHeader(r,i)||t._refreshTaskBar(i-t.taskListTableInstance.columnHeaderLevelCount)}))}(this._gantt),function(t){var e,r,i,n;null===(e=t.taskListTableInstance)||void 0===e||e.on("change_header_position",(e=>{t.parsedOptions.tasksShowMode===Sd.Sub_Tasks_Arrange||t.parsedOptions.tasksShowMode===Sd.Sub_Tasks_Compact||t.parsedOptions.tasksShowMode===Sd.Sub_Tasks_Separate||t.parsedOptions.tasksShowMode===Sd.Project_Sub_Tasks_Inline?t.scenegraph.refreshTaskBarsAndGrid():t.scenegraph.refreshTaskBars(),t.scenegraph.dragOrderLine.hideDragLine();const r=t.stateManager.scroll.horizontalBarPos,i=t.stateManager.scroll.verticalBarPos;t.scenegraph.setX(-r),t.scenegraph.setY(-i)})),null===(r=t.taskListTableInstance)||void 0===r||r.on("change_header_position_start",(e=>{const{col:r,row:i,x:n,y:s,backX:o,lineX:a,backY:l,lineY:h,event:c}=e;t.scenegraph.dragOrderLine.showDragLine(h),t.scenegraph.updateNextFrame()})),null===(i=t.taskListTableInstance)||void 0===i||i.on("changing_header_position",(e=>{const{col:r,row:i,x:n,y:s,backX:o,lineX:a,backY:l,lineY:h,event:c}=e;t.scenegraph.dragOrderLine.showDragLine(h),t.scenegraph.updateNextFrame()})),null===(n=t.taskListTableInstance)||void 0===n||n.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 r,i;const{row:n,hierarchyState:s}=e;if(t.parsedOptions.tasksShowMode===Sd.Project_Sub_Tasks_Inline){const e=n-t.taskListTableInstance.columnHeaderLevelCount,i=t.getRecordByIndex(e);i&&i.type===Td.PROJECT&&(null===(r=i.children)||void 0===r?void 0:r.length)>0&&(i.hierarchyState=s)}t._syncPropsFromTable(),t.scenegraph.refreshTaskBarsAndGrid(),!t.taskListTableInstance.checkHasColumnAutoWidth()||"auto"!==(null===(i=t.options.taskListTable)||void 0===i?void 0:i.tableWidth)&&-1!==t.taskTableWidth||Np(t);const o=t.stateManager.scroll.horizontalBarPos,a=t.stateManager.scroll.verticalBarPos;t.scenegraph.setX(-o),t.scenegraph.setY(-a)}))}(this._gantt),function(t){var e;null===(e=t.taskListTableInstance)||void 0===e||e.on("after_sort",(e=>{t.scenegraph.refreshTaskBars();const r=t.stateManager.scroll.horizontalBarPos,i=t.stateManager.scroll.verticalBarPos;t.scenegraph.setX(-r),t.scenegraph.setY(-i)}))}(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=>{Np(t)}))}(this._gantt)}setScrollTop(t,e=!0){const r=this._gantt.getAllRowsHeight();t=Math.max(0,Math.min(t,r-this._gantt.scenegraph.height)),t=Math.ceil(t);const i=this.scroll.verticalBarPos;this.scroll.verticalBarPos=t,ld(this.scroll.verticalBarPos)&&!isNaN(this.scroll.verticalBarPos)||(this.scroll.verticalBarPos=0),this._gantt.scenegraph.setY(-t);const n=t/(r-this._gantt.scenegraph.height);this._gantt.scenegraph.scrollbarComponent.updateVerticalScrollBarPos(n),i!==t&&e&&(Ip(this._gantt),this._gantt.fireListeners(kd.SCROLL,{scrollTop:this.scroll.verticalBarPos,scrollLeft:this.scroll.horizontalBarPos,scrollDirection:"vertical",scrollRatioY:n}))}get scrollLeft(){return this.scroll.horizontalBarPos}get scrollTop(){return this.scroll.verticalBarPos}setScrollLeft(t,e=!0){const r=this._gantt.getAllDateColsWidth();t=Math.max(0,Math.min(t,r-this._gantt.scenegraph.width)),t=Math.ceil(t);const i=this.scroll.horizontalBarPos;this.scroll.horizontalBarPos=t,ld(this.scroll.horizontalBarPos)&&!isNaN(this.scroll.horizontalBarPos)||(this.scroll.horizontalBarPos=0),this._gantt.scenegraph.setX(-t);const n=t/(r-this._gantt.scenegraph.width);this._gantt.scenegraph.scrollbarComponent.updateHorizontalScrollBarPos(n),i!==t&&e&&this._gantt.fireListeners(kd.SCROLL,{scrollTop:this.scroll.verticalBarPos,scrollLeft:this.scroll.horizontalBarPos,scrollDirection:"horizontal",scrollRatioX:n})}updateInteractionState(t){if(this.interactionState===t)return;const e=this.interactionState;this.interactionState=t,e===wd.scrolling&&wd.default}updateVerticalScrollBar(t){const e=this._gantt.getAllRowsHeight();this.scroll.verticalBarPos,this.scroll.verticalBarPos=Math.ceil(t*(e-this._gantt.scenegraph.height)),ld(this.scroll.verticalBarPos)&&!isNaN(this.scroll.verticalBarPos)||(this.scroll.verticalBarPos=0),this._gantt.scenegraph.setY(-this.scroll.verticalBarPos,1===t),Ip(this._gantt),this._gantt.fireListeners(kd.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)),ld(this.scroll.horizontalBarPos)&&!isNaN(this.scroll.horizontalBarPos)||(this.scroll.horizontalBarPos=0),this._gantt.scenegraph.setX(-this.scroll.horizontalBarPos,1===t),this._gantt.fireListeners(kd.SCROLL,{scrollTop:this.scroll.verticalBarPos,scrollLeft:this.scroll.horizontalBarPos,scrollDirection:"horizontal",scrollRatioY:t})}startMoveTaskBar(t,e,r,i){"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=r,this.moveTaskBar.startOffsetY=i,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,r=this.moveTaskBar.target;if(Math.abs(t)>=1||Math.abs(e)>=1){const t=r.task_index,i=r.task_index,n=r.sub_task_index,{startDate:s,endDate:o}=this._gantt.getTaskInfoByTaskListIndex(i,n),a=this.moveTaskBar.targetStartY+this._gantt.parsedOptions.rowHeight*Math.round(e/this._gantt.parsedOptions.rowHeight),l=this._gantt.parsedOptions.taskBarMilestoneStyle.width,h=Kd(this.moveTaskBar.target.attribute.x+(r.record.type===Td.MILESTONE?l/2:0)-this._gantt.stateManager.scroll.horizontalBarPos,this._gantt),c=this._gantt.parsedOptions.reverseSortedTimelineScales[0].timelineDates[h];if(!c)return;const u=c.startDate,d=new Date(u.getTime()+(Md(o).getTime()-Md(s).getTime()));let p;if(Md(s).getTime()!==u.getTime()){p=Md(s).getTime()>u.getTime()?"left":"right",this._gantt._updateStartEndDateToTaskRecord(u,d,i,n);const e=this._gantt.getRecordByIndex(i,n);this._gantt.hasListeners(kd.CHANGE_DATE_RANGE)&&this._gantt.fireListeners(kd.CHANGE_DATE_RANGE,{startDate:e[this._gantt.parsedOptions.startDateField],endDate:e[this._gantt.parsedOptions.endDateField],oldStartDate:s,oldEndDate:o,index:i,record:e});const r=op(a,this._gantt).task_index;this._gantt.hasListeners(kd.MOVE_END_TASK_BAR)&&this._gantt.fireListeners(kd.MOVE_END_TASK_BAR,{startDate:e[this._gantt.parsedOptions.startDateField],endDate:e[this._gantt.parsedOptions.endDateField],oldStartDate:s,oldEndDate:o,oldRowIndex:t,newRowIndex:r,index:i,record:e})}else{const e=this._gantt.getRecordByIndex(i,n),r=op(a,this._gantt).task_index;this._gantt.hasListeners(kd.MOVE_END_TASK_BAR)&&this._gantt.fireListeners(kd.MOVE_END_TASK_BAR,{startDate:e[this._gantt.parsedOptions.startDateField],endDate:e[this._gantt.parsedOptions.endDateField],oldStartDate:s,oldEndDate:o,oldRowIndex:t,newRowIndex:r,index:r,record:e})}if(this._gantt.parsedOptions.tasksShowMode===Sd.Sub_Tasks_Arrange||this._gantt.parsedOptions.tasksShowMode===Sd.Sub_Tasks_Compact){const t=op(a,this._gantt);this._gantt._dragOrderTaskRecord(r.task_index,r.sub_task_index,t.task_index,t.sub_task_index),sp(this._gantt.records),this._gantt.taskListTableInstance.renderWithRecreateCells(),this._gantt._syncPropsFromTable(),this._gantt.scenegraph.refreshTaskBarsAndGrid()}else if(this._gantt.parsedOptions.tasksShowMode!==Sd.Tasks_Separate&&Math.abs(Math.round(e/this._gantt.parsedOptions.rowHeight))>=1){const t=op(a,this._gantt);this._gantt._dragOrderTaskRecord(r.task_index,r.sub_task_index,t.task_index,t.sub_task_index),this._gantt.parsedOptions.tasksShowMode===Sd.Sub_Tasks_Separate?(this._gantt.taskListTableInstance.renderWithRecreateCells(),this._gantt.scenegraph.refreshTaskBarsAndGrid()):(this._gantt.scenegraph.taskBar.refresh(),this._gantt.scenegraph.dependencyLink.refresh())}else{let t=h>=1?this._gantt.getDateColsWidth(0,h-1):0;if(r.record.type===Td.MILESTONE&&(t-=this._gantt.parsedOptions.taskBarMilestoneStyle.width/2),zp(r,t-r.attribute.x,a-r.attribute.y,this),"right"===p){let t=r;for(;t.nextSibling&&t.nextSibling.attribute.y===r.attribute.y&&t.nextSibling.record[this._gantt.parsedOptions.startDateField]<=r.record[this._gantt.parsedOptions.startDateField];)t=t.nextSibling;t!==r&&t.parent.insertAfter(r,t)}else if("left"===p){let t=r;for(;t.previousSibling&&t.previousSibling.attribute.y===r.attribute.y&&t.previousSibling.record[this._gantt.parsedOptions.startDateField]>=r.record[this._gantt.parsedOptions.startDateField];)t=t.previousSibling;t!==r&&t.parent.insertBefore(r,t)}}this._gantt.scenegraph.updateNextFrame()}this.moveTaskBar.moving=!1,this.selectedTaskBar.target!==r&&r.setAttribute("zIndex",0),r.updateTextPosition(),this.moveTaskBar.target=null,this.moveTaskBar.deltaX=0,this.moveTaskBar.deltaY=0,this.moveTaskBar.moveTaskBarXSpeed=0}dealTaskBarMove(t){var e,r,i,n,s,o;const a=this._gantt;let l=this.moveTaskBar.target;l.setAttribute("zIndex",1e4);const h=a.eventManager.lastDragPointerXYOnWindow.x,c=t.x-h,u=a.eventManager.lastDragPointerXYOnWindow.y,d=t.y-u;if(this.moveTaskBar.deltaX+=c,this.moveTaskBar.deltaY+=d,zp(l,c,d,this),l.attribute.x<=a.stateManager.scrollLeft&&c<0)if(a.parsedOptions.moveTaskBarToExtendDateRange&&0===a.stateManager.scrollLeft){null===(e=this.moveTaskBar.moveTaskBarXInertia)||void 0===e||e.endInertia();const n=a.parsedOptions.reverseSortedTimelineScales[0].timelineDates[1].startDate.getTime()-a.parsedOptions.reverseSortedTimelineScales[0].timelineDates[0].startDate.getTime(),{unit:s,startOfWeek:o}=a.parsedOptions.reverseSortedTimelineScales[0];a.parsedOptions.minDate=Hd(new Date(a.parsedOptions.reverseSortedTimelineScales[0].timelineDates[0].startDate.getTime()-n/2),s,o),a.parsedOptions._minDateTime=null===(r=a.parsedOptions.minDate)||void 0===r?void 0:r.getTime(),a._generateTimeLineDateMap(),a._updateSize(),a.scenegraph.refreshAll(),l=this.moveTaskBar.target=a.scenegraph.taskBar.getTaskBarNodeByIndex(this.moveTaskBar.target.task_index,this.moveTaskBar.target.sub_task_index),a.scrollLeft=a.parsedOptions.timelineColWidth-1,a.eventManager.lastDragPointerXYOnWindow.x=t.x,"milestone"===(null===(i=l.record)||void 0===i?void 0:i.type)?zp(l,a.scrollLeft-l.attribute.x,0,this):l.setAttribute("x",a.scrollLeft)}else this.moveTaskBar.moveTaskBarXSpeed=-a.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,zp(l,t,e,this),a.stateManager.setScrollLeft(l.attribute.x),0===a.stateManager.scrollLeft&&this.moveTaskBar.moveTaskBarXInertia.endInertia()}));else if(l.attribute.x+l.attribute.width>=a.stateManager.scrollLeft+a.tableNoFrameWidth&&c>0)if(a.parsedOptions.moveTaskBarToExtendDateRange&&a.stateManager.scrollLeft+a.tableNoFrameWidth===a.getAllDateColsWidth()){null===(n=this.moveTaskBar.moveTaskBarXInertia)||void 0===n||n.endInertia();const e=a.parsedOptions.reverseSortedTimelineScales[0].timelineDates,r=e[1].startDate.getTime()-e[0].startDate.getTime(),{unit:i,startOfWeek:h,step:c}=a.parsedOptions.reverseSortedTimelineScales[0];if(a.parsedOptions.maxDate=zd(a.parsedOptions.minDate,new Date(e[e.length-1].endDate.getTime()+r/2),i,c),a.parsedOptions._maxDateTime=null===(s=a.parsedOptions.maxDate)||void 0===s?void 0:s.getTime(),a._generateTimeLineDateMap(),a._updateSize(),a.scenegraph.refreshAll(),l=this.moveTaskBar.target=a.scenegraph.taskBar.getTaskBarNodeByIndex(this.moveTaskBar.target.task_index,this.moveTaskBar.target.sub_task_index),a.scrollLeft+=1,a.eventManager.lastDragPointerXYOnWindow.x=t.x,"milestone"===(null===(o=l.record)||void 0===o?void 0:o.type)){const t=a.scrollLeft+a.tableNoFrameWidth-l.attribute.width;zp(l,t-l.attribute.x,0,this)}else l.setAttribute("x",a.scrollLeft+a.tableNoFrameWidth-l.attribute.width)}else this.moveTaskBar.moveTaskBarXSpeed=a.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,zp(l,t,e,this),a.stateManager.setScrollLeft(l.attribute.x+l.attribute.width-a.tableNoFrameWidth),a.stateManager.scrollLeft===a.getAllDateColsWidth()-a.tableNoFrameWidth&&this.moveTaskBar.moveTaskBarXInertia.endInertia()}));else this.moveTaskBar.moveTaskBarXInertia.isInertiaScrolling()?this.moveTaskBar.moveTaskBarXInertia.endInertia():this.moveTaskBar.moveTaskBarXSpeed=0;a.scenegraph.updateNextFrame()}startResizeTaskBar(t,e,r,i,n){this.resizeTaskBar.onIconName=n,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=r,this.resizeTaskBar.startOffsetY=i}isResizingTaskBar(){return this.resizeTaskBar.resizing}endResizeTaskBar(t){const e=this._gantt.stateManager.resizeTaskBar.onIconName,r=t-this.resizeTaskBar.startX;if(Math.abs(r)>=1){const t=Kd(("left"===e?this.resizeTaskBar.target.attribute.x:this.resizeTaskBar.target.attribute.x+this.resizeTaskBar.target.attribute.width)-this._gantt.stateManager.scroll.horizontalBarPos,this._gantt),r=this._gantt.parsedOptions.reverseSortedTimelineScales[0].timelineDates[t];if(!r)return;const i="left"===e?r.startDate:r.endDate,n=this.resizeTaskBar.target,s=n.clipGroupBox,o=n.barRect,a=n.progressRect,l=n.textLabel,h=n.task_index,c=n.sub_task_index,{taskDays:u,progress:d,startDate:p,endDate:f}=this._gantt.getTaskInfoByTaskListIndex(h,c);let g=!1;if("left"===e?(this._gantt._updateStartDateToTaskRecord(i,h,c),i.getTime()!==new Date(p).getTime()&&(g=!0)):(this._gantt._updateEndDateToTaskRecord(i,h,c),i.getTime()!==new Date(f).getTime()&&(g=!0)),this._gantt.parsedOptions.tasksShowMode===Sd.Sub_Tasks_Arrange||this._gantt.parsedOptions.tasksShowMode===Sd.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;n.setAttribute("x",e),n.setAttribute("width",this.resizeTaskBar.targetEndX-e)}else if("right"===e){const e=this._gantt.getDateColsWidth(0,t);n.setAttribute("width",e-this.resizeTaskBar.targetStartX)}if(s.setAttribute("width",n.attribute.width),null==o||o.setAttribute("width",n.attribute.width),null==a||a.setAttribute("width",d/100*n.attribute.width),l){const{textAlign:t,textBaseline:e,padding:r}=this._gantt.parsedOptions.taskBarLabelStyle,i=ep(Pd(r),t,e,n.attribute.width,n.attribute.height);l.setAttribute("maxLineWidth",n.attribute.width-20),l.setAttribute("x",i.x)}this._gantt.scenegraph.refreshRecordLinkNodes(h,c,n,0),this.showTaskBarHover(),jp(this._gantt,n,h,c),n.setAttribute("zIndex",0)}if(n.updateTextPosition(),this.resizeTaskBar.resizing=!1,this.resizeTaskBar.target=null,g&&this._gantt.hasListeners(kd.CHANGE_DATE_RANGE)){const t=this._gantt.getRecordByIndex(h,c);this._gantt.fireListeners(kd.CHANGE_DATE_RANGE,{startDate:t[this._gantt.parsedOptions.startDateField],endDate:t[this._gantt.parsedOptions.endDateField],oldStartDate:p,oldEndDate:f,index:h,record:t})}this._gantt.scenegraph.updateNextFrame()}}dealTaskBarResize(t){const e=this._gantt.eventManager.lastDragPointerXYOnWindow.x,r=t.x-e,i=this._gantt.stateManager.resizeTaskBar.target;let n="left"===this._gantt.stateManager.resizeTaskBar.onIconName?-r:r;const s=Math.max(1,i.attribute.width+n);n=s-i.attribute.width,function(t,e,r,i){const n=i._gantt.parsedOptions.progressField,s=t.clipGroupBox,o=t.barRect,a=t.progressRect,l=t.textLabel,h=t.task_index,c=t.sub_task_index,u=t.record,d=u[n],p=u.type===Td.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]),r&&t.setAttribute("width",r),s.setAttribute("width",t.attribute.width),null==o||o.setAttribute("width",t.attribute.width),null==a||a.setAttribute("width",d/100*t.attribute.width),l){const{textAlign:e,textBaseline:n,padding:s}=i._gantt.parsedOptions.taskBarLabelStyle,o=ep(Pd(s),e,n,r,t.attribute.height);l.setAttribute("maxLineWidth",r-20),l.setAttribute("x",o.x)}t.updateTextPosition(),i.showTaskBarHover(),jp(i._gantt,t,h,c),i._gantt.scenegraph.refreshRecordLinkNodes(h,c,t,0)}(i,"left"===this._gantt.stateManager.resizeTaskBar.onIconName?-n:0,s,this),this._gantt.scenegraph.updateNextFrame()}startCreateDependencyLine(t,e,r,i,n){this.resizeTaskBar.resizing=!1,this.creatingDenpendencyLink.creating=!0,this.creatingDenpendencyLink.startClickedPoint=t,this.creatingDenpendencyLink.startX=e,this.creatingDenpendencyLink.startY=r,this.creatingDenpendencyLink.startOffsetY=i,this.creatingDenpendencyLink.firstTaskBarPosition=n,this.highlightLinkPointNode(t)}isCreatingDependencyLine(){return this.creatingDenpendencyLink.creating}endCreateDependencyLine(t){const e=this._gantt.parsedOptions.taskKeyField,r=this.selectedTaskBar.target.task_index,i=this.selectedTaskBar.target.sub_task_index,n=this.creatingDenpendencyLink.secondTaskBarNode.task_index,s=this.creatingDenpendencyLink.secondTaskBarNode.sub_task_index,o={linkedFromTaskKey:this._gantt.getRecordByIndex(r,i)[e],linkedToTaskKey:this._gantt.getRecordByIndex(n,s)[e],type:"left"===this.creatingDenpendencyLink.firstTaskBarPosition&&"left"===this.creatingDenpendencyLink.secondTaskBarPosition?xd.StartToStart:"right"===this.creatingDenpendencyLink.firstTaskBarPosition&&"left"===this.creatingDenpendencyLink.secondTaskBarPosition?xd.FinishToStart:"right"===this.creatingDenpendencyLink.firstTaskBarPosition&&"right"===this.creatingDenpendencyLink.secondTaskBarPosition?xd.FinishToFinish:xd.StartToFinish};return this._gantt.addLink(o),this.hideTaskBarSelectedBorder(),this._gantt.scenegraph.updateNextFrame(),this.creatingDenpendencyLink.creating=!1,o}dealCreateDependencyLine(t){const e=this.creatingDenpendencyLink.startX,r=this.creatingDenpendencyLink.startY,i=t.x-e,n=t.y-r,s=this.creatingDenpendencyLink.startClickedPoint,o=s.attribute.x+s.attribute.width/2,a=s.attribute.y+s.attribute.height/2;this._gantt.scenegraph.taskBar.updateCreatingDependencyLine(o,a,o+i,a+n),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,r;if(!this.resizeTableWidth.resizing)return;const i=t.pageX-this.resizeTableWidth.lastX;if(Math.abs(i)>=1){let n=this._gantt.taskTableWidth+i;const s=Math.min(this._gantt.taskListTableInstance.getAllColsWidth()+this._gantt.parsedOptions.outerFrameStyle.borderLineWidth,null!==(e=this._gantt.options.taskListTable.maxTableWidth)&&void 0!==e?e:1e5),o=Math.max(this._gantt.parsedOptions.outerFrameStyle.borderLineWidth,null!==(r=this._gantt.options.taskListTable.minTableWidth)&&void 0!==r?r:0);i>0&&n>s&&(n=s),i<0&&n<o&&(n=o),this._gantt.taskTableWidth=n,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,r=t.attribute.y,i=t.attribute.width,n=t.attribute.height;this._gantt.scenegraph.taskBar.showHoverBar(e,r,i,n,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 r=this._gantt.parsedOptions.dependencyLinkCreatable;t.setAttribute("zIndex",1e4);const i=t.attribute.x,n=t.attribute.y,s=t.attribute.width,o=t.attribute.height;this._gantt.scenegraph.taskBar.createSelectedBorder(i,n,s,o,t,r),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,r=t.attribute.y,i=t.attribute.width,n=t.attribute.height;this._gantt.scenegraph.taskBar.createSelectedBorder(e,r,i,n,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:r}=this._gantt.parsedOptions,{linkedToTaskKey:i,linkedFromTaskKey:n,type:s}=t;let o,a,l,h;const c=ip(this._gantt.records,e,i),u=ip(this._gantt.records,e,n);this._gantt.parsedOptions.tasksShowMode===Sd.Sub_Tasks_Inline||this._gantt.parsedOptions.tasksShowMode===Sd.Sub_Tasks_Separate||this._gantt.parsedOptions.tasksShowMode===Sd.Sub_Tasks_Arrange||this._gantt.parsedOptions.tasksShowMode===Sd.Sub_Tasks_Compact?(o=u.index[0],a=u.index[1],l=c.index[0],h=c.index[1]):(o=this._gantt.getTaskShowIndexByRecordIndex(u.index),l=this._gantt.getTaskShowIndexByRecordIndex(c.index));const d=this._gantt.scenegraph.taskBar.getTaskBarNodeByIndex(o,a);this._gantt.scenegraph.taskBar.createSelectedBorder(d.attribute.x,d.attribute.y,d.attribute.width,d.attribute.height,d,!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 r=this._gantt.stateManager.marklineIcon.target;if(r){const i=this._gantt.scenegraph.timelineHeader.showMarklineIcon(r.parent);i&&(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(i),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,r;if(!t||0===t.length||!this._gantt||!this._gantt.records)return;const i=this._gantt.parsedOptions.startDateField,n=this._gantt.parsedOptions.endDateField,s=[...t];for(;s.length>0;){const t=[...s],r=t.pop();let o=this._gantt.records;for(const e of t){if(!o[e]||!o[e].children)return;o=o[e].children}const a=0===t.length?this._gantt.records[r]:o[r];if(a&&a.type===Td.PROJECT&&a.children&&a.children.length>0){let t=null,r=null;for(const e of a.children)if(e[i]&&e[n]){const s=new Date(e[i]),o=new Date(e[n]);(!t||s<t)&&(t=s),(!r||o>r)&&(r=o)}if(t&&r){const s=a[i]?new Date(a[i]):null,o=a[n]?new Date(a[n]):null;if(!s||!o||t.getTime()!==s.getTime()||r.getTime()!==o.getTime()){const s=null!==(e=this._gantt.parsedOptions.dateFormat)&&void 0!==e?e:this._gantt.parseTimeFormat(a[i]||a.children[0][i]),o=t=>this._gantt.formatDate?this._gantt.formatDate(t,s):t.toISOString().split("T")[0];a[i]=o(t),a[n]=o(r)}}}s.pop()}null===(r=this._gantt.scenegraph)||void 0===r||r.refreshAll()}}function jp(t,e,r,i){const n=t.parsedOptions.taskBarCustomLayout;if(n){let s;if("function"==typeof n){const{startDate:o,endDate:a,taskDays:l,progress:h,taskRecord:c}=t.getTaskInfoByTaskListIndex(r,i);s=n({width:e.attribute.width,height:e.attribute.height,index:r,startDate:o,endDate:a,taskDays:l,progress:h,taskRecord:c,ganttInstance:t})}else s=n;if(s){const t=s.rootContainer;t.name="task-bar-custom-render";const r=e.children.find((t=>"task-bar-group"===t.name));if(r){const e=r.children.findIndex((t=>"task-bar-custom-render"===t.name)),i=r.children[e];i&&(r.removeChild(i),r.insertInto(t,e))}}}}function zp(t,e,r,i){const n=t.task_index,s=t.sub_task_index,o=t.record.type===Td.MILESTONE,a=t.attribute.x,l=t.attribute.y;if(e&&t.setAttribute("x",Math.max(0,t.attribute.x+e)),i._gantt.parsedOptions.tasksShowMode!==Sd.Tasks_Separate&&i._gantt.parsedOptions.tasksShowMode!==Sd.Project_Sub_Tasks_Inline?r&&t.setAttribute("y",t.attribute.y+r):r=0,o&&(t.setAttribute("anchor",[t.attribute.x+t.attribute.width/2,t.attribute.y+t.attribute.height/2]),t.milestoneTextContainer)){const e=t.attribute.x-a,r=t.attribute.y-l,i=t.milestoneTextContainer.attribute.x,n=t.milestoneTextContainer.attribute.y;t.milestoneTextContainer.setAttribute("x",i+e),t.milestoneTextContainer.setAttribute("y",n+r)}t.updateTextPosition(),i._gantt.scenegraph.refreshRecordLinkNodes(n,s,t,r)}let Hp=1;class Wp{constructor(){this.listenersData={listeners:{},listenerData:{}}}on(t,e){const r=this.listenersData.listeners[t]||(this.listenersData.listeners[t]=[]);r.push(e);const i=Hp++;return this.listenersData.listenerData[i]={type:t,listener:e,remove:()=>{delete this.listenersData.listenerData[i];const n=r.indexOf(e);r.splice(n,1),this.listenersData.listeners[t].length||delete this.listenersData.listeners[t]}},i}off(t,e){var r;if(e){const r=t;this.removeEventListener(r,e)}else{const e=t;if(!this.listenersData)return;null===(r=this.listenersData.listenerData[e])||void 0===r||r.remove()}}addEventListener(t,e,r){this.on(t,e)}removeEventListener(t,e){if(this.listenersData)for(const r in this.listenersData.listenerData){const i=this.listenersData.listenerData[r];i.type===t&&i.listener===e&&this.off(r)}}hasListeners(t){return!!this.listenersData&&!!this.listenersData.listeners[t]}fireListeners(t,e){if(!this.listenersData)return[];const r=this.listenersData.listeners[t];return r?r.map((t=>t.call(this,e))).filter((t=>ld(t))):[]}release(){delete this.listenersData}}class Up{constructor(t){this._gantt=t,this.records=t.records,this.processRecords()}processRecords(){const t=!this._gantt.options.minDate,e=!this._gantt.options.maxDate;let r=Number.MAX_SAFE_INTEGER,i=Number.MIN_SAFE_INTEGER;if((t||e||this._gantt.parsedOptions.tasksShowMode===Sd.Sub_Tasks_Inline||this._gantt.parsedOptions.tasksShowMode===Sd.Sub_Tasks_Compact)&&this.records.length){for(let n=0;n<this.records.length;n++){const s=this.records[n];if(t&&s[this._gantt.parsedOptions.startDateField]){const t=Md(s[this._gantt.parsedOptions.startDateField]);r=Math.min(r,t.getTime())}if(e&&s[this._gantt.parsedOptions.endDateField]){const t=Md(s[this._gantt.parsedOptions.endDateField]);i=Math.max(i,t.getTime())}this._gantt.parsedOptions.tasksShowMode!==Sd.Sub_Tasks_Inline&&this._gantt.parsedOptions.tasksShowMode!==Sd.Sub_Tasks_Compact||s.children&&s.children.sort(((t,e)=>Md(t[this._gantt.parsedOptions.startDateField]).getTime()-Md(e[this._gantt.parsedOptions.startDateField]).getTime()))}const{unit:n,startOfWeek:s,step:o}=this._gantt.parsedOptions.reverseSortedTimelineScales[0];t&&(this._gantt.parsedOptions.minDate=Hd(new Date(r),n,s),this._gantt.parsedOptions._minDateTime=this._gantt.parsedOptions.minDate.getTime()),t&&!e&&(this._gantt.parsedOptions.maxDate=zd(this._gantt.parsedOptions.minDate,new Date(this._gantt.options.maxDate),n,o),this._gantt.parsedOptions._maxDateTime=this._gantt.parsedOptions.maxDate.getTime()),e&&(this._gantt.parsedOptions.maxDate=zd(this._gantt.parsedOptions.minDate,new Date(i),n,o),this._gantt.parsedOptions._maxDateTime=this._gantt.parsedOptions.maxDate.getTime())}}adjustOrder(t,e,r,i){var n,s,o,a;if(this._gantt.parsedOptions.tasksShowMode!==Sd.Sub_Tasks_Arrange&&this._gantt.parsedOptions.tasksShowMode!==Sd.Sub_Tasks_Compact||t!==r)if(this._gantt.parsedOptions.tasksShowMode===Sd.Sub_Tasks_Inline){if(ld(e)&&ld(i)&&ld(t)&&ld(r)){const n=this.records[t].children[e];this.records[t].children.splice(e,1),this.records[r].children||(this.records[r].children=[]),this.records[r].children.splice(i,0,n)}null===(s=null===(n=this.records[r])||void 0===n?void 0:n.children)||void 0===s||s.sort(((t,e)=>Md(t[this._gantt.parsedOptions.startDateField]).getTime()-Md(e[this._gantt.parsedOptions.startDateField]).getTime()))}else if(this._gantt.parsedOptions.tasksShowMode===Sd.Project_Sub_Tasks_Inline){if(ld(e)&&ld(i)&&ld(t)&&ld(r)){this.records[t].type,Td.PROJECT;const n=this.records[r].type===Td.PROJECT,s=this.records[t].children[e];this.records[t].children.splice(e,1),this.records[r].children||(this.records[r].children=[]),this.records[r].children.splice(i,0,s),n&&(null===(a=null===(o=this.records[r])||void 0===o?void 0:o.children)||void 0===a||a.sort(((t,e)=>Md(t[this._gantt.parsedOptions.startDateField]).getTime()-Md(e[this._gantt.parsedOptions.startDateField]).getTime())))}}else if(ld(e)&&ld(i)&&ld(t)&&ld(r)){const n=this.records[t].children[e];this.records[t].children.splice(e,1),this.records[r].children||(this.records[r].children=[]),this.records[r].children.splice(i,0,n)}}setRecords(t){this.records=t,this.processRecords()}}class $p{constructor(t,e){var r;this.plugins=new Map,this.gantt=t,null===(r=e.plugins)||void 0===r||r.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){t.runTime&&t.runTime.forEach((e=>{this.gantt.on(e,((...r)=>{var i;try{null===(i=t.run)||void 0===i||i.call(t,...r,e,this.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 Vp extends Wp{constructor(t,e){var r,i,n,s,o;super(),this.parsedOptions={},this.container=t,this.options=e,this.taskTableWidth="number"==typeof(null===(r=null==e?void 0:e.taskListTable)||void 0===r?void 0:r.tableWidth)?null===(i=null==e?void 0:e.taskListTable)||void 0===i?void 0:i.tableWidth:-1,this.taskTableColumns=null!==(s=null===(n=null==e?void 0:e.taskListTable)||void 0===n?void 0:n.columns)&&void 0!==s?s:[],this.records=null!==(o=null==e?void 0:e.records)&&void 0!==o?o:[],this._sortScales(),Jd(this),function(t){if(!t.records||0===t.records.length)return;const e=t.parsedOptions.startDateField,r=t.parsedOptions.endDateField,i=(n,s,o)=>{let a=null,l=null;return n.forEach(((s,o)=>{var h;if(!s)return;let c=null,u=null;if(s.children&&s.children.length>0&&s.type===Td.PROJECT){const[a,l]=i(s.children);if(a&&l&&(c=a,u=l,s.type===Td.PROJECT)){const i=null!==(h=t.parsedOptions.dateFormat)&&void 0!==h?h:t.parseTimeFormat(s[e]||s.children[0][e]||""),a=e=>t.formatDate?t.formatDate(e,i):e.toISOString().split("T")[0],l=Object.assign({},s);l[e]=a(c),l[r]=a(u),n[o]=l}}else s[e]&&s[r]&&(c=new Date(s[e]),u=new Date(s[r]));c&&(!a||c<a)&&(a=c),u&&(!l||u>l)&&(l=u)})),[a,l]};i(t.records)}(this),this.data=new Up(this),this._generateTimeLineDateMap(),this.timeLineHeaderLevel=this.parsedOptions.sortedTimelineScales.length,this.element=function(t,e="vtable-gantt"){var r,i;const n=document.createElement("div");n.setAttribute("tabindex","0"),n.classList.add(e),n.style.outline="none",n.style.margin=`${t.top}px ${t.right}px ${t.bottom}px ${t.left}px`;const s=(n.offsetWidth||(null===(r=n.parentElement)||void 0===r?void 0:r.offsetWidth)||1)-1,o=(n.offsetHeight||(null===(i=n.parentElement)||void 0===i?void 0:i.offsetHeight)||1)-1;return n.style.width=s&&s-t.left-t.right+"px"||"0px",n.style.height=o&&o-t.top-t.bottom+"px"||"0px",n}({top:0,right:0,left:0,bottom:0},"vtable-gantt"),this.element.style.left=-1!==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=(-1!==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 kp(this),this.stateManager=new Fp(this),this.eventManager=new Mp(this),this.scenegraph.afterCreateSceneGraph(),this._scrollToMarkLine(),this.pluginManager=new $p(this,e)}renderTaskBarsTable(){this.scenegraph.updateNextFrame()}_updateSize(){var t,r,i,n,s,o,a,l,h;let c=0,u=0;if("browser"===$d.mode){const e=this.getElement();let o=0,a=0;if(e.parentElement){const t=e.parentElement.style||window.getComputedStyle(e.parentElement);o=e.parentElement.offsetWidth-parseInt(t.paddingLeft||"0px",10)-parseInt(t.paddingRight||"0px",10),a=e.parentElement.offsetHeight-parseInt(t.paddingTop||"0px",10)-parseInt(t.paddingBottom||"0px",20)}const l=(null!=o?o:1)-1-this.taskTableWidth,h=(null!=a?a:1)-1;e.style.width=l&&`${l}px`||"0px",e.style.height=h&&`${h}px`||"0px";const{canvas:d}=this;c=null!==(r=null===(t=d.parentElement)||void 0===t?void 0:t.offsetWidth)&&void 0!==r?r:1,u=null!==(n=null===(i=d.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(c,u):(d.style.width="",d.style.height="",d.width=c,d.height=u,d.style.width=`${c}px`,d.style.height=`${u}px`)}else $d.mode;const d=Math.floor(c-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)),p=Math.floor(u-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=c,this.tableNoFrameHeight=Math.floor(u),this.parsedOptions.outerFrameStyle){const[t,r,i,n]=e.toBoxArray(null!==(a=null===(o=this.parsedOptions.outerFrameStyle)||void 0===o?void 0:o.borderLineWidth)&&void 0!==a?a:0);this.tableX=this.taskTableColumns.length>=1||(null===(l=this.options)||void 0===l?void 0:l.rowSeriesNumber)?null!==(h=this.parsedOptions.verticalSplitLine.lineWidth)&&void 0!==h?h:0:n,this.tableY=t,this.tableNoFrameWidth=Math.min(d-r-this.tableX,this.getAllDateColsWidth()),this.tableNoFrameHeight=p-t-i}}_updateListTableSize(t){var r,i,n,s,o,a,l,h,c,u,d,p;if(t){if("auto"===(null===(i=null===(r=this.options)||void 0===r?void 0:r.taskListTable)||void 0===i?void 0:i.tableWidth)||-1===this.taskTableWidth){const[r,i,f,g]=e.toBoxArray(null!==(s=null===(n=this.parsedOptions.outerFrameStyle)||void 0===n?void 0:n.borderLineWidth)&&void 0!==s?s:0);this.taskTableWidth=t.getAllColsWidth()+i,(null===(a=null===(o=this.options)||void 0===o?void 0:o.taskListTable)||void 0===a?void 0:a.maxTableWidth)&&(this.taskTableWidth=Math.min(null===(h=null===(l=this.options)||void 0===l?void 0:l.taskListTable)||void 0===h?void 0:h.maxTableWidth,this.taskTableWidth)),(null===(u=null===(c=this.options)||void 0===c?void 0:c.taskListTable)||void 0===u?void 0:u.minTableWidth)&&(this.taskTableWidth=Math.max(null===(p=null===(d=this.options)||void 0===d?void 0:d.taskListTable)||void 0===p?void 0:p.minTableWidth,this.taskTableWidth)),this.element.style.left=-1!==this.taskTableWidth?`${this.taskTableWidth}px`:"0px",t.setCanvasSize(this.taskTableWidth,this.tableNoFrameHeight+r+f),this._updateSize()}if(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 r=0;r<t.columnHeaderLevelCount;r++)t.setRowHeight(r,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,r,i,n,s,o,a,l,h,c,u,d,p,f,g,m,y,v,b,_,w,x,S,T,k,C,E,A,O,B,R,L,P,D,M,I,N,F,j,z,H,W,U,$,V,G,X,Y,q,Z,K,Q,J,tt;const et={},rt=["container","records","rowSeriesNumber","overscrollBehavior","pixelRatio","eventOptions"];for(const t of rt)t in this.options&&(et[t]=this.options[t]);if(et.defaultRowHeight=this.options.rowHeight,this.options.taskListTable)for(const t in this.options.taskListTable){if(et[t]=this.options.taskListTable[t],"columns"===t&&(et[t][et[t].length-1].disableColumnResize=!0,this.parsedOptions.tasksShowMode===Sd.Sub_Tasks_Inline||this.parsedOptions.tasksShowMode===Sd.Sub_Tasks_Separate||this.parsedOptions.tasksShowMode===Sd.Sub_Tasks_Arrange||this.parsedOptions.tasksShowMode===Sd.Sub_Tasks_Compact))for(let t=0;t<et.columns.length;t++)et.columns[t].tree&&(et.columns[t].tree=!1);"hierarchyExpandLevel"!==t||this.parsedOptions.tasksShowMode!==Sd.Sub_Tasks_Inline&&this.parsedOptions.tasksShowMode!==Sd.Sub_Tasks_Separate&&this.parsedOptions.tasksShowMode!==Sd.Sub_Tasks_Arrange&&this.parsedOptions.tasksShowMode!==Sd.Sub_Tasks_Compact||delete et[t]}if(null===(t=this.options.taskListTable)||void 0===t?void 0:t.theme)if(et.theme=null===(r=this.options.taskListTable)||void 0===r?void 0:r.theme,et.theme.bodyStyle&&!function(t,e){const r=Object.getOwnPropertyDescriptor(t,e);return!(!r||!r.set&&!0!==r.writable)}(et.theme,"bodyStyle")){et.theme=(null===(i=this.options.taskListTable)||void 0===i?void 0:i.theme).extends((null===(n=this.options.taskListTable)||void 0===n?void 0:n.theme).getExtendTheme());const t=et.theme.getExtendTheme();et.theme.clearBodyStyleCache(),(null===(s=et.theme.headerStyle)||void 0===s?void 0:s.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!==(a=null===(o=this.parsedOptions.horizontalSplitLine)||void 0===o?void 0:o.lineWidth)&&void 0!==a?a:0,0,0,0],borderColor:null===(l=this.parsedOptions.horizontalSplitLine)||void 0===l?void 0:l.lineColor}:t.bodyStyle={frameStyle:{borderLineWidth:[null!==(c=null===(h=this.parsedOptions.horizontalSplitLine)||void 0===h?void 0:h.lineWidth)&&void 0!==c?c:0,0,0,0],borderColor:null===(u=this.parsedOptions.horizontalSplitLine)||void 0===u?void 0:u.lineColor}},t.cellInnerBorder=!1;const[r,_,w,x]=e.toBoxArray(null!==(p=null===(d=this.parsedOptions.outerFrameStyle)||void 0===d?void 0:d.borderLineWidth)&&void 0!==p?p:0);t.frameStyle=Object.assign({},this.parsedOptions.outerFrameStyle,{shadowBlur:0,cornerRadius:[null!==(g=null===(f=this.parsedOptions.outerFrameStyle)||void 0===f?void 0:f.cornerRadius)&&void 0!==g?g:0,0,0,null!==(y=null===(m=this.parsedOptions.outerFrameStyle)||void 0===m?void 0:m.cornerRadius)&&void 0!==y?y:0],borderLineWidth:[r,0,w,x]}),t.scrollStyle=Object.assign({},null===(b=null===(v=this.options.taskListTable)||void 0===v?void 0:v.theme)||void 0===b?void 0:b.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{et.theme.headerStyle?et.theme.headerStyle.bgColor||(et.theme.headerStyle.bgColor=this.parsedOptions.timelineHeaderBackgroundColor):et.theme.headerStyle={bgColor:this.parsedOptions.timelineHeaderBackgroundColor},et.theme.headerStyle=Object.assign({},e.themes.DEFAULT.headerStyle,{bgColor:this.parsedOptions.timelineHeaderBackgroundColor},null===(w=null===(_=this.options.taskListTable)||void 0===_?void 0:_.theme)||void 0===w?void 0:w.headerStyle),et.theme.bodyStyle=Object.assign({},e.themes.DEFAULT.bodyStyle,null===(S=null===(x=this.options.taskListTable)||void 0===x?void 0:x.theme)||void 0===S?void 0:S.bodyStyle,{frameStyle:{borderLineWidth:[null!==(k=null===(T=this.parsedOptions.horizontalSplitLine)||void 0===T?void 0:T.lineWidth)&&void 0!==k?k:0,0,0,0],borderColor:null===(C=this.parsedOptions.horizontalSplitLine)||void 0===C?void 0:C.lineColor}}),et.theme.cellInnerBorder=!1;const[t,r,i,n]=e.toBoxArray(null!==(A=null===(E=this.parsedOptions.outerFrameStyle)||void 0===E?void 0:E.borderLineWidth)&&void 0!==A?A:0);et.theme.frameStyle=Object.assign({},this.parsedOptions.outerFrameStyle,{cornerRadius:[null!==(B=null===(O=this.parsedOptions.outerFrameStyle)||void 0===O?void 0:O.cornerRadius)&&void 0!==B?B:0,0,0,null!==(L=null===(R=this.parsedOptions.outerFrameStyle)||void 0===R?void 0:R.cornerRadius)&&void 0!==L?L:0],borderLineWidth:[t,0,i,n]}),et.theme.scrollStyle=Object.assign({},null===(D=null===(P=this.options.taskListTable)||void 0===P?void 0:P.theme)||void 0===D?void 0:D.scrollStyle,this.parsedOptions.scrollStyle,{verticalVisible:"none"}),et.theme.columnResize=Object.assign({labelColor:"rgba(0,0,0,0)",labelBackgroundFill:"rgba(0,0,0,0)"},null===(I=null===(M=this.options.taskListTable)||void 0===M?void 0:M.theme)||void 0===I?void 0:I.columnResize),et.theme.underlayBackgroundColor||(et.theme.underlayBackgroundColor=this.parsedOptions.underlayBackgroundColor)}else{const[t,r,i,n]=e.toBoxArray(null!==(F=null===(N=this.parsedOptions.outerFrameStyle)||void 0===N?void 0:N.borderLineWidth)&&void 0!==F?F:0);et.theme={scrollStyle:Object.assign({},null===(z=null===(j=this.options.taskListTable)||void 0===j?void 0:j.theme)||void 0===z?void 0:z.scrollStyle,this.parsedOptions.scrollStyle,{verticalVisible:"none"}),headerStyle:Object.assign({},e.themes.DEFAULT.headerStyle,{bgColor:this.parsedOptions.timelineHeaderBackgroundColor},null===(W=null===(H=this.options.taskListTable)||void 0===H?void 0:H.theme)||void 0===W?void 0:W.headerStyle),bodyStyle:Object.assign({},e.themes.DEFAULT.bodyStyle,null===($=null===(U=this.options.taskListTable)||void 0===U?void 0:U.theme)||void 0===$?void 0:$.bodyStyle,{frameStyle:{borderLineWidth:[null!==(G=null===(V=this.parsedOptions.horizontalSplitLine)||void 0===V?void 0:V.lineWidth)&&void 0!==G?G:0,0,0,0],borderColor:null===(X=this.parsedOptions.horizontalSplitLine)||void 0===X?void 0:X.lineColor}}),cellInnerBorder:!1,frameStyle:Object.assign({},this.parsedOptions.outerFrameStyle,{cornerRadius:[null!==(q=null===(Y=this.parsedOptions.outerFrameStyle)||void 0===Y?void 0:Y.cornerRadius)&&void 0!==q?q:0,0,0,null!==(K=null===(Z=this.parsedOptions.outerFrameStyle)||void 0===Z?void 0:Z.cornerRadius)&&void 0!==K?K:0],borderLineWidth:[t,0,i,n]}),columnResize:Object.assign({labelColor:"rgba(0,0,0,0)",labelBackgroundFill:"rgba(0,0,0,0)"},null===(J=null===(Q=this.options.taskListTable)||void 0===Q?void 0:Q.theme)||void 0===J?void 0:J.columnResize),underlayBackgroundColor:this.parsedOptions.underlayBackgroundColor}}return et.canvasWidth=this.taskTableWidth,et.canvasHeight=this.canvas.height,et.defaultHeaderRowHeight=this.getAllHeaderRowsHeight(),this.parsedOptions.tasksShowMode===Sd.Sub_Tasks_Separate?(et.customComputeRowHeight=t=>{var e;const{row:r,table:i}=t,n=i.getRecordByRowCol(0,r);if(n)return((null===(e=n.children)||void 0===e?void 0:e.length)||1)*this.parsedOptions.rowHeight},et.defaultRowHeight="auto",et.customConfig={forceComputeAllRowHeight:!0}):this.parsedOptions.tasksShowMode===Sd.Sub_Tasks_Compact?(et.customComputeRowHeight=t=>{const{row:e,table:r}=t,i=r.getRecordByRowCol(0,e);if(i)return function(t,e){var r;if(!e.children||e.children.length<=1)return 1===(null===(r=e.children)||void 0===r?void 0:r.length)?e.children[0].vtable_gantt_showIndex=0:e.vtable_gantt_showIndex=0,1;const i=e.children.slice().sort(((e,r)=>{const{startDate:i}=lp(t,e),{startDate:n}=lp(t,r);return i.getTime()-n.getTime()})),n=[];for(let e=0;e<=i.length-1;e++){const r=i[e],{startDate:s,endDate:o}=lp(t,r);let a=!1;for(let t=0;t<n.length;t++)if(s.getTime()>n[t]){n[t]=o.getTime(),a=!0,r.vtable_gantt_showIndex=t;break}a||(n.push(o.getTime()),r.vtable_gantt_showIndex=n.length-1)}return n.length}(this,i)*this.parsedOptions.rowHeight},et.defaultRowHeight="auto",et.customConfig={forceComputeAllRowHeight:!0}):this.parsedOptions.tasksShowMode===Sd.Sub_Tasks_Arrange?(et.customComputeRowHeight=t=>{const{row:e,table:r}=t,i=r.getRecordByRowCol(0,e);if(i)return function(t,e){var r;if(!e.children||e.children.length<=1)return 1===(null===(r=e.children)||void 0===r?void 0:r.length)?e.children[0].vtable_gantt_showIndex=0:e.vtable_gantt_showIndex=0,1;const i=[];for(let r=0;r<=e.children.length-1;r++){const n=e.children[r],{startDate:s,endDate:o}=lp(t,n);let a=!1;for(let r=0;r<i.length;r++)if(!ap(s,o,e.children.filter((t=>t!==n&&t.vtable_gantt_showIndex===r)),t)){i[r]=o.getTime(),a=!0,n.vtable_gantt_showIndex=r;break}a||(i.push(o.getTime()),n.vtable_gantt_showIndex=i.length-1)}return i.length}(this,i)*this.parsedOptions.rowHeight},et.defaultRowHeight="auto",et.customConfig={forceComputeAllRowHeight:!0}):et.defaultRowHeight=null!==(tt=this.options.rowHeight)&&void 0!==tt?tt:40,et.clearDOM=!1,et}getElement(){return this.element}getContainer(){return this.element.parentElement}_sortScales(){const{timelineHeader:t}=this.options;if(t){const e=t.scales,r=["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 i=e.slice().sort(((t,e)=>{"hour"!==t.unit&&"minute"!==t.unit&&"second"!==t.unit||(this.parsedOptions.timeScaleIncludeHour=!0);const i=r.indexOf(t.unit),n=r.indexOf(e.unit);return-1===i?1:-1===n?-1:i-n})),n=e.slice().sort(((t,e)=>{const i=r.indexOf(t.unit),n=r.indexOf(e.unit);return-1===i?1:-1===n?-1:n-i}));this.parsedOptions.sortedTimelineScales=i,this.parsedOptions.reverseSortedTimelineScales=n}}_generateTimeLineDateMap(){if(this.parsedOptions.minDate&&this.parsedOptions.maxDate)for(const t of this.parsedOptions.reverseSortedTimelineScales)t.timelineDates=tp(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,r)=>!1===this.parsedOptions.sortedTimelineScales[r].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 r,i;if(this.taskListTableInstance){if(ld(e)){const n=this.taskListTableInstance.getRecordByCell(0,t+this.taskListTableInstance.columnHeaderLevelCount);if(Array.isArray(e)){const i=this.getRecordIndexByTaskShowIndex(t),s=Array.isArray(i)?i.length:1,o=[...e];o.splice(0,s);let a=n;for(;o.length>0;){const t=o.shift();a=null===(r=null==a?void 0:a.children)||void 0===r?void 0:r[t]}return a}return null===(i=null==n?void 0:n.children)||void 0===i?void 0:i[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 r=this.getRecordByIndex(t,e),i=null==r?void 0:r.type,n=this.parsedOptions.startDateField,s=this.parsedOptions.endDateField,o=this.parsedOptions.progressField,a=Md(null==r?void 0:r[n]).getTime(),l=Md(null==r?void 0:r[s]).getTime();if(i&&!(null==r?void 0:r[n])||!i&&(l<this.parsedOptions._minDateTime||a>this.parsedOptions._maxDateTime||!(null==r?void 0:r[n])||!(null==r?void 0:r[s])))return{taskDays:0,progress:0,startDate:null,endDate:null,taskRecord:r};const h=function(t){return"string"==typeof t&&(t=t.replace("%",""),t=parseFloat(t)),Math.round(t)}(r[o]);let c,u;return this.parsedOptions.timeScaleIncludeHour?(c=Md(Math.min(Math.max(this.parsedOptions._minDateTime,a),this.parsedOptions._maxDateTime)),u=Fd(Math.max(Math.min(this.parsedOptions._maxDateTime,l),this.parsedOptions._minDateTime),!0)):(c=Md(Math.min(Math.max(this.parsedOptions._minDateTime,a),this.parsedOptions._maxDateTime),!0),u=jd(Math.max(Math.min(this.parsedOptions._maxDateTime,l),this.parsedOptions._minDateTime),!0)),{taskRecord:r,taskDays:(u.getTime()-c.getTime()+1)/864e5,startDate:c,endDate:u,progress:h}}_updateStartDateToTaskRecord(t,e,r){var i;const n=this.getRecordByIndex(e,r),s=this.parsedOptions.startDateField,o=Ed(t,null!==(i=this.parsedOptions.dateFormat)&&void 0!==i?i:Rd(n[s]));if(n[s]=o,ld(r))Array.isArray(r)&&this.stateManager.updateProjectTaskTimes(r);else{const t=this.getRecordIndexByTaskShowIndex(e);this._updateRecordToListTable(n,t),Array.isArray(t)&&this.stateManager.updateProjectTaskTimes(t)}}_updateEndDateToTaskRecord(t,e,r){var i;const n=this.getRecordByIndex(e,r),s=this.parsedOptions.endDateField,o=Ed(t,null!==(i=this.parsedOptions.dateFormat)&&void 0!==i?i:Rd(n[s]));if(n[s]=o,ld(r))Array.isArray(r)&&this.stateManager.updateProjectTaskTimes(r);else{const t=this.getRecordIndexByTaskShowIndex(e);this._updateRecordToListTable(n,t),Array.isArray(t)&&this.stateManager.updateProjectTaskTimes(t)}}_updateStartEndDateToTaskRecord(t,e,r,i){var n;const s=this.getRecordByIndex(r,i),o=this.parsedOptions.startDateField,a=this.parsedOptions.endDateField,l=null!==(n=this.parsedOptions.dateFormat)&&void 0!==n?n:Rd(s[o]),h=Ed(t,l);s[o]=h;const c=Ed(e,l);if(s[a]=c,ld(i))Array.isArray(i)&&this.stateManager.updateProjectTaskTimes(i);else{const t=this.getRecordIndexByTaskShowIndex(r);this._updateRecordToListTable(s,t),Array.isArray(t)&&this.stateManager.updateProjectTaskTimes(t)}}_dragOrderTaskRecord(t,e,r,i){this.data.adjustOrder(t,e,r,i)}updateTaskRecord(t,e,r){if(ld(r)){const i="number"==typeof e?e:e[0];return this._updateRecordToListTable(t,[i,r]),void this._refreshTaskBar(i,r)}if(Array.isArray(e)){const r=e[0],i=e[1];return this._updateRecordToListTable(t,e),void this._refreshTaskBar(r,i)}let i=e;"tree"===this.taskListTableInstance.rowHierarchyType&&(i=this.taskListTableInstance.getRecordIndexByCell(0,e+this.taskListTableInstance.columnHeaderLevelCount)),this._updateRecordToListTable(t,i),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,r,i,n,s;this._updateSize(),null===(t=this.taskListTableInstance)||void 0===t||t.setCanvasSize(this.taskTableWidth,this.tableNoFrameHeight+e.toBoxArray(null!==(i=null===(r=this.parsedOptions.outerFrameStyle)||void 0===r?void 0:r.borderLineWidth)&&void 0!==i?i:0)[0]+e.toBoxArray(null!==(s=null===(n=this.parsedOptions.outerFrameStyle)||void 0===n?void 0:n.borderLineWidth)&&void 0!==s?s:0)[2]),this._syncPropsFromTable(),this.scenegraph.resize(),rp(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:r}=this.element;r&&(r.removeChild(this.element),this.verticalSplitResizeLine&&r.removeChild(this.verticalSplitResizeLine),this.horizontalSplitLine&&r.removeChild(this.horizontalSplitLine)),this.scenegraph=null,this.pluginManager.release()}updateOption(t){var e,r,i,n,s;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===(r=null==t?void 0:t.taskListTable)||void 0===r?void 0:r.tableWidth:-1,this.taskTableColumns=null!==(n=null===(i=null==t?void 0:t.taskListTable)||void 0===i?void 0:i.columns)&&void 0!==n?n:[],this.records=null!==(s=null==t?void 0:t.records)&&void 0!==s?s:[],this._sortScales(),Jd(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=-1!==this.taskTableWidth?`${this.taskTableWidth}px`:"0px",rp(this),this.scenegraph.updateSceneGraph(),this.scenegraph.afterCreateSceneGraph(),this._scrollToMarkLine()}setRecords(t){this.records=t,this.data.setRecords(t),function(t){var e,r,i,n,s,o,a;const l=t.options,{unit:h,startOfWeek:c}=t.parsedOptions.reverseSortedTimelineScales[0];t.parsedOptions.markLine=Qd(null==l?void 0:l.markLine),null!==(r=null===(e=t.parsedOptions.markLine)||void 0===e?void 0:e.length)&&void 0!==r&&r&&((null===(i=t.parsedOptions.markLine)||void 0===i?void 0:i.every((t=>void 0===t.scrollToMarkLine)))&&(t.parsedOptions.markLine[0].scrollToMarkLine=!0),(null===(n=t.parsedOptions.markLine)||void 0===n?void 0:n.find((t=>t.scrollToMarkLine)))&&(t.parsedOptions.scrollToMarkLineDate=Hd(new Date(null===(s=t.parsedOptions.markLine)||void 0===s?void 0:s.find((t=>t.scrollToMarkLine)).date),h,c))),t.parsedOptions.dependencyLinks=null!==(a=null===(o=l.dependency)||void 0===o?void 0:o.links)&&void 0!==a?a:[]}(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,r=this.stateManager.scroll.verticalBarPos;this.scenegraph.setX(-e),this.scenegraph.setY(-r)}updateScales(t){const e=this.parsedOptions.sortedTimelineScales.length;if(this.options.timelineHeader.scales=t,this._sortScales(),function(t){var e,r,i,n;const s=t.options,{unit:o,startOfWeek:a,step:l}=t.parsedOptions.reverseSortedTimelineScales[0];t.parsedOptions.minDate=Hd(new Date(t.parsedOptions.minDate),o,a),t.parsedOptions.maxDate=zd(t.parsedOptions.minDate,new Date(t.parsedOptions.maxDate),o,l),t.parsedOptions._minDateTime=null===(e=t.parsedOptions.minDate)||void 0===e?void 0:e.getTime(),t.parsedOptions._maxDateTime=null===(r=t.parsedOptions.maxDate)||void 0===r?void 0:r.getTime(),t.parsedOptions.timeLineHeaderRowHeights=[],t.parsedOptions.timelineHeaderStyles=[];for(let e=0;e<t.parsedOptions.sortedTimelineScales.length;e++){const r=t.parsedOptions.sortedTimelineScales[e].style;t.parsedOptions.timelineHeaderStyles.push(Object.assign({fontSize:20,fontWeight:"bold",textAlign:"center",textBaseline:"middle",color:"#000",backgroundColor:"#fff"},r)),t.parsedOptions.timeLineHeaderRowHeights.push(null!==(n=null!==(i=t.parsedOptions.sortedTimelineScales[e].rowHeight)&&void 0!==i?i:null==s?void 0:s.headerRowHeight)&&void 0!==n?n:40)}}(this),this._generateTimeLineDateMap(),this.timeLineHeaderLevel=this.parsedOptions.sortedTimelineScales.length,this.scenegraph.refreshAll(),rp(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,r;const i=t.options,{unit:n,startOfWeek:s,step:o}=t.parsedOptions.reverseSortedTimelineScales[0];t.parsedOptions.minDate=(null==i?void 0:i.minDate)?Hd(new Date(i.minDate),n,s):void 0,t.parsedOptions.maxDate=(null==i?void 0:i.maxDate)?zd(t.parsedOptions.minDate,new Date(i.maxDate),n,o):void 0,t.parsedOptions._minDateTime=null===(e=t.parsedOptions.minDate)||void 0===e?void 0:e.getTime(),t.parsedOptions._maxDateTime=null===(r=t.parsedOptions.maxDate)||void 0===r?void 0:r.getTime()}(this),this._generateTimeLineDateMap(),this._updateSize(),this.scenegraph.refreshAll(),this._scrollToMarkLine()}updateMarkLine(t){this.options.markLine=t,hp(this),this.scenegraph.markLine.refresh(),this.scenegraph.renderSceneGraph()}addMarkLine(t){this.options.markLine=[...this.parsedOptions.markLine,t],hp(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)],hp(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:r}=this.parsedOptions.reverseSortedTimelineScales[0],i=Wd(this.parsedOptions.scrollToMarkLineDate,t,e,r)*this.parsedOptions.timelineColWidth-this.tableNoFrameWidth/2;this.stateManager.setScrollLeft(i)}}scrollToMarkLine(t){if(!t||!this.parsedOptions.minDate)return;const e=this.parsedOptions.minDate,{unit:r,step:i}=this.parsedOptions.reverseSortedTimelineScales[0],n=Wd(t,e,r,i)*this.parsedOptions.timelineColWidth-this.tableNoFrameWidth/2;this.stateManager.setScrollLeft(n)}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 Rd(t)}getTaskBarStyle(t,e){const{startDate:r,endDate:i,taskRecord:n}=this.getTaskInfoByTaskListIndex(t,e);let s;return s=n.type===Td.PROJECT?this.parsedOptions.projectBarStyle:this.parsedOptions.taskBarStyle,"function"==typeof s?s({index:t,startDate:r,endDate:i,taskRecord:n,ganttInstance:this}):s}formatDate(t,e){return Ed(t,e)}}var Gp=1e6,Xp=1e6,Yp="[big.js] ",qp=Yp+"Invalid ",Zp=qp+"decimal places",Kp=qp+"rounding mode",Qp=Yp+"Division by zero",Jp={},tf=void 0,ef=/^-?(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i;function rf(t,e,r,i){var n=t.c;if(r===tf&&(r=t.constructor.RM),0!==r&&1!==r&&2!==r&&3!==r)throw Error(Kp);if(e<1)i=3===r&&(i||!!n[0])||0===e&&(1===r&&n[0]>=5||2===r&&(n[0]>5||5===n[0]&&(i||n[1]!==tf))),n.length=1,i?(t.e=t.e-e+1,n[0]=1):n[0]=t.e=0;else if(e<n.length){if(i=1===r&&n[e]>=5||2===r&&(n[e]>5||5===n[e]&&(i||n[e+1]!==tf||1&n[e-1]))||3===r&&(i||!!n[0]),n.length=e,i)for(;++n[--e]>9;)if(n[e]=0,0===e){++t.e,n.unshift(1);break}for(e=n.length;!n[--e];)n.pop()}return t}function nf(t,e,r){var i=t.e,n=t.c.join(""),s=n.length;if(e)n=n.charAt(0)+(s>1?"."+n.slice(1):"")+(i<0?"e":"e+")+i;else if(i<0){for(;++i;)n="0"+n;n="0."+n}else if(i>0)if(++i>s)for(i-=s;i--;)n+="0";else i<s&&(n=n.slice(0,i)+"."+n.slice(i));else s>1&&(n=n.charAt(0)+"."+n.slice(1));return t.s<0&&r?"-"+n:n}Jp.abs=function(){var t=new this.constructor(this);return t.s=1,t},Jp.cmp=function(t){var e,r=this,i=r.c,n=(t=new r.constructor(t)).c,s=r.s,o=t.s,a=r.e,l=t.e;if(!i[0]||!n[0])return i[0]?s:n[0]?-o:0;if(s!=o)return s;if(e=s<0,a!=l)return a>l^e?1:-1;for(o=(a=i.length)<(l=n.length)?a:l,s=-1;++s<o;)if(i[s]!=n[s])return i[s]>n[s]^e?1:-1;return a==l?0:a>l^e?1:-1},Jp.div=function(t){var e=this,r=e.constructor,i=e.c,n=(t=new r(t)).c,s=e.s==t.s?1:-1,o=r.DP;if(o!==~~o||o<0||o>Gp)throw Error(Zp);if(!n[0])throw Error(Qp);if(!i[0])return t.s=s,t.c=[t.e=0],t;var a,l,h,c,u,d=n.slice(),p=a=n.length,f=i.length,g=i.slice(0,a),m=g.length,y=t,v=y.c=[],b=0,_=o+(y.e=e.e-t.e)+1;for(y.s=s,s=_<0?0:_,d.unshift(0);m++<a;)g.push(0);do{for(h=0;h<10;h++){if(a!=(m=g.length))c=a>m?1:-1;else for(u=-1,c=0;++u<a;)if(n[u]!=g[u]){c=n[u]>g[u]?1:-1;break}if(!(c<0))break;for(l=m==a?n:d;m;){if(g[--m]<l[m]){for(u=m;u&&!g[--u];)g[u]=9;--g[u],g[m]+=10}g[m]-=l[m]}for(;!g[0];)g.shift()}v[b++]=c?h:++h,g[0]&&c?g[m]=i[p]||0:g=[i[p]]}while((p++<f||g[0]!==tf)&&s--);return v[0]||1==b||(v.shift(),y.e--,_--),b>_&&rf(y,_,r.RM,g[0]!==tf),y},Jp.eq=function(t){return 0===this.cmp(t)},Jp.gt=function(t){return this.cmp(t)>0},Jp.gte=function(t){return this.cmp(t)>-1},Jp.lt=function(t){return this.cmp(t)<0},Jp.lte=function(t){return this.cmp(t)<1},Jp.minus=Jp.sub=function(t){var e,r,i,n,s=this,o=s.constructor,a=s.s,l=(t=new o(t)).s;if(a!=l)return t.s=-l,s.plus(t);var h=s.c.slice(),c=s.e,u=t.c,d=t.e;if(!h[0]||!u[0])return u[0]?t.s=-l:h[0]?t=new o(s):t.s=1,t;if(a=c-d){for((n=a<0)?(a=-a,i=h):(d=c,i=u),i.reverse(),l=a;l--;)i.push(0);i.reverse()}else for(r=((n=h.length<u.length)?h:u).length,a=l=0;l<r;l++)if(h[l]!=u[l]){n=h[l]<u[l];break}if(n&&(i=h,h=u,u=i,t.s=-t.s),(l=(r=u.length)-(e=h.length))>0)for(;l--;)h[e++]=0;for(l=e;r>a;){if(h[--r]<u[r]){for(e=r;e&&!h[--e];)h[e]=9;--h[e],h[r]+=10}h[r]-=u[r]}for(;0===h[--l];)h.pop();for(;0===h[0];)h.shift(),--d;return h[0]||(t.s=1,h=[d=0]),t.c=h,t.e=d,t},Jp.mod=function(t){var e,r=this,i=r.constructor,n=r.s,s=(t=new i(t)).s;if(!t.c[0])throw Error(Qp);return r.s=t.s=1,e=1==t.cmp(r),r.s=n,t.s=s,e?new i(r):(n=i.DP,s=i.RM,i.DP=i.RM=0,r=r.div(t),i.DP=n,i.RM=s,this.minus(r.times(t)))},Jp.neg=function(){var t=new this.constructor(this);return t.s=-t.s,t},Jp.plus=Jp.add=function(t){var e,r,i,n=this,s=n.constructor;if(t=new s(t),n.s!=t.s)return t.s=-t.s,n.minus(t);var o=n.e,a=n.c,l=t.e,h=t.c;if(!a[0]||!h[0])return h[0]||(a[0]?t=new s(n):t.s=n.s),t;if(a=a.slice(),e=o-l){for(e>0?(l=o,i=h):(e=-e,i=a),i.reverse();e--;)i.push(0);i.reverse()}for(a.length-h.length<0&&(i=h,h=a,a=i),e=h.length,r=0;e;a[e]%=10)r=(a[--e]=a[e]+h[e]+r)/10|0;for(r&&(a.unshift(r),++l),e=a.length;0===a[--e];)a.pop();return t.c=a,t.e=l,t},Jp.pow=function(t){var e=this,r=new e.constructor("1"),i=r,n=t<0;if(t!==~~t||t<-1e6||t>Xp)throw Error(qp+"exponent");for(n&&(t=-t);1&t&&(i=i.times(e)),t>>=1;)e=e.times(e);return n?r.div(i):i},Jp.prec=function(t,e){if(t!==~~t||t<1||t>Gp)throw Error(qp+"precision");return rf(new this.constructor(this),t,e)},Jp.round=function(t,e){if(t===tf)t=0;else if(t!==~~t||t<-Gp||t>Gp)throw Error(Zp);return rf(new this.constructor(this),t+this.e+1,e)},Jp.sqrt=function(){var t,e,r,i=this,n=i.constructor,s=i.s,o=i.e,a=new n("0.5");if(!i.c[0])return new n(i);if(s<0)throw Error(Yp+"No square root");0===(s=Math.sqrt(+nf(i,!0,!0)))||s===1/0?((e=i.c.join("")).length+o&1||(e+="0"),o=((o+1)/2|0)-(o<0||1&o),t=new n(((s=Math.sqrt(e))==1/0?"5e":(s=s.toExponential()).slice(0,s.indexOf("e")+1))+o)):t=new n(s+""),o=t.e+(n.DP+=4);do{r=t,t=a.times(r.plus(i.div(r)))}while(r.c.slice(0,o).join("")!==t.c.slice(0,o).join(""));return rf(t,(n.DP-=4)+t.e+1,n.RM)},Jp.times=Jp.mul=function(t){var e,r=this,i=r.constructor,n=r.c,s=(t=new i(t)).c,o=n.length,a=s.length,l=r.e,h=t.e;if(t.s=r.s==t.s?1:-1,!n[0]||!s[0])return t.c=[t.e=0],t;for(t.e=l+h,o<a&&(e=n,n=s,s=e,h=o,o=a,a=h),e=new Array(h=o+a);h--;)e[h]=0;for(l=a;l--;){for(a=0,h=o+l;h>l;)a=e[h]+s[l]*n[h-l-1]+a,e[h--]=a%10,a=a/10|0;e[h]=a}for(a?++t.e:e.shift(),l=e.length;!e[--l];)e.pop();return t.c=e,t},Jp.toExponential=function(t,e){var r=this,i=r.c[0];if(t!==tf){if(t!==~~t||t<0||t>Gp)throw Error(Zp);for(r=rf(new r.constructor(r),++t,e);r.c.length<t;)r.c.push(0)}return nf(r,!0,!!i)},Jp.toFixed=function(t,e){var r=this,i=r.c[0];if(t!==tf){if(t!==~~t||t<0||t>Gp)throw Error(Zp);for(t=t+(r=rf(new r.constructor(r),t+r.e+1,e)).e+1;r.c.length<t;)r.c.push(0)}return nf(r,!1,!!i)},Jp[Symbol.for("nodejs.util.inspect.custom")]=Jp.toJSON=Jp.toString=function(){var t=this,e=t.constructor;return nf(t,t.e<=e.NE||t.e>=e.PE,!!t.c[0])},Jp.toNumber=function(){var t=+nf(this,!0,!0);if(!0===this.constructor.strict&&!this.eq(t.toString()))throw Error(Yp+"Imprecise conversion");return t},Jp.toPrecision=function(t,e){var r=this,i=r.constructor,n=r.c[0];if(t!==tf){if(t!==~~t||t<1||t>Gp)throw Error(qp+"precision");for(r=rf(new i(r),t,e);r.c.length<t;)r.c.push(0)}return nf(r,t<=r.e||r.e<=i.NE||r.e>=i.PE,!!n)},Jp.valueOf=function(){var t=this,e=t.constructor;if(!0===e.strict)throw Error(Yp+"valueOf disallowed");return nf(t,t.e<=e.NE||t.e>=e.PE,!0)};var sf=function t(){function e(r){var i=this;if(!(i instanceof e))return r===tf?t():new e(r);if(r instanceof e)i.s=r.s,i.e=r.e,i.c=r.c.slice();else{if("string"!=typeof r){if(!0===e.strict&&"bigint"!=typeof r)throw TypeError(qp+"value");r=0===r&&1/r<0?"-0":String(r)}!function(t,e){var r,i,n;if(!ef.test(e))throw Error(qp+"number");t.s="-"==e.charAt(0)?(e=e.slice(1),-1):1,(r=e.indexOf("."))>-1&&(e=e.replace(".",""));(i=e.search(/e/i))>0?(r<0&&(r=i),r+=+e.slice(i+1),e=e.substring(0,i)):r<0&&(r=e.length);for(n=e.length,i=0;i<n&&"0"==e.charAt(i);)++i;if(i==n)t.c=[t.e=0];else{for(;n>0&&"0"==e.charAt(--n););for(t.e=r-i-1,t.c=[],r=0;i<=n;)t.c[r++]=+e.charAt(i++)}}(i,r)}i.constructor=e}return e.prototype=Jp,e.DP=20,e.RM=1,e.NE=-7,e.PE=21,e.strict=false,e.roundDown=0,e.roundHalfUp=1,e.roundHalfEven=2,e.roundUp=3,e}();var of=function(){this.__data__=[],this.size=0};var af=function(t,e){return t===e||t!=t&&e!=e},lf=af;var hf=function(t,e){for(var r=t.length;r--;)if(lf(t[r][0],e))return r;return-1},cf=hf,uf=Array.prototype.splice;var df=function(t){var e=this.__data__,r=cf(e,t);return!(r<0)&&(r==e.length-1?e.pop():uf.call(e,r,1),--this.size,!0)},pf=hf;var ff=function(t){var e=this.__data__,r=pf(e,t);return r<0?void 0:e[r][1]},gf=hf;var mf=function(t){return gf(this.__data__,t)>-1},yf=hf;var vf=function(t,e){var r=this.__data__,i=yf(r,t);return i<0?(++this.size,r.push([t,e])):r[i][1]=e,this},bf=of,_f=df,wf=ff,xf=mf,Sf=vf;function Tf(t){var e=-1,r=null==t?0:t.length;for(this.clear();++e<r;){var i=t[e];this.set(i[0],i[1])}}Tf.prototype.clear=bf,Tf.prototype.delete=_f,Tf.prototype.get=wf,Tf.prototype.has=xf,Tf.prototype.set=Sf;var kf=Tf,Cf=kf;var Ef=function(){this.__data__=new Cf,this.size=0};var Af=function(t){var e=this.__data__,r=e.delete(t);return this.size=e.size,r};var Of=function(t){return this.__data__.get(t)};var Bf=function(t){return this.__data__.has(t)},Rf="object"==typeof dt&&dt&&dt.Object===Object&&dt,Lf=Rf,Pf="object"==typeof self&&self&&self.Object===Object&&self,Df=Lf||Pf||Function("return this")(),Mf=Df.Symbol,If=Mf,Nf=Object.prototype,Ff=Nf.hasOwnProperty,jf=Nf.toString,zf=If?If.toStringTag:void 0;var Hf=function(t){var e=Ff.call(t,zf),r=t[zf];try{t[zf]=void 0;var i=!0}catch(t){}var n=jf.call(t);return i&&(e?t[zf]=r:delete t[zf]),n},Wf=Object.prototype.toString;var Uf=Hf,$f=function(t){return Wf.call(t)},Vf=Mf?Mf.toStringTag:void 0;var Gf=function(t){return null==t?void 0===t?"[object Undefined]":"[object Null]":Vf&&Vf in Object(t)?Uf(t):$f(t)};var Xf=function(t){var e=typeof t;return null!=t&&("object"==e||"function"==e)},Yf=pt(Xf),qf=Gf,Zf=Xf;var Kf,Qf=function(t){if(!Zf(t))return!1;var e=qf(t);return"[object Function]"==e||"[object GeneratorFunction]"==e||"[object AsyncFunction]"==e||"[object Proxy]"==e},Jf=Df["__core-js_shared__"],tg=(Kf=/[^.]+$/.exec(Jf&&Jf.keys&&Jf.keys.IE_PROTO||""))?"Symbol(src)_1."+Kf:"";var eg=function(t){return!!tg&&tg in t},rg=Function.prototype.toString;var ig=function(t){if(null!=t){try{return rg.call(t)}catch(t){}try{return t+""}catch(t){}}return""},ng=Qf,sg=eg,og=Xf,ag=ig,lg=/^\[object .+?Constructor\]$/,hg=Function.prototype,cg=Object.prototype,ug=hg.toString,dg=cg.hasOwnProperty,pg=RegExp("^"+ug.call(dg).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");var fg=function(t,e){return null==t?void 0:t[e]},gg=function(t){return!(!og(t)||sg(t))&&(ng(t)?pg:lg).test(ag(t))},mg=fg;var yg=function(t,e){var r=mg(t,e);return gg(r)?r:void 0},vg=yg(Df,"Map"),bg=yg(Object,"create"),_g=bg;var wg=function(){this.__data__=_g?_g(null):{},this.size=0};var xg=function(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e},Sg=bg,Tg=Object.prototype.hasOwnProperty;var kg=function(t){var e=this.__data__;if(Sg){var r=e[t];return"__lodash_hash_undefined__"===r?void 0:r}return Tg.call(e,t)?e[t]:void 0},Cg=bg,Eg=Object.prototype.hasOwnProperty;var Ag=function(t){var e=this.__data__;return Cg?void 0!==e[t]:Eg.call(e,t)},Og=bg;var Bg=function(t,e){var r=this.__data__;return this.size+=this.has(t)?0:1,r[t]=Og&&void 0===e?"__lodash_hash_undefined__":e,this},Rg=wg,Lg=xg,Pg=kg,Dg=Ag,Mg=Bg;function Ig(t){var e=-1,r=null==t?0:t.length;for(this.clear();++e<r;){var i=t[e];this.set(i[0],i[1])}}Ig.prototype.clear=Rg,Ig.prototype.delete=Lg,Ig.prototype.get=Pg,Ig.prototype.has=Dg,Ig.prototype.set=Mg;var Ng=Ig,Fg=kf,jg=vg;var zg=function(t){var e=typeof t;return"string"==e||"number"==e||"symbol"==e||"boolean"==e?"__proto__"!==t:null===t};var Hg=function(t,e){var r=t.__data__;return zg(e)?r["string"==typeof e?"string":"hash"]:r.map},Wg=Hg;var Ug=function(t){var e=Wg(this,t).delete(t);return this.size-=e?1:0,e},$g=Hg;var Vg=function(t){return $g(this,t).get(t)},Gg=Hg;var Xg=function(t){return Gg(this,t).has(t)},Yg=Hg;var qg=function(t,e){var r=Yg(this,t),i=r.size;return r.set(t,e),this.size+=r.size==i?0:1,this},Zg=function(){this.size=0,this.__data__={hash:new Ng,map:new(jg||Fg),string:new Ng}},Kg=Ug,Qg=Vg,Jg=Xg,tm=qg;function em(t){var e=-1,r=null==t?0:t.length;for(this.clear();++e<r;){var i=t[e];this.set(i[0],i[1])}}em.prototype.clear=Zg,em.prototype.delete=Kg,em.prototype.get=Qg,em.prototype.has=Jg,em.prototype.set=tm;var rm=em,im=kf,nm=vg,sm=rm;var om=function(t,e){var r=this.__data__;if(r instanceof im){var i=r.__data__;if(!nm||i.length<199)return i.push([t,e]),this.size=++r.size,this;r=this.__data__=new sm(i)}return r.set(t,e),this.size=r.size,this},am=kf,lm=Ef,hm=Af,cm=Of,um=Bf,dm=om;function pm(t){var e=this.__data__=new am(t);this.size=e.size}pm.prototype.clear=lm,pm.prototype.delete=hm,pm.prototype.get=cm,pm.prototype.has=um,pm.prototype.set=dm;var fm=pm;var gm=rm,mm=function(t){return this.__data__.set(t,"__lodash_hash_undefined__"),this},ym=function(t){return this.__data__.has(t)};function vm(t){var e=-1,r=null==t?0:t.length;for(this.__data__=new gm;++e<r;)this.add(t[e])}vm.prototype.add=vm.prototype.push=mm,vm.prototype.has=ym;var bm=function(t,e){for(var r=-1,i=null==t?0:t.length;++r<i;)if(e(t[r],r,t))return!0;return!1};var _m=function(t,e){return t.has(e)},wm=vm,xm=bm,Sm=_m;var Tm=function(t,e,r,i,n,s){var o=1&r,a=t.length,l=e.length;if(a!=l&&!(o&&l>a))return!1;var h=s.get(t),c=s.get(e);if(h&&c)return h==e&&c==t;var u=-1,d=!0,p=2&r?new wm:void 0;for(s.set(t,e),s.set(e,t);++u<a;){var f=t[u],g=e[u];if(i)var m=o?i(g,f,u,e,t,s):i(f,g,u,t,e,s);if(void 0!==m){if(m)continue;d=!1;break}if(p){if(!xm(e,(function(t,e){if(!Sm(p,e)&&(f===t||n(f,t,r,i,s)))return p.push(e)}))){d=!1;break}}else if(f!==g&&!n(f,g,r,i,s)){d=!1;break}}return s.delete(t),s.delete(e),d};var km=function(t){var e=-1,r=Array(t.size);return t.forEach((function(t,i){r[++e]=[i,t]})),r};var Cm=function(t){var e=-1,r=Array(t.size);return t.forEach((function(t){r[++e]=t})),r},Em=Df.Uint8Array,Am=af,Om=Tm,Bm=km,Rm=Cm,Lm=Mf?Mf.prototype:void 0,Pm=Lm?Lm.valueOf:void 0;var Dm=function(t,e,r,i,n,s,o){switch(r){case"[object DataView]":if(t.byteLength!=e.byteLength||t.byteOffset!=e.byteOffset)return!1;t=t.buffer,e=e.buffer;case"[object ArrayBuffer]":return!(t.byteLength!=e.byteLength||!s(new Em(t),new Em(e)));case"[object Boolean]":case"[object Date]":case"[object Number]":return Am(+t,+e);case"[object Error]":return t.name==e.name&&t.message==e.message;case"[object RegExp]":case"[object String]":return t==e+"";case"[object Map]":var a=Bm;case"[object Set]":var l=1&i;if(a||(a=Rm),t.size!=e.size&&!l)return!1;var h=o.get(t);if(h)return h==e;i|=2,o.set(t,e);var c=Om(a(t),a(e),i,n,s,o);return o.delete(t),c;case"[object Symbol]":if(Pm)return Pm.call(t)==Pm.call(e)}return!1};var Mm=function(t,e){for(var r=-1,i=e.length,n=t.length;++r<i;)t[n+r]=e[r];return t},Im=Array.isArray,Nm=Mm,Fm=Im;var jm=function(t,e,r){var i=e(t);return Fm(t)?i:Nm(i,r(t))};var zm=function(t,e){for(var r=-1,i=null==t?0:t.length,n=0,s=[];++r<i;){var o=t[r];e(o,r,t)&&(s[n++]=o)}return s};var Hm=zm,Wm=function(){return[]},Um=Object.prototype.propertyIsEnumerable,$m=Object.getOwnPropertySymbols,Vm=$m?function(t){return null==t?[]:(t=Object(t),Hm($m(t),(function(e){return Um.call(t,e)})))}:Wm,Gm=Vm;var Xm=function(t,e){for(var r=-1,i=Array(t);++r<t;)i[r]=e(r);return i};var Ym=function(t){return null!=t&&"object"==typeof t},qm=Gf,Zm=Ym;var Km=function(t){return Zm(t)&&"[object Arguments]"==qm(t)},Qm=Ym,Jm=Object.prototype,ty=Jm.hasOwnProperty,ey=Jm.propertyIsEnumerable,ry=Km(function(){return arguments}())?Km:function(t){return Qm(t)&&ty.call(t,"callee")&&!ey.call(t,"callee")},iy=ry,ny={exports:{}};var sy=function(){return!1};!function(t,e){var r=Df,i=sy,n=e&&!e.nodeType&&e,s=n&&t&&!t.nodeType&&t,o=s&&s.exports===n?r.Buffer:void 0,a=(o?o.isBuffer:void 0)||i;t.exports=a}(ny,ny.exports);var oy=ny.exports,ay=/^(?:0|[1-9]\d*)$/;var ly=function(t,e){var r=typeof t;return!!(e=null==e?9007199254740991:e)&&("number"==r||"symbol"!=r&&ay.test(t))&&t>-1&&t%1==0&&t<e};var hy=function(t){return"number"==typeof t&&t>-1&&t%1==0&&t<=9007199254740991},cy=Gf,uy=hy,dy=Ym,py={};py["[object Float32Array]"]=py["[object Float64Array]"]=py["[object Int8Array]"]=py["[object Int16Array]"]=py["[object Int32Array]"]=py["[object Uint8Array]"]=py["[object Uint8ClampedArray]"]=py["[object Uint16Array]"]=py["[object Uint32Array]"]=!0,py["[object Arguments]"]=py["[object Array]"]=py["[object ArrayBuffer]"]=py["[object Boolean]"]=py["[object DataView]"]=py["[object Date]"]=py["[object Error]"]=py["[object Function]"]=py["[object Map]"]=py["[object Number]"]=py["[object Object]"]=py["[object RegExp]"]=py["[object Set]"]=py["[object String]"]=py["[object WeakMap]"]=!1;var fy=function(t){return dy(t)&&uy(t.length)&&!!py[cy(t)]};var gy=function(t){return function(e){return t(e)}},my={exports:{}};!function(t,e){var r=Rf,i=e&&!e.nodeType&&e,n=i&&t&&!t.nodeType&&t,s=n&&n.exports===i&&r.process,o=function(){try{var t=n&&n.require&&n.require("util").types;return t||s&&s.binding&&s.binding("util")}catch(t){}}();t.exports=o}(my,my.exports);var yy=my.exports,vy=fy,by=gy,_y=yy&&yy.isTypedArray,wy=_y?by(_y):vy,xy=Xm,Sy=iy,Ty=Im,ky=oy,Cy=ly,Ey=wy,Ay=Object.prototype.hasOwnProperty;var Oy=function(t,e){var r=Ty(t),i=!r&&Sy(t),n=!r&&!i&&ky(t),s=!r&&!i&&!n&&Ey(t),o=r||i||n||s,a=o?xy(t.length,String):[],l=a.length;for(var h in t)!e&&!Ay.call(t,h)||o&&("length"==h||n&&("offset"==h||"parent"==h)||s&&("buffer"==h||"byteLength"==h||"byteOffset"==h)||Cy(h,l))||a.push(h);return a},By=Object.prototype;var Ry=function(t){var e=t&&t.constructor;return t===("function"==typeof e&&e.prototype||By)};var Ly=function(t,e){return function(r){return t(e(r))}},Py=Ly(Object.keys,Object),Dy=Ry,My=Py,Iy=Object.prototype.hasOwnProperty;var Ny=function(t){if(!Dy(t))return My(t);var e=[];for(var r in Object(t))Iy.call(t,r)&&"constructor"!=r&&e.push(r);return e},Fy=Qf,jy=hy;var zy=Oy,Hy=Ny,Wy=function(t){return null!=t&&jy(t.length)&&!Fy(t)};var Uy=function(t){return Wy(t)?zy(t):Hy(t)},$y=jm,Vy=Gm,Gy=Uy;var Xy=function(t){return $y(t,Gy,Vy)},Yy=Xy,qy=Object.prototype.hasOwnProperty;var Zy=function(t,e,r,i,n,s){var o=1&r,a=Yy(t),l=a.length;if(l!=Yy(e).length&&!o)return!1;for(var h=l;h--;){var c=a[h];if(!(o?c in e:qy.call(e,c)))return!1}var u=s.get(t),d=s.get(e);if(u&&d)return u==e&&d==t;var p=!0;s.set(t,e),s.set(e,t);for(var f=o;++h<l;){var g=t[c=a[h]],m=e[c];if(i)var y=o?i(m,g,c,e,t,s):i(g,m,c,t,e,s);if(!(void 0===y?g===m||n(g,m,r,i,s):y)){p=!1;break}f||(f="constructor"==c)}if(p&&!f){var v=t.constructor,b=e.constructor;v==b||!("constructor"in t)||!("constructor"in e)||"function"==typeof v&&v instanceof v&&"function"==typeof b&&b instanceof b||(p=!1)}return s.delete(t),s.delete(e),p},Ky=yg(Df,"DataView"),Qy=vg,Jy=yg(Df,"Promise"),tv=yg(Df,"Set"),ev=yg(Df,"WeakMap"),rv=Gf,iv=ig,nv="[object Map]",sv="[object Promise]",ov="[object Set]",av="[object WeakMap]",lv="[object DataView]",hv=iv(Ky),cv=iv(Qy),uv=iv(Jy),dv=iv(tv),pv=iv(ev),fv=rv;(Ky&&fv(new Ky(new ArrayBuffer(1)))!=lv||Qy&&fv(new Qy)!=nv||Jy&&fv(Jy.resolve())!=sv||tv&&fv(new tv)!=ov||ev&&fv(new ev)!=av)&&(fv=function(t){var e=rv(t),r="[object Object]"==e?t.constructor:void 0,i=r?iv(r):"";if(i)switch(i){case hv:return lv;case cv:return nv;case uv:return sv;case dv:return ov;case pv:return av}return e});var gv=fm,mv=Tm,yv=Dm,vv=Zy,bv=fv,_v=Im,wv=oy,xv=wy,Sv="[object Arguments]",Tv="[object Array]",kv="[object Object]",Cv=Object.prototype.hasOwnProperty;var Ev=function(t,e,r,i,n,s){var o=_v(t),a=_v(e),l=o?Tv:bv(t),h=a?Tv:bv(e),c=(l=l==Sv?kv:l)==kv,u=(h=h==Sv?kv:h)==kv,d=l==h;if(d&&wv(t)){if(!wv(e))return!1;o=!0,c=!1}if(d&&!c)return s||(s=new gv),o||xv(t)?mv(t,e,r,i,n,s):yv(t,e,l,r,i,n,s);if(!(1&r)){var p=c&&Cv.call(t,"__wrapped__"),f=u&&Cv.call(e,"__wrapped__");if(p||f){var g=p?t.value():t,m=f?e.value():e;return s||(s=new gv),n(g,m,r,i,s)}}return!!d&&(s||(s=new gv),vv(t,e,r,i,n,s))},Av=Ev,Ov=Ym;var Bv=function t(e,r,i,n,s){return e===r||(null==e||null==r||!Ov(e)&&!Ov(r)?e!=e&&r!=r:Av(e,r,i,n,t,s))},Rv=Bv;var Lv=pt((function(t,e){return Rv(t,e)})),Pv=Gf,Dv=Ym;var Mv=pt((function(t){return"number"==typeof t||Dv(t)&&"[object Number]"==Pv(t)}));const Iv=(t,e,r)=>{if("number"!=typeof t&&(t=Number(t)),"number"!=typeof e&&(e=Number(e)),Number.isNaN(t)||Number.isNaN(e))throw new Error(`${r}(a, b), a or b is NaN`);return new sf(t)[r](e).toNumber()},Nv=(t=0,e=0)=>Iv(t,e,"plus");const Fv=t=>{if("number"==typeof t)return{prefix:"",number:t,full:t};const e=function(t){const e=t.match(/((\d+)(\.\d+)?)(?!.*(\d+)(\.\d+)?)/);if(!e||void 0===e.index)return[t];const r=e.index,i=e[0];return[t.slice(0,r),i,t.slice(r+i.length)].filter((t=>""!==t))}(t),r=e.findIndex((t=>!isNaN(Number(t))&&""!==t&&!isNaN(parseFloat(t))&&isFinite(Number(t))));return 1===e.length?0===r?{prefix:"",number:Number(e[0]),suffix:"",full:t}:{prefix:t,number:null,suffix:"",full:t}:e.length>1?0===r?{prefix:"",number:Number(e[0]),suffix:e[1],full:t}:{prefix:e[0],number:Number(e[1]),suffix:e?.[2],full:t}:{prefix:null,number:null,suffix:null,full:t}},jv=(t,e,r,i)=>{if(!t||t.length<r.endRow-1)return[];let n=[];if(Array.isArray(t?.[0])?n=t.map((t=>[...t])):e.length&&Yf(t?.[0])&&(n=function(t,e){return t.map((t=>e.map((e=>t[e.field]))))}(t,e)),!n?.length)return t;const s=i.row-r.endRow,o=i.col-r.endCol,a=Math.abs(s)>=Math.abs(o),l=a?s:o,[h,c]=[r.startRow,r.endRow].sort(((t,e)=>t-e)),[u,d]=[r.startCol,r.endCol].sort(((t,e)=>t-e)),p=[];for(let t=h;t<=c;t++)for(let e=u;e<=d;e++)p.push(n[t][e]);const f=p.map(Fv),g=f.every((t=>null!==t.number))&&f.slice(1).every(((t,e)=>t.prefix===f[e].prefix))&&f.length<3&&!(2===f.length&&Lv(f[0],f[1]));let m;if(1===f.length&&null!==f[0].number)m=1;else if(g&&f.length>1){const t=f.map((t=>t.number));m=((t=0,e=0)=>Iv(t,e,"minus"))(t[t.length-1],t[t.length-2])}const y=t=>a&&s>0?t.row<=i.row:a&&s<0?t.row>=i.row:!a&&o>0?t.col<=i.col:!a&&o<0&&t.col>=i.col,v=Math.abs(l),b=l>0?1:-1,_=f.length;if(1===f.length){const t=f[0];for(let e=1;e<=v;e++){const i={row:a?r.endRow+b*e:r.startRow,col:a?r.startCol:r.endCol+b*e};if(i.row>=0&&i.col>=0&&y(i)){let r=Mv(t.number)?`${t.prefix||""}${(t?.number||0)+(b>0?e:-e)}${t.suffix||""}`:t.full;Mv(t.full)&&(r=(t?.number||0)+(b>0?e:-e)),n[i.row][i.col]=r}}}else if(f.length>=2)for(let t=1;t<=v;t++){let e;const i={row:0,col:0};if(1===b?(i.row=a?r.endRow+b*t:r.endRow,i.col=a?r.endCol:r.endCol+b*t,e=f[(t-1)%_]):(i.row=a?r.startRow+b*t:r.startRow,i.col=a?r.startCol:r.startCol+b*t,e=f[Math.abs(_-t)%_]),i.row>=0&&i.col>=0&&y(i)){let r;if(Mv(e.full)||Number(e.full)===Number(e.number)&&2===_){const i=_+Math.floor((t-1)/_)*_;r=Nv(e?.number||0,b>0?(m||1)*i:-(m||1)*i)}else r=g?`${e.prefix||""}${Nv(e?.number||0,b>0?(m||1)*_:-(m||1)*_)}${e.suffix||""}`:Mv(e?.number)?`${e.prefix||""}${Nv(e?.number||0,b>0?Math.floor((t-1)/_)+1:-(Math.floor((t-1)/_)+1))}${e.suffix||""}`:e.full;n[i.row][i.col]=r}}return Array.isArray(t?.[0])?n:function(t,e){return t.map((t=>e.reduce(((e,r,i)=>(e[r.field]=t[i],e)),{})))}(n,e)};const{toString:zv}=Object.prototype,Hv=/["&<>]/,Wv={each:function(t,e){t&&(Array.isArray(t)?t.forEach(e):Object.keys(t).forEach((r=>{e(t[r],r)})))},some:function(t,e){return!!t&&(Array.isArray(t)?t.some(e):Object.keys(t).some((r=>e(t[r],r))))},every:function(t,e){return!t||(Array.isArray(t)?t.every(e):Object.keys(t).every((r=>e(t[r],r))))},map:function(t,e){return t?Array.isArray(t)?t.map(e):Object.keys(t).map((r=>e(t[r],r))):[]},keyBy:(t,e)=>t.reduce(((t,r)=>(t[r[e]]=r,t)),{}),isEqual:function(t,e){const r=typeof t,i=typeof e,n=Array.isArray(t),s=Array.isArray(e);let o;if(r!==i)return!1;if("object"==typeof t){if(n||s)return!(!n||!s)&&(t.length===e.length&&t.every(((t,r)=>{const i=e[r];return Wv.isEqual(t,i)})));if(null===t||null===e)return t===e;if(o=Object.keys(t),Object.keys(e).length!==o.length)return!1;for(const t of o)if(!e.hasOwnProperty(t))return!1;return Wv.every(t,((t,r)=>{const i=e[r];return Wv.isEqual(t,i)}))}return t===e},escapeHtml(t){const e=Hv.exec(t);if(!e)return t;let r="",i="",n=0,s=e.index;for(;s<t.length;s++){switch(t.charAt(s)){case'"':i=""";break;case"&":i="&";break;case"'":i="'";break;case"<":i="<";break;case">":i=">";break;default:continue}n!==s&&(r+=t.substring(n,s)),n=s+1,r+=i}return n!==s?r+t.substring(n,s):r},strcmp:(t,e)=>t<e?-1:t>e?1:0,isUndefined:t=>"[object Undefined]"===zv.call(t),isObject:t=>"[object Object]"===zv.call(t),deepMerge(){const t=arguments[0]||{},{length:e}=arguments;let r,i,n;function s(e,s){r=t[s],n=Array.isArray(e),Wv.isObject(e)||n?(n?(n=!1,i=r&&Array.isArray(r)?r:[]):i=r&&Wv.isObject(r)?r:{},t[s]=Wv.deepMerge(i,e)):Wv.isUndefined(e)||(t[s]=e)}for(let t=0;t<e;t++)Wv.each(arguments[t],s);return t}};var Uv=Wv;const $v=/^[A-Z]+\d+$/,Vv={_dictionary:["A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"],_l2nFill:0,_l2n:{},_n2l:[],_level:t=>t<=26?1:t<=676?2:3,_fill(t){let e,r,i,n,s,o=1;if(t>=4)throw new Error("Out of bounds. Excel supports columns from 1 to 16384");if(this._l2nFill<1&&t>=1){for(;o<=26;)e=this._dictionary[o-1],this._n2l[o]=e,this._l2n[e]=o,o++;this._l2nFill=1}if(this._l2nFill<2&&t>=2){for(o=27;o<=702;)r=o-27,i=r%26,n=Math.floor(r/26),e=this._dictionary[n]+this._dictionary[i],this._n2l[o]=e,this._l2n[e]=o,o++;this._l2nFill=2}if(this._l2nFill<3&&t>=3){for(o=703;o<=16384;)r=o-703,i=r%26,n=Math.floor(r/26)%26,s=Math.floor(r/676),e=this._dictionary[s]+this._dictionary[n]+this._dictionary[i],this._n2l[o]=e,this._l2n[e]=o,o++;this._l2nFill=3}},l2n(t){if(this._l2n[t]||this._fill(t.length),!this._l2n[t])throw new Error(`Out of bounds. Invalid column letter: ${t}`);return this._l2n[t]},n2l(t){if(t<1||t>16384)throw new Error(`${t} is out of bounds. Excel supports columns from 1 to 16384`);return this._n2l[t]||this._fill(this._level(t)),this._n2l[t]},_hash:{},validateAddress(t){if(!$v.test(t))throw new Error(`Invalid Address: ${t}`);return!0},decodeAddress(t){const e=t.length<5&&this._hash[t];if(e)return e;let r=!1,i="",n=0,s=!1,o="",a=0;for(let e,l=0;l<t.length;l++)if(e=t.charCodeAt(l),!s&&e>=65&&e<=90)r=!0,i+=t[l],n=26*n+e-64;else if(e>=48&&e<=57)s=!0,o+=t[l],a=10*a+e-48;else if(s&&r&&36!==e)break;if(r){if(n>16384)throw new Error(`Out of bounds. Invalid column letter: ${i}`)}else n=void 0;s||(a=void 0);const l={address:t=i+o,col:n,row:a,$col$row:`$${i}$${o}`};return n<=100&&a<=100&&(this._hash[t]=l,this._hash[l.$col$row]=l),l},getAddress(t,e){if(e){const r=this.n2l(e)+t;return this.decodeAddress(r)}return this.decodeAddress(t)},decode(t){const e=t.split(":");if(2===e.length){const t=this.decodeAddress(e[0]),r=this.decodeAddress(e[1]),i={top:Math.min(t.row,r.row),left:Math.min(t.col,r.col),bottom:Math.max(t.row,r.row),right:Math.max(t.col,r.col)};return i.tl=this.n2l(i.left)+i.top,i.br=this.n2l(i.right)+i.bottom,i.dimensions=`${i.tl}:${i.br}`,i}return this.decodeAddress(t)},decodeEx(t){const e=t.match(/(?:(?:(?:'((?:[^']|'')*)')|([^'^ !]*))!)?(.*)/),r=e[1]||e[2],i=e[3],n=i.split(":");if(n.length>1){let t=this.decodeAddress(n[0]),e=this.decodeAddress(n[1]);const i=Math.min(t.row,e.row),s=Math.min(t.col,e.col),o=Math.max(t.row,e.row),a=Math.max(t.col,e.col);return t=this.n2l(s)+i,e=this.n2l(a)+o,{top:i,left:s,bottom:o,right:a,sheetName:r,tl:{address:t,col:s,row:i,$col$row:`$${this.n2l(s)}$${i}`,sheetName:r},br:{address:e,col:a,row:o,$col$row:`$${this.n2l(a)}$${o}`,sheetName:r},dimensions:`${t}:${e}`}}if(i.startsWith("#"))return r?{sheetName:r,error:i}:{error:i};const s=this.decodeAddress(i);return r?{sheetName:r,...s}:s},encodeAddress:(t,e)=>Vv.n2l(e)+t,encode(){switch(arguments.length){case 2:return Vv.encodeAddress(arguments[0],arguments[1]);case 4:return`${Vv.encodeAddress(arguments[0],arguments[1])}:${Vv.encodeAddress(arguments[2],arguments[3])}`;default:throw new Error("Can only encode with 2 or 4 arguments")}},inRange(t,e){const[r,i,,n,s]=t,[o,a]=e;return o>=r&&o<=n&&a>=i&&a<=s}};var Gv=Vv;const Xv=Gv;var Yv=class t{constructor(){this.decode(arguments)}setTLBR(t,e,r,i,n){if(arguments.length<4){const i=Xv.decodeAddress(t),s=Xv.decodeAddress(e);this.model={top:Math.min(i.row,s.row),left:Math.min(i.col,s.col),bottom:Math.max(i.row,s.row),right:Math.max(i.col,s.col),sheetName:r},this.setTLBR(i.row,i.col,s.row,s.col,n)}else this.model={top:Math.min(t,r),left:Math.min(e,i),bottom:Math.max(t,r),right:Math.max(e,i),sheetName:n}}decode(e){switch(e.length){case 5:this.setTLBR(e[0],e[1],e[2],e[3],e[4]);break;case 4:this.setTLBR(e[0],e[1],e[2],e[3]);break;case 3:this.setTLBR(e[0],e[1],e[2]);break;case 2:this.setTLBR(e[0],e[1]);break;case 1:{const r=e[0];if(r instanceof t)this.model={top:r.model.top,left:r.model.left,bottom:r.model.bottom,right:r.model.right,sheetName:r.sheetName};else if(r instanceof Array)this.decode(r);else if(r.top&&r.left&&r.bottom&&r.right)this.model={top:r.top,left:r.left,bottom:r.bottom,right:r.right,sheetName:r.sheetName};else{const t=Xv.decodeEx(r);t.top?this.model={top:t.top,left:t.left,bottom:t.bottom,right:t.right,sheetName:t.sheetName}:this.model={top:t.row,left:t.col,bottom:t.row,right:t.col,sheetName:t.sheetName}}break}case 0:this.model={top:0,left:0,bottom:0,right:0};break;default:throw new Error(`Invalid number of arguments to _getDimensions() - ${e.length}`)}}get top(){return this.model.top||1}set top(t){this.model.top=t}get left(){return this.model.left||1}set left(t){this.model.left=t}get bottom(){return this.model.bottom||1}set bottom(t){this.model.bottom=t}get right(){return this.model.right||1}set right(t){this.model.right=t}get sheetName(){return this.model.sheetName}set sheetName(t){this.model.sheetName=t}get _serialisedSheetName(){const{sheetName:t}=this.model;return t?/^[a-zA-Z0-9]*$/.test(t)?`${t}!`:`'${t}'!`:""}expand(t,e,r,i){(!this.model.top||t<this.top)&&(this.top=t),(!this.model.left||e<this.left)&&(this.left=e),(!this.model.bottom||r>this.bottom)&&(this.bottom=r),(!this.model.right||i>this.right)&&(this.right=i)}expandRow(t){if(t){const{dimensions:e,number:r}=t;e&&this.expand(r,e.min,r,e.max)}}expandToAddress(t){const e=Xv.decodeEx(t);this.expand(e.row,e.col,e.row,e.col)}get tl(){return Xv.n2l(this.left)+this.top}get $t$l(){return`$${Xv.n2l(this.left)}$${this.top}`}get br(){return Xv.n2l(this.right)+this.bottom}get $b$r(){return`$${Xv.n2l(this.right)}$${this.bottom}`}get range(){return`${this._serialisedSheetName+this.tl}:${this.br}`}get $range(){return`${this._serialisedSheetName+this.$t$l}:${this.$b$r}`}get shortRange(){return this.count>1?this.range:this._serialisedSheetName+this.tl}get $shortRange(){return this.count>1?this.$range:this._serialisedSheetName+this.$t$l}get count(){return(1+this.bottom-this.top)*(1+this.right-this.left)}toString(){return this.range}intersects(t){return(!t.sheetName||!this.sheetName||t.sheetName===this.sheetName)&&(!(t.bottom<this.top)&&(!(t.top>this.bottom)&&(!(t.right<this.left)&&!(t.left>this.right))))}contains(t){const e=Xv.decodeEx(t);return this.containsEx(e)}containsEx(t){return(!t.sheetName||!this.sheetName||t.sheetName===this.sheetName)&&(t.row>=this.top&&t.row<=this.bottom&&t.col>=this.left&&t.col<=this.right)}forEachAddress(t){for(let e=this.left;e<=this.right;e++)for(let r=this.top;r<=this.bottom;r++)t(Xv.encodeAddress(r,e),r,e)}},qv={ValueType:{Null:0,Merge:1,Number:2,String:3,Date:4,Hyperlink:5,Formula:6,SharedString:7,RichText:8,Boolean:9,Error:10},FormulaType:{None:0,Master:1,Shared:2},RelationshipType:{None:0,OfficeDocument:1,Worksheet:2,CalcChain:3,SharedStrings:4,Styles:5,Theme:6,Hyperlink:7},DocumentType:{Xlsx:1},ReadingOrder:{LeftToRight:1,RightToLeft:2},ErrorValue:{NotApplicable:"#N/A",Ref:"#REF!",Name:"#NAME?",DivZero:"#DIV/0!",Null:"#NULL!",Value:"#VALUE!",Num:"#NUM!"}};const Zv=Gv,Kv=/(([a-z_\-0-9]*)!)?([a-z0-9_$]{2,})([(])?/gi,Qv=/^([$])?([a-z]+)([$])?([1-9][0-9]*)$/i;var Jv={slideFormula:function(t,e,r){const i=Zv.decode(e),n=Zv.decode(r);return t.replace(Kv,((t,e,r,s,o)=>{if(o)return t;const a=Qv.exec(s);if(a){const r=a[1],s=a[2].toUpperCase(),o=a[3],l=a[4];if(s.length>3||3===s.length&&s>"XFD")return t;let h=Zv.l2n(s),c=parseInt(l,10);r||(h+=n.col-i.col),o||(c+=n.row-i.row);return(e||"")+(r||"")+Zv.n2l(h)+(o||"")+c}return t}))}};const tb=Uv;let eb=class t{constructor(t){this.note=t}get model(){let e=null;if("string"==typeof this.note)e={type:"note",note:{texts:[{text:this.note}]}};else e={type:"note",note:this.note};return tb.deepMerge({},t.DEFAULT_CONFIGS,e)}set model(t){const{note:e}=t,{texts:r}=e;1===r.length&&1===Object.keys(r[0]).length?this.note=r[0].text:this.note=e}static fromModel(e){const r=new t;return r.model=e,r}};eb.DEFAULT_CONFIGS={note:{margins:{insetmode:"auto",inset:[.13,.13,.25,.25]},protection:{locked:"True",lockText:"True"},editAs:"absolute"}};var rb=eb;const ib=Gv,nb=Uv,sb=qv,{slideFormula:ob}=Jv,ab=rb;let lb=class t{constructor(e,r,i){if(!e||!r)throw new Error("A Cell needs a Row");this._row=e,this._column=r,ib.validateAddress(i),this._address=i,this._value=hb.create(t.Types.Null,this),this.style=this._mergeStyle(e.style,r.style,{}),this._mergeCount=0}get worksheet(){return this._row.worksheet}get workbook(){return this._row.worksheet.workbook}destroy(){delete this.style,delete this._value,delete this._row,delete this._column,delete this._address}get numFmt(){return this.style.numFmt}set numFmt(t){this.style.numFmt=t}get font(){return this.style.font}set font(t){this.style.font=t}get alignment(){return this.style.alignment}set alignment(t){this.style.alignment=t}get border(){return this.style.border}set border(t){this.style.border=t}get fill(){return this.style.fill}set fill(t){this.style.fill=t}get protection(){return this.style.protection}set protection(t){this.style.protection=t}_mergeStyle(t,e,r){const i=t&&t.numFmt||e&&e.numFmt;i&&(r.numFmt=i);const n=t&&t.font||e&&e.font;n&&(r.font=n);const s=t&&t.alignment||e&&e.alignment;s&&(r.alignment=s);const o=t&&t.border||e&&e.border;o&&(r.border=o);const a=t&&t.fill||e&&e.fill;a&&(r.fill=a);const l=t&&t.protection||e&&e.protection;return l&&(r.protection=l),r}get address(){return this._address}get row(){return this._row.number}get col(){return this._column.number}get $col$row(){return`$${this._column.letter}$${this.row}`}get type(){return this._value.type}get effectiveType(){return this._value.effectiveType}toCsvString(){return this._value.toCsvString()}addMergeRef(){this._mergeCount++}releaseMergeRef(){this._mergeCount--}get isMerged(){return this._mergeCount>0||this.type===t.Types.Merge}merge(e,r){this._value.release(),this._value=hb.create(t.Types.Merge,this,e),r||(this.style=e.style)}unmerge(){this.type===t.Types.Merge&&(this._value.release(),this._value=hb.create(t.Types.Null,this),this.style=this._mergeStyle(this._row.style,this._column.style,{}))}isMergedTo(e){return this._value.type===t.Types.Merge&&this._value.isMergedTo(e)}get master(){return this.type===t.Types.Merge?this._value.master:this}get isHyperlink(){return this._value.type===t.Types.Hyperlink}get hyperlink(){return this._value.hyperlink}get value(){return this._value.value}set value(e){this.type!==t.Types.Merge?(this._value.release(),this._value=hb.create(hb.getType(e),this,e)):this._value.master.value=e}get note(){return this._comment&&this._comment.note}set note(t){this._comment=new ab(t)}get text(){return this._value.toString()}get html(){return nb.escapeHtml(this.text)}toString(){return this.text}_upgradeToHyperlink(e){this.type===t.Types.String&&(this._value=hb.create(t.Types.Hyperlink,this,{text:this._value.value,hyperlink:e}))}get formula(){return this._value.formula}get result(){return this._value.result}get formulaType(){return this._value.formulaType}get fullAddress(){const{worksheet:t}=this._row;return{sheetName:t.name,address:this.address,row:this.row,col:this.col}}get name(){return this.names[0]}set name(t){this.names=[t]}get names(){return this.workbook.definedNames.getNamesEx(this.fullAddress)}set names(t){const{definedNames:e}=this.workbook;e.removeAllNames(this.fullAddress),t.forEach((t=>{e.addEx(this.fullAddress,t)}))}addName(t){this.workbook.definedNames.addEx(this.fullAddress,t)}removeName(t){this.workbook.definedNames.removeEx(this.fullAddress,t)}removeAllNames(){this.workbook.definedNames.removeAllNames(this.fullAddress)}get _dataValidations(){return this.worksheet.dataValidations}get dataValidation(){return this._dataValidations.find(this.address)}set dataValidation(t){this._dataValidations.add(this.address,t)}get model(){const{model:t}=this._value;return t.style=this.style,this._comment&&(t.comment=this._comment.model),t}set model(t){if(this._value.release(),this._value=hb.create(t.type,this),this._value.model=t,t.comment&&"note"===t.comment.type)this._comment=ab.fromModel(t.comment);t.style?this.style=t.style:this.style={}}};lb.Types=sb.ValueType;const hb={getType:t=>null==t?lb.Types.Null:t instanceof String||"string"==typeof t?lb.Types.String:"number"==typeof t?lb.Types.Number:"boolean"==typeof t?lb.Types.Boolean:t instanceof Date?lb.Types.Date:t.text&&t.hyperlink?lb.Types.Hyperlink:t.formula||t.sharedFormula?lb.Types.Formula:t.richText?lb.Types.RichText:t.sharedString?lb.Types.SharedString:t.error?lb.Types.Error:lb.Types.JSON,types:[{t:lb.Types.Null,f:class{constructor(t){this.model={address:t.address,type:lb.Types.Null}}get value(){return null}set value(t){}get type(){return lb.Types.Null}get effectiveType(){return lb.Types.Null}get address(){return this.model.address}set address(t){this.model.address=t}toCsvString(){return""}release(){}toString(){return""}}},{t:lb.Types.Number,f:class{constructor(t,e){this.model={address:t.address,type:lb.Types.Number,value:e}}get value(){return this.model.value}set value(t){this.model.value=t}get type(){return lb.Types.Number}get effectiveType(){return lb.Types.Number}get address(){return this.model.address}set address(t){this.model.address=t}toCsvString(){return this.model.value.toString()}release(){}toString(){return this.model.value.toString()}}},{t:lb.Types.String,f:class{constructor(t,e){this.model={address:t.address,type:lb.Types.String,value:e}}get value(){return this.model.value}set value(t){this.model.value=t}get type(){return lb.Types.String}get effectiveType(){return lb.Types.String}get address(){return this.model.address}set address(t){this.model.address=t}toCsvString(){return`"${this.model.value.replace(/"/g,'""')}"`}release(){}toString(){return this.model.value}}},{t:lb.Types.Date,f:class{constructor(t,e){this.model={address:t.address,type:lb.Types.Date,value:e}}get value(){return this.model.value}set value(t){this.model.value=t}get type(){return lb.Types.Date}get effectiveType(){return lb.Types.Date}get address(){return this.model.address}set address(t){this.model.address=t}toCsvString(){return this.model.value.toISOString()}release(){}toString(){return this.model.value.toString()}}},{t:lb.Types.Hyperlink,f:class{constructor(t,e){this.model={address:t.address,type:lb.Types.Hyperlink,text:e?e.text:void 0,hyperlink:e?e.hyperlink:void 0},e&&e.tooltip&&(this.model.tooltip=e.tooltip)}get value(){const t={text:this.model.text,hyperlink:this.model.hyperlink};return this.model.tooltip&&(t.tooltip=this.model.tooltip),t}set value(t){this.model={text:t.text,hyperlink:t.hyperlink},t.tooltip&&(this.model.tooltip=t.tooltip)}get text(){return this.model.text}set text(t){this.model.text=t}get hyperlink(){return this.model.hyperlink}set hyperlink(t){this.model.hyperlink=t}get type(){return lb.Types.Hyperlink}get effectiveType(){return lb.Types.Hyperlink}get address(){return this.model.address}set address(t){this.model.address=t}toCsvString(){return this.model.hyperlink}release(){}toString(){return this.model.text}}},{t:lb.Types.Formula,f:class{constructor(t,e){this.cell=t,this.model={address:t.address,type:lb.Types.Formula,shareType:e?e.shareType:void 0,ref:e?e.ref:void 0,formula:e?e.formula:void 0,sharedFormula:e?e.sharedFormula:void 0,result:e?e.result:void 0}}_copyModel(t){const e={},r=r=>{const i=t[r];i&&(e[r]=i)};return r("formula"),r("result"),r("ref"),r("shareType"),r("sharedFormula"),e}get value(){return this._copyModel(this.model)}set value(t){this.model=this._copyModel(t)}validate(t){switch(hb.getType(t)){case lb.Types.Null:case lb.Types.String:case lb.Types.Number:case lb.Types.Date:break;case lb.Types.Hyperlink:case lb.Types.Formula:default:throw new Error("Cannot process that type of result value")}}get dependencies(){return{ranges:this.formula.match(/([a-zA-Z0-9]+!)?[A-Z]{1,3}\d{1,4}:[A-Z]{1,3}\d{1,4}/g),cells:this.formula.replace(/([a-zA-Z0-9]+!)?[A-Z]{1,3}\d{1,4}:[A-Z]{1,3}\d{1,4}/g,"").match(/([a-zA-Z0-9]+!)?[A-Z]{1,3}\d{1,4}/g)}}get formula(){return this.model.formula||this._getTranslatedFormula()}set formula(t){this.model.formula=t}get formulaType(){return this.model.formula?sb.FormulaType.Master:this.model.sharedFormula?sb.FormulaType.Shared:sb.FormulaType.None}get result(){return this.model.result}set result(t){this.model.result=t}get type(){return lb.Types.Formula}get effectiveType(){const t=this.model.result;return null==t?sb.ValueType.Null:t instanceof String||"string"==typeof t?sb.ValueType.String:"number"==typeof t?sb.ValueType.Number:t instanceof Date?sb.ValueType.Date:t.text&&t.hyperlink?sb.ValueType.Hyperlink:t.formula?sb.ValueType.Formula:sb.ValueType.Null}get address(){return this.model.address}set address(t){this.model.address=t}_getTranslatedFormula(){if(!this._translatedFormula&&this.model.sharedFormula){const{worksheet:t}=this.cell,e=t.findCell(this.model.sharedFormula);this._translatedFormula=e&&ob(e.formula,e.address,this.model.address)}return this._translatedFormula}toCsvString(){return`${this.model.result||""}`}release(){}toString(){return this.model.result?this.model.result.toString():""}}},{t:lb.Types.Merge,f:class{constructor(t,e){this.model={address:t.address,type:lb.Types.Merge,master:e?e.address:void 0},this._master=e,e&&e.addMergeRef()}get value(){return this._master.value}set value(t){t instanceof lb?(this._master&&this._master.releaseMergeRef(),t.addMergeRef(),this._master=t):this._master.value=t}isMergedTo(t){return t===this._master}get master(){return this._master}get type(){return lb.Types.Merge}get effectiveType(){return this._master.effectiveType}get address(){return this.model.address}set address(t){this.model.address=t}toCsvString(){return""}release(){this._master.releaseMergeRef()}toString(){return this.value.toString()}}},{t:lb.Types.JSON,f:class{constructor(t,e){this.model={address:t.address,type:lb.Types.String,value:JSON.stringify(e),rawValue:e}}get value(){return this.model.rawValue}set value(t){this.model.rawValue=t,this.model.value=JSON.stringify(t)}get type(){return lb.Types.String}get effectiveType(){return lb.Types.String}get address(){return this.model.address}set address(t){this.model.address=t}toCsvString(){return this.model.value}release(){}toString(){return this.model.value}}},{t:lb.Types.SharedString,f:class{constructor(t,e){this.model={address:t.address,type:lb.Types.SharedString,value:e}}get value(){return this.model.value}set value(t){this.model.value=t}get type(){return lb.Types.SharedString}get effectiveType(){return lb.Types.SharedString}get address(){return this.model.address}set address(t){this.model.address=t}toCsvString(){return this.model.value.toString()}release(){}toString(){return this.model.value.toString()}}},{t:lb.Types.RichText,f:class{constructor(t,e){this.model={address:t.address,type:lb.Types.String,value:e}}get value(){return this.model.value}set value(t){this.model.value=t}toString(){return this.model.value.richText.map((t=>t.text)).join("")}get type(){return lb.Types.RichText}get effectiveType(){return lb.Types.RichText}get address(){return this.model.address}set address(t){this.model.address=t}toCsvString(){return`"${this.text.replace(/"/g,'""')}"`}release(){}}},{t:lb.Types.Boolean,f:class{constructor(t,e){this.model={address:t.address,type:lb.Types.Boolean,value:e}}get value(){return this.model.value}set value(t){this.model.value=t}get type(){return lb.Types.Boolean}get effectiveType(){return lb.Types.Boolean}get address(){return this.model.address}set address(t){this.model.address=t}toCsvString(){return this.model.value?1:0}release(){}toString(){return this.model.value.toString()}}},{t:lb.Types.Error,f:class{constructor(t,e){this.model={address:t.address,type:lb.Types.Error,value:e}}get value(){return this.model.value}set value(t){this.model.value=t}get type(){return lb.Types.Error}get effectiveType(){return lb.Types.Error}get address(){return this.model.address}set address(t){this.model.address=t}toCsvString(){return this.toString()}release(){}toString(){return this.model.value.error.toString()}}}].reduce(((t,e)=>(t[e.t]=e.f,t)),[]),create(t,e,r){const i=this.types[t];if(!i)throw new Error(`Could not create Value of type ${t}`);return new i(e,r)}};const cb=Uv,ub=qv,db=Gv,pb=lb;var fb=class{constructor(t,e){this._worksheet=t,this._number=e,this._cells=[],this.style={},this.outlineLevel=0}get number(){return this._number}get worksheet(){return this._worksheet}commit(){this._worksheet._commitRow(this)}destroy(){delete this._worksheet,delete this._cells,delete this.style}findCell(t){return this._cells[t-1]}getCellEx(t){let e=this._cells[t.col-1];if(!e){const r=this._worksheet.getColumn(t.col);e=new pb(this,r,t.address),this._cells[t.col-1]=e}return e}getCell(t){if("string"==typeof t){const e=this._worksheet.getColumnKey(t);t=e?e.number:db.l2n(t)}return this._cells[t-1]||this.getCellEx({address:db.encodeAddress(this._number,t),row:this._number,col:t})}splice(t,e,...r){const i=t+e,n=r.length-e,s=this._cells.length;let o,a,l;if(n<0)for(o=t+r.length;o<=s;o++)l=this._cells[o-1],a=this._cells[o-n-1],a?(l=this.getCell(o),l.value=a.value,l.style=a.style,l._comment=a._comment):l&&(l.value=null,l.style={},l._comment=void 0);else if(n>0)for(o=s;o>=i;o--)a=this._cells[o-1],a?(l=this.getCell(o+n),l.value=a.value,l.style=a.style,l._comment=a._comment):this._cells[o+n-1]=void 0;for(o=0;o<r.length;o++)l=this.getCell(t+o),l.value=r[o],l.style={},l._comment=void 0}eachCell(t,e){if(e||(e=t,t=null),t&&t.includeEmpty){const t=this._cells.length;for(let r=1;r<=t;r++)e(this.getCell(r),r)}else this._cells.forEach(((t,r)=>{t&&t.type!==ub.ValueType.Null&&e(t,r+1)}))}addPageBreak(t,e){const r=this._worksheet,i=Math.max(0,t-1)||0,n=Math.max(0,e-1)||16838,s={id:this._number,max:n,man:1};i&&(s.min=i),r.rowBreaks.push(s)}get values(){const t=[];return this._cells.forEach((e=>{e&&e.type!==ub.ValueType.Null&&(t[e.col]=e.value)})),t}set values(t){if(this._cells=[],t)if(t instanceof Array){let e=0;t.hasOwnProperty("0")&&(e=1),t.forEach(((t,r)=>{void 0!==t&&(this.getCellEx({address:db.encodeAddress(this._number,r+e),row:this._number,col:r+e}).value=t)}))}else this._worksheet.eachColumnKey(((e,r)=>{void 0!==t[r]&&(this.getCellEx({address:db.encodeAddress(this._number,e.number),row:this._number,col:e.number}).value=t[r])}));else;}get hasValues(){return cb.some(this._cells,(t=>t&&t.type!==ub.ValueType.Null))}get cellCount(){return this._cells.length}get actualCellCount(){let t=0;return this.eachCell((()=>{t++})),t}get dimensions(){let t=0,e=0;return this._cells.forEach((r=>{r&&r.type!==ub.ValueType.Null&&((!t||t>r.col)&&(t=r.col),e<r.col&&(e=r.col))})),t>0?{min:t,max:e}:null}_applyStyle(t,e){return this.style[t]=e,this._cells.forEach((r=>{r&&(r[t]=e)})),e}get numFmt(){return this.style.numFmt}set numFmt(t){this._applyStyle("numFmt",t)}get font(){return this.style.font}set font(t){this._applyStyle("font",t)}get alignment(){return this.style.alignment}set alignment(t){this._applyStyle("alignment",t)}get protection(){return this.style.protection}set protection(t){this._applyStyle("protection",t)}get border(){return this.style.border}set border(t){this._applyStyle("border",t)}get fill(){return this.style.fill}set fill(t){this._applyStyle("fill",t)}get hidden(){return!!this._hidden}set hidden(t){this._hidden=t}get outlineLevel(){return this._outlineLevel||0}set outlineLevel(t){this._outlineLevel=t}get collapsed(){return!!(this._outlineLevel&&this._outlineLevel>=this._worksheet.properties.outlineLevelRow)}get model(){const t=[];let e=0,r=0;return this._cells.forEach((i=>{if(i){const n=i.model;n&&((!e||e>i.col)&&(e=i.col),r<i.col&&(r=i.col),t.push(n))}})),this.height||t.length?{cells:t,number:this.number,min:e,max:r,height:this.height,style:this.style,hidden:this.hidden,outlineLevel:this.outlineLevel,collapsed:this.collapsed}:null}set model(t){if(t.number!==this._number)throw new Error("Invalid row number in model");let e;this._cells=[],t.cells.forEach((t=>{switch(t.type){case pb.Types.Merge:break;default:{let r;if(t.address)r=db.decodeAddress(t.address);else if(e){const{row:t}=e,i=e.col+1;r={row:t,col:i,address:db.encodeAddress(t,i),$col$row:`$${db.n2l(i)}$${t}`}}e=r;this.getCellEx(r).model=t;break}}})),t.height?this.height=t.height:delete this.height,this.hidden=t.hidden,this.outlineLevel=t.outlineLevel||0,this.style=t.style&&JSON.parse(JSON.stringify(t.style))||{}}};const gb=Uv,mb=qv,yb=Gv;var vb=class t{constructor(t,e,r){this._worksheet=t,this._number=e,!1!==r&&(this.defn=r)}get number(){return this._number}get worksheet(){return this._worksheet}get letter(){return yb.n2l(this._number)}get isCustomWidth(){return void 0!==this.width&&9!==this.width}get defn(){return{header:this._header,key:this.key,width:this.width,style:this.style,hidden:this.hidden,outlineLevel:this.outlineLevel}}set defn(t){t?(this.key=t.key,this.width=void 0!==t.width?t.width:9,this.outlineLevel=t.outlineLevel,t.style?this.style=t.style:this.style={},this.header=t.header,this._hidden=!!t.hidden):(delete this._header,delete this._key,delete this.width,this.style={},this.outlineLevel=0)}get headers(){return this._header&&this._header instanceof Array?this._header:[this._header]}get header(){return this._header}set header(t){void 0!==t?(this._header=t,this.headers.forEach(((t,e)=>{this._worksheet.getCell(e+1,this.number).value=t}))):this._header=void 0}get key(){return this._key}set key(t){(this._key&&this._worksheet.getColumnKey(this._key))===this&&this._worksheet.deleteColumnKey(this._key),this._key=t,t&&this._worksheet.setColumnKey(this._key,this)}get hidden(){return!!this._hidden}set hidden(t){this._hidden=t}get outlineLevel(){return this._outlineLevel||0}set outlineLevel(t){this._outlineLevel=t}get collapsed(){return!!(this._outlineLevel&&this._outlineLevel>=this._worksheet.properties.outlineLevelCol)}toString(){return JSON.stringify({key:this.key,width:this.width,headers:this.headers.length?this.headers:void 0})}equivalentTo(t){return this.width===t.width&&this.hidden===t.hidden&&this.outlineLevel===t.outlineLevel&&gb.isEqual(this.style,t.style)}get isDefault(){if(this.isCustomWidth)return!1;if(this.hidden)return!1;if(this.outlineLevel)return!1;const t=this.style;return!t||!(t.font||t.numFmt||t.alignment||t.border||t.fill||t.protection)}get headerCount(){return this.headers.length}eachCell(t,e){const r=this.number;e||(e=t,t=null),this._worksheet.eachRow(t,((t,i)=>{e(t.getCell(r),i)}))}get values(){const t=[];return this.eachCell(((e,r)=>{e&&e.type!==mb.ValueType.Null&&(t[r]=e.value)})),t}set values(t){if(!t)return;const e=this.number;let r=0;t.hasOwnProperty("0")&&(r=1),t.forEach(((t,i)=>{this._worksheet.getCell(i+r,e).value=t}))}_applyStyle(t,e){return this.style[t]=e,this.eachCell((r=>{r[t]=e})),e}get numFmt(){return this.style.numFmt}set numFmt(t){this._applyStyle("numFmt",t)}get font(){return this.style.font}set font(t){this._applyStyle("font",t)}get alignment(){return this.style.alignment}set alignment(t){this._applyStyle("alignment",t)}get protection(){return this.style.protection}set protection(t){this._applyStyle("protection",t)}get border(){return this.style.border}set border(t){this._applyStyle("border",t)}get fill(){return this.style.fill}set fill(t){this._applyStyle("fill",t)}static toModel(t){const e=[];let r=null;return t&&t.forEach(((t,i)=>{t.isDefault?r&&(r=null):r&&t.equivalentTo(r)?r.max=i+1:(r={min:i+1,max:i+1,width:void 0!==t.width?t.width:9,style:t.style,isCustomWidth:t.isCustomWidth,hidden:t.hidden,outlineLevel:t.outlineLevel,collapsed:t.collapsed},e.push(r))})),e.length?e:void 0}static fromModel(e,r){const i=[];let n=1,s=0;for(r=(r=r||[]).sort((function(t,e){return t.min-e.min}));s<r.length;){const o=r[s++];for(;n<o.min;)i.push(new t(e,n++));for(;n<=o.max;)i.push(new t(e,n++,o))}return i.length?i:null}};const bb=Gv;var _b=class t{constructor(t,e,r=0){if(this.worksheet=t,e)if("string"==typeof e){const t=bb.decodeAddress(e);this.nativeCol=t.col+r,this.nativeColOff=0,this.nativeRow=t.row+r,this.nativeRowOff=0}else void 0!==e.nativeCol?(this.nativeCol=e.nativeCol||0,this.nativeColOff=e.nativeColOff||0,this.nativeRow=e.nativeRow||0,this.nativeRowOff=e.nativeRowOff||0):void 0!==e.col?(this.col=e.col+r,this.row=e.row+r):(this.nativeCol=0,this.nativeColOff=0,this.nativeRow=0,this.nativeRowOff=0);else this.nativeCol=0,this.nativeColOff=0,this.nativeRow=0,this.nativeRowOff=0}static asInstance(e){return e instanceof t||null==e?e:new t(e)}get col(){return this.nativeCol+Math.min(this.colWidth-1,this.nativeColOff)/this.colWidth}set col(t){this.nativeCol=Math.floor(t),this.nativeColOff=Math.floor((t-this.nativeCol)*this.colWidth)}get row(){return this.nativeRow+Math.min(this.rowHeight-1,this.nativeRowOff)/this.rowHeight}set row(t){this.nativeRow=Math.floor(t),this.nativeRowOff=Math.floor((t-this.nativeRow)*this.rowHeight)}get colWidth(){return this.worksheet&&this.worksheet.getColumn(this.nativeCol+1)&&this.worksheet.getColumn(this.nativeCol+1).isCustomWidth?Math.floor(1e4*this.worksheet.getColumn(this.nativeCol+1).width):64e4}get rowHeight(){return this.worksheet&&this.worksheet.getRow(this.nativeRow+1)&&this.worksheet.getRow(this.nativeRow+1).height?Math.floor(1e4*this.worksheet.getRow(this.nativeRow+1).height):18e4}get model(){return{nativeCol:this.nativeCol,nativeColOff:this.nativeColOff,nativeRow:this.nativeRow,nativeRowOff:this.nativeRowOff}}set model(t){this.nativeCol=t.nativeCol,this.nativeColOff=t.nativeColOff,this.nativeRow=t.nativeRow,this.nativeRowOff=t.nativeRowOff}};const wb=Gv,xb=_b;var Sb=class{constructor(t,e){this.worksheet=t,this.model=e}get model(){switch(this.type){case"background":return{type:this.type,imageId:this.imageId};case"image":return{type:this.type,imageId:this.imageId,hyperlinks:this.range.hyperlinks,range:{tl:this.range.tl.model,br:this.range.br&&this.range.br.model,ext:this.range.ext,editAs:this.range.editAs}};default:throw new Error("Invalid Image Type")}}set model({type:t,imageId:e,range:r,hyperlinks:i}){if(this.type=t,this.imageId=e,"image"===t)if("string"==typeof r){const t=wb.decode(r);this.range={tl:new xb(this.worksheet,{col:t.left,row:t.top},-1),br:new xb(this.worksheet,{col:t.right,row:t.bottom},0),editAs:"oneCell"}}else this.range={tl:new xb(this.worksheet,r.tl,0),br:r.br&&new xb(this.worksheet,r.br,0),ext:r.ext,editAs:r.editAs,hyperlinks:i||r.hyperlinks}}};const Tb=Gv;var kb=class{constructor(t,e){this.worksheet=t,e&&(this.table=e,this.validate(),this.store())}getFormula(t){switch(t.totalsRowFunction){case"none":return null;case"average":return`SUBTOTAL(101,${this.table.name}[${t.name}])`;case"countNums":return`SUBTOTAL(102,${this.table.name}[${t.name}])`;case"count":return`SUBTOTAL(103,${this.table.name}[${t.name}])`;case"max":return`SUBTOTAL(104,${this.table.name}[${t.name}])`;case"min":return`SUBTOTAL(105,${this.table.name}[${t.name}])`;case"stdDev":return`SUBTOTAL(106,${this.table.name}[${t.name}])`;case"var":return`SUBTOTAL(107,${this.table.name}[${t.name}])`;case"sum":return`SUBTOTAL(109,${this.table.name}[${t.name}])`;case"custom":return t.totalsRowFormula;default:throw new Error(`Invalid Totals Row Function: ${t.totalsRowFunction}`)}}get width(){return this.table.columns.length}get height(){return this.table.rows.length}get filterHeight(){return this.height+(this.table.headerRow?1:0)}get tableHeight(){return this.filterHeight+(this.table.totalsRow?1:0)}validate(){const{table:t}=this,e=(t,e,r)=>{void 0===t[e]&&(t[e]=r)};e(t,"headerRow",!0),e(t,"totalsRow",!1),e(t,"style",{}),e(t.style,"theme","TableStyleMedium2"),e(t.style,"showFirstColumn",!1),e(t.style,"showLastColumn",!1),e(t.style,"showRowStripes",!1),e(t.style,"showColumnStripes",!1);const r=(t,e)=>{if(!t)throw new Error(e)};r(t.ref,"Table must have ref"),r(t.columns,"Table must have column definitions"),r(t.rows,"Table must have row definitions"),t.tl=Tb.decodeAddress(t.ref);const{row:i,col:n}=t.tl;r(i>0,"Table must be on valid row"),r(n>0,"Table must be on valid col");const{width:s,filterHeight:o,tableHeight:a}=this;t.autoFilterRef=Tb.encode(i,n,i+o-1,n+s-1),t.tableRef=Tb.encode(i,n,i+a-1,n+s-1),t.columns.forEach(((t,i)=>{r(t.name,`Column ${i} must have a name`),0===i?e(t,"totalsRowLabel","Total"):(e(t,"totalsRowFunction","none"),t.totalsRowFormula=this.getFormula(t))}))}store(){const t=(t,e)=>{e&&Object.keys(e).forEach((r=>{t[r]=e[r]}))},{worksheet:e,table:r}=this,{row:i,col:n}=r.tl;let s=0;if(r.headerRow){const o=e.getRow(i+s++);r.columns.forEach(((e,r)=>{const{style:i,name:s}=e,a=o.getCell(n+r);a.value=s,t(a,i)}))}if(r.rows.forEach((o=>{const a=e.getRow(i+s++);o.forEach(((e,i)=>{const s=a.getCell(n+i);s.value=e,t(s,r.columns[i].style)}))})),r.totalsRow){const o=e.getRow(i+s++);r.columns.forEach(((e,r)=>{const i=o.getCell(n+r);if(0===r)i.value=e.totalsRowLabel;else{const t=this.getFormula(e);i.value=t?{formula:e.totalsRowFormula,result:e.totalsRowResult}:null}t(i,e.style)}))}}load(t){const{table:e}=this,{row:r,col:i}=e.tl;let n=0;if(e.headerRow){const s=t.getRow(r+n++);e.columns.forEach(((t,e)=>{s.getCell(i+e).value=t.name}))}if(e.rows.forEach((e=>{const s=t.getRow(r+n++);e.forEach(((t,e)=>{s.getCell(i+e).value=t}))})),e.totalsRow){const s=t.getRow(r+n++);e.columns.forEach(((t,e)=>{const r=s.getCell(i+e);if(0===e)r.value=t.totalsRowLabel;else{this.getFormula(t)&&(r.value={formula:t.totalsRowFormula,result:t.totalsRowResult})}}))}}get model(){return this.table}set model(t){this.table=t}cacheState(){this._cache||(this._cache={ref:this.ref,width:this.width,tableHeight:this.tableHeight})}commit(){if(!this._cache)return;this.validate();const t=Tb.decodeAddress(this._cache.ref);if(this.ref!==this._cache.ref)for(let e=0;e<this._cache.tableHeight;e++){const r=this.worksheet.getRow(t.row+e);for(let e=0;e<this._cache.width;e++){r.getCell(t.col+e).value=null}}else{for(let e=this.tableHeight;e<this._cache.tableHeight;e++){const r=this.worksheet.getRow(t.row+e);for(let e=0;e<this._cache.width;e++){r.getCell(t.col+e).value=null}}for(let e=0;e<this.tableHeight;e++){const r=this.worksheet.getRow(t.row+e);for(let e=this.width;e<this._cache.width;e++){r.getCell(t.col+e).value=null}}}this.store()}addRow(t,e){this.cacheState(),void 0===e?this.table.rows.push(t):this.table.rows.splice(e,0,t)}removeRows(t,e=1){this.cacheState(),this.table.rows.splice(t,e)}getColumn(t){const e=this.table.columns[t];return new class{constructor(t,e,r){this.table=t,this.column=e,this.index=r}_set(t,e){this.table.cacheState(),this.column[t]=e}get name(){return this.column.name}set name(t){this._set("name",t)}get filterButton(){return this.column.filterButton}set filterButton(t){this.column.filterButton=t}get style(){return this.column.style}set style(t){this.column.style=t}get totalsRowLabel(){return this.column.totalsRowLabel}set totalsRowLabel(t){this._set("totalsRowLabel",t)}get totalsRowFunction(){return this.column.totalsRowFunction}set totalsRowFunction(t){this._set("totalsRowFunction",t)}get totalsRowResult(){return this.column.totalsRowResult}set totalsRowResult(t){this._set("totalsRowResult",t)}get totalsRowFormula(){return this.column.totalsRowFormula}set totalsRowFormula(t){this._set("totalsRowFormula",t)}}(this,e,t)}addColumn(t,e,r){this.cacheState(),void 0===r?(this.table.columns.push(t),this.table.rows.forEach(((t,r)=>{t.push(e[r])}))):(this.table.columns.splice(r,0,t),this.table.rows.forEach(((t,i)=>{t.splice(r,0,e[i])})))}removeColumns(t,e=1){this.cacheState(),this.table.columns.splice(t,e),this.table.rows.forEach((r=>{r.splice(t,e)}))}_assign(t,e,r){this.cacheState(),t[e]=r}get ref(){return this.table.ref}set ref(t){this._assign(this.table,"ref",t)}get name(){return this.table.name}set name(t){this.table.name=t}get displayName(){return this.table.displyName||this.table.name}set displayNamename(t){this.table.displayName=t}get headerRow(){return this.table.headerRow}set headerRow(t){this._assign(this.table,"headerRow",t)}get totalsRow(){return this.table.totalsRow}set totalsRow(t){this._assign(this.table,"totalsRow",t)}get theme(){return this.table.style.name}set theme(t){this.table.style.name=t}get showFirstColumn(){return this.table.style.showFirstColumn}set showFirstColumn(t){this.table.style.showFirstColumn=t}get showLastColumn(){return this.table.style.showLastColumn}set showLastColumn(t){this.table.style.showLastColumn=t}get showRowStripes(){return this.table.style.showRowStripes}set showRowStripes(t){this.table.style.showRowStripes=t}get showColumnStripes(){return this.table.style.showColumnStripes}set showColumnStripes(t){this.table.style.showColumnStripes=t}};var Cb=class{constructor(t){this.model=t||{}}add(t,e){return this.model[t]=e}find(t){return this.model[t]}remove(t){this.model[t]=void 0}};const Eb=r,Ab={hash(t,...e){const r=Eb.createHash(t);return r.update(Buffer.concat(e)),r.digest()},convertPasswordToHash(t,e,r,i){e=e.toLowerCase();if(Eb.getHashes().indexOf(e)<0)throw new Error(`Hash algorithm '${e}' not supported!`);const n=Buffer.from(t,"utf16le");let s=this.hash(e,Buffer.from(r,"base64"),n);for(let t=0;t<i;t++){const r=Buffer.alloc(4);r.writeUInt32LE(t,0),s=this.hash(e,s,r)}return s.toString("base64")},randomBytes:t=>Eb.randomBytes(t)};var Ob=Ab,Bb={};const Rb=(t,e)=>({...t,...e.reduce(((e,r)=>(t[r]&&(e[r]={...t[r]}),e)),{})}),Lb=(t,e,r,i=[])=>{t[r]&&(e[r]=Rb(t[r],i))};Bb.copyStyle=t=>{if(!t)return t;if(e=t,0===Object.keys(e).length)return{};var e;const r={...t};return Lb(t,r,"font",["color"]),Lb(t,r,"alignment"),Lb(t,r,"protection"),t.border&&(Lb(t,r,"border"),Lb(t.border,r.border,"top",["color"]),Lb(t.border,r.border,"left",["color"]),Lb(t.border,r.border,"bottom",["color"]),Lb(t.border,r.border,"right",["color"]),Lb(t.border,r.border,"diagonal",["color"])),t.fill&&(Lb(t,r,"fill",["fgColor","bgColor","center"]),t.fill.stops&&(r.fill.stops=t.fill.stops.map((t=>Rb(t,["color"]))))),r};const Pb=Uv,Db=Gv,Mb=Yv,Ib=fb,Nb=vb,Fb=qv,jb=Sb,zb=kb,Hb=Cb,Wb=Ob,{copyStyle:Ub}=Bb;var $b=class{constructor(t){t=t||{},this._workbook=t.workbook,this.id=t.id,this.orderNo=t.orderNo,this.name=t.name,this.state=t.state||"visible",this._rows=[],this._columns=null,this._keys={},this._merges={},this.rowBreaks=[],this.properties=Object.assign({},{defaultRowHeight:15,dyDescent:55,outlineLevelCol:0,outlineLevelRow:0},t.properties),this.pageSetup=Object.assign({},{margins:{left:.7,right:.7,top:.75,bottom:.75,header:.3,footer:.3},orientation:"portrait",horizontalDpi:4294967295,verticalDpi:4294967295,fitToPage:!(!t.pageSetup||!t.pageSetup.fitToWidth&&!t.pageSetup.fitToHeight||t.pageSetup.scale),pageOrder:"downThenOver",blackAndWhite:!1,draft:!1,cellComments:"None",errors:"displayed",scale:100,fitToWidth:1,fitToHeight:1,paperSize:void 0,showRowColHeaders:!1,showGridLines:!1,firstPageNumber:void 0,horizontalCentered:!1,verticalCentered:!1,rowBreaks:null,colBreaks:null},t.pageSetup),this.headerFooter=Object.assign({},{differentFirst:!1,differentOddEven:!1,oddHeader:null,oddFooter:null,evenHeader:null,evenFooter:null,firstHeader:null,firstFooter:null},t.headerFooter),this.dataValidations=new Hb,this.views=t.views||[],this.autoFilter=t.autoFilter||null,this._media=[],this.sheetProtection=null,this.tables={},this.conditionalFormattings=[]}get name(){return this._name}set name(t){if(void 0===t&&(t=`sheet${this.id}`),this._name!==t){if("string"!=typeof t)throw new Error("The name has to be a string.");if(""===t)throw new Error("The name can't be empty.");if("History"===t)throw new Error('The name "History" is protected. Please use a different name.');if(/[*?:/\\[\]]/.test(t))throw new Error(`Worksheet name ${t} cannot include any of the following characters: * ? : \\ / [ ]`);if(/(^')|('$)/.test(t))throw new Error(`The first or last character of worksheet name cannot be a single quotation mark: ${t}`);if(t&&t.length>31&&(t=t.substring(0,31)),this._workbook._worksheets.find((e=>e&&e.name.toLowerCase()===t.toLowerCase())))throw new Error(`Worksheet name already exists: ${t}`);this._name=t}}get workbook(){return this._workbook}destroy(){this._workbook.removeWorksheetEx(this)}get dimensions(){const t=new Mb;return this._rows.forEach((e=>{if(e){const r=e.dimensions;r&&t.expand(e.number,r.min,e.number,r.max)}})),t}get columns(){return this._columns}set columns(t){this._headerRowCount=t.reduce(((t,e)=>{const r=(e.header?1:e.headers&&e.headers.length)||0;return Math.max(t,r)}),0);let e=1;const r=this._columns=[];t.forEach((t=>{const i=new Nb(this,e++,!1);r.push(i),i.defn=t}))}getColumnKey(t){return this._keys[t]}setColumnKey(t,e){this._keys[t]=e}deleteColumnKey(t){delete this._keys[t]}eachColumnKey(t){Pb.each(this._keys,t)}getColumn(t){if("string"==typeof t){const e=this._keys[t];if(e)return e;t=Db.l2n(t)}if(this._columns||(this._columns=[]),t>this._columns.length){let e=this._columns.length+1;for(;e<=t;)this._columns.push(new Nb(this,e++))}return this._columns[t-1]}spliceColumns(t,e,...r){const i=this._rows.length;if(r.length>0)for(let n=0;n<i;n++){const i=[t,e];r.forEach((t=>{i.push(t[n]||null)}));const s=this.getRow(n+1);s.splice.apply(s,i)}else this._rows.forEach((r=>{r&&r.splice(t,e)}));const n=r.length-e,s=t+e,o=this._columns.length;if(n<0)for(let e=t+r.length;e<=o;e++)this.getColumn(e).defn=this.getColumn(e-n).defn;else if(n>0)for(let t=o;t>=s;t--)this.getColumn(t+n).defn=this.getColumn(t).defn;for(let e=t;e<t+r.length;e++)this.getColumn(e).defn=null;this.workbook.definedNames.spliceColumns(this.name,t,e,r.length)}get lastColumn(){return this.getColumn(this.columnCount)}get columnCount(){let t=0;return this.eachRow((e=>{t=Math.max(t,e.cellCount)})),t}get actualColumnCount(){const t=[];let e=0;return this.eachRow((r=>{r.eachCell((({col:r})=>{t[r]||(t[r]=!0,e++)}))})),e}_commitRow(){}get _lastRowNumber(){const t=this._rows;let e=t.length;for(;e>0&&void 0===t[e-1];)e--;return e}get _nextRow(){return this._lastRowNumber+1}get lastRow(){if(this._rows.length)return this._rows[this._rows.length-1]}findRow(t){return this._rows[t-1]}findRows(t,e){return this._rows.slice(t-1,t-1+e)}get rowCount(){return this._lastRowNumber}get actualRowCount(){let t=0;return this.eachRow((()=>{t++})),t}getRow(t){let e=this._rows[t-1];return e||(e=this._rows[t-1]=new Ib(this,t)),e}getRows(t,e){if(e<1)return;const r=[];for(let i=t;i<t+e;i++)r.push(this.getRow(i));return r}addRow(t,e="n"){const r=this._nextRow,i=this.getRow(r);return i.values=t,this._setStyleOption(r,"i"===e[0]?e:"n"),i}addRows(t,e="n"){const r=[];return t.forEach((t=>{r.push(this.addRow(t,e))})),r}insertRow(t,e,r="n"){return this.spliceRows(t,0,e),this._setStyleOption(t,r),this.getRow(t)}insertRows(t,e,r="n"){if(this.spliceRows(t,0,...e),"n"!==r)for(let i=0;i<e.length;i++)"o"===r[0]&&void 0!==this.findRow(e.length+t+i)?this._copyStyle(e.length+t+i,t+i,"+"===r[1]):"i"===r[0]&&void 0!==this.findRow(t-1)&&this._copyStyle(t-1,t+i,"+"===r[1]);return this.getRows(t,e.length)}_setStyleOption(t,e="n"){"o"===e[0]&&void 0!==this.findRow(t+1)?this._copyStyle(t+1,t,"+"===e[1]):"i"===e[0]&&void 0!==this.findRow(t-1)&&this._copyStyle(t-1,t,"+"===e[1])}_copyStyle(t,e,r=!1){const i=this.getRow(t),n=this.getRow(e);n.style=Ub(i.style),i.eachCell({includeEmpty:r},((t,e)=>{n.getCell(e).style=Ub(t.style)})),n.height=i.height}duplicateRow(t,e,r=!1){const i=this._rows[t-1],n=new Array(e).fill(i.values);this.spliceRows(t+1,r?0:e,...n);for(let r=0;r<e;r++){const e=this._rows[t+r];e.style=i.style,e.height=i.height,i.eachCell({includeEmpty:!0},((t,r)=>{e.getCell(r).style=t.style}))}}spliceRows(t,e,...r){const i=t+e,n=r.length,s=n-e,o=this._rows.length;let a,l;if(s<0)for(t===o&&(this._rows[o-1]=void 0),a=i;a<=o;a++)if(l=this._rows[a-1],l){const t=this.getRow(a+s);t.values=l.values,t.style=l.style,t.height=l.height,l.eachCell({includeEmpty:!0},((e,r)=>{t.getCell(r).style=e.style})),this._rows[a-1]=void 0}else this._rows[a+s-1]=void 0;else if(s>0)for(a=o;a>=i;a--)if(l=this._rows[a-1],l){const t=this.getRow(a+s);t.values=l.values,t.style=l.style,t.height=l.height,l.eachCell({includeEmpty:!0},((e,r)=>{if(t.getCell(r).style=e.style,"MergeValue"===e._value.constructor.name){const t=this.getRow(e._row._number+n).getCell(r),i=e._value._master,s=this.getRow(i._row._number+n).getCell(i._column._number);t.merge(s)}}))}else this._rows[a+s-1]=void 0;for(a=0;a<n;a++){const e=this.getRow(t+a);e.style={},e.values=r[a]}this.workbook.definedNames.spliceRows(this.name,t,e,n)}eachRow(t,e){if(e||(e=t,t=void 0),t&&t.includeEmpty){const t=this._rows.length;for(let r=1;r<=t;r++)e(this.getRow(r),r)}else this._rows.forEach((t=>{t&&t.hasValues&&e(t,t.number)}))}getSheetValues(){const t=[];return this._rows.forEach((e=>{e&&(t[e.number]=e.values)})),t}findCell(t,e){const r=Db.getAddress(t,e),i=this._rows[r.row-1];return i?i.findCell(r.col):void 0}getCell(t,e){const r=Db.getAddress(t,e);return this.getRow(r.row).getCellEx(r)}mergeCells(...t){const e=new Mb(t);this._mergeCellsInternal(e)}mergeCellsWithoutStyle(...t){const e=new Mb(t);this._mergeCellsInternal(e,!0)}_mergeCellsInternal(t,e){Pb.each(this._merges,(e=>{if(e.intersects(t))throw new Error("Cannot merge already merged cells")}));const r=this.getCell(t.top,t.left);for(let i=t.top;i<=t.bottom;i++)for(let n=t.left;n<=t.right;n++)(i>t.top||n>t.left)&&this.getCell(i,n).merge(r,e);this._merges[r.address]=t}_unMergeMaster(t){const e=this._merges[t.address];if(e){for(let t=e.top;t<=e.bottom;t++)for(let r=e.left;r<=e.right;r++)this.getCell(t,r).unmerge();delete this._merges[t.address]}}get hasMerges(){return Pb.some(this._merges,Boolean)}unMergeCells(...t){const e=new Mb(t);for(let t=e.top;t<=e.bottom;t++)for(let r=e.left;r<=e.right;r++){const e=this.findCell(t,r);e&&(e.type===Fb.ValueType.Merge?this._unMergeMaster(e.master):this._merges[e.address]&&this._unMergeMaster(e))}}fillFormula(t,e,r,i="shared"){const n=Db.decode(t),{top:s,left:o,bottom:a,right:l}=n,h=l-o+1,c=Db.encodeAddress(s,o),u="shared"===i;let d;d="function"==typeof r?r:Array.isArray(r)?Array.isArray(r[0])?(t,e)=>r[t-s][e-o]:(t,e)=>r[(t-s)*h+(e-o)]:()=>{};let p=!0;for(let r=s;r<=a;r++)for(let n=o;n<=l;n++)p?(this.getCell(r,n).value={shareType:i,formula:e,ref:t,result:d(r,n)},p=!1):this.getCell(r,n).value=u?{sharedFormula:c,result:d(r,n)}:d(r,n)}addImage(t,e){const r={type:"image",imageId:t,range:e};this._media.push(new jb(this,r))}getImages(){return this._media.filter((t=>"image"===t.type))}addBackgroundImage(t){const e={type:"background",imageId:t};this._media.push(new jb(this,e))}getBackgroundImageId(){const t=this._media.find((t=>"background"===t.type));return t&&t.imageId}protect(t,e){return new Promise((r=>{this.sheetProtection={sheet:!0},e&&"spinCount"in e&&(e.spinCount=Number.isFinite(e.spinCount)?Math.round(Math.max(0,e.spinCount)):1e5),t&&(this.sheetProtection.algorithmName="SHA-512",this.sheetProtection.saltValue=Wb.randomBytes(16).toString("base64"),this.sheetProtection.spinCount=e&&"spinCount"in e?e.spinCount:1e5,this.sheetProtection.hashValue=Wb.convertPasswordToHash(t,"SHA512",this.sheetProtection.saltValue,this.sheetProtection.spinCount)),e&&(this.sheetProtection=Object.assign(this.sheetProtection,e),!t&&"spinCount"in e&&delete this.sheetProtection.spinCount),r()}))}unprotect(){this.sheetProtection=null}addTable(t){const e=new zb(this,t);return this.tables[t.name]=e,e}getTable(t){return this.tables[t]}removeTable(t){delete this.tables[t]}getTables(){return Object.values(this.tables)}addConditionalFormatting(t){this.conditionalFormattings.push(t)}removeConditionalFormatting(t){"number"==typeof t?this.conditionalFormattings.splice(t,1):this.conditionalFormattings=t instanceof Function?this.conditionalFormattings.filter(t):[]}get tabColor(){return this.properties.tabColor}set tabColor(t){this.properties.tabColor=t}get model(){const t={id:this.id,name:this.name,dataValidations:this.dataValidations.model,properties:this.properties,state:this.state,pageSetup:this.pageSetup,headerFooter:this.headerFooter,rowBreaks:this.rowBreaks,views:this.views,autoFilter:this.autoFilter,media:this._media.map((t=>t.model)),sheetProtection:this.sheetProtection,tables:Object.values(this.tables).map((t=>t.model)),conditionalFormattings:this.conditionalFormattings};t.cols=Nb.toModel(this.columns);const e=t.rows=[],r=t.dimensions=new Mb;return this._rows.forEach((t=>{const i=t&&t.model;i&&(r.expand(i.number,i.min,i.number,i.max),e.push(i))})),t.merges=[],Pb.each(this._merges,(e=>{t.merges.push(e.range)})),t}_parseRows(t){this._rows=[],t.rows.forEach((t=>{const e=new Ib(this,t.number);this._rows[e.number-1]=e,e.model=t}))}_parseMergeCells(t){Pb.each(t.mergeCells,(t=>{this.mergeCellsWithoutStyle(t)}))}set model(t){this.name=t.name,this._columns=Nb.fromModel(this,t.cols),this._parseRows(t),this._parseMergeCells(t),this.dataValidations=new Hb(t.dataValidations),this.properties=t.properties,this.pageSetup=t.pageSetup,this.headerFooter=t.headerFooter,this.views=t.views,this.autoFilter=t.autoFilter,this._media=t.media.map((t=>new jb(this,t))),this.sheetProtection=t.sheetProtection,this.tables=t.tables.reduce(((t,e)=>{const r=new zb;return r.model=e,t[e.name]=r,t}),{}),this.conditionalFormattings=t.conditionalFormattings}};const Vb=Uv,Gb=Gv;var Xb=class{constructor(t){this.template=t,this.sheets={}}addCell(t){this.addCellEx(Gb.decodeEx(t))}getCell(t){return this.findCellEx(Gb.decodeEx(t),!0)}findCell(t){return this.findCellEx(Gb.decodeEx(t),!1)}findCellAt(t,e,r){const i=this.sheets[t],n=i&&i[e];return n&&n[r]}addCellEx(t){if(t.top)for(let e=t.top;e<=t.bottom;e++)for(let r=t.left;r<=t.right;r++)this.getCellAt(t.sheetName,e,r);else this.findCellEx(t,!0)}getCellEx(t){return this.findCellEx(t,!0)}findCellEx(t,e){const r=this.findSheet(t,e),i=this.findSheetRow(r,t,e);return this.findRowCell(i,t,e)}getCellAt(t,e,r){const i=this.sheets[t]||(this.sheets[t]=[]),n=i[e]||(i[e]=[]);return n[r]||(n[r]={sheetName:t,address:Gb.n2l(r)+e,row:e,col:r})}removeCellEx(t){const e=this.findSheet(t);if(!e)return;const r=this.findSheetRow(e,t);r&&delete r[t.col]}forEachInSheet(t,e){const r=this.sheets[t];r&&r.forEach(((t,r)=>{t&&t.forEach(((t,i)=>{t&&e(t,r,i)}))}))}forEach(t){Vb.each(this.sheets,((e,r)=>{this.forEachInSheet(r,t)}))}map(t){const e=[];return this.forEach((r=>{e.push(t(r))})),e}findSheet(t,e){const r=t.sheetName;return this.sheets[r]?this.sheets[r]:e?this.sheets[r]=[]:void 0}findSheetRow(t,e,r){const{row:i}=e;return t&&t[i]?t[i]:r?t[i]=[]:void 0}findRowCell(t,e,r){const{col:i}=e;return t&&t[i]?t[i]:r?t[i]=this.template?Object.assign(e,JSON.parse(JSON.stringify(this.template))):e:void 0}spliceRows(t,e,r,i){const n=this.sheets[t];if(n){const t=[];for(let e=0;e<i;e++)t.push([]);n.splice(e,r,...t)}}spliceColumns(t,e,r,i){const n=this.sheets[t];if(n){const t=[];for(let e=0;e<i;e++)t.push(null);Vb.each(n,(i=>{i.splice(e,r,...t)}))}}};const Yb=Uv,qb=Gv,Zb=Xb,Kb=Yv,Qb=/[$](\w+)[$](\d+)(:[$](\w+)[$](\d+))?/;var Jb,t_,e_,r_,i_,n_=class{constructor(){this.matrixMap={}}getMatrix(t){return this.matrixMap[t]||(this.matrixMap[t]=new Zb)}add(t,e){const r=qb.decodeEx(t);this.addEx(r,e)}addEx(t,e){const r=this.getMatrix(e);if(t.top)for(let e=t.left;e<=t.right;e++)for(let i=t.top;i<=t.bottom;i++){const n={sheetName:t.sheetName,address:qb.n2l(e)+i,row:i,col:e};r.addCellEx(n)}else r.addCellEx(t)}remove(t,e){const r=qb.decodeEx(t);this.removeEx(r,e)}removeEx(t,e){this.getMatrix(e).removeCellEx(t)}removeAllNames(t){Yb.each(this.matrixMap,(e=>{e.removeCellEx(t)}))}forEach(t){Yb.each(this.matrixMap,((e,r)=>{e.forEach((e=>{t(r,e)}))}))}getNames(t){return this.getNamesEx(qb.decodeEx(t))}getNamesEx(t){return Yb.map(this.matrixMap,((e,r)=>e.findCellEx(t)&&r)).filter(Boolean)}_explore(t,e){e.mark=!1;const{sheetName:r}=e,i=new Kb(e.row,e.col,e.row,e.col,r);let n,s;function o(n,s){const o=t.findCellAt(r,n,e.col);return!(!o||!o.mark)&&(i[s]=n,o.mark=!1,!0)}for(s=e.row-1;o(s,"top");s--);for(s=e.row+1;o(s,"bottom");s++);function a(e,n){const o=[];for(s=i.top;s<=i.bottom;s++){const i=t.findCellAt(r,s,e);if(!i||!i.mark)return!1;o.push(i)}i[n]=e;for(let t=0;t<o.length;t++)o[t].mark=!1;return!0}for(n=e.col-1;a(n,"left");n--);for(n=e.col+1;a(n,"right");n++);return i}getRanges(t,e){if(!(e=e||this.matrixMap[t]))return{name:t,ranges:[]};e.forEach((t=>{t.mark=!0}));const r=e.map((t=>t.mark&&this._explore(e,t))).filter(Boolean).map((t=>t.$shortRange));return{name:t,ranges:r}}normaliseMatrix(t,e){t.forEachInSheet(e,((t,e,r)=>{t&&(t.row===e&&t.col===r||(t.row=e,t.col=r,t.address=qb.n2l(r)+e))}))}spliceRows(t,e,r,i){Yb.each(this.matrixMap,(n=>{n.spliceRows(t,e,r,i),this.normaliseMatrix(n,t)}))}spliceColumns(t,e,r,i){Yb.each(this.matrixMap,(n=>{n.spliceColumns(t,e,r,i),this.normaliseMatrix(n,t)}))}get model(){return Yb.map(this.matrixMap,((t,e)=>this.getRanges(e,t))).filter((t=>t.ranges.length))}set model(t){const e=this.matrixMap={};t.forEach((t=>{const r=e[t.name]=new Zb;t.ranges.forEach((t=>{Qb.test(t.split("!").pop()||"")&&r.addCell(t)}))}))}},s_={},o_={},a_={},l_={exports:{}},h_={exports:{}};function c_(){if(Jb)return h_.exports;return Jb=1,"undefined"==typeof process||!process.version||0===process.version.indexOf("v0.")||0===process.version.indexOf("v1.")&&0!==process.version.indexOf("v1.8.")?h_.exports={nextTick:function(t,e,r,i){if("function"!=typeof t)throw new TypeError('"callback" argument must be a function');var n,s,o=arguments.length;switch(o){case 0:case 1:return process.nextTick(t);case 2:return process.nextTick((function(){t.call(null,e)}));case 3:return process.nextTick((function(){t.call(null,e,r)}));case 4:return process.nextTick((function(){t.call(null,e,r,i)}));default:for(n=new Array(o-1),s=0;s<n.length;)n[s++]=arguments[s];return process.nextTick((function(){t.apply(null,n)}))}}}:h_.exports=process,h_.exports}function u_(){return i_?r_:(i_=1,r_=n)}var d_,p_={exports:{}};function f_(){return d_||(d_=1,function(t,e){var r=o,i=r.Buffer;function n(t,e){for(var r in t)e[r]=t[r]}function s(t,e,r){return i(t,e,r)}i.from&&i.alloc&&i.allocUnsafe&&i.allocUnsafeSlow?t.exports=r:(n(r,e),e.Buffer=s),n(i,s),s.from=function(t,e,r){if("number"==typeof t)throw new TypeError("Argument must not be a number");return i(t,e,r)},s.alloc=function(t,e,r){if("number"!=typeof t)throw new TypeError("Argument must be a number");var n=i(t);return void 0!==e?"string"==typeof r?n.fill(e,r):n.fill(e):n.fill(0),n},s.allocUnsafe=function(t){if("number"!=typeof t)throw new TypeError("Argument must be a number");return i(t)},s.allocUnsafeSlow=function(t){if("number"!=typeof t)throw new TypeError("Argument must be a number");return r.SlowBuffer(t)}}(p_,p_.exports)),p_.exports}var g_,m_={};function y_(){if(g_)return m_;function t(t){return Object.prototype.toString.call(t)}return g_=1,m_.isArray=function(e){return Array.isArray?Array.isArray(e):"[object Array]"===t(e)},m_.isBoolean=function(t){return"boolean"==typeof t},m_.isNull=function(t){return null===t},m_.isNullOrUndefined=function(t){return null==t},m_.isNumber=function(t){return"number"==typeof t},m_.isString=function(t){return"string"==typeof t},m_.isSymbol=function(t){return"symbol"==typeof t},m_.isUndefined=function(t){return void 0===t},m_.isRegExp=function(e){return"[object RegExp]"===t(e)},m_.isObject=function(t){return"object"==typeof t&&null!==t},m_.isDate=function(e){return"[object Date]"===t(e)},m_.isError=function(e){return"[object Error]"===t(e)||e instanceof Error},m_.isFunction=function(t){return"function"==typeof t},m_.isPrimitive=function(t){return null===t||"boolean"==typeof t||"number"==typeof t||"string"==typeof t||"symbol"==typeof t||void 0===t},m_.isBuffer=o.Buffer.isBuffer,m_}var v_,b_,__={exports:{}},w_={exports:{}};function x_(){if(b_)return __.exports;b_=1;try{var t=require("util");if("function"!=typeof t.inherits)throw"";__.exports=t.inherits}catch(t){__.exports=(v_||(v_=1,"function"==typeof Object.create?w_.exports=function(t,e){e&&(t.super_=e,t.prototype=Object.create(e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}))}:w_.exports=function(t,e){if(e){t.super_=e;var r=function(){};r.prototype=e.prototype,t.prototype=new r,t.prototype.constructor=t}}),w_.exports)}return __.exports}var S_,T_,k_,C_,E_,A_,O_,B_,R_,L_={exports:{}};function P_(){return S_||(S_=1,function(t){var e=f_().Buffer,r=a;function i(t,e,r){t.copy(e,r)}t.exports=function(){function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.head=null,this.tail=null,this.length=0}return t.prototype.push=function(t){var e={data:t,next:null};this.length>0?this.tail.next=e:this.head=e,this.tail=e,++this.length},t.prototype.unshift=function(t){var e={data:t,next:this.head};0===this.length&&(this.tail=e),this.head=e,++this.length},t.prototype.shift=function(){if(0!==this.length){var t=this.head.data;return 1===this.length?this.head=this.tail=null:this.head=this.head.next,--this.length,t}},t.prototype.clear=function(){this.head=this.tail=null,this.length=0},t.prototype.join=function(t){if(0===this.length)return"";for(var e=this.head,r=""+e.data;e=e.next;)r+=t+e.data;return r},t.prototype.concat=function(t){if(0===this.length)return e.alloc(0);for(var r=e.allocUnsafe(t>>>0),n=this.head,s=0;n;)i(n.data,r,s),s+=n.data.length,n=n.next;return r},t}(),r&&r.inspect&&r.inspect.custom&&(t.exports.prototype[r.inspect.custom]=function(){var t=r.inspect({length:this.length});return this.constructor.name+" "+t})}(L_)),L_.exports}function D_(){if(k_)return T_;k_=1;var t=c_();function e(t,e){t.emit("error",e)}return T_={destroy:function(r,i){var n=this,s=this._readableState&&this._readableState.destroyed,o=this._writableState&&this._writableState.destroyed;return s||o?(i?i(r):r&&(this._writableState?this._writableState.errorEmitted||(this._writableState.errorEmitted=!0,t.nextTick(e,this,r)):t.nextTick(e,this,r)),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(r||null,(function(r){!i&&r?n._writableState?n._writableState.errorEmitted||(n._writableState.errorEmitted=!0,t.nextTick(e,n,r)):t.nextTick(e,n,r):i&&i(r)})),this)},undestroy:function(){this._readableState&&(this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1),this._writableState&&(this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finalCalled=!1,this._writableState.prefinished=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1)}},T_}function M_(){return E_?C_:(E_=1,C_=a.deprecate)}function I_(){if(O_)return A_;O_=1;var t=c_();function e(t){var e=this;this.next=null,this.entry=null,this.finish=function(){!function(t,e,r){var i=t.entry;t.entry=null;for(;i;){var n=i.callback;e.pendingcb--,n(r),i=i.next}e.corkedRequestsFree.next=t}(e,t)}}A_=p;var r,i=!process.browser&&["v0.10","v0.9."].indexOf(process.version.slice(0,5))>-1?setImmediate:t.nextTick;p.WritableState=d;var n=Object.create(y_());n.inherits=x_();var s={deprecate:M_()},o=u_(),a=f_().Buffer,l=(void 0!==dt?dt:"undefined"!=typeof window?window:"undefined"!=typeof self?self:{}).Uint8Array||function(){};var h,c=D_();function u(){}function d(n,s){r=r||N_(),n=n||{};var o=s instanceof r;this.objectMode=!!n.objectMode,o&&(this.objectMode=this.objectMode||!!n.writableObjectMode);var a=n.highWaterMark,l=n.writableHighWaterMark,h=this.objectMode?16:16384;this.highWaterMark=a||0===a?a:o&&(l||0===l)?l:h,this.highWaterMark=Math.floor(this.highWaterMark),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var c=!1===n.decodeStrings;this.decodeStrings=!c,this.defaultEncoding=n.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(e){!function(e,r){var n=e._writableState,s=n.sync,o=n.writecb;if(function(t){t.writing=!1,t.writecb=null,t.length-=t.writelen,t.writelen=0}(n),r)!function(e,r,i,n,s){--r.pendingcb,i?(t.nextTick(s,n),t.nextTick(b,e,r),e._writableState.errorEmitted=!0,e.emit("error",n)):(s(n),e._writableState.errorEmitted=!0,e.emit("error",n),b(e,r))}(e,n,s,r,o);else{var a=y(n);a||n.corked||n.bufferProcessing||!n.bufferedRequest||m(e,n),s?i(g,e,n,a,o):g(e,n,a,o)}}(s,e)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.bufferedRequestCount=0,this.corkedRequestsFree=new e(this)}function p(t){if(r=r||N_(),!(h.call(p,this)||this instanceof r))return new p(t);this._writableState=new d(t,this),this.writable=!0,t&&("function"==typeof t.write&&(this._write=t.write),"function"==typeof t.writev&&(this._writev=t.writev),"function"==typeof t.destroy&&(this._destroy=t.destroy),"function"==typeof t.final&&(this._final=t.final)),o.call(this)}function f(t,e,r,i,n,s,o){e.writelen=i,e.writecb=o,e.writing=!0,e.sync=!0,r?t._writev(n,e.onwrite):t._write(n,s,e.onwrite),e.sync=!1}function g(t,e,r,i){r||function(t,e){0===e.length&&e.needDrain&&(e.needDrain=!1,t.emit("drain"))}(t,e),e.pendingcb--,i(),b(t,e)}function m(t,r){r.bufferProcessing=!0;var i=r.bufferedRequest;if(t._writev&&i&&i.next){var n=r.bufferedRequestCount,s=new Array(n),o=r.corkedRequestsFree;o.entry=i;for(var a=0,l=!0;i;)s[a]=i,i.isBuf||(l=!1),i=i.next,a+=1;s.allBuffers=l,f(t,r,!0,r.length,s,"",o.finish),r.pendingcb++,r.lastBufferedRequest=null,o.next?(r.corkedRequestsFree=o.next,o.next=null):r.corkedRequestsFree=new e(r),r.bufferedRequestCount=0}else{for(;i;){var h=i.chunk,c=i.encoding,u=i.callback;if(f(t,r,!1,r.objectMode?1:h.length,h,c,u),i=i.next,r.bufferedRequestCount--,r.writing)break}null===i&&(r.lastBufferedRequest=null)}r.bufferedRequest=i,r.bufferProcessing=!1}function y(t){return t.ending&&0===t.length&&null===t.bufferedRequest&&!t.finished&&!t.writing}function v(t,e){t._final((function(r){e.pendingcb--,r&&t.emit("error",r),e.prefinished=!0,t.emit("prefinish"),b(t,e)}))}function b(e,r){var i=y(r);return i&&(!function(e,r){r.prefinished||r.finalCalled||("function"==typeof e._final?(r.pendingcb++,r.finalCalled=!0,t.nextTick(v,e,r)):(r.prefinished=!0,e.emit("prefinish")))}(e,r),0===r.pendingcb&&(r.finished=!0,e.emit("finish"))),i}return n.inherits(p,o),d.prototype.getBuffer=function(){for(var t=this.bufferedRequest,e=[];t;)e.push(t),t=t.next;return e},function(){try{Object.defineProperty(d.prototype,"buffer",{get:s.deprecate((function(){return this.getBuffer()}),"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch(t){}}(),"function"==typeof Symbol&&Symbol.hasInstance&&"function"==typeof Function.prototype[Symbol.hasInstance]?(h=Function.prototype[Symbol.hasInstance],Object.defineProperty(p,Symbol.hasInstance,{value:function(t){return!!h.call(this,t)||this===p&&(t&&t._writableState instanceof d)}})):h=function(t){return t instanceof this},p.prototype.pipe=function(){this.emit("error",new Error("Cannot pipe, not readable"))},p.prototype.write=function(e,r,i){var n,s=this._writableState,o=!1,h=!s.objectMode&&(n=e,a.isBuffer(n)||n instanceof l);return h&&!a.isBuffer(e)&&(e=function(t){return a.from(t)}(e)),"function"==typeof r&&(i=r,r=null),h?r="buffer":r||(r=s.defaultEncoding),"function"!=typeof i&&(i=u),s.ended?function(e,r){var i=new Error("write after end");e.emit("error",i),t.nextTick(r,i)}(this,i):(h||function(e,r,i,n){var s=!0,o=!1;return null===i?o=new TypeError("May not write null values to stream"):"string"==typeof i||void 0===i||r.objectMode||(o=new TypeError("Invalid non-string/buffer chunk")),o&&(e.emit("error",o),t.nextTick(n,o),s=!1),s}(this,s,e,i))&&(s.pendingcb++,o=function(t,e,r,i,n,s){if(!r){var o=function(t,e,r){t.objectMode||!1===t.decodeStrings||"string"!=typeof e||(e=a.from(e,r));return e}(e,i,n);i!==o&&(r=!0,n="buffer",i=o)}var l=e.objectMode?1:i.length;e.length+=l;var h=e.length<e.highWaterMark;h||(e.needDrain=!0);if(e.writing||e.corked){var c=e.lastBufferedRequest;e.lastBufferedRequest={chunk:i,encoding:n,isBuf:r,callback:s,next:null},c?c.next=e.lastBufferedRequest:e.bufferedRequest=e.lastBufferedRequest,e.bufferedRequestCount+=1}else f(t,e,!1,l,i,n,s);return h}(this,s,h,e,r,i)),o},p.prototype.cork=function(){this._writableState.corked++},p.prototype.uncork=function(){var t=this._writableState;t.corked&&(t.corked--,t.writing||t.corked||t.bufferProcessing||!t.bufferedRequest||m(this,t))},p.prototype.setDefaultEncoding=function(t){if("string"==typeof t&&(t=t.toLowerCase()),!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((t+"").toLowerCase())>-1))throw new TypeError("Unknown encoding: "+t);return this._writableState.defaultEncoding=t,this},Object.defineProperty(p.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),p.prototype._write=function(t,e,r){r(new Error("_write() is not implemented"))},p.prototype._writev=null,p.prototype.end=function(e,r,i){var n=this._writableState;"function"==typeof e?(i=e,e=null,r=null):"function"==typeof r&&(i=r,r=null),null!=e&&this.write(e,r),n.corked&&(n.corked=1,this.uncork()),n.ending||function(e,r,i){r.ending=!0,b(e,r),i&&(r.finished?t.nextTick(i):e.once("finish",i));r.ended=!0,e.writable=!1}(this,n,i)},Object.defineProperty(p.prototype,"destroyed",{get:function(){return void 0!==this._writableState&&this._writableState.destroyed},set:function(t){this._writableState&&(this._writableState.destroyed=t)}}),p.prototype.destroy=c.destroy,p.prototype._undestroy=c.undestroy,p.prototype._destroy=function(t,e){this.end(),e(t)},A_}function N_(){if(R_)return B_;R_=1;var t=c_(),e=Object.keys||function(t){var e=[];for(var r in t)e.push(r);return e};B_=l;var r=Object.create(y_());r.inherits=x_();var i=Y_(),n=I_();r.inherits(l,i);for(var s=e(n.prototype),o=0;o<s.length;o++){var a=s[o];l.prototype[a]||(l.prototype[a]=n.prototype[a])}function l(t){if(!(this instanceof l))return new l(t);i.call(this,t),n.call(this,t),t&&!1===t.readable&&(this.readable=!1),t&&!1===t.writable&&(this.writable=!1),this.allowHalfOpen=!0,t&&!1===t.allowHalfOpen&&(this.allowHalfOpen=!1),this.once("end",h)}function h(){this.allowHalfOpen||this._writableState.ended||t.nextTick(c,this)}function c(t){t.end()}return Object.defineProperty(l.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),Object.defineProperty(l.prototype,"destroyed",{get:function(){return void 0!==this._readableState&&void 0!==this._writableState&&(this._readableState.destroyed&&this._writableState.destroyed)},set:function(t){void 0!==this._readableState&&void 0!==this._writableState&&(this._readableState.destroyed=t,this._writableState.destroyed=t)}}),l.prototype._destroy=function(e,r){this.push(null),this.end(),t.nextTick(r,e)},B_}var F_,j_,z_,H_,W_,U_,$_,V_,G_={};function X_(){if(F_)return G_;F_=1;var t=f_().Buffer,e=t.isEncoding||function(t){switch((t=""+t)&&t.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};function r(r){var i;switch(this.encoding=function(r){var i=function(t){if(!t)return"utf8";for(var e;;)switch(t){case"utf8":case"utf-8":return"utf8";case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return"utf16le";case"latin1":case"binary":return"latin1";case"base64":case"ascii":case"hex":return t;default:if(e)return;t=(""+t).toLowerCase(),e=!0}}(r);if("string"!=typeof i&&(t.isEncoding===e||!e(r)))throw new Error("Unknown encoding: "+r);return i||r}(r),this.encoding){case"utf16le":this.text=s,this.end=o,i=4;break;case"utf8":this.fillLast=n,i=4;break;case"base64":this.text=a,this.end=l,i=3;break;default:return this.write=h,void(this.end=c)}this.lastNeed=0,this.lastTotal=0,this.lastChar=t.allocUnsafe(i)}function i(t){return t<=127?0:t>>5==6?2:t>>4==14?3:t>>3==30?4:t>>6==2?-1:-2}function n(t){var e=this.lastTotal-this.lastNeed,r=function(t,e,r){if(128!=(192&e[0]))return t.lastNeed=0,"�";if(t.lastNeed>1&&e.length>1){if(128!=(192&e[1]))return t.lastNeed=1,"�";if(t.lastNeed>2&&e.length>2&&128!=(192&e[2]))return t.lastNeed=2,"�"}}(this,t);return void 0!==r?r:this.lastNeed<=t.length?(t.copy(this.lastChar,e,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal)):(t.copy(this.lastChar,e,0,t.length),void(this.lastNeed-=t.length))}function s(t,e){if((t.length-e)%2==0){var r=t.toString("utf16le",e);if(r){var i=r.charCodeAt(r.length-1);if(i>=55296&&i<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=t[t.length-2],this.lastChar[1]=t[t.length-1],r.slice(0,-1)}return r}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=t[t.length-1],t.toString("utf16le",e,t.length-1)}function o(t){var e=t&&t.length?this.write(t):"";if(this.lastNeed){var r=this.lastTotal-this.lastNeed;return e+this.lastChar.toString("utf16le",0,r)}return e}function a(t,e){var r=(t.length-e)%3;return 0===r?t.toString("base64",e):(this.lastNeed=3-r,this.lastTotal=3,1===r?this.lastChar[0]=t[t.length-1]:(this.lastChar[0]=t[t.length-2],this.lastChar[1]=t[t.length-1]),t.toString("base64",e,t.length-r))}function l(t){var e=t&&t.length?this.write(t):"";return this.lastNeed?e+this.lastChar.toString("base64",0,3-this.lastNeed):e}function h(t){return t.toString(this.encoding)}function c(t){return t&&t.length?this.write(t):""}return G_.StringDecoder=r,r.prototype.write=function(t){if(0===t.length)return"";var e,r;if(this.lastNeed){if(void 0===(e=this.fillLast(t)))return"";r=this.lastNeed,this.lastNeed=0}else r=0;return r<t.length?e?e+this.text(t,r):this.text(t,r):e||""},r.prototype.end=function(t){var e=t&&t.length?this.write(t):"";return this.lastNeed?e+"�":e},r.prototype.text=function(t,e){var r=function(t,e,r){var n=e.length-1;if(n<r)return 0;var s=i(e[n]);if(s>=0)return s>0&&(t.lastNeed=s-1),s;if(--n<r||-2===s)return 0;if(s=i(e[n]),s>=0)return s>0&&(t.lastNeed=s-2),s;if(--n<r||-2===s)return 0;if(s=i(e[n]),s>=0)return s>0&&(2===s?s=0:t.lastNeed=s-3),s;return 0}(this,t,e);if(!this.lastNeed)return t.toString("utf8",e);this.lastTotal=r;var n=t.length-(r-this.lastNeed);return t.copy(this.lastChar,0,n),t.toString("utf8",e,n)},r.prototype.fillLast=function(t){if(this.lastNeed<=t.length)return t.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);t.copy(this.lastChar,this.lastTotal-this.lastNeed,0,t.length),this.lastNeed-=t.length},G_}function Y_(){if(z_)return j_;z_=1;var t=c_();j_=y;var e,r=function(){if(e_)return t_;e_=1;var t={}.toString;return t_=Array.isArray||function(e){return"[object Array]"==t.call(e)}}();y.ReadableState=m,s.EventEmitter;var i=function(t,e){return t.listeners(e).length},n=u_(),o=f_().Buffer,l=(void 0!==dt?dt:"undefined"!=typeof window?window:"undefined"!=typeof self?self:{}).Uint8Array||function(){};var h=Object.create(y_());h.inherits=x_();var c=a,u=void 0;u=c&&c.debuglog?c.debuglog("stream"):function(){};var d,p=P_(),f=D_();h.inherits(y,n);var g=["error","close","destroy","pause","resume"];function m(t,r){t=t||{};var i=r instanceof(e=e||N_());this.objectMode=!!t.objectMode,i&&(this.objectMode=this.objectMode||!!t.readableObjectMode);var n=t.highWaterMark,s=t.readableHighWaterMark,o=this.objectMode?16:16384;this.highWaterMark=n||0===n?n:i&&(s||0===s)?s:o,this.highWaterMark=Math.floor(this.highWaterMark),this.buffer=new p,this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this.destroyed=!1,this.defaultEncoding=t.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,t.encoding&&(d||(d=X_().StringDecoder),this.decoder=new d(t.encoding),this.encoding=t.encoding)}function y(t){if(e=e||N_(),!(this instanceof y))return new y(t);this._readableState=new m(t,this),this.readable=!0,t&&("function"==typeof t.read&&(this._read=t.read),"function"==typeof t.destroy&&(this._destroy=t.destroy)),n.call(this)}function v(t,e,r,i,n){var s,a=t._readableState;null===e?(a.reading=!1,function(t,e){if(e.ended)return;if(e.decoder){var r=e.decoder.end();r&&r.length&&(e.buffer.push(r),e.length+=e.objectMode?1:r.length)}e.ended=!0,x(t)}(t,a)):(n||(s=function(t,e){var r;i=e,o.isBuffer(i)||i instanceof l||"string"==typeof e||void 0===e||t.objectMode||(r=new TypeError("Invalid non-string/buffer chunk"));var i;return r}(a,e)),s?t.emit("error",s):a.objectMode||e&&e.length>0?("string"==typeof e||a.objectMode||Object.getPrototypeOf(e)===o.prototype||(e=function(t){return o.from(t)}(e)),i?a.endEmitted?t.emit("error",new Error("stream.unshift() after end event")):b(t,a,e,!0):a.ended?t.emit("error",new Error("stream.push() after EOF")):(a.reading=!1,a.decoder&&!r?(e=a.decoder.write(e),a.objectMode||0!==e.length?b(t,a,e,!1):T(t,a)):b(t,a,e,!1))):i||(a.reading=!1));return function(t){return!t.ended&&(t.needReadable||t.length<t.highWaterMark||0===t.length)}(a)}function b(t,e,r,i){e.flowing&&0===e.length&&!e.sync?(t.emit("data",r),t.read(0)):(e.length+=e.objectMode?1:r.length,i?e.buffer.unshift(r):e.buffer.push(r),e.needReadable&&x(t)),T(t,e)}Object.defineProperty(y.prototype,"destroyed",{get:function(){return void 0!==this._readableState&&this._readableState.destroyed},set:function(t){this._readableState&&(this._readableState.destroyed=t)}}),y.prototype.destroy=f.destroy,y.prototype._undestroy=f.undestroy,y.prototype._destroy=function(t,e){this.push(null),e(t)},y.prototype.push=function(t,e){var r,i=this._readableState;return i.objectMode?r=!0:"string"==typeof t&&((e=e||i.defaultEncoding)!==i.encoding&&(t=o.from(t,e),e=""),r=!0),v(this,t,e,!1,r)},y.prototype.unshift=function(t){return v(this,t,null,!0,!1)},y.prototype.isPaused=function(){return!1===this._readableState.flowing},y.prototype.setEncoding=function(t){return d||(d=X_().StringDecoder),this._readableState.decoder=new d(t),this._readableState.encoding=t,this};var _=8388608;function w(t,e){return t<=0||0===e.length&&e.ended?0:e.objectMode?1:t!=t?e.flowing&&e.length?e.buffer.head.data.length:e.length:(t>e.highWaterMark&&(e.highWaterMark=function(t){return t>=_?t=_:(t--,t|=t>>>1,t|=t>>>2,t|=t>>>4,t|=t>>>8,t|=t>>>16,t++),t}(t)),t<=e.length?t:e.ended?e.length:(e.needReadable=!0,0))}function x(e){var r=e._readableState;r.needReadable=!1,r.emittedReadable||(u("emitReadable",r.flowing),r.emittedReadable=!0,r.sync?t.nextTick(S,e):S(e))}function S(t){u("emit readable"),t.emit("readable"),A(t)}function T(e,r){r.readingMore||(r.readingMore=!0,t.nextTick(k,e,r))}function k(t,e){for(var r=e.length;!e.reading&&!e.flowing&&!e.ended&&e.length<e.highWaterMark&&(u("maybeReadMore read 0"),t.read(0),r!==e.length);)r=e.length;e.readingMore=!1}function C(t){u("readable nexttick read 0"),t.read(0)}function E(t,e){e.reading||(u("resume read 0"),t.read(0)),e.resumeScheduled=!1,e.awaitDrain=0,t.emit("resume"),A(t),e.flowing&&!e.reading&&t.read(0)}function A(t){var e=t._readableState;for(u("flow",e.flowing);e.flowing&&null!==t.read(););}function O(t,e){return 0===e.length?null:(e.objectMode?r=e.buffer.shift():!t||t>=e.length?(r=e.decoder?e.buffer.join(""):1===e.buffer.length?e.buffer.head.data:e.buffer.concat(e.length),e.buffer.clear()):r=function(t,e,r){var i;t<e.head.data.length?(i=e.head.data.slice(0,t),e.head.data=e.head.data.slice(t)):i=t===e.head.data.length?e.shift():r?function(t,e){var r=e.head,i=1,n=r.data;t-=n.length;for(;r=r.next;){var s=r.data,o=t>s.length?s.length:t;if(o===s.length?n+=s:n+=s.slice(0,t),0===(t-=o)){o===s.length?(++i,r.next?e.head=r.next:e.head=e.tail=null):(e.head=r,r.data=s.slice(o));break}++i}return e.length-=i,n}(t,e):function(t,e){var r=o.allocUnsafe(t),i=e.head,n=1;i.data.copy(r),t-=i.data.length;for(;i=i.next;){var s=i.data,a=t>s.length?s.length:t;if(s.copy(r,r.length-t,0,a),0===(t-=a)){a===s.length?(++n,i.next?e.head=i.next:e.head=e.tail=null):(e.head=i,i.data=s.slice(a));break}++n}return e.length-=n,r}(t,e);return i}(t,e.buffer,e.decoder),r);var r}function B(e){var r=e._readableState;if(r.length>0)throw new Error('"endReadable()" called on non-empty stream');r.endEmitted||(r.ended=!0,t.nextTick(R,r,e))}function R(t,e){t.endEmitted||0!==t.length||(t.endEmitted=!0,e.readable=!1,e.emit("end"))}function L(t,e){for(var r=0,i=t.length;r<i;r++)if(t[r]===e)return r;return-1}return y.prototype.read=function(t){u("read",t),t=parseInt(t,10);var e=this._readableState,r=t;if(0!==t&&(e.emittedReadable=!1),0===t&&e.needReadable&&(e.length>=e.highWaterMark||e.ended))return u("read: emitReadable",e.length,e.ended),0===e.length&&e.ended?B(this):x(this),null;if(0===(t=w(t,e))&&e.ended)return 0===e.length&&B(this),null;var i,n=e.needReadable;return u("need readable",n),(0===e.length||e.length-t<e.highWaterMark)&&u("length less than watermark",n=!0),e.ended||e.reading?u("reading or ended",n=!1):n&&(u("do read"),e.reading=!0,e.sync=!0,0===e.length&&(e.needReadable=!0),this._read(e.highWaterMark),e.sync=!1,e.reading||(t=w(r,e))),null===(i=t>0?O(t,e):null)?(e.needReadable=!0,t=0):e.length-=t,0===e.length&&(e.ended||(e.needReadable=!0),r!==t&&e.ended&&B(this)),null!==i&&this.emit("data",i),i},y.prototype._read=function(t){this.emit("error",new Error("_read() is not implemented"))},y.prototype.pipe=function(e,n){var s=this,o=this._readableState;switch(o.pipesCount){case 0:o.pipes=e;break;case 1:o.pipes=[o.pipes,e];break;default:o.pipes.push(e)}o.pipesCount+=1,u("pipe count=%d opts=%j",o.pipesCount,n);var a=(!n||!1!==n.end)&&e!==process.stdout&&e!==process.stderr?h:v;function l(t,r){u("onunpipe"),t===s&&r&&!1===r.hasUnpiped&&(r.hasUnpiped=!0,u("cleanup"),e.removeListener("close",m),e.removeListener("finish",y),e.removeListener("drain",c),e.removeListener("error",g),e.removeListener("unpipe",l),s.removeListener("end",h),s.removeListener("end",v),s.removeListener("data",f),d=!0,!o.awaitDrain||e._writableState&&!e._writableState.needDrain||c())}function h(){u("onend"),e.end()}o.endEmitted?t.nextTick(a):s.once("end",a),e.on("unpipe",l);var c=function(t){return function(){var e=t._readableState;u("pipeOnDrain",e.awaitDrain),e.awaitDrain&&e.awaitDrain--,0===e.awaitDrain&&i(t,"data")&&(e.flowing=!0,A(t))}}(s);e.on("drain",c);var d=!1;var p=!1;function f(t){u("ondata"),p=!1,!1!==e.write(t)||p||((1===o.pipesCount&&o.pipes===e||o.pipesCount>1&&-1!==L(o.pipes,e))&&!d&&(u("false write response, pause",o.awaitDrain),o.awaitDrain++,p=!0),s.pause())}function g(t){u("onerror",t),v(),e.removeListener("error",g),0===i(e,"error")&&e.emit("error",t)}function m(){e.removeListener("finish",y),v()}function y(){u("onfinish"),e.removeListener("close",m),v()}function v(){u("unpipe"),s.unpipe(e)}return s.on("data",f),function(t,e,i){if("function"==typeof t.prependListener)return t.prependListener(e,i);t._events&&t._events[e]?r(t._events[e])?t._events[e].unshift(i):t._events[e]=[i,t._events[e]]:t.on(e,i)}(e,"error",g),e.once("close",m),e.once("finish",y),e.emit("pipe",s),o.flowing||(u("pipe resume"),s.resume()),e},y.prototype.unpipe=function(t){var e=this._readableState,r={hasUnpiped:!1};if(0===e.pipesCount)return this;if(1===e.pipesCount)return t&&t!==e.pipes||(t||(t=e.pipes),e.pipes=null,e.pipesCount=0,e.flowing=!1,t&&t.emit("unpipe",this,r)),this;if(!t){var i=e.pipes,n=e.pipesCount;e.pipes=null,e.pipesCount=0,e.flowing=!1;for(var s=0;s<n;s++)i[s].emit("unpipe",this,{hasUnpiped:!1});return this}var o=L(e.pipes,t);return-1===o||(e.pipes.splice(o,1),e.pipesCount-=1,1===e.pipesCount&&(e.pipes=e.pipes[0]),t.emit("unpipe",this,r)),this},y.prototype.on=function(e,r){var i=n.prototype.on.call(this,e,r);if("data"===e)!1!==this._readableState.flowing&&this.resume();else if("readable"===e){var s=this._readableState;s.endEmitted||s.readableListening||(s.readableListening=s.needReadable=!0,s.emittedReadable=!1,s.reading?s.length&&x(this):t.nextTick(C,this))}return i},y.prototype.addListener=y.prototype.on,y.prototype.resume=function(){var e=this._readableState;return e.flowing||(u("resume"),e.flowing=!0,function(e,r){r.resumeScheduled||(r.resumeScheduled=!0,t.nextTick(E,e,r))}(this,e)),this},y.prototype.pause=function(){return u("call pause flowing=%j",this._readableState.flowing),!1!==this._readableState.flowing&&(u("pause"),this._readableState.flowing=!1,this.emit("pause")),this},y.prototype.wrap=function(t){var e=this,r=this._readableState,i=!1;for(var n in t.on("end",(function(){if(u("wrapped end"),r.decoder&&!r.ended){var t=r.decoder.end();t&&t.length&&e.push(t)}e.push(null)})),t.on("data",(function(n){(u("wrapped data"),r.decoder&&(n=r.decoder.write(n)),r.objectMode&&null==n)||(r.objectMode||n&&n.length)&&(e.push(n)||(i=!0,t.pause()))})),t)void 0===this[n]&&"function"==typeof t[n]&&(this[n]=function(e){return function(){return t[e].apply(t,arguments)}}(n));for(var s=0;s<g.length;s++)t.on(g[s],this.emit.bind(this,g[s]));return this._read=function(e){u("wrapped _read",e),i&&(i=!1,t.resume())},this},Object.defineProperty(y.prototype,"readableHighWaterMark",{enumerable:!1,get:function(){return this._readableState.highWaterMark}}),y._fromList=O,j_}function q_(){if(W_)return H_;W_=1,H_=i;var t=N_(),e=Object.create(y_());function r(t,e){var r=this._transformState;r.transforming=!1;var i=r.writecb;if(!i)return this.emit("error",new Error("write callback called multiple times"));r.writechunk=null,r.writecb=null,null!=e&&this.push(e),i(t);var n=this._readableState;n.reading=!1,(n.needReadable||n.length<n.highWaterMark)&&this._read(n.highWaterMark)}function i(e){if(!(this instanceof i))return new i(e);t.call(this,e),this._transformState={afterTransform:r.bind(this),needTransform:!1,transforming:!1,writecb:null,writechunk:null,writeencoding:null},this._readableState.needReadable=!0,this._readableState.sync=!1,e&&("function"==typeof e.transform&&(this._transform=e.transform),"function"==typeof e.flush&&(this._flush=e.flush)),this.on("prefinish",n)}function n(){var t=this;"function"==typeof this._flush?this._flush((function(e,r){s(t,e,r)})):s(this,null,null)}function s(t,e,r){if(e)return t.emit("error",e);if(null!=r&&t.push(r),t._writableState.length)throw new Error("Calling transform done when ws.length != 0");if(t._transformState.transforming)throw new Error("Calling transform done when still transforming");return t.push(null)}return e.inherits=x_(),e.inherits(i,t),i.prototype.push=function(e,r){return this._transformState.needTransform=!1,t.prototype.push.call(this,e,r)},i.prototype._transform=function(t,e,r){throw new Error("_transform() is not implemented")},i.prototype._write=function(t,e,r){var i=this._transformState;if(i.writecb=r,i.writechunk=t,i.writeencoding=e,!i.transforming){var n=this._readableState;(i.needTransform||n.needReadable||n.length<n.highWaterMark)&&this._read(n.highWaterMark)}},i.prototype._read=function(t){var e=this._transformState;null!==e.writechunk&&e.writecb&&!e.transforming?(e.transforming=!0,this._transform(e.writechunk,e.writeencoding,e.afterTransform)):e.needTransform=!0},i.prototype._destroy=function(e,r){var i=this;t.prototype._destroy.call(this,e,(function(t){r(t),i.emit("close")}))},H_}function Z_(){return V_||(V_=1,function(t,e){var r=n;"disable"===process.env.READABLE_STREAM&&r?(t.exports=r,(e=t.exports=r.Readable).Readable=r.Readable,e.Writable=r.Writable,e.Duplex=r.Duplex,e.Transform=r.Transform,e.PassThrough=r.PassThrough,e.Stream=r):((e=t.exports=Y_()).Stream=r||e,e.Readable=e,e.Writable=I_(),e.Duplex=N_(),e.Transform=q_(),e.PassThrough=function(){if($_)return U_;$_=1,U_=r;var t=q_(),e=Object.create(y_());function r(e){if(!(this instanceof r))return new r(e);t.call(this,e)}return e.inherits=x_(),e.inherits(r,t),r.prototype._transform=function(t,e,r){r(null,t)},U_}())}(l_,l_.exports)),l_.exports}if(a_.base64=!0,a_.array=!0,a_.string=!0,a_.arraybuffer="undefined"!=typeof ArrayBuffer&&"undefined"!=typeof Uint8Array,a_.nodebuffer="undefined"!=typeof Buffer,a_.uint8array="undefined"!=typeof Uint8Array,"undefined"==typeof ArrayBuffer)a_.blob=!1;else{var K_=new ArrayBuffer(0);try{a_.blob=0===new Blob([K_],{type:"application/zip"}).size}catch(t){try{var Q_=new(self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder);Q_.append(K_),a_.blob=0===Q_.getBlob("application/zip").size}catch(t){a_.blob=!1}}}try{a_.nodestream=!!Z_().Readable}catch(t){a_.nodestream=!1}var J_,tw={};function ew(){if(J_)return tw;J_=1;var t=cw(),e=a_,r="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";return tw.encode=function(e){for(var i,n,s,o,a,l,h,c=[],u=0,d=e.length,p=d,f="string"!==t.getTypeOf(e);u<e.length;)p=d-u,f?(i=e[u++],n=u<d?e[u++]:0,s=u<d?e[u++]:0):(i=e.charCodeAt(u++),n=u<d?e.charCodeAt(u++):0,s=u<d?e.charCodeAt(u++):0),o=i>>2,a=(3&i)<<4|n>>4,l=p>1?(15&n)<<2|s>>6:64,h=p>2?63&s:64,c.push(r.charAt(o)+r.charAt(a)+r.charAt(l)+r.charAt(h));return c.join("")},tw.decode=function(t){var i,n,s,o,a,l,h=0,c=0,u="data:";if(t.substr(0,5)===u)throw new Error("Invalid base64 input, it looks like a data url.");var d,p=3*(t=t.replace(/[^A-Za-z0-9+/=]/g,"")).length/4;if(t.charAt(t.length-1)===r.charAt(64)&&p--,t.charAt(t.length-2)===r.charAt(64)&&p--,p%1!=0)throw new Error("Invalid base64 input, bad content length.");for(d=e.uint8array?new Uint8Array(0|p):new Array(0|p);h<t.length;)i=r.indexOf(t.charAt(h++))<<2|(o=r.indexOf(t.charAt(h++)))>>4,n=(15&o)<<4|(a=r.indexOf(t.charAt(h++)))>>2,s=(3&a)<<6|(l=r.indexOf(t.charAt(h++))),d[c++]=i,64!==a&&(d[c++]=n),64!==l&&(d[c++]=s);return d},tw}var rw,iw,nw,sw,ow={isNode:"undefined"!=typeof Buffer,newBufferFrom:function(t,e){if(Buffer.from&&Buffer.from!==Uint8Array.from)return Buffer.from(t,e);if("number"==typeof t)throw new Error('The "data" argument must not be a number');return new Buffer(t,e)},allocBuffer:function(t){if(Buffer.alloc)return Buffer.alloc(t);var e=new Buffer(t);return e.fill(0),e},isBuffer:function(t){return Buffer.isBuffer(t)},isStream:function(t){return t&&"function"==typeof t.on&&"function"==typeof t.pause&&"function"==typeof t.resume}};var aw=null;aw="undefined"!=typeof Promise?Promise:function(){if(sw)return nw;sw=1;var t=function(){if(iw)return rw;iw=1;var t,e,r=dt.MutationObserver||dt.WebKitMutationObserver;if(process.browser)if(r){var i=0,n=new r(l),s=dt.document.createTextNode("");n.observe(s,{characterData:!0}),t=function(){s.data=i=++i%2}}else if(dt.setImmediate||void 0===dt.MessageChannel)t="document"in dt&&"onreadystatechange"in dt.document.createElement("script")?function(){var t=dt.document.createElement("script");t.onreadystatechange=function(){l(),t.onreadystatechange=null,t.parentNode.removeChild(t),t=null},dt.document.documentElement.appendChild(t)}:function(){setTimeout(l,0)};else{var o=new dt.MessageChannel;o.port1.onmessage=l,t=function(){o.port2.postMessage(0)}}else t=function(){process.nextTick(l)};var a=[];function l(){var t,r;e=!0;for(var i=a.length;i;){for(r=a,a=[],t=-1;++t<i;)r[t]();i=a.length}e=!1}return rw=function(r){1!==a.push(r)||e||t()}}();function e(){}var r={},i=["REJECTED"],n=["FULFILLED"],s=["PENDING"];if(!process.browser)var o=["UNHANDLED"];function a(t){if("function"!=typeof t)throw new TypeError("resolver must be a function");this.state=s,this.queue=[],this.outcome=void 0,process.browser||(this.handled=o),t!==e&&u(this,t)}function l(t,e,r){this.promise=t,"function"==typeof e&&(this.onFulfilled=e,this.callFulfilled=this.otherCallFulfilled),"function"==typeof r&&(this.onRejected=r,this.callRejected=this.otherCallRejected)}function h(e,i,n){t((function(){var t;try{t=i(n)}catch(t){return r.reject(e,t)}t===e?r.reject(e,new TypeError("Cannot resolve promise with itself")):r.resolve(e,t)}))}function c(t){var e=t&&t.then;if(t&&("object"==typeof t||"function"==typeof t)&&"function"==typeof e)return function(){e.apply(t,arguments)}}function u(t,e){var i=!1;function n(e){i||(i=!0,r.reject(t,e))}function s(e){i||(i=!0,r.resolve(t,e))}var o=d((function(){e(s,n)}));"error"===o.status&&n(o.value)}function d(t,e){var r={};try{r.value=t(e),r.status="success"}catch(t){r.status="error",r.value=t}return r}return nw=a,a.prototype.finally=function(t){if("function"!=typeof t)return this;var e=this.constructor;return this.then((function(r){return e.resolve(t()).then((function(){return r}))}),(function(r){return e.resolve(t()).then((function(){throw r}))}))},a.prototype.catch=function(t){return this.then(null,t)},a.prototype.then=function(t,r){if("function"!=typeof t&&this.state===n||"function"!=typeof r&&this.state===i)return this;var a=new this.constructor(e);return process.browser||this.handled===o&&(this.handled=null),this.state!==s?h(a,this.state===n?t:r,this.outcome):this.queue.push(new l(a,t,r)),a},l.prototype.callFulfilled=function(t){r.resolve(this.promise,t)},l.prototype.otherCallFulfilled=function(t){h(this.promise,this.onFulfilled,t)},l.prototype.callRejected=function(t){r.reject(this.promise,t)},l.prototype.otherCallRejected=function(t){h(this.promise,this.onRejected,t)},r.resolve=function(t,e){var i=d(c,e);if("error"===i.status)return r.reject(t,i.value);var s=i.value;if(s)u(t,s);else{t.state=n,t.outcome=e;for(var o=-1,a=t.queue.length;++o<a;)t.queue[o].callFulfilled(e)}return t},r.reject=function(e,r){e.state=i,e.outcome=r,process.browser||e.handled===o&&t((function(){e.handled===o&&process.emit("unhandledRejection",r,e)}));for(var n=-1,s=e.queue.length;++n<s;)e.queue[n].callRejected(r);return e},a.resolve=function(t){return t instanceof this?t:r.resolve(new this(e),t)},a.reject=function(t){var i=new this(e);return r.reject(i,t)},a.all=function(t){var i=this;if("[object Array]"!==Object.prototype.toString.call(t))return this.reject(new TypeError("must be an array"));var n=t.length,s=!1;if(!n)return this.resolve([]);for(var o=new Array(n),a=0,l=-1,h=new this(e);++l<n;)c(t[l],l);return h;function c(t,e){i.resolve(t).then((function(t){o[e]=t,++a!==n||s||(s=!0,r.resolve(h,o))}),(function(t){s||(s=!0,r.reject(h,t))}))}},a.race=function(t){var i=this;if("[object Array]"!==Object.prototype.toString.call(t))return this.reject(new TypeError("must be an array"));var n=t.length,s=!1;if(!n)return this.resolve([]);for(var o,a=-1,l=new this(e);++a<n;)o=t[a],i.resolve(o).then((function(t){s||(s=!0,r.resolve(l,t))}),(function(t){s||(s=!0,r.reject(l,t))}));return l},nw}();var lw,hw={Promise:aw};function cw(){return lw||(lw=1,function(t){var e=a_,r=ew(),i=ow,n=hw;function s(t){return t}function o(t,e){for(var r=0;r<t.length;++r)e[r]=255&t.charCodeAt(r);return e}t.newBlob=function(e,r){t.checkSupport("blob");try{return new Blob([e],{type:r})}catch(t){try{var i=new(self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder);return i.append(e),i.getBlob(r)}catch(t){throw new Error("Bug : can't construct the Blob.")}}};var a={stringifyByChunk:function(t,e,r){var i=[],n=0,s=t.length;if(s<=r)return String.fromCharCode.apply(null,t);for(;n<s;)"array"===e||"nodebuffer"===e?i.push(String.fromCharCode.apply(null,t.slice(n,Math.min(n+r,s)))):i.push(String.fromCharCode.apply(null,t.subarray(n,Math.min(n+r,s)))),n+=r;return i.join("")},stringifyByChar:function(t){for(var e="",r=0;r<t.length;r++)e+=String.fromCharCode(t[r]);return e},applyCanBeUsed:{uint8array:function(){try{return e.uint8array&&1===String.fromCharCode.apply(null,new Uint8Array(1)).length}catch(t){return!1}}(),nodebuffer:function(){try{return e.nodebuffer&&1===String.fromCharCode.apply(null,i.allocBuffer(1)).length}catch(t){return!1}}()}};function l(e){var r=65536,i=t.getTypeOf(e),n=!0;if("uint8array"===i?n=a.applyCanBeUsed.uint8array:"nodebuffer"===i&&(n=a.applyCanBeUsed.nodebuffer),n)for(;r>1;)try{return a.stringifyByChunk(e,i,r)}catch(t){r=Math.floor(r/2)}return a.stringifyByChar(e)}function h(t,e){for(var r=0;r<t.length;r++)e[r]=t[r];return e}t.applyFromCharCode=l;var c={};c.string={string:s,array:function(t){return o(t,new Array(t.length))},arraybuffer:function(t){return c.string.uint8array(t).buffer},uint8array:function(t){return o(t,new Uint8Array(t.length))},nodebuffer:function(t){return o(t,i.allocBuffer(t.length))}},c.array={string:l,array:s,arraybuffer:function(t){return new Uint8Array(t).buffer},uint8array:function(t){return new Uint8Array(t)},nodebuffer:function(t){return i.newBufferFrom(t)}},c.arraybuffer={string:function(t){return l(new Uint8Array(t))},array:function(t){return h(new Uint8Array(t),new Array(t.byteLength))},arraybuffer:s,uint8array:function(t){return new Uint8Array(t)},nodebuffer:function(t){return i.newBufferFrom(new Uint8Array(t))}},c.uint8array={string:l,array:function(t){return h(t,new Array(t.length))},arraybuffer:function(t){return t.buffer},uint8array:s,nodebuffer:function(t){return i.newBufferFrom(t)}},c.nodebuffer={string:l,array:function(t){return h(t,new Array(t.length))},arraybuffer:function(t){return c.nodebuffer.uint8array(t).buffer},uint8array:function(t){return h(t,new Uint8Array(t.length))},nodebuffer:s},t.transformTo=function(e,r){if(r||(r=""),!e)return r;t.checkSupport(e);var i=t.getTypeOf(r);return c[i][e](r)},t.resolve=function(t){for(var e=t.split("/"),r=[],i=0;i<e.length;i++){var n=e[i];"."===n||""===n&&0!==i&&i!==e.length-1||(".."===n?r.pop():r.push(n))}return r.join("/")},t.getTypeOf=function(t){return"string"==typeof t?"string":"[object Array]"===Object.prototype.toString.call(t)?"array":e.nodebuffer&&i.isBuffer(t)?"nodebuffer":e.uint8array&&t instanceof Uint8Array?"uint8array":e.arraybuffer&&t instanceof ArrayBuffer?"arraybuffer":void 0},t.checkSupport=function(t){if(!e[t.toLowerCase()])throw new Error(t+" is not supported by this platform")},t.MAX_VALUE_16BITS=65535,t.MAX_VALUE_32BITS=-1,t.pretty=function(t){var e,r,i="";for(r=0;r<(t||"").length;r++)i+="\\x"+((e=t.charCodeAt(r))<16?"0":"")+e.toString(16).toUpperCase();return i},t.delay=function(t,e,r){setImmediate((function(){t.apply(r||null,e||[])}))},t.inherits=function(t,e){var r=function(){};r.prototype=e.prototype,t.prototype=new r},t.extend=function(){var t,e,r={};for(t=0;t<arguments.length;t++)for(e in arguments[t])Object.prototype.hasOwnProperty.call(arguments[t],e)&&void 0===r[e]&&(r[e]=arguments[t][e]);return r},t.prepareContent=function(i,s,a,l,h){var c=n.Promise.resolve(s).then((function(t){return e.blob&&(t instanceof Blob||-1!==["[object File]","[object Blob]"].indexOf(Object.prototype.toString.call(t)))&&"undefined"!=typeof FileReader?new n.Promise((function(e,r){var i=new FileReader;i.onload=function(t){e(t.target.result)},i.onerror=function(t){r(t.target.error)},i.readAsArrayBuffer(t)})):t}));return c.then((function(s){var c,u=t.getTypeOf(s);return u?("arraybuffer"===u?s=t.transformTo("uint8array",s):"string"===u&&(h?s=r.decode(s):a&&!0!==l&&(s=o(c=s,e.uint8array?new Uint8Array(c.length):new Array(c.length)))),s):n.Promise.reject(new Error("Can't read the data of '"+i+"'. Is it in a supported JavaScript type (String, Blob, ArrayBuffer, etc) ?"))}))}}(o_)),o_}function uw(t){this.name=t||"default",this.streamInfo={},this.generatedError=null,this.extraStreamInfo={},this.isPaused=!0,this.isFinished=!1,this.isLocked=!1,this._listeners={data:[],end:[],error:[]},this.previous=null}!function(t,e){if(!t.setImmediate){var r,i,n,s,o,a=1,l={},h=!1,c=t.document,u=Object.getPrototypeOf&&Object.getPrototypeOf(t);u=u&&u.setTimeout?u:t,"[object process]"==={}.toString.call(t.process)?r=function(t){process.nextTick((function(){p(t)}))}:!function(){if(t.postMessage&&!t.importScripts){var e=!0,r=t.onmessage;return t.onmessage=function(){e=!1},t.postMessage("","*"),t.onmessage=r,e}}()?t.MessageChannel?((n=new MessageChannel).port1.onmessage=function(t){p(t.data)},r=function(t){n.port2.postMessage(t)}):c&&"onreadystatechange"in c.createElement("script")?(i=c.documentElement,r=function(t){var e=c.createElement("script");e.onreadystatechange=function(){p(t),e.onreadystatechange=null,i.removeChild(e),e=null},i.appendChild(e)}):r=function(t){setTimeout(p,0,t)}:(s="setImmediate$"+Math.random()+"$",o=function(e){e.source===t&&"string"==typeof e.data&&0===e.data.indexOf(s)&&p(+e.data.slice(s.length))},t.addEventListener?t.addEventListener("message",o,!1):t.attachEvent("onmessage",o),r=function(e){t.postMessage(s+e,"*")}),u.setImmediate=function(t){"function"!=typeof t&&(t=new Function(""+t));for(var e=new Array(arguments.length-1),i=0;i<e.length;i++)e[i]=arguments[i+1];var n={callback:t,args:e};return l[a]=n,r(a),a++},u.clearImmediate=d}function d(t){delete l[t]}function p(t){if(h)setTimeout(p,0,t);else{var r=l[t];if(r){h=!0;try{!function(t){var r=t.callback,i=t.args;switch(i.length){case 0:r();break;case 1:r(i[0]);break;case 2:r(i[0],i[1]);break;case 3:r(i[0],i[1],i[2]);break;default:r.apply(e,i)}}(r)}finally{d(t),h=!1}}}}}("undefined"==typeof self?dt:self),uw.prototype={push:function(t){this.emit("data",t)},end:function(){if(this.isFinished)return!1;this.flush();try{this.emit("end"),this.cleanUp(),this.isFinished=!0}catch(t){this.emit("error",t)}return!0},error:function(t){return!this.isFinished&&(this.isPaused?this.generatedError=t:(this.isFinished=!0,this.emit("error",t),this.previous&&this.previous.error(t),this.cleanUp()),!0)},on:function(t,e){return this._listeners[t].push(e),this},cleanUp:function(){this.streamInfo=this.generatedError=this.extraStreamInfo=null,this._listeners=[]},emit:function(t,e){if(this._listeners[t])for(var r=0;r<this._listeners[t].length;r++)this._listeners[t][r].call(this,e)},pipe:function(t){return t.registerPrevious(this)},registerPrevious:function(t){if(this.isLocked)throw new Error("The stream '"+this+"' has already been used.");this.streamInfo=t.streamInfo,this.mergeStreamInfo(),this.previous=t;var e=this;return t.on("data",(function(t){e.processChunk(t)})),t.on("end",(function(){e.end()})),t.on("error",(function(t){e.error(t)})),this},pause:function(){return!this.isPaused&&!this.isFinished&&(this.isPaused=!0,this.previous&&this.previous.pause(),!0)},resume:function(){if(!this.isPaused||this.isFinished)return!1;this.isPaused=!1;var t=!1;return this.generatedError&&(this.error(this.generatedError),t=!0),this.previous&&this.previous.resume(),!t},flush:function(){},processChunk:function(t){this.push(t)},withStreamInfo:function(t,e){return this.extraStreamInfo[t]=e,this.mergeStreamInfo(),this},mergeStreamInfo:function(){for(var t in this.extraStreamInfo)Object.prototype.hasOwnProperty.call(this.extraStreamInfo,t)&&(this.streamInfo[t]=this.extraStreamInfo[t])},lock:function(){if(this.isLocked)throw new Error("The stream '"+this+"' has already been used.");this.isLocked=!0,this.previous&&this.previous.lock()},toString:function(){var t="Worker "+this.name;return this.previous?this.previous+" -> "+t:t}};var dw=uw;!function(t){for(var e=cw(),r=a_,i=ow,n=dw,s=new Array(256),o=0;o<256;o++)s[o]=o>=252?6:o>=248?5:o>=240?4:o>=224?3:o>=192?2:1;s[254]=s[254]=1;function a(){n.call(this,"utf-8 decode"),this.leftOver=null}function l(){n.call(this,"utf-8 encode")}t.utf8encode=function(t){return r.nodebuffer?i.newBufferFrom(t,"utf-8"):function(t){var e,i,n,s,o,a=t.length,l=0;for(s=0;s<a;s++)55296==(64512&(i=t.charCodeAt(s)))&&s+1<a&&56320==(64512&(n=t.charCodeAt(s+1)))&&(i=65536+(i-55296<<10)+(n-56320),s++),l+=i<128?1:i<2048?2:i<65536?3:4;for(e=r.uint8array?new Uint8Array(l):new Array(l),o=0,s=0;o<l;s++)55296==(64512&(i=t.charCodeAt(s)))&&s+1<a&&56320==(64512&(n=t.charCodeAt(s+1)))&&(i=65536+(i-55296<<10)+(n-56320),s++),i<128?e[o++]=i:i<2048?(e[o++]=192|i>>>6,e[o++]=128|63&i):i<65536?(e[o++]=224|i>>>12,e[o++]=128|i>>>6&63,e[o++]=128|63&i):(e[o++]=240|i>>>18,e[o++]=128|i>>>12&63,e[o++]=128|i>>>6&63,e[o++]=128|63&i);return e}(t)},t.utf8decode=function(t){return r.nodebuffer?e.transformTo("nodebuffer",t).toString("utf-8"):function(t){var r,i,n,o,a=t.length,l=new Array(2*a);for(i=0,r=0;r<a;)if((n=t[r++])<128)l[i++]=n;else if((o=s[n])>4)l[i++]=65533,r+=o-1;else{for(n&=2===o?31:3===o?15:7;o>1&&r<a;)n=n<<6|63&t[r++],o--;o>1?l[i++]=65533:n<65536?l[i++]=n:(n-=65536,l[i++]=55296|n>>10&1023,l[i++]=56320|1023&n)}return l.length!==i&&(l.subarray?l=l.subarray(0,i):l.length=i),e.applyFromCharCode(l)}(t=e.transformTo(r.uint8array?"uint8array":"array",t))},e.inherits(a,n),a.prototype.processChunk=function(i){var n=e.transformTo(r.uint8array?"uint8array":"array",i.data);if(this.leftOver&&this.leftOver.length){if(r.uint8array){var o=n;(n=new Uint8Array(o.length+this.leftOver.length)).set(this.leftOver,0),n.set(o,this.leftOver.length)}else n=this.leftOver.concat(n);this.leftOver=null}var a=function(t,e){var r;for((e=e||t.length)>t.length&&(e=t.length),r=e-1;r>=0&&128==(192&t[r]);)r--;return r<0||0===r?e:r+s[t[r]]>e?r:e}(n),l=n;a!==n.length&&(r.uint8array?(l=n.subarray(0,a),this.leftOver=n.subarray(a,n.length)):(l=n.slice(0,a),this.leftOver=n.slice(a,n.length))),this.push({data:t.utf8decode(l),meta:i.meta})},a.prototype.flush=function(){this.leftOver&&this.leftOver.length&&(this.push({data:t.utf8decode(this.leftOver),meta:{}}),this.leftOver=null)},t.Utf8DecodeWorker=a,e.inherits(l,n),l.prototype.processChunk=function(e){this.push({data:t.utf8encode(e.data),meta:e.meta})},t.Utf8EncodeWorker=l}(s_);var pw=dw,fw=cw();function gw(t){pw.call(this,"ConvertWorker to "+t),this.destType=t}fw.inherits(gw,pw),gw.prototype.processChunk=function(t){this.push({data:fw.transformTo(this.destType,t.data),meta:t.meta})};var mw,yw,vw=gw;var bw=cw(),_w=vw,ww=dw,xw=ew(),Sw=hw,Tw=null;if(a_.nodestream)try{Tw=function(){if(yw)return mw;yw=1;var t=Z_().Readable;function e(e,r,i){t.call(this,r),this._helper=e;var n=this;e.on("data",(function(t,e){n.push(t)||n._helper.pause(),i&&i(e)})).on("error",(function(t){n.emit("error",t)})).on("end",(function(){n.push(null)}))}return cw().inherits(e,t),e.prototype._read=function(){this._helper.resume()},mw=e}()}catch(t){}function kw(t,e){return new Sw.Promise((function(r,i){var n=[],s=t._internalType,o=t._outputType,a=t._mimeType;t.on("data",(function(t,r){n.push(t),e&&e(r)})).on("error",(function(t){n=[],i(t)})).on("end",(function(){try{var t=function(t,e,r){switch(t){case"blob":return bw.newBlob(bw.transformTo("arraybuffer",e),r);case"base64":return xw.encode(e);default:return bw.transformTo(t,e)}}(o,function(t,e){var r,i=0,n=null,s=0;for(r=0;r<e.length;r++)s+=e[r].length;switch(t){case"string":return e.join("");case"array":return Array.prototype.concat.apply([],e);case"uint8array":for(n=new Uint8Array(s),r=0;r<e.length;r++)n.set(e[r],i),i+=e[r].length;return n;case"nodebuffer":return Buffer.concat(e);default:throw new Error("concat : unsupported type '"+t+"'")}}(s,n),a);r(t)}catch(t){i(t)}n=[]})).resume()}))}function Cw(t,e,r){var i=e;switch(e){case"blob":case"arraybuffer":i="uint8array";break;case"base64":i="string"}try{this._internalType=i,this._outputType=e,this._mimeType=r,bw.checkSupport(i),this._worker=t.pipe(new _w(i)),t.lock()}catch(t){this._worker=new ww("error"),this._worker.error(t)}}Cw.prototype={accumulate:function(t){return kw(this,t)},on:function(t,e){var r=this;return"data"===t?this._worker.on(t,(function(t){e.call(r,t.data,t.meta)})):this._worker.on(t,(function(){bw.delay(e,arguments,r)})),this},resume:function(){return bw.delay(this._worker.resume,[],this._worker),this},pause:function(){return this._worker.pause(),this},toNodejsStream:function(t){if(bw.checkSupport("nodestream"),"nodebuffer"!==this._outputType)throw new Error(this._outputType+" is not supported by this method");return new Tw(this,{objectMode:"nodebuffer"!==this._outputType},t)}};var Ew=Cw,Aw={base64:!1,binary:!1,dir:!1,createFolders:!0,date:null,compression:null,compressionOptions:null,comment:null,unixPermissions:null,dosPermissions:null},Ow=cw(),Bw=dw;function Rw(t){Bw.call(this,"DataWorker");var e=this;this.dataIsReady=!1,this.index=0,this.max=0,this.data=null,this.type="",this._tickScheduled=!1,t.then((function(t){e.dataIsReady=!0,e.data=t,e.max=t&&t.length||0,e.type=Ow.getTypeOf(t),e.isPaused||e._tickAndRepeat()}),(function(t){e.error(t)}))}Ow.inherits(Rw,Bw),Rw.prototype.cleanUp=function(){Bw.prototype.cleanUp.call(this),this.data=null},Rw.prototype.resume=function(){return!!Bw.prototype.resume.call(this)&&(!this._tickScheduled&&this.dataIsReady&&(this._tickScheduled=!0,Ow.delay(this._tickAndRepeat,[],this)),!0)},Rw.prototype._tickAndRepeat=function(){this._tickScheduled=!1,this.isPaused||this.isFinished||(this._tick(),this.isFinished||(Ow.delay(this._tickAndRepeat,[],this),this._tickScheduled=!0))},Rw.prototype._tick=function(){if(this.isPaused||this.isFinished)return!1;var t=null,e=Math.min(this.max,this.index+16384);if(this.index>=this.max)return this.end();switch(this.type){case"string":t=this.data.substring(this.index,e);break;case"uint8array":t=this.data.subarray(this.index,e);break;case"array":case"nodebuffer":t=this.data.slice(this.index,e)}return this.index=e,this.push({data:t,meta:{percent:this.max?this.index/this.max*100:0}})};var Lw=Rw,Pw=cw();var Dw=function(){for(var t,e=[],r=0;r<256;r++){t=r;for(var i=0;i<8;i++)t=1&t?3988292384^t>>>1:t>>>1;e[r]=t}return e}();var Mw=function(t,e){return void 0!==t&&t.length?"string"!==Pw.getTypeOf(t)?function(t,e,r,i){var n=Dw,s=i+r;t^=-1;for(var o=i;o<s;o++)t=t>>>8^n[255&(t^e[o])];return-1^t}(0|e,t,t.length,0):function(t,e,r,i){var n=Dw,s=i+r;t^=-1;for(var o=i;o<s;o++)t=t>>>8^n[255&(t^e.charCodeAt(o))];return-1^t}(0|e,t,t.length,0):0},Iw=dw,Nw=Mw;function Fw(){Iw.call(this,"Crc32Probe"),this.withStreamInfo("crc32",0)}cw().inherits(Fw,Iw),Fw.prototype.processChunk=function(t){this.streamInfo.crc32=Nw(t.data,this.streamInfo.crc32||0),this.push(t)};var jw=Fw,zw=cw(),Hw=dw;function Ww(t){Hw.call(this,"DataLengthProbe for "+t),this.propName=t,this.withStreamInfo(t,0)}zw.inherits(Ww,Hw),Ww.prototype.processChunk=function(t){if(t){var e=this.streamInfo[this.propName]||0;this.streamInfo[this.propName]=e+t.data.length}Hw.prototype.processChunk.call(this,t)};var Uw=hw,$w=Lw,Vw=jw,Gw=Ww;function Xw(t,e,r,i,n){this.compressedSize=t,this.uncompressedSize=e,this.crc32=r,this.compression=i,this.compressedContent=n}Xw.prototype={getContentWorker:function(){var t=new $w(Uw.Promise.resolve(this.compressedContent)).pipe(this.compression.uncompressWorker()).pipe(new Gw("data_length")),e=this;return t.on("end",(function(){if(this.streamInfo.data_length!==e.uncompressedSize)throw new Error("Bug : uncompressed data size mismatch")})),t},getCompressedWorker:function(){return new $w(Uw.Promise.resolve(this.compressedContent)).withStreamInfo("compressedSize",this.compressedSize).withStreamInfo("uncompressedSize",this.uncompressedSize).withStreamInfo("crc32",this.crc32).withStreamInfo("compression",this.compression)}},Xw.createWorkerFrom=function(t,e,r){return t.pipe(new Vw).pipe(new Gw("uncompressedSize")).pipe(e.compressWorker(r)).pipe(new Gw("compressedSize")).withStreamInfo("compression",e)};var Yw=Xw,qw=Ew,Zw=Lw,Kw=s_,Qw=Yw,Jw=dw,tx=function(t,e,r){this.name=t,this.dir=r.dir,this.date=r.date,this.comment=r.comment,this.unixPermissions=r.unixPermissions,this.dosPermissions=r.dosPermissions,this._data=e,this._dataBinary=r.binary,this.options={compression:r.compression,compressionOptions:r.compressionOptions}};tx.prototype={internalStream:function(t){var e=null,r="string";try{if(!t)throw new Error("No output type specified.");var i="string"===(r=t.toLowerCase())||"text"===r;"binarystring"!==r&&"text"!==r||(r="string"),e=this._decompressWorker();var n=!this._dataBinary;n&&!i&&(e=e.pipe(new Kw.Utf8EncodeWorker)),!n&&i&&(e=e.pipe(new Kw.Utf8DecodeWorker))}catch(t){(e=new Jw("error")).error(t)}return new qw(e,r,"")},async:function(t,e){return this.internalStream(t).accumulate(e)},nodeStream:function(t,e){return this.internalStream(t||"nodebuffer").toNodejsStream(e)},_compressWorker:function(t,e){if(this._data instanceof Qw&&this._data.compression.magic===t.magic)return this._data.getCompressedWorker();var r=this._decompressWorker();return this._dataBinary||(r=r.pipe(new Kw.Utf8EncodeWorker)),Qw.createWorkerFrom(r,t,e)},_decompressWorker:function(){return this._data instanceof Qw?this._data.getContentWorker():this._data instanceof Jw?this._data:new Zw(this._data)}};for(var ex=["asText","asBinary","asNodeBuffer","asUint8Array","asArrayBuffer"],rx=function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},ix=0;ix<ex.length;ix++)tx.prototype[ex[ix]]=rx;var nx=tx,sx={},ox={},ax={},lx={};!function(t){var e="undefined"!=typeof Uint8Array&&"undefined"!=typeof Uint16Array&&"undefined"!=typeof Int32Array;function r(t,e){return Object.prototype.hasOwnProperty.call(t,e)}t.assign=function(t){for(var e=Array.prototype.slice.call(arguments,1);e.length;){var i=e.shift();if(i){if("object"!=typeof i)throw new TypeError(i+"must be non-object");for(var n in i)r(i,n)&&(t[n]=i[n])}}return t},t.shrinkBuf=function(t,e){return t.length===e?t:t.subarray?t.subarray(0,e):(t.length=e,t)};var i={arraySet:function(t,e,r,i,n){if(e.subarray&&t.subarray)t.set(e.subarray(r,r+i),n);else for(var s=0;s<i;s++)t[n+s]=e[r+s]},flattenChunks:function(t){var e,r,i,n,s,o;for(i=0,e=0,r=t.length;e<r;e++)i+=t[e].length;for(o=new Uint8Array(i),n=0,e=0,r=t.length;e<r;e++)s=t[e],o.set(s,n),n+=s.length;return o}},n={arraySet:function(t,e,r,i,n){for(var s=0;s<i;s++)t[n+s]=e[r+s]},flattenChunks:function(t){return[].concat.apply([],t)}};t.setTyped=function(e){e?(t.Buf8=Uint8Array,t.Buf16=Uint16Array,t.Buf32=Int32Array,t.assign(t,i)):(t.Buf8=Array,t.Buf16=Array,t.Buf32=Array,t.assign(t,n))},t.setTyped(e)}(lx);var hx={},cx={},ux={},dx=lx,px=0,fx=1;function gx(t){for(var e=t.length;--e>=0;)t[e]=0}var mx=0,yx=29,vx=256,bx=vx+1+yx,_x=30,wx=19,xx=2*bx+1,Sx=15,Tx=16,kx=7,Cx=256,Ex=16,Ax=17,Ox=18,Bx=[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0],Rx=[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13],Lx=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],Px=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],Dx=new Array(2*(bx+2));gx(Dx);var Mx=new Array(2*_x);gx(Mx);var Ix=new Array(512);gx(Ix);var Nx=new Array(256);gx(Nx);var Fx=new Array(yx);gx(Fx);var jx,zx,Hx,Wx=new Array(_x);function Ux(t,e,r,i,n){this.static_tree=t,this.extra_bits=e,this.extra_base=r,this.elems=i,this.max_length=n,this.has_stree=t&&t.length}function $x(t,e){this.dyn_tree=t,this.max_code=0,this.stat_desc=e}function Vx(t){return t<256?Ix[t]:Ix[256+(t>>>7)]}function Gx(t,e){t.pending_buf[t.pending++]=255&e,t.pending_buf[t.pending++]=e>>>8&255}function Xx(t,e,r){t.bi_valid>Tx-r?(t.bi_buf|=e<<t.bi_valid&65535,Gx(t,t.bi_buf),t.bi_buf=e>>Tx-t.bi_valid,t.bi_valid+=r-Tx):(t.bi_buf|=e<<t.bi_valid&65535,t.bi_valid+=r)}function Yx(t,e,r){Xx(t,r[2*e],r[2*e+1])}function qx(t,e){var r=0;do{r|=1&t,t>>>=1,r<<=1}while(--e>0);return r>>>1}function Zx(t,e,r){var i,n,s=new Array(Sx+1),o=0;for(i=1;i<=Sx;i++)s[i]=o=o+r[i-1]<<1;for(n=0;n<=e;n++){var a=t[2*n+1];0!==a&&(t[2*n]=qx(s[a]++,a))}}function Kx(t){var e;for(e=0;e<bx;e++)t.dyn_ltree[2*e]=0;for(e=0;e<_x;e++)t.dyn_dtree[2*e]=0;for(e=0;e<wx;e++)t.bl_tree[2*e]=0;t.dyn_ltree[2*Cx]=1,t.opt_len=t.static_len=0,t.last_lit=t.matches=0}function Qx(t){t.bi_valid>8?Gx(t,t.bi_buf):t.bi_valid>0&&(t.pending_buf[t.pending++]=t.bi_buf),t.bi_buf=0,t.bi_valid=0}function Jx(t,e,r,i){var n=2*e,s=2*r;return t[n]<t[s]||t[n]===t[s]&&i[e]<=i[r]}function tS(t,e,r){for(var i=t.heap[r],n=r<<1;n<=t.heap_len&&(n<t.heap_len&&Jx(e,t.heap[n+1],t.heap[n],t.depth)&&n++,!Jx(e,i,t.heap[n],t.depth));)t.heap[r]=t.heap[n],r=n,n<<=1;t.heap[r]=i}function eS(t,e,r){var i,n,s,o,a=0;if(0!==t.last_lit)do{i=t.pending_buf[t.d_buf+2*a]<<8|t.pending_buf[t.d_buf+2*a+1],n=t.pending_buf[t.l_buf+a],a++,0===i?Yx(t,n,e):(Yx(t,(s=Nx[n])+vx+1,e),0!==(o=Bx[s])&&Xx(t,n-=Fx[s],o),Yx(t,s=Vx(--i),r),0!==(o=Rx[s])&&Xx(t,i-=Wx[s],o))}while(a<t.last_lit);Yx(t,Cx,e)}function rS(t,e){var r,i,n,s=e.dyn_tree,o=e.stat_desc.static_tree,a=e.stat_desc.has_stree,l=e.stat_desc.elems,h=-1;for(t.heap_len=0,t.heap_max=xx,r=0;r<l;r++)0!==s[2*r]?(t.heap[++t.heap_len]=h=r,t.depth[r]=0):s[2*r+1]=0;for(;t.heap_len<2;)s[2*(n=t.heap[++t.heap_len]=h<2?++h:0)]=1,t.depth[n]=0,t.opt_len--,a&&(t.static_len-=o[2*n+1]);for(e.max_code=h,r=t.heap_len>>1;r>=1;r--)tS(t,s,r);n=l;do{r=t.heap[1],t.heap[1]=t.heap[t.heap_len--],tS(t,s,1),i=t.heap[1],t.heap[--t.heap_max]=r,t.heap[--t.heap_max]=i,s[2*n]=s[2*r]+s[2*i],t.depth[n]=(t.depth[r]>=t.depth[i]?t.depth[r]:t.depth[i])+1,s[2*r+1]=s[2*i+1]=n,t.heap[1]=n++,tS(t,s,1)}while(t.heap_len>=2);t.heap[--t.heap_max]=t.heap[1],function(t,e){var r,i,n,s,o,a,l=e.dyn_tree,h=e.max_code,c=e.stat_desc.static_tree,u=e.stat_desc.has_stree,d=e.stat_desc.extra_bits,p=e.stat_desc.extra_base,f=e.stat_desc.max_length,g=0;for(s=0;s<=Sx;s++)t.bl_count[s]=0;for(l[2*t.heap[t.heap_max]+1]=0,r=t.heap_max+1;r<xx;r++)(s=l[2*l[2*(i=t.heap[r])+1]+1]+1)>f&&(s=f,g++),l[2*i+1]=s,i>h||(t.bl_count[s]++,o=0,i>=p&&(o=d[i-p]),a=l[2*i],t.opt_len+=a*(s+o),u&&(t.static_len+=a*(c[2*i+1]+o)));if(0!==g){do{for(s=f-1;0===t.bl_count[s];)s--;t.bl_count[s]--,t.bl_count[s+1]+=2,t.bl_count[f]--,g-=2}while(g>0);for(s=f;0!==s;s--)for(i=t.bl_count[s];0!==i;)(n=t.heap[--r])>h||(l[2*n+1]!==s&&(t.opt_len+=(s-l[2*n+1])*l[2*n],l[2*n+1]=s),i--)}}(t,e),Zx(s,h,t.bl_count)}function iS(t,e,r){var i,n,s=-1,o=e[1],a=0,l=7,h=4;for(0===o&&(l=138,h=3),e[2*(r+1)+1]=65535,i=0;i<=r;i++)n=o,o=e[2*(i+1)+1],++a<l&&n===o||(a<h?t.bl_tree[2*n]+=a:0!==n?(n!==s&&t.bl_tree[2*n]++,t.bl_tree[2*Ex]++):a<=10?t.bl_tree[2*Ax]++:t.bl_tree[2*Ox]++,a=0,s=n,0===o?(l=138,h=3):n===o?(l=6,h=3):(l=7,h=4))}function nS(t,e,r){var i,n,s=-1,o=e[1],a=0,l=7,h=4;for(0===o&&(l=138,h=3),i=0;i<=r;i++)if(n=o,o=e[2*(i+1)+1],!(++a<l&&n===o)){if(a<h)do{Yx(t,n,t.bl_tree)}while(0!=--a);else 0!==n?(n!==s&&(Yx(t,n,t.bl_tree),a--),Yx(t,Ex,t.bl_tree),Xx(t,a-3,2)):a<=10?(Yx(t,Ax,t.bl_tree),Xx(t,a-3,3)):(Yx(t,Ox,t.bl_tree),Xx(t,a-11,7));a=0,s=n,0===o?(l=138,h=3):n===o?(l=6,h=3):(l=7,h=4)}}gx(Wx);var sS=!1;function oS(t,e,r,i){Xx(t,(mx<<1)+(i?1:0),3),function(t,e,r,i){Qx(t),i&&(Gx(t,r),Gx(t,~r)),dx.arraySet(t.pending_buf,t.window,e,r,t.pending),t.pending+=r}(t,e,r,!0)}ux._tr_init=function(t){sS||(!function(){var t,e,r,i,n,s=new Array(Sx+1);for(r=0,i=0;i<yx-1;i++)for(Fx[i]=r,t=0;t<1<<Bx[i];t++)Nx[r++]=i;for(Nx[r-1]=i,n=0,i=0;i<16;i++)for(Wx[i]=n,t=0;t<1<<Rx[i];t++)Ix[n++]=i;for(n>>=7;i<_x;i++)for(Wx[i]=n<<7,t=0;t<1<<Rx[i]-7;t++)Ix[256+n++]=i;for(e=0;e<=Sx;e++)s[e]=0;for(t=0;t<=143;)Dx[2*t+1]=8,t++,s[8]++;for(;t<=255;)Dx[2*t+1]=9,t++,s[9]++;for(;t<=279;)Dx[2*t+1]=7,t++,s[7]++;for(;t<=287;)Dx[2*t+1]=8,t++,s[8]++;for(Zx(Dx,bx+1,s),t=0;t<_x;t++)Mx[2*t+1]=5,Mx[2*t]=qx(t,5);jx=new Ux(Dx,Bx,vx+1,bx,Sx),zx=new Ux(Mx,Rx,0,_x,Sx),Hx=new Ux(new Array(0),Lx,0,wx,kx)}(),sS=!0),t.l_desc=new $x(t.dyn_ltree,jx),t.d_desc=new $x(t.dyn_dtree,zx),t.bl_desc=new $x(t.bl_tree,Hx),t.bi_buf=0,t.bi_valid=0,Kx(t)},ux._tr_stored_block=oS,ux._tr_flush_block=function(t,e,r,i){var n,s,o=0;t.level>0?(2===t.strm.data_type&&(t.strm.data_type=function(t){var e,r=4093624447;for(e=0;e<=31;e++,r>>>=1)if(1&r&&0!==t.dyn_ltree[2*e])return px;if(0!==t.dyn_ltree[18]||0!==t.dyn_ltree[20]||0!==t.dyn_ltree[26])return fx;for(e=32;e<vx;e++)if(0!==t.dyn_ltree[2*e])return fx;return px}(t)),rS(t,t.l_desc),rS(t,t.d_desc),o=function(t){var e;for(iS(t,t.dyn_ltree,t.l_desc.max_code),iS(t,t.dyn_dtree,t.d_desc.max_code),rS(t,t.bl_desc),e=wx-1;e>=3&&0===t.bl_tree[2*Px[e]+1];e--);return t.opt_len+=3*(e+1)+5+5+4,e}(t),n=t.opt_len+3+7>>>3,(s=t.static_len+3+7>>>3)<=n&&(n=s)):n=s=r+5,r+4<=n&&-1!==e?oS(t,e,r,i):4===t.strategy||s===n?(Xx(t,2+(i?1:0),3),eS(t,Dx,Mx)):(Xx(t,4+(i?1:0),3),function(t,e,r,i){var n;for(Xx(t,e-257,5),Xx(t,r-1,5),Xx(t,i-4,4),n=0;n<i;n++)Xx(t,t.bl_tree[2*Px[n]+1],3);nS(t,t.dyn_ltree,e-1),nS(t,t.dyn_dtree,r-1)}(t,t.l_desc.max_code+1,t.d_desc.max_code+1,o+1),eS(t,t.dyn_ltree,t.dyn_dtree)),Kx(t),i&&Qx(t)},ux._tr_tally=function(t,e,r){return t.pending_buf[t.d_buf+2*t.last_lit]=e>>>8&255,t.pending_buf[t.d_buf+2*t.last_lit+1]=255&e,t.pending_buf[t.l_buf+t.last_lit]=255&r,t.last_lit++,0===e?t.dyn_ltree[2*r]++:(t.matches++,e--,t.dyn_ltree[2*(Nx[r]+vx+1)]++,t.dyn_dtree[2*Vx(e)]++),t.last_lit===t.lit_bufsize-1},ux._tr_align=function(t){Xx(t,2,3),Yx(t,Cx,Dx),function(t){16===t.bi_valid?(Gx(t,t.bi_buf),t.bi_buf=0,t.bi_valid=0):t.bi_valid>=8&&(t.pending_buf[t.pending++]=255&t.bi_buf,t.bi_buf>>=8,t.bi_valid-=8)}(t)};var aS=function(t,e,r,i){for(var n=65535&t|0,s=t>>>16&65535|0,o=0;0!==r;){r-=o=r>2e3?2e3:r;do{s=s+(n=n+e[i++]|0)|0}while(--o);n%=65521,s%=65521}return n|s<<16|0};var lS=function(){for(var t,e=[],r=0;r<256;r++){t=r;for(var i=0;i<8;i++)t=1&t?3988292384^t>>>1:t>>>1;e[r]=t}return e}();var hS,cS=function(t,e,r,i){var n=lS,s=i+r;t^=-1;for(var o=i;o<s;o++)t=t>>>8^n[255&(t^e[o])];return-1^t},uS={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"},dS=lx,pS=ux,fS=aS,gS=cS,mS=uS,yS=0,vS=4,bS=0,_S=-2,wS=-1,xS=4,SS=2,TS=8,kS=9,CS=286,ES=30,AS=19,OS=2*CS+1,BS=15,RS=3,LS=258,PS=LS+RS+1,DS=42,MS=103,IS=113,NS=666,FS=1,jS=2,zS=3,HS=4;function WS(t,e){return t.msg=mS[e],e}function US(t){return(t<<1)-(t>4?9:0)}function $S(t){for(var e=t.length;--e>=0;)t[e]=0}function VS(t){var e=t.state,r=e.pending;r>t.avail_out&&(r=t.avail_out),0!==r&&(dS.arraySet(t.output,e.pending_buf,e.pending_out,r,t.next_out),t.next_out+=r,e.pending_out+=r,t.total_out+=r,t.avail_out-=r,e.pending-=r,0===e.pending&&(e.pending_out=0))}function GS(t,e){pS._tr_flush_block(t,t.block_start>=0?t.block_start:-1,t.strstart-t.block_start,e),t.block_start=t.strstart,VS(t.strm)}function XS(t,e){t.pending_buf[t.pending++]=e}function YS(t,e){t.pending_buf[t.pending++]=e>>>8&255,t.pending_buf[t.pending++]=255&e}function qS(t,e){var r,i,n=t.max_chain_length,s=t.strstart,o=t.prev_length,a=t.nice_match,l=t.strstart>t.w_size-PS?t.strstart-(t.w_size-PS):0,h=t.window,c=t.w_mask,u=t.prev,d=t.strstart+LS,p=h[s+o-1],f=h[s+o];t.prev_length>=t.good_match&&(n>>=2),a>t.lookahead&&(a=t.lookahead);do{if(h[(r=e)+o]===f&&h[r+o-1]===p&&h[r]===h[s]&&h[++r]===h[s+1]){s+=2,r++;do{}while(h[++s]===h[++r]&&h[++s]===h[++r]&&h[++s]===h[++r]&&h[++s]===h[++r]&&h[++s]===h[++r]&&h[++s]===h[++r]&&h[++s]===h[++r]&&h[++s]===h[++r]&&s<d);if(i=LS-(d-s),s=d-LS,i>o){if(t.match_start=e,o=i,i>=a)break;p=h[s+o-1],f=h[s+o]}}}while((e=u[e&c])>l&&0!=--n);return o<=t.lookahead?o:t.lookahead}function ZS(t){var e,r,i,n,s,o,a,l,h,c,u=t.w_size;do{if(n=t.window_size-t.lookahead-t.strstart,t.strstart>=u+(u-PS)){dS.arraySet(t.window,t.window,u,u,0),t.match_start-=u,t.strstart-=u,t.block_start-=u,e=r=t.hash_size;do{i=t.head[--e],t.head[e]=i>=u?i-u:0}while(--r);e=r=u;do{i=t.prev[--e],t.prev[e]=i>=u?i-u:0}while(--r);n+=u}if(0===t.strm.avail_in)break;if(o=t.strm,a=t.window,l=t.strstart+t.lookahead,h=n,c=void 0,(c=o.avail_in)>h&&(c=h),r=0===c?0:(o.avail_in-=c,dS.arraySet(a,o.input,o.next_in,c,l),1===o.state.wrap?o.adler=fS(o.adler,a,c,l):2===o.state.wrap&&(o.adler=gS(o.adler,a,c,l)),o.next_in+=c,o.total_in+=c,c),t.lookahead+=r,t.lookahead+t.insert>=RS)for(s=t.strstart-t.insert,t.ins_h=t.window[s],t.ins_h=(t.ins_h<<t.hash_shift^t.window[s+1])&t.hash_mask;t.insert&&(t.ins_h=(t.ins_h<<t.hash_shift^t.window[s+RS-1])&t.hash_mask,t.prev[s&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=s,s++,t.insert--,!(t.lookahead+t.insert<RS)););}while(t.lookahead<PS&&0!==t.strm.avail_in)}function KS(t,e){for(var r,i;;){if(t.lookahead<PS){if(ZS(t),t.lookahead<PS&&e===yS)return FS;if(0===t.lookahead)break}if(r=0,t.lookahead>=RS&&(t.ins_h=(t.ins_h<<t.hash_shift^t.window[t.strstart+RS-1])&t.hash_mask,r=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart),0!==r&&t.strstart-r<=t.w_size-PS&&(t.match_length=qS(t,r)),t.match_length>=RS)if(i=pS._tr_tally(t,t.strstart-t.match_start,t.match_length-RS),t.lookahead-=t.match_length,t.match_length<=t.max_lazy_match&&t.lookahead>=RS){t.match_length--;do{t.strstart++,t.ins_h=(t.ins_h<<t.hash_shift^t.window[t.strstart+RS-1])&t.hash_mask,r=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart}while(0!=--t.match_length);t.strstart++}else t.strstart+=t.match_length,t.match_length=0,t.ins_h=t.window[t.strstart],t.ins_h=(t.ins_h<<t.hash_shift^t.window[t.strstart+1])&t.hash_mask;else i=pS._tr_tally(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++;if(i&&(GS(t,!1),0===t.strm.avail_out))return FS}return t.insert=t.strstart<RS-1?t.strstart:RS-1,e===vS?(GS(t,!0),0===t.strm.avail_out?zS:HS):t.last_lit&&(GS(t,!1),0===t.strm.avail_out)?FS:jS}function QS(t,e){for(var r,i,n;;){if(t.lookahead<PS){if(ZS(t),t.lookahead<PS&&e===yS)return FS;if(0===t.lookahead)break}if(r=0,t.lookahead>=RS&&(t.ins_h=(t.ins_h<<t.hash_shift^t.window[t.strstart+RS-1])&t.hash_mask,r=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart),t.prev_length=t.match_length,t.prev_match=t.match_start,t.match_length=RS-1,0!==r&&t.prev_length<t.max_lazy_match&&t.strstart-r<=t.w_size-PS&&(t.match_length=qS(t,r),t.match_length<=5&&(1===t.strategy||t.match_length===RS&&t.strstart-t.match_start>4096)&&(t.match_length=RS-1)),t.prev_length>=RS&&t.match_length<=t.prev_length){n=t.strstart+t.lookahead-RS,i=pS._tr_tally(t,t.strstart-1-t.prev_match,t.prev_length-RS),t.lookahead-=t.prev_length-1,t.prev_length-=2;do{++t.strstart<=n&&(t.ins_h=(t.ins_h<<t.hash_shift^t.window[t.strstart+RS-1])&t.hash_mask,r=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart)}while(0!=--t.prev_length);if(t.match_available=0,t.match_length=RS-1,t.strstart++,i&&(GS(t,!1),0===t.strm.avail_out))return FS}else if(t.match_available){if((i=pS._tr_tally(t,0,t.window[t.strstart-1]))&&GS(t,!1),t.strstart++,t.lookahead--,0===t.strm.avail_out)return FS}else t.match_available=1,t.strstart++,t.lookahead--}return t.match_available&&(i=pS._tr_tally(t,0,t.window[t.strstart-1]),t.match_available=0),t.insert=t.strstart<RS-1?t.strstart:RS-1,e===vS?(GS(t,!0),0===t.strm.avail_out?zS:HS):t.last_lit&&(GS(t,!1),0===t.strm.avail_out)?FS:jS}function JS(t,e,r,i,n){this.good_length=t,this.max_lazy=e,this.nice_length=r,this.max_chain=i,this.func=n}function tT(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=TS,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new dS.Buf16(2*OS),this.dyn_dtree=new dS.Buf16(2*(2*ES+1)),this.bl_tree=new dS.Buf16(2*(2*AS+1)),$S(this.dyn_ltree),$S(this.dyn_dtree),$S(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new dS.Buf16(BS+1),this.heap=new dS.Buf16(2*CS+1),$S(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new dS.Buf16(2*CS+1),$S(this.depth),this.l_buf=0,this.lit_bufsize=0,this.last_lit=0,this.d_buf=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}function eT(t){var e;return t&&t.state?(t.total_in=t.total_out=0,t.data_type=SS,(e=t.state).pending=0,e.pending_out=0,e.wrap<0&&(e.wrap=-e.wrap),e.status=e.wrap?DS:IS,t.adler=2===e.wrap?0:1,e.last_flush=yS,pS._tr_init(e),bS):WS(t,_S)}function rT(t){var e=eT(t);return e===bS&&function(t){t.window_size=2*t.w_size,$S(t.head),t.max_lazy_match=hS[t.level].max_lazy,t.good_match=hS[t.level].good_length,t.nice_match=hS[t.level].nice_length,t.max_chain_length=hS[t.level].max_chain,t.strstart=0,t.block_start=0,t.lookahead=0,t.insert=0,t.match_length=t.prev_length=RS-1,t.match_available=0,t.ins_h=0}(t.state),e}function iT(t,e,r,i,n,s){if(!t)return _S;var o=1;if(e===wS&&(e=6),i<0?(o=0,i=-i):i>15&&(o=2,i-=16),n<1||n>kS||r!==TS||i<8||i>15||e<0||e>9||s<0||s>xS)return WS(t,_S);8===i&&(i=9);var a=new tT;return t.state=a,a.strm=t,a.wrap=o,a.gzhead=null,a.w_bits=i,a.w_size=1<<a.w_bits,a.w_mask=a.w_size-1,a.hash_bits=n+7,a.hash_size=1<<a.hash_bits,a.hash_mask=a.hash_size-1,a.hash_shift=~~((a.hash_bits+RS-1)/RS),a.window=new dS.Buf8(2*a.w_size),a.head=new dS.Buf16(a.hash_size),a.prev=new dS.Buf16(a.w_size),a.lit_bufsize=1<<n+6,a.pending_buf_size=4*a.lit_bufsize,a.pending_buf=new dS.Buf8(a.pending_buf_size),a.d_buf=1*a.lit_bufsize,a.l_buf=3*a.lit_bufsize,a.level=e,a.strategy=s,a.method=r,rT(t)}hS=[new JS(0,0,0,0,(function(t,e){var r=65535;for(r>t.pending_buf_size-5&&(r=t.pending_buf_size-5);;){if(t.lookahead<=1){if(ZS(t),0===t.lookahead&&e===yS)return FS;if(0===t.lookahead)break}t.strstart+=t.lookahead,t.lookahead=0;var i=t.block_start+r;if((0===t.strstart||t.strstart>=i)&&(t.lookahead=t.strstart-i,t.strstart=i,GS(t,!1),0===t.strm.avail_out))return FS;if(t.strstart-t.block_start>=t.w_size-PS&&(GS(t,!1),0===t.strm.avail_out))return FS}return t.insert=0,e===vS?(GS(t,!0),0===t.strm.avail_out?zS:HS):(t.strstart>t.block_start&&(GS(t,!1),t.strm.avail_out),FS)})),new JS(4,4,8,4,KS),new JS(4,5,16,8,KS),new JS(4,6,32,32,KS),new JS(4,4,16,16,QS),new JS(8,16,32,32,QS),new JS(8,16,128,128,QS),new JS(8,32,128,256,QS),new JS(32,128,258,1024,QS),new JS(32,258,258,4096,QS)],cx.deflateInit=function(t,e){return iT(t,e,TS,15,8,0)},cx.deflateInit2=iT,cx.deflateReset=rT,cx.deflateResetKeep=eT,cx.deflateSetHeader=function(t,e){return t&&t.state?2!==t.state.wrap?_S:(t.state.gzhead=e,bS):_S},cx.deflate=function(t,e){var r,i,n,s;if(!t||!t.state||e>5||e<0)return t?WS(t,_S):_S;if(i=t.state,!t.output||!t.input&&0!==t.avail_in||i.status===NS&&e!==vS)return WS(t,0===t.avail_out?-5:_S);if(i.strm=t,r=i.last_flush,i.last_flush=e,i.status===DS)if(2===i.wrap)t.adler=0,XS(i,31),XS(i,139),XS(i,8),i.gzhead?(XS(i,(i.gzhead.text?1:0)+(i.gzhead.hcrc?2:0)+(i.gzhead.extra?4:0)+(i.gzhead.name?8:0)+(i.gzhead.comment?16:0)),XS(i,255&i.gzhead.time),XS(i,i.gzhead.time>>8&255),XS(i,i.gzhead.time>>16&255),XS(i,i.gzhead.time>>24&255),XS(i,9===i.level?2:i.strategy>=2||i.level<2?4:0),XS(i,255&i.gzhead.os),i.gzhead.extra&&i.gzhead.extra.length&&(XS(i,255&i.gzhead.extra.length),XS(i,i.gzhead.extra.length>>8&255)),i.gzhead.hcrc&&(t.adler=gS(t.adler,i.pending_buf,i.pending,0)),i.gzindex=0,i.status=69):(XS(i,0),XS(i,0),XS(i,0),XS(i,0),XS(i,0),XS(i,9===i.level?2:i.strategy>=2||i.level<2?4:0),XS(i,3),i.status=IS);else{var o=TS+(i.w_bits-8<<4)<<8;o|=(i.strategy>=2||i.level<2?0:i.level<6?1:6===i.level?2:3)<<6,0!==i.strstart&&(o|=32),o+=31-o%31,i.status=IS,YS(i,o),0!==i.strstart&&(YS(i,t.adler>>>16),YS(i,65535&t.adler)),t.adler=1}if(69===i.status)if(i.gzhead.extra){for(n=i.pending;i.gzindex<(65535&i.gzhead.extra.length)&&(i.pending!==i.pending_buf_size||(i.gzhead.hcrc&&i.pending>n&&(t.adler=gS(t.adler,i.pending_buf,i.pending-n,n)),VS(t),n=i.pending,i.pending!==i.pending_buf_size));)XS(i,255&i.gzhead.extra[i.gzindex]),i.gzindex++;i.gzhead.hcrc&&i.pending>n&&(t.adler=gS(t.adler,i.pending_buf,i.pending-n,n)),i.gzindex===i.gzhead.extra.length&&(i.gzindex=0,i.status=73)}else i.status=73;if(73===i.status)if(i.gzhead.name){n=i.pending;do{if(i.pending===i.pending_buf_size&&(i.gzhead.hcrc&&i.pending>n&&(t.adler=gS(t.adler,i.pending_buf,i.pending-n,n)),VS(t),n=i.pending,i.pending===i.pending_buf_size)){s=1;break}s=i.gzindex<i.gzhead.name.length?255&i.gzhead.name.charCodeAt(i.gzindex++):0,XS(i,s)}while(0!==s);i.gzhead.hcrc&&i.pending>n&&(t.adler=gS(t.adler,i.pending_buf,i.pending-n,n)),0===s&&(i.gzindex=0,i.status=91)}else i.status=91;if(91===i.status)if(i.gzhead.comment){n=i.pending;do{if(i.pending===i.pending_buf_size&&(i.gzhead.hcrc&&i.pending>n&&(t.adler=gS(t.adler,i.pending_buf,i.pending-n,n)),VS(t),n=i.pending,i.pending===i.pending_buf_size)){s=1;break}s=i.gzindex<i.gzhead.comment.length?255&i.gzhead.comment.charCodeAt(i.gzindex++):0,XS(i,s)}while(0!==s);i.gzhead.hcrc&&i.pending>n&&(t.adler=gS(t.adler,i.pending_buf,i.pending-n,n)),0===s&&(i.status=MS)}else i.status=MS;if(i.status===MS&&(i.gzhead.hcrc?(i.pending+2>i.pending_buf_size&&VS(t),i.pending+2<=i.pending_buf_size&&(XS(i,255&t.adler),XS(i,t.adler>>8&255),t.adler=0,i.status=IS)):i.status=IS),0!==i.pending){if(VS(t),0===t.avail_out)return i.last_flush=-1,bS}else if(0===t.avail_in&&US(e)<=US(r)&&e!==vS)return WS(t,-5);if(i.status===NS&&0!==t.avail_in)return WS(t,-5);if(0!==t.avail_in||0!==i.lookahead||e!==yS&&i.status!==NS){var a=2===i.strategy?function(t,e){for(var r;;){if(0===t.lookahead&&(ZS(t),0===t.lookahead)){if(e===yS)return FS;break}if(t.match_length=0,r=pS._tr_tally(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++,r&&(GS(t,!1),0===t.strm.avail_out))return FS}return t.insert=0,e===vS?(GS(t,!0),0===t.strm.avail_out?zS:HS):t.last_lit&&(GS(t,!1),0===t.strm.avail_out)?FS:jS}(i,e):3===i.strategy?function(t,e){for(var r,i,n,s,o=t.window;;){if(t.lookahead<=LS){if(ZS(t),t.lookahead<=LS&&e===yS)return FS;if(0===t.lookahead)break}if(t.match_length=0,t.lookahead>=RS&&t.strstart>0&&(i=o[n=t.strstart-1])===o[++n]&&i===o[++n]&&i===o[++n]){s=t.strstart+LS;do{}while(i===o[++n]&&i===o[++n]&&i===o[++n]&&i===o[++n]&&i===o[++n]&&i===o[++n]&&i===o[++n]&&i===o[++n]&&n<s);t.match_length=LS-(s-n),t.match_length>t.lookahead&&(t.match_length=t.lookahead)}if(t.match_length>=RS?(r=pS._tr_tally(t,1,t.match_length-RS),t.lookahead-=t.match_length,t.strstart+=t.match_length,t.match_length=0):(r=pS._tr_tally(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++),r&&(GS(t,!1),0===t.strm.avail_out))return FS}return t.insert=0,e===vS?(GS(t,!0),0===t.strm.avail_out?zS:HS):t.last_lit&&(GS(t,!1),0===t.strm.avail_out)?FS:jS}(i,e):hS[i.level].func(i,e);if(a!==zS&&a!==HS||(i.status=NS),a===FS||a===zS)return 0===t.avail_out&&(i.last_flush=-1),bS;if(a===jS&&(1===e?pS._tr_align(i):5!==e&&(pS._tr_stored_block(i,0,0,!1),3===e&&($S(i.head),0===i.lookahead&&(i.strstart=0,i.block_start=0,i.insert=0))),VS(t),0===t.avail_out))return i.last_flush=-1,bS}return e!==vS?bS:i.wrap<=0?1:(2===i.wrap?(XS(i,255&t.adler),XS(i,t.adler>>8&255),XS(i,t.adler>>16&255),XS(i,t.adler>>24&255),XS(i,255&t.total_in),XS(i,t.total_in>>8&255),XS(i,t.total_in>>16&255),XS(i,t.total_in>>24&255)):(YS(i,t.adler>>>16),YS(i,65535&t.adler)),VS(t),i.wrap>0&&(i.wrap=-i.wrap),0!==i.pending?bS:1)},cx.deflateEnd=function(t){var e;return t&&t.state?(e=t.state.status)!==DS&&69!==e&&73!==e&&91!==e&&e!==MS&&e!==IS&&e!==NS?WS(t,_S):(t.state=null,e===IS?WS(t,-3):bS):_S},cx.deflateSetDictionary=function(t,e){var r,i,n,s,o,a,l,h,c=e.length;if(!t||!t.state)return _S;if(2===(s=(r=t.state).wrap)||1===s&&r.status!==DS||r.lookahead)return _S;for(1===s&&(t.adler=fS(t.adler,e,c,0)),r.wrap=0,c>=r.w_size&&(0===s&&($S(r.head),r.strstart=0,r.block_start=0,r.insert=0),h=new dS.Buf8(r.w_size),dS.arraySet(h,e,c-r.w_size,r.w_size,0),e=h,c=r.w_size),o=t.avail_in,a=t.next_in,l=t.input,t.avail_in=c,t.next_in=0,t.input=e,ZS(r);r.lookahead>=RS;){i=r.strstart,n=r.lookahead-(RS-1);do{r.ins_h=(r.ins_h<<r.hash_shift^r.window[i+RS-1])&r.hash_mask,r.prev[i&r.w_mask]=r.head[r.ins_h],r.head[r.ins_h]=i,i++}while(--n);r.strstart=i,r.lookahead=RS-1,ZS(r)}return r.strstart+=r.lookahead,r.block_start=r.strstart,r.insert=r.lookahead,r.lookahead=0,r.match_length=r.prev_length=RS-1,r.match_available=0,t.next_in=a,t.input=l,t.avail_in=o,r.wrap=s,bS},cx.deflateInfo="pako deflate (from Nodeca project)";var nT={},sT=lx,oT=!0,aT=!0;try{String.fromCharCode.apply(null,[0])}catch(t){oT=!1}try{String.fromCharCode.apply(null,new Uint8Array(1))}catch(t){aT=!1}for(var lT=new sT.Buf8(256),hT=0;hT<256;hT++)lT[hT]=hT>=252?6:hT>=248?5:hT>=240?4:hT>=224?3:hT>=192?2:1;function cT(t,e){if(e<65534&&(t.subarray&&aT||!t.subarray&&oT))return String.fromCharCode.apply(null,sT.shrinkBuf(t,e));for(var r="",i=0;i<e;i++)r+=String.fromCharCode(t[i]);return r}lT[254]=lT[254]=1,nT.string2buf=function(t){var e,r,i,n,s,o=t.length,a=0;for(n=0;n<o;n++)55296==(64512&(r=t.charCodeAt(n)))&&n+1<o&&56320==(64512&(i=t.charCodeAt(n+1)))&&(r=65536+(r-55296<<10)+(i-56320),n++),a+=r<128?1:r<2048?2:r<65536?3:4;for(e=new sT.Buf8(a),s=0,n=0;s<a;n++)55296==(64512&(r=t.charCodeAt(n)))&&n+1<o&&56320==(64512&(i=t.charCodeAt(n+1)))&&(r=65536+(r-55296<<10)+(i-56320),n++),r<128?e[s++]=r:r<2048?(e[s++]=192|r>>>6,e[s++]=128|63&r):r<65536?(e[s++]=224|r>>>12,e[s++]=128|r>>>6&63,e[s++]=128|63&r):(e[s++]=240|r>>>18,e[s++]=128|r>>>12&63,e[s++]=128|r>>>6&63,e[s++]=128|63&r);return e},nT.buf2binstring=function(t){return cT(t,t.length)},nT.binstring2buf=function(t){for(var e=new sT.Buf8(t.length),r=0,i=e.length;r<i;r++)e[r]=t.charCodeAt(r);return e},nT.buf2string=function(t,e){var r,i,n,s,o=e||t.length,a=new Array(2*o);for(i=0,r=0;r<o;)if((n=t[r++])<128)a[i++]=n;else if((s=lT[n])>4)a[i++]=65533,r+=s-1;else{for(n&=2===s?31:3===s?15:7;s>1&&r<o;)n=n<<6|63&t[r++],s--;s>1?a[i++]=65533:n<65536?a[i++]=n:(n-=65536,a[i++]=55296|n>>10&1023,a[i++]=56320|1023&n)}return cT(a,i)},nT.utf8border=function(t,e){var r;for((e=e||t.length)>t.length&&(e=t.length),r=e-1;r>=0&&128==(192&t[r]);)r--;return r<0||0===r?e:r+lT[t[r]]>e?r:e};var uT=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0},dT=cx,pT=lx,fT=nT,gT=uS,mT=uT,yT=Object.prototype.toString,vT=0,bT=-1,_T=0,wT=8;function xT(t){if(!(this instanceof xT))return new xT(t);this.options=pT.assign({level:bT,method:wT,chunkSize:16384,windowBits:15,memLevel:8,strategy:_T,to:""},t||{});var e=this.options;e.raw&&e.windowBits>0?e.windowBits=-e.windowBits:e.gzip&&e.windowBits>0&&e.windowBits<16&&(e.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new mT,this.strm.avail_out=0;var r=dT.deflateInit2(this.strm,e.level,e.method,e.windowBits,e.memLevel,e.strategy);if(r!==vT)throw new Error(gT[r]);if(e.header&&dT.deflateSetHeader(this.strm,e.header),e.dictionary){var i;if(i="string"==typeof e.dictionary?fT.string2buf(e.dictionary):"[object ArrayBuffer]"===yT.call(e.dictionary)?new Uint8Array(e.dictionary):e.dictionary,(r=dT.deflateSetDictionary(this.strm,i))!==vT)throw new Error(gT[r]);this._dict_set=!0}}function ST(t,e){var r=new xT(e);if(r.push(t,!0),r.err)throw r.msg||gT[r.err];return r.result}xT.prototype.push=function(t,e){var r,i,n=this.strm,s=this.options.chunkSize;if(this.ended)return!1;i=e===~~e?e:!0===e?4:0,"string"==typeof t?n.input=fT.string2buf(t):"[object ArrayBuffer]"===yT.call(t)?n.input=new Uint8Array(t):n.input=t,n.next_in=0,n.avail_in=n.input.length;do{if(0===n.avail_out&&(n.output=new pT.Buf8(s),n.next_out=0,n.avail_out=s),1!==(r=dT.deflate(n,i))&&r!==vT)return this.onEnd(r),this.ended=!0,!1;0!==n.avail_out&&(0!==n.avail_in||4!==i&&2!==i)||("string"===this.options.to?this.onData(fT.buf2binstring(pT.shrinkBuf(n.output,n.next_out))):this.onData(pT.shrinkBuf(n.output,n.next_out)))}while((n.avail_in>0||0===n.avail_out)&&1!==r);return 4===i?(r=dT.deflateEnd(this.strm),this.onEnd(r),this.ended=!0,r===vT):2!==i||(this.onEnd(vT),n.avail_out=0,!0)},xT.prototype.onData=function(t){this.chunks.push(t)},xT.prototype.onEnd=function(t){t===vT&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=pT.flattenChunks(this.chunks)),this.chunks=[],this.err=t,this.msg=this.strm.msg},hx.Deflate=xT,hx.deflate=ST,hx.deflateRaw=function(t,e){return(e=e||{}).raw=!0,ST(t,e)},hx.gzip=function(t,e){return(e=e||{}).gzip=!0,ST(t,e)};var TT={},kT={},CT=lx,ET=15,AT=[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0],OT=[16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78],BT=[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0],RT=[16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64],LT=lx,PT=aS,DT=cS,MT=function(t,e){var r,i,n,s,o,a,l,h,c,u,d,p,f,g,m,y,v,b,_,w,x,S,T,k,C;r=t.state,i=t.next_in,k=t.input,n=i+(t.avail_in-5),s=t.next_out,C=t.output,o=s-(e-t.avail_out),a=s+(t.avail_out-257),l=r.dmax,h=r.wsize,c=r.whave,u=r.wnext,d=r.window,p=r.hold,f=r.bits,g=r.lencode,m=r.distcode,y=(1<<r.lenbits)-1,v=(1<<r.distbits)-1;t:do{f<15&&(p+=k[i++]<<f,f+=8,p+=k[i++]<<f,f+=8),b=g[p&y];e:for(;;){if(p>>>=_=b>>>24,f-=_,0===(_=b>>>16&255))C[s++]=65535&b;else{if(!(16&_)){if(0==(64&_)){b=g[(65535&b)+(p&(1<<_)-1)];continue e}if(32&_){r.mode=12;break t}t.msg="invalid literal/length code",r.mode=30;break t}w=65535&b,(_&=15)&&(f<_&&(p+=k[i++]<<f,f+=8),w+=p&(1<<_)-1,p>>>=_,f-=_),f<15&&(p+=k[i++]<<f,f+=8,p+=k[i++]<<f,f+=8),b=m[p&v];r:for(;;){if(p>>>=_=b>>>24,f-=_,!(16&(_=b>>>16&255))){if(0==(64&_)){b=m[(65535&b)+(p&(1<<_)-1)];continue r}t.msg="invalid distance code",r.mode=30;break t}if(x=65535&b,f<(_&=15)&&(p+=k[i++]<<f,(f+=8)<_&&(p+=k[i++]<<f,f+=8)),(x+=p&(1<<_)-1)>l){t.msg="invalid distance too far back",r.mode=30;break t}if(p>>>=_,f-=_,x>(_=s-o)){if((_=x-_)>c&&r.sane){t.msg="invalid distance too far back",r.mode=30;break t}if(S=0,T=d,0===u){if(S+=h-_,_<w){w-=_;do{C[s++]=d[S++]}while(--_);S=s-x,T=C}}else if(u<_){if(S+=h+u-_,(_-=u)<w){w-=_;do{C[s++]=d[S++]}while(--_);if(S=0,u<w){w-=_=u;do{C[s++]=d[S++]}while(--_);S=s-x,T=C}}}else if(S+=u-_,_<w){w-=_;do{C[s++]=d[S++]}while(--_);S=s-x,T=C}for(;w>2;)C[s++]=T[S++],C[s++]=T[S++],C[s++]=T[S++],w-=3;w&&(C[s++]=T[S++],w>1&&(C[s++]=T[S++]))}else{S=s-x;do{C[s++]=C[S++],C[s++]=C[S++],C[s++]=C[S++],w-=3}while(w>2);w&&(C[s++]=C[S++],w>1&&(C[s++]=C[S++]))}break}}break}}while(i<n&&s<a);i-=w=f>>3,p&=(1<<(f-=w<<3))-1,t.next_in=i,t.next_out=s,t.avail_in=i<n?n-i+5:5-(i-n),t.avail_out=s<a?a-s+257:257-(s-a),r.hold=p,r.bits=f},IT=function(t,e,r,i,n,s,o,a){var l,h,c,u,d,p,f,g,m,y=a.bits,v=0,b=0,_=0,w=0,x=0,S=0,T=0,k=0,C=0,E=0,A=null,O=0,B=new CT.Buf16(16),R=new CT.Buf16(16),L=null,P=0;for(v=0;v<=ET;v++)B[v]=0;for(b=0;b<i;b++)B[e[r+b]]++;for(x=y,w=ET;w>=1&&0===B[w];w--);if(x>w&&(x=w),0===w)return n[s++]=20971520,n[s++]=20971520,a.bits=1,0;for(_=1;_<w&&0===B[_];_++);for(x<_&&(x=_),k=1,v=1;v<=ET;v++)if(k<<=1,(k-=B[v])<0)return-1;if(k>0&&(0===t||1!==w))return-1;for(R[1]=0,v=1;v<ET;v++)R[v+1]=R[v]+B[v];for(b=0;b<i;b++)0!==e[r+b]&&(o[R[e[r+b]]++]=b);if(0===t?(A=L=o,p=19):1===t?(A=AT,O-=257,L=OT,P-=257,p=256):(A=BT,L=RT,p=-1),E=0,b=0,v=_,d=s,S=x,T=0,c=-1,u=(C=1<<x)-1,1===t&&C>852||2===t&&C>592)return 1;for(;;){f=v-T,o[b]<p?(g=0,m=o[b]):o[b]>p?(g=L[P+o[b]],m=A[O+o[b]]):(g=96,m=0),l=1<<v-T,_=h=1<<S;do{n[d+(E>>T)+(h-=l)]=f<<24|g<<16|m|0}while(0!==h);for(l=1<<v-1;E&l;)l>>=1;if(0!==l?(E&=l-1,E+=l):E=0,b++,0==--B[v]){if(v===w)break;v=e[r+o[b]]}if(v>x&&(E&u)!==c){for(0===T&&(T=x),d+=_,k=1<<(S=v-T);S+T<w&&!((k-=B[S+T])<=0);)S++,k<<=1;if(C+=1<<S,1===t&&C>852||2===t&&C>592)return 1;n[c=E&u]=x<<24|S<<16|d-s|0}}return 0!==E&&(n[d+E]=v-T<<24|64<<16|0),a.bits=x,0},NT=1,FT=2,jT=0,zT=-2,HT=1,WT=12,UT=30,$T=852,VT=592;function GT(t){return(t>>>24&255)+(t>>>8&65280)+((65280&t)<<8)+((255&t)<<24)}function XT(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new LT.Buf16(320),this.work=new LT.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function YT(t){var e;return t&&t.state?(e=t.state,t.total_in=t.total_out=e.total=0,t.msg="",e.wrap&&(t.adler=1&e.wrap),e.mode=HT,e.last=0,e.havedict=0,e.dmax=32768,e.head=null,e.hold=0,e.bits=0,e.lencode=e.lendyn=new LT.Buf32($T),e.distcode=e.distdyn=new LT.Buf32(VT),e.sane=1,e.back=-1,jT):zT}function qT(t){var e;return t&&t.state?((e=t.state).wsize=0,e.whave=0,e.wnext=0,YT(t)):zT}function ZT(t,e){var r,i;return t&&t.state?(i=t.state,e<0?(r=0,e=-e):(r=1+(e>>4),e<48&&(e&=15)),e&&(e<8||e>15)?zT:(null!==i.window&&i.wbits!==e&&(i.window=null),i.wrap=r,i.wbits=e,qT(t))):zT}function KT(t,e){var r,i;return t?(i=new XT,t.state=i,i.window=null,(r=ZT(t,e))!==jT&&(t.state=null),r):zT}var QT,JT,tk=!0;function ek(t){if(tk){var e;for(QT=new LT.Buf32(512),JT=new LT.Buf32(32),e=0;e<144;)t.lens[e++]=8;for(;e<256;)t.lens[e++]=9;for(;e<280;)t.lens[e++]=7;for(;e<288;)t.lens[e++]=8;for(IT(NT,t.lens,0,288,QT,0,t.work,{bits:9}),e=0;e<32;)t.lens[e++]=5;IT(FT,t.lens,0,32,JT,0,t.work,{bits:5}),tk=!1}t.lencode=QT,t.lenbits=9,t.distcode=JT,t.distbits=5}function rk(t,e,r,i){var n,s=t.state;return null===s.window&&(s.wsize=1<<s.wbits,s.wnext=0,s.whave=0,s.window=new LT.Buf8(s.wsize)),i>=s.wsize?(LT.arraySet(s.window,e,r-s.wsize,s.wsize,0),s.wnext=0,s.whave=s.wsize):((n=s.wsize-s.wnext)>i&&(n=i),LT.arraySet(s.window,e,r-i,n,s.wnext),(i-=n)?(LT.arraySet(s.window,e,r-i,i,0),s.wnext=i,s.whave=s.wsize):(s.wnext+=n,s.wnext===s.wsize&&(s.wnext=0),s.whave<s.wsize&&(s.whave+=n))),0}kT.inflateReset=qT,kT.inflateReset2=ZT,kT.inflateResetKeep=YT,kT.inflateInit=function(t){return KT(t,15)},kT.inflateInit2=KT,kT.inflate=function(t,e){var r,i,n,s,o,a,l,h,c,u,d,p,f,g,m,y,v,b,_,w,x,S,T,k,C=0,E=new LT.Buf8(4),A=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];if(!t||!t.state||!t.output||!t.input&&0!==t.avail_in)return zT;(r=t.state).mode===WT&&(r.mode=13),o=t.next_out,n=t.output,l=t.avail_out,s=t.next_in,i=t.input,a=t.avail_in,h=r.hold,c=r.bits,u=a,d=l,S=jT;t:for(;;)switch(r.mode){case HT:if(0===r.wrap){r.mode=13;break}for(;c<16;){if(0===a)break t;a--,h+=i[s++]<<c,c+=8}if(2&r.wrap&&35615===h){r.check=0,E[0]=255&h,E[1]=h>>>8&255,r.check=DT(r.check,E,2,0),h=0,c=0,r.mode=2;break}if(r.flags=0,r.head&&(r.head.done=!1),!(1&r.wrap)||(((255&h)<<8)+(h>>8))%31){t.msg="incorrect header check",r.mode=UT;break}if(8!=(15&h)){t.msg="unknown compression method",r.mode=UT;break}if(c-=4,x=8+(15&(h>>>=4)),0===r.wbits)r.wbits=x;else if(x>r.wbits){t.msg="invalid window size",r.mode=UT;break}r.dmax=1<<x,t.adler=r.check=1,r.mode=512&h?10:WT,h=0,c=0;break;case 2:for(;c<16;){if(0===a)break t;a--,h+=i[s++]<<c,c+=8}if(r.flags=h,8!=(255&r.flags)){t.msg="unknown compression method",r.mode=UT;break}if(57344&r.flags){t.msg="unknown header flags set",r.mode=UT;break}r.head&&(r.head.text=h>>8&1),512&r.flags&&(E[0]=255&h,E[1]=h>>>8&255,r.check=DT(r.check,E,2,0)),h=0,c=0,r.mode=3;case 3:for(;c<32;){if(0===a)break t;a--,h+=i[s++]<<c,c+=8}r.head&&(r.head.time=h),512&r.flags&&(E[0]=255&h,E[1]=h>>>8&255,E[2]=h>>>16&255,E[3]=h>>>24&255,r.check=DT(r.check,E,4,0)),h=0,c=0,r.mode=4;case 4:for(;c<16;){if(0===a)break t;a--,h+=i[s++]<<c,c+=8}r.head&&(r.head.xflags=255&h,r.head.os=h>>8),512&r.flags&&(E[0]=255&h,E[1]=h>>>8&255,r.check=DT(r.check,E,2,0)),h=0,c=0,r.mode=5;case 5:if(1024&r.flags){for(;c<16;){if(0===a)break t;a--,h+=i[s++]<<c,c+=8}r.length=h,r.head&&(r.head.extra_len=h),512&r.flags&&(E[0]=255&h,E[1]=h>>>8&255,r.check=DT(r.check,E,2,0)),h=0,c=0}else r.head&&(r.head.extra=null);r.mode=6;case 6:if(1024&r.flags&&((p=r.length)>a&&(p=a),p&&(r.head&&(x=r.head.extra_len-r.length,r.head.extra||(r.head.extra=new Array(r.head.extra_len)),LT.arraySet(r.head.extra,i,s,p,x)),512&r.flags&&(r.check=DT(r.check,i,p,s)),a-=p,s+=p,r.length-=p),r.length))break t;r.length=0,r.mode=7;case 7:if(2048&r.flags){if(0===a)break t;p=0;do{x=i[s+p++],r.head&&x&&r.length<65536&&(r.head.name+=String.fromCharCode(x))}while(x&&p<a);if(512&r.flags&&(r.check=DT(r.check,i,p,s)),a-=p,s+=p,x)break t}else r.head&&(r.head.name=null);r.length=0,r.mode=8;case 8:if(4096&r.flags){if(0===a)break t;p=0;do{x=i[s+p++],r.head&&x&&r.length<65536&&(r.head.comment+=String.fromCharCode(x))}while(x&&p<a);if(512&r.flags&&(r.check=DT(r.check,i,p,s)),a-=p,s+=p,x)break t}else r.head&&(r.head.comment=null);r.mode=9;case 9:if(512&r.flags){for(;c<16;){if(0===a)break t;a--,h+=i[s++]<<c,c+=8}if(h!==(65535&r.check)){t.msg="header crc mismatch",r.mode=UT;break}h=0,c=0}r.head&&(r.head.hcrc=r.flags>>9&1,r.head.done=!0),t.adler=r.check=0,r.mode=WT;break;case 10:for(;c<32;){if(0===a)break t;a--,h+=i[s++]<<c,c+=8}t.adler=r.check=GT(h),h=0,c=0,r.mode=11;case 11:if(0===r.havedict)return t.next_out=o,t.avail_out=l,t.next_in=s,t.avail_in=a,r.hold=h,r.bits=c,2;t.adler=r.check=1,r.mode=WT;case WT:if(5===e||6===e)break t;case 13:if(r.last){h>>>=7&c,c-=7&c,r.mode=27;break}for(;c<3;){if(0===a)break t;a--,h+=i[s++]<<c,c+=8}switch(r.last=1&h,c-=1,3&(h>>>=1)){case 0:r.mode=14;break;case 1:if(ek(r),r.mode=20,6===e){h>>>=2,c-=2;break t}break;case 2:r.mode=17;break;case 3:t.msg="invalid block type",r.mode=UT}h>>>=2,c-=2;break;case 14:for(h>>>=7&c,c-=7&c;c<32;){if(0===a)break t;a--,h+=i[s++]<<c,c+=8}if((65535&h)!=(h>>>16^65535)){t.msg="invalid stored block lengths",r.mode=UT;break}if(r.length=65535&h,h=0,c=0,r.mode=15,6===e)break t;case 15:r.mode=16;case 16:if(p=r.length){if(p>a&&(p=a),p>l&&(p=l),0===p)break t;LT.arraySet(n,i,s,p,o),a-=p,s+=p,l-=p,o+=p,r.length-=p;break}r.mode=WT;break;case 17:for(;c<14;){if(0===a)break t;a--,h+=i[s++]<<c,c+=8}if(r.nlen=257+(31&h),h>>>=5,c-=5,r.ndist=1+(31&h),h>>>=5,c-=5,r.ncode=4+(15&h),h>>>=4,c-=4,r.nlen>286||r.ndist>30){t.msg="too many length or distance symbols",r.mode=UT;break}r.have=0,r.mode=18;case 18:for(;r.have<r.ncode;){for(;c<3;){if(0===a)break t;a--,h+=i[s++]<<c,c+=8}r.lens[A[r.have++]]=7&h,h>>>=3,c-=3}for(;r.have<19;)r.lens[A[r.have++]]=0;if(r.lencode=r.lendyn,r.lenbits=7,T={bits:r.lenbits},S=IT(0,r.lens,0,19,r.lencode,0,r.work,T),r.lenbits=T.bits,S){t.msg="invalid code lengths set",r.mode=UT;break}r.have=0,r.mode=19;case 19:for(;r.have<r.nlen+r.ndist;){for(;y=(C=r.lencode[h&(1<<r.lenbits)-1])>>>16&255,v=65535&C,!((m=C>>>24)<=c);){if(0===a)break t;a--,h+=i[s++]<<c,c+=8}if(v<16)h>>>=m,c-=m,r.lens[r.have++]=v;else{if(16===v){for(k=m+2;c<k;){if(0===a)break t;a--,h+=i[s++]<<c,c+=8}if(h>>>=m,c-=m,0===r.have){t.msg="invalid bit length repeat",r.mode=UT;break}x=r.lens[r.have-1],p=3+(3&h),h>>>=2,c-=2}else if(17===v){for(k=m+3;c<k;){if(0===a)break t;a--,h+=i[s++]<<c,c+=8}c-=m,x=0,p=3+(7&(h>>>=m)),h>>>=3,c-=3}else{for(k=m+7;c<k;){if(0===a)break t;a--,h+=i[s++]<<c,c+=8}c-=m,x=0,p=11+(127&(h>>>=m)),h>>>=7,c-=7}if(r.have+p>r.nlen+r.ndist){t.msg="invalid bit length repeat",r.mode=UT;break}for(;p--;)r.lens[r.have++]=x}}if(r.mode===UT)break;if(0===r.lens[256]){t.msg="invalid code -- missing end-of-block",r.mode=UT;break}if(r.lenbits=9,T={bits:r.lenbits},S=IT(NT,r.lens,0,r.nlen,r.lencode,0,r.work,T),r.lenbits=T.bits,S){t.msg="invalid literal/lengths set",r.mode=UT;break}if(r.distbits=6,r.distcode=r.distdyn,T={bits:r.distbits},S=IT(FT,r.lens,r.nlen,r.ndist,r.distcode,0,r.work,T),r.distbits=T.bits,S){t.msg="invalid distances set",r.mode=UT;break}if(r.mode=20,6===e)break t;case 20:r.mode=21;case 21:if(a>=6&&l>=258){t.next_out=o,t.avail_out=l,t.next_in=s,t.avail_in=a,r.hold=h,r.bits=c,MT(t,d),o=t.next_out,n=t.output,l=t.avail_out,s=t.next_in,i=t.input,a=t.avail_in,h=r.hold,c=r.bits,r.mode===WT&&(r.back=-1);break}for(r.back=0;y=(C=r.lencode[h&(1<<r.lenbits)-1])>>>16&255,v=65535&C,!((m=C>>>24)<=c);){if(0===a)break t;a--,h+=i[s++]<<c,c+=8}if(y&&0==(240&y)){for(b=m,_=y,w=v;y=(C=r.lencode[w+((h&(1<<b+_)-1)>>b)])>>>16&255,v=65535&C,!(b+(m=C>>>24)<=c);){if(0===a)break t;a--,h+=i[s++]<<c,c+=8}h>>>=b,c-=b,r.back+=b}if(h>>>=m,c-=m,r.back+=m,r.length=v,0===y){r.mode=26;break}if(32&y){r.back=-1,r.mode=WT;break}if(64&y){t.msg="invalid literal/length code",r.mode=UT;break}r.extra=15&y,r.mode=22;case 22:if(r.extra){for(k=r.extra;c<k;){if(0===a)break t;a--,h+=i[s++]<<c,c+=8}r.length+=h&(1<<r.extra)-1,h>>>=r.extra,c-=r.extra,r.back+=r.extra}r.was=r.length,r.mode=23;case 23:for(;y=(C=r.distcode[h&(1<<r.distbits)-1])>>>16&255,v=65535&C,!((m=C>>>24)<=c);){if(0===a)break t;a--,h+=i[s++]<<c,c+=8}if(0==(240&y)){for(b=m,_=y,w=v;y=(C=r.distcode[w+((h&(1<<b+_)-1)>>b)])>>>16&255,v=65535&C,!(b+(m=C>>>24)<=c);){if(0===a)break t;a--,h+=i[s++]<<c,c+=8}h>>>=b,c-=b,r.back+=b}if(h>>>=m,c-=m,r.back+=m,64&y){t.msg="invalid distance code",r.mode=UT;break}r.offset=v,r.extra=15&y,r.mode=24;case 24:if(r.extra){for(k=r.extra;c<k;){if(0===a)break t;a--,h+=i[s++]<<c,c+=8}r.offset+=h&(1<<r.extra)-1,h>>>=r.extra,c-=r.extra,r.back+=r.extra}if(r.offset>r.dmax){t.msg="invalid distance too far back",r.mode=UT;break}r.mode=25;case 25:if(0===l)break t;if(p=d-l,r.offset>p){if((p=r.offset-p)>r.whave&&r.sane){t.msg="invalid distance too far back",r.mode=UT;break}p>r.wnext?(p-=r.wnext,f=r.wsize-p):f=r.wnext-p,p>r.length&&(p=r.length),g=r.window}else g=n,f=o-r.offset,p=r.length;p>l&&(p=l),l-=p,r.length-=p;do{n[o++]=g[f++]}while(--p);0===r.length&&(r.mode=21);break;case 26:if(0===l)break t;n[o++]=r.length,l--,r.mode=21;break;case 27:if(r.wrap){for(;c<32;){if(0===a)break t;a--,h|=i[s++]<<c,c+=8}if(d-=l,t.total_out+=d,r.total+=d,d&&(t.adler=r.check=r.flags?DT(r.check,n,d,o-d):PT(r.check,n,d,o-d)),d=l,(r.flags?h:GT(h))!==r.check){t.msg="incorrect data check",r.mode=UT;break}h=0,c=0}r.mode=28;case 28:if(r.wrap&&r.flags){for(;c<32;){if(0===a)break t;a--,h+=i[s++]<<c,c+=8}if(h!==(4294967295&r.total)){t.msg="incorrect length check",r.mode=UT;break}h=0,c=0}r.mode=29;case 29:S=1;break t;case UT:S=-3;break t;case 31:return-4;default:return zT}return t.next_out=o,t.avail_out=l,t.next_in=s,t.avail_in=a,r.hold=h,r.bits=c,(r.wsize||d!==t.avail_out&&r.mode<UT&&(r.mode<27||4!==e))&&rk(t,t.output,t.next_out,d-t.avail_out),u-=t.avail_in,d-=t.avail_out,t.total_in+=u,t.total_out+=d,r.total+=d,r.wrap&&d&&(t.adler=r.check=r.flags?DT(r.check,n,d,t.next_out-d):PT(r.check,n,d,t.next_out-d)),t.data_type=r.bits+(r.last?64:0)+(r.mode===WT?128:0)+(20===r.mode||15===r.mode?256:0),(0===u&&0===d||4===e)&&S===jT&&(S=-5),S},kT.inflateEnd=function(t){if(!t||!t.state)return zT;var e=t.state;return e.window&&(e.window=null),t.state=null,jT},kT.inflateGetHeader=function(t,e){var r;return t&&t.state?0==(2&(r=t.state).wrap)?zT:(r.head=e,e.done=!1,jT):zT},kT.inflateSetDictionary=function(t,e){var r,i=e.length;return t&&t.state?0!==(r=t.state).wrap&&11!==r.mode?zT:11===r.mode&&PT(1,e,i,0)!==r.check?-3:rk(t,e,i,i)?(r.mode=31,-4):(r.havedict=1,jT):zT},kT.inflateInfo="pako inflate (from Nodeca project)";var ik={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8};var nk=kT,sk=lx,ok=nT,ak=ik,lk=uS,hk=uT,ck=function(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1},uk=Object.prototype.toString;function dk(t){if(!(this instanceof dk))return new dk(t);this.options=sk.assign({chunkSize:16384,windowBits:0,to:""},t||{});var e=this.options;e.raw&&e.windowBits>=0&&e.windowBits<16&&(e.windowBits=-e.windowBits,0===e.windowBits&&(e.windowBits=-15)),!(e.windowBits>=0&&e.windowBits<16)||t&&t.windowBits||(e.windowBits+=32),e.windowBits>15&&e.windowBits<48&&0==(15&e.windowBits)&&(e.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new hk,this.strm.avail_out=0;var r=nk.inflateInit2(this.strm,e.windowBits);if(r!==ak.Z_OK)throw new Error(lk[r]);if(this.header=new ck,nk.inflateGetHeader(this.strm,this.header),e.dictionary&&("string"==typeof e.dictionary?e.dictionary=ok.string2buf(e.dictionary):"[object ArrayBuffer]"===uk.call(e.dictionary)&&(e.dictionary=new Uint8Array(e.dictionary)),e.raw&&(r=nk.inflateSetDictionary(this.strm,e.dictionary))!==ak.Z_OK))throw new Error(lk[r])}function pk(t,e){var r=new dk(e);if(r.push(t,!0),r.err)throw r.msg||lk[r.err];return r.result}dk.prototype.push=function(t,e){var r,i,n,s,o,a=this.strm,l=this.options.chunkSize,h=this.options.dictionary,c=!1;if(this.ended)return!1;i=e===~~e?e:!0===e?ak.Z_FINISH:ak.Z_NO_FLUSH,"string"==typeof t?a.input=ok.binstring2buf(t):"[object ArrayBuffer]"===uk.call(t)?a.input=new Uint8Array(t):a.input=t,a.next_in=0,a.avail_in=a.input.length;do{if(0===a.avail_out&&(a.output=new sk.Buf8(l),a.next_out=0,a.avail_out=l),(r=nk.inflate(a,ak.Z_NO_FLUSH))===ak.Z_NEED_DICT&&h&&(r=nk.inflateSetDictionary(this.strm,h)),r===ak.Z_BUF_ERROR&&!0===c&&(r=ak.Z_OK,c=!1),r!==ak.Z_STREAM_END&&r!==ak.Z_OK)return this.onEnd(r),this.ended=!0,!1;a.next_out&&(0!==a.avail_out&&r!==ak.Z_STREAM_END&&(0!==a.avail_in||i!==ak.Z_FINISH&&i!==ak.Z_SYNC_FLUSH)||("string"===this.options.to?(n=ok.utf8border(a.output,a.next_out),s=a.next_out-n,o=ok.buf2string(a.output,n),a.next_out=s,a.avail_out=l-s,s&&sk.arraySet(a.output,a.output,n,s,0),this.onData(o)):this.onData(sk.shrinkBuf(a.output,a.next_out)))),0===a.avail_in&&0===a.avail_out&&(c=!0)}while((a.avail_in>0||0===a.avail_out)&&r!==ak.Z_STREAM_END);return r===ak.Z_STREAM_END&&(i=ak.Z_FINISH),i===ak.Z_FINISH?(r=nk.inflateEnd(this.strm),this.onEnd(r),this.ended=!0,r===ak.Z_OK):i!==ak.Z_SYNC_FLUSH||(this.onEnd(ak.Z_OK),a.avail_out=0,!0)},dk.prototype.onData=function(t){this.chunks.push(t)},dk.prototype.onEnd=function(t){t===ak.Z_OK&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=sk.flattenChunks(this.chunks)),this.chunks=[],this.err=t,this.msg=this.strm.msg},TT.Inflate=dk,TT.inflate=pk,TT.inflateRaw=function(t,e){return(e=e||{}).raw=!0,pk(t,e)},TT.ungzip=pk;var fk={};(0,lx.assign)(fk,hx,TT,ik);var gk="undefined"!=typeof Uint8Array&&"undefined"!=typeof Uint16Array&&"undefined"!=typeof Uint32Array,mk=fk,yk=cw(),vk=dw,bk=gk?"uint8array":"array";function _k(t,e){vk.call(this,"FlateWorker/"+t),this._pako=null,this._pakoAction=t,this._pakoOptions=e,this.meta={}}ax.magic="\b\0",yk.inherits(_k,vk),_k.prototype.processChunk=function(t){this.meta=t.meta,null===this._pako&&this._createPako(),this._pako.push(yk.transformTo(bk,t.data),!1)},_k.prototype.flush=function(){vk.prototype.flush.call(this),null===this._pako&&this._createPako(),this._pako.push([],!0)},_k.prototype.cleanUp=function(){vk.prototype.cleanUp.call(this),this._pako=null},_k.prototype._createPako=function(){this._pako=new mk[this._pakoAction]({raw:!0,level:this._pakoOptions.level||-1});var t=this;this._pako.onData=function(e){t.push({data:e,meta:t.meta})}},ax.compressWorker=function(t){return new _k("Deflate",t)},ax.uncompressWorker=function(){return new _k("Inflate",{})};var wk=dw;ox.STORE={magic:"\0\0",compressWorker:function(){return new wk("STORE compression")},uncompressWorker:function(){return new wk("STORE decompression")}},ox.DEFLATE=ax;var xk={LOCAL_FILE_HEADER:"PK",CENTRAL_FILE_HEADER:"PK",CENTRAL_DIRECTORY_END:"PK",ZIP64_CENTRAL_DIRECTORY_LOCATOR:"PK",ZIP64_CENTRAL_DIRECTORY_END:"PK",DATA_DESCRIPTOR:"PK\b"},Sk=cw(),Tk=dw,kk=s_,Ck=Mw,Ek=xk,Ak=function(t,e){var r,i="";for(r=0;r<e;r++)i+=String.fromCharCode(255&t),t>>>=8;return i},Ok=function(t,e,r,i,n,s){var o,a,l=t.file,h=t.compression,c=s!==kk.utf8encode,u=Sk.transformTo("string",s(l.name)),d=Sk.transformTo("string",kk.utf8encode(l.name)),p=l.comment,f=Sk.transformTo("string",s(p)),g=Sk.transformTo("string",kk.utf8encode(p)),m=d.length!==l.name.length,y=g.length!==p.length,v="",b="",_="",w=l.dir,x=l.date,S={crc32:0,compressedSize:0,uncompressedSize:0};e&&!r||(S.crc32=t.crc32,S.compressedSize=t.compressedSize,S.uncompressedSize=t.uncompressedSize);var T=0;e&&(T|=8),c||!m&&!y||(T|=2048);var k=0,C=0;w&&(k|=16),"UNIX"===n?(C=798,k|=function(t,e){var r=t;return t||(r=e?16893:33204),(65535&r)<<16}(l.unixPermissions,w)):(C=20,k|=63&(l.dosPermissions||0)),o=x.getUTCHours(),o<<=6,o|=x.getUTCMinutes(),o<<=5,o|=x.getUTCSeconds()/2,a=x.getUTCFullYear()-1980,a<<=4,a|=x.getUTCMonth()+1,a<<=5,a|=x.getUTCDate(),m&&(b=Ak(1,1)+Ak(Ck(u),4)+d,v+="up"+Ak(b.length,2)+b),y&&(_=Ak(1,1)+Ak(Ck(f),4)+g,v+="uc"+Ak(_.length,2)+_);var E="";return E+="\n\0",E+=Ak(T,2),E+=h.magic,E+=Ak(o,2),E+=Ak(a,2),E+=Ak(S.crc32,4),E+=Ak(S.compressedSize,4),E+=Ak(S.uncompressedSize,4),E+=Ak(u.length,2),E+=Ak(v.length,2),{fileRecord:Ek.LOCAL_FILE_HEADER+E+u+v,dirRecord:Ek.CENTRAL_FILE_HEADER+Ak(C,2)+E+Ak(f.length,2)+"\0\0\0\0"+Ak(k,4)+Ak(i,4)+u+v+f}},Bk=function(t){return Ek.DATA_DESCRIPTOR+Ak(t.crc32,4)+Ak(t.compressedSize,4)+Ak(t.uncompressedSize,4)};function Rk(t,e,r,i){Tk.call(this,"ZipFileWorker"),this.bytesWritten=0,this.zipComment=e,this.zipPlatform=r,this.encodeFileName=i,this.streamFiles=t,this.accumulate=!1,this.contentBuffer=[],this.dirRecords=[],this.currentSourceOffset=0,this.entriesCount=0,this.currentFile=null,this._sources=[]}Sk.inherits(Rk,Tk),Rk.prototype.push=function(t){var e=t.meta.percent||0,r=this.entriesCount,i=this._sources.length;this.accumulate?this.contentBuffer.push(t):(this.bytesWritten+=t.data.length,Tk.prototype.push.call(this,{data:t.data,meta:{currentFile:this.currentFile,percent:r?(e+100*(r-i-1))/r:100}}))},Rk.prototype.openedSource=function(t){this.currentSourceOffset=this.bytesWritten,this.currentFile=t.file.name;var e=this.streamFiles&&!t.file.dir;if(e){var r=Ok(t,e,!1,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);this.push({data:r.fileRecord,meta:{percent:0}})}else this.accumulate=!0},Rk.prototype.closedSource=function(t){this.accumulate=!1;var e=this.streamFiles&&!t.file.dir,r=Ok(t,e,!0,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);if(this.dirRecords.push(r.dirRecord),e)this.push({data:Bk(t),meta:{percent:100}});else for(this.push({data:r.fileRecord,meta:{percent:0}});this.contentBuffer.length;)this.push(this.contentBuffer.shift());this.currentFile=null},Rk.prototype.flush=function(){for(var t=this.bytesWritten,e=0;e<this.dirRecords.length;e++)this.push({data:this.dirRecords[e],meta:{percent:100}});var r=this.bytesWritten-t,i=function(t,e,r,i,n){var s=Sk.transformTo("string",n(i));return Ek.CENTRAL_DIRECTORY_END+"\0\0\0\0"+Ak(t,2)+Ak(t,2)+Ak(e,4)+Ak(r,4)+Ak(s.length,2)+s}(this.dirRecords.length,r,t,this.zipComment,this.encodeFileName);this.push({data:i,meta:{percent:100}})},Rk.prototype.prepareNextSource=function(){this.previous=this._sources.shift(),this.openedSource(this.previous.streamInfo),this.isPaused?this.previous.pause():this.previous.resume()},Rk.prototype.registerPrevious=function(t){this._sources.push(t);var e=this;return t.on("data",(function(t){e.processChunk(t)})),t.on("end",(function(){e.closedSource(e.previous.streamInfo),e._sources.length?e.prepareNextSource():e.end()})),t.on("error",(function(t){e.error(t)})),this},Rk.prototype.resume=function(){return!!Tk.prototype.resume.call(this)&&(!this.previous&&this._sources.length?(this.prepareNextSource(),!0):this.previous||this._sources.length||this.generatedError?void 0:(this.end(),!0))},Rk.prototype.error=function(t){var e=this._sources;if(!Tk.prototype.error.call(this,t))return!1;for(var r=0;r<e.length;r++)try{e[r].error(t)}catch(t){}return!0},Rk.prototype.lock=function(){Tk.prototype.lock.call(this);for(var t=this._sources,e=0;e<t.length;e++)t[e].lock()};var Lk=ox,Pk=Rk;sx.generateWorker=function(t,e,r){var i=new Pk(e.streamFiles,r,e.platform,e.encodeFileName),n=0;try{t.forEach((function(t,r){n++;var s=function(t,e){var r=t||e,i=Lk[r];if(!i)throw new Error(r+" is not a valid compression method !");return i}(r.options.compression,e.compression),o=r.options.compressionOptions||e.compressionOptions||{},a=r.dir,l=r.date;r._compressWorker(s,o).withStreamInfo("file",{name:t,dir:a,date:l,comment:r.comment||"",unixPermissions:r.unixPermissions,dosPermissions:r.dosPermissions}).pipe(i)})),i.entriesCount=n}catch(t){i.error(t)}return i};var Dk=cw(),Mk=dw;function Ik(t,e){Mk.call(this,"Nodejs stream input adapter for "+t),this._upstreamEnded=!1,this._bindStream(e)}Dk.inherits(Ik,Mk),Ik.prototype._bindStream=function(t){var e=this;this._stream=t,t.pause(),t.on("data",(function(t){e.push({data:t,meta:{percent:0}})})).on("error",(function(t){e.isPaused?this.generatedError=t:e.error(t)})).on("end",(function(){e.isPaused?e._upstreamEnded=!0:e.end()}))},Ik.prototype.pause=function(){return!!Mk.prototype.pause.call(this)&&(this._stream.pause(),!0)},Ik.prototype.resume=function(){return!!Mk.prototype.resume.call(this)&&(this._upstreamEnded?this.end():this._stream.resume(),!0)};var Nk=Ik,Fk=s_,jk=cw(),zk=dw,Hk=Ew,Wk=Aw,Uk=Yw,$k=nx,Vk=sx,Gk=ow,Xk=Nk,Yk=function(t,e,r){var i,n=jk.getTypeOf(e),s=jk.extend(r||{},Wk);s.date=s.date||new Date,null!==s.compression&&(s.compression=s.compression.toUpperCase()),"string"==typeof s.unixPermissions&&(s.unixPermissions=parseInt(s.unixPermissions,8)),s.unixPermissions&&16384&s.unixPermissions&&(s.dir=!0),s.dosPermissions&&16&s.dosPermissions&&(s.dir=!0),s.dir&&(t=Zk(t)),s.createFolders&&(i=qk(t))&&Kk.call(this,i,!0);var o="string"===n&&!1===s.binary&&!1===s.base64;r&&void 0!==r.binary||(s.binary=!o),(e instanceof Uk&&0===e.uncompressedSize||s.dir||!e||0===e.length)&&(s.base64=!1,s.binary=!0,e="",s.compression="STORE",n="string");var a=null;a=e instanceof Uk||e instanceof zk?e:Gk.isNode&&Gk.isStream(e)?new Xk(t,e):jk.prepareContent(t,e,s.binary,s.optimizedBinaryString,s.base64);var l=new $k(t,a,s);this.files[t]=l},qk=function(t){"/"===t.slice(-1)&&(t=t.substring(0,t.length-1));var e=t.lastIndexOf("/");return e>0?t.substring(0,e):""},Zk=function(t){return"/"!==t.slice(-1)&&(t+="/"),t},Kk=function(t,e){return e=void 0!==e?e:Wk.createFolders,t=Zk(t),this.files[t]||Yk.call(this,t,null,{dir:!0,createFolders:e}),this.files[t]};function Qk(t){return"[object RegExp]"===Object.prototype.toString.call(t)}var Jk={load:function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},forEach:function(t){var e,r,i;for(e in this.files)i=this.files[e],(r=e.slice(this.root.length,e.length))&&e.slice(0,this.root.length)===this.root&&t(r,i)},filter:function(t){var e=[];return this.forEach((function(r,i){t(r,i)&&e.push(i)})),e},file:function(t,e,r){if(1===arguments.length){if(Qk(t)){var i=t;return this.filter((function(t,e){return!e.dir&&i.test(t)}))}var n=this.files[this.root+t];return n&&!n.dir?n:null}return t=this.root+t,Yk.call(this,t,e,r),this},folder:function(t){if(!t)return this;if(Qk(t))return this.filter((function(e,r){return r.dir&&t.test(e)}));var e=this.root+t,r=Kk.call(this,e),i=this.clone();return i.root=r.name,i},remove:function(t){t=this.root+t;var e=this.files[t];if(e||("/"!==t.slice(-1)&&(t+="/"),e=this.files[t]),e&&!e.dir)delete this.files[t];else for(var r=this.filter((function(e,r){return r.name.slice(0,t.length)===t})),i=0;i<r.length;i++)delete this.files[r[i].name];return this},generate:function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},generateInternalStream:function(t){var e,r={};try{if((r=jk.extend(t||{},{streamFiles:!1,compression:"STORE",compressionOptions:null,type:"",platform:"DOS",comment:null,mimeType:"application/zip",encodeFileName:Fk.utf8encode})).type=r.type.toLowerCase(),r.compression=r.compression.toUpperCase(),"binarystring"===r.type&&(r.type="string"),!r.type)throw new Error("No output type specified.");jk.checkSupport(r.type),"darwin"!==r.platform&&"freebsd"!==r.platform&&"linux"!==r.platform&&"sunos"!==r.platform||(r.platform="UNIX"),"win32"===r.platform&&(r.platform="DOS");var i=r.comment||this.comment||"";e=Vk.generateWorker(this,r,i)}catch(t){(e=new zk("error")).error(t)}return new Hk(e,r.type||"string",r.mimeType)},generateAsync:function(t,e){return this.generateInternalStream(t).accumulate(e)},generateNodeStream:function(t,e){return(t=t||{}).type||(t.type="nodebuffer"),this.generateInternalStream(t).toNodejsStream(e)}},tC=Jk,eC=cw();function rC(t){this.data=t,this.length=t.length,this.index=0,this.zero=0}rC.prototype={checkOffset:function(t){this.checkIndex(this.index+t)},checkIndex:function(t){if(this.length<this.zero+t||t<0)throw new Error("End of data reached (data length = "+this.length+", asked index = "+t+"). Corrupted zip ?")},setIndex:function(t){this.checkIndex(t),this.index=t},skip:function(t){this.setIndex(this.index+t)},byteAt:function(){},readInt:function(t){var e,r=0;for(this.checkOffset(t),e=this.index+t-1;e>=this.index;e--)r=(r<<8)+this.byteAt(e);return this.index+=t,r},readString:function(t){return eC.transformTo("string",this.readData(t))},readData:function(){},lastIndexOfSignature:function(){},readAndCheckSignature:function(){},readDate:function(){var t=this.readInt(4);return new Date(Date.UTC(1980+(t>>25&127),(t>>21&15)-1,t>>16&31,t>>11&31,t>>5&63,(31&t)<<1))}};var iC=rC,nC=iC;function sC(t){nC.call(this,t);for(var e=0;e<this.data.length;e++)t[e]=255&t[e]}cw().inherits(sC,nC),sC.prototype.byteAt=function(t){return this.data[this.zero+t]},sC.prototype.lastIndexOfSignature=function(t){for(var e=t.charCodeAt(0),r=t.charCodeAt(1),i=t.charCodeAt(2),n=t.charCodeAt(3),s=this.length-4;s>=0;--s)if(this.data[s]===e&&this.data[s+1]===r&&this.data[s+2]===i&&this.data[s+3]===n)return s-this.zero;return-1},sC.prototype.readAndCheckSignature=function(t){var e=t.charCodeAt(0),r=t.charCodeAt(1),i=t.charCodeAt(2),n=t.charCodeAt(3),s=this.readData(4);return e===s[0]&&r===s[1]&&i===s[2]&&n===s[3]},sC.prototype.readData=function(t){if(this.checkOffset(t),0===t)return[];var e=this.data.slice(this.zero+this.index,this.zero+this.index+t);return this.index+=t,e};var oC=sC,aC=iC;function lC(t){aC.call(this,t)}cw().inherits(lC,aC),lC.prototype.byteAt=function(t){return this.data.charCodeAt(this.zero+t)},lC.prototype.lastIndexOfSignature=function(t){return this.data.lastIndexOf(t)-this.zero},lC.prototype.readAndCheckSignature=function(t){return t===this.readData(4)},lC.prototype.readData=function(t){this.checkOffset(t);var e=this.data.slice(this.zero+this.index,this.zero+this.index+t);return this.index+=t,e};var hC=lC,cC=oC;function uC(t){cC.call(this,t)}cw().inherits(uC,cC),uC.prototype.readData=function(t){if(this.checkOffset(t),0===t)return new Uint8Array(0);var e=this.data.subarray(this.zero+this.index,this.zero+this.index+t);return this.index+=t,e};var dC=uC,pC=dC;function fC(t){pC.call(this,t)}cw().inherits(fC,pC),fC.prototype.readData=function(t){this.checkOffset(t);var e=this.data.slice(this.zero+this.index,this.zero+this.index+t);return this.index+=t,e};var gC=fC,mC=cw(),yC=a_,vC=oC,bC=hC,_C=gC,wC=dC,xC=function(t){var e=mC.getTypeOf(t);return mC.checkSupport(e),"string"!==e||yC.uint8array?"nodebuffer"===e?new _C(t):yC.uint8array?new wC(mC.transformTo("uint8array",t)):new vC(mC.transformTo("array",t)):new bC(t)},SC=xC,TC=cw(),kC=Yw,CC=Mw,EC=s_,AC=ox,OC=a_;function BC(t,e){this.options=t,this.loadOptions=e}BC.prototype={isEncrypted:function(){return 1==(1&this.bitFlag)},useUTF8:function(){return 2048==(2048&this.bitFlag)},readLocalPart:function(t){var e,r;if(t.skip(22),this.fileNameLength=t.readInt(2),r=t.readInt(2),this.fileName=t.readData(this.fileNameLength),t.skip(r),-1===this.compressedSize||-1===this.uncompressedSize)throw new Error("Bug or corrupted zip : didn't get enough information from the central directory (compressedSize === -1 || uncompressedSize === -1)");if(e=function(t){for(var e in AC)if(Object.prototype.hasOwnProperty.call(AC,e)&&AC[e].magic===t)return AC[e];return null}(this.compressionMethod),null===e)throw new Error("Corrupted zip : compression "+TC.pretty(this.compressionMethod)+" unknown (inner file : "+TC.transformTo("string",this.fileName)+")");this.decompressed=new kC(this.compressedSize,this.uncompressedSize,this.crc32,e,t.readData(this.compressedSize))},readCentralPart:function(t){this.versionMadeBy=t.readInt(2),t.skip(2),this.bitFlag=t.readInt(2),this.compressionMethod=t.readString(2),this.date=t.readDate(),this.crc32=t.readInt(4),this.compressedSize=t.readInt(4),this.uncompressedSize=t.readInt(4);var e=t.readInt(2);if(this.extraFieldsLength=t.readInt(2),this.fileCommentLength=t.readInt(2),this.diskNumberStart=t.readInt(2),this.internalFileAttributes=t.readInt(2),this.externalFileAttributes=t.readInt(4),this.localHeaderOffset=t.readInt(4),this.isEncrypted())throw new Error("Encrypted zip are not supported");t.skip(e),this.readExtraFields(t),this.parseZIP64ExtraField(t),this.fileComment=t.readData(this.fileCommentLength)},processAttributes:function(){this.unixPermissions=null,this.dosPermissions=null;var t=this.versionMadeBy>>8;this.dir=!!(16&this.externalFileAttributes),0===t&&(this.dosPermissions=63&this.externalFileAttributes),3===t&&(this.unixPermissions=this.externalFileAttributes>>16&65535),this.dir||"/"!==this.fileNameStr.slice(-1)||(this.dir=!0)},parseZIP64ExtraField:function(){if(this.extraFields[1]){var t=SC(this.extraFields[1].value);this.uncompressedSize===TC.MAX_VALUE_32BITS&&(this.uncompressedSize=t.readInt(8)),this.compressedSize===TC.MAX_VALUE_32BITS&&(this.compressedSize=t.readInt(8)),this.localHeaderOffset===TC.MAX_VALUE_32BITS&&(this.localHeaderOffset=t.readInt(8)),this.diskNumberStart===TC.MAX_VALUE_32BITS&&(this.diskNumberStart=t.readInt(4))}},readExtraFields:function(t){var e,r,i,n=t.index+this.extraFieldsLength;for(this.extraFields||(this.extraFields={});t.index+4<n;)e=t.readInt(2),r=t.readInt(2),i=t.readData(r),this.extraFields[e]={id:e,length:r,value:i};t.setIndex(n)},handleUTF8:function(){var t=OC.uint8array?"uint8array":"array";if(this.useUTF8())this.fileNameStr=EC.utf8decode(this.fileName),this.fileCommentStr=EC.utf8decode(this.fileComment);else{var e=this.findExtraFieldUnicodePath();if(null!==e)this.fileNameStr=e;else{var r=TC.transformTo(t,this.fileName);this.fileNameStr=this.loadOptions.decodeFileName(r)}var i=this.findExtraFieldUnicodeComment();if(null!==i)this.fileCommentStr=i;else{var n=TC.transformTo(t,this.fileComment);this.fileCommentStr=this.loadOptions.decodeFileName(n)}}},findExtraFieldUnicodePath:function(){var t=this.extraFields[28789];if(t){var e=SC(t.value);return 1!==e.readInt(1)||CC(this.fileName)!==e.readInt(4)?null:EC.utf8decode(e.readData(t.length-5))}return null},findExtraFieldUnicodeComment:function(){var t=this.extraFields[25461];if(t){var e=SC(t.value);return 1!==e.readInt(1)||CC(this.fileComment)!==e.readInt(4)?null:EC.utf8decode(e.readData(t.length-5))}return null}};var RC=BC,LC=xC,PC=cw(),DC=xk,MC=RC,IC=a_;function NC(t){this.files=[],this.loadOptions=t}NC.prototype={checkSignature:function(t){if(!this.reader.readAndCheckSignature(t)){this.reader.index-=4;var e=this.reader.readString(4);throw new Error("Corrupted zip or bug: unexpected signature ("+PC.pretty(e)+", expected "+PC.pretty(t)+")")}},isSignature:function(t,e){var r=this.reader.index;this.reader.setIndex(t);var i=this.reader.readString(4)===e;return this.reader.setIndex(r),i},readBlockEndOfCentral:function(){this.diskNumber=this.reader.readInt(2),this.diskWithCentralDirStart=this.reader.readInt(2),this.centralDirRecordsOnThisDisk=this.reader.readInt(2),this.centralDirRecords=this.reader.readInt(2),this.centralDirSize=this.reader.readInt(4),this.centralDirOffset=this.reader.readInt(4),this.zipCommentLength=this.reader.readInt(2);var t=this.reader.readData(this.zipCommentLength),e=IC.uint8array?"uint8array":"array",r=PC.transformTo(e,t);this.zipComment=this.loadOptions.decodeFileName(r)},readBlockZip64EndOfCentral:function(){this.zip64EndOfCentralSize=this.reader.readInt(8),this.reader.skip(4),this.diskNumber=this.reader.readInt(4),this.diskWithCentralDirStart=this.reader.readInt(4),this.centralDirRecordsOnThisDisk=this.reader.readInt(8),this.centralDirRecords=this.reader.readInt(8),this.centralDirSize=this.reader.readInt(8),this.centralDirOffset=this.reader.readInt(8),this.zip64ExtensibleData={};for(var t,e,r,i=this.zip64EndOfCentralSize-44;0<i;)t=this.reader.readInt(2),e=this.reader.readInt(4),r=this.reader.readData(e),this.zip64ExtensibleData[t]={id:t,length:e,value:r}},readBlockZip64EndOfCentralLocator:function(){if(this.diskWithZip64CentralDirStart=this.reader.readInt(4),this.relativeOffsetEndOfZip64CentralDir=this.reader.readInt(8),this.disksCount=this.reader.readInt(4),this.disksCount>1)throw new Error("Multi-volumes zip are not supported")},readLocalFiles:function(){var t,e;for(t=0;t<this.files.length;t++)e=this.files[t],this.reader.setIndex(e.localHeaderOffset),this.checkSignature(DC.LOCAL_FILE_HEADER),e.readLocalPart(this.reader),e.handleUTF8(),e.processAttributes()},readCentralDir:function(){var t;for(this.reader.setIndex(this.centralDirOffset);this.reader.readAndCheckSignature(DC.CENTRAL_FILE_HEADER);)(t=new MC({zip64:this.zip64},this.loadOptions)).readCentralPart(this.reader),this.files.push(t);if(this.centralDirRecords!==this.files.length&&0!==this.centralDirRecords&&0===this.files.length)throw new Error("Corrupted zip or bug: expected "+this.centralDirRecords+" records in central dir, got "+this.files.length)},readEndOfCentral:function(){var t=this.reader.lastIndexOfSignature(DC.CENTRAL_DIRECTORY_END);if(t<0)throw!this.isSignature(0,DC.LOCAL_FILE_HEADER)?new Error("Can't find end of central directory : is this a zip file ? If it is, see https://stuk.github.io/jszip/documentation/howto/read_zip.html"):new Error("Corrupted zip: can't find end of central directory");this.reader.setIndex(t);var e=t;if(this.checkSignature(DC.CENTRAL_DIRECTORY_END),this.readBlockEndOfCentral(),this.diskNumber===PC.MAX_VALUE_16BITS||this.diskWithCentralDirStart===PC.MAX_VALUE_16BITS||this.centralDirRecordsOnThisDisk===PC.MAX_VALUE_16BITS||this.centralDirRecords===PC.MAX_VALUE_16BITS||this.centralDirSize===PC.MAX_VALUE_32BITS||this.centralDirOffset===PC.MAX_VALUE_32BITS){if(this.zip64=!0,(t=this.reader.lastIndexOfSignature(DC.ZIP64_CENTRAL_DIRECTORY_LOCATOR))<0)throw new Error("Corrupted zip: can't find the ZIP64 end of central directory locator");if(this.reader.setIndex(t),this.checkSignature(DC.ZIP64_CENTRAL_DIRECTORY_LOCATOR),this.readBlockZip64EndOfCentralLocator(),!this.isSignature(this.relativeOffsetEndOfZip64CentralDir,DC.ZIP64_CENTRAL_DIRECTORY_END)&&(this.relativeOffsetEndOfZip64CentralDir=this.reader.lastIndexOfSignature(DC.ZIP64_CENTRAL_DIRECTORY_END),this.relativeOffsetEndOfZip64CentralDir<0))throw new Error("Corrupted zip: can't find the ZIP64 end of central directory");this.reader.setIndex(this.relativeOffsetEndOfZip64CentralDir),this.checkSignature(DC.ZIP64_CENTRAL_DIRECTORY_END),this.readBlockZip64EndOfCentral()}var r=this.centralDirOffset+this.centralDirSize;this.zip64&&(r+=20,r+=12+this.zip64EndOfCentralSize);var i=e-r;if(i>0)this.isSignature(e,DC.CENTRAL_FILE_HEADER)||(this.reader.zero=i);else if(i<0)throw new Error("Corrupted zip: missing "+Math.abs(i)+" bytes.")},prepareReader:function(t){this.reader=LC(t)},load:function(t){this.prepareReader(t),this.readEndOfCentral(),this.readCentralDir(),this.readLocalFiles()}};var FC=NC,jC=cw(),zC=hw,HC=s_,WC=FC,UC=jw,$C=ow;function VC(t){return new zC.Promise((function(e,r){var i=t.decompressed.getContentWorker().pipe(new UC);i.on("error",(function(t){r(t)})).on("end",(function(){i.streamInfo.crc32!==t.decompressed.crc32?r(new Error("Corrupted zip : CRC32 mismatch")):e()})).resume()}))}function GC(){if(!(this instanceof GC))return new GC;if(arguments.length)throw new Error("The constructor with parameters has been removed in JSZip 3.0, please check the upgrade guide.");this.files=Object.create(null),this.comment=null,this.root="",this.clone=function(){var t=new GC;for(var e in this)"function"!=typeof this[e]&&(t[e]=this[e]);return t}}GC.prototype=tC,GC.prototype.loadAsync=function(t,e){var r=this;return e=jC.extend(e||{},{base64:!1,checkCRC32:!1,optimizedBinaryString:!1,createFolders:!1,decodeFileName:HC.utf8decode}),$C.isNode&&$C.isStream(t)?zC.Promise.reject(new Error("JSZip can't accept a stream when loading a zip file.")):jC.prepareContent("the loaded zip file",t,!0,e.optimizedBinaryString,e.base64).then((function(t){var r=new WC(e);return r.load(t),r})).then((function(t){var r=[zC.Promise.resolve(t)],i=t.files;if(e.checkCRC32)for(var n=0;n<i.length;n++)r.push(VC(i[n]));return zC.Promise.all(r)})).then((function(t){for(var i=t.shift(),n=i.files,s=0;s<n.length;s++){var o=n[s],a=o.fileNameStr,l=jC.resolve(o.fileNameStr);r.file(l,o.decompressed,{binary:!0,optimizedBinaryString:!0,date:o.date,dir:o.dir,comment:o.fileCommentStr.length?o.fileCommentStr:null,unixPermissions:o.unixPermissions,dosPermissions:o.dosPermissions,createFolders:e.createFolders}),o.dir||(r.file(l).unsafeOriginalName=a)}return i.zipComment.length&&(r.comment=i.zipComment),r}))},GC.support=a_,GC.defaults=Aw,GC.version="3.10.1",GC.loadAsync=function(t,e){return(new GC).loadAsync(t,e)},GC.external=hw;var XC,YC,qC,ZC,KC,QC,JC=GC,tE={exports:{}};function eE(){return YC?XC:(YC=1,XC=n)}function rE(){if(ZC)return qC;function t(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);e&&(i=i.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,i)}return r}function e(e){for(var i=1;i<arguments.length;i++){var n=null!=arguments[i]?arguments[i]:{};i%2?t(Object(n),!0).forEach((function(t){r(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):t(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function r(t,e,r){return(e=n(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function i(t,e){for(var r=0;r<e.length;r++){var i=e[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,n(i.key),i)}}function n(t){var e=function(t,e){if("object"!=typeof t||null===t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var i=r.call(t,e||"default");if("object"!=typeof i)return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==typeof e?e:String(e)}ZC=1;var s=o.Buffer,l=a.inspect,h=l&&l.custom||"inspect";function c(t,e,r){s.prototype.copy.call(t,e,r)}return qC=function(){function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.head=null,this.tail=null,this.length=0}var r,n,o;return r=t,n=[{key:"push",value:function(t){var e={data:t,next:null};this.length>0?this.tail.next=e:this.head=e,this.tail=e,++this.length}},{key:"unshift",value:function(t){var e={data:t,next:this.head};0===this.length&&(this.tail=e),this.head=e,++this.length}},{key:"shift",value:function(){if(0!==this.length){var t=this.head.data;return 1===this.length?this.head=this.tail=null:this.head=this.head.next,--this.length,t}}},{key:"clear",value:function(){this.head=this.tail=null,this.length=0}},{key:"join",value:function(t){if(0===this.length)return"";for(var e=this.head,r=""+e.data;e=e.next;)r+=t+e.data;return r}},{key:"concat",value:function(t){if(0===this.length)return s.alloc(0);for(var e=s.allocUnsafe(t>>>0),r=this.head,i=0;r;)c(r.data,e,i),i+=r.data.length,r=r.next;return e}},{key:"consume",value:function(t,e){var r;return t<this.head.data.length?(r=this.head.data.slice(0,t),this.head.data=this.head.data.slice(t)):r=t===this.head.data.length?this.shift():e?this._getString(t):this._getBuffer(t),r}},{key:"first",value:function(){return this.head.data}},{key:"_getString",value:function(t){var e=this.head,r=1,i=e.data;for(t-=i.length;e=e.next;){var n=e.data,s=t>n.length?n.length:t;if(s===n.length?i+=n:i+=n.slice(0,t),0==(t-=s)){s===n.length?(++r,e.next?this.head=e.next:this.head=this.tail=null):(this.head=e,e.data=n.slice(s));break}++r}return this.length-=r,i}},{key:"_getBuffer",value:function(t){var e=s.allocUnsafe(t),r=this.head,i=1;for(r.data.copy(e),t-=r.data.length;r=r.next;){var n=r.data,o=t>n.length?n.length:t;if(n.copy(e,e.length-t,0,o),0==(t-=o)){o===n.length?(++i,r.next?this.head=r.next:this.head=this.tail=null):(this.head=r,r.data=n.slice(o));break}++i}return this.length-=i,e}},{key:h,value:function(t,r){return l(this,e(e({},r),{},{depth:0,customInspect:!1}))}}],n&&i(r.prototype,n),o&&i(r,o),Object.defineProperty(r,"prototype",{writable:!1}),t}(),qC}function iE(){if(QC)return KC;function t(t,i){r(t,i),e(t)}function e(t){t._writableState&&!t._writableState.emitClose||t._readableState&&!t._readableState.emitClose||t.emit("close")}function r(t,e){t.emit("error",e)}return QC=1,KC={destroy:function(i,n){var s=this,o=this._readableState&&this._readableState.destroyed,a=this._writableState&&this._writableState.destroyed;return o||a?(n?n(i):i&&(this._writableState?this._writableState.errorEmitted||(this._writableState.errorEmitted=!0,process.nextTick(r,this,i)):process.nextTick(r,this,i)),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(i||null,(function(r){!n&&r?s._writableState?s._writableState.errorEmitted?process.nextTick(e,s):(s._writableState.errorEmitted=!0,process.nextTick(t,s,r)):process.nextTick(t,s,r):n?(process.nextTick(e,s),n(r)):process.nextTick(e,s)})),this)},undestroy:function(){this._readableState&&(this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1),this._writableState&&(this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finalCalled=!1,this._writableState.prefinished=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1)},errorOrDestroy:function(t,e){var r=t._readableState,i=t._writableState;r&&r.autoDestroy||i&&i.autoDestroy?t.destroy(e):t.emit("error",e)}},KC}var nE,sE,oE,aE,lE,hE,cE,uE={};function dE(){if(nE)return uE;nE=1;const t={};function e(e,r,i){i||(i=Error);class n extends i{constructor(t,e,i){super(function(t,e,i){return"string"==typeof r?r:r(t,e,i)}(t,e,i))}}n.prototype.name=i.name,n.prototype.code=e,t[e]=n}function r(t,e){if(Array.isArray(t)){const r=t.length;return t=t.map((t=>String(t))),r>2?`one of ${e} ${t.slice(0,r-1).join(", ")}, or `+t[r-1]:2===r?`one of ${e} ${t[0]} or ${t[1]}`:`of ${e} ${t[0]}`}return`of ${e} ${String(t)}`}return e("ERR_INVALID_OPT_VALUE",(function(t,e){return'The value "'+e+'" is invalid for option "'+t+'"'}),TypeError),e("ERR_INVALID_ARG_TYPE",(function(t,e,i){let n;var s,o;let a;if("string"==typeof e&&(s="not ",e.substr(!o||o<0?0:+o,s.length)===s)?(n="must not be",e=e.replace(/^not /,"")):n="must be",function(t,e,r){return(void 0===r||r>t.length)&&(r=t.length),t.substring(r-e.length,r)===e}(t," argument"))a=`The ${t} ${n} ${r(e,"type")}`;else{const i=function(t,e,r){return"number"!=typeof r&&(r=0),!(r+e.length>t.length)&&-1!==t.indexOf(e,r)}(t,".")?"property":"argument";a=`The "${t}" ${i} ${n} ${r(e,"type")}`}return a+=". Received type "+typeof i,a}),TypeError),e("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF"),e("ERR_METHOD_NOT_IMPLEMENTED",(function(t){return"The "+t+" method is not implemented"})),e("ERR_STREAM_PREMATURE_CLOSE","Premature close"),e("ERR_STREAM_DESTROYED",(function(t){return"Cannot call "+t+" after a stream was destroyed"})),e("ERR_MULTIPLE_CALLBACK","Callback called multiple times"),e("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable"),e("ERR_STREAM_WRITE_AFTER_END","write after end"),e("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError),e("ERR_UNKNOWN_ENCODING",(function(t){return"Unknown encoding: "+t}),TypeError),e("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event"),uE.codes=t,uE}function pE(){if(oE)return sE;oE=1;var t=dE().codes.ERR_INVALID_OPT_VALUE;return sE={getHighWaterMark:function(e,r,i,n){var s=function(t,e,r){return null!=t.highWaterMark?t.highWaterMark:e?t[r]:null}(r,n,i);if(null!=s){if(!isFinite(s)||Math.floor(s)!==s||s<0)throw new t(n?i:"highWaterMark",s);return Math.floor(s)}return e.objectMode?16:16384}}}function fE(){if(lE)return aE;function t(t){var e=this;this.next=null,this.entry=null,this.finish=function(){!function(t,e,r){var i=t.entry;t.entry=null;for(;i;){var n=i.callback;e.pendingcb--,n(r),i=i.next}e.corkedRequestsFree.next=t}(e,t)}}var e;lE=1,aE=x,x.WritableState=w;var r={deprecate:M_()},i=eE(),n=o.Buffer,s=(void 0!==dt?dt:"undefined"!=typeof window?window:"undefined"!=typeof self?self:{}).Uint8Array||function(){};var a,l=iE(),h=pE().getHighWaterMark,c=dE().codes,u=c.ERR_INVALID_ARG_TYPE,d=c.ERR_METHOD_NOT_IMPLEMENTED,p=c.ERR_MULTIPLE_CALLBACK,f=c.ERR_STREAM_CANNOT_PIPE,g=c.ERR_STREAM_DESTROYED,m=c.ERR_STREAM_NULL_VALUES,y=c.ERR_STREAM_WRITE_AFTER_END,v=c.ERR_UNKNOWN_ENCODING,b=l.errorOrDestroy;function _(){}function w(r,i,n){e=e||gE(),r=r||{},"boolean"!=typeof n&&(n=i instanceof e),this.objectMode=!!r.objectMode,n&&(this.objectMode=this.objectMode||!!r.writableObjectMode),this.highWaterMark=h(this,r,"writableHighWaterMark",n),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var s=!1===r.decodeStrings;this.decodeStrings=!s,this.defaultEncoding=r.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(t){!function(t,e){var r=t._writableState,i=r.sync,n=r.writecb;if("function"!=typeof n)throw new p;if(function(t){t.writing=!1,t.writecb=null,t.length-=t.writelen,t.writelen=0}(r),e)!function(t,e,r,i,n){--e.pendingcb,r?(process.nextTick(n,i),process.nextTick(A,t,e),t._writableState.errorEmitted=!0,b(t,i)):(n(i),t._writableState.errorEmitted=!0,b(t,i),A(t,e))}(t,r,i,e,n);else{var s=C(r)||t.destroyed;s||r.corked||r.bufferProcessing||!r.bufferedRequest||k(t,r),i?process.nextTick(T,t,r,s,n):T(t,r,s,n)}}(i,t)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.emitClose=!1!==r.emitClose,this.autoDestroy=!!r.autoDestroy,this.bufferedRequestCount=0,this.corkedRequestsFree=new t(this)}function x(t){var r=this instanceof(e=e||gE());if(!r&&!a.call(x,this))return new x(t);this._writableState=new w(t,this,r),this.writable=!0,t&&("function"==typeof t.write&&(this._write=t.write),"function"==typeof t.writev&&(this._writev=t.writev),"function"==typeof t.destroy&&(this._destroy=t.destroy),"function"==typeof t.final&&(this._final=t.final)),i.call(this)}function S(t,e,r,i,n,s,o){e.writelen=i,e.writecb=o,e.writing=!0,e.sync=!0,e.destroyed?e.onwrite(new g("write")):r?t._writev(n,e.onwrite):t._write(n,s,e.onwrite),e.sync=!1}function T(t,e,r,i){r||function(t,e){0===e.length&&e.needDrain&&(e.needDrain=!1,t.emit("drain"))}(t,e),e.pendingcb--,i(),A(t,e)}function k(e,r){r.bufferProcessing=!0;var i=r.bufferedRequest;if(e._writev&&i&&i.next){var n=r.bufferedRequestCount,s=new Array(n),o=r.corkedRequestsFree;o.entry=i;for(var a=0,l=!0;i;)s[a]=i,i.isBuf||(l=!1),i=i.next,a+=1;s.allBuffers=l,S(e,r,!0,r.length,s,"",o.finish),r.pendingcb++,r.lastBufferedRequest=null,o.next?(r.corkedRequestsFree=o.next,o.next=null):r.corkedRequestsFree=new t(r),r.bufferedRequestCount=0}else{for(;i;){var h=i.chunk,c=i.encoding,u=i.callback;if(S(e,r,!1,r.objectMode?1:h.length,h,c,u),i=i.next,r.bufferedRequestCount--,r.writing)break}null===i&&(r.lastBufferedRequest=null)}r.bufferedRequest=i,r.bufferProcessing=!1}function C(t){return t.ending&&0===t.length&&null===t.bufferedRequest&&!t.finished&&!t.writing}function E(t,e){t._final((function(r){e.pendingcb--,r&&b(t,r),e.prefinished=!0,t.emit("prefinish"),A(t,e)}))}function A(t,e){var r=C(e);if(r&&(function(t,e){e.prefinished||e.finalCalled||("function"!=typeof t._final||e.destroyed?(e.prefinished=!0,t.emit("prefinish")):(e.pendingcb++,e.finalCalled=!0,process.nextTick(E,t,e)))}(t,e),0===e.pendingcb&&(e.finished=!0,t.emit("finish"),e.autoDestroy))){var i=t._readableState;(!i||i.autoDestroy&&i.endEmitted)&&t.destroy()}return r}return x_()(x,i),w.prototype.getBuffer=function(){for(var t=this.bufferedRequest,e=[];t;)e.push(t),t=t.next;return e},function(){try{Object.defineProperty(w.prototype,"buffer",{get:r.deprecate((function(){return this.getBuffer()}),"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch(t){}}(),"function"==typeof Symbol&&Symbol.hasInstance&&"function"==typeof Function.prototype[Symbol.hasInstance]?(a=Function.prototype[Symbol.hasInstance],Object.defineProperty(x,Symbol.hasInstance,{value:function(t){return!!a.call(this,t)||this===x&&(t&&t._writableState instanceof w)}})):a=function(t){return t instanceof this},x.prototype.pipe=function(){b(this,new f)},x.prototype.write=function(t,e,r){var i,o=this._writableState,a=!1,l=!o.objectMode&&(i=t,n.isBuffer(i)||i instanceof s);return l&&!n.isBuffer(t)&&(t=function(t){return n.from(t)}(t)),"function"==typeof e&&(r=e,e=null),l?e="buffer":e||(e=o.defaultEncoding),"function"!=typeof r&&(r=_),o.ending?function(t,e){var r=new y;b(t,r),process.nextTick(e,r)}(this,r):(l||function(t,e,r,i){var n;return null===r?n=new m:"string"==typeof r||e.objectMode||(n=new u("chunk",["string","Buffer"],r)),!n||(b(t,n),process.nextTick(i,n),!1)}(this,o,t,r))&&(o.pendingcb++,a=function(t,e,r,i,s,o){if(!r){var a=function(t,e,r){t.objectMode||!1===t.decodeStrings||"string"!=typeof e||(e=n.from(e,r));return e}(e,i,s);i!==a&&(r=!0,s="buffer",i=a)}var l=e.objectMode?1:i.length;e.length+=l;var h=e.length<e.highWaterMark;h||(e.needDrain=!0);if(e.writing||e.corked){var c=e.lastBufferedRequest;e.lastBufferedRequest={chunk:i,encoding:s,isBuf:r,callback:o,next:null},c?c.next=e.lastBufferedRequest:e.bufferedRequest=e.lastBufferedRequest,e.bufferedRequestCount+=1}else S(t,e,!1,l,i,s,o);return h}(this,o,l,t,e,r)),a},x.prototype.cork=function(){this._writableState.corked++},x.prototype.uncork=function(){var t=this._writableState;t.corked&&(t.corked--,t.writing||t.corked||t.bufferProcessing||!t.bufferedRequest||k(this,t))},x.prototype.setDefaultEncoding=function(t){if("string"==typeof t&&(t=t.toLowerCase()),!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((t+"").toLowerCase())>-1))throw new v(t);return this._writableState.defaultEncoding=t,this},Object.defineProperty(x.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(x.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),x.prototype._write=function(t,e,r){r(new d("_write()"))},x.prototype._writev=null,x.prototype.end=function(t,e,r){var i=this._writableState;return"function"==typeof t?(r=t,t=null,e=null):"function"==typeof e&&(r=e,e=null),null!=t&&this.write(t,e),i.corked&&(i.corked=1,this.uncork()),i.ending||function(t,e,r){e.ending=!0,A(t,e),r&&(e.finished?process.nextTick(r):t.once("finish",r));e.ended=!0,t.writable=!1}(this,i,r),this},Object.defineProperty(x.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}}),Object.defineProperty(x.prototype,"destroyed",{enumerable:!1,get:function(){return void 0!==this._writableState&&this._writableState.destroyed},set:function(t){this._writableState&&(this._writableState.destroyed=t)}}),x.prototype.destroy=l.destroy,x.prototype._undestroy=l.undestroy,x.prototype._destroy=function(t,e){e(t)},aE}function gE(){if(cE)return hE;cE=1;var t=Object.keys||function(t){var e=[];for(var r in t)e.push(r);return e};hE=o;var e=FE(),r=fE();x_()(o,e);for(var i=t(r.prototype),n=0;n<i.length;n++){var s=i[n];o.prototype[s]||(o.prototype[s]=r.prototype[s])}function o(t){if(!(this instanceof o))return new o(t);e.call(this,t),r.call(this,t),this.allowHalfOpen=!0,t&&(!1===t.readable&&(this.readable=!1),!1===t.writable&&(this.writable=!1),!1===t.allowHalfOpen&&(this.allowHalfOpen=!1,this.once("end",a)))}function a(){this._writableState.ended||process.nextTick(l,this)}function l(t){t.end()}return Object.defineProperty(o.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),Object.defineProperty(o.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(o.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}}),Object.defineProperty(o.prototype,"destroyed",{enumerable:!1,get:function(){return void 0!==this._readableState&&void 0!==this._writableState&&(this._readableState.destroyed&&this._writableState.destroyed)},set:function(t){void 0!==this._readableState&&void 0!==this._writableState&&(this._readableState.destroyed=t,this._writableState.destroyed=t)}}),hE}var mE,yE,vE,bE,_E,wE,xE,SE,TE,kE,CE,EE,AE,OE,BE,RE,LE={},PE={exports:{}};function DE(){if(yE)return LE;yE=1;var t=(mE||(mE=1,function(t,e){var r=o,i=r.Buffer;function n(t,e){for(var r in t)e[r]=t[r]}function s(t,e,r){return i(t,e,r)}i.from&&i.alloc&&i.allocUnsafe&&i.allocUnsafeSlow?t.exports=r:(n(r,e),e.Buffer=s),s.prototype=Object.create(i.prototype),n(i,s),s.from=function(t,e,r){if("number"==typeof t)throw new TypeError("Argument must not be a number");return i(t,e,r)},s.alloc=function(t,e,r){if("number"!=typeof t)throw new TypeError("Argument must be a number");var n=i(t);return void 0!==e?"string"==typeof r?n.fill(e,r):n.fill(e):n.fill(0),n},s.allocUnsafe=function(t){if("number"!=typeof t)throw new TypeError("Argument must be a number");return i(t)},s.allocUnsafeSlow=function(t){if("number"!=typeof t)throw new TypeError("Argument must be a number");return r.SlowBuffer(t)}}(PE,PE.exports)),PE.exports).Buffer,e=t.isEncoding||function(t){switch((t=""+t)&&t.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};function r(r){var i;switch(this.encoding=function(r){var i=function(t){if(!t)return"utf8";for(var e;;)switch(t){case"utf8":case"utf-8":return"utf8";case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return"utf16le";case"latin1":case"binary":return"latin1";case"base64":case"ascii":case"hex":return t;default:if(e)return;t=(""+t).toLowerCase(),e=!0}}(r);if("string"!=typeof i&&(t.isEncoding===e||!e(r)))throw new Error("Unknown encoding: "+r);return i||r}(r),this.encoding){case"utf16le":this.text=s,this.end=a,i=4;break;case"utf8":this.fillLast=n,i=4;break;case"base64":this.text=l,this.end=h,i=3;break;default:return this.write=c,void(this.end=u)}this.lastNeed=0,this.lastTotal=0,this.lastChar=t.allocUnsafe(i)}function i(t){return t<=127?0:t>>5==6?2:t>>4==14?3:t>>3==30?4:t>>6==2?-1:-2}function n(t){var e=this.lastTotal-this.lastNeed,r=function(t,e,r){if(128!=(192&e[0]))return t.lastNeed=0,"�";if(t.lastNeed>1&&e.length>1){if(128!=(192&e[1]))return t.lastNeed=1,"�";if(t.lastNeed>2&&e.length>2&&128!=(192&e[2]))return t.lastNeed=2,"�"}}(this,t);return void 0!==r?r:this.lastNeed<=t.length?(t.copy(this.lastChar,e,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal)):(t.copy(this.lastChar,e,0,t.length),void(this.lastNeed-=t.length))}function s(t,e){if((t.length-e)%2==0){var r=t.toString("utf16le",e);if(r){var i=r.charCodeAt(r.length-1);if(i>=55296&&i<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=t[t.length-2],this.lastChar[1]=t[t.length-1],r.slice(0,-1)}return r}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=t[t.length-1],t.toString("utf16le",e,t.length-1)}function a(t){var e=t&&t.length?this.write(t):"";if(this.lastNeed){var r=this.lastTotal-this.lastNeed;return e+this.lastChar.toString("utf16le",0,r)}return e}function l(t,e){var r=(t.length-e)%3;return 0===r?t.toString("base64",e):(this.lastNeed=3-r,this.lastTotal=3,1===r?this.lastChar[0]=t[t.length-1]:(this.lastChar[0]=t[t.length-2],this.lastChar[1]=t[t.length-1]),t.toString("base64",e,t.length-r))}function h(t){var e=t&&t.length?this.write(t):"";return this.lastNeed?e+this.lastChar.toString("base64",0,3-this.lastNeed):e}function c(t){return t.toString(this.encoding)}function u(t){return t&&t.length?this.write(t):""}return LE.StringDecoder=r,r.prototype.write=function(t){if(0===t.length)return"";var e,r;if(this.lastNeed){if(void 0===(e=this.fillLast(t)))return"";r=this.lastNeed,this.lastNeed=0}else r=0;return r<t.length?e?e+this.text(t,r):this.text(t,r):e||""},r.prototype.end=function(t){var e=t&&t.length?this.write(t):"";return this.lastNeed?e+"�":e},r.prototype.text=function(t,e){var r=function(t,e,r){var n=e.length-1;if(n<r)return 0;var s=i(e[n]);if(s>=0)return s>0&&(t.lastNeed=s-1),s;if(--n<r||-2===s)return 0;if(s=i(e[n]),s>=0)return s>0&&(t.lastNeed=s-2),s;if(--n<r||-2===s)return 0;if(s=i(e[n]),s>=0)return s>0&&(2===s?s=0:t.lastNeed=s-3),s;return 0}(this,t,e);if(!this.lastNeed)return t.toString("utf8",e);this.lastTotal=r;var n=t.length-(r-this.lastNeed);return t.copy(this.lastChar,0,n),t.toString("utf8",e,n)},r.prototype.fillLast=function(t){if(this.lastNeed<=t.length)return t.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);t.copy(this.lastChar,this.lastTotal-this.lastNeed,0,t.length),this.lastNeed-=t.length},LE}function ME(){if(bE)return vE;bE=1;var t=dE().codes.ERR_STREAM_PREMATURE_CLOSE;function e(){}return vE=function r(i,n,s){if("function"==typeof n)return r(i,null,n);n||(n={}),s=function(t){var e=!1;return function(){if(!e){e=!0;for(var r=arguments.length,i=new Array(r),n=0;n<r;n++)i[n]=arguments[n];t.apply(this,i)}}}(s||e);var o=n.readable||!1!==n.readable&&i.readable,a=n.writable||!1!==n.writable&&i.writable,l=function(){i.writable||c()},h=i._writableState&&i._writableState.finished,c=function(){a=!1,h=!0,o||s.call(i)},u=i._readableState&&i._readableState.endEmitted,d=function(){o=!1,u=!0,a||s.call(i)},p=function(t){s.call(i,t)},f=function(){var e;return o&&!u?(i._readableState&&i._readableState.ended||(e=new t),s.call(i,e)):a&&!h?(i._writableState&&i._writableState.ended||(e=new t),s.call(i,e)):void 0},g=function(){i.req.on("finish",c)};return!function(t){return t.setHeader&&"function"==typeof t.abort}(i)?a&&!i._writableState&&(i.on("end",l),i.on("close",l)):(i.on("complete",c),i.on("abort",f),i.req?g():i.on("request",g)),i.on("end",d),i.on("finish",c),!1!==n.error&&i.on("error",p),i.on("close",f),function(){i.removeListener("complete",c),i.removeListener("abort",f),i.removeListener("request",g),i.req&&i.req.removeListener("finish",c),i.removeListener("end",l),i.removeListener("close",l),i.removeListener("finish",c),i.removeListener("end",d),i.removeListener("error",p),i.removeListener("close",f)}},vE}function IE(){if(wE)return _E;var t;function e(t,e,r){return(e=function(t){var e=function(t,e){if("object"!=typeof t||null===t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var i=r.call(t,e||"default");if("object"!=typeof i)return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==typeof e?e:String(e)}(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}wE=1;var r=ME(),i=Symbol("lastResolve"),n=Symbol("lastReject"),s=Symbol("error"),o=Symbol("ended"),a=Symbol("lastPromise"),l=Symbol("handlePromise"),h=Symbol("stream");function c(t,e){return{value:t,done:e}}function u(t){var e=t[i];if(null!==e){var r=t[h].read();null!==r&&(t[a]=null,t[i]=null,t[n]=null,e(c(r,!1)))}}function d(t){process.nextTick(u,t)}var p=Object.getPrototypeOf((function(){})),f=Object.setPrototypeOf((t={get stream(){return this[h]},next:function(){var t=this,e=this[s];if(null!==e)return Promise.reject(e);if(this[o])return Promise.resolve(c(void 0,!0));if(this[h].destroyed)return new Promise((function(e,r){process.nextTick((function(){t[s]?r(t[s]):e(c(void 0,!0))}))}));var r,i=this[a];if(i)r=new Promise(function(t,e){return function(r,i){t.then((function(){e[o]?r(c(void 0,!0)):e[l](r,i)}),i)}}(i,this));else{var n=this[h].read();if(null!==n)return Promise.resolve(c(n,!1));r=new Promise(this[l])}return this[a]=r,r}},e(t,Symbol.asyncIterator,(function(){return this})),e(t,"return",(function(){var t=this;return new Promise((function(e,r){t[h].destroy(null,(function(t){t?r(t):e(c(void 0,!0))}))}))})),t),p);return _E=function(t){var u,p=Object.create(f,(e(u={},h,{value:t,writable:!0}),e(u,i,{value:null,writable:!0}),e(u,n,{value:null,writable:!0}),e(u,s,{value:null,writable:!0}),e(u,o,{value:t._readableState.endEmitted,writable:!0}),e(u,l,{value:function(t,e){var r=p[h].read();r?(p[a]=null,p[i]=null,p[n]=null,t(c(r,!1))):(p[i]=t,p[n]=e)},writable:!0}),u));return p[a]=null,r(t,(function(t){if(t&&"ERR_STREAM_PREMATURE_CLOSE"!==t.code){var e=p[n];return null!==e&&(p[a]=null,p[i]=null,p[n]=null,e(t)),void(p[s]=t)}var r=p[i];null!==r&&(p[a]=null,p[i]=null,p[n]=null,r(c(void 0,!0))),p[o]=!0})),t.on("readable",d.bind(null,p)),p},_E}function NE(){if(SE)return xE;function t(t,e,r,i,n,s,o){try{var a=t[s](o),l=a.value}catch(t){return void r(t)}a.done?e(l):Promise.resolve(l).then(i,n)}function e(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);e&&(i=i.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,i)}return r}function r(t,e,r){return(e=function(t){var e=function(t,e){if("object"!=typeof t||null===t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var i=r.call(t,e||"default");if("object"!=typeof i)return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==typeof e?e:String(e)}(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}SE=1;var i=dE().codes.ERR_INVALID_ARG_TYPE;return xE=function(n,s,o){var a;if(s&&"function"==typeof s.next)a=s;else if(s&&s[Symbol.asyncIterator])a=s[Symbol.asyncIterator]();else{if(!s||!s[Symbol.iterator])throw new i("iterable",["Iterable"],s);a=s[Symbol.iterator]()}var l=new n(function(t){for(var i=1;i<arguments.length;i++){var n=null!=arguments[i]?arguments[i]:{};i%2?e(Object(n),!0).forEach((function(e){r(t,e,n[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):e(Object(n)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}))}return t}({objectMode:!0},o)),h=!1;function c(){return u.apply(this,arguments)}function u(){var e;return e=function*(){try{var t=yield a.next(),e=t.value;t.done?l.push(null):l.push(yield e)?c():h=!1}catch(t){l.destroy(t)}},u=function(){var r=this,i=arguments;return new Promise((function(n,s){var o=e.apply(r,i);function a(e){t(o,n,s,a,l,"next",e)}function l(e){t(o,n,s,a,l,"throw",e)}a(void 0)}))},u.apply(this,arguments)}return l._read=function(){h||(h=!0,c())},l},xE}function FE(){if(kE)return TE;var t;kE=1,TE=T,T.ReadableState=S,s.EventEmitter;var e=function(t,e){return t.listeners(e).length},r=eE(),i=o.Buffer,n=(void 0!==dt?dt:"undefined"!=typeof window?window:"undefined"!=typeof self?self:{}).Uint8Array||function(){};var l,h=a;l=h&&h.debuglog?h.debuglog("stream"):function(){};var c,u,d,p=rE(),f=iE(),g=pE().getHighWaterMark,m=dE().codes,y=m.ERR_INVALID_ARG_TYPE,v=m.ERR_STREAM_PUSH_AFTER_EOF,b=m.ERR_METHOD_NOT_IMPLEMENTED,_=m.ERR_STREAM_UNSHIFT_AFTER_END_EVENT;x_()(T,r);var w=f.errorOrDestroy,x=["error","close","destroy","pause","resume"];function S(e,r,i){t=t||gE(),e=e||{},"boolean"!=typeof i&&(i=r instanceof t),this.objectMode=!!e.objectMode,i&&(this.objectMode=this.objectMode||!!e.readableObjectMode),this.highWaterMark=g(this,e,"readableHighWaterMark",i),this.buffer=new p,this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this.paused=!0,this.emitClose=!1!==e.emitClose,this.autoDestroy=!!e.autoDestroy,this.destroyed=!1,this.defaultEncoding=e.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,e.encoding&&(c||(c=DE().StringDecoder),this.decoder=new c(e.encoding),this.encoding=e.encoding)}function T(e){if(t=t||gE(),!(this instanceof T))return new T(e);var i=this instanceof t;this._readableState=new S(e,this,i),this.readable=!0,e&&("function"==typeof e.read&&(this._read=e.read),"function"==typeof e.destroy&&(this._destroy=e.destroy)),r.call(this)}function k(t,e,r,s,o){l("readableAddChunk",e);var a,h=t._readableState;if(null===e)h.reading=!1,function(t,e){if(l("onEofChunk"),e.ended)return;if(e.decoder){var r=e.decoder.end();r&&r.length&&(e.buffer.push(r),e.length+=e.objectMode?1:r.length)}e.ended=!0,e.sync?O(t):(e.needReadable=!1,e.emittedReadable||(e.emittedReadable=!0,B(t)))}(t,h);else if(o||(a=function(t,e){var r;s=e,i.isBuffer(s)||s instanceof n||"string"==typeof e||void 0===e||t.objectMode||(r=new y("chunk",["string","Buffer","Uint8Array"],e));var s;return r}(h,e)),a)w(t,a);else if(h.objectMode||e&&e.length>0)if("string"==typeof e||h.objectMode||Object.getPrototypeOf(e)===i.prototype||(e=function(t){return i.from(t)}(e)),s)h.endEmitted?w(t,new _):C(t,h,e,!0);else if(h.ended)w(t,new v);else{if(h.destroyed)return!1;h.reading=!1,h.decoder&&!r?(e=h.decoder.write(e),h.objectMode||0!==e.length?C(t,h,e,!1):R(t,h)):C(t,h,e,!1)}else s||(h.reading=!1,R(t,h));return!h.ended&&(h.length<h.highWaterMark||0===h.length)}function C(t,e,r,i){e.flowing&&0===e.length&&!e.sync?(e.awaitDrain=0,t.emit("data",r)):(e.length+=e.objectMode?1:r.length,i?e.buffer.unshift(r):e.buffer.push(r),e.needReadable&&O(t)),R(t,e)}Object.defineProperty(T.prototype,"destroyed",{enumerable:!1,get:function(){return void 0!==this._readableState&&this._readableState.destroyed},set:function(t){this._readableState&&(this._readableState.destroyed=t)}}),T.prototype.destroy=f.destroy,T.prototype._undestroy=f.undestroy,T.prototype._destroy=function(t,e){e(t)},T.prototype.push=function(t,e){var r,n=this._readableState;return n.objectMode?r=!0:"string"==typeof t&&((e=e||n.defaultEncoding)!==n.encoding&&(t=i.from(t,e),e=""),r=!0),k(this,t,e,!1,r)},T.prototype.unshift=function(t){return k(this,t,null,!0,!1)},T.prototype.isPaused=function(){return!1===this._readableState.flowing},T.prototype.setEncoding=function(t){c||(c=DE().StringDecoder);var e=new c(t);this._readableState.decoder=e,this._readableState.encoding=this._readableState.decoder.encoding;for(var r=this._readableState.buffer.head,i="";null!==r;)i+=e.write(r.data),r=r.next;return this._readableState.buffer.clear(),""!==i&&this._readableState.buffer.push(i),this._readableState.length=i.length,this};var E=1073741824;function A(t,e){return t<=0||0===e.length&&e.ended?0:e.objectMode?1:t!=t?e.flowing&&e.length?e.buffer.head.data.length:e.length:(t>e.highWaterMark&&(e.highWaterMark=function(t){return t>=E?t=E:(t--,t|=t>>>1,t|=t>>>2,t|=t>>>4,t|=t>>>8,t|=t>>>16,t++),t}(t)),t<=e.length?t:e.ended?e.length:(e.needReadable=!0,0))}function O(t){var e=t._readableState;l("emitReadable",e.needReadable,e.emittedReadable),e.needReadable=!1,e.emittedReadable||(l("emitReadable",e.flowing),e.emittedReadable=!0,process.nextTick(B,t))}function B(t){var e=t._readableState;l("emitReadable_",e.destroyed,e.length,e.ended),e.destroyed||!e.length&&!e.ended||(t.emit("readable"),e.emittedReadable=!1),e.needReadable=!e.flowing&&!e.ended&&e.length<=e.highWaterMark,I(t)}function R(t,e){e.readingMore||(e.readingMore=!0,process.nextTick(L,t,e))}function L(t,e){for(;!e.reading&&!e.ended&&(e.length<e.highWaterMark||e.flowing&&0===e.length);){var r=e.length;if(l("maybeReadMore read 0"),t.read(0),r===e.length)break}e.readingMore=!1}function P(t){var e=t._readableState;e.readableListening=t.listenerCount("readable")>0,e.resumeScheduled&&!e.paused?e.flowing=!0:t.listenerCount("data")>0&&t.resume()}function D(t){l("readable nexttick read 0"),t.read(0)}function M(t,e){l("resume",e.reading),e.reading||t.read(0),e.resumeScheduled=!1,t.emit("resume"),I(t),e.flowing&&!e.reading&&t.read(0)}function I(t){var e=t._readableState;for(l("flow",e.flowing);e.flowing&&null!==t.read(););}function N(t,e){return 0===e.length?null:(e.objectMode?r=e.buffer.shift():!t||t>=e.length?(r=e.decoder?e.buffer.join(""):1===e.buffer.length?e.buffer.first():e.buffer.concat(e.length),e.buffer.clear()):r=e.buffer.consume(t,e.decoder),r);var r}function F(t){var e=t._readableState;l("endReadable",e.endEmitted),e.endEmitted||(e.ended=!0,process.nextTick(j,e,t))}function j(t,e){if(l("endReadableNT",t.endEmitted,t.length),!t.endEmitted&&0===t.length&&(t.endEmitted=!0,e.readable=!1,e.emit("end"),t.autoDestroy)){var r=e._writableState;(!r||r.autoDestroy&&r.finished)&&e.destroy()}}function z(t,e){for(var r=0,i=t.length;r<i;r++)if(t[r]===e)return r;return-1}return T.prototype.read=function(t){l("read",t),t=parseInt(t,10);var e=this._readableState,r=t;if(0!==t&&(e.emittedReadable=!1),0===t&&e.needReadable&&((0!==e.highWaterMark?e.length>=e.highWaterMark:e.length>0)||e.ended))return l("read: emitReadable",e.length,e.ended),0===e.length&&e.ended?F(this):O(this),null;if(0===(t=A(t,e))&&e.ended)return 0===e.length&&F(this),null;var i,n=e.needReadable;return l("need readable",n),(0===e.length||e.length-t<e.highWaterMark)&&l("length less than watermark",n=!0),e.ended||e.reading?l("reading or ended",n=!1):n&&(l("do read"),e.reading=!0,e.sync=!0,0===e.length&&(e.needReadable=!0),this._read(e.highWaterMark),e.sync=!1,e.reading||(t=A(r,e))),null===(i=t>0?N(t,e):null)?(e.needReadable=e.length<=e.highWaterMark,t=0):(e.length-=t,e.awaitDrain=0),0===e.length&&(e.ended||(e.needReadable=!0),r!==t&&e.ended&&F(this)),null!==i&&this.emit("data",i),i},T.prototype._read=function(t){w(this,new b("_read()"))},T.prototype.pipe=function(t,r){var i=this,n=this._readableState;switch(n.pipesCount){case 0:n.pipes=t;break;case 1:n.pipes=[n.pipes,t];break;default:n.pipes.push(t)}n.pipesCount+=1,l("pipe count=%d opts=%j",n.pipesCount,r);var s=(!r||!1!==r.end)&&t!==process.stdout&&t!==process.stderr?a:g;function o(e,r){l("onunpipe"),e===i&&r&&!1===r.hasUnpiped&&(r.hasUnpiped=!0,l("cleanup"),t.removeListener("close",p),t.removeListener("finish",f),t.removeListener("drain",h),t.removeListener("error",d),t.removeListener("unpipe",o),i.removeListener("end",a),i.removeListener("end",g),i.removeListener("data",u),c=!0,!n.awaitDrain||t._writableState&&!t._writableState.needDrain||h())}function a(){l("onend"),t.end()}n.endEmitted?process.nextTick(s):i.once("end",s),t.on("unpipe",o);var h=function(t){return function(){var r=t._readableState;l("pipeOnDrain",r.awaitDrain),r.awaitDrain&&r.awaitDrain--,0===r.awaitDrain&&e(t,"data")&&(r.flowing=!0,I(t))}}(i);t.on("drain",h);var c=!1;function u(e){l("ondata");var r=t.write(e);l("dest.write",r),!1===r&&((1===n.pipesCount&&n.pipes===t||n.pipesCount>1&&-1!==z(n.pipes,t))&&!c&&(l("false write response, pause",n.awaitDrain),n.awaitDrain++),i.pause())}function d(r){l("onerror",r),g(),t.removeListener("error",d),0===e(t,"error")&&w(t,r)}function p(){t.removeListener("finish",f),g()}function f(){l("onfinish"),t.removeListener("close",p),g()}function g(){l("unpipe"),i.unpipe(t)}return i.on("data",u),function(t,e,r){if("function"==typeof t.prependListener)return t.prependListener(e,r);t._events&&t._events[e]?Array.isArray(t._events[e])?t._events[e].unshift(r):t._events[e]=[r,t._events[e]]:t.on(e,r)}(t,"error",d),t.once("close",p),t.once("finish",f),t.emit("pipe",i),n.flowing||(l("pipe resume"),i.resume()),t},T.prototype.unpipe=function(t){var e=this._readableState,r={hasUnpiped:!1};if(0===e.pipesCount)return this;if(1===e.pipesCount)return t&&t!==e.pipes||(t||(t=e.pipes),e.pipes=null,e.pipesCount=0,e.flowing=!1,t&&t.emit("unpipe",this,r)),this;if(!t){var i=e.pipes,n=e.pipesCount;e.pipes=null,e.pipesCount=0,e.flowing=!1;for(var s=0;s<n;s++)i[s].emit("unpipe",this,{hasUnpiped:!1});return this}var o=z(e.pipes,t);return-1===o||(e.pipes.splice(o,1),e.pipesCount-=1,1===e.pipesCount&&(e.pipes=e.pipes[0]),t.emit("unpipe",this,r)),this},T.prototype.on=function(t,e){var i=r.prototype.on.call(this,t,e),n=this._readableState;return"data"===t?(n.readableListening=this.listenerCount("readable")>0,!1!==n.flowing&&this.resume()):"readable"===t&&(n.endEmitted||n.readableListening||(n.readableListening=n.needReadable=!0,n.flowing=!1,n.emittedReadable=!1,l("on readable",n.length,n.reading),n.length?O(this):n.reading||process.nextTick(D,this))),i},T.prototype.addListener=T.prototype.on,T.prototype.removeListener=function(t,e){var i=r.prototype.removeListener.call(this,t,e);return"readable"===t&&process.nextTick(P,this),i},T.prototype.removeAllListeners=function(t){var e=r.prototype.removeAllListeners.apply(this,arguments);return"readable"!==t&&void 0!==t||process.nextTick(P,this),e},T.prototype.resume=function(){var t=this._readableState;return t.flowing||(l("resume"),t.flowing=!t.readableListening,function(t,e){e.resumeScheduled||(e.resumeScheduled=!0,process.nextTick(M,t,e))}(this,t)),t.paused=!1,this},T.prototype.pause=function(){return l("call pause flowing=%j",this._readableState.flowing),!1!==this._readableState.flowing&&(l("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState.paused=!0,this},T.prototype.wrap=function(t){var e=this,r=this._readableState,i=!1;for(var n in t.on("end",(function(){if(l("wrapped end"),r.decoder&&!r.ended){var t=r.decoder.end();t&&t.length&&e.push(t)}e.push(null)})),t.on("data",(function(n){(l("wrapped data"),r.decoder&&(n=r.decoder.write(n)),r.objectMode&&null==n)||(r.objectMode||n&&n.length)&&(e.push(n)||(i=!0,t.pause()))})),t)void 0===this[n]&&"function"==typeof t[n]&&(this[n]=function(e){return function(){return t[e].apply(t,arguments)}}(n));for(var s=0;s<x.length;s++)t.on(x[s],this.emit.bind(this,x[s]));return this._read=function(e){l("wrapped _read",e),i&&(i=!1,t.resume())},this},"function"==typeof Symbol&&(T.prototype[Symbol.asyncIterator]=function(){return void 0===u&&(u=IE()),u(this)}),Object.defineProperty(T.prototype,"readableHighWaterMark",{enumerable:!1,get:function(){return this._readableState.highWaterMark}}),Object.defineProperty(T.prototype,"readableBuffer",{enumerable:!1,get:function(){return this._readableState&&this._readableState.buffer}}),Object.defineProperty(T.prototype,"readableFlowing",{enumerable:!1,get:function(){return this._readableState.flowing},set:function(t){this._readableState&&(this._readableState.flowing=t)}}),T._fromList=N,Object.defineProperty(T.prototype,"readableLength",{enumerable:!1,get:function(){return this._readableState.length}}),"function"==typeof Symbol&&(T.from=function(t,e){return void 0===d&&(d=NE()),d(T,t,e)}),TE}function jE(){if(EE)return CE;EE=1,CE=a;var t=dE().codes,e=t.ERR_METHOD_NOT_IMPLEMENTED,r=t.ERR_MULTIPLE_CALLBACK,i=t.ERR_TRANSFORM_ALREADY_TRANSFORMING,n=t.ERR_TRANSFORM_WITH_LENGTH_0,s=gE();function o(t,e){var i=this._transformState;i.transforming=!1;var n=i.writecb;if(null===n)return this.emit("error",new r);i.writechunk=null,i.writecb=null,null!=e&&this.push(e),n(t);var s=this._readableState;s.reading=!1,(s.needReadable||s.length<s.highWaterMark)&&this._read(s.highWaterMark)}function a(t){if(!(this instanceof a))return new a(t);s.call(this,t),this._transformState={afterTransform:o.bind(this),needTransform:!1,transforming:!1,writecb:null,writechunk:null,writeencoding:null},this._readableState.needReadable=!0,this._readableState.sync=!1,t&&("function"==typeof t.transform&&(this._transform=t.transform),"function"==typeof t.flush&&(this._flush=t.flush)),this.on("prefinish",l)}function l(){var t=this;"function"!=typeof this._flush||this._readableState.destroyed?h(this,null,null):this._flush((function(e,r){h(t,e,r)}))}function h(t,e,r){if(e)return t.emit("error",e);if(null!=r&&t.push(r),t._writableState.length)throw new n;if(t._transformState.transforming)throw new i;return t.push(null)}return x_()(a,s),a.prototype.push=function(t,e){return this._transformState.needTransform=!1,s.prototype.push.call(this,t,e)},a.prototype._transform=function(t,r,i){i(new e("_transform()"))},a.prototype._write=function(t,e,r){var i=this._transformState;if(i.writecb=r,i.writechunk=t,i.writeencoding=e,!i.transforming){var n=this._readableState;(i.needTransform||n.needReadable||n.length<n.highWaterMark)&&this._read(n.highWaterMark)}},a.prototype._read=function(t){var e=this._transformState;null===e.writechunk||e.transforming?e.needTransform=!0:(e.transforming=!0,this._transform(e.writechunk,e.writeencoding,e.afterTransform))},a.prototype._destroy=function(t,e){s.prototype._destroy.call(this,t,(function(t){e(t)}))},CE}function zE(){if(RE)return BE;var t;RE=1;var e=dE().codes,r=e.ERR_MISSING_ARGS,i=e.ERR_STREAM_DESTROYED;function n(t){if(t)throw t}function s(t){t()}function o(t,e){return t.pipe(e)}return BE=function(){for(var e=arguments.length,a=new Array(e),l=0;l<e;l++)a[l]=arguments[l];var h,c=function(t){return t.length?"function"!=typeof t[t.length-1]?n:t.pop():n}(a);if(Array.isArray(a[0])&&(a=a[0]),a.length<2)throw new r("streams");var u=a.map((function(e,r){var n=r<a.length-1;return function(e,r,n,s){s=function(t){var e=!1;return function(){e||(e=!0,t.apply(void 0,arguments))}}(s);var o=!1;e.on("close",(function(){o=!0})),void 0===t&&(t=ME()),t(e,{readable:r,writable:n},(function(t){if(t)return s(t);o=!0,s()}));var a=!1;return function(t){if(!o&&!a)return a=!0,function(t){return t.setHeader&&"function"==typeof t.abort}(e)?e.abort():"function"==typeof e.destroy?e.destroy():void s(t||new i("pipe"))}}(e,n,r>0,(function(t){h||(h=t),t&&u.forEach(s),n||(u.forEach(s),c(h))}))}));return a.reduce(o)},BE}!function(t,e){var r=n;"disable"===process.env.READABLE_STREAM&&r?(t.exports=r.Readable,Object.assign(t.exports,r),t.exports.Stream=r):((e=t.exports=FE()).Stream=r||e,e.Readable=e,e.Writable=fE(),e.Duplex=gE(),e.Transform=jE(),e.PassThrough=function(){if(OE)return AE;OE=1,AE=e;var t=jE();function e(r){if(!(this instanceof e))return new e(r);t.call(this,r)}return x_()(e,t),e.prototype._transform=function(t,e,r){r(null,t)},AE}(),e.finished=ME(),e.pipeline=zE())}(tE,tE.exports);var HE=tE.exports;const WE=i,UE=/[<>&'"\x7F\x00-\x08\x0B-\x0C\x0E-\x1F]/,$E={nop(){},promiseImmediate:t=>new Promise((e=>{dt.setImmediate?setImmediate((()=>{e(t)})):setTimeout((()=>{e(t)}),1)})),inherits:function(t,e,r,i){t.super_=e,i||(i=r,r=null),r&&Object.keys(r).forEach((e=>{Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}));const n={constructor:{value:t,enumerable:!1,writable:!1,configurable:!0}};i&&Object.keys(i).forEach((t=>{n[t]=Object.getOwnPropertyDescriptor(i,t)})),t.prototype=Object.create(e.prototype,n)},dateToExcel:(t,e)=>25569+t.getTime()/864e5-(e?1462:0),excelToDate(t,e){const r=Math.round(24*(t-25569+(e?1462:0))*3600*1e3);return new Date(r)},parsePath(t){const e=t.lastIndexOf("/");return{path:t.substring(0,e),name:t.substring(e+1)}},getRelsPath(t){const e=$E.parsePath(t);return`${e.path}/_rels/${e.name}.rels`},xmlEncode(t){const e=UE.exec(t);if(!e)return t;let r="",i="",n=0,s=e.index;for(;s<t.length;s++){const e=t.charCodeAt(s);switch(e){case 34:i=""";break;case 38:i="&";break;case 39:i="'";break;case 60:i="<";break;case 62:i=">";break;case 127:i="";break;default:if(e<=31&&(e<=8||e>=11&&13!==e)){i="";break}continue}n!==s&&(r+=t.substring(n,s)),n=s+1,i&&(r+=i)}return n!==s?r+t.substring(n,s):r},xmlDecode:t=>t.replace(/&([a-z]*);/g,(t=>{switch(t){case"<":return"<";case">":return">";case"&":return"&";case"'":return"'";case""":return'"';default:return t}})),validInt(t){const e=parseInt(t,10);return Number.isNaN(e)?0:e},isDateFmt(t){if(!t)return!1;return null!==(t=(t=t.replace(/\[[^\]]*]/g,"")).replace(/"[^"]*"/g,"")).match(/[ymdhMsb]+/)},fs:{exists:t=>new Promise((e=>{WE.access(t,WE.constants.F_OK,(t=>{e(!t)}))}))},toIsoDateString:t=>t.toIsoString().subsstr(0,10),parseBoolean:t=>!0===t||"true"===t||1===t||"1"===t};var VE=$E;var GE=class{constructor(t){this._buf=Buffer.alloc(t&&t.size||16384),this._encoding=t&&t.encoding||"utf8",this._inPos=0,this._buffer=void 0}get length(){return this._inPos}get capacity(){return this._buf.length}get buffer(){return this._buf}toBuffer(){return this._buffer||(this._buffer=Buffer.alloc(this.length),this._buf.copy(this._buffer,0,0,this.length)),this._buffer}reset(t){t=t||0,this._buffer=void 0,this._inPos=t}_grow(t){let e=2*this._buf.length;for(;e<t;)e*=2;const r=Buffer.alloc(e);this._buf.copy(r,0),this._buf=r}addText(t){this._buffer=void 0;let e=this._inPos+this._buf.write(t,this._inPos,this._encoding);for(;e>=this._buf.length-4;)this._grow(this._inPos+t.length),e=this._inPos+this._buf.write(t,this._inPos,this._encoding);this._inPos=e}addStringBuf(t){t.length&&(this._buffer=void 0,this.length+t.length>this.capacity&&this._grow(this.length+t.length),t._buf.copy(this._buf,this._inPos,0,t.length),this._inPos+=t.length)}};const XE=HE,YE=VE,qE=GE;class ZE{constructor(t,e){this._data=t,this._encoding=e}get length(){return this.toBuffer().length}copy(t,e,r,i){return this.toBuffer().copy(t,e,r,i)}toBuffer(){return this._buffer||(this._buffer=Buffer.from(this._data,this._encoding)),this._buffer}}class KE{constructor(t){this._data=t}get length(){return this._data.length}copy(t,e,r,i){return this._data._buf.copy(t,e,r,i)}toBuffer(){return this._data.toBuffer()}}class QE{constructor(t){this._data=t}get length(){return this._data.length}copy(t,e,r,i){this._data.copy(t,e,r,i)}toBuffer(){return this._data}}class JE{constructor(t){this.size=t,this.buffer=Buffer.alloc(t),this.iRead=0,this.iWrite=0}toBuffer(){if(0===this.iRead&&this.iWrite===this.size)return this.buffer;const t=Buffer.alloc(this.iWrite-this.iRead);return this.buffer.copy(t,0,this.iRead,this.iWrite),t}get length(){return this.iWrite-this.iRead}get eod(){return this.iRead===this.iWrite}get full(){return this.iWrite===this.size}read(t){let e;return 0===t?null:void 0===t||t>=this.length?(e=this.toBuffer(),this.iRead=this.iWrite,e):(e=Buffer.alloc(t),this.buffer.copy(e,0,this.iRead,t),this.iRead+=t,e)}write(t,e,r){const i=Math.min(r,this.size-this.iWrite);return t.copy(this.buffer,this.iWrite,e,e+i),this.iWrite+=i,i}}const tA=function(t){t=t||{},this.bufSize=t.bufSize||1048576,this.buffers=[],this.batch=t.batch||!1,this.corked=!1,this.inPos=0,this.outPos=0,this.pipes=[],this.paused=!1,this.encoding=null};YE.inherits(tA,XE.Duplex,{toBuffer(){switch(this.buffers.length){case 0:return null;case 1:return this.buffers[0].toBuffer();default:return Buffer.concat(this.buffers.map((t=>t.toBuffer())))}},_getWritableBuffer(){if(this.buffers.length){const t=this.buffers[this.buffers.length-1];if(!t.full)return t}const t=new JE(this.bufSize);return this.buffers.push(t),t},async _pipe(t){await Promise.all(this.pipes.map((function(e){return new Promise((r=>{e.write(t.toBuffer(),(()=>{r()}))}))})))},_writeToBuffers(t){let e=0;const r=t.length;for(;e<r;){e+=this._getWritableBuffer().write(t,e,r-e)}},async write(t,e,r){let i;if(e instanceof Function&&(r=e,e="utf8"),r=r||YE.nop,t instanceof qE)i=new KE(t);else if(t instanceof Buffer)i=new QE(t);else{if(!("string"==typeof t||t instanceof String||t instanceof ArrayBuffer))throw new Error("Chunk must be one of type String, Buffer or StringBuf.");i=new ZE(t,e)}if(this.pipes.length)if(this.batch)for(this._writeToBuffers(i);!this.corked&&this.buffers.length>1;)this._pipe(this.buffers.shift());else this.corked?(this._writeToBuffers(i),process.nextTick(r)):(await this._pipe(i),r());else this.paused||this.emit("data",i.toBuffer()),this._writeToBuffers(i),this.emit("readable");return!0},cork(){this.corked=!0},_flush(){if(this.pipes.length)for(;this.buffers.length;)this._pipe(this.buffers.shift())},uncork(){this.corked=!1,this._flush()},end(t,e,r){const i=t=>{t?r(t):(this._flush(),this.pipes.forEach((t=>{t.end()})),this.emit("finish"))};t?this.write(t,e,i):i()},read(t){let e;if(t){for(e=[];t&&this.buffers.length&&!this.buffers[0].eod;){const r=this.buffers[0],i=r.read(t);t-=i.length,e.push(i),r.eod&&r.full&&this.buffers.shift()}return Buffer.concat(e)}return e=this.buffers.map((t=>t.toBuffer())).filter(Boolean),this.buffers=[],Buffer.concat(e)},setEncoding(t){this.encoding=t},pause(){this.paused=!0},resume(){this.paused=!1},isPaused(){return!!this.paused},pipe(t){this.pipes.push(t),!this.paused&&this.buffers.length&&this.end()},unpipe(t){this.pipes=this.pipes.filter((e=>e!==t))},unshift(){throw new Error("Not Implemented")},wrap(){throw new Error("Not Implemented")}});var eA=tA,rA={};const iA="undefined"==typeof TextEncoder?null:new TextEncoder("utf-8"),{Buffer:nA}=o;rA.stringToBuffer=function(t){return"string"!=typeof t?t:iA?nA.from(iA.encode(t).buffer):nA.from(t)};const sA=s,oA=JC,aA=eA,{stringToBuffer:lA}=rA;class hA extends sA.EventEmitter{constructor(t){super(),this.options=Object.assign({type:"nodebuffer",compression:"DEFLATE"},t),this.zip=new oA,this.stream=new aA}append(t,e){e.hasOwnProperty("base64")&&e.base64?this.zip.file(e.name,t,{base64:!0}):(process.browser&&"string"==typeof t&&(t=lA(t)),this.zip.file(e.name,t))}async finalize(){const t=await this.zip.generateAsync(this.options);this.stream.end(t),this.emit("finish")}read(t){return this.stream.read(t)}setEncoding(t){return this.stream.setEncoding(t)}pause(){return this.stream.pause()}resume(){return this.stream.resume()}isPaused(){return this.stream.isPaused()}pipe(t,e){return this.stream.pipe(t,e)}unpipe(t){return this.stream.unpipe(t)}unshift(t){return this.stream.unshift(t)}wrap(t){return this.stream.wrap(t)}}var cA={ZipWriter:hA};const uA=Uv,dA=VE,pA=">";function fA(t,e,r){t.push(` ${e}="${dA.xmlEncode(r.toString())}"`)}function gA(t,e){if(e){const r=[];uA.each(e,((t,e)=>{void 0!==t&&fA(r,e,t)})),t.push(r.join(""))}}let mA=class{constructor(){this._xml=[],this._stack=[],this._rollbacks=[]}get tos(){return this._stack.length?this._stack[this._stack.length-1]:void 0}get cursor(){return this._xml.length}openXml(t){const e=this._xml;e.push("<?xml"),gA(e,t),e.push("?>\n")}openNode(t,e){const r=this.tos,i=this._xml;r&&this.open&&i.push(pA),this._stack.push(t),i.push("<"),i.push(t),gA(i,e),this.leaf=!0,this.open=!0}addAttribute(t,e){if(!this.open)throw new Error("Cannot write attributes to node if it is not open");void 0!==e&&fA(this._xml,t,e)}addAttributes(t){if(!this.open)throw new Error("Cannot write attributes to node if it is not open");gA(this._xml,t)}writeText(t){const e=this._xml;this.open&&(e.push(pA),this.open=!1),this.leaf=!1,e.push(dA.xmlEncode(t.toString()))}writeXml(t){this.open&&(this._xml.push(pA),this.open=!1),this.leaf=!1,this._xml.push(t)}closeNode(){const t=this._stack.pop(),e=this._xml;this.leaf?e.push("/>"):(e.push("</"),e.push(t),e.push(pA)),this.open=!1,this.leaf=!1}leafNode(t,e,r){this.openNode(t,e),void 0!==r&&this.writeText(r),this.closeNode()}closeAll(){for(;this._stack.length;)this.closeNode()}addRollback(){return this._rollbacks.push({xml:this._xml.length,stack:this._stack.length,leaf:this.leaf,open:this.open}),this.cursor}commit(){this._rollbacks.pop()}rollback(){const t=this._rollbacks.pop();this._xml.length>t.xml&&this._xml.splice(t.xml,this._xml.length-t.xml),this._stack.length>t.stack&&this._stack.splice(t.stack,this._stack.length-t.stack),this.leaf=t.leaf,this.open=t.open}get xml(){return this.closeAll(),this._xml.join("")}};mA.StdDocAttributes={version:"1.0",encoding:"UTF-8",standalone:"yes"};var yA=mA,vA={};const bA="undefined"==typeof TextDecoder?null:new TextDecoder("utf-8");vA.bufferToString=function(t){return"string"==typeof t?t:bA?bA.decode(t):t.toString()};var _A={},wA={};!function(t){
|
|
2
2
|
/**
|
|
3
3
|
* Character classes and associated utilities for the 5th edition of XML 1.0.
|
|
4
4
|
*
|