@antv/g-canvas
Advanced tools
| /*! | ||
| * @antv/g-canvas | ||
| * @description A renderer implemented by Canvas 2D API | ||
| * @version 2.1.0 | ||
| * @date 12/22/2025, 3:03:16 AM | ||
| * @version 2.2.0 | ||
| * @date 12/24/2025, 11:55:53 AM | ||
| * @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 r(e){return r="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},r(e)}function n(e){var t=function(e,t){if("object"!=r(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var i=n.call(e,t||"default");if("object"!=r(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==r(t)?t:t+""}function i(e,t){for(var r=0;t.length>r;r++){var i=t[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,n(i.key),i)}}function a(e,t,r){return t&&i(e.prototype,t),r&&i(e,r),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 c(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(c=function(){return!!e})()}function s(e,t){if(t&&("object"==r(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,r){return t=l(t),s(e,c()?Reflect.construct(t,r||[],l(e).constructor):t.apply(e,r))}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,r){return(t=n(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function v(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 p(e){for(var t=1;arguments.length>t;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?v(Object(r),!0).forEach(function(t){d(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):v(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}function y(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);t>r;r++)n[r]=e[r];return n}function g(e,t){if(e){if("string"==typeof e)return y(e,t);var r={}.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?y(e,t):void 0}}function m(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,i,a,o,l=[],c=!0,s=!1;try{if(a=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;c=!1}else for(;!(c=(n=a.call(r)).done)&&(l.push(n.value),l.length!==t);c=!0);}catch(e){s=!0,i=e}finally{try{if(!c&&null!=r.return&&(o=r.return(),Object(o)!==o))return}finally{if(s)throw i}}return l}}(e,t)||g(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 b(e){return function(e){if(Array.isArray(e))return y(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||g(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.")}()}function x(e,t){if(!{}.hasOwnProperty.call(e,t))throw new TypeError("attempted to use private field on non-instance");return e}var S=0;function w(e){return"__private_"+S+++"_"+e}var M="undefined"!=typeof Float32Array?Float32Array:Array;function k(){var e=new M(16);return M!=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 O(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 C(e,t,r){var n=t[0],i=t[1],a=t[2],o=t[3],l=t[4],c=t[5],s=t[6],u=t[7],h=t[8],f=t[9],d=t[10],v=t[11],p=t[12],y=t[13],g=t[14],m=t[15],b=r[0],x=r[1],S=r[2],w=r[3];return e[0]=b*n+x*l+S*h+w*p,e[1]=b*i+x*c+S*f+w*y,e[2]=b*a+x*s+S*d+w*g,e[3]=b*o+x*u+S*v+w*m,e[4]=(b=r[4])*n+(x=r[5])*l+(S=r[6])*h+(w=r[7])*p,e[5]=b*i+x*c+S*f+w*y,e[6]=b*a+x*s+S*d+w*g,e[7]=b*o+x*u+S*v+w*m,e[8]=(b=r[8])*n+(x=r[9])*l+(S=r[10])*h+(w=r[11])*p,e[9]=b*i+x*c+S*f+w*y,e[10]=b*a+x*s+S*d+w*g,e[11]=b*o+x*u+S*v+w*m,e[12]=(b=r[12])*n+(x=r[13])*l+(S=r[14])*h+(w=r[15])*p,e[13]=b*i+x*c+S*f+w*y,e[14]=b*a+x*s+S*d+w*g,e[15]=b*o+x*u+S*v+w*m,e}function P(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]}function T(){var e=new M(3);return M!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0),e}function A(e,t,r,n){return e[0]=t,e[1]=r,e[2]=n,e}function E(e,t,r){var n=t[0],i=t[1],a=t[2],o=r[3]*n+r[7]*i+r[11]*a+r[15];return e[0]=(r[0]*n+r[4]*i+r[8]*a+r[12])/(o=o||1),e[1]=(r[1]*n+r[5]*i+r[9]*a+r[13])/o,e[2]=(r[2]*n+r[6]*i+r[10]*a+r[14])/o,e}function R(e){return null==e}T(),function(){var e,t=(e=new M(2),M!=Float32Array&&(e[0]=0,e[1]=0),e)}();var D=function(e,t,r){return t>e?t:e>r?r:e};function L(e,t,r){return{x:e*Math.cos(r)-t*Math.sin(r),y:e*Math.sin(r)+t*Math.cos(r)}}function I(e,t,r,n,i,a,o,l,c,s){var u,h,f,d,v,p=e,y=t,g=r,m=n,b=l,x=c,S=120*Math.PI/180,w=Math.PI/180*(+i||0),M=[];if(s)h=s[0],f=s[1],d=s[2],v=s[3];else{y=(u=L(p,y,-w)).y;var k=((p=u.x)-(b=(u=L(b,x,-w)).x))/2,O=(y-(x=u.y))/2,C=k*k/(g*g)+O*O/(m*m);C>1&&(g*=C=Math.sqrt(C),m*=C);var P=g*g,T=m*m,A=(a===o?-1:1)*Math.sqrt(Math.abs((P*T-P*O*O-T*k*k)/(P*O*O+T*k*k)));d=A*g*O/m+(p+b)/2,h=Math.asin(((y-(v=A*-m*k/g+(y+x)/2))/m*1e9|0)/1e9),f=Math.asin(((x-v)/m*1e9|0)/1e9),0>(h=d>p?Math.PI-h:h)&&(h=2*Math.PI+h),0>(f=d>b?Math.PI-f:f)&&(f=2*Math.PI+f),o&&h>f&&(h-=2*Math.PI),!o&&f>h&&(f-=2*Math.PI)}var E=f-h;if(Math.abs(E)>S){var R=f,D=b,j=x;M=I(b=d+g*Math.cos(f=h+S*(o&&f>h?1:-1)),x=v+m*Math.sin(f),g,m,i,0,o,D,j,[f,R,d,v])}E=f-h;var F=Math.cos(h),B=Math.sin(h),N=Math.cos(f),G=Math.sin(f),W=Math.tan(E/4),_=4/3*g*W,H=4/3*m*W,$=[p,y],Y=[p+_*B,y-H*F],z=[b+_*G,x-H*N],X=[b,x];if(Y[0]=2*$[0]-Y[0],Y[1]=2*$[1]-Y[1],s)return Y.concat(z,X,M);for(var U=[],q=0,V=(M=Y.concat(z,X,M)).length;V>q;q+=1)U[q]=q%2?L(M[q-1],M[q],w).y:L(M[q],M[q+1],w).x;return U}var j=w("renderState"),F=function(){function e(t){o(this,e),this.removedRBushNodeAABBs=[],this.renderQueue=[],Object.defineProperty(this,j,{writable:!0,value:{restoreStack:[],prevObject:null,currentContext:new Map}}),this.clearFullScreenLastFrame=!1,this.clearFullScreen=!1,this.vpMatrix=k(),this.dprMatrix=k(),this.tmpMat4=k(),this.vec3a=T(),this.vec3b=T(),this.vec3c=T(),this.vec3d=T(),this.canvasRendererPluginOptions=t}return a(e,[{key:"apply",value:function(r,n){var i=this;this.context=r;var a=this.context,o=a.config,l=a.camera,c=a.renderingService,s=a.renderingContext,u=a.rBushRoot,h=a.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=s.root.ownerDocument.defaultView,p=function(e){var t=e.target.rBushNode;null!=t&&t.aabb&&i.removedRBushNodeAABBs.push(t.aabb)},y=function(e){var t=e.target.rBushNode;t.aabb&&i.removedRBushNodeAABBs.push(t.aabb)};c.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,a=d.getContext();i.clearRect(a,0,0,r*e,n*e,o.background)}),c.hooks.destroy.tap(e.tag,function(){v.removeEventListener(t.ElementEvent.UNMOUNTED,p),v.removeEventListener(t.ElementEvent.CULLED,y),i.renderQueue=[],i.removedRBushNodeAABBs=[],x(i,j)[j]={restoreStack:[],prevObject:null,currentContext:null}});var g=function(e,t){for(var r=[e];r.length>0;){var a,o=r.pop();o.isVisible()&&!o.isCulled()&&(f?i.renderDisplayObjectOptimized(o,t,i.context,x(i,j)[j],n):i.renderDisplayObject(o,t,i.context,x(i,j)[j],n));for(var l=(null===(a=o.sortable)||void 0===a||null===(a=a.sorted)||void 0===a?void 0:a.length)>0?o.sortable.sorted:o.childNodes,c=l.length-1;c>=0;c--)r.push(l[c])}};c.hooks.endFrame.tap(e.tag,function(){if(function(){var e,t=d.getContext(),r=d.getDPR(),n=o.width,a=o.height,l=i.canvasRendererPluginOptions,s=l.dirtyObjectNumThreshold,u=l.dirtyObjectRatioThreshold,h=c.getStats(),f=h.rendered,p=f/h.total;i.clearFullScreen=i.clearFullScreenLastFrame||!(null!==(e=v.context.renderingPlugins[1])&&void 0!==e&&e.isFirstTimeRenderingFinished)||c.disableDirtyRectangleRendering()||f>s&&p>u,t&&("function"==typeof t.resetTransform?t.resetTransform():t.setTransform(1,0,0,1,0,0),i.clearFullScreen&&i.clearRect(t,0,0,n*r,a*r,o.background))}(),0!==s.root.childNodes.length){f=o.renderer.getConfig().enableRenderingOptimization,x(i,j)[j]={restoreStack:[],prevObject:null,currentContext:x(i,j)[j].currentContext},x(i,j)[j].currentContext.clear(),i.clearFullScreenLastFrame=!1;var e,r,a=d.getContext(),u=d.getDPR();if((e=i.dprMatrix)[0]=(r=[u,u,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,C(i.vpMatrix,i.dprMatrix,l.getOrthoMatrix()),i.clearFullScreen)f?(a.save(),g(s.root,a),a.restore()):g(s.root,a),i.removedRBushNodeAABBs=[];else{var h=i.safeMergeAABB.apply(i,[i.mergeDirtyAABBs(i.renderQueue)].concat(b(i.removedRBushNodeAABBs.map(function(e){var r=e.minX,n=e.minY,i=e.maxX,a=e.maxY,o=new t.AABB;return o.setMinMax([r,n,0],[i,a,0]),o}))));if(i.removedRBushNodeAABBs=[],t.AABB.isEmpty(h))return void(i.renderQueue=[]);var p=i.convertAABB2Rect(h),y=p.x,m=p.y,S=p.width,w=p.height,M=E(i.vec3a,[y,m,0],i.vpMatrix),k=E(i.vec3b,[y+S,m,0],i.vpMatrix),O=E(i.vec3c,[y,m+w,0],i.vpMatrix),P=E(i.vec3d,[y+S,m+w,0],i.vpMatrix),T=Math.min(M[0],k[0],P[0],O[0]),A=Math.min(M[1],k[1],P[1],O[1]),R=Math.max(M[0],k[0],P[0],O[0]),D=Math.max(M[1],k[1],P[1],O[1]),L=Math.floor(T),I=Math.floor(A),F=Math.ceil(R-T),B=Math.ceil(D-A);a.save(),i.clearRect(a,L,I,F,B,o.background),a.beginPath(),a.rect(L,I,F,B),a.clip(),a.setTransform(i.vpMatrix[0],i.vpMatrix[1],i.vpMatrix[4],i.vpMatrix[5],i.vpMatrix[12],i.vpMatrix[13]),o.renderer.getConfig().enableDirtyRectangleRenderingDebug&&v.dispatchEvent(new t.CustomEvent(t.CanvasEvent.DIRTY_RECTANGLE,{dirtyRect:{x:L,y:I,width:F,height:B}})),i.searchDirtyObjects(h).sort(function(e,t){return e.sortable.renderOrder-t.sortable.renderOrder}).forEach(function(e){e&&e.isVisible()&&!e.isCulled()&&i.renderDisplayObject(e,a,i.context,x(i,j)[j],n)}),a.restore(),i.renderQueue.forEach(function(e){i.saveDirtyAABB(e)}),i.renderQueue=[]}x(i,j)[j].restoreStack.forEach(function(){a.restore()}),x(i,j)[j].restoreStack=[]}else i.clearFullScreenLastFrame=!0}),c.hooks.render.tap(e.tag,function(e){i.clearFullScreen||i.renderQueue.push(e)})}},{key:"clearRect",value:function(e,t,r,n,i,a){e.clearRect(t,r,n,i),a&&(e.fillStyle=a,e.fillRect(t,r,n,i))}},{key:"renderDisplayObjectOptimized",value:function(e,r,n,i,a){var o=e.nodeName,l=!1,c=this.context.styleRendererFactory[o],s=this.pathGeneratorFactory[o],u=e.parsedStyle.clipPath;if(u){(!i.prevObject||!P(u.getWorldTransform(),i.prevObject.getWorldTransform()))&&(this.applyWorldTransform(r,u),i.prevObject=null);var h=this.pathGeneratorFactory[u.nodeName];h&&(r.save(),l=!0,r.beginPath(),h(r,u.parsedStyle),r.closePath(),r.clip())}if(c){(!i.prevObject||!P(e.getWorldTransform(),i.prevObject.getWorldTransform()))&&this.applyWorldTransform(r,e);var f=!i.prevObject;if(!f){var d=i.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}c.applyStyleToContext(r,e,f,i),i.prevObject=e}s&&(r.beginPath(),s(r,e.parsedStyle),o!==t.Shape.LINE&&o!==t.Shape.PATH&&o!==t.Shape.POLYLINE&&r.closePath()),c&&c.drawToContext(r,e,x(this,j)[j],this,a),l&&r.restore(),e.dirty(!1)}},{key:"renderDisplayObject",value:function(e,r,n,i,a){var o=e.nodeName,l=i.restoreStack[i.restoreStack.length-1];!l||e.compareDocumentPosition(l)&t.Node.DOCUMENT_POSITION_CONTAINS||(r.restore(),i.restoreStack.pop());var c=this.context.styleRendererFactory[o],s=this.pathGeneratorFactory[o],u=e.parsedStyle.clipPath;if(u){this.applyWorldTransform(r,u);var h=this.pathGeneratorFactory[u.nodeName];h&&(r.save(),i.restoreStack.push(e),r.beginPath(),h(r,u.parsedStyle),r.closePath(),r.clip())}c&&(this.applyWorldTransform(r,e),r.save(),this.applyAttributesToContext(r,e)),s&&(r.beginPath(),s(r,e.parsedStyle),o!==t.Shape.LINE&&o!==t.Shape.PATH&&o!==t.Shape.POLYLINE&&r.closePath()),c&&(c.render(r,e.parsedStyle,e,n,this,a),r.restore()),e.dirty(!1)}},{key:"applyAttributesToContext",value:function(e,t){var r=t.parsedStyle,n=r.stroke,i=r.fill,a=r.opacity,o=r.lineDash,l=r.lineDashOffset;o&&e.setLineDash(o),R(l)||(e.lineDashOffset=l),R(a)||(e.globalAlpha*=a),R(n)||Array.isArray(n)||n.isNone||(e.strokeStyle=t.attributes.stroke),R(i)||Array.isArray(i)||i.isNone||(e.fillStyle=t.attributes.fill)}},{key:"convertAABB2Rect",value:function(e){var t=e.getMin(),r=e.getMax(),n=Math.floor(t[0]),i=Math.floor(t[1]);return{x:n,y:i,width:Math.ceil(r[0])-n,height:Math.ceil(r[1])-i}}},{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=m(e.getMin(),2),r=t[0],n=t[1],i=m(e.getMax(),2);return this.rBush.search({minX:r,minY:n,maxX:i[0],maxY:i[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?(O(this.tmpMat4,t.getLocalTransform()),C(this.tmpMat4,r,this.tmpMat4),C(this.tmpMat4,this.vpMatrix,this.tmpMat4)):(O(this.tmpMat4,t.getWorldTransform()),C(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),i=0;r>i;i++)n[i]=arguments[i];return n.forEach(function(t){e.add(t)}),e}}])}();function B(e,t,r,n,i,a,o){var l,c;if("rect"===e.image.nodeName){var s=e.image.parsedStyle,u=s.width,h=s.height;c=n.contextService.getDPR();var f=n.config.offscreenCanvas;(l=a.offscreenCanvasCreator.getOrCreateCanvas(f)).width=u*c,l.height=h*c;var d=a.offscreenCanvasCreator.getOrCreateContext(f),v={restoreStack:[],prevObject:null,currentContext:new Map};e.image.forEach(function(e){i.renderDisplayObject(e,d,n,v,a)}),v.restoreStack.forEach(function(){d.restore()})}return o.getOrCreatePatternSync(t,e,r,l,c,t.getGeometryBounds().min,function(){t.dirty(),n.renderingService.dirty()})}function N(e,r,n,i){var a;if(e.type===t.GradientType.LinearGradient||e.type===t.GradientType.RadialGradient){var o=r.getGeometryBounds(),l=o&&2*o.halfExtents[0]||1,c=o&&2*o.halfExtents[1]||1,s=o&&o.min||[0,0];a=i.getOrCreateGradient(p(p({type:e.type},e.value),{},{min:s,width:l,height:c}),n)}return a}F.tag="CanvasRenderer";var G=["shadowBlur","shadowOffsetX","shadowOffsetY"],W=["lineCap","lineJoin","miterLimit"],_={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},H={};function $(e,t,r,n){var i=n.has(t)?n.get(t):_[t];return i!==r&&("lineDash"===t?e.setLineDash(r):e[t]=r,n.set(t,r)),i}var Y=function(){return a(function e(t){o(this,e),this.imagePool=t},[{key:"applyAttributesToContext",value:function(e,t){}},{key:"render",value:function(e,t,r,n,i,a){}},{key:"applyCommonStyleToContext",value:function(e,t,r,n){var i=r?H:n.prevObject.parsedStyle,a=t.parsedStyle;(r||a.opacity!==i.opacity)&&$(e,"globalAlpha",R(a.opacity)?_.globalAlpha:a.opacity,n.currentContext),(r||a.blend!==i.blend)&&$(e,"globalCompositeOperation",R(a.blend)?_.globalCompositeOperation:a.blend,n.currentContext)}},{key:"applyStrokeFillStyleToContext",value:function(e,t,r,n){var i=r?H:n.prevObject.parsedStyle,a=t.parsedStyle,o=a.lineWidth,l=a.fill&&!a.fill.isNone;if(a.stroke&&!a.stroke.isNone&&(void 0===o?_.lineWidth:o)>0){if(r||t.attributes.stroke!==n.prevObject.attributes.stroke)$(e,"strokeStyle",R(a.stroke)||Array.isArray(a.stroke)||a.stroke.isNone?_.strokeStyle:t.attributes.stroke,n.currentContext);(r||a.lineWidth!==i.lineWidth)&&$(e,"lineWidth",R(a.lineWidth)?_.lineWidth:a.lineWidth,n.currentContext),(r||a.lineDash!==i.lineDash)&&$(e,"lineDash",a.lineDash||_.lineDash,n.currentContext),(r||a.lineDashOffset!==i.lineDashOffset)&&$(e,"lineDashOffset",R(a.lineDashOffset)?_.lineDashOffset:a.lineDashOffset,n.currentContext);for(var c=0;W.length>c;c++){var s=W[c];(r||a[s]!==i[s])&&$(e,s,R(a[s])?_[s]:a[s],n.currentContext)}}l&&(r||t.attributes.fill!==n.prevObject.attributes.fill)&&$(e,"fillStyle",R(a.fill)||Array.isArray(a.fill)||a.fill.isNone?_.fillStyle:t.attributes.fill,n.currentContext)}},{key:"applyStyleToContext",value:function(e,r,n,i){var a=r.nodeName;this.applyCommonStyleToContext(e,r,n,i),a===t.Shape.IMAGE||this.applyStrokeFillStyleToContext(e,r,n,i)}},{key:"applyShadowAndFilterStyleToContext",value:function(e,t,r,n){var i=t.parsedStyle;if(r){$(e,"shadowColor",""+i.shadowColor,n.currentContext);for(var a=0;G.length>a;a++){var o=G[a];$(e,o,i[o]||_[o],n.currentContext)}}i.filter&&i.filter.length&&$(e,"filter",t.attributes.filter,n.currentContext)}},{key:"clearShadowAndFilterStyleForContext",value:function(e,t,r,n){var i=arguments.length>4&&void 0!==arguments[4]&&arguments[4];if(t){$(e,"shadowColor",_.shadowColor,n.currentContext);for(var a=0;G.length>a;a++){var o=G[a];$(e,o,_[o],n.currentContext)}}if(r)if(t&&i){var l=e.filter;!R(l)&&l.indexOf("drop-shadow")>-1&&$(e,"filter",l.replace(/drop-shadow\([^)]*\)/,"").trim()||_.filter,n.currentContext)}else $(e,"filter",_.filter,n.currentContext)}},{key:"fillToContext",value:function(e,r,n,i,a){var o=this,l=r.parsedStyle,c=l.fill,s=l.fillRule,u=null;if(Array.isArray(c)&&c.length>0)c.forEach(function(t){var i=$(e,"fillStyle",N(t,r,e,o.imagePool),n.currentContext);u=null!=u?u:i,s?e.fill(s):e.fill()});else{if(t.isPattern(c)){var h=B(c,r,e,r.ownerDocument.defaultView.context,i,a,this.imagePool);h&&(e.fillStyle=h,u=!0)}s?e.fill(s):e.fill()}null!==u&&$(e,"fillStyle",u,n.currentContext)}},{key:"strokeToContext",value:function(e,r,n,i,a){var o=this,l=r.parsedStyle.stroke,c=null;if(Array.isArray(l)&&l.length>0)l.forEach(function(t){var i=$(e,"strokeStyle",N(t,r,e,o.imagePool),n.currentContext);c=null!=c?c:i,e.stroke()});else{if(t.isPattern(l)){var s=B(l,r,e,r.ownerDocument.defaultView.context,i,a,this.imagePool);if(s){var u=$(e,"strokeStyle",s,n.currentContext);c=null!=c?c:u}}e.stroke()}null!==c&&$(e,"strokeStyle",c,n.currentContext)}},{key:"drawToContext",value:function(e,r,n,i,a){var o,l=r.nodeName,c=r.parsedStyle,s=c.opacity,u=void 0===s?_.globalAlpha:s,h=c.fillOpacity,f=void 0===h?_.fillOpacity:h,d=c.strokeOpacity,v=void 0===d?_.strokeOpacity:d,p=c.lineWidth,y=c.fill&&!c.fill.isNone,g=c.stroke&&!c.stroke.isNone&&(void 0===p?_.lineWidth:p)>0;if(y||g){var m=!R(c.shadowColor)&&c.shadowBlur>0,b="inner"===c.shadowType,x=0===(null===(o=c.fill)||void 0===o?void 0:o.alpha),S=!(!c.filter||!c.filter.length),w=m&&g&&(l===t.Shape.PATH||l===t.Shape.LINE||l===t.Shape.POLYLINE||x||b),M=null;if(y)w||this.applyShadowAndFilterStyleToContext(e,r,m,n),M=$(e,"globalAlpha",u*f,n.currentContext),this.fillToContext(e,r,n,i,a),w||this.clearShadowAndFilterStyleForContext(e,m,S,n);if(g){var k=!1,O=$(e,"globalAlpha",u*v,n.currentContext);if(M=y?M:O,w&&(this.applyShadowAndFilterStyleToContext(e,r,m,n),k=!0,b)){var C=e.globalCompositeOperation;e.globalCompositeOperation="source-atop",this.strokeToContext(e,r,n,i,a),e.globalCompositeOperation=C,this.clearShadowAndFilterStyleForContext(e,m,S,n,!0)}this.strokeToContext(e,r,n,i,a),k&&this.clearShadowAndFilterStyleForContext(e,m,S,n)}null!==M&&$(e,"globalAlpha",M,n.currentContext)}}}])}(),z=function(e){function r(){return o(this,r),u(this,r,arguments)}return f(r,e),a(r,[{key:"render",value:function(e,r,n,i,a,o){var l=r.fill,c=r.fillRule,s=r.opacity,u=void 0===s?1:s,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,m=r.lineCap,b=r.lineJoin,x=r.shadowType,S=r.shadowBlur,w=r.filter,M=r.miterLimit,k=l&&!l.isNone,O=d&&!d.isNone&&g>0,C=0===(null==l?void 0:l.alpha),P=!(!w||!w.length),T=!R(r.shadowColor)&&S>0,A=n.nodeName,E="inner"===x,D=O&&T&&(A===t.Shape.PATH||A===t.Shape.LINE||A===t.Shape.POLYLINE||C||E);k&&(e.globalAlpha=u*f,D||X(n,e,T),U(e,n,l,c,i,a,o,this.imagePool),D||this.clearShadowAndFilter(e,P,T)),O&&(e.globalAlpha=u*p,e.lineWidth=g,R(M)||(e.miterLimit=M),R(m)||(e.lineCap=m),R(b)||(e.lineJoin=b),D&&(E&&(e.globalCompositeOperation="source-atop"),X(n,e,!0),E&&(q(e,n,d,i,a,o,this.imagePool),e.globalCompositeOperation=_.globalCompositeOperation,this.clearShadowAndFilter(e,P,!0))),q(e,n,d,i,a,o,this.imagePool))}},{key:"clearShadowAndFilter",value:function(e,t,r){if(r&&(e.shadowColor="transparent",e.shadowBlur=0),t){var n=e.filter;!R(n)&&n.indexOf("drop-shadow")>-1&&(e.filter=n.replace(/drop-shadow\([^)]*\)/,"").trim()||"none")}}}])}(Y);function X(e,t,r){var n=e.parsedStyle,i=n.filter,a=n.shadowColor,o=n.shadowBlur,l=n.shadowOffsetX,c=n.shadowOffsetY;i&&i.length&&(t.filter=e.style.filter),r&&(t.shadowColor=""+a,t.shadowBlur=o||0,t.shadowOffsetX=l||0,t.shadowOffsetY=c||0)}function U(e,r,n,i,a,o,l,c){var s=arguments.length>8&&void 0!==arguments[8]&&arguments[8];Array.isArray(n)?n.forEach(function(t){e.fillStyle=N(t,r,e,c),s||(i?e.fill(i):e.fill())}):(t.isPattern(n)&&(e.fillStyle=B(n,r,e,a,o,l,c)),s||(i?e.fill(i):e.fill()))}function q(e,r,n,i,a,o,l){var c=arguments.length>7&&void 0!==arguments[7]&&arguments[7];Array.isArray(n)?n.forEach(function(t){e.strokeStyle=N(t,r,e,l),c||e.stroke()}):(t.isPattern(n)&&(e.strokeStyle=B(n,r,e,i,a,o,l)),c||e.stroke())}var V=function(e){function t(){return o(this,t),u(this,t,arguments)}return f(t,e),a(t,[{key:"renderDownSampled",value:function(e,t,r,n){var i=n.src,a=n.imageCache;a.downSampled?e.drawImage(a.downSampled,Math.floor(n.drawRect[0]),Math.floor(n.drawRect[1]),Math.ceil(n.drawRect[2]),Math.ceil(n.drawRect[3])):this.imagePool.createDownSampledImage(i,r).then(function(){r.ownerDocument&&(r.dirty(),r.ownerDocument.defaultView.context.renderingService.dirty())}).catch(function(e){console.error(e)})}},{key:"renderTile",value:function(e,t,r,n){var i=n.src,a=n.imageCache,o=n.imageRect,l=n.drawRect,c=a.size,s=e.getTransform(),u=s.a,h=s.b,f=s.c,d=s.d,v=s.e,p=s.f;if(e.resetTransform(),null!=a&&a.gridSize){for(var y=[c[0]/o[2],c[1]/o[3]],g=[a.tileSize[0]/y[0],a.tileSize[1]/y[1]],m=[Math.floor((l[0]-o[0])/g[0]),Math.ceil((l[0]+l[2]-o[0])/g[0])],b=m[0],x=m[1],S=[Math.floor((l[1]-o[1])/g[1]),Math.ceil((l[1]+l[3]-o[1])/g[1])],w=S[1],M=S[0];w>=M;M++)for(var k=b;x>=k;k++){var O=a.tiles[M][k];if(O){var C=[Math.floor(o[0]+O.tileX*g[0]),Math.floor(o[1]+O.tileY*g[1]),Math.ceil(g[0]),Math.ceil(g[1])];e.drawImage(O.data,C[0],C[1],C[2],C[3])}}e.setTransform(u,h,f,d,v,p)}else this.imagePool.createImageTiles(i,[],function(){r.ownerDocument&&(r.dirty(),r.ownerDocument.defaultView.context.renderingService.dirty())},r).catch(function(e){console.error(e)})}},{key:"render",value:function(e,r,n){var i=r.x,a=void 0===i?0:i,o=r.y,l=void 0===o?0:o,c=r.width,s=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=c,y=s;if(v){var g,b,x,S,w,k,O,C,P,A,D,L,I,j,F,B,N,G,W,_,H,$,Y,z,U,q,V,Q,J,Z,K,ee,te,re,ne,ie,ae,oe;p||(p=v.width),y||(y=v.height),X(n,e,!R(h)&&f>0);try{var le=n.ownerDocument.defaultView.getContextService().getDomElement(),ce=le.width,se=le.height,ue=e.getTransform(),he=($=ue.a,Y=ue.c,z=0,U=0,q=ue.b,V=ue.d,Q=0,J=0,Z=0,K=0,ee=1,te=0,re=ue.e,ne=ue.f,ie=0,ae=1,(oe=new M(16))[0]=$,oe[1]=Y,oe[2]=z,oe[3]=U,oe[4]=q,oe[5]=V,oe[6]=Q,oe[7]=J,oe[8]=Z,oe[9]=K,oe[10]=ee,oe[11]=te,oe[12]=re,oe[13]=ne,oe[14]=ie,oe[15]=ae,oe),fe=(B=[a,l,p,y],N=he,G=E(T(),[B[0],B[1],0],N),W=E(T(),[B[0]+B[2],B[1],0],N),_=E(T(),[B[0],B[1]+B[3],0],N),H=E(T(),[B[0]+B[2],B[1]+B[3],0],N),[Math.min(G[0],W[0],_[0],H[0]),Math.min(G[1],W[1],_[1],H[1]),Math.max(G[0],W[0],_[0],H[0])-Math.min(G[0],W[0],_[0],H[0]),Math.max(G[1],W[1],_[1],H[1])-Math.min(G[1],W[1],_[1],H[1])]),de=(g=fe,b=m([0,0,ce,se],4),x=b[0],S=b[1],w=b[2],k=b[3],O=m(g,4),P=O[1],A=O[2],D=O[3],L=Math.max(x,C=O[0]),I=Math.max(S,P),j=Math.min(x+w,C+A),F=Math.min(S+k,P+D),j>L&&F>I?[L,I,j-L,F-I]:null);if(!de)return;if(!n.ownerDocument.defaultView.getConfig().enableLargeImageOptimization)return void t.renderFull(e,r,n,{image:v,drawRect:[a,l,p,y]});if((d.downSamplingRate||.5)>fe[2]/d.size[0])return void this.renderDownSampled(e,r,n,{src:u,imageCache:d,drawRect:[a,l,p,y]});if(!ImagePool.isSupportTile)return void t.renderFull(e,r,n,{image:v,drawRect:[a,l,p,y]});this.renderTile(e,r,n,{src:u,imageCache:d,imageRect:fe,drawRect:de})}catch(e){}}}},{key:"drawToContext",value:function(e,t,r,n,i){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]))}}])}(z);function Q(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=g(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var n=0,i=function(){};return{s:i,n:function(){return e.length>n?{done:!1,value:e[n++]}:{done:!0}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,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,a=e},f:function(){try{o||null==r.return||r.return()}finally{if(l)throw a}}}}var J=function(e){function t(){return o(this,t),u(this,t,arguments)}return f(t,e),a(t,[{key:"render",value:function(e,t,r,n,i,a){r.getBounds();var o=t.lineWidth,l=void 0===o?1:o,c=t.textAlign,s=void 0===c?"start":c,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,m=t.stroke,b=t.fill,x=t.fillRule,S=t.fillOpacity,w=void 0===S?1:S,M=t.strokeOpacity,k=void 0===M?1:M,O=t.opacity,C=void 0===O?1:O,P=t.metrics,T=t.x,A=void 0===T?0:T,E=t.y,D=void 0===E?0:E,L=t.dx,I=t.dy,j=t.shadowColor,F=t.shadowBlur,B=t.textDecorationLine,N=P.lines,G=P.height,W=P.lineHeight,_=P.lineMetrics;e.font=P.font,e.lineWidth=l,e.textAlign="middle"===s?"center":s;var H=h;"alphabetic"===H&&(H="bottom"),e.lineJoin=d,R(p)||(e.miterLimit=p);var $=D;"middle"===h?$+=-G/2-W/2:"bottom"===h||"alphabetic"===h||"ideographic"===h?$+=-G:"top"!==h&&"hanging"!==h||($+=-W);var Y=A+(L||0);$+=I||0,1===N.length&&("bottom"===H?(H="middle",$-=.5*G):"top"===H&&(H="middle",$+=.5*G)),e.textBaseline=H,X(r,e,!R(j)&&F>0);for(var z=0;N.length>z;z++){var U=l/2+Y;$+=W,R(m)||m.isNone||!l||this.drawLetterSpacing(e,r,N[z],_[z],s,U,$,g,b,x,w,m,k,C,!0,n,i,a),R(b)||this.drawLetterSpacing(e,r,N[z],_[z],s,U,$,g,b,x,w,m,k,C,!1,n,i,a)}B&&"none"!==B&&this.drawTextDecorations(e,t,r,N,W,Y,D+(I||0),n,i,a)}},{key:"drawLetterSpacing",value:function(e,t,r,n,i,a,o,l,c,s,u,h,f,d,v,p,y,g){if(0!==l){var m=e.textAlign;e.textAlign="left";var b=a;"center"===i||"middle"===i?b=a-n.width/2:"right"!==i&&"end"!==i||(b=a-n.width);for(var x=Array.from(r),S=e.measureText(r).width,w=0,M=0;x.length>M;++M){var k=x[M];v?this.strokeText(e,t,k,b,o,h,f,p,y,g):this.fillText(e,t,k,b,o,c,s,u,d,p,y,g),b+=S-(w=e.measureText(r.substring(M+1)).width)+l,S=w}e.textAlign=m}else v?this.strokeText(e,t,r,a,o,h,f,p,y,g):this.fillText(e,t,r,a,o,c,s,u,d,p,y,g)}},{key:"fillText",value:function(e,t,r,n,i,a,o,l,c,s,u,h){var f;U(e,t,a,o,s,u,h,this.imagePool,!0);var d=!R(l)&&1!==l;d&&(f=e.globalAlpha,e.globalAlpha=l*c),e.fillText(r,n,i),d&&(e.globalAlpha=f)}},{key:"strokeText",value:function(e,t,r,n,i,a,o,l,c,s){var u;q(e,t,a,l,c,s,this.imagePool,!0);var h=!R(o)&&1!==o;h&&(u=e.globalAlpha,e.globalAlpha=o),e.strokeText(r,n,i),h&&(e.globalAlpha=u)}},{key:"drawTextDecorations",value:function(e,t,r,n,i,a,o,l,c,s){var u=t.textDecorationLine,h=t.textDecorationColor,f=t.textDecorationStyle,d=t.textDecorationThickness,v=void 0===d?1:d,p=t.textAlign,y=void 0===p?"start":p,g=t.lineWidth,m=void 0===g?1:g,b=t.metrics;if(u&&"none"!==u){var x=b.lineMetrics,S=u.split(" ");switch(e.lineWidth=v,h&&(e.strokeStyle="rgba(".concat(h.r,", ").concat(h.g,", ").concat(h.b,", ").concat(h.alpha,")")),f){case"dashed":e.setLineDash([5,5]);break;case"dotted":e.setLineDash([2,2]);break;default:e.setLineDash([])}var w=o,M=t.textBaseline,k=void 0===M?"alphabetic":M;"middle"===k?w+=-b.height/2-i/2:"bottom"===k||"alphabetic"===k||"ideographic"===k?w+=-b.height:"top"!==k&&"hanging"!==k||(w+=-i);for(var O=0;n.length>O;O++){w+=i;var C=x[O];if(C){var P=m/2,T=a,A=a+C.width;"center"===y||"middle"===y?(T=a-C.width/2,A=a+C.width/2):"right"!==y&&"end"!==y||(T=a-C.width,A=a),T+=P,A+=P;var E,R=Q(S);try{for(R.s();!(E=R.n()).done;){var D=w;switch(E.value){case"underline":D+=2;break;case"overline":D-=i-2;break;case"line-through":D-=i/2;break;default:continue}"wavy"===f?this.drawWavyLine(e,T,A,D):(e.beginPath(),e.moveTo(T,D),e.lineTo(A,D),e.stroke())}}catch(e){R.e(e)}finally{R.f()}}}e.setLineDash([])}}},{key:"drawWavyLine",value:function(e,t,r,n){var i=10,a=Math.floor((r-t)/i);e.beginPath(),e.moveTo(t,n);for(var o=0;a>o;o++){e.quadraticCurveTo(t+o*i+2.5,n+2,t+o*i+5,n),e.quadraticCurveTo(t+o*i+7.5,n-2,t+(o+1)*i,n)}e.stroke()}},{key:"drawToContext",value:function(e,t,r,n,i){this.render(e,t.parsedStyle,t,t.ownerDocument.defaultView.context,n,i)}}])}(z),Z=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),a(r,[{key:"init",value:function(){var e,r=p({dirtyObjectNumThreshold:500,dirtyObjectRatioThreshold:.8},this.options),n=this.context.imagePool,i=new z(n),a=(d(d(d(d(d(d(d(d(d(d(e={},t.Shape.CIRCLE,i),t.Shape.ELLIPSE,i),t.Shape.RECT,i),t.Shape.IMAGE,new V(n)),t.Shape.TEXT,new J(n)),t.Shape.LINE,i),t.Shape.POLYLINE,i),t.Shape.POLYGON,i),t.Shape.PATH,i),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=a,this.context.styleRendererFactory=a,this.addRenderingPlugin(new F(r))}},{key:"destroy",value:function(){this.removeAllRenderingPlugins(),delete this.context.defaultStyleRendererFactory,delete this.context.styleRendererFactory}}])}(t.AbstractRendererPlugin),K=Object.freeze({__proto__:null,CircleRenderer:z,DefaultRenderer:z,EllipseRenderer:z,ImageRenderer:V,LineRenderer:z,PathRenderer:z,Plugin:Z,PolygonRenderer:z,PolylineRenderer:z,RectRenderer:z,TextRenderer:J});function ee(e,t){this.v=e,this.k=t}function te(e,t,r,n){var i=Object.defineProperty;try{i({},"",{})}catch(e){i=0}te=function(e,t,r,n){function a(t,r){te(e,t,function(e){return this._invoke(t,r,e)})}t?i?i(e,t,{value:r,enumerable:!n,configurable:!n,writable:!n}):e[t]=r:(a("next",0),a("throw",1),a("return",2))},te(e,t,r,n)}function re(){ | ||
| !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@antv/g-lite")):"function"==typeof define&&define.amd?define(["exports","@antv/g-lite"],t):t(((e="undefined"!=typeof globalThis?globalThis:e||self).G=e.G||{},e.G.Canvas2D={}),e.window.G)}(this,function(e,t){"use strict";function r(e){return r="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},r(e)}function n(e){var t=function(e,t){if("object"!=r(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var i=n.call(e,t||"default");if("object"!=r(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==r(t)?t:t+""}function i(e,t){for(var r=0;t.length>r;r++){var i=t[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,n(i.key),i)}}function a(e,t,r){return t&&i(e.prototype,t),r&&i(e,r),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 c(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(c=function(){return!!e})()}function s(e,t){if(t&&("object"==r(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,r){return t=l(t),s(e,c()?Reflect.construct(t,r||[],l(e).constructor):t.apply(e,r))}function f(e,t){return f=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},f(e,t)}function h(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&&f(e,t)}function d(e,t,r){return(t=n(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function v(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 p(e){for(var t=1;arguments.length>t;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?v(Object(r),!0).forEach(function(t){d(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):v(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}function y(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);t>r;r++)n[r]=e[r];return n}function g(e,t){if(e){if("string"==typeof e)return y(e,t);var r={}.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?y(e,t):void 0}}function m(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,i,a,o,l=[],c=!0,s=!1;try{if(a=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;c=!1}else for(;!(c=(n=a.call(r)).done)&&(l.push(n.value),l.length!==t);c=!0);}catch(e){s=!0,i=e}finally{try{if(!c&&null!=r.return&&(o=r.return(),Object(o)!==o))return}finally{if(s)throw i}}return l}}(e,t)||g(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 b(e,t){if(!{}.hasOwnProperty.call(e,t))throw new TypeError("attempted to use private field on non-instance");return e}var x=0;function S(e){return"__private_"+x+++"_"+e}var w="undefined"!=typeof Float32Array?Float32Array:Array;function M(){var e=new w(16);return w!=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 k(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 O(e,t,r){var n=t[0],i=t[1],a=t[2],o=t[3],l=t[4],c=t[5],s=t[6],u=t[7],f=t[8],h=t[9],d=t[10],v=t[11],p=t[12],y=t[13],g=t[14],m=t[15],b=r[0],x=r[1],S=r[2],w=r[3];return e[0]=b*n+x*l+S*f+w*p,e[1]=b*i+x*c+S*h+w*y,e[2]=b*a+x*s+S*d+w*g,e[3]=b*o+x*u+S*v+w*m,e[4]=(b=r[4])*n+(x=r[5])*l+(S=r[6])*f+(w=r[7])*p,e[5]=b*i+x*c+S*h+w*y,e[6]=b*a+x*s+S*d+w*g,e[7]=b*o+x*u+S*v+w*m,e[8]=(b=r[8])*n+(x=r[9])*l+(S=r[10])*f+(w=r[11])*p,e[9]=b*i+x*c+S*h+w*y,e[10]=b*a+x*s+S*d+w*g,e[11]=b*o+x*u+S*v+w*m,e[12]=(b=r[12])*n+(x=r[13])*l+(S=r[14])*f+(w=r[15])*p,e[13]=b*i+x*c+S*h+w*y,e[14]=b*a+x*s+S*d+w*g,e[15]=b*o+x*u+S*v+w*m,e}function C(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]}function P(){var e=new w(3);return w!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0),e}function T(e,t,r,n){return e[0]=t,e[1]=r,e[2]=n,e}function A(e,t,r){var n=t[0],i=t[1],a=t[2],o=r[3]*n+r[7]*i+r[11]*a+r[15];return e[0]=(r[0]*n+r[4]*i+r[8]*a+r[12])/(o=o||1),e[1]=(r[1]*n+r[5]*i+r[9]*a+r[13])/o,e[2]=(r[2]*n+r[6]*i+r[10]*a+r[14])/o,e}function R(e){return null==e}P(),function(){var e,t=(e=new w(2),w!=Float32Array&&(e[0]=0,e[1]=0),e)}();var E=function(e,t,r){return t>e?t:e>r?r:e};function D(e,t,r){return{x:e*Math.cos(r)-t*Math.sin(r),y:e*Math.sin(r)+t*Math.cos(r)}}function I(e,t,r,n,i,a,o,l,c,s){var u,f,h,d,v,p=e,y=t,g=r,m=n,b=l,x=c,S=120*Math.PI/180,w=Math.PI/180*(+i||0),M=[];if(s)f=s[0],h=s[1],d=s[2],v=s[3];else{y=(u=D(p,y,-w)).y;var k=((p=u.x)-(b=(u=D(b,x,-w)).x))/2,O=(y-(x=u.y))/2,C=k*k/(g*g)+O*O/(m*m);C>1&&(g*=C=Math.sqrt(C),m*=C);var P=g*g,T=m*m,A=(a===o?-1:1)*Math.sqrt(Math.abs((P*T-P*O*O-T*k*k)/(P*O*O+T*k*k)));d=A*g*O/m+(p+b)/2,f=Math.asin(((y-(v=A*-m*k/g+(y+x)/2))/m*1e9|0)/1e9),h=Math.asin(((x-v)/m*1e9|0)/1e9),0>(f=d>p?Math.PI-f:f)&&(f=2*Math.PI+f),0>(h=d>b?Math.PI-h:h)&&(h=2*Math.PI+h),o&&f>h&&(f-=2*Math.PI),!o&&h>f&&(h-=2*Math.PI)}var R=h-f;if(Math.abs(R)>S){var E=h,j=b,F=x;M=I(b=d+g*Math.cos(h=f+S*(o&&h>f?1:-1)),x=v+m*Math.sin(h),g,m,i,0,o,j,F,[h,E,d,v])}R=h-f;var L=Math.cos(f),N=Math.sin(f),B=Math.cos(h),G=Math.sin(h),W=Math.tan(R/4),_=4/3*g*W,H=4/3*m*W,$=[p,y],z=[p+_*N,y-H*L],Y=[b+_*G,x-H*B],X=[b,x];if(z[0]=2*$[0]-z[0],z[1]=2*$[1]-z[1],s)return z.concat(Y,X,M);for(var q=[],V=0,Q=(M=z.concat(Y,X,M)).length;Q>V;V+=1)q[V]=V%2?D(M[V-1],M[V],w).y:D(M[V],M[V+1],w).x;return q}var j=S("renderState"),F=function(){function e(t){o(this,e),this.renderQueue=[],Object.defineProperty(this,j,{writable:!0,value:{restoreStack:[],prevObject:null,currentContext:new Map}}),this.clearFullScreenLastFrame=!1,this.clearFullScreen=!1,this.vpMatrix=M(),this.dprMatrix=M(),this.tmpMat4=M(),this.vec3a=P(),this.vec3b=P(),this.vec3c=P(),this.vec3d=P(),this.canvasRendererPluginOptions=t}return a(e,[{key:"apply",value:function(r,n){var i=this;this.context=r;var a=this.context,o=a.config,l=a.camera,c=a.renderingService,s=a.renderingContext,u=a.pathGeneratorFactory,f=o.renderer.getConfig().enableRenderingOptimization;o.renderer.getConfig().enableDirtyCheck=!1,o.renderer.getConfig().enableDirtyRectangleRendering=!1,this.pathGeneratorFactory=u;var h=r.contextService,d=s.root.ownerDocument.defaultView;c.hooks.init.tap(e.tag,function(){var e=h.getDPR(),t=o.width,r=o.height,n=h.getContext();i.clearRect(n,0,0,t*e,r*e,o.background)}),c.hooks.destroy.tap(e.tag,function(){i.renderQueue=[],b(i,j)[j]={restoreStack:[],prevObject:null,currentContext:null}});var v=function(e,t){for(var r=[e];r.length>0;){var a,o=r.pop();o.isVisible()&&!o.isCulled()&&(f?i.renderDisplayObjectOptimized(o,t,i.context,b(i,j)[j],n):i.renderDisplayObject(o,t,i.context,b(i,j)[j],n));for(var l=(null===(a=o.sortable)||void 0===a||null===(a=a.sorted)||void 0===a?void 0:a.length)>0?o.sortable.sorted:o.childNodes,c=l.length-1;c>=0;c--)r.push(l[c])}};c.hooks.endFrame.tap(e.tag,function(){if(function(){var e,t=h.getContext(),r=h.getDPR(),n=o.width,a=o.height,l=i.canvasRendererPluginOptions,s=l.dirtyObjectNumThreshold,u=l.dirtyObjectRatioThreshold,f=c.getStats(),v=f.rendered,p=v/f.total;i.clearFullScreen=i.clearFullScreenLastFrame||!(null!==(e=d.context.renderingPlugins[1])&&void 0!==e&&e.isFirstTimeRenderingFinished)||c.disableDirtyRectangleRendering()||v>s&&p>u,t&&("function"==typeof t.resetTransform?t.resetTransform():t.setTransform(1,0,0,1,0,0),i.clearFullScreen&&i.clearRect(t,0,0,n*r,a*r,o.background))}(),0!==s.root.childNodes.length){f=o.renderer.getConfig().enableRenderingOptimization,b(i,j)[j]={restoreStack:[],prevObject:null,currentContext:b(i,j)[j].currentContext},b(i,j)[j].currentContext.clear(),i.clearFullScreenLastFrame=!1;var e,r,a=h.getContext(),u=h.getDPR();if((e=i.dprMatrix)[0]=(r=[u,u,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,O(i.vpMatrix,i.dprMatrix,l.getOrthoMatrix()),i.clearFullScreen)f?(a.save(),v(s.root,a),a.restore()):v(s.root,a);else{var p=i.safeMergeAABB(i.mergeDirtyAABBs(i.renderQueue));if(t.AABB.isEmpty(p))return void(i.renderQueue=[]);var y=i.convertAABB2Rect(p),g=y.x,x=y.y,S=y.width,w=y.height,M=A(i.vec3a,[g,x,0],i.vpMatrix),k=A(i.vec3b,[g+S,x,0],i.vpMatrix),C=A(i.vec3c,[g,x+w,0],i.vpMatrix),P=A(i.vec3d,[g+S,x+w,0],i.vpMatrix),T=Math.min(M[0],k[0],P[0],C[0]),R=Math.min(M[1],k[1],P[1],C[1]),E=Math.max(M[0],k[0],P[0],C[0]),D=Math.max(M[1],k[1],P[1],C[1]),I=Math.floor(T),F=Math.floor(R),L=Math.ceil(E-T),N=Math.ceil(D-R);a.save(),i.clearRect(a,I,F,L,N,o.background),a.beginPath(),a.rect(I,F,L,N),a.clip(),a.setTransform(i.vpMatrix[0],i.vpMatrix[1],i.vpMatrix[4],i.vpMatrix[5],i.vpMatrix[12],i.vpMatrix[13]),o.renderer.getConfig().enableDirtyRectangleRenderingDebug&&d.dispatchEvent(new t.CustomEvent(t.CanvasEvent.DIRTY_RECTANGLE,{dirtyRect:{x:I,y:F,width:L,height:N}}));var B=m(p.getMin(),2),G=B[0],W=B[1],_=m(p.getMax(),2);s.root.ownerDocument.elementsFromBBox(G,W,_[0],_[1]).sort(function(e,t){return e.sortable.renderOrder-t.sortable.renderOrder}).forEach(function(e){e&&e.isVisible()&&!e.isCulled()&&i.renderDisplayObject(e,a,i.context,b(i,j)[j],n)}),a.restore(),i.renderQueue.forEach(function(e){i.saveDirtyAABB(e)}),i.renderQueue=[]}b(i,j)[j].restoreStack.forEach(function(){a.restore()}),b(i,j)[j].restoreStack=[]}else i.clearFullScreenLastFrame=!0}),c.hooks.render.tap(e.tag,function(e){i.clearFullScreen||i.renderQueue.push(e)})}},{key:"clearRect",value:function(e,t,r,n,i,a){e.clearRect(t,r,n,i),a&&(e.fillStyle=a,e.fillRect(t,r,n,i))}},{key:"renderDisplayObjectOptimized",value:function(e,r,n,i,a){var o=e.nodeName,l=!1,c=this.context.styleRendererFactory[o],s=this.pathGeneratorFactory[o],u=e.parsedStyle.clipPath;if(u){(!i.prevObject||!C(u.getWorldTransform(),i.prevObject.getWorldTransform()))&&(this.applyWorldTransform(r,u),i.prevObject=null);var f=this.pathGeneratorFactory[u.nodeName];f&&(r.save(),l=!0,r.beginPath(),f(r,u.parsedStyle),r.closePath(),r.clip())}if(c){(!i.prevObject||!C(e.getWorldTransform(),i.prevObject.getWorldTransform()))&&this.applyWorldTransform(r,e);var h=!i.prevObject;if(!h){var d=i.prevObject.nodeName;h=o===t.Shape.TEXT?d!==t.Shape.TEXT:o===t.Shape.IMAGE?d!==t.Shape.IMAGE:d===t.Shape.TEXT||d===t.Shape.IMAGE}c.applyStyleToContext(r,e,h,i),i.prevObject=e}s&&(r.beginPath(),s(r,e.parsedStyle),o!==t.Shape.LINE&&o!==t.Shape.PATH&&o!==t.Shape.POLYLINE&&r.closePath()),c&&c.drawToContext(r,e,b(this,j)[j],this,a),l&&r.restore(),e.dirty(!1)}},{key:"renderDisplayObject",value:function(e,r,n,i,a){var o=e.nodeName,l=i.restoreStack[i.restoreStack.length-1];!l||e.compareDocumentPosition(l)&t.Node.DOCUMENT_POSITION_CONTAINS||(r.restore(),i.restoreStack.pop());var c=this.context.styleRendererFactory[o],s=this.pathGeneratorFactory[o],u=e.parsedStyle.clipPath;if(u){this.applyWorldTransform(r,u);var f=this.pathGeneratorFactory[u.nodeName];f&&(r.save(),i.restoreStack.push(e),r.beginPath(),f(r,u.parsedStyle),r.closePath(),r.clip())}c&&(this.applyWorldTransform(r,e),r.save(),this.applyAttributesToContext(r,e)),s&&(r.beginPath(),s(r,e.parsedStyle),o!==t.Shape.LINE&&o!==t.Shape.PATH&&o!==t.Shape.POLYLINE&&r.closePath()),c&&(c.render(r,e.parsedStyle,e,n,this,a),r.restore()),e.dirty(!1)}},{key:"applyAttributesToContext",value:function(e,t){var r=t.parsedStyle,n=r.stroke,i=r.fill,a=r.opacity,o=r.lineDash,l=r.lineDashOffset;o&&e.setLineDash(o),R(l)||(e.lineDashOffset=l),R(a)||(e.globalAlpha*=a),R(n)||Array.isArray(n)||n.isNone||(e.strokeStyle=t.attributes.stroke),R(i)||Array.isArray(i)||i.isNone||(e.fillStyle=t.attributes.fill)}},{key:"convertAABB2Rect",value:function(e){var t=e.getMin(),r=e.getMax(),n=Math.floor(t[0]),i=Math.floor(t[1]);return{x:n,y:i,width:Math.ceil(r[0])-n,height:Math.ceil(r[1])-i}}},{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:"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?(k(this.tmpMat4,t.getLocalTransform()),O(this.tmpMat4,r,this.tmpMat4),O(this.tmpMat4,this.vpMatrix,this.tmpMat4)):(k(this.tmpMat4,t.getWorldTransform()),O(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),i=0;r>i;i++)n[i]=arguments[i];return n.forEach(function(t){e.add(t)}),e}}])}();function L(e,t,r,n,i,a,o){var l,c;if("rect"===e.image.nodeName){var s=e.image.parsedStyle,u=s.width,f=s.height;c=n.contextService.getDPR();var h=n.config.offscreenCanvas;(l=a.offscreenCanvasCreator.getOrCreateCanvas(h)).width=u*c,l.height=f*c;var d=a.offscreenCanvasCreator.getOrCreateContext(h),v={restoreStack:[],prevObject:null,currentContext:new Map};e.image.forEach(function(e){i.renderDisplayObject(e,d,n,v,a)}),v.restoreStack.forEach(function(){d.restore()})}return o.getOrCreatePatternSync(t,e,r,l,c,t.getGeometryBounds().min,function(){t.dirty(),n.renderingService.dirty()})}function N(e,r,n,i){var a;if(e.type===t.GradientType.LinearGradient||e.type===t.GradientType.RadialGradient){var o=r.getGeometryBounds(),l=o&&2*o.halfExtents[0]||1,c=o&&2*o.halfExtents[1]||1,s=o&&o.min||[0,0];a=i.getOrCreateGradient(p(p({type:e.type},e.value),{},{min:s,width:l,height:c}),n)}return a}F.tag="CanvasRenderer";var B=["shadowBlur","shadowOffsetX","shadowOffsetY"],G=["lineCap","lineJoin","miterLimit"],W={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},_={};function H(e,t,r,n){var i=n.has(t)?n.get(t):W[t];return i!==r&&("lineDash"===t?e.setLineDash(r):e[t]=r,n.set(t,r)),i}var $=function(){return a(function e(t){o(this,e),this.imagePool=t},[{key:"applyAttributesToContext",value:function(e,t){}},{key:"render",value:function(e,t,r,n,i,a){}},{key:"applyCommonStyleToContext",value:function(e,t,r,n){var i=r?_:n.prevObject.parsedStyle,a=t.parsedStyle;(r||a.opacity!==i.opacity)&&H(e,"globalAlpha",R(a.opacity)?W.globalAlpha:a.opacity,n.currentContext),(r||a.blend!==i.blend)&&H(e,"globalCompositeOperation",R(a.blend)?W.globalCompositeOperation:a.blend,n.currentContext)}},{key:"applyStrokeFillStyleToContext",value:function(e,t,r,n){var i=r?_:n.prevObject.parsedStyle,a=t.parsedStyle,o=a.lineWidth,l=a.fill&&!a.fill.isNone;if(a.stroke&&!a.stroke.isNone&&(void 0===o?W.lineWidth:o)>0){if(r||t.attributes.stroke!==n.prevObject.attributes.stroke)H(e,"strokeStyle",R(a.stroke)||Array.isArray(a.stroke)||a.stroke.isNone?W.strokeStyle:t.attributes.stroke,n.currentContext);(r||a.lineWidth!==i.lineWidth)&&H(e,"lineWidth",R(a.lineWidth)?W.lineWidth:a.lineWidth,n.currentContext),(r||a.lineDash!==i.lineDash)&&H(e,"lineDash",a.lineDash||W.lineDash,n.currentContext),(r||a.lineDashOffset!==i.lineDashOffset)&&H(e,"lineDashOffset",R(a.lineDashOffset)?W.lineDashOffset:a.lineDashOffset,n.currentContext);for(var c=0;G.length>c;c++){var s=G[c];(r||a[s]!==i[s])&&H(e,s,R(a[s])?W[s]:a[s],n.currentContext)}}l&&(r||t.attributes.fill!==n.prevObject.attributes.fill)&&H(e,"fillStyle",R(a.fill)||Array.isArray(a.fill)||a.fill.isNone?W.fillStyle:t.attributes.fill,n.currentContext)}},{key:"applyStyleToContext",value:function(e,r,n,i){var a=r.nodeName;this.applyCommonStyleToContext(e,r,n,i),a===t.Shape.IMAGE||this.applyStrokeFillStyleToContext(e,r,n,i)}},{key:"applyShadowAndFilterStyleToContext",value:function(e,t,r,n){var i=t.parsedStyle;if(r){H(e,"shadowColor",""+i.shadowColor,n.currentContext);for(var a=0;B.length>a;a++){var o=B[a];H(e,o,i[o]||W[o],n.currentContext)}}i.filter&&i.filter.length&&H(e,"filter",t.attributes.filter,n.currentContext)}},{key:"clearShadowAndFilterStyleForContext",value:function(e,t,r,n){var i=arguments.length>4&&void 0!==arguments[4]&&arguments[4];if(t){H(e,"shadowColor",W.shadowColor,n.currentContext);for(var a=0;B.length>a;a++){var o=B[a];H(e,o,W[o],n.currentContext)}}if(r)if(t&&i){var l=e.filter;!R(l)&&l.indexOf("drop-shadow")>-1&&H(e,"filter",l.replace(/drop-shadow\([^)]*\)/,"").trim()||W.filter,n.currentContext)}else H(e,"filter",W.filter,n.currentContext)}},{key:"fillToContext",value:function(e,r,n,i,a){var o=this,l=r.parsedStyle,c=l.fill,s=l.fillRule,u=null;if(Array.isArray(c)&&c.length>0)c.forEach(function(t){var i=H(e,"fillStyle",N(t,r,e,o.imagePool),n.currentContext);u=null!=u?u:i,s?e.fill(s):e.fill()});else{if(t.isPattern(c)){var f=L(c,r,e,r.ownerDocument.defaultView.context,i,a,this.imagePool);f&&(e.fillStyle=f,u=!0)}s?e.fill(s):e.fill()}null!==u&&H(e,"fillStyle",u,n.currentContext)}},{key:"strokeToContext",value:function(e,r,n,i,a){var o=this,l=r.parsedStyle.stroke,c=null;if(Array.isArray(l)&&l.length>0)l.forEach(function(t){var i=H(e,"strokeStyle",N(t,r,e,o.imagePool),n.currentContext);c=null!=c?c:i,e.stroke()});else{if(t.isPattern(l)){var s=L(l,r,e,r.ownerDocument.defaultView.context,i,a,this.imagePool);if(s){var u=H(e,"strokeStyle",s,n.currentContext);c=null!=c?c:u}}e.stroke()}null!==c&&H(e,"strokeStyle",c,n.currentContext)}},{key:"drawToContext",value:function(e,r,n,i,a){var o,l=r.nodeName,c=r.parsedStyle,s=c.opacity,u=void 0===s?W.globalAlpha:s,f=c.fillOpacity,h=void 0===f?W.fillOpacity:f,d=c.strokeOpacity,v=void 0===d?W.strokeOpacity:d,p=c.lineWidth,y=c.fill&&!c.fill.isNone,g=c.stroke&&!c.stroke.isNone&&(void 0===p?W.lineWidth:p)>0;if(y||g){var m=!R(c.shadowColor)&&c.shadowBlur>0,b="inner"===c.shadowType,x=0===(null===(o=c.fill)||void 0===o?void 0:o.alpha),S=!(!c.filter||!c.filter.length),w=m&&g&&(l===t.Shape.PATH||l===t.Shape.LINE||l===t.Shape.POLYLINE||x||b),M=null;if(y)w||this.applyShadowAndFilterStyleToContext(e,r,m,n),M=H(e,"globalAlpha",u*h,n.currentContext),this.fillToContext(e,r,n,i,a),w||this.clearShadowAndFilterStyleForContext(e,m,S,n);if(g){var k=!1,O=H(e,"globalAlpha",u*v,n.currentContext);if(M=y?M:O,w&&(this.applyShadowAndFilterStyleToContext(e,r,m,n),k=!0,b)){var C=e.globalCompositeOperation;e.globalCompositeOperation="source-atop",this.strokeToContext(e,r,n,i,a),e.globalCompositeOperation=C,this.clearShadowAndFilterStyleForContext(e,m,S,n,!0)}this.strokeToContext(e,r,n,i,a),k&&this.clearShadowAndFilterStyleForContext(e,m,S,n)}null!==M&&H(e,"globalAlpha",M,n.currentContext)}}}])}(),z=function(e){function r(){return o(this,r),u(this,r,arguments)}return h(r,e),a(r,[{key:"render",value:function(e,r,n,i,a,o){var l=r.fill,c=r.fillRule,s=r.opacity,u=void 0===s?1:s,f=r.fillOpacity,h=void 0===f?1:f,d=r.stroke,v=r.strokeOpacity,p=void 0===v?1:v,y=r.lineWidth,g=void 0===y?1:y,m=r.lineCap,b=r.lineJoin,x=r.shadowType,S=r.shadowBlur,w=r.filter,M=r.miterLimit,k=l&&!l.isNone,O=d&&!d.isNone&&g>0,C=0===(null==l?void 0:l.alpha),P=!(!w||!w.length),T=!R(r.shadowColor)&&S>0,A=n.nodeName,E="inner"===x,D=O&&T&&(A===t.Shape.PATH||A===t.Shape.LINE||A===t.Shape.POLYLINE||C||E);k&&(e.globalAlpha=u*h,D||Y(n,e,T),X(e,n,l,c,i,a,o,this.imagePool),D||this.clearShadowAndFilter(e,P,T)),O&&(e.globalAlpha=u*p,e.lineWidth=g,R(M)||(e.miterLimit=M),R(m)||(e.lineCap=m),R(b)||(e.lineJoin=b),D&&(E&&(e.globalCompositeOperation="source-atop"),Y(n,e,!0),E&&(q(e,n,d,i,a,o,this.imagePool),e.globalCompositeOperation=W.globalCompositeOperation,this.clearShadowAndFilter(e,P,!0))),q(e,n,d,i,a,o,this.imagePool))}},{key:"clearShadowAndFilter",value:function(e,t,r){if(r&&(e.shadowColor="transparent",e.shadowBlur=0),t){var n=e.filter;!R(n)&&n.indexOf("drop-shadow")>-1&&(e.filter=n.replace(/drop-shadow\([^)]*\)/,"").trim()||"none")}}}])}($);function Y(e,t,r){var n=e.parsedStyle,i=n.filter,a=n.shadowColor,o=n.shadowBlur,l=n.shadowOffsetX,c=n.shadowOffsetY;i&&i.length&&(t.filter=e.style.filter),r&&(t.shadowColor=""+a,t.shadowBlur=o||0,t.shadowOffsetX=l||0,t.shadowOffsetY=c||0)}function X(e,r,n,i,a,o,l,c){var s=arguments.length>8&&void 0!==arguments[8]&&arguments[8];Array.isArray(n)?n.forEach(function(t){e.fillStyle=N(t,r,e,c),s||(i?e.fill(i):e.fill())}):(t.isPattern(n)&&(e.fillStyle=L(n,r,e,a,o,l,c)),s||(i?e.fill(i):e.fill()))}function q(e,r,n,i,a,o,l){var c=arguments.length>7&&void 0!==arguments[7]&&arguments[7];Array.isArray(n)?n.forEach(function(t){e.strokeStyle=N(t,r,e,l),c||e.stroke()}):(t.isPattern(n)&&(e.strokeStyle=L(n,r,e,i,a,o,l)),c||e.stroke())}var V=function(e){function t(){return o(this,t),u(this,t,arguments)}return h(t,e),a(t,[{key:"renderDownSampled",value:function(e,t,r,n){var i=n.src,a=n.imageCache;a.downSampled?e.drawImage(a.downSampled,Math.floor(n.drawRect[0]),Math.floor(n.drawRect[1]),Math.ceil(n.drawRect[2]),Math.ceil(n.drawRect[3])):this.imagePool.createDownSampledImage(i,r).then(function(){r.ownerDocument&&(r.dirty(),r.ownerDocument.defaultView.context.renderingService.dirty())}).catch(function(e){console.error(e)})}},{key:"renderTile",value:function(e,t,r,n){var i=n.src,a=n.imageCache,o=n.imageRect,l=n.drawRect,c=a.size,s=e.getTransform(),u=s.a,f=s.b,h=s.c,d=s.d,v=s.e,p=s.f;if(e.resetTransform(),null!=a&&a.gridSize){for(var y=[c[0]/o[2],c[1]/o[3]],g=[a.tileSize[0]/y[0],a.tileSize[1]/y[1]],m=[Math.floor((l[0]-o[0])/g[0]),Math.ceil((l[0]+l[2]-o[0])/g[0])],b=m[0],x=m[1],S=[Math.floor((l[1]-o[1])/g[1]),Math.ceil((l[1]+l[3]-o[1])/g[1])],w=S[1],M=S[0];w>=M;M++)for(var k=b;x>=k;k++){var O=a.tiles[M][k];if(O){var C=[Math.floor(o[0]+O.tileX*g[0]),Math.floor(o[1]+O.tileY*g[1]),Math.ceil(g[0]),Math.ceil(g[1])];e.drawImage(O.data,C[0],C[1],C[2],C[3])}}e.setTransform(u,f,h,d,v,p)}else this.imagePool.createImageTiles(i,[],function(){r.ownerDocument&&(r.dirty(),r.ownerDocument.defaultView.context.renderingService.dirty())},r).catch(function(e){console.error(e)})}},{key:"render",value:function(e,r,n){var i=r.x,a=void 0===i?0:i,o=r.y,l=void 0===o?0:o,c=r.width,s=r.height,u=r.src,f=r.shadowColor,h=r.shadowBlur,d=this.imagePool.getImageSync(u,n),v=null==d?void 0:d.img,p=c,y=s;if(v){var g,b,x,S,M,k,O,C,T,E,D,I,j,F,L,N,B,G,W,_,H,$,z,X,q,V,Q,U,J,Z,K,ee,te,re,ne,ie,ae,oe;p||(p=v.width),y||(y=v.height),Y(n,e,!R(f)&&h>0);try{var le=n.ownerDocument.defaultView.getContextService().getDomElement(),ce=le.width,se=le.height,ue=e.getTransform(),fe=($=ue.a,z=ue.c,X=0,q=0,V=ue.b,Q=ue.d,U=0,J=0,Z=0,K=0,ee=1,te=0,re=ue.e,ne=ue.f,ie=0,ae=1,(oe=new w(16))[0]=$,oe[1]=z,oe[2]=X,oe[3]=q,oe[4]=V,oe[5]=Q,oe[6]=U,oe[7]=J,oe[8]=Z,oe[9]=K,oe[10]=ee,oe[11]=te,oe[12]=re,oe[13]=ne,oe[14]=ie,oe[15]=ae,oe),he=(N=[a,l,p,y],B=fe,G=A(P(),[N[0],N[1],0],B),W=A(P(),[N[0]+N[2],N[1],0],B),_=A(P(),[N[0],N[1]+N[3],0],B),H=A(P(),[N[0]+N[2],N[1]+N[3],0],B),[Math.min(G[0],W[0],_[0],H[0]),Math.min(G[1],W[1],_[1],H[1]),Math.max(G[0],W[0],_[0],H[0])-Math.min(G[0],W[0],_[0],H[0]),Math.max(G[1],W[1],_[1],H[1])-Math.min(G[1],W[1],_[1],H[1])]),de=(g=he,b=m([0,0,ce,se],4),x=b[0],S=b[1],M=b[2],k=b[3],O=m(g,4),T=O[1],E=O[2],D=O[3],I=Math.max(x,C=O[0]),j=Math.max(S,T),F=Math.min(x+M,C+E),L=Math.min(S+k,T+D),F>I&&L>j?[I,j,F-I,L-j]:null);if(!de)return;if(!n.ownerDocument.defaultView.getConfig().enableLargeImageOptimization)return void t.renderFull(e,r,n,{image:v,drawRect:[a,l,p,y]});if((d.downSamplingRate||.5)>he[2]/d.size[0])return void this.renderDownSampled(e,r,n,{src:u,imageCache:d,drawRect:[a,l,p,y]});if(!ImagePool.isSupportTile)return void t.renderFull(e,r,n,{image:v,drawRect:[a,l,p,y]});this.renderTile(e,r,n,{src:u,imageCache:d,imageRect:he,drawRect:de})}catch(e){}}}},{key:"drawToContext",value:function(e,t,r,n,i){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]))}}])}(z);function Q(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=g(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var n=0,i=function(){};return{s:i,n:function(){return e.length>n?{done:!1,value:e[n++]}:{done:!0}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,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,a=e},f:function(){try{o||null==r.return||r.return()}finally{if(l)throw a}}}}var U=function(e){function t(){return o(this,t),u(this,t,arguments)}return h(t,e),a(t,[{key:"render",value:function(e,t,r,n,i,a){r.getBounds();var o=t.lineWidth,l=void 0===o?1:o,c=t.textAlign,s=void 0===c?"start":c,u=t.textBaseline,f=void 0===u?"alphabetic":u,h=t.lineJoin,d=void 0===h?"miter":h,v=t.miterLimit,p=void 0===v?10:v,y=t.letterSpacing,g=void 0===y?0:y,m=t.stroke,b=t.fill,x=t.fillRule,S=t.fillOpacity,w=void 0===S?1:S,M=t.strokeOpacity,k=void 0===M?1:M,O=t.opacity,C=void 0===O?1:O,P=t.metrics,T=t.x,A=void 0===T?0:T,E=t.y,D=void 0===E?0:E,I=t.dx,j=t.dy,F=t.shadowColor,L=t.shadowBlur,N=t.textDecorationLine,B=P.lines,G=P.height,W=P.lineHeight,_=P.lineMetrics;e.font=P.font,e.lineWidth=l,e.textAlign="middle"===s?"center":s;var H=f;"alphabetic"===H&&(H="bottom"),e.lineJoin=d,R(p)||(e.miterLimit=p);var $=D;"middle"===f?$+=-G/2-W/2:"bottom"===f||"alphabetic"===f||"ideographic"===f?$+=-G:"top"!==f&&"hanging"!==f||($+=-W);var z=A+(I||0);$+=j||0,1===B.length&&("bottom"===H?(H="middle",$-=.5*G):"top"===H&&(H="middle",$+=.5*G)),e.textBaseline=H,Y(r,e,!R(F)&&L>0);for(var X=0;B.length>X;X++){var q=l/2+z;$+=W,R(m)||m.isNone||!l||this.drawLetterSpacing(e,r,B[X],_[X],s,q,$,g,b,x,w,m,k,C,!0,n,i,a),R(b)||this.drawLetterSpacing(e,r,B[X],_[X],s,q,$,g,b,x,w,m,k,C,!1,n,i,a)}N&&"none"!==N&&this.drawTextDecorations(e,t,r,B,W,z,D+(j||0),n,i,a)}},{key:"drawLetterSpacing",value:function(e,t,r,n,i,a,o,l,c,s,u,f,h,d,v,p,y,g){if(0!==l){var m=e.textAlign;e.textAlign="left";var b=a;"center"===i||"middle"===i?b=a-n.width/2:"right"!==i&&"end"!==i||(b=a-n.width);for(var x=Array.from(r),S=e.measureText(r).width,w=0,M=0;x.length>M;++M){var k=x[M];v?this.strokeText(e,t,k,b,o,f,h,p,y,g):this.fillText(e,t,k,b,o,c,s,u,d,p,y,g),b+=S-(w=e.measureText(r.substring(M+1)).width)+l,S=w}e.textAlign=m}else v?this.strokeText(e,t,r,a,o,f,h,p,y,g):this.fillText(e,t,r,a,o,c,s,u,d,p,y,g)}},{key:"fillText",value:function(e,t,r,n,i,a,o,l,c,s,u,f){var h;X(e,t,a,o,s,u,f,this.imagePool,!0);var d=!R(l)&&1!==l;d&&(h=e.globalAlpha,e.globalAlpha=l*c),e.fillText(r,n,i),d&&(e.globalAlpha=h)}},{key:"strokeText",value:function(e,t,r,n,i,a,o,l,c,s){var u;q(e,t,a,l,c,s,this.imagePool,!0);var f=!R(o)&&1!==o;f&&(u=e.globalAlpha,e.globalAlpha=o),e.strokeText(r,n,i),f&&(e.globalAlpha=u)}},{key:"drawTextDecorations",value:function(e,t,r,n,i,a,o,l,c,s){var u=t.textDecorationLine,f=t.textDecorationColor,h=t.textDecorationStyle,d=t.textDecorationThickness,v=void 0===d?1:d,p=t.textAlign,y=void 0===p?"start":p,g=t.lineWidth,m=void 0===g?1:g,b=t.metrics;if(u&&"none"!==u){var x=b.lineMetrics,S=u.split(" ");switch(e.lineWidth=v,f&&(e.strokeStyle="rgba(".concat(f.r,", ").concat(f.g,", ").concat(f.b,", ").concat(f.alpha,")")),h){case"dashed":e.setLineDash([5,5]);break;case"dotted":e.setLineDash([2,2]);break;default:e.setLineDash([])}var w=o,M=t.textBaseline,k=void 0===M?"alphabetic":M;"middle"===k?w+=-b.height/2-i/2:"bottom"===k||"alphabetic"===k||"ideographic"===k?w+=-b.height:"top"!==k&&"hanging"!==k||(w+=-i);for(var O=0;n.length>O;O++){w+=i;var C=x[O];if(C){var P=m/2,T=a,A=a+C.width;"center"===y||"middle"===y?(T=a-C.width/2,A=a+C.width/2):"right"!==y&&"end"!==y||(T=a-C.width,A=a),T+=P,A+=P;var R,E=Q(S);try{for(E.s();!(R=E.n()).done;){var D=w;switch(R.value){case"underline":D+=2;break;case"overline":D-=i-2;break;case"line-through":D-=i/2;break;default:continue}"wavy"===h?this.drawWavyLine(e,T,A,D):(e.beginPath(),e.moveTo(T,D),e.lineTo(A,D),e.stroke())}}catch(e){E.e(e)}finally{E.f()}}}e.setLineDash([])}}},{key:"drawWavyLine",value:function(e,t,r,n){var i=10,a=Math.floor((r-t)/i);e.beginPath(),e.moveTo(t,n);for(var o=0;a>o;o++){e.quadraticCurveTo(t+o*i+2.5,n+2,t+o*i+5,n),e.quadraticCurveTo(t+o*i+7.5,n-2,t+(o+1)*i,n)}e.stroke()}},{key:"drawToContext",value:function(e,t,r,n,i){this.render(e,t.parsedStyle,t,t.ownerDocument.defaultView.context,n,i)}}])}(z),J=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 h(r,e),a(r,[{key:"init",value:function(){var e,r=p({dirtyObjectNumThreshold:500,dirtyObjectRatioThreshold:.8},this.options),n=this.context.imagePool,i=new z(n),a=(d(d(d(d(d(d(d(d(d(d(e={},t.Shape.CIRCLE,i),t.Shape.ELLIPSE,i),t.Shape.RECT,i),t.Shape.IMAGE,new V(n)),t.Shape.TEXT,new U(n)),t.Shape.LINE,i),t.Shape.POLYLINE,i),t.Shape.POLYGON,i),t.Shape.PATH,i),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=a,this.context.styleRendererFactory=a,this.addRenderingPlugin(new F(r))}},{key:"destroy",value:function(){this.removeAllRenderingPlugins(),delete this.context.defaultStyleRendererFactory,delete this.context.styleRendererFactory}}])}(t.AbstractRendererPlugin),Z=Object.freeze({__proto__:null,CircleRenderer:z,DefaultRenderer:z,EllipseRenderer:z,ImageRenderer:V,LineRenderer:z,PathRenderer:z,Plugin:J,PolygonRenderer:z,PolylineRenderer:z,RectRenderer:z,TextRenderer:U});function K(e,t){this.v=e,this.k=t}function ee(e,t,r,n){var i=Object.defineProperty;try{i({},"",{})}catch(e){i=0}ee=function(e,t,r,n){function a(t,r){ee(e,t,function(e){return this._invoke(t,r,e)})}t?i?i(e,t,{value:r,enumerable:!n,configurable:!n,writable:!n}):e[t]=r:(a("next",0),a("throw",1),a("return",2))},ee(e,t,r,n)}function te(){ | ||
| /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */ | ||
| var e,t,r="function"==typeof Symbol?Symbol:{},n=r.iterator||"@@iterator",i=r.toStringTag||"@@toStringTag";function a(r,n,i,a){var c=Object.create((n&&n.prototype instanceof l?n:l).prototype);return te(c,"_invoke",function(r,n,i){var a,l,c,s=0,u=i||[],h=!1,f={p:0,n:0,v:e,a:d,f:d.bind(e,4),d:function(t,r){return a=t,l=0,c=e,f.n=r,o}};function d(r,n){for(l=r,c=n,t=0;!h&&s&&!i&&u.length>t;t++){var i,a=u[t],d=f.p,v=a[2];r>3?(i=v===n)&&(c=a[(l=a[4])?5:(l=3,3)],a[4]=a[5]=e):d>=a[0]&&((i=2>r&&a[1]>d)?(l=0,f.v=n,f.n=a[1]):v>d&&(i=3>r||a[0]>n||n>v)&&(a[4]=r,a[5]=n,f.n=v,l=0))}if(i||r>1)return o;throw h=!0,n}return function(i,u,v){if(s>1)throw TypeError("Generator is already running");for(h&&1===u&&d(u,v),l=u,c=v;(t=2>l?e:c)||!h;){a||(l?3>l?(l>1&&(f.n=-1),d(l,c)):f.n=c:f.v=c);try{if(s=2,a){if(l||(i="next"),t=a[i]){if(!(t=t.call(a,c)))throw TypeError("iterator result is not an object");if(!t.done)return t;c=t.value,2>l&&(l=0)}else 1===l&&(t=a.return)&&t.call(a),2>l&&(c=TypeError("The iterator does not provide a '"+i+"' method"),l=1);a=e}else if((t=(h=0>f.n)?c:r.call(n,f))!==o)break}catch(t){a=e,l=1,c=t}finally{s=1}}return{value:t,done:h}}}(r,i,a),!0),c}var o={};function l(){}function c(){}function s(){}t=Object.getPrototypeOf;var u=[][n]?t(t([][n]())):(te(t={},n,function(){return this}),t),h=s.prototype=l.prototype=Object.create(u);function f(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,s):(e.__proto__=s,te(e,i,"GeneratorFunction")),e.prototype=Object.create(h),e}return c.prototype=s,te(h,"constructor",s),te(s,"constructor",c),c.displayName="GeneratorFunction",te(s,i,"GeneratorFunction"),te(h),te(h,i,"Generator"),te(h,n,function(){return this}),te(h,"toString",function(){return"[object Generator]"}),(re=function(){return{w:a,m:f}})()}function ne(e,t){function r(n,i,a,o){try{var l=e[n](i),c=l.value;return c instanceof ee?t.resolve(c.v).then(function(e){r("next",e,a,o)},function(e){r("throw",e,a,o)}):t.resolve(c).then(function(e){l.value=e,a(l)},function(e){return r("throw",e,a,o)})}catch(e){o(e)}}var n;this.next||(te(ne.prototype),te(ne.prototype,"function"==typeof Symbol&&Symbol.asyncIterator||"@asyncIterator",function(){return this})),te(this,"_invoke",function(e,i,a){function o(){return new t(function(t,n){r(e,a,t,n)})}return n=n?n.then(o,o):o()},!0)}function ie(e,t,r,n,i){return new ne(re().w(e,t,r,n),i||Promise)}function ae(e,t,r,n,i){var a=ie(e,t,r,n,i);return a.next().then(function(e){return e.done?e.value:a.next()})}function oe(e){var t=Object(e),r=[];for(var n in t)r.unshift(n);return function e(){for(;r.length;)if((n=r.pop())in t)return e.value=n,e.done=!1,e;return e.done=!0,e}}function le(e){if(null!=e){var t=e["function"==typeof Symbol&&Symbol.iterator||"@@iterator"],n=0;if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length))return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}}}throw new TypeError(r(e)+" is not iterable")}function ce(){var e=re(),t=e.m(ce),r=(Object.getPrototypeOf?Object.getPrototypeOf(t):t.__proto__).constructor;function n(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===r||"GeneratorFunction"===(t.displayName||t.name))}var i={throw:1,return:2,break:3,continue:3};function a(e){var t,r;return function(n){t||(t={stop:function(){return r(n.a,2)},catch:function(){return n.v},abrupt:function(e,t){return r(n.a,i[e],t)},delegateYield:function(e,i,a){return t.resultName=i,r(n.d,le(e),a)},finish:function(e){return r(n.f,e)}},r=function(e,r,i){n.p=t.prev,n.n=t.next;try{return e(r,i)}finally{t.next=n.n}}),t.resultName&&(t[t.resultName]=n.v,t.resultName=void 0),t.sent=n.v,t.next=n.n;try{return e.call(this,t)}finally{n.p=t.prev,n.n=t.next}}}return(ce=function(){return{wrap:function(t,r,n,i){return e.w(a(t),r,n,i&&i.reverse())},isGeneratorFunction:n,mark:e.m,awrap:function(e,t){return new ee(e,t)},AsyncIterator:ne,async:function(e,t,r,i,o){return(n(t)?ie:ae)(a(e),t,r,i,o)},keys:oe,values:le}})()}function se(e,t,r,n,i,a,o){try{var l=e[a](o),c=l.value}catch(e){return void r(e)}l.done?t(c):Promise.resolve(c).then(n,i)}function ue(e){return function(){var t=this,r=arguments;return new Promise(function(n,i){var a=e.apply(t,r);function o(e){se(a,n,i,o,l,"next",e)}function l(e){se(a,n,i,o,l,"throw",e)}o(void 0)})}}var he=T(),fe=T(),de=T(),ve=k(),pe=function(){function e(){var r=this;o(this,e),this.isHit=function(e,n,i,a){var o,l,c,s,u,h,f,d,v,p,y,g,m,b,x,S,w,M,k,O,C,P,T,R,D,L,I,j,F,B,N,G=r.context.pointInPathPickerFactory[e.nodeName];if(G){var W=(o=ve,(N=(k=(c=(l=i)[0])*(d=l[5])-(s=l[1])*(f=l[4]))*(B=(m=l[10])*(M=l[15])-(b=l[11])*(w=l[14]))-(O=c*(v=l[6])-(u=l[2])*f)*(F=(g=l[9])*M-b*(S=l[13]))+(C=c*(p=l[7])-(h=l[3])*f)*(j=g*w-m*S)+(P=s*v-u*d)*(I=(y=l[8])*M-b*(x=l[12]))-(T=s*p-h*d)*(L=y*w-m*x)+(R=u*p-h*v)*(D=y*S-g*x))?(o[0]=(d*B-v*F+p*j)*(N=1/N),o[1]=(u*F-s*B-h*j)*N,o[2]=(S*R-w*T+M*P)*N,o[3]=(m*T-g*R-b*P)*N,o[4]=(v*I-f*B-p*L)*N,o[5]=(c*B-u*I+h*L)*N,o[6]=(w*C-x*R-M*O)*N,o[7]=(y*R-m*C+b*O)*N,o[8]=(f*F-d*I+p*D)*N,o[9]=(s*I-c*F-h*D)*N,o[10]=(x*T-S*C+M*k)*N,o[11]=(g*C-y*T-b*k)*N,o[12]=(d*L-f*j-v*D)*N,o[13]=(c*j-s*L+u*D)*N,o[14]=(S*O-x*P-w*k)*N,o[15]=(y*P-g*O+m*k)*N,o):null),_=E(fe,A(de,n[0],n[1],0),W);if(G(e,new t.Point(_[0],_[1]),a,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),i=r.context.pathGeneratorFactory[e.nodeName];return i&&(n.beginPath(),i(n,e.parsedStyle),n.closePath()),n.isPointInPath(t.x,t.y)}}return a(e,[{key:"apply",value:function(t,r){var n,i=this,a=t.renderingService,o=t.renderingContext;this.context=t,this.runtime=r;var l=null===(n=o.root)||void 0===n?void 0:n.ownerDocument;a.hooks.pick.tapPromise(e.tag,function(){var e=ue(ce().mark(function e(t){return ce().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",i.pick(l,t));case 1:case"end":return e.stop()}},e)}));return function(t){return e.apply(this,arguments)}}()),a.hooks.pickSync.tap(e.tag,function(e){return i.pick(l,e)})}},{key:"pick",value:function(e,r){var n,i=r.topmost,a=r.position,o=A(he,a.x,a.y,0),l=[],c=Q(e.elementsFromBBox(o[0],o[1],o[0],o[1]));try{for(c.s();!(n=c.n()).done;){var s=n.value,u=s.getWorldTransform();if(this.isHit(s,o,u,!1)){var h=t.findClosestClipPathTarget(s);if(h){var f=h.parsedStyle.clipPath;if(this.isHit(f,o,f.getWorldTransform(),!0)){if(i)return r.picked=[s],r;l.push(s)}}else{if(i)return r.picked=[s],r;l.push(s)}}}}catch(e){c.e(e)}finally{c.f()}return r.picked=l,r}}])}(); | ||
| var e,t,r="function"==typeof Symbol?Symbol:{},n=r.iterator||"@@iterator",i=r.toStringTag||"@@toStringTag";function a(r,n,i,a){var c=Object.create((n&&n.prototype instanceof l?n:l).prototype);return ee(c,"_invoke",function(r,n,i){var a,l,c,s=0,u=i||[],f=!1,h={p:0,n:0,v:e,a:d,f:d.bind(e,4),d:function(t,r){return a=t,l=0,c=e,h.n=r,o}};function d(r,n){for(l=r,c=n,t=0;!f&&s&&!i&&u.length>t;t++){var i,a=u[t],d=h.p,v=a[2];r>3?(i=v===n)&&(c=a[(l=a[4])?5:(l=3,3)],a[4]=a[5]=e):d>=a[0]&&((i=2>r&&a[1]>d)?(l=0,h.v=n,h.n=a[1]):v>d&&(i=3>r||a[0]>n||n>v)&&(a[4]=r,a[5]=n,h.n=v,l=0))}if(i||r>1)return o;throw f=!0,n}return function(i,u,v){if(s>1)throw TypeError("Generator is already running");for(f&&1===u&&d(u,v),l=u,c=v;(t=2>l?e:c)||!f;){a||(l?3>l?(l>1&&(h.n=-1),d(l,c)):h.n=c:h.v=c);try{if(s=2,a){if(l||(i="next"),t=a[i]){if(!(t=t.call(a,c)))throw TypeError("iterator result is not an object");if(!t.done)return t;c=t.value,2>l&&(l=0)}else 1===l&&(t=a.return)&&t.call(a),2>l&&(c=TypeError("The iterator does not provide a '"+i+"' method"),l=1);a=e}else if((t=(f=0>h.n)?c:r.call(n,h))!==o)break}catch(t){a=e,l=1,c=t}finally{s=1}}return{value:t,done:f}}}(r,i,a),!0),c}var o={};function l(){}function c(){}function s(){}t=Object.getPrototypeOf;var u=[][n]?t(t([][n]())):(ee(t={},n,function(){return this}),t),f=s.prototype=l.prototype=Object.create(u);function h(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,s):(e.__proto__=s,ee(e,i,"GeneratorFunction")),e.prototype=Object.create(f),e}return c.prototype=s,ee(f,"constructor",s),ee(s,"constructor",c),c.displayName="GeneratorFunction",ee(s,i,"GeneratorFunction"),ee(f),ee(f,i,"Generator"),ee(f,n,function(){return this}),ee(f,"toString",function(){return"[object Generator]"}),(te=function(){return{w:a,m:h}})()}function re(e,t){function r(n,i,a,o){try{var l=e[n](i),c=l.value;return c instanceof K?t.resolve(c.v).then(function(e){r("next",e,a,o)},function(e){r("throw",e,a,o)}):t.resolve(c).then(function(e){l.value=e,a(l)},function(e){return r("throw",e,a,o)})}catch(e){o(e)}}var n;this.next||(ee(re.prototype),ee(re.prototype,"function"==typeof Symbol&&Symbol.asyncIterator||"@asyncIterator",function(){return this})),ee(this,"_invoke",function(e,i,a){function o(){return new t(function(t,n){r(e,a,t,n)})}return n=n?n.then(o,o):o()},!0)}function ne(e,t,r,n,i){return new re(te().w(e,t,r,n),i||Promise)}function ie(e,t,r,n,i){var a=ne(e,t,r,n,i);return a.next().then(function(e){return e.done?e.value:a.next()})}function ae(e){var t=Object(e),r=[];for(var n in t)r.unshift(n);return function e(){for(;r.length;)if((n=r.pop())in t)return e.value=n,e.done=!1,e;return e.done=!0,e}}function oe(e){if(null!=e){var t=e["function"==typeof Symbol&&Symbol.iterator||"@@iterator"],n=0;if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length))return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}}}throw new TypeError(r(e)+" is not iterable")}function le(){var e=te(),t=e.m(le),r=(Object.getPrototypeOf?Object.getPrototypeOf(t):t.__proto__).constructor;function n(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===r||"GeneratorFunction"===(t.displayName||t.name))}var i={throw:1,return:2,break:3,continue:3};function a(e){var t,r;return function(n){t||(t={stop:function(){return r(n.a,2)},catch:function(){return n.v},abrupt:function(e,t){return r(n.a,i[e],t)},delegateYield:function(e,i,a){return t.resultName=i,r(n.d,oe(e),a)},finish:function(e){return r(n.f,e)}},r=function(e,r,i){n.p=t.prev,n.n=t.next;try{return e(r,i)}finally{t.next=n.n}}),t.resultName&&(t[t.resultName]=n.v,t.resultName=void 0),t.sent=n.v,t.next=n.n;try{return e.call(this,t)}finally{n.p=t.prev,n.n=t.next}}}return(le=function(){return{wrap:function(t,r,n,i){return e.w(a(t),r,n,i&&i.reverse())},isGeneratorFunction:n,mark:e.m,awrap:function(e,t){return new K(e,t)},AsyncIterator:re,async:function(e,t,r,i,o){return(n(t)?ne:ie)(a(e),t,r,i,o)},keys:ae,values:oe}})()}function ce(e,t,r,n,i,a,o){try{var l=e[a](o),c=l.value}catch(e){return void r(e)}l.done?t(c):Promise.resolve(c).then(n,i)}function se(e){return function(){var t=this,r=arguments;return new Promise(function(n,i){var a=e.apply(t,r);function o(e){ce(a,n,i,o,l,"next",e)}function l(e){ce(a,n,i,o,l,"throw",e)}o(void 0)})}}var ue=P(),fe=P(),he=P(),de=M(),ve=function(){function e(){var r=this;o(this,e),this.isHit=function(e,n,i,a){var o,l,c,s,u,f,h,d,v,p,y,g,m,b,x,S,w,M,k,O,C,P,R,E,D,I,j,F,L,N,B,G=r.context.pointInPathPickerFactory[e.nodeName];if(G){var W=(o=de,(B=(k=(c=(l=i)[0])*(d=l[5])-(s=l[1])*(h=l[4]))*(N=(m=l[10])*(M=l[15])-(b=l[11])*(w=l[14]))-(O=c*(v=l[6])-(u=l[2])*h)*(L=(g=l[9])*M-b*(S=l[13]))+(C=c*(p=l[7])-(f=l[3])*h)*(F=g*w-m*S)+(P=s*v-u*d)*(j=(y=l[8])*M-b*(x=l[12]))-(R=s*p-f*d)*(I=y*w-m*x)+(E=u*p-f*v)*(D=y*S-g*x))?(o[0]=(d*N-v*L+p*F)*(B=1/B),o[1]=(u*L-s*N-f*F)*B,o[2]=(S*E-w*R+M*P)*B,o[3]=(m*R-g*E-b*P)*B,o[4]=(v*j-h*N-p*I)*B,o[5]=(c*N-u*j+f*I)*B,o[6]=(w*C-x*E-M*O)*B,o[7]=(y*E-m*C+b*O)*B,o[8]=(h*L-d*j+p*D)*B,o[9]=(s*j-c*L-f*D)*B,o[10]=(x*R-S*C+M*k)*B,o[11]=(g*C-y*R-b*k)*B,o[12]=(d*I-h*F-v*D)*B,o[13]=(c*F-s*I+u*D)*B,o[14]=(S*O-x*P-w*k)*B,o[15]=(y*P-g*O+m*k)*B,o):null),_=A(fe,T(he,n[0],n[1],0),W);if(G(e,new t.Point(_[0],_[1]),a,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),i=r.context.pathGeneratorFactory[e.nodeName];return i&&(n.beginPath(),i(n,e.parsedStyle),n.closePath()),n.isPointInPath(t.x,t.y)}}return a(e,[{key:"apply",value:function(t,r){var n,i=this,a=t.renderingService,o=t.renderingContext;this.context=t,this.runtime=r;var l=null===(n=o.root)||void 0===n?void 0:n.ownerDocument;a.hooks.pick.tapPromise(e.tag,function(){var e=se(le().mark(function e(t){return le().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",i.pick(l,t));case 1:case"end":return e.stop()}},e)}));return function(t){return e.apply(this,arguments)}}()),a.hooks.pickSync.tap(e.tag,function(e){return i.pick(l,e)})}},{key:"pick",value:function(e,r){var n,i=r.topmost,a=r.position,o=T(ue,a.x,a.y,0),l=[],c=Q(e.elementsFromBBox(o[0],o[1],o[0],o[1]));try{for(c.s();!(n=c.n()).done;){var s=n.value,u=s.getWorldTransform();if(this.isHit(s,o,u,!1)){var f=t.findClosestClipPathTarget(s);if(f){var h=f.parsedStyle.clipPath;if(this.isHit(h,o,h.getWorldTransform(),!0)){if(i)return r.picked=[s],r;l.push(s)}}else{if(i)return r.picked=[s],r;l.push(s)}}}}catch(e){c.e(e)}finally{c.f()}return r.picked=l,r}}])}();function pe(e){return function(e){if(Array.isArray(e))return y(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||g(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.")}()} | ||
| /*! | ||
@@ -16,7 +16,6 @@ * @antv/g-math | ||
| * @version 3.1.0 | ||
| * @date 12/22/2025, 3:02:36 AM | ||
| * @date 12/24/2025, 11:55:15 AM | ||
| * @author AntVis | ||
| * @docs https://g.antv.antgroup.com/ | ||
| */ | ||
| function ye(e,t,r,n){var i=e-r,a=t-n;return Math.sqrt(i*i+a*a)}pe.tag="CanvasPicker";function ge(e,t,r,n,i,a){var o=-1,l=1/0,c=[r,n],s=20;a&&a>200&&(s=a/10);for(var u=1/s,h=u/10,f=0;s>=f;f++){var d=f*u,v=[i.apply(void 0,b(e.concat([d]))),i.apply(void 0,b(t.concat([d])))],p=ye(c[0],c[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 g=0;32>g&&1e-4<=h;g++){var m=o-h,x=o+h,S=[i.apply(void 0,b(e.concat([m]))),i.apply(void 0,b(t.concat([m])))],w=ye(c[0],c[1],S[0],S[1]);if(m>=0&&l>w)o=m,l=w;else{var M=[i.apply(void 0,b(e.concat([x]))),i.apply(void 0,b(t.concat([x])))],k=ye(c[0],c[1],M[0],M[1]);1>=x&&l>k?(o=x,l=k):h*=.5}}return{x:i.apply(void 0,b(e.concat([o]))),y:i.apply(void 0,b(t.concat([o])))}}function me(e,t,r,n,i,a){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((i-e)*(i-e)+(a-t)*(a-t));var l=[-o[1],o[0]];return function(e,t){var r=t[0],n=t[1],i=r*r+n*n;i>0&&(i=1/Math.sqrt(i)),e[0]=t[0]*i,e[1]=t[1]*i}(l,l),Math.abs(function(e,t){return e[0]*t[0]+e[1]*t[1]}([i-e,a-t],l))}function be(e,t,r,n,i){var a=1-i;return a*a*a*e+3*t*i*a*a+3*r*i*i*a+n*i*i*i}function xe(e,t,r,n,i,a,o,l,c,s,u){var h=function(e,t,r,n,i,a,o,l,c,s,u){return ge([e,r,i,o],[t,n,a,l],c,s,be,u)}(e,t,r,n,i,a,o,l,c,s,u);return ye(h.x,h.y,c,s)}function Se(e,t,r,n){var i=1-n;return i*i*e+2*n*i*t+n*n*r}function we(e,t,r,n,i,a,o,l){var c=function(e,t,r,n,i,a,o,l){return ge([e,r,i],[t,n,a],o,l,Se)}(e,t,r,n,i,a,o,l);return ye(c.x,c.y,o,l)}function Me(e,r,n){var i=e.parsedStyle,a=i.cx,o=i.cy,l=i.r,c=i.fill,s=i.stroke,u=i.lineWidth,h=i.increasedLineWidthForHitTesting,f=i.pointerEvents,d=void 0===f?"auto":f,v=((void 0===u?1:u)+(void 0===h?0:h))/2,p=ye(void 0===a?0:a,void 0===o?0:o,r.x,r.y),y=m(t.isFillOrStrokeAffected(d,c,s),2),g=y[0],b=y[1];return g&&b||n?l+v>=p:g?l>=p:!!b&&(p>=l-v&&l+v>=p)}function ke(e,t,r,n){return e/(r*r)+t/(n*n)}function Oe(e,r,n){var i=e.parsedStyle,a=i.cx,o=void 0===a?0:a,l=i.cy,c=void 0===l?0:l,s=i.rx,u=i.ry,h=i.lineWidth,f=void 0===h?1:h,d=i.increasedLineWidthForHitTesting,v=void 0===d?0:d,p=i.pointerEvents,y=r.x,g=r.y,b=m(t.isFillOrStrokeAffected(void 0===p?"auto":p,i.fill,i.stroke),2),x=b[0],S=b[1],w=(f+v)/2,M=(y-o)*(y-o),k=(g-c)*(g-c);return x&&S||n?1>=ke(M,k,s+w,u+w):x?1>=ke(M,k,s,u):!!S&&(ke(M,k,s-w,u-w)>=1&&1>=ke(M,k,s+w,u+w))}function Ce(e,t,r,n,i,a){return!(e>i||i>e+r||t>a||a>t+n)}function Pe(e,t,r,n,i,a,o,l){var c=(Math.atan2(l-t,o-e)+2*Math.PI)%(2*Math.PI),s={x:e+r*Math.cos(c),y:t+r*Math.sin(c)};return ye(s.x,s.y,o,l)<=a/2}function Te(e,t,r,n,i,a,o){var l=i/2;return!(Math.min(e,r)-l>a||a>Math.max(e,r)+l||Math.min(t,n)-l>o||o>Math.max(t,n)+l)&&me(e,t,r,n,a,o)<=i/2}function Ae(e,t,r,n,i){var a=e.length;if(2>a)return!1;for(var o=0;a-1>o;o++){if(Te(e[o][0],e[o][1],e[o+1][0],e[o+1][1],t,r,n))return!0}if(i){var l=e[0],c=e[a-1];if(Te(l[0],l[1],c[0],c[1],t,r,n))return!0}return!1}function Ee(e){return 1e-6>Math.abs(e)?0:0>e?-1:1}function Re(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,i=e.length;if(2>=i)return!1;for(var a=0;i>a;a++){var o=e[a],l=e[(a+1)%i];if(Re(o,l,[t,r]))return!0;Ee(o[1]-r)>0!=Ee(l[1]-r)>0&&0>Ee(t-(r-o[1])*(o[0]-l[0])/(o[1]-l[1])-o[0])&&(n=!n)}return n}function Le(e,t,r){for(var n=!1,i=0;e.length>i;i++){if(n=De(e[i],t,r))break}return n}function Ie(e,r,n){var i=e.parsedStyle,a=i.x1,o=i.y1,l=i.x2,c=i.y2,s=i.lineWidth,u=void 0===s?1:s,h=i.increasedLineWidthForHitTesting,f=void 0===h?0:h,d=i.pointerEvents;return!(!m(t.isFillOrStrokeAffected(void 0===d?"auto":d,i.fill,i.stroke),2)[1]&&!n||!u)&&Te(a,o,l,c,u+f,r.x,r.y)}function je(e,r,n,i,a,o){var l=e.parsedStyle,c=l.lineWidth,s=void 0===c?1:c,u=l.increasedLineWidthForHitTesting,h=void 0===u?0:u,f=l.d,d=l.pointerEvents,v=f.segments,p=f.hasArc,y=f.polylines,g=f.polygons,b=m(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),M=!1;return x||n?M=p?i(e,r):Le(g,r.x,r.y)||Le(y,r.x,r.y):((S||n)&&(M=function(e,t,r,n,i){for(var a=!1,o=t/2,l=0;e.length>l;l++){var c=e[l],s=c.currentPoint,u=c.params,h=c.prePoint,f=c.box;if(!f||Ce(f.x-o,f.y-o,f.width+t,f.height+t,r,n))switch(c.command){case"L":case"Z":if(a=Te(h[0],h[1],s[0],s[1],t,r,n))return!0;break;case"Q":if(a=t/2>=we(h[0],h[1],u[1],u[2],u[3],u[4],r,n))return!0;break;case"C":if(a=t/2>=xe(h[0],h[1],u[1],u[2],u[3],u[4],u[5],u[6],r,n,i))return!0;break;case"A":c.cubicParams||(c.cubicParams=I(h[0],h[1],u[1],u[2],u[3],u[4],u[5],u[6],u[7],void 0));for(var d=c.cubicParams,v=h,p=0;d.length>p;p+=6){var y=xe(v[0],v[1],d[p],d[p+1],d[p+2],d[p+3],d[p+4],d[p+5],r,n,i);if(v=[d[p+4],d[p+5]],a=t/2>=y)return!0}}}return a}(v,s+h,r.x,r.y,w)),M)}function Fe(e,r,n){var i=e.parsedStyle,a=i.lineWidth,o=void 0===a?1:a,l=i.increasedLineWidthForHitTesting,c=void 0===l?0:l,s=i.points,u=i.pointerEvents,h=m(t.isFillOrStrokeAffected(void 0===u?"auto":u,i.fill,i.stroke),2),f=h[0],d=!1;return(h[1]||n)&&(d=Ae(s.points,o+c,r.x,r.y,!0)),d||!f&&!n||(d=De(s.points,r.x,r.y)),d}function Be(e,r,n){var i=e.parsedStyle,a=i.lineWidth,o=void 0===a?1:a,l=i.increasedLineWidthForHitTesting,c=void 0===l?0:l,s=i.points,u=i.pointerEvents;return!(!m(t.isFillOrStrokeAffected(void 0===u?"auto":u,i.fill,i.stroke),2)[1]&&!n||!o)&&Ae(s.points,o+c,r.x,r.y,!1)}function Ne(e,r,n,i,a){var o=e.parsedStyle,l=o.radius,c=o.lineWidth,s=void 0===c?1:c,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,y=o.width,g=o.height,b=o.pointerEvents,x=m(t.isFillOrStrokeAffected(void 0===b?"auto":b,o.fill,o.stroke),2),S=x[0],w=x[1],M=s+h;if(l&&l.some(function(e){return 0!==e})){var k=!1;return(w||n)&&(k=function(e,t,r,n,i,a,o,l){var c=m(i,4),s=c[0],u=c[1],h=c[2],f=c[3];return Te(e+s,t,e+r-u,t,a,o,l)||Te(e+r,t+u,e+r,t+n-h,a,o,l)||Te(e+r-h,t+n,e+f,t+n,a,o,l)||Te(e,t+n-f,e,t+s,a,o,l)||Pe(e+r-u,t+u,u,0,0,a,o,l)||Pe(e+r-h,t+n-h,h,0,0,a,o,l)||Pe(e+f,t+n-f,f,0,0,a,o,l)||Pe(e+s,t+s,s,0,0,a,o,l)}(d,p,y,g,l.map(function(e){return D(e,0,Math.min(Math.abs(y)/2,Math.abs(g)/2))}),M,r.x,r.y)),k||!S&&!n||(k=i(e,r)),k}var O=M/2;return S&&w||n?Ce(d-O,p-O,y+O,g+O,r.x,r.y):S?Ce(d,p,y,g,r.x,r.y):!!w&&function(e,t,r,n,i,a,o){var l=i/2;return Ce(e-l,t-l,r,i,a,o)||Ce(e+r-l,t-l,i,n,a,o)||Ce(e+l,t+n-l,r,i,a,o)||Ce(e-l,t+l,i,n,a,o)}(d,p,y,g,M,r.x,r.y)}function Ge(e,r,n,i,a,o){var l=e.parsedStyle,c=l.pointerEvents,s=l.x,u=void 0===s?0:s,h=l.y,f=void 0===h?0:h,d=l.width,v=l.height;if("non-transparent-pixel"===(void 0===c?"auto":c)){var y=a.config.offscreenCanvas,g=o.offscreenCanvasCreator.getOrCreateCanvas(y),m=o.offscreenCanvasCreator.getOrCreateContext(y,{willReadFrequently:!0});return g.width=d,g.height=v,a.defaultStyleRendererFactory[t.Shape.IMAGE].render(m,p(p({},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 We(e,t,r,n){var i=e.getGeometryBounds();return!(i.min[0]>t.x||i.min[1]>t.y||t.x>i.max[0]||t.y>i.max[1])}var _e=function(e){function r(){var e;o(this,r);for(var t=arguments.length,n=Array(t),i=0;t>i;i++)n[i]=arguments[i];return(e=u(this,r,[].concat(n))).name="canvas-picker",e}return f(r,e),a(r,[{key:"init",value:function(){var e,r=(d(d(d(d(d(d(d(d(d(d(e={},t.Shape.CIRCLE,Me),t.Shape.ELLIPSE,Oe),t.Shape.RECT,Ne),t.Shape.LINE,Ie),t.Shape.POLYLINE,Be),t.Shape.POLYGON,Fe),t.Shape.PATH,je),t.Shape.TEXT,We),t.Shape.GROUP,null),t.Shape.IMAGE,Ge),d(d(e,t.Shape.HTML,null),t.Shape.MESH,null));this.context.pointInPathPickerFactory=r,this.addRenderingPlugin(new pe)}},{key:"destroy",value:function(){delete this.context.pointInPathPickerFactory,this.removeAllRenderingPlugins()}}])}(t.AbstractRendererPlugin),He=Object.freeze({__proto__:null,Plugin:_e});function $e(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 Ye(e,t){var r=t.cx,n=void 0===r?0:r,i=t.cy,a=void 0===i?0:i,o=t.rx,l=t.ry;if(e.ellipse)e.ellipse(n,a,o,l,0,0,2*Math.PI,!1);else{var c=o>l?o:l,s=o>l?1:o/l,u=o>l?l/o:1;e.save(),e.scale(s,u),e.arc(n,a,c,0,2*Math.PI)}}function ze(e,r){var n=r.x1,i=r.y1,a=r.x2,o=r.y2,l=r.markerStart,c=r.markerEnd,s=r.markerStartOffset,u=r.markerEndOffset,h=0,f=0,d=0,v=0,p=0;l&&t.isDisplayObject(l)&&s&&(h=Math.cos(p=Math.atan2(o-i,a-n))*(s||0),f=Math.sin(p)*(s||0)),c&&t.isDisplayObject(c)&&u&&(d=Math.cos(p=Math.atan2(i-o,n-a))*(u||0),v=Math.sin(p)*(u||0)),e.moveTo(n+h,i+f),e.lineTo(a+d,o+v)}function Xe(e,r){var n=r.markerStart,i=r.markerEnd,a=r.markerStartOffset,o=r.markerEndOffset,l=r.d,c=l.absolutePath,s=l.segments,u=0,h=0,f=0,d=0,v=0;if(n&&t.isDisplayObject(n)&&a){var p=m(n.parentNode.getStartTangent(),2),y=p[0],g=p[1];u=Math.cos(v=Math.atan2(y[1]-g[1],y[0]-g[0]))*(a||0),h=Math.sin(v)*(a||0)}if(i&&t.isDisplayObject(i)&&o){var b=m(i.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;c.length>w;w++){var M=c[w],k=M[0],O=c[w+1],C=(w===c.length-1||O&&("M"===O[0]||"Z"===O[0]))&&0!==f&&0!==d,P=m(0===w&&(0!==u||0!==h)?[u,h]:[0,0],2),T=P[0],A=P[1],E=m(C?[f,d]:[0,0],2),R=E[0],D=E[1];switch(k){case"M":e.moveTo(M[1]+T,M[2]+A);break;case"L":e.lineTo(M[1]+R,M[2]+D);break;case"Q":e.quadraticCurveTo(M[1],M[2],M[3]+R,M[4]+D);break;case"C":e.bezierCurveTo(M[1],M[2],M[3],M[4],M[5]+R,M[6]+D);break;case"A":var L=s[w].arcParams,I=L.cx,j=L.cy,F=L.rx,B=L.ry,N=L.startAngle,G=L.endAngle,W=L.xRotation,_=L.sweepFlag;if(e.ellipse)e.ellipse(I,j,F,B,W,N,G,!!(1-_));else{var H=F>B?F:B,$=F>B?1:F/B,Y=F>B?B/F:1;e.translate(I,j),e.rotate(W),e.scale($,Y),e.arc(0,0,H,N,G,!!(1-_)),e.scale(1/$,1/Y),e.rotate(-W),e.translate(-I,-j)}C&&e.lineTo(M[6]+f,M[7]+d);break;case"Z":e.closePath()}}}function Ue(e,r){var n=r.markerStart,i=r.markerEnd,a=r.markerStartOffset,o=r.markerEndOffset,l=r.points.points,c=l.length,s=l[0][0],u=l[0][1],h=l[c-1][0],f=l[c-1][1],d=0,v=0,p=0,y=0,g=0;n&&t.isDisplayObject(n)&&a&&(d=Math.cos(g=Math.atan2(l[1][1]-l[0][1],l[1][0]-l[0][0]))*(a||0),v=Math.sin(g)*(a||0)),i&&t.isDisplayObject(i)&&o&&(p=Math.cos(g=Math.atan2(l[c-1][1]-l[0][1],l[c-1][0]-l[0][0]))*(o||0),y=Math.sin(g)*(o||0)),e.moveTo(s+(d||p),u+(v||y));for(var m=1;c-1>m;m++){var b=l[m];e.lineTo(b[0],b[1])}e.lineTo(h,f)}function qe(e,r){var n=r.markerStart,i=r.markerEnd,a=r.markerStartOffset,o=r.markerEndOffset,l=r.points.points,c=l.length,s=l[0][0],u=l[0][1],h=l[c-1][0],f=l[c-1][1],d=0,v=0,p=0,y=0,g=0;n&&t.isDisplayObject(n)&&a&&(d=Math.cos(g=Math.atan2(l[1][1]-l[0][1],l[1][0]-l[0][0]))*(a||0),v=Math.sin(g)*(a||0)),i&&t.isDisplayObject(i)&&o&&(p=Math.cos(g=Math.atan2(l[c-2][1]-l[c-1][1],l[c-2][0]-l[c-1][0]))*(o||0),y=Math.sin(g)*(o||0)),e.moveTo(s+d,u+v);for(var m=1;c-1>m;m++){var b=l[m];e.lineTo(b[0],b[1])}e.lineTo(h+p,f+y)}function Ve(e,t){var r=t.x,n=void 0===r?0:r,i=t.y,a=void 0===i?0:i,o=t.radius,l=t.width,c=t.height,s=l,u=c;if(o&&o.some(function(e){return 0!==e})){var h=l>0?1:-1,f=c>0?1:-1,d=h+f===0,v=m(o.map(function(e){return D(e,0,Math.min(Math.abs(s)/2,Math.abs(u)/2))}),4),p=v[0],y=v[1],g=v[2],b=v[3];e.moveTo(h*p+n,a),e.lineTo(s-h*y+n,a),0!==y&&e.arc(s-h*y+n,f*y+a,y,-f*Math.PI/2,h>0?0:Math.PI,d),e.lineTo(s+n,u-f*g+a),0!==g&&e.arc(s-h*g+n,u-f*g+a,g,h>0?0:Math.PI,f>0?Math.PI/2:1.5*Math.PI,d),e.lineTo(h*b+n,u+a),0!==b&&e.arc(h*b+n,u-f*b+a,b,f>0?Math.PI/2:-Math.PI/2,h>0?Math.PI:0,d),e.lineTo(n,f*p+a),0!==p&&e.arc(h*p+n,f*p+a,p,h>0?Math.PI:0,f>0?1.5*Math.PI:Math.PI/2,d)}else e.rect(n,a,s,u)}var Qe=function(e){function r(){var e;o(this,r);for(var t=arguments.length,n=Array(t),i=0;t>i;i++)n[i]=arguments[i];return(e=u(this,r,[].concat(n))).name="canvas-path-generator",e}return f(r,e),a(r,[{key:"init",value:function(){var e,r=(d(d(d(d(d(d(d(d(d(d(e={},t.Shape.CIRCLE,$e),t.Shape.ELLIPSE,Ye),t.Shape.RECT,Ve),t.Shape.LINE,ze),t.Shape.POLYLINE,qe),t.Shape.POLYGON,Ue),t.Shape.PATH,Xe),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),Je=Object.freeze({__proto__:null,Plugin:Qe}),Ze=function(){return a(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="string"==typeof 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=ue(ce().mark(function e(){var t,r=arguments;return ce().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 1:case"end":return e.stop()}},e,this)})),function(){return e.apply(this,arguments)})}]);var e}(),Ke=function(e){function t(){var e;o(this,t);for(var r=arguments.length,n=Array(r),i=0;r>i;i++)n[i]=arguments[i];return(e=u(this,t,[].concat(n))).name="canvas-context-register",e}return f(t,e),a(t,[{key:"init",value:function(){this.context.ContextService=Ze}},{key:"destroy",value:function(){delete this.context.ContextService}}])}(t.AbstractRendererPlugin),et=function(e){function r(e){var n;return o(this,r),(n=u(this,r,[e])).registerPlugin(new Ke),n.registerPlugin(new t.ImageLoader.Plugin),n.registerPlugin(new Qe),n.registerPlugin(new Z),n.registerPlugin(new t.DomInteraction.Plugin),n.registerPlugin(new _e),n.registerPlugin(new t.HTMLRenderer.Plugin),n}return f(r,e),a(r)}(t.AbstractRenderer);Object.defineProperty(e,"DomInteraction",{enumerable:!0,get:function(){return t.DomInteraction}}),Object.defineProperty(e,"HTMLRenderer",{enumerable:!0,get:function(){return t.HTMLRenderer}}),Object.defineProperty(e,"ImageLoader",{enumerable:!0,get:function(){return t.ImageLoader}}),e.CanvasPathGenerator=Je,e.CanvasPicker=He,e.CanvasRenderer=K,e.Renderer=et}); | ||
| */function ye(e,t,r,n){var i=e-r,a=t-n;return Math.sqrt(i*i+a*a)}ve.tag="CanvasPicker";function ge(e,t,r,n,i,a){var o=-1,l=1/0,c=[r,n],s=20;a&&a>200&&(s=a/10);for(var u=1/s,f=u/10,h=0;s>=h;h++){var d=h*u,v=[i.apply(void 0,pe(e.concat([d]))),i.apply(void 0,pe(t.concat([d])))],p=ye(c[0],c[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 g=0;32>g&&1e-4<=f;g++){var m=o-f,b=o+f,x=[i.apply(void 0,pe(e.concat([m]))),i.apply(void 0,pe(t.concat([m])))],S=ye(c[0],c[1],x[0],x[1]);if(m>=0&&l>S)o=m,l=S;else{var w=[i.apply(void 0,pe(e.concat([b]))),i.apply(void 0,pe(t.concat([b])))],M=ye(c[0],c[1],w[0],w[1]);1>=b&&l>M?(o=b,l=M):f*=.5}}return{x:i.apply(void 0,pe(e.concat([o]))),y:i.apply(void 0,pe(t.concat([o])))}}function me(e,t,r,n,i,a){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((i-e)*(i-e)+(a-t)*(a-t));var l=[-o[1],o[0]];return function(e,t){var r=t[0],n=t[1],i=r*r+n*n;i>0&&(i=1/Math.sqrt(i)),e[0]=t[0]*i,e[1]=t[1]*i}(l,l),Math.abs(function(e,t){return e[0]*t[0]+e[1]*t[1]}([i-e,a-t],l))}function be(e,t,r,n,i){var a=1-i;return a*a*a*e+3*t*i*a*a+3*r*i*i*a+n*i*i*i}function xe(e,t,r,n,i,a,o,l,c,s,u){var f=function(e,t,r,n,i,a,o,l,c,s,u){return ge([e,r,i,o],[t,n,a,l],c,s,be,u)}(e,t,r,n,i,a,o,l,c,s,u);return ye(f.x,f.y,c,s)}function Se(e,t,r,n){var i=1-n;return i*i*e+2*n*i*t+n*n*r}function we(e,t,r,n,i,a,o,l){var c=function(e,t,r,n,i,a,o,l){return ge([e,r,i],[t,n,a],o,l,Se)}(e,t,r,n,i,a,o,l);return ye(c.x,c.y,o,l)}function Me(e,r,n){var i=e.parsedStyle,a=i.cx,o=i.cy,l=i.r,c=i.fill,s=i.stroke,u=i.lineWidth,f=i.increasedLineWidthForHitTesting,h=i.pointerEvents,d=void 0===h?"auto":h,v=((void 0===u?1:u)+(void 0===f?0:f))/2,p=ye(void 0===a?0:a,void 0===o?0:o,r.x,r.y),y=m(t.isFillOrStrokeAffected(d,c,s),2),g=y[0],b=y[1];return g&&b||n?l+v>=p:g?l>=p:!!b&&(p>=l-v&&l+v>=p)}function ke(e,t,r,n){return e/(r*r)+t/(n*n)}function Oe(e,r,n){var i=e.parsedStyle,a=i.cx,o=void 0===a?0:a,l=i.cy,c=void 0===l?0:l,s=i.rx,u=i.ry,f=i.lineWidth,h=void 0===f?1:f,d=i.increasedLineWidthForHitTesting,v=void 0===d?0:d,p=i.pointerEvents,y=r.x,g=r.y,b=m(t.isFillOrStrokeAffected(void 0===p?"auto":p,i.fill,i.stroke),2),x=b[0],S=b[1],w=(h+v)/2,M=(y-o)*(y-o),k=(g-c)*(g-c);return x&&S||n?1>=ke(M,k,s+w,u+w):x?1>=ke(M,k,s,u):!!S&&(ke(M,k,s-w,u-w)>=1&&1>=ke(M,k,s+w,u+w))}function Ce(e,t,r,n,i,a){return!(e>i||i>e+r||t>a||a>t+n)}function Pe(e,t,r,n,i,a,o,l){var c=(Math.atan2(l-t,o-e)+2*Math.PI)%(2*Math.PI),s={x:e+r*Math.cos(c),y:t+r*Math.sin(c)};return ye(s.x,s.y,o,l)<=a/2}function Te(e,t,r,n,i,a,o){var l=i/2;return!(Math.min(e,r)-l>a||a>Math.max(e,r)+l||Math.min(t,n)-l>o||o>Math.max(t,n)+l)&&me(e,t,r,n,a,o)<=i/2}function Ae(e,t,r,n,i){var a=e.length;if(2>a)return!1;for(var o=0;a-1>o;o++){if(Te(e[o][0],e[o][1],e[o+1][0],e[o+1][1],t,r,n))return!0}if(i){var l=e[0],c=e[a-1];if(Te(l[0],l[1],c[0],c[1],t,r,n))return!0}return!1}function Re(e){return 1e-6>Math.abs(e)?0:0>e?-1:1}function Ee(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,i=e.length;if(2>=i)return!1;for(var a=0;i>a;a++){var o=e[a],l=e[(a+1)%i];if(Ee(o,l,[t,r]))return!0;Re(o[1]-r)>0!=Re(l[1]-r)>0&&0>Re(t-(r-o[1])*(o[0]-l[0])/(o[1]-l[1])-o[0])&&(n=!n)}return n}function Ie(e,t,r){for(var n=!1,i=0;e.length>i;i++){if(n=De(e[i],t,r))break}return n}function je(e,r,n){var i=e.parsedStyle,a=i.x1,o=i.y1,l=i.x2,c=i.y2,s=i.lineWidth,u=void 0===s?1:s,f=i.increasedLineWidthForHitTesting,h=void 0===f?0:f,d=i.pointerEvents;return!(!m(t.isFillOrStrokeAffected(void 0===d?"auto":d,i.fill,i.stroke),2)[1]&&!n||!u)&&Te(a,o,l,c,u+h,r.x,r.y)}function Fe(e,r,n,i,a,o){var l=e.parsedStyle,c=l.lineWidth,s=void 0===c?1:c,u=l.increasedLineWidthForHitTesting,f=void 0===u?0:u,h=l.d,d=l.pointerEvents,v=h.segments,p=h.hasArc,y=h.polylines,g=h.polygons,b=m(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),M=!1;return x||n?M=p?i(e,r):Ie(g,r.x,r.y)||Ie(y,r.x,r.y):((S||n)&&(M=function(e,t,r,n,i){for(var a=!1,o=t/2,l=0;e.length>l;l++){var c=e[l],s=c.currentPoint,u=c.params,f=c.prePoint,h=c.box;if(!h||Ce(h.x-o,h.y-o,h.width+t,h.height+t,r,n))switch(c.command){case"L":case"Z":if(a=Te(f[0],f[1],s[0],s[1],t,r,n))return!0;break;case"Q":if(a=t/2>=we(f[0],f[1],u[1],u[2],u[3],u[4],r,n))return!0;break;case"C":if(a=t/2>=xe(f[0],f[1],u[1],u[2],u[3],u[4],u[5],u[6],r,n,i))return!0;break;case"A":c.cubicParams||(c.cubicParams=I(f[0],f[1],u[1],u[2],u[3],u[4],u[5],u[6],u[7],void 0));for(var d=c.cubicParams,v=f,p=0;d.length>p;p+=6){var y=xe(v[0],v[1],d[p],d[p+1],d[p+2],d[p+3],d[p+4],d[p+5],r,n,i);if(v=[d[p+4],d[p+5]],a=t/2>=y)return!0}}}return a}(v,s+f,r.x,r.y,w)),M)}function Le(e,r,n){var i=e.parsedStyle,a=i.lineWidth,o=void 0===a?1:a,l=i.increasedLineWidthForHitTesting,c=void 0===l?0:l,s=i.points,u=i.pointerEvents,f=m(t.isFillOrStrokeAffected(void 0===u?"auto":u,i.fill,i.stroke),2),h=f[0],d=!1;return(f[1]||n)&&(d=Ae(s.points,o+c,r.x,r.y,!0)),d||!h&&!n||(d=De(s.points,r.x,r.y)),d}function Ne(e,r,n){var i=e.parsedStyle,a=i.lineWidth,o=void 0===a?1:a,l=i.increasedLineWidthForHitTesting,c=void 0===l?0:l,s=i.points,u=i.pointerEvents;return!(!m(t.isFillOrStrokeAffected(void 0===u?"auto":u,i.fill,i.stroke),2)[1]&&!n||!o)&&Ae(s.points,o+c,r.x,r.y,!1)}function Be(e,r,n,i,a){var o=e.parsedStyle,l=o.radius,c=o.lineWidth,s=void 0===c?1:c,u=o.increasedLineWidthForHitTesting,f=void 0===u?0:u,h=o.x,d=void 0===h?0:h,v=o.y,p=void 0===v?0:v,y=o.width,g=o.height,b=o.pointerEvents,x=m(t.isFillOrStrokeAffected(void 0===b?"auto":b,o.fill,o.stroke),2),S=x[0],w=x[1],M=s+f;if(l&&l.some(function(e){return 0!==e})){var k=!1;return(w||n)&&(k=function(e,t,r,n,i,a,o,l){var c=m(i,4),s=c[0],u=c[1],f=c[2],h=c[3];return Te(e+s,t,e+r-u,t,a,o,l)||Te(e+r,t+u,e+r,t+n-f,a,o,l)||Te(e+r-f,t+n,e+h,t+n,a,o,l)||Te(e,t+n-h,e,t+s,a,o,l)||Pe(e+r-u,t+u,u,0,0,a,o,l)||Pe(e+r-f,t+n-f,f,0,0,a,o,l)||Pe(e+h,t+n-h,h,0,0,a,o,l)||Pe(e+s,t+s,s,0,0,a,o,l)}(d,p,y,g,l.map(function(e){return E(e,0,Math.min(Math.abs(y)/2,Math.abs(g)/2))}),M,r.x,r.y)),k||!S&&!n||(k=i(e,r)),k}var O=M/2;return S&&w||n?Ce(d-O,p-O,y+O,g+O,r.x,r.y):S?Ce(d,p,y,g,r.x,r.y):!!w&&function(e,t,r,n,i,a,o){var l=i/2;return Ce(e-l,t-l,r,i,a,o)||Ce(e+r-l,t-l,i,n,a,o)||Ce(e+l,t+n-l,r,i,a,o)||Ce(e-l,t+l,i,n,a,o)}(d,p,y,g,M,r.x,r.y)}function Ge(e,r,n,i,a,o){var l=e.parsedStyle,c=l.pointerEvents,s=l.x,u=void 0===s?0:s,f=l.y,h=void 0===f?0:f,d=l.width,v=l.height;if("non-transparent-pixel"===(void 0===c?"auto":c)){var y=a.config.offscreenCanvas,g=o.offscreenCanvasCreator.getOrCreateCanvas(y),m=o.offscreenCanvasCreator.getOrCreateContext(y,{willReadFrequently:!0});return g.width=d,g.height=v,a.defaultStyleRendererFactory[t.Shape.IMAGE].render(m,p(p({},e.parsedStyle),{},{x:0,y:0}),e,void 0,void 0,void 0),m.getImageData(r.x-u,r.y-h,1,1).data.every(function(e){return 0!==e})}return!0}function We(e,t,r,n){var i=e.getGeometryBounds();return!(i.min[0]>t.x||i.min[1]>t.y||t.x>i.max[0]||t.y>i.max[1])}var _e=function(e){function r(){var e;o(this,r);for(var t=arguments.length,n=Array(t),i=0;t>i;i++)n[i]=arguments[i];return(e=u(this,r,[].concat(n))).name="canvas-picker",e}return h(r,e),a(r,[{key:"init",value:function(){var e,r=(d(d(d(d(d(d(d(d(d(d(e={},t.Shape.CIRCLE,Me),t.Shape.ELLIPSE,Oe),t.Shape.RECT,Be),t.Shape.LINE,je),t.Shape.POLYLINE,Ne),t.Shape.POLYGON,Le),t.Shape.PATH,Fe),t.Shape.TEXT,We),t.Shape.GROUP,null),t.Shape.IMAGE,Ge),d(d(e,t.Shape.HTML,null),t.Shape.MESH,null));this.context.pointInPathPickerFactory=r,this.addRenderingPlugin(new ve)}},{key:"destroy",value:function(){delete this.context.pointInPathPickerFactory,this.removeAllRenderingPlugins()}}])}(t.AbstractRendererPlugin),He=Object.freeze({__proto__:null,Plugin:_e});function $e(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 ze(e,t){var r=t.cx,n=void 0===r?0:r,i=t.cy,a=void 0===i?0:i,o=t.rx,l=t.ry;if(e.ellipse)e.ellipse(n,a,o,l,0,0,2*Math.PI,!1);else{var c=o>l?o:l,s=o>l?1:o/l,u=o>l?l/o:1;e.save(),e.scale(s,u),e.arc(n,a,c,0,2*Math.PI)}}function Ye(e,r){var n=r.x1,i=r.y1,a=r.x2,o=r.y2,l=r.markerStart,c=r.markerEnd,s=r.markerStartOffset,u=r.markerEndOffset,f=0,h=0,d=0,v=0,p=0;l&&t.isDisplayObject(l)&&s&&(f=Math.cos(p=Math.atan2(o-i,a-n))*(s||0),h=Math.sin(p)*(s||0)),c&&t.isDisplayObject(c)&&u&&(d=Math.cos(p=Math.atan2(i-o,n-a))*(u||0),v=Math.sin(p)*(u||0)),e.moveTo(n+f,i+h),e.lineTo(a+d,o+v)}function Xe(e,r){var n=r.markerStart,i=r.markerEnd,a=r.markerStartOffset,o=r.markerEndOffset,l=r.d,c=l.absolutePath,s=l.segments,u=0,f=0,h=0,d=0,v=0;if(n&&t.isDisplayObject(n)&&a){var p=m(n.parentNode.getStartTangent(),2),y=p[0],g=p[1];u=Math.cos(v=Math.atan2(y[1]-g[1],y[0]-g[0]))*(a||0),f=Math.sin(v)*(a||0)}if(i&&t.isDisplayObject(i)&&o){var b=m(i.parentNode.getEndTangent(),2),x=b[0],S=b[1];h=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;c.length>w;w++){var M=c[w],k=M[0],O=c[w+1],C=(w===c.length-1||O&&("M"===O[0]||"Z"===O[0]))&&0!==h&&0!==d,P=m(0===w&&(0!==u||0!==f)?[u,f]:[0,0],2),T=P[0],A=P[1],R=m(C?[h,d]:[0,0],2),E=R[0],D=R[1];switch(k){case"M":e.moveTo(M[1]+T,M[2]+A);break;case"L":e.lineTo(M[1]+E,M[2]+D);break;case"Q":e.quadraticCurveTo(M[1],M[2],M[3]+E,M[4]+D);break;case"C":e.bezierCurveTo(M[1],M[2],M[3],M[4],M[5]+E,M[6]+D);break;case"A":var I=s[w].arcParams,j=I.cx,F=I.cy,L=I.rx,N=I.ry,B=I.startAngle,G=I.endAngle,W=I.xRotation,_=I.sweepFlag;if(e.ellipse)e.ellipse(j,F,L,N,W,B,G,!!(1-_));else{var H=L>N?L:N,$=L>N?1:L/N,z=L>N?N/L:1;e.translate(j,F),e.rotate(W),e.scale($,z),e.arc(0,0,H,B,G,!!(1-_)),e.scale(1/$,1/z),e.rotate(-W),e.translate(-j,-F)}C&&e.lineTo(M[6]+h,M[7]+d);break;case"Z":e.closePath()}}}function qe(e,r){var n=r.markerStart,i=r.markerEnd,a=r.markerStartOffset,o=r.markerEndOffset,l=r.points.points,c=l.length,s=l[0][0],u=l[0][1],f=l[c-1][0],h=l[c-1][1],d=0,v=0,p=0,y=0,g=0;n&&t.isDisplayObject(n)&&a&&(d=Math.cos(g=Math.atan2(l[1][1]-l[0][1],l[1][0]-l[0][0]))*(a||0),v=Math.sin(g)*(a||0)),i&&t.isDisplayObject(i)&&o&&(p=Math.cos(g=Math.atan2(l[c-1][1]-l[0][1],l[c-1][0]-l[0][0]))*(o||0),y=Math.sin(g)*(o||0)),e.moveTo(s+(d||p),u+(v||y));for(var m=1;c-1>m;m++){var b=l[m];e.lineTo(b[0],b[1])}e.lineTo(f,h)}function Ve(e,r){var n=r.markerStart,i=r.markerEnd,a=r.markerStartOffset,o=r.markerEndOffset,l=r.points.points,c=l.length,s=l[0][0],u=l[0][1],f=l[c-1][0],h=l[c-1][1],d=0,v=0,p=0,y=0,g=0;n&&t.isDisplayObject(n)&&a&&(d=Math.cos(g=Math.atan2(l[1][1]-l[0][1],l[1][0]-l[0][0]))*(a||0),v=Math.sin(g)*(a||0)),i&&t.isDisplayObject(i)&&o&&(p=Math.cos(g=Math.atan2(l[c-2][1]-l[c-1][1],l[c-2][0]-l[c-1][0]))*(o||0),y=Math.sin(g)*(o||0)),e.moveTo(s+d,u+v);for(var m=1;c-1>m;m++){var b=l[m];e.lineTo(b[0],b[1])}e.lineTo(f+p,h+y)}function Qe(e,t){var r=t.x,n=void 0===r?0:r,i=t.y,a=void 0===i?0:i,o=t.radius,l=t.width,c=t.height,s=l,u=c;if(o&&o.some(function(e){return 0!==e})){var f=l>0?1:-1,h=c>0?1:-1,d=f+h===0,v=m(o.map(function(e){return E(e,0,Math.min(Math.abs(s)/2,Math.abs(u)/2))}),4),p=v[0],y=v[1],g=v[2],b=v[3];e.moveTo(f*p+n,a),e.lineTo(s-f*y+n,a),0!==y&&e.arc(s-f*y+n,h*y+a,y,-h*Math.PI/2,f>0?0:Math.PI,d),e.lineTo(s+n,u-h*g+a),0!==g&&e.arc(s-f*g+n,u-h*g+a,g,f>0?0:Math.PI,h>0?Math.PI/2:1.5*Math.PI,d),e.lineTo(f*b+n,u+a),0!==b&&e.arc(f*b+n,u-h*b+a,b,h>0?Math.PI/2:-Math.PI/2,f>0?Math.PI:0,d),e.lineTo(n,h*p+a),0!==p&&e.arc(f*p+n,h*p+a,p,f>0?Math.PI:0,h>0?1.5*Math.PI:Math.PI/2,d)}else e.rect(n,a,s,u)}var Ue=function(e){function r(){var e;o(this,r);for(var t=arguments.length,n=Array(t),i=0;t>i;i++)n[i]=arguments[i];return(e=u(this,r,[].concat(n))).name="canvas-path-generator",e}return h(r,e),a(r,[{key:"init",value:function(){var e,r=(d(d(d(d(d(d(d(d(d(d(e={},t.Shape.CIRCLE,$e),t.Shape.ELLIPSE,ze),t.Shape.RECT,Qe),t.Shape.LINE,Ye),t.Shape.POLYLINE,Ve),t.Shape.POLYGON,qe),t.Shape.PATH,Xe),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),Je=Object.freeze({__proto__:null,Plugin:Ue}),Ze=function(){return a(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="string"==typeof 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=se(le().mark(function e(){var t,r=arguments;return le().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 1:case"end":return e.stop()}},e,this)})),function(){return e.apply(this,arguments)})}]);var e}(),Ke=function(e){function t(){var e;o(this,t);for(var r=arguments.length,n=Array(r),i=0;r>i;i++)n[i]=arguments[i];return(e=u(this,t,[].concat(n))).name="canvas-context-register",e}return h(t,e),a(t,[{key:"init",value:function(){this.context.ContextService=Ze}},{key:"destroy",value:function(){delete this.context.ContextService}}])}(t.AbstractRendererPlugin),et=function(e){function r(e){var n;return o(this,r),(n=u(this,r,[e])).registerPlugin(new Ke),n.registerPlugin(new t.ImageLoader.Plugin),n.registerPlugin(new Ue),n.registerPlugin(new J),n.registerPlugin(new t.DomInteraction.Plugin),n.registerPlugin(new _e),n.registerPlugin(new t.HTMLRenderer.Plugin),n}return h(r,e),a(r)}(t.AbstractRenderer);Object.defineProperty(e,"DomInteraction",{enumerable:!0,get:function(){return t.DomInteraction}}),Object.defineProperty(e,"HTMLRenderer",{enumerable:!0,get:function(){return t.HTMLRenderer}}),Object.defineProperty(e,"ImageLoader",{enumerable:!0,get:function(){return t.ImageLoader}}),e.CanvasPathGenerator=Je,e.CanvasPicker=He,e.CanvasRenderer=Z,e.Renderer=et}); | ||
| //# sourceMappingURL=index.umd.min.js.map |
+2
-2
| { | ||
| "name": "@antv/g-canvas", | ||
| "version": "2.1.0", | ||
| "version": "2.2.0", | ||
| "description": "A renderer implemented by Canvas 2D API", | ||
@@ -43,3 +43,3 @@ "keywords": [ | ||
| "tslib": "^2.5.3", | ||
| "@antv/g-lite": "2.6.0", | ||
| "@antv/g-lite": "2.7.0", | ||
| "@antv/g-math": "3.1.0" | ||
@@ -46,0 +46,0 @@ }, |
@@ -19,8 +19,3 @@ import type { DisplayObject, RenderingPlugin, RenderingPluginContext, CanvasContext, GlobalRuntime } from '@antv/g-lite'; | ||
| private pathGeneratorFactory; | ||
| /** | ||
| * RBush used in dirty rectangle rendering | ||
| */ | ||
| private rBush; | ||
| constructor(canvasRendererPluginOptions: CanvasRendererPluginOptions); | ||
| private removedRBushNodeAABBs; | ||
| private renderQueue; | ||
@@ -51,3 +46,2 @@ private clearFullScreenLastFrame; | ||
| private mergeDirtyAABBs; | ||
| private searchDirtyObjects; | ||
| private saveDirtyAABB; | ||
@@ -54,0 +48,0 @@ private applyWorldTransform; |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
0
-100%1188458
-1.45%5857
-2.14%+ Added
- Removed
Updated