New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@antv/g-canvas

Package Overview
Dependencies
Maintainers
64
Versions
359
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@antv/g-canvas - npm Package Compare versions

Comparing version 1.11.24 to 1.11.25

4

dist/index.esm.js

@@ -1,2 +0,2 @@

import { __awaiter, __generator, __extends } from 'tslib';
import { __awaiter, __generator, __extends, __spreadArray, __read } from 'tslib';
import { setDOMSize, RenderReason, isBrowser, AbstractRendererPlugin, AbstractRenderer } from '@antv/g-lite';

@@ -113,3 +113,3 @@ import * as CanvasPathGenerator from '@antv/g-plugin-canvas-path-generator';

function ContextRegisterPlugin() {
var _this = _super !== null && _super.apply(this, arguments) || this;
var _this = _super.apply(this, __spreadArray([], __read(arguments), false)) || this;
_this.name = 'canvas-context-register';

@@ -116,0 +116,0 @@ return _this;

@@ -133,3 +133,3 @@ 'use strict';

function ContextRegisterPlugin() {
var _this = _super !== null && _super.apply(this, arguments) || this;
var _this = _super.apply(this, tslib.__spreadArray([], tslib.__read(arguments), false)) || this;
_this.name = 'canvas-context-register';

@@ -136,0 +136,0 @@ return _this;

@@ -1,2 +0,2 @@

!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("@antv/g-lite")):"function"==typeof define&&define.amd?define(["exports","@antv/g-lite"],e):e(((t="undefined"!=typeof globalThis?globalThis:t||self).G=t.G||{},t.G.Canvas2D={}),t.window.G)}(this,(function(t,e){"use strict";var n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},n(t,e)};function r(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+e+" is not a constructor or null");function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}var a=function(){return a=Object.assign||function(t){for(var e,n=1,r=arguments.length;r>n;n++)for(var a in e=arguments[n])Object.prototype.hasOwnProperty.call(e,a)&&(t[a]=e[a]);return t},a.apply(this,arguments)};function i(t,e,n,r){return new(n||(n=Promise))((function(a,i){function o(t){try{c(r.next(t))}catch(t){i(t)}}function s(t){try{c(r.throw(t))}catch(t){i(t)}}function c(t){var e;t.done?a(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(o,s)}c((r=r.apply(t,e||[])).next())}))}function o(t,e){var n,r,a,i,o={label:0,sent:function(){if(1&a[0])throw a[1];return a[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(s){return function(c){return function(s){if(n)throw new TypeError("Generator is already executing.");for(;i&&(i=0,s[0]&&(o=0)),o;)try{if(n=1,r&&(a=2&s[0]?r.return:s[0]?r.throw||((a=r.return)&&a.call(r),0):r.next)&&!(a=a.call(r,s[1])).done)return a;switch(r=0,a&&(s=[2&s[0],a.value]),s[0]){case 0:case 1:a=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(!(a=o.trys,(a=a.length>0&&a[a.length-1])||6!==s[0]&&2!==s[0])){o=0;continue}if(3===s[0]&&(!a||s[1]>a[0]&&a[3]>s[1])){o.label=s[1];break}if(6===s[0]&&a[1]>o.label){o.label=a[1],a=s;break}if(a&&a[2]>o.label){o.label=a[2],o.ops.push(s);break}a[2]&&o.ops.pop(),o.trys.pop();continue}s=e.call(t,o)}catch(t){s=[6,t],r=0}finally{n=a=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,c])}}}function s(t,e){var n="function"==typeof Symbol&&t[Symbol.iterator];if(!n)return t;var r,a,i=n.call(t),o=[];try{for(;(void 0===e||e-- >0)&&!(r=i.next()).done;)o.push(r.value)}catch(t){a={error:t}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(a)throw a.error}}return o}function c(t,e,n){if(n||2===arguments.length)for(var r,a=0,i=e.length;i>a;a++)!r&&a in e||(r||(r=Array.prototype.slice.call(e,0,a)),r[a]=e[a]);return t.concat(r||Array.prototype.slice.call(e))}var l="undefined"!=typeof Float32Array?Float32Array:Array;function h(){var t=new l(16);return l!=Float32Array&&(t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0),t[0]=1,t[5]=1,t[10]=1,t[15]=1,t}function u(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[8]=e[8],t[9]=e[9],t[10]=e[10],t[11]=e[11],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15],t}function d(t,e,n){var r=e[0],a=e[1],i=e[2],o=e[3],s=e[4],c=e[5],l=e[6],h=e[7],u=e[8],d=e[9],p=e[10],f=e[11],v=e[12],y=e[13],g=e[14],m=e[15],E=n[0],M=n[1],x=n[2],b=n[3];return t[0]=E*r+M*s+x*u+b*v,t[1]=E*a+M*c+x*d+b*y,t[2]=E*i+M*l+x*p+b*g,t[3]=E*o+M*h+x*f+b*m,t[4]=(E=n[4])*r+(M=n[5])*s+(x=n[6])*u+(b=n[7])*v,t[5]=E*a+M*c+x*d+b*y,t[6]=E*i+M*l+x*p+b*g,t[7]=E*o+M*h+x*f+b*m,t[8]=(E=n[8])*r+(M=n[9])*s+(x=n[10])*u+(b=n[11])*v,t[9]=E*a+M*c+x*d+b*y,t[10]=E*i+M*l+x*p+b*g,t[11]=E*o+M*h+x*f+b*m,t[12]=(E=n[12])*r+(M=n[13])*s+(x=n[14])*u+(b=n[15])*v,t[13]=E*a+M*c+x*d+b*y,t[14]=E*i+M*l+x*p+b*g,t[15]=E*o+M*h+x*f+b*m,t}function p(t,e,n){var r,a,i,o,s,c,l,h,u,d,p,f,v=n[0],y=n[1],g=n[2];return e===t?(t[12]=e[0]*v+e[4]*y+e[8]*g+e[12],t[13]=e[1]*v+e[5]*y+e[9]*g+e[13],t[14]=e[2]*v+e[6]*y+e[10]*g+e[14],t[15]=e[3]*v+e[7]*y+e[11]*g+e[15]):(a=e[1],i=e[2],o=e[3],s=e[4],c=e[5],l=e[6],h=e[7],u=e[8],d=e[9],p=e[10],f=e[11],t[0]=r=e[0],t[1]=a,t[2]=i,t[3]=o,t[4]=s,t[5]=c,t[6]=l,t[7]=h,t[8]=u,t[9]=d,t[10]=p,t[11]=f,t[12]=r*v+s*y+u*g+e[12],t[13]=a*v+c*y+d*g+e[13],t[14]=i*v+l*y+p*g+e[14],t[15]=o*v+h*y+f*g+e[15]),t}function f(){var t=new l(3);return l!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0),t}function v(t,e,n,r){return t[0]=e,t[1]=n,t[2]=r,t}function y(t,e,n){var r=e[0],a=e[1],i=e[2],o=n[3]*r+n[7]*a+n[11]*i+n[15];return t[0]=(n[0]*r+n[4]*a+n[8]*i+n[12])/(o=o||1),t[1]=(n[1]*r+n[5]*a+n[9]*i+n[13])/o,t[2]=(n[2]*r+n[6]*a+n[10]*i+n[14])/o,t}function g(t,e,n){return{x:t*Math.cos(n)-e*Math.sin(n),y:t*Math.sin(n)+e*Math.cos(n)}}function m(t,e,n,r,a,i,o,s,c,l){var h,u,d,p,f,v=t,y=e,E=n,M=r,x=s,b=c,S=120*Math.PI/180,P=Math.PI/180*(+a||0),C=[];if(l)u=l[0],d=l[1],p=l[2],f=l[3];else{y=(h=g(v,y,-P)).y;var T=((v=h.x)-(x=(h=g(x,b,-P)).x))/2,A=(y-(b=h.y))/2,w=T*T/(E*E)+A*A/(M*M);w>1&&(E*=w=Math.sqrt(w),M*=w);var k=E*E,O=M*M,L=(i===o?-1:1)*Math.sqrt(Math.abs((k*O-k*A*A-O*T*T)/(k*A*A+O*T*T)));p=L*E*A/M+(v+x)/2,u=Math.asin(((y-(f=L*-M*T/E+(y+b)/2))/M*1e9>>0)/1e9),d=Math.asin(((b-f)/M*1e9>>0)/1e9),0>(u=p>v?Math.PI-u:u)&&(u=2*Math.PI+u),0>(d=p>x?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)>S){var I=d,N=x,B=b;C=m(x=p+E*Math.cos(d=u+S*(o&&d>u?1:-1)),b=f+M*Math.sin(d),E,M,a,0,o,N,B,[d,I,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*E*_,$=4/3*M*_,W=[v,y],U=[v+H*F,y-$*D],Y=[x+H*j,b-$*G],X=[x,b];if(U[0]=2*W[0]-U[0],U[1]=2*W[1]-U[1],l)return U.concat(Y,X,C);for(var z=[],q=0,Q=(C=U.concat(Y,X,C)).length;Q>q;q+=1)z[q]=q%2?g(C[q-1],C[q],P).y:g(C[q],C[q+1],P).x;return z}Math.hypot||(Math.hypot=function(){for(var t=0,e=arguments.length;e--;)t+=arguments[e]*arguments[e];return Math.sqrt(t)}),f(),function(){var t,e=(t=new l(2),l!=Float32Array&&(t[0]=0,t[1]=0),t)}();var E=function(t){return null==t},M={}.toString,x=function(t,e){return M.call(t)==="[object "+e+"]"},b=function(t){return x(t,"String")},S=function(t,e,n){return e>t?e:t>n?n:t},P=function(t){return x(t,"Number")};function C(t,e){var n=e.r;t.arc(n,n,n,0,2*Math.PI,!1)}function T(t,e){var n=e.rx,r=e.ry;if(t.ellipse)t.ellipse(n,r,n,r,0,0,2*Math.PI,!1);else{var a=n>r?n:r,i=n>r?1:n/r,o=n>r?r/n:1;t.save(),t.scale(i,o),t.arc(a,a,a,0,2*Math.PI)}}function A(t,n){var r=n.x1,a=n.y1,i=n.x2,o=n.y2,s=n.defX,c=void 0===s?0:s,l=n.defY,h=void 0===l?0:l,u=n.markerStart,d=n.markerEnd,p=n.markerStartOffset,f=n.markerEndOffset,v=0,y=0,g=0,m=0,E=0;u&&e.isDisplayObject(u)&&p&&(v=Math.cos(E=Math.atan2(o-a,i-r))*(p||0),y=Math.sin(E)*(p||0)),d&&e.isDisplayObject(d)&&f&&(g=Math.cos(E=Math.atan2(a-o,r-i))*(f||0),m=Math.sin(E)*(f||0)),t.moveTo(r-c+v,a-h+y),t.lineTo(i-c+g,o-h+m)}function w(t,n){var r=n.defX,a=void 0===r?0:r,i=n.defY,o=void 0===i?0:i,c=n.markerStart,l=n.markerEnd,h=n.markerStartOffset,u=n.markerEndOffset,d=n.path,p=d.absolutePath,f=d.segments,v=0,y=0,g=0,m=0,E=0;if(c&&e.isDisplayObject(c)&&h){var M=s(c.parentNode.getStartTangent(),2);v=Math.cos(E=Math.atan2((x=M[0])[1]-(b=M[1])[1],x[0]-b[0]))*(h||0),y=Math.sin(E)*(h||0)}if(l&&e.isDisplayObject(l)&&u){var x,b,S=s(l.parentNode.getEndTangent(),2);g=Math.cos(E=Math.atan2((x=S[0])[1]-(b=S[1])[1],x[0]-b[0]))*(u||0),m=Math.sin(E)*(u||0)}for(var P=0;p.length>P;P++){var C=p[P],T=p[P+1],A=0===P&&(0!==v||0!==y),w=(P===p.length-1||T&&("M"===T[0]||"Z"===T[0]))&&0!==g&&0!==m;switch(C[0]){case"M":A?(t.moveTo(C[1]-a+v,C[2]-o+y),t.lineTo(C[1]-a,C[2]-o)):t.moveTo(C[1]-a,C[2]-o);break;case"L":w?t.lineTo(C[1]-a+g,C[2]-o+m):t.lineTo(C[1]-a,C[2]-o);break;case"Q":t.quadraticCurveTo(C[1]-a,C[2]-o,C[3]-a,C[4]-o),w&&t.lineTo(C[3]-a+g,C[4]-o+m);break;case"C":t.bezierCurveTo(C[1]-a,C[2]-o,C[3]-a,C[4]-o,C[5]-a,C[6]-o),w&&t.lineTo(C[5]-a+g,C[6]-o+m);break;case"A":var k=f[P].arcParams,O=k.cx,L=k.cy,R=k.rx,I=k.ry,N=k.startAngle,B=k.endAngle,D=k.xRotation,F=k.sweepFlag;if(t.ellipse)t.ellipse(O-a,L-o,R,I,D,N,B,!!(1-F));else{var G=R>I?R:I,j=R>I?1:R/I,_=R>I?I/R:1;t.translate(O-a,L-o),t.rotate(D),t.scale(j,_),t.arc(0,0,G,N,B,!!(1-F)),t.scale(1/j,1/_),t.rotate(-D),t.translate(-(O-a),-(L-o))}w&&t.lineTo(C[6]-a+g,C[7]-o+m);break;case"Z":t.closePath()}}}function k(t,n){var r=n.defX,a=void 0===r?0:r,i=n.defY,o=void 0===i?0:i,s=n.markerStart,c=n.markerEnd,l=n.markerStartOffset,h=n.markerEndOffset,u=n.points.points,d=u.length,p=u[0][0]-a,f=u[0][1]-o,v=u[d-1][0]-a,y=u[d-1][1]-o,g=0,m=0,E=0,M=0,x=0;s&&e.isDisplayObject(s)&&l&&(g=Math.cos(x=Math.atan2(u[1][1]-u[0][1],u[1][0]-u[0][0]))*(l||0),m=Math.sin(x)*(l||0)),c&&e.isDisplayObject(c)&&h&&(E=Math.cos(x=Math.atan2(u[d-1][1]-u[0][1],u[d-1][0]-u[0][0]))*(h||0),M=Math.sin(x)*(h||0)),t.moveTo(p+(g||E),f+(m||M));for(var b=1;d-1>b;b++){var S=u[b];t.lineTo(S[0]-a,S[1]-o)}t.lineTo(v,y)}function O(t,n){var r=n.defX,a=void 0===r?0:r,i=n.defY,o=void 0===i?0:i,s=n.markerStart,c=n.markerEnd,l=n.markerStartOffset,h=n.markerEndOffset,u=n.points.points,d=u.length,p=u[0][0]-a,f=u[0][1]-o,v=u[d-1][0]-a,y=u[d-1][1]-o,g=0,m=0,E=0,M=0,x=0;s&&e.isDisplayObject(s)&&l&&(g=Math.cos(x=Math.atan2(u[1][1]-u[0][1],u[1][0]-u[0][0]))*(l||0),m=Math.sin(x)*(l||0)),c&&e.isDisplayObject(c)&&h&&(E=Math.cos(x=Math.atan2(u[d-2][1]-u[d-1][1],u[d-2][0]-u[d-1][0]))*(h||0),M=Math.sin(x)*(h||0)),t.moveTo(p+g,f+m);for(var b=1;d-1>b;b++){var S=u[b];t.lineTo(S[0]-a,S[1]-o)}t.lineTo(v+E,y+M)}function L(t,e){var n=e.radius,r=e.width,a=e.height,i=r,o=a;if(n&&n.some((function(t){return 0!==t}))){var c=r>0?1:-1,l=a>0?1:-1,h=c+l===0,u=s(n.map((function(t){return S(t,0,Math.min(Math.abs(i)/2,Math.abs(o)/2))})),4),d=u[0],p=u[1],f=u[2],v=u[3];t.moveTo(c*d,0),t.lineTo(i-c*p,0),0!==p&&t.arc(i-c*p,l*p,p,-l*Math.PI/2,c>0?0:Math.PI,h),t.lineTo(i,o-l*f),0!==f&&t.arc(i-c*f,o-l*f,f,c>0?0:Math.PI,l>0?Math.PI/2:1.5*Math.PI,h),t.lineTo(c*v,o),0!==v&&t.arc(c*v,o-l*v,v,l>0?Math.PI/2:-Math.PI/2,c>0?Math.PI:0,h),t.lineTo(0,l*d),0!==d&&t.arc(c*d,l*d,d,c>0?Math.PI:0,l>0?1.5*Math.PI:Math.PI/2,h)}else t.rect(0,0,i,o)}var R=function(t){function n(){var e=null!==t&&t.apply(this,arguments)||this;return e.name="canvas-path-generator",e}return r(n,t),n.prototype.init=function(){var t,n=((t={})[e.Shape.CIRCLE]=C,t[e.Shape.ELLIPSE]=T,t[e.Shape.RECT]=L,t[e.Shape.LINE]=A,t[e.Shape.POLYLINE]=O,t[e.Shape.POLYGON]=k,t[e.Shape.PATH]=w,t[e.Shape.TEXT]=void 0,t[e.Shape.GROUP]=void 0,t[e.Shape.IMAGE]=void 0,t[e.Shape.HTML]=void 0,t[e.Shape.MESH]=void 0,t);this.context.pathGeneratorFactory=n},n.prototype.destroy=function(){delete this.context.pathGeneratorFactory},n}(e.AbstractRendererPlugin),I=Object.freeze({__proto__:null,Plugin:R});function N(t,e,n,r){var a=t-n,i=e-r;return Math.sqrt(a*a+i*i)}var B=1e-4;function D(t,e,n,r,a,i){var o=-1,l=1/0,h=[n,r],u=20;i&&i>200&&(u=i/10);for(var d=1/u,p=d/10,f=0;u>=f;f++){var v=f*d,y=[a.apply(void 0,c([],s(t.concat([v])),!1)),a.apply(void 0,c([],s(e.concat([v])),!1))];l>(M=N(h[0],h[1],y[0],y[1]))&&(o=v,l=M)}if(0===o)return{x:t[0],y:e[0]};if(1===o){var g=t.length;return{x:t[g-1],y:e[g-1]}}l=1/0;for(f=0;32>f&&B<=p;f++){var m=o-p,E=o+p,M=(y=[a.apply(void 0,c([],s(t.concat([m])),!1)),a.apply(void 0,c([],s(e.concat([m])),!1))],N(h[0],h[1],y[0],y[1]));if(m>=0&&l>M)o=m,l=M;else{var x=[a.apply(void 0,c([],s(t.concat([E])),!1)),a.apply(void 0,c([],s(e.concat([E])),!1))],b=N(h[0],h[1],x[0],x[1]);1>=E&&l>b?(o=E,l=b):p*=.5}}return{x:a.apply(void 0,c([],s(t.concat([o])),!1)),y:a.apply(void 0,c([],s(e.concat([o])),!1))}}function F(t,e,n,r,a,i){var o=[n-t,r-e];if(function(t,e){return t[0]===e[0]&&t[1]===e[1]}(o,[0,0]))return Math.sqrt((a-t)*(a-t)+(i-e)*(i-e));var s=[-o[1],o[0]];return function(t,e){var n=e[0],r=e[1],a=n*n+r*r;a>0&&(a=1/Math.sqrt(a)),t[0]=e[0]*a,t[1]=e[1]*a}(s,s),Math.abs(function(t,e){return t[0]*e[0]+t[1]*e[1]}([a-t,i-e],s))}function G(t,e,n,r,a){var i=1-a;return i*i*i*t+3*e*a*i*i+3*n*a*a*i+r*a*a*a}function j(t,e,n,r,a,i,o,s,c,l,h){var u=function(t,e,n,r,a,i,o,s,c,l,h){return D([t,n,a,o],[e,r,i,s],c,l,G,h)}(t,e,n,r,a,i,o,s,c,l,h);return N(u.x,u.y,c,l)}function _(t,e,n,r){var a=1-r;return a*a*t+2*r*a*e+r*r*n}function H(t,e,n,r,a,i,o,s){var c=function(t,e,n,r,a,i,o,s){return D([t,n,a],[e,r,i],o,s,_)}(t,e,n,r,a,i,o,s);return N(c.x,c.y,o,s)}var $=f(),W=f(),U=f(),Y=h(),X=function(){function t(){var t=this;this.isHit=function(n,r,a,i){var o,s,c,l,h,u,d,p,f,g,m,E,M,x,b,S,P,C,T,A,w,k,O,L,R,I,N,B,D,F,G,j=t.context.pointInPathPickerFactory[n.nodeName];if(j){var _=(o=Y,(G=(T=(c=(s=a)[0])*(p=s[5])-(l=s[1])*(d=s[4]))*(F=(M=s[10])*(C=s[15])-(x=s[11])*(P=s[14]))-(A=c*(f=s[6])-(h=s[2])*d)*(D=(E=s[9])*C-x*(S=s[13]))+(w=c*(g=s[7])-(u=s[3])*d)*(B=E*P-M*S)+(k=l*f-h*p)*(N=(m=s[8])*C-x*(b=s[12]))-(O=l*g-u*p)*(I=m*P-M*b)+(L=h*g-u*f)*(R=m*S-E*b))?(o[0]=(p*F-f*D+g*B)*(G=1/G),o[1]=(h*D-l*F-u*B)*G,o[2]=(S*L-P*O+C*k)*G,o[3]=(M*O-E*L-x*k)*G,o[4]=(f*N-d*F-g*I)*G,o[5]=(c*F-h*N+u*I)*G,o[6]=(P*w-b*L-C*A)*G,o[7]=(m*L-M*w+x*A)*G,o[8]=(d*D-p*N+g*R)*G,o[9]=(l*N-c*D-u*R)*G,o[10]=(b*O-S*w+C*T)*G,o[11]=(E*w-m*O-x*T)*G,o[12]=(p*I-d*B-f*R)*G,o[13]=(c*B-l*I+h*R)*G,o[14]=(S*A-b*k-P*T)*G,o[15]=(m*k-E*A+M*T)*G,o):null),H=y(W,v(U,r[0],r[1],0),_),$=n.getGeometryBounds().halfExtents,X=n.parsedStyle.anchor;if(H[0]+=(X&&X[0]||0)*$[0]*2,H[1]+=(X&&X[1]||0)*$[1]*2,j(n,new e.Point(H[0],H[1]),i,t.isPointInPath,t.context,t.runtime))return!0}return!1},this.isPointInPath=function(e,n){var r=t.runtime.offscreenCanvasCreator.getOrCreateContext(t.context.config.offscreenCanvas),a=t.context.pathGeneratorFactory[e.nodeName];return a&&(r.beginPath(),a(r,e.parsedStyle),r.closePath()),r.isPointInPath(n.x,n.y)}}return t.prototype.apply=function(e,n){var r,a=this,s=e.renderingService,c=e.renderingContext;this.context=e,this.runtime=n;var l=null===(r=c.root)||void 0===r?void 0:r.ownerDocument;s.hooks.pick.tapPromise(t.tag,(function(t){return i(a,void 0,void 0,(function(){return o(this,(function(e){return[2,this.pick(l,t)]}))}))})),s.hooks.pickSync.tap(t.tag,(function(t){return a.pick(l,t)}))},t.prototype.pick=function(t,n){var r,a,i=n.topmost,o=n.position,s=v($,o.x,o.y,0),c=t.elementsFromBBox(s[0],s[1],s[0],s[1]),l=[];try{for(var h=function(t){var e="function"==typeof Symbol&&Symbol.iterator,n=e&&t[e],r=0;if(n)return n.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&r>=t.length&&(t=void 0),{value:t&&t[r++],done:!t}}};throw new TypeError(e?"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=e.findClosestClipPathTarget(d);if(f){var y=f.parsedStyle.clipPath;if(this.isHit(y,s,y.getWorldTransform(),!0)){if(i)return n.picked=[d],n;l.push(d)}}else{if(i)return n.picked=[d],n;l.push(d)}}}}catch(t){r={error:t}}finally{try{u&&!u.done&&(a=h.return)&&a.call(h)}finally{if(r)throw r.error}}return n.picked=l,n},t.tag="CanvasPicker",t}();function z(t,n,r){var a=t.parsedStyle,i=a.r,o=a.fill,c=a.stroke,l=a.pointerEvents,h=((a.lineWidth||0)+(a.increasedLineWidthForHitTesting||0))/2,u=N(i,i,n.x,n.y),d=s(e.isFillOrStrokeAffected(l,o,c),2),p=d[0],f=d[1];return p&&f||r?i+h>=u:p?i>=u:!!f&&(u>=i-h&&i+h>=u)}function q(t,e,n,r){return t/(n*n)+e/(r*r)}function Q(t,n,r){var a=t.parsedStyle,i=a.rx,o=a.ry,c=a.lineWidth,l=a.increasedLineWidthForHitTesting,h=n.x,u=n.y,d=s(e.isFillOrStrokeAffected(a.pointerEvents,a.fill,a.stroke),2),p=d[0],f=d[1],v=((c||0)+(l||0))/2,y=(h-i)*(h-i),g=(u-o)*(u-o);return p&&f||r?1>=q(y,g,i+v,o+v):p?1>=q(y,g,i,o):!!f&&(q(y,g,i-v,o-v)>=1&&1>=q(y,g,i+v,o+v))}function V(t,e,n,r,a,i){return!(t>a||a>t+n||e>i||i>e+r)}function Z(t,e,n,r,a,i,o,s){var c=(Math.atan2(s-e,o-t)+2*Math.PI)%(2*Math.PI),l={x:t+n*Math.cos(c),y:e+n*Math.sin(c)};return N(l.x,l.y,o,s)<=i/2}function J(t,e,n,r,a,i,o){var s=a/2;return!(Math.min(t,n)-s>i||i>Math.max(t,n)+s||Math.min(e,r)-s>o||o>Math.max(e,r)+s)&&F(t,e,n,r,i,o)<=a/2}function K(t,e,n,r,a){var i=t.length;if(2>i)return!1;for(var o=0;i-1>o;o++){if(J(t[o][0],t[o][1],t[o+1][0],t[o+1][1],e,n,r))return!0}if(a){var s=t[0],c=t[i-1];if(J(s[0],s[1],c[0],c[1],e,n,r))return!0}return!1}var tt=1e-6;function et(t){return tt>Math.abs(t)?0:0>t?-1:1}function nt(t,e,n){return!((n[0]-t[0])*(e[1]-t[1])!=(e[0]-t[0])*(n[1]-t[1])||Math.min(t[0],e[0])>n[0]||n[0]>Math.max(t[0],e[0])||Math.min(t[1],e[1])>n[1]||n[1]>Math.max(t[1],e[1]))}function rt(t,e,n){var r=!1,a=t.length;if(2>=a)return!1;for(var i=0;a>i;i++){var o=t[i],s=t[(i+1)%a];if(nt(o,s,[e,n]))return!0;et(o[1]-n)>0!=et(s[1]-n)>0&&0>et(e-(n-o[1])*(o[0]-s[0])/(o[1]-s[1])-o[0])&&(r=!r)}return r}function at(t,e,n){for(var r=!1,a=0;t.length>a;a++){if(r=rt(t[a],e,n))break}return r}function it(t,n,r){var a=t.parsedStyle,i=a.x1,o=a.y1,c=a.x2,l=a.y2,h=a.lineWidth,u=a.increasedLineWidthForHitTesting,d=a.defX,p=void 0===d?0:d,f=a.defY,v=void 0===f?0:f;return!(!s(e.isFillOrStrokeAffected(a.pointerEvents,a.fill,a.stroke),2)[1]&&!r||!h)&&J(i,o,c,l,(h||0)+(u||0),n.x+p,n.y+v)}function ot(t,n,r,a,i,o){var c=t.parsedStyle,l=c.lineWidth,h=c.increasedLineWidthForHitTesting,u=c.defX,d=void 0===u?0:u,p=c.defY,f=void 0===p?0:p,v=c.path,y=v.segments,g=v.hasArc,E=v.polylines,M=v.polygons,x=s(e.isFillOrStrokeAffected(c.pointerEvents,(null==M?void 0:M.length)&&c.fill,c.stroke),2),b=x[0],S=x[1],P=e.getOrCalculatePathTotalLength(t),C=!1;return b||r?C=g?a(t,n):at(M,n.x+d,n.y+f)||at(E,n.x+d,n.y+f):((S||r)&&(C=function(t,e,n,r,a){for(var i=!1,o=e/2,s=0;t.length>s;s++){var c=t[s],l=c.currentPoint,h=c.params,u=c.prePoint,d=c.box;if(!d||V(d.x-o,d.y-o,d.width+e,d.height+e,n,r))switch(c.command){case"L":case"Z":if(i=J(u[0],u[1],l[0],l[1],e,n,r))return!0;break;case"Q":if(i=e/2>=H(u[0],u[1],h[1],h[2],h[3],h[4],n,r))return!0;break;case"C":if(i=e/2>=j(u[0],u[1],h[1],h[2],h[3],h[4],h[5],h[6],n,r,a))return!0;break;case"A":c.cubicParams||(c.cubicParams=m(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=j(f[0],f[1],p[v],p[v+1],p[v+2],p[v+3],p[v+4],p[v+5],n,r,a);if(f=[p[v+4],p[v+5]],i=e/2>=y)return!0}}}return i}(y,(l||0)+(h||0),n.x+d,n.y+f,P)),C)}function st(t,n,r){var a=t.parsedStyle,i=a.lineWidth,o=a.increasedLineWidthForHitTesting,c=a.points,l=a.defX,h=void 0===l?0:l,u=a.defY,d=void 0===u?0:u,p=s(e.isFillOrStrokeAffected(a.pointerEvents,a.fill,a.stroke),2),f=p[0],v=!1;return(p[1]||r)&&(v=K(c.points,(i||0)+(o||0),n.x+h,n.y+d,!0)),v||!f&&!r||(v=rt(c.points,n.x+h,n.y+d)),v}function ct(t,n,r){var a=t.parsedStyle,i=a.lineWidth,o=a.increasedLineWidthForHitTesting,c=a.points,l=a.defX,h=void 0===l?0:l,u=a.defY,d=void 0===u?0:u;return!(!s(e.isFillOrStrokeAffected(a.pointerEvents,a.fill,a.stroke),2)[1]&&!r||!i)&&K(c.points,(i||0)+(o||0),n.x+h,n.y+d,!1)}function lt(t,n,r,a,i){var o=t.parsedStyle,c=o.radius,l=o.lineWidth,h=o.increasedLineWidthForHitTesting,u=o.width,d=o.height,p=s(e.isFillOrStrokeAffected(o.pointerEvents,o.fill,o.stroke),2),f=p[0],v=p[1],y=(l||0)+(h||0);if(c&&c.some((function(t){return 0!==t}))){var g=!1;return(v||r)&&(g=function(t,e,n,r,a,i,o,c){var l=s(a,4),h=l[0],u=l[1],d=l[2],p=l[3];return J(t+h,e,t+n-u,e,i,o,c)||J(t+n,e+u,t+n,e+r-d,i,o,c)||J(t+n-d,e+r,t+p,e+r,i,o,c)||J(t,e+r-p,t,e+h,i,o,c)||Z(t+n-u,e+u,u,0,0,i,o,c)||Z(t+n-d,e+r-d,d,0,0,i,o,c)||Z(t+p,e+r-p,p,0,0,i,o,c)||Z(t+h,e+h,h,0,0,i,o,c)}(0,0,u,d,c.map((function(t){return S(t,0,Math.min(Math.abs(u)/2,Math.abs(d)/2))})),y,n.x,n.y)),g||!f&&!r||(g=a(t,n)),g}var m=y/2;return f&&v||r?V(0-m,0-m,u+m,d+m,n.x,n.y):f?V(0,0,u,d,n.x,n.y):!!v&&function(t,e,n,r,a,i,o){var s=a/2;return V(t-s,e-s,n,a,i,o)||V(t+n-s,e-s,a,r,i,o)||V(t+s,e+r-s,n,a,i,o)||V(t-s,e+s,a,r,i,o)}(0,0,u,d,y,n.x,n.y)}function ht(t,n,r,a,i,o){var s=t.parsedStyle,c=s.width,l=s.height;if("non-transparent-pixel"===s.pointerEvents){var h=i.config.offscreenCanvas,u=o.offscreenCanvasCreator.getOrCreateCanvas(h),d=o.offscreenCanvasCreator.getOrCreateContext(h,{willReadFrequently:!0});return u.width=c,u.height=l,i.defaultStyleRendererFactory[e.Shape.IMAGE].render(d,t.parsedStyle,t,void 0,void 0,void 0),d.getImageData(n.x,n.y,1,1).data.every((function(t){return 0!==t}))}return!0}var ut=function(t){function n(){var e=null!==t&&t.apply(this,arguments)||this;return e.name="canvas-picker",e}return r(n,t),n.prototype.init=function(){var t,n=((t={})[e.Shape.CIRCLE]=z,t[e.Shape.ELLIPSE]=Q,t[e.Shape.RECT]=lt,t[e.Shape.LINE]=it,t[e.Shape.POLYLINE]=ct,t[e.Shape.POLYGON]=st,t[e.Shape.PATH]=ot,t[e.Shape.TEXT]=function(){return!0},t[e.Shape.GROUP]=null,t[e.Shape.IMAGE]=ht,t[e.Shape.HTML]=null,t[e.Shape.MESH]=null,t);this.context.pointInPathPickerFactory=n,this.addRenderingPlugin(new X)},n.prototype.destroy=function(){delete this.context.pointInPathPickerFactory,this.removeAllRenderingPlugins()},n}(e.AbstractRendererPlugin),dt=Object.freeze({__proto__:null,Plugin:ut}),pt=function(){function t(t){this.canvasRendererPluginOptions=t,this.removedRBushNodeAABBs=[],this.renderQueue=[],this.restoreStack=[],this.clearFullScreen=!1,this.vpMatrix=h(),this.dprMatrix=h(),this.tmpMat4=h(),this.vec3a=f(),this.vec3b=f(),this.vec3c=f(),this.vec3d=f()}return t.prototype.apply=function(n,r){var a=this;this.context=n;var i=n.config,o=n.camera,l=n.renderingService,h=n.renderingContext,u=n.pathGeneratorFactory;this.rBush=n.rBushRoot,this.pathGeneratorFactory=u;var p=n.contextService,f=h.root.ownerDocument.defaultView,v=function(t){var e=t.target.rBushNode;e.aabb&&a.removedRBushNodeAABBs.push(e.aabb)},g=function(t){var e=t.target.rBushNode;e.aabb&&a.removedRBushNodeAABBs.push(e.aabb)};l.hooks.init.tap(t.tag,(function(){f.addEventListener(e.ElementEvent.UNMOUNTED,v),f.addEventListener(e.ElementEvent.CULLED,g);var t=p.getDPR(),n=i.width,r=i.height,o=p.getContext();a.clearRect(o,0,0,n*t,r*t,i.background)})),l.hooks.destroy.tap(t.tag,(function(){f.removeEventListener(e.ElementEvent.UNMOUNTED,v),f.removeEventListener(e.ElementEvent.CULLED,g),a.renderQueue=[],a.removedRBushNodeAABBs=[],a.restoreStack=[]})),l.hooks.beginFrame.tap(t.tag,(function(){var t=p.getContext(),e=p.getDPR(),n=i.width,r=i.height,o=a.canvasRendererPluginOptions,s=o.dirtyObjectNumThreshold,c=o.dirtyObjectRatioThreshold,h=l.getStats(),u=h.rendered,d=u/h.total;a.clearFullScreen=l.disableDirtyRectangleRendering()||u>s&&d>c,t&&(t.resetTransform?t.resetTransform():t.setTransform(1,0,0,1,0,0),a.clearFullScreen&&a.clearRect(t,0,0,n*e,r*e,i.background))}));var m=function(t,e){t.isVisible()&&!t.isCulled()&&(a.renderDisplayObject(t,e,a.context,a.restoreStack,r),a.saveDirtyAABB(t)),(t.sortable.sorted||t.childNodes).forEach((function(t){m(t,e)}))};l.hooks.endFrame.tap(t.tag,(function(){var t,n,l=p.getContext(),u=p.getDPR();if((t=a.dprMatrix)[0]=(n=[u,u,1])[0],t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=n[1],t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=n[2],t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,d(a.vpMatrix,a.dprMatrix,o.getOrthoMatrix()),a.clearFullScreen)m(h.root,l);else{var v=a.safeMergeAABB.apply(a,c([a.mergeDirtyAABBs(a.renderQueue)],s(a.removedRBushNodeAABBs.map((function(t){var n=t.minX,r=t.minY,a=t.maxX,i=t.maxY,o=new e.AABB;return o.setMinMax([n,r,0],[a,i,0]),o}))),!1));if(a.removedRBushNodeAABBs=[],e.AABB.isEmpty(v))return void(a.renderQueue=[]);var g=a.convertAABB2Rect(v),E=g.x,M=g.y,x=g.width,b=g.height,S=y(a.vec3a,[E,M,0],a.vpMatrix),P=y(a.vec3b,[E+x,M,0],a.vpMatrix),C=y(a.vec3c,[E,M+b,0],a.vpMatrix),T=y(a.vec3d,[E+x,M+b,0],a.vpMatrix),A=Math.min(S[0],P[0],T[0],C[0]),w=Math.min(S[1],P[1],T[1],C[1]),k=Math.max(S[0],P[0],T[0],C[0]),O=Math.max(S[1],P[1],T[1],C[1]),L=Math.floor(A),R=Math.floor(w),I=Math.ceil(k-A),N=Math.ceil(O-w);l.save(),a.clearRect(l,L,R,I,N,i.background),l.beginPath(),l.rect(L,R,I,N),l.clip(),l.setTransform(a.vpMatrix[0],a.vpMatrix[1],a.vpMatrix[4],a.vpMatrix[5],a.vpMatrix[12],a.vpMatrix[13]),i.renderer.getConfig().enableDirtyRectangleRenderingDebug&&f.dispatchEvent(new e.CustomEvent(e.CanvasEvent.DIRTY_RECTANGLE,{dirtyRect:{x:L,y:R,width:I,height:N}})),a.searchDirtyObjects(v).sort((function(t,e){return t.sortable.renderOrder-e.sortable.renderOrder})).forEach((function(t){t&&t.isVisible()&&!t.isCulled()&&a.renderDisplayObject(t,l,a.context,a.restoreStack,r)})),l.restore(),a.renderQueue.forEach((function(t){a.saveDirtyAABB(t)})),a.renderQueue=[]}a.restoreStack.forEach((function(){l.restore()})),a.restoreStack=[]})),l.hooks.render.tap(t.tag,(function(t){a.clearFullScreen||a.renderQueue.push(t)}))},t.prototype.clearRect=function(t,e,n,r,a,i){t.clearRect(e,n,r,a),i&&(t.fillStyle=i,t.fillRect(e,n,r,a))},t.prototype.renderDisplayObject=function(t,n,r,a,i){var o=t.nodeName,s=a[a.length-1];!s||t.compareDocumentPosition(s)&e.Node.DOCUMENT_POSITION_CONTAINS||(n.restore(),a.pop());var c=this.context.styleRendererFactory[o],l=this.pathGeneratorFactory[o],h=t.parsedStyle.clipPath;if(h){this.applyWorldTransform(n,h);var u=this.pathGeneratorFactory[h.nodeName];u&&(n.save(),a.push(t),n.beginPath(),u(n,h.parsedStyle),n.closePath(),n.clip())}c&&(this.applyWorldTransform(n,t),n.save(),this.applyAttributesToContext(n,t)),l&&(n.beginPath(),l(n,t.parsedStyle),t.nodeName!==e.Shape.LINE&&t.nodeName!==e.Shape.PATH&&t.nodeName!==e.Shape.POLYLINE&&n.closePath()),c&&(c.render(n,t.parsedStyle,t,r,this,i),n.restore()),t.renderable.dirty=!1},t.prototype.convertAABB2Rect=function(t){var e=t.getMin(),n=t.getMax(),r=Math.floor(e[0]),a=Math.floor(e[1]);return{x:r,y:a,width:Math.ceil(n[0])-r,height:Math.ceil(n[1])-a}},t.prototype.mergeDirtyAABBs=function(t){var n=new e.AABB;return t.forEach((function(t){var e=t.getRenderBounds();n.add(e);var r=t.renderable.dirtyRenderBounds;r&&n.add(r)})),n},t.prototype.searchDirtyObjects=function(t){var e=s(t.getMin(),2),n=e[0],r=e[1],a=s(t.getMax(),2);return this.rBush.search({minX:n,minY:r,maxX:a[0],maxY:a[1]}).map((function(t){return t.displayObject}))},t.prototype.saveDirtyAABB=function(t){var n=t.renderable;n.dirtyRenderBounds||(n.dirtyRenderBounds=new e.AABB);var r=t.getRenderBounds();r&&n.dirtyRenderBounds.update(r.center,r.halfExtents)},t.prototype.applyAttributesToContext=function(t,e){var n=e.parsedStyle,r=n.stroke,a=n.fill,i=n.opacity,o=n.lineDash,s=n.lineDashOffset;o&&t.setLineDash(o),E(s)||(t.lineDashOffset=s),E(i)||(t.globalAlpha*=i),E(r)||Array.isArray(r)||r.isNone||(t.strokeStyle=e.attributes.stroke),E(a)||Array.isArray(a)||a.isNone||(t.fillStyle=e.attributes.fill)},t.prototype.applyWorldTransform=function(t,e,n){var r=0,a=0,i=(e.parsedStyle||{}).anchor,o=i&&i[0]||0,s=i&&i[1]||0;if(0!==o||0!==s){var c=e.geometry.contentBounds;r=-o*(c&&2*c.halfExtents[0]||0),a=-s*(c&&2*c.halfExtents[1]||0)}n?(u(this.tmpMat4,e.getLocalTransform()),this.vec3a[0]=r,this.vec3a[1]=a,this.vec3a[2]=0,p(this.tmpMat4,this.tmpMat4,this.vec3a),d(this.tmpMat4,n,this.tmpMat4),d(this.tmpMat4,this.vpMatrix,this.tmpMat4)):(u(this.tmpMat4,e.getWorldTransform()),this.vec3a[0]=r,this.vec3a[1]=a,this.vec3a[2]=0,p(this.tmpMat4,this.tmpMat4,this.vec3a),d(this.tmpMat4,this.vpMatrix,this.tmpMat4)),t.setTransform(this.tmpMat4[0],this.tmpMat4[1],this.tmpMat4[4],this.tmpMat4[5],this.tmpMat4[12],this.tmpMat4[13])},t.prototype.safeMergeAABB=function(){for(var t=[],n=0;arguments.length>n;n++)t[n]=arguments[n];var r=new e.AABB;return t.forEach((function(t){r.add(t)})),r},t.tag="CanvasRenderer",t}(),ft=function(){function t(t){this.imagePool=t}return t.prototype.render=function(t,n,r,a,i,o){var s=n.fill,c=n.fillRule,l=n.opacity,h=n.fillOpacity,u=n.stroke,d=n.strokeOpacity,p=n.lineWidth,f=n.lineCap,v=n.lineJoin,y=n.shadowType,g=n.shadowColor,m=n.shadowBlur,M=n.filter,x=n.miterLimit,b=!E(s)&&!s.isNone,S=!E(u)&&!u.isNone&&p>0,P=0===s.alpha,C=!(!M||!M.length),T=!E(g)&&m>0,A=r.nodeName,w="inner"===y,k=S&&T&&(A===e.Shape.PATH||A===e.Shape.LINE||A===e.Shape.POLYLINE||P||w);b&&(t.globalAlpha=l*h,k||vt(r,t,T),this.fill(t,r,s,c,a,i,o),k||this.clearShadowAndFilter(t,C,T)),S&&(t.globalAlpha=l*d,t.lineWidth=p,E(x)||(t.miterLimit=x),E(f)||(t.lineCap=f),E(v)||(t.lineJoin=v),k&&(w&&(t.globalCompositeOperation="source-atop"),vt(r,t,!0),w&&(this.stroke(t,r,u,a,i,o),t.globalCompositeOperation="source-over",this.clearShadowAndFilter(t,C,!0))),this.stroke(t,r,u,a,i,o))},t.prototype.clearShadowAndFilter=function(t,e,n){if(n&&(t.shadowColor="transparent",t.shadowBlur=0),e){var r=t.filter;!E(r)&&r.indexOf("drop-shadow")>-1&&(t.filter=r.replace(/drop-shadow\([^)]*\)/,"").trim()||"none")}},t.prototype.fill=function(t,n,r,a,i,o,s){var c=this;Array.isArray(r)?r.forEach((function(e){t.fillStyle=c.getColor(e,n,t),a?t.fill(a):t.fill()})):(e.isPattern(r)&&(t.fillStyle=this.getPattern(r,n,t,i,o,s)),a?t.fill(a):t.fill())},t.prototype.stroke=function(t,n,r,a,i,o){var s=this;Array.isArray(r)?r.forEach((function(e){t.strokeStyle=s.getColor(e,n,t),t.stroke()})):(e.isPattern(r)&&(t.strokeStyle=this.getPattern(r,n,t,a,i,o)),t.stroke())},t.prototype.getPattern=function(t,e,n,r,a,i){var o,s;if("rect"===t.image.nodeName){var c=t.image.parsedStyle,l=c.width,h=c.height;s=r.contextService.getDPR();var u=r.config.offscreenCanvas;(o=i.offscreenCanvasCreator.getOrCreateCanvas(u)).width=l*s,o.height=h*s;var d=i.offscreenCanvasCreator.getOrCreateContext(u),p=[];t.image.forEach((function(t){a.renderDisplayObject(t,d,r,p,i)})),p.forEach((function(){d.restore()}))}return this.imagePool.getOrCreatePatternSync(t,n,o,s,(function(){e.renderable.dirty=!0,r.renderingService.dirtify()}))},t.prototype.getColor=function(t,n,r){var i;if(t.type===e.GradientType.LinearGradient||t.type===e.GradientType.RadialGradient){var o=n.getGeometryBounds(),s=o&&2*o.halfExtents[0]||1,c=o&&2*o.halfExtents[1]||1;i=this.imagePool.getOrCreateGradient(a(a({type:t.type},t.value),{width:s,height:c}),r)}return i},t}();function vt(t,e,n){var r=t.parsedStyle,a=r.filter,i=r.shadowColor,o=r.shadowBlur,s=r.shadowOffsetX,c=r.shadowOffsetY;a&&a.length&&(e.filter=t.style.filter),n&&(e.shadowColor=""+i,e.shadowBlur=o||0,e.shadowOffsetX=s||0,e.shadowOffsetY=c||0)}var yt=function(){function t(t){this.imagePool=t}return t.prototype.render=function(t,e,n){var r,a=e.img,i=e.shadowColor,o=e.shadowBlur,s=e.width,c=e.height;if(b(a)?r=this.imagePool.getImageSync(a):(s||(s=a.width),c||(c=a.height),r=a),r){vt(n,t,!E(i)&&o>0);try{t.drawImage(r,0,0,s,c)}catch(t){}}},t}(),gt=function(){function t(){}return t.prototype.render=function(t,e,n,r,a,i){var o=e.lineWidth,s=e.textAlign,c=e.textBaseline,l=e.lineJoin,h=e.miterLimit,u=e.letterSpacing,d=e.stroke,p=e.fill,f=e.fillOpacity,v=e.strokeOpacity,y=e.opacity,g=e.metrics,m=e.dx,M=e.dy,x=e.shadowColor,b=e.shadowBlur,S=g.lines,P=g.height,C=g.lineHeight,T=g.lineMetrics;t.font=g.font,t.lineWidth=o,t.textAlign="middle"===s?"center":s;var A=c;i.enableCSSParsing||"alphabetic"!==A||(A="bottom"),t.lineJoin=l,E(h)||(t.miterLimit=h);var w=0;"middle"===c?w=-P/2-C/2:"bottom"===c||"alphabetic"===c||"ideographic"===c?w=-P:"top"!==c&&"hanging"!==c||(w=-C);var k=m||0;w+=M||0,1===S.length&&("bottom"===A?(A="middle",w-=.5*P):"top"===A&&(A="middle",w+=.5*P)),t.textBaseline=A,vt(n,t,!E(x)&&b>0);for(var O=0;S.length>O;O++){var L=o/2+k;w+=C,E(d)||d.isNone||!o||this.drawLetterSpacing(t,S[O],T[O],s,L,w,u,f,v,y,!0),E(p)||this.drawLetterSpacing(t,S[O],T[O],s,L,w,u,f,v,y)}},t.prototype.drawLetterSpacing=function(t,e,n,r,a,i,o,s,c,l,h){if(void 0===h&&(h=!1),0!==o){var u=t.textAlign;t.textAlign="left";var d=a;"center"===r||"middle"===r?d=a-n.width/2:"right"!==r&&"end"!==r||(d=a-n.width);for(var p=Array.from(e),f=t.measureText(e).width,v=0,y=0;p.length>y;++y){var g=p[y];h?this.strokeText(t,g,d,i,c):this.fillText(t,g,d,i,s,l),d+=f-(v=t.measureText(e.substring(y+1)).width)+o,f=v}t.textAlign=u}else h?this.strokeText(t,e,a,i,c):this.fillText(t,e,a,i,s,l)},t.prototype.fillText=function(t,e,n,r,a,i){var o,s=!E(a)&&1!==a;s&&(o=t.globalAlpha,t.globalAlpha=a*i),t.fillText(e,n,r),s&&(t.globalAlpha=o)},t.prototype.strokeText=function(t,e,n,r,a){var i,o=!E(a)&&1!==a;o&&(i=t.globalAlpha,t.globalAlpha=a),t.strokeText(e,n,r),o&&(t.globalAlpha=i)},t}(),mt=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return r(e,t),e}(ft),Et=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return r(e,t),e}(ft),Mt=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return r(e,t),e}(ft),xt=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return r(e,t),e}(ft),bt=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return r(e,t),e}(ft),St=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return r(e,t),e}(ft),Pt=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return r(e,t),e}(ft),Ct=function(t){function n(e){void 0===e&&(e={});var n=t.call(this)||this;return n.options=e,n.name="canvas-renderer",n}return r(n,t),n.prototype.init=function(){var t,n=a({dirtyObjectNumThreshold:500,dirtyObjectRatioThreshold:.8},this.options),r=this.context.imagePool,i=new ft(r),o=((t={})[e.Shape.CIRCLE]=i,t[e.Shape.ELLIPSE]=i,t[e.Shape.RECT]=i,t[e.Shape.IMAGE]=new yt(r),t[e.Shape.TEXT]=new gt,t[e.Shape.LINE]=i,t[e.Shape.POLYLINE]=i,t[e.Shape.POLYGON]=i,t[e.Shape.PATH]=i,t[e.Shape.GROUP]=void 0,t[e.Shape.HTML]=void 0,t[e.Shape.MESH]=void 0,t);this.context.defaultStyleRendererFactory=o,this.context.styleRendererFactory=o,this.addRenderingPlugin(new pt(n))},n.prototype.destroy=function(){this.removeAllRenderingPlugins(),delete this.context.defaultStyleRendererFactory,delete this.context.styleRendererFactory},n}(e.AbstractRendererPlugin),Tt=Object.freeze({__proto__:null,CircleRenderer:Et,EllipseRenderer:Mt,ImageRenderer:yt,LineRenderer:xt,PathRenderer:Pt,Plugin:Ct,PolygonRenderer:St,PolylineRenderer:bt,RectRenderer:mt,TextRenderer:gt}),At=function(){function t(){}return t.prototype.apply=function(e,n){var r=this,a=e.renderingService,i=e.renderingContext,o=e.config;this.context=e;var s=i.root.ownerDocument.defaultView,c=function(t){a.hooks.pointerMove.call(t)},l=function(t){a.hooks.pointerUp.call(t)},h=function(t){a.hooks.pointerDown.call(t)},u=function(t){a.hooks.pointerOver.call(t)},d=function(t){a.hooks.pointerOut.call(t)},p=function(t){a.hooks.pointerCancel.call(t)},f=function(t){a.hooks.pointerWheel.call(t)},v=function(t){a.hooks.click.call(t)};a.hooks.init.tap(t.tag,(function(){var t=r.context.contextService.getDomElement();n.globalThis.navigator.msPointerEnabled?(t.style.msContentZooming="none",t.style.msTouchAction="none"):s.supportsPointerEvents&&(t.style.touchAction="none"),s.supportsPointerEvents?function(t){n.globalThis.document.addEventListener("pointermove",c,!0),t.addEventListener("pointerdown",h,!0),t.addEventListener("pointerleave",d,!0),t.addEventListener("pointerover",u,!0),n.globalThis.addEventListener("pointerup",l,!0),n.globalThis.addEventListener("pointercancel",p,!0)}(t):function(t){n.globalThis.document.addEventListener("mousemove",c,!0),t.addEventListener("mousedown",h,!0),t.addEventListener("mouseout",d,!0),t.addEventListener("mouseover",u,!0),n.globalThis.addEventListener("mouseup",l,!0)}(t),s.supportsTouchEvents&&function(t){t.addEventListener("touchstart",h,!0),t.addEventListener("touchend",l,!0),t.addEventListener("touchmove",c,!0),t.addEventListener("touchcancel",p,!0)}(t),o.useNativeClickEvent&&t.addEventListener("click",v,!0),t.addEventListener("wheel",f,{passive:!0,capture:!0})})),a.hooks.destroy.tap(t.tag,(function(){var t=r.context.contextService.getDomElement();n.globalThis.navigator.msPointerEnabled?(t.style.msContentZooming="",t.style.msTouchAction=""):s.supportsPointerEvents&&(t.style.touchAction=""),s.supportsPointerEvents?function(t){n.globalThis.document.removeEventListener("pointermove",c,!0),t.removeEventListener("pointerdown",h,!0),t.removeEventListener("pointerleave",d,!0),t.removeEventListener("pointerover",u,!0),n.globalThis.removeEventListener("pointerup",l,!0)}(t):function(t){n.globalThis.document.removeEventListener("mousemove",c,!0),t.removeEventListener("mousedown",h,!0),t.removeEventListener("mouseout",d,!0),t.removeEventListener("mouseover",u,!0),n.globalThis.removeEventListener("mouseup",l,!0)}(t),s.supportsTouchEvents&&function(t){t.removeEventListener("touchstart",h,!0),t.removeEventListener("touchend",l,!0),t.removeEventListener("touchmove",c,!0),t.removeEventListener("touchcancel",p,!0)}(t),o.useNativeClickEvent&&t.removeEventListener("click",v,!0),t.removeEventListener("wheel",f,!0)}))},t.tag="DOMInteraction",t}(),wt=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.name="dom-interaction",e}return r(e,t),e.prototype.init=function(){this.addRenderingPlugin(new At)},e.prototype.destroy=function(){this.removeAllRenderingPlugins()},e}(e.AbstractRendererPlugin),kt=Object.freeze({__proto__:null,Plugin:wt}),Ot=function(){function t(){this.displayObjectHTMLElementMap=new WeakMap}return t.prototype.joinTransformMatrix=function(t){return"matrix(".concat([t[0],t[1],t[4],t[5],t[12],t[13]].join(","),")")},t.prototype.apply=function(n,r){var a=this,i=n.camera,o=n.renderingContext,s=n.renderingService;this.context=n;var c=o.root.ownerDocument.defaultView,l=function(t,e){e.style.transform=a.joinTransformMatrix(t.getWorldTransform())},h=function(t){var n=t.target;if(n.nodeName===e.Shape.HTML){a.$camera||(a.$camera=a.createCamera(i));var o=a.getOrCreateEl(n);if(a.$camera.appendChild(o),r.enableCSSParsing){var s=n.ownerDocument.documentElement.attributes;Object.keys(s).forEach((function(t){o.style[t]=s[t]}))}Object.keys(n.attributes).forEach((function(t){a.updateAttribute(t,n)})),l(n,o),a.context.nativeHTMLMap.set(o,n)}},u=function(t){var n=t.target;if(n.nodeName===e.Shape.HTML&&a.$camera){var r=a.getOrCreateEl(n);r&&(r.remove(),a.context.nativeHTMLMap.delete(r))}},d=function(t){var n=t.target;n.nodeName===e.Shape.HTML&&a.updateAttribute(t.attrName,n)},p=function(t){var n=t.target;if(n.nodeName===e.Shape.HTML){var r=a.getOrCreateEl(n);l(n,r)}},f=function(){if(a.$camera){var t=a.context.config,e=t.height;a.$camera.style.width="".concat(t.width||0,"px"),a.$camera.style.height="".concat(e||0,"px")}};s.hooks.init.tap(t.tag,(function(){c.addEventListener(e.CanvasEvent.RESIZE,f),c.addEventListener(e.ElementEvent.MOUNTED,h),c.addEventListener(e.ElementEvent.UNMOUNTED,u),c.addEventListener(e.ElementEvent.ATTR_MODIFIED,d),c.addEventListener(e.ElementEvent.BOUNDS_CHANGED,p)})),s.hooks.endFrame.tap(t.tag,(function(){a.$camera&&o.renderReasons.has(e.RenderReason.CAMERA_CHANGED)&&(a.$camera.style.transform=a.joinTransformMatrix(i.getOrthoMatrix()))})),s.hooks.destroy.tap(t.tag,(function(){a.$camera&&a.$camera.remove(),c.removeEventListener(e.CanvasEvent.RESIZE,f),c.removeEventListener(e.ElementEvent.MOUNTED,h),c.removeEventListener(e.ElementEvent.UNMOUNTED,u),c.removeEventListener(e.ElementEvent.ATTR_MODIFIED,d),c.removeEventListener(e.ElementEvent.BOUNDS_CHANGED,p)}))},t.prototype.createCamera=function(t){var e=this.context.config,n=e.document,r=e.width,a=e.height,i=this.context.contextService.getDomElement(),o=i.parentNode;if(o){var s="g-canvas-camera",c=o.querySelector("#"+s);if(!c){var l=(n||document).createElement("div");c=l,l.id=s,l.style.position="absolute",l.style.left="".concat(i.offsetLeft||0,"px"),l.style.top="".concat(i.offsetTop||0,"px"),l.style.transformOrigin="left top",l.style.transform=this.joinTransformMatrix(t.getOrthoMatrix()),l.style.overflow="hidden",l.style.pointerEvents="none",l.style.width="".concat(r||0,"px"),l.style.height="".concat(a||0,"px"),o.appendChild(l)}return c}return null},t.prototype.getOrCreateEl=function(t){var e=this.context.config.document,n=this.displayObjectHTMLElementMap.get(t);return n||(n=(e||document).createElement("div"),t.parsedStyle.$el=n,this.displayObjectHTMLElementMap.set(t,n),t.id&&(n.id=t.id),t.name&&n.setAttribute("name",t.name),t.className&&(n.className=t.className),n.style.position="absolute",n.style.left="0px",n.style.top="0px",n.style["will-change"]="transform",n.style.transform=this.joinTransformMatrix(t.getWorldTransform())),n},t.prototype.updateAttribute=function(t,n){var r=this.getOrCreateEl(n);switch(t){case"innerHTML":var a=n.parsedStyle.innerHTML;b(a)?r.innerHTML=a:(r.innerHTML="",r.appendChild(a));break;case"transformOrigin":var i=n.parsedStyle.transformOrigin;r.style["transform-origin"]="".concat(i[0].value," ").concat(i[1].value);break;case"width":if(this.context.enableCSSParsing){var o=n.computedStyleMap().get("width");r.style.width=""+o}else{r.style.width=P(o=n.parsedStyle.width)?"".concat(o,"px"):""+o}break;case"height":if(this.context.enableCSSParsing){var s=n.computedStyleMap().get("height");r.style.height=""+s}else{r.style.height=P(s=n.parsedStyle.height)?"".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":r.style.pointerEvents=n.parsedStyle.pointerEvents;break;case"opacity":r.style.opacity="".concat(n.parsedStyle.opacity);break;case"fill":var c=n.parsedStyle.fill,l="";e.isCSSRGB(c)?l=c.isNone?"transparent":n.getAttribute("fill"):Array.isArray(c)?l=n.getAttribute("fill"):e.isPattern(c),r.style.background=l;break;case"stroke":var h=n.parsedStyle.stroke,u="";e.isCSSRGB(h)?u=h.isNone?"transparent":n.getAttribute("stroke"):Array.isArray(h)?u=n.getAttribute("stroke"):e.isPattern(h),r.style["border-color"]=u,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:"x"!==t&&"y"!==t&&(E(n.style[t])||""===n.style[t]||(r.style[t]=n.style[t]))}},t.tag="HTMLRendering",t}(),Lt=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.name="html-renderer",e}return r(e,t),e.prototype.init=function(){this.addRenderingPlugin(new Ot)},e.prototype.destroy=function(){this.removeAllRenderingPlugins()},e}(e.AbstractRendererPlugin),Rt=Object.freeze({__proto__:null,Plugin:Lt}),It=function(){function t(t){this.canvasConfig=t,this.imageCache={},this.gradientCache={},this.patternCache={}}return t.prototype.getImageSync=function(t,e){return this.imageCache[t]?e&&e(this.imageCache[t]):this.getOrCreateImage(t).then((function(t){e&&e(t)})),this.imageCache[t]},t.prototype.getOrCreateImage=function(t){var n=this;if(this.imageCache[t])return Promise.resolve(this.imageCache[t]);var r=this.canvasConfig.createImage;return new Promise((function(a,i){var o;r?o=r(t):e.isBrowser&&(o=new window.Image),o&&(o.onload=function(){n.imageCache[t]=o,a(o)},o.onerror=function(t){i(t)},o.crossOrigin="Anonymous",o.src=t)}))},t.prototype.getOrCreatePatternSync=function(t,n,r,a,i){var o=this.generatePatternKey(t);if(o&&this.patternCache[o])return this.patternCache[o];var s,c=t.image,l=t.repetition,u=t.transform,d=!1;b(c)?s=this.getImageSync(c,i):r?(s=r,d=!0):s=c;var p,f=s&&n.createPattern(s,l);if(f){var v=void 0;u?v=e.parsedTransformToMat4(e.parseTransform(u),new e.DisplayObject({})):((p=h())[0]=1,p[1]=0,p[2]=0,p[3]=0,p[4]=0,p[5]=1,p[6]=0,p[7]=0,p[8]=0,p[9]=0,p[10]=1,p[11]=0,p[12]=0,p[13]=0,p[14]=0,p[15]=1,v=p),d&&function(t,e,n){var r=n[0],a=n[1],i=n[2];t[0]=e[0]*r,t[1]=e[1]*r,t[2]=e[2]*r,t[3]=e[3]*r,t[4]=e[4]*a,t[5]=e[5]*a,t[6]=e[6]*a,t[7]=e[7]*a,t[8]=e[8]*i,t[9]=e[9]*i,t[10]=e[10]*i,t[11]=e[11]*i,t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]}(v,v,[1/a,1/a,1]),f.setTransform({a:v[0],b:v[1],c:v[4],d:v[5],e:v[12],f:v[13]})}return o&&f&&(this.patternCache[o]=f),f},t.prototype.getOrCreateGradient=function(t,n){var r=this.generateGradientKey(t),a=t.type,i=t.steps,o=t.width,s=t.height,c=t.cx,l=t.cy,h=t.size;if(this.gradientCache[r])return this.gradientCache[r];var u=null;if(a===e.GradientType.LinearGradient){var d=e.computeLinearGradient(o,s,t.angle);u=n.createLinearGradient(d.x1,d.y1,d.x2,d.y2)}else if(a===e.GradientType.RadialGradient){var p=e.computeRadialGradient(o,s,c,l,h),f=p.x,v=p.y;u=n.createRadialGradient(f,v,0,f,v,p.r)}return u&&(i.forEach((function(t){var n=t.offset;n.unit===e.UnitType.kPercentage&&(null==u||u.addColorStop(n.value/100,""+t.color))})),this.gradientCache[r]=u),this.gradientCache[r]},t.prototype.generateGradientKey=function(t){var e=t.width,n=t.height,r=t.steps,a=t.angle,i=t.cx,o=t.cy,s=t.size;return"gradient-".concat(t.type,"-").concat((null==a?void 0:""+a)||0,"-").concat((null==i?void 0:""+i)||0,"-").concat((null==o?void 0:""+o)||0,"-").concat((null==s?void 0:""+s)||0,"-").concat(e,"-").concat(n,"-").concat(r.map((function(t){var e=t.color;return"".concat(t.offset).concat(e)})).join("-"))},t.prototype.generatePatternKey=function(t){var e=t.image,n=t.repetition;return b(e)?"pattern-".concat(e,"-").concat(n):"rect"===e.nodeName?"pattern-".concat(e.entity,"-").concat(n):void 0},t}(),Nt=function(){function t(){}return t.prototype.apply=function(n){var r=n.renderingService,a=n.imagePool,i=n.renderingContext.root.ownerDocument.defaultView,o=function(t,e,n){var r=t.parsedStyle,a=r.width,i=r.height;a&&!i?t.setAttribute("height",n/e*a):!a&&i&&t.setAttribute("width",e/n*i)},s=function(t){var n=t.target,i=n.attributes;if(n.nodeName===e.Shape.IMAGE){var s=i.img,c=i.keepAspectRatio;b(s)&&a.getImageSync(s,(function(t){c&&o(n,t.width,t.height),n.renderable.dirty=!0,r.dirtify()}))}},c=function(t){var n=t.target,i=t.newValue;n.nodeName===e.Shape.IMAGE&&"img"===t.attrName&&b(i)&&a.getOrCreateImage(i).then((function(t){n.attributes.keepAspectRatio&&o(n,t.width,t.height),n.renderable.dirty=!0,r.dirtify()}))};r.hooks.init.tap(t.tag,(function(){i.addEventListener(e.ElementEvent.MOUNTED,s),i.addEventListener(e.ElementEvent.ATTR_MODIFIED,c)})),r.hooks.destroy.tap(t.tag,(function(){i.removeEventListener(e.ElementEvent.MOUNTED,s),i.removeEventListener(e.ElementEvent.ATTR_MODIFIED,c)}))},t.tag="LoadImage",t}(),Bt=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.name="image-loader",e}return r(e,t),e.prototype.init=function(){this.context.imagePool=new It(this.context.config),this.addRenderingPlugin(new Nt)},e.prototype.destroy=function(){this.removeAllRenderingPlugins()},e}(e.AbstractRendererPlugin),Dt=Object.freeze({__proto__:null,ImagePool:It,Plugin:Bt}),Ft=function(){function t(t){this.renderingContext=t.renderingContext,this.canvasConfig=t.config}return t.prototype.init=function(){var t=this.canvasConfig,e=t.container,n=t.canvas;if(n)this.$canvas=n,e&&n.parentElement!==e&&e.appendChild(n),this.$container=n.parentElement,this.canvasConfig.container=this.$container;else if(e&&(this.$container=b(e)?document.getElementById(e):e,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)},t.prototype.getContext=function(){return this.context},t.prototype.getDomElement=function(){return this.$canvas},t.prototype.getDPR=function(){return this.dpr},t.prototype.getBoundingClientRect=function(){if(this.$canvas.getBoundingClientRect)return this.$canvas.getBoundingClientRect()},t.prototype.destroy=function(){this.$container&&this.$canvas&&this.$canvas.parentNode&&this.$container.removeChild(this.$canvas)},t.prototype.resize=function(t,n){var r=this.canvasConfig.devicePixelRatio||e.isBrowser&&window.devicePixelRatio||1;this.dpr=r=1>r?1:Math.ceil(r),this.$canvas&&(this.$canvas.width=this.dpr*t,this.$canvas.height=this.dpr*n,e.setDOMSize(this.$canvas,t,n)),this.renderingContext.renderReasons.add(e.RenderReason.CAMERA_CHANGED)},t.prototype.applyCursorStyle=function(t){this.$container&&this.$container.style&&(this.$container.style.cursor=t)},t.prototype.toDataURL=function(t){return void 0===t&&(t={}),i(this,void 0,void 0,(function(){return o(this,(function(e){return[2,this.context.canvas.toDataURL(t.type,t.encoderOptions)]}))}))},t}(),Gt=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.name="canvas-context-register",e}return r(e,t),e.prototype.init=function(){this.context.ContextService=Ft},e.prototype.destroy=function(){delete this.context.ContextService},e}(e.AbstractRendererPlugin),jt=function(t){function e(e){var n=t.call(this,e)||this;return n.registerPlugin(new Gt),n.registerPlugin(new Bt),n.registerPlugin(new R),n.registerPlugin(new Ct),n.registerPlugin(new wt),n.registerPlugin(new ut),n.registerPlugin(new Lt),n}return r(e,t),e}(e.AbstractRenderer);t.CanvasPathGenerator=I,t.CanvasPicker=dt,t.CanvasRenderer=Tt,t.DomInteraction=kt,t.HTMLRenderer=Rt,t.ImageLoader=Dt,t.Renderer=jt}));
!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 a=function(){return a=Object.assign||function(e){for(var t,n=1,r=arguments.length;r>n;n++)for(var a in t=arguments[n])Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a]);return e},a.apply(this,arguments)};function i(e,t,n,r){return new(n||(n=Promise))((function(a,i){function o(e){try{c(r.next(e))}catch(e){i(e)}}function s(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?a(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,a,i,o={label:0,sent:function(){if(1&a[0])throw a[1];return a[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(s){return function(c){return function(s){if(n)throw new TypeError("Generator is already executing.");for(;i&&(i=0,s[0]&&(o=0)),o;)try{if(n=1,r&&(a=2&s[0]?r.return:s[0]?r.throw||((a=r.return)&&a.call(r),0):r.next)&&!(a=a.call(r,s[1])).done)return a;switch(r=0,a&&(s=[2&s[0],a.value]),s[0]){case 0:case 1:a=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(!(a=o.trys,(a=a.length>0&&a[a.length-1])||6!==s[0]&&2!==s[0])){o=0;continue}if(3===s[0]&&(!a||s[1]>a[0]&&a[3]>s[1])){o.label=s[1];break}if(6===s[0]&&a[1]>o.label){o.label=a[1],a=s;break}if(a&&a[2]>o.label){o.label=a[2],o.ops.push(s);break}a[2]&&o.ops.pop(),o.trys.pop();continue}s=t.call(e,o)}catch(e){s=[6,e],r=0}finally{n=a=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,a,i=n.call(e),o=[];try{for(;(void 0===t||t-- >0)&&!(r=i.next()).done;)o.push(r.value)}catch(e){a={error:e}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(a)throw a.error}}return o}function c(e,t,n){if(n||2===arguments.length)for(var r,a=0,i=t.length;i>a;a++)!r&&a in t||(r||(r=Array.prototype.slice.call(t,0,a)),r[a]=t[a]);return e.concat(r||Array.prototype.slice.call(t))}var l="undefined"!=typeof Float32Array?Float32Array:Array;function h(){var e=new l(16);return l!=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 u(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 d(e,t,n){var r=t[0],a=t[1],i=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],M=n[1],x=n[2],b=n[3];return e[0]=E*r+M*s+x*u+b*v,e[1]=E*a+M*c+x*d+b*y,e[2]=E*i+M*l+x*p+b*g,e[3]=E*o+M*h+x*f+b*m,e[4]=(E=n[4])*r+(M=n[5])*s+(x=n[6])*u+(b=n[7])*v,e[5]=E*a+M*c+x*d+b*y,e[6]=E*i+M*l+x*p+b*g,e[7]=E*o+M*h+x*f+b*m,e[8]=(E=n[8])*r+(M=n[9])*s+(x=n[10])*u+(b=n[11])*v,e[9]=E*a+M*c+x*d+b*y,e[10]=E*i+M*l+x*p+b*g,e[11]=E*o+M*h+x*f+b*m,e[12]=(E=n[12])*r+(M=n[13])*s+(x=n[14])*u+(b=n[15])*v,e[13]=E*a+M*c+x*d+b*y,e[14]=E*i+M*l+x*p+b*g,e[15]=E*o+M*h+x*f+b*m,e}function p(e,t,n){var r,a,i,o,s,c,l,h,u,d,p,f,v=n[0],y=n[1],g=n[2];return t===e?(e[12]=t[0]*v+t[4]*y+t[8]*g+t[12],e[13]=t[1]*v+t[5]*y+t[9]*g+t[13],e[14]=t[2]*v+t[6]*y+t[10]*g+t[14],e[15]=t[3]*v+t[7]*y+t[11]*g+t[15]):(a=t[1],i=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],e[0]=r=t[0],e[1]=a,e[2]=i,e[3]=o,e[4]=s,e[5]=c,e[6]=l,e[7]=h,e[8]=u,e[9]=d,e[10]=p,e[11]=f,e[12]=r*v+s*y+u*g+t[12],e[13]=a*v+c*y+d*g+t[13],e[14]=i*v+l*y+p*g+t[14],e[15]=o*v+h*y+f*g+t[15]),e}function f(){var e=new l(3);return l!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0),e}function v(e,t,n,r){return e[0]=t,e[1]=n,e[2]=r,e}function y(e,t,n){var r=t[0],a=t[1],i=t[2],o=n[3]*r+n[7]*a+n[11]*i+n[15];return e[0]=(n[0]*r+n[4]*a+n[8]*i+n[12])/(o=o||1),e[1]=(n[1]*r+n[5]*a+n[9]*i+n[13])/o,e[2]=(n[2]*r+n[6]*a+n[10]*i+n[14])/o,e}function g(e,t,n){return{x:e*Math.cos(n)-t*Math.sin(n),y:e*Math.sin(n)+t*Math.cos(n)}}function m(e,t,n,r,a,i,o,s,c,l){var h,u,d,p,f,v=e,y=t,E=n,M=r,x=s,b=c,S=120*Math.PI/180,P=Math.PI/180*(+a||0),C=[];if(l)u=l[0],d=l[1],p=l[2],f=l[3];else{y=(h=g(v,y,-P)).y;var T=((v=h.x)-(x=(h=g(x,b,-P)).x))/2,A=(y-(b=h.y))/2,w=T*T/(E*E)+A*A/(M*M);w>1&&(E*=w=Math.sqrt(w),M*=w);var k=E*E,O=M*M,L=(i===o?-1:1)*Math.sqrt(Math.abs((k*O-k*A*A-O*T*T)/(k*A*A+O*T*T)));p=L*E*A/M+(v+x)/2,u=Math.asin(((y-(f=L*-M*T/E+(y+b)/2))/M*1e9>>0)/1e9),d=Math.asin(((b-f)/M*1e9>>0)/1e9),0>(u=p>v?Math.PI-u:u)&&(u=2*Math.PI+u),0>(d=p>x?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)>S){var I=d,N=x,B=b;C=m(x=p+E*Math.cos(d=u+S*(o&&d>u?1:-1)),b=f+M*Math.sin(d),E,M,a,0,o,N,B,[d,I,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*E*_,$=4/3*M*_,W=[v,y],U=[v+H*F,y-$*D],Y=[x+H*j,b-$*G],X=[x,b];if(U[0]=2*W[0]-U[0],U[1]=2*W[1]-U[1],l)return U.concat(Y,X,C);for(var z=[],q=0,Q=(C=U.concat(Y,X,C)).length;Q>q;q+=1)z[q]=q%2?g(C[q-1],C[q],P).y:g(C[q],C[q+1],P).x;return z}Math.hypot||(Math.hypot=function(){for(var e=0,t=arguments.length;t--;)e+=arguments[t]*arguments[t];return Math.sqrt(e)}),f(),function(){var e,t=(e=new l(2),l!=Float32Array&&(e[0]=0,e[1]=0),e)}();var E=function(e){return null==e},M={}.toString,x=function(e,t){return M.call(e)==="[object "+t+"]"},b=function(e){return x(e,"String")},S=function(e,t,n){return t>e?t:e>n?n:e},P=function(e){return x(e,"Number")};function C(e,t){var n=t.r;e.arc(n,n,n,0,2*Math.PI,!1)}function T(e,t){var n=t.rx,r=t.ry;if(e.ellipse)e.ellipse(n,r,n,r,0,0,2*Math.PI,!1);else{var a=n>r?n:r,i=n>r?1:n/r,o=n>r?r/n:1;e.save(),e.scale(i,o),e.arc(a,a,a,0,2*Math.PI)}}function A(e,n){var r=n.x1,a=n.y1,i=n.x2,o=n.y2,s=n.defX,c=void 0===s?0:s,l=n.defY,h=void 0===l?0:l,u=n.markerStart,d=n.markerEnd,p=n.markerStartOffset,f=n.markerEndOffset,v=0,y=0,g=0,m=0,E=0;u&&t.isDisplayObject(u)&&p&&(v=Math.cos(E=Math.atan2(o-a,i-r))*(p||0),y=Math.sin(E)*(p||0)),d&&t.isDisplayObject(d)&&f&&(g=Math.cos(E=Math.atan2(a-o,r-i))*(f||0),m=Math.sin(E)*(f||0)),e.moveTo(r-c+v,a-h+y),e.lineTo(i-c+g,o-h+m)}function w(e,n){var r=n.defX,a=void 0===r?0:r,i=n.defY,o=void 0===i?0:i,c=n.markerStart,l=n.markerEnd,h=n.markerStartOffset,u=n.markerEndOffset,d=n.path,p=d.absolutePath,f=d.segments,v=0,y=0,g=0,m=0,E=0;if(c&&t.isDisplayObject(c)&&h){var M=s(c.parentNode.getStartTangent(),2);v=Math.cos(E=Math.atan2((x=M[0])[1]-(b=M[1])[1],x[0]-b[0]))*(h||0),y=Math.sin(E)*(h||0)}if(l&&t.isDisplayObject(l)&&u){var x,b,S=s(l.parentNode.getEndTangent(),2);g=Math.cos(E=Math.atan2((x=S[0])[1]-(b=S[1])[1],x[0]-b[0]))*(u||0),m=Math.sin(E)*(u||0)}for(var P=0;p.length>P;P++){var C=p[P],T=p[P+1],A=0===P&&(0!==v||0!==y),w=(P===p.length-1||T&&("M"===T[0]||"Z"===T[0]))&&0!==g&&0!==m;switch(C[0]){case"M":A?(e.moveTo(C[1]-a+v,C[2]-o+y),e.lineTo(C[1]-a,C[2]-o)):e.moveTo(C[1]-a,C[2]-o);break;case"L":w?e.lineTo(C[1]-a+g,C[2]-o+m):e.lineTo(C[1]-a,C[2]-o);break;case"Q":e.quadraticCurveTo(C[1]-a,C[2]-o,C[3]-a,C[4]-o),w&&e.lineTo(C[3]-a+g,C[4]-o+m);break;case"C":e.bezierCurveTo(C[1]-a,C[2]-o,C[3]-a,C[4]-o,C[5]-a,C[6]-o),w&&e.lineTo(C[5]-a+g,C[6]-o+m);break;case"A":var k=f[P].arcParams,O=k.cx,L=k.cy,R=k.rx,I=k.ry,N=k.startAngle,B=k.endAngle,D=k.xRotation,F=k.sweepFlag;if(e.ellipse)e.ellipse(O-a,L-o,R,I,D,N,B,!!(1-F));else{var G=R>I?R:I,j=R>I?1:R/I,_=R>I?I/R:1;e.translate(O-a,L-o),e.rotate(D),e.scale(j,_),e.arc(0,0,G,N,B,!!(1-F)),e.scale(1/j,1/_),e.rotate(-D),e.translate(-(O-a),-(L-o))}w&&e.lineTo(C[6]-a+g,C[7]-o+m);break;case"Z":e.closePath()}}}function k(e,n){var r=n.defX,a=void 0===r?0:r,i=n.defY,o=void 0===i?0:i,s=n.markerStart,c=n.markerEnd,l=n.markerStartOffset,h=n.markerEndOffset,u=n.points.points,d=u.length,p=u[0][0]-a,f=u[0][1]-o,v=u[d-1][0]-a,y=u[d-1][1]-o,g=0,m=0,E=0,M=0,x=0;s&&t.isDisplayObject(s)&&l&&(g=Math.cos(x=Math.atan2(u[1][1]-u[0][1],u[1][0]-u[0][0]))*(l||0),m=Math.sin(x)*(l||0)),c&&t.isDisplayObject(c)&&h&&(E=Math.cos(x=Math.atan2(u[d-1][1]-u[0][1],u[d-1][0]-u[0][0]))*(h||0),M=Math.sin(x)*(h||0)),e.moveTo(p+(g||E),f+(m||M));for(var b=1;d-1>b;b++){var S=u[b];e.lineTo(S[0]-a,S[1]-o)}e.lineTo(v,y)}function O(e,n){var r=n.defX,a=void 0===r?0:r,i=n.defY,o=void 0===i?0:i,s=n.markerStart,c=n.markerEnd,l=n.markerStartOffset,h=n.markerEndOffset,u=n.points.points,d=u.length,p=u[0][0]-a,f=u[0][1]-o,v=u[d-1][0]-a,y=u[d-1][1]-o,g=0,m=0,E=0,M=0,x=0;s&&t.isDisplayObject(s)&&l&&(g=Math.cos(x=Math.atan2(u[1][1]-u[0][1],u[1][0]-u[0][0]))*(l||0),m=Math.sin(x)*(l||0)),c&&t.isDisplayObject(c)&&h&&(E=Math.cos(x=Math.atan2(u[d-2][1]-u[d-1][1],u[d-2][0]-u[d-1][0]))*(h||0),M=Math.sin(x)*(h||0)),e.moveTo(p+g,f+m);for(var b=1;d-1>b;b++){var S=u[b];e.lineTo(S[0]-a,S[1]-o)}e.lineTo(v+E,y+M)}function L(e,t){var n=t.radius,r=t.width,a=t.height,i=r,o=a;if(n&&n.some((function(e){return 0!==e}))){var c=r>0?1:-1,l=a>0?1:-1,h=c+l===0,u=s(n.map((function(e){return S(e,0,Math.min(Math.abs(i)/2,Math.abs(o)/2))})),4),d=u[0],p=u[1],f=u[2],v=u[3];e.moveTo(c*d,0),e.lineTo(i-c*p,0),0!==p&&e.arc(i-c*p,l*p,p,-l*Math.PI/2,c>0?0:Math.PI,h),e.lineTo(i,o-l*f),0!==f&&e.arc(i-c*f,o-l*f,f,c>0?0:Math.PI,l>0?Math.PI/2:1.5*Math.PI,h),e.lineTo(c*v,o),0!==v&&e.arc(c*v,o-l*v,v,l>0?Math.PI/2:-Math.PI/2,c>0?Math.PI:0,h),e.lineTo(0,l*d),0!==d&&e.arc(c*d,l*d,d,c>0?Math.PI:0,l>0?1.5*Math.PI:Math.PI/2,h)}else e.rect(0,0,i,o)}var R=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]=C,e[t.Shape.ELLIPSE]=T,e[t.Shape.RECT]=L,e[t.Shape.LINE]=A,e[t.Shape.POLYLINE]=O,e[t.Shape.POLYGON]=k,e[t.Shape.PATH]=w,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),I=Object.freeze({__proto__:null,Plugin:R});function N(e,t,n,r){var a=e-n,i=t-r;return Math.sqrt(a*a+i*i)}var B=1e-4;function D(e,t,n,r,a,i){var o=-1,l=1/0,h=[n,r],u=20;i&&i>200&&(u=i/10);for(var d=1/u,p=d/10,f=0;u>=f;f++){var v=f*d,y=[a.apply(void 0,c([],s(e.concat([v])),!1)),a.apply(void 0,c([],s(t.concat([v])),!1))];l>(M=N(h[0],h[1],y[0],y[1]))&&(o=v,l=M)}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&&B<=p;f++){var m=o-p,E=o+p,M=(y=[a.apply(void 0,c([],s(e.concat([m])),!1)),a.apply(void 0,c([],s(t.concat([m])),!1))],N(h[0],h[1],y[0],y[1]));if(m>=0&&l>M)o=m,l=M;else{var x=[a.apply(void 0,c([],s(e.concat([E])),!1)),a.apply(void 0,c([],s(t.concat([E])),!1))],b=N(h[0],h[1],x[0],x[1]);1>=E&&l>b?(o=E,l=b):p*=.5}}return{x:a.apply(void 0,c([],s(e.concat([o])),!1)),y:a.apply(void 0,c([],s(t.concat([o])),!1))}}function F(e,t,n,r,a,i){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((a-e)*(a-e)+(i-t)*(i-t));var s=[-o[1],o[0]];return function(e,t){var n=t[0],r=t[1],a=n*n+r*r;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 G(e,t,n,r,a){var i=1-a;return i*i*i*e+3*t*a*i*i+3*n*a*a*i+r*a*a*a}function j(e,t,n,r,a,i,o,s,c,l,h){var u=function(e,t,n,r,a,i,o,s,c,l,h){return D([e,n,a,o],[t,r,i,s],c,l,G,h)}(e,t,n,r,a,i,o,s,c,l,h);return N(u.x,u.y,c,l)}function _(e,t,n,r){var a=1-r;return a*a*e+2*r*a*t+r*r*n}function H(e,t,n,r,a,i,o,s){var c=function(e,t,n,r,a,i,o,s){return D([e,n,a],[t,r,i],o,s,_)}(e,t,n,r,a,i,o,s);return N(c.x,c.y,o,s)}var $=f(),W=f(),U=f(),Y=h(),X=function(){function e(){var e=this;this.isHit=function(n,r,a,i){var o,s,c,l,h,u,d,p,f,g,m,E,M,x,b,S,P,C,T,A,w,k,O,L,R,I,N,B,D,F,G,j=e.context.pointInPathPickerFactory[n.nodeName];if(j){var _=(o=Y,(G=(T=(c=(s=a)[0])*(p=s[5])-(l=s[1])*(d=s[4]))*(F=(M=s[10])*(C=s[15])-(x=s[11])*(P=s[14]))-(A=c*(f=s[6])-(h=s[2])*d)*(D=(E=s[9])*C-x*(S=s[13]))+(w=c*(g=s[7])-(u=s[3])*d)*(B=E*P-M*S)+(k=l*f-h*p)*(N=(m=s[8])*C-x*(b=s[12]))-(O=l*g-u*p)*(I=m*P-M*b)+(L=h*g-u*f)*(R=m*S-E*b))?(o[0]=(p*F-f*D+g*B)*(G=1/G),o[1]=(h*D-l*F-u*B)*G,o[2]=(S*L-P*O+C*k)*G,o[3]=(M*O-E*L-x*k)*G,o[4]=(f*N-d*F-g*I)*G,o[5]=(c*F-h*N+u*I)*G,o[6]=(P*w-b*L-C*A)*G,o[7]=(m*L-M*w+x*A)*G,o[8]=(d*D-p*N+g*R)*G,o[9]=(l*N-c*D-u*R)*G,o[10]=(b*O-S*w+C*T)*G,o[11]=(E*w-m*O-x*T)*G,o[12]=(p*I-d*B-f*R)*G,o[13]=(c*B-l*I+h*R)*G,o[14]=(S*A-b*k-P*T)*G,o[15]=(m*k-E*A+M*T)*G,o):null),H=y(W,v(U,r[0],r[1],0),_),$=n.getGeometryBounds().halfExtents,X=n.parsedStyle.anchor;if(H[0]+=(X&&X[0]||0)*$[0]*2,H[1]+=(X&&X[1]||0)*$[1]*2,j(n,new t.Point(H[0],H[1]),i,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),a=e.context.pathGeneratorFactory[t.nodeName];return a&&(r.beginPath(),a(r,t.parsedStyle),r.closePath()),r.isPointInPath(n.x,n.y)}}return e.prototype.apply=function(t,n){var r,a=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 i(a,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 a.pick(l,e)}))},e.prototype.pick=function(e,n){var r,a,i=n.topmost,o=n.position,s=v($,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 y=f.parsedStyle.clipPath;if(this.isHit(y,s,y.getWorldTransform(),!0)){if(i)return n.picked=[d],n;l.push(d)}}else{if(i)return n.picked=[d],n;l.push(d)}}}}catch(e){r={error:e}}finally{try{u&&!u.done&&(a=h.return)&&a.call(h)}finally{if(r)throw r.error}}return n.picked=l,n},e.tag="CanvasPicker",e}();function z(e,n,r){var a=e.parsedStyle,i=a.r,o=a.fill,c=a.stroke,l=a.pointerEvents,h=((a.lineWidth||0)+(a.increasedLineWidthForHitTesting||0))/2,u=N(i,i,n.x,n.y),d=s(t.isFillOrStrokeAffected(l,o,c),2),p=d[0],f=d[1];return p&&f||r?i+h>=u:p?i>=u:!!f&&(u>=i-h&&i+h>=u)}function q(e,t,n,r){return e/(n*n)+t/(r*r)}function Q(e,n,r){var a=e.parsedStyle,i=a.rx,o=a.ry,c=a.lineWidth,l=a.increasedLineWidthForHitTesting,h=n.x,u=n.y,d=s(t.isFillOrStrokeAffected(a.pointerEvents,a.fill,a.stroke),2),p=d[0],f=d[1],v=((c||0)+(l||0))/2,y=(h-i)*(h-i),g=(u-o)*(u-o);return p&&f||r?1>=q(y,g,i+v,o+v):p?1>=q(y,g,i,o):!!f&&(q(y,g,i-v,o-v)>=1&&1>=q(y,g,i+v,o+v))}function V(e,t,n,r,a,i){return!(e>a||a>e+n||t>i||i>t+r)}function Z(e,t,n,r,a,i,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)<=i/2}function J(e,t,n,r,a,i,o){var s=a/2;return!(Math.min(e,n)-s>i||i>Math.max(e,n)+s||Math.min(t,r)-s>o||o>Math.max(t,r)+s)&&F(e,t,n,r,i,o)<=a/2}function K(e,t,n,r,a){var i=e.length;if(2>i)return!1;for(var o=0;i-1>o;o++){if(J(e[o][0],e[o][1],e[o+1][0],e[o+1][1],t,n,r))return!0}if(a){var s=e[0],c=e[i-1];if(J(s[0],s[1],c[0],c[1],t,n,r))return!0}return!1}var ee=1e-6;function te(e){return ee>Math.abs(e)?0:0>e?-1:1}function ne(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 re(e,t,n){var r=!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(ne(o,s,[t,n]))return!0;te(o[1]-n)>0!=te(s[1]-n)>0&&0>te(t-(n-o[1])*(o[0]-s[0])/(o[1]-s[1])-o[0])&&(r=!r)}return r}function ae(e,t,n){for(var r=!1,a=0;e.length>a;a++){if(r=re(e[a],t,n))break}return r}function ie(e,n,r){var a=e.parsedStyle,i=a.x1,o=a.y1,c=a.x2,l=a.y2,h=a.lineWidth,u=a.increasedLineWidthForHitTesting,d=a.defX,p=void 0===d?0:d,f=a.defY,v=void 0===f?0:f;return!(!s(t.isFillOrStrokeAffected(a.pointerEvents,a.fill,a.stroke),2)[1]&&!r||!h)&&J(i,o,c,l,(h||0)+(u||0),n.x+p,n.y+v)}function oe(e,n,r,a,i,o){var c=e.parsedStyle,l=c.lineWidth,h=c.increasedLineWidthForHitTesting,u=c.defX,d=void 0===u?0:u,p=c.defY,f=void 0===p?0:p,v=c.path,y=v.segments,g=v.hasArc,E=v.polylines,M=v.polygons,x=s(t.isFillOrStrokeAffected(c.pointerEvents,(null==M?void 0:M.length)&&c.fill,c.stroke),2),b=x[0],S=x[1],P=t.getOrCalculatePathTotalLength(e),C=!1;return b||r?C=g?a(e,n):ae(M,n.x+d,n.y+f)||ae(E,n.x+d,n.y+f):((S||r)&&(C=function(e,t,n,r,a){for(var i=!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||V(d.x-o,d.y-o,d.width+t,d.height+t,n,r))switch(c.command){case"L":case"Z":if(i=J(u[0],u[1],l[0],l[1],t,n,r))return!0;break;case"Q":if(i=t/2>=H(u[0],u[1],h[1],h[2],h[3],h[4],n,r))return!0;break;case"C":if(i=t/2>=j(u[0],u[1],h[1],h[2],h[3],h[4],h[5],h[6],n,r,a))return!0;break;case"A":c.cubicParams||(c.cubicParams=m(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=j(f[0],f[1],p[v],p[v+1],p[v+2],p[v+3],p[v+4],p[v+5],n,r,a);if(f=[p[v+4],p[v+5]],i=t/2>=y)return!0}}}return i}(y,(l||0)+(h||0),n.x+d,n.y+f,P)),C)}function se(e,n,r){var a=e.parsedStyle,i=a.lineWidth,o=a.increasedLineWidthForHitTesting,c=a.points,l=a.defX,h=void 0===l?0:l,u=a.defY,d=void 0===u?0:u,p=s(t.isFillOrStrokeAffected(a.pointerEvents,a.fill,a.stroke),2),f=p[0],v=!1;return(p[1]||r)&&(v=K(c.points,(i||0)+(o||0),n.x+h,n.y+d,!0)),v||!f&&!r||(v=re(c.points,n.x+h,n.y+d)),v}function ce(e,n,r){var a=e.parsedStyle,i=a.lineWidth,o=a.increasedLineWidthForHitTesting,c=a.points,l=a.defX,h=void 0===l?0:l,u=a.defY,d=void 0===u?0:u;return!(!s(t.isFillOrStrokeAffected(a.pointerEvents,a.fill,a.stroke),2)[1]&&!r||!i)&&K(c.points,(i||0)+(o||0),n.x+h,n.y+d,!1)}function le(e,n,r,a,i){var o=e.parsedStyle,c=o.radius,l=o.lineWidth,h=o.increasedLineWidthForHitTesting,u=o.width,d=o.height,p=s(t.isFillOrStrokeAffected(o.pointerEvents,o.fill,o.stroke),2),f=p[0],v=p[1],y=(l||0)+(h||0);if(c&&c.some((function(e){return 0!==e}))){var g=!1;return(v||r)&&(g=function(e,t,n,r,a,i,o,c){var l=s(a,4),h=l[0],u=l[1],d=l[2],p=l[3];return J(e+h,t,e+n-u,t,i,o,c)||J(e+n,t+u,e+n,t+r-d,i,o,c)||J(e+n-d,t+r,e+p,t+r,i,o,c)||J(e,t+r-p,e,t+h,i,o,c)||Z(e+n-u,t+u,u,0,0,i,o,c)||Z(e+n-d,t+r-d,d,0,0,i,o,c)||Z(e+p,t+r-p,p,0,0,i,o,c)||Z(e+h,t+h,h,0,0,i,o,c)}(0,0,u,d,c.map((function(e){return S(e,0,Math.min(Math.abs(u)/2,Math.abs(d)/2))})),y,n.x,n.y)),g||!f&&!r||(g=a(e,n)),g}var m=y/2;return f&&v||r?V(0-m,0-m,u+m,d+m,n.x,n.y):f?V(0,0,u,d,n.x,n.y):!!v&&function(e,t,n,r,a,i,o){var s=a/2;return V(e-s,t-s,n,a,i,o)||V(e+n-s,t-s,a,r,i,o)||V(e+s,t+r-s,n,a,i,o)||V(e-s,t+s,a,r,i,o)}(0,0,u,d,y,n.x,n.y)}function he(e,n,r,a,i,o){var s=e.parsedStyle,c=s.width,l=s.height;if("non-transparent-pixel"===s.pointerEvents){var h=i.config.offscreenCanvas,u=o.offscreenCanvasCreator.getOrCreateCanvas(h),d=o.offscreenCanvasCreator.getOrCreateContext(h,{willReadFrequently:!0});return u.width=c,u.height=l,i.defaultStyleRendererFactory[t.Shape.IMAGE].render(d,e.parsedStyle,e,void 0,void 0,void 0),d.getImageData(n.x,n.y,1,1).data.every((function(e){return 0!==e}))}return!0}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]=z,e[t.Shape.ELLIPSE]=Q,e[t.Shape.RECT]=le,e[t.Shape.LINE]=ie,e[t.Shape.POLYLINE]=ce,e[t.Shape.POLYGON]=se,e[t.Shape.PATH]=oe,e[t.Shape.TEXT]=function(){return!0},e[t.Shape.GROUP]=null,e[t.Shape.IMAGE]=he,e[t.Shape.HTML]=null,e[t.Shape.MESH]=null,e);this.context.pointInPathPickerFactory=n,this.addRenderingPlugin(new X)},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.clearFullScreen=!1,this.vpMatrix=h(),this.dprMatrix=h(),this.tmpMat4=h(),this.vec3a=f(),this.vec3b=f(),this.vec3c=f(),this.vec3d=f()}return e.prototype.apply=function(n,r){var a=this;this.context=n;var i=n.config,o=n.camera,l=n.renderingService,h=n.renderingContext,u=n.pathGeneratorFactory;this.rBush=n.rBushRoot,this.pathGeneratorFactory=u;var p=n.contextService,f=h.root.ownerDocument.defaultView,v=function(e){var t=e.target.rBushNode;t.aabb&&a.removedRBushNodeAABBs.push(t.aabb)},g=function(e){var t=e.target.rBushNode;t.aabb&&a.removedRBushNodeAABBs.push(t.aabb)};l.hooks.init.tap(e.tag,(function(){f.addEventListener(t.ElementEvent.UNMOUNTED,v),f.addEventListener(t.ElementEvent.CULLED,g);var e=p.getDPR(),n=i.width,r=i.height,o=p.getContext();a.clearRect(o,0,0,n*e,r*e,i.background)})),l.hooks.destroy.tap(e.tag,(function(){f.removeEventListener(t.ElementEvent.UNMOUNTED,v),f.removeEventListener(t.ElementEvent.CULLED,g),a.renderQueue=[],a.removedRBushNodeAABBs=[],a.restoreStack=[]})),l.hooks.beginFrame.tap(e.tag,(function(){var e=p.getContext(),t=p.getDPR(),n=i.width,r=i.height,o=a.canvasRendererPluginOptions,s=o.dirtyObjectNumThreshold,c=o.dirtyObjectRatioThreshold,h=l.getStats(),u=h.rendered,d=u/h.total;a.clearFullScreen=l.disableDirtyRectangleRendering()||u>s&&d>c,e&&(e.resetTransform?e.resetTransform():e.setTransform(1,0,0,1,0,0),a.clearFullScreen&&a.clearRect(e,0,0,n*t,r*t,i.background))}));var m=function(e,t){e.isVisible()&&!e.isCulled()&&(a.renderDisplayObject(e,t,a.context,a.restoreStack,r),a.saveDirtyAABB(e)),(e.sortable.sorted||e.childNodes).forEach((function(e){m(e,t)}))};l.hooks.endFrame.tap(e.tag,(function(){var e,n,l=p.getContext(),u=p.getDPR();if((e=a.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,d(a.vpMatrix,a.dprMatrix,o.getOrthoMatrix()),a.clearFullScreen)m(h.root,l);else{var v=a.safeMergeAABB.apply(a,c([a.mergeDirtyAABBs(a.renderQueue)],s(a.removedRBushNodeAABBs.map((function(e){var n=e.minX,r=e.minY,a=e.maxX,i=e.maxY,o=new t.AABB;return o.setMinMax([n,r,0],[a,i,0]),o}))),!1));if(a.removedRBushNodeAABBs=[],t.AABB.isEmpty(v))return void(a.renderQueue=[]);var g=a.convertAABB2Rect(v),E=g.x,M=g.y,x=g.width,b=g.height,S=y(a.vec3a,[E,M,0],a.vpMatrix),P=y(a.vec3b,[E+x,M,0],a.vpMatrix),C=y(a.vec3c,[E,M+b,0],a.vpMatrix),T=y(a.vec3d,[E+x,M+b,0],a.vpMatrix),A=Math.min(S[0],P[0],T[0],C[0]),w=Math.min(S[1],P[1],T[1],C[1]),k=Math.max(S[0],P[0],T[0],C[0]),O=Math.max(S[1],P[1],T[1],C[1]),L=Math.floor(A),R=Math.floor(w),I=Math.ceil(k-A),N=Math.ceil(O-w);l.save(),a.clearRect(l,L,R,I,N,i.background),l.beginPath(),l.rect(L,R,I,N),l.clip(),l.setTransform(a.vpMatrix[0],a.vpMatrix[1],a.vpMatrix[4],a.vpMatrix[5],a.vpMatrix[12],a.vpMatrix[13]),i.renderer.getConfig().enableDirtyRectangleRenderingDebug&&f.dispatchEvent(new t.CustomEvent(t.CanvasEvent.DIRTY_RECTANGLE,{dirtyRect:{x:L,y:R,width:I,height:N}})),a.searchDirtyObjects(v).sort((function(e,t){return e.sortable.renderOrder-t.sortable.renderOrder})).forEach((function(e){e&&e.isVisible()&&!e.isCulled()&&a.renderDisplayObject(e,l,a.context,a.restoreStack,r)})),l.restore(),a.renderQueue.forEach((function(e){a.saveDirtyAABB(e)})),a.renderQueue=[]}a.restoreStack.forEach((function(){l.restore()})),a.restoreStack=[]})),l.hooks.render.tap(e.tag,(function(e){a.clearFullScreen||a.renderQueue.push(e)}))},e.prototype.clearRect=function(e,t,n,r,a,i){e.clearRect(t,n,r,a),i&&(e.fillStyle=i,e.fillRect(t,n,r,a))},e.prototype.renderDisplayObject=function(e,n,r,a,i){var o=e.nodeName,s=a[a.length-1];!s||e.compareDocumentPosition(s)&t.Node.DOCUMENT_POSITION_CONTAINS||(n.restore(),a.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(),a.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,i),n.restore()),e.renderable.dirty=!1},e.prototype.convertAABB2Rect=function(e){var t=e.getMin(),n=e.getMax(),r=Math.floor(t[0]),a=Math.floor(t[1]);return{x:r,y:a,width:Math.ceil(n[0])-r,height:Math.ceil(n[1])-a}},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],a=s(e.getMax(),2);return this.rBush.search({minX:n,minY:r,maxX:a[0],maxY:a[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,a=n.fill,i=n.opacity,o=n.lineDash,s=n.lineDashOffset;o&&e.setLineDash(o),E(s)||(e.lineDashOffset=s),E(i)||(e.globalAlpha*=i),E(r)||Array.isArray(r)||r.isNone||(e.strokeStyle=t.attributes.stroke),E(a)||Array.isArray(a)||a.isNone||(e.fillStyle=t.attributes.fill)},e.prototype.applyWorldTransform=function(e,t,n){var r=0,a=0,i=(t.parsedStyle||{}).anchor,o=i&&i[0]||0,s=i&&i[1]||0;if(0!==o||0!==s){var c=t.geometry.contentBounds;r=-o*(c&&2*c.halfExtents[0]||0),a=-s*(c&&2*c.halfExtents[1]||0)}n?(u(this.tmpMat4,t.getLocalTransform()),this.vec3a[0]=r,this.vec3a[1]=a,this.vec3a[2]=0,p(this.tmpMat4,this.tmpMat4,this.vec3a),d(this.tmpMat4,n,this.tmpMat4),d(this.tmpMat4,this.vpMatrix,this.tmpMat4)):(u(this.tmpMat4,t.getWorldTransform()),this.vec3a[0]=r,this.vec3a[1]=a,this.vec3a[2]=0,p(this.tmpMat4,this.tmpMat4,this.vec3a),d(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,a,i,o){var s=n.fill,c=n.fillRule,l=n.opacity,h=n.fillOpacity,u=n.stroke,d=n.strokeOpacity,p=n.lineWidth,f=n.lineCap,v=n.lineJoin,y=n.shadowType,g=n.shadowColor,m=n.shadowBlur,M=n.filter,x=n.miterLimit,b=!E(s)&&!s.isNone,S=!E(u)&&!u.isNone&&p>0,P=0===s.alpha,C=!(!M||!M.length),T=!E(g)&&m>0,A=r.nodeName,w="inner"===y,k=S&&T&&(A===t.Shape.PATH||A===t.Shape.LINE||A===t.Shape.POLYLINE||P||w);b&&(e.globalAlpha=l*h,k||ve(r,e,T),this.fill(e,r,s,c,a,i,o),k||this.clearShadowAndFilter(e,C,T)),S&&(e.globalAlpha=l*d,e.lineWidth=p,E(x)||(e.miterLimit=x),E(f)||(e.lineCap=f),E(v)||(e.lineJoin=v),k&&(w&&(e.globalCompositeOperation="source-atop"),ve(r,e,!0),w&&(this.stroke(e,r,u,a,i,o),e.globalCompositeOperation="source-over",this.clearShadowAndFilter(e,C,!0))),this.stroke(e,r,u,a,i,o))},e.prototype.clearShadowAndFilter=function(e,t,n){if(n&&(e.shadowColor="transparent",e.shadowBlur=0),t){var r=e.filter;!E(r)&&r.indexOf("drop-shadow")>-1&&(e.filter=r.replace(/drop-shadow\([^)]*\)/,"").trim()||"none")}},e.prototype.fill=function(e,n,r,a,i,o,s){var c=this;Array.isArray(r)?r.forEach((function(t){e.fillStyle=c.getColor(t,n,e),a?e.fill(a):e.fill()})):(t.isPattern(r)&&(e.fillStyle=this.getPattern(r,n,e,i,o,s)),a?e.fill(a):e.fill())},e.prototype.stroke=function(e,n,r,a,i,o){var s=this;Array.isArray(r)?r.forEach((function(t){e.strokeStyle=s.getColor(t,n,e),e.stroke()})):(t.isPattern(r)&&(e.strokeStyle=this.getPattern(r,n,e,a,i,o)),e.stroke())},e.prototype.getPattern=function(e,t,n,r,a,i){var o,s;if("rect"===e.image.nodeName){var c=e.image.parsedStyle,l=c.width,h=c.height;s=r.contextService.getDPR();var u=r.config.offscreenCanvas;(o=i.offscreenCanvasCreator.getOrCreateCanvas(u)).width=l*s,o.height=h*s;var d=i.offscreenCanvasCreator.getOrCreateContext(u),p=[];e.image.forEach((function(e){a.renderDisplayObject(e,d,r,p,i)})),p.forEach((function(){d.restore()}))}return this.imagePool.getOrCreatePatternSync(e,n,o,s,(function(){t.renderable.dirty=!0,r.renderingService.dirtify()}))},e.prototype.getColor=function(e,n,r){var i;if(e.type===t.GradientType.LinearGradient||e.type===t.GradientType.RadialGradient){var o=n.getGeometryBounds(),s=o&&2*o.halfExtents[0]||1,c=o&&2*o.halfExtents[1]||1;i=this.imagePool.getOrCreateGradient(a(a({type:e.type},e.value),{width:s,height:c}),r)}return i},e}();function ve(e,t,n){var r=e.parsedStyle,a=r.filter,i=r.shadowColor,o=r.shadowBlur,s=r.shadowOffsetX,c=r.shadowOffsetY;a&&a.length&&(t.filter=e.style.filter),n&&(t.shadowColor=""+i,t.shadowBlur=o||0,t.shadowOffsetX=s||0,t.shadowOffsetY=c||0)}var ye=function(){function e(e){this.imagePool=e}return e.prototype.render=function(e,t,n){var r,a=t.img,i=t.shadowColor,o=t.shadowBlur,s=t.width,c=t.height;if(b(a)?r=this.imagePool.getImageSync(a):(s||(s=a.width),c||(c=a.height),r=a),r){ve(n,e,!E(i)&&o>0);try{e.drawImage(r,0,0,s,c)}catch(e){}}},e}(),ge=function(){function e(){}return e.prototype.render=function(e,t,n,r,a,i){var o=t.lineWidth,s=t.textAlign,c=t.textBaseline,l=t.lineJoin,h=t.miterLimit,u=t.letterSpacing,d=t.stroke,p=t.fill,f=t.fillOpacity,v=t.strokeOpacity,y=t.opacity,g=t.metrics,m=t.dx,M=t.dy,x=t.shadowColor,b=t.shadowBlur,S=g.lines,P=g.height,C=g.lineHeight,T=g.lineMetrics;e.font=g.font,e.lineWidth=o,e.textAlign="middle"===s?"center":s;var A=c;i.enableCSSParsing||"alphabetic"!==A||(A="bottom"),e.lineJoin=l,E(h)||(e.miterLimit=h);var w=0;"middle"===c?w=-P/2-C/2:"bottom"===c||"alphabetic"===c||"ideographic"===c?w=-P:"top"!==c&&"hanging"!==c||(w=-C);var k=m||0;w+=M||0,1===S.length&&("bottom"===A?(A="middle",w-=.5*P):"top"===A&&(A="middle",w+=.5*P)),e.textBaseline=A,ve(n,e,!E(x)&&b>0);for(var O=0;S.length>O;O++){var L=o/2+k;w+=C,E(d)||d.isNone||!o||this.drawLetterSpacing(e,S[O],T[O],s,L,w,u,f,v,y,!0),E(p)||this.drawLetterSpacing(e,S[O],T[O],s,L,w,u,f,v,y)}},e.prototype.drawLetterSpacing=function(e,t,n,r,a,i,o,s,c,l,h){if(void 0===h&&(h=!1),0!==o){var u=e.textAlign;e.textAlign="left";var d=a;"center"===r||"middle"===r?d=a-n.width/2:"right"!==r&&"end"!==r||(d=a-n.width);for(var p=Array.from(t),f=e.measureText(t).width,v=0,y=0;p.length>y;++y){var g=p[y];h?this.strokeText(e,g,d,i,c):this.fillText(e,g,d,i,s,l),d+=f-(v=e.measureText(t.substring(y+1)).width)+o,f=v}e.textAlign=u}else h?this.strokeText(e,t,a,i,c):this.fillText(e,t,a,i,s,l)},e.prototype.fillText=function(e,t,n,r,a,i){var o,s=!E(a)&&1!==a;s&&(o=e.globalAlpha,e.globalAlpha=a*i),e.fillText(t,n,r),s&&(e.globalAlpha=o)},e.prototype.strokeText=function(e,t,n,r,a){var i,o=!E(a)&&1!==a;o&&(i=e.globalAlpha,e.globalAlpha=a),e.strokeText(t,n,r),o&&(e.globalAlpha=i)},e}(),me=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return r(t,e),t}(fe),Ee=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return r(t,e),t}(fe),Me=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return r(t,e),t}(fe),xe=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return r(t,e),t}(fe),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),Ce=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=a({dirtyObjectNumThreshold:500,dirtyObjectRatioThreshold:.8},this.options),r=this.context.imagePool,i=new fe(r),o=((e={})[t.Shape.CIRCLE]=i,e[t.Shape.ELLIPSE]=i,e[t.Shape.RECT]=i,e[t.Shape.IMAGE]=new ye(r),e[t.Shape.TEXT]=new ge,e[t.Shape.LINE]=i,e[t.Shape.POLYLINE]=i,e[t.Shape.POLYGON]=i,e[t.Shape.PATH]=i,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),Te=Object.freeze({__proto__:null,CircleRenderer:Ee,EllipseRenderer:Me,ImageRenderer:ye,LineRenderer:xe,PathRenderer:Pe,Plugin:Ce,PolygonRenderer:Se,PolylineRenderer:be,RectRenderer:me,TextRenderer:ge}),Ae=function(){function e(){}return e.prototype.apply=function(t,n){var r=this,a=t.renderingService,i=t.renderingContext,o=t.config;this.context=t;var s=i.root.ownerDocument.defaultView,c=function(e){a.hooks.pointerMove.call(e)},l=function(e){a.hooks.pointerUp.call(e)},h=function(e){a.hooks.pointerDown.call(e)},u=function(e){a.hooks.pointerOver.call(e)},d=function(e){a.hooks.pointerOut.call(e)},p=function(e){a.hooks.pointerCancel.call(e)},f=function(e){a.hooks.pointerWheel.call(e)},v=function(e){a.hooks.click.call(e)};a.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})})),a.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)}(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}(),we=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 Ae)},t.prototype.destroy=function(){this.removeAllRenderingPlugins()},t}(t.AbstractRendererPlugin),ke=Object.freeze({__proto__:null,Plugin:we}),Oe=function(){function e(){this.displayObjectHTMLElementMap=new WeakMap}return e.prototype.joinTransformMatrix=function(e){return"matrix(".concat([e[0],e[1],e[4],e[5],e[12],e[13]].join(","),")")},e.prototype.apply=function(n,r){var a=this,i=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=a.joinTransformMatrix(e.getWorldTransform())},u=function(e){var n=e.target;if(n.nodeName===t.Shape.HTML){a.$camera||(a.$camera=a.createCamera(i));var o=a.getOrCreateEl(n);if(a.$camera.appendChild(o),r.enableCSSParsing){var s=n.ownerDocument.documentElement.attributes;Object.keys(s).forEach((function(e){o.style[e]=s[e]}))}Object.keys(n.attributes).forEach((function(e){a.updateAttribute(e,n)})),h(n,o),l.set(o,n)}},d=function(e){var n=e.target;if(n.nodeName===t.Shape.HTML&&a.$camera){var r=a.getOrCreateEl(n);r&&(r.remove(),l.delete(r))}},p=function(e){var n=e.target;n.nodeName===t.Shape.HTML&&a.updateAttribute(e.attrName,n)},f=function(e){var n=e.target;if(n.nodeName===t.Shape.HTML){var r=a.getOrCreateEl(n);h(n,r)}},v=function(){if(a.$camera){var e=a.context.config,t=e.height;a.$camera.style.width="".concat(e.width||0,"px"),a.$camera.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(){a.$camera&&o.renderReasons.has(t.RenderReason.CAMERA_CHANGED)&&(a.$camera.style.transform=a.joinTransformMatrix(i.getOrthoMatrix()))})),s.hooks.destroy.tap(e.tag,(function(){a.$camera&&a.$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,a=t.height,i=this.context.contextService.getDomElement(),o=i.parentNode;if(o){var s="g-canvas-camera",c=o.querySelector("#"+s);if(!c){var l=(n||document).createElement("div");c=l,l.id=s,l.style.position="absolute",l.style.left="".concat(i.offsetLeft||0,"px"),l.style.top="".concat(i.offsetTop||0,"px"),l.style.transformOrigin="left top",l.style.transform=this.joinTransformMatrix(e.getOrthoMatrix()),l.style.overflow="hidden",l.style.pointerEvents="none",l.style.width="".concat(r||0,"px"),l.style.height="".concat(a||0,"px"),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.left="0px",n.style.top="0px",n.style["will-change"]="transform",n.style.transform=this.joinTransformMatrix(e.getWorldTransform())),n},e.prototype.updateAttribute=function(e,n){var r=this.getOrCreateEl(n);switch(e){case"innerHTML":var a=n.parsedStyle.innerHTML;b(a)?r.innerHTML=a:(r.innerHTML="",r.appendChild(a));break;case"transformOrigin":var i=n.parsedStyle.transformOrigin;r.style["transform-origin"]="".concat(i[0].value," ").concat(i[1].value);break;case"width":if(this.context.enableCSSParsing){var o=n.computedStyleMap().get("width");r.style.width=""+o}else{r.style.width=P(o=n.parsedStyle.width)?"".concat(o,"px"):""+o}break;case"height":if(this.context.enableCSSParsing){var s=n.computedStyleMap().get("height");r.style.height=""+s}else{r.style.height=P(s=n.parsedStyle.height)?"".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":r.style.pointerEvents=n.parsedStyle.pointerEvents;break;case"opacity":r.style.opacity="".concat(n.parsedStyle.opacity);break;case"fill":var c=n.parsedStyle.fill,l="";t.isCSSRGB(c)?l=c.isNone?"transparent":n.getAttribute("fill"):Array.isArray(c)?l=n.getAttribute("fill"):t.isPattern(c),r.style.background=l;break;case"stroke":var h=n.parsedStyle.stroke,u="";t.isCSSRGB(h)?u=h.isNone?"transparent":n.getAttribute("stroke"):Array.isArray(h)?u=n.getAttribute("stroke"):t.isPattern(h),r.style["border-color"]=u,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:"x"!==e&&"y"!==e&&(E(n.style[e])||""===n.style[e]||(r.style[e]=n.style[e]))}},e.tag="HTMLRendering",e}(),Le=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 Oe)},t.prototype.destroy=function(){this.removeAllRenderingPlugins()},t}(t.AbstractRendererPlugin),Re=Object.freeze({__proto__:null,Plugin:Le}),Ie=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(a,i){var o;r?o=r(e):t.isBrowser&&(o=new window.Image),o&&(o.onload=function(){n.imageCache[e]=o,a(o)},o.onerror=function(e){i(e)},o.crossOrigin="Anonymous",o.src=e)}))},e.prototype.getOrCreatePatternSync=function(e,n,r,a,i){var o=this.generatePatternKey(e);if(o&&this.patternCache[o])return this.patternCache[o];var s,c=e.image,l=e.repetition,u=e.transform,d=!1;b(c)?s=this.getImageSync(c,i):r?(s=r,d=!0):s=c;var p,f=s&&n.createPattern(s,l);if(f){var v=void 0;u?v=t.parsedTransformToMat4(t.parseTransform(u),new t.DisplayObject({})):((p=h())[0]=1,p[1]=0,p[2]=0,p[3]=0,p[4]=0,p[5]=1,p[6]=0,p[7]=0,p[8]=0,p[9]=0,p[10]=1,p[11]=0,p[12]=0,p[13]=0,p[14]=0,p[15]=1,v=p),d&&function(e,t,n){var r=n[0],a=n[1],i=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]*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]}(v,v,[1/a,1/a,1]),f.setTransform({a:v[0],b:v[1],c:v[4],d:v[5],e:v[12],f:v[13]})}return o&&f&&(this.patternCache[o]=f),f},e.prototype.getOrCreateGradient=function(e,n){var r=this.generateGradientKey(e),a=e.type,i=e.steps,o=e.width,s=e.height,c=e.cx,l=e.cy,h=e.size;if(this.gradientCache[r])return this.gradientCache[r];var u=null;if(a===t.GradientType.LinearGradient){var d=t.computeLinearGradient(o,s,e.angle);u=n.createLinearGradient(d.x1,d.y1,d.x2,d.y2)}else if(a===t.GradientType.RadialGradient){var p=t.computeRadialGradient(o,s,c,l,h),f=p.x,v=p.y;u=n.createRadialGradient(f,v,0,f,v,p.r)}return u&&(i.forEach((function(e){var n=e.offset;n.unit===t.UnitType.kPercentage&&(null==u||u.addColorStop(n.value/100,""+e.color))})),this.gradientCache[r]=u),this.gradientCache[r]},e.prototype.generateGradientKey=function(e){var t=e.width,n=e.height,r=e.steps,a=e.angle,i=e.cx,o=e.cy,s=e.size;return"gradient-".concat(e.type,"-").concat((null==a?void 0:""+a)||0,"-").concat((null==i?void 0:""+i)||0,"-").concat((null==o?void 0:""+o)||0,"-").concat((null==s?void 0:""+s)||0,"-").concat(t,"-").concat(n,"-").concat(r.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 b(t)?"pattern-".concat(t,"-").concat(n):"rect"===t.nodeName?"pattern-".concat(t.entity,"-").concat(n):void 0},e}(),Ne=function(){function e(){}return e.prototype.apply=function(n){var r=n.renderingService,a=n.imagePool,i=n.renderingContext.root.ownerDocument.defaultView,o=function(e,t,n){var r=e.parsedStyle,a=r.width,i=r.height;a&&!i?e.setAttribute("height",n/t*a):!a&&i&&e.setAttribute("width",t/n*i)},s=function(e){var n=e.target,i=n.attributes;if(n.nodeName===t.Shape.IMAGE){var s=i.img,c=i.keepAspectRatio;b(s)&&a.getImageSync(s,(function(e){c&&o(n,e.width,e.height),n.renderable.dirty=!0,r.dirtify()}))}},c=function(e){var n=e.target,i=e.newValue;n.nodeName===t.Shape.IMAGE&&"img"===e.attrName&&b(i)&&a.getOrCreateImage(i).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(){i.addEventListener(t.ElementEvent.MOUNTED,s),i.addEventListener(t.ElementEvent.ATTR_MODIFIED,c)})),r.hooks.destroy.tap(e.tag,(function(){i.removeEventListener(t.ElementEvent.MOUNTED,s),i.removeEventListener(t.ElementEvent.ATTR_MODIFIED,c)}))},e.tag="LoadImage",e}(),Be=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 Ie(this.context.config),this.addRenderingPlugin(new Ne)},t.prototype.destroy=function(){this.removeAllRenderingPlugins()},t}(t.AbstractRendererPlugin),De=Object.freeze({__proto__:null,ImagePool:Ie,Plugin:Be}),Fe=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=b(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(e){return void 0===e&&(e={}),i(this,void 0,void 0,(function(){return o(this,(function(t){return[2,this.context.canvas.toDataURL(e.type,e.encoderOptions)]}))}))},e}(),Ge=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=Fe},t.prototype.destroy=function(){delete this.context.ContextService},t}(t.AbstractRendererPlugin),je=function(e){function t(t){var n=e.call(this,t)||this;return n.registerPlugin(new Ge),n.registerPlugin(new Be),n.registerPlugin(new R),n.registerPlugin(new Ce),n.registerPlugin(new we),n.registerPlugin(new ue),n.registerPlugin(new Le),n}return r(t,e),t}(t.AbstractRenderer);e.CanvasPathGenerator=I,e.CanvasPicker=de,e.CanvasRenderer=Te,e.DomInteraction=ke,e.HTMLRenderer=Re,e.ImageLoader=De,e.Renderer=je}));
//# sourceMappingURL=index.umd.min.js.map
{
"name": "@antv/g-canvas",
"version": "1.11.24",
"version": "1.11.25",
"description": "A renderer implemented by Canvas 2D API",

@@ -40,9 +40,9 @@ "keywords": [

"tslib": "^2.5.3",
"@antv/g-lite": "1.2.19",
"@antv/g-plugin-canvas-path-generator": "1.3.19",
"@antv/g-plugin-canvas-picker": "1.10.21",
"@antv/g-plugin-canvas-renderer": "1.9.21",
"@antv/g-plugin-dom-interaction": "1.9.19",
"@antv/g-plugin-html-renderer": "1.9.22",
"@antv/g-plugin-image-loader": "1.3.19"
"@antv/g-lite": "1.2.20",
"@antv/g-plugin-canvas-path-generator": "1.3.20",
"@antv/g-plugin-canvas-picker": "1.10.22",
"@antv/g-plugin-canvas-renderer": "1.9.22",
"@antv/g-plugin-dom-interaction": "1.9.20",
"@antv/g-plugin-html-renderer": "1.9.23",
"@antv/g-plugin-image-loader": "1.3.20"
},

@@ -49,0 +49,0 @@ "devDependencies": {

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc