UNPKG

@visactor/vtable

Version:

canvas table width high performance

1 lines 1.73 MB
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).VTable={})}(this,(function(t){"use strict";class e{static GenAutoIncrementId(){return e.auto_increment_id++}}e.auto_increment_id=0;class i{constructor(t){this.id=e.GenAutoIncrementId(),this.registry=t}}const r="named",o="inject",n="multi_inject",s="inversify:tagged",a="inversify:paramtypes";class l{constructor(t,e){this.key=t,this.value=e}toString(){return this.key===r?`named: ${String(this.value).toString()} `:`tagged: { key:${this.key.toString()}, value: ${String(this.value)} }`}}var h=function(t){var e;return function(t){const e="function"==typeof Symbol&&void 0!==Symbol.toPrimitive?Symbol.toPrimitive:"@@toPrimitive",i=Object.getPrototypeOf(Function),r=("object"==typeof process&&process.env&&process.env.REFLECT_METADATA_USE_MAP_POLYFILL,Map),o=new WeakMap;function n(t,e,i){let n=o.get(t);if(h(n)){if(!i)return;n=new r,o.set(t,n)}let s=n.get(e);if(h(s)){if(!i)return;s=new r,n.set(e,s)}return s}function s(t,e,i){if(a(t,e,i))return!0;const r=f(e);return!c(r)&&s(t,r,i)}function a(t,e,i){const r=n(e,i,!1);return!h(r)&&!!r.has(t)}function l(t,e,i){if(a(t,e,i))return function(t,e,i){const r=n(e,i,!1);if(!h(r))return r.get(t)}(t,e,i);const r=f(e);return c(r)?void 0:l(t,r,i)}function h(t){return void 0===t}function c(t){return null===t}function d(t){return"object"==typeof t?null!==t:"function"==typeof t}function u(t,i){switch(function(t){if(null===t)return 1;switch(typeof t){case"undefined":return 0;case"boolean":return 2;case"string":return 3;case"symbol":return 4;case"number":return 5;case"object":return null===t?1:6;default:return 6}}(t)){case 0:case 1:case 2:case 3:case 4:case 5:return t}const r=3===i?"string":5===i?"number":"default",o=function(t,e){const i=t[e];if(null!=i){if(!p(i))throw new TypeError;return i}}(t,e);if(void 0!==o){const e=o.call(t,r);if(d(e))throw new TypeError;return e}return function(t,e){if("string"===e){const e=t.toString;if(p(e)){const i=e.call(t);if(!d(i))return i}const i=t.valueOf;if(p(i)){const e=i.call(t);if(!d(e))return e}}else{const e=t.valueOf;if(p(e)){const i=e.call(t);if(!d(i))return i}const i=t.toString;if(p(i)){const e=i.call(t);if(!d(e))return e}}throw new TypeError}(t,"default"===r?"number":r)}function g(t){const e=u(t,3);return"symbol"==typeof e?e:function(t){return""+t}(e)}function p(t){return"function"==typeof t}function f(t){const e=Object.getPrototypeOf(t);if("function"!=typeof t||t===i)return e;if(e!==i)return e;const r=t.prototype,o=r&&Object.getPrototypeOf(r);if(null==o||o===Object.prototype)return e;const n=o.constructor;return"function"!=typeof n||n===t?e:n}t("defineMetadata",(function(t,e,i,r){if(!d(i))throw new TypeError;return o=t,s=e,void n(i,r,!0).set(o,s);var o,s})),t("hasMetadata",(function(t,e,i){if(!d(e))throw new TypeError;return h(i)||(i=g(i)),s(t,e,i)})),t("hasOwnMetadata",(function(t,e,i){if(!d(e))throw new TypeError;return h(i)||(i=g(i)),a(t,e,i)})),t("getMetadata",(function(t,e,i){if(!d(e))throw new TypeError;return h(i)||(i=g(i)),l(t,e,i)}))}((e=t,function(t,i){"function"!=typeof e[t]&&Object.defineProperty(e,t,{configurable:!0,writable:!0,value:i})})),t}({});function c(t,e,i,r){!function(t,e,i,r){const o=[r];let n={};h.hasOwnMetadata(t,e)&&(n=h.getMetadata(t,e));let s=n[i];void 0===s&&(s=[]),s.push(...o),n[i]=s,h.defineMetadata(t,n,e)}(s,t,i.toString(),r)}function d(t){return(e,i,r)=>{c(e,0,r,t)}}function u(t){return e=>(i,r,o)=>d(new l(t,e))(i,r,o)}const g=u(o),p=u(n);function f(){return function(t){return h.defineMetadata(a,null,t),t}}function m(t){return d(new l(r,t))}const b="Singleton",y="Transient",C="ConstantValue",w="DynamicValue",v="Factory",x="Function",_="Instance",S="Invalid";class A{constructor(t,i){this.id=e.GenAutoIncrementId(),this.activated=!1,this.serviceIdentifier=t,this.scope=i,this.type=S,this.constraint=t=>!0,this.implementationType=null,this.cache=null,this.factory=null,this.provider=null,this.dynamicValue=null}clone(){const t=new A(this.serviceIdentifier,this.scope);return t.activated=t.scope===b&&this.activated,t.implementationType=this.implementationType,t.dynamicValue=this.dynamicValue,t.scope=this.scope,t.type=this.type,t.provider=this.provider,t.constraint=this.constraint,t.cache=this.cache,t}}class R{getConstructorMetadata(t){return{compilerGeneratedMetadata:h.getMetadata(a,t),userGeneratedMetadata:h.getMetadata(s,t)||{}}}getPropertiesMetadata(t){throw new Error("暂未实现")}}const T=(B=r,t=>{const e=e=>{if(null==e)return!1;if(e.key===B&&e.value===t)return!0;if(null==e.constructorArgsMetadata)return!1;const i=e.constructorArgsMetadata;for(let e=0;e<i.length;e++)if(i[e].key===B&&i[e].value===t)return!0;return!1};return e.metaData=new l(B,t),e});var B;class M{constructor(t){this._binding=t}inRequestScope(){throw new Error("暂未实现")}inSingletonScope(){return this._binding.scope=b,this}inTransientScope(){return this._binding.scope=y,this}whenTargetNamed(t){return this._binding.constraint=T(t),this}}class P{constructor(t){this._binding=t}to(t){return this._binding.type=_,this._binding.implementationType=t,new M(this._binding)}toSelf(){const t=this._binding.serviceIdentifier;return this.to(t)}toDynamicValue(t){return this._binding.type=w,this._binding.cache=null,this._binding.dynamicValue=t,this._binding.implementationType=null,new M(this._binding)}toConstantValue(t){return this._binding.type=C,this._binding.cache=t,this._binding.dynamicValue=null,this._binding.implementationType=null,this._binding.scope=b,new M(this._binding)}toFactory(t){return this._binding.type=v,this._binding.factory=t,this._binding.scope=b,new M(this._binding)}toService(t){this.toDynamicValue((e=>e.container.get(t)))}}const H=Symbol("ContributionProvider");class k{constructor(t,e){this.serviceIdentifier=t,this.container=e}getContributions(){return this.caches||(this.caches=[],this.container&&this.container.isBound(this.serviceIdentifier)&&this.caches.push(...this.container.getAll(this.serviceIdentifier))),this.caches}}function L(t,e){t(H).toDynamicValue((t=>{let{container:i}=t;return new k(e,i)})).inSingletonScope().whenTargetNamed(e)}class E{constructor(t,e){this._args=t,this.name=e,this.taps=[]}tap(t,e){this._tap("sync",t,e)}unTap(t,e){const i="string"==typeof t?t.trim():t.name;i&&(this.taps=this.taps.filter((t=>!(t.name===i&&(!e||t.fn===e)))))}_parseOptions(t,e,i){let r;if("string"==typeof e)r={name:e.trim()};else if("object"!=typeof e||null===e)throw new Error("Invalid tap options");if("string"!=typeof r.name||""===r.name)throw new Error("Missing name for tap");return r=Object.assign({type:t,fn:i},r),r}_tap(t,e,i){this._insert(this._parseOptions(t,e,i))}_insert(t){let e;"string"==typeof t.before?e=new Set([t.before]):Array.isArray(t.before)&&(e=new Set(t.before));let i=0;"number"==typeof t.stage&&(i=t.stage);let r=this.taps.length;for(;r>0;){r--;const t=this.taps[r];this.taps[r+1]=t;const o=t.stage||0;if(e){if(e.has(t.name)){e.delete(t.name);continue}if(e.size>0)continue}if(!(o>i)){r++;break}}this.taps[r]=t}}class F extends E{call(){for(var t=arguments.length,e=new Array(t),i=0;i<t;i++)e[i]=arguments[i];this.taps.map((t=>t.fn)).forEach((t=>t(...e)))}}const I=Symbol.for("EnvContribution"),z=Symbol.for("VGlobal");var O=function(t,e,i,r){var o,n=arguments.length,s=n<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,i,r);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(s=(n<3?o(s):n>3?o(e,i,s):o(e,i))||s);return n>3&&s&&Object.defineProperty(e,i,s),s},D=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},W=function(t,e){return function(i,r){e(i,r,t)}},N=function(t,e,i,r){return new(i||(i=Promise))((function(o,n){function s(t){try{l(r.next(t))}catch(t){n(t)}}function a(t){try{l(r.throw(t))}catch(t){n(t)}}function l(t){var e;t.done?o(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(s,a)}l((r=r.apply(t,e||[])).next())}))};let G=class{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){this.contributions=t,this._isImageAnonymous=!0,this.id=e.GenAutoIncrementId(),this.hooks={onSetEnv:new F(["lastEnv","env","global"])},this.measureTextMethod="native",this.optimizeVisible=!1}bindContribution(t){const e=[];if(this.contributions.getContributions().forEach((i=>{const r=i.configure(this,t);r&&r.then&&e.push(r)})),e.length)return Promise.all(e)}getDynamicCanvasCount(){return this._env||this.setEnv("browser"),this.envContribution.getDynamicCanvasCount()}getStaticCanvasCount(){return this._env||this.setEnv("browser"),this.envContribution.getStaticCanvasCount()}setEnv(t,e){if(e&&!0===e.force||this._env!==t)return this.deactiveCurrentEnv(),this.activeEnv(t,e)}deactiveCurrentEnv(){this.envContribution&&this.envContribution.release()}activeEnv(t,e){const i=this._env;this._env=t;const r=this.bindContribution(e);if(r&&r.then)return r.then((()=>{this.envParams=e,this.hooks.onSetEnv.call(i,t,this)}));this.envParams=e,this.hooks.onSetEnv.call(i,t,this)}setActiveEnvContribution(t){this.envContribution=t}createCanvas(t){return this._env||this.setEnv("browser"),this.envContribution.createCanvas(t)}createOffscreenCanvas(t){return this._env||this.setEnv("browser"),this.envContribution.createOffscreenCanvas(t)}releaseCanvas(t){return this._env||this.setEnv("browser"),this.envContribution.releaseCanvas(t)}addEventListener(t,e,i){return this._env||this.setEnv("browser"),this.envContribution.addEventListener(t,e,i)}removeEventListener(t,e,i){return this._env||this.setEnv("browser"),this.envContribution.removeEventListener(t,e,i)}dispatchEvent(t){return this._env||this.setEnv("browser"),this.envContribution.dispatchEvent(t)}getRequestAnimationFrame(){return this._env||this.setEnv("browser"),this.envContribution.getRequestAnimationFrame()}getCancelAnimationFrame(){return this._env||this.setEnv("browser"),this.envContribution.getCancelAnimationFrame()}getElementById(t){return this._env||this.setEnv("browser"),this.envContribution.getElementById?this.envContribution.getElementById(t):null}getRootElement(){return this._env||this.setEnv("browser"),this.envContribution.getRootElement?this.envContribution.getRootElement():null}getDocument(){return this._env||this.setEnv("browser"),this.envContribution.getDocument?this.envContribution.getDocument():null}mapToCanvasPoint(t,e){return this._env||this.setEnv("browser"),this.envContribution.mapToCanvasPoint?this.envContribution.mapToCanvasPoint(t,e):null}loadImage(t){return this._env||this.setEnv("browser"),this.envContribution.loadImage(t)}loadSvg(t){return this._env||this.setEnv("browser"),this.envContribution.loadSvg(t)}loadJson(t){return this._env||this.setEnv("browser"),this.envContribution.loadJson(t)}loadArrayBuffer(t){return this._env||this.setEnv("browser"),this.envContribution.loadArrayBuffer(t)}loadBlob(t){return this._env||this.setEnv("browser"),this.envContribution.loadBlob(t)}loadFont(t,e,i){return N(this,void 0,void 0,(function*(){return this._env||this.setEnv("browser"),this.envContribution.loadFont(t,e,i)}))}isChrome(){return null!=this._isChrome||(this._env||this.setEnv("browser"),this._isChrome="browser"===this._env&&navigator.userAgent.indexOf("Chrome")>-1),this._isChrome}isSafari(){return null!=this._isSafari||(this._env||this.setEnv("browser"),this._isSafari="browser"===this._env&&/Safari/.test(navigator.userAgent)&&!/Chrome/.test(navigator.userAgent)),this._isSafari}getNativeAABBBounds(t){return this._env||this.setEnv("browser"),this.envContribution.getNativeAABBBounds(t)}removeDom(t){return this._env||this.setEnv("browser"),this.envContribution.removeDom(t)}createDom(t){return this._env||this.setEnv("browser"),this.envContribution.createDom(t)}updateDom(t,e){return this._env||this.setEnv("browser"),this.envContribution.updateDom(t,e)}getElementTop(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return this._env||this.setEnv("browser"),this.envContribution.getElementTop(t,e)}getElementLeft(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return this._env||this.setEnv("browser"),this.envContribution.getElementLeft(t,e)}getElementTopLeft(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return this._env||this.setEnv("browser"),this.envContribution.getElementTopLeft(t,e)}};var V;G=O([f(),W(0,g(H)),W(0,m(I)),D("design:paramtypes",[Object])],G),function(t){t[t.estimate=0]="estimate",t[t.actualBounding=1]="actualBounding",t[t.fontBounding=2]="fontBounding"}(V||(V={}));var j="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function U(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var K={exports:{}};!function(t){var e=Object.prototype.hasOwnProperty,i="~";function r(){}function o(t,e,i){this.fn=t,this.context=e,this.once=i||!1}function n(t,e,r,n,s){if("function"!=typeof r)throw new TypeError("The listener must be a function");var a=new o(r,n||t,s),l=i?i+e:e;return t._events[l]?t._events[l].fn?t._events[l]=[t._events[l],a]:t._events[l].push(a):(t._events[l]=a,t._eventsCount++),t}function s(t,e){0==--t._eventsCount?t._events=new r:delete t._events[e]}function a(){this._events=new r,this._eventsCount=0}Object.create&&(r.prototype=Object.create(null),(new r).__proto__||(i=!1)),a.prototype.eventNames=function(){var t,r,o=[];if(0===this._eventsCount)return o;for(r in t=this._events)e.call(t,r)&&o.push(i?r.slice(1):r);return Object.getOwnPropertySymbols?o.concat(Object.getOwnPropertySymbols(t)):o},a.prototype.listeners=function(t){var e=i?i+t:t,r=this._events[e];if(!r)return[];if(r.fn)return[r.fn];for(var o=0,n=r.length,s=new Array(n);o<n;o++)s[o]=r[o].fn;return s},a.prototype.listenerCount=function(t){var e=i?i+t:t,r=this._events[e];return r?r.fn?1:r.length:0},a.prototype.emit=function(t,e,r,o,n,s){var a=i?i+t:t;if(!this._events[a])return!1;var l,h,c=this._events[a],d=arguments.length;if(c.fn){switch(c.once&&this.removeListener(t,c.fn,void 0,!0),d){case 1:return c.fn.call(c.context),!0;case 2:return c.fn.call(c.context,e),!0;case 3:return c.fn.call(c.context,e,r),!0;case 4:return c.fn.call(c.context,e,r,o),!0;case 5:return c.fn.call(c.context,e,r,o,n),!0;case 6:return c.fn.call(c.context,e,r,o,n,s),!0}for(h=1,l=new Array(d-1);h<d;h++)l[h-1]=arguments[h];c.fn.apply(c.context,l)}else{var u,g=c.length;for(h=0;h<g;h++)switch(c[h].once&&this.removeListener(t,c[h].fn,void 0,!0),d){case 1:c[h].fn.call(c[h].context);break;case 2:c[h].fn.call(c[h].context,e);break;case 3:c[h].fn.call(c[h].context,e,r);break;case 4:c[h].fn.call(c[h].context,e,r,o);break;default:if(!l)for(u=1,l=new Array(d-1);u<d;u++)l[u-1]=arguments[u];c[h].fn.apply(c[h].context,l)}}return!0},a.prototype.on=function(t,e,i){return n(this,t,e,i,!1)},a.prototype.once=function(t,e,i){return n(this,t,e,i,!0)},a.prototype.removeListener=function(t,e,r,o){var n=i?i+t:t;if(!this._events[n])return this;if(!e)return s(this,n),this;var a=this._events[n];if(a.fn)a.fn!==e||o&&!a.once||r&&a.context!==r||s(this,n);else{for(var l=0,h=[],c=a.length;l<c;l++)(a[l].fn!==e||o&&!a[l].once||r&&a[l].context!==r)&&h.push(a[l]);h.length?this._events[n]=1===h.length?h[0]:h:s(this,n)}return this},a.prototype.removeAllListeners=function(t){var e;return t?(e=i?i+t:t,this._events[e]&&s(this,e)):(this._events=new r,this._eventsCount=0),this},a.prototype.off=a.prototype.removeListener,a.prototype.addListener=a.prototype.on,a.prefixed=i,a.EventEmitter=a,t.exports=a}(K);var $=U(K.exports);var X=(t,e)=>Object.prototype.toString.call(t)===`[object ${e}]`;var Y=function(t){return arguments.length>1&&void 0!==arguments[1]&&arguments[1]?"boolean"==typeof t:!0===t||!1===t||X(t,"Boolean")};var q=t=>"function"==typeof t;var Z=t=>null==t;var J=t=>null!=t;var Q=t=>{const e=typeof t;return null!==t&&"object"===e||"function"===e};var tt=t=>"object"==typeof t&&null!==t;var et=function(t){if(!tt(t)||!X(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 it=t=>void 0===t;var rt=function(t){const e=typeof t;return arguments.length>1&&void 0!==arguments[1]&&arguments[1]?"string"===e:"string"===e||X(t,"String")};var ot=t=>Array.isArray?Array.isArray(t):X(t,"Array");var nt=function(t){return null!==t&&"function"!=typeof t&&Number.isFinite(t.length)};var st=t=>X(t,"Date");var at=function(t){const e=typeof t;return arguments.length>1&&void 0!==arguments[1]&&arguments[1]?"number"===e:"number"===e||X(t,"Number")};var lt=t=>at(t)&&Number.isFinite(t);var ht=t=>new RegExp(/^(http(s)?:\/\/)\w+[^\s]+(\.[^\s]+){1,}$/).test(t);var ct=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 dt=t=>({}.toString.call(t).replace(/^\[object /,"").replace(/]$/,""));const ut=Object.prototype;var gt=function(t){const e=t&&t.constructor;return t===("function"==typeof e&&e.prototype||ut)};const pt=Object.prototype.hasOwnProperty;function ft(t){if(Z(t))return!0;if(nt(t))return!t.length;const e=dt(t);if("Map"===e||"Set"===e)return!t.size;if(gt(t))return!Object.keys(t).length;for(const e in t)if(pt.call(t,e))return!1;return!0}var mt=(t,e,i)=>{const r=rt(e)?e.split("."):e;for(let e=0;e<r.length;e++)t=t?t[r[e]]:void 0;return void 0===t?i:t};const bt=Object.prototype.hasOwnProperty;var yt=(t,e)=>null!=t&&bt.call(t,e);function Ct(t,e,i){let r;if(!J(t)||"object"!=typeof t||e&&e(t))return t;const o=ot(t),n=t.length;r=o?new Array(n):"object"==typeof t?{}:Y(t)||at(t)||rt(t)?t:st(t)?new Date(+t):void 0;const s=o?void 0:Object.keys(Object(t));let a=-1;if(r)for(;++a<(s||t).length;){const o=s?s[a]:a,n=t[o];i&&i.includes(o.toString())?r[o]=n:r[o]=Ct(n,e,i)}return r}function wt(t,e){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2],r=arguments.length>3&&void 0!==arguments[3]&&arguments[3];if(e){if(t===e)return;if(J(e)&&"object"==typeof e){const o=Object(e),n=[];for(const t in o)n.push(t);let{length:s}=n,a=-1;for(;s--;){const s=n[++a];!J(o[s])||"object"!=typeof o[s]||r&&ot(t[s])?xt(t,s,o[s]):vt(t,e,s,i,r)}}}}function vt(t,e,i){let r=arguments.length>3&&void 0!==arguments[3]&&arguments[3],o=arguments.length>4&&void 0!==arguments[4]&&arguments[4];const n=t[i],s=e[i];let a=e[i],l=!0;if(ot(s)){if(r)a=[];else if(ot(n))a=n;else if(nt(n)){a=new Array(n.length);let t=-1;const e=n.length;for(;++t<e;)a[t]=n[t]}}else et(s)?(a=null!=n?n:{},"function"!=typeof n&&"object"==typeof n||(a={})):l=!1;l&&wt(a,s,r,o),xt(t,i,a)}function xt(t,e,i){(void 0!==i&&!function(t,e){return t===e||Number.isNaN(t)&&Number.isNaN(e)}(t[e],i)||void 0===i&&!(e in t))&&(t[e]=i)}function _t(t){let e=-1;const i=arguments.length<=1?0:arguments.length-1;for(;++e<i;)wt(t,e+1<1||arguments.length<=e+1?void 0:arguments[e+1],!0);return t}function St(t){return Object.prototype.toString.call(t)}function At(t){return Object.keys(t)}function Rt(t,e,i){if(t===e)return!0;if(typeof t!=typeof e)return!1;if(null==t||null==e)return!1;if(Number.isNaN(t)&&Number.isNaN(e))return!0;if(St(t)!==St(e))return!1;if(q(t))return!!(null==i?void 0:i.skipFunction);if("object"!=typeof t)return!1;if(ot(t)){if(t.length!==e.length)return!1;for(let r=t.length-1;r>=0;r--)if(!Rt(t[r],e[r],i))return!1;return!0}if(!et(t))return!1;const r=At(t),o=At(e);if(r.length!==o.length)return!1;r.sort(),o.sort();for(let t=r.length-1;t>=0;t--)if(r[t]!=o[t])return!1;for(let o=r.length-1;o>=0;o--){const n=r[o];if(!Rt(t[n],e[n],i))return!1}return!0}function Tt(t,e,i){const r=function(t){if(!t)return[];if(Object.keys)return Object.keys(t);const e=[];for(const i in t)t.hasOwnProperty(i)&&e.push(i);return e}(e);for(let o=0;o<r.length;o++){const n=r[o];(i?null!=e[n]:null==t[n])&&(t[n]=e[n])}return t}function Bt(t){return J(t)?ot(t)?t:[t]:[]}function Mt(t){if(nt(t))return t[t.length-1]}const Pt=(t,e)=>{var i;if(0===t.length)return;let r=t[0];for(let o=1;o<t.length;o++){const n=t[o];(null!==(i=null==e?void 0:e(n,r))&&void 0!==i?i:n-r)>0&&(r=n)}return r},Ht=(t,e)=>{var i;if(0===t.length)return;let r=t[0];for(let o=1;o<t.length;o++){const n=t[o];(null!==(i=null==e?void 0:e(n,r))&&void 0!==i?i:n-r)<0&&(r=n)}return r};function kt(t,e){if(!ot(t)||!ot(e))return!1;if(t.length!==e.length)return!1;for(let i=0;i<t.length;i++)if(t[i]!==e[i])return!1;return!0}function Lt(t){if(!ot(t))return[t];const e=[];for(const i of t)e.push(...Lt(i));return e}function Et(t,e){return t<e?-1:t>e?1:t>=e?0:NaN}function Ft(t){return Number(t)}const It="undefined"!=typeof console;function zt(t,e,i){const r=[e].concat([].slice.call(i));It&&console[t].apply(console,r)}var Ot;!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"}(Ot||(Ot={}));let Dt=class t{static getInstance(e,i){return t._instance&&at(e)?t._instance.level(e):t._instance||(t._instance=new t(e,i)),t._instance}static setInstance(e){return t._instance=e}static setInstanceLevel(e){t._instance?t._instance.level(e):t._instance=new t(e)}static clearInstance(){t._instance=null}constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Ot.None,e=arguments.length>1?arguments[1]:void 0;this._onErrorHandler=[],this._level=t,this._method=e}addErrorHandler(t){this._onErrorHandler.find((e=>e===t))||this._onErrorHandler.push(t)}removeErrorHandler(t){const e=this._onErrorHandler.findIndex((e=>e===t));e<0||this._onErrorHandler.splice(e,1)}callErrorHandler(){for(var t=arguments.length,e=new Array(t),i=0;i<t;i++)e[i]=arguments[i];this._onErrorHandler.forEach((t=>t(...e)))}canLogInfo(){return this._level>=Ot.Info}canLogDebug(){return this._level>=Ot.Debug}canLogError(){return this._level>=Ot.Error}canLogWarn(){return this._level>=Ot.Warn}level(t){return arguments.length?(this._level=+t,this):this._level}error(){for(var t,e=arguments.length,i=new Array(e),r=0;r<e;r++)i[r]=arguments[r];return this._level>=Ot.Error&&(this._onErrorHandler.length?this.callErrorHandler(...i):zt(null!==(t=this._method)&&void 0!==t?t:"error","ERROR",i)),this}warn(){for(var t=arguments.length,e=new Array(t),i=0;i<t;i++)e[i]=arguments[i];return this._level>=Ot.Warn&&zt(this._method||"warn","WARN",e),this}info(){for(var t=arguments.length,e=new Array(t),i=0;i<t;i++)e[i]=arguments[i];return this._level>=Ot.Info&&zt(this._method||"log","INFO",e),this}debug(){for(var t=arguments.length,e=new Array(t),i=0;i<t;i++)e[i]=arguments[i];return this._level>=Ot.Debug&&zt(this._method||"log","DEBUG",e),this}};Dt._instance=null;function Wt(t,e){const i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1e-10,r=(arguments.length>2&&void 0!==arguments[2]?arguments[2]:1e-10)*Math.max(t,e);return Math.abs(t-e)<=Math.max(i,r)}const Nt=t=>{let e=null,i=null;return function(){for(var r=arguments.length,o=new Array(r),n=0;n<r;n++)o[n]=arguments[n];return e&&o.every(((t,i)=>t===e[i]))||(e=o,i=t(...o)),i}};var Gt=function(t,e,i){return t<e?e:t>i?i:t};var Vt=(t,e,i)=>{let[r,o]=t;o<r&&(r=t[1],o=t[0]);const n=o-r;return n>=i-e?[e,i]:(r=Math.min(Math.max(r,e),i-n),[r,r+n])};let jt=!1;try{jt="function"==typeof requestAnimationFrame&&"function"==typeof cancelAnimationFrame}catch(t){jt=!1}function Ut(t,e,i){let r,o,n,s,a,l,h=0,c=!1,d=!1,u=!0;const g=!e&&0!==e&&jt;if("function"!=typeof t)throw new TypeError("Expected a function");function p(e){const i=r,n=o;return r=o=void 0,h=e,s=t.apply(n,i),s}function f(t,e){return g?(cancelAnimationFrame(a),requestAnimationFrame(t)):setTimeout(t,e)}function m(t){const i=t-l;return void 0===l||i>=e||i<0||d&&t-h>=n}function b(){const t=Date.now();if(m(t))return y(t);a=f(b,function(t){const i=t-h,r=e-(t-l);return d?Math.min(r,n-i):r}(t))}function y(t){return a=void 0,u&&r?p(t):(r=o=void 0,s)}function C(){const t=Date.now(),i=m(t);for(var n=arguments.length,u=new Array(n),g=0;g<n;g++)u[g]=arguments[g];if(r=u,o=this,l=t,i){if(void 0===a)return function(t){return h=t,a=f(b,e),c?p(t):s}(l);if(d)return a=f(b,e),p(l)}return void 0===a&&(a=f(b,e)),s}return e=+e||0,Q(i)&&(c=!!i.leading,d="maxWait"in i,d&&(n=Math.max(lt(i.maxWait)?i.maxWait:0,e)),u="trailing"in i?!!i.trailing:u),C.cancel=function(){void 0!==a&&function(t){if(g)return cancelAnimationFrame(t);clearTimeout(t)}(a),h=0,r=l=o=a=void 0},C.flush=function(){return void 0===a?s:y(Date.now())},C.pending=function(){return void 0!==a},C}function Kt(t,e,i){let r=!0,o=!0;if("function"!=typeof t)throw new TypeError("Expected a function");return Q(i)&&(r="leading"in i?!!i.leading:r,o="trailing"in i?!!i.trailing:o),Ut(t,e,{leading:r,trailing:o,maxWait:e})}function $t(t,e){return i=>t*(1-i)+e*i}function Xt(t,e){return function(i){return Math.round(t*(1-i)+e*i)}}jt=!1;const Yt=1e-12,qt=Math.PI,Zt=qt/2,Jt=2*qt,Qt=2*Math.PI,te=Math.abs,ee=Math.atan2,ie=Math.cos,re=Math.max,oe=Math.min,ne=Math.sin,se=Math.sqrt,ae=Math.pow;function le(t){return t>=1?Zt:t<=-1?-Zt:Math.asin(t)}function he(t,e,i,r,o){let n=i,s=r;return"number"==typeof t&&"number"==typeof i&&(n=(1-o)*t+o*i),"number"==typeof e&&"number"==typeof r&&(s=(1-o)*e+o*r),{x:n,y:s}}class ce{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2?arguments[2]:void 0,r=arguments.length>3?arguments[3]:void 0;this.x=0,this.y=0,this.x=t,this.y=e,this.x1=i,this.y1=r}clone(){return new ce(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 at(t)?(this.x+=t,void(this.y+=t)):(this.x+=t.x,this.y+=t.y,this)}sub(t){return at(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 de{static distancePP(t,e){return se(ae(t.x-e.x,2)+ae(t.y-e.y,2))}static distanceNN(t,e,i,r){return se(ae(t-i,2)+ae(e-r,2))}static distancePN(t,e,i){return se(ae(e-t.x,2)+ae(i-t.y,2))}static pointAtPP(t,e,i){return new ce((e.x-t.x)*i+t.x,(e.y-t.y)*i+t.y)}}function ue(t){return t*(Math.PI/180)}const ge=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;if(t<0)for(;t<-Jt;)t+=Jt;else if(t>0)for(;t>Jt;)t-=Jt;return t};function pe(t){for(;t<0;)t+=2*Math.PI;for(;t>=2*Math.PI;)t-=2*Math.PI;return t}function fe(t,e,i){if(null===t)return e;if(null===e)return t;const{x11:r,x12:o,y11:n,y12:s,x21:a,x22:l,y21:h,y22:c}=be(t,e,i);return r>=l||o<=a||n>=c||s<=h?{x1:0,y1:0,x2:0,y2:0}:{x1:Math.max(r,a),y1:Math.max(n,h),x2:Math.min(o,l),y2:Math.min(s,c)}}var me;!function(t){t[t.NONE=0]="NONE",t[t.BBOX1=1]="BBOX1",t[t.BBOX2=2]="BBOX2"}(me||(me={}));const be=(t,e,i)=>{let r=t.x1,o=t.x2,n=t.y1,s=t.y2,a=e.x1,l=e.x2,h=e.y1,c=e.y2;return i&&(r>o&&([r,o]=[o,r]),n>s&&([n,s]=[s,n]),a>l&&([a,l]=[l,a]),h>c&&([h,c]=[c,h])),{x11:r,x12:o,y11:n,y12:s,x21:a,x22:l,y21:h,y22:c}};function ye(t,e,i){if(!t||!e)return me.NONE;const{x11:r,x12:o,y11:n,y12:s,x21:a,x22:l,y21:h,y22:c}=be(t,e,i);return r>a&&o<l&&n>h&&s<c?me.BBOX1:a>r&&l<o&&h>n&&c<s?me.BBOX2:me.NONE}function Ce(t,e,i){if(t&&e){if(!i)return!(t.x1>e.x2||t.x2<e.x1||t.y1>e.y2||t.y2<e.y1);const{x11:r,x12:o,y11:n,y12:s,x21:a,x22:l,y21:h,y22:c}=be(t,e,!0);return!(r>l||o<a||n>c||s<h)}return!0}function we(t,e){return Math.abs(e[0]*t[0]+e[1]*t[1])}function ve(t,e){let{x:i,y:r}=t,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{x:0,y:0};return{x:(i-o.x)*Math.cos(e)-(r-o.y)*Math.sin(e)+o.x,y:(i-o.x)*Math.sin(e)+(r-o.y)*Math.cos(e)+o.y}}function xe(t){return{x:(t.x1+t.x2)/2,y:(t.y1+t.y2)/2}}function _e(t,e){const i=e?ue(t.angle):t.angle,r=xe(t);return[ve({x:t.x1,y:t.y1},i,r),ve({x:t.x2,y:t.y1},i,r),ve({x:t.x2,y:t.y2},i,r),ve({x:t.x1,y:t.y2},i,r)]}function Se(t,e){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];const r=_e(t,i),o=_e(e,i),n=(t,e)=>[e.x-t.x,e.y-t.y],s=n(xe(t),xe(e)),a=n(r[0],r[1]),l=n(r[1],r[2]),h=n(o[0],o[1]),c=n(o[1],o[2]),d=i?ue(t.angle):t.angle;let u=i?ue(90-t.angle):t.angle+Zt;const g=i?ue(e.angle):e.angle;let p=i?ue(90-e.angle):e.angle+Zt;u>Qt&&(u-=Qt),p>Qt&&(p-=Qt);const f=(t,e,i,r)=>{const o=[Math.cos(e),Math.sin(e)];return t+(we(o,i)+we(o,r))/2>we(o,s)};return f((t.x2-t.x1)/2,d,h,c)&&f((t.y2-t.y1)/2,u,h,c)&&f((e.x2-e.x1)/2,g,a,l)&&f((e.y2-e.y1)/2,p,a,l)}const Ae=t=>{let e=t.charCodeAt(0),i=2===t.length?t.charCodeAt(1):0,r=e;return 55296<=e&&e<=56319&&56320<=i&&i<=57343&&(e&=1023,i&=1023,r=e<<10|i,r+=65536),12288===r||65281<=r&&r<=65376||65504<=r&&r<=65510?"F":8361===r||65377<=r&&r<=65470||65474<=r&&r<=65479||65482<=r&&r<=65487||65490<=r&&r<=65495||65498<=r&&r<=65500||65512<=r&&r<=65518?"H":4352<=r&&r<=4447||4515<=r&&r<=4519||4602<=r&&r<=4607||9001<=r&&r<=9002||11904<=r&&r<=11929||11931<=r&&r<=12019||12032<=r&&r<=12245||12272<=r&&r<=12283||12289<=r&&r<=12350||12353<=r&&r<=12438||12441<=r&&r<=12543||12549<=r&&r<=12589||12593<=r&&r<=12686||12688<=r&&r<=12730||12736<=r&&r<=12771||12784<=r&&r<=12830||12832<=r&&r<=12871||12880<=r&&r<=13054||13056<=r&&r<=19903||19968<=r&&r<=42124||42128<=r&&r<=42182||43360<=r&&r<=43388||44032<=r&&r<=55203||55216<=r&&r<=55238||55243<=r&&r<=55291||63744<=r&&r<=64255||65040<=r&&r<=65049||65072<=r&&r<=65106||65108<=r&&r<=65126||65128<=r&&r<=65131||110592<=r&&r<=110593||127488<=r&&r<=127490||127504<=r&&r<=127546||127552<=r&&r<=127560||127568<=r&&r<=127569||131072<=r&&r<=194367||177984<=r&&r<=196605||196608<=r&&r<=262141?"W":32<=r&&r<=126||162<=r&&r<=163||165<=r&&r<=166||172===r||175===r||10214<=r&&r<=10221||10629<=r&&r<=10630?"Na":161===r||164===r||167<=r&&r<=168||170===r||173<=r&&r<=174||176<=r&&r<=180||182<=r&&r<=186||188<=r&&r<=191||198===r||208===r||215<=r&&r<=216||222<=r&&r<=225||230===r||232<=r&&r<=234||236<=r&&r<=237||240===r||242<=r&&r<=243||247<=r&&r<=250||252===r||254===r||257===r||273===r||275===r||283===r||294<=r&&r<=295||299===r||305<=r&&r<=307||312===r||319<=r&&r<=322||324===r||328<=r&&r<=331||333===r||338<=r&&r<=339||358<=r&&r<=359||363===r||462===r||464===r||466===r||468===r||470===r||472===r||474===r||476===r||593===r||609===r||708===r||711===r||713<=r&&r<=715||717===r||720===r||728<=r&&r<=731||733===r||735===r||768<=r&&r<=879||913<=r&&r<=929||931<=r&&r<=937||945<=r&&r<=961||963<=r&&r<=969||1025===r||1040<=r&&r<=1103||1105===r||8208===r||8211<=r&&r<=8214||8216<=r&&r<=8217||8220<=r&&r<=8221||8224<=r&&r<=8226||8228<=r&&r<=8231||8240===r||8242<=r&&r<=8243||8245===r||8251===r||8254===r||8308===r||8319===r||8321<=r&&r<=8324||8364===r||8451===r||8453===r||8457===r||8467===r||8470===r||8481<=r&&r<=8482||8486===r||8491===r||8531<=r&&r<=8532||8539<=r&&r<=8542||8544<=r&&r<=8555||8560<=r&&r<=8569||8585===r||8592<=r&&r<=8601||8632<=r&&r<=8633||8658===r||8660===r||8679===r||8704===r||8706<=r&&r<=8707||8711<=r&&r<=8712||8715===r||8719===r||8721===r||8725===r||8730===r||8733<=r&&r<=8736||8739===r||8741===r||8743<=r&&r<=8748||8750===r||8756<=r&&r<=8759||8764<=r&&r<=8765||8776===r||8780===r||8786===r||8800<=r&&r<=8801||8804<=r&&r<=8807||8810<=r&&r<=8811||8814<=r&&r<=8815||8834<=r&&r<=8835||8838<=r&&r<=8839||8853===r||8857===r||8869===r||8895===r||8978===r||9312<=r&&r<=9449||9451<=r&&r<=9547||9552<=r&&r<=9587||9600<=r&&r<=9615||9618<=r&&r<=9621||9632<=r&&r<=9633||9635<=r&&r<=9641||9650<=r&&r<=9651||9654<=r&&r<=9655||9660<=r&&r<=9661||9664<=r&&r<=9665||9670<=r&&r<=9672||9675===r||9678<=r&&r<=9681||9698<=r&&r<=9701||9711===r||9733<=r&&r<=9734||9737===r||9742<=r&&r<=9743||9748<=r&&r<=9749||9756===r||9758===r||9792===r||9794===r||9824<=r&&r<=9825||9827<=r&&r<=9829||9831<=r&&r<=9834||9836<=r&&r<=9837||9839===r||9886<=r&&r<=9887||9918<=r&&r<=9919||9924<=r&&r<=9933||9935<=r&&r<=9953||9955===r||9960<=r&&r<=9983||10045===r||10071===r||10102<=r&&r<=10111||11093<=r&&r<=11097||12872<=r&&r<=12879||57344<=r&&r<=63743||65024<=r&&r<=65039||65533===r||127232<=r&&r<=127242||127248<=r&&r<=127277||127280<=r&&r<=127337||127344<=r&&r<=127386||917760<=r&&r<=917999||983040<=r&&r<=1048573||1048576<=r&&r<=1114109?"A":"N"};function Re(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=arguments.length>2?arguments[2]:void 0;i||(i=1);const{fontStyle:r=e.fontStyle,fontVariant:o=e.fontVariant,fontWeight:n=e.fontWeight,fontSize:s=e.fontSize,fontFamily:a=e.fontFamily}=t;return(r?r+" ":"")+(o?o+" ":"")+(n?n+" ":"")+s*i+"px "+(a||"sans-serif")}class Te{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(),J(t.specialCharSet)&&(this.specialCharSet=t.specialCharSet),this._standardMethod=J(t.getTextBounds)?this.fullMeasure.bind(this):this.measureWithNaiveCanvas.bind(this)}initContext(){if(this._notSupportCanvas)return!1;if(Z(this._canvas)&&(J(this._option.getCanvasForMeasure)&&(this._canvas=this._option.getCanvasForMeasure()),Z(this._canvas)&&"undefined"!=typeof window&&void 0!==window.document&&globalThis&&J(globalThis.document)&&(this._canvas=globalThis.document.createElement("canvas"))),Z(this._context)&&J(this._canvas)){const t=this._canvas.getContext("2d");J(t)&&(t.save(),t.font=Re(this.textSpec),this._contextSaved=!0,this._context=t)}return!Z(this._context)||(this._notSupportCanvas=!0,!1)}_initSpec(){var t,e,i;const{defaultFontParams:r={}}=this._option,{fontStyle:o=r.fontStyle,fontVariant:n=r.fontVariant,fontWeight:s=(null!==(t=r.fontWeight)&&void 0!==t?t:"normal"),fontSize:a=(null!==(e=r.fontSize)&&void 0!==e?e:12),fontFamily:l=(null!==(i=r.fontFamily)&&void 0!==i?i:"sans-serif"),align:h,textAlign:c=(null!=h?h:"center"),baseline:d,textBaseline:u=(null!=d?d:"middle"),ellipsis:g,limit:p}=this._userSpec;let{lineHeight:f=a}=this._userSpec;if(rt(f)&&"%"===f[f.length-1]){const t=Number.parseFloat(f.substring(0,f.length-1))/100;f=a*t}return{fontStyle:o,fontVariant:n,fontFamily:l,fontSize:a,fontWeight:s,textAlign:c,textBaseline:u,ellipsis:g,limit:p,lineHeight:f}}measure(t,e){switch(e){case"vrender":case"canopus":return this.fullMeasure(t);case"canvas":return this.measureWithNaiveCanvas(t);case"simple":return this.quickMeasureWithoutCanvas(t);default:return this.quickMeasure(t)}}fullMeasure(t){if(Z(t))return{width:0,height:0};if(Z(this._option.getTextBounds)||!this._notSupportVRender)return this.measureWithNaiveCanvas(t);const{fontFamily:e,fontSize:i,fontWeight:r,textAlign:o,textBaseline:n,ellipsis:s,limit:a,lineHeight:l}=this.textSpec;let h;try{const c=this._option.getTextBounds({text:t,fontFamily:e,fontSize:i,fontWeight:r,textAlign:o,textBaseline:n,ellipsis:!!s,maxLineWidth:a||1/0,lineHeight:l});h={width:c.width(),height:c.height()}}catch(e){this._notSupportVRender=!0,h=this.measureWithNaiveCanvas(t)}return h}measureWithNaiveCanvas(t){return this._measureReduce(t,this._measureWithNaiveCanvas.bind(this))}_measureWithNaiveCanvas(t){var e;if(!this.initContext())return this._quickMeasureWithoutCanvas(t);const i=this._context.measureText(t),{fontSize:r,lineHeight:o}=this.textSpec;return{width:i.width,height:null!==(e=o)&&void 0!==e?e:r,fontBoundingBoxAscent:i.fontBoundingBoxAscent,fontBoundingBoxDescent:i.fontBoundingBoxDescent}}quickMeasure(t){return this._measureReduce(t,this._quickMeasure.bind(this))}_quickMeasure(t){const e={width:0,height:0};for(let i=0;i<t.length;i++){const r=t[i];let o=this._measureSpecialChar(r);Z(o)&&Te.NUMBERS_CHAR_SET.includes(r)&&(o=this._measureNumberChar()),Z(o)&&["F","W"].includes(Ae(r))&&(o=this._measureFullSizeChar()),Z(o)&&(o=this._measureLetterChar()),e.width+=o.width,e.height=Math.max(e.height,o.height),!Z(o.fontBoundingBoxAscent)&&(e.fontBoundingBoxAscent=o.fontBoundingBoxAscent),!Z(o.fontBoundingBoxDescent)&&(e.fontBoundingBoxDescent=o.fontBoundingBoxDescent)}return e}quickMeasureWithoutCanvas(t){return this._measureReduce(t,this._quickMeasureWithoutCanvas.bind(this))}_quickMeasureWithoutCanvas(t){var e;const i={width:0,height:0},{fontSize:r,lineHeight:o}=this.textSpec;for(let e=0;e<t.length;e++){const o=t[e],n=["F","W"].includes(Ae(o))?1:.53;i.width+=n*r}return i.height=null!==(e=o)&&void 0!==e?e:r,i}_measureReduce(t,e){var i;const{fontSize:r,lineHeight:o}=this.textSpec,n={width:0,height:0};if(Z(t))return n;if(ot(t)){const s=t.filter(J).map((t=>t.toString()));return 0===s.length?n:1===s.length?e(s[0]):{width:s.reduce(((t,i)=>Math.max(t,e(i).width)),0),height:s.length*((null!==(i=o)&&void 0!==i?i:r)+1)+1}}return e(t.toString())}_measureNumberChar(){if(Z(this._numberCharSize)){const t=this._standardMethod(Te.NUMBERS_CHAR_SET);this._numberCharSize={width:t.width/Te.NUMBERS_CHAR_SET.length,height:t.height,fontBoundingBoxAscent:t.fontBoundingBoxAscent,fontBoundingBoxDescent:t.fontBoundingBoxDescent}}return this._numberCharSize}_measureFullSizeChar(){return Z(this._fullCharSize)&&(this._fullCharSize=this._standardMethod(Te.FULL_SIZE_CHAR)),this._fullCharSize}_measureLetterChar(){if(Z(this._letterCharSize)){const t=this._standardMethod(Te.ALPHABET_CHAR_SET);this._letterCharSize={width:t.width/Te.ALPHABET_CHAR_SET.length,height:t.height,fontBoundingBoxAscent:t.fontBoundingBoxAscent,fontBoundingBoxDescent:t.fontBoundingBoxDescent}}return this._letterCharSize}_measureSpecialChar(t){return J(this._specialCharSizeMap[t])?this._specialCharSizeMap[t]:this.specialCharSet.includes(t)?(this._specialCharSizeMap[t]=this._standardMethod(t),this._specialCharSizeMap[t]):null}release(){J(this._canvas)&&(this._canvas=null),J(this._context)&&(this._contextSaved&&(this._context.restore(),this._contextSaved=!1),this._context=null)}}function Be(t,e,i){const{x1:r,y1:o,x2:n,y2:s}=e;return i.onlyTranslate()?(t!==e&&t.setValue(e.x1,e.y1,e.x2,e.y2),t.translate(i.e,i.f),e):(t.clear(),t.add(i.a*r+i.c*o+i.e,i.b*r+i.d*o+i.f),t.add(i.a*n+i.c*o+i.e,i.b*n+i.d*o+i.f),t.add(i.a*n+i.c*s+i.e,i.b*n+i.d*s+i.f),t.add(i.a*r+i.c*s+i.e,i.b*r+i.d*s+i.f),e)}Te.ALPHABET_CHAR_SET="abcdefghijklmnopqrstuvwxyz",Te.NUMBERS_CHAR_SET="0123456789",Te.FULL_SIZE_CHAR="字";class Me{constructor(t){t?this.setValue(t.x1,t.y1,t.x2,t.y2):this.clear()}clone(){return new Me(this)}clear(){return this.x1=+Number.MAX_VALUE,this.y1=+Number.MAX_VALUE,this.x2=-Number.MAX_VALUE,this.y2=-Number.MAX_VALUE,this}empty(){return this.x1===+Number.MAX_VALUE&&this.y1===+Number.MAX_VALUE&&this.x2===-Number.MAX_VALUE&&this.y2===-Number.MAX_VALUE}equals(t){return this.x1===t.x1&&this.y1===t.y1&&this.x2===t.x2&&this.y2===t.y2}setValue(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;return this.x1=t,this.y1=e,this.x2=i,this.y2=r,this}set(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;return i<t?(this.x2=t,this.x1=i):(this.x1=t,this.x2=i),r<e?(this.y2=e,this.y1=r):(this.y1=e,this.y2=r),this}add(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return t<this.x1&&(this.x1=t),e<this.y1&&(this.y1=e),t>this.x2&&(this.x2=t),e>this.y2&&(this.y2=e),this}expand(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return ot(t)?(this.y1-=t[0],this.x2+=t[1],this.y2+=t[2],this.x1-=t[3]):(this.x1-=t,this.y1-=t,this.x2+=t,this.y2+=t),this}round(){return this.x1=Math.floor(this.x1),this.y1=Math.floor(this.y1),this.x2=Math.ceil(this.x2),this.y2=Math.ceil(this.y2),this}translate(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return this.x1+=t,this.x2+=t,this.y1+=e,this.y2+=e,this}rotate(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;const r=this.rotatedPoints(t,e,i);return this.clear().add(r[0],r[1]).add(r[2],r[3]).add(r[4],r[5]).add(r[6],r[7])}scale(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;const o=this.scalePoints(t,e,i,r);return this.clear().add(o[0],o[1]).add(o[2],o[3])}union(t){return t.x1<this.x1&&(this.x1=t.x1),t.y1<this.y1&&(this.y1=t.y1),t.x2>this.x2&&(this.x2=t.x2),t.y2>this.y2&&(this.y2=t.y2),this}intersect(t){return t.x1>this.x1&&(this.x1=t.x1),t.y1>this.y1&&(this.y1=t.y1),t.x2<this.x2&&(this.x2=t.x2),t.y2<this.y2&&(this.y2=t.y2),this}encloses(t){return t&&this.x1<=t.x1&&this.x2>=t.x2&&this.y1<=t.y1&&this.y2>=t.y2}alignsWith(t){return t&&(this.x1===t.x1||this.x2===t.x2||this.y1===t.y1||this.y2===t.y2)}intersects(t){return t&&!(this.x2<t.x1||this.x1>t.x2||this.y2<t.y1||this.y1>t.y2)}contains(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return!(t<this.x1||t>this.x2||e<this.y1||e>this.y2)}containsPoint(t){return!(t.x<this.x1||t.x>this.x2||t.y<this.y1||t.y>this.y2)}width(){return this.empty()?0:this.x2-this.x1}height(){return this.empty()?0:this.y2-this.y1}scaleX(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return this.x1*=t,this.x2*=t,this}scaleY(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return this.y1*=t,this.y2*=t,this}transformWithMatrix(t){return 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,i){const{x1:r,y1:o,x2:n,y2:s}=this,a=Math.cos(t),l=Math.sin(t),h=e-e*a+i*l,c=i-e*l-i*a;return[a*r-l*o+h,l*r+a*o+c,a*r-l*s+h,l*r+a*s+c,a*n-l*o+h,l*n+a*o+c,a*n-l*s+h,l*n+a*s+c]}scalePoints(t,e,i,r){const{x1:o,y1:n,x2:s,y2:a}=this;return[t*o+(1-t)*i,e*n+(1-e)*r,t*s+(1-t)*i,e*a+(1-e)*r]}}class Pe extends Me{}class He extends Me{constructor(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;var i;super(t),t&&(this.angle=null!==(i=t.angle)&&void 0!==i?i:e)}intersects(t){return Se(this,t)}setValue(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0;return super.setValue(t,e,i,r),this.angle=o,this}clone(){return new He(this)}}class ke{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1,o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0,n=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0;this.a=t,this.b=e,this.c=i,this.d=r,this.e=o,this.f=n}equalToMatrix(t){return!(this.e!==t.e||this.f!==t.f||this.a!==t.a||this.d!==t.d||this.b!==t.b||this.c!==t.c)}equalTo(t,e,i,r,o,n){return!(this.e!==o||this.f!==n||this.a!==t||this.d!==r||this.b!==e||this.c!==i)}setValue(t,e,i,r,o,n){return this.a=t,this.b=e,this.c=i,this.d=r,this.e=o,this.f=n,this}reset(){return this.a=1,this.b=0,this.c=0,this.d=1,this.e=0,this.f=0,this}getInverse(){const t=this.a,e=this.b,i=this.c,r=this.d,o=this.e,n=this.f,s=new ke,a=t*r-e*i;return s.a=r/a,s.b=-e/a,s.c=-i/a,s.d=t/a,s.e=(i*n-r*o)/a,s.f=-(t*n-e*o)/a,s}rotate(t){const e=Math.cos(t),i=Math.sin(t),r=this.a*e+this.c*i,o=this.b*e+this.d*i,n=this.a*-i+this.c*e,s=this.b*-i+this.d*e;return this.a=r,this.b=o,this.c=n,this.d=s,this}rotateByCenter(t,e,i){const r=Math.cos(t),o=Math.sin(t),n=(1-r)*e+o*i,s=(1-r)*i-o*e,a=r*this.a-o*this.b,l=o*this.a+r*this.b,h=r*this.c-o*this.d,c=o*this.c+r*this.d,d=r*this.e-o*this.f+n,u=o*this.e+r*this.f+s;return this.a=a,this.b=l,this.c=h,this.d=c,this.e=d,this.f=u,this}scale(t,e){return this.a*=t,this.b*=t,this.c*=e,this.d*=e,this}setScale(t,e){return this.b=this.b/this.a*t,this.c=this.c/this.d*e,this.a=t,this.d=e,this}transform(t,e,i,r,o,n){return this.multiply(t,e,i,r,o,n),this}translate(t,e){return this.e+=this.a*t+this.c*e,this.f+=this.b*t+this.d*e,this}transpose(){const{a:t,b:e,c:i,d:r,e:o,f:n}=this;return this.a=e,this.b=t,this.c=r,this.d=i,this.e=n,this.f=o,this}multiply(t,e,i,r,o,n){const s=this.a,a=this.b,l=this.c,h=this.d,c=s*t+l*e,d=a*t+h*e,u=s*i+l*r,g=a*i+h*r,p=s*o+l*n+this.e,f=a*o+h*n+this.f;return this.a=c,this.b=d,this.c=u,this.d=g,this.e=p,this.f=f,this}interpolate(t,e){const i=new ke;return i.a=this.a+(t.a-this.a)*e,i.b=this.b+(t.b-this.b)*e,i.c=this.c+(t.c-this.c)*e,i.d=this.d+(t.d-this.d)*e,i.e=this.e+(t.e-this.e)*e,i.f=this.f+(t.f-this.f)*e,i}transformPoint(t,e){const{a:i,b:r,c:o,d:n,e:s,f:a}=this,l=i*n-r*o,h=n/l,c=-r/l,d=-o/l,u=i/l,g=(o*a-n*s)/l,p=-(i*a-r*s)/l,{x:f,y:m}=t;e.x=f*h+m*d+g,e.y=f*c+m*u+p}onlyTranslate(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1;return this.a===t&&0===this.b&&0===this.c&&this.d===t}clone(){return new ke(this.a,this.b,this.c,this.d,this.e,this.f)}toTransformAttrs(){const t=this.a,e=this.b,i=this.c,r=this.d,o=t*r-e*i,n={x:this.e,y:this.f,rotateDeg:0,scaleX:0,scaleY:0,skewX:0,skewY:0};if(0!==t||0!==e){const s=Math.sqrt(t*t+e*e);n.rotateDeg=e>0?Math.acos(t/s):-Math.acos(t/s),n.scaleX=s,n.scaleY=o/s,n.skewX=(t*i+e*r)/o,n.skewY=0}else if(0!==i||0!==r){const s=Math.sqrt(i*i+r*r);n.rotateDeg=Math.PI/2-(r>0?Math.acos(-i/s):-Math.acos(i/s)),n.scaleX=o/s,n.scaleY=s,n.skewX=0,n.skewY=(t*i+e*r)/o}return n.rotateDeg=180*n.rotateDeg/Math.PI,n}}class Le{constructor(){this.CLEAN_THRESHOLD=1e3,this.L_TIME=1e3,this.R_COUNT=1,this.R_TIMESTAMP_MAX_SIZE=20}clearCache(t,e){const{CLEAN_THRESHOLD:i=this.CLEAN_THRESHOLD,L_TIME:r=this.L_TIME,R_COUNT:o=this.R_COUNT}=e;if(t.size<i)return 0;let n=0;const s=e=>{n++,t.delete(e)},a=Date.now();return t.forEach(((t,e)=>{if(t.timestamp.length<o)return s(e);let i=0;for(;a-t.timestamp[t.timestamp.length-1-i]<r&&(i++,!(i>=o)););if(i<o)return s(e);for(;a-t.timestamp[0]>r;)t.timestamp.shift()})),n}addLimitedTimestamp(t,e,i){const{R_TIMESTAMP_MAX_SIZE:r=this.R_TIMESTAMP_MAX_SIZE}=i;t.timestamp.length>r&&t.timestamp.shift(),t.timestamp.push(e)}clearTimeStamp(t,e){const{L_TIME:i=this.L_TIME}=e,r=Date.now();t.forEach((t=>{for(;r-t.timestamp[0]>i;)t.timestamp.shift()}))}clearItemTimestamp(t,e){const{L_TIME:i=this.L_TIME}=e,r=Date.now();for(;r-t.timestamp[0]>i;)t.timestamp.shift()}}function Ee(t,e,i){e/=100,i/=100;const r=(1-Math.abs(2*i-1))*e,o=r*(1-Math.abs(t/60%2-1)),n=i-r/2;let s=0,a=0,l=0;return 0<=t&&t<60?(s=r,a=o,l=0):60<=t&&t<120?(s=o,a=r,l=0):120<=t&&t<180?(s=0,a=r,l=o):180<=t&&t<240?(s=0,a=o,l=r):240<=t&&t<300?(s=o,a=0,l=r):300<=t&&t<360&&(s=r,a=0,l=o),s=Math.round(255*(s+n)),a=Math.round(255*(a+n)),l=Math.round(255*(l+n)),{r:s,g:a,b:l}}function Fe(t,e,i){t/=255,e/=255,i/=255;const r=Math.min(t,e,i),o=Math.max(t,e,i),n=o-r;let s=0,a=0,l=0;return s=0===n?0:o===t?(e-i)/n%6:o===e?(i-t)/n+2:(t-e)/n+4,s=Math.round(60*s),s<0&&(s+=360),l=(o+r)/2,a=0===n?0:n/(1-Math.abs(2*l-1)),a=+(100*a).toFixed(1),l=+(100*l).toFixed(1),{h:s,s:a,l:l}}const Ie=/^#([0-9a-f]{3,8})$/,ze={transparent:4294967040},Oe={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:164