@antv/g-canvas 1.0.12 → 1.0.13

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.
@@ -13,4 +13,4 @@ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
13
13
  OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
14
14
  PERFORMANCE OF THIS SOFTWARE.
15
15
  ***************************************************************************** */
16
- var l=function(t,n){return(l=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var e in n)Object.prototype.hasOwnProperty.call(n,e)&&(t[e]=n[e])})(t,n)};var d=function(){return(d=Object.assign||function(t){for(var n,e=1,r=arguments.length;e<r;e++)for(var o in n=arguments[e])Object.prototype.hasOwnProperty.call(n,o)&&(t[o]=n[o]);return t}).apply(this,arguments)};function p(t,n,e,r){var o,i=arguments.length,a=i<3?n:null===r?r=Object.getOwnPropertyDescriptor(n,e):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,n,e,r);else for(var u=t.length-1;u>=0;u--)(o=t[u])&&(a=(i<3?o(a):i>3?o(n,e,a):o(n,e))||a);return i>3&&a&&Object.defineProperty(n,e,a),a}function v(t,n){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,n)}Object.create;function y(t,n){var e="function"==typeof Symbol&&t[Symbol.iterator];if(!e)return t;var r,o,i=e.call(t),a=[];try{for(;(void 0===n||n-- >0)&&!(r=i.next()).done;)a.push(r.value)}catch(t){o={error:t}}finally{try{r&&!r.done&&(e=i.return)&&e.call(i)}finally{if(o)throw o.error}}return a}function m(t,n,e){if(e||2===arguments.length)for(var r,o=0,i=n.length;o<i;o++)!r&&o in n||(r||(r=Array.prototype.slice.call(n,0,o)),r[o]=n[o]);return t.concat(r||Array.prototype.slice.call(n))}Object.create;var g=e(0),M=e(1),b="ontouchstart"in self,x=!!self.PointerEvent;var P=function(){function t(){}var n;return n=t,t.prototype.apply=function(t){var e=this,r=function(n){t.hooks.pointerMove.call(n)},o=function(n){t.hooks.pointerUp.call(n)},i=function(n){t.hooks.pointerDown.call(n)},a=function(n){t.hooks.pointerOver.call(n)},u=function(n){t.hooks.pointerOut.call(n)},c=function(n){t.hooks.pointerWheel.call(n)};t.hooks.init.tap(n.tag,(function(){var t=e.contextService.getDomElement();x?(self.document.addEventListener("pointermove",r,!0),t.addEventListener("pointerdown",i,!0),t.addEventListener("pointerleave",u,!0),t.addEventListener("pointerover",a,!0),self.addEventListener("pointerup",o,!0)):(self.document.addEventListener("mousemove",r,!0),t.addEventListener("mousedown",i,!0),t.addEventListener("mouseout",u,!0),t.addEventListener("mouseover",a,!0),self.addEventListener("mouseup",o,!0)),b&&(t.addEventListener("touchstart",i,!0),t.addEventListener("touchend",o,!0),t.addEventListener("touchmove",r,!0)),t.addEventListener("wheel",c,{passive:!0,capture:!0})})),t.hooks.destroy.tap(n.tag,(function(){var t=e.contextService.getDomElement();x?(self.document.removeEventListener("pointermove",r,!0),t.removeEventListener("pointerdown",i,!0),t.removeEventListener("pointerleave",u,!0),t.removeEventListener("pointerover",a,!0),self.removeEventListener("pointerup",o,!0)):(self.document.removeEventListener("mousemove",r,!0),t.removeEventListener("mousedown",i,!0),t.removeEventListener("mouseout",u,!0),t.removeEventListener("mouseover",a,!0),self.removeEventListener("mouseup",o,!0)),b&&(t.removeEventListener("touchstart",i,!0),t.removeEventListener("touchend",o,!0),t.removeEventListener("touchmove",r,!0)),t.removeEventListener("wheel",c,!0)}))},t.tag="DOMInteractionPlugin",p([Object(M.inject)(g.ContextService),v("design:type",Object)],t.prototype,"contextService",void 0),t=n=p([Object(M.singleton)({contrib:g.RenderingPluginContribution})],t)}(),E=Object(M.Module)((function(t){t(P)})),O=function(){function t(){}return t.prototype.init=function(t){t.load(E,!0)},t.prototype.destroy=function(t){t.remove(P)},t}(),S=e(2),C=e.n(S),A=M.Syringe.defineToken("StyleRendererFactory"),j=M.Syringe.defineToken("StyleRenderer"),w={}.toString,R=function(t,n){return w.call(t)==="[object "+n+"]"},B=function(t){return R(t,"Function")},T=function(t){return null==t},k=function(t){return Array.isArray?Array.isArray(t):R(t,"Array")},L=function(t){var n=typeof t;return null!==t&&"object"===n||"function"===n};var D=function(t,n){if(t)if(k(t))for(var e=0,r=t.length;e<r&&!1!==n(t[e],e);e++);else if(L(t))for(var o in t)if(t.hasOwnProperty(o)&&!1===n(t[o],o))break};Object.keys;var _=function(t){if(k(t))return t.reduce((function(t,n){return Math.max(t,n)}),t[0])},Y=function(t){if(k(t))return t.reduce((function(t,n){return Math.min(t,n)}),t[0])},I=Array.prototype,N=(I.splice,I.indexOf,Array.prototype.splice,function(t){return R(t,"String")});Object.prototype.hasOwnProperty;var q=function(t){return R(t,"Number")};Number.isInteger&&Number.isInteger;Math.PI,parseInt,Math.PI;var X=Object.values?function(t){return Object.values(t)}:function(t){var n=[];return D(t,(function(e,r){B(t)&&"prototype"===r||n.push(e)})),n};Object.prototype;Object.prototype.hasOwnProperty;var H;Object.prototype.hasOwnProperty;(function(t,n){if(!B(t))throw new TypeError("Expected a function");var e=function(){for(var r=[],o=0;o<arguments.length;o++)r[o]=arguments[o];var i=n?n.apply(this,r):r[0],a=e.cache;if(a.has(i))return a.get(i);var u=t.apply(this,r);return a.set(i,u),u};e.cache=new Map})((function(t,n){void 0===n&&(n={});var e=n.fontSize,r=n.fontFamily,o=n.fontWeight,i=n.fontStyle,a=n.fontVariant;return H||(H=document.createElement("canvas").getContext("2d")),H.font=[i,a,o,e+"px",r].join(" "),H.measureText(N(t)?t:"").width}),(function(t,n){return void 0===n&&(n={}),function(){for(var t=0,n=0,e=arguments.length;n<e;n++)t+=arguments[n].length;var r=Array(t),o=0;for(n=0;n<e;n++)for(var i=arguments[n],a=0,u=i.length;a<u;a++,o++)r[o]=i[a];return r}([t],X(n)).join("")})),function(){function t(){this.map={}}t.prototype.has=function(t){return void 0!==this.map[t]},t.prototype.get=function(t,n){var e=this.map[t];return void 0===e?n:e},t.prototype.set=function(t,n){this.map[t]=n},t.prototype.clear=function(){this.map={}},t.prototype.delete=function(t){delete this.map[t]},t.prototype.size=function(){return Object.keys(this.map).length}}();var F=function(){function t(){}return t.prototype.hash=function(t){t.fill,t.opacity,t.fillOpacity,t.stroke,t.strokeOpacity,t.lineWidth,t.lineCap,t.lineJoin;return""},t.prototype.render=function(t,n){var e=n.fill,r=n.opacity,o=n.fillOpacity,i=n.stroke,a=n.strokeOpacity,u=n.lineWidth,c=n.lineCap,s=n.lineJoin,f=n.shadowColor,h=n.filter;if(T(e)||(T(o)||1===o?t.fill():(t.globalAlpha=o,t.fill(),t.globalAlpha=r)),!T(i)&&u&&u>0){!T(a)&&1!==a&&(t.globalAlpha=a),t.lineWidth=u,T(c)||(t.lineCap=c),T(s)||(t.lineJoin=s);var l=void 0,d=void 0,p=void 0,v=!T(f),y=!T(h);v&&(l=t.shadowBlur,d=t.shadowColor,T(l)||(t.shadowColor="transparent",t.shadowBlur=0)),y&&(p=t.filter,!T(p)&&p.indexOf("drop-shadow")>-1&&(t.filter=p.replace(/drop-shadow\([^)]*\)/,"").trim()||"none")),t.stroke(),v&&(t.shadowColor=d,t.shadowBlur=l),y&&(t.filter=p)}},t=p([Object(M.singleton)({token:[{token:j,named:g.SHAPE.Circle},{token:j,named:g.SHAPE.Ellipse},{token:j,named:g.SHAPE.Rect},{token:j,named:g.SHAPE.Line},{token:j,named:g.SHAPE.Polyline},{token:j,named:g.SHAPE.Polygon},{token:j,named:g.SHAPE.Path}]})],t)}(),G=function(){function t(){this.imageCache={},this.patternCache={}}return t.prototype.getImageSync=function(t){return this.imageCache[t]},t.prototype.getOrCreateImage=function(t){var n=this;return this.imageCache[t]?Promise.resolve(this.imageCache[t]):new Promise((function(e,r){var o=new window.Image;o.onload=function(){e(o)},o.onerror=function(t){r(t)},o.crossOrigin="Anonymous",o.src=t,n.imageCache[t]=o}))},t.prototype.getPatternSync=function(t){var n=this.generatePatternKey(t);if(this.patternCache[n])return this.patternCache[n]},t.prototype.createPattern=function(t,n){var e=this;return this.getOrCreateImage(t.src).then((function(r){var o=e.generatePatternKey(t),i=n.createPattern(r,t.repetition);return i&&(e.patternCache[o]=i),e.patternCache[o]}))},t.prototype.generatePatternKey=function(t){return"pattern-"+t.src+"-"+t.repetition},t=p([Object(M.singleton)()],t)}(),$=function(){function t(){}return t.prototype.hash=function(t){return""},t.prototype.render=function(t,n){var e,r=n.width,o=void 0===r?0:r,i=n.height,a=void 0===i?0:i,u=n.img,c=o,s=a;N(u)?e=this.imagePool.getImageSync(u):(c||(c=u.width),s||(s=u.height),e=u),t.drawImage(e,0,0,c,s)},p([Object(M.inject)(G),v("design:type",G)],t.prototype,"imagePool",void 0),t=p([Object(M.singleton)({token:{token:j,named:g.SHAPE.Image}})],t)}(),V=function(){function t(){}return t.prototype.hash=function(t){return""},t.prototype.render=function(t,n){n.text;var e=n.lineWidth,r=void 0===e?0:e,o=n.textAlign,i=n.textBaseline,a=n.lineJoin,u=n.miterLimit,c=void 0===u?0:u,s=n.padding,f=void 0===s?0:s,h=n.letterSpacing,l=void 0===h?0:h,d=n.stroke,p=n.fill,v=n.fillOpacity,y=n.strokeOpacity,m=n.opacity,g=n.metrics,M=g.font,b=g.lines,x=g.height,P=g.lineHeight,E=g.lineMetrics;t.font=M,t.lineWidth=r,t.textAlign=o,t.textBaseline=i,t.lineJoin=a,t.miterLimit=c;var O=0;"middle"===i?O=-x/2-P/2:"bottom"===i||"alphabetic"===i||"ideographic"===i?O=-x:"top"!==i&&"hanging"!==i||(O=-P);for(var S=0;S<b.length;S++){var C=r/2;O+=P,!T(d)&&r&&this.drawLetterSpacing(t,b[S],E[S],o,C+f,O+f,l,v,y,m,!0),T(p)||this.drawLetterSpacing(t,b[S],E[S],o,C+f,O+f,l,v,y,m)}},t.prototype.drawLetterSpacing=function(t,n,e,r,o,i,a,u,c,s,f){if(void 0===f&&(f=!1),0!==a){var h=t.textAlign;t.textAlign="left";var l=o;"center"===r?l=o-e.width/2:"right"!==r&&"end"!==r||(l=o-e.width);for(var d=Array.from(n),p=t.measureText(n).width,v=0,y=0;y<d.length;++y){var m=d[y];f?this.strokeText(t,m,l,i,c):this.fillText(t,m,l,i,u,s),l+=p-(v=t.measureText(n.substring(y+1)).width)+a,p=v}t.textAlign=h}else f?this.strokeText(t,n,o,i,c):this.fillText(t,n,o,i,u,s)},t.prototype.fillText=function(t,n,e,r,o,i){var a,u=!T(o)&&1!==o;u&&(a=t.globalAlpha,t.globalAlpha=o*i),t.fillText(n,e,r),u&&(t.globalAlpha=a)},t.prototype.strokeText=function(t,n,e,r,o){var i,a=!T(o)&&1!==o;a&&(i=t.globalAlpha,t.globalAlpha=o),t.strokeText(n,e,r),a&&(t.globalAlpha=i)},p([Object(M.inject)(g.TextService),v("design:type",g.TextService)],t.prototype,"textService",void 0),t=p([Object(M.singleton)({token:{token:j,named:g.SHAPE.Text}})],t)}(),U=function(){function t(){this.gradientCache={}}return t.prototype.getOrCreateGradient=function(t,n){var e=this.generateCacheKey(t),r=t.type,o=t.x0,i=t.y0,a=t.x1,u=t.y1,c=t.steps,s=t.width,f=t.height;if(this.gradientCache[e])return this.gradientCache[e];var h=null;if(r===g.PARSED_COLOR_TYPE.LinearGradient)h=n.createLinearGradient(o*s,i*f,a*s,u*f);else if(r===g.PARSED_COLOR_TYPE.RadialGradient){var l=Math.sqrt(s*s+f*f)/2;h=n.createRadialGradient(o*s,i*f,0,a*s,u*f,t.r1*l)}return h&&(c.forEach((function(t){var n=y(t,2),e=n[0],r=n[1];null==h||h.addColorStop(Number(e),r)})),this.gradientCache[e]=h),this.gradientCache[e]},t.prototype.generateCacheKey=function(t){var n=t.type,e=t.x0,r=t.y0,o=t.x1,i=t.y1,a=t.r1,u=t.steps;return"gradient-"+n+"-"+e+"-"+r+"-"+o+"-"+i+"-"+(a||0)+"-"+t.width+"-"+t.height+"-"+u.map((function(t){return t.join("")})).join("-")},t=p([Object(M.singleton)()],t)}();var W="PathGeneratorFactory",z="PathGenerator",Q=1e-6,Z="undefined"!=typeof Float32Array?Float32Array:Array,J=Math.random;Math.PI;function K(){var t=new Z(9);return Z!=Float32Array&&(t[1]=0,t[2]=0,t[3]=0,t[5]=0,t[6]=0,t[7]=0),t[0]=1,t[4]=1,t[8]=1,t}function tt(t,n){return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[4],t[4]=n[5],t[5]=n[6],t[6]=n[8],t[7]=n[9],t[8]=n[10],t}function nt(t){var n=new Z(9);return n[0]=t[0],n[1]=t[1],n[2]=t[2],n[3]=t[3],n[4]=t[4],n[5]=t[5],n[6]=t[6],n[7]=t[7],n[8]=t[8],n}function et(t,n){return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],t}function rt(t,n,e,r,o,i,a,u,c){var s=new Z(9);return s[0]=t,s[1]=n,s[2]=e,s[3]=r,s[4]=o,s[5]=i,s[6]=a,s[7]=u,s[8]=c,s}function ot(t,n,e,r,o,i,a,u,c,s){return t[0]=n,t[1]=e,t[2]=r,t[3]=o,t[4]=i,t[5]=a,t[6]=u,t[7]=c,t[8]=s,t}function it(t){return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=1,t[5]=0,t[6]=0,t[7]=0,t[8]=1,t}function at(t,n){if(t===n){var e=n[1],r=n[2],o=n[5];t[1]=n[3],t[2]=n[6],t[3]=e,t[5]=n[7],t[6]=r,t[7]=o}else t[0]=n[0],t[1]=n[3],t[2]=n[6],t[3]=n[1],t[4]=n[4],t[5]=n[7],t[6]=n[2],t[7]=n[5],t[8]=n[8];return t}function ut(t,n){var e=n[0],r=n[1],o=n[2],i=n[3],a=n[4],u=n[5],c=n[6],s=n[7],f=n[8],h=f*a-u*s,l=-f*i+u*c,d=s*i-a*c,p=e*h+r*l+o*d;return p?(p=1/p,t[0]=h*p,t[1]=(-f*r+o*s)*p,t[2]=(u*r-o*a)*p,t[3]=l*p,t[4]=(f*e-o*c)*p,t[5]=(-u*e+o*i)*p,t[6]=d*p,t[7]=(-s*e+r*c)*p,t[8]=(a*e-r*i)*p,t):null}function ct(t,n){var e=n[0],r=n[1],o=n[2],i=n[3],a=n[4],u=n[5],c=n[6],s=n[7],f=n[8];return t[0]=a*f-u*s,t[1]=o*s-r*f,t[2]=r*u-o*a,t[3]=u*c-i*f,t[4]=e*f-o*c,t[5]=o*i-e*u,t[6]=i*s-a*c,t[7]=r*c-e*s,t[8]=e*a-r*i,t}function st(t){var n=t[0],e=t[1],r=t[2],o=t[3],i=t[4],a=t[5],u=t[6],c=t[7],s=t[8];return n*(s*i-a*c)+e*(-s*o+a*u)+r*(c*o-i*u)}function ft(t,n,e){var r=n[0],o=n[1],i=n[2],a=n[3],u=n[4],c=n[5],s=n[6],f=n[7],h=n[8],l=e[0],d=e[1],p=e[2],v=e[3],y=e[4],m=e[5],g=e[6],M=e[7],b=e[8];return t[0]=l*r+d*a+p*s,t[1]=l*o+d*u+p*f,t[2]=l*i+d*c+p*h,t[3]=v*r+y*a+m*s,t[4]=v*o+y*u+m*f,t[5]=v*i+y*c+m*h,t[6]=g*r+M*a+b*s,t[7]=g*o+M*u+b*f,t[8]=g*i+M*c+b*h,t}function ht(t,n,e){var r=n[0],o=n[1],i=n[2],a=n[3],u=n[4],c=n[5],s=n[6],f=n[7],h=n[8],l=e[0],d=e[1];return t[0]=r,t[1]=o,t[2]=i,t[3]=a,t[4]=u,t[5]=c,t[6]=l*r+d*a+s,t[7]=l*o+d*u+f,t[8]=l*i+d*c+h,t}function lt(t,n,e){var r=n[0],o=n[1],i=n[2],a=n[3],u=n[4],c=n[5],s=n[6],f=n[7],h=n[8],l=Math.sin(e),d=Math.cos(e);return t[0]=d*r+l*a,t[1]=d*o+l*u,t[2]=d*i+l*c,t[3]=d*a-l*r,t[4]=d*u-l*o,t[5]=d*c-l*i,t[6]=s,t[7]=f,t[8]=h,t}function dt(t,n,e){var r=e[0],o=e[1];return t[0]=r*n[0],t[1]=r*n[1],t[2]=r*n[2],t[3]=o*n[3],t[4]=o*n[4],t[5]=o*n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],t}function pt(t,n){return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=1,t[5]=0,t[6]=n[0],t[7]=n[1],t[8]=1,t}function vt(t,n){var e=Math.sin(n),r=Math.cos(n);return t[0]=r,t[1]=e,t[2]=0,t[3]=-e,t[4]=r,t[5]=0,t[6]=0,t[7]=0,t[8]=1,t}function yt(t,n){return t[0]=n[0],t[1]=0,t[2]=0,t[3]=0,t[4]=n[1],t[5]=0,t[6]=0,t[7]=0,t[8]=1,t}function mt(t,n){return t[0]=n[0],t[1]=n[1],t[2]=0,t[3]=n[2],t[4]=n[3],t[5]=0,t[6]=n[4],t[7]=n[5],t[8]=1,t}function gt(t,n){var e=n[0],r=n[1],o=n[2],i=n[3],a=e+e,u=r+r,c=o+o,s=e*a,f=r*a,h=r*u,l=o*a,d=o*u,p=o*c,v=i*a,y=i*u,m=i*c;return t[0]=1-h-p,t[3]=f-m,t[6]=l+y,t[1]=f+m,t[4]=1-s-p,t[7]=d-v,t[2]=l-y,t[5]=d+v,t[8]=1-s-h,t}function Mt(t,n){var e=n[0],r=n[1],o=n[2],i=n[3],a=n[4],u=n[5],c=n[6],s=n[7],f=n[8],h=n[9],l=n[10],d=n[11],p=n[12],v=n[13],y=n[14],m=n[15],g=e*u-r*a,M=e*c-o*a,b=e*s-i*a,x=r*c-o*u,P=r*s-i*u,E=o*s-i*c,O=f*v-h*p,S=f*y-l*p,C=f*m-d*p,A=h*y-l*v,j=h*m-d*v,w=l*m-d*y,R=g*w-M*j+b*A+x*C-P*S+E*O;return R?(R=1/R,t[0]=(u*w-c*j+s*A)*R,t[1]=(c*C-a*w-s*S)*R,t[2]=(a*j-u*C+s*O)*R,t[3]=(o*j-r*w-i*A)*R,t[4]=(e*w-o*C+i*S)*R,t[5]=(r*C-e*j-i*O)*R,t[6]=(v*E-y*P+m*x)*R,t[7]=(y*b-p*E-m*M)*R,t[8]=(p*P-v*b+m*g)*R,t):null}function bt(t,n,e){return t[0]=2/n,t[1]=0,t[2]=0,t[3]=0,t[4]=-2/e,t[5]=0,t[6]=-1,t[7]=1,t[8]=1,t}function xt(t){return"mat3("+t[0]+", "+t[1]+", "+t[2]+", "+t[3]+", "+t[4]+", "+t[5]+", "+t[6]+", "+t[7]+", "+t[8]+")"}function Pt(t){return Math.hypot(t[0],t[1],t[2],t[3],t[4],t[5],t[6],t[7],t[8])}function Et(t,n,e){return t[0]=n[0]+e[0],t[1]=n[1]+e[1],t[2]=n[2]+e[2],t[3]=n[3]+e[3],t[4]=n[4]+e[4],t[5]=n[5]+e[5],t[6]=n[6]+e[6],t[7]=n[7]+e[7],t[8]=n[8]+e[8],t}function Ot(t,n,e){return t[0]=n[0]-e[0],t[1]=n[1]-e[1],t[2]=n[2]-e[2],t[3]=n[3]-e[3],t[4]=n[4]-e[4],t[5]=n[5]-e[5],t[6]=n[6]-e[6],t[7]=n[7]-e[7],t[8]=n[8]-e[8],t}function St(t,n,e){return t[0]=n[0]*e,t[1]=n[1]*e,t[2]=n[2]*e,t[3]=n[3]*e,t[4]=n[4]*e,t[5]=n[5]*e,t[6]=n[6]*e,t[7]=n[7]*e,t[8]=n[8]*e,t}function Ct(t,n,e,r){return t[0]=n[0]+e[0]*r,t[1]=n[1]+e[1]*r,t[2]=n[2]+e[2]*r,t[3]=n[3]+e[3]*r,t[4]=n[4]+e[4]*r,t[5]=n[5]+e[5]*r,t[6]=n[6]+e[6]*r,t[7]=n[7]+e[7]*r,t[8]=n[8]+e[8]*r,t}function At(t,n){return t[0]===n[0]&&t[1]===n[1]&&t[2]===n[2]&&t[3]===n[3]&&t[4]===n[4]&&t[5]===n[5]&&t[6]===n[6]&&t[7]===n[7]&&t[8]===n[8]}function jt(t,n){var e=t[0],r=t[1],o=t[2],i=t[3],a=t[4],u=t[5],c=t[6],s=t[7],f=t[8],h=n[0],l=n[1],d=n[2],p=n[3],v=n[4],y=n[5],m=n[6],g=n[7],M=n[8];return Math.abs(e-h)<=Q*Math.max(1,Math.abs(e),Math.abs(h))&&Math.abs(r-l)<=Q*Math.max(1,Math.abs(r),Math.abs(l))&&Math.abs(o-d)<=Q*Math.max(1,Math.abs(o),Math.abs(d))&&Math.abs(i-p)<=Q*Math.max(1,Math.abs(i),Math.abs(p))&&Math.abs(a-v)<=Q*Math.max(1,Math.abs(a),Math.abs(v))&&Math.abs(u-y)<=Q*Math.max(1,Math.abs(u),Math.abs(y))&&Math.abs(c-m)<=Q*Math.max(1,Math.abs(c),Math.abs(m))&&Math.abs(s-g)<=Q*Math.max(1,Math.abs(s),Math.abs(g))&&Math.abs(f-M)<=Q*Math.max(1,Math.abs(f),Math.abs(M))}Math.hypot||(Math.hypot=function(){for(var t=0,n=arguments.length;n--;)t+=arguments[n]*arguments[n];return Math.sqrt(t)});var wt=ft,Rt=Ot;function Bt(){var t=new Z(16);return Z!=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 Tt(t){var n=new Z(16);return n[0]=t[0],n[1]=t[1],n[2]=t[2],n[3]=t[3],n[4]=t[4],n[5]=t[5],n[6]=t[6],n[7]=t[7],n[8]=t[8],n[9]=t[9],n[10]=t[10],n[11]=t[11],n[12]=t[12],n[13]=t[13],n[14]=t[14],n[15]=t[15],n}function kt(t,n){return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],t[9]=n[9],t[10]=n[10],t[11]=n[11],t[12]=n[12],t[13]=n[13],t[14]=n[14],t[15]=n[15],t}function Lt(t,n,e,r,o,i,a,u,c,s,f,h,l,d,p,v){var y=new Z(16);return y[0]=t,y[1]=n,y[2]=e,y[3]=r,y[4]=o,y[5]=i,y[6]=a,y[7]=u,y[8]=c,y[9]=s,y[10]=f,y[11]=h,y[12]=l,y[13]=d,y[14]=p,y[15]=v,y}function Dt(t,n,e,r,o,i,a,u,c,s,f,h,l,d,p,v,y){return t[0]=n,t[1]=e,t[2]=r,t[3]=o,t[4]=i,t[5]=a,t[6]=u,t[7]=c,t[8]=s,t[9]=f,t[10]=h,t[11]=l,t[12]=d,t[13]=p,t[14]=v,t[15]=y,t}function _t(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}function Yt(t,n){if(t===n){var e=n[1],r=n[2],o=n[3],i=n[6],a=n[7],u=n[11];t[1]=n[4],t[2]=n[8],t[3]=n[12],t[4]=e,t[6]=n[9],t[7]=n[13],t[8]=r,t[9]=i,t[11]=n[14],t[12]=o,t[13]=a,t[14]=u}else t[0]=n[0],t[1]=n[4],t[2]=n[8],t[3]=n[12],t[4]=n[1],t[5]=n[5],t[6]=n[9],t[7]=n[13],t[8]=n[2],t[9]=n[6],t[10]=n[10],t[11]=n[14],t[12]=n[3],t[13]=n[7],t[14]=n[11],t[15]=n[15];return t}function It(t,n){var e=n[0],r=n[1],o=n[2],i=n[3],a=n[4],u=n[5],c=n[6],s=n[7],f=n[8],h=n[9],l=n[10],d=n[11],p=n[12],v=n[13],y=n[14],m=n[15],g=e*u-r*a,M=e*c-o*a,b=e*s-i*a,x=r*c-o*u,P=r*s-i*u,E=o*s-i*c,O=f*v-h*p,S=f*y-l*p,C=f*m-d*p,A=h*y-l*v,j=h*m-d*v,w=l*m-d*y,R=g*w-M*j+b*A+x*C-P*S+E*O;return R?(R=1/R,t[0]=(u*w-c*j+s*A)*R,t[1]=(o*j-r*w-i*A)*R,t[2]=(v*E-y*P+m*x)*R,t[3]=(l*P-h*E-d*x)*R,t[4]=(c*C-a*w-s*S)*R,t[5]=(e*w-o*C+i*S)*R,t[6]=(y*b-p*E-m*M)*R,t[7]=(f*E-l*b+d*M)*R,t[8]=(a*j-u*C+s*O)*R,t[9]=(r*C-e*j-i*O)*R,t[10]=(p*P-v*b+m*g)*R,t[11]=(h*b-f*P-d*g)*R,t[12]=(u*S-a*A-c*O)*R,t[13]=(e*A-r*S+o*O)*R,t[14]=(v*M-p*x-y*g)*R,t[15]=(f*x-h*M+l*g)*R,t):null}function Nt(t,n){var e=n[0],r=n[1],o=n[2],i=n[3],a=n[4],u=n[5],c=n[6],s=n[7],f=n[8],h=n[9],l=n[10],d=n[11],p=n[12],v=n[13],y=n[14],m=n[15];return t[0]=u*(l*m-d*y)-h*(c*m-s*y)+v*(c*d-s*l),t[1]=-(r*(l*m-d*y)-h*(o*m-i*y)+v*(o*d-i*l)),t[2]=r*(c*m-s*y)-u*(o*m-i*y)+v*(o*s-i*c),t[3]=-(r*(c*d-s*l)-u*(o*d-i*l)+h*(o*s-i*c)),t[4]=-(a*(l*m-d*y)-f*(c*m-s*y)+p*(c*d-s*l)),t[5]=e*(l*m-d*y)-f*(o*m-i*y)+p*(o*d-i*l),t[6]=-(e*(c*m-s*y)-a*(o*m-i*y)+p*(o*s-i*c)),t[7]=e*(c*d-s*l)-a*(o*d-i*l)+f*(o*s-i*c),t[8]=a*(h*m-d*v)-f*(u*m-s*v)+p*(u*d-s*h),t[9]=-(e*(h*m-d*v)-f*(r*m-i*v)+p*(r*d-i*h)),t[10]=e*(u*m-s*v)-a*(r*m-i*v)+p*(r*s-i*u),t[11]=-(e*(u*d-s*h)-a*(r*d-i*h)+f*(r*s-i*u)),t[12]=-(a*(h*y-l*v)-f*(u*y-c*v)+p*(u*l-c*h)),t[13]=e*(h*y-l*v)-f*(r*y-o*v)+p*(r*l-o*h),t[14]=-(e*(u*y-c*v)-a*(r*y-o*v)+p*(r*c-o*u)),t[15]=e*(u*l-c*h)-a*(r*l-o*h)+f*(r*c-o*u),t}function qt(t){var n=t[0],e=t[1],r=t[2],o=t[3],i=t[4],a=t[5],u=t[6],c=t[7],s=t[8],f=t[9],h=t[10],l=t[11],d=t[12],p=t[13],v=t[14],y=t[15];return(n*a-e*i)*(h*y-l*v)-(n*u-r*i)*(f*y-l*p)+(n*c-o*i)*(f*v-h*p)+(e*u-r*a)*(s*y-l*d)-(e*c-o*a)*(s*v-h*d)+(r*c-o*u)*(s*p-f*d)}function Xt(t,n,e){var r=n[0],o=n[1],i=n[2],a=n[3],u=n[4],c=n[5],s=n[6],f=n[7],h=n[8],l=n[9],d=n[10],p=n[11],v=n[12],y=n[13],m=n[14],g=n[15],M=e[0],b=e[1],x=e[2],P=e[3];return t[0]=M*r+b*u+x*h+P*v,t[1]=M*o+b*c+x*l+P*y,t[2]=M*i+b*s+x*d+P*m,t[3]=M*a+b*f+x*p+P*g,M=e[4],b=e[5],x=e[6],P=e[7],t[4]=M*r+b*u+x*h+P*v,t[5]=M*o+b*c+x*l+P*y,t[6]=M*i+b*s+x*d+P*m,t[7]=M*a+b*f+x*p+P*g,M=e[8],b=e[9],x=e[10],P=e[11],t[8]=M*r+b*u+x*h+P*v,t[9]=M*o+b*c+x*l+P*y,t[10]=M*i+b*s+x*d+P*m,t[11]=M*a+b*f+x*p+P*g,M=e[12],b=e[13],x=e[14],P=e[15],t[12]=M*r+b*u+x*h+P*v,t[13]=M*o+b*c+x*l+P*y,t[14]=M*i+b*s+x*d+P*m,t[15]=M*a+b*f+x*p+P*g,t}function Ht(t,n,e){var r,o,i,a,u,c,s,f,h,l,d,p,v=e[0],y=e[1],m=e[2];return n===t?(t[12]=n[0]*v+n[4]*y+n[8]*m+n[12],t[13]=n[1]*v+n[5]*y+n[9]*m+n[13],t[14]=n[2]*v+n[6]*y+n[10]*m+n[14],t[15]=n[3]*v+n[7]*y+n[11]*m+n[15]):(r=n[0],o=n[1],i=n[2],a=n[3],u=n[4],c=n[5],s=n[6],f=n[7],h=n[8],l=n[9],d=n[10],p=n[11],t[0]=r,t[1]=o,t[2]=i,t[3]=a,t[4]=u,t[5]=c,t[6]=s,t[7]=f,t[8]=h,t[9]=l,t[10]=d,t[11]=p,t[12]=r*v+u*y+h*m+n[12],t[13]=o*v+c*y+l*m+n[13],t[14]=i*v+s*y+d*m+n[14],t[15]=a*v+f*y+p*m+n[15]),t}function Ft(t,n,e){var r=e[0],o=e[1],i=e[2];return t[0]=n[0]*r,t[1]=n[1]*r,t[2]=n[2]*r,t[3]=n[3]*r,t[4]=n[4]*o,t[5]=n[5]*o,t[6]=n[6]*o,t[7]=n[7]*o,t[8]=n[8]*i,t[9]=n[9]*i,t[10]=n[10]*i,t[11]=n[11]*i,t[12]=n[12],t[13]=n[13],t[14]=n[14],t[15]=n[15],t}function Gt(t,n,e,r){var o,i,a,u,c,s,f,h,l,d,p,v,y,m,g,M,b,x,P,E,O,S,C,A,j=r[0],w=r[1],R=r[2],B=Math.hypot(j,w,R);return B<Q?null:(j*=B=1/B,w*=B,R*=B,o=Math.sin(e),a=1-(i=Math.cos(e)),u=n[0],c=n[1],s=n[2],f=n[3],h=n[4],l=n[5],d=n[6],p=n[7],v=n[8],y=n[9],m=n[10],g=n[11],M=j*j*a+i,b=w*j*a+R*o,x=R*j*a-w*o,P=j*w*a-R*o,E=w*w*a+i,O=R*w*a+j*o,S=j*R*a+w*o,C=w*R*a-j*o,A=R*R*a+i,t[0]=u*M+h*b+v*x,t[1]=c*M+l*b+y*x,t[2]=s*M+d*b+m*x,t[3]=f*M+p*b+g*x,t[4]=u*P+h*E+v*O,t[5]=c*P+l*E+y*O,t[6]=s*P+d*E+m*O,t[7]=f*P+p*E+g*O,t[8]=u*S+h*C+v*A,t[9]=c*S+l*C+y*A,t[10]=s*S+d*C+m*A,t[11]=f*S+p*C+g*A,n!==t&&(t[12]=n[12],t[13]=n[13],t[14]=n[14],t[15]=n[15]),t)}function $t(t,n,e){var r=Math.sin(e),o=Math.cos(e),i=n[4],a=n[5],u=n[6],c=n[7],s=n[8],f=n[9],h=n[10],l=n[11];return n!==t&&(t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[12]=n[12],t[13]=n[13],t[14]=n[14],t[15]=n[15]),t[4]=i*o+s*r,t[5]=a*o+f*r,t[6]=u*o+h*r,t[7]=c*o+l*r,t[8]=s*o-i*r,t[9]=f*o-a*r,t[10]=h*o-u*r,t[11]=l*o-c*r,t}function Vt(t,n,e){var r=Math.sin(e),o=Math.cos(e),i=n[0],a=n[1],u=n[2],c=n[3],s=n[8],f=n[9],h=n[10],l=n[11];return n!==t&&(t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[12]=n[12],t[13]=n[13],t[14]=n[14],t[15]=n[15]),t[0]=i*o-s*r,t[1]=a*o-f*r,t[2]=u*o-h*r,t[3]=c*o-l*r,t[8]=i*r+s*o,t[9]=a*r+f*o,t[10]=u*r+h*o,t[11]=c*r+l*o,t}function Ut(t,n,e){var r=Math.sin(e),o=Math.cos(e),i=n[0],a=n[1],u=n[2],c=n[3],s=n[4],f=n[5],h=n[6],l=n[7];return n!==t&&(t[8]=n[8],t[9]=n[9],t[10]=n[10],t[11]=n[11],t[12]=n[12],t[13]=n[13],t[14]=n[14],t[15]=n[15]),t[0]=i*o+s*r,t[1]=a*o+f*r,t[2]=u*o+h*r,t[3]=c*o+l*r,t[4]=s*o-i*r,t[5]=f*o-a*r,t[6]=h*o-u*r,t[7]=l*o-c*r,t}function Wt(t,n){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]=n[0],t[13]=n[1],t[14]=n[2],t[15]=1,t}function zt(t,n){return t[0]=n[0],t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=n[1],t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=n[2],t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}function Qt(t,n,e){var r,o,i,a=e[0],u=e[1],c=e[2],s=Math.hypot(a,u,c);return s<Q?null:(a*=s=1/s,u*=s,c*=s,r=Math.sin(n),i=1-(o=Math.cos(n)),t[0]=a*a*i+o,t[1]=u*a*i+c*r,t[2]=c*a*i-u*r,t[3]=0,t[4]=a*u*i-c*r,t[5]=u*u*i+o,t[6]=c*u*i+a*r,t[7]=0,t[8]=a*c*i+u*r,t[9]=u*c*i-a*r,t[10]=c*c*i+o,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t)}function Zt(t,n){var e=Math.sin(n),r=Math.cos(n);return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=r,t[6]=e,t[7]=0,t[8]=0,t[9]=-e,t[10]=r,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}function Jt(t,n){var e=Math.sin(n),r=Math.cos(n);return t[0]=r,t[1]=0,t[2]=-e,t[3]=0,t[4]=0,t[5]=1,t[6]=0,t[7]=0,t[8]=e,t[9]=0,t[10]=r,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}function Kt(t,n){var e=Math.sin(n),r=Math.cos(n);return t[0]=r,t[1]=e,t[2]=0,t[3]=0,t[4]=-e,t[5]=r,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}function tn(t,n,e){var r=n[0],o=n[1],i=n[2],a=n[3],u=r+r,c=o+o,s=i+i,f=r*u,h=r*c,l=r*s,d=o*c,p=o*s,v=i*s,y=a*u,m=a*c,g=a*s;return t[0]=1-(d+v),t[1]=h+g,t[2]=l-m,t[3]=0,t[4]=h-g,t[5]=1-(f+v),t[6]=p+y,t[7]=0,t[8]=l+m,t[9]=p-y,t[10]=1-(f+d),t[11]=0,t[12]=e[0],t[13]=e[1],t[14]=e[2],t[15]=1,t}function nn(t,n){var e=new Z(3),r=-n[0],o=-n[1],i=-n[2],a=n[3],u=n[4],c=n[5],s=n[6],f=n[7],h=r*r+o*o+i*i+a*a;return h>0?(e[0]=2*(u*a+f*r+c*i-s*o)/h,e[1]=2*(c*a+f*o+s*r-u*i)/h,e[2]=2*(s*a+f*i+u*o-c*r)/h):(e[0]=2*(u*a+f*r+c*i-s*o),e[1]=2*(c*a+f*o+s*r-u*i),e[2]=2*(s*a+f*i+u*o-c*r)),tn(t,n,e),t}function en(t,n){return t[0]=n[12],t[1]=n[13],t[2]=n[14],t}function rn(t,n){var e=n[0],r=n[1],o=n[2],i=n[4],a=n[5],u=n[6],c=n[8],s=n[9],f=n[10];return t[0]=Math.hypot(e,r,o),t[1]=Math.hypot(i,a,u),t[2]=Math.hypot(c,s,f),t}function on(t,n){var e=new Z(3);rn(e,n);var r=1/e[0],o=1/e[1],i=1/e[2],a=n[0]*r,u=n[1]*o,c=n[2]*i,s=n[4]*r,f=n[5]*o,h=n[6]*i,l=n[8]*r,d=n[9]*o,p=n[10]*i,v=a+f+p,y=0;return v>0?(y=2*Math.sqrt(v+1),t[3]=.25*y,t[0]=(h-d)/y,t[1]=(l-c)/y,t[2]=(u-s)/y):a>f&&a>p?(y=2*Math.sqrt(1+a-f-p),t[3]=(h-d)/y,t[0]=.25*y,t[1]=(u+s)/y,t[2]=(l+c)/y):f>p?(y=2*Math.sqrt(1+f-a-p),t[3]=(l-c)/y,t[0]=(u+s)/y,t[1]=.25*y,t[2]=(h+d)/y):(y=2*Math.sqrt(1+p-a-f),t[3]=(u-s)/y,t[0]=(l+c)/y,t[1]=(h+d)/y,t[2]=.25*y),t}function an(t,n,e,r){var o=n[0],i=n[1],a=n[2],u=n[3],c=o+o,s=i+i,f=a+a,h=o*c,l=o*s,d=o*f,p=i*s,v=i*f,y=a*f,m=u*c,g=u*s,M=u*f,b=r[0],x=r[1],P=r[2];return t[0]=(1-(p+y))*b,t[1]=(l+M)*b,t[2]=(d-g)*b,t[3]=0,t[4]=(l-M)*x,t[5]=(1-(h+y))*x,t[6]=(v+m)*x,t[7]=0,t[8]=(d+g)*P,t[9]=(v-m)*P,t[10]=(1-(h+p))*P,t[11]=0,t[12]=e[0],t[13]=e[1],t[14]=e[2],t[15]=1,t}function un(t,n,e,r,o){var i=n[0],a=n[1],u=n[2],c=n[3],s=i+i,f=a+a,h=u+u,l=i*s,d=i*f,p=i*h,v=a*f,y=a*h,m=u*h,g=c*s,M=c*f,b=c*h,x=r[0],P=r[1],E=r[2],O=o[0],S=o[1],C=o[2],A=(1-(v+m))*x,j=(d+b)*x,w=(p-M)*x,R=(d-b)*P,B=(1-(l+m))*P,T=(y+g)*P,k=(p+M)*E,L=(y-g)*E,D=(1-(l+v))*E;return t[0]=A,t[1]=j,t[2]=w,t[3]=0,t[4]=R,t[5]=B,t[6]=T,t[7]=0,t[8]=k,t[9]=L,t[10]=D,t[11]=0,t[12]=e[0]+O-(A*O+R*S+k*C),t[13]=e[1]+S-(j*O+B*S+L*C),t[14]=e[2]+C-(w*O+T*S+D*C),t[15]=1,t}function cn(t,n){var e=n[0],r=n[1],o=n[2],i=n[3],a=e+e,u=r+r,c=o+o,s=e*a,f=r*a,h=r*u,l=o*a,d=o*u,p=o*c,v=i*a,y=i*u,m=i*c;return t[0]=1-h-p,t[1]=f+m,t[2]=l-y,t[3]=0,t[4]=f-m,t[5]=1-s-p,t[6]=d+v,t[7]=0,t[8]=l+y,t[9]=d-v,t[10]=1-s-h,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}function sn(t,n,e,r,o,i,a){var u=1/(e-n),c=1/(o-r),s=1/(i-a);return t[0]=2*i*u,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=2*i*c,t[6]=0,t[7]=0,t[8]=(e+n)*u,t[9]=(o+r)*c,t[10]=(a+i)*s,t[11]=-1,t[12]=0,t[13]=0,t[14]=a*i*2*s,t[15]=0,t}function fn(t,n,e,r,o){var i,a=1/Math.tan(n/2);return t[0]=a/e,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=a,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[11]=-1,t[12]=0,t[13]=0,t[15]=0,null!=o&&o!==1/0?(i=1/(r-o),t[10]=(o+r)*i,t[14]=2*o*r*i):(t[10]=-1,t[14]=-2*r),t}var hn=fn;function ln(t,n,e,r,o){var i,a=1/Math.tan(n/2);return t[0]=a/e,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=a,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[11]=-1,t[12]=0,t[13]=0,t[15]=0,null!=o&&o!==1/0?(i=1/(r-o),t[10]=o*i,t[14]=o*r*i):(t[10]=-1,t[14]=-r),t}function dn(t,n,e,r){var o=Math.tan(n.upDegrees*Math.PI/180),i=Math.tan(n.downDegrees*Math.PI/180),a=Math.tan(n.leftDegrees*Math.PI/180),u=Math.tan(n.rightDegrees*Math.PI/180),c=2/(a+u),s=2/(o+i);return t[0]=c,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=s,t[6]=0,t[7]=0,t[8]=-(a-u)*c*.5,t[9]=(o-i)*s*.5,t[10]=r/(e-r),t[11]=-1,t[12]=0,t[13]=0,t[14]=r*e/(e-r),t[15]=0,t}function pn(t,n,e,r,o,i,a){var u=1/(n-e),c=1/(r-o),s=1/(i-a);return t[0]=-2*u,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=-2*c,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=2*s,t[11]=0,t[12]=(n+e)*u,t[13]=(o+r)*c,t[14]=(a+i)*s,t[15]=1,t}var vn=pn;function yn(t,n,e,r,o,i,a){var u=1/(n-e),c=1/(r-o),s=1/(i-a);return t[0]=-2*u,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=-2*c,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=s,t[11]=0,t[12]=(n+e)*u,t[13]=(o+r)*c,t[14]=i*s,t[15]=1,t}function mn(t,n,e,r){var o,i,a,u,c,s,f,h,l,d,p=n[0],v=n[1],y=n[2],m=r[0],g=r[1],M=r[2],b=e[0],x=e[1],P=e[2];return Math.abs(p-b)<Q&&Math.abs(v-x)<Q&&Math.abs(y-P)<Q?_t(t):(f=p-b,h=v-x,l=y-P,o=g*(l*=d=1/Math.hypot(f,h,l))-M*(h*=d),i=M*(f*=d)-m*l,a=m*h-g*f,(d=Math.hypot(o,i,a))?(o*=d=1/d,i*=d,a*=d):(o=0,i=0,a=0),u=h*a-l*i,c=l*o-f*a,s=f*i-h*o,(d=Math.hypot(u,c,s))?(u*=d=1/d,c*=d,s*=d):(u=0,c=0,s=0),t[0]=o,t[1]=u,t[2]=f,t[3]=0,t[4]=i,t[5]=c,t[6]=h,t[7]=0,t[8]=a,t[9]=s,t[10]=l,t[11]=0,t[12]=-(o*p+i*v+a*y),t[13]=-(u*p+c*v+s*y),t[14]=-(f*p+h*v+l*y),t[15]=1,t)}function gn(t,n,e,r){var o=n[0],i=n[1],a=n[2],u=r[0],c=r[1],s=r[2],f=o-e[0],h=i-e[1],l=a-e[2],d=f*f+h*h+l*l;d>0&&(f*=d=1/Math.sqrt(d),h*=d,l*=d);var p=c*l-s*h,v=s*f-u*l,y=u*h-c*f;return(d=p*p+v*v+y*y)>0&&(p*=d=1/Math.sqrt(d),v*=d,y*=d),t[0]=p,t[1]=v,t[2]=y,t[3]=0,t[4]=h*y-l*v,t[5]=l*p-f*y,t[6]=f*v-h*p,t[7]=0,t[8]=f,t[9]=h,t[10]=l,t[11]=0,t[12]=o,t[13]=i,t[14]=a,t[15]=1,t}function Mn(t){return"mat4("+t[0]+", "+t[1]+", "+t[2]+", "+t[3]+", "+t[4]+", "+t[5]+", "+t[6]+", "+t[7]+", "+t[8]+", "+t[9]+", "+t[10]+", "+t[11]+", "+t[12]+", "+t[13]+", "+t[14]+", "+t[15]+")"}function bn(t){return Math.hypot(t[0],t[1],t[2],t[3],t[4],t[5],t[6],t[7],t[8],t[9],t[10],t[11],t[12],t[13],t[14],t[15])}function xn(t,n,e){return t[0]=n[0]+e[0],t[1]=n[1]+e[1],t[2]=n[2]+e[2],t[3]=n[3]+e[3],t[4]=n[4]+e[4],t[5]=n[5]+e[5],t[6]=n[6]+e[6],t[7]=n[7]+e[7],t[8]=n[8]+e[8],t[9]=n[9]+e[9],t[10]=n[10]+e[10],t[11]=n[11]+e[11],t[12]=n[12]+e[12],t[13]=n[13]+e[13],t[14]=n[14]+e[14],t[15]=n[15]+e[15],t}function Pn(t,n,e){return t[0]=n[0]-e[0],t[1]=n[1]-e[1],t[2]=n[2]-e[2],t[3]=n[3]-e[3],t[4]=n[4]-e[4],t[5]=n[5]-e[5],t[6]=n[6]-e[6],t[7]=n[7]-e[7],t[8]=n[8]-e[8],t[9]=n[9]-e[9],t[10]=n[10]-e[10],t[11]=n[11]-e[11],t[12]=n[12]-e[12],t[13]=n[13]-e[13],t[14]=n[14]-e[14],t[15]=n[15]-e[15],t}function En(t,n,e){return t[0]=n[0]*e,t[1]=n[1]*e,t[2]=n[2]*e,t[3]=n[3]*e,t[4]=n[4]*e,t[5]=n[5]*e,t[6]=n[6]*e,t[7]=n[7]*e,t[8]=n[8]*e,t[9]=n[9]*e,t[10]=n[10]*e,t[11]=n[11]*e,t[12]=n[12]*e,t[13]=n[13]*e,t[14]=n[14]*e,t[15]=n[15]*e,t}function On(t,n,e,r){return t[0]=n[0]+e[0]*r,t[1]=n[1]+e[1]*r,t[2]=n[2]+e[2]*r,t[3]=n[3]+e[3]*r,t[4]=n[4]+e[4]*r,t[5]=n[5]+e[5]*r,t[6]=n[6]+e[6]*r,t[7]=n[7]+e[7]*r,t[8]=n[8]+e[8]*r,t[9]=n[9]+e[9]*r,t[10]=n[10]+e[10]*r,t[11]=n[11]+e[11]*r,t[12]=n[12]+e[12]*r,t[13]=n[13]+e[13]*r,t[14]=n[14]+e[14]*r,t[15]=n[15]+e[15]*r,t}function Sn(t,n){return t[0]===n[0]&&t[1]===n[1]&&t[2]===n[2]&&t[3]===n[3]&&t[4]===n[4]&&t[5]===n[5]&&t[6]===n[6]&&t[7]===n[7]&&t[8]===n[8]&&t[9]===n[9]&&t[10]===n[10]&&t[11]===n[11]&&t[12]===n[12]&&t[13]===n[13]&&t[14]===n[14]&&t[15]===n[15]}function Cn(t,n){var e=t[0],r=t[1],o=t[2],i=t[3],a=t[4],u=t[5],c=t[6],s=t[7],f=t[8],h=t[9],l=t[10],d=t[11],p=t[12],v=t[13],y=t[14],m=t[15],g=n[0],M=n[1],b=n[2],x=n[3],P=n[4],E=n[5],O=n[6],S=n[7],C=n[8],A=n[9],j=n[10],w=n[11],R=n[12],B=n[13],T=n[14],k=n[15];return Math.abs(e-g)<=Q*Math.max(1,Math.abs(e),Math.abs(g))&&Math.abs(r-M)<=Q*Math.max(1,Math.abs(r),Math.abs(M))&&Math.abs(o-b)<=Q*Math.max(1,Math.abs(o),Math.abs(b))&&Math.abs(i-x)<=Q*Math.max(1,Math.abs(i),Math.abs(x))&&Math.abs(a-P)<=Q*Math.max(1,Math.abs(a),Math.abs(P))&&Math.abs(u-E)<=Q*Math.max(1,Math.abs(u),Math.abs(E))&&Math.abs(c-O)<=Q*Math.max(1,Math.abs(c),Math.abs(O))&&Math.abs(s-S)<=Q*Math.max(1,Math.abs(s),Math.abs(S))&&Math.abs(f-C)<=Q*Math.max(1,Math.abs(f),Math.abs(C))&&Math.abs(h-A)<=Q*Math.max(1,Math.abs(h),Math.abs(A))&&Math.abs(l-j)<=Q*Math.max(1,Math.abs(l),Math.abs(j))&&Math.abs(d-w)<=Q*Math.max(1,Math.abs(d),Math.abs(w))&&Math.abs(p-R)<=Q*Math.max(1,Math.abs(p),Math.abs(R))&&Math.abs(v-B)<=Q*Math.max(1,Math.abs(v),Math.abs(B))&&Math.abs(y-T)<=Q*Math.max(1,Math.abs(y),Math.abs(T))&&Math.abs(m-k)<=Q*Math.max(1,Math.abs(m),Math.abs(k))}var An=Xt,jn=Pn;function wn(){var t=new Z(3);return Z!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0),t}function Rn(t){var n=new Z(3);return n[0]=t[0],n[1]=t[1],n[2]=t[2],n}function Bn(t){var n=t[0],e=t[1],r=t[2];return Math.hypot(n,e,r)}function Tn(t,n,e){var r=new Z(3);return r[0]=t,r[1]=n,r[2]=e,r}function kn(t,n){return t[0]=n[0],t[1]=n[1],t[2]=n[2],t}function Ln(t,n,e,r){return t[0]=n,t[1]=e,t[2]=r,t}function Dn(t,n,e){return t[0]=n[0]+e[0],t[1]=n[1]+e[1],t[2]=n[2]+e[2],t}function _n(t,n,e){return t[0]=n[0]-e[0],t[1]=n[1]-e[1],t[2]=n[2]-e[2],t}function Yn(t,n,e){return t[0]=n[0]*e[0],t[1]=n[1]*e[1],t[2]=n[2]*e[2],t}function In(t,n,e){return t[0]=n[0]/e[0],t[1]=n[1]/e[1],t[2]=n[2]/e[2],t}function Nn(t,n){return t[0]=Math.ceil(n[0]),t[1]=Math.ceil(n[1]),t[2]=Math.ceil(n[2]),t}function qn(t,n){return t[0]=Math.floor(n[0]),t[1]=Math.floor(n[1]),t[2]=Math.floor(n[2]),t}function Xn(t,n,e){return t[0]=Math.min(n[0],e[0]),t[1]=Math.min(n[1],e[1]),t[2]=Math.min(n[2],e[2]),t}function Hn(t,n,e){return t[0]=Math.max(n[0],e[0]),t[1]=Math.max(n[1],e[1]),t[2]=Math.max(n[2],e[2]),t}function Fn(t,n){return t[0]=Math.round(n[0]),t[1]=Math.round(n[1]),t[2]=Math.round(n[2]),t}function Gn(t,n,e){return t[0]=n[0]*e,t[1]=n[1]*e,t[2]=n[2]*e,t}function $n(t,n,e,r){return t[0]=n[0]+e[0]*r,t[1]=n[1]+e[1]*r,t[2]=n[2]+e[2]*r,t}function Vn(t,n){var e=n[0]-t[0],r=n[1]-t[1],o=n[2]-t[2];return Math.hypot(e,r,o)}function Un(t,n){var e=n[0]-t[0],r=n[1]-t[1],o=n[2]-t[2];return e*e+r*r+o*o}function Wn(t){var n=t[0],e=t[1],r=t[2];return n*n+e*e+r*r}function zn(t,n){return t[0]=-n[0],t[1]=-n[1],t[2]=-n[2],t}function Qn(t,n){return t[0]=1/n[0],t[1]=1/n[1],t[2]=1/n[2],t}function Zn(t,n){var e=n[0],r=n[1],o=n[2],i=e*e+r*r+o*o;return i>0&&(i=1/Math.sqrt(i)),t[0]=n[0]*i,t[1]=n[1]*i,t[2]=n[2]*i,t}function Jn(t,n){return t[0]*n[0]+t[1]*n[1]+t[2]*n[2]}function Kn(t,n,e){var r=n[0],o=n[1],i=n[2],a=e[0],u=e[1],c=e[2];return t[0]=o*c-i*u,t[1]=i*a-r*c,t[2]=r*u-o*a,t}function te(t,n,e,r){var o=n[0],i=n[1],a=n[2];return t[0]=o+r*(e[0]-o),t[1]=i+r*(e[1]-i),t[2]=a+r*(e[2]-a),t}function ne(t,n,e,r,o,i){var a=i*i,u=a*(2*i-3)+1,c=a*(i-2)+i,s=a*(i-1),f=a*(3-2*i);return t[0]=n[0]*u+e[0]*c+r[0]*s+o[0]*f,t[1]=n[1]*u+e[1]*c+r[1]*s+o[1]*f,t[2]=n[2]*u+e[2]*c+r[2]*s+o[2]*f,t}function ee(t,n,e,r,o,i){var a=1-i,u=a*a,c=i*i,s=u*a,f=3*i*u,h=3*c*a,l=c*i;return t[0]=n[0]*s+e[0]*f+r[0]*h+o[0]*l,t[1]=n[1]*s+e[1]*f+r[1]*h+o[1]*l,t[2]=n[2]*s+e[2]*f+r[2]*h+o[2]*l,t}function re(t,n){n=n||1;var e=2*J()*Math.PI,r=2*J()-1,o=Math.sqrt(1-r*r)*n;return t[0]=Math.cos(e)*o,t[1]=Math.sin(e)*o,t[2]=r*n,t}function oe(t,n,e){var r=n[0],o=n[1],i=n[2],a=e[3]*r+e[7]*o+e[11]*i+e[15];return a=a||1,t[0]=(e[0]*r+e[4]*o+e[8]*i+e[12])/a,t[1]=(e[1]*r+e[5]*o+e[9]*i+e[13])/a,t[2]=(e[2]*r+e[6]*o+e[10]*i+e[14])/a,t}function ie(t,n,e){var r=n[0],o=n[1],i=n[2];return t[0]=r*e[0]+o*e[3]+i*e[6],t[1]=r*e[1]+o*e[4]+i*e[7],t[2]=r*e[2]+o*e[5]+i*e[8],t}function ae(t,n,e){var r=e[0],o=e[1],i=e[2],a=e[3],u=n[0],c=n[1],s=n[2],f=o*s-i*c,h=i*u-r*s,l=r*c-o*u,d=o*l-i*h,p=i*f-r*l,v=r*h-o*f,y=2*a;return f*=y,h*=y,l*=y,d*=2,p*=2,v*=2,t[0]=u+f+d,t[1]=c+h+p,t[2]=s+l+v,t}function ue(t,n,e,r){var o=[],i=[];return o[0]=n[0]-e[0],o[1]=n[1]-e[1],o[2]=n[2]-e[2],i[0]=o[0],i[1]=o[1]*Math.cos(r)-o[2]*Math.sin(r),i[2]=o[1]*Math.sin(r)+o[2]*Math.cos(r),t[0]=i[0]+e[0],t[1]=i[1]+e[1],t[2]=i[2]+e[2],t}function ce(t,n,e,r){var o=[],i=[];return o[0]=n[0]-e[0],o[1]=n[1]-e[1],o[2]=n[2]-e[2],i[0]=o[2]*Math.sin(r)+o[0]*Math.cos(r),i[1]=o[1],i[2]=o[2]*Math.cos(r)-o[0]*Math.sin(r),t[0]=i[0]+e[0],t[1]=i[1]+e[1],t[2]=i[2]+e[2],t}function se(t,n,e,r){var o=[],i=[];return o[0]=n[0]-e[0],o[1]=n[1]-e[1],o[2]=n[2]-e[2],i[0]=o[0]*Math.cos(r)-o[1]*Math.sin(r),i[1]=o[0]*Math.sin(r)+o[1]*Math.cos(r),i[2]=o[2],t[0]=i[0]+e[0],t[1]=i[1]+e[1],t[2]=i[2]+e[2],t}function fe(t,n){var e=t[0],r=t[1],o=t[2],i=n[0],a=n[1],u=n[2],c=Math.sqrt(e*e+r*r+o*o)*Math.sqrt(i*i+a*a+u*u),s=c&&Jn(t,n)/c;return Math.acos(Math.min(Math.max(s,-1),1))}function he(t){return t[0]=0,t[1]=0,t[2]=0,t}function le(t){return"vec3("+t[0]+", "+t[1]+", "+t[2]+")"}function de(t,n){return t[0]===n[0]&&t[1]===n[1]&&t[2]===n[2]}function pe(t,n){var e=t[0],r=t[1],o=t[2],i=n[0],a=n[1],u=n[2];return Math.abs(e-i)<=Q*Math.max(1,Math.abs(e),Math.abs(i))&&Math.abs(r-a)<=Q*Math.max(1,Math.abs(r),Math.abs(a))&&Math.abs(o-u)<=Q*Math.max(1,Math.abs(o),Math.abs(u))}var ve,ye=_n,me=Yn,ge=In,Me=Vn,be=Un,xe=Bn,Pe=Wn,Ee=(ve=wn(),function(t,n,e,r,o,i){var a,u;for(n||(n=3),e||(e=0),u=r?Math.min(r*n+e,t.length):t.length,a=e;a<u;a+=n)ve[0]=t[a],ve[1]=t[a+1],ve[2]=t[a+2],o(ve,ve,i),t[a]=ve[0],t[a+1]=ve[1],t[a+2]=ve[2];return t});function Oe(t){var n=t[0],e=t[1],r=t[2],o=t[3];return Math.hypot(n,e,r,o)}function Se(t){var n=t[0],e=t[1],r=t[2],o=t[3];return n*n+e*e+r*r+o*o}!function(){var t,n=(t=new Z(4),Z!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0,t[3]=0),t)}();function Ce(){var t=new Z(4);return Z!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0),t[3]=1,t}function Ae(t){return t[0]=0,t[1]=0,t[2]=0,t[3]=1,t}function je(t,n,e){e*=.5;var r=Math.sin(e);return t[0]=r*n[0],t[1]=r*n[1],t[2]=r*n[2],t[3]=Math.cos(e),t}function we(t,n){var e=2*Math.acos(n[3]),r=Math.sin(e/2);return r>Q?(t[0]=n[0]/r,t[1]=n[1]/r,t[2]=n[2]/r):(t[0]=1,t[1]=0,t[2]=0),e}function Re(t,n){var e=ir(t,n);return Math.acos(2*e*e-1)}function Be(t,n,e){var r=n[0],o=n[1],i=n[2],a=n[3],u=e[0],c=e[1],s=e[2],f=e[3];return t[0]=r*f+a*u+o*s-i*c,t[1]=o*f+a*c+i*u-r*s,t[2]=i*f+a*s+r*c-o*u,t[3]=a*f-r*u-o*c-i*s,t}function Te(t,n,e){e*=.5;var r=n[0],o=n[1],i=n[2],a=n[3],u=Math.sin(e),c=Math.cos(e);return t[0]=r*c+a*u,t[1]=o*c+i*u,t[2]=i*c-o*u,t[3]=a*c-r*u,t}function ke(t,n,e){e*=.5;var r=n[0],o=n[1],i=n[2],a=n[3],u=Math.sin(e),c=Math.cos(e);return t[0]=r*c-i*u,t[1]=o*c+a*u,t[2]=i*c+r*u,t[3]=a*c-o*u,t}function Le(t,n,e){e*=.5;var r=n[0],o=n[1],i=n[2],a=n[3],u=Math.sin(e),c=Math.cos(e);return t[0]=r*c+o*u,t[1]=o*c-r*u,t[2]=i*c+a*u,t[3]=a*c-i*u,t}function De(t,n){var e=n[0],r=n[1],o=n[2];return t[0]=e,t[1]=r,t[2]=o,t[3]=Math.sqrt(Math.abs(1-e*e-r*r-o*o)),t}function _e(t,n){var e=n[0],r=n[1],o=n[2],i=n[3],a=Math.sqrt(e*e+r*r+o*o),u=Math.exp(i),c=a>0?u*Math.sin(a)/a:0;return t[0]=e*c,t[1]=r*c,t[2]=o*c,t[3]=u*Math.cos(a),t}function Ye(t,n){var e=n[0],r=n[1],o=n[2],i=n[3],a=Math.sqrt(e*e+r*r+o*o),u=a>0?Math.atan2(a,i)/a:0;return t[0]=e*u,t[1]=r*u,t[2]=o*u,t[3]=.5*Math.log(e*e+r*r+o*o+i*i),t}function Ie(t,n,e){return Ye(t,n),or(t,t,e),_e(t,t),t}function Ne(t,n,e,r){var o,i,a,u,c,s=n[0],f=n[1],h=n[2],l=n[3],d=e[0],p=e[1],v=e[2],y=e[3];return(i=s*d+f*p+h*v+l*y)<0&&(i=-i,d=-d,p=-p,v=-v,y=-y),1-i>Q?(o=Math.acos(i),a=Math.sin(o),u=Math.sin((1-r)*o)/a,c=Math.sin(r*o)/a):(u=1-r,c=r),t[0]=u*s+c*d,t[1]=u*f+c*p,t[2]=u*h+c*v,t[3]=u*l+c*y,t}function qe(t){var n=J(),e=J(),r=J(),o=Math.sqrt(1-n),i=Math.sqrt(n);return t[0]=o*Math.sin(2*Math.PI*e),t[1]=o*Math.cos(2*Math.PI*e),t[2]=i*Math.sin(2*Math.PI*r),t[3]=i*Math.cos(2*Math.PI*r),t}function Xe(t,n){var e=n[0],r=n[1],o=n[2],i=n[3],a=e*e+r*r+o*o+i*i,u=a?1/a:0;return t[0]=-e*u,t[1]=-r*u,t[2]=-o*u,t[3]=i*u,t}function He(t,n){return t[0]=-n[0],t[1]=-n[1],t[2]=-n[2],t[3]=n[3],t}function Fe(t,n){var e,r=n[0]+n[4]+n[8];if(r>0)e=Math.sqrt(r+1),t[3]=.5*e,e=.5/e,t[0]=(n[5]-n[7])*e,t[1]=(n[6]-n[2])*e,t[2]=(n[1]-n[3])*e;else{var o=0;n[4]>n[0]&&(o=1),n[8]>n[3*o+o]&&(o=2);var i=(o+1)%3,a=(o+2)%3;e=Math.sqrt(n[3*o+o]-n[3*i+i]-n[3*a+a]+1),t[o]=.5*e,e=.5/e,t[3]=(n[3*i+a]-n[3*a+i])*e,t[i]=(n[3*i+o]+n[3*o+i])*e,t[a]=(n[3*a+o]+n[3*o+a])*e}return t}function Ge(t,n,e,r){var o=.5*Math.PI/180;n*=o,e*=o,r*=o;var i=Math.sin(n),a=Math.cos(n),u=Math.sin(e),c=Math.cos(e),s=Math.sin(r),f=Math.cos(r);return t[0]=i*c*f-a*u*s,t[1]=a*u*f+i*c*s,t[2]=a*c*s-i*u*f,t[3]=a*c*f+i*u*s,t}function $e(t){return"quat("+t[0]+", "+t[1]+", "+t[2]+", "+t[3]+")"}var Ve,Ue,We,ze,Qe,Ze,Je=function(t){var n=new Z(4);return n[0]=t[0],n[1]=t[1],n[2]=t[2],n[3]=t[3],n},Ke=function(t,n,e,r){var o=new Z(4);return o[0]=t,o[1]=n,o[2]=e,o[3]=r,o},tr=function(t,n){return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t},nr=function(t,n,e,r,o){return t[0]=n,t[1]=e,t[2]=r,t[3]=o,t},er=function(t,n,e){return t[0]=n[0]+e[0],t[1]=n[1]+e[1],t[2]=n[2]+e[2],t[3]=n[3]+e[3],t},rr=Be,or=function(t,n,e){return t[0]=n[0]*e,t[1]=n[1]*e,t[2]=n[2]*e,t[3]=n[3]*e,t},ir=function(t,n){return t[0]*n[0]+t[1]*n[1]+t[2]*n[2]+t[3]*n[3]},ar=function(t,n,e,r){var o=n[0],i=n[1],a=n[2],u=n[3];return t[0]=o+r*(e[0]-o),t[1]=i+r*(e[1]-i),t[2]=a+r*(e[2]-a),t[3]=u+r*(e[3]-u),t},ur=Oe,cr=ur,sr=Se,fr=sr,hr=function(t,n){var e=n[0],r=n[1],o=n[2],i=n[3],a=e*e+r*r+o*o+i*i;return a>0&&(a=1/Math.sqrt(a)),t[0]=e*a,t[1]=r*a,t[2]=o*a,t[3]=i*a,t},lr=function(t,n){return t[0]===n[0]&&t[1]===n[1]&&t[2]===n[2]&&t[3]===n[3]},dr=function(t,n){var e=t[0],r=t[1],o=t[2],i=t[3],a=n[0],u=n[1],c=n[2],s=n[3];return Math.abs(e-a)<=Q*Math.max(1,Math.abs(e),Math.abs(a))&&Math.abs(r-u)<=Q*Math.max(1,Math.abs(r),Math.abs(u))&&Math.abs(o-c)<=Q*Math.max(1,Math.abs(o),Math.abs(c))&&Math.abs(i-s)<=Q*Math.max(1,Math.abs(i),Math.abs(s))},pr=(Ve=wn(),Ue=Tn(1,0,0),We=Tn(0,1,0),function(t,n,e){var r=Jn(n,e);return r<-.999999?(Kn(Ve,Ue,n),xe(Ve)<1e-6&&Kn(Ve,We,n),Zn(Ve,Ve),je(t,Ve,Math.PI),t):r>.999999?(t[0]=0,t[1]=0,t[2]=0,t[3]=1,t):(Kn(Ve,n,e),t[0]=Ve[0],t[1]=Ve[1],t[2]=Ve[2],t[3]=1+r,hr(t,t))}),vr=(ze=Ce(),Qe=Ce(),function(t,n,e,r,o,i){return Ne(ze,n,o,i),Ne(Qe,e,r,i),Ne(t,ze,Qe,2*i*(1-i)),t}),yr=(Ze=K(),function(t,n,e,r){return Ze[0]=e[0],Ze[3]=e[1],Ze[6]=e[2],Ze[1]=r[0],Ze[4]=r[1],Ze[7]=r[2],Ze[2]=-n[0],Ze[5]=-n[1],Ze[8]=-n[2],hr(t,Fe(t,Ze))});function mr(){var t=new Z(2);return Z!=Float32Array&&(t[0]=0,t[1]=0),t}function gr(t){var n=new Z(2);return n[0]=t[0],n[1]=t[1],n}function Mr(t,n){var e=new Z(2);return e[0]=t,e[1]=n,e}function br(t,n){return t[0]=n[0],t[1]=n[1],t}function xr(t,n,e){return t[0]=n,t[1]=e,t}function Pr(t,n,e){return t[0]=n[0]+e[0],t[1]=n[1]+e[1],t}function Er(t,n,e){return t[0]=n[0]-e[0],t[1]=n[1]-e[1],t}function Or(t,n,e){return t[0]=n[0]*e[0],t[1]=n[1]*e[1],t}function Sr(t,n,e){return t[0]=n[0]/e[0],t[1]=n[1]/e[1],t}function Cr(t,n){return t[0]=Math.ceil(n[0]),t[1]=Math.ceil(n[1]),t}function Ar(t,n){return t[0]=Math.floor(n[0]),t[1]=Math.floor(n[1]),t}function jr(t,n,e){return t[0]=Math.min(n[0],e[0]),t[1]=Math.min(n[1],e[1]),t}function wr(t,n,e){return t[0]=Math.max(n[0],e[0]),t[1]=Math.max(n[1],e[1]),t}function Rr(t,n){return t[0]=Math.round(n[0]),t[1]=Math.round(n[1]),t}function Br(t,n,e){return t[0]=n[0]*e,t[1]=n[1]*e,t}function Tr(t,n,e,r){return t[0]=n[0]+e[0]*r,t[1]=n[1]+e[1]*r,t}function kr(t,n){var e=n[0]-t[0],r=n[1]-t[1];return Math.hypot(e,r)}function Lr(t,n){var e=n[0]-t[0],r=n[1]-t[1];return e*e+r*r}function Dr(t){var n=t[0],e=t[1];return Math.hypot(n,e)}function _r(t){var n=t[0],e=t[1];return n*n+e*e}function Yr(t,n){return t[0]=-n[0],t[1]=-n[1],t}function Ir(t,n){return t[0]=1/n[0],t[1]=1/n[1],t}function Nr(t,n){var e=n[0],r=n[1],o=e*e+r*r;return o>0&&(o=1/Math.sqrt(o)),t[0]=n[0]*o,t[1]=n[1]*o,t}function qr(t,n){return t[0]*n[0]+t[1]*n[1]}function Xr(t,n,e){var r=n[0]*e[1]-n[1]*e[0];return t[0]=t[1]=0,t[2]=r,t}function Hr(t,n,e,r){var o=n[0],i=n[1];return t[0]=o+r*(e[0]-o),t[1]=i+r*(e[1]-i),t}function Fr(t,n){n=n||1;var e=2*J()*Math.PI;return t[0]=Math.cos(e)*n,t[1]=Math.sin(e)*n,t}function Gr(t,n,e){var r=n[0],o=n[1];return t[0]=e[0]*r+e[2]*o,t[1]=e[1]*r+e[3]*o,t}function $r(t,n,e){var r=n[0],o=n[1];return t[0]=e[0]*r+e[2]*o+e[4],t[1]=e[1]*r+e[3]*o+e[5],t}function Vr(t,n,e){var r=n[0],o=n[1];return t[0]=e[0]*r+e[3]*o+e[6],t[1]=e[1]*r+e[4]*o+e[7],t}function Ur(t,n,e){var r=n[0],o=n[1];return t[0]=e[0]*r+e[4]*o+e[12],t[1]=e[1]*r+e[5]*o+e[13],t}function Wr(t,n,e,r){var o=n[0]-e[0],i=n[1]-e[1],a=Math.sin(r),u=Math.cos(r);return t[0]=o*u-i*a+e[0],t[1]=o*a+i*u+e[1],t}function zr(t,n){var e=t[0],r=t[1],o=n[0],i=n[1],a=Math.sqrt(e*e+r*r)*Math.sqrt(o*o+i*i),u=a&&(e*o+r*i)/a;return Math.acos(Math.min(Math.max(u,-1),1))}function Qr(t){return t[0]=0,t[1]=0,t}function Zr(t){return"vec2("+t[0]+", "+t[1]+")"}function Jr(t,n){return t[0]===n[0]&&t[1]===n[1]}function Kr(t,n){var e=t[0],r=t[1],o=n[0],i=n[1];return Math.abs(e-o)<=Q*Math.max(1,Math.abs(e),Math.abs(o))&&Math.abs(r-i)<=Q*Math.max(1,Math.abs(r),Math.abs(i))}var to=Dr,no=Er,eo=Or,ro=Sr,oo=kr,io=Lr,ao=_r,uo=function(){var t=mr();return function(n,e,r,o,i,a){var u,c;for(e||(e=2),r||(r=0),c=o?Math.min(o*e+r,n.length):n.length,u=r;u<c;u+=e)t[0]=n[u],t[1]=n[u+1],i(t,t,a),n[u]=t[0],n[u+1]=t[1];return n}}(),co=function(){function t(){}return t.tag="c-canvas-rbush-node",t}(),so="RBushRoot",fo=function(){function t(){this.renderQueue=[],this.restoreStack=[],this.clearFullScreen=!1,this.enableBatch=!1,this.batchedStyleHash="",this.batchedDisplayObject=null,this.toSync=new Set}var n;return n=t,t.prototype.syncRTree=function(){var t=this,n=[];this.toSync.forEach((function(e){var r=e.rBushNode;r&&t.rBush.remove(r.aabb);var o=e.getRenderBounds();if(o){var i=y(o.getMin(),2),a=i[0],u=i[1],c=y(o.getMax(),2),s=c[0],f=c[1];r.aabb={id:e.entity,minX:a,minY:u,maxX:s,maxY:f}}r.aabb&&n.push(r.aabb)})),this.rBush.load(n),this.toSync.clear()},t.prototype.pushToSync=function(t){var n=this;t.forEach((function(t){n.toSync.add(t)}))},t.prototype.apply=function(t){var e=this,r=function(t){t.target.rBushNode=new co,e.pushToSync(t.composedPath().slice(0,-2))},o=function(t){var n=t.target,r=n.rBushNode;e.rBush.remove(r.aabb),e.toSync.delete(n)},i=function(t){var n,r=t.target;(null===(n=r.ownerDocument)||void 0===n?void 0:n.documentElement)===e.renderingContext.root&&(t.detail.affectChildren&&r.forEach((function(t){e.pushToSync([t])})),e.pushToSync(t.composedPath().slice(0,-2)))};t.hooks.init.tap(n.tag,(function(){e.renderingContext.root.addEventListener(g.ElementEvent.MOUNTED,r),e.renderingContext.root.addEventListener(g.ElementEvent.UNMOUNTED,o),e.renderingContext.root.addEventListener(g.ElementEvent.BOUNDS_CHANGED,i)})),t.hooks.destroy.tap(n.tag,(function(){e.renderingContext.root.removeEventListener(g.ElementEvent.MOUNTED,r),e.renderingContext.root.removeEventListener(g.ElementEvent.UNMOUNTED,o),e.renderingContext.root.removeEventListener(g.ElementEvent.BOUNDS_CHANGED,i)})),t.hooks.beginFrame.tap(n.tag,(function(){var t=e.contextService.getContext(),n=e.canvasConfig.renderer.getConfig(),r=n.enableDirtyRectangleRendering;n.enableDirtyRectangleRenderingDebug;e.clearFullScreen=!r||e.renderingContext.renderReasons.has(g.RENDER_REASON.CameraChanged),t&&(t.save(),e.clearFullScreen&&t.clearRect(0,0,e.canvasConfig.width,e.canvasConfig.height),e.applyTransform(t,e.camera.getOrthoMatrix()))})),t.hooks.endFrame.tap(n.tag,(function(){e.syncRTree();var n=e.canvasConfig.renderer.getConfig().enableDirtyRectangleRendering,r=e.contextService.getContext();if(n){var o=e.safeMergeAABB.apply(e,m([e.mergeDirtyAABBs(e.renderQueue)],y(e.renderingContext.removedRenderBoundsList),!1));if(e.renderingContext.removedRenderBoundsList=[],!o)return;var i=e.convertAABB2Rect(o),a=i.x,u=i.y,c=i.width,s=i.height;r.clearRect(a,u,c,s),r.beginPath(),r.rect(a,u,c,s),r.clip(),e.searchDirtyObjects(o).sort((function(t,n){return t.sortable.renderOrder-n.sortable.renderOrder})).forEach((function(n){n.isVisible()&&e.renderDisplayObject(n,t)})),e.enableBatch&&e.batchedStyleHash&&e.flush(r,t),e.renderQueue.forEach((function(t){e.saveDirtyAABB(t)})),e.renderQueue=[]}e.restoreStack.forEach((function(t){r.restore()})),e.restoreStack=[],r.restore()})),t.hooks.render.tap(n.tag,(function(n){e.canvasConfig.renderer.getConfig().enableDirtyRectangleRendering?e.renderQueue.push(n):e.renderDisplayObject(n,t)}))},t.prototype.flush=function(t,n){if(this.batchedDisplayObject){var e=this.styleRendererFactory(this.batchedDisplayObject.nodeName);e&&(this.applyAttributesToContext(t,this.batchedDisplayObject,n),t.closePath(),e.render(t,this.batchedDisplayObject.parsedStyle,this.batchedDisplayObject),t.restore()),this.batchedStyleHash="",this.batchedDisplayObject=null}},t.prototype.renderDisplayObject=function(t,n){for(var e=this,r=this.contextService.getContext(),o=this.restoreStack[this.restoreStack.length-1];o&&t.parentNode!==o;)r.restore(),this.restoreStack.pop(),o=this.restoreStack[this.restoreStack.length-1];var i=t.nodeName,a=this.styleRendererFactory(i),u=!1;if(this.enableBatch&&a){var c=a.hash(t.attributes);this.batchedStyleHash&&c!==this.batchedStyleHash&&this.flush(r,n),this.batchedStyleHash||(this.batchedStyleHash=c,this.batchedDisplayObject=t,u=!0)}r.save(),this.applyTransform(r,t.getLocalTransform());var s=t.style.clipPath;if(s){r.save(),this.applyTransform(r,s.getLocalTransform());var f=this.pathGeneratorFactory(s.nodeName);f&&this.useAnchor(r,s,(function(){r.beginPath(),f(r,s.parsedStyle),r.closePath()})),r.restore(),r.clip()}this.enableBatch||(r.save(),this.applyAttributesToContext(r,t,n)),this.useAnchor(r,t,(function(){var n=e.pathGeneratorFactory(t.nodeName);n&&(!u&&e.enableBatch||r.beginPath(),n(r,t.parsedStyle),e.enableBatch||t.nodeName===g.SHAPE.Line||t.nodeName===g.SHAPE.Path||t.nodeName===g.SHAPE.Polyline||r.closePath()),a&&!e.enableBatch&&a.render(r,t.parsedStyle,t)})),this.enableBatch||r.restore(),t.renderable.dirty=!1,this.restoreStack.push(t)},t.prototype.convertAABB2Rect=function(t){var n=t.getMin(),e=t.getMax(),r=Math.floor(n[0]),o=Math.floor(n[1]);return{x:r,y:o,width:Math.ceil(e[0])-r,height:Math.ceil(e[1])-o}},t.prototype.insertRBushNode=function(t){var n=t.rBushNode;if(n){this.rBush.remove(n.aabb);var e=t.getRenderBounds();if(e){var r=y(e.getMin(),2),o=r[0],i=r[1],a=y(e.getMax(),2),u=a[0],c=a[1];n.aabb={id:t.entity,minX:o,minY:i,maxX:u,maxY:c}}this.rBush.insert(n.aabb)}},t.prototype.mergeDirtyAABBs=function(t){var n;return t.forEach((function(t){var e=t.getRenderBounds();e&&(n?n.add(e):n=new g.AABB(e.center,e.halfExtents));var r=t.renderable.dirtyRenderBounds;r&&(n?n.add(r):n=new g.AABB(r.center,r.halfExtents))})),n},t.prototype.searchDirtyObjects=function(t){var n=this,e=y(t.getMin(),2),r=e[0],o=e[1],i=y(t.getMax(),2),a=i[0],u=i[1];return this.rBush.search({minX:r,minY:o,maxX:a,maxY:u}).map((function(t){var e=t.id;return n.displayObjectPool.getByEntity(e)}))},t.prototype.saveDirtyAABB=function(t){var n=t.renderable;n.dirtyRenderBounds||(n.dirtyRenderBounds=new g.AABB);var e=t.getRenderBounds();e&&n.dirtyRenderBounds.update(e.center,e.halfExtents)},t.prototype.applyTransform=function(t,n){var e=y(i.getTranslation(a.create(),n),2),r=e[0],o=e[1],c=y(i.getScaling(a.create(),n),2),s=c[0],f=c[1],h=i.getRotation(u.create(),n),l=y(Object(g.getEuler)(a.create(),h),3),d=l[0],p=(l[1],l[2]),v=Object(g.fromRotationTranslationScale)(d||p,r,o,s,f);t.transform(v[0],v[1],v[3],v[4],v[6],v[7])},t.prototype.getColor=function(t,n,e,r){var o;if(t.type===g.PARSED_COLOR_TYPE.LinearGradient||t.type===g.PARSED_COLOR_TYPE.RadialGradient){var i=n.getGeometryBounds(),a=i&&2*i.halfExtents[0]||0,u=i&&2*i.halfExtents[1]||0;o=this.gradientPool.getOrCreateGradient(d(d({type:t.type},t.value),{width:a,height:u}),e)}else if(t.type===g.PARSED_COLOR_TYPE.Pattern){var c=this.imagePool.getPatternSync(t.value);c?o=c:this.imagePool.createPattern(t.value,e).then((function(){n.renderable.dirty=!0,r.dirtify()}))}else o=t.formatted;return o},t.prototype.applyAttributesToContext=function(t,n,e){var r=n.parsedStyle,o=r.stroke,i=r.fill,a=r.opacity,u=r.lineDash,c=r.lineDashOffset,s=r.filter,f=r.shadowColor,h=r.shadowBlur,l=r.shadowOffsetX,d=r.shadowOffsetY;u&&k(u)&&t.setLineDash(u),T(c)||(t.lineDashOffset=c),T(a)||(t.globalAlpha*=a),T(o)||(t.strokeStyle=this.getColor(o,n,t,e)),T(i)||(t.fillStyle=this.getColor(i,n,t,e)),T(s)||(t.filter=n.style.filter),T(f)||(t.shadowColor=f.formatted,t.shadowBlur=h,t.shadowOffsetX=l,t.shadowOffsetY=d)},t.prototype.useAnchor=function(t,n,e){var r=n.getGeometryBounds();if(r){var o=r.halfExtents,i=(n.parsedStyle||{}).anchor,a=void 0===i?[0,0]:i;t.translate(-a[0]*o[0]*2,-a[1]*o[1]*2),e()}else e()},t.prototype.safeMergeAABB=function(){for(var t,n=[],e=0;e<arguments.length;e++)n[e]=arguments[e];return n.forEach((function(n){n&&(t?t.add(n):t=n)})),t},t.tag="CanvasRendererPlugin",p([Object(M.inject)(g.CanvasConfig),v("design:type",Object)],t.prototype,"canvasConfig",void 0),p([Object(M.inject)(g.DefaultCamera),v("design:type",g.Camera)],t.prototype,"camera",void 0),p([Object(M.inject)(g.ContextService),v("design:type",Object)],t.prototype,"contextService",void 0),p([Object(M.inject)(g.SceneGraphService),v("design:type",Object)],t.prototype,"sceneGraphService",void 0),p([Object(M.inject)(g.RenderingContext),v("design:type",Object)],t.prototype,"renderingContext",void 0),p([Object(M.inject)(G),v("design:type",G)],t.prototype,"imagePool",void 0),p([Object(M.inject)(U),v("design:type",U)],t.prototype,"gradientPool",void 0),p([Object(M.inject)(W),v("design:type",Function)],t.prototype,"pathGeneratorFactory",void 0),p([Object(M.inject)(A),v("design:type",Function)],t.prototype,"styleRendererFactory",void 0),p([Object(M.inject)(g.DisplayObjectPool),v("design:type",g.DisplayObjectPool)],t.prototype,"displayObjectPool",void 0),p([Object(M.inject)(so),v("design:type",C.a)],t.prototype,"rBush",void 0),t=n=p([Object(M.singleton)({contrib:g.RenderingPluginContribution})],t)}(),ho=function(){function t(){}var n;return n=t,t.prototype.apply=function(t){var e=this,r=function(n){var r=n.target,o=r.nodeName,i=r.attributes;if(o===g.SHAPE.Image){var a=i.img;N(a)&&e.imagePool.getOrCreateImage(a).then((function(){r.renderable.dirty=!0,t.dirtify()}))}},o=function(n){var r=n.target,o=n.detail,i=o.attributeName,a=o.newValue;r.nodeName===g.SHAPE.Image&&"img"===i&&N(a)&&e.imagePool.getOrCreateImage(a).then((function(){r.renderable.dirty=!0,t.dirtify()}))};t.hooks.init.tap(n.tag,(function(){e.renderingContext.root.addEventListener(g.ElementEvent.MOUNTED,r),e.renderingContext.root.addEventListener(g.ElementEvent.ATTRIBUTE_CHANGED,o)})),t.hooks.destroy.tap(n.tag,(function(){e.renderingContext.root.removeEventListener(g.ElementEvent.MOUNTED,r),e.renderingContext.root.removeEventListener(g.ElementEvent.ATTRIBUTE_CHANGED,o)}))},t.tag="LoadImagePlugin",p([Object(M.inject)(G),v("design:type",G)],t.prototype,"imagePool",void 0),p([Object(M.inject)(g.RenderingContext),v("design:type",Object)],t.prototype,"renderingContext",void 0),t=n=p([Object(M.singleton)({contrib:g.RenderingPluginContribution})],t)}();g.globalContainer.register({token:{token:z,named:g.SHAPE.Circle},useValue:function(t,n){var e=n.r,r=void 0===e?0:e;t.arc(r,r,r,0,2*Math.PI,!1)}}),g.globalContainer.register({token:{token:z,named:g.SHAPE.Ellipse},useValue:function(t,n){var e=n.rx,r=n.ry;if(t.ellipse)t.ellipse(e,r,e,r,0,0,2*Math.PI,!1);else{var o=e>r?e:r,i=e>r?1:e/r,a=e>r?r/e:1;t.save(),t.scale(i,a),t.arc(0,0,o,0,2*Math.PI)}}}),g.globalContainer.register({token:{token:z,named:g.SHAPE.Rect},useValue:function(t,n){var e=n.radius,r=void 0===e?0:e,o=n.width,i=void 0===o?0:o,a=n.height,u=void 0===a?0:a;if(0===r)t.rect(0,0,i,u);else{var c=y(function(t){var n=0,e=0,r=0,o=0;return k(t)?1===t.length?n=e=r=o=t[0]:2===t.length?(n=r=t[0],e=o=t[1]):3===t.length?(n=t[0],e=o=t[1],r=t[2]):(n=t[0],e=t[1],r=t[2],o=t[3]):n=e=r=o=t,[n,e,r,o]}(r),4),s=c[0],f=c[1],h=c[2],l=c[3];t.moveTo(s,0),t.lineTo(i-f,0),0!==f&&t.arc(i-f,f,f,-Math.PI/2,0),t.lineTo(i,u-h),0!==h&&t.arc(i-h,u-h,h,0,Math.PI/2),t.lineTo(l,u),0!==l&&t.arc(l,u-l,l,Math.PI/2,Math.PI),t.lineTo(0,s),0!==s&&t.arc(s,s,s,Math.PI,1.5*Math.PI)}}}),g.globalContainer.register({token:{token:z,named:g.SHAPE.Line},useValue:function(t,n){var e=n.x1,r=n.y1,o=n.x2,i=n.y2,a=n.defX,u=void 0===a?0:a,c=n.defY,s=void 0===c?0:c;t.moveTo(e-u,r-s),t.lineTo(o-u,i-s)}}),g.globalContainer.register({token:{token:z,named:g.SHAPE.Polyline},useValue:function(t,n){var e=n.defX,r=void 0===e?0:e,o=n.defY,i=void 0===o?0:o,a=n.points.points,u=a.length,c=a[0][0]-r,s=a[0][1]-i,f=a[u-1][0]-r,h=a[u-1][1]-i;t.moveTo(c,s);for(var l=0;l<u-1;l++){var d=a[l];t.lineTo(d[0]-r,d[1]-i)}t.lineTo(f,h)}}),g.globalContainer.register({token:{token:z,named:g.SHAPE.Polygon},useValue:function(t,n){var e=n.defX,r=void 0===e?0:e,o=n.defY,i=void 0===o?0:o,a=n.points.points,u=a.length,c=a[0][0]-r,s=a[0][1]-i,f=a[u-1][0]-r,h=a[u-1][1]-i;t.moveTo(c,s);for(var l=0;l<u-1;l++){var d=a[l];t.lineTo(d[0]-r,d[1]-i)}t.lineTo(f,h)}}),g.globalContainer.register({token:{token:z,named:g.SHAPE.Path},useValue:function(t,n){var e=n.defX,r=void 0===e?0:e,o=n.defY,i=void 0===o?0:o,a=n.path,u=a.curve,c=a.zCommandIndexes,s=u;c.forEach((function(t,n){s.splice(t+n,0,["Z"])}));for(var f=[-r,-i],h=0;h<s.length;h++){var l=s[h],d=l[0];switch(d){case"M":t.moveTo(l[1]-r,l[2]-i),f=[l[1]-r,l[2]-i];break;case"C":t.bezierCurveTo(l[1]-r,l[2]-i,l[3]-r,l[4]-i,l[5]-r,l[6]-i);break;case"Z":t.closePath()}if("Z"===d)f;else{var p=l.length;[l[p-2]-r,l[p-1]-i]}}}}),g.globalContainer.register({token:W,useFactory:function(t){var n={};return function(e){return n[e]||t.container.isBoundNamed(z,e)&&(n[e]=t.container.getNamed(z,e)),n[e]}}});var lo=Object(M.Module)((function(t){t(G),t({token:so,useValue:new C.a}),t(F),t($),t(V),t({token:A,useFactory:function(t){var n={};return function(e){return n[e]||t.container.isBoundNamed(j,e)&&(n[e]=t.container.getNamed(j,e)),n[e]}}}),t(U),t(fo),t(ho)})),po=function(){function t(){}return t.prototype.init=function(t){t.load(lo,!0)},t.prototype.destroy=function(t){t.remove(G),t.remove(so),t.remove(F),t.remove($),t.remove(V),t.remove(j),t.remove(A),t.remove(U),t.remove(fo),t.remove(ho)},t}(),vo=function(){function t(){var t=this;this.isHit=function(n,e,r){var o=t.pointInPathPickerFactory(n.nodeName);if(o){var u=i.invert(i.create(),r),c=a.transformMat4(a.create(),a.fromValues(e[0],e[1],0),u),s=n.getGeometryBounds().halfExtents,f=n.parsedStyle.anchor,h=void 0===f?[0,0]:f;if(c[0]+=h[0]*s[0]*2,c[1]+=h[1]*s[1]*2,o(n,new g.Point(c[0],c[1]),t.isPointInPath))return!0}return!1},this.isPointInPath=function(n,e){var r=t.offscreenCanvas.getOrCreateContext(),o=t.pathGeneratorFactory(n.nodeName);return o&&o(r,n.parsedStyle),r.isPointInPath(e.x,e.y)}}var n;return n=t,t.prototype.apply=function(t){var e=this;t.hooks.pick.tap(n.tag,(function(t){var n=t.position,r=n.x,o=n.y,u=a.fromValues(r,o,0),c=[],s=e.rBush.search({minX:u[0],minY:u[1],maxX:u[0],maxY:u[1]}),f=s.map((function(t){return t.id}));return s.forEach((function(t){var n=t.id,r=e.displayObjectPool.getByEntity(n);if(r.isVisible()&&r.interactive){if(r.parentNode&&-1===f.indexOf(r.parentNode.entity))return;var o=r.style.clipPath||r,a=r.getWorldTransform();r.style.clipPath&&(a=i.multiply(i.create(),a,r.style.clipPath.getLocalTransform())),e.isHit(o,u,a)&&c.push(r)}})),c.sort((function(t,n){return t.sortable.renderOrder-n.sortable.renderOrder})),t.picked=c[c.length-1]||null,t}))},t.tag="CanvasPickerPlugin",p([Object(M.inject)(g.SceneGraphService),v("design:type",Object)],t.prototype,"sceneGraphService",void 0),p([Object(M.inject)(g.DisplayObjectPool),v("design:type",g.DisplayObjectPool)],t.prototype,"displayObjectPool",void 0),p([Object(M.inject)(g.OffscreenCanvasCreator),v("design:type",g.OffscreenCanvasCreator)],t.prototype,"offscreenCanvas",void 0),p([Object(M.inject)(so),v("design:type",Function)],t.prototype,"rBush",void 0),p([Object(M.inject)(W),v("design:type",Function)],t.prototype,"pathGeneratorFactory",void 0),p([Object(M.inject)("PointInPathPicker"),v("design:type",Function)],t.prototype,"pointInPathPickerFactory",void 0),t=n=p([Object(M.singleton)({contrib:g.RenderingPluginContribution})],t)}();function yo(t,n,e,r){var o=t-e,i=n-r;return Math.sqrt(o*o+i*i)}function mo(t,n){return Math.abs(t-n)<.001}function go(t,n){var e=Y(t),r=Y(n);return{x:e,y:r,width:_(t)-e,height:_(n)-r}}function Mo(t){return(t+2*Math.PI)%(2*Math.PI)}var bo={box:function(t,n,e,r){return go([t,e],[n,r])},length:function(t,n,e,r){return yo(t,n,e,r)},pointAt:function(t,n,e,r,o){return{x:(1-o)*t+o*e,y:(1-o)*n+o*r}},pointDistance:function(t,n,e,r,o,i){var a=(e-t)*(o-t)+(r-n)*(i-n);return a<0?yo(t,n,o,i):a>(e-t)*(e-t)+(r-n)*(r-n)?yo(e,r,o,i):this.pointToLine(t,n,e,r,o,i)},pointToLine:function(t,n,e,r,o,i){var a=[e-t,r-n];if(c.exactEquals(a,[0,0]))return Math.sqrt((o-t)*(o-t)+(i-n)*(i-n));var u=[-a[1],a[0]];c.normalize(u,u);var s=[o-t,i-n];return Math.abs(c.dot(s,u))},tangentAngle:function(t,n,e,r){return Math.atan2(r-n,e-t)}};function xo(t,n,e,r,o,i){var a=-1,u=1/0,c=[e,r],s=20;i&&i>200&&(s=i/10);for(var f=1/s,h=f/10,l=0;l<=s;l++){var d=l*f,p=[o.apply(null,t.concat([d])),o.apply(null,n.concat([d]))];(g=yo(c[0],c[1],p[0],p[1]))<u&&(a=d,u=g)}if(0===a)return{x:t[0],y:n[0]};if(1===a){var v=t.length;return{x:t[v-1],y:n[v-1]}}u=1/0;for(l=0;l<32&&!(h<1e-4);l++){var y=a-h,m=a+h,g=(p=[o.apply(null,t.concat([y])),o.apply(null,n.concat([y]))],yo(c[0],c[1],p[0],p[1]));if(y>=0&&g<u)a=y,u=g;else{var M=[o.apply(null,t.concat([m])),o.apply(null,n.concat([m]))],b=yo(c[0],c[1],M[0],M[1]);m<=1&&b<u?(a=m,u=b):h*=.5}}return{x:o.apply(null,t.concat([a])),y:o.apply(null,n.concat([a]))}}function Po(t,n,e,r){var o=1-r;return o*o*t+2*r*o*n+r*r*e}function Eo(t,n,e){var r=t+e-2*n;if(mo(r,0))return[.5];var o=(t-n)/r;return o<=1&&o>=0?[o]:[]}function Oo(t,n,e,r){return 2*(1-r)*(n-t)+2*r*(e-n)}function So(t,n,e,r,o,i,a){var u=Po(t,e,o,a),c=Po(n,r,i,a),s=bo.pointAt(t,n,e,r,a),f=bo.pointAt(e,r,o,i,a);return[[t,n,s.x,s.y,u,c],[u,c,f.x,f.y,o,i]]}var Co={box:function(t,n,e,r,o,i){var a=Eo(t,e,o)[0],u=Eo(n,r,i)[0],c=[t,o],s=[n,i];return void 0!==a&&c.push(Po(t,e,o,a)),void 0!==u&&s.push(Po(n,r,i,u)),go(c,s)},length:function(t,n,e,r,o,i){return function t(n,e,r,o,i,a,u){if(0===u)return(yo(n,e,r,o)+yo(r,o,i,a)+yo(n,e,i,a))/2;var c=So(n,e,r,o,i,a,.5),s=c[0],f=c[1];return s.push(u-1),f.push(u-1),t.apply(null,s)+t.apply(null,f)}(t,n,e,r,o,i,3)},nearestPoint:function(t,n,e,r,o,i,a,u){return xo([t,e,o],[n,r,i],a,u,Po)},pointDistance:function(t,n,e,r,o,i,a,u){var c=this.nearestPoint(t,n,e,r,o,i,a,u);return yo(c.x,c.y,a,u)},interpolationAt:Po,pointAt:function(t,n,e,r,o,i,a){return{x:Po(t,e,o,a),y:Po(n,r,i,a)}},divide:function(t,n,e,r,o,i,a){return So(t,n,e,r,o,i,a)},tangentAngle:function(t,n,e,r,o,i,a){var u=Oo(t,e,o,a),c=Oo(n,r,i,a);return Mo(Math.atan2(c,u))}};function Ao(t,n,e,r,o){var i=1-o;return i*i*i*t+3*n*o*i*i+3*e*o*o*i+r*o*o*o}function jo(t,n,e,r,o){var i=1-o;return 3*(i*i*(n-t)+2*i*o*(e-n)+o*o*(r-e))}function wo(t,n,e,r){var o,i,a,u=-3*t+9*n-9*e+3*r,c=6*t-12*n+6*e,s=3*n-3*t,f=[];if(mo(u,0))mo(c,0)||(o=-s/c)>=0&&o<=1&&f.push(o);else{var h=c*c-4*u*s;mo(h,0)?f.push(-c/(2*u)):h>0&&(i=(-c-(a=Math.sqrt(h)))/(2*u),(o=(-c+a)/(2*u))>=0&&o<=1&&f.push(o),i>=0&&i<=1&&f.push(i))}return f}function Ro(t,n,e,r,o,i,a,u,c){var s=Ao(t,e,o,a,c),f=Ao(n,r,i,u,c),h=bo.pointAt(t,n,e,r,c),l=bo.pointAt(e,r,o,i,c),d=bo.pointAt(o,i,a,u,c),p=bo.pointAt(h.x,h.y,l.x,l.y,c),v=bo.pointAt(l.x,l.y,d.x,d.y,c);return[[t,n,h.x,h.y,p.x,p.y,s,f],[s,f,v.x,v.y,d.x,d.y,a,u]]}function Bo(t,n,e,r,o,i,a,u,c){if(0===c)return function(t,n){for(var e=0,r=t.length,o=0;o<r;o++){e+=yo(t[o],n[o],t[(o+1)%r],n[(o+1)%r])}return e/2}([t,e,o,a],[n,r,i,u]);var s=Ro(t,n,e,r,o,i,a,u,.5),f=m(m([],y(s[0]),!1),[c-1],!1),h=m(m([],y(s[1]),!1),[c-1],!1);return Bo.apply(null,f)+Bo.apply(null,h)}var To={extrema:wo,box:function(t,n,e,r,o,i,a,u){for(var c=[t,a],s=[n,u],f=wo(t,e,o,a),h=wo(n,r,i,u),l=0;l<f.length;l++)c.push(Ao(t,e,o,a,f[l]));for(l=0;l<h.length;l++)s.push(Ao(n,r,i,u,h[l]));return go(c,s)},length:function(t,n,e,r,o,i,a,u){return Bo(t,n,e,r,o,i,a,u,3)},nearestPoint:function(t,n,e,r,o,i,a,u,c,s,f){return xo([t,e,o,a],[n,r,i,u],c,s,Ao,f)},pointDistance:function(t,n,e,r,o,i,a,u,c,s,f){var h=this.nearestPoint(t,n,e,r,o,i,a,u,c,s,f);return yo(h.x,h.y,c,s)},interpolationAt:Ao,pointAt:function(t,n,e,r,o,i,a,u,c){return{x:Ao(t,e,o,a,c),y:Ao(n,r,i,u,c)}},divide:function(t,n,e,r,o,i,a,u,c){return Ro(t,n,e,r,o,i,a,u,c)},tangentAngle:function(t,n,e,r,o,i,a,u,c){var s=jo(t,e,o,a,c),f=jo(n,r,i,u,c);return Mo(Math.atan2(f,s))}};function ko(t,n,e,r){var o=t-e,i=n-r;return Math.sqrt(o*o+i*i)}function Lo(t,n,e,r,o,i){return o>=t&&o<=t+e&&i>=n&&i<=n+r}function Do(t,n,e,r,o,i,a,u){var c=(Math.atan2(u-n,a-t)+2*Math.PI)%(2*Math.PI);if(c<r||c>o)return!1;var s={x:t+e*Math.cos(c),y:n+e*Math.sin(c)};return ko(s.x,s.y,a,u)<=i/2}function _o(t,n,e,r,o,i,a){var u=Math.min(t,e),c=Math.max(t,e),s=Math.min(n,r),f=Math.max(n,r),h=o/2;return i>=u-h&&i<=c+h&&a>=s-h&&a<=f+h&&bo.pointToLine(t,n,e,r,i,a)<=o/2}function Yo(t,n,e,r,o){var i=t.length;if(i<2)return!1;for(var a=0;a<i-1;a++){if(_o(t[a][0],t[a][1],t[a+1][0],t[a+1][1],n,e,r))return!0}if(o){var u=t[0],c=t[i-1];if(_o(u[0],u[1],c[0],c[1],n,e,r))return!0}return!1}function Io(t){return Math.abs(t)<1e-6?0:t<0?-1:1}function No(t,n,e){return(e[0]-t[0])*(n[1]-t[1])==(n[0]-t[0])*(e[1]-t[1])&&Math.min(t[0],n[0])<=e[0]&&e[0]<=Math.max(t[0],n[0])&&Math.min(t[1],n[1])<=e[1]&&e[1]<=Math.max(t[1],n[1])}function qo(t,n,e){var r=!1,o=t.length;if(o<=2)return!1;for(var i=0;i<o;i++){var a=t[i],u=t[(i+1)%o];if(No(a,u,[n,e]))return!0;Io(a[1]-e)>0!=Io(u[1]-e)>0&&Io(n-(e-a[1])*(a[0]-u[0])/(a[1]-u[1])-a[0])<0&&(r=!r)}return r}function Xo(t,n,e){for(var r=!1,o=0;o<t.length;o++){if(r=qo(t[o],n,e))break}return r}function Ho(t,n){var e=t.parsedStyle,r=e.r,o=void 0===r?0:r,i=e.fill,a=e.stroke,u=e.lineWidth,c=void 0===u?0:u,s=e.clipPathTargets,f=c/2,h=ko(o,o,n.x,n.y),l=!!(null==s?void 0:s.length);return i&&a||l?h<=o+f:i?h<=o:!!a&&(h>=o-f&&h<=o+f)}function Fo(t,n,e,r){return t/(e*e)+n/(r*r)}function Go(t,n){var e=n.x,r=n.y,o=t.parsedStyle,i=o.rx,a=void 0===i?0:i,u=o.ry,c=void 0===u?0:u,s=o.fill,f=o.stroke,h=o.lineWidth,l=void 0===h?0:h,d=o.clipPathTargets,p=!!(null==d?void 0:d.length),v=l/2,y=(e-a)*(e-a),m=(r-c)*(r-c);return s&&f||p?Fo(y,m,a+v,c+v)<=1:s?Fo(y,m,a,c)<=1:!!f&&(Fo(y,m,a-v,c-v)>=1&&Fo(y,m,a+v,c+v)<=1)}function $o(t,n){var e=t.parsedStyle,r=e.x1,o=e.y1,i=e.x2,a=e.y2,u=e.lineWidth,c=void 0===u?0:u,s=e.defX,f=void 0===s?0:s,h=e.defY,l=void 0===h?0:h;return _o(r,o,i,a,c,n.x+f,n.y+l)}function Vo(t,n){var e=t.parsedStyle,r=e.stroke,o=e.lineWidth,i=void 0===o?0:o,a=e.points,u=e.defX,c=void 0===u?0:u,s=e.defY,f=void 0===s?0:s,h=e.clipPathTargets,l=!!(null==h?void 0:h.length);return!(!r&&!l||!i)&&Yo(a.points,i,n.x+c,n.y+f,!1)}function Uo(t,n,e){var r=t.parsedStyle,i=r.lineWidth,a=void 0===i?0:i,u=r.stroke,s=r.fill,f=r.defX,h=void 0===f?0:f,l=r.defY,d=void 0===l?0:l,p=r.clipPathTargets,v=r.path,y=v.segments,m=v.hasArc,g=v.polylines,M=v.polygons,b=v.totalLength,x=!!(null==p?void 0:p.length),P=!1;return(u||x)&&(P=function(t,n,e,r,i,a,u){for(var s=!1,f=n/2,h=0;h<t.length;h++){var l=t[h],d=l.currentPoint,p=l.params,v=l.prePoint,y=l.box;if(!y||Lo(y.x-f,y.y-f,y.width+n,y.height+n,e,r)){switch(l.command){case"L":case"Z":s=_o(v[0],v[1],d[0],d[1],n,e,r);break;case"Q":s=Co.pointDistance(v[0],v[1],p[1],p[2],p[3],p[4],e,r)<=n/2;break;case"C":s=To.pointDistance(v[0],v[1],p[1],p[2],p[3],p[4],p[5],p[6],e,r,i)<=n/2;break;case"A":var m=l.arcParams,g=m.cx,M=m.cy,b=m.rx,x=m.ry,P=m.startAngle,E=m.endAngle,O=m.xRotation,S=b>x?b:x,C=b>x?1:b/x,A=b>x?x/b:1,j=o.fromTranslation(o.create(),[-g,-M]);o.multiply(j,o.fromRotation(o.create(),-O),j),o.multiply(j,o.fromScaling(o.create(),[1/C,1/A]),j);var w=c.fromValues(e,r);s=Do(0,0,S,P,E,n,(w=c.transformMat3(w,w,j))[0],w[1])}if(s)break}}return s}(y,a,n.x+h,n.y+d,b)),P||!s&&!x||(P=m?e(t,n):Xo(M,n.x+h,n.y+d)||Xo(g,n.x+h,n.y+d)),P}function Wo(t,n,e){var r=t.parsedStyle,o=r.radius,i=r.fill,a=r.stroke,u=r.lineWidth,c=void 0===u?0:u,s=r.width,f=r.height,h=r.clipPathTargets,l=!!(null==h?void 0:h.length);if(o){var d=!1;return(a||l)&&(d=function(t,n,e,r,o,i,a,u){return _o(t+o,n,t+e-o,n,i,a,u)||_o(t+e,n+o,t+e,n+r-o,i,a,u)||_o(t+e-o,n+r,t+o,n+r,i,a,u)||_o(t,n+r-o,t,n+o,i,a,u)||Do(t+e-o,n+o,o,1.5*Math.PI,2*Math.PI,i,a,u)||Do(t+e-o,n+r-o,o,0,.5*Math.PI,i,a,u)||Do(t+o,n+r-o,o,.5*Math.PI,Math.PI,i,a,u)||Do(t+o,n+o,o,Math.PI,1.5*Math.PI,i,a,u)}(0,0,s,f,o,c,n.x,n.y)),d||!i&&!l||(d=e(t,n)),d}var p=c/2;return i&&a||l?Lo(0-p,0-p,s+p,f+p,n.x,n.y):i?Lo(0,0,s,f,n.x,n.y):!!a&&function(t,n,e,r,o,i,a){var u=o/2;return Lo(t-u,n-u,e,o,i,a)||Lo(t+e-u,n-u,o,r,i,a)||Lo(t+u,n+r-u,e,o,i,a)||Lo(t-u,n+u,o,r,i,a)}(0,0,s,f,c,n.x,n.y)}function zo(t,n){var e=t.parsedStyle,r=e.stroke,o=e.fill,i=e.lineWidth,a=void 0===i?0:i,u=e.points,c=e.defX,s=void 0===c?0:c,f=e.defY,h=void 0===f?0:f,l=e.clipPathTargets,d=!!(null==l?void 0:l.length),p=!1;return(r||d)&&(p=Yo(u.points,a,n.x+s,n.y+h,!0)),p||!o&&!d||(p=qo(u.points,n.x+s,n.y+h)),p}var Qo=Object(M.Module)((function(t){t({token:"PointInPathPicker",useFactory:function(t){return function(t){return t===g.SHAPE.Circle?Ho:t===g.SHAPE.Ellipse?Go:t===g.SHAPE.Rect?Wo:t===g.SHAPE.Line?$o:t===g.SHAPE.Polyline?Vo:t===g.SHAPE.Polygon?zo:t===g.SHAPE.Path?Uo:t===g.SHAPE.Image||t===g.SHAPE.Text?function(){return!0}:null}}}),t(vo)})),Zo=function(){function t(){}return t.prototype.init=function(t){t.load(Qo,!0)},t.prototype.destroy=function(t){t.remove("PointInPathPicker"),t.remove(vo)},t}(),Jo=function(){function t(){}var n;return n=t,t.prototype.apply=function(t){var e=this,r=function(t){var n=t.target;if(n.nodeName===g.SHAPE.HTML){var r=n.parsedStyle.innerHTML,o="g-html-"+n.entity,i=e.contextService.getDomElement().parentNode;if(i)if(!i.querySelector("#"+o)){var a=document.createElement("div");n.parsedStyle.$el=a,a.id=o,N(r)?a.innerHTML=r:a.appendChild(r),i.appendChild(a)}}},o=function(t){var n=t.target;if(n.nodeName===g.SHAPE.HTML){var r="g-html-"+n.entity,o=e.contextService.getDomElement().parentNode;if(o){var i=o.querySelector("#"+r);i&&o.removeChild(i)}}};t.hooks.init.tap(n.tag,(function(){e.renderingContext.root.addEventListener(g.ElementEvent.MOUNTED,r),e.renderingContext.root.addEventListener(g.ElementEvent.UNMOUNTED,o)})),t.hooks.destroy.tap(n.tag,(function(){e.renderingContext.root.removeEventListener(g.ElementEvent.MOUNTED,r),e.renderingContext.root.removeEventListener(g.ElementEvent.UNMOUNTED,o)})),t.hooks.render.tap(n.tag,(function(t){if(t.nodeName===g.SHAPE.HTML){var n="g-html-"+t.entity,r=e.contextService.getDomElement().parentNode;if(r){var o=r.querySelector("#"+n);e.updateCSSStyle(o,t.parsedStyle,t)}}}))},t.prototype.updateCSSStyle=function(t,n,e){var r=n.zIndex,o=void 0===r?0:r,i=n.visibility,a=void 0===i?"visible":i,u=n.opacity,c=void 0===u?1:u,s=n.fill,f=n.lineWidth,h=void 0===f?0:f,l=n.lineDash,d=n.stroke,p=n.anchor,v=n.width,y=void 0===v?0:v,m=n.height,M=void 0===m?0:m,b=n.style,x=void 0===b?"":b,P=n.className,E=void 0===P?"":P,O={position:"absolute",top:0,left:0};if(O.width=y+"px",O.height=M+"px",O.transform="matrix3d("+e.getWorldTransform().join(",")+")",p&&(O.transform+=" translate("+100*p[0]+"%, "+100*p[0]+"%)"),e.style.transformOrigin&&(O["transform-origin"]=e.style.transformOrigin),O["z-index"]=o,O.visibility=a,O.opacity=c,s){var S="";if(s.type===g.PARSED_COLOR_TYPE.Constant)S=s.formatted;else if(s.type===g.PARSED_COLOR_TYPE.LinearGradient){S="linear-gradient(to right, "+s.value.steps.map((function(t){return t[1]+" "+100*Number(t[0])+"%"})).join(",")+");"}else s.type===g.PARSED_COLOR_TYPE.RadialGradient||(s.type,g.PARSED_COLOR_TYPE.Pattern);O.background=S}O["border-width"]=h+"px",d&&d.type===g.PARSED_COLOR_TYPE.Constant&&(O["border-color"]=d.formatted,O["border-style"]="solid"),l&&(O["border-style"]="dashed"),e.style.filter&&(O.filter=e.style.filter),E&&(Array.isArray(E)?E.forEach((function(n){t.classList.add(n)})):t.classList.add(E)),t.setAttribute("style",Object.keys(O).map((function(t){return t+":"+O[t]})).join(";")+x)},t.tag="HTMLRenderingPlugin",p([Object(M.inject)(g.ContextService),v("design:type",Object)],t.prototype,"contextService",void 0),p([Object(M.inject)(g.RenderingContext),v("design:type",Object)],t.prototype,"renderingContext",void 0),t=n=p([Object(M.singleton)({contrib:g.RenderingPluginContribution})],t)}(),Ko=Object(M.Module)((function(t){t(Jo)})),ti=function(){function t(){}return t.prototype.init=function(t){t.load(Ko,!0)},t.prototype.destroy=function(t){t.remove(Jo)},t}(),ni="undefined"!=typeof window&&void 0!==window.document;var ei=function(){function t(){}return t.prototype.init=function(){var t=this.canvasConfig,n=t.container,e=t.canvas,r=t.devicePixelRatio;if(e)this.$canvas=e,n&&e.parentElement!==n&&n.appendChild(e),this.$container=e.parentElement,this.canvasConfig.container=this.$container;else if(n&&(this.$container=N(n)?document.getElementById(n):n,this.$container)){var o=document.createElement("canvas");this.$container.appendChild(o),this.$container.style.position||(this.$container.style.position="relative"),this.$canvas=o}this.context=this.$canvas.getContext("2d");var i=r||ni&&window.devicePixelRatio||1;i=i>=1?Math.ceil(i):1,this.dpr=i,this.resize(this.canvasConfig.width,this.canvasConfig.height)},t.prototype.getContext=function(){return this.context},t.prototype.getDomElement=function(){return this.$canvas},t.prototype.getDPR=function(){return this.dpr},t.prototype.getBoundingClientRect=function(){if(this.$canvas.getBoundingClientRect)return this.$canvas.getBoundingClientRect()},t.prototype.destroy=function(){this.$container&&this.$canvas&&this.$canvas.parentNode&&this.$container.removeChild(this.$canvas)},t.prototype.resize=function(t,n){if(this.$canvas){this.$canvas.width=this.dpr*t,this.$canvas.height=this.dpr*n,function(t,n,e){ni&&t.style&&(t.style.width=n+"px",t.style.height=e+"px")}(this.$canvas,t,n);var e=this.getDPR();this.context.scale(e,e)}},t.prototype.applyCursorStyle=function(t){this.$container&&this.$container.style&&(this.$container.style.cursor=t)},p([Object(M.inject)(g.CanvasConfig),v("design:type",Object)],t.prototype,"canvasConfig",void 0),t=p([Object(M.singleton)({token:g.ContextService})],t)}(),ri=Object(M.Module)((function(t){t(ei)})),oi=function(){function t(){}return t.prototype.init=function(t){t.load(ri,!0)},t.prototype.destroy=function(t){t.remove(ei)},t}(),ii=function(t){function n(n){var e=t.call(this,n)||this;return e.registerPlugin(new oi),e.registerPlugin(new po),e.registerPlugin(new O),e.registerPlugin(new Zo),e.registerPlugin(new ti),e}return function(t,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function e(){this.constructor=t}l(t,n),t.prototype=null===n?Object.create(n):(e.prototype=n.prototype,new e)}(n,t),n}(g.AbstractRenderer)}])}));
16
+ var l=function(t,n){return(l=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var e in n)Object.prototype.hasOwnProperty.call(n,e)&&(t[e]=n[e])})(t,n)};var d=function(){return(d=Object.assign||function(t){for(var n,e=1,r=arguments.length;e<r;e++)for(var o in n=arguments[e])Object.prototype.hasOwnProperty.call(n,o)&&(t[o]=n[o]);return t}).apply(this,arguments)};function p(t,n,e,r){var o,i=arguments.length,a=i<3?n:null===r?r=Object.getOwnPropertyDescriptor(n,e):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,n,e,r);else for(var u=t.length-1;u>=0;u--)(o=t[u])&&(a=(i<3?o(a):i>3?o(n,e,a):o(n,e))||a);return i>3&&a&&Object.defineProperty(n,e,a),a}function v(t,n){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,n)}Object.create;function y(t,n){var e="function"==typeof Symbol&&t[Symbol.iterator];if(!e)return t;var r,o,i=e.call(t),a=[];try{for(;(void 0===n||n-- >0)&&!(r=i.next()).done;)a.push(r.value)}catch(t){o={error:t}}finally{try{r&&!r.done&&(e=i.return)&&e.call(i)}finally{if(o)throw o.error}}return a}function m(t,n,e){if(e||2===arguments.length)for(var r,o=0,i=n.length;o<i;o++)!r&&o in n||(r||(r=Array.prototype.slice.call(n,0,o)),r[o]=n[o]);return t.concat(r||Array.prototype.slice.call(n))}Object.create;var g=e(0),M=e(1),b="ontouchstart"in self,x=!!self.PointerEvent;var P=function(){function t(){}var n;return n=t,t.prototype.apply=function(t){var e=this,r=function(n){t.hooks.pointerMove.call(n)},o=function(n){t.hooks.pointerUp.call(n)},i=function(n){t.hooks.pointerDown.call(n)},a=function(n){t.hooks.pointerOver.call(n)},u=function(n){t.hooks.pointerOut.call(n)},c=function(n){t.hooks.pointerWheel.call(n)};t.hooks.init.tap(n.tag,(function(){var t=e.contextService.getDomElement();x?(self.document.addEventListener("pointermove",r,!0),t.addEventListener("pointerdown",i,!0),t.addEventListener("pointerleave",u,!0),t.addEventListener("pointerover",a,!0),self.addEventListener("pointerup",o,!0)):(self.document.addEventListener("mousemove",r,!0),t.addEventListener("mousedown",i,!0),t.addEventListener("mouseout",u,!0),t.addEventListener("mouseover",a,!0),self.addEventListener("mouseup",o,!0)),b&&(t.addEventListener("touchstart",i,!0),t.addEventListener("touchend",o,!0),t.addEventListener("touchmove",r,!0)),t.addEventListener("wheel",c,{passive:!0,capture:!0})})),t.hooks.destroy.tap(n.tag,(function(){var t=e.contextService.getDomElement();x?(self.document.removeEventListener("pointermove",r,!0),t.removeEventListener("pointerdown",i,!0),t.removeEventListener("pointerleave",u,!0),t.removeEventListener("pointerover",a,!0),self.removeEventListener("pointerup",o,!0)):(self.document.removeEventListener("mousemove",r,!0),t.removeEventListener("mousedown",i,!0),t.removeEventListener("mouseout",u,!0),t.removeEventListener("mouseover",a,!0),self.removeEventListener("mouseup",o,!0)),b&&(t.removeEventListener("touchstart",i,!0),t.removeEventListener("touchend",o,!0),t.removeEventListener("touchmove",r,!0)),t.removeEventListener("wheel",c,!0)}))},t.tag="DOMInteractionPlugin",p([Object(M.inject)(g.ContextService),v("design:type",Object)],t.prototype,"contextService",void 0),t=n=p([Object(M.singleton)({contrib:g.RenderingPluginContribution})],t)}(),E=Object(M.Module)((function(t){t(P)})),O=function(){function t(){}return t.prototype.init=function(t){t.load(E,!0)},t.prototype.destroy=function(t){t.remove(P)},t}(),S=e(2),C=e.n(S),A=M.Syringe.defineToken("StyleRendererFactory"),j=M.Syringe.defineToken("StyleRenderer"),w={}.toString,R=function(t,n){return w.call(t)==="[object "+n+"]"},B=function(t){return R(t,"Function")},T=function(t){return null==t},k=function(t){return Array.isArray?Array.isArray(t):R(t,"Array")},L=function(t){var n=typeof t;return null!==t&&"object"===n||"function"===n};var D=function(t,n){if(t)if(k(t))for(var e=0,r=t.length;e<r&&!1!==n(t[e],e);e++);else if(L(t))for(var o in t)if(t.hasOwnProperty(o)&&!1===n(t[o],o))break};Object.keys;var _=function(t){if(k(t))return t.reduce((function(t,n){return Math.max(t,n)}),t[0])},Y=function(t){if(k(t))return t.reduce((function(t,n){return Math.min(t,n)}),t[0])},I=Array.prototype,N=(I.splice,I.indexOf,Array.prototype.splice,function(t){return R(t,"String")});Object.prototype.hasOwnProperty;var q=function(t){return R(t,"Number")};Number.isInteger&&Number.isInteger;Math.PI,parseInt,Math.PI;var X=Object.values?function(t){return Object.values(t)}:function(t){var n=[];return D(t,(function(e,r){B(t)&&"prototype"===r||n.push(e)})),n};Object.prototype;Object.prototype.hasOwnProperty;var H;Object.prototype.hasOwnProperty;(function(t,n){if(!B(t))throw new TypeError("Expected a function");var e=function(){for(var r=[],o=0;o<arguments.length;o++)r[o]=arguments[o];var i=n?n.apply(this,r):r[0],a=e.cache;if(a.has(i))return a.get(i);var u=t.apply(this,r);return a.set(i,u),u};e.cache=new Map})((function(t,n){void 0===n&&(n={});var e=n.fontSize,r=n.fontFamily,o=n.fontWeight,i=n.fontStyle,a=n.fontVariant;return H||(H=document.createElement("canvas").getContext("2d")),H.font=[i,a,o,e+"px",r].join(" "),H.measureText(N(t)?t:"").width}),(function(t,n){return void 0===n&&(n={}),function(){for(var t=0,n=0,e=arguments.length;n<e;n++)t+=arguments[n].length;var r=Array(t),o=0;for(n=0;n<e;n++)for(var i=arguments[n],a=0,u=i.length;a<u;a++,o++)r[o]=i[a];return r}([t],X(n)).join("")})),function(){function t(){this.map={}}t.prototype.has=function(t){return void 0!==this.map[t]},t.prototype.get=function(t,n){var e=this.map[t];return void 0===e?n:e},t.prototype.set=function(t,n){this.map[t]=n},t.prototype.clear=function(){this.map={}},t.prototype.delete=function(t){delete this.map[t]},t.prototype.size=function(){return Object.keys(this.map).length}}();var F=function(){function t(){}return t.prototype.hash=function(t){t.fill,t.opacity,t.fillOpacity,t.stroke,t.strokeOpacity,t.lineWidth,t.lineCap,t.lineJoin;return""},t.prototype.render=function(t,n){var e=n.fill,r=n.opacity,o=n.fillOpacity,i=n.stroke,a=n.strokeOpacity,u=n.lineWidth,c=n.lineCap,s=n.lineJoin,f=n.shadowColor,h=n.filter;if(T(e)||(T(o)||1===o?t.fill():(t.globalAlpha=o,t.fill(),t.globalAlpha=r)),!T(i)&&u&&u>0){!T(a)&&1!==a&&(t.globalAlpha=a),t.lineWidth=u,T(c)||(t.lineCap=c),T(s)||(t.lineJoin=s);var l=void 0,d=void 0,p=void 0,v=!T(f),y=!T(h);v&&(l=t.shadowBlur,d=t.shadowColor,T(l)||(t.shadowColor="transparent",t.shadowBlur=0)),y&&(p=t.filter,!T(p)&&p.indexOf("drop-shadow")>-1&&(t.filter=p.replace(/drop-shadow\([^)]*\)/,"").trim()||"none")),t.stroke(),v&&(t.shadowColor=d,t.shadowBlur=l),y&&(t.filter=p)}},t=p([Object(M.singleton)({token:[{token:j,named:g.SHAPE.Circle},{token:j,named:g.SHAPE.Ellipse},{token:j,named:g.SHAPE.Rect},{token:j,named:g.SHAPE.Line},{token:j,named:g.SHAPE.Polyline},{token:j,named:g.SHAPE.Polygon},{token:j,named:g.SHAPE.Path}]})],t)}(),G=function(){function t(){this.imageCache={},this.patternCache={}}return t.prototype.getImageSync=function(t){return this.imageCache[t]},t.prototype.getOrCreateImage=function(t){var n=this;return this.imageCache[t]?Promise.resolve(this.imageCache[t]):new Promise((function(e,r){var o=new window.Image;o.onload=function(){e(o)},o.onerror=function(t){r(t)},o.crossOrigin="Anonymous",o.src=t,n.imageCache[t]=o}))},t.prototype.getPatternSync=function(t){var n=this.generatePatternKey(t);if(this.patternCache[n])return this.patternCache[n]},t.prototype.createPattern=function(t,n){var e=this;return this.getOrCreateImage(t.src).then((function(r){var o=e.generatePatternKey(t),i=n.createPattern(r,t.repetition);return i&&(e.patternCache[o]=i),e.patternCache[o]}))},t.prototype.generatePatternKey=function(t){return"pattern-"+t.src+"-"+t.repetition},t=p([Object(M.singleton)()],t)}(),$=function(){function t(){}return t.prototype.hash=function(t){return""},t.prototype.render=function(t,n){var e,r=n.width,o=void 0===r?0:r,i=n.height,a=void 0===i?0:i,u=n.img,c=o,s=a;N(u)?e=this.imagePool.getImageSync(u):(c||(c=u.width),s||(s=u.height),e=u),t.drawImage(e,0,0,c,s)},p([Object(M.inject)(G),v("design:type",G)],t.prototype,"imagePool",void 0),t=p([Object(M.singleton)({token:{token:j,named:g.SHAPE.Image}})],t)}(),V=function(){function t(){}return t.prototype.hash=function(t){return""},t.prototype.render=function(t,n){n.text;var e=n.lineWidth,r=void 0===e?0:e,o=n.textAlign,i=n.textBaseline,a=n.lineJoin,u=n.miterLimit,c=void 0===u?0:u,s=n.letterSpacing,f=void 0===s?0:s,h=n.stroke,l=n.fill,d=n.fillOpacity,p=n.strokeOpacity,v=n.opacity,y=n.metrics,m=y.font,g=y.lines,M=y.height,b=y.lineHeight,x=y.lineMetrics;t.font=m,t.lineWidth=r,t.textAlign=o,t.textBaseline=i,t.lineJoin=a,t.miterLimit=c;var P=0;"middle"===i?P=-M/2-b/2:"bottom"===i||"alphabetic"===i||"ideographic"===i?P=-M:"top"!==i&&"hanging"!==i||(P=-b);for(var E=0;E<g.length;E++){var O=r/2;P+=b,!T(h)&&r&&this.drawLetterSpacing(t,g[E],x[E],o,O,P,f,d,p,v,!0),T(l)||this.drawLetterSpacing(t,g[E],x[E],o,O,P,f,d,p,v)}},t.prototype.drawLetterSpacing=function(t,n,e,r,o,i,a,u,c,s,f){if(void 0===f&&(f=!1),0!==a){var h=t.textAlign;t.textAlign="left";var l=o;"center"===r?l=o-e.width/2:"right"!==r&&"end"!==r||(l=o-e.width);for(var d=Array.from(n),p=t.measureText(n).width,v=0,y=0;y<d.length;++y){var m=d[y];f?this.strokeText(t,m,l,i,c):this.fillText(t,m,l,i,u,s),l+=p-(v=t.measureText(n.substring(y+1)).width)+a,p=v}t.textAlign=h}else f?this.strokeText(t,n,o,i,c):this.fillText(t,n,o,i,u,s)},t.prototype.fillText=function(t,n,e,r,o,i){var a,u=!T(o)&&1!==o;u&&(a=t.globalAlpha,t.globalAlpha=o*i),t.fillText(n,e,r),u&&(t.globalAlpha=a)},t.prototype.strokeText=function(t,n,e,r,o){var i,a=!T(o)&&1!==o;a&&(i=t.globalAlpha,t.globalAlpha=o),t.strokeText(n,e,r),a&&(t.globalAlpha=i)},p([Object(M.inject)(g.TextService),v("design:type",g.TextService)],t.prototype,"textService",void 0),t=p([Object(M.singleton)({token:{token:j,named:g.SHAPE.Text}})],t)}(),U=function(){function t(){this.gradientCache={}}return t.prototype.getOrCreateGradient=function(t,n){var e=this.generateCacheKey(t),r=t.type,o=t.x0,i=t.y0,a=t.x1,u=t.y1,c=t.steps,s=t.width,f=t.height;if(this.gradientCache[e])return this.gradientCache[e];var h=null;if(r===g.PARSED_COLOR_TYPE.LinearGradient)h=n.createLinearGradient(o*s,i*f,a*s,u*f);else if(r===g.PARSED_COLOR_TYPE.RadialGradient){var l=Math.sqrt(s*s+f*f)/2;h=n.createRadialGradient(o*s,i*f,0,a*s,u*f,t.r1*l)}return h&&(c.forEach((function(t){var n=y(t,2),e=n[0],r=n[1];null==h||h.addColorStop(Number(e),r)})),this.gradientCache[e]=h),this.gradientCache[e]},t.prototype.generateCacheKey=function(t){var n=t.type,e=t.x0,r=t.y0,o=t.x1,i=t.y1,a=t.r1,u=t.steps;return"gradient-"+n+"-"+e+"-"+r+"-"+o+"-"+i+"-"+(a||0)+"-"+t.width+"-"+t.height+"-"+u.map((function(t){return t.join("")})).join("-")},t=p([Object(M.singleton)()],t)}();var W="PathGeneratorFactory",z="PathGenerator",Q=1e-6,Z="undefined"!=typeof Float32Array?Float32Array:Array,J=Math.random;Math.PI;function K(){var t=new Z(9);return Z!=Float32Array&&(t[1]=0,t[2]=0,t[3]=0,t[5]=0,t[6]=0,t[7]=0),t[0]=1,t[4]=1,t[8]=1,t}function tt(t,n){return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[4],t[4]=n[5],t[5]=n[6],t[6]=n[8],t[7]=n[9],t[8]=n[10],t}function nt(t){var n=new Z(9);return n[0]=t[0],n[1]=t[1],n[2]=t[2],n[3]=t[3],n[4]=t[4],n[5]=t[5],n[6]=t[6],n[7]=t[7],n[8]=t[8],n}function et(t,n){return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],t}function rt(t,n,e,r,o,i,a,u,c){var s=new Z(9);return s[0]=t,s[1]=n,s[2]=e,s[3]=r,s[4]=o,s[5]=i,s[6]=a,s[7]=u,s[8]=c,s}function ot(t,n,e,r,o,i,a,u,c,s){return t[0]=n,t[1]=e,t[2]=r,t[3]=o,t[4]=i,t[5]=a,t[6]=u,t[7]=c,t[8]=s,t}function it(t){return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=1,t[5]=0,t[6]=0,t[7]=0,t[8]=1,t}function at(t,n){if(t===n){var e=n[1],r=n[2],o=n[5];t[1]=n[3],t[2]=n[6],t[3]=e,t[5]=n[7],t[6]=r,t[7]=o}else t[0]=n[0],t[1]=n[3],t[2]=n[6],t[3]=n[1],t[4]=n[4],t[5]=n[7],t[6]=n[2],t[7]=n[5],t[8]=n[8];return t}function ut(t,n){var e=n[0],r=n[1],o=n[2],i=n[3],a=n[4],u=n[5],c=n[6],s=n[7],f=n[8],h=f*a-u*s,l=-f*i+u*c,d=s*i-a*c,p=e*h+r*l+o*d;return p?(p=1/p,t[0]=h*p,t[1]=(-f*r+o*s)*p,t[2]=(u*r-o*a)*p,t[3]=l*p,t[4]=(f*e-o*c)*p,t[5]=(-u*e+o*i)*p,t[6]=d*p,t[7]=(-s*e+r*c)*p,t[8]=(a*e-r*i)*p,t):null}function ct(t,n){var e=n[0],r=n[1],o=n[2],i=n[3],a=n[4],u=n[5],c=n[6],s=n[7],f=n[8];return t[0]=a*f-u*s,t[1]=o*s-r*f,t[2]=r*u-o*a,t[3]=u*c-i*f,t[4]=e*f-o*c,t[5]=o*i-e*u,t[6]=i*s-a*c,t[7]=r*c-e*s,t[8]=e*a-r*i,t}function st(t){var n=t[0],e=t[1],r=t[2],o=t[3],i=t[4],a=t[5],u=t[6],c=t[7],s=t[8];return n*(s*i-a*c)+e*(-s*o+a*u)+r*(c*o-i*u)}function ft(t,n,e){var r=n[0],o=n[1],i=n[2],a=n[3],u=n[4],c=n[5],s=n[6],f=n[7],h=n[8],l=e[0],d=e[1],p=e[2],v=e[3],y=e[4],m=e[5],g=e[6],M=e[7],b=e[8];return t[0]=l*r+d*a+p*s,t[1]=l*o+d*u+p*f,t[2]=l*i+d*c+p*h,t[3]=v*r+y*a+m*s,t[4]=v*o+y*u+m*f,t[5]=v*i+y*c+m*h,t[6]=g*r+M*a+b*s,t[7]=g*o+M*u+b*f,t[8]=g*i+M*c+b*h,t}function ht(t,n,e){var r=n[0],o=n[1],i=n[2],a=n[3],u=n[4],c=n[5],s=n[6],f=n[7],h=n[8],l=e[0],d=e[1];return t[0]=r,t[1]=o,t[2]=i,t[3]=a,t[4]=u,t[5]=c,t[6]=l*r+d*a+s,t[7]=l*o+d*u+f,t[8]=l*i+d*c+h,t}function lt(t,n,e){var r=n[0],o=n[1],i=n[2],a=n[3],u=n[4],c=n[5],s=n[6],f=n[7],h=n[8],l=Math.sin(e),d=Math.cos(e);return t[0]=d*r+l*a,t[1]=d*o+l*u,t[2]=d*i+l*c,t[3]=d*a-l*r,t[4]=d*u-l*o,t[5]=d*c-l*i,t[6]=s,t[7]=f,t[8]=h,t}function dt(t,n,e){var r=e[0],o=e[1];return t[0]=r*n[0],t[1]=r*n[1],t[2]=r*n[2],t[3]=o*n[3],t[4]=o*n[4],t[5]=o*n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],t}function pt(t,n){return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=1,t[5]=0,t[6]=n[0],t[7]=n[1],t[8]=1,t}function vt(t,n){var e=Math.sin(n),r=Math.cos(n);return t[0]=r,t[1]=e,t[2]=0,t[3]=-e,t[4]=r,t[5]=0,t[6]=0,t[7]=0,t[8]=1,t}function yt(t,n){return t[0]=n[0],t[1]=0,t[2]=0,t[3]=0,t[4]=n[1],t[5]=0,t[6]=0,t[7]=0,t[8]=1,t}function mt(t,n){return t[0]=n[0],t[1]=n[1],t[2]=0,t[3]=n[2],t[4]=n[3],t[5]=0,t[6]=n[4],t[7]=n[5],t[8]=1,t}function gt(t,n){var e=n[0],r=n[1],o=n[2],i=n[3],a=e+e,u=r+r,c=o+o,s=e*a,f=r*a,h=r*u,l=o*a,d=o*u,p=o*c,v=i*a,y=i*u,m=i*c;return t[0]=1-h-p,t[3]=f-m,t[6]=l+y,t[1]=f+m,t[4]=1-s-p,t[7]=d-v,t[2]=l-y,t[5]=d+v,t[8]=1-s-h,t}function Mt(t,n){var e=n[0],r=n[1],o=n[2],i=n[3],a=n[4],u=n[5],c=n[6],s=n[7],f=n[8],h=n[9],l=n[10],d=n[11],p=n[12],v=n[13],y=n[14],m=n[15],g=e*u-r*a,M=e*c-o*a,b=e*s-i*a,x=r*c-o*u,P=r*s-i*u,E=o*s-i*c,O=f*v-h*p,S=f*y-l*p,C=f*m-d*p,A=h*y-l*v,j=h*m-d*v,w=l*m-d*y,R=g*w-M*j+b*A+x*C-P*S+E*O;return R?(R=1/R,t[0]=(u*w-c*j+s*A)*R,t[1]=(c*C-a*w-s*S)*R,t[2]=(a*j-u*C+s*O)*R,t[3]=(o*j-r*w-i*A)*R,t[4]=(e*w-o*C+i*S)*R,t[5]=(r*C-e*j-i*O)*R,t[6]=(v*E-y*P+m*x)*R,t[7]=(y*b-p*E-m*M)*R,t[8]=(p*P-v*b+m*g)*R,t):null}function bt(t,n,e){return t[0]=2/n,t[1]=0,t[2]=0,t[3]=0,t[4]=-2/e,t[5]=0,t[6]=-1,t[7]=1,t[8]=1,t}function xt(t){return"mat3("+t[0]+", "+t[1]+", "+t[2]+", "+t[3]+", "+t[4]+", "+t[5]+", "+t[6]+", "+t[7]+", "+t[8]+")"}function Pt(t){return Math.hypot(t[0],t[1],t[2],t[3],t[4],t[5],t[6],t[7],t[8])}function Et(t,n,e){return t[0]=n[0]+e[0],t[1]=n[1]+e[1],t[2]=n[2]+e[2],t[3]=n[3]+e[3],t[4]=n[4]+e[4],t[5]=n[5]+e[5],t[6]=n[6]+e[6],t[7]=n[7]+e[7],t[8]=n[8]+e[8],t}function Ot(t,n,e){return t[0]=n[0]-e[0],t[1]=n[1]-e[1],t[2]=n[2]-e[2],t[3]=n[3]-e[3],t[4]=n[4]-e[4],t[5]=n[5]-e[5],t[6]=n[6]-e[6],t[7]=n[7]-e[7],t[8]=n[8]-e[8],t}function St(t,n,e){return t[0]=n[0]*e,t[1]=n[1]*e,t[2]=n[2]*e,t[3]=n[3]*e,t[4]=n[4]*e,t[5]=n[5]*e,t[6]=n[6]*e,t[7]=n[7]*e,t[8]=n[8]*e,t}function Ct(t,n,e,r){return t[0]=n[0]+e[0]*r,t[1]=n[1]+e[1]*r,t[2]=n[2]+e[2]*r,t[3]=n[3]+e[3]*r,t[4]=n[4]+e[4]*r,t[5]=n[5]+e[5]*r,t[6]=n[6]+e[6]*r,t[7]=n[7]+e[7]*r,t[8]=n[8]+e[8]*r,t}function At(t,n){return t[0]===n[0]&&t[1]===n[1]&&t[2]===n[2]&&t[3]===n[3]&&t[4]===n[4]&&t[5]===n[5]&&t[6]===n[6]&&t[7]===n[7]&&t[8]===n[8]}function jt(t,n){var e=t[0],r=t[1],o=t[2],i=t[3],a=t[4],u=t[5],c=t[6],s=t[7],f=t[8],h=n[0],l=n[1],d=n[2],p=n[3],v=n[4],y=n[5],m=n[6],g=n[7],M=n[8];return Math.abs(e-h)<=Q*Math.max(1,Math.abs(e),Math.abs(h))&&Math.abs(r-l)<=Q*Math.max(1,Math.abs(r),Math.abs(l))&&Math.abs(o-d)<=Q*Math.max(1,Math.abs(o),Math.abs(d))&&Math.abs(i-p)<=Q*Math.max(1,Math.abs(i),Math.abs(p))&&Math.abs(a-v)<=Q*Math.max(1,Math.abs(a),Math.abs(v))&&Math.abs(u-y)<=Q*Math.max(1,Math.abs(u),Math.abs(y))&&Math.abs(c-m)<=Q*Math.max(1,Math.abs(c),Math.abs(m))&&Math.abs(s-g)<=Q*Math.max(1,Math.abs(s),Math.abs(g))&&Math.abs(f-M)<=Q*Math.max(1,Math.abs(f),Math.abs(M))}Math.hypot||(Math.hypot=function(){for(var t=0,n=arguments.length;n--;)t+=arguments[n]*arguments[n];return Math.sqrt(t)});var wt=ft,Rt=Ot;function Bt(){var t=new Z(16);return Z!=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 Tt(t){var n=new Z(16);return n[0]=t[0],n[1]=t[1],n[2]=t[2],n[3]=t[3],n[4]=t[4],n[5]=t[5],n[6]=t[6],n[7]=t[7],n[8]=t[8],n[9]=t[9],n[10]=t[10],n[11]=t[11],n[12]=t[12],n[13]=t[13],n[14]=t[14],n[15]=t[15],n}function kt(t,n){return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],t[9]=n[9],t[10]=n[10],t[11]=n[11],t[12]=n[12],t[13]=n[13],t[14]=n[14],t[15]=n[15],t}function Lt(t,n,e,r,o,i,a,u,c,s,f,h,l,d,p,v){var y=new Z(16);return y[0]=t,y[1]=n,y[2]=e,y[3]=r,y[4]=o,y[5]=i,y[6]=a,y[7]=u,y[8]=c,y[9]=s,y[10]=f,y[11]=h,y[12]=l,y[13]=d,y[14]=p,y[15]=v,y}function Dt(t,n,e,r,o,i,a,u,c,s,f,h,l,d,p,v,y){return t[0]=n,t[1]=e,t[2]=r,t[3]=o,t[4]=i,t[5]=a,t[6]=u,t[7]=c,t[8]=s,t[9]=f,t[10]=h,t[11]=l,t[12]=d,t[13]=p,t[14]=v,t[15]=y,t}function _t(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}function Yt(t,n){if(t===n){var e=n[1],r=n[2],o=n[3],i=n[6],a=n[7],u=n[11];t[1]=n[4],t[2]=n[8],t[3]=n[12],t[4]=e,t[6]=n[9],t[7]=n[13],t[8]=r,t[9]=i,t[11]=n[14],t[12]=o,t[13]=a,t[14]=u}else t[0]=n[0],t[1]=n[4],t[2]=n[8],t[3]=n[12],t[4]=n[1],t[5]=n[5],t[6]=n[9],t[7]=n[13],t[8]=n[2],t[9]=n[6],t[10]=n[10],t[11]=n[14],t[12]=n[3],t[13]=n[7],t[14]=n[11],t[15]=n[15];return t}function It(t,n){var e=n[0],r=n[1],o=n[2],i=n[3],a=n[4],u=n[5],c=n[6],s=n[7],f=n[8],h=n[9],l=n[10],d=n[11],p=n[12],v=n[13],y=n[14],m=n[15],g=e*u-r*a,M=e*c-o*a,b=e*s-i*a,x=r*c-o*u,P=r*s-i*u,E=o*s-i*c,O=f*v-h*p,S=f*y-l*p,C=f*m-d*p,A=h*y-l*v,j=h*m-d*v,w=l*m-d*y,R=g*w-M*j+b*A+x*C-P*S+E*O;return R?(R=1/R,t[0]=(u*w-c*j+s*A)*R,t[1]=(o*j-r*w-i*A)*R,t[2]=(v*E-y*P+m*x)*R,t[3]=(l*P-h*E-d*x)*R,t[4]=(c*C-a*w-s*S)*R,t[5]=(e*w-o*C+i*S)*R,t[6]=(y*b-p*E-m*M)*R,t[7]=(f*E-l*b+d*M)*R,t[8]=(a*j-u*C+s*O)*R,t[9]=(r*C-e*j-i*O)*R,t[10]=(p*P-v*b+m*g)*R,t[11]=(h*b-f*P-d*g)*R,t[12]=(u*S-a*A-c*O)*R,t[13]=(e*A-r*S+o*O)*R,t[14]=(v*M-p*x-y*g)*R,t[15]=(f*x-h*M+l*g)*R,t):null}function Nt(t,n){var e=n[0],r=n[1],o=n[2],i=n[3],a=n[4],u=n[5],c=n[6],s=n[7],f=n[8],h=n[9],l=n[10],d=n[11],p=n[12],v=n[13],y=n[14],m=n[15];return t[0]=u*(l*m-d*y)-h*(c*m-s*y)+v*(c*d-s*l),t[1]=-(r*(l*m-d*y)-h*(o*m-i*y)+v*(o*d-i*l)),t[2]=r*(c*m-s*y)-u*(o*m-i*y)+v*(o*s-i*c),t[3]=-(r*(c*d-s*l)-u*(o*d-i*l)+h*(o*s-i*c)),t[4]=-(a*(l*m-d*y)-f*(c*m-s*y)+p*(c*d-s*l)),t[5]=e*(l*m-d*y)-f*(o*m-i*y)+p*(o*d-i*l),t[6]=-(e*(c*m-s*y)-a*(o*m-i*y)+p*(o*s-i*c)),t[7]=e*(c*d-s*l)-a*(o*d-i*l)+f*(o*s-i*c),t[8]=a*(h*m-d*v)-f*(u*m-s*v)+p*(u*d-s*h),t[9]=-(e*(h*m-d*v)-f*(r*m-i*v)+p*(r*d-i*h)),t[10]=e*(u*m-s*v)-a*(r*m-i*v)+p*(r*s-i*u),t[11]=-(e*(u*d-s*h)-a*(r*d-i*h)+f*(r*s-i*u)),t[12]=-(a*(h*y-l*v)-f*(u*y-c*v)+p*(u*l-c*h)),t[13]=e*(h*y-l*v)-f*(r*y-o*v)+p*(r*l-o*h),t[14]=-(e*(u*y-c*v)-a*(r*y-o*v)+p*(r*c-o*u)),t[15]=e*(u*l-c*h)-a*(r*l-o*h)+f*(r*c-o*u),t}function qt(t){var n=t[0],e=t[1],r=t[2],o=t[3],i=t[4],a=t[5],u=t[6],c=t[7],s=t[8],f=t[9],h=t[10],l=t[11],d=t[12],p=t[13],v=t[14],y=t[15];return(n*a-e*i)*(h*y-l*v)-(n*u-r*i)*(f*y-l*p)+(n*c-o*i)*(f*v-h*p)+(e*u-r*a)*(s*y-l*d)-(e*c-o*a)*(s*v-h*d)+(r*c-o*u)*(s*p-f*d)}function Xt(t,n,e){var r=n[0],o=n[1],i=n[2],a=n[3],u=n[4],c=n[5],s=n[6],f=n[7],h=n[8],l=n[9],d=n[10],p=n[11],v=n[12],y=n[13],m=n[14],g=n[15],M=e[0],b=e[1],x=e[2],P=e[3];return t[0]=M*r+b*u+x*h+P*v,t[1]=M*o+b*c+x*l+P*y,t[2]=M*i+b*s+x*d+P*m,t[3]=M*a+b*f+x*p+P*g,M=e[4],b=e[5],x=e[6],P=e[7],t[4]=M*r+b*u+x*h+P*v,t[5]=M*o+b*c+x*l+P*y,t[6]=M*i+b*s+x*d+P*m,t[7]=M*a+b*f+x*p+P*g,M=e[8],b=e[9],x=e[10],P=e[11],t[8]=M*r+b*u+x*h+P*v,t[9]=M*o+b*c+x*l+P*y,t[10]=M*i+b*s+x*d+P*m,t[11]=M*a+b*f+x*p+P*g,M=e[12],b=e[13],x=e[14],P=e[15],t[12]=M*r+b*u+x*h+P*v,t[13]=M*o+b*c+x*l+P*y,t[14]=M*i+b*s+x*d+P*m,t[15]=M*a+b*f+x*p+P*g,t}function Ht(t,n,e){var r,o,i,a,u,c,s,f,h,l,d,p,v=e[0],y=e[1],m=e[2];return n===t?(t[12]=n[0]*v+n[4]*y+n[8]*m+n[12],t[13]=n[1]*v+n[5]*y+n[9]*m+n[13],t[14]=n[2]*v+n[6]*y+n[10]*m+n[14],t[15]=n[3]*v+n[7]*y+n[11]*m+n[15]):(r=n[0],o=n[1],i=n[2],a=n[3],u=n[4],c=n[5],s=n[6],f=n[7],h=n[8],l=n[9],d=n[10],p=n[11],t[0]=r,t[1]=o,t[2]=i,t[3]=a,t[4]=u,t[5]=c,t[6]=s,t[7]=f,t[8]=h,t[9]=l,t[10]=d,t[11]=p,t[12]=r*v+u*y+h*m+n[12],t[13]=o*v+c*y+l*m+n[13],t[14]=i*v+s*y+d*m+n[14],t[15]=a*v+f*y+p*m+n[15]),t}function Ft(t,n,e){var r=e[0],o=e[1],i=e[2];return t[0]=n[0]*r,t[1]=n[1]*r,t[2]=n[2]*r,t[3]=n[3]*r,t[4]=n[4]*o,t[5]=n[5]*o,t[6]=n[6]*o,t[7]=n[7]*o,t[8]=n[8]*i,t[9]=n[9]*i,t[10]=n[10]*i,t[11]=n[11]*i,t[12]=n[12],t[13]=n[13],t[14]=n[14],t[15]=n[15],t}function Gt(t,n,e,r){var o,i,a,u,c,s,f,h,l,d,p,v,y,m,g,M,b,x,P,E,O,S,C,A,j=r[0],w=r[1],R=r[2],B=Math.hypot(j,w,R);return B<Q?null:(j*=B=1/B,w*=B,R*=B,o=Math.sin(e),a=1-(i=Math.cos(e)),u=n[0],c=n[1],s=n[2],f=n[3],h=n[4],l=n[5],d=n[6],p=n[7],v=n[8],y=n[9],m=n[10],g=n[11],M=j*j*a+i,b=w*j*a+R*o,x=R*j*a-w*o,P=j*w*a-R*o,E=w*w*a+i,O=R*w*a+j*o,S=j*R*a+w*o,C=w*R*a-j*o,A=R*R*a+i,t[0]=u*M+h*b+v*x,t[1]=c*M+l*b+y*x,t[2]=s*M+d*b+m*x,t[3]=f*M+p*b+g*x,t[4]=u*P+h*E+v*O,t[5]=c*P+l*E+y*O,t[6]=s*P+d*E+m*O,t[7]=f*P+p*E+g*O,t[8]=u*S+h*C+v*A,t[9]=c*S+l*C+y*A,t[10]=s*S+d*C+m*A,t[11]=f*S+p*C+g*A,n!==t&&(t[12]=n[12],t[13]=n[13],t[14]=n[14],t[15]=n[15]),t)}function $t(t,n,e){var r=Math.sin(e),o=Math.cos(e),i=n[4],a=n[5],u=n[6],c=n[7],s=n[8],f=n[9],h=n[10],l=n[11];return n!==t&&(t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[12]=n[12],t[13]=n[13],t[14]=n[14],t[15]=n[15]),t[4]=i*o+s*r,t[5]=a*o+f*r,t[6]=u*o+h*r,t[7]=c*o+l*r,t[8]=s*o-i*r,t[9]=f*o-a*r,t[10]=h*o-u*r,t[11]=l*o-c*r,t}function Vt(t,n,e){var r=Math.sin(e),o=Math.cos(e),i=n[0],a=n[1],u=n[2],c=n[3],s=n[8],f=n[9],h=n[10],l=n[11];return n!==t&&(t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[12]=n[12],t[13]=n[13],t[14]=n[14],t[15]=n[15]),t[0]=i*o-s*r,t[1]=a*o-f*r,t[2]=u*o-h*r,t[3]=c*o-l*r,t[8]=i*r+s*o,t[9]=a*r+f*o,t[10]=u*r+h*o,t[11]=c*r+l*o,t}function Ut(t,n,e){var r=Math.sin(e),o=Math.cos(e),i=n[0],a=n[1],u=n[2],c=n[3],s=n[4],f=n[5],h=n[6],l=n[7];return n!==t&&(t[8]=n[8],t[9]=n[9],t[10]=n[10],t[11]=n[11],t[12]=n[12],t[13]=n[13],t[14]=n[14],t[15]=n[15]),t[0]=i*o+s*r,t[1]=a*o+f*r,t[2]=u*o+h*r,t[3]=c*o+l*r,t[4]=s*o-i*r,t[5]=f*o-a*r,t[6]=h*o-u*r,t[7]=l*o-c*r,t}function Wt(t,n){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]=n[0],t[13]=n[1],t[14]=n[2],t[15]=1,t}function zt(t,n){return t[0]=n[0],t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=n[1],t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=n[2],t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}function Qt(t,n,e){var r,o,i,a=e[0],u=e[1],c=e[2],s=Math.hypot(a,u,c);return s<Q?null:(a*=s=1/s,u*=s,c*=s,r=Math.sin(n),i=1-(o=Math.cos(n)),t[0]=a*a*i+o,t[1]=u*a*i+c*r,t[2]=c*a*i-u*r,t[3]=0,t[4]=a*u*i-c*r,t[5]=u*u*i+o,t[6]=c*u*i+a*r,t[7]=0,t[8]=a*c*i+u*r,t[9]=u*c*i-a*r,t[10]=c*c*i+o,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t)}function Zt(t,n){var e=Math.sin(n),r=Math.cos(n);return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=r,t[6]=e,t[7]=0,t[8]=0,t[9]=-e,t[10]=r,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}function Jt(t,n){var e=Math.sin(n),r=Math.cos(n);return t[0]=r,t[1]=0,t[2]=-e,t[3]=0,t[4]=0,t[5]=1,t[6]=0,t[7]=0,t[8]=e,t[9]=0,t[10]=r,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}function Kt(t,n){var e=Math.sin(n),r=Math.cos(n);return t[0]=r,t[1]=e,t[2]=0,t[3]=0,t[4]=-e,t[5]=r,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}function tn(t,n,e){var r=n[0],o=n[1],i=n[2],a=n[3],u=r+r,c=o+o,s=i+i,f=r*u,h=r*c,l=r*s,d=o*c,p=o*s,v=i*s,y=a*u,m=a*c,g=a*s;return t[0]=1-(d+v),t[1]=h+g,t[2]=l-m,t[3]=0,t[4]=h-g,t[5]=1-(f+v),t[6]=p+y,t[7]=0,t[8]=l+m,t[9]=p-y,t[10]=1-(f+d),t[11]=0,t[12]=e[0],t[13]=e[1],t[14]=e[2],t[15]=1,t}function nn(t,n){var e=new Z(3),r=-n[0],o=-n[1],i=-n[2],a=n[3],u=n[4],c=n[5],s=n[6],f=n[7],h=r*r+o*o+i*i+a*a;return h>0?(e[0]=2*(u*a+f*r+c*i-s*o)/h,e[1]=2*(c*a+f*o+s*r-u*i)/h,e[2]=2*(s*a+f*i+u*o-c*r)/h):(e[0]=2*(u*a+f*r+c*i-s*o),e[1]=2*(c*a+f*o+s*r-u*i),e[2]=2*(s*a+f*i+u*o-c*r)),tn(t,n,e),t}function en(t,n){return t[0]=n[12],t[1]=n[13],t[2]=n[14],t}function rn(t,n){var e=n[0],r=n[1],o=n[2],i=n[4],a=n[5],u=n[6],c=n[8],s=n[9],f=n[10];return t[0]=Math.hypot(e,r,o),t[1]=Math.hypot(i,a,u),t[2]=Math.hypot(c,s,f),t}function on(t,n){var e=new Z(3);rn(e,n);var r=1/e[0],o=1/e[1],i=1/e[2],a=n[0]*r,u=n[1]*o,c=n[2]*i,s=n[4]*r,f=n[5]*o,h=n[6]*i,l=n[8]*r,d=n[9]*o,p=n[10]*i,v=a+f+p,y=0;return v>0?(y=2*Math.sqrt(v+1),t[3]=.25*y,t[0]=(h-d)/y,t[1]=(l-c)/y,t[2]=(u-s)/y):a>f&&a>p?(y=2*Math.sqrt(1+a-f-p),t[3]=(h-d)/y,t[0]=.25*y,t[1]=(u+s)/y,t[2]=(l+c)/y):f>p?(y=2*Math.sqrt(1+f-a-p),t[3]=(l-c)/y,t[0]=(u+s)/y,t[1]=.25*y,t[2]=(h+d)/y):(y=2*Math.sqrt(1+p-a-f),t[3]=(u-s)/y,t[0]=(l+c)/y,t[1]=(h+d)/y,t[2]=.25*y),t}function an(t,n,e,r){var o=n[0],i=n[1],a=n[2],u=n[3],c=o+o,s=i+i,f=a+a,h=o*c,l=o*s,d=o*f,p=i*s,v=i*f,y=a*f,m=u*c,g=u*s,M=u*f,b=r[0],x=r[1],P=r[2];return t[0]=(1-(p+y))*b,t[1]=(l+M)*b,t[2]=(d-g)*b,t[3]=0,t[4]=(l-M)*x,t[5]=(1-(h+y))*x,t[6]=(v+m)*x,t[7]=0,t[8]=(d+g)*P,t[9]=(v-m)*P,t[10]=(1-(h+p))*P,t[11]=0,t[12]=e[0],t[13]=e[1],t[14]=e[2],t[15]=1,t}function un(t,n,e,r,o){var i=n[0],a=n[1],u=n[2],c=n[3],s=i+i,f=a+a,h=u+u,l=i*s,d=i*f,p=i*h,v=a*f,y=a*h,m=u*h,g=c*s,M=c*f,b=c*h,x=r[0],P=r[1],E=r[2],O=o[0],S=o[1],C=o[2],A=(1-(v+m))*x,j=(d+b)*x,w=(p-M)*x,R=(d-b)*P,B=(1-(l+m))*P,T=(y+g)*P,k=(p+M)*E,L=(y-g)*E,D=(1-(l+v))*E;return t[0]=A,t[1]=j,t[2]=w,t[3]=0,t[4]=R,t[5]=B,t[6]=T,t[7]=0,t[8]=k,t[9]=L,t[10]=D,t[11]=0,t[12]=e[0]+O-(A*O+R*S+k*C),t[13]=e[1]+S-(j*O+B*S+L*C),t[14]=e[2]+C-(w*O+T*S+D*C),t[15]=1,t}function cn(t,n){var e=n[0],r=n[1],o=n[2],i=n[3],a=e+e,u=r+r,c=o+o,s=e*a,f=r*a,h=r*u,l=o*a,d=o*u,p=o*c,v=i*a,y=i*u,m=i*c;return t[0]=1-h-p,t[1]=f+m,t[2]=l-y,t[3]=0,t[4]=f-m,t[5]=1-s-p,t[6]=d+v,t[7]=0,t[8]=l+y,t[9]=d-v,t[10]=1-s-h,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}function sn(t,n,e,r,o,i,a){var u=1/(e-n),c=1/(o-r),s=1/(i-a);return t[0]=2*i*u,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=2*i*c,t[6]=0,t[7]=0,t[8]=(e+n)*u,t[9]=(o+r)*c,t[10]=(a+i)*s,t[11]=-1,t[12]=0,t[13]=0,t[14]=a*i*2*s,t[15]=0,t}function fn(t,n,e,r,o){var i,a=1/Math.tan(n/2);return t[0]=a/e,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=a,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[11]=-1,t[12]=0,t[13]=0,t[15]=0,null!=o&&o!==1/0?(i=1/(r-o),t[10]=(o+r)*i,t[14]=2*o*r*i):(t[10]=-1,t[14]=-2*r),t}var hn=fn;function ln(t,n,e,r,o){var i,a=1/Math.tan(n/2);return t[0]=a/e,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=a,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[11]=-1,t[12]=0,t[13]=0,t[15]=0,null!=o&&o!==1/0?(i=1/(r-o),t[10]=o*i,t[14]=o*r*i):(t[10]=-1,t[14]=-r),t}function dn(t,n,e,r){var o=Math.tan(n.upDegrees*Math.PI/180),i=Math.tan(n.downDegrees*Math.PI/180),a=Math.tan(n.leftDegrees*Math.PI/180),u=Math.tan(n.rightDegrees*Math.PI/180),c=2/(a+u),s=2/(o+i);return t[0]=c,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=s,t[6]=0,t[7]=0,t[8]=-(a-u)*c*.5,t[9]=(o-i)*s*.5,t[10]=r/(e-r),t[11]=-1,t[12]=0,t[13]=0,t[14]=r*e/(e-r),t[15]=0,t}function pn(t,n,e,r,o,i,a){var u=1/(n-e),c=1/(r-o),s=1/(i-a);return t[0]=-2*u,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=-2*c,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=2*s,t[11]=0,t[12]=(n+e)*u,t[13]=(o+r)*c,t[14]=(a+i)*s,t[15]=1,t}var vn=pn;function yn(t,n,e,r,o,i,a){var u=1/(n-e),c=1/(r-o),s=1/(i-a);return t[0]=-2*u,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=-2*c,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=s,t[11]=0,t[12]=(n+e)*u,t[13]=(o+r)*c,t[14]=i*s,t[15]=1,t}function mn(t,n,e,r){var o,i,a,u,c,s,f,h,l,d,p=n[0],v=n[1],y=n[2],m=r[0],g=r[1],M=r[2],b=e[0],x=e[1],P=e[2];return Math.abs(p-b)<Q&&Math.abs(v-x)<Q&&Math.abs(y-P)<Q?_t(t):(f=p-b,h=v-x,l=y-P,o=g*(l*=d=1/Math.hypot(f,h,l))-M*(h*=d),i=M*(f*=d)-m*l,a=m*h-g*f,(d=Math.hypot(o,i,a))?(o*=d=1/d,i*=d,a*=d):(o=0,i=0,a=0),u=h*a-l*i,c=l*o-f*a,s=f*i-h*o,(d=Math.hypot(u,c,s))?(u*=d=1/d,c*=d,s*=d):(u=0,c=0,s=0),t[0]=o,t[1]=u,t[2]=f,t[3]=0,t[4]=i,t[5]=c,t[6]=h,t[7]=0,t[8]=a,t[9]=s,t[10]=l,t[11]=0,t[12]=-(o*p+i*v+a*y),t[13]=-(u*p+c*v+s*y),t[14]=-(f*p+h*v+l*y),t[15]=1,t)}function gn(t,n,e,r){var o=n[0],i=n[1],a=n[2],u=r[0],c=r[1],s=r[2],f=o-e[0],h=i-e[1],l=a-e[2],d=f*f+h*h+l*l;d>0&&(f*=d=1/Math.sqrt(d),h*=d,l*=d);var p=c*l-s*h,v=s*f-u*l,y=u*h-c*f;return(d=p*p+v*v+y*y)>0&&(p*=d=1/Math.sqrt(d),v*=d,y*=d),t[0]=p,t[1]=v,t[2]=y,t[3]=0,t[4]=h*y-l*v,t[5]=l*p-f*y,t[6]=f*v-h*p,t[7]=0,t[8]=f,t[9]=h,t[10]=l,t[11]=0,t[12]=o,t[13]=i,t[14]=a,t[15]=1,t}function Mn(t){return"mat4("+t[0]+", "+t[1]+", "+t[2]+", "+t[3]+", "+t[4]+", "+t[5]+", "+t[6]+", "+t[7]+", "+t[8]+", "+t[9]+", "+t[10]+", "+t[11]+", "+t[12]+", "+t[13]+", "+t[14]+", "+t[15]+")"}function bn(t){return Math.hypot(t[0],t[1],t[2],t[3],t[4],t[5],t[6],t[7],t[8],t[9],t[10],t[11],t[12],t[13],t[14],t[15])}function xn(t,n,e){return t[0]=n[0]+e[0],t[1]=n[1]+e[1],t[2]=n[2]+e[2],t[3]=n[3]+e[3],t[4]=n[4]+e[4],t[5]=n[5]+e[5],t[6]=n[6]+e[6],t[7]=n[7]+e[7],t[8]=n[8]+e[8],t[9]=n[9]+e[9],t[10]=n[10]+e[10],t[11]=n[11]+e[11],t[12]=n[12]+e[12],t[13]=n[13]+e[13],t[14]=n[14]+e[14],t[15]=n[15]+e[15],t}function Pn(t,n,e){return t[0]=n[0]-e[0],t[1]=n[1]-e[1],t[2]=n[2]-e[2],t[3]=n[3]-e[3],t[4]=n[4]-e[4],t[5]=n[5]-e[5],t[6]=n[6]-e[6],t[7]=n[7]-e[7],t[8]=n[8]-e[8],t[9]=n[9]-e[9],t[10]=n[10]-e[10],t[11]=n[11]-e[11],t[12]=n[12]-e[12],t[13]=n[13]-e[13],t[14]=n[14]-e[14],t[15]=n[15]-e[15],t}function En(t,n,e){return t[0]=n[0]*e,t[1]=n[1]*e,t[2]=n[2]*e,t[3]=n[3]*e,t[4]=n[4]*e,t[5]=n[5]*e,t[6]=n[6]*e,t[7]=n[7]*e,t[8]=n[8]*e,t[9]=n[9]*e,t[10]=n[10]*e,t[11]=n[11]*e,t[12]=n[12]*e,t[13]=n[13]*e,t[14]=n[14]*e,t[15]=n[15]*e,t}function On(t,n,e,r){return t[0]=n[0]+e[0]*r,t[1]=n[1]+e[1]*r,t[2]=n[2]+e[2]*r,t[3]=n[3]+e[3]*r,t[4]=n[4]+e[4]*r,t[5]=n[5]+e[5]*r,t[6]=n[6]+e[6]*r,t[7]=n[7]+e[7]*r,t[8]=n[8]+e[8]*r,t[9]=n[9]+e[9]*r,t[10]=n[10]+e[10]*r,t[11]=n[11]+e[11]*r,t[12]=n[12]+e[12]*r,t[13]=n[13]+e[13]*r,t[14]=n[14]+e[14]*r,t[15]=n[15]+e[15]*r,t}function Sn(t,n){return t[0]===n[0]&&t[1]===n[1]&&t[2]===n[2]&&t[3]===n[3]&&t[4]===n[4]&&t[5]===n[5]&&t[6]===n[6]&&t[7]===n[7]&&t[8]===n[8]&&t[9]===n[9]&&t[10]===n[10]&&t[11]===n[11]&&t[12]===n[12]&&t[13]===n[13]&&t[14]===n[14]&&t[15]===n[15]}function Cn(t,n){var e=t[0],r=t[1],o=t[2],i=t[3],a=t[4],u=t[5],c=t[6],s=t[7],f=t[8],h=t[9],l=t[10],d=t[11],p=t[12],v=t[13],y=t[14],m=t[15],g=n[0],M=n[1],b=n[2],x=n[3],P=n[4],E=n[5],O=n[6],S=n[7],C=n[8],A=n[9],j=n[10],w=n[11],R=n[12],B=n[13],T=n[14],k=n[15];return Math.abs(e-g)<=Q*Math.max(1,Math.abs(e),Math.abs(g))&&Math.abs(r-M)<=Q*Math.max(1,Math.abs(r),Math.abs(M))&&Math.abs(o-b)<=Q*Math.max(1,Math.abs(o),Math.abs(b))&&Math.abs(i-x)<=Q*Math.max(1,Math.abs(i),Math.abs(x))&&Math.abs(a-P)<=Q*Math.max(1,Math.abs(a),Math.abs(P))&&Math.abs(u-E)<=Q*Math.max(1,Math.abs(u),Math.abs(E))&&Math.abs(c-O)<=Q*Math.max(1,Math.abs(c),Math.abs(O))&&Math.abs(s-S)<=Q*Math.max(1,Math.abs(s),Math.abs(S))&&Math.abs(f-C)<=Q*Math.max(1,Math.abs(f),Math.abs(C))&&Math.abs(h-A)<=Q*Math.max(1,Math.abs(h),Math.abs(A))&&Math.abs(l-j)<=Q*Math.max(1,Math.abs(l),Math.abs(j))&&Math.abs(d-w)<=Q*Math.max(1,Math.abs(d),Math.abs(w))&&Math.abs(p-R)<=Q*Math.max(1,Math.abs(p),Math.abs(R))&&Math.abs(v-B)<=Q*Math.max(1,Math.abs(v),Math.abs(B))&&Math.abs(y-T)<=Q*Math.max(1,Math.abs(y),Math.abs(T))&&Math.abs(m-k)<=Q*Math.max(1,Math.abs(m),Math.abs(k))}var An=Xt,jn=Pn;function wn(){var t=new Z(3);return Z!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0),t}function Rn(t){var n=new Z(3);return n[0]=t[0],n[1]=t[1],n[2]=t[2],n}function Bn(t){var n=t[0],e=t[1],r=t[2];return Math.hypot(n,e,r)}function Tn(t,n,e){var r=new Z(3);return r[0]=t,r[1]=n,r[2]=e,r}function kn(t,n){return t[0]=n[0],t[1]=n[1],t[2]=n[2],t}function Ln(t,n,e,r){return t[0]=n,t[1]=e,t[2]=r,t}function Dn(t,n,e){return t[0]=n[0]+e[0],t[1]=n[1]+e[1],t[2]=n[2]+e[2],t}function _n(t,n,e){return t[0]=n[0]-e[0],t[1]=n[1]-e[1],t[2]=n[2]-e[2],t}function Yn(t,n,e){return t[0]=n[0]*e[0],t[1]=n[1]*e[1],t[2]=n[2]*e[2],t}function In(t,n,e){return t[0]=n[0]/e[0],t[1]=n[1]/e[1],t[2]=n[2]/e[2],t}function Nn(t,n){return t[0]=Math.ceil(n[0]),t[1]=Math.ceil(n[1]),t[2]=Math.ceil(n[2]),t}function qn(t,n){return t[0]=Math.floor(n[0]),t[1]=Math.floor(n[1]),t[2]=Math.floor(n[2]),t}function Xn(t,n,e){return t[0]=Math.min(n[0],e[0]),t[1]=Math.min(n[1],e[1]),t[2]=Math.min(n[2],e[2]),t}function Hn(t,n,e){return t[0]=Math.max(n[0],e[0]),t[1]=Math.max(n[1],e[1]),t[2]=Math.max(n[2],e[2]),t}function Fn(t,n){return t[0]=Math.round(n[0]),t[1]=Math.round(n[1]),t[2]=Math.round(n[2]),t}function Gn(t,n,e){return t[0]=n[0]*e,t[1]=n[1]*e,t[2]=n[2]*e,t}function $n(t,n,e,r){return t[0]=n[0]+e[0]*r,t[1]=n[1]+e[1]*r,t[2]=n[2]+e[2]*r,t}function Vn(t,n){var e=n[0]-t[0],r=n[1]-t[1],o=n[2]-t[2];return Math.hypot(e,r,o)}function Un(t,n){var e=n[0]-t[0],r=n[1]-t[1],o=n[2]-t[2];return e*e+r*r+o*o}function Wn(t){var n=t[0],e=t[1],r=t[2];return n*n+e*e+r*r}function zn(t,n){return t[0]=-n[0],t[1]=-n[1],t[2]=-n[2],t}function Qn(t,n){return t[0]=1/n[0],t[1]=1/n[1],t[2]=1/n[2],t}function Zn(t,n){var e=n[0],r=n[1],o=n[2],i=e*e+r*r+o*o;return i>0&&(i=1/Math.sqrt(i)),t[0]=n[0]*i,t[1]=n[1]*i,t[2]=n[2]*i,t}function Jn(t,n){return t[0]*n[0]+t[1]*n[1]+t[2]*n[2]}function Kn(t,n,e){var r=n[0],o=n[1],i=n[2],a=e[0],u=e[1],c=e[2];return t[0]=o*c-i*u,t[1]=i*a-r*c,t[2]=r*u-o*a,t}function te(t,n,e,r){var o=n[0],i=n[1],a=n[2];return t[0]=o+r*(e[0]-o),t[1]=i+r*(e[1]-i),t[2]=a+r*(e[2]-a),t}function ne(t,n,e,r,o,i){var a=i*i,u=a*(2*i-3)+1,c=a*(i-2)+i,s=a*(i-1),f=a*(3-2*i);return t[0]=n[0]*u+e[0]*c+r[0]*s+o[0]*f,t[1]=n[1]*u+e[1]*c+r[1]*s+o[1]*f,t[2]=n[2]*u+e[2]*c+r[2]*s+o[2]*f,t}function ee(t,n,e,r,o,i){var a=1-i,u=a*a,c=i*i,s=u*a,f=3*i*u,h=3*c*a,l=c*i;return t[0]=n[0]*s+e[0]*f+r[0]*h+o[0]*l,t[1]=n[1]*s+e[1]*f+r[1]*h+o[1]*l,t[2]=n[2]*s+e[2]*f+r[2]*h+o[2]*l,t}function re(t,n){n=n||1;var e=2*J()*Math.PI,r=2*J()-1,o=Math.sqrt(1-r*r)*n;return t[0]=Math.cos(e)*o,t[1]=Math.sin(e)*o,t[2]=r*n,t}function oe(t,n,e){var r=n[0],o=n[1],i=n[2],a=e[3]*r+e[7]*o+e[11]*i+e[15];return a=a||1,t[0]=(e[0]*r+e[4]*o+e[8]*i+e[12])/a,t[1]=(e[1]*r+e[5]*o+e[9]*i+e[13])/a,t[2]=(e[2]*r+e[6]*o+e[10]*i+e[14])/a,t}function ie(t,n,e){var r=n[0],o=n[1],i=n[2];return t[0]=r*e[0]+o*e[3]+i*e[6],t[1]=r*e[1]+o*e[4]+i*e[7],t[2]=r*e[2]+o*e[5]+i*e[8],t}function ae(t,n,e){var r=e[0],o=e[1],i=e[2],a=e[3],u=n[0],c=n[1],s=n[2],f=o*s-i*c,h=i*u-r*s,l=r*c-o*u,d=o*l-i*h,p=i*f-r*l,v=r*h-o*f,y=2*a;return f*=y,h*=y,l*=y,d*=2,p*=2,v*=2,t[0]=u+f+d,t[1]=c+h+p,t[2]=s+l+v,t}function ue(t,n,e,r){var o=[],i=[];return o[0]=n[0]-e[0],o[1]=n[1]-e[1],o[2]=n[2]-e[2],i[0]=o[0],i[1]=o[1]*Math.cos(r)-o[2]*Math.sin(r),i[2]=o[1]*Math.sin(r)+o[2]*Math.cos(r),t[0]=i[0]+e[0],t[1]=i[1]+e[1],t[2]=i[2]+e[2],t}function ce(t,n,e,r){var o=[],i=[];return o[0]=n[0]-e[0],o[1]=n[1]-e[1],o[2]=n[2]-e[2],i[0]=o[2]*Math.sin(r)+o[0]*Math.cos(r),i[1]=o[1],i[2]=o[2]*Math.cos(r)-o[0]*Math.sin(r),t[0]=i[0]+e[0],t[1]=i[1]+e[1],t[2]=i[2]+e[2],t}function se(t,n,e,r){var o=[],i=[];return o[0]=n[0]-e[0],o[1]=n[1]-e[1],o[2]=n[2]-e[2],i[0]=o[0]*Math.cos(r)-o[1]*Math.sin(r),i[1]=o[0]*Math.sin(r)+o[1]*Math.cos(r),i[2]=o[2],t[0]=i[0]+e[0],t[1]=i[1]+e[1],t[2]=i[2]+e[2],t}function fe(t,n){var e=t[0],r=t[1],o=t[2],i=n[0],a=n[1],u=n[2],c=Math.sqrt(e*e+r*r+o*o)*Math.sqrt(i*i+a*a+u*u),s=c&&Jn(t,n)/c;return Math.acos(Math.min(Math.max(s,-1),1))}function he(t){return t[0]=0,t[1]=0,t[2]=0,t}function le(t){return"vec3("+t[0]+", "+t[1]+", "+t[2]+")"}function de(t,n){return t[0]===n[0]&&t[1]===n[1]&&t[2]===n[2]}function pe(t,n){var e=t[0],r=t[1],o=t[2],i=n[0],a=n[1],u=n[2];return Math.abs(e-i)<=Q*Math.max(1,Math.abs(e),Math.abs(i))&&Math.abs(r-a)<=Q*Math.max(1,Math.abs(r),Math.abs(a))&&Math.abs(o-u)<=Q*Math.max(1,Math.abs(o),Math.abs(u))}var ve,ye=_n,me=Yn,ge=In,Me=Vn,be=Un,xe=Bn,Pe=Wn,Ee=(ve=wn(),function(t,n,e,r,o,i){var a,u;for(n||(n=3),e||(e=0),u=r?Math.min(r*n+e,t.length):t.length,a=e;a<u;a+=n)ve[0]=t[a],ve[1]=t[a+1],ve[2]=t[a+2],o(ve,ve,i),t[a]=ve[0],t[a+1]=ve[1],t[a+2]=ve[2];return t});function Oe(t){var n=t[0],e=t[1],r=t[2],o=t[3];return Math.hypot(n,e,r,o)}function Se(t){var n=t[0],e=t[1],r=t[2],o=t[3];return n*n+e*e+r*r+o*o}!function(){var t,n=(t=new Z(4),Z!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0,t[3]=0),t)}();function Ce(){var t=new Z(4);return Z!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0),t[3]=1,t}function Ae(t){return t[0]=0,t[1]=0,t[2]=0,t[3]=1,t}function je(t,n,e){e*=.5;var r=Math.sin(e);return t[0]=r*n[0],t[1]=r*n[1],t[2]=r*n[2],t[3]=Math.cos(e),t}function we(t,n){var e=2*Math.acos(n[3]),r=Math.sin(e/2);return r>Q?(t[0]=n[0]/r,t[1]=n[1]/r,t[2]=n[2]/r):(t[0]=1,t[1]=0,t[2]=0),e}function Re(t,n){var e=ir(t,n);return Math.acos(2*e*e-1)}function Be(t,n,e){var r=n[0],o=n[1],i=n[2],a=n[3],u=e[0],c=e[1],s=e[2],f=e[3];return t[0]=r*f+a*u+o*s-i*c,t[1]=o*f+a*c+i*u-r*s,t[2]=i*f+a*s+r*c-o*u,t[3]=a*f-r*u-o*c-i*s,t}function Te(t,n,e){e*=.5;var r=n[0],o=n[1],i=n[2],a=n[3],u=Math.sin(e),c=Math.cos(e);return t[0]=r*c+a*u,t[1]=o*c+i*u,t[2]=i*c-o*u,t[3]=a*c-r*u,t}function ke(t,n,e){e*=.5;var r=n[0],o=n[1],i=n[2],a=n[3],u=Math.sin(e),c=Math.cos(e);return t[0]=r*c-i*u,t[1]=o*c+a*u,t[2]=i*c+r*u,t[3]=a*c-o*u,t}function Le(t,n,e){e*=.5;var r=n[0],o=n[1],i=n[2],a=n[3],u=Math.sin(e),c=Math.cos(e);return t[0]=r*c+o*u,t[1]=o*c-r*u,t[2]=i*c+a*u,t[3]=a*c-i*u,t}function De(t,n){var e=n[0],r=n[1],o=n[2];return t[0]=e,t[1]=r,t[2]=o,t[3]=Math.sqrt(Math.abs(1-e*e-r*r-o*o)),t}function _e(t,n){var e=n[0],r=n[1],o=n[2],i=n[3],a=Math.sqrt(e*e+r*r+o*o),u=Math.exp(i),c=a>0?u*Math.sin(a)/a:0;return t[0]=e*c,t[1]=r*c,t[2]=o*c,t[3]=u*Math.cos(a),t}function Ye(t,n){var e=n[0],r=n[1],o=n[2],i=n[3],a=Math.sqrt(e*e+r*r+o*o),u=a>0?Math.atan2(a,i)/a:0;return t[0]=e*u,t[1]=r*u,t[2]=o*u,t[3]=.5*Math.log(e*e+r*r+o*o+i*i),t}function Ie(t,n,e){return Ye(t,n),or(t,t,e),_e(t,t),t}function Ne(t,n,e,r){var o,i,a,u,c,s=n[0],f=n[1],h=n[2],l=n[3],d=e[0],p=e[1],v=e[2],y=e[3];return(i=s*d+f*p+h*v+l*y)<0&&(i=-i,d=-d,p=-p,v=-v,y=-y),1-i>Q?(o=Math.acos(i),a=Math.sin(o),u=Math.sin((1-r)*o)/a,c=Math.sin(r*o)/a):(u=1-r,c=r),t[0]=u*s+c*d,t[1]=u*f+c*p,t[2]=u*h+c*v,t[3]=u*l+c*y,t}function qe(t){var n=J(),e=J(),r=J(),o=Math.sqrt(1-n),i=Math.sqrt(n);return t[0]=o*Math.sin(2*Math.PI*e),t[1]=o*Math.cos(2*Math.PI*e),t[2]=i*Math.sin(2*Math.PI*r),t[3]=i*Math.cos(2*Math.PI*r),t}function Xe(t,n){var e=n[0],r=n[1],o=n[2],i=n[3],a=e*e+r*r+o*o+i*i,u=a?1/a:0;return t[0]=-e*u,t[1]=-r*u,t[2]=-o*u,t[3]=i*u,t}function He(t,n){return t[0]=-n[0],t[1]=-n[1],t[2]=-n[2],t[3]=n[3],t}function Fe(t,n){var e,r=n[0]+n[4]+n[8];if(r>0)e=Math.sqrt(r+1),t[3]=.5*e,e=.5/e,t[0]=(n[5]-n[7])*e,t[1]=(n[6]-n[2])*e,t[2]=(n[1]-n[3])*e;else{var o=0;n[4]>n[0]&&(o=1),n[8]>n[3*o+o]&&(o=2);var i=(o+1)%3,a=(o+2)%3;e=Math.sqrt(n[3*o+o]-n[3*i+i]-n[3*a+a]+1),t[o]=.5*e,e=.5/e,t[3]=(n[3*i+a]-n[3*a+i])*e,t[i]=(n[3*i+o]+n[3*o+i])*e,t[a]=(n[3*a+o]+n[3*o+a])*e}return t}function Ge(t,n,e,r){var o=.5*Math.PI/180;n*=o,e*=o,r*=o;var i=Math.sin(n),a=Math.cos(n),u=Math.sin(e),c=Math.cos(e),s=Math.sin(r),f=Math.cos(r);return t[0]=i*c*f-a*u*s,t[1]=a*u*f+i*c*s,t[2]=a*c*s-i*u*f,t[3]=a*c*f+i*u*s,t}function $e(t){return"quat("+t[0]+", "+t[1]+", "+t[2]+", "+t[3]+")"}var Ve,Ue,We,ze,Qe,Ze,Je=function(t){var n=new Z(4);return n[0]=t[0],n[1]=t[1],n[2]=t[2],n[3]=t[3],n},Ke=function(t,n,e,r){var o=new Z(4);return o[0]=t,o[1]=n,o[2]=e,o[3]=r,o},tr=function(t,n){return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t},nr=function(t,n,e,r,o){return t[0]=n,t[1]=e,t[2]=r,t[3]=o,t},er=function(t,n,e){return t[0]=n[0]+e[0],t[1]=n[1]+e[1],t[2]=n[2]+e[2],t[3]=n[3]+e[3],t},rr=Be,or=function(t,n,e){return t[0]=n[0]*e,t[1]=n[1]*e,t[2]=n[2]*e,t[3]=n[3]*e,t},ir=function(t,n){return t[0]*n[0]+t[1]*n[1]+t[2]*n[2]+t[3]*n[3]},ar=function(t,n,e,r){var o=n[0],i=n[1],a=n[2],u=n[3];return t[0]=o+r*(e[0]-o),t[1]=i+r*(e[1]-i),t[2]=a+r*(e[2]-a),t[3]=u+r*(e[3]-u),t},ur=Oe,cr=ur,sr=Se,fr=sr,hr=function(t,n){var e=n[0],r=n[1],o=n[2],i=n[3],a=e*e+r*r+o*o+i*i;return a>0&&(a=1/Math.sqrt(a)),t[0]=e*a,t[1]=r*a,t[2]=o*a,t[3]=i*a,t},lr=function(t,n){return t[0]===n[0]&&t[1]===n[1]&&t[2]===n[2]&&t[3]===n[3]},dr=function(t,n){var e=t[0],r=t[1],o=t[2],i=t[3],a=n[0],u=n[1],c=n[2],s=n[3];return Math.abs(e-a)<=Q*Math.max(1,Math.abs(e),Math.abs(a))&&Math.abs(r-u)<=Q*Math.max(1,Math.abs(r),Math.abs(u))&&Math.abs(o-c)<=Q*Math.max(1,Math.abs(o),Math.abs(c))&&Math.abs(i-s)<=Q*Math.max(1,Math.abs(i),Math.abs(s))},pr=(Ve=wn(),Ue=Tn(1,0,0),We=Tn(0,1,0),function(t,n,e){var r=Jn(n,e);return r<-.999999?(Kn(Ve,Ue,n),xe(Ve)<1e-6&&Kn(Ve,We,n),Zn(Ve,Ve),je(t,Ve,Math.PI),t):r>.999999?(t[0]=0,t[1]=0,t[2]=0,t[3]=1,t):(Kn(Ve,n,e),t[0]=Ve[0],t[1]=Ve[1],t[2]=Ve[2],t[3]=1+r,hr(t,t))}),vr=(ze=Ce(),Qe=Ce(),function(t,n,e,r,o,i){return Ne(ze,n,o,i),Ne(Qe,e,r,i),Ne(t,ze,Qe,2*i*(1-i)),t}),yr=(Ze=K(),function(t,n,e,r){return Ze[0]=e[0],Ze[3]=e[1],Ze[6]=e[2],Ze[1]=r[0],Ze[4]=r[1],Ze[7]=r[2],Ze[2]=-n[0],Ze[5]=-n[1],Ze[8]=-n[2],hr(t,Fe(t,Ze))});function mr(){var t=new Z(2);return Z!=Float32Array&&(t[0]=0,t[1]=0),t}function gr(t){var n=new Z(2);return n[0]=t[0],n[1]=t[1],n}function Mr(t,n){var e=new Z(2);return e[0]=t,e[1]=n,e}function br(t,n){return t[0]=n[0],t[1]=n[1],t}function xr(t,n,e){return t[0]=n,t[1]=e,t}function Pr(t,n,e){return t[0]=n[0]+e[0],t[1]=n[1]+e[1],t}function Er(t,n,e){return t[0]=n[0]-e[0],t[1]=n[1]-e[1],t}function Or(t,n,e){return t[0]=n[0]*e[0],t[1]=n[1]*e[1],t}function Sr(t,n,e){return t[0]=n[0]/e[0],t[1]=n[1]/e[1],t}function Cr(t,n){return t[0]=Math.ceil(n[0]),t[1]=Math.ceil(n[1]),t}function Ar(t,n){return t[0]=Math.floor(n[0]),t[1]=Math.floor(n[1]),t}function jr(t,n,e){return t[0]=Math.min(n[0],e[0]),t[1]=Math.min(n[1],e[1]),t}function wr(t,n,e){return t[0]=Math.max(n[0],e[0]),t[1]=Math.max(n[1],e[1]),t}function Rr(t,n){return t[0]=Math.round(n[0]),t[1]=Math.round(n[1]),t}function Br(t,n,e){return t[0]=n[0]*e,t[1]=n[1]*e,t}function Tr(t,n,e,r){return t[0]=n[0]+e[0]*r,t[1]=n[1]+e[1]*r,t}function kr(t,n){var e=n[0]-t[0],r=n[1]-t[1];return Math.hypot(e,r)}function Lr(t,n){var e=n[0]-t[0],r=n[1]-t[1];return e*e+r*r}function Dr(t){var n=t[0],e=t[1];return Math.hypot(n,e)}function _r(t){var n=t[0],e=t[1];return n*n+e*e}function Yr(t,n){return t[0]=-n[0],t[1]=-n[1],t}function Ir(t,n){return t[0]=1/n[0],t[1]=1/n[1],t}function Nr(t,n){var e=n[0],r=n[1],o=e*e+r*r;return o>0&&(o=1/Math.sqrt(o)),t[0]=n[0]*o,t[1]=n[1]*o,t}function qr(t,n){return t[0]*n[0]+t[1]*n[1]}function Xr(t,n,e){var r=n[0]*e[1]-n[1]*e[0];return t[0]=t[1]=0,t[2]=r,t}function Hr(t,n,e,r){var o=n[0],i=n[1];return t[0]=o+r*(e[0]-o),t[1]=i+r*(e[1]-i),t}function Fr(t,n){n=n||1;var e=2*J()*Math.PI;return t[0]=Math.cos(e)*n,t[1]=Math.sin(e)*n,t}function Gr(t,n,e){var r=n[0],o=n[1];return t[0]=e[0]*r+e[2]*o,t[1]=e[1]*r+e[3]*o,t}function $r(t,n,e){var r=n[0],o=n[1];return t[0]=e[0]*r+e[2]*o+e[4],t[1]=e[1]*r+e[3]*o+e[5],t}function Vr(t,n,e){var r=n[0],o=n[1];return t[0]=e[0]*r+e[3]*o+e[6],t[1]=e[1]*r+e[4]*o+e[7],t}function Ur(t,n,e){var r=n[0],o=n[1];return t[0]=e[0]*r+e[4]*o+e[12],t[1]=e[1]*r+e[5]*o+e[13],t}function Wr(t,n,e,r){var o=n[0]-e[0],i=n[1]-e[1],a=Math.sin(r),u=Math.cos(r);return t[0]=o*u-i*a+e[0],t[1]=o*a+i*u+e[1],t}function zr(t,n){var e=t[0],r=t[1],o=n[0],i=n[1],a=Math.sqrt(e*e+r*r)*Math.sqrt(o*o+i*i),u=a&&(e*o+r*i)/a;return Math.acos(Math.min(Math.max(u,-1),1))}function Qr(t){return t[0]=0,t[1]=0,t}function Zr(t){return"vec2("+t[0]+", "+t[1]+")"}function Jr(t,n){return t[0]===n[0]&&t[1]===n[1]}function Kr(t,n){var e=t[0],r=t[1],o=n[0],i=n[1];return Math.abs(e-o)<=Q*Math.max(1,Math.abs(e),Math.abs(o))&&Math.abs(r-i)<=Q*Math.max(1,Math.abs(r),Math.abs(i))}var to=Dr,no=Er,eo=Or,ro=Sr,oo=kr,io=Lr,ao=_r,uo=function(){var t=mr();return function(n,e,r,o,i,a){var u,c;for(e||(e=2),r||(r=0),c=o?Math.min(o*e+r,n.length):n.length,u=r;u<c;u+=e)t[0]=n[u],t[1]=n[u+1],i(t,t,a),n[u]=t[0],n[u+1]=t[1];return n}}(),co=function(){function t(){}return t.tag="c-canvas-rbush-node",t}(),so="RBushRoot",fo=function(){function t(){this.renderQueue=[],this.restoreStack=[],this.clearFullScreen=!1,this.enableBatch=!1,this.batchedStyleHash="",this.batchedDisplayObject=null,this.toSync=new Set}var n;return n=t,t.prototype.syncRTree=function(){var t=this,n=[];this.toSync.forEach((function(e){var r=e.rBushNode;r&&t.rBush.remove(r.aabb);var o=e.getRenderBounds();if(o){var i=y(o.getMin(),2),a=i[0],u=i[1],c=y(o.getMax(),2),s=c[0],f=c[1];r.aabb={id:e.entity,minX:a,minY:u,maxX:s,maxY:f}}r.aabb&&n.push(r.aabb)})),this.rBush.load(n),this.toSync.clear()},t.prototype.pushToSync=function(t){var n=this;t.forEach((function(t){n.toSync.add(t)}))},t.prototype.apply=function(t){var e=this,r=function(t){t.target.rBushNode=new co,e.pushToSync(t.composedPath().slice(0,-2))},o=function(t){var n=t.target,r=n.rBushNode;e.rBush.remove(r.aabb),e.toSync.delete(n)},i=function(t){var n,r=t.target;(null===(n=r.ownerDocument)||void 0===n?void 0:n.documentElement)===e.renderingContext.root&&(t.detail.affectChildren&&r.forEach((function(t){e.pushToSync([t])})),e.pushToSync(t.composedPath().slice(0,-2)))};t.hooks.init.tap(n.tag,(function(){e.renderingContext.root.addEventListener(g.ElementEvent.MOUNTED,r),e.renderingContext.root.addEventListener(g.ElementEvent.UNMOUNTED,o),e.renderingContext.root.addEventListener(g.ElementEvent.BOUNDS_CHANGED,i)})),t.hooks.destroy.tap(n.tag,(function(){e.renderingContext.root.removeEventListener(g.ElementEvent.MOUNTED,r),e.renderingContext.root.removeEventListener(g.ElementEvent.UNMOUNTED,o),e.renderingContext.root.removeEventListener(g.ElementEvent.BOUNDS_CHANGED,i)})),t.hooks.beginFrame.tap(n.tag,(function(){var t=e.contextService.getContext(),n=e.canvasConfig.renderer.getConfig(),r=n.enableDirtyRectangleRendering;n.enableDirtyRectangleRenderingDebug;e.clearFullScreen=!r||e.renderingContext.renderReasons.has(g.RENDER_REASON.CameraChanged),t&&(t.save(),e.clearFullScreen&&t.clearRect(0,0,e.canvasConfig.width,e.canvasConfig.height),e.applyTransform(t,e.camera.getOrthoMatrix()))})),t.hooks.endFrame.tap(n.tag,(function(){e.syncRTree();var n=e.canvasConfig.renderer.getConfig().enableDirtyRectangleRendering,r=e.contextService.getContext();if(n){var o=e.safeMergeAABB.apply(e,m([e.mergeDirtyAABBs(e.renderQueue)],y(e.renderingContext.removedRenderBoundsList),!1));if(e.renderingContext.removedRenderBoundsList=[],!o)return;var i=e.convertAABB2Rect(o),a=i.x,u=i.y,c=i.width,s=i.height;r.clearRect(a,u,c,s),r.beginPath(),r.rect(a,u,c,s),r.clip(),e.searchDirtyObjects(o).sort((function(t,n){return t.sortable.renderOrder-n.sortable.renderOrder})).forEach((function(n){n.isVisible()&&e.renderDisplayObject(n,t)})),e.enableBatch&&e.batchedStyleHash&&e.flush(r,t),e.renderQueue.forEach((function(t){e.saveDirtyAABB(t)})),e.renderQueue=[]}e.restoreStack.forEach((function(t){r.restore()})),e.restoreStack=[],r.restore()})),t.hooks.render.tap(n.tag,(function(n){e.canvasConfig.renderer.getConfig().enableDirtyRectangleRendering?e.renderQueue.push(n):e.renderDisplayObject(n,t)}))},t.prototype.flush=function(t,n){if(this.batchedDisplayObject){var e=this.styleRendererFactory(this.batchedDisplayObject.nodeName);e&&(this.applyAttributesToContext(t,this.batchedDisplayObject,n),t.closePath(),e.render(t,this.batchedDisplayObject.parsedStyle,this.batchedDisplayObject),t.restore()),this.batchedStyleHash="",this.batchedDisplayObject=null}},t.prototype.renderDisplayObject=function(t,n){for(var e=this,r=this.contextService.getContext(),o=this.restoreStack[this.restoreStack.length-1];o&&t.parentNode!==o;)r.restore(),this.restoreStack.pop(),o=this.restoreStack[this.restoreStack.length-1];var i=t.nodeName,a=this.styleRendererFactory(i),u=!1;if(this.enableBatch&&a){var c=a.hash(t.attributes);this.batchedStyleHash&&c!==this.batchedStyleHash&&this.flush(r,n),this.batchedStyleHash||(this.batchedStyleHash=c,this.batchedDisplayObject=t,u=!0)}r.save(),this.applyTransform(r,t.getLocalTransform());var s=t.style.clipPath;if(s){r.save(),this.applyTransform(r,s.getLocalTransform());var f=this.pathGeneratorFactory(s.nodeName);f&&this.useAnchor(r,s,(function(){r.beginPath(),f(r,s.parsedStyle),r.closePath()})),r.restore(),r.clip()}this.enableBatch||(r.save(),this.applyAttributesToContext(r,t,n)),this.useAnchor(r,t,(function(){var n=e.pathGeneratorFactory(t.nodeName);n&&(!u&&e.enableBatch||r.beginPath(),n(r,t.parsedStyle),e.enableBatch||t.nodeName===g.SHAPE.Line||t.nodeName===g.SHAPE.Path||t.nodeName===g.SHAPE.Polyline||r.closePath()),a&&!e.enableBatch&&a.render(r,t.parsedStyle,t)})),this.enableBatch||r.restore(),t.renderable.dirty=!1,this.restoreStack.push(t)},t.prototype.convertAABB2Rect=function(t){var n=t.getMin(),e=t.getMax(),r=Math.floor(n[0]),o=Math.floor(n[1]);return{x:r,y:o,width:Math.ceil(e[0])-r,height:Math.ceil(e[1])-o}},t.prototype.insertRBushNode=function(t){var n=t.rBushNode;if(n){this.rBush.remove(n.aabb);var e=t.getRenderBounds();if(e){var r=y(e.getMin(),2),o=r[0],i=r[1],a=y(e.getMax(),2),u=a[0],c=a[1];n.aabb={id:t.entity,minX:o,minY:i,maxX:u,maxY:c}}this.rBush.insert(n.aabb)}},t.prototype.mergeDirtyAABBs=function(t){var n;return t.forEach((function(t){var e=t.getRenderBounds();e&&(n?n.add(e):n=new g.AABB(e.center,e.halfExtents));var r=t.renderable.dirtyRenderBounds;r&&(n?n.add(r):n=new g.AABB(r.center,r.halfExtents))})),n},t.prototype.searchDirtyObjects=function(t){var n=this,e=y(t.getMin(),2),r=e[0],o=e[1],i=y(t.getMax(),2),a=i[0],u=i[1];return this.rBush.search({minX:r,minY:o,maxX:a,maxY:u}).map((function(t){var e=t.id;return n.displayObjectPool.getByEntity(e)}))},t.prototype.saveDirtyAABB=function(t){var n=t.renderable;n.dirtyRenderBounds||(n.dirtyRenderBounds=new g.AABB);var e=t.getRenderBounds();e&&n.dirtyRenderBounds.update(e.center,e.halfExtents)},t.prototype.applyTransform=function(t,n){var e=y(i.getTranslation(a.create(),n),2),r=e[0],o=e[1],c=y(i.getScaling(a.create(),n),2),s=c[0],f=c[1],h=i.getRotation(u.create(),n),l=y(Object(g.getEuler)(a.create(),h),3),d=l[0],p=(l[1],l[2]),v=Object(g.fromRotationTranslationScale)(d||p,r,o,s,f);t.transform(v[0],v[1],v[3],v[4],v[6],v[7])},t.prototype.getColor=function(t,n,e,r){var o;if(t.type===g.PARSED_COLOR_TYPE.LinearGradient||t.type===g.PARSED_COLOR_TYPE.RadialGradient){var i=n.getGeometryBounds(),a=i&&2*i.halfExtents[0]||0,u=i&&2*i.halfExtents[1]||0;o=this.gradientPool.getOrCreateGradient(d(d({type:t.type},t.value),{width:a,height:u}),e)}else if(t.type===g.PARSED_COLOR_TYPE.Pattern){var c=this.imagePool.getPatternSync(t.value);c?o=c:this.imagePool.createPattern(t.value,e).then((function(){n.renderable.dirty=!0,r.dirtify()}))}else o=t.formatted;return o},t.prototype.applyAttributesToContext=function(t,n,e){var r=n.parsedStyle,o=r.stroke,i=r.fill,a=r.opacity,u=r.lineDash,c=r.lineDashOffset,s=r.filter,f=r.shadowColor,h=r.shadowBlur,l=r.shadowOffsetX,d=r.shadowOffsetY;u&&k(u)&&t.setLineDash(u),T(c)||(t.lineDashOffset=c),T(a)||(t.globalAlpha*=a),T(o)||(t.strokeStyle=this.getColor(o,n,t,e)),T(i)||(t.fillStyle=this.getColor(i,n,t,e)),T(s)||(t.filter=n.style.filter),T(f)||(t.shadowColor=f.formatted,t.shadowBlur=h,t.shadowOffsetX=l,t.shadowOffsetY=d)},t.prototype.useAnchor=function(t,n,e){var r=n.getGeometryBounds();if(r){var o=r.halfExtents,i=(n.parsedStyle||{}).anchor,a=void 0===i?[0,0]:i;t.translate(-a[0]*o[0]*2,-a[1]*o[1]*2),e()}else e()},t.prototype.safeMergeAABB=function(){for(var t,n=[],e=0;e<arguments.length;e++)n[e]=arguments[e];return n.forEach((function(n){n&&(t?t.add(n):t=n)})),t},t.tag="CanvasRendererPlugin",p([Object(M.inject)(g.CanvasConfig),v("design:type",Object)],t.prototype,"canvasConfig",void 0),p([Object(M.inject)(g.DefaultCamera),v("design:type",g.Camera)],t.prototype,"camera",void 0),p([Object(M.inject)(g.ContextService),v("design:type",Object)],t.prototype,"contextService",void 0),p([Object(M.inject)(g.SceneGraphService),v("design:type",Object)],t.prototype,"sceneGraphService",void 0),p([Object(M.inject)(g.RenderingContext),v("design:type",Object)],t.prototype,"renderingContext",void 0),p([Object(M.inject)(G),v("design:type",G)],t.prototype,"imagePool",void 0),p([Object(M.inject)(U),v("design:type",U)],t.prototype,"gradientPool",void 0),p([Object(M.inject)(W),v("design:type",Function)],t.prototype,"pathGeneratorFactory",void 0),p([Object(M.inject)(A),v("design:type",Function)],t.prototype,"styleRendererFactory",void 0),p([Object(M.inject)(g.DisplayObjectPool),v("design:type",g.DisplayObjectPool)],t.prototype,"displayObjectPool",void 0),p([Object(M.inject)(so),v("design:type",C.a)],t.prototype,"rBush",void 0),t=n=p([Object(M.singleton)({contrib:g.RenderingPluginContribution})],t)}(),ho=function(){function t(){}var n;return n=t,t.prototype.apply=function(t){var e=this,r=function(n){var r=n.target,o=r.nodeName,i=r.attributes;if(o===g.SHAPE.Image){var a=i.img;N(a)&&e.imagePool.getOrCreateImage(a).then((function(){r.renderable.dirty=!0,t.dirtify()}))}},o=function(n){var r=n.target,o=n.detail,i=o.attributeName,a=o.newValue;r.nodeName===g.SHAPE.Image&&"img"===i&&N(a)&&e.imagePool.getOrCreateImage(a).then((function(){r.renderable.dirty=!0,t.dirtify()}))};t.hooks.init.tap(n.tag,(function(){e.renderingContext.root.addEventListener(g.ElementEvent.MOUNTED,r),e.renderingContext.root.addEventListener(g.ElementEvent.ATTRIBUTE_CHANGED,o)})),t.hooks.destroy.tap(n.tag,(function(){e.renderingContext.root.removeEventListener(g.ElementEvent.MOUNTED,r),e.renderingContext.root.removeEventListener(g.ElementEvent.ATTRIBUTE_CHANGED,o)}))},t.tag="LoadImagePlugin",p([Object(M.inject)(G),v("design:type",G)],t.prototype,"imagePool",void 0),p([Object(M.inject)(g.RenderingContext),v("design:type",Object)],t.prototype,"renderingContext",void 0),t=n=p([Object(M.singleton)({contrib:g.RenderingPluginContribution})],t)}();g.globalContainer.register({token:{token:z,named:g.SHAPE.Circle},useValue:function(t,n){var e=n.r,r=void 0===e?0:e;t.arc(r,r,r,0,2*Math.PI,!1)}}),g.globalContainer.register({token:{token:z,named:g.SHAPE.Ellipse},useValue:function(t,n){var e=n.rx,r=n.ry;if(t.ellipse)t.ellipse(e,r,e,r,0,0,2*Math.PI,!1);else{var o=e>r?e:r,i=e>r?1:e/r,a=e>r?r/e:1;t.save(),t.scale(i,a),t.arc(0,0,o,0,2*Math.PI)}}}),g.globalContainer.register({token:{token:z,named:g.SHAPE.Rect},useValue:function(t,n){var e=n.radius,r=void 0===e?0:e,o=n.width,i=void 0===o?0:o,a=n.height,u=void 0===a?0:a;if(0===r)t.rect(0,0,i,u);else{var c=y(function(t){var n=0,e=0,r=0,o=0;return k(t)?1===t.length?n=e=r=o=t[0]:2===t.length?(n=r=t[0],e=o=t[1]):3===t.length?(n=t[0],e=o=t[1],r=t[2]):(n=t[0],e=t[1],r=t[2],o=t[3]):n=e=r=o=t,[n,e,r,o]}(r),4),s=c[0],f=c[1],h=c[2],l=c[3];t.moveTo(s,0),t.lineTo(i-f,0),0!==f&&t.arc(i-f,f,f,-Math.PI/2,0),t.lineTo(i,u-h),0!==h&&t.arc(i-h,u-h,h,0,Math.PI/2),t.lineTo(l,u),0!==l&&t.arc(l,u-l,l,Math.PI/2,Math.PI),t.lineTo(0,s),0!==s&&t.arc(s,s,s,Math.PI,1.5*Math.PI)}}}),g.globalContainer.register({token:{token:z,named:g.SHAPE.Line},useValue:function(t,n){var e=n.x1,r=n.y1,o=n.x2,i=n.y2,a=n.defX,u=void 0===a?0:a,c=n.defY,s=void 0===c?0:c;t.moveTo(e-u,r-s),t.lineTo(o-u,i-s)}}),g.globalContainer.register({token:{token:z,named:g.SHAPE.Polyline},useValue:function(t,n){var e=n.defX,r=void 0===e?0:e,o=n.defY,i=void 0===o?0:o,a=n.points.points,u=a.length,c=a[0][0]-r,s=a[0][1]-i,f=a[u-1][0]-r,h=a[u-1][1]-i;t.moveTo(c,s);for(var l=0;l<u-1;l++){var d=a[l];t.lineTo(d[0]-r,d[1]-i)}t.lineTo(f,h)}}),g.globalContainer.register({token:{token:z,named:g.SHAPE.Polygon},useValue:function(t,n){var e=n.defX,r=void 0===e?0:e,o=n.defY,i=void 0===o?0:o,a=n.points.points,u=a.length,c=a[0][0]-r,s=a[0][1]-i,f=a[u-1][0]-r,h=a[u-1][1]-i;t.moveTo(c,s);for(var l=0;l<u-1;l++){var d=a[l];t.lineTo(d[0]-r,d[1]-i)}t.lineTo(f,h)}}),g.globalContainer.register({token:{token:z,named:g.SHAPE.Path},useValue:function(t,n){var e=n.defX,r=void 0===e?0:e,o=n.defY,i=void 0===o?0:o,a=n.path,u=a.curve,c=a.zCommandIndexes,s=u;c.forEach((function(t,n){s.splice(t+n,0,["Z"])}));for(var f=[-r,-i],h=0;h<s.length;h++){var l=s[h],d=l[0];switch(d){case"M":t.moveTo(l[1]-r,l[2]-i),f=[l[1]-r,l[2]-i];break;case"C":t.bezierCurveTo(l[1]-r,l[2]-i,l[3]-r,l[4]-i,l[5]-r,l[6]-i);break;case"Z":t.closePath()}if("Z"===d)f;else{var p=l.length;[l[p-2]-r,l[p-1]-i]}}}}),g.globalContainer.register({token:W,useFactory:function(t){var n={};return function(e){return n[e]||t.container.isBoundNamed(z,e)&&(n[e]=t.container.getNamed(z,e)),n[e]}}});var lo=Object(M.Module)((function(t){t(G),t({token:so,useValue:new C.a}),t(F),t($),t(V),t({token:A,useFactory:function(t){var n={};return function(e){return n[e]||t.container.isBoundNamed(j,e)&&(n[e]=t.container.getNamed(j,e)),n[e]}}}),t(U),t(fo),t(ho)})),po=function(){function t(){}return t.prototype.init=function(t){t.load(lo,!0)},t.prototype.destroy=function(t){t.remove(G),t.remove(so),t.remove(F),t.remove($),t.remove(V),t.remove(j),t.remove(A),t.remove(U),t.remove(fo),t.remove(ho)},t}(),vo=function(){function t(){var t=this;this.isHit=function(n,e,r){var o=t.pointInPathPickerFactory(n.nodeName);if(o){var u=i.invert(i.create(),r),c=a.transformMat4(a.create(),a.fromValues(e[0],e[1],0),u),s=n.getGeometryBounds().halfExtents,f=n.parsedStyle.anchor,h=void 0===f?[0,0]:f;if(c[0]+=h[0]*s[0]*2,c[1]+=h[1]*s[1]*2,o(n,new g.Point(c[0],c[1]),t.isPointInPath))return!0}return!1},this.isPointInPath=function(n,e){var r=t.offscreenCanvas.getOrCreateContext(),o=t.pathGeneratorFactory(n.nodeName);return o&&o(r,n.parsedStyle),r.isPointInPath(e.x,e.y)}}var n;return n=t,t.prototype.apply=function(t){var e=this;t.hooks.pick.tap(n.tag,(function(t){var n=t.position,r=n.x,o=n.y,u=a.fromValues(r,o,0),c=[],s=e.rBush.search({minX:u[0],minY:u[1],maxX:u[0],maxY:u[1]}),f=s.map((function(t){return t.id}));return s.forEach((function(t){var n=t.id,r=e.displayObjectPool.getByEntity(n);if(r.isVisible()&&r.interactive){if(r.parentNode&&-1===f.indexOf(r.parentNode.entity))return;var o=r.style.clipPath||r,a=r.getWorldTransform();r.style.clipPath&&(a=i.multiply(i.create(),a,r.style.clipPath.getLocalTransform())),e.isHit(o,u,a)&&c.push(r)}})),c.sort((function(t,n){return t.sortable.renderOrder-n.sortable.renderOrder})),t.picked=c[c.length-1]||null,t}))},t.tag="CanvasPickerPlugin",p([Object(M.inject)(g.SceneGraphService),v("design:type",Object)],t.prototype,"sceneGraphService",void 0),p([Object(M.inject)(g.DisplayObjectPool),v("design:type",g.DisplayObjectPool)],t.prototype,"displayObjectPool",void 0),p([Object(M.inject)(g.OffscreenCanvasCreator),v("design:type",g.OffscreenCanvasCreator)],t.prototype,"offscreenCanvas",void 0),p([Object(M.inject)(so),v("design:type",Function)],t.prototype,"rBush",void 0),p([Object(M.inject)(W),v("design:type",Function)],t.prototype,"pathGeneratorFactory",void 0),p([Object(M.inject)("PointInPathPicker"),v("design:type",Function)],t.prototype,"pointInPathPickerFactory",void 0),t=n=p([Object(M.singleton)({contrib:g.RenderingPluginContribution})],t)}();function yo(t,n,e,r){var o=t-e,i=n-r;return Math.sqrt(o*o+i*i)}function mo(t,n){return Math.abs(t-n)<.001}function go(t,n){var e=Y(t),r=Y(n);return{x:e,y:r,width:_(t)-e,height:_(n)-r}}function Mo(t){return(t+2*Math.PI)%(2*Math.PI)}var bo={box:function(t,n,e,r){return go([t,e],[n,r])},length:function(t,n,e,r){return yo(t,n,e,r)},pointAt:function(t,n,e,r,o){return{x:(1-o)*t+o*e,y:(1-o)*n+o*r}},pointDistance:function(t,n,e,r,o,i){var a=(e-t)*(o-t)+(r-n)*(i-n);return a<0?yo(t,n,o,i):a>(e-t)*(e-t)+(r-n)*(r-n)?yo(e,r,o,i):this.pointToLine(t,n,e,r,o,i)},pointToLine:function(t,n,e,r,o,i){var a=[e-t,r-n];if(c.exactEquals(a,[0,0]))return Math.sqrt((o-t)*(o-t)+(i-n)*(i-n));var u=[-a[1],a[0]];c.normalize(u,u);var s=[o-t,i-n];return Math.abs(c.dot(s,u))},tangentAngle:function(t,n,e,r){return Math.atan2(r-n,e-t)}};function xo(t,n,e,r,o,i){var a=-1,u=1/0,c=[e,r],s=20;i&&i>200&&(s=i/10);for(var f=1/s,h=f/10,l=0;l<=s;l++){var d=l*f,p=[o.apply(null,t.concat([d])),o.apply(null,n.concat([d]))];(g=yo(c[0],c[1],p[0],p[1]))<u&&(a=d,u=g)}if(0===a)return{x:t[0],y:n[0]};if(1===a){var v=t.length;return{x:t[v-1],y:n[v-1]}}u=1/0;for(l=0;l<32&&!(h<1e-4);l++){var y=a-h,m=a+h,g=(p=[o.apply(null,t.concat([y])),o.apply(null,n.concat([y]))],yo(c[0],c[1],p[0],p[1]));if(y>=0&&g<u)a=y,u=g;else{var M=[o.apply(null,t.concat([m])),o.apply(null,n.concat([m]))],b=yo(c[0],c[1],M[0],M[1]);m<=1&&b<u?(a=m,u=b):h*=.5}}return{x:o.apply(null,t.concat([a])),y:o.apply(null,n.concat([a]))}}function Po(t,n,e,r){var o=1-r;return o*o*t+2*r*o*n+r*r*e}function Eo(t,n,e){var r=t+e-2*n;if(mo(r,0))return[.5];var o=(t-n)/r;return o<=1&&o>=0?[o]:[]}function Oo(t,n,e,r){return 2*(1-r)*(n-t)+2*r*(e-n)}function So(t,n,e,r,o,i,a){var u=Po(t,e,o,a),c=Po(n,r,i,a),s=bo.pointAt(t,n,e,r,a),f=bo.pointAt(e,r,o,i,a);return[[t,n,s.x,s.y,u,c],[u,c,f.x,f.y,o,i]]}var Co={box:function(t,n,e,r,o,i){var a=Eo(t,e,o)[0],u=Eo(n,r,i)[0],c=[t,o],s=[n,i];return void 0!==a&&c.push(Po(t,e,o,a)),void 0!==u&&s.push(Po(n,r,i,u)),go(c,s)},length:function(t,n,e,r,o,i){return function t(n,e,r,o,i,a,u){if(0===u)return(yo(n,e,r,o)+yo(r,o,i,a)+yo(n,e,i,a))/2;var c=So(n,e,r,o,i,a,.5),s=c[0],f=c[1];return s.push(u-1),f.push(u-1),t.apply(null,s)+t.apply(null,f)}(t,n,e,r,o,i,3)},nearestPoint:function(t,n,e,r,o,i,a,u){return xo([t,e,o],[n,r,i],a,u,Po)},pointDistance:function(t,n,e,r,o,i,a,u){var c=this.nearestPoint(t,n,e,r,o,i,a,u);return yo(c.x,c.y,a,u)},interpolationAt:Po,pointAt:function(t,n,e,r,o,i,a){return{x:Po(t,e,o,a),y:Po(n,r,i,a)}},divide:function(t,n,e,r,o,i,a){return So(t,n,e,r,o,i,a)},tangentAngle:function(t,n,e,r,o,i,a){var u=Oo(t,e,o,a),c=Oo(n,r,i,a);return Mo(Math.atan2(c,u))}};function Ao(t,n,e,r,o){var i=1-o;return i*i*i*t+3*n*o*i*i+3*e*o*o*i+r*o*o*o}function jo(t,n,e,r,o){var i=1-o;return 3*(i*i*(n-t)+2*i*o*(e-n)+o*o*(r-e))}function wo(t,n,e,r){var o,i,a,u=-3*t+9*n-9*e+3*r,c=6*t-12*n+6*e,s=3*n-3*t,f=[];if(mo(u,0))mo(c,0)||(o=-s/c)>=0&&o<=1&&f.push(o);else{var h=c*c-4*u*s;mo(h,0)?f.push(-c/(2*u)):h>0&&(i=(-c-(a=Math.sqrt(h)))/(2*u),(o=(-c+a)/(2*u))>=0&&o<=1&&f.push(o),i>=0&&i<=1&&f.push(i))}return f}function Ro(t,n,e,r,o,i,a,u,c){var s=Ao(t,e,o,a,c),f=Ao(n,r,i,u,c),h=bo.pointAt(t,n,e,r,c),l=bo.pointAt(e,r,o,i,c),d=bo.pointAt(o,i,a,u,c),p=bo.pointAt(h.x,h.y,l.x,l.y,c),v=bo.pointAt(l.x,l.y,d.x,d.y,c);return[[t,n,h.x,h.y,p.x,p.y,s,f],[s,f,v.x,v.y,d.x,d.y,a,u]]}function Bo(t,n,e,r,o,i,a,u,c){if(0===c)return function(t,n){for(var e=0,r=t.length,o=0;o<r;o++){e+=yo(t[o],n[o],t[(o+1)%r],n[(o+1)%r])}return e/2}([t,e,o,a],[n,r,i,u]);var s=Ro(t,n,e,r,o,i,a,u,.5),f=m(m([],y(s[0]),!1),[c-1],!1),h=m(m([],y(s[1]),!1),[c-1],!1);return Bo.apply(null,f)+Bo.apply(null,h)}var To={extrema:wo,box:function(t,n,e,r,o,i,a,u){for(var c=[t,a],s=[n,u],f=wo(t,e,o,a),h=wo(n,r,i,u),l=0;l<f.length;l++)c.push(Ao(t,e,o,a,f[l]));for(l=0;l<h.length;l++)s.push(Ao(n,r,i,u,h[l]));return go(c,s)},length:function(t,n,e,r,o,i,a,u){return Bo(t,n,e,r,o,i,a,u,3)},nearestPoint:function(t,n,e,r,o,i,a,u,c,s,f){return xo([t,e,o,a],[n,r,i,u],c,s,Ao,f)},pointDistance:function(t,n,e,r,o,i,a,u,c,s,f){var h=this.nearestPoint(t,n,e,r,o,i,a,u,c,s,f);return yo(h.x,h.y,c,s)},interpolationAt:Ao,pointAt:function(t,n,e,r,o,i,a,u,c){return{x:Ao(t,e,o,a,c),y:Ao(n,r,i,u,c)}},divide:function(t,n,e,r,o,i,a,u,c){return Ro(t,n,e,r,o,i,a,u,c)},tangentAngle:function(t,n,e,r,o,i,a,u,c){var s=jo(t,e,o,a,c),f=jo(n,r,i,u,c);return Mo(Math.atan2(f,s))}};function ko(t,n,e,r){var o=t-e,i=n-r;return Math.sqrt(o*o+i*i)}function Lo(t,n,e,r,o,i){return o>=t&&o<=t+e&&i>=n&&i<=n+r}function Do(t,n,e,r,o,i,a,u){var c=(Math.atan2(u-n,a-t)+2*Math.PI)%(2*Math.PI);if(c<r||c>o)return!1;var s={x:t+e*Math.cos(c),y:n+e*Math.sin(c)};return ko(s.x,s.y,a,u)<=i/2}function _o(t,n,e,r,o,i,a){var u=Math.min(t,e),c=Math.max(t,e),s=Math.min(n,r),f=Math.max(n,r),h=o/2;return i>=u-h&&i<=c+h&&a>=s-h&&a<=f+h&&bo.pointToLine(t,n,e,r,i,a)<=o/2}function Yo(t,n,e,r,o){var i=t.length;if(i<2)return!1;for(var a=0;a<i-1;a++){if(_o(t[a][0],t[a][1],t[a+1][0],t[a+1][1],n,e,r))return!0}if(o){var u=t[0],c=t[i-1];if(_o(u[0],u[1],c[0],c[1],n,e,r))return!0}return!1}function Io(t){return Math.abs(t)<1e-6?0:t<0?-1:1}function No(t,n,e){return(e[0]-t[0])*(n[1]-t[1])==(n[0]-t[0])*(e[1]-t[1])&&Math.min(t[0],n[0])<=e[0]&&e[0]<=Math.max(t[0],n[0])&&Math.min(t[1],n[1])<=e[1]&&e[1]<=Math.max(t[1],n[1])}function qo(t,n,e){var r=!1,o=t.length;if(o<=2)return!1;for(var i=0;i<o;i++){var a=t[i],u=t[(i+1)%o];if(No(a,u,[n,e]))return!0;Io(a[1]-e)>0!=Io(u[1]-e)>0&&Io(n-(e-a[1])*(a[0]-u[0])/(a[1]-u[1])-a[0])<0&&(r=!r)}return r}function Xo(t,n,e){for(var r=!1,o=0;o<t.length;o++){if(r=qo(t[o],n,e))break}return r}function Ho(t,n){var e=t.parsedStyle,r=e.r,o=void 0===r?0:r,i=e.fill,a=e.stroke,u=e.lineWidth,c=void 0===u?0:u,s=e.clipPathTargets,f=c/2,h=ko(o,o,n.x,n.y),l=!!(null==s?void 0:s.length);return i&&a||l?h<=o+f:i?h<=o:!!a&&(h>=o-f&&h<=o+f)}function Fo(t,n,e,r){return t/(e*e)+n/(r*r)}function Go(t,n){var e=n.x,r=n.y,o=t.parsedStyle,i=o.rx,a=void 0===i?0:i,u=o.ry,c=void 0===u?0:u,s=o.fill,f=o.stroke,h=o.lineWidth,l=void 0===h?0:h,d=o.clipPathTargets,p=!!(null==d?void 0:d.length),v=l/2,y=(e-a)*(e-a),m=(r-c)*(r-c);return s&&f||p?Fo(y,m,a+v,c+v)<=1:s?Fo(y,m,a,c)<=1:!!f&&(Fo(y,m,a-v,c-v)>=1&&Fo(y,m,a+v,c+v)<=1)}function $o(t,n){var e=t.parsedStyle,r=e.x1,o=e.y1,i=e.x2,a=e.y2,u=e.lineWidth,c=void 0===u?0:u,s=e.defX,f=void 0===s?0:s,h=e.defY,l=void 0===h?0:h;return _o(r,o,i,a,c,n.x+f,n.y+l)}function Vo(t,n){var e=t.parsedStyle,r=e.stroke,o=e.lineWidth,i=void 0===o?0:o,a=e.points,u=e.defX,c=void 0===u?0:u,s=e.defY,f=void 0===s?0:s,h=e.clipPathTargets,l=!!(null==h?void 0:h.length);return!(!r&&!l||!i)&&Yo(a.points,i,n.x+c,n.y+f,!1)}function Uo(t,n,e){var r=t.parsedStyle,i=r.lineWidth,a=void 0===i?0:i,u=r.stroke,s=r.fill,f=r.defX,h=void 0===f?0:f,l=r.defY,d=void 0===l?0:l,p=r.clipPathTargets,v=r.path,y=v.segments,m=v.hasArc,g=v.polylines,M=v.polygons,b=v.totalLength,x=!!(null==p?void 0:p.length),P=!1;return(u||x)&&(P=function(t,n,e,r,i,a,u){for(var s=!1,f=n/2,h=0;h<t.length;h++){var l=t[h],d=l.currentPoint,p=l.params,v=l.prePoint,y=l.box;if(!y||Lo(y.x-f,y.y-f,y.width+n,y.height+n,e,r)){switch(l.command){case"L":case"Z":s=_o(v[0],v[1],d[0],d[1],n,e,r);break;case"Q":s=Co.pointDistance(v[0],v[1],p[1],p[2],p[3],p[4],e,r)<=n/2;break;case"C":s=To.pointDistance(v[0],v[1],p[1],p[2],p[3],p[4],p[5],p[6],e,r,i)<=n/2;break;case"A":var m=l.arcParams,g=m.cx,M=m.cy,b=m.rx,x=m.ry,P=m.startAngle,E=m.endAngle,O=m.xRotation,S=b>x?b:x,C=b>x?1:b/x,A=b>x?x/b:1,j=o.fromTranslation(o.create(),[-g,-M]);o.multiply(j,o.fromRotation(o.create(),-O),j),o.multiply(j,o.fromScaling(o.create(),[1/C,1/A]),j);var w=c.fromValues(e,r);s=Do(0,0,S,P,E,n,(w=c.transformMat3(w,w,j))[0],w[1])}if(s)break}}return s}(y,a,n.x+h,n.y+d,b)),P||!s&&!x||(P=m?e(t,n):Xo(M,n.x+h,n.y+d)||Xo(g,n.x+h,n.y+d)),P}function Wo(t,n,e){var r=t.parsedStyle,o=r.radius,i=r.fill,a=r.stroke,u=r.lineWidth,c=void 0===u?0:u,s=r.width,f=r.height,h=r.clipPathTargets,l=!!(null==h?void 0:h.length);if(o){var d=!1;return(a||l)&&(d=function(t,n,e,r,o,i,a,u){return _o(t+o,n,t+e-o,n,i,a,u)||_o(t+e,n+o,t+e,n+r-o,i,a,u)||_o(t+e-o,n+r,t+o,n+r,i,a,u)||_o(t,n+r-o,t,n+o,i,a,u)||Do(t+e-o,n+o,o,1.5*Math.PI,2*Math.PI,i,a,u)||Do(t+e-o,n+r-o,o,0,.5*Math.PI,i,a,u)||Do(t+o,n+r-o,o,.5*Math.PI,Math.PI,i,a,u)||Do(t+o,n+o,o,Math.PI,1.5*Math.PI,i,a,u)}(0,0,s,f,o,c,n.x,n.y)),d||!i&&!l||(d=e(t,n)),d}var p=c/2;return i&&a||l?Lo(0-p,0-p,s+p,f+p,n.x,n.y):i?Lo(0,0,s,f,n.x,n.y):!!a&&function(t,n,e,r,o,i,a){var u=o/2;return Lo(t-u,n-u,e,o,i,a)||Lo(t+e-u,n-u,o,r,i,a)||Lo(t+u,n+r-u,e,o,i,a)||Lo(t-u,n+u,o,r,i,a)}(0,0,s,f,c,n.x,n.y)}function zo(t,n){var e=t.parsedStyle,r=e.stroke,o=e.fill,i=e.lineWidth,a=void 0===i?0:i,u=e.points,c=e.defX,s=void 0===c?0:c,f=e.defY,h=void 0===f?0:f,l=e.clipPathTargets,d=!!(null==l?void 0:l.length),p=!1;return(r||d)&&(p=Yo(u.points,a,n.x+s,n.y+h,!0)),p||!o&&!d||(p=qo(u.points,n.x+s,n.y+h)),p}var Qo=Object(M.Module)((function(t){t({token:"PointInPathPicker",useFactory:function(t){return function(t){return t===g.SHAPE.Circle?Ho:t===g.SHAPE.Ellipse?Go:t===g.SHAPE.Rect?Wo:t===g.SHAPE.Line?$o:t===g.SHAPE.Polyline?Vo:t===g.SHAPE.Polygon?zo:t===g.SHAPE.Path?Uo:t===g.SHAPE.Image||t===g.SHAPE.Text?function(){return!0}:null}}}),t(vo)})),Zo=function(){function t(){}return t.prototype.init=function(t){t.load(Qo,!0)},t.prototype.destroy=function(t){t.remove("PointInPathPicker"),t.remove(vo)},t}(),Jo=function(){function t(){}var n;return n=t,t.prototype.apply=function(t){var e=this,r=function(t){var n=t.target;if(n.nodeName===g.SHAPE.HTML){var r=n.parsedStyle.innerHTML,o="g-html-"+n.entity,i=e.contextService.getDomElement().parentNode;if(i)if(!i.querySelector("#"+o)){var a=document.createElement("div");n.parsedStyle.$el=a,a.id=o,N(r)?a.innerHTML=r:a.appendChild(r),i.appendChild(a)}}},o=function(t){var n=t.target;if(n.nodeName===g.SHAPE.HTML){var r="g-html-"+n.entity,o=e.contextService.getDomElement().parentNode;if(o){var i=o.querySelector("#"+r);i&&o.removeChild(i)}}};t.hooks.init.tap(n.tag,(function(){e.renderingContext.root.addEventListener(g.ElementEvent.MOUNTED,r),e.renderingContext.root.addEventListener(g.ElementEvent.UNMOUNTED,o)})),t.hooks.destroy.tap(n.tag,(function(){e.renderingContext.root.removeEventListener(g.ElementEvent.MOUNTED,r),e.renderingContext.root.removeEventListener(g.ElementEvent.UNMOUNTED,o)})),t.hooks.render.tap(n.tag,(function(t){if(t.nodeName===g.SHAPE.HTML){var n="g-html-"+t.entity,r=e.contextService.getDomElement().parentNode;if(r){var o=r.querySelector("#"+n);e.updateCSSStyle(o,t.parsedStyle,t)}}}))},t.prototype.updateCSSStyle=function(t,n,e){var r=n.zIndex,o=void 0===r?0:r,i=n.visibility,a=void 0===i?"visible":i,u=n.opacity,c=void 0===u?1:u,s=n.fill,f=n.lineWidth,h=void 0===f?0:f,l=n.lineDash,d=n.stroke,p=n.anchor,v=n.width,y=void 0===v?0:v,m=n.height,M=void 0===m?0:m,b=n.style,x=void 0===b?"":b,P=n.className,E=void 0===P?"":P,O={position:"absolute",top:0,left:0};if(O.width=y+"px",O.height=M+"px",O.transform="matrix3d("+e.getWorldTransform().join(",")+")",p&&(O.transform+=" translate("+100*p[0]+"%, "+100*p[0]+"%)"),e.style.transformOrigin&&(O["transform-origin"]=e.style.transformOrigin),O["z-index"]=o,O.visibility=a,O.opacity=c,s){var S="";if(s.type===g.PARSED_COLOR_TYPE.Constant)S=s.formatted;else if(s.type===g.PARSED_COLOR_TYPE.LinearGradient){S="linear-gradient(to right, "+s.value.steps.map((function(t){return t[1]+" "+100*Number(t[0])+"%"})).join(",")+");"}else s.type===g.PARSED_COLOR_TYPE.RadialGradient||(s.type,g.PARSED_COLOR_TYPE.Pattern);O.background=S}O["border-width"]=h+"px",d&&d.type===g.PARSED_COLOR_TYPE.Constant&&(O["border-color"]=d.formatted,O["border-style"]="solid"),l&&(O["border-style"]="dashed"),e.style.filter&&(O.filter=e.style.filter),E&&(Array.isArray(E)?E.forEach((function(n){t.classList.add(n)})):t.classList.add(E)),t.setAttribute("style",Object.keys(O).map((function(t){return t+":"+O[t]})).join(";")+x)},t.tag="HTMLRenderingPlugin",p([Object(M.inject)(g.ContextService),v("design:type",Object)],t.prototype,"contextService",void 0),p([Object(M.inject)(g.RenderingContext),v("design:type",Object)],t.prototype,"renderingContext",void 0),t=n=p([Object(M.singleton)({contrib:g.RenderingPluginContribution})],t)}(),Ko=Object(M.Module)((function(t){t(Jo)})),ti=function(){function t(){}return t.prototype.init=function(t){t.load(Ko,!0)},t.prototype.destroy=function(t){t.remove(Jo)},t}(),ni="undefined"!=typeof window&&void 0!==window.document;var ei=function(){function t(){}return t.prototype.init=function(){var t=this.canvasConfig,n=t.container,e=t.canvas,r=t.devicePixelRatio;if(e)this.$canvas=e,n&&e.parentElement!==n&&n.appendChild(e),this.$container=e.parentElement,this.canvasConfig.container=this.$container;else if(n&&(this.$container=N(n)?document.getElementById(n):n,this.$container)){var o=document.createElement("canvas");this.$container.appendChild(o),this.$container.style.position||(this.$container.style.position="relative"),this.$canvas=o}this.context=this.$canvas.getContext("2d");var i=r||ni&&window.devicePixelRatio||1;i=i>=1?Math.ceil(i):1,this.dpr=i,this.resize(this.canvasConfig.width,this.canvasConfig.height)},t.prototype.getContext=function(){return this.context},t.prototype.getDomElement=function(){return this.$canvas},t.prototype.getDPR=function(){return this.dpr},t.prototype.getBoundingClientRect=function(){if(this.$canvas.getBoundingClientRect)return this.$canvas.getBoundingClientRect()},t.prototype.destroy=function(){this.$container&&this.$canvas&&this.$canvas.parentNode&&this.$container.removeChild(this.$canvas)},t.prototype.resize=function(t,n){if(this.$canvas){this.$canvas.width=this.dpr*t,this.$canvas.height=this.dpr*n,function(t,n,e){ni&&t.style&&(t.style.width=n+"px",t.style.height=e+"px")}(this.$canvas,t,n);var e=this.getDPR();this.context.scale(e,e)}},t.prototype.applyCursorStyle=function(t){this.$container&&this.$container.style&&(this.$container.style.cursor=t)},p([Object(M.inject)(g.CanvasConfig),v("design:type",Object)],t.prototype,"canvasConfig",void 0),t=p([Object(M.singleton)({token:g.ContextService})],t)}(),ri=Object(M.Module)((function(t){t(ei)})),oi=function(){function t(){}return t.prototype.init=function(t){t.load(ri,!0)},t.prototype.destroy=function(t){t.remove(ei)},t}(),ii=function(t){function n(n){var e=t.call(this,n)||this;return e.registerPlugin(new oi),e.registerPlugin(new po),e.registerPlugin(new O),e.registerPlugin(new Zo),e.registerPlugin(new ti),e}return function(t,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function e(){this.constructor=t}l(t,n),t.prototype=null===n?Object.create(n):(e.prototype=n.prototype,new e)}(n,t),n}(g.AbstractRenderer)}])}));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@antv/g-canvas",
3
- "version": "1.0.12",
3
+ "version": "1.0.13",
4
4
  "description": "A renderer implemented by Canvas 2D API",
