@visactor/vrender-kits 0.16.17 → 0.16.18-alpha.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -21,6 +21,7 @@ export declare class Gesture extends EventEmitter {
21
21
  private config;
22
22
  private tapCount;
23
23
  private lastTapTime;
24
+ private lastTapTarget;
24
25
  constructor(element: IEventTarget, config?: GestureConfig);
25
26
  initEvents(): void;
26
27
  removeEvents(): void;
@@ -28,7 +28,7 @@ class Gesture extends vutils_1.EventEmitter {
28
28
  constructor(element, config = {}) {
29
29
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
30
30
  super(), this.cachedEvents = [], this.startPoints = [], this.processEvent = {},
31
- this.throttleTimer = 0, this.emitThrottles = [], this.onStart = ev => {
31
+ this.throttleTimer = 0, this.emitThrottles = [], this.lastTapTarget = null, this.onStart = ev => {
32
32
  this.reset(), this.startTime = vrender_core_1.clock.now();
33
33
  const {cachedEvents: cachedEvents, startPoints: startPoints} = this;
34
34
  ev && cachedEvents.push(ev.clone()), startPoints.length = cachedEvents.length;
@@ -90,8 +90,8 @@ class Gesture extends vutils_1.EventEmitter {
90
90
  endEvent.direction = calcDirection(prevMovePoint, lastMovePoint), this.triggerEvent("swipe", endEvent));
91
91
  }
92
92
  }
93
- now - this.lastTapTime < this.config.tap.interval ? this.tapCount++ : this.tapCount = 1,
94
- this.lastTapTime = now, 1 === this.tapCount ? this.triggerEvent("tap", endEvent) : 2 === this.tapCount && (this.triggerEvent("doubletap", endEvent),
93
+ now - this.lastTapTime < this.config.tap.interval && ev.target === this.lastTapTarget ? this.tapCount++ : this.tapCount = 1,
94
+ this.lastTapTime = now, this.lastTapTarget = ev.target, 1 === this.tapCount ? this.triggerEvent("tap", endEvent) : 2 === this.tapCount && (this.triggerEvent("doubletap", endEvent),
95
95
  this.tapCount = 0);
96
96
  }
97
97
  for (let i = 0, len = cachedEvents.length; i < len; i++) if (cachedEvents[i].pointerId === endEvent.pointerId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AAC,OAAO,CAAC;QACxD,MAAM,SAAS,GAAG,MAAM,CAAC,uBAAQ,CAAC,CAAC;QACnC,IAAI,SAAS,EAAE;YACb,IAAI,IAAI,IAAI,SAAS,EAAE;gBACrB,SAAS,CAAC,EAAE,CAAC,IAAI,CAAC,SAAS,CAAC,OAAO,EAAE,CAAC,EAAE,IAAI,CAAC,CAAC;aAC/C;iBAAM;gBACL,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,SAAS,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,6BAA6B,EAAE,CAAC,EAAE,EAAE;oBACpF,SAAS,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,OAAO,EAAE,CAAC,EAAE,IAAI,CAAC,CAAC;iBACrD;aACF;SACF;QAED,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC;IACrB,CAAC;CACF;AAzVD,0BAyVC","file":"gesture.js","sourcesContent":["import { application, clock, WILDCARD } from '@visactor/vrender-core';\nimport type { IEventTarget, IFederatedPointerEvent, FederatedPointerEvent, INode } from '@visactor/vrender-core';\nimport type { IPointLike } from '@visactor/vutils';\nimport { EventEmitter } from '@visactor/vutils';\n\nimport type { DefaultGestureConfig, EmitEventObject, GestureConfig, GestureDirection, GestureEvent } from './interface';\n\n/**\n * 代码参考 https://github.com/hammerjs/hammer.js\n * The MIT License (MIT)\n\n Copyright (C) 2011-2017 by Jorik Tangelder (Eight Media)\n\n Permission is hereby granted, free of charge, to any person obtaining a copy\n of this software and associated documentation files (the \"Software\"), to deal\n in the Software without restriction, including without limitation the rights\n to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n copies of the Software, and to permit persons to whom the Software is\n furnished to do so, subject to the following conditions:\n\n The above copyright notice and this permission notice shall be included in\n all copies or substantial portions of the Software.\n\n THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n THE SOFTWARE.\n */\n\nconst PRESS_TIME = 251;\nconst PRESS_THRESHOLD = 9;\nconst SWIPE_VELOCITY = 0.3;\nconst SWIPE_THRESHOLD = 10;\nconst TAP_INTERVAL = 300;\n\nconst calcDirection = (start: IPointLike, end: IPointLike) => {\n const xDistance = end.x - start.x;\n const yDistance = end.y - start.y;\n if (Math.abs(xDistance) > Math.abs(yDistance)) {\n return xDistance > 0 ? 'right' : 'left';\n }\n return yDistance > 0 ? 'down' : 'up';\n};\n\n// 计算2点之间的距离\nconst calcDistance = (point1: IPointLike, point2: IPointLike) => {\n const xDistance = Math.abs(point2.x - point1.x);\n const yDistance = Math.abs(point2.y - point1.y);\n return Math.sqrt(xDistance * xDistance + yDistance * yDistance);\n};\n\nconst getCenter = (points: IPointLike[]) => {\n const pointersLength = points.length;\n\n if (pointersLength === 1) {\n return {\n x: Math.round(points[0].x),\n y: Math.round(points[0].y)\n };\n }\n\n let x = 0;\n let y = 0;\n let i = 0;\n while (i < pointersLength) {\n x += points[i].x;\n y += points[i].y;\n i++;\n }\n\n return {\n x: Math.round(x / pointersLength),\n y: Math.round(y / pointersLength)\n };\n};\n\nexport class Gesture extends EventEmitter {\n element: INode | null;\n\n private cachedEvents: IFederatedPointerEvent[] = [];\n private startTime: number;\n // @ts-ignore\n // eslint-disable-next-line no-undef\n private pressTimeout: NodeJS.Timeout | null;\n private startPoints: IPointLike[] = [];\n // 用来记录当前触发的事件\n private processEvent: Record<string, boolean> = {};\n private startDistance: number;\n private center: IPointLike;\n private eventType: string | null;\n private direction: GestureDirection | null;\n\n private lastMoveTime: number;\n private prevMoveTime: number;\n\n private prevMovePoint: IPointLike | null;\n private lastMovePoint: IPointLike | null;\n\n private throttleTimer: number = 0;\n private emitThrottles: EmitEventObject[] = [];\n\n private config: DefaultGestureConfig;\n\n private tapCount;\n private lastTapTime;\n\n constructor(element: IEventTarget, config: GestureConfig = {}) {\n super();\n this.element = element;\n this.tapCount = 0;\n this.lastTapTime = 0;\n this.config = {\n press: {\n time: config?.press?.time ?? PRESS_TIME,\n threshold: config?.press?.threshold ?? PRESS_THRESHOLD\n },\n swipe: {\n threshold: config?.swipe?.threshold ?? SWIPE_THRESHOLD,\n velocity: config?.swipe?.velocity ?? SWIPE_VELOCITY\n },\n tap: {\n interval: config?.tap?.interval ?? TAP_INTERVAL\n }\n };\n this.initEvents();\n }\n\n initEvents() {\n const { element } = this;\n if (!element) {\n return;\n }\n\n element.addEventListener('pointerdown', this.onStart);\n element.addEventListener('pointermove', this.onMove);\n element.addEventListener('pointerup', this.onEnd);\n element.addEventListener('pointerupoutside', this.onEnd);\n }\n\n removeEvents() {\n const { element } = this;\n if (!element) {\n return;\n }\n element.removeEventListener('pointerdown', this.onStart);\n element.removeEventListener('pointermove', this.onMove);\n element.removeEventListener('pointerup', this.onEnd);\n element.removeEventListener('pointerupoutside', this.onEnd);\n }\n\n release() {\n this.removeEvents();\n this.element = null;\n }\n\n private onStart = (ev?: FederatedPointerEvent) => {\n this.reset();\n\n this.startTime = clock.now();\n\n const { cachedEvents, startPoints } = this;\n\n if (ev) {\n cachedEvents.push(ev.clone());\n }\n // 重置 startPoints\n startPoints.length = cachedEvents.length;\n for (let i = 0; i < cachedEvents.length; i++) {\n const { x, y } = cachedEvents[i];\n const point = { x, y };\n startPoints[i] = point;\n }\n\n if (startPoints.length === 1) {\n const event = cachedEvents[0] as unknown as GestureEvent;\n this.pressTimeout = setTimeout(() => {\n const eventType = 'press';\n const direction = 'none';\n event.direction = direction;\n event.deltaX = 0;\n event.deltaY = 0;\n event.points = startPoints;\n this.triggerStartEvent(eventType, event);\n this.triggerEvent(eventType, event);\n this.eventType = eventType;\n this.direction = direction;\n }, this.config.press.time);\n return;\n }\n\n this.startDistance = calcDistance(startPoints[0], startPoints[1]);\n this.center = getCenter([startPoints[0], startPoints[1]]);\n };\n\n private onMove = (ev: FederatedPointerEvent) => {\n this.clearPressTimeout();\n const { startPoints, cachedEvents } = this;\n if (!startPoints.length) {\n return;\n }\n\n const moveEvent = ev.clone() as unknown as GestureEvent;\n const { x, y, pointerId } = moveEvent;\n for (let i = 0, len = cachedEvents.length; i < len; i++) {\n if (pointerId === cachedEvents[i].pointerId) {\n cachedEvents[i] = moveEvent;\n break;\n }\n }\n const point = { x, y };\n const points = cachedEvents.map(cachedEvent => ({ x: cachedEvent.x, y: cachedEvent.y }));\n\n const now = clock.now();\n this.prevMoveTime = this.lastMoveTime;\n this.prevMovePoint = this.lastMovePoint;\n this.lastMoveTime = now;\n this.lastMovePoint = point;\n\n if (startPoints.length === 1) {\n const startPoint = startPoints[0];\n const deltaX = x - startPoint.x;\n const deltaY = y - startPoint.y;\n const direction = this.direction || calcDirection(startPoint, point);\n this.direction = direction;\n\n const eventType = this.getEventType(point);\n moveEvent.direction = direction;\n moveEvent.deltaX = deltaX;\n moveEvent.deltaY = deltaY;\n moveEvent.points = points;\n this.triggerStartEvent(eventType, moveEvent);\n this.triggerEvent(eventType, moveEvent);\n return;\n }\n\n const { startDistance } = this;\n const currentDistance = calcDistance(points[0], points[1]);\n\n // 缩放比例\n moveEvent.scale = currentDistance / startDistance;\n moveEvent.center = this.center;\n moveEvent.points = points;\n this.triggerStartEvent('pinch', moveEvent);\n this.triggerEvent('pinch', moveEvent);\n };\n\n private onEnd = (ev: FederatedPointerEvent) => {\n const endEvent = ev.clone() as unknown as GestureEvent;\n const { cachedEvents, startPoints } = this;\n const points = cachedEvents.map(ev => {\n return { x: ev.x, y: ev.y };\n });\n endEvent.points = points;\n this.triggerEndEvent(endEvent);\n\n if (cachedEvents.length === 1) {\n const now = clock.now();\n const lastMoveTime = this.lastMoveTime;\n // 做这个判断是为了最后一次touchmove后到end前,是否还有一个停顿的过程\n // 100 是拍的一个值,理论这个值会很短,一般不卡顿的话在10ms以内\n if (now - lastMoveTime < 100) {\n const prevMoveTime = this.prevMoveTime || this.startTime;\n const intervalTime = lastMoveTime - prevMoveTime;\n // 时间间隔一定要大于0, 否则计算没意义\n if (intervalTime > 0) {\n const prevMovePoint = this.prevMovePoint || startPoints[0];\n const lastMovePoint = this.lastMovePoint || startPoints[0];\n const distance = calcDistance(prevMovePoint, lastMovePoint);\n // move速率\n const velocity = distance / intervalTime;\n // 0.3 是参考hammerjs的设置\n if (velocity > this.config.swipe.velocity && distance > this.config.swipe.threshold) {\n endEvent.velocity = velocity;\n endEvent.direction = calcDirection(prevMovePoint, lastMovePoint);\n this.triggerEvent('swipe', endEvent);\n }\n }\n }\n\n if (now - this.lastTapTime < this.config.tap.interval) {\n this.tapCount++;\n } else {\n this.tapCount = 1;\n }\n this.lastTapTime = now;\n\n if (this.tapCount === 1) {\n this.triggerEvent('tap', endEvent);\n } else if (this.tapCount === 2) {\n this.triggerEvent('doubletap', endEvent);\n this.tapCount = 0; // reset tapCount after doubletap\n }\n }\n\n for (let i = 0, len = cachedEvents.length; i < len; i++) {\n if (cachedEvents[i].pointerId === endEvent.pointerId) {\n cachedEvents.splice(i, 1);\n startPoints.splice(i, 1);\n break;\n }\n }\n\n this.reset();\n\n // 多指离开 1 指后,重新触发一次start\n if (cachedEvents.length > 0) {\n this.onStart();\n }\n };\n\n private getEventType(point: IPointLike) {\n const { eventType, startTime, startPoints } = this;\n if (eventType) {\n return eventType;\n }\n let type;\n const now = clock.now();\n if (now - startTime > this.config.press.time && calcDistance(startPoints[0], point) < this.config.press.threshold) {\n type = 'press';\n } else {\n type = 'pan';\n }\n this.eventType = type;\n return type;\n }\n\n private enable(eventType: string) {\n this.processEvent[eventType] = true;\n }\n\n // 是否进行中的事件\n private isProcess(eventType: string) {\n return this.processEvent[eventType];\n }\n\n private pushEvent(type: string, ev: GestureEvent) {\n const { emitThrottles } = this;\n const newEvent = { type, ev };\n for (let i = 0, len = emitThrottles.length; i < len; i++) {\n if (emitThrottles[i].type === type) {\n emitThrottles.splice(i, 1, newEvent);\n return;\n }\n }\n emitThrottles.push(newEvent);\n }\n\n private clearPressTimeout() {\n if (this.pressTimeout) {\n clearTimeout(this.pressTimeout);\n this.pressTimeout = null;\n }\n }\n\n private reset() {\n this.clearPressTimeout();\n this.startTime = 0;\n this.startDistance = 0;\n this.direction = null;\n this.eventType = null;\n this.prevMoveTime = 0;\n this.prevMovePoint = null;\n this.lastMoveTime = 0;\n this.lastMovePoint = null;\n }\n\n private triggerEvent(type: string, ev: GestureEvent) {\n // 主要是节流处理\n this.pushEvent(type, ev);\n const { throttleTimer, emitThrottles } = this;\n if (throttleTimer) {\n return;\n }\n\n this.throttleTimer = application.global.getRequestAnimationFrame()(() => {\n for (let i = 0, len = emitThrottles.length; i < len; i++) {\n const { type, ev } = emitThrottles[i];\n this.emitEvent(type, ev);\n }\n // 清空\n this.throttleTimer = 0;\n this.emitThrottles.length = 0;\n });\n }\n\n // 触发start事件\n private triggerStartEvent(type: string, ev: GestureEvent) {\n if (this.isProcess(type)) {\n return;\n }\n this.enable(type);\n this.triggerEvent(`${type}start`, ev);\n }\n\n private triggerEndEvent(ev: GestureEvent) {\n const processEvent = this.processEvent;\n Object.keys(processEvent).forEach(type => {\n this.triggerEvent(`${type}end`, ev);\n if (type === 'press') {\n // pressend 别名,pressup\n this.triggerEvent(`${type}up`, ev);\n }\n delete processEvent[type];\n });\n }\n\n private emitEvent(type: string, e: GestureEvent) {\n const events = (this.element as unknown as any)._events;\n const listeners = events[WILDCARD];\n if (listeners) {\n if ('fn' in listeners) {\n listeners.fn.call(listeners.context, e, type);\n } else {\n for (let i = 0, j = listeners.length; i < j && !e.propagationImmediatelyStopped; i++) {\n listeners[i].fn.call(listeners[i].context, e, type);\n }\n }\n }\n\n this.emit(type, e);\n }\n}\n"]}
1
+ {"version":3,"sources":["../src/event/extension/gesture.ts"],"names":[],"mappings":";;;AAAA,yDAAsE;AAGtE,6CAAgD;AA6BhD,MAAM,UAAU,GAAG,GAAG,CAAC;AACvB,MAAM,eAAe,GAAG,CAAC,CAAC;AAC1B,MAAM,cAAc,GAAG,GAAG,CAAC;AAC3B,MAAM,eAAe,GAAG,EAAE,CAAC;AAC3B,MAAM,YAAY,GAAG,GAAG,CAAC;AAEzB,MAAM,aAAa,GAAG,CAAC,KAAiB,EAAE,GAAe,EAAE,EAAE;IAC3D,MAAM,SAAS,GAAG,GAAG,CAAC,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC;IAClC,MAAM,SAAS,GAAG,GAAG,CAAC,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC;IAClC,IAAI,IAAI,CAAC,GAAG,CAAC,SAAS,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,SAAS,CAAC,EAAE;QAC7C,OAAO,SAAS,GAAG,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC;KACzC;IACD,OAAO,SAAS,GAAG,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC;AACvC,CAAC,CAAC;AAGF,MAAM,YAAY,GAAG,CAAC,MAAkB,EAAE,MAAkB,EAAE,EAAE;IAC9D,MAAM,SAAS,GAAG,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC;IAChD,MAAM,SAAS,GAAG,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC;IAChD,OAAO,IAAI,CAAC,IAAI,CAAC,SAAS,GAAG,SAAS,GAAG,SAAS,GAAG,SAAS,CAAC,CAAC;AAClE,CAAC,CAAC;AAEF,M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,IAAI,IAAI,EAAE,EAAE,CAAC,CAAC;aACpC;YACD,OAAO,YAAY,CAAC,IAAI,CAAC,CAAC;QAC5B,CAAC,CAAC,CAAC;IACL,CAAC;IAEO,SAAS,CAAC,IAAY,EAAE,CAAe;QAC7C,MAAM,MAAM,GAAI,IAAI,CAAC,OAA0B,CAAC,OAAO,CAAC;QACxD,MAAM,SAAS,GAAG,MAAM,CAAC,uBAAQ,CAAC,CAAC;QACnC,IAAI,SAAS,EAAE;YACb,IAAI,IAAI,IAAI,SAAS,EAAE;gBACrB,SAAS,CAAC,EAAE,CAAC,IAAI,CAAC,SAAS,CAAC,OAAO,EAAE,CAAC,EAAE,IAAI,CAAC,CAAC;aAC/C;iBAAM;gBACL,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,SAAS,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,6BAA6B,EAAE,CAAC,EAAE,EAAE;oBACpF,SAAS,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,OAAO,EAAE,CAAC,EAAE,IAAI,CAAC,CAAC;iBACrD;aACF;SACF;QAED,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC;IACrB,CAAC;CACF;AA3VD,0BA2VC","file":"gesture.js","sourcesContent":["import { application, clock, WILDCARD } from '@visactor/vrender-core';\nimport type { IEventTarget, IFederatedPointerEvent, FederatedPointerEvent, INode } from '@visactor/vrender-core';\nimport type { IPointLike } from '@visactor/vutils';\nimport { EventEmitter } from '@visactor/vutils';\n\nimport type { DefaultGestureConfig, EmitEventObject, GestureConfig, GestureDirection, GestureEvent } from './interface';\n\n/**\n * 代码参考 https://github.com/hammerjs/hammer.js\n * The MIT License (MIT)\n\n Copyright (C) 2011-2017 by Jorik Tangelder (Eight Media)\n\n Permission is hereby granted, free of charge, to any person obtaining a copy\n of this software and associated documentation files (the \"Software\"), to deal\n in the Software without restriction, including without limitation the rights\n to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n copies of the Software, and to permit persons to whom the Software is\n furnished to do so, subject to the following conditions:\n\n The above copyright notice and this permission notice shall be included in\n all copies or substantial portions of the Software.\n\n THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n THE SOFTWARE.\n */\n\nconst PRESS_TIME = 251;\nconst PRESS_THRESHOLD = 9;\nconst SWIPE_VELOCITY = 0.3;\nconst SWIPE_THRESHOLD = 10;\nconst TAP_INTERVAL = 300;\n\nconst calcDirection = (start: IPointLike, end: IPointLike) => {\n const xDistance = end.x - start.x;\n const yDistance = end.y - start.y;\n if (Math.abs(xDistance) > Math.abs(yDistance)) {\n return xDistance > 0 ? 'right' : 'left';\n }\n return yDistance > 0 ? 'down' : 'up';\n};\n\n// 计算2点之间的距离\nconst calcDistance = (point1: IPointLike, point2: IPointLike) => {\n const xDistance = Math.abs(point2.x - point1.x);\n const yDistance = Math.abs(point2.y - point1.y);\n return Math.sqrt(xDistance * xDistance + yDistance * yDistance);\n};\n\nconst getCenter = (points: IPointLike[]) => {\n const pointersLength = points.length;\n\n if (pointersLength === 1) {\n return {\n x: Math.round(points[0].x),\n y: Math.round(points[0].y)\n };\n }\n\n let x = 0;\n let y = 0;\n let i = 0;\n while (i < pointersLength) {\n x += points[i].x;\n y += points[i].y;\n i++;\n }\n\n return {\n x: Math.round(x / pointersLength),\n y: Math.round(y / pointersLength)\n };\n};\n\nexport class Gesture extends EventEmitter {\n element: INode | null;\n\n private cachedEvents: IFederatedPointerEvent[] = [];\n private startTime: number;\n // @ts-ignore\n // eslint-disable-next-line no-undef\n private pressTimeout: NodeJS.Timeout | null;\n private startPoints: IPointLike[] = [];\n // 用来记录当前触发的事件\n private processEvent: Record<string, boolean> = {};\n private startDistance: number;\n private center: IPointLike;\n private eventType: string | null;\n private direction: GestureDirection | null;\n\n private lastMoveTime: number;\n private prevMoveTime: number;\n\n private prevMovePoint: IPointLike | null;\n private lastMovePoint: IPointLike | null;\n\n private throttleTimer: number = 0;\n private emitThrottles: EmitEventObject[] = [];\n\n private config: DefaultGestureConfig;\n\n private tapCount;\n private lastTapTime;\n private lastTapTarget: IEventTarget | null = null;\n\n constructor(element: IEventTarget, config: GestureConfig = {}) {\n super();\n this.element = element;\n this.tapCount = 0;\n this.lastTapTime = 0;\n this.config = {\n press: {\n time: config?.press?.time ?? PRESS_TIME,\n threshold: config?.press?.threshold ?? PRESS_THRESHOLD\n },\n swipe: {\n threshold: config?.swipe?.threshold ?? SWIPE_THRESHOLD,\n velocity: config?.swipe?.velocity ?? SWIPE_VELOCITY\n },\n tap: {\n interval: config?.tap?.interval ?? TAP_INTERVAL\n }\n };\n this.initEvents();\n }\n\n initEvents() {\n const { element } = this;\n if (!element) {\n return;\n }\n\n element.addEventListener('pointerdown', this.onStart);\n element.addEventListener('pointermove', this.onMove);\n element.addEventListener('pointerup', this.onEnd);\n element.addEventListener('pointerupoutside', this.onEnd);\n }\n\n removeEvents() {\n const { element } = this;\n if (!element) {\n return;\n }\n element.removeEventListener('pointerdown', this.onStart);\n element.removeEventListener('pointermove', this.onMove);\n element.removeEventListener('pointerup', this.onEnd);\n element.removeEventListener('pointerupoutside', this.onEnd);\n }\n\n release() {\n this.removeEvents();\n this.element = null;\n }\n\n private onStart = (ev?: FederatedPointerEvent) => {\n this.reset();\n\n this.startTime = clock.now();\n\n const { cachedEvents, startPoints } = this;\n\n if (ev) {\n cachedEvents.push(ev.clone());\n }\n // 重置 startPoints\n startPoints.length = cachedEvents.length;\n for (let i = 0; i < cachedEvents.length; i++) {\n const { x, y } = cachedEvents[i];\n const point = { x, y };\n startPoints[i] = point;\n }\n\n if (startPoints.length === 1) {\n const event = cachedEvents[0] as unknown as GestureEvent;\n this.pressTimeout = setTimeout(() => {\n const eventType = 'press';\n const direction = 'none';\n event.direction = direction;\n event.deltaX = 0;\n event.deltaY = 0;\n event.points = startPoints;\n this.triggerStartEvent(eventType, event);\n this.triggerEvent(eventType, event);\n this.eventType = eventType;\n this.direction = direction;\n }, this.config.press.time);\n return;\n }\n\n this.startDistance = calcDistance(startPoints[0], startPoints[1]);\n this.center = getCenter([startPoints[0], startPoints[1]]);\n };\n\n private onMove = (ev: FederatedPointerEvent) => {\n this.clearPressTimeout();\n const { startPoints, cachedEvents } = this;\n if (!startPoints.length) {\n return;\n }\n\n const moveEvent = ev.clone() as unknown as GestureEvent;\n const { x, y, pointerId } = moveEvent;\n for (let i = 0, len = cachedEvents.length; i < len; i++) {\n if (pointerId === cachedEvents[i].pointerId) {\n cachedEvents[i] = moveEvent;\n break;\n }\n }\n const point = { x, y };\n const points = cachedEvents.map(cachedEvent => ({ x: cachedEvent.x, y: cachedEvent.y }));\n\n const now = clock.now();\n this.prevMoveTime = this.lastMoveTime;\n this.prevMovePoint = this.lastMovePoint;\n this.lastMoveTime = now;\n this.lastMovePoint = point;\n\n if (startPoints.length === 1) {\n const startPoint = startPoints[0];\n const deltaX = x - startPoint.x;\n const deltaY = y - startPoint.y;\n const direction = this.direction || calcDirection(startPoint, point);\n this.direction = direction;\n\n const eventType = this.getEventType(point);\n moveEvent.direction = direction;\n moveEvent.deltaX = deltaX;\n moveEvent.deltaY = deltaY;\n moveEvent.points = points;\n this.triggerStartEvent(eventType, moveEvent);\n this.triggerEvent(eventType, moveEvent);\n return;\n }\n\n const { startDistance } = this;\n const currentDistance = calcDistance(points[0], points[1]);\n\n // 缩放比例\n moveEvent.scale = currentDistance / startDistance;\n moveEvent.center = this.center;\n moveEvent.points = points;\n this.triggerStartEvent('pinch', moveEvent);\n this.triggerEvent('pinch', moveEvent);\n };\n\n private onEnd = (ev: FederatedPointerEvent) => {\n const endEvent = ev.clone() as unknown as GestureEvent;\n const { cachedEvents, startPoints } = this;\n const points = cachedEvents.map(ev => {\n return { x: ev.x, y: ev.y };\n });\n endEvent.points = points;\n this.triggerEndEvent(endEvent);\n\n if (cachedEvents.length === 1) {\n const now = clock.now();\n const lastMoveTime = this.lastMoveTime;\n // 做这个判断是为了最后一次touchmove后到end前,是否还有一个停顿的过程\n // 100 是拍的一个值,理论这个值会很短,一般不卡顿的话在10ms以内\n if (now - lastMoveTime < 100) {\n const prevMoveTime = this.prevMoveTime || this.startTime;\n const intervalTime = lastMoveTime - prevMoveTime;\n // 时间间隔一定要大于0, 否则计算没意义\n if (intervalTime > 0) {\n const prevMovePoint = this.prevMovePoint || startPoints[0];\n const lastMovePoint = this.lastMovePoint || startPoints[0];\n const distance = calcDistance(prevMovePoint, lastMovePoint);\n // move速率\n const velocity = distance / intervalTime;\n // 0.3 是参考hammerjs的设置\n if (velocity > this.config.swipe.velocity && distance > this.config.swipe.threshold) {\n endEvent.velocity = velocity;\n endEvent.direction = calcDirection(prevMovePoint, lastMovePoint);\n this.triggerEvent('swipe', endEvent);\n }\n }\n }\n\n if (now - this.lastTapTime < this.config.tap.interval && ev.target === this.lastTapTarget) {\n this.tapCount++;\n } else {\n this.tapCount = 1;\n }\n this.lastTapTime = now;\n this.lastTapTarget = ev.target;\n\n if (this.tapCount === 1) {\n this.triggerEvent('tap', endEvent);\n } else if (this.tapCount === 2) {\n this.triggerEvent('doubletap', endEvent);\n this.tapCount = 0; // reset tapCount after doubletap\n }\n }\n\n for (let i = 0, len = cachedEvents.length; i < len; i++) {\n if (cachedEvents[i].pointerId === endEvent.pointerId) {\n cachedEvents.splice(i, 1);\n startPoints.splice(i, 1);\n break;\n }\n }\n\n this.reset();\n\n // 多指离开 1 指后,重新触发一次start\n if (cachedEvents.length > 0) {\n this.onStart();\n }\n };\n\n private getEventType(point: IPointLike) {\n const { eventType, startTime, startPoints } = this;\n if (eventType) {\n return eventType;\n }\n let type;\n const now = clock.now();\n if (now - startTime > this.config.press.time && calcDistance(startPoints[0], point) < this.config.press.threshold) {\n type = 'press';\n } else {\n type = 'pan';\n }\n this.eventType = type;\n return type;\n }\n\n private enable(eventType: string) {\n this.processEvent[eventType] = true;\n }\n\n // 是否进行中的事件\n private isProcess(eventType: string) {\n return this.processEvent[eventType];\n }\n\n private pushEvent(type: string, ev: GestureEvent) {\n const { emitThrottles } = this;\n const newEvent = { type, ev };\n for (let i = 0, len = emitThrottles.length; i < len; i++) {\n if (emitThrottles[i].type === type) {\n emitThrottles.splice(i, 1, newEvent);\n return;\n }\n }\n emitThrottles.push(newEvent);\n }\n\n private clearPressTimeout() {\n if (this.pressTimeout) {\n clearTimeout(this.pressTimeout);\n this.pressTimeout = null;\n }\n }\n\n private reset() {\n this.clearPressTimeout();\n this.startTime = 0;\n this.startDistance = 0;\n this.direction = null;\n this.eventType = null;\n this.prevMoveTime = 0;\n this.prevMovePoint = null;\n this.lastMoveTime = 0;\n this.lastMovePoint = null;\n }\n\n private triggerEvent(type: string, ev: GestureEvent) {\n // 主要是节流处理\n this.pushEvent(type, ev);\n const { throttleTimer, emitThrottles } = this;\n if (throttleTimer) {\n return;\n }\n\n this.throttleTimer = application.global.getRequestAnimationFrame()(() => {\n for (let i = 0, len = emitThrottles.length; i < len; i++) {\n const { type, ev } = emitThrottles[i];\n this.emitEvent(type, ev);\n }\n // 清空\n this.throttleTimer = 0;\n this.emitThrottles.length = 0;\n });\n }\n\n // 触发start事件\n private triggerStartEvent(type: string, ev: GestureEvent) {\n if (this.isProcess(type)) {\n return;\n }\n this.enable(type);\n this.triggerEvent(`${type}start`, ev);\n }\n\n private triggerEndEvent(ev: GestureEvent) {\n const processEvent = this.processEvent;\n Object.keys(processEvent).forEach(type => {\n this.triggerEvent(`${type}end`, ev);\n if (type === 'press') {\n // pressend 别名,pressup\n this.triggerEvent(`${type}up`, ev);\n }\n delete processEvent[type];\n });\n }\n\n private emitEvent(type: string, e: GestureEvent) {\n const events = (this.element as unknown as any)._events;\n const listeners = events[WILDCARD];\n if (listeners) {\n if ('fn' in listeners) {\n listeners.fn.call(listeners.context, e, type);\n } else {\n for (let i = 0, j = listeners.length; i < j && !e.propagationImmediatelyStopped; i++) {\n listeners[i].fn.call(listeners[i].context, e, type);\n }\n }\n }\n\n this.emit(type, e);\n }\n}\n"]}
package/dist/index.js CHANGED
@@ -2896,6 +2896,7 @@
2896
2896
  this.processEvent = {};
2897
2897
  this.throttleTimer = 0;
2898
2898
  this.emitThrottles = [];
2899
+ this.lastTapTarget = null;
2899
2900
  this.onStart = (ev) => {
2900
2901
  this.reset();
2901
2902
  this.startTime = vrenderCore.clock.now();
@@ -2998,13 +2999,14 @@
2998
2999
  }
2999
3000
  }
3000
3001
  }
3001
- if (now - this.lastTapTime < this.config.tap.interval) {
3002
+ if (now - this.lastTapTime < this.config.tap.interval && ev.target === this.lastTapTarget) {
3002
3003
  this.tapCount++;
3003
3004
  }
3004
3005
  else {
3005
3006
  this.tapCount = 1;
3006
3007
  }
3007
3008
  this.lastTapTime = now;
3009
+ this.lastTapTarget = ev.target;
3008
3010
  if (this.tapCount === 1) {
3009
3011
  this.triggerEvent('tap', endEvent);
3010
3012
  }
package/dist/index.min.js CHANGED
@@ -1 +1 @@
1
- !function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("@visactor/vrender-core"),require("@visactor/vutils")):"function"==typeof define&&define.amd?define(["exports","@visactor/vrender-core","@visactor/vutils"],e):e(((t="undefined"!=typeof globalThis?globalThis:t||self).VRender=t.VRender||{},t.VRender.Kits={}),t.VRenderCore,t.VUtils)}(this,(function(t,e,n){"use strict";function i(t){return i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},i(t)}function r(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function a(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,(r=i.key,a=void 0,"symbol"==typeof(a=function(t,e){if("object"!=typeof t||null===t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var i=n.call(t,e||"default");if("object"!=typeof i)return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(r,"string"))?a:String(a)),i)}var r,a}function s(t,e,n){return e&&a(t.prototype,e),n&&a(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}function o(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&h(t,e)}function l(t){return l=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},l(t)}function h(t,e){return h=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},h(t,e)}function c(t,e){if(e&&("object"==typeof e||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}function u(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var n,i=l(t);if(e){var r=l(this).constructor;n=Reflect.construct(i,arguments,r)}else n=i.apply(this,arguments);return c(this,n)}}function d(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var n=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=n){var i,r,a,s,o=[],l=!0,h=!1;try{if(a=(n=n.call(t)).next,0===e){if(Object(n)!==n)return;l=!1}else for(;!(l=(i=a.call(n)).done)&&(o.push(i.value),o.length!==e);l=!0);}catch(t){h=!0,r=t}finally{try{if(!l&&null!=n.return&&(s=n.return(),Object(s)!==s))return}finally{if(h)throw r}}return o}}(t,e)||v(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function f(t){return function(t){if(Array.isArray(t))return p(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||v(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function v(t,e){if(t){if("string"==typeof t)return p(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?p(t,e):void 0}}function p(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,i=new Array(e);n<e;n++)i[n]=t[n];return i}function g(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=v(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var i=0,r=function(){};return{s:r,n:function(){return i>=t.length?{done:!0}:{done:!1,value:t[i++]}},e:function(t){throw t},f:r}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,s=!0,o=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return s=t.done,t},e:function(t){o=!0,a=t},f:function(){try{s||null==n.return||n.return()}finally{if(o)throw a}}}}function m(t,e,n,r){var a,s=arguments.length,o=s<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,n):r;if("object"===("undefined"==typeof Reflect?"undefined":i(Reflect))&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,e,n,r);else for(var l=t.length-1;l>=0;l--)(a=t[l])&&(o=(s<3?a(o):s>3?a(e,n,o):a(e,n))||o);return s>3&&o&&Object.defineProperty(e,n,o),o}function y(t,e){return function(n,i){e(n,i,t)}}function x(t,e){if("object"===("undefined"==typeof Reflect?"undefined":i(Reflect))&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)}function b(t,e,n,i){return new(n||(n=Promise))((function(r,a){function s(t){try{l(i.next(t))}catch(t){a(t)}}function o(t){try{l(i.throw(t))}catch(t){a(t)}}function l(t){var e;t.done?r(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,o)}l((i=i.apply(t,e||[])).next())}))}function S(t,e,n){if(t&&t.length){var i=d(e,2),r=i[0],a=i[1],s=Math.PI/180*n,o=Math.cos(s),l=Math.sin(s);t.forEach((function(t){var e=d(t,2),n=e[0],i=e[1];t[0]=(n-r)*o-(i-a)*l+r,t[1]=(n-r)*l+(i-a)*o+a}))}}function C(t){var e=t[0],n=t[1];return Math.sqrt(Math.pow(e[0]-n[0],2)+Math.pow(e[1]-n[1],2))}function w(t,e){var n=e.hachureAngle+90,i=e.hachureGap;i<0&&(i=4*e.strokeWidth),i=Math.max(i,.1);var r=[0,0];if(n){var a,s=g(t);try{for(s.s();!(a=s.n()).done;){S(a.value,r,n)}}catch(t){s.e(t)}finally{s.f()}}var o=function(t,e){var n,i=[],r=g(t);try{for(r.s();!(n=r.n()).done;){var a=f(n.value);a[0].join(",")!==a[a.length-1].join(",")&&a.push([a[0][0],a[0][1]]),a.length>2&&i.push(a)}}catch(t){r.e(t)}finally{r.f()}var s=[];e=Math.max(e,.1);for(var o=[],l=0,h=i;l<h.length;l++)for(var c=h[l],u=0;u<c.length-1;u++){var d=c[u],v=c[u+1];if(d[1]!==v[1]){var p=Math.min(d[1],v[1]);o.push({ymin:p,ymax:Math.max(d[1],v[1]),x:p===d[1]?d[0]:v[0],islope:(v[0]-d[0])/(v[1]-d[1])})}}if(o.sort((function(t,e){return t.ymin<e.ymin?-1:t.ymin>e.ymin?1:t.x<e.x?-1:t.x>e.x?1:t.ymax===e.ymax?0:(t.ymax-e.ymax)/Math.abs(t.ymax-e.ymax)})),!o.length)return s;for(var m=[],y=o[0].ymin;m.length||o.length;){if(o.length){for(var x=-1,b=0;b<o.length&&!(o[b].ymin>y);b++)x=b;o.splice(0,x+1).forEach((function(t){m.push({s:y,edge:t})}))}if(m=m.filter((function(t){return!(t.edge.ymax<=y)})),m.sort((function(t,e){return t.edge.x===e.edge.x?0:(t.edge.x-e.edge.x)/Math.abs(t.edge.x-e.edge.x)})),m.length>1)for(var S=0;S<m.length;S+=2){var C=S+1;if(C>=m.length)break;var w=m[S].edge,M=m[C].edge;s.push([[Math.round(w.x),y],[Math.round(M.x),y]])}y+=e,m.forEach((function(t){t.edge.x=t.edge.x+e*t.edge.islope}))}return s}(t,i);if(n){var l,h=g(t);try{for(h.s();!(l=h.n()).done;){S(l.value,r,-n)}}catch(t){h.e(t)}finally{h.f()}!function(t,e,n){var i=[];t.forEach((function(t){return i.push.apply(i,f(t))})),S(i,e,n)}(o,r,-n)}return o}"function"==typeof SuppressedError&&SuppressedError;var M=function(){function t(e){r(this,t),this.helper=e}return s(t,[{key:"fillPolygons",value:function(t,e){return this._fillPolygons(t,e)}},{key:"_fillPolygons",value:function(t,e){var n=w(t,e);return{type:"fillSketch",ops:this.renderLines(n,e)}}},{key:"renderLines",value:function(t,e){var n,i=[],r=g(t);try{for(r.s();!(n=r.n()).done;){var a=n.value;i.push.apply(i,f(this.helper.doubleLineOps(a[0][0],a[0][1],a[1][0],a[1][1],e)))}}catch(t){r.e(t)}finally{r.f()}return i}}]),t}(),P=function(t){o(n,t);var e=u(n);function n(){return r(this,n),e.apply(this,arguments)}return s(n,[{key:"fillPolygons",value:function(t,e){var n=e.hachureGap;n<0&&(n=4*e.strokeWidth),n=Math.max(n,.1);var i,r=w(t,Object.assign({},e,{hachureGap:n})),a=Math.PI/180*e.hachureAngle,s=[],o=.5*n*Math.cos(a),l=.5*n*Math.sin(a),h=g(r);try{for(h.s();!(i=h.n()).done;){var c=d(i.value,2),u=c[0],v=c[1];C([u,v])&&s.push([[u[0]-o,u[1]+l],f(v)],[[u[0]+o,u[1]-l],f(v)])}}catch(t){h.e(t)}finally{h.f()}return{type:"fillSketch",ops:this.renderLines(s,e)}}}]),n}(M),k=function(t){o(n,t);var e=u(n);function n(){return r(this,n),e.apply(this,arguments)}return s(n,[{key:"fillPolygons",value:function(t,e){var n=this._fillPolygons(t,e),i=Object.assign({},e,{hachureAngle:e.hachureAngle+90}),r=this._fillPolygons(t,i);return n.ops=n.ops.concat(r.ops),n}}]),n}(M),T=function(){function t(e){r(this,t),this.helper=e}return s(t,[{key:"fillPolygons",value:function(t,e){var n=w(t,e=Object.assign({},e,{hachureAngle:0}));return this.dotsOnLines(n,e)}},{key:"dotsOnLines",value:function(t,e){var n=[],i=e.hachureGap;i<0&&(i=4*e.strokeWidth),i=Math.max(i,.1);var r=e.fillWeight;r<0&&(r=e.strokeWidth/2);var a,s=i/4,o=g(t);try{for(o.s();!(a=o.n()).done;)for(var l=a.value,h=C(l),c=h/i,u=Math.ceil(c)-1,d=h-u*i,v=(l[0][0]+l[1][0])/2-i/4,p=Math.min(l[0][1],l[1][1]),m=0;m<u;m++){var y=p+d+m*i,x=v-s+2*Math.random()*s,b=y-s+2*Math.random()*s,S=this.helper.ellipse(x,b,r,r,e);n.push.apply(n,f(S.ops))}}catch(t){o.e(t)}finally{o.f()}return{type:"fillSketch",ops:n}}}]),t}(),E=function(){function t(e){r(this,t),this.helper=e}return s(t,[{key:"fillPolygons",value:function(t,e){var n=w(t,e);return{type:"fillSketch",ops:this.dashedLine(n,e)}}},{key:"dashedLine",value:function(t,e){var n=this,i=e.dashOffset<0?e.hachureGap<0?4*e.strokeWidth:e.hachureGap:e.dashOffset,r=e.dashGap<0?e.hachureGap<0?4*e.strokeWidth:e.hachureGap:e.dashGap,a=[];return t.forEach((function(t){var s=C(t),o=Math.floor(s/(i+r)),l=(s+r-o*(i+r))/2,h=t[0],c=t[1];h[0]>c[0]&&(h=t[1],c=t[0]);for(var u=Math.atan((c[1]-h[1])/(c[0]-h[0])),d=0;d<o;d++){var v=d*(i+r),p=v+i,g=[h[0]+v*Math.cos(u)+l*Math.cos(u),h[1]+v*Math.sin(u)+l*Math.sin(u)],m=[h[0]+p*Math.cos(u)+l*Math.cos(u),h[1]+p*Math.sin(u)+l*Math.sin(u)];a.push.apply(a,f(n.helper.doubleLineOps(g[0],g[1],m[0],m[1],e)))}})),a}}]),t}(),R=function(){function t(e){r(this,t),this.helper=e}return s(t,[{key:"fillPolygons",value:function(t,e){var n=e.hachureGap<0?4*e.strokeWidth:e.hachureGap,i=e.zigzagOffset<0?n:e.zigzagOffset,r=w(t,e=Object.assign({},e,{hachureGap:n+i}));return{type:"fillSketch",ops:this.zigzagLines(r,i,e)}}},{key:"zigzagLines",value:function(t,e,n){var i=this,r=[];return t.forEach((function(t){var a=C(t),s=Math.round(a/(2*e)),o=t[0],l=t[1];o[0]>l[0]&&(o=t[1],l=t[0]);for(var h=Math.atan((l[1]-o[1])/(l[0]-o[0])),c=0;c<s;c++){var u=2*c*e,d=2*(c+1)*e,v=Math.sqrt(2*Math.pow(e,2)),p=[o[0]+u*Math.cos(h),o[1]+u*Math.sin(h)],g=[o[0]+d*Math.cos(h),o[1]+d*Math.sin(h)],m=[p[0]+v*Math.cos(h+Math.PI/4),p[1]+v*Math.sin(h+Math.PI/4)];r.push.apply(r,f(i.helper.doubleLineOps(p[0],p[1],m[0],m[1],n)).concat(f(i.helper.doubleLineOps(m[0],m[1],g[0],g[1],n))))}})),r}}]),t}(),O={},B=function(){function t(e){r(this,t),this.seed=e}return s(t,[{key:"next",value:function(){return this.seed?(Math.pow(2,31)-1&(this.seed=Math.imul(48271,this.seed)))/Math.pow(2,31):Math.random()}}]),t}(),A={A:7,a:7,C:6,c:6,H:1,h:1,L:2,l:2,M:2,m:2,Q:4,q:4,S:4,s:4,T:2,t:2,V:1,v:1,Z:0,z:0};function j(t,e){return t.type===e}function I(t){for(var e=[],n=function(t){for(var e=new Array;""!==t;)if(t.match(/^([ \t\r\n,]+)/))t=t.substr(RegExp.$1.length);else if(t.match(/^([aAcChHlLmMqQsStTvVzZ])/))e[e.length]={type:0,text:RegExp.$1},t=t.substr(RegExp.$1.length);else{if(!t.match(/^(([-+]?[0-9]+(\.[0-9]*)?|[-+]?\.[0-9]+)([eE][-+]?[0-9]+)?)/))return[];e[e.length]={type:1,text:"".concat(parseFloat(RegExp.$1))},t=t.substr(RegExp.$1.length)}return e[e.length]={type:2,text:""},e}(t),i="BOD",r=0,a=n[r];!j(a,2);){var s=0,o=[];if("BOD"===i){if("M"!==a.text&&"m"!==a.text)return I("M0,0"+t);r++,s=A[a.text],i=a.text}else j(a,1)?s=A[i]:(r++,s=A[a.text],i=a.text);if(!(r+s<n.length))throw new Error("Path data ended short");for(var l=r;l<r+s;l++){var h=n[l];if(!j(h,1))throw new Error("Param not a number: "+i+","+h.text);o[o.length]=+h.text}if("number"!=typeof A[i])throw new Error("Bad segment: "+i);var c={key:i,data:o};e.push(c),a=n[r+=s],"M"===i&&(i="L"),"m"===i&&(i="l")}return e}function D(t){var e,n,i,r,a=0,s=0,o=0,l=0,h=[],c=g(t);try{for(c.s();!(r=c.n()).done;){var u=r.value,v=u.key,p=u.data;switch(v){case"M":h.push({key:"M",data:f(p)}),e=d(p,2),a=e[0],s=e[1],o=(n=d(p,2))[0],l=n[1];break;case"m":a+=p[0],s+=p[1],h.push({key:"M",data:[a,s]}),o=a,l=s;break;case"L":h.push({key:"L",data:f(p)}),i=d(p,2),a=i[0],s=i[1];break;case"l":a+=p[0],s+=p[1],h.push({key:"L",data:[a,s]});break;case"C":h.push({key:"C",data:f(p)}),a=p[4],s=p[5];break;case"c":var m=p.map((function(t,e){return e%2?t+s:t+a}));h.push({key:"C",data:m}),a=m[4],s=m[5];break;case"Q":h.push({key:"Q",data:f(p)}),a=p[2],s=p[3];break;case"q":var y=p.map((function(t,e){return e%2?t+s:t+a}));h.push({key:"Q",data:y}),a=y[2],s=y[3];break;case"A":h.push({key:"A",data:f(p)}),a=p[5],s=p[6];break;case"a":a+=p[5],s+=p[6],h.push({key:"A",data:[p[0],p[1],p[2],p[3],p[4],a,s]});break;case"H":h.push({key:"H",data:f(p)}),a=p[0];break;case"h":a+=p[0],h.push({key:"H",data:[a]});break;case"V":h.push({key:"V",data:f(p)}),s=p[0];break;case"v":s+=p[0],h.push({key:"V",data:[s]});break;case"S":h.push({key:"S",data:f(p)}),a=p[2],s=p[3];break;case"s":var x=p.map((function(t,e){return e%2?t+s:t+a}));h.push({key:"S",data:x}),a=x[2],s=x[3];break;case"T":h.push({key:"T",data:f(p)}),a=p[0],s=p[1];break;case"t":a+=p[0],s+=p[1],h.push({key:"T",data:[a,s]});break;case"Z":case"z":h.push({key:"Z",data:[]}),a=o,s=l}}}catch(t){c.e(t)}finally{c.f()}return h}function L(t){var e,n,i,r,a=[],s="",o=0,l=0,h=0,c=0,u=0,v=0,p=g(t);try{for(p.s();!(r=p.n()).done;){var m=r.value,y=m.key,x=m.data;switch(y){case"M":a.push({key:"M",data:f(x)}),o=(e=d(x,2))[0],l=e[1],h=(n=d(x,2))[0],c=n[1];break;case"C":a.push({key:"C",data:f(x)}),o=x[4],l=x[5],u=x[2],v=x[3];break;case"L":a.push({key:"L",data:f(x)}),o=(i=d(x,2))[0],l=i[1];break;case"H":o=x[0],a.push({key:"L",data:[o,l]});break;case"V":l=x[0],a.push({key:"L",data:[o,l]});break;case"S":var b=0,S=0;"C"===s||"S"===s?(b=o+(o-u),S=l+(l-v)):(b=o,S=l),a.push({key:"C",data:[b,S].concat(f(x))}),u=x[0],v=x[1],o=x[2],l=x[3];break;case"T":var C=d(x,2),w=C[0],M=C[1],P=0,k=0;"Q"===s||"T"===s?(P=o+(o-u),k=l+(l-v)):(P=o,k=l);var T=o+2*(P-o)/3,E=l+2*(k-l)/3,R=w+2*(P-w)/3,O=M+2*(k-M)/3;a.push({key:"C",data:[T,E,R,O,w,M]}),u=P,v=k,o=w,l=M;break;case"Q":var B=d(x,4),A=B[0],j=B[1],I=B[2],D=B[3],L=o+2*(A-o)/3,_=l+2*(j-l)/3,F=I+2*(A-I)/3,z=D+2*(j-D)/3;a.push({key:"C",data:[L,_,F,z,I,D]}),u=A,v=j,o=I,l=D;break;case"A":var G=Math.abs(x[0]),V=Math.abs(x[1]),Y=x[2],N=x[3],H=x[4],U=x[5],X=x[6];0===G||0===V?(a.push({key:"C",data:[o,l,U,X,U,X]}),o=U,l=X):o===U&&l===X||(W(o,l,U,X,G,V,Y,N,H).forEach((function(t){a.push({key:"C",data:t})})),o=U,l=X);break;case"Z":a.push({key:"Z",data:[]}),o=h,l=c}s=y}}catch(t){p.e(t)}finally{p.f()}return a}function _(t,e,n){return[t*Math.cos(n)-e*Math.sin(n),t*Math.sin(n)+e*Math.cos(n)]}function W(t,e,n,i,r,a,s,o,l,h){var c,u=(c=s,Math.PI*c/180),f=[],v=0,p=0,g=0,m=0;if(h){var y=d(h,4);v=y[0],p=y[1],g=y[2],m=y[3]}else{var x,b;t=(x=d(_(t,e,-u),2))[0],e=x[1];var S=(t-(n=(b=d(_(n,i,-u),2))[0]))/2,C=(e-(i=b[1]))/2,w=S*S/(r*r)+C*C/(a*a);w>1&&(r*=w=Math.sqrt(w),a*=w);var M=r*r,P=a*a,k=M*P-M*C*C-P*S*S,T=M*C*C+P*S*S,E=(o===l?-1:1)*Math.sqrt(Math.abs(k/T));g=E*r*C/a+(t+n)/2,m=E*-a*S/r+(e+i)/2,v=Math.asin(parseFloat(((e-m)/a).toFixed(9))),p=Math.asin(parseFloat(((i-m)/a).toFixed(9))),t<g&&(v=Math.PI-v),n<g&&(p=Math.PI-p),v<0&&(v=2*Math.PI+v),p<0&&(p=2*Math.PI+p),l&&v>p&&(v-=2*Math.PI),!l&&p>v&&(p-=2*Math.PI)}var R=p-v;if(Math.abs(R)>120*Math.PI/180){var O=p,B=n,A=i;p=l&&p>v?v+120*Math.PI/180*1:v+120*Math.PI/180*-1,f=W(n=g+r*Math.cos(p),i=m+a*Math.sin(p),B,A,r,a,s,0,l,[p,O,g,m])}R=p-v;var j=Math.cos(v),I=Math.sin(v),D=Math.cos(p),L=Math.sin(p),F=Math.tan(R/4),z=4/3*r*F,G=4/3*a*F,V=[t,e],Y=[t+z*I,e-G*j],N=[n+z*L,i-G*D],H=[n,i];if(Y[0]=2*V[0]-Y[0],Y[1]=2*V[1]-Y[1],h)return[Y,N,H].concat(f);f=[Y,N,H].concat(f);for(var U=[],X=0;X<f.length;X+=3){var q=_(f[X][0],f[X][1],u),$=_(f[X+1][0],f[X+1][1],u),J=_(f[X+2][0],f[X+2][1],u);U.push([q[0],q[1],$[0],$[1],J[0],J[1]])}return U}var F={randOffset:function(t,e){return $(t,e)},randOffsetWithRange:function(t,e,n){return q(t,e,n)},ellipse:function(t,e,n,i,r){return Y(t,e,r,V(n,i,r)).opset},doubleLineOps:function(t,e,n,i,r){return J(t,e,n,i,r,!0)}};function z(t,e,n,i,r){return{type:"path",ops:J(t,e,n,i,r)}}function G(t,e,n){var i=(t||[]).length;if(i>2){for(var r=[],a=0;a<i-1;a++)r.push.apply(r,f(J(t[a][0],t[a][1],t[a+1][0],t[a+1][1],n)));return e&&r.push.apply(r,f(J(t[i-1][0],t[i-1][1],t[0][0],t[0][1],n))),{type:"path",ops:r}}return 2===i?z(t[0][0],t[0][1],t[1][0],t[1][1],n):{type:"path",ops:[]}}function V(t,e,n){var i=Math.sqrt(2*Math.PI*Math.sqrt((Math.pow(t/2,2)+Math.pow(e/2,2))/2)),r=Math.ceil(Math.max(n.curveStepCount,n.curveStepCount/Math.sqrt(200)*i)),a=2*Math.PI/r,s=Math.abs(t/2),o=Math.abs(e/2),l=1-n.curveFitting;return{increment:a,rx:s+=$(s*l,n),ry:o+=$(o*l,n)}}function Y(t,e,n,i){var r=d(et(i.increment,t,e,i.rx,i.ry,1,i.increment*q(.1,q(.4,1,n),n),n),2),a=r[0],s=r[1],o=K(a,null,n);if(!n.disableMultiStroke&&0!==n.roughness){var l=K(d(et(i.increment,t,e,i.rx,i.ry,1.5,0,n),1)[0],null,n);o=o.concat(l)}return{estimatedPoints:s,opset:{type:"path",ops:o}}}function N(t,e,n,i,r,a,s,o,l){var h=t,c=e,u=Math.abs(n/2),d=Math.abs(i/2);u+=$(.01*u,l),d+=$(.01*d,l);for(var v=r,p=a;v<0;)v+=2*Math.PI,p+=2*Math.PI;p-v>2*Math.PI&&(v=0,p=2*Math.PI);var g=2*Math.PI/l.curveStepCount,m=Math.min(g/2,(p-v)/2),y=nt(m,h,c,u,d,v,p,1,l);if(!l.disableMultiStroke){var x=nt(m,h,c,u,d,v,p,1.5,l);y.push.apply(y,f(x))}return s&&(o?y.push.apply(y,f(J(h,c,h+u*Math.cos(v),c+d*Math.sin(v),l)).concat(f(J(h,c,h+u*Math.cos(p),c+d*Math.sin(p),l)))):y.push({op:"lineTo",data:[h,c]},{op:"lineTo",data:[h+u*Math.cos(v),c+d*Math.sin(v)]})),{type:"path",ops:y}}function H(t,e){var n,i=[],r=g(t);try{for(r.s();!(n=r.n()).done;){var a=n.value;if(a.length){var s=e.maxRandomnessOffset||0,o=a.length;if(o>2){i.push({op:"move",data:[a[0][0]+$(s,e),a[0][1]+$(s,e)]});for(var l=1;l<o;l++)i.push({op:"lineTo",data:[a[l][0]+$(s,e),a[l][1]+$(s,e)]})}}}}catch(t){r.e(t)}finally{r.f()}return{type:"fillPath",ops:i}}function U(t,e){return function(t,e){var n=t.fillStyle||"hachure";if(!O[n])switch(n){case"zigzag":O[n]||(O[n]=new P(e));break;case"cross-hatch":O[n]||(O[n]=new k(e));break;case"dots":O[n]||(O[n]=new T(e));break;case"dashed":O[n]||(O[n]=new E(e));break;case"zigzag-line":O[n]||(O[n]=new R(e));break;default:O[n="hachure"]||(O[n]=new M(e))}return O[n]}(e,F).fillPolygons(t,e)}function X(t){return t.randomizer||(t.randomizer=new B(t.seed||0)),t.randomizer.next()}function q(t,e,n){var i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1;return n.roughness*i*(X(n)*(e-t)+t)}function $(t,e){return q(-t,t,e,arguments.length>2&&void 0!==arguments[2]?arguments[2]:1)}function J(t,e,n,i,r){var a=arguments.length>5&&void 0!==arguments[5]&&arguments[5]?r.disableMultiStrokeFill:r.disableMultiStroke,s=Q(t,e,n,i,r,!0,!1);if(a)return s;var o=Q(t,e,n,i,r,!0,!0);return s.concat(o)}function Q(t,e,n,i,r,a,s){var o,l=Math.pow(t-n,2)+Math.pow(e-i,2),h=Math.sqrt(l);o=h<200?1:h>500?.4:-.0016668*h+1.233334;var c=r.maxRandomnessOffset||0;c*c*100>l&&(c=h/10);var u=c/2,d=.2+.2*X(r),f=r.bowing*r.maxRandomnessOffset*(i-e)/200,v=r.bowing*r.maxRandomnessOffset*(t-n)/200;f=$(f,r,o),v=$(v,r,o);var p=[],g=function(){return $(u,r,o)},m=function(){return $(c,r,o)},y=r.preserveVertices;return a&&(s?p.push({op:"move",data:[t+(y?0:g()),e+(y?0:g())]}):p.push({op:"move",data:[t+(y?0:$(c,r,o)),e+(y?0:$(c,r,o))]})),s?p.push({op:"bcurveTo",data:[f+t+(n-t)*d+g(),v+e+(i-e)*d+g(),f+t+2*(n-t)*d+g(),v+e+2*(i-e)*d+g(),n+(y?0:g()),i+(y?0:g())]}):p.push({op:"bcurveTo",data:[f+t+(n-t)*d+m(),v+e+(i-e)*d+m(),f+t+2*(n-t)*d+m(),v+e+2*(i-e)*d+m(),n+(y?0:m()),i+(y?0:m())]}),p}function Z(t,e,n){var i=[];i.push([t[0][0]+$(e,n),t[0][1]+$(e,n)]),i.push([t[0][0]+$(e,n),t[0][1]+$(e,n)]);for(var r=1;r<t.length;r++)i.push([t[r][0]+$(e,n),t[r][1]+$(e,n)]),r===t.length-1&&i.push([t[r][0]+$(e,n),t[r][1]+$(e,n)]);return K(i,null,n)}function K(t,e,n){var i=t.length,r=[];if(i>3){var a=[],s=1-n.curveTightness;r.push({op:"move",data:[t[1][0],t[1][1]]});for(var o=1;o+2<i;o++){var l=t[o];a[0]=[l[0],l[1]],a[1]=[l[0]+(s*t[o+1][0]-s*t[o-1][0])/6,l[1]+(s*t[o+1][1]-s*t[o-1][1])/6],a[2]=[t[o+1][0]+(s*t[o][0]-s*t[o+2][0])/6,t[o+1][1]+(s*t[o][1]-s*t[o+2][1])/6],a[3]=[t[o+1][0],t[o+1][1]],r.push({op:"bcurveTo",data:[a[1][0],a[1][1],a[2][0],a[2][1],a[3][0],a[3][1]]})}if(e&&2===e.length){var h=n.maxRandomnessOffset;r.push({op:"lineTo",data:[e[0]+$(h,n),e[1]+$(h,n)]})}}else 3===i?(r.push({op:"move",data:[t[1][0],t[1][1]]}),r.push({op:"bcurveTo",data:[t[1][0],t[1][1],t[2][0],t[2][1],t[2][0],t[2][1]]})):2===i&&r.push.apply(r,f(J(t[0][0],t[0][1],t[1][0],t[1][1],n)));return r}function et(t,e,n,i,r,a,s,o){var l=[],h=[];if(0===o.roughness){t/=4,h.push([e+i*Math.cos(-t),n+r*Math.sin(-t)]);for(var c=0;c<=2*Math.PI;c+=t){var u=[e+i*Math.cos(c),n+r*Math.sin(c)];l.push(u),h.push(u)}h.push([e+i*Math.cos(0),n+r*Math.sin(0)]),h.push([e+i*Math.cos(t),n+r*Math.sin(t)])}else{var d=$(.5,o)-Math.PI/2;h.push([$(a,o)+e+.9*i*Math.cos(d-t),$(a,o)+n+.9*r*Math.sin(d-t)]);for(var f=2*Math.PI+d-.01,v=d;v<f;v+=t){var p=[$(a,o)+e+i*Math.cos(v),$(a,o)+n+r*Math.sin(v)];l.push(p),h.push(p)}h.push([$(a,o)+e+i*Math.cos(d+2*Math.PI+.5*s),$(a,o)+n+r*Math.sin(d+2*Math.PI+.5*s)]),h.push([$(a,o)+e+.98*i*Math.cos(d+s),$(a,o)+n+.98*r*Math.sin(d+s)]),h.push([$(a,o)+e+.9*i*Math.cos(d+.5*s),$(a,o)+n+.9*r*Math.sin(d+.5*s)])}return[h,l]}function nt(t,e,n,i,r,a,s,o,l){var h=a+$(.1,l),c=[];c.push([$(o,l)+e+.9*i*Math.cos(h-t),$(o,l)+n+.9*r*Math.sin(h-t)]);for(var u=h;u<=s;u+=t)c.push([$(o,l)+e+i*Math.cos(u),$(o,l)+n+r*Math.sin(u)]);return c.push([e+i*Math.cos(s),n+r*Math.sin(s)]),c.push([e+i*Math.cos(s),n+r*Math.sin(s)]),K(c,null,l)}function it(t){return f(t)}function rt(t,e){return Math.pow(t[0]-e[0],2)+Math.pow(t[1]-e[1],2)}function at(t,e,n){var i=rt(e,n);if(0===i)return rt(t,e);var r=((t[0]-e[0])*(n[0]-e[0])+(t[1]-e[1])*(n[1]-e[1]))/i;return rt(t,st(e,n,r=Math.max(0,Math.min(1,r))))}function st(t,e,n){return[t[0]+(e[0]-t[0])*n,t[1]+(e[1]-t[1])*n]}function ot(t,e,n,i){var r,a,s=i||[];if(function(t,e){var n=t[e+0],i=t[e+1],r=t[e+2],a=t[e+3],s=3*i[0]-2*n[0]-a[0];s*=s;var o=3*i[1]-2*n[1]-a[1];o*=o;var l=3*r[0]-2*a[0]-n[0];l*=l;var h=3*r[1]-2*a[1]-n[1];return s<l&&(s=l),o<(h*=h)&&(o=h),s+o}(t,e)<n){var o=t[e+0];s.length?(r=s[s.length-1],a=o,Math.sqrt(rt(r,a))>1&&s.push(o)):s.push(o),s.push(t[e+3])}else{var l=.5,h=t[e+0],c=t[e+1],u=t[e+2],d=t[e+3],f=st(h,c,l),v=st(c,u,l),p=st(u,d,l),g=st(f,v,l),m=st(v,p,l),y=st(g,m,l);ot([h,f,g,y],0,n,s),ot([y,m,p,d],0,n,s)}return s}function lt(t,e){return ht(t,0,t.length,e)}function ht(t,e,n,i,r){for(var a=r||[],s=t[e],o=t[n-1],l=0,h=1,c=e+1;c<n-1;++c){var u=at(t[c],s,o);u>l&&(l=u,h=c)}return Math.sqrt(l)>i?(ht(t,e,h+1,i,a),ht(t,h,n,i,a)):(a.length||a.push(s),a.push(o)),a}function ct(t){for(var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:.15,n=arguments.length>2?arguments[2]:void 0,i=[],r=(t.length-1)/3,a=0;a<r;a++)ot(t,3*a,e,i);return n&&n>0?ht(i,0,i.length,n):i}var ut="none",dt=function(){function t(e){r(this,t),this.defaultOptions={maxRandomnessOffset:2,roughness:1,bowing:1,stroke:"#000",strokeWidth:1,curveTightness:0,curveFitting:.95,curveStepCount:9,fillStyle:"hachure",fillWeight:-1,hachureAngle:-41,hachureGap:-1,dashOffset:-1,dashGap:-1,zigzagOffset:-1,seed:0,disableMultiStroke:!1,disableMultiStrokeFill:!1,preserveVertices:!1},this.config=e||{},this.config.options&&(this.defaultOptions=this._o(this.config.options))}return s(t,[{key:"_o",value:function(t){return t?Object.assign({},this.defaultOptions,t):this.defaultOptions}},{key:"_d",value:function(t,e,n){return{shape:t,sets:e||[],options:n||this.defaultOptions}}},{key:"line",value:function(t,e,n,i,r){var a=this._o(r);return this._d("line",[z(t,e,n,i,a)],a)}},{key:"rectangle",value:function(t,e,n,i,r){var a=this._o(r),s=[],o=function(t,e,n,i,r){return function(t,e){return G(t,!0,e)}([[t,e],[t+n,e],[t+n,e+i],[t,e+i]],r)}(t,e,n,i,a);if(a.fill){var l=[[t,e],[t+n,e],[t+n,e+i],[t,e+i]];"solid"===a.fillStyle?s.push(H([l],a)):s.push(U([l],a))}return a.stroke!==ut&&s.push(o),this._d("rectangle",s,a)}},{key:"ellipse",value:function(t,e,n,i,r){var a=this._o(r),s=[],o=V(n,i,a),l=Y(t,e,a,o);if(a.fill)if("solid"===a.fillStyle){var h=Y(t,e,a,o).opset;h.type="fillPath",s.push(h)}else s.push(U([l.estimatedPoints],a));return a.stroke!==ut&&s.push(l.opset),this._d("ellipse",s,a)}},{key:"circle",value:function(t,e,n,i){var r=this.ellipse(t,e,n,n,i);return r.shape="circle",r}},{key:"linearPath",value:function(t,e){var n=this._o(e);return this._d("linearPath",[G(t,!1,n)],n)}},{key:"arc",value:function(t,e,n,i,r,a){var s=arguments.length>6&&void 0!==arguments[6]&&arguments[6],o=arguments.length>7?arguments[7]:void 0,l=this._o(o),h=[],c=N(t,e,n,i,r,a,s,!0,l);if(s&&l.fill)if("solid"===l.fillStyle){var u=Object.assign({},l);u.disableMultiStroke=!0;var d=N(t,e,n,i,r,a,!0,!1,u);d.type="fillPath",h.push(d)}else h.push(function(t,e,n,i,r,a,s){var o=t,l=e,h=Math.abs(n/2),c=Math.abs(i/2);h+=$(.01*h,s),c+=$(.01*c,s);for(var u=r,d=a;u<0;)u+=2*Math.PI,d+=2*Math.PI;d-u>2*Math.PI&&(u=0,d=2*Math.PI);for(var f=(d-u)/s.curveStepCount,v=[],p=u;p<=d;p+=f)v.push([o+h*Math.cos(p),l+c*Math.sin(p)]);return v.push([o+h*Math.cos(d),l+c*Math.sin(d)]),v.push([o,l]),U([v],s)}(t,e,n,i,r,a,l));return l.stroke!==ut&&h.push(c),this._d("arc",h,l)}},{key:"curve",value:function(t,e){var n=this._o(e),i=[],r=function(t,e){var n=Z(t,1*(1+.2*e.roughness),e);if(!e.disableMultiStroke){var i=Z(t,1.5*(1+.22*e.roughness),function(t){var e=Object.assign({},t);return e.randomizer=void 0,t.seed&&(e.seed=t.seed+1),e}(e));n=n.concat(i)}return{type:"path",ops:n}}(t,n);if(n.fill&&n.fill!==ut&&t.length>=3){var a=ct(function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=t.length;if(n<3)throw new Error("A curve must have at least three points.");var i=[];if(3===n)i.push(it(t[0]),it(t[1]),it(t[2]),it(t[2]));else{var r=[];r.push(t[0],t[0]);for(var a=1;a<t.length;a++)r.push(t[a]),a===t.length-1&&r.push(t[a]);var s=[],o=1-e;i.push(it(r[0]));for(var l=1;l+2<r.length;l++){var h=r[l];s[0]=[h[0],h[1]],s[1]=[h[0]+(o*r[l+1][0]-o*r[l-1][0])/6,h[1]+(o*r[l+1][1]-o*r[l-1][1])/6],s[2]=[r[l+1][0]+(o*r[l][0]-o*r[l+2][0])/6,r[l+1][1]+(o*r[l][1]-o*r[l+2][1])/6],s[3]=[r[l+1][0],r[l+1][1]],i.push(s[1],s[2],s[3])}}return i}(t),10,(1+n.roughness)/2);"solid"===n.fillStyle?i.push(H([a],n)):i.push(U([a],n))}return n.stroke!==ut&&i.push(r),this._d("curve",i,n)}},{key:"polygon",value:function(t,e){var n=this._o(e),i=[],r=G(t,!0,n);return n.fill&&("solid"===n.fillStyle?i.push(H([t],n)):i.push(U([t],n))),n.stroke!==ut&&i.push(r),this._d("polygon",i,n)}},{key:"path",value:function(t,e){var n=this._o(e),i=[];if(!t)return this._d("path",i,n);t=(t||"").replace(/\n/g," ").replace(/(-\s)/g,"-").replace("/(ss)/g"," ");var r=n.fill&&"transparent"!==n.fill&&n.fill!==ut,a=n.stroke!==ut,s=!!(n.simplification&&n.simplification<1),o=function(t,e,n){var i,r=L(D(I(t))),a=[],s=[],o=[0,0],l=[],h=function(){var t;l.length>=4&&(t=s).push.apply(t,f(ct(l,1))),l=[]},c=function(){h(),s.length&&(a.push(s),s=[])},u=g(r);try{for(u.s();!(i=u.n()).done;){var d=i.value,v=d.key,p=d.data;switch(v){case"M":c(),o=[p[0],p[1]],s.push(o);break;case"L":h(),s.push([p[0],p[1]]);break;case"C":if(!l.length){var m=s.length?s[s.length-1]:o;l.push([m[0],m[1]])}l.push([p[0],p[1]]),l.push([p[2],p[3]]),l.push([p[4],p[5]]);break;case"Z":h(),s.push([o[0],o[1]])}}}catch(t){u.e(t)}finally{u.f()}if(c(),!n)return a;for(var y=[],x=0,b=a;x<b.length;x++){var S=lt(b[x],n);S.length&&y.push(S)}return y}(t,0,s?4-4*n.simplification:(1+n.roughness)/2);return r&&("solid"===n.fillStyle?i.push(H(o,n)):i.push(U(o,n))),a&&(s?o.forEach((function(t){i.push(G(t,!1,n))})):i.push(function(t,e){var n,i=L(D(I(t))),r=[],a=[0,0],s=[0,0],o=g(i);try{var l=function(){var t=n.value,i=t.key,o=t.data;switch(i){case"M":var l=1*(e.maxRandomnessOffset||0),h=e.preserveVertices;r.push({op:"move",data:o.map((function(t){return t+(h?0:$(l,e))}))}),s=[o[0],o[1]],a=[o[0],o[1]];break;case"L":r.push.apply(r,f(J(s[0],s[1],o[0],o[1],e))),s=[o[0],o[1]];break;case"C":var c=d(o,6),u=c[0],v=c[1],p=c[2],g=c[3],m=c[4],y=c[5];r.push.apply(r,f(function(t,e,n,i,r,a,s,o){for(var l=[],h=[o.maxRandomnessOffset||1,(o.maxRandomnessOffset||1)+.3],c=[0,0],u=o.disableMultiStroke?1:2,d=o.preserveVertices,f=0;f<u;f++)0===f?l.push({op:"move",data:[s[0],s[1]]}):l.push({op:"move",data:[s[0]+(d?0:$(h[0],o)),s[1]+(d?0:$(h[0],o))]}),c=d?[r,a]:[r+$(h[f],o),a+$(h[f],o)],l.push({op:"bcurveTo",data:[t+$(h[f],o),e+$(h[f],o),n+$(h[f],o),i+$(h[f],o),c[0],c[1]]});return l}(u,v,p,g,m,y,s,e))),s=[m,y];break;case"Z":r.push.apply(r,f(J(s[0],s[1],a[0],a[1],e))),s=[a[0],a[1]]}};for(o.s();!(n=o.n()).done;)l()}catch(t){o.e(t)}finally{o.f()}return{type:"path",ops:r}}(t,n))),this._d("path",i,n)}},{key:"opsToPath",value:function(t,e){var n,i="",r=g(t.ops);try{for(r.s();!(n=r.n()).done;){var a=n.value,s="number"==typeof e&&e>=0?a.data.map((function(t){return+t.toFixed(e)})):a.data;switch(a.op){case"move":i+="M".concat(s[0]," ").concat(s[1]," ");break;case"bcurveTo":i+="C".concat(s[0]," ").concat(s[1],", ").concat(s[2]," ").concat(s[3],", ").concat(s[4]," ").concat(s[5]," ");break;case"lineTo":i+="L".concat(s[0]," ").concat(s[1]," ")}}}catch(t){r.e(t)}finally{r.f()}return i.trim()}},{key:"toPaths",value:function(t){var e,n=t.sets||[],i=t.options||this.defaultOptions,r=[],a=g(n);try{for(a.s();!(e=a.n()).done;){var s=e.value,o=null;switch(s.type){case"path":o={d:this.opsToPath(s),stroke:i.stroke,strokeWidth:i.strokeWidth,fill:ut};break;case"fillPath":o={d:this.opsToPath(s),stroke:ut,strokeWidth:0,fill:i.fill||ut};break;case"fillSketch":o=this.fillSketch(s,i)}o&&r.push(o)}}catch(t){a.e(t)}finally{a.f()}return r}},{key:"fillSketch",value:function(t,e){var n=e.fillWeight;return n<0&&(n=e.strokeWidth/2),{d:this.opsToPath(t),stroke:e.fill||ut,strokeWidth:n,fill:ut}}}],[{key:"newSeed",value:function(){return Math.floor(Math.random()*Math.pow(2,31))}}]),t}(),ft=function(){function t(e,n){r(this,t),this.canvas=e,this.ctx=this.canvas.getContext("2d"),this.gen=new dt(n)}return s(t,[{key:"draw",value:function(t){var e,n=t.sets||[],i=t.options||this.getDefaultOptions(),r=this.ctx,a=t.options.fixedDecimalPlaceDigits,s=g(n);try{for(s.s();!(e=s.n()).done;){var o=e.value;switch(o.type){case"path":r.save(),r.strokeStyle="none"===i.stroke?"transparent":i.stroke,r.lineWidth=i.strokeWidth,i.strokeLineDash&&r.setLineDash(i.strokeLineDash),i.strokeLineDashOffset&&(r.lineDashOffset=i.strokeLineDashOffset),this._drawToContext(r,o,a),r.restore();break;case"fillPath":r.save(),r.fillStyle=i.fill||"";var l="curve"===t.shape||"polygon"===t.shape||"path"===t.shape?"evenodd":"nonzero";this._drawToContext(r,o,a,l),r.restore();break;case"fillSketch":this.fillSketch(r,o,i)}}}catch(t){s.e(t)}finally{s.f()}}},{key:"fillSketch",value:function(t,e,n){var i=n.fillWeight;i<0&&(i=n.strokeWidth/2),t.save(),n.fillLineDash&&t.setLineDash(n.fillLineDash),n.fillLineDashOffset&&(t.lineDashOffset=n.fillLineDashOffset),t.strokeStyle=n.fill||"",t.lineWidth=i,this._drawToContext(t,e,n.fixedDecimalPlaceDigits),t.restore()}},{key:"_drawToContext",value:function(t,e,n){var i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"nonzero";t.beginPath();var r,a=g(e.ops);try{for(a.s();!(r=a.n()).done;){var s=r.value,o="number"==typeof n&&n>=0?s.data.map((function(t){return+t.toFixed(n)})):s.data;switch(s.op){case"move":t.moveTo(o[0],o[1]);break;case"bcurveTo":t.bezierCurveTo(o[0],o[1],o[2],o[3],o[4],o[5]);break;case"lineTo":t.lineTo(o[0],o[1])}}}catch(t){a.e(t)}finally{a.f()}"fillPath"===e.type?t.fill(i):t.stroke()}},{key:"generator",get:function(){return this.gen}},{key:"getDefaultOptions",value:function(){return this.gen.defaultOptions}},{key:"line",value:function(t,e,n,i,r){var a=this.gen.line(t,e,n,i,r);return this.draw(a),a}},{key:"rectangle",value:function(t,e,n,i,r){var a=this.gen.rectangle(t,e,n,i,r);return this.draw(a),a}},{key:"ellipse",value:function(t,e,n,i,r){var a=this.gen.ellipse(t,e,n,i,r);return this.draw(a),a}},{key:"circle",value:function(t,e,n,i){var r=this.gen.circle(t,e,n,i);return this.draw(r),r}},{key:"linearPath",value:function(t,e){var n=this.gen.linearPath(t,e);return this.draw(n),n}},{key:"polygon",value:function(t,e){var n=this.gen.polygon(t,e);return this.draw(n),n}},{key:"arc",value:function(t,e,n,i,r,a){var s=arguments.length>6&&void 0!==arguments[6]&&arguments[6],o=arguments.length>7?arguments[7]:void 0,l=this.gen.arc(t,e,n,i,r,a,s,o);return this.draw(l),l}},{key:"curve",value:function(t,e){var n=this.gen.curve(t,e);return this.draw(n),n}},{key:"path",value:function(t,e){var n=this.gen.path(t,e);return this.draw(n),n}}]),t}(),vt=function(t,e){return new ft(t,e)};const pt={maxRandomnessOffset:3,roughness:1,bowing:1,curveFitting:.95,curveTightness:void 0,curveStepCount:9,fillStyle:"hachure",fillWeight:void 0,hachureAngle:60,hachureGap:6,simplification:0,dashOffset:void 0,dashGap:void 0,zigzagOffset:void 0,seed:1,fillLineDash:void 0,fillLineDashOffset:void 0,disableMultiStroke:!1,disableMultiStrokeFill:!1,preserveVertices:!0,fixedDecimalPlaceDigits:void 0};let gt=class{constructor(t){this.canvasRenderer=t,this.style="rough",this.type="arc",this.numberType=e.ARC_NUMBER_TYPE}draw(t,n,i,r){const{context:a}=i;if(!a)return;const s=a.canvas.nativeCanvas,o=vt(s);a.highPerformanceSave();const l=e.getTheme(t).arc;let{x:h=l.x,y:c=l.y}=t.attribute;if(t.transMatrix.onlyTranslate()){const{dx:e=l.dx,dy:n=l.dy}=t.attribute;h+=e,c+=n,a.setTransformForCurrent()}else h=0,c=0,a.transformFromMatrix(t.transMatrix,!0);const u=new e.CustomPath2D,{fill:d=l.fill,stroke:f=l.stroke,lineWidth:v=l.lineWidth,outerRadius:p=l.outerRadius,innerRadius:g=l.innerRadius,maxRandomnessOffset:m=pt.maxRandomnessOffset,roughness:y=pt.roughness,bowing:x=pt.bowing,curveFitting:b=pt.curveFitting,curveTightness:S=pt.curveTightness,curveStepCount:C=pt.curveStepCount,fillStyle:w=pt.fillStyle,fillWeight:M=pt.fillWeight,hachureAngle:P=pt.hachureAngle,hachureGap:k=pt.hachureGap,simplification:T=pt.simplification,dashOffset:E=pt.dashOffset,dashGap:R=pt.dashGap,zigzagOffset:O=pt.zigzagOffset,seed:B=pt.seed,fillLineDash:A=pt.fillLineDash,fillLineDashOffset:j=pt.fillLineDashOffset,disableMultiStroke:I=pt.disableMultiStroke,disableMultiStrokeFill:D=pt.disableMultiStrokeFill,preserveVertices:L=pt.preserveVertices,fixedDecimalPlaceDigits:_=pt.fixedDecimalPlaceDigits}=t.attribute;e.drawArcPath(t,u,h,c,p,g),o.path(u.toString(),{fill:d||void 0,stroke:f||void 0,strokeWidth:v,maxRandomnessOffset:m,roughness:y,bowing:x,curveFitting:b,curveTightness:S,curveStepCount:C,fillStyle:w,fillWeight:M,hachureAngle:P,hachureGap:k,simplification:T,dashOffset:E,dashGap:R,zigzagOffset:O,seed:B,fillLineDash:A,fillLineDashOffset:j,disableMultiStroke:I,disableMultiStrokeFill:D,preserveVertices:L,fixedDecimalPlaceDigits:_}),a.highPerformanceRestore()}drawShape(t,e,n,i,r,a,s,o){if(this.canvasRenderer.drawShape)return this.canvasRenderer.drawShape(t,e,n,i,r,a,s,o)}};gt=m([e.injectable(),y(0,e.inject(e.DefaultCanvasArcRender)),x("design:paramtypes",[Object])],gt);let mt=class extends e.DefaultCanvasAreaRender{constructor(){super(...arguments),this.style="rough"}drawSegmentItem(t,n,i,r,a,s,o,l,h,c,u,d,f,v,p){if(p)return super.drawSegmentItem(t,n,i,r,a,s,o,l,h,c,u,d,f,v,p);t.highPerformanceSave();const g=t.canvas.nativeCanvas,m=vt(g,{}),y=new e.CustomPath2D;e.drawAreaSegments(y,n,h,{offsetX:c,offsetY:u});const{maxRandomnessOffset:x=pt.maxRandomnessOffset,roughness:b=pt.roughness,bowing:S=pt.bowing,curveFitting:C=pt.curveFitting,curveTightness:w=pt.curveTightness,curveStepCount:M=pt.curveStepCount,fillStyle:P=pt.fillStyle,fillWeight:k=pt.fillWeight,hachureAngle:T=pt.hachureAngle,hachureGap:E=pt.hachureGap,simplification:R=pt.simplification,dashOffset:O=pt.dashOffset,dashGap:B=pt.dashGap,zigzagOffset:A=pt.zigzagOffset,seed:j=pt.seed,fillLineDash:I=pt.fillLineDash,fillLineDashOffset:D=pt.fillLineDashOffset,disableMultiStroke:L=pt.disableMultiStroke,disableMultiStrokeFill:_=pt.disableMultiStrokeFill,preserveVertices:W=pt.preserveVertices,fixedDecimalPlaceDigits:F=pt.fixedDecimalPlaceDigits}=o;let{fill:z,stroke:G,lineWidth:V}=o;return Array.isArray(l)?l.forEach((t=>{z=null!=z?z:t.fill,G=null!=G?G:t.stroke,V=null!=V?V:t.lineWidth})):(z=null!=z?z:l.fill,G=null!=G?G:l.stroke,V=null!=V?V:l.lineWidth),m.path(y.toString(),{fill:i?z:void 0,strokeWidth:V,maxRandomnessOffset:x,roughness:b,bowing:S,curveFitting:C,curveTightness:w,curveStepCount:M,fillStyle:P,fillWeight:k,hachureAngle:T,hachureGap:E,simplification:R,dashOffset:O,dashGap:B,zigzagOffset:A,seed:j,fillLineDash:I,fillLineDashOffset:D,disableMultiStroke:L,disableMultiStrokeFill:_,preserveVertices:W,fixedDecimalPlaceDigits:F}),t.highPerformanceRestore(),!1}};mt=m([e.injectable()],mt);let yt=class{constructor(t){this.canvasRenderer=t,this.style="rough",this.type="circle",this.numberType=e.CIRCLE_NUMBER_TYPE}draw(t,n,i,r){const{context:a}=i;if(!a)return;const s=a.canvas.nativeCanvas,o=vt(s,{}),l=e.getTheme(t).circle;let{x:h=l.x,y:c=l.y}=t.attribute;t.transMatrix.onlyTranslate()?a.onlyTranslate()||a.clearMatrix():(h=0,c=0,a.transformFromMatrix(t.transMatrix,!0));const{radius:u=l.radius,fill:d=l.fill,stroke:f=l.stroke,lineWidth:v=l.lineWidth}=t.attribute;o.circle(h,c,u,{fill:d||void 0,stroke:f||void 0,strokeWidth:v,fillStyle:"zigzag",roughness:.5})}drawShape(t,e,n,i,r,a,s,o){if(this.canvasRenderer.drawShape)return this.canvasRenderer.drawShape(t,e,n,i,r,a,s,o)}};yt=m([e.injectable(),y(0,e.inject(e.DefaultCanvasCircleRender)),x("design:paramtypes",[Object])],yt);let xt=class extends e.DefaultCanvasLineRender{constructor(){super(...arguments),this.style="rough"}drawSegmentItem(t,n,i,r,a,s,o,l,h,c,u,d,f,v,p){if(v||p)return super.drawSegmentItem(t,n,i,r,a,s,o,l,h,c,u,d,f,v,p);t.highPerformanceSave();const g=t.canvas.nativeCanvas,m=vt(g,{}),y=new e.CustomPath2D;e.drawSegments(t.camera?t:t.nativeContext,n,h,c,{offsetX:u,offsetY:d});const{maxRandomnessOffset:x=pt.maxRandomnessOffset,roughness:b=pt.roughness,bowing:S=pt.bowing,curveFitting:C=pt.curveFitting,curveTightness:w=pt.curveTightness,curveStepCount:M=pt.curveStepCount,fillStyle:P=pt.fillStyle,fillWeight:k=pt.fillWeight,hachureAngle:T=pt.hachureAngle,hachureGap:E=pt.hachureGap,simplification:R=pt.simplification,dashOffset:O=pt.dashOffset,dashGap:B=pt.dashGap,zigzagOffset:A=pt.zigzagOffset,seed:j=pt.seed,fillLineDash:I=pt.fillLineDash,fillLineDashOffset:D=pt.fillLineDashOffset,disableMultiStroke:L=pt.disableMultiStroke,disableMultiStrokeFill:_=pt.disableMultiStrokeFill,preserveVertices:W=pt.preserveVertices,fixedDecimalPlaceDigits:F=pt.fixedDecimalPlaceDigits}=o;let{fill:z,stroke:G,lineWidth:V}=o;return Array.isArray(l)?l.forEach((t=>{z=null!=z?z:t.fill,G=null!=G?G:t.stroke,V=null!=V?V:t.lineWidth})):(z=null!=z?z:l.fill,G=null!=G?G:l.stroke,V=null!=V?V:l.lineWidth),m.path(y.toString(),{fill:i?z:void 0,stroke:r?G:void 0,strokeWidth:V,maxRandomnessOffset:x,roughness:b,bowing:S,curveFitting:C,curveTightness:w,curveStepCount:M,fillStyle:P,fillWeight:k,hachureAngle:T,hachureGap:E,simplification:R,dashOffset:O,dashGap:B,zigzagOffset:A,seed:j,fillLineDash:I,fillLineDashOffset:D,disableMultiStroke:L,disableMultiStrokeFill:_,preserveVertices:W,fixedDecimalPlaceDigits:F}),t.highPerformanceRestore(),!1}};xt=m([e.injectable()],xt);let bt=class{constructor(t){this.canvasRenderer=t,this.style="rough",this.type="path",this.numberType=e.PATH_NUMBER_TYPE}draw(t,n,i,r){const{context:a}=i;if(!a)return;const s=a.canvas.nativeCanvas,o=vt(s,{});a.highPerformanceSave();const l=e.getTheme(t).path;a.transformFromMatrix(t.transMatrix,!0);const{fill:h=l.fill,stroke:c=l.stroke,lineWidth:u=l.lineWidth,path:d=l.path,maxRandomnessOffset:f=pt.maxRandomnessOffset,roughness:v=pt.roughness,bowing:p=pt.bowing,curveFitting:g=pt.curveFitting,curveTightness:m=pt.curveTightness,curveStepCount:y=pt.curveStepCount,fillStyle:x=pt.fillStyle,fillWeight:b=pt.fillWeight,hachureAngle:S=pt.hachureAngle,hachureGap:C=pt.hachureGap,simplification:w=pt.simplification,dashOffset:M=pt.dashOffset,dashGap:P=pt.dashGap,zigzagOffset:k=pt.zigzagOffset,seed:T=pt.seed,fillLineDash:E=pt.fillLineDash,fillLineDashOffset:R=pt.fillLineDashOffset,disableMultiStroke:O=pt.disableMultiStroke,disableMultiStrokeFill:B=pt.disableMultiStrokeFill,preserveVertices:A=pt.preserveVertices,fixedDecimalPlaceDigits:j=pt.fixedDecimalPlaceDigits}=t.attribute;"string"==typeof d&&o.path(d,{fill:h||void 0,stroke:c||void 0,strokeWidth:u,maxRandomnessOffset:f,roughness:v,bowing:p,curveFitting:g,curveTightness:m,curveStepCount:y,fillStyle:x,fillWeight:b,hachureAngle:S,hachureGap:C,simplification:w,dashOffset:M,dashGap:P,zigzagOffset:k,seed:T,fillLineDash:E,fillLineDashOffset:R,disableMultiStroke:O,disableMultiStrokeFill:B,preserveVertices:A,fixedDecimalPlaceDigits:j}),a.highPerformanceRestore()}drawShape(t,e,n,i,r,a,s,o){if(this.canvasRenderer.drawShape)return this.canvasRenderer.drawShape(t,e,n,i,r,a,s,o)}};bt=m([e.injectable(),y(0,e.inject(e.DefaultCanvasPathRender)),x("design:paramtypes",[Object])],bt);let St=class{constructor(t){this.canvasRenderer=t,this.style="rough",this.type="rect",this.numberType=e.RECT_NUMBER_TYPE}draw(t,n,i,r){const{context:a}=i;if(!a)return;const s=a.canvas.nativeCanvas,o=vt(s);a.highPerformanceSave();const l=e.getTheme(t).rect;let{x:h=l.x,y:c=l.y}=t.attribute;if(t.transMatrix.onlyTranslate()){const{dx:e=l.dx,dy:n=l.dy}=t.attribute;h+=e,c+=n,a.setTransformForCurrent()}else h=0,c=0,a.transformFromMatrix(t.transMatrix,!0);const{fill:u=l.fill,stroke:d=l.stroke,fillColor:f=l.fill,strokeColor:v=l.stroke,width:p=l.width,height:g=l.height,lineWidth:m=l.lineWidth,maxRandomnessOffset:y=pt.maxRandomnessOffset,roughness:x=pt.roughness,bowing:b=pt.bowing,curveFitting:S=pt.curveFitting,curveTightness:C=pt.curveTightness,curveStepCount:w=pt.curveStepCount,fillStyle:M=pt.fillStyle,fillWeight:P=pt.fillWeight,hachureAngle:k=pt.hachureAngle,hachureGap:T=pt.hachureGap,simplification:E=pt.simplification,dashOffset:R=pt.dashOffset,dashGap:O=pt.dashGap,zigzagOffset:B=pt.zigzagOffset,seed:A=pt.seed,fillLineDash:j=pt.fillLineDash,fillLineDashOffset:I=pt.fillLineDashOffset,disableMultiStroke:D=pt.disableMultiStroke,disableMultiStrokeFill:L=pt.disableMultiStrokeFill,preserveVertices:_=pt.preserveVertices,fixedDecimalPlaceDigits:W=pt.fixedDecimalPlaceDigits}=t.attribute;o.rectangle(h,c,p,g,{fill:u?f:void 0,stroke:d?v:void 0,strokeWidth:m,maxRandomnessOffset:y,roughness:x,bowing:b,curveFitting:S,curveTightness:C,curveStepCount:w,fillStyle:M,fillWeight:P,hachureAngle:k,hachureGap:T,simplification:E,dashOffset:R,dashGap:O,zigzagOffset:B,seed:A,fillLineDash:j,fillLineDashOffset:I,disableMultiStroke:D,disableMultiStrokeFill:L,preserveVertices:_,fixedDecimalPlaceDigits:W}),a.highPerformanceRestore()}drawShape(t,e,n,i,r,a,s,o){if(this.canvasRenderer.drawShape)return this.canvasRenderer.drawShape(t,e,n,i,r,a,s,o)}};St=m([e.injectable(),y(0,e.inject(e.DefaultCanvasRectRender)),x("design:paramtypes",[Object])],St);let Ct=class extends e.BaseRender{constructor(t){super(),this.canvasRenderer=t,this.type="symbol",this.numberType=e.SYMBOL_NUMBER_TYPE,this.style="rough"}draw(t,n,i,r){const{context:a}=i;if(!a)return;const s=a.canvas.nativeCanvas,o=vt(s);a.highPerformanceSave();const l=e.getTheme(t).symbol,h=this.transform(t,l,a),{x:c,y:u,z:d,lastModelMatrix:f}=h,v=t.getParsedPath();if(!v)return;const{fill:p=l.fill,stroke:g=l.stroke,fillColor:m=l.fill,strokeColor:y=l.stroke,size:x=l.size,lineWidth:b=l.lineWidth,maxRandomnessOffset:S=pt.maxRandomnessOffset,roughness:C=pt.roughness,bowing:w=pt.bowing,curveFitting:M=pt.curveFitting,curveTightness:P=pt.curveTightness,curveStepCount:k=pt.curveStepCount,fillStyle:T=pt.fillStyle,fillWeight:E=pt.fillWeight,hachureAngle:R=pt.hachureAngle,hachureGap:O=pt.hachureGap,simplification:B=pt.simplification,dashOffset:A=pt.dashOffset,dashGap:j=pt.dashGap,zigzagOffset:I=pt.zigzagOffset,seed:D=pt.seed,fillLineDash:L=pt.fillLineDash,fillLineDashOffset:_=pt.fillLineDashOffset,disableMultiStroke:W=pt.disableMultiStroke,disableMultiStrokeFill:F=pt.disableMultiStrokeFill,preserveVertices:z=pt.preserveVertices,fixedDecimalPlaceDigits:G=pt.fixedDecimalPlaceDigits}=t.attribute;let V="";if(v.drawToSvgPath)V=v.drawToSvgPath(x,c,u);else{const t=new e.CustomPath2D;v.draw(t,x,c,u)&&t.closePath(),V=t.toString()}o.path(V,{fill:p?m:void 0,stroke:g?y:void 0,strokeWidth:b,maxRandomnessOffset:S,roughness:C,bowing:w,curveFitting:M,curveTightness:P,curveStepCount:k,fillStyle:T,fillWeight:E,hachureAngle:R,hachureGap:O,simplification:B,dashOffset:A,dashGap:j,zigzagOffset:I,seed:D,fillLineDash:L,fillLineDashOffset:_,disableMultiStroke:W,disableMultiStrokeFill:F,preserveVertices:z,fixedDecimalPlaceDigits:G}),a.highPerformanceRestore()}drawShape(t,e,n,i,r,a,s,o){if(this.canvasRenderer.drawShape)return this.canvasRenderer.drawShape(t,e,n,i,r,a,s,o)}};Ct=m([e.injectable(),y(0,e.inject(e.DefaultCanvasSymbolRender)),x("design:paramtypes",[Object])],Ct);var wt=new e.ContainerModule((t=>{t(yt).toSelf().inSingletonScope(),t(e.GraphicRender).to(yt),t(St).toSelf().inSingletonScope(),t(e.GraphicRender).to(St),t(bt).toSelf().inSingletonScope(),t(e.GraphicRender).to(bt),t(Ct).toSelf().inSingletonScope(),t(e.GraphicRender).to(Ct),t(xt).toSelf().inSingletonScope(),t(e.GraphicRender).to(xt),t(mt).toSelf().inSingletonScope(),t(e.GraphicRender).to(mt),t(gt).toSelf().inSingletonScope(),t(e.GraphicRender).to(gt)}));const Mt={onPointerDown:"pointerdown",onPointerUp:"pointerup",onPointerUpOutside:"pointerupoutside",onPointerTap:"pointertap",onPointerOver:"pointerover",onPointerMove:"pointermove",onPointerEnter:"pointerenter",onPointerLeave:"pointerleave",onPointerOut:"pointerout",onMouseDown:"mousedown",onMouseUp:"mouseup",onMouseUpOutside:"mouseupoutside",onMouseMove:"mousemove",onMouseOver:"mouseover",onMouseOut:"mouseout",onMouseEnter:"mouseenter",onMouseLeave:"mouseleave",onPinch:"pinch",onPinchStart:"pinchstart",onPinchEnd:"pinchend",onPan:"pan",onPanStart:"panstart",onPanEnd:"panend",onDrag:"drag",onDragStart:"dragstart",onDragEnter:"dragenter",onDragLeave:"dragleave",onDragOver:"dragover",onDragEnd:"dragend",onRightDown:"rightdown",onRightUp:"rightup",onRightUpOutside:"rightupoutside",onTouchStart:"touchstart",onTouchEnd:"touchend",onTouchEndOutside:"touchendoutside",onTouchMove:"touchmove",onTouchCancel:"touchcancel",onPress:"press",onPressUp:"pressup",onPressEnd:"pressend",onSwipe:"swipe",onDrop:"drop",onWeel:"wheel",onClick:"click",onDblClick:"dblclick"},Pt=Object.keys(Mt);function kt(t){return e.createRichText(t?t.attribute:{})}function Tt(t,e){if(n.isArray(t))return t.forEach((t=>Tt(t,e)));e.push(t)}kt.Text=function(t){return Object.assign({type:"rich/text"},t)},kt.Image=function(t){return Object.assign({type:"rich/image"},t)};const Et=e.Group;const Rt=(t,e)=>{const n=e.x-t.x,i=e.y-t.y;return Math.abs(n)>Math.abs(i)?n>0?"right":"left":i>0?"down":"up"},Ot=(t,e)=>{const n=Math.abs(e.x-t.x),i=Math.abs(e.y-t.y);return Math.sqrt(n*n+i*i)};class Bt extends n.EventEmitter{constructor(t,n={}){var i,r,a,s,o,l,h,c,u,d;super(),this.cachedEvents=[],this.startPoints=[],this.processEvent={},this.throttleTimer=0,this.emitThrottles=[],this.onStart=t=>{this.reset(),this.startTime=e.clock.now();const{cachedEvents:n,startPoints:i}=this;t&&n.push(t.clone()),i.length=n.length;for(let t=0;t<n.length;t++){const{x:e,y:r}=n[t],a={x:e,y:r};i[t]=a}if(1!==i.length)this.startDistance=Ot(i[0],i[1]),this.center=(t=>{const e=t.length;if(1===e)return{x:Math.round(t[0].x),y:Math.round(t[0].y)};let n=0,i=0,r=0;for(;r<e;)n+=t[r].x,i+=t[r].y,r++;return{x:Math.round(n/e),y:Math.round(i/e)}})([i[0],i[1]]);else{const t=n[0];this.pressTimeout=setTimeout((()=>{const e="press",n="none";t.direction=n,t.deltaX=0,t.deltaY=0,t.points=i,this.triggerStartEvent(e,t),this.triggerEvent(e,t),this.eventType=e,this.direction=n}),this.config.press.time)}},this.onMove=t=>{this.clearPressTimeout();const{startPoints:n,cachedEvents:i}=this;if(!n.length)return;const r=t.clone(),{x:a,y:s,pointerId:o}=r;for(let t=0,e=i.length;t<e;t++)if(o===i[t].pointerId){i[t]=r;break}const l={x:a,y:s},h=i.map((t=>({x:t.x,y:t.y}))),c=e.clock.now();if(this.prevMoveTime=this.lastMoveTime,this.prevMovePoint=this.lastMovePoint,this.lastMoveTime=c,this.lastMovePoint=l,1===n.length){const t=n[0],e=a-t.x,i=s-t.y,o=this.direction||Rt(t,l);this.direction=o;const c=this.getEventType(l);return r.direction=o,r.deltaX=e,r.deltaY=i,r.points=h,this.triggerStartEvent(c,r),void this.triggerEvent(c,r)}const{startDistance:u}=this,d=Ot(h[0],h[1]);r.scale=d/u,r.center=this.center,r.points=h,this.triggerStartEvent("pinch",r),this.triggerEvent("pinch",r)},this.onEnd=t=>{const n=t.clone(),{cachedEvents:i,startPoints:r}=this,a=i.map((t=>({x:t.x,y:t.y})));if(n.points=a,this.triggerEndEvent(n),1===i.length){const t=e.clock.now(),i=this.lastMoveTime;if(t-i<100){const t=i-(this.prevMoveTime||this.startTime);if(t>0){const e=this.prevMovePoint||r[0],i=this.lastMovePoint||r[0],a=Ot(e,i),s=a/t;s>this.config.swipe.velocity&&a>this.config.swipe.threshold&&(n.velocity=s,n.direction=Rt(e,i),this.triggerEvent("swipe",n))}}t-this.lastTapTime<this.config.tap.interval?this.tapCount++:this.tapCount=1,this.lastTapTime=t,1===this.tapCount?this.triggerEvent("tap",n):2===this.tapCount&&(this.triggerEvent("doubletap",n),this.tapCount=0)}for(let t=0,e=i.length;t<e;t++)if(i[t].pointerId===n.pointerId){i.splice(t,1),r.splice(t,1);break}this.reset(),i.length>0&&this.onStart()},this.element=t,this.tapCount=0,this.lastTapTime=0,this.config={press:{time:null!==(r=null===(i=null==n?void 0:n.press)||void 0===i?void 0:i.time)&&void 0!==r?r:251,threshold:null!==(s=null===(a=null==n?void 0:n.press)||void 0===a?void 0:a.threshold)&&void 0!==s?s:9},swipe:{threshold:null!==(l=null===(o=null==n?void 0:n.swipe)||void 0===o?void 0:o.threshold)&&void 0!==l?l:10,velocity:null!==(c=null===(h=null==n?void 0:n.swipe)||void 0===h?void 0:h.velocity)&&void 0!==c?c:.3},tap:{interval:null!==(d=null===(u=null==n?void 0:n.tap)||void 0===u?void 0:u.interval)&&void 0!==d?d:300}},this.initEvents()}initEvents(){const{element:t}=this;t&&(t.addEventListener("pointerdown",this.onStart),t.addEventListener("pointermove",this.onMove),t.addEventListener("pointerup",this.onEnd),t.addEventListener("pointerupoutside",this.onEnd))}removeEvents(){const{element:t}=this;t&&(t.removeEventListener("pointerdown",this.onStart),t.removeEventListener("pointermove",this.onMove),t.removeEventListener("pointerup",this.onEnd),t.removeEventListener("pointerupoutside",this.onEnd))}release(){this.removeEvents(),this.element=null}getEventType(t){const{eventType:n,startTime:i,startPoints:r}=this;if(n)return n;let a;return a=e.clock.now()-i>this.config.press.time&&Ot(r[0],t)<this.config.press.threshold?"press":"pan",this.eventType=a,a}enable(t){this.processEvent[t]=!0}isProcess(t){return this.processEvent[t]}pushEvent(t,e){const{emitThrottles:n}=this,i={type:t,ev:e};for(let e=0,r=n.length;e<r;e++)if(n[e].type===t)return void n.splice(e,1,i);n.push(i)}clearPressTimeout(){this.pressTimeout&&(clearTimeout(this.pressTimeout),this.pressTimeout=null)}reset(){this.clearPressTimeout(),this.startTime=0,this.startDistance=0,this.direction=null,this.eventType=null,this.prevMoveTime=0,this.prevMovePoint=null,this.lastMoveTime=0,this.lastMovePoint=null}triggerEvent(t,n){this.pushEvent(t,n);const{throttleTimer:i,emitThrottles:r}=this;i||(this.throttleTimer=e.application.global.getRequestAnimationFrame()((()=>{for(let t=0,e=r.length;t<e;t++){const{type:e,ev:n}=r[t];this.emitEvent(e,n)}this.throttleTimer=0,this.emitThrottles.length=0})))}triggerStartEvent(t,e){this.isProcess(t)||(this.enable(t),this.triggerEvent(`${t}start`,e))}triggerEndEvent(t){const e=this.processEvent;Object.keys(e).forEach((n=>{this.triggerEvent(`${n}end`,t),"press"===n&&this.triggerEvent(`${n}up`,t),delete e[n]}))}emitEvent(t,n){const i=this.element._events[e.WILDCARD];if(i)if("fn"in i)i.fn.call(i.context,n,t);else for(let e=0,r=i.length;e<r&&!n.propagationImmediatelyStopped;e++)i[e].fn.call(i[e].context,n,t);this.emit(t,n)}}class At{get x1(){return this.dom.getBoundingClientRect().left}get x2(){return this.dom.getBoundingClientRect().right}get y1(){return this.dom.getBoundingClientRect().top}get y2(){return this.dom.getBoundingClientRect().bottom}get width(){return this.dom.getBoundingClientRect().width}get height(){return this.dom.getBoundingClientRect().height}constructor(t){this.dom=t}}function jt(t,e=!1){const n=document.createElement("img");if(n.crossOrigin="anonymous",e){const e=new Blob([t],{type:"image/svg+xml"});t=window.URL.createObjectURL(e)}if(n.src=t,n.complete)return Promise.resolve(n);return new Promise(((t,e)=>{n.onload=()=>{t(n)},n.onerror=()=>{e(new Error("加载失败"))}}))}let It=class extends e.BaseEnvContribution{constructor(){super(),this.type="browser",this.supportEvent=!0;try{this.supportsTouchEvents="ontouchstart"in globalThis,this.supportsPointerEvents=!!globalThis.PointerEvent,this.supportsMouseEvents=!!globalThis.MouseEvent}catch(t){this.supportsTouchEvents=!1,this.supportsPointerEvents=!1,this.supportsPointerEvents=!1}this.applyStyles=!0}mapToCanvasPoint(t,e){var i;if(e){const{clientX:r,clientY:a}=t,s=e.getBoundingClientRect(),o=null===(i=e.getNativeHandler)||void 0===i?void 0:i.call(e).nativeCanvas;let l,h;return o&&(l=s.width/o.offsetWidth,h=s.height/o.offsetHeight),{x:(r-s.left)/(n.isValidNumber(l)?l:1),y:(a-s.top)/(n.isValidNumber(h)?h:1)}}return{x:t.offsetX,y:t.offsetY}}getNativeAABBBounds(t){let e=t;if("string"==typeof t&&(e=(new DOMParser).parseFromString(t,"text/html").firstChild),e.getBoundingClientRect){const t=e.getBoundingClientRect();return new At(t)}return new n.AABBBounds}removeDom(t){return t.parentElement.removeChild(t),!0}createDom(t){const{tagName:e="div",width:i,height:r,style:a,parent:s}=t,o=document.createElement(e);if(a&&(n.isString(a)?o.setAttribute("style",a):Object.keys(a).forEach((t=>{o.setAttribute(t,a[t])}))),null!=i&&(o.style.width=`${i}px`),null!=r&&(o.style.height=`${r}px`),s){const t=n.isString(s)?this.getElementById(s):s;t&&t.appendChild&&t.appendChild(o)}return o}loadImage(t){return jt(t,!1).then((t=>({data:t,loadState:"success"}))).catch((()=>({data:null,loadState:"fail"})))}loadSvg(t){return jt(t,!0).then((t=>({data:t,loadState:"success"}))).catch((()=>({data:null,loadState:"fail"})))}createCanvas(t){var n,i;const r=document.createElement("canvas");t.id&&(r.id=null!==(n=t.id)&&void 0!==n?n:e.Generator.GenAutoIncrementId().toString());const a=null!==(i=t.dpr)&&void 0!==i?i:window.devicePixelRatio;return t.width&&t.height&&(r.style.width=`${t.width}px`,r.style.height=`${t.height}px`,r.width=t.width*a,r.height=t.height*a),r}createOffscreenCanvas(t){var e;const n=null!==(e=t.dpr)&&void 0!==e?e:window.devicePixelRatio;return new OffscreenCanvas(t.width*n,t.height*n)}releaseCanvas(t){let e;e="string"==typeof t?document.getElementById(t):t,e&&e.parentElement&&e.parentElement.removeChild(e)}getDevicePixelRatio(){return window.devicePixelRatio}getRequestAnimationFrame(){return window.requestAnimationFrame}getCancelAnimationFrame(){return window.cancelAnimationFrame}addEventListener(t,e,n){return document.addEventListener(t,e,n)}removeEventListener(t,e,n){return document.removeEventListener(t,e,n)}dispatchEvent(t){return document.dispatchEvent(t)}getElementById(t){return document.getElementById(t)}getRootElement(){return document.body}getDocument(){return document}release(...t){}getElementTop(t,e){let n=t.offsetTop,i=t.offsetParent;for(;null!==i;)n+=i.offsetTop,i=i.offsetParent;return n}getElementLeft(t,e){let n=t.offsetLeft,i=t.offsetParent;for(;null!==i;)n+=i.offsetLeft,i=i.offsetParent;return n}getElementTopLeft(t,e){let n=t.offsetTop,i=t.offsetLeft,r=t.offsetParent;for(;null!==r;)n+=r.offsetTop,i+=r.offsetLeft,r=r.offsetParent;return{top:n,left:i}}};It=m([e.injectable(),x("design:paramtypes",[])],It);let Dt=class extends e.BaseEnvContribution{constructor(){super(),this.type="feishu",this.supportEvent=!0,this.canvasMap=new Map,this.freeCanvasList=[],this.canvasIdx=0,this.supportsTouchEvents=!0;try{this.supportsPointerEvents=!!globalThis.PointerEvent,this.supportsMouseEvents=!!globalThis.MouseEvent}catch(t){this.supportsPointerEvents=!1,this.supportsMouseEvents=!1}this.applyStyles=!0}getDynamicCanvasCount(){return this.freeCanvasList.length}getStaticCanvasCount(){return this.freeCanvasList.length}configure(t,e){t.env===this.type&&(t.setActiveEnvContribution(this),function(t,e,n,i,r){const a=tt.getSystemInfoSync().pixelRatio;e.forEach(((e,s)=>{const o=tt.createCanvasContext(e);o.canvas={width:t.width*a,height:t.height*a};const l={width:t.width*a,height:t.height*a,offsetWidth:t.width,offsetHeight:t.height,id:null!=e?e:"",getContext:()=>o,getBoundingClientRect:()=>({height:t.height,width:t.width})};n.set(e,l),s>=i&&r.push(l)}))}(e.domref,e.canvasIdLists,this.canvasMap,e.freeCanvasIdx,this.freeCanvasList))}loadImage(t){return Promise.resolve({data:t,loadState:"success"})}loadSvg(t){return Promise.reject()}createCanvas(t){const e=this.freeCanvasList[this.canvasIdx]||this.freeCanvasList[this.freeCanvasList.length-1];return this.canvasIdx++,e}createOffscreenCanvas(t){}releaseCanvas(t){}getDevicePixelRatio(){return tt.getSystemInfoSync().pixelRatio}getRequestAnimationFrame(){return function(t){return e.rafBasedSto.call(t)}}getCancelAnimationFrame(){return t=>{e.rafBasedSto.clear(t)}}addEventListener(t,e,n){return null}removeEventListener(t,e,n){return null}dispatchEvent(t){return null}getElementById(t){return this.canvasMap.get(t)}getRootElement(){return null}getDocument(){return null}release(...t){}mapToCanvasPoint(t){var e;return(null===(e=null==t?void 0:t.type)||void 0===e?void 0:e.startsWith("mouse"))?t:null}};Dt=m([e.injectable(),x("design:paramtypes",[])],Dt);let Lt=class extends e.BaseEnvContribution{constructor(){super(),this.type="taro",this.supportEvent=!0,this.canvasMap=new Map,this.freeCanvasList=[],this.canvasIdx=0,this.supportsTouchEvents=!0;try{this.supportsPointerEvents=!!globalThis.PointerEvent,this.supportsMouseEvents=!!globalThis.MouseEvent}catch(t){this.supportsPointerEvents=!1,this.supportsMouseEvents=!1}this.applyStyles=!0}getDynamicCanvasCount(){return this.freeCanvasList.length}getStaticCanvasCount(){return this.freeCanvasList.length}configure(t,e){var n,i,r,a,s,o,l;t.env===this.type&&(t.setActiveEnvContribution(this),n=e.domref,i=e.canvasIdLists,r=this.canvasMap,a=e.freeCanvasIdx,s=this.freeCanvasList,o=e.taro,l=e.pixelRatio,i.forEach(((t,e)=>{const i=o.createCanvasContext(t);i.canvas={width:n.width*l,height:n.height*l},i.createRadialGradient||(i.createRadialGradient=(...t)=>i.createCircularGradient(...t)),!i.getImageData&&o.canvasGetImageData&&(i.getImageData=(e,n,i,r)=>new Promise(((a,s)=>{try{o.canvasGetImageData({canvasId:t,x:e,y:n,width:i,height:r,success(t){a(t)}})}catch(t){s(t)}})));const h={id:t,width:n.width*l,height:n.height*l,offsetWidth:n.width,offsetHeight:n.height,getContext:()=>i,getBoundingClientRect:()=>({height:n.height,width:n.width})};return r.set(t,h),e>=a&&s.push(h),h})),this.taro=e.taro,this.pixelRatio=e.pixelRatio)}loadImage(t){return Promise.resolve({data:t,loadState:"success"})}loadSvg(t){const e=window||globalThis;if(e.DOMParser){const n=(new e.DOMParser).parseFromString(t,"image/svg+xml").children[0],i=(new XMLSerializer).serializeToString(n),r=`data:image/svg+xml;charset=utf-8,${encodeURIComponent(i)}`;return Promise.resolve({data:r,loadState:"success"})}if(e.Blob){const n=new e.Blob([t],{type:"image/svg+xml"}),i=e.URL.createObjectURL(n);return Promise.resolve({data:i,loadState:"success"})}return Promise.reject()}createCanvas(t){const e=this.freeCanvasList[this.canvasIdx]||this.freeCanvasList[this.freeCanvasList.length-1];return this.canvasIdx++,e}createOffscreenCanvas(t){}releaseCanvas(t){}getDevicePixelRatio(){return this.pixelRatio}getRequestAnimationFrame(){return requestAnimationFrame}getCancelAnimationFrame(){return cancelAnimationFrame}addEventListener(t,e,n){return null}removeEventListener(t,e,n){return null}dispatchEvent(t){return null}getElementById(t){return this.canvasMap.get(t)}getRootElement(){return null}getDocument(){return null}release(...t){}};Lt=m([e.injectable(),x("design:paramtypes",[])],Lt);let _t=!1;try{_t=!!lynx.createCanvasNG}catch(t){}let Wt=class extends e.BaseEnvContribution{constructor(){super(),this.type="lynx",this.supportEvent=!0,this.canvasMap=new Map,this.freeCanvasList=[],this.canvasIdx=0,this.supportsTouchEvents=!0;try{this.supportsPointerEvents=!!globalThis.PointerEvent,this.supportsMouseEvents=!!globalThis.MouseEvent}catch(t){this.supportsPointerEvents=!1,this.supportsMouseEvents=!1}this.applyStyles=!0}configure(t,e){t.env===this.type&&(t.setActiveEnvContribution(this),function(t,e,n,i,r){const a=SystemInfo.pixelRatio;e.forEach(((e,s)=>{const o=_t?lynx.createCanvasNG(e):lynx.createCanvas(e);o.width=t.width*a,o.height=t.height*a,_t&&o.attachToCanvasView(e);const l=o.getContext("2d");l.draw=(t,e)=>{e()};const h={width:t.width*a,height:t.height*a,offsetWidth:t.width,offsetHeight:t.height,id:null!=e?e:"",getContext:()=>l,getBoundingClientRect:()=>({height:t.height,width:t.width}),nativeCanvas:o};n.set(e,h),s>=i&&r.push(h)}))}(e.domref,e.canvasIdLists,this.canvasMap,e.freeCanvasIdx,this.freeCanvasList))}getDynamicCanvasCount(){return this.freeCanvasList.length}getStaticCanvasCount(){return this.freeCanvasList.length}loadImage(t){return function(t,e=!1){if(e)return Promise.reject();const n=lynx.createImage(t);return new Promise(((t,e)=>{n.onload=()=>{t(n)},n.onerror=()=>{e(new Error("加载失败"))}}))}(t,!1).then((t=>({data:t,loadState:"success"}))).catch((()=>({data:null,loadState:"fail"})))}loadSvg(t){return Promise.reject()}createCanvas(t){const e=this.freeCanvasList[this.canvasIdx]||this.freeCanvasList[this.freeCanvasList.length-1];return this.canvasIdx++,e}createOffscreenCanvas(t){}releaseCanvas(t){}getDevicePixelRatio(){return SystemInfo.pixelRatio}getRequestAnimationFrame(){return function(t){return e.rafBasedSto.call(t)}}getCancelAnimationFrame(){return t=>{e.rafBasedSto.clear(t)}}addEventListener(t,e,n){return null}removeEventListener(t,e,n){return null}dispatchEvent(t){return null}getElementById(t){return this.canvasMap.get(t)}getRootElement(){return null}getDocument(){return null}release(...t){}};Wt=m([e.injectable(),x("design:paramtypes",[])],Wt);let Ft=class extends e.BaseEnvContribution{constructor(){super(),this.type="wx",this.supportEvent=!0,this.canvasMap=new Map,this.freeCanvasList=[],this.canvasIdx=0,this.supportsTouchEvents=!0;try{this.supportsPointerEvents=!!globalThis.PointerEvent,this.supportsMouseEvents=!!globalThis.MouseEvent}catch(t){this.supportsPointerEvents=!1,this.supportsMouseEvents=!1}this.applyStyles=!0}configure(t,e){if(t.env===this.type)return t.setActiveEnvContribution(this),function(t,e,n,i,r,a){return b(this,void 0,void 0,(function*(){const t=wx.getSystemInfoSync().pixelRatio;for(let s=0;s<e.length;s++){const o=e[s];yield new Promise((e=>{let l=wx.createSelectorQuery();a&&(l=l.in(a)),l.select(`#${o}`).fields({node:!0,size:!0}).exec((a=>{if(!a[0])return;const l=a[0].node,h=a[0].width,c=a[0].height;l.width=h*t,l.height=c*t,n.set(o,l),s>=i&&r.push(l),e(null)}))}))}}))}(e.domref,e.canvasIdLists,this.canvasMap,e.freeCanvasIdx,this.freeCanvasList,e.component).then((()=>{}))}loadImage(t){return Promise.resolve({data:t,loadState:"success"})}loadSvg(t){return Promise.reject()}createCanvas(t){const e=this.freeCanvasList[this.canvasIdx]||this.freeCanvasList[this.freeCanvasList.length-1];return this.canvasIdx++,e}createOffscreenCanvas(t){}releaseCanvas(t){}getDevicePixelRatio(){return wx.getSystemInfoSync().pixelRatio}getRequestAnimationFrame(){return function(t){return e.rafBasedSto.call(t)}}getCancelAnimationFrame(){return t=>{e.rafBasedSto.clear(t)}}addEventListener(t,e,n){return null}removeEventListener(t,e,n){return null}dispatchEvent(t){return null}getElementById(t){return this.canvasMap.get(t)}getRootElement(){return null}getDocument(){return null}release(...t){}mapToCanvasPoint(t){var e;return(null===(e=null==t?void 0:t.type)||void 0===e?void 0:e.startsWith("mouse"))?t:null}};Ft=m([e.injectable(),x("design:paramtypes",[])],Ft);let zt=class extends e.BaseEnvContribution{constructor(){super(...arguments),this.type="node",this._lastTime=0,this.supportEvent=!1}configure(t,e){t.env===this.type&&(t.setActiveEnvContribution(this),this.pkg=e)}getDynamicCanvasCount(){return 0}getStaticCanvasCount(){return 999}loadJson(t){const e=fetch(t).then((t=>t.json()));return e.then((t=>({data:t,state:"success"}))).catch((()=>({data:null,state:"fail"}))),e}loadArrayBuffer(t){return fetch(t).then((t=>t.arrayBuffer())).then((t=>({data:t,loadState:"success"}))).catch((()=>({data:null,loadState:"fail"})))}loadImage(t){const{loadImage:e}=this.pkg;return e?e(t).then((t=>({loadState:t?"success":"fail",data:t}))).catch((()=>({loadState:"fail",data:null}))):Promise.reject(new Error("node-canvas loadImage could not be found!"))}loadSvg(t){const e=this.pkg.Resvg;if(!e)return Promise.reject(new Error("@resvg/resvg-js svgParser could not be found!"));const n=new e(t).render().asPng();return this.loadImage(n)}createCanvas(t){return this.pkg.createCanvas(t.width,t.height)}releaseCanvas(t){}getDevicePixelRatio(){return 1}getRequestAnimationFrame(){return function(t){return e.rafBasedSto.call(t)}}getCancelAnimationFrame(){return t=>{e.rafBasedSto.clear(t)}}addEventListener(t,e,n){}removeEventListener(t,e,n){}getElementById(t){return null}getRootElement(){return null}dispatchEvent(t){}release(...t){}createOffscreenCanvas(t){}};zt=m([e.injectable()],zt);let Gt=!1;const Vt=new e.ContainerModule((t=>{Gt||(Gt=!0,t(It).toSelf().inSingletonScope(),t(e.EnvContribution).toService(It))}));let Yt=!1;const Nt=new e.ContainerModule((t=>{Yt||(Yt=!0,t(Dt).toSelf().inSingletonScope(),t(e.EnvContribution).toService(Dt))}));let Ht=!1;const Ut=new e.ContainerModule((t=>{Ht||(Ht=!0,t(Lt).toSelf().inSingletonScope(),t(e.EnvContribution).toService(Lt))}));let Xt=!1;new e.ContainerModule((t=>{Xt||(Xt=!0,t(Lt).toSelf().inSingletonScope(),t(e.EnvContribution).toService(Lt))}));let qt=!1;const $t=new e.ContainerModule((t=>{qt||(qt=!0,t(Wt).toSelf().inSingletonScope(),t(e.EnvContribution).toService(Wt))}));let Jt=!1;const Qt=new e.ContainerModule((t=>{Jt||(Jt=!0,t(Ft).toSelf().inSingletonScope(),t(e.EnvContribution).toService(Ft))}));let Zt=!1;const Kt=new e.ContainerModule((t=>{Zt||(Zt=!0,t(zt).toSelf().inSingletonScope(),t(e.EnvContribution).toService(zt))})),te=[0,0,0],ee=new n.Matrix(1,0,0,1,0,0);let ne=class{set fillStyle(t){this.nativeContext.fillStyle=t}get fillStyle(){return this.nativeContext.fillStyle}set font(t){this.nativeContext.font=t}get font(){return this.nativeContext.font}set globalAlpha(t){this.nativeContext.globalAlpha=t}get globalAlpha(){return this.nativeContext.globalAlpha}set lineCap(t){this.nativeContext.lineCap=t}get lineCap(){return this.nativeContext.lineCap}set lineDashOffset(t){this.nativeContext.lineDashOffset=t}get lineDashOffset(){return this.nativeContext.lineDashOffset}set lineJoin(t){this.nativeContext.lineJoin=t}get lineJoin(){return this.nativeContext.lineJoin}set lineWidth(t){this.nativeContext.lineWidth=t}get lineWidth(){return this.nativeContext.lineWidth}set miterLimit(t){this.nativeContext.miterLimit=t}get miterLimit(){return this.nativeContext.miterLimit}set shadowBlur(t){this.nativeContext.shadowBlur=t}get shadowBlur(){return this.nativeContext.shadowBlur}set shadowColor(t){this.nativeContext.shadowColor=t}get shadowColor(){return this.nativeContext.shadowColor}set shadowOffsetX(t){this.nativeContext.shadowOffsetX=t}get shadowOffsetX(){return this.nativeContext.shadowOffsetX}set shadowOffsetY(t){this.nativeContext.shadowOffsetY=t}get shadowOffsetY(){return this.nativeContext.shadowOffsetY}set strokeStyle(t){this.nativeContext.strokeStyle=t}get strokeStyle(){return this.nativeContext.strokeStyle}set textAlign(t){this.nativeContext.textAlign=t}get textAlign(){return this.nativeContext.textAlign}set textBaseline(t){this.nativeContext.textBaseline=t}get textBaseline(){return this.nativeContext.textBaseline}get inuse(){return!!this._inuse}set inuse(t){t!==!!this._inuse&&(this._inuse=t,t?(this.nativeContext.save(),this.reset()):this.nativeContext.restore())}constructor(t,i){this.fillAttributes=Object.assign(Object.assign({},e.DefaultFillStyle),{opacity:1}),this.strokeAttributes=Object.assign(Object.assign({},e.DefaultStrokeStyle),{opacity:1}),this.textAttributes=Object.assign(Object.assign({},e.DefaultTextStyle),{opacity:1}),this._clearShadowStyle=!1,this._clearFilterStyle=!1,this._clearGlobalCompositeOperationStyle=!1;const r=t.nativeCanvas.getContext("2d");if(!r)throw new Error("发生错误,获取2d上下文失败");this.nativeContext=r,this.canvas=t,this.matrix=new n.Matrix(1,0,0,1,0,0),this.stack=[],this.dpr=i,this.applyedMatrix=new n.Matrix(1,0,0,1,0,0)}reset(){this.stack.length&&console.warn("可能存在bug,matrix没有清空"),this.matrix.setValue(1,0,0,1,0,0),this.applyedMatrix=new n.Matrix(1,0,0,1,0,0),this.stack.length=0,this.nativeContext.setTransform(1,0,0,1,0,0)}getCanvas(){return this.canvas}getContext(){return this.nativeContext}setTransformForCurrent(t=!1){!t&&this.applyedMatrix.equalToMatrix(this.matrix)||(this.applyedMatrix.setValue(this.matrix.a,this.matrix.b,this.matrix.c,this.matrix.d,this.matrix.e,this.matrix.f),this.nativeContext.setTransform(this.matrix.a,this.matrix.b,this.matrix.c,this.matrix.d,this.matrix.e,this.matrix.f))}get currentMatrix(){return this.matrix}cloneMatrix(t){return e.matrixAllocate.allocateByObj(t)}clear(){this.save(),this.resetTransform(),this.nativeContext.clearRect(0,0,this.canvas.width,this.canvas.height),this.restore()}restore(){this.nativeContext.restore(),this.stack.length>0&&(e.matrixAllocate.free(this.matrix),this.matrix=this.stack.pop(),this.setTransformForCurrent(!0))}highPerformanceRestore(){this.stack.length>0&&(e.matrixAllocate.free(this.matrix),this.matrix=this.stack.pop())}rotate(t,e=!0){this.matrix.rotate(t),e&&this.setTransformForCurrent()}save(){const t=this.cloneMatrix(this.matrix);this.stack.push(t),this.nativeContext.save()}highPerformanceSave(){const t=this.cloneMatrix(this.matrix);this.stack.push(t)}scale(t,e,n=!0){this.matrix.scale(t,e),n&&this.setTransformForCurrent()}setScale(t,e,n=!0){this.matrix.setScale(t,e),n&&this.setTransformForCurrent()}scalePoint(t,e,n,i,r=!0){this.translate(n,i,!1),this.scale(t,e,!1),this.translate(-n,-i,!1),r&&this.setTransformForCurrent()}setTransform(t,e,n,i,r,a,s=!0,o=this.dpr){this.matrix.setValue(o*t,o*e,o*n,o*i,o*r,o*a),s&&this.setTransformForCurrent()}setTransformFromMatrix(t,e=!0,n=this.dpr){this.matrix.setValue(t.a*n,t.b*n,t.c*n,t.d*n,t.e*n,t.f*n),e&&this.setTransformForCurrent()}resetTransform(t=!0,e=this.dpr){this.setTransform(e,0,0,e,0,0),t&&this.setTransformForCurrent()}transform(t,e,n,i,r,a,s=!0){this.matrix.multiply(t,e,n,i,r,a),s&&this.setTransformForCurrent()}transformFromMatrix(t,e){this.matrix.multiply(t.a,t.b,t.c,t.d,t.e,t.f),e&&this.setTransformForCurrent()}translate(t,e,n=!0){this.matrix.translate(t,e),n&&this.setTransformForCurrent()}rotateDegrees(t,e=!0){const n=t*Math.PI/180;this.rotate(n,e)}rotateAbout(t,e,n,i=!0){this.translate(e,n,!1),this.rotate(t,!1),this.translate(-e,-n,!1),i&&this.setTransformForCurrent()}rotateDegreesAbout(t,e,n,i=!0){this.translate(e,n,!1),this.rotateDegrees(t,!1),this.translate(-e,-n,!1),i&&this.setTransformForCurrent()}beginPath(){this.disableBeginPath||this.nativeContext.beginPath()}clip(t,e){t?"string"==typeof t?this.nativeContext.clip(t):this.nativeContext.clip(t,e):this.nativeContext.clip()}arc(t,e,i,r,a,s,o){if(o=o||0,this.camera){const l=[];((t,e,i,r,a,s,o,l)=>{if(l)for(;i>e;)i-=n.pi2;else for(;i<e;)i+=n.pi2;const h=n.pi/3*(i>e?1:-1);let c=e,u=c;for(;u!==i;){u=h>0?Math.min(u+h,i):Math.max(u+h,i);const e=Math.abs(u-c),n=4*Math.tan(e/4)/3,l=u<c?-1:1,d=Math.cos(c),f=Math.sin(c),v=Math.cos(u),p=Math.sin(u),g=d*s+r,m=f*o+a,y=v*s+r,x=p*o+a,b=s*n*l,S=o*n*l;t.push([g-b*f,m+S*d,y+b*p,x-S*v,y,x]),c=u}})(l,r,a,t,e,i,i,s);for(let t=0;t<l.length;++t){const e=l[t];this.bezierCurveTo(e[0],e[1],e[2],e[3],e[4],e[5],o)}}else this.nativeContext.arc(t,e,i,r,a,s)}arcTo(t,e,n,i,r){this.nativeContext.arcTo(t,e,n,i,r)}bezierCurveTo(t,n,i,r,a,s,o){if(o=o||0,this.camera){let l=o,h=o;this.modelMatrix&&(e.transformMat4(te,[t,n,o],this.modelMatrix),t=te[0],n=te[1],l=te[2],e.transformMat4(te,[i,r,o],this.modelMatrix),i=te[0],r=te[1],h=te[2],e.transformMat4(te,[a,s,o],this.modelMatrix),a=te[0],s=te[1],o=te[2]);let c=this.camera.vp(a,s,o);a=c.x,s=c.y,c=this.camera.vp(t,n,l),t=c.x,n=c.y,c=this.camera.vp(i,r,h),i=c.x,r=c.y}this.nativeContext.bezierCurveTo(t,n,i,r,a,s)}closePath(){this.nativeContext.closePath()}ellipse(t,e,n,i,r,a,s,o){null==o?this.nativeContext.ellipse(t,e,n,i,r,a,s):this.nativeContext.ellipse(t,e,n,i,r,a,s,o)}lineTo(t,n,i){if(i=i||0,this.camera){this.modelMatrix&&(e.transformMat4(te,[t,n,i],this.modelMatrix),t=te[0],n=te[1],i=te[2]);const r=this.camera.vp(t,n,i);t=r.x,n=r.y}this.nativeContext.lineTo(t,n)}moveTo(t,n,i){if(i=i||0,this.camera){this.modelMatrix&&(e.transformMat4(te,[t,n,i],this.modelMatrix),t=te[0],n=te[1],i=te[2]);const r=this.camera.vp(t,n,i);t=r.x,n=r.y}this.nativeContext.moveTo(t,n)}quadraticCurveTo(t,n,i,r,a){if(a=a||0,this.camera){let s=a;this.modelMatrix&&(e.transformMat4(te,[t,n,a],this.modelMatrix),t=te[0],n=te[1],s=te[2],e.transformMat4(te,[i,r,a],this.modelMatrix),i=te[0],r=te[1],a=te[2]);let o=this.camera.vp(i,r,a);i=o.x,r=o.y,o=this.camera.vp(t,n,s),t=o.x,n=o.y}this.nativeContext.quadraticCurveTo(t,n,i,r)}rect(t,e,n,i,r){r=r||0,this.camera?(this.moveTo(t,e,r),this.lineTo(t+n,e,r),this.lineTo(t+n,e+i,r),this.lineTo(t,e+i,r),this.closePath()):this.nativeContext.rect(t,e,n,i)}createImageData(){const t=arguments;return 2===t.length?this.nativeContext.createImageData(t[0],t[1]):1===t.length?this.nativeContext.createImageData(t[0]):null}createLinearGradient(t,e,n,i){return this.nativeContext.createLinearGradient(t,e,n,i)}createPattern(t,e){return 0===t.width||0===t.height?null:this.nativeContext.createPattern(t,e)}createRadialGradient(t,e,n,i,r,a){return this.nativeContext.createRadialGradient(t,e,n,i,r,a)}createConicGradient(t,n,i,r){let a,s=!1;const o=this;return{stops:[],addColorStop(t,e){this.stops.push([t,e]),s=!0},GetPattern(l,h,c){return s&&(c||(c=r-i),a=e.createConicalGradient(o,this.stops,t,n,c,i,r,l,h),s=!1),a}}}fill(t,e){this.disableFill||(t?this.nativeContext.fill(t):this.nativeContext.fill())}fillRect(t,e,n,i){this.nativeContext.fillRect(t,e,n,i)}clearRect(t,e,n,i){this.nativeContext.clearRect(t,e,n,i)}project(t,n,i){if(i=i||0,this.camera){this.modelMatrix&&(e.transformMat4(te,[t,n,i],this.modelMatrix),t=te[0],n=te[1],i=te[2]);const r=this.camera.vp(t,n,i);t=r.x,n=r.y}return{x:t,y:n}}view(t,n,i){return i=i||0,this.camera?(this.modelMatrix&&(e.transformMat4(te,[t,n,i],this.modelMatrix),t=te[0],n=te[1],i=te[2]),this.camera.view(t,n,i)):[t,n,i]}fillText(t,n,i,r){if(r=r||0,this.camera){this.modelMatrix&&(e.transformMat4(te,[n,i,r],this.modelMatrix),n=te[0],i=te[1],r=te[2]);const t=this.camera.vp(n,i,r);n=t.x,i=t.y}this.nativeContext.fillText(t,n,i)}getImageData(t,e,n,i){return this.nativeContext.getImageData(t,e,n,i)}getLineDash(){return this.nativeContext.getLineDash()}isPointInPath(t,e){return this.nativeContext.isPointInPath(t,e)}isPointInStroke(t,e){return this.nativeContext.isPointInStroke(t,e)}measureText(t,n=e.application.global.measureTextMethod){var i,r;return n&&"native"!==n?(this.mathTextMeasure||(this.mathTextMeasure=e.application.graphicUtil.createTextMeasureInstance({},{},(()=>this.canvas))),this.mathTextMeasure.textSpec.fontFamily=null!==(i=this.fontFamily)&&void 0!==i?i:e.DefaultTextStyle.fontFamily,this.mathTextMeasure.textSpec.fontSize=null!==(r=this.fontSize)&&void 0!==r?r:e.DefaultTextStyle.fontSize,this.mathTextMeasure._numberCharSize=null,this.mathTextMeasure._fullCharSize=null,this.mathTextMeasure._letterCharSize=null,this.mathTextMeasure._specialCharSizeMap={},this.mathTextMeasure.measure(t,n)):this.nativeContext.measureText(t)}putImageData(t,e,n){this.nativeContext.putImageData(t,e,n)}setLineDash(t){const e=arguments,n=this.nativeContext;this.nativeContext.setLineDash?n.setLineDash(e[0]):"mozDash"in n?n.mozDash=e[0]:"webkitLineDash"in n&&(n.webkitLineDash=e[0])}stroke(t){this.disableStroke||(t?this.nativeContext.stroke(t):this.nativeContext.stroke())}strokeRect(t,e,n,i){this.nativeContext.strokeRect(t,e,n,i)}strokeText(t,n,i,r){if(r=r||0,this.camera){this.modelMatrix&&(e.transformMat4(te,[n,i,r],this.modelMatrix),n=te[0],i=te[1],r=te[2]);const t=this.camera.vp(n,i,r);n=t.x,i=t.y}this.nativeContext.strokeText(t,n,i)}drawImage(){const t=this.nativeContext,e=arguments;3===e.length?t.drawImage(e[0],e[1],e[2]):5===e.length?t.drawImage(e[0],e[1],e[2],e[3],e[4]):9===e.length&&t.drawImage(e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8])}setCommonStyle(t,e,n,i,r){if(Array.isArray(r)){if(r.length<=1)return this._setCommonStyle(t,e,n,i,r[0]);const a={};return r.forEach((t=>{Object.assign(a,t)})),this._setCommonStyle(t,e,n,i,a)}return this._setCommonStyle(t,e,n,i,r)}_setCommonStyle(t,n,i,r,a){const s=this.nativeContext;a||(a=this.fillAttributes);const{fillOpacity:o=a.fillOpacity,opacity:l=a.opacity,fill:h=a.fill}=n;o>1e-12&&l>1e-12?(s.globalAlpha=o*l,s.fillStyle=e.createColor(this,h,t,i,r)):s.globalAlpha=o*l}setShadowBlendStyle(t,e,n){if(Array.isArray(n)){if(n.length<=1)return this._setShadowBlendStyle(t,n[0]);const i={};return n.forEach((t=>{Object.assign(i,t)})),this._setShadowBlendStyle(t,e,i)}return this._setShadowBlendStyle(t,e,n)}_setShadowBlendStyle(t,e,n){const i=this.nativeContext;n||(n=this.fillAttributes);const{opacity:r=n.opacity,shadowBlur:a=n.shadowBlur,shadowColor:s=n.shadowColor,shadowOffsetX:o=n.shadowOffsetX,shadowOffsetY:l=n.shadowOffsetY,blur:h=n.blur,globalCompositeOperation:c=n.globalCompositeOperation}=e;r<=1e-12||(a||o||l?(i.shadowBlur=a,i.shadowColor=s,i.shadowOffsetX=o,i.shadowOffsetY=l,this._clearShadowStyle=!0):this._clearShadowStyle&&(i.shadowBlur=0,i.shadowOffsetX=0,i.shadowOffsetY=0),h?(i.filter=`blur(${h}px)`,this._clearFilterStyle=!0):this._clearFilterStyle&&(i.filter="blur(0px)",this._clearFilterStyle=!1),c?(i.globalCompositeOperation=c,this._clearGlobalCompositeOperationStyle=!0):this._clearGlobalCompositeOperationStyle&&(i.globalCompositeOperation="source-over",this._clearGlobalCompositeOperationStyle=!1))}setStrokeStyle(t,e,n,i,r){if(Array.isArray(r)){if(r.length<=1)return this._setStrokeStyle(t,e,n,i,r[0]);const a={};return r.forEach((t=>{Object.assign(a,t)})),this._setStrokeStyle(t,e,n,i,a)}return this._setStrokeStyle(t,e,n,i,r)}_setStrokeStyle(t,n,i,r,a){const s=this.nativeContext;a||(a=this.strokeAttributes);const{strokeOpacity:o=a.strokeOpacity,opacity:l=a.opacity}=n;if(o>1e-12&&l>1e-12){const{lineWidth:h=a.lineWidth,stroke:c=a.stroke,lineJoin:u=a.lineJoin,lineDash:d=a.lineDash,lineCap:f=a.lineCap,miterLimit:v=a.miterLimit}=n;s.globalAlpha=o*l,s.lineWidth=e.getScaledStroke(this,h,this.dpr),s.strokeStyle=e.createColor(this,c,t,i,r),s.lineJoin=u,s.setLineDash(d),s.lineCap=f,s.miterLimit=v}}setTextStyleWithoutAlignBaseline(t,n,i){const r=this.nativeContext;n||(n=this.textAttributes);const{scaleIn3d:a=n.scaleIn3d}=t;t.font?r.font=t.font:r.font=e.getContextFont(t,n,a&&this.camera&&this.camera.getProjectionScale(i));const{fontFamily:s=n.fontFamily,fontSize:o=n.fontSize}=t;this.fontFamily=s,this.fontSize=o,r.textAlign="left",r.textBaseline="alphabetic"}setTextStyle(t,n,i){var r,a;const s=this.nativeContext;n||(n=this.textAttributes),t.font?s.font=t.font:s.font=e.getContextFont(t,n,this.camera&&this.camera.getProjectionScale(i));const{fontFamily:o=n.fontFamily,fontSize:l=n.fontSize}=t;this.fontFamily=o,this.fontSize=l,s.textAlign=null!==(r=t.textAlign)&&void 0!==r?r:n.textAlign,s.textBaseline=null!==(a=t.textBaseline)&&void 0!==a?a:n.textBaseline}draw(){}clearMatrix(t=!0,e=this.dpr){this.setTransformFromMatrix(ee,t,e)}onlyTranslate(t=this.dpr){return this.matrix.a===t&&0===this.matrix.b&&0===this.matrix.c&&this.matrix.d===t}release(...t){this.stack.forEach((t=>e.matrixAllocate.free(t))),this.stack.length=0}};ne.env="browser",ne=m([e.injectable(),x("design:paramtypes",[Object,Number])],ne);let ie=class extends e.BaseCanvas{constructor(t){super(t)}init(t){const{container:n}=t;if("string"==typeof n){const t=e.application.global.getElementById(n);t&&(this._container=t)}else this._container=n;this._context=new ne(this,this._dpr),this.initStyle()}initStyle(){if(!this.controled)return;const{nativeCanvas:t}=this;t.width=this._pixelWidth,t.height=this._pixelHeight;!t.style||this.setCanvasStyle(t,this._x,this._y,this._displayWidth,this._displayHeight),null!=this.id&&(t.id=this.id.toString()),this._container&&this._container.appendChild(t),this.visiable||this.hide()}hide(){this._nativeCanvas&&(this._nativeCanvas.style.display="none")}show(){this._nativeCanvas&&(this._nativeCanvas.style.display="block")}applyPosition(){const t=this._nativeCanvas;t.style.position="absolute",t.style.top=`${this._y}px`,t.style.left=`${this._x}px`}resetStyle(t){if(!this.controled)return;const{width:e=this._displayWidth,height:n=this._displayHeight,dpr:i=this._dpr,x:r=this._x,y:a=this._y}=t,{nativeCanvas:s}=this;s.width=e*i,s.height=n*i;!s.style||this.setCanvasStyle(s,r,a,e,n),t.id&&(s.id=t.id),this.visiable||this.hide()}setCanvasStyle(t,e,n,i,r){this.controled&&(t.style.padding="0",t.style.margin="0",t.style.border="0",t.style.background="transparent",t.style.width=`${i}px`,t.style.height=`${r}px`)}toDataURL(t,e){return"image/jpeg"===t?this._nativeCanvas.toDataURL(t,e):"image/png"===t?this._nativeCanvas.toDataURL(t):this._nativeCanvas.toDataURL(t,e)}resize(t,e){if(!this.controled)return;this._pixelWidth=t*this._dpr,this._pixelHeight=e*this._dpr,this._displayWidth=t,this._displayHeight=e,this._nativeCanvas.style&&(this._nativeCanvas.style.width=`${t}px`,this._nativeCanvas.style.height=`${e}px`),this._nativeCanvas.width=this._pixelWidth,this._nativeCanvas.height=this._pixelHeight;this._context.dpr=this._dpr}};function re(t,n){return new e.ContainerModule((i=>{i(e.CanvasFactory).toDynamicValue((()=>e=>new t(e))).whenTargetNamed(t.env),i(e.Context2dFactory).toDynamicValue((()=>(t,e)=>new n(t,e))).whenTargetNamed(n.env)}))}ie.env="browser",ie=m([e.injectable(),x("design:paramtypes",[Object])],ie);const ae=re(ie,ne),se=Symbol.for("MathPickerContribution"),oe=Symbol.for("MathArcPicker"),le=Symbol.for("MathAreaPicker"),he=Symbol.for("MathCirclePicker"),ce=Symbol.for("MathLinePicker"),ue=Symbol.for("MathPathPicker"),de=Symbol.for("MathRectPicker"),fe=Symbol.for("MathSymbolPicker"),ve=Symbol.for("MathTextPicker"),pe=Symbol.for("MathPolygonPicker"),ge=Symbol.for("MathGlyphPicker"),me=Symbol.for("CanvasArcPicker"),ye=Symbol.for("CanvasArc3dPicker"),xe=Symbol.for("CanvasAreaPicker"),be=Symbol.for("CanvasCirclePicker"),Se=Symbol.for("CanvasImagePicker"),Ce=Symbol.for("CanvasLinePicker"),we=Symbol.for("CanvasPathPicker"),Me=Symbol.for("CanvasRectPicker"),Pe=Symbol.for("CanvasRect3dPicker"),ke=Symbol.for("CanvasSymbolPicker"),Te=Symbol.for("CanvasTextPicker"),Ee=Symbol.for("CanvasPolygonPicker"),Re=Symbol.for("CanvasPyramid3dPicker"),Oe=Symbol.for("CanvasRichTextPicker"),Be=Symbol.for("CanvasGlyphPicker"),Ae=Symbol.for("CanvasGroupPicker"),je=Symbol.for("CanvasPickerContribution");let Ie=class extends e.DefaultPickService{constructor(t,e,n,i,r,a,s,o,l,h,c,u,d,f,v){super(f,v),this.contributions=t,this.circlePicker=e,this.rectPicker=n,this.arcPicker=i,this.areaPicker=r,this.imagePicker=a,this.linePicker=s,this.pathPicker=o,this.symbolPicker=l,this.textPicker=h,this.polygonPicker=c,this.richtextPicker=u,this.drawContribution=d,this.global=f,this.pickItemInterceptorContributions=v,this.global.hooks.onSetEnv.tap("canvas-picker-service",((t,e,n)=>{this.configure(n,e)})),this.configure(this.global,this.global.env),this.pickerMap=new Map}init(){this.contributions.getContributions().forEach((t=>{this.pickerMap.set(t.numberType,t)})),super._init()}configure(t,n){const i={width:100,height:100,nativeCanvas:t.createCanvas({width:100,height:100}),id:"for-pick"};this.pickCanvas=e.wrapCanvas(i),this.pickContext=this.pickCanvas.getContext("2d")}pickItem(t,e,n,i){if(!1===t.attribute.pickable)return null;if(this.InterceptorContributions.length)for(let r=0;r<this.InterceptorContributions.length;r++){const a=this.InterceptorContributions[r];if(a.beforePickItem){const r=a.beforePickItem(t,this,e,i,{parentMatrix:n});if(r)return r}}const r=this.pickerMap.get(t.numberType);if(!r)return null;const a=r.contains(t,e,i)?t:null,s={graphic:a};if(a)return s;if(this.InterceptorContributions.length)for(let r=0;r<this.InterceptorContributions.length;r++){const a=this.InterceptorContributions[r];if(a.afterPickItem){const r=a.afterPickItem(t,this,e,i,{parentMatrix:n});if(r)return r}}return s}};m([e.postConstruct(),x("design:type",Function),x("design:paramtypes",[]),x("design:returntype",void 0)],Ie.prototype,"init",null),Ie=m([e.injectable(),y(0,e.inject(e.ContributionProvider)),y(0,e.named(je)),y(1,e.inject(be)),y(2,e.inject(Me)),y(3,e.inject(me)),y(4,e.inject(xe)),y(5,e.inject(Se)),y(6,e.inject(Ce)),y(7,e.inject(we)),y(8,e.inject(ke)),y(9,e.inject(Te)),y(10,e.inject(Ee)),y(11,e.inject(Oe)),y(12,e.inject(e.DrawContribution)),y(13,e.inject(e.VGlobal)),y(14,e.inject(e.ContributionProvider)),y(14,e.named(e.PickItemInterceptor)),x("design:paramtypes",[Object,Object,Object,Object,Object,Object,Object,Object,Object,Object,Object,Object,Object,Object,Object])],Ie);let De=class{constructor(t){this.canvasRenderer=t,this.type="circle",this.numberType=e.CIRCLE_NUMBER_TYPE}contains(t,n,i){if(!t.AABBBounds.containsPoint(n))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:r}=null!=i?i:{};if(!r)return!1;const a=e.getTheme(t).circle;let{x:s=a.x,y:o=a.y}=t.attribute;if(r.highPerformanceSave(),t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(a);s+=e.x,o+=e.y,r.setTransformForCurrent()}else s=0,o=0,r.transformFromMatrix(t.transMatrix,!0);let l=!1;return this.canvasRenderer.drawShape(t,r,s,o,{},null,((t,e,i)=>!!l||(l=t.isPointInPath(n.x,n.y),l)),((t,i,a)=>{if(l)return!0;const s=i.lineWidth||a.lineWidth;return r.lineWidth=e.getScaledStroke(r,s,r.dpr),l=t.isPointInStroke(n.x,n.y),l})),r.highPerformanceRestore(),l}};De=m([e.injectable(),y(0,e.inject(e.CircleRender)),x("design:paramtypes",[Object])],De);const Le=new n.AABBBounds;let _e=class{constructor(t){this.canvasRenderer=t,this.type="rect",this.numberType=e.RECT_NUMBER_TYPE}contains(t,i,r){if(!t.AABBBounds.containsPoint(i))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:a}=null!=r?r:{};if(!a)return!1;const s=e.getTheme(t).rect,{cornerRadius:o=s.cornerRadius}=t.attribute;let{x:l=s.x,y:h=s.y}=t.attribute;a.highPerformanceSave();let c=!0;if(t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(s);l+=e.x,h+=e.y,a.setTransformForCurrent()}else l=0,h=0,c=!1,a.transformFromMatrix(t.transMatrix,!0);let u=!0;if(!c||t.shadowRoot||n.isNumber(o,!0)&&0!==o||n.isArray(o)&&o.some((t=>0!==t)))u=!1,this.canvasRenderer.drawShape(t,a,l,h,{},null,((t,e,n)=>!!u||(u=t.isPointInPath(i.x,i.y),u)),((t,n,r)=>{if(u)return!0;const s=n.lineWidth||r.lineWidth;return a.lineWidth=e.getScaledStroke(a,s,a.dpr),u=t.isPointInStroke(i.x,i.y),u}));else{const{fill:e=s.fill,stroke:n=s.stroke,lineWidth:r=s.lineWidth}=t.attribute;if(e)u=!0;else if(n){const e=t.AABBBounds;Le.setValue(e.x1,e.y1,e.x2,e.y2),Le.expand(-r/2),u=!Le.containsPoint(i)}}return a.highPerformanceRestore(),u}};_e=m([e.injectable(),y(0,e.inject(e.RectRender)),x("design:paramtypes",[Object])],_e);let We=class{constructor(t){this.canvasRenderer=t,this.type="arc",this.numberType=e.ARC_NUMBER_TYPE}contains(t,n,i){if(!t.AABBBounds.containsPoint(n))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:r}=null!=i?i:{};if(!r)return!1;const a=e.getTheme(t).arc;r.highPerformanceSave();let{x:s=a.x,y:o=a.y}=t.attribute;if(t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(a);s+=e.x,o+=e.y,r.setTransformForCurrent()}else s=0,o=0,r.transformFromMatrix(t.transMatrix,!0);let l=!1;return this.canvasRenderer.drawShape(t,r,s,o,{},null,((t,e,i)=>!!l||(l=t.isPointInPath(n.x,n.y),l)),((t,i,a)=>{if(l)return!0;const s=i.lineWidth||a.lineWidth;return r.lineWidth=e.getScaledStroke(r,s,r.dpr),l=t.isPointInStroke(n.x,n.y),l})),r.highPerformanceRestore(),l}};We=m([e.injectable(),y(0,e.inject(e.ArcRender)),x("design:paramtypes",[Object])],We);let Fe=class{constructor(t){this.canvasRenderer=t,this.type="area",this.numberType=e.AREA_NUMBER_TYPE}contains(t,n,i){if(!t.AABBBounds.containsPoint(n))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:r}=null!=i?i:{};if(!r)return!1;const a=e.getTheme(t).area;let{x:s=a.x,y:o=a.y}=t.attribute;if(r.highPerformanceSave(),t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(a);s+=e.x,o+=e.y,r.setTransformForCurrent()}else s=0,o=0,r.transformFromMatrix(t.transMatrix,!0);let l=!1;return this.canvasRenderer.drawShape(t,r,s,o,{},null,(t=>!!l||(l=t.isPointInPath(n.x,n.y),l))),r.highPerformanceRestore(),l}};Fe=m([e.injectable(),y(0,e.inject(e.AreaRender)),x("design:paramtypes",[Object])],Fe);let ze=class{constructor(){this.type="image",this.numberType=e.IMAGE_NUMBER_TYPE}contains(t,e,n){const{pickContext:i}=null!=n?n:{};return!!i&&!!t.AABBBounds.containsPoint(e)}};ze=m([e.injectable()],ze);let Ge=class extends e.BaseRender{};Ge=m([e.injectable()],Ge);let Ve=class extends Ge{constructor(t){super(),this.canvasRenderer=t,this.type="line",this.numberType=e.LINE_NUMBER_TYPE}contains(t,n,i){if(!t.AABBBounds.containsPoint(n))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:r}=null!=i?i:{};if(!r)return!1;r.highPerformanceSave();const a=e.getTheme(t).line,s=this.transform(t,a,r),{x:o,y:l,z:h,lastModelMatrix:c}=s;let u=n;if(r.camera){u=n.clone();const e=t.parent.globalTransMatrix;u.x=e.a*n.x+e.c*n.y+e.e,u.y=e.b*n.x+e.d*n.y+e.f}this.canvasRenderer.z=h;let d=!1;return this.canvasRenderer.drawShape(t,r,o,l,{},null,(t=>!!d||(d=t.isPointInPath(u.x,u.y),d)),((t,n,i)=>{if(d)return!0;const a=n.lineWidth||i.lineWidth;return r.lineWidth=e.getScaledStroke(r,a,r.dpr),d=t.isPointInStroke(u.x,u.y),d})),this.canvasRenderer.z=0,r.modelMatrix!==c&&e.mat4Allocate.free(r.modelMatrix),r.modelMatrix=c,r.highPerformanceRestore(),d}};Ve=m([e.injectable(),y(0,e.inject(e.LineRender)),x("design:paramtypes",[Object])],Ve);let Ye=class extends Ge{constructor(t){super(),this.canvasRenderer=t,this.type="path",this.numberType=e.PATH_NUMBER_TYPE}contains(t,n,i){if(!t.AABBBounds.containsPoint(n))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:r}=null!=i?i:{};if(!r)return!1;const a=e.getTheme(t).path;r.highPerformanceSave();const s=this.transform(t,a,r),{x:o,y:l,z:h,lastModelMatrix:c}=s;let u=n;if(r.camera){u=n.clone();const e=t.parent.globalTransMatrix;u.x=e.a*n.x+e.c*n.y+e.e,u.y=e.b*n.x+e.d*n.y+e.f}this.canvasRenderer.z=h;let d=!1;return this.canvasRenderer.drawShape(t,r,o,l,{},null,((t,e,n)=>!!d||(d=t.isPointInPath(u.x,u.y),d)),((t,n,i)=>{if(d)return!0;const a=n.lineWidth||i.lineWidth;return r.lineWidth=e.getScaledStroke(r,a,r.dpr),d=t.isPointInStroke(u.x,u.y),d})),this.canvasRenderer.z=0,r.modelMatrix!==c&&e.mat4Allocate.free(r.modelMatrix),r.modelMatrix=c,r.highPerformanceRestore(),d}};Ye=m([e.injectable(),y(0,e.inject(e.PathRender)),x("design:paramtypes",[Object])],Ye);let Ne=class extends Ge{constructor(t){super(),this.canvasRenderer=t,this.type="symbol",this.numberType=e.SYMBOL_NUMBER_TYPE}contains(t,n,i){const{pickContext:r}=null!=i?i:{};if(!r)return!1;const a=t.getParsedPath();if(!r.camera){if(!t.AABBBounds.containsPoint(n))return!1;if(a.isSvg||"imprecise"===t.attribute.pickMode)return!0}r.highPerformanceSave();const s=e.getTheme(t).symbol,o=this.transform(t,s,r),{x:l,y:h,z:c,lastModelMatrix:u}=o;let d=n;if(r.camera){d=n.clone();const e=t.parent.globalTransMatrix;d.x=e.a*n.x+e.c*n.y+e.e,d.y=e.b*n.x+e.d*n.y+e.f}this.canvasRenderer.z=c;let f=!1;return this.canvasRenderer.drawShape(t,r,l,h,{},null,((t,e,n)=>!!f||(f=t.isPointInPath(d.x,d.y),f)),((t,n,i)=>{if(f)return!0;const a=n.lineWidth||i.lineWidth;return r.lineWidth=e.getScaledStroke(r,a,r.dpr),f=t.isPointInStroke(d.x,d.y),f})),this.canvasRenderer.z=0,r.modelMatrix!==u&&e.mat4Allocate.free(r.modelMatrix),r.modelMatrix=u,r.highPerformanceRestore(),f}};Ne=m([e.injectable(),y(0,e.inject(e.SymbolRender)),x("design:paramtypes",[Object])],Ne);let He=class extends Ge{constructor(t){super(),this.canvasRenderer=t,this.type="text",this.numberType=e.TEXT_NUMBER_TYPE}contains(t,n,i){const{pickContext:r}=null!=i?i:{};if(!r)return!1;const a=t.AABBBounds;if(!r.camera)return!!a.containsPoint(n);r.highPerformanceSave();const s=e.getTheme(t).text,{keepDirIn3d:o=s.keepDirIn3d}=t.attribute,l=!o,h=this.transform(t,s,r,l),{x:c,y:u,z:d,lastModelMatrix:f}=h;this.canvasRenderer.z=d;let v=n;if(r.camera){v=n.clone();const e=t.parent.globalTransMatrix;v.x=e.a*n.x+e.c*n.y+e.e,v.y=e.b*n.x+e.d*n.y+e.f}let p=!1;return this.canvasRenderer.drawShape(t,r,c,u,{},null,((n,i,r)=>{if(p)return!0;const{fontSize:a=s.fontSize,textBaseline:o=s.textBaseline,textAlign:l=s.textAlign}=t.attribute,h=t.AABBBounds,f=h.height(),g=h.width(),m=e.textLayoutOffsetY(o,f,a),y=e.textDrawOffsetX(l,g);return n.rect(y+c,m+u,g,f,d),p=n.isPointInPath(v.x,v.y),p}),((t,e,n)=>p)),this.canvasRenderer.z=0,r.modelMatrix!==f&&e.mat4Allocate.free(r.modelMatrix),r.modelMatrix=f,r.highPerformanceRestore(),p}};He=m([e.injectable(),y(0,e.inject(e.TextRender)),x("design:paramtypes",[Object])],He);let Ue=class{constructor(t){this.canvasRenderer=t,this.type="polygon",this.numberType=e.POLYGON_NUMBER_TYPE}contains(t,n,i){if(!t.AABBBounds.contains(n.x,n.y))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:r}=null!=i?i:{};if(!r)return!1;const a=e.getTheme(t).polygon;let{x:s=a.x,y:o=a.y}=t.attribute;if(r.highPerformanceSave(),t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(a);s+=e.x,o+=e.y,r.setTransformForCurrent()}else s=0,o=0,r.transformFromMatrix(t.transMatrix,!0);let l=!1;return this.canvasRenderer.drawShape(t,r,s,o,{},null,((t,e,i)=>!!l||(l=t.isPointInPath(n.x,n.y),l)),((t,e,i)=>{if(l)return!0;const a=e.lineWidth||i.lineWidth;return r.lineWidth=a,l=t.isPointInStroke(n.x,n.y),l})),r.highPerformanceRestore(),l}};Ue=m([e.injectable(),y(0,e.inject(e.PolygonRender)),x("design:paramtypes",[Object])],Ue);let Xe=class{constructor(t){this.canvasRenderer=t,this.type="richtext",this.numberType=e.RICHTEXT_NUMBER_TYPE}contains(t,e,n){return!!t.AABBBounds.containsPoint(e)}};Xe=m([e.injectable(),y(0,e.inject(e.RichTextRender)),x("design:paramtypes",[Object])],Xe);let qe=class{constructor(t){this.canvasRenderer=t,this.type="glyph",this.numberType=e.GLYPH_NUMBER_TYPE}contains(t,e,n){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:i}=null!=n?n:{};if(!i)return!1;const r=null==n?void 0:n.pickerService;if(r){let i=!1;return t.getSubGraphic().forEach((t=>{if(i)return;const a=r.pickItem(t,e,null,n);i=!(!a||!a.graphic)})),i}return!1}};qe=m([e.injectable(),y(0,e.inject(e.GlyphRender)),x("design:paramtypes",[Object])],qe),new n.AABBBounds;let $e=class extends Ge{constructor(t){super(),this.canvasRenderer=t,this.type="rect3d",this.numberType=e.RECT3D_NUMBER_TYPE}contains(t,n,i){const{pickContext:r}=null!=i?i:{};if(!r)return!1;const a=e.getTheme(t).rect;r.highPerformanceSave();const s=this.transform(t,a,r),{x:o,y:l,z:h,lastModelMatrix:c}=s;let u=n;if(r.camera){u=n.clone();const e=t.parent.globalTransMatrix;u.x=e.a*n.x+e.c*n.y+e.e,u.y=e.b*n.x+e.d*n.y+e.f}this.canvasRenderer.z=h;let d=!1;return this.canvasRenderer.drawShape(t,r,o,l,i,null,((t,e,n)=>!!d||(d=t.isPointInPath(u.x,u.y),d))),this.canvasRenderer.z=0,r.modelMatrix!==c&&e.mat4Allocate.free(r.modelMatrix),r.modelMatrix=c,r.highPerformanceRestore(),d}};$e=m([e.injectable(),y(0,e.inject(e.Rect3DRender)),x("design:paramtypes",[Object])],$e);let Je=class extends Ge{constructor(t){super(),this.canvasRenderer=t,this.type="pyramid3d",this.numberType=e.PYRAMID3D_NUMBER_TYPE}contains(t,n,i){const{pickContext:r}=null!=i?i:{};if(!r)return!1;const a=e.getTheme(t).polygon;r.highPerformanceSave();const s=this.transform(t,a,r),{x:o,y:l,z:h,lastModelMatrix:c}=s;let u=n;if(r.camera){u=n.clone();const e=t.parent.globalTransMatrix;u.x=e.a*n.x+e.c*n.y+e.e,u.y=e.b*n.x+e.d*n.y+e.f}this.canvasRenderer.z=h;let d=!1;return this.canvasRenderer.drawShape(t,r,o,l,{},null,((t,e,n)=>!!d||(d=t.isPointInPath(u.x,u.y),d)),((t,e,n)=>!1)),this.canvasRenderer.z=0,r.modelMatrix!==c&&e.mat4Allocate.free(r.modelMatrix),r.modelMatrix=c,r.highPerformanceRestore(),d}};Je=m([e.injectable(),y(0,e.inject(e.Pyramid3dRender)),x("design:paramtypes",[Object])],Je);let Qe=class extends Ge{constructor(t){super(),this.canvasRenderer=t,this.type="arc3d",this.numberType=e.ARC3D_NUMBER_TYPE}contains(t,n,i){const{pickContext:r}=null!=i?i:{};if(!r)return!1;const a=e.getTheme(t).arc;r.highPerformanceSave();const s=this.transform(t,a,r),{x:o,y:l,z:h,lastModelMatrix:c}=s;let u=n;if(r.camera){u=n.clone();const e=t.parent.globalTransMatrix;u.x=e.a*n.x+e.c*n.y+e.e,u.y=e.b*n.x+e.d*n.y+e.f}this.canvasRenderer.z=h;let d=!1;return this.canvasRenderer.drawShape(t,r,o,l,i,null,((t,e,n)=>!!d||(d=t.isPointInPath(u.x,u.y),d))),this.canvasRenderer.z=0,r.modelMatrix!==c&&e.mat4Allocate.free(r.modelMatrix),r.modelMatrix=c,r.highPerformanceRestore(),d}};Qe=m([e.injectable(),y(0,e.inject(e.Arc3dRender)),x("design:paramtypes",[Object])],Qe);let Ze=class{constructor(){this.type="group",this.numberType=e.GROUP_NUMBER_TYPE}contains(t,e,n){return!1}};Ze=m([e.injectable()],Ze);var Ke=new e.ContainerModule(((t,n,i,r)=>{t(De).toSelf().inSingletonScope(),t(be).toService(De),t(je).toService(be),t(_e).toSelf().inSingletonScope(),t(Me).toService(_e),t(je).toService(Me),t($e).toSelf().inSingletonScope(),t(Pe).toService($e),t(je).toService(Pe),t(We).toSelf().inSingletonScope(),t(me).toService(We),t(je).toService(me),t(Fe).toSelf().inSingletonScope(),t(xe).toService(Fe),t(je).toService(xe),t(ze).toSelf().inSingletonScope(),t(Se).toService(ze),t(je).toService(Se),t(Ve).toSelf().inSingletonScope(),t(Ce).toService(Ve),t(je).toService(Ce),t(Ye).toSelf().inSingletonScope(),t(we).toService(Ye),t(je).toService(we),t(Ne).toSelf().inSingletonScope(),t(ke).toService(Ne),t(je).toService(ke),t(He).toSelf().inSingletonScope(),t(Te).toService(He),t(je).toService(Te),t(Ue).toSelf().inSingletonScope(),t(Ee).toService(Ue),t(je).toService(Ee),t(Je).toSelf().inSingletonScope(),t(Re).toService(Je),t(je).toService(Re),t(Qe).toSelf().inSingletonScope(),t(ye).toService(Qe),t(je).toService(ye),t(Xe).toSelf().inSingletonScope(),t(Oe).toService(Xe),t(je).toService(Oe),t(qe).toSelf().inSingletonScope(),t(Be).toService(qe),t(je).toService(Be),t(Ze).toSelf().inSingletonScope(),t(Ae).toService(Ze),t(je).toService(Ae),e.bindContributionProvider(t,je)}));const tn=new e.ContainerModule(((t,n,i,r)=>{i(Ie)||t(Ie).toSelf().inSingletonScope(),i(e.PickerService)?r(e.PickerService).toService(Ie):t(e.PickerService).toService(Ie)}));function en(t){t.load(Ke),t.load(tn)}let nn=class extends e.BaseWindowHandlerContribution{get container(){return this.canvas.nativeCanvas.parentElement}constructor(t){super(),this.global=t,this.type="browser",this._canvasIsIntersecting=!0}getTitle(){return this.canvas.id.toString()}getWH(){return{width:this.canvas.width/(this.canvas.dpr||1),height:this.canvas.height/(this.canvas.dpr||1)}}getXY(){return this.canvas.nativeCanvas.getBoundingClientRect()}createWindow(t){t.canvas?this.createWindowByCanvas(t):this.createWindowByConfig(t),this.postInit()}postInit(){try{this.observerCanvas()}catch(t){console.error("发生错误,该环境不存在IntersectionObserver")}}isElementVisible(t){const e=t.getBoundingClientRect(),n=window.innerWidth||document.documentElement.clientWidth,i=window.innerHeight||document.documentElement.clientHeight;return!(e.right<0||e.bottom<0||e.left>n||e.top>i)}observerCanvas(){this._canvasIsIntersecting=this.isElementVisible(this.canvas.nativeCanvas);const t=new IntersectionObserver(((t,e)=>{t.forEach((t=>{this._canvasIsIntersecting!==t.isIntersecting?(this._canvasIsIntersecting=t.isIntersecting,this._onVisibleChangeCb&&this._onVisibleChangeCb(t.isIntersecting)):this._canvasIsIntersecting=t.isIntersecting}))}));t&&t.observe(this.canvas.nativeCanvas)}createWindowByConfig(t){const n=this.global.createCanvas({width:t.width,height:t.height});let i;if(i="string"==typeof t.container?this.global.getElementById(t.container):t.container?t.container:this.global.getRootElement(),!i)throw new Error("发生错误,containerId可能传入有误");t.offscreen?i=null:i.appendChild(n);const r={width:t.width,height:t.height,dpr:t.dpr,nativeCanvas:n,container:i,id:e.Generator.GenAutoIncrementId().toString(),canvasControled:!0};this.canvas=new ie(r)}createWindowByCanvas(t){var e;let n;if("string"==typeof t.canvas){if(n=this.global.getElementById(t.canvas),!n)throw new Error("canvasId 参数不正确,请确认canvas存在并插入dom")}else n=t.canvas;if(!n)throw new Error("发生错误,传入的canvas不正确");let i=t.width,r=t.height;if(null==i||null==r||!t.canvasControled){const t=n.getBoundingClientRect();i=t.width,r=t.height}let a=t.dpr;if(null==a){a=null!==(e=n.getContext("2d").pixelRatio)&&void 0!==e?e:n.width/i}this.canvas=new ie({width:i,height:r,dpr:a,nativeCanvas:n,canvasControled:t.canvasControled})}releaseWindow(){this.canvas.release()}resizeWindow(t,e){this.canvas.resize(t,e)}setDpr(t){this.canvas.dpr=t}getContext(){return this.canvas.getContext()}getNativeHandler(){return this.canvas}getDpr(){return this.canvas.dpr}addEventListener(t,e,n){return this.canvas.nativeCanvas.addEventListener(t,e,n)}removeEventListener(t,e,n){return this.canvas.nativeCanvas.removeEventListener(t,e,n)}dispatchEvent(t){return this.canvas.nativeCanvas.dispatchEvent(t)}getStyle(){return this.canvas.nativeCanvas.style}setStyle(t){this.canvas.nativeCanvas.style=t}getBoundingClientRect(){const t=this.canvas.nativeCanvas,e=this.getWH();return t.parentElement?this.canvas.nativeCanvas.getBoundingClientRect():{x:0,y:0,width:e.width,height:e.height,left:0,top:0,right:0,bottom:0}}clearViewBox(t,e){const n=this.getContext(),i=this.getDpr();n.nativeContext.save(),n.nativeContext.setTransform(i,0,0,i,0,0),n.clearRect(t.x1,t.y1,t.x2-t.x1,t.y2-t.y1),e&&(n.fillStyle=e,n.fillRect(t.x1,t.y1,t.x2-t.x1,t.y2-t.y1)),n.nativeContext.restore()}isVisible(t){return this._canvasIsIntersecting}onVisibleChange(t){this._onVisibleChangeCb=t}getTopLeft(t){return this.global.getElementTopLeft(this.canvas.nativeCanvas,t)}};nn.env="browser",nn=m([e.injectable(),y(0,e.inject(e.VGlobal)),x("design:paramtypes",[Object])],nn);const rn=new e.ContainerModule((t=>{t(nn).toSelf(),t(e.WindowHandlerContribution).toDynamicValue((t=>t.container.get(nn))).whenTargetNamed(nn.env)}));let an=!1;function sn(t,e=!0){an||(an=!0,t.load(Vt),t.load(ae),t.load(rn),e&&en(t))}let on=class extends ne{get globalAlpha(){return this._globalAlpha}set globalAlpha(t){this.nativeContext.globalAlpha=t,this._globalAlpha=t}getImageData(t,e,n,i){return new Promise(((r,a)=>{var s;try{tt.canvasGetImageData({canvasId:null!==(s=this.canvas.nativeCanvas.id)&&void 0!==s?s:this.canvas.id,x:t,y:e,width:n,height:i,success(t){r(t)}})}catch(t){a(t)}}))}draw(){const t=this.nativeContext;t.draw&&(this.drawPromise=new Promise((e=>{t.draw(!0,(()=>{this.drawPromise=null,e(null)}))})))}createPattern(t,e){return null}};on.env="feishu",on=m([e.injectable()],on);let ln=class extends e.BaseCanvas{constructor(t){super(t)}init(){this._context=new on(this,this._dpr)}release(...t){}};ln.env="feishu",ln=m([e.injectable(),x("design:paramtypes",[Object])],ln);const hn=re(ln,on);let cn=class extends e.BaseWindowHandlerContribution{get container(){return null}constructor(t){super(),this.global=t,this.type="feishu",this.eventManager=new class{constructor(){this.cache={}}addEventListener(t,e){t&&e&&(this.cache[t]=this.cache[t]||{listener:[]},this.cache[t].listener.push(e))}removeEventListener(t,e){if(!t||!e)return;if(!this.cache[t])return;const n=this.cache[t].listener.findIndex((t=>t===e));n>=0&&this.cache[t].listener.splice(n,1)}cleanEvent(){this.cache={}}}}getTitle(){return this.canvas.id.toString()}getWH(){return{width:this.canvas.width/(this.canvas.dpr||1),height:this.canvas.height/(this.canvas.dpr||1)}}getXY(){return{x:0,y:0}}createWindow(t){t.canvas?this.createWindowByCanvas(t):this.createWindowByConfig(t)}createWindowByConfig(t){const n=this.global.createCanvas({width:t.width,height:t.height}),i={width:t.width,height:t.height,dpr:t.dpr,nativeCanvas:n,id:e.Generator.GenAutoIncrementId().toString(),canvasControled:!1};this.canvas=new ln(i)}createWindowByCanvas(t){let e;if("string"==typeof t.canvas){if(e=this.global.getElementById(t.canvas),!e)throw new Error("canvasId 参数不正确,请确认canvas存在并插入dom")}else e=t.canvas;let n=t.width,i=t.height;if(null==n||null==i||!t.canvasControled){const t=e.getBoundingClientRect();n=t.width,i=t.height}let r=t.dpr;null==r&&(r=e.width/n),this.canvas=new ln({width:n,height:i,dpr:r,nativeCanvas:e,canvasControled:t.canvasControled})}releaseWindow(){}resizeWindow(t,e){}setDpr(t){this.canvas.dpr=t}getContext(){return this.canvas.getContext()}getNativeHandler(){return this.canvas}getDpr(){return this.canvas.dpr}addEventListener(t,e){this.eventManager.addEventListener(t,e)}removeEventListener(t,e){this.eventManager.removeEventListener(t,e)}dispatchEvent(t){const{type:e}=t;return!!this.eventManager.cache[e]&&(t.changedTouches&&t.changedTouches[0]&&(t.offsetX=t.changedTouches[0].x,t.changedTouches[0].offsetX=t.changedTouches[0].x,t.changedTouches[0].clientX=t.changedTouches[0].x,t.offsetY=t.changedTouches[0].y,t.changedTouches[0].offsetY=t.changedTouches[0].y,t.changedTouches[0].clientY=t.changedTouches[0].y),t.preventDefault=()=>{},t.stopPropagation=()=>{},this.eventManager.cache[e].listener&&this.eventManager.cache[e].listener.forEach((e=>{e(t)})),!0)}getStyle(){return{}}setStyle(t){}getBoundingClientRect(){const t=this.getWH();return{x:0,y:0,width:t.width,height:t.height,left:0,top:0,right:0,bottom:0}}clearViewBox(t,e){const n=this.getContext(),i=this.getDpr();n.nativeContext.save(),n.nativeContext.setTransform(i,0,0,i,0,0),n.clearRect(t.x1,t.y1,t.x2-t.x1,t.y2-t.y1),e&&(n.fillStyle=e,n.fillRect(t.x1,t.y1,t.x2-t.x1,t.y2-t.y1)),n.nativeContext.restore()}};cn.env="feishu",cn=m([e.injectable(),y(0,e.inject(e.VGlobal)),x("design:paramtypes",[Object])],cn);const un=new e.ContainerModule((t=>{t(cn).toSelf(),t(e.WindowHandlerContribution).toDynamicValue((t=>t.container.get(cn))).whenTargetNamed(cn.env)}));let dn=class extends e.DefaultPickService{constructor(t,e,n){super(e,n),this.contributions=t,this.global=e,this.pickItemInterceptorContributions=n,this.global.hooks.onSetEnv.tap("math-picker-service",((t,e,n)=>{this.configure(n,e)})),this.configure(this.global,this.global.env),this.pickerMap=new Map}init(){this.contributions.getContributions().forEach((t=>{this.pickerMap.set(t.numberType,t)})),super._init()}configure(t,n){this.pickContext=new e.EmptyContext2d(null,1)}pickItem(t,e,n,i){if(!1===t.attribute.pickable)return null;const r=this.pickerMap.get(t.numberType);if(!r)return null;const a=r.contains(t,e,i)?t:null;return a?{graphic:a}:null}};m([e.postConstruct(),x("design:type",Function),x("design:paramtypes",[]),x("design:returntype",void 0)],dn.prototype,"init",null),dn=m([e.injectable(),y(0,e.inject(e.ContributionProvider)),y(0,e.named(se)),y(1,e.inject(e.VGlobal)),y(2,e.inject(e.ContributionProvider)),y(2,e.named(e.PickItemInterceptor)),x("design:paramtypes",[Object,Object,Object])],dn);let fn=class{constructor(t){this.canvasRenderer=t,this.type="path",this.numberType=e.PATH_NUMBER_TYPE}contains(t,n,i){if(!t.AABBBounds.containsPoint(n))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:r}=null!=i?i:{};if(!r)return!1;const a=e.getTheme(t).path;let{x:s=a.x,y:o=a.y}=t.attribute;if(r.highPerformanceSave(),t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(a);s+=e.x,o+=e.y,r.setTransformForCurrent()}else s=0,o=0,r.transformFromMatrix(t.transMatrix,!0);let l=!1;return this.canvasRenderer.drawShape(t,r,s,o,{},null,((t,e,i)=>!!l||(l=t.isPointInPath(n.x,n.y),l)),((t,e,i)=>{if(l)return!0;const a=e.lineWidth||i.lineWidth;return r.lineWidth=a,l=t.isPointInStroke(n.x,n.y),l})),r.highPerformanceRestore(),l}};fn=m([e.injectable(),y(0,e.inject(e.PathRender)),x("design:paramtypes",[Object])],fn);let vn=class{constructor(t){this.canvasRenderer=t,this.type="circle",this.numberType=e.CIRCLE_NUMBER_TYPE}contains(t,n,i){if(!t.AABBBounds.containsPoint(n))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:r}=null!=i?i:{};if(!r)return!1;const a=e.getTheme(t).circle;let{x:s=a.x,y:o=a.y}=t.attribute;if(r.highPerformanceSave(),t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(a);s+=e.x,o+=e.y,r.setTransformForCurrent()}else s=0,o=0,r.transformFromMatrix(t.transMatrix,!0);let l=!1;return this.canvasRenderer.drawShape(t,r,s,o,{},null,((t,e,i)=>!!l||(l=t.isPointInPath(n.x,n.y),l)),((t,e,i)=>{if(l)return!0;const a=e.lineWidth||i.lineWidth;return r.lineWidth=a,l=t.isPointInStroke(n.x,n.y),l})),r.highPerformanceRestore(),l}};vn=m([e.injectable(),y(0,e.inject(e.CircleRender)),x("design:paramtypes",[Object])],vn);const pn=new n.AABBBounds;let gn=class{constructor(t){this.canvasRenderer=t,this.type="rect",this.numberType=e.RECT_NUMBER_TYPE}contains(t,i,r){if(!t.AABBBounds.containsPoint(i))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:a}=null!=r?r:{};if(!a)return!1;const s=e.getTheme(t).rect,{cornerRadius:o=s.cornerRadius}=t.attribute;let{x:l=s.x,y:h=s.y}=t.attribute;a.highPerformanceSave();let c=!0;if(t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(s);l+=e.x,h+=e.y,a.setTransformForCurrent()}else l=0,h=0,c=!1,a.transformFromMatrix(t.transMatrix,!0);let u=!0;if(!c||n.isNumber(o,!0)&&0!==o||n.isArray(o)&&o.some((t=>0!==t)))u=!1,this.canvasRenderer.drawShape(t,a,l,h,{},null,((t,e,n)=>!!u||(u=t.isPointInPath(i.x,i.y),u)),((t,e,n)=>{if(u)return!0;const r=e.lineWidth||n.lineWidth;return a.lineWidth=r,u=t.isPointInStroke(i.x,i.y),u}));else if(u){const{fill:e=s.fill,stroke:n=s.stroke,lineWidth:r=s.lineWidth}=t.attribute;if(e)u=!0;else if(n){const e=t.AABBBounds;pn.setValue(e.x1,e.y1,e.x2,e.y2),pn.expand(-r/2),u=!pn.containsPoint(i)}}return a.highPerformanceRestore(),u}};gn=m([e.injectable(),y(0,e.inject(e.RectRender)),x("design:paramtypes",[Object])],gn);let mn=class{constructor(t){this.canvasRenderer=t,this.type="arc",this.numberType=e.ARC_NUMBER_TYPE}contains(t,n,i){if(!t.AABBBounds.containsPoint(n))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:r}=null!=i?i:{};if(!r)return!1;const a=e.getTheme(t).arc;r.highPerformanceSave();let{x:s=a.x,y:o=a.y}=t.attribute;if(t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(a);s+=e.x,o+=e.y,r.setTransformForCurrent()}else s=0,o=0,r.transformFromMatrix(t.transMatrix,!0);let l=!1;return this.canvasRenderer.drawShape(t,r,s,o,{},null,((t,e,i)=>!!l||(l=t.isPointInPath(n.x,n.y),l)),((t,e,i)=>{if(l)return!0;const a=e.lineWidth||i.lineWidth;return r.lineWidth=a,l=t.isPointInStroke(n.x,n.y),l})),r.highPerformanceRestore(),l}};mn=m([e.injectable(),y(0,e.inject(e.ArcRender)),x("design:paramtypes",[Object])],mn);let yn=class{constructor(t){this.canvasRenderer=t,this.type="area",this.numberType=e.AREA_NUMBER_TYPE}contains(t,n,i){if(!t.AABBBounds.containsPoint(n))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:r}=null!=i?i:{};if(!r)return!1;const a=e.getTheme(t).area;let{x:s=a.x,y:o=a.y}=t.attribute;if(r.highPerformanceSave(),t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(a);s+=e.x,o+=e.y,r.setTransformForCurrent()}else s=0,o=0,r.transformFromMatrix(t.transMatrix,!0);let l=!1;return this.canvasRenderer.drawShape(t,r,s,o,{},null,(t=>!!l||(l=t.isPointInPath(n.x,n.y),l))),r.highPerformanceRestore(),l}};yn=m([e.injectable(),y(0,e.inject(e.AreaRender)),x("design:paramtypes",[Object])],yn);let xn=class{constructor(t){this.canvasRenderer=t,this.type="line",this.numberType=e.LINE_NUMBER_TYPE}contains(t,n,i){if(!t.AABBBounds.containsPoint(n))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:r}=null!=i?i:{};if(!r)return!1;const a=e.getTheme(t).line;let{x:s=a.x,y:o=a.y}=t.attribute;if(r.highPerformanceSave(),t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(a);s+=e.x,o+=e.y,r.setTransformForCurrent()}else s=0,o=0,r.transformFromMatrix(t.transMatrix,!0);let l=!1;return this.canvasRenderer.drawShape(t,r,s,o,{},null,(t=>!!l||(l=t.isPointInPath(n.x,n.y),l)),((t,e,i)=>{if(l)return!0;const a=e.lineWidth||i.lineWidth;return r.lineWidth=a,l=t.isPointInStroke(n.x,n.y),l})),r.highPerformanceRestore(),l}};xn=m([e.injectable(),y(0,e.inject(e.LineRender)),x("design:paramtypes",[Object])],xn);let bn=class{constructor(t){this.canvasRenderer=t,this.type="symbol",this.numberType=e.SYMBOL_NUMBER_TYPE}contains(t,n,i){if(!t.AABBBounds.containsPoint(n))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:r}=null!=i?i:{};if(!r)return!1;const a=e.getTheme(t).symbol;let{x:s=a.x,y:o=a.y}=t.attribute;if(r.highPerformanceSave(),t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(a);s+=e.x,o+=e.y,r.setTransformForCurrent()}else s=0,o=0,r.transformFromMatrix(t.transMatrix,!0);let l=!1;return this.canvasRenderer.drawShape(t,r,s,o,{},null,((t,e,i)=>!!l||(l=t.isPointInPath(n.x,n.y),l)),((t,e,i)=>{if(l)return!0;const a=e.lineWidth||i.lineWidth;return r.lineWidth=a,l=t.isPointInStroke(n.x,n.y),l})),r.highPerformanceRestore(),l}};bn=m([e.injectable(),y(0,e.inject(e.SymbolRender)),x("design:paramtypes",[Object])],bn);let Sn=class{constructor(){this.type="text",this.numberType=e.TEXT_NUMBER_TYPE}contains(t,e,n){return!!t.AABBBounds.containsPoint(e)}};Sn=m([e.injectable()],Sn);let Cn=class{constructor(t){this.canvasRenderer=t,this.type="polygon",this.numberType=e.POLYGON_NUMBER_TYPE}contains(t,n,i){if(!t.AABBBounds.contains(n.x,n.y))return!1;const{pickContext:r}=null!=i?i:{};if(!r)return!1;const a=e.getTheme(t).polygon;let{x:s=a.x,y:o=a.y}=t.attribute;if(r.highPerformanceSave(),t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(a);s+=e.x,o+=e.y,r.setTransformForCurrent()}else s=0,o=0,r.transformFromMatrix(t.transMatrix,!0);let l=!1;return this.canvasRenderer.drawShape(t,r,s,o,{},null,((t,e,i)=>!!l||(l=t.isPointInPath(n.x,n.y),l)),((t,e,i)=>{if(l)return!0;const a=e.lineWidth||i.lineWidth;return r.lineWidth=a,l=t.isPointInStroke(n.x,n.y),l})),r.highPerformanceRestore(),l}};Cn=m([e.injectable(),y(0,e.inject(e.PolygonRender)),x("design:paramtypes",[Object])],Cn);let wn=class{constructor(t){this.canvasRenderer=t,this.type="glyph",this.numberType=e.GLYPH_NUMBER_TYPE}contains(t,e,n){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:i}=null!=n?n:{};if(!i)return!1;const r=null==n?void 0:n.pickerService;if(r){let i=!1;return t.getSubGraphic().forEach((t=>{i||(i=!!r.pickItem(t,e,null,n))})),i}return!1}};wn=m([e.injectable(),y(0,e.inject(e.GlyphRender)),x("design:paramtypes",[Object])],wn);var Mn=new e.ContainerModule((t=>{t(vn).toSelf().inSingletonScope(),t(he).toService(vn),t(se).toService(he),t(gn).toSelf().inSingletonScope(),t(de).toService(gn),t(se).toService(de),t(mn).toSelf().inSingletonScope(),t(oe).toService(mn),t(se).toService(oe),t(yn).toSelf().inSingletonScope(),t(le).toService(yn),t(se).toService(le),t(xn).toSelf().inSingletonScope(),t(ce).toService(xn),t(se).toService(ce),t(fn).toSelf().inSingletonScope(),t(ue).toService(fn),t(se).toService(ue),t(bn).toSelf().inSingletonScope(),t(fe).toService(bn),t(se).toService(fe),t(Sn).toSelf().inSingletonScope(),t(ve).toService(Sn),t(se).toService(ve),t(Cn).toSelf().inSingletonScope(),t(pe).toService(Cn),t(se).toService(pe),t(wn).toSelf().inSingletonScope(),t(ge).toService(wn),t(wn).toService(ge),e.bindContributionProvider(t,se)}));const Pn=new e.ContainerModule(((t,n,i,r)=>{i(dn)||t(dn).toSelf().inSingletonScope(),i(e.PickerService)?r(e.PickerService).toService(dn):t(e.PickerService).toService(dn)}));function kn(t){t.load(Mn),t.load(Pn)}let Tn=!1;function En(t,e=!0){Tn||(Tn=!0,t.load(Nt),t.load(hn),t.load(un),e&&kn(t))}let Rn=class extends ne{get globalAlpha(){return this._globalAlpha}set globalAlpha(t){this.nativeContext.globalAlpha=t,this._globalAlpha=t}setLineDash(t){const e=arguments,n=this.nativeContext;if(this.nativeContext.setLineDash){const t=e[0];if(0===t[0]&&0===t[1])return;n.setLineDash(t)}}_setStrokeStyle(t,n,i,r,a){const s=this.nativeContext;a||(a=this.strokeAttributes);const{strokeOpacity:o=a.strokeOpacity,opacity:l=a.opacity}=n;if(o>1e-12&&l>1e-12){const{lineWidth:h=a.lineWidth,stroke:c=a.stroke,lineJoin:u=a.lineJoin,lineDash:d=a.lineDash,lineCap:f=a.lineCap,miterLimit:v=a.miterLimit}=n;s.globalAlpha=o*l,s.lineWidth=e.getScaledStroke(this,h,this.dpr),s.strokeStyle=e.createColor(this,c,t,i,r),s.lineJoin=u,0===d[0]&&0===d[1]||s.setLineDash(d),s.lineCap=f,s.miterLimit=v}}measureText(t,n=e.application.global.measureTextMethod){this.setTransform(1,0,0,1,0,0,!0,e.application.global.devicePixelRatio);return super.measureText(t,n)}createPattern(t,e){return null}draw(){const t=this.nativeContext;this.drawPromise=new Promise((e=>{t.draw(!0,(()=>{this.drawPromise=null,e(null)}))}))}};Rn.env="lynx",Rn=m([e.injectable()],Rn);let On=class extends e.BaseCanvas{constructor(t){super(t)}init(){this._context=new Rn(this,this._dpr)}resize(t,e){this._pixelWidth=t*this._dpr,this._pixelHeight=e*this._dpr,this._displayWidth=t,this._displayHeight=e,this._nativeCanvas.width=this._pixelWidth,this._nativeCanvas.height=this._pixelHeight,this._nativeCanvas.nativeCanvas&&(this._nativeCanvas.nativeCanvas.width=this._pixelWidth,this._nativeCanvas.nativeCanvas.height=this._pixelHeight);this._context.dpr=this._dpr}release(...t){}};On.env="lynx",On=m([e.injectable(),x("design:paramtypes",[Object])],On);let Bn=class extends e.BaseWindowHandlerContribution{get container(){return null}constructor(t){super(),this.global=t,this.type="lynx",this.eventManager=new class{constructor(){this.cache={}}addEventListener(t,e){t&&e&&(this.cache[t]=this.cache[t]||{listener:[]},this.cache[t].listener.push(e))}removeEventListener(t,e){if(!t||!e)return;if(!this.cache[t])return;const n=this.cache[t].listener.findIndex((t=>t===e));n>=0&&this.cache[t].listener.splice(n,1)}cleanEvent(){this.cache={}}}}getTitle(){return this.canvas.id.toString()}getWH(){return{width:this.canvas.width/(this.canvas.dpr||1),height:this.canvas.height/(this.canvas.dpr||1)}}getXY(){return{x:0,y:0}}createWindow(t){t.canvas?this.createWindowByCanvas(t):this.createWindowByConfig(t)}createWindowByConfig(t){const n=this.global.createCanvas({width:t.width,height:t.height}),i={width:t.width,height:t.height,dpr:t.dpr,nativeCanvas:n,id:e.Generator.GenAutoIncrementId().toString(),canvasControled:!1};this.canvas=new On(i)}createWindowByCanvas(t){let e;if("string"==typeof t.canvas){if(e=this.global.getElementById(t.canvas),!e)throw new Error("canvasId 参数不正确,请确认canvas存在并插入dom")}else e=t.canvas;let n=t.width,i=t.height;if(null==n||null==i||!t.canvasControled){const t=e.getBoundingClientRect();n=t.width,i=t.height}let r=t.dpr;null==r&&(r=e.width/n),this.canvas=new On({width:n,height:i,dpr:r,nativeCanvas:e,canvasControled:t.canvasControled})}releaseWindow(){}resizeWindow(t,e){this.canvas.resize(t,e)}setDpr(t){this.canvas.dpr=t}getContext(){return this.canvas.getContext()}getNativeHandler(){return this.canvas}getDpr(){return this.canvas.dpr}addEventListener(t,e){this.eventManager.addEventListener(t,e)}removeEventListener(t,e){this.eventManager.removeEventListener(t,e)}dispatchEvent(t){const{type:e}=t;return!!this.eventManager.cache[e]&&(t.changedTouches&&t.changedTouches[0]&&(t.offsetX=t.changedTouches[0].x,t.changedTouches[0].offsetX=t.changedTouches[0].x,t.changedTouches[0].clientX=t.changedTouches[0].x,t.offsetY=t.changedTouches[0].y,t.changedTouches[0].offsetY=t.changedTouches[0].y,t.changedTouches[0].clientY=t.changedTouches[0].y),t.preventDefault=()=>{},t.stopPropagation=()=>{},this.eventManager.cache[e].listener&&this.eventManager.cache[e].listener.forEach((e=>{e(t)})),!0)}getStyle(){return{}}setStyle(t){}getBoundingClientRect(){const t=this.getWH();return{x:0,y:0,width:t.width,height:t.height,left:0,top:0,right:0,bottom:0}}clearViewBox(t,e){const n=this.getContext(),i=this.getDpr();n.nativeContext.save(),n.nativeContext.setTransform(i,0,0,i,0,0),n.clearRect(t.x1,t.y1,t.x2-t.x1,t.y2-t.y1),e&&(n.fillStyle=e,n.fillRect(t.x1,t.y1,t.x2-t.x1,t.y2-t.y1)),n.nativeContext.restore()}};Bn.env="lynx",Bn=m([e.injectable(),y(0,e.inject(e.VGlobal)),x("design:paramtypes",[Object])],Bn);const An=new e.ContainerModule((t=>{t(Bn).toSelf(),t(e.WindowHandlerContribution).toDynamicValue((t=>t.container.get(Bn))).whenTargetNamed(Bn.env)})),jn=re(On,Rn);let In=!1;function Dn(t,e=!0){In||(In=!0,t.load($t),t.load(jn),t.load(An),e&&kn(t))}let Ln=class extends ne{constructor(t,e){super(t,e);const i=t.nativeCanvas.getContext("2d");if(!i)throw new Error("发生错误,获取2d上下文失败");this.nativeContext=i,this.canvas=t,this.matrix=new n.Matrix(1,0,0,1,0,0),this.stack=[],this.dpr=null!=e?e:1}release(...t){}};Ln.env="node",Ln=m([e.injectable(),x("design:paramtypes",[Object,Number])],Ln);let _n=class extends e.BaseCanvas{constructor(t){super(t)}init(){this._context=new Ln(this,this._dpr),this.nativeCanvas.width=this._pixelWidth,this.nativeCanvas.height=this._pixelHeight}release(...t){this._nativeCanvas.release&&n.isFunction(this._nativeCanvas.release)&&this._nativeCanvas.release()}};_n.env="node",_n=m([e.injectable(),x("design:paramtypes",[Object])],_n);const Wn=re(_n,Ln);let Fn=class extends e.BaseWindowHandlerContribution{get container(){return null}constructor(t){super(),this.global=t,this.type="node"}getTitle(){return""}getWH(){return{width:this.canvas.displayWidth,height:this.canvas.displayHeight}}getXY(){return{x:0,y:0}}createWindow(t){t.canvas?this.createWindowByCanvas(t):this.createWindowByConfig(t)}createWindowByConfig(t){const n=this.global.createCanvas({width:t.width,height:t.height}),i={width:t.width,height:t.height,dpr:t.dpr,nativeCanvas:n,id:e.Generator.GenAutoIncrementId().toString(),canvasControled:!0};this.canvas=new _n(i)}createWindowByCanvas(t){const e=t.canvas;let n=t.width,i=t.height;null!=n&&null!=i&&t.canvasControled||(n=e.width,i=e.height),this.canvas=new _n({width:n,height:i,dpr:1,nativeCanvas:e,canvasControled:t.canvasControled})}releaseWindow(){this.canvas.release()}resizeWindow(t,e){this.canvas.resize(t,e)}setDpr(t){this.canvas.dpr=t}getContext(){return this.canvas.getContext()}getNativeHandler(){return this.canvas}getDpr(){return this.canvas.dpr}getImageBuffer(t="image/png"){return this.canvas.nativeCanvas.toBuffer(t)}addEventListener(t,e,n){}dispatchEvent(t){return!0}removeEventListener(t,e,n){}getStyle(){}setStyle(t){}getBoundingClientRect(){return null}clearViewBox(t,e){}};Fn.env="node",Fn=m([e.injectable(),y(0,e.inject(e.VGlobal)),x("design:paramtypes",[Object])],Fn);const zn=new e.ContainerModule((t=>{t(Fn).toSelf(),t(e.WindowHandlerContribution).toDynamicValue((t=>t.container.get(Fn))).whenTargetNamed(Fn.env)}));let Gn=!1;function Vn(t,e=!0){Gn||(Gn=!0,t.load(Kt),t.load(Wn),t.load(zn),e&&kn(t))}let Yn=class extends ne{get globalAlpha(){return this._globalAlpha}set globalAlpha(t){this.nativeContext.setGlobalAlpha(t),this._globalAlpha=t}draw(){this.nativeContext.draw()}strokeText(t,e,n){}_setCommonStyle(t,n,i,r,a){const s=this.nativeContext;a||(a=this.fillAttributes);const{fillOpacity:o=a.fillOpacity,opacity:l=a.opacity,fill:h=a.fill}=n;o>1e-12&&l>1e-12&&(s.setGlobalAlpha(o*l),s.setFillStyle(e.createColor(this,h,t,i,r)))}_setStrokeStyle(t,n,i,r,a){const s=this.nativeContext;a||(a=this.strokeAttributes);const{strokeOpacity:o=a.strokeOpacity,opacity:l=a.opacity}=n;if(o>1e-12&&l>1e-12){const{lineWidth:h=a.lineWidth,stroke:c=a.stroke,lineJoin:u=a.lineJoin,lineDash:d=a.lineDash,lineCap:f=a.lineCap,miterLimit:v=a.miterLimit}=n;s.setGlobalAlpha(o*l),s.setLineWidth(e.getScaledStroke(this,h,this.dpr)),s.setStrokeStyle(e.createColor(this,c,t,i,r)),s.setLineJoin(u),s.setLineDash(d),s.setLineCap(f),s.setMiterLimit(v)}}setTextStyleWithoutAlignBaseline(t,n){var i;const r=this.nativeContext;n||(n=this.textAttributes),t.font?r.font=t.font:r.font=e.getContextFont(t,n),r.setFontSize(null!==(i=t.fontSize)&&void 0!==i?i:n.fontSize)}setTextStyle(t,n){var i,r;const a=this.nativeContext;n||(n=this.textAttributes),t.font?a.font=t.font:a.font=e.getContextFont(t,n),a.setTextAlign(null!==(i=t.textAlign)&&void 0!==i?i:n.textAlign),a.setTextBaseline(null!==(r=t.textBaseline)&&void 0!==r?r:n.textBaseline)}createConicGradient(t,e,n,i){return null}createPattern(t,e){return null}};Yn.env="taro",Yn=m([e.injectable()],Yn);let Nn=class extends e.BaseCanvas{constructor(t){super(t)}init(){this._context=new Yn(this,this._dpr)}release(...t){}};Nn.env="taro",Nn=m([e.injectable(),x("design:paramtypes",[Object])],Nn);const Hn=re(Nn,Yn);let Un=class extends e.BaseWindowHandlerContribution{get container(){return null}constructor(t){super(),this.global=t,this.type="taro",this.eventManager=new class{constructor(){this.cache={}}addEventListener(t,e){t&&e&&(this.cache[t]=this.cache[t]||{listener:[]},this.cache[t].listener.push(e))}removeEventListener(t,e){if(!t||!e)return;if(!this.cache[t])return;const n=this.cache[t].listener.findIndex((t=>t===e));n>=0&&this.cache[t].listener.splice(n,1)}cleanEvent(){this.cache={}}}}getTitle(){return this.canvas.id.toString()}getWH(){return{width:this.canvas.width/(this.canvas.dpr||1),height:this.canvas.height/(this.canvas.dpr||1)}}getXY(){return{x:0,y:0}}createWindow(t){t.canvas?this.createWindowByCanvas(t):this.createWindowByConfig(t)}createWindowByConfig(t){const n=this.global.createCanvas({width:t.width,height:t.height}),i={width:t.width,height:t.height,dpr:t.dpr,nativeCanvas:n,id:e.Generator.GenAutoIncrementId().toString(),canvasControled:!1};this.canvas=new Nn(i)}createWindowByCanvas(t){let e;if("string"==typeof t.canvas){if(e=this.global.getElementById(t.canvas),!e)throw new Error("canvasId 参数不正确,请确认canvas存在并插入dom")}else e=t.canvas;let n=t.width,i=t.height;if(null==n||null==i||!t.canvasControled){const t=e.getBoundingClientRect();n=t.width,i=t.height}let r=t.dpr;null==r&&(r=e.width/n),this.canvas=new Nn({width:n,height:i,dpr:r,nativeCanvas:e,canvasControled:t.canvasControled})}releaseWindow(){}resizeWindow(t,e){}setDpr(t){this.canvas.dpr=t}getContext(){return this.canvas.getContext()}getNativeHandler(){return this.canvas}getDpr(){return this.canvas.dpr}addEventListener(t,e){this.eventManager.addEventListener(t,e)}removeEventListener(t,e){this.eventManager.removeEventListener(t,e)}dispatchEvent(t){const{type:e}=t;return!!this.eventManager.cache[e]&&(t.changedTouches.length>0&&(t.changedTouches.forEach(((e,n)=>{t.changedTouches[n]=Object.assign(Object.assign({},t.changedTouches[n]),{offsetX:e.x,offsetY:e.y})})),t.offsetX=t.changedTouches[0].offsetX,t.offsetY=t.changedTouches[0].offsetY),t.touches.length>0&&t.touches.forEach(((e,n)=>{t.touches[n]=Object.assign(Object.assign({},t.touches[n]),{offsetX:e.x,offsetY:e.y})})),t.preventDefault=()=>{},t.stopPropagation=()=>{},this.eventManager.cache[e].listener&&this.eventManager.cache[e].listener.forEach((e=>{e(t)})),!0)}getStyle(){return{}}setStyle(t){}getBoundingClientRect(){const t=this.getWH();return{x:0,y:0,width:t.width,height:t.height,left:0,top:0,right:0,bottom:0}}clearViewBox(t,e){const n=this.getContext(),i=this.getDpr();n.nativeContext.save(),n.nativeContext.setTransform(i,0,0,i,0,0),n.clearRect(t.x1,t.y1,t.x2-t.x1,t.y2-t.y1),e&&(n.fillStyle=e,n.fillRect(t.x1,t.y1,t.x2-t.x1,t.y2-t.y1)),n.nativeContext.restore()}};Un.env="taro",Un=m([e.injectable(),y(0,e.inject(e.VGlobal)),x("design:paramtypes",[Object])],Un);const Xn=new e.ContainerModule((t=>{t(Un).toSelf(),t(e.WindowHandlerContribution).toDynamicValue((t=>t.container.get(Un))).whenTargetNamed(Un.env)}));let qn=!1;function $n(t,e=!0){qn||(qn=!0,t.load(Ut),t.load(Hn),t.load(Xn),e&&kn(t))}let Jn=class extends ne{draw(){}createPattern(t,e){return null}};Jn.env="wx",Jn=m([e.injectable()],Jn);let Qn=class extends e.BaseCanvas{constructor(t){super(t)}init(){this._context=new Jn(this,this._dpr)}release(...t){}};Qn.env="wx",Qn=m([e.injectable(),x("design:paramtypes",[Object])],Qn);const Zn=re(Qn,Jn);class Kn{constructor(){this.cache={}}addEventListener(t,e){t&&e&&(this.cache[t]=this.cache[t]||{listener:[]},this.cache[t].listener.push(e))}removeEventListener(t,e){if(!t||!e)return;if(!this.cache[t])return;const n=this.cache[t].listener.findIndex((t=>t===e));n>=0&&this.cache[t].listener.splice(n,1)}cleanEvent(){this.cache={}}}let ti=class extends e.BaseWindowHandlerContribution{get container(){return null}constructor(t){super(),this.global=t,this.type="wx",this.eventManager=new Kn}getTitle(){return this.canvas.id.toString()}getWH(){return{width:this.canvas.width/(this.canvas.dpr||1),height:this.canvas.height/(this.canvas.dpr||1)}}getXY(){return{x:0,y:0}}createWindow(t){t.canvas?this.createWindowByCanvas(t):this.createWindowByConfig(t)}createWindowByConfig(t){const n=this.global.createCanvas({width:t.width,height:t.height}),i={width:t.width,height:t.height,dpr:t.dpr,nativeCanvas:n,id:e.Generator.GenAutoIncrementId().toString(),canvasControled:!1};this.canvas=new Qn(i)}createWindowByCanvas(t){let e;if("string"==typeof t.canvas){if(e=this.global.getElementById(t.canvas),!e)throw new Error("canvasId 参数不正确,请确认canvas存在并插入dom")}else e=t.canvas;let n=t.width,i=t.height;if(null==n||null==i||!t.canvasControled){const t=e.getBoundingClientRect();n=t.width,i=t.height}let r=t.dpr;null==r&&(r=e.width/n),this.canvas=new Qn({width:n,height:i,dpr:r,nativeCanvas:e,canvasControled:t.canvasControled})}releaseWindow(){}resizeWindow(t,e){}setDpr(t){this.canvas.dpr=t}getContext(){return this.canvas.getContext()}getNativeHandler(){return this.canvas}getDpr(){return this.canvas.dpr}addEventListener(t,e){this.eventManager.addEventListener(t,e)}removeEventListener(t,e){this.eventManager.removeEventListener(t,e)}dispatchEvent(t){var e,n,i,r;const{type:a}=t;return!!this.eventManager.cache[a]&&(t.changedTouches&&t.changedTouches[0]&&(t.offsetX=t.changedTouches[0].x,t.changedTouches[0].offsetX=null!==(e=t.changedTouches[0].x)&&void 0!==e?e:t.changedTouches[0].pageX,t.changedTouches[0].clientX=null!==(n=t.changedTouches[0].x)&&void 0!==n?n:t.changedTouches[0].pageX,t.offsetY=t.changedTouches[0].y,t.changedTouches[0].offsetY=null!==(i=t.changedTouches[0].y)&&void 0!==i?i:t.changedTouches[0].pageY,t.changedTouches[0].clientY=null!==(r=t.changedTouches[0].y)&&void 0!==r?r:t.changedTouches[0].pageY),t.preventDefault=()=>{},t.stopPropagation=()=>{},this.eventManager.cache[a].listener&&this.eventManager.cache[a].listener.forEach((e=>{e(t)})),!0)}getStyle(){return{}}setStyle(t){}getBoundingClientRect(){const t=this.getWH();return{x:0,y:0,width:t.width,height:t.height,left:0,top:0,right:0,bottom:0}}clearViewBox(t,e){const n=this.getContext(),i=this.getDpr();n.nativeContext.save(),n.nativeContext.setTransform(i,0,0,i,0,0),n.clearRect(t.x1,t.y1,t.x2-t.x1,t.y2-t.y1),e&&(n.fillStyle=e,n.fillRect(t.x1,t.y1,t.x2-t.x1,t.y2-t.y1)),n.nativeContext.restore()}};ti.env="wx",ti=m([e.injectable(),y(0,e.inject(e.VGlobal)),x("design:paramtypes",[Object])],ti);const ei=new e.ContainerModule((t=>{t(ti).toSelf(),t(e.WindowHandlerContribution).toDynamicValue((t=>t.container.get(ti))).whenTargetNamed(ti.env)}));let ni=!1;function ii(t,e=!0){ni||(ni=!0,t.load(Qt),t.load(Zn),t.load(ei),e&&kn(t))}new e.ContainerModule(((t,n,i,r)=>{i(Ie)||t(Ie).toSelf().inSingletonScope(),i(e.PickerService)?r(e.PickerService).toService(Ie):t(e.PickerService).toService(Ie)}));const ri=new e.ContainerModule(((t,n,i,r)=>{i(dn)||t(dn).toSelf().inSingletonScope(),i(e.PickerService)?r(e.PickerService).toService(dn):t(e.PickerService).toService(dn)}));function ai(t){oi(t)}let si=!1;function oi(t){si||(si=!0,sn(t,!1),En(t,!1),Dn(t,!1),Vn(t,!1),$n(t,!1),ii(t,!1),en(t),e.vglobal.hooks.onSetEnv.tap("loadMathPicker",((e,n)=>{"browser"!==n&&function(t){t.load(Mn),t.load(ri)}(t)})))}const li=wt;t.DragNDrop=class{constructor(t){this.onPointerDown=t=>{const e=t.target,n=this.rootNode,i=e===n;if(e&&!i){let r,a=!1;function s(t){if(a||(t.type="dragstart",null==e||e.dispatchEvent(t),a=!0),t.type="drag",null==e||e.dispatchEvent(t),!i){e.pickable=!1;const i=(null==n?void 0:n.pick(t.global.x,t.global.y)).graphic;e.pickable=!0,r!==i&&(r&&(t.type="dragleave",t.target=r,r.dispatchEvent(t)),i&&(t.type="dragenter",t.target=i,i.dispatchEvent(t)),r=i,r&&(t.type="dragover",t.target=r,r.dispatchEvent(t)))}}null==n||n.addEventListener("pointermove",s);const o=function(){a&&(r&&(t.type="drop",t.target=r,r.dispatchEvent(t)),t.type="dragend",e.dispatchEvent(t),a=!1),null==n||n.removeEventListener("pointermove",s)};e.addEventListener("pointerup",o,{once:!0}),e.addEventListener("pointerupoutside",o,{once:!0})}},this.rootNode=t,this.initEvents()}initEvents(){var t;null===(t=this.rootNode)||void 0===t||t.addEventListener("pointerdown",this.onPointerDown)}removeEvents(){var t;null===(t=this.rootNode)||void 0===t||t.removeEventListener("pointerdown",this.onPointerDown)}release(){this.removeEvents(),this.rootNode=null}},t.Fragment=Et,t.Gesture=Bt,t.REACT_TO_CANOPUS_EVENTS=Mt,t.REACT_TO_CANOPUS_EVENTS_LIST=Pt,t.VArc=function(t){return e.createArc(t?t.attribute:{})},t.VArc3d=function(t){return e.createArc3d(t?t.attribute:{})},t.VArea=function(t){return e.createArea(t?t.attribute:{})},t.VCircle=function(t){return e.createCircle(t?t.attribute:{})},t.VGlyph=function(t){return e.createGlyph(t?t.attribute:{})},t.VGroup=function(t){return e.createGroup(t?t.attribute:{})},t.VImage=function(t){return e.createImage(t?t.attribute:{})},t.VLine=function(t){return e.createLine(t?t.attribute:{})},t.VPath=function(t){return e.createPath(t?t.attribute:{})},t.VPolygon=function(t){return e.createPolygon(t?t.attribute:{})},t.VPyramid3d=function(t){return e.createPyramid3d(t?t.attribute:{})},t.VRect=function(t){return e.createRect(t?t.attribute:{})},t.VRect3d=function(t){return e.createRect3d(t?t.attribute:{})},t.VRichText=kt,t.VSymbol=function(t){return e.createSymbol(t?t.attribute:{})},t.VText=function(t){return e.createText(t?t.attribute:{})},t.initAllEnv=function(){ai(e.container)},t.initBrowserEnv=function(){sn(e.container)},t.initFeishuEnv=function(){En(e.container)},t.initLynxEnv=function(){Dn(e.container)},t.initNodeEnv=function(){Vn(e.container)},t.initTaroEnv=function(){$n(e.container)},t.initWxEnv=function(){ii(e.container)},t.jsx=function(t,i,...r){const a=i||{},{key:s,attribute:o,stateProxy:l}=a,h=function(t,e){var n={};for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&e.indexOf(i)<0&&(n[i]=t[i]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(i=Object.getOwnPropertySymbols(t);r<i.length;r++)e.indexOf(i[r])<0&&Object.prototype.propertyIsEnumerable.call(t,i[r])&&(n[i[r]]=t[i[r]])}return n}(a,["key","attribute","stateProxy"]);let c=t;n.isString(t)&&(c=e.graphicCreator[t]);const u=[];r.length&&Tt(1===r.length?r[0]:r,u);const d="Group"===c.name?new c(o):c(i);return function(t,e,n){let i,r=!1;switch(t.type){case"richtext":case"rich/image":break;case"rich/text":i=t.attribute||{},e[0]&&(i.text=e[0]);break;default:r=!0}r?(e.forEach((e=>{e&&t.add(e)})),Object.keys(n).forEach((e=>{const i=Mt[e];i&&t.on(i,n[e])}))):"richtext"===t.type&&(t.attribute.textConfig=e.map((t=>t.attribute)).filter((t=>t)))}(d,u,h),l&&(d.stateProxy=l),d},t.loadAllEnv=ai,t.loadAllModule=oi,t.loadBrowserEnv=sn,t.loadFeishuEnv=En,t.loadLynxEnv=Dn,t.loadNodeEnv=Vn,t.loadTaroEnv=$n,t.loadWxEnv=ii,t.roughModule=li}));
1
+ !function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("@visactor/vrender-core"),require("@visactor/vutils")):"function"==typeof define&&define.amd?define(["exports","@visactor/vrender-core","@visactor/vutils"],e):e(((t="undefined"!=typeof globalThis?globalThis:t||self).VRender=t.VRender||{},t.VRender.Kits={}),t.VRenderCore,t.VUtils)}(this,(function(t,e,n){"use strict";function i(t){return i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},i(t)}function r(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function a(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,(r=i.key,a=void 0,"symbol"==typeof(a=function(t,e){if("object"!=typeof t||null===t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var i=n.call(t,e||"default");if("object"!=typeof i)return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(r,"string"))?a:String(a)),i)}var r,a}function s(t,e,n){return e&&a(t.prototype,e),n&&a(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}function o(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&h(t,e)}function l(t){return l=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},l(t)}function h(t,e){return h=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},h(t,e)}function c(t,e){if(e&&("object"==typeof e||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}function u(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var n,i=l(t);if(e){var r=l(this).constructor;n=Reflect.construct(i,arguments,r)}else n=i.apply(this,arguments);return c(this,n)}}function d(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var n=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=n){var i,r,a,s,o=[],l=!0,h=!1;try{if(a=(n=n.call(t)).next,0===e){if(Object(n)!==n)return;l=!1}else for(;!(l=(i=a.call(n)).done)&&(o.push(i.value),o.length!==e);l=!0);}catch(t){h=!0,r=t}finally{try{if(!l&&null!=n.return&&(s=n.return(),Object(s)!==s))return}finally{if(h)throw r}}return o}}(t,e)||v(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function f(t){return function(t){if(Array.isArray(t))return p(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||v(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function v(t,e){if(t){if("string"==typeof t)return p(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?p(t,e):void 0}}function p(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,i=new Array(e);n<e;n++)i[n]=t[n];return i}function g(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=v(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var i=0,r=function(){};return{s:r,n:function(){return i>=t.length?{done:!0}:{done:!1,value:t[i++]}},e:function(t){throw t},f:r}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,s=!0,o=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return s=t.done,t},e:function(t){o=!0,a=t},f:function(){try{s||null==n.return||n.return()}finally{if(o)throw a}}}}function m(t,e,n,r){var a,s=arguments.length,o=s<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,n):r;if("object"===("undefined"==typeof Reflect?"undefined":i(Reflect))&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,e,n,r);else for(var l=t.length-1;l>=0;l--)(a=t[l])&&(o=(s<3?a(o):s>3?a(e,n,o):a(e,n))||o);return s>3&&o&&Object.defineProperty(e,n,o),o}function y(t,e){return function(n,i){e(n,i,t)}}function x(t,e){if("object"===("undefined"==typeof Reflect?"undefined":i(Reflect))&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)}function b(t,e,n,i){return new(n||(n=Promise))((function(r,a){function s(t){try{l(i.next(t))}catch(t){a(t)}}function o(t){try{l(i.throw(t))}catch(t){a(t)}}function l(t){var e;t.done?r(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,o)}l((i=i.apply(t,e||[])).next())}))}function S(t,e,n){if(t&&t.length){var i=d(e,2),r=i[0],a=i[1],s=Math.PI/180*n,o=Math.cos(s),l=Math.sin(s);t.forEach((function(t){var e=d(t,2),n=e[0],i=e[1];t[0]=(n-r)*o-(i-a)*l+r,t[1]=(n-r)*l+(i-a)*o+a}))}}function C(t){var e=t[0],n=t[1];return Math.sqrt(Math.pow(e[0]-n[0],2)+Math.pow(e[1]-n[1],2))}function w(t,e){var n=e.hachureAngle+90,i=e.hachureGap;i<0&&(i=4*e.strokeWidth),i=Math.max(i,.1);var r=[0,0];if(n){var a,s=g(t);try{for(s.s();!(a=s.n()).done;){S(a.value,r,n)}}catch(t){s.e(t)}finally{s.f()}}var o=function(t,e){var n,i=[],r=g(t);try{for(r.s();!(n=r.n()).done;){var a=f(n.value);a[0].join(",")!==a[a.length-1].join(",")&&a.push([a[0][0],a[0][1]]),a.length>2&&i.push(a)}}catch(t){r.e(t)}finally{r.f()}var s=[];e=Math.max(e,.1);for(var o=[],l=0,h=i;l<h.length;l++)for(var c=h[l],u=0;u<c.length-1;u++){var d=c[u],v=c[u+1];if(d[1]!==v[1]){var p=Math.min(d[1],v[1]);o.push({ymin:p,ymax:Math.max(d[1],v[1]),x:p===d[1]?d[0]:v[0],islope:(v[0]-d[0])/(v[1]-d[1])})}}if(o.sort((function(t,e){return t.ymin<e.ymin?-1:t.ymin>e.ymin?1:t.x<e.x?-1:t.x>e.x?1:t.ymax===e.ymax?0:(t.ymax-e.ymax)/Math.abs(t.ymax-e.ymax)})),!o.length)return s;for(var m=[],y=o[0].ymin;m.length||o.length;){if(o.length){for(var x=-1,b=0;b<o.length&&!(o[b].ymin>y);b++)x=b;o.splice(0,x+1).forEach((function(t){m.push({s:y,edge:t})}))}if(m=m.filter((function(t){return!(t.edge.ymax<=y)})),m.sort((function(t,e){return t.edge.x===e.edge.x?0:(t.edge.x-e.edge.x)/Math.abs(t.edge.x-e.edge.x)})),m.length>1)for(var S=0;S<m.length;S+=2){var C=S+1;if(C>=m.length)break;var w=m[S].edge,M=m[C].edge;s.push([[Math.round(w.x),y],[Math.round(M.x),y]])}y+=e,m.forEach((function(t){t.edge.x=t.edge.x+e*t.edge.islope}))}return s}(t,i);if(n){var l,h=g(t);try{for(h.s();!(l=h.n()).done;){S(l.value,r,-n)}}catch(t){h.e(t)}finally{h.f()}!function(t,e,n){var i=[];t.forEach((function(t){return i.push.apply(i,f(t))})),S(i,e,n)}(o,r,-n)}return o}"function"==typeof SuppressedError&&SuppressedError;var M=function(){function t(e){r(this,t),this.helper=e}return s(t,[{key:"fillPolygons",value:function(t,e){return this._fillPolygons(t,e)}},{key:"_fillPolygons",value:function(t,e){var n=w(t,e);return{type:"fillSketch",ops:this.renderLines(n,e)}}},{key:"renderLines",value:function(t,e){var n,i=[],r=g(t);try{for(r.s();!(n=r.n()).done;){var a=n.value;i.push.apply(i,f(this.helper.doubleLineOps(a[0][0],a[0][1],a[1][0],a[1][1],e)))}}catch(t){r.e(t)}finally{r.f()}return i}}]),t}(),P=function(t){o(n,t);var e=u(n);function n(){return r(this,n),e.apply(this,arguments)}return s(n,[{key:"fillPolygons",value:function(t,e){var n=e.hachureGap;n<0&&(n=4*e.strokeWidth),n=Math.max(n,.1);var i,r=w(t,Object.assign({},e,{hachureGap:n})),a=Math.PI/180*e.hachureAngle,s=[],o=.5*n*Math.cos(a),l=.5*n*Math.sin(a),h=g(r);try{for(h.s();!(i=h.n()).done;){var c=d(i.value,2),u=c[0],v=c[1];C([u,v])&&s.push([[u[0]-o,u[1]+l],f(v)],[[u[0]+o,u[1]-l],f(v)])}}catch(t){h.e(t)}finally{h.f()}return{type:"fillSketch",ops:this.renderLines(s,e)}}}]),n}(M),k=function(t){o(n,t);var e=u(n);function n(){return r(this,n),e.apply(this,arguments)}return s(n,[{key:"fillPolygons",value:function(t,e){var n=this._fillPolygons(t,e),i=Object.assign({},e,{hachureAngle:e.hachureAngle+90}),r=this._fillPolygons(t,i);return n.ops=n.ops.concat(r.ops),n}}]),n}(M),T=function(){function t(e){r(this,t),this.helper=e}return s(t,[{key:"fillPolygons",value:function(t,e){var n=w(t,e=Object.assign({},e,{hachureAngle:0}));return this.dotsOnLines(n,e)}},{key:"dotsOnLines",value:function(t,e){var n=[],i=e.hachureGap;i<0&&(i=4*e.strokeWidth),i=Math.max(i,.1);var r=e.fillWeight;r<0&&(r=e.strokeWidth/2);var a,s=i/4,o=g(t);try{for(o.s();!(a=o.n()).done;)for(var l=a.value,h=C(l),c=h/i,u=Math.ceil(c)-1,d=h-u*i,v=(l[0][0]+l[1][0])/2-i/4,p=Math.min(l[0][1],l[1][1]),m=0;m<u;m++){var y=p+d+m*i,x=v-s+2*Math.random()*s,b=y-s+2*Math.random()*s,S=this.helper.ellipse(x,b,r,r,e);n.push.apply(n,f(S.ops))}}catch(t){o.e(t)}finally{o.f()}return{type:"fillSketch",ops:n}}}]),t}(),E=function(){function t(e){r(this,t),this.helper=e}return s(t,[{key:"fillPolygons",value:function(t,e){var n=w(t,e);return{type:"fillSketch",ops:this.dashedLine(n,e)}}},{key:"dashedLine",value:function(t,e){var n=this,i=e.dashOffset<0?e.hachureGap<0?4*e.strokeWidth:e.hachureGap:e.dashOffset,r=e.dashGap<0?e.hachureGap<0?4*e.strokeWidth:e.hachureGap:e.dashGap,a=[];return t.forEach((function(t){var s=C(t),o=Math.floor(s/(i+r)),l=(s+r-o*(i+r))/2,h=t[0],c=t[1];h[0]>c[0]&&(h=t[1],c=t[0]);for(var u=Math.atan((c[1]-h[1])/(c[0]-h[0])),d=0;d<o;d++){var v=d*(i+r),p=v+i,g=[h[0]+v*Math.cos(u)+l*Math.cos(u),h[1]+v*Math.sin(u)+l*Math.sin(u)],m=[h[0]+p*Math.cos(u)+l*Math.cos(u),h[1]+p*Math.sin(u)+l*Math.sin(u)];a.push.apply(a,f(n.helper.doubleLineOps(g[0],g[1],m[0],m[1],e)))}})),a}}]),t}(),R=function(){function t(e){r(this,t),this.helper=e}return s(t,[{key:"fillPolygons",value:function(t,e){var n=e.hachureGap<0?4*e.strokeWidth:e.hachureGap,i=e.zigzagOffset<0?n:e.zigzagOffset,r=w(t,e=Object.assign({},e,{hachureGap:n+i}));return{type:"fillSketch",ops:this.zigzagLines(r,i,e)}}},{key:"zigzagLines",value:function(t,e,n){var i=this,r=[];return t.forEach((function(t){var a=C(t),s=Math.round(a/(2*e)),o=t[0],l=t[1];o[0]>l[0]&&(o=t[1],l=t[0]);for(var h=Math.atan((l[1]-o[1])/(l[0]-o[0])),c=0;c<s;c++){var u=2*c*e,d=2*(c+1)*e,v=Math.sqrt(2*Math.pow(e,2)),p=[o[0]+u*Math.cos(h),o[1]+u*Math.sin(h)],g=[o[0]+d*Math.cos(h),o[1]+d*Math.sin(h)],m=[p[0]+v*Math.cos(h+Math.PI/4),p[1]+v*Math.sin(h+Math.PI/4)];r.push.apply(r,f(i.helper.doubleLineOps(p[0],p[1],m[0],m[1],n)).concat(f(i.helper.doubleLineOps(m[0],m[1],g[0],g[1],n))))}})),r}}]),t}(),O={},B=function(){function t(e){r(this,t),this.seed=e}return s(t,[{key:"next",value:function(){return this.seed?(Math.pow(2,31)-1&(this.seed=Math.imul(48271,this.seed)))/Math.pow(2,31):Math.random()}}]),t}(),A={A:7,a:7,C:6,c:6,H:1,h:1,L:2,l:2,M:2,m:2,Q:4,q:4,S:4,s:4,T:2,t:2,V:1,v:1,Z:0,z:0};function j(t,e){return t.type===e}function I(t){for(var e=[],n=function(t){for(var e=new Array;""!==t;)if(t.match(/^([ \t\r\n,]+)/))t=t.substr(RegExp.$1.length);else if(t.match(/^([aAcChHlLmMqQsStTvVzZ])/))e[e.length]={type:0,text:RegExp.$1},t=t.substr(RegExp.$1.length);else{if(!t.match(/^(([-+]?[0-9]+(\.[0-9]*)?|[-+]?\.[0-9]+)([eE][-+]?[0-9]+)?)/))return[];e[e.length]={type:1,text:"".concat(parseFloat(RegExp.$1))},t=t.substr(RegExp.$1.length)}return e[e.length]={type:2,text:""},e}(t),i="BOD",r=0,a=n[r];!j(a,2);){var s=0,o=[];if("BOD"===i){if("M"!==a.text&&"m"!==a.text)return I("M0,0"+t);r++,s=A[a.text],i=a.text}else j(a,1)?s=A[i]:(r++,s=A[a.text],i=a.text);if(!(r+s<n.length))throw new Error("Path data ended short");for(var l=r;l<r+s;l++){var h=n[l];if(!j(h,1))throw new Error("Param not a number: "+i+","+h.text);o[o.length]=+h.text}if("number"!=typeof A[i])throw new Error("Bad segment: "+i);var c={key:i,data:o};e.push(c),a=n[r+=s],"M"===i&&(i="L"),"m"===i&&(i="l")}return e}function D(t){var e,n,i,r,a=0,s=0,o=0,l=0,h=[],c=g(t);try{for(c.s();!(r=c.n()).done;){var u=r.value,v=u.key,p=u.data;switch(v){case"M":h.push({key:"M",data:f(p)}),e=d(p,2),a=e[0],s=e[1],o=(n=d(p,2))[0],l=n[1];break;case"m":a+=p[0],s+=p[1],h.push({key:"M",data:[a,s]}),o=a,l=s;break;case"L":h.push({key:"L",data:f(p)}),i=d(p,2),a=i[0],s=i[1];break;case"l":a+=p[0],s+=p[1],h.push({key:"L",data:[a,s]});break;case"C":h.push({key:"C",data:f(p)}),a=p[4],s=p[5];break;case"c":var m=p.map((function(t,e){return e%2?t+s:t+a}));h.push({key:"C",data:m}),a=m[4],s=m[5];break;case"Q":h.push({key:"Q",data:f(p)}),a=p[2],s=p[3];break;case"q":var y=p.map((function(t,e){return e%2?t+s:t+a}));h.push({key:"Q",data:y}),a=y[2],s=y[3];break;case"A":h.push({key:"A",data:f(p)}),a=p[5],s=p[6];break;case"a":a+=p[5],s+=p[6],h.push({key:"A",data:[p[0],p[1],p[2],p[3],p[4],a,s]});break;case"H":h.push({key:"H",data:f(p)}),a=p[0];break;case"h":a+=p[0],h.push({key:"H",data:[a]});break;case"V":h.push({key:"V",data:f(p)}),s=p[0];break;case"v":s+=p[0],h.push({key:"V",data:[s]});break;case"S":h.push({key:"S",data:f(p)}),a=p[2],s=p[3];break;case"s":var x=p.map((function(t,e){return e%2?t+s:t+a}));h.push({key:"S",data:x}),a=x[2],s=x[3];break;case"T":h.push({key:"T",data:f(p)}),a=p[0],s=p[1];break;case"t":a+=p[0],s+=p[1],h.push({key:"T",data:[a,s]});break;case"Z":case"z":h.push({key:"Z",data:[]}),a=o,s=l}}}catch(t){c.e(t)}finally{c.f()}return h}function L(t){var e,n,i,r,a=[],s="",o=0,l=0,h=0,c=0,u=0,v=0,p=g(t);try{for(p.s();!(r=p.n()).done;){var m=r.value,y=m.key,x=m.data;switch(y){case"M":a.push({key:"M",data:f(x)}),o=(e=d(x,2))[0],l=e[1],h=(n=d(x,2))[0],c=n[1];break;case"C":a.push({key:"C",data:f(x)}),o=x[4],l=x[5],u=x[2],v=x[3];break;case"L":a.push({key:"L",data:f(x)}),o=(i=d(x,2))[0],l=i[1];break;case"H":o=x[0],a.push({key:"L",data:[o,l]});break;case"V":l=x[0],a.push({key:"L",data:[o,l]});break;case"S":var b=0,S=0;"C"===s||"S"===s?(b=o+(o-u),S=l+(l-v)):(b=o,S=l),a.push({key:"C",data:[b,S].concat(f(x))}),u=x[0],v=x[1],o=x[2],l=x[3];break;case"T":var C=d(x,2),w=C[0],M=C[1],P=0,k=0;"Q"===s||"T"===s?(P=o+(o-u),k=l+(l-v)):(P=o,k=l);var T=o+2*(P-o)/3,E=l+2*(k-l)/3,R=w+2*(P-w)/3,O=M+2*(k-M)/3;a.push({key:"C",data:[T,E,R,O,w,M]}),u=P,v=k,o=w,l=M;break;case"Q":var B=d(x,4),A=B[0],j=B[1],I=B[2],D=B[3],L=o+2*(A-o)/3,_=l+2*(j-l)/3,F=I+2*(A-I)/3,z=D+2*(j-D)/3;a.push({key:"C",data:[L,_,F,z,I,D]}),u=A,v=j,o=I,l=D;break;case"A":var G=Math.abs(x[0]),V=Math.abs(x[1]),Y=x[2],N=x[3],H=x[4],U=x[5],X=x[6];0===G||0===V?(a.push({key:"C",data:[o,l,U,X,U,X]}),o=U,l=X):o===U&&l===X||(W(o,l,U,X,G,V,Y,N,H).forEach((function(t){a.push({key:"C",data:t})})),o=U,l=X);break;case"Z":a.push({key:"Z",data:[]}),o=h,l=c}s=y}}catch(t){p.e(t)}finally{p.f()}return a}function _(t,e,n){return[t*Math.cos(n)-e*Math.sin(n),t*Math.sin(n)+e*Math.cos(n)]}function W(t,e,n,i,r,a,s,o,l,h){var c,u=(c=s,Math.PI*c/180),f=[],v=0,p=0,g=0,m=0;if(h){var y=d(h,4);v=y[0],p=y[1],g=y[2],m=y[3]}else{var x,b;t=(x=d(_(t,e,-u),2))[0],e=x[1];var S=(t-(n=(b=d(_(n,i,-u),2))[0]))/2,C=(e-(i=b[1]))/2,w=S*S/(r*r)+C*C/(a*a);w>1&&(r*=w=Math.sqrt(w),a*=w);var M=r*r,P=a*a,k=M*P-M*C*C-P*S*S,T=M*C*C+P*S*S,E=(o===l?-1:1)*Math.sqrt(Math.abs(k/T));g=E*r*C/a+(t+n)/2,m=E*-a*S/r+(e+i)/2,v=Math.asin(parseFloat(((e-m)/a).toFixed(9))),p=Math.asin(parseFloat(((i-m)/a).toFixed(9))),t<g&&(v=Math.PI-v),n<g&&(p=Math.PI-p),v<0&&(v=2*Math.PI+v),p<0&&(p=2*Math.PI+p),l&&v>p&&(v-=2*Math.PI),!l&&p>v&&(p-=2*Math.PI)}var R=p-v;if(Math.abs(R)>120*Math.PI/180){var O=p,B=n,A=i;p=l&&p>v?v+120*Math.PI/180*1:v+120*Math.PI/180*-1,f=W(n=g+r*Math.cos(p),i=m+a*Math.sin(p),B,A,r,a,s,0,l,[p,O,g,m])}R=p-v;var j=Math.cos(v),I=Math.sin(v),D=Math.cos(p),L=Math.sin(p),F=Math.tan(R/4),z=4/3*r*F,G=4/3*a*F,V=[t,e],Y=[t+z*I,e-G*j],N=[n+z*L,i-G*D],H=[n,i];if(Y[0]=2*V[0]-Y[0],Y[1]=2*V[1]-Y[1],h)return[Y,N,H].concat(f);f=[Y,N,H].concat(f);for(var U=[],X=0;X<f.length;X+=3){var q=_(f[X][0],f[X][1],u),$=_(f[X+1][0],f[X+1][1],u),J=_(f[X+2][0],f[X+2][1],u);U.push([q[0],q[1],$[0],$[1],J[0],J[1]])}return U}var F={randOffset:function(t,e){return $(t,e)},randOffsetWithRange:function(t,e,n){return q(t,e,n)},ellipse:function(t,e,n,i,r){return Y(t,e,r,V(n,i,r)).opset},doubleLineOps:function(t,e,n,i,r){return J(t,e,n,i,r,!0)}};function z(t,e,n,i,r){return{type:"path",ops:J(t,e,n,i,r)}}function G(t,e,n){var i=(t||[]).length;if(i>2){for(var r=[],a=0;a<i-1;a++)r.push.apply(r,f(J(t[a][0],t[a][1],t[a+1][0],t[a+1][1],n)));return e&&r.push.apply(r,f(J(t[i-1][0],t[i-1][1],t[0][0],t[0][1],n))),{type:"path",ops:r}}return 2===i?z(t[0][0],t[0][1],t[1][0],t[1][1],n):{type:"path",ops:[]}}function V(t,e,n){var i=Math.sqrt(2*Math.PI*Math.sqrt((Math.pow(t/2,2)+Math.pow(e/2,2))/2)),r=Math.ceil(Math.max(n.curveStepCount,n.curveStepCount/Math.sqrt(200)*i)),a=2*Math.PI/r,s=Math.abs(t/2),o=Math.abs(e/2),l=1-n.curveFitting;return{increment:a,rx:s+=$(s*l,n),ry:o+=$(o*l,n)}}function Y(t,e,n,i){var r=d(et(i.increment,t,e,i.rx,i.ry,1,i.increment*q(.1,q(.4,1,n),n),n),2),a=r[0],s=r[1],o=K(a,null,n);if(!n.disableMultiStroke&&0!==n.roughness){var l=K(d(et(i.increment,t,e,i.rx,i.ry,1.5,0,n),1)[0],null,n);o=o.concat(l)}return{estimatedPoints:s,opset:{type:"path",ops:o}}}function N(t,e,n,i,r,a,s,o,l){var h=t,c=e,u=Math.abs(n/2),d=Math.abs(i/2);u+=$(.01*u,l),d+=$(.01*d,l);for(var v=r,p=a;v<0;)v+=2*Math.PI,p+=2*Math.PI;p-v>2*Math.PI&&(v=0,p=2*Math.PI);var g=2*Math.PI/l.curveStepCount,m=Math.min(g/2,(p-v)/2),y=nt(m,h,c,u,d,v,p,1,l);if(!l.disableMultiStroke){var x=nt(m,h,c,u,d,v,p,1.5,l);y.push.apply(y,f(x))}return s&&(o?y.push.apply(y,f(J(h,c,h+u*Math.cos(v),c+d*Math.sin(v),l)).concat(f(J(h,c,h+u*Math.cos(p),c+d*Math.sin(p),l)))):y.push({op:"lineTo",data:[h,c]},{op:"lineTo",data:[h+u*Math.cos(v),c+d*Math.sin(v)]})),{type:"path",ops:y}}function H(t,e){var n,i=[],r=g(t);try{for(r.s();!(n=r.n()).done;){var a=n.value;if(a.length){var s=e.maxRandomnessOffset||0,o=a.length;if(o>2){i.push({op:"move",data:[a[0][0]+$(s,e),a[0][1]+$(s,e)]});for(var l=1;l<o;l++)i.push({op:"lineTo",data:[a[l][0]+$(s,e),a[l][1]+$(s,e)]})}}}}catch(t){r.e(t)}finally{r.f()}return{type:"fillPath",ops:i}}function U(t,e){return function(t,e){var n=t.fillStyle||"hachure";if(!O[n])switch(n){case"zigzag":O[n]||(O[n]=new P(e));break;case"cross-hatch":O[n]||(O[n]=new k(e));break;case"dots":O[n]||(O[n]=new T(e));break;case"dashed":O[n]||(O[n]=new E(e));break;case"zigzag-line":O[n]||(O[n]=new R(e));break;default:O[n="hachure"]||(O[n]=new M(e))}return O[n]}(e,F).fillPolygons(t,e)}function X(t){return t.randomizer||(t.randomizer=new B(t.seed||0)),t.randomizer.next()}function q(t,e,n){var i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1;return n.roughness*i*(X(n)*(e-t)+t)}function $(t,e){return q(-t,t,e,arguments.length>2&&void 0!==arguments[2]?arguments[2]:1)}function J(t,e,n,i,r){var a=arguments.length>5&&void 0!==arguments[5]&&arguments[5]?r.disableMultiStrokeFill:r.disableMultiStroke,s=Q(t,e,n,i,r,!0,!1);if(a)return s;var o=Q(t,e,n,i,r,!0,!0);return s.concat(o)}function Q(t,e,n,i,r,a,s){var o,l=Math.pow(t-n,2)+Math.pow(e-i,2),h=Math.sqrt(l);o=h<200?1:h>500?.4:-.0016668*h+1.233334;var c=r.maxRandomnessOffset||0;c*c*100>l&&(c=h/10);var u=c/2,d=.2+.2*X(r),f=r.bowing*r.maxRandomnessOffset*(i-e)/200,v=r.bowing*r.maxRandomnessOffset*(t-n)/200;f=$(f,r,o),v=$(v,r,o);var p=[],g=function(){return $(u,r,o)},m=function(){return $(c,r,o)},y=r.preserveVertices;return a&&(s?p.push({op:"move",data:[t+(y?0:g()),e+(y?0:g())]}):p.push({op:"move",data:[t+(y?0:$(c,r,o)),e+(y?0:$(c,r,o))]})),s?p.push({op:"bcurveTo",data:[f+t+(n-t)*d+g(),v+e+(i-e)*d+g(),f+t+2*(n-t)*d+g(),v+e+2*(i-e)*d+g(),n+(y?0:g()),i+(y?0:g())]}):p.push({op:"bcurveTo",data:[f+t+(n-t)*d+m(),v+e+(i-e)*d+m(),f+t+2*(n-t)*d+m(),v+e+2*(i-e)*d+m(),n+(y?0:m()),i+(y?0:m())]}),p}function Z(t,e,n){var i=[];i.push([t[0][0]+$(e,n),t[0][1]+$(e,n)]),i.push([t[0][0]+$(e,n),t[0][1]+$(e,n)]);for(var r=1;r<t.length;r++)i.push([t[r][0]+$(e,n),t[r][1]+$(e,n)]),r===t.length-1&&i.push([t[r][0]+$(e,n),t[r][1]+$(e,n)]);return K(i,null,n)}function K(t,e,n){var i=t.length,r=[];if(i>3){var a=[],s=1-n.curveTightness;r.push({op:"move",data:[t[1][0],t[1][1]]});for(var o=1;o+2<i;o++){var l=t[o];a[0]=[l[0],l[1]],a[1]=[l[0]+(s*t[o+1][0]-s*t[o-1][0])/6,l[1]+(s*t[o+1][1]-s*t[o-1][1])/6],a[2]=[t[o+1][0]+(s*t[o][0]-s*t[o+2][0])/6,t[o+1][1]+(s*t[o][1]-s*t[o+2][1])/6],a[3]=[t[o+1][0],t[o+1][1]],r.push({op:"bcurveTo",data:[a[1][0],a[1][1],a[2][0],a[2][1],a[3][0],a[3][1]]})}if(e&&2===e.length){var h=n.maxRandomnessOffset;r.push({op:"lineTo",data:[e[0]+$(h,n),e[1]+$(h,n)]})}}else 3===i?(r.push({op:"move",data:[t[1][0],t[1][1]]}),r.push({op:"bcurveTo",data:[t[1][0],t[1][1],t[2][0],t[2][1],t[2][0],t[2][1]]})):2===i&&r.push.apply(r,f(J(t[0][0],t[0][1],t[1][0],t[1][1],n)));return r}function et(t,e,n,i,r,a,s,o){var l=[],h=[];if(0===o.roughness){t/=4,h.push([e+i*Math.cos(-t),n+r*Math.sin(-t)]);for(var c=0;c<=2*Math.PI;c+=t){var u=[e+i*Math.cos(c),n+r*Math.sin(c)];l.push(u),h.push(u)}h.push([e+i*Math.cos(0),n+r*Math.sin(0)]),h.push([e+i*Math.cos(t),n+r*Math.sin(t)])}else{var d=$(.5,o)-Math.PI/2;h.push([$(a,o)+e+.9*i*Math.cos(d-t),$(a,o)+n+.9*r*Math.sin(d-t)]);for(var f=2*Math.PI+d-.01,v=d;v<f;v+=t){var p=[$(a,o)+e+i*Math.cos(v),$(a,o)+n+r*Math.sin(v)];l.push(p),h.push(p)}h.push([$(a,o)+e+i*Math.cos(d+2*Math.PI+.5*s),$(a,o)+n+r*Math.sin(d+2*Math.PI+.5*s)]),h.push([$(a,o)+e+.98*i*Math.cos(d+s),$(a,o)+n+.98*r*Math.sin(d+s)]),h.push([$(a,o)+e+.9*i*Math.cos(d+.5*s),$(a,o)+n+.9*r*Math.sin(d+.5*s)])}return[h,l]}function nt(t,e,n,i,r,a,s,o,l){var h=a+$(.1,l),c=[];c.push([$(o,l)+e+.9*i*Math.cos(h-t),$(o,l)+n+.9*r*Math.sin(h-t)]);for(var u=h;u<=s;u+=t)c.push([$(o,l)+e+i*Math.cos(u),$(o,l)+n+r*Math.sin(u)]);return c.push([e+i*Math.cos(s),n+r*Math.sin(s)]),c.push([e+i*Math.cos(s),n+r*Math.sin(s)]),K(c,null,l)}function it(t){return f(t)}function rt(t,e){return Math.pow(t[0]-e[0],2)+Math.pow(t[1]-e[1],2)}function at(t,e,n){var i=rt(e,n);if(0===i)return rt(t,e);var r=((t[0]-e[0])*(n[0]-e[0])+(t[1]-e[1])*(n[1]-e[1]))/i;return rt(t,st(e,n,r=Math.max(0,Math.min(1,r))))}function st(t,e,n){return[t[0]+(e[0]-t[0])*n,t[1]+(e[1]-t[1])*n]}function ot(t,e,n,i){var r,a,s=i||[];if(function(t,e){var n=t[e+0],i=t[e+1],r=t[e+2],a=t[e+3],s=3*i[0]-2*n[0]-a[0];s*=s;var o=3*i[1]-2*n[1]-a[1];o*=o;var l=3*r[0]-2*a[0]-n[0];l*=l;var h=3*r[1]-2*a[1]-n[1];return s<l&&(s=l),o<(h*=h)&&(o=h),s+o}(t,e)<n){var o=t[e+0];s.length?(r=s[s.length-1],a=o,Math.sqrt(rt(r,a))>1&&s.push(o)):s.push(o),s.push(t[e+3])}else{var l=.5,h=t[e+0],c=t[e+1],u=t[e+2],d=t[e+3],f=st(h,c,l),v=st(c,u,l),p=st(u,d,l),g=st(f,v,l),m=st(v,p,l),y=st(g,m,l);ot([h,f,g,y],0,n,s),ot([y,m,p,d],0,n,s)}return s}function lt(t,e){return ht(t,0,t.length,e)}function ht(t,e,n,i,r){for(var a=r||[],s=t[e],o=t[n-1],l=0,h=1,c=e+1;c<n-1;++c){var u=at(t[c],s,o);u>l&&(l=u,h=c)}return Math.sqrt(l)>i?(ht(t,e,h+1,i,a),ht(t,h,n,i,a)):(a.length||a.push(s),a.push(o)),a}function ct(t){for(var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:.15,n=arguments.length>2?arguments[2]:void 0,i=[],r=(t.length-1)/3,a=0;a<r;a++)ot(t,3*a,e,i);return n&&n>0?ht(i,0,i.length,n):i}var ut="none",dt=function(){function t(e){r(this,t),this.defaultOptions={maxRandomnessOffset:2,roughness:1,bowing:1,stroke:"#000",strokeWidth:1,curveTightness:0,curveFitting:.95,curveStepCount:9,fillStyle:"hachure",fillWeight:-1,hachureAngle:-41,hachureGap:-1,dashOffset:-1,dashGap:-1,zigzagOffset:-1,seed:0,disableMultiStroke:!1,disableMultiStrokeFill:!1,preserveVertices:!1},this.config=e||{},this.config.options&&(this.defaultOptions=this._o(this.config.options))}return s(t,[{key:"_o",value:function(t){return t?Object.assign({},this.defaultOptions,t):this.defaultOptions}},{key:"_d",value:function(t,e,n){return{shape:t,sets:e||[],options:n||this.defaultOptions}}},{key:"line",value:function(t,e,n,i,r){var a=this._o(r);return this._d("line",[z(t,e,n,i,a)],a)}},{key:"rectangle",value:function(t,e,n,i,r){var a=this._o(r),s=[],o=function(t,e,n,i,r){return function(t,e){return G(t,!0,e)}([[t,e],[t+n,e],[t+n,e+i],[t,e+i]],r)}(t,e,n,i,a);if(a.fill){var l=[[t,e],[t+n,e],[t+n,e+i],[t,e+i]];"solid"===a.fillStyle?s.push(H([l],a)):s.push(U([l],a))}return a.stroke!==ut&&s.push(o),this._d("rectangle",s,a)}},{key:"ellipse",value:function(t,e,n,i,r){var a=this._o(r),s=[],o=V(n,i,a),l=Y(t,e,a,o);if(a.fill)if("solid"===a.fillStyle){var h=Y(t,e,a,o).opset;h.type="fillPath",s.push(h)}else s.push(U([l.estimatedPoints],a));return a.stroke!==ut&&s.push(l.opset),this._d("ellipse",s,a)}},{key:"circle",value:function(t,e,n,i){var r=this.ellipse(t,e,n,n,i);return r.shape="circle",r}},{key:"linearPath",value:function(t,e){var n=this._o(e);return this._d("linearPath",[G(t,!1,n)],n)}},{key:"arc",value:function(t,e,n,i,r,a){var s=arguments.length>6&&void 0!==arguments[6]&&arguments[6],o=arguments.length>7?arguments[7]:void 0,l=this._o(o),h=[],c=N(t,e,n,i,r,a,s,!0,l);if(s&&l.fill)if("solid"===l.fillStyle){var u=Object.assign({},l);u.disableMultiStroke=!0;var d=N(t,e,n,i,r,a,!0,!1,u);d.type="fillPath",h.push(d)}else h.push(function(t,e,n,i,r,a,s){var o=t,l=e,h=Math.abs(n/2),c=Math.abs(i/2);h+=$(.01*h,s),c+=$(.01*c,s);for(var u=r,d=a;u<0;)u+=2*Math.PI,d+=2*Math.PI;d-u>2*Math.PI&&(u=0,d=2*Math.PI);for(var f=(d-u)/s.curveStepCount,v=[],p=u;p<=d;p+=f)v.push([o+h*Math.cos(p),l+c*Math.sin(p)]);return v.push([o+h*Math.cos(d),l+c*Math.sin(d)]),v.push([o,l]),U([v],s)}(t,e,n,i,r,a,l));return l.stroke!==ut&&h.push(c),this._d("arc",h,l)}},{key:"curve",value:function(t,e){var n=this._o(e),i=[],r=function(t,e){var n=Z(t,1*(1+.2*e.roughness),e);if(!e.disableMultiStroke){var i=Z(t,1.5*(1+.22*e.roughness),function(t){var e=Object.assign({},t);return e.randomizer=void 0,t.seed&&(e.seed=t.seed+1),e}(e));n=n.concat(i)}return{type:"path",ops:n}}(t,n);if(n.fill&&n.fill!==ut&&t.length>=3){var a=ct(function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=t.length;if(n<3)throw new Error("A curve must have at least three points.");var i=[];if(3===n)i.push(it(t[0]),it(t[1]),it(t[2]),it(t[2]));else{var r=[];r.push(t[0],t[0]);for(var a=1;a<t.length;a++)r.push(t[a]),a===t.length-1&&r.push(t[a]);var s=[],o=1-e;i.push(it(r[0]));for(var l=1;l+2<r.length;l++){var h=r[l];s[0]=[h[0],h[1]],s[1]=[h[0]+(o*r[l+1][0]-o*r[l-1][0])/6,h[1]+(o*r[l+1][1]-o*r[l-1][1])/6],s[2]=[r[l+1][0]+(o*r[l][0]-o*r[l+2][0])/6,r[l+1][1]+(o*r[l][1]-o*r[l+2][1])/6],s[3]=[r[l+1][0],r[l+1][1]],i.push(s[1],s[2],s[3])}}return i}(t),10,(1+n.roughness)/2);"solid"===n.fillStyle?i.push(H([a],n)):i.push(U([a],n))}return n.stroke!==ut&&i.push(r),this._d("curve",i,n)}},{key:"polygon",value:function(t,e){var n=this._o(e),i=[],r=G(t,!0,n);return n.fill&&("solid"===n.fillStyle?i.push(H([t],n)):i.push(U([t],n))),n.stroke!==ut&&i.push(r),this._d("polygon",i,n)}},{key:"path",value:function(t,e){var n=this._o(e),i=[];if(!t)return this._d("path",i,n);t=(t||"").replace(/\n/g," ").replace(/(-\s)/g,"-").replace("/(ss)/g"," ");var r=n.fill&&"transparent"!==n.fill&&n.fill!==ut,a=n.stroke!==ut,s=!!(n.simplification&&n.simplification<1),o=function(t,e,n){var i,r=L(D(I(t))),a=[],s=[],o=[0,0],l=[],h=function(){var t;l.length>=4&&(t=s).push.apply(t,f(ct(l,1))),l=[]},c=function(){h(),s.length&&(a.push(s),s=[])},u=g(r);try{for(u.s();!(i=u.n()).done;){var d=i.value,v=d.key,p=d.data;switch(v){case"M":c(),o=[p[0],p[1]],s.push(o);break;case"L":h(),s.push([p[0],p[1]]);break;case"C":if(!l.length){var m=s.length?s[s.length-1]:o;l.push([m[0],m[1]])}l.push([p[0],p[1]]),l.push([p[2],p[3]]),l.push([p[4],p[5]]);break;case"Z":h(),s.push([o[0],o[1]])}}}catch(t){u.e(t)}finally{u.f()}if(c(),!n)return a;for(var y=[],x=0,b=a;x<b.length;x++){var S=lt(b[x],n);S.length&&y.push(S)}return y}(t,0,s?4-4*n.simplification:(1+n.roughness)/2);return r&&("solid"===n.fillStyle?i.push(H(o,n)):i.push(U(o,n))),a&&(s?o.forEach((function(t){i.push(G(t,!1,n))})):i.push(function(t,e){var n,i=L(D(I(t))),r=[],a=[0,0],s=[0,0],o=g(i);try{var l=function(){var t=n.value,i=t.key,o=t.data;switch(i){case"M":var l=1*(e.maxRandomnessOffset||0),h=e.preserveVertices;r.push({op:"move",data:o.map((function(t){return t+(h?0:$(l,e))}))}),s=[o[0],o[1]],a=[o[0],o[1]];break;case"L":r.push.apply(r,f(J(s[0],s[1],o[0],o[1],e))),s=[o[0],o[1]];break;case"C":var c=d(o,6),u=c[0],v=c[1],p=c[2],g=c[3],m=c[4],y=c[5];r.push.apply(r,f(function(t,e,n,i,r,a,s,o){for(var l=[],h=[o.maxRandomnessOffset||1,(o.maxRandomnessOffset||1)+.3],c=[0,0],u=o.disableMultiStroke?1:2,d=o.preserveVertices,f=0;f<u;f++)0===f?l.push({op:"move",data:[s[0],s[1]]}):l.push({op:"move",data:[s[0]+(d?0:$(h[0],o)),s[1]+(d?0:$(h[0],o))]}),c=d?[r,a]:[r+$(h[f],o),a+$(h[f],o)],l.push({op:"bcurveTo",data:[t+$(h[f],o),e+$(h[f],o),n+$(h[f],o),i+$(h[f],o),c[0],c[1]]});return l}(u,v,p,g,m,y,s,e))),s=[m,y];break;case"Z":r.push.apply(r,f(J(s[0],s[1],a[0],a[1],e))),s=[a[0],a[1]]}};for(o.s();!(n=o.n()).done;)l()}catch(t){o.e(t)}finally{o.f()}return{type:"path",ops:r}}(t,n))),this._d("path",i,n)}},{key:"opsToPath",value:function(t,e){var n,i="",r=g(t.ops);try{for(r.s();!(n=r.n()).done;){var a=n.value,s="number"==typeof e&&e>=0?a.data.map((function(t){return+t.toFixed(e)})):a.data;switch(a.op){case"move":i+="M".concat(s[0]," ").concat(s[1]," ");break;case"bcurveTo":i+="C".concat(s[0]," ").concat(s[1],", ").concat(s[2]," ").concat(s[3],", ").concat(s[4]," ").concat(s[5]," ");break;case"lineTo":i+="L".concat(s[0]," ").concat(s[1]," ")}}}catch(t){r.e(t)}finally{r.f()}return i.trim()}},{key:"toPaths",value:function(t){var e,n=t.sets||[],i=t.options||this.defaultOptions,r=[],a=g(n);try{for(a.s();!(e=a.n()).done;){var s=e.value,o=null;switch(s.type){case"path":o={d:this.opsToPath(s),stroke:i.stroke,strokeWidth:i.strokeWidth,fill:ut};break;case"fillPath":o={d:this.opsToPath(s),stroke:ut,strokeWidth:0,fill:i.fill||ut};break;case"fillSketch":o=this.fillSketch(s,i)}o&&r.push(o)}}catch(t){a.e(t)}finally{a.f()}return r}},{key:"fillSketch",value:function(t,e){var n=e.fillWeight;return n<0&&(n=e.strokeWidth/2),{d:this.opsToPath(t),stroke:e.fill||ut,strokeWidth:n,fill:ut}}}],[{key:"newSeed",value:function(){return Math.floor(Math.random()*Math.pow(2,31))}}]),t}(),ft=function(){function t(e,n){r(this,t),this.canvas=e,this.ctx=this.canvas.getContext("2d"),this.gen=new dt(n)}return s(t,[{key:"draw",value:function(t){var e,n=t.sets||[],i=t.options||this.getDefaultOptions(),r=this.ctx,a=t.options.fixedDecimalPlaceDigits,s=g(n);try{for(s.s();!(e=s.n()).done;){var o=e.value;switch(o.type){case"path":r.save(),r.strokeStyle="none"===i.stroke?"transparent":i.stroke,r.lineWidth=i.strokeWidth,i.strokeLineDash&&r.setLineDash(i.strokeLineDash),i.strokeLineDashOffset&&(r.lineDashOffset=i.strokeLineDashOffset),this._drawToContext(r,o,a),r.restore();break;case"fillPath":r.save(),r.fillStyle=i.fill||"";var l="curve"===t.shape||"polygon"===t.shape||"path"===t.shape?"evenodd":"nonzero";this._drawToContext(r,o,a,l),r.restore();break;case"fillSketch":this.fillSketch(r,o,i)}}}catch(t){s.e(t)}finally{s.f()}}},{key:"fillSketch",value:function(t,e,n){var i=n.fillWeight;i<0&&(i=n.strokeWidth/2),t.save(),n.fillLineDash&&t.setLineDash(n.fillLineDash),n.fillLineDashOffset&&(t.lineDashOffset=n.fillLineDashOffset),t.strokeStyle=n.fill||"",t.lineWidth=i,this._drawToContext(t,e,n.fixedDecimalPlaceDigits),t.restore()}},{key:"_drawToContext",value:function(t,e,n){var i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"nonzero";t.beginPath();var r,a=g(e.ops);try{for(a.s();!(r=a.n()).done;){var s=r.value,o="number"==typeof n&&n>=0?s.data.map((function(t){return+t.toFixed(n)})):s.data;switch(s.op){case"move":t.moveTo(o[0],o[1]);break;case"bcurveTo":t.bezierCurveTo(o[0],o[1],o[2],o[3],o[4],o[5]);break;case"lineTo":t.lineTo(o[0],o[1])}}}catch(t){a.e(t)}finally{a.f()}"fillPath"===e.type?t.fill(i):t.stroke()}},{key:"generator",get:function(){return this.gen}},{key:"getDefaultOptions",value:function(){return this.gen.defaultOptions}},{key:"line",value:function(t,e,n,i,r){var a=this.gen.line(t,e,n,i,r);return this.draw(a),a}},{key:"rectangle",value:function(t,e,n,i,r){var a=this.gen.rectangle(t,e,n,i,r);return this.draw(a),a}},{key:"ellipse",value:function(t,e,n,i,r){var a=this.gen.ellipse(t,e,n,i,r);return this.draw(a),a}},{key:"circle",value:function(t,e,n,i){var r=this.gen.circle(t,e,n,i);return this.draw(r),r}},{key:"linearPath",value:function(t,e){var n=this.gen.linearPath(t,e);return this.draw(n),n}},{key:"polygon",value:function(t,e){var n=this.gen.polygon(t,e);return this.draw(n),n}},{key:"arc",value:function(t,e,n,i,r,a){var s=arguments.length>6&&void 0!==arguments[6]&&arguments[6],o=arguments.length>7?arguments[7]:void 0,l=this.gen.arc(t,e,n,i,r,a,s,o);return this.draw(l),l}},{key:"curve",value:function(t,e){var n=this.gen.curve(t,e);return this.draw(n),n}},{key:"path",value:function(t,e){var n=this.gen.path(t,e);return this.draw(n),n}}]),t}(),vt=function(t,e){return new ft(t,e)};const pt={maxRandomnessOffset:3,roughness:1,bowing:1,curveFitting:.95,curveTightness:void 0,curveStepCount:9,fillStyle:"hachure",fillWeight:void 0,hachureAngle:60,hachureGap:6,simplification:0,dashOffset:void 0,dashGap:void 0,zigzagOffset:void 0,seed:1,fillLineDash:void 0,fillLineDashOffset:void 0,disableMultiStroke:!1,disableMultiStrokeFill:!1,preserveVertices:!0,fixedDecimalPlaceDigits:void 0};let gt=class{constructor(t){this.canvasRenderer=t,this.style="rough",this.type="arc",this.numberType=e.ARC_NUMBER_TYPE}draw(t,n,i,r){const{context:a}=i;if(!a)return;const s=a.canvas.nativeCanvas,o=vt(s);a.highPerformanceSave();const l=e.getTheme(t).arc;let{x:h=l.x,y:c=l.y}=t.attribute;if(t.transMatrix.onlyTranslate()){const{dx:e=l.dx,dy:n=l.dy}=t.attribute;h+=e,c+=n,a.setTransformForCurrent()}else h=0,c=0,a.transformFromMatrix(t.transMatrix,!0);const u=new e.CustomPath2D,{fill:d=l.fill,stroke:f=l.stroke,lineWidth:v=l.lineWidth,outerRadius:p=l.outerRadius,innerRadius:g=l.innerRadius,maxRandomnessOffset:m=pt.maxRandomnessOffset,roughness:y=pt.roughness,bowing:x=pt.bowing,curveFitting:b=pt.curveFitting,curveTightness:S=pt.curveTightness,curveStepCount:C=pt.curveStepCount,fillStyle:w=pt.fillStyle,fillWeight:M=pt.fillWeight,hachureAngle:P=pt.hachureAngle,hachureGap:k=pt.hachureGap,simplification:T=pt.simplification,dashOffset:E=pt.dashOffset,dashGap:R=pt.dashGap,zigzagOffset:O=pt.zigzagOffset,seed:B=pt.seed,fillLineDash:A=pt.fillLineDash,fillLineDashOffset:j=pt.fillLineDashOffset,disableMultiStroke:I=pt.disableMultiStroke,disableMultiStrokeFill:D=pt.disableMultiStrokeFill,preserveVertices:L=pt.preserveVertices,fixedDecimalPlaceDigits:_=pt.fixedDecimalPlaceDigits}=t.attribute;e.drawArcPath(t,u,h,c,p,g),o.path(u.toString(),{fill:d||void 0,stroke:f||void 0,strokeWidth:v,maxRandomnessOffset:m,roughness:y,bowing:x,curveFitting:b,curveTightness:S,curveStepCount:C,fillStyle:w,fillWeight:M,hachureAngle:P,hachureGap:k,simplification:T,dashOffset:E,dashGap:R,zigzagOffset:O,seed:B,fillLineDash:A,fillLineDashOffset:j,disableMultiStroke:I,disableMultiStrokeFill:D,preserveVertices:L,fixedDecimalPlaceDigits:_}),a.highPerformanceRestore()}drawShape(t,e,n,i,r,a,s,o){if(this.canvasRenderer.drawShape)return this.canvasRenderer.drawShape(t,e,n,i,r,a,s,o)}};gt=m([e.injectable(),y(0,e.inject(e.DefaultCanvasArcRender)),x("design:paramtypes",[Object])],gt);let mt=class extends e.DefaultCanvasAreaRender{constructor(){super(...arguments),this.style="rough"}drawSegmentItem(t,n,i,r,a,s,o,l,h,c,u,d,f,v,p){if(p)return super.drawSegmentItem(t,n,i,r,a,s,o,l,h,c,u,d,f,v,p);t.highPerformanceSave();const g=t.canvas.nativeCanvas,m=vt(g,{}),y=new e.CustomPath2D;e.drawAreaSegments(y,n,h,{offsetX:c,offsetY:u});const{maxRandomnessOffset:x=pt.maxRandomnessOffset,roughness:b=pt.roughness,bowing:S=pt.bowing,curveFitting:C=pt.curveFitting,curveTightness:w=pt.curveTightness,curveStepCount:M=pt.curveStepCount,fillStyle:P=pt.fillStyle,fillWeight:k=pt.fillWeight,hachureAngle:T=pt.hachureAngle,hachureGap:E=pt.hachureGap,simplification:R=pt.simplification,dashOffset:O=pt.dashOffset,dashGap:B=pt.dashGap,zigzagOffset:A=pt.zigzagOffset,seed:j=pt.seed,fillLineDash:I=pt.fillLineDash,fillLineDashOffset:D=pt.fillLineDashOffset,disableMultiStroke:L=pt.disableMultiStroke,disableMultiStrokeFill:_=pt.disableMultiStrokeFill,preserveVertices:W=pt.preserveVertices,fixedDecimalPlaceDigits:F=pt.fixedDecimalPlaceDigits}=o;let{fill:z,stroke:G,lineWidth:V}=o;return Array.isArray(l)?l.forEach((t=>{z=null!=z?z:t.fill,G=null!=G?G:t.stroke,V=null!=V?V:t.lineWidth})):(z=null!=z?z:l.fill,G=null!=G?G:l.stroke,V=null!=V?V:l.lineWidth),m.path(y.toString(),{fill:i?z:void 0,strokeWidth:V,maxRandomnessOffset:x,roughness:b,bowing:S,curveFitting:C,curveTightness:w,curveStepCount:M,fillStyle:P,fillWeight:k,hachureAngle:T,hachureGap:E,simplification:R,dashOffset:O,dashGap:B,zigzagOffset:A,seed:j,fillLineDash:I,fillLineDashOffset:D,disableMultiStroke:L,disableMultiStrokeFill:_,preserveVertices:W,fixedDecimalPlaceDigits:F}),t.highPerformanceRestore(),!1}};mt=m([e.injectable()],mt);let yt=class{constructor(t){this.canvasRenderer=t,this.style="rough",this.type="circle",this.numberType=e.CIRCLE_NUMBER_TYPE}draw(t,n,i,r){const{context:a}=i;if(!a)return;const s=a.canvas.nativeCanvas,o=vt(s,{}),l=e.getTheme(t).circle;let{x:h=l.x,y:c=l.y}=t.attribute;t.transMatrix.onlyTranslate()?a.onlyTranslate()||a.clearMatrix():(h=0,c=0,a.transformFromMatrix(t.transMatrix,!0));const{radius:u=l.radius,fill:d=l.fill,stroke:f=l.stroke,lineWidth:v=l.lineWidth}=t.attribute;o.circle(h,c,u,{fill:d||void 0,stroke:f||void 0,strokeWidth:v,fillStyle:"zigzag",roughness:.5})}drawShape(t,e,n,i,r,a,s,o){if(this.canvasRenderer.drawShape)return this.canvasRenderer.drawShape(t,e,n,i,r,a,s,o)}};yt=m([e.injectable(),y(0,e.inject(e.DefaultCanvasCircleRender)),x("design:paramtypes",[Object])],yt);let xt=class extends e.DefaultCanvasLineRender{constructor(){super(...arguments),this.style="rough"}drawSegmentItem(t,n,i,r,a,s,o,l,h,c,u,d,f,v,p){if(v||p)return super.drawSegmentItem(t,n,i,r,a,s,o,l,h,c,u,d,f,v,p);t.highPerformanceSave();const g=t.canvas.nativeCanvas,m=vt(g,{}),y=new e.CustomPath2D;e.drawSegments(t.camera?t:t.nativeContext,n,h,c,{offsetX:u,offsetY:d});const{maxRandomnessOffset:x=pt.maxRandomnessOffset,roughness:b=pt.roughness,bowing:S=pt.bowing,curveFitting:C=pt.curveFitting,curveTightness:w=pt.curveTightness,curveStepCount:M=pt.curveStepCount,fillStyle:P=pt.fillStyle,fillWeight:k=pt.fillWeight,hachureAngle:T=pt.hachureAngle,hachureGap:E=pt.hachureGap,simplification:R=pt.simplification,dashOffset:O=pt.dashOffset,dashGap:B=pt.dashGap,zigzagOffset:A=pt.zigzagOffset,seed:j=pt.seed,fillLineDash:I=pt.fillLineDash,fillLineDashOffset:D=pt.fillLineDashOffset,disableMultiStroke:L=pt.disableMultiStroke,disableMultiStrokeFill:_=pt.disableMultiStrokeFill,preserveVertices:W=pt.preserveVertices,fixedDecimalPlaceDigits:F=pt.fixedDecimalPlaceDigits}=o;let{fill:z,stroke:G,lineWidth:V}=o;return Array.isArray(l)?l.forEach((t=>{z=null!=z?z:t.fill,G=null!=G?G:t.stroke,V=null!=V?V:t.lineWidth})):(z=null!=z?z:l.fill,G=null!=G?G:l.stroke,V=null!=V?V:l.lineWidth),m.path(y.toString(),{fill:i?z:void 0,stroke:r?G:void 0,strokeWidth:V,maxRandomnessOffset:x,roughness:b,bowing:S,curveFitting:C,curveTightness:w,curveStepCount:M,fillStyle:P,fillWeight:k,hachureAngle:T,hachureGap:E,simplification:R,dashOffset:O,dashGap:B,zigzagOffset:A,seed:j,fillLineDash:I,fillLineDashOffset:D,disableMultiStroke:L,disableMultiStrokeFill:_,preserveVertices:W,fixedDecimalPlaceDigits:F}),t.highPerformanceRestore(),!1}};xt=m([e.injectable()],xt);let bt=class{constructor(t){this.canvasRenderer=t,this.style="rough",this.type="path",this.numberType=e.PATH_NUMBER_TYPE}draw(t,n,i,r){const{context:a}=i;if(!a)return;const s=a.canvas.nativeCanvas,o=vt(s,{});a.highPerformanceSave();const l=e.getTheme(t).path;a.transformFromMatrix(t.transMatrix,!0);const{fill:h=l.fill,stroke:c=l.stroke,lineWidth:u=l.lineWidth,path:d=l.path,maxRandomnessOffset:f=pt.maxRandomnessOffset,roughness:v=pt.roughness,bowing:p=pt.bowing,curveFitting:g=pt.curveFitting,curveTightness:m=pt.curveTightness,curveStepCount:y=pt.curveStepCount,fillStyle:x=pt.fillStyle,fillWeight:b=pt.fillWeight,hachureAngle:S=pt.hachureAngle,hachureGap:C=pt.hachureGap,simplification:w=pt.simplification,dashOffset:M=pt.dashOffset,dashGap:P=pt.dashGap,zigzagOffset:k=pt.zigzagOffset,seed:T=pt.seed,fillLineDash:E=pt.fillLineDash,fillLineDashOffset:R=pt.fillLineDashOffset,disableMultiStroke:O=pt.disableMultiStroke,disableMultiStrokeFill:B=pt.disableMultiStrokeFill,preserveVertices:A=pt.preserveVertices,fixedDecimalPlaceDigits:j=pt.fixedDecimalPlaceDigits}=t.attribute;"string"==typeof d&&o.path(d,{fill:h||void 0,stroke:c||void 0,strokeWidth:u,maxRandomnessOffset:f,roughness:v,bowing:p,curveFitting:g,curveTightness:m,curveStepCount:y,fillStyle:x,fillWeight:b,hachureAngle:S,hachureGap:C,simplification:w,dashOffset:M,dashGap:P,zigzagOffset:k,seed:T,fillLineDash:E,fillLineDashOffset:R,disableMultiStroke:O,disableMultiStrokeFill:B,preserveVertices:A,fixedDecimalPlaceDigits:j}),a.highPerformanceRestore()}drawShape(t,e,n,i,r,a,s,o){if(this.canvasRenderer.drawShape)return this.canvasRenderer.drawShape(t,e,n,i,r,a,s,o)}};bt=m([e.injectable(),y(0,e.inject(e.DefaultCanvasPathRender)),x("design:paramtypes",[Object])],bt);let St=class{constructor(t){this.canvasRenderer=t,this.style="rough",this.type="rect",this.numberType=e.RECT_NUMBER_TYPE}draw(t,n,i,r){const{context:a}=i;if(!a)return;const s=a.canvas.nativeCanvas,o=vt(s);a.highPerformanceSave();const l=e.getTheme(t).rect;let{x:h=l.x,y:c=l.y}=t.attribute;if(t.transMatrix.onlyTranslate()){const{dx:e=l.dx,dy:n=l.dy}=t.attribute;h+=e,c+=n,a.setTransformForCurrent()}else h=0,c=0,a.transformFromMatrix(t.transMatrix,!0);const{fill:u=l.fill,stroke:d=l.stroke,fillColor:f=l.fill,strokeColor:v=l.stroke,width:p=l.width,height:g=l.height,lineWidth:m=l.lineWidth,maxRandomnessOffset:y=pt.maxRandomnessOffset,roughness:x=pt.roughness,bowing:b=pt.bowing,curveFitting:S=pt.curveFitting,curveTightness:C=pt.curveTightness,curveStepCount:w=pt.curveStepCount,fillStyle:M=pt.fillStyle,fillWeight:P=pt.fillWeight,hachureAngle:k=pt.hachureAngle,hachureGap:T=pt.hachureGap,simplification:E=pt.simplification,dashOffset:R=pt.dashOffset,dashGap:O=pt.dashGap,zigzagOffset:B=pt.zigzagOffset,seed:A=pt.seed,fillLineDash:j=pt.fillLineDash,fillLineDashOffset:I=pt.fillLineDashOffset,disableMultiStroke:D=pt.disableMultiStroke,disableMultiStrokeFill:L=pt.disableMultiStrokeFill,preserveVertices:_=pt.preserveVertices,fixedDecimalPlaceDigits:W=pt.fixedDecimalPlaceDigits}=t.attribute;o.rectangle(h,c,p,g,{fill:u?f:void 0,stroke:d?v:void 0,strokeWidth:m,maxRandomnessOffset:y,roughness:x,bowing:b,curveFitting:S,curveTightness:C,curveStepCount:w,fillStyle:M,fillWeight:P,hachureAngle:k,hachureGap:T,simplification:E,dashOffset:R,dashGap:O,zigzagOffset:B,seed:A,fillLineDash:j,fillLineDashOffset:I,disableMultiStroke:D,disableMultiStrokeFill:L,preserveVertices:_,fixedDecimalPlaceDigits:W}),a.highPerformanceRestore()}drawShape(t,e,n,i,r,a,s,o){if(this.canvasRenderer.drawShape)return this.canvasRenderer.drawShape(t,e,n,i,r,a,s,o)}};St=m([e.injectable(),y(0,e.inject(e.DefaultCanvasRectRender)),x("design:paramtypes",[Object])],St);let Ct=class extends e.BaseRender{constructor(t){super(),this.canvasRenderer=t,this.type="symbol",this.numberType=e.SYMBOL_NUMBER_TYPE,this.style="rough"}draw(t,n,i,r){const{context:a}=i;if(!a)return;const s=a.canvas.nativeCanvas,o=vt(s);a.highPerformanceSave();const l=e.getTheme(t).symbol,h=this.transform(t,l,a),{x:c,y:u,z:d,lastModelMatrix:f}=h,v=t.getParsedPath();if(!v)return;const{fill:p=l.fill,stroke:g=l.stroke,fillColor:m=l.fill,strokeColor:y=l.stroke,size:x=l.size,lineWidth:b=l.lineWidth,maxRandomnessOffset:S=pt.maxRandomnessOffset,roughness:C=pt.roughness,bowing:w=pt.bowing,curveFitting:M=pt.curveFitting,curveTightness:P=pt.curveTightness,curveStepCount:k=pt.curveStepCount,fillStyle:T=pt.fillStyle,fillWeight:E=pt.fillWeight,hachureAngle:R=pt.hachureAngle,hachureGap:O=pt.hachureGap,simplification:B=pt.simplification,dashOffset:A=pt.dashOffset,dashGap:j=pt.dashGap,zigzagOffset:I=pt.zigzagOffset,seed:D=pt.seed,fillLineDash:L=pt.fillLineDash,fillLineDashOffset:_=pt.fillLineDashOffset,disableMultiStroke:W=pt.disableMultiStroke,disableMultiStrokeFill:F=pt.disableMultiStrokeFill,preserveVertices:z=pt.preserveVertices,fixedDecimalPlaceDigits:G=pt.fixedDecimalPlaceDigits}=t.attribute;let V="";if(v.drawToSvgPath)V=v.drawToSvgPath(x,c,u);else{const t=new e.CustomPath2D;v.draw(t,x,c,u)&&t.closePath(),V=t.toString()}o.path(V,{fill:p?m:void 0,stroke:g?y:void 0,strokeWidth:b,maxRandomnessOffset:S,roughness:C,bowing:w,curveFitting:M,curveTightness:P,curveStepCount:k,fillStyle:T,fillWeight:E,hachureAngle:R,hachureGap:O,simplification:B,dashOffset:A,dashGap:j,zigzagOffset:I,seed:D,fillLineDash:L,fillLineDashOffset:_,disableMultiStroke:W,disableMultiStrokeFill:F,preserveVertices:z,fixedDecimalPlaceDigits:G}),a.highPerformanceRestore()}drawShape(t,e,n,i,r,a,s,o){if(this.canvasRenderer.drawShape)return this.canvasRenderer.drawShape(t,e,n,i,r,a,s,o)}};Ct=m([e.injectable(),y(0,e.inject(e.DefaultCanvasSymbolRender)),x("design:paramtypes",[Object])],Ct);var wt=new e.ContainerModule((t=>{t(yt).toSelf().inSingletonScope(),t(e.GraphicRender).to(yt),t(St).toSelf().inSingletonScope(),t(e.GraphicRender).to(St),t(bt).toSelf().inSingletonScope(),t(e.GraphicRender).to(bt),t(Ct).toSelf().inSingletonScope(),t(e.GraphicRender).to(Ct),t(xt).toSelf().inSingletonScope(),t(e.GraphicRender).to(xt),t(mt).toSelf().inSingletonScope(),t(e.GraphicRender).to(mt),t(gt).toSelf().inSingletonScope(),t(e.GraphicRender).to(gt)}));const Mt={onPointerDown:"pointerdown",onPointerUp:"pointerup",onPointerUpOutside:"pointerupoutside",onPointerTap:"pointertap",onPointerOver:"pointerover",onPointerMove:"pointermove",onPointerEnter:"pointerenter",onPointerLeave:"pointerleave",onPointerOut:"pointerout",onMouseDown:"mousedown",onMouseUp:"mouseup",onMouseUpOutside:"mouseupoutside",onMouseMove:"mousemove",onMouseOver:"mouseover",onMouseOut:"mouseout",onMouseEnter:"mouseenter",onMouseLeave:"mouseleave",onPinch:"pinch",onPinchStart:"pinchstart",onPinchEnd:"pinchend",onPan:"pan",onPanStart:"panstart",onPanEnd:"panend",onDrag:"drag",onDragStart:"dragstart",onDragEnter:"dragenter",onDragLeave:"dragleave",onDragOver:"dragover",onDragEnd:"dragend",onRightDown:"rightdown",onRightUp:"rightup",onRightUpOutside:"rightupoutside",onTouchStart:"touchstart",onTouchEnd:"touchend",onTouchEndOutside:"touchendoutside",onTouchMove:"touchmove",onTouchCancel:"touchcancel",onPress:"press",onPressUp:"pressup",onPressEnd:"pressend",onSwipe:"swipe",onDrop:"drop",onWeel:"wheel",onClick:"click",onDblClick:"dblclick"},Pt=Object.keys(Mt);function kt(t){return e.createRichText(t?t.attribute:{})}function Tt(t,e){if(n.isArray(t))return t.forEach((t=>Tt(t,e)));e.push(t)}kt.Text=function(t){return Object.assign({type:"rich/text"},t)},kt.Image=function(t){return Object.assign({type:"rich/image"},t)};const Et=e.Group;const Rt=(t,e)=>{const n=e.x-t.x,i=e.y-t.y;return Math.abs(n)>Math.abs(i)?n>0?"right":"left":i>0?"down":"up"},Ot=(t,e)=>{const n=Math.abs(e.x-t.x),i=Math.abs(e.y-t.y);return Math.sqrt(n*n+i*i)};class Bt extends n.EventEmitter{constructor(t,n={}){var i,r,a,s,o,l,h,c,u,d;super(),this.cachedEvents=[],this.startPoints=[],this.processEvent={},this.throttleTimer=0,this.emitThrottles=[],this.lastTapTarget=null,this.onStart=t=>{this.reset(),this.startTime=e.clock.now();const{cachedEvents:n,startPoints:i}=this;t&&n.push(t.clone()),i.length=n.length;for(let t=0;t<n.length;t++){const{x:e,y:r}=n[t],a={x:e,y:r};i[t]=a}if(1!==i.length)this.startDistance=Ot(i[0],i[1]),this.center=(t=>{const e=t.length;if(1===e)return{x:Math.round(t[0].x),y:Math.round(t[0].y)};let n=0,i=0,r=0;for(;r<e;)n+=t[r].x,i+=t[r].y,r++;return{x:Math.round(n/e),y:Math.round(i/e)}})([i[0],i[1]]);else{const t=n[0];this.pressTimeout=setTimeout((()=>{const e="press",n="none";t.direction=n,t.deltaX=0,t.deltaY=0,t.points=i,this.triggerStartEvent(e,t),this.triggerEvent(e,t),this.eventType=e,this.direction=n}),this.config.press.time)}},this.onMove=t=>{this.clearPressTimeout();const{startPoints:n,cachedEvents:i}=this;if(!n.length)return;const r=t.clone(),{x:a,y:s,pointerId:o}=r;for(let t=0,e=i.length;t<e;t++)if(o===i[t].pointerId){i[t]=r;break}const l={x:a,y:s},h=i.map((t=>({x:t.x,y:t.y}))),c=e.clock.now();if(this.prevMoveTime=this.lastMoveTime,this.prevMovePoint=this.lastMovePoint,this.lastMoveTime=c,this.lastMovePoint=l,1===n.length){const t=n[0],e=a-t.x,i=s-t.y,o=this.direction||Rt(t,l);this.direction=o;const c=this.getEventType(l);return r.direction=o,r.deltaX=e,r.deltaY=i,r.points=h,this.triggerStartEvent(c,r),void this.triggerEvent(c,r)}const{startDistance:u}=this,d=Ot(h[0],h[1]);r.scale=d/u,r.center=this.center,r.points=h,this.triggerStartEvent("pinch",r),this.triggerEvent("pinch",r)},this.onEnd=t=>{const n=t.clone(),{cachedEvents:i,startPoints:r}=this,a=i.map((t=>({x:t.x,y:t.y})));if(n.points=a,this.triggerEndEvent(n),1===i.length){const i=e.clock.now(),a=this.lastMoveTime;if(i-a<100){const t=a-(this.prevMoveTime||this.startTime);if(t>0){const e=this.prevMovePoint||r[0],i=this.lastMovePoint||r[0],a=Ot(e,i),s=a/t;s>this.config.swipe.velocity&&a>this.config.swipe.threshold&&(n.velocity=s,n.direction=Rt(e,i),this.triggerEvent("swipe",n))}}i-this.lastTapTime<this.config.tap.interval&&t.target===this.lastTapTarget?this.tapCount++:this.tapCount=1,this.lastTapTime=i,this.lastTapTarget=t.target,1===this.tapCount?this.triggerEvent("tap",n):2===this.tapCount&&(this.triggerEvent("doubletap",n),this.tapCount=0)}for(let t=0,e=i.length;t<e;t++)if(i[t].pointerId===n.pointerId){i.splice(t,1),r.splice(t,1);break}this.reset(),i.length>0&&this.onStart()},this.element=t,this.tapCount=0,this.lastTapTime=0,this.config={press:{time:null!==(r=null===(i=null==n?void 0:n.press)||void 0===i?void 0:i.time)&&void 0!==r?r:251,threshold:null!==(s=null===(a=null==n?void 0:n.press)||void 0===a?void 0:a.threshold)&&void 0!==s?s:9},swipe:{threshold:null!==(l=null===(o=null==n?void 0:n.swipe)||void 0===o?void 0:o.threshold)&&void 0!==l?l:10,velocity:null!==(c=null===(h=null==n?void 0:n.swipe)||void 0===h?void 0:h.velocity)&&void 0!==c?c:.3},tap:{interval:null!==(d=null===(u=null==n?void 0:n.tap)||void 0===u?void 0:u.interval)&&void 0!==d?d:300}},this.initEvents()}initEvents(){const{element:t}=this;t&&(t.addEventListener("pointerdown",this.onStart),t.addEventListener("pointermove",this.onMove),t.addEventListener("pointerup",this.onEnd),t.addEventListener("pointerupoutside",this.onEnd))}removeEvents(){const{element:t}=this;t&&(t.removeEventListener("pointerdown",this.onStart),t.removeEventListener("pointermove",this.onMove),t.removeEventListener("pointerup",this.onEnd),t.removeEventListener("pointerupoutside",this.onEnd))}release(){this.removeEvents(),this.element=null}getEventType(t){const{eventType:n,startTime:i,startPoints:r}=this;if(n)return n;let a;return a=e.clock.now()-i>this.config.press.time&&Ot(r[0],t)<this.config.press.threshold?"press":"pan",this.eventType=a,a}enable(t){this.processEvent[t]=!0}isProcess(t){return this.processEvent[t]}pushEvent(t,e){const{emitThrottles:n}=this,i={type:t,ev:e};for(let e=0,r=n.length;e<r;e++)if(n[e].type===t)return void n.splice(e,1,i);n.push(i)}clearPressTimeout(){this.pressTimeout&&(clearTimeout(this.pressTimeout),this.pressTimeout=null)}reset(){this.clearPressTimeout(),this.startTime=0,this.startDistance=0,this.direction=null,this.eventType=null,this.prevMoveTime=0,this.prevMovePoint=null,this.lastMoveTime=0,this.lastMovePoint=null}triggerEvent(t,n){this.pushEvent(t,n);const{throttleTimer:i,emitThrottles:r}=this;i||(this.throttleTimer=e.application.global.getRequestAnimationFrame()((()=>{for(let t=0,e=r.length;t<e;t++){const{type:e,ev:n}=r[t];this.emitEvent(e,n)}this.throttleTimer=0,this.emitThrottles.length=0})))}triggerStartEvent(t,e){this.isProcess(t)||(this.enable(t),this.triggerEvent(`${t}start`,e))}triggerEndEvent(t){const e=this.processEvent;Object.keys(e).forEach((n=>{this.triggerEvent(`${n}end`,t),"press"===n&&this.triggerEvent(`${n}up`,t),delete e[n]}))}emitEvent(t,n){const i=this.element._events[e.WILDCARD];if(i)if("fn"in i)i.fn.call(i.context,n,t);else for(let e=0,r=i.length;e<r&&!n.propagationImmediatelyStopped;e++)i[e].fn.call(i[e].context,n,t);this.emit(t,n)}}class At{get x1(){return this.dom.getBoundingClientRect().left}get x2(){return this.dom.getBoundingClientRect().right}get y1(){return this.dom.getBoundingClientRect().top}get y2(){return this.dom.getBoundingClientRect().bottom}get width(){return this.dom.getBoundingClientRect().width}get height(){return this.dom.getBoundingClientRect().height}constructor(t){this.dom=t}}function jt(t,e=!1){const n=document.createElement("img");if(n.crossOrigin="anonymous",e){const e=new Blob([t],{type:"image/svg+xml"});t=window.URL.createObjectURL(e)}if(n.src=t,n.complete)return Promise.resolve(n);return new Promise(((t,e)=>{n.onload=()=>{t(n)},n.onerror=()=>{e(new Error("加载失败"))}}))}let It=class extends e.BaseEnvContribution{constructor(){super(),this.type="browser",this.supportEvent=!0;try{this.supportsTouchEvents="ontouchstart"in globalThis,this.supportsPointerEvents=!!globalThis.PointerEvent,this.supportsMouseEvents=!!globalThis.MouseEvent}catch(t){this.supportsTouchEvents=!1,this.supportsPointerEvents=!1,this.supportsPointerEvents=!1}this.applyStyles=!0}mapToCanvasPoint(t,e){var i;if(e){const{clientX:r,clientY:a}=t,s=e.getBoundingClientRect(),o=null===(i=e.getNativeHandler)||void 0===i?void 0:i.call(e).nativeCanvas;let l,h;return o&&(l=s.width/o.offsetWidth,h=s.height/o.offsetHeight),{x:(r-s.left)/(n.isValidNumber(l)?l:1),y:(a-s.top)/(n.isValidNumber(h)?h:1)}}return{x:t.offsetX,y:t.offsetY}}getNativeAABBBounds(t){let e=t;if("string"==typeof t&&(e=(new DOMParser).parseFromString(t,"text/html").firstChild),e.getBoundingClientRect){const t=e.getBoundingClientRect();return new At(t)}return new n.AABBBounds}removeDom(t){return t.parentElement.removeChild(t),!0}createDom(t){const{tagName:e="div",width:i,height:r,style:a,parent:s}=t,o=document.createElement(e);if(a&&(n.isString(a)?o.setAttribute("style",a):Object.keys(a).forEach((t=>{o.setAttribute(t,a[t])}))),null!=i&&(o.style.width=`${i}px`),null!=r&&(o.style.height=`${r}px`),s){const t=n.isString(s)?this.getElementById(s):s;t&&t.appendChild&&t.appendChild(o)}return o}loadImage(t){return jt(t,!1).then((t=>({data:t,loadState:"success"}))).catch((()=>({data:null,loadState:"fail"})))}loadSvg(t){return jt(t,!0).then((t=>({data:t,loadState:"success"}))).catch((()=>({data:null,loadState:"fail"})))}createCanvas(t){var n,i;const r=document.createElement("canvas");t.id&&(r.id=null!==(n=t.id)&&void 0!==n?n:e.Generator.GenAutoIncrementId().toString());const a=null!==(i=t.dpr)&&void 0!==i?i:window.devicePixelRatio;return t.width&&t.height&&(r.style.width=`${t.width}px`,r.style.height=`${t.height}px`,r.width=t.width*a,r.height=t.height*a),r}createOffscreenCanvas(t){var e;const n=null!==(e=t.dpr)&&void 0!==e?e:window.devicePixelRatio;return new OffscreenCanvas(t.width*n,t.height*n)}releaseCanvas(t){let e;e="string"==typeof t?document.getElementById(t):t,e&&e.parentElement&&e.parentElement.removeChild(e)}getDevicePixelRatio(){return window.devicePixelRatio}getRequestAnimationFrame(){return window.requestAnimationFrame}getCancelAnimationFrame(){return window.cancelAnimationFrame}addEventListener(t,e,n){return document.addEventListener(t,e,n)}removeEventListener(t,e,n){return document.removeEventListener(t,e,n)}dispatchEvent(t){return document.dispatchEvent(t)}getElementById(t){return document.getElementById(t)}getRootElement(){return document.body}getDocument(){return document}release(...t){}getElementTop(t,e){let n=t.offsetTop,i=t.offsetParent;for(;null!==i;)n+=i.offsetTop,i=i.offsetParent;return n}getElementLeft(t,e){let n=t.offsetLeft,i=t.offsetParent;for(;null!==i;)n+=i.offsetLeft,i=i.offsetParent;return n}getElementTopLeft(t,e){let n=t.offsetTop,i=t.offsetLeft,r=t.offsetParent;for(;null!==r;)n+=r.offsetTop,i+=r.offsetLeft,r=r.offsetParent;return{top:n,left:i}}};It=m([e.injectable(),x("design:paramtypes",[])],It);let Dt=class extends e.BaseEnvContribution{constructor(){super(),this.type="feishu",this.supportEvent=!0,this.canvasMap=new Map,this.freeCanvasList=[],this.canvasIdx=0,this.supportsTouchEvents=!0;try{this.supportsPointerEvents=!!globalThis.PointerEvent,this.supportsMouseEvents=!!globalThis.MouseEvent}catch(t){this.supportsPointerEvents=!1,this.supportsMouseEvents=!1}this.applyStyles=!0}getDynamicCanvasCount(){return this.freeCanvasList.length}getStaticCanvasCount(){return this.freeCanvasList.length}configure(t,e){t.env===this.type&&(t.setActiveEnvContribution(this),function(t,e,n,i,r){const a=tt.getSystemInfoSync().pixelRatio;e.forEach(((e,s)=>{const o=tt.createCanvasContext(e);o.canvas={width:t.width*a,height:t.height*a};const l={width:t.width*a,height:t.height*a,offsetWidth:t.width,offsetHeight:t.height,id:null!=e?e:"",getContext:()=>o,getBoundingClientRect:()=>({height:t.height,width:t.width})};n.set(e,l),s>=i&&r.push(l)}))}(e.domref,e.canvasIdLists,this.canvasMap,e.freeCanvasIdx,this.freeCanvasList))}loadImage(t){return Promise.resolve({data:t,loadState:"success"})}loadSvg(t){return Promise.reject()}createCanvas(t){const e=this.freeCanvasList[this.canvasIdx]||this.freeCanvasList[this.freeCanvasList.length-1];return this.canvasIdx++,e}createOffscreenCanvas(t){}releaseCanvas(t){}getDevicePixelRatio(){return tt.getSystemInfoSync().pixelRatio}getRequestAnimationFrame(){return function(t){return e.rafBasedSto.call(t)}}getCancelAnimationFrame(){return t=>{e.rafBasedSto.clear(t)}}addEventListener(t,e,n){return null}removeEventListener(t,e,n){return null}dispatchEvent(t){return null}getElementById(t){return this.canvasMap.get(t)}getRootElement(){return null}getDocument(){return null}release(...t){}mapToCanvasPoint(t){var e;return(null===(e=null==t?void 0:t.type)||void 0===e?void 0:e.startsWith("mouse"))?t:null}};Dt=m([e.injectable(),x("design:paramtypes",[])],Dt);let Lt=class extends e.BaseEnvContribution{constructor(){super(),this.type="taro",this.supportEvent=!0,this.canvasMap=new Map,this.freeCanvasList=[],this.canvasIdx=0,this.supportsTouchEvents=!0;try{this.supportsPointerEvents=!!globalThis.PointerEvent,this.supportsMouseEvents=!!globalThis.MouseEvent}catch(t){this.supportsPointerEvents=!1,this.supportsMouseEvents=!1}this.applyStyles=!0}getDynamicCanvasCount(){return this.freeCanvasList.length}getStaticCanvasCount(){return this.freeCanvasList.length}configure(t,e){var n,i,r,a,s,o,l;t.env===this.type&&(t.setActiveEnvContribution(this),n=e.domref,i=e.canvasIdLists,r=this.canvasMap,a=e.freeCanvasIdx,s=this.freeCanvasList,o=e.taro,l=e.pixelRatio,i.forEach(((t,e)=>{const i=o.createCanvasContext(t);i.canvas={width:n.width*l,height:n.height*l},i.createRadialGradient||(i.createRadialGradient=(...t)=>i.createCircularGradient(...t)),!i.getImageData&&o.canvasGetImageData&&(i.getImageData=(e,n,i,r)=>new Promise(((a,s)=>{try{o.canvasGetImageData({canvasId:t,x:e,y:n,width:i,height:r,success(t){a(t)}})}catch(t){s(t)}})));const h={id:t,width:n.width*l,height:n.height*l,offsetWidth:n.width,offsetHeight:n.height,getContext:()=>i,getBoundingClientRect:()=>({height:n.height,width:n.width})};return r.set(t,h),e>=a&&s.push(h),h})),this.taro=e.taro,this.pixelRatio=e.pixelRatio)}loadImage(t){return Promise.resolve({data:t,loadState:"success"})}loadSvg(t){const e=window||globalThis;if(e.DOMParser){const n=(new e.DOMParser).parseFromString(t,"image/svg+xml").children[0],i=(new XMLSerializer).serializeToString(n),r=`data:image/svg+xml;charset=utf-8,${encodeURIComponent(i)}`;return Promise.resolve({data:r,loadState:"success"})}if(e.Blob){const n=new e.Blob([t],{type:"image/svg+xml"}),i=e.URL.createObjectURL(n);return Promise.resolve({data:i,loadState:"success"})}return Promise.reject()}createCanvas(t){const e=this.freeCanvasList[this.canvasIdx]||this.freeCanvasList[this.freeCanvasList.length-1];return this.canvasIdx++,e}createOffscreenCanvas(t){}releaseCanvas(t){}getDevicePixelRatio(){return this.pixelRatio}getRequestAnimationFrame(){return requestAnimationFrame}getCancelAnimationFrame(){return cancelAnimationFrame}addEventListener(t,e,n){return null}removeEventListener(t,e,n){return null}dispatchEvent(t){return null}getElementById(t){return this.canvasMap.get(t)}getRootElement(){return null}getDocument(){return null}release(...t){}};Lt=m([e.injectable(),x("design:paramtypes",[])],Lt);let _t=!1;try{_t=!!lynx.createCanvasNG}catch(t){}let Wt=class extends e.BaseEnvContribution{constructor(){super(),this.type="lynx",this.supportEvent=!0,this.canvasMap=new Map,this.freeCanvasList=[],this.canvasIdx=0,this.supportsTouchEvents=!0;try{this.supportsPointerEvents=!!globalThis.PointerEvent,this.supportsMouseEvents=!!globalThis.MouseEvent}catch(t){this.supportsPointerEvents=!1,this.supportsMouseEvents=!1}this.applyStyles=!0}configure(t,e){t.env===this.type&&(t.setActiveEnvContribution(this),function(t,e,n,i,r){const a=SystemInfo.pixelRatio;e.forEach(((e,s)=>{const o=_t?lynx.createCanvasNG(e):lynx.createCanvas(e);o.width=t.width*a,o.height=t.height*a,_t&&o.attachToCanvasView(e);const l=o.getContext("2d");l.draw=(t,e)=>{e()};const h={width:t.width*a,height:t.height*a,offsetWidth:t.width,offsetHeight:t.height,id:null!=e?e:"",getContext:()=>l,getBoundingClientRect:()=>({height:t.height,width:t.width}),nativeCanvas:o};n.set(e,h),s>=i&&r.push(h)}))}(e.domref,e.canvasIdLists,this.canvasMap,e.freeCanvasIdx,this.freeCanvasList))}getDynamicCanvasCount(){return this.freeCanvasList.length}getStaticCanvasCount(){return this.freeCanvasList.length}loadImage(t){return function(t,e=!1){if(e)return Promise.reject();const n=lynx.createImage(t);return new Promise(((t,e)=>{n.onload=()=>{t(n)},n.onerror=()=>{e(new Error("加载失败"))}}))}(t,!1).then((t=>({data:t,loadState:"success"}))).catch((()=>({data:null,loadState:"fail"})))}loadSvg(t){return Promise.reject()}createCanvas(t){const e=this.freeCanvasList[this.canvasIdx]||this.freeCanvasList[this.freeCanvasList.length-1];return this.canvasIdx++,e}createOffscreenCanvas(t){}releaseCanvas(t){}getDevicePixelRatio(){return SystemInfo.pixelRatio}getRequestAnimationFrame(){return function(t){return e.rafBasedSto.call(t)}}getCancelAnimationFrame(){return t=>{e.rafBasedSto.clear(t)}}addEventListener(t,e,n){return null}removeEventListener(t,e,n){return null}dispatchEvent(t){return null}getElementById(t){return this.canvasMap.get(t)}getRootElement(){return null}getDocument(){return null}release(...t){}};Wt=m([e.injectable(),x("design:paramtypes",[])],Wt);let Ft=class extends e.BaseEnvContribution{constructor(){super(),this.type="wx",this.supportEvent=!0,this.canvasMap=new Map,this.freeCanvasList=[],this.canvasIdx=0,this.supportsTouchEvents=!0;try{this.supportsPointerEvents=!!globalThis.PointerEvent,this.supportsMouseEvents=!!globalThis.MouseEvent}catch(t){this.supportsPointerEvents=!1,this.supportsMouseEvents=!1}this.applyStyles=!0}configure(t,e){if(t.env===this.type)return t.setActiveEnvContribution(this),function(t,e,n,i,r,a){return b(this,void 0,void 0,(function*(){const t=wx.getSystemInfoSync().pixelRatio;for(let s=0;s<e.length;s++){const o=e[s];yield new Promise((e=>{let l=wx.createSelectorQuery();a&&(l=l.in(a)),l.select(`#${o}`).fields({node:!0,size:!0}).exec((a=>{if(!a[0])return;const l=a[0].node,h=a[0].width,c=a[0].height;l.width=h*t,l.height=c*t,n.set(o,l),s>=i&&r.push(l),e(null)}))}))}}))}(e.domref,e.canvasIdLists,this.canvasMap,e.freeCanvasIdx,this.freeCanvasList,e.component).then((()=>{}))}loadImage(t){return Promise.resolve({data:t,loadState:"success"})}loadSvg(t){return Promise.reject()}createCanvas(t){const e=this.freeCanvasList[this.canvasIdx]||this.freeCanvasList[this.freeCanvasList.length-1];return this.canvasIdx++,e}createOffscreenCanvas(t){}releaseCanvas(t){}getDevicePixelRatio(){return wx.getSystemInfoSync().pixelRatio}getRequestAnimationFrame(){return function(t){return e.rafBasedSto.call(t)}}getCancelAnimationFrame(){return t=>{e.rafBasedSto.clear(t)}}addEventListener(t,e,n){return null}removeEventListener(t,e,n){return null}dispatchEvent(t){return null}getElementById(t){return this.canvasMap.get(t)}getRootElement(){return null}getDocument(){return null}release(...t){}mapToCanvasPoint(t){var e;return(null===(e=null==t?void 0:t.type)||void 0===e?void 0:e.startsWith("mouse"))?t:null}};Ft=m([e.injectable(),x("design:paramtypes",[])],Ft);let zt=class extends e.BaseEnvContribution{constructor(){super(...arguments),this.type="node",this._lastTime=0,this.supportEvent=!1}configure(t,e){t.env===this.type&&(t.setActiveEnvContribution(this),this.pkg=e)}getDynamicCanvasCount(){return 0}getStaticCanvasCount(){return 999}loadJson(t){const e=fetch(t).then((t=>t.json()));return e.then((t=>({data:t,state:"success"}))).catch((()=>({data:null,state:"fail"}))),e}loadArrayBuffer(t){return fetch(t).then((t=>t.arrayBuffer())).then((t=>({data:t,loadState:"success"}))).catch((()=>({data:null,loadState:"fail"})))}loadImage(t){const{loadImage:e}=this.pkg;return e?e(t).then((t=>({loadState:t?"success":"fail",data:t}))).catch((()=>({loadState:"fail",data:null}))):Promise.reject(new Error("node-canvas loadImage could not be found!"))}loadSvg(t){const e=this.pkg.Resvg;if(!e)return Promise.reject(new Error("@resvg/resvg-js svgParser could not be found!"));const n=new e(t).render().asPng();return this.loadImage(n)}createCanvas(t){return this.pkg.createCanvas(t.width,t.height)}releaseCanvas(t){}getDevicePixelRatio(){return 1}getRequestAnimationFrame(){return function(t){return e.rafBasedSto.call(t)}}getCancelAnimationFrame(){return t=>{e.rafBasedSto.clear(t)}}addEventListener(t,e,n){}removeEventListener(t,e,n){}getElementById(t){return null}getRootElement(){return null}dispatchEvent(t){}release(...t){}createOffscreenCanvas(t){}};zt=m([e.injectable()],zt);let Gt=!1;const Vt=new e.ContainerModule((t=>{Gt||(Gt=!0,t(It).toSelf().inSingletonScope(),t(e.EnvContribution).toService(It))}));let Yt=!1;const Nt=new e.ContainerModule((t=>{Yt||(Yt=!0,t(Dt).toSelf().inSingletonScope(),t(e.EnvContribution).toService(Dt))}));let Ht=!1;const Ut=new e.ContainerModule((t=>{Ht||(Ht=!0,t(Lt).toSelf().inSingletonScope(),t(e.EnvContribution).toService(Lt))}));let Xt=!1;new e.ContainerModule((t=>{Xt||(Xt=!0,t(Lt).toSelf().inSingletonScope(),t(e.EnvContribution).toService(Lt))}));let qt=!1;const $t=new e.ContainerModule((t=>{qt||(qt=!0,t(Wt).toSelf().inSingletonScope(),t(e.EnvContribution).toService(Wt))}));let Jt=!1;const Qt=new e.ContainerModule((t=>{Jt||(Jt=!0,t(Ft).toSelf().inSingletonScope(),t(e.EnvContribution).toService(Ft))}));let Zt=!1;const Kt=new e.ContainerModule((t=>{Zt||(Zt=!0,t(zt).toSelf().inSingletonScope(),t(e.EnvContribution).toService(zt))})),te=[0,0,0],ee=new n.Matrix(1,0,0,1,0,0);let ne=class{set fillStyle(t){this.nativeContext.fillStyle=t}get fillStyle(){return this.nativeContext.fillStyle}set font(t){this.nativeContext.font=t}get font(){return this.nativeContext.font}set globalAlpha(t){this.nativeContext.globalAlpha=t}get globalAlpha(){return this.nativeContext.globalAlpha}set lineCap(t){this.nativeContext.lineCap=t}get lineCap(){return this.nativeContext.lineCap}set lineDashOffset(t){this.nativeContext.lineDashOffset=t}get lineDashOffset(){return this.nativeContext.lineDashOffset}set lineJoin(t){this.nativeContext.lineJoin=t}get lineJoin(){return this.nativeContext.lineJoin}set lineWidth(t){this.nativeContext.lineWidth=t}get lineWidth(){return this.nativeContext.lineWidth}set miterLimit(t){this.nativeContext.miterLimit=t}get miterLimit(){return this.nativeContext.miterLimit}set shadowBlur(t){this.nativeContext.shadowBlur=t}get shadowBlur(){return this.nativeContext.shadowBlur}set shadowColor(t){this.nativeContext.shadowColor=t}get shadowColor(){return this.nativeContext.shadowColor}set shadowOffsetX(t){this.nativeContext.shadowOffsetX=t}get shadowOffsetX(){return this.nativeContext.shadowOffsetX}set shadowOffsetY(t){this.nativeContext.shadowOffsetY=t}get shadowOffsetY(){return this.nativeContext.shadowOffsetY}set strokeStyle(t){this.nativeContext.strokeStyle=t}get strokeStyle(){return this.nativeContext.strokeStyle}set textAlign(t){this.nativeContext.textAlign=t}get textAlign(){return this.nativeContext.textAlign}set textBaseline(t){this.nativeContext.textBaseline=t}get textBaseline(){return this.nativeContext.textBaseline}get inuse(){return!!this._inuse}set inuse(t){t!==!!this._inuse&&(this._inuse=t,t?(this.nativeContext.save(),this.reset()):this.nativeContext.restore())}constructor(t,i){this.fillAttributes=Object.assign(Object.assign({},e.DefaultFillStyle),{opacity:1}),this.strokeAttributes=Object.assign(Object.assign({},e.DefaultStrokeStyle),{opacity:1}),this.textAttributes=Object.assign(Object.assign({},e.DefaultTextStyle),{opacity:1}),this._clearShadowStyle=!1,this._clearFilterStyle=!1,this._clearGlobalCompositeOperationStyle=!1;const r=t.nativeCanvas.getContext("2d");if(!r)throw new Error("发生错误,获取2d上下文失败");this.nativeContext=r,this.canvas=t,this.matrix=new n.Matrix(1,0,0,1,0,0),this.stack=[],this.dpr=i,this.applyedMatrix=new n.Matrix(1,0,0,1,0,0)}reset(){this.stack.length&&console.warn("可能存在bug,matrix没有清空"),this.matrix.setValue(1,0,0,1,0,0),this.applyedMatrix=new n.Matrix(1,0,0,1,0,0),this.stack.length=0,this.nativeContext.setTransform(1,0,0,1,0,0)}getCanvas(){return this.canvas}getContext(){return this.nativeContext}setTransformForCurrent(t=!1){!t&&this.applyedMatrix.equalToMatrix(this.matrix)||(this.applyedMatrix.setValue(this.matrix.a,this.matrix.b,this.matrix.c,this.matrix.d,this.matrix.e,this.matrix.f),this.nativeContext.setTransform(this.matrix.a,this.matrix.b,this.matrix.c,this.matrix.d,this.matrix.e,this.matrix.f))}get currentMatrix(){return this.matrix}cloneMatrix(t){return e.matrixAllocate.allocateByObj(t)}clear(){this.save(),this.resetTransform(),this.nativeContext.clearRect(0,0,this.canvas.width,this.canvas.height),this.restore()}restore(){this.nativeContext.restore(),this.stack.length>0&&(e.matrixAllocate.free(this.matrix),this.matrix=this.stack.pop(),this.setTransformForCurrent(!0))}highPerformanceRestore(){this.stack.length>0&&(e.matrixAllocate.free(this.matrix),this.matrix=this.stack.pop())}rotate(t,e=!0){this.matrix.rotate(t),e&&this.setTransformForCurrent()}save(){const t=this.cloneMatrix(this.matrix);this.stack.push(t),this.nativeContext.save()}highPerformanceSave(){const t=this.cloneMatrix(this.matrix);this.stack.push(t)}scale(t,e,n=!0){this.matrix.scale(t,e),n&&this.setTransformForCurrent()}setScale(t,e,n=!0){this.matrix.setScale(t,e),n&&this.setTransformForCurrent()}scalePoint(t,e,n,i,r=!0){this.translate(n,i,!1),this.scale(t,e,!1),this.translate(-n,-i,!1),r&&this.setTransformForCurrent()}setTransform(t,e,n,i,r,a,s=!0,o=this.dpr){this.matrix.setValue(o*t,o*e,o*n,o*i,o*r,o*a),s&&this.setTransformForCurrent()}setTransformFromMatrix(t,e=!0,n=this.dpr){this.matrix.setValue(t.a*n,t.b*n,t.c*n,t.d*n,t.e*n,t.f*n),e&&this.setTransformForCurrent()}resetTransform(t=!0,e=this.dpr){this.setTransform(e,0,0,e,0,0),t&&this.setTransformForCurrent()}transform(t,e,n,i,r,a,s=!0){this.matrix.multiply(t,e,n,i,r,a),s&&this.setTransformForCurrent()}transformFromMatrix(t,e){this.matrix.multiply(t.a,t.b,t.c,t.d,t.e,t.f),e&&this.setTransformForCurrent()}translate(t,e,n=!0){this.matrix.translate(t,e),n&&this.setTransformForCurrent()}rotateDegrees(t,e=!0){const n=t*Math.PI/180;this.rotate(n,e)}rotateAbout(t,e,n,i=!0){this.translate(e,n,!1),this.rotate(t,!1),this.translate(-e,-n,!1),i&&this.setTransformForCurrent()}rotateDegreesAbout(t,e,n,i=!0){this.translate(e,n,!1),this.rotateDegrees(t,!1),this.translate(-e,-n,!1),i&&this.setTransformForCurrent()}beginPath(){this.disableBeginPath||this.nativeContext.beginPath()}clip(t,e){t?"string"==typeof t?this.nativeContext.clip(t):this.nativeContext.clip(t,e):this.nativeContext.clip()}arc(t,e,i,r,a,s,o){if(o=o||0,this.camera){const l=[];((t,e,i,r,a,s,o,l)=>{if(l)for(;i>e;)i-=n.pi2;else for(;i<e;)i+=n.pi2;const h=n.pi/3*(i>e?1:-1);let c=e,u=c;for(;u!==i;){u=h>0?Math.min(u+h,i):Math.max(u+h,i);const e=Math.abs(u-c),n=4*Math.tan(e/4)/3,l=u<c?-1:1,d=Math.cos(c),f=Math.sin(c),v=Math.cos(u),p=Math.sin(u),g=d*s+r,m=f*o+a,y=v*s+r,x=p*o+a,b=s*n*l,S=o*n*l;t.push([g-b*f,m+S*d,y+b*p,x-S*v,y,x]),c=u}})(l,r,a,t,e,i,i,s);for(let t=0;t<l.length;++t){const e=l[t];this.bezierCurveTo(e[0],e[1],e[2],e[3],e[4],e[5],o)}}else this.nativeContext.arc(t,e,i,r,a,s)}arcTo(t,e,n,i,r){this.nativeContext.arcTo(t,e,n,i,r)}bezierCurveTo(t,n,i,r,a,s,o){if(o=o||0,this.camera){let l=o,h=o;this.modelMatrix&&(e.transformMat4(te,[t,n,o],this.modelMatrix),t=te[0],n=te[1],l=te[2],e.transformMat4(te,[i,r,o],this.modelMatrix),i=te[0],r=te[1],h=te[2],e.transformMat4(te,[a,s,o],this.modelMatrix),a=te[0],s=te[1],o=te[2]);let c=this.camera.vp(a,s,o);a=c.x,s=c.y,c=this.camera.vp(t,n,l),t=c.x,n=c.y,c=this.camera.vp(i,r,h),i=c.x,r=c.y}this.nativeContext.bezierCurveTo(t,n,i,r,a,s)}closePath(){this.nativeContext.closePath()}ellipse(t,e,n,i,r,a,s,o){null==o?this.nativeContext.ellipse(t,e,n,i,r,a,s):this.nativeContext.ellipse(t,e,n,i,r,a,s,o)}lineTo(t,n,i){if(i=i||0,this.camera){this.modelMatrix&&(e.transformMat4(te,[t,n,i],this.modelMatrix),t=te[0],n=te[1],i=te[2]);const r=this.camera.vp(t,n,i);t=r.x,n=r.y}this.nativeContext.lineTo(t,n)}moveTo(t,n,i){if(i=i||0,this.camera){this.modelMatrix&&(e.transformMat4(te,[t,n,i],this.modelMatrix),t=te[0],n=te[1],i=te[2]);const r=this.camera.vp(t,n,i);t=r.x,n=r.y}this.nativeContext.moveTo(t,n)}quadraticCurveTo(t,n,i,r,a){if(a=a||0,this.camera){let s=a;this.modelMatrix&&(e.transformMat4(te,[t,n,a],this.modelMatrix),t=te[0],n=te[1],s=te[2],e.transformMat4(te,[i,r,a],this.modelMatrix),i=te[0],r=te[1],a=te[2]);let o=this.camera.vp(i,r,a);i=o.x,r=o.y,o=this.camera.vp(t,n,s),t=o.x,n=o.y}this.nativeContext.quadraticCurveTo(t,n,i,r)}rect(t,e,n,i,r){r=r||0,this.camera?(this.moveTo(t,e,r),this.lineTo(t+n,e,r),this.lineTo(t+n,e+i,r),this.lineTo(t,e+i,r),this.closePath()):this.nativeContext.rect(t,e,n,i)}createImageData(){const t=arguments;return 2===t.length?this.nativeContext.createImageData(t[0],t[1]):1===t.length?this.nativeContext.createImageData(t[0]):null}createLinearGradient(t,e,n,i){return this.nativeContext.createLinearGradient(t,e,n,i)}createPattern(t,e){return 0===t.width||0===t.height?null:this.nativeContext.createPattern(t,e)}createRadialGradient(t,e,n,i,r,a){return this.nativeContext.createRadialGradient(t,e,n,i,r,a)}createConicGradient(t,n,i,r){let a,s=!1;const o=this;return{stops:[],addColorStop(t,e){this.stops.push([t,e]),s=!0},GetPattern(l,h,c){return s&&(c||(c=r-i),a=e.createConicalGradient(o,this.stops,t,n,c,i,r,l,h),s=!1),a}}}fill(t,e){this.disableFill||(t?this.nativeContext.fill(t):this.nativeContext.fill())}fillRect(t,e,n,i){this.nativeContext.fillRect(t,e,n,i)}clearRect(t,e,n,i){this.nativeContext.clearRect(t,e,n,i)}project(t,n,i){if(i=i||0,this.camera){this.modelMatrix&&(e.transformMat4(te,[t,n,i],this.modelMatrix),t=te[0],n=te[1],i=te[2]);const r=this.camera.vp(t,n,i);t=r.x,n=r.y}return{x:t,y:n}}view(t,n,i){return i=i||0,this.camera?(this.modelMatrix&&(e.transformMat4(te,[t,n,i],this.modelMatrix),t=te[0],n=te[1],i=te[2]),this.camera.view(t,n,i)):[t,n,i]}fillText(t,n,i,r){if(r=r||0,this.camera){this.modelMatrix&&(e.transformMat4(te,[n,i,r],this.modelMatrix),n=te[0],i=te[1],r=te[2]);const t=this.camera.vp(n,i,r);n=t.x,i=t.y}this.nativeContext.fillText(t,n,i)}getImageData(t,e,n,i){return this.nativeContext.getImageData(t,e,n,i)}getLineDash(){return this.nativeContext.getLineDash()}isPointInPath(t,e){return this.nativeContext.isPointInPath(t,e)}isPointInStroke(t,e){return this.nativeContext.isPointInStroke(t,e)}measureText(t,n=e.application.global.measureTextMethod){var i,r;return n&&"native"!==n?(this.mathTextMeasure||(this.mathTextMeasure=e.application.graphicUtil.createTextMeasureInstance({},{},(()=>this.canvas))),this.mathTextMeasure.textSpec.fontFamily=null!==(i=this.fontFamily)&&void 0!==i?i:e.DefaultTextStyle.fontFamily,this.mathTextMeasure.textSpec.fontSize=null!==(r=this.fontSize)&&void 0!==r?r:e.DefaultTextStyle.fontSize,this.mathTextMeasure._numberCharSize=null,this.mathTextMeasure._fullCharSize=null,this.mathTextMeasure._letterCharSize=null,this.mathTextMeasure._specialCharSizeMap={},this.mathTextMeasure.measure(t,n)):this.nativeContext.measureText(t)}putImageData(t,e,n){this.nativeContext.putImageData(t,e,n)}setLineDash(t){const e=arguments,n=this.nativeContext;this.nativeContext.setLineDash?n.setLineDash(e[0]):"mozDash"in n?n.mozDash=e[0]:"webkitLineDash"in n&&(n.webkitLineDash=e[0])}stroke(t){this.disableStroke||(t?this.nativeContext.stroke(t):this.nativeContext.stroke())}strokeRect(t,e,n,i){this.nativeContext.strokeRect(t,e,n,i)}strokeText(t,n,i,r){if(r=r||0,this.camera){this.modelMatrix&&(e.transformMat4(te,[n,i,r],this.modelMatrix),n=te[0],i=te[1],r=te[2]);const t=this.camera.vp(n,i,r);n=t.x,i=t.y}this.nativeContext.strokeText(t,n,i)}drawImage(){const t=this.nativeContext,e=arguments;3===e.length?t.drawImage(e[0],e[1],e[2]):5===e.length?t.drawImage(e[0],e[1],e[2],e[3],e[4]):9===e.length&&t.drawImage(e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8])}setCommonStyle(t,e,n,i,r){if(Array.isArray(r)){if(r.length<=1)return this._setCommonStyle(t,e,n,i,r[0]);const a={};return r.forEach((t=>{Object.assign(a,t)})),this._setCommonStyle(t,e,n,i,a)}return this._setCommonStyle(t,e,n,i,r)}_setCommonStyle(t,n,i,r,a){const s=this.nativeContext;a||(a=this.fillAttributes);const{fillOpacity:o=a.fillOpacity,opacity:l=a.opacity,fill:h=a.fill}=n;o>1e-12&&l>1e-12?(s.globalAlpha=o*l,s.fillStyle=e.createColor(this,h,t,i,r)):s.globalAlpha=o*l}setShadowBlendStyle(t,e,n){if(Array.isArray(n)){if(n.length<=1)return this._setShadowBlendStyle(t,n[0]);const i={};return n.forEach((t=>{Object.assign(i,t)})),this._setShadowBlendStyle(t,e,i)}return this._setShadowBlendStyle(t,e,n)}_setShadowBlendStyle(t,e,n){const i=this.nativeContext;n||(n=this.fillAttributes);const{opacity:r=n.opacity,shadowBlur:a=n.shadowBlur,shadowColor:s=n.shadowColor,shadowOffsetX:o=n.shadowOffsetX,shadowOffsetY:l=n.shadowOffsetY,blur:h=n.blur,globalCompositeOperation:c=n.globalCompositeOperation}=e;r<=1e-12||(a||o||l?(i.shadowBlur=a,i.shadowColor=s,i.shadowOffsetX=o,i.shadowOffsetY=l,this._clearShadowStyle=!0):this._clearShadowStyle&&(i.shadowBlur=0,i.shadowOffsetX=0,i.shadowOffsetY=0),h?(i.filter=`blur(${h}px)`,this._clearFilterStyle=!0):this._clearFilterStyle&&(i.filter="blur(0px)",this._clearFilterStyle=!1),c?(i.globalCompositeOperation=c,this._clearGlobalCompositeOperationStyle=!0):this._clearGlobalCompositeOperationStyle&&(i.globalCompositeOperation="source-over",this._clearGlobalCompositeOperationStyle=!1))}setStrokeStyle(t,e,n,i,r){if(Array.isArray(r)){if(r.length<=1)return this._setStrokeStyle(t,e,n,i,r[0]);const a={};return r.forEach((t=>{Object.assign(a,t)})),this._setStrokeStyle(t,e,n,i,a)}return this._setStrokeStyle(t,e,n,i,r)}_setStrokeStyle(t,n,i,r,a){const s=this.nativeContext;a||(a=this.strokeAttributes);const{strokeOpacity:o=a.strokeOpacity,opacity:l=a.opacity}=n;if(o>1e-12&&l>1e-12){const{lineWidth:h=a.lineWidth,stroke:c=a.stroke,lineJoin:u=a.lineJoin,lineDash:d=a.lineDash,lineCap:f=a.lineCap,miterLimit:v=a.miterLimit}=n;s.globalAlpha=o*l,s.lineWidth=e.getScaledStroke(this,h,this.dpr),s.strokeStyle=e.createColor(this,c,t,i,r),s.lineJoin=u,s.setLineDash(d),s.lineCap=f,s.miterLimit=v}}setTextStyleWithoutAlignBaseline(t,n,i){const r=this.nativeContext;n||(n=this.textAttributes);const{scaleIn3d:a=n.scaleIn3d}=t;t.font?r.font=t.font:r.font=e.getContextFont(t,n,a&&this.camera&&this.camera.getProjectionScale(i));const{fontFamily:s=n.fontFamily,fontSize:o=n.fontSize}=t;this.fontFamily=s,this.fontSize=o,r.textAlign="left",r.textBaseline="alphabetic"}setTextStyle(t,n,i){var r,a;const s=this.nativeContext;n||(n=this.textAttributes),t.font?s.font=t.font:s.font=e.getContextFont(t,n,this.camera&&this.camera.getProjectionScale(i));const{fontFamily:o=n.fontFamily,fontSize:l=n.fontSize}=t;this.fontFamily=o,this.fontSize=l,s.textAlign=null!==(r=t.textAlign)&&void 0!==r?r:n.textAlign,s.textBaseline=null!==(a=t.textBaseline)&&void 0!==a?a:n.textBaseline}draw(){}clearMatrix(t=!0,e=this.dpr){this.setTransformFromMatrix(ee,t,e)}onlyTranslate(t=this.dpr){return this.matrix.a===t&&0===this.matrix.b&&0===this.matrix.c&&this.matrix.d===t}release(...t){this.stack.forEach((t=>e.matrixAllocate.free(t))),this.stack.length=0}};ne.env="browser",ne=m([e.injectable(),x("design:paramtypes",[Object,Number])],ne);let ie=class extends e.BaseCanvas{constructor(t){super(t)}init(t){const{container:n}=t;if("string"==typeof n){const t=e.application.global.getElementById(n);t&&(this._container=t)}else this._container=n;this._context=new ne(this,this._dpr),this.initStyle()}initStyle(){if(!this.controled)return;const{nativeCanvas:t}=this;t.width=this._pixelWidth,t.height=this._pixelHeight;!t.style||this.setCanvasStyle(t,this._x,this._y,this._displayWidth,this._displayHeight),null!=this.id&&(t.id=this.id.toString()),this._container&&this._container.appendChild(t),this.visiable||this.hide()}hide(){this._nativeCanvas&&(this._nativeCanvas.style.display="none")}show(){this._nativeCanvas&&(this._nativeCanvas.style.display="block")}applyPosition(){const t=this._nativeCanvas;t.style.position="absolute",t.style.top=`${this._y}px`,t.style.left=`${this._x}px`}resetStyle(t){if(!this.controled)return;const{width:e=this._displayWidth,height:n=this._displayHeight,dpr:i=this._dpr,x:r=this._x,y:a=this._y}=t,{nativeCanvas:s}=this;s.width=e*i,s.height=n*i;!s.style||this.setCanvasStyle(s,r,a,e,n),t.id&&(s.id=t.id),this.visiable||this.hide()}setCanvasStyle(t,e,n,i,r){this.controled&&(t.style.padding="0",t.style.margin="0",t.style.border="0",t.style.background="transparent",t.style.width=`${i}px`,t.style.height=`${r}px`)}toDataURL(t,e){return"image/jpeg"===t?this._nativeCanvas.toDataURL(t,e):"image/png"===t?this._nativeCanvas.toDataURL(t):this._nativeCanvas.toDataURL(t,e)}resize(t,e){if(!this.controled)return;this._pixelWidth=t*this._dpr,this._pixelHeight=e*this._dpr,this._displayWidth=t,this._displayHeight=e,this._nativeCanvas.style&&(this._nativeCanvas.style.width=`${t}px`,this._nativeCanvas.style.height=`${e}px`),this._nativeCanvas.width=this._pixelWidth,this._nativeCanvas.height=this._pixelHeight;this._context.dpr=this._dpr}};function re(t,n){return new e.ContainerModule((i=>{i(e.CanvasFactory).toDynamicValue((()=>e=>new t(e))).whenTargetNamed(t.env),i(e.Context2dFactory).toDynamicValue((()=>(t,e)=>new n(t,e))).whenTargetNamed(n.env)}))}ie.env="browser",ie=m([e.injectable(),x("design:paramtypes",[Object])],ie);const ae=re(ie,ne),se=Symbol.for("MathPickerContribution"),oe=Symbol.for("MathArcPicker"),le=Symbol.for("MathAreaPicker"),he=Symbol.for("MathCirclePicker"),ce=Symbol.for("MathLinePicker"),ue=Symbol.for("MathPathPicker"),de=Symbol.for("MathRectPicker"),fe=Symbol.for("MathSymbolPicker"),ve=Symbol.for("MathTextPicker"),pe=Symbol.for("MathPolygonPicker"),ge=Symbol.for("MathGlyphPicker"),me=Symbol.for("CanvasArcPicker"),ye=Symbol.for("CanvasArc3dPicker"),xe=Symbol.for("CanvasAreaPicker"),be=Symbol.for("CanvasCirclePicker"),Se=Symbol.for("CanvasImagePicker"),Ce=Symbol.for("CanvasLinePicker"),we=Symbol.for("CanvasPathPicker"),Me=Symbol.for("CanvasRectPicker"),Pe=Symbol.for("CanvasRect3dPicker"),ke=Symbol.for("CanvasSymbolPicker"),Te=Symbol.for("CanvasTextPicker"),Ee=Symbol.for("CanvasPolygonPicker"),Re=Symbol.for("CanvasPyramid3dPicker"),Oe=Symbol.for("CanvasRichTextPicker"),Be=Symbol.for("CanvasGlyphPicker"),Ae=Symbol.for("CanvasGroupPicker"),je=Symbol.for("CanvasPickerContribution");let Ie=class extends e.DefaultPickService{constructor(t,e,n,i,r,a,s,o,l,h,c,u,d,f,v){super(f,v),this.contributions=t,this.circlePicker=e,this.rectPicker=n,this.arcPicker=i,this.areaPicker=r,this.imagePicker=a,this.linePicker=s,this.pathPicker=o,this.symbolPicker=l,this.textPicker=h,this.polygonPicker=c,this.richtextPicker=u,this.drawContribution=d,this.global=f,this.pickItemInterceptorContributions=v,this.global.hooks.onSetEnv.tap("canvas-picker-service",((t,e,n)=>{this.configure(n,e)})),this.configure(this.global,this.global.env),this.pickerMap=new Map}init(){this.contributions.getContributions().forEach((t=>{this.pickerMap.set(t.numberType,t)})),super._init()}configure(t,n){const i={width:100,height:100,nativeCanvas:t.createCanvas({width:100,height:100}),id:"for-pick"};this.pickCanvas=e.wrapCanvas(i),this.pickContext=this.pickCanvas.getContext("2d")}pickItem(t,e,n,i){if(!1===t.attribute.pickable)return null;if(this.InterceptorContributions.length)for(let r=0;r<this.InterceptorContributions.length;r++){const a=this.InterceptorContributions[r];if(a.beforePickItem){const r=a.beforePickItem(t,this,e,i,{parentMatrix:n});if(r)return r}}const r=this.pickerMap.get(t.numberType);if(!r)return null;const a=r.contains(t,e,i)?t:null,s={graphic:a};if(a)return s;if(this.InterceptorContributions.length)for(let r=0;r<this.InterceptorContributions.length;r++){const a=this.InterceptorContributions[r];if(a.afterPickItem){const r=a.afterPickItem(t,this,e,i,{parentMatrix:n});if(r)return r}}return s}};m([e.postConstruct(),x("design:type",Function),x("design:paramtypes",[]),x("design:returntype",void 0)],Ie.prototype,"init",null),Ie=m([e.injectable(),y(0,e.inject(e.ContributionProvider)),y(0,e.named(je)),y(1,e.inject(be)),y(2,e.inject(Me)),y(3,e.inject(me)),y(4,e.inject(xe)),y(5,e.inject(Se)),y(6,e.inject(Ce)),y(7,e.inject(we)),y(8,e.inject(ke)),y(9,e.inject(Te)),y(10,e.inject(Ee)),y(11,e.inject(Oe)),y(12,e.inject(e.DrawContribution)),y(13,e.inject(e.VGlobal)),y(14,e.inject(e.ContributionProvider)),y(14,e.named(e.PickItemInterceptor)),x("design:paramtypes",[Object,Object,Object,Object,Object,Object,Object,Object,Object,Object,Object,Object,Object,Object,Object])],Ie);let De=class{constructor(t){this.canvasRenderer=t,this.type="circle",this.numberType=e.CIRCLE_NUMBER_TYPE}contains(t,n,i){if(!t.AABBBounds.containsPoint(n))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:r}=null!=i?i:{};if(!r)return!1;const a=e.getTheme(t).circle;let{x:s=a.x,y:o=a.y}=t.attribute;if(r.highPerformanceSave(),t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(a);s+=e.x,o+=e.y,r.setTransformForCurrent()}else s=0,o=0,r.transformFromMatrix(t.transMatrix,!0);let l=!1;return this.canvasRenderer.drawShape(t,r,s,o,{},null,((t,e,i)=>!!l||(l=t.isPointInPath(n.x,n.y),l)),((t,i,a)=>{if(l)return!0;const s=i.lineWidth||a.lineWidth;return r.lineWidth=e.getScaledStroke(r,s,r.dpr),l=t.isPointInStroke(n.x,n.y),l})),r.highPerformanceRestore(),l}};De=m([e.injectable(),y(0,e.inject(e.CircleRender)),x("design:paramtypes",[Object])],De);const Le=new n.AABBBounds;let _e=class{constructor(t){this.canvasRenderer=t,this.type="rect",this.numberType=e.RECT_NUMBER_TYPE}contains(t,i,r){if(!t.AABBBounds.containsPoint(i))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:a}=null!=r?r:{};if(!a)return!1;const s=e.getTheme(t).rect,{cornerRadius:o=s.cornerRadius}=t.attribute;let{x:l=s.x,y:h=s.y}=t.attribute;a.highPerformanceSave();let c=!0;if(t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(s);l+=e.x,h+=e.y,a.setTransformForCurrent()}else l=0,h=0,c=!1,a.transformFromMatrix(t.transMatrix,!0);let u=!0;if(!c||t.shadowRoot||n.isNumber(o,!0)&&0!==o||n.isArray(o)&&o.some((t=>0!==t)))u=!1,this.canvasRenderer.drawShape(t,a,l,h,{},null,((t,e,n)=>!!u||(u=t.isPointInPath(i.x,i.y),u)),((t,n,r)=>{if(u)return!0;const s=n.lineWidth||r.lineWidth;return a.lineWidth=e.getScaledStroke(a,s,a.dpr),u=t.isPointInStroke(i.x,i.y),u}));else{const{fill:e=s.fill,stroke:n=s.stroke,lineWidth:r=s.lineWidth}=t.attribute;if(e)u=!0;else if(n){const e=t.AABBBounds;Le.setValue(e.x1,e.y1,e.x2,e.y2),Le.expand(-r/2),u=!Le.containsPoint(i)}}return a.highPerformanceRestore(),u}};_e=m([e.injectable(),y(0,e.inject(e.RectRender)),x("design:paramtypes",[Object])],_e);let We=class{constructor(t){this.canvasRenderer=t,this.type="arc",this.numberType=e.ARC_NUMBER_TYPE}contains(t,n,i){if(!t.AABBBounds.containsPoint(n))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:r}=null!=i?i:{};if(!r)return!1;const a=e.getTheme(t).arc;r.highPerformanceSave();let{x:s=a.x,y:o=a.y}=t.attribute;if(t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(a);s+=e.x,o+=e.y,r.setTransformForCurrent()}else s=0,o=0,r.transformFromMatrix(t.transMatrix,!0);let l=!1;return this.canvasRenderer.drawShape(t,r,s,o,{},null,((t,e,i)=>!!l||(l=t.isPointInPath(n.x,n.y),l)),((t,i,a)=>{if(l)return!0;const s=i.lineWidth||a.lineWidth;return r.lineWidth=e.getScaledStroke(r,s,r.dpr),l=t.isPointInStroke(n.x,n.y),l})),r.highPerformanceRestore(),l}};We=m([e.injectable(),y(0,e.inject(e.ArcRender)),x("design:paramtypes",[Object])],We);let Fe=class{constructor(t){this.canvasRenderer=t,this.type="area",this.numberType=e.AREA_NUMBER_TYPE}contains(t,n,i){if(!t.AABBBounds.containsPoint(n))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:r}=null!=i?i:{};if(!r)return!1;const a=e.getTheme(t).area;let{x:s=a.x,y:o=a.y}=t.attribute;if(r.highPerformanceSave(),t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(a);s+=e.x,o+=e.y,r.setTransformForCurrent()}else s=0,o=0,r.transformFromMatrix(t.transMatrix,!0);let l=!1;return this.canvasRenderer.drawShape(t,r,s,o,{},null,(t=>!!l||(l=t.isPointInPath(n.x,n.y),l))),r.highPerformanceRestore(),l}};Fe=m([e.injectable(),y(0,e.inject(e.AreaRender)),x("design:paramtypes",[Object])],Fe);let ze=class{constructor(){this.type="image",this.numberType=e.IMAGE_NUMBER_TYPE}contains(t,e,n){const{pickContext:i}=null!=n?n:{};return!!i&&!!t.AABBBounds.containsPoint(e)}};ze=m([e.injectable()],ze);let Ge=class extends e.BaseRender{};Ge=m([e.injectable()],Ge);let Ve=class extends Ge{constructor(t){super(),this.canvasRenderer=t,this.type="line",this.numberType=e.LINE_NUMBER_TYPE}contains(t,n,i){if(!t.AABBBounds.containsPoint(n))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:r}=null!=i?i:{};if(!r)return!1;r.highPerformanceSave();const a=e.getTheme(t).line,s=this.transform(t,a,r),{x:o,y:l,z:h,lastModelMatrix:c}=s;let u=n;if(r.camera){u=n.clone();const e=t.parent.globalTransMatrix;u.x=e.a*n.x+e.c*n.y+e.e,u.y=e.b*n.x+e.d*n.y+e.f}this.canvasRenderer.z=h;let d=!1;return this.canvasRenderer.drawShape(t,r,o,l,{},null,(t=>!!d||(d=t.isPointInPath(u.x,u.y),d)),((t,n,i)=>{if(d)return!0;const a=n.lineWidth||i.lineWidth;return r.lineWidth=e.getScaledStroke(r,a,r.dpr),d=t.isPointInStroke(u.x,u.y),d})),this.canvasRenderer.z=0,r.modelMatrix!==c&&e.mat4Allocate.free(r.modelMatrix),r.modelMatrix=c,r.highPerformanceRestore(),d}};Ve=m([e.injectable(),y(0,e.inject(e.LineRender)),x("design:paramtypes",[Object])],Ve);let Ye=class extends Ge{constructor(t){super(),this.canvasRenderer=t,this.type="path",this.numberType=e.PATH_NUMBER_TYPE}contains(t,n,i){if(!t.AABBBounds.containsPoint(n))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:r}=null!=i?i:{};if(!r)return!1;const a=e.getTheme(t).path;r.highPerformanceSave();const s=this.transform(t,a,r),{x:o,y:l,z:h,lastModelMatrix:c}=s;let u=n;if(r.camera){u=n.clone();const e=t.parent.globalTransMatrix;u.x=e.a*n.x+e.c*n.y+e.e,u.y=e.b*n.x+e.d*n.y+e.f}this.canvasRenderer.z=h;let d=!1;return this.canvasRenderer.drawShape(t,r,o,l,{},null,((t,e,n)=>!!d||(d=t.isPointInPath(u.x,u.y),d)),((t,n,i)=>{if(d)return!0;const a=n.lineWidth||i.lineWidth;return r.lineWidth=e.getScaledStroke(r,a,r.dpr),d=t.isPointInStroke(u.x,u.y),d})),this.canvasRenderer.z=0,r.modelMatrix!==c&&e.mat4Allocate.free(r.modelMatrix),r.modelMatrix=c,r.highPerformanceRestore(),d}};Ye=m([e.injectable(),y(0,e.inject(e.PathRender)),x("design:paramtypes",[Object])],Ye);let Ne=class extends Ge{constructor(t){super(),this.canvasRenderer=t,this.type="symbol",this.numberType=e.SYMBOL_NUMBER_TYPE}contains(t,n,i){const{pickContext:r}=null!=i?i:{};if(!r)return!1;const a=t.getParsedPath();if(!r.camera){if(!t.AABBBounds.containsPoint(n))return!1;if(a.isSvg||"imprecise"===t.attribute.pickMode)return!0}r.highPerformanceSave();const s=e.getTheme(t).symbol,o=this.transform(t,s,r),{x:l,y:h,z:c,lastModelMatrix:u}=o;let d=n;if(r.camera){d=n.clone();const e=t.parent.globalTransMatrix;d.x=e.a*n.x+e.c*n.y+e.e,d.y=e.b*n.x+e.d*n.y+e.f}this.canvasRenderer.z=c;let f=!1;return this.canvasRenderer.drawShape(t,r,l,h,{},null,((t,e,n)=>!!f||(f=t.isPointInPath(d.x,d.y),f)),((t,n,i)=>{if(f)return!0;const a=n.lineWidth||i.lineWidth;return r.lineWidth=e.getScaledStroke(r,a,r.dpr),f=t.isPointInStroke(d.x,d.y),f})),this.canvasRenderer.z=0,r.modelMatrix!==u&&e.mat4Allocate.free(r.modelMatrix),r.modelMatrix=u,r.highPerformanceRestore(),f}};Ne=m([e.injectable(),y(0,e.inject(e.SymbolRender)),x("design:paramtypes",[Object])],Ne);let He=class extends Ge{constructor(t){super(),this.canvasRenderer=t,this.type="text",this.numberType=e.TEXT_NUMBER_TYPE}contains(t,n,i){const{pickContext:r}=null!=i?i:{};if(!r)return!1;const a=t.AABBBounds;if(!r.camera)return!!a.containsPoint(n);r.highPerformanceSave();const s=e.getTheme(t).text,{keepDirIn3d:o=s.keepDirIn3d}=t.attribute,l=!o,h=this.transform(t,s,r,l),{x:c,y:u,z:d,lastModelMatrix:f}=h;this.canvasRenderer.z=d;let v=n;if(r.camera){v=n.clone();const e=t.parent.globalTransMatrix;v.x=e.a*n.x+e.c*n.y+e.e,v.y=e.b*n.x+e.d*n.y+e.f}let p=!1;return this.canvasRenderer.drawShape(t,r,c,u,{},null,((n,i,r)=>{if(p)return!0;const{fontSize:a=s.fontSize,textBaseline:o=s.textBaseline,textAlign:l=s.textAlign}=t.attribute,h=t.AABBBounds,f=h.height(),g=h.width(),m=e.textLayoutOffsetY(o,f,a),y=e.textDrawOffsetX(l,g);return n.rect(y+c,m+u,g,f,d),p=n.isPointInPath(v.x,v.y),p}),((t,e,n)=>p)),this.canvasRenderer.z=0,r.modelMatrix!==f&&e.mat4Allocate.free(r.modelMatrix),r.modelMatrix=f,r.highPerformanceRestore(),p}};He=m([e.injectable(),y(0,e.inject(e.TextRender)),x("design:paramtypes",[Object])],He);let Ue=class{constructor(t){this.canvasRenderer=t,this.type="polygon",this.numberType=e.POLYGON_NUMBER_TYPE}contains(t,n,i){if(!t.AABBBounds.contains(n.x,n.y))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:r}=null!=i?i:{};if(!r)return!1;const a=e.getTheme(t).polygon;let{x:s=a.x,y:o=a.y}=t.attribute;if(r.highPerformanceSave(),t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(a);s+=e.x,o+=e.y,r.setTransformForCurrent()}else s=0,o=0,r.transformFromMatrix(t.transMatrix,!0);let l=!1;return this.canvasRenderer.drawShape(t,r,s,o,{},null,((t,e,i)=>!!l||(l=t.isPointInPath(n.x,n.y),l)),((t,e,i)=>{if(l)return!0;const a=e.lineWidth||i.lineWidth;return r.lineWidth=a,l=t.isPointInStroke(n.x,n.y),l})),r.highPerformanceRestore(),l}};Ue=m([e.injectable(),y(0,e.inject(e.PolygonRender)),x("design:paramtypes",[Object])],Ue);let Xe=class{constructor(t){this.canvasRenderer=t,this.type="richtext",this.numberType=e.RICHTEXT_NUMBER_TYPE}contains(t,e,n){return!!t.AABBBounds.containsPoint(e)}};Xe=m([e.injectable(),y(0,e.inject(e.RichTextRender)),x("design:paramtypes",[Object])],Xe);let qe=class{constructor(t){this.canvasRenderer=t,this.type="glyph",this.numberType=e.GLYPH_NUMBER_TYPE}contains(t,e,n){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:i}=null!=n?n:{};if(!i)return!1;const r=null==n?void 0:n.pickerService;if(r){let i=!1;return t.getSubGraphic().forEach((t=>{if(i)return;const a=r.pickItem(t,e,null,n);i=!(!a||!a.graphic)})),i}return!1}};qe=m([e.injectable(),y(0,e.inject(e.GlyphRender)),x("design:paramtypes",[Object])],qe),new n.AABBBounds;let $e=class extends Ge{constructor(t){super(),this.canvasRenderer=t,this.type="rect3d",this.numberType=e.RECT3D_NUMBER_TYPE}contains(t,n,i){const{pickContext:r}=null!=i?i:{};if(!r)return!1;const a=e.getTheme(t).rect;r.highPerformanceSave();const s=this.transform(t,a,r),{x:o,y:l,z:h,lastModelMatrix:c}=s;let u=n;if(r.camera){u=n.clone();const e=t.parent.globalTransMatrix;u.x=e.a*n.x+e.c*n.y+e.e,u.y=e.b*n.x+e.d*n.y+e.f}this.canvasRenderer.z=h;let d=!1;return this.canvasRenderer.drawShape(t,r,o,l,i,null,((t,e,n)=>!!d||(d=t.isPointInPath(u.x,u.y),d))),this.canvasRenderer.z=0,r.modelMatrix!==c&&e.mat4Allocate.free(r.modelMatrix),r.modelMatrix=c,r.highPerformanceRestore(),d}};$e=m([e.injectable(),y(0,e.inject(e.Rect3DRender)),x("design:paramtypes",[Object])],$e);let Je=class extends Ge{constructor(t){super(),this.canvasRenderer=t,this.type="pyramid3d",this.numberType=e.PYRAMID3D_NUMBER_TYPE}contains(t,n,i){const{pickContext:r}=null!=i?i:{};if(!r)return!1;const a=e.getTheme(t).polygon;r.highPerformanceSave();const s=this.transform(t,a,r),{x:o,y:l,z:h,lastModelMatrix:c}=s;let u=n;if(r.camera){u=n.clone();const e=t.parent.globalTransMatrix;u.x=e.a*n.x+e.c*n.y+e.e,u.y=e.b*n.x+e.d*n.y+e.f}this.canvasRenderer.z=h;let d=!1;return this.canvasRenderer.drawShape(t,r,o,l,{},null,((t,e,n)=>!!d||(d=t.isPointInPath(u.x,u.y),d)),((t,e,n)=>!1)),this.canvasRenderer.z=0,r.modelMatrix!==c&&e.mat4Allocate.free(r.modelMatrix),r.modelMatrix=c,r.highPerformanceRestore(),d}};Je=m([e.injectable(),y(0,e.inject(e.Pyramid3dRender)),x("design:paramtypes",[Object])],Je);let Qe=class extends Ge{constructor(t){super(),this.canvasRenderer=t,this.type="arc3d",this.numberType=e.ARC3D_NUMBER_TYPE}contains(t,n,i){const{pickContext:r}=null!=i?i:{};if(!r)return!1;const a=e.getTheme(t).arc;r.highPerformanceSave();const s=this.transform(t,a,r),{x:o,y:l,z:h,lastModelMatrix:c}=s;let u=n;if(r.camera){u=n.clone();const e=t.parent.globalTransMatrix;u.x=e.a*n.x+e.c*n.y+e.e,u.y=e.b*n.x+e.d*n.y+e.f}this.canvasRenderer.z=h;let d=!1;return this.canvasRenderer.drawShape(t,r,o,l,i,null,((t,e,n)=>!!d||(d=t.isPointInPath(u.x,u.y),d))),this.canvasRenderer.z=0,r.modelMatrix!==c&&e.mat4Allocate.free(r.modelMatrix),r.modelMatrix=c,r.highPerformanceRestore(),d}};Qe=m([e.injectable(),y(0,e.inject(e.Arc3dRender)),x("design:paramtypes",[Object])],Qe);let Ze=class{constructor(){this.type="group",this.numberType=e.GROUP_NUMBER_TYPE}contains(t,e,n){return!1}};Ze=m([e.injectable()],Ze);var Ke=new e.ContainerModule(((t,n,i,r)=>{t(De).toSelf().inSingletonScope(),t(be).toService(De),t(je).toService(be),t(_e).toSelf().inSingletonScope(),t(Me).toService(_e),t(je).toService(Me),t($e).toSelf().inSingletonScope(),t(Pe).toService($e),t(je).toService(Pe),t(We).toSelf().inSingletonScope(),t(me).toService(We),t(je).toService(me),t(Fe).toSelf().inSingletonScope(),t(xe).toService(Fe),t(je).toService(xe),t(ze).toSelf().inSingletonScope(),t(Se).toService(ze),t(je).toService(Se),t(Ve).toSelf().inSingletonScope(),t(Ce).toService(Ve),t(je).toService(Ce),t(Ye).toSelf().inSingletonScope(),t(we).toService(Ye),t(je).toService(we),t(Ne).toSelf().inSingletonScope(),t(ke).toService(Ne),t(je).toService(ke),t(He).toSelf().inSingletonScope(),t(Te).toService(He),t(je).toService(Te),t(Ue).toSelf().inSingletonScope(),t(Ee).toService(Ue),t(je).toService(Ee),t(Je).toSelf().inSingletonScope(),t(Re).toService(Je),t(je).toService(Re),t(Qe).toSelf().inSingletonScope(),t(ye).toService(Qe),t(je).toService(ye),t(Xe).toSelf().inSingletonScope(),t(Oe).toService(Xe),t(je).toService(Oe),t(qe).toSelf().inSingletonScope(),t(Be).toService(qe),t(je).toService(Be),t(Ze).toSelf().inSingletonScope(),t(Ae).toService(Ze),t(je).toService(Ae),e.bindContributionProvider(t,je)}));const tn=new e.ContainerModule(((t,n,i,r)=>{i(Ie)||t(Ie).toSelf().inSingletonScope(),i(e.PickerService)?r(e.PickerService).toService(Ie):t(e.PickerService).toService(Ie)}));function en(t){t.load(Ke),t.load(tn)}let nn=class extends e.BaseWindowHandlerContribution{get container(){return this.canvas.nativeCanvas.parentElement}constructor(t){super(),this.global=t,this.type="browser",this._canvasIsIntersecting=!0}getTitle(){return this.canvas.id.toString()}getWH(){return{width:this.canvas.width/(this.canvas.dpr||1),height:this.canvas.height/(this.canvas.dpr||1)}}getXY(){return this.canvas.nativeCanvas.getBoundingClientRect()}createWindow(t){t.canvas?this.createWindowByCanvas(t):this.createWindowByConfig(t),this.postInit()}postInit(){try{this.observerCanvas()}catch(t){console.error("发生错误,该环境不存在IntersectionObserver")}}isElementVisible(t){const e=t.getBoundingClientRect(),n=window.innerWidth||document.documentElement.clientWidth,i=window.innerHeight||document.documentElement.clientHeight;return!(e.right<0||e.bottom<0||e.left>n||e.top>i)}observerCanvas(){this._canvasIsIntersecting=this.isElementVisible(this.canvas.nativeCanvas);const t=new IntersectionObserver(((t,e)=>{t.forEach((t=>{this._canvasIsIntersecting!==t.isIntersecting?(this._canvasIsIntersecting=t.isIntersecting,this._onVisibleChangeCb&&this._onVisibleChangeCb(t.isIntersecting)):this._canvasIsIntersecting=t.isIntersecting}))}));t&&t.observe(this.canvas.nativeCanvas)}createWindowByConfig(t){const n=this.global.createCanvas({width:t.width,height:t.height});let i;if(i="string"==typeof t.container?this.global.getElementById(t.container):t.container?t.container:this.global.getRootElement(),!i)throw new Error("发生错误,containerId可能传入有误");t.offscreen?i=null:i.appendChild(n);const r={width:t.width,height:t.height,dpr:t.dpr,nativeCanvas:n,container:i,id:e.Generator.GenAutoIncrementId().toString(),canvasControled:!0};this.canvas=new ie(r)}createWindowByCanvas(t){var e;let n;if("string"==typeof t.canvas){if(n=this.global.getElementById(t.canvas),!n)throw new Error("canvasId 参数不正确,请确认canvas存在并插入dom")}else n=t.canvas;if(!n)throw new Error("发生错误,传入的canvas不正确");let i=t.width,r=t.height;if(null==i||null==r||!t.canvasControled){const t=n.getBoundingClientRect();i=t.width,r=t.height}let a=t.dpr;if(null==a){a=null!==(e=n.getContext("2d").pixelRatio)&&void 0!==e?e:n.width/i}this.canvas=new ie({width:i,height:r,dpr:a,nativeCanvas:n,canvasControled:t.canvasControled})}releaseWindow(){this.canvas.release()}resizeWindow(t,e){this.canvas.resize(t,e)}setDpr(t){this.canvas.dpr=t}getContext(){return this.canvas.getContext()}getNativeHandler(){return this.canvas}getDpr(){return this.canvas.dpr}addEventListener(t,e,n){return this.canvas.nativeCanvas.addEventListener(t,e,n)}removeEventListener(t,e,n){return this.canvas.nativeCanvas.removeEventListener(t,e,n)}dispatchEvent(t){return this.canvas.nativeCanvas.dispatchEvent(t)}getStyle(){return this.canvas.nativeCanvas.style}setStyle(t){this.canvas.nativeCanvas.style=t}getBoundingClientRect(){const t=this.canvas.nativeCanvas,e=this.getWH();return t.parentElement?this.canvas.nativeCanvas.getBoundingClientRect():{x:0,y:0,width:e.width,height:e.height,left:0,top:0,right:0,bottom:0}}clearViewBox(t,e){const n=this.getContext(),i=this.getDpr();n.nativeContext.save(),n.nativeContext.setTransform(i,0,0,i,0,0),n.clearRect(t.x1,t.y1,t.x2-t.x1,t.y2-t.y1),e&&(n.fillStyle=e,n.fillRect(t.x1,t.y1,t.x2-t.x1,t.y2-t.y1)),n.nativeContext.restore()}isVisible(t){return this._canvasIsIntersecting}onVisibleChange(t){this._onVisibleChangeCb=t}getTopLeft(t){return this.global.getElementTopLeft(this.canvas.nativeCanvas,t)}};nn.env="browser",nn=m([e.injectable(),y(0,e.inject(e.VGlobal)),x("design:paramtypes",[Object])],nn);const rn=new e.ContainerModule((t=>{t(nn).toSelf(),t(e.WindowHandlerContribution).toDynamicValue((t=>t.container.get(nn))).whenTargetNamed(nn.env)}));let an=!1;function sn(t,e=!0){an||(an=!0,t.load(Vt),t.load(ae),t.load(rn),e&&en(t))}let on=class extends ne{get globalAlpha(){return this._globalAlpha}set globalAlpha(t){this.nativeContext.globalAlpha=t,this._globalAlpha=t}getImageData(t,e,n,i){return new Promise(((r,a)=>{var s;try{tt.canvasGetImageData({canvasId:null!==(s=this.canvas.nativeCanvas.id)&&void 0!==s?s:this.canvas.id,x:t,y:e,width:n,height:i,success(t){r(t)}})}catch(t){a(t)}}))}draw(){const t=this.nativeContext;t.draw&&(this.drawPromise=new Promise((e=>{t.draw(!0,(()=>{this.drawPromise=null,e(null)}))})))}createPattern(t,e){return null}};on.env="feishu",on=m([e.injectable()],on);let ln=class extends e.BaseCanvas{constructor(t){super(t)}init(){this._context=new on(this,this._dpr)}release(...t){}};ln.env="feishu",ln=m([e.injectable(),x("design:paramtypes",[Object])],ln);const hn=re(ln,on);let cn=class extends e.BaseWindowHandlerContribution{get container(){return null}constructor(t){super(),this.global=t,this.type="feishu",this.eventManager=new class{constructor(){this.cache={}}addEventListener(t,e){t&&e&&(this.cache[t]=this.cache[t]||{listener:[]},this.cache[t].listener.push(e))}removeEventListener(t,e){if(!t||!e)return;if(!this.cache[t])return;const n=this.cache[t].listener.findIndex((t=>t===e));n>=0&&this.cache[t].listener.splice(n,1)}cleanEvent(){this.cache={}}}}getTitle(){return this.canvas.id.toString()}getWH(){return{width:this.canvas.width/(this.canvas.dpr||1),height:this.canvas.height/(this.canvas.dpr||1)}}getXY(){return{x:0,y:0}}createWindow(t){t.canvas?this.createWindowByCanvas(t):this.createWindowByConfig(t)}createWindowByConfig(t){const n=this.global.createCanvas({width:t.width,height:t.height}),i={width:t.width,height:t.height,dpr:t.dpr,nativeCanvas:n,id:e.Generator.GenAutoIncrementId().toString(),canvasControled:!1};this.canvas=new ln(i)}createWindowByCanvas(t){let e;if("string"==typeof t.canvas){if(e=this.global.getElementById(t.canvas),!e)throw new Error("canvasId 参数不正确,请确认canvas存在并插入dom")}else e=t.canvas;let n=t.width,i=t.height;if(null==n||null==i||!t.canvasControled){const t=e.getBoundingClientRect();n=t.width,i=t.height}let r=t.dpr;null==r&&(r=e.width/n),this.canvas=new ln({width:n,height:i,dpr:r,nativeCanvas:e,canvasControled:t.canvasControled})}releaseWindow(){}resizeWindow(t,e){}setDpr(t){this.canvas.dpr=t}getContext(){return this.canvas.getContext()}getNativeHandler(){return this.canvas}getDpr(){return this.canvas.dpr}addEventListener(t,e){this.eventManager.addEventListener(t,e)}removeEventListener(t,e){this.eventManager.removeEventListener(t,e)}dispatchEvent(t){const{type:e}=t;return!!this.eventManager.cache[e]&&(t.changedTouches&&t.changedTouches[0]&&(t.offsetX=t.changedTouches[0].x,t.changedTouches[0].offsetX=t.changedTouches[0].x,t.changedTouches[0].clientX=t.changedTouches[0].x,t.offsetY=t.changedTouches[0].y,t.changedTouches[0].offsetY=t.changedTouches[0].y,t.changedTouches[0].clientY=t.changedTouches[0].y),t.preventDefault=()=>{},t.stopPropagation=()=>{},this.eventManager.cache[e].listener&&this.eventManager.cache[e].listener.forEach((e=>{e(t)})),!0)}getStyle(){return{}}setStyle(t){}getBoundingClientRect(){const t=this.getWH();return{x:0,y:0,width:t.width,height:t.height,left:0,top:0,right:0,bottom:0}}clearViewBox(t,e){const n=this.getContext(),i=this.getDpr();n.nativeContext.save(),n.nativeContext.setTransform(i,0,0,i,0,0),n.clearRect(t.x1,t.y1,t.x2-t.x1,t.y2-t.y1),e&&(n.fillStyle=e,n.fillRect(t.x1,t.y1,t.x2-t.x1,t.y2-t.y1)),n.nativeContext.restore()}};cn.env="feishu",cn=m([e.injectable(),y(0,e.inject(e.VGlobal)),x("design:paramtypes",[Object])],cn);const un=new e.ContainerModule((t=>{t(cn).toSelf(),t(e.WindowHandlerContribution).toDynamicValue((t=>t.container.get(cn))).whenTargetNamed(cn.env)}));let dn=class extends e.DefaultPickService{constructor(t,e,n){super(e,n),this.contributions=t,this.global=e,this.pickItemInterceptorContributions=n,this.global.hooks.onSetEnv.tap("math-picker-service",((t,e,n)=>{this.configure(n,e)})),this.configure(this.global,this.global.env),this.pickerMap=new Map}init(){this.contributions.getContributions().forEach((t=>{this.pickerMap.set(t.numberType,t)})),super._init()}configure(t,n){this.pickContext=new e.EmptyContext2d(null,1)}pickItem(t,e,n,i){if(!1===t.attribute.pickable)return null;const r=this.pickerMap.get(t.numberType);if(!r)return null;const a=r.contains(t,e,i)?t:null;return a?{graphic:a}:null}};m([e.postConstruct(),x("design:type",Function),x("design:paramtypes",[]),x("design:returntype",void 0)],dn.prototype,"init",null),dn=m([e.injectable(),y(0,e.inject(e.ContributionProvider)),y(0,e.named(se)),y(1,e.inject(e.VGlobal)),y(2,e.inject(e.ContributionProvider)),y(2,e.named(e.PickItemInterceptor)),x("design:paramtypes",[Object,Object,Object])],dn);let fn=class{constructor(t){this.canvasRenderer=t,this.type="path",this.numberType=e.PATH_NUMBER_TYPE}contains(t,n,i){if(!t.AABBBounds.containsPoint(n))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:r}=null!=i?i:{};if(!r)return!1;const a=e.getTheme(t).path;let{x:s=a.x,y:o=a.y}=t.attribute;if(r.highPerformanceSave(),t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(a);s+=e.x,o+=e.y,r.setTransformForCurrent()}else s=0,o=0,r.transformFromMatrix(t.transMatrix,!0);let l=!1;return this.canvasRenderer.drawShape(t,r,s,o,{},null,((t,e,i)=>!!l||(l=t.isPointInPath(n.x,n.y),l)),((t,e,i)=>{if(l)return!0;const a=e.lineWidth||i.lineWidth;return r.lineWidth=a,l=t.isPointInStroke(n.x,n.y),l})),r.highPerformanceRestore(),l}};fn=m([e.injectable(),y(0,e.inject(e.PathRender)),x("design:paramtypes",[Object])],fn);let vn=class{constructor(t){this.canvasRenderer=t,this.type="circle",this.numberType=e.CIRCLE_NUMBER_TYPE}contains(t,n,i){if(!t.AABBBounds.containsPoint(n))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:r}=null!=i?i:{};if(!r)return!1;const a=e.getTheme(t).circle;let{x:s=a.x,y:o=a.y}=t.attribute;if(r.highPerformanceSave(),t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(a);s+=e.x,o+=e.y,r.setTransformForCurrent()}else s=0,o=0,r.transformFromMatrix(t.transMatrix,!0);let l=!1;return this.canvasRenderer.drawShape(t,r,s,o,{},null,((t,e,i)=>!!l||(l=t.isPointInPath(n.x,n.y),l)),((t,e,i)=>{if(l)return!0;const a=e.lineWidth||i.lineWidth;return r.lineWidth=a,l=t.isPointInStroke(n.x,n.y),l})),r.highPerformanceRestore(),l}};vn=m([e.injectable(),y(0,e.inject(e.CircleRender)),x("design:paramtypes",[Object])],vn);const pn=new n.AABBBounds;let gn=class{constructor(t){this.canvasRenderer=t,this.type="rect",this.numberType=e.RECT_NUMBER_TYPE}contains(t,i,r){if(!t.AABBBounds.containsPoint(i))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:a}=null!=r?r:{};if(!a)return!1;const s=e.getTheme(t).rect,{cornerRadius:o=s.cornerRadius}=t.attribute;let{x:l=s.x,y:h=s.y}=t.attribute;a.highPerformanceSave();let c=!0;if(t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(s);l+=e.x,h+=e.y,a.setTransformForCurrent()}else l=0,h=0,c=!1,a.transformFromMatrix(t.transMatrix,!0);let u=!0;if(!c||n.isNumber(o,!0)&&0!==o||n.isArray(o)&&o.some((t=>0!==t)))u=!1,this.canvasRenderer.drawShape(t,a,l,h,{},null,((t,e,n)=>!!u||(u=t.isPointInPath(i.x,i.y),u)),((t,e,n)=>{if(u)return!0;const r=e.lineWidth||n.lineWidth;return a.lineWidth=r,u=t.isPointInStroke(i.x,i.y),u}));else if(u){const{fill:e=s.fill,stroke:n=s.stroke,lineWidth:r=s.lineWidth}=t.attribute;if(e)u=!0;else if(n){const e=t.AABBBounds;pn.setValue(e.x1,e.y1,e.x2,e.y2),pn.expand(-r/2),u=!pn.containsPoint(i)}}return a.highPerformanceRestore(),u}};gn=m([e.injectable(),y(0,e.inject(e.RectRender)),x("design:paramtypes",[Object])],gn);let mn=class{constructor(t){this.canvasRenderer=t,this.type="arc",this.numberType=e.ARC_NUMBER_TYPE}contains(t,n,i){if(!t.AABBBounds.containsPoint(n))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:r}=null!=i?i:{};if(!r)return!1;const a=e.getTheme(t).arc;r.highPerformanceSave();let{x:s=a.x,y:o=a.y}=t.attribute;if(t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(a);s+=e.x,o+=e.y,r.setTransformForCurrent()}else s=0,o=0,r.transformFromMatrix(t.transMatrix,!0);let l=!1;return this.canvasRenderer.drawShape(t,r,s,o,{},null,((t,e,i)=>!!l||(l=t.isPointInPath(n.x,n.y),l)),((t,e,i)=>{if(l)return!0;const a=e.lineWidth||i.lineWidth;return r.lineWidth=a,l=t.isPointInStroke(n.x,n.y),l})),r.highPerformanceRestore(),l}};mn=m([e.injectable(),y(0,e.inject(e.ArcRender)),x("design:paramtypes",[Object])],mn);let yn=class{constructor(t){this.canvasRenderer=t,this.type="area",this.numberType=e.AREA_NUMBER_TYPE}contains(t,n,i){if(!t.AABBBounds.containsPoint(n))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:r}=null!=i?i:{};if(!r)return!1;const a=e.getTheme(t).area;let{x:s=a.x,y:o=a.y}=t.attribute;if(r.highPerformanceSave(),t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(a);s+=e.x,o+=e.y,r.setTransformForCurrent()}else s=0,o=0,r.transformFromMatrix(t.transMatrix,!0);let l=!1;return this.canvasRenderer.drawShape(t,r,s,o,{},null,(t=>!!l||(l=t.isPointInPath(n.x,n.y),l))),r.highPerformanceRestore(),l}};yn=m([e.injectable(),y(0,e.inject(e.AreaRender)),x("design:paramtypes",[Object])],yn);let xn=class{constructor(t){this.canvasRenderer=t,this.type="line",this.numberType=e.LINE_NUMBER_TYPE}contains(t,n,i){if(!t.AABBBounds.containsPoint(n))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:r}=null!=i?i:{};if(!r)return!1;const a=e.getTheme(t).line;let{x:s=a.x,y:o=a.y}=t.attribute;if(r.highPerformanceSave(),t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(a);s+=e.x,o+=e.y,r.setTransformForCurrent()}else s=0,o=0,r.transformFromMatrix(t.transMatrix,!0);let l=!1;return this.canvasRenderer.drawShape(t,r,s,o,{},null,(t=>!!l||(l=t.isPointInPath(n.x,n.y),l)),((t,e,i)=>{if(l)return!0;const a=e.lineWidth||i.lineWidth;return r.lineWidth=a,l=t.isPointInStroke(n.x,n.y),l})),r.highPerformanceRestore(),l}};xn=m([e.injectable(),y(0,e.inject(e.LineRender)),x("design:paramtypes",[Object])],xn);let bn=class{constructor(t){this.canvasRenderer=t,this.type="symbol",this.numberType=e.SYMBOL_NUMBER_TYPE}contains(t,n,i){if(!t.AABBBounds.containsPoint(n))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:r}=null!=i?i:{};if(!r)return!1;const a=e.getTheme(t).symbol;let{x:s=a.x,y:o=a.y}=t.attribute;if(r.highPerformanceSave(),t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(a);s+=e.x,o+=e.y,r.setTransformForCurrent()}else s=0,o=0,r.transformFromMatrix(t.transMatrix,!0);let l=!1;return this.canvasRenderer.drawShape(t,r,s,o,{},null,((t,e,i)=>!!l||(l=t.isPointInPath(n.x,n.y),l)),((t,e,i)=>{if(l)return!0;const a=e.lineWidth||i.lineWidth;return r.lineWidth=a,l=t.isPointInStroke(n.x,n.y),l})),r.highPerformanceRestore(),l}};bn=m([e.injectable(),y(0,e.inject(e.SymbolRender)),x("design:paramtypes",[Object])],bn);let Sn=class{constructor(){this.type="text",this.numberType=e.TEXT_NUMBER_TYPE}contains(t,e,n){return!!t.AABBBounds.containsPoint(e)}};Sn=m([e.injectable()],Sn);let Cn=class{constructor(t){this.canvasRenderer=t,this.type="polygon",this.numberType=e.POLYGON_NUMBER_TYPE}contains(t,n,i){if(!t.AABBBounds.contains(n.x,n.y))return!1;const{pickContext:r}=null!=i?i:{};if(!r)return!1;const a=e.getTheme(t).polygon;let{x:s=a.x,y:o=a.y}=t.attribute;if(r.highPerformanceSave(),t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(a);s+=e.x,o+=e.y,r.setTransformForCurrent()}else s=0,o=0,r.transformFromMatrix(t.transMatrix,!0);let l=!1;return this.canvasRenderer.drawShape(t,r,s,o,{},null,((t,e,i)=>!!l||(l=t.isPointInPath(n.x,n.y),l)),((t,e,i)=>{if(l)return!0;const a=e.lineWidth||i.lineWidth;return r.lineWidth=a,l=t.isPointInStroke(n.x,n.y),l})),r.highPerformanceRestore(),l}};Cn=m([e.injectable(),y(0,e.inject(e.PolygonRender)),x("design:paramtypes",[Object])],Cn);let wn=class{constructor(t){this.canvasRenderer=t,this.type="glyph",this.numberType=e.GLYPH_NUMBER_TYPE}contains(t,e,n){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:i}=null!=n?n:{};if(!i)return!1;const r=null==n?void 0:n.pickerService;if(r){let i=!1;return t.getSubGraphic().forEach((t=>{i||(i=!!r.pickItem(t,e,null,n))})),i}return!1}};wn=m([e.injectable(),y(0,e.inject(e.GlyphRender)),x("design:paramtypes",[Object])],wn);var Mn=new e.ContainerModule((t=>{t(vn).toSelf().inSingletonScope(),t(he).toService(vn),t(se).toService(he),t(gn).toSelf().inSingletonScope(),t(de).toService(gn),t(se).toService(de),t(mn).toSelf().inSingletonScope(),t(oe).toService(mn),t(se).toService(oe),t(yn).toSelf().inSingletonScope(),t(le).toService(yn),t(se).toService(le),t(xn).toSelf().inSingletonScope(),t(ce).toService(xn),t(se).toService(ce),t(fn).toSelf().inSingletonScope(),t(ue).toService(fn),t(se).toService(ue),t(bn).toSelf().inSingletonScope(),t(fe).toService(bn),t(se).toService(fe),t(Sn).toSelf().inSingletonScope(),t(ve).toService(Sn),t(se).toService(ve),t(Cn).toSelf().inSingletonScope(),t(pe).toService(Cn),t(se).toService(pe),t(wn).toSelf().inSingletonScope(),t(ge).toService(wn),t(wn).toService(ge),e.bindContributionProvider(t,se)}));const Pn=new e.ContainerModule(((t,n,i,r)=>{i(dn)||t(dn).toSelf().inSingletonScope(),i(e.PickerService)?r(e.PickerService).toService(dn):t(e.PickerService).toService(dn)}));function kn(t){t.load(Mn),t.load(Pn)}let Tn=!1;function En(t,e=!0){Tn||(Tn=!0,t.load(Nt),t.load(hn),t.load(un),e&&kn(t))}let Rn=class extends ne{get globalAlpha(){return this._globalAlpha}set globalAlpha(t){this.nativeContext.globalAlpha=t,this._globalAlpha=t}setLineDash(t){const e=arguments,n=this.nativeContext;if(this.nativeContext.setLineDash){const t=e[0];if(0===t[0]&&0===t[1])return;n.setLineDash(t)}}_setStrokeStyle(t,n,i,r,a){const s=this.nativeContext;a||(a=this.strokeAttributes);const{strokeOpacity:o=a.strokeOpacity,opacity:l=a.opacity}=n;if(o>1e-12&&l>1e-12){const{lineWidth:h=a.lineWidth,stroke:c=a.stroke,lineJoin:u=a.lineJoin,lineDash:d=a.lineDash,lineCap:f=a.lineCap,miterLimit:v=a.miterLimit}=n;s.globalAlpha=o*l,s.lineWidth=e.getScaledStroke(this,h,this.dpr),s.strokeStyle=e.createColor(this,c,t,i,r),s.lineJoin=u,0===d[0]&&0===d[1]||s.setLineDash(d),s.lineCap=f,s.miterLimit=v}}measureText(t,n=e.application.global.measureTextMethod){this.setTransform(1,0,0,1,0,0,!0,e.application.global.devicePixelRatio);return super.measureText(t,n)}createPattern(t,e){return null}draw(){const t=this.nativeContext;this.drawPromise=new Promise((e=>{t.draw(!0,(()=>{this.drawPromise=null,e(null)}))}))}};Rn.env="lynx",Rn=m([e.injectable()],Rn);let On=class extends e.BaseCanvas{constructor(t){super(t)}init(){this._context=new Rn(this,this._dpr)}resize(t,e){this._pixelWidth=t*this._dpr,this._pixelHeight=e*this._dpr,this._displayWidth=t,this._displayHeight=e,this._nativeCanvas.width=this._pixelWidth,this._nativeCanvas.height=this._pixelHeight,this._nativeCanvas.nativeCanvas&&(this._nativeCanvas.nativeCanvas.width=this._pixelWidth,this._nativeCanvas.nativeCanvas.height=this._pixelHeight);this._context.dpr=this._dpr}release(...t){}};On.env="lynx",On=m([e.injectable(),x("design:paramtypes",[Object])],On);let Bn=class extends e.BaseWindowHandlerContribution{get container(){return null}constructor(t){super(),this.global=t,this.type="lynx",this.eventManager=new class{constructor(){this.cache={}}addEventListener(t,e){t&&e&&(this.cache[t]=this.cache[t]||{listener:[]},this.cache[t].listener.push(e))}removeEventListener(t,e){if(!t||!e)return;if(!this.cache[t])return;const n=this.cache[t].listener.findIndex((t=>t===e));n>=0&&this.cache[t].listener.splice(n,1)}cleanEvent(){this.cache={}}}}getTitle(){return this.canvas.id.toString()}getWH(){return{width:this.canvas.width/(this.canvas.dpr||1),height:this.canvas.height/(this.canvas.dpr||1)}}getXY(){return{x:0,y:0}}createWindow(t){t.canvas?this.createWindowByCanvas(t):this.createWindowByConfig(t)}createWindowByConfig(t){const n=this.global.createCanvas({width:t.width,height:t.height}),i={width:t.width,height:t.height,dpr:t.dpr,nativeCanvas:n,id:e.Generator.GenAutoIncrementId().toString(),canvasControled:!1};this.canvas=new On(i)}createWindowByCanvas(t){let e;if("string"==typeof t.canvas){if(e=this.global.getElementById(t.canvas),!e)throw new Error("canvasId 参数不正确,请确认canvas存在并插入dom")}else e=t.canvas;let n=t.width,i=t.height;if(null==n||null==i||!t.canvasControled){const t=e.getBoundingClientRect();n=t.width,i=t.height}let r=t.dpr;null==r&&(r=e.width/n),this.canvas=new On({width:n,height:i,dpr:r,nativeCanvas:e,canvasControled:t.canvasControled})}releaseWindow(){}resizeWindow(t,e){this.canvas.resize(t,e)}setDpr(t){this.canvas.dpr=t}getContext(){return this.canvas.getContext()}getNativeHandler(){return this.canvas}getDpr(){return this.canvas.dpr}addEventListener(t,e){this.eventManager.addEventListener(t,e)}removeEventListener(t,e){this.eventManager.removeEventListener(t,e)}dispatchEvent(t){const{type:e}=t;return!!this.eventManager.cache[e]&&(t.changedTouches&&t.changedTouches[0]&&(t.offsetX=t.changedTouches[0].x,t.changedTouches[0].offsetX=t.changedTouches[0].x,t.changedTouches[0].clientX=t.changedTouches[0].x,t.offsetY=t.changedTouches[0].y,t.changedTouches[0].offsetY=t.changedTouches[0].y,t.changedTouches[0].clientY=t.changedTouches[0].y),t.preventDefault=()=>{},t.stopPropagation=()=>{},this.eventManager.cache[e].listener&&this.eventManager.cache[e].listener.forEach((e=>{e(t)})),!0)}getStyle(){return{}}setStyle(t){}getBoundingClientRect(){const t=this.getWH();return{x:0,y:0,width:t.width,height:t.height,left:0,top:0,right:0,bottom:0}}clearViewBox(t,e){const n=this.getContext(),i=this.getDpr();n.nativeContext.save(),n.nativeContext.setTransform(i,0,0,i,0,0),n.clearRect(t.x1,t.y1,t.x2-t.x1,t.y2-t.y1),e&&(n.fillStyle=e,n.fillRect(t.x1,t.y1,t.x2-t.x1,t.y2-t.y1)),n.nativeContext.restore()}};Bn.env="lynx",Bn=m([e.injectable(),y(0,e.inject(e.VGlobal)),x("design:paramtypes",[Object])],Bn);const An=new e.ContainerModule((t=>{t(Bn).toSelf(),t(e.WindowHandlerContribution).toDynamicValue((t=>t.container.get(Bn))).whenTargetNamed(Bn.env)})),jn=re(On,Rn);let In=!1;function Dn(t,e=!0){In||(In=!0,t.load($t),t.load(jn),t.load(An),e&&kn(t))}let Ln=class extends ne{constructor(t,e){super(t,e);const i=t.nativeCanvas.getContext("2d");if(!i)throw new Error("发生错误,获取2d上下文失败");this.nativeContext=i,this.canvas=t,this.matrix=new n.Matrix(1,0,0,1,0,0),this.stack=[],this.dpr=null!=e?e:1}release(...t){}};Ln.env="node",Ln=m([e.injectable(),x("design:paramtypes",[Object,Number])],Ln);let _n=class extends e.BaseCanvas{constructor(t){super(t)}init(){this._context=new Ln(this,this._dpr),this.nativeCanvas.width=this._pixelWidth,this.nativeCanvas.height=this._pixelHeight}release(...t){this._nativeCanvas.release&&n.isFunction(this._nativeCanvas.release)&&this._nativeCanvas.release()}};_n.env="node",_n=m([e.injectable(),x("design:paramtypes",[Object])],_n);const Wn=re(_n,Ln);let Fn=class extends e.BaseWindowHandlerContribution{get container(){return null}constructor(t){super(),this.global=t,this.type="node"}getTitle(){return""}getWH(){return{width:this.canvas.displayWidth,height:this.canvas.displayHeight}}getXY(){return{x:0,y:0}}createWindow(t){t.canvas?this.createWindowByCanvas(t):this.createWindowByConfig(t)}createWindowByConfig(t){const n=this.global.createCanvas({width:t.width,height:t.height}),i={width:t.width,height:t.height,dpr:t.dpr,nativeCanvas:n,id:e.Generator.GenAutoIncrementId().toString(),canvasControled:!0};this.canvas=new _n(i)}createWindowByCanvas(t){const e=t.canvas;let n=t.width,i=t.height;null!=n&&null!=i&&t.canvasControled||(n=e.width,i=e.height),this.canvas=new _n({width:n,height:i,dpr:1,nativeCanvas:e,canvasControled:t.canvasControled})}releaseWindow(){this.canvas.release()}resizeWindow(t,e){this.canvas.resize(t,e)}setDpr(t){this.canvas.dpr=t}getContext(){return this.canvas.getContext()}getNativeHandler(){return this.canvas}getDpr(){return this.canvas.dpr}getImageBuffer(t="image/png"){return this.canvas.nativeCanvas.toBuffer(t)}addEventListener(t,e,n){}dispatchEvent(t){return!0}removeEventListener(t,e,n){}getStyle(){}setStyle(t){}getBoundingClientRect(){return null}clearViewBox(t,e){}};Fn.env="node",Fn=m([e.injectable(),y(0,e.inject(e.VGlobal)),x("design:paramtypes",[Object])],Fn);const zn=new e.ContainerModule((t=>{t(Fn).toSelf(),t(e.WindowHandlerContribution).toDynamicValue((t=>t.container.get(Fn))).whenTargetNamed(Fn.env)}));let Gn=!1;function Vn(t,e=!0){Gn||(Gn=!0,t.load(Kt),t.load(Wn),t.load(zn),e&&kn(t))}let Yn=class extends ne{get globalAlpha(){return this._globalAlpha}set globalAlpha(t){this.nativeContext.setGlobalAlpha(t),this._globalAlpha=t}draw(){this.nativeContext.draw()}strokeText(t,e,n){}_setCommonStyle(t,n,i,r,a){const s=this.nativeContext;a||(a=this.fillAttributes);const{fillOpacity:o=a.fillOpacity,opacity:l=a.opacity,fill:h=a.fill}=n;o>1e-12&&l>1e-12&&(s.setGlobalAlpha(o*l),s.setFillStyle(e.createColor(this,h,t,i,r)))}_setStrokeStyle(t,n,i,r,a){const s=this.nativeContext;a||(a=this.strokeAttributes);const{strokeOpacity:o=a.strokeOpacity,opacity:l=a.opacity}=n;if(o>1e-12&&l>1e-12){const{lineWidth:h=a.lineWidth,stroke:c=a.stroke,lineJoin:u=a.lineJoin,lineDash:d=a.lineDash,lineCap:f=a.lineCap,miterLimit:v=a.miterLimit}=n;s.setGlobalAlpha(o*l),s.setLineWidth(e.getScaledStroke(this,h,this.dpr)),s.setStrokeStyle(e.createColor(this,c,t,i,r)),s.setLineJoin(u),s.setLineDash(d),s.setLineCap(f),s.setMiterLimit(v)}}setTextStyleWithoutAlignBaseline(t,n){var i;const r=this.nativeContext;n||(n=this.textAttributes),t.font?r.font=t.font:r.font=e.getContextFont(t,n),r.setFontSize(null!==(i=t.fontSize)&&void 0!==i?i:n.fontSize)}setTextStyle(t,n){var i,r;const a=this.nativeContext;n||(n=this.textAttributes),t.font?a.font=t.font:a.font=e.getContextFont(t,n),a.setTextAlign(null!==(i=t.textAlign)&&void 0!==i?i:n.textAlign),a.setTextBaseline(null!==(r=t.textBaseline)&&void 0!==r?r:n.textBaseline)}createConicGradient(t,e,n,i){return null}createPattern(t,e){return null}};Yn.env="taro",Yn=m([e.injectable()],Yn);let Nn=class extends e.BaseCanvas{constructor(t){super(t)}init(){this._context=new Yn(this,this._dpr)}release(...t){}};Nn.env="taro",Nn=m([e.injectable(),x("design:paramtypes",[Object])],Nn);const Hn=re(Nn,Yn);let Un=class extends e.BaseWindowHandlerContribution{get container(){return null}constructor(t){super(),this.global=t,this.type="taro",this.eventManager=new class{constructor(){this.cache={}}addEventListener(t,e){t&&e&&(this.cache[t]=this.cache[t]||{listener:[]},this.cache[t].listener.push(e))}removeEventListener(t,e){if(!t||!e)return;if(!this.cache[t])return;const n=this.cache[t].listener.findIndex((t=>t===e));n>=0&&this.cache[t].listener.splice(n,1)}cleanEvent(){this.cache={}}}}getTitle(){return this.canvas.id.toString()}getWH(){return{width:this.canvas.width/(this.canvas.dpr||1),height:this.canvas.height/(this.canvas.dpr||1)}}getXY(){return{x:0,y:0}}createWindow(t){t.canvas?this.createWindowByCanvas(t):this.createWindowByConfig(t)}createWindowByConfig(t){const n=this.global.createCanvas({width:t.width,height:t.height}),i={width:t.width,height:t.height,dpr:t.dpr,nativeCanvas:n,id:e.Generator.GenAutoIncrementId().toString(),canvasControled:!1};this.canvas=new Nn(i)}createWindowByCanvas(t){let e;if("string"==typeof t.canvas){if(e=this.global.getElementById(t.canvas),!e)throw new Error("canvasId 参数不正确,请确认canvas存在并插入dom")}else e=t.canvas;let n=t.width,i=t.height;if(null==n||null==i||!t.canvasControled){const t=e.getBoundingClientRect();n=t.width,i=t.height}let r=t.dpr;null==r&&(r=e.width/n),this.canvas=new Nn({width:n,height:i,dpr:r,nativeCanvas:e,canvasControled:t.canvasControled})}releaseWindow(){}resizeWindow(t,e){}setDpr(t){this.canvas.dpr=t}getContext(){return this.canvas.getContext()}getNativeHandler(){return this.canvas}getDpr(){return this.canvas.dpr}addEventListener(t,e){this.eventManager.addEventListener(t,e)}removeEventListener(t,e){this.eventManager.removeEventListener(t,e)}dispatchEvent(t){const{type:e}=t;return!!this.eventManager.cache[e]&&(t.changedTouches.length>0&&(t.changedTouches.forEach(((e,n)=>{t.changedTouches[n]=Object.assign(Object.assign({},t.changedTouches[n]),{offsetX:e.x,offsetY:e.y})})),t.offsetX=t.changedTouches[0].offsetX,t.offsetY=t.changedTouches[0].offsetY),t.touches.length>0&&t.touches.forEach(((e,n)=>{t.touches[n]=Object.assign(Object.assign({},t.touches[n]),{offsetX:e.x,offsetY:e.y})})),t.preventDefault=()=>{},t.stopPropagation=()=>{},this.eventManager.cache[e].listener&&this.eventManager.cache[e].listener.forEach((e=>{e(t)})),!0)}getStyle(){return{}}setStyle(t){}getBoundingClientRect(){const t=this.getWH();return{x:0,y:0,width:t.width,height:t.height,left:0,top:0,right:0,bottom:0}}clearViewBox(t,e){const n=this.getContext(),i=this.getDpr();n.nativeContext.save(),n.nativeContext.setTransform(i,0,0,i,0,0),n.clearRect(t.x1,t.y1,t.x2-t.x1,t.y2-t.y1),e&&(n.fillStyle=e,n.fillRect(t.x1,t.y1,t.x2-t.x1,t.y2-t.y1)),n.nativeContext.restore()}};Un.env="taro",Un=m([e.injectable(),y(0,e.inject(e.VGlobal)),x("design:paramtypes",[Object])],Un);const Xn=new e.ContainerModule((t=>{t(Un).toSelf(),t(e.WindowHandlerContribution).toDynamicValue((t=>t.container.get(Un))).whenTargetNamed(Un.env)}));let qn=!1;function $n(t,e=!0){qn||(qn=!0,t.load(Ut),t.load(Hn),t.load(Xn),e&&kn(t))}let Jn=class extends ne{draw(){}createPattern(t,e){return null}};Jn.env="wx",Jn=m([e.injectable()],Jn);let Qn=class extends e.BaseCanvas{constructor(t){super(t)}init(){this._context=new Jn(this,this._dpr)}release(...t){}};Qn.env="wx",Qn=m([e.injectable(),x("design:paramtypes",[Object])],Qn);const Zn=re(Qn,Jn);class Kn{constructor(){this.cache={}}addEventListener(t,e){t&&e&&(this.cache[t]=this.cache[t]||{listener:[]},this.cache[t].listener.push(e))}removeEventListener(t,e){if(!t||!e)return;if(!this.cache[t])return;const n=this.cache[t].listener.findIndex((t=>t===e));n>=0&&this.cache[t].listener.splice(n,1)}cleanEvent(){this.cache={}}}let ti=class extends e.BaseWindowHandlerContribution{get container(){return null}constructor(t){super(),this.global=t,this.type="wx",this.eventManager=new Kn}getTitle(){return this.canvas.id.toString()}getWH(){return{width:this.canvas.width/(this.canvas.dpr||1),height:this.canvas.height/(this.canvas.dpr||1)}}getXY(){return{x:0,y:0}}createWindow(t){t.canvas?this.createWindowByCanvas(t):this.createWindowByConfig(t)}createWindowByConfig(t){const n=this.global.createCanvas({width:t.width,height:t.height}),i={width:t.width,height:t.height,dpr:t.dpr,nativeCanvas:n,id:e.Generator.GenAutoIncrementId().toString(),canvasControled:!1};this.canvas=new Qn(i)}createWindowByCanvas(t){let e;if("string"==typeof t.canvas){if(e=this.global.getElementById(t.canvas),!e)throw new Error("canvasId 参数不正确,请确认canvas存在并插入dom")}else e=t.canvas;let n=t.width,i=t.height;if(null==n||null==i||!t.canvasControled){const t=e.getBoundingClientRect();n=t.width,i=t.height}let r=t.dpr;null==r&&(r=e.width/n),this.canvas=new Qn({width:n,height:i,dpr:r,nativeCanvas:e,canvasControled:t.canvasControled})}releaseWindow(){}resizeWindow(t,e){}setDpr(t){this.canvas.dpr=t}getContext(){return this.canvas.getContext()}getNativeHandler(){return this.canvas}getDpr(){return this.canvas.dpr}addEventListener(t,e){this.eventManager.addEventListener(t,e)}removeEventListener(t,e){this.eventManager.removeEventListener(t,e)}dispatchEvent(t){var e,n,i,r;const{type:a}=t;return!!this.eventManager.cache[a]&&(t.changedTouches&&t.changedTouches[0]&&(t.offsetX=t.changedTouches[0].x,t.changedTouches[0].offsetX=null!==(e=t.changedTouches[0].x)&&void 0!==e?e:t.changedTouches[0].pageX,t.changedTouches[0].clientX=null!==(n=t.changedTouches[0].x)&&void 0!==n?n:t.changedTouches[0].pageX,t.offsetY=t.changedTouches[0].y,t.changedTouches[0].offsetY=null!==(i=t.changedTouches[0].y)&&void 0!==i?i:t.changedTouches[0].pageY,t.changedTouches[0].clientY=null!==(r=t.changedTouches[0].y)&&void 0!==r?r:t.changedTouches[0].pageY),t.preventDefault=()=>{},t.stopPropagation=()=>{},this.eventManager.cache[a].listener&&this.eventManager.cache[a].listener.forEach((e=>{e(t)})),!0)}getStyle(){return{}}setStyle(t){}getBoundingClientRect(){const t=this.getWH();return{x:0,y:0,width:t.width,height:t.height,left:0,top:0,right:0,bottom:0}}clearViewBox(t,e){const n=this.getContext(),i=this.getDpr();n.nativeContext.save(),n.nativeContext.setTransform(i,0,0,i,0,0),n.clearRect(t.x1,t.y1,t.x2-t.x1,t.y2-t.y1),e&&(n.fillStyle=e,n.fillRect(t.x1,t.y1,t.x2-t.x1,t.y2-t.y1)),n.nativeContext.restore()}};ti.env="wx",ti=m([e.injectable(),y(0,e.inject(e.VGlobal)),x("design:paramtypes",[Object])],ti);const ei=new e.ContainerModule((t=>{t(ti).toSelf(),t(e.WindowHandlerContribution).toDynamicValue((t=>t.container.get(ti))).whenTargetNamed(ti.env)}));let ni=!1;function ii(t,e=!0){ni||(ni=!0,t.load(Qt),t.load(Zn),t.load(ei),e&&kn(t))}new e.ContainerModule(((t,n,i,r)=>{i(Ie)||t(Ie).toSelf().inSingletonScope(),i(e.PickerService)?r(e.PickerService).toService(Ie):t(e.PickerService).toService(Ie)}));const ri=new e.ContainerModule(((t,n,i,r)=>{i(dn)||t(dn).toSelf().inSingletonScope(),i(e.PickerService)?r(e.PickerService).toService(dn):t(e.PickerService).toService(dn)}));function ai(t){oi(t)}let si=!1;function oi(t){si||(si=!0,sn(t,!1),En(t,!1),Dn(t,!1),Vn(t,!1),$n(t,!1),ii(t,!1),en(t),e.vglobal.hooks.onSetEnv.tap("loadMathPicker",((e,n)=>{"browser"!==n&&function(t){t.load(Mn),t.load(ri)}(t)})))}const li=wt;t.DragNDrop=class{constructor(t){this.onPointerDown=t=>{const e=t.target,n=this.rootNode,i=e===n;if(e&&!i){let r,a=!1;function s(t){if(a||(t.type="dragstart",null==e||e.dispatchEvent(t),a=!0),t.type="drag",null==e||e.dispatchEvent(t),!i){e.pickable=!1;const i=(null==n?void 0:n.pick(t.global.x,t.global.y)).graphic;e.pickable=!0,r!==i&&(r&&(t.type="dragleave",t.target=r,r.dispatchEvent(t)),i&&(t.type="dragenter",t.target=i,i.dispatchEvent(t)),r=i,r&&(t.type="dragover",t.target=r,r.dispatchEvent(t)))}}null==n||n.addEventListener("pointermove",s);const o=function(){a&&(r&&(t.type="drop",t.target=r,r.dispatchEvent(t)),t.type="dragend",e.dispatchEvent(t),a=!1),null==n||n.removeEventListener("pointermove",s)};e.addEventListener("pointerup",o,{once:!0}),e.addEventListener("pointerupoutside",o,{once:!0})}},this.rootNode=t,this.initEvents()}initEvents(){var t;null===(t=this.rootNode)||void 0===t||t.addEventListener("pointerdown",this.onPointerDown)}removeEvents(){var t;null===(t=this.rootNode)||void 0===t||t.removeEventListener("pointerdown",this.onPointerDown)}release(){this.removeEvents(),this.rootNode=null}},t.Fragment=Et,t.Gesture=Bt,t.REACT_TO_CANOPUS_EVENTS=Mt,t.REACT_TO_CANOPUS_EVENTS_LIST=Pt,t.VArc=function(t){return e.createArc(t?t.attribute:{})},t.VArc3d=function(t){return e.createArc3d(t?t.attribute:{})},t.VArea=function(t){return e.createArea(t?t.attribute:{})},t.VCircle=function(t){return e.createCircle(t?t.attribute:{})},t.VGlyph=function(t){return e.createGlyph(t?t.attribute:{})},t.VGroup=function(t){return e.createGroup(t?t.attribute:{})},t.VImage=function(t){return e.createImage(t?t.attribute:{})},t.VLine=function(t){return e.createLine(t?t.attribute:{})},t.VPath=function(t){return e.createPath(t?t.attribute:{})},t.VPolygon=function(t){return e.createPolygon(t?t.attribute:{})},t.VPyramid3d=function(t){return e.createPyramid3d(t?t.attribute:{})},t.VRect=function(t){return e.createRect(t?t.attribute:{})},t.VRect3d=function(t){return e.createRect3d(t?t.attribute:{})},t.VRichText=kt,t.VSymbol=function(t){return e.createSymbol(t?t.attribute:{})},t.VText=function(t){return e.createText(t?t.attribute:{})},t.initAllEnv=function(){ai(e.container)},t.initBrowserEnv=function(){sn(e.container)},t.initFeishuEnv=function(){En(e.container)},t.initLynxEnv=function(){Dn(e.container)},t.initNodeEnv=function(){Vn(e.container)},t.initTaroEnv=function(){$n(e.container)},t.initWxEnv=function(){ii(e.container)},t.jsx=function(t,i,...r){const a=i||{},{key:s,attribute:o,stateProxy:l}=a,h=function(t,e){var n={};for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&e.indexOf(i)<0&&(n[i]=t[i]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(i=Object.getOwnPropertySymbols(t);r<i.length;r++)e.indexOf(i[r])<0&&Object.prototype.propertyIsEnumerable.call(t,i[r])&&(n[i[r]]=t[i[r]])}return n}(a,["key","attribute","stateProxy"]);let c=t;n.isString(t)&&(c=e.graphicCreator[t]);const u=[];r.length&&Tt(1===r.length?r[0]:r,u);const d="Group"===c.name?new c(o):c(i);return function(t,e,n){let i,r=!1;switch(t.type){case"richtext":case"rich/image":break;case"rich/text":i=t.attribute||{},e[0]&&(i.text=e[0]);break;default:r=!0}r?(e.forEach((e=>{e&&t.add(e)})),Object.keys(n).forEach((e=>{const i=Mt[e];i&&t.on(i,n[e])}))):"richtext"===t.type&&(t.attribute.textConfig=e.map((t=>t.attribute)).filter((t=>t)))}(d,u,h),l&&(d.stateProxy=l),d},t.loadAllEnv=ai,t.loadAllModule=oi,t.loadBrowserEnv=sn,t.loadFeishuEnv=En,t.loadLynxEnv=Dn,t.loadNodeEnv=Vn,t.loadTaroEnv=$n,t.loadWxEnv=ii,t.roughModule=li}));
@@ -21,6 +21,7 @@ export declare class Gesture extends EventEmitter {
21
21
  private config;
22
22
  private tapCount;
23
23
  private lastTapTime;
24
+ private lastTapTarget;
24
25
  constructor(element: IEventTarget, config?: GestureConfig);
25
26
  initEvents(): void;
26
27
  removeEvents(): void;
@@ -26,7 +26,7 @@ export class Gesture extends EventEmitter {
26
26
  constructor(element, config = {}) {
27
27
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
28
28
  super(), this.cachedEvents = [], this.startPoints = [], this.processEvent = {},
29
- this.throttleTimer = 0, this.emitThrottles = [], this.onStart = ev => {
29
+ this.throttleTimer = 0, this.emitThrottles = [], this.lastTapTarget = null, this.onStart = ev => {
30
30
  this.reset(), this.startTime = clock.now();
31
31
  const {cachedEvents: cachedEvents, startPoints: startPoints} = this;
32
32
  ev && cachedEvents.push(ev.clone()), startPoints.length = cachedEvents.length;
@@ -88,8 +88,8 @@ export class Gesture extends EventEmitter {
88
88
  endEvent.direction = calcDirection(prevMovePoint, lastMovePoint), this.triggerEvent("swipe", endEvent));
89
89
  }
90
90
  }
91
- now - this.lastTapTime < this.config.tap.interval ? this.tapCount++ : this.tapCount = 1,
92
- this.lastTapTime = now, 1 === this.tapCount ? this.triggerEvent("tap", endEvent) : 2 === this.tapCount && (this.triggerEvent("doubletap", endEvent),
91
+ now - this.lastTapTime < this.config.tap.interval && ev.target === this.lastTapTarget ? this.tapCount++ : this.tapCount = 1,
92
+ this.lastTapTime = now, this.lastTapTarget = ev.target, 1 === this.tapCount ? this.triggerEvent("tap", endEvent) : 2 === this.tapCount && (this.triggerEvent("doubletap", endEvent),
93
93
  this.tapCount = 0);
94
94
  }
95
95
  for (let i = 0, len = cachedEvents.length; i < len; i++) if (cachedEvents[i].pointerId === endEvent.pointerId) {
@@ -1 +1 @@
1
- {"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CAAC,IAAY,EAAE,CAAe;QAC7C,MAAM,MAAM,GAAI,IAAI,CAAC,OAA0B,CAAC,OAAO,CAAC;QACxD,MAAM,SAAS,GAAG,MAAM,CAAC,QAAQ,CAAC,CAAC;QACnC,IAAI,SAAS,EAAE;YACb,IAAI,IAAI,IAAI,SAAS,EAAE;gBACrB,SAAS,CAAC,EAAE,CAAC,IAAI,CAAC,SAAS,CAAC,OAAO,EAAE,CAAC,EAAE,IAAI,CAAC,CAAC;aAC/C;iBAAM;gBACL,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,SAAS,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,6BAA6B,EAAE,CAAC,EAAE,EAAE;oBACpF,SAAS,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,OAAO,EAAE,CAAC,EAAE,IAAI,CAAC,CAAC;iBACrD;aACF;SACF;QAED,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC;IACrB,CAAC;CACF","file":"gesture.js","sourcesContent":["import { application, clock, WILDCARD } from '@visactor/vrender-core';\nimport type { IEventTarget, IFederatedPointerEvent, FederatedPointerEvent, INode } from '@visactor/vrender-core';\nimport type { IPointLike } from '@visactor/vutils';\nimport { EventEmitter } from '@visactor/vutils';\n\nimport type { DefaultGestureConfig, EmitEventObject, GestureConfig, GestureDirection, GestureEvent } from './interface';\n\n/**\n * 代码参考 https://github.com/hammerjs/hammer.js\n * The MIT License (MIT)\n\n Copyright (C) 2011-2017 by Jorik Tangelder (Eight Media)\n\n Permission is hereby granted, free of charge, to any person obtaining a copy\n of this software and associated documentation files (the \"Software\"), to deal\n in the Software without restriction, including without limitation the rights\n to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n copies of the Software, and to permit persons to whom the Software is\n furnished to do so, subject to the following conditions:\n\n The above copyright notice and this permission notice shall be included in\n all copies or substantial portions of the Software.\n\n THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n THE SOFTWARE.\n */\n\nconst PRESS_TIME = 251;\nconst PRESS_THRESHOLD = 9;\nconst SWIPE_VELOCITY = 0.3;\nconst SWIPE_THRESHOLD = 10;\nconst TAP_INTERVAL = 300;\n\nconst calcDirection = (start: IPointLike, end: IPointLike) => {\n const xDistance = end.x - start.x;\n const yDistance = end.y - start.y;\n if (Math.abs(xDistance) > Math.abs(yDistance)) {\n return xDistance > 0 ? 'right' : 'left';\n }\n return yDistance > 0 ? 'down' : 'up';\n};\n\n// 计算2点之间的距离\nconst calcDistance = (point1: IPointLike, point2: IPointLike) => {\n const xDistance = Math.abs(point2.x - point1.x);\n const yDistance = Math.abs(point2.y - point1.y);\n return Math.sqrt(xDistance * xDistance + yDistance * yDistance);\n};\n\nconst getCenter = (points: IPointLike[]) => {\n const pointersLength = points.length;\n\n if (pointersLength === 1) {\n return {\n x: Math.round(points[0].x),\n y: Math.round(points[0].y)\n };\n }\n\n let x = 0;\n let y = 0;\n let i = 0;\n while (i < pointersLength) {\n x += points[i].x;\n y += points[i].y;\n i++;\n }\n\n return {\n x: Math.round(x / pointersLength),\n y: Math.round(y / pointersLength)\n };\n};\n\nexport class Gesture extends EventEmitter {\n element: INode | null;\n\n private cachedEvents: IFederatedPointerEvent[] = [];\n private startTime: number;\n // @ts-ignore\n // eslint-disable-next-line no-undef\n private pressTimeout: NodeJS.Timeout | null;\n private startPoints: IPointLike[] = [];\n // 用来记录当前触发的事件\n private processEvent: Record<string, boolean> = {};\n private startDistance: number;\n private center: IPointLike;\n private eventType: string | null;\n private direction: GestureDirection | null;\n\n private lastMoveTime: number;\n private prevMoveTime: number;\n\n private prevMovePoint: IPointLike | null;\n private lastMovePoint: IPointLike | null;\n\n private throttleTimer: number = 0;\n private emitThrottles: EmitEventObject[] = [];\n\n private config: DefaultGestureConfig;\n\n private tapCount;\n private lastTapTime;\n\n constructor(element: IEventTarget, config: GestureConfig = {}) {\n super();\n this.element = element;\n this.tapCount = 0;\n this.lastTapTime = 0;\n this.config = {\n press: {\n time: config?.press?.time ?? PRESS_TIME,\n threshold: config?.press?.threshold ?? PRESS_THRESHOLD\n },\n swipe: {\n threshold: config?.swipe?.threshold ?? SWIPE_THRESHOLD,\n velocity: config?.swipe?.velocity ?? SWIPE_VELOCITY\n },\n tap: {\n interval: config?.tap?.interval ?? TAP_INTERVAL\n }\n };\n this.initEvents();\n }\n\n initEvents() {\n const { element } = this;\n if (!element) {\n return;\n }\n\n element.addEventListener('pointerdown', this.onStart);\n element.addEventListener('pointermove', this.onMove);\n element.addEventListener('pointerup', this.onEnd);\n element.addEventListener('pointerupoutside', this.onEnd);\n }\n\n removeEvents() {\n const { element } = this;\n if (!element) {\n return;\n }\n element.removeEventListener('pointerdown', this.onStart);\n element.removeEventListener('pointermove', this.onMove);\n element.removeEventListener('pointerup', this.onEnd);\n element.removeEventListener('pointerupoutside', this.onEnd);\n }\n\n release() {\n this.removeEvents();\n this.element = null;\n }\n\n private onStart = (ev?: FederatedPointerEvent) => {\n this.reset();\n\n this.startTime = clock.now();\n\n const { cachedEvents, startPoints } = this;\n\n if (ev) {\n cachedEvents.push(ev.clone());\n }\n // 重置 startPoints\n startPoints.length = cachedEvents.length;\n for (let i = 0; i < cachedEvents.length; i++) {\n const { x, y } = cachedEvents[i];\n const point = { x, y };\n startPoints[i] = point;\n }\n\n if (startPoints.length === 1) {\n const event = cachedEvents[0] as unknown as GestureEvent;\n this.pressTimeout = setTimeout(() => {\n const eventType = 'press';\n const direction = 'none';\n event.direction = direction;\n event.deltaX = 0;\n event.deltaY = 0;\n event.points = startPoints;\n this.triggerStartEvent(eventType, event);\n this.triggerEvent(eventType, event);\n this.eventType = eventType;\n this.direction = direction;\n }, this.config.press.time);\n return;\n }\n\n this.startDistance = calcDistance(startPoints[0], startPoints[1]);\n this.center = getCenter([startPoints[0], startPoints[1]]);\n };\n\n private onMove = (ev: FederatedPointerEvent) => {\n this.clearPressTimeout();\n const { startPoints, cachedEvents } = this;\n if (!startPoints.length) {\n return;\n }\n\n const moveEvent = ev.clone() as unknown as GestureEvent;\n const { x, y, pointerId } = moveEvent;\n for (let i = 0, len = cachedEvents.length; i < len; i++) {\n if (pointerId === cachedEvents[i].pointerId) {\n cachedEvents[i] = moveEvent;\n break;\n }\n }\n const point = { x, y };\n const points = cachedEvents.map(cachedEvent => ({ x: cachedEvent.x, y: cachedEvent.y }));\n\n const now = clock.now();\n this.prevMoveTime = this.lastMoveTime;\n this.prevMovePoint = this.lastMovePoint;\n this.lastMoveTime = now;\n this.lastMovePoint = point;\n\n if (startPoints.length === 1) {\n const startPoint = startPoints[0];\n const deltaX = x - startPoint.x;\n const deltaY = y - startPoint.y;\n const direction = this.direction || calcDirection(startPoint, point);\n this.direction = direction;\n\n const eventType = this.getEventType(point);\n moveEvent.direction = direction;\n moveEvent.deltaX = deltaX;\n moveEvent.deltaY = deltaY;\n moveEvent.points = points;\n this.triggerStartEvent(eventType, moveEvent);\n this.triggerEvent(eventType, moveEvent);\n return;\n }\n\n const { startDistance } = this;\n const currentDistance = calcDistance(points[0], points[1]);\n\n // 缩放比例\n moveEvent.scale = currentDistance / startDistance;\n moveEvent.center = this.center;\n moveEvent.points = points;\n this.triggerStartEvent('pinch', moveEvent);\n this.triggerEvent('pinch', moveEvent);\n };\n\n private onEnd = (ev: FederatedPointerEvent) => {\n const endEvent = ev.clone() as unknown as GestureEvent;\n const { cachedEvents, startPoints } = this;\n const points = cachedEvents.map(ev => {\n return { x: ev.x, y: ev.y };\n });\n endEvent.points = points;\n this.triggerEndEvent(endEvent);\n\n if (cachedEvents.length === 1) {\n const now = clock.now();\n const lastMoveTime = this.lastMoveTime;\n // 做这个判断是为了最后一次touchmove后到end前,是否还有一个停顿的过程\n // 100 是拍的一个值,理论这个值会很短,一般不卡顿的话在10ms以内\n if (now - lastMoveTime < 100) {\n const prevMoveTime = this.prevMoveTime || this.startTime;\n const intervalTime = lastMoveTime - prevMoveTime;\n // 时间间隔一定要大于0, 否则计算没意义\n if (intervalTime > 0) {\n const prevMovePoint = this.prevMovePoint || startPoints[0];\n const lastMovePoint = this.lastMovePoint || startPoints[0];\n const distance = calcDistance(prevMovePoint, lastMovePoint);\n // move速率\n const velocity = distance / intervalTime;\n // 0.3 是参考hammerjs的设置\n if (velocity > this.config.swipe.velocity && distance > this.config.swipe.threshold) {\n endEvent.velocity = velocity;\n endEvent.direction = calcDirection(prevMovePoint, lastMovePoint);\n this.triggerEvent('swipe', endEvent);\n }\n }\n }\n\n if (now - this.lastTapTime < this.config.tap.interval) {\n this.tapCount++;\n } else {\n this.tapCount = 1;\n }\n this.lastTapTime = now;\n\n if (this.tapCount === 1) {\n this.triggerEvent('tap', endEvent);\n } else if (this.tapCount === 2) {\n this.triggerEvent('doubletap', endEvent);\n this.tapCount = 0; // reset tapCount after doubletap\n }\n }\n\n for (let i = 0, len = cachedEvents.length; i < len; i++) {\n if (cachedEvents[i].pointerId === endEvent.pointerId) {\n cachedEvents.splice(i, 1);\n startPoints.splice(i, 1);\n break;\n }\n }\n\n this.reset();\n\n // 多指离开 1 指后,重新触发一次start\n if (cachedEvents.length > 0) {\n this.onStart();\n }\n };\n\n private getEventType(point: IPointLike) {\n const { eventType, startTime, startPoints } = this;\n if (eventType) {\n return eventType;\n }\n let type;\n const now = clock.now();\n if (now - startTime > this.config.press.time && calcDistance(startPoints[0], point) < this.config.press.threshold) {\n type = 'press';\n } else {\n type = 'pan';\n }\n this.eventType = type;\n return type;\n }\n\n private enable(eventType: string) {\n this.processEvent[eventType] = true;\n }\n\n // 是否进行中的事件\n private isProcess(eventType: string) {\n return this.processEvent[eventType];\n }\n\n private pushEvent(type: string, ev: GestureEvent) {\n const { emitThrottles } = this;\n const newEvent = { type, ev };\n for (let i = 0, len = emitThrottles.length; i < len; i++) {\n if (emitThrottles[i].type === type) {\n emitThrottles.splice(i, 1, newEvent);\n return;\n }\n }\n emitThrottles.push(newEvent);\n }\n\n private clearPressTimeout() {\n if (this.pressTimeout) {\n clearTimeout(this.pressTimeout);\n this.pressTimeout = null;\n }\n }\n\n private reset() {\n this.clearPressTimeout();\n this.startTime = 0;\n this.startDistance = 0;\n this.direction = null;\n this.eventType = null;\n this.prevMoveTime = 0;\n this.prevMovePoint = null;\n this.lastMoveTime = 0;\n this.lastMovePoint = null;\n }\n\n private triggerEvent(type: string, ev: GestureEvent) {\n // 主要是节流处理\n this.pushEvent(type, ev);\n const { throttleTimer, emitThrottles } = this;\n if (throttleTimer) {\n return;\n }\n\n this.throttleTimer = application.global.getRequestAnimationFrame()(() => {\n for (let i = 0, len = emitThrottles.length; i < len; i++) {\n const { type, ev } = emitThrottles[i];\n this.emitEvent(type, ev);\n }\n // 清空\n this.throttleTimer = 0;\n this.emitThrottles.length = 0;\n });\n }\n\n // 触发start事件\n private triggerStartEvent(type: string, ev: GestureEvent) {\n if (this.isProcess(type)) {\n return;\n }\n this.enable(type);\n this.triggerEvent(`${type}start`, ev);\n }\n\n private triggerEndEvent(ev: GestureEvent) {\n const processEvent = this.processEvent;\n Object.keys(processEvent).forEach(type => {\n this.triggerEvent(`${type}end`, ev);\n if (type === 'press') {\n // pressend 别名,pressup\n this.triggerEvent(`${type}up`, ev);\n }\n delete processEvent[type];\n });\n }\n\n private emitEvent(type: string, e: GestureEvent) {\n const events = (this.element as unknown as any)._events;\n const listeners = events[WILDCARD];\n if (listeners) {\n if ('fn' in listeners) {\n listeners.fn.call(listeners.context, e, type);\n } else {\n for (let i = 0, j = listeners.length; i < j && !e.propagationImmediatelyStopped; i++) {\n listeners[i].fn.call(listeners[i].context, e, type);\n }\n }\n }\n\n this.emit(type, e);\n }\n}\n"]}
1
+ {"version":3,"sources":["../src/event/extension/gesture.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAGtE,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AA6BhD,MAAM,UAAU,GAAG,GAAG,CAAC;AACvB,MAAM,eAAe,GAAG,CAAC,CAAC;AAC1B,MAAM,cAAc,GAAG,GAAG,CAAC;AAC3B,MAAM,eAAe,GAAG,EAAE,CAAC;AAC3B,MAAM,YAAY,GAAG,GAAG,CAAC;AAEzB,MAAM,aAAa,GAAG,CAAC,KAAiB,EAAE,GAAe,EAAE,EAAE;IAC3D,MAAM,SAAS,GAAG,GAAG,CAAC,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC;IAClC,MAAM,SAAS,GAAG,GAAG,CAAC,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC;IAClC,IAAI,IAAI,CAAC,GAAG,CAAC,SAAS,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,SAAS,CAAC,EAAE;QAC7C,OAAO,SAAS,GAAG,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC;KACzC;IACD,OAAO,SAAS,GAAG,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC;AACvC,CAAC,CAAC;AAGF,MAAM,YAAY,GAAG,CAAC,MAAkB,EAAE,MAAkB,EAAE,EAAE;IAC9D,MAAM,SAAS,GAAG,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC;IAChD,MAAM,SAAS,GAAG,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,GAA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;YACvC,IAAI,CAAC,YAAY,CAAC,GAAG,IAAI,KAAK,EAAE,EAAE,CAAC,CAAC;YACpC,IAAI,IAAI,KAAK,OAAO,EAAE;gBAEpB,IAAI,CAAC,YAAY,CAAC,GAAG,IAAI,IAAI,EAAE,EAAE,CAAC,CAAC;aACpC;YACD,OAAO,YAAY,CAAC,IAAI,CAAC,CAAC;QAC5B,CAAC,CAAC,CAAC;IACL,CAAC;IAEO,SAAS,CAAC,IAAY,EAAE,CAAe;QAC7C,MAAM,MAAM,GAAI,IAAI,CAAC,OAA0B,CAAC,OAAO,CAAC;QACxD,MAAM,SAAS,GAAG,MAAM,CAAC,QAAQ,CAAC,CAAC;QACnC,IAAI,SAAS,EAAE;YACb,IAAI,IAAI,IAAI,SAAS,EAAE;gBACrB,SAAS,CAAC,EAAE,CAAC,IAAI,CAAC,SAAS,CAAC,OAAO,EAAE,CAAC,EAAE,IAAI,CAAC,CAAC;aAC/C;iBAAM;gBACL,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,SAAS,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,6BAA6B,EAAE,CAAC,EAAE,EAAE;oBACpF,SAAS,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,OAAO,EAAE,CAAC,EAAE,IAAI,CAAC,CAAC;iBACrD;aACF;SACF;QAED,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC;IACrB,CAAC;CACF","file":"gesture.js","sourcesContent":["import { application, clock, WILDCARD } from '@visactor/vrender-core';\nimport type { IEventTarget, IFederatedPointerEvent, FederatedPointerEvent, INode } from '@visactor/vrender-core';\nimport type { IPointLike } from '@visactor/vutils';\nimport { EventEmitter } from '@visactor/vutils';\n\nimport type { DefaultGestureConfig, EmitEventObject, GestureConfig, GestureDirection, GestureEvent } from './interface';\n\n/**\n * 代码参考 https://github.com/hammerjs/hammer.js\n * The MIT License (MIT)\n\n Copyright (C) 2011-2017 by Jorik Tangelder (Eight Media)\n\n Permission is hereby granted, free of charge, to any person obtaining a copy\n of this software and associated documentation files (the \"Software\"), to deal\n in the Software without restriction, including without limitation the rights\n to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n copies of the Software, and to permit persons to whom the Software is\n furnished to do so, subject to the following conditions:\n\n The above copyright notice and this permission notice shall be included in\n all copies or substantial portions of the Software.\n\n THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n THE SOFTWARE.\n */\n\nconst PRESS_TIME = 251;\nconst PRESS_THRESHOLD = 9;\nconst SWIPE_VELOCITY = 0.3;\nconst SWIPE_THRESHOLD = 10;\nconst TAP_INTERVAL = 300;\n\nconst calcDirection = (start: IPointLike, end: IPointLike) => {\n const xDistance = end.x - start.x;\n const yDistance = end.y - start.y;\n if (Math.abs(xDistance) > Math.abs(yDistance)) {\n return xDistance > 0 ? 'right' : 'left';\n }\n return yDistance > 0 ? 'down' : 'up';\n};\n\n// 计算2点之间的距离\nconst calcDistance = (point1: IPointLike, point2: IPointLike) => {\n const xDistance = Math.abs(point2.x - point1.x);\n const yDistance = Math.abs(point2.y - point1.y);\n return Math.sqrt(xDistance * xDistance + yDistance * yDistance);\n};\n\nconst getCenter = (points: IPointLike[]) => {\n const pointersLength = points.length;\n\n if (pointersLength === 1) {\n return {\n x: Math.round(points[0].x),\n y: Math.round(points[0].y)\n };\n }\n\n let x = 0;\n let y = 0;\n let i = 0;\n while (i < pointersLength) {\n x += points[i].x;\n y += points[i].y;\n i++;\n }\n\n return {\n x: Math.round(x / pointersLength),\n y: Math.round(y / pointersLength)\n };\n};\n\nexport class Gesture extends EventEmitter {\n element: INode | null;\n\n private cachedEvents: IFederatedPointerEvent[] = [];\n private startTime: number;\n // @ts-ignore\n // eslint-disable-next-line no-undef\n private pressTimeout: NodeJS.Timeout | null;\n private startPoints: IPointLike[] = [];\n // 用来记录当前触发的事件\n private processEvent: Record<string, boolean> = {};\n private startDistance: number;\n private center: IPointLike;\n private eventType: string | null;\n private direction: GestureDirection | null;\n\n private lastMoveTime: number;\n private prevMoveTime: number;\n\n private prevMovePoint: IPointLike | null;\n private lastMovePoint: IPointLike | null;\n\n private throttleTimer: number = 0;\n private emitThrottles: EmitEventObject[] = [];\n\n private config: DefaultGestureConfig;\n\n private tapCount;\n private lastTapTime;\n private lastTapTarget: IEventTarget | null = null;\n\n constructor(element: IEventTarget, config: GestureConfig = {}) {\n super();\n this.element = element;\n this.tapCount = 0;\n this.lastTapTime = 0;\n this.config = {\n press: {\n time: config?.press?.time ?? PRESS_TIME,\n threshold: config?.press?.threshold ?? PRESS_THRESHOLD\n },\n swipe: {\n threshold: config?.swipe?.threshold ?? SWIPE_THRESHOLD,\n velocity: config?.swipe?.velocity ?? SWIPE_VELOCITY\n },\n tap: {\n interval: config?.tap?.interval ?? TAP_INTERVAL\n }\n };\n this.initEvents();\n }\n\n initEvents() {\n const { element } = this;\n if (!element) {\n return;\n }\n\n element.addEventListener('pointerdown', this.onStart);\n element.addEventListener('pointermove', this.onMove);\n element.addEventListener('pointerup', this.onEnd);\n element.addEventListener('pointerupoutside', this.onEnd);\n }\n\n removeEvents() {\n const { element } = this;\n if (!element) {\n return;\n }\n element.removeEventListener('pointerdown', this.onStart);\n element.removeEventListener('pointermove', this.onMove);\n element.removeEventListener('pointerup', this.onEnd);\n element.removeEventListener('pointerupoutside', this.onEnd);\n }\n\n release() {\n this.removeEvents();\n this.element = null;\n }\n\n private onStart = (ev?: FederatedPointerEvent) => {\n this.reset();\n\n this.startTime = clock.now();\n\n const { cachedEvents, startPoints } = this;\n\n if (ev) {\n cachedEvents.push(ev.clone());\n }\n // 重置 startPoints\n startPoints.length = cachedEvents.length;\n for (let i = 0; i < cachedEvents.length; i++) {\n const { x, y } = cachedEvents[i];\n const point = { x, y };\n startPoints[i] = point;\n }\n\n if (startPoints.length === 1) {\n const event = cachedEvents[0] as unknown as GestureEvent;\n this.pressTimeout = setTimeout(() => {\n const eventType = 'press';\n const direction = 'none';\n event.direction = direction;\n event.deltaX = 0;\n event.deltaY = 0;\n event.points = startPoints;\n this.triggerStartEvent(eventType, event);\n this.triggerEvent(eventType, event);\n this.eventType = eventType;\n this.direction = direction;\n }, this.config.press.time);\n return;\n }\n\n this.startDistance = calcDistance(startPoints[0], startPoints[1]);\n this.center = getCenter([startPoints[0], startPoints[1]]);\n };\n\n private onMove = (ev: FederatedPointerEvent) => {\n this.clearPressTimeout();\n const { startPoints, cachedEvents } = this;\n if (!startPoints.length) {\n return;\n }\n\n const moveEvent = ev.clone() as unknown as GestureEvent;\n const { x, y, pointerId } = moveEvent;\n for (let i = 0, len = cachedEvents.length; i < len; i++) {\n if (pointerId === cachedEvents[i].pointerId) {\n cachedEvents[i] = moveEvent;\n break;\n }\n }\n const point = { x, y };\n const points = cachedEvents.map(cachedEvent => ({ x: cachedEvent.x, y: cachedEvent.y }));\n\n const now = clock.now();\n this.prevMoveTime = this.lastMoveTime;\n this.prevMovePoint = this.lastMovePoint;\n this.lastMoveTime = now;\n this.lastMovePoint = point;\n\n if (startPoints.length === 1) {\n const startPoint = startPoints[0];\n const deltaX = x - startPoint.x;\n const deltaY = y - startPoint.y;\n const direction = this.direction || calcDirection(startPoint, point);\n this.direction = direction;\n\n const eventType = this.getEventType(point);\n moveEvent.direction = direction;\n moveEvent.deltaX = deltaX;\n moveEvent.deltaY = deltaY;\n moveEvent.points = points;\n this.triggerStartEvent(eventType, moveEvent);\n this.triggerEvent(eventType, moveEvent);\n return;\n }\n\n const { startDistance } = this;\n const currentDistance = calcDistance(points[0], points[1]);\n\n // 缩放比例\n moveEvent.scale = currentDistance / startDistance;\n moveEvent.center = this.center;\n moveEvent.points = points;\n this.triggerStartEvent('pinch', moveEvent);\n this.triggerEvent('pinch', moveEvent);\n };\n\n private onEnd = (ev: FederatedPointerEvent) => {\n const endEvent = ev.clone() as unknown as GestureEvent;\n const { cachedEvents, startPoints } = this;\n const points = cachedEvents.map(ev => {\n return { x: ev.x, y: ev.y };\n });\n endEvent.points = points;\n this.triggerEndEvent(endEvent);\n\n if (cachedEvents.length === 1) {\n const now = clock.now();\n const lastMoveTime = this.lastMoveTime;\n // 做这个判断是为了最后一次touchmove后到end前,是否还有一个停顿的过程\n // 100 是拍的一个值,理论这个值会很短,一般不卡顿的话在10ms以内\n if (now - lastMoveTime < 100) {\n const prevMoveTime = this.prevMoveTime || this.startTime;\n const intervalTime = lastMoveTime - prevMoveTime;\n // 时间间隔一定要大于0, 否则计算没意义\n if (intervalTime > 0) {\n const prevMovePoint = this.prevMovePoint || startPoints[0];\n const lastMovePoint = this.lastMovePoint || startPoints[0];\n const distance = calcDistance(prevMovePoint, lastMovePoint);\n // move速率\n const velocity = distance / intervalTime;\n // 0.3 是参考hammerjs的设置\n if (velocity > this.config.swipe.velocity && distance > this.config.swipe.threshold) {\n endEvent.velocity = velocity;\n endEvent.direction = calcDirection(prevMovePoint, lastMovePoint);\n this.triggerEvent('swipe', endEvent);\n }\n }\n }\n\n if (now - this.lastTapTime < this.config.tap.interval && ev.target === this.lastTapTarget) {\n this.tapCount++;\n } else {\n this.tapCount = 1;\n }\n this.lastTapTime = now;\n this.lastTapTarget = ev.target;\n\n if (this.tapCount === 1) {\n this.triggerEvent('tap', endEvent);\n } else if (this.tapCount === 2) {\n this.triggerEvent('doubletap', endEvent);\n this.tapCount = 0; // reset tapCount after doubletap\n }\n }\n\n for (let i = 0, len = cachedEvents.length; i < len; i++) {\n if (cachedEvents[i].pointerId === endEvent.pointerId) {\n cachedEvents.splice(i, 1);\n startPoints.splice(i, 1);\n break;\n }\n }\n\n this.reset();\n\n // 多指离开 1 指后,重新触发一次start\n if (cachedEvents.length > 0) {\n this.onStart();\n }\n };\n\n private getEventType(point: IPointLike) {\n const { eventType, startTime, startPoints } = this;\n if (eventType) {\n return eventType;\n }\n let type;\n const now = clock.now();\n if (now - startTime > this.config.press.time && calcDistance(startPoints[0], point) < this.config.press.threshold) {\n type = 'press';\n } else {\n type = 'pan';\n }\n this.eventType = type;\n return type;\n }\n\n private enable(eventType: string) {\n this.processEvent[eventType] = true;\n }\n\n // 是否进行中的事件\n private isProcess(eventType: string) {\n return this.processEvent[eventType];\n }\n\n private pushEvent(type: string, ev: GestureEvent) {\n const { emitThrottles } = this;\n const newEvent = { type, ev };\n for (let i = 0, len = emitThrottles.length; i < len; i++) {\n if (emitThrottles[i].type === type) {\n emitThrottles.splice(i, 1, newEvent);\n return;\n }\n }\n emitThrottles.push(newEvent);\n }\n\n private clearPressTimeout() {\n if (this.pressTimeout) {\n clearTimeout(this.pressTimeout);\n this.pressTimeout = null;\n }\n }\n\n private reset() {\n this.clearPressTimeout();\n this.startTime = 0;\n this.startDistance = 0;\n this.direction = null;\n this.eventType = null;\n this.prevMoveTime = 0;\n this.prevMovePoint = null;\n this.lastMoveTime = 0;\n this.lastMovePoint = null;\n }\n\n private triggerEvent(type: string, ev: GestureEvent) {\n // 主要是节流处理\n this.pushEvent(type, ev);\n const { throttleTimer, emitThrottles } = this;\n if (throttleTimer) {\n return;\n }\n\n this.throttleTimer = application.global.getRequestAnimationFrame()(() => {\n for (let i = 0, len = emitThrottles.length; i < len; i++) {\n const { type, ev } = emitThrottles[i];\n this.emitEvent(type, ev);\n }\n // 清空\n this.throttleTimer = 0;\n this.emitThrottles.length = 0;\n });\n }\n\n // 触发start事件\n private triggerStartEvent(type: string, ev: GestureEvent) {\n if (this.isProcess(type)) {\n return;\n }\n this.enable(type);\n this.triggerEvent(`${type}start`, ev);\n }\n\n private triggerEndEvent(ev: GestureEvent) {\n const processEvent = this.processEvent;\n Object.keys(processEvent).forEach(type => {\n this.triggerEvent(`${type}end`, ev);\n if (type === 'press') {\n // pressend 别名,pressup\n this.triggerEvent(`${type}up`, ev);\n }\n delete processEvent[type];\n });\n }\n\n private emitEvent(type: string, e: GestureEvent) {\n const events = (this.element as unknown as any)._events;\n const listeners = events[WILDCARD];\n if (listeners) {\n if ('fn' in listeners) {\n listeners.fn.call(listeners.context, e, type);\n } else {\n for (let i = 0, j = listeners.length; i < j && !e.propagationImmediatelyStopped; i++) {\n listeners[i].fn.call(listeners[i].context, e, type);\n }\n }\n }\n\n this.emit(type, e);\n }\n}\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@visactor/vrender-kits",
3
- "version": "0.16.17",
3
+ "version": "0.16.18-alpha.0",
4
4
  "description": "",
5
5
  "sideEffects": false,
6
6
  "main": "cjs/index.js",
@@ -12,7 +12,7 @@
12
12
  "dist"
13
13
  ],
14
14
  "dependencies": {
15
- "@visactor/vrender-core": "0.16.17",
15
+ "@visactor/vrender-core": "0.16.18-alpha.0",
16
16
  "@visactor/vutils": "~0.16.18",
17
17
  "@resvg/resvg-js": "2.4.1",
18
18
  "roughjs": "4.5.2"
@@ -31,8 +31,8 @@
31
31
  "vite": "3.2.6",
32
32
  "typescript": "4.9.5",
33
33
  "@internal/bundler": "0.0.1",
34
- "@internal/eslint-config": "0.0.1",
35
- "@internal/ts-config": "0.0.1"
34
+ "@internal/ts-config": "0.0.1",
35
+ "@internal/eslint-config": "0.0.1"
36
36
  },
37
37
  "keywords": [
38
38
  "VisActor",