You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

45 lines
70 KiB

4 months ago
/*!
* @antv/g-canvas
* @description A renderer implemented by Canvas 2D API
* @version 2.0.48
* @date 7/30/2025, 1:38:18 PM
* @author AntVis
* @docs https://g.antv.antgroup.com/
*/
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@antv/g-lite")):"function"==typeof define&&define.amd?define(["exports","@antv/g-lite"],t):t(((e="undefined"!=typeof globalThis?globalThis:e||self).G=e.G||{},e.G.Canvas2D={}),e.window.G)}(this,function(e,t){"use strict";function n(e){return n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},n(e)}function r(e){var t=function(e,t){if("object"!=n(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var a=r.call(e,t||"default");if("object"!=n(a))return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==n(t)?t:t+""}function a(e,t){for(var n=0;t.length>n;n++){var a=t[n];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,r(a.key),a)}}function i(e,t,n){return t&&a(e.prototype,t),n&&a(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function l(e){return l=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},l(e)}function s(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(s=function(){return!!e})()}function c(e,t){if(t&&("object"==n(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}function u(e,t,n){return t=l(t),c(e,s()?Reflect.construct(t,n||[],l(e).constructor):t.apply(e,n))}function h(e,t){return h=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},h(e,t)}function f(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&h(e,t)}function d(e,t,n){return(t=r(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function v(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);t>n;n++)r[n]=e[n];return r}function p(e,t){if(e){if("string"==typeof e)return v(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?v(e,t):void 0}}function y(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,a,i,o,l=[],s=!0,c=!1;try{if(i=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;s=!1}else for(;!(s=(r=i.call(n)).done)&&(l.push(r.value),l.length!==t);s=!0);}catch(e){c=!0,a=e}finally{try{if(!s&&null!=n.return&&(o=n.return(),Object(o)!==o))return}finally{if(c)throw a}}return l}}(e,t)||p(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function m(e){return null==e}function g(e){return"string"==typeof e}var b=function(e,t,n){return t>e?t:e>n?n:e};function S(e){return"number"==typeof e}var x="undefined"!=typeof Float32Array?Float32Array:Array;function k(){var e=new x(16);return x!=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 w(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 E(e,t,n){var r=t[0],a=t[1],i=t[2],o=t[3],l=t[4],s=t[5],c=t[6
/*!
* @antv/g-plugin-canvas-path-generator
* @description A G plugin of path generator with Canvas2D API
* @version 2.1.22
* @date 7/30/2025, 1:35:25 PM
* @author AntVis
* @docs https://g.antv.antgroup.com/
*/function R(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 L(e,t){var n=t.cx,r=void 0===n?0:n,a=t.cy,i=void 0===a?0:a,o=t.rx,l=t.ry;if(e.ellipse)e.ellipse(r,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(r,i,s,0,2*Math.PI)}}function I(e,n){var r=n.x1,a=n.y1,i=n.x2,o=n.y2,l=n.markerStart,s=n.markerEnd,c=n.markerStartOffset,u=n.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-r))*(c||0),f=Math.sin(p)*(c||0)),s&&t.isDisplayObject(s)&&u&&(d=Math.cos(p=Math.atan2(a-o,r-i))*(u||0),v=Math.sin(p)*(u||0)),e.moveTo(r+h,a+f),e.lineTo(i+d,o+v)}function D(e,n){var r=n.markerStart,a=n.markerEnd,i=n.markerStartOffset,o=n.markerEndOffset,l=n.d,s=l.absolutePath,c=l.segments,u=0,h=0,f=0,d=0,v=0;if(r&&t.isDisplayObject(r)&&i){var p=y(r.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),S=b[0],x=b[1];f=Math.cos(v=Math.atan2(S[1]-x[1],S[0]-x[0]))*(o||0),d=Math.sin(v)*(o||0)}for(var k=0;s.length>k;k++){var w=s[k],E=w[0],M=s[k+1],O=(k===s.length-1||M&&("M"===M[0]||"Z"===M[0]))&&0!==f&&0!==d,C=y(0===k&&(0!==u||0!==h)?[u,h]:[0,0],2),T=C[0],A=C[1],P=y(O?[f,d]:[0,0],2),R=P[0],L=P[1];switch(E){case"M":e.moveTo(w[1]+T,w[2]+A);break;case"L":e.lineTo(w[1]+R,w[2]+L);break;case"Q":e.quadraticCurveTo(w[1],w[2],w[3]+R,w[4]+L);break;case"C":e.bezierCurveTo(w[1],w[2],w[3],w[4],w[5]+R,w[6]+L);break;case"A":var I=c[k].arcParams,D=I.cx,N=I.cy,j=I.rx,F=I.ry,B=I.startAngle,G=I.endAngle,_=I.xRotation,W=I.sweepFlag;if(e.ellipse)e.ellipse(D,N,j,F,_,B,G,!!(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(_),e.scale(z,$),e.arc(0,0,H,B,G,!!(1-W)),e.scale(1/z,1/$),e.rotate(-_),e.translate(-D,-N)}O&&e.lineTo(w[6]+f,w[7]+d);break;case"Z":e.closePath()}}}function N(e,n){var r=n.markerStart,a=n.markerEnd,i=n.markerStartOffset,o=n.markerEndOffset,l=n.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;r&&t.isDisplayObject(r)&&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,n){var r=n.markerStart,a=n.markerEnd,i=n.markerStartOffset,o=n.markerEndOffset,l=n.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;r&&t.isDisplayObject(r)&&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 n=t.x,r=void 0===n?0:n,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],S=v[3];e.moveTo(h*p+r,i),e.lineTo(c-h*m+r,i),0!==m&&e.arc(c-h*m+r,f*m+i,m,-f*Math.PI/2,h>0?0:Math.PI,d),e.lineTo(c+r,u-f*g+i),0!==g&&e.arc(c-h*g+r,u-f*g+i,g,h>0?0:Math.PI,f>0?Math.PI/2:1.5*Math.PI,d),e.lineTo(h*S+r,u+i),0!==S&&e.arc(h*S+r,u-f*S+i,S,f>0?Math.PI/2:-Math.PI/2,h>0?Math.PI:0,d),e.lineTo(r,f*p+i),0!==p&&e.arc(h*p+r,f*p+i,p,h>0?Math.PI:0,f>0?1.5*Math.PI:Math.PI/2,d)}else e.rect(r,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)}),O(),function(){var e,t=(e=new x(2),x!=Float32Array&&(e[0]=0,e[1]=0),e)}();var B=function(e){function n(){var e;o(this,n);for(var t=arguments.length,r=Array(t),a=0;t>a;a++)r[a]=arguments[a];return(e=u(this,n,[].concat(r))).name="canvas-path-generator",e}return f(n,e),i(n,[{key:"init",value:function(){var e,n=(d(d(d(d(d(d(
/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */
var e,t,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",a=n.toStringTag||"@@toStringTag";function i(n,r,a,i){var s=Object.create((r&&r.prototype instanceof l?r:l).prototype);return W(s,"_invoke",function(n,r,a){var i,l,s,c=0,u=a||[],h=!1,f={p:0,n:0,v:e,a:d,f:d.bind(e,4),d:function(t,n){return i=t,l=0,s=e,f.n=n,o}};function d(n,r){for(l=n,s=r,t=0;!h&&c&&!a&&u.length>t;t++){var a,i=u[t],d=f.p,v=i[2];n>3?(a=v===r)&&(s=i[(l=i[4])?5:(l=3,3)],i[4]=i[5]=e):d>=i[0]&&((a=2>n&&i[1]>d)?(l=0,f.v=r,f.n=i[1]):v>d&&(a=3>n||i[0]>r||r>v)&&(i[4]=n,i[5]=r,f.n=v,l=0))}if(a||n>1)return o;throw h=!0,r}return function(a,u,v){if(c>1)throw TypeError("Generator is already running");for(h&&1===u&&d(u,v),l=u,s=v;(t=2>l?e:s)||!h;){i||(l?3>l?(l>1&&(f.n=-1),d(l,s)):f.n=s:f.v=s);try{if(c=2,i){if(l||(a="next"),t=i[a]){if(!(t=t.call(i,s)))throw TypeError("iterator result is not an object");if(!t.done)return t;s=t.value,2>l&&(l=0)}else 1===l&&(t=i.return)&&t.call(i),2>l&&(s=TypeError("The iterator does not provide a '"+a+"' method"),l=1);i=e}else if((t=(h=0>f.n)?s:n.call(r,f))!==o)break}catch(t){i=e,l=1,s=t}finally{c=1}}return{value:t,done:h}}}(n,a,i),!0),s}var o={};function l(){}function s(){}function c(){}t=Object.getPrototypeOf;var u=[][r]?t(t([][r]())):(W(t={},r,function(){return this}),t),h=c.prototype=l.prototype=Object.create(u);function f(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,c):(e.__proto__=c,W(e,a,"GeneratorFunction")),e.prototype=Object.create(h),e}return s.prototype=c,W(h,"constructor",c),W(c,"constructor",s),s.displayName="GeneratorFunction",W(c,a,"GeneratorFunction"),W(h),W(h,a,"Generator"),W(h,r,function(){return this}),W(h,"toString",function(){return"[object Generator]"}),(H=function(){return{w:i,m:f}})()}function z(e,t){function n(r,a,i,o){try{var l=e[r](a),s=l.value;return s instanceof _?t.resolve(s.v).then(function(e){n("next",e,i,o)},function(e){n("throw",e,i,o)}):t.resolve(s).then(function(e){l.value=e,i(l)},function(e){return n("throw",e,i,o)})}catch(e){o(e)}}var r;this.next||(W(z.prototype),W(z.prototype,"function"==typeof Symbol&&Symbol.asyncIterator||"@asyncIterator",function(){return this})),W(this,"_invoke",function(e,a,i){function o(){return new t(function(t,r){n(e,i,t,r)})}return r=r?r.then(o,o):o()},!0)}function $(e,t,n,r,a){return new z(H().w(e,t,n,r),a||Promise)}function U(e,t,n,r,a){var i=$(e,t,n,r,a);return i.next().then(function(e){return e.done?e.value:i.next()})}function Y(e){var t=Object(e),n=[];for(var r in t)n.unshift(r);return function e(){for(;n.length;)if((r=n.pop())in t)return e.value=r,e.done=!1,e;return e.done=!0,e}}function V(e){if(null!=e){var t=e["function"==typeof Symbol&&Symbol.iterator||"@@iterator"],r=0;if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length))return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}}}throw new TypeError(n(e)+" is not iterable")}function X(){var e=H(),t=e.m(X),n=(Object.getPrototypeOf?Object.getPrototypeOf(t):t.__proto__).constructor;function r(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===n||"GeneratorFunction"===(t.displayName||t.name))}var a={throw:1,return:2,break:3,continue:3};function i(e){var t,n;return function(r){t||(t={stop:function(){return n(r.a,2)},catch:function(){return r.v},abrupt:function(e,t){return n(r.a,a[e],t)},delegateYield:function(e,a,i){return t.resultName=a,n(r.d,V(e),i)},finish:function(e){return n(r.f,e)}},n=function(e,n,a){r.p=t.prev,r.n=t.next;try{return e(n,a)}finally{t.next=r.n}}),t.resultName&&(t[t.resultName]=r.v,t.resultName=void 0),t.sent=r.v,t.next=r.n;try{return e.call(this,t)}finally{r.p=t.prev,r.n=t.next}}}return(X=function(){return{wrap:function(t,n,r,a){return e.w(i(t),n,r,a&&a.reverse())},isGeneratorFunction:r,mark:e.m,awrap:function(e,t){return new _(e,t)},AsyncIterator:z,async:function(e,t,n,a,o){return(r(t)?$:U)(i(e),t,n,a,o)},keys:Y,values:V}})()}function q(e,t,n,r,a,i,o){try{var l=e[i](o),s=l.value}catch(e){return void n(e)}l.done?t(s):Promise.resolve(s).then(r,a)}function Q(e){return function(){var t=this,n=arguments;return
/*!
* @antv/g-math
* @description Geometry util
* @version 3.0.1
* @date 7/30/2025, 1:34:14 PM
* @author AntVis
* @docs https://g.antv.antgroup.com/
*/function J(e,t,n,r){var a=e-n,i=t-r;return Math.sqrt(a*a+i*i)}function K(e,t,n,r,a,i){var o=-1,l=1/0,s=[n,r],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=J(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,S=[a.apply(void 0,Z(e.concat([g]))),a.apply(void 0,Z(t.concat([g])))],x=J(s[0],s[1],S[0],S[1]);if(g>=0&&l>x)o=g,l=x;else{var k=[a.apply(void 0,Z(e.concat([b]))),a.apply(void 0,Z(t.concat([b])))],w=J(s[0],s[1],k[0],k[1]);1>=b&&l>w?(o=b,l=w):h*=.5}}return{x:a.apply(void 0,Z(e.concat([o]))),y:a.apply(void 0,Z(t.concat([o])))}}function ee(e,t,n,r,a,i){var o=[n-e,r-t];if(function(e,t){return e[0]===t[0]&&e[1]===t[1]}(o,[0,0]))return Math.sqrt((a-e)*(a-e)+(i-t)*(i-t));var l=[-o[1],o[0]];return function(e,t){var n=t[0],r=t[1],a=n*n+r*r;a>0&&(a=1/Math.sqrt(a)),e[0]=t[0]*a,e[1]=t[1]*a}(l,l),Math.abs(function(e,t){return e[0]*t[0]+e[1]*t[1]}([a-e,i-t],l))}function te(e,t,n,r,a){var i=1-a;return i*i*i*e+3*t*a*i*i+3*n*a*a*i+r*a*a*a}function ne(e,t,n,r,a,i,o,l,s,c,u){var h=function(e,t,n,r,a,i,o,l,s,c,u){return K([e,n,a,o],[t,r,i,l],s,c,te,u)}(e,t,n,r,a,i,o,l,s,c,u);return J(h.x,h.y,s,c)}function re(e,t,n,r){var a=1-r;return a*a*e+2*r*a*t+r*r*n}function ae(e,t,n,r,a,i,o,l){var s=function(e,t,n,r,a,i,o,l){return K([e,n,a],[t,r,i],o,l,re)}(e,t,n,r,a,i,o,l);return J(s.x,s.y,o,l)}function ie(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function oe(e){for(var t=1;arguments.length>t;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?ie(Object(n),!0).forEach(function(t){d(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):ie(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}
/*!
* @antv/g-plugin-canvas-picker
* @description A G plugin for picking in canvas
* @version 2.1.27
* @date 7/30/2025, 1:37:32 PM
* @author AntVis
* @docs https://g.antv.antgroup.com/
*/var le=O(),se=O(),ce=O(),ue=k(),he=function(){function e(){var n=this;o(this,e),this.isHit=function(e,r,a,i){var o,l,s,c,u,h,f,d,v,p,y,m,g,b,S,x,k,w,E,M,O,A,P,R,L,I,D,N,j,F,B,G=n.context.pointInPathPickerFactory[e.nodeName];if(G){var _=(o=ue,(B=(E=(s=(l=a)[0])*(d=l[5])-(c=l[1])*(f=l[4]))*(F=(g=l[10])*(w=l[15])-(b=l[11])*(k=l[14]))-(M=s*(v=l[6])-(u=l[2])*f)*(j=(m=l[9])*w-b*(x=l[13]))+(O=s*(p=l[7])-(h=l[3])*f)*(N=m*k-g*x)+(A=c*v-u*d)*(D=(y=l[8])*w-b*(S=l[12]))-(P=c*p-h*d)*(I=y*k-g*S)+(R=u*p-h*v)*(L=y*x-m*S))?(o[0]=(d*F-v*j+p*N)*(B=1/B),o[1]=(u*j-c*F-h*N)*B,o[2]=(x*R-k*P+w*A)*B,o[3]=(g*P-m*R-b*A)*B,o[4]=(v*D-f*F-p*I)*B,o[5]=(s*F-u*D+h*I)*B,o[6]=(k*O-S*R-w*M)*B,o[7]=(y*R-g*O+b*M)*B,o[8]=(f*j-d*D+p*L)*B,o[9]=(c*D-s*j-h*L)*B,o[10]=(S*P-x*O+w*E)*B,o[11]=(m*O-y*P-b*E)*B,o[12]=(d*I-f*N-v*L)*B,o[13]=(s*N-c*I+u*L)*B,o[14]=(x*M-S*A-k*E)*B,o[15]=(y*A-m*M+g*E)*B,o):null),W=T(se,C(ce,r[0],r[1],0),_);if(G(e,new t.Point(W[0],W[1]),i,n.isPointInPath,n.context,n.runtime))return!0}return!1},this.isPointInPath=function(e,t){var r=n.runtime.offscreenCanvasCreator.getOrCreateContext(n.context.config.offscreenCanvas),a=n.context.pathGeneratorFactory[e.nodeName];return a&&(r.beginPath(),a(r,e.parsedStyle),r.closePath()),r.isPointInPath(t.x,t.y)}}return i(e,[{key:"apply",value:function(t,n){var r,a=this,i=t.renderingService,o=t.renderingContext;this.context=t,this.runtime=n;var l=null===(r=o.root)||void 0===r?void 0:r.ownerDocument;i.hooks.pick.tapPromise(e.tag,function(){var e=Q(X().mark(function e(t){return X().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,n){var r,a=n.topmost,i=n.position,o=C(le,i.x,i.y,0),l=[],s=function(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=p(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0,a=function(){};return{s:a,n:function(){return e.length>r?{done:!1,value:e[r++]}:{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(){n=n.call(e)},n:function(){var e=n.next();return o=e.done,e},e:function(e){l=!0,i=e},f:function(){try{o||null==n.return||n.return()}finally{if(l)throw i}}}}(e.elementsFromBBox(o[0],o[1],o[0],o[1]));try{for(s.s();!(r=s.n()).done;){var c=r.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 n.picked=[c],n;l.push(c)}}else{if(a)return n.picked=[c],n;l.push(c)}}}}catch(e){s.e(e)}finally{s.f()}return n.picked=l,n}}])}();function fe(e,n,r){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=J(void 0===i?0:i,void 0===o?0:o,n.x,n.y),m=y(t.isFillOrStrokeAffected(d,s,c),2),g=m[0],b=m[1];return g&&b||r?l+v>=p:g?l>=p:!!b&&(p>=l-v&&l+v>=p)}function de(e,t,n,r){return e/(n*n)+t/(r*r)}function ve(e,n,r){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=n.x,g=n.y,b=y(t.isFillOrStrokeAffected(void 0===p?"auto":p,a.fill,a.stroke),2),S=b[0],x=b[1],k=(f+v)/2,w=(m-o)*(m-o),E=(g-s)*(g-s);return S&&x||r?1>=de(w,E,c+k,u+k):S?1>=de(w,E,c,u):!!x&&(de(w,E,c-k,u-k)>=1&&1>=de(w,E,c+k,u+k))}function pe(e,t,n,r,a,i){return!(e>a||a>e+n||t>i||i>t+r)}function ye(e,t,n,r,a,i,o,l){var s=(Math.atan2(l-t,o-e)+2*Math.PI)%(2*Math.PI),c={x:e+n*Math.cos(s),y:t+n*Math.sin(s)};return J(c.x,c.y,o,l)<=i/2}function me(e,t,n,r,a,i,o){var l=a/2;return!(Math.min(e,n)-l>i||i>Math.max(e,n)+l||Math.min(t,r)-l>o||o>Math.max(t,r)+l)&&ee(e,t,n,r,i,o)<=a/2}function ge(e,t,n,r,a){var i
/*!
* @antv/g-plugin-image-loader
* @description A G plugin for loading image
* @version 2.1.26
* @date 7/30/2025, 1:35:52 PM
* @author AntVis
* @docs https://g.antv.antgroup.com/
*/var Ne=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,n){return!this.cacheStore.has(e)&&(this.cacheStore.set(e,{value:t,counter:new Set([n.entity])}),this.onRefAdded(n),!0)}},{key:"get",value:function(e,t){var n=this.cacheStore.get(e);return n?(n.counter.has(t.entity)||(n.counter.add(t.entity),this.onRefAdded(t)),n.value):null}},{key:"update",value:function(e,t,n){var r=this.cacheStore.get(e);return!!r&&(r.value=oe(oe({},r.value),t),r.counter.has(n.entity)||(r.counter.add(n.entity),this.onRefAdded(n)),!0)}},{key:"release",value:function(e,t){var n=this.cacheStore.get(e);return!!n&&(n.counter.delete(t.entity),n.counter.size>0||this.cacheStore.delete(e),!0)}},{key:"releaseRef",value:function(e){var t=this;Array.from(this.cacheStore.keys()).forEach(function(n){t.release(n,e)})}},{key:"getSize",value:function(){return this.cacheStore.size}},{key:"clear",value:function(){this.cacheStore.clear()}}])}(),je=[],Fe=[],Be=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;(je.length>0||Fe.length>0)&&(Fe.forEach(function(e){return e()}),Fe=je.splice(0,e.TASK_NUM_PER_FRAME),e.rafId=t.requestAnimationFrame(function(){e.executeTask(t)}))}},{key:"sliceImage",value:function(t,n,r,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=n-i,u=r-i,h=Math.ceil(l/c),f=Math.ceil(s/u),d={tileSize:[n,r],gridSize:[f,h],tiles:Array(f).fill(null).map(function(){return Array(h).fill(null)})},v=function(e){for(var i=function(i){je.push(function(){var h=i*c,f=e*u,v=[Math.min(n,l-h),Math.min(r,s-f)],p=v[0],y=v[1],m=o.createCanvas();m.width=n,m.height=r,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}}])}();Be.TASK_NUM_PER_FRAME=10;var Ge=new Ne;Ge.onRefAdded=function(e){var n=this;e.addEventListener(t.ElementEvent.DESTROY,function(){n.releaseRef(e)},{once:!0})};var _e=function(){return i(function e(t,n){o(this,e),this.gradientCache={},this.patternCache={},this.context=t,this.runtime=n},[{key:"getImageSync",value:function(e,t,n){var r=g(e)?e:e.src;if(Ge.has(r)){var a=Ge.get(r,t);if(a.img.complete)return null==n||n(a),a}return this.getOrCreateImage(e,t).then(function(e){null==n||n(e)}).catch(function(e){console.error(e)}),null}},{key:"getOrCreateImage",value:function(e,t){var n=this,r=g(e)?e:e.src;if(!g(e)&&!Ge.has(r)){var a={img:e,size:[e.naturalWidth||e.width,e.naturalHeight||e.height],tileSize:We(e)};Ge.put(r,a,t)}if(Ge.has(r)){var i=Ge.get(r,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=We(i.img),e(i)}),i.img.addEventListener("error",function(e){t(e)})})}return new Promise(function(e,a){var i=n.context.config.createImage();if(i){var o={img:i,size:[0,0],tileSize:We(i)};Ge.put(r,o,t),i.onload=function(){o.size=[i.naturalWidth||i.width,i.naturalHeight||i.height],o.tileSize=We(o.img),e(o)},i.onerror=function(e){a(e)},i.crossOrigin="Anonymous",i.src=r}})}},{key:"createDownSampledImage",value:(n=Q(X().mark(function e(t,n){var r,a,i,o,l,s,c,u,h,f,d,v,p,m;return X().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=1,this.getOrCreateImage(t,n);case 1:if(void 0===(r=e.sent).downSamplingRate){e.next=2;break}return e.abrupt("return",r);case 2: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.cre
//# sourceMappingURL=index.umd.min.js.map