5
5
  "main": "lib/index.js",
6
6
  "module": "es/index.js",
@@ -37,10 +37,10 @@
37
37
  },
38
38
  "homepage": "https://github.com/antvis/g#readme",
39
39
  "dependencies": {
40
- "@antv/g-plugin-canvas-picker": "^1.0.10",
41
- "@antv/g-plugin-canvas-renderer": "^1.0.10",
42
- "@antv/g-plugin-dom-interaction": "^1.0.10",
43
- "@antv/g-plugin-html-renderer": "^1.0.11",
40
+ "@antv/g-plugin-canvas-picker": "^1.0.11",
41
+ "@antv/g-plugin-canvas-renderer": "^1.0.11",
42
+ "@antv/g-plugin-dom-interaction": "^1.0.11",
43
+ "@antv/g-plugin-html-renderer": "^1.0.12",
44
44
  "@antv/util": "^2.0.13",
45
45
  "tslib": "^2.3.1"
46
46
  },
@@ -51,5 +51,5 @@
51
51
  "scripts": {
52
52
  "umd": "webpack"
53
53
  },
54
- "gitHead": "e713211a92d77d0820e3252c3e8704aefda9c2e7"
54
+ "gitHead": "688274a67997224971b11c806a0e363ea1326240"
55
55
  }