@antv/g-canvas 2.0.16 → 2.0.17

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.
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../src/Canvas2DContextService.ts","../src/ContextRegisterPlugin.ts","../src/index.ts"],"sourcesContent":[null,null,null],"names":["isString","isBrowser","setDOMSize","RenderReason","__extends","AbstractRendererPlugin","ImageLoader","CanvasPathGenerator","CanvasRenderer","DomInteraction","CanvasPicker","HTMLRenderer","AbstractRenderer"],"mappings":"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"}
1
+ {"version":3,"file":"index.js","sources":["../src/Canvas2DContextService.ts","../src/ContextRegisterPlugin.ts","../src/index.ts"],"sourcesContent":["import type {\n RenderingContext,\n CanvasContext,\n CanvasLike,\n DataURLOptions,\n GlobalRuntime,\n CanvasConfig,\n ContextService,\n} from '@antv/g-lite';\nimport { RenderReason, isBrowser, setDOMSize } from '@antv/g-lite';\nimport { isString } from '@antv/util';\n\nexport class Canvas2DContextService\n implements ContextService<CanvasRenderingContext2D>\n{\n private $container: HTMLElement | null;\n private $canvas: CanvasLike | null;\n private dpr: number;\n private context:\n | CanvasRenderingContext2D\n | OffscreenCanvasRenderingContext2D\n | null;\n private canvasConfig: Partial<CanvasConfig>;\n private renderingContext: RenderingContext;\n\n constructor(context: GlobalRuntime & CanvasContext) {\n this.renderingContext = context.renderingContext;\n this.canvasConfig = context.config;\n }\n\n init() {\n const { container, canvas } = this.canvasConfig;\n\n if (canvas) {\n this.$canvas = canvas;\n\n if (\n container &&\n (canvas as HTMLCanvasElement).parentElement !== container\n ) {\n (container as HTMLElement).appendChild(canvas as HTMLCanvasElement);\n }\n\n this.$container = (canvas as HTMLCanvasElement).parentElement;\n this.canvasConfig.container = this.$container;\n } else if (container) {\n // create container\n this.$container = isString(container)\n ? document.getElementById(container)\n : container;\n if (this.$container) {\n // create canvas\n const $canvas = document.createElement('canvas');\n\n this.$container.appendChild($canvas);\n if (!this.$container.style.position) {\n this.$container.style.position = 'relative';\n }\n this.$canvas = $canvas;\n }\n }\n\n this.context = this.$canvas.getContext('2d');\n this.resize(this.canvasConfig.width, this.canvasConfig.height);\n }\n\n getContext() {\n return this.context as CanvasRenderingContext2D;\n }\n\n getDomElement() {\n return this.$canvas;\n }\n\n getDPR() {\n return this.dpr;\n }\n\n getBoundingClientRect() {\n if ((this.$canvas as HTMLCanvasElement).getBoundingClientRect) {\n return (this.$canvas as HTMLCanvasElement).getBoundingClientRect();\n }\n }\n\n destroy() {\n // @ts-ignore\n if (this.$container && this.$canvas && this.$canvas.parentNode) {\n // destroy context\n // @ts-ignore\n this.$container.removeChild(this.$canvas);\n }\n }\n\n resize(width: number, height: number) {\n const { devicePixelRatio } = this.canvasConfig;\n\n // use user-defined dpr first\n let dpr = devicePixelRatio || (isBrowser && window.devicePixelRatio) || 1;\n dpr = dpr >= 1 ? Math.ceil(dpr) : 1;\n this.dpr = dpr;\n\n if (this.$canvas) {\n // set canvas width & height\n this.$canvas.width = this.dpr * width;\n this.$canvas.height = this.dpr * height;\n\n // set CSS style width & height\n setDOMSize(this.$canvas, width, height);\n\n // const dpr = this.getDPR();\n // scale all drawing operations by the dpr\n // @see https://www.html5rocks.com/en/tutorials/canvas/hidpi/\n // this.context.scale(dpr, dpr);\n }\n\n this.renderingContext.renderReasons.add(RenderReason.CAMERA_CHANGED);\n }\n\n applyCursorStyle(cursor: string) {\n if (this.$container && this.$container.style) {\n this.$container.style.cursor = cursor;\n }\n }\n\n async toDataURL(options: Partial<DataURLOptions> = {}) {\n const { type, encoderOptions } = options;\n return (this.context.canvas as HTMLCanvasElement).toDataURL(\n type,\n encoderOptions,\n );\n }\n}\n","import { AbstractRendererPlugin } from '@antv/g-lite';\nimport { Canvas2DContextService } from './Canvas2DContextService';\n\nexport class ContextRegisterPlugin extends AbstractRendererPlugin {\n name = 'canvas-context-register';\n init(): void {\n this.context.ContextService = Canvas2DContextService;\n }\n destroy(): void {\n delete this.context.ContextService;\n }\n}\n","import type { RendererConfig } from '@antv/g-lite';\nimport { AbstractRenderer } from '@antv/g-lite';\nimport * as CanvasPathGenerator from '@antv/g-plugin-canvas-path-generator';\nimport * as CanvasPicker from '@antv/g-plugin-canvas-picker';\nimport * as CanvasRenderer from '@antv/g-plugin-canvas-renderer';\nimport * as DomInteraction from '@antv/g-plugin-dom-interaction';\nimport * as HTMLRenderer from '@antv/g-plugin-html-renderer';\nimport * as ImageLoader from '@antv/g-plugin-image-loader';\nimport { ContextRegisterPlugin } from './ContextRegisterPlugin';\n\nexport {\n CanvasPathGenerator,\n CanvasPicker,\n CanvasRenderer,\n DomInteraction,\n HTMLRenderer,\n ImageLoader,\n};\n\nexport class Renderer extends AbstractRenderer {\n constructor(config?: Partial<RendererConfig>) {\n super(config);\n\n // register Canvas2DContext\n this.registerPlugin(new ContextRegisterPlugin());\n this.registerPlugin(new ImageLoader.Plugin());\n this.registerPlugin(new CanvasPathGenerator.Plugin());\n // enable rendering with Canvas2D API\n this.registerPlugin(new CanvasRenderer.Plugin());\n this.registerPlugin(new DomInteraction.Plugin());\n // enable picking with Canvas2D API\n this.registerPlugin(new CanvasPicker.Plugin());\n\n // render HTML component\n this.registerPlugin(new HTMLRenderer.Plugin());\n }\n}\n"],"names":["Canvas2DContextService","constructor","context","renderingContext","canvasConfig","config","init","_this$canvasConfig","container","canvas","$canvas","parentElement","appendChild","$container","isString","document","getElementById","createElement","style","position","getContext","resize","width","height","getDomElement","getDPR","dpr","getBoundingClientRect","destroy","parentNode","removeChild","devicePixelRatio","isBrowser","window","Math","ceil","setDOMSize","renderReasons","add","RenderReason","CAMERA_CHANGED","applyCursorStyle","cursor","toDataURL","_arguments","arguments","_this","_asyncToGenerator","_regeneratorRuntime","mark","_callee","options","type","encoderOptions","wrap","_callee$","_context","prev","next","length","undefined","abrupt","stop","ContextRegisterPlugin","AbstractRendererPlugin","name","ContextService","Renderer","AbstractRenderer","registerPlugin","ImageLoader","Plugin","CanvasPathGenerator","CanvasRenderer","DomInteraction","CanvasPicker","HTMLRenderer"],"mappings":"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"}
@@ -1,2 +1,66 @@
1
- !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@antv/g-lite")):"function"==typeof define&&define.amd?define(["exports","@antv/g-lite"],t):t(((e="undefined"!=typeof globalThis?globalThis:e||self).G=e.G||{},e.G.Canvas2D={}),e.window.G)}(this,(function(e,t){"use strict";var n=function(e,t){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},n(e,t)};function r(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+t+" is not a constructor or null");function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}var i=function(){return i=Object.assign||function(e){for(var t,n=1,r=arguments.length;r>n;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},i.apply(this,arguments)};function a(e,t,n,r){return new(n||(n=Promise))((function(i,a){function o(e){try{c(r.next(e))}catch(e){a(e)}}function s(e){try{c(r.throw(e))}catch(e){a(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(o,s)}c((r=r.apply(e,t||[])).next())}))}function o(e,t){var n,r,i,a,o={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return a={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function s(s){return function(c){return function(s){if(n)throw new TypeError("Generator is already executing.");for(;a&&(a=0,s[0]&&(o=0)),o;)try{if(n=1,r&&(i=2&s[0]?r.return:s[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,s[1])).done)return i;switch(r=0,i&&(s=[2&s[0],i.value]),s[0]){case 0:case 1:i=s;break;case 4:return o.label++,{value:s[1],done:!1};case 5:o.label++,r=s[1],s=[0];continue;case 7:s=o.ops.pop(),o.trys.pop();continue;default:if(!(i=o.trys,(i=i.length>0&&i[i.length-1])||6!==s[0]&&2!==s[0])){o=0;continue}if(3===s[0]&&(!i||s[1]>i[0]&&i[3]>s[1])){o.label=s[1];break}if(6===s[0]&&i[1]>o.label){o.label=i[1],i=s;break}if(i&&i[2]>o.label){o.label=i[2],o.ops.push(s);break}i[2]&&o.ops.pop(),o.trys.pop();continue}s=t.call(e,o)}catch(e){s=[6,e],r=0}finally{n=i=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,c])}}}function s(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,i,a=n.call(e),o=[];try{for(;(void 0===t||t-- >0)&&!(r=a.next()).done;)o.push(r.value)}catch(e){i={error:e}}finally{try{r&&!r.done&&(n=a.return)&&n.call(a)}finally{if(i)throw i.error}}return o}function c(e,t,n){if(n||2===arguments.length)for(var r,i=0,a=t.length;a>i;i++)!r&&i in t||(r||(r=Array.prototype.slice.call(t,0,i)),r[i]=t[i]);return e.concat(r||Array.prototype.slice.call(t))}"function"==typeof SuppressedError&&SuppressedError;var l=function(e){return null==e},h={}.toString,u=function(e,t){return h.call(e)==="[object "+t+"]"},d=function(e){return u(e,"String")},p=function(e,t,n){return t>e?t:e>n?n:e},f=function(e){return u(e,"Number")},v="undefined"!=typeof Float32Array?Float32Array:Array;function y(){var e=new v(16);return v!=Float32Array&&(e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[11]=0,e[12]=0,e[13]=0,e[14]=0),e[0]=1,e[5]=1,e[10]=1,e[15]=1,e}function g(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[8]=t[8],e[9]=t[9],e[10]=t[10],e[11]=t[11],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15],e}function m(e,t,n){var r=t[0],i=t[1],a=t[2],o=t[3],s=t[4],c=t[5],l=t[6],h=t[7],u=t[8],d=t[9],p=t[10],f=t[11],v=t[12],y=t[13],g=t[14],m=t[15],E=n[0],x=n[1],M=n[2],b=n[3];return e[0]=E*r+x*s+M*u+b*v,e[1]=E*i+x*c+M*d+b*y,e[2]=E*a+x*l+M*p+b*g,e[3]=E*o+x*h+M*f+b*m,e[4]=(E=n[4])*r+(x=n[5])*s+(M=n[6])*u+(b=n[7])*v,e[5]=E*i+x*c+M*d+b*y,e[6]=E*a+x*l+M*p+b*g,e[7]=E*o+x*h+M*f+b*m,e[8]=(E=n[8])*r+(x=n[9])*s+(M=n[10])*u+(b=n[11])*v,e[9]=E*i+x*c+M*d+b*y,e[10]=E*a+x*l+M*p+b*g,e[11]=E*o+x*h+M*f+b*m,e[12]=(E=n[12])*r+(x=n[13])*s+(M=n[14])*u+(b=n[15])*v,e[13]=E*i+x*c+M*d+b*y,e[14]=E*a+x*l+M*p+b*g,e[15]=E*o+x*h+M*f+b*m,e}function E(){var e=new v(3);return v!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0),e}function x(e,t,n,r){return e[0]=t,e[1]=n,e[2]=r,e}function M(e,t,n){var r=t[0],i=t[1],a=t[2],o=n[3]*r+n[7]*i+n[11]*a+n[15];return e[0]=(n[0]*r+n[4]*i+n[8]*a+n[12])/(o=o||1),e[1]=(n[1]*r+n[5]*i+n[9]*a+n[13])/o,e[2]=(n[2]*r+n[6]*i+n[10]*a+n[14])/o,e}function b(e,t,n){return{x:e*Math.cos(n)-t*Math.sin(n),y:e*Math.sin(n)+t*Math.cos(n)}}function S(e,t,n,r,i,a,o,s,c,l){var h,u,d,p,f,v=e,y=t,g=n,m=r,E=s,x=c,M=120*Math.PI/180,P=Math.PI/180*(+i||0),T=[];if(l)u=l[0],d=l[1],p=l[2],f=l[3];else{y=(h=b(v,y,-P)).y;var C=((v=h.x)-(E=(h=b(E,x,-P)).x))/2,A=(y-(x=h.y))/2,w=C*C/(g*g)+A*A/(m*m);w>1&&(g*=w=Math.sqrt(w),m*=w);var O=g*g,L=m*m,k=(a===o?-1:1)*Math.sqrt(Math.abs((O*L-O*A*A-L*C*C)/(O*A*A+L*C*C)));p=k*g*A/m+(v+E)/2,u=Math.asin(((y-(f=k*-m*C/g+(y+x)/2))/m*1e9>>0)/1e9),d=Math.asin(((x-f)/m*1e9>>0)/1e9),0>(u=p>v?Math.PI-u:u)&&(u=2*Math.PI+u),0>(d=p>E?Math.PI-d:d)&&(d=2*Math.PI+d),o&&u>d&&(u-=2*Math.PI),!o&&d>u&&(d-=2*Math.PI)}var R=d-u;if(Math.abs(R)>M){var N=d,I=E,B=x;T=S(E=p+g*Math.cos(d=u+M*(o&&d>u?1:-1)),x=f+m*Math.sin(d),g,m,i,0,o,I,B,[d,N,p,f])}R=d-u;var D=Math.cos(u),F=Math.sin(u),G=Math.cos(d),j=Math.sin(d),_=Math.tan(R/4),H=4/3*g*_,$=4/3*m*_,W=[v,y],U=[v+H*F,y-$*D],z=[E+H*j,x-$*G],Y=[E,x];if(U[0]=2*W[0]-U[0],U[1]=2*W[1]-U[1],l)return U.concat(z,Y,T);for(var q=[],Q=0,X=(T=U.concat(z,Y,T)).length;X>Q;Q+=1)q[Q]=Q%2?b(T[Q-1],T[Q],P).y:b(T[Q],T[Q+1],P).x;return q}function P(e,t){var n=t.cx,r=t.cy;e.arc(void 0===n?0:n,void 0===r?0:r,t.r,0,2*Math.PI,!1)}function T(e,t){var n=t.cx,r=void 0===n?0:n,i=t.cy,a=void 0===i?0:i,o=t.rx,s=t.ry;if(e.ellipse)e.ellipse(r,a,o,s,0,0,2*Math.PI,!1);else{var c=o>s?o:s,l=o>s?1:o/s,h=o>s?s/o:1;e.save(),e.scale(l,h),e.arc(r,a,c,0,2*Math.PI)}}function C(e,n){var r=n.x1,i=n.y1,a=n.x2,o=n.y2,s=n.markerStart,c=n.markerEnd,l=n.markerStartOffset,h=n.markerEndOffset,u=0,d=0,p=0,f=0,v=0;s&&t.isDisplayObject(s)&&l&&(u=Math.cos(v=Math.atan2(o-i,a-r))*(l||0),d=Math.sin(v)*(l||0)),c&&t.isDisplayObject(c)&&h&&(p=Math.cos(v=Math.atan2(i-o,r-a))*(h||0),f=Math.sin(v)*(h||0)),e.moveTo(r+u,i+d),e.lineTo(a+p,o+f)}function A(e,n){var r=n.markerStart,i=n.markerEnd,a=n.markerStartOffset,o=n.markerEndOffset,c=n.d,l=c.absolutePath,h=c.segments,u=0,d=0,p=0,f=0,v=0;if(r&&t.isDisplayObject(r)&&a){var y=s(r.parentNode.getStartTangent(),2);u=Math.cos(v=Math.atan2((g=y[0])[1]-(m=y[1])[1],g[0]-m[0]))*(a||0),d=Math.sin(v)*(a||0)}if(i&&t.isDisplayObject(i)&&o){var g,m,E=s(i.parentNode.getEndTangent(),2);p=Math.cos(v=Math.atan2((g=E[0])[1]-(m=E[1])[1],g[0]-m[0]))*(o||0),f=Math.sin(v)*(o||0)}for(var x=0;l.length>x;x++){var M=l[x],b=l[x+1],S=0===x&&(0!==u||0!==d),P=(x===l.length-1||b&&("M"===b[0]||"Z"===b[0]))&&0!==p&&0!==f;switch(M[0]){case"M":S?e.moveTo(M[1]+u,M[2]+d):e.moveTo(M[1],M[2]);break;case"L":P?e.lineTo(M[1]+p,M[2]+f):e.lineTo(M[1],M[2]);break;case"Q":e.quadraticCurveTo(M[1],M[2],M[3],M[4]),P&&e.lineTo(M[3]+p,M[4]+f);break;case"C":e.bezierCurveTo(M[1],M[2],M[3],M[4],M[5],M[6]),P&&e.lineTo(M[5]+p,M[6]+f);break;case"A":var T=h[x].arcParams,C=T.cx,A=T.cy,w=T.rx,O=T.ry,L=T.startAngle,k=T.endAngle,R=T.xRotation,N=T.sweepFlag;if(e.ellipse)e.ellipse(C,A,w,O,R,L,k,!!(1-N));else{var I=w>O?w:O,B=w>O?1:w/O,D=w>O?O/w:1;e.translate(C,A),e.rotate(R),e.scale(B,D),e.arc(0,0,I,L,k,!!(1-N)),e.scale(1/B,1/D),e.rotate(-R),e.translate(-C,-A)}P&&e.lineTo(M[6]+p,M[7]+f);break;case"Z":e.closePath()}}}function w(e,n){var r=n.markerStart,i=n.markerEnd,a=n.markerStartOffset,o=n.markerEndOffset,s=n.points.points,c=s.length,l=s[0][0],h=s[0][1],u=s[c-1][0],d=s[c-1][1],p=0,f=0,v=0,y=0,g=0;r&&t.isDisplayObject(r)&&a&&(p=Math.cos(g=Math.atan2(s[1][1]-s[0][1],s[1][0]-s[0][0]))*(a||0),f=Math.sin(g)*(a||0)),i&&t.isDisplayObject(i)&&o&&(v=Math.cos(g=Math.atan2(s[c-1][1]-s[0][1],s[c-1][0]-s[0][0]))*(o||0),y=Math.sin(g)*(o||0)),e.moveTo(l+(p||v),h+(f||y));for(var m=1;c-1>m;m++){var E=s[m];e.lineTo(E[0],E[1])}e.lineTo(u,d)}function O(e,n){var r=n.markerStart,i=n.markerEnd,a=n.markerStartOffset,o=n.markerEndOffset,s=n.points.points,c=s.length,l=s[0][0],h=s[0][1],u=s[c-1][0],d=s[c-1][1],p=0,f=0,v=0,y=0,g=0;r&&t.isDisplayObject(r)&&a&&(p=Math.cos(g=Math.atan2(s[1][1]-s[0][1],s[1][0]-s[0][0]))*(a||0),f=Math.sin(g)*(a||0)),i&&t.isDisplayObject(i)&&o&&(v=Math.cos(g=Math.atan2(s[c-2][1]-s[c-1][1],s[c-2][0]-s[c-1][0]))*(o||0),y=Math.sin(g)*(o||0)),e.moveTo(l+p,h+f);for(var m=1;c-1>m;m++){var E=s[m];e.lineTo(E[0],E[1])}e.lineTo(u+v,d+y)}function L(e,t){var n=t.x,r=void 0===n?0:n,i=t.y,a=void 0===i?0:i,o=t.radius,c=t.width,l=t.height,h=c,u=l;if(o&&o.some((function(e){return 0!==e}))){var d=c>0?1:-1,f=l>0?1:-1,v=d+f===0,y=s(o.map((function(e){return p(e,0,Math.min(Math.abs(h)/2,Math.abs(u)/2))})),4),g=y[0],m=y[1],E=y[2],x=y[3];e.moveTo(d*g+r,a),e.lineTo(h-d*m+r,a),0!==m&&e.arc(h-d*m+r,f*m+a,m,-f*Math.PI/2,d>0?0:Math.PI,v),e.lineTo(h+r,u-f*E+a),0!==E&&e.arc(h-d*E+r,u-f*E+a,E,d>0?0:Math.PI,f>0?Math.PI/2:1.5*Math.PI,v),e.lineTo(d*x+r,u+a),0!==x&&e.arc(d*x+r,u-f*x+a,x,f>0?Math.PI/2:-Math.PI/2,d>0?Math.PI:0,v),e.lineTo(r,f*g+a),0!==g&&e.arc(d*g+r,f*g+a,g,d>0?Math.PI:0,f>0?1.5*Math.PI:Math.PI/2,v)}else e.rect(r,a,h,u)}Math.hypot||(Math.hypot=function(){for(var e=0,t=arguments.length;t--;)e+=arguments[t]*arguments[t];return Math.sqrt(e)}),E(),function(){var e,t=(e=new v(2),v!=Float32Array&&(e[0]=0,e[1]=0),e)}();var k=function(e){function n(){var t=e.apply(this,c([],s(arguments),!1))||this;return t.name="canvas-path-generator",t}return r(n,e),n.prototype.init=function(){var e,n=((e={})[t.Shape.CIRCLE]=P,e[t.Shape.ELLIPSE]=T,e[t.Shape.RECT]=L,e[t.Shape.LINE]=C,e[t.Shape.POLYLINE]=O,e[t.Shape.POLYGON]=w,e[t.Shape.PATH]=A,e[t.Shape.TEXT]=void 0,e[t.Shape.GROUP]=void 0,e[t.Shape.IMAGE]=void 0,e[t.Shape.HTML]=void 0,e[t.Shape.MESH]=void 0,e);this.context.pathGeneratorFactory=n},n.prototype.destroy=function(){delete this.context.pathGeneratorFactory},n}(t.AbstractRendererPlugin),R=Object.freeze({__proto__:null,Plugin:k});function N(e,t,n,r){var i=e-n,a=t-r;return Math.sqrt(i*i+a*a)}var I=1e-4;function B(e,t,n,r,i,a){var o=-1,l=1/0,h=[n,r],u=20;a&&a>200&&(u=a/10);for(var d=1/u,p=d/10,f=0;u>=f;f++){var v=f*d,y=[i.apply(void 0,c([],s(e.concat([v])),!1)),i.apply(void 0,c([],s(t.concat([v])),!1))];l>(x=N(h[0],h[1],y[0],y[1]))&&(o=v,l=x)}if(0===o)return{x:e[0],y:t[0]};if(1===o){var g=e.length;return{x:e[g-1],y:t[g-1]}}l=1/0;for(f=0;32>f&&I<=p;f++){var m=o-p,E=o+p,x=(y=[i.apply(void 0,c([],s(e.concat([m])),!1)),i.apply(void 0,c([],s(t.concat([m])),!1))],N(h[0],h[1],y[0],y[1]));if(m>=0&&l>x)o=m,l=x;else{var M=[i.apply(void 0,c([],s(e.concat([E])),!1)),i.apply(void 0,c([],s(t.concat([E])),!1))],b=N(h[0],h[1],M[0],M[1]);1>=E&&l>b?(o=E,l=b):p*=.5}}return{x:i.apply(void 0,c([],s(e.concat([o])),!1)),y:i.apply(void 0,c([],s(t.concat([o])),!1))}}function D(e,t,n,r,i,a){var o=[n-e,r-t];if(function(e,t){return e[0]===t[0]&&e[1]===t[1]}(o,[0,0]))return Math.sqrt((i-e)*(i-e)+(a-t)*(a-t));var s=[-o[1],o[0]];return function(e,t){var n=t[0],r=t[1],i=n*n+r*r;i>0&&(i=1/Math.sqrt(i)),e[0]=t[0]*i,e[1]=t[1]*i}(s,s),Math.abs(function(e,t){return e[0]*t[0]+e[1]*t[1]}([i-e,a-t],s))}function F(e,t,n,r,i){var a=1-i;return a*a*a*e+3*t*i*a*a+3*n*i*i*a+r*i*i*i}function G(e,t,n,r,i,a,o,s,c,l,h){var u=function(e,t,n,r,i,a,o,s,c,l,h){return B([e,n,i,o],[t,r,a,s],c,l,F,h)}(e,t,n,r,i,a,o,s,c,l,h);return N(u.x,u.y,c,l)}function j(e,t,n,r){var i=1-r;return i*i*e+2*r*i*t+r*r*n}function _(e,t,n,r,i,a,o,s){var c=function(e,t,n,r,i,a,o,s){return B([e,n,i],[t,r,a],o,s,j)}(e,t,n,r,i,a,o,s);return N(c.x,c.y,o,s)}var H=E(),$=E(),W=E(),U=y(),z=function(){function e(){var e=this;this.isHit=function(n,r,i,a){var o,s,c,l,h,u,d,p,f,v,y,g,m,E,b,S,P,T,C,A,w,O,L,k,R,N,I,B,D,F,G,j=e.context.pointInPathPickerFactory[n.nodeName];if(j){var _=(o=U,(G=(C=(c=(s=i)[0])*(p=s[5])-(l=s[1])*(d=s[4]))*(F=(m=s[10])*(T=s[15])-(E=s[11])*(P=s[14]))-(A=c*(f=s[6])-(h=s[2])*d)*(D=(g=s[9])*T-E*(S=s[13]))+(w=c*(v=s[7])-(u=s[3])*d)*(B=g*P-m*S)+(O=l*f-h*p)*(I=(y=s[8])*T-E*(b=s[12]))-(L=l*v-u*p)*(N=y*P-m*b)+(k=h*v-u*f)*(R=y*S-g*b))?(o[0]=(p*F-f*D+v*B)*(G=1/G),o[1]=(h*D-l*F-u*B)*G,o[2]=(S*k-P*L+T*O)*G,o[3]=(m*L-g*k-E*O)*G,o[4]=(f*I-d*F-v*N)*G,o[5]=(c*F-h*I+u*N)*G,o[6]=(P*w-b*k-T*A)*G,o[7]=(y*k-m*w+E*A)*G,o[8]=(d*D-p*I+v*R)*G,o[9]=(l*I-c*D-u*R)*G,o[10]=(b*L-S*w+T*C)*G,o[11]=(g*w-y*L-E*C)*G,o[12]=(p*N-d*B-f*R)*G,o[13]=(c*B-l*N+h*R)*G,o[14]=(S*A-b*O-P*C)*G,o[15]=(y*O-g*A+m*C)*G,o):null),H=M($,x(W,r[0],r[1],0),_);if(j(n,new t.Point(H[0],H[1]),a,e.isPointInPath,e.context,e.runtime))return!0}return!1},this.isPointInPath=function(t,n){var r=e.runtime.offscreenCanvasCreator.getOrCreateContext(e.context.config.offscreenCanvas),i=e.context.pathGeneratorFactory[t.nodeName];return i&&(r.beginPath(),i(r,t.parsedStyle),r.closePath()),r.isPointInPath(n.x,n.y)}}return e.prototype.apply=function(t,n){var r,i=this,s=t.renderingService,c=t.renderingContext;this.context=t,this.runtime=n;var l=null===(r=c.root)||void 0===r?void 0:r.ownerDocument;s.hooks.pick.tapPromise(e.tag,(function(e){return a(i,void 0,void 0,(function(){return o(this,(function(t){return[2,this.pick(l,e)]}))}))})),s.hooks.pickSync.tap(e.tag,(function(e){return i.pick(l,e)}))},e.prototype.pick=function(e,n){var r,i,a=n.topmost,o=n.position,s=x(H,o.x,o.y,0),c=e.elementsFromBBox(s[0],s[1],s[0],s[1]),l=[];try{for(var h=function(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}(c),u=h.next();!u.done;u=h.next()){var d=u.value,p=d.getWorldTransform();if(this.isHit(d,s,p,!1)){var f=t.findClosestClipPathTarget(d);if(f){var v=f.parsedStyle.clipPath;if(this.isHit(v,s,v.getWorldTransform(),!0)){if(a)return n.picked=[d],n;l.push(d)}}else{if(a)return n.picked=[d],n;l.push(d)}}}}catch(e){r={error:e}}finally{try{u&&!u.done&&(i=h.return)&&i.call(h)}finally{if(r)throw r.error}}return n.picked=l,n},e.tag="CanvasPicker",e}();function Y(e,n,r){var i=e.parsedStyle,a=i.cx,o=i.cy,c=i.r,l=i.fill,h=i.stroke,u=i.lineWidth,d=i.increasedLineWidthForHitTesting,p=i.pointerEvents,f=void 0===p?"auto":p,v=((void 0===u?1:u)+(void 0===d?0:d))/2,y=N(void 0===a?0:a,void 0===o?0:o,n.x,n.y),g=s(t.isFillOrStrokeAffected(f,l,h),2),m=g[0],E=g[1];return m&&E||r?c+v>=y:m?c>=y:!!E&&(y>=c-v&&c+v>=y)}function q(e,t,n,r){return e/(n*n)+t/(r*r)}function Q(e,n,r){var i=e.parsedStyle,a=i.cx,o=void 0===a?0:a,c=i.cy,l=void 0===c?0:c,h=i.rx,u=i.ry,d=i.lineWidth,p=void 0===d?1:d,f=i.increasedLineWidthForHitTesting,v=void 0===f?0:f,y=i.pointerEvents,g=n.x,m=n.y,E=s(t.isFillOrStrokeAffected(void 0===y?"auto":y,i.fill,i.stroke),2),x=E[0],M=E[1],b=(p+v)/2,S=(g-o)*(g-o),P=(m-l)*(m-l);return x&&M||r?1>=q(S,P,h+b,u+b):x?1>=q(S,P,h,u):!!M&&(q(S,P,h-b,u-b)>=1&&1>=q(S,P,h+b,u+b))}function X(e,t,n,r,i,a){return!(e>i||i>e+n||t>a||a>t+r)}function V(e,t,n,r,i,a,o,s){var c=(Math.atan2(s-t,o-e)+2*Math.PI)%(2*Math.PI),l={x:e+n*Math.cos(c),y:t+n*Math.sin(c)};return N(l.x,l.y,o,s)<=a/2}function Z(e,t,n,r,i,a,o){var s=i/2;return!(Math.min(e,n)-s>a||a>Math.max(e,n)+s||Math.min(t,r)-s>o||o>Math.max(t,r)+s)&&D(e,t,n,r,a,o)<=i/2}function J(e,t,n,r,i){var a=e.length;if(2>a)return!1;for(var o=0;a-1>o;o++){if(Z(e[o][0],e[o][1],e[o+1][0],e[o+1][1],t,n,r))return!0}if(i){var s=e[0],c=e[a-1];if(Z(s[0],s[1],c[0],c[1],t,n,r))return!0}return!1}var K=1e-6;function ee(e){return K>Math.abs(e)?0:0>e?-1:1}function te(e,t,n){return!((n[0]-e[0])*(t[1]-e[1])!=(t[0]-e[0])*(n[1]-e[1])||Math.min(e[0],t[0])>n[0]||n[0]>Math.max(e[0],t[0])||Math.min(e[1],t[1])>n[1]||n[1]>Math.max(e[1],t[1]))}function ne(e,t,n){var r=!1,i=e.length;if(2>=i)return!1;for(var a=0;i>a;a++){var o=e[a],s=e[(a+1)%i];if(te(o,s,[t,n]))return!0;ee(o[1]-n)>0!=ee(s[1]-n)>0&&0>ee(t-(n-o[1])*(o[0]-s[0])/(o[1]-s[1])-o[0])&&(r=!r)}return r}function re(e,t,n){for(var r=!1,i=0;e.length>i;i++){if(r=ne(e[i],t,n))break}return r}function ie(e,n,r){var i=e.parsedStyle,a=i.x1,o=i.y1,c=i.x2,l=i.y2,h=i.lineWidth,u=void 0===h?1:h,d=i.increasedLineWidthForHitTesting,p=void 0===d?0:d,f=i.pointerEvents;return!(!s(t.isFillOrStrokeAffected(void 0===f?"auto":f,i.fill,i.stroke),2)[1]&&!r||!u)&&Z(a,o,c,l,u+p,n.x,n.y)}function ae(e,n,r,i,a,o){var c=e.parsedStyle,l=c.lineWidth,h=void 0===l?1:l,u=c.increasedLineWidthForHitTesting,d=void 0===u?0:u,p=c.d,f=c.pointerEvents,v=p.segments,y=p.hasArc,g=p.polylines,m=p.polygons,E=s(t.isFillOrStrokeAffected(void 0===f?"auto":f,(null==m?void 0:m.length)&&c.fill,c.stroke),2),x=E[0],M=E[1],b=t.getOrCalculatePathTotalLength(e),P=!1;return x||r?P=y?i(e,n):re(m,n.x,n.y)||re(g,n.x,n.y):((M||r)&&(P=function(e,t,n,r,i){for(var a=!1,o=t/2,s=0;e.length>s;s++){var c=e[s],l=c.currentPoint,h=c.params,u=c.prePoint,d=c.box;if(!d||X(d.x-o,d.y-o,d.width+t,d.height+t,n,r))switch(c.command){case"L":case"Z":if(a=Z(u[0],u[1],l[0],l[1],t,n,r))return!0;break;case"Q":if(a=t/2>=_(u[0],u[1],h[1],h[2],h[3],h[4],n,r))return!0;break;case"C":if(a=t/2>=G(u[0],u[1],h[1],h[2],h[3],h[4],h[5],h[6],n,r,i))return!0;break;case"A":c.cubicParams||(c.cubicParams=S(u[0],u[1],h[1],h[2],h[3],h[4],h[5],h[6],h[7],void 0));for(var p=c.cubicParams,f=u,v=0;p.length>v;v+=6){var y=G(f[0],f[1],p[v],p[v+1],p[v+2],p[v+3],p[v+4],p[v+5],n,r,i);if(f=[p[v+4],p[v+5]],a=t/2>=y)return!0}}}return a}(v,h+d,n.x,n.y,b)),P)}function oe(e,n,r){var i=e.parsedStyle,a=i.lineWidth,o=void 0===a?1:a,c=i.increasedLineWidthForHitTesting,l=void 0===c?0:c,h=i.points,u=i.pointerEvents,d=s(t.isFillOrStrokeAffected(void 0===u?"auto":u,i.fill,i.stroke),2),p=d[0],f=!1;return(d[1]||r)&&(f=J(h.points,o+l,n.x,n.y,!0)),f||!p&&!r||(f=ne(h.points,n.x,n.y)),f}function se(e,n,r){var i=e.parsedStyle,a=i.lineWidth,o=void 0===a?1:a,c=i.increasedLineWidthForHitTesting,l=void 0===c?0:c,h=i.points,u=i.pointerEvents;return!(!s(t.isFillOrStrokeAffected(void 0===u?"auto":u,i.fill,i.stroke),2)[1]&&!r||!o)&&J(h.points,o+l,n.x,n.y,!1)}function ce(e,n,r,i,a){var o=e.parsedStyle,c=o.radius,l=o.lineWidth,h=void 0===l?1:l,u=o.increasedLineWidthForHitTesting,d=void 0===u?0:u,f=o.x,v=void 0===f?0:f,y=o.y,g=void 0===y?0:y,m=o.width,E=o.height,x=o.pointerEvents,M=s(t.isFillOrStrokeAffected(void 0===x?"auto":x,o.fill,o.stroke),2),b=M[0],S=M[1],P=h+d;if(c&&c.some((function(e){return 0!==e}))){var T=!1;return(S||r)&&(T=function(e,t,n,r,i,a,o,c){var l=s(i,4),h=l[0],u=l[1],d=l[2],p=l[3];return Z(e+h,t,e+n-u,t,a,o,c)||Z(e+n,t+u,e+n,t+r-d,a,o,c)||Z(e+n-d,t+r,e+p,t+r,a,o,c)||Z(e,t+r-p,e,t+h,a,o,c)||V(e+n-u,t+u,u,0,0,a,o,c)||V(e+n-d,t+r-d,d,0,0,a,o,c)||V(e+p,t+r-p,p,0,0,a,o,c)||V(e+h,t+h,h,0,0,a,o,c)}(v,g,m,E,c.map((function(e){return p(e,0,Math.min(Math.abs(m)/2,Math.abs(E)/2))})),P,n.x,n.y)),T||!b&&!r||(T=i(e,n)),T}var C=P/2;return b&&S||r?X(v-C,g-C,m+C,E+C,n.x,n.y):b?X(v,g,m,E,n.x,n.y):!!S&&function(e,t,n,r,i,a,o){var s=i/2;return X(e-s,t-s,n,i,a,o)||X(e+n-s,t-s,i,r,a,o)||X(e+s,t+r-s,n,i,a,o)||X(e-s,t+s,i,r,a,o)}(v,g,m,E,P,n.x,n.y)}function le(e,n,r,a,o,s){var c=e.parsedStyle,l=c.pointerEvents,h=c.x,u=void 0===h?0:h,d=c.y,p=void 0===d?0:d,f=c.width,v=c.height;if("non-transparent-pixel"===(void 0===l?"auto":l)){var y=o.config.offscreenCanvas,g=s.offscreenCanvasCreator.getOrCreateCanvas(y),m=s.offscreenCanvasCreator.getOrCreateContext(y,{willReadFrequently:!0});return g.width=f,g.height=v,o.defaultStyleRendererFactory[t.Shape.IMAGE].render(m,i(i({},e.parsedStyle),{x:0,y:0}),e,void 0,void 0,void 0),m.getImageData(n.x-u,n.y-p,1,1).data.every((function(e){return 0!==e}))}return!0}function he(e,t,n,r){var i=e.getGeometryBounds();return!(i.min[0]>t.x||i.min[1]>t.y||t.x>i.max[0]||t.y>i.max[1])}var ue=function(e){function n(){var t=e.apply(this,c([],s(arguments),!1))||this;return t.name="canvas-picker",t}return r(n,e),n.prototype.init=function(){var e,n=((e={})[t.Shape.CIRCLE]=Y,e[t.Shape.ELLIPSE]=Q,e[t.Shape.RECT]=ce,e[t.Shape.LINE]=ie,e[t.Shape.POLYLINE]=se,e[t.Shape.POLYGON]=oe,e[t.Shape.PATH]=ae,e[t.Shape.TEXT]=he,e[t.Shape.GROUP]=null,e[t.Shape.IMAGE]=le,e[t.Shape.HTML]=null,e[t.Shape.MESH]=null,e);this.context.pointInPathPickerFactory=n,this.addRenderingPlugin(new z)},n.prototype.destroy=function(){delete this.context.pointInPathPickerFactory,this.removeAllRenderingPlugins()},n}(t.AbstractRendererPlugin),de=Object.freeze({__proto__:null,Plugin:ue}),pe=function(){function e(e){this.canvasRendererPluginOptions=e,this.removedRBushNodeAABBs=[],this.renderQueue=[],this.restoreStack=[],this.clearFullScreenLastFrame=!1,this.clearFullScreen=!1,this.vpMatrix=y(),this.dprMatrix=y(),this.tmpMat4=y(),this.vec3a=E(),this.vec3b=E(),this.vec3c=E(),this.vec3d=E()}return e.prototype.apply=function(n,r){var i=this;this.context=n;var a=n.config,o=n.camera,l=n.renderingService,h=n.renderingContext,u=n.pathGeneratorFactory;this.rBush=n.rBushRoot,this.pathGeneratorFactory=u;var d=n.contextService,p=h.root.ownerDocument.defaultView,f=function(e){var t=e.target.rBushNode;t.aabb&&i.removedRBushNodeAABBs.push(t.aabb)},v=function(e){var t=e.target.rBushNode;t.aabb&&i.removedRBushNodeAABBs.push(t.aabb)};l.hooks.init.tap(e.tag,(function(){p.addEventListener(t.ElementEvent.UNMOUNTED,f),p.addEventListener(t.ElementEvent.CULLED,v);var e=d.getDPR(),n=a.width,r=a.height,o=d.getContext();i.clearRect(o,0,0,n*e,r*e,a.background)})),l.hooks.destroy.tap(e.tag,(function(){p.removeEventListener(t.ElementEvent.UNMOUNTED,f),p.removeEventListener(t.ElementEvent.CULLED,v),i.renderQueue=[],i.removedRBushNodeAABBs=[],i.restoreStack=[]})),l.hooks.beginFrame.tap(e.tag,(function(){var e,t=d.getContext(),n=d.getDPR(),r=a.width,o=a.height,s=i.canvasRendererPluginOptions,c=s.dirtyObjectNumThreshold,h=s.dirtyObjectRatioThreshold,u=l.getStats(),f=u.rendered,v=f/u.total;i.clearFullScreen=i.clearFullScreenLastFrame||!(null===(e=p.context.renderingPlugins[1])||void 0===e?void 0:e.isFirstTimeRenderingFinished)||l.disableDirtyRectangleRendering()||f>c&&v>h,t&&(t.resetTransform?t.resetTransform():t.setTransform(1,0,0,1,0,0),i.clearFullScreen&&i.clearRect(t,0,0,r*n,o*n,a.background))}));var y=function(e,t){e.isVisible()&&!e.isCulled()&&i.renderDisplayObject(e,t,i.context,i.restoreStack,r),(e.sortable.sorted||e.childNodes).forEach((function(e){y(e,t)}))};l.hooks.endFrame.tap(e.tag,(function(){if(0!==h.root.childNodes.length){i.clearFullScreenLastFrame=!1;var e,n,l=d.getContext(),u=d.getDPR();if((e=i.dprMatrix)[0]=(n=[u,u,1])[0],e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=n[1],e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=n[2],e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,m(i.vpMatrix,i.dprMatrix,o.getOrthoMatrix()),i.clearFullScreen)y(h.root,l);else{var f=i.safeMergeAABB.apply(i,c([i.mergeDirtyAABBs(i.renderQueue)],s(i.removedRBushNodeAABBs.map((function(e){var n=e.minX,r=e.minY,i=e.maxX,a=e.maxY,o=new t.AABB;return o.setMinMax([n,r,0],[i,a,0]),o}))),!1));if(i.removedRBushNodeAABBs=[],t.AABB.isEmpty(f))return void(i.renderQueue=[]);var v=i.convertAABB2Rect(f),g=v.x,E=v.y,x=v.width,b=v.height,S=M(i.vec3a,[g,E,0],i.vpMatrix),P=M(i.vec3b,[g+x,E,0],i.vpMatrix),T=M(i.vec3c,[g,E+b,0],i.vpMatrix),C=M(i.vec3d,[g+x,E+b,0],i.vpMatrix),A=Math.min(S[0],P[0],C[0],T[0]),w=Math.min(S[1],P[1],C[1],T[1]),O=Math.max(S[0],P[0],C[0],T[0]),L=Math.max(S[1],P[1],C[1],T[1]),k=Math.floor(A),R=Math.floor(w),N=Math.ceil(O-A),I=Math.ceil(L-w);l.save(),i.clearRect(l,k,R,N,I,a.background),l.beginPath(),l.rect(k,R,N,I),l.clip(),l.setTransform(i.vpMatrix[0],i.vpMatrix[1],i.vpMatrix[4],i.vpMatrix[5],i.vpMatrix[12],i.vpMatrix[13]),a.renderer.getConfig().enableDirtyRectangleRenderingDebug&&p.dispatchEvent(new t.CustomEvent(t.CanvasEvent.DIRTY_RECTANGLE,{dirtyRect:{x:k,y:R,width:N,height:I}})),i.searchDirtyObjects(f).sort((function(e,t){return e.sortable.renderOrder-t.sortable.renderOrder})).forEach((function(e){e&&e.isVisible()&&!e.isCulled()&&i.renderDisplayObject(e,l,i.context,i.restoreStack,r)})),l.restore(),i.renderQueue.forEach((function(e){i.saveDirtyAABB(e)})),i.renderQueue=[]}i.restoreStack.forEach((function(){l.restore()})),i.restoreStack=[]}else i.clearFullScreenLastFrame=!0})),l.hooks.render.tap(e.tag,(function(e){i.clearFullScreen||i.renderQueue.push(e)}))},e.prototype.clearRect=function(e,t,n,r,i,a){e.clearRect(t,n,r,i),a&&(e.fillStyle=a,e.fillRect(t,n,r,i))},e.prototype.renderDisplayObject=function(e,n,r,i,a){var o=e.nodeName,s=i[i.length-1];!s||e.compareDocumentPosition(s)&t.Node.DOCUMENT_POSITION_CONTAINS||(n.restore(),i.pop());var c=this.context.styleRendererFactory[o],l=this.pathGeneratorFactory[o],h=e.parsedStyle.clipPath;if(h){this.applyWorldTransform(n,h);var u=this.pathGeneratorFactory[h.nodeName];u&&(n.save(),i.push(e),n.beginPath(),u(n,h.parsedStyle),n.closePath(),n.clip())}c&&(this.applyWorldTransform(n,e),n.save(),this.applyAttributesToContext(n,e)),l&&(n.beginPath(),l(n,e.parsedStyle),e.nodeName!==t.Shape.LINE&&e.nodeName!==t.Shape.PATH&&e.nodeName!==t.Shape.POLYLINE&&n.closePath()),c&&(c.render(n,e.parsedStyle,e,r,this,a),n.restore()),e.renderable.dirty=!1},e.prototype.convertAABB2Rect=function(e){var t=e.getMin(),n=e.getMax(),r=Math.floor(t[0]),i=Math.floor(t[1]);return{x:r,y:i,width:Math.ceil(n[0])-r,height:Math.ceil(n[1])-i}},e.prototype.mergeDirtyAABBs=function(e){var n=new t.AABB;return e.forEach((function(e){var t=e.getRenderBounds();n.add(t);var r=e.renderable.dirtyRenderBounds;r&&n.add(r)})),n},e.prototype.searchDirtyObjects=function(e){var t=s(e.getMin(),2),n=t[0],r=t[1],i=s(e.getMax(),2);return this.rBush.search({minX:n,minY:r,maxX:i[0],maxY:i[1]}).map((function(e){return e.displayObject}))},e.prototype.saveDirtyAABB=function(e){var n=e.renderable;n.dirtyRenderBounds||(n.dirtyRenderBounds=new t.AABB);var r=e.getRenderBounds();r&&n.dirtyRenderBounds.update(r.center,r.halfExtents)},e.prototype.applyAttributesToContext=function(e,t){var n=t.parsedStyle,r=n.stroke,i=n.fill,a=n.opacity,o=n.lineDash,s=n.lineDashOffset;o&&e.setLineDash(o),l(s)||(e.lineDashOffset=s),l(a)||(e.globalAlpha*=a),l(r)||Array.isArray(r)||r.isNone||(e.strokeStyle=t.attributes.stroke),l(i)||Array.isArray(i)||i.isNone||(e.fillStyle=t.attributes.fill)},e.prototype.applyWorldTransform=function(e,t,n){n?(g(this.tmpMat4,t.getLocalTransform()),m(this.tmpMat4,n,this.tmpMat4),m(this.tmpMat4,this.vpMatrix,this.tmpMat4)):(g(this.tmpMat4,t.getWorldTransform()),m(this.tmpMat4,this.vpMatrix,this.tmpMat4)),e.setTransform(this.tmpMat4[0],this.tmpMat4[1],this.tmpMat4[4],this.tmpMat4[5],this.tmpMat4[12],this.tmpMat4[13])},e.prototype.safeMergeAABB=function(){for(var e=[],n=0;arguments.length>n;n++)e[n]=arguments[n];var r=new t.AABB;return e.forEach((function(e){r.add(e)})),r},e.tag="CanvasRenderer",e}(),fe=function(){function e(e){this.imagePool=e}return e.prototype.render=function(e,n,r,i,a,o){var s=n.fill,c=n.fillRule,h=n.opacity,u=void 0===h?1:h,d=n.fillOpacity,p=void 0===d?1:d,f=n.stroke,v=n.strokeOpacity,y=void 0===v?1:v,g=n.lineWidth,m=void 0===g?1:g,E=n.lineCap,x=n.lineJoin,M=n.shadowType,b=n.shadowBlur,S=n.filter,P=n.miterLimit,T=s&&!s.isNone,C=f&&!f.isNone&&m>0,A=0===(null==s?void 0:s.alpha),w=!(!S||!S.length),O=!l(n.shadowColor)&&b>0,L=r.nodeName,k="inner"===M,R=C&&O&&(L===t.Shape.PATH||L===t.Shape.LINE||L===t.Shape.POLYLINE||A||k);T&&(e.globalAlpha=u*p,R||ve(r,e,O),me(e,r,s,c,i,a,o,this.imagePool),R||this.clearShadowAndFilter(e,w,O)),C&&(e.globalAlpha=u*y,e.lineWidth=m,l(P)||(e.miterLimit=P),l(E)||(e.lineCap=E),l(x)||(e.lineJoin=x),R&&(k&&(e.globalCompositeOperation="source-atop"),ve(r,e,!0),k&&(Ee(e,r,f,i,a,o,this.imagePool),e.globalCompositeOperation="source-over",this.clearShadowAndFilter(e,w,!0))),Ee(e,r,f,i,a,o,this.imagePool))},e.prototype.clearShadowAndFilter=function(e,t,n){if(n&&(e.shadowColor="transparent",e.shadowBlur=0),t){var r=e.filter;!l(r)&&r.indexOf("drop-shadow")>-1&&(e.filter=r.replace(/drop-shadow\([^)]*\)/,"").trim()||"none")}},e}();function ve(e,t,n){var r=e.parsedStyle,i=r.filter,a=r.shadowColor,o=r.shadowBlur,s=r.shadowOffsetX,c=r.shadowOffsetY;i&&i.length&&(t.filter=e.style.filter),n&&(t.shadowColor=""+a,t.shadowBlur=o||0,t.shadowOffsetX=s||0,t.shadowOffsetY=c||0)}function ye(e,t,n,r,i,a,o){var s,c;if("rect"===e.image.nodeName){var l=e.image.parsedStyle,h=l.width,u=l.height;c=r.contextService.getDPR();var d=r.config.offscreenCanvas;(s=a.offscreenCanvasCreator.getOrCreateCanvas(d)).width=h*c,s.height=u*c;var p=a.offscreenCanvasCreator.getOrCreateContext(d),f=[];e.image.forEach((function(e){i.renderDisplayObject(e,p,r,f,a)})),f.forEach((function(){p.restore()}))}return o.getOrCreatePatternSync(e,n,s,c,t.getGeometryBounds().min,(function(){t.renderable.dirty=!0,r.renderingService.dirtify()}))}function ge(e,n,r,a){var o;if(e.type===t.GradientType.LinearGradient||e.type===t.GradientType.RadialGradient){var s=n.getGeometryBounds(),c=s&&2*s.halfExtents[0]||1,l=s&&2*s.halfExtents[1]||1,h=s&&s.min||[0,0];o=a.getOrCreateGradient(i(i({type:e.type},e.value),{min:h,width:c,height:l}),r)}return o}function me(e,n,r,i,a,o,s,c,l){void 0===l&&(l=!1),Array.isArray(r)?r.forEach((function(t){e.fillStyle=ge(t,n,e,c),l||(i?e.fill(i):e.fill())})):(t.isPattern(r)&&(e.fillStyle=ye(r,n,e,a,o,s,c)),l||(i?e.fill(i):e.fill()))}function Ee(e,n,r,i,a,o,s,c){void 0===c&&(c=!1),Array.isArray(r)?r.forEach((function(t){e.strokeStyle=ge(t,n,e,s),c||e.stroke()})):(t.isPattern(r)&&(e.strokeStyle=ye(r,n,e,i,a,o,s)),c||e.stroke())}var xe=function(){function e(e){this.imagePool=e}return e.prototype.render=function(e,t,n){var r,i=t.x,a=void 0===i?0:i,o=t.y,s=void 0===o?0:o,c=t.src,h=t.shadowColor,u=t.shadowBlur,p=t.width,f=t.height;if(d(c)?r=this.imagePool.getImageSync(c):(p||(p=c.width),f||(f=c.height),r=c),r){ve(n,e,!l(h)&&u>0);try{e.drawImage(r,a,s,p,f)}catch(e){}}},e}(),Me=function(){function e(e){this.imagePool=e}return e.prototype.render=function(e,t,n,r,i,a){n.getBounds();var o=t.lineWidth,s=void 0===o?1:o,c=t.textAlign,h=void 0===c?"start":c,u=t.textBaseline,d=void 0===u?"alphabetic":u,p=t.lineJoin,f=void 0===p?"miter":p,v=t.miterLimit,y=void 0===v?10:v,g=t.letterSpacing,m=void 0===g?0:g,E=t.stroke,x=t.fill,M=t.fillRule,b=t.fillOpacity,S=void 0===b?1:b,P=t.strokeOpacity,T=void 0===P?1:P,C=t.opacity,A=void 0===C?1:C,w=t.metrics,O=t.x,L=void 0===O?0:O,k=t.y,R=void 0===k?0:k,N=t.dx,I=t.dy,B=t.shadowColor,D=t.shadowBlur,F=w.lines,G=w.height,j=w.lineHeight,_=w.lineMetrics;e.font=w.font,e.lineWidth=s,e.textAlign="middle"===h?"center":h;var H=d;"alphabetic"===H&&(H="bottom"),e.lineJoin=f,l(y)||(e.miterLimit=y);var $=R;"middle"===d?$+=-G/2-j/2:"bottom"===d||"alphabetic"===d||"ideographic"===d?$+=-G:"top"!==d&&"hanging"!==d||($+=-j);var W=L+(N||0);$+=I||0,1===F.length&&("bottom"===H?(H="middle",$-=.5*G):"top"===H&&(H="middle",$+=.5*G)),e.textBaseline=H,ve(n,e,!l(B)&&D>0);for(var U=0;F.length>U;U++){var z=s/2+W;$+=j,l(E)||E.isNone||!s||this.drawLetterSpacing(e,n,F[U],_[U],h,z,$,m,x,M,S,E,T,A,!0,r,i,a),l(x)||this.drawLetterSpacing(e,n,F[U],_[U],h,z,$,m,x,M,S,E,T,A,!1,r,i,a)}},e.prototype.drawLetterSpacing=function(e,t,n,r,i,a,o,s,c,l,h,u,d,p,f,v,y,g){if(0!==s){var m=e.textAlign;e.textAlign="left";var E=a;"center"===i||"middle"===i?E=a-r.width/2:"right"!==i&&"end"!==i||(E=a-r.width);for(var x=Array.from(n),M=e.measureText(n).width,b=0,S=0;x.length>S;++S){var P=x[S];f?this.strokeText(e,t,P,E,o,u,d,v,y,g):this.fillText(e,t,P,E,o,c,l,h,p,v,y,g),E+=M-(b=e.measureText(n.substring(S+1)).width)+s,M=b}e.textAlign=m}else f?this.strokeText(e,t,n,a,o,u,d,v,y,g):this.fillText(e,t,n,a,o,c,l,h,p,v,y,g)},e.prototype.fillText=function(e,t,n,r,i,a,o,s,c,h,u,d){var p;me(e,t,a,o,h,u,d,this.imagePool,!0);var f=!l(s)&&1!==s;f&&(p=e.globalAlpha,e.globalAlpha=s*c),e.fillText(n,r,i),f&&(e.globalAlpha=p)},e.prototype.strokeText=function(e,t,n,r,i,a,o,s,c,h){var u;Ee(e,t,a,s,c,h,this.imagePool,!0);var d=!l(o)&&1!==o;d&&(u=e.globalAlpha,e.globalAlpha=o),e.strokeText(n,r,i),d&&(e.globalAlpha=u)},e}(),be=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return r(t,e),t}(fe),Se=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return r(t,e),t}(fe),Pe=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return r(t,e),t}(fe),Te=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return r(t,e),t}(fe),Ce=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return r(t,e),t}(fe),Ae=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return r(t,e),t}(fe),we=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return r(t,e),t}(fe),Oe=function(e){function n(t){void 0===t&&(t={});var n=e.call(this)||this;return n.options=t,n.name="canvas-renderer",n}return r(n,e),n.prototype.init=function(){var e,n=i({dirtyObjectNumThreshold:500,dirtyObjectRatioThreshold:.8},this.options),r=this.context.imagePool,a=new fe(r),o=((e={})[t.Shape.CIRCLE]=a,e[t.Shape.ELLIPSE]=a,e[t.Shape.RECT]=a,e[t.Shape.IMAGE]=new xe(r),e[t.Shape.TEXT]=new Me(r),e[t.Shape.LINE]=a,e[t.Shape.POLYLINE]=a,e[t.Shape.POLYGON]=a,e[t.Shape.PATH]=a,e[t.Shape.GROUP]=void 0,e[t.Shape.HTML]=void 0,e[t.Shape.MESH]=void 0,e);this.context.defaultStyleRendererFactory=o,this.context.styleRendererFactory=o,this.addRenderingPlugin(new pe(n))},n.prototype.destroy=function(){this.removeAllRenderingPlugins(),delete this.context.defaultStyleRendererFactory,delete this.context.styleRendererFactory},n}(t.AbstractRendererPlugin),Le=Object.freeze({__proto__:null,CircleRenderer:Se,EllipseRenderer:Pe,ImageRenderer:xe,LineRenderer:Te,PathRenderer:we,Plugin:Oe,PolygonRenderer:Ae,PolylineRenderer:Ce,RectRenderer:be,TextRenderer:Me}),ke=function(){function e(){}return e.prototype.apply=function(t,n){var r=this,i=t.renderingService,a=t.renderingContext,o=t.config;this.context=t;var s=a.root.ownerDocument.defaultView,c=function(e){i.hooks.pointerMove.call(e)},l=function(e){i.hooks.pointerUp.call(e)},h=function(e){i.hooks.pointerDown.call(e)},u=function(e){i.hooks.pointerOver.call(e)},d=function(e){i.hooks.pointerOut.call(e)},p=function(e){i.hooks.pointerCancel.call(e)},f=function(e){i.hooks.pointerWheel.call(e)},v=function(e){i.hooks.click.call(e)};i.hooks.init.tap(e.tag,(function(){var e=r.context.contextService.getDomElement();n.globalThis.navigator.msPointerEnabled?(e.style.msContentZooming="none",e.style.msTouchAction="none"):s.supportsPointerEvents&&(e.style.touchAction="none"),s.supportsPointerEvents?function(e){n.globalThis.document.addEventListener("pointermove",c,!0),e.addEventListener("pointerdown",h,!0),e.addEventListener("pointerleave",d,!0),e.addEventListener("pointerover",u,!0),n.globalThis.addEventListener("pointerup",l,!0),n.globalThis.addEventListener("pointercancel",p,!0)}(e):function(e){n.globalThis.document.addEventListener("mousemove",c,!0),e.addEventListener("mousedown",h,!0),e.addEventListener("mouseout",d,!0),e.addEventListener("mouseover",u,!0),n.globalThis.addEventListener("mouseup",l,!0)}(e),s.supportsTouchEvents&&function(e){e.addEventListener("touchstart",h,!0),e.addEventListener("touchend",l,!0),e.addEventListener("touchmove",c,!0),e.addEventListener("touchcancel",p,!0)}(e),o.useNativeClickEvent&&e.addEventListener("click",v,!0),e.addEventListener("wheel",f,{passive:!0,capture:!0})})),i.hooks.destroy.tap(e.tag,(function(){var e=r.context.contextService.getDomElement();n.globalThis.navigator.msPointerEnabled?(e.style.msContentZooming="",e.style.msTouchAction=""):s.supportsPointerEvents&&(e.style.touchAction=""),s.supportsPointerEvents?function(e){n.globalThis.document.removeEventListener("pointermove",c,!0),e.removeEventListener("pointerdown",h,!0),e.removeEventListener("pointerleave",d,!0),e.removeEventListener("pointerover",u,!0),n.globalThis.removeEventListener("pointerup",l,!0),n.globalThis.removeEventListener("pointercancel",p,!0)}(e):function(e){n.globalThis.document.removeEventListener("mousemove",c,!0),e.removeEventListener("mousedown",h,!0),e.removeEventListener("mouseout",d,!0),e.removeEventListener("mouseover",u,!0),n.globalThis.removeEventListener("mouseup",l,!0)}(e),s.supportsTouchEvents&&function(e){e.removeEventListener("touchstart",h,!0),e.removeEventListener("touchend",l,!0),e.removeEventListener("touchmove",c,!0),e.removeEventListener("touchcancel",p,!0)}(e),o.useNativeClickEvent&&e.removeEventListener("click",v,!0),e.removeEventListener("wheel",f,!0)}))},e.tag="DOMInteraction",e}(),Re=function(e){function t(){var t=e.apply(this,c([],s(arguments),!1))||this;return t.name="dom-interaction",t}return r(t,e),t.prototype.init=function(){this.addRenderingPlugin(new ke)},t.prototype.destroy=function(){this.removeAllRenderingPlugins()},t}(t.AbstractRendererPlugin),Ne=Object.freeze({__proto__:null,Plugin:Re}),Ie=function(){function e(){this.displayObjectHTMLElementMap=new WeakMap}return e.prototype.joinTransformMatrix=function(e,t){return void 0===t&&(t=[0,0,0]),"matrix(".concat([e[0],e[1],e[4],e[5],e[12]+t[0],e[13]+t[1]].join(","),")")},e.prototype.apply=function(n,r){var i=this,a=n.camera,o=n.renderingContext,s=n.renderingService;this.context=n;var c=o.root.ownerDocument.defaultView,l=c.context.eventService.nativeHTMLMap,h=function(e,t){t.style.transform=i.joinTransformMatrix(e.getWorldTransform(),e.getOrigin())},u=function(e){var n=e.target;if(n.nodeName===t.Shape.HTML){i.$camera||(i.$camera=i.createCamera(a));var r=i.getOrCreateEl(n);i.$camera.appendChild(r),Object.keys(n.attributes).forEach((function(e){i.updateAttribute(e,n)})),h(n,r),l.set(r,n)}},d=function(e){var n=e.target;if(n.nodeName===t.Shape.HTML&&i.$camera){var r=i.getOrCreateEl(n);r&&(r.remove(),l.delete(r))}},p=function(e){var n=e.target;n.nodeName===t.Shape.HTML&&i.updateAttribute(e.attrName,n)},f=function(e){var n=e.target;(n.nodeName===t.Shape.FRAGMENT?n.childNodes:[n]).forEach((function(e){if(e.nodeName===t.Shape.HTML){var n=i.getOrCreateEl(e);h(e,n)}}))},v=function(){if(i.$camera){var e=i.context.config,t=e.height;i.$camera.parentElement.style.width="".concat(e.width||0,"px"),i.$camera.parentElement.style.height="".concat(t||0,"px")}};s.hooks.init.tap(e.tag,(function(){c.addEventListener(t.CanvasEvent.RESIZE,v),c.addEventListener(t.ElementEvent.MOUNTED,u),c.addEventListener(t.ElementEvent.UNMOUNTED,d),c.addEventListener(t.ElementEvent.ATTR_MODIFIED,p),c.addEventListener(t.ElementEvent.BOUNDS_CHANGED,f)})),s.hooks.endFrame.tap(e.tag,(function(){i.$camera&&o.renderReasons.has(t.RenderReason.CAMERA_CHANGED)&&(i.$camera.style.transform=i.joinTransformMatrix(a.getOrthoMatrix()))})),s.hooks.destroy.tap(e.tag,(function(){i.$camera&&i.$camera.remove(),c.removeEventListener(t.CanvasEvent.RESIZE,v),c.removeEventListener(t.ElementEvent.MOUNTED,u),c.removeEventListener(t.ElementEvent.UNMOUNTED,d),c.removeEventListener(t.ElementEvent.ATTR_MODIFIED,p),c.removeEventListener(t.ElementEvent.BOUNDS_CHANGED,f)}))},e.prototype.createCamera=function(e){var t=this.context.config,n=t.document,r=t.width,i=t.height,a=this.context.contextService.getDomElement(),o=a.parentNode;if(o){var s="g-canvas-camera",c=o.querySelector("#"+s);if(!c){var l=(n||document).createElement("div");l.style.overflow="hidden",l.style.pointerEvents="none",l.style.position="absolute",l.style.left="0px",l.style.top="0px",l.style.width="".concat(r||0,"px"),l.style.height="".concat(i||0,"px");var h=(n||document).createElement("div");c=h,h.id=s,h.style.position="absolute",h.style.left="".concat(a.offsetLeft||0,"px"),h.style.top="".concat(a.offsetTop||0,"px"),h.style.transformOrigin="left top",h.style.transform=this.joinTransformMatrix(e.getOrthoMatrix()),h.style.pointerEvents="none",h.style.width="100%",h.style.height="100%",l.appendChild(h),o.appendChild(l)}return c}return null},e.prototype.getOrCreateEl=function(e){var t=this.context.config.document,n=this.displayObjectHTMLElementMap.get(e);return n||(n=(t||document).createElement("div"),e.parsedStyle.$el=n,this.displayObjectHTMLElementMap.set(e,n),e.id&&(n.id=e.id),e.name&&n.setAttribute("name",e.name),e.className&&(n.className=e.className),n.style.position="absolute",n.style["will-change"]="transform",n.style.transform=this.joinTransformMatrix(e.getWorldTransform(),e.getOrigin())),n},e.prototype.updateAttribute=function(e,n){var r=this.getOrCreateEl(n);switch(e){case"innerHTML":var i=n.parsedStyle.innerHTML;d(i)?r.innerHTML=i:(r.innerHTML="",r.appendChild(i));break;case"x":r.style.left="".concat(n.parsedStyle.x,"px");break;case"y":r.style.top="".concat(n.parsedStyle.y,"px");break;case"transformOrigin":var a=n.parsedStyle.transformOrigin;r.style["transform-origin"]="".concat(a[0].buildCSSText(null,null,"")," ").concat(a[1].buildCSSText(null,null,""));break;case"width":var o=n.parsedStyle.width;r.style.width=f(o)?"".concat(o,"px"):""+o;break;case"height":var s=n.parsedStyle.height;r.style.height=f(s)?"".concat(s,"px"):""+s;break;case"zIndex":r.style["z-index"]="".concat(n.parsedStyle.zIndex);break;case"visibility":r.style.visibility=n.parsedStyle.visibility;break;case"pointerEvents":var c=n.parsedStyle.pointerEvents;r.style.pointerEvents=void 0===c?"auto":c;break;case"opacity":r.style.opacity="".concat(n.parsedStyle.opacity);break;case"fill":var h=n.parsedStyle.fill,u="";t.isCSSRGB(h)?u=h.isNone?"transparent":n.getAttribute("fill"):Array.isArray(h)?u=n.getAttribute("fill"):t.isPattern(h),r.style.background=u;break;case"stroke":var p=n.parsedStyle.stroke,v="";t.isCSSRGB(p)?v=p.isNone?"transparent":n.getAttribute("stroke"):Array.isArray(p)?v=n.getAttribute("stroke"):t.isPattern(p),r.style["border-color"]=v,r.style["border-style"]="solid";break;case"lineWidth":r.style["border-width"]="".concat(n.parsedStyle.lineWidth||0,"px");break;case"lineDash":r.style["border-style"]="dashed";break;case"filter":r.style.filter=n.style.filter;break;default:l(n.style[e])||""===n.style[e]||(r.style[e]=n.style[e])}},e.tag="HTMLRendering",e}(),Be=function(e){function t(){var t=e.apply(this,c([],s(arguments),!1))||this;return t.name="html-renderer",t}return r(t,e),t.prototype.init=function(){this.addRenderingPlugin(new Ie)},t.prototype.destroy=function(){this.removeAllRenderingPlugins()},t}(t.AbstractRendererPlugin),De=Object.freeze({__proto__:null,Plugin:Be}),Fe=function(){function e(e){this.canvasConfig=e,this.imageCache={},this.gradientCache={},this.patternCache={}}return e.prototype.getImageSync=function(e,t){return this.imageCache[e]?t&&t(this.imageCache[e]):this.getOrCreateImage(e).then((function(e){t&&t(e)})),this.imageCache[e]},e.prototype.getOrCreateImage=function(e){var n=this;if(this.imageCache[e])return Promise.resolve(this.imageCache[e]);var r=this.canvasConfig.createImage;return new Promise((function(i,a){var o;r?o=r(e):t.isBrowser&&(o=new window.Image),o&&(o.onload=function(){n.imageCache[e]=o,i(o)},o.onerror=function(e){a(e)},o.crossOrigin="Anonymous",o.src=e)}))},e.prototype.getOrCreatePatternSync=function(e,n,r,i,a,o){var s=this.generatePatternKey(e);if(s&&this.patternCache[s])return this.patternCache[s];var c,l=e.image,h=e.repetition,u=e.transform,p=!1;d(l)?c=this.getImageSync(l,o):r?(c=r,p=!0):c=l;var f,v=c&&n.createPattern(c,h);if(v){var g=void 0;u?g=t.parsedTransformToMat4(t.parseTransform(u),new t.DisplayObject({})):((f=y())[0]=1,f[1]=0,f[2]=0,f[3]=0,f[4]=0,f[5]=1,f[6]=0,f[7]=0,f[8]=0,f[9]=0,f[10]=1,f[11]=0,f[12]=0,f[13]=0,f[14]=0,f[15]=1,g=f),p&&function(e,t,n){var r=n[0],i=n[1],a=n[2];e[0]=t[0]*r,e[1]=t[1]*r,e[2]=t[2]*r,e[3]=t[3]*r,e[4]=t[4]*i,e[5]=t[5]*i,e[6]=t[6]*i,e[7]=t[7]*i,e[8]=t[8]*a,e[9]=t[9]*a,e[10]=t[10]*a,e[11]=t[11]*a,e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15]}(g,g,[1/i,1/i,1]),v.setTransform({a:g[0],b:g[1],c:g[4],d:g[5],e:g[12]+a[0],f:g[13]+a[1]})}return s&&v&&(this.patternCache[s]=v),v},e.prototype.getOrCreateGradient=function(e,n){var r=this.generateGradientKey(e),i=e.type,a=e.steps,o=e.min,s=e.width,c=e.height,l=e.cx,h=e.cy,u=e.size;if(this.gradientCache[r])return this.gradientCache[r];var d=null;if(i===t.GradientType.LinearGradient){var p=t.computeLinearGradient(o,s,c,e.angle);d=n.createLinearGradient(p.x1,p.y1,p.x2,p.y2)}else if(i===t.GradientType.RadialGradient){var f=t.computeRadialGradient(o,s,c,l,h,u),v=f.x,y=f.y;d=n.createRadialGradient(v,y,0,v,y,f.r)}return d&&(a.forEach((function(e){var n=e.offset;n.unit===t.UnitType.kPercentage&&(null==d||d.addColorStop(n.value/100,""+e.color))})),this.gradientCache[r]=d),this.gradientCache[r]},e.prototype.generateGradientKey=function(e){var t=e.min,n=e.width,r=e.height,i=e.steps,a=e.angle,o=e.cx,s=e.cy,c=e.size;return"gradient-".concat(e.type,"-").concat((null==a?void 0:""+a)||0,"-").concat((null==o?void 0:""+o)||0,"-").concat((null==s?void 0:""+s)||0,"-").concat((null==c?void 0:""+c)||0,"-").concat(t[0],"-").concat(t[1],"-").concat(n,"-").concat(r,"-").concat(i.map((function(e){var t=e.color;return"".concat(e.offset).concat(t)})).join("-"))},e.prototype.generatePatternKey=function(e){var t=e.image,n=e.repetition;return d(t)?"pattern-".concat(t,"-").concat(n):"rect"===t.nodeName?"pattern-".concat(t.entity,"-").concat(n):void 0},e}(),Ge=function(){function e(){}return e.prototype.apply=function(n){var r=n.renderingService,i=n.imagePool,a=n.renderingContext.root.ownerDocument.defaultView,o=function(e,t,n){var r=e.parsedStyle,i=r.width,a=r.height;i&&!a?e.setAttribute("height",n/t*i):!i&&a&&e.setAttribute("width",t/n*a)},s=function(e){var n=e.target,a=n.attributes;if(n.nodeName===t.Shape.IMAGE){var s=a.src,c=a.keepAspectRatio;d(s)&&i.getImageSync(s,(function(e){c&&o(n,e.width,e.height),n.renderable.dirty=!0,r.dirtify()}))}},c=function(e){var n=e.target,a=e.newValue;n.nodeName===t.Shape.IMAGE&&"src"===e.attrName&&d(a)&&i.getOrCreateImage(a).then((function(e){n.attributes.keepAspectRatio&&o(n,e.width,e.height),n.renderable.dirty=!0,r.dirtify()}))};r.hooks.init.tap(e.tag,(function(){a.addEventListener(t.ElementEvent.MOUNTED,s),a.addEventListener(t.ElementEvent.ATTR_MODIFIED,c)})),r.hooks.destroy.tap(e.tag,(function(){a.removeEventListener(t.ElementEvent.MOUNTED,s),a.removeEventListener(t.ElementEvent.ATTR_MODIFIED,c)}))},e.tag="LoadImage",e}(),je=function(e){function t(){var t=e.apply(this,c([],s(arguments),!1))||this;return t.name="image-loader",t}return r(t,e),t.prototype.init=function(){this.context.imagePool=new Fe(this.context.config),this.addRenderingPlugin(new Ge)},t.prototype.destroy=function(){this.removeAllRenderingPlugins()},t}(t.AbstractRendererPlugin),_e=Object.freeze({__proto__:null,ImagePool:Fe,Plugin:je}),He=function(){function e(e){this.renderingContext=e.renderingContext,this.canvasConfig=e.config}return e.prototype.init=function(){var e=this.canvasConfig,t=e.container,n=e.canvas;if(n)this.$canvas=n,t&&n.parentElement!==t&&t.appendChild(n),this.$container=n.parentElement,this.canvasConfig.container=this.$container;else if(t&&(this.$container=d(t)?document.getElementById(t):t,this.$container)){var r=document.createElement("canvas");this.$container.appendChild(r),this.$container.style.position||(this.$container.style.position="relative"),this.$canvas=r}this.context=this.$canvas.getContext("2d"),this.resize(this.canvasConfig.width,this.canvasConfig.height)},e.prototype.getContext=function(){return this.context},e.prototype.getDomElement=function(){return this.$canvas},e.prototype.getDPR=function(){return this.dpr},e.prototype.getBoundingClientRect=function(){if(this.$canvas.getBoundingClientRect)return this.$canvas.getBoundingClientRect()},e.prototype.destroy=function(){this.$container&&this.$canvas&&this.$canvas.parentNode&&this.$container.removeChild(this.$canvas)},e.prototype.resize=function(e,n){var r=this.canvasConfig.devicePixelRatio||t.isBrowser&&window.devicePixelRatio||1;this.dpr=r=1>r?1:Math.ceil(r),this.$canvas&&(this.$canvas.width=this.dpr*e,this.$canvas.height=this.dpr*n,t.setDOMSize(this.$canvas,e,n)),this.renderingContext.renderReasons.add(t.RenderReason.CAMERA_CHANGED)},e.prototype.applyCursorStyle=function(e){this.$container&&this.$container.style&&(this.$container.style.cursor=e)},e.prototype.toDataURL=function(){return a(this,arguments,void 0,(function(e){return void 0===e&&(e={}),o(this,(function(t){return[2,this.context.canvas.toDataURL(e.type,e.encoderOptions)]}))}))},e}(),$e=function(e){function t(){var t=e.apply(this,c([],s(arguments),!1))||this;return t.name="canvas-context-register",t}return r(t,e),t.prototype.init=function(){this.context.ContextService=He},t.prototype.destroy=function(){delete this.context.ContextService},t}(t.AbstractRendererPlugin),We=function(e){function t(t){var n=e.call(this,t)||this;return n.registerPlugin(new $e),n.registerPlugin(new je),n.registerPlugin(new k),n.registerPlugin(new Oe),n.registerPlugin(new Re),n.registerPlugin(new ue),n.registerPlugin(new Be),n}return r(t,e),t}(t.AbstractRenderer);e.CanvasPathGenerator=R,e.CanvasPicker=de,e.CanvasRenderer=Le,e.DomInteraction=Ne,e.HTMLRenderer=De,e.ImageLoader=_e,e.Renderer=We}));
1
+ /*!
2
+ * @antv/g-canvas
3
+ * @description A renderer implemented by Canvas 2D API
4
+ * @version 2.0.17
5
+ * @date 10/23/2024, 7:16:21 AM
6
+ * @author AntVis
7
+ * @docs https://g.antv.antgroup.com/
8
+ */
9
+ !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@antv/g-lite")):"function"==typeof define&&define.amd?define(["exports","@antv/g-lite"],t):t(((e="undefined"!=typeof globalThis?globalThis:e||self).G=e.G||{},e.G.Canvas2D={}),e.window.G)}(this,(function(e,t){"use strict";function r(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);t>r;r++)n[r]=e[r];return n}function n(e,t){if(e){if("string"==typeof e)return r(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?r(e,t):void 0}}function a(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,a,i,o,s=[],l=!0,c=!1;try{if(i=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;l=!1}else for(;!(l=(n=i.call(r)).done)&&(s.push(n.value),s.length!==t);l=!0);}catch(e){c=!0,a=e}finally{try{if(!l&&null!=r.return&&(o=r.return(),Object(o)!==o))return}finally{if(c)throw a}}return s}}(e,t)||n(e,t)||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.")}()}var i=function(e){return null==e},o={}.toString,s=function(e,t){return o.call(e)==="[object "+t+"]"},l=function(e){return s(e,"String")},c=function(e,t,r){return t>e?t:e>r?r:e},h=function(e){return s(e,"Number")},d="undefined"!=typeof Float32Array?Float32Array:Array;function u(){var e=new d(16);return d!=Float32Array&&(e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[11]=0,e[12]=0,e[13]=0,e[14]=0),e[0]=1,e[5]=1,e[10]=1,e[15]=1,e}function v(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[8]=t[8],e[9]=t[9],e[10]=t[10],e[11]=t[11],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15],e}function f(e,t,r){var n=t[0],a=t[1],i=t[2],o=t[3],s=t[4],l=t[5],c=t[6],h=t[7],d=t[8],u=t[9],v=t[10],f=t[11],p=t[12],m=t[13],g=t[14],y=t[15],x=r[0],b=r[1],E=r[2],M=r[3];return e[0]=x*n+b*s+E*d+M*p,e[1]=x*a+b*l+E*u+M*m,e[2]=x*i+b*c+E*v+M*g,e[3]=x*o+b*h+E*f+M*y,e[4]=(x=r[4])*n+(b=r[5])*s+(E=r[6])*d+(M=r[7])*p,e[5]=x*a+b*l+E*u+M*m,e[6]=x*i+b*c+E*v+M*g,e[7]=x*o+b*h+E*f+M*y,e[8]=(x=r[8])*n+(b=r[9])*s+(E=r[10])*d+(M=r[11])*p,e[9]=x*a+b*l+E*u+M*m,e[10]=x*i+b*c+E*v+M*g,e[11]=x*o+b*h+E*f+M*y,e[12]=(x=r[12])*n+(b=r[13])*s+(E=r[14])*d+(M=r[15])*p,e[13]=x*a+b*l+E*u+M*m,e[14]=x*i+b*c+E*v+M*g,e[15]=x*o+b*h+E*f+M*y,e}function p(){var e=new d(3);return d!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0),e}function m(e,t,r,n){return e[0]=t,e[1]=r,e[2]=n,e}function g(e,t,r){var n=t[0],a=t[1],i=t[2],o=r[3]*n+r[7]*a+r[11]*i+r[15];return e[0]=(r[0]*n+r[4]*a+r[8]*i+r[12])/(o=o||1),e[1]=(r[1]*n+r[5]*a+r[9]*i+r[13])/o,e[2]=(r[2]*n+r[6]*a+r[10]*i+r[14])/o,e}function y(e,t,r){return{x:e*Math.cos(r)-t*Math.sin(r),y:e*Math.sin(r)+t*Math.cos(r)}}function x(e,t,r,n,a,i,o,s,l,c){var h,d,u,v,f,p=e,m=t,g=r,b=n,E=s,M=l,w=120*Math.PI/180,S=Math.PI/180*(+a||0),P=[];if(c)d=c[0],u=c[1],v=c[2],f=c[3];else{m=(h=y(p,m,-S)).y;var T=((p=h.x)-(E=(h=y(E,M,-S)).x))/2,O=(m-(M=h.y))/2,A=T*T/(g*g)+O*O/(b*b);A>1&&(g*=A=Math.sqrt(A),b*=A);var L=g*g,C=b*b,k=(i===o?-1:1)*Math.sqrt(Math.abs((L*C-L*O*O-C*T*T)/(L*O*O+C*T*T)));v=k*g*O/b+(p+E)/2,d=Math.asin(((m-(f=k*-b*T/g+(m+M)/2))/b*1e9>>0)/1e9),u=Math.asin(((M-f)/b*1e9>>0)/1e9),0>(d=v>p?Math.PI-d:d)&&(d=2*Math.PI+d),0>(u=v>E?Math.PI-u:u)&&(u=2*Math.PI+u),o&&d>u&&(d-=2*Math.PI),!o&&u>d&&(u-=2*Math.PI)}var R=u-d;if(Math.abs(R)>w){var I=u,N=E,D=M;P=x(E=v+g*Math.cos(u=d+w*(o&&u>d?1:-1)),M=f+b*Math.sin(u),g,b,a,0,o,N,D,[u,I,v,f])}R=u-d;var B=Math.cos(d),F=Math.sin(d),j=Math.cos(u),G=Math.sin(u),_=Math.tan(R/4),H=4/3*g*_,z=4/3*b*_,$=[p,m],W=[p+H*F,m-z*B],U=[E+H*G,M-z*j],Y=[E,M];if(W[0]=2*$[0]-W[0],W[1]=2*$[1]-W[1],c)return W.concat(U,Y,P);for(var q=[],V=0,X=(P=W.concat(U,Y,P)).length;X>V;V+=1)q[V]=V%2?y(P[V-1],P[V],S).y:y(P[V],P[V+1],S).x;return q}
10
+ /*!
11
+ * @antv/g-plugin-canvas-path-generator
12
+ * @description A G plugin of path generator with Canvas2D API
13
+ * @version 2.0.12
14
+ * @date 10/23/2024, 7:13:41 AM
15
+ * @author AntVis
16
+ * @docs https://g.antv.antgroup.com/
17
+ */function b(e,t){var r=t.cx,n=t.cy;e.arc(void 0===r?0:r,void 0===n?0:n,t.r,0,2*Math.PI,!1)}function E(e,t){var r=t.cx,n=void 0===r?0:r,a=t.cy,i=void 0===a?0:a,o=t.rx,s=t.ry;if(e.ellipse)e.ellipse(n,i,o,s,0,0,2*Math.PI,!1);else{var l=o>s?o:s,c=o>s?1:o/s,h=o>s?s/o:1;e.save(),e.scale(c,h),e.arc(n,i,l,0,2*Math.PI)}}function M(e,r){var n=r.x1,a=r.y1,i=r.x2,o=r.y2,s=r.markerStart,l=r.markerEnd,c=r.markerStartOffset,h=r.markerEndOffset,d=0,u=0,v=0,f=0,p=0;s&&t.isDisplayObject(s)&&c&&(d=Math.cos(p=Math.atan2(o-a,i-n))*(c||0),u=Math.sin(p)*(c||0)),l&&t.isDisplayObject(l)&&h&&(v=Math.cos(p=Math.atan2(a-o,n-i))*(h||0),f=Math.sin(p)*(h||0)),e.moveTo(n+d,a+u),e.lineTo(i+v,o+f)}function w(e,r){var n=r.markerStart,i=r.markerEnd,o=r.markerStartOffset,s=r.markerEndOffset,l=r.d,c=l.absolutePath,h=l.segments,d=0,u=0,v=0,f=0,p=0;if(n&&t.isDisplayObject(n)&&o){var m=a(n.parentNode.getStartTangent(),2),g=m[0],y=m[1];d=Math.cos(p=Math.atan2(g[1]-y[1],g[0]-y[0]))*(o||0),u=Math.sin(p)*(o||0)}if(i&&t.isDisplayObject(i)&&s){var x=a(i.parentNode.getEndTangent(),2),b=x[0],E=x[1];v=Math.cos(p=Math.atan2(b[1]-E[1],b[0]-E[0]))*(s||0),f=Math.sin(p)*(s||0)}for(var M=0;c.length>M;M++){var w=c[M],S=c[M+1],P=0===M&&(0!==d||0!==u),T=(M===c.length-1||S&&("M"===S[0]||"Z"===S[0]))&&0!==v&&0!==f;switch(w[0]){case"M":P?e.moveTo(w[1]+d,w[2]+u):e.moveTo(w[1],w[2]);break;case"L":T?e.lineTo(w[1]+v,w[2]+f):e.lineTo(w[1],w[2]);break;case"Q":e.quadraticCurveTo(w[1],w[2],w[3],w[4]),T&&e.lineTo(w[3]+v,w[4]+f);break;case"C":e.bezierCurveTo(w[1],w[2],w[3],w[4],w[5],w[6]),T&&e.lineTo(w[5]+v,w[6]+f);break;case"A":var O=h[M].arcParams,A=O.cx,L=O.cy,C=O.rx,k=O.ry,R=O.startAngle,I=O.endAngle,N=O.xRotation,D=O.sweepFlag;if(e.ellipse)e.ellipse(A,L,C,k,N,R,I,!!(1-D));else{var B=C>k?C:k,F=C>k?1:C/k,j=C>k?k/C:1;e.translate(A,L),e.rotate(N),e.scale(F,j),e.arc(0,0,B,R,I,!!(1-D)),e.scale(1/F,1/j),e.rotate(-N),e.translate(-A,-L)}T&&e.lineTo(w[6]+v,w[7]+f);break;case"Z":e.closePath()}}}function S(e,r){var n=r.markerStart,a=r.markerEnd,i=r.markerStartOffset,o=r.markerEndOffset,s=r.points.points,l=s.length,c=s[0][0],h=s[0][1],d=s[l-1][0],u=s[l-1][1],v=0,f=0,p=0,m=0,g=0;n&&t.isDisplayObject(n)&&i&&(v=Math.cos(g=Math.atan2(s[1][1]-s[0][1],s[1][0]-s[0][0]))*(i||0),f=Math.sin(g)*(i||0)),a&&t.isDisplayObject(a)&&o&&(p=Math.cos(g=Math.atan2(s[l-1][1]-s[0][1],s[l-1][0]-s[0][0]))*(o||0),m=Math.sin(g)*(o||0)),e.moveTo(c+(v||p),h+(f||m));for(var y=1;l-1>y;y++){var x=s[y];e.lineTo(x[0],x[1])}e.lineTo(d,u)}function P(e,r){var n=r.markerStart,a=r.markerEnd,i=r.markerStartOffset,o=r.markerEndOffset,s=r.points.points,l=s.length,c=s[0][0],h=s[0][1],d=s[l-1][0],u=s[l-1][1],v=0,f=0,p=0,m=0,g=0;n&&t.isDisplayObject(n)&&i&&(v=Math.cos(g=Math.atan2(s[1][1]-s[0][1],s[1][0]-s[0][0]))*(i||0),f=Math.sin(g)*(i||0)),a&&t.isDisplayObject(a)&&o&&(p=Math.cos(g=Math.atan2(s[l-2][1]-s[l-1][1],s[l-2][0]-s[l-1][0]))*(o||0),m=Math.sin(g)*(o||0)),e.moveTo(c+v,h+f);for(var y=1;l-1>y;y++){var x=s[y];e.lineTo(x[0],x[1])}e.lineTo(d+p,u+m)}function T(e,t){var r=t.x,n=void 0===r?0:r,i=t.y,o=void 0===i?0:i,s=t.radius,l=t.width,h=t.height,d=l,u=h;if(s&&s.some((e=>0!==e))){var v=l>0?1:-1,f=h>0?1:-1,p=v+f===0,m=a(s.map((e=>c(e,0,Math.min(Math.abs(d)/2,Math.abs(u)/2)))),4),g=m[0],y=m[1],x=m[2],b=m[3];e.moveTo(v*g+n,o),e.lineTo(d-v*y+n,o),0!==y&&e.arc(d-v*y+n,f*y+o,y,-f*Math.PI/2,v>0?0:Math.PI,p),e.lineTo(d+n,u-f*x+o),0!==x&&e.arc(d-v*x+n,u-f*x+o,x,v>0?0:Math.PI,f>0?Math.PI/2:1.5*Math.PI,p),e.lineTo(v*b+n,u+o),0!==b&&e.arc(v*b+n,u-f*b+o,b,f>0?Math.PI/2:-Math.PI/2,v>0?Math.PI:0,p),e.lineTo(n,f*g+o),0!==g&&e.arc(v*g+n,f*g+o,g,v>0?Math.PI:0,f>0?1.5*Math.PI:Math.PI/2,p)}else e.rect(n,o,d,u)}Math.hypot||(Math.hypot=function(){for(var e=0,t=arguments.length;t--;)e+=arguments[t]*arguments[t];return Math.sqrt(e)}),p(),function(){var e,t=(e=new d(2),d!=Float32Array&&(e[0]=0,e[1]=0),e)}();let O=class extends t.AbstractRendererPlugin{constructor(){super(...arguments),this.name="canvas-path-generator"}init(){this.context.pathGeneratorFactory={[t.Shape.CIRCLE]:b,[t.Shape.ELLIPSE]:E,[t.Shape.RECT]:T,[t.Shape.LINE]:M,[t.Shape.POLYLINE]:P,[t.Shape.POLYGON]:S,[t.Shape.PATH]:w,[t.Shape.TEXT]:void 0,[t.Shape.GROUP]:void 0,[t.Shape.IMAGE]:void 0,[t.Shape.HTML]:void 0,[t.Shape.MESH]:void 0}}destroy(){delete this.context.pathGeneratorFactory}};var A=Object.freeze({__proto__:null,Plugin:O});function L(e){return L="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},L(e)}function C(){C=function(){return t};var e,t={},r=Object.prototype,n=r.hasOwnProperty,a=Object.defineProperty||function(e,t,r){e[t]=r.value},i="function"==typeof Symbol?Symbol:{},o=i.iterator||"@@iterator",s=i.asyncIterator||"@@asyncIterator",l=i.toStringTag||"@@toStringTag";function c(e,t,r){return Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{c({},"")}catch(e){c=function(e,t,r){return e[t]=r}}function h(e,t,r,n){var i=Object.create((t&&t.prototype instanceof g?t:g).prototype),o=new R(n||[]);return a(i,"_invoke",{value:T(e,r,o)}),i}function d(e,t,r){try{return{type:"normal",arg:e.call(t,r)}}catch(e){return{type:"throw",arg:e}}}t.wrap=h;var u="suspendedStart",v="suspendedYield",f="executing",p="completed",m={};function g(){}function y(){}function x(){}var b={};c(b,o,(function(){return this}));var E=Object.getPrototypeOf,M=E&&E(E(I([])));M&&M!==r&&n.call(M,o)&&(b=M);var w=x.prototype=g.prototype=Object.create(b);function S(e){["next","throw","return"].forEach((function(t){c(e,t,(function(e){return this._invoke(t,e)}))}))}function P(e,t){function r(a,i,o,s){var l=d(e[a],e,i);if("throw"!==l.type){var c=l.arg,h=c.value;return h&&"object"==L(h)&&n.call(h,"__await")?t.resolve(h.__await).then((function(e){r("next",e,o,s)}),(function(e){r("throw",e,o,s)})):t.resolve(h).then((function(e){c.value=e,o(c)}),(function(e){return r("throw",e,o,s)}))}s(l.arg)}var i;a(this,"_invoke",{value:function(e,n){function a(){return new t((function(t,a){r(e,n,t,a)}))}return i=i?i.then(a,a):a()}})}function T(t,r,n){var a=u;return function(i,o){if(a===f)throw Error("Generator is already running");if(a===p){if("throw"===i)throw o;return{value:e,done:!0}}for(n.method=i,n.arg=o;;){var s=n.delegate;if(s){var l=O(s,n);if(l){if(l===m)continue;return l}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(a===u)throw a=p,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);a=f;var c=d(t,r,n);if("normal"===c.type){if(a=n.done?p:v,c.arg===m)continue;return{value:c.arg,done:n.done}}"throw"===c.type&&(a=p,n.method="throw",n.arg=c.arg)}}}function O(t,r){var n=r.method,a=t.iterator[n];if(a===e)return r.delegate=null,"throw"===n&&t.iterator.return&&(r.method="return",r.arg=e,O(t,r),"throw"===r.method)||"return"!==n&&(r.method="throw",r.arg=new TypeError("The iterator does not provide a '"+n+"' method")),m;var i=d(a,t.iterator,r.arg);if("throw"===i.type)return r.method="throw",r.arg=i.arg,r.delegate=null,m;var o=i.arg;return o?o.done?(r[t.resultName]=o.value,r.next=t.nextLoc,"return"!==r.method&&(r.method="next",r.arg=e),r.delegate=null,m):o:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,m)}function A(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function k(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function R(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(A,this),this.reset(!0)}function I(t){if(t||""===t){var r=t[o];if(r)return r.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var a=-1,i=function r(){for(;++a<t.length;)if(n.call(t,a))return r.value=t[a],r.done=!1,r;return r.value=e,r.done=!0,r};return i.next=i}}throw new TypeError(L(t)+" is not iterable")}return y.prototype=x,a(w,"constructor",{value:x,configurable:!0}),a(x,"constructor",{value:y,configurable:!0}),y.displayName=c(x,l,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===y||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,x):(e.__proto__=x,c(e,l,"GeneratorFunction")),e.prototype=Object.create(w),e},t.awrap=function(e){return{__await:e}},S(P.prototype),c(P.prototype,s,(function(){return this})),t.AsyncIterator=P,t.async=function(e,r,n,a,i){void 0===i&&(i=Promise);var o=new P(h(e,r,n,a),i);return t.isGeneratorFunction(r)?o:o.next().then((function(e){return e.done?e.value:o.next()}))},S(w),c(w,l,"Generator"),c(w,o,(function(){return this})),c(w,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=Object(e),r=[];for(var n in t)r.push(n);return r.reverse(),function e(){for(;r.length;){var n=r.pop();if(n in t)return e.value=n,e.done=!1,e}return e.done=!0,e}},t.values=I,R.prototype={constructor:R,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(k),!t)for(var r in this)"t"===r.charAt(0)&&n.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=e)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var r=this;function a(n,a){return s.type="throw",s.arg=t,r.next=n,a&&(r.method="next",r.arg=e),!!a}for(var i=this.tryEntries.length-1;i>=0;--i){var o=this.tryEntries[i],s=o.completion;if("root"===o.tryLoc)return a("end");if(this.prev>=o.tryLoc){var l=n.call(o,"catchLoc"),c=n.call(o,"finallyLoc");if(l&&c){if(o.catchLoc>this.prev)return a(o.catchLoc,!0);if(o.finallyLoc>this.prev)return a(o.finallyLoc)}else if(l){if(o.catchLoc>this.prev)return a(o.catchLoc,!0)}else{if(!c)throw Error("try statement without catch or finally");if(o.finallyLoc>this.prev)return a(o.finallyLoc)}}}},abrupt:function(e,t){for(var r=this.tryEntries.length-1;r>=0;--r){var a=this.tryEntries[r];if(this.prev>=a.tryLoc&&n.call(a,"finallyLoc")&&a.finallyLoc>this.prev){var i=a;break}}i&&("break"===e||"continue"===e)&&t>=i.tryLoc&&i.finallyLoc>=t&&(i=null);var o=i?i.completion:{};return o.type=e,o.arg=t,i?(this.method="next",this.next=i.finallyLoc,m):this.complete(o)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),m},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),k(r),m}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.tryLoc===e){var n=r.completion;if("throw"===n.type){var a=n.arg;k(r)}return a}}throw Error("illegal catch attempt")},delegateYield:function(t,r,n){return this.delegate={iterator:I(t),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=e),m}},t}function k(e,t,r,n,a,i,o){try{var s=e[i](o),l=s.value}catch(e){return void r(e)}s.done?t(l):Promise.resolve(l).then(n,a)}function R(e){return function(){var t=this,r=arguments;return new Promise((function(n,a){var i=e.apply(t,r);function o(e){k(i,n,a,o,s,"next",e)}function s(e){k(i,n,a,o,s,"throw",e)}o(void 0)}))}}
18
+ /*!
19
+ * @antv/g-math
20
+ * @description Geometry util
21
+ * @version 3.0.0
22
+ * @date 10/23/2024, 7:12:37 AM
23
+ * @author AntVis
24
+ * @docs https://g.antv.antgroup.com/
25
+ */function I(e,t,r,n){var a=e-r,i=t-n;return Math.sqrt(a*a+i*i)}var N=1e-4;function D(e,t,r,n,a,i){var o=-1,s=1/0,l=[r,n],c=20;i&&i>200&&(c=i/10);for(var h=1/c,d=h/10,u=0;c>=u;u++){var v=u*h,f=[a(...e.concat([v])),a(...t.concat([v]))],p=I(l[0],l[1],f[0],f[1]);s>p&&(o=v,s=p)}if(0===o)return{x:e[0],y:t[0]};if(1===o){var m=e.length;return{x:e[m-1],y:t[m-1]}}s=1/0;for(var g=0;32>g&&N<=d;g++){var y=o-d,x=o+d,b=[a(...e.concat([y])),a(...t.concat([y]))],E=I(l[0],l[1],b[0],b[1]);if(y>=0&&s>E)o=y,s=E;else{var M=[a(...e.concat([x])),a(...t.concat([x]))],w=I(l[0],l[1],M[0],M[1]);1>=x&&s>w?(o=x,s=w):d*=.5}}return{x:a(...e.concat([o])),y:a(...t.concat([o]))}}function B(e,t,r,n,a,i){var o=[r-e,n-t];if(function(e,t){return e[0]===t[0]&&e[1]===t[1]}(o,[0,0]))return Math.sqrt((a-e)*(a-e)+(i-t)*(i-t));var s=[-o[1],o[0]];return function(e,t){var r=t[0],n=t[1],a=r*r+n*n;a>0&&(a=1/Math.sqrt(a)),e[0]=t[0]*a,e[1]=t[1]*a}(s,s),Math.abs(function(e,t){return e[0]*t[0]+e[1]*t[1]}([a-e,i-t],s))}function F(e,t,r,n,a){var i=1-a;return i*i*i*e+3*t*a*i*i+3*r*a*a*i+n*a*a*a}function j(e,t,r,n,a,i,o,s,l,c,h){var d=function(e,t,r,n,a,i,o,s,l,c,h){return D([e,r,a,o],[t,n,i,s],l,c,F,h)}(e,t,r,n,a,i,o,s,l,c,h);return I(d.x,d.y,l,c)}function G(e,t,r,n){var a=1-n;return a*a*e+2*n*a*t+n*n*r}function _(e,t,r,n,a,i,o,s){var l=function(e,t,r,n,a,i,o,s){return D([e,r,a],[t,n,i],o,s,G)}(e,t,r,n,a,i,o,s);return I(l.x,l.y,o,s)}function H(e){var t=function(e,t){if("object"!=L(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!=L(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==L(t)?t:t+""}function z(e,t,r){return(t=H(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function $(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function W(e){for(var t=1;arguments.length>t;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?$(Object(r),!0).forEach((function(t){z(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):$(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}
26
+ /*!
27
+ * @antv/g-plugin-canvas-picker
28
+ * @description A G plugin for picking in canvas
29
+ * @version 2.0.14
30
+ * @date 10/23/2024, 7:15:38 AM
31
+ * @author AntVis
32
+ * @docs https://g.antv.antgroup.com/
33
+ */var U=p(),Y=p(),q=p(),V=u();class X{constructor(){this.isHit=(e,r,n,a)=>{var i,o,s,l,c,h,d,u,v,f,p,y,x,b,E,M,w,S,P,T,O,A,L,C,k,R,I,N,D,B,F,j=this.context.pointInPathPickerFactory[e.nodeName];if(j){var G=(i=V,(F=(P=(s=(o=n)[0])*(u=o[5])-(l=o[1])*(d=o[4]))*(B=(x=o[10])*(S=o[15])-(b=o[11])*(w=o[14]))-(T=s*(v=o[6])-(c=o[2])*d)*(D=(y=o[9])*S-b*(M=o[13]))+(O=s*(f=o[7])-(h=o[3])*d)*(N=y*w-x*M)+(A=l*v-c*u)*(I=(p=o[8])*S-b*(E=o[12]))-(L=l*f-h*u)*(R=p*w-x*E)+(C=c*f-h*v)*(k=p*M-y*E))?(i[0]=(u*B-v*D+f*N)*(F=1/F),i[1]=(c*D-l*B-h*N)*F,i[2]=(M*C-w*L+S*A)*F,i[3]=(x*L-y*C-b*A)*F,i[4]=(v*I-d*B-f*R)*F,i[5]=(s*B-c*I+h*R)*F,i[6]=(w*O-E*C-S*T)*F,i[7]=(p*C-x*O+b*T)*F,i[8]=(d*D-u*I+f*k)*F,i[9]=(l*I-s*D-h*k)*F,i[10]=(E*L-M*O+S*P)*F,i[11]=(y*O-p*L-b*P)*F,i[12]=(u*R-d*N-v*k)*F,i[13]=(s*N-l*R+c*k)*F,i[14]=(M*T-E*A-w*P)*F,i[15]=(p*A-y*T+x*P)*F,i):null),_=g(Y,m(q,r[0],r[1],0),G);if(j(e,new t.Point(_[0],_[1]),a,this.isPointInPath,this.context,this.runtime))return!0}return!1},this.isPointInPath=(e,t)=>{var r=this.runtime.offscreenCanvasCreator.getOrCreateContext(this.context.config.offscreenCanvas),n=this.context.pathGeneratorFactory[e.nodeName];return n&&(r.beginPath(),n(r,e.parsedStyle),r.closePath()),r.isPointInPath(t.x,t.y)}}apply(e,t){var r,n=this,a=e.renderingService,i=e.renderingContext;this.context=e,this.runtime=t;var o=null===(r=i.root)||void 0===r?void 0:r.ownerDocument;a.hooks.pick.tapPromise(X.tag,function(){var e=R(C().mark((function e(t){return C().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",n.pick(o,t));case 1:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}()),a.hooks.pickSync.tap(X.tag,(e=>this.pick(o,e)))}pick(e,r){var a,i=r.topmost,o=r.position,s=m(U,o.x,o.y,0),l=[],c=function(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=n(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var a=0,i=function(){};return{s:i,n:function(){return e.length>a?{done:!1,value:e[a++]}:{done:!0}},e:function(e){throw e},f:i}}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 o,s=!0,l=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return s=e.done,e},e:function(e){l=!0,o=e},f:function(){try{s||null==r.return||r.return()}finally{if(l)throw o}}}}(e.elementsFromBBox(s[0],s[1],s[0],s[1]));try{for(c.s();!(a=c.n()).done;){var h=a.value,d=h.getWorldTransform();if(this.isHit(h,s,d,!1)){var u=t.findClosestClipPathTarget(h);if(u){var v=u.parsedStyle.clipPath;if(this.isHit(v,s,v.getWorldTransform(),!0)){if(i)return r.picked=[h],r;l.push(h)}}else{if(i)return r.picked=[h],r;l.push(h)}}}}catch(e){c.e(e)}finally{c.f()}return r.picked=l,r}}function Q(e,r,n){var i=e.parsedStyle,o=i.cx,s=i.cy,l=i.r,c=i.fill,h=i.stroke,d=i.lineWidth,u=i.increasedLineWidthForHitTesting,v=i.pointerEvents,f=void 0===v?"auto":v,p=((void 0===d?1:d)+(void 0===u?0:u))/2,m=I(void 0===o?0:o,void 0===s?0:s,r.x,r.y),g=a(t.isFillOrStrokeAffected(f,c,h),2),y=g[0],x=g[1];return y&&x||n?l+p>=m:y?l>=m:!!x&&(m>=l-p&&l+p>=m)}function Z(e,t,r,n){return e/(r*r)+t/(n*n)}function K(e,r,n){var i=e.parsedStyle,o=i.cx,s=void 0===o?0:o,l=i.cy,c=void 0===l?0:l,h=i.rx,d=i.ry,u=i.lineWidth,v=void 0===u?1:u,f=i.increasedLineWidthForHitTesting,p=void 0===f?0:f,m=i.pointerEvents,g=r.x,y=r.y,x=a(t.isFillOrStrokeAffected(void 0===m?"auto":m,i.fill,i.stroke),2),b=x[0],E=x[1],M=(v+p)/2,w=(g-s)*(g-s),S=(y-c)*(y-c);return b&&E||n?1>=Z(w,S,h+M,d+M):b?1>=Z(w,S,h,d):!!E&&(Z(w,S,h-M,d-M)>=1&&1>=Z(w,S,h+M,d+M))}function J(e,t,r,n,a,i){return!(e>a||a>e+r||t>i||i>t+n)}function ee(e,t,r,n,a,i,o,s){var l=(Math.atan2(s-t,o-e)+2*Math.PI)%(2*Math.PI),c={x:e+r*Math.cos(l),y:t+r*Math.sin(l)};return I(c.x,c.y,o,s)<=i/2}function te(e,t,r,n,a,i,o){var s=a/2;return!(Math.min(e,r)-s>i||i>Math.max(e,r)+s||Math.min(t,n)-s>o||o>Math.max(t,n)+s)&&B(e,t,r,n,i,o)<=a/2}function re(e,t,r,n,a){var i=e.length;if(2>i)return!1;for(var o=0;i-1>o;o++){if(te(e[o][0],e[o][1],e[o+1][0],e[o+1][1],t,r,n))return!0}if(a){var s=e[0],l=e[i-1];if(te(s[0],s[1],l[0],l[1],t,r,n))return!0}return!1}X.tag="CanvasPicker";var ne=1e-6;function ae(e){return ne>Math.abs(e)?0:0>e?-1:1}function ie(e,t,r){return!((r[0]-e[0])*(t[1]-e[1])!=(t[0]-e[0])*(r[1]-e[1])||Math.min(e[0],t[0])>r[0]||r[0]>Math.max(e[0],t[0])||Math.min(e[1],t[1])>r[1]||r[1]>Math.max(e[1],t[1]))}function oe(e,t,r){var n=!1,a=e.length;if(2>=a)return!1;for(var i=0;a>i;i++){var o=e[i],s=e[(i+1)%a];if(ie(o,s,[t,r]))return!0;ae(o[1]-r)>0!=ae(s[1]-r)>0&&0>ae(t-(r-o[1])*(o[0]-s[0])/(o[1]-s[1])-o[0])&&(n=!n)}return n}function se(e,t,r){for(var n=!1,a=0;e.length>a;a++){if(n=oe(e[a],t,r))break}return n}function le(e,r,n){var i=e.parsedStyle,o=i.x1,s=i.y1,l=i.x2,c=i.y2,h=i.lineWidth,d=void 0===h?1:h,u=i.increasedLineWidthForHitTesting,v=void 0===u?0:u,f=i.pointerEvents;return!(!a(t.isFillOrStrokeAffected(void 0===f?"auto":f,i.fill,i.stroke),2)[1]&&!n||!d)&&te(o,s,l,c,d+v,r.x,r.y)}function ce(e,r,n,i,o,s){var l=e.parsedStyle,c=l.lineWidth,h=void 0===c?1:c,d=l.increasedLineWidthForHitTesting,u=void 0===d?0:d,v=l.d,f=l.pointerEvents,p=v.segments,m=v.hasArc,g=v.polylines,y=v.polygons,b=a(t.isFillOrStrokeAffected(void 0===f?"auto":f,(null==y?void 0:y.length)&&l.fill,l.stroke),2),E=b[0],M=b[1],w=t.getOrCalculatePathTotalLength(e),S=!1;return E||n?S=m?i(e,r):se(y,r.x,r.y)||se(g,r.x,r.y):((M||n)&&(S=function(e,t,r,n,a){for(var i=!1,o=t/2,s=0;e.length>s;s++){var l=e[s],c=l.currentPoint,h=l.params,d=l.prePoint,u=l.box;if(!u||J(u.x-o,u.y-o,u.width+t,u.height+t,r,n))switch(l.command){case"L":case"Z":if(i=te(d[0],d[1],c[0],c[1],t,r,n))return!0;break;case"Q":if(i=t/2>=_(d[0],d[1],h[1],h[2],h[3],h[4],r,n))return!0;break;case"C":if(i=t/2>=j(d[0],d[1],h[1],h[2],h[3],h[4],h[5],h[6],r,n,a))return!0;break;case"A":l.cubicParams||(l.cubicParams=x(d[0],d[1],h[1],h[2],h[3],h[4],h[5],h[6],h[7],void 0));for(var v=l.cubicParams,f=d,p=0;v.length>p;p+=6){var m=j(f[0],f[1],v[p],v[p+1],v[p+2],v[p+3],v[p+4],v[p+5],r,n,a);if(f=[v[p+4],v[p+5]],i=t/2>=m)return!0}}}return i}(p,h+u,r.x,r.y,w)),S)}function he(e,r,n){var i=e.parsedStyle,o=i.lineWidth,s=void 0===o?1:o,l=i.increasedLineWidthForHitTesting,c=void 0===l?0:l,h=i.points,d=i.pointerEvents,u=a(t.isFillOrStrokeAffected(void 0===d?"auto":d,i.fill,i.stroke),2),v=u[0],f=!1;return(u[1]||n)&&(f=re(h.points,s+c,r.x,r.y,!0)),f||!v&&!n||(f=oe(h.points,r.x,r.y)),f}function de(e,r,n){var i=e.parsedStyle,o=i.lineWidth,s=void 0===o?1:o,l=i.increasedLineWidthForHitTesting,c=void 0===l?0:l,h=i.points,d=i.pointerEvents;return!(!a(t.isFillOrStrokeAffected(void 0===d?"auto":d,i.fill,i.stroke),2)[1]&&!n||!s)&&re(h.points,s+c,r.x,r.y,!1)}function ue(e,r,n,i,o){var s=e.parsedStyle,l=s.radius,h=s.lineWidth,d=void 0===h?1:h,u=s.increasedLineWidthForHitTesting,v=void 0===u?0:u,f=s.x,p=void 0===f?0:f,m=s.y,g=void 0===m?0:m,y=s.width,x=s.height,b=s.pointerEvents,E=a(t.isFillOrStrokeAffected(void 0===b?"auto":b,s.fill,s.stroke),2),M=E[0],w=E[1],S=d+v;if(l&&l.some((e=>0!==e))){var P=!1;return(w||n)&&(P=function(e,t,r,n,i,o,s,l){var c=a(i,4),h=c[0],d=c[1],u=c[2],v=c[3];return te(e+h,t,e+r-d,t,o,s,l)||te(e+r,t+d,e+r,t+n-u,o,s,l)||te(e+r-u,t+n,e+v,t+n,o,s,l)||te(e,t+n-v,e,t+h,o,s,l)||ee(e+r-d,t+d,d,0,0,o,s,l)||ee(e+r-u,t+n-u,u,0,0,o,s,l)||ee(e+v,t+n-v,v,0,0,o,s,l)||ee(e+h,t+h,h,0,0,o,s,l)}(p,g,y,x,l.map((e=>c(e,0,Math.min(Math.abs(y)/2,Math.abs(x)/2)))),S,r.x,r.y)),P||!M&&!n||(P=i(e,r)),P}var T=S/2;return M&&w||n?J(p-T,g-T,y+T,x+T,r.x,r.y):M?J(p,g,y,x,r.x,r.y):!!w&&function(e,t,r,n,a,i,o){var s=a/2;return J(e-s,t-s,r,a,i,o)||J(e+r-s,t-s,a,n,i,o)||J(e+s,t+n-s,r,a,i,o)||J(e-s,t+s,a,n,i,o)}(p,g,y,x,S,r.x,r.y)}function ve(e,r,n,a,i,o){var s=e.parsedStyle,l=s.pointerEvents,c=s.x,h=void 0===c?0:c,d=s.y,u=void 0===d?0:d,v=s.width,f=s.height;if("non-transparent-pixel"===(void 0===l?"auto":l)){var p=i.config.offscreenCanvas,m=o.offscreenCanvasCreator.getOrCreateCanvas(p),g=o.offscreenCanvasCreator.getOrCreateContext(p,{willReadFrequently:!0});return m.width=v,m.height=f,i.defaultStyleRendererFactory[t.Shape.IMAGE].render(g,W(W({},e.parsedStyle),{},{x:0,y:0}),e,void 0,void 0,void 0),g.getImageData(r.x-h,r.y-u,1,1).data.every((e=>0!==e))}return!0}function fe(e,t,r,n){var a=e.getGeometryBounds();return!(a.min[0]>t.x||a.min[1]>t.y||t.x>a.max[0]||t.y>a.max[1])}let pe=class extends t.AbstractRendererPlugin{constructor(){super(...arguments),this.name="canvas-picker"}init(){this.context.pointInPathPickerFactory={[t.Shape.CIRCLE]:Q,[t.Shape.ELLIPSE]:K,[t.Shape.RECT]:ue,[t.Shape.LINE]:le,[t.Shape.POLYLINE]:de,[t.Shape.POLYGON]:he,[t.Shape.PATH]:ce,[t.Shape.TEXT]:fe,[t.Shape.GROUP]:null,[t.Shape.IMAGE]:ve,[t.Shape.HTML]:null,[t.Shape.MESH]:null},this.addRenderingPlugin(new X)}destroy(){delete this.context.pointInPathPickerFactory,this.removeAllRenderingPlugins()}};var me=Object.freeze({__proto__:null,Plugin:pe});function ge(e,t){if(!{}.hasOwnProperty.call(e,t))throw new TypeError("attempted to use private field on non-instance");return e}var ye=0;function xe(e){return"__private_"+ye+++"_"+e}
34
+ /*!
35
+ * @antv/g-plugin-image-loader
36
+ * @description A G plugin for loading image
37
+ * @version 2.0.12
38
+ * @date 10/23/2024, 7:14:07 AM
39
+ * @author AntVis
40
+ * @docs https://g.antv.antgroup.com/
41
+ */var be=xe("cacheStore");var Ee=[],Me=[];class we{static stop(){we.rafId&&((arguments.length>0&&void 0!==arguments[0]?arguments[0]:we.api).cancelAnimationFrame(we.rafId),we.rafId=null)}static executeTask(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:we.api;(Ee.length>0||Me.length>0)&&(Me.forEach((e=>e())),Me=Ee.splice(0,we.TASK_NUM_PER_FRAME),we.rafId=e.requestAnimationFrame((()=>{we.executeTask(e)})))}static sliceImage(e,t,r){for(var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,a=arguments.length>4&&void 0!==arguments[4]?arguments[4]:we.api,i=e.naturalWidth||e.width,o=e.naturalHeight||e.height,s=t-n,l=r-n,c=Math.ceil(i/s),h=Math.ceil(o/l),d={tileSize:[t,r],gridSize:[h,c],tiles:Array(h).fill(null).map((()=>Array(c).fill(null)))},u=function(n){for(var h=function(c){Ee.push((()=>{var h=c*s,u=n*l,v=[Math.min(t,i-h),Math.min(r,o-u)],f=v[0],p=v[1],m=a.createCanvas();m.width=t,m.height=r,m.getContext("2d").drawImage(e,h,u,f,p,0,0,f,p),d.tiles[n][c]={x:h,y:u,tileX:c,tileY:n,data:m}}))},u=0;c>u;u++)h(u)},v=0;h>v;v++)u(v);return we.stop(),we.executeTask(),d}}we.TASK_NUM_PER_FRAME=10;var Se=new class{constructor(){Object.defineProperty(this,be,{writable:!0,value:new Map})}has(e){return ge(this,be)[be].has(e)}put(e,t,r){return!ge(this,be)[be].has(e)&&(ge(this,be)[be].set(e,{value:t,counter:new Set([r])}),!0)}get(e,t){var r=ge(this,be)[be].get(e);return r?(r.counter.add(t),r.value):null}update(e,t,r){var n=ge(this,be)[be].get(e);return!!n&&(n.value=W(W({},n.value),t),n.counter.add(r),!0)}release(e,t){var r=ge(this,be)[be].get(e);return!!r&&(r.counter.delete(t),r.counter.size>0||ge(this,be)[be].delete(e),!0)}releaseRef(e){ge(this,be)[be].keys().forEach((t=>{this.release(t,e)}))}getSize(){return ge(this,be)[be].size}clear(){ge(this,be)[be].clear()}};class Pe{constructor(e,t){this.imageCache={},this.gradientCache={},this.patternCache={},this.context=e,this.runtime=t}getImageSync(e,t,r){var n=l(e)?e:e.src;if(Se.has(n)){var a=Se.get(n,t);if(a.img.complete)return null==r||r(a),a}return this.getOrCreateImage(e,t).then((e=>{null==r||r(e)})).catch((()=>{})),null}getOrCreateImage(e,r){var n=l(e)?e:e.src;if(!l(e)&&!Se.has(n)){var a={img:e,size:[e.naturalWidth||e.width,e.naturalHeight||e.height],tileSize:Te(e)};Se.put(n,a,r)}if(Se.has(n)){var i=Se.get(n,r);return i.img.complete?Promise.resolve(i):new Promise(((e,t)=>{i.img.addEventListener("load",(()=>{i.tileSize=Te(i.img),e(i)})),i.img.addEventListener("error",(e=>{t(e)}))}))}var o=this.context.config.createImage;return new Promise(((e,a)=>{var i;if(o?i=o(n):t.isBrowser&&(i=new window.Image),i){var s={img:i,size:[0,0],tileSize:Te(i)};Se.put(n,s,r),i.onload=()=>{s.size=[i.naturalWidth||i.width,i.naturalHeight||i.height],s.tileSize=Te(s.img),e(s)},i.onerror=e=>{a(e)},i.crossOrigin="Anonymous",i.src=n}}))}createDownSampledImage(e,t){var r=this;return R(C().mark((function n(){var i,o,s,l,c,h,d,u,v,f,p,m,g,y;return C().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return n.next=2,r.getOrCreateImage(e,t);case 2:if(void 0===(i=n.sent).downSamplingRate){n.next=5;break}return n.abrupt("return",i);case 5:if(c=void 0===(l=(s="boolean"==typeof(o=r.context.config.enableLargeImageOptimization)?{}:o).maxDownSampledImageSize)?2048:l,d=void 0===(h=s.downSamplingRateThreshold)?.5:h,u=r.runtime.globalThis.createImageBitmap,v=a(i.size,2),m=i.img,g=Math.min((c+c)/((f=v[0])+(p=v[1])),Math.max(.01,Math.min(d,.5))),y=W(W({},i),{},{downSamplingRate:g}),Se.update(i.img.src,y,t),!u){n.next=25;break}return n.prev=14,n.next=17,u(i.img,{resizeWidth:f*g,resizeHeight:p*g});case 17:m=n.sent,n.next=23;break;case 20:n.prev=20,n.t0=n.catch(14),g=1;case 23:n.next=26;break;case 25:g=1;case 26:return y=W(W({},r.getImageSync(e,t)),{},{downSampled:m,downSamplingRate:g}),Se.update(i.img.src,y,t),n.abrupt("return",y);case 29:case"end":return n.stop()}}),n,null,[[14,20]])})))()}createImageTiles(e,r,n){var a=this;return R(C().mark((function r(){var i,o,s;return C().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return r.next=2,a.getOrCreateImage(e,n);case 2:return i=r.sent,we.api={requestAnimationFrame:(o=n.ownerDocument.defaultView).requestAnimationFrame,cancelAnimationFrame:o.cancelAnimationFrame,createCanvas:()=>t.OffscreenCanvasCreator.createCanvas()},s=W(W({},i),we.sliceImage(i.img,i.tileSize[0],i.tileSize[0])),Se.update(i.img.src,s,n),r.abrupt("return",s);case 8:case"end":return r.stop()}}),r)})))()}releaseImage(e,t){Se.release(l(e)?e:e.src,t)}releaseImageRef(e){Se.releaseRef(e)}getOrCreatePatternSync(e,r,n,a,i,o,s){var c=this.generatePatternKey(r);if(c&&this.patternCache[c])return this.patternCache[c];var h,d=r.image,v=r.repetition,f=r.transform,p=!1;if(l(d)){var m=this.getImageSync(d,e,s);h=null==m?void 0:m.img}else a?(h=a,p=!0):h=d;var g,y,x=h&&n.createPattern(h,v);x&&(f?g=t.parsedTransformToMat4(t.parseTransform(f),new t.DisplayObject({})):((y=u())[0]=1,y[1]=0,y[2]=0,y[3]=0,y[4]=0,y[5]=1,y[6]=0,y[7]=0,y[8]=0,y[9]=0,y[10]=1,y[11]=0,y[12]=0,y[13]=0,y[14]=0,y[15]=1,g=y),p&&function(e,t,r){var n=r[0],a=r[1],i=r[2];e[0]=t[0]*n,e[1]=t[1]*n,e[2]=t[2]*n,e[3]=t[3]*n,e[4]=t[4]*a,e[5]=t[5]*a,e[6]=t[6]*a,e[7]=t[7]*a,e[8]=t[8]*i,e[9]=t[9]*i,e[10]=t[10]*i,e[11]=t[11]*i,e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15]}(g,g,[1/i,1/i,1]),x.setTransform({a:g[0],b:g[1],c:g[4],d:g[5],e:g[12]+o[0],f:g[13]+o[1]}));return c&&x&&(this.patternCache[c]=x),x}getOrCreateGradient(e,r){var n=this.generateGradientKey(e),a=e.type,i=e.steps,o=e.min,s=e.width,l=e.height,c=e.cx,h=e.cy,d=e.size;if(this.gradientCache[n])return this.gradientCache[n];var u=null;if(a===t.GradientType.LinearGradient){var v=t.computeLinearGradient(o,s,l,e.angle);u=r.createLinearGradient(v.x1,v.y1,v.x2,v.y2)}else if(a===t.GradientType.RadialGradient){var f=t.computeRadialGradient(o,s,l,c,h,d),p=f.x,m=f.y;u=r.createRadialGradient(p,m,0,p,m,f.r)}return u&&(i.forEach((e=>{var r,n=e.offset;n.unit===t.UnitType.kPercentage&&(null===(r=u)||void 0===r||r.addColorStop(n.value/100,""+e.color))})),this.gradientCache[n]=u),this.gradientCache[n]}generateGradientKey(e){var t=e.min,r=e.width,n=e.height,a=e.steps,i=e.angle,o=e.cx,s=e.cy,l=e.size;return"gradient-".concat(e.type,"-").concat((null==i?void 0:""+i)||0,"-").concat((null==o?void 0:""+o)||0,"-").concat((null==s?void 0:""+s)||0,"-").concat((null==l?void 0:""+l)||0,"-").concat(t[0],"-").concat(t[1],"-").concat(r,"-").concat(n,"-").concat(a.map((e=>{var t=e.color;return"".concat(e.offset).concat(t)})).join("-"))}generatePatternKey(e){var t=e.image,r=e.repetition;return l(t)?"pattern-".concat(t,"-").concat(r):"rect"===t.nodeName?"pattern-".concat(t.entity,"-").concat(r):void 0}}function Te(e){if(!e.complete)return[0,0];var t=e.naturalWidth||e.width,r=e.naturalHeight||e.height,n=256;return[256,512].forEach((e=>{1e3>Math.ceil(r/e)*Math.ceil(t/e)&&(n=e)})),[n,n]}Pe.isSupportTile=!!t.OffscreenCanvasCreator.createCanvas();class Oe{apply(e){var r=e.renderingService,n=e.imagePool,a=e.renderingContext.root.ownerDocument.defaultView,i=(e,t,r)=>{var n=e.parsedStyle,a=n.width,i=n.height;a&&!i?e.setAttribute("height",r/t*a):!a&&i&&e.setAttribute("width",t/r*i)},o=e=>{var a=e.target,o=a.attributes;if(a.nodeName===t.Shape.IMAGE){var s=o.src,c=o.keepAspectRatio;l(s)&&n.getImageSync(s,a,(e=>{var t=e.img;c&&i(a,t.width,t.height),a.renderable.dirty=!0,r.dirtify()}))}},s=e=>{var a=e.target,o=e.prevValue,s=e.newValue;a.nodeName===t.Shape.IMAGE&&"src"===e.attrName&&(o!==s&&n.releaseImage(o,a),l(s)&&n.getOrCreateImage(s,a).then((e=>{var t=e.img;a.attributes.keepAspectRatio&&i(a,t.width,t.height),a.renderable.dirty=!0,r.dirtify()})).catch((()=>{})))};function c(e){var r=e.target;r.nodeName===t.Shape.IMAGE&&n.releaseImageRef(r)}r.hooks.init.tap(Oe.tag,(()=>{a.addEventListener(t.ElementEvent.MOUNTED,o),a.addEventListener(t.ElementEvent.ATTR_MODIFIED,s),a.addEventListener(t.ElementEvent.DESTROY,c)})),r.hooks.destroy.tap(Oe.tag,(()=>{a.removeEventListener(t.ElementEvent.MOUNTED,o),a.removeEventListener(t.ElementEvent.ATTR_MODIFIED,s),a.removeEventListener(t.ElementEvent.DESTROY,c)}))}}Oe.tag="LoadImage";let Ae=class extends t.AbstractRendererPlugin{constructor(){super(...arguments),this.name="image-loader"}init(e){this.context.imagePool=new Pe(this.context,e),this.addRenderingPlugin(new Oe)}destroy(){this.removeAllRenderingPlugins()}};var Le=Object.freeze({__proto__:null,ImagePool:Pe,Plugin:Ae});
42
+ /*!
43
+ * @antv/g-plugin-canvas-renderer
44
+ * @description A G plugin of renderer implementation with Canvas2D API
45
+ * @version 2.1.1
46
+ * @date 10/23/2024, 7:14:51 AM
47
+ * @author AntVis
48
+ * @docs https://g.antv.antgroup.com/
49
+ */class Ce{constructor(e){this.removedRBushNodeAABBs=[],this.renderQueue=[],this.restoreStack=[],this.clearFullScreenLastFrame=!1,this.clearFullScreen=!1,this.vpMatrix=u(),this.dprMatrix=u(),this.tmpMat4=u(),this.vec3a=p(),this.vec3b=p(),this.vec3c=p(),this.vec3d=p(),this.canvasRendererPluginOptions=e}apply(e,r){this.context=e;var n=e.config,a=e.camera,i=e.renderingService,o=e.renderingContext,s=e.pathGeneratorFactory;this.rBush=e.rBushRoot,this.pathGeneratorFactory=s;var l=e.contextService,c=o.root.ownerDocument.defaultView,h=e=>{var t=e.target.rBushNode;t.aabb&&this.removedRBushNodeAABBs.push(t.aabb)},d=e=>{var t=e.target.rBushNode;t.aabb&&this.removedRBushNodeAABBs.push(t.aabb)};i.hooks.init.tap(Ce.tag,(()=>{c.addEventListener(t.ElementEvent.UNMOUNTED,h),c.addEventListener(t.ElementEvent.CULLED,d);var e=l.getDPR(),r=n.width,a=n.height,i=l.getContext();this.clearRect(i,0,0,r*e,a*e,n.background)})),i.hooks.destroy.tap(Ce.tag,(()=>{c.removeEventListener(t.ElementEvent.UNMOUNTED,h),c.removeEventListener(t.ElementEvent.CULLED,d),this.renderQueue=[],this.removedRBushNodeAABBs=[],this.restoreStack=[]})),i.hooks.beginFrame.tap(Ce.tag,(()=>{var e,t=l.getContext(),r=l.getDPR(),a=n.width,o=n.height,s=this.canvasRendererPluginOptions,h=s.dirtyObjectNumThreshold,d=s.dirtyObjectRatioThreshold,u=i.getStats(),v=u.rendered,f=v/u.total;this.clearFullScreen=this.clearFullScreenLastFrame||!(null!==(e=c.context.renderingPlugins[1])&&void 0!==e&&e.isFirstTimeRenderingFinished)||i.disableDirtyRectangleRendering()||v>h&&f>d,t&&(t.resetTransform?t.resetTransform():t.setTransform(1,0,0,1,0,0),this.clearFullScreen&&this.clearRect(t,0,0,a*r,o*r,n.background))}));var u=(e,t)=>{e.isVisible()&&!e.isCulled()&&this.renderDisplayObject(e,t,this.context,this.restoreStack,r),(e.sortable.sorted||e.childNodes).forEach((e=>{u(e,t)}))};i.hooks.endFrame.tap(Ce.tag,(()=>{if(0!==o.root.childNodes.length){this.clearFullScreenLastFrame=!1;var e,i,s=l.getContext(),h=l.getDPR();if((e=this.dprMatrix)[0]=(i=[h,h,1])[0],e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=i[1],e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=i[2],e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,f(this.vpMatrix,this.dprMatrix,a.getOrthoMatrix()),this.clearFullScreen)u(o.root,s);else{var d=this.safeMergeAABB(this.mergeDirtyAABBs(this.renderQueue),...this.removedRBushNodeAABBs.map((e=>{var r=e.minX,n=e.minY,a=e.maxX,i=e.maxY,o=new t.AABB;return o.setMinMax([r,n,0],[a,i,0]),o})));if(this.removedRBushNodeAABBs=[],t.AABB.isEmpty(d))return void(this.renderQueue=[]);var v=this.convertAABB2Rect(d),p=v.x,m=v.y,y=v.width,x=v.height,b=g(this.vec3a,[p,m,0],this.vpMatrix),E=g(this.vec3b,[p+y,m,0],this.vpMatrix),M=g(this.vec3c,[p,m+x,0],this.vpMatrix),w=g(this.vec3d,[p+y,m+x,0],this.vpMatrix),S=Math.min(b[0],E[0],w[0],M[0]),P=Math.min(b[1],E[1],w[1],M[1]),T=Math.max(b[0],E[0],w[0],M[0]),O=Math.max(b[1],E[1],w[1],M[1]),A=Math.floor(S),L=Math.floor(P),C=Math.ceil(T-S),k=Math.ceil(O-P);s.save(),this.clearRect(s,A,L,C,k,n.background),s.beginPath(),s.rect(A,L,C,k),s.clip(),s.setTransform(this.vpMatrix[0],this.vpMatrix[1],this.vpMatrix[4],this.vpMatrix[5],this.vpMatrix[12],this.vpMatrix[13]),n.renderer.getConfig().enableDirtyRectangleRenderingDebug&&c.dispatchEvent(new t.CustomEvent(t.CanvasEvent.DIRTY_RECTANGLE,{dirtyRect:{x:A,y:L,width:C,height:k}})),this.searchDirtyObjects(d).sort(((e,t)=>e.sortable.renderOrder-t.sortable.renderOrder)).forEach((e=>{e&&e.isVisible()&&!e.isCulled()&&this.renderDisplayObject(e,s,this.context,this.restoreStack,r)})),s.restore(),this.renderQueue.forEach((e=>{this.saveDirtyAABB(e)})),this.renderQueue=[]}this.restoreStack.forEach((()=>{s.restore()})),this.restoreStack=[]}else this.clearFullScreenLastFrame=!0})),i.hooks.render.tap(Ce.tag,(e=>{this.clearFullScreen||this.renderQueue.push(e)}))}clearRect(e,t,r,n,a,i){e.clearRect(t,r,n,a),i&&(e.fillStyle=i,e.fillRect(t,r,n,a))}renderDisplayObject(e,r,n,a,i){var o=e.nodeName,s=a[a.length-1];!s||e.compareDocumentPosition(s)&t.Node.DOCUMENT_POSITION_CONTAINS||(r.restore(),a.pop());var l=this.context.styleRendererFactory[o],c=this.pathGeneratorFactory[o],h=e.parsedStyle.clipPath;if(h){this.applyWorldTransform(r,h);var d=this.pathGeneratorFactory[h.nodeName];d&&(r.save(),a.push(e),r.beginPath(),d(r,h.parsedStyle),r.closePath(),r.clip())}l&&(this.applyWorldTransform(r,e),r.save(),this.applyAttributesToContext(r,e)),c&&(r.beginPath(),c(r,e.parsedStyle),e.nodeName!==t.Shape.LINE&&e.nodeName!==t.Shape.PATH&&e.nodeName!==t.Shape.POLYLINE&&r.closePath()),l&&(l.render(r,e.parsedStyle,e,n,this,i),r.restore()),e.renderable.dirty=!1}convertAABB2Rect(e){var t=e.getMin(),r=e.getMax(),n=Math.floor(t[0]),a=Math.floor(t[1]);return{x:n,y:a,width:Math.ceil(r[0])-n,height:Math.ceil(r[1])-a}}mergeDirtyAABBs(e){var r=new t.AABB;return e.forEach((e=>{var t=e.getRenderBounds();r.add(t);var n=e.renderable.dirtyRenderBounds;n&&r.add(n)})),r}searchDirtyObjects(e){var t=a(e.getMin(),2),r=t[0],n=t[1],i=a(e.getMax(),2);return this.rBush.search({minX:r,minY:n,maxX:i[0],maxY:i[1]}).map((e=>e.displayObject))}saveDirtyAABB(e){var r=e.renderable;r.dirtyRenderBounds||(r.dirtyRenderBounds=new t.AABB);var n=e.getRenderBounds();n&&r.dirtyRenderBounds.update(n.center,n.halfExtents)}applyAttributesToContext(e,t){var r=t.parsedStyle,n=r.stroke,a=r.fill,o=r.opacity,s=r.lineDash,l=r.lineDashOffset;s&&e.setLineDash(s),i(l)||(e.lineDashOffset=l),i(o)||(e.globalAlpha*=o),i(n)||Array.isArray(n)||n.isNone||(e.strokeStyle=t.attributes.stroke),i(a)||Array.isArray(a)||a.isNone||(e.fillStyle=t.attributes.fill)}applyWorldTransform(e,t,r){r?(v(this.tmpMat4,t.getLocalTransform()),f(this.tmpMat4,r,this.tmpMat4),f(this.tmpMat4,this.vpMatrix,this.tmpMat4)):(v(this.tmpMat4,t.getWorldTransform()),f(this.tmpMat4,this.vpMatrix,this.tmpMat4)),e.setTransform(this.tmpMat4[0],this.tmpMat4[1],this.tmpMat4[4],this.tmpMat4[5],this.tmpMat4[12],this.tmpMat4[13])}safeMergeAABB(){for(var e=new t.AABB,r=arguments.length,n=Array(r),a=0;r>a;a++)n[a]=arguments[a];return n.forEach((t=>{e.add(t)})),e}}Ce.tag="CanvasRenderer";class ke{constructor(e){this.imagePool=e}render(e,r,n,a,o,s){var l=r.fill,c=r.fillRule,h=r.opacity,d=void 0===h?1:h,u=r.fillOpacity,v=void 0===u?1:u,f=r.stroke,p=r.strokeOpacity,m=void 0===p?1:p,g=r.lineWidth,y=void 0===g?1:g,x=r.lineCap,b=r.lineJoin,E=r.shadowType,M=r.shadowBlur,w=r.filter,S=r.miterLimit,P=l&&!l.isNone,T=f&&!f.isNone&&y>0,O=0===(null==l?void 0:l.alpha),A=!(!w||!w.length),L=!i(r.shadowColor)&&M>0,C=n.nodeName,k="inner"===E,R=T&&L&&(C===t.Shape.PATH||C===t.Shape.LINE||C===t.Shape.POLYLINE||O||k);P&&(e.globalAlpha=d*v,R||Re(n,e,L),De(e,n,l,c,a,o,s,this.imagePool),R||this.clearShadowAndFilter(e,A,L)),T&&(e.globalAlpha=d*m,e.lineWidth=y,i(S)||(e.miterLimit=S),i(x)||(e.lineCap=x),i(b)||(e.lineJoin=b),R&&(k&&(e.globalCompositeOperation="source-atop"),Re(n,e,!0),k&&(Be(e,n,f,a,o,s,this.imagePool),e.globalCompositeOperation="source-over",this.clearShadowAndFilter(e,A,!0))),Be(e,n,f,a,o,s,this.imagePool))}clearShadowAndFilter(e,t,r){if(r&&(e.shadowColor="transparent",e.shadowBlur=0),t){var n=e.filter;!i(n)&&n.indexOf("drop-shadow")>-1&&(e.filter=n.replace(/drop-shadow\([^)]*\)/,"").trim()||"none")}}}function Re(e,t,r){var n=e.parsedStyle,a=n.filter,i=n.shadowColor,o=n.shadowBlur,s=n.shadowOffsetX,l=n.shadowOffsetY;a&&a.length&&(t.filter=e.style.filter),r&&(t.shadowColor=""+i,t.shadowBlur=o||0,t.shadowOffsetX=s||0,t.shadowOffsetY=l||0)}function Ie(e,t,r,n,a,i,o){var s,l;if("rect"===e.image.nodeName){var c=e.image.parsedStyle,h=c.width,d=c.height;l=n.contextService.getDPR();var u=n.config.offscreenCanvas;(s=i.offscreenCanvasCreator.getOrCreateCanvas(u)).width=h*l,s.height=d*l;var v=i.offscreenCanvasCreator.getOrCreateContext(u),f=[];e.image.forEach((e=>{a.renderDisplayObject(e,v,n,f,i)})),f.forEach((()=>{v.restore()}))}return o.getOrCreatePatternSync(t,e,r,s,l,t.getGeometryBounds().min,(()=>{t.renderable.dirty=!0,n.renderingService.dirtify()}))}function Ne(e,r,n,a){var i;if(e.type===t.GradientType.LinearGradient||e.type===t.GradientType.RadialGradient){var o=r.getGeometryBounds(),s=o&&2*o.halfExtents[0]||1,l=o&&2*o.halfExtents[1]||1,c=o&&o.min||[0,0];i=a.getOrCreateGradient(W(W({type:e.type},e.value),{},{min:c,width:s,height:l}),n)}return i}function De(e,r,n,a,i,o,s,l){var c=arguments.length>8&&void 0!==arguments[8]&&arguments[8];Array.isArray(n)?n.forEach((t=>{e.fillStyle=Ne(t,r,e,l),c||(a?e.fill(a):e.fill())})):(t.isPattern(n)&&(e.fillStyle=Ie(n,r,e,i,o,s,l)),c||(a?e.fill(a):e.fill()))}function Be(e,r,n,a,i,o,s){var l=arguments.length>7&&void 0!==arguments[7]&&arguments[7];Array.isArray(n)?n.forEach((t=>{e.strokeStyle=Ne(t,r,e,s),l||e.stroke()})):(t.isPattern(n)&&(e.strokeStyle=Ie(n,r,e,a,i,o,s)),l||e.stroke())}var Fe=xe("renderDownSampled"),je=xe("renderTile");class Ge{constructor(e){Object.defineProperty(this,je,{value:He}),Object.defineProperty(this,Fe,{value:_e}),this.imagePool=e}static renderFull(e,t,r,n){e.drawImage(n.image,Math.floor(n.drawRect[0]),Math.floor(n.drawRect[1]),Math.ceil(n.drawRect[2]),Math.ceil(n.drawRect[3]))}render(e,t,r){var n=t.x,o=void 0===n?0:n,s=t.y,l=void 0===s?0:s,c=t.width,h=t.height,u=t.src,v=t.shadowColor,f=t.shadowBlur,m=this.imagePool.getImageSync(u,r),y=null==m?void 0:m.img,x=c,b=h;if(y){var E,M,w,S,P,T,O,A,L,C,k,R,I,N,D,B,F,j,G,_,H,z,$,W,U,Y,q,V,X,Q,Z,K,J,ee,te,re,ne,ae;x||(x=y.width),b||(b=y.height),Re(r,e,!i(v)&&f>0);try{var ie=r.ownerDocument.defaultView.getContextService().getDomElement(),oe=ie.width,se=ie.height,le=e.getTransform(),ce=(z=le.a,$=le.c,W=0,U=0,Y=le.b,q=le.d,V=0,X=0,Q=0,Z=0,K=1,J=0,ee=le.e,te=le.f,re=0,ne=1,(ae=new d(16))[0]=z,ae[1]=$,ae[2]=W,ae[3]=U,ae[4]=Y,ae[5]=q,ae[6]=V,ae[7]=X,ae[8]=Q,ae[9]=Z,ae[10]=K,ae[11]=J,ae[12]=ee,ae[13]=te,ae[14]=re,ae[15]=ne,ae),he=(B=[o,l,x,b],F=ce,j=g(p(),[B[0],B[1],0],F),G=g(p(),[B[0]+B[2],B[1],0],F),_=g(p(),[B[0],B[1]+B[3],0],F),H=g(p(),[B[0]+B[2],B[1]+B[3],0],F),[Math.min(j[0],G[0],_[0],H[0]),Math.min(j[1],G[1],_[1],H[1]),Math.max(j[0],G[0],_[0],H[0])-Math.min(j[0],G[0],_[0],H[0]),Math.max(j[1],G[1],_[1],H[1])-Math.min(j[1],G[1],_[1],H[1])]),de=(E=he,M=a([0,0,oe,se],4),w=M[0],S=M[1],P=M[2],T=M[3],O=a(E,4),L=O[1],C=O[2],k=O[3],R=Math.max(w,A=O[0]),I=Math.max(S,L),N=Math.min(w+P,A+C),D=Math.min(S+T,L+k),N>R&&D>I?[R,I,N-R,D-I]:null);if(!de)return;if(!r.ownerDocument.defaultView.getConfig().enableLargeImageOptimization)return void Ge.renderFull(e,t,r,{image:y,drawRect:[o,l,x,b]});if((m.downSamplingRate||.5)>he[2]/m.size[0])return void ge(this,Fe)[Fe](e,t,r,{src:u,imageCache:m,drawRect:[o,l,x,b]});if(!Pe.isSupportTile)return void Ge.renderFull(e,t,r,{image:y,drawRect:[o,l,x,b]});ge(this,je)[je](e,t,r,{src:u,imageCache:m,imageRect:he,drawRect:de})}catch(e){}}}}function _e(e,t,r,n){var a=n.src,i=n.imageCache;i.downSampled?e.drawImage(i.downSampled,Math.floor(n.drawRect[0]),Math.floor(n.drawRect[1]),Math.ceil(n.drawRect[2]),Math.ceil(n.drawRect[3])):this.imagePool.createDownSampledImage(a,r).then((e=>{r.renderable.dirty=!0,r.ownerDocument.defaultView.context.renderingService.dirtify()})).catch((()=>{}))}function He(e,t,r,n){var a=n.src,i=n.imageCache,o=n.imageRect,s=n.drawRect,l=i.size,c=e.getTransform(),h=c.a,d=c.b,u=c.c,v=c.d,f=c.e,p=c.f;if(e.resetTransform(),null!=i&&i.gridSize){for(var m=[l[0]/o[2],l[1]/o[3]],g=[i.tileSize[0]/m[0],i.tileSize[1]/m[1]],y=[Math.floor((s[0]-o[0])/g[0]),Math.ceil((s[0]+s[2]-o[0])/g[0])],x=y[0],b=y[1],E=[Math.floor((s[1]-o[1])/g[1]),Math.ceil((s[1]+s[3]-o[1])/g[1])],M=E[1],w=E[0];M>=w;w++)for(var S=x;b>=S;S++){var P=i.tiles[w][S];if(P){var T=[Math.floor(o[0]+P.tileX*g[0]),Math.floor(o[1]+P.tileY*g[1]),Math.ceil(g[0]),Math.ceil(g[1])];e.drawImage(P.data,T[0],T[1],T[2],T[3])}}e.setTransform(h,d,u,v,f,p)}else this.imagePool.createImageTiles(a,[],r).then((()=>{r.renderable.dirty=!0,r.ownerDocument.defaultView.context.renderingService.dirtify()})).catch((()=>{}))}class ze{constructor(e){this.imagePool=e}render(e,t,r,n,a,o){r.getBounds();var s=t.lineWidth,l=void 0===s?1:s,c=t.textAlign,h=void 0===c?"start":c,d=t.textBaseline,u=void 0===d?"alphabetic":d,v=t.lineJoin,f=void 0===v?"miter":v,p=t.miterLimit,m=void 0===p?10:p,g=t.letterSpacing,y=void 0===g?0:g,x=t.stroke,b=t.fill,E=t.fillRule,M=t.fillOpacity,w=void 0===M?1:M,S=t.strokeOpacity,P=void 0===S?1:S,T=t.opacity,O=void 0===T?1:T,A=t.metrics,L=t.x,C=void 0===L?0:L,k=t.y,R=void 0===k?0:k,I=t.dx,N=t.dy,D=t.shadowColor,B=t.shadowBlur,F=A.lines,j=A.height,G=A.lineHeight,_=A.lineMetrics;e.font=A.font,e.lineWidth=l,e.textAlign="middle"===h?"center":h;var H=u;"alphabetic"===H&&(H="bottom"),e.lineJoin=f,i(m)||(e.miterLimit=m);var z=R;"middle"===u?z+=-j/2-G/2:"bottom"===u||"alphabetic"===u||"ideographic"===u?z+=-j:"top"!==u&&"hanging"!==u||(z+=-G);var $=C+(I||0);z+=N||0,1===F.length&&("bottom"===H?(H="middle",z-=.5*j):"top"===H&&(H="middle",z+=.5*j)),e.textBaseline=H,Re(r,e,!i(D)&&B>0);for(var W=0;F.length>W;W++){var U=l/2+$;z+=G,i(x)||x.isNone||!l||this.drawLetterSpacing(e,r,F[W],_[W],h,U,z,y,b,E,w,x,P,O,!0,n,a,o),i(b)||this.drawLetterSpacing(e,r,F[W],_[W],h,U,z,y,b,E,w,x,P,O,!1,n,a,o)}}drawLetterSpacing(e,t,r,n,a,i,o,s,l,c,h,d,u,v,f,p,m,g){if(0!==s){var y=e.textAlign;e.textAlign="left";var x=i;"center"===a||"middle"===a?x=i-n.width/2:"right"!==a&&"end"!==a||(x=i-n.width);for(var b=Array.from(r),E=e.measureText(r).width,M=0,w=0;b.length>w;++w){var S=b[w];f?this.strokeText(e,t,S,x,o,d,u,p,m,g):this.fillText(e,t,S,x,o,l,c,h,v,p,m,g),x+=E-(M=e.measureText(r.substring(w+1)).width)+s,E=M}e.textAlign=y}else f?this.strokeText(e,t,r,i,o,d,u,p,m,g):this.fillText(e,t,r,i,o,l,c,h,v,p,m,g)}fillText(e,t,r,n,a,o,s,l,c,h,d,u){var v;De(e,t,o,s,h,d,u,this.imagePool,!0);var f=!i(l)&&1!==l;f&&(v=e.globalAlpha,e.globalAlpha=l*c),e.fillText(r,n,a),f&&(e.globalAlpha=v)}strokeText(e,t,r,n,a,o,s,l,c,h){var d;Be(e,t,o,l,c,h,this.imagePool,!0);var u=!i(s)&&1!==s;u&&(d=e.globalAlpha,e.globalAlpha=s),e.strokeText(r,n,a),u&&(e.globalAlpha=d)}}let $e=class extends t.AbstractRendererPlugin{constructor(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};super(),this.name="canvas-renderer",this.options=e}init(){var e=W({dirtyObjectNumThreshold:500,dirtyObjectRatioThreshold:.8},this.options),r=this.context.imagePool,n=new ke(r),a={[t.Shape.CIRCLE]:n,[t.Shape.ELLIPSE]:n,[t.Shape.RECT]:n,[t.Shape.IMAGE]:new Ge(r),[t.Shape.TEXT]:new ze(r),[t.Shape.LINE]:n,[t.Shape.POLYLINE]:n,[t.Shape.POLYGON]:n,[t.Shape.PATH]:n,[t.Shape.GROUP]:void 0,[t.Shape.HTML]:void 0,[t.Shape.MESH]:void 0};this.context.defaultStyleRendererFactory=a,this.context.styleRendererFactory=a,this.addRenderingPlugin(new Ce(e))}destroy(){this.removeAllRenderingPlugins(),delete this.context.defaultStyleRendererFactory,delete this.context.styleRendererFactory}};var We=Object.freeze({__proto__:null,CircleRenderer:class extends ke{},EllipseRenderer:class extends ke{},ImageRenderer:Ge,LineRenderer:class extends ke{},PathRenderer:class extends ke{},Plugin:$e,PolygonRenderer:class extends ke{},PolylineRenderer:class extends ke{},RectRenderer:class extends ke{},TextRenderer:ze});
50
+ /*!
51
+ * @antv/g-plugin-dom-interaction
52
+ * @description A G plugin
53
+ * @version 2.1.1
54
+ * @date 10/23/2024, 7:13:54 AM
55
+ * @author AntVis
56
+ * @docs https://g.antv.antgroup.com/
57
+ */class Ue{apply(e,t){var r=e.renderingService,n=e.renderingContext,a=e.config;this.context=e;var i=n.root.ownerDocument.defaultView,o=e=>{r.hooks.pointerMove.call(e)},s=e=>{r.hooks.pointerUp.call(e)},l=e=>{r.hooks.pointerDown.call(e)},c=e=>{r.hooks.pointerOver.call(e)},h=e=>{r.hooks.pointerOut.call(e)},d=e=>{r.hooks.pointerCancel.call(e)},u=e=>{r.hooks.pointerWheel.call(e)},v=e=>{r.hooks.click.call(e)};r.hooks.init.tap(Ue.tag,(()=>{var e=this.context.contextService.getDomElement();t.globalThis.navigator.msPointerEnabled?(e.style.msContentZooming="none",e.style.msTouchAction="none"):i.supportsPointerEvents&&(e.style.touchAction="none"),i.supportsPointerEvents?(e=>{t.globalThis.document.addEventListener("pointermove",o,!0),e.addEventListener("pointerdown",l,!0),e.addEventListener("pointerleave",h,!0),e.addEventListener("pointerover",c,!0),t.globalThis.addEventListener("pointerup",s,!0),t.globalThis.addEventListener("pointercancel",d,!0)})(e):(e=>{t.globalThis.document.addEventListener("mousemove",o,!0),e.addEventListener("mousedown",l,!0),e.addEventListener("mouseout",h,!0),e.addEventListener("mouseover",c,!0),t.globalThis.addEventListener("mouseup",s,!0)})(e),i.supportsTouchEvents&&(e=>{e.addEventListener("touchstart",l,!0),e.addEventListener("touchend",s,!0),e.addEventListener("touchmove",o,!0),e.addEventListener("touchcancel",d,!0)})(e),a.useNativeClickEvent&&e.addEventListener("click",v,!0),e.addEventListener("wheel",u,{passive:!0,capture:!0})})),r.hooks.destroy.tap(Ue.tag,(()=>{var e=this.context.contextService.getDomElement();t.globalThis.navigator.msPointerEnabled?(e.style.msContentZooming="",e.style.msTouchAction=""):i.supportsPointerEvents&&(e.style.touchAction=""),i.supportsPointerEvents?(e=>{t.globalThis.document.removeEventListener("pointermove",o,!0),e.removeEventListener("pointerdown",l,!0),e.removeEventListener("pointerleave",h,!0),e.removeEventListener("pointerover",c,!0),t.globalThis.removeEventListener("pointerup",s,!0),t.globalThis.removeEventListener("pointercancel",d,!0)})(e):(e=>{t.globalThis.document.removeEventListener("mousemove",o,!0),e.removeEventListener("mousedown",l,!0),e.removeEventListener("mouseout",h,!0),e.removeEventListener("mouseover",c,!0),t.globalThis.removeEventListener("mouseup",s,!0)})(e),i.supportsTouchEvents&&(e=>{e.removeEventListener("touchstart",l,!0),e.removeEventListener("touchend",s,!0),e.removeEventListener("touchmove",o,!0),e.removeEventListener("touchcancel",d,!0)})(e),a.useNativeClickEvent&&e.removeEventListener("click",v,!0),e.removeEventListener("wheel",u,!0)}))}}Ue.tag="DOMInteraction";let Ye=class extends t.AbstractRendererPlugin{constructor(){super(...arguments),this.name="dom-interaction"}init(){this.addRenderingPlugin(new Ue)}destroy(){this.removeAllRenderingPlugins()}};var qe=Object.freeze({__proto__:null,Plugin:Ye});
58
+ /*!
59
+ * @antv/g-plugin-html-renderer
60
+ * @description A G plugin for rendering HTML
61
+ * @version 2.1.1
62
+ * @date 10/23/2024, 7:14:03 AM
63
+ * @author AntVis
64
+ * @docs https://g.antv.antgroup.com/
65
+ */class Ve{constructor(){this.displayObjectHTMLElementMap=new WeakMap}joinTransformMatrix(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[0,0,0];return"matrix(".concat([e[0],e[1],e[4],e[5],e[12]+t[0],e[13]+t[1]].join(","),")")}apply(e,r){var n=e.camera,a=e.renderingContext,i=e.renderingService;this.context=e;var o=a.root.ownerDocument.defaultView,s=o.context.eventService.nativeHTMLMap,l=(e,t)=>{t.style.transform=this.joinTransformMatrix(e.getWorldTransform(),e.getOrigin())},c=e=>{var r=e.target;if(r.nodeName===t.Shape.HTML){this.$camera||(this.$camera=this.createCamera(n));var a=this.getOrCreateEl(r);this.$camera.appendChild(a),Object.keys(r.attributes).forEach((e=>{this.updateAttribute(e,r)})),l(r,a),s.set(a,r)}},h=e=>{var r=e.target;if(r.nodeName===t.Shape.HTML&&this.$camera){var n=this.getOrCreateEl(r);n&&(n.remove(),s.delete(n))}},d=e=>{var r=e.target;r.nodeName===t.Shape.HTML&&this.updateAttribute(e.attrName,r)},u=e=>{var r=e.target;(r.nodeName===t.Shape.FRAGMENT?r.childNodes:[r]).forEach((e=>{if(e.nodeName===t.Shape.HTML){var r=this.getOrCreateEl(e);l(e,r)}}))},v=()=>{if(this.$camera){var e=this.context.config,t=e.height;this.$camera.parentElement.style.width="".concat(e.width||0,"px"),this.$camera.parentElement.style.height="".concat(t||0,"px")}};i.hooks.init.tap(Ve.tag,(()=>{o.addEventListener(t.CanvasEvent.RESIZE,v),o.addEventListener(t.ElementEvent.MOUNTED,c),o.addEventListener(t.ElementEvent.UNMOUNTED,h),o.addEventListener(t.ElementEvent.ATTR_MODIFIED,d),o.addEventListener(t.ElementEvent.BOUNDS_CHANGED,u)})),i.hooks.endFrame.tap(Ve.tag,(()=>{this.$camera&&a.renderReasons.has(t.RenderReason.CAMERA_CHANGED)&&(this.$camera.style.transform=this.joinTransformMatrix(n.getOrthoMatrix()))})),i.hooks.destroy.tap(Ve.tag,(()=>{this.$camera&&this.$camera.remove(),o.removeEventListener(t.CanvasEvent.RESIZE,v),o.removeEventListener(t.ElementEvent.MOUNTED,c),o.removeEventListener(t.ElementEvent.UNMOUNTED,h),o.removeEventListener(t.ElementEvent.ATTR_MODIFIED,d),o.removeEventListener(t.ElementEvent.BOUNDS_CHANGED,u)}))}createCamera(e){var t=this.context.config,r=t.document,n=t.width,a=t.height,i=this.context.contextService.getDomElement(),o=i.parentNode;if(o){var s="g-canvas-camera",l=o.querySelector("#".concat(s));if(!l){var c=(r||document).createElement("div");c.style.overflow="hidden",c.style.pointerEvents="none",c.style.position="absolute",c.style.left="0px",c.style.top="0px",c.style.width="".concat(n||0,"px"),c.style.height="".concat(a||0,"px");var h=(r||document).createElement("div");l=h,h.id=s,h.style.position="absolute",h.style.left="".concat(i.offsetLeft||0,"px"),h.style.top="".concat(i.offsetTop||0,"px"),h.style.transformOrigin="left top",h.style.transform=this.joinTransformMatrix(e.getOrthoMatrix()),h.style.pointerEvents="none",h.style.width="100%",h.style.height="100%",c.appendChild(h),o.appendChild(c)}return l}return null}getOrCreateEl(e){var t=this.context.config.document,r=this.displayObjectHTMLElementMap.get(e);return r||(r=(t||document).createElement("div"),e.parsedStyle.$el=r,this.displayObjectHTMLElementMap.set(e,r),e.id&&(r.id=e.id),e.name&&r.setAttribute("name",e.name),e.className&&(r.className=e.className),r.style.position="absolute",r.style["will-change"]="transform",r.style.transform=this.joinTransformMatrix(e.getWorldTransform(),e.getOrigin())),r}updateAttribute(e,r){var n=this.getOrCreateEl(r);switch(e){case"innerHTML":var a=r.parsedStyle.innerHTML;l(a)?n.innerHTML=a:(n.innerHTML="",n.appendChild(a));break;case"x":n.style.left="".concat(r.parsedStyle.x,"px");break;case"y":n.style.top="".concat(r.parsedStyle.y,"px");break;case"transformOrigin":var o=r.parsedStyle.transformOrigin;n.style["transform-origin"]="".concat(o[0].buildCSSText(null,null,"")," ").concat(o[1].buildCSSText(null,null,""));break;case"width":var s=r.parsedStyle.width;n.style.width=h(s)?"".concat(s,"px"):""+s;break;case"height":var c=r.parsedStyle.height;n.style.height=h(c)?"".concat(c,"px"):""+c;break;case"zIndex":n.style["z-index"]="".concat(r.parsedStyle.zIndex);break;case"visibility":n.style.visibility=r.parsedStyle.visibility;break;case"pointerEvents":var d=r.parsedStyle.pointerEvents;n.style.pointerEvents=void 0===d?"auto":d;break;case"opacity":n.style.opacity="".concat(r.parsedStyle.opacity);break;case"fill":var u=r.parsedStyle.fill,v="";t.isCSSRGB(u)?v=u.isNone?"transparent":r.getAttribute("fill"):Array.isArray(u)?v=r.getAttribute("fill"):t.isPattern(u),n.style.background=v;break;case"stroke":var f=r.parsedStyle.stroke,p="";t.isCSSRGB(f)?p=f.isNone?"transparent":r.getAttribute("stroke"):Array.isArray(f)?p=r.getAttribute("stroke"):t.isPattern(f),n.style["border-color"]=p,n.style["border-style"]="solid";break;case"lineWidth":n.style["border-width"]="".concat(r.parsedStyle.lineWidth||0,"px");break;case"lineDash":n.style["border-style"]="dashed";break;case"filter":n.style.filter=r.style.filter;break;default:i(r.style[e])||""===r.style[e]||(n.style[e]=r.style[e])}}}Ve.tag="HTMLRendering";class Xe extends t.AbstractRendererPlugin{constructor(){super(...arguments),this.name="html-renderer"}init(){this.addRenderingPlugin(new Ve)}destroy(){this.removeAllRenderingPlugins()}}var Qe=Object.freeze({__proto__:null,Plugin:Xe});class Ze{constructor(e){this.renderingContext=e.renderingContext,this.canvasConfig=e.config}init(){var e=this.canvasConfig,t=e.container,r=e.canvas;if(r)this.$canvas=r,t&&r.parentElement!==t&&t.appendChild(r),this.$container=r.parentElement,this.canvasConfig.container=this.$container;else if(t&&(this.$container=l(t)?document.getElementById(t):t,this.$container)){var n=document.createElement("canvas");this.$container.appendChild(n),this.$container.style.position||(this.$container.style.position="relative"),this.$canvas=n}this.context=this.$canvas.getContext("2d"),this.resize(this.canvasConfig.width,this.canvasConfig.height)}getContext(){return this.context}getDomElement(){return this.$canvas}getDPR(){return this.dpr}getBoundingClientRect(){if(this.$canvas.getBoundingClientRect)return this.$canvas.getBoundingClientRect()}destroy(){this.$container&&this.$canvas&&this.$canvas.parentNode&&this.$container.removeChild(this.$canvas)}resize(e,r){var n=this.canvasConfig.devicePixelRatio||t.isBrowser&&window.devicePixelRatio||1;this.dpr=n=1>n?1:Math.ceil(n),this.$canvas&&(this.$canvas.width=this.dpr*e,this.$canvas.height=this.dpr*r,t.setDOMSize(this.$canvas,e,r)),this.renderingContext.renderReasons.add(t.RenderReason.CAMERA_CHANGED)}applyCursorStyle(e){this.$container&&this.$container.style&&(this.$container.style.cursor=e)}toDataURL(){var e=arguments,t=this;return R(C().mark((function r(){var n;return C().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return r.abrupt("return",t.context.canvas.toDataURL((n=e.length>0&&void 0!==e[0]?e[0]:{}).type,n.encoderOptions));case 3:case"end":return r.stop()}}),r)})))()}}class Ke extends t.AbstractRendererPlugin{constructor(){super(...arguments),this.name="canvas-context-register"}init(){this.context.ContextService=Ze}destroy(){delete this.context.ContextService}}e.CanvasPathGenerator=A,e.CanvasPicker=me,e.CanvasRenderer=We,e.DomInteraction=qe,e.HTMLRenderer=Qe,e.ImageLoader=Le,e.Renderer=class extends t.AbstractRenderer{constructor(e){super(e),this.registerPlugin(new Ke),this.registerPlugin(new Ae),this.registerPlugin(new O),this.registerPlugin(new $e),this.registerPlugin(new Ye),this.registerPlugin(new pe),this.registerPlugin(new Xe)}}}));
2
66
  //# sourceMappingURL=index.umd.min.js.map