@antv/g-canvas 2.0.35 → 2.0.36

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