@antv/g-canvas 1.9.20 → 1.9.22

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- !function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("@antv/g-lite")):"function"==typeof define&&define.amd?define(["exports","@antv/g-lite"],e):e(((t="undefined"!=typeof globalThis?globalThis:t||self).G=t.G||{},t.G.Canvas2D={}),t.window.G)}(this,(function(t,e){"use strict";function r(){r=function(){return t};var t={},e=Object.prototype,n=e.hasOwnProperty,o=Object.defineProperty||function(t,e,r){t[e]=r.value},i="function"==typeof Symbol?Symbol:{},a=i.iterator||"@@iterator",c=i.asyncIterator||"@@asyncIterator",u=i.toStringTag||"@@toStringTag";function s(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{s({},"")}catch(t){s=function(t,e,r){return t[e]=r}}function l(t,e,r,n){var i=Object.create((e&&e.prototype instanceof p?e:p).prototype),a=new S(n||[]);return o(i,"_invoke",{value:E(t,r,a)}),i}function f(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}t.wrap=l;var h={};function p(){}function v(){}function d(){}var y={};s(y,a,(function(){return this}));var g=Object.getPrototypeOf,m=g&&g(g(k([])));m&&m!==e&&n.call(m,a)&&(y=m);var b=d.prototype=p.prototype=Object.create(y);function w(t){["next","throw","return"].forEach((function(e){s(t,e,(function(t){return this._invoke(e,t)}))}))}function x(t,e){function r(o,i,a,c){var u=f(t[o],t,i);if("throw"!==u.type){var s=u.arg,l=s.value;return l&&"object"==typeof l&&n.call(l,"__await")?e.resolve(l.__await).then((function(t){r("next",t,a,c)}),(function(t){r("throw",t,a,c)})):e.resolve(l).then((function(t){s.value=t,a(s)}),(function(t){return r("throw",t,a,c)}))}c(u.arg)}var i;o(this,"_invoke",{value:function(t,n){function o(){return new e((function(e,o){r(t,n,e,o)}))}return i=i?i.then(o,o):o()}})}function E(t,e,r){var n="suspendedStart";return function(o,i){if("executing"===n)throw Error("Generator is already running");if("completed"===n){if("throw"===o)throw i;return j()}for(r.method=o,r.arg=i;;){var a=r.delegate;if(a){var c=O(a,r);if(c){if(c===h)continue;return c}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if("suspendedStart"===n)throw n="completed",r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n="executing";var u=f(t,e,r);if("normal"===u.type){if(n=r.done?"completed":"suspendedYield",u.arg===h)continue;return{value:u.arg,done:r.done}}"throw"===u.type&&(n="completed",r.method="throw",r.arg=u.arg)}}}function O(t,e){var r=e.method,n=t.iterator[r];if(void 0===n)return e.delegate=null,"throw"===r&&t.iterator.return&&(e.method="return",e.arg=void 0,O(t,e),"throw"===e.method)||"return"!==r&&(e.method="throw",e.arg=new TypeError("The iterator does not provide a '"+r+"' method")),h;var o=f(n,t.iterator,e.arg);if("throw"===o.type)return e.method="throw",e.arg=o.arg,e.delegate=null,h;var i=o.arg;return i?i.done?(e[t.resultName]=i.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=void 0),e.delegate=null,h):i:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,h)}function P(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function L(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function S(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(P,this),this.reset(!0)}function k(t){if(t){var e=t[a];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var r=-1,o=function e(){for(;++r<t.length;)if(n.call(t,r))return e.value=t[r],e.done=!1,e;return e.value=void 0,e.done=!0,e};return o.next=o}}return{next:j}}function j(){return{value:void 0,done:!0}}return v.prototype=d,o(b,"constructor",{value:d,configurable:!0}),o(d,"constructor",{value:v,configurable:!0}),v.displayName=s(d,u,"GeneratorFunction"),t.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===v||"GeneratorFunction"===(e.displayName||e.name))},t.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,d):(t.__proto__=d,s(t,u,"GeneratorFunction")),t.prototype=Object.create(b),t},t.awrap=function(t){return{__await:t}},w(x.prototype),s(x.prototype,c,(function(){return this})),t.AsyncIterator=x,t.async=function(e,r,n,o,i){void 0===i&&(i=Promise);var a=new x(l(e,r,n,o),i);return t.isGeneratorFunction(r)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},w(b),s(b,u,"Generator"),s(b,a,(function(){return this})),s(b,"toString",(function(){return"[object Generator]"})),t.keys=function(t){var e=Object(t),r=[];for(var n in e)r.push(n);return r.reverse(),function t(){for(;r.length;){var n=r.pop();if(n in e)return t.value=n,t.done=!1,t}return t.done=!0,t}},t.values=k,S.prototype={constructor:S,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(L),!t)for(var e in this)"t"===e.charAt(0)&&n.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=void 0)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var e=this;function r(r,n){return a.type="throw",a.arg=t,e.next=r,n&&(e.method="next",e.arg=void 0),!!n}for(var o=this.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],a=i.completion;if("root"===i.tryLoc)return r("end");if(this.prev>=i.tryLoc){var c=n.call(i,"catchLoc"),u=n.call(i,"finallyLoc");if(c&&u){if(i.catchLoc>this.prev)return r(i.catchLoc,!0);if(i.finallyLoc>this.prev)return r(i.finallyLoc)}else if(c){if(i.catchLoc>this.prev)return r(i.catchLoc,!0)}else{if(!u)throw Error("try statement without catch or finally");if(i.finallyLoc>this.prev)return r(i.finallyLoc)}}}},abrupt:function(t,e){for(var r=this.tryEntries.length-1;r>=0;--r){var o=this.tryEntries[r];if(this.prev>=o.tryLoc&&n.call(o,"finallyLoc")&&o.finallyLoc>this.prev){var i=o;break}}i&&("break"===t||"continue"===t)&&e>=i.tryLoc&&i.finallyLoc>=e&&(i=null);var a=i?i.completion:{};return a.type=t,a.arg=e,i?(this.method="next",this.next=i.finallyLoc,h):this.complete(a)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),h},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),L(r),h}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;L(r)}return o}}throw Error("illegal catch attempt")},delegateYield:function(t,e,r){return this.delegate={iterator:k(t),resultName:e,nextLoc:r},"next"===this.method&&(this.arg=void 0),h}},t}function n(t){return n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},n(t)}function o(t,e,r,n,o,i,a){try{var c=t[i](a),u=c.value}catch(t){return void r(t)}c.done?e(u):Promise.resolve(u).then(n,o)}function i(t){return function(){var e=this,r=arguments;return new Promise((function(n,i){var a=t.apply(e,r);function c(t){o(a,n,i,c,u,"next",t)}function u(t){o(a,n,i,c,u,"throw",t)}c(void 0)}))}}function a(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function c(t,e){for(var r=0;e.length>r;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,(o=void 0,"symbol"==typeof(o=function(t,e){if("object"!=typeof t||null===t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,e||"default");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(n.key,"string"))?o:o+""),n)}var o}function u(t,e,r){return e&&c(t.prototype,e),r&&c(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function s(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&f(t,e)}function l(t){return l=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},l(t)}function f(t,e){return f=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},f(t,e)}function h(t,e){if(e&&("object"==typeof e||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}function p(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var r,n=l(t);if(e){var o=l(this).constructor;r=Reflect.construct(n,arguments,o)}else r=n.apply(this,arguments);return h(this,r)}}var v="undefined"!=typeof Float32Array?Float32Array:Array;function d(){var t=new v(16);return v!=Float32Array&&(t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0),t[0]=1,t[5]=1,t[10]=1,t[15]=1,t}function y(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[8]=e[8],t[9]=e[9],t[10]=e[10],t[11]=e[11],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15],t}function g(t,e,r){var n=e[0],o=e[1],i=e[2],a=e[3],c=e[4],u=e[5],s=e[6],l=e[7],f=e[8],h=e[9],p=e[10],v=e[11],d=e[12],y=e[13],g=e[14],m=e[15],b=r[0],w=r[1],x=r[2],E=r[3];return t[0]=b*n+w*c+x*f+E*d,t[1]=b*o+w*u+x*h+E*y,t[2]=b*i+w*s+x*p+E*g,t[3]=b*a+w*l+x*v+E*m,t[4]=(b=r[4])*n+(w=r[5])*c+(x=r[6])*f+(E=r[7])*d,t[5]=b*o+w*u+x*h+E*y,t[6]=b*i+w*s+x*p+E*g,t[7]=b*a+w*l+x*v+E*m,t[8]=(b=r[8])*n+(w=r[9])*c+(x=r[10])*f+(E=r[11])*d,t[9]=b*o+w*u+x*h+E*y,t[10]=b*i+w*s+x*p+E*g,t[11]=b*a+w*l+x*v+E*m,t[12]=(b=r[12])*n+(w=r[13])*c+(x=r[14])*f+(E=r[15])*d,t[13]=b*o+w*u+x*h+E*y,t[14]=b*i+w*s+x*p+E*g,t[15]=b*a+w*l+x*v+E*m,t}function m(t,e,r){var n,o,i,a,c,u,s,l,f,h,p,v,d=r[0],y=r[1],g=r[2];return e===t?(t[12]=e[0]*d+e[4]*y+e[8]*g+e[12],t[13]=e[1]*d+e[5]*y+e[9]*g+e[13],t[14]=e[2]*d+e[6]*y+e[10]*g+e[14],t[15]=e[3]*d+e[7]*y+e[11]*g+e[15]):(o=e[1],i=e[2],a=e[3],c=e[4],u=e[5],s=e[6],l=e[7],f=e[8],h=e[9],p=e[10],v=e[11],t[0]=n=e[0],t[1]=o,t[2]=i,t[3]=a,t[4]=c,t[5]=u,t[6]=s,t[7]=l,t[8]=f,t[9]=h,t[10]=p,t[11]=v,t[12]=n*d+c*y+f*g+e[12],t[13]=o*d+u*y+h*g+e[13],t[14]=i*d+s*y+p*g+e[14],t[15]=a*d+l*y+v*g+e[15]),t}function b(){var t=new v(3);return v!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0),t}function w(t,e,r){var n=new v(3);return n[0]=t,n[1]=e,n[2]=r,n}function x(t,e,r,n){return t[0]=e,t[1]=r,t[2]=n,t}function E(t,e,r){var n=e[0],o=e[1],i=e[2],a=r[3]*n+r[7]*o+r[11]*i+r[15];return t[0]=(r[0]*n+r[4]*o+r[8]*i+r[12])/(a=a||1),t[1]=(r[1]*n+r[5]*o+r[9]*i+r[13])/a,t[2]=(r[2]*n+r[6]*o+r[10]*i+r[14])/a,t}Math.hypot||(Math.hypot=function(){for(var t=0,e=arguments.length;e--;)t+=arguments[e]*arguments[e];return Math.sqrt(t)});var O;O=b();!function(){var t,e=(t=new v(2),v!=Float32Array&&(t[0]=0,t[1]=0),t)}();function P(t,e,r){return{x:t*Math.cos(r)-e*Math.sin(r),y:t*Math.sin(r)+e*Math.cos(r)}}function L(t,e,r,n,o,i,a,c,u,s){var l,f,h,p,v,d=t,y=e,g=r,m=n,b=c,w=u,x=120*Math.PI/180,E=Math.PI/180*(+o||0),O=[];if(s)f=s[0],h=s[1],p=s[2],v=s[3];else{y=(l=P(d,y,-E)).y;var S=((d=l.x)-(b=(l=P(b,w,-E)).x))/2,k=(y-(w=l.y))/2,j=S*S/(g*g)+k*k/(m*m);j>1&&(g*=j=Math.sqrt(j),m*=j);var M=g*g,T=m*m,A=(i===a?-1:1)*Math.sqrt(Math.abs((M*T-M*k*k-T*S*S)/(M*k*k+T*S*S)));p=A*g*k/m+(d+b)/2,f=Math.asin(((y-(v=A*-m*S/g+(y+w)/2))/m*1e9>>0)/1e9),h=Math.asin(((w-v)/m*1e9>>0)/1e9),0>(f=p>d?Math.PI-f:f)&&(f=2*Math.PI+f),0>(h=p>b?Math.PI-h:h)&&(h=2*Math.PI+h),a&&f>h&&(f-=2*Math.PI),!a&&h>f&&(h-=2*Math.PI)}var _=h-f;if(Math.abs(_)>x){var R=h,C=b,N=w;O=L(b=p+g*Math.cos(h=f+x*(a&&h>f?1:-1)),w=v+m*Math.sin(h),g,m,o,0,a,C,N,[h,R,p,v])}_=h-f;var I=Math.cos(f),G=Math.sin(f),B=Math.cos(h),D=Math.sin(h),F=Math.tan(_/4),$=4/3*g*F,H=4/3*m*F,Y=[d,y],W=[d+$*G,y-H*I],U=[b+$*D,w-H*B],X=[b,w];if(W[0]=2*Y[0]-W[0],W[1]=2*Y[1]-W[1],s)return W.concat(U,X,O);for(var z=[],q=0,Q=(O=W.concat(U,X,O)).length;Q>q;q+=1)z[q]=q%2?P(O[q-1],O[q],E).y:P(O[q],O[q+1],E).x;return z}var S=function(t){return null==t},k={}.toString,j=function(t){return e="String",k.call(t)==="[object "+e+"]";var e},M=function(t,e,r){return e>t?e:t>r?r:t};function T(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function A(t,e){for(var r=0;e.length>r;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,D(n.key),n)}}function _(t,e,r){return(e=D(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function R(t){return R=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},R(t)}function C(t,e){return C=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},C(t,e)}function N(t,e){if(e&&("object"===n(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}function I(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var r,n=R(t);if(e){var o=R(this).constructor;r=Reflect.construct(n,arguments,o)}else r=n.apply(this,arguments);return N(this,r)}}function G(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var r=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=r){var n,o,i,a,c=[],u=!0,s=!1;try{if(i=(r=r.call(t)).next,0===e){if(Object(r)!==r)return;u=!1}else for(;!(u=(n=i.call(r)).done)&&(c.push(n.value),c.length!==e);u=!0);}catch(t){s=!0,o=t}finally{try{if(!u&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(s)throw o}}return c}}(t,e)||function(t,e){if(!t)return;if("string"==typeof t)return B(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);"Object"===r&&t.constructor&&(r=t.constructor.name);if("Map"===r||"Set"===r)return Array.from(t);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return B(t,e)}(t,e)||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(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=Array(e);e>r;r++)n[r]=t[r];return n}function D(t){var e=function(t,e){if("object"!==n(t)||null===t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var o=r.call(t,e||"default");if("object"!==n(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"===n(e)?e:e+""}function F(t,e){var r=e.r;t.arc(r,r,r,0,2*Math.PI,!1)}function $(t,e){var r=e.rx,n=e.ry;if(t.ellipse)t.ellipse(r,n,r,n,0,0,2*Math.PI,!1);else{var o=r>n?r:n,i=r>n?1:r/n,a=r>n?n/r:1;t.save(),t.scale(i,a),t.arc(0,0,o,0,2*Math.PI)}}function H(t,r){var n=r.x1,o=r.y1,i=r.x2,a=r.y2,c=r.defX,u=void 0===c?0:c,s=r.defY,l=void 0===s?0:s,f=r.markerStart,h=r.markerEnd,p=r.markerStartOffset,v=r.markerEndOffset,d=0,y=0,g=0,m=0,b=0;f&&f instanceof e.DisplayObject&&p&&(d=Math.cos(b=Math.atan2(a-o,i-n))*(p||0),y=Math.sin(b)*(p||0)),h&&h instanceof e.DisplayObject&&v&&(g=Math.cos(b=Math.atan2(o-a,n-i))*(v||0),m=Math.sin(b)*(v||0)),t.moveTo(n-u+d,o-l+y),t.lineTo(i-u+g,a-l+m)}function Y(t,r){var n=r.defX,o=void 0===n?0:n,i=r.defY,a=void 0===i?0:i,c=r.markerStart,u=r.markerEnd,s=r.markerStartOffset,l=r.markerEndOffset,f=r.path,h=f.absolutePath,p=f.segments,v=0,d=0,y=0,g=0,m=0;if(c&&c instanceof e.DisplayObject&&s){var b=G(c.parentNode.getStartTangent(),2),w=b[0],x=b[1];v=Math.cos(m=Math.atan2(w[1]-x[1],w[0]-x[0]))*(s||0),d=Math.sin(m)*(s||0)}if(u&&u instanceof e.DisplayObject&&l){var E=G(u.parentNode.getEndTangent(),2),O=E[0],P=E[1];y=Math.cos(m=Math.atan2(O[1]-P[1],O[0]-P[0]))*(l||0),g=Math.sin(m)*(l||0)}for(var L=0;h.length>L;L++){var S=h[L],k=h[L+1],j=0===L&&(0!==v||0!==d),M=(L===h.length-1||k&&("M"===k[0]||"Z"===k[0]))&&0!==y&&0!==g;switch(S[0]){case"M":j?(t.moveTo(S[1]-o+v,S[2]-a+d),t.lineTo(S[1]-o,S[2]-a)):t.moveTo(S[1]-o,S[2]-a);break;case"L":M?t.lineTo(S[1]-o+y,S[2]-a+g):t.lineTo(S[1]-o,S[2]-a);break;case"Q":t.quadraticCurveTo(S[1]-o,S[2]-a,S[3]-o,S[4]-a),M&&t.lineTo(S[3]-o+y,S[4]-a+g);break;case"C":t.bezierCurveTo(S[1]-o,S[2]-a,S[3]-o,S[4]-a,S[5]-o,S[6]-a),M&&t.lineTo(S[5]-o+y,S[6]-a+g);break;case"A":var T=p[L].arcParams,A=T.cx,_=T.cy,R=T.rx,C=T.ry,N=T.startAngle,I=T.endAngle,B=T.xRotation,D=T.sweepFlag;if(t.ellipse)t.ellipse(A-o,_-a,R,C,B,N,I,!!(1-D));else{var F=R>C?R:C,$=R>C?1:R/C,H=R>C?C/R:1;t.translate(A-o,_-a),t.rotate(B),t.scale($,H),t.arc(0,0,F,N,I,!!(1-D)),t.scale(1/$,1/H),t.rotate(-B),t.translate(-(A-o),-(_-a))}M&&t.lineTo(S[6]-o+y,S[7]-a+g);break;case"Z":t.closePath()}}}function W(t,r){var n=r.defX,o=void 0===n?0:n,i=r.defY,a=void 0===i?0:i,c=r.markerStart,u=r.markerEnd,s=r.markerStartOffset,l=r.markerEndOffset,f=r.points.points,h=f.length,p=f[0][0]-o,v=f[0][1]-a,d=f[h-1][0]-o,y=f[h-1][1]-a,g=0,m=0,b=0,w=0,x=0;c&&c instanceof e.DisplayObject&&s&&(g=Math.cos(x=Math.atan2(f[1][1]-f[0][1],f[1][0]-f[0][0]))*(s||0),m=Math.sin(x)*(s||0)),u&&u instanceof e.DisplayObject&&l&&(b=Math.cos(x=Math.atan2(f[h-1][1]-f[0][1],f[h-1][0]-f[0][0]))*(l||0),w=Math.sin(x)*(l||0)),t.moveTo(p+(g||b),v+(m||w));for(var E=1;h-1>E;E++){var O=f[E];t.lineTo(O[0]-o,O[1]-a)}t.lineTo(d,y)}function U(t,r){var n=r.defX,o=void 0===n?0:n,i=r.defY,a=void 0===i?0:i,c=r.markerStart,u=r.markerEnd,s=r.markerStartOffset,l=r.markerEndOffset,f=r.points.points,h=f.length,p=f[0][0]-o,v=f[0][1]-a,d=f[h-1][0]-o,y=f[h-1][1]-a,g=0,m=0,b=0,w=0,x=0;c&&c instanceof e.DisplayObject&&s&&(g=Math.cos(x=Math.atan2(f[1][1]-f[0][1],f[1][0]-f[0][0]))*(s||0),m=Math.sin(x)*(s||0)),u&&u instanceof e.DisplayObject&&l&&(b=Math.cos(x=Math.atan2(f[h-2][1]-f[h-1][1],f[h-2][0]-f[h-1][0]))*(l||0),w=Math.sin(x)*(l||0)),t.moveTo(p+g,v+m);for(var E=1;h-1>E;E++){var O=f[E];t.lineTo(O[0]-o,O[1]-a)}t.lineTo(d+b,y+w)}function X(t,e){var r=e.radius,n=e.width,o=e.height,i=n,a=o;if(r&&r.some((function(t){return 0!==t}))){var c=n>0?1:-1,u=o>0?1:-1,s=c+u===0,l=G(r.map((function(t){return M(t,0,Math.min(Math.abs(i)/2,Math.abs(a)/2))})),4),f=l[0],h=l[1],p=l[2],v=l[3];t.moveTo(c*f,0),t.lineTo(i-c*h,0),0!==h&&t.arc(i-c*h,u*h,h,-u*Math.PI/2,c>0?0:Math.PI,s),t.lineTo(i,a-u*p),0!==p&&t.arc(i-c*p,a-u*p,p,c>0?0:Math.PI,u>0?Math.PI/2:1.5*Math.PI,s),t.lineTo(c*v,a),0!==v&&t.arc(c*v,a-u*v,v,u>0?Math.PI/2:-Math.PI/2,c>0?Math.PI:0,s),t.lineTo(0,u*f),0!==f&&t.arc(c*f,u*f,f,c>0?Math.PI:0,u>0?1.5*Math.PI:Math.PI/2,s)}else t.rect(0,0,i,a)}var z=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&C(t,e)}(a,t);var r,n,o,i=I(a);function a(){var t;T(this,a);for(var e=arguments.length,r=Array(e),n=0;e>n;n++)r[n]=arguments[n];return(t=i.call.apply(i,[this].concat(r))).name="canvas-path-generator",t}return r=a,(n=[{key:"init",value:function(){var t,r=(_(t={},e.Shape.CIRCLE,F),_(t,e.Shape.ELLIPSE,$),_(t,e.Shape.RECT,X),_(t,e.Shape.LINE,H),_(t,e.Shape.POLYLINE,U),_(t,e.Shape.POLYGON,W),_(t,e.Shape.PATH,Y),_(t,e.Shape.TEXT,void 0),_(t,e.Shape.GROUP,void 0),_(t,e.Shape.IMAGE,void 0),_(t,e.Shape.HTML,void 0),_(t,e.Shape.MESH,void 0),t);this.context.pathGeneratorFactory=r}},{key:"destroy",value:function(){delete this.context.pathGeneratorFactory}}])&&A(r.prototype,n),o&&A(r,o),Object.defineProperty(r,"prototype",{writable:!1}),a}(e.AbstractRendererPlugin),q=Object.freeze({__proto__:null,Plugin:z});function Q(){Q=function(){return t};var t={},e=Object.prototype,r=e.hasOwnProperty,o=Object.defineProperty||function(t,e,r){t[e]=r.value},i="function"==typeof Symbol?Symbol:{},a=i.iterator||"@@iterator",c=i.asyncIterator||"@@asyncIterator",u=i.toStringTag||"@@toStringTag";function s(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{s({},"")}catch(t){s=function(t,e,r){return t[e]=r}}function l(t,e,r,n){var i=Object.create((e&&e.prototype instanceof p?e:p).prototype),a=new S(n||[]);return o(i,"_invoke",{value:E(t,r,a)}),i}function f(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}t.wrap=l;var h={};function p(){}function v(){}function d(){}var y={};s(y,a,(function(){return this}));var g=Object.getPrototypeOf,m=g&&g(g(k([])));m&&m!==e&&r.call(m,a)&&(y=m);var b=d.prototype=p.prototype=Object.create(y);function w(t){["next","throw","return"].forEach((function(e){s(t,e,(function(t){return this._invoke(e,t)}))}))}function x(t,e){function i(o,a,c,u){var s=f(t[o],t,a);if("throw"!==s.type){var l=s.arg,h=l.value;return h&&"object"==n(h)&&r.call(h,"__await")?e.resolve(h.__await).then((function(t){i("next",t,c,u)}),(function(t){i("throw",t,c,u)})):e.resolve(h).then((function(t){l.value=t,c(l)}),(function(t){return i("throw",t,c,u)}))}u(s.arg)}var a;o(this,"_invoke",{value:function(t,r){function n(){return new e((function(e,n){i(t,r,e,n)}))}return a=a?a.then(n,n):n()}})}function E(t,e,r){var n="suspendedStart";return function(o,i){if("executing"===n)throw Error("Generator is already running");if("completed"===n){if("throw"===o)throw i;return j()}for(r.method=o,r.arg=i;;){var a=r.delegate;if(a){var c=O(a,r);if(c){if(c===h)continue;return c}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if("suspendedStart"===n)throw n="completed",r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n="executing";var u=f(t,e,r);if("normal"===u.type){if(n=r.done?"completed":"suspendedYield",u.arg===h)continue;return{value:u.arg,done:r.done}}"throw"===u.type&&(n="completed",r.method="throw",r.arg=u.arg)}}}function O(t,e){var r=e.method,n=t.iterator[r];if(void 0===n)return e.delegate=null,"throw"===r&&t.iterator.return&&(e.method="return",e.arg=void 0,O(t,e),"throw"===e.method)||"return"!==r&&(e.method="throw",e.arg=new TypeError("The iterator does not provide a '"+r+"' method")),h;var o=f(n,t.iterator,e.arg);if("throw"===o.type)return e.method="throw",e.arg=o.arg,e.delegate=null,h;var i=o.arg;return i?i.done?(e[t.resultName]=i.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=void 0),e.delegate=null,h):i:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,h)}function P(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function L(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function S(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(P,this),this.reset(!0)}function k(t){if(t){var e=t[a];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var n=-1,o=function e(){for(;++n<t.length;)if(r.call(t,n))return e.value=t[n],e.done=!1,e;return e.value=void 0,e.done=!0,e};return o.next=o}}return{next:j}}function j(){return{value:void 0,done:!0}}return v.prototype=d,o(b,"constructor",{value:d,configurable:!0}),o(d,"constructor",{value:v,configurable:!0}),v.displayName=s(d,u,"GeneratorFunction"),t.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===v||"GeneratorFunction"===(e.displayName||e.name))},t.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,d):(t.__proto__=d,s(t,u,"GeneratorFunction")),t.prototype=Object.create(b),t},t.awrap=function(t){return{__await:t}},w(x.prototype),s(x.prototype,c,(function(){return this})),t.AsyncIterator=x,t.async=function(e,r,n,o,i){void 0===i&&(i=Promise);var a=new x(l(e,r,n,o),i);return t.isGeneratorFunction(r)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},w(b),s(b,u,"Generator"),s(b,a,(function(){return this})),s(b,"toString",(function(){return"[object Generator]"})),t.keys=function(t){var e=Object(t),r=[];for(var n in e)r.push(n);return r.reverse(),function t(){for(;r.length;){var n=r.pop();if(n in e)return t.value=n,t.done=!1,t}return t.done=!0,t}},t.values=k,S.prototype={constructor:S,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(L),!t)for(var e in this)"t"===e.charAt(0)&&r.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=void 0)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var e=this;function n(r,n){return a.type="throw",a.arg=t,e.next=r,n&&(e.method="next",e.arg=void 0),!!n}for(var o=this.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],a=i.completion;if("root"===i.tryLoc)return n("end");if(this.prev>=i.tryLoc){var c=r.call(i,"catchLoc"),u=r.call(i,"finallyLoc");if(c&&u){if(i.catchLoc>this.prev)return n(i.catchLoc,!0);if(i.finallyLoc>this.prev)return n(i.finallyLoc)}else if(c){if(i.catchLoc>this.prev)return n(i.catchLoc,!0)}else{if(!u)throw Error("try statement without catch or finally");if(i.finallyLoc>this.prev)return n(i.finallyLoc)}}}},abrupt:function(t,e){for(var n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n];if(this.prev>=o.tryLoc&&r.call(o,"finallyLoc")&&o.finallyLoc>this.prev){var i=o;break}}i&&("break"===t||"continue"===t)&&e>=i.tryLoc&&i.finallyLoc>=e&&(i=null);var a=i?i.completion:{};return a.type=t,a.arg=e,i?(this.method="next",this.next=i.finallyLoc,h):this.complete(a)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),h},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),L(r),h}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;L(r)}return o}}throw Error("illegal catch attempt")},delegateYield:function(t,e,r){return this.delegate={iterator:k(t),resultName:e,nextLoc:r},"next"===this.method&&(this.arg=void 0),h}},t}function V(t,e,r,n,o,i,a){try{var c=t[i](a),u=c.value}catch(t){return void r(t)}c.done?e(u):Promise.resolve(u).then(n,o)}function Z(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function J(t,e){for(var r=0;e.length>r;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,ut(n.key),n)}}function K(t,e,r){return e&&J(t.prototype,e),r&&J(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function tt(t,e,r){return(e=ut(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function et(t){return et=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},et(t)}function rt(t,e){return rt=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},rt(t,e)}function nt(t,e){if(e&&("object"===n(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}function ot(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var r,n=et(t);if(e){var o=et(this).constructor;r=Reflect.construct(n,arguments,o)}else r=n.apply(this,arguments);return nt(this,r)}}function it(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var r=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=r){var n,o,i,a,c=[],u=!0,s=!1;try{if(i=(r=r.call(t)).next,0===e){if(Object(r)!==r)return;u=!1}else for(;!(u=(n=i.call(r)).done)&&(c.push(n.value),c.length!==e);u=!0);}catch(t){s=!0,o=t}finally{try{if(!u&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(s)throw o}}return c}}(t,e)||at(t,e)||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 at(t,e){if(t){if("string"==typeof t)return ct(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?ct(t,e):void 0}}function ct(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=Array(e);e>r;r++)n[r]=t[r];return n}function ut(t){var e=function(t,e){if("object"!==n(t)||null===t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var o=r.call(t,e||"default");if("object"!==n(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"===n(e)?e:e+""}var st=b(),lt=b(),ft=b(),ht=d(),pt=function(){function t(){var r=this;Z(this,t),this.canvasConfig=void 0,this.pathGeneratorFactory=void 0,this.pointInPathPickerFactory=void 0,this.isHit=function(t,n,o,i){var a,c,u,s,l,f,h,p,v,d,y,g,m,b,w,O,P,L,S,k,j,M,T,A,_,R,C,N,I,G,B,D=r.pointInPathPickerFactory[t.nodeName];if(D){var F=(a=ht,(B=(S=(u=(c=o)[0])*(p=c[5])-(s=c[1])*(h=c[4]))*(G=(m=c[10])*(L=c[15])-(b=c[11])*(P=c[14]))-(k=u*(v=c[6])-(l=c[2])*h)*(I=(g=c[9])*L-b*(O=c[13]))+(j=u*(d=c[7])-(f=c[3])*h)*(N=g*P-m*O)+(M=s*v-l*p)*(C=(y=c[8])*L-b*(w=c[12]))-(T=s*d-f*p)*(R=y*P-m*w)+(A=l*d-f*v)*(_=y*O-g*w))?(a[0]=(p*G-v*I+d*N)*(B=1/B),a[1]=(l*I-s*G-f*N)*B,a[2]=(O*A-P*T+L*M)*B,a[3]=(m*T-g*A-b*M)*B,a[4]=(v*C-h*G-d*R)*B,a[5]=(u*G-l*C+f*R)*B,a[6]=(P*j-w*A-L*k)*B,a[7]=(y*A-m*j+b*k)*B,a[8]=(h*I-p*C+d*_)*B,a[9]=(s*C-u*I-f*_)*B,a[10]=(w*T-O*j+L*S)*B,a[11]=(g*j-y*T-b*S)*B,a[12]=(p*R-h*N-v*_)*B,a[13]=(u*N-s*R+l*_)*B,a[14]=(O*k-w*M-P*S)*B,a[15]=(y*M-g*k+m*S)*B,a):null),$=E(lt,x(ft,n[0],n[1],0),F),H=t.getGeometryBounds().halfExtents,Y=t.parsedStyle.anchor;if($[0]+=(Y&&Y[0]||0)*H[0]*2,$[1]+=(Y&&Y[1]||0)*H[1]*2,D(t,new e.Point($[0],$[1]),i,r.isPointInPath))return!0}return!1},this.isPointInPath=function(t,n){var o=e.runtime.offscreenCanvas.getOrCreateContext(r.canvasConfig.offscreenCanvas),i=r.pathGeneratorFactory[t.nodeName];return i&&(o.beginPath(),i(o,t.parsedStyle),o.closePath()),o.isPointInPath(n.x,n.y)}}return K(t,[{key:"apply",value:function(e){var r,n=this,o=e.renderingService,i=e.renderingContext,a=e.pathGeneratorFactory,c=e.pointInPathPickerFactory;this.canvasConfig=e.config,this.pathGeneratorFactory=a,this.pointInPathPickerFactory=c;var u=null===(r=i.root)||void 0===r?void 0:r.ownerDocument;o.hooks.pick.tapPromise(t.tag,function(){var t,e=(t=Q().mark((function t(e){return Q().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",n.pick(u,e));case 1:case"end":return t.stop()}}),t)})),function(){var e=this,r=arguments;return new Promise((function(n,o){var i=t.apply(e,r);function a(t){V(i,n,o,a,c,"next",t)}function c(t){V(i,n,o,a,c,"throw",t)}a(void 0)}))});return function(t){return e.apply(this,arguments)}}()),o.hooks.pickSync.tap(t.tag,(function(t){return n.pick(u,t)}))}},{key:"pick",value:function(t,r){var n,o=r.topmost,i=r.position,a=x(st,i.x,i.y,0),c=[],u=function(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=at(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var n=0,o=function(){};return{s:o,n:function(){return t.length>n?{done:!1,value:t[n++]}:{done:!0}},e:function(t){throw t},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,a=!0,c=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return a=t.done,t},e:function(t){c=!0,i=t},f:function(){try{a||null==r.return||r.return()}finally{if(c)throw i}}}}(t.elementsFromBBox(a[0],a[1],a[0],a[1]));try{for(u.s();!(n=u.n()).done;){var s=n.value,l=s.getWorldTransform();if(this.isHit(s,a,l,!1)){var f=e.findClosestClipPathTarget(s);if(f){var h=f.parsedStyle.clipPath;if(this.isHit(h,a,h.getWorldTransform(),!0)){if(o)return r.picked=[s],r;c.push(s)}}else{if(o)return r.picked=[s],r;c.push(s)}}}}catch(t){u.e(t)}finally{u.f()}return r.picked=c,r}}]),t}();function vt(t){return function(t){if(Array.isArray(t))return dt(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||function(t,e){if(!t)return;if("string"==typeof t)return dt(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);"Object"===r&&t.constructor&&(r=t.constructor.name);if("Map"===r||"Set"===r)return Array.from(t);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return dt(t,e)}(t)||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 dt(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=Array(e);e>r;r++)n[r]=t[r];return n}function yt(t,e,r,n){var o=t-r,i=e-n;return Math.sqrt(o*o+i*i)}function gt(t,e){return.001>Math.abs(t-e)}function mt(t,e){var r=Math.min.apply(Math,vt(t)),n=Math.min.apply(Math,vt(e));return{x:r,y:n,width:Math.max.apply(Math,vt(t))-r,height:Math.max.apply(Math,vt(e))-n}}function bt(t){return(t+2*Math.PI)%(2*Math.PI)}pt.tag="CanvasPicker";var wt=function(t,e,r,n,o){return{x:(1-o)*t+o*r,y:(1-o)*e+o*n}},xt=function(t,e,r,n,o,i){var a=[r-t,n-e];if(function(t,e){return t[0]===e[0]&&t[1]===e[1]}(a,[0,0]))return Math.sqrt((o-t)*(o-t)+(i-e)*(i-e));var c=[-a[1],a[0]];return function(t,e){var r=e[0],n=e[1],o=r*r+n*n;o>0&&(o=1/Math.sqrt(o)),t[0]=e[0]*o,t[1]=e[1]*o}(c,c),Math.abs(function(t,e){return t[0]*e[0]+t[1]*e[1]}([o-t,i-e],c))};function Et(t,e,r,n,o,i){var a=-1,c=1/0,u=[r,n],s=20;i&&i>200&&(s=i/10);for(var l=1/s,f=l/10,h=0;s>=h;h++){var p=h*l,v=[o.apply(void 0,vt(t.concat([p]))),o.apply(void 0,vt(e.concat([p])))],d=yt(u[0],u[1],v[0],v[1]);c>d&&(a=p,c=d)}if(0===a)return{x:t[0],y:e[0]};if(1===a){var y=t.length;return{x:t[y-1],y:e[y-1]}}c=1/0;for(var g=0;32>g&&1e-4<=f;g++){var m=a-f,b=a+f,w=[o.apply(void 0,vt(t.concat([m]))),o.apply(void 0,vt(e.concat([m])))],x=yt(u[0],u[1],w[0],w[1]);if(m>=0&&c>x)a=m,c=x;else{var E=[o.apply(void 0,vt(t.concat([b]))),o.apply(void 0,vt(e.concat([b])))],O=yt(u[0],u[1],E[0],E[1]);1>=b&&c>O?(a=b,c=O):f*=.5}}return{x:o.apply(void 0,vt(t.concat([a]))),y:o.apply(void 0,vt(e.concat([a])))}}function Ot(t,e,r,n){var o=1-n;return o*o*t+2*n*o*e+n*n*r}function Pt(t,e,r){var n=t+r-2*e;if(gt(n,0))return[.5];var o=(t-e)/n;return o>1||0>o?[]:[o]}function Lt(t,e,r,n){return 2*(1-n)*(e-t)+2*n*(r-e)}function St(t,e,r,n,o,i,a){var c=Ot(t,r,o,a),u=Ot(e,n,i,a),s=wt(t,e,r,n,a),l=wt(r,n,o,i,a);return[[t,e,s.x,s.y,c,u],[c,u,l.x,l.y,o,i]]}function kt(t,e,r,n,o,i,a){if(0===a)return(yt(t,e,r,n)+yt(r,n,o,i)+yt(t,e,o,i))/2;var c=St(t,e,r,n,o,i,.5),u=c[0],s=c[1];return u.push(a-1),s.push(a-1),kt.apply(void 0,vt(u))+kt.apply(void 0,vt(s))}var jt={box:function(t,e,r,n,o,i){var a=Pt(t,r,o)[0],c=Pt(e,n,i)[0],u=[t,o],s=[e,i];return void 0!==a&&u.push(Ot(t,r,o,a)),void 0!==c&&s.push(Ot(e,n,i,c)),mt(u,s)},length:function(t,e,r,n,o,i){return kt(t,e,r,n,o,i,3)},nearestPoint:function(t,e,r,n,o,i,a,c){return Et([t,r,o],[e,n,i],a,c,Ot)},pointDistance:function(t,e,r,n,o,i,a,c){var u=this.nearestPoint(t,e,r,n,o,i,a,c);return yt(u.x,u.y,a,c)},interpolationAt:Ot,pointAt:function(t,e,r,n,o,i,a){return{x:Ot(t,r,o,a),y:Ot(e,n,i,a)}},divide:function(t,e,r,n,o,i,a){return St(t,e,r,n,o,i,a)},tangentAngle:function(t,e,r,n,o,i,a){var c=Lt(t,r,o,a),u=Lt(e,n,i,a);return bt(Math.atan2(u,c))}};function Mt(t,e,r,n,o){var i=1-o;return i*i*i*t+3*e*o*i*i+3*r*o*o*i+n*o*o*o}function Tt(t,e,r,n,o){var i=1-o;return 3*(i*i*(e-t)+2*i*o*(r-e)+o*o*(n-r))}function At(t,e,r,n){var o,i,a,c=-3*t+9*e-9*r+3*n,u=6*t-12*e+6*r,s=3*e-3*t,l=[];if(gt(c,0))gt(u,0)||0>(o=-s/u)||o>1||l.push(o);else{var f=u*u-4*c*s;gt(f,0)?l.push(-u/(2*c)):f>0&&(i=(-u-(a=Math.sqrt(f)))/(2*c),0>(o=(-u+a)/(2*c))||o>1||l.push(o),0>i||i>1||l.push(i))}return l}function _t(t,e,r,n,o,i,a,c,u){var s=Mt(t,r,o,a,u),l=Mt(e,n,i,c,u),f=wt(t,e,r,n,u),h=wt(r,n,o,i,u),p=wt(o,i,a,c,u),v=wt(f.x,f.y,h.x,h.y,u),d=wt(h.x,h.y,p.x,p.y,u);return[[t,e,f.x,f.y,v.x,v.y,s,l],[s,l,d.x,d.y,p.x,p.y,a,c]]}function Rt(t,e,r,n,o,i,a,c,u){if(0===u)return function(t,e){for(var r=0,n=t.length,o=0;n>o;o++)r+=yt(t[o],e[o],t[(o+1)%n],e[(o+1)%n]);return r/2}([t,r,o,a],[e,n,i,c]);var s=_t(t,e,r,n,o,i,a,c,.5),l=[].concat(vt(s[0]),[u-1]),f=[].concat(vt(s[1]),[u-1]);return Rt.apply(void 0,vt(l))+Rt.apply(void 0,vt(f))}var Ct={extrema:At,box:function(t,e,r,n,o,i,a,c){for(var u=[t,a],s=[e,c],l=At(t,r,o,a),f=At(e,n,i,c),h=0;l.length>h;h++)u.push(Mt(t,r,o,a,l[h]));for(var p=0;f.length>p;p++)s.push(Mt(e,n,i,c,f[p]));return mt(u,s)},length:function(t,e,r,n,o,i,a,c){return Rt(t,e,r,n,o,i,a,c,3)},nearestPoint:function(t,e,r,n,o,i,a,c,u,s,l){return Et([t,r,o,a],[e,n,i,c],u,s,Mt,l)},pointDistance:function(t,e,r,n,o,i,a,c,u,s,l){var f=this.nearestPoint(t,e,r,n,o,i,a,c,u,s,l);return yt(f.x,f.y,u,s)},interpolationAt:Mt,pointAt:function(t,e,r,n,o,i,a,c,u){return{x:Mt(t,r,o,a,u),y:Mt(e,n,i,c,u)}},divide:function(t,e,r,n,o,i,a,c,u){return _t(t,e,r,n,o,i,a,c,u)},tangentAngle:function(t,e,r,n,o,i,a,c,u){var s=Tt(t,r,o,a,u),l=Tt(e,n,i,c,u);return bt(Math.atan2(l,s))}};function Nt(t,e,r,n){var o=t-r,i=e-n;return Math.sqrt(o*o+i*i)}function It(t,e,r,n,o,i){return!(t>o||o>t+r||e>i||i>e+n)}function Gt(t,e,r,n,o,i,a,c){var u=(Math.atan2(c-e,a-t)+2*Math.PI)%(2*Math.PI),s={x:t+r*Math.cos(u),y:e+r*Math.sin(u)};return Nt(s.x,s.y,a,c)<=i/2}function Bt(t,e,r,n,o,i,a){var c=o/2;return!(Math.min(t,r)-c>i||i>Math.max(t,r)+c||Math.min(e,n)-c>a||a>Math.max(e,n)+c)&&xt(t,e,r,n,i,a)<=o/2}function Dt(t,e,r,n,o){var i=t.length;if(2>i)return!1;for(var a=0;i-1>a;a++){if(Bt(t[a][0],t[a][1],t[a+1][0],t[a+1][1],e,r,n))return!0}if(o){var c=t[0],u=t[i-1];if(Bt(c[0],c[1],u[0],u[1],e,r,n))return!0}return!1}function Ft(t){return 1e-6>Math.abs(t)?0:0>t?-1:1}function $t(t,e,r){return!((r[0]-t[0])*(e[1]-t[1])!=(e[0]-t[0])*(r[1]-t[1])||Math.min(t[0],e[0])>r[0]||r[0]>Math.max(t[0],e[0])||Math.min(t[1],e[1])>r[1]||r[1]>Math.max(t[1],e[1]))}function Ht(t,e,r){var n=!1,o=t.length;if(2>=o)return!1;for(var i=0;o>i;i++){var a=t[i],c=t[(i+1)%o];if($t(a,c,[e,r]))return!0;Ft(a[1]-r)>0!=Ft(c[1]-r)>0&&0>Ft(e-(r-a[1])*(a[0]-c[0])/(a[1]-c[1])-a[0])&&(n=!n)}return n}function Yt(t,e,r){for(var n=!1,o=0;t.length>o;o++){if(n=Ht(t[o],e,r))break}return n}function Wt(t,r,n){var o=t.parsedStyle,i=o.r,a=o.fill,c=o.stroke,u=o.pointerEvents,s=((o.lineWidth||0)+(o.increasedLineWidthForHitTesting||0))/2,l=Nt(i,i,r.x,r.y),f=it(e.isFillOrStrokeAffected(u,a,c),2),h=f[0],p=f[1];return h&&p||n?i+s>=l:h?i>=l:!!p&&(l>=i-s&&i+s>=l)}function Ut(t,e,r,n){return t/(r*r)+e/(n*n)}function Xt(t,r,n){var o=t.parsedStyle,i=o.rx,a=o.ry,c=o.lineWidth,u=o.increasedLineWidthForHitTesting,s=r.x,l=r.y,f=it(e.isFillOrStrokeAffected(o.pointerEvents,o.fill,o.stroke),2),h=f[0],p=f[1],v=((c||0)+(u||0))/2,d=(s-i)*(s-i),y=(l-a)*(l-a);return h&&p||n?1>=Ut(d,y,i+v,a+v):h?1>=Ut(d,y,i,a):!!p&&(Ut(d,y,i-v,a-v)>=1&&1>=Ut(d,y,i+v,a+v))}function zt(t,r,n){var o=t.parsedStyle,i=o.x1,a=o.y1,c=o.x2,u=o.y2,s=o.lineWidth,l=o.increasedLineWidthForHitTesting,f=o.defX,h=void 0===f?0:f,p=o.defY,v=void 0===p?0:p,d=it(e.isFillOrStrokeAffected(o.pointerEvents,o.fill,o.stroke),2);return!(!d[1]&&!n||!s)&&Bt(i,a,c,u,(s||0)+(l||0),r.x+h,r.y+v)}function qt(t,r,n,o){var i=t.parsedStyle,a=i.lineWidth,c=i.increasedLineWidthForHitTesting,u=i.defX,s=void 0===u?0:u,l=i.defY,f=void 0===l?0:l,h=i.path,p=it(e.isFillOrStrokeAffected(i.pointerEvents,i.fill,i.stroke),2),v=p[0],d=p[1],y=h.segments,g=h.hasArc,m=h.polylines,b=h.polygons,w=e.getOrCalculatePathTotalLength(t),x=!1;return v||n?x=g?o(t,r):Yt(b,r.x+s,r.y+f)||Yt(m,r.x+s,r.y+f):((d||n)&&(x=function(t,e,r,n,o){for(var i=!1,a=e/2,c=0;t.length>c;c++){var u=t[c],s=u.currentPoint,l=u.params,f=u.prePoint,h=u.box;if(!h||It(h.x-a,h.y-a,h.width+e,h.height+e,r,n))switch(u.command){case"L":case"Z":if(i=Bt(f[0],f[1],s[0],s[1],e,r,n))return!0;break;case"Q":if(i=e/2>=jt.pointDistance(f[0],f[1],l[1],l[2],l[3],l[4],r,n))return!0;break;case"C":if(i=e/2>=Ct.pointDistance(f[0],f[1],l[1],l[2],l[3],l[4],l[5],l[6],r,n,o))return!0;break;case"A":u.cubicParams||(u.cubicParams=L(f[0],f[1],l[1],l[2],l[3],l[4],l[5],l[6],l[7],void 0));for(var p=u.cubicParams,v=f,d=0;p.length>d;d+=6){var y=Ct.pointDistance(v[0],v[1],p[d],p[d+1],p[d+2],p[d+3],p[d+4],p[d+5],r,n,o);if(v=[p[d+4],p[d+5]],i=e/2>=y)return!0}}}return i}(y,(a||0)+(c||0),r.x+s,r.y+f,w)),x)}function Qt(t,r,n){var o=t.parsedStyle,i=o.lineWidth,a=o.increasedLineWidthForHitTesting,c=o.points,u=o.defX,s=void 0===u?0:u,l=o.defY,f=void 0===l?0:l,h=it(e.isFillOrStrokeAffected(o.pointerEvents,o.fill,o.stroke),2),p=h[0],v=!1;return(h[1]||n)&&(v=Dt(c.points,(i||0)+(a||0),r.x+s,r.y+f,!0)),v||!p&&!n||(v=Ht(c.points,r.x+s,r.y+f)),v}function Vt(t,r,n){var o=t.parsedStyle,i=o.lineWidth,a=o.increasedLineWidthForHitTesting,c=o.points,u=o.defX,s=void 0===u?0:u,l=o.defY,f=void 0===l?0:l;return!(!it(e.isFillOrStrokeAffected(o.pointerEvents,o.fill,o.stroke),2)[1]&&!n||!i)&&Dt(c.points,(i||0)+(a||0),r.x+s,r.y+f,!1)}function Zt(t,r,n,o){var i=t.parsedStyle,a=i.radius,c=i.lineWidth,u=i.increasedLineWidthForHitTesting,s=i.width,l=i.height,f=it(e.isFillOrStrokeAffected(i.pointerEvents,i.fill,i.stroke),2),h=f[0],p=f[1],v=(c||0)+(u||0);if(a&&a.some((function(t){return 0!==t}))){var d=!1;return(p||n)&&(d=function(t,e,r,n,o,i,a,c){var u=it(o,4),s=u[0],l=u[1],f=u[2],h=u[3];return Bt(t+s,e,t+r-l,e,i,a,c)||Bt(t+r,e+l,t+r,e+n-f,i,a,c)||Bt(t+r-f,e+n,t+h,e+n,i,a,c)||Bt(t,e+n-h,t,e+s,i,a,c)||Gt(t+r-l,e+l,l,0,0,i,a,c)||Gt(t+r-f,e+n-f,f,0,0,i,a,c)||Gt(t+h,e+n-h,h,0,0,i,a,c)||Gt(t+s,e+s,s,0,0,i,a,c)}(0,0,s,l,a.map((function(t){return M(t,0,Math.min(Math.abs(s)/2,Math.abs(l)/2))})),v,r.x,r.y)),d||!h&&!n||(d=o(t,r)),d}var y=v/2;return h&&p||n?It(0-y,0-y,s+y,l+y,r.x,r.y):h?It(0,0,s,l,r.x,r.y):!!p&&function(t,e,r,n,o,i,a){var c=o/2;return It(t-c,e-c,r,o,i,a)||It(t+r-c,e-c,o,n,i,a)||It(t+c,e+n-c,r,o,i,a)||It(t-c,e+c,o,n,i,a)}(0,0,s,l,v,r.x,r.y)}var Jt=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&rt(t,e)}(n,t);var r=ot(n);function n(){var t;Z(this,n);for(var e=arguments.length,o=Array(e),i=0;e>i;i++)o[i]=arguments[i];return(t=r.call.apply(r,[this].concat(o))).name="canvas-picker",t}return K(n,[{key:"init",value:function(){var t,r=function(){return!0},n=(tt(t={},e.Shape.CIRCLE,Wt),tt(t,e.Shape.ELLIPSE,Xt),tt(t,e.Shape.RECT,Zt),tt(t,e.Shape.LINE,zt),tt(t,e.Shape.POLYLINE,Vt),tt(t,e.Shape.POLYGON,Qt),tt(t,e.Shape.PATH,qt),tt(t,e.Shape.TEXT,r),tt(t,e.Shape.GROUP,null),tt(t,e.Shape.IMAGE,r),tt(t,e.Shape.HTML,null),tt(t,e.Shape.MESH,null),t);this.context.pointInPathPickerFactory=n,this.addRenderingPlugin(new pt)}},{key:"destroy",value:function(){delete this.context.pointInPathPickerFactory,this.removeAllRenderingPlugins()}}]),n}(e.AbstractRendererPlugin),Kt=Object.freeze({__proto__:null,Plugin:Jt});function te(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function ee(t){for(var e=1;arguments.length>e;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?te(Object(r),!0).forEach((function(e){ue(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):te(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}function re(){re=function(){return t};var t={},e=Object.prototype,r=e.hasOwnProperty,o=Object.defineProperty||function(t,e,r){t[e]=r.value},i="function"==typeof Symbol?Symbol:{},a=i.iterator||"@@iterator",c=i.asyncIterator||"@@asyncIterator",u=i.toStringTag||"@@toStringTag";function s(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{s({},"")}catch(t){s=function(t,e,r){return t[e]=r}}function l(t,e,r,n){var i=Object.create((e&&e.prototype instanceof p?e:p).prototype),a=new S(n||[]);return o(i,"_invoke",{value:E(t,r,a)}),i}function f(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}t.wrap=l;var h={};function p(){}function v(){}function d(){}var y={};s(y,a,(function(){return this}));var g=Object.getPrototypeOf,m=g&&g(g(k([])));m&&m!==e&&r.call(m,a)&&(y=m);var b=d.prototype=p.prototype=Object.create(y);function w(t){["next","throw","return"].forEach((function(e){s(t,e,(function(t){return this._invoke(e,t)}))}))}function x(t,e){function i(o,a,c,u){var s=f(t[o],t,a);if("throw"!==s.type){var l=s.arg,h=l.value;return h&&"object"==n(h)&&r.call(h,"__await")?e.resolve(h.__await).then((function(t){i("next",t,c,u)}),(function(t){i("throw",t,c,u)})):e.resolve(h).then((function(t){l.value=t,c(l)}),(function(t){return i("throw",t,c,u)}))}u(s.arg)}var a;o(this,"_invoke",{value:function(t,r){function n(){return new e((function(e,n){i(t,r,e,n)}))}return a=a?a.then(n,n):n()}})}function E(t,e,r){var n="suspendedStart";return function(o,i){if("executing"===n)throw Error("Generator is already running");if("completed"===n){if("throw"===o)throw i;return j()}for(r.method=o,r.arg=i;;){var a=r.delegate;if(a){var c=O(a,r);if(c){if(c===h)continue;return c}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if("suspendedStart"===n)throw n="completed",r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n="executing";var u=f(t,e,r);if("normal"===u.type){if(n=r.done?"completed":"suspendedYield",u.arg===h)continue;return{value:u.arg,done:r.done}}"throw"===u.type&&(n="completed",r.method="throw",r.arg=u.arg)}}}function O(t,e){var r=e.method,n=t.iterator[r];if(void 0===n)return e.delegate=null,"throw"===r&&t.iterator.return&&(e.method="return",e.arg=void 0,O(t,e),"throw"===e.method)||"return"!==r&&(e.method="throw",e.arg=new TypeError("The iterator does not provide a '"+r+"' method")),h;var o=f(n,t.iterator,e.arg);if("throw"===o.type)return e.method="throw",e.arg=o.arg,e.delegate=null,h;var i=o.arg;return i?i.done?(e[t.resultName]=i.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=void 0),e.delegate=null,h):i:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,h)}function P(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function L(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function S(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(P,this),this.reset(!0)}function k(t){if(t){var e=t[a];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var n=-1,o=function e(){for(;++n<t.length;)if(r.call(t,n))return e.value=t[n],e.done=!1,e;return e.value=void 0,e.done=!0,e};return o.next=o}}return{next:j}}function j(){return{value:void 0,done:!0}}return v.prototype=d,o(b,"constructor",{value:d,configurable:!0}),o(d,"constructor",{value:v,configurable:!0}),v.displayName=s(d,u,"GeneratorFunction"),t.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===v||"GeneratorFunction"===(e.displayName||e.name))},t.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,d):(t.__proto__=d,s(t,u,"GeneratorFunction")),t.prototype=Object.create(b),t},t.awrap=function(t){return{__await:t}},w(x.prototype),s(x.prototype,c,(function(){return this})),t.AsyncIterator=x,t.async=function(e,r,n,o,i){void 0===i&&(i=Promise);var a=new x(l(e,r,n,o),i);return t.isGeneratorFunction(r)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},w(b),s(b,u,"Generator"),s(b,a,(function(){return this})),s(b,"toString",(function(){return"[object Generator]"})),t.keys=function(t){var e=Object(t),r=[];for(var n in e)r.push(n);return r.reverse(),function t(){for(;r.length;){var n=r.pop();if(n in e)return t.value=n,t.done=!1,t}return t.done=!0,t}},t.values=k,S.prototype={constructor:S,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(L),!t)for(var e in this)"t"===e.charAt(0)&&r.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=void 0)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var e=this;function n(r,n){return a.type="throw",a.arg=t,e.next=r,n&&(e.method="next",e.arg=void 0),!!n}for(var o=this.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],a=i.completion;if("root"===i.tryLoc)return n("end");if(this.prev>=i.tryLoc){var c=r.call(i,"catchLoc"),u=r.call(i,"finallyLoc");if(c&&u){if(i.catchLoc>this.prev)return n(i.catchLoc,!0);if(i.finallyLoc>this.prev)return n(i.finallyLoc)}else if(c){if(i.catchLoc>this.prev)return n(i.catchLoc,!0)}else{if(!u)throw Error("try statement without catch or finally");if(i.finallyLoc>this.prev)return n(i.finallyLoc)}}}},abrupt:function(t,e){for(var n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n];if(this.prev>=o.tryLoc&&r.call(o,"finallyLoc")&&o.finallyLoc>this.prev){var i=o;break}}i&&("break"===t||"continue"===t)&&e>=i.tryLoc&&i.finallyLoc>=e&&(i=null);var a=i?i.completion:{};return a.type=t,a.arg=e,i?(this.method="next",this.next=i.finallyLoc,h):this.complete(a)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),h},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),L(r),h}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;L(r)}return o}}throw Error("illegal catch attempt")},delegateYield:function(t,e,r){return this.delegate={iterator:k(t),resultName:e,nextLoc:r},"next"===this.method&&(this.arg=void 0),h}},t}function ne(t,e,r,n,o,i,a){try{var c=t[i](a),u=c.value}catch(t){return void r(t)}c.done?e(u):Promise.resolve(u).then(n,o)}function oe(t){return function(){var e=this,r=arguments;return new Promise((function(n,o){var i=t.apply(e,r);function a(t){ne(i,n,o,a,c,"next",t)}function c(t){ne(i,n,o,a,c,"throw",t)}a(void 0)}))}}function ie(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function ae(t,e){for(var r=0;e.length>r;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,me(n.key),n)}}function ce(t,e,r){return e&&ae(t.prototype,e),r&&ae(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function ue(t,e,r){return(e=me(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function se(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&fe(t,e)}function le(t){return le=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},le(t)}function fe(t,e){return fe=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},fe(t,e)}function he(t,e){if(e&&("object"===n(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}function pe(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var r,n=le(t);if(e){var o=le(this).constructor;r=Reflect.construct(n,arguments,o)}else r=n.apply(this,arguments);return he(this,r)}}function ve(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var r=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=r){var n,o,i,a,c=[],u=!0,s=!1;try{if(i=(r=r.call(t)).next,0===e){if(Object(r)!==r)return;u=!1}else for(;!(u=(n=i.call(r)).done)&&(c.push(n.value),c.length!==e);u=!0);}catch(t){s=!0,o=t}finally{try{if(!u&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(s)throw o}}return c}}(t,e)||ye(t,e)||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 de(t){return function(t){if(Array.isArray(t))return ge(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||ye(t)||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 ye(t,e){if(t){if("string"==typeof t)return ge(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?ge(t,e):void 0}}function ge(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=Array(e);e>r;r++)n[r]=t[r];return n}function me(t){var e=function(t,e){if("object"!==n(t)||null===t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var o=r.call(t,e||"default");if("object"!==n(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"===n(e)?e:e+""}var be=function(){function t(e){ie(this,t),this.canvasRendererPluginOptions=void 0,this.context=void 0,this.pathGeneratorFactory=void 0,this.rBush=void 0,this.removedRBushNodeAABBs=[],this.renderQueue=[],this.restoreStack=[],this.clearFullScreen=!1,this.vpMatrix=d(),this.dprMatrix=d(),this.tmpMat4=d(),this.vec3a=b(),this.vec3b=b(),this.vec3c=b(),this.vec3d=b(),this.canvasRendererPluginOptions=e}return ce(t,[{key:"apply",value:function(r){var n=this;this.context=r;var o=r.config,i=r.camera,a=r.renderingService,c=r.renderingContext,u=r.pathGeneratorFactory;this.rBush=r.rBushRoot,this.pathGeneratorFactory=u;var s=r.contextService,l=c.root.ownerDocument.defaultView,f=function(t){var e=t.target.rBushNode;e.aabb&&n.removedRBushNodeAABBs.push(e.aabb)},h=function(t){var e=t.target.rBushNode;e.aabb&&n.removedRBushNodeAABBs.push(e.aabb)};a.hooks.init.tapPromise(t.tag,oe(re().mark((function t(){var r,i,a,c;return re().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:l.addEventListener(e.ElementEvent.UNMOUNTED,f),l.addEventListener(e.ElementEvent.CULLED,h),r=s.getDPR(),i=o.width,a=o.height,c=s.getContext(),n.clearRect(c,0,0,i*r,a*r,o.background);case 6:case"end":return t.stop()}}),t)})))),a.hooks.destroy.tap(t.tag,(function(){l.removeEventListener(e.ElementEvent.UNMOUNTED,f),l.removeEventListener(e.ElementEvent.CULLED,h)})),a.hooks.beginFrame.tap(t.tag,(function(){var t=s.getContext(),e=s.getDPR(),r=o.width,i=o.height,c=n.canvasRendererPluginOptions,u=c.dirtyObjectNumThreshold,l=c.dirtyObjectRatioThreshold,f=a.getStats(),h=f.rendered,p=h/f.total;n.clearFullScreen=a.disableDirtyRectangleRendering()||h>u&&p>l,t&&(t.resetTransform(),n.clearFullScreen&&n.clearRect(t,0,0,r*e,i*e,o.background))}));var p=function t(e,r){e.isVisible()&&!e.isCulled()&&(n.renderDisplayObject(e,r,n.context,n.restoreStack),n.saveDirtyAABB(e)),(e.sortable.sorted||e.childNodes).forEach((function(e){t(e,r)}))};a.hooks.endFrame.tap(t.tag,(function(){var t,r,a=s.getContext(),u=s.getDPR();if(t=n.dprMatrix,r=w(u,u,1),t[0]=r[0],t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=r[1],t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=r[2],t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,g(n.vpMatrix,n.dprMatrix,i.getOrthoMatrix()),n.clearFullScreen)p(c.root,a);else{var f=n.safeMergeAABB.apply(n,[n.mergeDirtyAABBs(n.renderQueue)].concat(de(n.removedRBushNodeAABBs.map((function(t){var r=t.minX,n=t.minY,o=t.maxX,i=t.maxY,a=new e.AABB;return a.setMinMax(w(r,n,0),w(o,i,0)),a})))));if(n.removedRBushNodeAABBs=[],e.AABB.isEmpty(f))return void(n.renderQueue=[]);var h=n.convertAABB2Rect(f),v=h.x,d=h.y,y=h.width,m=h.height,b=E(n.vec3a,w(v,d,0),n.vpMatrix),x=E(n.vec3b,w(v+y,d,0),n.vpMatrix),O=E(n.vec3c,w(v,d+m,0),n.vpMatrix),P=E(n.vec3d,w(v+y,d+m,0),n.vpMatrix),L=Math.min(b[0],x[0],P[0],O[0]),S=Math.min(b[1],x[1],P[1],O[1]),k=Math.max(b[0],x[0],P[0],O[0]),j=Math.max(b[1],x[1],P[1],O[1]),M=Math.floor(L),T=Math.floor(S),A=Math.ceil(k-L),_=Math.ceil(j-S);a.save(),n.clearRect(a,M,T,A,_,o.background),a.beginPath(),a.rect(M,T,A,_),a.clip(),a.setTransform(n.vpMatrix[0],n.vpMatrix[1],n.vpMatrix[4],n.vpMatrix[5],n.vpMatrix[12],n.vpMatrix[13]),o.renderer.getConfig().enableDirtyRectangleRenderingDebug&&l.dispatchEvent(new e.CustomEvent(e.CanvasEvent.DIRTY_RECTANGLE,{dirtyRect:{x:M,y:T,width:A,height:_}})),n.searchDirtyObjects(f).sort((function(t,e){return t.sortable.renderOrder-e.sortable.renderOrder})).forEach((function(t){t&&t.isVisible()&&!t.isCulled()&&n.renderDisplayObject(t,a,n.context,n.restoreStack)})),a.restore(),n.renderQueue.forEach((function(t){n.saveDirtyAABB(t)})),n.renderQueue=[]}n.restoreStack.forEach((function(){a.restore()})),n.restoreStack=[]})),a.hooks.render.tap(t.tag,(function(t){n.clearFullScreen||n.renderQueue.push(t)}))}},{key:"clearRect",value:function(t,e,r,n,o,i){t.clearRect(e,r,n,o),i&&(t.fillStyle=i,t.fillRect(e,r,n,o))}},{key:"renderDisplayObject",value:function(t,r,n,o){var i=t.nodeName,a=o[o.length-1];!a||t.compareDocumentPosition(a)&Node.DOCUMENT_POSITION_CONTAINS||(r.restore(),o.pop());var c=this.context.styleRendererFactory[i],u=this.pathGeneratorFactory[i],s=t.parsedStyle.clipPath;if(s){this.applyWorldTransform(r,s);var l=this.pathGeneratorFactory[s.nodeName];l&&(r.save(),o.push(t),r.beginPath(),l(r,s.parsedStyle),r.closePath(),r.clip())}c&&(this.applyWorldTransform(r,t),r.save(),this.applyAttributesToContext(r,t)),u&&(r.beginPath(),u(r,t.parsedStyle),t.nodeName!==e.Shape.LINE&&t.nodeName!==e.Shape.PATH&&t.nodeName!==e.Shape.POLYLINE&&r.closePath()),c&&(c.render(r,t.parsedStyle,t,n,this),r.restore()),t.renderable.dirty=!1}},{key:"convertAABB2Rect",value:function(t){var e=t.getMin(),r=t.getMax(),n=Math.floor(e[0]),o=Math.floor(e[1]);return{x:n,y:o,width:Math.ceil(r[0])-n,height:Math.ceil(r[1])-o}}},{key:"mergeDirtyAABBs",value:function(t){var r=new e.AABB;return t.forEach((function(t){var e=t.getRenderBounds();r.add(e);var n=t.renderable.dirtyRenderBounds;n&&r.add(n)})),r}},{key:"searchDirtyObjects",value:function(t){var r=ve(t.getMin(),2),n=r[0],o=r[1],i=ve(t.getMax(),2);return this.rBush.search({minX:n,minY:o,maxX:i[0],maxY:i[1]}).map((function(t){return e.runtime.displayObjectPool.getByEntity(t.id)}))}},{key:"saveDirtyAABB",value:function(t){var r=t.renderable;r.dirtyRenderBounds||(r.dirtyRenderBounds=new e.AABB);var n=t.getRenderBounds();n&&r.dirtyRenderBounds.update(n.center,n.halfExtents)}},{key:"applyAttributesToContext",value:function(t,e){var r=e.parsedStyle,n=r.stroke,o=r.fill,i=r.opacity,a=r.lineDash,c=r.lineDashOffset;a&&t.setLineDash(a),S(c)||(t.lineDashOffset=c),S(i)||(t.globalAlpha*=i),S(n)||Array.isArray(n)||n.isNone||(t.strokeStyle=e.attributes.stroke),S(o)||Array.isArray(o)||o.isNone||(t.fillStyle=e.attributes.fill)}},{key:"applyWorldTransform",value:function(t,e,r){var n=0,o=0,i=(e.parsedStyle||{}).anchor,a=i&&i[0]||0,c=i&&i[1]||0;if(0!==a||0!==c){var u=e.getGeometryBounds();n=-a*(u&&2*u.halfExtents[0]||0),o=-c*(u&&2*u.halfExtents[1]||0)}r?(y(this.tmpMat4,e.getLocalTransform()),this.vec3a[0]=n,this.vec3a[1]=o,this.vec3a[2]=0,m(this.tmpMat4,this.tmpMat4,this.vec3a),g(this.tmpMat4,r,this.tmpMat4),g(this.tmpMat4,this.vpMatrix,this.tmpMat4)):(y(this.tmpMat4,e.getWorldTransform()),this.vec3a[0]=n,this.vec3a[1]=o,this.vec3a[2]=0,m(this.tmpMat4,this.tmpMat4,this.vec3a),g(this.tmpMat4,this.vpMatrix,this.tmpMat4)),t.setTransform(this.tmpMat4[0],this.tmpMat4[1],this.tmpMat4[4],this.tmpMat4[5],this.tmpMat4[12],this.tmpMat4[13])}},{key:"safeMergeAABB",value:function(){for(var t=new e.AABB,r=arguments.length,n=Array(r),o=0;r>o;o++)n[o]=arguments[o];return n.forEach((function(e){t.add(e)})),t}}]),t}();be.tag="CanvasRenderer";var we=function(){function t(e){ie(this,t),this.imagePool=void 0,this.imagePool=e}return ce(t,[{key:"render",value:function(t,r,n,o,i){var a=r.fill,c=r.fillRule,u=r.opacity,s=r.fillOpacity,l=r.stroke,f=r.strokeOpacity,h=r.lineWidth,p=r.lineCap,v=r.lineJoin,d=r.shadowType,y=r.shadowColor,g=r.shadowBlur,m=r.filter,b=r.miterLimit,w=!S(a)&&!a.isNone,x=!S(l)&&!l.isNone&&h>0,E=0===a.alpha,O=!(!m||!m.length),P=!S(y)&&g>0,L=n.nodeName,k="inner"===d,j=x&&P&&(L===e.Shape.PATH||L===e.Shape.LINE||L===e.Shape.POLYLINE||E||k);w&&(t.globalAlpha=u*s,j||xe(n,t,P),this.fill(t,n,a,c,o,i),j||this.clearShadowAndFilter(t,O,P)),x&&(t.globalAlpha=u*f,t.lineWidth=h,S(b)||(t.miterLimit=b),S(p)||(t.lineCap=p),S(v)||(t.lineJoin=v),j&&(k&&(t.globalCompositeOperation="source-atop"),xe(n,t,!0),k&&(this.stroke(t,n,l,o,i),t.globalCompositeOperation="source-over",this.clearShadowAndFilter(t,O,!0))),this.stroke(t,n,l,o,i))}},{key:"clearShadowAndFilter",value:function(t,e,r){if(r&&(t.shadowColor="transparent",t.shadowBlur=0),e){var n=t.filter;!S(n)&&n.indexOf("drop-shadow")>-1&&(t.filter=n.replace(/drop-shadow\([^)]*\)/,"").trim()||"none")}}},{key:"fill",value:function(t,r,n,o,i,a){var c=this;Array.isArray(n)?n.forEach((function(e){t.fillStyle=c.getColor(e,r,t),t.fill(o)})):(e.isPattern(n)&&(t.fillStyle=this.getPattern(n,r,t,i,a)),t.fill(o))}},{key:"stroke",value:function(t,r,n,o,i){var a=this;Array.isArray(n)?n.forEach((function(e){t.strokeStyle=a.getColor(e,r,t),t.stroke()})):(e.isPattern(n)&&(t.strokeStyle=this.getPattern(n,r,t,o,i)),t.stroke())}},{key:"getPattern",value:function(t,r,n,o,i){var a,c;if(t.image instanceof e.Rect){var u=t.image.parsedStyle,s=u.width,l=u.height;c=o.contextService.getDPR();var f=o.config.offscreenCanvas;(a=e.runtime.offscreenCanvas.getOrCreateCanvas(f)).width=s*c,a.height=l*c;var h=e.runtime.offscreenCanvas.getOrCreateContext(f),p=[];t.image.forEach((function(t){i.renderDisplayObject(t,h,o,p)})),p.forEach((function(){h.restore()}))}return this.imagePool.getOrCreatePatternSync(t,n,a,c,(function(){r.renderable.dirty=!0,o.renderingService.dirtify()}))}},{key:"getColor",value:function(t,r,n){var o;if(t.type===e.GradientType.LinearGradient||t.type===e.GradientType.RadialGradient){var i=r.getGeometryBounds(),a=i&&2*i.halfExtents[0]||1,c=i&&2*i.halfExtents[1]||1;o=this.imagePool.getOrCreateGradient(ee(ee({type:t.type},t.value),{},{width:a,height:c}),n)}return o}}]),t}();function xe(t,e,r){var n=t.parsedStyle,o=n.filter,i=n.shadowColor,a=n.shadowBlur,c=n.shadowOffsetX,u=n.shadowOffsetY;o&&o.length&&(e.filter=t.style.filter),r&&(e.shadowColor=""+i,e.shadowBlur=a||0,e.shadowOffsetX=c||0,e.shadowOffsetY=u||0)}var Ee=function(){function t(e){ie(this,t),this.imagePool=void 0,this.imagePool=e}return ce(t,[{key:"render",value:function(t,e,r){var n,o=e.img,i=e.shadowColor,a=e.shadowBlur,c=e.width,u=e.height;if(j(o)?n=this.imagePool.getImageSync(o):(c||(c=o.width),u||(u=o.height),n=o),n){xe(r,t,!S(i)&&a>0);try{t.drawImage(n,0,0,c,u)}catch(t){}}}}]),t}(),Oe=function(){function t(){ie(this,t)}return ce(t,[{key:"render",value:function(t,e,r){var n=e.lineWidth,o=e.textAlign,i=e.textBaseline,a=e.lineJoin,c=e.miterLimit,u=e.letterSpacing,s=e.stroke,l=e.fill,f=e.fillOpacity,h=e.strokeOpacity,p=e.opacity,v=e.metrics,d=e.dx,y=e.dy,g=e.shadowColor,m=e.shadowBlur,b=v.lines,w=v.height,x=v.lineHeight,E=v.lineMetrics;t.font=v.font,t.lineWidth=n,t.textAlign="middle"===o?"center":o,t.textBaseline=i,t.lineJoin=a,S(c)||(t.miterLimit=c);var O=0;"middle"===i?O=-w/2-x/2:"bottom"===i||"alphabetic"===i||"ideographic"===i?O=-w:"top"!==i&&"hanging"!==i||(O=-x);var P=d||0;O+=y||0,xe(r,t,!S(g)&&m>0);for(var L=0;b.length>L;L++){var k=n/2+P;O+=x,S(s)||s.isNone||!n||this.drawLetterSpacing(t,b[L],E[L],o,k,O,u,f,h,p,!0),S(l)||this.drawLetterSpacing(t,b[L],E[L],o,k,O,u,f,h,p)}}},{key:"drawLetterSpacing",value:function(t,e,r,n,o,i,a,c,u,s){var l=arguments.length>10&&void 0!==arguments[10]&&arguments[10];if(0!==a){var f=t.textAlign;t.textAlign="left";var h=o;"center"===n||"middle"===n?h=o-r.width/2:"right"!==n&&"end"!==n||(h=o-r.width);for(var p=Array.from(e),v=t.measureText(e).width,d=0,y=0;p.length>y;++y){var g=p[y];l?this.strokeText(t,g,h,i,u):this.fillText(t,g,h,i,c,s),h+=v-(d=t.measureText(e.substring(y+1)).width)+a,v=d}t.textAlign=f}else l?this.strokeText(t,e,o,i,u):this.fillText(t,e,o,i,c,s)}},{key:"fillText",value:function(t,e,r,n,o,i){var a,c=!S(o)&&1!==o;c&&(a=t.globalAlpha,t.globalAlpha=o*i),t.fillText(e,r,n),c&&(t.globalAlpha=a)}},{key:"strokeText",value:function(t,e,r,n,o){var i,a=!S(o)&&1!==o;a&&(i=t.globalAlpha,t.globalAlpha=o),t.strokeText(e,r,n),a&&(t.globalAlpha=i)}}]),t}(),Pe=function(t){se(r,t);var e=pe(r);function r(){return ie(this,r),e.apply(this,arguments)}return ce(r)}(we),Le=function(t){se(r,t);var e=pe(r);function r(){return ie(this,r),e.apply(this,arguments)}return ce(r)}(we),Se=function(t){se(r,t);var e=pe(r);function r(){return ie(this,r),e.apply(this,arguments)}return ce(r)}(we),ke=function(t){se(r,t);var e=pe(r);function r(){return ie(this,r),e.apply(this,arguments)}return ce(r)}(we),je=function(t){se(r,t);var e=pe(r);function r(){return ie(this,r),e.apply(this,arguments)}return ce(r)}(we),Me=function(t){se(r,t);var e=pe(r);function r(){return ie(this,r),e.apply(this,arguments)}return ce(r)}(we),Te=function(t){se(r,t);var e=pe(r);function r(){return ie(this,r),e.apply(this,arguments)}return ce(r)}(we),Ae=function(t){se(n,t);var r=pe(n);function n(){var t,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return ie(this,n),(t=r.call(this)).options=void 0,t.name="canvas-renderer",t.options=e,t}return ce(n,[{key:"init",value:function(){var t,r=ee({dirtyObjectNumThreshold:500,dirtyObjectRatioThreshold:.8},this.options),n=this.context.imagePool,o=new we(n),i=(ue(t={},e.Shape.CIRCLE,o),ue(t,e.Shape.ELLIPSE,o),ue(t,e.Shape.RECT,o),ue(t,e.Shape.IMAGE,new Ee(n)),ue(t,e.Shape.TEXT,new Oe),ue(t,e.Shape.LINE,o),ue(t,e.Shape.POLYLINE,o),ue(t,e.Shape.POLYGON,o),ue(t,e.Shape.PATH,o),ue(t,e.Shape.GROUP,void 0),ue(t,e.Shape.HTML,void 0),ue(t,e.Shape.MESH,void 0),t);this.context.defaultStyleRendererFactory=i,this.context.styleRendererFactory=i,this.addRenderingPlugin(new be(r))}},{key:"destroy",value:function(){this.removeAllRenderingPlugins(),delete this.context.defaultStyleRendererFactory,delete this.context.styleRendererFactory}}]),n}(e.AbstractRendererPlugin),_e=Object.freeze({__proto__:null,CircleRenderer:Le,EllipseRenderer:Se,ImageRenderer:Ee,LineRenderer:ke,PathRenderer:Te,Plugin:Ae,PolygonRenderer:Me,PolylineRenderer:je,RectRenderer:Pe,TextRenderer:Oe});function Re(){Re=function(){return t};var t={},e=Object.prototype,r=e.hasOwnProperty,o=Object.defineProperty||function(t,e,r){t[e]=r.value},i="function"==typeof Symbol?Symbol:{},a=i.iterator||"@@iterator",c=i.asyncIterator||"@@asyncIterator",u=i.toStringTag||"@@toStringTag";function s(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{s({},"")}catch(t){s=function(t,e,r){return t[e]=r}}function l(t,e,r,n){var i=Object.create((e&&e.prototype instanceof p?e:p).prototype),a=new S(n||[]);return o(i,"_invoke",{value:E(t,r,a)}),i}function f(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}t.wrap=l;var h={};function p(){}function v(){}function d(){}var y={};s(y,a,(function(){return this}));var g=Object.getPrototypeOf,m=g&&g(g(k([])));m&&m!==e&&r.call(m,a)&&(y=m);var b=d.prototype=p.prototype=Object.create(y);function w(t){["next","throw","return"].forEach((function(e){s(t,e,(function(t){return this._invoke(e,t)}))}))}function x(t,e){function i(o,a,c,u){var s=f(t[o],t,a);if("throw"!==s.type){var l=s.arg,h=l.value;return h&&"object"==n(h)&&r.call(h,"__await")?e.resolve(h.__await).then((function(t){i("next",t,c,u)}),(function(t){i("throw",t,c,u)})):e.resolve(h).then((function(t){l.value=t,c(l)}),(function(t){return i("throw",t,c,u)}))}u(s.arg)}var a;o(this,"_invoke",{value:function(t,r){function n(){return new e((function(e,n){i(t,r,e,n)}))}return a=a?a.then(n,n):n()}})}function E(t,e,r){var n="suspendedStart";return function(o,i){if("executing"===n)throw Error("Generator is already running");if("completed"===n){if("throw"===o)throw i;return j()}for(r.method=o,r.arg=i;;){var a=r.delegate;if(a){var c=O(a,r);if(c){if(c===h)continue;return c}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if("suspendedStart"===n)throw n="completed",r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n="executing";var u=f(t,e,r);if("normal"===u.type){if(n=r.done?"completed":"suspendedYield",u.arg===h)continue;return{value:u.arg,done:r.done}}"throw"===u.type&&(n="completed",r.method="throw",r.arg=u.arg)}}}function O(t,e){var r=e.method,n=t.iterator[r];if(void 0===n)return e.delegate=null,"throw"===r&&t.iterator.return&&(e.method="return",e.arg=void 0,O(t,e),"throw"===e.method)||"return"!==r&&(e.method="throw",e.arg=new TypeError("The iterator does not provide a '"+r+"' method")),h;var o=f(n,t.iterator,e.arg);if("throw"===o.type)return e.method="throw",e.arg=o.arg,e.delegate=null,h;var i=o.arg;return i?i.done?(e[t.resultName]=i.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=void 0),e.delegate=null,h):i:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,h)}function P(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function L(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function S(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(P,this),this.reset(!0)}function k(t){if(t){var e=t[a];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var n=-1,o=function e(){for(;++n<t.length;)if(r.call(t,n))return e.value=t[n],e.done=!1,e;return e.value=void 0,e.done=!0,e};return o.next=o}}return{next:j}}function j(){return{value:void 0,done:!0}}return v.prototype=d,o(b,"constructor",{value:d,configurable:!0}),o(d,"constructor",{value:v,configurable:!0}),v.displayName=s(d,u,"GeneratorFunction"),t.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===v||"GeneratorFunction"===(e.displayName||e.name))},t.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,d):(t.__proto__=d,s(t,u,"GeneratorFunction")),t.prototype=Object.create(b),t},t.awrap=function(t){return{__await:t}},w(x.prototype),s(x.prototype,c,(function(){return this})),t.AsyncIterator=x,t.async=function(e,r,n,o,i){void 0===i&&(i=Promise);var a=new x(l(e,r,n,o),i);return t.isGeneratorFunction(r)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},w(b),s(b,u,"Generator"),s(b,a,(function(){return this})),s(b,"toString",(function(){return"[object Generator]"})),t.keys=function(t){var e=Object(t),r=[];for(var n in e)r.push(n);return r.reverse(),function t(){for(;r.length;){var n=r.pop();if(n in e)return t.value=n,t.done=!1,t}return t.done=!0,t}},t.values=k,S.prototype={constructor:S,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(L),!t)for(var e in this)"t"===e.charAt(0)&&r.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=void 0)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var e=this;function n(r,n){return a.type="throw",a.arg=t,e.next=r,n&&(e.method="next",e.arg=void 0),!!n}for(var o=this.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],a=i.completion;if("root"===i.tryLoc)return n("end");if(this.prev>=i.tryLoc){var c=r.call(i,"catchLoc"),u=r.call(i,"finallyLoc");if(c&&u){if(i.catchLoc>this.prev)return n(i.catchLoc,!0);if(i.finallyLoc>this.prev)return n(i.finallyLoc)}else if(c){if(i.catchLoc>this.prev)return n(i.catchLoc,!0)}else{if(!u)throw Error("try statement without catch or finally");if(i.finallyLoc>this.prev)return n(i.finallyLoc)}}}},abrupt:function(t,e){for(var n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n];if(this.prev>=o.tryLoc&&r.call(o,"finallyLoc")&&o.finallyLoc>this.prev){var i=o;break}}i&&("break"===t||"continue"===t)&&e>=i.tryLoc&&i.finallyLoc>=e&&(i=null);var a=i?i.completion:{};return a.type=t,a.arg=e,i?(this.method="next",this.next=i.finallyLoc,h):this.complete(a)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),h},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),L(r),h}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;L(r)}return o}}throw Error("illegal catch attempt")},delegateYield:function(t,e,r){return this.delegate={iterator:k(t),resultName:e,nextLoc:r},"next"===this.method&&(this.arg=void 0),h}},t}function Ce(t,e,r,n,o,i,a){try{var c=t[i](a),u=c.value}catch(t){return void r(t)}c.done?e(u):Promise.resolve(u).then(n,o)}function Ne(t){return function(){var e=this,r=arguments;return new Promise((function(n,o){var i=t.apply(e,r);function a(t){Ce(i,n,o,a,c,"next",t)}function c(t){Ce(i,n,o,a,c,"throw",t)}a(void 0)}))}}function Ie(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function Ge(t,e){for(var r=0;e.length>r;r++){var o=e[r];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(t,(i=void 0,i=function(t,e){if("object"!==n(t)||null===t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var o=r.call(t,e||"default");if("object"!==n(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(o.key,"string"),"symbol"===n(i)?i:i+""),o)}var i}function Be(t,e,r){return e&&Ge(t.prototype,e),r&&Ge(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function De(t){return De=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},De(t)}function Fe(t,e){return Fe=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Fe(t,e)}function $e(t,e){if(e&&("object"===n(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}function He(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var r,n=De(t);if(e){var o=De(this).constructor;r=Reflect.construct(n,arguments,o)}else r=n.apply(this,arguments);return $e(this,r)}}var Ye=function(){function t(){Ie(this,t),this.context=void 0}return Be(t,[{key:"apply",value:function(e){var r=this,n=e.renderingService,o=e.renderingContext;this.context=e;var i=o.root.ownerDocument.defaultView,a=function(t){n.hooks.pointerMove.call(t)},c=function(t){n.hooks.pointerUp.call(t)},u=function(t){n.hooks.pointerDown.call(t)},s=function(t){n.hooks.pointerOver.call(t)},l=function(t){n.hooks.pointerOut.call(t)},f=function(t){n.hooks.pointerCancel.call(t)},h=function(t){n.hooks.pointerWheel.call(t)},p=function(t){globalThis.document.addEventListener("pointermove",a,!0),t.addEventListener("pointerdown",u,!0),t.addEventListener("pointerleave",l,!0),t.addEventListener("pointerover",s,!0),globalThis.addEventListener("pointerup",c,!0)},v=function(t){t.addEventListener("touchstart",u,!0),t.addEventListener("touchend",c,!0),t.addEventListener("touchmove",a,!0),t.addEventListener("touchcancel",f,!0)},d=function(t){globalThis.document.addEventListener("mousemove",a,!0),t.addEventListener("mousedown",u,!0),t.addEventListener("mouseout",l,!0),t.addEventListener("mouseover",s,!0),globalThis.addEventListener("mouseup",c,!0)};n.hooks.init.tapPromise(t.tag,Ne(Re().mark((function t(){var e;return Re().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:e=r.context.contextService.getDomElement(),globalThis.navigator.msPointerEnabled?(e.style.msContentZooming="none",e.style.msTouchAction="none"):i.supportsPointerEvents&&(e.style.touchAction="none"),i.supportsPointerEvents?p(e):d(e),i.supportsTouchEvents&&v(e),e.addEventListener("wheel",h,{passive:!0,capture:!0});case 5:case"end":return t.stop()}}),t)})))),n.hooks.destroy.tap(t.tag,(function(){var t=r.context.contextService.getDomElement();globalThis.navigator.msPointerEnabled?(t.style.msContentZooming="",t.style.msTouchAction=""):i.supportsPointerEvents&&(t.style.touchAction=""),i.supportsPointerEvents?function(t){globalThis.document.removeEventListener("pointermove",a,!0),t.removeEventListener("pointerdown",u,!0),t.removeEventListener("pointerleave",l,!0),t.removeEventListener("pointerover",s,!0),globalThis.removeEventListener("pointerup",c,!0)}(t):function(t){globalThis.document.removeEventListener("mousemove",a,!0),t.removeEventListener("mousedown",u,!0),t.removeEventListener("mouseout",l,!0),t.removeEventListener("mouseover",s,!0),globalThis.removeEventListener("mouseup",c,!0)}(t),i.supportsTouchEvents&&function(t){t.removeEventListener("touchstart",u,!0),t.removeEventListener("touchend",c,!0),t.removeEventListener("touchmove",a,!0),t.removeEventListener("touchcancel",f,!0)}(t),t.removeEventListener("wheel",h,!0)}))}}]),t}();Ye.tag="DOMInteraction";var We=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Fe(t,e)}(r,t);var e=He(r);function r(){var t;Ie(this,r);for(var n=arguments.length,o=Array(n),i=0;n>i;i++)o[i]=arguments[i];return(t=e.call.apply(e,[this].concat(o))).name="dom-interaction",t}return Be(r,[{key:"init",value:function(){this.addRenderingPlugin(new Ye)}},{key:"destroy",value:function(){this.removeAllRenderingPlugins()}}]),r}(e.AbstractRendererPlugin),Ue=Object.freeze({__proto__:null,Plugin:We});function Xe(){Xe=function(){return t};var t={},e=Object.prototype,r=e.hasOwnProperty,o=Object.defineProperty||function(t,e,r){t[e]=r.value},i="function"==typeof Symbol?Symbol:{},a=i.iterator||"@@iterator",c=i.asyncIterator||"@@asyncIterator",u=i.toStringTag||"@@toStringTag";function s(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{s({},"")}catch(t){s=function(t,e,r){return t[e]=r}}function l(t,e,r,n){var i=Object.create((e&&e.prototype instanceof p?e:p).prototype),a=new S(n||[]);return o(i,"_invoke",{value:E(t,r,a)}),i}function f(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}t.wrap=l;var h={};function p(){}function v(){}function d(){}var y={};s(y,a,(function(){return this}));var g=Object.getPrototypeOf,m=g&&g(g(k([])));m&&m!==e&&r.call(m,a)&&(y=m);var b=d.prototype=p.prototype=Object.create(y);function w(t){["next","throw","return"].forEach((function(e){s(t,e,(function(t){return this._invoke(e,t)}))}))}function x(t,e){function i(o,a,c,u){var s=f(t[o],t,a);if("throw"!==s.type){var l=s.arg,h=l.value;return h&&"object"==n(h)&&r.call(h,"__await")?e.resolve(h.__await).then((function(t){i("next",t,c,u)}),(function(t){i("throw",t,c,u)})):e.resolve(h).then((function(t){l.value=t,c(l)}),(function(t){return i("throw",t,c,u)}))}u(s.arg)}var a;o(this,"_invoke",{value:function(t,r){function n(){return new e((function(e,n){i(t,r,e,n)}))}return a=a?a.then(n,n):n()}})}function E(t,e,r){var n="suspendedStart";return function(o,i){if("executing"===n)throw Error("Generator is already running");if("completed"===n){if("throw"===o)throw i;return j()}for(r.method=o,r.arg=i;;){var a=r.delegate;if(a){var c=O(a,r);if(c){if(c===h)continue;return c}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if("suspendedStart"===n)throw n="completed",r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n="executing";var u=f(t,e,r);if("normal"===u.type){if(n=r.done?"completed":"suspendedYield",u.arg===h)continue;return{value:u.arg,done:r.done}}"throw"===u.type&&(n="completed",r.method="throw",r.arg=u.arg)}}}function O(t,e){var r=e.method,n=t.iterator[r];if(void 0===n)return e.delegate=null,"throw"===r&&t.iterator.return&&(e.method="return",e.arg=void 0,O(t,e),"throw"===e.method)||"return"!==r&&(e.method="throw",e.arg=new TypeError("The iterator does not provide a '"+r+"' method")),h;var o=f(n,t.iterator,e.arg);if("throw"===o.type)return e.method="throw",e.arg=o.arg,e.delegate=null,h;var i=o.arg;return i?i.done?(e[t.resultName]=i.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=void 0),e.delegate=null,h):i:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,h)}function P(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function L(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function S(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(P,this),this.reset(!0)}function k(t){if(t){var e=t[a];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var n=-1,o=function e(){for(;++n<t.length;)if(r.call(t,n))return e.value=t[n],e.done=!1,e;return e.value=void 0,e.done=!0,e};return o.next=o}}return{next:j}}function j(){return{value:void 0,done:!0}}return v.prototype=d,o(b,"constructor",{value:d,configurable:!0}),o(d,"constructor",{value:v,configurable:!0}),v.displayName=s(d,u,"GeneratorFunction"),t.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===v||"GeneratorFunction"===(e.displayName||e.name))},t.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,d):(t.__proto__=d,s(t,u,"GeneratorFunction")),t.prototype=Object.create(b),t},t.awrap=function(t){return{__await:t}},w(x.prototype),s(x.prototype,c,(function(){return this})),t.AsyncIterator=x,t.async=function(e,r,n,o,i){void 0===i&&(i=Promise);var a=new x(l(e,r,n,o),i);return t.isGeneratorFunction(r)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},w(b),s(b,u,"Generator"),s(b,a,(function(){return this})),s(b,"toString",(function(){return"[object Generator]"})),t.keys=function(t){var e=Object(t),r=[];for(var n in e)r.push(n);return r.reverse(),function t(){for(;r.length;){var n=r.pop();if(n in e)return t.value=n,t.done=!1,t}return t.done=!0,t}},t.values=k,S.prototype={constructor:S,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(L),!t)for(var e in this)"t"===e.charAt(0)&&r.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=void 0)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var e=this;function n(r,n){return a.type="throw",a.arg=t,e.next=r,n&&(e.method="next",e.arg=void 0),!!n}for(var o=this.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],a=i.completion;if("root"===i.tryLoc)return n("end");if(this.prev>=i.tryLoc){var c=r.call(i,"catchLoc"),u=r.call(i,"finallyLoc");if(c&&u){if(i.catchLoc>this.prev)return n(i.catchLoc,!0);if(i.finallyLoc>this.prev)return n(i.finallyLoc)}else if(c){if(i.catchLoc>this.prev)return n(i.catchLoc,!0)}else{if(!u)throw Error("try statement without catch or finally");if(i.finallyLoc>this.prev)return n(i.finallyLoc)}}}},abrupt:function(t,e){for(var n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n];if(this.prev>=o.tryLoc&&r.call(o,"finallyLoc")&&o.finallyLoc>this.prev){var i=o;break}}i&&("break"===t||"continue"===t)&&e>=i.tryLoc&&i.finallyLoc>=e&&(i=null);var a=i?i.completion:{};return a.type=t,a.arg=e,i?(this.method="next",this.next=i.finallyLoc,h):this.complete(a)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),h},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),L(r),h}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;L(r)}return o}}throw Error("illegal catch attempt")},delegateYield:function(t,e,r){return this.delegate={iterator:k(t),resultName:e,nextLoc:r},"next"===this.method&&(this.arg=void 0),h}},t}function ze(t,e,r,n,o,i,a){try{var c=t[i](a),u=c.value}catch(t){return void r(t)}c.done?e(u):Promise.resolve(u).then(n,o)}function qe(t){return function(){var e=this,r=arguments;return new Promise((function(n,o){var i=t.apply(e,r);function a(t){ze(i,n,o,a,c,"next",t)}function c(t){ze(i,n,o,a,c,"throw",t)}a(void 0)}))}}function Qe(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function Ve(t,e){for(var r=0;e.length>r;r++){var o=e[r];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(t,(i=void 0,i=function(t,e){if("object"!==n(t)||null===t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var o=r.call(t,e||"default");if("object"!==n(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(o.key,"string"),"symbol"===n(i)?i:i+""),o)}var i}function Ze(t,e,r){return e&&Ve(t.prototype,e),r&&Ve(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function Je(t){return Je=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Je(t)}function Ke(t,e){return Ke=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Ke(t,e)}function tr(t,e){if(e&&("object"===n(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}function er(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var r,n=Je(t);if(e){var o=Je(this).constructor;r=Reflect.construct(n,arguments,o)}else r=n.apply(this,arguments);return tr(this,r)}}var rr=function(){function t(){Qe(this,t),this.context=void 0,this.$camera=void 0}return Ze(t,[{key:"joinTransformMatrix",value:function(t){return"matrix(".concat([t[0],t[1],t[4],t[5],t[12],t[13]].join(","),")")}},{key:"apply",value:function(r){var n=this,o=r.camera,i=r.renderingContext,a=r.renderingService,c=r.displayObjectPool;this.context=r;var u=i.root.ownerDocument.defaultView,s=function(t,e){e.style.transform=n.joinTransformMatrix(t.getWorldTransform())},l=function(t){var r=t.target;if(r.nodeName===e.Shape.HTML){n.$camera||(n.$camera=n.createCamera(o));var i=n.getOrCreateEl(r);n.$camera.appendChild(i);var a=r.ownerDocument.documentElement.attributes;Object.keys(a).forEach((function(t){i.style[t]=a[t]})),Object.keys(r.attributes).forEach((function(t){n.updateAttribute(t,r)})),s(r,i)}},f=function(t){var r=t.target;if(r.nodeName===e.Shape.HTML&&n.$camera){var o=n.getOrCreateEl(r);o&&o.remove()}},h=function(t){var r=t.target;r.nodeName===e.Shape.HTML&&n.updateAttribute(t.attrName,r)},p=function(t){var r=t.target;if(r.nodeName===e.Shape.HTML){var o=n.getOrCreateEl(r);s(r,o)}},v=function(){if(n.$camera){var t=n.context.config,e=t.height;n.$camera.style.width="".concat(t.width||0,"px"),n.$camera.style.height="".concat(e||0,"px")}};a.hooks.init.tapPromise(t.tag,qe(Xe().mark((function t(){return Xe().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:c.getHTMLs().length&&(n.$camera=n.createCamera(o)),u.addEventListener(e.CanvasEvent.RESIZE,v),u.addEventListener(e.ElementEvent.MOUNTED,l),u.addEventListener(e.ElementEvent.UNMOUNTED,f),u.addEventListener(e.ElementEvent.ATTR_MODIFIED,h),u.addEventListener(e.ElementEvent.BOUNDS_CHANGED,p);case 6:case"end":return t.stop()}}),t)})))),a.hooks.endFrame.tap(t.tag,(function(){n.$camera&&i.renderReasons.has(e.RenderReason.CAMERA_CHANGED)&&(n.$camera.style.transform=n.joinTransformMatrix(o.getOrthoMatrix()))})),a.hooks.destroy.tap(t.tag,(function(){n.$camera&&n.$camera.remove(),u.removeEventListener(e.CanvasEvent.RESIZE,v),u.removeEventListener(e.ElementEvent.MOUNTED,l),u.removeEventListener(e.ElementEvent.UNMOUNTED,f),u.removeEventListener(e.ElementEvent.ATTR_MODIFIED,h),u.removeEventListener(e.ElementEvent.BOUNDS_CHANGED,p)}))}},{key:"getId",value:function(t){return t.id||"g-html-"+t.entity}},{key:"createCamera",value:function(t){var e=this.context.config,r=e.document,n=e.width,o=e.height,i=this.context.contextService.getDomElement(),a=i.parentNode;if(a){var c="g-canvas-camera",u=a.querySelector("#"+c);if(!u){var s=(r||document).createElement("div");u=s,s.id=c,s.style.position="absolute",s.style.left="".concat(i.offsetLeft||0,"px"),s.style.top="".concat(i.offsetTop||0,"px"),s.style.transformOrigin="left top",s.style.transform=this.joinTransformMatrix(t.getOrthoMatrix()),s.style.overflow="hidden",s.style.pointerEvents="none",s.style.width="".concat(n||0,"px"),s.style.height="".concat(o||0,"px"),a.appendChild(s)}return u}return null}},{key:"getOrCreateEl",value:function(t){var e=this.context.config.document,r=this.getId(t),n=this.$camera.querySelector("#"+r);return n||(n=(e||document).createElement("div"),t.parsedStyle.$el=n,n.id=r,t.name&&n.setAttribute("name",t.name),t.className&&(n.className=t.className),n.style.position="absolute",n.style.left="0px",n.style.top="0px",n.style["will-change"]="transform",n.style.transform=this.joinTransformMatrix(t.getWorldTransform())),n}},{key:"updateAttribute",value:function(t,r){var n=this.getOrCreateEl(r);switch(t){case"innerHTML":var o=r.parsedStyle.innerHTML;j(o)?n.innerHTML=o:(n.innerHTML="",n.appendChild(o));break;case"transformOrigin":var i=r.parsedStyle.transformOrigin;n.style["transform-origin"]="".concat(i[0].value," ").concat(i[1].value);break;case"width":var a=r.computedStyleMap().get("width");n.style.width=""+a;break;case"height":var c=r.computedStyleMap().get("height");n.style.height=""+c;break;case"zIndex":n.style["z-index"]="".concat(r.parsedStyle.zIndex);break;case"visibility":n.style.visibility=r.parsedStyle.visibility;break;case"pointerEvents":n.style.pointerEvents=r.parsedStyle.pointerEvents;break;case"opacity":n.style.opacity="".concat(r.parsedStyle.opacity);break;case"fill":var u=r.parsedStyle.fill,s="";u instanceof e.CSSRGB?s=u.isNone?"transparent":r.getAttribute("fill"):Array.isArray(u)?s=r.getAttribute("fill"):e.isPattern(u),n.style.background=s;break;case"stroke":var l=r.parsedStyle.stroke,f="";l instanceof e.CSSRGB?f=l.isNone?"transparent":r.getAttribute("stroke"):Array.isArray(l)?f=r.getAttribute("stroke"):e.isPattern(l),n.style["border-color"]=f,n.style["border-style"]="solid";break;case"lineWidth":n.style["border-width"]="".concat(r.parsedStyle.lineWidth||0,"px");break;case"lineDash":n.style["border-style"]="dashed";break;case"filter":n.style.filter=r.style.filter}}}]),t}();rr.tag="HTMLRendering";var nr=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Ke(t,e)}(r,t);var e=er(r);function r(){var t;Qe(this,r);for(var n=arguments.length,o=Array(n),i=0;n>i;i++)o[i]=arguments[i];return(t=e.call.apply(e,[this].concat(o))).name="html-renderer",t}return Ze(r,[{key:"init",value:function(){this.addRenderingPlugin(new rr)}},{key:"destroy",value:function(){this.removeAllRenderingPlugins()}}]),r}(e.AbstractRendererPlugin),or=Object.freeze({__proto__:null,Plugin:nr});function ir(){ir=function(){return t};var t={},e=Object.prototype,r=e.hasOwnProperty,o=Object.defineProperty||function(t,e,r){t[e]=r.value},i="function"==typeof Symbol?Symbol:{},a=i.iterator||"@@iterator",c=i.asyncIterator||"@@asyncIterator",u=i.toStringTag||"@@toStringTag";function s(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{s({},"")}catch(t){s=function(t,e,r){return t[e]=r}}function l(t,e,r,n){var i=Object.create((e&&e.prototype instanceof p?e:p).prototype),a=new S(n||[]);return o(i,"_invoke",{value:E(t,r,a)}),i}function f(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}t.wrap=l;var h={};function p(){}function v(){}function d(){}var y={};s(y,a,(function(){return this}));var g=Object.getPrototypeOf,m=g&&g(g(k([])));m&&m!==e&&r.call(m,a)&&(y=m);var b=d.prototype=p.prototype=Object.create(y);function w(t){["next","throw","return"].forEach((function(e){s(t,e,(function(t){return this._invoke(e,t)}))}))}function x(t,e){function i(o,a,c,u){var s=f(t[o],t,a);if("throw"!==s.type){var l=s.arg,h=l.value;return h&&"object"==n(h)&&r.call(h,"__await")?e.resolve(h.__await).then((function(t){i("next",t,c,u)}),(function(t){i("throw",t,c,u)})):e.resolve(h).then((function(t){l.value=t,c(l)}),(function(t){return i("throw",t,c,u)}))}u(s.arg)}var a;o(this,"_invoke",{value:function(t,r){function n(){return new e((function(e,n){i(t,r,e,n)}))}return a=a?a.then(n,n):n()}})}function E(t,e,r){var n="suspendedStart";return function(o,i){if("executing"===n)throw Error("Generator is already running");if("completed"===n){if("throw"===o)throw i;return j()}for(r.method=o,r.arg=i;;){var a=r.delegate;if(a){var c=O(a,r);if(c){if(c===h)continue;return c}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if("suspendedStart"===n)throw n="completed",r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n="executing";var u=f(t,e,r);if("normal"===u.type){if(n=r.done?"completed":"suspendedYield",u.arg===h)continue;return{value:u.arg,done:r.done}}"throw"===u.type&&(n="completed",r.method="throw",r.arg=u.arg)}}}function O(t,e){var r=e.method,n=t.iterator[r];if(void 0===n)return e.delegate=null,"throw"===r&&t.iterator.return&&(e.method="return",e.arg=void 0,O(t,e),"throw"===e.method)||"return"!==r&&(e.method="throw",e.arg=new TypeError("The iterator does not provide a '"+r+"' method")),h;var o=f(n,t.iterator,e.arg);if("throw"===o.type)return e.method="throw",e.arg=o.arg,e.delegate=null,h;var i=o.arg;return i?i.done?(e[t.resultName]=i.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=void 0),e.delegate=null,h):i:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,h)}function P(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function L(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function S(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(P,this),this.reset(!0)}function k(t){if(t){var e=t[a];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var n=-1,o=function e(){for(;++n<t.length;)if(r.call(t,n))return e.value=t[n],e.done=!1,e;return e.value=void 0,e.done=!0,e};return o.next=o}}return{next:j}}function j(){return{value:void 0,done:!0}}return v.prototype=d,o(b,"constructor",{value:d,configurable:!0}),o(d,"constructor",{value:v,configurable:!0}),v.displayName=s(d,u,"GeneratorFunction"),t.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===v||"GeneratorFunction"===(e.displayName||e.name))},t.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,d):(t.__proto__=d,s(t,u,"GeneratorFunction")),t.prototype=Object.create(b),t},t.awrap=function(t){return{__await:t}},w(x.prototype),s(x.prototype,c,(function(){return this})),t.AsyncIterator=x,t.async=function(e,r,n,o,i){void 0===i&&(i=Promise);var a=new x(l(e,r,n,o),i);return t.isGeneratorFunction(r)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},w(b),s(b,u,"Generator"),s(b,a,(function(){return this})),s(b,"toString",(function(){return"[object Generator]"})),t.keys=function(t){var e=Object(t),r=[];for(var n in e)r.push(n);return r.reverse(),function t(){for(;r.length;){var n=r.pop();if(n in e)return t.value=n,t.done=!1,t}return t.done=!0,t}},t.values=k,S.prototype={constructor:S,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(L),!t)for(var e in this)"t"===e.charAt(0)&&r.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=void 0)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var e=this;function n(r,n){return a.type="throw",a.arg=t,e.next=r,n&&(e.method="next",e.arg=void 0),!!n}for(var o=this.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],a=i.completion;if("root"===i.tryLoc)return n("end");if(this.prev>=i.tryLoc){var c=r.call(i,"catchLoc"),u=r.call(i,"finallyLoc");if(c&&u){if(i.catchLoc>this.prev)return n(i.catchLoc,!0);if(i.finallyLoc>this.prev)return n(i.finallyLoc)}else if(c){if(i.catchLoc>this.prev)return n(i.catchLoc,!0)}else{if(!u)throw Error("try statement without catch or finally");if(i.finallyLoc>this.prev)return n(i.finallyLoc)}}}},abrupt:function(t,e){for(var n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n];if(this.prev>=o.tryLoc&&r.call(o,"finallyLoc")&&o.finallyLoc>this.prev){var i=o;break}}i&&("break"===t||"continue"===t)&&e>=i.tryLoc&&i.finallyLoc>=e&&(i=null);var a=i?i.completion:{};return a.type=t,a.arg=e,i?(this.method="next",this.next=i.finallyLoc,h):this.complete(a)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),h},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),L(r),h}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;L(r)}return o}}throw Error("illegal catch attempt")},delegateYield:function(t,e,r){return this.delegate={iterator:k(t),resultName:e,nextLoc:r},"next"===this.method&&(this.arg=void 0),h}},t}function ar(t,e,r,n,o,i,a){try{var c=t[i](a),u=c.value}catch(t){return void r(t)}c.done?e(u):Promise.resolve(u).then(n,o)}function cr(t){return function(){var e=this,r=arguments;return new Promise((function(n,o){var i=t.apply(e,r);function a(t){ar(i,n,o,a,c,"next",t)}function c(t){ar(i,n,o,a,c,"throw",t)}a(void 0)}))}}function ur(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function sr(t,e){for(var r=0;e.length>r;r++){var o=e[r];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(t,(i=void 0,i=function(t,e){if("object"!==n(t)||null===t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var o=r.call(t,e||"default");if("object"!==n(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(o.key,"string"),"symbol"===n(i)?i:i+""),o)}var i}function lr(t,e,r){return e&&sr(t.prototype,e),r&&sr(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function fr(t){return fr=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},fr(t)}function hr(t,e){return hr=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},hr(t,e)}function pr(t,e){if(e&&("object"===n(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}function vr(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var r,n=fr(t);if(e){var o=fr(this).constructor;r=Reflect.construct(n,arguments,o)}else r=n.apply(this,arguments);return pr(this,r)}}var dr="undefined"!=typeof Float32Array?Float32Array:Array;Math.hypot||(Math.hypot=function(){for(var t=0,e=arguments.length;e--;)t+=arguments[e]*arguments[e];return Math.sqrt(t)});var yr=function(){function t(e){ur(this,t),this.canvasConfig=void 0,this.imageCache={},this.gradientCache={},this.patternCache={},this.canvasConfig=e}return lr(t,[{key:"getImageSync",value:function(t,e){return this.imageCache[t]?e&&e():this.getOrCreateImage(t).then((function(){e&&e()})),this.imageCache[t]}},{key:"getOrCreateImage",value:function(t){var r=this;if(this.imageCache[t])return Promise.resolve(this.imageCache[t]);var n=this.canvasConfig.createImage;return new Promise((function(o,i){var a;n?a=n(t):e.isBrowser&&(a=new window.Image),a&&(a.onload=function(){o(a)},a.onerror=function(t){i(t)},a.crossOrigin="Anonymous",a.src=t,r.imageCache[t]=a)}))}},{key:"getOrCreatePatternSync",value:function(t,r,n,o,i){var a=this.generatePatternKey(t);if(a&&this.patternCache[a])return this.patternCache[a];var c,u=t.image,s=t.repetition,l=t.transform,f=!1;j(u)?c=this.getImageSync(u,i):n?(c=n,f=!0):c=u;var h,p,v=c&&r.createPattern(c,s);v&&(h=l?e.parsedTransformToMat4(e.parseTransform(l)):function(t){return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=1,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}((p=new dr(16),dr!=Float32Array&&(p[1]=0,p[2]=0,p[3]=0,p[4]=0,p[6]=0,p[7]=0,p[8]=0,p[9]=0,p[11]=0,p[12]=0,p[13]=0,p[14]=0),p[0]=1,p[5]=1,p[10]=1,p[15]=1,p)),f&&function(t,e,r){var n=r[0],o=r[1],i=r[2];t[0]=e[0]*n,t[1]=e[1]*n,t[2]=e[2]*n,t[3]=e[3]*n,t[4]=e[4]*o,t[5]=e[5]*o,t[6]=e[6]*o,t[7]=e[7]*o,t[8]=e[8]*i,t[9]=e[9]*i,t[10]=e[10]*i,t[11]=e[11]*i,t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]}(h,h,[1/o,1/o,1]),v.setTransform({a:h[0],b:h[1],c:h[4],d:h[5],e:h[12],f:h[13]}));return a&&v&&(this.patternCache[a]=v),v}},{key:"getOrCreateGradient",value:function(t,r){var n=this.generateGradientKey(t),o=t.type,i=t.steps,a=t.width,c=t.height,u=t.cx,s=t.cy,l=t.size;if(this.gradientCache[n])return this.gradientCache[n];var f=null;if(o===e.GradientType.LinearGradient){var h=e.computeLinearGradient(a,c,t.angle);f=r.createLinearGradient(h.x1,h.y1,h.x2,h.y2)}else if(o===e.GradientType.RadialGradient){var p=e.computeRadialGradient(a,c,u,s,l),v=p.x,d=p.y;f=r.createRadialGradient(v,d,0,v,d,p.r)}return f&&(i.forEach((function(t){var r,n=t.offset;n.unit===e.UnitType.kPercentage&&(null===(r=f)||void 0===r||r.addColorStop(n.value/100,""+t.color))})),this.gradientCache[n]=f),this.gradientCache[n]}},{key:"generateGradientKey",value:function(t){var e=t.width,r=t.height,n=t.steps,o=t.angle,i=t.cx,a=t.cy,c=t.size;return"gradient-".concat(t.type,"-").concat((null==o?void 0:""+o)||0,"-").concat((null==i?void 0:""+i)||0,"-").concat((null==a?void 0:""+a)||0,"-").concat((null==c?void 0:""+c)||0,"-").concat(e,"-").concat(r,"-").concat(n.map((function(t){var e=t.color;return"".concat(t.offset).concat(e)})).join("-"))}},{key:"generatePatternKey",value:function(t){var r=t.image,n=t.repetition;return j(r)?"pattern-".concat(r,"-").concat(n):r instanceof e.Rect?"pattern-".concat(r.entity,"-").concat(n):void 0}}]),t}(),gr=function(){function t(){ur(this,t)}return lr(t,[{key:"apply",value:function(r){var n=r.renderingService,o=r.imagePool,i=r.renderingContext.root.ownerDocument.defaultView,a=function(t){var r=t.target;if(r.nodeName===e.Shape.IMAGE){var i=r.attributes.img;j(i)&&o.getImageSync(i,(function(){r.renderable.dirty=!0,n.dirtify()}))}},c=function(t){var r=t.target,i=t.newValue;r.nodeName===e.Shape.IMAGE&&"img"===t.attrName&&j(i)&&o.getOrCreateImage(i).then((function(){r.renderable.dirty=!0,n.dirtify()}))};n.hooks.init.tapPromise(t.tag,cr(ir().mark((function t(){return ir().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:i.addEventListener(e.ElementEvent.MOUNTED,a),i.addEventListener(e.ElementEvent.ATTR_MODIFIED,c);case 2:case"end":return t.stop()}}),t)})))),n.hooks.destroy.tap(t.tag,(function(){i.removeEventListener(e.ElementEvent.MOUNTED,a),i.removeEventListener(e.ElementEvent.ATTR_MODIFIED,c)}))}}]),t}();gr.tag="LoadImage";var mr=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&hr(t,e)}(r,t);var e=vr(r);function r(){var t;ur(this,r);for(var n=arguments.length,o=Array(n),i=0;n>i;i++)o[i]=arguments[i];return(t=e.call.apply(e,[this].concat(o))).name="image-loader",t}return lr(r,[{key:"init",value:function(){this.context.imagePool=new yr(this.context.config),this.addRenderingPlugin(new gr)}},{key:"destroy",value:function(){this.removeAllRenderingPlugins()}}]),r}(e.AbstractRendererPlugin),br=Object.freeze({__proto__:null,ImagePool:yr,Plugin:mr}),wr=function(){function t(e){a(this,t),this.$container=void 0,this.$canvas=void 0,this.dpr=void 0,this.context=void 0,this.canvasConfig=void 0,this.renderingContext=void 0,this.renderingContext=e.renderingContext,this.canvasConfig=e.config}var n,o;return u(t,[{key:"init",value:(o=i(r().mark((function t(){var e,n,o,i;return r().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:n=(e=this.canvasConfig).container,(o=e.canvas)?(this.$canvas=o,n&&o.parentElement!==n&&n.appendChild(o),this.$container=o.parentElement,this.canvasConfig.container=this.$container):n&&(this.$container=j(n)?document.getElementById(n):n,this.$container&&(i=document.createElement("canvas"),this.$container.appendChild(i),this.$container.style.position||(this.$container.style.position="relative"),this.$canvas=i)),this.context=this.$canvas.getContext("2d"),this.resize(this.canvasConfig.width,this.canvasConfig.height);case 4:case"end":return t.stop()}}),t,this)}))),function(){return o.apply(this,arguments)})},{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(t,r){var n=this.canvasConfig.devicePixelRatio||e.isBrowser&&window.devicePixelRatio||1;this.dpr=n=1>n?1:Math.ceil(n),this.$canvas&&(this.$canvas.width=this.dpr*t,this.$canvas.height=this.dpr*r,e.setDOMSize(this.$canvas,t,r)),this.renderingContext.renderReasons.add(e.RenderReason.CAMERA_CHANGED)}},{key:"applyCursorStyle",value:function(t){this.$container&&this.$container.style&&(this.$container.style.cursor=t)}},{key:"toDataURL",value:(n=i(r().mark((function t(){var e,n=arguments;return r().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",this.context.canvas.toDataURL((e=n.length>0&&void 0!==n[0]?n[0]:{}).type,e.encoderOptions));case 3:case"end":return t.stop()}}),t,this)}))),function(){return n.apply(this,arguments)})}]),t}(),xr=function(t){s(r,t);var e=p(r);function r(){var t;a(this,r);for(var n=arguments.length,o=Array(n),i=0;n>i;i++)o[i]=arguments[i];return(t=e.call.apply(e,[this].concat(o))).name="canvas-context-register",t}return u(r,[{key:"init",value:function(){this.context.ContextService=wr}},{key:"destroy",value:function(){delete this.context.ContextService}}]),r}(e.AbstractRendererPlugin),Er=function(t){s(r,t);var e=p(r);function r(t){var n;return a(this,r),(n=e.call(this,t)).registerPlugin(new xr),n.registerPlugin(new mr),n.registerPlugin(new z),n.registerPlugin(new Ae),n.registerPlugin(new We),n.registerPlugin(new Jt),n.registerPlugin(new nr),n}return u(r)}(e.AbstractRenderer);t.CanvasPathGenerator=q,t.CanvasPicker=Kt,t.CanvasRenderer=_e,t.DomInteraction=Ue,t.HTMLRenderer=or,t.ImageLoader=br,t.Renderer=Er,Object.defineProperty(t,"__esModule",{value:!0})}));
1
+ !function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("@antv/g-lite")):"function"==typeof define&&define.amd?define(["exports","@antv/g-lite"],e):e(((t="undefined"!=typeof globalThis?globalThis:t||self).G=t.G||{},t.G.Canvas2D={}),t.window.G)}(this,(function(t,e){"use strict";function r(){r=function(){return t};var t={},e=Object.prototype,n=e.hasOwnProperty,o=Object.defineProperty||function(t,e,r){t[e]=r.value},i="function"==typeof Symbol?Symbol:{},a=i.iterator||"@@iterator",c=i.asyncIterator||"@@asyncIterator",s=i.toStringTag||"@@toStringTag";function u(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{u({},"")}catch(t){u=function(t,e,r){return t[e]=r}}function h(t,e,r,n){var i=Object.create((e&&e.prototype instanceof p?e:p).prototype),a=new M(n||[]);return o(i,"_invoke",{value:E(t,r,a)}),i}function l(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}t.wrap=h;var f={};function p(){}function v(){}function d(){}var y={};u(y,a,(function(){return this}));var g=Object.getPrototypeOf,m=g&&g(g(S([])));m&&m!==e&&n.call(m,a)&&(y=m);var w=d.prototype=p.prototype=Object.create(y);function x(t){["next","throw","return"].forEach((function(e){u(t,e,(function(t){return this._invoke(e,t)}))}))}function b(t,e){function r(o,i,a,c){var s=l(t[o],t,i);if("throw"!==s.type){var u=s.arg,h=u.value;return h&&"object"==typeof h&&n.call(h,"__await")?e.resolve(h.__await).then((function(t){r("next",t,a,c)}),(function(t){r("throw",t,a,c)})):e.resolve(h).then((function(t){u.value=t,a(u)}),(function(t){return r("throw",t,a,c)}))}c(s.arg)}var i;o(this,"_invoke",{value:function(t,n){function o(){return new e((function(e,o){r(t,n,e,o)}))}return i=i?i.then(o,o):o()}})}function E(t,e,r){var n="suspendedStart";return function(o,i){if("executing"===n)throw Error("Generator is already running");if("completed"===n){if("throw"===o)throw i;return k()}for(r.method=o,r.arg=i;;){var a=r.delegate;if(a){var c=L(a,r);if(c){if(c===f)continue;return c}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if("suspendedStart"===n)throw n="completed",r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n="executing";var s=l(t,e,r);if("normal"===s.type){if(n=r.done?"completed":"suspendedYield",s.arg===f)continue;return{value:s.arg,done:r.done}}"throw"===s.type&&(n="completed",r.method="throw",r.arg=s.arg)}}}function L(t,e){var r=e.method,n=t.iterator[r];if(void 0===n)return e.delegate=null,"throw"===r&&t.iterator.return&&(e.method="return",e.arg=void 0,L(t,e),"throw"===e.method)||"return"!==r&&(e.method="throw",e.arg=new TypeError("The iterator does not provide a '"+r+"' method")),f;var o=l(n,t.iterator,e.arg);if("throw"===o.type)return e.method="throw",e.arg=o.arg,e.delegate=null,f;var i=o.arg;return i?i.done?(e[t.resultName]=i.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=void 0),e.delegate=null,f):i:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,f)}function O(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function P(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function M(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(O,this),this.reset(!0)}function S(t){if(t){var e=t[a];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var r=-1,o=function e(){for(;++r<t.length;)if(n.call(t,r))return e.value=t[r],e.done=!1,e;return e.value=void 0,e.done=!0,e};return o.next=o}}return{next:k}}function k(){return{value:void 0,done:!0}}return v.prototype=d,o(w,"constructor",{value:d,configurable:!0}),o(d,"constructor",{value:v,configurable:!0}),v.displayName=u(d,s,"GeneratorFunction"),t.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===v||"GeneratorFunction"===(e.displayName||e.name))},t.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,d):(t.__proto__=d,u(t,s,"GeneratorFunction")),t.prototype=Object.create(w),t},t.awrap=function(t){return{__await:t}},x(b.prototype),u(b.prototype,c,(function(){return this})),t.AsyncIterator=b,t.async=function(e,r,n,o,i){void 0===i&&(i=Promise);var a=new b(h(e,r,n,o),i);return t.isGeneratorFunction(r)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},x(w),u(w,s,"Generator"),u(w,a,(function(){return this})),u(w,"toString",(function(){return"[object Generator]"})),t.keys=function(t){var e=Object(t),r=[];for(var n in e)r.push(n);return r.reverse(),function t(){for(;r.length;){var n=r.pop();if(n in e)return t.value=n,t.done=!1,t}return t.done=!0,t}},t.values=S,M.prototype={constructor:M,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(P),!t)for(var e in this)"t"===e.charAt(0)&&n.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=void 0)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var e=this;function r(r,n){return a.type="throw",a.arg=t,e.next=r,n&&(e.method="next",e.arg=void 0),!!n}for(var o=this.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],a=i.completion;if("root"===i.tryLoc)return r("end");if(this.prev>=i.tryLoc){var c=n.call(i,"catchLoc"),s=n.call(i,"finallyLoc");if(c&&s){if(i.catchLoc>this.prev)return r(i.catchLoc,!0);if(i.finallyLoc>this.prev)return r(i.finallyLoc)}else if(c){if(i.catchLoc>this.prev)return r(i.catchLoc,!0)}else{if(!s)throw Error("try statement without catch or finally");if(i.finallyLoc>this.prev)return r(i.finallyLoc)}}}},abrupt:function(t,e){for(var r=this.tryEntries.length-1;r>=0;--r){var o=this.tryEntries[r];if(this.prev>=o.tryLoc&&n.call(o,"finallyLoc")&&o.finallyLoc>this.prev){var i=o;break}}i&&("break"===t||"continue"===t)&&e>=i.tryLoc&&i.finallyLoc>=e&&(i=null);var a=i?i.completion:{};return a.type=t,a.arg=e,i?(this.method="next",this.next=i.finallyLoc,f):this.complete(a)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),f},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),P(r),f}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;P(r)}return o}}throw Error("illegal catch attempt")},delegateYield:function(t,e,r){return this.delegate={iterator:S(t),resultName:e,nextLoc:r},"next"===this.method&&(this.arg=void 0),f}},t}function n(t,e,r,n,o,i,a){try{var c=t[i](a),s=c.value}catch(t){return void r(t)}c.done?e(s):Promise.resolve(s).then(n,o)}function o(t){return function(){var e=this,r=arguments;return new Promise((function(o,i){var a=t.apply(e,r);function c(t){n(a,o,i,c,s,"next",t)}function s(t){n(a,o,i,c,s,"throw",t)}c(void 0)}))}}function i(t,e){t.prototype=Object.create(e.prototype),t.prototype.constructor=t,a(t,e)}function a(t,e){return a=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},a(t,e)}var c="undefined"!=typeof Float32Array?Float32Array:Array;function s(){var t=new c(16);return c!=Float32Array&&(t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0),t[0]=1,t[5]=1,t[10]=1,t[15]=1,t}function u(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[8]=e[8],t[9]=e[9],t[10]=e[10],t[11]=e[11],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15],t}function h(t,e,r){var n=e[0],o=e[1],i=e[2],a=e[3],c=e[4],s=e[5],u=e[6],h=e[7],l=e[8],f=e[9],p=e[10],v=e[11],d=e[12],y=e[13],g=e[14],m=e[15],w=r[0],x=r[1],b=r[2],E=r[3];return t[0]=w*n+x*c+b*l+E*d,t[1]=w*o+x*s+b*f+E*y,t[2]=w*i+x*u+b*p+E*g,t[3]=w*a+x*h+b*v+E*m,t[4]=(w=r[4])*n+(x=r[5])*c+(b=r[6])*l+(E=r[7])*d,t[5]=w*o+x*s+b*f+E*y,t[6]=w*i+x*u+b*p+E*g,t[7]=w*a+x*h+b*v+E*m,t[8]=(w=r[8])*n+(x=r[9])*c+(b=r[10])*l+(E=r[11])*d,t[9]=w*o+x*s+b*f+E*y,t[10]=w*i+x*u+b*p+E*g,t[11]=w*a+x*h+b*v+E*m,t[12]=(w=r[12])*n+(x=r[13])*c+(b=r[14])*l+(E=r[15])*d,t[13]=w*o+x*s+b*f+E*y,t[14]=w*i+x*u+b*p+E*g,t[15]=w*a+x*h+b*v+E*m,t}function l(t,e,r){var n,o,i,a,c,s,u,h,l,f,p,v,d=r[0],y=r[1],g=r[2];return e===t?(t[12]=e[0]*d+e[4]*y+e[8]*g+e[12],t[13]=e[1]*d+e[5]*y+e[9]*g+e[13],t[14]=e[2]*d+e[6]*y+e[10]*g+e[14],t[15]=e[3]*d+e[7]*y+e[11]*g+e[15]):(o=e[1],i=e[2],a=e[3],c=e[4],s=e[5],u=e[6],h=e[7],l=e[8],f=e[9],p=e[10],v=e[11],t[0]=n=e[0],t[1]=o,t[2]=i,t[3]=a,t[4]=c,t[5]=s,t[6]=u,t[7]=h,t[8]=l,t[9]=f,t[10]=p,t[11]=v,t[12]=n*d+c*y+l*g+e[12],t[13]=o*d+s*y+f*g+e[13],t[14]=i*d+u*y+p*g+e[14],t[15]=a*d+h*y+v*g+e[15]),t}function f(){var t=new c(3);return c!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0),t}function p(t,e,r){var n=new c(3);return n[0]=t,n[1]=e,n[2]=r,n}function v(t,e,r,n){return t[0]=e,t[1]=r,t[2]=n,t}function d(t,e,r){var n=e[0],o=e[1],i=e[2],a=r[3]*n+r[7]*o+r[11]*i+r[15];return t[0]=(r[0]*n+r[4]*o+r[8]*i+r[12])/(a=a||1),t[1]=(r[1]*n+r[5]*o+r[9]*i+r[13])/a,t[2]=(r[2]*n+r[6]*o+r[10]*i+r[14])/a,t}Math.hypot||(Math.hypot=function(){for(var t=0,e=arguments.length;e--;)t+=arguments[e]*arguments[e];return Math.sqrt(t)});var y;y=f();!function(){var t,e=(t=new c(2),c!=Float32Array&&(t[0]=0,t[1]=0),t)}();function g(t,e,r){return{x:t*Math.cos(r)-e*Math.sin(r),y:t*Math.sin(r)+e*Math.cos(r)}}function m(t,e,r,n,o,i,a,c,s,u){var h,l,f,p,v,d=t,y=e,w=r,x=n,b=c,E=s,L=120*Math.PI/180,O=Math.PI/180*(+o||0),P=[];if(u)l=u[0],f=u[1],p=u[2],v=u[3];else{y=(h=g(d,y,-O)).y;var M=((d=h.x)-(b=(h=g(b,E,-O)).x))/2,S=(y-(E=h.y))/2,k=M*M/(w*w)+S*S/(x*x);k>1&&(w*=k=Math.sqrt(k),x*=k);var T=w*w,A=x*x,_=(i===a?-1:1)*Math.sqrt(Math.abs((T*A-T*S*S-A*M*M)/(T*S*S+A*M*M)));p=_*w*S/x+(d+b)/2,l=Math.asin(((y-(v=_*-x*M/w+(y+E)/2))/x*1e9>>0)/1e9),f=Math.asin(((E-v)/x*1e9>>0)/1e9),0>(l=p>d?Math.PI-l:l)&&(l=2*Math.PI+l),0>(f=p>b?Math.PI-f:f)&&(f=2*Math.PI+f),a&&l>f&&(l-=2*Math.PI),!a&&f>l&&(f-=2*Math.PI)}var j=f-l;if(Math.abs(j)>L){var C=f,N=b,R=E;P=m(b=p+w*Math.cos(f=l+L*(a&&f>l?1:-1)),E=v+x*Math.sin(f),w,x,o,0,a,N,R,[f,C,p,v])}j=f-l;var I=Math.cos(l),G=Math.sin(l),F=Math.cos(f),D=Math.sin(f),B=Math.tan(j/4),$=4/3*w*B,H=4/3*x*B,Y=[d,y],W=[d+$*G,y-H*I],U=[b+$*D,E-H*F],X=[b,E];if(W[0]=2*Y[0]-W[0],W[1]=2*Y[1]-W[1],u)return W.concat(U,X,P);for(var z=[],q=0,Q=(P=W.concat(U,X,P)).length;Q>q;q+=1)z[q]=q%2?g(P[q-1],P[q],O).y:g(P[q],P[q+1],O).x;return z}var w=function(t){return null==t},x={}.toString,b=function(t){return e="String",x.call(t)==="[object "+e+"]";var e},E=function(t,e,r){return e>t?e:t>r?r:t};function L(t,e){return L=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},L(t,e)}function O(t,e){var r=e.r;t.arc(r,r,r,0,2*Math.PI,!1)}function P(t,e){var r=e.rx,n=e.ry;if(t.ellipse)t.ellipse(r,n,r,n,0,0,2*Math.PI,!1);else{var o=r>n?r:n,i=r>n?1:r/n,a=r>n?n/r:1;t.save(),t.scale(i,a),t.arc(0,0,o,0,2*Math.PI)}}function M(t,r){var n=r.x1,o=r.y1,i=r.x2,a=r.y2,c=r.defX,s=void 0===c?0:c,u=r.defY,h=void 0===u?0:u,l=r.markerStart,f=r.markerEnd,p=r.markerStartOffset,v=r.markerEndOffset,d=0,y=0,g=0,m=0,w=0;l&&l instanceof e.DisplayObject&&p&&(d=Math.cos(w=Math.atan2(a-o,i-n))*(p||0),y=Math.sin(w)*(p||0)),f&&f instanceof e.DisplayObject&&v&&(g=Math.cos(w=Math.atan2(o-a,n-i))*(v||0),m=Math.sin(w)*(v||0)),t.moveTo(n-s+d,o-h+y),t.lineTo(i-s+g,a-h+m)}function S(t,r){var n=r.defX,o=void 0===n?0:n,i=r.defY,a=void 0===i?0:i,c=r.markerStart,s=r.markerEnd,u=r.markerStartOffset,h=r.markerEndOffset,l=r.path,f=l.absolutePath,p=l.segments,v=0,d=0,y=0,g=0,m=0;if(c&&c instanceof e.DisplayObject&&u){var w=c.parentNode.getStartTangent(),x=w[0],b=w[1];v=Math.cos(m=Math.atan2(x[1]-b[1],x[0]-b[0]))*(u||0),d=Math.sin(m)*(u||0)}if(s&&s instanceof e.DisplayObject&&h){var E=s.parentNode.getEndTangent(),L=E[0],O=E[1];y=Math.cos(m=Math.atan2(L[1]-O[1],L[0]-O[0]))*(h||0),g=Math.sin(m)*(h||0)}for(var P=0;f.length>P;P++){var M=f[P],S=f[P+1],k=0===P&&(0!==v||0!==d),T=(P===f.length-1||S&&("M"===S[0]||"Z"===S[0]))&&0!==y&&0!==g;switch(M[0]){case"M":k?(t.moveTo(M[1]-o+v,M[2]-a+d),t.lineTo(M[1]-o,M[2]-a)):t.moveTo(M[1]-o,M[2]-a);break;case"L":T?t.lineTo(M[1]-o+y,M[2]-a+g):t.lineTo(M[1]-o,M[2]-a);break;case"Q":t.quadraticCurveTo(M[1]-o,M[2]-a,M[3]-o,M[4]-a),T&&t.lineTo(M[3]-o+y,M[4]-a+g);break;case"C":t.bezierCurveTo(M[1]-o,M[2]-a,M[3]-o,M[4]-a,M[5]-o,M[6]-a),T&&t.lineTo(M[5]-o+y,M[6]-a+g);break;case"A":var A=p[P].arcParams,_=A.cx,j=A.cy,C=A.rx,N=A.ry,R=A.startAngle,I=A.endAngle,G=A.xRotation,F=A.sweepFlag;if(t.ellipse)t.ellipse(_-o,j-a,C,N,G,R,I,!!(1-F));else{var D=C>N?C:N,B=C>N?1:C/N,$=C>N?N/C:1;t.translate(_-o,j-a),t.rotate(G),t.scale(B,$),t.arc(0,0,D,R,I,!!(1-F)),t.scale(1/B,1/$),t.rotate(-G),t.translate(-(_-o),-(j-a))}T&&t.lineTo(M[6]-o+y,M[7]-a+g);break;case"Z":t.closePath()}}}function k(t,r){var n=r.defX,o=void 0===n?0:n,i=r.defY,a=void 0===i?0:i,c=r.markerStart,s=r.markerEnd,u=r.markerStartOffset,h=r.markerEndOffset,l=r.points.points,f=l.length,p=l[0][0]-o,v=l[0][1]-a,d=l[f-1][0]-o,y=l[f-1][1]-a,g=0,m=0,w=0,x=0,b=0;c&&c instanceof e.DisplayObject&&u&&(g=Math.cos(b=Math.atan2(l[1][1]-l[0][1],l[1][0]-l[0][0]))*(u||0),m=Math.sin(b)*(u||0)),s&&s instanceof e.DisplayObject&&h&&(w=Math.cos(b=Math.atan2(l[f-1][1]-l[0][1],l[f-1][0]-l[0][0]))*(h||0),x=Math.sin(b)*(h||0)),t.moveTo(p+(g||w),v+(m||x));for(var E=1;f-1>E;E++){var L=l[E];t.lineTo(L[0]-o,L[1]-a)}t.lineTo(d,y)}function T(t,r){var n=r.defX,o=void 0===n?0:n,i=r.defY,a=void 0===i?0:i,c=r.markerStart,s=r.markerEnd,u=r.markerStartOffset,h=r.markerEndOffset,l=r.points.points,f=l.length,p=l[0][0]-o,v=l[0][1]-a,d=l[f-1][0]-o,y=l[f-1][1]-a,g=0,m=0,w=0,x=0,b=0;c&&c instanceof e.DisplayObject&&u&&(g=Math.cos(b=Math.atan2(l[1][1]-l[0][1],l[1][0]-l[0][0]))*(u||0),m=Math.sin(b)*(u||0)),s&&s instanceof e.DisplayObject&&h&&(w=Math.cos(b=Math.atan2(l[f-2][1]-l[f-1][1],l[f-2][0]-l[f-1][0]))*(h||0),x=Math.sin(b)*(h||0)),t.moveTo(p+g,v+m);for(var E=1;f-1>E;E++){var L=l[E];t.lineTo(L[0]-o,L[1]-a)}t.lineTo(d+w,y+x)}function A(t,e){var r=e.radius,n=e.width,o=e.height,i=n,a=o;if(r&&r.some((function(t){return 0!==t}))){var c=n>0?1:-1,s=o>0?1:-1,u=c+s===0,h=r.map((function(t){return E(t,0,Math.min(Math.abs(i)/2,Math.abs(a)/2))})),l=h[0],f=h[1],p=h[2],v=h[3];t.moveTo(c*l,0),t.lineTo(i-c*f,0),0!==f&&t.arc(i-c*f,s*f,f,-s*Math.PI/2,c>0?0:Math.PI,u),t.lineTo(i,a-s*p),0!==p&&t.arc(i-c*p,a-s*p,p,c>0?0:Math.PI,s>0?Math.PI/2:1.5*Math.PI,u),t.lineTo(c*v,a),0!==v&&t.arc(c*v,a-s*v,v,s>0?Math.PI/2:-Math.PI/2,c>0?Math.PI:0,u),t.lineTo(0,s*l),0!==l&&t.arc(c*l,s*l,l,c>0?Math.PI:0,s>0?1.5*Math.PI:Math.PI/2,u)}else t.rect(0,0,i,a)}var _=function(t){var r,n;function o(){for(var e,r=arguments.length,n=Array(r),o=0;r>o;o++)n[o]=arguments[o];return(e=t.call.apply(t,[this].concat(n))||this).name="canvas-path-generator",e}(r=o).prototype=Object.create((n=t).prototype),r.prototype.constructor=r,L(r,n);var i=o.prototype;return i.init=function(){var t,r=((t={})[e.Shape.CIRCLE]=O,t[e.Shape.ELLIPSE]=P,t[e.Shape.RECT]=A,t[e.Shape.LINE]=M,t[e.Shape.POLYLINE]=T,t[e.Shape.POLYGON]=k,t[e.Shape.PATH]=S,t[e.Shape.TEXT]=void 0,t[e.Shape.GROUP]=void 0,t[e.Shape.IMAGE]=void 0,t[e.Shape.HTML]=void 0,t[e.Shape.MESH]=void 0,t);this.context.pathGeneratorFactory=r},i.destroy=function(){delete this.context.pathGeneratorFactory},o}(e.AbstractRendererPlugin),j=Object.freeze({__proto__:null,Plugin:_});function C(){C=function(){return t};var t={},e=Object.prototype,r=e.hasOwnProperty,n=Object.defineProperty||function(t,e,r){t[e]=r.value},o="function"==typeof Symbol?Symbol:{},i=o.iterator||"@@iterator",a=o.asyncIterator||"@@asyncIterator",c=o.toStringTag||"@@toStringTag";function s(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{s({},"")}catch(t){s=function(t,e,r){return t[e]=r}}function u(t,e,r,o){var i=Object.create((e&&e.prototype instanceof f?e:f).prototype),a=new P(o||[]);return n(i,"_invoke",{value:b(t,r,a)}),i}function h(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}t.wrap=u;var l={};function f(){}function p(){}function v(){}var d={};s(d,i,(function(){return this}));var y=Object.getPrototypeOf,g=y&&y(y(M([])));g&&g!==e&&r.call(g,i)&&(d=g);var m=v.prototype=f.prototype=Object.create(d);function w(t){["next","throw","return"].forEach((function(e){s(t,e,(function(t){return this._invoke(e,t)}))}))}function x(t,e){function o(n,i,a,c){var s=h(t[n],t,i);if("throw"!==s.type){var u=s.arg,l=u.value;return l&&"object"==typeof l&&r.call(l,"__await")?e.resolve(l.__await).then((function(t){o("next",t,a,c)}),(function(t){o("throw",t,a,c)})):e.resolve(l).then((function(t){u.value=t,a(u)}),(function(t){return o("throw",t,a,c)}))}c(s.arg)}var i;n(this,"_invoke",{value:function(t,r){function n(){return new e((function(e,n){o(t,r,e,n)}))}return i=i?i.then(n,n):n()}})}function b(t,e,r){var n="suspendedStart";return function(o,i){if("executing"===n)throw Error("Generator is already running");if("completed"===n){if("throw"===o)throw i;return S()}for(r.method=o,r.arg=i;;){var a=r.delegate;if(a){var c=E(a,r);if(c){if(c===l)continue;return c}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if("suspendedStart"===n)throw n="completed",r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n="executing";var s=h(t,e,r);if("normal"===s.type){if(n=r.done?"completed":"suspendedYield",s.arg===l)continue;return{value:s.arg,done:r.done}}"throw"===s.type&&(n="completed",r.method="throw",r.arg=s.arg)}}}function E(t,e){var r=e.method,n=t.iterator[r];if(void 0===n)return e.delegate=null,"throw"===r&&t.iterator.return&&(e.method="return",e.arg=void 0,E(t,e),"throw"===e.method)||"return"!==r&&(e.method="throw",e.arg=new TypeError("The iterator does not provide a '"+r+"' method")),l;var o=h(n,t.iterator,e.arg);if("throw"===o.type)return e.method="throw",e.arg=o.arg,e.delegate=null,l;var i=o.arg;return i?i.done?(e[t.resultName]=i.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=void 0),e.delegate=null,l):i:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,l)}function L(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function O(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function P(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(L,this),this.reset(!0)}function M(t){if(t){var e=t[i];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var n=-1,o=function e(){for(;++n<t.length;)if(r.call(t,n))return e.value=t[n],e.done=!1,e;return e.value=void 0,e.done=!0,e};return o.next=o}}return{next:S}}function S(){return{value:void 0,done:!0}}return p.prototype=v,n(m,"constructor",{value:v,configurable:!0}),n(v,"constructor",{value:p,configurable:!0}),p.displayName=s(v,c,"GeneratorFunction"),t.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===p||"GeneratorFunction"===(e.displayName||e.name))},t.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,v):(t.__proto__=v,s(t,c,"GeneratorFunction")),t.prototype=Object.create(m),t},t.awrap=function(t){return{__await:t}},w(x.prototype),s(x.prototype,a,(function(){return this})),t.AsyncIterator=x,t.async=function(e,r,n,o,i){void 0===i&&(i=Promise);var a=new x(u(e,r,n,o),i);return t.isGeneratorFunction(r)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},w(m),s(m,c,"Generator"),s(m,i,(function(){return this})),s(m,"toString",(function(){return"[object Generator]"})),t.keys=function(t){var e=Object(t),r=[];for(var n in e)r.push(n);return r.reverse(),function t(){for(;r.length;){var n=r.pop();if(n in e)return t.value=n,t.done=!1,t}return t.done=!0,t}},t.values=M,P.prototype={constructor:P,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(O),!t)for(var e in this)"t"===e.charAt(0)&&r.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=void 0)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var e=this;function n(r,n){return a.type="throw",a.arg=t,e.next=r,n&&(e.method="next",e.arg=void 0),!!n}for(var o=this.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],a=i.completion;if("root"===i.tryLoc)return n("end");if(this.prev>=i.tryLoc){var c=r.call(i,"catchLoc"),s=r.call(i,"finallyLoc");if(c&&s){if(i.catchLoc>this.prev)return n(i.catchLoc,!0);if(i.finallyLoc>this.prev)return n(i.finallyLoc)}else if(c){if(i.catchLoc>this.prev)return n(i.catchLoc,!0)}else{if(!s)throw Error("try statement without catch or finally");if(i.finallyLoc>this.prev)return n(i.finallyLoc)}}}},abrupt:function(t,e){for(var n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n];if(this.prev>=o.tryLoc&&r.call(o,"finallyLoc")&&o.finallyLoc>this.prev){var i=o;break}}i&&("break"===t||"continue"===t)&&e>=i.tryLoc&&i.finallyLoc>=e&&(i=null);var a=i?i.completion:{};return a.type=t,a.arg=e,i?(this.method="next",this.next=i.finallyLoc,l):this.complete(a)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),l},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),O(r),l}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;O(r)}return o}}throw Error("illegal catch attempt")},delegateYield:function(t,e,r){return this.delegate={iterator:M(t),resultName:e,nextLoc:r},"next"===this.method&&(this.arg=void 0),l}},t}function N(t,e,r,n,o,i,a){try{var c=t[i](a),s=c.value}catch(t){return void r(t)}c.done?e(s):Promise.resolve(s).then(n,o)}function R(t,e){return R=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},R(t,e)}function I(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=Array(e);e>r;r++)n[r]=t[r];return n}function G(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(r)return(r=r.call(t)).next.bind(r);if(Array.isArray(t)||(r=function(t,e){if(t){if("string"==typeof t)return I(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?I(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var n=0;return function(){return t.length>n?{done:!1,value:t[n++]}:{done:!0}}}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 F=f(),D=f(),B=f(),$=s(),H=function(){function t(){var t=this;this.canvasConfig=void 0,this.pathGeneratorFactory=void 0,this.pointInPathPickerFactory=void 0,this.isHit=function(r,n,o,i){var a,c,s,u,h,l,f,p,y,g,m,w,x,b,E,L,O,P,M,S,k,T,A,_,j,C,N,R,I,G,F,H=t.pointInPathPickerFactory[r.nodeName];if(H){var Y=(a=$,(F=(M=(s=(c=o)[0])*(p=c[5])-(u=c[1])*(f=c[4]))*(G=(x=c[10])*(P=c[15])-(b=c[11])*(O=c[14]))-(S=s*(y=c[6])-(h=c[2])*f)*(I=(w=c[9])*P-b*(L=c[13]))+(k=s*(g=c[7])-(l=c[3])*f)*(R=w*O-x*L)+(T=u*y-h*p)*(N=(m=c[8])*P-b*(E=c[12]))-(A=u*g-l*p)*(C=m*O-x*E)+(_=h*g-l*y)*(j=m*L-w*E))?(a[0]=(p*G-y*I+g*R)*(F=1/F),a[1]=(h*I-u*G-l*R)*F,a[2]=(L*_-O*A+P*T)*F,a[3]=(x*A-w*_-b*T)*F,a[4]=(y*N-f*G-g*C)*F,a[5]=(s*G-h*N+l*C)*F,a[6]=(O*k-E*_-P*S)*F,a[7]=(m*_-x*k+b*S)*F,a[8]=(f*I-p*N+g*j)*F,a[9]=(u*N-s*I-l*j)*F,a[10]=(E*A-L*k+P*M)*F,a[11]=(w*k-m*A-b*M)*F,a[12]=(p*C-f*R-y*j)*F,a[13]=(s*R-u*C+h*j)*F,a[14]=(L*S-E*T-O*M)*F,a[15]=(m*T-w*S+x*M)*F,a):null),W=d(D,v(B,n[0],n[1],0),Y),U=r.getGeometryBounds().halfExtents,X=r.parsedStyle.anchor;if(W[0]+=(X&&X[0]||0)*U[0]*2,W[1]+=(X&&X[1]||0)*U[1]*2,H(r,new e.Point(W[0],W[1]),i,t.isPointInPath))return!0}return!1},this.isPointInPath=function(r,n){var o=e.runtime.offscreenCanvas.getOrCreateContext(t.canvasConfig.offscreenCanvas),i=t.pathGeneratorFactory[r.nodeName];return i&&(o.beginPath(),i(o,r.parsedStyle),o.closePath()),o.isPointInPath(n.x,n.y)}}var r=t.prototype;return r.apply=function(e){var r,n=this,o=e.renderingService,i=e.renderingContext,a=e.pathGeneratorFactory,c=e.pointInPathPickerFactory;this.canvasConfig=e.config,this.pathGeneratorFactory=a,this.pointInPathPickerFactory=c;var s=null===(r=i.root)||void 0===r?void 0:r.ownerDocument;o.hooks.pick.tapPromise(t.tag,function(){var t,e=(t=C().mark((function t(e){return C().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",n.pick(s,e));case 1:case"end":return t.stop()}}),t)})),function(){var e=this,r=arguments;return new Promise((function(n,o){var i=t.apply(e,r);function a(t){N(i,n,o,a,c,"next",t)}function c(t){N(i,n,o,a,c,"throw",t)}a(void 0)}))});return function(t){return e.apply(this,arguments)}}()),o.hooks.pickSync.tap(t.tag,(function(t){return n.pick(s,t)}))},r.pick=function(t,r){for(var n,o=r.topmost,i=r.position,a=v(F,i.x,i.y,0),c=[],s=G(t.elementsFromBBox(a[0],a[1],a[0],a[1]));!(n=s()).done;){var u=n.value,h=u.getWorldTransform();if(this.isHit(u,a,h,!1)){var l=e.findClosestClipPathTarget(u);if(l){var f=l.parsedStyle.clipPath;if(this.isHit(f,a,f.getWorldTransform(),!0)){if(o)return r.picked=[u],r;c.push(u)}}else{if(o)return r.picked=[u],r;c.push(u)}}}return r.picked=c,r},t}();function Y(t,e,r,n){var o=t-r,i=e-n;return Math.sqrt(o*o+i*i)}function W(t,e){return.001>Math.abs(t-e)}function U(t,e){var r=Math.min.apply(Math,t),n=Math.min.apply(Math,e);return{x:r,y:n,width:Math.max.apply(Math,t)-r,height:Math.max.apply(Math,e)-n}}function X(t){return(t+2*Math.PI)%(2*Math.PI)}H.tag="CanvasPicker";var z=function(t,e,r,n,o){return{x:(1-o)*t+o*r,y:(1-o)*e+o*n}},q=function(t,e,r,n,o,i){var a=[r-t,n-e];if(function(t,e){return t[0]===e[0]&&t[1]===e[1]}(a,[0,0]))return Math.sqrt((o-t)*(o-t)+(i-e)*(i-e));var c=[-a[1],a[0]];return function(t,e){var r=e[0],n=e[1],o=r*r+n*n;o>0&&(o=1/Math.sqrt(o)),t[0]=e[0]*o,t[1]=e[1]*o}(c,c),Math.abs(function(t,e){return t[0]*e[0]+t[1]*e[1]}([o-t,i-e],c))};function Q(t,e,r,n,o,i){var a=-1,c=1/0,s=[r,n],u=20;i&&i>200&&(u=i/10);for(var h=1/u,l=h/10,f=0;u>=f;f++){var p=f*h,v=[o.apply(void 0,t.concat([p])),o.apply(void 0,e.concat([p]))],d=Y(s[0],s[1],v[0],v[1]);c>d&&(a=p,c=d)}if(0===a)return{x:t[0],y:e[0]};if(1===a){var y=t.length;return{x:t[y-1],y:e[y-1]}}c=1/0;for(var g=0;32>g&&1e-4<=l;g++){var m=a-l,w=a+l,x=[o.apply(void 0,t.concat([m])),o.apply(void 0,e.concat([m]))],b=Y(s[0],s[1],x[0],x[1]);if(m>=0&&c>b)a=m,c=b;else{var E=[o.apply(void 0,t.concat([w])),o.apply(void 0,e.concat([w]))],L=Y(s[0],s[1],E[0],E[1]);1>=w&&c>L?(a=w,c=L):l*=.5}}return{x:o.apply(void 0,t.concat([a])),y:o.apply(void 0,e.concat([a]))}}function V(t,e,r,n){var o=1-n;return o*o*t+2*n*o*e+n*n*r}function Z(t,e,r){var n=t+r-2*e;if(W(n,0))return[.5];var o=(t-e)/n;return o>1||0>o?[]:[o]}function J(t,e,r,n){return 2*(1-n)*(e-t)+2*n*(r-e)}function K(t,e,r,n,o,i,a){var c=V(t,r,o,a),s=V(e,n,i,a),u=z(t,e,r,n,a),h=z(r,n,o,i,a);return[[t,e,u.x,u.y,c,s],[c,s,h.x,h.y,o,i]]}function tt(t,e,r,n,o,i,a){if(0===a)return(Y(t,e,r,n)+Y(r,n,o,i)+Y(t,e,o,i))/2;var c=K(t,e,r,n,o,i,.5),s=c[0],u=c[1];return s.push(a-1),u.push(a-1),tt.apply(void 0,s)+tt.apply(void 0,u)}var et={box:function(t,e,r,n,o,i){var a=Z(t,r,o)[0],c=Z(e,n,i)[0],s=[t,o],u=[e,i];return void 0!==a&&s.push(V(t,r,o,a)),void 0!==c&&u.push(V(e,n,i,c)),U(s,u)},length:function(t,e,r,n,o,i){return tt(t,e,r,n,o,i,3)},nearestPoint:function(t,e,r,n,o,i,a,c){return Q([t,r,o],[e,n,i],a,c,V)},pointDistance:function(t,e,r,n,o,i,a,c){var s=this.nearestPoint(t,e,r,n,o,i,a,c);return Y(s.x,s.y,a,c)},interpolationAt:V,pointAt:function(t,e,r,n,o,i,a){return{x:V(t,r,o,a),y:V(e,n,i,a)}},divide:function(t,e,r,n,o,i,a){return K(t,e,r,n,o,i,a)},tangentAngle:function(t,e,r,n,o,i,a){var c=J(t,r,o,a),s=J(e,n,i,a);return X(Math.atan2(s,c))}};function rt(t,e,r,n,o){var i=1-o;return i*i*i*t+3*e*o*i*i+3*r*o*o*i+n*o*o*o}function nt(t,e,r,n,o){var i=1-o;return 3*(i*i*(e-t)+2*i*o*(r-e)+o*o*(n-r))}function ot(t,e,r,n){var o,i,a,c=-3*t+9*e-9*r+3*n,s=6*t-12*e+6*r,u=3*e-3*t,h=[];if(W(c,0))W(s,0)||0>(o=-u/s)||o>1||h.push(o);else{var l=s*s-4*c*u;W(l,0)?h.push(-s/(2*c)):l>0&&(i=(-s-(a=Math.sqrt(l)))/(2*c),0>(o=(-s+a)/(2*c))||o>1||h.push(o),0>i||i>1||h.push(i))}return h}function it(t,e,r,n,o,i,a,c,s){var u=rt(t,r,o,a,s),h=rt(e,n,i,c,s),l=z(t,e,r,n,s),f=z(r,n,o,i,s),p=z(o,i,a,c,s),v=z(l.x,l.y,f.x,f.y,s),d=z(f.x,f.y,p.x,p.y,s);return[[t,e,l.x,l.y,v.x,v.y,u,h],[u,h,d.x,d.y,p.x,p.y,a,c]]}function at(t,e,r,n,o,i,a,c,s){if(0===s)return function(t,e){for(var r=0,n=t.length,o=0;n>o;o++)r+=Y(t[o],e[o],t[(o+1)%n],e[(o+1)%n]);return r/2}([t,r,o,a],[e,n,i,c]);var u=it(t,e,r,n,o,i,a,c,.5),h=[].concat(u[0],[s-1]),l=[].concat(u[1],[s-1]);return at.apply(void 0,h)+at.apply(void 0,l)}var ct={extrema:ot,box:function(t,e,r,n,o,i,a,c){for(var s=[t,a],u=[e,c],h=ot(t,r,o,a),l=ot(e,n,i,c),f=0;h.length>f;f++)s.push(rt(t,r,o,a,h[f]));for(var p=0;l.length>p;p++)u.push(rt(e,n,i,c,l[p]));return U(s,u)},length:function(t,e,r,n,o,i,a,c){return at(t,e,r,n,o,i,a,c,3)},nearestPoint:function(t,e,r,n,o,i,a,c,s,u,h){return Q([t,r,o,a],[e,n,i,c],s,u,rt,h)},pointDistance:function(t,e,r,n,o,i,a,c,s,u,h){var l=this.nearestPoint(t,e,r,n,o,i,a,c,s,u,h);return Y(l.x,l.y,s,u)},interpolationAt:rt,pointAt:function(t,e,r,n,o,i,a,c,s){return{x:rt(t,r,o,a,s),y:rt(e,n,i,c,s)}},divide:function(t,e,r,n,o,i,a,c,s){return it(t,e,r,n,o,i,a,c,s)},tangentAngle:function(t,e,r,n,o,i,a,c,s){var u=nt(t,r,o,a,s),h=nt(e,n,i,c,s);return X(Math.atan2(h,u))}};function st(t,e,r,n){var o=t-r,i=e-n;return Math.sqrt(o*o+i*i)}function ut(t,e,r,n,o,i){return!(t>o||o>t+r||e>i||i>e+n)}function ht(t,e,r,n,o,i,a,c){var s=(Math.atan2(c-e,a-t)+2*Math.PI)%(2*Math.PI),u={x:t+r*Math.cos(s),y:e+r*Math.sin(s)};return st(u.x,u.y,a,c)<=i/2}function lt(t,e,r,n,o,i,a){var c=o/2;return!(Math.min(t,r)-c>i||i>Math.max(t,r)+c||Math.min(e,n)-c>a||a>Math.max(e,n)+c)&&q(t,e,r,n,i,a)<=o/2}function ft(t,e,r,n,o){var i=t.length;if(2>i)return!1;for(var a=0;i-1>a;a++){if(lt(t[a][0],t[a][1],t[a+1][0],t[a+1][1],e,r,n))return!0}if(o){var c=t[0],s=t[i-1];if(lt(c[0],c[1],s[0],s[1],e,r,n))return!0}return!1}function pt(t){return 1e-6>Math.abs(t)?0:0>t?-1:1}function vt(t,e,r){return!((r[0]-t[0])*(e[1]-t[1])!=(e[0]-t[0])*(r[1]-t[1])||Math.min(t[0],e[0])>r[0]||r[0]>Math.max(t[0],e[0])||Math.min(t[1],e[1])>r[1]||r[1]>Math.max(t[1],e[1]))}function dt(t,e,r){var n=!1,o=t.length;if(2>=o)return!1;for(var i=0;o>i;i++){var a=t[i],c=t[(i+1)%o];if(vt(a,c,[e,r]))return!0;pt(a[1]-r)>0!=pt(c[1]-r)>0&&0>pt(e-(r-a[1])*(a[0]-c[0])/(a[1]-c[1])-a[0])&&(n=!n)}return n}function yt(t,e,r){for(var n=!1,o=0;t.length>o;o++){if(n=dt(t[o],e,r))break}return n}function gt(t,r,n){var o=t.parsedStyle,i=o.r,a=o.fill,c=o.stroke,s=o.pointerEvents,u=((o.lineWidth||0)+(o.increasedLineWidthForHitTesting||0))/2,h=st(i,i,r.x,r.y),l=e.isFillOrStrokeAffected(s,a,c),f=l[0],p=l[1];return f&&p||n?i+u>=h:f?i>=h:!!p&&(h>=i-u&&i+u>=h)}function mt(t,e,r,n){return t/(r*r)+e/(n*n)}function wt(t,r,n){var o=t.parsedStyle,i=o.rx,a=o.ry,c=o.lineWidth,s=o.increasedLineWidthForHitTesting,u=r.x,h=r.y,l=e.isFillOrStrokeAffected(o.pointerEvents,o.fill,o.stroke),f=l[0],p=l[1],v=((c||0)+(s||0))/2,d=(u-i)*(u-i),y=(h-a)*(h-a);return f&&p||n?1>=mt(d,y,i+v,a+v):f?1>=mt(d,y,i,a):!!p&&(mt(d,y,i-v,a-v)>=1&&1>=mt(d,y,i+v,a+v))}function xt(t,r,n){var o=t.parsedStyle,i=o.x1,a=o.y1,c=o.x2,s=o.y2,u=o.lineWidth,h=o.increasedLineWidthForHitTesting,l=o.defX,f=void 0===l?0:l,p=o.defY,v=void 0===p?0:p,d=e.isFillOrStrokeAffected(o.pointerEvents,o.fill,o.stroke);return!(!d[1]&&!n||!u)&&lt(i,a,c,s,(u||0)+(h||0),r.x+f,r.y+v)}function bt(t,r,n,o){var i=t.parsedStyle,a=i.lineWidth,c=i.increasedLineWidthForHitTesting,s=i.defX,u=void 0===s?0:s,h=i.defY,l=void 0===h?0:h,f=i.path,p=e.isFillOrStrokeAffected(i.pointerEvents,i.fill,i.stroke),v=p[0],d=p[1],y=f.segments,g=f.hasArc,w=f.polylines,x=f.polygons,b=e.getOrCalculatePathTotalLength(t),E=!1;return v||n?E=g?o(t,r):yt(x,r.x+u,r.y+l)||yt(w,r.x+u,r.y+l):((d||n)&&(E=function(t,e,r,n,o){for(var i=!1,a=e/2,c=0;t.length>c;c++){var s=t[c],u=s.currentPoint,h=s.params,l=s.prePoint,f=s.box;if(!f||ut(f.x-a,f.y-a,f.width+e,f.height+e,r,n))switch(s.command){case"L":case"Z":if(i=lt(l[0],l[1],u[0],u[1],e,r,n))return!0;break;case"Q":if(i=e/2>=et.pointDistance(l[0],l[1],h[1],h[2],h[3],h[4],r,n))return!0;break;case"C":if(i=e/2>=ct.pointDistance(l[0],l[1],h[1],h[2],h[3],h[4],h[5],h[6],r,n,o))return!0;break;case"A":s.cubicParams||(s.cubicParams=m(l[0],l[1],h[1],h[2],h[3],h[4],h[5],h[6],h[7],void 0));for(var p=s.cubicParams,v=l,d=0;p.length>d;d+=6){var y=ct.pointDistance(v[0],v[1],p[d],p[d+1],p[d+2],p[d+3],p[d+4],p[d+5],r,n,o);if(v=[p[d+4],p[d+5]],i=e/2>=y)return!0}}}return i}(y,(a||0)+(c||0),r.x+u,r.y+l,b)),E)}function Et(t,r,n){var o=t.parsedStyle,i=o.lineWidth,a=o.increasedLineWidthForHitTesting,c=o.points,s=o.defX,u=void 0===s?0:s,h=o.defY,l=void 0===h?0:h,f=e.isFillOrStrokeAffected(o.pointerEvents,o.fill,o.stroke),p=f[0],v=!1;return(f[1]||n)&&(v=ft(c.points,(i||0)+(a||0),r.x+u,r.y+l,!0)),v||!p&&!n||(v=dt(c.points,r.x+u,r.y+l)),v}function Lt(t,r,n){var o=t.parsedStyle,i=o.lineWidth,a=o.increasedLineWidthForHitTesting,c=o.points,s=o.defX,u=void 0===s?0:s,h=o.defY,l=void 0===h?0:h;return!(!e.isFillOrStrokeAffected(o.pointerEvents,o.fill,o.stroke)[1]&&!n||!i)&&ft(c.points,(i||0)+(a||0),r.x+u,r.y+l,!1)}function Ot(t,r,n,o){var i=t.parsedStyle,a=i.radius,c=i.lineWidth,s=i.increasedLineWidthForHitTesting,u=i.width,h=i.height,l=e.isFillOrStrokeAffected(i.pointerEvents,i.fill,i.stroke),f=l[0],p=l[1],v=(c||0)+(s||0);if(a&&a.some((function(t){return 0!==t}))){var d=!1;return(p||n)&&(d=function(t,e,r,n,o,i,a,c){var s=o[0],u=o[1],h=o[2],l=o[3];return lt(t+s,e,t+r-u,e,i,a,c)||lt(t+r,e+u,t+r,e+n-h,i,a,c)||lt(t+r-h,e+n,t+l,e+n,i,a,c)||lt(t,e+n-l,t,e+s,i,a,c)||ht(t+r-u,e+u,u,0,0,i,a,c)||ht(t+r-h,e+n-h,h,0,0,i,a,c)||ht(t+l,e+n-l,l,0,0,i,a,c)||ht(t+s,e+s,s,0,0,i,a,c)}(0,0,u,h,a.map((function(t){return E(t,0,Math.min(Math.abs(u)/2,Math.abs(h)/2))})),v,r.x,r.y)),d||!f&&!n||(d=o(t,r)),d}var y=v/2;return f&&p||n?ut(0-y,0-y,u+y,h+y,r.x,r.y):f?ut(0,0,u,h,r.x,r.y):!!p&&function(t,e,r,n,o,i,a){var c=o/2;return ut(t-c,e-c,r,o,i,a)||ut(t+r-c,e-c,o,n,i,a)||ut(t+c,e+n-c,r,o,i,a)||ut(t-c,e+c,o,n,i,a)}(0,0,u,h,v,r.x,r.y)}var Pt=function(t){var r,n;function o(){for(var e,r=arguments.length,n=Array(r),o=0;r>o;o++)n[o]=arguments[o];return(e=t.call.apply(t,[this].concat(n))||this).name="canvas-picker",e}(r=o).prototype=Object.create((n=t).prototype),r.prototype.constructor=r,R(r,n);var i=o.prototype;return i.init=function(){var t,r=function(){return!0},n=((t={})[e.Shape.CIRCLE]=gt,t[e.Shape.ELLIPSE]=wt,t[e.Shape.RECT]=Ot,t[e.Shape.LINE]=xt,t[e.Shape.POLYLINE]=Lt,t[e.Shape.POLYGON]=Et,t[e.Shape.PATH]=bt,t[e.Shape.TEXT]=r,t[e.Shape.GROUP]=null,t[e.Shape.IMAGE]=r,t[e.Shape.HTML]=null,t[e.Shape.MESH]=null,t);this.context.pointInPathPickerFactory=n,this.addRenderingPlugin(new H)},i.destroy=function(){delete this.context.pointInPathPickerFactory,this.removeAllRenderingPlugins()},o}(e.AbstractRendererPlugin),Mt=Object.freeze({__proto__:null,Plugin:Pt});function St(){St=function(){return t};var t={},e=Object.prototype,r=e.hasOwnProperty,n=Object.defineProperty||function(t,e,r){t[e]=r.value},o="function"==typeof Symbol?Symbol:{},i=o.iterator||"@@iterator",a=o.asyncIterator||"@@asyncIterator",c=o.toStringTag||"@@toStringTag";function s(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{s({},"")}catch(t){s=function(t,e,r){return t[e]=r}}function u(t,e,r,o){var i=Object.create((e&&e.prototype instanceof f?e:f).prototype),a=new P(o||[]);return n(i,"_invoke",{value:b(t,r,a)}),i}function h(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}t.wrap=u;var l={};function f(){}function p(){}function v(){}var d={};s(d,i,(function(){return this}));var y=Object.getPrototypeOf,g=y&&y(y(M([])));g&&g!==e&&r.call(g,i)&&(d=g);var m=v.prototype=f.prototype=Object.create(d);function w(t){["next","throw","return"].forEach((function(e){s(t,e,(function(t){return this._invoke(e,t)}))}))}function x(t,e){function o(n,i,a,c){var s=h(t[n],t,i);if("throw"!==s.type){var u=s.arg,l=u.value;return l&&"object"==typeof l&&r.call(l,"__await")?e.resolve(l.__await).then((function(t){o("next",t,a,c)}),(function(t){o("throw",t,a,c)})):e.resolve(l).then((function(t){u.value=t,a(u)}),(function(t){return o("throw",t,a,c)}))}c(s.arg)}var i;n(this,"_invoke",{value:function(t,r){function n(){return new e((function(e,n){o(t,r,e,n)}))}return i=i?i.then(n,n):n()}})}function b(t,e,r){var n="suspendedStart";return function(o,i){if("executing"===n)throw Error("Generator is already running");if("completed"===n){if("throw"===o)throw i;return S()}for(r.method=o,r.arg=i;;){var a=r.delegate;if(a){var c=E(a,r);if(c){if(c===l)continue;return c}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if("suspendedStart"===n)throw n="completed",r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n="executing";var s=h(t,e,r);if("normal"===s.type){if(n=r.done?"completed":"suspendedYield",s.arg===l)continue;return{value:s.arg,done:r.done}}"throw"===s.type&&(n="completed",r.method="throw",r.arg=s.arg)}}}function E(t,e){var r=e.method,n=t.iterator[r];if(void 0===n)return e.delegate=null,"throw"===r&&t.iterator.return&&(e.method="return",e.arg=void 0,E(t,e),"throw"===e.method)||"return"!==r&&(e.method="throw",e.arg=new TypeError("The iterator does not provide a '"+r+"' method")),l;var o=h(n,t.iterator,e.arg);if("throw"===o.type)return e.method="throw",e.arg=o.arg,e.delegate=null,l;var i=o.arg;return i?i.done?(e[t.resultName]=i.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=void 0),e.delegate=null,l):i:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,l)}function L(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function O(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function P(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(L,this),this.reset(!0)}function M(t){if(t){var e=t[i];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var n=-1,o=function e(){for(;++n<t.length;)if(r.call(t,n))return e.value=t[n],e.done=!1,e;return e.value=void 0,e.done=!0,e};return o.next=o}}return{next:S}}function S(){return{value:void 0,done:!0}}return p.prototype=v,n(m,"constructor",{value:v,configurable:!0}),n(v,"constructor",{value:p,configurable:!0}),p.displayName=s(v,c,"GeneratorFunction"),t.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===p||"GeneratorFunction"===(e.displayName||e.name))},t.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,v):(t.__proto__=v,s(t,c,"GeneratorFunction")),t.prototype=Object.create(m),t},t.awrap=function(t){return{__await:t}},w(x.prototype),s(x.prototype,a,(function(){return this})),t.AsyncIterator=x,t.async=function(e,r,n,o,i){void 0===i&&(i=Promise);var a=new x(u(e,r,n,o),i);return t.isGeneratorFunction(r)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},w(m),s(m,c,"Generator"),s(m,i,(function(){return this})),s(m,"toString",(function(){return"[object Generator]"})),t.keys=function(t){var e=Object(t),r=[];for(var n in e)r.push(n);return r.reverse(),function t(){for(;r.length;){var n=r.pop();if(n in e)return t.value=n,t.done=!1,t}return t.done=!0,t}},t.values=M,P.prototype={constructor:P,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(O),!t)for(var e in this)"t"===e.charAt(0)&&r.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=void 0)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var e=this;function n(r,n){return a.type="throw",a.arg=t,e.next=r,n&&(e.method="next",e.arg=void 0),!!n}for(var o=this.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],a=i.completion;if("root"===i.tryLoc)return n("end");if(this.prev>=i.tryLoc){var c=r.call(i,"catchLoc"),s=r.call(i,"finallyLoc");if(c&&s){if(i.catchLoc>this.prev)return n(i.catchLoc,!0);if(i.finallyLoc>this.prev)return n(i.finallyLoc)}else if(c){if(i.catchLoc>this.prev)return n(i.catchLoc,!0)}else{if(!s)throw Error("try statement without catch or finally");if(i.finallyLoc>this.prev)return n(i.finallyLoc)}}}},abrupt:function(t,e){for(var n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n];if(this.prev>=o.tryLoc&&r.call(o,"finallyLoc")&&o.finallyLoc>this.prev){var i=o;break}}i&&("break"===t||"continue"===t)&&e>=i.tryLoc&&i.finallyLoc>=e&&(i=null);var a=i?i.completion:{};return a.type=t,a.arg=e,i?(this.method="next",this.next=i.finallyLoc,l):this.complete(a)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),l},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),O(r),l}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;O(r)}return o}}throw Error("illegal catch attempt")},delegateYield:function(t,e,r){return this.delegate={iterator:M(t),resultName:e,nextLoc:r},"next"===this.method&&(this.arg=void 0),l}},t}function kt(t,e,r,n,o,i,a){try{var c=t[i](a),s=c.value}catch(t){return void r(t)}c.done?e(s):Promise.resolve(s).then(n,o)}function Tt(t){return function(){var e=this,r=arguments;return new Promise((function(n,o){var i=t.apply(e,r);function a(t){kt(i,n,o,a,c,"next",t)}function c(t){kt(i,n,o,a,c,"throw",t)}a(void 0)}))}}function At(){return At=Object.assign?Object.assign.bind():function(t){for(var e=1;arguments.length>e;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},At.apply(this,arguments)}function _t(t,e){t.prototype=Object.create(e.prototype),t.prototype.constructor=t,jt(t,e)}function jt(t,e){return jt=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},jt(t,e)}var Ct=function(){function t(t){this.canvasRendererPluginOptions=void 0,this.context=void 0,this.pathGeneratorFactory=void 0,this.rBush=void 0,this.removedRBushNodeAABBs=[],this.renderQueue=[],this.restoreStack=[],this.clearFullScreen=!1,this.vpMatrix=s(),this.dprMatrix=s(),this.tmpMat4=s(),this.vec3a=f(),this.vec3b=f(),this.vec3c=f(),this.vec3d=f(),this.canvasRendererPluginOptions=t}var r=t.prototype;return r.apply=function(r){var n=this;this.context=r;var o=r.config,i=r.camera,a=r.renderingService,c=r.renderingContext,s=r.pathGeneratorFactory;this.rBush=r.rBushRoot,this.pathGeneratorFactory=s;var u=r.contextService,l=c.root.ownerDocument.defaultView,f=function(t){var e=t.target.rBushNode;e.aabb&&n.removedRBushNodeAABBs.push(e.aabb)},v=function(t){var e=t.target.rBushNode;e.aabb&&n.removedRBushNodeAABBs.push(e.aabb)};a.hooks.init.tapPromise(t.tag,Tt(St().mark((function t(){var r,i,a,c;return St().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:l.addEventListener(e.ElementEvent.UNMOUNTED,f),l.addEventListener(e.ElementEvent.CULLED,v),r=u.getDPR(),i=o.width,a=o.height,c=u.getContext(),n.clearRect(c,0,0,i*r,a*r,o.background);case 6:case"end":return t.stop()}}),t)})))),a.hooks.destroy.tap(t.tag,(function(){l.removeEventListener(e.ElementEvent.UNMOUNTED,f),l.removeEventListener(e.ElementEvent.CULLED,v)})),a.hooks.beginFrame.tap(t.tag,(function(){var t=u.getContext(),e=u.getDPR(),r=o.width,i=o.height,c=n.canvasRendererPluginOptions,s=c.dirtyObjectNumThreshold,h=c.dirtyObjectRatioThreshold,l=a.getStats(),f=l.rendered,p=f/l.total;n.clearFullScreen=a.disableDirtyRectangleRendering()||f>s&&p>h,t&&(t.resetTransform(),n.clearFullScreen&&n.clearRect(t,0,0,r*e,i*e,o.background))}));var y=function t(e,r){e.isVisible()&&!e.isCulled()&&(n.renderDisplayObject(e,r,n.context,n.restoreStack),n.saveDirtyAABB(e)),(e.sortable.sorted||e.childNodes).forEach((function(e){t(e,r)}))};a.hooks.endFrame.tap(t.tag,(function(){var t,r,a=u.getContext(),s=u.getDPR();if(t=n.dprMatrix,r=p(s,s,1),t[0]=r[0],t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=r[1],t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=r[2],t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,h(n.vpMatrix,n.dprMatrix,i.getOrthoMatrix()),n.clearFullScreen)y(c.root,a);else{var f=n.safeMergeAABB.apply(n,[n.mergeDirtyAABBs(n.renderQueue)].concat(n.removedRBushNodeAABBs.map((function(t){var r=t.minX,n=t.minY,o=t.maxX,i=t.maxY,a=new e.AABB;return a.setMinMax(p(r,n,0),p(o,i,0)),a}))));if(n.removedRBushNodeAABBs=[],e.AABB.isEmpty(f))return void(n.renderQueue=[]);var v=n.convertAABB2Rect(f),g=v.x,m=v.y,w=v.width,x=v.height,b=d(n.vec3a,p(g,m,0),n.vpMatrix),E=d(n.vec3b,p(g+w,m,0),n.vpMatrix),L=d(n.vec3c,p(g,m+x,0),n.vpMatrix),O=d(n.vec3d,p(g+w,m+x,0),n.vpMatrix),P=Math.min(b[0],E[0],O[0],L[0]),M=Math.min(b[1],E[1],O[1],L[1]),S=Math.max(b[0],E[0],O[0],L[0]),k=Math.max(b[1],E[1],O[1],L[1]),T=Math.floor(P),A=Math.floor(M),_=Math.ceil(S-P),j=Math.ceil(k-M);a.save(),n.clearRect(a,T,A,_,j,o.background),a.beginPath(),a.rect(T,A,_,j),a.clip(),a.setTransform(n.vpMatrix[0],n.vpMatrix[1],n.vpMatrix[4],n.vpMatrix[5],n.vpMatrix[12],n.vpMatrix[13]),o.renderer.getConfig().enableDirtyRectangleRenderingDebug&&l.dispatchEvent(new e.CustomEvent(e.CanvasEvent.DIRTY_RECTANGLE,{dirtyRect:{x:T,y:A,width:_,height:j}})),n.searchDirtyObjects(f).sort((function(t,e){return t.sortable.renderOrder-e.sortable.renderOrder})).forEach((function(t){t&&t.isVisible()&&!t.isCulled()&&n.renderDisplayObject(t,a,n.context,n.restoreStack)})),a.restore(),n.renderQueue.forEach((function(t){n.saveDirtyAABB(t)})),n.renderQueue=[]}n.restoreStack.forEach((function(){a.restore()})),n.restoreStack=[]})),a.hooks.render.tap(t.tag,(function(t){n.clearFullScreen||n.renderQueue.push(t)}))},r.clearRect=function(t,e,r,n,o,i){t.clearRect(e,r,n,o),i&&(t.fillStyle=i,t.fillRect(e,r,n,o))},r.renderDisplayObject=function(t,r,n,o){var i=t.nodeName,a=o[o.length-1];!a||t.compareDocumentPosition(a)&Node.DOCUMENT_POSITION_CONTAINS||(r.restore(),o.pop());var c=this.context.styleRendererFactory[i],s=this.pathGeneratorFactory[i],u=t.parsedStyle.clipPath;if(u){this.applyWorldTransform(r,u);var h=this.pathGeneratorFactory[u.nodeName];h&&(r.save(),o.push(t),r.beginPath(),h(r,u.parsedStyle),r.closePath(),r.clip())}c&&(this.applyWorldTransform(r,t),r.save(),this.applyAttributesToContext(r,t)),s&&(r.beginPath(),s(r,t.parsedStyle),t.nodeName!==e.Shape.LINE&&t.nodeName!==e.Shape.PATH&&t.nodeName!==e.Shape.POLYLINE&&r.closePath()),c&&(c.render(r,t.parsedStyle,t,n,this),r.restore()),t.renderable.dirty=!1},r.convertAABB2Rect=function(t){var e=t.getMin(),r=t.getMax(),n=Math.floor(e[0]),o=Math.floor(e[1]);return{x:n,y:o,width:Math.ceil(r[0])-n,height:Math.ceil(r[1])-o}},r.mergeDirtyAABBs=function(t){var r=new e.AABB;return t.forEach((function(t){var e=t.getRenderBounds();r.add(e);var n=t.renderable.dirtyRenderBounds;n&&r.add(n)})),r},r.searchDirtyObjects=function(t){var r=t.getMin(),n=r[0],o=r[1],i=t.getMax();return this.rBush.search({minX:n,minY:o,maxX:i[0],maxY:i[1]}).map((function(t){return e.runtime.displayObjectPool.getByEntity(t.id)}))},r.saveDirtyAABB=function(t){var r=t.renderable;r.dirtyRenderBounds||(r.dirtyRenderBounds=new e.AABB);var n=t.getRenderBounds();n&&r.dirtyRenderBounds.update(n.center,n.halfExtents)},r.applyAttributesToContext=function(t,e){var r=e.parsedStyle,n=r.stroke,o=r.fill,i=r.opacity,a=r.lineDash,c=r.lineDashOffset;a&&t.setLineDash(a),w(c)||(t.lineDashOffset=c),w(i)||(t.globalAlpha*=i),w(n)||Array.isArray(n)||n.isNone||(t.strokeStyle=e.attributes.stroke),w(o)||Array.isArray(o)||o.isNone||(t.fillStyle=e.attributes.fill)},r.applyWorldTransform=function(t,e,r){var n=0,o=0,i=(e.parsedStyle||{}).anchor,a=i&&i[0]||0,c=i&&i[1]||0;if(0!==a||0!==c){var s=e.getGeometryBounds();n=-a*(s&&2*s.halfExtents[0]||0),o=-c*(s&&2*s.halfExtents[1]||0)}r?(u(this.tmpMat4,e.getLocalTransform()),this.vec3a[0]=n,this.vec3a[1]=o,this.vec3a[2]=0,l(this.tmpMat4,this.tmpMat4,this.vec3a),h(this.tmpMat4,r,this.tmpMat4),h(this.tmpMat4,this.vpMatrix,this.tmpMat4)):(u(this.tmpMat4,e.getWorldTransform()),this.vec3a[0]=n,this.vec3a[1]=o,this.vec3a[2]=0,l(this.tmpMat4,this.tmpMat4,this.vec3a),h(this.tmpMat4,this.vpMatrix,this.tmpMat4)),t.setTransform(this.tmpMat4[0],this.tmpMat4[1],this.tmpMat4[4],this.tmpMat4[5],this.tmpMat4[12],this.tmpMat4[13])},r.safeMergeAABB=function(){for(var t=new e.AABB,r=arguments.length,n=Array(r),o=0;r>o;o++)n[o]=arguments[o];return n.forEach((function(e){t.add(e)})),t},t}();Ct.tag="CanvasRenderer";var Nt=function(){function t(t){this.imagePool=void 0,this.imagePool=t}var r=t.prototype;return r.render=function(t,r,n,o,i){var a=r.fill,c=r.fillRule,s=r.opacity,u=r.fillOpacity,h=r.stroke,l=r.strokeOpacity,f=r.lineWidth,p=r.lineCap,v=r.lineJoin,d=r.shadowType,y=r.shadowColor,g=r.shadowBlur,m=r.filter,x=r.miterLimit,b=!w(a)&&!a.isNone,E=!w(h)&&!h.isNone&&f>0,L=0===a.alpha,O=!(!m||!m.length),P=!w(y)&&g>0,M=n.nodeName,S="inner"===d,k=E&&P&&(M===e.Shape.PATH||M===e.Shape.LINE||M===e.Shape.POLYLINE||L||S);b&&(t.globalAlpha=s*u,k||Rt(n,t,P),this.fill(t,n,a,c,o,i),k||this.clearShadowAndFilter(t,O,P)),E&&(t.globalAlpha=s*l,t.lineWidth=f,w(x)||(t.miterLimit=x),w(p)||(t.lineCap=p),w(v)||(t.lineJoin=v),k&&(S&&(t.globalCompositeOperation="source-atop"),Rt(n,t,!0),S&&(this.stroke(t,n,h,o,i),t.globalCompositeOperation="source-over",this.clearShadowAndFilter(t,O,!0))),this.stroke(t,n,h,o,i))},r.clearShadowAndFilter=function(t,e,r){if(r&&(t.shadowColor="transparent",t.shadowBlur=0),e){var n=t.filter;!w(n)&&n.indexOf("drop-shadow")>-1&&(t.filter=n.replace(/drop-shadow\([^)]*\)/,"").trim()||"none")}},r.fill=function(t,r,n,o,i,a){var c=this;Array.isArray(n)?n.forEach((function(e){t.fillStyle=c.getColor(e,r,t),t.fill(o)})):(e.isPattern(n)&&(t.fillStyle=this.getPattern(n,r,t,i,a)),t.fill(o))},r.stroke=function(t,r,n,o,i){var a=this;Array.isArray(n)?n.forEach((function(e){t.strokeStyle=a.getColor(e,r,t),t.stroke()})):(e.isPattern(n)&&(t.strokeStyle=this.getPattern(n,r,t,o,i)),t.stroke())},r.getPattern=function(t,r,n,o,i){var a,c;if(t.image instanceof e.Rect){var s=t.image.parsedStyle,u=s.width,h=s.height;c=o.contextService.getDPR();var l=o.config.offscreenCanvas;(a=e.runtime.offscreenCanvas.getOrCreateCanvas(l)).width=u*c,a.height=h*c;var f=e.runtime.offscreenCanvas.getOrCreateContext(l),p=[];t.image.forEach((function(t){i.renderDisplayObject(t,f,o,p)})),p.forEach((function(){f.restore()}))}return this.imagePool.getOrCreatePatternSync(t,n,a,c,(function(){r.renderable.dirty=!0,o.renderingService.dirtify()}))},r.getColor=function(t,r,n){var o;if(t.type===e.GradientType.LinearGradient||t.type===e.GradientType.RadialGradient){var i=r.getGeometryBounds();o=this.imagePool.getOrCreateGradient(At({type:t.type},t.value,{width:i&&2*i.halfExtents[0]||1,height:i&&2*i.halfExtents[1]||1}),n)}return o},t}();function Rt(t,e,r){var n=t.parsedStyle,o=n.filter,i=n.shadowColor,a=n.shadowBlur,c=n.shadowOffsetX,s=n.shadowOffsetY;o&&o.length&&(e.filter=t.style.filter),r&&(e.shadowColor=""+i,e.shadowBlur=a||0,e.shadowOffsetX=c||0,e.shadowOffsetY=s||0)}var It=function(){function t(t){this.imagePool=void 0,this.imagePool=t}return t.prototype.render=function(t,e,r){var n,o=e.img,i=e.shadowColor,a=e.shadowBlur,c=e.width,s=e.height;if(b(o)?n=this.imagePool.getImageSync(o):(c||(c=o.width),s||(s=o.height),n=o),n){Rt(r,t,!w(i)&&a>0);try{t.drawImage(n,0,0,c,s)}catch(t){}}},t}(),Gt=function(){function t(){}var e=t.prototype;return e.render=function(t,e,r){var n=e.lineWidth,o=e.textAlign,i=e.textBaseline,a=e.lineJoin,c=e.miterLimit,s=e.letterSpacing,u=e.stroke,h=e.fill,l=e.fillOpacity,f=e.strokeOpacity,p=e.opacity,v=e.metrics,d=e.dx,y=e.dy,g=e.shadowColor,m=e.shadowBlur,x=v.lines,b=v.height,E=v.lineHeight,L=v.lineMetrics;t.font=v.font,t.lineWidth=n,t.textAlign="middle"===o?"center":o,t.textBaseline=i,t.lineJoin=a,w(c)||(t.miterLimit=c);var O=0;"middle"===i?O=-b/2-E/2:"bottom"===i||"alphabetic"===i||"ideographic"===i?O=-b:"top"!==i&&"hanging"!==i||(O=-E);var P=d||0;O+=y||0,Rt(r,t,!w(g)&&m>0);for(var M=0;x.length>M;M++){var S=n/2+P;O+=E,w(u)||u.isNone||!n||this.drawLetterSpacing(t,x[M],L[M],o,S,O,s,l,f,p,!0),w(h)||this.drawLetterSpacing(t,x[M],L[M],o,S,O,s,l,f,p)}},e.drawLetterSpacing=function(t,e,r,n,o,i,a,c,s,u,h){if(void 0===h&&(h=!1),0!==a){var l=t.textAlign;t.textAlign="left";var f=o;"center"===n||"middle"===n?f=o-r.width/2:"right"!==n&&"end"!==n||(f=o-r.width);for(var p=Array.from(e),v=t.measureText(e).width,d=0,y=0;p.length>y;++y){var g=p[y];h?this.strokeText(t,g,f,i,s):this.fillText(t,g,f,i,c,u),f+=v-(d=t.measureText(e.substring(y+1)).width)+a,v=d}t.textAlign=l}else h?this.strokeText(t,e,o,i,s):this.fillText(t,e,o,i,c,u)},e.fillText=function(t,e,r,n,o,i){var a,c=!w(o)&&1!==o;c&&(a=t.globalAlpha,t.globalAlpha=o*i),t.fillText(e,r,n),c&&(t.globalAlpha=a)},e.strokeText=function(t,e,r,n,o){var i,a=!w(o)&&1!==o;a&&(i=t.globalAlpha,t.globalAlpha=o),t.strokeText(e,r,n),a&&(t.globalAlpha=i)},t}(),Ft=function(t){function e(){return t.apply(this,arguments)||this}return _t(e,t),e}(Nt),Dt=function(t){function e(){return t.apply(this,arguments)||this}return _t(e,t),e}(Nt),Bt=function(t){function e(){return t.apply(this,arguments)||this}return _t(e,t),e}(Nt),$t=function(t){function e(){return t.apply(this,arguments)||this}return _t(e,t),e}(Nt),Ht=function(t){function e(){return t.apply(this,arguments)||this}return _t(e,t),e}(Nt),Yt=function(t){function e(){return t.apply(this,arguments)||this}return _t(e,t),e}(Nt),Wt=function(t){function e(){return t.apply(this,arguments)||this}return _t(e,t),e}(Nt),Ut=function(t){function r(e){var r;return void 0===e&&(e={}),(r=t.call(this)||this).options=void 0,r.name="canvas-renderer",r.options=e,r}_t(r,t);var n=r.prototype;return n.init=function(){var t,r=At({dirtyObjectNumThreshold:500,dirtyObjectRatioThreshold:.8},this.options),n=this.context.imagePool,o=new Nt(n),i=((t={})[e.Shape.CIRCLE]=o,t[e.Shape.ELLIPSE]=o,t[e.Shape.RECT]=o,t[e.Shape.IMAGE]=new It(n),t[e.Shape.TEXT]=new Gt,t[e.Shape.LINE]=o,t[e.Shape.POLYLINE]=o,t[e.Shape.POLYGON]=o,t[e.Shape.PATH]=o,t[e.Shape.GROUP]=void 0,t[e.Shape.HTML]=void 0,t[e.Shape.MESH]=void 0,t);this.context.defaultStyleRendererFactory=i,this.context.styleRendererFactory=i,this.addRenderingPlugin(new Ct(r))},n.destroy=function(){this.removeAllRenderingPlugins(),delete this.context.defaultStyleRendererFactory,delete this.context.styleRendererFactory},r}(e.AbstractRendererPlugin),Xt=Object.freeze({__proto__:null,CircleRenderer:Dt,EllipseRenderer:Bt,ImageRenderer:It,LineRenderer:$t,PathRenderer:Wt,Plugin:Ut,PolygonRenderer:Yt,PolylineRenderer:Ht,RectRenderer:Ft,TextRenderer:Gt});function zt(){zt=function(){return t};var t={},e=Object.prototype,r=e.hasOwnProperty,n=Object.defineProperty||function(t,e,r){t[e]=r.value},o="function"==typeof Symbol?Symbol:{},i=o.iterator||"@@iterator",a=o.asyncIterator||"@@asyncIterator",c=o.toStringTag||"@@toStringTag";function s(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{s({},"")}catch(t){s=function(t,e,r){return t[e]=r}}function u(t,e,r,o){var i=Object.create((e&&e.prototype instanceof f?e:f).prototype),a=new P(o||[]);return n(i,"_invoke",{value:b(t,r,a)}),i}function h(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}t.wrap=u;var l={};function f(){}function p(){}function v(){}var d={};s(d,i,(function(){return this}));var y=Object.getPrototypeOf,g=y&&y(y(M([])));g&&g!==e&&r.call(g,i)&&(d=g);var m=v.prototype=f.prototype=Object.create(d);function w(t){["next","throw","return"].forEach((function(e){s(t,e,(function(t){return this._invoke(e,t)}))}))}function x(t,e){function o(n,i,a,c){var s=h(t[n],t,i);if("throw"!==s.type){var u=s.arg,l=u.value;return l&&"object"==typeof l&&r.call(l,"__await")?e.resolve(l.__await).then((function(t){o("next",t,a,c)}),(function(t){o("throw",t,a,c)})):e.resolve(l).then((function(t){u.value=t,a(u)}),(function(t){return o("throw",t,a,c)}))}c(s.arg)}var i;n(this,"_invoke",{value:function(t,r){function n(){return new e((function(e,n){o(t,r,e,n)}))}return i=i?i.then(n,n):n()}})}function b(t,e,r){var n="suspendedStart";return function(o,i){if("executing"===n)throw Error("Generator is already running");if("completed"===n){if("throw"===o)throw i;return S()}for(r.method=o,r.arg=i;;){var a=r.delegate;if(a){var c=E(a,r);if(c){if(c===l)continue;return c}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if("suspendedStart"===n)throw n="completed",r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n="executing";var s=h(t,e,r);if("normal"===s.type){if(n=r.done?"completed":"suspendedYield",s.arg===l)continue;return{value:s.arg,done:r.done}}"throw"===s.type&&(n="completed",r.method="throw",r.arg=s.arg)}}}function E(t,e){var r=e.method,n=t.iterator[r];if(void 0===n)return e.delegate=null,"throw"===r&&t.iterator.return&&(e.method="return",e.arg=void 0,E(t,e),"throw"===e.method)||"return"!==r&&(e.method="throw",e.arg=new TypeError("The iterator does not provide a '"+r+"' method")),l;var o=h(n,t.iterator,e.arg);if("throw"===o.type)return e.method="throw",e.arg=o.arg,e.delegate=null,l;var i=o.arg;return i?i.done?(e[t.resultName]=i.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=void 0),e.delegate=null,l):i:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,l)}function L(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function O(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function P(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(L,this),this.reset(!0)}function M(t){if(t){var e=t[i];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var n=-1,o=function e(){for(;++n<t.length;)if(r.call(t,n))return e.value=t[n],e.done=!1,e;return e.value=void 0,e.done=!0,e};return o.next=o}}return{next:S}}function S(){return{value:void 0,done:!0}}return p.prototype=v,n(m,"constructor",{value:v,configurable:!0}),n(v,"constructor",{value:p,configurable:!0}),p.displayName=s(v,c,"GeneratorFunction"),t.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===p||"GeneratorFunction"===(e.displayName||e.name))},t.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,v):(t.__proto__=v,s(t,c,"GeneratorFunction")),t.prototype=Object.create(m),t},t.awrap=function(t){return{__await:t}},w(x.prototype),s(x.prototype,a,(function(){return this})),t.AsyncIterator=x,t.async=function(e,r,n,o,i){void 0===i&&(i=Promise);var a=new x(u(e,r,n,o),i);return t.isGeneratorFunction(r)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},w(m),s(m,c,"Generator"),s(m,i,(function(){return this})),s(m,"toString",(function(){return"[object Generator]"})),t.keys=function(t){var e=Object(t),r=[];for(var n in e)r.push(n);return r.reverse(),function t(){for(;r.length;){var n=r.pop();if(n in e)return t.value=n,t.done=!1,t}return t.done=!0,t}},t.values=M,P.prototype={constructor:P,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(O),!t)for(var e in this)"t"===e.charAt(0)&&r.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=void 0)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var e=this;function n(r,n){return a.type="throw",a.arg=t,e.next=r,n&&(e.method="next",e.arg=void 0),!!n}for(var o=this.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],a=i.completion;if("root"===i.tryLoc)return n("end");if(this.prev>=i.tryLoc){var c=r.call(i,"catchLoc"),s=r.call(i,"finallyLoc");if(c&&s){if(i.catchLoc>this.prev)return n(i.catchLoc,!0);if(i.finallyLoc>this.prev)return n(i.finallyLoc)}else if(c){if(i.catchLoc>this.prev)return n(i.catchLoc,!0)}else{if(!s)throw Error("try statement without catch or finally");if(i.finallyLoc>this.prev)return n(i.finallyLoc)}}}},abrupt:function(t,e){for(var n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n];if(this.prev>=o.tryLoc&&r.call(o,"finallyLoc")&&o.finallyLoc>this.prev){var i=o;break}}i&&("break"===t||"continue"===t)&&e>=i.tryLoc&&i.finallyLoc>=e&&(i=null);var a=i?i.completion:{};return a.type=t,a.arg=e,i?(this.method="next",this.next=i.finallyLoc,l):this.complete(a)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),l},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),O(r),l}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;O(r)}return o}}throw Error("illegal catch attempt")},delegateYield:function(t,e,r){return this.delegate={iterator:M(t),resultName:e,nextLoc:r},"next"===this.method&&(this.arg=void 0),l}},t}function qt(t,e,r,n,o,i,a){try{var c=t[i](a),s=c.value}catch(t){return void r(t)}c.done?e(s):Promise.resolve(s).then(n,o)}function Qt(t){return function(){var e=this,r=arguments;return new Promise((function(n,o){var i=t.apply(e,r);function a(t){qt(i,n,o,a,c,"next",t)}function c(t){qt(i,n,o,a,c,"throw",t)}a(void 0)}))}}function Vt(t,e){return Vt=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Vt(t,e)}var Zt=function(){function t(){this.context=void 0}return t.prototype.apply=function(r){var n=this,o=r.renderingService,i=r.renderingContext;this.context=r;var a=i.root.ownerDocument.defaultView,c=function(t){o.hooks.pointerMove.call(t)},s=function(t){o.hooks.pointerUp.call(t)},u=function(t){o.hooks.pointerDown.call(t)},h=function(t){o.hooks.pointerOver.call(t)},l=function(t){o.hooks.pointerOut.call(t)},f=function(t){o.hooks.pointerCancel.call(t)},p=function(t){o.hooks.pointerWheel.call(t)},v=function(t){e.runtime.globalThis.document.addEventListener("pointermove",c,!0),t.addEventListener("pointerdown",u,!0),t.addEventListener("pointerleave",l,!0),t.addEventListener("pointerover",h,!0),e.runtime.globalThis.addEventListener("pointerup",s,!0)},d=function(t){t.addEventListener("touchstart",u,!0),t.addEventListener("touchend",s,!0),t.addEventListener("touchmove",c,!0),t.addEventListener("touchcancel",f,!0)},y=function(t){e.runtime.globalThis.document.addEventListener("mousemove",c,!0),t.addEventListener("mousedown",u,!0),t.addEventListener("mouseout",l,!0),t.addEventListener("mouseover",h,!0),e.runtime.globalThis.addEventListener("mouseup",s,!0)};o.hooks.init.tapPromise(t.tag,Qt(zt().mark((function t(){var r;return zt().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:r=n.context.contextService.getDomElement(),e.runtime.globalThis.navigator.msPointerEnabled?(r.style.msContentZooming="none",r.style.msTouchAction="none"):a.supportsPointerEvents&&(r.style.touchAction="none"),a.supportsPointerEvents?v(r):y(r),a.supportsTouchEvents&&d(r),r.addEventListener("wheel",p,{passive:!0,capture:!0});case 5:case"end":return t.stop()}}),t)})))),o.hooks.destroy.tap(t.tag,(function(){var t=n.context.contextService.getDomElement();e.runtime.globalThis.navigator.msPointerEnabled?(t.style.msContentZooming="",t.style.msTouchAction=""):a.supportsPointerEvents&&(t.style.touchAction=""),a.supportsPointerEvents?function(t){e.runtime.globalThis.document.removeEventListener("pointermove",c,!0),t.removeEventListener("pointerdown",u,!0),t.removeEventListener("pointerleave",l,!0),t.removeEventListener("pointerover",h,!0),e.runtime.globalThis.removeEventListener("pointerup",s,!0)}(t):function(t){e.runtime.globalThis.document.removeEventListener("mousemove",c,!0),t.removeEventListener("mousedown",u,!0),t.removeEventListener("mouseout",l,!0),t.removeEventListener("mouseover",h,!0),e.runtime.globalThis.removeEventListener("mouseup",s,!0)}(t),a.supportsTouchEvents&&function(t){t.removeEventListener("touchstart",u,!0),t.removeEventListener("touchend",s,!0),t.removeEventListener("touchmove",c,!0),t.removeEventListener("touchcancel",f,!0)}(t),t.removeEventListener("wheel",p,!0)}))},t}();Zt.tag="DOMInteraction";var Jt=function(t){var e,r;function n(){for(var e,r=arguments.length,n=Array(r),o=0;r>o;o++)n[o]=arguments[o];return(e=t.call.apply(t,[this].concat(n))||this).name="dom-interaction",e}(e=n).prototype=Object.create((r=t).prototype),e.prototype.constructor=e,Vt(e,r);var o=n.prototype;return o.init=function(){this.addRenderingPlugin(new Zt)},o.destroy=function(){this.removeAllRenderingPlugins()},n}(e.AbstractRendererPlugin),Kt=Object.freeze({__proto__:null,Plugin:Jt});function te(){te=function(){return t};var t={},e=Object.prototype,r=e.hasOwnProperty,n=Object.defineProperty||function(t,e,r){t[e]=r.value},o="function"==typeof Symbol?Symbol:{},i=o.iterator||"@@iterator",a=o.asyncIterator||"@@asyncIterator",c=o.toStringTag||"@@toStringTag";function s(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{s({},"")}catch(t){s=function(t,e,r){return t[e]=r}}function u(t,e,r,o){var i=Object.create((e&&e.prototype instanceof f?e:f).prototype),a=new P(o||[]);return n(i,"_invoke",{value:b(t,r,a)}),i}function h(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}t.wrap=u;var l={};function f(){}function p(){}function v(){}var d={};s(d,i,(function(){return this}));var y=Object.getPrototypeOf,g=y&&y(y(M([])));g&&g!==e&&r.call(g,i)&&(d=g);var m=v.prototype=f.prototype=Object.create(d);function w(t){["next","throw","return"].forEach((function(e){s(t,e,(function(t){return this._invoke(e,t)}))}))}function x(t,e){function o(n,i,a,c){var s=h(t[n],t,i);if("throw"!==s.type){var u=s.arg,l=u.value;return l&&"object"==typeof l&&r.call(l,"__await")?e.resolve(l.__await).then((function(t){o("next",t,a,c)}),(function(t){o("throw",t,a,c)})):e.resolve(l).then((function(t){u.value=t,a(u)}),(function(t){return o("throw",t,a,c)}))}c(s.arg)}var i;n(this,"_invoke",{value:function(t,r){function n(){return new e((function(e,n){o(t,r,e,n)}))}return i=i?i.then(n,n):n()}})}function b(t,e,r){var n="suspendedStart";return function(o,i){if("executing"===n)throw Error("Generator is already running");if("completed"===n){if("throw"===o)throw i;return S()}for(r.method=o,r.arg=i;;){var a=r.delegate;if(a){var c=E(a,r);if(c){if(c===l)continue;return c}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if("suspendedStart"===n)throw n="completed",r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n="executing";var s=h(t,e,r);if("normal"===s.type){if(n=r.done?"completed":"suspendedYield",s.arg===l)continue;return{value:s.arg,done:r.done}}"throw"===s.type&&(n="completed",r.method="throw",r.arg=s.arg)}}}function E(t,e){var r=e.method,n=t.iterator[r];if(void 0===n)return e.delegate=null,"throw"===r&&t.iterator.return&&(e.method="return",e.arg=void 0,E(t,e),"throw"===e.method)||"return"!==r&&(e.method="throw",e.arg=new TypeError("The iterator does not provide a '"+r+"' method")),l;var o=h(n,t.iterator,e.arg);if("throw"===o.type)return e.method="throw",e.arg=o.arg,e.delegate=null,l;var i=o.arg;return i?i.done?(e[t.resultName]=i.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=void 0),e.delegate=null,l):i:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,l)}function L(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function O(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function P(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(L,this),this.reset(!0)}function M(t){if(t){var e=t[i];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var n=-1,o=function e(){for(;++n<t.length;)if(r.call(t,n))return e.value=t[n],e.done=!1,e;return e.value=void 0,e.done=!0,e};return o.next=o}}return{next:S}}function S(){return{value:void 0,done:!0}}return p.prototype=v,n(m,"constructor",{value:v,configurable:!0}),n(v,"constructor",{value:p,configurable:!0}),p.displayName=s(v,c,"GeneratorFunction"),t.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===p||"GeneratorFunction"===(e.displayName||e.name))},t.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,v):(t.__proto__=v,s(t,c,"GeneratorFunction")),t.prototype=Object.create(m),t},t.awrap=function(t){return{__await:t}},w(x.prototype),s(x.prototype,a,(function(){return this})),t.AsyncIterator=x,t.async=function(e,r,n,o,i){void 0===i&&(i=Promise);var a=new x(u(e,r,n,o),i);return t.isGeneratorFunction(r)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},w(m),s(m,c,"Generator"),s(m,i,(function(){return this})),s(m,"toString",(function(){return"[object Generator]"})),t.keys=function(t){var e=Object(t),r=[];for(var n in e)r.push(n);return r.reverse(),function t(){for(;r.length;){var n=r.pop();if(n in e)return t.value=n,t.done=!1,t}return t.done=!0,t}},t.values=M,P.prototype={constructor:P,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(O),!t)for(var e in this)"t"===e.charAt(0)&&r.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=void 0)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var e=this;function n(r,n){return a.type="throw",a.arg=t,e.next=r,n&&(e.method="next",e.arg=void 0),!!n}for(var o=this.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],a=i.completion;if("root"===i.tryLoc)return n("end");if(this.prev>=i.tryLoc){var c=r.call(i,"catchLoc"),s=r.call(i,"finallyLoc");if(c&&s){if(i.catchLoc>this.prev)return n(i.catchLoc,!0);if(i.finallyLoc>this.prev)return n(i.finallyLoc)}else if(c){if(i.catchLoc>this.prev)return n(i.catchLoc,!0)}else{if(!s)throw Error("try statement without catch or finally");if(i.finallyLoc>this.prev)return n(i.finallyLoc)}}}},abrupt:function(t,e){for(var n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n];if(this.prev>=o.tryLoc&&r.call(o,"finallyLoc")&&o.finallyLoc>this.prev){var i=o;break}}i&&("break"===t||"continue"===t)&&e>=i.tryLoc&&i.finallyLoc>=e&&(i=null);var a=i?i.completion:{};return a.type=t,a.arg=e,i?(this.method="next",this.next=i.finallyLoc,l):this.complete(a)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),l},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),O(r),l}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;O(r)}return o}}throw Error("illegal catch attempt")},delegateYield:function(t,e,r){return this.delegate={iterator:M(t),resultName:e,nextLoc:r},"next"===this.method&&(this.arg=void 0),l}},t}function ee(t,e,r,n,o,i,a){try{var c=t[i](a),s=c.value}catch(t){return void r(t)}c.done?e(s):Promise.resolve(s).then(n,o)}function re(t){return function(){var e=this,r=arguments;return new Promise((function(n,o){var i=t.apply(e,r);function a(t){ee(i,n,o,a,c,"next",t)}function c(t){ee(i,n,o,a,c,"throw",t)}a(void 0)}))}}function ne(t,e){return ne=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},ne(t,e)}var oe=function(){function t(){this.context=void 0,this.$camera=void 0}var r=t.prototype;return r.joinTransformMatrix=function(t){return"matrix("+[t[0],t[1],t[4],t[5],t[12],t[13]].join(",")+")"},r.apply=function(r){var n=this,o=r.camera,i=r.renderingContext,a=r.renderingService,c=r.displayObjectPool;this.context=r;var s=i.root.ownerDocument.defaultView,u=function(t,e){e.style.transform=n.joinTransformMatrix(t.getWorldTransform())},h=function(t){var r=t.target;if(r.nodeName===e.Shape.HTML){n.$camera||(n.$camera=n.createCamera(o));var i=n.getOrCreateEl(r);n.$camera.appendChild(i);var a=r.ownerDocument.documentElement.attributes;Object.keys(a).forEach((function(t){i.style[t]=a[t]})),Object.keys(r.attributes).forEach((function(t){n.updateAttribute(t,r)})),u(r,i)}},l=function(t){var r=t.target;if(r.nodeName===e.Shape.HTML&&n.$camera){var o=n.getOrCreateEl(r);o&&o.remove()}},f=function(t){var r=t.target;r.nodeName===e.Shape.HTML&&n.updateAttribute(t.attrName,r)},p=function(t){var r=t.target;if(r.nodeName===e.Shape.HTML){var o=n.getOrCreateEl(r);u(r,o)}},v=function(){if(n.$camera){var t=n.context.config,e=t.height;n.$camera.style.width=(t.width||0)+"px",n.$camera.style.height=(e||0)+"px"}};a.hooks.init.tapPromise(t.tag,re(te().mark((function t(){return te().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:c.getHTMLs().length&&(n.$camera=n.createCamera(o)),s.addEventListener(e.CanvasEvent.RESIZE,v),s.addEventListener(e.ElementEvent.MOUNTED,h),s.addEventListener(e.ElementEvent.UNMOUNTED,l),s.addEventListener(e.ElementEvent.ATTR_MODIFIED,f),s.addEventListener(e.ElementEvent.BOUNDS_CHANGED,p);case 6:case"end":return t.stop()}}),t)})))),a.hooks.endFrame.tap(t.tag,(function(){n.$camera&&i.renderReasons.has(e.RenderReason.CAMERA_CHANGED)&&(n.$camera.style.transform=n.joinTransformMatrix(o.getOrthoMatrix()))})),a.hooks.destroy.tap(t.tag,(function(){n.$camera&&n.$camera.remove(),s.removeEventListener(e.CanvasEvent.RESIZE,v),s.removeEventListener(e.ElementEvent.MOUNTED,h),s.removeEventListener(e.ElementEvent.UNMOUNTED,l),s.removeEventListener(e.ElementEvent.ATTR_MODIFIED,f),s.removeEventListener(e.ElementEvent.BOUNDS_CHANGED,p)}))},r.getId=function(t){return t.id||"g-html-"+t.entity},r.createCamera=function(t){var e=this.context.config,r=e.document,n=e.width,o=e.height,i=this.context.contextService.getDomElement(),a=i.parentNode;if(a){var c="g-canvas-camera",s=a.querySelector("#"+c);if(!s){var u=(r||document).createElement("div");s=u,u.id=c,u.style.position="absolute",u.style.left=(i.offsetLeft||0)+"px",u.style.top=(i.offsetTop||0)+"px",u.style.transformOrigin="left top",u.style.transform=this.joinTransformMatrix(t.getOrthoMatrix()),u.style.overflow="hidden",u.style.pointerEvents="none",u.style.width=(n||0)+"px",u.style.height=(o||0)+"px",a.appendChild(u)}return s}return null},r.getOrCreateEl=function(t){var e=this.context.config.document,r=this.getId(t),n=this.$camera.querySelector("#"+r);return n||(n=(e||document).createElement("div"),t.parsedStyle.$el=n,n.id=r,t.name&&n.setAttribute("name",t.name),t.className&&(n.className=t.className),n.style.position="absolute",n.style.left="0px",n.style.top="0px",n.style["will-change"]="transform",n.style.transform=this.joinTransformMatrix(t.getWorldTransform())),n},r.updateAttribute=function(t,r){var n=this.getOrCreateEl(r);switch(t){case"innerHTML":var o=r.parsedStyle.innerHTML;b(o)?n.innerHTML=o:(n.innerHTML="",n.appendChild(o));break;case"transformOrigin":var i=r.parsedStyle.transformOrigin;n.style["transform-origin"]=i[0].value+" "+i[1].value;break;case"width":var a=r.computedStyleMap().get("width");n.style.width=""+a;break;case"height":var c=r.computedStyleMap().get("height");n.style.height=""+c;break;case"zIndex":n.style["z-index"]=""+r.parsedStyle.zIndex;break;case"visibility":n.style.visibility=r.parsedStyle.visibility;break;case"pointerEvents":n.style.pointerEvents=r.parsedStyle.pointerEvents;break;case"opacity":n.style.opacity=""+r.parsedStyle.opacity;break;case"fill":var s=r.parsedStyle.fill,u="";s instanceof e.CSSRGB?u=s.isNone?"transparent":r.getAttribute("fill"):Array.isArray(s)?u=r.getAttribute("fill"):e.isPattern(s),n.style.background=u;break;case"stroke":var h=r.parsedStyle.stroke,l="";h instanceof e.CSSRGB?l=h.isNone?"transparent":r.getAttribute("stroke"):Array.isArray(h)?l=r.getAttribute("stroke"):e.isPattern(h),n.style["border-color"]=l,n.style["border-style"]="solid";break;case"lineWidth":n.style["border-width"]=(r.parsedStyle.lineWidth||0)+"px";break;case"lineDash":n.style["border-style"]="dashed";break;case"filter":n.style.filter=r.style.filter}},t}();oe.tag="HTMLRendering";var ie=function(t){var e,r;function n(){for(var e,r=arguments.length,n=Array(r),o=0;r>o;o++)n[o]=arguments[o];return(e=t.call.apply(t,[this].concat(n))||this).name="html-renderer",e}(e=n).prototype=Object.create((r=t).prototype),e.prototype.constructor=e,ne(e,r);var o=n.prototype;return o.init=function(){this.addRenderingPlugin(new oe)},o.destroy=function(){this.removeAllRenderingPlugins()},n}(e.AbstractRendererPlugin),ae=Object.freeze({__proto__:null,Plugin:ie});function ce(){ce=function(){return t};var t={},e=Object.prototype,r=e.hasOwnProperty,n=Object.defineProperty||function(t,e,r){t[e]=r.value},o="function"==typeof Symbol?Symbol:{},i=o.iterator||"@@iterator",a=o.asyncIterator||"@@asyncIterator",c=o.toStringTag||"@@toStringTag";function s(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{s({},"")}catch(t){s=function(t,e,r){return t[e]=r}}function u(t,e,r,o){var i=Object.create((e&&e.prototype instanceof f?e:f).prototype),a=new P(o||[]);return n(i,"_invoke",{value:b(t,r,a)}),i}function h(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}t.wrap=u;var l={};function f(){}function p(){}function v(){}var d={};s(d,i,(function(){return this}));var y=Object.getPrototypeOf,g=y&&y(y(M([])));g&&g!==e&&r.call(g,i)&&(d=g);var m=v.prototype=f.prototype=Object.create(d);function w(t){["next","throw","return"].forEach((function(e){s(t,e,(function(t){return this._invoke(e,t)}))}))}function x(t,e){function o(n,i,a,c){var s=h(t[n],t,i);if("throw"!==s.type){var u=s.arg,l=u.value;return l&&"object"==typeof l&&r.call(l,"__await")?e.resolve(l.__await).then((function(t){o("next",t,a,c)}),(function(t){o("throw",t,a,c)})):e.resolve(l).then((function(t){u.value=t,a(u)}),(function(t){return o("throw",t,a,c)}))}c(s.arg)}var i;n(this,"_invoke",{value:function(t,r){function n(){return new e((function(e,n){o(t,r,e,n)}))}return i=i?i.then(n,n):n()}})}function b(t,e,r){var n="suspendedStart";return function(o,i){if("executing"===n)throw Error("Generator is already running");if("completed"===n){if("throw"===o)throw i;return S()}for(r.method=o,r.arg=i;;){var a=r.delegate;if(a){var c=E(a,r);if(c){if(c===l)continue;return c}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if("suspendedStart"===n)throw n="completed",r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n="executing";var s=h(t,e,r);if("normal"===s.type){if(n=r.done?"completed":"suspendedYield",s.arg===l)continue;return{value:s.arg,done:r.done}}"throw"===s.type&&(n="completed",r.method="throw",r.arg=s.arg)}}}function E(t,e){var r=e.method,n=t.iterator[r];if(void 0===n)return e.delegate=null,"throw"===r&&t.iterator.return&&(e.method="return",e.arg=void 0,E(t,e),"throw"===e.method)||"return"!==r&&(e.method="throw",e.arg=new TypeError("The iterator does not provide a '"+r+"' method")),l;var o=h(n,t.iterator,e.arg);if("throw"===o.type)return e.method="throw",e.arg=o.arg,e.delegate=null,l;var i=o.arg;return i?i.done?(e[t.resultName]=i.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=void 0),e.delegate=null,l):i:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,l)}function L(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function O(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function P(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(L,this),this.reset(!0)}function M(t){if(t){var e=t[i];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var n=-1,o=function e(){for(;++n<t.length;)if(r.call(t,n))return e.value=t[n],e.done=!1,e;return e.value=void 0,e.done=!0,e};return o.next=o}}return{next:S}}function S(){return{value:void 0,done:!0}}return p.prototype=v,n(m,"constructor",{value:v,configurable:!0}),n(v,"constructor",{value:p,configurable:!0}),p.displayName=s(v,c,"GeneratorFunction"),t.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===p||"GeneratorFunction"===(e.displayName||e.name))},t.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,v):(t.__proto__=v,s(t,c,"GeneratorFunction")),t.prototype=Object.create(m),t},t.awrap=function(t){return{__await:t}},w(x.prototype),s(x.prototype,a,(function(){return this})),t.AsyncIterator=x,t.async=function(e,r,n,o,i){void 0===i&&(i=Promise);var a=new x(u(e,r,n,o),i);return t.isGeneratorFunction(r)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},w(m),s(m,c,"Generator"),s(m,i,(function(){return this})),s(m,"toString",(function(){return"[object Generator]"})),t.keys=function(t){var e=Object(t),r=[];for(var n in e)r.push(n);return r.reverse(),function t(){for(;r.length;){var n=r.pop();if(n in e)return t.value=n,t.done=!1,t}return t.done=!0,t}},t.values=M,P.prototype={constructor:P,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(O),!t)for(var e in this)"t"===e.charAt(0)&&r.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=void 0)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var e=this;function n(r,n){return a.type="throw",a.arg=t,e.next=r,n&&(e.method="next",e.arg=void 0),!!n}for(var o=this.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],a=i.completion;if("root"===i.tryLoc)return n("end");if(this.prev>=i.tryLoc){var c=r.call(i,"catchLoc"),s=r.call(i,"finallyLoc");if(c&&s){if(i.catchLoc>this.prev)return n(i.catchLoc,!0);if(i.finallyLoc>this.prev)return n(i.finallyLoc)}else if(c){if(i.catchLoc>this.prev)return n(i.catchLoc,!0)}else{if(!s)throw Error("try statement without catch or finally");if(i.finallyLoc>this.prev)return n(i.finallyLoc)}}}},abrupt:function(t,e){for(var n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n];if(this.prev>=o.tryLoc&&r.call(o,"finallyLoc")&&o.finallyLoc>this.prev){var i=o;break}}i&&("break"===t||"continue"===t)&&e>=i.tryLoc&&i.finallyLoc>=e&&(i=null);var a=i?i.completion:{};return a.type=t,a.arg=e,i?(this.method="next",this.next=i.finallyLoc,l):this.complete(a)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),l},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),O(r),l}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;O(r)}return o}}throw Error("illegal catch attempt")},delegateYield:function(t,e,r){return this.delegate={iterator:M(t),resultName:e,nextLoc:r},"next"===this.method&&(this.arg=void 0),l}},t}function se(t,e,r,n,o,i,a){try{var c=t[i](a),s=c.value}catch(t){return void r(t)}c.done?e(s):Promise.resolve(s).then(n,o)}function ue(t){return function(){var e=this,r=arguments;return new Promise((function(n,o){var i=t.apply(e,r);function a(t){se(i,n,o,a,c,"next",t)}function c(t){se(i,n,o,a,c,"throw",t)}a(void 0)}))}}function he(t,e){return he=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},he(t,e)}var le="undefined"!=typeof Float32Array?Float32Array:Array;Math.hypot||(Math.hypot=function(){for(var t=0,e=arguments.length;e--;)t+=arguments[e]*arguments[e];return Math.sqrt(t)});var fe=function(){function t(t){this.canvasConfig=void 0,this.imageCache={},this.gradientCache={},this.patternCache={},this.canvasConfig=t}var r=t.prototype;return r.getImageSync=function(t,e){return this.imageCache[t]?e&&e():this.getOrCreateImage(t).then((function(){e&&e()})),this.imageCache[t]},r.getOrCreateImage=function(t){var r=this;if(this.imageCache[t])return Promise.resolve(this.imageCache[t]);var n=this.canvasConfig.createImage;return new Promise((function(o,i){var a;n?a=n(t):e.isBrowser&&(a=new window.Image),a&&(a.onload=function(){o(a)},a.onerror=function(t){i(t)},a.crossOrigin="Anonymous",a.src=t,r.imageCache[t]=a)}))},r.getOrCreatePatternSync=function(t,r,n,o,i){var a=this.generatePatternKey(t);if(a&&this.patternCache[a])return this.patternCache[a];var c,s=t.image,u=t.repetition,h=t.transform,l=!1;b(s)?c=this.getImageSync(s,i):n?(c=n,l=!0):c=s;var f,p,v=c&&r.createPattern(c,u);v&&(f=h?e.parsedTransformToMat4(e.parseTransform(h)):function(t){return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=1,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}((p=new le(16),le!=Float32Array&&(p[1]=0,p[2]=0,p[3]=0,p[4]=0,p[6]=0,p[7]=0,p[8]=0,p[9]=0,p[11]=0,p[12]=0,p[13]=0,p[14]=0),p[0]=1,p[5]=1,p[10]=1,p[15]=1,p)),l&&function(t,e,r){var n=r[0],o=r[1],i=r[2];t[0]=e[0]*n,t[1]=e[1]*n,t[2]=e[2]*n,t[3]=e[3]*n,t[4]=e[4]*o,t[5]=e[5]*o,t[6]=e[6]*o,t[7]=e[7]*o,t[8]=e[8]*i,t[9]=e[9]*i,t[10]=e[10]*i,t[11]=e[11]*i,t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]}(f,f,[1/o,1/o,1]),v.setTransform({a:f[0],b:f[1],c:f[4],d:f[5],e:f[12],f:f[13]}));return a&&v&&(this.patternCache[a]=v),v},r.getOrCreateGradient=function(t,r){var n=this.generateGradientKey(t),o=t.type,i=t.steps,a=t.width,c=t.height,s=t.cx,u=t.cy,h=t.size;if(this.gradientCache[n])return this.gradientCache[n];var l=null;if(o===e.GradientType.LinearGradient){var f=e.computeLinearGradient(a,c,t.angle);l=r.createLinearGradient(f.x1,f.y1,f.x2,f.y2)}else if(o===e.GradientType.RadialGradient){var p=e.computeRadialGradient(a,c,s,u,h),v=p.x,d=p.y;l=r.createRadialGradient(v,d,0,v,d,p.r)}return l&&(i.forEach((function(t){var r,n=t.offset;n.unit===e.UnitType.kPercentage&&(null===(r=l)||void 0===r||r.addColorStop(n.value/100,""+t.color))})),this.gradientCache[n]=l),this.gradientCache[n]},r.generateGradientKey=function(t){var e=t.angle,r=t.cx,n=t.cy,o=t.size;return"gradient-"+t.type+"-"+((null==e?void 0:""+e)||0)+"-"+((null==r?void 0:""+r)||0)+"-"+((null==n?void 0:""+n)||0)+"-"+((null==o?void 0:""+o)||0)+"-"+t.width+"-"+t.height+"-"+t.steps.map((function(t){return""+t.offset+t.color})).join("-")},r.generatePatternKey=function(t){var r=t.image,n=t.repetition;return b(r)?"pattern-"+r+"-"+n:r instanceof e.Rect?"pattern-"+r.entity+"-"+n:void 0},t}(),pe=function(){function t(){}return t.prototype.apply=function(r){var n=r.renderingService,o=r.imagePool,i=r.renderingContext.root.ownerDocument.defaultView,a=function(t){var r=t.target;if(r.nodeName===e.Shape.IMAGE){var i=r.attributes.img;b(i)&&o.getImageSync(i,(function(){r.renderable.dirty=!0,n.dirtify()}))}},c=function(t){var r=t.target,i=t.newValue;r.nodeName===e.Shape.IMAGE&&"img"===t.attrName&&b(i)&&o.getOrCreateImage(i).then((function(){r.renderable.dirty=!0,n.dirtify()}))};n.hooks.init.tapPromise(t.tag,ue(ce().mark((function t(){return ce().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:i.addEventListener(e.ElementEvent.MOUNTED,a),i.addEventListener(e.ElementEvent.ATTR_MODIFIED,c);case 2:case"end":return t.stop()}}),t)})))),n.hooks.destroy.tap(t.tag,(function(){i.removeEventListener(e.ElementEvent.MOUNTED,a),i.removeEventListener(e.ElementEvent.ATTR_MODIFIED,c)}))},t}();pe.tag="LoadImage";var ve=function(t){var e,r;function n(){for(var e,r=arguments.length,n=Array(r),o=0;r>o;o++)n[o]=arguments[o];return(e=t.call.apply(t,[this].concat(n))||this).name="image-loader",e}(e=n).prototype=Object.create((r=t).prototype),e.prototype.constructor=e,he(e,r);var o=n.prototype;return o.init=function(){this.context.imagePool=new fe(this.context.config),this.addRenderingPlugin(new pe)},o.destroy=function(){this.removeAllRenderingPlugins()},n}(e.AbstractRendererPlugin),de=Object.freeze({__proto__:null,ImagePool:fe,Plugin:ve}),ye=function(){function t(t){this.$container=void 0,this.$canvas=void 0,this.dpr=void 0,this.context=void 0,this.canvasConfig=void 0,this.renderingContext=void 0,this.renderingContext=t.renderingContext,this.canvasConfig=t.config}var n=t.prototype;return n.init=function(){var t=o(r().mark((function t(){var e,n,o,i;return r().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:n=(e=this.canvasConfig).container,(o=e.canvas)?(this.$canvas=o,n&&o.parentElement!==n&&n.appendChild(o),this.$container=o.parentElement,this.canvasConfig.container=this.$container):n&&(this.$container=b(n)?document.getElementById(n):n,this.$container&&(i=document.createElement("canvas"),this.$container.appendChild(i),this.$container.style.position||(this.$container.style.position="relative"),this.$canvas=i)),this.context=this.$canvas.getContext("2d"),this.resize(this.canvasConfig.width,this.canvasConfig.height);case 4:case"end":return t.stop()}}),t,this)})));return function(){return t.apply(this,arguments)}}(),n.getContext=function(){return this.context},n.getDomElement=function(){return this.$canvas},n.getDPR=function(){return this.dpr},n.getBoundingClientRect=function(){if(this.$canvas.getBoundingClientRect)return this.$canvas.getBoundingClientRect()},n.destroy=function(){this.$container&&this.$canvas&&this.$canvas.parentNode&&this.$container.removeChild(this.$canvas)},n.resize=function(t,r){var n=this.canvasConfig.devicePixelRatio||e.isBrowser&&window.devicePixelRatio||1;this.dpr=n=1>n?1:Math.ceil(n),this.$canvas&&(this.$canvas.width=this.dpr*t,this.$canvas.height=this.dpr*r,e.setDOMSize(this.$canvas,t,r)),this.renderingContext.renderReasons.add(e.RenderReason.CAMERA_CHANGED)},n.applyCursorStyle=function(t){this.$container&&this.$container.style&&(this.$container.style.cursor=t)},n.toDataURL=function(){var t=o(r().mark((function t(e){var n;return r().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return void 0===e&&(e={}),t.abrupt("return",this.context.canvas.toDataURL((n=e).type,n.encoderOptions));case 3:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}(),t}(),ge=function(t){function e(){for(var e,r=arguments.length,n=Array(r),o=0;r>o;o++)n[o]=arguments[o];return(e=t.call.apply(t,[this].concat(n))||this).name="canvas-context-register",e}i(e,t);var r=e.prototype;return r.init=function(){this.context.ContextService=ye},r.destroy=function(){delete this.context.ContextService},e}(e.AbstractRendererPlugin),me=function(t){function e(e){var r;return(r=t.call(this,e)||this).registerPlugin(new ge),r.registerPlugin(new ve),r.registerPlugin(new _),r.registerPlugin(new Ut),r.registerPlugin(new Jt),r.registerPlugin(new Pt),r.registerPlugin(new ie),r}return i(e,t),e}(e.AbstractRenderer);t.CanvasPathGenerator=j,t.CanvasPicker=Mt,t.CanvasRenderer=Xt,t.DomInteraction=Kt,t.HTMLRenderer=ae,t.ImageLoader=de,t.Renderer=me,Object.defineProperty(t,"__esModule",{value:!0})}));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@antv/g-canvas",
3
- "version": "1.9.20",
3
+ "version": "1.9.22",
4
4
  "description": "A renderer implemented by Canvas 2D API",
5
5
  "keywords": [
6
6
  "antv",
@@ -32,12 +32,12 @@
32
32
  "sync": "tnpm sync"
33
33
  },
34
34
  "dependencies": {
35
- "@antv/g-plugin-canvas-path-generator": "^1.1.32",
36
- "@antv/g-plugin-canvas-picker": "^1.8.29",
37
- "@antv/g-plugin-canvas-renderer": "^1.7.35",
38
- "@antv/g-plugin-dom-interaction": "^1.7.32",
39
- "@antv/g-plugin-html-renderer": "^1.7.32",
40
- "@antv/g-plugin-image-loader": "^1.1.33",
35
+ "@antv/g-plugin-canvas-path-generator": "^1.1.34",
36
+ "@antv/g-plugin-canvas-picker": "^1.8.31",
37
+ "@antv/g-plugin-canvas-renderer": "^1.7.37",
38
+ "@antv/g-plugin-dom-interaction": "^1.7.34",
39
+ "@antv/g-plugin-html-renderer": "^1.7.34",
40
+ "@antv/g-plugin-image-loader": "^1.1.35",
41
41
  "@antv/util": "^3.3.1",
42
42
  "@types/offscreencanvas": "^2019.6.4",
43
43
  "tslib": "^2.3.1"
@@ -52,5 +52,5 @@
52
52
  "publishConfig": {
53
53
  "access": "public"
54
54
  },
55
- "gitHead": "a4ea86f17b561d0483129ca2022586fcd9e42b7b"
55
+ "gitHead": "d780322215f8ece20e3a2d8c137c02c0a6b57f84"
56
56
  }