@antv/g-canvas 2.0.15-alpha.7 → 2.0.16-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Canvas2DContextService.d.ts +0 -1
- package/dist/ContextRegisterPlugin.d.ts +0 -1
- package/dist/index.d.ts +0 -1
- package/dist/index.esm.js +0 -10
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +0 -10
- package/dist/index.js.map +1 -1
- package/dist/index.umd.min.js +1 -1
- package/dist/index.umd.min.js.map +1 -1
- package/package.json +9 -9
- package/dist/Canvas2DContextService.d.ts.map +0 -1
- package/dist/ContextRegisterPlugin.d.ts.map +0 -1
- package/dist/index.d.ts.map +0 -1
package/dist/index.d.ts
CHANGED
package/dist/index.esm.js
CHANGED
|
@@ -47,7 +47,6 @@ var Canvas2DContextService = /** @class */ (function () {
|
|
|
47
47
|
}
|
|
48
48
|
this.context = this.$canvas.getContext('2d');
|
|
49
49
|
this.resize(this.canvasConfig.width, this.canvasConfig.height);
|
|
50
|
-
applyCanvasImageSmoothingConfig(this.context, this.canvasConfig.renderer.getConfig());
|
|
51
50
|
};
|
|
52
51
|
Canvas2DContextService.prototype.getContext = function () {
|
|
53
52
|
return this.context;
|
|
@@ -107,15 +106,6 @@ var Canvas2DContextService = /** @class */ (function () {
|
|
|
107
106
|
};
|
|
108
107
|
return Canvas2DContextService;
|
|
109
108
|
}());
|
|
110
|
-
function applyCanvasImageSmoothingConfig(context, config) {
|
|
111
|
-
var imageSmoothingEnabled = config.imageSmoothingEnabled, imageSmoothingQuality = config.imageSmoothingQuality;
|
|
112
|
-
if (imageSmoothingEnabled !== undefined) {
|
|
113
|
-
context.imageSmoothingEnabled = imageSmoothingEnabled;
|
|
114
|
-
}
|
|
115
|
-
if (imageSmoothingQuality !== undefined) {
|
|
116
|
-
context.imageSmoothingQuality = imageSmoothingQuality;
|
|
117
|
-
}
|
|
118
|
-
}
|
|
119
109
|
|
|
120
110
|
var ContextRegisterPlugin = /** @class */ (function (_super) {
|
|
121
111
|
__extends(ContextRegisterPlugin, _super);
|
package/dist/index.esm.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.esm.js","sources":["../src/Canvas2DContextService.ts","../src/ContextRegisterPlugin.ts","../src/index.ts"],"sourcesContent":[null,null,null],"names":[],"mappings":";;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"index.esm.js","sources":["../src/Canvas2DContextService.ts","../src/ContextRegisterPlugin.ts","../src/index.ts"],"sourcesContent":[null,null,null],"names":[],"mappings":"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"}
|
package/dist/index.js
CHANGED
|
@@ -67,7 +67,6 @@ var Canvas2DContextService = /** @class */ (function () {
|
|
|
67
67
|
}
|
|
68
68
|
this.context = this.$canvas.getContext('2d');
|
|
69
69
|
this.resize(this.canvasConfig.width, this.canvasConfig.height);
|
|
70
|
-
applyCanvasImageSmoothingConfig(this.context, this.canvasConfig.renderer.getConfig());
|
|
71
70
|
};
|
|
72
71
|
Canvas2DContextService.prototype.getContext = function () {
|
|
73
72
|
return this.context;
|
|
@@ -127,15 +126,6 @@ var Canvas2DContextService = /** @class */ (function () {
|
|
|
127
126
|
};
|
|
128
127
|
return Canvas2DContextService;
|
|
129
128
|
}());
|
|
130
|
-
function applyCanvasImageSmoothingConfig(context, config) {
|
|
131
|
-
var imageSmoothingEnabled = config.imageSmoothingEnabled, imageSmoothingQuality = config.imageSmoothingQuality;
|
|
132
|
-
if (imageSmoothingEnabled !== undefined) {
|
|
133
|
-
context.imageSmoothingEnabled = imageSmoothingEnabled;
|
|
134
|
-
}
|
|
135
|
-
if (imageSmoothingQuality !== undefined) {
|
|
136
|
-
context.imageSmoothingQuality = imageSmoothingQuality;
|
|
137
|
-
}
|
|
138
|
-
}
|
|
139
129
|
|
|
140
130
|
var ContextRegisterPlugin = /** @class */ (function (_super) {
|
|
141
131
|
tslib.__extends(ContextRegisterPlugin, _super);
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../src/Canvas2DContextService.ts","../src/ContextRegisterPlugin.ts","../src/index.ts"],"sourcesContent":[null,null,null],"names":["isString","isBrowser","setDOMSize","RenderReason","__extends","AbstractRendererPlugin","ImageLoader","CanvasPathGenerator","CanvasRenderer","DomInteraction","CanvasPicker","HTMLRenderer","AbstractRenderer"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../src/Canvas2DContextService.ts","../src/ContextRegisterPlugin.ts","../src/index.ts"],"sourcesContent":[null,null,null],"names":["isString","isBrowser","setDOMSize","RenderReason","__extends","AbstractRendererPlugin","ImageLoader","CanvasPathGenerator","CanvasRenderer","DomInteraction","CanvasPicker","HTMLRenderer","AbstractRenderer"],"mappings":"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"}
|
package/dist/index.umd.min.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@antv/g-lite")):"function"==typeof define&&define.amd?define(["exports","@antv/g-lite"],t):t(((e="undefined"!=typeof globalThis?globalThis:e||self).G=e.G||{},e.G.Canvas2D={}),e.window.G)}(this,(function(e,t){"use strict";var n=function(e,t){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},n(e,t)};function r(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+t+" is not a constructor or null");function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}var i=function(){return i=Object.assign||function(e){for(var t,n=1,r=arguments.length;r>n;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},i.apply(this,arguments)};function a(e,t,n,r){return new(n||(n=Promise))((function(i,a){function o(e){try{c(r.next(e))}catch(e){a(e)}}function s(e){try{c(r.throw(e))}catch(e){a(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(o,s)}c((r=r.apply(e,t||[])).next())}))}function o(e,t){var n,r,i,a,o={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return a={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function s(s){return function(c){return function(s){if(n)throw new TypeError("Generator is already executing.");for(;a&&(a=0,s[0]&&(o=0)),o;)try{if(n=1,r&&(i=2&s[0]?r.return:s[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,s[1])).done)return i;switch(r=0,i&&(s=[2&s[0],i.value]),s[0]){case 0:case 1:i=s;break;case 4:return o.label++,{value:s[1],done:!1};case 5:o.label++,r=s[1],s=[0];continue;case 7:s=o.ops.pop(),o.trys.pop();continue;default:if(!(i=o.trys,(i=i.length>0&&i[i.length-1])||6!==s[0]&&2!==s[0])){o=0;continue}if(3===s[0]&&(!i||s[1]>i[0]&&i[3]>s[1])){o.label=s[1];break}if(6===s[0]&&i[1]>o.label){o.label=i[1],i=s;break}if(i&&i[2]>o.label){o.label=i[2],o.ops.push(s);break}i[2]&&o.ops.pop(),o.trys.pop();continue}s=t.call(e,o)}catch(e){s=[6,e],r=0}finally{n=i=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,c])}}}function s(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,i,a=n.call(e),o=[];try{for(;(void 0===t||t-- >0)&&!(r=a.next()).done;)o.push(r.value)}catch(e){i={error:e}}finally{try{r&&!r.done&&(n=a.return)&&n.call(a)}finally{if(i)throw i.error}}return o}function c(e,t,n){if(n||2===arguments.length)for(var r,i=0,a=t.length;a>i;i++)!r&&i in t||(r||(r=Array.prototype.slice.call(t,0,i)),r[i]=t[i]);return e.concat(r||Array.prototype.slice.call(t))}function l(e){return null==e}function h(e){return"string"==typeof e}"function"==typeof SuppressedError&&SuppressedError;var u=function(e,t,n){return t>e?t:e>n?n:e};function d(e){return"number"==typeof e}var p="undefined"!=typeof Float32Array?Float32Array:Array;function v(){var e=new p(16);return p!=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 f(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 y(e,t,n){var r=t[0],i=t[1],a=t[2],o=t[3],s=t[4],c=t[5],l=t[6],h=t[7],u=t[8],d=t[9],p=t[10],v=t[11],f=t[12],y=t[13],g=t[14],m=t[15],x=n[0],E=n[1],b=n[2],S=n[3];return e[0]=x*r+E*s+b*u+S*f,e[1]=x*i+E*c+b*d+S*y,e[2]=x*a+E*l+b*p+S*g,e[3]=x*o+E*h+b*v+S*m,e[4]=(x=n[4])*r+(E=n[5])*s+(b=n[6])*u+(S=n[7])*f,e[5]=x*i+E*c+b*d+S*y,e[6]=x*a+E*l+b*p+S*g,e[7]=x*o+E*h+b*v+S*m,e[8]=(x=n[8])*r+(E=n[9])*s+(b=n[10])*u+(S=n[11])*f,e[9]=x*i+E*c+b*d+S*y,e[10]=x*a+E*l+b*p+S*g,e[11]=x*o+E*h+b*v+S*m,e[12]=(x=n[12])*r+(E=n[13])*s+(b=n[14])*u+(S=n[15])*f,e[13]=x*i+E*c+b*d+S*y,e[14]=x*a+E*l+b*p+S*g,e[15]=x*o+E*h+b*v+S*m,e}function g(){var e=new p(3);return p!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0),e}function m(e,t,n,r){return e[0]=t,e[1]=n,e[2]=r,e}function x(e,t,n){var r=t[0],i=t[1],a=t[2],o=n[3]*r+n[7]*i+n[11]*a+n[15];return e[0]=(n[0]*r+n[4]*i+n[8]*a+n[12])/(o=o||1),e[1]=(n[1]*r+n[5]*i+n[9]*a+n[13])/o,e[2]=(n[2]*r+n[6]*i+n[10]*a+n[14])/o,e}function E(e,t,n){return{x:e*Math.cos(n)-t*Math.sin(n),y:e*Math.sin(n)+t*Math.cos(n)}}function b(e,t,n,r,i,a,o,s,c,l){var h,u,d,p,v,f=e,y=t,g=n,m=r,x=s,S=c,M=120*Math.PI/180,T=Math.PI/180*(+i||0),C=[];if(l)u=l[0],d=l[1],p=l[2],v=l[3];else{y=(h=E(f,y,-T)).y;var P=((f=h.x)-(x=(h=E(x,S,-T)).x))/2,A=(y-(S=h.y))/2,w=P*P/(g*g)+A*A/(m*m);w>1&&(g*=w=Math.sqrt(w),m*=w);var O=g*g,k=m*m,L=(a===o?-1:1)*Math.sqrt(Math.abs((O*k-O*A*A-k*P*P)/(O*A*A+k*P*P)));p=L*g*A/m+(f+x)/2,u=Math.asin(((y-(v=L*-m*P/g+(y+S)/2))/m*1e9>>0)/1e9),d=Math.asin(((S-v)/m*1e9>>0)/1e9),0>(u=p>f?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)>M){var N=d,B=x,D=S;C=b(x=p+g*Math.cos(d=u+M*(o&&d>u?1:-1)),S=v+m*Math.sin(d),g,m,i,0,o,B,D,[d,N,p,v])}R=d-u;var I=Math.cos(u),F=Math.sin(u),G=Math.cos(d),j=Math.sin(d),_=Math.tan(R/4),H=4/3*g*_,$=4/3*m*_,W=[f,y],U=[f+H*F,y-$*I],z=[x+H*j,S-$*G],Y=[x,S];if(U[0]=2*W[0]-U[0],U[1]=2*W[1]-U[1],l)return U.concat(z,Y,C);for(var Q=[],q=0,X=(C=U.concat(z,Y,C)).length;X>q;q+=1)Q[q]=q%2?E(C[q-1],C[q],T).y:E(C[q],C[q+1],T).x;return Q}Math.hypot||(Math.hypot=function(){for(var e=0,t=arguments.length;t--;)e+=arguments[t]*arguments[t];return Math.sqrt(e)}),g(),function(){var e,t=(e=new p(2),p!=Float32Array&&(e[0]=0,e[1]=0),e)}();var S=Math.PI,M=S/2,T=1.5*S,C=2*S;function P(e,t){var n=t.cx,r=t.cy;e.arc(void 0===n?0:n,void 0===r?0:r,t.r,0,C,!1)}function A(e,t){var n=t.cx,r=void 0===n?0:n,i=t.cy,a=void 0===i?0:i,o=t.rx,s=t.ry;if(e.ellipse)e.ellipse(r,a,o,s,0,0,C,!1);else{var c=void 0,l=void 0,h=void 0;o>s?(c=o,l=1,h=s/o):(c=s,l=o/s,h=1),e.save(),e.scale(l,h),e.arc(r,a,c,0,C)}}function w(e,n){var r,i=n.x1,a=n.y1,o=n.x2,s=n.y2,c=n.markerEnd,l=n.markerStartOffset,h=void 0===l?0:l,u=n.markerEndOffset,d=void 0===u?0:u,p=0,v=0,f=0,y=0;t.isDisplayObject(n.markerStart)&&h&&(p=Math.cos(r=Math.atan2(s-a,o-i))*h,v=Math.sin(r)*h);t.isDisplayObject(c)&&d&&(f=Math.cos(r=Math.atan2(a-s,i-o))*d,y=Math.sin(r)*d);e.moveTo(i+p,a+v),e.lineTo(o+f,s+y)}function O(e,n){var r=n.markerStart,i=n.markerEnd,a=n.markerStartOffset,o=void 0===a?0:a,c=n.markerEndOffset,l=void 0===c?0:c,h=n.d,u=h.absolutePath,d=h.segments,p=0,v=0,f=0,y=0;if(t.isDisplayObject(r)&&o){var g=s(r.parentNode.getStartTangent(),2),m=s(g[0],2),x=m[0],E=m[1],b=s(g[1],2);p=Math.cos(S=Math.atan2(E-b[1],x-b[0]))*o,v=Math.sin(S)*o}if(t.isDisplayObject(i)&&l){var S,M=s(i.parentNode.getEndTangent(),2),T=s(M[0],2),C=(x=T[0],E=T[1],s(M[1],2));f=Math.cos(S=Math.atan2(E-C[1],x-C[0]))*l,y=Math.sin(S)*l}for(var P=u.length,A=P-1,w=0;P>w;w++){var O=u[w],k=u[w+1],L=0===w&&(0!==p||0!==v),R=(w===A||k&&("M"===k[0]||"Z"===k[0]))&&0!==f&&0!==y;switch(O[0]){case"M":L?e.moveTo(O[1]+p,O[2]+v):e.moveTo(O[1],O[2]);break;case"L":R?e.lineTo(O[1]+f,O[2]+y):e.lineTo(O[1],O[2]);break;case"Q":e.quadraticCurveTo(O[1],O[2],O[3],O[4]),R&&e.lineTo(O[3]+f,O[4]+y);break;case"C":e.bezierCurveTo(O[1],O[2],O[3],O[4],O[5],O[6]),R&&e.lineTo(O[5]+f,O[6]+y);break;case"A":var N=d[w].arcParams,B=N.cx,D=N.cy,I=N.rx,F=N.ry,G=N.startAngle,j=N.endAngle,_=N.xRotation,H=N.sweepFlag;if(e.ellipse)e.ellipse(B,D,I,F,_,G,j,!!(1-H));else{var $=void 0,W=void 0,U=void 0;I>F?($=I,W=1,U=F/I):($=F,W=I/F,U=1),e.translate(B,D),e.rotate(_),e.scale(W,U),e.arc(0,0,$,G,j,!!(1-H)),e.scale(1/W,1/U),e.rotate(-_),e.translate(-B,-D)}R&&e.lineTo(O[6]+f,O[7]+y);break;case"Z":e.closePath()}}}function k(e,n){var r,i=n.markerEnd,a=n.markerStartOffset,o=void 0===a?0:a,s=n.markerEndOffset,c=void 0===s?0:s,l=n.points.points,h=l.length-1,u=l[0][0],d=l[0][1],p=l[h][0],v=l[h][1],f=0,y=0,g=0,m=0;t.isDisplayObject(n.markerStart)&&o&&(f=Math.cos(r=Math.atan2(l[1][1]-l[0][1],l[1][0]-l[0][0]))*o,y=Math.sin(r)*o);t.isDisplayObject(i)&&c&&(g=Math.cos(r=Math.atan2(l[h][1]-l[0][1],l[h][0]-l[0][0]))*c,m=Math.sin(r)*c);e.moveTo(u+(f||g),d+(y||m));for(var x=1;h>x;x++)e.lineTo(l[x][0],l[x][1]);e.lineTo(p,v)}function L(e,n){var r,i=n.markerEnd,a=n.markerStartOffset,o=void 0===a?0:a,s=n.markerEndOffset,c=void 0===s?0:s,l=n.points.points,h=l.length,u=h-1,d=h-2,p=l[0][0],v=l[0][1],f=l[u][0],y=l[u][1],g=0,m=0,x=0,E=0;t.isDisplayObject(n.markerStart)&&o&&(g=Math.cos(r=Math.atan2(l[1][1]-l[0][1],l[1][0]-l[0][0]))*o,m=Math.sin(r)*o);t.isDisplayObject(i)&&c&&(x=Math.cos(r=Math.atan2(l[d][1]-l[u][1],l[d][0]-l[u][0]))*c,E=Math.sin(r)*c);e.moveTo(p+g,v+m);for(var b=1;u>b;b++)e.lineTo(l[b][0],l[b][1]);e.lineTo(f+x,y+E)}function R(e,t){var n=t.x,r=void 0===n?0:n,i=t.y,a=void 0===i?0:i,o=t.radius,c=t.width,l=t.height;if(o&&o.some((function(e){return 0!==e}))){var h=c>0?1:-1,d=l>0?1:-1,p=h+d===0,v=s(o.map((function(e){return u(e,0,Math.min(Math.abs(c)/2,Math.abs(l)/2))})),4),f=v[0],y=v[1],g=v[2],m=v[3],x=h*f+r,E=c-h*y+r;e.moveTo(x,a),e.lineTo(E,a),0!==y&&e.arc(E,d*y+a,y,-d*M,h>0?0:S,p);var b=l-d*g+a;e.lineTo(c+r,b),0!==g&&e.arc(c-h*g+r,b,g,h>0?0:S,d>0?M:T,p);var C=h*m+r;e.lineTo(C,l+a),0!==m&&e.arc(C,l-d*m+a,m,d>0?M:-M,h>0?S:0,p);var P=d*f+a;e.lineTo(r,P),0!==f&&e.arc(x,P,f,h>0?S:0,d>0?T:M,p)}else e.rect(r,a,c,l)}var N=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;this.context.pathGeneratorFactory=((e={})[t.Shape.CIRCLE]=P,e[t.Shape.ELLIPSE]=A,e[t.Shape.RECT]=R,e[t.Shape.LINE]=w,e[t.Shape.POLYLINE]=L,e[t.Shape.POLYGON]=k,e[t.Shape.PATH]=O,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)},n.prototype.destroy=function(){delete this.context.pathGeneratorFactory},n}(t.AbstractRendererPlugin),B=Object.freeze({__proto__:null,Plugin:N});function D(e,t,n,r){var i=e-n,a=t-r;return Math.sqrt(i*i+a*a)}var I=1e-4;function F(e,t,n,r,i,a){var o=-1,l=1/0,h=[n,r],u=20;a&&a>200&&(u=a/10);for(var d=1/u,p=d/10,v=0;u>=v;v++){var f=v*d,y=[i.apply(void 0,c([],s(e.concat([f])),!1)),i.apply(void 0,c([],s(t.concat([f])),!1))];l>(E=D(h[0],h[1],y[0],y[1]))&&(o=f,l=E)}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(v=0;32>v&&I<=p;v++){var m=o-p,x=o+p,E=(y=[i.apply(void 0,c([],s(e.concat([m])),!1)),i.apply(void 0,c([],s(t.concat([m])),!1))],D(h[0],h[1],y[0],y[1]));if(m>=0&&l>E)o=m,l=E;else{var b=[i.apply(void 0,c([],s(e.concat([x])),!1)),i.apply(void 0,c([],s(t.concat([x])),!1))],S=D(h[0],h[1],b[0],b[1]);1>=x&&l>S?(o=x,l=S):p*=.5}}return{x:i.apply(void 0,c([],s(e.concat([o])),!1)),y:i.apply(void 0,c([],s(t.concat([o])),!1))}}function G(e,t,n,r,i,a){var o=[n-e,r-t];if(function(e,t){return e[0]===t[0]&&e[1]===t[1]}(o,[0,0]))return Math.sqrt((i-e)*(i-e)+(a-t)*(a-t));var s=[-o[1],o[0]];return function(e,t){var n=t[0],r=t[1],i=n*n+r*r;i>0&&(i=1/Math.sqrt(i)),e[0]=t[0]*i,e[1]=t[1]*i}(s,s),Math.abs(function(e,t){return e[0]*t[0]+e[1]*t[1]}([i-e,a-t],s))}function j(e,t,n,r,i){var a=1-i;return a*a*a*e+3*t*i*a*a+3*n*i*i*a+r*i*i*i}function _(e,t,n,r,i,a,o,s,c,l,h){var u=function(e,t,n,r,i,a,o,s,c,l,h){return F([e,n,i,o],[t,r,a,s],c,l,j,h)}(e,t,n,r,i,a,o,s,c,l,h);return D(u.x,u.y,c,l)}function H(e,t,n,r){var i=1-r;return i*i*e+2*r*i*t+r*r*n}function $(e,t,n,r,i,a,o,s){var c=function(e,t,n,r,i,a,o,s){return F([e,n,i],[t,r,a],o,s,H)}(e,t,n,r,i,a,o,s);return D(c.x,c.y,o,s)}var W=g(),U=g(),z=g(),Y=v(),Q=function(){function e(){var e=this;this.isHit=function(n,r,i,a){var o,s,c,l,h,u,d,p,v,f,y,g,E,b,S,M,T,C,P,A,w,O,k,L,R,N,B,D,I,F,G,j=e.context.pointInPathPickerFactory[n.nodeName];if(j){var _=(o=Y,(G=(P=(c=(s=i)[0])*(p=s[5])-(l=s[1])*(d=s[4]))*(F=(E=s[10])*(C=s[15])-(b=s[11])*(T=s[14]))-(A=c*(v=s[6])-(h=s[2])*d)*(I=(g=s[9])*C-b*(M=s[13]))+(w=c*(f=s[7])-(u=s[3])*d)*(D=g*T-E*M)+(O=l*v-h*p)*(B=(y=s[8])*C-b*(S=s[12]))-(k=l*f-u*p)*(N=y*T-E*S)+(L=h*f-u*v)*(R=y*M-g*S))?(o[0]=(p*F-v*I+f*D)*(G=1/G),o[1]=(h*I-l*F-u*D)*G,o[2]=(M*L-T*k+C*O)*G,o[3]=(E*k-g*L-b*O)*G,o[4]=(v*B-d*F-f*N)*G,o[5]=(c*F-h*B+u*N)*G,o[6]=(T*w-S*L-C*A)*G,o[7]=(y*L-E*w+b*A)*G,o[8]=(d*I-p*B+f*R)*G,o[9]=(l*B-c*I-u*R)*G,o[10]=(S*k-M*w+C*P)*G,o[11]=(g*w-y*k-b*P)*G,o[12]=(p*N-d*D-v*R)*G,o[13]=(c*D-l*N+h*R)*G,o[14]=(M*A-S*O-T*P)*G,o[15]=(y*O-g*A+E*P)*G,o):null),H=x(U,m(z,r[0],r[1],0),_);if(j(n,new t.Point(H[0],H[1]),a,e.isPointInPath,e.context,e.runtime))return!0}return!1},this.isPointInPath=function(t,n){var r=e.runtime.offscreenCanvasCreator.getOrCreateContext(e.context.config.offscreenCanvas),i=e.context.pathGeneratorFactory[t.nodeName];return i&&(r.beginPath(),i(r,t.parsedStyle),r.closePath()),r.isPointInPath(n.x,n.y)}}return e.prototype.apply=function(t,n){var r,i=this,s=t.renderingService,c=t.renderingContext;this.context=t,this.runtime=n;var l=null===(r=c.root)||void 0===r?void 0:r.ownerDocument;s.hooks.pick.tapPromise(e.tag,(function(e){return a(i,void 0,void 0,(function(){return o(this,(function(t){return[2,this.pick(l,e)]}))}))})),s.hooks.pickSync.tap(e.tag,(function(e){return i.pick(l,e)}))},e.prototype.pick=function(e,n){var r,i,a=n.topmost,o=n.position,s=m(W,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 v=t.findClosestClipPathTarget(d);if(v){var f=v.parsedStyle.clipPath;if(this.isHit(f,s,f.getWorldTransform(),!0)){if(a)return n.picked=[d],n;l.push(d)}}else{if(a)return n.picked=[d],n;l.push(d)}}}}catch(e){r={error:e}}finally{try{u&&!u.done&&(i=h.return)&&i.call(h)}finally{if(r)throw r.error}}return n.picked=l,n},e.tag="CanvasPicker",e}();function q(e,n,r){var i=e.parsedStyle,a=i.cx,o=i.cy,c=i.r,l=i.fill,h=i.stroke,u=i.lineWidth,d=i.increasedLineWidthForHitTesting,p=i.pointerEvents,v=void 0===p?"auto":p,f=((void 0===u?1:u)+(void 0===d?0:d))/2,y=D(void 0===a?0:a,void 0===o?0:o,n.x,n.y),g=s(t.isFillOrStrokeAffected(v,l,h),2),m=g[0],x=g[1];return m&&x||r?c+f>=y:m?c>=y:!!x&&(y>=c-f&&c+f>=y)}function X(e,t,n,r){return e/(n*n)+t/(r*r)}function V(e,n,r){var i=e.parsedStyle,a=i.cx,o=void 0===a?0:a,c=i.cy,l=void 0===c?0:c,h=i.rx,u=i.ry,d=i.lineWidth,p=void 0===d?1:d,v=i.increasedLineWidthForHitTesting,f=void 0===v?0:v,y=i.pointerEvents,g=n.x,m=n.y,x=s(t.isFillOrStrokeAffected(void 0===y?"auto":y,i.fill,i.stroke),2),E=x[0],b=x[1],S=(p+f)/2,M=(g-o)*(g-o),T=(m-l)*(m-l);return E&&b||r?1>=X(M,T,h+S,u+S):E?1>=X(M,T,h,u):!!b&&(X(M,T,h-S,u-S)>=1&&1>=X(M,T,h+S,u+S))}function Z(e,t,n,r,i,a){return!(e>i||i>e+n||t>a||a>t+r)}function J(e,t,n,r,i,a,o,s){var c=(Math.atan2(s-t,o-e)+2*Math.PI)%(2*Math.PI),l={x:e+n*Math.cos(c),y:t+n*Math.sin(c)};return D(l.x,l.y,o,s)<=a/2}function K(e,t,n,r,i,a,o){var s=i/2;return!(Math.min(e,n)-s>a||a>Math.max(e,n)+s||Math.min(t,r)-s>o||o>Math.max(t,r)+s)&&G(e,t,n,r,a,o)<=i/2}function ee(e,t,n,r,i){var a=e.length;if(2>a)return!1;for(var o=0;a-1>o;o++){if(K(e[o][0],e[o][1],e[o+1][0],e[o+1][1],t,n,r))return!0}if(i){var s=e[0],c=e[a-1];if(K(s[0],s[1],c[0],c[1],t,n,r))return!0}return!1}var te=1e-6;function ne(e){return te>Math.abs(e)?0:0>e?-1:1}function re(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 ie(e,t,n){var r=!1,i=e.length;if(2>=i)return!1;for(var a=0;i>a;a++){var o=e[a],s=e[(a+1)%i];if(re(o,s,[t,n]))return!0;ne(o[1]-n)>0!=ne(s[1]-n)>0&&0>ne(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,i=0;e.length>i;i++){if(r=ie(e[i],t,n))break}return r}function oe(e,n,r){var i=e.parsedStyle,a=i.x1,o=i.y1,c=i.x2,l=i.y2,h=i.lineWidth,u=void 0===h?1:h,d=i.increasedLineWidthForHitTesting,p=void 0===d?0:d,v=i.pointerEvents;return!(!s(t.isFillOrStrokeAffected(void 0===v?"auto":v,i.fill,i.stroke),2)[1]&&!r||!u)&&K(a,o,c,l,u+p,n.x,n.y)}function se(e,n,r,i,a,o){var c=e.parsedStyle,l=c.lineWidth,h=void 0===l?1:l,u=c.increasedLineWidthForHitTesting,d=void 0===u?0:u,p=c.d,v=c.pointerEvents,f=p.segments,y=p.hasArc,g=p.polylines,m=p.polygons,x=s(t.isFillOrStrokeAffected(void 0===v?"auto":v,(null==m?void 0:m.length)&&c.fill,c.stroke),2),E=x[0],S=x[1],M=t.getOrCalculatePathTotalLength(e),T=!1;return E||r?T=y?i(e,n):ae(m,n.x,n.y)||ae(g,n.x,n.y):((S||r)&&(T=function(e,t,n,r,i){for(var a=!1,o=t/2,s=0;e.length>s;s++){var c=e[s],l=c.currentPoint,h=c.params,u=c.prePoint,d=c.box;if(!d||Z(d.x-o,d.y-o,d.width+t,d.height+t,n,r))switch(c.command){case"L":case"Z":if(a=K(u[0],u[1],l[0],l[1],t,n,r))return!0;break;case"Q":if(a=t/2>=$(u[0],u[1],h[1],h[2],h[3],h[4],n,r))return!0;break;case"C":if(a=t/2>=_(u[0],u[1],h[1],h[2],h[3],h[4],h[5],h[6],n,r,i))return!0;break;case"A":c.cubicParams||(c.cubicParams=b(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,v=u,f=0;p.length>f;f+=6){var y=_(v[0],v[1],p[f],p[f+1],p[f+2],p[f+3],p[f+4],p[f+5],n,r,i);if(v=[p[f+4],p[f+5]],a=t/2>=y)return!0}}}return a}(f,h+d,n.x,n.y,M)),T)}function ce(e,n,r){var i=e.parsedStyle,a=i.lineWidth,o=void 0===a?1:a,c=i.increasedLineWidthForHitTesting,l=void 0===c?0:c,h=i.points,u=i.pointerEvents,d=s(t.isFillOrStrokeAffected(void 0===u?"auto":u,i.fill,i.stroke),2),p=d[0],v=!1;return(d[1]||r)&&(v=ee(h.points,o+l,n.x,n.y,!0)),v||!p&&!r||(v=ie(h.points,n.x,n.y)),v}function le(e,n,r){var i=e.parsedStyle,a=i.lineWidth,o=void 0===a?1:a,c=i.increasedLineWidthForHitTesting,l=void 0===c?0:c,h=i.points,u=i.pointerEvents;return!(!s(t.isFillOrStrokeAffected(void 0===u?"auto":u,i.fill,i.stroke),2)[1]&&!r||!o)&&ee(h.points,o+l,n.x,n.y,!1)}function he(e,n,r,i,a){var o=e.parsedStyle,c=o.radius,l=o.lineWidth,h=void 0===l?1:l,d=o.increasedLineWidthForHitTesting,p=void 0===d?0:d,v=o.x,f=void 0===v?0:v,y=o.y,g=void 0===y?0:y,m=o.width,x=o.height,E=o.pointerEvents,b=s(t.isFillOrStrokeAffected(void 0===E?"auto":E,o.fill,o.stroke),2),S=b[0],M=b[1],T=h+p;if(c&&c.some((function(e){return 0!==e}))){var C=!1;return(M||r)&&(C=function(e,t,n,r,i,a,o,c){var l=s(i,4),h=l[0],u=l[1],d=l[2],p=l[3];return K(e+h,t,e+n-u,t,a,o,c)||K(e+n,t+u,e+n,t+r-d,a,o,c)||K(e+n-d,t+r,e+p,t+r,a,o,c)||K(e,t+r-p,e,t+h,a,o,c)||J(e+n-u,t+u,u,0,0,a,o,c)||J(e+n-d,t+r-d,d,0,0,a,o,c)||J(e+p,t+r-p,p,0,0,a,o,c)||J(e+h,t+h,h,0,0,a,o,c)}(f,g,m,x,c.map((function(e){return u(e,0,Math.min(Math.abs(m)/2,Math.abs(x)/2))})),T,n.x,n.y)),C||!S&&!r||(C=i(e,n)),C}var P=T/2;return S&&M||r?Z(f-P,g-P,m+P,x+P,n.x,n.y):S?Z(f,g,m,x,n.x,n.y):!!M&&function(e,t,n,r,i,a,o){var s=i/2;return Z(e-s,t-s,n,i,a,o)||Z(e+n-s,t-s,i,r,a,o)||Z(e+s,t+r-s,n,i,a,o)||Z(e-s,t+s,i,r,a,o)}(f,g,m,x,T,n.x,n.y)}function ue(e,n,r,a,o,s){var c=e.parsedStyle,l=c.pointerEvents,h=c.x,u=void 0===h?0:h,d=c.y,p=void 0===d?0:d,v=c.width,f=c.height;if("non-transparent-pixel"===(void 0===l?"auto":l)){var y=o.config.offscreenCanvas,g=s.offscreenCanvasCreator.getOrCreateCanvas(y),m=s.offscreenCanvasCreator.getOrCreateContext(y,{willReadFrequently:!0});return g.width=v,g.height=f,o.defaultStyleRendererFactory[t.Shape.IMAGE].render(m,i(i({},e.parsedStyle),{x:0,y:0}),e,void 0,void 0,void 0),m.getImageData(n.x-u,n.y-p,1,1).data.every((function(e){return 0!==e}))}return!0}function de(e,t,n,r){var i=e.getGeometryBounds();return!(i.min[0]>t.x||i.min[1]>t.y||t.x>i.max[0]||t.y>i.max[1])}var pe=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]=q,e[t.Shape.ELLIPSE]=V,e[t.Shape.RECT]=he,e[t.Shape.LINE]=oe,e[t.Shape.POLYLINE]=le,e[t.Shape.POLYGON]=ce,e[t.Shape.PATH]=se,e[t.Shape.TEXT]=de,e[t.Shape.GROUP]=null,e[t.Shape.IMAGE]=ue,e[t.Shape.HTML]=null,e[t.Shape.MESH]=null,e);this.context.pointInPathPickerFactory=n,this.addRenderingPlugin(new Q)},n.prototype.destroy=function(){delete this.context.pointInPathPickerFactory,this.removeAllRenderingPlugins()},n}(t.AbstractRendererPlugin),ve=Object.freeze({__proto__:null,Plugin:pe}),fe=function(){function e(e){this.canvasRendererPluginOptions=e,this.removedRBushNodeAABBs=[],this.renderQueue=[],this.restoreStack=[],this.clearFullScreenLastFrame=!1,this.clearFullScreen=!1,this.vpMatrix=v(),this.dprMatrix=v(),this.tmpMat4=v(),this.vec3a=g(),this.vec3b=g(),this.vec3c=g(),this.vec3d=g()}return e.prototype.apply=function(n,r){var i=this;this.context=n;var a=n.config,o=n.camera,l=n.renderingService,h=n.renderingContext,u=n.pathGeneratorFactory;this.rBush=n.rBushRoot,this.pathGeneratorFactory=u;var d=n.contextService,p=h.root.ownerDocument.defaultView,v=function(e){var t=e.target.rBushNode;t.aabb&&i.removedRBushNodeAABBs.push(t.aabb)},f=function(e){var t=e.target.rBushNode;t.aabb&&i.removedRBushNodeAABBs.push(t.aabb)};l.hooks.init.tap(e.tag,(function(){p.addEventListener(t.ElementEvent.UNMOUNTED,v),p.addEventListener(t.ElementEvent.CULLED,f);var e=d.getDPR(),n=a.width,r=a.height,o=d.getContext();i.clearRect(o,0,0,n*e,r*e,a.background)})),l.hooks.destroy.tap(e.tag,(function(){p.removeEventListener(t.ElementEvent.UNMOUNTED,v),p.removeEventListener(t.ElementEvent.CULLED,f),i.renderQueue=[],i.removedRBushNodeAABBs=[],i.restoreStack=[]})),l.hooks.beginFrame.tap(e.tag,(function(){var e,t=d.getContext(),n=d.getDPR(),r=a.width,o=a.height,s=i.canvasRendererPluginOptions,c=s.dirtyObjectNumThreshold,h=s.dirtyObjectRatioThreshold,u=l.getStats(),v=u.rendered,f=v/u.total;i.clearFullScreen=i.clearFullScreenLastFrame||!(null===(e=p.context.renderingPlugins[1])||void 0===e?void 0:e.isFirstTimeRenderingFinished)||l.disableDirtyRectangleRendering()||v>c&&f>h,t&&(t.resetTransform?t.resetTransform():t.setTransform(1,0,0,1,0,0),i.clearFullScreen&&i.clearRect(t,0,0,r*n,o*n,a.background))})),l.hooks.endFrame.tap(e.tag,(function(){if(0!==h.root.childNodes.length){i.clearFullScreenLastFrame=!1;var e,n,l=d.getContext(),u=d.getDPR();if((e=i.dprMatrix)[0]=(n=[u,u,1])[0],e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=n[1],e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=n[2],e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,y(i.vpMatrix,i.dprMatrix,o.getOrthoMatrix()),i.clearFullScreen)i.renderSceneGraph(h.root,l,r);else{var p=i.safeMergeAABB.apply(i,c([i.mergeDirtyAABBs(i.renderQueue)],s(i.removedRBushNodeAABBs.map((function(e){var n=e.minX,r=e.minY,i=e.maxX,a=e.maxY,o=new t.AABB;return o.setMinMax([n,r,0],[i,a,0]),o}))),!1));if(i.removedRBushNodeAABBs=[],t.AABB.isEmpty(p))return void(i.renderQueue.length=0);var v=i.convertAABB2Rect(p),f=v.x,g=v.y,m=v.width,E=v.height,b=x(i.vec3a,[f,g,0],i.vpMatrix),S=x(i.vec3b,[f+m,g,0],i.vpMatrix),M=x(i.vec3c,[f,g+E,0],i.vpMatrix),T=x(i.vec3d,[f+m,g+E,0],i.vpMatrix),C=Math.min(b[0],S[0],T[0],M[0]),P=Math.min(b[1],S[1],T[1],M[1]),A=Math.max(b[0],S[0],T[0],M[0]),w=Math.max(b[1],S[1],T[1],M[1]),O=Math.floor(C),k=Math.floor(P),L=Math.ceil(A-C),R=Math.ceil(w-P);l.save(),i.clearRect(l,O,k,L,R,a.background),l.beginPath(),l.rect(O,k,L,R),l.clip(),l.setTransform(i.vpMatrix[0],i.vpMatrix[1],i.vpMatrix[4],i.vpMatrix[5],i.vpMatrix[12],i.vpMatrix[13]),i.searchDirtyObjects(p).sort((function(e,t){return e.sortable.renderOrder-t.sortable.renderOrder})).forEach((function(e){e&&e.isVisible()&&!e.isCulled()&&i.renderDisplayObject(e,l,i.context,i.restoreStack,r)})),l.restore();for(var N=i.renderQueue.length,B=0;N>B;B++)i.saveDirtyAABB(i.renderQueue[B]);i.renderQueue.length=0}var D=i.restoreStack.length;for(B=0;D>B;B++)l.restore();i.restoreStack.length=0}else i.clearFullScreenLastFrame=!0})),l.hooks.render.tap(e.tag,(function(e){if(!i.clearFullScreen)for(var t=e.length,n=0;t>n;n++)i.renderQueue.push(e[n])}))},e.prototype.clearRect=function(e,t,n,r,i,a){e.clearRect(t,n,r,i),a&&(e.fillStyle=a,e.fillRect(t,n,r,i))},e.prototype.renderSceneGraph=function(e,t,n){e.isVisible()&&!e.isCulled()&&this.renderDisplayObject(e,t,this.context,this.restoreStack,n);for(var r=e.sortable.sorted||e.childNodes,i=r.length,a=0;i>a;a++)this.renderSceneGraph(r[a],t,n)},e.prototype.renderDisplayObject=function(e,n,r,i,a){var o=e.nodeName,s=i[i.length-1];!s||e.compareDocumentPosition(s)&t.Node.DOCUMENT_POSITION_CONTAINS||(n.restore(),i.pop());var c=this.context.styleRendererFactory[o],l=this.pathGeneratorFactory[o],h=e.parsedStyle.clipPath;if(h){this.applyWorldTransform(n,h);var u=this.pathGeneratorFactory[h.nodeName];u&&(n.save(),i.push(e),n.beginPath(),u(n,h.parsedStyle),n.closePath(),n.clip())}c&&(this.applyWorldTransform(n,e),n.save(),this.applyAttributesToContext(n,e)),l&&(n.beginPath(),l(n,e.parsedStyle),e.nodeName!==t.Shape.LINE&&e.nodeName!==t.Shape.PATH&&e.nodeName!==t.Shape.POLYLINE&&n.closePath()),c&&(c.render(n,e.parsedStyle,e,r,this,a),n.restore()),e.renderable.dirty=!1},e.prototype.convertAABB2Rect=function(e){var t=e.getMin(),n=e.getMax(),r=Math.floor(t[0]),i=Math.floor(t[1]);return{x:r,y:i,width:Math.ceil(n[0])-r,height:Math.ceil(n[1])-i}},e.prototype.mergeDirtyAABBs=function(e){var n=new t.AABB;return e.forEach((function(e){var t=e.getRenderBounds();n.add(t);var r=e.renderable.dirtyRenderBounds;r&&n.add(r)})),n},e.prototype.searchDirtyObjects=function(e){var t=s(e.getMin(),2),n=t[0],r=t[1],i=s(e.getMax(),2);return this.rBush.search({minX:n,minY:r,maxX:i[0],maxY:i[1]}).map((function(e){return e.displayObject}))},e.prototype.saveDirtyAABB=function(e){var n=e.renderable;n.dirtyRenderBounds||(n.dirtyRenderBounds=new t.AABB);var r=e.getRenderBounds();r&&n.dirtyRenderBounds.update(r.center,r.halfExtents)},e.prototype.applyAttributesToContext=function(e,t){var n=t.parsedStyle,r=n.stroke,i=n.fill,a=n.opacity,o=n.lineDash,s=n.lineDashOffset;o&&e.setLineDash(o),d(s)&&(e.lineDashOffset=s),d(a)&&(e.globalAlpha*=a),l(r)||Array.isArray(r)||r.isNone||(e.strokeStyle=t.attributes.stroke),l(i)||Array.isArray(i)||i.isNone||(e.fillStyle=t.attributes.fill)},e.prototype.applyWorldTransform=function(e,t,n){n?(f(this.tmpMat4,t.getLocalTransform()),y(this.tmpMat4,n,this.tmpMat4),y(this.tmpMat4,this.vpMatrix,this.tmpMat4)):(f(this.tmpMat4,t.getWorldTransform()),y(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}(),ye=function(){function e(e){this.imagePool=e}return e.prototype.render=function(e,n,r,i,a,o){var s=n.fill,c=n.fillRule,u=n.opacity,p=void 0===u?1:u,v=n.fillOpacity,f=void 0===v?1:v,y=n.stroke,g=n.strokeOpacity,m=void 0===g?1:g,x=n.lineWidth,E=void 0===x?1:x,b=n.lineCap,S=n.lineJoin,M=n.shadowType,T=n.shadowBlur,C=n.filter,P=n.miterLimit,A=s&&!s.isNone,w=y&&!y.isNone&&E>0,O=0===(null==s?void 0:s.alpha),k=!(!C||!C.length),L=!l(n.shadowColor)&&T>0,R=r.nodeName,N="inner"===M,B=w&&L&&(R===t.Shape.PATH||R===t.Shape.LINE||R===t.Shape.POLYLINE||O||N);A&&(e.globalAlpha=p*f,B||ge(r,e,L),Ee(e,r,s,c,i,a,o,this.imagePool),B||this.clearShadowAndFilter(e,k,L)),w&&(e.globalAlpha=p*m,e.lineWidth=E,d(P)&&(e.miterLimit=P),h(b)&&(e.lineCap=b),h(S)&&(e.lineJoin=S),B&&(N&&(e.globalCompositeOperation="source-atop"),ge(r,e,!0),N&&(be(e,r,y,i,a,o,this.imagePool),e.globalCompositeOperation="source-over",this.clearShadowAndFilter(e,k,!0))),be(e,r,y,i,a,o,this.imagePool))},e.prototype.clearShadowAndFilter=function(e,t,n){if(n&&(e.shadowColor="transparent",e.shadowBlur=0),t){var r=e.filter;!l(r)&&r.indexOf("drop-shadow")>-1&&(e.filter=r.replace(/drop-shadow\([^)]*\)/,"").trim()||"none")}},e}();function ge(e,t,n){var r=e.parsedStyle,i=r.filter,a=r.shadowColor,o=r.shadowBlur,s=r.shadowOffsetX,c=r.shadowOffsetY;i&&i.length&&(t.filter=e.style.filter),n&&(t.shadowColor=""+a,t.shadowBlur=o||0,t.shadowOffsetX=s||0,t.shadowOffsetY=c||0)}function me(e,t,n,r,i,a,o){var s,c;if("rect"===e.image.nodeName){var l=e.image.parsedStyle,h=l.width,u=l.height;c=r.contextService.getDPR();var d=r.config.offscreenCanvas;(s=a.offscreenCanvasCreator.getOrCreateCanvas(d)).width=h*c,s.height=u*c;var p=a.offscreenCanvasCreator.getOrCreateContext(d),v=[];e.image.forEach((function(e){i.renderDisplayObject(e,p,r,v,a)})),v.forEach((function(){p.restore()}))}return o.getOrCreatePatternSync(e,n,s,c,t.getGeometryBounds().min,(function(){t.renderable.dirty=!0,r.renderingService.dirtify()}))}function xe(e,n,r,a){var o;if(e.type===t.GradientType.LinearGradient||e.type===t.GradientType.RadialGradient){var s=n.getGeometryBounds(),c=s&&2*s.halfExtents[0]||1,l=s&&2*s.halfExtents[1]||1,h=s&&s.min||[0,0];o=a.getOrCreateGradient(i(i({type:e.type},e.value),{min:h,width:c,height:l}),r)}return o}function Ee(e,n,r,i,a,o,s,c,l){void 0===l&&(l=!1),Array.isArray(r)?r.forEach((function(t){e.fillStyle=xe(t,n,e,c),l||(i?e.fill(i):e.fill())})):(t.isPattern(r)&&(e.fillStyle=me(r,n,e,a,o,s,c)),l||(i?e.fill(i):e.fill()))}function be(e,n,r,i,a,o,s,c){void 0===c&&(c=!1),Array.isArray(r)?r.forEach((function(t){e.strokeStyle=xe(t,n,e,s),c||e.stroke()})):(t.isPattern(r)&&(e.strokeStyle=me(r,n,e,i,a,o,s)),c||e.stroke())}var Se=function(){function e(e){this.imagePool=e}return e.prototype.render=function(e,t,n){var r,i=t.x,a=void 0===i?0:i,o=t.y,s=void 0===o?0:o,c=t.src,u=t.shadowColor,d=t.shadowBlur,p=t.width,v=t.height;if(h(c)?r=this.imagePool.getImageSync(c):(p||(p=c.width),v||(v=c.height),r=c),r){ge(n,e,!l(u)&&d>0);try{e.drawImage(r,a,s,p,v)}catch(e){}}},e}(),Me=function(){function e(e){this.imagePool=e}return e.prototype.render=function(e,t,n,r,i,a){n.getBounds();var o=t.lineWidth,s=void 0===o?1:o,c=t.textAlign,h=void 0===c?"start":c,u=t.textBaseline,d=void 0===u?"alphabetic":u,p=t.lineJoin,v=void 0===p?"miter":p,f=t.miterLimit,y=void 0===f?10:f,g=t.letterSpacing,m=void 0===g?0:g,x=t.stroke,E=t.fill,b=t.fillRule,S=t.fillOpacity,M=void 0===S?1:S,T=t.strokeOpacity,C=void 0===T?1:T,P=t.opacity,A=void 0===P?1:P,w=t.metrics,O=t.x,k=void 0===O?0:O,L=t.y,R=void 0===L?0:L,N=t.dx,B=t.dy,D=t.shadowColor,I=t.shadowBlur,F=w.lines,G=w.height,j=w.lineHeight,_=w.lineMetrics;e.font=w.font,e.lineWidth=s,e.textAlign="middle"===h?"center":h;var H=d;a.enableCSSParsing||"alphabetic"!==H||(H="bottom"),e.lineJoin=v,l(y)||(e.miterLimit=y);var $=R;"middle"===d?$+=-G/2-j/2:"bottom"===d||"alphabetic"===d||"ideographic"===d?$+=-G:"top"!==d&&"hanging"!==d||($+=-j);var W=k+(N||0);$+=B||0,1===F.length&&("bottom"===H?(H="middle",$-=.5*G):"top"===H&&(H="middle",$+=.5*G)),e.textBaseline=H,ge(n,e,!l(D)&&I>0);for(var U=0;F.length>U;U++){var z=s/2+W;$+=j,l(x)||x.isNone||!s||this.drawLetterSpacing(e,n,F[U],_[U],h,z,$,m,E,b,M,x,C,A,!0,r,i,a),l(E)||this.drawLetterSpacing(e,n,F[U],_[U],h,z,$,m,E,b,M,x,C,A,!1,r,i,a)}},e.prototype.drawLetterSpacing=function(e,t,n,r,i,a,o,s,c,l,h,u,d,p,v,f,y,g){if(0!==s){var m=e.textAlign;e.textAlign="left";var x=a;"center"===i||"middle"===i?x=a-r.width/2:"right"!==i&&"end"!==i||(x=a-r.width);for(var E=Array.from(n),b=e.measureText(n).width,S=0,M=0;E.length>M;++M){var T=E[M];v?this.strokeText(e,t,T,x,o,u,d,f,y,g):this.fillText(e,t,T,x,o,c,l,h,p,f,y,g),x+=b-(S=e.measureText(n.substring(M+1)).width)+s,b=S}e.textAlign=m}else v?this.strokeText(e,t,n,a,o,u,d,f,y,g):this.fillText(e,t,n,a,o,c,l,h,p,f,y,g)},e.prototype.fillText=function(e,t,n,r,i,a,o,s,c,h,u,d){var p;Ee(e,t,a,o,h,u,d,this.imagePool,!0);var v=!l(s)&&1!==s;v&&(p=e.globalAlpha,e.globalAlpha=s*c),e.fillText(n,r,i),v&&(e.globalAlpha=p)},e.prototype.strokeText=function(e,t,n,r,i,a,o,s,c,h){var u;be(e,t,a,s,c,h,this.imagePool,!0);var d=!l(o)&&1!==o;d&&(u=e.globalAlpha,e.globalAlpha=o),e.strokeText(n,r,i),d&&(e.globalAlpha=u)},e}(),Te=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return r(t,e),t}(ye),Ce=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return r(t,e),t}(ye),Pe=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return r(t,e),t}(ye),Ae=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return r(t,e),t}(ye),we=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return r(t,e),t}(ye),Oe=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return r(t,e),t}(ye),ke=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return r(t,e),t}(ye),Le=function(e){function n(t){void 0===t&&(t={});var n=e.call(this)||this;return n.options=t,n.name="canvas-renderer",n}return r(n,e),n.prototype.init=function(){var e,n=i({dirtyObjectNumThreshold:500,dirtyObjectRatioThreshold:.8,imageSmoothingEnabled:!0,imageSmoothingQuality:"high"},this.options),r=this.context.imagePool,a=new ye(r),o=((e={})[t.Shape.CIRCLE]=a,e[t.Shape.ELLIPSE]=a,e[t.Shape.RECT]=a,e[t.Shape.IMAGE]=new Se(r),e[t.Shape.TEXT]=new Me(r),e[t.Shape.LINE]=a,e[t.Shape.POLYLINE]=a,e[t.Shape.POLYGON]=a,e[t.Shape.PATH]=a,e[t.Shape.GROUP]=void 0,e[t.Shape.HTML]=void 0,e[t.Shape.MESH]=void 0,e);this.context.defaultStyleRendererFactory=o,this.context.styleRendererFactory=o,this.addRenderingPlugin(new fe(n))},n.prototype.destroy=function(){this.removeAllRenderingPlugins(),delete this.context.defaultStyleRendererFactory,delete this.context.styleRendererFactory},n}(t.AbstractRendererPlugin),Re=Object.freeze({__proto__:null,CircleRenderer:Ce,EllipseRenderer:Pe,ImageRenderer:Se,LineRenderer:Ae,PathRenderer:ke,Plugin:Le,PolygonRenderer:Oe,PolylineRenderer:we,RectRenderer:Te,TextRenderer:Me}),Ne=function(){function e(){}return e.prototype.apply=function(t,n){var r=this,i=t.renderingService,a=t.renderingContext,o=t.config;this.context=t;var s=a.root.ownerDocument.defaultView,c=function(e){i.hooks.pointerMove.call(e)},l=function(e){i.hooks.pointerUp.call(e)},h=function(e){i.hooks.pointerDown.call(e)},u=function(e){i.hooks.pointerOver.call(e)},d=function(e){i.hooks.pointerOut.call(e)},p=function(e){i.hooks.pointerCancel.call(e)},v=function(e){i.hooks.pointerWheel.call(e)},f=function(e){i.hooks.click.call(e)};i.hooks.init.tap(e.tag,(function(){var e=r.context.contextService.getDomElement();n.globalThis.navigator.msPointerEnabled?(e.style.msContentZooming="none",e.style.msTouchAction="none"):s.supportsPointerEvents&&(e.style.touchAction="none"),s.supportsPointerEvents?function(e){n.globalThis.document.addEventListener("pointermove",c,!0),e.addEventListener("pointerdown",h,!0),e.addEventListener("pointerleave",d,!0),e.addEventListener("pointerover",u,!0),n.globalThis.addEventListener("pointerup",l,!0),n.globalThis.addEventListener("pointercancel",p,!0)}(e):function(e){n.globalThis.document.addEventListener("mousemove",c,!0),e.addEventListener("mousedown",h,!0),e.addEventListener("mouseout",d,!0),e.addEventListener("mouseover",u,!0),n.globalThis.addEventListener("mouseup",l,!0)}(e),s.supportsTouchEvents&&function(e){e.addEventListener("touchstart",h,!0),e.addEventListener("touchend",l,!0),e.addEventListener("touchmove",c,!0),e.addEventListener("touchcancel",p,!0)}(e),o.useNativeClickEvent&&e.addEventListener("click",f,!0),e.addEventListener("wheel",v,{passive:!0,capture:!0})})),i.hooks.destroy.tap(e.tag,(function(){var e=r.context.contextService.getDomElement();n.globalThis.navigator.msPointerEnabled?(e.style.msContentZooming="",e.style.msTouchAction=""):s.supportsPointerEvents&&(e.style.touchAction=""),s.supportsPointerEvents?function(e){n.globalThis.document.removeEventListener("pointermove",c,!0),e.removeEventListener("pointerdown",h,!0),e.removeEventListener("pointerleave",d,!0),e.removeEventListener("pointerover",u,!0),n.globalThis.removeEventListener("pointerup",l,!0),n.globalThis.removeEventListener("pointercancel",p,!0)}(e):function(e){n.globalThis.document.removeEventListener("mousemove",c,!0),e.removeEventListener("mousedown",h,!0),e.removeEventListener("mouseout",d,!0),e.removeEventListener("mouseover",u,!0),n.globalThis.removeEventListener("mouseup",l,!0)}(e),s.supportsTouchEvents&&function(e){e.removeEventListener("touchstart",h,!0),e.removeEventListener("touchend",l,!0),e.removeEventListener("touchmove",c,!0),e.removeEventListener("touchcancel",p,!0)}(e),o.useNativeClickEvent&&e.removeEventListener("click",f,!0),e.removeEventListener("wheel",v,!0)}))},e.tag="DOMInteraction",e}(),Be=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 Ne)},t.prototype.destroy=function(){this.removeAllRenderingPlugins()},t}(t.AbstractRendererPlugin),De=Object.freeze({__proto__:null,Plugin:Be}),Ie=function(){function e(){this.displayObjectHTMLElementMap=new WeakMap}return e.prototype.joinTransformMatrix=function(e,t){return void 0===t&&(t=[0,0,0]),"matrix(".concat([e[0],e[1],e[4],e[5],e[12]+t[0],e[13]+t[1]].join(","),")")},e.prototype.apply=function(n,r){var i=this,a=n.camera,o=n.renderingContext,s=n.renderingService;this.context=n;var c=o.root.ownerDocument.defaultView,l=c.context.eventService.nativeHTMLMap,h=function(e,t){t.style.transform=i.joinTransformMatrix(e.getWorldTransform(),e.getOrigin())},u=function(e){var n=e.target;if(n.nodeName===t.Shape.HTML){i.$camera||(i.$camera=i.createCamera(a));var o=i.getOrCreateEl(n);if(i.$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){i.updateAttribute(e,n)})),h(n,o),l.set(o,n)}},d=function(e){var n=e.target;if(n.nodeName===t.Shape.HTML&&i.$camera){var r=i.getOrCreateEl(n);r&&(r.remove(),l.delete(r))}},p=function(e){var n=e.target;n.nodeName===t.Shape.HTML&&i.updateAttribute(e.attrName,n)},v=function(e){var n=e.target;if(n.nodeName===t.Shape.HTML){var r=i.getOrCreateEl(n);h(n,r)}},f=function(){if(i.$camera){var e=i.context.config,t=e.height;i.$camera.parentElement.style.width="".concat(e.width||0,"px"),i.$camera.parentElement.style.height="".concat(t||0,"px")}};s.hooks.init.tap(e.tag,(function(){c.addEventListener(t.CanvasEvent.RESIZE,f),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,v)})),s.hooks.endFrame.tap(e.tag,(function(){i.$camera&&o.renderReasons.has(t.RenderReason.CAMERA_CHANGED)&&(i.$camera.style.transform=i.joinTransformMatrix(a.getOrthoMatrix()))})),s.hooks.destroy.tap(e.tag,(function(){i.$camera&&i.$camera.remove(),c.removeEventListener(t.CanvasEvent.RESIZE,f),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,v)}))},e.prototype.createCamera=function(e){var t=this.context.config,n=t.document,r=t.width,i=t.height,a=this.context.contextService.getDomElement(),o=a.parentNode;if(o){var s="g-canvas-camera",c=o.querySelector("#"+s);if(!c){var l=(n||document).createElement("div");l.style.overflow="hidden",l.style.pointerEvents="none",l.style.position="absolute",l.style.left="0px",l.style.top="0px",l.style.width="".concat(r||0,"px"),l.style.height="".concat(i||0,"px");var h=(n||document).createElement("div");c=h,h.id=s,h.style.position="absolute",h.style.left="".concat(a.offsetLeft||0,"px"),h.style.top="".concat(a.offsetTop||0,"px"),h.style.transformOrigin="left top",h.style.transform=this.joinTransformMatrix(e.getOrthoMatrix()),h.style.pointerEvents="none",h.style.width="100%",h.style.height="100%",l.appendChild(h),o.appendChild(l)}return c}return null},e.prototype.getOrCreateEl=function(e){var t=this.context.config.document,n=this.displayObjectHTMLElementMap.get(e);return n||(n=(t||document).createElement("div"),e.parsedStyle.$el=n,this.displayObjectHTMLElementMap.set(e,n),e.id&&(n.id=e.id),e.name&&n.setAttribute("name",e.name),e.className&&(n.className=e.className),n.style.position="absolute",n.style["will-change"]="transform",n.style.transform=this.joinTransformMatrix(e.getWorldTransform(),e.getOrigin())),n},e.prototype.updateAttribute=function(e,n){var r=this.getOrCreateEl(n);switch(e){case"innerHTML":var i=n.parsedStyle.innerHTML;h(i)?r.innerHTML=i:(r.innerHTML="",r.appendChild(i));break;case"x":r.style.left="".concat(n.parsedStyle.x,"px");break;case"y":r.style.top="".concat(n.parsedStyle.y,"px");break;case"transformOrigin":var a=n.parsedStyle.transformOrigin;r.style["transform-origin"]="".concat(a[0].buildCSSText(null,null,"")," ").concat(a[1].buildCSSText(null,null,""));break;case"width":if(this.context.enableCSSParsing){var o=n.computedStyleMap().get("width");r.style.width=""+o}else{r.style.width=d(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=d(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":var c=n.parsedStyle.pointerEvents;r.style.pointerEvents=void 0===c?"auto":c;break;case"opacity":r.style.opacity="".concat(n.parsedStyle.opacity);break;case"fill":var u=n.parsedStyle.fill,p="";t.isCSSRGB(u)?p=u.isNone?"transparent":n.getAttribute("fill"):Array.isArray(u)?p=n.getAttribute("fill"):t.isPattern(u),r.style.background=p;break;case"stroke":var v=n.parsedStyle.stroke,f="";t.isCSSRGB(v)?f=v.isNone?"transparent":n.getAttribute("stroke"):Array.isArray(v)?f=n.getAttribute("stroke"):t.isPattern(v),r.style["border-color"]=f,r.style["border-style"]="solid";break;case"lineWidth":r.style["border-width"]="".concat(n.parsedStyle.lineWidth||0,"px");break;case"lineDash":r.style["border-style"]="dashed";break;case"filter":r.style.filter=n.style.filter;break;default:l(n.style[e])||""===n.style[e]||(r.style[e]=n.style[e])}},e.tag="HTMLRendering",e}(),Fe=function(e){function t(){var t=e.apply(this,c([],s(arguments),!1))||this;return t.name="html-renderer",t}return r(t,e),t.prototype.init=function(){this.addRenderingPlugin(new Ie)},t.prototype.destroy=function(){this.removeAllRenderingPlugins()},t}(t.AbstractRendererPlugin),Ge=Object.freeze({__proto__:null,Plugin:Fe}),je=function(){function e(e){this.canvasConfig=e,this.imageCache={},this.gradientCache={},this.patternCache={}}return e.prototype.getImageSync=function(e,t){return this.imageCache[e]?t&&t(this.imageCache[e]):this.getOrCreateImage(e).then((function(e){t&&t(e)})),this.imageCache[e]},e.prototype.getOrCreateImage=function(e){var n=this;if(this.imageCache[e])return Promise.resolve(this.imageCache[e]);var r=this.canvasConfig.createImage;return new Promise((function(i,a){var o;r?o=r(e):t.isBrowser&&(o=new window.Image),o&&(o.onload=function(){n.imageCache[e]=o,i(o)},o.onerror=function(e){a(e)},o.crossOrigin="Anonymous",o.src=e)}))},e.prototype.getOrCreatePatternSync=function(e,n,r,i,a,o){var s=this.generatePatternKey(e);if(s&&this.patternCache[s])return this.patternCache[s];var c,l=e.image,u=e.repetition,d=e.transform,p=!1;h(l)?c=this.getImageSync(l,o):r?(c=r,p=!0):c=l;var f,y=c&&n.createPattern(c,u);if(y){var g=void 0;d?g=t.parsedTransformToMat4(t.parseTransform(d),new t.DisplayObject({})):((f=v())[0]=1,f[1]=0,f[2]=0,f[3]=0,f[4]=0,f[5]=1,f[6]=0,f[7]=0,f[8]=0,f[9]=0,f[10]=1,f[11]=0,f[12]=0,f[13]=0,f[14]=0,f[15]=1,g=f),p&&function(e,t,n){var r=n[0],i=n[1],a=n[2];e[0]=t[0]*r,e[1]=t[1]*r,e[2]=t[2]*r,e[3]=t[3]*r,e[4]=t[4]*i,e[5]=t[5]*i,e[6]=t[6]*i,e[7]=t[7]*i,e[8]=t[8]*a,e[9]=t[9]*a,e[10]=t[10]*a,e[11]=t[11]*a,e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15]}(g,g,[1/i,1/i,1]),y.setTransform({a:g[0],b:g[1],c:g[4],d:g[5],e:g[12]+a[0],f:g[13]+a[1]})}return s&&y&&(this.patternCache[s]=y),y},e.prototype.getOrCreateGradient=function(e,n){var r=this.generateGradientKey(e),i=e.type,a=e.steps,o=e.min,s=e.width,c=e.height,l=e.cx,h=e.cy,u=e.size;if(this.gradientCache[r])return this.gradientCache[r];var d=null;if(i===t.GradientType.LinearGradient){var p=t.computeLinearGradient(o,s,c,e.angle);d=n.createLinearGradient(p.x1,p.y1,p.x2,p.y2)}else if(i===t.GradientType.RadialGradient){var v=t.computeRadialGradient(o,s,c,l,h,u),f=v.x,y=v.y;d=n.createRadialGradient(f,y,0,f,y,v.r)}return d&&(a.forEach((function(e){var n=e.offset;n.unit===t.UnitType.kPercentage&&(null==d||d.addColorStop(n.value/100,""+e.color))})),this.gradientCache[r]=d),this.gradientCache[r]},e.prototype.generateGradientKey=function(e){var t=e.min,n=e.width,r=e.height,i=e.steps,a=e.angle,o=e.cx,s=e.cy,c=e.size;return"gradient-".concat(e.type,"-").concat((null==a?void 0:""+a)||0,"-").concat((null==o?void 0:""+o)||0,"-").concat((null==s?void 0:""+s)||0,"-").concat((null==c?void 0:""+c)||0,"-").concat(t[0],"-").concat(t[1],"-").concat(n,"-").concat(r,"-").concat(i.map((function(e){var t=e.color;return"".concat(e.offset).concat(t)})).join("-"))},e.prototype.generatePatternKey=function(e){var t=e.image,n=e.repetition;return h(t)?"pattern-".concat(t,"-").concat(n):"rect"===t.nodeName?"pattern-".concat(t.entity,"-").concat(n):void 0},e}(),_e=function(){function e(){}return e.prototype.apply=function(n){var r=n.renderingService,i=n.imagePool,a=n.renderingContext.root.ownerDocument.defaultView,o=function(e,t,n){var r=e.parsedStyle,i=r.width,a=r.height;i&&!a?e.setAttribute("height",n/t*i):!i&&a&&e.setAttribute("width",t/n*a)},s=function(e){var n=e.target,a=n.attributes;if(n.nodeName===t.Shape.IMAGE){var s=a.src,c=a.keepAspectRatio;h(s)&&i.getImageSync(s,(function(e){c&&o(n,e.width,e.height),n.renderable.dirty=!0,r.dirtify()}))}},c=function(e){var n=e.target,a=e.newValue;n.nodeName===t.Shape.IMAGE&&"src"===e.attrName&&h(a)&&i.getOrCreateImage(a).then((function(e){n.attributes.keepAspectRatio&&o(n,e.width,e.height),n.renderable.dirty=!0,r.dirtify()}))};r.hooks.init.tap(e.tag,(function(){a.addEventListener(t.ElementEvent.MOUNTED,s),a.addEventListener(t.ElementEvent.ATTR_MODIFIED,c)})),r.hooks.destroy.tap(e.tag,(function(){a.removeEventListener(t.ElementEvent.MOUNTED,s),a.removeEventListener(t.ElementEvent.ATTR_MODIFIED,c)}))},e.tag="LoadImage",e}(),He=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 je(this.context.config),this.addRenderingPlugin(new _e)},t.prototype.destroy=function(){this.removeAllRenderingPlugins()},t}(t.AbstractRendererPlugin),$e=Object.freeze({__proto__:null,ImagePool:je,Plugin:He}),We=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=h(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),function(e,t){var n=t.imageSmoothingEnabled,r=t.imageSmoothingQuality;void 0!==n&&(e.imageSmoothingEnabled=n);void 0!==r&&(e.imageSmoothingQuality=r)}(this.context,this.canvasConfig.renderer.getConfig())},e.prototype.getContext=function(){return this.context},e.prototype.getDomElement=function(){return this.$canvas},e.prototype.getDPR=function(){return this.dpr},e.prototype.getBoundingClientRect=function(){if(this.$canvas.getBoundingClientRect)return this.$canvas.getBoundingClientRect()},e.prototype.destroy=function(){this.$container&&this.$canvas&&this.$canvas.parentNode&&this.$container.removeChild(this.$canvas)},e.prototype.resize=function(e,n){var r=this.canvasConfig.devicePixelRatio||t.isBrowser&&window.devicePixelRatio||1;this.dpr=r=1>r?1:Math.ceil(r),this.$canvas&&(this.$canvas.width=this.dpr*e,this.$canvas.height=this.dpr*n,t.setDOMSize(this.$canvas,e,n)),this.renderingContext.renderReasons.add(t.RenderReason.CAMERA_CHANGED)},e.prototype.applyCursorStyle=function(e){this.$container&&this.$container.style&&(this.$container.style.cursor=e)},e.prototype.toDataURL=function(){return a(this,arguments,void 0,(function(e){return void 0===e&&(e={}),o(this,(function(t){return[2,this.context.canvas.toDataURL(e.type,e.encoderOptions)]}))}))},e}();var Ue=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=We},t.prototype.destroy=function(){delete this.context.ContextService},t}(t.AbstractRendererPlugin),ze=function(e){function t(t){var n=e.call(this,t)||this;return n.registerPlugin(new Ue),n.registerPlugin(new He),n.registerPlugin(new N),n.registerPlugin(new Le),n.registerPlugin(new Be),n.registerPlugin(new pe),n.registerPlugin(new Fe),n}return r(t,e),t}(t.AbstractRenderer);e.CanvasPathGenerator=B,e.CanvasPicker=ve,e.CanvasRenderer=Re,e.DomInteraction=De,e.HTMLRenderer=Ge,e.ImageLoader=$e,e.Renderer=ze}));
|
|
1
|
+
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@antv/g-lite")):"function"==typeof define&&define.amd?define(["exports","@antv/g-lite"],t):t(((e="undefined"!=typeof globalThis?globalThis:e||self).G=e.G||{},e.G.Canvas2D={}),e.window.G)}(this,(function(e,t){"use strict";var n=function(e,t){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},n(e,t)};function r(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+t+" is not a constructor or null");function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}var i=function(){return i=Object.assign||function(e){for(var t,n=1,r=arguments.length;r>n;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},i.apply(this,arguments)};function a(e,t,n,r){return new(n||(n=Promise))((function(i,a){function o(e){try{c(r.next(e))}catch(e){a(e)}}function s(e){try{c(r.throw(e))}catch(e){a(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(o,s)}c((r=r.apply(e,t||[])).next())}))}function o(e,t){var n,r,i,a,o={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return a={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function s(s){return function(c){return function(s){if(n)throw new TypeError("Generator is already executing.");for(;a&&(a=0,s[0]&&(o=0)),o;)try{if(n=1,r&&(i=2&s[0]?r.return:s[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,s[1])).done)return i;switch(r=0,i&&(s=[2&s[0],i.value]),s[0]){case 0:case 1:i=s;break;case 4:return o.label++,{value:s[1],done:!1};case 5:o.label++,r=s[1],s=[0];continue;case 7:s=o.ops.pop(),o.trys.pop();continue;default:if(!(i=o.trys,(i=i.length>0&&i[i.length-1])||6!==s[0]&&2!==s[0])){o=0;continue}if(3===s[0]&&(!i||s[1]>i[0]&&i[3]>s[1])){o.label=s[1];break}if(6===s[0]&&i[1]>o.label){o.label=i[1],i=s;break}if(i&&i[2]>o.label){o.label=i[2],o.ops.push(s);break}i[2]&&o.ops.pop(),o.trys.pop();continue}s=t.call(e,o)}catch(e){s=[6,e],r=0}finally{n=i=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,c])}}}function s(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,i,a=n.call(e),o=[];try{for(;(void 0===t||t-- >0)&&!(r=a.next()).done;)o.push(r.value)}catch(e){i={error:e}}finally{try{r&&!r.done&&(n=a.return)&&n.call(a)}finally{if(i)throw i.error}}return o}function c(e,t,n){if(n||2===arguments.length)for(var r,i=0,a=t.length;a>i;i++)!r&&i in t||(r||(r=Array.prototype.slice.call(t,0,i)),r[i]=t[i]);return e.concat(r||Array.prototype.slice.call(t))}function l(e){return null==e}function h(e){return"string"==typeof e}"function"==typeof SuppressedError&&SuppressedError;var u=function(e,t,n){return t>e?t:e>n?n:e};function d(e){return"number"==typeof e}var p="undefined"!=typeof Float32Array?Float32Array:Array;function f(){var e=new p(16);return p!=Float32Array&&(e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[11]=0,e[12]=0,e[13]=0,e[14]=0),e[0]=1,e[5]=1,e[10]=1,e[15]=1,e}function v(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[8]=t[8],e[9]=t[9],e[10]=t[10],e[11]=t[11],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15],e}function y(e,t,n){var r=t[0],i=t[1],a=t[2],o=t[3],s=t[4],c=t[5],l=t[6],h=t[7],u=t[8],d=t[9],p=t[10],f=t[11],v=t[12],y=t[13],g=t[14],m=t[15],E=n[0],x=n[1],M=n[2],b=n[3];return e[0]=E*r+x*s+M*u+b*v,e[1]=E*i+x*c+M*d+b*y,e[2]=E*a+x*l+M*p+b*g,e[3]=E*o+x*h+M*f+b*m,e[4]=(E=n[4])*r+(x=n[5])*s+(M=n[6])*u+(b=n[7])*v,e[5]=E*i+x*c+M*d+b*y,e[6]=E*a+x*l+M*p+b*g,e[7]=E*o+x*h+M*f+b*m,e[8]=(E=n[8])*r+(x=n[9])*s+(M=n[10])*u+(b=n[11])*v,e[9]=E*i+x*c+M*d+b*y,e[10]=E*a+x*l+M*p+b*g,e[11]=E*o+x*h+M*f+b*m,e[12]=(E=n[12])*r+(x=n[13])*s+(M=n[14])*u+(b=n[15])*v,e[13]=E*i+x*c+M*d+b*y,e[14]=E*a+x*l+M*p+b*g,e[15]=E*o+x*h+M*f+b*m,e}function g(){var e=new p(3);return p!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0),e}function m(e,t,n,r){return e[0]=t,e[1]=n,e[2]=r,e}function E(e,t,n){var r=t[0],i=t[1],a=t[2],o=n[3]*r+n[7]*i+n[11]*a+n[15];return e[0]=(n[0]*r+n[4]*i+n[8]*a+n[12])/(o=o||1),e[1]=(n[1]*r+n[5]*i+n[9]*a+n[13])/o,e[2]=(n[2]*r+n[6]*i+n[10]*a+n[14])/o,e}function x(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,i,a,o,s,c,l){var h,u,d,p,f,v=e,y=t,g=n,m=r,E=s,b=c,S=120*Math.PI/180,P=Math.PI/180*(+i||0),T=[];if(l)u=l[0],d=l[1],p=l[2],f=l[3];else{y=(h=x(v,y,-P)).y;var C=((v=h.x)-(E=(h=x(E,b,-P)).x))/2,A=(y-(b=h.y))/2,w=C*C/(g*g)+A*A/(m*m);w>1&&(g*=w=Math.sqrt(w),m*=w);var O=g*g,L=m*m,k=(a===o?-1:1)*Math.sqrt(Math.abs((O*L-O*A*A-L*C*C)/(O*A*A+L*C*C)));p=k*g*A/m+(v+E)/2,u=Math.asin(((y-(f=k*-m*C/g+(y+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>E?Math.PI-d:d)&&(d=2*Math.PI+d),o&&u>d&&(u-=2*Math.PI),!o&&d>u&&(d-=2*Math.PI)}var R=d-u;if(Math.abs(R)>S){var I=d,N=E,B=b;T=M(E=p+g*Math.cos(d=u+S*(o&&d>u?1:-1)),b=f+m*Math.sin(d),g,m,i,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*g*_,$=4/3*m*_,W=[v,y],U=[v+H*F,y-$*D],z=[E+H*j,b-$*G],Y=[E,b];if(U[0]=2*W[0]-U[0],U[1]=2*W[1]-U[1],l)return U.concat(z,Y,T);for(var q=[],Q=0,X=(T=U.concat(z,Y,T)).length;X>Q;Q+=1)q[Q]=Q%2?x(T[Q-1],T[Q],P).y:x(T[Q],T[Q+1],P).x;return q}function b(e,t){var n=t.cx,r=t.cy;e.arc(void 0===n?0:n,void 0===r?0:r,t.r,0,2*Math.PI,!1)}function S(e,t){var n=t.cx,r=void 0===n?0:n,i=t.cy,a=void 0===i?0:i,o=t.rx,s=t.ry;if(e.ellipse)e.ellipse(r,a,o,s,0,0,2*Math.PI,!1);else{var c=o>s?o:s,l=o>s?1:o/s,h=o>s?s/o:1;e.save(),e.scale(l,h),e.arc(r,a,c,0,2*Math.PI)}}function P(e,n){var r=n.x1,i=n.y1,a=n.x2,o=n.y2,s=n.markerStart,c=n.markerEnd,l=n.markerStartOffset,h=n.markerEndOffset,u=0,d=0,p=0,f=0,v=0;s&&t.isDisplayObject(s)&&l&&(u=Math.cos(v=Math.atan2(o-i,a-r))*(l||0),d=Math.sin(v)*(l||0)),c&&t.isDisplayObject(c)&&h&&(p=Math.cos(v=Math.atan2(i-o,r-a))*(h||0),f=Math.sin(v)*(h||0)),e.moveTo(r+u,i+d),e.lineTo(a+p,o+f)}function T(e,n){var r=n.markerStart,i=n.markerEnd,a=n.markerStartOffset,o=n.markerEndOffset,c=n.d,l=c.absolutePath,h=c.segments,u=0,d=0,p=0,f=0,v=0;if(r&&t.isDisplayObject(r)&&a){var y=s(r.parentNode.getStartTangent(),2);u=Math.cos(v=Math.atan2((g=y[0])[1]-(m=y[1])[1],g[0]-m[0]))*(a||0),d=Math.sin(v)*(a||0)}if(i&&t.isDisplayObject(i)&&o){var g,m,E=s(i.parentNode.getEndTangent(),2);p=Math.cos(v=Math.atan2((g=E[0])[1]-(m=E[1])[1],g[0]-m[0]))*(o||0),f=Math.sin(v)*(o||0)}for(var x=0;l.length>x;x++){var M=l[x],b=l[x+1],S=0===x&&(0!==u||0!==d),P=(x===l.length-1||b&&("M"===b[0]||"Z"===b[0]))&&0!==p&&0!==f;switch(M[0]){case"M":S?e.moveTo(M[1]+u,M[2]+d):e.moveTo(M[1],M[2]);break;case"L":P?e.lineTo(M[1]+p,M[2]+f):e.lineTo(M[1],M[2]);break;case"Q":e.quadraticCurveTo(M[1],M[2],M[3],M[4]),P&&e.lineTo(M[3]+p,M[4]+f);break;case"C":e.bezierCurveTo(M[1],M[2],M[3],M[4],M[5],M[6]),P&&e.lineTo(M[5]+p,M[6]+f);break;case"A":var T=h[x].arcParams,C=T.cx,A=T.cy,w=T.rx,O=T.ry,L=T.startAngle,k=T.endAngle,R=T.xRotation,I=T.sweepFlag;if(e.ellipse)e.ellipse(C,A,w,O,R,L,k,!!(1-I));else{var N=w>O?w:O,B=w>O?1:w/O,D=w>O?O/w:1;e.translate(C,A),e.rotate(R),e.scale(B,D),e.arc(0,0,N,L,k,!!(1-I)),e.scale(1/B,1/D),e.rotate(-R),e.translate(-C,-A)}P&&e.lineTo(M[6]+p,M[7]+f);break;case"Z":e.closePath()}}}function C(e,n){var r=n.markerStart,i=n.markerEnd,a=n.markerStartOffset,o=n.markerEndOffset,s=n.points.points,c=s.length,l=s[0][0],h=s[0][1],u=s[c-1][0],d=s[c-1][1],p=0,f=0,v=0,y=0,g=0;r&&t.isDisplayObject(r)&&a&&(p=Math.cos(g=Math.atan2(s[1][1]-s[0][1],s[1][0]-s[0][0]))*(a||0),f=Math.sin(g)*(a||0)),i&&t.isDisplayObject(i)&&o&&(v=Math.cos(g=Math.atan2(s[c-1][1]-s[0][1],s[c-1][0]-s[0][0]))*(o||0),y=Math.sin(g)*(o||0)),e.moveTo(l+(p||v),h+(f||y));for(var m=1;c-1>m;m++){var E=s[m];e.lineTo(E[0],E[1])}e.lineTo(u,d)}function A(e,n){var r=n.markerStart,i=n.markerEnd,a=n.markerStartOffset,o=n.markerEndOffset,s=n.points.points,c=s.length,l=s[0][0],h=s[0][1],u=s[c-1][0],d=s[c-1][1],p=0,f=0,v=0,y=0,g=0;r&&t.isDisplayObject(r)&&a&&(p=Math.cos(g=Math.atan2(s[1][1]-s[0][1],s[1][0]-s[0][0]))*(a||0),f=Math.sin(g)*(a||0)),i&&t.isDisplayObject(i)&&o&&(v=Math.cos(g=Math.atan2(s[c-2][1]-s[c-1][1],s[c-2][0]-s[c-1][0]))*(o||0),y=Math.sin(g)*(o||0)),e.moveTo(l+p,h+f);for(var m=1;c-1>m;m++){var E=s[m];e.lineTo(E[0],E[1])}e.lineTo(u+v,d+y)}function w(e,t){var n=t.x,r=void 0===n?0:n,i=t.y,a=void 0===i?0:i,o=t.radius,c=t.width,l=t.height,h=c,d=l;if(o&&o.some((function(e){return 0!==e}))){var p=c>0?1:-1,f=l>0?1:-1,v=p+f===0,y=s(o.map((function(e){return u(e,0,Math.min(Math.abs(h)/2,Math.abs(d)/2))})),4),g=y[0],m=y[1],E=y[2],x=y[3];e.moveTo(p*g+r,a),e.lineTo(h-p*m+r,a),0!==m&&e.arc(h-p*m+r,f*m+a,m,-f*Math.PI/2,p>0?0:Math.PI,v),e.lineTo(h+r,d-f*E+a),0!==E&&e.arc(h-p*E+r,d-f*E+a,E,p>0?0:Math.PI,f>0?Math.PI/2:1.5*Math.PI,v),e.lineTo(p*x+r,d+a),0!==x&&e.arc(p*x+r,d-f*x+a,x,f>0?Math.PI/2:-Math.PI/2,p>0?Math.PI:0,v),e.lineTo(r,f*g+a),0!==g&&e.arc(p*g+r,f*g+a,g,p>0?Math.PI:0,f>0?1.5*Math.PI:Math.PI/2,v)}else e.rect(r,a,h,d)}Math.hypot||(Math.hypot=function(){for(var e=0,t=arguments.length;t--;)e+=arguments[t]*arguments[t];return Math.sqrt(e)}),g(),function(){var e,t=(e=new p(2),p!=Float32Array&&(e[0]=0,e[1]=0),e)}();var O=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]=b,e[t.Shape.ELLIPSE]=S,e[t.Shape.RECT]=w,e[t.Shape.LINE]=P,e[t.Shape.POLYLINE]=A,e[t.Shape.POLYGON]=C,e[t.Shape.PATH]=T,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),L=Object.freeze({__proto__:null,Plugin:O});function k(e,t,n,r){var i=e-n,a=t-r;return Math.sqrt(i*i+a*a)}var R=1e-4;function I(e,t,n,r,i,a){var o=-1,l=1/0,h=[n,r],u=20;a&&a>200&&(u=a/10);for(var d=1/u,p=d/10,f=0;u>=f;f++){var v=f*d,y=[i.apply(void 0,c([],s(e.concat([v])),!1)),i.apply(void 0,c([],s(t.concat([v])),!1))];l>(x=k(h[0],h[1],y[0],y[1]))&&(o=v,l=x)}if(0===o)return{x:e[0],y:t[0]};if(1===o){var g=e.length;return{x:e[g-1],y:t[g-1]}}l=1/0;for(f=0;32>f&&R<=p;f++){var m=o-p,E=o+p,x=(y=[i.apply(void 0,c([],s(e.concat([m])),!1)),i.apply(void 0,c([],s(t.concat([m])),!1))],k(h[0],h[1],y[0],y[1]));if(m>=0&&l>x)o=m,l=x;else{var M=[i.apply(void 0,c([],s(e.concat([E])),!1)),i.apply(void 0,c([],s(t.concat([E])),!1))],b=k(h[0],h[1],M[0],M[1]);1>=E&&l>b?(o=E,l=b):p*=.5}}return{x:i.apply(void 0,c([],s(e.concat([o])),!1)),y:i.apply(void 0,c([],s(t.concat([o])),!1))}}function N(e,t,n,r,i,a){var o=[n-e,r-t];if(function(e,t){return e[0]===t[0]&&e[1]===t[1]}(o,[0,0]))return Math.sqrt((i-e)*(i-e)+(a-t)*(a-t));var s=[-o[1],o[0]];return function(e,t){var n=t[0],r=t[1],i=n*n+r*r;i>0&&(i=1/Math.sqrt(i)),e[0]=t[0]*i,e[1]=t[1]*i}(s,s),Math.abs(function(e,t){return e[0]*t[0]+e[1]*t[1]}([i-e,a-t],s))}function B(e,t,n,r,i){var a=1-i;return a*a*a*e+3*t*i*a*a+3*n*i*i*a+r*i*i*i}function D(e,t,n,r,i,a,o,s,c,l,h){var u=function(e,t,n,r,i,a,o,s,c,l,h){return I([e,n,i,o],[t,r,a,s],c,l,B,h)}(e,t,n,r,i,a,o,s,c,l,h);return k(u.x,u.y,c,l)}function F(e,t,n,r){var i=1-r;return i*i*e+2*r*i*t+r*r*n}function G(e,t,n,r,i,a,o,s){var c=function(e,t,n,r,i,a,o,s){return I([e,n,i],[t,r,a],o,s,F)}(e,t,n,r,i,a,o,s);return k(c.x,c.y,o,s)}var j=g(),_=g(),H=g(),$=f(),W=function(){function e(){var e=this;this.isHit=function(n,r,i,a){var o,s,c,l,h,u,d,p,f,v,y,g,x,M,b,S,P,T,C,A,w,O,L,k,R,I,N,B,D,F,G,j=e.context.pointInPathPickerFactory[n.nodeName];if(j){var W=(o=$,(G=(C=(c=(s=i)[0])*(p=s[5])-(l=s[1])*(d=s[4]))*(F=(x=s[10])*(T=s[15])-(M=s[11])*(P=s[14]))-(A=c*(f=s[6])-(h=s[2])*d)*(D=(g=s[9])*T-M*(S=s[13]))+(w=c*(v=s[7])-(u=s[3])*d)*(B=g*P-x*S)+(O=l*f-h*p)*(N=(y=s[8])*T-M*(b=s[12]))-(L=l*v-u*p)*(I=y*P-x*b)+(k=h*v-u*f)*(R=y*S-g*b))?(o[0]=(p*F-f*D+v*B)*(G=1/G),o[1]=(h*D-l*F-u*B)*G,o[2]=(S*k-P*L+T*O)*G,o[3]=(x*L-g*k-M*O)*G,o[4]=(f*N-d*F-v*I)*G,o[5]=(c*F-h*N+u*I)*G,o[6]=(P*w-b*k-T*A)*G,o[7]=(y*k-x*w+M*A)*G,o[8]=(d*D-p*N+v*R)*G,o[9]=(l*N-c*D-u*R)*G,o[10]=(b*L-S*w+T*C)*G,o[11]=(g*w-y*L-M*C)*G,o[12]=(p*I-d*B-f*R)*G,o[13]=(c*B-l*I+h*R)*G,o[14]=(S*A-b*O-P*C)*G,o[15]=(y*O-g*A+x*C)*G,o):null),U=E(_,m(H,r[0],r[1],0),W);if(j(n,new t.Point(U[0],U[1]),a,e.isPointInPath,e.context,e.runtime))return!0}return!1},this.isPointInPath=function(t,n){var r=e.runtime.offscreenCanvasCreator.getOrCreateContext(e.context.config.offscreenCanvas),i=e.context.pathGeneratorFactory[t.nodeName];return i&&(r.beginPath(),i(r,t.parsedStyle),r.closePath()),r.isPointInPath(n.x,n.y)}}return e.prototype.apply=function(t,n){var r,i=this,s=t.renderingService,c=t.renderingContext;this.context=t,this.runtime=n;var l=null===(r=c.root)||void 0===r?void 0:r.ownerDocument;s.hooks.pick.tapPromise(e.tag,(function(e){return a(i,void 0,void 0,(function(){return o(this,(function(t){return[2,this.pick(l,e)]}))}))})),s.hooks.pickSync.tap(e.tag,(function(e){return i.pick(l,e)}))},e.prototype.pick=function(e,n){var r,i,a=n.topmost,o=n.position,s=m(j,o.x,o.y,0),c=e.elementsFromBBox(s[0],s[1],s[0],s[1]),l=[];try{for(var h=function(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}(c),u=h.next();!u.done;u=h.next()){var d=u.value,p=d.getWorldTransform();if(this.isHit(d,s,p,!1)){var f=t.findClosestClipPathTarget(d);if(f){var v=f.parsedStyle.clipPath;if(this.isHit(v,s,v.getWorldTransform(),!0)){if(a)return n.picked=[d],n;l.push(d)}}else{if(a)return n.picked=[d],n;l.push(d)}}}}catch(e){r={error:e}}finally{try{u&&!u.done&&(i=h.return)&&i.call(h)}finally{if(r)throw r.error}}return n.picked=l,n},e.tag="CanvasPicker",e}();function U(e,n,r){var i=e.parsedStyle,a=i.cx,o=i.cy,c=i.r,l=i.fill,h=i.stroke,u=i.lineWidth,d=i.increasedLineWidthForHitTesting,p=i.pointerEvents,f=void 0===p?"auto":p,v=((void 0===u?1:u)+(void 0===d?0:d))/2,y=k(void 0===a?0:a,void 0===o?0:o,n.x,n.y),g=s(t.isFillOrStrokeAffected(f,l,h),2),m=g[0],E=g[1];return m&&E||r?c+v>=y:m?c>=y:!!E&&(y>=c-v&&c+v>=y)}function z(e,t,n,r){return e/(n*n)+t/(r*r)}function Y(e,n,r){var i=e.parsedStyle,a=i.cx,o=void 0===a?0:a,c=i.cy,l=void 0===c?0:c,h=i.rx,u=i.ry,d=i.lineWidth,p=void 0===d?1:d,f=i.increasedLineWidthForHitTesting,v=void 0===f?0:f,y=i.pointerEvents,g=n.x,m=n.y,E=s(t.isFillOrStrokeAffected(void 0===y?"auto":y,i.fill,i.stroke),2),x=E[0],M=E[1],b=(p+v)/2,S=(g-o)*(g-o),P=(m-l)*(m-l);return x&&M||r?1>=z(S,P,h+b,u+b):x?1>=z(S,P,h,u):!!M&&(z(S,P,h-b,u-b)>=1&&1>=z(S,P,h+b,u+b))}function q(e,t,n,r,i,a){return!(e>i||i>e+n||t>a||a>t+r)}function Q(e,t,n,r,i,a,o,s){var c=(Math.atan2(s-t,o-e)+2*Math.PI)%(2*Math.PI),l={x:e+n*Math.cos(c),y:t+n*Math.sin(c)};return k(l.x,l.y,o,s)<=a/2}function X(e,t,n,r,i,a,o){var s=i/2;return!(Math.min(e,n)-s>a||a>Math.max(e,n)+s||Math.min(t,r)-s>o||o>Math.max(t,r)+s)&&N(e,t,n,r,a,o)<=i/2}function V(e,t,n,r,i){var a=e.length;if(2>a)return!1;for(var o=0;a-1>o;o++){if(X(e[o][0],e[o][1],e[o+1][0],e[o+1][1],t,n,r))return!0}if(i){var s=e[0],c=e[a-1];if(X(s[0],s[1],c[0],c[1],t,n,r))return!0}return!1}var Z=1e-6;function J(e){return Z>Math.abs(e)?0:0>e?-1:1}function K(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 ee(e,t,n){var r=!1,i=e.length;if(2>=i)return!1;for(var a=0;i>a;a++){var o=e[a],s=e[(a+1)%i];if(K(o,s,[t,n]))return!0;J(o[1]-n)>0!=J(s[1]-n)>0&&0>J(t-(n-o[1])*(o[0]-s[0])/(o[1]-s[1])-o[0])&&(r=!r)}return r}function te(e,t,n){for(var r=!1,i=0;e.length>i;i++){if(r=ee(e[i],t,n))break}return r}function ne(e,n,r){var i=e.parsedStyle,a=i.x1,o=i.y1,c=i.x2,l=i.y2,h=i.lineWidth,u=void 0===h?1:h,d=i.increasedLineWidthForHitTesting,p=void 0===d?0:d,f=i.pointerEvents;return!(!s(t.isFillOrStrokeAffected(void 0===f?"auto":f,i.fill,i.stroke),2)[1]&&!r||!u)&&X(a,o,c,l,u+p,n.x,n.y)}function re(e,n,r,i,a,o){var c=e.parsedStyle,l=c.lineWidth,h=void 0===l?1:l,u=c.increasedLineWidthForHitTesting,d=void 0===u?0:u,p=c.d,f=c.pointerEvents,v=p.segments,y=p.hasArc,g=p.polylines,m=p.polygons,E=s(t.isFillOrStrokeAffected(void 0===f?"auto":f,(null==m?void 0:m.length)&&c.fill,c.stroke),2),x=E[0],b=E[1],S=t.getOrCalculatePathTotalLength(e),P=!1;return x||r?P=y?i(e,n):te(m,n.x,n.y)||te(g,n.x,n.y):((b||r)&&(P=function(e,t,n,r,i){for(var a=!1,o=t/2,s=0;e.length>s;s++){var c=e[s],l=c.currentPoint,h=c.params,u=c.prePoint,d=c.box;if(!d||q(d.x-o,d.y-o,d.width+t,d.height+t,n,r))switch(c.command){case"L":case"Z":if(a=X(u[0],u[1],l[0],l[1],t,n,r))return!0;break;case"Q":if(a=t/2>=G(u[0],u[1],h[1],h[2],h[3],h[4],n,r))return!0;break;case"C":if(a=t/2>=D(u[0],u[1],h[1],h[2],h[3],h[4],h[5],h[6],n,r,i))return!0;break;case"A":c.cubicParams||(c.cubicParams=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=D(f[0],f[1],p[v],p[v+1],p[v+2],p[v+3],p[v+4],p[v+5],n,r,i);if(f=[p[v+4],p[v+5]],a=t/2>=y)return!0}}}return a}(v,h+d,n.x,n.y,S)),P)}function ie(e,n,r){var i=e.parsedStyle,a=i.lineWidth,o=void 0===a?1:a,c=i.increasedLineWidthForHitTesting,l=void 0===c?0:c,h=i.points,u=i.pointerEvents,d=s(t.isFillOrStrokeAffected(void 0===u?"auto":u,i.fill,i.stroke),2),p=d[0],f=!1;return(d[1]||r)&&(f=V(h.points,o+l,n.x,n.y,!0)),f||!p&&!r||(f=ee(h.points,n.x,n.y)),f}function ae(e,n,r){var i=e.parsedStyle,a=i.lineWidth,o=void 0===a?1:a,c=i.increasedLineWidthForHitTesting,l=void 0===c?0:c,h=i.points,u=i.pointerEvents;return!(!s(t.isFillOrStrokeAffected(void 0===u?"auto":u,i.fill,i.stroke),2)[1]&&!r||!o)&&V(h.points,o+l,n.x,n.y,!1)}function oe(e,n,r,i,a){var o=e.parsedStyle,c=o.radius,l=o.lineWidth,h=void 0===l?1:l,d=o.increasedLineWidthForHitTesting,p=void 0===d?0:d,f=o.x,v=void 0===f?0:f,y=o.y,g=void 0===y?0:y,m=o.width,E=o.height,x=o.pointerEvents,M=s(t.isFillOrStrokeAffected(void 0===x?"auto":x,o.fill,o.stroke),2),b=M[0],S=M[1],P=h+p;if(c&&c.some((function(e){return 0!==e}))){var T=!1;return(S||r)&&(T=function(e,t,n,r,i,a,o,c){var l=s(i,4),h=l[0],u=l[1],d=l[2],p=l[3];return X(e+h,t,e+n-u,t,a,o,c)||X(e+n,t+u,e+n,t+r-d,a,o,c)||X(e+n-d,t+r,e+p,t+r,a,o,c)||X(e,t+r-p,e,t+h,a,o,c)||Q(e+n-u,t+u,u,0,0,a,o,c)||Q(e+n-d,t+r-d,d,0,0,a,o,c)||Q(e+p,t+r-p,p,0,0,a,o,c)||Q(e+h,t+h,h,0,0,a,o,c)}(v,g,m,E,c.map((function(e){return u(e,0,Math.min(Math.abs(m)/2,Math.abs(E)/2))})),P,n.x,n.y)),T||!b&&!r||(T=i(e,n)),T}var C=P/2;return b&&S||r?q(v-C,g-C,m+C,E+C,n.x,n.y):b?q(v,g,m,E,n.x,n.y):!!S&&function(e,t,n,r,i,a,o){var s=i/2;return q(e-s,t-s,n,i,a,o)||q(e+n-s,t-s,i,r,a,o)||q(e+s,t+r-s,n,i,a,o)||q(e-s,t+s,i,r,a,o)}(v,g,m,E,P,n.x,n.y)}function se(e,n,r,a,o,s){var c=e.parsedStyle,l=c.pointerEvents,h=c.x,u=void 0===h?0:h,d=c.y,p=void 0===d?0:d,f=c.width,v=c.height;if("non-transparent-pixel"===(void 0===l?"auto":l)){var y=o.config.offscreenCanvas,g=s.offscreenCanvasCreator.getOrCreateCanvas(y),m=s.offscreenCanvasCreator.getOrCreateContext(y,{willReadFrequently:!0});return g.width=f,g.height=v,o.defaultStyleRendererFactory[t.Shape.IMAGE].render(m,i(i({},e.parsedStyle),{x:0,y:0}),e,void 0,void 0,void 0),m.getImageData(n.x-u,n.y-p,1,1).data.every((function(e){return 0!==e}))}return!0}function ce(e,t,n,r){var i=e.getGeometryBounds();return!(i.min[0]>t.x||i.min[1]>t.y||t.x>i.max[0]||t.y>i.max[1])}var le=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]=U,e[t.Shape.ELLIPSE]=Y,e[t.Shape.RECT]=oe,e[t.Shape.LINE]=ne,e[t.Shape.POLYLINE]=ae,e[t.Shape.POLYGON]=ie,e[t.Shape.PATH]=re,e[t.Shape.TEXT]=ce,e[t.Shape.GROUP]=null,e[t.Shape.IMAGE]=se,e[t.Shape.HTML]=null,e[t.Shape.MESH]=null,e);this.context.pointInPathPickerFactory=n,this.addRenderingPlugin(new W)},n.prototype.destroy=function(){delete this.context.pointInPathPickerFactory,this.removeAllRenderingPlugins()},n}(t.AbstractRendererPlugin),he=Object.freeze({__proto__:null,Plugin:le}),ue=function(){function e(e){this.canvasRendererPluginOptions=e,this.removedRBushNodeAABBs=[],this.renderQueue=[],this.restoreStack=[],this.clearFullScreenLastFrame=!1,this.clearFullScreen=!1,this.vpMatrix=f(),this.dprMatrix=f(),this.tmpMat4=f(),this.vec3a=g(),this.vec3b=g(),this.vec3c=g(),this.vec3d=g()}return e.prototype.apply=function(n,r){var i=this;this.context=n;var a=n.config,o=n.camera,l=n.renderingService,h=n.renderingContext,u=n.pathGeneratorFactory;this.rBush=n.rBushRoot,this.pathGeneratorFactory=u;var d=n.contextService,p=h.root.ownerDocument.defaultView,f=function(e){var t=e.target.rBushNode;t.aabb&&i.removedRBushNodeAABBs.push(t.aabb)},v=function(e){var t=e.target.rBushNode;t.aabb&&i.removedRBushNodeAABBs.push(t.aabb)};l.hooks.init.tap(e.tag,(function(){p.addEventListener(t.ElementEvent.UNMOUNTED,f),p.addEventListener(t.ElementEvent.CULLED,v);var e=d.getDPR(),n=a.width,r=a.height,o=d.getContext();i.clearRect(o,0,0,n*e,r*e,a.background)})),l.hooks.destroy.tap(e.tag,(function(){p.removeEventListener(t.ElementEvent.UNMOUNTED,f),p.removeEventListener(t.ElementEvent.CULLED,v),i.renderQueue=[],i.removedRBushNodeAABBs=[],i.restoreStack=[]})),l.hooks.beginFrame.tap(e.tag,(function(){var e,t=d.getContext(),n=d.getDPR(),r=a.width,o=a.height,s=i.canvasRendererPluginOptions,c=s.dirtyObjectNumThreshold,h=s.dirtyObjectRatioThreshold,u=l.getStats(),f=u.rendered,v=f/u.total;i.clearFullScreen=i.clearFullScreenLastFrame||!(null===(e=p.context.renderingPlugins[1])||void 0===e?void 0:e.isFirstTimeRenderingFinished)||l.disableDirtyRectangleRendering()||f>c&&v>h,t&&(t.resetTransform?t.resetTransform():t.setTransform(1,0,0,1,0,0),i.clearFullScreen&&i.clearRect(t,0,0,r*n,o*n,a.background))}));var g=function(e,t){e.isVisible()&&!e.isCulled()&&i.renderDisplayObject(e,t,i.context,i.restoreStack,r),(e.sortable.sorted||e.childNodes).forEach((function(e){g(e,t)}))};l.hooks.endFrame.tap(e.tag,(function(){if(0!==h.root.childNodes.length){i.clearFullScreenLastFrame=!1;var e,n,l=d.getContext(),u=d.getDPR();if((e=i.dprMatrix)[0]=(n=[u,u,1])[0],e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=n[1],e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=n[2],e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,y(i.vpMatrix,i.dprMatrix,o.getOrthoMatrix()),i.clearFullScreen)g(h.root,l);else{var f=i.safeMergeAABB.apply(i,c([i.mergeDirtyAABBs(i.renderQueue)],s(i.removedRBushNodeAABBs.map((function(e){var n=e.minX,r=e.minY,i=e.maxX,a=e.maxY,o=new t.AABB;return o.setMinMax([n,r,0],[i,a,0]),o}))),!1));if(i.removedRBushNodeAABBs=[],t.AABB.isEmpty(f))return void(i.renderQueue=[]);var v=i.convertAABB2Rect(f),m=v.x,x=v.y,M=v.width,b=v.height,S=E(i.vec3a,[m,x,0],i.vpMatrix),P=E(i.vec3b,[m+M,x,0],i.vpMatrix),T=E(i.vec3c,[m,x+b,0],i.vpMatrix),C=E(i.vec3d,[m+M,x+b,0],i.vpMatrix),A=Math.min(S[0],P[0],C[0],T[0]),w=Math.min(S[1],P[1],C[1],T[1]),O=Math.max(S[0],P[0],C[0],T[0]),L=Math.max(S[1],P[1],C[1],T[1]),k=Math.floor(A),R=Math.floor(w),I=Math.ceil(O-A),N=Math.ceil(L-w);l.save(),i.clearRect(l,k,R,I,N,a.background),l.beginPath(),l.rect(k,R,I,N),l.clip(),l.setTransform(i.vpMatrix[0],i.vpMatrix[1],i.vpMatrix[4],i.vpMatrix[5],i.vpMatrix[12],i.vpMatrix[13]),a.renderer.getConfig().enableDirtyRectangleRenderingDebug&&p.dispatchEvent(new t.CustomEvent(t.CanvasEvent.DIRTY_RECTANGLE,{dirtyRect:{x:k,y:R,width:I,height:N}})),i.searchDirtyObjects(f).sort((function(e,t){return e.sortable.renderOrder-t.sortable.renderOrder})).forEach((function(e){e&&e.isVisible()&&!e.isCulled()&&i.renderDisplayObject(e,l,i.context,i.restoreStack,r)})),l.restore(),i.renderQueue.forEach((function(e){i.saveDirtyAABB(e)})),i.renderQueue=[]}i.restoreStack.forEach((function(){l.restore()})),i.restoreStack=[]}else i.clearFullScreenLastFrame=!0})),l.hooks.render.tap(e.tag,(function(e){i.clearFullScreen||i.renderQueue.push(e)}))},e.prototype.clearRect=function(e,t,n,r,i,a){e.clearRect(t,n,r,i),a&&(e.fillStyle=a,e.fillRect(t,n,r,i))},e.prototype.renderDisplayObject=function(e,n,r,i,a){var o=e.nodeName,s=i[i.length-1];!s||e.compareDocumentPosition(s)&t.Node.DOCUMENT_POSITION_CONTAINS||(n.restore(),i.pop());var c=this.context.styleRendererFactory[o],l=this.pathGeneratorFactory[o],h=e.parsedStyle.clipPath;if(h){this.applyWorldTransform(n,h);var u=this.pathGeneratorFactory[h.nodeName];u&&(n.save(),i.push(e),n.beginPath(),u(n,h.parsedStyle),n.closePath(),n.clip())}c&&(this.applyWorldTransform(n,e),n.save(),this.applyAttributesToContext(n,e)),l&&(n.beginPath(),l(n,e.parsedStyle),e.nodeName!==t.Shape.LINE&&e.nodeName!==t.Shape.PATH&&e.nodeName!==t.Shape.POLYLINE&&n.closePath()),c&&(c.render(n,e.parsedStyle,e,r,this,a),n.restore()),e.renderable.dirty=!1},e.prototype.convertAABB2Rect=function(e){var t=e.getMin(),n=e.getMax(),r=Math.floor(t[0]),i=Math.floor(t[1]);return{x:r,y:i,width:Math.ceil(n[0])-r,height:Math.ceil(n[1])-i}},e.prototype.mergeDirtyAABBs=function(e){var n=new t.AABB;return e.forEach((function(e){var t=e.getRenderBounds();n.add(t);var r=e.renderable.dirtyRenderBounds;r&&n.add(r)})),n},e.prototype.searchDirtyObjects=function(e){var t=s(e.getMin(),2),n=t[0],r=t[1],i=s(e.getMax(),2);return this.rBush.search({minX:n,minY:r,maxX:i[0],maxY:i[1]}).map((function(e){return e.displayObject}))},e.prototype.saveDirtyAABB=function(e){var n=e.renderable;n.dirtyRenderBounds||(n.dirtyRenderBounds=new t.AABB);var r=e.getRenderBounds();r&&n.dirtyRenderBounds.update(r.center,r.halfExtents)},e.prototype.applyAttributesToContext=function(e,t){var n=t.parsedStyle,r=n.stroke,i=n.fill,a=n.opacity,o=n.lineDash,s=n.lineDashOffset;o&&e.setLineDash(o),l(s)||(e.lineDashOffset=s),l(a)||(e.globalAlpha*=a),l(r)||Array.isArray(r)||r.isNone||(e.strokeStyle=t.attributes.stroke),l(i)||Array.isArray(i)||i.isNone||(e.fillStyle=t.attributes.fill)},e.prototype.applyWorldTransform=function(e,t,n){n?(v(this.tmpMat4,t.getLocalTransform()),y(this.tmpMat4,n,this.tmpMat4),y(this.tmpMat4,this.vpMatrix,this.tmpMat4)):(v(this.tmpMat4,t.getWorldTransform()),y(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}(),de=function(){function e(e){this.imagePool=e}return e.prototype.render=function(e,n,r,i,a,o){var s=n.fill,c=n.fillRule,h=n.opacity,u=void 0===h?1:h,d=n.fillOpacity,p=void 0===d?1:d,f=n.stroke,v=n.strokeOpacity,y=void 0===v?1:v,g=n.lineWidth,m=void 0===g?1:g,E=n.lineCap,x=n.lineJoin,M=n.shadowType,b=n.shadowBlur,S=n.filter,P=n.miterLimit,T=s&&!s.isNone,C=f&&!f.isNone&&m>0,A=0===(null==s?void 0:s.alpha),w=!(!S||!S.length),O=!l(n.shadowColor)&&b>0,L=r.nodeName,k="inner"===M,R=C&&O&&(L===t.Shape.PATH||L===t.Shape.LINE||L===t.Shape.POLYLINE||A||k);T&&(e.globalAlpha=u*p,R||pe(r,e,O),ye(e,r,s,c,i,a,o,this.imagePool),R||this.clearShadowAndFilter(e,w,O)),C&&(e.globalAlpha=u*y,e.lineWidth=m,l(P)||(e.miterLimit=P),l(E)||(e.lineCap=E),l(x)||(e.lineJoin=x),R&&(k&&(e.globalCompositeOperation="source-atop"),pe(r,e,!0),k&&(ge(e,r,f,i,a,o,this.imagePool),e.globalCompositeOperation="source-over",this.clearShadowAndFilter(e,w,!0))),ge(e,r,f,i,a,o,this.imagePool))},e.prototype.clearShadowAndFilter=function(e,t,n){if(n&&(e.shadowColor="transparent",e.shadowBlur=0),t){var r=e.filter;!l(r)&&r.indexOf("drop-shadow")>-1&&(e.filter=r.replace(/drop-shadow\([^)]*\)/,"").trim()||"none")}},e}();function pe(e,t,n){var r=e.parsedStyle,i=r.filter,a=r.shadowColor,o=r.shadowBlur,s=r.shadowOffsetX,c=r.shadowOffsetY;i&&i.length&&(t.filter=e.style.filter),n&&(t.shadowColor=""+a,t.shadowBlur=o||0,t.shadowOffsetX=s||0,t.shadowOffsetY=c||0)}function fe(e,t,n,r,i,a,o){var s,c;if("rect"===e.image.nodeName){var l=e.image.parsedStyle,h=l.width,u=l.height;c=r.contextService.getDPR();var d=r.config.offscreenCanvas;(s=a.offscreenCanvasCreator.getOrCreateCanvas(d)).width=h*c,s.height=u*c;var p=a.offscreenCanvasCreator.getOrCreateContext(d),f=[];e.image.forEach((function(e){i.renderDisplayObject(e,p,r,f,a)})),f.forEach((function(){p.restore()}))}return o.getOrCreatePatternSync(e,n,s,c,t.getGeometryBounds().min,(function(){t.renderable.dirty=!0,r.renderingService.dirtify()}))}function ve(e,n,r,a){var o;if(e.type===t.GradientType.LinearGradient||e.type===t.GradientType.RadialGradient){var s=n.getGeometryBounds(),c=s&&2*s.halfExtents[0]||1,l=s&&2*s.halfExtents[1]||1,h=s&&s.min||[0,0];o=a.getOrCreateGradient(i(i({type:e.type},e.value),{min:h,width:c,height:l}),r)}return o}function ye(e,n,r,i,a,o,s,c,l){void 0===l&&(l=!1),Array.isArray(r)?r.forEach((function(t){e.fillStyle=ve(t,n,e,c),l||(i?e.fill(i):e.fill())})):(t.isPattern(r)&&(e.fillStyle=fe(r,n,e,a,o,s,c)),l||(i?e.fill(i):e.fill()))}function ge(e,n,r,i,a,o,s,c){void 0===c&&(c=!1),Array.isArray(r)?r.forEach((function(t){e.strokeStyle=ve(t,n,e,s),c||e.stroke()})):(t.isPattern(r)&&(e.strokeStyle=fe(r,n,e,i,a,o,s)),c||e.stroke())}var me=function(){function e(e){this.imagePool=e}return e.prototype.render=function(e,t,n){var r,i=t.x,a=void 0===i?0:i,o=t.y,s=void 0===o?0:o,c=t.src,u=t.shadowColor,d=t.shadowBlur,p=t.width,f=t.height;if(h(c)?r=this.imagePool.getImageSync(c):(p||(p=c.width),f||(f=c.height),r=c),r){pe(n,e,!l(u)&&d>0);try{e.drawImage(r,a,s,p,f)}catch(e){}}},e}(),Ee=function(){function e(e){this.imagePool=e}return e.prototype.render=function(e,t,n,r,i,a){n.getBounds();var o=t.lineWidth,s=void 0===o?1:o,c=t.textAlign,h=void 0===c?"start":c,u=t.textBaseline,d=void 0===u?"alphabetic":u,p=t.lineJoin,f=void 0===p?"miter":p,v=t.miterLimit,y=void 0===v?10:v,g=t.letterSpacing,m=void 0===g?0:g,E=t.stroke,x=t.fill,M=t.fillRule,b=t.fillOpacity,S=void 0===b?1:b,P=t.strokeOpacity,T=void 0===P?1:P,C=t.opacity,A=void 0===C?1:C,w=t.metrics,O=t.x,L=void 0===O?0:O,k=t.y,R=void 0===k?0:k,I=t.dx,N=t.dy,B=t.shadowColor,D=t.shadowBlur,F=w.lines,G=w.height,j=w.lineHeight,_=w.lineMetrics;e.font=w.font,e.lineWidth=s,e.textAlign="middle"===h?"center":h;var H=d;"alphabetic"===H&&(H="bottom"),e.lineJoin=f,l(y)||(e.miterLimit=y);var $=R;"middle"===d?$+=-G/2-j/2:"bottom"===d||"alphabetic"===d||"ideographic"===d?$+=-G:"top"!==d&&"hanging"!==d||($+=-j);var W=L+(I||0);$+=N||0,1===F.length&&("bottom"===H?(H="middle",$-=.5*G):"top"===H&&(H="middle",$+=.5*G)),e.textBaseline=H,pe(n,e,!l(B)&&D>0);for(var U=0;F.length>U;U++){var z=s/2+W;$+=j,l(E)||E.isNone||!s||this.drawLetterSpacing(e,n,F[U],_[U],h,z,$,m,x,M,S,E,T,A,!0,r,i,a),l(x)||this.drawLetterSpacing(e,n,F[U],_[U],h,z,$,m,x,M,S,E,T,A,!1,r,i,a)}},e.prototype.drawLetterSpacing=function(e,t,n,r,i,a,o,s,c,l,h,u,d,p,f,v,y,g){if(0!==s){var m=e.textAlign;e.textAlign="left";var E=a;"center"===i||"middle"===i?E=a-r.width/2:"right"!==i&&"end"!==i||(E=a-r.width);for(var x=Array.from(n),M=e.measureText(n).width,b=0,S=0;x.length>S;++S){var P=x[S];f?this.strokeText(e,t,P,E,o,u,d,v,y,g):this.fillText(e,t,P,E,o,c,l,h,p,v,y,g),E+=M-(b=e.measureText(n.substring(S+1)).width)+s,M=b}e.textAlign=m}else f?this.strokeText(e,t,n,a,o,u,d,v,y,g):this.fillText(e,t,n,a,o,c,l,h,p,v,y,g)},e.prototype.fillText=function(e,t,n,r,i,a,o,s,c,h,u,d){var p;ye(e,t,a,o,h,u,d,this.imagePool,!0);var f=!l(s)&&1!==s;f&&(p=e.globalAlpha,e.globalAlpha=s*c),e.fillText(n,r,i),f&&(e.globalAlpha=p)},e.prototype.strokeText=function(e,t,n,r,i,a,o,s,c,h){var u;ge(e,t,a,s,c,h,this.imagePool,!0);var d=!l(o)&&1!==o;d&&(u=e.globalAlpha,e.globalAlpha=o),e.strokeText(n,r,i),d&&(e.globalAlpha=u)},e}(),xe=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return r(t,e),t}(de),Me=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return r(t,e),t}(de),be=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return r(t,e),t}(de),Se=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return r(t,e),t}(de),Pe=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return r(t,e),t}(de),Te=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return r(t,e),t}(de),Ce=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return r(t,e),t}(de),Ae=function(e){function n(t){void 0===t&&(t={});var n=e.call(this)||this;return n.options=t,n.name="canvas-renderer",n}return r(n,e),n.prototype.init=function(){var e,n=i({dirtyObjectNumThreshold:500,dirtyObjectRatioThreshold:.8},this.options),r=this.context.imagePool,a=new de(r),o=((e={})[t.Shape.CIRCLE]=a,e[t.Shape.ELLIPSE]=a,e[t.Shape.RECT]=a,e[t.Shape.IMAGE]=new me(r),e[t.Shape.TEXT]=new Ee(r),e[t.Shape.LINE]=a,e[t.Shape.POLYLINE]=a,e[t.Shape.POLYGON]=a,e[t.Shape.PATH]=a,e[t.Shape.GROUP]=void 0,e[t.Shape.HTML]=void 0,e[t.Shape.MESH]=void 0,e);this.context.defaultStyleRendererFactory=o,this.context.styleRendererFactory=o,this.addRenderingPlugin(new ue(n))},n.prototype.destroy=function(){this.removeAllRenderingPlugins(),delete this.context.defaultStyleRendererFactory,delete this.context.styleRendererFactory},n}(t.AbstractRendererPlugin),we=Object.freeze({__proto__:null,CircleRenderer:Me,EllipseRenderer:be,ImageRenderer:me,LineRenderer:Se,PathRenderer:Ce,Plugin:Ae,PolygonRenderer:Te,PolylineRenderer:Pe,RectRenderer:xe,TextRenderer:Ee}),Oe=function(){function e(){}return e.prototype.apply=function(t,n){var r=this,i=t.renderingService,a=t.renderingContext,o=t.config;this.context=t;var s=a.root.ownerDocument.defaultView,c=function(e){i.hooks.pointerMove.call(e)},l=function(e){i.hooks.pointerUp.call(e)},h=function(e){i.hooks.pointerDown.call(e)},u=function(e){i.hooks.pointerOver.call(e)},d=function(e){i.hooks.pointerOut.call(e)},p=function(e){i.hooks.pointerCancel.call(e)},f=function(e){i.hooks.pointerWheel.call(e)},v=function(e){i.hooks.click.call(e)};i.hooks.init.tap(e.tag,(function(){var e=r.context.contextService.getDomElement();n.globalThis.navigator.msPointerEnabled?(e.style.msContentZooming="none",e.style.msTouchAction="none"):s.supportsPointerEvents&&(e.style.touchAction="none"),s.supportsPointerEvents?function(e){n.globalThis.document.addEventListener("pointermove",c,!0),e.addEventListener("pointerdown",h,!0),e.addEventListener("pointerleave",d,!0),e.addEventListener("pointerover",u,!0),n.globalThis.addEventListener("pointerup",l,!0),n.globalThis.addEventListener("pointercancel",p,!0)}(e):function(e){n.globalThis.document.addEventListener("mousemove",c,!0),e.addEventListener("mousedown",h,!0),e.addEventListener("mouseout",d,!0),e.addEventListener("mouseover",u,!0),n.globalThis.addEventListener("mouseup",l,!0)}(e),s.supportsTouchEvents&&function(e){e.addEventListener("touchstart",h,!0),e.addEventListener("touchend",l,!0),e.addEventListener("touchmove",c,!0),e.addEventListener("touchcancel",p,!0)}(e),o.useNativeClickEvent&&e.addEventListener("click",v,!0),e.addEventListener("wheel",f,{passive:!0,capture:!0})})),i.hooks.destroy.tap(e.tag,(function(){var e=r.context.contextService.getDomElement();n.globalThis.navigator.msPointerEnabled?(e.style.msContentZooming="",e.style.msTouchAction=""):s.supportsPointerEvents&&(e.style.touchAction=""),s.supportsPointerEvents?function(e){n.globalThis.document.removeEventListener("pointermove",c,!0),e.removeEventListener("pointerdown",h,!0),e.removeEventListener("pointerleave",d,!0),e.removeEventListener("pointerover",u,!0),n.globalThis.removeEventListener("pointerup",l,!0),n.globalThis.removeEventListener("pointercancel",p,!0)}(e):function(e){n.globalThis.document.removeEventListener("mousemove",c,!0),e.removeEventListener("mousedown",h,!0),e.removeEventListener("mouseout",d,!0),e.removeEventListener("mouseover",u,!0),n.globalThis.removeEventListener("mouseup",l,!0)}(e),s.supportsTouchEvents&&function(e){e.removeEventListener("touchstart",h,!0),e.removeEventListener("touchend",l,!0),e.removeEventListener("touchmove",c,!0),e.removeEventListener("touchcancel",p,!0)}(e),o.useNativeClickEvent&&e.removeEventListener("click",v,!0),e.removeEventListener("wheel",f,!0)}))},e.tag="DOMInteraction",e}(),Le=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 Oe)},t.prototype.destroy=function(){this.removeAllRenderingPlugins()},t}(t.AbstractRendererPlugin),ke=Object.freeze({__proto__:null,Plugin:Le}),Re=function(){function e(){this.displayObjectHTMLElementMap=new WeakMap}return e.prototype.joinTransformMatrix=function(e,t){return void 0===t&&(t=[0,0,0]),"matrix(".concat([e[0],e[1],e[4],e[5],e[12]+t[0],e[13]+t[1]].join(","),")")},e.prototype.apply=function(n,r){var i=this,a=n.camera,o=n.renderingContext,s=n.renderingService;this.context=n;var c=o.root.ownerDocument.defaultView,l=c.context.eventService.nativeHTMLMap,h=function(e,t){t.style.transform=i.joinTransformMatrix(e.getWorldTransform(),e.getOrigin())},u=function(e){var n=e.target;if(n.nodeName===t.Shape.HTML){i.$camera||(i.$camera=i.createCamera(a));var r=i.getOrCreateEl(n);i.$camera.appendChild(r),Object.keys(n.attributes).forEach((function(e){i.updateAttribute(e,n)})),h(n,r),l.set(r,n)}},d=function(e){var n=e.target;if(n.nodeName===t.Shape.HTML&&i.$camera){var r=i.getOrCreateEl(n);r&&(r.remove(),l.delete(r))}},p=function(e){var n=e.target;n.nodeName===t.Shape.HTML&&i.updateAttribute(e.attrName,n)},f=function(e){var n=e.target;(n.nodeName===t.Shape.FRAGMENT?n.childNodes:[n]).forEach((function(e){if(e.nodeName===t.Shape.HTML){var n=i.getOrCreateEl(e);h(e,n)}}))},v=function(){if(i.$camera){var e=i.context.config,t=e.height;i.$camera.parentElement.style.width="".concat(e.width||0,"px"),i.$camera.parentElement.style.height="".concat(t||0,"px")}};s.hooks.init.tap(e.tag,(function(){c.addEventListener(t.CanvasEvent.RESIZE,v),c.addEventListener(t.ElementEvent.MOUNTED,u),c.addEventListener(t.ElementEvent.UNMOUNTED,d),c.addEventListener(t.ElementEvent.ATTR_MODIFIED,p),c.addEventListener(t.ElementEvent.BOUNDS_CHANGED,f)})),s.hooks.endFrame.tap(e.tag,(function(){i.$camera&&o.renderReasons.has(t.RenderReason.CAMERA_CHANGED)&&(i.$camera.style.transform=i.joinTransformMatrix(a.getOrthoMatrix()))})),s.hooks.destroy.tap(e.tag,(function(){i.$camera&&i.$camera.remove(),c.removeEventListener(t.CanvasEvent.RESIZE,v),c.removeEventListener(t.ElementEvent.MOUNTED,u),c.removeEventListener(t.ElementEvent.UNMOUNTED,d),c.removeEventListener(t.ElementEvent.ATTR_MODIFIED,p),c.removeEventListener(t.ElementEvent.BOUNDS_CHANGED,f)}))},e.prototype.createCamera=function(e){var t=this.context.config,n=t.document,r=t.width,i=t.height,a=this.context.contextService.getDomElement(),o=a.parentNode;if(o){var s="g-canvas-camera",c=o.querySelector("#"+s);if(!c){var l=(n||document).createElement("div");l.style.overflow="hidden",l.style.pointerEvents="none",l.style.position="absolute",l.style.left="0px",l.style.top="0px",l.style.width="".concat(r||0,"px"),l.style.height="".concat(i||0,"px");var h=(n||document).createElement("div");c=h,h.id=s,h.style.position="absolute",h.style.left="".concat(a.offsetLeft||0,"px"),h.style.top="".concat(a.offsetTop||0,"px"),h.style.transformOrigin="left top",h.style.transform=this.joinTransformMatrix(e.getOrthoMatrix()),h.style.pointerEvents="none",h.style.width="100%",h.style.height="100%",l.appendChild(h),o.appendChild(l)}return c}return null},e.prototype.getOrCreateEl=function(e){var t=this.context.config.document,n=this.displayObjectHTMLElementMap.get(e);return n||(n=(t||document).createElement("div"),e.parsedStyle.$el=n,this.displayObjectHTMLElementMap.set(e,n),e.id&&(n.id=e.id),e.name&&n.setAttribute("name",e.name),e.className&&(n.className=e.className),n.style.position="absolute",n.style["will-change"]="transform",n.style.transform=this.joinTransformMatrix(e.getWorldTransform(),e.getOrigin())),n},e.prototype.updateAttribute=function(e,n){var r=this.getOrCreateEl(n);switch(e){case"innerHTML":var i=n.parsedStyle.innerHTML;h(i)?r.innerHTML=i:(r.innerHTML="",r.appendChild(i));break;case"x":r.style.left="".concat(n.parsedStyle.x,"px");break;case"y":r.style.top="".concat(n.parsedStyle.y,"px");break;case"transformOrigin":var a=n.parsedStyle.transformOrigin;r.style["transform-origin"]="".concat(a[0].buildCSSText(null,null,"")," ").concat(a[1].buildCSSText(null,null,""));break;case"width":var o=n.parsedStyle.width;r.style.width=d(o)?"".concat(o,"px"):""+o;break;case"height":var s=n.parsedStyle.height;r.style.height=d(s)?"".concat(s,"px"):""+s;break;case"zIndex":r.style["z-index"]="".concat(n.parsedStyle.zIndex);break;case"visibility":r.style.visibility=n.parsedStyle.visibility;break;case"pointerEvents":var c=n.parsedStyle.pointerEvents;r.style.pointerEvents=void 0===c?"auto":c;break;case"opacity":r.style.opacity="".concat(n.parsedStyle.opacity);break;case"fill":var u=n.parsedStyle.fill,p="";t.isCSSRGB(u)?p=u.isNone?"transparent":n.getAttribute("fill"):Array.isArray(u)?p=n.getAttribute("fill"):t.isPattern(u),r.style.background=p;break;case"stroke":var f=n.parsedStyle.stroke,v="";t.isCSSRGB(f)?v=f.isNone?"transparent":n.getAttribute("stroke"):Array.isArray(f)?v=n.getAttribute("stroke"):t.isPattern(f),r.style["border-color"]=v,r.style["border-style"]="solid";break;case"lineWidth":r.style["border-width"]="".concat(n.parsedStyle.lineWidth||0,"px");break;case"lineDash":r.style["border-style"]="dashed";break;case"filter":r.style.filter=n.style.filter;break;default:l(n.style[e])||""===n.style[e]||(r.style[e]=n.style[e])}},e.tag="HTMLRendering",e}(),Ie=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 Re)},t.prototype.destroy=function(){this.removeAllRenderingPlugins()},t}(t.AbstractRendererPlugin),Ne=Object.freeze({__proto__:null,Plugin:Ie}),Be=function(){function e(e){this.canvasConfig=e,this.imageCache={},this.gradientCache={},this.patternCache={}}return e.prototype.getImageSync=function(e,t){return this.imageCache[e]?t&&t(this.imageCache[e]):this.getOrCreateImage(e).then((function(e){t&&t(e)})),this.imageCache[e]},e.prototype.getOrCreateImage=function(e){var n=this;if(this.imageCache[e])return Promise.resolve(this.imageCache[e]);var r=this.canvasConfig.createImage;return new Promise((function(i,a){var o;r?o=r(e):t.isBrowser&&(o=new window.Image),o&&(o.onload=function(){n.imageCache[e]=o,i(o)},o.onerror=function(e){a(e)},o.crossOrigin="Anonymous",o.src=e)}))},e.prototype.getOrCreatePatternSync=function(e,n,r,i,a,o){var s=this.generatePatternKey(e);if(s&&this.patternCache[s])return this.patternCache[s];var c,l=e.image,u=e.repetition,d=e.transform,p=!1;h(l)?c=this.getImageSync(l,o):r?(c=r,p=!0):c=l;var v,y=c&&n.createPattern(c,u);if(y){var g=void 0;d?g=t.parsedTransformToMat4(t.parseTransform(d),new t.DisplayObject({})):((v=f())[0]=1,v[1]=0,v[2]=0,v[3]=0,v[4]=0,v[5]=1,v[6]=0,v[7]=0,v[8]=0,v[9]=0,v[10]=1,v[11]=0,v[12]=0,v[13]=0,v[14]=0,v[15]=1,g=v),p&&function(e,t,n){var r=n[0],i=n[1],a=n[2];e[0]=t[0]*r,e[1]=t[1]*r,e[2]=t[2]*r,e[3]=t[3]*r,e[4]=t[4]*i,e[5]=t[5]*i,e[6]=t[6]*i,e[7]=t[7]*i,e[8]=t[8]*a,e[9]=t[9]*a,e[10]=t[10]*a,e[11]=t[11]*a,e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15]}(g,g,[1/i,1/i,1]),y.setTransform({a:g[0],b:g[1],c:g[4],d:g[5],e:g[12]+a[0],f:g[13]+a[1]})}return s&&y&&(this.patternCache[s]=y),y},e.prototype.getOrCreateGradient=function(e,n){var r=this.generateGradientKey(e),i=e.type,a=e.steps,o=e.min,s=e.width,c=e.height,l=e.cx,h=e.cy,u=e.size;if(this.gradientCache[r])return this.gradientCache[r];var d=null;if(i===t.GradientType.LinearGradient){var p=t.computeLinearGradient(o,s,c,e.angle);d=n.createLinearGradient(p.x1,p.y1,p.x2,p.y2)}else if(i===t.GradientType.RadialGradient){var f=t.computeRadialGradient(o,s,c,l,h,u),v=f.x,y=f.y;d=n.createRadialGradient(v,y,0,v,y,f.r)}return d&&(a.forEach((function(e){var n=e.offset;n.unit===t.UnitType.kPercentage&&(null==d||d.addColorStop(n.value/100,""+e.color))})),this.gradientCache[r]=d),this.gradientCache[r]},e.prototype.generateGradientKey=function(e){var t=e.min,n=e.width,r=e.height,i=e.steps,a=e.angle,o=e.cx,s=e.cy,c=e.size;return"gradient-".concat(e.type,"-").concat((null==a?void 0:""+a)||0,"-").concat((null==o?void 0:""+o)||0,"-").concat((null==s?void 0:""+s)||0,"-").concat((null==c?void 0:""+c)||0,"-").concat(t[0],"-").concat(t[1],"-").concat(n,"-").concat(r,"-").concat(i.map((function(e){var t=e.color;return"".concat(e.offset).concat(t)})).join("-"))},e.prototype.generatePatternKey=function(e){var t=e.image,n=e.repetition;return h(t)?"pattern-".concat(t,"-").concat(n):"rect"===t.nodeName?"pattern-".concat(t.entity,"-").concat(n):void 0},e}(),De=function(){function e(){}return e.prototype.apply=function(n){var r=n.renderingService,i=n.imagePool,a=n.renderingContext.root.ownerDocument.defaultView,o=function(e,t,n){var r=e.parsedStyle,i=r.width,a=r.height;i&&!a?e.setAttribute("height",n/t*i):!i&&a&&e.setAttribute("width",t/n*a)},s=function(e){var n=e.target,a=n.attributes;if(n.nodeName===t.Shape.IMAGE){var s=a.src,c=a.keepAspectRatio;h(s)&&i.getImageSync(s,(function(e){c&&o(n,e.width,e.height),n.renderable.dirty=!0,r.dirtify()}))}},c=function(e){var n=e.target,a=e.newValue;n.nodeName===t.Shape.IMAGE&&"src"===e.attrName&&h(a)&&i.getOrCreateImage(a).then((function(e){n.attributes.keepAspectRatio&&o(n,e.width,e.height),n.renderable.dirty=!0,r.dirtify()}))};r.hooks.init.tap(e.tag,(function(){a.addEventListener(t.ElementEvent.MOUNTED,s),a.addEventListener(t.ElementEvent.ATTR_MODIFIED,c)})),r.hooks.destroy.tap(e.tag,(function(){a.removeEventListener(t.ElementEvent.MOUNTED,s),a.removeEventListener(t.ElementEvent.ATTR_MODIFIED,c)}))},e.tag="LoadImage",e}(),Fe=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 Be(this.context.config),this.addRenderingPlugin(new De)},t.prototype.destroy=function(){this.removeAllRenderingPlugins()},t}(t.AbstractRendererPlugin),Ge=Object.freeze({__proto__:null,ImagePool:Be,Plugin:Fe}),je=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=h(t)?document.getElementById(t):t,this.$container)){var r=document.createElement("canvas");this.$container.appendChild(r),this.$container.style.position||(this.$container.style.position="relative"),this.$canvas=r}this.context=this.$canvas.getContext("2d"),this.resize(this.canvasConfig.width,this.canvasConfig.height)},e.prototype.getContext=function(){return this.context},e.prototype.getDomElement=function(){return this.$canvas},e.prototype.getDPR=function(){return this.dpr},e.prototype.getBoundingClientRect=function(){if(this.$canvas.getBoundingClientRect)return this.$canvas.getBoundingClientRect()},e.prototype.destroy=function(){this.$container&&this.$canvas&&this.$canvas.parentNode&&this.$container.removeChild(this.$canvas)},e.prototype.resize=function(e,n){var r=this.canvasConfig.devicePixelRatio||t.isBrowser&&window.devicePixelRatio||1;this.dpr=r=1>r?1:Math.ceil(r),this.$canvas&&(this.$canvas.width=this.dpr*e,this.$canvas.height=this.dpr*n,t.setDOMSize(this.$canvas,e,n)),this.renderingContext.renderReasons.add(t.RenderReason.CAMERA_CHANGED)},e.prototype.applyCursorStyle=function(e){this.$container&&this.$container.style&&(this.$container.style.cursor=e)},e.prototype.toDataURL=function(){return a(this,arguments,void 0,(function(e){return void 0===e&&(e={}),o(this,(function(t){return[2,this.context.canvas.toDataURL(e.type,e.encoderOptions)]}))}))},e}(),_e=function(e){function t(){var t=e.apply(this,c([],s(arguments),!1))||this;return t.name="canvas-context-register",t}return r(t,e),t.prototype.init=function(){this.context.ContextService=je},t.prototype.destroy=function(){delete this.context.ContextService},t}(t.AbstractRendererPlugin),He=function(e){function t(t){var n=e.call(this,t)||this;return n.registerPlugin(new _e),n.registerPlugin(new Fe),n.registerPlugin(new O),n.registerPlugin(new Ae),n.registerPlugin(new Le),n.registerPlugin(new le),n.registerPlugin(new Ie),n}return r(t,e),t}(t.AbstractRenderer);e.CanvasPathGenerator=L,e.CanvasPicker=he,e.CanvasRenderer=we,e.DomInteraction=ke,e.HTMLRenderer=Ne,e.ImageLoader=Ge,e.Renderer=He}));
|
|
2
2
|
//# sourceMappingURL=index.umd.min.js.map
|