UNPKG

@visactor/vtable

Version:

canvas table width high performance

1 lines 2.04 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",C="Transient",y="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=(M=r,t=>{const e=e=>{if(null==e)return!1;if(e.key===M&&e.value===t)return!0;if(null==e.constructorArgsMetadata)return!1;const i=e.constructorArgsMetadata;for(let e=0;e<i.length;e++)if(i[e].key===M&&i[e].value===t)return!0;return!1};return e.metaData=new l(M,t),e});var M;class B{constructor(t){this._binding=t}inRequestScope(){throw new Error("暂未实现")}inSingletonScope(){return this._binding.scope=b,this}inTransientScope(){return this._binding.scope=C,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 B(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 B(this._binding)}toConstantValue(t){return this._binding.type=y,this._binding.cache=t,this._binding.dynamicValue=null,this._binding.implementationType=null,this._binding.scope=b,new B(this._binding)}toFactory(t){return this._binding.type=v,this._binding.factory=t,this._binding.scope=b,new B(this._binding)}toService(t){this.toDynamicValue((e=>e.container.get(t)))}}const H=Symbol("ContributionProvider");class E{constructor(t,e){this.serviceIdentifier=t,this.container=e,L.setStore(this.serviceIdentifier,this)}getContributions(){return this.caches||(this.caches=[],this.container&&this.container.isBound(this.serviceIdentifier)&&this.caches.push(...this.container.getAll(this.serviceIdentifier))),this.caches}refresh(){this.caches&&(this.caches.length=0,this.container&&this.container.isBound(this.serviceIdentifier)&&this.caches.push(...this.container.getAll(this.serviceIdentifier)))}}function F(t,e){t(H).toDynamicValue((({container:t})=>new E(e,t))).inSingletonScope().whenTargetNamed(e)}class L{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()}))}}L.store=new Map;class k{constructor(t,e){this._args=t,this.name=e,this.taps=[]}tap(t,e){this._tap("sync",t,e)}unTap(t,e){const i="string"==typeof t?t.trim():t.name;i&&(this.taps=this.taps.filter((t=>!(t.name===i&&(!e||t.fn===e)))))}_parseOptions(t,e,i){let r;if("string"==typeof e)r={name:e.trim()};else if("object"!=typeof e||null===e)throw new Error("Invalid tap options");if("string"!=typeof r.name||""===r.name)throw new Error("Missing name for tap");return r=Object.assign({type:t,fn:i},r),r}_tap(t,e,i){this._insert(this._parseOptions(t,e,i))}_insert(t){let e;"string"==typeof t.before?e=new Set([t.before]):Array.isArray(t.before)&&(e=new Set(t.before));let i=0;"number"==typeof t.stage&&(i=t.stage);let r=this.taps.length;for(;r>0;){r--;const t=this.taps[r];this.taps[r+1]=t;const 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 I extends k{call(...t){this.taps.map((t=>t.fn)).forEach((e=>e(...t)))}}const z=Symbol.for("EnvContribution"),O=Symbol.for("VGlobal"),D=new class{constructor(t){const i=t||{};i.defaultScope=i.defaultScope||C,this.options=i,this.id=e.GenAutoIncrementId(),this._bindingDictionary=new Map,this._metadataReader=new R}load(t){const e=this._getContainerModuleHelpersFactory()(t.id);t.registry(e.bindFunction,e.unbindFunction,e.isboundFunction,e.rebindFunction)}get(t){const e=this._getNotAllArgs(t,!1);return this._get(e)}getAll(t){const e=this._getAllArgs(t);return this._get(e)}getTagged(t,e,i){const r=this._getNotAllArgs(t,!1,e,i);return this._get(r)}getNamed(t,e){return this.getTagged(t,r,e)}isBound(t){return this._bindingDictionary.has(t)}bind(t){const e=this.options.defaultScope,i=new A(t,e),r=this._bindingDictionary.get(t)||[];return r.push(i),this._bindingDictionary.set(t,r),new P(i)}unbind(t){this._bindingDictionary.delete(t)}rebind(t){return this.unbind(t),this.bind(t)}_getContainerModuleHelpersFactory(){const t=(t,e)=>{t._binding.moduleId=e},e=e=>i=>{const r=this.bind(i);return t(r,e),r},i=()=>t=>this.unbind(t),r=()=>t=>this.isBound(t),o=e=>i=>{const r=this.rebind(i);return t(r,e),r};return t=>({bindFunction:e(t),isboundFunction:r(),rebindFunction:o(t),unbindFunction:i(),unbindAsyncFunction:t=>null})}_getNotAllArgs(t,e,i,r){return{avoidConstraints:!1,isMultiInject:e,serviceIdentifier:t,key:i,value:r}}_getAllArgs(t){return{avoidConstraints:!0,isMultiInject:!0,serviceIdentifier:t}}_get(t){const e=[];return this._bindingDictionary.get(t.serviceIdentifier).filter((e=>e.constraint(t))).forEach((t=>{e.push(this._resolveFromBinding(t))})),t.isMultiInject||1!==e.length?e:e[0]}_getChildRequest(t){const e=t.implementationType,{userGeneratedMetadata:i}=this._metadataReader.getConstructorMetadata(e),r=Object.keys(i),s=[];for(let t=0;t<r.length;t++){const e=i[t],r={};e.forEach((t=>{r[t.key]=t.value}));const a={inject:r[o],multiInject:r[n]},l=a.inject||a.multiInject,h={serviceIdentifier:l,constructorArgsMetadata:e},c=(this._bindingDictionary.get(l)||[]).filter((t=>t.constraint(h)));if(c.length){const t={injectIdentifier:l,metadata:e,bindings:c};s.push(t)}}return s}_resolveFromBinding(t){const e=this._getResolvedFromBinding(t);return this._saveToScope(t,e),e}_getResolvedFromBinding(t){let e;switch(t.type){case y:case x:e=t.cache;break;case _:e=this._resolveInstance(t,t.implementationType);break;default:e=t.dynamicValue({container:this})}return e}_resolveInstance(t,e){if(t.activated)return t.cache;const i=this._getChildRequest(t);return this._createInstance(e,i)}_createInstance(t,e){return e.length?new t(...this._resolveRequests(e)):new t}_resolveRequests(t){return t.map((t=>t.bindings.length>1?t.bindings.map((t=>this._resolveFromBinding(t))):this._resolveFromBinding(t.bindings[0])))}_saveToScope(t,e){t.scope===b&&(t.cache=e,t.activated=!0)}},W=Symbol.for("RenderService");const N=new class{get renderService(){return this._renderService||(this._renderService=D.get(W)),this._renderService}};let G=0;class V{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=N.global.getRequestAnimationFrame()(this.runAnimationFrame))}}addAnimationFrameCb(t){return this.nextAnimationFrameCbs.set(++G,t),this.tryRunAnimationFrameNextFrame(),G}removeAnimationFrameCb(t){return!!this.nextAnimationFrameCbs.has(t)&&(this.nextAnimationFrameCbs.delete(t),!0)}}class j{constructor(){this._listenerMap=new Map,this._eventListenerTransformer=t=>t}setEventListenerTransformer(t){this._eventListenerTransformer=t||(t=>t)}addEventListener(t,e,i){if(!e)return;const r=this._resolveCapture(i),o=this._resolveOnce(i),n=this._getOrCreateListenerTypeMap(t),s=this._getOrCreateWrappedMap(n,e);if(s.has(r))return;const a=i=>{const n=this._eventListenerTransformer(i);"function"==typeof e?e(n):e.handleEvent&&e.handleEvent(n),o&&this._deleteListenerRecord(t,e,r)};s.set(r,{wrappedListener:a,options:i}),this._nativeAddEventListener(t,a,i)}removeEventListener(t,e,i){var r,o;if(!e)return;const n=this._resolveCapture(i),s=null===(o=null===(r=this._listenerMap.get(t))||void 0===r?void 0:r.get(e))||void 0===o?void 0:o.get(n);s&&(this._nativeRemoveEventListener(t,s.wrappedListener,n),this._deleteListenerRecord(t,e,n))}dispatchEvent(t){return this._nativeDispatchEvent(t)}clearAllEventListeners(){this._listenerMap.forEach(((t,e)=>{t.forEach((t=>{t.forEach(((t,i)=>{this._nativeRemoveEventListener(e,t.wrappedListener,i)}))}))})),this._listenerMap.clear()}_resolveCapture(t){return"boolean"==typeof t?t:!!(null==t?void 0:t.capture)}_resolveOnce(t){return"object"==typeof t&&!!(null==t?void 0:t.once)}_getOrCreateListenerTypeMap(t){let e=this._listenerMap.get(t);return e||(e=new Map,this._listenerMap.set(t,e)),e}_getOrCreateWrappedMap(t,e){let i=t.get(e);return i||(i=new Map,t.set(e,i)),i}_deleteListenerRecord(t,e,i){const r=this._listenerMap.get(t);if(!r)return;const o=r.get(e);o&&(o.delete(i),0===o.size&&r.delete(e),0===r.size&&this._listenerMap.delete(t))}_nativeAddEventListener(t,e,i){throw new Error("_nativeAddEventListener must be implemented by derived classes")}_nativeRemoveEventListener(t,e,i){throw new Error("_nativeRemoveEventListener must be implemented by derived classes")}_nativeDispatchEvent(t){throw new Error("_nativeDispatchEvent must be implemented by derived classes")}}var U=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},K=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},$=function(t,e){return function(i,r){e(i,r,t)}},X=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 Y=class extends j{get env(){return this._env}get isImageAnonymous(){return this._isImageAnonymous}set isImageAnonymous(t){this._isImageAnonymous=t}get devicePixelRatio(){return this._env||this.setEnv("browser"),this.envContribution.getDevicePixelRatio()}get supportEvent(){return this._env||this.setEnv("browser"),this.envContribution.supportEvent}set supportEvent(t){this._env||this.setEnv("browser"),this.envContribution.supportEvent=t}get supportsTouchEvents(){return this._env||this.setEnv("browser"),this.envContribution.supportsTouchEvents}set supportsTouchEvents(t){this._env||this.setEnv("browser"),this.envContribution.supportsTouchEvents=t}get supportsPointerEvents(){return this._env||this.setEnv("browser"),this.envContribution.supportsPointerEvents}set supportsPointerEvents(t){this._env||this.setEnv("browser"),this.envContribution.supportsPointerEvents=t}get supportsMouseEvents(){return this._env||this.setEnv("browser"),this.envContribution.supportsMouseEvents}set supportsMouseEvents(t){this._env||this.setEnv("browser"),this.envContribution.supportsMouseEvents=t}get applyStyles(){return this._env||this.setEnv("browser"),this.envContribution.applyStyles}set applyStyles(t){this._env||this.setEnv("browser"),this.envContribution.applyStyles=t}constructor(t){super(),this.contributions=t,this._isImageAnonymous=!0,this._performanceRAFList=[],this.eventListenerTransformer=t=>t,this.id=e.GenAutoIncrementId(),this.hooks={onSetEnv:new I(["lastEnv","env","global"])},this.measureTextMethod="native",this.optimizeVisible=!1}_nativeAddEventListener(t,e,i){return this._env||this.setEnv("browser"),this.envContribution.addEventListener(t,e,i)}_nativeRemoveEventListener(t,e,i){return this._env||this.setEnv("browser"),this.envContribution.removeEventListener(t,e,i)}_nativeDispatchEvent(t){return this._env||this.setEnv("browser"),this.envContribution.dispatchEvent(t)}bindContribution(t){const e=[];if(this.contributions.getContributions().forEach((i=>{const 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)}getRequestAnimationFrame(){return this._env||this.setEnv("browser"),this.envContribution.getRequestAnimationFrame()}getSpecifiedRequestAnimationFrame(t){this._env||this.setEnv("browser"),this._performanceRAFList[t]||(this._performanceRAFList[t]=new V);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,i){return X(this,void 0,void 0,(function*(){return this._env||this.setEnv("browser"),this.envContribution.loadFont(t,e,i)}))}isChrome(){return null!=this._isChrome||(this._env||this.setEnv("browser"),this._isChrome="browser"===this._env&&navigator.userAgent.indexOf("Chrome")>-1),this._isChrome}isSafari(){return null!=this._isSafari||(this._env||this.setEnv("browser"),this._isSafari="browser"===this._env&&/Safari/.test(navigator.userAgent)&&!/Chrome/.test(navigator.userAgent)),this._isSafari}getNativeAABBBounds(t){return this._env||this.setEnv("browser"),this.envContribution.getNativeAABBBounds(t)}removeDom(t){return this._env||this.setEnv("browser"),this.envContribution.removeDom(t)}createDom(t){return this._env||this.setEnv("browser"),this.envContribution.createDom(t)}updateDom(t,e){return this._env||this.setEnv("browser"),this.envContribution.updateDom(t,e)}getElementTop(t,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 q,Z,J,Q;Y=U([f(),$(0,g(H)),$(0,m(z)),K("design:paramtypes",[Object])],Y),function(t){t[t.estimate=0]="estimate",t[t.actualBounding=1]="actualBounding",t[t.fontBounding=2]="fontBounding"}(q||(q={})),function(t){t[t.INITIAL=0]="INITIAL",t[t.RUNNING=1]="RUNNING",t[t.PAUSE=2]="PAUSE"}(Z||(Z={})),function(t){t.wait="wait",t.from="from",t.to="to",t.customAnimate="customAnimate"}(J||(J={})),function(t){t[t.INITIAL=0]="INITIAL",t[t.RUNNING=1]="RUNNING",t[t.PAUSED=2]="PAUSED",t[t.END=3]="END"}(Q||(Q={}));var tt="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function et(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var it={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}(it);var rt=et(it.exports);var ot=(t,e)=>Object.prototype.toString.call(t)===`[object ${e}]`;var nt=(t,e=!1)=>e?"boolean"==typeof t:!0===t||!1===t||ot(t,"Boolean");var st=t=>"function"==typeof t;var at=t=>null==t;var lt=t=>null!=t;var ht=t=>{const e=typeof t;return null!==t&&"object"===e||"function"===e};var ct=t=>"object"==typeof t&&null!==t;var dt=function(t){if(!ct(t)||!ot(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 ut=t=>void 0===t;var gt=(t,e=!1)=>{const i=typeof t;return e?"string"===i:"string"===i||ot(t,"String")};var pt=t=>Array.isArray?Array.isArray(t):ot(t,"Array");var ft=function(t){return null!==t&&"function"!=typeof t&&Number.isFinite(t.length)};var mt=t=>ot(t,"Date");var bt=(t,e=!1)=>{const i=typeof t;return e?"number"===i:"number"===i||ot(t,"Number")};var Ct=t=>bt(t)&&Number.isFinite(t);var yt=t=>new RegExp(/^(http(s)?:\/\/)\w+[^\s]+(\.[^\s]+){1,}$/).test(t);var wt=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 vt=t=>({}.toString.call(t).replace(/^\[object /,"").replace(/]$/,""));const xt=Object.prototype;var _t=function(t){const e=t&&t.constructor;return t===("function"==typeof e&&e.prototype||xt)};const St=Object.prototype.hasOwnProperty;function At(t){if(at(t))return!0;if(ft(t))return!t.length;const e=vt(t);if("Map"===e||"Set"===e)return!t.size;if(_t(t))return!Object.keys(t).length;for(const e in t)if(St.call(t,e))return!1;return!0}var Rt=(t,e,i)=>{const r=gt(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 Tt=Object.prototype.hasOwnProperty;var Mt=(t,e)=>null!=t&&Tt.call(t,e);function Bt(t,e,i){let r;if(!lt(t)||"object"!=typeof t||e&&e(t))return t;const o=pt(t),n=t.length;r=o?new Array(n):"object"==typeof t?{}:nt(t)||bt(t)||gt(t)?t:mt(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]=Bt(n,e,i)}return r}function Pt(t,e,i=!1,r=!1){if(e){if(t===e)return;if(lt(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];!lt(o[s])||"object"!=typeof o[s]||r&&pt(t[s])?Et(t,s,o[s]):Ht(t,e,s,i,r)}}}}function Ht(t,e,i,r=!1,o=!1){const n=t[i],s=e[i];let a=e[i],l=!0;if(pt(s)){if(r)a=[];else if(pt(n))a=n;else if(ft(n)){a=new Array(n.length);let t=-1;const e=n.length;for(;++t<e;)a[t]=n[t]}}else dt(s)?(a=null!=n?n:{},"function"!=typeof n&&"object"==typeof n||(a={})):l=!1;l&&Pt(a,s,r,o),Et(t,i,a)}function Et(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 Ft(t,...e){let i=-1;const r=e.length;for(;++i<r;)Pt(t,e[i],!0);return t}function Lt(t){return Object.prototype.toString.call(t)}function kt(t){return Object.keys(t)}function It(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(Lt(t)!==Lt(e))return!1;if(st(t))return!!(null==i?void 0:i.skipFunction);if("object"!=typeof t)return!1;if(pt(t)){if(t.length!==e.length)return!1;for(let r=t.length-1;r>=0;r--)if(!It(t[r],e[r],i))return!1;return!0}if(!dt(t))return!1;const r=kt(t),o=kt(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(!It(t[n],e[n],i))return!1}return!0}function zt(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 Ot(t,e,i=!0){if(t="prototype"in t?t.prototype:t,e="prototype"in e?e.prototype:e,Object.getOwnPropertyNames){const r=Object.getOwnPropertyNames(e);for(let o=0;o<r.length;o++){const n=r[o];"constructor"!==n&&(i?null!=e[n]:null==t[n])&&(t[n]=e[n])}}else zt(t,e,i)}function Dt(t){return lt(t)?pt(t)?t:[t]:[]}function Wt(t){if(ft(t))return t[t.length-1]}const Nt=(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},Gt=(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 Vt(t,e){if(!pt(t)||!pt(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 jt(t){if(!pt(t))return[t];const e=[];for(const i of t)e.push(...jt(i));return e}function Ut(t,e){return t<e?-1:t>e?1:t>=e?0:NaN}function Kt(t){return Number(t)}const $t="undefined"!=typeof console;function Xt(t,e,i){const r=[e].concat([].slice.call(i));$t&&console[t].apply(console,r)}var Yt;!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"}(Yt||(Yt={}));class qt{static getInstance(t,e){return qt._instance&&bt(t)?qt._instance.level(t):qt._instance||(qt._instance=new qt(t,e)),qt._instance}static setInstance(t){return qt._instance=t}static setInstanceLevel(t){qt._instance?qt._instance.level(t):qt._instance=new qt(t)}static clearInstance(){qt._instance=null}constructor(t=Yt.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>=Yt.Info}canLogDebug(){return this._level>=Yt.Debug}canLogError(){return this._level>=Yt.Error}canLogWarn(){return this._level>=Yt.Warn}level(t){return arguments.length?(this._level=+t,this):this._level}error(...t){var e;return this._level>=Yt.Error&&(this._onErrorHandler.length?this.callErrorHandler(...t):Xt(null!==(e=this._method)&&void 0!==e?e:"error","ERROR",t)),this}warn(...t){return this._level>=Yt.Warn&&Xt(this._method||"warn","WARN",t),this}info(...t){return this._level>=Yt.Info&&Xt(this._method||"log","INFO",t),this}debug(...t){return this._level>=Yt.Debug&&Xt(this._method||"log","DEBUG",t),this}}qt._instance=null;const Zt=1e-10,Jt=1e-10;function Qt(t,e,i=Jt,r=Zt){const o=r,n=i*Math.max(t,e);return Math.abs(t-e)<=Math.max(o,n)}function te(t,e,i,r){return t>e&&!Qt(t,e,i,r)}function ee(t,e,i,r){return t<e&&!Qt(t,e,i,r)}const ie=t=>{let e=null,i=null;return(...r)=>(e&&r.every(((t,i)=>t===e[i]))||(e=r,i=t(...r)),i)};var re=function(t,e,i){return t<e?e:t>i?i:t};var oe=(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])};function ne(t,e){let i;return t>e&&(i=t,t=e,e=i),i=>Math.max(t,Math.min(e,i))}let se=!1;try{se="function"==typeof requestAnimationFrame&&"function"==typeof cancelAnimationFrame}catch(t){se=!1}function ae(t,e,i){let r,o,n,s,a,l,h=0,c=!1,d=!1,u=!0;const g=!e&&0!==e&&se;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 C(t);a=f(b,function(t){const i=t-h,r=e-(t-l);return d?Math.min(r,n-i):r}(t))}function C(t){return a=void 0,u&&r?p(t):(r=o=void 0,s)}function y(...t){const i=Date.now(),n=m(i);if(r=t,o=this,l=i,n){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,ht(i)&&(c=!!i.leading,d="maxWait"in i,d&&(n=Math.max(Ct(i.maxWait)?i.maxWait:0,e)),u="trailing"in i?!!i.trailing:u),y.cancel=function(){void 0!==a&&function(t){if(g)return cancelAnimationFrame(t);clearTimeout(t)}(a),h=0,r=l=o=a=void 0},y.flush=function(){return void 0===a?s:C(Date.now())},y.pending=function(){return void 0!==a},y}function le(t,e,i){let r=!0,o=!0;if("function"!=typeof t)throw new TypeError("Expected a function");return ht(i)&&(r="leading"in i?!!i.leading:r,o="trailing"in i?!!i.trailing:o),ae(t,e,{leading:r,trailing:o,maxWait:e})}function he(t,e){return i=>t*(1-i)+e*i}function ce(t,e){return function(i){return Math.round(t*(1-i)+e*i)}}se=!1;const de=1e-12,ue=Math.PI,ge=ue/2,pe=2*ue,fe=2*Math.PI,me=Math.abs,be=Math.atan2,Ce=Math.cos,ye=Math.max,we=Math.min,ve=Math.sin,xe=Math.sqrt,_e=Math.pow;function Se(t){return t>=1?ge:t<=-1?-ge:Math.asin(t)}function Ae(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}}function Re(t,e=10){return Math.round(t*e)/e}function Te(t){const e=t.toString().split(/[eE]/),i=(e[0].split(".")[1]||"").length-(+e[1]||0);return i>0?i:0}function Me(t,e){return Re(t+e,10**Math.max(Te(t),Te(e)))}function Be(t,e){return Re(t-e,10**Math.max(Te(t),Te(e)))}class Pe{constructor(t=0,e=0,i,r){this.x=0,this.y=0,this.x=t,this.y=e,this.x1=i,this.y1=r}clone(){return new Pe(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 bt(t)?(this.x+=t,void(this.y+=t)):(this.x+=t.x,this.y+=t.y,this)}sub(t){return bt(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 He{static distancePP(t,e){return xe(_e(t.x-e.x,2)+_e(t.y-e.y,2))}static distanceNN(t,e,i,r){return xe(_e(t-i,2)+_e(e-r,2))}static distancePN(t,e,i){return xe(_e(e-t.x,2)+_e(i-t.y,2))}static pointAtPP(t,e,i){return new Pe((e.x-t.x)*i+t.x,(e.y-t.y)*i+t.y)}}function Ee(t){return t*(Math.PI/180)}const Fe=(t=0)=>{if(t<0)for(;t<-pe;)t+=pe;else if(t>0)for(;t>pe;)t-=pe;return t};function Le(t){for(;t<0;)t+=2*Math.PI;for(;t>=2*Math.PI;)t-=2*Math.PI;return t}function ke(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}=ze(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 Ie;!function(t){t[t.NONE=0]="NONE",t[t.BBOX1=1]="BBOX1",t[t.BBOX2=2]="BBOX2"}(Ie||(Ie={}));const ze=(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 Oe(t,e,i){if(!t||!e)return Ie.NONE;const{x11:r,x12:o,y11:n,y12:s,x21:a,x22:l,y21:h,y22:c}=ze(t,e,i);return r>a&&o<l&&n>h&&s<c?Ie.BBOX1:a>r&&l<o&&h>n&&c<s?Ie.BBOX2:Ie.NONE}function De(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}=ze(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 Ne({x:t,y:e},i,r={x:0,y:0}){return{x:(t-r.x)*Math.cos(i)-(e-r.y)*Math.sin(i)+r.x,y:(t-r.x)*Math.sin(i)+(e-r.y)*Math.cos(i)+r.y}}function Ge(t){return{x:(t.x1+t.x2)/2,y:(t.y1+t.y2)/2}}function Ve(t,e){const i=e?Ee(t.angle):t.angle,r=Ge(t);return[Ne({x:t.x1,y:t.y1},i,r),Ne({x:t.x2,y:t.y1},i,r),Ne({x:t.x2,y:t.y2},i,r),Ne({x:t.x1,y:t.y2},i,r)]}function je(t,e,i=!1){const r=Ve(t,i),o=Ve(e,i),n=(t,e)=>[e.x-t.x,e.y-t.y],s=n(Ge(t),Ge(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?Ee(t.angle):t.angle;let u=i?Ee(90-t.angle):t.angle+ge;const g=i?Ee(e.angle):e.angle;let p=i?Ee(90-e.angle):e.angle+ge;u>fe&&(u-=fe),p>fe&&(p-=fe);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)}function Ue(t,e,i,r,o,n){if(n>e&&n>r||n<e&&n<r)return 0;if(r===e)return 0;const s=(n-e)/(r-e);let a=r<e?1:-1;1!==s&&0!==s||(a=r<e?.5:-.5);const l=s*(i-t)+t;return l===o?1/0:l>o?a:0}const Ke=t=>{let e=t.charCodeAt(0),i=2===t.length?t.charCodeAt(1):0,r=e;return 55296<=e&&e<=56319&&56320<=i&&i<=57343&&(e&=1023,i&=1023,r=e<<10|i,r+=65536),12288===r||65281<=r&&r<=65376||65504<=r&&r<=65510?"F":8361===r||65377<=r&&r<=65470||65474<=r&&r<=65479||65482<=r&&r<=65487||65490<=r&&r<=65495||65498<=r&&r<=65500||65512<=r&&r<=65518?"H":4352<=r&&r<=4447||4515<=r&&r<=4519||4602<=r&&r<=4607||9001<=r&&r<=9002||11904<=r&&r<=11929||11931<=r&&r<=12019||12032<=r&&r<=12245||12272<=r&&r<=12283||12289<=r&&r<=12350||12353<=r&&r<=12438||12441<=r&&r<=12543||12549<=r&&r<=12589||12593<=r&&r<=12686||12688<=r&&r<=12730||12736<=r&&r<=12771||12784<=r&&r<=12830||12832<=r&&r<=12871||12880<=r&&r<=13054||13056<=r&&r<=19903||19968<=r&&r<=42124||42128<=r&&r<=42182||43360<=r&&r<=43388||44032<=r&&r<=55203||55216<=r&&r<=55238||55243<=r&&r<=55291||63744<=r&&r<=64255||65040<=r&&r<=65049||65072<=r&&r<=65106||65108<=r&&r<=65126||65128<=r&&r<=65131||110592<=r&&r<=110593||127488<=r&&r<=127490||127504<=r&&r<=127546||127552<=r&&r<=127560||127568<=r&&r<=127569||131072<=r&&r<=194367||177984<=r&&r<=196605||196608<=r&&r<=262141?"W":32<=r&&r<=126||162<=r&&r<=163||165<=r&&r<=166||172===r||175===r||10214<=r&&r<=10221||10629<=r&&r<=10630?"Na":161===r||164===r||167<=r&&r<=168||170===r||173<=r&&r<=174||176<=r&&r<=180||182<=r&&r<=186||188<=r&&r<=191||198===r||208===r||215<=r&&r<=216||222<=r&&r<=225||230===r||232<=r&&r<=234||236<=r&&r<=237||240===r||242<=r&&r<=243||247<=r&&r<=250||252===r||254===r||257===r||273===r||275===r||283===r||294<=r&&r<=295||299===r||305<=r&&r<=307||312===r||319<=r&&r<=322||324===r||328<=r&&r<=331||333===r||338<=r&&r<=339||358<=r&&r<=359||363===r||462===r||464===r||466===r||468===r||470===r||472===r||474===r||476===r||593===r||609===r||708===r||711===r||713<=r&&r<=715||717===r||720===r||728<=r&&r<=731||733===r||735===r||768<=r&&r<=879||913<=r&&r<=929||931<=r&&r<=937||945<=r&&r<=961||963<=r&&r<=969||1025===r||1040<=r&&r<=1103||1105===r||8208===r||8211<=r&&r<=8214||8216<=r&&r<=8217||8220<=r&&r<=8221||8224<=r&&r<=8226||8228<=r&&r<=8231||8240===r||8242<=r&&r<=8243||8245===r||8251===r||8254===r||8308===r||8319===r||8321<=r&&r<=8324||8364===r||8451===r||8453===r||8457===r||8467===r||8470===r||8481<=r&&r<=8482||8486===r||8491===r||8531<=r&&r<=8532||8539<=r&&r<=8542||8544<=r&&r<=8555||8560<=r&&r<=8569||8585===r||8592<=r&&r<=8601||8632<=r&&r<=8633||8658===r||8660===r||8679===r||8704===r||8706<=r&&r<=8707||8711<=r&&r<=8712||8715===r||8719===r||8721===r||8725===r||8730===r||8733<=r&&r<=8736||8739===r||8741===r||8743<=r&&r<=8748||8750===r||8756<=r&&r<=8759||8764<=r&&r<=8765||8776===r||8780===r||8786===r||8800<=r&&r<=8801||8804<=r&&r<=8807||8810<=r&&r<=8811||8814<=r&&r<=8815||8834<=r&&r<=8835||8838<=r&&r<=8839||8853===r||8857===r||8869===r||8895===r||8978===r||9312<=r&&r<=9449||9451<=r&&r<=9547||9552<=r&&r<=9587||9600<=r&&r<=9615||9618<=r&&r<=9621||9632<=r&&r<=9633||9635<=r&&r<=9641||9650<=r&&r<=9651||9654<=r&&r<=9655||9660<=r&&r<=9661||9664<=r&&r<=9665||9670<=r&&r<=9672||9675===r||9678<=r&&r<=9681||9698<=r&&r<=9701||9711===r||9733<=r&&r<=9734||9737===r||9742<=r&&r<=9743||9748<=r&&r<=9749||9756===r||9758===r||9792===r||9794===r||9824<=r&&r<=9825||9827<=r&&r<=9829||9831<=r&&r<=9834||9836<=r&&r<=9837||9839===r||9886<=r&&r<=9887||9918<=r&&r<=9919||9924<=r&&r<=9933||9935<=r&&r<=9953||9955===r||9960<=r&&r<=9983||10045===r||10071===r||10102<=r&&r<=10111||11093<=r&&r<=11097||12872<=r&&r<=12879||57344<=r&&r<=63743||65024<=r&&r<=65039||65533===r||127232<=r&&r<=127242||127248<=r&&r<=127277||127280<=r&&r<=127337||127344<=r&&r<=127386||917760<=r&&r<=917999||983040<=r&&r<=1048573||1048576<=r&&r<=1114109?"A":"N"};function $e(t,e={},i){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 Xe{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(),lt(t.specialCharSet)&&(this.specialCharSet=t.specialCharSet),this._standardMethod=lt(t.getTextBounds)?this.fullMeasure.bind(this):this.measureWithNaiveCanvas.bind(this)}initContext(){if(this._notSupportCanvas)return!1;if(at(this._canvas)&&(lt(this._option.getCanvasForMeasure)&&(this._canvas=this._option.getCanvasForMeasure()),at(this._canvas)&&"undefined"!=typeof window&&void 0!==window.document&&globalThis&&lt(globalThis.document)&&(this._canvas=globalThis.document.createElement("canvas"))),at(this._context)&&lt(this._canvas)){const t=this._canvas.getContext("2d");lt(t)&&(t.save(),t.font=$e(this.textSpec),this._contextSaved=!0,this._context=t)}return!at(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(gt(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(at(t))return{width:0,height:0};if(at(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);at(o)&&Xe.NUMBERS_CHAR_SET.includes(r)&&(o=this._measureNumberChar()),at(o)&&["F","W"].includes(Ke(r))&&(o=this._measureFullSizeChar()),at(o)&&(o=this._measureLetterChar()),e.width+=o.width,e.height=Math.max(e.height,o.height),!at(o.fontBoundingBoxAscent)&&(e.fontBoundingBoxAscent=o.fontBoundingBoxAscent),!at(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(Ke(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(at(t))return n;if(pt(t)){const s=t.filter(lt).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(at(this._numberCharSize)){const t=this._standardMethod(Xe.NUMBERS_CHAR_SET);this._numberCharSize={width:t.width/Xe.NUMBERS_CHAR_SET.length,height:t.height,fontBoundingBoxAscent:t.fontBoundingBoxAscent,fontBoundingBoxDescent:t.fontBoundingBoxDescent}}return this._numberCharSize}_measureFullSizeChar(){return at(this._fullCharSize)&&(this._fullCharSize=this._standardMethod(Xe.FULL_SIZE_CHAR)),this._fullCharSize}_measureLetterChar(){if(at(this._letterCharSize)){const t=this._standardMethod(Xe.ALPHABET_CHAR_SET);this._letterCharSize={width:t.width/Xe.ALPHABET_CHAR_SET.length,height:t.height,fontBoundingBoxAscent:t.fontBoundingBoxAscent,fontBoundingBoxDescent:t.fontBoundingBoxDescent}}return this._letterCharSize}_measureSpecialChar(t){return lt(this._specialCharSizeMap[t])?this._specialCharSizeMap[t]:this.specialCharSet.includes(t)?(this._specialCharSizeMap[t]=this._standardMethod(t),this._specialCharSizeMap[t]):null}release(){lt(this._canvas)&&(this._canvas=null),lt(this._context)&&(this._contextSaved&&(this._context.restore(),this._contextSaved=!1),this._context=null)}}Xe.ALPHABET_CHAR_SET="abcdefghijklmnopqrstuvwxyz",Xe.NUMBERS_CHAR_SET="0123456789",Xe.FULL_SIZE_CHAR="字";const Ye=(t,e)=>Math.max(e.x1-t.x2,t.x1-e.x2,e.y1-t.y2,t.y1-e.y2),qe=(t,e)=>{const i=[{x:Math.cos(t.angle),y:Math.sin(t.angle)},{x:-Math.sin(t.angle),y:Math.cos(t.angle)},{x:Math.cos(e.angle),y:Math.sin(t.angle)},{x:-Math.sin(e.angle),y:Math.cos(t.angle)}];function r(t,e,i){const r=t.getRotatedCorners().map((t=>t.x*e+t.y*i));return{min:Math.min(...r),max:Math.max(...r)}}let o=0;for(const n of i){const i=r(t,n.x,n.y),s=r(e,n.x,n.y);let a;a=i.max<s.min?s.min-i.max:s.max<i.min?i.min-s.max:0,o=Math.max(o,a)}return o};function Ze(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)}class Je{constructor(t){t?this.setValue(t.x1,t.y1,t.x2,t.y2):this.clear()}clone(){return new Je(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,i=0,r=0){return this.x1=t,this.y1=e,this.x2=i,this.y2=r,this}set(t=0,e=0,i=0,r=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(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 pt(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,i=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(t=0,e=0,i=0,r=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(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 Ze(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 Qe extends Je{}class ti extends Je{constructor(t,e=0){var i;super(t),t&&(this.angle=null!==(i=t.angle)&&void 0!==i?i:e)}intersects(t){return je(this,t)}setValue(t=0,e=0,i=0,r=0,o=0){return super.setValue(t,e,i,r),this.angle=o,this}clone(){return new ti(this)}getRotatedCorners(){const t={x:(this.x1+this.x2)/2,y:(this.y1+this.y2)/2};return[Ne({x:this.x1,y:this.y1},this.angle,t),Ne({x:this.x2,y:this.y1},this.angle,t),Ne({x:this.x1,y:this.y2},this.angle,t),Ne({x:this.x2,y:this.y2},this.angle,t)]}}class ei{constructor(t=1,e=0,i=0,r=1,o=0,n=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 ei,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.m