@antv/g6 5.0.0-alpha.1 → 5.0.0-alpha.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/g6.min.js +1 -1
- package/package.json +1 -1
package/dist/g6.min.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).G6={})}(this,function(N){"use strict";var C=function(t,e){return(C=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(t,e){t.__proto__=e}:function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])}))(t,e)};function P(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function n(){this.constructor=t}C(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}var k=function(){return(k=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var i in e=arguments[n])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t}).apply(this,arguments)};function I(t,e){var n={};for(i in t)Object.prototype.hasOwnProperty.call(t,i)&&e.indexOf(i)<0&&(n[i]=t[i]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols)for(var r=0,i=Object.getOwnPropertySymbols(t);r<i.length;r++)e.indexOf(i[r])<0&&Object.prototype.propertyIsEnumerable.call(t,i[r])&&(n[i[r]]=t[i[r]]);return n}function s(t,a,s,l){return new(s=s||Promise)(function(n,e){function r(t){try{o(l.next(t))}catch(t){e(t)}}function i(t){try{o(l.throw(t))}catch(t){e(t)}}function o(t){var e;t.done?n(t.value):((e=t.value)instanceof s?e:new s(function(t){t(e)})).then(r,i)}o((l=l.apply(t,a||[])).next())})}function U(r,i){var o,a,s,l={label:0,sent:function(){if(1&s[0])throw s[1];return s[1]},trys:[],ops:[]},u={next:t(0),throw:t(1),return:t(2)};return"function"==typeof Symbol&&(u[Symbol.iterator]=function(){return this}),u;function t(n){return function(t){var e=[n,t];if(o)throw new TypeError("Generator is already executing.");for(;l=u&&e[u=0]?0:l;)try{if(o=1,a&&(s=2&e[0]?a.return:e[0]?a.throw||((s=a.return)&&s.call(a),0):a.next)&&!(s=s.call(a,e[1])).done)return s;switch(a=0,(e=s?[2&e[0],s.value]:e)[0]){case 0:case 1:s=e;break;case 4:return l.label++,{value:e[1],done:!1};case 5:l.label++,a=e[1],e=[0];continue;case 7:e=l.ops.pop(),l.trys.pop();continue;default:if(!(s=0<(s=l.trys).length&&s[s.length-1])&&(6===e[0]||2===e[0])){l=0;continue}if(3===e[0]&&(!s||e[1]>s[0]&&e[1]<s[3]))l.label=e[1];else if(6===e[0]&&l.label<s[1])l.label=s[1],s=e;else{if(!(s&&l.label<s[2])){s[2]&&l.ops.pop(),l.trys.pop();continue}l.label=s[2],l.ops.push(e)}}e=i.call(r,l)}catch(t){e=[6,t],a=0}finally{o=s=0}if(5&e[0])throw e[1];return{value:e[0]?e[1]:void 0,done:!0}}}}function D(t,e){var n="function"==typeof Symbol&&t[Symbol.iterator];if(!n)return t;var r,i,o=n.call(t),a=[];try{for(;(void 0===e||0<e--)&&!(r=o.next()).done;)a.push(r.value)}catch(t){i={error:t}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(i)throw i.error}}return a}function O(t,e,n){if(n||2===arguments.length)for(var r,i=0,o=e.length;i<o;i++)!r&&i in e||((r=r||Array.prototype.slice.call(e,0,i))[i]=e[i]);return t.concat(r||Array.prototype.slice.call(e))}function L(t,e,n,r){if("a"===n&&!r)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof e?t===e&&r:e.has(t))return"m"===n?r:"a"===n?r.call(t):r?r.value:e.get(t);throw new TypeError("Cannot read private member from an object whose class did not declare it")}W.prototype.on=function(t,e,n){return this._events[t]||(this._events[t]=[]),this._events[t].push({callback:e,once:!!n}),this},W.prototype.once=function(t,e){return this.on(t,e,!0)},W.prototype.emit=function(o){for(var a=this,s=[],t=1;t<arguments.length;t++)s[t-1]=arguments[t];function e(t){for(var e,n,r=t.length,i=0;i<r;i++)t[i]&&(n=(e=t[i]).callback,e.once&&(t.splice(i,1),0===t.length&&delete a._events[o],r--,i--),n.apply(a,s))}var n=this._events[o]||[],r=this._events["*"]||[];e(n),e(r)},W.prototype.off=function(t,e){if(t)if(e){for(var n=this._events[t]||[],r=n.length,i=0;i<r;i++)n[i].callback===e&&(n.splice(i,1),r--,i--);0===n.length&&delete this._events[t]}else delete this._events[t];else this._events={};return this},W.prototype.getEvents=function(){return this._events};var G=W;function W(){this._events={}}var V="undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{};function j(t,e,n){return t(n={path:e,exports:{},require:function(t,e){throw null==e&&n.path,new Error("Dynamic requires are not currently supported by @rollup/plugin-commonjs")}},n.exports),n.exports}var z=j(function(t,e){function s(t,e,n,r,i){!function t(e,n,r,i,o){for(;r<i;){600<i-r&&(a=i-r+1,c=n-r+1,l=Math.log(a),s=.5*Math.exp(2*l/3),l=.5*Math.sqrt(l*s*(a-s)/a)*(c-a/2<0?-1:1),u=Math.max(r,Math.floor(n-c*s/a+l)),c=Math.min(i,Math.floor(n+(a-c)*s/a+l)),t(e,n,u,c,o));var a,s,l,u,c,h=e[n],d=r,f=i;for(p(e,r,n),0<o(e[i],h)&&p(e,r,i);d<f;){for(p(e,d,f),d++,f--;o(e[d],h)<0;)d++;for(;0<o(e[f],h);)f--}0===o(e[r],h)?p(e,r,f):p(e,++f,i),f<=n&&(r=f+1),n<=f&&(i=f-1)}}(t,e,n||0,r||t.length-1,i||o)}function p(t,e,n){var r=t[e];t[e]=t[n],t[n]=r}function o(t,e){return t<e?-1:e<t?1:0}function f(t,e){g(t,0,t.children.length,e,t)}function g(t,e,n,r,i){(i=i||y(null)).minX=1/0,i.minY=1/0,i.maxX=-1/0,i.maxY=-1/0;for(var o=e;o<n;o++){var a=t.children[o];d(i,t.leaf?r(a):a)}return i}function d(t,e){t.minX=Math.min(t.minX,e.minX),t.minY=Math.min(t.minY,e.minY),t.maxX=Math.max(t.maxX,e.maxX),t.maxY=Math.max(t.maxY,e.maxY)}function a(t,e){return t.minX-e.minX}function l(t,e){return t.minY-e.minY}function m(t){return(t.maxX-t.minX)*(t.maxY-t.minY)}function v(t){return t.maxX-t.minX+(t.maxY-t.minY)}function c(t,e){return t.minX<=e.minX&&t.minY<=e.minY&&e.maxX<=t.maxX&&e.maxY<=t.maxY}function u(t,e){return e.minX<=t.maxX&&e.minY<=t.maxY&&e.maxX>=t.minX&&e.maxY>=t.minY}function y(t){return{children:t,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function E(t,e,n,r,i){for(var o,a=[e,n];a.length;)(n=a.pop())-(e=a.pop())<=r||(s(t,o=e+Math.ceil((n-e)/r/2)*r,e,n,i),a.push(e,o,o,n))}t.exports=((t=function(t){void 0===t&&(t=9),this._maxEntries=Math.max(4,t),this._minEntries=Math.max(2,Math.ceil(.4*this._maxEntries)),this.clear()}).prototype.all=function(){return this._all(this.data,[])},t.prototype.search=function(t){var e=this.data,n=[];if(u(t,e))for(var r=this.toBBox,i=[];e;){for(var o=0;o<e.children.length;o++){var a=e.children[o],s=e.leaf?r(a):a;u(t,s)&&(e.leaf?n.push(a):c(t,s)?this._all(a,n):i.push(a))}e=i.pop()}return n},t.prototype.collides=function(t){var e=this.data;if(u(t,e))for(var n=[];e;){for(var r=0;r<e.children.length;r++){var i=e.children[r],o=e.leaf?this.toBBox(i):i;if(u(t,o)){if(e.leaf||c(t,o))return!0;n.push(i)}}e=n.pop()}return!1},t.prototype.load=function(t){if(t&&t.length)if(t.length<this._minEntries)for(var e=0;e<t.length;e++)this.insert(t[e]);else{var n,r=this._build(t.slice(),0,t.length-1,0);this.data.children.length?this.data.height===r.height?this._splitRoot(this.data,r):(this.data.height<r.height&&(n=this.data,this.data=r,r=n),this._insert(r,this.data.height-r.height-1,!0)):this.data=r}return this},t.prototype.insert=function(t){return t&&this._insert(t,this.data.height-1),this},t.prototype.clear=function(){return this.data=y([]),this},t.prototype.remove=function(t,e){if(t)for(var n,r,i,o=this.data,a=this.toBBox(t),s=[],l=[];o||s.length;){if(o||(o=s.pop(),r=s[s.length-1],n=l.pop(),i=!0),o.leaf){var u=function(t,e,n){if(!n)return e.indexOf(t);for(var r=0;r<e.length;r++)if(n(t,e[r]))return r;return-1}(t,o.children,e);if(-1!==u)return o.children.splice(u,1),s.push(o),this._condense(s),this}i||o.leaf||!c(o,a)?r?(n++,o=r.children[n],i=!1):o=null:(s.push(o),l.push(n),o=(r=o).children[n=0])}return this},t.prototype.toBBox=function(t){return t},t.prototype.compareMinX=function(t,e){return t.minX-e.minX},t.prototype.compareMinY=function(t,e){return t.minY-e.minY},t.prototype.toJSON=function(){return this.data},t.prototype.fromJSON=function(t){return this.data=t,this},t.prototype._all=function(t,e){for(var n=[];t;)t.leaf?e.push.apply(e,t.children):n.push.apply(n,t.children),t=n.pop();return e},t.prototype._build=function(t,e,n,r){var i,o=n-e+1,a=this._maxEntries;if(o<=a)f(i=y(t.slice(e,n+1)),this.toBBox);else{r||(r=Math.ceil(Math.log(o)/Math.log(a)),a=Math.ceil(o/Math.pow(a,r-1))),(i=y([])).leaf=!1,i.height=r;var s=Math.ceil(o/a),l=s*Math.ceil(Math.sqrt(a));E(t,e,n,l,this.compareMinX);for(var u=e;u<=n;u+=l){var c=Math.min(u+l-1,n);E(t,u,c,s,this.compareMinY);for(var h=u;h<=c;h+=s){var d=Math.min(h+s-1,c);i.children.push(this._build(t,h,d,r-1))}}f(i,this.toBBox)}return i},t.prototype._chooseSubtree=function(t,e,n,r){for(;;){if(r.push(e),e.leaf||r.length-1===n)break;for(var i=1/0,o=1/0,a=void 0,s=0;s<e.children.length;s++){var l=e.children[s],u=m(l),c=(h=t,c=l,(Math.max(c.maxX,h.maxX)-Math.min(c.minX,h.minX))*(Math.max(c.maxY,h.maxY)-Math.min(c.minY,h.minY))-u);c<o?(o=c,i=u<i?u:i,a=l):c===o&&u<i&&(i=u,a=l)}e=a||e.children[0]}var h,c;return e},t.prototype._insert=function(t,e,n){var n=n?t:this.toBBox(t),r=[],i=this._chooseSubtree(n,this.data,e,r);for(i.children.push(t),d(i,n);0<=e&&r[e].children.length>this._maxEntries;)this._split(r,e),e--;this._adjustParentBBoxes(n,r,e)},t.prototype._split=function(t,e){var n=t[e],r=n.children.length,i=this._minEntries,i=(this._chooseSplitAxis(n,i,r),this._chooseSplitIndex(n,i,r)),r=y(n.children.splice(i,n.children.length-i));r.height=n.height,r.leaf=n.leaf,f(n,this.toBBox),f(r,this.toBBox),e?t[e-1].children.push(r):this._splitRoot(n,r)},t.prototype._splitRoot=function(t,e){this.data=y([t,e]),this.data.height=t.height+1,this.data.leaf=!1,f(this.data,this.toBBox)},t.prototype._chooseSplitIndex=function(t,e,n){for(var r,i,o,a,s=1/0,l=1/0,u=e;u<=n-e;u++){var c=g(t,0,u,this.toBBox),h=g(t,u,n,this.toBBox),d=(i=c,d=h,f=a=o=void 0,o=Math.max(i.minX,d.minX),a=Math.max(i.minY,d.minY),f=Math.min(i.maxX,d.maxX),i=Math.min(i.maxY,d.maxY),Math.max(0,f-o)*Math.max(0,i-a)),f=m(c)+m(h);d<s?(s=d,r=u,l=f<l?f:l):d===s&&f<l&&(l=f,r=u)}return r||n-e},t.prototype._chooseSplitAxis=function(t,e,n){var r=t.leaf?this.compareMinX:a,i=t.leaf?this.compareMinY:l;this._allDistMargin(t,e,n,r)<this._allDistMargin(t,e,n,i)&&t.children.sort(r)},t.prototype._allDistMargin=function(t,e,n,r){t.children.sort(r);for(var i=this.toBBox,o=g(t,0,e,i),a=g(t,n-e,n,i),s=v(o)+v(a),l=e;l<n-e;l++){var u=t.children[l];d(o,t.leaf?i(u):u),s+=v(o)}for(var c=n-e-1;e<=c;c--){var h=t.children[c];d(a,t.leaf?i(h):h),s+=v(a)}return s},t.prototype._adjustParentBBoxes=function(t,e,n){for(var r=n;0<=r;r--)d(e[r],t)},t.prototype._condense=function(t){for(var e=t.length-1,n=void 0;0<=e;e--)0===t[e].children.length?0<e?(n=t[e-1].children).splice(n.indexOf(t[e]),1):this.clear():f(t[e],this.toBBox)},t)}),H=1e-6,X="undefined"!=typeof Float32Array?Float32Array:Array;function Y(){var t=new X(9);return X!=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 K(){var t=new X(16);return X!=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 q(t){var e=new X(16);return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[8]=t[8],e[9]=t[9],e[10]=t[10],e[11]=t[11],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15],e}function $(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[8]=e[8],t[9]=e[9],t[10]=e[10],t[11]=e[11],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15],t}function Z(t,e,n,r,i,o,a,s,l,u,c,h,d,f,p,g){var m=new X(16);return m[0]=t,m[1]=e,m[2]=n,m[3]=r,m[4]=i,m[5]=o,m[6]=a,m[7]=s,m[8]=l,m[9]=u,m[10]=c,m[11]=h,m[12]=d,m[13]=f,m[14]=p,m[15]=g,m}function Q(t,e,n,r,i,o,a,s,l,u,c,h,d,f,p,g,m){return t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=o,t[5]=a,t[6]=s,t[7]=l,t[8]=u,t[9]=c,t[10]=h,t[11]=d,t[12]=f,t[13]=p,t[14]=g,t[15]=m,t}function J(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 tt(t,e){var n,r,i,o,a,s;return t===e?(n=e[1],r=e[2],i=e[3],o=e[6],a=e[7],s=e[11],t[1]=e[4],t[2]=e[8],t[3]=e[12],t[4]=n,t[6]=e[9],t[7]=e[13],t[8]=r,t[9]=o,t[11]=e[14],t[12]=i,t[13]=a,t[14]=s):(t[0]=e[0],t[1]=e[4],t[2]=e[8],t[3]=e[12],t[4]=e[1],t[5]=e[5],t[6]=e[9],t[7]=e[13],t[8]=e[2],t[9]=e[6],t[10]=e[10],t[11]=e[14],t[12]=e[3],t[13]=e[7],t[14]=e[11],t[15]=e[15]),t}function et(t,e){var n=e[0],r=e[1],i=e[2],o=e[3],a=e[4],s=e[5],l=e[6],u=e[7],c=e[8],h=e[9],d=e[10],f=e[11],p=e[12],g=e[13],m=e[14],e=e[15],v=n*s-r*a,y=n*l-i*a,E=n*u-o*a,_=r*l-i*s,b=r*u-o*s,x=i*u-o*l,S=c*g-h*p,w=c*m-d*p,T=c*e-f*p,A=h*m-d*g,M=h*e-f*g,R=d*e-f*m,N=v*R-y*M+E*A+_*T-b*w+x*S;return N?(t[0]=(s*R-l*M+u*A)*(N=1/N),t[1]=(i*M-r*R-o*A)*N,t[2]=(g*x-m*b+e*_)*N,t[3]=(d*b-h*x-f*_)*N,t[4]=(l*T-a*R-u*w)*N,t[5]=(n*R-i*T+o*w)*N,t[6]=(m*E-p*x-e*y)*N,t[7]=(c*x-d*E+f*y)*N,t[8]=(a*M-s*T+u*S)*N,t[9]=(r*T-n*M-o*S)*N,t[10]=(p*b-g*E+e*v)*N,t[11]=(h*E-c*b-f*v)*N,t[12]=(s*w-a*A-l*S)*N,t[13]=(n*A-r*w+i*S)*N,t[14]=(g*y-p*_-m*v)*N,t[15]=(c*_-h*y+d*v)*N,t):null}function nt(t){var e=t[0],n=t[1],r=t[2],i=t[3],o=t[4],a=t[5],s=t[6],l=t[7],u=t[8],c=t[9],h=t[10],d=t[11],f=t[12],p=t[13],g=t[14],t=t[15];return(e*a-n*o)*(h*t-d*g)-(e*s-r*o)*(c*t-d*p)+(e*l-i*o)*(c*g-h*p)+(n*s-r*a)*(u*t-d*f)-(n*l-i*a)*(u*g-h*f)+(r*l-i*s)*(u*p-c*f)}function rt(t,e,n){var r=e[0],i=e[1],o=e[2],a=e[3],s=e[4],l=e[5],u=e[6],c=e[7],h=e[8],d=e[9],f=e[10],p=e[11],g=e[12],m=e[13],v=e[14],e=e[15],y=n[0],E=n[1],_=n[2],b=n[3];return t[0]=y*r+E*s+_*h+b*g,t[1]=y*i+E*l+_*d+b*m,t[2]=y*o+E*u+_*f+b*v,t[3]=y*a+E*c+_*p+b*e,y=n[4],E=n[5],_=n[6],b=n[7],t[4]=y*r+E*s+_*h+b*g,t[5]=y*i+E*l+_*d+b*m,t[6]=y*o+E*u+_*f+b*v,t[7]=y*a+E*c+_*p+b*e,y=n[8],E=n[9],_=n[10],b=n[11],t[8]=y*r+E*s+_*h+b*g,t[9]=y*i+E*l+_*d+b*m,t[10]=y*o+E*u+_*f+b*v,t[11]=y*a+E*c+_*p+b*e,y=n[12],E=n[13],_=n[14],b=n[15],t[12]=y*r+E*s+_*h+b*g,t[13]=y*i+E*l+_*d+b*m,t[14]=y*o+E*u+_*f+b*v,t[15]=y*a+E*c+_*p+b*e,t}function it(t,e,n){var r,i,o,a,s,l,u,c,h,d,f,p,g=n[0],m=n[1],n=n[2];return e===t?(t[12]=e[0]*g+e[4]*m+e[8]*n+e[12],t[13]=e[1]*g+e[5]*m+e[9]*n+e[13],t[14]=e[2]*g+e[6]*m+e[10]*n+e[14],t[15]=e[3]*g+e[7]*m+e[11]*n+e[15]):(r=e[0],i=e[1],o=e[2],a=e[3],s=e[4],l=e[5],u=e[6],c=e[7],h=e[8],d=e[9],f=e[10],p=e[11],t[0]=r,t[1]=i,t[2]=o,t[3]=a,t[4]=s,t[5]=l,t[6]=u,t[7]=c,t[8]=h,t[9]=d,t[10]=f,t[11]=p,t[12]=r*g+s*m+h*n+e[12],t[13]=i*g+l*m+d*n+e[13],t[14]=o*g+u*m+f*n+e[14],t[15]=a*g+c*m+p*n+e[15]),t}function ot(t,e,n){var r=n[0],i=n[1],n=n[2];return t[0]=e[0]*r,t[1]=e[1]*r,t[2]=e[2]*r,t[3]=e[3]*r,t[4]=e[4]*i,t[5]=e[5]*i,t[6]=e[6]*i,t[7]=e[7]*i,t[8]=e[8]*n,t[9]=e[9]*n,t[10]=e[10]*n,t[11]=e[11]*n,t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15],t}function at(t,e,n){var r=Math.sin(n),n=Math.cos(n),i=e[4],o=e[5],a=e[6],s=e[7],l=e[8],u=e[9],c=e[10],h=e[11];return e!==t&&(t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[4]=i*n+l*r,t[5]=o*n+u*r,t[6]=a*n+c*r,t[7]=s*n+h*r,t[8]=l*n-i*r,t[9]=u*n-o*r,t[10]=c*n-a*r,t[11]=h*n-s*r,t}function st(t,e,n){var r=Math.sin(n),n=Math.cos(n),i=e[0],o=e[1],a=e[2],s=e[3],l=e[8],u=e[9],c=e[10],h=e[11];return e!==t&&(t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[0]=i*n-l*r,t[1]=o*n-u*r,t[2]=a*n-c*r,t[3]=s*n-h*r,t[8]=i*r+l*n,t[9]=o*r+u*n,t[10]=a*r+c*n,t[11]=s*r+h*n,t}function ht(t,e){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]=e[0],t[13]=e[1],t[14]=e[2],t[15]=1,t}function dt(t,e){return t[0]=e[0],t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=e[1],t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=e[2],t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}function ft(t,e,n){var r=e[0],i=e[1],o=e[2],e=e[3],a=r+r,s=i+i,l=o+o,u=r*a,c=r*s,r=r*l,h=i*s,i=i*l,o=o*l,a=e*a,s=e*s,e=e*l;return t[0]=1-(h+o),t[1]=c+e,t[2]=r-s,t[3]=0,t[4]=c-e,t[5]=1-(u+o),t[6]=i+a,t[7]=0,t[8]=r+s,t[9]=i-a,t[10]=1-(u+h),t[11]=0,t[12]=n[0],t[13]=n[1],t[14]=n[2],t[15]=1,t}function pt(t,e){return t[0]=e[12],t[1]=e[13],t[2]=e[14],t}function gt(t,e){var n=e[0],r=e[1],i=e[2],o=e[4],a=e[5],s=e[6],l=e[8],u=e[9],e=e[10];return t[0]=Math.hypot(n,r,i),t[1]=Math.hypot(o,a,s),t[2]=Math.hypot(l,u,e),t}function mt(t,e){var n=new X(3),r=(gt(n,e),1/n[0]),i=1/n[1],n=1/n[2],o=e[0]*r,a=e[1]*i,s=e[2]*n,l=e[4]*r,u=e[5]*i,c=e[6]*n,r=e[8]*r,i=e[9]*i,e=e[10]*n,n=o+u+e,h=0;return 0<n?(h=2*Math.sqrt(1+n),t[3]=.25*h,t[0]=(c-i)/h,t[1]=(r-s)/h,t[2]=(a-l)/h):u<o&&e<o?(h=2*Math.sqrt(1+o-u-e),t[3]=(c-i)/h,t[0]=.25*h,t[1]=(a+l)/h,t[2]=(r+s)/h):e<u?(h=2*Math.sqrt(1+u-o-e),t[3]=(r-s)/h,t[0]=(a+l)/h,t[1]=.25*h,t[2]=(c+i)/h):(h=2*Math.sqrt(1+e-o-u),t[3]=(a-l)/h,t[0]=(r+s)/h,t[1]=(c+i)/h,t[2]=.25*h),t}function vt(t,e,n,r,i){var o=e[0],a=e[1],s=e[2],e=e[3],l=o+o,u=a+a,c=s+s,h=o*l,d=o*u,o=o*c,f=a*u,a=a*c,s=s*c,l=e*l,u=e*u,e=e*c,c=r[0],p=r[1],r=r[2],g=i[0],m=i[1],i=i[2],v=(1-(f+s))*c,y=(d+e)*c,c=(o-u)*c,d=(d-e)*p,e=(1-(h+s))*p,s=(a+l)*p,p=(o+u)*r,o=(a-l)*r,u=(1-(h+f))*r;return t[0]=v,t[1]=y,t[2]=c,t[3]=0,t[4]=d,t[5]=e,t[6]=s,t[7]=0,t[8]=p,t[9]=o,t[10]=u,t[11]=0,t[12]=n[0]+g-(v*g+d*m+p*i),t[13]=n[1]+m-(y*g+e*m+o*i),t[14]=n[2]+i-(c*g+s*m+u*i),t[15]=1,t}function yt(t,e){var n=e[0],r=e[1],i=e[2],e=e[3],o=n+n,a=r+r,s=i+i,n=n*o,l=r*o,r=r*a,u=i*o,c=i*a,i=i*s,o=e*o,a=e*a,e=e*s;return t[0]=1-r-i,t[1]=l+e,t[2]=u-a,t[3]=0,t[4]=l-e,t[5]=1-n-i,t[6]=c+o,t[7]=0,t[8]=u+a,t[9]=c-o,t[10]=1-n-r,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}function Et(t,e,n,r,i){e=1/Math.tan(e/2);return t[0]=e/n,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=e,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!=i&&i!==1/0?(t[10]=(i+r)*(n=1/(r-i)),t[14]=2*i*r*n):(t[10]=-1,t[14]=-2*r),t}function _t(t,e,n,r,i,o,a){var s=1/(e-n),l=1/(r-i),u=1/(o-a);return t[0]=-2*s,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=-2*l,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=2*u,t[11]=0,t[12]=(e+n)*s,t[13]=(i+r)*l,t[14]=(a+o)*u,t[15]=1,t}Math.hypot||(Math.hypot=function(){for(var t=0,e=arguments.length;e--;)t+=arguments[e]*arguments[e];return Math.sqrt(t)});var bt=_t;function xt(t,e,n,r){var i,o,a,s,l=e[0],u=e[1],e=e[2],c=r[0],h=r[1],r=r[2],d=n[0],f=n[1],n=n[2];return Math.abs(l-d)<H&&Math.abs(u-f)<H&&Math.abs(e-n)<H?J(t):(d=l-d,f=u-f,n=e-n,i=h*(n*=s=1/Math.hypot(d,f,n))-r*(f*=s),r=r*(d*=s)-c*n,c=c*f-h*d,(s=Math.hypot(i,r,c))?(i*=s=1/s,r*=s,c*=s):c=r=i=0,h=f*c-n*r,o=n*i-d*c,a=d*r-f*i,(s=Math.hypot(h,o,a))?(h*=s=1/s,o*=s,a*=s):a=o=h=0,t[0]=i,t[1]=h,t[2]=d,t[3]=0,t[4]=r,t[5]=o,t[6]=f,t[7]=0,t[8]=c,t[9]=a,t[10]=n,t[11]=0,t[12]=-(i*l+r*u+c*e),t[13]=-(h*l+o*u+a*e),t[14]=-(d*l+f*u+n*e),t[15]=1,t)}function St(t,e,n){return t[0]=e[0]-n[0],t[1]=e[1]-n[1],t[2]=e[2]-n[2],t[3]=e[3]-n[3],t[4]=e[4]-n[4],t[5]=e[5]-n[5],t[6]=e[6]-n[6],t[7]=e[7]-n[7],t[8]=e[8]-n[8],t[9]=e[9]-n[9],t[10]=e[10]-n[10],t[11]=e[11]-n[11],t[12]=e[12]-n[12],t[13]=e[13]-n[13],t[14]=e[14]-n[14],t[15]=e[15]-n[15],t}var wt=rt,Tt=Object.freeze({__proto__:null,create:K,clone:q,copy:$,fromValues:Z,set:Q,identity:J,transpose:tt,invert:et,adjoint:function(t,e){var n=e[0],r=e[1],i=e[2],o=e[3],a=e[4],s=e[5],l=e[6],u=e[7],c=e[8],h=e[9],d=e[10],f=e[11],p=e[12],g=e[13],m=e[14],e=e[15];return t[0]=s*(d*e-f*m)-h*(l*e-u*m)+g*(l*f-u*d),t[1]=-(r*(d*e-f*m)-h*(i*e-o*m)+g*(i*f-o*d)),t[2]=r*(l*e-u*m)-s*(i*e-o*m)+g*(i*u-o*l),t[3]=-(r*(l*f-u*d)-s*(i*f-o*d)+h*(i*u-o*l)),t[4]=-(a*(d*e-f*m)-c*(l*e-u*m)+p*(l*f-u*d)),t[5]=n*(d*e-f*m)-c*(i*e-o*m)+p*(i*f-o*d),t[6]=-(n*(l*e-u*m)-a*(i*e-o*m)+p*(i*u-o*l)),t[7]=n*(l*f-u*d)-a*(i*f-o*d)+c*(i*u-o*l),t[8]=a*(h*e-f*g)-c*(s*e-u*g)+p*(s*f-u*h),t[9]=-(n*(h*e-f*g)-c*(r*e-o*g)+p*(r*f-o*h)),t[10]=n*(s*e-u*g)-a*(r*e-o*g)+p*(r*u-o*s),t[11]=-(n*(s*f-u*h)-a*(r*f-o*h)+c*(r*u-o*s)),t[12]=-(a*(h*m-d*g)-c*(s*m-l*g)+p*(s*d-l*h)),t[13]=n*(h*m-d*g)-c*(r*m-i*g)+p*(r*d-i*h),t[14]=-(n*(s*m-l*g)-a*(r*m-i*g)+p*(r*l-i*s)),t[15]=n*(s*d-l*h)-a*(r*d-i*h)+c*(r*l-i*s),t},determinant:nt,multiply:rt,translate:it,scale:ot,rotate:function(t,e,n,r){var i,o,a,s,l,u,c,h,d,f,p,g,m,v,y,E,_,b,x,S,w=r[0],T=r[1],r=r[2],A=Math.hypot(w,T,r);return A<H?null:(w*=A=1/A,T*=A,r*=A,A=Math.sin(n),n=Math.cos(n),o=e[0],a=e[1],s=e[2],l=e[3],u=e[4],c=e[5],h=e[6],d=e[7],f=e[8],p=e[9],g=e[10],m=e[11],y=w*T*(i=1-n)-r*A,E=T*T*i+n,_=r*T*i+w*A,b=w*r*i+T*A,x=T*r*i-w*A,S=r*r*i+n,t[0]=o*(n=w*w*i+n)+u*(v=T*w*i+r*A)+f*(r=r*w*i-T*A),t[1]=a*n+c*v+p*r,t[2]=s*n+h*v+g*r,t[3]=l*n+d*v+m*r,t[4]=o*y+u*E+f*_,t[5]=a*y+c*E+p*_,t[6]=s*y+h*E+g*_,t[7]=l*y+d*E+m*_,t[8]=o*b+u*x+f*S,t[9]=a*b+c*x+p*S,t[10]=s*b+h*x+g*S,t[11]=l*b+d*x+m*S,e!==t&&(t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t)},rotateX:at,rotateY:st,rotateZ:function(t,e,n){var r=Math.sin(n),n=Math.cos(n),i=e[0],o=e[1],a=e[2],s=e[3],l=e[4],u=e[5],c=e[6],h=e[7];return e!==t&&(t[8]=e[8],t[9]=e[9],t[10]=e[10],t[11]=e[11],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[0]=i*n+l*r,t[1]=o*n+u*r,t[2]=a*n+c*r,t[3]=s*n+h*r,t[4]=l*n-i*r,t[5]=u*n-o*r,t[6]=c*n-a*r,t[7]=h*n-s*r,t},fromTranslation:ht,fromScaling:dt,fromRotation:function(t,e,n){var r,i=n[0],o=n[1],n=n[2],a=Math.hypot(i,o,n);return a<H?null:(i*=a=1/a,o*=a,n*=a,a=Math.sin(e),e=Math.cos(e),t[0]=i*i*(r=1-e)+e,t[1]=o*i*r+n*a,t[2]=n*i*r-o*a,t[3]=0,t[4]=i*o*r-n*a,t[5]=o*o*r+e,t[6]=n*o*r+i*a,t[7]=0,t[8]=i*n*r+o*a,t[9]=o*n*r-i*a,t[10]=n*n*r+e,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t)},fromXRotation:function(t,e){var n=Math.sin(e),e=Math.cos(e);return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=e,t[6]=n,t[7]=0,t[8]=0,t[9]=-n,t[10]=e,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t},fromYRotation:function(t,e){var n=Math.sin(e),e=Math.cos(e);return t[0]=e,t[1]=0,t[2]=-n,t[3]=0,t[4]=0,t[5]=1,t[6]=0,t[7]=0,t[8]=n,t[9]=0,t[10]=e,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t},fromZRotation:function(t,e){var n=Math.sin(e),e=Math.cos(e);return t[0]=e,t[1]=n,t[2]=0,t[3]=0,t[4]=-n,t[5]=e,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},fromRotationTranslation:ft,fromQuat2:function(t,e){var n=new X(3),r=-e[0],i=-e[1],o=-e[2],a=e[3],s=e[4],l=e[5],u=e[6],c=e[7],h=r*r+i*i+o*o+a*a;return 0<h?(n[0]=2*(s*a+c*r+l*o-u*i)/h,n[1]=2*(l*a+c*i+u*r-s*o)/h,n[2]=2*(u*a+c*o+s*i-l*r)/h):(n[0]=2*(s*a+c*r+l*o-u*i),n[1]=2*(l*a+c*i+u*r-s*o),n[2]=2*(u*a+c*o+s*i-l*r)),ft(t,e,n),t},getTranslation:pt,getScaling:gt,getRotation:mt,fromRotationTranslationScale:function(t,e,n,r){var i=e[0],o=e[1],a=e[2],e=e[3],s=i*(c=i+i),l=i*(h=o+o),i=i*(d=a+a),u=o*h,o=o*d,a=a*d,c=e*c,h=e*h,e=e*d,d=r[0],f=r[1],r=r[2];return t[0]=(1-(u+a))*d,t[1]=(l+e)*d,t[2]=(i-h)*d,t[3]=0,t[4]=(l-e)*f,t[5]=(1-(s+a))*f,t[6]=(o+c)*f,t[7]=0,t[8]=(i+h)*r,t[9]=(o-c)*r,t[10]=(1-(s+u))*r,t[11]=0,t[12]=n[0],t[13]=n[1],t[14]=n[2],t[15]=1,t},fromRotationTranslationScaleOrigin:vt,fromQuat:yt,frustum:function(t,e,n,r,i,o,a){var s=1/(n-e),l=1/(i-r),u=1/(o-a);return t[0]=2*o*s,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=2*o*l,t[6]=0,t[7]=0,t[8]=(n+e)*s,t[9]=(i+r)*l,t[10]=(a+o)*u,t[11]=-1,t[12]=0,t[13]=0,t[14]=a*o*2*u,t[15]=0,t},perspectiveNO:Et,perspective:Et,perspectiveZO:function(t,e,n,r,i){return e=1/Math.tan(e/2),t[0]=e/n,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=e,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!=i&&i!==1/0?(t[10]=i*(n=1/(r-i)),t[14]=i*r*n):(t[10]=-1,t[14]=-r),t},perspectiveFromFieldOfView:function(t,e,n,r){var i=Math.tan(e.upDegrees*Math.PI/180),o=Math.tan(e.downDegrees*Math.PI/180),a=Math.tan(e.leftDegrees*Math.PI/180),e=Math.tan(e.rightDegrees*Math.PI/180),s=2/(a+e),l=2/(i+o);return t[0]=s,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=l,t[6]=0,t[7]=0,t[8]=-(a-e)*s*.5,t[9]=(i-o)*l*.5,t[10]=r/(n-r),t[11]=-1,t[12]=0,t[13]=0,t[14]=r*n/(n-r),t[15]=0,t},orthoNO:_t,ortho:bt,orthoZO:function(t,e,n,r,i,o,a){var s=1/(e-n),l=1/(r-i),a=1/(o-a);return t[0]=-2*s,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=-2*l,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=a,t[11]=0,t[12]=(e+n)*s,t[13]=(i+r)*l,t[14]=o*a,t[15]=1,t},lookAt:xt,targetTo:function(t,e,n,r){var i=e[0],o=e[1],e=e[2],a=r[0],s=r[1],r=r[2],l=i-n[0],u=o-n[1],n=e-n[2],c=l*l+u*u+n*n,h=(0<c&&(l*=c=1/Math.sqrt(c),u*=c,n*=c),s*n-r*u);return 0<(c=h*h+(r=r*l-a*n)*r+(a=a*u-s*l)*a)&&(h*=c=1/Math.sqrt(c),r*=c,a*=c),t[0]=h,t[1]=r,t[2]=a,t[3]=0,t[4]=u*a-n*r,t[5]=n*h-l*a,t[6]=l*r-u*h,t[7]=0,t[8]=l,t[9]=u,t[10]=n,t[11]=0,t[12]=i,t[13]=o,t[14]=e,t[15]=1,t},str:function(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]+")"},frob:function(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])},add:function(t,e,n){return t[0]=e[0]+n[0],t[1]=e[1]+n[1],t[2]=e[2]+n[2],t[3]=e[3]+n[3],t[4]=e[4]+n[4],t[5]=e[5]+n[5],t[6]=e[6]+n[6],t[7]=e[7]+n[7],t[8]=e[8]+n[8],t[9]=e[9]+n[9],t[10]=e[10]+n[10],t[11]=e[11]+n[11],t[12]=e[12]+n[12],t[13]=e[13]+n[13],t[14]=e[14]+n[14],t[15]=e[15]+n[15],t},subtract:St,multiplyScalar:function(t,e,n){return t[0]=e[0]*n,t[1]=e[1]*n,t[2]=e[2]*n,t[3]=e[3]*n,t[4]=e[4]*n,t[5]=e[5]*n,t[6]=e[6]*n,t[7]=e[7]*n,t[8]=e[8]*n,t[9]=e[9]*n,t[10]=e[10]*n,t[11]=e[11]*n,t[12]=e[12]*n,t[13]=e[13]*n,t[14]=e[14]*n,t[15]=e[15]*n,t},multiplyScalarAndAdd:function(t,e,n,r){return t[0]=e[0]+n[0]*r,t[1]=e[1]+n[1]*r,t[2]=e[2]+n[2]*r,t[3]=e[3]+n[3]*r,t[4]=e[4]+n[4]*r,t[5]=e[5]+n[5]*r,t[6]=e[6]+n[6]*r,t[7]=e[7]+n[7]*r,t[8]=e[8]+n[8]*r,t[9]=e[9]+n[9]*r,t[10]=e[10]+n[10]*r,t[11]=e[11]+n[11]*r,t[12]=e[12]+n[12]*r,t[13]=e[13]+n[13]*r,t[14]=e[14]+n[14]*r,t[15]=e[15]+n[15]*r,t},exactEquals:function(t,e){return t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2]&&t[3]===e[3]&&t[4]===e[4]&&t[5]===e[5]&&t[6]===e[6]&&t[7]===e[7]&&t[8]===e[8]&&t[9]===e[9]&&t[10]===e[10]&&t[11]===e[11]&&t[12]===e[12]&&t[13]===e[13]&&t[14]===e[14]&&t[15]===e[15]},equals:function(t,e){var n=t[0],r=t[1],i=t[2],o=t[3],a=t[4],s=t[5],l=t[6],u=t[7],c=t[8],h=t[9],d=t[10],f=t[11],p=t[12],g=t[13],m=t[14],t=t[15],v=e[0],y=e[1],E=e[2],_=e[3],b=e[4],x=e[5],S=e[6],w=e[7],T=e[8],A=e[9],M=e[10],R=e[11],N=e[12],C=e[13],P=e[14],e=e[15];return Math.abs(n-v)<=H*Math.max(1,Math.abs(n),Math.abs(v))&&Math.abs(r-y)<=H*Math.max(1,Math.abs(r),Math.abs(y))&&Math.abs(i-E)<=H*Math.max(1,Math.abs(i),Math.abs(E))&&Math.abs(o-_)<=H*Math.max(1,Math.abs(o),Math.abs(_))&&Math.abs(a-b)<=H*Math.max(1,Math.abs(a),Math.abs(b))&&Math.abs(s-x)<=H*Math.max(1,Math.abs(s),Math.abs(x))&&Math.abs(l-S)<=H*Math.max(1,Math.abs(l),Math.abs(S))&&Math.abs(u-w)<=H*Math.max(1,Math.abs(u),Math.abs(w))&&Math.abs(c-T)<=H*Math.max(1,Math.abs(c),Math.abs(T))&&Math.abs(h-A)<=H*Math.max(1,Math.abs(h),Math.abs(A))&&Math.abs(d-M)<=H*Math.max(1,Math.abs(d),Math.abs(M))&&Math.abs(f-R)<=H*Math.max(1,Math.abs(f),Math.abs(R))&&Math.abs(p-N)<=H*Math.max(1,Math.abs(p),Math.abs(N))&&Math.abs(g-C)<=H*Math.max(1,Math.abs(g),Math.abs(C))&&Math.abs(m-P)<=H*Math.max(1,Math.abs(m),Math.abs(P))&&Math.abs(t-e)<=H*Math.max(1,Math.abs(t),Math.abs(e))},mul:wt,sub:St});function y(){var t=new X(3);return X!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0),t}function At(t){var e=new X(3);return e[0]=t[0],e[1]=t[1],e[2]=t[2],e}function Mt(t){var e=t[0],n=t[1],t=t[2];return Math.hypot(e,n,t)}function x(t,e,n){var r=new X(3);return r[0]=t,r[1]=e,r[2]=n,r}function Rt(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t}function Nt(t,e,n,r){return t[0]=e,t[1]=n,t[2]=r,t}function Ct(t,e,n){t[0]=e[0]+n[0],t[1]=e[1]+n[1],t[2]=e[2]+n[2]}function Pt(t,e,n){return t[0]=e[0]-n[0],t[1]=e[1]-n[1],t[2]=e[2]-n[2],t}function Ot(t,e,n){return t[0]=e[0]*n,t[1]=e[1]*n,t[2]=e[2]*n,t}function It(t,e){var n=e[0],r=e[1],i=e[2],n=n*n+r*r+i*i;0<n&&(n=1/Math.sqrt(n)),t[0]=e[0]*n,t[1]=e[1]*n,t[2]=e[2]*n}function Lt(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]}function kt(t,e,n){var r=e[0],i=e[1],e=e[2],o=n[0],a=n[1],n=n[2];t[0]=i*n-e*a,t[1]=e*o-r*n,t[2]=r*a-i*o}function Dt(t,e,n,r){var i=e[0],o=e[1],e=e[2];t[0]=i+r*(n[0]-i),t[1]=o+r*(n[1]-o),t[2]=e+r*(n[2]-e)}function Bt(t,e,n){var r=e[0],i=e[1],e=e[2],o=n[3]*r+n[7]*i+n[11]*e+n[15];return t[0]=(n[0]*r+n[4]*i+n[8]*e+n[12])/(o=o||1),t[1]=(n[1]*r+n[5]*i+n[9]*e+n[13])/o,t[2]=(n[2]*r+n[6]*i+n[10]*e+n[14])/o,t}function Ft(t,e){var n=t[0],r=t[1],t=t[2],i=e[0],o=e[1],e=e[2];return Math.abs(n-i)<=H*Math.max(1,Math.abs(n),Math.abs(i))&&Math.abs(r-o)<=H*Math.max(1,Math.abs(r),Math.abs(o))&&Math.abs(t-e)<=H*Math.max(1,Math.abs(t),Math.abs(e))}var Ut=Pt,Gt=function(t,e){var n=e[0]-t[0],r=e[1]-t[1],e=e[2]-t[2];return Math.hypot(n,r,e)},Wt=Mt;function Vt(){var t=new X(4);return X!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0,t[3]=0),t}function jt(t,e,n){var r=e[0],i=e[1],o=e[2],e=e[3];return t[0]=n[0]*r+n[4]*i+n[8]*o+n[12]*e,t[1]=n[1]*r+n[5]*i+n[9]*o+n[13]*e,t[2]=n[2]*r+n[6]*i+n[10]*o+n[14]*e,t[3]=n[3]*r+n[7]*i+n[11]*o+n[15]*e,t}function zt(){var t=new X(4);return X!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0),t[3]=1,t}function Ht(t,e,n){n*=.5;var r=Math.sin(n);return t[0]=r*e[0],t[1]=r*e[1],t[2]=r*e[2],t[3]=Math.cos(n),t}function Xt(t,e,n){var r=e[0],i=e[1],o=e[2],e=e[3],a=n[0],s=n[1],l=n[2],n=n[3];return t[0]=r*n+e*a+i*l-o*s,t[1]=i*n+e*s+o*a-r*l,t[2]=o*n+e*l+r*s-i*a,t[3]=e*n-r*a-i*s-o*l,t}function Yt(t,e){var n=e[0],r=e[1],i=e[2],e=e[3],o=n*n+r*r+i*i+e*e,o=o?1/o:0;return t[0]=-n*o,t[1]=-r*o,t[2]=-i*o,t[3]=e*o,t}function Kt(t,e,n,r){var i=.5*Math.PI/180,i=(e*=i,n*=i,r*=i,Math.sin(e)),e=Math.cos(e),o=Math.sin(n),n=Math.cos(n),a=Math.sin(r),r=Math.cos(r);t[0]=i*n*r-e*o*a,t[1]=e*o*r+i*n*a,t[2]=e*n*a-i*o*r,t[3]=e*n*r+i*o*a}y(),Vt();var qt=function(t,e,n,r){var i=new X(4);return i[0]=t,i[1]=e,i[2]=n,i[3]=r,i},$t=function(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t},Zt=Xt,Qt=function(t,e){var n=e[0],r=e[1],i=e[2],e=e[3],o=n*n+r*r+i*i+e*e;return 0<o&&(o=1/Math.sqrt(o)),t[0]=n*o,t[1]=r*o,t[2]=i*o,t[3]=e*o,t};function Jt(t,e){var n=e[0],r=e[1],n=n*n+r*r;0<n&&(n=1/Math.sqrt(n)),t[0]=e[0]*n,t[1]=e[1]*n}function te(t,e){return t[0]*e[0]+t[1]*e[1]}function ee(t,e){return t[0]===e[0]&&t[1]===e[1]}function ne(t){return t.map(function(t){return Array.isArray(t)?[].concat(t):t})}y(),x(1,0,0),x(0,1,0),zt(),zt(),Y(),t=new X(2),X!=Float32Array&&(t[0]=0,t[1]=0);var re={x1:0,y1:0,x2:0,y2:0,x:0,y:0,qx:null,qy:null};var ie={a:7,c:6,h:1,l:2,m:2,r:4,q:4,s:4,t:2,v:1,z:0};function oe(t){return Array.isArray(t)&&t.every(function(t){var e=t[0].toLowerCase();return ie[e]===t.length-1&&"achlmqstvz".includes(e)})}function ae(t){return oe(t)&&t.every(function(t){t=t[0];return t===t.toUpperCase()})}function se(t){return ae(t)&&t.every(function(t){t=t[0];return"ACLMQZ".includes(t)})}function le(t){for(var e=t.pathValue[t.segmentStart],n=e.toLowerCase(),r=t.data;r.length>=ie[n]&&("m"===n&&2<r.length?(t.segments.push([e].concat(r.splice(0,2))),n="l",e="m"===e?"l":"L"):t.segments.push([e].concat(r.splice(0,ie[n]))),ie[n]););}function ue(t){return 48<=t&&t<=57}function ce(t){for(var e,n=t.pathValue,r=t.max;t.index<r&&(10===(e=n.charCodeAt(t.index))||13===e||8232===e||8233===e||32===e||9===e||11===e||12===e||160===e||5760<=e&&[5760,6158,8192,8193,8194,8195,8196,8197,8198,8199,8200,8201,8202,8239,8287,12288,65279].includes(e));)t.index+=1}function he(t){var e,n,r,i,o,a=t.max,s=t.pathValue,l=t.index,u=s.charCodeAt(l),c=ie[s[l].toLowerCase()];if(t.segmentStart=l,function(t){switch(32|t){case 109:case 122:case 108:case 104:case 118:case 99:case 115:case 113:case 116:case 97:return 1;default:return}}(u)){if(t.index+=1,ce(t),t.data=[],c)for(;;){for(var h=c;0<h;--h){if(97!=(32|u)||3!==h&&4!==h?function(t){var e,n,r=t.max,i=t.pathValue,o=t.index,a=o,s=!1,l=!1,u=!1;if(r<=a)t.err="[path-util]: Invalid path value at index "+a+', "pathValue" is missing param';else if(ue(n=43!==(n=i.charCodeAt(a))&&45!==n?n:i.charCodeAt(a+=1))||46===n){if(46!==n){if(e=48===n,n=i.charCodeAt(a+=1),e&&a<r&&n&&ue(n))return t.err="[path-util]: Invalid path value at index "+o+', "'+i[o]+'" illegal number';for(;a<r&&ue(i.charCodeAt(a));)a+=1,s=!0;n=i.charCodeAt(a)}if(46===n){for(u=!0,a+=1;ue(i.charCodeAt(a));)a+=1,l=!0;n=i.charCodeAt(a)}if(101===n||69===n){if(u&&!s&&!l)return t.err="[path-util]: Invalid path value at index "+a+', "'+i[a]+'" invalid float exponent';if(43!==(n=i.charCodeAt(a+=1))&&45!==n||(a+=1),!(a<r&&ue(i.charCodeAt(a))))return t.err="[path-util]: Invalid path value at index "+a+', "'+i[a]+'" invalid integer exponent';for(;a<r&&ue(i.charCodeAt(a));)a+=1}t.index=a,t.param=+t.pathValue.slice(o,a)}else t.err="[path-util]: Invalid path value at index "+a+', "'+i[a]+'" is not a number'}(t):(o=i=r=void 0,r=(n=t).index,i=n.pathValue,48===(o=i.charCodeAt(r))?(n.param=0,n.index+=1):49===o?(n.param=1,n.index+=1):n.err='[path-util]: invalid Arc flag "'+i[r]+'", expecting 0 or 1 at index '+r),t.err.length)return;t.data.push(t.param),ce(t),t.index<a&&44===s.charCodeAt(t.index)&&(t.index+=1,ce(t))}if(t.index>=t.max)break;if(!(48<=(e=s.charCodeAt(t.index))&&e<=57||43===e||45===e||46===e))break}le(t)}else t.err='[path-util]: Invalid path value "'+s[l]+'" is not a path command'}var de=function(t){this.pathValue=t,this.segments=[],this.max=t.length,this.index=0,this.param=0,this.segmentStart=0,this.data=[],this.err=""};function fe(t){var a,s,l,u;return ae(t)?ne(t):(t=function(t){if(oe(t))return ne(t);var e=new de(t);for(ce(e);e.index<e.max&&!e.err.length;)he(e);return e.err||e.segments}(t),u=l=s=a=0,t.map(function(t){var e=t.slice(1).map(Number),t=t[0],n=t.toUpperCase();if("M"===t)return a=e[0],s=e[1],["M",l=a,u=s];if(t!==n)switch(n){case"A":i=[n,e[0],e[1],e[2],e[3],e[4],e[5]+a,e[6]+s];break;case"V":i=[n,e[0]+s];break;case"H":i=[n,e[0]+a];break;default:var r=e.map(function(t,e){return t+(e%2?s:a)}),i=[n].concat(r)}else i=[n].concat(e);var o=i.length;switch(n){case"Z":a=l,s=u;break;case"H":a=i[1];break;case"V":s=i[1];break;default:a=i[o-2],s=i[o-1],"M"===n&&(l=a,u=s)}return i}))}function pe(t){if(se(t))return ne(t);for(var e,n,r,i,o,a,s,l=fe(t),u=k({},re),c=0;c<l.length;c+=1){l[c]=(e=l[c],n=u,s=a=d=o=h=i=r=void 0,r=e[0],i=n.x1,h=n.y1,o=n.x2,d=n.y2,a=e.slice(1).map(Number),s=e,"TQ".includes(r)||(n.qx=null,n.qy=null),"H"===r?s=["L",e[1],h]:"V"===r?s=["L",i,e[1]]:"S"===r?(e=2*h-d,s=["C",n.x1=2*i-o,n.y1=e].concat(a)):"T"===r?(d=2*i-n.qx,o=2*h-n.qy,s=["Q",n.qx=d,n.qy=o].concat(a)):"Q"===r&&(e=a[0],i=a[1],n.qx=e,n.qy=i),s);var h=l[c],d=h.length;u.x1=+h[d-2],u.y1=+h[d-1],u.x2=+h[d-4]||u.x1,u.y2=+h[d-3]||u.y1}return l}function ge(t,e,n){return{x:t*Math.cos(n)-e*Math.sin(n),y:t*Math.sin(n)+e*Math.cos(n)}}function me(t,e,n,r,i,o,a,s,l,u){var c=120*Math.PI/180,h=Math.PI/180*(+i||0),d=[],f=(u?(E=u[0],_=u[1],v=u[2],y=u[3]):(t=(g=ge(t,e,-h)).x,e=g.y,1<(f=(p=(t-(s=(g=ge(s,l,-h)).x))/2)*p/(n*n)+(g=(e-(l=g.y))/2)*g/(r*r))&&(n*=f=Math.sqrt(f),r*=f),f=n*n,m=r*r,v=(o=(o===a?-1:1)*Math.sqrt(Math.abs((f*m-f*g*g-m*p*p)/(f*g*g+m*p*p))))*n*g/r+(t+s)/2,y=o*-r*p/n+(e+l)/2,E=Math.asin(((e-y)/r*Math.pow(10,9)>>0)/Math.pow(10,9)),_=Math.asin(((l-y)/r*Math.pow(10,9)>>0)/Math.pow(10,9)),E=t<v?Math.PI-E:E,_=s<v?Math.PI-_:_,E<0&&(E=2*Math.PI+E),_<0&&(_=2*Math.PI+_),a&&_<E&&(E-=2*Math.PI),!a&&E<_&&(_-=2*Math.PI)),_-E),p=(Math.abs(f)>c&&(m=_,g=s,o=l,_=E+c*(a&&E<_?1:-1),d=me(s=v+n*Math.cos(_),l=y+r*Math.sin(_),n,r,i,0,a,g,o,[_,m,v,y])),f=_-E,Math.cos(E)),c=Math.sin(E),i=Math.cos(_),a=Math.sin(_),g=Math.tan(f/4),o=4/3*n*g,m=4/3*r*g,v=[t,e],y=[t+o*c,e-m*p],E=[s+o*a,l-m*i],_=[s,l];if(y[0]=2*v[0]-y[0],y[1]=2*v[1]-y[1],u)return y.concat(E,_,d);for(var b=[],x=0,S=(d=y.concat(E,_,d)).length;x<S;x+=1)b[x]=x%2?ge(d[x-1],d[x],h).y:ge(d[x],d[x+1],h).x;return b}function ve(t,e,n){var r=t[0],t=t[1];return[r+(e[0]-r)*n,t+(e[1]-t)*n]}function ye(t,e){return Math.sqrt((t[0]-e[0])*(t[0]-e[0])+(t[1]-e[1])*(t[1]-e[1]))}function Ee(t,e,n,r,i){var o=ye([t,e],[n,r]),a={x:0,y:0};return{length:o,point:a="number"==typeof i?i<=0?{x:t,y:e}:o<=i?{x:n,y:r}:{x:(i=ve([t,e],[n,r],i/o))[0],y:i[1]}:a,min:{x:Math.min(t,n),y:Math.min(e,r)},max:{x:Math.max(t,n),y:Math.max(e,r)}}}function _e(t,e,n,r){var t=[t,e],e=[n,r],i=ve(t,e,.5),e=ve(e,i,.5),o=ve(i,e,.5),a=ve(e,o,.5),s=ve(o,a,.5),t=Ee(t[0],t[1],i[0],i[1],o[0]).point,i=Ee(s[0],s[1],a[0],a[1],e[0]).point;return[t.x,t.y,i.x,i.y,n,r]}function be(t,e){var n;if(void 0===e&&(e=!1),se(n=t)&&n.every(function(t){t=t[0];return"MC".includes(t)}))return n=ne(t),e?[n,[]]:n;for(var r,i=pe(t),o=k({},re),a=[],s="",l=i.length,u=[],c=0;c<l;c+=1){i[c]&&(s=i[c][0]),a[c]=s;var h=function(t,e){var n,r,i,o,a,s,l=t[0],u=t.slice(1).map(Number),c=u[0],h=u[1],d=e.x1,f=e.y1,p=e.x,g=e.y;switch("TQ".includes(l)||(e.qx=null,e.qy=null),l){case"M":return e.x=c,e.y=h,t;case"A":return s=[d,f].concat(u),["C"].concat(me(s[0],s[1],s[2],s[3],s[4],s[5],s[6],s[7],s[8],s[9]));case"Q":return e.qx=c,e.qy=h,s=[d,f].concat(u),["C"].concat((n=s[0],r=s[1],i=s[2],o=s[3],a=s[4],s=s[5],[1/3*n+2/3*i,1/3*r+2/3*o,1/3*a+2/3*i,1/3*s+2/3*o,a,s]));case"L":return["C"].concat(_e(d,f,c,h));case"Z":return d===p&&f===g?["C",d,f,p,g,p,g]:["C"].concat(_e(d,f,p,g))}return t}(i[c],o),d=(i[c]=h,m=g=p=f=d=void 0,i),f=a,p=c;if(7<d[p].length){d[p].shift();for(var g=d[p],m=p;g.length;)f[p]="A",d.splice(m+=1,0,["C"].concat(g.splice(0,6)));d.splice(p,1)}l=i.length,"Z"===s&&u.push(c),r=(h=i[c]).length,o.x1=+h[r-2],o.y1=+h[r-1],o.x2=+h[r-4]||o.x1,o.y2=+h[r-3]||o.y1}return e?[i,u]:i}function xe(t,e){var n=t.x,t=t.y,r=e.x,e=e.y,i=n*r+t*e,o=Math.sqrt((Math.pow(n,2)+Math.pow(t,2))*(Math.pow(r,2)+Math.pow(e,2)));return(n*e-t*r<0?-1:1)*Math.acos(i/o)}function Se(t,e,n,r,i,D,B,o,a,s,l){var u=l.bbox,F=void 0===u||u,u=l.length,U=void 0===u||u,u=l.sampleSize,c=void 0===u?30:u,h="number"==typeof s,d=t,f=e,p=0,g=[d,f,p],m=[d,f],v={x:0,y:0},y=[{x:d,y:f}];h&&s<=0&&(v={x:d,y:f});for(var E,_,b,x,S,w,T,A,M,R,N,C,P,O,I,L,k=0;k<=c;k+=1)E=t,_=e,b=n,x=r,S=i,w=D,T=B,A=o,M=a,R=k/c,C=L=I=O=P=C=N=void 0,C=Math.abs,P=Math.sin,O=Math.cos,I=Math.sqrt,L=Math.PI,b=C(b),C=C(x),x=L/180*((S%360+360)%360),d=(N=E===A&&_===M?{x:E,y:_}:0===b||0===C?Ee(E,_,A,M,R).point:(S=(E-A)/2,N=(_-M)/2,S={x:O(x)*S+P(x)*N,y:-P(x)*S+O(x)*N},1<(N=Math.pow(S.x,2)/Math.pow(b,2)+Math.pow(S.y,2)/Math.pow(C,2))&&(b*=I(N),C*=I(N)),N=(Math.pow(b,2)*Math.pow(C,2)-Math.pow(b,2)*Math.pow(S.y,2)-Math.pow(C,2)*Math.pow(S.x,2))/(Math.pow(b,2)*Math.pow(S.y,2)+Math.pow(C,2)*Math.pow(S.x,2)),w=(w!==T?1:-1)*I(N<0?0:N),I=b*S.y/C*w,N=-C*S.x/b*w,w=O(x)*I-P(x)*N+(E+A)/2,E=P(x)*I+O(x)*N+(_+M)/2,_=xe({x:1,y:0},A={x:(S.x-I)/b,y:(S.y-N)/C}),M=xe(A,{x:(-S.x-I)/b,y:(-S.y-N)/C}),!T&&0<M?M-=2*L:T&&M<0&&(M+=2*L),A=_+(M%=2*L)*R,I=b*O(A),S=C*P(A),{x:O(x)*I-P(x)*S+w,y:P(x)*I+O(x)*S+E})).x,f=N.y,F&&y.push({x:d,y:f}),U&&(p+=ye(m,[d,f])),m=[d,f],h&&s<=p&&s>g[2]&&(T=(p-s)/(p-g[2]),v={x:m[0]*(1-T)+g[0]*T,y:m[1]*(1-T)+g[1]*T}),g=[d,f,p];return{length:p,point:v=h&&p<=s?{x:o,y:a}:v,min:{x:Math.min.apply(null,y.map(function(t){return t.x})),y:Math.min.apply(null,y.map(function(t){return t.y}))},max:{x:Math.max.apply(null,y.map(function(t){return t.x})),y:Math.max.apply(null,y.map(function(t){return t.y}))}}}function we(t,e,n,r,i,o,a,s,l,u){var c=u.bbox,h=void 0===c||c,c=u.length,d=void 0===c||c,c=u.sampleSize,f=void 0===c?10:c,p="number"==typeof l,g=t,m=e,v=0,y=[g,m,v],E=[g,m],_={x:0,y:0},b=[{x:g,y:m}];p&&l<=0&&(_={x:g,y:m});for(var x,S,w,T,A,M,R,N,C,P,O=0;O<=f;O+=1)x=t,S=e,w=n,T=r,A=i,M=o,R=a,N=s,P=void 0,P=1-(C=O/f),g=(x={x:Math.pow(P,3)*x+3*Math.pow(P,2)*C*w+3*P*Math.pow(C,2)*A+Math.pow(C,3)*R,y:Math.pow(P,3)*S+3*Math.pow(P,2)*C*T+3*P*Math.pow(C,2)*M+Math.pow(C,3)*N}).x,m=x.y,h&&b.push({x:g,y:m}),d&&(v+=ye(E,[g,m])),E=[g,m],p&&l<=v&&l>y[2]&&(w=(v-l)/(v-y[2]),_={x:E[0]*(1-w)+y[0]*w,y:E[1]*(1-w)+y[1]*w}),y=[g,m,v];return{length:v,point:_=p&&v<=l?{x:a,y:s}:_,min:{x:Math.min.apply(null,b.map(function(t){return t.x})),y:Math.min.apply(null,b.map(function(t){return t.y}))},max:{x:Math.max.apply(null,b.map(function(t){return t.x})),y:Math.max.apply(null,b.map(function(t){return t.y}))}}}function Te(t,e,n,r,i,o,a,s){var l=s.bbox,u=void 0===l||l,l=s.length,c=void 0===l||l,l=s.sampleSize,h=void 0===l?10:l,d="number"==typeof a,f=t,p=e,g=0,m=[f,p,g],v=[f,p],y={x:0,y:0},E=[{x:f,y:p}];d&&a<=0&&(y={x:f,y:p});for(var _,b,x,S,w,T,A,M,R=0;R<=h;R+=1)_=t,b=e,x=n,S=r,w=i,T=o,M=void 0,M=1-(A=R/h),f=(_={x:Math.pow(M,2)*_+2*M*A*x+Math.pow(A,2)*w,y:Math.pow(M,2)*b+2*M*A*S+Math.pow(A,2)*T}).x,p=_.y,u&&E.push({x:f,y:p}),c&&(g+=ye(v,[f,p])),v=[f,p],d&&a<=g&&a>m[2]&&(x=(g-a)/(g-m[2]),y={x:v[0]*(1-x)+m[0]*x,y:v[1]*(1-x)+m[1]*x}),m=[f,p,g];return{length:g,point:y=d&&g<=a?{x:i,y:o}:y,min:{x:Math.min.apply(null,E.map(function(t){return t.x})),y:Math.min.apply(null,E.map(function(t){return t.y}))},max:{x:Math.max.apply(null,E.map(function(t){return t.x})),y:Math.max.apply(null,E.map(function(t){return t.y}))}}}function Ae(t,e,n){for(var r,i,o,a=pe(t),s="number"==typeof e,l=[],u=0,c=0,h=0,d=0,f=[],p=[],g=0,m={x:0,y:0},v=m,y=m,E=m,_=0,b=0,x=a.length;b<x;b+=1)l=(r="M"===(i=(o=a[b])[0]))?l:[u,c].concat(o.slice(1)),r?(v=m={x:h=o[1],y:d=o[2]},g=0,s&&e<.001&&(E=m)):"L"===i?(g=(r=Ee(l[0],l[1],l[2],l[3],(e||0)-_)).length,m=r.min,v=r.max,y=r.point):"A"===i?(g=(r=Se(l[0],l[1],l[2],l[3],l[4],l[5],l[6],l[7],l[8],(e||0)-_,n||{})).length,m=r.min,v=r.max,y=r.point):"C"===i?(g=(r=we(l[0],l[1],l[2],l[3],l[4],l[5],l[6],l[7],(e||0)-_,n||{})).length,m=r.min,v=r.max,y=r.point):"Q"===i?(g=(r=Te(l[0],l[1],l[2],l[3],l[4],l[5],(e||0)-_,n||{})).length,m=r.min,v=r.max,y=r.point):"Z"===i&&(g=(r=Ee((l=[u,c,h,d])[0],l[1],l[2],l[3],(e||0)-_)).length,m=r.min,v=r.max,y=r.point),s&&_<e&&e<=_+g&&(E=y),p.push(v),f.push(m),_+=g,u=(r="Z"!==i?o.slice(-2):[h,d])[0],c=r[1];return{length:_,point:E=s&&_<=e?{x:u,y:c}:E,min:{x:Math.min.apply(null,f.map(function(t){return t.x})),y:Math.min.apply(null,f.map(function(t){return t.y}))},max:{x:Math.max.apply(null,p.map(function(t){return t.x})),y:Math.max.apply(null,p.map(function(t){return t.y}))}}}function Me(t){return(u=l=s=0)<=be(t).map(function(t){var e,n,r,i,o,a;return"M"===t[0]?(s=t[1],l=t[2],0):(a=t.slice(1),e=a[0],n=a[1],r=a[2],i=a[3],o=a[4],a=a[5],u=3*((a-l)*(e+r)-(o-s)*(n+i)+n*(s-r)-e*(l-i)+a*(r+s/3)-o*(i+l/3))/20,n=t.slice(-2),s=n[0],l=n[1],u)}).reduce(function(t,e){return t+e},0);var s,l,u}function Re(t){return t.map(function(t,e,n){var r,i,o,a,n=e&&n[e-1].slice(-2).concat(t.slice(1)),s=e?we(n[0],n[1],n[2],n[3],n[4],n[5],n[6],n[7],n[8],{bbox:!1}).length:0,n=e?s?(void 0===r&&(r=.5),n=(e=n).slice(0,2),i=e.slice(2,4),o=e.slice(4,6),e=e.slice(6,8),n=ve(n,i,r),i=ve(i,o,r),o=ve(o,e,r),a=ve(n,i,r),i=ve(i,o,r),r=ve(a,i,r),[["C"].concat(n,a,r),["C"].concat(i,o,e)]):[t,t]:[t];return{s:t,ss:n,l:s}})}var Ne=function(t){return"function"==typeof t},M=function(t){return null==t},Ce={}.toString,Pe=function(t,e){return Ce.call(t)==="[object "+e+"]"},Oe=function(t){return Array.isArray?Array.isArray(t):Pe(t,"Array")},Ie=function(t){var e=typeof t;return null!==t&&"object"==e||"function"==e},Le=function(t){return"object"==typeof t&&null!==t},ke=function(t){if(!Le(t)||!Pe(t,"Object"))return!1;if(null===Object.getPrototypeOf(t))return!0;for(var e=t;null!==Object.getPrototypeOf(e);)e=Object.getPrototypeOf(e);return Object.getPrototypeOf(t)===e},De=function(t){if(Oe(t))return t.reduce(function(t,e){return Math.max(t,e)},t[0])},Be=function(t){if(Oe(t))return t.reduce(function(t,e){return Math.min(t,e)},t[0])},Fe=function(t){return Pe(t,"String")},Ue=function(t,e,n){return t<e?e:n<t?n:t},B=function(t){return Pe(t,"Number")},Ge=1e-5;var We=function(t,e){return(t%e+e)%e},Ve=function(t){return Pe(t,"Boolean")},je=function(t){return void 0===t},ze=function(t){if("object"!=typeof t||null===t)return t;if(Oe(t))for(var e=[],n=0,r=t.length;n<r;n++)"object"==typeof t[n]&&null!=t[n]?e[n]=ze(t[n]):e[n]=t[n];else for(var i in e={},t)"object"==typeof t[i]&&null!=t[i]?e[i]=ze(t[i]):e[i]=t[i];return e},He=ze;function Xe(){}function Ye(t,e,n){(t.prototype=e.prototype=n).constructor=t}function Ke(t,e){var n,r=Object.create(t.prototype);for(n in e)r[n]=e[n];return r}function qe(){}var t="\\s*([+-]?\\d+)\\s*",e="\\s*([+-]?\\d*\\.?\\d+(?:[eE][+-]?\\d+)?)\\s*",n="\\s*([+-]?\\d*\\.?\\d+(?:[eE][+-]?\\d+)?)%\\s*",$e=/^#([0-9a-f]{3,8})$/,Ze=new RegExp("^rgb\\("+[t,t,t]+"\\)$"),Qe=new RegExp("^rgb\\("+[n,n,n]+"\\)$"),Je=new RegExp("^rgba\\("+[t,t,t,e]+"\\)$"),tn=new RegExp("^rgba\\("+[n,n,n,e]+"\\)$"),en=new RegExp("^hsl\\("+[e,n,n]+"\\)$"),nn=new RegExp("^hsla\\("+[e,n,n,e]+"\\)$"),rn={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};function on(){return this.rgb().formatHex()}function an(){return this.rgb().formatRgb()}function sn(t){var e,n;return t=(t+"").trim().toLowerCase(),(e=$e.exec(t))?(n=e[1].length,e=parseInt(e[1],16),6===n?ln(e):3===n?new cn(e>>8&15|e>>4&240,e>>4&15|240&e,(15&e)<<4|15&e,1):8===n?un(e>>24&255,e>>16&255,e>>8&255,(255&e)/255):4===n?un(e>>12&15|e>>8&240,e>>8&15|e>>4&240,e>>4&15|240&e,((15&e)<<4|15&e)/255):null):(e=Ze.exec(t))?new cn(e[1],e[2],e[3],1):(e=Qe.exec(t))?new cn(255*e[1]/100,255*e[2]/100,255*e[3]/100,1):(e=Je.exec(t))?un(e[1],e[2],e[3],e[4]):(e=tn.exec(t))?un(255*e[1]/100,255*e[2]/100,255*e[3]/100,e[4]):(e=en.exec(t))?pn(e[1],e[2]/100,e[3]/100,1):(e=nn.exec(t))?pn(e[1],e[2]/100,e[3]/100,e[4]):rn.hasOwnProperty(t)?ln(rn[t]):"transparent"===t?new cn(NaN,NaN,NaN,0):null}function ln(t){return new cn(t>>16&255,t>>8&255,255&t,1)}function un(t,e,n,r){return new cn(t=r<=0?e=n=NaN:t,e,n,r)}function cn(t,e,n,r){this.r=+t,this.g=+e,this.b=+n,this.opacity=+r}function hn(){return"#"+fn(this.r)+fn(this.g)+fn(this.b)}function dn(){var t=this.opacity;return(1===(t=isNaN(t)?1:Math.max(0,Math.min(1,t)))?"rgb(":"rgba(")+Math.max(0,Math.min(255,Math.round(this.r)||0))+", "+Math.max(0,Math.min(255,Math.round(this.g)||0))+", "+Math.max(0,Math.min(255,Math.round(this.b)||0))+(1===t?")":", "+t+")")}function fn(t){return((t=Math.max(0,Math.min(255,Math.round(t)||0)))<16?"0":"")+t.toString(16)}function pn(t,e,n,r){return r<=0?t=e=n=NaN:n<=0||1<=n?t=e=NaN:e<=0&&(t=NaN),new mn(t,e,n,r)}function gn(t){var e,n,r,i,o,a,s,l;return t instanceof mn?new mn(t.h,t.s,t.l,t.opacity):(t=t instanceof qe?t:sn(t))?t instanceof mn?t:(e=(t=t.rgb()).r/255,n=t.g/255,r=t.b/255,i=Math.min(e,n,r),a=NaN,l=((o=Math.max(e,n,r))+i)/2,(s=o-i)?(a=e===o?(n-r)/s+6*(n<r):n===o?(r-e)/s+2:(e-n)/s+4,s/=l<.5?o+i:2-o-i,a*=60):s=0<l&&l<1?0:a,new mn(a,s,l,t.opacity)):new mn}function mn(t,e,n,r){this.h=+t,this.s=+e,this.l=+n,this.opacity=+r}function vn(t,e,n){return 255*(t<60?e+(n-e)*t/60:t<180?n:t<240?e+(n-e)*(240-t)/60:e)}function yn(t,e,n,r){t-=n,n=e-r;return Math.sqrt(t*t+n*n)}function En(t,e){return Math.abs(t-e)<.001}function _n(t,e){var n=Math.min.apply(Math,t),r=Math.min.apply(Math,e);return{x:n,y:r,width:Math.max.apply(Math,t)-n,height:Math.max.apply(Math,e)-r}}function bn(t){return(t+2*Math.PI)%(2*Math.PI)}Ye(qe,sn,{copy:function(t){return Object.assign(new this.constructor,this,t)},displayable:function(){return this.rgb().displayable()},hex:on,formatHex:on,formatHsl:function(){return gn(this).formatHsl()},formatRgb:an,toString:an}),Ye(cn,function(t,e,n,r){return 1===arguments.length?(i=(i=t)instanceof qe?i:sn(i))?new cn((i=i.rgb()).r,i.g,i.b,i.opacity):new cn:new cn(t,e,n,null==r?1:r);var i},Ke(qe,{brighter:function(t){return t=null==t?1/.7:Math.pow(1/.7,t),new cn(this.r*t,this.g*t,this.b*t,this.opacity)},darker:function(t){return t=null==t?.7:Math.pow(.7,t),new cn(this.r*t,this.g*t,this.b*t,this.opacity)},rgb:function(){return this},displayable:function(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:hn,formatHex:hn,formatRgb:dn,toString:dn})),Ye(mn,function(t,e,n,r){return 1===arguments.length?gn(t):new mn(t,e,n,null==r?1:r)},Ke(qe,{brighter:function(t){return t=null==t?1/.7:Math.pow(1/.7,t),new mn(this.h,this.s,this.l*t,this.opacity)},darker:function(t){return t=null==t?.7:Math.pow(.7,t),new mn(this.h,this.s,this.l*t,this.opacity)},rgb:function(){var t=this.h%360+360*(this.h<0),e=isNaN(t)||isNaN(this.s)?0:this.s,n=this.l,e=n+(n<.5?n:1-n)*e,n=2*n-e;return new cn(vn(240<=t?t-240:120+t,n,e),vn(t,n,e),vn(t<120?240+t:t-120,n,e),this.opacity)},displayable:function(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl:function(){var t=this.opacity;return(1===(t=isNaN(t)?1:Math.max(0,Math.min(1,t)))?"hsl(":"hsla(")+(this.h||0)+", "+100*(this.s||0)+"%, "+100*(this.l||0)+"%"+(1===t?")":", "+t+")")}}));var xn={box:function(t,e,n,r){return _n([t,n],[e,r])},length:yn,pointAt:function(t,e,n,r,i){return{x:(1-i)*t+i*n,y:(1-i)*e+i*r}},pointDistance:function(t,e,n,r,i,o){var a=(n-t)*(i-t)+(r-e)*(o-e);return a<0?yn(t,e,i,o):(n-t)*(n-t)+(r-e)*(r-e)<a?yn(n,r,i,o):this.pointToLine(t,e,n,r,i,o)},pointToLine:function(t,e,n,r,i,o){n=[n-t,r-e];return ee(n,[0,0])?Math.sqrt((i-t)*(i-t)+(o-e)*(o-e)):(Jt(r=[-n[1],n[0]],r),Math.abs(te([i-t,o-e],r)))},tangentAngle:function(t,e,n,r){return Math.atan2(r-e,n-t)}},Sn=1e-4;function wn(t,e,n,r,i,o){for(var a=-1,s=1/0,l=[n,r],u=20,c=1/(u=o&&200<o?o/10:u),h=c/10,d=0;d<=u;d++){var f=d*c,p=[i.apply(void 0,t.concat([f])),i.apply(void 0,e.concat([f]))],p=yn(l[0],l[1],p[0],p[1]);p<s&&(a=f,s=p)}if(0===a)return{x:t[0],y:e[0]};if(1===a)return{x:t[(n=t.length)-1],y:e[n-1]};for(var s=1/0,g=0;g<32&&!(h<Sn);g++){var m=a-h,v=a+h,y=[i.apply(void 0,t.concat([m])),i.apply(void 0,e.concat([m]))],y=yn(l[0],l[1],y[0],y[1]);0<=m&&y<s?(a=m,s=y):(m=[i.apply(void 0,t.concat([v])),i.apply(void 0,e.concat([v]))],y=yn(l[0],l[1],m[0],m[1]),v<=1&&y<s?(a=v,s=y):h*=.5)}return{x:i.apply(void 0,t.concat([a])),y:i.apply(void 0,e.concat([a]))}}function Tn(t,e,n,r){var i=1-r;return i*i*t+2*r*i*e+r*r*n}function An(t,e,n){n=t+n-2*e;return En(n,0)?[.5]:(t=(t-e)/n)<=1&&0<=t?[t]:[]}function Mn(t,e,n,r){return 2*(1-r)*(e-t)+2*r*(n-e)}function Rn(t,e,n,r,i,o,a){var s=Tn(t,n,i,a),l=Tn(e,r,o,a),u=xn.pointAt(t,e,n,r,a),n=xn.pointAt(n,r,i,o,a);return[[t,e,u.x,u.y,s,l],[s,l,n.x,n.y,i,o]]}function Nn(t,e,n,r,i,o,a){return 0===a?(yn(t,e,n,r)+yn(n,r,i,o)+yn(t,e,i,o))/2:(e=(t=Rn(t,e,n,r,i,o,.5))[0],n=t[1],e.push(a-1),n.push(a-1),Nn.apply(void 0,e)+Nn.apply(void 0,n))}var Cn={box:function(t,e,n,r,i,o){var a=An(t,n,i)[0],s=An(e,r,o)[0],l=[t,i],u=[e,o];return void 0!==a&&l.push(Tn(t,n,i,a)),void 0!==s&&u.push(Tn(e,r,o,s)),_n(l,u)},length:function(t,e,n,r,i,o){return Nn(t,e,n,r,i,o,3)},nearestPoint:function(t,e,n,r,i,o,a,s){return wn([t,n,i],[e,r,o],a,s,Tn)},pointDistance:function(t,e,n,r,i,o,a,s){t=this.nearestPoint(t,e,n,r,i,o,a,s);return yn(t.x,t.y,a,s)},interpolationAt:Tn,pointAt:function(t,e,n,r,i,o,a){return{x:Tn(t,n,i,a),y:Tn(e,r,o,a)}},divide:Rn,tangentAngle:function(t,e,n,r,i,o,a){t=Mn(t,n,i,a),n=Mn(e,r,o,a);return bn(Math.atan2(n,t))}};function Pn(t,e,n,r,i){var o=1-i;return o*o*o*t+3*e*i*o*o+3*n*i*i*o+r*i*i*i}function On(t,e,n,r,i){var o=1-i;return 3*(o*o*(e-t)+2*o*i*(n-e)+i*i*(r-n))}function In(t,e,n,r){var i,o,r=-3*t+9*e-9*n+3*r,n=6*t-12*e+6*n,e=3*e-3*t,t=[];return En(r,0)?En(n,0)||0<=(i=-e/n)&&i<=1&&t.push(i):En(e=n*n-4*r*e,0)?t.push(-n/(2*r)):0<e&&(o=(-n-(e=Math.sqrt(e)))/(2*r),0<=(i=(-n+e)/(2*r))&&i<=1&&t.push(i),0<=o)&&o<=1&&t.push(o),t}function Ln(t,e,n,r,i,o,a,s,l){var u=Pn(t,n,i,a,l),c=Pn(e,r,o,s,l),h=xn.pointAt(t,e,n,r,l),n=xn.pointAt(n,r,i,o,l),r=xn.pointAt(i,o,a,s,l),i=xn.pointAt(h.x,h.y,n.x,n.y,l),o=xn.pointAt(n.x,n.y,r.x,r.y,l);return[[t,e,h.x,h.y,i.x,i.y,u,c],[u,c,o.x,o.y,r.x,r.y,a,s]]}function kn(t,e,n,r,i,o,a,s,l){if(0===l){for(var u=[t,n,i,a],c=[e,r,o,s],h=0,d=u.length,f=0;f<d;f++)h+=yn(u[f],c[f],u[(f+1)%d],c[(f+1)%d]);return h/2}t=Ln(t,e,n,r,i,o,a,s,.5),e=[].concat(t[0],[l-1]),n=[].concat(t[1],[l-1]);return kn.apply(void 0,e)+kn.apply(void 0,n)}var Dn={extrema:In,box:function(t,e,n,r,i,o,a,s){for(var l=[t,a],u=[e,s],c=In(t,n,i,a),h=In(e,r,o,s),d=0;d<c.length;d++)l.push(Pn(t,n,i,a,c[d]));for(var f=0;f<h.length;f++)u.push(Pn(e,r,o,s,h[f]));return _n(l,u)},length:function(t,e,n,r,i,o,a,s){return kn(t,e,n,r,i,o,a,s,3)},nearestPoint:function(t,e,n,r,i,o,a,s,l,u,c){return wn([t,n,i,a],[e,r,o,s],l,u,Pn,c)},pointDistance:function(t,e,n,r,i,o,a,s,l,u,c){t=this.nearestPoint(t,e,n,r,i,o,a,s,l,u,c);return yn(t.x,t.y,l,u)},interpolationAt:Pn,pointAt:function(t,e,n,r,i,o,a,s,l){return{x:Pn(t,n,i,a,l),y:Pn(e,r,o,s,l)}},divide:Ln,tangentAngle:function(t,e,n,r,i,o,a,s,l){t=On(t,n,i,a,l),n=On(e,r,o,s,l);return bn(Math.atan2(n,t))}};function Bn(t,e){t=Math.abs(t);return 0<e?t:-1*t}var Fn=function(t,e,n,r,i,o){var a=n,s=r;if(0===a||0===s)return{x:t,y:e};for(var n=i-t,r=o-e,l=Math.abs(n),u=Math.abs(r),c=a*a,h=s*s,d=Math.PI/4,f=0,p=0,g=0;g<4;g++){var f=a*Math.cos(d),p=s*Math.sin(d),m=(c-h)*Math.pow(Math.cos(d),3)/a,v=(h-c)*Math.pow(Math.sin(d),3)/s,y=f-m,E=p-v,m=l-m,v=u-v,_=Math.hypot(E,y),b=Math.hypot(v,m);d+=_*Math.asin((y*v-E*m)/(_*b))/Math.sqrt(c+h-f*f-p*p),d=Math.min(Math.PI/2,Math.max(0,d))}return{x:t+Bn(f,n),y:e+Bn(p,r)}};function Un(t,e,n,r,i,o){return n*Math.cos(i)*Math.cos(o)-r*Math.sin(i)*Math.sin(o)+t}function Gn(t,e,n,r,i,o){return n*Math.sin(i)*Math.cos(o)+r*Math.cos(i)*Math.sin(o)+e}function Wn(t,e,n){return{x:t*Math.cos(n),y:e*Math.sin(n)}}function Vn(t,e,n){var r=Math.cos(n),n=Math.sin(n);return[t*r-e*n,t*n+e*r]}var jn={box:function(t,e,n,r,i,o,a){for(var s=Math.atan(-r/n*Math.tan(i)),l=1/0,u=-1/0,c=[o,a],h=2*-Math.PI;h<=2*Math.PI;h+=Math.PI){var d=s+h;o<a?o<d&&d<a&&c.push(d):a<d&&d<o&&c.push(d)}for(var f=0;f<c.length;f++){var p=Un(t,0,n,r,i,c[f]);p<l&&(l=p),u<p&&(u=p)}for(var g=Math.atan(r/(n*Math.tan(i))),m=1/0,v=-1/0,y=[o,a],E=2*-Math.PI;E<=2*Math.PI;E+=Math.PI){var _=g+E;o<a?o<_&&_<a&&y.push(_):a<_&&_<o&&y.push(_)}for(var b=0;b<y.length;b++){var x=Gn(0,e,n,r,i,y[b]);x<m&&(m=x),v<x&&(v=x)}return{x:l,y:m,width:u-l,height:v-m}},length:function(t,e,n,r,i,o,a){},nearestPoint:function(t,e,n,r,i,o,a,s,l){var s=Vn(s-t,l-e,-i),l=s[0],s=s[1],l=Fn(0,0,n,r,l,s),u=(s=l.x,u=l.y,(Math.atan2(u*n,s*r)+2*Math.PI)%(2*Math.PI)),s=(u<o?l=Wn(n,r,o):a<u&&(l=Wn(n,r,a)),Vn(l.x,l.y,i));return{x:s[0]+t,y:s[1]+e}},pointDistance:function(t,e,n,r,i,o,a,s,l){t=this.nearestPoint(t,e,n,r,i,o,a,s,l);return yn(t.x,t.y,s,l)},pointAt:function(t,e,n,r,i,o,a,s){a=(a-o)*s+o;return{x:Un(t,0,n,r,i,a),y:Gn(0,e,n,r,i,a)}},tangentAngle:function(t,e,n,r,i,o,a,s){var l,a=(a-o)*s+o,s=(s=r,o=i,l=a,-1*n*Math.cos(o)*Math.sin(l)-s*Math.sin(o)*Math.cos(l)),i=(o=r,l=i,r=a,-1*n*Math.sin(l)*Math.sin(r)+o*Math.cos(l)*Math.cos(r));return bn(Math.atan2(i,s))}};function zn(t){for(var e=0,n=[],r=0;r<t.length-1;r++){var i=t[r],o=t[r+1],a=yn(i[0],i[1],o[0],o[1]);n.push({from:i,to:o,length:a}),e+=a}return{segments:n,totalLength:e}}var p,Hn,Xn,Yn,Kn={box:function(t){for(var e=[],n=[],r=0;r<t.length;r++){var i=t[r];e.push(i[0]),n.push(i[1])}return _n(e,n)},length:function(t){var e=t;if(e.length<2)return 0;for(var n=0,r=0;r<e.length-1;r++){var i=e[r],o=e[r+1];n+=yn(i[0],i[1],o[0],o[1])}return n},pointAt:function(t,e){var n=e;if(1<n||n<0||t.length<2)return null;var e=zn(t),r=e.segments,i=e.totalLength;if(0===i)return{x:t[0][0],y:t[0][1]};for(var o=0,a=null,s=0;s<r.length;s++){var l=r[s],u=l.from,c=l.to,l=l.length/i;if(o<=n&&n<=o+l){a=xn.pointAt(u[0],u[1],c[0],c[1],(n-o)/l);break}o+=l}return a},pointDistance:function(t,e,n){for(var r=t,i=e,o=n,a=1/0,s=0;s<r.length-1;s++){var l=r[s],u=r[s+1],l=xn.pointDistance(l[0],l[1],u[0],u[1],i,o);l<a&&(a=l)}return a},tangentAngle:function(t,e){var n=e;if(1<n||n<0||t.length<2)return 0;for(var r=(t=zn(t)).segments,i=t.totalLength,o=0,a=0,s=0;s<r.length;s++){var l=r[s],u=l.from,c=l.to,l=l.length/i;if(o<=n&&n<=o+l){a=Math.atan2(c[1]-u[1],c[0]-u[0]);break}o+=l}return a}},qn=j(function(t){var r=Object.prototype.hasOwnProperty,f="~";function n(){}function o(t,e,n){this.fn=t,this.context=e,this.once=n||!1}function i(t,e,n,r,i){if("function"!=typeof n)throw new TypeError("The listener must be a function");n=new o(n,r||t,i),r=f?f+e:e;return t._events[r]?t._events[r].fn?t._events[r]=[t._events[r],n]:t._events[r].push(n):(t._events[r]=n,t._eventsCount++),t}function l(t,e){0==--t._eventsCount?t._events=new n:delete t._events[e]}function e(){this._events=new n,this._eventsCount=0}Object.create&&(n.prototype=Object.create(null),(new n).__proto__||(f=!1)),e.prototype.eventNames=function(){var t,e,n=[];if(0===this._eventsCount)return n;for(e in t=this._events)r.call(t,e)&&n.push(f?e.slice(1):e);return Object.getOwnPropertySymbols?n.concat(Object.getOwnPropertySymbols(t)):n},e.prototype.listeners=function(t){var t=f?f+t:t,e=this._events[t];if(!e)return[];if(e.fn)return[e.fn];for(var n=0,r=e.length,i=new Array(r);n<r;n++)i[n]=e[n].fn;return i},e.prototype.listenerCount=function(t){t=f?f+t:t,t=this._events[t];return t?t.fn?1:t.length:0},e.prototype.emit=function(t,e,n,r,i,o){var a=f?f+t:t;if(!this._events[a])return!1;var s,l=this._events[a],u=arguments.length;if(l.fn){switch(l.once&&this.removeListener(t,l.fn,void 0,!0),u){case 1:return l.fn.call(l.context),!0;case 2:return l.fn.call(l.context,e),!0;case 3:return l.fn.call(l.context,e,n),!0;case 4:return l.fn.call(l.context,e,n,r),!0;case 5:return l.fn.call(l.context,e,n,r,i),!0;case 6:return l.fn.call(l.context,e,n,r,i,o),!0}for(d=1,s=new Array(u-1);d<u;d++)s[d-1]=arguments[d];l.fn.apply(l.context,s)}else for(var c,h=l.length,d=0;d<h;d++)switch(l[d].once&&this.removeListener(t,l[d].fn,void 0,!0),u){case 1:l[d].fn.call(l[d].context);break;case 2:l[d].fn.call(l[d].context,e);break;case 3:l[d].fn.call(l[d].context,e,n);break;case 4:l[d].fn.call(l[d].context,e,n,r);break;default:if(!s)for(c=1,s=new Array(u-1);c<u;c++)s[c-1]=arguments[c];l[d].fn.apply(l[d].context,s)}return!0},e.prototype.on=function(t,e,n){return i(this,t,e,n,!1)},e.prototype.once=function(t,e,n){return i(this,t,e,n,!0)},e.prototype.removeListener=function(t,e,n,r){t=f?f+t:t;if(this._events[t])if(e){var i=this._events[t];if(i.fn)i.fn!==e||r&&!i.once||n&&i.context!==n||l(this,t);else{for(var o=0,a=[],s=i.length;o<s;o++)(i[o].fn!==e||r&&!i[o].once||n&&i[o].context!==n)&&a.push(i[o]);a.length?this._events[t]=1===a.length?a[0]:a:l(this,t)}}else l(this,t);return this},e.prototype.removeAllListeners=function(t){return t?(t=f?f+t:t,this._events[t]&&l(this,t)):(this._events=new n,this._eventsCount=0),this},e.prototype.off=e.prototype.removeListener,e.prototype.addListener=e.prototype.on,e.prefixed=f,t.exports=e.EventEmitter=e});function $n(){$n=function(){return a};var a={},t=Object.prototype,l=t.hasOwnProperty,u=Object.defineProperty||function(t,e,n){t[e]=n.value},e="function"==typeof Symbol?Symbol:{},r=e.iterator||"@@iterator",n=e.asyncIterator||"@@asyncIterator",i=e.toStringTag||"@@toStringTag";function o(t,e,n){return Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{o({},"")}catch(t){o=function(t,e,n){return t[e]=n}}function s(t,e,n,r){var i,o,a,s,e=e&&e.prototype instanceof d?e:d,e=Object.create(e.prototype),r=new b(r||[]);return u(e,"_invoke",{value:(i=t,o=n,a=r,s="suspendedStart",function(t,e){if("executing"===s)throw new Error("Generator is already running");if("completed"===s){if("throw"===t)throw e;return S()}for(a.method=t,a.arg=e;;){var n=a.delegate;if(n){n=function t(e,n){var r=n.method,i=e.iterator[r];if(void 0===i)return n.delegate=null,"throw"===r&&e.iterator.return&&(n.method="return",n.arg=void 0,t(e,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),h;r=c(i,e.iterator,n.arg);if("throw"===r.type)return n.method="throw",n.arg=r.arg,n.delegate=null,h;i=r.arg;return i?i.done?(n[e.resultName]=i.value,n.next=e.nextLoc,"return"!==n.method&&(n.method="next",n.arg=void 0),n.delegate=null,h):i:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,h)}(n,a);if(n){if(n===h)continue;return n}}if("next"===a.method)a.sent=a._sent=a.arg;else if("throw"===a.method){if("suspendedStart"===s)throw s="completed",a.arg;a.dispatchException(a.arg)}else"return"===a.method&&a.abrupt("return",a.arg);s="executing";n=c(i,o,a);if("normal"===n.type){if(s=a.done?"completed":"suspendedYield",n.arg===h)continue;return{value:n.arg,done:a.done}}"throw"===n.type&&(s="completed",a.method="throw",a.arg=n.arg)}})}),e}function c(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(t){return{type:"throw",arg:t}}}a.wrap=s;var h={};function d(){}function f(){}function p(){}var e={},g=(o(e,r,function(){return this}),Object.getPrototypeOf),g=g&&g(g(x([]))),m=(g&&g!==t&&l.call(g,r)&&(e=g),p.prototype=d.prototype=Object.create(e));function v(t){["next","throw","return"].forEach(function(e){o(t,e,function(t){return this._invoke(e,t)})})}function y(a,s){var e;u(this,"_invoke",{value:function(n,r){function t(){return new s(function(t,e){!function e(t,n,r,i){var o,t=c(a[t],a,n);if("throw"!==t.type)return(n=(o=t.arg).value)&&"object"==typeof n&&l.call(n,"__await")?s.resolve(n.__await).then(function(t){e("next",t,r,i)},function(t){e("throw",t,r,i)}):s.resolve(n).then(function(t){o.value=t,r(o)},function(t){return e("throw",t,r,i)});i(t.arg)}(n,r,t,e)})}return e=e?e.then(t,t):t()}})}function E(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function _(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function b(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(E,this),this.reset(!0)}function x(e){if(e){var n,t=e[r];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length))return n=-1,(t=function t(){for(;++n<e.length;)if(l.call(e,n))return t.value=e[n],t.done=!1,t;return t.value=void 0,t.done=!0,t}).next=t}return{next:S}}function S(){return{value:void 0,done:!0}}return u(m,"constructor",{value:f.prototype=p,configurable:!0}),u(p,"constructor",{value:f,configurable:!0}),f.displayName=o(p,i,"GeneratorFunction"),a.isGeneratorFunction=function(t){t="function"==typeof t&&t.constructor;return!!t&&(t===f||"GeneratorFunction"===(t.displayName||t.name))},a.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,p):(t.__proto__=p,o(t,i,"GeneratorFunction")),t.prototype=Object.create(m),t},a.awrap=function(t){return{__await:t}},v(y.prototype),o(y.prototype,n,function(){return this}),a.AsyncIterator=y,a.async=function(t,e,n,r,i){void 0===i&&(i=Promise);var o=new y(s(t,e,n,r),i);return a.isGeneratorFunction(e)?o:o.next().then(function(t){return t.done?t.value:o.next()})},v(m),o(m,i,"Generator"),o(m,r,function(){return this}),o(m,"toString",function(){return"[object Generator]"}),a.keys=function(t){var e,n=Object(t),r=[];for(e in n)r.push(e);return r.reverse(),function t(){for(;r.length;){var e=r.pop();if(e in n)return t.value=e,t.done=!1,t}return t.done=!0,t}},a.values=x,b.prototype={constructor:b,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(_),!t)for(var e in this)"t"===e.charAt(0)&&l.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=void 0)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(n){if(this.done)throw n;var r=this;function t(t,e){return o.type="throw",o.arg=n,r.next=t,e&&(r.method="next",r.arg=void 0),!!e}for(var e=this.tryEntries.length-1;0<=e;--e){var i=this.tryEntries[e],o=i.completion;if("root"===i.tryLoc)return t("end");if(i.tryLoc<=this.prev){var a=l.call(i,"catchLoc"),s=l.call(i,"finallyLoc");if(a&&s){if(this.prev<i.catchLoc)return t(i.catchLoc,!0);if(this.prev<i.finallyLoc)return t(i.finallyLoc)}else if(a){if(this.prev<i.catchLoc)return t(i.catchLoc,!0)}else{if(!s)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return t(i.finallyLoc)}}}},abrupt:function(t,e){for(var n=this.tryEntries.length-1;0<=n;--n){var r=this.tryEntries[n];if(r.tryLoc<=this.prev&&l.call(r,"finallyLoc")&&this.prev<r.finallyLoc){var i=r;break}}var o=(i=i&&("break"===t||"continue"===t)&&i.tryLoc<=e&&e<=i.finallyLoc?null:i)?i.completion:{};return o.type=t,o.arg=e,i?(this.method="next",this.next=i.finallyLoc,h):this.complete(o)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),h},finish:function(t){for(var e=this.tryEntries.length-1;0<=e;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),_(n),h}},catch:function(t){for(var e=this.tryEntries.length-1;0<=e;--e){var n,r,i=this.tryEntries[e];if(i.tryLoc===t)return"throw"===(n=i.completion).type&&(r=n.arg,_(i)),r}throw new Error("illegal catch attempt")},delegateYield:function(t,e,n){return this.delegate={iterator:x(t),resultName:e,nextLoc:n},"next"===this.method&&(this.arg=void 0),h}},a}function Zn(t,e,n,r,i,o,a){try{var s=t[o](a),l=s.value}catch(t){return void n(t)}s.done?e(l):Promise.resolve(l).then(r,i)}function Qn(s){return function(){var t=this,a=arguments;return new Promise(function(e,n){var r=s.apply(t,a);function i(t){Zn(r,e,n,i,o,"next",t)}function o(t){Zn(r,e,n,i,o,"throw",t)}i(void 0)})}}function Jn(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,function(t){t=function(t,e){if("object"!=typeof t||null===t)return t;var n=t[Symbol.toPrimitive];if(void 0===n)return("string"===e?String:Number)(t);n=n.call(t,e||"default");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}(t,"string");return"symbol"==typeof t?t:String(t)}(r.key),r)}}function tr(t,e,n){e&&Jn(t.prototype,e),n&&Jn(t,n),Object.defineProperty(t,"prototype",{writable:!1})}function d(){return(d=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n,r=arguments[e];for(n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t}).apply(this,arguments)}function er(t,e){t.prototype=Object.create(e.prototype),nr(t.prototype.constructor=t,e)}function nr(t,e){return(nr=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t})(t,e)}function rr(t,e){if(null==t)return{};for(var n,r={},i=Object.keys(t),o=0;o<i.length;o++)n=i[o],0<=e.indexOf(n)||(r[n]=t[n]);return r}function ir(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function or(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}function ar(t,e){var n,r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(r)return(r=r.call(t)).next.bind(r);if(Array.isArray(t)||(r=function(t,e){var n;if(t)return"string"==typeof t?or(t,e):"Map"===(n="Object"===(n=Object.prototype.toString.call(t).slice(8,-1))&&t.constructor?t.constructor.name:n)||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?or(t,e):void 0}(t))||e&&t&&"number"==typeof t.length)return r&&(t=r),n=0,function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}};throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}(t=b=b||{}).COORDINATE="<coordinate>",t.COLOR="<color>",t.PAINT="<paint>",t.NUMBER="<number>",t.ANGLE="<angle>",t.OPACITY_VALUE="<opacity-value>",t.SHADOW_BLUR="<shadow-blur>",t.LENGTH="<length>",t.PERCENTAGE="<percentage>",t.LENGTH_PERCENTAGE="<length> | <percentage>",t.LENGTH_PERCENTAGE_12="[<length> | <percentage>]{1,2}",t.LENGTH_PERCENTAGE_14="[<length> | <percentage>]{1,4}",t.LIST_OF_POINTS="<list-of-points>",t.PATH="<path>",t.FILTER="<filter>",t.Z_INDEX="<z-index>",t.OFFSET_DISTANCE="<offset-distance>",t.DEFINED_PATH="<defined-path>",t.MARKER="<marker>",t.TRANSFORM="<transform>",t.TRANSFORM_ORIGIN="<transform-origin>",t.TEXT="<text>",t.TEXT_TRANSFORM="<text-transform>",(n=p=p||{})[n.kUnknown=0]="kUnknown",n[n.kNumber=1]="kNumber",n[n.kPercentage=2]="kPercentage",n[n.kEms=3]="kEms",n[n.kPixels=4]="kPixels",n[n.kRems=5]="kRems",n[n.kDegrees=6]="kDegrees",n[n.kRadians=7]="kRadians",n[n.kGradians=8]="kGradians",n[n.kTurns=9]="kTurns",n[n.kMilliseconds=10]="kMilliseconds",n[n.kSeconds=11]="kSeconds",n[n.kInteger=12]="kInteger",(e=Hn=Hn||{})[e.kUNumber=0]="kUNumber",e[e.kUPercent=1]="kUPercent",e[e.kULength=2]="kULength",e[e.kUAngle=3]="kUAngle",e[e.kUTime=4]="kUTime",e[e.kUOther=5]="kUOther",(t=Xn=Xn||{})[t.kYes=0]="kYes",t[t.kNo=1]="kNo",(n=Yn=Yn||{})[n.kYes=0]="kYes",n[n.kNo=1]="kNo";function sr(t){var e=1;switch(t){case p.kPixels:case p.kDegrees:case p.kSeconds:break;case p.kMilliseconds:e=.001;break;case p.kRadians:e=180/Math.PI;break;case p.kGradians:e=.9;break;case p.kTurns:e=360}return e}var lr,ur,cr=[{name:"em",unit_type:p.kEms},{name:"px",unit_type:p.kPixels},{name:"deg",unit_type:p.kDegrees},{name:"rad",unit_type:p.kRadians},{name:"grad",unit_type:p.kGradians},{name:"ms",unit_type:p.kMilliseconds},{name:"s",unit_type:p.kSeconds},{name:"rem",unit_type:p.kRems},{name:"turn",unit_type:p.kTurns}],hr=((e=lr=lr||{})[e.kUnknownType=0]="kUnknownType",e[e.kUnparsedType=1]="kUnparsedType",e[e.kKeywordType=2]="kKeywordType",e[e.kUnitType=3]="kUnitType",e[e.kSumType=4]="kSumType",e[e.kProductType=5]="kProductType",e[e.kNegateType=6]="kNegateType",e[e.kInvertType=7]="kInvertType",e[e.kMinType=8]="kMinType",e[e.kMaxType=9]="kMaxType",e[e.kClampType=10]="kClampType",e[e.kTransformType=11]="kTransformType",e[e.kPositionType=12]="kPositionType",e[e.kURLImageType=13]="kURLImageType",e[e.kColorType=14]="kColorType",e[e.kUnsupportedColorType=15]="kUnsupportedColorType",function(e){return cr.find(function(t){return t.name===e}).unit_type}),dr=function(t){switch(t){case p.kNumber:case p.kInteger:return Hn.kUNumber;case p.kPercentage:return Hn.kUPercent;case p.kPixels:return Hn.kULength;case p.kMilliseconds:case p.kSeconds:return Hn.kUTime;case p.kDegrees:case p.kRadians:case p.kGradians:case p.kTurns:return Hn.kUAngle;default:return Hn.kUOther}},fr=function(t){switch(t){case Hn.kUNumber:return p.kNumber;case Hn.kULength:return p.kPixels;case Hn.kUPercent:return p.kPercentage;case Hn.kUTime:return p.kSeconds;case Hn.kUAngle:return p.kDegrees;default:return p.kUnknown}},pr=function(t){switch(t){case p.kNumber:case p.kInteger:return"";case p.kPercentage:return"%";case p.kEms:return"em";case p.kRems:return"rem";case p.kPixels:return"px";case p.kDegrees:return"deg";case p.kRadians:return"rad";case p.kGradians:return"grad";case p.kMilliseconds:return"ms";case p.kSeconds:return"s";case p.kTurns:return"turn"}return""},t=function(){function t(){}t.isAngle=function(t){return t===p.kDegrees||t===p.kRadians||t===p.kGradians||t===p.kTurns},t.isLength=function(t){return t>=p.kEms&&t<p.kDegrees},t.isRelativeUnit=function(t){return t===p.kPercentage||t===p.kEms||t===p.kRems},t.isTime=function(t){return t===p.kSeconds||t===p.kMilliseconds};var e=t.prototype;return e.toString=function(){return this.buildCSSText(Xn.kNo,Yn.kNo,"")},e.isNumericValue=function(){return this.getType()>=lr.kUnitType&&this.getType()<=lr.kClampType},t}(),n=function(n){function t(t){var e=n.call(this)||this;return e.colorSpace=void 0,e.colorSpace=t,e}er(t,n);var e=t.prototype;return e.getType=function(){return lr.kColorType},e.to=function(t){return this},t}(t),gr=((e=ur=ur||{})[e.Constant=0]="Constant",e[e.LinearGradient=1]="LinearGradient",e[e.RadialGradient=2]="RadialGradient",function(r){function t(t,e){var n=r.call(this)||this;return n.type=void 0,n.value=void 0,n.type=t,n.value=e,n}er(t,r);var e=t.prototype;return e.clone=function(){return new t(this.type,this.value)},e.buildCSSText=function(t,e,n){return n},e.getType=function(){return lr.kColorType},t}(t)),mr=function(n){function t(t){var e=n.call(this)||this;return e.value=void 0,e.value=t,e}er(t,n);var e=t.prototype;return e.clone=function(){return new t(this.value)},e.getType=function(){return lr.kKeywordType},e.buildCSSText=function(t,e,n){return n+this.value},t}(t);function vr(a,s){if("function"!=typeof a||null!=s&&"function"!=typeof s)throw new TypeError("Expected a function");function l(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];var r,i=s?s.apply(this,e):e[0],o=l.cache;return o.has(i)?o.get(i):(r=a.apply(this,e),l.cache=o.set(i,r)||o,r)}return l.cache=new(vr.Cache||Map),l}vr.Cache=Map;function yr(t){return t.split("").map(function(t,e){return t.toUpperCase()===t?(0!==e?"-":"")+t.toLowerCase():t}).join("")}var Er=vr(function(t){return(t=void 0===t?"":t).replace(/-([a-z])/g,function(t){return t[1].toUpperCase()})});function _r(t){return"function"==typeof t}function br(t,e){void 0===e&&(e="");var n="";if(Number.isFinite(t)){if(!Number.isNaN(t))throw new Error;n="NaN"}else n=0<t?"infinity":"-infinity";return n+e}function xr(t){return Pr[t]||(Pr[t]=new mr(t)),Pr[t]}var Sr={d:{alias:"path"},strokeDasharray:{alias:"lineDash"},strokeWidth:{alias:"lineWidth"},textAnchor:{alias:"textAlign"},src:{alias:"img"}},wr=vr(function(t){var t=Er(t),e=Sr[t];return(null==e?void 0:e.alias)||t}),Tr=function(t){return fr(dr(t))},Ar=function(i){function n(t,e){var n,r;return void 0===e&&(e=p.kNumber),(n=i.call(this)||this).unit=void 0,n.value=void 0,r="string"==typeof e?(r=e)?"number"===r?p.kNumber:"percent"===r||"%"===r?p.kPercentage:hr(r):p.kUnknown:e,n.unit=r,n.value=t,n}er(n,i);var t=n.prototype;return t.clone=function(){return new n(this.value,this.unit)},t.equals=function(t){return this.value===t.value&&this.unit===t.unit},t.getType=function(){return lr.kUnitType},t.convertTo=function(t){var e;return this.unit===t?new n(this.value,this.unit):(e=Tr(this.unit))!==Tr(t)||e===p.kUnknown?null:(e=sr(this.unit)/sr(t),new n(this.value*e,t))},t.buildCSSText=function(t,e,n){switch(this.unit){case p.kUnknown:break;case p.kInteger:i=Number(this.value).toFixed(0);break;case p.kNumber:case p.kPercentage:case p.kEms:case p.kRems:case p.kPixels:case p.kDegrees:case p.kRadians:case p.kGradians:case p.kMilliseconds:case p.kSeconds:case p.kTurns:var r,i,o=this.value,a=pr(this.unit);i=o<-999999||999999<o?(r=pr(this.unit),!Number.isFinite(o)||Number.isNaN(o)?br(o,r):o+(r||"")):""+o+a}return n+=i},n}(t),Mr=new Ar(0,"px"),Rr=(new Ar(1,"px"),new Ar(0,"deg")),Nr=function(a){function t(t,e,n,r,i){var o;return void 0===r&&(r=1),void 0===i&&(i=!1),(o=a.call(this,"rgb")||this).r=void 0,o.g=void 0,o.b=void 0,o.alpha=void 0,o.isNone=void 0,o.r=t,o.g=e,o.b=n,o.alpha=r,o.isNone=i,o}er(t,a);var e=t.prototype;return e.clone=function(){return new t(this.r,this.g,this.b,this.alpha)},e.buildCSSText=function(t,e,n){return n+("rgba("+this.r+","+this.g+","+this.b+","+this.alpha)+")"},t}(n),Cr=new mr("unset"),e=new mr("initial"),t=new mr("inherit"),Pr={"":Cr,unset:Cr,initial:e,inherit:t},Or=new Nr(0,0,0,0,!0),Ir=new Nr(0,0,0,0),Lr=vr(function(t,e,n,r){return new Nr(t,e,n,r)},function(t,e,n,r){return"rgba("+t+","+e+","+n+","+r+")"}),kr=function(t,e){return void 0===e&&(e=p.kNumber),new Ar(t,e)},Dr=new Ar(50,"%"),Br={},Fr=0;var Ur="undefined"!=typeof window&&void 0!==window.document;function Gr(t,e){var n=Number(t.parsedStyle.zIndex),r=Number(e.parsedStyle.zIndex);if(n===r){var i=t.parentNode;if(i)return(i=i.childNodes||[]).indexOf(t)-i.indexOf(e)}return n-r}function Wr(t){var e,n=t;do{if(null==(e=n.parsedStyle)?void 0:e.clipPath)return n}while(null!==(n=n.parentElement));return null}var Vr="px";function jr(t,e,n){Ur&&t.style&&(t.style.width=e+Vr,t.style.height=n+Vr)}function zr(t,e){if(Ur)return document.defaultView.getComputedStyle(t,null).getPropertyValue(e)}var Hr="Method not implemented.",Xr="Use document.documentElement instead.",Yr={touchstart:"pointerdown",touchend:"pointerup",touchendoutside:"pointerupoutside",touchmove:"pointermove",touchcancel:"pointercancel"};function Kr(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t}function qr(t,e,n){t[0]=e[0]-n[0],t[1]=e[1]-n[1],t[2]=e[2]-n[2]}function $r(t,e,n){return t[0]=e[0]+n[0],t[1]=e[1]+n[1],t[2]=e[2]+n[2],t}function Zr(t,e,n){t[0]=e[0]*n,t[1]=e[1]*n,t[2]=e[2]*n}function Qr(t){return void 0===t?0:360<t||t<-360?t%360:t}function Jr(t,e,n){return void 0===e&&(e=0),void 0===n&&(n=0),Array.isArray(t)&&3===t.length?At(t):B(t)?x(t,e,n):x(t[0],t[1]||e,t[2]||n)}function ti(t){return t*(Math.PI/180)}function ei(t){return t*(180/Math.PI)}function ni(t,e){return 16===e.length?(n=t,r=e,a=.5*Math.PI,s=(u=gt(y(),r))[0],l=u[1],u=u[2],(c=Math.asin(-r[2]/s))<a?-a<c?(i=Math.atan2(r[6]/l,r[10]/u),o=Math.atan2(r[1]/s,r[0]/s)):(o=0,i=-Math.atan2(r[4]/l,r[5]/l)):(o=0,i=Math.atan2(r[4]/l,r[5]/l)),n[0]=i,n[1]=c,n[2]=o,n):(a=t,s=(u=e)[0],r=u[1],l=u[2],u=u[3],.499995*(n=s*s+(i=r*r)+(c=l*l)+(o=u*u))<(t=s*u-r*l)?(a[0]=Math.PI/2,a[1]=2*Math.atan2(r,s),a[2]=0):t<-.499995*n?(a[0]=-Math.PI/2,a[1]=2*Math.atan2(r,s),a[2]=0):(a[0]=Math.asin(2*(s*l-u*r)),a[1]=Math.atan2(2*(s*u+r*l),1-2*(c+o)),a[2]=Math.atan2(2*(s*r+l*u),1-2*(i+c))),a);var n,r,i,o,a,s,l,u,c}function ri(t,e,n,r,i){var o,a,s,l,u=Math.cos(t),t=Math.sin(t);return o=r*u,a=i*t,r=-r*t,t=i*u,u=i=0,e=e,n=n,s=1,(l=new X(9))[0]=o,l[1]=a,l[2]=i,l[3]=r,l[4]=t,l[5]=u,l[6]=e,l[7]=n,l[8]=s,l}function ii(t){var e=t[0],n=t[1],r=t[3],i=t[4],o=Math.sqrt(e*e+n*n),a=Math.sqrt(r*r+i*i);e*i-n*r<0&&(e<i?o=-o:a=-a),o&&(e*=1/o,n*=1/o);r=ei(Math.atan2(n,e));return[t[6],t[7],o,a,r]}var oi=K(),ai=K(),si=Vt(),f=[y(),y(),y()],li=y();function ui(t,e,n,r,i,o){if(function(t,e){var n=e[15];if(0===n)return;for(var r=1/n,i=0;i<16;i++)t[i]=e[i]*r;return 1}(oi,t)&&($(ai,oi),ai[3]=0,ai[7]=0,ai[11]=0,ai[15]=1,!(Math.abs(nt(ai))<1e-8))){var t=oi[3],a=oi[7],s=oi[11],l=oi[12],u=oi[13],c=oi[14],h=oi[15];if(0!==t||0!==a||0!==s){if(si[0]=t,si[1]=a,si[2]=s,si[3]=h,!et(ai,ai))return;tt(ai,ai),jt(i,si,ai)}else i[0]=i[1]=i[2]=0,i[3]=1;if(e[0]=l,e[1]=u,e[2]=c,t=oi,(a=f)[0][0]=t[0],a[0][1]=t[1],a[0][2]=t[2],a[1][0]=t[4],a[1][1]=t[5],a[1][2]=t[6],a[2][0]=t[8],a[2][1]=t[9],a[2][2]=t[10],n[0]=Mt(f[0]),It(f[0],f[0]),r[0]=Lt(f[0],f[1]),ci(f[1],f[1],f[0],1,-r[0]),n[1]=Mt(f[1]),It(f[1],f[1]),r[0]/=n[1],r[1]=Lt(f[0],f[2]),ci(f[2],f[2],f[0],1,-r[1]),r[2]=Lt(f[1],f[2]),ci(f[2],f[2],f[1],1,-r[2]),n[2]=Mt(f[2]),It(f[2],f[2]),r[1]/=n[2],r[2]/=n[2],kt(li,f[1],f[2]),Lt(f[0],li)<0)for(var d=0;d<3;d++)n[d]*=-1,f[d][0]*=-1,f[d][1]*=-1,f[d][2]*=-1;o[0]=.5*Math.sqrt(Math.max(1+f[0][0]-f[1][1]-f[2][2],0)),o[1]=.5*Math.sqrt(Math.max(1-f[0][0]+f[1][1]-f[2][2],0)),o[2]=.5*Math.sqrt(Math.max(1-f[0][0]-f[1][1]+f[2][2],0)),o[3]=.5*Math.sqrt(Math.max(1+f[0][0]+f[1][1]+f[2][2],0)),f[2][1]>f[1][2]&&(o[0]=-o[0]),f[0][2]>f[2][0]&&(o[1]=-o[1]),f[1][0]>f[0][1]&&(o[2]=-o[2])}}function ci(t,e,n,r,i){t[0]=e[0]*r+n[0]*i,t[1]=e[1]*r+n[1]*i,t[2]=e[2]*r+n[2]*i}var hi=K();function di(t,l){var u,c;return t&&t.length&&(c=u=0,l?(u=l.parsedStyle.defX||0,c=l.parsedStyle.defY||0,l.resetLocalTransform(),l.setLocalPosition(u,c)):l=new as({}),t.forEach(function(t){var e,n,r,i,o,a,s=t.t,t=t.d;"scale"===s?(a=(null==t?void 0:t.map(function(t){return t.value}))||[1,1],l.scaleLocal(a[0],a[1],1)):"scalex"===s?(a=(null==t?void 0:t.map(function(t){return t.value}))||[1],l.scaleLocal(a[0],1,1)):"scaley"===s?(a=(null==t?void 0:t.map(function(t){return t.value}))||[1],l.scaleLocal(1,a[0],1)):"scalez"===s?(a=(null==t?void 0:t.map(function(t){return t.value}))||[1],l.scaleLocal(1,1,a[0])):"scale3d"===s?(a=(null==t?void 0:t.map(function(t){return t.value}))||[1,1,1],l.scaleLocal(a[0],a[1],a[2])):"translate"===s?l.translateLocal((a=t||[Mr,Mr])[0].value,a[1].value,0):"translatex"===s?l.translateLocal((t||[Mr])[0].value,0,0):"translatey"===s?l.translateLocal(0,(t||[Mr])[0].value,0):"translatez"===s?l.translateLocal(0,0,(t||[Mr])[0].value):"translate3d"===s?l.translateLocal((a=t||[Mr,Mr,Mr])[0].value,a[1].value,a[2].value):"rotate"===s?(a=t||[Rr],l.rotateLocal(0,0,Oo(a[0]))):"rotatex"===s?(a=t||[Rr],l.rotateLocal(Oo(a[0]),0,0)):"rotatey"===s?(a=t||[Rr],l.rotateLocal(0,Oo(a[0]),0)):"rotatez"===s?(a=t||[Rr],l.rotateLocal(0,0,Oo(a[0]))):"rotate3d"!==s&&("skew"===s?(a=(null==t?void 0:t.map(function(t){return t.value}))||[0,0],l.setLocalSkew(ti(a[0]),ti(a[1]))):"skewx"===s?(a=(null==t?void 0:t.map(function(t){return t.value}))||[0],l.setLocalSkew(ti(a[0]),l.getLocalSkew()[1])):"skewy"===s?(a=(null==t?void 0:t.map(function(t){return t.value}))||[0],l.setLocalSkew(l.getLocalSkew()[0],ti(a[0]))):"matrix"===s?(e=(a=t.map(function(t){return t.value}))[0],n=a[1],r=a[2],i=a[3],o=a[4],a=a[5],l.setLocalTransform(Q(hi,e,n,0,0,r,i,0,0,0,0,1,0,o+u,a+c,0,1))):"matrix3d"===s&&(Q.apply(Tt,[hi].concat(t.map(function(t){return t.value}))),hi[12]+=u,hi[13]+=c,l.setLocalTransform(hi)))})),l.getLocalTransform()}fi={linearGradient:/^(linear\-gradient)/i,repeatingLinearGradient:/^(repeating\-linear\-gradient)/i,radialGradient:/^(radial\-gradient)/i,repeatingRadialGradient:/^(repeating\-radial\-gradient)/i,conicGradient:/^(conic\-gradient)/i,sideOrCorner:/^to (left (top|bottom)|right (top|bottom)|top (left|right)|bottom (left|right)|left|right|top|bottom)/i,extentKeywords:/^(closest\-side|closest\-corner|farthest\-side|farthest\-corner|contain|cover)/,positionKeywords:/^(left|center|right|top|bottom)/i,pixelValue:/^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))px/,percentageValue:/^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))\%/,emValue:/^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))em/,angleValue:/^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))deg/,startCall:/^\(/,endCall:/^\)/,comma:/^,/,hexColor:/^\#([0-9a-fA-F]+)/,literalColor:/^([a-zA-Z]+)/,rgbColor:/^rgb/i,rgbaColor:/^rgba/i,number:/^(([0-9]*\.[0-9]+)|([0-9]+\.?))/},pi="";var fi,pi,lt,gi=function(t){return pi=t,vi()};function mi(t){throw new Error(pi+": "+t)}function vi(){var t=Mi(yi);return 0<pi.length&&mi("Invalid input not EOF"),t}function yi(){return Ei("linear-gradient",fi.linearGradient,bi)||Ei("repeating-linear-gradient",fi.repeatingLinearGradient,bi)||Ei("radial-gradient",fi.radialGradient,xi)||Ei("repeating-radial-gradient",fi.repeatingRadialGradient,xi)||Ei("conic-gradient",fi.conicGradient,xi)}function Ei(n,t,r){return _i(t,function(t){var e=r();return e&&!Li(fi.comma)&&mi("Missing comma before color stops"),{type:n,orientation:e,colorStops:Mi(Ri)}})}function _i(t,e){t=Li(t);if(t)return Li(fi.startCall)||mi("Missing ("),e=e(t),Li(fi.endCall)||mi("Missing )"),e}function bi(){return Ii("directional",fi.sideOrCorner,1)||Ii("angular",fi.angleValue,1)}function xi(){var t,e,n=Si();return n&&((t=[]).push(n),e=pi,Li(fi.comma))&&((n=Si())?t.push(n):pi=e),t}function Si(){var t,e=function(){var t=Ii("shape",/^(circle)/i,0);t&&(t.style=Oi()||wi());return t}()||function(){var t=Ii("shape",/^(ellipse)/i,0);t&&(t.style=Ci()||wi());return t}();return e?e.at=Ti():(t=wi())?(e=t,(t=Ti())&&(e.at=t)):(t=Ai())&&(e={type:"default-radial",at:t}),e}function wi(){return Ii("extent-keyword",fi.extentKeywords,1)}function Ti(){var t;if(Ii("position",/^at/,0))return(t=Ai())||mi("Missing positioning value"),t}function Ai(){var t={x:Ci(),y:Ci()};if(t.x||t.y)return{type:"position",value:t}}function Mi(t){var e=t(),n=[];if(e)for(n.push(e);Li(fi.comma);)(e=t())?n.push(e):mi("One extra comma");return n}function Ri(){var t=Ii("hex",fi.hexColor,1)||_i(fi.rgbaColor,function(){return{type:"rgba",value:Mi(Ni)}})||_i(fi.rgbColor,function(){return{type:"rgb",value:Mi(Ni)}})||Ii("literal",fi.literalColor,0);return t||mi("Expected color definition"),t.length=Ci(),t}function Ni(){return Li(fi.number)[1]}function Ci(){return Ii("%",fi.percentageValue,1)||Pi()||Oi()}function Pi(){return Ii("position-keyword",fi.positionKeywords,1)}function Oi(){return Ii("px",fi.pixelValue,1)||Ii("em",fi.emValue,1)}function Ii(t,e,n){e=Li(e);if(e)return{type:t,value:e[n]}}function Li(t){var e=/^[\n\r\t\s]+/.exec(pi),e=(e&&ki(e[0].length),t.exec(pi));return e&&ki(e[0].length),e}function ki(t){pi=pi.substring(t)}function Di(t,e,n){var n=ti(n.value),r=0+t/2,i=0+e/2,t=Math.abs(t*Math.cos(n))+Math.abs(e*Math.sin(n));return{x1:r-Math.cos(n)*t/2,y1:i-Math.sin(n)*t/2,x2:r+Math.cos(n)*t/2,y2:i+Math.sin(n)*t/2}}function Bi(t,e,n,r,i){var o=n.value,a=r.value,n=(n.unit===p.kPercentage&&(o=n.value/100*t),r.unit===p.kPercentage&&(a=r.value/100*e),Math.max(ye([0,0],[o,a]),ye([0,e],[o,a]),ye([t,e],[o,a]),ye([t,0],[o,a])));return i&&(i instanceof Ar?n=i.value:i instanceof mr&&("closest-side"===i.value?n=Math.min(o,t-o,a,e-a):"farthest-side"===i.value?n=Math.max(o,t-o,a,e-a):"closest-corner"===i.value&&(n=Math.min(ye([0,0],[o,a]),ye([0,e],[o,a]),ye([t,e],[o,a]),ye([t,0],[o,a]))))),{x:o,y:a,r:n}}function Fi(t){var e;return 0===t.parsedStyle.path.totalLength&&(t.parsedStyle.path.totalLength=Ae(t.parsedStyle.path.absolutePath,void 0,k(k({},e),{bbox:!1,length:!0})).length),t.parsedStyle.path.totalLength}function Ui(t,e){return t[0]===e[0]&&t[1]===e[1]}function Gi(t,e){var n,r=t.prePoint,i=t.currentPoint,t=t.nextPoint,o=Math.pow(i[0]-r[0],2)+Math.pow(i[1]-r[1],2),a=Math.pow(i[0]-t[0],2)+Math.pow(i[1]-t[1],2),r=Math.pow(r[0]-t[0],2)+Math.pow(r[1]-t[1],2),r=Math.acos((o+a-r)/(2*Math.sqrt(o)*Math.sqrt(a)));return!r||0===Math.sin(r)||(void(o=0)===n&&(n=Ge),Math.abs(r-o)<n)?{xExtra:0,yExtra:0}:(a=Math.abs(Math.atan2(t[1]-i[1],t[0]-i[0])),o=Math.abs(Math.atan2(t[0]-i[0],t[1]-i[1])),a=a>Math.PI/2?Math.PI-a:a,o=o>Math.PI/2?Math.PI-o:o,{xExtra:Math.cos(r/2-a)*(e/2*(1/Math.sin(r/2)))-e/2||0,yExtra:Math.cos(o-r/2)*(e/2*(1/Math.sin(r/2)))-e/2||0})}function Wi(t,e){return[e[0]+(e[0]-t[0]),e[1]+(e[1]-t[1])]}(n=lt=lt||{}).GROUP="g",n.CIRCLE="circle",n.ELLIPSE="ellipse",n.IMAGE="image",n.RECT="rect",n.LINE="line",n.POLYLINE="polyline",n.POLYGON="polygon",n.TEXT="text",n.PATH="path",n.HTML="html",n.MESH="mesh";var Vi=function(t,e){var n=t.x*e.x+t.y*e.y,r=Math.sqrt((Math.pow(t.x,2)+Math.pow(t.y,2))*(Math.pow(e.x,2)+Math.pow(e.y,2)));return(t.x*e.y-t.y*e.x<0?-1:1)*Math.acos(n/r)},ji=function(t,e,n,r,i,o,a,s){e=Math.abs(e),n=Math.abs(n);r=ti(r=We(r,360));if(t.x===a.x&&t.y===a.y)return{x:t.x,y:t.y,ellipticalArcAngle:0};if(0===e||0===n)return{x:0,y:0,ellipticalArcAngle:0};var l=(t.x-a.x)/2,u=(t.y-a.y)/2,l={x:Math.cos(r)*l+Math.sin(r)*u,y:-Math.sin(r)*l+Math.cos(r)*u},u=Math.pow(l.x,2)/Math.pow(e,2)+Math.pow(l.y,2)/Math.pow(n,2);1<u&&(e=Math.sqrt(u)*e,n=Math.sqrt(u)*n);var u=(u=(Math.pow(e,2)*Math.pow(n,2)-Math.pow(e,2)*Math.pow(l.y,2)-Math.pow(n,2)*Math.pow(l.x,2))/(Math.pow(e,2)*Math.pow(l.y,2)+Math.pow(n,2)*Math.pow(l.x,2)))<0?0:u,i=(i!==o?1:-1)*Math.sqrt(u),u=e*l.y/n*i,i=-n*l.x/e*i,t={x:Math.cos(r)*u-Math.sin(r)*i+(t.x+a.x)/2,y:Math.sin(r)*u+Math.cos(r)*i+(t.y+a.y)/2},a={x:(l.x-u)/e,y:(l.y-i)/n},c=Vi({x:1,y:0},a),a=Vi(a,{x:(-l.x-u)/e,y:(-l.y-i)/n}),u=(!o&&0<a?a-=2*Math.PI:o&&a<0&&(a+=2*Math.PI),c+(a%=2*Math.PI)*s),l=e*Math.cos(u),i=n*Math.sin(u);return{x:Math.cos(r)*l-Math.sin(r)*i+t.x,y:Math.sin(r)*l+Math.cos(r)*i+t.y,ellipticalArcStartAngle:c,ellipticalArcEndAngle:c+a,ellipticalArcAngle:u,ellipticalArcCenter:t,resultantRx:e,resultantRy:n}};function zi(t){for(var e=[],n=null,r=null,i=null,o=0,a=t.length,s=0;s<a;s++){var l=t[s],r=t[s+1],u=l[0],c={command:u,prePoint:n,params:l,startTangent:null,endTangent:null,currentPoint:null,nextPoint:null,arcParams:null,box:null,cubicParams:null};switch(u){case"M":i=[l[1],l[2]],o=s;break;case"A":var h=function(t,e){var n=e[1],r=e[2],i=We(ti(e[3]),2*Math.PI),o=e[4],a=e[5],s=t[0],l=t[1],u=e[6],e=e[7],c=Math.cos(i)*(s-u)/2+Math.sin(i)*(l-e)/2,h=-1*Math.sin(i)*(s-u)/2+Math.cos(i)*(l-e)/2,d=c*c/(n*n)+h*h/(r*r);1<d&&(n*=Math.sqrt(d),r*=Math.sqrt(d));d=n*n*(h*h)+r*r*(c*c),d=d?Math.sqrt((n*n*(r*r)-d)/d):1;o===a&&(d*=-1);isNaN(d)&&(d=0);var f=r?d*n*h/r:0,d=n?d*-r*c/n:0,s=(s+u)/2+Math.cos(i)*f-Math.sin(i)*d,l=(l+e)/2+Math.sin(i)*f+Math.cos(i)*d,p=[(c-f)/n,(h-d)/r],c=[(-1*c-f)/n,(-1*h-d)/r],f=Ki([1,0],p),h=Ki(p,c);Yi(p,c)<=-1&&(h=Math.PI);1<=Yi(p,c)&&(h=0);0===a&&0<h&&(h-=2*Math.PI);1===a&&h<0&&(h+=2*Math.PI);return{cx:s,cy:l,rx:Ui(t,[u,e])?0:n,ry:Ui(t,[u,e])?0:r,startAngle:f,endAngle:f+h,xRotation:i,arcFlag:o,sweepFlag:a}}(n,l);c.arcParams=h}"Z"===u?(n=i,r=t[o+1]):n=[l[(y=l.length)-2],l[y-1]],r&&"Z"===r[0]&&(r=t[o],e[o])&&(e[o].prePoint=n),c.currentPoint=n,e[o]&&Ui(n,e[o].currentPoint)&&(e[o].prePoint=c.prePoint);var d,f,p,g,m,v,y=r?[r[r.length-2],r[r.length-1]]:null,E=(c.nextPoint=y,c.prePoint);["L","H","V"].includes(u)?(c.startTangent=[E[0]-n[0],E[1]-n[1]],c.endTangent=[n[0]-E[0],n[1]-E[1]]):"Q"===u?(d=[l[1],l[2]],c.startTangent=[E[0]-d[0],E[1]-d[1]],c.endTangent=[n[0]-d[0],n[1]-d[1]]):"T"===u?(f=Wi((d=e[s-1]).currentPoint,E),"Q"===d.command?(c.command="Q",c.startTangent=[E[0]-f[0],E[1]-f[1]],c.endTangent=[n[0]-f[0],n[1]-f[1]]):(c.command="TL",c.startTangent=[E[0]-n[0],E[1]-n[1]],c.endTangent=[n[0]-E[0],n[1]-E[1]])):"C"===u?(f=[l[1],l[2]],p=[l[3],l[4]],c.startTangent=[E[0]-f[0],E[1]-f[1]],c.endTangent=[n[0]-p[0],n[1]-p[1]],0===c.startTangent[0]&&0===c.startTangent[1]&&(c.startTangent=[f[0]-p[0],f[1]-p[1]]),0===c.endTangent[0]&&0===c.endTangent[1]&&(c.endTangent=[p[0]-f[0],p[1]-f[1]])):"S"===u?(g=Wi((p=e[s-1]).currentPoint,E),m=[l[1],l[2]],"C"===p.command?(c.command="C",c.startTangent=[E[0]-g[0],E[1]-g[1]]):(c.command="SQ",c.startTangent=[E[0]-m[0],E[1]-m[1]]),c.endTangent=[n[0]-m[0],n[1]-m[1]]):"A"===u&&(E=(g=Hi(c,0)).x,m=g.y,v=(u=Hi(c,1,!1)).x,u=u.y,c.startTangent=[E,m],c.endTangent=[v,u]),e.push(c)}return e}function Hi(t,e,n){void 0===n&&(n=!0);var r=t.arcParams,i=r.rx,i=void 0===i?0:i,o=r.ry,o=void 0===o?0:o,a=r.xRotation,s=r.arcFlag,r=r.sweepFlag,l=ji({x:t.prePoint[0],y:t.prePoint[1]},i,o,a,!!s,!!r,{x:t.currentPoint[0],y:t.currentPoint[1]},e),i=ji({x:t.prePoint[0],y:t.prePoint[1]},i,o,a,!!s,!!r,{x:t.currentPoint[0],y:t.currentPoint[1]},n?e+.005:e-.005),o=i.x-l.x,a=i.y-l.y,s=Math.sqrt(o*o+a*a);return{x:-o/s,y:-a/s}}function Xi(t){return Math.sqrt(t[0]*t[0]+t[1]*t[1])}function Yi(t,e){return Xi(t)*Xi(e)?(t[0]*e[0]+t[1]*e[1])/(Xi(t)*Xi(e)):1}function Ki(t,e){return(t[0]*e[1]<t[1]*e[0]?-1:1)*Math.acos(Yi(t,e))}function qi(t,e,n,r){var i=(-1+Math.sqrt(2))/3*4,o=t*i,i=e*i,a=n-t,t=n+t,s=r-e,e=r+e;return[["M",a,r],["C",a,r-i,n-o,s,n,s],["C",n+o,s,t,r-i,t,r],["C",t,r+i,n+o,e,n,e],["C",n-o,e,a,r+i,a,r],["Z"]]}function $i(t,e){void 0===e&&(e=t.getLocalTransform());var n,r,i,o,a,s,l,u,c,h,d,f=[];switch(t.nodeName){case lt.LINE:var p=t.parsedStyle,f=[["M",p.x1,p.y1],["L",p.x2,p.y2]];break;case lt.CIRCLE:var p=t.parsedStyle,g=p.r;f=qi(g,g,p.cx,p.cy);break;case lt.ELLIPSE:var g=t.parsedStyle;f=qi(g.rx,g.ry,g.cx,g.cy);break;case lt.POLYLINE:case lt.POLYGON:p=t.parsedStyle.points;g=p.points,p=t.nodeName===lt.POLYGON,g=g.map(function(t,e){return[0===e?"M":"L",t[0],t[1]]}),p&&g.push(["Z"]),f=g;break;case lt.RECT:var m=t.parsedStyle,v=m.width,y=m.height,E=m.x,_=m.y,m=m.radius,b=m&&m.some(function(t){return 0!==t});n=v,r=y,E=E,_=_,f=(b=b&&m.map(function(t){return Ue(t,0,Math.min(Math.abs(v)/2,Math.abs(y)/2))}))?(s=(m=0<n?1:-1)+(a=0<r?1:-1)!=0?1:0,[["M",m*(i=b[0])+E,_],["L",n-m*(o=b[1])+E,_],o?["A",o,o,0,0,s,n+E,a*o+_]:null,["L",n+E,r-a*(o=b[2])+_],o?["A",o,o,0,0,s,n+E-m*o,r+_]:null,["L",E+m*(o=b[3]),r+_],o?["A",o,o,0,0,s,E,r+_-a*o]:null,["L",E,a*i+_],i?["A",i,i,0,0,s,m*i+E,_]:null,["Z"]].filter(function(t){return t})):[["M",E,_],["L",E+n,_],["L",E+n,_+r],["L",E,_+r],["Z"]];break;case lt.PATH:b=t.parsedStyle.path.absolutePath;f=[].concat(b)}if(f.length)return l=f,u=e,c=(e=(e=t).parsedStyle).defX,h=void 0===c?0:c,d=void 0===(c=e.defY)?0:c,l.reduce(function(t,e){var n,r,i,o="";return"M"===e[0]||"L"===e[0]?(n=x(e[1]-h,e[2]-d,0),u&&Bt(n,n,u),o=""+e[0]+n[0]+","+n[1]):"Z"===e[0]?o=e[0]:"C"===e[0]?(n=x(e[1]-h,e[2]-d,0),r=x(e[3]-h,e[4]-d,0),i=x(e[5]-h,e[6]-d,0),u&&(Bt(n,n,u),Bt(r,r,u),Bt(i,i,u)),o=""+e[0]+n[0]+","+n[1]+","+r[0]+","+r[1]+","+i[0]+","+i[1]):"A"===e[0]?(n=x(e[6]-h,e[7]-d,0),u&&Bt(n,n,u),o=""+e[0]+e[1]+","+e[2]+","+e[3]+","+e[4]+","+e[5]+","+n[0]+","+n[1]):"Q"===e[0]&&(r=x(e[1]-h,e[2]-d,0),i=x(e[3]-h,e[4]-d,0),u&&(Bt(r,r,u),Bt(i,i,u)),o=""+e[0]+e[1]+","+e[2]+","+e[3]+","+e[4]+"}"),t+o},"")}function Zi(t,e,n){var r=!1,i=!1,e=!!e&&!e.isNone,n=!!n&&!n.isNone;return"visiblepainted"===t||"painted"===t||"auto"===t?(r=e,i=n):"visiblefill"===t||"fill"===t?r=!0:"visiblestroke"===t||"stroke"===t?i=!0:"visible"!==t&&"all"!==t||(i=r=!0),[r,i]}var Qi=function(){function t(){this.callbacks=[]}var e=t.prototype;return e.tapPromise=function(t,e){this.callbacks.push(e)},e.promise=function(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];return Promise.all(this.callbacks.map(function(t){return t.apply(void 0,e)}))},t}(),Ji=function(){function t(){this.callbacks=[]}var e=t.prototype;return e.tapPromise=function(t,e){this.callbacks.push(e)},e.promise=function(){var t=Qn($n().mark(function t(){var e,n,r,i=arguments;return $n().wrap(function(t){for(;;)switch(t.prev=t.next){case 0:if(this.callbacks.length)return t.next=3,(r=this.callbacks)[0].apply(r,i);t.next=14;break;case 3:e=t.sent,n=0;case 5:if(n<this.callbacks.length-1)return r=this.callbacks[n],t.next=9,r(e);t.next=13;break;case 9:e=t.sent;case 10:n++,t.next=5;break;case 13:return t.abrupt("return",e);case 14:return t.abrupt("return",null);case 15:case"end":return t.stop()}},t,this)}));return function(){return t.apply(this,arguments)}}(),t}(),to=function(){function t(){this.callbacks=[]}var e=t.prototype;return e.tap=function(t,e){this.callbacks.push(e)},e.call=function(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];this.callbacks.forEach(function(t){t.apply(void 0,e)})},t}(),eo=function(){function t(){this.callbacks=[]}var e=t.prototype;return e.tap=function(t,e){this.callbacks.push(e)},e.call=function(){if(this.callbacks.length){for(var t,e=(t=this.callbacks)[0].apply(t,arguments),n=0;n<this.callbacks.length-1;n++)e=(0,this.callbacks[n])(e);return e}return null},t}(),no=["serif","sans-serif","monospace","cursive","fantasy","system-ui"],ro=/([\"\'])[^\'\"]+\1/;function io(t){return"string"!=typeof t?fo:""===t?so.requestAnimationFrame:so[t+"RequestAnimationFrame"]}var oo=1,ao=function(){return oo++},so="object"==typeof self&&self.self==self?self:"object"==typeof V&&V.global==V?V:{},lo=Date.now(),uo=function(){return so.performance&&"function"==typeof so.performance.now?so.performance.now():Date.now()-lo},co={},ho=Date.now(),fo=function(t){if("function"!=typeof t)throw new TypeError(t+" is not a function");var n=Date.now(),e=n-ho,e=16<e?0:16-e,r=ao();return co[r]=t,1<Object.keys(co).length||setTimeout(function(){ho=n;var e=co;co={},Object.keys(e).forEach(function(t){return e[t](uo())})},e),r},e=function(t){delete co[t]},t=function(t,e){for(var n=0;void 0!==t[n];){if(e(t[n]))return t[n];n+=1}}(["","webkit","moz","ms","o"],io),po=io(t),go="string"!=typeof(n=t)?e:""===n?so.cancelAnimationFrame:so[n+"CancelAnimationFrame"]||so[n+"CancelRequestAnimationFrame"],mo=(so.requestAnimationFrame=po,so.cancelAnimationFrame=go,/^l\s*\(\s*([\d.]+)\s*\)\s*(.*)/i),vo=/^r\s*\(\s*([\d.]+)\s*,\s*([\d.]+)\s*,\s*([\d.]+)\s*\)\s*(.*)/i,yo=/^p\s*\(\s*([axyn])\s*\)\s*(.*)/i,Eo=/[\d.]+:(#[^\s]+|[^\)]+\))/gi;var _o={left:180,top:-90,bottom:90,right:0,"left top":225,"top left":225,"left bottom":135,"bottom left":135,"right top":-45,"top right":-45,"right bottom":45,"bottom right":45},bo=vr(function(t){t="angular"===t.type?Number(t.value):_o[t.value]||0;return kr(t,"deg")}),xo=vr(function(t){var e,n=50,r=50,i="%",o="%";return"position"===(null==t?void 0:t.type)&&(e=(t=t.value).x,t=t.y,"position-keyword"===(null==e?void 0:e.type)&&("left"===e.value?n=0:"center"===e.value?n=50:"right"===e.value?n=100:"top"===e.value?r=0:"bottom"===e.value&&(r=100)),"position-keyword"===(null==t?void 0:t.type)&&("left"===t.value?n=0:"center"===t.value?r=50:"right"===t.value?n=100:"top"===t.value?r=0:"bottom"===t.value&&(r=100)),"px"!==(null==e?void 0:e.type)&&"%"!==(null==e?void 0:e.type)&&"em"!==(null==e?void 0:e.type)||(i=null==e?void 0:e.type,n=Number(e.value)),"px"!==(null==t?void 0:t.type)&&"%"!==(null==t?void 0:t.type)&&"em"!==(null==t?void 0:t.type)||(o=null==t?void 0:t.type,r=Number(t.value))),{cx:kr(n,i),cy:kr(r,o)}}),So=vr(function(t){if(-1<t.indexOf("linear")||-1<t.indexOf("radial"))return gi(t).map(function(t){for(var e=t.type,n=t.orientation,t=t.colorStops,r=t,i=r.length,o=(r[i-1].length=null!=(d=r[i-1].length)?d:{type:"%",value:"100"},1<i&&(r[0].length=null!=(d=r[0].length)?d:{type:"%",value:"0"}),0),a=Number(r[0].length.value),s=1;s<i;s++){var l,u=null==(l=r[s].length)?void 0:l.value;if(!M(u)&&!M(a)){for(var c=1;c<s-o;c++)r[o+c].length={type:"%",value:""+(a+(Number(u)-a)*c/(s-o))};o=s,a=Number(u)}}var h,d=t.map(function(t){return{offset:kr(Number(t.length.value),"%"),color:(e=(t=t).type,t=t.value,"hex"===e?"#"+t:"literal"===e?t:"rgb"===e?"rgb("+t.join(",")+")":"rgba("+t.join(",")+")")};var e});return"linear-gradient"===e?new gr(ur.LinearGradient,{angle:n?bo(n):Rr,steps:d}):"radial-gradient"===e&&"shape"===(n=n||[{type:"shape",value:"circle"}])[0].type&&"circle"===n[0].value?(e=(t=xo(n[0].at)).cx,t=t.cy,n[0].style&&(h=(n=n[0].style).type,n=n.value,h="extent-keyword"===h?xr(n):kr(n,h)),new gr(ur.RadialGradient,{cx:e,cy:t,size:h,steps:d})):void 0});var e=t[0];if("("===t[1]||"("===t[2])if("l"===e){var n=mo.exec(t);if(n)return r=(null==(r=n[2].match(Eo))?void 0:r.map(function(t){return t.split(":")}))||[],[new gr(ur.LinearGradient,{angle:kr(parseFloat(n[1]),"deg"),steps:r.map(function(t){var e=t[0],t=t[1];return{offset:kr(100*Number(e),"%"),color:t}})})]}else if("r"===e){n=function(t){var t=vo.exec(t);if(t)return t=(null==(t=t[4].match(Eo))?void 0:t.map(function(t){return t.split(":")}))||[],{cx:kr(50,"%"),cy:kr(50,"%"),steps:t.map(function(t){var e=t[0],t=t[1];return{offset:kr(100*Number(e),"%"),color:t}})};return null}(t);if(n&&!Fe(n))return[new gr(ur.RadialGradient,n)]}else if("p"===e){var r=t;if(r=yo.exec(r)){var i=r[1],r=r[2];switch(i){case"a":i="repeat";break;case"x":i="repeat-x";break;case"y":i="repeat-y";break;default:i="no-repeat"}return{image:r,repetition:i}}return null}});function wo(t){return t&&t.image}function To(t){return t&&!M(t.r)&&!M(t.g)&&!M(t.b)}var Ao=vr(function(t){var e;return wo(t)?d({repetition:"repeat"},t):"transparent"===(t=M(t)?"":t)?Ir:So(t="currentColor"===t?"black":t)||(e=[0,0,0,0],null!==(t=sn(t))&&(e[0]=t.r||0,e[1]=t.g||0,e[2]=t.b||0,e[3]=t.opacity),Lr.apply(void 0,e))});function Mo(t,e){if(To(t)&&To(e))return[[Number(t.r),Number(t.g),Number(t.b),Number(t.alpha)],[Number(e.r),Number(e.g),Number(e.b),Number(e.alpha)],function(t){var e=t.slice();if(e[3])for(var n=0;n<3;n++)e[n]=Math.round(Ue(e[n],0,255));return e[3]=Ue(e[3],0,1),"rgba("+e.join(",")+")"}]}function Ro(t,e){if(M(e))return kr(0,"px");if(e=(""+e).trim().toLowerCase(),isFinite(Number(e))){if(0<="px".search(t))return kr(Number(e),"px");if(0<="deg".search(t))return kr(Number(e),"deg")}var n=[],r=(e=e.replace(t,function(t){return n.push(t),"U"+t}),"U("+t.source+")");return n.map(function(t){return kr(Number(e.replace(new RegExp("U"+t,"g"),"").replace(new RegExp(r,"g"),"*0")),t)})[0]}var No=vr(function(t){return Ro(new RegExp("px","g"),t)}),Co=(vr(function(t){return Ro(new RegExp("%","g"),t)}),function(t){return B(t)||isFinite(Number(t))?kr(Number(t)||0,"px"):Ro(new RegExp("px|%|em|rem","g"),t)}),Po=vr(function(t){return Ro(new RegExp("deg|rad|grad|turn","g"),t)});function Oo(t){var e=0;return t.unit===p.kDegrees?e=t.value:t.unit===p.kRadians?e=ei(Number(t.value)):t.unit===p.kTurns&&(e=360*Number(t.value)),e}function Io(t,e){var n;return Array.isArray(t)?n=t.map(function(t){return Number(t)}):Fe(t)?n=t.split(" ").map(function(t){return Number(t)}):B(t)&&(n=[t]),2===e?1===n.length?[n[0],n[0]]:[n[0],n[1]]:1===n.length?[n[0],n[0],n[0],n[0]]:2===n.length?[n[0],n[1],n[0],n[1]]:3===n.length?[n[0],n[1],n[2],n[1]]:[n[0],n[1],n[2],n[3]]}function Lo(t){return Fe(t)?t.split(" ").map(function(t){return Co(t)}):t.map(function(t){return Co(t.toString())})}function ko(t,e,n){return 0===t.value?0:t.unit===p.kPixels?Number(t.value):t.unit===p.kPercentage&&n?(n=n.nodeName===lt.GROUP?n.getLocalBounds():n.geometry.contentBounds,t.value/100*n.halfExtents[e]*2):0}var Do=function(t){return Ro(/deg|rad|grad|turn|px|%/g,t)},Bo=["blur","brightness","drop-shadow","contrast","grayscale","sepia","saturate","hue-rotate","invert"];function Fo(t){if("none"!==(t=(t=void 0===t?"":t).toLowerCase().trim()))for(var e,n=/\s*([\w-]+)\(([^)]*)\)/g,r=[],i=0;e=n.exec(t);){if(e.index!==i)return[];if(i=e.index+e[0].length,-1<Bo.indexOf(e[1])&&r.push({name:e[1],params:e[2].split(" ").map(function(t){return Do(t)||Ao(t)})}),n.lastIndex===t.length)return r}return[]}function Uo(t){return t.toString()}var Go=vr(function(t){return"number"==typeof t?kr(t):/^\s*[-+]?(\d*\.)?\d+\s*$/.test(t)?kr(Number(t)):kr(0)});function Wo(t,e){return[t,e,Uo]}function Vo(n,r){return function(t,e){return[t,e,function(t){return Uo(Ue(t,n,r))}]}}function jo(t,e){if(t.length===e.length)return[t,e,function(t){return t}]}vr(function(t){return(Fe(t)?t.split(" "):t).map(Go)});var zo=function(e){if(""===e||Array.isArray(e)&&0===e.length)return{absolutePath:[],hasArc:!1,segments:[],polygons:[],polylines:[],curve:null,totalLength:0,rect:{x:0,y:0,width:0,height:0}};var n;try{n=pe(e)}catch(t){n=pe(""),console.error("[g]: Invalid SVG Path definition: "+e)}var e=function(t){for(var e=!1,n=t.length,r=0;r<n;r++){var i=t[r][0];if("C"===i||"A"===i||"Q"===i){e=!0;break}}return e}(n),t=function(t){for(var e=[],n=[],r=[],i=0;i<t.length;i++){var o=t[i],a=o[0];"M"===a?(r.length&&(n.push(r),r=[]),r.push([o[1],o[2]])):"Z"===a?r.length&&(e.push(r),r=[]):r.push([o[1],o[2]])}return 0<r.length&&n.push(r),{polygons:e,polylines:n}}(n),r=t.polygons,t=t.polylines,i=zi(n),o=function(t,e){for(var n=[],r=[],i=[],o=0;o<t.length;o++){var a=t[o],s=a.currentPoint,l=a.params,u=a.prePoint,c=void 0;switch(a.command){case"Q":c=Cn.box(u[0],u[1],l[1],l[2],l[3],l[4]);break;case"C":c=Dn.box(u[0],u[1],l[1],l[2],l[3],l[4],l[5],l[6]);break;case"A":var h=a.arcParams,c=jn.box(h.cx,h.cy,h.rx,h.ry,h.xRotation,h.startAngle,h.endAngle);break;default:n.push(s[0]),r.push(s[1])}c&&(a.box=c,n.push(c.x,c.x+c.width),r.push(c.y,c.y+c.height)),e&&("L"===a.command||"M"===a.command)&&a.prePoint&&a.nextPoint&&i.push(a)}var n=n.filter(function(t){return!Number.isNaN(t)&&t!==1/0&&t!==-1/0}),r=r.filter(function(t){return!Number.isNaN(t)&&t!==1/0&&t!==-1/0}),d=Be(n),f=Be(r),p=De(n),g=De(r);if(0!==i.length)for(var m=0;m<i.length;m++){var v=i[m],y=v.currentPoint;y[0]===d?d-=Gi(v,e).xExtra:y[0]===p&&(p+=Gi(v,e).xExtra),y[1]===f?f-=Gi(v,e).yExtra:y[1]===g&&(g+=Gi(v,e).yExtra)}return{x:d,y:f,width:p-d,height:g-f}}(i,0),a=o.x,s=o.y,l=o.width,o=o.height;return{absolutePath:n,hasArc:e,segments:i,polygons:r,polylines:t,totalLength:0,rect:{x:Number.isFinite(a)?a:0,y:Number.isFinite(s)?s:0,width:Number.isFinite(l)?l:0,height:Number.isFinite(o)?o:0}}},Ho=vr(zo);function Xo(t,e){t=(Fe(t)?Ho:zo)(t);return e&&(e.parsedStyle.defX=t.rect.x,e.parsedStyle.defY=t.rect.y),t}function Yo(t,e,n){var r,i,o,a,s,l,u,c,h,d=t.curve,f=e.curve,t=(d&&0!==d.length||(d=be(t.absolutePath,!1),t.curve=d),f&&0!==f.length||(f=be(e.absolutePath,!1),e.curve=f),[d,f]),d=Me((t=d.length!==f.length?function t(e,n,r){var i,e=Re(e),n=Re(n),o=e.length,a=n.length,s=e.filter(function(t){return t.l}).length,l=n.filter(function(t){return t.l}).length,s=e.filter(function(t){return t.l}).reduce(function(t,e){return t+e.l},0)/s||0,l=n.filter(function(t){return t.l}).reduce(function(t,e){return t+e.l},0)/l||0,u=r||Math.max(o,a),c=[s,l],h=[u-o,u-a],r=[e,n].map(function(t,n){return t.l===u?t.map(function(t){return t.s}):t.map(function(t,e){return i=e&&h[n]&&t.l>=c[n],h[n]-=i?1:0,i?t.ss:[t.s]}).flat()});return r[0].length===r[1].length?r:t(r[0],r[1],u)}(d,f):t)[0])!==Me(t[1])?(r=t[0],e=r.slice(1).map(function(t,e,n){return(e?n[e-1].slice(-2):r[0].slice(1)).concat(t.slice(1))}).map(function(n){return n.map(function(t,e){return n[n.length-e-2*(1-e%2)]})}).reverse(),[["M"].concat(e[0].slice(0,2))].concat(e.map(function(t){return["C"].concat(t.slice(2))}))):ne(t[0]);return[d,(i=t[1],o=d,u=i.length-1,c=[],h=0,s=(a=i).length,l=s-1,(f=a.map(function(t,r){return a.map(function(t,e){var n=r+e;return 0===e||a[n]&&"M"===a[n][0]?(e=a[n],["M"].concat(e.slice(-2))):(s<=n&&(n-=l),a[n])})})).forEach(function(t,n){i.slice(1).forEach(function(t,e){h+=ye(i[(n+e)%u].slice(-2),o[e%u].slice(-2))}),c[n]=h,h=0}),f[c.indexOf(Math.min.apply(null,c))]),function(t){return t}]}function Ko(t,e){var n,r,i=Fe(t)?t.split(" ").map(function(t){var t=t.split(","),e=t[0],t=t[1];return[Number(e),Number(t)]}):t,o=[],a=0,s=Kn.length(i),t=(i.forEach(function(t,e){i[e+1]&&((n=[0,0])[0]=a/s,r=xn.length(t[0],t[1],i[e+1][0],i[e+1][1]),a+=r,n[1]=a/s,o.push(n))}),Math.min.apply(Math,i.map(function(t){return t[0]}))),l=Math.min.apply(Math,i.map(function(t){return t[1]}));return e&&(e.parsedStyle.defX=t,e.parsedStyle.defY=l),{points:i,totalLength:s,segments:o}}function qo(t,e){return[t.points,e.points,function(t){return t}]}var $o=null;function Zo(t){return function(e){var n=0;return t.map(function(t){return t===$o?e[n++]:t})}}function Qo(t){return t}var Jo={matrix:["NNNNNN",[$o,$o,0,0,$o,$o,0,0,0,0,1,0,$o,$o,0,1],Qo],matrix3d:["NNNNNNNNNNNNNNNN",Qo],rotate:["A"],rotatex:["A"],rotatey:["A"],rotatez:["A"],rotate3d:["NNNA"],perspective:["L"],scale:["Nn",Zo([$o,$o,new Ar(1)]),Qo],scalex:["N",Zo([$o,new Ar(1),new Ar(1)]),Zo([$o,new Ar(1)])],scaley:["N",Zo([new Ar(1),$o,new Ar(1)]),Zo([new Ar(1),$o])],scalez:["N",Zo([new Ar(1),new Ar(1),$o])],scale3d:["NNN",Qo],skew:["Aa",null,Qo],skewx:["A",null,Zo([$o,Rr])],skewy:["A",null,Zo([Rr,$o])],translate:["Tt",Zo([$o,$o,Mr]),Qo],translatex:["T",Zo([$o,Mr,Mr]),Zo([$o,Mr])],translatey:["T",Zo([Mr,$o,Mr]),Zo([Mr,$o])],translatez:["L",Zo([Mr,Mr,$o])],translate3d:["TTL",Qo]};function ta(t){if("none"!==(t=(t||"none").toLowerCase().trim()))for(var e,n=/\s*(\w+)\(([^)]*)\)/g,r=[],i=0;e=n.exec(t);){if(e.index!==i)return[];var i=e.index+e[0].length,o=e[1],a=Jo[o];if(!a)return[];var s=e[2].split(","),l=a[0];if(l.length<s.length)return[];for(var u=[],c=0;c<l.length;c++){var h=s[c],d=l[c],f=void 0;if(void 0===(f=h?{A:function(t){return"0"===t.trim()?Rr:Po(t)},N:Go,T:Co,L:No}[d.toUpperCase()](h):{a:Rr,n:u[0],t:Mr}[d]))return[];u.push(f)}if(r.push({t:o,d:u}),n.lastIndex===t.length)return r}return[]}function ea(t){switch(t.t){case"rotatex":return i=ti(Oo(t.d[0])),[1,0,0,0,0,Math.cos(i),Math.sin(i),0,0,-Math.sin(i),Math.cos(i),0,0,0,0,1];case"rotatey":return i=ti(Oo(t.d[0])),[Math.cos(i),0,-Math.sin(i),0,0,1,0,0,Math.sin(i),0,Math.cos(i),0,0,0,0,1];case"rotate":case"rotatez":return i=ti(Oo(t.d[0])),[Math.cos(i),Math.sin(i),0,0,-Math.sin(i),Math.cos(i),0,0,0,0,1,0,0,0,0,1];case"rotate3d":var e=t.d[0].value,n=t.d[1].value,r=t.d[2].value,i=ti(Oo(t.d[3])),o=e*e+n*n+r*r,o=(0==o?(e=1,r=n=0):1!=o&&(e/=o=Math.sqrt(o),n/=o,r/=o),Math.sin(i/2)),a=o*Math.cos(i/2),o=o*o;return[1-2*(n*n+r*r)*o,2*(e*n*o+r*a),2*(e*r*o-n*a),0,2*(e*n*o-r*a),1-2*(e*e+r*r)*o,2*(n*r*o+e*a),0,2*(e*r*o+n*a),2*(n*r*o-e*a),1-2*(e*e+n*n)*o,0,0,0,0,1];case"scale":return[t.d[0].value,0,0,0,0,t.d[1].value,0,0,0,0,1,0,0,0,0,1];case"scalex":return[t.d[0].value,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1];case"scaley":return[1,0,0,0,0,t.d[0].value,0,0,0,0,1,0,0,0,0,1];case"scalez":return[1,0,0,0,0,1,0,0,0,0,t.d[0].value,0,0,0,0,1];case"scale3d":return[t.d[0].value,0,0,0,0,t.d[1].value,0,0,0,0,t.d[2].value,0,0,0,0,1];case"skew":a=ti(Oo(t.d[0])),o=ti(Oo(t.d[1]));return[1,Math.tan(o),0,0,Math.tan(a),1,0,0,0,0,1,0,0,0,0,1];case"skewx":return i=ti(Oo(t.d[0])),[1,0,0,0,Math.tan(i),1,0,0,0,0,1,0,0,0,0,1];case"skewy":return i=ti(Oo(t.d[0])),[1,Math.tan(i),0,0,0,1,0,0,0,0,1,0,0,0,0,1];case"translate":return[1,0,0,0,0,1,0,0,0,0,1,0,e=ko(t.d[0],0,null)||0,n=ko(t.d[1],0,null)||0,0,1];case"translatex":return[1,0,0,0,0,1,0,0,0,0,1,0,e=ko(t.d[0],0,null)||0,0,0,1];case"translatey":return[1,0,0,0,0,1,0,0,0,0,1,0,0,n=ko(t.d[0],0,null)||0,0,1];case"translatez":return[1,0,0,0,0,1,0,0,0,0,1,0,0,0,r=ko(t.d[0],0,null)||0,1];case"translate3d":return[1,0,0,0,0,1,0,0,0,0,1,0,e=ko(t.d[0],0,null)||0,n=ko(t.d[1],0,null)||0,r=ko(t.d[2],0,null)||0,1];case"perspective":o=ko(t.d[0],0,null)||0;return[1,0,0,0,0,1,0,0,0,0,1,o?-1/o:0,0,0,0,1];case"matrix":return[t.d[0].value,t.d[1].value,0,0,t.d[2].value,t.d[3].value,0,0,0,0,1,0,t.d[4].value,t.d[5].value,0,1];case"matrix3d":return t.d.map(function(t){return t.value})}}function na(t,e){return[t[0]*e[0]+t[4]*e[1]+t[8]*e[2]+t[12]*e[3],t[1]*e[0]+t[5]*e[1]+t[9]*e[2]+t[13]*e[3],t[2]*e[0]+t[6]*e[1]+t[10]*e[2]+t[14]*e[3],t[3]*e[0]+t[7]*e[1]+t[11]*e[2]+t[15]*e[3],t[0]*e[4]+t[4]*e[5]+t[8]*e[6]+t[12]*e[7],t[1]*e[4]+t[5]*e[5]+t[9]*e[6]+t[13]*e[7],t[2]*e[4]+t[6]*e[5]+t[10]*e[6]+t[14]*e[7],t[3]*e[4]+t[7]*e[5]+t[11]*e[6]+t[15]*e[7],t[0]*e[8]+t[4]*e[9]+t[8]*e[10]+t[12]*e[11],t[1]*e[8]+t[5]*e[9]+t[9]*e[10]+t[13]*e[11],t[2]*e[8]+t[6]*e[9]+t[10]*e[10]+t[14]*e[11],t[3]*e[8]+t[7]*e[9]+t[11]*e[10]+t[15]*e[11],t[0]*e[12]+t[4]*e[13]+t[8]*e[14]+t[12]*e[15],t[1]*e[12]+t[5]*e[13]+t[9]*e[14]+t[13]*e[15],t[2]*e[12]+t[6]*e[13]+t[10]*e[14]+t[14]*e[15],t[3]*e[12]+t[7]*e[13]+t[11]*e[14]+t[15]*e[15]]}function ra(t){var e=[0,0,0],n=[1,1,1],r=[0,0,0],i=[0,0,0,1],o=[0,0,0,1];return ui(0===(t=t).length?[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]:t.map(ea).reduce(na),e,n,r,i,o),[[e,n,r,o,i]]}var ia=function(t,e,n,r,i){for(var o=[[1,0,0,0],[0,1,0,0],[0,0,1,0],[0,0,0,1]],a=0;a<4;a++)o[a][3]=i[a];for(var s=0;s<3;s++)for(var l=0;l<3;l++)o[3][s]+=t[l]*o[l][s];var u=r[0],c=r[1],h=r[2],r=r[3],d=[[1,0,0,0],[0,1,0,0],[0,0,1,0],[0,0,0,1]],h=(d[0][0]=1-2*(c*c+h*h),d[0][1]=2*(u*c-h*r),d[0][2]=2*(u*h+c*r),d[1][0]=2*(u*c+h*r),d[1][1]=1-2*(u*u+h*h),d[1][2]=2*(c*h-u*r),d[2][0]=2*(u*h-c*r),d[2][1]=2*(c*h+u*r),d[2][2]=1-2*(u*u+c*c),o=oa(o,d),[[1,0,0,0],[0,1,0,0],[0,0,1,0],[0,0,0,1]]);n[2]&&(h[2][1]=n[2],o=oa(o,h)),n[1]&&(h[2][1]=0,h[2][0]=n[0],o=oa(o,h)),n[0]&&(h[2][0]=0,h[1][0]=n[0],o=oa(o,h));for(var f=0;f<3;f++)for(var p=0;p<3;p++)o[f][p]*=e[f];return 0==(r=o)[0][2]&&0==r[0][3]&&0==r[1][2]&&0==r[1][3]&&0==r[2][0]&&0==r[2][1]&&1==r[2][2]&&0==r[2][3]&&0==r[3][2]&&1==r[3][3]?[o[0][0],o[0][1],o[1][0],o[1][1],o[3][0],o[3][1]]:o[0].concat(o[1],o[2],o[3])};function oa(t,e){for(var n=[[0,0,0,0],[0,0,0,0],[0,0,0,0],[0,0,0,0]],r=0;r<4;r++)for(var i=0;i<4;i++)for(var o=0;o<4;o++)n[r][i]+=e[r][o]*t[o][i];return n}function aa(t){return t.toFixed(6).replace(".000000","")}function sa(e,n){var r,i;return e.decompositionPair!==n&&(e.decompositionPair=n,r=ra(e)),n.decompositionPair!==e&&(n.decompositionPair=e,i=ra(n)),null===r[0]||null===i[0]?[[!1],[!0],function(t){return(t?n:e)[0].d}]:(r[0].push(0),i[0].push(1),[r,i,function(t){var e=function(t,e,n){var r=function(t,e){for(var n=0,r=0;r<t.length;r++)n+=t[r]*e[r];return n}(t,e),i=(r=Ue(r,-1,1),[]);if(1===r)i=t;else for(var o=Math.acos(r),a=+Math.sin(n*o)/Math.sqrt(1-r*r),s=0;s<4;s++)i.push(t[s]*(Math.cos(n*o)-r*a)+e[s]*a);return i}(r[0][3],i[0][3],t[5]);return ia(t[0],t[1],t[2],e,t[4]).map(aa).join(",")}])}function la(t){return t.replace(/[xy]/,"")}function ua(t){return t.replace(/(x|y|z|3d)?$/,"3d")}var ca=function(t,e){return"perspective"===t&&"perspective"===e||("matrix"===t||"matrix3d"===t)&&("matrix"===e||"matrix3d"===e)};function ha(r,i,t){var e=!1;if(!r.length||!i.length){r.length||(e=!0,r=i,i=[]);for(var o=0;o<r.length;o++)!function(){var t=r[o],e=t.t,t=t.d,n="scale"===e.substring(0,5)?1:0;i.push({t:e,d:t.map(function(t){return"number"==typeof t?kr(n):kr(n,t.unit)})})}()}var n=[],a=[],s=[];if(r.length!==i.length)var l=sa(r,i),n=[l[0]],a=[l[1]],s=[["matrix",[l[2]]]];else for(var u=0;u<r.length;u++){var c=r[u].t,h=i[u].t,d=r[u].d,f=i[u].d,p=Jo[c],g=Jo[h],m=void 0;if(ca(c,h)){var v=sa([r[u]],[i[u]]);n.push(v[0]),a.push(v[1]),s.push(["matrix",[v[2]]])}else{if(c===h)m=c;else if(p[2]&&g[2]&&la(c)===la(h))m=la(c),d=p[2](d),f=g[2](f);else{if(!p[1]||!g[1]||ua(c)!==ua(h)){v=sa(r,i);n=[v[0]],a=[v[1]],s=[["matrix",[v[2]]]];break}m=ua(c),d=p[1](d),f=g[1](f)}for(var y=[],E=[],_=[],b=0;b<d.length;b++){var x=function(t,e,n,r,i){void 0===i&&(i=0);var o="",a=t.value||0,s=e.value||0,l=Tr(t.unit),u=t.convertTo(l),l=e.convertTo(l);return u&&l?(a=u.value,s=l.value,o=pr(t.unit)):(Ar.isLength(t.unit)||Ar.isLength(e.unit))&&(a=ko(t,i,n),s=ko(e,i,n),o="px"),[a,s,function(t){return(t=r?Math.max(t,0):t)+o}]}(d[b],f[b],t,!1,b);y[b]=x[0],E[b]=x[1],_.push(x[2])}n.push(y),a.push(E),s.push([m,_])}}return e&&(l=n,n=a,a=l),[n,a,function(t){return t.map(function(t,n){t=t.map(function(t,e){return s[n][1][e](t)}).join(",");return"matrix"===s[n][0]&&16===t.split(",").length&&(s[n][0]="matrix3d"),"matrix3d"===s[n][0]&&6===t.split(",").length&&(s[n][0]="matrix"),s[n][0]+"("+t+")"}).join(" ")}]}var da=vr(function(t){var e;return Fe(t)?"text-anchor"===t?[kr(0,"px"),kr(0,"px")]:(1===(e=t.split(" ")).length&&("top"===e[0]||"bottom"===e[0]?(e[1]=e[0],e[0]="center"):e[1]="center"),2!==e.length?null:[Co(fa(e[0])),Co(fa(e[1]))]):[kr(t[0]||0,"px"),kr(t[1]||0,"px")]});function fa(t){return"center"===t?"50%":"left"===t||"top"===t?"0":"right"===t||"bottom"===t?"100%":t}var t=function(){function t(){this.parser=Po,this.parserWithCSSDisabled=null,this.mixer=Wo}return t.prototype.calculator=function(t,e,n,r){return Oo(n)},t}(),e=function(){function t(){}return t.prototype.calculator=function(t,e,n,r){return n instanceof mr&&(n=null),ct.sceneGraphService.updateDisplayObjectDependency(t,e,n,r),"clipPath"===t&&r.forEach(function(t){0===t.childNodes.length&&ct.sceneGraphService.dirtifyToRoot(t)}),n},t}(),n=function(){function t(){this.parser=Ao,this.parserWithCSSDisabled=Ao,this.mixer=Mo}return t.prototype.calculator=function(t,e,n,r){return n instanceof mr?"none"===n.value?Or:Ir:n},t}(),pa=function(){function t(){this.parser=Fo}return t.prototype.calculator=function(t,e,n){return n instanceof mr?[]:n},t}();function ga(t){t=t.parsedStyle.fontSize;return M(t)?null:t}function ma(){this.parser=da}var va,ya=function(){function t(){this.parser=Co,this.parserWithCSSDisabled=null,this.mixer=Wo}return t.prototype.calculator=function(t,e,n,r,i){if(B(n))return n;if(!Ar.isRelativeUnit(n.unit))return n.value;if(n.unit===p.kPercentage)return 0;if(n.unit===p.kEms){if(r.parentNode){var o=ga(r.parentNode);if(o)return o*=n.value}return i.addUnresolveProperty(r,t),0}if(n.unit===p.kRems){if(null!=r&&null!=(o=r.ownerDocument)&&o.documentElement){o=ga(r.ownerDocument.documentElement);if(o)return o*=n.value}return i.addUnresolveProperty(r,t),0}},t}(),Ea=function(){function t(){this.mixer=jo}var e=t.prototype;return e.parser=function(t){t=Lo(B(t)?[t]:t),t=1===t.length?[t[0],t[0]]:[t[0],t[1]];return t},e.calculator=function(t,e,n){return n.map(function(t){return t.value})},t}(),_a=function(){function t(){this.mixer=jo}var e=t.prototype;return e.parser=function(t){t=Lo(B(t)?[t]:t),t=1===t.length?[t[0],t[0],t[0],t[0]]:2===t.length?[t[0],t[1],t[0],t[1]]:3===t.length?[t[0],t[1],t[2],t[1]]:[t[0],t[1],t[2],t[3]];return t},e.calculator=function(t,e,n){return n.map(function(t){return t.value})},t}(),ba=function(t){function e(){return t.apply(this,arguments)||this}return er(e,t),e.prototype.postProcessor=function(t,e){var n,r;switch(t.nodeName){case lt.CIRCLE:case lt.ELLIPSE:var i=t.parsedStyle,o=i.cx,a=i.cy,i=i.cz;M(o)||(l=o),M(a)||(u=a),M(i)||(c=i);break;case lt.LINE:var o=t.parsedStyle,a=o.x1,i=o.x2,s=o.y1,o=o.y2,l=Math.min(a,i),u=Math.min(s,o),c=0;break;case lt.RECT:case lt.IMAGE:case lt.GROUP:case lt.HTML:case lt.TEXT:case lt.MESH:M(t.parsedStyle.x)||(l=t.parsedStyle.x),M(t.parsedStyle.y)||(u=t.parsedStyle.y),M(t.parsedStyle.z)||(c=t.parsedStyle.z)}t.nodeName!==lt.PATH&&t.nodeName!==lt.POLYLINE&&t.nodeName!==lt.POLYGON&&(t.parsedStyle.defX=l||0,t.parsedStyle.defY=u||0),M(l)&&M(u)&&M(c)||-1!==e.indexOf("transform")||((e=t.parsedStyle.transform)&&e.length?di(e,t):(n=(e=t.getLocalPosition())[0],r=e[1],e=e[2],t.setLocalPosition(M(l)?n:l,M(u)?r:u,M(c)?e:c)))},e}(ya),xa=function(){function t(){}return t.prototype.calculator=function(t,e,n,r){n=null==(n=n=n instanceof mr?null:n)?void 0:n.cloneNode(!0);return n&&(n.style.isMarker=!0),n},t}(),Sa=function(){function t(){this.mixer=Wo,this.parser=Go,this.parserWithCSSDisabled=null}return t.prototype.calculator=function(t,e,n){return n.value},t}(),r=function(){function t(){this.parser=Go,this.parserWithCSSDisabled=null,this.mixer=Vo(0,1)}var e=t.prototype;return e.calculator=function(t,e,n){return n.value},e.postProcessor=function(t){var e,n=t.parsedStyle,r=n.offsetPath,n=n.offsetDistance;!r||(e=r.nodeName)!==lt.LINE&&e!==lt.PATH&&e!==lt.POLYLINE||(e=r.getPoint(n))&&(t.parsedStyle.defX=e.x,t.parsedStyle.defY=e.y,t.setLocalPosition(e.x,e.y))},t}(),wa=function(){function t(){this.parser=Go,this.parserWithCSSDisabled=null,this.mixer=Vo(0,1)}return t.prototype.calculator=function(t,e,n){return n.value},t}(),Ta=function(){function m(){this.center=[0,0,0],this.halfExtents=[0,0,0],this.min=[0,0,0],this.max=[0,0,0]}m.isEmpty=function(t){return!t||0===t.halfExtents[0]&&0===t.halfExtents[1]&&0===t.halfExtents[2]};var t=m.prototype;return t.update=function(t,e){Kr(this.center,t),Kr(this.halfExtents,e),qr(this.min,this.center,this.halfExtents),$r(this.max,this.center,this.halfExtents)},t.setMinMax=function(t,e){$r(this.center,e,t),Zr(this.center,this.center,.5),qr(this.halfExtents,e,t),Zr(this.halfExtents,this.halfExtents,.5),Kr(this.min,t),Kr(this.max,e)},t.getMin=function(){return this.min},t.getMax=function(){return this.max},t.add=function(t){var e,n,r,i,o,a,s,l,u,c,h,d,f,p,g;m.isEmpty(t)||(m.isEmpty(this)?this.setMinMax(t.getMin(),t.getMax()):(n=(e=this.center)[0],p=e[1],o=e[2],i=(r=this.halfExtents)[0],h=r[1],a=r[2],l=(d=t.center)[0],g=d[1],d=d[2],u=(t=t.halfExtents)[0],(f=g-(c=t[1]))<(s=p-h)&&(s=f),(f=p+h)<(p=g+c)&&(f=p),(g=d-(h=t[2]))<(c=o-a)&&(c=g),(p=o+a)<(t=d+h)&&(p=t),e[0]=.5*((o=(g=l-u)<(o=n-i)?g:o)+(a=(a=n+i)<(d=l+u)?d:a)),e[1]=.5*(s+f),e[2]=.5*(c+p),r[0]=.5*(a-o),r[1]=.5*(f-s),r[2]=.5*(p-c),this.min[0]=o,this.min[1]=s,this.min[2]=c,this.max[0]=a,this.max[1]=f,this.max[2]=p))},t.setFromTransformedAABB=function(t,e){var n=this.center,r=this.halfExtents,i=t.center,t=t.halfExtents,o=e[0],a=e[4],s=e[8],l=e[1],u=e[5],c=e[9],h=e[2],d=e[6],f=e[10],p=Math.abs(o),g=Math.abs(a),m=Math.abs(s),v=Math.abs(l),y=Math.abs(u),E=Math.abs(c),_=Math.abs(h),b=Math.abs(d),x=Math.abs(f);n[0]=e[12]+o*i[0]+a*i[1]+s*i[2],n[1]=e[13]+l*i[0]+u*i[1]+c*i[2],n[2]=e[14]+h*i[0]+d*i[1]+f*i[2],r[0]=p*t[0]+g*t[1]+m*t[2],r[1]=v*t[0]+y*t[1]+E*t[2],r[2]=_*t[0]+b*t[1]+x*t[2],qr(this.min,n,r),$r(this.max,n,r)},t.intersects=function(t){var e=this.getMax(),n=this.getMin(),r=t.getMax(),t=t.getMin();return n[0]<=r[0]&&e[0]>=t[0]&&n[1]<=r[1]&&e[1]>=t[1]&&n[2]<=r[2]&&e[2]>=t[2]},t.intersection=function(t){var e,n,r,i;return this.intersects(t)?(e=new m,i=[0,0,0],n=this.getMin(),r=t.getMin(),i[0]=Math.max(n[0],r[0]),i[1]=Math.max(n[1],r[1]),i[2]=Math.max(n[2],r[2]),n=i,r=[0,0,0],i=this.getMax(),t=t.getMax(),r[0]=Math.min(i[0],t[0]),r[1]=Math.min(i[1],t[1]),r[2]=Math.min(i[2],t[2]),e.setMinMax(n,r),e):null},t.getNegativeFarPoint=function(t){return 273===t.pnVertexFlag?Kr([0,0,0],this.min):272===t.pnVertexFlag?[this.min[0],this.min[1],this.max[2]]:257===t.pnVertexFlag?[this.min[0],this.max[1],this.min[2]]:256===t.pnVertexFlag?[this.min[0],this.max[1],this.max[2]]:17===t.pnVertexFlag?[this.max[0],this.min[1],this.min[2]]:16===t.pnVertexFlag?[this.max[0],this.min[1],this.max[2]]:1===t.pnVertexFlag?[this.max[0],this.max[1],this.min[2]]:[this.max[0],this.max[1],this.max[2]]},t.getPositiveFarPoint=function(t){return 273===t.pnVertexFlag?Kr([0,0,0],this.max):272===t.pnVertexFlag?[this.max[0],this.max[1],this.min[2]]:257===t.pnVertexFlag?[this.max[0],this.min[1],this.max[2]]:256===t.pnVertexFlag?[this.max[0],this.min[1],this.min[2]]:17===t.pnVertexFlag?[this.min[0],this.max[1],this.max[2]]:16===t.pnVertexFlag?[this.min[0],this.max[1],this.min[2]]:1===t.pnVertexFlag?[this.min[0],this.min[1],this.max[2]]:[this.min[0],this.min[1],this.min[2]]},m}(),Aa=function(){function t(t,e){this.distance=void 0,this.normal=void 0,this.pnVertexFlag=void 0,this.distance=t||0,this.normal=e||x(0,1,0),this.updatePNVertexFlag()}var e=t.prototype;return e.updatePNVertexFlag=function(){this.pnVertexFlag=(Number(0<=this.normal[0])<<8)+(Number(0<=this.normal[1])<<4)+Number(0<=this.normal[2])},e.distanceToPoint=function(t){return Lt(t,this.normal)-this.distance},e.normalize=function(){var t=1/Wt(this.normal);Ot(this.normal,this.normal,t),this.distance*=t},e.intersectsLine=function(t,e,n){var r=this.distanceToPoint(t),r=r/(r-this.distanceToPoint(e)),i=0<=r&&r<=1;return i&&n&&Dt(n,t,e,r),i},t}(),Ma=((Ca=va=va||{})[Ca.OUTSIDE=4294967295]="OUTSIDE",Ca[Ca.INSIDE=0]="INSIDE",Ca[Ca.INDETERMINATE=2147483647]="INDETERMINATE",function(){function t(t){if(this.planes=[],t)this.planes=t;else for(var e=0;e<6;e++)this.planes.push(new Aa)}return t.prototype.extractFromVPMatrix=function(t){var e=t[0],n=t[1],r=t[2],i=t[3],o=t[4],a=t[5],s=t[6],l=t[7],u=t[8],c=t[9],h=t[10],d=t[11],f=t[12],p=t[13],g=t[14],t=t[15];Nt(this.planes[0].normal,i-e,l-o,d-u),this.planes[0].distance=t-f,Nt(this.planes[1].normal,i+e,l+o,d+u),this.planes[1].distance=t+f,Nt(this.planes[2].normal,i+n,l+a,d+c),this.planes[2].distance=t+p,Nt(this.planes[3].normal,i-n,l-a,d-c),this.planes[3].distance=t-p,Nt(this.planes[4].normal,i-r,l-s,d-h),this.planes[4].distance=t-g,Nt(this.planes[5].normal,i+r,l+s,d+h),this.planes[5].distance=t+g,this.planes.forEach(function(t){t.normalize(),t.updatePNVertexFlag()})},t}()),Ra=function(){function t(t,e){void 0===t&&(t=0),void 0===e&&(e=0),this.x=0,this.y=0,this.x=t,this.y=e}var e=t.prototype;return e.clone=function(){return new t(this.x,this.y)},e.copyFrom=function(t){this.x=t.x,this.y=t.y},t}(),Na=function(){function t(t,e,n,r){this.x=void 0,this.y=void 0,this.width=void 0,this.height=void 0,this.left=void 0,this.right=void 0,this.top=void 0,this.bottom=void 0,this.x=t,this.y=e,this.width=n,this.height=r,this.left=t,this.right=t+n,this.top=e,this.bottom=e+r}return t.prototype.toJSON=function(){},t}(),Ca=function(){function t(){this.parser=Xo,this.parserWithCSSDisabled=Xo,this.mixer=Yo}var e=t.prototype;return e.calculator=function(t,e,n){return n instanceof mr&&"unset"===n.value?{absolutePath:[],hasArc:!1,segments:[],polygons:[],polylines:[],curve:null,totalLength:0,rect:new Na(0,0,0,0)}:n},e.postProcessor=function(t,e){var n;t.nodeName===lt.PATH&&-1===e.indexOf("transform")&&(n=(e=t.parsedStyle).defX,e=e.defY,t.setLocalPosition(void 0===n?0:n,void 0===e?0:e))},t}(),Pa=function(){function t(){this.parser=Ko,this.mixer=qo}return t.prototype.postProcessor=function(t,e){var n;t.nodeName!==lt.POLYGON&&t.nodeName!==lt.POLYLINE||-1!==e.indexOf("transform")||(n=(e=t.parsedStyle).defX,e=e.defY,t.setLocalPosition(n,e))},t}(),Oa=function(i){function t(){for(var t,e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];return(t=i.call.apply(i,[this].concat(n))||this).mixer=Vo(0,1/0),t}return er(t,i),t}(ya),Ia=function(){function t(){}var e=t.prototype;return e.calculator=function(t,e,n,r){return n instanceof mr?"unset"===n.value?"":n.value:""+n},e.postProcessor=function(t){t.nodeValue=""+t.parsedStyle.text||""},t}(),La=function(){function t(){}return t.prototype.calculator=function(t,e,n,r){var i,o=r.getAttribute("text");return o&&(i=o,"capitalize"===n.value?i=o.charAt(0).toUpperCase()+o.slice(1):"lowercase"===n.value?i=o.toLowerCase():"uppercase"===n.value&&(i=o.toUpperCase()),r.parsedStyle.text=i),n.value},t}(),ka=function(){function t(){this.parser=ta,this.parserWithCSSDisabled=ta,this.mixer=ha}var e=t.prototype;return e.calculator=function(t,e,n,r){return n instanceof mr?[]:n},e.postProcessor=function(t){di(t.parsedStyle.transform,t)},t}(),Da=function(){function t(){this.parser=Go}var e=t.prototype;return e.calculator=function(t,e,n,r){return n.value},e.postProcessor=function(t){var e;t.parentNode&&(e=(t=t.parentNode).renderable,t=t.sortable,e&&(e.dirty=!0),t)&&(t.dirty=!0)},t}(),Ba=function(){function t(){this.registry={},this.define(lt.CIRCLE,ls),this.define(lt.ELLIPSE,hs),this.define(lt.RECT,Rs),this.define(lt.IMAGE,vs),this.define(lt.LINE,Es),this.define(lt.GROUP,fs),this.define(lt.PATH,xs),this.define(lt.POLYGON,ws),this.define(lt.POLYLINE,As),this.define(lt.TEXT,Cs),this.define(lt.HTML,gs)}var e=t.prototype;return e.define=function(t,e){this.registry[t]=e},e.get=function(t){return this.registry[t]},t}();var Fa,v,Ua=function(){function e(t){this.type=void 0,this.eventPhase=e.prototype.NONE,this.target=void 0,this.bubbles=!0,this.cancelBubble=!0,this.cancelable=!1,this.currentTarget=void 0,this.defaultPrevented=!1,this.timeStamp=void 0,this.nativeEvent=void 0,this.originalEvent=void 0,this.propagationStopped=!1,this.propagationImmediatelyStopped=!1,this.manager=void 0,this.detail=void 0,this.layer=new Ra,this.page=new Ra,this.canvas=new Ra,this.viewport=new Ra,this.path=void 0,this.view=void 0,this.which=void 0,this.returnValue=void 0,this.srcElement=void 0,this.composed=!1,this.isTrusted=void 0,this.NONE=0,this.CAPTURING_PHASE=1,this.AT_TARGET=2,this.BUBBLING_PHASE=3,this.manager=t}var t=e.prototype;return t.composedPath=function(){return!this.manager||this.path&&this.path[0]===this.target||(this.path=this.target?this.manager.propagationPath(this.target):[]),this.path},t.preventDefault=function(){this.nativeEvent instanceof Event&&this.nativeEvent.cancelable&&this.nativeEvent.preventDefault(),this.defaultPrevented=!0},t.stopImmediatePropagation=function(){this.propagationImmediatelyStopped=!0},t.stopPropagation=function(){this.propagationStopped=!0},t.initEvent=function(){},t.initUIEvent=function(){},t.clone=function(){throw new Error(Hr)},tr(e,[{key:"name",get:function(){return this.type}},{key:"layerX",get:function(){return this.layer.x}},{key:"layerY",get:function(){return this.layer.y}},{key:"pageX",get:function(){return this.page.x}},{key:"pageY",get:function(){return this.page.y}},{key:"x",get:function(){return this.canvas.x}},{key:"y",get:function(){return this.canvas.y}},{key:"canvasX",get:function(){return this.canvas.x}},{key:"canvasY",get:function(){return this.canvas.y}},{key:"viewportX",get:function(){return this.viewport.x}},{key:"viewportY",get:function(){return this.viewport.y}},{key:"propagationPath",get:function(){return this.composedPath()}}]),e}(),Ga=function(r){function t(t,e){var n=r.call(this,null)||this;return n.type=t,n.detail=e,Object.assign(ir(n),e),n}return er(t,r),t}(Ua),i=function(){function t(){this.emitter=new qn}var e=t.prototype;return e.on=function(t,e,n){return this.addEventListener(t,e,n),this},e.addEventListener=function(t,e,n){var r,i,o,a=Ve(n)&&n||Ie(n)&&n.capture,n=Ie(n)&&n.once,s=_r(e)?void 0:e,l=!1,u="";return-1<t.indexOf(":")&&(i=(r=t.split(":"))[0],t=r[1],u=i,l=!0),t=a?t+"capture":t,e=_r(e)?e:e.handleEvent,l&&(o=e,e=function(){for(var t,e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];(null==(t=n[0].target)?void 0:t.name)===u&&o.apply(void 0,n)}),n?this.emitter.once(t,e,s):this.emitter.on(t,e,s),this},e.off=function(t,e,n){return t?this.removeEventListener(t,e,n):this.removeAllEventListeners(),this},e.removeAllEventListeners=function(){this.emitter.removeAllListeners()},e.removeEventListener=function(t,e,n){var r,n=Ve(n)&&n||Ie(n)&&n.capture,i=_r(e)?void 0:e;return e=_r(e)?e:null==(r=e)?void 0:r.handleEvent,this.emitter.off(t=n?t+"capture":t,e,i),this},e.emit=function(t,e){this.dispatchEvent(new Ga(t,e))},e.dispatchEvent=function(t,e){if(void 0===e&&(e=!1),!t.type)throw new Error("DisplayObject cannot propagate events outside of the Federated Events API");var n;if(n=this.document?this:this.defaultView||(null==(n=this.ownerDocument)?void 0:n.defaultView)){if(t.manager=n.getEventService()||null,!t.manager)return!1;t.defaultPrevented=!1,t.path=[],e||(t.target=this),null!=(n=t.manager)&&n.dispatchEvent(t,t.type,e)}return!t.defaultPrevented},t}(),Wa=function(i){function f(){for(var t,e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];return(t=i.call.apply(i,[this].concat(n))||this).shadow=!1,t.ownerDocument=null,t.isConnected=!1,t.baseURI="",t.childNodes=[],t.nodeType=0,t.nodeName="",t.nodeValue=null,t.parentNode=null,t}er(f,i),f.isNode=function(t){return!!t.childNodes};var t=f.prototype;return t.getRootNode=function(t){return void 0===t&&(t={}),this.parentNode?this.parentNode.getRootNode(t):t.composed&&this.host?this.host.getRootNode(t):this},t.hasChildNodes=function(){return 0<this.childNodes.length},t.isDefaultNamespace=function(t){throw new Error(Hr)},t.lookupNamespaceURI=function(t){throw new Error(Hr)},t.lookupPrefix=function(t){throw new Error(Hr)},t.normalize=function(){throw new Error(Hr)},t.isEqualNode=function(t){return this===t},t.isSameNode=function(t){return this.isEqualNode(t)},t.compareDocumentPosition=function(t){if(t===this)return 0;for(var e=[i=t],n=[o=this];null!=(r=i.parentNode)?r:o.parentNode;)var r,i=i.parentNode?(e.push(i.parentNode),i.parentNode):i,o=o.parentNode?(n.push(o.parentNode),o.parentNode):o;if(i!==o)return f.DOCUMENT_POSITION_DISCONNECTED|f.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC|f.DOCUMENT_POSITION_PRECEDING;var a=n.length<e.length?e:n,s=a===e?n:e;if(a[a.length-s.length]===s[0])return a===e?f.DOCUMENT_POSITION_CONTAINED_BY|f.DOCUMENT_POSITION_FOLLOWING:f.DOCUMENT_POSITION_CONTAINS|f.DOCUMENT_POSITION_PRECEDING;for(var l=a.length-s.length,u=s.length-1;0<=u;u--){var c,h=s[u],d=a[l+u];if(d!==h)return(c=h.parentNode.childNodes).indexOf(h)<c.indexOf(d)?s===e?f.DOCUMENT_POSITION_PRECEDING:f.DOCUMENT_POSITION_FOLLOWING:a===e?f.DOCUMENT_POSITION_PRECEDING:f.DOCUMENT_POSITION_FOLLOWING}return f.DOCUMENT_POSITION_FOLLOWING},t.contain=function(t){return this.contains(t)},t.contains=function(t){for(var e=t;e&&this!==e;)e=e.parentNode;return!!e},t.getAncestor=function(t){for(var e=this;0<t&&e;)e=e.parentNode,t--;return e},t.forEach=function(e,t){void 0===t&&(t=!1),e(this)||(t?this.childNodes.slice():this.childNodes).forEach(function(t){t.forEach(e)})},tr(f,[{key:"textContent",get:function(){var t="";this.nodeName===lt.TEXT&&(t+=this.style.text);for(var e=ar(this.childNodes);!(n=e()).done;){var n=n.value;n.nodeName===lt.TEXT?t+=n.nodeValue:t+=n.textContent}return t},set:function(t){var e=this;this.childNodes.slice().forEach(function(t){e.removeChild(t)}),this.nodeName===lt.TEXT&&(this.style.text=""+t)}},{key:"parent",get:function(){return this.parentNode}},{key:"parentElement",get:function(){return null}},{key:"nextSibling",get:function(){return null}},{key:"previousSibling",get:function(){return null}},{key:"firstChild",get:function(){return 0<this.childNodes.length?this.childNodes[0]:null}},{key:"lastChild",get:function(){return 0<this.childNodes.length?this.childNodes[this.childNodes.length-1]:null}}]),f}(i),Va=(Wa.DOCUMENT_POSITION_DISCONNECTED=1,Wa.DOCUMENT_POSITION_PRECEDING=2,Wa.DOCUMENT_POSITION_FOLLOWING=4,Wa.DOCUMENT_POSITION_CONTAINS=8,Wa.DOCUMENT_POSITION_CONTAINED_BY=16,Wa.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC=32,function(e){function t(){var t=e.call(this)||this;t.defaultView=null,t.documentElement=void 0,t.timeline=void 0,t.ownerDocument=null,t.nodeName="document";try{t.timeline=new ct.AnimationTimeline(ir(t))}catch(t){}var r={};return Ps.forEach(function(t){var e=t.n,n=t.inh,t=t.d;n&&t&&(r[e]=_r(t)?t(lt.GROUP):t)}),t.documentElement=new fs({id:"g-root",style:r}),t.documentElement.ownerDocument=ir(t),t.documentElement.parentNode=ir(t),t.childNodes=[t.documentElement],t}er(t,e);var n=t.prototype;return n.createElement=function(t,e){var n;return"svg"===t?this.documentElement:((n=this.defaultView.customElements.get(t))||(console.warn("Unsupported tagName: ",t),n="tspan"===t?Cs:fs),(t=new n(e)).ownerDocument=this,t)},n.createElementNS=function(t,e,n){return this.createElement(e,n)},n.cloneNode=function(t){throw new Error(Hr)},n.destroy=function(){try{this.documentElement.destroyChildren(),this.timeline.destroy()}catch(t){}},n.elementsFromBBox=function(t,e,n,r){var t=this.defaultView.context.rBushRoot.search({minX:t,minY:e,maxX:n,maxY:r}),i=[];return t.forEach(function(t){var t=t.displayObject,e=t.parsedStyle.pointerEvents,e=["auto","visiblepainted","visiblefill","visiblestroke","visible"].includes(e);e&&!t.isVisible()||t.isCulled()||!t.isInteractive()||i.push(t)}),i.sort(function(t,e){return e.sortable.renderOrder-t.sortable.renderOrder}),i},n.elementFromPointSync=function(t,e){var n=this.defaultView.canvas2Viewport({x:t,y:e}),r=n.x,n=n.y,i=this.defaultView.getConfig(),o=i.width,i=i.height;return r<0||n<0||o<r||i<n?null:(i=(o=this.defaultView.viewport2Client({x:r,y:n})).x,o=o.y,(t=this.defaultView.getRenderingService().hooks.pickSync.call({topmost:!0,position:{x:t,y:e,viewportX:r,viewportY:n,clientX:i,clientY:o},picked:[]}).picked)&&t[0]||this.documentElement)},n.elementFromPoint=function(){var n=Qn($n().mark(function t(e,n){var r,i,o,a,s,l;return $n().wrap(function(t){for(;;)switch(t.prev=t.next){case 0:if(i=this.defaultView.canvas2Viewport({x:e,y:n}),r=i.x,i=i.y,a=this.defaultView.getConfig(),o=a.width,a=a.height,r<0||i<0||o<r||a<i)return t.abrupt("return",null);t.next=4;break;case 4:return o=this.defaultView.viewport2Client({x:r,y:i}),a=o.x,s=o.y,t.next=7,this.defaultView.getRenderingService().hooks.pick.promise({topmost:!0,position:{x:e,y:n,viewportX:r,viewportY:i,clientX:a,clientY:s},picked:[]});case 7:return s=t.sent,l=s.picked,t.abrupt("return",l&&l[0]||this.documentElement);case 10:case"end":return t.stop()}},t,this)}));return function(t,e){return n.apply(this,arguments)}}(),n.elementsFromPointSync=function(t,e){var n=this.defaultView.canvas2Viewport({x:t,y:e}),r=n.x,n=n.y,i=this.defaultView.getConfig(),o=i.width,i=i.height;return r<0||n<0||o<r||i<n?[]:(i=(o=this.defaultView.viewport2Client({x:r,y:n})).x,o=o.y,(t=this.defaultView.getRenderingService().hooks.pickSync.call({topmost:!1,position:{x:t,y:e,viewportX:r,viewportY:n,clientX:i,clientY:o},picked:[]}).picked)[t.length-1]!==this.documentElement&&t.push(this.documentElement),t)},n.elementsFromPoint=function(){var n=Qn($n().mark(function t(e,n){var r,i,o,a,s,l;return $n().wrap(function(t){for(;;)switch(t.prev=t.next){case 0:if(i=this.defaultView.canvas2Viewport({x:e,y:n}),r=i.x,i=i.y,a=this.defaultView.getConfig(),o=a.width,a=a.height,r<0||i<0||o<r||a<i)return t.abrupt("return",[]);t.next=4;break;case 4:return o=this.defaultView.viewport2Client({x:r,y:i}),a=o.x,s=o.y,t.next=7,this.defaultView.getRenderingService().hooks.pick.promise({topmost:!1,position:{x:e,y:n,viewportX:r,viewportY:i,clientX:a,clientY:s},picked:[]});case 7:return s=t.sent,(l=s.picked)[l.length-1]!==this.documentElement&&l.push(this.documentElement),t.abrupt("return",l);case 11:case"end":return t.stop()}},t,this)}));return function(t,e){return n.apply(this,arguments)}}(),n.appendChild=function(t,e){throw new Error(Xr)},n.insertBefore=function(t,e){throw new Error(Xr)},n.removeChild=function(t,e){throw new Error(Xr)},n.replaceChild=function(t,e,n){throw new Error(Xr)},n.append=function(){throw new Error(Xr)},n.prepend=function(){throw new Error(Xr)},n.getElementById=function(t){return this.documentElement.getElementById(t)},n.getElementsByName=function(t){return this.documentElement.getElementsByName(t)},n.getElementsByTagName=function(t){return this.documentElement.getElementsByTagName(t)},n.getElementsByClassName=function(t){return this.documentElement.getElementsByClassName(t)},n.querySelector=function(t){return this.documentElement.querySelector(t)},n.querySelectorAll=function(t){return this.documentElement.querySelectorAll(t)},n.find=function(t){return this.documentElement.find(t)},n.findAll=function(t){return this.documentElement.findAll(t)},tr(t,[{key:"children",get:function(){return this.childNodes}},{key:"childElementCount",get:function(){return this.childNodes.length}},{key:"firstElementChild",get:function(){return this.firstChild}},{key:"lastElementChild",get:function(){return this.lastChild}}]),t}(Wa)),ja=(Fa=Fa||{},Fa[Fa.Standard=0]="Standard",(qa=v=v||{}).REPARENT="reparent",qa.DESTROY="destroy",qa.ATTR_MODIFIED="DOMAttrModified",qa.INSERTED="DOMNodeInserted",qa.REMOVED="removed",qa.MOUNTED="DOMNodeInsertedIntoDocument",qa.UNMOUNTED="DOMNodeRemovedFromDocument",qa.BOUNDS_CHANGED="bounds-changed",qa.RENDER_ORDER_CHANGED="render-order-changed",qa.CULLED="culled",function(u){function t(t,e,n,r,i,o,a,s){var l=u.call(this,null)||this;return l.relatedNode=void 0,l.prevValue=void 0,l.newValue=void 0,l.attrName=void 0,l.attrChange=void 0,l.prevParsedValue=void 0,l.newParsedValue=void 0,l.relatedNode=e,l.prevValue=n,l.newValue=r,l.attrName=i,l.attrChange=o,l.prevParsedValue=a,l.newParsedValue=s,l.type=t,l}return er(t,u),t}(Ua)),za=(ja.ADDITION=2,ja.MODIFICATION=1,ja.REMOVAL=3,0),Ha=new ja(v.INSERTED,null,"","","",0,"",""),Xa=new ja(v.REMOVED,null,"","","",0,"",""),Ya=new Ga(v.DESTROY),Ka=function(i){function t(){for(var t,e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];return(t=i.call.apply(i,[this].concat(n))||this).entity=za++,t.renderable={bounds:void 0,boundsDirty:!0,renderBounds:void 0,renderBoundsDirty:!0,dirtyRenderBounds:void 0,dirty:!1,proxyNodeName:void 0},t.cullable={strategy:Fa.Standard,visibilityPlaneMask:-1,visible:!0,enable:!0},t.transformable={dirtyFlag:!1,localDirtyFlag:!1,frozen:!1,localPosition:[0,0,0],localRotation:[0,0,0,1],localScale:[1,1,1],localTransform:[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],localSkew:[0,0],position:[0,0,0],rotation:[0,0,0,1],scaling:[1,1,1],worldTransform:[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],origin:[0,0,0]},t.sortable={dirty:!1,sorted:void 0,lastSortedIndex:void 0,renderOrder:0},t.geometry={contentBounds:void 0,renderBounds:void 0},t.rBushNode={aabb:void 0},t.id=void 0,t.name=void 0,t.namespaceURI="g",t.scrollLeft=0,t.scrollTop=0,t.clientTop=0,t.clientLeft=0,t.destroyed=!1,t.style={},t.computedStyle=ct.enableCSSParsing?{anchor:Cr,opacity:Cr,fillOpacity:Cr,strokeOpacity:Cr,fill:Cr,stroke:Cr,transform:Cr,transformOrigin:Cr,visibility:Cr,pointerEvents:Cr,lineWidth:Cr,lineCap:Cr,lineJoin:Cr,increasedLineWidthForHitTesting:Cr,fontSize:Cr,fontFamily:Cr,fontStyle:Cr,fontWeight:Cr,fontVariant:Cr,textAlign:Cr,textBaseline:Cr,textTransform:Cr,zIndex:Cr,filter:Cr,shadowType:Cr}:null,t.parsedStyle={},t.attributes={},t}er(t,i),t.isElement=function(t){return!!t.getAttribute};var e=t.prototype;return e.cloneNode=function(t){throw new Error(Hr)},e.appendChild=function(t,e){if(t.destroyed)throw new Error("Cannot append a destroyed element.");return ct.sceneGraphService.attach(t,this,e),null!=(e=this.ownerDocument)&&e.defaultView&&this.ownerDocument.defaultView.mountChildren(t),Ha.relatedNode=this,t.dispatchEvent(Ha),t},e.insertBefore=function(t,e){return e?(e=this.childNodes.indexOf(e),this.appendChild(t,e-1)):this.appendChild(t),t},e.replaceChild=function(t,e){var n=this.childNodes.indexOf(e);return this.removeChild(e),this.appendChild(t,n),e},e.removeChild=function(t){var e;return Xa.relatedNode=this,t.dispatchEvent(Xa),null!=(e=t.ownerDocument)&&e.defaultView&&t.ownerDocument.defaultView.unmountChildren(t),ct.sceneGraphService.detach(t),t},e.removeChildren=function(){for(var t=this.childNodes.length-1;0<=t;t--){var e=this.childNodes[t];this.removeChild(e)}},e.destroyChildren=function(){for(var t=this.childNodes.length-1;0<=t;t--){var e=this.childNodes[t];e.childNodes.length&&e.destroyChildren(),e.destroy()}},e.matches=function(t){return ct.sceneGraphService.matches(t,this)},e.getElementById=function(t){return ct.sceneGraphService.querySelector("#"+t,this)},e.getElementsByName=function(t){return ct.sceneGraphService.querySelectorAll('[name="'+t+'"]',this)},e.getElementsByClassName=function(t){return ct.sceneGraphService.querySelectorAll("."+t,this)},e.getElementsByTagName=function(t){return ct.sceneGraphService.querySelectorAll(t,this)},e.querySelector=function(t){return ct.sceneGraphService.querySelector(t,this)},e.querySelectorAll=function(t){return ct.sceneGraphService.querySelectorAll(t,this)},e.closest=function(t){var e=this;do{if(ct.sceneGraphService.matches(t,e))return e}while(null!==(e=e.parentElement));return null},e.find=function(e){var n=this,r=null;return this.forEach(function(t){return!(t===n||!e(t)||(r=t,0))}),r},e.findAll=function(e){var n=this,r=[];return this.forEach(function(t){t!==n&&e(t)&&r.push(t)}),r},e.after=function(){var r=this;if(this.parentNode){for(var i=this.parentNode.childNodes.indexOf(this),t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];e.forEach(function(t,e){var n;return null==(n=r.parentNode)?void 0:n.appendChild(t,i+e+1)})}},e.before=function(){if(this.parentNode){for(var t=this.parentNode.childNodes.indexOf(this),e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];var i=n[0],o=n.slice(1);this.parentNode.appendChild(i,t),i.after.apply(i,o)}},e.replaceWith=function(){this.after.apply(this,arguments),this.remove()},e.append=function(){for(var e=this,t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];n.forEach(function(t){return e.appendChild(t)})},e.prepend=function(){for(var n=this,t=arguments.length,e=new Array(t),r=0;r<t;r++)e[r]=arguments[r];e.forEach(function(t,e){return n.appendChild(t,e)})},e.replaceChildren=function(){for(;this.childNodes.length&&this.firstChild;)this.removeChild(this.firstChild);this.append.apply(this,arguments)},e.remove=function(){return this.parentNode?this.parentNode.removeChild(this):this},e.destroy=function(){this.dispatchEvent(Ya),this.remove(),this.emitter.removeAllListeners(),this.destroyed=!0},e.getGeometryBounds=function(){return ct.sceneGraphService.getGeometryBounds(this)},e.getRenderBounds=function(){return ct.sceneGraphService.getBounds(this,!0)},e.getBounds=function(){return ct.sceneGraphService.getBounds(this)},e.getLocalBounds=function(){return ct.sceneGraphService.getLocalBounds(this)},e.getBoundingClientRect=function(){return ct.sceneGraphService.getBoundingClientRect(this)},e.getClientRects=function(){return[this.getBoundingClientRect()]},e.computedStyleMap=function(){return new Map(Object.entries(this.computedStyle))},e.getAttributeNames=function(){return Object.keys(this.attributes)},e.getAttribute=function(t){var e;return"symbol"==typeof t?ct.enableCSSParsing?null:void 0:void 0===(e=this.attributes[t])&&(t=wr(t),e=this.attributes[t],ct.enableCSSParsing)&&M(e)?null:e},e.hasAttribute=function(t){return this.getAttributeNames().includes(t)},e.hasAttributes=function(){return!!this.getAttributeNames().length},e.removeAttribute=function(t){this.setAttribute(t,null),delete this.attributes[t]},e.setAttribute=function(t,e,n){this.attributes[t]=e},e.getAttributeNS=function(t,e){throw new Error(Hr)},e.getAttributeNode=function(t){throw new Error(Hr)},e.getAttributeNodeNS=function(t,e){throw new Error(Hr)},e.hasAttributeNS=function(t,e){throw new Error(Hr)},e.removeAttributeNS=function(t,e){throw new Error(Hr)},e.removeAttributeNode=function(t){throw new Error(Hr)},e.setAttributeNS=function(t,e,n){throw new Error(Hr)},e.setAttributeNode=function(t){throw new Error(Hr)},e.setAttributeNodeNS=function(t){throw new Error(Hr)},e.toggleAttribute=function(t,e){throw new Error(Hr)},tr(t,[{key:"className",get:function(){return this.getAttribute("class")||""},set:function(t){this.setAttribute("class",t)}},{key:"classList",get:function(){return this.className.split(" ").filter(function(t){return""!==t})}},{key:"tagName",get:function(){return this.nodeName}},{key:"children",get:function(){return this.childNodes}},{key:"childElementCount",get:function(){return this.childNodes.length}},{key:"firstElementChild",get:function(){return this.firstChild}},{key:"lastElementChild",get:function(){return this.lastChild}},{key:"parentElement",get:function(){return this.parentNode}},{key:"nextSibling",get:function(){var t;return this.parentNode&&(t=this.parentNode.childNodes.indexOf(this),this.parentNode.childNodes[t+1])||null}},{key:"previousSibling",get:function(){var t;return this.parentNode&&(t=this.parentNode.childNodes.indexOf(this),this.parentNode.childNodes[t-1])||null}}]),t}(Wa),qa=function(i){function t(){for(var t,e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];return(t=i.call.apply(i,[this].concat(n))||this).altKey=void 0,t.button=void 0,t.buttons=void 0,t.ctrlKey=void 0,t.metaKey=void 0,t.relatedTarget=void 0,t.shiftKey=void 0,t.client=new Ra,t.movement=new Ra,t.offset=new Ra,t.global=new Ra,t.screen=new Ra,t}er(t,i);var e=t.prototype;return e.getModifierState=function(t){return"getModifierState"in this.nativeEvent&&this.nativeEvent.getModifierState(t)},e.initMouseEvent=function(){throw new Error(Hr)},tr(t,[{key:"clientX",get:function(){return this.client.x}},{key:"clientY",get:function(){return this.client.y}},{key:"movementX",get:function(){return this.movement.x}},{key:"movementY",get:function(){return this.movement.y}},{key:"offsetX",get:function(){return this.offset.x}},{key:"offsetY",get:function(){return this.offset.y}},{key:"globalX",get:function(){return this.global.x}},{key:"globalY",get:function(){return this.global.y}},{key:"screenX",get:function(){return this.screen.x}},{key:"screenY",get:function(){return this.screen.y}}]),t}(Ua),$a=function(i){function t(){for(var t,e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];return(t=i.call.apply(i,[this].concat(n))||this).pointerId=void 0,t.width=0,t.height=0,t.isPrimary=!1,t.pointerType=void 0,t.pressure=void 0,t.tangentialPressure=void 0,t.tiltX=void 0,t.tiltY=void 0,t.twist=void 0,t}er(t,i);var e=t.prototype;return e.getCoalescedEvents=function(){return"pointermove"===this.type||"mousemove"===this.type||"touchmove"===this.type?[this]:[]},e.getPredictedEvents=function(){throw new Error("getPredictedEvents is not supported!")},e.clone=function(){return this.manager.clonePointerEvent(this)},t}(qa),Za=function(i){function t(){for(var t,e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];return(t=i.call.apply(i,[this].concat(n))||this).deltaMode=void 0,t.deltaX=void 0,t.deltaY=void 0,t.deltaZ=void 0,t.DOM_DELTA_LINE=0,t.DOM_DELTA_PAGE=1,t.DOM_DELTA_PIXEL=2,t}return er(t,i),t.prototype.clone=function(){return this.manager.cloneWheelEvent(this)},t}(qa);function ut(t){return null!=t&&t.nodeName}var Qa,Ja,ts,es=new ja(v.ATTR_MODIFIED,null,null,null,null,ja.MODIFICATION,null,null),ns={anchor:"",opacity:"",fillOpacity:"",strokeOpacity:"",fill:"",stroke:"",transform:"",transformOrigin:"",visibility:"",pointerEvents:"",lineWidth:"",lineCap:"",lineJoin:"",increasedLineWidthForHitTesting:"",fontSize:"",fontFamily:"",fontStyle:"",fontWeight:"",fontVariant:"",textAlign:"",textBaseline:"",textTransform:"",zIndex:"",filter:"",shadowType:""},rs={anchor:[0,0],fill:Or,stroke:Or,transform:[],zIndex:0,filter:[],shadowType:"outer",miterLimit:10},is=d({},rs,{opacity:1,fillOpacity:1,strokeOpacity:1,visibility:"visible",pointerEvents:"auto",lineWidth:1,lineCap:"butt",lineJoin:"miter",increasedLineWidthForHitTesting:0,fillRule:"nonzero"}),os=[].concat(["opacity","fillOpacity","strokeOpacity","transformOrigin","visibility","pointerEvents","lineWidth","lineCap","lineJoin","increasedLineWidthForHitTesting"],["fontSize","fontFamily","fontStyle","fontWeight","fontVariant","textAlign","textBaseline","textTransform"]),as=function(i){function t(t){var r=i.call(this)||this,t=(r.config=void 0,r.isCustomElement=!1,r.isMutationObserved=!1,r.activeAnimations=[],r.dataset=void 0,r.getClip=function(){return this.style.clipPath||null},r.config=t,r.config.interactive=null!=(t=r.config.capture)?t:r.config.interactive,r.id=r.config.id||"",r.name=r.config.name||"",(r.config.className||r.config.class)&&(r.className=r.config.className||r.config.class),r.nodeName=r.config.type||lt.GROUP,r.config.style=r.config.style||r.config.attrs||{},Object.assign(r.config.style,r.config.attrs),null!=r.config.visible&&(r.config.style.visibility=!1===r.config.visible?"hidden":"visible"),null!=r.config.interactive&&(r.config.style.pointerEvents=!1===r.config.interactive?"none":"auto"),Object.assign(r.parsedStyle,ct.enableCSSParsing?rs:is,r.config.initialParsedStyle),ct.enableCSSParsing&&Object.assign(r.attributes,ns),r.initAttributes(r.config.style),ct.globalThis.Proxy||function(){});return ct.enableDataset&&(r.dataset=new t({},{get:function(t,e){e="data-"+yr(e);return void 0!==t[e]?t[e]:r.getAttribute(e)},set:function(t,e,n){return r.setAttribute("data-"+yr(e),n),!0}})),ct.enableStyleSyntax&&(r.style=new t({setProperty:function(t,e){r.setAttribute(t,e)},getPropertyValue:function(t){return r.getAttribute(t)},removeProperty:function(t){r.removeAttribute(t)},item:function(){return""}},{get:function(t,e){return void 0!==t[e]?t[e]:r.getAttribute(e)},set:function(t,e,n){return r.setAttribute(e,n),!0}})),r}er(t,i);var e=t.prototype;return e.destroy=function(){i.prototype.destroy.call(this),this.getAnimations().forEach(function(t){t.cancel()})},e.cloneNode=function(e,t){var n,r=d({},this.attributes);for(n in r){var i=r[n];ut(i)&&"clipPath"!==n&&"offsetPath"!==n&&"textPath"!==n&&(r[n]=i.cloneNode(e)),t&&(r[n]=t(n,i))}var o=new this.constructor({id:this.id,name:this.name,className:this.name,interactive:this.interactive,style:r});return o.setLocalTransform(this.getLocalTransform()),e&&this.children.forEach(function(t){t.style.isMarker||(t=t.cloneNode(e),o.appendChild(t))}),o},e.initAttributes=function(t){void 0===t&&(t={});var e,n=this.renderable,r={forceUpdateGeometry:!0},i=(ct.enableCSSParsing&&(r.usedAttributes=os),{});for(e in t)i[wr(e)]=t[e];ct.styleValueRegistry.processProperties(this,i,r),n.dirty=!0},e.setAttribute=function(t,e,n){void 0===n&&(n=!1);t=wr(t);je(e)||!n&&e===this.attributes[t]||(this.internalSetAttribute(t,e),i.prototype.setAttribute.call(this,t,e))},e.internalSetAttribute=function(t,e,n){void 0===n&&(n={});var r=this.renderable,i=this.attributes[t],o=this.parsedStyle[t],a=(ct.styleValueRegistry.processProperties(this,((a={})[t]=e,a),n),r.dirty=!0,this.parsedStyle[t]);this.isConnected&&(es.relatedNode=this,es.prevValue=i,es.newValue=e,es.attrName=t,es.prevParsedValue=o,es.newParsedValue=a,this.isMutationObserved?this.dispatchEvent(es):(es.target=this).ownerDocument.defaultView.dispatchEvent(es,!0)),(this.isCustomElement&&this.isConnected||!this.isCustomElement)&&this.attributeChangedCallback&&this.attributeChangedCallback(t,i,e,o,a)},e.getBBox=function(){var t=this.getBounds(),e=t.getMin(),n=e[0],e=e[1],t=t.getMax(),r=t[0],t=t[1];return new Na(n,e,r-n,t-e)},e.setOrigin=function(t,e,n){return ct.sceneGraphService.setOrigin(this,Jr(t,e=void 0===e?0:e,n=void 0===n?0:n)),this},e.getOrigin=function(){return ct.sceneGraphService.getOrigin(this)},e.setPosition=function(t,e,n){return ct.sceneGraphService.setPosition(this,Jr(t,e=void 0===e?0:e,n=void 0===n?0:n)),this},e.setLocalPosition=function(t,e,n){return ct.sceneGraphService.setLocalPosition(this,Jr(t,e=void 0===e?0:e,n=void 0===n?0:n)),this},e.translate=function(t,e,n){return ct.sceneGraphService.translate(this,Jr(t,e=void 0===e?0:e,n=void 0===n?0:n)),this},e.translateLocal=function(t,e,n){return ct.sceneGraphService.translateLocal(this,Jr(t,e=void 0===e?0:e,n=void 0===n?0:n)),this},e.getPosition=function(){return ct.sceneGraphService.getPosition(this)},e.getLocalPosition=function(){return ct.sceneGraphService.getLocalPosition(this)},e.scale=function(t,e,n){return this.scaleLocal(t,e,n)},e.scaleLocal=function(t,e,n){return"number"==typeof t&&(t=Jr(t,e=e||t,n=n||t)),ct.sceneGraphService.scaleLocal(this,t),this},e.setLocalScale=function(t,e,n){return"number"==typeof t&&(t=Jr(t,e=e||t,n=n||t)),ct.sceneGraphService.setLocalScale(this,t),this},e.getLocalScale=function(){return ct.sceneGraphService.getLocalScale(this)},e.getScale=function(){return ct.sceneGraphService.getScale(this)},e.getEulerAngles=function(){return ei(ni(y(),ct.sceneGraphService.getWorldTransform(this))[2])},e.getLocalEulerAngles=function(){return ei(ni(y(),ct.sceneGraphService.getLocalRotation(this))[2])},e.setEulerAngles=function(t){return ct.sceneGraphService.setEulerAngles(this,0,0,t),this},e.setLocalEulerAngles=function(t){return ct.sceneGraphService.setLocalEulerAngles(this,0,0,t),this},e.rotateLocal=function(t,e,n){return M(e)&&M(n)?ct.sceneGraphService.rotateLocal(this,0,0,t):ct.sceneGraphService.rotateLocal(this,t,e,n),this},e.rotate=function(t,e,n){return M(e)&&M(n)?ct.sceneGraphService.rotate(this,0,0,t):ct.sceneGraphService.rotate(this,t,e,n),this},e.setRotation=function(t,e,n,r){return ct.sceneGraphService.setRotation(this,t,e,n,r),this},e.setLocalRotation=function(t,e,n,r){return ct.sceneGraphService.setLocalRotation(this,t,e,n,r),this},e.setLocalSkew=function(t,e){return ct.sceneGraphService.setLocalSkew(this,t,e),this},e.getRotation=function(){return ct.sceneGraphService.getRotation(this)},e.getLocalRotation=function(){return ct.sceneGraphService.getLocalRotation(this)},e.getLocalSkew=function(){return ct.sceneGraphService.getLocalSkew(this)},e.getLocalTransform=function(){return ct.sceneGraphService.getLocalTransform(this)},e.getWorldTransform=function(){return ct.sceneGraphService.getWorldTransform(this)},e.setLocalTransform=function(t){return ct.sceneGraphService.setLocalTransform(this,t),this},e.resetLocalTransform=function(){ct.sceneGraphService.resetLocalTransform(this)},e.getAnimations=function(){return this.activeAnimations},e.animate=function(t,e){var n=null==(n=this.ownerDocument)?void 0:n.timeline;return n?n.play(this,t,e):null},e.isVisible=function(){var t;return"visible"===(null==(t=this.parsedStyle)?void 0:t.visibility)},e.isInteractive=function(){var t;return"none"!==(null==(t=this.parsedStyle)?void 0:t.pointerEvents)},e.isCulled=function(){return!(!this.cullable||!this.cullable.enable||this.cullable.visible)},e.toFront=function(){return this.parentNode&&(this.style.zIndex=Math.max.apply(Math,this.parentNode.children.map(function(t){return Number(t.style.zIndex)}))+1),this},e.toBack=function(){return this.parentNode&&(this.style.zIndex=Math.min.apply(Math,this.parentNode.children.map(function(t){return Number(t.style.zIndex)}))-1),this},e.getConfig=function(){return this.config},e.attr=function(){for(var e=this,t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];var i=n[0],o=n[1];return i?Ie(i)?(Object.keys(i).forEach(function(t){e.setAttribute(t,i[t])}),this):2===n.length?(this.setAttribute(i,o),this):this.attributes[i]:this.attributes},e.getMatrix=function(t){var t=t||this.getWorldTransform(),e=pt(y(),t),n=e[0],e=e[1],r=gt(y(),t),i=r[0],r=r[1],t=mt(zt(),t),t=ni(y(),t),o=t[0],t=t[2];return ri(o||t,n,e,i,r)},e.getLocalMatrix=function(){return this.getMatrix(this.getLocalTransform())},e.setMatrix=function(t){var t=ii(t),e=t[0],n=t[1],r=t[2],i=t[3],t=t[4];this.setEulerAngles(t).setPosition(e,n).setLocalScale(r,i)},e.setLocalMatrix=function(t){var t=ii(t),e=t[0],n=t[1],r=t[2],i=t[3],t=t[4];this.setLocalEulerAngles(t).setLocalPosition(e,n).setLocalScale(r,i)},e.show=function(){ct.enableCSSParsing?this.style.visibility="visible":this.forEach(function(t){t.style.visibility="visible"})},e.hide=function(){ct.enableCSSParsing?this.style.visibility="hidden":this.forEach(function(t){t.style.visibility="hidden"})},e.getCount=function(){return this.childElementCount},e.getParent=function(){return this.parentElement},e.getChildren=function(){return this.children},e.getFirst=function(){return this.firstElementChild},e.getLast=function(){return this.lastElementChild},e.getChildByIndex=function(t){return this.children[t]||null},e.add=function(t,e){return this.appendChild(t,e)},e.setClip=function(t){this.style.clipPath=t},e.set=function(t,e){this.config[t]=e},e.get=function(t){return this.config[t]},e.moveTo=function(t,e,n){return this.setPosition(t,e=void 0===e?0:e,n=void 0===n?0:n),this},e.move=function(t,e,n){return this.setPosition(t,e=void 0===e?0:e,n=void 0===n?0:n),this},e.setZIndex=function(t){return this.style.zIndex=t,this},tr(t,[{key:"interactive",get:function(){return this.isInteractive()},set:function(t){this.style.pointerEvents=t?"auto":"none"}}]),t}(Ka),ss=["style"],ls=function(n){function t(t){var t=void 0===t?{}:t,e=t.style,t=rr(t,ss);return n.call(this,d({type:lt.CIRCLE,style:ct.enableCSSParsing?d({cx:"",cy:"",r:""},e):d({},e),initialParsedStyle:{anchor:[.5,.5],transformOrigin:ct.enableCSSParsing?null:[Dr,Dr]}},t))||this}return er(t,n),t}(as),us=["style"],qa=function(n){function t(t){var t=void 0===t?{}:t,e=t.style,t=rr(t,us),e=n.call(this,d({style:ct.enableCSSParsing?d({x:"",y:""},e):d({},e)},t))||this;return e.isCustomElement=!0,e}return er(t,n),t}(as),cs=["style"],hs=function(n){function t(t){var t=void 0===t?{}:t,e=t.style,t=rr(t,cs);return n.call(this,d({type:lt.ELLIPSE,style:ct.enableCSSParsing?d({cx:"",cy:"",rx:"",ry:""},e):d({},e),initialParsedStyle:{anchor:[.5,.5],transformOrigin:ct.enableCSSParsing?null:[Dr,Dr]}},t))||this}return er(t,n),t}(as),ds=["style"],fs=function(n){function t(t){var t=void 0===t?{}:t,e=t.style,t=rr(t,ds);return n.call(this,d({type:lt.GROUP,style:ct.enableCSSParsing?d({x:"",y:"",width:"",height:""},e):d({},e)},t))||this}return er(t,n),t}(as),ps=["style"],gs=function(n){function t(t){var t=void 0===t?{}:t,e=t.style,t=rr(t,ps),e=n.call(this,d({type:lt.HTML,style:ct.enableCSSParsing?d({x:"",y:"",width:"auto",height:"auto",innerHTML:""},e):d({},e)},t))||this;return e.cullable.enable=!1,e}er(t,n);var e=t.prototype;return e.getDomElement=function(){return this.parsedStyle.$el},e.getBoundingClientRect=function(){return this.parsedStyle.$el.getBoundingClientRect()},e.getClientRects=function(){return[this.getBoundingClientRect()]},e.getBounds=function(){var t,e,n=this.getBoundingClientRect(),r=null==(r=this.ownerDocument)||null==(r=r.defaultView)?void 0:r.getContextService().getBoundingClientRect();return r?(t=n.left-r.left,r=n.top-r.top,(e=new Ta).setMinMax([t,r,0],[t+n.width,r+n.height,0]),e):null},e.getLocalBounds=function(){if(this.parentNode){var t,e=et(K(),this.parentNode.getWorldTransform()),n=this.getBounds();if(!Ta.isEmpty(n))return(t=new Ta).setFromTransformedAABB(n,e),t}return this.getBounds()},t}(as),ms=["style"],vs=function(n){function t(t){var t=void 0===t?{}:t,e=t.style,t=rr(t,ms);return n.call(this,d({type:lt.IMAGE,style:ct.enableCSSParsing?d({x:"",y:"",img:"",width:"",height:""},e):d({},e)},t))||this}return er(t,n),t}(as),ys=["style"],Es=function(r){function t(t){var t=void 0===t?{}:t,e=t.style,t=rr(t,ys),e=r.call(this,d({type:lt.LINE,style:d({x1:0,y1:0,x2:0,y2:0,z1:0,z2:0,isBillboard:!1},e)},t))||this,t=(e.markerStartAngle=0,e.markerEndAngle=0,e.parsedStyle),n=t.markerStart,t=t.markerEnd;return n&&ut(n)&&(e.markerStartAngle=n.getLocalEulerAngles(),e.appendChild(n)),t&&ut(t)&&(e.markerEndAngle=t.getLocalEulerAngles(),e.appendChild(t)),e.transformMarker(!0),e.transformMarker(!1),e}er(t,r);var e=t.prototype;return e.attributeChangedCallback=function(t,e,n,r,i){"x1"===t||"y1"===t||"x2"===t||"y2"===t||"markerStartOffset"===t||"markerEndOffset"===t?(this.transformMarker(!0),this.transformMarker(!1)):"markerStart"===t?(r&&ut(r)&&(this.markerStartAngle=0,r.remove()),i&&ut(i)&&(this.markerStartAngle=i.getLocalEulerAngles(),this.appendChild(i),this.transformMarker(!0))):"markerEnd"===t&&(r&&ut(r)&&(this.markerEndAngle=0,r.remove()),i)&&ut(i)&&(this.markerEndAngle=i.getLocalEulerAngles(),this.appendChild(i),this.transformMarker(!1))},e.transformMarker=function(t){var e,n,r,i,o,a=this.parsedStyle,s=a.markerStart,l=a.markerEnd,u=a.markerStartOffset,c=a.markerEndOffset,h=a.x1,d=a.x2,f=a.y1,p=a.y2,g=a.defX,a=a.defY,s=t?s:l;s&&ut(s)&&(l=0,t=t?(r=h-g,i=f-a,e=d-h,n=p-f,o=u||0,this.markerStartAngle):(r=d-g,i=p-a,e=h-d,n=f-p,o=c||0,this.markerEndAngle),l=Math.atan2(n,e),s.setLocalEulerAngles(180*l/Math.PI+t),s.setLocalPosition(r+Math.cos(l)*o,i+Math.sin(l)*o))},e.getPoint=function(t,e){void 0===e&&(e=!1);var n=this.parsedStyle,r=n.x1,i=n.y1,o=n.x2,a=n.y2,s=n.defX,n=n.defY,r=xn.pointAt(r,i,o,a,t),i=r.x,o=r.y,a=Bt(y(),x(i-s,o-n,0),e?this.getWorldTransform():this.getLocalTransform());return new Ra(a[0],a[1])},e.getPointAtLength=function(t,e){return void 0===e&&(e=!1),this.getPoint(t/this.getTotalLength(),e)},e.getTotalLength=function(){var t=this.parsedStyle,e=t.x1,n=t.y1,r=t.x2,t=t.y2;return xn.length(e,n,r,t)},t}(as),_s=["style"],bs={absolutePath:[],hasArc:!1,segments:[],polygons:[],polylines:[],curve:null,totalLength:0,rect:new Na(0,0,0,0)},xs=function(i){function t(t){var t=void 0===t?{}:t,e=t.style,t=rr(t,_s),e=i.call(this,d({type:lt.PATH,style:ct.enableCSSParsing?d({path:"",miterLimit:""},e):d({},e),initialParsedStyle:ct.enableCSSParsing?null:{miterLimit:4,path:d({},bs)}},t))||this,t=(e.markerStartAngle=0,e.markerEndAngle=0,e.markerMidList=[],e.parsedStyle),n=t.markerStart,r=t.markerEnd,t=t.markerMid;return n&&ut(n)&&(e.markerStartAngle=n.getLocalEulerAngles(),e.appendChild(n)),t&&ut(t)&&e.placeMarkerMid(t),r&&ut(r)&&(e.markerEndAngle=r.getLocalEulerAngles(),e.appendChild(r)),e.transformMarker(!0),e.transformMarker(!1),e}er(t,i);var e=t.prototype;return e.attributeChangedCallback=function(t,e,n,r,i){"path"===t?(this.transformMarker(!0),this.transformMarker(!1),this.placeMarkerMid(this.parsedStyle.markerMid)):"markerStartOffset"===t||"markerEndOffset"===t?(this.transformMarker(!0),this.transformMarker(!1)):"markerStart"===t?(r&&ut(r)&&(this.markerStartAngle=0,r.remove()),i&&ut(i)&&(this.markerStartAngle=i.getLocalEulerAngles(),this.appendChild(i),this.transformMarker(!0))):"markerEnd"===t?(r&&ut(r)&&(this.markerEndAngle=0,r.remove()),i&&ut(i)&&(this.markerEndAngle=i.getLocalEulerAngles(),this.appendChild(i),this.transformMarker(!1))):"markerMid"===t&&this.placeMarkerMid(i)},e.transformMarker=function(t){var e,n,r,i,o,a=this.parsedStyle,s=a.markerStart,l=a.markerEnd,u=a.markerStartOffset,c=a.markerEndOffset,h=a.defX,a=a.defY,s=t?s:l;s&&ut(s)&&(l=0,h=t?(i=(t=this.getStartTangent())[0],e=(t=t[1])[0]-h,n=t[1]-a,r=i[0]-t[0],i=i[1]-t[1],o=u||0,this.markerStartAngle):(u=(t=this.getEndTangent())[0],e=(t=t[1])[0]-h,n=t[1]-a,r=u[0]-t[0],i=u[1]-t[1],o=c||0,this.markerEndAngle),l=Math.atan2(i,r),s.setLocalEulerAngles(180*l/Math.PI+h),s.setLocalPosition(e+Math.cos(l)*o,n+Math.sin(l)*o))},e.placeMarkerMid=function(t){var e=this.parsedStyle,n=e.path.segments,r=e.defX,i=e.defY;if(this.markerMidList.forEach(function(t){t.remove()}),t&&ut(t))for(var o=1;o<n.length-1;o++){var a=n[o].currentPoint,s=a[0],a=a[1],l=1===o?t:t.cloneNode(!0);this.markerMidList.push(l),this.appendChild(l),l.setLocalPosition(s-r,a-i)}},e.getTotalLength=function(){return Fi(this)},e.getPointAtLength=function(t,e){void 0===e&&(e=!1);var n=this.parsedStyle,r=n.defX,i=n.defY,n=Ae(n.path.absolutePath,t,k(k({},o),{bbox:!1,length:!0})).point,t=n.x,o=n.y,n=Bt(y(),x(t-r,o-i,0),e?this.getWorldTransform():this.getLocalTransform());return new Ra(n[0],n[1])},e.getPoint=function(t,e){return void 0===e&&(e=!1),this.getPointAtLength(t*Fi(this),e)},e.getStartTangent=function(){var t,e,n=this.parsedStyle.path.segments,r=[];return 1<n.length&&(t=n[0].currentPoint,e=n[1].currentPoint,r=[],(n=n[1].startTangent)?r.push([t[0]-n[0],t[1]-n[1]]):r.push([e[0],e[1]]),r.push([t[0],t[1]])),r},e.getEndTangent=function(){var t,e,n=this.parsedStyle.path.segments,r=n.length,i=[];return 1<r&&(t=n[r-2].currentPoint,e=n[r-1].currentPoint,i=[],(n=n[r-1].endTangent)?i.push([e[0]-n[0],e[1]-n[1]]):i.push([t[0],t[1]]),i.push([e[0],e[1]])),i},t}(as),Ss=["style"],ws=function(i){function t(t){var t=void 0===t?{}:t,e=t.style,t=rr(t,Ss),e=i.call(this,d({type:lt.POLYGON,style:ct.enableCSSParsing?d({points:"",miterLimit:"",isClosed:!0},e):d({},e),initialParsedStyle:ct.enableCSSParsing?null:{points:{points:[],totalLength:0,segments:[]},miterLimit:4,isClosed:!0}},t))||this,t=(e.markerStartAngle=0,e.markerEndAngle=0,e.markerMidList=[],e.parsedStyle),n=t.markerStart,r=t.markerEnd,t=t.markerMid;return n&&ut(n)&&(e.markerStartAngle=n.getLocalEulerAngles(),e.appendChild(n)),t&&ut(t)&&e.placeMarkerMid(t),r&&ut(r)&&(e.markerEndAngle=r.getLocalEulerAngles(),e.appendChild(r)),e.transformMarker(!0),e.transformMarker(!1),e}er(t,i);var e=t.prototype;return e.attributeChangedCallback=function(t,e,n,r,i){"points"===t?(this.transformMarker(!0),this.transformMarker(!1),this.placeMarkerMid(this.parsedStyle.markerMid)):"markerStartOffset"===t||"markerEndOffset"===t?(this.transformMarker(!0),this.transformMarker(!1)):"markerStart"===t?(r&&ut(r)&&(this.markerStartAngle=0,r.remove()),i&&ut(i)&&(this.markerStartAngle=i.getLocalEulerAngles(),this.appendChild(i),this.transformMarker(!0))):"markerEnd"===t?(r&&ut(r)&&(this.markerEndAngle=0,r.remove()),i&&ut(i)&&(this.markerEndAngle=i.getLocalEulerAngles(),this.appendChild(i),this.transformMarker(!1))):"markerMid"===t&&this.placeMarkerMid(i)},e.transformMarker=function(t){var e,n,r,i,o,a=this.parsedStyle,s=a.markerStart,l=a.markerEnd,u=a.markerStartOffset,c=a.markerEndOffset,h=a.points.points,d=a.defX,a=a.defY,s=t?s:l;s&&ut(s)&&(i=h[l=0][0]-d,o=h[0][1]-a,u=t?(e=h[1][0]-h[0][0],n=h[1][1]-h[0][1],r=u||0,this.markerStartAngle):(t=h.length,n=this.parsedStyle.isClosed?(e=h[t-1][0]-h[0][0],h[t-1][1]-h[0][1]):(i=h[t-1][0]-d,o=h[t-1][1]-a,e=h[t-2][0]-h[t-1][0],h[t-2][1]-h[t-1][1]),r=c||0,this.markerEndAngle),l=Math.atan2(n,e),s.setLocalEulerAngles(180*l/Math.PI+u),s.setLocalPosition(i+Math.cos(l)*r,o+Math.sin(l)*r))},e.placeMarkerMid=function(t){var e=this.parsedStyle,n=e.points.points,r=e.defX,i=e.defY;if(this.markerMidList.forEach(function(t){t.remove()}),this.markerMidList=[],t&&ut(t))for(var o=1;o<(this.parsedStyle.isClosed?n.length:n.length-1);o++){var a=n[o][0]-r,s=n[o][1]-i,l=1===o?t:t.cloneNode(!0);this.markerMidList.push(l),this.appendChild(l),l.setLocalPosition(a,s)}},t}(as),Ts=["style"],As=function(n){function t(t){var t=void 0===t?{}:t,e=t.style,t=rr(t,Ts);return n.call(this,d({type:lt.POLYLINE,style:ct.enableCSSParsing?d({points:"",miterLimit:"",isClosed:!1},e):d({},e),initialParsedStyle:ct.enableCSSParsing?null:{points:{points:[],totalLength:0,segments:[]},miterLimit:4,isClosed:!1}},t))||this}er(t,n);var e=t.prototype;return e.getTotalLength=function(){return this.parsedStyle.points.totalLength},e.getPointAtLength=function(t,e){return void 0===e&&(e=!1),this.getPoint(t/this.getTotalLength(),e)},e.getPoint=function(n,t){void 0===t&&(t=!1);var e=this.parsedStyle,r=e.defX,i=e.defY,e=e.points,o=e.points,e=e.segments,a=0,s=0,e=(e.forEach(function(t,e){n>=t[0]&&n<=t[1]&&(a=(n-t[0])/(t[1]-t[0]),s=e)}),xn.pointAt(o[s][0],o[s][1],o[s+1][0],o[s+1][1],a)),o=e.x,e=e.y,o=Bt(y(),x(o-r,e-i,0),t?this.getWorldTransform():this.getLocalTransform());return new Ra(o[0],o[1])},e.getStartTangent=function(){var t=this.parsedStyle.points.points,e=[];return e.push([t[1][0],t[1][1]]),e.push([t[0][0],t[0][1]]),e},e.getEndTangent=function(){var t=this.parsedStyle.points.points,e=t.length-1,n=[];return n.push([t[e-1][0],t[e-1][1]]),n.push([t[e][0],t[e][1]]),n},t}(ws),Ms=["style"],Rs=function(n){function t(t){var t=void 0===t?{}:t,e=t.style,t=rr(t,Ms);return n.call(this,d({type:lt.RECT,style:ct.enableCSSParsing?d({x:"",y:"",width:"",height:"",radius:""},e):d({},e)},t))||this}return er(t,n),t}(as),Ns=["style"],Cs=function(n){function t(t){var t=void 0===t?{}:t,e=t.style,t=rr(t,Ns);return n.call(this,d({type:lt.TEXT,style:ct.enableCSSParsing?d({x:"",y:"",text:"",fontSize:"",fontFamily:"",fontStyle:"",fontWeight:"",fontVariant:"",textAlign:"",textBaseline:"",textTransform:"",fill:"black",letterSpacing:"",lineHeight:"",miterLimit:"",wordWrap:!1,wordWrapWidth:0,leading:0,dx:"",dy:"",isBillboard:!1,sizeAttenuation:!0},e):d({fill:"black"},e),initialParsedStyle:ct.enableCSSParsing?{}:{x:0,y:0,fontSize:16,fontFamily:"sans-serif",fontStyle:"normal",fontWeight:"normal",fontVariant:"normal",lineHeight:0,letterSpacing:0,textBaseline:"alphabetic",textAlign:"start",wordWrap:!1,wordWrapWidth:0,leading:0,dx:0,dy:0,isBillboard:!1,sizeAttenuation:!0}},t))||this}er(t,n);var e=t.prototype;return e.getComputedTextLength=function(){var t;return(null==(t=this.parsedStyle.metrics)?void 0:t.maxLineWidth)||0},e.getLineBoundingRects=function(){var t;return(null==(t=this.parsedStyle.metrics)?void 0:t.lineMetrics)||[]},e.isOverflowing=function(){return!!this.parsedStyle.isOverflowing},t}(as),Ps=[{n:"display",k:["none"]},{n:"opacity",int:!0,inh:!0,d:"1",syntax:b.OPACITY_VALUE},{n:"fillOpacity",int:!0,inh:!0,d:"1",syntax:b.OPACITY_VALUE},{n:"strokeOpacity",int:!0,inh:!0,d:"1",syntax:b.OPACITY_VALUE},{n:"fill",int:!0,k:["none"],d:"none",syntax:b.PAINT},{n:"fillRule",k:["nonzero","evenodd"],d:"nonzero"},{n:"stroke",int:!0,k:["none"],d:"none",syntax:b.PAINT,l:!0},{n:"shadowType",k:["inner","outer","both"],d:"outer",l:!0},{n:"shadowColor",int:!0,syntax:b.COLOR},{n:"shadowOffsetX",int:!0,l:!0,d:"0",syntax:b.LENGTH_PERCENTAGE},{n:"shadowOffsetY",int:!0,l:!0,d:"0",syntax:b.LENGTH_PERCENTAGE},{n:"shadowBlur",int:!0,l:!0,d:"0",syntax:b.SHADOW_BLUR},{n:"lineWidth",int:!0,inh:!0,d:"1",l:!0,a:["strokeWidth"],syntax:b.LENGTH_PERCENTAGE},{n:"increasedLineWidthForHitTesting",inh:!0,d:"0",l:!0,syntax:b.LENGTH_PERCENTAGE},{n:"lineJoin",inh:!0,l:!0,a:["strokeLinejoin"],k:["miter","bevel","round"],d:"miter"},{n:"lineCap",inh:!0,l:!0,a:["strokeLinecap"],k:["butt","round","square"],d:"butt"},{n:"lineDash",int:!0,inh:!0,k:["none"],a:["strokeDasharray"],syntax:b.LENGTH_PERCENTAGE_12},{n:"lineDashOffset",int:!0,inh:!0,d:"0",a:["strokeDashoffset"],syntax:b.LENGTH_PERCENTAGE},{n:"offsetPath",syntax:b.DEFINED_PATH},{n:"offsetDistance",int:!0,syntax:b.OFFSET_DISTANCE},{n:"dx",int:!0,l:!0,d:"0",syntax:b.LENGTH_PERCENTAGE},{n:"dy",int:!0,l:!0,d:"0",syntax:b.LENGTH_PERCENTAGE},{n:"zIndex",ind:!0,int:!0,d:"0",k:["auto"],syntax:b.Z_INDEX},{n:"visibility",k:["visible","hidden"],ind:!0,inh:!0,int:!0,d:"visible"},{n:"pointerEvents",inh:!0,k:["none","auto","stroke","fill","painted","visible","visiblestroke","visiblefill","visiblepainted","all"],d:"auto"},{n:"filter",ind:!0,l:!0,k:["none"],d:"none",syntax:b.FILTER},{n:"clipPath",syntax:b.DEFINED_PATH},{n:"textPath",syntax:b.DEFINED_PATH},{n:"textPathSide",k:["left","right"],d:"left"},{n:"textPathStartOffset",l:!0,d:"0",syntax:b.LENGTH_PERCENTAGE},{n:"transform",p:100,int:!0,k:["none"],d:"none",syntax:b.TRANSFORM},{n:"transformOrigin",p:100,d:function(t){return t===lt.CIRCLE||t===lt.ELLIPSE?"center":t===lt.TEXT?"text-anchor":"left top"},l:!0,syntax:b.TRANSFORM_ORIGIN},{n:"anchor",p:99,d:function(t){return t===lt.CIRCLE||t===lt.ELLIPSE?"0.5 0.5":"0 0"},l:!0,syntax:b.LENGTH_PERCENTAGE_12},{n:"cx",int:!0,d:"0",syntax:b.COORDINATE},{n:"cy",int:!0,d:"0",syntax:b.COORDINATE},{n:"cz",int:!0,d:"0",syntax:b.COORDINATE},{n:"r",int:!0,l:!0,d:"0",syntax:b.LENGTH_PERCENTAGE},{n:"rx",int:!0,l:!0,d:"0",syntax:b.LENGTH_PERCENTAGE},{n:"ry",int:!0,l:!0,d:"0",syntax:b.LENGTH_PERCENTAGE},{n:"x",int:!0,d:"0",syntax:b.COORDINATE},{n:"y",int:!0,d:"0",syntax:b.COORDINATE},{n:"z",int:!0,d:"0",syntax:b.COORDINATE},{n:"width",int:!0,l:!0,k:["auto","fit-content","min-content","max-content"],d:"0",syntax:b.LENGTH_PERCENTAGE},{n:"height",int:!0,l:!0,k:["auto","fit-content","min-content","max-content"],d:"0",syntax:b.LENGTH_PERCENTAGE},{n:"radius",int:!0,l:!0,d:"0",syntax:b.LENGTH_PERCENTAGE_14},{n:"x1",int:!0,l:!0,syntax:b.COORDINATE},{n:"y1",int:!0,l:!0,syntax:b.COORDINATE},{n:"z1",int:!0,l:!0,syntax:b.COORDINATE},{n:"x2",int:!0,l:!0,syntax:b.COORDINATE},{n:"y2",int:!0,l:!0,syntax:b.COORDINATE},{n:"z2",int:!0,l:!0,syntax:b.COORDINATE},{n:"path",int:!0,l:!0,d:"",a:["d"],syntax:b.PATH,p:50},{n:"points",int:!0,l:!0,syntax:b.LIST_OF_POINTS,p:50},{n:"text",l:!0,d:"",syntax:b.TEXT,p:50},{n:"textTransform",l:!0,inh:!0,k:["capitalize","uppercase","lowercase","none"],d:"none",syntax:b.TEXT_TRANSFORM,p:51},{n:"font",l:!0},{n:"fontSize",int:!0,inh:!0,d:"16px",l:!0,syntax:b.LENGTH_PERCENTAGE},{n:"fontFamily",l:!0,inh:!0,d:"sans-serif"},{n:"fontStyle",l:!0,inh:!0,k:["normal","italic","oblique"],d:"normal"},{n:"fontWeight",l:!0,inh:!0,k:["normal","bold","bolder","lighter"],d:"normal"},{n:"fontVariant",l:!0,inh:!0,k:["normal","small-caps"],d:"normal"},{n:"lineHeight",l:!0,syntax:b.LENGTH,int:!0,d:"0"},{n:"letterSpacing",l:!0,syntax:b.LENGTH,int:!0,d:"0"},{n:"miterLimit",l:!0,syntax:b.NUMBER,d:function(t){return t===lt.PATH||t===lt.POLYGON||t===lt.POLYLINE?"4":"10"}},{n:"wordWrap",l:!0},{n:"wordWrapWidth",l:!0},{n:"maxLines",l:!0},{n:"textOverflow",l:!0,d:"clip"},{n:"leading",l:!0},{n:"textBaseline",l:!0,inh:!0,k:["top","hanging","middle","alphabetic","ideographic","bottom"],d:"alphabetic"},{n:"textAlign",l:!0,inh:!0,k:["start","center","middle","end","left","right"],d:"start"},{n:"markerStart",syntax:b.MARKER},{n:"markerEnd",syntax:b.MARKER},{n:"markerMid",syntax:b.MARKER},{n:"markerStartOffset",syntax:b.LENGTH,l:!0,int:!0,d:"0"},{n:"markerEndOffset",syntax:b.LENGTH,l:!0,int:!0,d:"0"}],Os=Ps.filter(function(t){return!!t.l}).map(function(t){return t.n}),Is={},Ls=new WeakMap,ks=function(){function t(){var e=this;Ps.forEach(function(t){e.registerMetadata(t)})}var e=t.prototype;return e.registerMetadata=function(e){[e.n].concat(e.a||[]).forEach(function(t){Is[t]=e})},e.unregisterMetadata=function(t){delete Is[t]},e.getPropertySyntax=function(t){return ct.CSSPropertySyntaxFactory[t]},e.processProperties=function(n,e,t){var r=this;if(void 0===t&&(t={skipUpdateAttribute:!1,skipParse:!1,forceUpdateGeometry:!1,usedAttributes:[]}),ct.enableCSSParsing){var i=t,o=i.skipUpdateAttribute,a=i.skipParse,s=i.forceUpdateGeometry,i=i.usedAttributes,l=s,u=Object.keys(e);u.forEach(function(t){o||(n.attributes[t]=e[t]),!l&&null!=(t=Is[t])&&t.l&&(l=!0)}),a||u.forEach(function(t){n.computedStyle[t]=r.parseProperty(t,n.attributes[t],n)}),(u=null!=i&&i.length?Array.from(new Set(u.concat(i))):u).forEach(function(t){t in n.computedStyle&&(n.parsedStyle[t]=r.computeProperty(t,n.computedStyle[t],n))}),l&&this.updateGeometry(n),u.forEach(function(t){t in n.parsedStyle&&r.postProcessProperty(t,n,u)}),ct.enableCSSParsing&&n.children.length&&u.forEach(function(e){e in n.parsedStyle&&r.isPropertyInheritable(e)&&n.children.forEach(function(t){t.internalSetAttribute(e,null,{skipUpdateAttribute:!0,skipParse:!0})})})}else{Object.assign(n.attributes,e);var s=Object.keys(e),a=n.parsedStyle.clipPath,i=n.parsedStyle.offsetPath,c=(n.parsedStyle=Object.assign(n.parsedStyle,e),!!t.forceUpdateGeometry);if(!c)for(var h=0;h<Os.length;h++)if(Os[h]in e){c=!0;break}e.fill&&(n.parsedStyle.fill=Ao(e.fill)),e.stroke&&(n.parsedStyle.stroke=Ao(e.stroke)),e.shadowColor&&(n.parsedStyle.shadowColor=Ao(e.shadowColor)),e.filter&&(n.parsedStyle.filter=Fo(e.filter)),M(e.radius)||(n.parsedStyle.radius=Io(e.radius,4)),M(e.lineDash)||(n.parsedStyle.lineDash=Io(e.lineDash,2)),e.points&&(n.parsedStyle.points=Ko(e.points,n)),""===e.path&&(n.parsedStyle.path=d({},bs)),e.path&&(n.parsedStyle.path=Xo(e.path,n)),e.textTransform&&ct.CSSPropertySyntaxFactory["<text-transform>"].calculator(null,null,{value:e.textTransform},n,null),e.clipPath&&ct.CSSPropertySyntaxFactory["<defined-path>"].calculator("clipPath",a,e.clipPath,n,this),e.offsetPath&&ct.CSSPropertySyntaxFactory["<defined-path>"].calculator("offsetPath",i,e.offsetPath,n,this),e.anchor&&(n.parsedStyle.anchor=Io(e.anchor,2)),e.transform&&(n.parsedStyle.transform=ta(e.transform)),e.transformOrigin&&(n.parsedStyle.transformOrigin=da(e.transformOrigin)),e.markerStart&&(n.parsedStyle.markerStart=ct.CSSPropertySyntaxFactory["<marker>"].calculator(null,e.markerStart,e.markerStart,null,null)),e.markerEnd&&(n.parsedStyle.markerEnd=ct.CSSPropertySyntaxFactory["<marker>"].calculator(null,e.markerEnd,e.markerEnd,null,null)),e.markerMid&&(n.parsedStyle.markerMid=ct.CSSPropertySyntaxFactory["<marker>"].calculator("",e.markerMid,e.markerMid,null,null)),(n.nodeName!==lt.CIRCLE&&n.nodeName!==lt.ELLIPSE||M(e.cx)&&M(e.cy))&&(n.nodeName!==lt.RECT&&n.nodeName!==lt.IMAGE&&n.nodeName!==lt.GROUP&&n.nodeName!==lt.HTML&&n.nodeName!==lt.TEXT&&n.nodeName!==lt.MESH||M(e.x)&&M(e.y)&&M(e.z))&&(n.nodeName!==lt.LINE||M(e.x1)&&M(e.y1)&&M(e.z1)&&M(e.x2)&&M(e.y2)&&M(e.z2))||ct.CSSPropertySyntaxFactory["<coordinate>"].postProcessor(n,s),M(e.zIndex)||ct.CSSPropertySyntaxFactory["<z-index>"].postProcessor(n,s),e.path&&ct.CSSPropertySyntaxFactory["<path>"].postProcessor(n,s),e.points&&ct.CSSPropertySyntaxFactory["<list-of-points>"].postProcessor(n,s),M(e.offsetDistance)||ct.CSSPropertySyntaxFactory["<offset-distance>"].postProcessor(n,s),e.transform&&ct.CSSPropertySyntaxFactory["<transform>"].postProcessor(n,s),c&&this.updateGeometry(n)}},e.parseProperty=function(t,e,n){var r,t=Is[t],i=e;return"unset"===(e=""!==e&&!M(e)?e:"unset")||"initial"===e||"inherit"===e?i=xr(e):t&&(r=t.k,t=(t=t.syntax)&&this.getPropertySyntax(t),r&&-1<r.indexOf(e)?i=xr(e):t&&t.parser&&(i=t.parser(e,n))),i},e.computeProperty=function(t,e,n){var r=Is[t],i="g-root"===n.id,o=e;if(r){var a=r.syntax,s=r.inh,r=r.d;if(e instanceof mr){var l=e.value;if("initial"===(l="unset"===l?s&&!i?"inherit":"initial":l))M(r)||(e=this.parseProperty(t,_r(r)?r(n.nodeName):r,n));else if("inherit"===l)return s=this.tryToResolveProperty(n,t,{inherited:!0}),M(s)?void this.addUnresolveProperty(n,t):s}i=a&&this.getPropertySyntax(a);o=i&&i.calculator?(r=n.parsedStyle[t],i.calculator(t,r,e,n,this)):e instanceof mr?e.value:e}return o},e.postProcessProperty=function(t,e,n){var t=Is[t];t&&t.syntax&&(t=t.syntax&&this.getPropertySyntax(t.syntax))&&t.postProcessor&&t.postProcessor(e,n)},e.addUnresolveProperty=function(t,e){var n=Ls.get(t);n||(Ls.set(t,[]),n=Ls.get(t)),-1===n.indexOf(e)&&n.push(e)},e.tryToResolveProperty=function(t,e,n){var n=(n=void 0===n?{}:n).inherited;if(n&&(t.parentElement&&function(t,e){t=Ls.get(t);return!t||0===t.length||t.includes(e)}(t.parentElement,e)))return"unset"===(n=t.parentElement.parsedStyle[e])||"initial"===n||"inherit"===n?void 0:n},e.recalc=function(e){var n,t=Ls.get(e);t&&t.length&&(n={},t.forEach(function(t){n[t]=e.attributes[t]}),this.processProperties(e,n),Ls.delete(e))},e.updateGeometry=function(t){var s,e,n,r,i,o,a,l,u,c,h,d,f,p,g,m=t.nodeName,v=ct.geometryUpdaterFactory[m];v&&((s=t.geometry).contentBounds||(s.contentBounds=new Ta),s.renderBounds||(s.renderBounds=new Ta),e=t.parsedStyle,n=(v=v.update(e,t)).width,r=v.height,h=void 0===(h=v.depth)?0:h,c=void 0===(c=v.offsetX)?0:c,p=void 0===(p=v.offsetY)?0:p,v=void 0===(v=v.offsetZ)?0:v,h=[Math.abs(n)/2,Math.abs(r)/2,h/2],l=e.stroke,u=e.lineWidth,g=e.increasedLineWidthForHitTesting,f=e.shadowType,d=e.shadowColor,i=void 0===(i=e.filter)?[]:i,o=e.transformOrigin,a=e.anchor,m===lt.TEXT?delete e.anchor:m===lt.MESH&&(e.anchor[2]=.5),c=[(1-2*(a&&a[0]||0))*n/2+c,(1-2*(a&&a[1]||0))*r/2+p,(1-2*(a&&a[2]||0))*h[2]+v],s.contentBounds.update(c,h),p=m===lt.POLYLINE||m===lt.POLYGON||m===lt.PATH?Math.SQRT2:.5,l&&!l.isNone&&(h[0]+=v=((u||0)+(g||0))*p,h[1]+=v),s.renderBounds.update(c,h),d&&f&&"inner"!==f&&(l=(m=s.renderBounds).min,u=m.max,g=e.shadowBlur||0,p=e.shadowOffsetX||0,v=e.shadowOffsetY||0,c=l[0]-g+p,h=u[0]+g+p,d=l[1]-g+v,f=u[1]+g+v,l[0]=Math.min(l[0],c),u[0]=Math.max(u[0],h),l[1]=Math.min(l[1],d),u[1]=Math.max(u[1],f),s.renderBounds.setMinMax(l,u)),i.forEach(function(t){var e,n,r,i,o,a=t.name,t=t.params;"blur"===a?(i=t[0].value,s.renderBounds.update(s.renderBounds.center,$r(s.renderBounds.halfExtents,s.renderBounds.halfExtents,[i,i,0]))):"drop-shadow"===a&&(i=t[0].value,a=t[1].value,t=t[2].value,e=(n=s.renderBounds).min,n=n.max,r=e[0]-t+i,i=n[0]+t+i,o=e[1]-t+a,t=n[1]+t+a,e[0]=Math.min(e[0],r),n[0]=Math.max(n[0],i),e[1]=Math.min(e[1],o),n[1]=Math.max(n[1],t),s.renderBounds.setMinMax(e,n))}),a=e.anchor,m=r<0,g=((p=n<0)?-1:1)*(o?ko(o[0],0,t):0),v=(m?-1:1)*(o?ko(o[1],1,t):0),g-=(p?-1:1)*(a&&a[0]||0)*s.contentBounds.halfExtents[0]*2,v-=(m?-1:1)*(a&&a[1]||0)*s.contentBounds.halfExtents[1]*2,t.setOrigin(g,v),ct.sceneGraphService.dirtifyToRoot(t))},e.isPropertyInheritable=function(t){t=Is[t];return!!t&&t.inh},t}();(Fs=Qa=Qa||{})[Fs.ORBITING=0]="ORBITING",Fs[Fs.EXPLORING=1]="EXPLORING",Fs[Fs.TRACKING=2]="TRACKING",(Fs=Ja=Ja||{})[Fs.DEFAULT=0]="DEFAULT",Fs[Fs.ROTATIONAL=1]="ROTATIONAL",Fs[Fs.TRANSLATIONAL=2]="TRANSLATIONAL",Fs[Fs.CINEMATIC=3]="CINEMATIC",(Fs=ts=ts||{})[Fs.ORTHOGRAPHIC=0]="ORTHOGRAPHIC",Fs[Fs.PERSPECTIVE=1]="PERSPECTIVE";var Ds,Bs="updated",Fs=function(){function t(){this.canvas=void 0,this.eventEmitter=new qn,this.matrix=K(),this.right=x(1,0,0),this.up=x(0,1,0),this.forward=x(0,0,1),this.position=x(0,0,1),this.focalPoint=x(0,0,0),this.distanceVector=x(0,0,-1),this.distance=1,this.azimuth=0,this.elevation=0,this.roll=0,this.relAzimuth=0,this.relElevation=0,this.relRoll=0,this.dollyingStep=0,this.maxDistance=1/0,this.minDistance=-1/0,this.zoom=1,this.rotateWorld=!1,this.fov=30,this.near=.1,this.far=1e3,this.aspect=1,this.left=void 0,this.rright=void 0,this.top=void 0,this.bottom=void 0,this.projectionMatrix=K(),this.projectionMatrixInverse=K(),this.jitteredProjectionMatrix=void 0,this.view=void 0,this.enableUpdate=!0,this.type=Qa.EXPLORING,this.trackingMode=Ja.DEFAULT,this.projectionMode=ts.PERSPECTIVE,this.frustum=new Ma,this.orthoMatrix=K()}var e=t.prototype;return e.isOrtho=function(){return this.projectionMode===ts.ORTHOGRAPHIC},e.getProjectionMode=function(){return this.projectionMode},e.getPerspective=function(){return this.jitteredProjectionMatrix||this.projectionMatrix},e.getPerspectiveInverse=function(){return this.projectionMatrixInverse},e.getFrustum=function(){return this.frustum},e.getPosition=function(){return this.position},e.getFocalPoint=function(){return this.focalPoint},e.getDollyingStep=function(){return this.dollyingStep},e.getNear=function(){return this.near},e.getFar=function(){return this.far},e.getZoom=function(){return this.zoom},e.getOrthoMatrix=function(){return this.orthoMatrix},e.getView=function(){return this.view},e.setEnableUpdate=function(t){this.enableUpdate=t},e.setType=function(t,e){return this.type=t,this.type===Qa.EXPLORING?this.setWorldRotation(!0):this.setWorldRotation(!1),this._getAngles(),this.type===Qa.TRACKING&&void 0!==e&&this.setTrackingMode(e),this},e.setProjectionMode=function(t){return this.projectionMode=t,this},e.setTrackingMode=function(t){if(this.type!==Qa.TRACKING)throw new Error("Impossible to set a tracking mode if the camera is not of tracking type");return this.trackingMode=t,this},e.setWorldRotation=function(t){return this.rotateWorld=t,this._getAngles(),this},e.getViewTransform=function(){return et(K(),this.matrix)},e.getWorldTransform=function(){return this.matrix},e.jitterProjectionMatrix=function(t,e){t=ht(K(),[t,e,0]);this.jitteredProjectionMatrix=rt(K(),t,this.projectionMatrix)},e.clearJitterProjectionMatrix=function(){this.jitteredProjectionMatrix=void 0},e.setMatrix=function(t){return this.matrix=t,this._update(),this},e.setFov=function(t){return this.setPerspective(this.near,this.far,t,this.aspect),this},e.setAspect=function(t){return this.setPerspective(this.near,this.far,this.fov,t),this},e.setNear=function(t){return this.projectionMode===ts.PERSPECTIVE?this.setPerspective(t,this.far,this.fov,this.aspect):this.setOrthographic(this.left,this.rright,this.top,this.bottom,t,this.far),this},e.setFar=function(t){return this.projectionMode===ts.PERSPECTIVE?this.setPerspective(this.near,t,this.fov,this.aspect):this.setOrthographic(this.left,this.rright,this.top,this.bottom,this.near,t),this},e.setViewOffset=function(t,e,n,r,i,o){return this.aspect=t/e,void 0===this.view&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=t,this.view.fullHeight=e,this.view.offsetX=n,this.view.offsetY=r,this.view.width=i,this.view.height=o,this.projectionMode===ts.PERSPECTIVE?this.setPerspective(this.near,this.far,this.fov,this.aspect):this.setOrthographic(this.left,this.rright,this.top,this.bottom,this.near,this.far),this},e.clearViewOffset=function(){return void 0!==this.view&&(this.view.enabled=!1),this.projectionMode===ts.PERSPECTIVE?this.setPerspective(this.near,this.far,this.fov,this.aspect):this.setOrthographic(this.left,this.rright,this.top,this.bottom,this.near,this.far),this},e.setZoom=function(t){return this.zoom=t,this.projectionMode===ts.ORTHOGRAPHIC?this.setOrthographic(this.left,this.rright,this.top,this.bottom,this.near,this.far):this.projectionMode===ts.PERSPECTIVE&&this.setPerspective(this.near,this.far,this.fov,this.aspect),this},e.setZoomByViewportPoint=function(t,e){var n=this.canvas.viewport2Canvas({x:e[0],y:e[1]}),r=n.x,n=n.y,i=this.roll,t=(this.rotate(0,0,-i),this.setPosition(r,n),this.setFocalPoint(r,n),this.setZoom(t),this.rotate(0,0,i),this.canvas.viewport2Canvas({x:e[0],y:e[1]})),i=x(t.x-r,t.y-n,0),e=Lt(i,this.right)/Mt(this.right),r=Lt(i,this.up)/Mt(this.up);return this.pan(-e,-r),this},e.setPerspective=function(t,e,n,r){this.projectionMode=ts.PERSPECTIVE,this.fov=n,this.near=t,this.far=e,this.aspect=r;var i,o,a,s,n=this.near*Math.tan(ti(.5*this.fov))/this.zoom,e=2*n,r=this.aspect*e,l=-.5*r;return null!=(i=this.view)&&i.enabled&&(i=this.view.fullWidth,o=this.view.fullHeight,l+=this.view.offsetX*r/i,n-=this.view.offsetY*e/o,r*=this.view.width/i,e*=this.view.height/o),i=this.projectionMatrix,l=(o=l)+r,n=(r=n)-e,e=this.far,a=2*t/(r-n),s=(l+o)/(l-o),r=(r+n)/(r-n),n=-(e+t)/(e-t),e=-2*e*t/(e-t),i[0]=2*t/(l-o),i[1]=0,i[2]=0,i[3]=0,i[4]=0,i[5]=a,i[6]=0,i[7]=0,i[8]=s,i[9]=r,i[10]=n,i[11]=-1,i[12]=0,i[13]=0,i[14]=e,i[15]=0,ot(this.projectionMatrix,this.projectionMatrix,x(1,-1,1)),et(this.projectionMatrixInverse,this.projectionMatrix),this.triggerUpdate(),this},e.setOrthographic=function(t,e,n,r,i,o){this.projectionMode=ts.ORTHOGRAPHIC,this.rright=e,this.left=t,this.top=n,this.bottom=r,this.near=i,this.far=o;var a,e=(this.rright-this.left)/(2*this.zoom),t=(this.top-this.bottom)/(2*this.zoom),n=(this.rright+this.left)/2,r=(this.top+this.bottom)/2,s=n-e,n=n+e,e=r+t,r=r-t;return null!=(t=this.view)&&t.enabled&&(t=(this.rright-this.left)/this.view.fullWidth/this.zoom,a=(this.top-this.bottom)/this.view.fullHeight/this.zoom,n=(s+=t*this.view.offsetX)+t*this.view.width,r=(e-=a*this.view.offsetY)-a*this.view.height),bt(this.projectionMatrix,s,n,r,e,i,o),ot(this.projectionMatrix,this.projectionMatrix,x(1,-1,1)),et(this.projectionMatrixInverse,this.projectionMatrix),this._getOrthoMatrix(),this.triggerUpdate(),this},e.setPosition=function(t,e,n){t=Jr(t,e=void 0===e?this.position[1]:e,n=void 0===n?this.position[2]:n);return this._setPosition(t),this.setFocalPoint(this.focalPoint),this.triggerUpdate(),this},e.setFocalPoint=function(t,e,n){void 0===e&&(e=this.focalPoint[1]),void 0===n&&(n=this.focalPoint[2]);var r,i=x(0,1,0);return this.focalPoint=Jr(t,e,n),this.trackingMode===Ja.CINEMATIC&&(t=(r=Pt(y(),this.focalPoint,this.position))[0],e=r[1],n=r[2],r=Mt(r),e=ei(Math.asin(e/r)),r=90+ei(Math.atan2(n,t)),st(n=K(),n,ti(r)),at(n,n,ti(e)),i=Bt(y(),[0,1,0],n)),et(this.matrix,xt(K(),this.position,this.focalPoint,i)),this._getAxes(),this._getDistance(),this._getAngles(),this.triggerUpdate(),this},e.getDistance=function(){return this.distance},e.getDistanceVector=function(){return this.distanceVector},e.setDistance=function(t){var e,n,r;return this.distance===t||t<0||(this.distance=t,this.distance<2e-4&&(this.distance=2e-4),this.dollyingStep=this.distance/100,e=y(),t=this.distance,n=this.forward,r=this.focalPoint,e[0]=t*n[0]+r[0],e[1]=t*n[1]+r[1],e[2]=t*n[2]+r[2],this._setPosition(e),this.triggerUpdate()),this},e.setMaxDistance=function(t){return this.maxDistance=t,this},e.setMinDistance=function(t){return this.minDistance=t,this},e.setAzimuth=function(t){return this.azimuth=Qr(t),this.computeMatrix(),this._getAxes(),this.type===Qa.ORBITING||this.type===Qa.EXPLORING?this._getPosition():this.type===Qa.TRACKING&&this._getFocalPoint(),this.triggerUpdate(),this},e.getAzimuth=function(){return this.azimuth},e.setElevation=function(t){return this.elevation=Qr(t),this.computeMatrix(),this._getAxes(),this.type===Qa.ORBITING||this.type===Qa.EXPLORING?this._getPosition():this.type===Qa.TRACKING&&this._getFocalPoint(),this.triggerUpdate(),this},e.getElevation=function(){return this.elevation},e.setRoll=function(t){return this.roll=Qr(t),this.computeMatrix(),this._getAxes(),this.type===Qa.ORBITING||this.type===Qa.EXPLORING?this._getPosition():this.type===Qa.TRACKING&&this._getFocalPoint(),this.triggerUpdate(),this},e.getRoll=function(){return this.roll},e._update=function(){this._getAxes(),this._getPosition(),this._getDistance(),this._getAngles(),this._getOrthoMatrix(),this.triggerUpdate()},e.computeMatrix=function(){var t=Ht(zt(),[0,0,1],ti(this.roll)),e=(J(this.matrix),Ht(zt(),[1,0,0],ti((this.rotateWorld&&this.type!==Qa.TRACKING||this.type===Qa.TRACKING?1:-1)*this.elevation))),n=Ht(zt(),[0,1,0],ti((this.rotateWorld&&this.type!==Qa.TRACKING||this.type===Qa.TRACKING?1:-1)*this.azimuth)),n=Xt(zt(),n,e),n=Xt(zt(),n,t),e=yt(K(),n);this.type===Qa.ORBITING||this.type===Qa.EXPLORING?(it(this.matrix,this.matrix,this.focalPoint),rt(this.matrix,this.matrix,e),it(this.matrix,this.matrix,[0,0,this.distance])):this.type===Qa.TRACKING&&(it(this.matrix,this.matrix,this.position),rt(this.matrix,this.matrix,e))},e._setPosition=function(t,e,n){this.position=Jr(t,e,n);t=this.matrix;t[12]=this.position[0],t[13]=this.position[1],t[14]=this.position[2],t[15]=1,this._getOrthoMatrix()},e._getAxes=function(){Rt(this.right,Jr(jt(Vt(),[1,0,0,0],this.matrix))),Rt(this.up,Jr(jt(Vt(),[0,1,0,0],this.matrix))),Rt(this.forward,Jr(jt(Vt(),[0,0,1,0],this.matrix))),It(this.right,this.right),It(this.up,this.up),It(this.forward,this.forward)},e._getAngles=function(){var t=this.distanceVector[0],e=this.distanceVector[1],n=this.distanceVector[2],r=Mt(this.distanceVector);0===r?(this.elevation=0,this.azimuth=0):this.type===Qa.TRACKING||this.rotateWorld?(this.elevation=ei(Math.asin(e/r)),this.azimuth=ei(Math.atan2(-t,-n))):(this.elevation=-ei(Math.asin(e/r)),this.azimuth=-ei(Math.atan2(-t,-n)))},e._getPosition=function(){Rt(this.position,Jr(jt(Vt(),[0,0,0,1],this.matrix))),this._getDistance()},e._getFocalPoint=function(){var t,e,n,r,i;t=this.distanceVector,e=[0,0,-this.distance],r=Y(),i=this.matrix,r[0]=i[0],r[1]=i[1],r[2]=i[2],r[3]=i[4],r[4]=i[5],r[5]=i[6],r[6]=i[8],r[7]=i[9],r[8]=i[10],i=r,r=e[0],n=e[1],e=e[2],t[0]=r*i[0]+n*i[3]+e*i[6],t[1]=r*i[1]+n*i[4]+e*i[7],t[2]=r*i[2]+n*i[5]+e*i[8],Ct(this.focalPoint,this.position,this.distanceVector),this._getDistance()},e._getDistance=function(){this.distanceVector=Pt(y(),this.focalPoint,this.position),this.distance=Mt(this.distanceVector),this.dollyingStep=this.distance/100},e._getOrthoMatrix=function(){var t,e;this.projectionMode===ts.ORTHOGRAPHIC&&(t=this.position,e=Ht(zt(),[0,0,1],-this.roll*Math.PI/180),vt(this.orthoMatrix,e,x((this.rright-this.left)/2-t[0],(this.top-this.bottom)/2-t[1],0),x(this.zoom,this.zoom,1),t))},e.triggerUpdate=function(){var t;this.enableUpdate&&(t=this.getViewTransform(),t=rt(K(),this.getPerspective(),t),this.getFrustum().extractFromVPMatrix(t),this.eventEmitter.emit(Bs))},e.rotate=function(t,e,n){throw new Error(Hr)},e.pan=function(t,e){throw new Error(Hr)},e.dolly=function(t){throw new Error(Hr)},e.createLandmark=function(t,e){throw new Error(Hr)},e.gotoLandmark=function(t,e){throw new Error(Hr)},e.cancelLandmarkAnimation=function(){throw new Error(Hr)},t}(),o=function(){function t(){}return t.prototype.update=function(t,e){t=t.r;return{width:2*t,height:2*t}},t}(),Us=function(){function t(){}return t.prototype.update=function(t,e){return{width:2*t.rx,height:2*t.ry}},t}(),a=function(){function t(){}return t.prototype.update=function(t){var e=t.x1,n=t.y1,r=t.x2,t=t.y2,i=Math.min(e,r),e=Math.max(e,r),r=Math.min(n,t);return{width:e-i,height:Math.max(n,t)-r}},t}(),Gs=function(){function t(){}return t.prototype.update=function(t){t=t.path.rect;return{width:t.width,height:t.height}},t}(),Ws=function(){function t(){}return t.prototype.update=function(t){var t=t.points.points,e=Math.min.apply(Math,t.map(function(t){return t[0]})),n=Math.max.apply(Math,t.map(function(t){return t[0]})),r=Math.min.apply(Math,t.map(function(t){return t[1]}));return{width:n-e,height:Math.max.apply(Math,t.map(function(t){return t[1]}))-r}},t}(),l=function(){function t(){}return t.prototype.update=function(t,e){var n=t.img,r=t.width,i=t.height,r=void 0===r?0:r,i=void 0===i?0:i;return n&&!Fe(n)&&(r||(r=n.width,t.width=r),i||(i=n.height,t.height=i)),{width:r,height:i}},t}(),Vs=function(){function t(t){this.globalRuntime=void 0,this.globalRuntime=t}var e=t.prototype;return e.isReadyToMeasure=function(t,e){var n=t.text,r=t.textAlign,i=t.textBaseline,o=t.fontSize,a=t.fontStyle,s=t.fontWeight,l=t.fontVariant,t=t.lineWidth;return n&&o&&a&&s&&l&&r&&i&&!M(t)},e.update=function(t,e){var n,r,i=t.text,o=t.textAlign,a=t.lineWidth,s=t.textBaseline,l=t.dx,u=t.dy,c=((null==e||null==(c=e.ownerDocument)||null==(c=c.defaultView)?void 0:c.getConfig())||{}).offscreenCanvas;return this.isReadyToMeasure(t,e)?(e=this.globalRuntime.textService.measureText(i,t,c),i=(t.metrics=e).width,c=e.height,n=e.lineHeight,e=e.fontProperties,i=[i/2,c/2,0],c=[0,1],r=0,"center"===o||"middle"===o?(r=a/2,c=[.5,1]):"right"!==o&&"end"!==o||(r=a,c=[1,1]),o=0,"middle"===s?o=i[1]:"top"===s||"hanging"===s?o=2*i[1]:"alphabetic"===s?o=ct.enableCSSParsing?n-e.ascent:0:"bottom"!==s&&"ideographic"!==s||(o=0),l&&(r+=l),u&&(o+=u),t.anchor=[c[0],c[1],0],{width:2*i[0],height:2*i[1],offsetX:r,offsetY:o}):(t.metrics={font:"",width:0,height:0,lines:[],lineWidths:[],lineHeight:0,maxLineWidth:0,fontProperties:{ascent:0,descent:0,fontSize:0},lineMetrics:[]},{width:0,height:0,x:0,y:0,offsetX:0,offsetY:0})},t}(),js=function(){function t(t,e){var u=this;this.globalRuntime=void 0,this.context=void 0,this.rootTarget=void 0,this.emitter=new qn,this.cursor="default",this.mappingTable={},this.mappingState={trackingData:{}},this.eventPool=new Map,this.pickHandler=void 0,this.tmpMatrix=K(),this.tmpVec3=y(),this.onPointerDown=function(t){var e,n=u.createPointerEvent(t);u.dispatchEvent(n,"pointerdown"),"touch"===n.pointerType?u.dispatchEvent(n,"touchstart"):"mouse"!==n.pointerType&&"pen"!==n.pointerType||(e=2===n.button,u.dispatchEvent(n,e?"rightdown":"mousedown")),u.trackingData(t.pointerId).pressTargetsByButton[t.button]=n.composedPath(),u.freeEvent(n)},this.onPointerUp=function(t){var e=performance.now(),n=u.createPointerEvent(t,void 0,void 0,u.context.config.alwaysTriggerPointerEventOnCanvas?u.rootTarget:void 0),r=(u.dispatchEvent(n,"pointerup"),"touch"===n.pointerType?u.dispatchEvent(n,"touchend"):"mouse"!==n.pointerType&&"pen"!==n.pointerType||(r=2===n.button,u.dispatchEvent(n,r?"rightup":"mouseup")),u.trackingData(t.pointerId)),i=u.findMountedTarget(r.pressTargetsByButton[t.button]),o=i;if(i&&!n.composedPath().includes(i)){for(var a,s=i;s&&!n.composedPath().includes(s);)n.currentTarget=s,u.notifyTarget(n,"pointerupoutside"),"touch"===n.pointerType?u.notifyTarget(n,"touchendoutside"):"mouse"!==n.pointerType&&"pen"!==n.pointerType||(a=2===n.button,u.notifyTarget(n,a?"rightupoutside":"mouseupoutside")),Wa.isNode(s)&&(s=s.parentNode);delete r.pressTargetsByButton[t.button],o=s}o&&((i=u.clonePointerEvent(n,"click")).target=o,i.path=[],r.clicksByButton[t.button]||(r.clicksByButton[t.button]={clickCount:0,target:i.target,timeStamp:e}),(o=r.clicksByButton[t.button]).target===i.target&&e-o.timeStamp<200?++o.clickCount:o.clickCount=1,o.target=i.target,o.timeStamp=e,i.detail=o.clickCount,null!=(r=n.detail)&&r.preventClick||(u.context.config.useNativeClickEvent||"mouse"!==i.pointerType&&"touch"!==i.pointerType||u.dispatchEvent(i,"click"),u.dispatchEvent(i,"pointertap")),u.freeEvent(i)),u.freeEvent(n)},this.onPointerMove=function(t){var e=u.createPointerEvent(t,void 0,void 0,u.context.config.alwaysTriggerPointerEventOnCanvas?u.rootTarget:void 0),n="mouse"===e.pointerType||"pen"===e.pointerType,r=u.trackingData(t.pointerId),i=u.findMountedTarget(r.overTargets);if(r.overTargets&&i!==e.target){var o="mousemove"===t.type?"mouseout":"pointerout",o=u.createPointerEvent(t,o,i||void 0);if(u.dispatchEvent(o,"pointerout"),n&&u.dispatchEvent(o,"mouseout"),!e.composedPath().includes(i)){var a=u.createPointerEvent(t,"pointerleave",i||void 0);for(a.eventPhase=a.AT_TARGET;a.target&&!e.composedPath().includes(a.target);)a.currentTarget=a.target,u.notifyTarget(a),n&&u.notifyTarget(a,"mouseleave"),Wa.isNode(a.target)&&(a.target=a.target.parentNode);u.freeEvent(a)}u.freeEvent(o)}if(i!==e.target){for(var o="mousemove"===t.type?"mouseover":"pointerover",t=u.clonePointerEvent(e,o),s=(u.dispatchEvent(t,"pointerover"),n&&u.dispatchEvent(t,"mouseover"),i&&Wa.isNode(i)&&i.parentNode);s&&s!==(Wa.isNode(u.rootTarget)&&u.rootTarget.parentNode)&&s!==e.target;)s=s.parentNode;if(!s||s===(Wa.isNode(u.rootTarget)&&u.rootTarget.parentNode)){var l=u.clonePointerEvent(e,"pointerenter");for(l.eventPhase=l.AT_TARGET;l.target&&l.target!==i&&l.target!==(Wa.isNode(u.rootTarget)&&u.rootTarget.parentNode);)l.currentTarget=l.target,u.notifyTarget(l),n&&u.notifyTarget(l,"mouseenter"),Wa.isNode(l.target)&&(l.target=l.target.parentNode);u.freeEvent(l)}u.freeEvent(t)}u.dispatchEvent(e,"pointermove"),"touch"===e.pointerType&&u.dispatchEvent(e,"touchmove"),n&&(u.dispatchEvent(e,"mousemove"),u.cursor=u.getCursor(e.target)),r.overTargets=e.composedPath(),u.freeEvent(e)},this.onPointerOut=function(t){var e=u.trackingData(t.pointerId);if(e.overTargets){var n="mouse"===t.pointerType||"pen"===t.pointerType,r=u.findMountedTarget(e.overTargets),i=u.createPointerEvent(t,"pointerout",r||void 0),o=(u.dispatchEvent(i),n&&u.dispatchEvent(i,"mouseout"),u.createPointerEvent(t,"pointerleave",r||void 0));for(o.eventPhase=o.AT_TARGET;o.target&&o.target!==(Wa.isNode(u.rootTarget)&&u.rootTarget.parentNode);)o.currentTarget=o.target,u.notifyTarget(o),n&&u.notifyTarget(o,"mouseleave"),Wa.isNode(o.target)&&(o.target=o.target.parentNode);e.overTargets=null,u.freeEvent(i),u.freeEvent(o)}u.cursor=null},this.onPointerOver=function(t){var e=u.trackingData(t.pointerId),t=u.createPointerEvent(t),n="mouse"===t.pointerType||"pen"===t.pointerType,r=(u.dispatchEvent(t,"pointerover"),n&&u.dispatchEvent(t,"mouseover"),"mouse"===t.pointerType&&(u.cursor=u.getCursor(t.target)),u.clonePointerEvent(t,"pointerenter"));for(r.eventPhase=r.AT_TARGET;r.target&&r.target!==(Wa.isNode(u.rootTarget)&&u.rootTarget.parentNode);)r.currentTarget=r.target,u.notifyTarget(r),n&&u.notifyTarget(r,"mouseenter"),Wa.isNode(r.target)&&(r.target=r.target.parentNode);e.overTargets=t.composedPath(),u.freeEvent(t),u.freeEvent(r)},this.onPointerUpOutside=function(t){var e=u.trackingData(t.pointerId),n=u.findMountedTarget(e.pressTargetsByButton[t.button]),r=u.createPointerEvent(t);if(n){for(var i=n;i;)r.currentTarget=i,u.notifyTarget(r,"pointerupoutside"),"touch"===r.pointerType||"mouse"!==r.pointerType&&"pen"!==r.pointerType||u.notifyTarget(r,2===r.button?"rightupoutside":"mouseupoutside"),Wa.isNode(i)&&(i=i.parentNode);delete e.pressTargetsByButton[t.button]}u.freeEvent(r)},this.onWheel=function(t){t=u.createWheelEvent(t);u.dispatchEvent(t),u.freeEvent(t)},this.onClick=function(t){u.context.config.useNativeClickEvent&&(t=u.createPointerEvent(t),u.dispatchEvent(t),u.freeEvent(t))},this.onPointerCancel=function(t){t=u.createPointerEvent(t,void 0,void 0,u.context.config.alwaysTriggerPointerEventOnCanvas?u.rootTarget:void 0);u.dispatchEvent(t),u.freeEvent(t)},this.globalRuntime=t,this.context=e}var e=t.prototype;return e.init=function(){this.rootTarget=this.context.renderingContext.root.parentNode,this.addEventMapping("pointerdown",this.onPointerDown),this.addEventMapping("pointerup",this.onPointerUp),this.addEventMapping("pointermove",this.onPointerMove),this.addEventMapping("pointerout",this.onPointerOut),this.addEventMapping("pointerleave",this.onPointerOut),this.addEventMapping("pointercancel",this.onPointerCancel),this.addEventMapping("pointerover",this.onPointerOver),this.addEventMapping("pointerupoutside",this.onPointerUpOutside),this.addEventMapping("wheel",this.onWheel),this.addEventMapping("click",this.onClick)},e.destroy=function(){this.emitter.removeAllListeners(),this.mappingTable={},this.mappingState={},this.eventPool.clear()},e.client2Viewport=function(t){var e=this.context.contextService.getBoundingClientRect();return new Ra(t.x-((null==e?void 0:e.left)||0),t.y-((null==e?void 0:e.top)||0))},e.viewport2Client=function(t){var e=this.context.contextService.getBoundingClientRect();return new Ra(t.x+((null==e?void 0:e.left)||0),t.y+((null==e?void 0:e.top)||0))},e.viewport2Canvas=function(t){var e=t.x,t=t.y,n=this.rootTarget.defaultView.getCamera(),r=this.context.config,i=r.width,r=r.height,o=n.getPerspectiveInverse(),n=n.getWorldTransform(),n=rt(this.tmpMatrix,n,o),o=Nt(this.tmpVec3,e/i*2-1,2*(1-t/r)-1,0);return Bt(o,o,n),new Ra(o[0],o[1])},e.canvas2Viewport=function(t){var e=this.rootTarget.defaultView.getCamera(),n=e.getPerspective(),e=e.getViewTransform(),n=rt(this.tmpMatrix,n,e),e=Nt(this.tmpVec3,t.x,t.y,0),t=(Bt(this.tmpVec3,this.tmpVec3,n),this.context.config),n=t.width,t=t.height;return new Ra((e[0]+1)/2*n,(1-(e[1]+1)/2)*t)},e.setPickHandler=function(t){this.pickHandler=t},e.addEventMapping=function(t,e){this.mappingTable[t]||(this.mappingTable[t]=[]),this.mappingTable[t].push({fn:e,priority:0}),this.mappingTable[t].sort(function(t,e){return t.priority-e.priority})},e.mapEvent=function(t){if(this.rootTarget){var e=this.mappingTable[t.type];if(e)for(var n=0,r=e.length;n<r;n++)e[n].fn(t);else console.warn("[EventService]: Event mapping not defined for "+t.type)}},e.dispatchEvent=function(t,e,n){n?(t.eventPhase=t.AT_TARGET,n=this.rootTarget.defaultView||null,t.currentTarget=n,this.notifyListeners(t,e)):(t.propagationStopped=!1,t.propagationImmediatelyStopped=!1,this.propagate(t,e)),this.emitter.emit(e||t.type,t)},e.propagate=function(t,e){if(t.target){var n=t.composedPath();t.eventPhase=t.CAPTURING_PHASE;for(var r=n.length-1;1<=r;r--)if(t.currentTarget=n[r],this.notifyTarget(t,e),t.propagationStopped||t.propagationImmediatelyStopped)return;if(t.eventPhase=t.AT_TARGET,t.currentTarget=t.target,this.notifyTarget(t,e),!t.propagationStopped&&!t.propagationImmediatelyStopped){var i=n.indexOf(t.currentTarget);t.eventPhase=t.BUBBLING_PHASE;for(var o=i+1;o<n.length;o++)if(t.currentTarget=n[o],this.notifyTarget(t,e),t.propagationStopped||t.propagationImmediatelyStopped)return}}},e.propagationPath=function(t){var e=[t],n=this.rootTarget.defaultView||null;if(n&&n===t)e.unshift(n.document);else{for(var r=0;r<2048&&t!==this.rootTarget;r++)Wa.isNode(t)&&t.parentNode&&(e.push(t.parentNode),t=t.parentNode);n&&e.push(n)}return e},e.hitTest=function(t){var e=t.viewportX,n=t.viewportY,r=this.context.config,i=r.width,r=r.height;return!(e<0||n<0||i<e||r<n)&&(this.pickHandler(t)||this.rootTarget)||null},e.isNativeEventFromCanvas=function(t){var e=this.context.contextService.getDomElement(),n=null==(n=t.nativeEvent)?void 0:n.target;if(n){if(n===e)return!0;if(e&&e.contains)return e.contains(n)}return!!t.nativeEvent.composedPath&&-1<t.nativeEvent.composedPath().indexOf(e)},e.getExistedHTML=function(t){if(t.nativeEvent.composedPath)for(var e=ar(t.nativeEvent.composedPath());!(n=e()).done;){var n=n.value,n=ct.nativeHTMLMap.get(n);if(n)return n}return null},e.pickTarget=function(t){return this.hitTest({clientX:t.clientX,clientY:t.clientY,viewportX:t.viewportX,viewportY:t.viewportY,x:t.canvasX,y:t.canvasY})},e.createPointerEvent=function(t,e,n,r){var i=this.allocateEvent($a),t=(this.copyPointerData(t,i),this.copyMouseData(t,i),this.copyData(t,i),i.nativeEvent=t.nativeEvent,i.originalEvent=t,this.getExistedHTML(i));return i.target=null!=n?n:t||this.isNativeEventFromCanvas(i)&&this.pickTarget(i)||r,"string"==typeof e&&(i.type=e),i},e.createWheelEvent=function(t){var e=this.allocateEvent(Za),t=(this.copyWheelData(t,e),this.copyMouseData(t,e),this.copyData(t,e),e.nativeEvent=t.nativeEvent,e.originalEvent=t,this.getExistedHTML(e));return e.target=t||this.isNativeEventFromCanvas(e)&&this.pickTarget(e),e},e.trackingData=function(t){return this.mappingState.trackingData[t]||(this.mappingState.trackingData[t]={pressTargetsByButton:{},clicksByButton:{},overTarget:null}),this.mappingState.trackingData[t]},e.cloneWheelEvent=function(t){var e=this.allocateEvent(Za);return e.nativeEvent=t.nativeEvent,e.originalEvent=t.originalEvent,this.copyWheelData(t,e),this.copyMouseData(t,e),this.copyData(t,e),e.target=t.target,e.path=t.composedPath().slice(),e.type=t.type,e},e.clonePointerEvent=function(t,e){var n=this.allocateEvent($a);return n.nativeEvent=t.nativeEvent,n.originalEvent=t.originalEvent,this.copyPointerData(t,n),this.copyMouseData(t,n),this.copyData(t,n),n.target=t.target,n.path=t.composedPath().slice(),n.type=null!=e?e:n.type,n},e.copyPointerData=function(t,e){e.pointerId=t.pointerId,e.width=t.width,e.height=t.height,e.isPrimary=t.isPrimary,e.pointerType=t.pointerType,e.pressure=t.pressure,e.tangentialPressure=t.tangentialPressure,e.tiltX=t.tiltX,e.tiltY=t.tiltY,e.twist=t.twist},e.copyMouseData=function(t,e){e.altKey=t.altKey,e.button=t.button,e.buttons=t.buttons,e.ctrlKey=t.ctrlKey,e.metaKey=t.metaKey,e.shiftKey=t.shiftKey,e.client.copyFrom(t.client),e.movement.copyFrom(t.movement),e.canvas.copyFrom(t.canvas),e.screen.copyFrom(t.screen),e.global.copyFrom(t.global),e.offset.copyFrom(t.offset)},e.copyWheelData=function(t,e){e.deltaMode=t.deltaMode,e.deltaX=t.deltaX,e.deltaY=t.deltaY,e.deltaZ=t.deltaZ},e.copyData=function(t,e){e.isTrusted=t.isTrusted,e.timeStamp=performance.now(),e.type=t.type,e.detail=t.detail,e.view=t.view,e.page.copyFrom(t.page),e.viewport.copyFrom(t.viewport)},e.allocateEvent=function(t){this.eventPool.has(t)||this.eventPool.set(t,[]);t=this.eventPool.get(t).pop()||new t(this);return t.eventPhase=t.NONE,t.currentTarget=null,t.path=[],t.target=null,t},e.freeEvent=function(t){if(t.manager!==this)throw new Error("It is illegal to free an event not managed by this EventBoundary!");var e=t.constructor;this.eventPool.has(e)||this.eventPool.set(e,[]),this.eventPool.get(e).push(t)},e.notifyTarget=function(t,e){e=null!=(n=e)?n:t.type;var n=t.eventPhase===t.CAPTURING_PHASE||t.eventPhase===t.AT_TARGET?e+"capture":e;this.notifyListeners(t,n),t.eventPhase===t.AT_TARGET&&this.notifyListeners(t,e)},e.notifyListeners=function(t,e){var n=t.currentTarget.emitter,r=n._events[e];if(r)if("fn"in r)r.once&&n.removeListener(e,r.fn,void 0,!0),r.fn.call(t.currentTarget||r.context,t);else for(var i=0;i<r.length&&!t.propagationImmediatelyStopped;i++)r[i].once&&n.removeListener(e,r[i].fn,void 0,!0),r[i].fn.call(t.currentTarget||r[i].context,t)},e.findMountedTarget=function(t){if(!t)return null;for(var e=t[t.length-1],n=t.length-2;0<=n;n--){var r=t[n];if(!(r===this.rootTarget||Wa.isNode(r)&&r.parentNode===e))break;e=t[n]}return e},e.getCursor=function(t){for(var e=t;e;){var n=Ka.isElement(e)&&e.getAttribute("cursor");if(n)return n;e=Wa.isNode(e)&&e.parentNode}},t}(),zs=function(){function t(){this.canvas=void 0,this.context=void 0}var e=t.prototype;return e.getOrCreateCanvas=function(t,e){if(!this.canvas){if(t)this.canvas=t,this.context=this.canvas.getContext("2d",e);else try{this.canvas=new window.OffscreenCanvas(0,0),this.context=this.canvas.getContext("2d",e),this.context&&this.context.measureText||(this.canvas=document.createElement("canvas"),this.context=this.canvas.getContext("2d"))}catch(t){this.canvas=document.createElement("canvas"),this.context=this.canvas.getContext("2d",e)}this.canvas.width=10,this.canvas.height=10}return this.canvas},e.getOrCreateContext=function(t,e){return this.context||this.getOrCreateCanvas(t,e),this.context},t}(),Hs=((Ys=Ds=Ds||{})[Ys.CAMERA_CHANGED=0]="CAMERA_CHANGED",Ys[Ys.DISPLAY_OBJECT_CHANGED=1]="DISPLAY_OBJECT_CHANGED",Ys[Ys.NONE=2]="NONE",function(){function t(t,e){this.globalRuntime=void 0,this.context=void 0,this.inited=!1,this.stats={total:0,rendered:0},this.zIndexCounter=0,this.renderOrderChangedEvent=new Ga(v.RENDER_ORDER_CHANGED),this.hooks={init:new Qi,dirtycheck:new eo,cull:new eo,beginFrame:new to,beforeRender:new to,render:new to,afterRender:new to,endFrame:new to,destroy:new to,pick:new Ji,pickSync:new eo,pointerDown:new to,pointerUp:new to,pointerMove:new to,pointerOut:new to,pointerOver:new to,pointerWheel:new to,pointerCancel:new to,click:new to},this.globalRuntime=t,this.context=e}var e=t.prototype;return e.init=function(){var t=Qn($n().mark(function t(){var e;return $n().wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return e=d({},this.globalRuntime,this.context),this.context.renderingPlugins.forEach(function(t){t.apply(e,ct)}),t.next=4,this.hooks.init.promise();case 4:this.inited=!0;case 5:case"end":return t.stop()}},t,this)}));return function(){return t.apply(this,arguments)}}(),e.getStats=function(){return this.stats},e.disableDirtyRectangleRendering=function(){return!this.context.config.renderer.getConfig().enableDirtyRectangleRendering||this.context.renderingContext.renderReasons.has(Ds.CAMERA_CHANGED)},e.render=function(t,e){var n=this,r=(this.stats.total=0,this.stats.rendered=0,this.zIndexCounter=0,this.context.renderingContext);this.globalRuntime.sceneGraphService.syncHierarchy(r.root),this.globalRuntime.sceneGraphService.triggerPendingEvents(),r.renderReasons.size&&this.inited&&(this.renderDisplayObject(r.root,t,r),this.hooks.beginFrame.call(),r.renderListCurrentFrame.forEach(function(t){n.hooks.beforeRender.call(t),n.hooks.render.call(t),n.hooks.afterRender.call(t)}),this.hooks.endFrame.call(),r.renderListCurrentFrame=[],r.renderReasons.clear(),e())},e.renderDisplayObject=function(t,e,n){var r=this,i=e.renderer.getConfig(),o=i.enableDirtyCheck,i=i.enableCulling,o=(this.globalRuntime.enableCSSParsing&&this.globalRuntime.styleValueRegistry.recalc(t),o?this.hooks.dirtycheck.call(t):t),o=(o&&(i=i?this.hooks.cull.call(o,this.context.camera):o)&&(this.stats.rendered++,n.renderListCurrentFrame.push(i)),t.renderable.dirty=!1,t.sortable.renderOrder=this.zIndexCounter++,this.stats.total++,t.sortable),i=!1;o.dirty&&(o.sorted=t.childNodes.slice().sort(Gr),o.dirty=!(i=!0)),(o.sorted||t.childNodes).forEach(function(t){r.renderDisplayObject(t,e,n)}),i&&t.forEach(function(t){r.renderOrderChangedEvent.target=t,r.renderOrderChangedEvent.detail={renderOrder:t.sortable.renderOrder},t.ownerDocument.defaultView.dispatchEvent(r.renderOrderChangedEvent,!0)})},e.destroy=function(){this.inited=!1,this.hooks.destroy.call(),this.globalRuntime.sceneGraphService.clearPendingEvents()},e.dirtify=function(){this.context.renderingContext.renderReasons.add(Ds.DISPLAY_OBJECT_CHANGED)},t}()),Xs=/\[\s*(.*)=(.*)\s*\]/,Ys=function(){function t(){}var e=t.prototype;return e.selectOne=function(e,n){var t,r,i,o=this;return e.startsWith(".")?n.find(function(t){return-1<((null==t?void 0:t.classList)||[]).indexOf(o.getIdOrClassname(e))}):e.startsWith("#")?n.find(function(t){return t.id===o.getIdOrClassname(e)}):e.startsWith("[")?(t=this.getAttribute(e),r=t.name,i=t.value,r?n.find(function(t){return n!==t&&("name"===r?t.name===i:o.attributeToString(t,r)===i)}):null):n.find(function(t){return n!==t&&t.nodeName===e})},e.selectAll=function(e,n){var t,r,i,o=this;return e.startsWith(".")?n.findAll(function(t){return n!==t&&-1<((null==t?void 0:t.classList)||[]).indexOf(o.getIdOrClassname(e))}):e.startsWith("#")?n.findAll(function(t){return n!==t&&t.id===o.getIdOrClassname(e)}):e.startsWith("[")?(t=this.getAttribute(e),r=t.name,i=t.value,r?n.findAll(function(t){return n!==t&&("name"===r?t.name===i:o.attributeToString(t,r)===i)}):[]):n.findAll(function(t){return n!==t&&t.nodeName===e})},e.is=function(t,e){var n,r;return t.startsWith(".")?e.className===this.getIdOrClassname(t):t.startsWith("#")?e.id===this.getIdOrClassname(t):t.startsWith("[")?(n=(r=this.getAttribute(t)).name,r=r.value,"name"===n?e.name===r:this.attributeToString(e,n)===r):e.nodeName===t},e.getIdOrClassname=function(t){return t.substring(1)},e.getAttribute=function(t){var t=t.match(Xs),e="",n="";return t&&2<t.length&&(e=t[1].replace(/"/g,""),n=t[2].replace(/"/g,"")),{name:e,value:n}},e.attributeToString=function(t,e){return t.getAttribute&&(t=t.getAttribute(e),!M(t))&&t.toString?t.toString():""},t}();function Ks(t){t=t.renderable;t&&(t.renderBoundsDirty=!0,t.boundsDirty=!0)}var qs,$s=new ja(v.REPARENT,null,"","","",0,"",""),Zs=function(){function t(t){var a,i,o,r,s,l,u,c,h,n,d,f,g=this;this.runtime=void 0,this.pendingEvents=[],this.boundsChangedEvent=new Ga(v.BOUNDS_CHANGED),this.rotate=(a=zt(),function(t,e,n,r){void 0===n&&(n=0),void 0===r&&(r=0),"number"==typeof e&&(e=x(e,n,r));var i,o,n=t.transformable;null!==t.parentNode&&t.parentNode.transformable?(Kt(r=zt(),e[0],e[1],e[2]),i=g.getRotation(t),o=g.getRotation(t.parentNode),$t(a,o),Yt(a,a),Xt(r,a,r),Xt(n.localRotation,r,i),Qt(n.localRotation,n.localRotation),g.dirtifyLocal(t,n)):g.rotateLocal(t,e)}),this.rotateLocal=(i=zt(),function(t,e,n,r){void 0===n&&(n=0),void 0===r&&(r=0),"number"==typeof e&&(e=x(e,n,r));n=t.transformable;Kt(i,e[0],e[1],e[2]),Zt(n.localRotation,n.localRotation,i),g.dirtifyLocal(t,n)}),this.setEulerAngles=(o=zt(),function(t,e,n,r){void 0===n&&(n=0),void 0===r&&(r=0),"number"==typeof e&&(e=x(e,n,r));n=t.transformable;null!==t.parentNode&&t.parentNode.transformable?(Kt(n.localRotation,e[0],e[1],e[2]),r=g.getRotation(t.parentNode),$t(o,Yt(zt(),r)),Zt(n.localRotation,n.localRotation,o),g.dirtifyLocal(t,n)):g.setLocalEulerAngles(t,e)}),this.translateLocal=function(t,e,n,r){void 0===n&&(n=0),void 0===r&&(r=0),"number"==typeof e&&(e=x(e,n,r));var i,o,a,s,l,u,c,h,d,f,p,n=t.transformable;Ft(e,y())||(i=r=e,o=n.localRotation,a=o[0],s=o[1],l=o[2],o=o[3],u=i[0],c=i[1],i=i[2],p=s*(f=a*c-s*u)-l*(d=l*u-a*i),l=l*(h=s*i-l*c)-a*f,a=a*d-s*h,d*=s=2*o,f*=s,l*=2,a*=2,r[0]=u+(h*=s)+(p*=2),r[1]=c+d+l,r[2]=i+f+a,Ct(n.localPosition,n.localPosition,e),g.dirtifyLocal(t,n))},this.setPosition=(r=K(),s=y(),function(t,e){var n=t.transformable;s[0]=e[0],s[1]=e[1],s[2]=e[2]||0,Ft(g.getPosition(t),s)||(Rt(n.position,s),null!==t.parentNode&&t.parentNode.transformable?(e=t.parentNode.transformable,$(r,e.worldTransform),et(r,r),Bt(n.localPosition,s,r)):Rt(n.localPosition,s),g.dirtifyLocal(t,n))}),this.setLocalPosition=(l=y(),function(t,e){var n=t.transformable;l[0]=e[0],l[1]=e[1],l[2]=e[2]||0,Ft(n.localPosition,l)||(Rt(n.localPosition,l),g.dirtifyLocal(t,n))}),this.translate=(u=y(),c=y(),h=y(),function(t,e,n,r){void 0===n&&(n=0),void 0===r&&(r=0),Ft(e="number"==typeof e?Nt(c,e,n,r):e,u)||(Ct(h,g.getPosition(t),e),g.setPosition(t,h))}),this.setRotation=function(){var a=zt();return function(t,e,n,r,i){var o=t.transformable;"number"==typeof e&&(e=qt(e,n,r,i)),null!==t.parentNode&&t.parentNode.transformable?(n=g.getRotation(t.parentNode),$t(a,n),Yt(a,a),Xt(o.localRotation,a,e),Qt(o.localRotation,o.localRotation),g.dirtifyLocal(t,o)):g.setLocalRotation(t,e)}},this.displayObjectDependencyMap=new WeakMap,this.calcLocalTransform=(n=K(),d=y(),f=qt(0,0,0,1),function(t){var e;0!==t.localSkew[0]||0!==t.localSkew[1]?(vt(t.localTransform,t.localRotation,t.localPosition,x(1,1,1),t.origin),0===t.localSkew[0]&&0===t.localSkew[1]||((e=J(n))[4]=Math.tan(t.localSkew[0]),e[1]=Math.tan(t.localSkew[1]),rt(t.localTransform,t.localTransform,e)),e=vt(n,f,d,t.localScale,t.origin),rt(t.localTransform,t.localTransform,e)):vt(t.localTransform,t.localRotation,t.localPosition,t.localScale,t.origin)}),this.runtime=t}var e=t.prototype;return e.matches=function(t,e){return this.runtime.sceneGraphSelector.is(t,e)},e.querySelector=function(t,e){return this.runtime.sceneGraphSelector.selectOne(t,e)},e.querySelectorAll=function(t,e){return this.runtime.sceneGraphSelector.selectAll(t,e)},e.attach=function(t,e,n){var r=!1,n=(t.parentNode&&(r=t.parentNode!==e,this.detach(t)),t.parentNode=e,M(n)?t.parentNode.childNodes.push(t):t.parentNode.childNodes.splice(n,0,t),e.sortable),e=((null!=n&&null!=(e=n.sorted)&&e.length||null!=(e=t.style)&&e.zIndex)&&(n.dirty=!0),t.transformable);e&&this.dirtifyWorld(t,e),e.frozen&&this.unfreezeParentToRoot(t),r&&t.dispatchEvent($s)},e.detach=function(t){var e,n,r;t.parentNode&&(e=t.transformable,(null!=(n=t.parentNode.sortable)&&null!=(r=n.sorted)&&r.length||null!=(r=t.style)&&r.zIndex)&&(n.dirty=!0),-1<(r=t.parentNode.childNodes.indexOf(t))&&t.parentNode.childNodes.splice(r,1),e&&this.dirtifyWorld(t,e),t.parentNode=null)},e.getOrigin=function(t){return t.transformable.origin},e.setOrigin=function(t,e,n,r){void 0===n&&(n=0),void 0===r&&(r=0);var i=t.transformable;(e="number"==typeof e?[e,n,r]:e)[0]===i.origin[0]&&e[1]===i.origin[1]&&e[2]===i.origin[2]||((n=i.origin)[0]=e[0],n[1]=e[1],n[2]=e[2]||0,this.dirtifyLocal(t,i))},e.setLocalEulerAngles=function(t,e,n,r){void 0===n&&(n=0),void 0===r&&(r=0),"number"==typeof e&&(e=x(e,n,r));n=t.transformable;Kt(n.localRotation,e[0],e[1],e[2]),this.dirtifyLocal(t,n)},e.scaleLocal=function(t,e){var n,r,i=t.transformable;n=i.localScale,r=i.localScale,e=x(e[0],e[1],e[2]||1),n[0]=r[0]*e[0],n[1]=r[1]*e[1],n[2]=r[2]*e[2],this.dirtifyLocal(t,i)},e.setLocalScale=function(t,e){var n=t.transformable,e=x(e[0],e[1],e[2]||n.localScale[2]);Ft(e,n.localScale)||(Rt(n.localScale,e),this.dirtifyLocal(t,n))},e.setLocalRotation=function(t,e,n,r,i){"number"==typeof e&&(e=qt(e,n,r,i));n=t.transformable;$t(n.localRotation,e),this.dirtifyLocal(t,n)},e.setLocalSkew=function(t,e,n){"number"==typeof e&&(i=e,n=n,(r=new X(2))[0]=i,r[1]=n,e=r);var r,i=t.transformable;n=i.localSkew,r=e,n[0]=r[0],n[1]=r[1],this.dirtifyLocal(t,i)},e.dirtifyLocal=function(t,e){e.localDirtyFlag||(e.localDirtyFlag=!0,e.dirtyFlag)||this.dirtifyWorld(t,e)},e.dirtifyWorld=function(t,e){e.dirtyFlag||this.unfreezeParentToRoot(t),this.dirtifyWorldInternal(t,e),this.dirtifyToRoot(t,!0)},e.triggerPendingEvents=function(){function r(t,e){t.isConnected&&!i.has(t.entity)&&(n.boundsChangedEvent.detail=e,(n.boundsChangedEvent.target=t).isMutationObserved?t.dispatchEvent(n.boundsChangedEvent):t.ownerDocument.defaultView.dispatchEvent(n.boundsChangedEvent,!0),i.add(t.entity))}var n=this,i=new Set;this.pendingEvents.forEach(function(t){var e=t[0],n=t[1];n.affectChildren?e.forEach(function(t){r(t,n)}):r(e,n)}),this.clearPendingEvents(),i.clear()},e.clearPendingEvents=function(){this.pendingEvents=[]},e.dirtifyToRoot=function(t,e){void 0===e&&(e=!1);var n=t;for(n.renderable&&(n.renderable.dirty=!0);n;)Ks(n),n=n.parentNode;e&&t.forEach(function(t){Ks(t)}),this.informDependentDisplayObjects(t),this.pendingEvents.push([t,{affectChildren:e}])},e.updateDisplayObjectDependency=function(t,e,n,r){var i;e&&e!==n&&(e=this.displayObjectDependencyMap.get(e))&&e[t]&&(i=e[t].indexOf(r),e[t].splice(i,1)),n&&((e=this.displayObjectDependencyMap.get(n))||(this.displayObjectDependencyMap.set(n,{}),e=this.displayObjectDependencyMap.get(n)),e[t]||(e[t]=[]),e[t].push(r))},e.informDependentDisplayObjects=function(t){var n=this,r=this.displayObjectDependencyMap.get(t);r&&Object.keys(r).forEach(function(e){r[e].forEach(function(t){n.dirtifyToRoot(t,!0),t.dispatchEvent(new ja(v.ATTR_MODIFIED,t,n,n,e,ja.MODIFICATION,n,n)),t.isCustomElement&&t.isConnected&&t.attributeChangedCallback&&t.attributeChangedCallback(e,n,n)})})},e.getPosition=function(t){var e=t.transformable;return pt(e.position,this.getWorldTransform(t,e))},e.getRotation=function(t){var e=t.transformable;return mt(e.rotation,this.getWorldTransform(t,e))},e.getScale=function(t){var e=t.transformable;return gt(e.scaling,this.getWorldTransform(t,e))},e.getWorldTransform=function(t,e){return((e=void 0===e?t.transformable:e).localDirtyFlag||e.dirtyFlag)&&(t.parentNode&&t.parentNode.transformable&&this.getWorldTransform(t.parentNode),this.sync(t,e)),e.worldTransform},e.getLocalPosition=function(t){return t.transformable.localPosition},e.getLocalRotation=function(t){return t.transformable.localRotation},e.getLocalScale=function(t){return t.transformable.localScale},e.getLocalSkew=function(t){return t.transformable.localSkew},e.getLocalTransform=function(t){t=t.transformable;return t.localDirtyFlag&&(this.calcLocalTransform(t),t.localDirtyFlag=!1),t.localTransform},e.setLocalTransform=function(t,e){var n=pt(y(),e),r=mt(zt(),e),e=gt(y(),e);this.setLocalScale(t,e),this.setLocalPosition(t,n),this.setLocalRotation(t,r)},e.resetLocalTransform=function(t){this.setLocalScale(t,[1,1,1]),this.setLocalPosition(t,[0,0,0]),this.setLocalEulerAngles(t,[0,0,0]),this.setLocalSkew(t,[0,0])},e.getTransformedGeometryBounds=function(t,e,n){e=this.getGeometryBounds(t,e=void 0===e?!1:e);return Ta.isEmpty(e)?null:((n=n||new Ta).setFromTransformedAABB(e,this.getWorldTransform(t)),n)},e.getGeometryBounds=function(t,e){t=t.geometry;return((e=void 0===e?!1:e)?t.renderBounds:t.contentBounds||null)||new Ta},e.getBounds=function(t,e){var n,r,i=this,o=(void 0===e&&(e=!1),t.renderable);return o.boundsDirty||e||!o.bounds?!o.renderBoundsDirty&&e&&o.renderBounds?o.renderBounds:(n=e?o.renderBounds:o.bounds,r=this.getTransformedGeometryBounds(t,e,n),t.childNodes.forEach(function(t){t=i.getBounds(t,e);t&&(r?r.add(t):(r=n||new Ta).update(t.center,t.halfExtents))}),e&&(t=Wr(t))&&(t=t.parsedStyle.clipPath.getBounds(e),r?t&&(r=t.intersection(r)):r=t),(r=r||new Ta)&&(e?o.renderBounds=r:o.bounds=r),e?o.renderBoundsDirty=!1:o.boundsDirty=!1,r):o.bounds},e.getLocalBounds=function(t){if(t.parentNode){var e,n=K(),r=(t.parentNode.transformable&&(n=et(K(),this.getWorldTransform(t.parentNode))),this.getBounds(t));if(!Ta.isEmpty(r))return(e=new Ta).setFromTransformedAABB(r,n),e}return this.getBounds(t)},e.getBoundingClientRect=function(t){var e,n,r,i=this.getGeometryBounds(t),i=(Ta.isEmpty(i)||(r=new Ta).setFromTransformedAABB(i,this.getWorldTransform(t)),null==(i=t.ownerDocument)||null==(t=i.defaultView)?void 0:t.getContextService().getBoundingClientRect());return r?(e=(t=r.getMin())[0],t=t[1],n=(r=r.getMax())[0],r=r[1],new Na(e+((null==i?void 0:i.left)||0),t+((null==i?void 0:i.top)||0),n-e,r-t)):new Na((null==i?void 0:i.left)||0,(null==i?void 0:i.top)||0,0,0)},e.dirtifyWorldInternal=function(t,e){var n=this;!e.dirtyFlag&&(e.dirtyFlag=!0,e.frozen=!1,t.childNodes.forEach(function(t){var e=t.transformable;e.dirtyFlag||n.dirtifyWorldInternal(t,e)}),e=t.renderable)&&(e.renderBoundsDirty=!0,e.boundsDirty=!0,e.dirty=!0)},e.syncHierarchy=function(t){var e=t.transformable;if(!e.frozen){e.frozen=!0,(e.localDirtyFlag||e.dirtyFlag)&&this.sync(t,e);for(var n=t.childNodes,r=0;r<n.length;r++)this.syncHierarchy(n[r])}},e.sync=function(t,e){var n;e.localDirtyFlag&&(this.calcLocalTransform(e),e.localDirtyFlag=!1),e.dirtyFlag&&(n=(t=t.parentNode)&&t.transformable,null!==t&&n?rt(e.worldTransform,n.worldTransform,e.localTransform):$(e.worldTransform,e.localTransform),e.dirtyFlag=!1)},e.unfreezeParentToRoot=function(t){for(var e=t.parentNode;e;){var n=e.transformable;n&&(n.frozen=!1),e=e.parentNode}},t}(),Qs={MetricsString:"|ÉqÅ",BaselineSymbol:"M",BaselineMultiplier:1.4,HeightMultiplier:2,Newlines:[10,13],BreakingSpaces:[9,32,8192,8193,8194,8195,8196,8197,8198,8200,8201,8202,8287,12288]},Js=/[a-zA-Z0-9\u00C0-\u00D6\u00D8-\u00f6\u00f8-\u00ff!"#$%&'()*+,-./:;]/,tl=new RegExp(/[!%),.:;?\]}¢°·'""†‡›℃∶、。〃〆〕〗〞﹚﹜!"%'),.:;?!]}~]/.source+"|"+/[!),.:;?\]}¢·–—'"•"、。〆〞〕〉》」︰︱︲︳﹐﹑﹒﹔﹕﹖﹘﹚﹜!),.:;?︶︸︺︼︾﹀﹂﹗]|}、]/.source+"|"+/[)\]}〕〉》」』】〙〗〟'"⦆»ヽヾーァィゥェォッャュョヮヵヶぁぃぅぇぉっゃゅょゎゕゖㇰㇱㇲㇳㇴㇵㇶㇷㇸㇹㇺㇻㇼㇽㇾㇿ々〻‐゠–〜?!‼⁇⁈⁉・、:;,。.]/.source+"|"+/[!%),.:;?\]}¢°'"†‡℃〆〈《「『〕!%),.:;?]}]/.source),el=new RegExp(/[$(£¥·'"〈《「『【〔〖〝﹙﹛$(.[{£¥]/.source+"|"+/[([{£¥'"‵〈《「『〔〝︴﹙﹛({︵︷︹︻︽︿﹁﹃﹏]/.source+"|"+/[([{〔〈《「『【〘〖〝'"⦅«—...‥〳〴〵]/.source+"|"+/[$([{£¥'"々〇〉》」〔$([{⦆¥₩#]/.source),nl=function(){function t(t){var n=this;this.runtime=void 0,this.fontMetricsCache={},this.shouldBreakByKinsokuShorui=function(t,e){return!n.isBreakingSpace(e)&&!(!t||!el.exec(e)&&!tl.exec(t))},this.trimByKinsokuShorui=function(t){var e,n=[].concat(t),r=n[n.length-2];return r?(e=r[r.length-1],n[n.length-2]=r.slice(0,-1),n[n.length-1]=e+n[n.length-1],n):t},this.runtime=t}var e=t.prototype;return e.measureFont=function(t,e){if(this.fontMetricsCache[t])return this.fontMetricsCache[t];for(var n={ascent:0,descent:0,fontSize:0},r=this.runtime.offscreenCanvas.getOrCreateCanvas(e),e=this.runtime.offscreenCanvas.getOrCreateContext(e),i=(e.font=t,Qs.MetricsString+Qs.BaselineSymbol),o=Math.ceil(e.measureText(i).width),a=Math.ceil(e.measureText(Qs.BaselineSymbol).width),s=Qs.HeightMultiplier*a,a=a*Qs.BaselineMultiplier|0,l=(r.width=o,r.height=s,e.fillStyle="#f00",e.fillRect(0,0,o,s),e.font=t,e.textBaseline="alphabetic",e.fillStyle="#000",e.fillText(i,0,a),e.getImageData(0,0,o||1,s||1).data),r=l.length,u=4*o,c=0,h=0,d=!1,c=0;c<a;++c){for(var f=0;f<u;f+=4)if(255!==l[h+f]){d=!0;break}if(d)break;h+=u}for(n.ascent=a-c,h=r-u,d=!1,c=s;a<c;--c){for(var p=0;p<u;p+=4)if(255!==l[h+p]){d=!0;break}if(d)break;h-=u}return n.descent=c-a,n.fontSize=n.ascent+n.descent,this.fontMetricsCache[t]=n},e.measureText=function(t,e,n){var r=e.fontSize,i=e.wordWrap,o=e.lineHeight,a=e.lineWidth,s=e.textBaseline,l=e.textAlign,u=e.letterSpacing,c=e.textPath,h=(e.textPathSide,e.textPathStartOffset,e.leading),h=void 0===h?0:h,d=function(t){for(var e=t.fontSize,n=t.fontFamily,r=t.fontStyle,i=t.fontVariant,t=t.fontWeight,e=B(e)&&e+"px"||"16px",o=n.split(","),a=o.length-1;0<=a;a--){var s=o[a].trim();!ro.test(s)&&no.indexOf(s)<0&&(s='"'+s+'"'),o[a]=s}return r+" "+i+" "+t+" "+e+" "+o.join(",")}(e),f=this.measureFont(d,n),p=(0===f.fontSize&&(f.fontSize=r,f.ascent=r),this.runtime.offscreenCanvas.getOrCreateContext(n));p.font=d,e.isOverflowing=!1;var g=(i?this.wordWrap(t,e,n):t).split(/(?:\r\n|\r|\n)/),m=new Array(g.length),v=0;if(!c){for(var y=0;y<g.length;y++){var E=p.measureText(g[y]).width+(g[y].length-1)*u;m[y]=E,v=Math.max(v,E)}var r=v+a,_=o||f.fontSize+a,i=Math.max(_,f.fontSize+a)+(g.length-1)*(_+h),b=0;return"middle"===s?b=-i/2:"bottom"===s||"alphabetic"===s||"ideographic"===s?b=-i:"top"!==s&&"hanging"!==s||(b=0),{font:d,width:r,height:i,lines:g,lineWidths:m,lineHeight:_+=h,maxLineWidth:v,fontProperties:f,lineMetrics:m.map(function(t,e){var n=0;return"center"===l||"middle"===l?n-=t/2:"right"!==l&&"end"!==l||(n-=t),new Na(n-a/2,b+e*_,t+a,_)})}}c.getTotalLength();for(var x=0;x<g.length;x++)p.measureText(g[x]).width,g[x].length},e.setGraphemeOnPath=function(){},e.wordWrap=function(t,e,n){for(var r=this,i=e.wordWrapWidth,i=void 0===i?0:i,o=e.letterSpacing,a=e.maxLines,s=void 0===a?1/0:a,a=e.textOverflow,l=this.runtime.offscreenCanvas.getOrCreateContext(n),u=i+o,c="",h=("ellipsis"===a?c="...":a&&"clip"!==a&&(c=a),[]),d=0,f=0,p={},g=function(t){return r.getFromCache(t,o,p,l)},m=Array.from(c).reduce(function(t,e){return t+g(e)},0),v=Array.from(t),y=0;y<v.length;y++){var E=v[y],_=t[y-1],b=t[y+1],x=g(E);if(this.isNewline(E)){if(s<=++d){e.isOverflowing=!0;break}f=0,h[d]=""}else{if(0<f&&u<f+x){if(s<=d+1){if(e.isOverflowing=!0,0<m&&m<=u){for(var S=h[d].length,w=0,T=S,A=0;A<S;A++){var M=g(h[d][A]);if(u<w+M+m){T=A;break}w+=M}h[d]=(h[d]||"").slice(0,T)+c}break}if(f=0,h[++d]="",this.isBreakingSpace(E))continue;this.canBreakInLastChar(E)||(h=this.trimToBreakable(h),f=this.sumTextWidthByCache(h[d]||"",p)),this.shouldBreakByKinsokuShorui(E,b)&&(h=this.trimByKinsokuShorui(h),f+=g(_||""))}f+=x,h[d]=(h[d]||"")+E}}return h.join("\n")},e.isBreakingSpace=function(t){return"string"==typeof t&&0<=Qs.BreakingSpaces.indexOf(t.charCodeAt(0))},e.isNewline=function(t){return"string"==typeof t&&0<=Qs.Newlines.indexOf(t.charCodeAt(0))},e.trimToBreakable=function(t){var e,t=[].concat(t),n=t[t.length-2],r=this.findBreakableIndex(n);return-1!==r&&n&&(e=n.slice(r,r+1),e=r+(this.isBreakingSpace(e)?0:1),t[t.length-1]+=n.slice(r+1,n.length),t[t.length-2]=n.slice(0,e)),t},e.canBreakInLastChar=function(t){return!t||!Js.test(t)},e.sumTextWidthByCache=function(t,n){return t.split("").reduce(function(t,e){if(n[e])return t+n[e];throw Error("cannot count the word without cache")},0)},e.findBreakableIndex=function(t){for(var e=t.length-1;0<=e;e--)if(!Js.test(t[e]))return e;return-1},e.getFromCache=function(t,e,n,r){var i=n[t];return"number"!=typeof i&&(e=t.length*e,i=r.measureText(t).width+e,n[t]=i),i},t}(),ct={},o=(l=new l,Ws=new Ws,(E={})[lt.CIRCLE]=new o,E[lt.ELLIPSE]=new Us,E[lt.RECT]=l,E[lt.IMAGE]=l,E[lt.GROUP]=l,E[lt.LINE]=new a,E[lt.TEXT]=new Vs(ct),E[lt.POLYLINE]=Ws,E[lt.POLYGON]=Ws,E[lt.PATH]=new Gs,E[lt.HTML]=null,E[lt.MESH]=null,E),Vs=(Us=new n,l=new ya,(a={})[b.PERCENTAGE]=null,a[b.NUMBER]=new Sa,a[b.ANGLE]=new t,a[b.DEFINED_PATH]=new e,a[b.PAINT]=Us,a[b.COLOR]=Us,a[b.FILTER]=new pa,a[b.LENGTH]=l,a[b.LENGTH_PERCENTAGE]=l,a[b.LENGTH_PERCENTAGE_12]=new Ea,a[b.LENGTH_PERCENTAGE_14]=new _a,a[b.COORDINATE]=new ba,a[b.OFFSET_DISTANCE]=new r,a[b.OPACITY_VALUE]=new wa,a[b.PATH]=new Ca,a[b.LIST_OF_POINTS]=new Pa,a[b.SHADOW_BLUR]=new Oa,a[b.TEXT]=new Ia,a[b.TEXT_TRANSFORM]=new La,a[b.TRANSFORM]=new ka,a[b.TRANSFORM_ORIGIN]=new ma,a[b.Z_INDEX]=new Da,a[b.MARKER]=new xa,a),Ws=(ct.CameraContribution=Fs,ct.AnimationTimeline=null,ct.EasingFunction=null,ct.offscreenCanvas=new zs,ct.nativeHTMLMap=new WeakMap,ct.sceneGraphSelector=new Ys,ct.sceneGraphService=new Zs(ct),ct.textService=new nl(ct),ct.geometryUpdaterFactory=o,ct.CSSPropertySyntaxFactory=Vs,ct.styleValueRegistry=new ks,ct.layoutRegistry=null,ct.globalThis=function(){if("undefined"!=typeof globalThis)return globalThis;if("undefined"!=typeof self)return self;if("undefined"!=typeof window)return window;if(void 0!==V)return V;throw new Error("Unable to locate global `this`")}(),ct.enableCSSParsing=!0,ct.enableDataset=!1,ct.enableStyleSyntax=!0,function(){function t(){this.context=void 0,this.plugins=[]}var e=t.prototype;return e.addRenderingPlugin=function(t){this.plugins.push(t),this.context.renderingPlugins.push(t)},e.removeAllRenderingPlugins=function(){var e=this;this.plugins.forEach(function(t){t=e.context.renderingPlugins.indexOf(t);0<=t&&e.context.renderingPlugins.splice(t,1)})},t}()),Gs=function(){function t(t){this.plugins=[],this.config=void 0,this.config=d({enableDirtyCheck:!0,enableCulling:!1,enableAutoRendering:!0,enableDirtyRectangleRendering:!0,enableDirtyRectangleRenderingDebug:!1},t)}var e=t.prototype;return e.registerPlugin=function(e){-1===this.plugins.findIndex(function(t){return t===e})&&this.plugins.push(e)},e.unregisterPlugin=function(e){var t=this.plugins.findIndex(function(t){return t===e});-1<t&&this.plugins.splice(t,1)},e.getPlugins=function(){return this.plugins},e.getPlugin=function(e){return this.plugins.find(function(t){return t.name===e})},e.getConfig=function(){return this.config},e.setConfig=function(t){Object.assign(this.config,t)},t}(),rl=function(){function o(t){this.strategies=void 0,this.strategies=t}return o.prototype.apply=function(t){var n=t.camera,e=t.renderingService,r=t.renderingContext,i=this.strategies;e.hooks.cull.tap(o.tag,function(e){var t;return e&&(t=e.cullable,0===i.length?t.visible=-1<r.unculledEntities.indexOf(e.entity):t.visible=i.every(function(t){return t.isVisible(n,e)}),!e.isCulled()&&e.isVisible()?e:(e.dispatchEvent(new Ga(v.CULLED)),null))}),e.hooks.afterRender.tap(o.tag,function(t){t.cullable.visibilityPlaneMask=-1})},o}(),il=(rl.tag="Culling",function(){function n(){}return n.prototype.apply=function(t){var e=t.renderingService;e.hooks.dirtycheck.tap(n.tag,function(t){return t&&(t.renderable.dirty||e.disableDirtyRectangleRendering()?t:null)})},n}()),ol=(il.tag="DirtyCheck",function(){function e(){var o=this;this.autoPreventDefault=!1,this.rootPointerEvent=new $a(null),this.rootWheelEvent=new Za(null),this.context=void 0,this.onPointerMove=function(t){var e,n=null==(e=o.context.renderingContext.root)||null==(e=e.ownerDocument)?void 0:e.defaultView;if(!n.supportsTouchEvents||"touch"!==t.pointerType){for(var r=ar(o.normalizeToPointerEvent(t,n));!(i=r()).done;){var i=i.value,i=o.bootstrapEvent(o.rootPointerEvent,i,n,t);o.context.eventService.mapEvent(i)}o.setCursor(o.context.eventService.cursor)}}}var t=e.prototype;return t.apply=function(t){var o=this,t=(this.context=t).renderingService,a=this.context.renderingContext.root.ownerDocument.defaultView;this.context.eventService.setPickHandler(function(t){return o.context.renderingService.hooks.pickSync.call({position:t,picked:[],topmost:!0}).picked[0]||null}),t.hooks.pointerWheel.tap(e.tag,function(t){t=o.normalizeWheelEvent(t);o.context.eventService.mapEvent(t)}),t.hooks.pointerDown.tap(e.tag,function(t){if(!a.supportsTouchEvents||"touch"!==t.pointerType){var e=o.normalizeToPointerEvent(t,a);!o.autoPreventDefault||!e[0].isNormalized||!t.cancelable&&"cancelable"in t||t.preventDefault();for(var n=ar(e);!(r=n()).done;){var r=r.value,r=o.bootstrapEvent(o.rootPointerEvent,r,a,t);o.context.eventService.mapEvent(r)}o.setCursor(o.context.eventService.cursor)}}),t.hooks.pointerUp.tap(e.tag,function(t){if(!a.supportsTouchEvents||"touch"!==t.pointerType){var e=o.context.contextService.getDomElement(),n="outside";try{n=e&&t.target&&t.target!==e&&e.contains&&!e.contains(t.target)?"outside":""}catch(t){}for(var r=ar(o.normalizeToPointerEvent(t,a));!(i=r()).done;){var i=i.value,i=o.bootstrapEvent(o.rootPointerEvent,i,a,t);i.type+=n,o.context.eventService.mapEvent(i)}o.setCursor(o.context.eventService.cursor)}}),t.hooks.pointerMove.tap(e.tag,this.onPointerMove),t.hooks.pointerOver.tap(e.tag,this.onPointerMove),t.hooks.pointerOut.tap(e.tag,this.onPointerMove),t.hooks.click.tap(e.tag,this.onPointerMove),t.hooks.pointerCancel.tap(e.tag,function(t){for(var e=ar(o.normalizeToPointerEvent(t,a));!(n=e()).done;){var n=n.value,n=o.bootstrapEvent(o.rootPointerEvent,n,a,t);o.context.eventService.mapEvent(n)}o.setCursor(o.context.eventService.cursor)})},t.getViewportXY=function(t){var e,n=t.offsetX,r=t.offsetY,i=t.clientX,t=t.clientY;return t=!this.context.config.supportsCSSTransform||M(n)||M(r)?(e=(i=this.context.eventService.client2Viewport(new Ra(i,t))).x,i.y):(e=n,r),{x:e,y:t}},t.bootstrapEvent=function(t,e,n,r){t.view=n,t.originalEvent=null,t.nativeEvent=r,t.pointerId=e.pointerId,t.width=e.width,t.height=e.height,t.isPrimary=e.isPrimary,t.pointerType=e.pointerType,t.pressure=e.pressure,t.tangentialPressure=e.tangentialPressure,t.tiltX=e.tiltX,t.tiltY=e.tiltY,t.twist=e.twist,this.transferMouseData(t,e);n=this.getViewportXY(e),e=n.x,n=n.y,t.viewport.x=e,t.viewport.y=n,e=this.context.eventService.viewport2Canvas(t.viewport),n=e.x,e=e.y;return t.canvas.x=n,t.canvas.y=e,t.global.copyFrom(t.canvas),t.offset.copyFrom(t.canvas),t.isTrusted=r.isTrusted,"pointerleave"===t.type&&(t.type="pointerout"),t.type.startsWith("mouse")&&(t.type=t.type.replace("mouse","pointer")),t.type.startsWith("touch")&&(t.type=Yr[t.type]||t.type),t},t.normalizeWheelEvent=function(t){var e=this.rootWheelEvent,n=(this.transferMouseData(e,t),e.deltaMode=t.deltaMode,e.deltaX=t.deltaX,e.deltaY=t.deltaY,e.deltaZ=t.deltaZ,this.getViewportXY(t)),r=n.x,n=n.y,r=(e.viewport.x=r,e.viewport.y=n,this.context.eventService.viewport2Canvas(e.viewport)),n=r.x,r=r.y;return e.canvas.x=n,e.canvas.y=r,e.global.copyFrom(e.canvas),e.offset.copyFrom(e.canvas),e.nativeEvent=t,e.type=t.type,e},t.transferMouseData=function(t,e){t.isTrusted=e.isTrusted,t.srcElement=e.srcElement,t.timeStamp=performance.now(),t.type=e.type,t.altKey=e.altKey,t.metaKey=e.metaKey,t.shiftKey=e.shiftKey,t.ctrlKey=e.ctrlKey,t.button=e.button,t.buttons=e.buttons,t.client.x=e.clientX,t.client.y=e.clientY,t.movement.x=e.movementX,t.movement.y=e.movementY,t.page.x=e.pageX,t.page.y=e.pageY,t.screen.x=e.screenX,t.screen.y=e.screenY,t.relatedTarget=null},t.setCursor=function(t){this.context.contextService.applyCursorStyle(t||this.context.config.cursor||"default")},t.normalizeToPointerEvent=function(t,e){var n=[];if(e.isTouchEvent(t))for(var r=0;r<t.changedTouches.length;r++){var i=t.changedTouches[r];je(i.button)&&(i.button=0),je(i.buttons)&&(i.buttons=1),je(i.isPrimary)&&(i.isPrimary=1===t.touches.length&&"touchstart"===t.type),je(i.width)&&(i.width=i.radiusX||1),je(i.height)&&(i.height=i.radiusY||1),je(i.tiltX)&&(i.tiltX=0),je(i.tiltY)&&(i.tiltY=0),je(i.pointerType)&&(i.pointerType="touch"),je(i.pointerId)&&(i.pointerId=i.identifier||0),je(i.pressure)&&(i.pressure=i.force||.5),je(i.twist)&&(i.twist=0),je(i.tangentialPressure)&&(i.tangentialPressure=0),i.isNormalized=!0,i.type=t.type,n.push(i)}else e.isMouseEvent(t)?(je((e=t).isPrimary)&&(e.isPrimary=!0),je(e.width)&&(e.width=1),je(e.height)&&(e.height=1),je(e.tiltX)&&(e.tiltX=0),je(e.tiltY)&&(e.tiltY=0),je(e.pointerType)&&(e.pointerType="mouse"),je(e.pointerId)&&(e.pointerId=1),je(e.pressure)&&(e.pressure=.5),je(e.twist)&&(e.twist=0),je(e.tangentialPressure)&&(e.tangentialPressure=0),e.isNormalized=!0,n.push(e)):n.push(t);return n},e}()),al=(ol.tag="Event",[lt.CIRCLE,lt.ELLIPSE,lt.IMAGE,lt.RECT,lt.LINE,lt.POLYLINE,lt.POLYGON,lt.TEXT,lt.PATH,lt.HTML]),sl=function(){function t(){}var e=t.prototype;return e.isVisible=function(t,e){var n,r,i=e.cullable;return!i.enable||(n=e.getRenderBounds(),!Ta.isEmpty(n)&&(t=t.getFrustum(),r=null==(r=e.parentNode)||null==(r=r.cullable)?void 0:r.visibilityPlaneMask,i.visibilityPlaneMask=this.computeVisibilityWithPlaneMask(e,n,r||va.INDETERMINATE,t.planes),i.visible=i.visibilityPlaneMask!==va.OUTSIDE,i.visible))},e.computeVisibilityWithPlaneMask=function(t,e,n,r){if(n===va.OUTSIDE||n===va.INSIDE)return n;for(var i=va.INSIDE,o=-1<al.indexOf(t.nodeName),a=0,s=r.length;a<s;++a){var l=1<<a;if(0!=(n&l)&&(!o||4!==a&&5!==a)){var u=r[a],c=u.normal,u=u.distance;if(Lt(c,e.getPositiveFarPoint(r[a]))+u<0)return va.OUTSIDE;Lt(c,e.getNegativeFarPoint(r[a]))+u<0&&(i|=l)}}return i},t}(),ll=function(){function u(){this.rBush=void 0,this.toSync=new Set}var t=u.prototype;return t.apply=function(t){function e(t){t.target.renderable.dirty=!0,a.dirtify()}function n(t){for(var e=t.detail.affectChildren,t=t.target,n=(e&&t.forEach(function(t){o.toSync.add(t)}),t);n;)n.renderable&&o.toSync.add(n),n=n.parentElement;a.dirtify()}function r(t){t=t.target,ct.enableCSSParsing&&ct.styleValueRegistry.recalc(t),ct.sceneGraphService.dirtifyToRoot(t),a.dirtify()}function i(t){var e=(t=t.target).rBushNode;e.aabb&&o.rBush.remove(e.aabb),o.toSync.delete(t),ct.sceneGraphService.dirtifyToRoot(t),a.dirtify()}var o=this,a=t.renderingService,s=t.renderingContext,t=t.rBushRoot,l=s.root.ownerDocument.defaultView;this.rBush=t;a.hooks.init.tapPromise(u.tag,Qn($n().mark(function t(){return $n().wrap(function(t){for(;;)switch(t.prev=t.next){case 0:l.addEventListener(v.MOUNTED,r),l.addEventListener(v.UNMOUNTED,i),l.addEventListener(v.ATTR_MODIFIED,e),l.addEventListener(v.BOUNDS_CHANGED,n);case 4:case"end":return t.stop()}},t)}))),a.hooks.destroy.tap(u.tag,function(){l.removeEventListener(v.MOUNTED,r),l.removeEventListener(v.UNMOUNTED,i),l.removeEventListener(v.ATTR_MODIFIED,e),l.removeEventListener(v.BOUNDS_CHANGED,n),o.toSync.clear()}),a.hooks.endFrame.tap(u.tag,function(){o.syncRTree()})},t.syncRTree=function(){var a=this,s=[];Array.from(this.toSync).filter(function(t){return t.isConnected}).forEach(function(t){var e,n,r,i=t.rBushNode,o=(i&&i.aabb&&a.rBush.remove(i.aabb),t.getRenderBounds());o&&(e=(n=o.getMin())[0],n=n[1],r=(o=o.getMax())[0],o=o[1],i.aabb||(i.aabb={}),i.aabb.displayObject=t,i.aabb.minX=e,i.aabb.minY=n,i.aabb.maxX=r,i.aabb.maxY=o),!i.aabb||isNaN(i.aabb.maxX)||isNaN(i.aabb.maxX)||isNaN(i.aabb.minX)||isNaN(i.aabb.minY)||s.push(i.aabb)}),this.rBush.load(s),s.length=0,this.toSync.clear()},u}(),ul=(ll.tag="Prepare",(E=qs=qs||{}).READY="ready",E.BEFORE_RENDER="beforerender",E.RERENDER="rerender",E.AFTER_RENDER="afterrender",E.BEFORE_DESTROY="beforedestroy",E.AFTER_DESTROY="afterdestroy",E.RESIZE="resize",E.DIRTY_RECTANGLE="dirtyrectangle",new Ga(v.MOUNTED)),cl=new Ga(v.UNMOUNTED),hl=new Ga(qs.BEFORE_RENDER),dl=new Ga(qs.RERENDER),fl=new Ga(qs.AFTER_RENDER),pl=function(w){function t(t){var e=w.call(this)||this,n=(e.document=void 0,e.customElements=void 0,e.requestAnimationFrame=void 0,e.cancelAnimationFrame=void 0,e.devicePixelRatio=void 0,e.supportsPointerEvents=void 0,e.supportsTouchEvents=void 0,e.isTouchEvent=void 0,e.isMouseEvent=void 0,e.Element=as,e.frameId=void 0,e.inited=!1,e.readyPromise=void 0,e.resolveReadyPromise=void 0,e.context={},e.document=new Va,e.document.defaultView=ir(e),e.customElements=new Ba,t.container),r=t.canvas,i=t.offscreenCanvas,o=t.width,a=t.height,s=t.devicePixelRatio,l=t.renderer,u=t.background,c=t.cursor,h=t.document,d=t.requestAnimationFrame,f=t.cancelAnimationFrame,p=t.createImage,g=t.supportsPointerEvents,m=t.supportsTouchEvents,v=t.supportsCSSTransform,y=t.useNativeClickEvent,E=t.alwaysTriggerPointerEventOnCanvas,_=t.isTouchEvent,t=t.isMouseEvent,b=(b=n,x=ir(e),b&&(b="string"==typeof b?b:b.id||Fr++,Br[b]&&Br[b].destroy(),Br[b]=x),o),x=a,S=s;return r&&(S=1<=(S=s||Ur&&window.devicePixelRatio||1)?Math.ceil(S):1,b=o||("auto"===(o=zr(s=r,"width"))?s.offsetWidth:parseFloat(o))||r.width/S,x=a||("auto"===(o=zr(s=r,"height"))?s.offsetHeight:parseFloat(o))||r.height/S),e.devicePixelRatio=S,e.requestAnimationFrame=null!=d?d:po.bind(ct.globalThis),e.cancelAnimationFrame=null!=f?f:go.bind(ct.globalThis),e.supportsTouchEvents=null!=m?m:"ontouchstart"in ct.globalThis,e.supportsPointerEvents=null!=g?g:!!ct.globalThis.PointerEvent,e.isTouchEvent=null!=_?_:function(t){return e.supportsTouchEvents&&t instanceof ct.globalThis.TouchEvent},e.isMouseEvent=null!=t?t:function(t){return!ct.globalThis.MouseEvent||t instanceof ct.globalThis.MouseEvent&&(!e.supportsPointerEvents||!(t instanceof ct.globalThis.PointerEvent))},e.initRenderingContext({container:n,canvas:r,width:b,height:x,renderer:l,offscreenCanvas:i,devicePixelRatio:S,cursor:c||"default",background:u||"transparent",createImage:p,document:h,supportsCSSTransform:v,useNativeClickEvent:y,alwaysTriggerPointerEventOnCanvas:E}),e.initDefaultCamera(b,x),Qn($n().mark(function t(){return $n().wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,e.initRenderer(l);case 2:e.dispatchEvent(new Ga(qs.READY)),e.readyPromise&&e.resolveReadyPromise();case 4:case"end":return t.stop()}},t)}))(),e}er(t,w);var e=t.prototype;return e.initRenderingContext=function(t){this.context.config=t,this.context.renderingContext={root:this.document.documentElement,renderListCurrentFrame:[],unculledEntities:[],renderReasons:new Set,force:!1,dirty:!1}},e.initDefaultCamera=function(t,e){var n=this,r=new ct.CameraContribution;r.setType(Qa.EXPLORING,Ja.DEFAULT).setPosition(t/2,e/2,500).setFocalPoint(t/2,e/2,0).setOrthographic(t/-2,t/2,e/2,e/-2,.1,1e3),r.canvas=this,r.eventEmitter.on(Bs,function(){n.context.renderingContext.renderReasons.add(Ds.CAMERA_CHANGED)}),this.context.camera=r},e.getConfig=function(){return this.context.config},e.getRoot=function(){return this.document.documentElement},e.getCamera=function(){return this.context.camera},e.getContextService=function(){return this.context.contextService},e.getEventService=function(){return this.context.eventService},e.getRenderingService=function(){return this.context.renderingService},e.getRenderingContext=function(){return this.context.renderingContext},e.getStats=function(){return this.getRenderingService().getStats()},e.destroy=function(t,e){void 0===t&&(t=!0),(e=void 0===e?!1:e)||this.dispatchEvent(new Ga(qs.BEFORE_DESTROY)),this.frameId&&(this.getConfig().cancelAnimationFrame||cancelAnimationFrame)(this.frameId);var n=this.getRoot();this.unmountChildren(n),t&&(this.document.destroy(),this.getEventService().destroy()),this.getRenderingService().destroy(),this.getContextService().destroy(),t&&this.context.rBushRoot&&(this.context.rBushRoot.clear(),this.context.rBushRoot=null,this.context.renderingContext.root=null),e||this.dispatchEvent(new Ga(qs.AFTER_DESTROY))},e.changeSize=function(t,e){this.resize(t,e)},e.resize=function(t,e){var n=this.context.config,n=(n.width=t,n.height=e,this.getContextService().resize(t,e),this.context.camera),r=n.getProjectionMode();n.setPosition(t/2,e/2,500).setFocalPoint(t/2,e/2,0),r===ts.ORTHOGRAPHIC?n.setOrthographic(t/-2,t/2,e/2,e/-2,n.getNear(),n.getFar()):n.setAspect(t/e),this.dispatchEvent(new Ga(qs.RESIZE,{width:t,height:e}))},e.appendChild=function(t,e){return this.document.documentElement.appendChild(t,e)},e.insertBefore=function(t,e){return this.document.documentElement.insertBefore(t,e)},e.removeChild=function(t){return this.document.documentElement.removeChild(t)},e.removeChildren=function(){this.document.documentElement.removeChildren()},e.destroyChildren=function(){this.document.documentElement.destroyChildren()},e.render=function(){var t=this;this.dispatchEvent(hl),this.getRenderingService().render(this.getConfig(),function(){t.dispatchEvent(dl)}),this.dispatchEvent(fl)},e.run=function(){var e=this;(function t(){e.render(),e.frameId=requestAnimationFrame(t)})()},e.initRenderer=function(){var e=Qn($n().mark(function t(e){return $n().wrap(function(t){for(;;)switch(t.prev=t.next){case 0:if(e){t.next=2;break}throw new Error("Renderer is required.");case 2:return this.inited=!1,this.readyPromise=void 0,this.context.rBushRoot=new z,this.context.renderingPlugins=[],this.context.renderingPlugins.push(new ol,new ll,new il,new rl([new sl])),this.loadRendererContainerModule(e),this.context.contextService=new this.context.ContextService(d({},ct,this.context)),this.context.renderingService=new Hs(ct,this.context),this.context.eventService=new js(ct,this.context),this.context.eventService.init(),t.next=14,this.context.contextService.init();case 14:return t.next=16,this.context.renderingService.init();case 16:this.inited=!0,this.getRoot().forEach(function(t){t=t.renderable;t&&(t.renderBoundsDirty=!0,t.boundsDirty=!0,t.dirty=!0)}),this.mountChildren(this.getRoot()),e.getConfig().enableAutoRendering&&this.run();case 20:case"end":return t.stop()}},t,this)}));return function(t){return e.apply(this,arguments)}}(),e.loadRendererContainerModule=function(t){var e=this;t.getPlugins().forEach(function(t){t.context=e.context,t.init(ct)})},e.setRenderer=function(){var e=Qn($n().mark(function t(e){var n,r;return $n().wrap(function(t){for(;;)switch(t.prev=t.next){case 0:if((n=this.getConfig()).renderer===e)return t.abrupt("return");t.next=3;break;case 3:return r=n.renderer,n.renderer=e,this.destroy(!1,!0),[].concat(null==r?void 0:r.getPlugins()).reverse().forEach(function(t){t.destroy(ct)}),t.next=9,this.initRenderer(e);case 9:case"end":return t.stop()}},t,this)}));return function(t){return e.apply(this,arguments)}}(),e.setCursor=function(t){this.getConfig().cursor=t,this.getContextService().applyCursorStyle(t)},e.unmountChildren=function(t){var e=this;t.childNodes.forEach(function(t){e.unmountChildren(t)}),this.inited&&(t.isMutationObserved?t.dispatchEvent(cl):(cl.target=t,this.dispatchEvent(cl,!0)),t!==this.document.documentElement&&(t.ownerDocument=null),t.isConnected=!1),t.isCustomElement&&t.disconnectedCallback&&t.disconnectedCallback()},e.mountChildren=function(t){var e=this;this.inited?t.isConnected||(t.ownerDocument=this.document,t.isConnected=!0,t.isMutationObserved?t.dispatchEvent(ul):(ul.target=t,this.dispatchEvent(ul,!0))):console.warn("[g]: You are trying to call `canvas.appendChild` before canvas' initialization finished. You can either await `canvas.ready` or listen to `CanvasEvent.READY` manually.","appended child: ",t.nodeName),t.childNodes.forEach(function(t){e.mountChildren(t)}),t.isCustomElement&&t.connectedCallback&&t.connectedCallback()},e.client2Viewport=function(t){return this.getEventService().client2Viewport(t)},e.viewport2Client=function(t){return this.getEventService().viewport2Client(t)},e.viewport2Canvas=function(t){return this.getEventService().viewport2Canvas(t)},e.canvas2Viewport=function(t){return this.getEventService().canvas2Viewport(t)},e.getPointByClient=function(t,e){return this.client2Viewport({x:t,y:e})},e.getClientByPoint=function(t,e){return this.viewport2Client({x:t,y:e})},tr(t,[{key:"ready",get:function(){var e=this;return this.readyPromise||(this.readyPromise=new Promise(function(t){e.resolveReadyPromise=function(){t(e)}}),this.inited&&this.resolveReadyPromise()),this.readyPromise}}]),t}(i);function gl(t,e){return(gl=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t})(t,e)}n=function(i){var t;function e(){for(var t,e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];return(t=i.call.apply(i,[this].concat(n))||this).landmarks=[],t.landmarkAnimationID=void 0,t}t=i,(n=e).prototype=Object.create(t.prototype),gl(n.prototype.constructor=n,t);var n=e.prototype;return n.rotate=function(t,e,n){if(this.relElevation=Qr(e),this.relAzimuth=Qr(t),this.relRoll=Qr(n),this.elevation+=this.relElevation,this.azimuth+=this.relAzimuth,this.roll+=this.relRoll,this.type===Qa.EXPLORING){e=Ht(zt(),[1,0,0],ti((this.rotateWorld?1:-1)*this.relElevation)),t=Ht(zt(),[0,1,0],ti((this.rotateWorld?1:-1)*this.relAzimuth)),n=Ht(zt(),[0,0,1],ti(this.relRoll)),t=Xt(zt(),t,e),t=Xt(zt(),t,n),e=yt(K(),t);it(this.matrix,this.matrix,[0,0,-this.distance]),rt(this.matrix,this.matrix,e),it(this.matrix,this.matrix,[0,0,this.distance])}else{if(90<Math.abs(this.elevation))return this;this.computeMatrix()}return this._getAxes(),this.type===Qa.ORBITING||this.type===Qa.EXPLORING?this._getPosition():this.type===Qa.TRACKING&&this._getFocalPoint(),this._update(),this},n.pan=function(t,e){t=Jr(t,e,0),e=At(this.position);return Ct(e,e,Ot(y(),this.right,t[0])),Ct(e,e,Ot(y(),this.up,t[1])),this._setPosition(e),this.triggerUpdate(),this},n.dolly=function(t){var e=this.forward,n=At(this.position),t=(this.dollyingStep,this.distance+t*this.dollyingStep),t=Math.max(Math.min(t,this.maxDistance),this.minDistance)-this.distance;return n[0]+=t*e[0],n[1]+=t*e[1],n[2]+=t*e[2],this._setPosition(n),this.type===Qa.ORBITING||this.type===Qa.EXPLORING?this._getDistance():this.type===Qa.TRACKING&&Ct(this.focalPoint,n,this.distanceVector),this.triggerUpdate(),this},n.cancelLandmarkAnimation=function(){void 0!==this.landmarkAnimationID&&this.canvas.cancelAnimationFrame(this.landmarkAnimationID)},n.createLandmark=function(t,e){var n,e=e=void 0===e?{}:e,r=e.position,r=void 0===r?this.position:r,i=e.focalPoint,i=void 0===i?this.focalPoint:i,o=e.roll,e=e.zoom,a=new ct.CameraContribution,r=(a.setType(this.type,void 0),a.setPosition(r[0],null!=(n=r[1])?n:this.position[1],null!=(n=r[2])?n:this.position[2]),a.setFocalPoint(i[0],null!=(r=i[1])?r:this.focalPoint[1],null!=(n=i[2])?n:this.focalPoint[2]),a.setRoll(null!=o?o:this.roll),a.setZoom(null!=e?e:this.zoom),{name:t,matrix:q(a.getWorldTransform()),right:At(a.right),up:At(a.up),forward:At(a.forward),position:At(a.getPosition()),focalPoint:At(a.getFocalPoint()),distanceVector:At(a.getDistanceVector()),distance:a.getDistance(),dollyingStep:a.getDollyingStep(),azimuth:a.getAzimuth(),elevation:a.getElevation(),roll:a.getRoll(),relAzimuth:a.relAzimuth,relElevation:a.relElevation,relRoll:a.relRoll,zoom:a.getZoom()});return this.landmarks.push(r),r},n.gotoLandmark=function(e,t){var n,s,r,i,l,u,c,h,d,f,p,g,m=this,o=(void 0===t&&(t={}),Fe(e)?this.landmarks.find(function(t){return t.name===e}):e);o&&(n=void 0===(n=(t=B(t)?{duration:t}:t).easing)?"linear":n,r=t.duration,s=void 0===r?100:r,r=void 0===(r=t.easingFunction)?void 0:r,t=t.onfinish,i=void 0===t?void 0:t,l=.01,0===s?(this.syncFromLandmark(o),i&&i()):(this.cancelLandmarkAnimation(),u=o.position,c=o.focalPoint,h=o.zoom,d=o.roll,f=r||ct.EasingFunction(n),g=function(){m.setFocalPoint(c),m.setPosition(u),m.setRoll(d),m.setZoom(h),m.computeMatrix(),m.triggerUpdate(),i&&i()},this.canvas.requestAnimationFrame(function t(e){var n,r,i,o,a,e=e-(p=void 0===p?e:p);s<e||(n=f(e/s),r=y(),i=y(),o=1,a=0,Dt(r,m.focalPoint,c,n),Dt(i,m.position,u,n),a=m.roll*(1-n)+d*n,o=m.zoom*(1-n)+h*n,m.setFocalPoint(r),m.setPosition(i),m.setRoll(a),m.setZoom(o),Gt(r,c)+Gt(i,u)<=l&&null==h&&null==d)?g():(m.computeMatrix(),m.triggerUpdate(),e<s&&(m.landmarkAnimationID=m.canvas.requestAnimationFrame(t)))})))},n.syncFromLandmark=function(t){this.matrix=$(this.matrix,t.matrix),this.right=Rt(this.right,t.right),this.up=Rt(this.up,t.up),this.forward=Rt(this.forward,t.forward),this.position=Rt(this.position,t.position),this.focalPoint=Rt(this.focalPoint,t.focalPoint),this.distanceVector=Rt(this.distanceVector,t.distanceVector),this.azimuth=t.azimuth,this.elevation=t.elevation,this.roll=t.roll,this.relAzimuth=t.relAzimuth,this.relElevation=t.relElevation,this.relRoll=t.relRoll,this.dollyingStep=t.dollyingStep,this.distance=t.distance,this.zoom=t.zoom},e}(Fs);function ml(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,function(t){t=function(t,e){if("object"!=typeof t||null===t)return t;var n=t[Symbol.toPrimitive];if(void 0===n)return("string"===e?String:Number)(t);n=n.call(t,e||"default");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}(t,"string");return"symbol"==typeof t?t:String(t)}(r.key),r)}}function vl(t,e,n){e&&ml(t.prototype,e),n&&ml(t,n),Object.defineProperty(t,"prototype",{writable:!1})}function yl(t,e){return(yl=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t})(t,e)}ct.CameraContribution=n;function El(t){return Math.pow(t,2)}function _l(t){return Math.pow(t,3)}function bl(t){return Math.pow(t,4)}function xl(t){return Math.pow(t,5)}function Sl(t){return Math.pow(t,6)}function wl(t){return 1-Math.cos(t*Math.PI/2)}function Tl(t){return 1-Math.sqrt(1-t*t)}function Al(t){return t*t*(3*t-2)}function Ml(t){for(var e,n=4;t<((e=Math.pow(2,--n))-1)/11;);return 1/Math.pow(4,3-n)-7.5625*Math.pow((3*e-2)/22-t,2)}function Rl(t,e){var n=(e=e=void 0===e?[]:e)[0],e=void 0===(e=e[1])?.5:e,n=Ue(Number(void 0===n?1:n),1,10),e=Ue(Number(e),.1,2);return 0===t||1===t?t:-n*Math.pow(2,10*(t-1))*Math.sin((t-1-e/(2*Math.PI)*Math.asin(1/n))*(2*Math.PI)/e)}function Nl(t,e,n){var r=(e=e=void 0===e?[]:e)[0],i=void 0===(i=e[1])?100:i,o=void 0===(o=e[2])?10:o,e=void 0===(e=e[3])?0:e,r=Ue(void 0===r?1:r,.1,1e3),i=Ue(i,.1,1e3),o=Ue(o,.1,1e3),e=Ue(e,.1,1e3),a=Math.sqrt(i/r),i=(o=o/(2*Math.sqrt(i*r)))<1?a*Math.sqrt(1-o*o):0,r=o<1?(o*a-e)/i:-e+a,e=n?n*t/1e3:t,e=o<1?Math.exp(-e*o*a)*(+Math.cos(i*e)+r*Math.sin(i*e)):(1+r*e)*Math.exp(-e*a);return 0===t||1===t?t:1-e}function Cl(t,e){var e=e=void 0===e?[]:e,n=void 0===(n=e[0])?10:n;return("start"==e[1]?Math.ceil:Math.floor)(Ue(t,0,1)*n)/n}function Pl(t,e){var n=(e=e=void 0===e?[]:e)[0],r=e[1],i=e[2],e=e[3];return Jl(n,r,i,e)(t)}function Ol(r){return function(t,e,n){return 1-r(1-t,e=void 0===e?[]:e,n)}}function Il(r){return function(t,e,n){return void 0===e&&(e=[]),t<.5?r(2*t,e,n)/2:1-r(-2*t+2,e,n)/2}}function Ll(r){return function(t,e,n){return void 0===e&&(e=[]),t<.5?(1-r(1-2*t,e,n))/2:(r(2*t-1,e,n)+1)/2}}function kl(t){return t}var Dl=function(i){var t,e;function n(t,e,n,r){t=i.call(this,t)||this;return t.currentTime=void 0,t.timelineTime=void 0,t.currentTime=n,t.timelineTime=r,t.target=e,t.type="finish",t.bubbles=!1,t.currentTarget=e,t.defaultPrevented=!1,t.eventPhase=t.AT_TARGET,t.timeStamp=Date.now(),t.currentTime=n,t.timelineTime=r,t}return e=i,(t=n).prototype=Object.create(e.prototype),yl(t.prototype.constructor=t,e),n}(Ua),Bl=0,Fl=function(){function t(t,e){this.effect=void 0,this.timeline=void 0,this.id=void 0,this.currentTimePending=!1,this._idle=!0,this._paused=!1,this._finishedFlag=!0,this.oldPlayState=void 0,this._holdTime=void 0,this.readyPromise=void 0,this.finishedPromise=void 0,this.resolveReadyPromise=void 0,this.rejectReadyPromise=void 0,this.resolveFinishedPromise=void 0,this.rejectFinishedPromise=void 0,this.onfinish=void 0,this.oncancel=void 0,this.onframe=void 0,this._currentTime=0,this._startTime=void 0,this._playbackRate=1,this._totalDuration=void 0,this._inEffect=void 0,this._inTimeline=!0,this.onremove=void 0,((this.effect=t).animation=this).timeline=e,this.id=""+Bl++,this._inEffect=!!this.effect.update(0),this._totalDuration=Number(null==(t=this.effect)?void 0:t.getComputedTiming().endTime),this._holdTime=0,this._paused=!1,this.oldPlayState="idle",this.updatePromises()}var e=t.prototype;return e.updatePromises=function(){var t=this.oldPlayState,e=this.pending?"pending":this.playState;return this.readyPromise&&e!==t&&("idle"===e?(this.rejectReadyPromise(),this.readyPromise=void 0):"pending"===t?this.resolveReadyPromise():"pending"===e&&(this.readyPromise=void 0)),this.finishedPromise&&e!==t&&("idle"===e?(this.rejectFinishedPromise(),this.finishedPromise=void 0):"finished"===e?this.resolveFinishedPromise():"finished"===t&&(this.finishedPromise=void 0)),this.oldPlayState=e,this.readyPromise||this.finishedPromise},e.play=function(){this.updatePromises(),this._paused=!1,(this._isFinished||this._idle)&&(this.rewind(),this._startTime=null),this._finishedFlag=!1,this._idle=!1,this.ensureAlive(),this.timeline.applyDirtiedAnimation(this),-1===this.timeline.animations.indexOf(this)&&this.timeline.animations.push(this),this.updatePromises()},e.pause=function(){this.updatePromises(),this.currentTime&&(this._holdTime=this.currentTime),this._isFinished||this._paused||this._idle?this._idle&&(this.rewind(),this._idle=!1):this.currentTimePending=!0,this._startTime=null,this._paused=!0,this.updatePromises()},e.finish=function(){this.updatePromises(),this._idle||(this.currentTime=0<this._playbackRate?this._totalDuration:0,this._startTime=this._totalDuration-this.currentTime,this.currentTimePending=!1,this.timeline.applyDirtiedAnimation(this),this.updatePromises())},e.cancel=function(){var t,e=this;this.updatePromises(),this._inEffect&&(this._inEffect=!1,this._idle=!0,this._paused=!1,this._finishedFlag=!0,this._currentTime=0,this._startTime=null,this.effect.update(null),this.timeline.applyDirtiedAnimation(this),this.updatePromises(),this.oncancel)&&(t=new Dl(null,this,this.currentTime,null),setTimeout(function(){e.oncancel(t)}))},e.reverse=function(){this.updatePromises();var t=this.currentTime;this.playbackRate*=-1,this.play(),null!==t&&(this.currentTime=t),this.updatePromises()},e.updatePlaybackRate=function(t){this.playbackRate=t},e.targetAnimations=function(){var t;return(null==(t=this.effect)?void 0:t.target).getAnimations()},e.markTarget=function(){var t=this.targetAnimations();-1===t.indexOf(this)&&t.push(this)},e.unmarkTarget=function(){var t=this.targetAnimations(),e=t.indexOf(this);-1!==e&&t.splice(e,1)},e.tick=function(t,e){this._idle||this._paused||(null===this._startTime?e&&(this.startTime=t-this._currentTime/this.playbackRate):this._isFinished||this.tickCurrentTime((t-this._startTime)*this.playbackRate)),e&&(this.currentTimePending=!1,this.fireEvents(t))},e.rewind=function(){if(0<=this.playbackRate)this.currentTime=0;else{if(!(this._totalDuration<1/0))throw new Error("Unable to rewind negative playback rate animation with infinite duration");this.currentTime=this._totalDuration}},e.persist=function(){throw new Error(Hr)},e.addEventListener=function(t,e,n){throw new Error(Hr)},e.removeEventListener=function(t,e,n){throw new Error(Hr)},e.dispatchEvent=function(t){throw new Error(Hr)},e.commitStyles=function(){throw new Error(Hr)},e.ensureAlive=function(){var t;this.playbackRate<0&&0===this.currentTime?this._inEffect=!(null==(t=this.effect)||!t.update(-1)):this._inEffect=!(null==(t=this.effect)||!t.update(this.currentTime)),this._inTimeline||!this._inEffect&&this._finishedFlag||(this._inTimeline=!0,this.timeline.animations.push(this))},e.tickCurrentTime=function(t,e){t!==this._currentTime&&(this._currentTime=t,this._isFinished&&!e&&(this._currentTime=0<this._playbackRate?this._totalDuration:0),this.ensureAlive())},e.fireEvents=function(t){var e,n=this;this._isFinished?this._finishedFlag||(this.onfinish&&(e=new Dl(null,this,this.currentTime,t),setTimeout(function(){n.onfinish&&n.onfinish(e)})),this._finishedFlag=!0):(this.onframe&&"running"===this.playState&&(t=new Dl(null,this,this.currentTime,t),this.onframe(t)),this._finishedFlag=!1)},vl(t,[{key:"pending",get:function(){return null===this._startTime&&!this._paused&&0!==this.playbackRate||this.currentTimePending}},{key:"playState",get:function(){return this._idle?"idle":this._isFinished?"finished":this._paused?"paused":"running"}},{key:"ready",get:function(){var n=this;return this.readyPromise||(-1===this.timeline.animationsWithPromises.indexOf(this)&&this.timeline.animationsWithPromises.push(this),this.readyPromise=new Promise(function(t,e){n.resolveReadyPromise=function(){t(n)},n.rejectReadyPromise=function(){e(new Error)}}),this.pending)||this.resolveReadyPromise(),this.readyPromise}},{key:"finished",get:function(){var n=this;return this.finishedPromise||(-1===this.timeline.animationsWithPromises.indexOf(this)&&this.timeline.animationsWithPromises.push(this),this.finishedPromise=new Promise(function(t,e){n.resolveFinishedPromise=function(){t(n)},n.rejectFinishedPromise=function(){e(new Error)}}),"finished"===this.playState&&this.resolveFinishedPromise()),this.finishedPromise}},{key:"currentTime",get:function(){return this.updatePromises(),this._idle||this.currentTimePending?null:this._currentTime},set:function(t){var e;t=Number(t),isNaN(t)||(this.timeline.restart(),this._paused||null===this._startTime||(this._startTime=Number(null==(e=this.timeline)?void 0:e.currentTime)-t/this.playbackRate),this.currentTimePending=!1,this._currentTime!==t&&(this._idle&&(this._idle=!1,this._paused=!0),this.tickCurrentTime(t,!0),this.timeline.applyDirtiedAnimation(this)))}},{key:"startTime",get:function(){return this._startTime},set:function(t){null!==t&&(this.updatePromises(),t=Number(t),isNaN(t)||this._paused||this._idle||(this._startTime=t,this.tickCurrentTime((Number(this.timeline.currentTime)-this._startTime)*this.playbackRate),this.timeline.applyDirtiedAnimation(this),this.updatePromises()))}},{key:"playbackRate",get:function(){return this._playbackRate},set:function(t){var e;t!==this._playbackRate&&(this.updatePromises(),e=this.currentTime,this._playbackRate=t,this.startTime=null,"paused"!==this.playState&&"idle"!==this.playState&&(this._finishedFlag=!1,this._idle=!1,this.ensureAlive(),this.timeline.applyDirtiedAnimation(this)),null!==e&&(this.currentTime=e),this.updatePromises())}},{key:"_isFinished",get:function(){return!this._idle&&(0<this._playbackRate&&Number(this._currentTime)>=this._totalDuration||this._playbackRate<0&&Number(this._currentTime)<=0)}},{key:"totalDuration",get:function(){return this._totalDuration}},{key:"_needsTick",get:function(){return this.pending||"running"===this.playState||!this._finishedFlag}}]),t}(),Ul=4,Gl=.001,Wl=1e-7,Vl=10,jl=11,zl=1/(jl-1),Hl="function"==typeof Float32Array,Xl=function(t,e){return 1-3*e+3*t},Yl=function(t,e){return 3*e-6*t},Kl=function(t){return 3*t},ql=function(t,e,n){return((Xl(e,n)*t+Yl(e,n))*t+Kl(e))*t},$l=function(t,e,n){return 3*Xl(e,n)*t*t+2*Yl(e,n)*t+Kl(e)},Zl=function(t,e,n,r,i){for(var o,a,s=0;0<(o=ql(a=e+(n-e)/2,r,i)-t)?n=a:e=a,Math.abs(o)>Wl&&++s<Vl;);return a},Ql=function(t,e,n,r){for(var i=0;i<Ul;++i){var o=$l(e,n,r);if(0===o)return e;e-=(ql(e,n,r)-t)/o}return e},Jl=function(a,e,s,n){if(!(0<=a&&a<=1&&0<=s&&s<=1))throw new Error("bezier x values must be in [0, 1] range");if(a===e&&s===n)return function(t){return t};for(var l=new(Hl?Float32Array:Array)(jl),t=0;t<jl;++t)l[t]=ql(t*zl,a,s);return function(t){return 0===t||1===t?t:ql(function(t){for(var e=0,n=1,r=jl-1;n!==r&&l[n]<=t;++n)e+=zl;var i=e+(t-l[--n])/(l[n+1]-l[n])*zl,o=$l(i,a,s);return Gl<=o?Ql(t,i,a,s):0===o?i:Zl(t,e,e+zl,a,s)}(t),e,n)}},tu=function(t){return"-"===(t=t.replace(/([A-Z])/g,function(t){return"-"+t.toLowerCase()})).charAt(0)?t.substring(1):t},ya=Jl(.42,0,1,1),eu={steps:Cl,"step-start":function(t){return Cl(t,[1,"start"])},"step-end":function(t){return Cl(t,[1,"end"])},linear:function(t){return t},"cubic-bezier":Pl,ease:function(t){return Pl(t,[.25,.1,.25,1])},in:ya,out:Ol(ya),"in-out":Il(ya),"out-in":Ll(ya),"in-quad":El,"out-quad":Ol(El),"in-out-quad":Il(El),"out-in-quad":Ll(El),"in-cubic":_l,"out-cubic":Ol(_l),"in-out-cubic":Il(_l),"out-in-cubic":Ll(_l),"in-quart":bl,"out-quart":Ol(bl),"in-out-quart":Il(bl),"out-in-quart":Ll(bl),"in-quint":xl,"out-quint":Ol(xl),"in-out-quint":Il(xl),"out-in-quint":Ll(xl),"in-expo":Sl,"out-expo":Ol(Sl),"in-out-expo":Il(Sl),"out-in-expo":Ll(Sl),"in-sine":wl,"out-sine":Ol(wl),"in-out-sine":Il(wl),"out-in-sine":Ll(wl),"in-circ":Tl,"out-circ":Ol(Tl),"in-out-circ":Il(Tl),"out-in-circ":Ll(Tl),"in-back":Al,"out-back":Ol(Al),"in-out-back":Il(Al),"out-in-back":Ll(Al),"in-bounce":Ml,"out-bounce":Ol(Ml),"in-out-bounce":Il(Ml),"out-in-bounce":Ll(Ml),"in-elastic":Rl,"out-elastic":Ol(Rl),"in-out-elastic":Il(Rl),"out-in-elastic":Ll(Rl),spring:Nl,"spring-in":Nl,"spring-out":Ol(Nl),"spring-in-out":Il(Nl),"spring-out-in":Ll(Nl)},nu=function(t){return tu(t).replace(/^ease-/,"").replace(/(\(|\s).+/,"").toLowerCase().trim()},ru=function(t){return eu[nu(t)]||eu.linear},iu=1,ou=.5,au=0;function su(n,r){return function(t){var e;return 1<=t?1:(t+=r*(e=1/n))-t%e}}var Sa="\\s*(-?\\d+\\.?\\d*|-?\\.\\d+)\\s*",lu=new RegExp("cubic-bezier\\("+Sa+","+Sa+","+Sa+","+Sa+"\\)"),uu=/steps\(\s*(\d+)\s*\)/,cu=/steps\(\s*(\d+)\s*,\s*(start|middle|end)\s*\)/;function hu(t){var e=lu.exec(t);return e?Jl.apply(void 0,e.slice(1).map(Number)):(e=uu.exec(t))?su(Number(e[1]),au):(e=cu.exec(t))?su(Number(e[1]),{start:iu,middle:ou,end:au}[e[2]]):ru(t)}function du(t){return Math.abs((0!==(e=t).duration&&0!==e.iterations?("auto"===e.duration?0:Number(e.duration))*(null!=(e=e.iterations)?e:1):0)/(t.playbackRate||1));var e}var fu=0,pu=1,gu=2,mu=3;function vu(t,e,n){u=t,i=n;var r,i,o,a,s,l=null===(l=e)?fu:(r=i.endTime,l<Math.min(i.delay,r)?pu:l>=Math.min(i.delay+u+i.endDelay,r)?gu:mu),u=function(t,e,n,r,i){switch(r){case pu:return"backwards"===e||"both"===e?0:null;case mu:return n-i;case gu:return"forwards"===e||"both"===e?t:null;case fu:return null}}(t,n.fill,e,l,n.delay);return null===u?null:(i="auto"===n.duration?0:n.duration,r=i,t=l,e=n.iterations,a=u,s=n.iterationStart,0===r?t!==pu&&(s+=e):s+=a/r,e=t=s,a=n.iterationStart,s=l,o=n.iterations,u=u,i=i,e=a=0!==(a=e===1/0?a%1:e%1)||s!==gu||0===o||0===u&&0!==i?a:1,s=n.iterations,o=e,u=t,i=l===gu&&s===1/0?1/0:1===o?Math.floor(u)-1:Math.floor(u),a=n.direction,t=i,l=e,o="normal"===(s="normal"!==(s=a)&&"reverse"!==a&&(t=t,"alternate-reverse"===a&&(t+=1),s="normal",t!==1/0)&&t%2!=0?"reverse":s)?l:1-l,n.currentIteration=i,n.progress=o,n.easingFunction(o))}function yu(t,e,n){var o=function(t,e){for(var n={},r=0;r<t.length;r++)for(var i in t[r]){var o;Eu(i)&&(o={offset:t[r].offset,computedOffset:t[r].computedOffset,easing:t[r].easing,easingFunction:hu(t[r].easing)||e.easingFunction,value:t[r][i]},n[i]=n[i]||[],n[i].push(o))}return n}(t,e),a=function(t,e){var n,r=[];for(n in t)for(var i=t[n],o=0;o<i.length-1;o++){var a=o,s=o+1,l=i[a].computedOffset,u=i[s].computedOffset,c=l,h=u;0===o&&(c=-1/0,0===u)&&(s=a),o===i.length-2&&(h=1/0,1===l)&&(a=s),r.push({applyFrom:c,applyTo:h,startOffset:i[a].computedOffset,endOffset:i[s].computedOffset,easingFunction:i[a].easingFunction,property:n,interpolation:function(t,e,n,r){var i=Is[t];if(i&&i.syntax&&i.int){i=ct.styleValueRegistry.getPropertySyntax(i.syntax);if(i){a=ct.enableCSSParsing?(o=ct.styleValueRegistry.parseProperty(t,e,r),a=ct.styleValueRegistry.parseProperty(t,n,r),o=ct.styleValueRegistry.computeProperty(t,o,r),ct.styleValueRegistry.computeProperty(t,a,r)):(t=i.parserWithCSSDisabled,o=t?t(e,r):e,t?t(n,r):n);var o,a,s,t=i.mixer(o,a,r);if(t)return s=_u.apply(void 0,t),function(t){return 0===t?e:1===t?n:s(t)}}}return _u(!1,!0,function(t){return t?n:e})}(n,i[a].value,i[s].value,e)})}return r.sort(function(t,e){return t.startOffset-e.startOffset}),r}(o,n);return function(r,i){if(null!==i)a.filter(function(t){return i>=t.applyFrom&&i<t.applyTo}).forEach(function(t){var e=i-t.startOffset,n=t.endOffset-t.startOffset,e=0==n?0:t.easingFunction(e/n);r.setAttribute(t.property,t.interpolation(e))});else for(var t in o)Eu(t)&&r.setAttribute(t,null)}}function Eu(t){return"offset"!==t&&"easing"!==t&&"composite"!==t&&"computedOffset"!==t}var _u=function(e,n,r){return function(t){t=function t(e,n,r){if("number"==typeof e&&"number"==typeof n)return e*(1-r)+n*r;if("boolean"==typeof e&&"boolean"==typeof n||"string"==typeof e&&"string"==typeof n)return r<.5?e:n;if(Array.isArray(e)&&Array.isArray(n)){for(var i=e.length,o=n.length,a=Math.max(i,o),s=[],l=0;l<a;l++)s.push(t(e[l<i?l:i-1],n[l<o?l:o-1],r));return s}throw new Error("Mismatched interpolation arguments "+e+":"+n)}(e,n,t);return!ct.enableCSSParsing&&B(t)?t:r(t)}};var bu=function(){function t(){this.delay=0,this.direction="normal",this.duration="auto",this._easing="linear",this.easingFunction=kl,this.endDelay=0,this.fill="auto",this.iterationStart=0,this.iterations=1,this.playbackRate=void 0,this.effect=void 0,this.composite=void 0,this.activeDuration=void 0,this.endTime=void 0,this.currentIteration=null,this.progress=null}return vl(t,[{key:"easing",get:function(){return this._easing},set:function(t){this.easingFunction=hu(t),this._easing=t}}]),t}();function xu(t,i){if(null===t)return[];for(var e=(t=Array.isArray(t)?t:function(t){var e,n=[];for(e in t)if(!(e in["easing","offset","composite"]))for(var r,i=t[e],o=(i=Array.isArray(i)?i:[i]).length,a=0;a<o;a++)n[a]||(r={},"offset"in t&&(r.offset=Number(t.offset)),"easing"in t&&(r.easing=t.easing),"composite"in t&&(r.composite=t.composite),n[a]=r),void 0!==i[a]&&null!==i[a]&&(n[a][e]=i[a]);return n.sort(function(t,e){return(t.computedOffset||0)-(e.computedOffset||0)}),n}(t)).map(function(t){var e,n={};for(e in null!=i&&i.composite&&(n.composite="auto"),t){var r=t[e];if("offset"===e){if(null!==r){if(r=Number(r),!isFinite(r))throw new Error("Keyframe offsets must be numbers.");if(r<0||1<r)throw new Error("Keyframe offsets must be between 0 and 1.");n.computedOffset=r}}else if("composite"===e&&-1===["replace","add","accumulate","auto"].indexOf(r))throw new Error(r+" compositing is not supported");n[e]=r}return void 0===n.offset&&(n.offset=null),void 0===n.easing&&(n.easing=(null==i?void 0:i.easing)||"linear"),void 0===n.composite&&(n.composite="auto"),n}),n=!0,r=-1/0,o=0;o<e.length;o++){var a=e[o].offset;if(M(a))n=!1;else{if(a<r)throw new TypeError("Keyframes are not loosely sorted by offset. Sort or specify offsets.");r=a}}if(e=e.filter(function(t){return 0<=Number(t.offset)&&Number(t.offset)<=1}),!n)for(var s=e.length,l=(e[s-1].computedOffset=Number(null!=(t=e[s-1].offset)?t:1),1<s&&(e[0].computedOffset=Number(null!=(t=e[0].offset)?t:0)),0),u=Number(e[0].computedOffset),c=1;c<s;c++){var h=e[c].computedOffset;if(!M(h)&&!M(u)){for(var d=1;d<c-l;d++)e[l+d].computedOffset=u+(Number(h)-u)*d/(c-l);l=c,u=Number(h)}}return e}var Su="backwards|forwards|both|none".split("|"),wu="reverse|alternate|alternate-reverse".split("|");function Tu(t,e){var n,r,i;return t=function(t){"number"==typeof t&&(t=isNaN(t)?{duration:"auto"}:{duration:t});return t}(null!=(r=t)?r:{duration:"auto"}),n=t,r=e,i=new bu,r&&(i.fill="both",i.duration="auto"),"number"!=typeof n||isNaN(n)?void 0!==n&&Object.keys(n).forEach(function(t){void 0===n[t]||null===n[t]||"auto"===n[t]||!("number"!=typeof i[t]&&"duration"!==t||"number"==typeof n[t]&&!isNaN(n[t]))||"fill"===t&&-1===Su.indexOf(n[t])||"direction"===t&&-1===wu.indexOf(n[t])||(i[t]=n[t])}):i.duration=n,i}var Au=function(){function t(t,e,n){var r=this,t=(this.composite="replace",this.iterationComposite="replace",this.target=void 0,this.animation=void 0,this.timing=void 0,this.computedTiming=void 0,this.normalizedKeyframes=void 0,this.timeFraction=void 0,this.interpolations=void 0,this.target=t,this.timing=Tu(n,!1),(this.timing.effect=this).timing.activeDuration=du(this.timing),this.timing.endTime=Math.max(0,this.timing.delay+this.timing.activeDuration+this.timing.endDelay),this.normalizedKeyframes=xu(e,this.timing),this.interpolations=yu(this.normalizedKeyframes,this.timing,this.target),ct.globalThis.Proxy);this.computedTiming=t?new t(this.timing,{get:function(t,e){return"duration"===e?"auto"===t.duration?0:t.duration:"fill"===e?"auto"===t.fill?"none":t.fill:"localTime"===e?r.animation&&r.animation.currentTime||null:"currentIteration"===e?r.animation&&"running"===r.animation.playState?t.currentIteration||0:null:"progress"===e?r.animation&&"running"===r.animation.playState?t.progress||0:null:t[e]},set:function(){return!0}}):this.timing}var e=t.prototype;return e.applyInterpolations=function(){this.interpolations(this.target,Number(this.timeFraction))},e.update=function(t){return null!==t&&(this.timeFraction=vu(this.timing.activeDuration,t,this.timing),null!==this.timeFraction)},e.getKeyframes=function(){return this.normalizedKeyframes},e.setKeyframes=function(t){this.normalizedKeyframes=xu(t)},e.getComputedTiming=function(){return this.computedTiming},e.getTiming=function(){return this.timing},e.updateTiming=function(e){var n=this;Object.keys(e||{}).forEach(function(t){n.timing[t]=e[t]})},t}();function Mu(t,e){return Number(t.id)-Number(e.id)}var t=function(){function t(t){var n=this;this.document=void 0,this.animations=[],this.ticking=!1,this.timelineTicking=!1,this.hasRestartedThisFrame=!1,this.animationsWithPromises=[],this.inTick=!1,this.pendingEffects=[],this.currentTime=null,this.rafId=0,this.rafCallbacks=[],this.frameId=void 0,this.webAnimationsNextTick=function(t){n.currentTime=t,n.discardAnimations(),0===n.animations.length?n.timelineTicking=!1:n.requestAnimationFrame(n.webAnimationsNextTick)},this.processRafCallbacks=function(e){var t=n.rafCallbacks;n.rafCallbacks=[],e<Number(n.currentTime)&&(e=Number(n.currentTime)),n.animations.sort(Mu),n.animations=n.tick(e,!0,n.animations)[0],t.forEach(function(t){t[1](e)}),n.applyPendingEffects()},this.document=t}var e=t.prototype;return e.getAnimations=function(){return this.discardAnimations(),this.animations.slice()},e.isTicking=function(){return this.inTick},e.play=function(t,e,n){t=new Au(t,e,n),e=new Fl(t,this);return this.animations.push(e),this.restartWebAnimationsNextTick(),e.updatePromises(),e.play(),e.updatePromises(),e},e.applyDirtiedAnimation=function(t){var e=this;this.inTick||(t.markTarget(),(t=t.targetAnimations()).sort(Mu),this.tick(Number(this.currentTime),!1,t.slice())[1].forEach(function(t){t=e.animations.indexOf(t);-1!==t&&e.animations.splice(t,1)}),this.applyPendingEffects())},e.restart=function(){return this.ticking||(this.ticking=!0,this.requestAnimationFrame(function(){}),this.hasRestartedThisFrame=!0),this.hasRestartedThisFrame},e.destroy=function(){this.document.defaultView.cancelAnimationFrame(this.frameId)},e.applyPendingEffects=function(){this.pendingEffects.forEach(function(t){null!=t&&t.applyInterpolations()}),this.pendingEffects=[]},e.updateAnimationsPromises=function(){this.animationsWithPromises=this.animationsWithPromises.filter(function(t){return t.updatePromises()})},e.discardAnimations=function(){this.updateAnimationsPromises(),this.animations=this.animations.filter(function(t){return"finished"!==t.playState&&"idle"!==t.playState})},e.restartWebAnimationsNextTick=function(){this.timelineTicking||(this.timelineTicking=!0,this.requestAnimationFrame(this.webAnimationsNextTick))},e.rAF=function(t){var e=this.rafId++;return 0===this.rafCallbacks.length&&(this.frameId=this.document.defaultView.requestAnimationFrame(this.processRafCallbacks)),this.rafCallbacks.push([e,t]),e},e.requestAnimationFrame=function(e){var n=this;return this.rAF(function(t){n.updateAnimationsPromises(),e(t),n.updateAnimationsPromises()})},e.tick=function(n,r,t){var i=this,o=(this.inTick=!0,this.hasRestartedThisFrame=!1,this.currentTime=n,this.ticking=!1,[]),a=[],s=[],l=[];return t.forEach(function(t){t.tick(n,r),t._inEffect?(a.push(t.effect),t.markTarget()):(o.push(t.effect),t.unmarkTarget()),t._needsTick&&(i.ticking=!0);var e=t._inEffect||t._needsTick;((t._inTimeline=e)?s:l).push(t)}),(t=this.pendingEffects).push.apply(t,o),(t=this.pendingEffects).push.apply(t,a),this.ticking&&this.requestAnimationFrame(function(){}),this.inTick=!1,[s,l]},t}(),Ru=(ct.EasingFunction=hu,ct.AnimationTimeline=t,{}.toString),Nu=function(t,e){return Ru.call(t)==="[object "+e+"]"},Cu=function(t){return Nu(t,"Function")},Pu=function(t){return null==t},Ou=function(t){return Array.isArray?Array.isArray(t):Nu(t,"Array")},Iu=function(t){var e=typeof t;return null!==t&&"object"==e||"function"==e};function Lu(t,e){if(t)if(Ou(t))for(var n=0,r=t.length;n<r&&!1!==e(t[n],n);n++);else if(Iu(t))for(var i in t)if(t.hasOwnProperty(i)&&!1===e(t[i],i))break}function ku(t){return Nu(t,"String")}var Du=function(t){return"object"==typeof t&&null!==t},Bu=function(t){if(!Du(t)||!Nu(t,"Object"))return!1;if(null===Object.getPrototypeOf(t))return!0;for(var e=t;null!==Object.getPrototypeOf(e);)e=Object.getPrototypeOf(e);return Object.getPrototypeOf(t)===e};var Fu=function(t){return Nu(t,"Number")},Uu=Object.values?function(t){return Object.values(t)}:function(n){var r=[];return Lu(n,function(t,e){Cu(n)&&"prototype"===e||r.push(t)}),r},Gu=function(t){return Pu(t)?"":t.toString()},Wu=function(t){if("object"!=typeof t||null===t)return t;if(Ou(t))for(var e=[],n=0,r=t.length;n<r;n++)"object"==typeof t[n]&&null!=t[n]?e[n]=Wu(t[n]):e[n]=t[n];else for(var i in e={},t)"object"==typeof t[i]&&null!=t[i]?e[i]=Wu(t[i]):e[i]=t[i];return e};function Vu(r,i,o){var a;return function(){var t=this,e=arguments,n=o&&!a;clearTimeout(a),a=setTimeout(function(){a=null,o||r.apply(t,e)},i),n&&r.apply(t,e)}}var ju=5;function zu(t){for(var e=[],n=1;n<arguments.length;n++)e[n-1]=arguments[n];for(var r=0;r<e.length;r+=1)!function t(e,n,r,i){for(var o in r=r||0,i=i||ju,n){var a;n.hasOwnProperty(o)&&(null!==(a=n[o])&&Bu(a)?(Bu(e[o])||(e[o]={}),r<i?t(e[o],a,r+1,i):e[o]=n[o]):Ou(a)?(e[o]=[],e[o]=e[o].concat(a)):void 0!==a&&(e[o]=a))}}(t,e[r]);return t}function Hu(n,r,i){function o(){c=!1===i.leading?0:Date.now(),a=null,u=n.apply(s,l),a||(s=l=null)}function t(){var t=Date.now(),e=(c||!1!==i.leading||(c=t),r-(t-c));return s=this,l=arguments,e<=0||r<e?(a&&(clearTimeout(a),a=null),c=t,u=n.apply(s,l),a||(s=l=null)):a||!1===i.trailing||(a=setTimeout(o,e)),u}var a,s,l,u,c=0;return i=i||{},t.cancel=function(){clearTimeout(a),c=0,a=s=l=null},t}var Xu;function Yu(t,e){return(Yu=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t})(t,e)}function Ku(t,e){e=e.r;t.arc(e,e,e,0,2*Math.PI,!1)}function qu(t,e){var n,r,i=e.rx,e=e.ry;t.ellipse?t.ellipse(i,e,i,e,0,0,2*Math.PI,!1):(n=e<i?i:e,r=e<i?1:i/e,e=e<i?e/i:1,t.save(),t.scale(r,e),t.arc(0,0,n,0,2*Math.PI))}function $u(t,e){var n,r,i=e.x1,o=e.y1,a=e.x2,s=e.y2,l=e.defX,l=void 0===l?0:l,u=e.defY,u=void 0===u?0:u,c=e.markerStart,h=e.markerEnd,d=e.markerStartOffset,e=e.markerEndOffset,f=0,p=0,g=0,m=0,v=0;c&&ut(c)&&d&&(n=a-i,r=s-o,v=Math.atan2(r,n),f=Math.cos(v)*(d||0),p=Math.sin(v)*(d||0)),h&&ut(h)&&e&&(n=i-a,r=o-s,v=Math.atan2(r,n),g=Math.cos(v)*(e||0),m=Math.sin(v)*(e||0)),t.moveTo(i-l+f,o-u+p),t.lineTo(a-l+g,s-u+m)}function Zu(t,e){var n,r,i=e.defX,o=void 0===i?0:i,i=e.defY,a=void 0===i?0:i,i=e.markerStart,s=e.markerEnd,l=e.markerStartOffset,u=e.markerEndOffset,e=e.path,c=e.absolutePath,h=e.segments,d=0,f=0,p=0,g=0,e=0;i&&ut(i)&&l&&(r=(i=i.parentNode.getStartTangent())[0],i=i[1],n=r[0]-i[0],r=r[1]-i[1],e=Math.atan2(r,n),d=Math.cos(e)*(l||0),f=Math.sin(e)*(l||0)),s&&ut(s)&&u&&(l=(i=s.parentNode.getEndTangent())[0],s=i[1],n=l[0]-s[0],r=l[1]-s[1],e=Math.atan2(r,n),p=Math.cos(e)*(u||0),g=Math.sin(e)*(u||0));for(var m=0;m<c.length;m++){var v=c[m],y=v[0],E=c[m+1],_=0===m&&(0!==d||0!==f),b=(m===c.length-1||E&&("M"===E[0]||"Z"===E[0]))&&0!==p&&0!==g;switch(y){case"M":_?(t.moveTo(v[1]-o+d,v[2]-a+f),t.lineTo(v[1]-o,v[2]-a)):t.moveTo(v[1]-o,v[2]-a);break;case"L":b?t.lineTo(v[1]-o+p,v[2]-a+g):t.lineTo(v[1]-o,v[2]-a);break;case"Q":t.quadraticCurveTo(v[1]-o,v[2]-a,v[3]-o,v[4]-a),b&&t.lineTo(v[3]-o+p,v[4]-a+g);break;case"C":t.bezierCurveTo(v[1]-o,v[2]-a,v[3]-o,v[4]-a,v[5]-o,v[6]-a),b&&t.lineTo(v[5]-o+p,v[6]-a+g);break;case"A":var x,S,w=h[m].arcParams,T=w.cx,A=w.cy,M=w.rx,R=w.ry,N=w.startAngle,C=w.endAngle,P=w.xRotation,w=w.sweepFlag;t.ellipse?t.ellipse(T-o,A-a,M,R,P,N,C,!!(1-w)):(x=R<M?M:R,S=R<M?1:M/R,R=R<M?R/M:1,t.translate(T-o,A-a),t.rotate(P),t.scale(S,R),t.arc(0,0,x,N,C,!!(1-w)),t.scale(1/S,1/R),t.rotate(-P),t.translate(-(T-o),-(A-a))),b&&t.lineTo(v[6]-o+p,v[7]-a+g);break;case"Z":t.closePath()}}}function Qu(t,e){var n,r,i=e.defX,o=void 0===i?0:i,i=e.defY,a=void 0===i?0:i,i=e.markerStart,s=e.markerEnd,l=e.markerStartOffset,u=e.markerEndOffset,c=e.points.points,h=c.length,e=c[0][0]-o,d=c[0][1]-a,f=c[h-1][0]-o,p=c[h-1][1]-a,g=0,m=0,v=0,y=0,E=0;i&&ut(i)&&l&&(n=c[1][0]-c[0][0],r=c[1][1]-c[0][1],E=Math.atan2(r,n),g=Math.cos(E)*(l||0),m=Math.sin(E)*(l||0)),s&&ut(s)&&u&&(n=c[h-1][0]-c[0][0],r=c[h-1][1]-c[0][1],E=Math.atan2(r,n),v=Math.cos(E)*(u||0),y=Math.sin(E)*(u||0)),t.moveTo(e+(g||v),d+(m||y));for(var _=1;_<h-1;_++){var b=c[_];t.lineTo(b[0]-o,b[1]-a)}t.lineTo(f,p)}function Ju(t,e){var n,r,i=e.defX,o=void 0===i?0:i,i=e.defY,a=void 0===i?0:i,i=e.markerStart,s=e.markerEnd,l=e.markerStartOffset,u=e.markerEndOffset,c=e.points.points,h=c.length,e=c[0][0]-o,d=c[0][1]-a,f=c[h-1][0]-o,p=c[h-1][1]-a,g=0,m=0,v=0,y=0,E=0;i&&ut(i)&&l&&(n=c[1][0]-c[0][0],r=c[1][1]-c[0][1],E=Math.atan2(r,n),g=Math.cos(E)*(l||0),m=Math.sin(E)*(l||0)),s&&ut(s)&&u&&(n=c[h-2][0]-c[h-1][0],r=c[h-2][1]-c[h-1][1],E=Math.atan2(r,n),v=Math.cos(E)*(u||0),y=Math.sin(E)*(u||0)),t.moveTo(e+g,d+m);for(var _=1;_<h-1;_++){var b=c[_];t.lineTo(b[0]-o,b[1]-a)}t.lineTo(f+v,p+y)}function tc(t,e){var n,r,i,o,a=e.radius,s=e.width,e=e.height,l=s,u=e;a&&a.some(function(t){return 0!==t})?(n=(s=0<s?1:-1)+(e=0<e?1:-1)==0,r=(a=a.map(function(t){return Ue(t,0,Math.min(Math.abs(l)/2,Math.abs(u)/2))}))[0],i=a[1],o=a[2],a=a[3],t.moveTo(s*r,0),t.lineTo(l-s*i,0),0!==i&&t.arc(l-s*i,e*i,i,-e*Math.PI/2,0<s?0:Math.PI,n),t.lineTo(l,u-e*o),0!==o&&t.arc(l-s*o,u-e*o,o,0<s?0:Math.PI,0<e?Math.PI/2:1.5*Math.PI,n),t.lineTo(s*a,u),0!==a&&t.arc(s*a,u-e*a,a,0<e?Math.PI/2:-Math.PI/2,0<s?Math.PI:0,n),t.lineTo(0,e*r),0!==r&&t.arc(s*r,e*r,r,0<s?Math.PI:0,0<e?1.5*Math.PI:Math.PI/2,n)):t.rect(0,0,l,u)}!function(o,a){var s;if(Cu(o))return(s=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var n,r=a?a.apply(this,t):t[0],i=s.cache;return i.has(r)?i.get(r):(n=o.apply(this,t),i.set(r,n),n)}).cache=new Map;throw new TypeError("Expected a function")}(function(t,e){var n=(e=void 0===e?{}:e).fontSize,r=e.fontFamily,i=e.fontWeight,o=e.fontStyle,e=e.fontVariant;return(Xu=Xu||document.createElement("canvas").getContext("2d")).font=[o,e,i,n+"px",r].join(" "),Xu.measureText(ku(t)?t:"").width},function(t,e){return function(){for(var t=0,e=0,n=arguments.length;e<n;e++)t+=arguments[e].length;for(var r=Array(t),i=0,e=0;e<n;e++)for(var o=arguments[e],a=0,s=o.length;a<s;a++,i++)r[i]=o[a];return r}([t],Uu(e=void 0===e?{}:e)).join("")});var ec=function(i){var t;function e(){for(var t,e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];return(t=i.call.apply(i,[this].concat(n))||this).name="canvas-path-generator",t}t=i,(n=e).prototype=Object.create(t.prototype),Yu(n.prototype.constructor=n,t);var n=e.prototype;return n.init=function(){(t={})[lt.CIRCLE]=Ku,t[lt.ELLIPSE]=qu,t[lt.RECT]=tc,t[lt.LINE]=$u,t[lt.POLYLINE]=Ju,t[lt.POLYGON]=Qu,t[lt.PATH]=Zu,t[lt.TEXT]=void 0,t[lt.GROUP]=void 0,t[lt.IMAGE]=void 0,t[lt.HTML]=void 0,t[lt.MESH]=void 0;var t;this.context.pathGeneratorFactory=t},n.destroy=function(){delete this.context.pathGeneratorFactory},e}(Ws);function nc(){nc=function(){return a};var a={},t=Object.prototype,l=t.hasOwnProperty,u=Object.defineProperty||function(t,e,n){t[e]=n.value},e="function"==typeof Symbol?Symbol:{},r=e.iterator||"@@iterator",n=e.asyncIterator||"@@asyncIterator",i=e.toStringTag||"@@toStringTag";function o(t,e,n){return Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{o({},"")}catch(t){o=function(t,e,n){return t[e]=n}}function s(t,e,n,r){var i,o,a,s,e=e&&e.prototype instanceof d?e:d,e=Object.create(e.prototype),r=new b(r||[]);return u(e,"_invoke",{value:(i=t,o=n,a=r,s="suspendedStart",function(t,e){if("executing"===s)throw new Error("Generator is already running");if("completed"===s){if("throw"===t)throw e;return S()}for(a.method=t,a.arg=e;;){var n=a.delegate;if(n){n=function t(e,n){var r=n.method,i=e.iterator[r];if(void 0===i)return n.delegate=null,"throw"===r&&e.iterator.return&&(n.method="return",n.arg=void 0,t(e,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),h;r=c(i,e.iterator,n.arg);if("throw"===r.type)return n.method="throw",n.arg=r.arg,n.delegate=null,h;i=r.arg;return i?i.done?(n[e.resultName]=i.value,n.next=e.nextLoc,"return"!==n.method&&(n.method="next",n.arg=void 0),n.delegate=null,h):i:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,h)}(n,a);if(n){if(n===h)continue;return n}}if("next"===a.method)a.sent=a._sent=a.arg;else if("throw"===a.method){if("suspendedStart"===s)throw s="completed",a.arg;a.dispatchException(a.arg)}else"return"===a.method&&a.abrupt("return",a.arg);s="executing";n=c(i,o,a);if("normal"===n.type){if(s=a.done?"completed":"suspendedYield",n.arg===h)continue;return{value:n.arg,done:a.done}}"throw"===n.type&&(s="completed",a.method="throw",a.arg=n.arg)}})}),e}function c(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(t){return{type:"throw",arg:t}}}a.wrap=s;var h={};function d(){}function f(){}function p(){}var e={},g=(o(e,r,function(){return this}),Object.getPrototypeOf),g=g&&g(g(x([]))),m=(g&&g!==t&&l.call(g,r)&&(e=g),p.prototype=d.prototype=Object.create(e));function v(t){["next","throw","return"].forEach(function(e){o(t,e,function(t){return this._invoke(e,t)})})}function y(a,s){var e;u(this,"_invoke",{value:function(n,r){function t(){return new s(function(t,e){!function e(t,n,r,i){var o,t=c(a[t],a,n);if("throw"!==t.type)return(n=(o=t.arg).value)&&"object"==typeof n&&l.call(n,"__await")?s.resolve(n.__await).then(function(t){e("next",t,r,i)},function(t){e("throw",t,r,i)}):s.resolve(n).then(function(t){o.value=t,r(o)},function(t){return e("throw",t,r,i)});i(t.arg)}(n,r,t,e)})}return e=e?e.then(t,t):t()}})}function E(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function _(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function b(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(E,this),this.reset(!0)}function x(e){if(e){var n,t=e[r];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length))return n=-1,(t=function t(){for(;++n<e.length;)if(l.call(e,n))return t.value=e[n],t.done=!1,t;return t.value=void 0,t.done=!0,t}).next=t}return{next:S}}function S(){return{value:void 0,done:!0}}return u(m,"constructor",{value:f.prototype=p,configurable:!0}),u(p,"constructor",{value:f,configurable:!0}),f.displayName=o(p,i,"GeneratorFunction"),a.isGeneratorFunction=function(t){t="function"==typeof t&&t.constructor;return!!t&&(t===f||"GeneratorFunction"===(t.displayName||t.name))},a.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,p):(t.__proto__=p,o(t,i,"GeneratorFunction")),t.prototype=Object.create(m),t},a.awrap=function(t){return{__await:t}},v(y.prototype),o(y.prototype,n,function(){return this}),a.AsyncIterator=y,a.async=function(t,e,n,r,i){void 0===i&&(i=Promise);var o=new y(s(t,e,n,r),i);return a.isGeneratorFunction(e)?o:o.next().then(function(t){return t.done?t.value:o.next()})},v(m),o(m,i,"Generator"),o(m,r,function(){return this}),o(m,"toString",function(){return"[object Generator]"}),a.keys=function(t){var e,n=Object(t),r=[];for(e in n)r.push(e);return r.reverse(),function t(){for(;r.length;){var e=r.pop();if(e in n)return t.value=e,t.done=!1,t}return t.done=!0,t}},a.values=x,b.prototype={constructor:b,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(_),!t)for(var e in this)"t"===e.charAt(0)&&l.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=void 0)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(n){if(this.done)throw n;var r=this;function t(t,e){return o.type="throw",o.arg=n,r.next=t,e&&(r.method="next",r.arg=void 0),!!e}for(var e=this.tryEntries.length-1;0<=e;--e){var i=this.tryEntries[e],o=i.completion;if("root"===i.tryLoc)return t("end");if(i.tryLoc<=this.prev){var a=l.call(i,"catchLoc"),s=l.call(i,"finallyLoc");if(a&&s){if(this.prev<i.catchLoc)return t(i.catchLoc,!0);if(this.prev<i.finallyLoc)return t(i.finallyLoc)}else if(a){if(this.prev<i.catchLoc)return t(i.catchLoc,!0)}else{if(!s)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return t(i.finallyLoc)}}}},abrupt:function(t,e){for(var n=this.tryEntries.length-1;0<=n;--n){var r=this.tryEntries[n];if(r.tryLoc<=this.prev&&l.call(r,"finallyLoc")&&this.prev<r.finallyLoc){var i=r;break}}var o=(i=i&&("break"===t||"continue"===t)&&i.tryLoc<=e&&e<=i.finallyLoc?null:i)?i.completion:{};return o.type=t,o.arg=e,i?(this.method="next",this.next=i.finallyLoc,h):this.complete(o)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),h},finish:function(t){for(var e=this.tryEntries.length-1;0<=e;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),_(n),h}},catch:function(t){for(var e=this.tryEntries.length-1;0<=e;--e){var n,r,i=this.tryEntries[e];if(i.tryLoc===t)return"throw"===(n=i.completion).type&&(r=n.arg,_(i)),r}throw new Error("illegal catch attempt")},delegateYield:function(t,e,n){return this.delegate={iterator:x(t),resultName:e,nextLoc:n},"next"===this.method&&(this.arg=void 0),h}},a}function rc(t,e,n,r,i,o,a){try{var s=t[o](a),l=s.value}catch(t){return void n(t)}s.done?e(l):Promise.resolve(l).then(r,i)}function ic(t,e){return(ic=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t})(t,e)}function oc(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}function ac(t,e){var n,r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(r)return(r=r.call(t)).next.bind(r);if(Array.isArray(t)||(r=function(t,e){var n;if(t)return"string"==typeof t?oc(t,e):"Map"===(n="Object"===(n=Object.prototype.toString.call(t).slice(8,-1))&&t.constructor?t.constructor.name:n)||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?oc(t,e):void 0}(t))||e&&t&&"number"==typeof t.length)return r&&(t=r),n=0,function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}};throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var sc=y(),lc=y(),uc=y(),cc=K(),hc=function(){function s(){var s=this;this.canvasConfig=void 0,this.pathGeneratorFactory=void 0,this.pointInPathPickerFactory=void 0,this.isHit=function(t,e,n,r,i){var o=s.pointInPathPickerFactory[t.nodeName];if(o){var n=et(cc,n),e=Bt(lc,Nt(uc,e[0],e[1],0),n),n=t.getGeometryBounds().halfExtents,a=t.parsedStyle.anchor;if(e[0]+=(a&&a[0]||0)*n[0]*2,e[1]+=(a&&a[1]||0)*n[1]*2,o(t,new Ra(e[0],e[1]),r,s.isPointInPath,i))return!0}return!1},this.isPointInPath=function(t,e,n){var t=t.offscreenCanvas.getOrCreateContext(s.canvasConfig.offscreenCanvas),r=s.pathGeneratorFactory[e.nodeName];return r&&(t.beginPath(),r(t,e.parsedStyle),t.closePath()),t.isPointInPath(n.x,n.y)}}var t=s.prototype;return t.apply=function(t,n){var r=this,e=t.config,i=t.renderingService,o=t.renderingContext,a=t.pathGeneratorFactory,t=t.pointInPathPickerFactory,l=(this.canvasConfig=e,this.pathGeneratorFactory=a,this.pointInPathPickerFactory=t,null==(e=o.root)?void 0:e.ownerDocument);i.hooks.pick.tapPromise(s.tag,function(){s=nc().mark(function t(e){return nc().wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",r.pick(l,e,n));case 1:case"end":return t.stop()}},t)});var s,e=function(){var t=this,a=arguments;return new Promise(function(e,n){var r=s.apply(t,a);function i(t){rc(r,e,n,i,o,"next",t)}function o(t){rc(r,e,n,i,o,"throw",t)}i(void 0)})};return function(t){return e.apply(this,arguments)}}()),i.hooks.pickSync.tap(s.tag,function(t){return r.pick(l,t,n)})},t.pick=function(t,e,n){for(var r=e.topmost,i=e.position,o=i.x,i=i.y,a=Nt(sc,o,i,0),s=[],l=ac(t.elementsFromBBox(a[0],a[1],a[0],a[1]));!(u=l()).done;){var u=u.value,c=u.getWorldTransform();if(this.isHit(u,a,c,!1,n)){c=Wr(u);if(c){c=c.parsedStyle.clipPath;if(this.isHit(c,a,c.getWorldTransform(),!0,n)){if(r)return e.picked=[u],e;s.push(u)}}else{if(r)return e.picked=[u],e;s.push(u)}}}return e.picked=s,e},s}();function dc(t,e,n,r){t-=n,n=e-r;return Math.sqrt(t*t+n*n)}function fc(t,e){return Math.abs(t-e)<.001}function pc(t,e){var n=Math.min.apply(Math,t),r=Math.min.apply(Math,e);return{x:n,y:r,width:Math.max.apply(Math,t)-n,height:Math.max.apply(Math,e)-r}}function gc(t){return(t+2*Math.PI)%(2*Math.PI)}hc.tag="CanvasPicker";var mc={box:function(t,e,n,r){return pc([t,n],[e,r])},length:dc,pointAt:function(t,e,n,r,i){return{x:(1-i)*t+i*n,y:(1-i)*e+i*r}},pointDistance:function(t,e,n,r,i,o){var a=(n-t)*(i-t)+(r-e)*(o-e);return a<0?dc(t,e,i,o):(n-t)*(n-t)+(r-e)*(r-e)<a?dc(n,r,i,o):this.pointToLine(t,e,n,r,i,o)},pointToLine:function(t,e,n,r,i,o){n=[n-t,r-e];return ee(n,[0,0])?Math.sqrt((i-t)*(i-t)+(o-e)*(o-e)):(Jt(r=[-n[1],n[0]],r),Math.abs(te([i-t,o-e],r)))},tangentAngle:function(t,e,n,r){return Math.atan2(r-e,n-t)}},vc=1e-4;function yc(t,e,n,r,i,o){for(var a=-1,s=1/0,l=[n,r],u=20,c=1/(u=o&&200<o?o/10:u),h=c/10,d=0;d<=u;d++){var f=d*c,p=[i.apply(void 0,t.concat([f])),i.apply(void 0,e.concat([f]))],p=dc(l[0],l[1],p[0],p[1]);p<s&&(a=f,s=p)}if(0===a)return{x:t[0],y:e[0]};if(1===a)return{x:t[(n=t.length)-1],y:e[n-1]};for(var s=1/0,g=0;g<32&&!(h<vc);g++){var m=a-h,v=a+h,y=[i.apply(void 0,t.concat([m])),i.apply(void 0,e.concat([m]))],y=dc(l[0],l[1],y[0],y[1]);0<=m&&y<s?(a=m,s=y):(m=[i.apply(void 0,t.concat([v])),i.apply(void 0,e.concat([v]))],y=dc(l[0],l[1],m[0],m[1]),v<=1&&y<s?(a=v,s=y):h*=.5)}return{x:i.apply(void 0,t.concat([a])),y:i.apply(void 0,e.concat([a]))}}function Ec(t,e,n,r){var i=1-r;return i*i*t+2*r*i*e+r*r*n}function _c(t,e,n){n=t+n-2*e;return fc(n,0)?[.5]:(t=(t-e)/n)<=1&&0<=t?[t]:[]}function bc(t,e,n,r){return 2*(1-r)*(e-t)+2*r*(n-e)}function xc(t,e,n,r,i,o,a){var s=Ec(t,n,i,a),l=Ec(e,r,o,a),u=mc.pointAt(t,e,n,r,a),n=mc.pointAt(n,r,i,o,a);return[[t,e,u.x,u.y,s,l],[s,l,n.x,n.y,i,o]]}function Sc(t,e,n,r,i,o,a){return 0===a?(dc(t,e,n,r)+dc(n,r,i,o)+dc(t,e,i,o))/2:(e=(t=xc(t,e,n,r,i,o,.5))[0],n=t[1],e.push(a-1),n.push(a-1),Sc.apply(void 0,e)+Sc.apply(void 0,n))}var wc={box:function(t,e,n,r,i,o){var a=_c(t,n,i)[0],s=_c(e,r,o)[0],l=[t,i],u=[e,o];return void 0!==a&&l.push(Ec(t,n,i,a)),void 0!==s&&u.push(Ec(e,r,o,s)),pc(l,u)},length:function(t,e,n,r,i,o){return Sc(t,e,n,r,i,o,3)},nearestPoint:function(t,e,n,r,i,o,a,s){return yc([t,n,i],[e,r,o],a,s,Ec)},pointDistance:function(t,e,n,r,i,o,a,s){t=this.nearestPoint(t,e,n,r,i,o,a,s);return dc(t.x,t.y,a,s)},interpolationAt:Ec,pointAt:function(t,e,n,r,i,o,a){return{x:Ec(t,n,i,a),y:Ec(e,r,o,a)}},divide:xc,tangentAngle:function(t,e,n,r,i,o,a){t=bc(t,n,i,a),n=bc(e,r,o,a);return gc(Math.atan2(n,t))}};function Tc(t,e,n,r,i){var o=1-i;return o*o*o*t+3*e*i*o*o+3*n*i*i*o+r*i*i*i}function Ac(t,e,n,r,i){var o=1-i;return 3*(o*o*(e-t)+2*o*i*(n-e)+i*i*(r-n))}function Mc(t,e,n,r){var i,o,r=-3*t+9*e-9*n+3*r,n=6*t-12*e+6*n,e=3*e-3*t,t=[];return fc(r,0)?fc(n,0)||0<=(i=-e/n)&&i<=1&&t.push(i):fc(e=n*n-4*r*e,0)?t.push(-n/(2*r)):0<e&&(o=(-n-(e=Math.sqrt(e)))/(2*r),0<=(i=(-n+e)/(2*r))&&i<=1&&t.push(i),0<=o)&&o<=1&&t.push(o),t}function Rc(t,e,n,r,i,o,a,s,l){var u=Tc(t,n,i,a,l),c=Tc(e,r,o,s,l),h=mc.pointAt(t,e,n,r,l),n=mc.pointAt(n,r,i,o,l),r=mc.pointAt(i,o,a,s,l),i=mc.pointAt(h.x,h.y,n.x,n.y,l),o=mc.pointAt(n.x,n.y,r.x,r.y,l);return[[t,e,h.x,h.y,i.x,i.y,u,c],[u,c,o.x,o.y,r.x,r.y,a,s]]}function Nc(t,e,n,r,i,o,a,s,l){if(0===l){for(var u=[t,n,i,a],c=[e,r,o,s],h=0,d=u.length,f=0;f<d;f++)h+=dc(u[f],c[f],u[(f+1)%d],c[(f+1)%d]);return h/2}t=Rc(t,e,n,r,i,o,a,s,.5),e=[].concat(t[0],[l-1]),n=[].concat(t[1],[l-1]);return Nc.apply(void 0,e)+Nc.apply(void 0,n)}var Cc={extrema:Mc,box:function(t,e,n,r,i,o,a,s){for(var l=[t,a],u=[e,s],c=Mc(t,n,i,a),h=Mc(e,r,o,s),d=0;d<c.length;d++)l.push(Tc(t,n,i,a,c[d]));for(var f=0;f<h.length;f++)u.push(Tc(e,r,o,s,h[f]));return pc(l,u)},length:function(t,e,n,r,i,o,a,s){return Nc(t,e,n,r,i,o,a,s,3)},nearestPoint:function(t,e,n,r,i,o,a,s,l,u,c){return yc([t,n,i,a],[e,r,o,s],l,u,Tc,c)},pointDistance:function(t,e,n,r,i,o,a,s,l,u,c){t=this.nearestPoint(t,e,n,r,i,o,a,s,l,u,c);return dc(t.x,t.y,l,u)},interpolationAt:Tc,pointAt:function(t,e,n,r,i,o,a,s,l){return{x:Tc(t,n,i,a,l),y:Tc(e,r,o,s,l)}},divide:Rc,tangentAngle:function(t,e,n,r,i,o,a,s,l){t=Ac(t,n,i,a,l),n=Ac(e,r,o,s,l);return gc(Math.atan2(n,t))}};function Pc(t,e,n,r){t-=n,n=e-r;return Math.sqrt(t*t+n*n)}function Oc(t,e,n,r,i,o){return t<=i&&i<=t+n&&e<=o&&o<=e+r}function Ic(t,e,n,r,i,o,a,s){var l=(Math.atan2(s-e,a-t)+2*Math.PI)%(2*Math.PI),t={x:t+n*Math.cos(l),y:e+n*Math.sin(l)};return Pc(t.x,t.y,a,s)<=o/2}function Lc(t,e,n,r,i,o,a){var s=Math.min(t,n),l=Math.max(t,n),u=Math.min(e,r),c=Math.max(e,r),h=i/2;return s-h<=o&&o<=l+h&&u-h<=a&&a<=c+h&&mc.pointToLine(t,e,n,r,o,a)<=i/2}function kc(t,e,n,r,i){var o=t.length;if(!(o<2)){for(var a=0;a<o-1;a++)if(Lc(t[a][0],t[a][1],t[a+1][0],t[a+1][1],e,n,r))return!0;if(i){var i=t[0],s=t[o-1];if(Lc(i[0],i[1],s[0],s[1],e,n,r))return!0}}return!1}var Dc=1e-6;function Bc(t){return Math.abs(t)<Dc?0:t<0?-1:1}function Fc(t,e,n){var r=!1,i=t.length;if(i<=2)return!1;for(var o,a,s,l=0;l<i;l++){var u=t[l],c=t[(l+1)%i];if(a=c,((s=[e,n])[0]-(o=u)[0])*(a[1]-o[1])==(a[0]-o[0])*(s[1]-o[1])&&Math.min(o[0],a[0])<=s[0]&&s[0]<=Math.max(o[0],a[0])&&Math.min(o[1],a[1])<=s[1]&&s[1]<=Math.max(o[1],a[1]))return!0;0<Bc(u[1]-n)!=0<Bc(c[1]-n)&&Bc(e-(n-u[1])*(u[0]-c[0])/(u[1]-c[1])-u[0])<0&&(r=!r)}return r}function Uc(t,e,n){for(var r=!1,i=0;i<t.length&&!(r=Fc(t[i],e,n));i++);return r}function Gc(t,e,n){var t=t.parsedStyle,r=t.r,i=t.fill,o=t.stroke,a=t.lineWidth,s=t.increasedLineWidthForHitTesting,t=t.pointerEvents,a=((a||0)+(s||0))/2,s=Pc(r,r,e.x,e.y),e=Zi(t,i,o),t=e[0],i=e[1];return t&&i||n?s<=r+a:t?s<=r:!!i&&r-a<=s&&s<=r+a}function Wc(t,e,n,r){return t/(n*n)+e/(r*r)}function Vc(t,e,n){var t=t.parsedStyle,r=t.rx,i=t.ry,o=t.fill,a=t.stroke,s=t.lineWidth,l=t.increasedLineWidthForHitTesting,t=t.pointerEvents,u=e.x,e=e.y,t=Zi(t,o,a),o=t[0],a=t[1],t=((s||0)+(l||0))/2,s=(u-r)*(u-r),l=(e-i)*(e-i);return o&&a||n?Wc(s,l,r+t,i+t)<=1:o?Wc(s,l,r,i)<=1:!!a&&1<=Wc(s,l,r-t,i-t)&&Wc(s,l,r+t,i+t)<=1}function jc(t,e,n){var t=t.parsedStyle,r=t.x1,i=t.y1,o=t.x2,a=t.y2,s=t.lineWidth,l=t.increasedLineWidthForHitTesting,u=t.defX,c=t.defY;return!(!Zi(t.pointerEvents,t.fill,t.stroke)[1]&&!n||!s)&&Lc(r,i,o,a,(s||0)+(l||0),e.x+(void 0===u?0:u),e.y+(void 0===c?0:c))}function zc(t,e,n,r,i){var o=t.parsedStyle,a=o.lineWidth,s=o.increasedLineWidthForHitTesting,l=o.stroke,u=o.fill,c=o.defX,c=void 0===c?0:c,h=o.defY,h=void 0===h?0:h,d=o.path,o=o.pointerEvents,f=d.segments,p=d.hasArc,g=d.polylines,d=d.polygons,o=Zi(o,(null==d?void 0:d.length)&&u,l),u=o[0],l=o[1],o=Fi(t),m=!1;return u||n?p?r(i,t,e):Uc(d,e.x+c,e.y+h)||Uc(g,e.x+c,e.y+h):l||n?function(t,e,n,r,i){for(var o=!1,a=e/2,s=0;s<t.length;s++){var l=t[s],u=l.currentPoint,c=l.params,h=l.prePoint,d=l.box;if(!d||Oc(d.x-a,d.y-a,d.width+e,d.height+e,n,r))switch(l.command){case"L":case"Z":if(o=Lc(h[0],h[1],u[0],u[1],e,n,r))return!0;break;case"Q":if(o=wc.pointDistance(h[0],h[1],c[1],c[2],c[3],c[4],n,r)<=e/2)return!0;break;case"C":if(o=Cc.pointDistance(h[0],h[1],c[1],c[2],c[3],c[4],c[5],c[6],n,r,i)<=e/2)return!0;break;case"A":l.cubicParams||(l.cubicParams=me(h[0],h[1],c[1],c[2],c[3],c[4],c[5],c[6],c[7],void 0));for(var f=l.cubicParams,p=h,g=0;g<f.length;g+=6){var m=Cc.pointDistance(p[0],p[1],f[g],f[g+1],f[g+2],f[g+3],f[g+4],f[g+5],n,r,i),p=[f[g+4],f[g+5]];if(o=m<=e/2)return!0}}}return o}(f,(a||0)+(s||0),e.x+c,e.y+h,o):m}function Hc(t,e,n){var t=t.parsedStyle,r=t.stroke,i=t.fill,o=t.lineWidth,a=t.increasedLineWidthForHitTesting,s=t.points,l=t.defX,l=void 0===l?0:l,u=t.defY,u=void 0===u?0:u,t=Zi(t.pointerEvents,i,r),i=t[0],r=!1;return r=(r=t[1]||n?kc(s.points,(o||0)+(a||0),e.x+l,e.y+u,!0):r)||!i&&!n?r:Fc(s.points,e.x+l,e.y+u)}function Xc(t,e,n){var t=t.parsedStyle,r=t.lineWidth,i=t.increasedLineWidthForHitTesting,o=t.points,a=t.defX,s=t.defY;return!(!Zi(t.pointerEvents,t.fill,t.stroke)[1]&&!n||!r)&&kc(o.points,(r||0)+(i||0),e.x+(void 0===a?0:a),e.y+(void 0===s?0:s),!1)}function Yc(t,e,n,r,i){var o,a,s,l,u,c,h,d,f,p=t.parsedStyle,g=p.radius,m=p.fill,v=p.stroke,y=p.lineWidth,E=p.increasedLineWidthForHitTesting,_=p.width,b=p.height,p=Zi(p.pointerEvents,m,v),m=p[0],v=p[1],p=(y||0)+(E||0);return g&&g.some(function(t){return 0!==t})?(y=!1,(v||n)&&(h=E=0,l=_,c=b,g=g.map(function(t){return Ue(t,0,Math.min(Math.abs(_)/2,Math.abs(b)/2))}),f=p,o=e.x,a=e.y,d=g[0],s=g[1],u=g[2],g=g[3],y=Lc(E+d,h,E+l-s,h,f,o,a)||Lc(E+l,h+s,E+l,h+c-u,f,o,a)||Lc(E+l-u,h+c,E+g,h+c,f,o,a)||Lc(E,h+c-g,E,h+d,f,o,a)||Ic(E+l-s,h+s,s,Math.PI,Math.PI,f,o,a)||Ic(E+l-u,h+c-u,u,0,Math.PI,f,o,a)||Ic(E+g,h+c-g,g,Math.PI,Math.PI,f,o,a)||Ic(E+d,h+d,d,Math.PI,Math.PI,f,o,a)),y||!m&&!n?y:r(i,t,e)):(s=p/2,m&&v||n?Oc(0-s,0-s,_+s,b+s,e.x,e.y):m?Oc(0,0,_,b,e.x,e.y):!!v&&(u=l=0,c=_,g=b,E=p,h=e.x,d=e.y,Oc(l-(f=E/2),u-f,c,E,h,d)||Oc(l+c-f,u-f,E,g,h,d)||Oc(l+f,u+g-f,c,E,h,d)||Oc(l-f,u+f,E,g,h,d)))}var Kc=function(i){var t;function e(){for(var t,e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];return(t=i.call.apply(i,[this].concat(n))||this).name="canvas-picker",t}t=i,(n=e).prototype=Object.create(t.prototype),ic(n.prototype.constructor=n,t);var n=e.prototype;return n.init=function(){function t(){return!0}(e={})[lt.CIRCLE]=Gc,e[lt.ELLIPSE]=Vc,e[lt.RECT]=Yc,e[lt.LINE]=jc,e[lt.POLYLINE]=Xc,e[lt.POLYGON]=Hc,e[lt.PATH]=zc,e[lt.TEXT]=t,e[lt.GROUP]=null,e[lt.IMAGE]=t,e[lt.HTML]=null,e[lt.MESH]=null;var e;this.context.pointInPathPickerFactory=e,this.addRenderingPlugin(new hc)},n.destroy=function(){delete this.context.pointInPathPickerFactory,this.removeAllRenderingPlugins()},e}(Ws);function qc(){qc=function(){return a};var a={},t=Object.prototype,l=t.hasOwnProperty,u=Object.defineProperty||function(t,e,n){t[e]=n.value},e="function"==typeof Symbol?Symbol:{},r=e.iterator||"@@iterator",n=e.asyncIterator||"@@asyncIterator",i=e.toStringTag||"@@toStringTag";function o(t,e,n){return Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{o({},"")}catch(t){o=function(t,e,n){return t[e]=n}}function s(t,e,n,r){var i,o,a,s,e=e&&e.prototype instanceof d?e:d,e=Object.create(e.prototype),r=new b(r||[]);return u(e,"_invoke",{value:(i=t,o=n,a=r,s="suspendedStart",function(t,e){if("executing"===s)throw new Error("Generator is already running");if("completed"===s){if("throw"===t)throw e;return S()}for(a.method=t,a.arg=e;;){var n=a.delegate;if(n){n=function t(e,n){var r=n.method,i=e.iterator[r];if(void 0===i)return n.delegate=null,"throw"===r&&e.iterator.return&&(n.method="return",n.arg=void 0,t(e,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),h;r=c(i,e.iterator,n.arg);if("throw"===r.type)return n.method="throw",n.arg=r.arg,n.delegate=null,h;i=r.arg;return i?i.done?(n[e.resultName]=i.value,n.next=e.nextLoc,"return"!==n.method&&(n.method="next",n.arg=void 0),n.delegate=null,h):i:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,h)}(n,a);if(n){if(n===h)continue;return n}}if("next"===a.method)a.sent=a._sent=a.arg;else if("throw"===a.method){if("suspendedStart"===s)throw s="completed",a.arg;a.dispatchException(a.arg)}else"return"===a.method&&a.abrupt("return",a.arg);s="executing";n=c(i,o,a);if("normal"===n.type){if(s=a.done?"completed":"suspendedYield",n.arg===h)continue;return{value:n.arg,done:a.done}}"throw"===n.type&&(s="completed",a.method="throw",a.arg=n.arg)}})}),e}function c(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(t){return{type:"throw",arg:t}}}a.wrap=s;var h={};function d(){}function f(){}function p(){}var e={},g=(o(e,r,function(){return this}),Object.getPrototypeOf),g=g&&g(g(x([]))),m=(g&&g!==t&&l.call(g,r)&&(e=g),p.prototype=d.prototype=Object.create(e));function v(t){["next","throw","return"].forEach(function(e){o(t,e,function(t){return this._invoke(e,t)})})}function y(a,s){var e;u(this,"_invoke",{value:function(n,r){function t(){return new s(function(t,e){!function e(t,n,r,i){var o,t=c(a[t],a,n);if("throw"!==t.type)return(n=(o=t.arg).value)&&"object"==typeof n&&l.call(n,"__await")?s.resolve(n.__await).then(function(t){e("next",t,r,i)},function(t){e("throw",t,r,i)}):s.resolve(n).then(function(t){o.value=t,r(o)},function(t){return e("throw",t,r,i)});i(t.arg)}(n,r,t,e)})}return e=e?e.then(t,t):t()}})}function E(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function _(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function b(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(E,this),this.reset(!0)}function x(e){if(e){var n,t=e[r];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length))return n=-1,(t=function t(){for(;++n<e.length;)if(l.call(e,n))return t.value=e[n],t.done=!1,t;return t.value=void 0,t.done=!0,t}).next=t}return{next:S}}function S(){return{value:void 0,done:!0}}return u(m,"constructor",{value:f.prototype=p,configurable:!0}),u(p,"constructor",{value:f,configurable:!0}),f.displayName=o(p,i,"GeneratorFunction"),a.isGeneratorFunction=function(t){t="function"==typeof t&&t.constructor;return!!t&&(t===f||"GeneratorFunction"===(t.displayName||t.name))},a.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,p):(t.__proto__=p,o(t,i,"GeneratorFunction")),t.prototype=Object.create(m),t},a.awrap=function(t){return{__await:t}},v(y.prototype),o(y.prototype,n,function(){return this}),a.AsyncIterator=y,a.async=function(t,e,n,r,i){void 0===i&&(i=Promise);var o=new y(s(t,e,n,r),i);return a.isGeneratorFunction(e)?o:o.next().then(function(t){return t.done?t.value:o.next()})},v(m),o(m,i,"Generator"),o(m,r,function(){return this}),o(m,"toString",function(){return"[object Generator]"}),a.keys=function(t){var e,n=Object(t),r=[];for(e in n)r.push(e);return r.reverse(),function t(){for(;r.length;){var e=r.pop();if(e in n)return t.value=e,t.done=!1,t}return t.done=!0,t}},a.values=x,b.prototype={constructor:b,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(_),!t)for(var e in this)"t"===e.charAt(0)&&l.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=void 0)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(n){if(this.done)throw n;var r=this;function t(t,e){return o.type="throw",o.arg=n,r.next=t,e&&(r.method="next",r.arg=void 0),!!e}for(var e=this.tryEntries.length-1;0<=e;--e){var i=this.tryEntries[e],o=i.completion;if("root"===i.tryLoc)return t("end");if(i.tryLoc<=this.prev){var a=l.call(i,"catchLoc"),s=l.call(i,"finallyLoc");if(a&&s){if(this.prev<i.catchLoc)return t(i.catchLoc,!0);if(this.prev<i.finallyLoc)return t(i.finallyLoc)}else if(a){if(this.prev<i.catchLoc)return t(i.catchLoc,!0)}else{if(!s)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return t(i.finallyLoc)}}}},abrupt:function(t,e){for(var n=this.tryEntries.length-1;0<=n;--n){var r=this.tryEntries[n];if(r.tryLoc<=this.prev&&l.call(r,"finallyLoc")&&this.prev<r.finallyLoc){var i=r;break}}var o=(i=i&&("break"===t||"continue"===t)&&i.tryLoc<=e&&e<=i.finallyLoc?null:i)?i.completion:{};return o.type=t,o.arg=e,i?(this.method="next",this.next=i.finallyLoc,h):this.complete(o)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),h},finish:function(t){for(var e=this.tryEntries.length-1;0<=e;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),_(n),h}},catch:function(t){for(var e=this.tryEntries.length-1;0<=e;--e){var n,r,i=this.tryEntries[e];if(i.tryLoc===t)return"throw"===(n=i.completion).type&&(r=n.arg,_(i)),r}throw new Error("illegal catch attempt")},delegateYield:function(t,e,n){return this.delegate={iterator:x(t),resultName:e,nextLoc:n},"next"===this.method&&(this.arg=void 0),h}},a}function $c(t,e,n,r,i,o,a){try{var s=t[o](a),l=s.value}catch(t){return void n(t)}s.done?e(l):Promise.resolve(l).then(r,i)}function Zc(s){return function(){var t=this,a=arguments;return new Promise(function(e,n){var r=s.apply(t,a);function i(t){$c(r,e,n,i,o,"next",t)}function o(t){$c(r,e,n,i,o,"throw",t)}i(void 0)})}}function Qc(){return(Qc=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n,r=arguments[e];for(n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t}).apply(this,arguments)}function Jc(t,e){return(Jc=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t})(t,e)}var th=function(){function r(t){this.canvasRendererPluginOptions=void 0,this.context=void 0,this.pathGeneratorFactory=void 0,this.rBush=void 0,this.removedRBushNodeAABBs=[],this.renderQueue=[],this.restoreStack=[],this.clearFullScreen=!1,this.vpMatrix=K(),this.dprMatrix=K(),this.tmpMat4=K(),this.vec3a=y(),this.vec3b=y(),this.vec3c=y(),this.vec3d=y(),this.canvasRendererPluginOptions=t}var t=r.prototype;return t.apply=function(t,u){function o(t){(t=t.target.rBushNode).aabb&&h.removedRBushNodeAABBs.push(t.aabb)}function a(t){(t=t.target.rBushNode).aabb&&h.removedRBushNodeAABBs.push(t.aabb)}function c(t,e){t.isVisible()&&!t.isCulled()&&(h.renderDisplayObject(t,e,h.context,h.restoreStack,u),h.saveDirtyAABB(t)),(t.sortable.sorted||t.childNodes).forEach(function(t){c(t,e)})}var h=this,d=(this.context=t).config,f=t.camera,l=t.renderingService,p=t.renderingContext,e=t.rBushRoot,n=t.pathGeneratorFactory,g=(this.rBush=e,this.pathGeneratorFactory=n,t.contextService),m=p.root.ownerDocument.defaultView;l.hooks.init.tapPromise(r.tag,Zc(qc().mark(function t(){var e,n,r,i;return qc().wrap(function(t){for(;;)switch(t.prev=t.next){case 0:m.addEventListener(v.UNMOUNTED,o),m.addEventListener(v.CULLED,a),e=g.getDPR(),n=d.width,r=d.height,i=g.getContext(),h.clearRect(i,0,0,n*e,r*e,d.background);case 6:case"end":return t.stop()}},t)}))),l.hooks.destroy.tap(r.tag,function(){m.removeEventListener(v.UNMOUNTED,o),m.removeEventListener(v.CULLED,a)}),l.hooks.beginFrame.tap(r.tag,function(){var t=g.getContext(),e=g.getDPR(),n=d.width,r=d.height,i=h.canvasRendererPluginOptions,o=i.dirtyObjectNumThreshold,i=i.dirtyObjectRatioThreshold,a=l.getStats(),s=a.total,a=a.rendered,s=a/s;h.clearFullScreen=l.disableDirtyRectangleRendering()||o<a&&i<s,t&&(t.resetTransform?t.resetTransform():t.setTransform(1,0,0,1,0,0),h.clearFullScreen)&&h.clearRect(t,0,0,n*e,r*e,d.background)});l.hooks.endFrame.tap(r.tag,function(){var e=g.getContext(),t=g.getDPR();if(dt(h.dprMatrix,[t,t,1]),rt(h.vpMatrix,h.dprMatrix,f.getOrthoMatrix()),h.clearFullScreen)c(p.root,e);else{t=h.safeMergeAABB.apply(h,[h.mergeDirtyAABBs(h.renderQueue)].concat(h.removedRBushNodeAABBs.map(function(t){var e=t.minX,n=t.minY,r=t.maxX,t=t.maxY,i=new Ta;return i.setMinMax([e,n,0],[r,t,0]),i})));if(h.removedRBushNodeAABBs=[],Ta.isEmpty(t))return void(h.renderQueue=[]);var n=h.convertAABB2Rect(t),r=n.x,i=n.y,o=n.width,n=n.height,a=Bt(h.vec3a,[r,i,0],h.vpMatrix),s=Bt(h.vec3b,[r+o,i,0],h.vpMatrix),l=Bt(h.vec3c,[r,i+n,0],h.vpMatrix),r=Bt(h.vec3d,[r+o,i+n,0],h.vpMatrix),o=Math.min(a[0],s[0],r[0],l[0]),i=Math.min(a[1],s[1],r[1],l[1]),n=Math.max(a[0],s[0],r[0],l[0]),a=Math.max(a[1],s[1],r[1],l[1]),s=Math.floor(o),r=Math.floor(i),l=Math.ceil(n-o),n=Math.ceil(a-i);e.save(),h.clearRect(e,s,r,l,n,d.background),e.beginPath(),e.rect(s,r,l,n),e.clip(),e.setTransform(h.vpMatrix[0],h.vpMatrix[1],h.vpMatrix[4],h.vpMatrix[5],h.vpMatrix[12],h.vpMatrix[13]),d.renderer.getConfig().enableDirtyRectangleRenderingDebug&&m.dispatchEvent(new Ga(qs.DIRTY_RECTANGLE,{dirtyRect:{x:s,y:r,width:l,height:n}})),h.searchDirtyObjects(t).sort(function(t,e){return t.sortable.renderOrder-e.sortable.renderOrder}).forEach(function(t){t&&t.isVisible()&&!t.isCulled()&&h.renderDisplayObject(t,e,h.context,h.restoreStack,u)}),e.restore(),h.renderQueue.forEach(function(t){h.saveDirtyAABB(t)}),h.renderQueue=[]}h.restoreStack.forEach(function(){e.restore()}),h.restoreStack=[]}),l.hooks.render.tap(r.tag,function(t){h.clearFullScreen||h.renderQueue.push(t)})},t.clearRect=function(t,e,n,r,i,o){t.clearRect(e,n,r,i),o&&(t.fillStyle=o,t.fillRect(e,n,r,i))},t.renderDisplayObject=function(t,e,n,r,i){var o,a=t.nodeName,s=r[r.length-1],s=(!s||t.compareDocumentPosition(s)&Node.DOCUMENT_POSITION_CONTAINS||(e.restore(),r.pop()),this.context.styleRendererFactory[a]),a=this.pathGeneratorFactory[a],l=t.parsedStyle.clipPath;l&&(this.applyWorldTransform(e,l),o=this.pathGeneratorFactory[l.nodeName])&&(e.save(),r.push(t),e.beginPath(),o(e,l.parsedStyle),e.closePath(),e.clip()),s&&(this.applyWorldTransform(e,t),e.save(),this.applyAttributesToContext(e,t)),a&&(e.beginPath(),a(e,t.parsedStyle),t.nodeName!==lt.LINE)&&t.nodeName!==lt.PATH&&t.nodeName!==lt.POLYLINE&&e.closePath(),s&&(s.render(e,t.parsedStyle,t,n,this,i),e.restore()),t.renderable.dirty=!1},t.convertAABB2Rect=function(t){var e=t.getMin(),t=t.getMax(),n=Math.floor(e[0]),e=Math.floor(e[1]);return{x:n,y:e,width:Math.ceil(t[0])-n,height:Math.ceil(t[1])-e}},t.mergeDirtyAABBs=function(t){var n=new Ta;return t.forEach(function(t){var e=t.getRenderBounds(),e=(n.add(e),t.renderable.dirtyRenderBounds);e&&n.add(e)}),n},t.searchDirtyObjects=function(t){var e=t.getMin(),n=e[0],e=e[1],t=t.getMax(),r=t[0],t=t[1];return this.rBush.search({minX:n,minY:e,maxX:r,maxY:t}).map(function(t){return t.displayObject})},t.saveDirtyAABB=function(t){var e=t.renderable,t=(e.dirtyRenderBounds||(e.dirtyRenderBounds=new Ta),t.getRenderBounds());t&&e.dirtyRenderBounds.update(t.center,t.halfExtents)},t.applyAttributesToContext=function(t,e){var n=e.parsedStyle,r=n.stroke,i=n.fill,o=n.opacity,a=n.lineDash,n=n.lineDashOffset;a&&t.setLineDash(a),M(n)||(t.lineDashOffset=n),M(o)||(t.globalAlpha*=o),M(r)||Array.isArray(r)||r.isNone||(t.strokeStyle=e.attributes.stroke),M(i)||Array.isArray(i)||i.isNone||(t.fillStyle=e.attributes.fill)},t.applyWorldTransform=function(t,e,n){var r=0,i=0,o=(e.parsedStyle||{}).anchor,a=o&&o[0]||0,o=o&&o[1]||0;0===a&&0===o||(r=-a*((a=e.geometry.contentBounds)&&2*a.halfExtents[0]||0),i=-o*(a&&2*a.halfExtents[1]||0)),n?($(this.tmpMat4,e.getLocalTransform()),this.vec3a[0]=r,this.vec3a[1]=i,this.vec3a[2]=0,it(this.tmpMat4,this.tmpMat4,this.vec3a),rt(this.tmpMat4,n,this.tmpMat4)):($(this.tmpMat4,e.getWorldTransform()),this.vec3a[0]=r,this.vec3a[1]=i,this.vec3a[2]=0,it(this.tmpMat4,this.tmpMat4,this.vec3a)),rt(this.tmpMat4,this.vpMatrix,this.tmpMat4),t.setTransform(this.tmpMat4[0],this.tmpMat4[1],this.tmpMat4[4],this.tmpMat4[5],this.tmpMat4[12],this.tmpMat4[13])},t.safeMergeAABB=function(){for(var e=new Ta,t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];return n.forEach(function(t){e.add(t)}),e},r}(),eh=(th.tag="CanvasRenderer",function(){function t(t){this.imagePool=void 0,this.imagePool=t}var e=t.prototype;return e.render=function(t,e,n,r,i,o){var a=e.fill,s=e.fillRule,l=e.opacity,u=e.fillOpacity,c=e.stroke,h=e.strokeOpacity,d=e.lineWidth,f=e.lineCap,p=e.lineJoin,g=e.shadowType,m=e.shadowColor,v=e.shadowBlur,y=e.filter,e=e.miterLimit,E=!M(a)&&!a.isNone,_=!M(c)&&!c.isNone&&0<d,b=0===a.alpha,y=!(!y||!y.length),m=!M(m)&&0<v,v=n.nodeName,g="inner"===g,v=_&&m&&(v===lt.PATH||v===lt.LINE||v===lt.POLYLINE||b||g);E&&(t.globalAlpha=l*u,v||nh(n,t,m),this.fill(t,n,a,s,r,i,o),v||this.clearShadowAndFilter(t,y,m)),_&&(t.globalAlpha=l*h,t.lineWidth=d,M(e)||(t.miterLimit=e),M(f)||(t.lineCap=f),M(p)||(t.lineJoin=p),v&&(g&&(t.globalCompositeOperation="source-atop"),nh(n,t,!0),g)&&(this.stroke(t,n,c,r,i,o),t.globalCompositeOperation="source-over",this.clearShadowAndFilter(t,y,!0)),this.stroke(t,n,c,r,i,o))},e.clearShadowAndFilter=function(t,e,n){n&&(t.shadowColor="transparent",t.shadowBlur=0),e&&(n=t.filter,!M(n))&&-1<n.indexOf("drop-shadow")&&(t.filter=n.replace(/drop-shadow\([^)]*\)/,"").trim()||"none")},e.fill=function(e,n,t,r,i,o,a){var s=this;Array.isArray(t)?t.forEach(function(t){e.fillStyle=s.getColor(t,n,e),r?e.fill(r):e.fill()}):(wo(t)&&(e.fillStyle=this.getPattern(t,n,e,i,o,a)),r?e.fill(r):e.fill())},e.stroke=function(e,n,t,r,i,o){var a=this;Array.isArray(t)?t.forEach(function(t){e.strokeStyle=a.getColor(t,n,e),e.stroke()}):(wo(t)&&(e.strokeStyle=this.getPattern(t,n,e,r,i,o)),e.stroke())},e.getPattern=function(t,e,n,r,i,o){var a,s,l,u,c,h,d;return"rect"===t.image.nodeName&&(a=(s=t.image.parsedStyle).width,s=s.height,l=r.contextService.getDPR(),u=r.config.offscreenCanvas,(c=o.offscreenCanvas.getOrCreateCanvas(u)).width=a*l,c.height=s*l,h=o.offscreenCanvas.getOrCreateContext(u),d=[],t.image.forEach(function(t){i.renderDisplayObject(t,h,r,d,o)}),d.forEach(function(){h.restore()})),this.imagePool.getOrCreatePatternSync(t,n,c,l,function(){e.renderable.dirty=!0,r.renderingService.dirtify()})},e.getColor=function(t,e,n){var r;return t.type!==ur.LinearGradient&&t.type!==ur.RadialGradient||(r=(e=e.getGeometryBounds())&&2*e.halfExtents[0]||1,e=e&&2*e.halfExtents[1]||1,r=this.imagePool.getOrCreateGradient(Qc({type:t.type},t.value,{width:r,height:e}),n)),r},t}());function nh(t,e,n){var r=t.parsedStyle,i=r.filter,o=r.shadowColor,a=r.shadowBlur,s=r.shadowOffsetX,r=r.shadowOffsetY;i&&i.length&&(e.filter=t.style.filter),n&&(e.shadowColor=o.toString(),e.shadowBlur=a||0,e.shadowOffsetX=s||0,e.shadowOffsetY=r||0)}var rh=function(){function t(t){this.imagePool=void 0,this.imagePool=t}return t.prototype.render=function(t,e,n){var r=e.width,i=e.height,o=e.img,a=e.shadowColor,e=e.shadowBlur,o=Fe(o)?this.imagePool.getImageSync(o):(r=r||o.width,i=i||o.height,o);if(o){nh(n,t,!M(a)&&0<e);try{t.drawImage(o,0,0,r,i)}catch(t){}}},t}(),ih=function(){function t(){}var e=t.prototype;return e.render=function(t,e,n){var r=e.lineWidth,i=e.textAlign,o=e.textBaseline,a=e.lineJoin,s=e.miterLimit,l=e.letterSpacing,u=e.stroke,c=e.fill,h=e.fillOpacity,d=e.strokeOpacity,f=e.opacity,p=e.metrics,g=e.dx,m=e.dy,v=e.shadowColor,e=e.shadowBlur,y=p.font,E=p.lines,_=p.height,b=p.lineHeight,x=p.lineMetrics,p=(t.font=y,t.lineWidth=r,t.textAlign="middle"===i?"center":i,o),S=(ct.enableCSSParsing||"alphabetic"!==p||(p="bottom"),t.lineJoin=a,M(s)||(t.miterLimit=s),0),w=("middle"===o?S=-_/2-b/2:"bottom"===o||"alphabetic"===o||"ideographic"===o?S=-_:"top"!==o&&"hanging"!==o||(S=-b),g||0),y=(S+=m||0,1===E.length&&("bottom"===p?(p="middle",S-=.5*_):"top"===p&&(p="middle",S+=.5*_)),t.textBaseline=p,!M(v)&&0<e);nh(n,t,y);for(var T=0;T<E.length;T++){var A=r/2+w;S+=b,M(u)||u.isNone||!r||this.drawLetterSpacing(t,E[T],x[T],i,A,S,l,h,d,f,!0),M(c)||this.drawLetterSpacing(t,E[T],x[T],i,A,S,l,h,d,f)}},e.drawLetterSpacing=function(t,e,n,r,i,o,a,s,l,u,c){if(void 0===c&&(c=!1),0===a)c?this.strokeText(t,e,i,o,l):this.fillText(t,e,i,o,s,u);else{for(var h=t.textAlign,d=(t.textAlign="left",i),f=("center"===r||"middle"===r?d=i-n.width/2:"right"!==r&&"end"!==r||(d=i-n.width),Array.from(e)),p=t.measureText(e).width,g=0;g<f.length;++g){var m=f[g];c?this.strokeText(t,m,d,o,l):this.fillText(t,m,d,o,s,u),d+=p-(m=t.measureText(e.substring(g+1)).width)+a,p=m}t.textAlign=h}},e.fillText=function(t,e,n,r,i,o){var a,s=!M(i)&&1!==i;s&&(a=t.globalAlpha,t.globalAlpha=i*o),t.fillText(e,n,r),s&&(t.globalAlpha=a)},e.strokeText=function(t,e,n,r,i){var o,a=!M(i)&&1!==i;a&&(o=t.globalAlpha,t.globalAlpha=i),t.strokeText(e,n,r),a&&(t.globalAlpha=o)},t}(),oh=function(n){var t;function e(t){var e;return void 0===t&&(t={}),(e=n.call(this)||this).options=void 0,e.name="canvas-renderer",e.options=t,e}t=n,(r=e).prototype=Object.create(t.prototype),Jc(r.prototype.constructor=r,t);var r=e.prototype;return r.init=function(){var t,e=Qc({dirtyObjectNumThreshold:500,dirtyObjectRatioThreshold:.8},this.options),n=this.context.imagePool,r=new eh(n),n=((t={})[lt.CIRCLE]=r,t[lt.ELLIPSE]=r,t[lt.RECT]=r,t[lt.IMAGE]=new rh(n),t[lt.TEXT]=new ih,t[lt.LINE]=r,t[lt.POLYLINE]=r,t[lt.POLYGON]=r,t[lt.PATH]=r,t[lt.GROUP]=void 0,t[lt.HTML]=void 0,t[lt.MESH]=void 0,t);this.context.defaultStyleRendererFactory=n,this.context.styleRendererFactory=n,this.addRenderingPlugin(new th(e))},r.destroy=function(){this.removeAllRenderingPlugins(),delete this.context.defaultStyleRendererFactory,delete this.context.styleRendererFactory},e}(Ws);function ah(){ah=function(){return a};var a={},t=Object.prototype,l=t.hasOwnProperty,u=Object.defineProperty||function(t,e,n){t[e]=n.value},e="function"==typeof Symbol?Symbol:{},r=e.iterator||"@@iterator",n=e.asyncIterator||"@@asyncIterator",i=e.toStringTag||"@@toStringTag";function o(t,e,n){return Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{o({},"")}catch(t){o=function(t,e,n){return t[e]=n}}function s(t,e,n,r){var i,o,a,s,e=e&&e.prototype instanceof d?e:d,e=Object.create(e.prototype),r=new b(r||[]);return u(e,"_invoke",{value:(i=t,o=n,a=r,s="suspendedStart",function(t,e){if("executing"===s)throw new Error("Generator is already running");if("completed"===s){if("throw"===t)throw e;return S()}for(a.method=t,a.arg=e;;){var n=a.delegate;if(n){n=function t(e,n){var r=n.method,i=e.iterator[r];if(void 0===i)return n.delegate=null,"throw"===r&&e.iterator.return&&(n.method="return",n.arg=void 0,t(e,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),h;r=c(i,e.iterator,n.arg);if("throw"===r.type)return n.method="throw",n.arg=r.arg,n.delegate=null,h;i=r.arg;return i?i.done?(n[e.resultName]=i.value,n.next=e.nextLoc,"return"!==n.method&&(n.method="next",n.arg=void 0),n.delegate=null,h):i:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,h)}(n,a);if(n){if(n===h)continue;return n}}if("next"===a.method)a.sent=a._sent=a.arg;else if("throw"===a.method){if("suspendedStart"===s)throw s="completed",a.arg;a.dispatchException(a.arg)}else"return"===a.method&&a.abrupt("return",a.arg);s="executing";n=c(i,o,a);if("normal"===n.type){if(s=a.done?"completed":"suspendedYield",n.arg===h)continue;return{value:n.arg,done:a.done}}"throw"===n.type&&(s="completed",a.method="throw",a.arg=n.arg)}})}),e}function c(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(t){return{type:"throw",arg:t}}}a.wrap=s;var h={};function d(){}function f(){}function p(){}var e={},g=(o(e,r,function(){return this}),Object.getPrototypeOf),g=g&&g(g(x([]))),m=(g&&g!==t&&l.call(g,r)&&(e=g),p.prototype=d.prototype=Object.create(e));function v(t){["next","throw","return"].forEach(function(e){o(t,e,function(t){return this._invoke(e,t)})})}function y(a,s){var e;u(this,"_invoke",{value:function(n,r){function t(){return new s(function(t,e){!function e(t,n,r,i){var o,t=c(a[t],a,n);if("throw"!==t.type)return(n=(o=t.arg).value)&&"object"==typeof n&&l.call(n,"__await")?s.resolve(n.__await).then(function(t){e("next",t,r,i)},function(t){e("throw",t,r,i)}):s.resolve(n).then(function(t){o.value=t,r(o)},function(t){return e("throw",t,r,i)});i(t.arg)}(n,r,t,e)})}return e=e?e.then(t,t):t()}})}function E(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function _(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function b(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(E,this),this.reset(!0)}function x(e){if(e){var n,t=e[r];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length))return n=-1,(t=function t(){for(;++n<e.length;)if(l.call(e,n))return t.value=e[n],t.done=!1,t;return t.value=void 0,t.done=!0,t}).next=t}return{next:S}}function S(){return{value:void 0,done:!0}}return u(m,"constructor",{value:f.prototype=p,configurable:!0}),u(p,"constructor",{value:f,configurable:!0}),f.displayName=o(p,i,"GeneratorFunction"),a.isGeneratorFunction=function(t){t="function"==typeof t&&t.constructor;return!!t&&(t===f||"GeneratorFunction"===(t.displayName||t.name))},a.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,p):(t.__proto__=p,o(t,i,"GeneratorFunction")),t.prototype=Object.create(m),t},a.awrap=function(t){return{__await:t}},v(y.prototype),o(y.prototype,n,function(){return this}),a.AsyncIterator=y,a.async=function(t,e,n,r,i){void 0===i&&(i=Promise);var o=new y(s(t,e,n,r),i);return a.isGeneratorFunction(e)?o:o.next().then(function(t){return t.done?t.value:o.next()})},v(m),o(m,i,"Generator"),o(m,r,function(){return this}),o(m,"toString",function(){return"[object Generator]"}),a.keys=function(t){var e,n=Object(t),r=[];for(e in n)r.push(e);return r.reverse(),function t(){for(;r.length;){var e=r.pop();if(e in n)return t.value=e,t.done=!1,t}return t.done=!0,t}},a.values=x,b.prototype={constructor:b,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(_),!t)for(var e in this)"t"===e.charAt(0)&&l.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=void 0)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(n){if(this.done)throw n;var r=this;function t(t,e){return o.type="throw",o.arg=n,r.next=t,e&&(r.method="next",r.arg=void 0),!!e}for(var e=this.tryEntries.length-1;0<=e;--e){var i=this.tryEntries[e],o=i.completion;if("root"===i.tryLoc)return t("end");if(i.tryLoc<=this.prev){var a=l.call(i,"catchLoc"),s=l.call(i,"finallyLoc");if(a&&s){if(this.prev<i.catchLoc)return t(i.catchLoc,!0);if(this.prev<i.finallyLoc)return t(i.finallyLoc)}else if(a){if(this.prev<i.catchLoc)return t(i.catchLoc,!0)}else{if(!s)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return t(i.finallyLoc)}}}},abrupt:function(t,e){for(var n=this.tryEntries.length-1;0<=n;--n){var r=this.tryEntries[n];if(r.tryLoc<=this.prev&&l.call(r,"finallyLoc")&&this.prev<r.finallyLoc){var i=r;break}}var o=(i=i&&("break"===t||"continue"===t)&&i.tryLoc<=e&&e<=i.finallyLoc?null:i)?i.completion:{};return o.type=t,o.arg=e,i?(this.method="next",this.next=i.finallyLoc,h):this.complete(o)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),h},finish:function(t){for(var e=this.tryEntries.length-1;0<=e;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),_(n),h}},catch:function(t){for(var e=this.tryEntries.length-1;0<=e;--e){var n,r,i=this.tryEntries[e];if(i.tryLoc===t)return"throw"===(n=i.completion).type&&(r=n.arg,_(i)),r}throw new Error("illegal catch attempt")},delegateYield:function(t,e,n){return this.delegate={iterator:x(t),resultName:e,nextLoc:n},"next"===this.method&&(this.arg=void 0),h}},a}function sh(t,e,n,r,i,o,a){try{var s=t[o](a),l=s.value}catch(t){return void n(t)}s.done?e(l):Promise.resolve(l).then(r,i)}function lh(s){return function(){var t=this,a=arguments;return new Promise(function(e,n){var r=s.apply(t,a);function i(t){sh(r,e,n,i,o,"next",t)}function o(t){sh(r,e,n,i,o,"throw",t)}i(void 0)})}}function uh(t,e){return(uh=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t})(t,e)}var ch=function(){function r(){this.context=void 0}return r.prototype.apply=function(t,i){function o(t){e.hooks.pointerWheel.call(t)}function a(t){e.hooks.click.call(t)}var s=this,e=t.renderingService,n=t.renderingContext,l=t.config,u=(this.context=t,n.root.ownerDocument.defaultView),c=function(t){e.hooks.pointerMove.call(t)},h=function(t){e.hooks.pointerUp.call(t)},d=function(t){e.hooks.pointerDown.call(t)},f=function(t){e.hooks.pointerOver.call(t)},p=function(t){e.hooks.pointerOut.call(t)},g=function(t){e.hooks.pointerCancel.call(t)};e.hooks.init.tapPromise(r.tag,lh(ah().mark(function t(){var r;return ah().wrap(function(t){for(;;)switch(t.prev=t.next){case 0:r=s.context.contextService.getDomElement(),i.globalThis.navigator.msPointerEnabled?(r.style.msContentZooming="none",r.style.msTouchAction="none"):u.supportsPointerEvents&&(r.style.touchAction="none"),u.supportsPointerEvents?(n=r,i.globalThis.document.addEventListener("pointermove",c,!0),n.addEventListener("pointerdown",d,!0),n.addEventListener("pointerleave",p,!0),n.addEventListener("pointerover",f,!0),i.globalThis.addEventListener("pointerup",h,!0),i.globalThis.addEventListener("pointercancel",g,!0)):(n=r,i.globalThis.document.addEventListener("mousemove",c,!0),n.addEventListener("mousedown",d,!0),n.addEventListener("mouseout",p,!0),n.addEventListener("mouseover",f,!0),i.globalThis.addEventListener("mouseup",h,!0)),u.supportsTouchEvents&&((e=r).addEventListener("touchstart",d,!0),e.addEventListener("touchend",h,!0),e.addEventListener("touchmove",c,!0),e.addEventListener("touchcancel",g,!0)),l.useNativeClickEvent&&r.addEventListener("click",a,!0),r.addEventListener("wheel",o,{passive:!0,capture:!0});case 6:case"end":return t.stop()}var e,n},t)}))),e.hooks.destroy.tap(r.tag,function(){var t,e,n=s.context.contextService.getDomElement();i.globalThis.navigator.msPointerEnabled?(n.style.msContentZooming="",n.style.msTouchAction=""):u.supportsPointerEvents&&(n.style.touchAction=""),u.supportsPointerEvents?(t=n,i.globalThis.document.removeEventListener("pointermove",c,!0),t.removeEventListener("pointerdown",d,!0),t.removeEventListener("pointerleave",p,!0),t.removeEventListener("pointerover",f,!0),i.globalThis.removeEventListener("pointerup",h,!0)):(t=n,i.globalThis.document.removeEventListener("mousemove",c,!0),t.removeEventListener("mousedown",d,!0),t.removeEventListener("mouseout",p,!0),t.removeEventListener("mouseover",f,!0),i.globalThis.removeEventListener("mouseup",h,!0)),u.supportsTouchEvents&&((e=n).removeEventListener("touchstart",d,!0),e.removeEventListener("touchend",h,!0),e.removeEventListener("touchmove",c,!0),e.removeEventListener("touchcancel",g,!0)),l.useNativeClickEvent&&n.removeEventListener("click",a,!0),n.removeEventListener("wheel",o,!0)})},r}(),hh=(ch.tag="DOMInteraction",function(i){var t;function e(){for(var t,e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];return(t=i.call.apply(i,[this].concat(n))||this).name="dom-interaction",t}t=i,(n=e).prototype=Object.create(t.prototype),uh(n.prototype.constructor=n,t);var n=e.prototype;return n.init=function(){this.addRenderingPlugin(new ch)},n.destroy=function(){this.removeAllRenderingPlugins()},e}(Ws));function dh(){dh=function(){return a};var a={},t=Object.prototype,l=t.hasOwnProperty,u=Object.defineProperty||function(t,e,n){t[e]=n.value},e="function"==typeof Symbol?Symbol:{},r=e.iterator||"@@iterator",n=e.asyncIterator||"@@asyncIterator",i=e.toStringTag||"@@toStringTag";function o(t,e,n){return Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{o({},"")}catch(t){o=function(t,e,n){return t[e]=n}}function s(t,e,n,r){var i,o,a,s,e=e&&e.prototype instanceof d?e:d,e=Object.create(e.prototype),r=new b(r||[]);return u(e,"_invoke",{value:(i=t,o=n,a=r,s="suspendedStart",function(t,e){if("executing"===s)throw new Error("Generator is already running");if("completed"===s){if("throw"===t)throw e;return S()}for(a.method=t,a.arg=e;;){var n=a.delegate;if(n){n=function t(e,n){var r=n.method,i=e.iterator[r];if(void 0===i)return n.delegate=null,"throw"===r&&e.iterator.return&&(n.method="return",n.arg=void 0,t(e,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),h;r=c(i,e.iterator,n.arg);if("throw"===r.type)return n.method="throw",n.arg=r.arg,n.delegate=null,h;i=r.arg;return i?i.done?(n[e.resultName]=i.value,n.next=e.nextLoc,"return"!==n.method&&(n.method="next",n.arg=void 0),n.delegate=null,h):i:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,h)}(n,a);if(n){if(n===h)continue;return n}}if("next"===a.method)a.sent=a._sent=a.arg;else if("throw"===a.method){if("suspendedStart"===s)throw s="completed",a.arg;a.dispatchException(a.arg)}else"return"===a.method&&a.abrupt("return",a.arg);s="executing";n=c(i,o,a);if("normal"===n.type){if(s=a.done?"completed":"suspendedYield",n.arg===h)continue;return{value:n.arg,done:a.done}}"throw"===n.type&&(s="completed",a.method="throw",a.arg=n.arg)}})}),e}function c(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(t){return{type:"throw",arg:t}}}a.wrap=s;var h={};function d(){}function f(){}function p(){}var e={},g=(o(e,r,function(){return this}),Object.getPrototypeOf),g=g&&g(g(x([]))),m=(g&&g!==t&&l.call(g,r)&&(e=g),p.prototype=d.prototype=Object.create(e));function v(t){["next","throw","return"].forEach(function(e){o(t,e,function(t){return this._invoke(e,t)})})}function y(a,s){var e;u(this,"_invoke",{value:function(n,r){function t(){return new s(function(t,e){!function e(t,n,r,i){var o,t=c(a[t],a,n);if("throw"!==t.type)return(n=(o=t.arg).value)&&"object"==typeof n&&l.call(n,"__await")?s.resolve(n.__await).then(function(t){e("next",t,r,i)},function(t){e("throw",t,r,i)}):s.resolve(n).then(function(t){o.value=t,r(o)},function(t){return e("throw",t,r,i)});i(t.arg)}(n,r,t,e)})}return e=e?e.then(t,t):t()}})}function E(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function _(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function b(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(E,this),this.reset(!0)}function x(e){if(e){var n,t=e[r];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length))return n=-1,(t=function t(){for(;++n<e.length;)if(l.call(e,n))return t.value=e[n],t.done=!1,t;return t.value=void 0,t.done=!0,t}).next=t}return{next:S}}function S(){return{value:void 0,done:!0}}return u(m,"constructor",{value:f.prototype=p,configurable:!0}),u(p,"constructor",{value:f,configurable:!0}),f.displayName=o(p,i,"GeneratorFunction"),a.isGeneratorFunction=function(t){t="function"==typeof t&&t.constructor;return!!t&&(t===f||"GeneratorFunction"===(t.displayName||t.name))},a.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,p):(t.__proto__=p,o(t,i,"GeneratorFunction")),t.prototype=Object.create(m),t},a.awrap=function(t){return{__await:t}},v(y.prototype),o(y.prototype,n,function(){return this}),a.AsyncIterator=y,a.async=function(t,e,n,r,i){void 0===i&&(i=Promise);var o=new y(s(t,e,n,r),i);return a.isGeneratorFunction(e)?o:o.next().then(function(t){return t.done?t.value:o.next()})},v(m),o(m,i,"Generator"),o(m,r,function(){return this}),o(m,"toString",function(){return"[object Generator]"}),a.keys=function(t){var e,n=Object(t),r=[];for(e in n)r.push(e);return r.reverse(),function t(){for(;r.length;){var e=r.pop();if(e in n)return t.value=e,t.done=!1,t}return t.done=!0,t}},a.values=x,b.prototype={constructor:b,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(_),!t)for(var e in this)"t"===e.charAt(0)&&l.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=void 0)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(n){if(this.done)throw n;var r=this;function t(t,e){return o.type="throw",o.arg=n,r.next=t,e&&(r.method="next",r.arg=void 0),!!e}for(var e=this.tryEntries.length-1;0<=e;--e){var i=this.tryEntries[e],o=i.completion;if("root"===i.tryLoc)return t("end");if(i.tryLoc<=this.prev){var a=l.call(i,"catchLoc"),s=l.call(i,"finallyLoc");if(a&&s){if(this.prev<i.catchLoc)return t(i.catchLoc,!0);if(this.prev<i.finallyLoc)return t(i.finallyLoc)}else if(a){if(this.prev<i.catchLoc)return t(i.catchLoc,!0)}else{if(!s)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return t(i.finallyLoc)}}}},abrupt:function(t,e){for(var n=this.tryEntries.length-1;0<=n;--n){var r=this.tryEntries[n];if(r.tryLoc<=this.prev&&l.call(r,"finallyLoc")&&this.prev<r.finallyLoc){var i=r;break}}var o=(i=i&&("break"===t||"continue"===t)&&i.tryLoc<=e&&e<=i.finallyLoc?null:i)?i.completion:{};return o.type=t,o.arg=e,i?(this.method="next",this.next=i.finallyLoc,h):this.complete(o)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),h},finish:function(t){for(var e=this.tryEntries.length-1;0<=e;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),_(n),h}},catch:function(t){for(var e=this.tryEntries.length-1;0<=e;--e){var n,r,i=this.tryEntries[e];if(i.tryLoc===t)return"throw"===(n=i.completion).type&&(r=n.arg,_(i)),r}throw new Error("illegal catch attempt")},delegateYield:function(t,e,n){return this.delegate={iterator:x(t),resultName:e,nextLoc:n},"next"===this.method&&(this.arg=void 0),h}},a}function fh(t,e,n,r,i,o,a){try{var s=t[o](a),l=s.value}catch(t){return void n(t)}s.done?e(l):Promise.resolve(l).then(r,i)}function ph(s){return function(){var t=this,a=arguments;return new Promise(function(e,n){var r=s.apply(t,a);function i(t){fh(r,e,n,i,o,"next",t)}function o(t){fh(r,e,n,i,o,"throw",t)}i(void 0)})}}function gh(t,e){return(gh=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t})(t,e)}var mh=function(){function d(){this.context=void 0,this.$camera=void 0}var t=d.prototype;return t.joinTransformMatrix=function(t){return"matrix("+[t[0],t[1],t[4],t[5],t[12],t[13]].join(",")+")"},t.apply=function(t){function i(t,e){e.style.transform=s.joinTransformMatrix(t.getWorldTransform())}function e(t){var e,n,r=t.target;r.nodeName===lt.HTML&&(s.$camera||(s.$camera=s.createCamera(l)),e=s.getOrCreateEl(r),s.$camera.appendChild(e),n=r.ownerDocument.documentElement.attributes,Object.keys(n).forEach(function(t){e.style[t]=n[t]}),Object.keys(r.attributes).forEach(function(t){s.updateAttribute(t,r)}),i(r,e),ct.nativeHTMLMap.set(e,r))}function n(t){(t=t.target).nodeName===lt.HTML&&s.$camera&&(t=s.getOrCreateEl(t))&&(t.remove(),ct.nativeHTMLMap.delete(t))}function r(t){var e=t.target;e.nodeName===lt.HTML&&(t=t.attrName,s.updateAttribute(t,e))}function o(t){var e;(t=t.target).nodeName===lt.HTML&&(e=s.getOrCreateEl(t),i(t,e))}function a(){var t,e;s.$camera&&(t=(e=s.context.config).width,e=e.height,s.$camera.style.width=(t||0)+"px",s.$camera.style.height=(e||0)+"px")}var s=this,l=t.camera,u=t.renderingContext,c=t.renderingService,h=(this.context=t,u.root.ownerDocument.defaultView);c.hooks.init.tapPromise(d.tag,ph(dh().mark(function t(){return dh().wrap(function(t){for(;;)switch(t.prev=t.next){case 0:h.addEventListener(qs.RESIZE,a),h.addEventListener(v.MOUNTED,e),h.addEventListener(v.UNMOUNTED,n),h.addEventListener(v.ATTR_MODIFIED,r),h.addEventListener(v.BOUNDS_CHANGED,o);case 5:case"end":return t.stop()}},t)}))),c.hooks.endFrame.tap(d.tag,function(){s.$camera&&u.renderReasons.has(Ds.CAMERA_CHANGED)&&(s.$camera.style.transform=s.joinTransformMatrix(l.getOrthoMatrix()))}),c.hooks.destroy.tap(d.tag,function(){s.$camera&&s.$camera.remove(),h.removeEventListener(qs.RESIZE,a),h.removeEventListener(v.MOUNTED,e),h.removeEventListener(v.UNMOUNTED,n),h.removeEventListener(v.ATTR_MODIFIED,r),h.removeEventListener(v.BOUNDS_CHANGED,o)})},t.getId=function(t){return t.id||"g-html-"+t.entity},t.createCamera=function(t){var e,n,r=this.context.config,i=r.document,o=r.width,r=r.height,a=this.context.contextService.getDomElement(),s=a.parentNode;return s?((n=s.querySelector("#"+(e="g-canvas-camera")))||((n=i=(i||document).createElement("div")).id=e,i.style.position="absolute",i.style.left=(a.offsetLeft||0)+"px",i.style.top=(a.offsetTop||0)+"px",i.style.transformOrigin="left top",i.style.transform=this.joinTransformMatrix(t.getOrthoMatrix()),i.style.overflow="hidden",i.style.pointerEvents="none",i.style.width=(o||0)+"px",i.style.height=(r||0)+"px",s.appendChild(i)),n):null},t.getOrCreateEl=function(t){var e=this.context.config.document,n=this.getId(t),r=this.$camera.querySelector("#"+n);return r||(r=(e||document).createElement("div"),(t.parsedStyle.$el=r).id=n,t.name&&r.setAttribute("name",t.name),t.className&&(r.className=t.className),r.style.position="absolute",r.style.left="0px",r.style.top="0px",r.style["will-change"]="transform",r.style.transform=this.joinTransformMatrix(t.getWorldTransform())),r},t.updateAttribute=function(t,e){var n=this.getOrCreateEl(e);switch(t){case"innerHTML":var r=e.parsedStyle.innerHTML;Fe(r)?n.innerHTML=r:(n.innerHTML="",n.appendChild(r));break;case"transformOrigin":var r=e.parsedStyle.transformOrigin;n.style["transform-origin"]=r[0].value+" "+r[1].value;break;case"width":ct.enableCSSParsing?(r=e.computedStyleMap().get("width"),n.style.width=r.toString()):(r=e.parsedStyle.width,n.style.width=B(r)?r+"px":r.toString());break;case"height":ct.enableCSSParsing?(r=e.computedStyleMap().get("height"),n.style.height=r.toString()):(r=e.parsedStyle.height,n.style.height=B(r)?r+"px":r.toString());break;case"zIndex":r=e.parsedStyle.zIndex;n.style["z-index"]=""+r;break;case"visibility":r=e.parsedStyle.visibility;n.style.visibility=r;break;case"pointerEvents":r=e.parsedStyle.pointerEvents;n.style.pointerEvents=r;break;case"opacity":r=e.parsedStyle.opacity;n.style.opacity=""+r;break;case"fill":var r=e.parsedStyle.fill,i="";To(r)?i=r.isNone?"transparent":e.getAttribute("fill"):Array.isArray(r)?i=e.getAttribute("fill"):wo(r),n.style.background=i;break;case"stroke":r=e.parsedStyle.stroke,i="";To(r)?i=r.isNone?"transparent":e.getAttribute("stroke"):Array.isArray(r)?i=e.getAttribute("stroke"):wo(r),n.style["border-color"]=i,n.style["border-style"]="solid";break;case"lineWidth":r=e.parsedStyle.lineWidth;n.style["border-width"]=(r||0)+"px";break;case"lineDash":n.style["border-style"]="dashed";break;case"filter":i=e.style.filter;n.style.filter=i}},d}(),vh=(mh.tag="HTMLRendering",function(i){var t;function e(){for(var t,e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];return(t=i.call.apply(i,[this].concat(n))||this).name="html-renderer",t}t=i,(n=e).prototype=Object.create(t.prototype),gh(n.prototype.constructor=n,t);var n=e.prototype;return n.init=function(){this.addRenderingPlugin(new mh)},n.destroy=function(){this.removeAllRenderingPlugins()},e}(Ws));function yh(){yh=function(){return a};var a={},t=Object.prototype,l=t.hasOwnProperty,u=Object.defineProperty||function(t,e,n){t[e]=n.value},e="function"==typeof Symbol?Symbol:{},r=e.iterator||"@@iterator",n=e.asyncIterator||"@@asyncIterator",i=e.toStringTag||"@@toStringTag";function o(t,e,n){return Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{o({},"")}catch(t){o=function(t,e,n){return t[e]=n}}function s(t,e,n,r){var i,o,a,s,e=e&&e.prototype instanceof d?e:d,e=Object.create(e.prototype),r=new b(r||[]);return u(e,"_invoke",{value:(i=t,o=n,a=r,s="suspendedStart",function(t,e){if("executing"===s)throw new Error("Generator is already running");if("completed"===s){if("throw"===t)throw e;return S()}for(a.method=t,a.arg=e;;){var n=a.delegate;if(n){n=function t(e,n){var r=n.method,i=e.iterator[r];if(void 0===i)return n.delegate=null,"throw"===r&&e.iterator.return&&(n.method="return",n.arg=void 0,t(e,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),h;r=c(i,e.iterator,n.arg);if("throw"===r.type)return n.method="throw",n.arg=r.arg,n.delegate=null,h;i=r.arg;return i?i.done?(n[e.resultName]=i.value,n.next=e.nextLoc,"return"!==n.method&&(n.method="next",n.arg=void 0),n.delegate=null,h):i:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,h)}(n,a);if(n){if(n===h)continue;return n}}if("next"===a.method)a.sent=a._sent=a.arg;else if("throw"===a.method){if("suspendedStart"===s)throw s="completed",a.arg;a.dispatchException(a.arg)}else"return"===a.method&&a.abrupt("return",a.arg);s="executing";n=c(i,o,a);if("normal"===n.type){if(s=a.done?"completed":"suspendedYield",n.arg===h)continue;return{value:n.arg,done:a.done}}"throw"===n.type&&(s="completed",a.method="throw",a.arg=n.arg)}})}),e}function c(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(t){return{type:"throw",arg:t}}}a.wrap=s;var h={};function d(){}function f(){}function p(){}var e={},g=(o(e,r,function(){return this}),Object.getPrototypeOf),g=g&&g(g(x([]))),m=(g&&g!==t&&l.call(g,r)&&(e=g),p.prototype=d.prototype=Object.create(e));function v(t){["next","throw","return"].forEach(function(e){o(t,e,function(t){return this._invoke(e,t)})})}function y(a,s){var e;u(this,"_invoke",{value:function(n,r){function t(){return new s(function(t,e){!function e(t,n,r,i){var o,t=c(a[t],a,n);if("throw"!==t.type)return(n=(o=t.arg).value)&&"object"==typeof n&&l.call(n,"__await")?s.resolve(n.__await).then(function(t){e("next",t,r,i)},function(t){e("throw",t,r,i)}):s.resolve(n).then(function(t){o.value=t,r(o)},function(t){return e("throw",t,r,i)});i(t.arg)}(n,r,t,e)})}return e=e?e.then(t,t):t()}})}function E(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function _(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function b(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(E,this),this.reset(!0)}function x(e){if(e){var n,t=e[r];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length))return n=-1,(t=function t(){for(;++n<e.length;)if(l.call(e,n))return t.value=e[n],t.done=!1,t;return t.value=void 0,t.done=!0,t}).next=t}return{next:S}}function S(){return{value:void 0,done:!0}}return u(m,"constructor",{value:f.prototype=p,configurable:!0}),u(p,"constructor",{value:f,configurable:!0}),f.displayName=o(p,i,"GeneratorFunction"),a.isGeneratorFunction=function(t){t="function"==typeof t&&t.constructor;return!!t&&(t===f||"GeneratorFunction"===(t.displayName||t.name))},a.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,p):(t.__proto__=p,o(t,i,"GeneratorFunction")),t.prototype=Object.create(m),t},a.awrap=function(t){return{__await:t}},v(y.prototype),o(y.prototype,n,function(){return this}),a.AsyncIterator=y,a.async=function(t,e,n,r,i){void 0===i&&(i=Promise);var o=new y(s(t,e,n,r),i);return a.isGeneratorFunction(e)?o:o.next().then(function(t){return t.done?t.value:o.next()})},v(m),o(m,i,"Generator"),o(m,r,function(){return this}),o(m,"toString",function(){return"[object Generator]"}),a.keys=function(t){var e,n=Object(t),r=[];for(e in n)r.push(e);return r.reverse(),function t(){for(;r.length;){var e=r.pop();if(e in n)return t.value=e,t.done=!1,t}return t.done=!0,t}},a.values=x,b.prototype={constructor:b,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(_),!t)for(var e in this)"t"===e.charAt(0)&&l.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=void 0)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(n){if(this.done)throw n;var r=this;function t(t,e){return o.type="throw",o.arg=n,r.next=t,e&&(r.method="next",r.arg=void 0),!!e}for(var e=this.tryEntries.length-1;0<=e;--e){var i=this.tryEntries[e],o=i.completion;if("root"===i.tryLoc)return t("end");if(i.tryLoc<=this.prev){var a=l.call(i,"catchLoc"),s=l.call(i,"finallyLoc");if(a&&s){if(this.prev<i.catchLoc)return t(i.catchLoc,!0);if(this.prev<i.finallyLoc)return t(i.finallyLoc)}else if(a){if(this.prev<i.catchLoc)return t(i.catchLoc,!0)}else{if(!s)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return t(i.finallyLoc)}}}},abrupt:function(t,e){for(var n=this.tryEntries.length-1;0<=n;--n){var r=this.tryEntries[n];if(r.tryLoc<=this.prev&&l.call(r,"finallyLoc")&&this.prev<r.finallyLoc){var i=r;break}}var o=(i=i&&("break"===t||"continue"===t)&&i.tryLoc<=e&&e<=i.finallyLoc?null:i)?i.completion:{};return o.type=t,o.arg=e,i?(this.method="next",this.next=i.finallyLoc,h):this.complete(o)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),h},finish:function(t){for(var e=this.tryEntries.length-1;0<=e;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),_(n),h}},catch:function(t){for(var e=this.tryEntries.length-1;0<=e;--e){var n,r,i=this.tryEntries[e];if(i.tryLoc===t)return"throw"===(n=i.completion).type&&(r=n.arg,_(i)),r}throw new Error("illegal catch attempt")},delegateYield:function(t,e,n){return this.delegate={iterator:x(t),resultName:e,nextLoc:n},"next"===this.method&&(this.arg=void 0),h}},a}function Eh(t,e,n,r,i,o,a){try{var s=t[o](a),l=s.value}catch(t){return void n(t)}s.done?e(l):Promise.resolve(l).then(r,i)}function _h(s){return function(){var t=this,a=arguments;return new Promise(function(e,n){var r=s.apply(t,a);function i(t){Eh(r,e,n,i,o,"next",t)}function o(t){Eh(r,e,n,i,o,"throw",t)}i(void 0)})}}function bh(t,e){return(bh=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t})(t,e)}var xh="undefined"!=typeof Float32Array?Float32Array:Array;Math.hypot||(Math.hypot=function(){for(var t=0,e=arguments.length;e--;)t+=arguments[e]*arguments[e];return Math.sqrt(t)});var Sh=function(){function t(t){this.canvasConfig=void 0,this.imageCache={},this.gradientCache={},this.patternCache={},this.canvasConfig=t}var e=t.prototype;return e.getImageSync=function(t,e){return this.imageCache[t]?e&&e():this.getOrCreateImage(t).then(function(){e&&e()}),this.imageCache[t]},e.getOrCreateImage=function(r){var i,o=this;return this.imageCache[r]?Promise.resolve(this.imageCache[r]):(i=this.canvasConfig.createImage,new Promise(function(t,e){var n;i?n=i(r):Ur&&(n=new window.Image),n&&(n.onload=function(){t(n)},n.onerror=function(t){e(t)},n.crossOrigin="Anonymous",n.src=r,o.imageCache[r]=n)}))},e.getOrCreatePatternSync=function(t,e,n,r,i){var o,a,s,l,u=this.generatePatternKey(t);return u&&this.patternCache[u]?this.patternCache[u]:(l=t.image,s=t.repetition,t=t.transform,o=!1,Fe(l)?a=this.getImageSync(l,i):n?(a=n,o=!0):a=l,(i=a&&e.createPattern(a,s))&&(e=t?di(ta(t)):(n=new xh(16),xh!=Float32Array&&(n[1]=0,n[2]=0,n[3]=0,n[4]=0,n[6]=0,n[7]=0,n[8]=0,n[9]=0,n[11]=0,n[12]=0,n[13]=0,n[14]=0),n[0]=1,n[5]=1,n[10]=1,n[15]=1,(l=n)[0]=1,l[1]=0,l[2]=0,l[3]=0,l[4]=0,l[5]=1,l[6]=0,l[7]=0,l[8]=0,l[9]=0,l[10]=1,l[11]=0,l[12]=0,l[13]=0,l[14]=0,l[15]=1,l),o&&(s=a=e,n=(t=[1/r,1/r,1])[0],l=t[1],t=t[2],a[0]=s[0]*n,a[1]=s[1]*n,a[2]=s[2]*n,a[3]=s[3]*n,a[4]=s[4]*l,a[5]=s[5]*l,a[6]=s[6]*l,a[7]=s[7]*l,a[8]=s[8]*t,a[9]=s[9]*t,a[10]=s[10]*t,a[11]=s[11]*t,a[12]=s[12],a[13]=s[13],a[14]=s[14],a[15]=s[15]),i.setTransform({a:e[0],b:e[1],c:e[4],d:e[5],e:e[12],f:e[13]})),u&&i&&(this.patternCache[u]=i),i)},e.getOrCreateGradient=function(t,e){var r,n,i,o,a=this.generateGradientKey(t),s=t.type,l=t.steps,u=t.width,c=t.height,h=t.angle,d=t.cx,f=t.cy,t=t.size;return this.gradientCache[a]||(r=null,s===ur.LinearGradient?(n=(h=Di(u,c,h)).x1,i=h.y1,o=h.x2,h=h.y2,r=e.createLinearGradient(n,i,o,h)):s===ur.RadialGradient&&(i=(n=Bi(u,c,d,f,t)).x,o=n.y,h=n.r,r=e.createRadialGradient(i,o,0,i,o,h)),r&&(l.forEach(function(t){var e,n=t.offset,t=t.color;n.unit===p.kPercentage&&null!=(e=r)&&e.addColorStop(n.value/100,t.toString())}),this.gradientCache[a]=r)),this.gradientCache[a]},e.generateGradientKey=function(t){var e=t.type,n=t.width,r=t.height,i=t.steps,o=t.angle,a=t.cx,s=t.cy,t=t.size;return"gradient-"+e+"-"+((null==o?void 0:o.toString())||0)+"-"+((null==a?void 0:a.toString())||0)+"-"+((null==s?void 0:s.toString())||0)+"-"+((null==t?void 0:t.toString())||0)+"-"+n+"-"+r+"-"+i.map(function(t){return""+t.offset+t.color}).join("-")},e.generatePatternKey=function(t){var e=t.image,t=t.repetition;return Fe(e)?"pattern-"+e+"-"+t:"rect"===e.nodeName?"pattern-"+e.entity+"-"+t:void 0},t}(),wh=function(){function s(){}return s.prototype.apply=function(t){function e(t){var e=t.target,t=e.nodeName,n=e.attributes;t===lt.IMAGE&&(t=n.img,Fe(t))&&o.getImageSync(t,function(){e.renderable.dirty=!0,r.dirtify()})}function n(t){var e=t.target,n=t.attrName,t=t.newValue;e.nodeName===lt.IMAGE&&"img"===n&&Fe(t)&&o.getOrCreateImage(t).then(function(){e.renderable.dirty=!0,r.dirtify()})}var r=t.renderingService,i=t.renderingContext,o=t.imagePool,a=i.root.ownerDocument.defaultView;r.hooks.init.tapPromise(s.tag,_h(yh().mark(function t(){return yh().wrap(function(t){for(;;)switch(t.prev=t.next){case 0:a.addEventListener(v.MOUNTED,e),a.addEventListener(v.ATTR_MODIFIED,n);case 2:case"end":return t.stop()}},t)}))),r.hooks.destroy.tap(s.tag,function(){a.removeEventListener(v.MOUNTED,e),a.removeEventListener(v.ATTR_MODIFIED,n)})},s}(),Th=(wh.tag="LoadImage",function(i){var t;function e(){for(var t,e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];return(t=i.call.apply(i,[this].concat(n))||this).name="image-loader",t}t=i,(n=e).prototype=Object.create(t.prototype),bh(n.prototype.constructor=n,t);var n=e.prototype;return n.init=function(){this.context.imagePool=new Sh(this.context.config),this.addRenderingPlugin(new wh)},n.destroy=function(){this.removeAllRenderingPlugins()},e}(Ws));function Ah(){Ah=function(){return a};var a={},t=Object.prototype,l=t.hasOwnProperty,u=Object.defineProperty||function(t,e,n){t[e]=n.value},e="function"==typeof Symbol?Symbol:{},r=e.iterator||"@@iterator",n=e.asyncIterator||"@@asyncIterator",i=e.toStringTag||"@@toStringTag";function o(t,e,n){return Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{o({},"")}catch(t){o=function(t,e,n){return t[e]=n}}function s(t,e,n,r){var i,o,a,s,e=e&&e.prototype instanceof d?e:d,e=Object.create(e.prototype),r=new b(r||[]);return u(e,"_invoke",{value:(i=t,o=n,a=r,s="suspendedStart",function(t,e){if("executing"===s)throw new Error("Generator is already running");if("completed"===s){if("throw"===t)throw e;return S()}for(a.method=t,a.arg=e;;){var n=a.delegate;if(n){n=function t(e,n){var r=n.method,i=e.iterator[r];if(void 0===i)return n.delegate=null,"throw"===r&&e.iterator.return&&(n.method="return",n.arg=void 0,t(e,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),h;r=c(i,e.iterator,n.arg);if("throw"===r.type)return n.method="throw",n.arg=r.arg,n.delegate=null,h;i=r.arg;return i?i.done?(n[e.resultName]=i.value,n.next=e.nextLoc,"return"!==n.method&&(n.method="next",n.arg=void 0),n.delegate=null,h):i:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,h)}(n,a);if(n){if(n===h)continue;return n}}if("next"===a.method)a.sent=a._sent=a.arg;else if("throw"===a.method){if("suspendedStart"===s)throw s="completed",a.arg;a.dispatchException(a.arg)}else"return"===a.method&&a.abrupt("return",a.arg);s="executing";n=c(i,o,a);if("normal"===n.type){if(s=a.done?"completed":"suspendedYield",n.arg===h)continue;return{value:n.arg,done:a.done}}"throw"===n.type&&(s="completed",a.method="throw",a.arg=n.arg)}})}),e}function c(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(t){return{type:"throw",arg:t}}}a.wrap=s;var h={};function d(){}function f(){}function p(){}var e={},g=(o(e,r,function(){return this}),Object.getPrototypeOf),g=g&&g(g(x([]))),m=(g&&g!==t&&l.call(g,r)&&(e=g),p.prototype=d.prototype=Object.create(e));function v(t){["next","throw","return"].forEach(function(e){o(t,e,function(t){return this._invoke(e,t)})})}function y(a,s){var e;u(this,"_invoke",{value:function(n,r){function t(){return new s(function(t,e){!function e(t,n,r,i){var o,t=c(a[t],a,n);if("throw"!==t.type)return(n=(o=t.arg).value)&&"object"==typeof n&&l.call(n,"__await")?s.resolve(n.__await).then(function(t){e("next",t,r,i)},function(t){e("throw",t,r,i)}):s.resolve(n).then(function(t){o.value=t,r(o)},function(t){return e("throw",t,r,i)});i(t.arg)}(n,r,t,e)})}return e=e?e.then(t,t):t()}})}function E(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function _(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function b(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(E,this),this.reset(!0)}function x(e){if(e){var n,t=e[r];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length))return n=-1,(t=function t(){for(;++n<e.length;)if(l.call(e,n))return t.value=e[n],t.done=!1,t;return t.value=void 0,t.done=!0,t}).next=t}return{next:S}}function S(){return{value:void 0,done:!0}}return u(m,"constructor",{value:f.prototype=p,configurable:!0}),u(p,"constructor",{value:f,configurable:!0}),f.displayName=o(p,i,"GeneratorFunction"),a.isGeneratorFunction=function(t){t="function"==typeof t&&t.constructor;return!!t&&(t===f||"GeneratorFunction"===(t.displayName||t.name))},a.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,p):(t.__proto__=p,o(t,i,"GeneratorFunction")),t.prototype=Object.create(m),t},a.awrap=function(t){return{__await:t}},v(y.prototype),o(y.prototype,n,function(){return this}),a.AsyncIterator=y,a.async=function(t,e,n,r,i){void 0===i&&(i=Promise);var o=new y(s(t,e,n,r),i);return a.isGeneratorFunction(e)?o:o.next().then(function(t){return t.done?t.value:o.next()})},v(m),o(m,i,"Generator"),o(m,r,function(){return this}),o(m,"toString",function(){return"[object Generator]"}),a.keys=function(t){var e,n=Object(t),r=[];for(e in n)r.push(e);return r.reverse(),function t(){for(;r.length;){var e=r.pop();if(e in n)return t.value=e,t.done=!1,t}return t.done=!0,t}},a.values=x,b.prototype={constructor:b,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(_),!t)for(var e in this)"t"===e.charAt(0)&&l.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=void 0)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(n){if(this.done)throw n;var r=this;function t(t,e){return o.type="throw",o.arg=n,r.next=t,e&&(r.method="next",r.arg=void 0),!!e}for(var e=this.tryEntries.length-1;0<=e;--e){var i=this.tryEntries[e],o=i.completion;if("root"===i.tryLoc)return t("end");if(i.tryLoc<=this.prev){var a=l.call(i,"catchLoc"),s=l.call(i,"finallyLoc");if(a&&s){if(this.prev<i.catchLoc)return t(i.catchLoc,!0);if(this.prev<i.finallyLoc)return t(i.finallyLoc)}else if(a){if(this.prev<i.catchLoc)return t(i.catchLoc,!0)}else{if(!s)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return t(i.finallyLoc)}}}},abrupt:function(t,e){for(var n=this.tryEntries.length-1;0<=n;--n){var r=this.tryEntries[n];if(r.tryLoc<=this.prev&&l.call(r,"finallyLoc")&&this.prev<r.finallyLoc){var i=r;break}}var o=(i=i&&("break"===t||"continue"===t)&&i.tryLoc<=e&&e<=i.finallyLoc?null:i)?i.completion:{};return o.type=t,o.arg=e,i?(this.method="next",this.next=i.finallyLoc,h):this.complete(o)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),h},finish:function(t){for(var e=this.tryEntries.length-1;0<=e;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),_(n),h}},catch:function(t){for(var e=this.tryEntries.length-1;0<=e;--e){var n,r,i=this.tryEntries[e];if(i.tryLoc===t)return"throw"===(n=i.completion).type&&(r=n.arg,_(i)),r}throw new Error("illegal catch attempt")},delegateYield:function(t,e,n){return this.delegate={iterator:x(t),resultName:e,nextLoc:n},"next"===this.method&&(this.arg=void 0),h}},a}function Mh(t,e,n,r,i,o,a){try{var s=t[o](a),l=s.value}catch(t){return void n(t)}s.done?e(l):Promise.resolve(l).then(r,i)}function Rh(s){return function(){var t=this,a=arguments;return new Promise(function(e,n){var r=s.apply(t,a);function i(t){Mh(r,e,n,i,o,"next",t)}function o(t){Mh(r,e,n,i,o,"throw",t)}i(void 0)})}}function Nh(t,e){t.prototype=Object.create(e.prototype),Ch(t.prototype.constructor=t,e)}function Ch(t,e){return(Ch=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t})(t,e)}var Ph=function(){function t(t){this.$container=void 0,this.$canvas=void 0,this.dpr=void 0,this.context=void 0,this.canvasConfig=void 0,this.renderingContext=void 0,this.renderingContext=t.renderingContext,this.canvasConfig=t.config}var e=t.prototype;return e.init=function(){var t=Rh(Ah().mark(function t(){var e,n;return Ah().wrap(function(t){for(;;)switch(t.prev=t.next){case 0:n=this.canvasConfig,e=n.container,(n=n.canvas)?(this.$canvas=n,e&&n.parentElement!==e&&e.appendChild(n),this.$container=n.parentElement,this.canvasConfig.container=this.$container):e&&(this.$container=Fe(e)?document.getElementById(e):e,this.$container)&&(n=document.createElement("canvas"),this.$container.appendChild(n),this.$container.style.position||(this.$container.style.position="relative"),this.$canvas=n),this.context=this.$canvas.getContext("2d"),this.resize(this.canvasConfig.width,this.canvasConfig.height);case 4:case"end":return t.stop()}},t,this)}));return function(){return t.apply(this,arguments)}}(),e.getContext=function(){return this.context},e.getDomElement=function(){return this.$canvas},e.getDPR=function(){return this.dpr},e.getBoundingClientRect=function(){if(this.$canvas.getBoundingClientRect)return this.$canvas.getBoundingClientRect()},e.destroy=function(){this.$container&&this.$canvas&&this.$canvas.parentNode&&this.$container.removeChild(this.$canvas)},e.resize=function(t,e){var n=1<=(n=this.canvasConfig.devicePixelRatio||Ur&&window.devicePixelRatio||1)?Math.ceil(n):1;this.dpr=n,this.$canvas&&(this.$canvas.width=this.dpr*t,this.$canvas.height=this.dpr*e,jr(this.$canvas,t,e)),this.renderingContext.renderReasons.add(Ds.CAMERA_CHANGED)},e.applyCursorStyle=function(t){this.$container&&this.$container.style&&(this.$container.style.cursor=t)},e.toDataURL=function(){var e=Rh(Ah().mark(function t(e){var n,r;return Ah().wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return n=(r=e=void 0===e?{}:e).type,r=r.encoderOptions,t.abrupt("return",this.context.canvas.toDataURL(n,r));case 3:case"end":return t.stop()}},t,this)}));return function(t){return e.apply(this,arguments)}}(),t}(),Oh=function(i){function t(){for(var t,e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];return(t=i.call.apply(i,[this].concat(n))||this).name="canvas-context-register",t}Nh(t,i);var e=t.prototype;return e.init=function(){this.context.ContextService=Ph},e.destroy=function(){delete this.context.ContextService},t}(Ws),Ih=function(e){function t(t){t=e.call(this,t)||this;return t.registerPlugin(new Oh),t.registerPlugin(new Th),t.registerPlugin(new ec),t.registerPlugin(new oh),t.registerPlugin(new hh),t.registerPlugin(new Kc),t.registerPlugin(new vh),t}return Nh(t,e),t}(Gs);function Lh(){Lh=function(){return a};var a={},t=Object.prototype,l=t.hasOwnProperty,u=Object.defineProperty||function(t,e,n){t[e]=n.value},e="function"==typeof Symbol?Symbol:{},r=e.iterator||"@@iterator",n=e.asyncIterator||"@@asyncIterator",i=e.toStringTag||"@@toStringTag";function o(t,e,n){return Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{o({},"")}catch(t){o=function(t,e,n){return t[e]=n}}function s(t,e,n,r){var i,o,a,s,e=e&&e.prototype instanceof d?e:d,e=Object.create(e.prototype),r=new b(r||[]);return u(e,"_invoke",{value:(i=t,o=n,a=r,s="suspendedStart",function(t,e){if("executing"===s)throw new Error("Generator is already running");if("completed"===s){if("throw"===t)throw e;return S()}for(a.method=t,a.arg=e;;){var n=a.delegate;if(n){n=function t(e,n){var r=n.method,i=e.iterator[r];if(void 0===i)return n.delegate=null,"throw"===r&&e.iterator.return&&(n.method="return",n.arg=void 0,t(e,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),h;r=c(i,e.iterator,n.arg);if("throw"===r.type)return n.method="throw",n.arg=r.arg,n.delegate=null,h;i=r.arg;return i?i.done?(n[e.resultName]=i.value,n.next=e.nextLoc,"return"!==n.method&&(n.method="next",n.arg=void 0),n.delegate=null,h):i:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,h)}(n,a);if(n){if(n===h)continue;return n}}if("next"===a.method)a.sent=a._sent=a.arg;else if("throw"===a.method){if("suspendedStart"===s)throw s="completed",a.arg;a.dispatchException(a.arg)}else"return"===a.method&&a.abrupt("return",a.arg);s="executing";n=c(i,o,a);if("normal"===n.type){if(s=a.done?"completed":"suspendedYield",n.arg===h)continue;return{value:n.arg,done:a.done}}"throw"===n.type&&(s="completed",a.method="throw",a.arg=n.arg)}})}),e}function c(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(t){return{type:"throw",arg:t}}}a.wrap=s;var h={};function d(){}function f(){}function p(){}var e={},g=(o(e,r,function(){return this}),Object.getPrototypeOf),g=g&&g(g(x([]))),m=(g&&g!==t&&l.call(g,r)&&(e=g),p.prototype=d.prototype=Object.create(e));function v(t){["next","throw","return"].forEach(function(e){o(t,e,function(t){return this._invoke(e,t)})})}function y(a,s){var e;u(this,"_invoke",{value:function(n,r){function t(){return new s(function(t,e){!function e(t,n,r,i){var o,t=c(a[t],a,n);if("throw"!==t.type)return(n=(o=t.arg).value)&&"object"==typeof n&&l.call(n,"__await")?s.resolve(n.__await).then(function(t){e("next",t,r,i)},function(t){e("throw",t,r,i)}):s.resolve(n).then(function(t){o.value=t,r(o)},function(t){return e("throw",t,r,i)});i(t.arg)}(n,r,t,e)})}return e=e?e.then(t,t):t()}})}function E(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function _(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function b(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(E,this),this.reset(!0)}function x(e){if(e){var n,t=e[r];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length))return n=-1,(t=function t(){for(;++n<e.length;)if(l.call(e,n))return t.value=e[n],t.done=!1,t;return t.value=void 0,t.done=!0,t}).next=t}return{next:S}}function S(){return{value:void 0,done:!0}}return u(m,"constructor",{value:f.prototype=p,configurable:!0}),u(p,"constructor",{value:f,configurable:!0}),f.displayName=o(p,i,"GeneratorFunction"),a.isGeneratorFunction=function(t){t="function"==typeof t&&t.constructor;return!!t&&(t===f||"GeneratorFunction"===(t.displayName||t.name))},a.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,p):(t.__proto__=p,o(t,i,"GeneratorFunction")),t.prototype=Object.create(m),t},a.awrap=function(t){return{__await:t}},v(y.prototype),o(y.prototype,n,function(){return this}),a.AsyncIterator=y,a.async=function(t,e,n,r,i){void 0===i&&(i=Promise);var o=new y(s(t,e,n,r),i);return a.isGeneratorFunction(e)?o:o.next().then(function(t){return t.done?t.value:o.next()})},v(m),o(m,i,"Generator"),o(m,r,function(){return this}),o(m,"toString",function(){return"[object Generator]"}),a.keys=function(t){var e,n=Object(t),r=[];for(e in n)r.push(e);return r.reverse(),function t(){for(;r.length;){var e=r.pop();if(e in n)return t.value=e,t.done=!1,t}return t.done=!0,t}},a.values=x,b.prototype={constructor:b,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(_),!t)for(var e in this)"t"===e.charAt(0)&&l.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=void 0)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(n){if(this.done)throw n;var r=this;function t(t,e){return o.type="throw",o.arg=n,r.next=t,e&&(r.method="next",r.arg=void 0),!!e}for(var e=this.tryEntries.length-1;0<=e;--e){var i=this.tryEntries[e],o=i.completion;if("root"===i.tryLoc)return t("end");if(i.tryLoc<=this.prev){var a=l.call(i,"catchLoc"),s=l.call(i,"finallyLoc");if(a&&s){if(this.prev<i.catchLoc)return t(i.catchLoc,!0);if(this.prev<i.finallyLoc)return t(i.finallyLoc)}else if(a){if(this.prev<i.catchLoc)return t(i.catchLoc,!0)}else{if(!s)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return t(i.finallyLoc)}}}},abrupt:function(t,e){for(var n=this.tryEntries.length-1;0<=n;--n){var r=this.tryEntries[n];if(r.tryLoc<=this.prev&&l.call(r,"finallyLoc")&&this.prev<r.finallyLoc){var i=r;break}}var o=(i=i&&("break"===t||"continue"===t)&&i.tryLoc<=e&&e<=i.finallyLoc?null:i)?i.completion:{};return o.type=t,o.arg=e,i?(this.method="next",this.next=i.finallyLoc,h):this.complete(o)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),h},finish:function(t){for(var e=this.tryEntries.length-1;0<=e;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),_(n),h}},catch:function(t){for(var e=this.tryEntries.length-1;0<=e;--e){var n,r,i=this.tryEntries[e];if(i.tryLoc===t)return"throw"===(n=i.completion).type&&(r=n.arg,_(i)),r}throw new Error("illegal catch attempt")},delegateYield:function(t,e,n){return this.delegate={iterator:x(t),resultName:e,nextLoc:n},"next"===this.method&&(this.arg=void 0),h}},a}function kh(t,e,n,r,i,o,a){try{var s=t[o](a),l=s.value}catch(t){return void n(t)}s.done?e(l):Promise.resolve(l).then(r,i)}function Dh(t,e){return(Dh=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t})(t,e)}function Bh(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}function Fh(t,e){var n,r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(r)return(r=r.call(t)).next.bind(r);if(Array.isArray(t)||(r=function(t,e){var n;if(t)return"string"==typeof t?Bh(t,e):"Map"===(n="Object"===(n=Object.prototype.toString.call(t).slice(8,-1))&&t.constructor?t.constructor.name:n)||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Bh(t,e):void 0}(t))||e&&t&&"number"==typeof t.length)return r&&(t=r),n=0,function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}};throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var Uh=function(){function a(){}var t=a.prototype;return t.apply=function(t,e){var n=this,r=t.config.document,i=t.renderingService,o=t.svgElementMap;i.hooks.pick.tapPromise(a.tag,function(){s=Lh().mark(function t(e){return Lh().wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",n.pick(o,r,e));case 1:case"end":return t.stop()}},t)});var s,e=function(){var t=this,a=arguments;return new Promise(function(e,n){var r=s.apply(t,a);function i(t){kh(r,e,n,i,o,"next",t)}function o(t){kh(r,e,n,i,o,"throw",t)}i(void 0)})};return function(t){return e.apply(this,arguments)}}()),i.hooks.pickSync.tap(a.tag,function(t){return n.pick(o,r,t)})},t.pick=function(t,e,n){var r=n.topmost,i=n.position,o=i.clientX,i=i.clientY;try{for(var a,s=[],l=Fh((e||document).elementsFromPoint(o,i));!(a=l()).done;){var u=a.value,c=t.get(u);if(c&&c.isInteractive()&&(s.push(c),r))return n.picked=s,n}n.picked=s}catch(t){n.picked=[]}return n},a}(),Gh=(Uh.tag="SVGPicker",function(i){var t;function e(){for(var t,e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];return(t=i.call.apply(i,[this].concat(n))||this).name="svg-picker",t}t=i,(n=e).prototype=Object.create(t.prototype),Dh(n.prototype.constructor=n,t);var n=e.prototype;return n.init=function(){this.addRenderingPlugin(new Uh)},n.destroy=function(){this.removeAllRenderingPlugins()},e}(Ws));function Wh(){Wh=function(){return a};var a={},t=Object.prototype,l=t.hasOwnProperty,u=Object.defineProperty||function(t,e,n){t[e]=n.value},e="function"==typeof Symbol?Symbol:{},r=e.iterator||"@@iterator",n=e.asyncIterator||"@@asyncIterator",i=e.toStringTag||"@@toStringTag";function o(t,e,n){return Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{o({},"")}catch(t){o=function(t,e,n){return t[e]=n}}function s(t,e,n,r){var i,o,a,s,e=e&&e.prototype instanceof d?e:d,e=Object.create(e.prototype),r=new b(r||[]);return u(e,"_invoke",{value:(i=t,o=n,a=r,s="suspendedStart",function(t,e){if("executing"===s)throw new Error("Generator is already running");if("completed"===s){if("throw"===t)throw e;return S()}for(a.method=t,a.arg=e;;){var n=a.delegate;if(n){n=function t(e,n){var r=n.method,i=e.iterator[r];if(void 0===i)return n.delegate=null,"throw"===r&&e.iterator.return&&(n.method="return",n.arg=void 0,t(e,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),h;r=c(i,e.iterator,n.arg);if("throw"===r.type)return n.method="throw",n.arg=r.arg,n.delegate=null,h;i=r.arg;return i?i.done?(n[e.resultName]=i.value,n.next=e.nextLoc,"return"!==n.method&&(n.method="next",n.arg=void 0),n.delegate=null,h):i:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,h)}(n,a);if(n){if(n===h)continue;return n}}if("next"===a.method)a.sent=a._sent=a.arg;else if("throw"===a.method){if("suspendedStart"===s)throw s="completed",a.arg;a.dispatchException(a.arg)}else"return"===a.method&&a.abrupt("return",a.arg);s="executing";n=c(i,o,a);if("normal"===n.type){if(s=a.done?"completed":"suspendedYield",n.arg===h)continue;return{value:n.arg,done:a.done}}"throw"===n.type&&(s="completed",a.method="throw",a.arg=n.arg)}})}),e}function c(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(t){return{type:"throw",arg:t}}}a.wrap=s;var h={};function d(){}function f(){}function p(){}var e={},g=(o(e,r,function(){return this}),Object.getPrototypeOf),g=g&&g(g(x([]))),m=(g&&g!==t&&l.call(g,r)&&(e=g),p.prototype=d.prototype=Object.create(e));function v(t){["next","throw","return"].forEach(function(e){o(t,e,function(t){return this._invoke(e,t)})})}function y(a,s){var e;u(this,"_invoke",{value:function(n,r){function t(){return new s(function(t,e){!function e(t,n,r,i){var o,t=c(a[t],a,n);if("throw"!==t.type)return(n=(o=t.arg).value)&&"object"==typeof n&&l.call(n,"__await")?s.resolve(n.__await).then(function(t){e("next",t,r,i)},function(t){e("throw",t,r,i)}):s.resolve(n).then(function(t){o.value=t,r(o)},function(t){return e("throw",t,r,i)});i(t.arg)}(n,r,t,e)})}return e=e?e.then(t,t):t()}})}function E(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function _(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function b(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(E,this),this.reset(!0)}function x(e){if(e){var n,t=e[r];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length))return n=-1,(t=function t(){for(;++n<e.length;)if(l.call(e,n))return t.value=e[n],t.done=!1,t;return t.value=void 0,t.done=!0,t}).next=t}return{next:S}}function S(){return{value:void 0,done:!0}}return u(m,"constructor",{value:f.prototype=p,configurable:!0}),u(p,"constructor",{value:f,configurable:!0}),f.displayName=o(p,i,"GeneratorFunction"),a.isGeneratorFunction=function(t){t="function"==typeof t&&t.constructor;return!!t&&(t===f||"GeneratorFunction"===(t.displayName||t.name))},a.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,p):(t.__proto__=p,o(t,i,"GeneratorFunction")),t.prototype=Object.create(m),t},a.awrap=function(t){return{__await:t}},v(y.prototype),o(y.prototype,n,function(){return this}),a.AsyncIterator=y,a.async=function(t,e,n,r,i){void 0===i&&(i=Promise);var o=new y(s(t,e,n,r),i);return a.isGeneratorFunction(e)?o:o.next().then(function(t){return t.done?t.value:o.next()})},v(m),o(m,i,"Generator"),o(m,r,function(){return this}),o(m,"toString",function(){return"[object Generator]"}),a.keys=function(t){var e,n=Object(t),r=[];for(e in n)r.push(e);return r.reverse(),function t(){for(;r.length;){var e=r.pop();if(e in n)return t.value=e,t.done=!1,t}return t.done=!0,t}},a.values=x,b.prototype={constructor:b,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(_),!t)for(var e in this)"t"===e.charAt(0)&&l.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=void 0)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(n){if(this.done)throw n;var r=this;function t(t,e){return o.type="throw",o.arg=n,r.next=t,e&&(r.method="next",r.arg=void 0),!!e}for(var e=this.tryEntries.length-1;0<=e;--e){var i=this.tryEntries[e],o=i.completion;if("root"===i.tryLoc)return t("end");if(i.tryLoc<=this.prev){var a=l.call(i,"catchLoc"),s=l.call(i,"finallyLoc");if(a&&s){if(this.prev<i.catchLoc)return t(i.catchLoc,!0);if(this.prev<i.finallyLoc)return t(i.finallyLoc)}else if(a){if(this.prev<i.catchLoc)return t(i.catchLoc,!0)}else{if(!s)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return t(i.finallyLoc)}}}},abrupt:function(t,e){for(var n=this.tryEntries.length-1;0<=n;--n){var r=this.tryEntries[n];if(r.tryLoc<=this.prev&&l.call(r,"finallyLoc")&&this.prev<r.finallyLoc){var i=r;break}}var o=(i=i&&("break"===t||"continue"===t)&&i.tryLoc<=e&&e<=i.finallyLoc?null:i)?i.completion:{};return o.type=t,o.arg=e,i?(this.method="next",this.next=i.finallyLoc,h):this.complete(o)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),h},finish:function(t){for(var e=this.tryEntries.length-1;0<=e;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),_(n),h}},catch:function(t){for(var e=this.tryEntries.length-1;0<=e;--e){var n,r,i=this.tryEntries[e];if(i.tryLoc===t)return"throw"===(n=i.completion).type&&(r=n.arg,_(i)),r}throw new Error("illegal catch attempt")},delegateYield:function(t,e,n){return this.delegate={iterator:x(t),resultName:e,nextLoc:n},"next"===this.method&&(this.arg=void 0),h}},a}function Vh(t,e,n,r,i,o,a){try{var s=t[o](a),l=s.value}catch(t){return void n(t)}s.done?e(l):Promise.resolve(l).then(r,i)}function jh(s){return function(){var t=this,a=arguments;return new Promise(function(e,n){var r=s.apply(t,a);function i(t){Vh(r,e,n,i,o,"next",t)}function o(t){Vh(r,e,n,i,o,"throw",t)}i(void 0)})}}function zh(){return(zh=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n,r=arguments[e];for(n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t}).apply(this,arguments)}function Hh(t,e){return(Hh=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t})(t,e)}function Xh(){this.$el=void 0,this.$groupEl=void 0,this.$hitTestingEl=void 0}function Yh(t,e){return(e||document).createElementNS("http://www.w3.org/2000/svg",t)}function Kh(t){return t.toFixed(6).replace(".000000","")}function qh(t){return t.replace(/[&|<|>|"|']/g,function(t){return"&"===t?"&":"<"===t?"<":">"===t?">":'"'===t?""":"'"})}Xh.tag="c-svg-element";var $h={opacity:"opacity",fillStyle:"fill",fill:"fill",fillRule:"fill-rule",fillOpacity:"fill-opacity",strokeStyle:"stroke",strokeOpacity:"stroke-opacity",stroke:"stroke",clipPath:"clip-path",textPath:"text-path",r:"r",rx:"rx",ry:"ry",width:"width",height:"height",lineCap:"stroke-linecap",lineJoin:"stroke-linejoin",lineWidth:"stroke-width",lineDash:"stroke-dasharray",lineDashOffset:"stroke-dashoffset",miterLimit:"stroke-miterlimit",font:"font",fontSize:"font-size",fontStyle:"font-style",fontVariant:"font-variant",fontWeight:"font-weight",fontFamily:"font-family",letterSpacing:"letter-spacing",startArrow:"marker-start",endArrow:"marker-end",class:"class",id:"id",preserveAspectRatio:"preserveAspectRatio",visibility:"visibility",anchor:"anchor",shadowColor:"flood-color",shadowBlur:"stdDeviation",shadowOffsetX:"dx",shadowOffsetY:"dy",filter:"filter",innerHTML:"innerHTML",textAlign:"text-anchor",pointerEvents:"pointer-events"},Zh={textAlign:{inherit:"inherit",left:"left",start:"left",center:"middle",right:"end",end:"end"}},Qh={textAlign:"inherit",lineCap:"butt",lineJoin:"miter",lineWidth:"1px",opacity:"1",fillOpacity:"1",fillRule:"nonzero",strokeOpacity:"1",strokeWidth:"0",strokeMiterLimit:"4",letterSpacing:"0",fontSize:"inherit",fontFamily:"inherit",pointerEvents:"auto"},Jh="g-svg",td="clip-path-",ed="text-path-",nd=function(){function d(t,e,n){this.pluginOptions=void 0,this.defElementManager=void 0,this.context=void 0,this.svgElementMap=new WeakMap,this.$camera=void 0,this.renderQueue=[],this.dirtyAttributes=new WeakMap,this.pendingReorderQueue=new Set,this.clipPathUseMap=new WeakMap,this.pluginOptions=t,this.defElementManager=e,this.context=n}var t=d.prototype;return t.apply=function(t){function i(t){var e,t=t.target;c.clipPathUseMap.get(t)&&(e=c.defElementManager.getDefElement().querySelector("#"+c.getId(t)))&&e.remove(),c.createSVGDom(r,t,c.$camera)}function o(t){t=t.target,c.defElementManager.clear(t.entity),c.clipPathUseMap.delete(t),c.removeSVGDom(t)}function a(t){var e=t.parentNode,t=null==(t=t.parentNode)||null==(t=t.elementSVG)?void 0:t.$groupEl,e=((null==e?void 0:e.children)||[]).slice();t&&c.reorderChildren(r,t,e)}function s(t){t=t.target,a(t)}function l(t){var e,n=t.target;n.elementSVG&&(t=t.attrName,(e=c.dirtyAttributes.get(n))||(c.dirtyAttributes.set(n,[]),e=c.dirtyAttributes.get(n)),e.push(t))}function u(t){var t=t.target,e=null==(e=t.elementSVG)?void 0:e.$el,n=(i=t.parsedStyle).fill,r=i.stroke,i=i.clipPath;n&&!To(n)&&c.defElementManager.createOrUpdateGradientAndPattern(t,e,n,"fill",c),r&&!To(r)&&c.defElementManager.createOrUpdateGradientAndPattern(t,e,r,"stroke",c),i&&(n=et(K(),t.getWorldTransform()),e=td+i.entity+"-"+t.entity,r=c.defElementManager.getDefElement().querySelector("#"+e))&&c.applyTransform(r,n)}var c=this,e=t.renderingService,n=t.renderingContext,h=(this.context=t,this.context.svgElementMap=this.svgElementMap,n.root.ownerDocument.defaultView),r=this.context.config.document;e.hooks.init.tapPromise(d.tag,jh(Wh().mark(function t(){var e,n,r;return Wh().wrap(function(t){for(;;)switch(t.prev=t.next){case 0:n=c.context.config,e=n.background,n=n.document,c.defElementManager.init(),r=c.context.contextService.getContext(),e&&(r.style.background=e),r.setAttribute("color-interpolation-filters","sRGB"),c.$camera=Yh("g",n),c.$camera.id=Jh+"-camera",c.applyTransform(c.$camera,c.context.camera.getOrthoMatrix()),r.appendChild(c.$camera),h.addEventListener(v.MOUNTED,i),h.addEventListener(v.UNMOUNTED,o),h.addEventListener(v.REPARENT,s),h.addEventListener(v.ATTR_MODIFIED,l),h.addEventListener(v.BOUNDS_CHANGED,u);case 14:case"end":return t.stop()}},t)}))),e.hooks.destroy.tap(d.tag,function(){h.removeEventListener(v.MOUNTED,i),h.removeEventListener(v.UNMOUNTED,o),h.removeEventListener(v.REPARENT,s),h.removeEventListener(v.ATTR_MODIFIED,l),h.removeEventListener(v.BOUNDS_CHANGED,u)}),e.hooks.render.tap(d.tag,function(t){c.renderQueue.push(t)}),e.hooks.beginFrame.tap(d.tag,function(){var n=c.context.config.document;c.pendingReorderQueue.size&&(c.pendingReorderQueue.forEach(function(t){var e=((null==t?void 0:t.children)||[]).slice(),t=null==t||null==(t=t.elementSVG)?void 0:t.$groupEl;t&&c.reorderChildren(n||r,t,e||[])}),c.pendingReorderQueue.clear())}),e.hooks.endFrame.tap(d.tag,function(){n.renderReasons.has(Ds.CAMERA_CHANGED)&&c.applyTransform(c.$camera,c.context.camera.getOrthoMatrix()),c.renderQueue.forEach(function(e){var n=null==(t=e.elementSVG)?void 0:t.$el,r=null==(t=e.elementSVG)?void 0:t.$groupEl,t=(n&&r&&(t=e.getLocalTransform(),c.applyTransform(r,t),(t=c.clipPathUseMap.get(e))&&t.length&&t.forEach(function(t){c.applyTransform(t,e.getWorldTransform())}),e.renderable.dirty=!1),c.dirtyAttributes.get(e));t&&(t.forEach(function(t){"zIndex"===t?a(e):"increasedLineWidthForHitTesting"===t&&c.createOrUpdateHitArea(e,n,r),c.updateAttribute(e,[t])}),c.dirtyAttributes.delete(e))}),c.renderQueue=[]})},t.getId=function(t){return Jh+"-"+t.entity},t.reorderChildren=function(t,e,n){var r;n.sort(function(t,e){return t.sortable.renderOrder-e.sortable.renderOrder}),n.length&&(r=(t||document).createDocumentFragment(),n.forEach(function(t){t.isConnected&&(t=t.elementSVG.$groupEl)&&r.appendChild(t)}),e.appendChild(r))},t.applyTransform=function(t,e){t.setAttribute("transform","matrix("+Kh(e[0])+","+Kh(e[1])+","+Kh(e[4])+","+Kh(e[5])+","+Kh(e[12])+","+Kh(e[13])+")")},t.applyAttributes=function(t){var e,n=t.elementSVG,r=null==n?void 0:n.$el,n=null==n?void 0:n.$groupEl;r&&n&&(n=t.nodeName,e=t.attributes,r.setAttribute("fill","none"),n===lt.IMAGE&&r.setAttribute("preserveAspectRatio","none"),this.updateAttribute(t,Object.keys(e)))},t.updateAttribute=function(s,t){var l=this,u=this.context.config.document,e=s.elementSVG,c=e.$el,h=e.$groupEl,d=e.$hitTestingEl,f=s.parsedStyle,p=s.computedStyle,g=s.nodeName;t.some(function(t){return l.context.SVGElementLifeCycleContribution.shouldUpdateElementAttribute(s,t)})&&c&&[c,d].forEach(function(t){t&&(l.context.SVGElementLifeCycleContribution.updateElementAttribute(s,t,l.svgElementMap),s.nodeName!==lt.TEXT)&&l.updateAnchorWithTransform(s)}),t.forEach(function(e){var n=$h[e],t=(ct.enableCSSParsing?p:f)[e],r=!M(t)&&t.toString(),i=(null==(o=Zh[e])?void 0:o[r])||r,o=f[e],a=n&&!(null==(a=Is[e])||!a.inh);n&&(g!==lt.GROUP&&!s.isCustomElement||ct.enableCSSParsing||!a&&"fill"!==n&&"stroke"!==n)&&(g===lt.HTML&&("lineWidth"===e?c.style["border-width"]=(o||0)+"px":"lineDash"===e&&(c.style["border-style"]="dashed")),"fill"===e?g===lt.HTML?c.style.background=o.toString():l.defElementManager.createOrUpdateGradientAndPattern(s,c,o,n,l):"stroke"===e?g===lt.HTML?(c.style["border-color"]=o.toString(),c.style["border-style"]="solid"):l.defElementManager.createOrUpdateGradientAndPattern(s,c,o,n,l):ct.enableCSSParsing&&a?"unset"!==r&&r!==Qh[e]?null!=h&&h.setAttribute(n,i):null!=h&&h.removeAttribute(n):"clipPath"===e?l.createOrUpdateClipOrTextPath(u,o,s):"textPath"===e?l.createOrUpdateClipOrTextPath(u,o,s,!0):"shadowType"===e||"shadowColor"===e||"shadowBlur"===e||"shadowOffsetX"===e||"shadowOffsetY"===e?l.defElementManager.createOrUpdateShadow(s,c,e):"filter"===e?l.defElementManager.createOrUpdateFilter(s,c,o):"innerHTML"===e?l.createOrUpdateInnerHTML(u,c,o):"anchor"===e?g!==lt.TEXT&&l.updateAnchorWithTransform(s):M(t)||[c,d].forEach(function(t){t&&n&&("unset"!==r&&r!==Qh[e]?t.setAttribute(n,i):t.removeAttribute(n))}))})},t.createSVGDom=function(t,e,n,r){void 0===r&&(r=!1),e.elementSVG=new Xh;var i,o=e.elementSVG,a=this.context.SVGElementLifeCycleContribution.createElement(e,this.svgElementMap);a&&(e.nodeName===lt.HTML&&(e.parsedStyle.$el=a),this.pluginOptions.outputSVGElementId&&(a.id=this.getId(e)),this.pluginOptions.outputSVGElementName&&e.name&&a.setAttribute("name",e.name),!a.hasAttribute("data-wrapgroup")&&"g"===a.nodeName||r?i=a:((i=Yh("g",t)).id=a.id+"-g",i.appendChild(a)),o.$el=a,o.$groupEl=i,this.applyAttributes(e),this.createOrUpdateHitArea(e,a,i),t=n||e.parentNode&&(null==(r=e.parentNode.elementSVG)?void 0:r.$groupEl))&&(t.appendChild(i),this.pendingReorderQueue.add(e.parentNode))},t.removeSVGDom=function(t){var e=null==(e=t.elementSVG)?void 0:e.$groupEl;e&&e.parentNode&&(e.parentNode.removeChild(e),this.context.SVGElementLifeCycleContribution.destroyElement(t,e))},t.createOrUpdateHitArea=function(t,e,n){var r=t.elementSVG,i=r.$hitTestingEl,o=t.parsedStyle.increasedLineWidthForHitTesting;o?(i||(i=e.cloneNode(),this.pluginOptions.outputSVGElementId&&(i.id=Jh+"-"+t.nodeName+"-hittesting-"+t.entity),["filter"].forEach(function(t){i.removeAttribute(t)}),e="none"!==e.getAttribute("fill"),i.setAttribute("fill",e?"transparent":"none"),i.setAttribute("stroke","transparent"),n.appendChild(i),r.$hitTestingEl=i),i.setAttribute("stroke-width",""+(o+t.parsedStyle.lineWidth))):i&&(n.removeChild(i),r.$hitTestingEl=null)},t.createOrUpdateInnerHTML=function(t,e,n){t=(t||document).createElement("div");"string"==typeof n?t.innerHTML=n:t.appendChild(n),e.innerHTML="",e.appendChild(t)},t.createOrUpdateClipOrTextPath=function(t,e,n,r){var i,o,a,s=n.elementSVG.$groupEl,l=(r=void 0===r?!1:r)?"g":"clipPath",u=r?"text-path":"clip-path";e?(i=(r?ed:td)+e.entity+"-"+n.entity,(o=this.defElementManager.getDefElement()).querySelector("#"+i)||(r?(this.createSVGDom(t,e,null,!0),a=e.elementSVG.$el):(e.isConnected||o.querySelector("#"+this.getId(e))||this.createSVGDom(t,e,o,!0),a=Yh(l,t),(l=Yh("use",t)).setAttribute("href","#"+e.elementSVG.$el.id),a.appendChild(l),(t=this.clipPathUseMap.get(e))||(this.clipPathUseMap.set(e,[]),t=this.clipPathUseMap.get(e)),t.push(l),this.applyTransform(l,e.getWorldTransform()),t=et(K(),n.getWorldTransform()),this.applyTransform(a,t)),a.id=i,o.appendChild(a)),this.applyAttributes(e),r||s.setAttribute(u,"url(#"+i+")")):r||s.removeAttribute(u)},t.updateAnchorWithTransform=function(r){var t=r.getGeometryBounds(),i=t&&2*t.halfExtents[0]||0,o=t&&2*t.halfExtents[1]||0,a=(r.parsedStyle||{}).anchor;[null==(t=r.elementSVG)?void 0:t.$el,null==(t=r.elementSVG)?void 0:t.$hitTestingEl].forEach(function(t){var e,n;t&&(e=-a[0]*i,n=-a[1]*o,0==e&&0==n||t.setAttribute("transform","translate("+e+","+n+")"),r.nodeName!==lt.CIRCLE&&r.nodeName!==lt.ELLIPSE||(t.setAttribute("cx",""+i/2),t.setAttribute("cy",""+o/2)))})},d}(),rd=(nd.tag="SVGRenderer",{top:"hanging",middle:"central",bottom:"text-after-edge",alphabetic:"alphabetic",ideographic:"ideographic",hanging:"hanging"});(e={})[lt.RECT]="path",e[lt.CIRCLE]="circle",e[lt.ELLIPSE]="ellipse",e[lt.IMAGE]="image",e[lt.GROUP]="g",e[lt.LINE]="line",e[lt.POLYLINE]="polyline",e[lt.POLYGON]="polygon",e[lt.TEXT]="text",e[lt.PATH]="path",e[lt.HTML]="foreignObject";var id=e,od=((Us={})[lt.CIRCLE]=["r"],Us[lt.ELLIPSE]=["rx","ry"],Us[lt.RECT]=["width","height","radius"],Us[lt.IMAGE]=["img","width","height"],Us[lt.LINE]=["x1","y1","x2","y2","markerStart","markerEnd","markerStartOffset","markerEndOffset"],Us[lt.POLYLINE]=["points","markerStart","markerEnd","markerMid","markerStartOffset","markerEndOffset"],Us[lt.POLYGON]=["points","markerStart","markerEnd","markerMid","markerStartOffset","markerEndOffset"],Us[lt.PATH]=["path","markerStart","markerEnd","markerMid","markerStartOffset","markerEndOffset"],Us[lt.TEXT]=["text","font","fontSize","fontFamily","fontStyle","fontWeight","fontVariant","lineHeight","letterSpacing","wordWrap","wordWrapWidth","maxLines","leading","textBaseline","textAlign","textTransform","textOverflow","textPath","textPathSide","textPathStartOffset","textDecorationLine","textDecorationColor","textDecorationStyle","dx","dy"],Us),ad=function(){function t(t){this.context=void 0,this.context=t}var e=t.prototype;return e.createElement=function(t,e){var n=this.context.config.document,n=Yh(id[t.nodeName]||"g",n||document);return e.set(n,t),n},e.destroyElement=function(t,e){},e.shouldUpdateElementAttribute=function(t,e){t=t.nodeName;return-1<(od[t]||[]).indexOf(e)},e.updateElementAttribute=function(D){var B,F,U,t,G,W,e,r,V,j,z,n,i,H,a,s,X,Y,l,u,o,K,c,q,$,Z,Q,h,d,J,tt,f,p,g,et,nt,m,v,y,rt,E,_,b,x,S,w,T,A,M,R,N,C,P,O,I,it,L,k,ot=D.elementSVG.$el,at=D.nodeName,st=D.parsedStyle;switch(at){case lt.IMAGE:P=ot,L=void 0===(L=(O=st).img)?"":L,k=O.width,O=O.height,P.setAttribute("x","0"),P.setAttribute("y","0"),Fe(L)?P.setAttribute("href",L):L instanceof Image?(k||P.setAttribute("width",""+L.width),O||P.setAttribute("height",""+L.height),P.setAttribute("href",L.src)):L instanceof HTMLElement&&Fe(L.nodeName)&&"CANVAS"===L.nodeName.toUpperCase()?P.setAttribute("href",L.toDataURL()):L instanceof ImageData&&((I=document.createElement("canvas")).setAttribute("width",""+L.width),I.setAttribute("height",""+L.height),it=I.getContext("2d"))&&(it.putImageData(L,0,0),k||P.setAttribute("width",""+L.width),O||P.setAttribute("height",""+L.height),P.setAttribute("href",I.toDataURL()));break;case lt.RECT:it=ot,O=(k=st).radius,N=k.width,C=k.height,isFinite(N)&&isFinite(C)&&(k="",k=O&&O.some(function(t){return 0!==t})?(L=(O=O.map(function(t){return Ue(t,0,Math.min(Math.abs(N)/2,Math.abs(C)/2))}))[0],P=O[1],I=O[2],O=O[3],[["M "+(A=0<N?1:-1)*L+",0"],["l "+(N-A*(L+P))+",0"],["a "+P+","+P+",0,0,"+(R=A+(M=0<C?1:-1)!=0?1:0)+","+A*P+","+M*P],["l 0,"+(C-M*(P+I))],["a "+I+","+I+",0,0,"+R+","+-A*I+","+M*I],["l "+(A*(I+O)-N)+",0"],["a "+O+","+O+",0,0,"+R+","+-A*O+","+-M*O],["l 0,"+(M*(O+L)-C)],["a "+L+","+L+",0,0,"+R+","+A*L+","+-M*L],["z"]].join(" ")):"M 0,0 l "+N+",0 l 0,"+C+" l"+-N+" 0 z",it.setAttribute("d",k));break;case lt.LINE:R=ot,M=(A=st).x1,et=A.y1,nt=A.x2,m=A.y2,v=void 0===(v=A.defX)?0:v,y=void 0===(y=A.defY)?0:y,rt=A.markerStart,E=A.markerEnd,_=A.markerStartOffset,A=A.markerEndOffset,T=w=S=x=b=0,rt&&ut(rt)&&_&&(p=nt-M,g=m-et,T=Math.atan2(g,p),b=Math.cos(T)*(_||0),x=Math.sin(T)*(_||0)),E&&ut(E)&&A&&(p=M-nt,g=et-m,T=Math.atan2(g,p),S=Math.cos(T)*(A||0),w=Math.sin(T)*(A||0)),R.setAttribute("x1",""+(M-v+b)),R.setAttribute("y1",""+(et-y+x)),R.setAttribute("x2",""+(nt-v+S)),R.setAttribute("y2",""+(m-y+w));break;case lt.POLYGON:case lt.POLYLINE:rt=ot,E=(_=st).points.points,J=void 0===(g=_.defX)?0:g,tt=void 0===(g=_.defY)?0:g,g=_.markerStart,p=_.markerStartOffset,T=_.markerEnd,_=_.markerEndOffset,f=E.length,E&&2<=f&&(b=Q=Z=$=q=0,g&&ut(g)&&p&&(h=E[1][0]-E[0][0],d=E[1][1]-E[0][1],b=Math.atan2(d,h),q=Math.cos(b)*(p||0),$=Math.sin(b)*(p||0)),T&&ut(T)&&_&&(h=E[f-2][0]-E[f-1][0],d=E[f-2][1]-E[f-1][1],b=Math.atan2(d,h),Z=Math.cos(b)*(_||0),Q=Math.sin(b)*(_||0)),rt.setAttribute("points",E.map(function(t,e){var n=0,r=0;return 0===e?(n=q,r=$):e===f-1&&(n=Z,r=Q),t[0]-J+n+","+(t[1]-tt+r)}).join(" ")));break;case lt.PATH:et=ot,nt=(x=st).path,v=void 0===(v=x.defX)?0:v,S=void 0===(S=x.defY)?0:S,m=x.markerStart,y=x.markerEnd,w=x.markerStartOffset,x=x.markerEndOffset,c=K=o=h=d=0,m&&ut(m)&&w&&(i=(m=m.parentNode.getStartTangent())[0],m=m[1],n=i[0]-m[0],i=i[1]-m[1],c=Math.atan2(i,n),d=Math.cos(c)*(w||0),h=Math.sin(c)*(w||0)),y&&ut(y)&&x&&(w=(m=y.parentNode.getEndTangent())[0],y=m[1],n=w[0]-y[0],i=w[1]-y[1],c=Math.atan2(i,n),o=Math.cos(c)*(x||0),K=Math.sin(c)*(x||0)),et.setAttribute("d",(H=nt.absolutePath,a=v,s=S,void 0===(X=d)&&(X=0),void 0===(Y=h)&&(Y=0),void 0===(l=o)&&(l=0),void 0===(u=K)&&(u=0),~(m=H.map(function(t,e){var n=t[0],r=H[e+1],i=0===e&&(0!==X||0!==Y),o=(e===H.length-1||r&&("M"===r[0]||"Z"===r[0]))&&0!==l&&0!==u;switch(n){case"M":return i?"M "+(t[1]-a+X)+","+(t[2]-s+Y)+" L "+(t[1]-a)+","+(t[2]-s):"M "+(t[1]-a)+","+(t[2]-s);case"L":return"L "+(t[1]-a+(o?l:0))+","+(t[2]-s+(o?u:0));case"Q":return"Q "+(t[1]-a)+" "+(t[2]-s)+","+(t[3]-a)+" "+(t[4]-s)+(o?" L "+(t[3]-a+l)+","+(t[4]-s+u):"");case"C":return"C "+(t[1]-a)+" "+(t[2]-s)+","+(t[3]-a)+" "+(t[4]-s)+","+(t[5]-a)+" "+(t[6]-s)+(o?" L "+(t[5]-a+l)+","+(t[6]-s+u):"");case"A":return"A "+t[1]+" "+t[2]+" "+t[3]+" "+t[4]+" "+t[5]+" "+(t[6]-a)+" "+(t[7]-s)+(o?" L "+(t[6]-a+l)+","+(t[7]-s+u):"");case"Z":return"Z"}}).join(" ")).indexOf("NaN")?"":m));break;case lt.TEXT:i=ot,B=(n=st).lineWidth,c=n.dx,o=n.dy,K=n.textPath,F=void 0===(F=n.textPathSide)?"left":F,U=void 0===(U=n.textPathStartOffset)?0:U,t=void 0===(t=n.textDecorationLine)?"":t,G=void 0===(G=n.textDecorationColor)?"":G,W=void 0===(W=n.textDecorationStyle)?"":W,e=n.metrics,r=n.textBaseline,ct.enableCSSParsing||"alphabetic"!==r||(r="bottom"),i.setAttribute("dominant-baseline",rd[r]),i.setAttribute("paint-order","stroke"),n=e.lines,V=e.lineHeight,j=e.height,z=n.length,e="",0===c&&0===o||(e+="transform:translate("+c+"px, "+o+"px);"),t&&"none"!==t&&(e+="text-decoration:"+t+" "+W+" "+G+";"),e&&i.setAttribute("style",e),1===z?(c=qh(n[0]),i.setAttribute("dx",""+B/2),"bottom"!==r&&"top"!==r||(i.setAttribute("dominant-baseline","middle"),i.setAttribute("dy","bottom"===r?"-0.5em":"0.5em")),K?(i.innerHTML="",(o=Yh("textPath",i.ownerDocument)).setAttribute("href","#"+(ed+K.entity)),"left"!==F&&o.setAttribute("side",F),0!==U&&o.setAttribute("startOffset",""+U),o.innerHTML=c,i.appendChild(o)):i.innerHTML=c):i.innerHTML=n.map(function(t,e){var n=0;return 0===e?"middle"===r?n=V/2-j/2:"top"===r||"hanging"===r?n=0:"bottom"!==r&&"alphabetic"!==r&&"ideographic"!==r||(n=-V*(z-1)):n=V,'<tspan x="0" dx="'+B/2+'" dy="'+n+'">'+qh(t)+"</tspan>"}).join("")}},t}(),sd="g-filter-";function ld(g,m,t,e,n){var r,v=sd+t.entity,t=m.querySelectorAll("[name="+v+"]");t.length&&t.forEach(function(t){m.removeChild(t)}),0===n.length?null!=e&&e.removeAttribute("filter"):(r=n.map(function(t,e){var n,r,i,o,a,s,l,u,c,h,d,f=t.name,t=t.params,p=Yh("filter",g);return p.setAttribute("filterUnits","userSpaceOnUse"),"blur"===f?(a=p,n=t,(s=Yh("feGaussianBlur",s=g)).setAttribute("in","SourceGraphic"),s.setAttribute("stdDeviation",""+n[0].value),a.appendChild(s)):"brightness"===f?(n=ud((n=t)[0]),cd(g,p,{type:"linear",slope:n,intercept:0})):"drop-shadow"===f?(a=g,s=p,u=(l=t)[0].value,c=l[1].value,h=l[2].value,l=l[3].formatted,(d=Yh("feGaussianBlur",a)).setAttribute("in","SourceAlpha"),d.setAttribute("stdDeviation",""+h),s.appendChild(d),(h=Yh("feOffset",a)).setAttribute("dx",""+u),h.setAttribute("dy",""+c),h.setAttribute("result","offsetblur"),s.appendChild(h),(d=Yh("feFlood",a)).setAttribute("flood-color",l),s.appendChild(d),(u=Yh("feComposite",a)).setAttribute("in2","offsetblur"),u.setAttribute("operator","in"),s.appendChild(u),c=Yh("feMerge",a),s.appendChild(c),h=Yh("feMergeNode",a),(l=Yh("feMergeNode",a)).setAttribute("in","SourceGraphic"),c.appendChild(h),c.appendChild(l)):"contrast"===f?(d=ud((d=t)[0]),cd(g,p,{type:"linear",slope:d,intercept:-.5*d+.5})):"grayscale"===f?(u=ud((u=t)[0]),hd(g,p,[.2126+.7874*(1-u),.7152-.7152*(1-u),.0722-.0722*(1-u),0,0,.2126-.2126*(1-u),.7152+.2848*(1-u),.0722-.0722*(1-u),0,0,.2126-.2126*(1-u),.7152-.7152*(1-u),.0722+.9278*(1-u),0,0,0,0,0,1,0])):"sepia"===f?(h=ud((h=t)[0]),hd(g,p,[.393+.607*(1-h),.769-.769*(1-h),.189-.189*(1-h),0,0,.349-.349*(1-h),.686+.314*(1-h),.168-.168*(1-h),0,0,.272-.272*(1-h),.534-.534*(1-h),.131+.869*(1-h),0,0,0,0,0,1,0])):"saturate"===f?(c=g,l=p,i=ud((i=t)[0]),(c=Yh("feColorMatrix",c)).setAttribute("type","saturate"),c.setAttribute("values",""+i),l.appendChild(c)):"hue-rotate"===f?(i=p,o=t,(r=Yh("feColorMatrix",r=g)).setAttribute("type","hueRotate"),r.setAttribute("values",""+o[0].value),i.appendChild(r)):"invert"===f&&(o=ud((o=t)[0]),cd(g,p,{type:"table",tableValues:o+" "+(1-o)})),p.id=v+"-"+e,p.setAttribute("name",v),m.appendChild(p),p.id}),setTimeout(function(){null!=e&&e.setAttribute("filter",r.map(function(t){return"url(#"+t+")"}).join(" "))}))}function ud(t){return t.unit===p.kPercentage?t.value/100:t.value}function cd(t,e,n){var r=n.type,i=n.slope,o=n.intercept,a=n.tableValues,s=Yh("feComponentTransfer",t);[Yh("feFuncR",t),Yh("feFuncG",t),Yh("feFuncB",t)].forEach(function(t){t.setAttribute("type",r),"table"===r?t.setAttribute("tableValues",""+a):(t.setAttribute("slope",""+i),t.setAttribute("intercept",""+o)),s.appendChild(t)}),e.appendChild(s)}function hd(t,e,n){t=Yh("feColorMatrix",t);t.setAttribute("type","matrix"),t.setAttribute("values",n.join(" ")),e.appendChild(t)}var dd="g-pattern-",fd={},pd=0;function gd(t,e,n,r,i,o,a,s){if(i){var l,u,c,h,d,f,p;if(!To(i))return wo(i)?(a=function(n,e,r,i,t,o){var a,s=md(i);{var l,u,c;e.querySelector("#"+s)||(l=i.image,c="",Fe(l)?c=l:Ur&&(l instanceof HTMLImageElement?c=l.src:l instanceof HTMLCanvasElement&&(c=l.toDataURL())),c&&((u=Yh("image",n)).setAttribute("href",c),t?a=t(c):Ur&&(a=new window.Image),c.match(/^data:/i)||(a.crossOrigin="Anonymous",u.setAttribute("crossorigin","anonymous")),a.src=c,t=function(){var t=vd(n,e,r,i,s,a.width,a.height);e.appendChild(t),t.appendChild(u),u.setAttribute("x","0"),u.setAttribute("y","0"),u.setAttribute("width",""+a.width),u.setAttribute("height",""+a.height)},a.complete?t():a.onload=t),"rect"===l.nodeName&&(c=l.parsedStyle,t=c.width,c=c.height,t=vd(n,e,l,i,s,t,c),l.forEach(function(t){o.createSVGDom(n,t,null);var e=t.elementSVG,t=t.getLocalTransform();o.applyTransform(e.$groupEl,t)}),c=l.elementSVG,t.appendChild(c.$groupEl)))}return s}(t,e,n,i,a,s),r.style[o]="url(#"+a+")",a):1===i.length?(s=yd(t,n,e,0,i[0]),null!=r&&r.setAttribute(o,"url(#"+s+")"),s):(l=t,c=e,h=r,a=i,d=sd+(u=n).entity+"-gradient",(f=c.querySelector("#"+d))||((f=Yh("filter",l)).setAttribute("filterUnits","userSpaceOnUse"),f.setAttribute("x","0%"),f.setAttribute("y","0%"),f.setAttribute("width","100%"),f.setAttribute("height","100%"),f.id=d,c.appendChild(f)),p=0,a.forEach(function(t,e){var t=yd(l,u,c,0,t),n=t+"_rect",r=Yh("rect",l),t=(r.setAttribute("x","0"),r.setAttribute("y","0"),r.setAttribute("width","100%"),r.setAttribute("height","100%"),r.setAttribute("fill","url(#"+t+")"),r.id=n,c.appendChild(r),Yh("feImage",l));t.setAttribute("href","#"+n),t.setAttribute("result",d+"-"+e),f.appendChild(t),0<e&&((r=Yh("feBlend",l)).setAttribute("in",1===e?d+"-"+(e-1):d+"-blended-"+(p-1)),r.setAttribute("in2",d+"-"+e),r.setAttribute("result",d+"-blended-"+p++),r.setAttribute("mode","multiply"),f.appendChild(r))}),(a=Yh("feComposite",l)).setAttribute("in",d+"-blended-"+p),a.setAttribute("in2","SourceGraphic"),a.setAttribute("operator","in"),f.appendChild(a),s=d,null!=r&&r.setAttribute("filter","url(#"+s+")"),null!=r&&r.setAttribute("fill","black"),s);"currentColor"===n.style[o]?null!=r&&r.setAttribute(o,"currentColor"):null!=r&&r.setAttribute(o,i.isNone?"none":i.toString())}return""}function md(t,e){void 0===e&&(e={});var n,r,i,o,a,s,l,u="";return(l=t).type&&l.value?(l=t.type,n=t.value,l!==ur.LinearGradient&&l!==ur.RadialGradient||(n=(l=zh({},n,e)).type,e=l.width,r=l.height,i=l.steps,o=l.angle,a=l.cx,s=l.cy,l=l.size,u="gradient-"+n+"-"+((null==o?void 0:o.toString())||0)+"-"+((null==a?void 0:a.toString())||0)+"-"+((null==s?void 0:s.toString())||0)+"-"+((null==l?void 0:l.toString())||0)+"-"+e+"-"+r+"-"+i.map(function(t){return""+t.offset+t.color}).join("-"))):wo(t)&&(u=Fe(t.image)?"pattern-"+t.image+"-"+t.repetition:"rect"===t.image.nodeName?"pattern-rect-"+t.image.entity:"pattern-"+pd),u&&!fd[u]&&(fd[u]=dd+(""+pd++)),fd[u]}function vd(t,e,n,r,i,o,a){var s=r.repetition,r=r.transform,t=Yh("pattern",t);r&&t.setAttribute("patternTransform",ta(r).map(function(t){var e,n=t.t,t=t.d;return"translate"===n?"translate("+t[0].value+" "+t[1].value+")":"translatex"===n?"translate("+t[0].value+" 0)":"translatey"===n?"translate(0 "+t[0].value+")":"rotate"===n?"rotate("+t[0].value+")":"scale"===n?"scale("+(e=(null==t?void 0:t.map(function(t){return t.value}))||[1,1])[0]+", "+e[1]+")":"scalex"===n?"scale("+((null==t?void 0:t.map(function(t){return t.value}))||[1])[0]+", 1)":"scaley"===n?"scale(1, "+((null==t?void 0:t.map(function(t){return t.value}))||[1])[0]+")":"skew"===n?"skewX("+(e=(null==t?void 0:t.map(function(t){return t.value}))||[0,0])[0]+") skewY("+e[1]+")":"skewx"===n?"skewX("+((null==t?void 0:t.map(function(t){return t.value}))||[0])[0]+")":"skewy"===n?"skewY("+((null==t?void 0:t.map(function(t){return t.value}))||[0])[0]+")":"matrix"===n?"matrix("+(e=t.map(function(t){return t.value}))[0]+" "+e[1]+" "+e[2]+" "+e[3]+" "+e[4]+" "+e[5]+")":void 0}).join(" ")),t.setAttribute("patternUnits","userSpaceOnUse"),t.id=i,e.appendChild(t),t.setAttribute("x","0"),t.setAttribute("y","0");r=n.getGeometryBounds().halfExtents,i=o,e=a;return"repeat-x"===s?e=2*r[1]:"repeat-y"===s?i=2*r[0]:"no-repeat"===s&&(i=2*r[0],e=2*r[1]),t.setAttribute("width",""+i),t.setAttribute("height",""+e),t}function yd(t,e,n,r,i){var o,a,s,e=e.getGeometryBounds(),l=e&&2*e.halfExtents[0]||0,e=e&&2*e.halfExtents[1]||0,u=md(i,{width:l,height:e}),c=n.querySelector("#"+u);return c||((c=Yh(i.type===ur.LinearGradient?"linearGradient":"radialGradient",t)).setAttribute("gradientUnits","userSpaceOnUse"),o="",i.value.steps.sort(function(t,e){return t.offset.value-e.offset.value}).forEach(function(t){var e=t.offset,t=t.color;o+='<stop offset="'+e.value/100+'" stop-color="'+t+'"></stop>'}),c.innerHTML=o,c.id=u,n.appendChild(c)),i.type===ur.LinearGradient?(n=(t=Di(l,e,i.value.angle)).x1,a=t.y1,s=t.x2,t=t.y2,c.setAttribute("x1",""+n),c.setAttribute("y1",""+a),c.setAttribute("x2",""+s),c.setAttribute("y2",""+t)):(s=(a=Bi(l,e,(n=i.value).cx,n.cy,n.size)).x,t=a.y,l=a.r,c.setAttribute("cx",""+s),c.setAttribute("cy",""+t),c.setAttribute("r",""+l)),u}var Ed="g-filter-dropshadow-";var _d=/url\("?#(.*)\)/,bd=function(){function t(t){this.context=void 0,this.$def=void 0,this.gradientCache={},this.context=t}var e=t.prototype;return e.getDefElement=function(){return this.$def},e.init=function(){var t=this.context.config.document,e=this.context.contextService.getContext();this.$def=Yh("defs",t),e.appendChild(this.$def)},e.clear=function(e){var n=this;Object.keys(this.gradientCache).forEach(function(t){n.clearUnusedDefElement(n.gradientCache,t,e)})},e.clearUnusedDefElement=function(t,e,n){t[e]&&1===t[e].size&&t[e].has(n)&&(t=this.$def.querySelector("#"+e))&&this.$def.removeChild(t)},e.createOrUpdateGradientAndPattern=function(t,e,n,r,i){var o,a=this.context.config,s=a.document,a=a.createImage;e&&((o=(wo(n)?e.style[r]:e.getAttribute(r)||"").match(_d))&&1<o.length&&this.clearUnusedDefElement(this.gradientCache,o[1].replace('"',""),t.entity),o=gd(s||document,this.$def,t,e,n,r,a,i))&&(this.gradientCache[o]||(this.gradientCache[o]=new Set),this.gradientCache[o].add(t.entity))},e.createOrUpdateShadow=function(t,e,n){var r,i,o,a,s,l,u,c,h,d,f=this.context.config.document;f=f||document,r=this.$def,e=e,n=n,a=(c=(t=t).parsedStyle).shadowType,s=c.shadowBlur,l=c.shadowColor,u=c.shadowOffsetX,c=c.shadowOffsetY,h=!M(l)&&0<s,t=Ed+t.entity,!(d=r.querySelector("#"+t))||d.getAttribute("data-type")===a&&h||(d.remove(),d=null),h?(null!=e&&e.setAttribute("filter","url(#"+t+")"),d?"inner"===a?(h=d.children[1],i=d.children[2],o=d.children[3],"shadowColor"===n?o.setAttribute("flood-color",l.toString()):"shadowBlur"===n?h.setAttribute("stdDeviation",""+(s||0)/4):"shadowOffsetX"===n?i.setAttribute("dx",""+(u||0)/2):"shadowOffsetY"===n&&i.setAttribute("dy",""+(c||0)/2)):"outer"===a&&(o=d.children[0],"shadowColor"===n?o.setAttribute("flood-color",l.toString()):"shadowBlur"===n?o.setAttribute("stdDeviation",""+(s||0)/4):"shadowOffsetX"===n?o.setAttribute("dx",""+(u||0)/2):"shadowOffsetY"===n&&o.setAttribute("dy",""+(c||0)/2)):((d=Yh("filter",f)).setAttribute("data-type",a),"outer"===a?((h=Yh("feDropShadow",f)).setAttribute("dx",""+(u||0)/2),h.setAttribute("dy",""+(c||0)/2),h.setAttribute("stdDeviation",""+(s||0)/4),h.setAttribute("flood-color",l.toString()),d.appendChild(h)):"inner"===a&&((i=Yh("feComponentTransfer",f)).setAttribute("in","SourceAlpha"),(n=Yh("feFuncA",f)).setAttribute("type","table"),n.setAttribute("tableValues","1 0"),i.appendChild(n),d.appendChild(i),(o=Yh("feGaussianBlur",f)).setAttribute("stdDeviation",""+(s||0)/4),d.appendChild(o),(h=Yh("feOffset",f)).setAttribute("dx",""+(u||0)/2),h.setAttribute("dy",""+(c||0)/2),h.setAttribute("result","offsetblur"),d.appendChild(h),(a=Yh("feFlood",f)).setAttribute("flood-color",l.toString()),a.setAttribute("result","color"),d.appendChild(a),(n=Yh("feComposite",f)).setAttribute("in2","offsetblur"),n.setAttribute("operator","in"),d.appendChild(n),(i=Yh("feComposite",f)).setAttribute("in2","SourceAlpha"),i.setAttribute("operator","in"),d.appendChild(i),s=Yh("feMerge",f),d.appendChild(s),(o=Yh("feMergeNode",f)).setAttribute("in","SourceGraphic"),u=Yh("feMergeNode",f),s.appendChild(o),s.appendChild(u)),d.id=t,d.setAttribute("filterUnits","userSpaceOnUse"),r.appendChild(d))):null!=e&&e.removeAttribute("filter")},e.createOrUpdateFilter=function(t,e,n){ld(this.context.config.document||document,this.$def,t,e,n)},t}(),xd=function(n){var t;function e(t){var e;return void 0===t&&(t={}),(e=n.call(this)||this).options=void 0,e.name="svg-renderer",e.options=t,e}t=n,(r=e).prototype=Object.create(t.prototype),Hh(r.prototype.constructor=r,t);var r=e.prototype;return r.init=function(){var t=this.options,e=t.outputSVGElementId,t=t.outputSVGElementName,n=new bd(this.context),r=new ad(this.context),r=(this.context.defaultElementLifeCycleContribution=r,this.context.SVGElementLifeCycleContribution=r,{outputSVGElementId:!!M(e)||!!e,outputSVGElementName:!!M(t)||!!t});this.addRenderingPlugin(new nd(r,n,this.context))},r.destroy=function(){this.removeAllRenderingPlugins(),delete this.context.defaultElementLifeCycleContribution,delete this.context.SVGElementLifeCycleContribution},e}(Ws);function Sd(){Sd=function(){return a};var a={},t=Object.prototype,l=t.hasOwnProperty,u=Object.defineProperty||function(t,e,n){t[e]=n.value},e="function"==typeof Symbol?Symbol:{},r=e.iterator||"@@iterator",n=e.asyncIterator||"@@asyncIterator",i=e.toStringTag||"@@toStringTag";function o(t,e,n){return Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{o({},"")}catch(t){o=function(t,e,n){return t[e]=n}}function s(t,e,n,r){var i,o,a,s,e=e&&e.prototype instanceof d?e:d,e=Object.create(e.prototype),r=new b(r||[]);return u(e,"_invoke",{value:(i=t,o=n,a=r,s="suspendedStart",function(t,e){if("executing"===s)throw new Error("Generator is already running");if("completed"===s){if("throw"===t)throw e;return S()}for(a.method=t,a.arg=e;;){var n=a.delegate;if(n){n=function t(e,n){var r=n.method,i=e.iterator[r];if(void 0===i)return n.delegate=null,"throw"===r&&e.iterator.return&&(n.method="return",n.arg=void 0,t(e,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),h;r=c(i,e.iterator,n.arg);if("throw"===r.type)return n.method="throw",n.arg=r.arg,n.delegate=null,h;i=r.arg;return i?i.done?(n[e.resultName]=i.value,n.next=e.nextLoc,"return"!==n.method&&(n.method="next",n.arg=void 0),n.delegate=null,h):i:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,h)}(n,a);if(n){if(n===h)continue;return n}}if("next"===a.method)a.sent=a._sent=a.arg;else if("throw"===a.method){if("suspendedStart"===s)throw s="completed",a.arg;a.dispatchException(a.arg)}else"return"===a.method&&a.abrupt("return",a.arg);s="executing";n=c(i,o,a);if("normal"===n.type){if(s=a.done?"completed":"suspendedYield",n.arg===h)continue;return{value:n.arg,done:a.done}}"throw"===n.type&&(s="completed",a.method="throw",a.arg=n.arg)}})}),e}function c(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(t){return{type:"throw",arg:t}}}a.wrap=s;var h={};function d(){}function f(){}function p(){}var e={},g=(o(e,r,function(){return this}),Object.getPrototypeOf),g=g&&g(g(x([]))),m=(g&&g!==t&&l.call(g,r)&&(e=g),p.prototype=d.prototype=Object.create(e));function v(t){["next","throw","return"].forEach(function(e){o(t,e,function(t){return this._invoke(e,t)})})}function y(a,s){var e;u(this,"_invoke",{value:function(n,r){function t(){return new s(function(t,e){!function e(t,n,r,i){var o,t=c(a[t],a,n);if("throw"!==t.type)return(n=(o=t.arg).value)&&"object"==typeof n&&l.call(n,"__await")?s.resolve(n.__await).then(function(t){e("next",t,r,i)},function(t){e("throw",t,r,i)}):s.resolve(n).then(function(t){o.value=t,r(o)},function(t){return e("throw",t,r,i)});i(t.arg)}(n,r,t,e)})}return e=e?e.then(t,t):t()}})}function E(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function _(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function b(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(E,this),this.reset(!0)}function x(e){if(e){var n,t=e[r];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length))return n=-1,(t=function t(){for(;++n<e.length;)if(l.call(e,n))return t.value=e[n],t.done=!1,t;return t.value=void 0,t.done=!0,t}).next=t}return{next:S}}function S(){return{value:void 0,done:!0}}return u(m,"constructor",{value:f.prototype=p,configurable:!0}),u(p,"constructor",{value:f,configurable:!0}),f.displayName=o(p,i,"GeneratorFunction"),a.isGeneratorFunction=function(t){t="function"==typeof t&&t.constructor;return!!t&&(t===f||"GeneratorFunction"===(t.displayName||t.name))},a.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,p):(t.__proto__=p,o(t,i,"GeneratorFunction")),t.prototype=Object.create(m),t},a.awrap=function(t){return{__await:t}},v(y.prototype),o(y.prototype,n,function(){return this}),a.AsyncIterator=y,a.async=function(t,e,n,r,i){void 0===i&&(i=Promise);var o=new y(s(t,e,n,r),i);return a.isGeneratorFunction(e)?o:o.next().then(function(t){return t.done?t.value:o.next()})},v(m),o(m,i,"Generator"),o(m,r,function(){return this}),o(m,"toString",function(){return"[object Generator]"}),a.keys=function(t){var e,n=Object(t),r=[];for(e in n)r.push(e);return r.reverse(),function t(){for(;r.length;){var e=r.pop();if(e in n)return t.value=e,t.done=!1,t}return t.done=!0,t}},a.values=x,b.prototype={constructor:b,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(_),!t)for(var e in this)"t"===e.charAt(0)&&l.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=void 0)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(n){if(this.done)throw n;var r=this;function t(t,e){return o.type="throw",o.arg=n,r.next=t,e&&(r.method="next",r.arg=void 0),!!e}for(var e=this.tryEntries.length-1;0<=e;--e){var i=this.tryEntries[e],o=i.completion;if("root"===i.tryLoc)return t("end");if(i.tryLoc<=this.prev){var a=l.call(i,"catchLoc"),s=l.call(i,"finallyLoc");if(a&&s){if(this.prev<i.catchLoc)return t(i.catchLoc,!0);if(this.prev<i.finallyLoc)return t(i.finallyLoc)}else if(a){if(this.prev<i.catchLoc)return t(i.catchLoc,!0)}else{if(!s)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return t(i.finallyLoc)}}}},abrupt:function(t,e){for(var n=this.tryEntries.length-1;0<=n;--n){var r=this.tryEntries[n];if(r.tryLoc<=this.prev&&l.call(r,"finallyLoc")&&this.prev<r.finallyLoc){var i=r;break}}var o=(i=i&&("break"===t||"continue"===t)&&i.tryLoc<=e&&e<=i.finallyLoc?null:i)?i.completion:{};return o.type=t,o.arg=e,i?(this.method="next",this.next=i.finallyLoc,h):this.complete(o)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),h},finish:function(t){for(var e=this.tryEntries.length-1;0<=e;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),_(n),h}},catch:function(t){for(var e=this.tryEntries.length-1;0<=e;--e){var n,r,i=this.tryEntries[e];if(i.tryLoc===t)return"throw"===(n=i.completion).type&&(r=n.arg,_(i)),r}throw new Error("illegal catch attempt")},delegateYield:function(t,e,n){return this.delegate={iterator:x(t),resultName:e,nextLoc:n},"next"===this.method&&(this.arg=void 0),h}},a}function wd(t,e,n,r,i,o,a){try{var s=t[o](a),l=s.value}catch(t){return void n(t)}s.done?e(l):Promise.resolve(l).then(r,i)}function Td(s){return function(){var t=this,a=arguments;return new Promise(function(e,n){var r=s.apply(t,a);function i(t){wd(r,e,n,i,o,"next",t)}function o(t){wd(r,e,n,i,o,"throw",t)}i(void 0)})}}function Ad(t,e){t.prototype=Object.create(e.prototype),Md(t.prototype.constructor=t,e)}function Md(t,e){return(Md=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t})(t,e)}function Rd(t,e){if(null==t)return{};for(var n,r={},i=Object.keys(t),o=0;o<i.length;o++)n=i[o],0<=e.indexOf(n)||(r[n]=t[n]);return r}var Nd=["offset","composite","computedOffset","easing"],Cd=["offset","composite","computedOffset","easing","transformOrigin"],Pd=["offset","composite","computedOffset","easing","transformOrigin"],Od=["offset","composite","computedOffset","easing","transformOrigin"],Id=function(){function t(t){this.context=void 0,this.$container=void 0,this.$namespace=void 0,this.dpr=void 0,this.canvasConfig=void 0,this.context=t,this.canvasConfig=t.config}var e=t.prototype;return e.init=function(){var t=Td(Sd().mark(function t(){var e,n,r;return Sd().wrap(function(t){for(;;)switch(t.prev=t.next){case 0:e=this.canvasConfig,n=e.container,r=e.document,e=e.devicePixelRatio,this.$container=Fe(n)?(r||document).getElementById(n):n,this.$container&&(this.$container.style.position||(this.$container.style.position="relative"),(n=Yh("svg",r)).setAttribute("width",""+this.canvasConfig.width),n.setAttribute("height",""+this.canvasConfig.height),this.$container.appendChild(n),this.$namespace=n),r=1<=(r=e||Ur&&window.devicePixelRatio||1)?Math.ceil(r):1,this.dpr=r;case 6:case"end":return t.stop()}},t,this)}));return function(){return t.apply(this,arguments)}}(),e.getDomElement=function(){return this.$namespace},e.getContext=function(){return this.$namespace},e.getDPR=function(){return this.dpr},e.getBoundingClientRect=function(){var t;return null==(t=this.$namespace)?void 0:t.getBoundingClientRect()},e.destroy=function(){this.$container&&this.$namespace&&this.$namespace.parentNode&&this.$container.removeChild(this.$namespace)},e.resize=function(t,e){this.$namespace&&(this.$namespace.setAttribute("width",""+t),this.$namespace.setAttribute("height",""+e))},e.applyCursorStyle=function(t){this.$container&&(this.$container.style.cursor=t)},e.generateCSSText=function(t,e,n,r,i){void 0===i&&(i={});var o=r.duration,a=r.easing,s=r.delay,l=r.direction,u=r.iterations,r=r.fill;return"@keyframes "+t+"{"+n.map(function(t){t.offset,t.composite;var e=t.computedOffset,n=(t.easing,Rd(t,Nd));return 100*e+"%{"+Object.keys(n).map(function(t){return t+":"+(i[t]||"")+n[t]+";"}).join("")+"}"}).join("")+"}"+e+" {animation: "+t+" "+o+"ms "+a+" "+s+"ms "+(u===1/0?"infinite":u)+" "+l+" "+r+";}"},e.toDataURL=function(){var e=Td(Sd().mark(function t(e){var n,s,c,l,r,h=this;return Sd().wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return n=this.$namespace.cloneNode(!0),s=this.canvasConfig.document,c=0,l=null,this.context.renderingContext.root.forEach(function(t){var r,i,o,a,u,e=t.getAnimations();e.length&&(l||(l=(s||document).createElement("style"),n.appendChild(l)),r=t.elementSVG,i="#"+r.$el.id,o="#"+r.$groupEl.id,u=a="",e.forEach(function(t){var s,l,e,n=t.effect.getKeyframes();n.length&&(s=[],l=[],(e=n[0]).offset,e.composite,e.computedOffset,e.easing,e.transformOrigin,e=Rd(e,Cd),Object.keys(e).forEach(function(t){var e;"transform"===t&&l.push(t),!(null==(e=Is[t])||!e.inh)?l.push(t):"transform"!==t&&s.push(t)}),l.length&&(e=n.map(function(e){var t=e.offset,n=e.composite,r=e.computedOffset,i=e.easing,o=(e.transformOrigin,Rd(e,Pd)),a={offset:t,composite:n,computedOffset:r,easing:i};return Object.keys(o).forEach(function(t){l.includes(t)&&(a[t]=e[t])}),a}),u+=h.generateCSSText("a"+c++,o,e,t.effect.getComputedTiming(),{transform:r.$groupEl.getAttribute("transform")})),s.length)&&(e=n.map(function(e){var t=e.offset,n=e.composite,r=e.computedOffset,i=e.easing,o=(e.transformOrigin,Rd(e,Od)),a={offset:t,composite:n,computedOffset:r,easing:i};return Object.keys(o).forEach(function(t){s.includes(t)&&(a[t]=e[t])}),a}),a+=h.generateCSSText("a"+c++,i,e,t.effect.getComputedTiming()))}),l.textContent+=a+u)}),r=document.implementation.createDocumentType("svg","-//W3C//DTD SVG 1.1//EN","http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"),(r=document.implementation.createDocument("http://www.w3.org/2000/svg","svg",r)).replaceChild(n,r.documentElement),t.abrupt("return","data:image/svg+xml;charset=utf8,"+encodeURIComponent((new XMLSerializer).serializeToString(r)));case 10:case"end":return t.stop()}},t,this)}));return function(t){return e.apply(this,arguments)}}(),t}(),Ld=function(i){function t(){for(var t,e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];return(t=i.call.apply(i,[this].concat(n))||this).name="svg-context-register",t}Ad(t,i);var e=t.prototype;return e.init=function(){this.context.ContextService=Id},e.destroy=function(){delete this.context.ContextService},t}(Ws),kd=function(n){function t(t){var e;return(e=n.call(this,t=void 0===t?{}:t)||this).registerPlugin(new Ld),e.registerPlugin(new xd({outputSVGElementId:t.outputSVGElementId})),e.registerPlugin(new hh),e.registerPlugin(new Gh),e}return Ad(t,n),t}(Gs),Dd=(j(function(e){e=function(a){var l,t=Object.prototype,u=t.hasOwnProperty,c=Object.defineProperty||function(t,e,n){t[e]=n.value},e="function"==typeof Symbol?Symbol:{},r=e.iterator||"@@iterator",n=e.asyncIterator||"@@asyncIterator",i=e.toStringTag||"@@toStringTag";function o(t,e,n){return Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{o({},"")}catch(t){o=function(t,e,n){return t[e]=n}}function s(t,e,n,r){var i,o,a,s,e=e&&e.prototype instanceof v?e:v,e=Object.create(e.prototype),r=new A(r||[]);return c(e,"_invoke",{value:(i=t,o=n,a=r,s=d,function(t,e){if(s===p)throw new Error("Generator is already running");if(s===g){if("throw"===t)throw e;return R()}for(a.method=t,a.arg=e;;){var n=a.delegate;if(n){n=function t(e,n){var r=n.method;var i=e.iterator[r];if(i===l)return n.delegate=null,"throw"===r&&e.iterator.return&&(n.method="return",n.arg=l,t(e,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),m;r=h(i,e.iterator,n.arg);if("throw"===r.type)return n.method="throw",n.arg=r.arg,n.delegate=null,m;i=r.arg;if(!i)return n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,m;{if(!i.done)return i;n[e.resultName]=i.value,n.next=e.nextLoc,"return"!==n.method&&(n.method="next",n.arg=l)}n.delegate=null;return m}(n,a);if(n){if(n===m)continue;return n}}if("next"===a.method)a.sent=a._sent=a.arg;else if("throw"===a.method){if(s===d)throw s=g,a.arg;a.dispatchException(a.arg)}else"return"===a.method&&a.abrupt("return",a.arg);s=p;n=h(i,o,a);if("normal"===n.type){if(s=a.done?g:f,n.arg!==m)return{value:n.arg,done:a.done}}else"throw"===n.type&&(s=g,a.method="throw",a.arg=n.arg)}})}),e}function h(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(t){return{type:"throw",arg:t}}}a.wrap=s;var d="suspendedStart",f="suspendedYield",p="executing",g="completed",m={};function v(){}function y(){}function E(){}var e={},_=(o(e,r,function(){return this}),Object.getPrototypeOf),_=_&&_(_(M([]))),b=(_&&_!==t&&u.call(_,r)&&(e=_),E.prototype=v.prototype=Object.create(e));function x(t){["next","throw","return"].forEach(function(e){o(t,e,function(t){return this._invoke(e,t)})})}function S(a,s){var e;c(this,"_invoke",{value:function(n,r){function t(){return new s(function(t,e){!function e(t,n,r,i){var o,t=h(a[t],a,n);if("throw"!==t.type)return(n=(o=t.arg).value)&&"object"==typeof n&&u.call(n,"__await")?s.resolve(n.__await).then(function(t){e("next",t,r,i)},function(t){e("throw",t,r,i)}):s.resolve(n).then(function(t){o.value=t,r(o)},function(t){return e("throw",t,r,i)});i(t.arg)}(n,r,t,e)})}return e=e?e.then(t,t):t()}})}function w(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function T(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function A(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(w,this),this.reset(!0)}function M(e){if(e){var n,t=e[r];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length))return n=-1,(t=function t(){for(;++n<e.length;)if(u.call(e,n))return t.value=e[n],t.done=!1,t;return t.value=l,t.done=!0,t}).next=t}return{next:R}}function R(){return{value:l,done:!0}}return c(b,"constructor",{value:y.prototype=E,configurable:!0}),c(E,"constructor",{value:y,configurable:!0}),y.displayName=o(E,i,"GeneratorFunction"),a.isGeneratorFunction=function(t){t="function"==typeof t&&t.constructor;return!!t&&(t===y||"GeneratorFunction"===(t.displayName||t.name))},a.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,E):(t.__proto__=E,o(t,i,"GeneratorFunction")),t.prototype=Object.create(b),t},a.awrap=function(t){return{__await:t}},x(S.prototype),o(S.prototype,n,function(){return this}),a.AsyncIterator=S,a.async=function(t,e,n,r,i){void 0===i&&(i=Promise);var o=new S(s(t,e,n,r),i);return a.isGeneratorFunction(e)?o:o.next().then(function(t){return t.done?t.value:o.next()})},x(b),o(b,i,"Generator"),o(b,r,function(){return this}),o(b,"toString",function(){return"[object Generator]"}),a.keys=function(t){var e,n=Object(t),r=[];for(e in n)r.push(e);return r.reverse(),function t(){for(;r.length;){var e=r.pop();if(e in n)return t.value=e,t.done=!1,t}return t.done=!0,t}},a.values=M,A.prototype={constructor:A,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=l,this.done=!1,this.delegate=null,this.method="next",this.arg=l,this.tryEntries.forEach(T),!t)for(var e in this)"t"===e.charAt(0)&&u.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=l)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(n){if(this.done)throw n;var r=this;function t(t,e){return o.type="throw",o.arg=n,r.next=t,e&&(r.method="next",r.arg=l),!!e}for(var e=this.tryEntries.length-1;0<=e;--e){var i=this.tryEntries[e],o=i.completion;if("root"===i.tryLoc)return t("end");if(i.tryLoc<=this.prev){var a=u.call(i,"catchLoc"),s=u.call(i,"finallyLoc");if(a&&s){if(this.prev<i.catchLoc)return t(i.catchLoc,!0);if(this.prev<i.finallyLoc)return t(i.finallyLoc)}else if(a){if(this.prev<i.catchLoc)return t(i.catchLoc,!0)}else{if(!s)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return t(i.finallyLoc)}}}},abrupt:function(t,e){for(var n=this.tryEntries.length-1;0<=n;--n){var r=this.tryEntries[n];if(r.tryLoc<=this.prev&&u.call(r,"finallyLoc")&&this.prev<r.finallyLoc){var i=r;break}}var o=(i=i&&("break"===t||"continue"===t)&&i.tryLoc<=e&&e<=i.finallyLoc?null:i)?i.completion:{};return o.type=t,o.arg=e,i?(this.method="next",this.next=i.finallyLoc,m):this.complete(o)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),m},finish:function(t){for(var e=this.tryEntries.length-1;0<=e;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),T(n),m}},catch:function(t){for(var e=this.tryEntries.length-1;0<=e;--e){var n,r,i=this.tryEntries[e];if(i.tryLoc===t)return"throw"===(n=i.completion).type&&(r=n.arg,T(i)),r}throw new Error("illegal catch attempt")},delegateYield:function(t,e,n){return this.delegate={iterator:M(t),resultName:e,nextLoc:n},"next"===this.method&&(this.arg=l),m}},a}(e.exports);try{regeneratorRuntime=e}catch(t){"object"==typeof globalThis?globalThis.regeneratorRuntime=e:Function("r","regeneratorRuntime = r")(e)}}),Bd),pa=Bd;function Bd(t,e,n){n=n||2;var r,i,o,a,s,l=e&&e.length,u=l?e[0]*n:t.length,c=Fd(t,0,u,n,!0),h=[];if(c&&c.next!==c.prev){if(l&&(c=function(t,e,n,r){var i,o,a,s,l=[];for(i=0,o=e.length;i<o;i++)s=e[i]*r,a=i<o-1?e[i+1]*r:t.length,(s=Fd(t,s,a,r,!1))===s.next&&(s.steiner=!0),l.push(function(t){var e=t,n=t;for(;(e.x<n.x||e.x===n.x&&e.y<n.y)&&(n=e),e=e.next,e!==t;);return n}(s));for(l.sort(Wd),i=0;i<l.length;i++)n=function(t,e){var n=function(t,e){var n,r=e,i=t.x,o=t.y,a=-1/0;do{if(o<=r.y&&o>=r.next.y&&r.next.y!==r.y){var s=r.x+(o-r.y)*(r.next.x-r.x)/(r.next.y-r.y);if(s<=i&&a<s&&(a=s,n=r.x<r.next.x?r:r.next,s===i))return n}}while(r=r.next,r!==e);if(!n)return null;var l,u=n,c=n.x,h=n.y,d=1/0;r=n;for(;i>=r.x&&r.x>=c&&i!==r.x&&jd(o<h?i:a,o,c,h,o<h?a:i,o,r.x,r.y)&&(l=Math.abs(o-r.y)/(i-r.x),qd(r,t))&&(l<d||l===d&&(r.x>n.x||r.x===n.x&&function(t,e){return zd(t.prev,t,e.prev)<0&&zd(e.next,t,t.next)<0}(n,r)))&&(n=r,d=l),r=r.next,r!==u;);return n}(t,e);return n?(Ud(t=$d(n,t),t.next),Ud(n,n.next)):e}(l[i],n);return n}(t,e,c,n)),t.length>80*n){for(var d=r=t[0],f=i=t[1],p=n;p<u;p+=n)(o=t[p])<d&&(d=o),(a=t[p+1])<f&&(f=a),r<o&&(r=o),i<a&&(i=a);s=0!==(s=Math.max(r-d,i-f))?32767/s:0}Gd(c,h,n,d,f,s,0)}return h}function Fd(t,e,n,r,i){var o,a;if(i===0<tf(t,e,n,r))for(o=e;o<n;o+=r)a=Zd(o,t[o],t[o+1],a);else for(o=n-r;e<=o;o-=r)a=Zd(o,t[o],t[o+1],a);return a&&Hd(a,a.next)&&(Qd(a),a=a.next),a}function Ud(t,e){if(!t)return t;e=e||t;var n,r=t;do{if(n=!1,r.steiner||!Hd(r,r.next)&&0!==zd(r.prev,r,r.next))r=r.next;else{if(Qd(r),(r=e=r.prev)===r.next)break;n=!0}}while(n||r!==e);return e}function Gd(t,e,n,r,i,o,a){if(t){if(!a&&o){for(var s=t,l=r,u=i,c=o,h=s;0===h.z&&(h.z=Vd(h.x,h.y,l,u,c)),h.prevZ=h.prev,h.nextZ=h.next,(h=h.next)!==s;);h.prevZ.nextZ=null,h.prevZ=null;var d,f,p,g,m,v,y,E,_=h,b=1;do{for(f=_,m=_=null,v=0;f;){for(v++,p=f,d=y=0;d<b&&(y++,p=p.nextZ);d++);for(E=b;0<y||0<E&&p;)0!==y&&(0===E||!p||f.z<=p.z)?(f=(g=f).nextZ,y--):(p=(g=p).nextZ,E--),m?m.nextZ=g:_=g,g.prevZ=m,m=g;f=p}}while(m.nextZ=null,b*=2,1<v)}for(var x,S,w=t;t.prev!==t.next;)if(x=t.prev,S=t.next,o?function(t,e,n,r){var i=t.prev,o=t,a=t.next;if(0<=zd(i,o,a))return;var s=i.x,l=o.x,u=a.x,c=i.y,h=o.y,d=a.y,f=s<l?s<u?s:u:l<u?l:u,p=c<h?c<d?c:d:h<d?h:d,g=l<s?u<s?s:u:u<l?l:u,m=h<c?d<c?c:d:d<h?h:d,v=Vd(f,p,e,n,r),y=Vd(g,m,e,n,r),E=t.prevZ,_=t.nextZ;for(;E&&E.z>=v&&_&&_.z<=y;){if(E.x>=f&&E.x<=g&&E.y>=p&&E.y<=m&&E!==i&&E!==a&&jd(s,c,l,h,u,d,E.x,E.y)&&0<=zd(E.prev,E,E.next))return;if(E=E.prevZ,_.x>=f&&_.x<=g&&_.y>=p&&_.y<=m&&_!==i&&_!==a&&jd(s,c,l,h,u,d,_.x,_.y)&&0<=zd(_.prev,_,_.next))return;_=_.nextZ}for(;E&&E.z>=v;){if(E.x>=f&&E.x<=g&&E.y>=p&&E.y<=m&&E!==i&&E!==a&&jd(s,c,l,h,u,d,E.x,E.y)&&0<=zd(E.prev,E,E.next))return;E=E.prevZ}for(;_&&_.z<=y;){if(_.x>=f&&_.x<=g&&_.y>=p&&_.y<=m&&_!==i&&_!==a&&jd(s,c,l,h,u,d,_.x,_.y)&&0<=zd(_.prev,_,_.next))return;_=_.nextZ}return 1}(t,r,i,o):function(t){var e=t.prev,n=t,t=t.next;if(0<=zd(e,n,t))return;var r=e.x,i=n.x,o=t.x,a=e.y,s=n.y,l=t.y,u=r<i?r<o?r:o:i<o?i:o,c=a<s?a<l?a:l:s<l?s:l,h=i<r?o<r?r:o:o<i?i:o,d=s<a?l<a?a:l:l<s?s:l,f=t.next;for(;f!==e;){if(f.x>=u&&f.x<=h&&f.y>=c&&f.y<=d&&jd(r,a,i,s,o,l,f.x,f.y)&&0<=zd(f.prev,f,f.next))return;f=f.next}return 1}(t))e.push(x.i/n|0),e.push(t.i/n|0),e.push(S.i/n|0),Qd(t),t=S.next,w=S.next;else if((t=S)===w){a?1===a?Gd(t=function(t,e,n){var r=t;do{var i=r.prev,o=r.next.next}while(!Hd(i,o)&&Xd(i,r,r.next,o)&&qd(i,o)&&qd(o,i)&&(e.push(i.i/n|0),e.push(r.i/n|0),e.push(o.i/n|0),Qd(r),Qd(r.next),r=t=o),r=r.next,r!==t);return Ud(r)}(Ud(t),e,n),e,n,r,i,o,2):2===a&&function(t,e,n,r,i,o){var a=t;do{for(var s,l=a.next.next;l!==a.prev;){if(a.i!==l.i&&function(t,e){return t.next.i!==e.i&&t.prev.i!==e.i&&!function(t,e){var n=t;do{if(n.i!==t.i&&n.next.i!==t.i&&n.i!==e.i&&n.next.i!==e.i&&Xd(n,n.next,t,e))return 1}while(n=n.next,n!==t);return}(t,e)&&(qd(t,e)&&qd(e,t)&&function(t,e){var n=t,r=!1,i=(t.x+e.x)/2,o=(t.y+e.y)/2;for(;n.y>o!=n.next.y>o&&n.next.y!==n.y&&i<(n.next.x-n.x)*(o-n.y)/(n.next.y-n.y)+n.x&&(r=!r),n=n.next,n!==t;);return r}(t,e)&&(zd(t.prev,t,e.prev)||zd(t,e.prev,e))||Hd(t,e)&&0<zd(t.prev,t,t.next)&&0<zd(e.prev,e,e.next))}(a,l))return s=$d(a,l),a=Ud(a,a.next),s=Ud(s,s.next),Gd(a,e,n,r,i,o,0),Gd(s,e,n,r,i,o,0);l=l.next}}while(a=a.next,a!==t)}(t,e,n,r,i,o):Gd(Ud(t),e,n,r,i,o,1);break}}}function Wd(t,e){return t.x-e.x}function Vd(t,e,n,r,i){return(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=(t-n)*i|0)|t<<8))|t<<4))|t<<2))|t<<1))|(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=(e-r)*i|0)|e<<8))|e<<4))|e<<2))|e<<1))<<1}function jd(t,e,n,r,i,o,a,s){return(t-a)*(o-s)<=(i-a)*(e-s)&&(n-a)*(e-s)<=(t-a)*(r-s)&&(i-a)*(r-s)<=(n-a)*(o-s)}function zd(t,e,n){return(e.y-t.y)*(n.x-e.x)-(e.x-t.x)*(n.y-e.y)}function Hd(t,e){return t.x===e.x&&t.y===e.y}function Xd(t,e,n,r){var i=Kd(zd(t,e,n)),o=Kd(zd(t,e,r)),a=Kd(zd(n,r,t)),s=Kd(zd(n,r,e));return i!==o&&a!==s||0===i&&Yd(t,n,e)||0===o&&Yd(t,r,e)||0===a&&Yd(n,t,r)||!(0!==s||!Yd(n,e,r))}function Yd(t,e,n){return e.x<=Math.max(t.x,n.x)&&e.x>=Math.min(t.x,n.x)&&e.y<=Math.max(t.y,n.y)&&e.y>=Math.min(t.y,n.y)}function Kd(t){return 0<t?1:t<0?-1:0}function qd(t,e){return zd(t.prev,t,t.next)<0?0<=zd(t,e,t.next)&&0<=zd(t,t.prev,e):zd(t,e,t.prev)<0||zd(t,t.next,e)<0}function $d(t,e){var n=new Jd(t.i,t.x,t.y),r=new Jd(e.i,e.x,e.y),i=t.next,o=e.prev;return(t.next=e).prev=t,(n.next=i).prev=n,(r.next=n).prev=r,(o.next=r).prev=o,r}function Zd(t,e,n,r){t=new Jd(t,e,n);return r?(t.next=r.next,(t.prev=r).next.prev=t,r.next=t):(t.prev=t).next=t,t}function Qd(t){t.next.prev=t.prev,t.prev.next=t.next,t.prevZ&&(t.prevZ.nextZ=t.nextZ),t.nextZ&&(t.nextZ.prevZ=t.prevZ)}function Jd(t,e,n){this.i=t,this.x=e,this.y=n,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}function tf(t,e,n,r){for(var i=0,o=e,a=n-r;o<n;o+=r)i+=(t[a]-t[o])*(t[o+1]+t[a+1]),a=o;return i}function ef(){ef=function(){return a};var a={},t=Object.prototype,l=t.hasOwnProperty,u=Object.defineProperty||function(t,e,n){t[e]=n.value},e="function"==typeof Symbol?Symbol:{},r=e.iterator||"@@iterator",n=e.asyncIterator||"@@asyncIterator",i=e.toStringTag||"@@toStringTag";function o(t,e,n){return Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{o({},"")}catch(t){o=function(t,e,n){return t[e]=n}}function s(t,e,n,r){var i,o,a,s,e=e&&e.prototype instanceof d?e:d,e=Object.create(e.prototype),r=new b(r||[]);return u(e,"_invoke",{value:(i=t,o=n,a=r,s="suspendedStart",function(t,e){if("executing"===s)throw new Error("Generator is already running");if("completed"===s){if("throw"===t)throw e;return S()}for(a.method=t,a.arg=e;;){var n=a.delegate;if(n){n=function t(e,n){var r=n.method,i=e.iterator[r];if(void 0===i)return n.delegate=null,"throw"===r&&e.iterator.return&&(n.method="return",n.arg=void 0,t(e,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),h;r=c(i,e.iterator,n.arg);if("throw"===r.type)return n.method="throw",n.arg=r.arg,n.delegate=null,h;i=r.arg;return i?i.done?(n[e.resultName]=i.value,n.next=e.nextLoc,"return"!==n.method&&(n.method="next",n.arg=void 0),n.delegate=null,h):i:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,h)}(n,a);if(n){if(n===h)continue;return n}}if("next"===a.method)a.sent=a._sent=a.arg;else if("throw"===a.method){if("suspendedStart"===s)throw s="completed",a.arg;a.dispatchException(a.arg)}else"return"===a.method&&a.abrupt("return",a.arg);s="executing";n=c(i,o,a);if("normal"===n.type){if(s=a.done?"completed":"suspendedYield",n.arg===h)continue;return{value:n.arg,done:a.done}}"throw"===n.type&&(s="completed",a.method="throw",a.arg=n.arg)}})}),e}function c(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(t){return{type:"throw",arg:t}}}a.wrap=s;var h={};function d(){}function f(){}function p(){}var e={},g=(o(e,r,function(){return this}),Object.getPrototypeOf),g=g&&g(g(x([]))),m=(g&&g!==t&&l.call(g,r)&&(e=g),p.prototype=d.prototype=Object.create(e));function v(t){["next","throw","return"].forEach(function(e){o(t,e,function(t){return this._invoke(e,t)})})}function y(a,s){var e;u(this,"_invoke",{value:function(n,r){function t(){return new s(function(t,e){!function e(t,n,r,i){var o,t=c(a[t],a,n);if("throw"!==t.type)return(n=(o=t.arg).value)&&"object"==typeof n&&l.call(n,"__await")?s.resolve(n.__await).then(function(t){e("next",t,r,i)},function(t){e("throw",t,r,i)}):s.resolve(n).then(function(t){o.value=t,r(o)},function(t){return e("throw",t,r,i)});i(t.arg)}(n,r,t,e)})}return e=e?e.then(t,t):t()}})}function E(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function _(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function b(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(E,this),this.reset(!0)}function x(e){if(e){var n,t=e[r];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length))return n=-1,(t=function t(){for(;++n<e.length;)if(l.call(e,n))return t.value=e[n],t.done=!1,t;return t.value=void 0,t.done=!0,t}).next=t}return{next:S}}function S(){return{value:void 0,done:!0}}return u(m,"constructor",{value:f.prototype=p,configurable:!0}),u(p,"constructor",{value:f,configurable:!0}),f.displayName=o(p,i,"GeneratorFunction"),a.isGeneratorFunction=function(t){t="function"==typeof t&&t.constructor;return!!t&&(t===f||"GeneratorFunction"===(t.displayName||t.name))},a.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,p):(t.__proto__=p,o(t,i,"GeneratorFunction")),t.prototype=Object.create(m),t},a.awrap=function(t){return{__await:t}},v(y.prototype),o(y.prototype,n,function(){return this}),a.AsyncIterator=y,a.async=function(t,e,n,r,i){void 0===i&&(i=Promise);var o=new y(s(t,e,n,r),i);return a.isGeneratorFunction(e)?o:o.next().then(function(t){return t.done?t.value:o.next()})},v(m),o(m,i,"Generator"),o(m,r,function(){return this}),o(m,"toString",function(){return"[object Generator]"}),a.keys=function(t){var e,n=Object(t),r=[];for(e in n)r.push(e);return r.reverse(),function t(){for(;r.length;){var e=r.pop();if(e in n)return t.value=e,t.done=!1,t}return t.done=!0,t}},a.values=x,b.prototype={constructor:b,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(_),!t)for(var e in this)"t"===e.charAt(0)&&l.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=void 0)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(n){if(this.done)throw n;var r=this;function t(t,e){return o.type="throw",o.arg=n,r.next=t,e&&(r.method="next",r.arg=void 0),!!e}for(var e=this.tryEntries.length-1;0<=e;--e){var i=this.tryEntries[e],o=i.completion;if("root"===i.tryLoc)return t("end");if(i.tryLoc<=this.prev){var a=l.call(i,"catchLoc"),s=l.call(i,"finallyLoc");if(a&&s){if(this.prev<i.catchLoc)return t(i.catchLoc,!0);if(this.prev<i.finallyLoc)return t(i.finallyLoc)}else if(a){if(this.prev<i.catchLoc)return t(i.catchLoc,!0)}else{if(!s)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return t(i.finallyLoc)}}}},abrupt:function(t,e){for(var n=this.tryEntries.length-1;0<=n;--n){var r=this.tryEntries[n];if(r.tryLoc<=this.prev&&l.call(r,"finallyLoc")&&this.prev<r.finallyLoc){var i=r;break}}var o=(i=i&&("break"===t||"continue"===t)&&i.tryLoc<=e&&e<=i.finallyLoc?null:i)?i.completion:{};return o.type=t,o.arg=e,i?(this.method="next",this.next=i.finallyLoc,h):this.complete(o)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),h},finish:function(t){for(var e=this.tryEntries.length-1;0<=e;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),_(n),h}},catch:function(t){for(var e=this.tryEntries.length-1;0<=e;--e){var n,r,i=this.tryEntries[e];if(i.tryLoc===t)return"throw"===(n=i.completion).type&&(r=n.arg,_(i)),r}throw new Error("illegal catch attempt")},delegateYield:function(t,e,n){return this.delegate={iterator:x(t),resultName:e,nextLoc:n},"next"===this.method&&(this.arg=void 0),h}},a}function nf(t,e,n,r,i,o,a){try{var s=t[o](a),l=s.value}catch(t){return void n(t)}s.done?e(l):Promise.resolve(l).then(r,i)}function rf(s){return function(){var t=this,a=arguments;return new Promise(function(e,n){var r=s.apply(t,a);function i(t){nf(r,e,n,i,o,"next",t)}function o(t){nf(r,e,n,i,o,"throw",t)}i(void 0)})}}function of(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,function(t){t=function(t,e){if("object"!=typeof t||null===t)return t;var n=t[Symbol.toPrimitive];if(void 0===n)return("string"===e?String:Number)(t);n=n.call(t,e||"default");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}(t,"string");return"symbol"==typeof t?t:String(t)}(r.key),r)}}function af(t,e,n){e&&of(t.prototype,e),n&&of(t,n),Object.defineProperty(t,"prototype",{writable:!1})}function sf(){return(sf=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n,r=arguments[e];for(n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t}).apply(this,arguments)}function lf(t,e){t.prototype=Object.create(e.prototype),uf(t.prototype.constructor=t,e)}function uf(t,e){return(uf=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t})(t,e)}function cf(t,e){if(null==t)return{};for(var n,r={},i=Object.keys(t),o=0;o<i.length;o++)n=i[o],0<=e.indexOf(n)||(r[n]=t[n]);return r}function hf(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function df(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}function ff(t,e){var n,r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(r)return(r=r.call(t)).next.bind(r);if(Array.isArray(t)||(r=function(t,e){var n;if(t)return"string"==typeof t?df(t,e):"Map"===(n="Object"===(n=Object.prototype.toString.call(t).slice(8,-1))&&t.constructor?t.constructor.name:n)||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?df(t,e):void 0}(t))||e&&t&&"number"==typeof t.length)return r&&(t=r),n=0,function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}};throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}Bd.deviation=function(t,e,n,r){var i=e&&e.length,o=i?e[0]*n:t.length,a=Math.abs(tf(t,0,o,n));if(i)for(var s=0,l=e.length;s<l;s++){var u=e[s]*n,c=s<l-1?e[s+1]*n:t.length;a-=Math.abs(tf(t,u,c,n))}for(var h=0,s=0;s<r.length;s+=3){var d=r[s]*n,f=r[s+1]*n,p=r[s+2]*n;h+=Math.abs((t[d]-t[p])*(t[1+f]-t[1+d])-(t[d]-t[f])*(t[1+p]-t[1+d]))}return 0===a&&0===h?0:Math.abs((h-a)/a)},Bd.flatten=function(t){for(var e=t[0][0].length,n={vertices:[],holes:[],dimensions:e},r=0,i=0;i<t.length;i++){for(var o=0;o<t[i].length;o++)for(var a=0;a<e;a++)n.vertices.push(t[i][o][a]);0<i&&(r+=t[i-1].length,n.holes.push(r))}return n},Dd.default=pa;function pf(){this.pickingId=void 0,this.encodedPickingColor=void 0,this.meshes=[]}pf.tag="c-renderable-3d";var gf,mf,vf,yf,Ef,_f,bf,xf,Sf,wf,Tf,Af,Mf,Rf,Nf,Cf,Pf,Of,If,Lf,kf,u,c,h,S,w,Df=function(){function t(){this.lights=[],this.fog=void 0}var e=t.prototype;return e.addLight=function(t){this.lights.push(t),this.sortLights()},e.removeLight=function(t){t=this.lights.indexOf(t);this.lights.splice(t,1),this.sortLights()},e.addFog=function(t){this.fog=t},e.removeFog=function(t){this.fog=null},e.getFog=function(){return this.fog},e.getAllLights=function(){return this.lights},e.getDefines=function(){var e={USE_LIGHT:!!this.lights.length};return this.lights.forEach(function(t){e[t.define]||(e[t.define]=0),e[t.define]++}),e},e.sortLights=function(){this.lights.sort(function(t,e){return t.order-e.order})},t}(),Bf=["style"],Ff=function(n){function t(t){var e=t.style,t=cf(t,Bf),e=n.call(this,sf({type:lt.MESH,style:sf({x:"",y:"",z:"",lineWidth:0,anchor:[.5,.5,.5]},e)},t))||this;return e.cullable.enable=!1,e.style.geometry.meshes.push(hf(e)),e.style.material.meshes.push(hf(e)),e}return lf(t,n),t.prototype.destroy=function(){n.prototype.destroy.call(this);var t=this.style.geometry.meshes,e=t.indexOf(this);t.splice(e,1),e=(t=this.style.material.meshes).indexOf(this),t.splice(e,1)},t}(as),Uf=function(){function t(){}return t.prototype.update=function(t){var t=t.geometry.computeBoundingBox(),e=t.getMax(),t=t.getMin();return{width:e[0]-t[0],height:e[1]-t[1],depth:e[2]-t[2]}},t}(),Gf=function(){function t(){this.counter=0,this.id2DisplayObjectMap={}}var e=t.prototype;return e.getId=function(t){var e=this.counter++;return this.id2DisplayObjectMap[e]=t,e},e.getById=function(t){return this.id2DisplayObjectMap[t]},e.reset=function(){this.counter=0,this.id2DisplayObjectMap={}},e.decodePickingColor=function(t){return t[0]+256*t[1]+65536*t[2]-1},e.encodePickingColor=function(t){return[t+1&255,t+1>>8&255,t+1>>8>>8&255]},t}();function Wf(t,e,n,r){return{dimension:Rf.n2D,pixelFormat:t,width:e,height:n,depth:1,numLevels:r,usage:Nf.Sampled}}function g(t,e,n){return t<<16|e<<8|n}function Vf(t){return t>>>8&255}function jf(t){return t>>>16&255}function zf(t){switch(jf(t)){case u.F32:case u.U32:case u.S32:return 4;case u.U16:case u.S16:case u.F16:return 2;case u.U8:case u.S8:return 1;default:throw new Error("whoops")}}function T(t,e){if(void 0===e&&(e=""),!t)throw console.error((new Error).stack),new Error("Assert fail: "+e)}function Hf(t){if(null!=t)return t;throw new Error("Missing object")}function Xf(t,e){return t.r===e.r&&t.g===e.g&&t.b===e.b&&t.a===e.a}function Yf(t,e){t.r=e.r,t.g=e.g,t.b=e.b,t.a=e.a}function Kf(t){return{r:t.r,g:t.g,b:t.b,a:t.a}}function qf(t,e,n,r){return{r:t,g:e,b:n,a:r=void 0===r?1:r}}(l=gf=gf||{})[l.Buffer=0]="Buffer",l[l.Texture=1]="Texture",l[l.RenderTarget=2]="RenderTarget",l[l.Sampler=3]="Sampler",l[l.Program=4]="Program",l[l.Bindings=5]="Bindings",l[l.InputLayout=6]="InputLayout",l[l.InputState=7]="InputState",l[l.RenderPipeline=8]="RenderPipeline",l[l.ComputePipeline=9]="ComputePipeline",l[l.Readback=10]="Readback",l[l.QueryPool=11]="QueryPool",(Ea=mf=mf||{})[Ea.Never=512]="Never",Ea[Ea.Less=513]="Less",Ea[Ea.Equal=514]="Equal",Ea[Ea.LessEqual=515]="LessEqual",Ea[Ea.Greater=516]="Greater",Ea[Ea.NotEqual=517]="NotEqual",Ea[Ea.GreaterEqual=518]="GreaterEqual",Ea[Ea.Always=519]="Always",(_a=mT=mT||{})[_a.CCW=2305]="CCW",_a[_a.CW=2304]="CW",(ba=vf=vf||{})[ba.None=0]="None",ba[ba.Front=1]="Front",ba[ba.Back=2]="Back",ba[ba.FrontAndBack=3]="FrontAndBack",(r=yf=yf||{})[r.Zero=0]="Zero",r[r.One=1]="One",r[r.Src=768]="Src",r[r.OneMinusSrc=769]="OneMinusSrc",r[r.Dst=774]="Dst",r[r.OneMinusDst=775]="OneMinusDst",r[r.SrcAlpha=770]="SrcAlpha",r[r.OneMinusSrcAlpha=771]="OneMinusSrcAlpha",r[r.DstAlpha=772]="DstAlpha",r[r.OneMinusDstAlpha=773]="OneMinusDstAlpha",(wa=Ef=Ef||{})[wa.Add=32774]="Add",wa[wa.Subtract=32778]="Subtract",wa[wa.ReverseSubtract=32779]="ReverseSubtract",(Ca=_f=_f||{})[Ca.Clamp=0]="Clamp",Ca[Ca.Repeat=1]="Repeat",Ca[Ca.Mirror=2]="Mirror",(Pa=bf=bf||{})[Pa.Point=0]="Point",Pa[Pa.Bilinear=1]="Bilinear",(Oa=xf=xf||{})[Oa.NoMip=0]="NoMip",Oa[Oa.Nearest=1]="Nearest",Oa[Oa.Linear=2]="Linear",(Ia=Sf=Sf||{})[Ia.Points=0]="Points",Ia[Ia.Triangles=1]="Triangles",Ia[Ia.TriangleStrip=2]="TriangleStrip",Ia[Ia.Lines=3]="Lines",Ia[Ia.LineStrip=4]="LineStrip",(La=wf=wf||{})[La.MAP_READ=1]="MAP_READ",La[La.MAP_WRITE=2]="MAP_WRITE",La[La.COPY_SRC=4]="COPY_SRC",La[La.COPY_DST=8]="COPY_DST",La[La.INDEX=16]="INDEX",La[La.VERTEX=32]="VERTEX",La[La.UNIFORM=64]="UNIFORM",La[La.STORAGE=128]="STORAGE",La[La.INDIRECT=256]="INDIRECT",La[La.QUERY_RESOLVE=512]="QUERY_RESOLVE",(ka=Tf=Tf||{})[ka.Static=1]="Static",ka[ka.Dynamic=2]="Dynamic",(Da=Af=Af||{})[Da.PerVertex=1]="PerVertex",Da[Da.PerInstance=2]="PerInstance",(Mf=Mf||{}).LOADED="loaded",(b=Rf=Rf||{})[b.n2D=0]="n2D",b[b.n2DArray=1]="n2DArray",b[b.n3D=2]="n3D",b[b.Cube=3]="Cube",(xa=Nf=Nf||{})[xa.Sampled=1]="Sampled",xa[xa.RenderTarget=2]="RenderTarget",(a=Cf=Cf||{})[a.None=0]="None",a[a.Red=1]="Red",a[a.Green=2]="Green",a[a.Blue=4]="Blue",a[a.Alpha=8]="Alpha",a[a.RGB=7]="RGB",a[a.AllChannels=15]="AllChannels",(zs=Pf=Pf||{})[zs.Keep=7680]="Keep",zs[zs.Zero=0]="Zero",zs[zs.Replace=7681]="Replace",zs[zs.Invert=5386]="Invert",zs[zs.IncrementClamp=7682]="IncrementClamp",zs[zs.DecrementClamp=7683]="DecrementClamp",zs[zs.IncrementWrap=34055]="IncrementWrap",zs[zs.DecrementWrap=34056]="DecrementWrap",(Ys=Of=Of||{})[Ys.Float=0]="Float",Ys[Ys.Uint=1]="Uint",Ys[Ys.Sint=2]="Sint",Ys[Ys.Depth=3]="Depth",(Zs=If=If||{})[Zs.LowerLeft=0]="LowerLeft",Zs[Zs.UpperLeft=1]="UpperLeft",(nl=Lf=Lf||{})[nl.NegativeOne=0]="NegativeOne",nl[nl.Zero=1]="Zero",kf=kf||{},kf[kf.OcclusionConservative=0]="OcclusionConservative",(o=u=u||{})[o.U8=1]="U8",o[o.U16=2]="U16",o[o.U32=3]="U32",o[o.S8=4]="S8",o[o.S16=5]="S16",o[o.S32=6]="S32",o[o.F16=7]="F16",o[o.F32=8]="F32",o[o.BC1=65]="BC1",o[o.BC2=66]="BC2",o[o.BC3=67]="BC3",o[o.BC4_UNORM=68]="BC4_UNORM",o[o.BC4_SNORM=69]="BC4_SNORM",o[o.BC5_UNORM=70]="BC5_UNORM",o[o.BC5_SNORM=71]="BC5_SNORM",o[o.U16_PACKED_5551=97]="U16_PACKED_5551",o[o.D24=129]="D24",o[o.D32F=130]="D32F",o[o.D24S8=131]="D24S8",o[o.D32FS8=132]="D32FS8",(Vs=c=c||{})[Vs.R=1]="R",Vs[Vs.RG=2]="RG",Vs[Vs.RGB=3]="RGB",Vs[Vs.RGBA=4]="RGBA",Vs[Vs.A=5]="A",(ks=h=h||{})[ks.None=0]="None",ks[ks.Normalized=1]="Normalized",ks[ks.sRGB=2]="sRGB",ks[ks.Depth=4]="Depth",ks[ks.Stencil=8]="Stencil",ks[ks.RenderTarget=16]="RenderTarget",(E=S=S||{})[E.ALPHA=g(u.U8,c.A,h.None)]="ALPHA",E[E.F16_R=g(u.F16,c.R,h.None)]="F16_R",E[E.F16_RG=g(u.F16,c.RG,h.None)]="F16_RG",E[E.F16_RGB=g(u.F16,c.RGB,h.None)]="F16_RGB",E[E.F16_RGBA=g(u.F16,c.RGBA,h.None)]="F16_RGBA",E[E.F32_R=g(u.F32,c.R,h.None)]="F32_R",E[E.F32_RG=g(u.F32,c.RG,h.None)]="F32_RG",E[E.F32_RGB=g(u.F32,c.RGB,h.None)]="F32_RGB",E[E.F32_RGBA=g(u.F32,c.RGBA,h.None)]="F32_RGBA",E[E.U8_R=g(u.U8,c.R,h.None)]="U8_R",E[E.U8_R_NORM=g(u.U8,c.R,h.Normalized)]="U8_R_NORM",E[E.U8_RG=g(u.U8,c.RG,h.None)]="U8_RG",E[E.U8_RG_NORM=g(u.U8,c.RG,h.Normalized)]="U8_RG_NORM",E[E.U8_RGB=g(u.U8,c.RGB,h.None)]="U8_RGB",E[E.U8_RGB_NORM=g(u.U8,c.RGB,h.Normalized)]="U8_RGB_NORM",E[E.U8_RGB_SRGB=g(u.U8,c.RGB,h.sRGB|h.Normalized)]="U8_RGB_SRGB",E[E.U8_RGBA=g(u.U8,c.RGBA,h.None)]="U8_RGBA",E[E.U8_RGBA_NORM=g(u.U8,c.RGBA,h.Normalized)]="U8_RGBA_NORM",E[E.U8_RGBA_SRGB=g(u.U8,c.RGBA,h.sRGB|h.Normalized)]="U8_RGBA_SRGB",E[E.U16_R=g(u.U16,c.R,h.None)]="U16_R",E[E.U16_R_NORM=g(u.U16,c.R,h.Normalized)]="U16_R_NORM",E[E.U16_RG_NORM=g(u.U16,c.RG,h.Normalized)]="U16_RG_NORM",E[E.U16_RGBA_NORM=g(u.U16,c.RGBA,h.Normalized)]="U16_RGBA_NORM",E[E.U16_RGB=g(u.U16,c.RGB,h.None)]="U16_RGB",E[E.U32_R=g(u.U32,c.R,h.None)]="U32_R",E[E.U32_RG=g(u.U32,c.RG,h.None)]="U32_RG",E[E.S8_R=g(u.S8,c.R,h.None)]="S8_R",E[E.S8_R_NORM=g(u.S8,c.R,h.Normalized)]="S8_R_NORM",E[E.S8_RG_NORM=g(u.S8,c.RG,h.Normalized)]="S8_RG_NORM",E[E.S8_RGB_NORM=g(u.S8,c.RGB,h.Normalized)]="S8_RGB_NORM",E[E.S8_RGBA_NORM=g(u.S8,c.RGBA,h.Normalized)]="S8_RGBA_NORM",E[E.S16_R=g(u.S16,c.R,h.None)]="S16_R",E[E.S16_RG=g(u.S16,c.RG,h.None)]="S16_RG",E[E.S16_RG_NORM=g(u.S16,c.RG,h.Normalized)]="S16_RG_NORM",E[E.S16_RGB_NORM=g(u.S16,c.RGB,h.Normalized)]="S16_RGB_NORM",E[E.S16_RGBA=g(u.S16,c.RGBA,h.None)]="S16_RGBA",E[E.S16_RGBA_NORM=g(u.S16,c.RGBA,h.Normalized)]="S16_RGBA_NORM",E[E.S32_R=g(u.S32,c.R,h.None)]="S32_R",E[E.U16_RGBA_5551=g(u.U16_PACKED_5551,c.RGBA,h.Normalized)]="U16_RGBA_5551",E[E.BC1=g(u.BC1,c.RGBA,h.Normalized)]="BC1",E[E.BC1_SRGB=g(u.BC1,c.RGBA,h.Normalized|h.sRGB)]="BC1_SRGB",E[E.BC2=g(u.BC2,c.RGBA,h.Normalized)]="BC2",E[E.BC2_SRGB=g(u.BC2,c.RGBA,h.Normalized|h.sRGB)]="BC2_SRGB",E[E.BC3=g(u.BC3,c.RGBA,h.Normalized)]="BC3",E[E.BC3_SRGB=g(u.BC3,c.RGBA,h.Normalized|h.sRGB)]="BC3_SRGB",E[E.BC4_UNORM=g(u.BC4_UNORM,c.R,h.Normalized)]="BC4_UNORM",E[E.BC4_SNORM=g(u.BC4_SNORM,c.R,h.Normalized)]="BC4_SNORM",E[E.BC5_UNORM=g(u.BC5_UNORM,c.RG,h.Normalized)]="BC5_UNORM",E[E.BC5_SNORM=g(u.BC5_SNORM,c.RG,h.Normalized)]="BC5_SNORM",E[E.D24=g(u.D24,c.R,h.Depth)]="D24",E[E.D24_S8=g(u.D24S8,c.RG,h.Depth|h.Stencil)]="D24_S8",E[E.D32F=g(u.D32F,c.R,h.Depth)]="D32F",E[E.D32F_S8=g(u.D32FS8,c.RG,h.Depth|h.Stencil)]="D32F_S8",E[E.U8_RGB_RT=g(u.U8,c.RGB,h.RenderTarget|h.Normalized)]="U8_RGB_RT",E[E.U8_RGBA_RT=g(u.U8,c.RGBA,h.RenderTarget|h.Normalized)]="U8_RGBA_RT",E[E.U8_RGBA_RT_SRGB=g(u.U8,c.RGBA,h.RenderTarget|h.Normalized|h.sRGB)]="U8_RGBA_RT_SRGB",(i=w=w||{})[i.DEPTH_BUFFER_BIT=256]="DEPTH_BUFFER_BIT",i[i.STENCIL_BUFFER_BIT=1024]="STENCIL_BUFFER_BIT",i[i.COLOR_BUFFER_BIT=16384]="COLOR_BUFFER_BIT",i[i.POINTS=0]="POINTS",i[i.LINES=1]="LINES",i[i.LINE_LOOP=2]="LINE_LOOP",i[i.LINE_STRIP=3]="LINE_STRIP",i[i.TRIANGLES=4]="TRIANGLES",i[i.TRIANGLE_STRIP=5]="TRIANGLE_STRIP",i[i.TRIANGLE_FAN=6]="TRIANGLE_FAN",i[i.ZERO=0]="ZERO",i[i.ONE=1]="ONE",i[i.SRC_COLOR=768]="SRC_COLOR",i[i.ONE_MINUS_SRC_COLOR=769]="ONE_MINUS_SRC_COLOR",i[i.SRC_ALPHA=770]="SRC_ALPHA",i[i.ONE_MINUS_SRC_ALPHA=771]="ONE_MINUS_SRC_ALPHA",i[i.DST_ALPHA=772]="DST_ALPHA",i[i.ONE_MINUS_DST_ALPHA=773]="ONE_MINUS_DST_ALPHA",i[i.DST_COLOR=774]="DST_COLOR",i[i.ONE_MINUS_DST_COLOR=775]="ONE_MINUS_DST_COLOR",i[i.SRC_ALPHA_SATURATE=776]="SRC_ALPHA_SATURATE",i[i.CONSTANT_COLOR=32769]="CONSTANT_COLOR",i[i.ONE_MINUS_CONSTANT_COLOR=32770]="ONE_MINUS_CONSTANT_COLOR",i[i.CONSTANT_ALPHA=32771]="CONSTANT_ALPHA",i[i.ONE_MINUS_CONSTANT_ALPHA=32772]="ONE_MINUS_CONSTANT_ALPHA",i[i.FUNC_ADD=32774]="FUNC_ADD",i[i.FUNC_SUBTRACT=32778]="FUNC_SUBTRACT",i[i.FUNC_REVERSE_SUBTRACT=32779]="FUNC_REVERSE_SUBTRACT",i[i.BLEND_EQUATION=32777]="BLEND_EQUATION",i[i.BLEND_EQUATION_RGB=32777]="BLEND_EQUATION_RGB",i[i.BLEND_EQUATION_ALPHA=34877]="BLEND_EQUATION_ALPHA",i[i.BLEND_DST_RGB=32968]="BLEND_DST_RGB",i[i.BLEND_SRC_RGB=32969]="BLEND_SRC_RGB",i[i.BLEND_DST_ALPHA=32970]="BLEND_DST_ALPHA",i[i.BLEND_SRC_ALPHA=32971]="BLEND_SRC_ALPHA",i[i.BLEND_COLOR=32773]="BLEND_COLOR",i[i.ARRAY_BUFFER_BINDING=34964]="ARRAY_BUFFER_BINDING",i[i.ELEMENT_ARRAY_BUFFER_BINDING=34965]="ELEMENT_ARRAY_BUFFER_BINDING",i[i.LINE_WIDTH=2849]="LINE_WIDTH",i[i.ALIASED_POINT_SIZE_RANGE=33901]="ALIASED_POINT_SIZE_RANGE",i[i.ALIASED_LINE_WIDTH_RANGE=33902]="ALIASED_LINE_WIDTH_RANGE",i[i.CULL_FACE_MODE=2885]="CULL_FACE_MODE",i[i.FRONT_FACE=2886]="FRONT_FACE",i[i.DEPTH_RANGE=2928]="DEPTH_RANGE",i[i.DEPTH_WRITEMASK=2930]="DEPTH_WRITEMASK",i[i.DEPTH_CLEAR_VALUE=2931]="DEPTH_CLEAR_VALUE",i[i.DEPTH_FUNC=2932]="DEPTH_FUNC",i[i.STENCIL_CLEAR_VALUE=2961]="STENCIL_CLEAR_VALUE",i[i.STENCIL_FUNC=2962]="STENCIL_FUNC",i[i.STENCIL_FAIL=2964]="STENCIL_FAIL",i[i.STENCIL_PASS_DEPTH_FAIL=2965]="STENCIL_PASS_DEPTH_FAIL",i[i.STENCIL_PASS_DEPTH_PASS=2966]="STENCIL_PASS_DEPTH_PASS",i[i.STENCIL_REF=2967]="STENCIL_REF",i[i.STENCIL_VALUE_MASK=2963]="STENCIL_VALUE_MASK",i[i.STENCIL_WRITEMASK=2968]="STENCIL_WRITEMASK",i[i.STENCIL_BACK_FUNC=34816]="STENCIL_BACK_FUNC",i[i.STENCIL_BACK_FAIL=34817]="STENCIL_BACK_FAIL",i[i.STENCIL_BACK_PASS_DEPTH_FAIL=34818]="STENCIL_BACK_PASS_DEPTH_FAIL",i[i.STENCIL_BACK_PASS_DEPTH_PASS=34819]="STENCIL_BACK_PASS_DEPTH_PASS",i[i.STENCIL_BACK_REF=36003]="STENCIL_BACK_REF",i[i.STENCIL_BACK_VALUE_MASK=36004]="STENCIL_BACK_VALUE_MASK",i[i.STENCIL_BACK_WRITEMASK=36005]="STENCIL_BACK_WRITEMASK",i[i.VIEWPORT=2978]="VIEWPORT",i[i.SCISSOR_BOX=3088]="SCISSOR_BOX",i[i.COLOR_CLEAR_VALUE=3106]="COLOR_CLEAR_VALUE",i[i.COLOR_WRITEMASK=3107]="COLOR_WRITEMASK",i[i.UNPACK_ALIGNMENT=3317]="UNPACK_ALIGNMENT",i[i.PACK_ALIGNMENT=3333]="PACK_ALIGNMENT",i[i.MAX_TEXTURE_SIZE=3379]="MAX_TEXTURE_SIZE",i[i.MAX_VIEWPORT_DIMS=3386]="MAX_VIEWPORT_DIMS",i[i.SUBPIXEL_BITS=3408]="SUBPIXEL_BITS",i[i.RED_BITS=3410]="RED_BITS",i[i.GREEN_BITS=3411]="GREEN_BITS",i[i.BLUE_BITS=3412]="BLUE_BITS",i[i.ALPHA_BITS=3413]="ALPHA_BITS",i[i.DEPTH_BITS=3414]="DEPTH_BITS",i[i.STENCIL_BITS=3415]="STENCIL_BITS",i[i.POLYGON_OFFSET_UNITS=10752]="POLYGON_OFFSET_UNITS",i[i.POLYGON_OFFSET_FACTOR=32824]="POLYGON_OFFSET_FACTOR",i[i.TEXTURE_BINDING_2D=32873]="TEXTURE_BINDING_2D",i[i.SAMPLE_BUFFERS=32936]="SAMPLE_BUFFERS",i[i.SAMPLES=32937]="SAMPLES",i[i.SAMPLE_COVERAGE_VALUE=32938]="SAMPLE_COVERAGE_VALUE",i[i.SAMPLE_COVERAGE_INVERT=32939]="SAMPLE_COVERAGE_INVERT",i[i.COMPRESSED_TEXTURE_FORMATS=34467]="COMPRESSED_TEXTURE_FORMATS",i[i.VENDOR=7936]="VENDOR",i[i.RENDERER=7937]="RENDERER",i[i.VERSION=7938]="VERSION",i[i.IMPLEMENTATION_COLOR_READ_TYPE=35738]="IMPLEMENTATION_COLOR_READ_TYPE",i[i.IMPLEMENTATION_COLOR_READ_FORMAT=35739]="IMPLEMENTATION_COLOR_READ_FORMAT",i[i.BROWSER_DEFAULT_WEBGL=37444]="BROWSER_DEFAULT_WEBGL",i[i.STATIC_DRAW=35044]="STATIC_DRAW",i[i.STREAM_DRAW=35040]="STREAM_DRAW",i[i.DYNAMIC_DRAW=35048]="DYNAMIC_DRAW",i[i.ARRAY_BUFFER=34962]="ARRAY_BUFFER",i[i.ELEMENT_ARRAY_BUFFER=34963]="ELEMENT_ARRAY_BUFFER",i[i.BUFFER_SIZE=34660]="BUFFER_SIZE",i[i.BUFFER_USAGE=34661]="BUFFER_USAGE",i[i.CURRENT_VERTEX_ATTRIB=34342]="CURRENT_VERTEX_ATTRIB",i[i.VERTEX_ATTRIB_ARRAY_ENABLED=34338]="VERTEX_ATTRIB_ARRAY_ENABLED",i[i.VERTEX_ATTRIB_ARRAY_SIZE=34339]="VERTEX_ATTRIB_ARRAY_SIZE",i[i.VERTEX_ATTRIB_ARRAY_STRIDE=34340]="VERTEX_ATTRIB_ARRAY_STRIDE",i[i.VERTEX_ATTRIB_ARRAY_TYPE=34341]="VERTEX_ATTRIB_ARRAY_TYPE",i[i.VERTEX_ATTRIB_ARRAY_NORMALIZED=34922]="VERTEX_ATTRIB_ARRAY_NORMALIZED",i[i.VERTEX_ATTRIB_ARRAY_POINTER=34373]="VERTEX_ATTRIB_ARRAY_POINTER",i[i.VERTEX_ATTRIB_ARRAY_BUFFER_BINDING=34975]="VERTEX_ATTRIB_ARRAY_BUFFER_BINDING",i[i.CULL_FACE=2884]="CULL_FACE",i[i.FRONT=1028]="FRONT",i[i.BACK=1029]="BACK",i[i.FRONT_AND_BACK=1032]="FRONT_AND_BACK",i[i.BLEND=3042]="BLEND",i[i.DEPTH_TEST=2929]="DEPTH_TEST",i[i.DITHER=3024]="DITHER",i[i.POLYGON_OFFSET_FILL=32823]="POLYGON_OFFSET_FILL",i[i.SAMPLE_ALPHA_TO_COVERAGE=32926]="SAMPLE_ALPHA_TO_COVERAGE",i[i.SAMPLE_COVERAGE=32928]="SAMPLE_COVERAGE",i[i.SCISSOR_TEST=3089]="SCISSOR_TEST",i[i.STENCIL_TEST=2960]="STENCIL_TEST",i[i.NO_ERROR=0]="NO_ERROR",i[i.INVALID_ENUM=1280]="INVALID_ENUM",i[i.INVALID_VALUE=1281]="INVALID_VALUE",i[i.INVALID_OPERATION=1282]="INVALID_OPERATION",i[i.OUT_OF_MEMORY=1285]="OUT_OF_MEMORY",i[i.CONTEXT_LOST_WEBGL=37442]="CONTEXT_LOST_WEBGL",i[i.CW=2304]="CW",i[i.CCW=2305]="CCW",i[i.DONT_CARE=4352]="DONT_CARE",i[i.FASTEST=4353]="FASTEST",i[i.NICEST=4354]="NICEST",i[i.GENERATE_MIPMAP_HINT=33170]="GENERATE_MIPMAP_HINT",i[i.BYTE=5120]="BYTE",i[i.UNSIGNED_BYTE=5121]="UNSIGNED_BYTE",i[i.SHORT=5122]="SHORT",i[i.UNSIGNED_SHORT=5123]="UNSIGNED_SHORT",i[i.INT=5124]="INT",i[i.UNSIGNED_INT=5125]="UNSIGNED_INT",i[i.FLOAT=5126]="FLOAT",i[i.DOUBLE=5130]="DOUBLE",i[i.DEPTH_COMPONENT=6402]="DEPTH_COMPONENT",i[i.ALPHA=6406]="ALPHA",i[i.RGB=6407]="RGB",i[i.RGBA=6408]="RGBA",i[i.LUMINANCE=6409]="LUMINANCE",i[i.LUMINANCE_ALPHA=6410]="LUMINANCE_ALPHA",i[i.UNSIGNED_SHORT_4_4_4_4=32819]="UNSIGNED_SHORT_4_4_4_4",i[i.UNSIGNED_SHORT_5_5_5_1=32820]="UNSIGNED_SHORT_5_5_5_1",i[i.UNSIGNED_SHORT_5_6_5=33635]="UNSIGNED_SHORT_5_6_5",i[i.FRAGMENT_SHADER=35632]="FRAGMENT_SHADER",i[i.VERTEX_SHADER=35633]="VERTEX_SHADER",i[i.COMPILE_STATUS=35713]="COMPILE_STATUS",i[i.DELETE_STATUS=35712]="DELETE_STATUS",i[i.LINK_STATUS=35714]="LINK_STATUS",i[i.VALIDATE_STATUS=35715]="VALIDATE_STATUS",i[i.ATTACHED_SHADERS=35717]="ATTACHED_SHADERS",i[i.ACTIVE_ATTRIBUTES=35721]="ACTIVE_ATTRIBUTES",i[i.ACTIVE_UNIFORMS=35718]="ACTIVE_UNIFORMS",i[i.MAX_VERTEX_ATTRIBS=34921]="MAX_VERTEX_ATTRIBS",i[i.MAX_VERTEX_UNIFORM_VECTORS=36347]="MAX_VERTEX_UNIFORM_VECTORS",i[i.MAX_VARYING_VECTORS=36348]="MAX_VARYING_VECTORS",i[i.MAX_COMBINED_TEXTURE_IMAGE_UNITS=35661]="MAX_COMBINED_TEXTURE_IMAGE_UNITS",i[i.MAX_VERTEX_TEXTURE_IMAGE_UNITS=35660]="MAX_VERTEX_TEXTURE_IMAGE_UNITS",i[i.MAX_TEXTURE_IMAGE_UNITS=34930]="MAX_TEXTURE_IMAGE_UNITS",i[i.MAX_FRAGMENT_UNIFORM_VECTORS=36349]="MAX_FRAGMENT_UNIFORM_VECTORS",i[i.SHADER_TYPE=35663]="SHADER_TYPE",i[i.SHADING_LANGUAGE_VERSION=35724]="SHADING_LANGUAGE_VERSION",i[i.CURRENT_PROGRAM=35725]="CURRENT_PROGRAM",i[i.NEVER=512]="NEVER",i[i.ALWAYS=519]="ALWAYS",i[i.LESS=513]="LESS",i[i.EQUAL=514]="EQUAL",i[i.LEQUAL=515]="LEQUAL",i[i.GREATER=516]="GREATER",i[i.GEQUAL=518]="GEQUAL",i[i.NOTEQUAL=517]="NOTEQUAL",i[i.KEEP=7680]="KEEP",i[i.REPLACE=7681]="REPLACE",i[i.INCR=7682]="INCR",i[i.DECR=7683]="DECR",i[i.INVERT=5386]="INVERT",i[i.INCR_WRAP=34055]="INCR_WRAP",i[i.DECR_WRAP=34056]="DECR_WRAP",i[i.NEAREST=9728]="NEAREST",i[i.LINEAR=9729]="LINEAR",i[i.NEAREST_MIPMAP_NEAREST=9984]="NEAREST_MIPMAP_NEAREST",i[i.LINEAR_MIPMAP_NEAREST=9985]="LINEAR_MIPMAP_NEAREST",i[i.NEAREST_MIPMAP_LINEAR=9986]="NEAREST_MIPMAP_LINEAR",i[i.LINEAR_MIPMAP_LINEAR=9987]="LINEAR_MIPMAP_LINEAR",i[i.TEXTURE_MAG_FILTER=10240]="TEXTURE_MAG_FILTER",i[i.TEXTURE_MIN_FILTER=10241]="TEXTURE_MIN_FILTER",i[i.TEXTURE_WRAP_S=10242]="TEXTURE_WRAP_S",i[i.TEXTURE_WRAP_T=10243]="TEXTURE_WRAP_T",i[i.TEXTURE_2D=3553]="TEXTURE_2D",i[i.TEXTURE=5890]="TEXTURE",i[i.TEXTURE_CUBE_MAP=34067]="TEXTURE_CUBE_MAP",i[i.TEXTURE_BINDING_CUBE_MAP=34068]="TEXTURE_BINDING_CUBE_MAP",i[i.TEXTURE_CUBE_MAP_POSITIVE_X=34069]="TEXTURE_CUBE_MAP_POSITIVE_X",i[i.TEXTURE_CUBE_MAP_NEGATIVE_X=34070]="TEXTURE_CUBE_MAP_NEGATIVE_X",i[i.TEXTURE_CUBE_MAP_POSITIVE_Y=34071]="TEXTURE_CUBE_MAP_POSITIVE_Y",i[i.TEXTURE_CUBE_MAP_NEGATIVE_Y=34072]="TEXTURE_CUBE_MAP_NEGATIVE_Y",i[i.TEXTURE_CUBE_MAP_POSITIVE_Z=34073]="TEXTURE_CUBE_MAP_POSITIVE_Z",i[i.TEXTURE_CUBE_MAP_NEGATIVE_Z=34074]="TEXTURE_CUBE_MAP_NEGATIVE_Z",i[i.MAX_CUBE_MAP_TEXTURE_SIZE=34076]="MAX_CUBE_MAP_TEXTURE_SIZE",i[i.TEXTURE0=33984]="TEXTURE0",i[i.ACTIVE_TEXTURE=34016]="ACTIVE_TEXTURE",i[i.REPEAT=10497]="REPEAT",i[i.CLAMP_TO_EDGE=33071]="CLAMP_TO_EDGE",i[i.MIRRORED_REPEAT=33648]="MIRRORED_REPEAT",i[i.TEXTURE_WIDTH=4096]="TEXTURE_WIDTH",i[i.TEXTURE_HEIGHT=4097]="TEXTURE_HEIGHT",i[i.FLOAT_VEC2=35664]="FLOAT_VEC2",i[i.FLOAT_VEC3=35665]="FLOAT_VEC3",i[i.FLOAT_VEC4=35666]="FLOAT_VEC4",i[i.INT_VEC2=35667]="INT_VEC2",i[i.INT_VEC3=35668]="INT_VEC3",i[i.INT_VEC4=35669]="INT_VEC4",i[i.BOOL=35670]="BOOL",i[i.BOOL_VEC2=35671]="BOOL_VEC2",i[i.BOOL_VEC3=35672]="BOOL_VEC3",i[i.BOOL_VEC4=35673]="BOOL_VEC4",i[i.FLOAT_MAT2=35674]="FLOAT_MAT2",i[i.FLOAT_MAT3=35675]="FLOAT_MAT3",i[i.FLOAT_MAT4=35676]="FLOAT_MAT4",i[i.SAMPLER_2D=35678]="SAMPLER_2D",i[i.SAMPLER_CUBE=35680]="SAMPLER_CUBE",i[i.LOW_FLOAT=36336]="LOW_FLOAT",i[i.MEDIUM_FLOAT=36337]="MEDIUM_FLOAT",i[i.HIGH_FLOAT=36338]="HIGH_FLOAT",i[i.LOW_INT=36339]="LOW_INT",i[i.MEDIUM_INT=36340]="MEDIUM_INT",i[i.HIGH_INT=36341]="HIGH_INT",i[i.FRAMEBUFFER=36160]="FRAMEBUFFER",i[i.RENDERBUFFER=36161]="RENDERBUFFER",i[i.RGBA4=32854]="RGBA4",i[i.RGB5_A1=32855]="RGB5_A1",i[i.RGB565=36194]="RGB565",i[i.DEPTH_COMPONENT16=33189]="DEPTH_COMPONENT16",i[i.STENCIL_INDEX=6401]="STENCIL_INDEX",i[i.STENCIL_INDEX8=36168]="STENCIL_INDEX8",i[i.DEPTH_STENCIL=34041]="DEPTH_STENCIL",i[i.RENDERBUFFER_WIDTH=36162]="RENDERBUFFER_WIDTH",i[i.RENDERBUFFER_HEIGHT=36163]="RENDERBUFFER_HEIGHT",i[i.RENDERBUFFER_INTERNAL_FORMAT=36164]="RENDERBUFFER_INTERNAL_FORMAT",i[i.RENDERBUFFER_RED_SIZE=36176]="RENDERBUFFER_RED_SIZE",i[i.RENDERBUFFER_GREEN_SIZE=36177]="RENDERBUFFER_GREEN_SIZE",i[i.RENDERBUFFER_BLUE_SIZE=36178]="RENDERBUFFER_BLUE_SIZE",i[i.RENDERBUFFER_ALPHA_SIZE=36179]="RENDERBUFFER_ALPHA_SIZE",i[i.RENDERBUFFER_DEPTH_SIZE=36180]="RENDERBUFFER_DEPTH_SIZE",i[i.RENDERBUFFER_STENCIL_SIZE=36181]="RENDERBUFFER_STENCIL_SIZE",i[i.FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE=36048]="FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE",i[i.FRAMEBUFFER_ATTACHMENT_OBJECT_NAME=36049]="FRAMEBUFFER_ATTACHMENT_OBJECT_NAME",i[i.FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL=36050]="FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL",i[i.FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE=36051]="FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE",i[i.COLOR_ATTACHMENT0=36064]="COLOR_ATTACHMENT0",i[i.DEPTH_ATTACHMENT=36096]="DEPTH_ATTACHMENT",i[i.STENCIL_ATTACHMENT=36128]="STENCIL_ATTACHMENT",i[i.DEPTH_STENCIL_ATTACHMENT=33306]="DEPTH_STENCIL_ATTACHMENT",i[i.NONE=0]="NONE",i[i.FRAMEBUFFER_COMPLETE=36053]="FRAMEBUFFER_COMPLETE",i[i.FRAMEBUFFER_INCOMPLETE_ATTACHMENT=36054]="FRAMEBUFFER_INCOMPLETE_ATTACHMENT",i[i.FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT=36055]="FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT",i[i.FRAMEBUFFER_INCOMPLETE_DIMENSIONS=36057]="FRAMEBUFFER_INCOMPLETE_DIMENSIONS",i[i.FRAMEBUFFER_UNSUPPORTED=36061]="FRAMEBUFFER_UNSUPPORTED",i[i.FRAMEBUFFER_BINDING=36006]="FRAMEBUFFER_BINDING",i[i.RENDERBUFFER_BINDING=36007]="RENDERBUFFER_BINDING",i[i.READ_FRAMEBUFFER=36008]="READ_FRAMEBUFFER",i[i.DRAW_FRAMEBUFFER=36009]="DRAW_FRAMEBUFFER",i[i.MAX_RENDERBUFFER_SIZE=34024]="MAX_RENDERBUFFER_SIZE",i[i.INVALID_FRAMEBUFFER_OPERATION=1286]="INVALID_FRAMEBUFFER_OPERATION",i[i.UNPACK_FLIP_Y_WEBGL=37440]="UNPACK_FLIP_Y_WEBGL",i[i.UNPACK_PREMULTIPLY_ALPHA_WEBGL=37441]="UNPACK_PREMULTIPLY_ALPHA_WEBGL",i[i.UNPACK_COLORSPACE_CONVERSION_WEBGL=37443]="UNPACK_COLORSPACE_CONVERSION_WEBGL",i[i.READ_BUFFER=3074]="READ_BUFFER",i[i.UNPACK_ROW_LENGTH=3314]="UNPACK_ROW_LENGTH",i[i.UNPACK_SKIP_ROWS=3315]="UNPACK_SKIP_ROWS",i[i.UNPACK_SKIP_PIXELS=3316]="UNPACK_SKIP_PIXELS",i[i.PACK_ROW_LENGTH=3330]="PACK_ROW_LENGTH",i[i.PACK_SKIP_ROWS=3331]="PACK_SKIP_ROWS",i[i.PACK_SKIP_PIXELS=3332]="PACK_SKIP_PIXELS",i[i.TEXTURE_BINDING_3D=32874]="TEXTURE_BINDING_3D",i[i.UNPACK_SKIP_IMAGES=32877]="UNPACK_SKIP_IMAGES",i[i.UNPACK_IMAGE_HEIGHT=32878]="UNPACK_IMAGE_HEIGHT",i[i.MAX_3D_TEXTURE_SIZE=32883]="MAX_3D_TEXTURE_SIZE",i[i.MAX_ELEMENTS_VERTICES=33e3]="MAX_ELEMENTS_VERTICES",i[i.MAX_ELEMENTS_INDICES=33001]="MAX_ELEMENTS_INDICES",i[i.MAX_TEXTURE_LOD_BIAS=34045]="MAX_TEXTURE_LOD_BIAS",i[i.MAX_FRAGMENT_UNIFORM_COMPONENTS=35657]="MAX_FRAGMENT_UNIFORM_COMPONENTS",i[i.MAX_VERTEX_UNIFORM_COMPONENTS=35658]="MAX_VERTEX_UNIFORM_COMPONENTS",i[i.MAX_ARRAY_TEXTURE_LAYERS=35071]="MAX_ARRAY_TEXTURE_LAYERS",i[i.MIN_PROGRAM_TEXEL_OFFSET=35076]="MIN_PROGRAM_TEXEL_OFFSET",i[i.MAX_PROGRAM_TEXEL_OFFSET=35077]="MAX_PROGRAM_TEXEL_OFFSET",i[i.MAX_VARYING_COMPONENTS=35659]="MAX_VARYING_COMPONENTS",i[i.FRAGMENT_SHADER_DERIVATIVE_HINT=35723]="FRAGMENT_SHADER_DERIVATIVE_HINT",i[i.RASTERIZER_DISCARD=35977]="RASTERIZER_DISCARD",i[i.VERTEX_ARRAY_BINDING=34229]="VERTEX_ARRAY_BINDING",i[i.MAX_VERTEX_OUTPUT_COMPONENTS=37154]="MAX_VERTEX_OUTPUT_COMPONENTS",i[i.MAX_FRAGMENT_INPUT_COMPONENTS=37157]="MAX_FRAGMENT_INPUT_COMPONENTS",i[i.MAX_SERVER_WAIT_TIMEOUT=37137]="MAX_SERVER_WAIT_TIMEOUT",i[i.MAX_ELEMENT_INDEX=36203]="MAX_ELEMENT_INDEX",i[i.RED=6403]="RED",i[i.RGB8=32849]="RGB8",i[i.RGBA8=32856]="RGBA8",i[i.RGB10_A2=32857]="RGB10_A2",i[i.TEXTURE_3D=32879]="TEXTURE_3D",i[i.TEXTURE_WRAP_R=32882]="TEXTURE_WRAP_R",i[i.TEXTURE_MIN_LOD=33082]="TEXTURE_MIN_LOD",i[i.TEXTURE_MAX_LOD=33083]="TEXTURE_MAX_LOD",i[i.TEXTURE_BASE_LEVEL=33084]="TEXTURE_BASE_LEVEL",i[i.TEXTURE_MAX_LEVEL=33085]="TEXTURE_MAX_LEVEL",i[i.TEXTURE_COMPARE_MODE=34892]="TEXTURE_COMPARE_MODE",i[i.TEXTURE_COMPARE_FUNC=34893]="TEXTURE_COMPARE_FUNC",i[i.SRGB=35904]="SRGB",i[i.SRGB8=35905]="SRGB8",i[i.SRGB8_ALPHA8=35907]="SRGB8_ALPHA8",i[i.COMPARE_REF_TO_TEXTURE=34894]="COMPARE_REF_TO_TEXTURE",i[i.RGBA32F=34836]="RGBA32F",i[i.RGB32F=34837]="RGB32F",i[i.RGBA16F=34842]="RGBA16F",i[i.RGB16F=34843]="RGB16F",i[i.TEXTURE_2D_ARRAY=35866]="TEXTURE_2D_ARRAY",i[i.TEXTURE_BINDING_2D_ARRAY=35869]="TEXTURE_BINDING_2D_ARRAY",i[i.R11F_G11F_B10F=35898]="R11F_G11F_B10F",i[i.RGB9_E5=35901]="RGB9_E5",i[i.RGBA32UI=36208]="RGBA32UI",i[i.RGB32UI=36209]="RGB32UI",i[i.RGBA16UI=36214]="RGBA16UI",i[i.RGB16UI=36215]="RGB16UI",i[i.RGBA8UI=36220]="RGBA8UI",i[i.RGB8UI=36221]="RGB8UI",i[i.RGBA32I=36226]="RGBA32I",i[i.RGB32I=36227]="RGB32I",i[i.RGBA16I=36232]="RGBA16I",i[i.RGB16I=36233]="RGB16I",i[i.RGBA8I=36238]="RGBA8I",i[i.RGB8I=36239]="RGB8I",i[i.RED_INTEGER=36244]="RED_INTEGER",i[i.RGB_INTEGER=36248]="RGB_INTEGER",i[i.RGBA_INTEGER=36249]="RGBA_INTEGER",i[i.R8=33321]="R8",i[i.RG8=33323]="RG8",i[i.R16F=33325]="R16F",i[i.R32F=33326]="R32F",i[i.RG16F=33327]="RG16F",i[i.RG32F=33328]="RG32F",i[i.R8I=33329]="R8I",i[i.R8UI=33330]="R8UI",i[i.R16I=33331]="R16I",i[i.R16UI=33332]="R16UI",i[i.R32I=33333]="R32I",i[i.R32UI=33334]="R32UI",i[i.RG8I=33335]="RG8I",i[i.RG8UI=33336]="RG8UI",i[i.RG16I=33337]="RG16I",i[i.RG16UI=33338]="RG16UI",i[i.RG32I=33339]="RG32I",i[i.RG32UI=33340]="RG32UI",i[i.R8_SNORM=36756]="R8_SNORM",i[i.RG8_SNORM=36757]="RG8_SNORM",i[i.RGB8_SNORM=36758]="RGB8_SNORM",i[i.RGBA8_SNORM=36759]="RGBA8_SNORM",i[i.RGB10_A2UI=36975]="RGB10_A2UI",i[i.TEXTURE_IMMUTABLE_FORMAT=37167]="TEXTURE_IMMUTABLE_FORMAT",i[i.TEXTURE_IMMUTABLE_LEVELS=33503]="TEXTURE_IMMUTABLE_LEVELS",i[i.UNSIGNED_INT_2_10_10_10_REV=33640]="UNSIGNED_INT_2_10_10_10_REV",i[i.UNSIGNED_INT_10F_11F_11F_REV=35899]="UNSIGNED_INT_10F_11F_11F_REV",i[i.UNSIGNED_INT_5_9_9_9_REV=35902]="UNSIGNED_INT_5_9_9_9_REV",i[i.FLOAT_32_UNSIGNED_INT_24_8_REV=36269]="FLOAT_32_UNSIGNED_INT_24_8_REV",i[i.UNSIGNED_INT_24_8=34042]="UNSIGNED_INT_24_8",i[i.HALF_FLOAT=5131]="HALF_FLOAT",i[i.RG=33319]="RG",i[i.RG_INTEGER=33320]="RG_INTEGER",i[i.INT_2_10_10_10_REV=36255]="INT_2_10_10_10_REV",i[i.CURRENT_QUERY=34917]="CURRENT_QUERY",i[i.QUERY_RESULT=34918]="QUERY_RESULT",i[i.QUERY_RESULT_AVAILABLE=34919]="QUERY_RESULT_AVAILABLE",i[i.ANY_SAMPLES_PASSED=35887]="ANY_SAMPLES_PASSED",i[i.ANY_SAMPLES_PASSED_CONSERVATIVE=36202]="ANY_SAMPLES_PASSED_CONSERVATIVE",i[i.MAX_DRAW_BUFFERS=34852]="MAX_DRAW_BUFFERS",i[i.DRAW_BUFFER0=34853]="DRAW_BUFFER0",i[i.DRAW_BUFFER1=34854]="DRAW_BUFFER1",i[i.DRAW_BUFFER2=34855]="DRAW_BUFFER2",i[i.DRAW_BUFFER3=34856]="DRAW_BUFFER3",i[i.DRAW_BUFFER4=34857]="DRAW_BUFFER4",i[i.DRAW_BUFFER5=34858]="DRAW_BUFFER5",i[i.DRAW_BUFFER6=34859]="DRAW_BUFFER6",i[i.DRAW_BUFFER7=34860]="DRAW_BUFFER7",i[i.DRAW_BUFFER8=34861]="DRAW_BUFFER8",i[i.DRAW_BUFFER9=34862]="DRAW_BUFFER9",i[i.DRAW_BUFFER10=34863]="DRAW_BUFFER10",i[i.DRAW_BUFFER11=34864]="DRAW_BUFFER11",i[i.DRAW_BUFFER12=34865]="DRAW_BUFFER12",i[i.DRAW_BUFFER13=34866]="DRAW_BUFFER13",i[i.DRAW_BUFFER14=34867]="DRAW_BUFFER14",i[i.DRAW_BUFFER15=34868]="DRAW_BUFFER15",i[i.MAX_COLOR_ATTACHMENTS=36063]="MAX_COLOR_ATTACHMENTS",i[i.COLOR_ATTACHMENT1=36065]="COLOR_ATTACHMENT1",i[i.COLOR_ATTACHMENT2=36066]="COLOR_ATTACHMENT2",i[i.COLOR_ATTACHMENT3=36067]="COLOR_ATTACHMENT3",i[i.COLOR_ATTACHMENT4=36068]="COLOR_ATTACHMENT4",i[i.COLOR_ATTACHMENT5=36069]="COLOR_ATTACHMENT5",i[i.COLOR_ATTACHMENT6=36070]="COLOR_ATTACHMENT6",i[i.COLOR_ATTACHMENT7=36071]="COLOR_ATTACHMENT7",i[i.COLOR_ATTACHMENT8=36072]="COLOR_ATTACHMENT8",i[i.COLOR_ATTACHMENT9=36073]="COLOR_ATTACHMENT9",i[i.COLOR_ATTACHMENT10=36074]="COLOR_ATTACHMENT10",i[i.COLOR_ATTACHMENT11=36075]="COLOR_ATTACHMENT11",i[i.COLOR_ATTACHMENT12=36076]="COLOR_ATTACHMENT12",i[i.COLOR_ATTACHMENT13=36077]="COLOR_ATTACHMENT13",i[i.COLOR_ATTACHMENT14=36078]="COLOR_ATTACHMENT14",i[i.COLOR_ATTACHMENT15=36079]="COLOR_ATTACHMENT15",i[i.SAMPLER_3D=35679]="SAMPLER_3D",i[i.SAMPLER_2D_SHADOW=35682]="SAMPLER_2D_SHADOW",i[i.SAMPLER_2D_ARRAY=36289]="SAMPLER_2D_ARRAY",i[i.SAMPLER_2D_ARRAY_SHADOW=36292]="SAMPLER_2D_ARRAY_SHADOW",i[i.SAMPLER_CUBE_SHADOW=36293]="SAMPLER_CUBE_SHADOW",i[i.INT_SAMPLER_2D=36298]="INT_SAMPLER_2D",i[i.INT_SAMPLER_3D=36299]="INT_SAMPLER_3D",i[i.INT_SAMPLER_CUBE=36300]="INT_SAMPLER_CUBE",i[i.INT_SAMPLER_2D_ARRAY=36303]="INT_SAMPLER_2D_ARRAY",i[i.UNSIGNED_INT_SAMPLER_2D=36306]="UNSIGNED_INT_SAMPLER_2D",i[i.UNSIGNED_INT_SAMPLER_3D=36307]="UNSIGNED_INT_SAMPLER_3D",i[i.UNSIGNED_INT_SAMPLER_CUBE=36308]="UNSIGNED_INT_SAMPLER_CUBE",i[i.UNSIGNED_INT_SAMPLER_2D_ARRAY=36311]="UNSIGNED_INT_SAMPLER_2D_ARRAY",i[i.MAX_SAMPLES=36183]="MAX_SAMPLES",i[i.SAMPLER_BINDING=35097]="SAMPLER_BINDING",i[i.PIXEL_PACK_BUFFER=35051]="PIXEL_PACK_BUFFER",i[i.PIXEL_UNPACK_BUFFER=35052]="PIXEL_UNPACK_BUFFER",i[i.PIXEL_PACK_BUFFER_BINDING=35053]="PIXEL_PACK_BUFFER_BINDING",i[i.PIXEL_UNPACK_BUFFER_BINDING=35055]="PIXEL_UNPACK_BUFFER_BINDING",i[i.COPY_READ_BUFFER=36662]="COPY_READ_BUFFER",i[i.COPY_WRITE_BUFFER=36663]="COPY_WRITE_BUFFER",i[i.COPY_READ_BUFFER_BINDING=36662]="COPY_READ_BUFFER_BINDING",i[i.COPY_WRITE_BUFFER_BINDING=36663]="COPY_WRITE_BUFFER_BINDING",i[i.FLOAT_MAT2x3=35685]="FLOAT_MAT2x3",i[i.FLOAT_MAT2x4=35686]="FLOAT_MAT2x4",i[i.FLOAT_MAT3x2=35687]="FLOAT_MAT3x2",i[i.FLOAT_MAT3x4=35688]="FLOAT_MAT3x4",i[i.FLOAT_MAT4x2=35689]="FLOAT_MAT4x2",i[i.FLOAT_MAT4x3=35690]="FLOAT_MAT4x3",i[i.UNSIGNED_INT_VEC2=36294]="UNSIGNED_INT_VEC2",i[i.UNSIGNED_INT_VEC3=36295]="UNSIGNED_INT_VEC3",i[i.UNSIGNED_INT_VEC4=36296]="UNSIGNED_INT_VEC4",i[i.UNSIGNED_NORMALIZED=35863]="UNSIGNED_NORMALIZED",i[i.SIGNED_NORMALIZED=36764]="SIGNED_NORMALIZED",i[i.VERTEX_ATTRIB_ARRAY_INTEGER=35069]="VERTEX_ATTRIB_ARRAY_INTEGER",i[i.VERTEX_ATTRIB_ARRAY_DIVISOR=35070]="VERTEX_ATTRIB_ARRAY_DIVISOR",i[i.TRANSFORM_FEEDBACK_BUFFER_MODE=35967]="TRANSFORM_FEEDBACK_BUFFER_MODE",i[i.MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS=35968]="MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS",i[i.TRANSFORM_FEEDBACK_VARYINGS=35971]="TRANSFORM_FEEDBACK_VARYINGS",i[i.TRANSFORM_FEEDBACK_BUFFER_START=35972]="TRANSFORM_FEEDBACK_BUFFER_START",i[i.TRANSFORM_FEEDBACK_BUFFER_SIZE=35973]="TRANSFORM_FEEDBACK_BUFFER_SIZE",i[i.TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN=35976]="TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN",i[i.MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS=35978]="MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS",i[i.MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS=35979]="MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS",i[i.INTERLEAVED_ATTRIBS=35980]="INTERLEAVED_ATTRIBS",i[i.SEPARATE_ATTRIBS=35981]="SEPARATE_ATTRIBS",i[i.TRANSFORM_FEEDBACK_BUFFER=35982]="TRANSFORM_FEEDBACK_BUFFER",i[i.TRANSFORM_FEEDBACK_BUFFER_BINDING=35983]="TRANSFORM_FEEDBACK_BUFFER_BINDING",i[i.TRANSFORM_FEEDBACK=36386]="TRANSFORM_FEEDBACK",i[i.TRANSFORM_FEEDBACK_PAUSED=36387]="TRANSFORM_FEEDBACK_PAUSED",i[i.TRANSFORM_FEEDBACK_ACTIVE=36388]="TRANSFORM_FEEDBACK_ACTIVE",i[i.TRANSFORM_FEEDBACK_BINDING=36389]="TRANSFORM_FEEDBACK_BINDING",i[i.FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING=33296]="FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING",i[i.FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE=33297]="FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE",i[i.FRAMEBUFFER_ATTACHMENT_RED_SIZE=33298]="FRAMEBUFFER_ATTACHMENT_RED_SIZE",i[i.FRAMEBUFFER_ATTACHMENT_GREEN_SIZE=33299]="FRAMEBUFFER_ATTACHMENT_GREEN_SIZE",i[i.FRAMEBUFFER_ATTACHMENT_BLUE_SIZE=33300]="FRAMEBUFFER_ATTACHMENT_BLUE_SIZE",i[i.FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE=33301]="FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE",i[i.FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE=33302]="FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE",i[i.FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE=33303]="FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE",i[i.FRAMEBUFFER_DEFAULT=33304]="FRAMEBUFFER_DEFAULT",i[i.DEPTH24_STENCIL8=35056]="DEPTH24_STENCIL8",i[i.DRAW_FRAMEBUFFER_BINDING=36006]="DRAW_FRAMEBUFFER_BINDING",i[i.READ_FRAMEBUFFER_BINDING=36010]="READ_FRAMEBUFFER_BINDING",i[i.RENDERBUFFER_SAMPLES=36011]="RENDERBUFFER_SAMPLES",i[i.FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER=36052]="FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER",i[i.FRAMEBUFFER_INCOMPLETE_MULTISAMPLE=36182]="FRAMEBUFFER_INCOMPLETE_MULTISAMPLE",i[i.UNIFORM_BUFFER=35345]="UNIFORM_BUFFER",i[i.UNIFORM_BUFFER_BINDING=35368]="UNIFORM_BUFFER_BINDING",i[i.UNIFORM_BUFFER_START=35369]="UNIFORM_BUFFER_START",i[i.UNIFORM_BUFFER_SIZE=35370]="UNIFORM_BUFFER_SIZE",i[i.MAX_VERTEX_UNIFORM_BLOCKS=35371]="MAX_VERTEX_UNIFORM_BLOCKS",i[i.MAX_FRAGMENT_UNIFORM_BLOCKS=35373]="MAX_FRAGMENT_UNIFORM_BLOCKS",i[i.MAX_COMBINED_UNIFORM_BLOCKS=35374]="MAX_COMBINED_UNIFORM_BLOCKS",i[i.MAX_UNIFORM_BUFFER_BINDINGS=35375]="MAX_UNIFORM_BUFFER_BINDINGS",i[i.MAX_UNIFORM_BLOCK_SIZE=35376]="MAX_UNIFORM_BLOCK_SIZE",i[i.MAX_COMBINED_VERTEX_UNIFORM_COMPONENTS=35377]="MAX_COMBINED_VERTEX_UNIFORM_COMPONENTS",i[i.MAX_COMBINED_FRAGMENT_UNIFORM_COMPONENTS=35379]="MAX_COMBINED_FRAGMENT_UNIFORM_COMPONENTS",i[i.UNIFORM_BUFFER_OFFSET_ALIGNMENT=35380]="UNIFORM_BUFFER_OFFSET_ALIGNMENT",i[i.ACTIVE_UNIFORM_BLOCKS=35382]="ACTIVE_UNIFORM_BLOCKS",i[i.UNIFORM_TYPE=35383]="UNIFORM_TYPE",i[i.UNIFORM_SIZE=35384]="UNIFORM_SIZE",i[i.UNIFORM_BLOCK_INDEX=35386]="UNIFORM_BLOCK_INDEX",i[i.UNIFORM_OFFSET=35387]="UNIFORM_OFFSET",i[i.UNIFORM_ARRAY_STRIDE=35388]="UNIFORM_ARRAY_STRIDE",i[i.UNIFORM_MATRIX_STRIDE=35389]="UNIFORM_MATRIX_STRIDE",i[i.UNIFORM_IS_ROW_MAJOR=35390]="UNIFORM_IS_ROW_MAJOR",i[i.UNIFORM_BLOCK_BINDING=35391]="UNIFORM_BLOCK_BINDING",i[i.UNIFORM_BLOCK_DATA_SIZE=35392]="UNIFORM_BLOCK_DATA_SIZE",i[i.UNIFORM_BLOCK_ACTIVE_UNIFORMS=35394]="UNIFORM_BLOCK_ACTIVE_UNIFORMS",i[i.UNIFORM_BLOCK_ACTIVE_UNIFORM_INDICES=35395]="UNIFORM_BLOCK_ACTIVE_UNIFORM_INDICES",i[i.UNIFORM_BLOCK_REFERENCED_BY_VERTEX_SHADER=35396]="UNIFORM_BLOCK_REFERENCED_BY_VERTEX_SHADER",i[i.UNIFORM_BLOCK_REFERENCED_BY_FRAGMENT_SHADER=35398]="UNIFORM_BLOCK_REFERENCED_BY_FRAGMENT_SHADER",i[i.OBJECT_TYPE=37138]="OBJECT_TYPE",i[i.SYNC_CONDITION=37139]="SYNC_CONDITION",i[i.SYNC_STATUS=37140]="SYNC_STATUS",i[i.SYNC_FLAGS=37141]="SYNC_FLAGS",i[i.SYNC_FENCE=37142]="SYNC_FENCE",i[i.SYNC_GPU_COMMANDS_COMPLETE=37143]="SYNC_GPU_COMMANDS_COMPLETE",i[i.UNSIGNALED=37144]="UNSIGNALED",i[i.SIGNALED=37145]="SIGNALED",i[i.ALREADY_SIGNALED=37146]="ALREADY_SIGNALED",i[i.TIMEOUT_EXPIRED=37147]="TIMEOUT_EXPIRED",i[i.CONDITION_SATISFIED=37148]="CONDITION_SATISFIED",i[i.WAIT_FAILED=37149]="WAIT_FAILED",i[i.SYNC_FLUSH_COMMANDS_BIT=1]="SYNC_FLUSH_COMMANDS_BIT",i[i.COLOR=6144]="COLOR",i[i.DEPTH=6145]="DEPTH",i[i.STENCIL=6146]="STENCIL",i[i.MIN=32775]="MIN",i[i.MAX=32776]="MAX",i[i.DEPTH_COMPONENT24=33190]="DEPTH_COMPONENT24",i[i.STREAM_READ=35041]="STREAM_READ",i[i.STREAM_COPY=35042]="STREAM_COPY",i[i.STATIC_READ=35045]="STATIC_READ",i[i.STATIC_COPY=35046]="STATIC_COPY",i[i.DYNAMIC_READ=35049]="DYNAMIC_READ",i[i.DYNAMIC_COPY=35050]="DYNAMIC_COPY",i[i.DEPTH_COMPONENT32F=36012]="DEPTH_COMPONENT32F",i[i.DEPTH32F_STENCIL8=36013]="DEPTH32F_STENCIL8",i[i.INVALID_INDEX=4294967295]="INVALID_INDEX",i[i.TIMEOUT_IGNORED=-1]="TIMEOUT_IGNORED",i[i.MAX_CLIENT_WAIT_TIMEOUT_WEBGL=37447]="MAX_CLIENT_WAIT_TIMEOUT_WEBGL",i[i.VERTEX_ATTRIB_ARRAY_DIVISOR_ANGLE=35070]="VERTEX_ATTRIB_ARRAY_DIVISOR_ANGLE",i[i.UNMASKED_VENDOR_WEBGL=37445]="UNMASKED_VENDOR_WEBGL",i[i.UNMASKED_RENDERER_WEBGL=37446]="UNMASKED_RENDERER_WEBGL",i[i.MAX_TEXTURE_MAX_ANISOTROPY_EXT=34047]="MAX_TEXTURE_MAX_ANISOTROPY_EXT",i[i.TEXTURE_MAX_ANISOTROPY_EXT=34046]="TEXTURE_MAX_ANISOTROPY_EXT",i[i.COMPRESSED_RGB_S3TC_DXT1_EXT=33776]="COMPRESSED_RGB_S3TC_DXT1_EXT",i[i.COMPRESSED_RGBA_S3TC_DXT1_EXT=33777]="COMPRESSED_RGBA_S3TC_DXT1_EXT",i[i.COMPRESSED_RGBA_S3TC_DXT3_EXT=33778]="COMPRESSED_RGBA_S3TC_DXT3_EXT",i[i.COMPRESSED_RGBA_S3TC_DXT5_EXT=33779]="COMPRESSED_RGBA_S3TC_DXT5_EXT",i[i.COMPRESSED_R11_EAC=37488]="COMPRESSED_R11_EAC",i[i.COMPRESSED_SIGNED_R11_EAC=37489]="COMPRESSED_SIGNED_R11_EAC",i[i.COMPRESSED_RG11_EAC=37490]="COMPRESSED_RG11_EAC",i[i.COMPRESSED_SIGNED_RG11_EAC=37491]="COMPRESSED_SIGNED_RG11_EAC",i[i.COMPRESSED_RGB8_ETC2=37492]="COMPRESSED_RGB8_ETC2",i[i.COMPRESSED_RGBA8_ETC2_EAC=37493]="COMPRESSED_RGBA8_ETC2_EAC",i[i.COMPRESSED_SRGB8_ETC2=37494]="COMPRESSED_SRGB8_ETC2",i[i.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC=37495]="COMPRESSED_SRGB8_ALPHA8_ETC2_EAC",i[i.COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2=37496]="COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2",i[i.COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2=37497]="COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2",i[i.COMPRESSED_RGB_PVRTC_4BPPV1_IMG=35840]="COMPRESSED_RGB_PVRTC_4BPPV1_IMG",i[i.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG=35842]="COMPRESSED_RGBA_PVRTC_4BPPV1_IMG",i[i.COMPRESSED_RGB_PVRTC_2BPPV1_IMG=35841]="COMPRESSED_RGB_PVRTC_2BPPV1_IMG",i[i.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG=35843]="COMPRESSED_RGBA_PVRTC_2BPPV1_IMG",i[i.COMPRESSED_RGB_ETC1_WEBGL=36196]="COMPRESSED_RGB_ETC1_WEBGL",i[i.COMPRESSED_RGB_ATC_WEBGL=35986]="COMPRESSED_RGB_ATC_WEBGL",i[i.COMPRESSED_RGBA_ATC_EXPLICIT_ALPHA_WEBGL=35986]="COMPRESSED_RGBA_ATC_EXPLICIT_ALPHA_WEBGL",i[i.COMPRESSED_RGBA_ATC_INTERPOLATED_ALPHA_WEBGL=34798]="COMPRESSED_RGBA_ATC_INTERPOLATED_ALPHA_WEBGL",i[i.UNSIGNED_INT_24_8_WEBGL=34042]="UNSIGNED_INT_24_8_WEBGL",i[i.HALF_FLOAT_OES=36193]="HALF_FLOAT_OES",i[i.RGBA32F_EXT=34836]="RGBA32F_EXT",i[i.RGB32F_EXT=34837]="RGB32F_EXT",i[i.FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE_EXT=33297]="FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE_EXT",i[i.UNSIGNED_NORMALIZED_EXT=35863]="UNSIGNED_NORMALIZED_EXT",i[i.MIN_EXT=32775]="MIN_EXT",i[i.MAX_EXT=32776]="MAX_EXT",i[i.SRGB_EXT=35904]="SRGB_EXT",i[i.SRGB_ALPHA_EXT=35906]="SRGB_ALPHA_EXT",i[i.SRGB8_ALPHA8_EXT=35907]="SRGB8_ALPHA8_EXT",i[i.FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING_EXT=33296]="FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING_EXT",i[i.FRAGMENT_SHADER_DERIVATIVE_HINT_OES=35723]="FRAGMENT_SHADER_DERIVATIVE_HINT_OES",i[i.COLOR_ATTACHMENT0_WEBGL=36064]="COLOR_ATTACHMENT0_WEBGL",i[i.COLOR_ATTACHMENT1_WEBGL=36065]="COLOR_ATTACHMENT1_WEBGL",i[i.COLOR_ATTACHMENT2_WEBGL=36066]="COLOR_ATTACHMENT2_WEBGL",i[i.COLOR_ATTACHMENT3_WEBGL=36067]="COLOR_ATTACHMENT3_WEBGL",i[i.COLOR_ATTACHMENT4_WEBGL=36068]="COLOR_ATTACHMENT4_WEBGL",i[i.COLOR_ATTACHMENT5_WEBGL=36069]="COLOR_ATTACHMENT5_WEBGL",i[i.COLOR_ATTACHMENT6_WEBGL=36070]="COLOR_ATTACHMENT6_WEBGL",i[i.COLOR_ATTACHMENT7_WEBGL=36071]="COLOR_ATTACHMENT7_WEBGL",i[i.COLOR_ATTACHMENT8_WEBGL=36072]="COLOR_ATTACHMENT8_WEBGL",i[i.COLOR_ATTACHMENT9_WEBGL=36073]="COLOR_ATTACHMENT9_WEBGL",i[i.COLOR_ATTACHMENT10_WEBGL=36074]="COLOR_ATTACHMENT10_WEBGL",i[i.COLOR_ATTACHMENT11_WEBGL=36075]="COLOR_ATTACHMENT11_WEBGL",i[i.COLOR_ATTACHMENT12_WEBGL=36076]="COLOR_ATTACHMENT12_WEBGL",i[i.COLOR_ATTACHMENT13_WEBGL=36077]="COLOR_ATTACHMENT13_WEBGL",i[i.COLOR_ATTACHMENT14_WEBGL=36078]="COLOR_ATTACHMENT14_WEBGL",i[i.COLOR_ATTACHMENT15_WEBGL=36079]="COLOR_ATTACHMENT15_WEBGL",i[i.DRAW_BUFFER0_WEBGL=34853]="DRAW_BUFFER0_WEBGL",i[i.DRAW_BUFFER1_WEBGL=34854]="DRAW_BUFFER1_WEBGL",i[i.DRAW_BUFFER2_WEBGL=34855]="DRAW_BUFFER2_WEBGL",i[i.DRAW_BUFFER3_WEBGL=34856]="DRAW_BUFFER3_WEBGL",i[i.DRAW_BUFFER4_WEBGL=34857]="DRAW_BUFFER4_WEBGL",i[i.DRAW_BUFFER5_WEBGL=34858]="DRAW_BUFFER5_WEBGL",i[i.DRAW_BUFFER6_WEBGL=34859]="DRAW_BUFFER6_WEBGL",i[i.DRAW_BUFFER7_WEBGL=34860]="DRAW_BUFFER7_WEBGL",i[i.DRAW_BUFFER8_WEBGL=34861]="DRAW_BUFFER8_WEBGL",i[i.DRAW_BUFFER9_WEBGL=34862]="DRAW_BUFFER9_WEBGL",i[i.DRAW_BUFFER10_WEBGL=34863]="DRAW_BUFFER10_WEBGL",i[i.DRAW_BUFFER11_WEBGL=34864]="DRAW_BUFFER11_WEBGL",i[i.DRAW_BUFFER12_WEBGL=34865]="DRAW_BUFFER12_WEBGL",i[i.DRAW_BUFFER13_WEBGL=34866]="DRAW_BUFFER13_WEBGL",i[i.DRAW_BUFFER14_WEBGL=34867]="DRAW_BUFFER14_WEBGL",i[i.DRAW_BUFFER15_WEBGL=34868]="DRAW_BUFFER15_WEBGL",i[i.MAX_COLOR_ATTACHMENTS_WEBGL=36063]="MAX_COLOR_ATTACHMENTS_WEBGL",i[i.MAX_DRAW_BUFFERS_WEBGL=34852]="MAX_DRAW_BUFFERS_WEBGL",i[i.VERTEX_ARRAY_BINDING_OES=34229]="VERTEX_ARRAY_BINDING_OES",i[i.QUERY_COUNTER_BITS_EXT=34916]="QUERY_COUNTER_BITS_EXT",i[i.CURRENT_QUERY_EXT=34917]="CURRENT_QUERY_EXT",i[i.QUERY_RESULT_EXT=34918]="QUERY_RESULT_EXT",i[i.QUERY_RESULT_AVAILABLE_EXT=34919]="QUERY_RESULT_AVAILABLE_EXT",i[i.TIME_ELAPSED_EXT=35007]="TIME_ELAPSED_EXT",i[i.TIMESTAMP_EXT=36392]="TIMESTAMP_EXT",i[i.GPU_DISJOINT_EXT=36795]="GPU_DISJOINT_EXT";var $f=qf(0,0,0,0),Fs=(qf(0,0,0,1),qf(1,1,1,0),qf(1,1,1,1));function Zf(t){return t&&0==(t&t-1)}function Qf(t,e){return null!=t?t:e}function Jf(t){return void 0===t?null:t}function tp(t,e,n){t.length=e,t.fill(n)}function ep(t,e){return((t+e-1)/e|0)*e}function np(t,e,n){n=function(t,e,n){for(var r=0,i=t.length;r<i;){var o=r+(i-r>>>1);n(e,t[o])<0?i=o:r=o+1}return r}(t,e,n);t.splice(n,0,e)}function rp(t,e,n){return n?t|=e:t&=~e,t}function ip(t,e){for(var n=new Array(t),r=0;r<t;r++)n[r]=e();return n}function op(t,n){return void 0===n&&(n=1),t.split("\n").map(function(t,e){return function(t,e,n){void 0===n&&(n="0");for(;t.length<e;)t=""+n+t;return t}(""+(n+e),4," ")+" "+t}).join("\n")}function ap(t,e){t.blendDstFactor=e.blendDstFactor,t.blendSrcFactor=e.blendSrcFactor,t.blendMode=e.blendMode}function sp(t,e){t.length!==e.length&&(t.length=e.length);for(var n,r,i=0;i<e.length;i++)t[i]=(n=t[i],r=e[i],ap((n=void 0===n?{rgbBlendState:{},alphaBlendState:{},channelWriteMask:0}:n).rgbBlendState,r.rgbBlendState),ap(n.alphaBlendState,r.alphaBlendState),n.channelWriteMask=r.channelWriteMask,n)}function lp(t,e){void 0!==e.attachmentsState&&sp(t.attachmentsState,e.attachmentsState),void 0!==e.blendConstant&&Yf(t.blendConstant,e.blendConstant),t.depthCompare=Qf(e.depthCompare,t.depthCompare),t.depthWrite=Qf(e.depthWrite,t.depthWrite),t.stencilCompare=Qf(e.stencilCompare,t.stencilCompare),t.stencilWrite=Qf(e.stencilWrite,t.stencilWrite),t.stencilPassOp=Qf(e.stencilPassOp,t.stencilPassOp),t.stencilRef=Qf(e.stencilRef,t.stencilRef),t.cullMode=Qf(e.cullMode,t.cullMode),t.frontFace=Qf(e.frontFace,t.frontFace),t.polygonOffset=Qf(e.polygonOffset,t.polygonOffset)}function up(t){var e=Object.assign({},t);return e.attachmentsState=[],sp(e.attachmentsState,t.attachmentsState),e.blendConstant=Kf(e.blendConstant),e}var n={blendMode:Ef.Add,blendSrcFactor:yf.One,blendDstFactor:yf.Zero},cp={attachmentsState:[{channelWriteMask:Cf.RGB,rgbBlendState:n,alphaBlendState:n}],blendConstant:Kf($f),depthWrite:!0,depthCompare:mf.LessEqual,stencilCompare:mf.Always,stencilWrite:!1,stencilPassOp:Pf.Keep,stencilRef:0,cullMode:vf.None,frontFace:mT.CCW,polygonOffset:!1};function hp(t,e){var n;return void 0===t.attachmentsState&&(t.attachmentsState=[],sp(t.attachmentsState,cp.attachmentsState)),n=t.attachmentsState[0],void 0!==(e=e).channelWriteMask&&(n.channelWriteMask=e.channelWriteMask),void 0!==e.rgbBlendMode&&(n.rgbBlendState.blendMode=e.rgbBlendMode),void 0!==e.alphaBlendMode&&(n.alphaBlendState.blendMode=e.alphaBlendMode),void 0!==e.rgbBlendSrcFactor&&(n.rgbBlendState.blendSrcFactor=e.rgbBlendSrcFactor),void 0!==e.alphaBlendSrcFactor&&(n.alphaBlendState.blendSrcFactor=e.alphaBlendSrcFactor),void 0!==e.rgbBlendDstFactor&&(n.rgbBlendState.blendDstFactor=e.rgbBlendDstFactor),void 0!==e.alphaBlendDstFactor&&(n.alphaBlendState.blendDstFactor=e.alphaBlendDstFactor),t}void 0===(Ua={depthCompare:mf.Always,depthWrite:!1})&&(Ua=null),ya=up(ya=void 0===(ya=cp)?cp:ya),null!==Ua&&lp(ya,Ua);var dp={formatKind:Of.Float,dimension:Rf.n2D};function fp(t,e,n){if(t.length===e.length){for(var r=0;r<t.length;r++)if(!n(t[r],e[r]))return;return 1}}function pp(t,e){for(var n=Array(t.length),r=0;r<t.length;r++)n[r]=e(t[r]);return n}function gp(t,e){return t.buffer===e.buffer&&t.wordCount===e.wordCount}function mp(t,e){return null===t?null===e:null!==e&&t.sampler===e.sampler&&t.texture===e.texture}function vp(t,e){return t.samplerBindings.length===e.samplerBindings.length&&!!fp(t.samplerBindings,e.samplerBindings,mp)&&!!fp(t.uniformBufferBindings,e.uniformBufferBindings,gp)&&!!_p(t.bindingLayout,e.bindingLayout)}function yp(t,e){return t.blendMode==e.blendMode&&t.blendSrcFactor===e.blendSrcFactor&&t.blendDstFactor===e.blendDstFactor}function Ep(t,e){return!!yp(t.rgbBlendState,e.rgbBlendState)&&!!yp(t.alphaBlendState,e.alphaBlendState)&&t.channelWriteMask===e.channelWriteMask}function _p(t,e){return t.numSamplers===e.numSamplers&&t.numUniformBuffers===e.numUniformBuffers}function bp(t,e){return t===e}function xp(t,e){var n,r;return t.topology===e.topology&&t.inputLayout===e.inputLayout&&t.sampleCount===e.sampleCount&&(n=t.megaStateDescriptor,r=e.megaStateDescriptor,!!(fp(n.attachmentsState,r.attachmentsState,Ep)&&Xf(n.blendConstant,r.blendConstant)&&n.depthCompare===r.depthCompare&&n.depthWrite===r.depthWrite&&n.stencilCompare===r.stencilCompare&&n.stencilWrite===r.stencilWrite&&n.stencilPassOp===r.stencilPassOp&&n.stencilRef===r.stencilRef&&n.cullMode===r.cullMode&&n.frontFace===r.frontFace&&n.polygonOffset===r.polygonOffset&&(n=t.program,r=e.program,n.id===r.id)&&fp(t.bindingLayouts,e.bindingLayouts,_p)&&fp(t.colorAttachmentFormats,e.colorAttachmentFormats,bp)&&t.depthStencilAttachmentFormat===e.depthStencilAttachmentFormat))}function Sp(t,e){return t.bufferIndex===e.bufferIndex&&t.bufferByteOffset===e.bufferByteOffset&&t.location===e.location&&t.format===e.format}function wp(t,e){return M(t)?M(e):!M(e)&&t.byteStride===e.byteStride&&t.frequency===e.frequency}function Tp(t,e){return t.indexBufferFormat===e.indexBufferFormat&&!!fp(t.vertexBufferDescriptors,e.vertexBufferDescriptors,wp)&&!!fp(t.vertexAttributeDescriptors,e.vertexAttributeDescriptors,Sp)}function Ap(t,e){return t.wrapS===e.wrapS&&t.wrapT===e.wrapT&&t.minFilter===e.minFilter&&t.magFilter===e.magFilter&&t.mipFilter===e.mipFilter&&t.minLOD===e.minLOD&&t.maxLOD===e.maxLOD&&t.maxAnisotropy===e.maxAnisotropy&&t.compareMode===e.compareMode}function Mp(t){return{sampler:t.sampler,texture:t.texture,lateBinding:t.lateBinding}}function Rp(t){return{buffer:t.buffer,wordCount:t.wordCount}}function Np(t){return{dimension:t.dimension,formatKind:t.formatKind}}function Cp(t){return{numSamplers:t.numSamplers,numUniformBuffers:t.numUniformBuffers,samplerEntries:void 0!==t.samplerEntries?pp(t.samplerEntries,Np):void 0}}function Pp(t){return{location:t.location,format:t.format,bufferIndex:t.bufferIndex,bufferByteOffset:t.bufferByteOffset,byteStride:t.byteStride,divisor:t.divisor}}function Op(t){return M(t)?t:{byteStride:t.byteStride,frequency:t.frequency}}(Sa=e1=e1||{})[Sa.LITTLE_ENDIAN=0]="LITTLE_ENDIAN",Sa[Sa.BIG_ENDIAN=1]="BIG_ENDIAN";var t=new Uint16Array([65279]),Ip=(255==new DataView(t.buffer).getUint8(0)?e1.LITTLE_ENDIAN:e1.BIG_ENDIAN,/([^[]*)(\[[0-9]+\])?/);function Lp(){var i=null;return function(t,e,n){var r=i!==n;return r&&(t.uniform1i(e,n),i=n),r}}function kp(s,l,u,c){var h=null,d=null;return function(t,e,n){var r=l(n,u),i=r.length,o=!1;if(null===h)h=new Float32Array(i),d=i,o=!0;else{T(d===i,"Uniform length cannot change.");for(var a=0;a<i;++a)if(r[a]!==h[a]){o=!0;break}}return o&&(c(t,s,e,r),h.set(r)),o}}function Dp(t,e,n,r){t[e](n,r)}function Bp(t,e,n,r){t[e](n,!1,r)}var Fp={},Up={},Gp={},Wp=[0];function Vp(t,e,n,r){1===e&&"boolean"==typeof t&&(t=t?1:0),Number.isFinite(t)&&(Wp[0]=t,t=Wp);var i=t.length;if(t instanceof n)return t;var o=r[i];o||(o=new n(i),r[i]=o);for(var a=0;a<i;a++)o[a]=t[a];return o}function jp(t,e){return Vp(t,e,Float32Array,Fp)}function zp(t,e){return Vp(t,e,Int32Array,Up)}function Hp(t,e){return Vp(t,e,Uint32Array,Gp)}(e={})[w.FLOAT]=kp.bind(null,"uniform1fv",jp,1,Dp),e[w.FLOAT_VEC2]=kp.bind(null,"uniform2fv",jp,2,Dp),e[w.FLOAT_VEC3]=kp.bind(null,"uniform3fv",jp,3,Dp),e[w.FLOAT_VEC4]=kp.bind(null,"uniform4fv",jp,4,Dp),e[w.INT]=kp.bind(null,"uniform1iv",zp,1,Dp),e[w.INT_VEC2]=kp.bind(null,"uniform2iv",zp,2,Dp),e[w.INT_VEC3]=kp.bind(null,"uniform3iv",zp,3,Dp),e[w.INT_VEC4]=kp.bind(null,"uniform4iv",zp,4,Dp),e[w.BOOL]=kp.bind(null,"uniform1iv",zp,1,Dp),e[w.BOOL_VEC2]=kp.bind(null,"uniform2iv",zp,2,Dp),e[w.BOOL_VEC3]=kp.bind(null,"uniform3iv",zp,3,Dp),e[w.BOOL_VEC4]=kp.bind(null,"uniform4iv",zp,4,Dp),e[w.FLOAT_MAT2]=kp.bind(null,"uniformMatrix2fv",jp,4,Bp),e[w.FLOAT_MAT3]=kp.bind(null,"uniformMatrix3fv",jp,9,Bp),e[w.FLOAT_MAT4]=kp.bind(null,"uniformMatrix4fv",jp,16,Bp),e[w.SAMPLER_2D]=Lp,e[w.SAMPLER_CUBE]=Lp,e[w.UNSIGNED_INT]=kp.bind(null,"uniform1uiv",Hp,1,Dp),e[w.UNSIGNED_INT_VEC2]=kp.bind(null,"uniform2uiv",Hp,2,Dp),e[w.UNSIGNED_INT_VEC3]=kp.bind(null,"uniform3uiv",Hp,3,Dp),e[w.UNSIGNED_INT_VEC4]=kp.bind(null,"uniform4uiv",Hp,4,Dp),e[w.FLOAT_MAT2x3]=kp.bind(null,"uniformMatrix2x3fv",jp,6,Bp),e[w.FLOAT_MAT2x4]=kp.bind(null,"uniformMatrix2x4fv",jp,8,Bp),e[w.FLOAT_MAT3x2]=kp.bind(null,"uniformMatrix3x2fv",jp,6,Bp),e[w.FLOAT_MAT3x4]=kp.bind(null,"uniformMatrix3x4fv",jp,12,Bp),e[w.FLOAT_MAT4x2]=kp.bind(null,"uniformMatrix4x2fv",jp,8,Bp),e[w.FLOAT_MAT4x3]=kp.bind(null,"uniformMatrix4x3fv",jp,12,Bp),e[w.SAMPLER_2D]=Lp,e[w.SAMPLER_CUBE]=Lp,e[w.SAMPLER_3D]=Lp,e[w.SAMPLER_2D_SHADOW]=Lp,e[w.SAMPLER_2D_ARRAY]=Lp,e[w.SAMPLER_2D_ARRAY_SHADOW]=Lp,e[w.SAMPLER_CUBE_SHADOW]=Lp,e[w.INT_SAMPLER_2D]=Lp,e[w.INT_SAMPLER_3D]=Lp,e[w.INT_SAMPLER_CUBE]=Lp,e[w.INT_SAMPLER_2D_ARRAY]=Lp,e[w.UNSIGNED_INT_SAMPLER_2D]=Lp,e[w.UNSIGNED_INT_SAMPLER_3D]=Lp,e[w.UNSIGNED_INT_SAMPLER_CUBE]=Lp,e[w.UNSIGNED_INT_SAMPLER_2D_ARRAY]=Lp;var Xp=e;function Yp(t,e,n){var r=Xp[n.type];if(r)return r().bind(null,t,e);throw new Error("Unknown GLSL uniform type "+n.type)}var Kp=[[/\btexture(2D|2DProj|Cube)Lod\(/g,"texture$1LodEXT("],[/\btexture\(/g,"texture2D("],[/\btextureLod\(/g,"texture2DLodEXT("]];function qp(t,e){return"#define "+t+" "+e}function $p(t){var o=[],a=[];return t.replace(/\s*struct\s*(.*)\s*{((?:\s*.*\s*)*?)};/g,function(t,e,n){var r=[];return n.trim().split("\n").forEach(function(t){var t=t.trim().split(/\s+/),e=t[0],t=t[1];r.push({type:e.trim(),name:t.replace(";","").trim()})}),a.push({type:e.trim(),uniforms:r}),""}),t.replace(/\s*uniform\s*.*\s*{((?:\s*.*\s*)*?)};/g,function(t,e){return e.trim().split("\n").forEach(function(t){var t=t.trim().split(" "),e=t[0]||"",t=-1<(n=t[1]||"").indexOf("["),n=n.replace(";","").replace("[","").trim();if(!e.startsWith("#")){if(e){var r=a.find(function(t){return e===t.type});if(r)if(t)for(var i=0;i<5;i++)!function(e){r.uniforms.forEach(function(t){o.push(n+"["+e+"]."+t.name)})}(i);else r.uniforms.forEach(function(t){o.push(n+"."+t.name)})}n&&o.push(n)}}),""}),o}function Zp(t,n,e,r){void 0===r&&(r=null);var i,o,a,s,l="#version 100"===t.glslVersion,e=e.split("\n").map(function(t){return t.replace(/[/][/].*$/,"")}).filter(function(t){return!(!t||/^\s+$/.test(t))}),u="",c=(null!==r&&(u=Object.keys(r).map(function(t){return qp(t,r[t])}).join("\n")),e.find(function(t){return t.startsWith("precision")})||"precision mediump float;"),e=e.filter(function(t){return!t.startsWith("precision")}).join("\n"),h="",d=(t.viewportOrigin===If.UpperLeft&&(h+="#define VIEWPORT_ORIGIN_TL 1\n"),t.clipSpaceNearZ===Lf.Zero&&(h+="#define CLIPSPACE_NEAR_ZERO 1\n"),t.explicitBindingLocations&&(a=o=i=0,e=e.replace(/^(layout\((.*)\))?\s*uniform(.+{)$/gm,function(t,e,n,r){return"layout("+(n?n+", ":"")+"set = "+i+", binding = "+o+++") uniform "+r}),i++,o=0,T(t.separateSamplerTextures),e=(e=e.replace(/uniform sampler2D (.*);/g,function(t,e){return"frag"===n?"\nlayout(set = "+i+", binding = "+o+++") uniform texture2D T_"+e+";\nlayout(set = "+i+", binding = "+o+++") uniform sampler S_"+e+";\n":""})).replace("frag"===n?/^\b(varying|in)\b/gm:/^\b(varying|out)\b/gm,function(t,e){return"layout(location = "+a+++") "+e}),h+="#define gl_VertexID gl_VertexIndex\n"),e=t.separateSamplerTextures?(e=(e=(e=e.replace(/\bPD_SAMPLER_2D\((.*?)\)/g,function(t,e){return"texture2D T_P_"+e+", sampler S_P_"+e})).replace(/\bPU_SAMPLER_2D\((.*?)\)/g,function(t,e){return"SAMPLER_2D(P_"+e+")"})).replace(/\bPP_SAMPLER_2D\((.*?)\)/g,function(t,e){return"T_"+e+", S_"+e})).replace(/\bSAMPLER_2D\((.*?)\)/g,function(t,e){return"sampler2D(T_"+e+", S_"+e+")"}):(e=(e=(e=e.replace(/\bPD_SAMPLER_2D\((.*?)\)/g,function(t,e){return"sampler2D P_"+e})).replace(/\bPU_SAMPLER_2D\((.*?)\)/g,function(t,e){return"SAMPLER_2D(P_"+e+")"})).replace(/\bPP_SAMPLER_2D\((.*?)\)/g,function(t,e){return e})).replace(/\bSAMPLER_2D\((.*?)\)/g,function(t,e){return e}),((l?"":t.glslVersion)+"\n\n"+(l&&"frag"===n?"#extension GL_OES_standard_derivatives : enable":"")+"\n"+c+"\n"+h+"\n"+u+"\n"+e+"\n").trim());if(t.explicitBindingLocations&&"frag"===n&&(d=d.replace(/^\b(out)\b/gm,function(t,e){return"layout(location = 0) "+e})),l){"frag"===n&&(d=d.replace(/^\s*in\s+(\S+)\s*(.*);$/gm,function(t,e,n){return"varying "+e+" "+n+";\n"})),d=(d="vert"===n?(d=d.replace(/^\s*out\s+(\S+)\s*(.*);$/gm,function(t,e,n){return"varying "+e+" "+n+";\n"})).replace(/^\s*layout\(location\s*=\s*\S*\)\s*in\s+(\S+)\s*(.*);$/gm,function(t,e,n){return"attribute "+e+" "+n+";\n"}):d).replace(/\s*uniform\s*.*\s*{((?:\s*.*\s*)*?)};/g,function(t,e){return e.trim().replace(/^.*$/gm,function(t){var e=t.trim();return e.startsWith("#")?e:t?"uniform "+e:""})}),"frag"===n&&(c=(d=d.replace(/^\s*out\s+(\S+)\s*(.*);$/gm,function(t,e,n){return e+" "+(s=n)+";\n"})).lastIndexOf("}"),d=d.substring(0,c)+"\n gl_FragColor = vec4("+s+");\n"+d.substring(c)),d=d.replace(/^\s*layout\((.*)\)/gm,"");for(var f=ff(Kp);!(p=f()).done;){var p=p.value,g=p[0],p=p[1];d=d.replace(g,p)}}return d}function Qp(t,e){var n=void 0!==e.defines?e.defines:null,r=(void 0!==e.features&&e.features,void 0!==e.both?e.both+e.vert:e.vert),e=void 0!==e.both?e.both+e.frag:e.frag;return t=t.queryVendorInfo(),{vert:r,frag:e=e,preprocessedVert:Zp(t,"vert",r,r=void 0===(r=n)?null:r),preprocessedFrag:Zp(t,"frag",e,r)}}var Jp=function(){function t(){this.name="(unnamed)",this.preprocessedVert="",this.preprocessedFrag="",this.both="",this.vert="",this.frag="",this.defines={},this.features={MRT:!0}}var e=t.prototype;return e.definesChanged=function(){this.preprocessedVert="",this.preprocessedFrag=""},e.setDefineString=function(t,e){if(null!==e){if(this.defines[t]===e)return!1;this.defines[t]=e}else{if(M(this.defines[t]))return!1;delete this.defines[t]}return this.definesChanged(),!0},e.setDefineBool=function(t,e){return this.setDefineString(t,e?"1":null)},e.getDefineString=function(t){return Jf(this.defines[t])},e.getDefineBool=function(t){t=this.getDefineString(t);return null!==t&&T("1"===t),null!==t},e.ensurePreprocessed=function(t){""===this.preprocessedVert&&(this.preprocessedVert=Zp(t,"vert",this.both+this.vert,this.defines,this.features),this.preprocessedFrag=Zp(t,"frag",this.both+this.frag,this.defines,this.features))},t}(),tg=function(){function t(t){this.device=void 0,this.uniformBufferWordAlignment=void 0,this.uniformBufferMaxPageWordSize=void 0,this.currentBufferWordSize=-1,this.currentWordOffset=0,this.buffer=null,this.shadowBufferF32=null,this.shadowBufferU8=null;t=(this.device=t).queryLimits();this.uniformBufferWordAlignment=t.uniformBufferWordAlignment,this.uniformBufferMaxPageWordSize=t.uniformBufferMaxPageWordSize}var e=t.prototype;return e.isSupportedUBO=function(){return"WebGL1"!==this.device.queryVendorInfo().platformString},e.findPageIndex=function(t){return t/this.uniformBufferMaxPageWordSize|0},e.allocateChunk=function(t){T((t=ep(t,this.uniformBufferWordAlignment))<this.uniformBufferMaxPageWordSize);var e=this.currentWordOffset;return this.findPageIndex(e)!==this.findPageIndex(e+t-1)&&(e=ep(e,this.uniformBufferMaxPageWordSize)),this.currentWordOffset=e+t,this.ensureShadowBuffer(e,t),e},e.ensureShadowBuffer=function(t,e){if(null===this.shadowBufferU8||null===this.shadowBufferF32){var n=ep(this.currentWordOffset,this.uniformBufferMaxPageWordSize);this.shadowBufferU8=new Uint8Array(4*n),this.shadowBufferF32=new Float32Array(this.shadowBufferU8.buffer)}else if(t+e>=this.shadowBufferF32.length){T(t<this.currentWordOffset&&t+e<=this.currentWordOffset);n=ep(Math.max(this.currentWordOffset,2*this.shadowBufferF32.length),this.uniformBufferMaxPageWordSize),t=new Uint8Array(4*n);if(t.set(this.shadowBufferU8,0),this.shadowBufferU8=t,this.shadowBufferF32=new Float32Array(this.shadowBufferU8.buffer),!(this.currentWordOffset<=n))throw new Error("Assert fail: this.currentWordOffset ["+this.currentWordOffset+"] <= newWordCount ["+n+"]")}},e.mapBufferF32=function(){return Hf(this.shadowBufferF32)},e.prepareToRender=function(){if(null!==this.shadowBufferF32){var t=Hf(this.shadowBufferF32),t=(t.length!==this.currentBufferWordSize&&(this.currentBufferWordSize=t.length,null!==this.buffer&&this.buffer.destroy(),this.buffer=this.device.createBuffer({viewOrSize:this.currentBufferWordSize,usage:wf.UNIFORM|wf.COPY_DST,hint:Tf.Dynamic})),ep(this.currentWordOffset,this.uniformBufferMaxPageWordSize));if(!(t<=this.currentBufferWordSize))throw new Error("Assert fail: wordCount ["+t+"] ("+this.currentWordOffset+" aligned "+this.uniformBufferMaxPageWordSize+") <= this.currentBufferWordSize ["+this.currentBufferWordSize+"]");this.isSupportedUBO()&&Hf(this.buffer).setSubData(0,this.shadowBufferU8,0,4*t),this.currentWordOffset=0}},e.destroy=function(){null!==this.buffer&&this.buffer.destroy(),this.shadowBufferF32=null,this.shadowBufferU8=null},t}();function eg(t,e){return(t=(t=(t+=e)+(t<<10))+(t>>>6))>>>0}function ng(t){return(t=(t=(t+=t<<3)^t>>>11)+(t<<15))>>>0}function rg(t){return 0}function ig(){this.keys=[],this.values=[]}var og=function(){function t(t,e){this.keyEqualFunc=void 0,this.keyHashFunc=void 0,this.buckets=new Map,this.keyEqualFunc=t,this.keyHashFunc=e}var e=t.prototype;return e.findBucketIndex=function(t,e){for(var n=0;n<t.keys.length;n++)if(this.keyEqualFunc(e,t.keys[n]))return n;return-1},e.findBucket=function(t){t=this.keyHashFunc(t);return this.buckets.get(t)},e.get=function(t){var e=this.findBucket(t);return void 0===e||(t=this.findBucketIndex(e,t))<0?null:e.values[t]},e.add=function(t,e){var n=this.keyHashFunc(t),n=(void 0===this.buckets.get(n)&&this.buckets.set(n,new ig),this.buckets.get(n));n.keys.push(t),n.values.push(e)},e.delete=function(t){var e=this.findBucket(t);void 0!==e&&-1!==(t=this.findBucketIndex(e,t))&&(e.keys.splice(t,1),e.values.splice(t,1))},e.clear=function(){this.buckets.clear()},e.size=function(){for(var t,e=0,n=ff(this.buckets.values());!(t=n()).done;)e+=t.value.values.length;return e},e.values=ef().mark(function t(){var e,n,r;return ef().wrap(function(t){for(;;)switch(t.prev=t.next){case 0:e=ff(this.buckets.values());case 1:if((n=e()).done){t.next=12;break}n=n.value,r=n.values.length-1;case 4:if(0<=r)return t.next=7,n.values[r];t.next=10;break;case 7:r--,t.next=4;break;case 10:t.next=1;break;case 12:case"end":return t.stop()}},t,this)}),t}();function ag(t,e){return T(""!==t.preprocessedVert&&""!==e.preprocessedVert),T(""!==t.preprocessedFrag&&""!==e.preprocessedFrag),t.preprocessedVert===e.preprocessedVert&&t.preprocessedFrag===e.preprocessedFrag}function sg(t,e){return t=eg(t,e.blendMode),t=eg(t,e.blendSrcFactor),t=eg(t,e.blendDstFactor)}function lg(t,e){for(var n,r,i,o,a=0;a<e.attachmentsState.length;a++)n=t,r=e.attachmentsState[a],n=sg(n,r.rgbBlendState),t=n=eg(n=sg(n,r.alphaBlendState),r.channelWriteMask);return i=t,o=e.blendConstant,t=i=eg(i,o.r<<24|o.g<<16|o.b<<8|o.a),t=eg(t,e.depthCompare),t=eg(t,e.depthWrite?1:0),t=eg(t,e.stencilCompare),t=eg(t,e.stencilPassOp),t=eg(t,e.stencilWrite?1:0),t=eg(t,e.cullMode),t=eg(t,e.frontFace?1:0),t=eg(t,e.polygonOffset?1:0)}function ug(t){var e=eg(e=0,t.program.id);null!==t.inputLayout&&(e=eg(e,t.inputLayout.id));for(var n,r,i=0;i<t.bindingLayouts.length;i++)n=e,r=t.bindingLayouts[i],n=eg(n,r.numUniformBuffers),e=n=eg(n,r.numSamplers);e=lg(e,t.megaStateDescriptor);for(var o=0;o<t.colorAttachmentFormats.length;o++)e=eg(e,t.colorAttachmentFormats[o]||0);return ng(e=eg(e,t.depthStencilAttachmentFormat||0))}function cg(t){for(var e=0,n=0;n<t.samplerBindings.length;n++){var r=t.samplerBindings[n];null!==r&&null!==r.texture&&(e=eg(e,r.texture.id))}for(var i=0;i<t.uniformBufferBindings.length;i++){var o=t.uniformBufferBindings[i];null!==o&&null!==o.buffer&&(e=eg(e,o.buffer.id),e=eg(e,o.wordCount))}return ng(e)}function hg(){this.renderTargetDescriptions=[],this.resolveTextureRenderTargetIDs=[],this.passes=[],this.renderTargetDebugNames=[]}var dg,fg,pg,gg=function(){function t(t){this.device=void 0,this.bindingsCache=new og(vp,cg),this.renderPipelinesCache=new og(xp,ug),this.inputLayoutsCache=new og(Tp,rg),this.programCache=new og(ag,rg),this.samplerCache=new og(Ap,rg),this.device=t}var e=t.prototype;return e.createBindings=function(t){var e=this.bindingsCache.get(t);return null===e&&(t={bindingLayout:(t=t).bindingLayout,samplerBindings:pp(t.samplerBindings,Mp),uniformBufferBindings:pp(t.uniformBufferBindings,Rp),pipeline:t.pipeline},e=this.device.createBindings(t),this.bindingsCache.add(t,e)),e},e.createRenderPipeline=function(t){var e,n,r,i,o=this.renderPipelinesCache.get(t);return null===o&&(e=pp((t=t).bindingLayouts,Cp),n=t.inputLayout,r=t.program,i=t.topology,e={bindingLayouts:e,inputLayout:n,megaStateDescriptor:up(t.megaStateDescriptor),program:r,topology:i,colorAttachmentFormats:t.colorAttachmentFormats.slice(),depthStencilAttachmentFormat:t.depthStencilAttachmentFormat,sampleCount:t.sampleCount},o=this.device.createRenderPipeline(e),this.renderPipelinesCache.add(e,o)),o},e.createInputLayout=function(t){var e=this.inputLayoutsCache.get(t);return null===e&&(t={vertexAttributeDescriptors:pp((t=t).vertexAttributeDescriptors,Pp),vertexBufferDescriptors:pp(t.vertexBufferDescriptors,Op),indexBufferFormat:t.indexBufferFormat},e=this.device.createInputLayout(t),this.inputLayoutsCache.add(t,e)),e},e.createProgramSimple=function(t){var e=this.programCache.get(t);return null===e&&(t={preprocessedVert:t.preprocessedVert,preprocessedFrag:t.preprocessedFrag,vert:t.vert,frag:t.frag},e=this.device.createProgramSimple(t),this.programCache.add(t,e)),e},e.createProgram=function(t){return t.ensurePreprocessed(this.device.queryVendorInfo()),this.createProgramSimple(t)},e.createSampler=function(t){var e=this.samplerCache.get(t);return null===e&&(e=this.device.createSampler(t),this.samplerCache.add(t,e)),e},e.destroy=function(){for(var t,e=ff(this.bindingsCache.values());!(t=e()).done;)t.value.destroy();for(var n,r=ff(this.renderPipelinesCache.values());!(n=r()).done;)n.value.destroy();for(var i,o=ff(this.inputLayoutsCache.values());!(i=o()).done;)i.value.destroy();for(var a,s=ff(this.programCache.values());!(a=s()).done;)a.value.destroy();for(var l,u=ff(this.samplerCache.values());!(l=u()).done;)l.value.destroy();this.bindingsCache.clear(),this.renderPipelinesCache.clear(),this.inputLayoutsCache.clear(),this.programCache.clear(),this.samplerCache.clear()},t}(),mg=((Us=dg=dg||{})[Us.Color0=0]="Color0",Us[Us.Color1=1]="Color1",Us[Us.Color2=2]="Color2",Us[Us.Color3=3]="Color3",Us[Us.ColorMax=3]="ColorMax",Us[Us.DepthStencil=4]="DepthStencil",{x:0,y:0,w:1,h:1}),vg=function(){function t(){this.renderTargetIDs=[],this.resolveTextureOutputIDs=[],this.resolveTextureOutputExternalTextures=[],this.resolveTextureInputIDs=[],this.renderTargetExtraRefs=[],this.viewport=mg,this.resolveTextureInputTextures=[],this.renderTargets=[],this.descriptor={colorAttachment:[],colorResolveTo:[],colorStore:[],depthStencilAttachment:null,depthStencilResolveTo:null,depthStencilStore:!0,colorClearColor:["load"],depthClearValue:"load",stencilClearValue:"load",occlusionQueryPool:null},this.viewportX=0,this.viewportY=0,this.viewportW=0,this.viewportH=0,this.execFunc=null,this.postFunc=null,this.debugName=void 0,this.debugThumbnails=[]}var e=t.prototype;return e.setDebugName=function(t){this.debugName=t},e.pushDebugThumbnail=function(t){this.debugThumbnails[t]=!0},e.setViewport=function(t){this.viewport=t},e.attachRenderTargetID=function(t,e){T(void 0===this.renderTargetIDs[t]),this.renderTargetIDs[t]=e},e.attachResolveTexture=function(t){this.resolveTextureInputIDs.push(t)},e.attachOcclusionQueryPool=function(t){this.descriptor.occlusionQueryPool=t},e.resolveToExternalTexture=function(t,e){this.resolveTextureOutputExternalTextures[t]=e},e.exec=function(t){T(null===this.execFunc),this.execFunc=t},e.post=function(t){T(null===this.postFunc),this.postFunc=t},e.addExtraRef=function(t){this.renderTargetExtraRefs[t]=!0},t}(),yg=function(){function t(t,e){this.debugName=void 0,this.dimension=Rf.n2D,this.depth=1,this.numLevels=1,this.pixelFormat=void 0,this.width=0,this.height=0,this.sampleCount=0,this.usage=Nf.RenderTarget,this.immutable=!0,this.needsClear=!0,this.texture=null,this.attachment=void 0,this.age=0,this.pixelFormat=e.pixelFormat,this.width=e.width,this.height=e.height,this.sampleCount=e.sampleCount,T(1<=this.sampleCount),1<this.sampleCount?this.attachment=t.createRenderTarget(this):(this.texture=t.createTexture(this),this.attachment=t.createRenderTargetFromTexture(this.texture))}var e=t.prototype;return e.setDebugName=function(t,e){this.debugName=e,null!==this.texture&&t.setResourceName(this.texture,this.debugName),t.setResourceName(this.attachment,this.debugName)},e.matchesDescription=function(t){return this.pixelFormat===t.pixelFormat&&this.width===t.width&&this.height===t.height&&this.sampleCount===t.sampleCount},e.reset=function(t){T(this.matchesDescription(t)),this.age=0},e.destroy=function(){null!==this.texture&&this.texture.destroy(),this.attachment.destroy()},t}(),Eg=function(){function t(t,e){this.dimension=Rf.n2D,this.depth=1,this.numLevels=1,this.usage=Nf.RenderTarget,this.pixelFormat=void 0,this.width=0,this.height=0,this.texture=void 0,this.age=0,this.immutable=!0,this.pixelFormat=e.pixelFormat,this.width=e.width,this.height=e.height,this.texture=t.createTexture(this)}var e=t.prototype;return e.matchesDescription=function(t){return this.pixelFormat===t.pixelFormat&&this.width===t.width&&this.height===t.height},e.reset=function(t){T(this.matchesDescription(t)),this.age=0},e.destroy=function(){this.texture.destroy()},t}(),_g=function(){function t(t){this.device=void 0,this.currentPass=null,this.renderTargetDeadPool=[],this.singleSampledTextureDeadPool=[],this.currentGraph=null,this.renderTargetOutputCount=[],this.renderTargetResolveCount=[],this.resolveTextureUseCount=[],this.renderTargetAliveForID=[],this.singleSampledTextureForResolveTextureID=[],this.device=t}var e=t.prototype;return e.acquireRenderTargetForDescription=function(t){for(var e=0;e<this.renderTargetDeadPool.length;e++){var n=this.renderTargetDeadPool[e];if(n.matchesDescription(t))return n.reset(t),this.renderTargetDeadPool.splice(e--,1),n}return new yg(this.device,t)},e.acquireSingleSampledTextureForDescription=function(t){for(var e=0;e<this.singleSampledTextureDeadPool.length;e++){var n=this.singleSampledTextureDeadPool[e];if(n.matchesDescription(t))return n.reset(t),this.singleSampledTextureDeadPool.splice(e--,1),n}return new Eg(this.device,t)},e.beginGraphBuilder=function(){T(null===this.currentGraph),this.currentGraph=new hg},e.pushPass=function(t){var e=new vg;t(e),this.currentGraph.passes.push(e)},e.createRenderTargetID=function(t,e){return this.currentGraph.renderTargetDebugNames.push(e),this.currentGraph.renderTargetDescriptions.push(t)-1},e.createResolveTextureID=function(t){return this.currentGraph.resolveTextureRenderTargetIDs.push(t)-1},e.findMostRecentPassThatAttachedRenderTarget=function(t){for(var e=this.currentGraph.passes.length-1;0<=e;e--){var n=this.currentGraph.passes[e];if(n.renderTargetIDs.includes(t))return n}return null},e.resolveRenderTargetPassAttachmentSlot=function(t,e){var n;return void 0===t.resolveTextureOutputIDs[e]&&(n=t.renderTargetIDs[e],n=this.createResolveTextureID(n),t.resolveTextureOutputIDs[e]=n),t.resolveTextureOutputIDs[e]},e.findPassForResolveRenderTarget=function(t){var e=Hf(this.findMostRecentPassThatAttachedRenderTarget(t)),t=e.renderTargetIDs.indexOf(t);return T(void 0===e.resolveTextureOutputExternalTextures[t]),e},e.resolveRenderTarget=function(t){var e=this.findPassForResolveRenderTarget(t),t=e.renderTargetIDs.indexOf(t);return this.resolveRenderTargetPassAttachmentSlot(e,t)},e.resolveRenderTargetToExternalTexture=function(t,e){var n=this.findPassForResolveRenderTarget(t),t=n.renderTargetIDs.indexOf(t);T(void 0===n.resolveTextureOutputIDs[t]),n.resolveTextureOutputExternalTextures[t]=e},e.getRenderTargetDescription=function(t){return Hf(this.currentGraph.renderTargetDescriptions[t])},e.scheduleAddUseCount=function(t,e){for(var n=0;n<e.renderTargetIDs.length;n++){var r=e.renderTargetIDs[n];void 0!==r&&(this.renderTargetOutputCount[r]++,e.renderTargetExtraRefs[n])&&this.renderTargetOutputCount[r]++}for(var i=0;i<e.resolveTextureInputIDs.length;i++){var o=e.resolveTextureInputIDs[i];void 0!==o&&(this.resolveTextureUseCount[o]++,o=t.resolveTextureRenderTargetIDs[o],this.renderTargetResolveCount[o]++)}},e.acquireRenderTargetForID=function(t,e){var n;return void 0===e?null:(T(0<this.renderTargetOutputCount[e]),this.renderTargetAliveForID[e]||(n=t.renderTargetDescriptions[e],(n=this.acquireRenderTargetForDescription(n)).setDebugName(this.device,t.renderTargetDebugNames[e]),this.renderTargetAliveForID[e]=n),this.renderTargetAliveForID[e])},e.releaseRenderTargetForID=function(t,e){var n;return void 0===t?null:(n=Hf(this.renderTargetAliveForID[t]),e?(T(0<this.renderTargetOutputCount[t]),this.renderTargetOutputCount[t]--):(T(0<this.renderTargetResolveCount[t]),this.renderTargetResolveCount[t]--),0===this.renderTargetOutputCount[t]&&0===this.renderTargetResolveCount[t]&&(n.needsClear=!0,delete this.renderTargetAliveForID[t],this.renderTargetDeadPool.push(n)),n)},e.acquireResolveTextureInputTextureForID=function(t,e){var n,t=t.resolveTextureRenderTargetIDs[e],t=(T(0<this.resolveTextureUseCount[e]),this.resolveTextureUseCount[e]--,Hf(this.releaseRenderTargetForID(t,!1)));return void 0!==this.singleSampledTextureForResolveTextureID[e]?(n=this.singleSampledTextureForResolveTextureID[e],0===this.resolveTextureUseCount[e]&&this.singleSampledTextureDeadPool.push(n),n.texture):Hf(t.texture)},e.determineResolveParam=function(t,e,n){var r=e.renderTargetIDs[n],i=e.resolveTextureOutputIDs[n],e=e.resolveTextureOutputExternalTextures[n],n=void 0!==i,o=void 0!==e,a=(T(!(n&&o)),null),s=!1;return 1<this.renderTargetOutputCount[r]&&(s=!0),n?(T(t.resolveTextureRenderTargetIDs[i]===r),T(0<this.resolveTextureUseCount[i]),T(0<this.renderTargetOutputCount[r]),null!==(n=Hf(this.renderTargetAliveForID[r])).texture&&1===this.renderTargetOutputCount[r]?s=!(a=null):(this.singleSampledTextureForResolveTextureID[i]||(t=Hf(t.renderTargetDescriptions[r]),this.singleSampledTextureForResolveTextureID[i]=this.acquireSingleSampledTextureForDescription(t),this.device.setResourceName(this.singleSampledTextureForResolveTextureID[i].texture,n.debugName+" (Resolve "+i+")")),a=this.singleSampledTextureForResolveTextureID[i].texture)):a=o?e:null,{resolveTo:a,store:s}},e.schedulePass=function(t,e){for(var n=e.renderTargetIDs[dg.DepthStencil],r=dg.Color0;r<=dg.ColorMax;r++){var i=e.renderTargetIDs[r],o=this.acquireRenderTargetForID(t,i),a=(e.renderTargets[r]=o,e.descriptor.colorAttachment[r]=null!==o?o.attachment:null,this.determineResolveParam(t,e,r)),s=a.resolveTo,a=a.store;e.descriptor.colorResolveTo[r]=s,e.descriptor.colorStore[r]=a,e.descriptor.colorClearColor[r]=null!==o&&o.needsClear?t.renderTargetDescriptions[i].colorClearColor:"load"}for(var l=this.acquireRenderTargetForID(t,n),u=(e.renderTargets[dg.DepthStencil]=l,e.descriptor.depthStencilAttachment=null!==l?l.attachment:null,this.determineResolveParam(t,e,dg.DepthStencil)),c=u.resolveTo,u=u.store,h=(e.descriptor.depthStencilResolveTo=c,e.descriptor.depthStencilStore=u,e.descriptor.depthClearValue=null!==l&&l.needsClear?t.renderTargetDescriptions[n].depthClearValue:"load",e.descriptor.stencilClearValue=null!==l&&l.needsClear?t.renderTargetDescriptions[n].stencilClearValue:"load",0),d=0,f=0,p=0;p<e.renderTargets.length;p++){var g=e.renderTargets[p];g&&(0===h&&(h=g.width,d=g.height,f=g.sampleCount),T(g.width===h),T(g.height===d),T(g.sampleCount===f),g.needsClear=!1)}0<h&&0<d&&(c=h*e.viewport.x,u=d*e.viewport.y,l=h*e.viewport.w,n=d*e.viewport.h,e.viewportX=c,e.viewportY=u,e.viewportW=l,e.viewportH=n);for(var m=0;m<e.resolveTextureInputIDs.length;m++){var v=e.resolveTextureInputIDs[m];e.resolveTextureInputTextures[m]=this.acquireResolveTextureInputTextureForID(t,v)}for(var y=0;y<e.renderTargetIDs.length;y++)this.releaseRenderTargetForID(e.renderTargetIDs[y],!0);for(var E=0;E<e.renderTargetExtraRefs.length;E++)e.renderTargetExtraRefs[E]&&this.releaseRenderTargetForID(e.renderTargetIDs[E],!0)},e.scheduleGraph=function(t){T(0===this.renderTargetOutputCount.length),T(0===this.renderTargetResolveCount.length),T(0===this.resolveTextureUseCount.length);for(var e=0;e<this.renderTargetDeadPool.length;e++)this.renderTargetDeadPool[e].age++;for(var n=0;n<this.singleSampledTextureDeadPool.length;n++)this.singleSampledTextureDeadPool[n].age++;tp(this.renderTargetOutputCount,t.renderTargetDescriptions.length,0),tp(this.renderTargetResolveCount,t.renderTargetDescriptions.length,0),tp(this.resolveTextureUseCount,t.resolveTextureRenderTargetIDs.length,0);for(var r=0;r<t.passes.length;r++)this.scheduleAddUseCount(t,t.passes[r]);for(var i=0;i<t.passes.length;i++)this.schedulePass(t,t.passes[i]);for(var o=0;o<this.renderTargetOutputCount.length;o++)T(0===this.renderTargetOutputCount[o]);for(var a=0;a<this.renderTargetResolveCount.length;a++)T(0===this.renderTargetResolveCount[a]);for(var s=0;s<this.resolveTextureUseCount.length;s++)T(0===this.resolveTextureUseCount[s]);for(var l=0;l<this.renderTargetAliveForID.length;l++)T(void 0===this.renderTargetAliveForID[l]);for(var u=0;u<this.renderTargetDeadPool.length;u++)1<=this.renderTargetDeadPool[u].age&&(this.renderTargetDeadPool[u].destroy(),this.renderTargetDeadPool.splice(u--,1));for(var c=0;c<this.singleSampledTextureDeadPool.length;c++)1<=this.singleSampledTextureDeadPool[c].age&&(this.singleSampledTextureDeadPool[c].destroy(),this.singleSampledTextureDeadPool.splice(c--,1));this.renderTargetResolveCount.length=0,this.renderTargetOutputCount.length=0,this.resolveTextureUseCount.length=0},e.execPass=function(t){T(null===this.currentPass),this.currentPass=t;var e=this.device.createRenderPass(t.descriptor);e.beginDebugGroup(t.debugName),e.setViewport(t.viewportX,t.viewportY,t.viewportW,t.viewportH),null!==t.execFunc&&t.execFunc(e,this),e.endDebugGroup(),this.device.submitPass(e),null!==t.postFunc&&t.postFunc(this),this.currentPass=null},e.execGraph=function(t){var e=this;this.scheduleGraph(t),t.passes.forEach(function(t){e.execPass(t)}),this.singleSampledTextureForResolveTextureID.length=0},e.execute=function(){var t=Hf(this.currentGraph);this.execGraph(t),this.currentGraph=null},e.getDebug=function(){return this},e.getPasses=function(){return this.currentGraph.passes},e.getPassDebugThumbnails=function(t){return t.debugThumbnails},e.getPassRenderTargetID=function(t,e){return t.renderTargetIDs[e]},e.getRenderTargetIDDebugName=function(t){return this.currentGraph.renderTargetDebugNames[t]},e.getResolveTextureForID=function(t){var e=this.currentPass,t=e.resolveTextureInputIDs.indexOf(t);return T(0<=t),Hf(e.resolveTextureInputTextures[t])},e.getRenderTargetAttachment=function(t){t=this.currentPass.renderTargets[t];return t?t.attachment:null},e.getRenderTargetTexture=function(t){t=this.currentPass.renderTargets[t];return t?t.texture:null},e.newGraphBuilder=function(){return this.beginGraphBuilder(),this},e.destroy=function(){for(var t=0;t<this.renderTargetAliveForID.length;t++)T(void 0===this.renderTargetAliveForID[t]);for(var e=0;e<this.singleSampledTextureForResolveTextureID.length;e++)T(void 0===this.singleSampledTextureForResolveTextureID[e]);for(var n=0;n<this.renderTargetDeadPool.length;n++)this.renderTargetDeadPool[n].destroy();for(var r=0;r<this.singleSampledTextureDeadPool.length;r++)this.singleSampledTextureDeadPool[r].destroy()},t}();(pa=fg=fg||{})[pa.BACKGROUND=0]="BACKGROUND",pa[pa.ALPHA_TEST=16]="ALPHA_TEST",pa[pa.OPAQUE=32]="OPAQUE",pa[pa.TRANSLUCENT=128]="TRANSLUCENT",Z(1,0,0,0,0,1,0,0,0,0,2,0,0,0,-1,1),Z(1,0,0,0,0,1,0,0,0,0,.5,0,0,0,.5,1),(l=pg=pg||{})[l.Indexed=1]="Indexed",l[l.AllowSkippingIfPipelineNotReady=2]="AllowSkippingIfPipelineNotReady",l[l.Template=4]="Template",l[l.Draw=8]="Draw",l[l.InheritedFlags=3]="InheritedFlags";var bg,xg=function(){function t(){this.sortKey=0,this.debug=null,this.renderPipelineDescriptor=void 0,this.uniformBuffer=void 0,this.uniforms=[],this.bindingDescriptors=ip(1,function(){return{bindingLayout:null,samplerBindings:[],uniformBufferBindings:[]}}),this.dynamicUniformBufferByteOffsets=ip(4,function(){return 0}),this.flags=0,this.inputState=null,this.drawStart=0,this.drawCount=0,this.drawInstanceCount=0,this.renderPipelineDescriptor={bindingLayouts:[],inputLayout:null,megaStateDescriptor:up(cp),program:null,topology:Sf.Triangles,colorAttachmentFormats:[],depthStencilAttachmentFormat:null,sampleCount:1},this.reset()}var e=t.prototype;return e.reset=function(){this.sortKey=0,this.flags=pg.AllowSkippingIfPipelineNotReady,this.inputState=null,this.renderPipelineDescriptor.inputLayout=null},e.setFromTemplate=function(t){lp(this.renderPipelineDescriptor.megaStateDescriptor,t.renderPipelineDescriptor.megaStateDescriptor),this.renderPipelineDescriptor.program=t.renderPipelineDescriptor.program,this.renderPipelineDescriptor.inputLayout=t.renderPipelineDescriptor.inputLayout,this.renderPipelineDescriptor.topology=t.renderPipelineDescriptor.topology,this.renderPipelineDescriptor.colorAttachmentFormats.length=Math.max(this.renderPipelineDescriptor.colorAttachmentFormats.length,t.renderPipelineDescriptor.colorAttachmentFormats.length);for(var e=0;e<t.renderPipelineDescriptor.colorAttachmentFormats.length;e++)this.renderPipelineDescriptor.colorAttachmentFormats[e]=t.renderPipelineDescriptor.colorAttachmentFormats[e];this.renderPipelineDescriptor.depthStencilAttachmentFormat=t.renderPipelineDescriptor.depthStencilAttachmentFormat,this.renderPipelineDescriptor.sampleCount=t.renderPipelineDescriptor.sampleCount,this.inputState=t.inputState,this.uniformBuffer=t.uniformBuffer,this.uniforms=[].concat(t.uniforms),this.drawCount=t.drawCount,this.drawStart=t.drawStart,this.drawInstanceCount=t.drawInstanceCount,this.flags=this.flags&~pg.InheritedFlags|t.flags&pg.InheritedFlags,this.sortKey=t.sortKey;var n=this.bindingDescriptors[0],r=t.bindingDescriptors[0];null!==r.bindingLayout&&this.setBindingLayout(r.bindingLayout);for(var i=0;i<Math.min(n.uniformBufferBindings.length,r.uniformBufferBindings.length);i++)n.uniformBufferBindings[i].wordCount=t.bindingDescriptors[0].uniformBufferBindings[i].wordCount;this.setSamplerBindingsFromTextureMappings(r.samplerBindings);for(var o=0;o<t.dynamicUniformBufferByteOffsets.length;o++)this.dynamicUniformBufferByteOffsets[o]=t.dynamicUniformBufferByteOffsets[o]},e.setProgram=function(t){this.renderPipelineDescriptor.program=t},e.setMegaStateFlags=function(t){return lp(this.renderPipelineDescriptor.megaStateDescriptor,t),this.renderPipelineDescriptor.megaStateDescriptor},e.getMegaStateFlags=function(){return this.renderPipelineDescriptor.megaStateDescriptor},e.setInputLayoutAndState=function(t,e){this.inputState=e,this.renderPipelineDescriptor.inputLayout=t},e.setBindingLayout=function(t){T(t.numUniformBuffers<this.dynamicUniformBufferByteOffsets.length),this.renderPipelineDescriptor.bindingLayouts[0]=t,this.bindingDescriptors[0].bindingLayout=t;for(var e=this.bindingDescriptors[0].uniformBufferBindings.length;e<t.numUniformBuffers;e++)this.bindingDescriptors[0].uniformBufferBindings.push({buffer:null,wordCount:0});for(var n=this.bindingDescriptors[0].samplerBindings.length;n<t.numSamplers;n++)this.bindingDescriptors[0].samplerBindings.push({sampler:null,texture:null,lateBinding:null})},e.setBindingLayouts=function(t){T(t.length<=this.bindingDescriptors.length),T(1===t.length),this.setBindingLayout(t[0])},e.drawIndexes=function(t,e){void 0===e&&(e=0),this.flags=rp(this.flags,pg.Indexed,!0),this.drawCount=t,this.drawStart=e,this.drawInstanceCount=1},e.drawIndexesInstanced=function(t,e,n){void 0===n&&(n=0),this.flags=rp(this.flags,pg.Indexed,!0),this.drawCount=t,this.drawStart=n,this.drawInstanceCount=e},e.drawPrimitives=function(t,e){void 0===e&&(e=0),this.flags=rp(this.flags,pg.Indexed,!1),this.drawCount=t,this.drawStart=e,this.drawInstanceCount=1},e.setUniforms=function(t,e){if(0!==e.length){this.uniforms[t]=e;var i=0,o=[],n=(e.forEach(function(t){t=t.value;if(B(t)||Array.isArray(t)||t instanceof Float32Array){var t=B(t)?[t]:t,e=4<t.length?4:t.length,n=4-i%4;if(4!=n&&!(e<=n)){i+=n;for(var r=0;r<n;r++)o.push(0)}i+=t.length,o.push.apply(o,t)}}),4-o.length%4);if(4!=n)for(var r=0;r<n;r++)o.push(0);for(var a,s,l,u,c,h,d=this.allocateUniformBuffer(t,o.length),f=this.mapUniformBufferF32(t),p=0;p<o.length;p+=4)d+=(s=d,l=o[p],void 0===(u=o[p+1])&&(u=0),void 0===(c=o[p+2])&&(c=0),void 0===(h=o[p+3])&&(h=0),(a=f)[s+0]=l,a[s+1]=u,a[s+2]=c,a[s+3]=h,4)}},e.setUniformBuffer=function(t){this.uniformBuffer=t},e.allocateUniformBuffer=function(t,e){return T(this.bindingDescriptors[0].bindingLayout.numUniformBuffers<this.dynamicUniformBufferByteOffsets.length),this.dynamicUniformBufferByteOffsets[t]=this.uniformBuffer.allocateChunk(e)<<2,this.bindingDescriptors[0].uniformBufferBindings[t].wordCount=e,this.getUniformBufferOffset(t)},e.getUniformBufferOffset=function(t){return this.dynamicUniformBufferByteOffsets[t]>>>2},e.setUniformBufferOffset=function(t,e,n){this.dynamicUniformBufferByteOffsets[t]=e<<2,this.bindingDescriptors[0].uniformBufferBindings[t].wordCount=n},e.mapUniformBufferF32=function(t){return this.uniformBuffer.mapBufferF32()},e.getUniformBuffer=function(){return this.uniformBuffer},e.setSamplerBindingsFromTextureMappings=function(t){t=t.filter(function(t){return t});for(var e=0;e<this.bindingDescriptors[0].samplerBindings.length;e++){var n=this.bindingDescriptors[0].samplerBindings[e],r=t[e];null==r?(n.texture=null,n.sampler=null,n.lateBinding=null):(n.texture=r.texture,n.sampler=r.sampler,n.lateBinding=r.lateBinding)}},e.hasLateSamplerBinding=function(t){for(var e=0;e<this.bindingDescriptors[0].samplerBindings.length;e++)if(this.bindingDescriptors[0].samplerBindings[e].lateBinding===t)return!0;return!1},e.resolveLateSamplerBinding=function(t,e){for(var n=0;n<this.bindingDescriptors[0].samplerBindings.length;n++){var r=this.bindingDescriptors[0].samplerBindings[n];r.lateBinding===t&&(null===e?(r.texture=null,r.sampler=null):(T(null===e.lateBinding),r.texture=e.texture,null!==e.sampler&&(r.sampler=e.sampler)),r.lateBinding=null)}},e.setAllowSkippingIfPipelineNotReady=function(t){this.flags=rp(this.flags,pg.AllowSkippingIfPipelineNotReady,t)},e.setAttachmentFormatsFromRenderPass=function(t,e){for(var n=t.queryRenderPass(e),r=-1,i=0;i<n.colorAttachment.length;i++){var o=null!==n.colorAttachment[i]?t.queryRenderTarget(n.colorAttachment[i]):null;this.renderPipelineDescriptor.colorAttachmentFormats[i]=null!==o?o.pixelFormat:null,null!==o&&(-1===r?r=o.sampleCount:T(r===o.sampleCount))}e=null!==n.depthStencilAttachment?t.queryRenderTarget(n.depthStencilAttachment):null;this.renderPipelineDescriptor.depthStencilAttachmentFormat=null!==e?e.pixelFormat:null,null!==e&&(-1===r?r=e.sampleCount:T(r==e.sampleCount)),T(0<r),this.renderPipelineDescriptor.sampleCount=r},e.drawOnPass=function(t,e){var r=this,n=t.device,i=(this.setAttachmentFormatsFromRenderPass(n,e),t.createRenderPipeline(this.renderPipelineDescriptor));if(!n.pipelineQueryReady(i)){if(this.flags&pg.AllowSkippingIfPipelineNotReady)return!1;n.pipelineForceReady(i)}e.setPipeline(i),e.setInputState(this.inputState);for(var o=0;o<this.bindingDescriptors[0].uniformBufferBindings.length;o++)this.bindingDescriptors[0].uniformBufferBindings[o].buffer=Hf(this.uniformBuffer.buffer);this.renderPipelineDescriptor.program.gl_program&&this.uniforms.forEach(function(t){var n={};t.forEach(function(t){var e=t.name,t=t.value;n[e]=t}),r.renderPipelineDescriptor.program.setUniforms(n)});n=t.createBindings(sf({},this.bindingDescriptors[0],{pipeline:i}));return e.setBindings(0,n,this.dynamicUniformBufferByteOffsets),1<this.drawInstanceCount?(T(!!(this.flags&pg.Indexed)),e.drawIndexedInstanced(this.drawCount,this.drawStart,this.drawInstanceCount)):this.flags&pg.Indexed?e.drawIndexed(this.drawCount,this.drawStart):e.draw(this.drawCount,this.drawStart),!0},t}();function Sg(t,e){return t.sortKey-e.sortKey}(Ea=bg=bg||{})[Ea.Forwards=0]="Forwards",Ea[Ea.Backwards=1]="Backwards";var wg=function(){function t(t,e){void 0===t&&(t=Sg),void 0===e&&(e=bg.Forwards),this.renderInsts=[],this.compareFunction=void 0,this.executionOrder=void 0,this.usePostSort=!1,this.compareFunction=t,this.executionOrder=e}var e=t.prototype;return e.checkUsePostSort=function(){this.usePostSort=null!==this.compareFunction&&500<=this.renderInsts.length},e.insertSorted=function(t){null===this.compareFunction||this.usePostSort?this.renderInsts.push(t):np(this.renderInsts,t,this.compareFunction),this.checkUsePostSort()},e.submitRenderInst=function(t){t.flags|=pg.Draw,this.insertSorted(t)},e.hasLateSamplerBinding=function(t){for(var e=0;e<this.renderInsts.length;e++)if(this.renderInsts[e].hasLateSamplerBinding(t))return!0;return!1},e.resolveLateSamplerBinding=function(t,e){for(var n=0;n<this.renderInsts.length;n++)this.renderInsts[n].resolveLateSamplerBinding(t,e)},e.ensureSorted=function(){this.usePostSort&&(0!==this.renderInsts.length&&this.renderInsts.sort(this.compareFunction),this.usePostSort=!1)},e.drawOnPassRendererNoReset=function(t,e){this.ensureSorted();var n=0;if(this.executionOrder===bg.Forwards)for(var r=0;r<this.renderInsts.length;r++)this.renderInsts[r].drawOnPass(t,e)&&n++;else for(var i=this.renderInsts.length-1;0<=i;i--)this.renderInsts[i].drawOnPass(t,e)&&n++;return n},e.reset=function(){this.renderInsts.length=0},e.drawOnPassRenderer=function(t,e){this.drawOnPassRendererNoReset(t,e),this.reset()},t}(),Tg=function(){function t(){this.pool=[],this.allocCount=0}var e=t.prototype;return e.allocRenderInstIndex=function(){return this.allocCount++,this.allocCount>this.pool.length&&this.pool.push(new xg),this.allocCount-1},e.popRenderInst=function(){this.allocCount--},e.reset=function(){for(var t=0;t<this.pool.length;t++)this.pool[t].reset();this.allocCount=0},e.destroy=function(){this.pool.length=0,this.allocCount=0},t}(),Ag=function(){function t(t){this.renderCache=void 0,this.instPool=new Tg,this.templatePool=new Tg,this.simpleRenderInstList=new wg,this.currentRenderInstList=this.simpleRenderInstList,this.renderCache=t}var e=t.prototype;return e.newRenderInst=function(){var t=this.templatePool.allocCount-1,e=this.instPool.allocRenderInstIndex(),e=this.instPool.pool[e];return e.debug=null,0<=t&&e.setFromTemplate(this.templatePool.pool[t]),e},e.submitRenderInst=function(t,e){(e=void 0===e?this.currentRenderInstList:e).submitRenderInst(t)},e.setCurrentRenderInstList=function(t){T(null===this.simpleRenderInstList),this.currentRenderInstList=t},e.pushTemplateRenderInst=function(){var t=this.templatePool.allocCount-1,e=this.templatePool.allocRenderInstIndex(),e=this.templatePool.pool[e];return 0<=t&&e.setFromTemplate(this.templatePool.pool[t]),e.flags|=pg.Template,e},e.popTemplateRenderInst=function(){this.templatePool.popRenderInst()},e.getTemplateRenderInst=function(){var t=this.templatePool.allocCount-1;return this.templatePool.pool[t]},e.resetRenderInsts=function(){this.instPool.reset(),null!==this.simpleRenderInstList&&this.simpleRenderInstList.reset(),T(0===this.templatePool.allocCount)},e.destroy=function(){this.instPool.destroy(),this.renderCache.destroy()},e.disableSimpleMode=function(){this.simpleRenderInstList=null},e.drawOnPassRenderer=function(t){Hf(this.simpleRenderInstList).drawOnPassRenderer(this.renderCache,t)},e.drawOnPassRendererNoReset=function(t){Hf(this.simpleRenderInstList).drawOnPassRendererNoReset(this.renderCache,t)},t}(),Mg=function(){function t(){this.renderCache=void 0,this.renderGraph=void 0,this.renderInstManager=void 0,this.uniformBuffer=void 0,this.device=void 0}var e=t.prototype;return e.getDevice=function(){return this.device},e.setDevice=function(t){this.device=t,this.renderCache=new gg(t),this.renderGraph=new _g(this.device),this.renderInstManager=new Ag(this.renderCache),this.uniformBuffer=new tg(this.device)},e.pushTemplateRenderInst=function(){var t=this.renderInstManager.pushTemplateRenderInst();return t.setUniformBuffer(this.uniformBuffer),t},e.prepareToRender=function(){this.uniformBuffer.prepareToRender()},e.destroy=function(){this.uniformBuffer&&this.uniformBuffer.destroy(),this.renderInstManager&&this.renderInstManager.destroy(),this.renderCache.destroy(),this.renderGraph.destroy()},e.getCache=function(){return this.renderCache},t}(),Rg=function(){function t(t){this.pixelFormat=void 0,this.width=0,this.height=0,this.sampleCount=0,this.colorClearColor="load",this.depthClearValue="load",this.stencilClearValue="load",this.pixelFormat=t}var e=t.prototype;return e.setDimensions=function(t,e,n){this.width=t,this.height=e,this.sampleCount=n},e.copyDimensions=function(t){this.width=t.width,this.height=t.height,this.sampleCount=t.sampleCount},t}();function Ng(t){return{colorClearColor:t,depthClearValue:1,stencilClearValue:0}}Ng(qf(.88,.88,.88,1));var Cg,Pg=Ng(Fs);function Og(t,e){var n=e.antialiasingMode===Cg.MSAAx4?4:1;t.setDimensions(e.backbufferWidth,e.backbufferHeight,n)}function Ig(t,e,n){t=function(t){if(t===dg.Color0)return S.U8_RGBA_RT;if(t===dg.DepthStencil)return S.D24_S8;throw new Error("whoops")}(t),t=new Rg(t);return Og(t,e),null!==n&&(t.colorClearColor=n.colorClearColor,t.depthClearValue=n.depthClearValue,t.stencilClearValue=n.stencilClearValue),t}(_a=Cg=Cg||{})[_a.None=0]="None",_a[_a.FXAA=1]="FXAA",_a[_a.MSAAx4=2]="MSAAx4";var Lg,kg,Dg,Bg=function(){function t(){this.name=void 0,this.texture=null,this.sampler=null,this.lateBinding=null,this.width=0,this.height=0,this.lodBias=0}var e=t.prototype;return e.reset=function(){this.texture=null,this.sampler=null,this.lateBinding=null,this.width=0,this.height=0,this.lodBias=0},e.copy=function(t){this.texture=t.texture,this.sampler=t.sampler,this.lateBinding=t.lateBinding,this.width=t.width,this.height=t.height,this.lodBias=t.lodBias},t}(),Fg=["style"],Ug=function(n){function r(t){var t=void 0===t?{}:t,e=t.style,t=cf(t,Fg);return n.call(this,sf({type:r.tag,style:sf({intensity:Math.PI},e)},t))||this}return lf(r,n),r}(as),Gg=(Ug.tag="light",["style"]),Wg=((ba=Lg=Lg||{})[ba.NONE=0]="NONE",ba[ba.EXP=1]="EXP",ba[ba.EXP2=2]="EXP2",ba[ba.LINEAR=3]="LINEAR",function(n){function r(t){var t=void 0===t?{}:t,e=t.style,t=cf(t,Gg);return n.call(this,sf({type:r.tag,style:sf({type:Lg.NONE,fill:"black",start:1,end:1e3,density:0},e)},t))||this}return lf(r,n),r}(as)),Vg=(Wg.tag="fog",(r=kg=kg||{}).PROJECTION_MATRIX="u_ProjectionMatrix",r.VIEW_MATRIX="u_ViewMatrix",r.CAMERA_POSITION="u_CameraPosition",r.DEVICE_PIXEL_RATIO="u_DevicePixelRatio",r.VIEWPORT="u_Viewport",r.IS_ORTHO="u_IsOrtho",r.IS_PICKING="u_IsPicking",function(){function e(t,e,n,r){this.renderHelper=void 0,this.lightPool=void 0,this.texturePool=void 0,this.batchManager=void 0,this.context=void 0,this.device=void 0,this.swapChain=void 0,this.renderLists={world:new wg,picking:new wg},this.builder=void 0,this.enableCapture=void 0,this.captureOptions=void 0,this.capturePromise=void 0,this.resolveCapturePromise=void 0,this.renderHelper=t,this.lightPool=e,this.texturePool=n,this.batchManager=r}var t=e.prototype;return t.getDevice=function(){return this.device},t.getSwapChain=function(){return this.swapChain},t.getRenderLists=function(){return this.renderLists},t.apply=function(i){function o(t){var e;(t=t.target).nodeName===Ug.tag?c.lightPool.addLight(t):t.nodeName===Wg.tag?c.lightPool.addFog(t):(e=new pf,t.renderable3D=e,c.batchManager.add(t))}function a(t){(t=t.target).nodeName===Ug.tag?c.lightPool.removeLight(t):t.nodeName===Wg.tag?c.lightPool.removeFog(t):(c.batchManager.remove(t),delete t.renderable3D)}function s(t){var e=t.target,n=t.attrName,t=t.newValue;c.batchManager.updateAttribute(e,n,t)}function l(t){t=t.target,c.batchManager.updateAttribute(t,"modelMatrix",null)}function u(t){var e=t.target,t=t.detail.renderOrder;c.batchManager.changeRenderOrder(e,t)}var c=this,t=(this.context=i).renderingService,h=i.renderingContext.root.ownerDocument.defaultView;t.hooks.init.tapPromise(e.tag,rf(ef().mark(function t(){var e,n,r;return ef().wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return h.addEventListener(v.MOUNTED,o),h.addEventListener(v.UNMOUNTED,a),h.addEventListener(v.ATTR_MODIFIED,s),h.addEventListener(v.BOUNDS_CHANGED,l),h.addEventListener(v.RENDER_ORDER_CHANGED,u),c.context.config.renderer.getConfig().enableDirtyRectangleRendering=!1,e=c.context.contextService.getDomElement(),r=c.context.config,n=r.width,r=r.height,c.context.contextService.resize(n,r),t.next=11,c.context.deviceContribution.createSwapChain(e);case 11:c.swapChain=t.sent,c.device=c.swapChain.getDevice(),c.renderHelper.setDevice(c.device),c.renderHelper.renderInstManager.disableSimpleMode(),c.swapChain.configureSwapChain(e.width,e.height),h.addEventListener(qs.RESIZE,function(){c.swapChain.configureSwapChain(e.width,e.height)}),c.batchManager.attach(sf({device:c.device},i));case 18:case"end":return t.stop()}},t)}))),t.hooks.destroy.tap(e.tag,function(){c.renderHelper.destroy(),h.removeEventListener(v.MOUNTED,o),h.removeEventListener(v.UNMOUNTED,a),h.removeEventListener(v.ATTR_MODIFIED,s),h.removeEventListener(v.BOUNDS_CHANGED,l),h.removeEventListener(v.RENDER_ORDER_CHANGED,u)}),t.hooks.beginFrame.tap(e.tag,function(){var t=c.swapChain.getCanvas(),e=c.renderHelper.renderInstManager,n=(c.builder=c.renderHelper.renderGraph.newGraphBuilder(),Ao(c.context.config.background)),n=c.context.config.background?qf(Number(n.r)/255*Number(n.alpha),Number(n.g)/255*Number(n.alpha),Number(n.b)/255*Number(n.alpha),Number(n.alpha)):$f,t={backbufferWidth:t.width,backbufferHeight:t.height,antialiasingMode:Cg.None},n=Ig(dg.Color0,t,Ng(n)),t=Ig(dg.DepthStencil,t,Pg),r=c.builder.createRenderTargetID(n,"Main Color"),i=c.builder.createRenderTargetID(t,"Main Depth");c.builder.pushPass(function(t){t.setDebugName("Main Render Pass"),t.attachRenderTargetID(dg.Color0,r),t.attachRenderTargetID(dg.DepthStencil,i),t.exec(function(t){c.renderLists.world.drawOnPassRenderer(e.renderCache,t)})}),c.builder.resolveRenderTargetToExternalTexture(r,c.swapChain.getOnscreenTexture())}),t.hooks.endFrame.tap(e.tag,function(){var t=c.renderHelper.renderInstManager,e=c.renderHelper.pushTemplateRenderInst(),n=(e.setBindingLayouts([{numUniformBuffers:2,numSamplers:0}]),e.setMegaStateFlags(hp({depthWrite:!0,blendConstant:$f},{rgbBlendMode:Ef.Add,alphaBlendMode:Ef.Add,rgbBlendSrcFactor:yf.SrcAlpha,alphaBlendSrcFactor:yf.One,rgbBlendDstFactor:yf.OneMinusSrcAlpha,alphaBlendDstFactor:yf.OneMinusSrcAlpha})),c.context.config),r=n.width,n=n.height,i=c.context.camera;e.setUniforms(0,[{name:kg.PROJECTION_MATRIX,value:i.getPerspective()},{name:kg.VIEW_MATRIX,value:i.getViewTransform()},{name:kg.CAMERA_POSITION,value:i.getPosition()},{name:kg.DEVICE_PIXEL_RATIO,value:c.context.contextService.getDPR()},{name:kg.VIEWPORT,value:[r,n]},{name:kg.IS_ORTHO,value:i.isOrtho()?1:0},{name:kg.IS_PICKING,value:0}]),c.batchManager.render(c.renderLists.world),t.popTemplateRenderInst(),c.renderHelper.prepareToRender(),c.renderHelper.renderGraph.execute(),t.resetRenderInsts(),c.swapChain.present(),c.enableCapture&&c.resolveCapturePromise&&(r=(e=c.captureOptions).type,n=e.encoderOptions,i=c.context.contextService.getDomElement().toDataURL(r,n),c.resolveCapturePromise(i),c.enableCapture=!1,c.captureOptions=void 0,c.resolveCapturePromise=void 0)})},t.loadTexture=function(t,e,n){return this.texturePool.getOrCreateTexture(this.device,t,e,function(t){n&&n(t)})},t.toDataURL=function(){var e=rf(ef().mark(function t(e){var n=this;return ef().wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return this.enableCapture=!0,this.captureOptions=e,this.capturePromise=new Promise(function(e){n.resolveCapturePromise=function(t){e(t)}}),t.abrupt("return",this.capturePromise);case 4:case"end":return t.stop()}},t,this)}));return function(t){return e.apply(this,arguments)}}(),e}()),jg=(Vg.tag="RenderGraph",function(){function o(t,e,n,r){this.renderHelper=void 0,this.renderGraphPlugin=void 0,this.pickingIdGenerator=void 0,this.batchManager=void 0,this.context=void 0,this.renderHelper=t,this.renderGraphPlugin=e,this.pickingIdGenerator=n,this.batchManager=r}var t=o.prototype;return t.apply=function(t){function e(t){var e=(t=t.target).renderable3D;e&&(t=n.pickingIdGenerator.getId(t),e.pickingId=t,e.encodedPickingColor=n.pickingIdGenerator.encodePickingColor(t))}var n=this,r=(this.context=t).renderingService,i=t.renderingContext.root.ownerDocument.defaultView;r.hooks.init.tapPromise(o.tag,rf(ef().mark(function t(){return ef().wrap(function(t){for(;;)switch(t.prev=t.next){case 0:i.addEventListener(v.MOUNTED,e);case 1:case"end":return t.stop()}},t)}))),r.hooks.destroy.tap(o.tag,function(){i.removeEventListener(v.MOUNTED,e)}),r.hooks.pickSync.tap(o.tag,function(t){return n.pick(t)}),r.hooks.pick.tapPromise(o.tag,function(){var e=rf(ef().mark(function t(e){return ef().wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",n.pick(e));case 1:case"end":return t.stop()}},t)}));return function(t){return e.apply(this,arguments)}}())},t.pick=function(t){var e=t.topmost,n=t.position,r=n.viewportX,n=n.viewportY,i=this.context.contextService.getDPR(),o=this.context.config.width*i,a=this.context.config.height*i,r=r*i,n=n*i;return o<r||r<0||a<n||n<0?t.picked=[]:(i=this.pickByRectangleInDepth(new Na(Ue(Math.round(r),0,o-1),Ue(Math.round(n),0,a-1),1,1),e?1:100),t.picked=i),t},t.pickByRectangleInDepth=function(t,e){void 0===e&&(e=100);for(var n=null,r=1,i=[];(n=this.pickByRectangle(t,n))&&(r++,i.push(n),n)&&r<=e;);return 1<e&&this.restorePickingColor(i),i},t.restorePickingColor=function(t){var e=this;t.forEach(function(t){e.batchManager.updateAttribute(t,"pointerEvents",!0,!0)})},t.pickByRectangle=function(t,e){var r,i=this,o=this.renderGraphPlugin.getDevice(),n=this.renderGraphPlugin.getRenderLists(),a=this.renderHelper.renderInstManager,s=this.renderHelper.renderGraph.newGraphBuilder(),l=this.context.camera,u=t.x,c=t.y,h=t.width,d=t.height,t={backbufferWidth:h,backbufferHeight:d,antialiasingMode:Cg.None},f=Ig(dg.Color0,t,Ng($f)),p=s.createRenderTargetID(f,"Picking Color"),f=Ig(dg.DepthStencil,t,Pg),g=s.createRenderTargetID(f,"Picking Depth"),m=sf({},l.getView()),t=(this.renderHelper.renderGraph.renderTargetDeadPool.forEach(function(t){t.age=-1}),s.pushPass(function(t){t.setDebugName("Picking Pass"),t.attachRenderTargetID(dg.Color0,p),t.attachRenderTargetID(dg.DepthStencil,g),t.exec(function(t){n.picking.drawOnPassRenderer(a.renderCache,t)}),t.post(function(t){var t=t.getRenderTargetTexture(dg.Color0),e=o.createReadback(),t=(m&&m.enabled?l.setViewOffset(m.fullWidth,m.fullHeight,m.offsetX,m.offsetY,m.width,m.height):l.clearViewOffset(),l.setEnableUpdate(!0),e.readTexture(t,0,0,h,d,new Uint8Array(h*d*4))),n=-1;-1<(n=!t||0===t[0]&&0===t[1]&&0===t[2]?n:i.pickingIdGenerator.decodePickingColor(t))&&(t=i.pickingIdGenerator.getById(n))&&t.isVisible()&&t.isInteractive()&&(r=t),e.destroy()})}),this.renderHelper.pushTemplateRenderInst()),f=(t.setBindingLayouts([{numUniformBuffers:2,numSamplers:0}]),t.setMegaStateFlags(hp({depthWrite:!0},{rgbBlendMode:Ef.Add,rgbBlendSrcFactor:yf.One,rgbBlendDstFactor:yf.Zero,alphaBlendMode:Ef.Add,alphaBlendSrcFactor:yf.One,alphaBlendDstFactor:yf.Zero})),this.context.config),s=f.width,f=f.height,v=this.context.contextService.getDPR();return l.setEnableUpdate(!1),l.setViewOffset(s*v,f*v,u,c,h,d),t.setUniforms(0,[{name:kg.PROJECTION_MATRIX,value:l.getPerspective()},{name:kg.VIEW_MATRIX,value:l.getViewTransform()},{name:kg.CAMERA_POSITION,value:l.getPosition()},{name:kg.DEVICE_PIXEL_RATIO,value:this.context.contextService.getDPR()},{name:kg.VIEWPORT,value:[s,f]},{name:kg.IS_ORTHO,value:l.isOrtho()?1:0},{name:kg.IS_PICKING,value:1}]),e&&this.batchManager.updateAttribute(e,"pointerEvents",!1,!0),this.batchManager.render(n.picking,!0),a.popTemplateRenderInst(),this.renderHelper.prepareToRender(),this.renderHelper.renderGraph.execute(),a.resetRenderInsts(),r},o}()),zg=(jg.tag="WebGLPicker",.005),Hg=1,wa=function(){function t(){this.id=Hg++,this.meshes=[],this.clipPathMeshCreated=!1}var e=t.prototype;return e.shouldSubmitRenderInst=function(t,e){return!0},e.beforeUploadUBO=function(t,e,n){},e.beforeInitMesh=function(t){},e.afterInitMesh=function(t){},t}();function Xg(t,e,n){var r,t=t.createBuffer({viewOrSize:(t=n.byteLength,r=4,(t+(r-=1)&~r)/4),usage:e,hint:Tf.Static});return t.setSubData(0,new Uint8Array(n)),t}(Dg=Dg||{}).CHANGED="changed";var Yg,Kg=function(r){function t(t,e){var n;return void 0===e&&(e={}),(n=r.call(this)||this).device=void 0,n.props=void 0,n.drawMode=Sf.Triangles,n.vertexBuffers=[],n.vertices=[],n.indexBuffer=void 0,n.indices=void 0,n.inputLayoutDescriptor={vertexBufferDescriptors:[],vertexAttributeDescriptors:[],indexBufferFormat:S.U32_R},n.vertexCount=0,n.instancedCount=0,n.indexStart=0,n.primitiveStart=0,n.dirty=!0,n.meshes=[],n.device=t,n.props=e,n}lf(t,r);var e=t.prototype;return e.validate=function(t){return!0},e.build=function(t){},e.computeBoundingBox=function(){return new Ta},e.setIndexBuffer=function(t){return this.indexBuffer&&this.indexBuffer.destroy(),this.indexBuffer=Xg(this.device,wf.INDEX|wf.COPY_DST,new Uint32Array(ArrayBuffer.isView(t)?t.buffer:t).buffer),this.indices=t,this},e.setVertexBuffer=function(t){var a=this,s=t.bufferIndex,e=t.byteStride,n=t.frequency,r=t.attributes,t=t.data,e=(this.inputLayoutDescriptor.vertexBufferDescriptors[s]={byteStride:e,frequency:n},this.vertices[s]=t,r.forEach(function(t){var e=t.format,n=t.bufferByteOffset,r=t.location,i=t.divisor,t=t.byteStride,o=a.inputLayoutDescriptor.vertexAttributeDescriptors.find(function(t){return t.bufferIndex===s&&t.location===r});o?(o.format=e,o.bufferByteOffset=n,o.byteStride=t,o.divisor=i):a.inputLayoutDescriptor.vertexAttributeDescriptors.push({format:e,bufferIndex:s,bufferByteOffset:n,location:r,byteStride:t,divisor:i})}),this.vertexBuffers[s]&&this.vertexBuffers[s].destroy(),Xg(this.device,wf.VERTEX|wf.COPY_DST,t.buffer));return this.vertexBuffers[s]=e,this},e.getVertexBuffer=function(t){return this.vertexBuffers[t]},e.updateVertexBuffer=function(t,e,n,r){var i=this.inputLayoutDescriptor.vertexBufferDescriptors[t].byteStride,o=this.inputLayoutDescriptor.vertexAttributeDescriptors.find(function(t){return t.location===e});o&&this.getVertexBuffer(t).setSubData(o.bufferByteOffset+n*i,r),this.emit(Dg.CHANGED)},e.updateIndices=function(t,e){return void 0===e&&(e=0),this.indexBuffer&&this.indexBuffer.setSubData(e,ArrayBuffer.isView(t)?t:new Uint32Array(t)),this},e.destroy=function(){this.vertexBuffers.forEach(function(t){t&&t.destroy()}),this.indexBuffer&&this.indexBuffer.destroy(),this.inputLayoutDescriptor.vertexAttributeDescriptors=[],this.inputLayoutDescriptor.vertexBufferDescriptors=[],this.indexBuffer=void 0,this.vertexBuffers=[],this.indices=void 0,this.vertices=[],this.vertexCount=0,this.instancedCount=0},t}(qn);(Yg=Yg||{}).CHANGED="changed";var Ca=function(d){function t(t,e){var n=d.call(this)||this,r=(n.device=void 0,n.props={},n.meshes=[],n.defines={},n.uniforms={},n.uniformNames=void 0,n.uboBuffer=[],n.textures={},n.samplers=[],n.programDirty=!0,n.textureDirty=!0,n.geometryDirty=!0,up(cp)),i=r.cullMode,o=r.depthCompare,a=r.depthWrite,s=r.stencilCompare,l=r.stencilWrite,u=r.stencilPassOp,c=r.frontFace,h=r.polygonOffset,r=r.attachmentsState;return n.device=t,n.props=sf({cullMode:i,depthTest:!0,depthCompare:o,depthWrite:a,stencilCompare:s,stencilWrite:l,stencilPassOp:u,frontFace:c,polygonOffset:h,attachmentsState:r,dithering:!1,wireframe:!1,wireframeColor:"black",wireframeLineWidth:1,vertexShader:"",fragmentShader:""},e),n.compile(),n}lf(t,d);var e=t.prototype;return e.compile=function(){var n=this;this.props.fragmentShader.replace(/^\s*uniform\s*sampler2D\s*(.*)\s*;$/gm,function(t,e){return n.samplers.push(e),""}),this.uniformNames=$p(this.props.fragmentShader)},e.setUniforms=function(r){var i=this,o=!1;Object.keys(r).forEach(function(t){var e=r[t],n=i.textures[t];n&&n!==e&&(i.textureDirty=!0),(n=e)&&n.type?(i.textures[t]=e,i.textureDirty=!0,e.on(Mf.LOADED,function(){i.dispatchMutationEvent()})):(i.uniforms[t]=e,o=!0),M(r[t])&&(delete i.textures[t],delete i.uniforms[t])}),o&&this.dispatchMutationEvent()},e.dispatchMutationEvent=function(){this.emit(Yg.CHANGED)},af(t,[{key:"cullMode",get:function(){return this.props.cullMode},set:function(t){this.props.cullMode=t}},{key:"frontFace",get:function(){return this.props.frontFace},set:function(t){this.props.frontFace=t}},{key:"blendConstant",get:function(){return this.props.blendConstant},set:function(t){this.props.blendConstant=t}},{key:"blendEquation",get:function(){return this.props.blendEquation},set:function(t){this.props.blendEquation=t}},{key:"blendEquationAlpha",get:function(){return this.props.blendEquationAlpha},set:function(t){this.props.blendEquationAlpha=t}},{key:"blendSrc",get:function(){return this.props.blendSrc},set:function(t){this.props.blendSrc=t}},{key:"blendDst",get:function(){return this.props.blendDst},set:function(t){this.props.blendDst=t}},{key:"blendSrcAlpha",get:function(){return this.props.blendSrcAlpha},set:function(t){this.props.blendSrcAlpha=t}},{key:"blendDstAlpha",get:function(){return this.props.blendDstAlpha},set:function(t){this.props.blendDstAlpha=t}},{key:"depthCompare",get:function(){return this.props.depthCompare},set:function(t){this.props.depthCompare=t}},{key:"depthTest",get:function(){return this.props.depthTest},set:function(t){this.props.depthTest=t}},{key:"depthWrite",get:function(){return this.props.depthWrite},set:function(t){this.props.depthWrite=t}},{key:"stencilCompare",get:function(){return this.props.stencilCompare},set:function(t){this.props.stencilCompare=t}},{key:"stencilWrite",get:function(){return this.props.stencilWrite},set:function(t){this.props.stencilWrite=t}},{key:"stencilPassOp",get:function(){return this.props.stencilPassOp},set:function(t){this.props.stencilPassOp=t}},{key:"stencilRef",get:function(){return this.props.stencilRef},set:function(t){this.props.stencilRef=t}},{key:"polygonOffset",get:function(){return this.props.polygonOffset},set:function(t){this.props.polygonOffset=t}},{key:"dithering",get:function(){return this.props.dithering},set:function(t){this.props.dithering=t}},{key:"wireframe",get:function(){return this.props.wireframe},set:function(t){this.props.wireframe!==t&&(this.geometryDirty=!0,this.programDirty=!0,this.props.wireframe=t,this.dispatchMutationEvent()),this.defines.USE_WIREFRAME=!!t}},{key:"wireframeColor",get:function(){return this.props.wireframeColor},set:function(t){this.props.wireframeColor=t}},{key:"wireframeLineWidth",get:function(){return this.props.wireframeLineWidth},set:function(t){this.props.wireframeLineWidth=t}},{key:"vertexShader",get:function(){return this.props.vertexShader},set:function(t){this.props.vertexShader!==t&&(this.programDirty=!0,this.props.vertexShader=t,this.compile())}},{key:"fragmentShader",get:function(){return this.props.fragmentShader},set:function(t){this.props.fragmentShader!==t&&(this.programDirty=!0,this.props.fragmentShader=t,this.compile())}}]),t}(qn),qg=function(n){function t(t,e){t=n.call(this,t,sf({},e))||this;return t.defines=sf({},t.defines,{USE_UV:!1,USE_MAP:!1,USE_WIREFRAME:!1,USE_FOG:!1,USE_LIGHT:!1}),t}return lf(t,n),t}(Ca);function $g(e){var n={};return Object.keys(e).forEach(function(t){"number"==typeof e[t]&&(n[t]=e[t])}),n}function Zg(t){return Object.fromEntries(Object.entries(t).filter(function(t){return t[0],void 0!==t[1]}))}var Qg,Jg,t0,e0,n0,r0,i0=1,o0="FillTextureMapping",Ia=((Pa=Qg=Qg||{})[Pa.MODEL_MATRIX=0]="MODEL_MATRIX",Pa[Pa.FILL_STROKE=1]="FILL_STROKE",Pa[Pa.PACKED_STYLE=2]="PACKED_STYLE",Pa[Pa.PICKING_COLOR=3]="PICKING_COLOR",Pa[Pa.POSITION=4]="POSITION",Pa[Pa.NORMAL=5]="NORMAL",Pa[Pa.UV=6]="UV",Pa[Pa.BARYCENTRIC=7]="BARYCENTRIC",Pa[Pa.MAX=8]="MAX",(Oa=Jg=Jg||{})[Oa.MODEL_MATRIX0=0]="MODEL_MATRIX0",Oa[Oa.MODEL_MATRIX1=1]="MODEL_MATRIX1",Oa[Oa.MODEL_MATRIX2=2]="MODEL_MATRIX2",Oa[Oa.MODEL_MATRIX3=3]="MODEL_MATRIX3",Oa[Oa.COLOR=4]="COLOR",Oa[Oa.STROKE_COLOR=5]="STROKE_COLOR",Oa[Oa.PACKED_STYLE1=6]="PACKED_STYLE1",Oa[Oa.PACKED_STYLE2=7]="PACKED_STYLE2",Oa[Oa.PICKING_COLOR=8]="PICKING_COLOR",Oa[Oa.POSITION=9]="POSITION",Oa[Oa.NORMAL=10]="NORMAL",Oa[Oa.UV=11]="UV",Oa[Oa.BARYCENTRIC=12]="BARYCENTRIC",Oa[Oa.MAX=13]="MAX",function(){function t(t,e,n){this.renderHelper=void 0,this.texturePool=void 0,this.lightPool=void 0,this.id=i0++,this.renderer=void 0,this.index=-1,this.context=void 0,this.objects=[],this.material=void 0,this.geometry=void 0,this.clipPath=void 0,this.clipPathTarget=void 0,this.inputState=void 0,this.program=new Jp,this.programDescriptorSimpleWithOrig=void 0,this.geometryDirty=!0,this.materialDirty=!0,this.inputStateDirty=!0,this.textureMappings=[],this.samplerEntries=void 0,this.lightReceived=!1,this.inited=!1,this.renderHelper=t,this.texturePool=e,this.lightPool=n}var e=t.prototype;return e.init=function(t){this.inited||(this.renderer.beforeInitMesh(this),this.context=t,this.material=new qg(this.context.device),this.material.defines=sf({},$g(Jg),this.material.defines),this.geometry=new Kg(this.context.device),this.geometry.meshes=this.objects,this.material.meshes=this.objects,this.observeGeometryChanged(),this.observeMaterialChanged(),this.inited=!0,this.renderer.afterInitMesh(this))},e.observeGeometryChanged=function(){var t=this;this.geometry.on(Dg.CHANGED,function(){t.geometry.meshes.forEach(function(t){t.renderable.dirty=!0}),t.context.renderingService.dirtify()})},e.observeMaterialChanged=function(){var t=this;this.material.on(Yg.CHANGED,function(){t.material.meshes.forEach(function(t){t.renderable.dirty=!0}),t.context.renderingService.dirtify()})},e.shouldMergeColor=function(t,e,n){var r=t.parsedStyle[n],i=e.parsedStyle[n];return!(!To(r)||!To(i))||!(!wo(r)||!wo(i)||r.image!==i.image)||!(!Array.isArray(r)||!Array.isArray(i)||t.style[n]!==e.style[n])},e.shouldMerge=function(t,e){return!this.instance||!(this.instance.nodeName!==t.nodeName&&this.instance.nodeName!==t.renderable.proxyNodeName&&this.instance.renderable.proxyNodeName!==t.nodeName&&this.instance.renderable.proxyNodeName!==t.renderable.proxyNodeName||t.parsedStyle.clipPath||!this.shouldMergeColor(this.instance,t,"fill")||!this.shouldMergeColor(this.instance,t,"stroke"))},e.createGeometry=function(t){var h=this,d=K(),f=K(),p=[],g=[],m=[],v=[];t.forEach(function(t){var e=t.parsedStyle,n=e.fill,r=e.stroke,i=e.opacity,o=e.fillOpacity,a=e.strokeOpacity,s=e.lineWidth,l=e.anchor,u=e.visibility,e=e.increasedLineWidthForHitTesting,c=[0,0,0,0],n=(To(n)&&(c=[Number(n.r)/255,Number(n.g)/255,Number(n.b)/255,Number(n.alpha)]),[0,0,0,0]),r=(To(r)&&(n=[Number(r.r)/255,Number(r.g)/255,Number(r.b)/255,Number(r.alpha)]),h.clipPathTarget?($(d,t.getLocalTransform()),c=[1,1,1,1],wt(d,h.clipPathTarget.getWorldTransform(),d)):$(d,t.getWorldTransform()),wt(f,h.context.camera.getViewTransform(),d),t.isInteractive()&&(null==(r=t.renderable3D)?void 0:r.encodedPickingColor)||[0,0,0]);p.push.apply(p,d),g.push.apply(g,c.concat(n)),m.push(i,o,a,s,"visible"===u?1:0,l[0],l[1],e||0),v.push.apply(v,r.concat([t.sortable.renderOrder*zg]))}),this.geometry.instancedCount=t.length,this.geometry.setVertexBuffer({bufferIndex:Qg.MODEL_MATRIX,byteStride:64,frequency:Af.PerInstance,attributes:[{format:S.F32_RGBA,bufferByteOffset:0,location:Jg.MODEL_MATRIX0,divisor:1},{format:S.F32_RGBA,bufferByteOffset:16,location:Jg.MODEL_MATRIX1,divisor:1},{format:S.F32_RGBA,bufferByteOffset:32,location:Jg.MODEL_MATRIX2,divisor:1},{format:S.F32_RGBA,bufferByteOffset:48,location:Jg.MODEL_MATRIX3,divisor:1}],data:new Float32Array(p)}),this.geometry.setVertexBuffer({bufferIndex:Qg.FILL_STROKE,byteStride:32,frequency:Af.PerInstance,attributes:[{format:S.F32_RGBA,bufferByteOffset:0,location:Jg.COLOR,divisor:1},{format:S.F32_RGBA,bufferByteOffset:16,location:Jg.STROKE_COLOR,divisor:1}],data:new Float32Array(g)}),this.geometry.setVertexBuffer({bufferIndex:Qg.PACKED_STYLE,byteStride:32,frequency:Af.PerInstance,attributes:[{format:S.F32_RGBA,bufferByteOffset:0,location:Jg.PACKED_STYLE1,divisor:1},{format:S.F32_RGBA,bufferByteOffset:16,location:Jg.PACKED_STYLE2,divisor:1}],data:new Float32Array(m)}),this.geometry.setVertexBuffer({bufferIndex:Qg.PICKING_COLOR,byteStride:16,frequency:Af.PerInstance,attributes:[{format:S.F32_RGBA,bufferByteOffset:0,location:Jg.PICKING_COLOR,divisor:1}],data:new Float32Array(v)})},e.destroy=function(){this.geometry&&this.geometry.destroy(),this.inputState&&this.inputState.destroy()},e.applyRenderInst=function(t,e){var n=this,r=this.lightPool.getAllLights(),i=!!this.lightPool.getFog(),r=!!r.length,o=(this.clipPathTarget||this.clipPath?this.clipPathTarget?(this.material.stencilWrite=!0,this.material.depthWrite=!1,this.material.stencilCompare=mf.Always,this.material.stencilPassOp=Pf.Replace):(this.material.stencilWrite=!1,this.material.depthWrite=!0,this.material.stencilCompare=mf.Equal,this.material.stencilPassOp=Pf.Keep):this.material.stencilWrite=!1,(this.materialDirty||this.material.programDirty)&&this.createMaterial(e),sf({},this.material.defines));this.material.defines.USE_FOG=i,this.material.defines.USE_LIGHT=r,this.material.defines=sf({},this.material.defines,this.lightPool.getDefines()),this.material.textureDirty&&(this.textureMappings=[],(i=this.createFillGradientTextureMapping(e))&&this.textureMappings.push(i),Object.keys(this.material.textures).sort(function(t,e){return n.material.samplers.indexOf(t)-n.material.samplers.indexOf(e)}).forEach(function(t){var e=new Bg;e.name=t,e.texture=n.material.textures[t],n.context.device.setResourceName(e.texture,"Material Texture "+t),e.sampler=n.renderHelper.getCache().createSampler({wrapS:_f.Clamp,wrapT:_f.Clamp,minFilter:bf.Point,magFilter:bf.Bilinear,mipFilter:xf.Linear,minLOD:0,maxLOD:0}),n.textureMappings.push(e)}),this.textureMappings.length?(this.material.defines.USE_UV=!0,this.material.defines.USE_MAP=!0):(this.material.defines.USE_UV=!1,this.material.defines.USE_MAP=!1),this.material.textureDirty=!1),a=o,s=this.material.defines,r=Object.keys(a),i=Object.keys(s);r.length===i.length&&r.every(function(t){return a[t]===s[t]})&&!this.material.programDirty&&!this.materialDirty||(this.material.defines=sf({},this.material.defines,$g(Jg)),Object.keys(this.material.defines).forEach(function(t){var e=n.material.defines[t];"number"==typeof e?n.program.setDefineString(t,""+e):n.program.setDefineBool(t,e)}),this.program.vert=this.material.vertexShader,this.program.frag=this.material.fragmentShader,this.programDescriptorSimpleWithOrig=Qp(this.context.device,this.program),this.material.programDirty=!1,this.materialDirty=!1),this.material.geometryDirty&&(this.geometryDirty=!0,this.inputStateDirty=!0,this.material.geometryDirty=!1),(this.geometryDirty||this.geometry.dirty)&&(this.geometry&&this.geometry.destroy(),this.createGeometry(e),this.material.wireframe&&this.generateWireframe(this.geometry),this.geometryDirty=!1,this.geometry.dirty=!1,this.inputStateDirty=!0);var a,s,o=this.renderHelper.getCache().createInputLayout(this.geometry.inputLayoutDescriptor),i=this.renderHelper.getCache().createProgramSimple(this.programDescriptorSimpleWithOrig),r=!!this.geometry.indexBuffer;this.inputStateDirty&&(this.inputState&&this.inputState.destroy(),this.inputState=this.context.device.createInputState(o,this.geometry.vertexBuffers.map(function(t){return{buffer:t,byteOffset:0}}),r?{buffer:this.geometry.indexBuffer,byteOffset:0}:null,i),this.inputStateDirty=!1),t.renderPipelineDescriptor.topology=this.geometry.drawMode,t.setProgram(i),t.setInputLayoutAndState(o,this.inputState),this.renderer.beforeUploadUBO(t,this,this.index),this.uploadUBO(t),r?t.drawIndexesInstanced(this.geometry.vertexCount,this.geometry.instancedCount,this.geometry.indexStart):t.drawPrimitives(this.geometry.vertexCount,this.geometry.primitiveStart),t.sortKey=(i=fg.OPAQUE,(16777215&(o=o=e[0].sortable.renderOrder,!!((r=0)>>>31&1)?r:(4278190335&r|(65535&o)<<8)>>>0)|(255&i)<<24)>>>0)},e.updateBatchedAttribute=function(t,e,n,r){var i,o,a,s,l,u;"fill"===n||"stroke"===n?(i=[],t.forEach(function(t){var t=t.parsedStyle,e=t.fill,t=t.stroke,n=[0,0,0,0],e=(To(e)&&(n=[Number(e.r)/255,Number(e.g)/255,Number(e.b)/255,Number(e.alpha)]),[0,0,0,0]);To(t)&&(e=[Number(t.r)/255,Number(t.g)/255,Number(t.b)/255,Number(t.alpha)]),i.push.apply(i,n.concat(e))}),this.geometry.updateVertexBuffer(Qg.FILL_STROKE,Jg.COLOR,e,new Uint8Array(new Float32Array(i).buffer)),a=this.instance.parsedStyle.fill,o=this.textureMappings.findIndex(function(t){return t.name===o0}),To(a)?0<=o&&(this.textureMappings.splice(o,-1),this.material.textureDirty=!0):(a=this.createFillGradientTextureMapping([this.instance]),0<=o&&this.textureMappings.splice(o,1,a),this.material.textureDirty=!0)):-1<["opacity","fillOpacity","strokeOpacity","lineWidth","visibility","anchor","increasedLineWidthForHitTesting"].indexOf(n)?(s=[],t.forEach(function(t){var t=t.parsedStyle,e=t.opacity,n=t.fillOpacity,r=t.strokeOpacity,i=t.lineWidth,o=t.visibility,a=t.anchor,t=t.increasedLineWidthForHitTesting;s.push(e,n,r,i,"visible"===o?1:0,a[0],a[1],t||0)}),this.geometry.updateVertexBuffer(Qg.PACKED_STYLE,Jg.PACKED_STYLE1,e,new Uint8Array(new Float32Array(s).buffer))):"modelMatrix"===n?(l=[],t.forEach(function(t){t=$(K(),t.getWorldTransform());l.push.apply(l,t)}),this.geometry.updateVertexBuffer(Qg.MODEL_MATRIX,Jg.MODEL_MATRIX0,e,new Uint8Array(new Float32Array(l).buffer))):"pointerEvents"===n&&(u=[],t.forEach(function(t){var e=r&&t.isInteractive()&&(null==(e=t.renderable3D)?void 0:e.encodedPickingColor)||[0,0,0];u.push.apply(u,e.concat([t.sortable.renderOrder*zg]))}),this.geometry.updateVertexBuffer(Qg.PICKING_COLOR,Jg.PICKING_COLOR,e,new Uint8Array(new Float32Array(u).buffer)))},e.updateAttribute=function(t,e,n,r){"clipPath"===n&&this.clipPath&&(this.geometryDirty=!0)},e.changeRenderOrder=function(t,e){var n=this.objects.indexOf(t),t=t.isInteractive()&&(null==(t=t.renderable3D)?void 0:t.encodedPickingColor)||[0,0,0];this.geometry.updateVertexBuffer(Qg.PICKING_COLOR,Jg.PICKING_COLOR,n,new Uint8Array(new Float32Array([].concat(t,[e*zg])).buffer))},e.generateWireframe=function(l){for(var t=l.indices,e=l.indices.length,n=l.vertices.map(function(t){return t.slice()}),r=Qg.PICKING_COLOR;r<l.vertexBuffers.length;r++){var i=l.inputLayoutDescriptor.vertexBufferDescriptors[r].byteStride;l.vertices[r]=new Float32Array(i/4*e)}for(var o=0,a=new Uint32Array(e),s=0;s<e;s++){for(var u=t[s],c=1;c<l.vertices.length;c++)for(var h=l.inputLayoutDescriptor.vertexBufferDescriptors[c].byteStride/4,d=0;d<h;d++)l.vertices[c][o*h+d]=n[c][u*h+d];a[s]=o,o++}for(var f=Qg.PICKING_COLOR+1;f<l.vertexBuffers.length;f++)!function(e){var t,n,r,i,o=l.inputLayoutDescriptor.vertexBufferDescriptors[e],a=o.frequency,o=o.byteStride,s=l.inputLayoutDescriptor.vertexAttributeDescriptors.find(function(t){return t.bufferIndex===e});s&&(t=s.location,n=s.bufferIndex,r=s.bufferByteOffset,i=s.format,s=s.divisor,l.setVertexBuffer({bufferIndex:n,byteStride:o,frequency:a,attributes:[{format:i,bufferByteOffset:r,location:t,divisor:s}],data:l.vertices[e]}))}(f);for(var p=new Float32Array(3*e),g=0;g<e;)for(var m=0;m<3;m++)p[3*a[g++]+m]=1;l.setVertexBuffer({bufferIndex:Qg.BARYCENTRIC,byteStride:12,frequency:Af.PerVertex,attributes:[{format:S.F32_RGB,bufferByteOffset:0,location:Number(Jg.BARYCENTRIC)}],data:p}),l.setIndexBuffer(a)},e.beforeUploadUBO=function(t,e,n){},e.uploadUBO=function(t){var e,n=this,r=this.material,i=this.lightPool.getAllLights(),o=this.lightPool.getFog(),a=!!o,s=this.lightReceived&&!!i.length,l=r.defines.USE_WIREFRAME,u=[],l=(l&&(l=Ao(r.wireframeColor),u.push({name:"u_WireframeLineColor",value:[Number(l.r)/255,Number(l.g)/255,Number(l.b)/255]}),u.push({name:"u_WireframeLineWidth",value:r.wireframeLineWidth})),a&&this.uploadFog(u,o),this.uploadMaterial(u,r),s&&(e={},i.forEach(function(t){e[t.define]||(e[t.define]=-1),e[t.define]++,t.uploadUBO(u,e[t.define])})),u.sort(function(t,e){return n.material.uniformNames.indexOf(t.name)-n.material.uniformNames.indexOf(e.name)}),t.setUniforms(1,u),r.depthCompare),a=r.depthWrite,o=r.stencilCompare,s=r.stencilWrite,i=r.stencilPassOp,c=r.stencilRef,h=r.cullMode,d=r.frontFace,f=r.polygonOffset,p=r.blendConstant,g=r.blendEquation,m=r.blendEquationAlpha,v=r.blendSrc,y=r.blendDst,E=r.blendSrcAlpha,r=r.blendDstAlpha,p=Zg({blendConstant:p,depthCompare:l,depthWrite:a,stencilCompare:o,stencilWrite:s,stencilPassOp:i,stencilRef:c,cullMode:h,frontFace:d,polygonOffset:f}),l=t.getMegaStateFlags().attachmentsState[0];t.setMegaStateFlags(sf({attachmentsState:[{channelWriteMask:this.material.stencilWrite?Cf.None:Cf.AllChannels,rgbBlendState:sf({},l.rgbBlendState,Zg({blendMode:g,blendSrcFactor:v,blendDstFactor:y})),alphaBlendState:sf({},l.alphaBlendState,Zg({blendMode:m,blendSrcFactor:E,blendDstFactor:r}))}]},p)),t.setBindingLayouts([{numUniformBuffers:1,numSamplers:this.textureMappings.length,samplerEntries:this.samplerEntries}]),t.setSamplerBindingsFromTextureMappings(this.textureMappings)},e.uploadFog=function(t,e){var e=e.parsedStyle,n=e.type,r=e.fill,i=e.start,o=e.end,e=e.density;To(r)&&(r=[Number(r.r)/255,Number(r.g)/255,Number(r.b)/255,Number(r.alpha)],t.push({name:"u_FogInfos",value:[n,i,o,e]}),t.push({name:"u_FogColor",value:r}))},e.uploadMaterial=function(t,e){var n=Object.keys(e.uniforms).map(function(t){return{name:t,value:e.uniforms[t]}});t.push.apply(t,n)},e.createFillGradientTextureMapping=function(t){var e=this,n=t[0],r=n.nodeName===lt.LINE?n.parsedStyle.stroke:n.parsedStyle.fill;if(r&&(wo(r)||Array.isArray(r))){Array.isArray(r)?(this.program.setDefineBool("USE_PATTERN",!1),this.texturePool.getOrCreateGradient({gradients:r,width:128,height:128,instance:n})):wo(r)&&(this.program.setDefineBool("USE_PATTERN",!0),this.texturePool.getOrCreatePattern(r,n,function(){t.forEach(function(t){t.renderable.dirty=!0}),e.material.textureDirty=!0}));var r=this.texturePool.getOrCreateCanvas(),n=this.texturePool.getOrCreateTexture(this.context.device,r,Wf(S.U8_RGBA_NORM,1,1,1));if(n)return(r=new Bg).name=o0,r.texture=n,r.texture.on("loaded",function(){t.forEach(function(t){t.renderable.dirty=!0}),e.material.textureDirty=!0}),this.context.device.setResourceName(r.texture,"Fill Texture"+this.id),r.sampler=this.renderHelper.getCache().createSampler({wrapS:_f.Repeat,wrapT:_f.Repeat,minFilter:bf.Point,magFilter:bf.Bilinear,mipFilter:xf.Linear,minLOD:0,maxLOD:0}),r}return null},af(t,[{key:"instance",get:function(){return this.objects[0]}}]),t}()),a0=(t0=t0||{},t0[t0.PACKED_STYLE=5]="PACKED_STYLE",(La=e0=e0||{})[La.PACKED_STYLE3=13]="PACKED_STYLE3",La[La.SIZE=14]="SIZE",[lt.CIRCLE,lt.ELLIPSE,lt.RECT]),s0=function(u){function t(){return u.apply(this,arguments)||this}lf(t,u);var e=t.prototype;return e.shouldMerge=function(t,e){return!!u.prototype.shouldMerge.call(this,t,e)&&!this.needDrawStrokeSeparately(t.parsedStyle)&&!this.needDrawStrokeSeparately(this.instance.parsedStyle)&&(e=this.instance.parsedStyle.fill,t=t.parsedStyle.fill,e.isNone===t.isNone)},e.createMaterial=function(t){this.material.vertexShader="#define GLSLIFY 1\nlayout(std140) uniform ub_SceneParams {\n mat4 u_ProjectionMatrix;\n mat4 u_ViewMatrix;\n vec3 u_CameraPosition;\n float u_DevicePixelRatio;\n vec2 u_Viewport;\n float u_IsOrtho;\n float u_IsPicking;\n};\n\nlayout(location = MODEL_MATRIX0) in vec4 a_ModelMatrix0;\nlayout(location = MODEL_MATRIX1) in vec4 a_ModelMatrix1;\nlayout(location = MODEL_MATRIX2) in vec4 a_ModelMatrix2;\nlayout(location = MODEL_MATRIX3) in vec4 a_ModelMatrix3;\nlayout(location = COLOR) in vec4 a_Color;\nlayout(location = STROKE_COLOR) in vec4 a_StrokeColor;\nlayout(location = PACKED_STYLE1) in vec4 a_StylePacked1;\nlayout(location = PACKED_STYLE2) in vec4 a_StylePacked2;\nlayout(location = PICKING_COLOR) in vec4 a_PickingColor;\n\nout vec4 v_PickingResult;\nout vec4 v_Color;\nout vec4 v_StrokeColor;\nout vec4 v_StylePacked1;\nout vec4 v_StylePacked2;\n\n#define COLOR_SCALE 1. / 255.\nvoid setPickingColor(vec3 pickingColor) {\n v_PickingResult.rgb = pickingColor * COLOR_SCALE;\n}\nvec4 project(vec4 pos, mat4 pm, mat4 vm, mat4 mm) {\n return pm * vm * mm * pos;\n}\n\nlayout(location = POSITION) in vec2 a_Extrude;\nlayout(location = PACKED_STYLE3) in vec4 a_StylePacked3;\nlayout(location = SIZE) in vec2 a_Size;\n#ifdef USE_UV\n layout(location = UV) in vec2 a_Uv;\n out vec2 v_Uv;\n#endif\n\nout vec4 v_Data;\nout vec2 v_Radius;\nout vec4 v_StylePacked3;\n\nvoid main() {\n mat4 u_ModelMatrix = mat4(a_ModelMatrix0, a_ModelMatrix1, a_ModelMatrix2, a_ModelMatrix3);\nvec4 u_StrokeColor = a_StrokeColor;\nfloat u_Opacity = a_StylePacked1.x;\nfloat u_FillOpacity = a_StylePacked1.y;\nfloat u_StrokeOpacity = a_StylePacked1.z;\nfloat u_StrokeWidth = a_StylePacked1.w;\nfloat u_ZIndex = a_PickingColor.w;\nvec2 u_Anchor = a_StylePacked2.yz;\nfloat u_IncreasedLineWidthForHitTesting = a_StylePacked2.w;\n\nsetPickingColor(a_PickingColor.xyz);\n\nv_Color = a_Color;\nv_StrokeColor = a_StrokeColor;\nv_StylePacked1 = a_StylePacked1;\nv_StylePacked2 = a_StylePacked2;\n\n#ifdef CLIPSPACE_NEAR_ZERO\n gl_Position.z = gl_Position.z * 0.5 + 0.5;\n#endif\n #ifdef USE_UV\n v_Uv = a_Uv;\n #ifdef VIEWPORT_ORIGIN_TL\n v_Uv.y = 1.0 - v_Uv.y;\n #endif\n#endif\n\n float strokeWidth;\n if (u_IsPicking > 0.5) {\n strokeWidth = u_IncreasedLineWidthForHitTesting + u_StrokeWidth;\n } else {\n strokeWidth = u_StrokeWidth;\n }\n\n float antialiasblur = 1.0 / (a_Size.x + strokeWidth);\n\n bool omitStroke = a_StylePacked3.z == 1.0;\n vec2 radius = a_Size + vec2(omitStroke ? 0.0 : strokeWidth / 2.0);\n vec2 offset = (a_Extrude + vec2(1.0) - 2.0 * u_Anchor.xy) * radius;\n\n bool isBillboard = a_StylePacked3.w > 0.5;\n if (isBillboard) {\n vec4 mvPosition = u_ViewMatrix * u_ModelMatrix * vec4( 0.0, 0.0, u_ZIndex, 1.0 );\nvec2 scale;\nscale.x = length( vec3( u_ModelMatrix[ 0 ].x, u_ModelMatrix[ 0 ].y, u_ModelMatrix[ 0 ].z ) );\nscale.y = length( vec3( u_ModelMatrix[ 1 ].x, u_ModelMatrix[ 1 ].y, u_ModelMatrix[ 1 ].z ) );\n\n// if (sizeAttenuation < 0.5) {\n// bool isPerspective = isPerspectiveMatrix( u_ProjectionMatrix );\n// if ( isPerspective ) scale *= - mvPosition.z;\n// }\n\nvec2 alignedPosition = offset * scale;\n\nfloat rotation = 0.0;\nvec2 rotatedPosition;\nrotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y;\nrotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y;\n\nmvPosition.xy += rotatedPosition;\n\ngl_Position = u_ProjectionMatrix * mvPosition;\n } else {\n gl_Position = project(vec4(offset, u_ZIndex, 1.0), u_ProjectionMatrix, u_ViewMatrix, u_ModelMatrix);\n }\n \n v_Radius = radius;\n v_Data = vec4(a_Extrude, antialiasblur, a_StylePacked3.x);\n v_StylePacked3 = a_StylePacked3;\n}",this.material.fragmentShader="#define GLSLIFY 1\nlayout(std140) uniform ub_SceneParams {\n mat4 u_ProjectionMatrix;\n mat4 u_ViewMatrix;\n vec3 u_CameraPosition;\n float u_DevicePixelRatio;\n vec2 u_Viewport;\n float u_IsOrtho;\n float u_IsPicking;\n};\n\nin vec4 v_PickingResult;\nin vec4 v_Color;\nin vec4 v_StrokeColor;\nin vec4 v_StylePacked1;\nin vec4 v_StylePacked2;\n#ifdef USE_UV\n in vec2 v_Uv;\n#endif\n#ifdef USE_MAP\n uniform sampler2D u_Map;\n#endif\n\nin vec4 v_Data;\nin vec2 v_Radius;\nin vec4 v_StylePacked3;\n\nout vec4 outputColor;\n\n/**\n * 2D signed distance field functions\n * @see http://www.iquilezles.org/www/articles/distfunctions2d/distfunctions2d.htm\n */\n\nfloat sdCircle(vec2 p, float r) {\n return length(p) - r;\n}\n\n// @see http://www.iquilezles.org/www/articles/ellipsoids/ellipsoids.htm\nfloat sdEllipsoidApproximated(vec2 p, vec2 r) {\n float k0 = length(p / r);\n float k1 = length(p / (r * r));\n return k0 * (k0 - 1.0) / k1;\n}\n\n// @see https://www.shadertoy.com/view/4llXD7\nfloat sdRoundedBox(vec2 p, vec2 b, vec2 r) {\n vec2 q = abs(p) - b + r;\n return min(max(q.x, q.y), 0.0) + length(max(q, 0.0)) - r.x;\n}\n\nvoid main() {\n int shape = int(floor(v_Data.w + 0.5));\n float epsilon = 0.000001;\n\n vec4 u_Color = v_Color;\nvec4 u_StrokeColor = v_StrokeColor;\nfloat u_Opacity = v_StylePacked1.x;\nfloat u_FillOpacity = v_StylePacked1.y;\nfloat u_StrokeOpacity = v_StylePacked1.z;\nfloat u_StrokeWidth = v_StylePacked1.w;\nfloat u_Visible = v_StylePacked2.x;\nvec3 u_PickingColor = v_PickingResult.xyz;\n\nif (u_Visible < 0.5) {\n discard;\n}\n #ifdef USE_MAP\n #ifdef USE_PATTERN\n vec4 texelColor = texture(SAMPLER_2D(u_Map), v_Uv);\n u_Color = texelColor;\n #else\n vec4 texelColor = texture(SAMPLER_2D(u_Map), v_Uv);\n u_Color = texelColor;\n #endif\n#endif\n\n bool omitStroke = v_StylePacked3.z == 1.0;\n\n float antialiasblur = v_Data.z;\n float antialiased_blur = -max(0.0, antialiasblur);\n vec2 r = (v_Radius - (omitStroke ? 0.0 : u_StrokeWidth)) / v_Radius;\n\n float outer_df;\n float inner_df;\n // 'circle', 'ellipse', 'rect'\n if (shape == 0) {\n outer_df = sdCircle(v_Data.xy, 1.0);\n inner_df = sdCircle(v_Data.xy, r.x);\n } else if (shape == 1) {\n outer_df = sdEllipsoidApproximated(v_Data.xy, vec2(1.0));\n inner_df = sdEllipsoidApproximated(v_Data.xy, r);\n } else if (shape == 2) {\n outer_df = sdRoundedBox(v_Data.xy, vec2(1.0), vec2(0.0));\n inner_df = sdRoundedBox(v_Data.xy, r, vec2(0.0));\n }\n\n float opacity_t = smoothstep(0.0, antialiased_blur, outer_df);\n\n float color_t = u_StrokeWidth < 0.01 ? 0.0 : smoothstep(\n antialiased_blur,\n 0.0,\n inner_df\n );\n\n vec4 diffuseColor;\n vec4 strokeColor;\n if (u_IsPicking > 0.5) {\n diffuseColor = vec4(u_PickingColor, 1.0);\n strokeColor = vec4(u_PickingColor, 1.0);\n } else {\n diffuseColor = u_Color;\n strokeColor = (u_StrokeColor == vec4(0) || omitStroke) ? vec4(0.0) : u_StrokeColor;\n }\n\n outputColor = mix(vec4(diffuseColor.rgb, diffuseColor.a * u_FillOpacity), strokeColor * u_StrokeOpacity, color_t);\n outputColor.a = outputColor.a * u_Opacity * opacity_t;\n\n if (outputColor.a < epsilon)\n discard;\n\n if (u_IsPicking > 0.5) {\n if (u_PickingColor.x == 0.0 && u_PickingColor.y == 0.0 && u_PickingColor.z == 0.0) {\n discard;\n }\n }\n}",this.material.defines=sf({},this.material.defines,$g(e0))},e.createGeometry=function(t){var o=this,a=(u.prototype.createGeometry.call(this,t),[]),s=[],l=[];t.forEach(function(t,e){var n=t,e=4*e,r=n.parsedStyle.radius,i=o.shouldOmitStroke(n.parsedStyle),t=o.getSize(t.parsedStyle,n.nodeName);s.push.apply(s,t.concat([a0.indexOf(n.nodeName),r||0,i?1:0,n.parsedStyle.isBillboard?1:0])),a.push(-1,-1,0,0,1,-1,1,0,1,1,1,1,-1,1,0,1),l.push(0+e,2+e,1+e,0+e,3+e,2+e)}),this.geometry.setIndexBuffer(new Uint32Array(l)),this.geometry.vertexCount=6,this.geometry.setVertexBuffer({bufferIndex:Qg.POSITION,byteStride:16,frequency:Af.PerVertex,attributes:[{format:S.F32_RG,bufferByteOffset:0,location:Jg.POSITION},{format:S.F32_RG,bufferByteOffset:8,location:Jg.UV}],data:new Float32Array(a)}),this.geometry.setVertexBuffer({bufferIndex:t0.PACKED_STYLE,byteStride:24,frequency:Af.PerInstance,attributes:[{format:S.F32_RG,bufferByteOffset:0,location:e0.SIZE,divisor:1},{format:S.F32_RGBA,bufferByteOffset:8,location:e0.PACKED_STYLE3,divisor:1}],data:new Float32Array(s)})},e.updateAttribute=function(t,e,n,r){var i,o=this;u.prototype.updateAttribute.call(this,t,e,n,r),this.updateBatchedAttribute(t,e,n,r),"r"!==n&&"rx"!==n&&"ry"!==n&&"width"!==n&&"height"!==n&&"lineWidth"!==n&&"stroke"!==n&&"lineDash"!==n&&"strokeOpacity"!==n||(i=[],t.forEach(function(t){var e=t,n=o.shouldOmitStroke(e.parsedStyle),r=o.getSize(t.parsedStyle,t.nodeName),r=[r[0],r[1]];i.push.apply(i,r.concat([a0.indexOf(t.nodeName),t.parsedStyle.radius||0,n?1:0,e.parsedStyle.isBillboard?1:0]))}),this.geometry.updateVertexBuffer(t0.PACKED_STYLE,e0.SIZE,e,new Uint8Array(new Float32Array(i).buffer)))},e.getSize=function(t,e){var n,r=[0,0];return e===lt.CIRCLE?r=[n=t.r,n]:e===lt.ELLIPSE?r=[t.rx,t.ry]:e===lt.RECT&&(r=[t.width/2,t.height/2]),r},e.shouldOmitStroke=function(t){var e=t.lineDash,n=t.stroke,t=t.strokeOpacity,n=n&&!n.isNone,e=e&&e.length&&e.every(function(t){return 0!==t});return!n||e||t<1},e.needDrawStrokeSeparately=function(t){var e=t.stroke,n=t.lineDash,r=t.lineWidth,t=t.strokeOpacity,e=e&&!e.isNone,n=n&&n.length&&n.every(function(t){return 0!==t});return e&&0<r&&(n||t<1)},t}(Ia),l0=[0,-.5,0,0,0,1,-.5,1,1,0,1,.5,1,1,1,0,.5,0,0,1],u0=((ka=n0=n0||{})[ka.POINT=5]="POINT",ka[ka.CAP=6]="CAP",ka[ka.DASH=7]="DASH",(Da=r0=r0||{})[Da.POSITION=9]="POSITION",Da[Da.UV=11]="UV",Da[Da.POINTA=10]="POINTA",Da[Da.POINTB=12]="POINTB",Da[Da.CAP=13]="CAP",Da[Da.DASH=14]="DASH",{butt:1,round:2,square:3}),c0=function(a){function t(){return a.apply(this,arguments)||this}lf(t,a);var e=t.prototype;return e.shouldMerge=function(t,e){return!!a.prototype.shouldMerge.call(this,t,e)},e.createMaterial=function(t){this.material.vertexShader="#define GLSLIFY 1\nlayout(std140) uniform ub_SceneParams {\n mat4 u_ProjectionMatrix;\n mat4 u_ViewMatrix;\n vec3 u_CameraPosition;\n float u_DevicePixelRatio;\n vec2 u_Viewport;\n float u_IsOrtho;\n float u_IsPicking;\n};\n\nlayout(location = MODEL_MATRIX0) in vec4 a_ModelMatrix0;\nlayout(location = MODEL_MATRIX1) in vec4 a_ModelMatrix1;\nlayout(location = MODEL_MATRIX2) in vec4 a_ModelMatrix2;\nlayout(location = MODEL_MATRIX3) in vec4 a_ModelMatrix3;\nlayout(location = COLOR) in vec4 a_Color;\nlayout(location = STROKE_COLOR) in vec4 a_StrokeColor;\nlayout(location = PACKED_STYLE1) in vec4 a_StylePacked1;\nlayout(location = PACKED_STYLE2) in vec4 a_StylePacked2;\nlayout(location = PICKING_COLOR) in vec4 a_PickingColor;\n\nout vec4 v_PickingResult;\nout vec4 v_Color;\nout vec4 v_StrokeColor;\nout vec4 v_StylePacked1;\nout vec4 v_StylePacked2;\n\n#define COLOR_SCALE 1. / 255.\nvoid setPickingColor(vec3 pickingColor) {\n v_PickingResult.rgb = pickingColor * COLOR_SCALE;\n}\nvec4 project(vec4 pos, mat4 pm, mat4 vm, mat4 mm) {\n return pm * vm * mm * pos;\n}\n\nlayout(location = POSITION) in vec3 a_Position;\nlayout(location = POINTA) in vec3 a_PointA;\nlayout(location = POINTB) in vec3 a_PointB;\nlayout(location = CAP) in float a_Cap;\n#ifdef USE_UV\n layout(location = UV) in vec2 a_Uv;\n out vec2 v_Uv;\n#endif\nlayout(location = DASH) in vec4 a_Dash;\n\nout vec4 v_Dash;\nout vec2 v_Distance;\n\nbool isPerspectiveMatrix(mat4 m) {\n return m[ 2 ][ 3 ] == - 1.0;\n}\n\nvoid main() {\n mat4 u_ModelMatrix = mat4(a_ModelMatrix0, a_ModelMatrix1, a_ModelMatrix2, a_ModelMatrix3);\nvec4 u_StrokeColor = a_StrokeColor;\nfloat u_Opacity = a_StylePacked1.x;\nfloat u_FillOpacity = a_StylePacked1.y;\nfloat u_StrokeOpacity = a_StylePacked1.z;\nfloat u_StrokeWidth = a_StylePacked1.w;\nfloat u_ZIndex = a_PickingColor.w;\nvec2 u_Anchor = a_StylePacked2.yz;\nfloat u_IncreasedLineWidthForHitTesting = a_StylePacked2.w;\n\nsetPickingColor(a_PickingColor.xyz);\n\nv_Color = a_Color;\nv_StrokeColor = a_StrokeColor;\nv_StylePacked1 = a_StylePacked1;\nv_StylePacked2 = a_StylePacked2;\n\n#ifdef CLIPSPACE_NEAR_ZERO\n gl_Position.z = gl_Position.z * 0.5 + 0.5;\n#endif\n #ifdef USE_UV\n v_Uv = a_Uv;\n #ifdef VIEWPORT_ORIGIN_TL\n v_Uv.y = 1.0 - v_Uv.y;\n #endif\n#endif\n\n float strokeWidth;\n if (u_IsPicking > 0.5) {\n strokeWidth = u_IncreasedLineWidthForHitTesting + u_StrokeWidth;\n } else {\n strokeWidth = u_StrokeWidth;\n }\n\n float isBillboard = a_Dash.w;\n bool isPerspective = isPerspectiveMatrix(u_ProjectionMatrix);\n\n if (isBillboard > 0.5 && isPerspective) {\n // clip space\n vec4 clip0 = project(vec4(a_PointA, 1.0), u_ProjectionMatrix, u_ViewMatrix, u_ModelMatrix);\n vec4 clip1 = project(vec4(a_PointB, 1.0), u_ProjectionMatrix, u_ViewMatrix, u_ModelMatrix);\n // screen space\n vec2 screen0 = u_Viewport * (0.5 * clip0.xy / clip0.w + 0.5);\n vec2 screen1 = u_Viewport * (0.5 * clip1.xy / clip1.w + 0.5);\n vec2 xBasis = normalize(screen1 - screen0);\n vec2 yBasis = vec2(-xBasis.y, xBasis.x);\n vec2 pt0 = screen0 + strokeWidth * (a_Position.x * xBasis + a_Position.y * yBasis);\n vec2 pt1 = screen1 + strokeWidth * (a_Position.x * xBasis + a_Position.y * yBasis);\n vec2 pt = mix(pt0, pt1, a_Position.z);\n vec4 clip = mix(clip0, clip1, a_Position.z);\n gl_Position = vec4(clip.w * (2.0 * pt / u_Viewport - 1.0), clip.z, clip.w);\n } else {\n vec2 xBasis = a_PointB.xy - a_PointA.xy;\n vec2 yBasis = normalize(vec2(-xBasis.y, xBasis.x));\n\n vec2 point = a_PointA.xy + xBasis * a_Position.x + yBasis * strokeWidth * a_Position.y;\n point = point - u_Anchor.xy * abs(xBasis);\n\n // round & square\n if (a_Cap > 1.0) {\n point += sign(a_Position.x - 0.5) * normalize(xBasis) * vec2(strokeWidth / 2.0);\n }\n gl_Position = project(vec4(point, u_ZIndex, 1.0), u_ProjectionMatrix, u_ViewMatrix, u_ModelMatrix);\n }\n\n float antialiasblur = 1.0 / strokeWidth;\n v_Distance = vec2(a_Position.y * 2.0, antialiasblur);\n v_Dash = vec4(a_Position.x, a_Dash.xyz);\n}",this.material.fragmentShader="#define GLSLIFY 1\nlayout(std140) uniform ub_SceneParams {\n mat4 u_ProjectionMatrix;\n mat4 u_ViewMatrix;\n vec3 u_CameraPosition;\n float u_DevicePixelRatio;\n vec2 u_Viewport;\n float u_IsOrtho;\n float u_IsPicking;\n};\n\nin vec4 v_PickingResult;\nin vec4 v_Color;\nin vec4 v_StrokeColor;\nin vec4 v_StylePacked1;\nin vec4 v_StylePacked2;\n#ifdef USE_UV\n in vec2 v_Uv;\n#endif\n#ifdef USE_MAP\n uniform sampler2D u_Map;\n#endif\n\nin vec4 v_Dash;\nin vec2 v_Distance;\n\nout vec4 outputColor;\n\nvoid main() {\n vec4 u_Color = v_Color;\nvec4 u_StrokeColor = v_StrokeColor;\nfloat u_Opacity = v_StylePacked1.x;\nfloat u_FillOpacity = v_StylePacked1.y;\nfloat u_StrokeOpacity = v_StylePacked1.z;\nfloat u_StrokeWidth = v_StylePacked1.w;\nfloat u_Visible = v_StylePacked2.x;\nvec3 u_PickingColor = v_PickingResult.xyz;\n\nif (u_Visible < 0.5) {\n discard;\n}\n #ifdef USE_MAP\n #ifdef USE_PATTERN\n vec4 texelColor = texture(SAMPLER_2D(u_Map), v_Uv);\n u_Color = texelColor;\n #else\n vec4 texelColor = texture(SAMPLER_2D(u_Map), v_Uv);\n u_Color = texelColor;\n #endif\n#endif\n\n if (u_IsPicking > 0.5) {\n if (u_PickingColor.x == 0.0 && u_PickingColor.y == 0.0 && u_PickingColor.z == 0.0) {\n discard;\n }\n outputColor = vec4(u_PickingColor, 1.0);\n } else {\n outputColor = u_StrokeColor;\n #ifdef USE_MAP\n outputColor = u_Color;\n #endif\n\n float blur = smoothstep(0.0, v_Distance.y, 1.0 - abs(v_Distance.x));\n float u_dash_offset = v_Dash.y;\n float u_dash_array = v_Dash.z;\n float u_dash_ratio = v_Dash.w;\n\n outputColor.a = outputColor.a\n * blur\n * u_Opacity * u_StrokeOpacity\n * ceil(mod(v_Dash.x + u_dash_offset, u_dash_array) - (u_dash_array * u_dash_ratio));\n }\n}",this.material.defines=sf({},this.material.defines,$g(r0))},e.createGeometry=function(t){var v=this,y=(a.prototype.createGeometry.call(this,t),[]),E=[],_=[],b=[],x=0;t.forEach(function(t){t.nodeName===lt.LINE?(p=t.parsedStyle,g=t.getTotalLength()):t.nodeName===lt.POLYLINE?(c=(u=t.parsedStyle).points.points,e=u.defX,n=u.defY,r=u.lineCap,i=u.lineDash,o=u.lineDashOffset,a=u.markerStart,s=u.markerEnd,l=u.markerStartOffset,u=u.markerEndOffset,p={x1:c[0][0],y1:c[0][1],x2:c[c.length-1][0],y2:c[c.length-1][1],z1:0,z2:0,defX:e,defY:n,lineCap:r,lineDash:i,lineDashOffset:o,isBillboard:!0,markerStart:a,markerEnd:s,markerStartOffset:l,markerEndOffset:u},g=t.getTotalLength()):t.nodeName===lt.PATH&&(e=(c=t.parsedStyle).path.absolutePath,n=c.defX,r=c.defY,i=c.lineCap,o=c.lineDash,a=c.lineDashOffset,s=c.markerStart,l=c.markerEnd,u=c.markerStartOffset,c=c.markerEndOffset,p={x1:e[0][1],y1:e[0][2],x2:e[1][1],y2:e[1][2],z1:0,z2:0,defX:n,defY:r,lineCap:i,lineDash:o,lineDashOffset:a,isBillboard:!1,markerStart:s,markerEnd:l,markerStartOffset:u,markerEndOffset:c},g=t.getTotalLength());var e=p,n=e.x1,r=e.y1,i=e.x2,o=e.y2,a=e.z1,s=e.z2,l=e.defX,u=e.defY,c=e.lineCap,t=e.isBillboard,e=v.calcOffset(p),h=e.startOffsetX,d=e.startOffsetY,f=e.endOffsetX,e=e.endOffsetY,p=v.calcDash(p,g),g=p.dashOffset,m=p.dashSegmentPercent,p=p.dashRatioInEachSegment;E.push(u0[c]),_.push(g,m,p,t?1:0),y.push(n-l+h,r-u+d,a,i-l+f,o-u+e,s),b.push(0+x,2+x,1+x,0+x,3+x,2+x),x+=4}),this.geometry.setIndexBuffer(new Uint32Array(b)),this.geometry.vertexCount=6,this.geometry.setVertexBuffer({bufferIndex:Qg.POSITION,byteStride:20,frequency:Af.PerInstance,attributes:[{format:S.F32_RGB,bufferByteOffset:0,location:r0.POSITION,divisor:0},{format:S.F32_RG,bufferByteOffset:12,location:r0.UV,divisor:0}],data:new Float32Array(l0)}),this.geometry.setVertexBuffer({bufferIndex:n0.POINT,byteStride:24,frequency:Af.PerInstance,attributes:[{format:S.F32_RGB,bufferByteOffset:0,location:r0.POINTA,divisor:1},{format:S.F32_RGB,bufferByteOffset:12,location:r0.POINTB,divisor:1}],data:new Float32Array(y)}),this.geometry.setVertexBuffer({bufferIndex:n0.CAP,byteStride:4,frequency:Af.PerInstance,attributes:[{format:S.F32_R,bufferByteOffset:0,location:r0.CAP,divisor:1}],data:new Float32Array(E)}),this.geometry.setVertexBuffer({bufferIndex:n0.DASH,byteStride:16,frequency:Af.PerInstance,attributes:[{format:S.F32_RGBA,bufferByteOffset:0,location:r0.DASH,divisor:1}],data:new Float32Array(_)})},e.updateAttribute=function(t,e,n,r){var d,i,o,f=this;a.prototype.updateAttribute.call(this,t,e,n,r),this.updateBatchedAttribute(t,e,n,r),"x1"===n||"y1"===n||"x2"===n||"y2"===n||"z1"===n||"z2"===n||"markerStartOffset"===n||"markerEndOffset"===n||"markerStart"===n||"markerEnd"===n||"points"===n||"path"===n?(d=[],t.forEach(function(t){t.nodeName===lt.LINE?u=t.parsedStyle:t.nodeName===lt.POLYLINE&&t.renderable.proxyNodeName===lt.LINE?(e=(l=t.parsedStyle).points.points,n=l.defX,r=l.defY,i=l.lineCap,o=l.markerStart,a=l.markerEnd,s=l.markerStartOffset,l=l.markerEndOffset,u={x1:e[0][0],y1:e[0][1],x2:e[e.length-1][0],y2:e[e.length-1][1],z1:0,z2:0,defX:n,defY:r,lineCap:i,isBillboard:!0,markerStart:o,markerEnd:a,markerStartOffset:s,markerEndOffset:l}):t.nodeName===lt.PATH&&t.renderable.proxyNodeName===lt.LINE&&(n=(e=t.parsedStyle).path.absolutePath,r=e.defX,i=e.defY,o=e.lineCap,a=e.markerStart,s=e.markerEnd,l=e.markerStartOffset,t=e.markerEndOffset,u={x1:n[0][1],y1:n[0][2],x2:n[1][1],y2:n[1][2],z1:0,z2:0,defX:r,defY:i,lineCap:o,isBillboard:!0,markerStart:a,markerEnd:s,markerStartOffset:l,markerEndOffset:t});var e=u,n=e.x1,r=e.y1,i=e.x2,o=e.y2,a=e.z1,s=e.z2,l=e.defX,t=e.defY,e=f.calcOffset(u),u=e.startOffsetX,c=e.startOffsetY,h=e.endOffsetX,e=e.endOffsetY;d.push(n-l+u,r-t+c,a,i-l+h,o-t+e,s)}),this.geometry.updateVertexBuffer(n0.POINT,r0.POINTA,e,new Uint8Array(new Float32Array(d).buffer))):"lineDashOffset"===n||"lineDash"===n||"isBillboard"===n?(i=[],t.forEach(function(t){var e=t.getTotalLength(),e=f.calcDash(t.parsedStyle,e),n=e.dashOffset,r=e.dashSegmentPercent,e=e.dashRatioInEachSegment;i.push(n,r,e,t.parsedStyle.isBillboard?1:0)}),this.geometry.updateVertexBuffer(n0.DASH,r0.DASH,e,new Uint8Array(new Float32Array(i).buffer))):"lineCap"===n&&(o=[],t.forEach(function(t){t=t.parsedStyle.lineCap;o.push(u0[t])}),this.geometry.updateVertexBuffer(n0.CAP,r0.CAP,e,new Uint8Array(new Float32Array(o).buffer)))},e.calcOffset=function(t){var e,n,r=t.x1,i=t.y1,o=t.x2,a=t.y2,s=t.markerStart,l=t.markerEnd,u=t.markerStartOffset,t=t.markerEndOffset,c=0,h=0,d=0,f=0,p=0;return s&&ut(s)&&u&&(e=o-r,n=a-i,p=Math.atan2(n,e),c=Math.cos(p)*(u||0),h=Math.sin(p)*(u||0)),l&&ut(l)&&t&&(e=r-o,n=i-a,p=Math.atan2(n,e),d=Math.cos(p)*(t||0),f=Math.sin(p)*(t||0)),{startOffsetX:c,startOffsetY:h,endOffsetX:d,endOffsetY:f}},e.calcDash=function(t,e){var n=t.lineDash,t=t.lineDashOffset,r=0,i=1,o=0;return n&&n.length&&(r=(t||0)/e,o=0===(t=n.reduce(function(t,e){return t+e},0))?(i=1,0):(i=t/e,n[1]/t)),{dashOffset:r,dashSegmentPercent:i,dashRatioInEachSegment:o}},t}(Ia);function h0(t,e,n,r){t-=n,n=e-r;return Math.sqrt(t*t+n*n)}function d0(t,e){return Math.abs(t-e)<.001}function f0(t,e){var n=Math.min.apply(Math,t),r=Math.min.apply(Math,e);return{x:n,y:r,width:Math.max.apply(Math,t)-n,height:Math.max.apply(Math,e)-r}}function p0(t){return(t+2*Math.PI)%(2*Math.PI)}var g0={box:function(t,e,n,r){return f0([t,n],[e,r])},length:h0,pointAt:function(t,e,n,r,i){return{x:(1-i)*t+i*n,y:(1-i)*e+i*r}},pointDistance:function(t,e,n,r,i,o){var a=(n-t)*(i-t)+(r-e)*(o-e);return a<0?h0(t,e,i,o):(n-t)*(n-t)+(r-e)*(r-e)<a?h0(n,r,i,o):this.pointToLine(t,e,n,r,i,o)},pointToLine:function(t,e,n,r,i,o){n=[n-t,r-e];return ee(n,[0,0])?Math.sqrt((i-t)*(i-t)+(o-e)*(o-e)):(Jt(r=[-n[1],n[0]],r),Math.abs(te([i-t,o-e],r)))},tangentAngle:function(t,e,n,r){return Math.atan2(r-e,n-t)}},m0=1e-4;function v0(t,e,n,r,i,o){for(var a=-1,s=1/0,l=[n,r],u=20,c=1/(u=o&&200<o?o/10:u),h=c/10,d=0;d<=u;d++){var f=d*c,p=[i.apply(void 0,t.concat([f])),i.apply(void 0,e.concat([f]))],p=h0(l[0],l[1],p[0],p[1]);p<s&&(a=f,s=p)}if(0===a)return{x:t[0],y:e[0]};if(1===a)return{x:t[(n=t.length)-1],y:e[n-1]};for(var s=1/0,g=0;g<32&&!(h<m0);g++){var m=a-h,v=a+h,y=[i.apply(void 0,t.concat([m])),i.apply(void 0,e.concat([m]))],y=h0(l[0],l[1],y[0],y[1]);0<=m&&y<s?(a=m,s=y):(m=[i.apply(void 0,t.concat([v])),i.apply(void 0,e.concat([v]))],y=h0(l[0],l[1],m[0],m[1]),v<=1&&y<s?(a=v,s=y):h*=.5)}return{x:i.apply(void 0,t.concat([a])),y:i.apply(void 0,e.concat([a]))}}function y0(t,e,n,r){var i=1-r;return i*i*t+2*r*i*e+r*r*n}function E0(t,e,n){n=t+n-2*e;return d0(n,0)?[.5]:(t=(t-e)/n)<=1&&0<=t?[t]:[]}function _0(t,e,n,r){return 2*(1-r)*(e-t)+2*r*(n-e)}function b0(t,e,n,r,i,o,a){var s=y0(t,n,i,a),l=y0(e,r,o,a),u=g0.pointAt(t,e,n,r,a),n=g0.pointAt(n,r,i,o,a);return[[t,e,u.x,u.y,s,l],[s,l,n.x,n.y,i,o]]}function x0(t,e,n,r,i,o,a){return 0===a?(h0(t,e,n,r)+h0(n,r,i,o)+h0(t,e,i,o))/2:(e=(t=b0(t,e,n,r,i,o,.5))[0],n=t[1],e.push(a-1),n.push(a-1),x0.apply(void 0,e)+x0.apply(void 0,n))}var S0={box:function(t,e,n,r,i,o){var a=E0(t,n,i)[0],s=E0(e,r,o)[0],l=[t,i],u=[e,o];return void 0!==a&&l.push(y0(t,n,i,a)),void 0!==s&&u.push(y0(e,r,o,s)),f0(l,u)},length:function(t,e,n,r,i,o){return x0(t,e,n,r,i,o,3)},nearestPoint:function(t,e,n,r,i,o,a,s){return v0([t,n,i],[e,r,o],a,s,y0)},pointDistance:function(t,e,n,r,i,o,a,s){t=this.nearestPoint(t,e,n,r,i,o,a,s);return h0(t.x,t.y,a,s)},interpolationAt:y0,pointAt:function(t,e,n,r,i,o,a){return{x:y0(t,n,i,a),y:y0(e,r,o,a)}},divide:b0,tangentAngle:function(t,e,n,r,i,o,a){t=_0(t,n,i,a),n=_0(e,r,o,a);return p0(Math.atan2(n,t))}};function w0(t,e,n,r,i){var o=1-i;return o*o*o*t+3*e*i*o*o+3*n*i*i*o+r*i*i*i}function T0(t,e,n,r,i){var o=1-i;return 3*(o*o*(e-t)+2*o*i*(n-e)+i*i*(r-n))}function A0(t,e,n,r){var i,o,r=-3*t+9*e-9*n+3*r,n=6*t-12*e+6*n,e=3*e-3*t,t=[];return d0(r,0)?d0(n,0)||0<=(i=-e/n)&&i<=1&&t.push(i):d0(e=n*n-4*r*e,0)?t.push(-n/(2*r)):0<e&&(o=(-n-(e=Math.sqrt(e)))/(2*r),0<=(i=(-n+e)/(2*r))&&i<=1&&t.push(i),0<=o)&&o<=1&&t.push(o),t}function M0(t,e,n,r,i,o,a,s,l){var u=w0(t,n,i,a,l),c=w0(e,r,o,s,l),h=g0.pointAt(t,e,n,r,l),n=g0.pointAt(n,r,i,o,l),r=g0.pointAt(i,o,a,s,l),i=g0.pointAt(h.x,h.y,n.x,n.y,l),o=g0.pointAt(n.x,n.y,r.x,r.y,l);return[[t,e,h.x,h.y,i.x,i.y,u,c],[u,c,o.x,o.y,r.x,r.y,a,s]]}function R0(t,e,n,r,i,o,a,s,l){if(0===l){for(var u=[t,n,i,a],c=[e,r,o,s],h=0,d=u.length,f=0;f<d;f++)h+=h0(u[f],c[f],u[(f+1)%d],c[(f+1)%d]);return h/2}t=M0(t,e,n,r,i,o,a,s,.5),e=[].concat(t[0],[l-1]),n=[].concat(t[1],[l-1]);return R0.apply(void 0,e)+R0.apply(void 0,n)}var N0={extrema:A0,box:function(t,e,n,r,i,o,a,s){for(var l=[t,a],u=[e,s],c=A0(t,n,i,a),h=A0(e,r,o,s),d=0;d<c.length;d++)l.push(w0(t,n,i,a,c[d]));for(var f=0;f<h.length;f++)u.push(w0(e,r,o,s,h[f]));return f0(l,u)},length:function(t,e,n,r,i,o,a,s){return R0(t,e,n,r,i,o,a,s,3)},nearestPoint:function(t,e,n,r,i,o,a,s,l,u,c){return v0([t,n,i,a],[e,r,o,s],l,u,w0,c)},pointDistance:function(t,e,n,r,i,o,a,s,l,u,c){t=this.nearestPoint(t,e,n,r,i,o,a,s,l,u,c);return h0(t.x,t.y,l,u)},interpolationAt:w0,pointAt:function(t,e,n,r,i,o,a,s,l){return{x:w0(t,n,i,a,l),y:w0(e,r,o,s,l)}},divide:M0,tangentAngle:function(t,e,n,r,i,o,a,s,l){t=T0(t,n,i,a,l),n=T0(e,r,o,s,l);return p0(Math.atan2(n,t))}},C0=10,P0=8,O0=100;function I0(t,e,n,r,i,o,a){var s,l,u,c,h,d=a[a.length-2],f=a[a.length-1],p=(a.length-=2,N0.length(d,f,t,e,n,r,i,o)),g=Ue(p/C0,P0,O0);a.push(d,f);for(var m,v=1;v<=g;++v)a.push((u=(l=(s=1-(m=v/g))*s)*s)*d+3*l*m*t+3*s*(c=m*m)*n+(h=c*m)*i,u*f+3*l*m*e+3*s*c*r+h*o)}var L0,k0=1e20,D0=function(){function t(t){this.buffer=void 0,this.radius=void 0,this.cutoff=void 0,this.size=void 0,this.f=void 0,this.z=void 0,this.v=void 0,this.gridOuter=void 0,this.gridInner=void 0,this.ctx=void 0;var e=t.fontSize,e=void 0===e?24:e,n=t.buffer,n=void 0===n?3:n,r=t.radius,r=void 0===r?8:r,i=t.cutoff,i=void 0===i?.25:i,o=t.fontFamily,o=void 0===o?"sans-serif":o,a=t.fontWeight,a=void 0===a?"normal":a,s=t.fontStyle,s=void 0===s?"normal":s,t=t.canvas,i=(this.buffer=n,this.cutoff=i,this.radius=r,this.size=e+4*n),r=ct.offscreenCanvas.getOrCreateCanvas(t),n=(r.width=i,r.height=i,ct.offscreenCanvas.getOrCreateContext(t));(this.ctx=n).font=s+" "+a+" "+e+"px "+o,n.textBaseline="alphabetic",n.textAlign="left",n.fillStyle="black",this.gridOuter=new Float64Array(i*i),this.gridInner=new Float64Array(i*i),this.f=new Float64Array(i),this.z=new Float64Array(i+1),this.v=new Uint16Array(i)}return t.prototype.draw=function(t){var e=this.ctx.measureText(t),n=e.width,r=e.actualBoundingBoxAscent,i=e.actualBoundingBoxDescent,o=e.actualBoundingBoxLeft,e=e.actualBoundingBoxRight,r=Math.ceil(r),a=Math.max(0,Math.min(this.size-this.buffer,Math.ceil(e-o))),s=Math.min(this.size-this.buffer,r+Math.ceil(i)),l=a+2*this.buffer,e=s+2*this.buffer,u=Math.max(l*e,0),c=new Uint8ClampedArray(u),o={data:c,width:l,height:e,glyphWidth:a,glyphHeight:s,glyphTop:r,glyphLeft:0,glyphAdvance:n};if(0!==a&&0!==s){var i=this.ctx,h=this.buffer,d=this.gridInner,f=this.gridOuter,p=(i.clearRect(h,h,a,s),i.fillText(t,h,h+r),i.getImageData(h,h,a,s));f.fill(k0,0,u),d.fill(0,0,u);for(var g=0;g<s;g++)for(var m=0;m<a;m++){var v,y=p.data[4*(g*a+m)+3]/255;0!=y&&(v=(g+h)*l+m+h,1==y?(f[v]=0,d[v]=k0):(f[v]=0<(y=.5-y)?y*y:0,d[v]=y<0?y*y:0))}B0(f,0,0,l,e,l,this.f,this.v,this.z),B0(d,h,h,a,s,l,this.f,this.v,this.z);for(var E=0;E<u;E++){var _=Math.sqrt(f[E])-Math.sqrt(d[E]);c[E]=Math.round(255-255*(_/this.radius+this.cutoff))}}return o},t}();function B0(t,e,n,r,i,o,a,s,l){for(var u=e;u<e+r;u++)F0(t,n*o+u,o,i,a,s,l);for(var c=n;c<n+i;c++)F0(t,c*o+e,1,r,a,s,l)}function F0(t,e,n,r,i,o,a){a[o[0]=0]=-k0,a[1]=k0,i[0]=t[e];for(var s=1,l=0,u=0;s<r;s++){i[s]=t[e+s*n];var c=s*s;do{var h=o[l],u=(i[s]-i[h]+c-h*h)/(s-h)/2}while(u<=a[l]&&-1<--l);o[++l]=s,a[l]=u,a[l+1]=k0}for(var d=0,f=0;d<r;d++){for(;a[f+1]<d;)f++;var p=o[f],g=d-p;t[e+d*n]=i[p]+g*g}}(b=L0=L0||{})[b.NONE=0]="NONE",b[b.FILL=1]="FILL",b[b.JOINT_BEVEL=4]="JOINT_BEVEL",b[b.JOINT_MITER=8]="JOINT_MITER",b[b.JOINT_ROUND=12]="JOINT_ROUND",b[b.JOINT_CAP_BUTT=16]="JOINT_CAP_BUTT",b[b.JOINT_CAP_SQUARE=18]="JOINT_CAP_SQUARE",b[b.JOINT_CAP_ROUND=20]="JOINT_CAP_ROUND",b[b.FILL_EXPAND=24]="FILL_EXPAND",b[b.CAP_BUTT=32]="CAP_BUTT",b[b.CAP_SQUARE=64]="CAP_SQUARE",b[b.CAP_ROUND=96]="CAP_ROUND",b[b.CAP_BUTT2=128]="CAP_BUTT2";var U0,G0,m,W0=2,V0=3,j0=((xa=U0=U0||{})[xa.PACKED=0]="PACKED",xa[xa.VERTEX_NUM=1]="VERTEX_NUM",xa[xa.TRAVEL=2]="TRAVEL",(a=G0=G0||{})[a.PREV=0]="PREV",a[a.POINT1=1]="POINT1",a[a.POINT2=2]="POINT2",a[a.NEXT=3]="NEXT",a[a.VERTEX_JOINT=4]="VERTEX_JOINT",a[a.VERTEX_NUM=5]="VERTEX_NUM",a[a.TRAVEL=6]="TRAVEL",(zs=m=m||{}).MODEL_MATRIX="u_ModelMatrix",zs.FILL_COLOR="u_FillColor",zs.STROKE_COLOR="u_StrokeColor",zs.STROKE_WIDTH="u_StrokeWidth",zs.INCREASED_LINE_WIDTH_FOR_HIT_TESTING="u_IncreasedLineWidthForHitTesting",zs.OPACITY="u_Opacity",zs.FILL_OPACITY="u_FillOpacity",zs.STROKE_OPACITY="u_StrokeOpacity",zs.EXPAND="u_Expand",zs.MITER_LIMIT="u_MiterLimit",zs.SCALE_MODE="u_ScaleMode",zs.ALIGNMENT="u_Alignment",zs.PICKING_COLOR="u_PickingColor",zs.DASH="u_Dash",zs.GAP="u_Gap",zs.DASH_OFFSET="u_DashOffset",zs.VISIBLE="u_Visible",zs.Z_INDEX="u_ZIndex",function(n){function t(){return n.apply(this,arguments)||this}lf(t,n);var e=t.prototype;return e.shouldMerge=function(t,e){return!1},e.updateAttribute=function(t,e,d,f){var p=this;n.prototype.updateAttribute.call(this,t,e,d,f),t.forEach(function(t){var e,n=t.parsedStyle,r=n.stroke,i=n.opacity,o=n.fillOpacity,a=n.strokeOpacity,s=n.lineWidth,l=n.increasedLineWidthForHitTesting,u=n.anchor,c=n.lineDash,h=n.lineDashOffset,n=n.visibility;"lineJoin"===d||"lineCap"===d||"markerStart"===d||"markerEnd"===d||"markerStartOffset"===d||"markerEndOffset"===d||t.nodeName===lt.CIRCLE&&"r"===d||t.nodeName===lt.ELLIPSE&&("rx"===d||"ry"===d)||t.nodeName===lt.RECT&&("width"===d||"height"===d||"radius"===d)||t.nodeName===lt.LINE&&("x1"===d||"y1"===d||"x2"===d||"y2"===d)||t.nodeName===lt.POLYLINE&&"points"===d||t.nodeName===lt.POLYGON&&"points"===d||t.nodeName===lt.PATH&&"path"===d?(p.material.geometryDirty=!0,p.material.programDirty=!0):"stroke"===d?(e=[0,0,0,0],To(r)&&(e=[Number(r.r)/255,Number(r.g)/255,Number(r.b)/255,Number(r.alpha)]),p.material.setUniforms(((r={})[m.STROKE_COLOR]=e,r))):"opacity"===d?p.material.setUniforms(((e={})[m.OPACITY]=i,e)):"fillOpacity"===d?p.material.setUniforms(((r={})[m.FILL_OPACITY]=o,r)):"strokeOpacity"===d?p.material.setUniforms(((i={})[m.STROKE_OPACITY]=a,i)):"lineWidth"===d?p.material.setUniforms(((e={})[m.STROKE_WIDTH]=s,e)):"increasedLineWidthForHitTesting"===d?p.material.setUniforms(((o={})[m.INCREASED_LINE_WIDTH_FOR_HIT_TESTING]=l||0,o)):"anchor"===d||"modelMatrix"===d?(a=r=0,(i=t.getGeometryBounds())&&(r=-(s=i.halfExtents)[0]*u[0]*2,a=-s[1]*u[1]*2),e=K(),wt(e,t.getWorldTransform(),ht(e,x(r,a,0))),p.material.setUniforms(((l={})[m.MODEL_MATRIX]=e,l))):"visibility"===d?p.material.setUniforms(((o={})[m.VISIBLE]="visible"===n?1:0,o)):"lineDash"===d?p.material.setUniforms(((i={})[m.DASH]=c[0]||0,i[m.GAP]=c[1]||0,i)):"lineDashOffset"===d?p.material.setUniforms(((s={})[m.DASH_OFFSET]=h||0,s)):"pointerEvents"===d&&(r=f&&t.isInteractive()&&(null==(u=t.renderable3D)?void 0:u.encodedPickingColor)||[0,0,0],p.material.setUniforms(((a={})[m.PICKING_COLOR]=r,a)))})},e.changeRenderOrder=function(t,e){var n;this.material&&this.material.setUniforms(((n={})[m.Z_INDEX]=e*zg,n))},e.createMaterial=function(t){this.material.vertexShader="#define GLSLIFY 1\nlayout(std140) uniform ub_SceneParams {\n mat4 u_ProjectionMatrix;\n mat4 u_ViewMatrix;\n vec3 u_CameraPosition;\n float u_DevicePixelRatio;\n vec2 u_Viewport;\n float u_IsOrtho;\n float u_IsPicking;\n};\nlayout(std140) uniform ub_ObjectParams {\n mat4 u_ModelMatrix;\n vec4 u_FillColor;\n vec4 u_StrokeColor;\n float u_StrokeWidth;\n float u_Opacity;\n float u_FillOpacity;\n float u_StrokeOpacity;\n float u_Expand;\n float u_MiterLimit;\n float u_ScaleMode;\n float u_Alignment;\n vec3 u_PickingColor;\n float u_Dash;\n float u_Gap;\n float u_DashOffset;\n float u_Visible;\n float u_ZIndex;\n float u_IncreasedLineWidthForHitTesting;\n};\n\nlayout(location = PREV) in vec2 a_Prev;\nlayout(location = POINT1) in vec2 a_Point1;\nlayout(location = POINT2) in vec2 a_Point2;\nlayout(location = NEXT) in vec2 a_Next;\nlayout(location = VERTEX_JOINT) in float a_VertexJoint;\nlayout(location = VERTEX_NUM) in float a_VertexNum;\nlayout(location = TRAVEL) in float a_Travel;\n\nconst float FILL = 1.0;\nconst float BEVEL = 4.0;\nconst float MITER = 8.0;\nconst float ROUND = 12.0;\nconst float JOINT_CAP_BUTT = 16.0;\nconst float JOINT_CAP_SQUARE = 18.0;\nconst float JOINT_CAP_ROUND = 20.0;\nconst float FILL_EXPAND = 24.0;\nconst float CAP_BUTT = 1.0;\nconst float CAP_SQUARE = 2.0;\nconst float CAP_ROUND = 3.0;\nconst float CAP_BUTT2 = 4.0;\n\nout vec4 v_Distance;\nout vec4 v_Arc;\nout float v_Type;\nout float v_Travel;\n\nvec2 doBisect(\n vec2 norm, float len, vec2 norm2, float len2, float dy, float inner\n) {\n vec2 bisect = (norm + norm2) / 2.0;\n bisect /= dot(norm, bisect);\n vec2 shift = dy * bisect;\n if (inner > 0.5) {\n if (len < len2) {\n if (abs(dy * (bisect.x * norm.y - bisect.y * norm.x)) > len) {\n return dy * norm;\n }\n } else {\n if (abs(dy * (bisect.x * norm2.y - bisect.y * norm2.x)) > len2) {\n return dy * norm;\n }\n }\n }\n return dy * bisect;\n}\n\nvoid main() {\n vec2 pointA = (u_ModelMatrix * vec4(a_Point1, 0., 1.0)).xy;\n vec2 pointB = (u_ModelMatrix * vec4(a_Point2, 0., 1.0)).xy;\n\n vec2 xBasis = pointB - pointA;\n float len = length(xBasis);\n vec2 forward = xBasis / len;\n vec2 norm = vec2(forward.y, -forward.x);\n\n float type = a_VertexJoint;\n\n float lineWidth;\n if (u_IsPicking > 0.5) {\n lineWidth = u_IncreasedLineWidthForHitTesting + u_StrokeWidth;\n } else {\n lineWidth = u_StrokeWidth;\n }\n\n if (u_ScaleMode > 2.5) {\n lineWidth *= length(u_ModelMatrix * vec4(1.0, 0.0, 0.0, 0.0));\n } else if (u_ScaleMode > 1.5) {\n lineWidth *= length(u_ModelMatrix * vec4(0.0, 1.0, 0.0, 0.0));\n } else if (u_ScaleMode > 0.5) {\n vec2 avgDiag = (u_ModelMatrix * vec4(1.0, 1.0, 0.0, 0.0)).xy;\n lineWidth *= sqrt(dot(avgDiag, avgDiag) * 0.5);\n }\n float capType = floor(type / 32.0);\n type -= capType * 32.0;\n v_Arc = vec4(0.0);\n lineWidth *= 0.5;\n float lineAlignment = 2.0 * u_Alignment - 1.0;\n\n vec2 pos;\n\n if (capType == CAP_ROUND) {\n if (a_VertexNum < 3.5) {\n gl_Position = vec4(0.0, 0.0, 0.0, 1.0);\n return;\n }\n type = JOINT_CAP_ROUND;\n capType = 0.0;\n }\n\n if (type >= BEVEL) {\n float dy = lineWidth + u_Expand;\n float inner = 0.0;\n if (a_VertexNum >= 1.5) {\n dy = -dy;\n inner = 1.0;\n }\n\n vec2 base, next, xBasis2, bisect;\n float flag = 0.0;\n float sign2 = 1.0;\n if (a_VertexNum < 0.5 || a_VertexNum > 2.5 && a_VertexNum < 3.5) {\n next = (u_ModelMatrix * vec4(a_Prev, 0.0, 1.0)).xy;\n base = pointA;\n flag = type - floor(type / 2.0) * 2.0;\n sign2 = -1.0;\n\n } else {\n next = (u_ModelMatrix * vec4(a_Next, 0.0, 1.0)).xy;\n base = pointB;\n if (type >= MITER && type < MITER + 3.5) {\n flag = step(MITER + 1.5, type);\n // check miter limit here?\n }\n }\n xBasis2 = next - base;\n float len2 = length(xBasis2);\n vec2 norm2 = vec2(xBasis2.y, -xBasis2.x) / len2;\n float D = norm.x * norm2.y - norm.y * norm2.x;\n if (D < 0.0) {\n inner = 1.0 - inner;\n }\n norm2 *= sign2;\n\n if (abs(lineAlignment) > 0.01) {\n float shift = lineWidth * lineAlignment;\n pointA += norm * shift;\n pointB += norm * shift;\n if (abs(D) < 0.01) {\n base += norm * shift;\n } else {\n base += doBisect(norm, len, norm2, len2, shift, 0.0);\n }\n }\n\n float collinear = step(0.0, dot(norm, norm2));\n v_Type = 0.0;\n float dy2 = -1000.0;\n float dy3 = -1000.0;\n if (abs(D) < 0.01 && collinear < 0.5) {\n if (type >= ROUND && type < ROUND + 1.5) {\n type = JOINT_CAP_ROUND;\n }\n //TODO: BUTT here too\n }\n\n if (a_VertexNum < 3.5) {\n if (abs(D) < 0.01) {\n pos = dy * norm;\n } else {\n if (flag < 0.5 && inner < 0.5) {\n pos = dy * norm;\n } else {\n pos = doBisect(norm, len, norm2, len2, dy, inner);\n }\n }\n if (capType >= CAP_BUTT && capType < CAP_ROUND) {\n float extra = step(CAP_SQUARE, capType) * lineWidth;\n vec2 back = -forward;\n if (a_VertexNum < 0.5 || a_VertexNum > 2.5) {\n pos += back * (u_Expand + extra);\n dy2 = u_Expand;\n } else {\n dy2 = dot(pos + base - pointA, back) - extra;\n }\n }\n if (type >= JOINT_CAP_BUTT && type < JOINT_CAP_SQUARE + 0.5) {\n float extra = step(JOINT_CAP_SQUARE, type) * lineWidth;\n if (a_VertexNum < 0.5 || a_VertexNum > 2.5) {\n dy3 = dot(pos + base - pointB, forward) - extra;\n } else {\n pos += forward * (u_Expand + extra);\n dy3 = u_Expand;\n if (capType >= CAP_BUTT) {\n dy2 -= u_Expand + extra;\n }\n }\n }\n } else if (type >= JOINT_CAP_ROUND && type < JOINT_CAP_ROUND + 1.5) {\n if (inner > 0.5) {\n dy = -dy;\n inner = 0.0;\n }\n vec2 d2 = abs(dy) * forward;\n if (a_VertexNum < 4.5) {\n dy = -dy;\n pos = dy * norm;\n } else if (a_VertexNum < 5.5) {\n pos = dy * norm;\n } else if (a_VertexNum < 6.5) {\n pos = dy * norm + d2;\n v_Arc.x = abs(dy);\n } else {\n dy = -dy;\n pos = dy * norm + d2;\n v_Arc.x = abs(dy);\n }\n dy2 = 0.0;\n v_Arc.y = dy;\n v_Arc.z = 0.0;\n v_Arc.w = lineWidth;\n v_Type = 3.0;\n } else if (abs(D) < 0.01) {\n pos = dy * norm;\n } else {\n if (type >= ROUND && type < ROUND + 1.5) {\n if (inner > 0.5) {\n dy = -dy;\n inner = 0.0;\n }\n if (a_VertexNum < 4.5) {\n pos = doBisect(norm, len, norm2, len2, -dy, 1.0);\n } else if (a_VertexNum < 5.5) {\n pos = dy * norm;\n } else if (a_VertexNum > 7.5) {\n pos = dy * norm2;\n } else {\n pos = doBisect(norm, len, norm2, len2, dy, 0.0);\n float d2 = abs(dy);\n if (length(pos) > abs(dy) * 1.5) {\n if (a_VertexNum < 6.5) {\n pos.x = dy * norm.x - d2 * norm.y;\n pos.y = dy * norm.y + d2 * norm.x;\n } else {\n pos.x = dy * norm2.x + d2 * norm2.y;\n pos.y = dy * norm2.y - d2 * norm2.x;\n }\n }\n }\n vec2 norm3 = normalize(norm + norm2);\n float sign = step(0.0, dy) * 2.0 - 1.0;\n v_Arc.x = sign * dot(pos, norm3);\n v_Arc.y = pos.x * norm3.y - pos.y * norm3.x;\n v_Arc.z = dot(norm, norm3) * lineWidth;\n v_Arc.w = lineWidth;\n dy = -sign * dot(pos, norm);\n dy2 = -sign * dot(pos, norm2);\n dy3 = v_Arc.z - v_Arc.x;\n v_Type = 3.0;\n } else {\n float hit = 0.0;\n if (type >= BEVEL && type < BEVEL + 1.5) {\n if (dot(norm, norm2) > 0.0) {\n type = MITER;\n }\n }\n if (type >= MITER && type < MITER + 3.5) {\n if (inner > 0.5) {\n dy = -dy;\n inner = 0.0;\n }\n float sign = step(0.0, dy) * 2.0 - 1.0;\n pos = doBisect(norm, len, norm2, len2, dy, 0.0);\n if (length(pos) > abs(dy) * u_MiterLimit) {\n type = BEVEL;\n } else {\n if (a_VertexNum < 4.5) {\n dy = -dy;\n pos = doBisect(norm, len, norm2, len2, dy, 1.0);\n } else if (a_VertexNum < 5.5) {\n pos = dy * norm;\n } else if (a_VertexNum > 6.5) {\n pos = dy * norm2;\n }\n v_Type = 1.0;\n dy = -sign * dot(pos, norm);\n dy2 = -sign * dot(pos, norm2);\n hit = 1.0;\n }\n }\n if (type >= BEVEL && type < BEVEL + 1.5) {\n if (inner > 0.5) {\n dy = -dy;\n inner = 0.0;\n }\n float d2 = abs(dy);\n vec2 pos3 = vec2(dy * norm.x - d2 * norm.y, dy * norm.y + d2 * norm.x);\n vec2 pos4 = vec2(dy * norm2.x + d2 * norm2.y, dy * norm2.y - d2 * norm2.x);\n if (a_VertexNum < 4.5) {\n pos = doBisect(norm, len, norm2, len2, -dy, 1.0);\n } else if (a_VertexNum < 5.5) {\n pos = dy * norm;\n } else if (a_VertexNum > 7.5) {\n pos = dy * norm2;\n } else {\n if (a_VertexNum < 6.5) {\n pos = pos3;\n } else {\n pos = pos4;\n }\n }\n vec2 norm3 = normalize(norm + norm2);\n float sign = step(0.0, dy) * 2.0 - 1.0;\n dy = -sign * dot(pos, norm);\n dy2 = -sign * dot(pos, norm2);\n dy3 = (-sign * dot(pos, norm3)) + lineWidth;\n v_Type = 4.0;\n hit = 1.0;\n }\n if (hit < 0.5) {\n gl_Position = vec4(0.0, 0.0, 0.0, 1.0);\n return;\n }\n }\n }\n pos += base;\n v_Distance = vec4(dy, dy2, dy3, lineWidth) * u_DevicePixelRatio;\n v_Arc = v_Arc * u_DevicePixelRatio;\n v_Travel = a_Travel + dot(pos - pointA, vec2(-norm.y, norm.x));\n }\n\n gl_Position = u_ProjectionMatrix * u_ViewMatrix * vec4(pos, u_ZIndex, 1.0);\n}",this.material.fragmentShader="#define GLSLIFY 1\nlayout(std140) uniform ub_SceneParams {\n mat4 u_ProjectionMatrix;\n mat4 u_ViewMatrix;\n vec3 u_CameraPosition;\n float u_DevicePixelRatio;\n vec2 u_Viewport;\n float u_IsOrtho;\n float u_IsPicking;\n};\nlayout(std140) uniform ub_ObjectParams {\n mat4 u_ModelMatrix;\n vec4 u_FillColor;\n vec4 u_StrokeColor;\n float u_StrokeWidth;\n float u_Opacity;\n float u_FillOpacity;\n float u_StrokeOpacity;\n float u_Expand;\n float u_MiterLimit;\n float u_ScaleMode;\n float u_Alignment;\n vec3 u_PickingColor;\n float u_Dash;\n float u_Gap;\n float u_DashOffset;\n float u_Visible;\n float u_ZIndex;\n float u_IncreasedLineWidthForHitTesting;\n};\n\nin vec4 v_Distance;\nin vec4 v_Arc;\nin float v_Type;\nin float v_Travel;\n\nout vec4 outputColor;\n\n#define COLOR_SCALE 1. / 255.\n\nvoid main(){\n if (u_Visible < 0.5) {\n discard;\n }\n\n float alpha = 1.0;\n float lineWidth = v_Distance.w;\n if (v_Type < 0.5) {\n float left = max(v_Distance.x - 0.5, -v_Distance.w);\n float right = min(v_Distance.x + 0.5, v_Distance.w);\n float near = v_Distance.y - 0.5;\n float far = min(v_Distance.y + 0.5, 0.0);\n float top = v_Distance.z - 0.5;\n float bottom = min(v_Distance.z + 0.5, 0.0);\n alpha = max(right - left, 0.0) * max(bottom - top, 0.0) * max(far - near, 0.0);\n } else if (v_Type < 1.5) {\n float a1 = clamp(v_Distance.x + 0.5 - lineWidth, 0.0, 1.0);\n float a2 = clamp(v_Distance.x + 0.5 + lineWidth, 0.0, 1.0);\n float b1 = clamp(v_Distance.y + 0.5 - lineWidth, 0.0, 1.0);\n float b2 = clamp(v_Distance.y + 0.5 + lineWidth, 0.0, 1.0);\n alpha = a2 * b2 - a1 * b1;\n } else if (v_Type < 2.5) {\n alpha *= max(min(v_Distance.x + 0.5, 1.0), 0.0);\n alpha *= max(min(v_Distance.y + 0.5, 1.0), 0.0);\n alpha *= max(min(v_Distance.z + 0.5, 1.0), 0.0);\n } else if (v_Type < 3.5) {\n float a1 = clamp(v_Distance.x + 0.5 - lineWidth, 0.0, 1.0);\n float a2 = clamp(v_Distance.x + 0.5 + lineWidth, 0.0, 1.0);\n float b1 = clamp(v_Distance.y + 0.5 - lineWidth, 0.0, 1.0);\n float b2 = clamp(v_Distance.y + 0.5 + lineWidth, 0.0, 1.0);\n float alpha_miter = a2 * b2 - a1 * b1;\n float alpha_plane = max(min(v_Distance.z + 0.5, 1.0), 0.0);\n float d = length(v_Arc.xy);\n float circle_hor = max(min(v_Arc.w, d + 0.5) - max(-v_Arc.w, d - 0.5), 0.0);\n float circle_vert = min(v_Arc.w * 2.0, 1.0);\n float alpha_circle = circle_hor * circle_vert;\n alpha = min(alpha_miter, max(alpha_circle, alpha_plane));\n } else {\n float a1 = clamp(v_Distance.x + 0.5 - lineWidth, 0.0, 1.0);\n float a2 = clamp(v_Distance.x + 0.5 + lineWidth, 0.0, 1.0);\n float b1 = clamp(v_Distance.y + 0.5 - lineWidth, 0.0, 1.0);\n float b2 = clamp(v_Distance.y + 0.5 + lineWidth, 0.0, 1.0);\n alpha = a2 * b2 - a1 * b1;\n alpha *= max(min(v_Distance.z + 0.5, 1.0), 0.0);\n }\n\n if (u_Dash + u_Gap > 1.0) {\n float scalingFactor = sqrt(u_ModelMatrix[0][0] * u_ModelMatrix[0][0] + u_ModelMatrix[0][1] * u_ModelMatrix[0][1] + u_ModelMatrix[0][2] * u_ModelMatrix[0][2]);\n float travel = mod(v_Travel + u_Gap * scalingFactor * 0.5 + u_DashOffset, u_Dash * scalingFactor + u_Gap * scalingFactor) - (u_Gap * scalingFactor * 0.5);\n float left = max(travel - 0.5, -0.5);\n float right = min(travel + 0.5, u_Gap * scalingFactor + 0.5);\n alpha *= max(0.0, right - left);\n }\n\n if (u_IsPicking > 0.5) {\n vec3 pickingColor = COLOR_SCALE * u_PickingColor;\n if (pickingColor.x == 0.0 && pickingColor.y == 0.0 && pickingColor.z == 0.0) {\n discard;\n }\n outputColor = vec4(pickingColor, 1.0);\n } else {\n outputColor = u_StrokeColor;\n outputColor.a *= alpha * u_Opacity * u_StrokeOpacity;\n }\n}",this.material.defines=sf({},this.material.defines,$g(G0));var t=t[0],e=t.parsedStyle,n=e.fill,r=e.stroke,i=e.opacity,o=e.fillOpacity,a=e.strokeOpacity,s=e.lineWidth,l=e.increasedLineWidthForHitTesting,u=e.anchor,c=e.lineDash,h=e.lineDashOffset,e=e.visibility,d=[0,0,0,0],n=(To(n)&&(d=[Number(n.r)/255,Number(n.g)/255,Number(n.b)/255,Number(n.alpha)]),[0,0,0,0]),r=(To(r)&&(n=[Number(r.r)/255,Number(r.g)/255,Number(r.b)/255,Number(r.alpha)]),t.isInteractive()&&(null==(r=t.renderable3D)?void 0:r.encodedPickingColor)||[0,0,0]),f=0,p=0,g=t.getGeometryBounds(),g=(g&&(f=-(g=g.halfExtents)[0]*u[0]*2,p=-g[1]*u[1]*2),K());wt(g,t.getWorldTransform(),ht(g,x(f,p,0))),this.material.setUniforms(((u={})[m.MODEL_MATRIX]=g,u[m.FILL_COLOR]=d,u[m.STROKE_COLOR]=n,u[m.STROKE_WIDTH]=s,u[m.INCREASED_LINE_WIDTH_FOR_HIT_TESTING]=l||0,u[m.OPACITY]=i,u[m.FILL_OPACITY]=o,u[m.STROKE_OPACITY]=a,u[m.EXPAND]=1,u[m.MITER_LIMIT]=5,u[m.SCALE_MODE]=1,u[m.ALIGNMENT]=.5,u[m.PICKING_COLOR]=r,u[m.DASH]=c&&c[0]||0,u[m.GAP]=c&&c[1]||0,u[m.DASH_OFFSET]=h||0,u[m.VISIBLE]="visible"===e?1:0,u[m.Z_INDEX]=t.sortable.renderOrder*zg,u)),this.material.cullMode=vf.None},e.createGeometry=function(t){var t=z0(t[0]),e=t.pointsBuffer,n=t.travelBuffer,t=t.instancedCount;this.geometry.setVertexBuffer({bufferIndex:U0.PACKED,byteStride:48,frequency:Af.PerInstance,attributes:[{format:S.F32_RG,bufferByteOffset:0,byteStride:12,location:G0.PREV,divisor:1},{format:S.F32_RG,bufferByteOffset:12,byteStride:12,location:G0.POINT1,divisor:1},{format:S.F32_R,bufferByteOffset:20,byteStride:12,location:G0.VERTEX_JOINT,divisor:1},{format:S.F32_RG,bufferByteOffset:24,byteStride:12,location:G0.POINT2,divisor:1},{format:S.F32_RG,bufferByteOffset:36,byteStride:12,location:G0.NEXT,divisor:1}],data:new Float32Array(e)}),this.geometry.setVertexBuffer({bufferIndex:U0.VERTEX_NUM,byteStride:4,frequency:Af.PerInstance,attributes:[{format:S.F32_R,bufferByteOffset:0,byteStride:4,location:G0.VERTEX_NUM,divisor:0}],data:new Float32Array([0,1,2,3,4,5,6,7,8])}),this.geometry.setVertexBuffer({bufferIndex:U0.TRAVEL,byteStride:4,frequency:Af.PerInstance,attributes:[{format:S.F32_R,bufferByteOffset:0,byteStride:4,location:G0.TRAVEL,divisor:1}],data:new Float32Array(n)}),this.geometry.vertexCount=15,this.geometry.instancedCount=t,this.geometry.setIndexBuffer(new Uint32Array([0,2,1,0,3,2,4,6,5,4,7,6,4,7,8]))},t}(Ia));function z0(y,t){void 0===t&&(t=!1);var e=y.parsedStyle,n=e.lineCap,e=e.lineJoin,r=y.parsedStyle,E=r.defX,_=r.defY,r=y.parsedStyle,i=r.markerStart,o=r.markerEnd,a=r.markerStartOffset,r=r.markerEndOffset,b=[],s=[];if(y.nodeName===lt.POLYLINE||y.nodeName===lt.POLYGON){var l=y.parsedStyle.points.points,u=l.length,c=0,h=0,d=0,f=0,p=0;if(i&&ut(i)&&a&&(N=l[1][0]-l[0][0],x=l[1][1]-l[0][1],p=Math.atan2(x,N),c=Math.cos(p)*(a||0),h=Math.sin(p)*(a||0)),o&&ut(o)&&r&&(N=l[u-2][0]-l[u-1][0],x=l[u-2][1]-l[u-1][1],p=Math.atan2(x,N),d=Math.cos(p)*(r||0),f=Math.sin(p)*(r||0)),b[0]=l.reduce(function(t,e,n){var r=0,i=0;return 0===n?(r=c,i=h):n===u-1&&(r=d,i=f),t.push(e[0]-E+r,e[1]-_+i),t},[]),y.nodeName===lt.POLYGON){if(t)return s=Dd(b[0],[],2),{pointsBuffer:b[0],travelBuffer:[],triangles:s,instancedCount:Math.round(b[0].length/W0)};b[0].push(b[0][0],b[0][1]),(x=b[0]).push.apply(x,H0(b[0][0],b[0][1],b[0][2],b[0][3]))}}else if(y.nodeName===lt.PATH||y.nodeName===lt.CIRCLE||y.nodeName===lt.ELLIPSE||y.nodeName===lt.RECT){y.nodeName!==lt.PATH?(E=(g=Xo($i(y,J(K())),y)).rect.x,_=g.rect.y,y.nodeName===lt.RECT&&(p=(N=y.parsedStyle).width,l=N.height,p<0&&(E+=g.rect.width),l<0)&&(_+=g.rect.height)):g=y.parsedStyle.path;var g,m,v,x=g,S=x.absolutePath,w=x.segments,T=0,A=0,M=0,R=0,N=0,C=(i&&ut(i)&&a&&(l=(p=i.parentNode.getStartTangent())[0],g=p[1],m=l[0]-g[0],v=l[1]-g[1],N=Math.atan2(v,m),T=Math.cos(N)*(a||0),A=Math.sin(N)*(a||0)),o&&ut(o)&&r&&(i=(x=o.parentNode.getEndTangent())[0],p=x[1],m=i[0]-p[0],v=i[1]-p[1],N=Math.atan2(v,m),M=Math.cos(N)*(r||0),R=Math.sin(N)*(r||0)),-1),P=-1;if(S.forEach(function(t,e){var n=t[0],t=t.slice(1),r=S[e+1],i=0===e&&(0!==T||0!==A),r=(e===S.length-1||r&&("M"===r[0]||"Z"===r[0]))&&0!==M&&0!==R;if("M"===n)b[++P]=[],C=b[P].length,i?b[P].push(t[0]-E+T,t[1]-_+A,t[0]-E,t[1]-_):b[P].push(t[0]-E,t[1]-_);else if("L"===n)r?b[P].push(t[0]-E+M,t[1]-_+R):b[P].push(t[0]-E,t[1]-_);else if("Q"===n){for(var o=t[0]-E,a=t[1]-_,s=t[2]-E,l=t[3]-_,u=b[P],c=u[u.length-2],h=u[u.length-1],i=S0.length(c,h,o,a,s,l),d=Ue(i/C0,P0,O0),f=1;f<=d;++f){var p,g=f/d;u.push((p=c+(o-c)*g)+(o+(s-o)*g-p)*g,(p=h+(a-h)*g)+(a+(l-a)*g-p)*g)}r&&b[P].push(t[2]-E+M,t[3]-_+R)}else if("A"===n){for(var i=w[e].prePoint,m=me(i[0],i[1],t[0],t[1],t[2],t[3],t[4],t[5],t[6],void 0),v=0;v<m.length;v+=6)I0(m[v]-E,m[v+1]-_,m[v+2]-E,m[v+3]-_,m[v+4]-E,m[v+5]-_,b[P]);r&&b[P].push(t[5]-E+M,t[6]-_+R)}else"C"===n?(I0(t[0]-E,t[1]-_,t[2]-E,t[3]-_,t[4]-E,t[5]-_,b[P]),r&&b[P].push(t[4]-E+M,t[5]-_+R)):"Z"!==n||y.nodeName!==lt.PATH&&y.nodeName!==lt.RECT||((1e-4<Math.abs(b[P][b[P].length-2]-b[P][C])||1e-4<Math.abs(b[P][b[P].length-1]-b[P][C+1]))&&b[P].push(b[P][C],b[P][C+1]),(e=b[P]).push.apply(e,H0(b[P][C],b[P][C+1],b[P][C+2],b[P][C+3])))}),t)return{pointsBuffer:l=b.reduce(function(t,e){return t.push.apply(t,e),t},[]),travelBuffer:[],triangles:s=Dd(l,[],2),instancedCount:Math.round(l.length/W0)}}var O=function(t){var e;switch(t){case"bevel":e=L0.JOINT_BEVEL;break;case"round":e=L0.JOINT_ROUND;break;default:e=L0.JOINT_MITER}return e}(e),I=function(t){var e;switch(t){case"square":e=L0.CAP_SQUARE;break;case"round":e=L0.CAP_ROUND;break;default:e=L0.CAP_BUTT}return e}(n),L=I;return I===L0.CAP_ROUND&&(L=L0.JOINT_CAP_ROUND),I===L0.CAP_BUTT&&(L=L0.JOINT_CAP_BUTT),I===L0.CAP_SQUARE&&(L=L0.JOINT_CAP_SQUARE),b.map(function(t){for(var e=(Math.round(0/W0)+2)*V0,n=0,r=[],i=[],o=0;o<t.length;o+=W0)1<o&&(n+=Math.sqrt(Math.pow(t[o]-t[o-2],2)+Math.pow(t[o+1]-t[o+1-2],2))),i.push(n),r[e++]=t[o],r[e++]=t[o+1],r[e]=O,0==o&&I!==L0.CAP_ROUND&&(r[e]+=I),o+2*W0>=t.length?r[e]+=L-O:o+W0>=t.length&&(r[e]=0),e++;r[e++]=t[t.length-4],r[e++]=t[t.length-3],r[e++]=0,r[0]=t[0],r[1]=t[1],r[2]=0,r[3]=t[2],r[4]=t[3],r[5]=I===L0.CAP_ROUND?I:0;var a=Math.round(t.length/W0);return{pointsBuffer:r,travelBuffer:i,triangles:s,instancedCount:a}}).reduce(function(t,e){var n;return(n=t.pointsBuffer).push.apply(n,e.pointsBuffer),(n=t.travelBuffer).push.apply(n,e.travelBuffer),t.instancedCount+=e.instancedCount,t},{pointsBuffer:[],travelBuffer:[],triangles:s,instancedCount:0})}function H0(t,e,n,r){n=[(n=void 0===n?t:n)-t,(r=void 0===r?e:r)-e];return[t+.01*n[0],e+.01*n[1]]}var X0=function(n){function t(){return n.apply(this,arguments)||this}lf(t,n);var e=t.prototype;return e.shouldMerge=function(t,e){return!1},e.createGeometry=function(t){var t=t[0],e=z0(t,!0),n=e.triangles,e=e.pointsBuffer;this.geometry.setVertexBuffer({bufferIndex:Qg.POSITION,byteStride:8,frequency:Af.PerVertex,attributes:[{format:S.F32_RG,bufferByteOffset:0,location:Jg.POSITION}],data:new Float32Array(e)});var r=t.getGeometryBounds().halfExtents,t=e.map(function(t,e){return t/r[e%2]/2});this.geometry.setVertexBuffer({bufferIndex:Qg.UV,byteStride:8,frequency:Af.PerVertex,attributes:[{format:S.F32_RG,bufferByteOffset:0,location:Jg.UV}],data:new Float32Array(t)}),this.geometry.vertexCount=n.length,this.geometry.setIndexBuffer(new Uint32Array(n))},e.createMaterial=function(t){this.material.vertexShader="#define GLSLIFY 1\nlayout(std140) uniform ub_SceneParams {\n mat4 u_ProjectionMatrix;\n mat4 u_ViewMatrix;\n vec3 u_CameraPosition;\n float u_DevicePixelRatio;\n vec2 u_Viewport;\n float u_IsOrtho;\n float u_IsPicking;\n};\nlayout(std140) uniform ub_ObjectParams {\n mat4 u_ModelMatrix;\n vec4 u_FillColor;\n vec3 u_PickingColor;\n float u_Opacity;\n float u_FillOpacity;\n float u_Visible;\n float u_ZIndex;\n};\n\nlayout(location = POSITION) in vec2 a_Position;\n#ifdef USE_UV\n layout(location = UV) in vec2 a_Uv;\n out vec2 v_Uv;\n#endif\n\nvoid main() {\n #ifdef USE_UV\n v_Uv = a_Uv;\n #ifdef VIEWPORT_ORIGIN_TL\n v_Uv.y = 1.0 - v_Uv.y;\n #endif\n#endif\n\n gl_Position = u_ProjectionMatrix * u_ViewMatrix * u_ModelMatrix * vec4(a_Position, u_ZIndex, 1.0);\n}",this.material.fragmentShader="#define GLSLIFY 1\nlayout(std140) uniform ub_SceneParams {\n mat4 u_ProjectionMatrix;\n mat4 u_ViewMatrix;\n vec3 u_CameraPosition;\n float u_DevicePixelRatio;\n vec2 u_Viewport;\n float u_IsOrtho;\n float u_IsPicking;\n};\nlayout(std140) uniform ub_ObjectParams {\n mat4 u_ModelMatrix;\n vec4 u_FillColor;\n vec3 u_PickingColor;\n float u_Opacity;\n float u_FillOpacity;\n float u_Visible;\n float u_ZIndex;\n};\n#ifdef USE_UV\n in vec2 v_Uv;\n#endif\n#ifdef USE_MAP\n uniform sampler2D u_Map;\n#endif\n\nout vec4 outputColor;\n\n#define COLOR_SCALE 1. / 255.\n\nvoid main(){\n if (u_Visible < 0.5) {\n discard;\n }\n\n if (u_IsPicking > 0.5) {\n vec3 pickingColor = COLOR_SCALE * u_PickingColor;\n if (pickingColor.x == 0.0 && pickingColor.y == 0.0 && pickingColor.z == 0.0) {\n discard;\n }\n outputColor = vec4(pickingColor, 1.0);\n } else {\n\n vec4 u_Color = u_FillColor;\n\n #ifdef USE_MAP\n #ifdef USE_PATTERN\n vec4 texelColor = texture(SAMPLER_2D(u_Map), v_Uv);\n u_Color = texelColor;\n #else\n vec4 texelColor = texture(SAMPLER_2D(u_Map), v_Uv);\n u_Color = texelColor;\n #endif\n#endif\n\n outputColor = u_Color;\n outputColor.a = outputColor.a * u_Opacity * u_FillOpacity;\n }\n}";var t=t[0],e=t.parsedStyle,n=e.fill,r=e.opacity,i=e.fillOpacity,o=e.anchor,e=e.visibility,a=[0,0,0,0],n=(To(n)&&(a=[Number(n.r)/255,Number(n.g)/255,Number(n.b)/255,Number(n.alpha)]),t.isInteractive()&&(null==(n=t.renderable3D)?void 0:n.encodedPickingColor)||[0,0,0]),s=0,l=0,u=t.getGeometryBounds(),u=(u&&(s=-(u=u.halfExtents)[0]*o[0]*2,l=-u[1]*o[1]*2),K());wt(u,t.getWorldTransform(),ht(u,x(s,l,0))),this.material.setUniforms(((o={})[m.MODEL_MATRIX]=u,o[m.FILL_COLOR]=a,o[m.PICKING_COLOR]=n,o[m.OPACITY]=r,o[m.FILL_OPACITY]=i,o[m.VISIBLE]="visible"===e?1:0,o[m.Z_INDEX]=t.sortable.renderOrder*zg,o))},e.updateAttribute=function(t,e,s,l){var u=this;n.prototype.updateAttribute.call(this,t,e,s,l),t.forEach(function(t){var e,n=t.parsedStyle,r=n.fill,i=n.opacity,o=n.fillOpacity,a=n.anchor,n=n.visibility;"lineJoin"===s||"lineCap"===s||"markerStart"===s||"markerEnd"===s||"markerStartOffset"===s||"markerEndOffset"===s||t.nodeName===lt.RECT&&("width"===s||"height"===s||"radius"===s)||t.nodeName===lt.LINE&&("x1"===s||"y1"===s||"x2"===s||"y2"===s)||t.nodeName===lt.POLYLINE&&"points"===s||t.nodeName===lt.POLYGON&&"points"===s||t.nodeName===lt.PATH&&"path"===s?(u.material.geometryDirty=!0,u.material.programDirty=!0):"fill"===s?To(r)?(r=[Number(r.r)/255,Number(r.g)/255,Number(r.b)/255,Number(r.alpha)],u.material.setUniforms(((e={})[m.FILL_COLOR]=r,e))):(r=u.textureMappings.findIndex(function(t){return t.name===o0}),e=u.createFillGradientTextureMapping([u.instance]),0<=r&&u.textureMappings.splice(r,1,e),u.material.textureDirty=!0):"opacity"===s?u.material.setUniforms(((r={})[m.OPACITY]=i,r)):"fillOpacity"===s?u.material.setUniforms(((e={})[m.FILL_OPACITY]=o,e)):"anchor"===s||"modelMatrix"===s?(r=i=0,(o=t.getGeometryBounds())&&(i=-(e=o.halfExtents)[0]*a[0]*2,r=-e[1]*a[1]*2),o=K(),wt(o,t.getWorldTransform(),ht(o,x(i,r,0))),u.material.setUniforms(((e={})[m.MODEL_MATRIX]=o,e))):"visibility"===s?u.material.setUniforms(((a={})[m.VISIBLE]="visible"===n?1:0,a)):"pointerEvents"===s&&(r=l&&t.isInteractive()&&(null==(i=t.renderable3D)?void 0:i.encodedPickingColor)||[0,0,0],u.material.setUniforms(((o={})[m.PICKING_COLOR]=r,o)))})},e.changeRenderOrder=function(t,e){var n;this.material&&this.material.setUniforms(((n={})[m.Z_INDEX]=e*zg,n))},t}(Ia),Y0=function(l){function t(){return l.apply(this,arguments)||this}lf(t,l);var e=t.prototype;return e.shouldMerge=function(t,e){return!!l.prototype.shouldMerge.call(this,t,e)&&this.instance.parsedStyle.img===t.parsedStyle.img},e.createMaterial=function(t){t=t[0].parsedStyle.img,this.material.defines=sf({},this.material.defines),this.material.vertexShader="#define GLSLIFY 1\nlayout(std140) uniform ub_SceneParams {\n mat4 u_ProjectionMatrix;\n mat4 u_ViewMatrix;\n vec3 u_CameraPosition;\n float u_DevicePixelRatio;\n vec2 u_Viewport;\n float u_IsOrtho;\n float u_IsPicking;\n};\nlayout(location = MODEL_MATRIX0) in vec4 a_ModelMatrix0;\nlayout(location = MODEL_MATRIX1) in vec4 a_ModelMatrix1;\nlayout(location = MODEL_MATRIX2) in vec4 a_ModelMatrix2;\nlayout(location = MODEL_MATRIX3) in vec4 a_ModelMatrix3;\nlayout(location = COLOR) in vec4 a_Color;\nlayout(location = STROKE_COLOR) in vec4 a_StrokeColor;\nlayout(location = PACKED_STYLE1) in vec4 a_StylePacked1;\nlayout(location = PACKED_STYLE2) in vec4 a_StylePacked2;\nlayout(location = PICKING_COLOR) in vec4 a_PickingColor;\n\nout vec4 v_PickingResult;\nout vec4 v_Color;\nout vec4 v_StrokeColor;\nout vec4 v_StylePacked1;\nout vec4 v_StylePacked2;\n\n#define COLOR_SCALE 1. / 255.\nvoid setPickingColor(vec3 pickingColor) {\n v_PickingResult.rgb = pickingColor * COLOR_SCALE;\n}\nvec4 project(vec4 pos, mat4 pm, mat4 vm, mat4 mm) {\n return pm * vm * mm * pos;\n}\n\nlayout(location = POSITION) in vec4 a_Size;\n\n#ifdef USE_UV\n layout(location = UV) in vec2 a_Uv;\n out vec2 v_Uv;\n#endif\n\nbool isPerspectiveMatrix(mat4 m) {\n\treturn m[ 2 ][ 3 ] == - 1.0;\n}\n\nvoid main() {\n mat4 u_ModelMatrix = mat4(a_ModelMatrix0, a_ModelMatrix1, a_ModelMatrix2, a_ModelMatrix3);\nvec4 u_StrokeColor = a_StrokeColor;\nfloat u_Opacity = a_StylePacked1.x;\nfloat u_FillOpacity = a_StylePacked1.y;\nfloat u_StrokeOpacity = a_StylePacked1.z;\nfloat u_StrokeWidth = a_StylePacked1.w;\nfloat u_ZIndex = a_PickingColor.w;\nvec2 u_Anchor = a_StylePacked2.yz;\nfloat u_IncreasedLineWidthForHitTesting = a_StylePacked2.w;\n\nsetPickingColor(a_PickingColor.xyz);\n\nv_Color = a_Color;\nv_StrokeColor = a_StrokeColor;\nv_StylePacked1 = a_StylePacked1;\nv_StylePacked2 = a_StylePacked2;\n\n#ifdef CLIPSPACE_NEAR_ZERO\n gl_Position.z = gl_Position.z * 0.5 + 0.5;\n#endif\n\n vec2 offset = (a_Uv - u_Anchor.xy) * a_Size.xy;\n\n bool isPerspective = isPerspectiveMatrix(u_ProjectionMatrix);\n\n bool isBillboard = a_Size.w > 0.5;\n if (isBillboard) {\n vec4 mvPosition = u_ViewMatrix * u_ModelMatrix * vec4( 0.0, 0.0, u_ZIndex, 1.0 );\nvec2 scale;\nscale.x = length( vec3( u_ModelMatrix[ 0 ].x, u_ModelMatrix[ 0 ].y, u_ModelMatrix[ 0 ].z ) );\nscale.y = length( vec3( u_ModelMatrix[ 1 ].x, u_ModelMatrix[ 1 ].y, u_ModelMatrix[ 1 ].z ) );\n\n// if (sizeAttenuation < 0.5) {\n// bool isPerspective = isPerspectiveMatrix( u_ProjectionMatrix );\n// if ( isPerspective ) scale *= - mvPosition.z;\n// }\n\nvec2 alignedPosition = offset * scale;\n\nfloat rotation = 0.0;\nvec2 rotatedPosition;\nrotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y;\nrotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y;\n\nmvPosition.xy += rotatedPosition;\n\ngl_Position = u_ProjectionMatrix * mvPosition;\n } else {\n gl_Position = project(vec4(offset, u_ZIndex, 1.0), u_ProjectionMatrix, u_ViewMatrix, u_ModelMatrix);\n }\n\n #ifdef USE_UV\n v_Uv = a_Uv;\n #ifdef VIEWPORT_ORIGIN_TL\n v_Uv.y = 1.0 - v_Uv.y;\n #endif\n#endif\n\n}",this.material.fragmentShader="#define GLSLIFY 1\nlayout(std140) uniform ub_SceneParams {\n mat4 u_ProjectionMatrix;\n mat4 u_ViewMatrix;\n vec3 u_CameraPosition;\n float u_DevicePixelRatio;\n vec2 u_Viewport;\n float u_IsOrtho;\n float u_IsPicking;\n};\n\nin vec4 v_PickingResult;\nin vec4 v_Color;\nin vec4 v_StrokeColor;\nin vec4 v_StylePacked1;\nin vec4 v_StylePacked2;\n#ifdef USE_UV\n in vec2 v_Uv;\n#endif\n#ifdef USE_MAP\n uniform sampler2D u_Map;\n#endif\n\nout vec4 outputColor;\n\nvoid main() {\n vec4 u_Color = v_Color;\nvec4 u_StrokeColor = v_StrokeColor;\nfloat u_Opacity = v_StylePacked1.x;\nfloat u_FillOpacity = v_StylePacked1.y;\nfloat u_StrokeOpacity = v_StylePacked1.z;\nfloat u_StrokeWidth = v_StylePacked1.w;\nfloat u_Visible = v_StylePacked2.x;\nvec3 u_PickingColor = v_PickingResult.xyz;\n\nif (u_Visible < 0.5) {\n discard;\n}\n #ifdef USE_MAP\n #ifdef USE_PATTERN\n vec4 texelColor = texture(SAMPLER_2D(u_Map), v_Uv);\n u_Color = texelColor;\n #else\n vec4 texelColor = texture(SAMPLER_2D(u_Map), v_Uv);\n u_Color = texelColor;\n #endif\n#endif\n\n if (u_IsPicking > 0.5) {\n if (u_PickingColor.x == 0.0 && u_PickingColor.y == 0.0 && u_PickingColor.z == 0.0) {\n discard;\n }\n outputColor = vec4(u_PickingColor, 1.0);\n } else {\n outputColor = u_Color;\n outputColor.a = outputColor.a * u_Opacity;\n }\n}",t=this.texturePool.getOrCreateTexture(this.context.device,t);this.material.setUniforms({u_Map:t})},e.createGeometry=function(t){l.prototype.createGeometry.call(this,t);var o=[],a=[],s=[];t.forEach(function(t,e){var e=4*e,t=t.parsedStyle,n=t.width,r=t.height,i=t.z,t=t.isBillboard;o.push(n,r,i,t?1:0),a.push(0,0,1,0,1,1,0,1),s.push(0+e,2+e,1+e,0+e,3+e,2+e)}),this.geometry.setIndexBuffer(new Uint32Array(s)),this.geometry.vertexCount=6,this.geometry.setVertexBuffer({bufferIndex:Qg.POSITION,byteStride:16,frequency:Af.PerInstance,attributes:[{format:S.F32_RGBA,bufferByteOffset:0,location:Jg.POSITION}],data:new Float32Array(o)}),this.geometry.setVertexBuffer({bufferIndex:Qg.UV,byteStride:8,frequency:Af.PerVertex,attributes:[{format:S.F32_RG,bufferByteOffset:0,location:Jg.UV}],data:new Float32Array(a)})},e.updateAttribute=function(t,e,n,r){var i;l.prototype.updateAttribute.call(this,t,e,n,r),this.updateBatchedAttribute(t,e,n,r),"width"===n||"height"===n||"z"===n||"isBillboard"===n?(i=[],t.forEach(function(t){var t=t.parsedStyle,e=t.width,n=t.height,r=t.z,t=t.isBillboard;i.push(e,n,r,t?1:0)}),this.geometry.updateVertexBuffer(Qg.POSITION,Jg.POSITION,e,new Uint8Array(new Float32Array(i).buffer))):"img"===n&&(t=this.texturePool.getOrCreateTexture(this.context.device,r),this.material.setUniforms({u_Map:t}))},t}(Ia);function K0(t,e,n,r){var i=e.width,e=e.height;if(r){if(r.length!==i*e*n)throw new RangeError("mismatched image size")}else r=new Uint8Array(i*e*n);return t.width=i,t.height=e,t.data=r,t}function q0(t,e,n,r,i,o){if(0!==i.width&&0!==i.height){if(i.width>t.width||i.height>t.height||n.x>t.width-i.width||n.y>t.height-i.height)throw new RangeError("out of range source coordinates for image copy");if(i.width>e.width||i.height>e.height||r.x>e.width-i.width||r.y>e.height-i.height)throw new RangeError("out of range destination coordinates for image copy");for(var a=t.data,s=e.data,l=0;l<i.height;l++)for(var u=((n.y+l)*t.width+n.x)*o,c=((r.y+l)*e.width+r.x)*o,h=0;h<i.width*o;h++)s[c+h]=a[u+h]}}var $0=function(){function t(t,e){this.width=void 0,this.height=void 0,this.data=void 0,K0(this,t,1,e)}var e=t.prototype;return e.resize=function(t){var e,n,r,i;e=this,n=1,i=(t=t).width,t=t.height,i===e.width&&t===e.height||(q0(e,r=K0({},{width:i,height:t},n),{x:0,y:0},{x:0,y:0},{width:Math.min(e.width,i),height:Math.min(e.height,t)},n),e.width=i,e.height=t,e.data=r.data)},e.clone=function(){return new t({width:this.width,height:this.height},new Uint8Array(this.data))},t.copy=function(t,e,n,r,i){q0(t,e,n,r,i,1)},t}();function Z0(t){this.image=void 0,this.positions=void 0;var e,n={},r=[];for(e in t){var i,o=t[e],a=n[e]={};for(i in o){var s,l=o[+i];l&&0!==l.bitmap.width&&0!==l.bitmap.height&&(s={x:0,y:0,w:l.bitmap.width+2*Q0,h:l.bitmap.height+2*Q0},r.push(s),a[i]={rect:s,metrics:l.metrics})}}var u,c=(h=function(t){for(var e=0,n=0,r=ff(t);!(i=r()).done;){var i=i.value;e+=i.w*i.h,n=Math.max(n,i.w)}t.sort(function(t,e){return e.h-t.h});for(var o,a=[{x:0,y:0,w:Math.max(Math.ceil(Math.sqrt(e/.95)),n),h:1/0}],s=0,l=0,u=ff(t);!(o=u()).done;)for(var c=o.value,h=a.length-1;0<=h;h--){var d,f=a[h];if(!(c.w>f.w||c.h>f.h)){c.x=f.x,c.y=f.y,l=Math.max(l,c.y+c.h),s=Math.max(s,c.x+c.w),c.w===f.w&&c.h===f.h?(d=a.pop(),h<a.length&&(a[h]=d)):c.h===f.h?(f.x+=c.w,f.w-=c.w):(c.w!==f.w&&a.push({x:f.x+c.w,y:f.y,w:f.w-c.w,h:c.h}),f.y+=c.h,f.h-=c.h);break}}return{w:s,h:l,fill:e/(s*l)||0}}(r)).w,h=h.h,d=new $0({width:c||1,height:h||1});for(u in t){var f,p=t[u];for(f in p){var g,m=p[+f];m&&0!==m.bitmap.width&&0!==m.bitmap.height&&(g=n[u][f].rect,$0.copy(m.bitmap,d,{x:0,y:0},{x:g.x+Q0,y:g.y+Q0},m.bitmap))}}this.image=d,this.positions=n}var Q0=1,J0=3,tm=J0;var em,nm,rm,im=function(){function t(){this.sdfGeneratorCache={},this.textMetricsCache={},this.glyphAtlas=void 0,this.glyphMap={},this.glyphAtlasTexture=void 0}var e=t.prototype;return e.getMap=function(){return this.glyphMap},e.getAtlas=function(){return this.glyphAtlas},e.getAtlasTexture=function(){return this.glyphAtlasTexture},e.layout=function(t,i,o,e,a,n,r){var s=this,l=[],u=n,c=r,h="right"===e||"end"===e?1:"left"===e||"start"===e?0:.5;return t.forEach(function(t){for(var e=l.length,n=(Array.from(t).forEach(function(t){var e=s.glyphMap[i],t=t.charCodeAt(0),e=e&&e[t];e&&(l.push({glyph:t,x:u,y:c,scale:1,fontStack:i}),u+=e.metrics.advance+a)}),u-a),r=e;r<l.length;r++)l[r].x=l[r].x-h*n;u=0,c+=o}),l},e.generateAtlas=function(e,n,r,i,o,t,a){var s,l,u=this,c=(void 0===n&&(n=""),void 0===o&&(o=""),[]),h=(this.glyphMap[n]||(c=function(){for(var t=[],e=32;e<128;e++)t.push(String.fromCharCode(e));return t}()),Object.keys(this.glyphMap[n]||{}));Array.from(new Set(t.split(""))).forEach(function(t){-1===h.indexOf(t.charCodeAt(0).toString())&&c.push(t)}),c.length&&(t=c.map(function(t){return u.generateSDF(e,n,r,i,o,t)}).reduce(function(t,e){return t[e.id]=e,t},{}),this.glyphMap[n]=sf({},this.glyphMap[n],t),this.glyphAtlas=new Z0(this.glyphMap),s=(t=this.glyphAtlas.image).width,l=t.height,t=t.data,this.glyphAtlasTexture&&this.glyphAtlasTexture.destroy(),this.glyphAtlasTexture=a.createTexture(sf({},Wf(S.ALPHA,s,l,1),{pixelStore:{unpackFlipY:!1,unpackAlignment:1},immutable:!1})),this.glyphAtlasTexture.setImageData([t],0))},e.generateSDF=function(t,e,n,r,i,o){void 0===e&&(e="");var a=o.charCodeAt(0),s=(s=this.sdfGeneratorCache[e])||(this.sdfGeneratorCache[e]=new D0({canvas:t,fontSize:24,fontFamily:n,fontWeight:r,fontStyle:i,buffer:tm,radius:8,cutoff:.25})),t=(this.textMetricsCache[e]||(this.textMetricsCache[e]={}),this.textMetricsCache[e][o]||(this.textMetricsCache[e][o]=s.ctx.measureText(o).width),s.draw(o)),n=t.data,r=t.width,i=t.height,e=t.glyphWidth,s=t.glyphHeight,o=t.glyphLeft,l=t.glyphTop,t=t.glyphAdvance;return{id:a,bitmap:new $0({width:r,height:i},n),metrics:{width:e,height:s,left:o,top:l-24+J0,advance:t}}},t}();(Ys=em=em||{})[Ys.INSTANCED=5]="INSTANCED",Ys[Ys.TEX=6]="TEX",(Zs=nm=nm||{})[Zs.TEX=13]="TEX",Zs[Zs.OFFSET=14]="OFFSET",(nl=rm=rm||{}).SDF_MAP="u_SDFMap",nl.SDF_MAP_SIZE="u_SDFMapSize",nl.FONT_SIZE="u_FontSize",nl.GAMMA_SCALE="u_GammaScale",nl.STROKE_BLUR="u_StrokeBlur",nl.HAS_STROKE="u_HasStroke";var om=function(i){function t(){for(var t,e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];return(t=i.call.apply(i,[this].concat(n))||this).glyphManager=new im,t}lf(t,i);var e=t.prototype;return e.shouldMerge=function(e,t){var n;return!!i.prototype.shouldMerge.call(this,e,t)&&this.index===t&&(n=this.instance).parsedStyle.metrics.font===e.parsedStyle.metrics.font&&!["fontSize","fontFamily","fontWeight","textBaseline","letterSpacing"].some(function(t){return n.parsedStyle[t]!==e.parsedStyle[t]})},e.createGeometry=function(t){var l=this,e=this.instance.parsedStyle,u=e.textBaseline,n=e.fontSize,c=e.letterSpacing,h=24/n,d=[],f=[],p=[],g=0;t.forEach(function(t){var e=t.parsedStyle,n=e.metrics,r=e.dx,e=e.dy,i=n.font,o=n.lines,a=n.height,n=n.lineHeight,r=r||0,e=e||0,s=0,a=("middle"===u?s=-a/2:"bottom"===u?s=-a:"top"===u||"hanging"===u?s=0:"alphabetic"===u?s=.25*n-a:"ideographic"===u&&(s=-a),l.glyphManager.getAtlas()),t=l.buildTextBuffers({object:t,lines:o,fontStack:i,lineHeight:h*n,offsetX:h*r,offsetY:h*(s+e),letterSpacing:h*c,glyphAtlas:a,indicesOffset:g}),o=t.indicesOffset,i=t.indexBuffer,n=t.charUVOffsetBuffer,r=t.charPackedBuffer;g=o,p.push.apply(p,r),f.push.apply(f,n),d.push.apply(d,i)}),this.geometry.vertexCount=d.length,this.geometry.setIndexBuffer(new Uint32Array(d)),this.geometry.setVertexBuffer({bufferIndex:em.INSTANCED,byteStride:144,frequency:Af.PerVertex,attributes:[{format:S.F32_RGBA,bufferByteOffset:0,location:Jg.MODEL_MATRIX0},{format:S.F32_RGBA,bufferByteOffset:16,location:Jg.MODEL_MATRIX1},{format:S.F32_RGBA,bufferByteOffset:32,location:Jg.MODEL_MATRIX2},{format:S.F32_RGBA,bufferByteOffset:48,location:Jg.MODEL_MATRIX3},{format:S.F32_RGBA,bufferByteOffset:64,location:Jg.COLOR},{format:S.F32_RGBA,bufferByteOffset:80,location:Jg.STROKE_COLOR},{format:S.F32_RGBA,bufferByteOffset:96,location:Jg.PACKED_STYLE1},{format:S.F32_RGBA,bufferByteOffset:112,location:Jg.PACKED_STYLE2},{format:S.F32_RGBA,bufferByteOffset:128,location:Jg.PICKING_COLOR}],data:new Float32Array(p)}),this.geometry.setVertexBuffer({bufferIndex:em.TEX,byteStride:16,frequency:Af.PerVertex,attributes:[{format:S.F32_RG,bufferByteOffset:0,location:nm.TEX},{format:S.F32_RG,bufferByteOffset:8,location:nm.OFFSET}],data:new Float32Array(f)})},e.createMaterial=function(t){this.material.vertexShader="#define GLSLIFY 1\nlayout(std140) uniform ub_SceneParams {\n mat4 u_ProjectionMatrix;\n mat4 u_ViewMatrix;\n vec3 u_CameraPosition;\n float u_DevicePixelRatio;\n vec2 u_Viewport;\n float u_IsOrtho;\n float u_IsPicking;\n};\nlayout(location = MODEL_MATRIX0) in vec4 a_ModelMatrix0;\nlayout(location = MODEL_MATRIX1) in vec4 a_ModelMatrix1;\nlayout(location = MODEL_MATRIX2) in vec4 a_ModelMatrix2;\nlayout(location = MODEL_MATRIX3) in vec4 a_ModelMatrix3;\nlayout(location = COLOR) in vec4 a_Color;\nlayout(location = STROKE_COLOR) in vec4 a_StrokeColor;\nlayout(location = PACKED_STYLE1) in vec4 a_StylePacked1;\nlayout(location = PACKED_STYLE2) in vec4 a_StylePacked2;\nlayout(location = PICKING_COLOR) in vec4 a_PickingColor;\n\nout vec4 v_PickingResult;\nout vec4 v_Color;\nout vec4 v_StrokeColor;\nout vec4 v_StylePacked1;\nout vec4 v_StylePacked2;\n\n#define COLOR_SCALE 1. / 255.\nvoid setPickingColor(vec3 pickingColor) {\n v_PickingResult.rgb = pickingColor * COLOR_SCALE;\n}\n\nlayout(std140) uniform ub_ObjectParams {\n vec2 u_SDFMapSize;\n float u_FontSize;\n float u_GammaScale;\n float u_StrokeBlur;\n float u_HasStroke;\n};\nvec4 project(vec4 pos, mat4 pm, mat4 vm, mat4 mm) {\n return pm * vm * mm * pos;\n}\n\nlayout(location = TEX) in vec2 a_Tex;\nlayout(location = OFFSET) in vec2 a_Offset;\n\nout vec2 v_Uv;\nout float v_GammaScale;\n\nbool isPerspectiveMatrix(mat4 m) {\n return m[ 2 ][ 3 ] == - 1.0;\n}\n\nvoid main() {\n mat4 u_ModelMatrix = mat4(a_ModelMatrix0, a_ModelMatrix1, a_ModelMatrix2, a_ModelMatrix3);\nvec4 u_StrokeColor = a_StrokeColor;\nfloat u_Opacity = a_StylePacked1.x;\nfloat u_FillOpacity = a_StylePacked1.y;\nfloat u_StrokeOpacity = a_StylePacked1.z;\nfloat u_StrokeWidth = a_StylePacked1.w;\nfloat u_ZIndex = a_PickingColor.w;\nvec2 u_Anchor = a_StylePacked2.yz;\nfloat u_IncreasedLineWidthForHitTesting = a_StylePacked2.w;\n\nsetPickingColor(a_PickingColor.xyz);\n\nv_Color = a_Color;\nv_StrokeColor = a_StrokeColor;\nv_StylePacked1 = a_StylePacked1;\nv_StylePacked2 = a_StylePacked2;\n\n#ifdef CLIPSPACE_NEAR_ZERO\n gl_Position.z = gl_Position.z * 0.5 + 0.5;\n#endif\n\n v_Uv = a_Tex / u_SDFMapSize;\n float fontScale = u_FontSize / 24.;\n\n bool isBillboard = a_StylePacked2.y > 0.5;\n float sizeAttenuation = a_StylePacked2.z;\n vec2 offset = a_Offset * fontScale;\n\n if (isBillboard) {\n vec4 mvPosition = u_ViewMatrix * u_ModelMatrix * vec4( 0.0, 0.0, u_ZIndex, 1.0 );\nvec2 scale;\nscale.x = length( vec3( u_ModelMatrix[ 0 ].x, u_ModelMatrix[ 0 ].y, u_ModelMatrix[ 0 ].z ) );\nscale.y = length( vec3( u_ModelMatrix[ 1 ].x, u_ModelMatrix[ 1 ].y, u_ModelMatrix[ 1 ].z ) );\n\n// if (sizeAttenuation < 0.5) {\n// bool isPerspective = isPerspectiveMatrix( u_ProjectionMatrix );\n// if ( isPerspective ) scale *= - mvPosition.z;\n// }\n\nvec2 alignedPosition = offset * scale;\n\nfloat rotation = 0.0;\nvec2 rotatedPosition;\nrotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y;\nrotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y;\n\nmvPosition.xy += rotatedPosition;\n\ngl_Position = u_ProjectionMatrix * mvPosition;\n v_GammaScale = 1.0;\n } else {\n gl_Position = project(vec4(a_Offset * fontScale, u_ZIndex, 1.0), u_ProjectionMatrix, u_ViewMatrix, u_ModelMatrix);\n v_GammaScale = gl_Position.w;\n }\n}",this.material.fragmentShader="#define GLSLIFY 1\nlayout(std140) uniform ub_SceneParams {\n mat4 u_ProjectionMatrix;\n mat4 u_ViewMatrix;\n vec3 u_CameraPosition;\n float u_DevicePixelRatio;\n vec2 u_Viewport;\n float u_IsOrtho;\n float u_IsPicking;\n};\nin vec4 v_PickingResult;\nin vec4 v_Color;\nin vec4 v_StrokeColor;\nin vec4 v_StylePacked1;\nin vec4 v_StylePacked2;\nlayout(std140) uniform ub_ObjectParams {\n vec2 u_SDFMapSize;\n float u_FontSize;\n float u_GammaScale;\n float u_StrokeBlur;\n float u_HasStroke;\n};\n#ifdef USE_UV\n in vec2 v_Uv;\n#endif\n\nuniform sampler2D u_SDFMap;\n\n#define SDF_PX 8.0\n\nin float v_GammaScale;\n\nout vec4 outputColor;\n\nvoid main() {\n vec4 u_Color = v_Color;\nvec4 u_StrokeColor = v_StrokeColor;\nfloat u_Opacity = v_StylePacked1.x;\nfloat u_FillOpacity = v_StylePacked1.y;\nfloat u_StrokeOpacity = v_StylePacked1.z;\nfloat u_StrokeWidth = v_StylePacked1.w;\nfloat u_Visible = v_StylePacked2.x;\nvec3 u_PickingColor = v_PickingResult.xyz;\n\nif (u_Visible < 0.5) {\n discard;\n}\n\n float dist = texture(SAMPLER_2D(u_SDFMap), v_Uv).a;\n\n float EDGE_GAMMA = 0.105 / u_DevicePixelRatio;\n float fontScale = u_FontSize / 24.0;\n highp float gamma = EDGE_GAMMA / (fontScale * u_GammaScale);\n lowp vec4 color = u_Color;\n lowp float buff = (256.0 - 64.0) / 256.0;\n float opacity = u_FillOpacity;\n if (u_HasStroke > 0.5 && u_StrokeWidth > 0.0) {\n color = u_StrokeColor;\n gamma = (u_StrokeBlur * 1.19 / SDF_PX + EDGE_GAMMA) / (fontScale * u_GammaScale);\n buff = (6.0 - u_StrokeWidth / fontScale / 2.0) / SDF_PX;\n opacity = u_StrokeOpacity;\n }\n\n highp float gamma_scaled = gamma * v_GammaScale;\n highp float alpha = smoothstep(buff - gamma_scaled, buff + gamma_scaled, dist);\n\n opacity *= alpha * u_Opacity;\n\n if (u_IsPicking > 0.5) {\n if (u_PickingColor.x == 0.0 && u_PickingColor.y == 0.0 && u_PickingColor.z == 0.0) {\n discard;\n }\n outputColor = vec4(u_PickingColor, 1.0);\n } else {\n\n if (opacity < 0.001) {\n discard;\n }\n\n outputColor = color;\n outputColor.a *= opacity;\n }\n}",this.material.cullMode=vf.Back,this.material.defines=sf({},this.material.defines,$g(nm));var e=this.instance.parsedStyle,n=e.fontSize,r=e.fontFamily,r=void 0===r?"":r,i=e.fontWeight,i=void 0===i?"":i,o=e.fontStyle,e=e.metrics.font,t=t.map(function(t){return t.parsedStyle.text}).join(""),e=(this.glyphManager.generateAtlas(this.texturePool.context.config.offscreenCanvas,e,r,i.toString(),o,t,this.context.device),this.glyphManager.getAtlasTexture()),r=this.glyphManager.getAtlas(),i=(this.context.device.setResourceName(e,"TextSDF Texture"),r.image),o=i.width,t=i.height;this.material.setUniforms(((r={})[rm.SDF_MAP]=e,r[rm.SDF_MAP_SIZE]=[o,t],r[rm.FONT_SIZE]=n,r[rm.GAMMA_SCALE]=1,r[rm.STROKE_BLUR]=.2,r[rm.HAS_STROKE]=this.index,r))},e.changeRenderOrder=function(t,e){this.material&&(this.material.programDirty=!0,this.material.geometryDirty=!0)},e.updateAttribute=function(t,e,n,r){"text"===n||"fontFamily"===n||"fontSize"===n||"fontWeight"===n||"fontStyle"===n||"fontVariant"===n||"textBaseline"===n||"letterSpacing"===n||"wordWrapWidth"===n||"lineHeight"===n||"wordWrap"===n||"textAlign"===n||"modelMatrix"===n||"visibility"===n||"dx"===n||"dy"===n?(this.material.programDirty=!0,this.material.geometryDirty=!0,this.material.textureDirty=!0):"fill"!==n&&"fillOpacity"!==n&&"stroke"!==n&&"strokeOpacity"!==n&&"opacity"!==n&&"lineWidth"!==n&&"visibility"!==n&&"pointerEvents"!==n||(this.material.geometryDirty=!0)},e.buildTextBuffers=function(t){var n=t.object,e=t.lines,r=t.fontStack,i=t.lineHeight,o=t.letterSpacing,a=t.offsetX,s=t.offsetY,l=t.glyphAtlas,t=t.indicesOffset,u=n.parsedStyle,c=u.textAlign,h=u.fill,d=u.stroke,f=u.opacity,p=u.fillOpacity,g=u.strokeOpacity,m=u.lineWidth,v=u.visibility,y=u.isBillboard,E=u.sizeAttenuation,_=[0,0,0,0],b=(To(h)&&(_=[Number(h.r)/255,Number(h.g)/255,Number(h.b)/255,Number(h.alpha)]),[0,0,0,0]),x=(To(d)&&(b=[Number(d.r)/255,Number(d.g)/255,Number(d.b)/255,Number(d.alpha)]),n.isInteractive()&&(null==(u=n.renderable3D)?void 0:u.encodedPickingColor)||[0,0,0]),S=$(K(),n.getWorldTransform()),w=[],T=[],A=[],M=t;return function(t,e){for(var n=[],r=0;r<t.length;r++){var i,o,a,s,l=t[r],u=e[l.fontStack],u=u&&u[l.glyph];u&&(i=u.rect)&&(o=u.metrics.advance*l.scale/2,s=[l.x+o,l.y],o=(u.metrics.left-(a=J0+1))*l.scale-o+s[0],u=(-u.metrics.top-a)*l.scale+s[1],a=o+i.w*l.scale,s=u+i.h*l.scale,n.push({tl:{x:o,y:u},tr:{x:a,y:u},bl:{x:o,y:s},br:{x:a,y:s},tex:i,glyphOffset:[0,0]}))}return n}(this.glyphManager.layout(e,r,i,c,o,a,s),l.positions).forEach(function(t){var e=[],e=(e.push.apply(e,S),[].concat(e,_,b,[f,p,g,m,"visible"===v?1:0,y?1:0,E?1:0,0],x,[n.sortable.renderOrder*zg]));w.push.apply(w,e.concat(e,e,e)),T.push(t.tex.x,t.tex.y,t.tl.x,t.tl.y),T.push(t.tex.x+t.tex.w,t.tex.y,t.tr.x,t.tr.y),T.push(t.tex.x+t.tex.w,t.tex.y+t.tex.h,t.br.x,t.br.y),T.push(t.tex.x,t.tex.y+t.tex.h,t.bl.x,t.bl.y),A.push(0+M,2+M,1+M),A.push(2+M,0+M,3+M),M+=4}),{indexBuffer:A,charUVOffsetBuffer:T,charPackedBuffer:w,indicesOffset:M}},t}(Ia),am=function(i){function t(){for(var t,e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];return(t=i.call.apply(i,[this].concat(n))||this).lightReceived=!0,t}lf(t,i);var e=t.prototype;return e.shouldMerge=function(t,e){return!!i.prototype.shouldMerge.call(this,t,e)&&(this.instance.nodeName!==lt.MESH||this.instance.parsedStyle.material===t.parsedStyle.material&&this.instance.parsedStyle.geometry===t.parsedStyle.geometry)},e.updateAttribute=function(t,e,n,r){i.prototype.updateAttribute.call(this,t,e,n,r),this.updateBatchedAttribute(t,e,n,r)},e.createMaterial=function(t){var e=this.instance.parsedStyle.material;this.material=e,this.observeMaterialChanged()},e.createGeometry=function(t){var e=this.instance.parsedStyle.geometry;this.geometry=e,i.prototype.createGeometry.call(this,t),this.geometry.build(t),this.observeGeometryChanged()},t}(Ia),sm=function(i){function t(){for(var t,e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];return(t=i.call.apply(i,[this].concat(n))||this).meshes=[s0,j0],t}lf(t,i);var e=t.prototype;return e.shouldSubmitRenderInst=function(t,e){if(0===e&&t.parsedStyle.fill.isNone)return!1;return 1!==e||this.needDrawStrokeSeparately(t)},e.needDrawStrokeSeparately=function(t){var t=t.parsedStyle,e=t.fill,n=t.stroke,r=t.lineDash,i=t.lineWidth,t=t.strokeOpacity,e=e&&!e.isNone,n=n&&!n.isNone,r=r&&r.length&&r.every(function(t){return 0!==t});return!e||n&&0<i&&(t<1||r)},t}(wa),lm=function(i){function t(){for(var t,e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];return(t=i.call.apply(i,[this].concat(n))||this).meshes=[X0,j0,c0],t}lf(t,i);var e=t.prototype;return e.shouldSubmitRenderInst=function(t,e){var n=t.parsedStyle,r=n.fill,i=n.stroke,o=n.opacity,a=n.strokeOpacity,s=n.lineDash,n=n.lineWidth,l=t.nodeName,i=i&&!i.isNone,s=s&&s.length&&s.every(function(t){return 0!==t}),u=this.isLine(t);if(t.renderable.proxyNodeName=u?lt.LINE:null,0===e&&(t.nodeName===lt.POLYLINE||r.isNone))return!1;if(1===e){if(u||0===a||0===o||0===n||!i)return!1;if(l===lt.CIRCLE||l===lt.ELLIPSE)return s}return 2!==e||u},e.isLine=function(t){if(t.nodeName===lt.PATH){var e=t.parsedStyle.path.absolutePath;if(2===e.length&&"M"===e[0][0]&&"L"===e[1][0])return!0}else if(t.nodeName===lt.POLYLINE){for(var n=t.parsedStyle.points.points,r=(n[1][0]-n[1][1])/(n[0][0]-n[0][1]),i=1;i<n.length-1;i++)if((n[i+1][0]-n[i+1][1])/(n[i][0]-n[i][1])!=r)return!1;return!0}return!1},t}(wa),um=function(i){function t(){for(var t,e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];return(t=i.call.apply(i,[this].concat(n))||this).meshes=[Y0],t}return lf(t,i),t.prototype.shouldSubmitRenderInst=function(t,e){return!0},t}(wa),cm=function(i){function t(){for(var t,e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];return(t=i.call.apply(i,[this].concat(n))||this).meshes=[om,om],t}lf(t,i);var e=t.prototype;return e.shouldSubmitRenderInst=function(t,e){var t=t.parsedStyle,n=t.stroke,t=t.lineWidth;return!!(n&&!n.isNone&&t||0!==e)},e.beforeUploadUBO=function(t,e,n){var r;e.material.setUniforms(((r={})[rm.HAS_STROKE]=1-e.index,r))},t}(wa),hm=function(i){function t(){for(var t,e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];return(t=i.call.apply(i,[this].concat(n))||this).meshes=[c0],t}return lf(t,i),t.prototype.shouldSubmitRenderInst=function(t,e){return!0},t}(wa),dm=function(i){function t(){for(var t,e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];return(t=i.call.apply(i,[this].concat(n))||this).meshes=[am],t}return lf(t,i),t}(wa),fm=function(i){function t(){for(var t,e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];return(t=i.call.apply(i,[this].concat(n))||this).meshes=[s0,j0],t}lf(t,i);var e=t.prototype;return e.shouldSubmitRenderInst=function(t,e){if(0===e&&t.parsedStyle.fill.isNone)return!1;return 1!==e||this.needDrawStrokeSeparately(t)},e.needDrawStrokeSeparately=function(t){var t=t.parsedStyle,e=t.fill,n=t.stroke,r=t.lineDash,i=t.lineWidth,t=t.strokeOpacity,e=e&&!e.isNone,n=n&&!n.isNone,r=r&&r.length&&r.every(function(t){return 0!==t});return!e||n&&0<i&&(t<1||r)},t}(wa),pm=1,gm=function(){function t(t,e,n,r){this.renderHelper=void 0,this.rendererFactory=void 0,this.texturePool=void 0,this.lightPool=void 0,this.context=void 0,this.meshes=[],this.pendingUpdatePatches={},this.stencilRefCache={},this.renderHelper=t,this.rendererFactory=e,this.texturePool=n,this.lightPool=r}var e=t.prototype;return e.render=function(r,i){var o=this;(i=void 0===i?!1:i)||this.updatePendingPatches(),this.meshes.forEach(function(t){t.init(o.context);var e=t.objects,n=(t.clipPathTarget&&(e=[t.clipPath]),o.renderHelper.renderInstManager.newRenderInst());n.setAllowSkippingIfPipelineNotReady(!1),t.applyRenderInst(n,e),o.renderHelper.renderInstManager.submitRenderInst(n,r),i||t.objects.forEach(function(t){t.renderable.dirty=!1})})},e.attach=function(t){this.context=t},e.add=function(r){var i,o=this,a=r.renderable3D;a&&!a.meshes.length&&(i=this.rendererFactory[r.nodeName])&&i.meshes.forEach(function(e,n){var t;a.meshes[n]=void 0,i.shouldSubmitRenderInst(r,n)&&((t=o.meshes.find(function(t){return e===t.constructor&&t.index===n&&t.shouldMerge(r,n)}))||((t=new e(o.renderHelper,o.texturePool,o.lightPool)).renderer=i,t.index=n,o.meshes.push(t)),t)&&(t.objects.push(r),(a.meshes[n]=t).geometryDirty=!0)})},e.remove=function(n){var r=this,t=n.renderable3D;t&&(t.meshes.forEach(function(t){var e;t&&(-1<(e=t.objects.indexOf(n))&&(t.objects.splice(e,1),t.geometryDirty=!0),0===t.objects.length)&&r.meshes.splice(r.meshes.indexOf(t),1)}),t.meshes=[])},e.updateAttribute=function(o,a,s,l){var u=this,c=(void 0===l&&(l=!1),o.renderable3D),h=this.rendererFactory[o.nodeName];h&&h.meshes.forEach(function(e,n){var t,r=h.shouldSubmitRenderInst(o,n),i=c.meshes.find(function(t){return t&&t.index===n&&t.constructor===e});r!==!!i&&(i&&(i.objects.splice(i.objects.indexOf(o),1),i.geometryDirty=!0,0===i.objects.length&&u.meshes.splice(u.meshes.indexOf(i),1),c.meshes[c.meshes.indexOf(i)]=void 0),r)&&((i=u.meshes.find(function(t){return e===t.constructor&&t.index===n&&t.shouldMerge(o,n)}))||((i=new e(u.renderHelper,u.texturePool,u.lightPool)).renderer=h,i.index=n,i.init(u.context),u.meshes.push(i)),i)&&(i.objects.push(o),c.meshes[n]=i),r&&i&&i.inited&&!i.geometryDirty&&(r=i.objects.indexOf(o),l?(o.parsedStyle[a]=s,i.updateAttribute([o],r,a,s)):(t=i.id+a,u.pendingUpdatePatches[t]||(u.pendingUpdatePatches[t]={instance:i,objectIndices:[],name:a,value:s}),-1===u.pendingUpdatePatches[t].objectIndices.indexOf(r)&&u.pendingUpdatePatches[t].objectIndices.push(r)))})},e.changeRenderOrder=function(e,n){var t=e.renderable3D;t&&t.meshes.length&&t.meshes.forEach(function(t){t&&t.inited&&!t.geometryDirty&&t.renderer.shouldSubmitRenderInst(e,t.index)&&t.inited&&t.changeRenderOrder(e,n)})},e.getStencilRef=function(t){return this.stencilRefCache[t.entity]||(this.stencilRefCache[t.entity]=pm++),this.stencilRefCache[t.entity]},e.updatePendingPatches=function(){var a=this;Object.keys(this.pendingUpdatePatches).forEach(function(t){var t=a.pendingUpdatePatches[t],e=t.instance,n=t.objectIndices,r=t.name,i=t.value,o=(n.sort(function(t,e){return t-e}),[]);n.forEach(function(t){var e=o[o.length-1];e&&t===e[e.length-1]+1?e.push(t):o.push([t])}),o.forEach(function(t){e.updateAttribute(e.objects.slice(t[0],t[0]+t.length),t[0],r,i)})}),this.pendingUpdatePatches={}},t}(),mm=function(){function t(t){this.context=void 0,this.textureCache={},this.context=t}var e=t.prototype;return e.getOrCreateTexture=function(t,e,n,r){var i,o,a=this,s="string"==typeof e?e:e.src||"";return s&&this.textureCache[s]?(o=this.textureCache[s]).emit(Mf.LOADED):(o=t.createTexture(sf({pixelFormat:S.U8_RGBA_NORM,width:1,height:1,depth:1,numLevels:1,dimension:Rf.n2D,usage:Nf.Sampled,pixelStore:{unpackFlipY:!1},immutable:!1},n)),s&&(this.textureCache[s]=o),Fe(e)?((t=this.context.config.createImage)?i=t(e):Ur&&(i=new window.Image),i&&(i.onload=function(){a.textureCache[s].setImageData(i),a.textureCache[s].emit(Mf.LOADED),a.context.renderingService.dirtify(),r&&r(a.textureCache[s])},i.onerror=function(){},i.crossOrigin="Anonymous",i.src=e)):(o.setImageData(e),o.emit(Mf.LOADED),this.context.renderingService.dirtify())),o},e.getOrCreateCanvas=function(){return ct.offscreenCanvas.getOrCreateCanvas(this.context.config.offscreenCanvas)},e.getOrCreateGradient=function(t){var e=t.instance,t=t.gradients,e=e.getGeometryBounds().halfExtents,n=2*e[0]||1,r=2*e[1]||1,e=this.context.config.offscreenCanvas,i=ct.offscreenCanvas.getOrCreateCanvas(e),o=ct.offscreenCanvas.getOrCreateContext(e),a=(i.width=n,i.height=r,this.context.imagePool);t.forEach(function(t){t=a.getOrCreateGradient(sf({type:t.type},t.value,{width:n,height:r}),o);o.fillStyle=t,o.fillRect(0,0,n,r)})},e.getOrCreatePattern=function(t,e,n){var r=t.image,i=t.repetition,t=t.transform,e=e.getGeometryBounds().halfExtents,o=2*e[0]||1,e=2*e[1]||1,a=this.context.config.offscreenCanvas,s=ct.offscreenCanvas.getOrCreateCanvas(a),a=ct.offscreenCanvas.getOrCreateContext(a),n=(s.width=o,s.height=e,(s=Fe(r)?this.context.imagePool.getImageSync(r,n):r)&&a.createPattern(s,i));t&&(r=di(ta(t)),n.setTransform({a:r[0],b:r[1],c:r[4],d:r[5],e:r[12],f:r[13]})),a.fillStyle=n,a.fillRect(0,0,o,e)},e.destroy=function(){for(var t in this.textureCache)this.textureCache[t].destroy();this.textureCache={}},t}(),vm=function(i){function t(){for(var t,e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];return(t=i.call.apply(i,[this].concat(n))||this).vert="#define GLSLIFY 1\nlayout(location = 0) in vec2 a_Position;\n\nout vec2 v_TexCoord;\n\nvoid main() {\n v_TexCoord = 0.5 * (a_Position + 1.0);\n gl_Position = vec4(a_Position, 0., 1.);\n\n #ifdef VIEWPORT_ORIGIN_TL\n v_TexCoord.y = 1.0 - v_TexCoord.y;\n #endif\n}",t.frag="#define GLSLIFY 1\nuniform sampler2D u_Texture;\nin vec2 v_TexCoord;\n\nout vec4 outputColor;\n\nvoid main() {\n outputColor = texture(SAMPLER_2D(u_Texture), v_TexCoord);\n}",t.features={},t}return lf(t,i),t}(Jp),ym=(ip(1,function(){return new Bg}),function(i){function t(){for(var t,e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];return(t=i.call.apply(i,[this].concat(n))||this).name="device-renderer",t}lf(t,i);var e=t.prototype;return e.init=function(t){t.geometryUpdaterFactory[lt.MESH]=new Uf;var e,t=new Mg,n=new Df,r=new mm(this.context),i=new Gf,o=new sm,a=new lm;(e={})[lt.CIRCLE]=o,e[lt.ELLIPSE]=o,e[lt.POLYLINE]=a,e[lt.PATH]=a,e[lt.POLYGON]=a,e[lt.RECT]=new fm,e[lt.IMAGE]=new um,e[lt.LINE]=new hm,e[lt.TEXT]=new cm,e[lt.MESH]=new dm,e[lt.GROUP]=void 0,e[lt.HTML]=void 0;o=new gm(t,e,r,n),a=new Vg(t,n,r,o);this.addRenderingPlugin(a),this.addRenderingPlugin(new jg(t,a,i,o))},e.destroy=function(t){delete t.geometryUpdaterFactory[lt.MESH]},e.getRenderGraphPlugin=function(){return this.plugins[0]},e.getDevice=function(){return this.getRenderGraphPlugin().getDevice()},e.loadTexture=function(t,e,n){return this.getRenderGraphPlugin().loadTexture(t,e,n)},e.toDataURL=function(t){return this.getRenderGraphPlugin().toDataURL(t)},t}(Ws));function Em(){Em=function(){return a};var a={},t=Object.prototype,l=t.hasOwnProperty,u=Object.defineProperty||function(t,e,n){t[e]=n.value},e="function"==typeof Symbol?Symbol:{},r=e.iterator||"@@iterator",n=e.asyncIterator||"@@asyncIterator",i=e.toStringTag||"@@toStringTag";function o(t,e,n){return Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{o({},"")}catch(t){o=function(t,e,n){return t[e]=n}}function s(t,e,n,r){var i,o,a,s,e=e&&e.prototype instanceof d?e:d,e=Object.create(e.prototype),r=new b(r||[]);return u(e,"_invoke",{value:(i=t,o=n,a=r,s="suspendedStart",function(t,e){if("executing"===s)throw new Error("Generator is already running");if("completed"===s){if("throw"===t)throw e;return S()}for(a.method=t,a.arg=e;;){var n=a.delegate;if(n){n=function t(e,n){var r=n.method,i=e.iterator[r];if(void 0===i)return n.delegate=null,"throw"===r&&e.iterator.return&&(n.method="return",n.arg=void 0,t(e,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),h;r=c(i,e.iterator,n.arg);if("throw"===r.type)return n.method="throw",n.arg=r.arg,n.delegate=null,h;i=r.arg;return i?i.done?(n[e.resultName]=i.value,n.next=e.nextLoc,"return"!==n.method&&(n.method="next",n.arg=void 0),n.delegate=null,h):i:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,h)}(n,a);if(n){if(n===h)continue;return n}}if("next"===a.method)a.sent=a._sent=a.arg;else if("throw"===a.method){if("suspendedStart"===s)throw s="completed",a.arg;a.dispatchException(a.arg)}else"return"===a.method&&a.abrupt("return",a.arg);s="executing";n=c(i,o,a);if("normal"===n.type){if(s=a.done?"completed":"suspendedYield",n.arg===h)continue;return{value:n.arg,done:a.done}}"throw"===n.type&&(s="completed",a.method="throw",a.arg=n.arg)}})}),e}function c(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(t){return{type:"throw",arg:t}}}a.wrap=s;var h={};function d(){}function f(){}function p(){}var e={},g=(o(e,r,function(){return this}),Object.getPrototypeOf),g=g&&g(g(x([]))),m=(g&&g!==t&&l.call(g,r)&&(e=g),p.prototype=d.prototype=Object.create(e));function v(t){["next","throw","return"].forEach(function(e){o(t,e,function(t){return this._invoke(e,t)})})}function y(a,s){var e;u(this,"_invoke",{value:function(n,r){function t(){return new s(function(t,e){!function e(t,n,r,i){var o,t=c(a[t],a,n);if("throw"!==t.type)return(n=(o=t.arg).value)&&"object"==typeof n&&l.call(n,"__await")?s.resolve(n.__await).then(function(t){e("next",t,r,i)},function(t){e("throw",t,r,i)}):s.resolve(n).then(function(t){o.value=t,r(o)},function(t){return e("throw",t,r,i)});i(t.arg)}(n,r,t,e)})}return e=e?e.then(t,t):t()}})}function E(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function _(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function b(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(E,this),this.reset(!0)}function x(e){if(e){var n,t=e[r];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length))return n=-1,(t=function t(){for(;++n<e.length;)if(l.call(e,n))return t.value=e[n],t.done=!1,t;return t.value=void 0,t.done=!0,t}).next=t}return{next:S}}function S(){return{value:void 0,done:!0}}return u(m,"constructor",{value:f.prototype=p,configurable:!0}),u(p,"constructor",{value:f,configurable:!0}),f.displayName=o(p,i,"GeneratorFunction"),a.isGeneratorFunction=function(t){t="function"==typeof t&&t.constructor;return!!t&&(t===f||"GeneratorFunction"===(t.displayName||t.name))},a.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,p):(t.__proto__=p,o(t,i,"GeneratorFunction")),t.prototype=Object.create(m),t},a.awrap=function(t){return{__await:t}},v(y.prototype),o(y.prototype,n,function(){return this}),a.AsyncIterator=y,a.async=function(t,e,n,r,i){void 0===i&&(i=Promise);var o=new y(s(t,e,n,r),i);return a.isGeneratorFunction(e)?o:o.next().then(function(t){return t.done?t.value:o.next()})},v(m),o(m,i,"Generator"),o(m,r,function(){return this}),o(m,"toString",function(){return"[object Generator]"}),a.keys=function(t){var e,n=Object(t),r=[];for(e in n)r.push(e);return r.reverse(),function t(){for(;r.length;){var e=r.pop();if(e in n)return t.value=e,t.done=!1,t}return t.done=!0,t}},a.values=x,b.prototype={constructor:b,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(_),!t)for(var e in this)"t"===e.charAt(0)&&l.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=void 0)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(n){if(this.done)throw n;var r=this;function t(t,e){return o.type="throw",o.arg=n,r.next=t,e&&(r.method="next",r.arg=void 0),!!e}for(var e=this.tryEntries.length-1;0<=e;--e){var i=this.tryEntries[e],o=i.completion;if("root"===i.tryLoc)return t("end");if(i.tryLoc<=this.prev){var a=l.call(i,"catchLoc"),s=l.call(i,"finallyLoc");if(a&&s){if(this.prev<i.catchLoc)return t(i.catchLoc,!0);if(this.prev<i.finallyLoc)return t(i.finallyLoc)}else if(a){if(this.prev<i.catchLoc)return t(i.catchLoc,!0)}else{if(!s)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return t(i.finallyLoc)}}}},abrupt:function(t,e){for(var n=this.tryEntries.length-1;0<=n;--n){var r=this.tryEntries[n];if(r.tryLoc<=this.prev&&l.call(r,"finallyLoc")&&this.prev<r.finallyLoc){var i=r;break}}var o=(i=i&&("break"===t||"continue"===t)&&i.tryLoc<=e&&e<=i.finallyLoc?null:i)?i.completion:{};return o.type=t,o.arg=e,i?(this.method="next",this.next=i.finallyLoc,h):this.complete(o)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),h},finish:function(t){for(var e=this.tryEntries.length-1;0<=e;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),_(n),h}},catch:function(t){for(var e=this.tryEntries.length-1;0<=e;--e){var n,r,i=this.tryEntries[e];if(i.tryLoc===t)return"throw"===(n=i.completion).type&&(r=n.arg,_(i)),r}throw new Error("illegal catch attempt")},delegateYield:function(t,e,n){return this.delegate={iterator:x(t),resultName:e,nextLoc:n},"next"===this.method&&(this.arg=void 0),h}},a}function _m(t,e,n,r,i,o,a){try{var s=t[o](a),l=s.value}catch(t){return void n(t)}s.done?e(l):Promise.resolve(l).then(r,i)}function bm(s){return function(){var t=this,a=arguments;return new Promise(function(e,n){var r=s.apply(t,a);function i(t){_m(r,e,n,i,o,"next",t)}function o(t){_m(r,e,n,i,o,"throw",t)}i(void 0)})}}function xm(){return(xm=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n,r=arguments[e];for(n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t}).apply(this,arguments)}function Sm(t,e){t.prototype=Object.create(e.prototype),wm(t.prototype.constructor=t,e)}function wm(t,e){return(wm=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t})(t,e)}function Tm(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function Am(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}function Mm(t,e){var n,r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(r)return(r=r.call(t)).next.bind(r);if(Array.isArray(t)||(r=function(t,e){var n;if(t)return"string"==typeof t?Am(t,e):"Map"===(n="Object"===(n=Object.prototype.toString.call(t).slice(8,-1))&&t.constructor?t.constructor.name:n)||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Am(t,e):void 0}(t))||e&&t&&"number"==typeof t.length)return r&&(t=r),n=0,function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}};throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o=function(r){function t(t){var e=t.id,t=t.device,n=r.call(this)||this;return n.id=void 0,n.name=void 0,n.device=void 0,n.id=e,n.device=t,null!==n.device.resourceCreationTracker&&n.device.resourceCreationTracker.trackResourceCreated(Tm(n)),n}return Sm(t,r),t.prototype.destroy=function(){null!==this.device.resourceCreationTracker&&this.device.resourceCreationTracker.trackResourceDestroyed(this)},t}(qn),Rm=function(a){function t(t){var e=t.id,n=t.device,t=t.descriptor,e=a.call(this,{id:e,device:n})||this,r=(e.type=gf.Bindings,e.uniformBufferBindings=void 0,e.samplerBindings=void 0,t.bindingLayout),i=t.uniformBufferBindings,n=t.samplerBindings;T(i.length>=r.numUniformBuffers),T(n.length>=r.numSamplers);for(var o=0;o<r.numUniformBuffers;o++)T(0<i[o].wordCount);return e.uniformBufferBindings=t.uniformBufferBindings,e.samplerBindings=t.samplerBindings,e}return Sm(t,a),t}(o);function A(t){return"undefined"!=typeof WebGL2RenderingContext&&t instanceof WebGL2RenderingContext||Boolean(t&&2===t._version)}function Nm(t){return!(255&t&h.Normalized||(t=jf(t))!==u.S8&&t!==u.S16&&t!==u.S32&&t!==u.U8&&t!==u.U16&&t!==u.U32)}function Cm(t){return t&wf.INDEX?w.ELEMENT_ARRAY_BUFFER:t&wf.VERTEX?w.ARRAY_BUFFER:t&wf.UNIFORM?w.UNIFORM_BUFFER:void 0}function Pm(t){var e=jf(t),n=Vf(t),t=255&t,e=function(t){switch(t){case u.U8:return w.UNSIGNED_BYTE;case u.U16:return w.UNSIGNED_SHORT;case u.U32:return w.UNSIGNED_INT;case u.S8:return w.BYTE;case u.S16:return w.SHORT;case u.S32:return w.INT;case u.F16:return w.HALF_FLOAT;case u.F32:return w.FLOAT;default:throw new Error("whoops")}}(e);return{size:function(t){switch(t){case c.R:return 1;case c.RG:return 2;case c.RGB:return 3;case c.RGBA:return 4;default:return 1}}(n),type:e,normalized:!!(t&h.Normalized)}}function Om(t){switch(t){case _f.Clamp:return w.CLAMP_TO_EDGE;case _f.Repeat:return w.REPEAT;case _f.Mirror:return w.MIRRORED_REPEAT;default:throw new Error("whoops")}}function Im(t,e){if(e===xf.Linear&&t===bf.Bilinear)return w.LINEAR_MIPMAP_LINEAR;if(e===xf.Linear&&t===bf.Point)return w.NEAREST_MIPMAP_LINEAR;if(e===xf.Nearest&&t===bf.Bilinear)return w.LINEAR_MIPMAP_NEAREST;if(e===xf.Nearest&&t===bf.Point)return w.NEAREST_MIPMAP_NEAREST;if(e===xf.NoMip&&t===bf.Bilinear)return w.LINEAR;if(e===xf.NoMip&&t===bf.Point)return w.NEAREST;throw new Error("Unknown texture filter mode")}function Lm(t,e){return t.gl_buffer_pages[(e=void 0===e?0:e)/t.pageByteSize|0]}function km(t){return t.gl_texture}function Dm(t){return t.gl_sampler}function Bm(t,e){t.name=e,t.__SPECTOR_Metadata={name:e}}function Fm(t,e){for(var n=[];;){var r=e.exec(t);if(!r)break;n.push(r)}return n}function Um(t){return t.blendMode==Ef.Add&&t.blendSrcFactor==yf.One&&t.blendDstFactor===yf.Zero}function Gm(t,e,n,r){return t%n==0&&e%r==0}var Wm,Vm=function(c){function t(t){var e=t.id,n=t.device,t=t.descriptor,r=c.call(this,{id:e,device:n})||this,e=(r.type=gf.Buffer,r.gl_buffer_pages=void 0,r.gl_target=void 0,r.usage=void 0,r.byteSize=void 0,r.pageByteSize=void 0,t.viewOrSize),i=t.usage,o=t.hint,a=n.uniformBufferMaxPageByteSize,t=n.gl;if(i&wf.STORAGE)return Tm(r)||Tm(r);var s,l=i&wf.UNIFORM,e=(l||(A(t)?t.bindVertexArray(null):n.OES_vertex_array_object.bindVertexArrayOES(null)),B(e)?4*e:4*e.byteLength);if(r.gl_buffer_pages=[],l){T(e%a==0);for(var u=e;0<u;)r.gl_buffer_pages.push(r.createBufferPage(Math.min(u,a),i,o)),u-=a;s=a}else r.gl_buffer_pages.push(r.createBufferPage(e,i,o)),s=e;return r.pageByteSize=s,r.byteSize=e,r.usage=i,r.gl_target=Cm(i),l||(A(t)?t.bindVertexArray(r.device.currentBoundVAO):n.OES_vertex_array_object.bindVertexArrayOES(r.device.currentBoundVAO)),r}Sm(t,c);var e=t.prototype;return e.setSubData=function(t,e,n,r){void 0===n&&(n=0),void 0===r&&(r=e.byteLength-n);var i=this.device.gl,o=this.gl_target,a=this.byteSize,s=this.pageByteSize;if(!(t+r<=a))throw new Error("Assert fail: (dstByteOffset ["+t+"] + byteSize ["+r+"]) <= dstByteSize ["+a+"], gl_target "+o);for(var l=t+r,u=t,c=t%s;u<l;){var h=A(i)?i.COPY_WRITE_BUFFER:this.gl_target;i.bindBuffer(h,Lm(this,u)),A(i)?i.bufferSubData(h,c,e,n,Math.min(l-u,s)):i.bufferSubData(h,c,e),u+=s,c=0,n+=s,this.device.debugGroupStatisticsBufferUpload()}},e.destroy=function(){c.prototype.destroy.call(this);for(var t=0;t<this.gl_buffer_pages.length;t++)this.gl_buffer_pages[t].ubo||this.device.gl.deleteBuffer(this.gl_buffer_pages[t])},e.createBufferPage=function(t,e,n){var r=this.device.gl,i=e&wf.UNIFORM;return!A(r)&&i?{ubo:!0}:(i=this.device.ensureResourceExists(r.createBuffer()),e=Cm(e),n=function(t){switch(t){case Tf.Static:return w.STATIC_DRAW;case Tf.Dynamic:return w.DYNAMIC_DRAW}}(n),r.bindBuffer(e,i),r.bufferData(e,t,n),i)},t}(o),jm=function(i){function t(t){var e=t.id,n=t.device,t=t.descriptor,e=i.call(this,{id:e,device:n})||this,n=(e.type=gf.InputLayout,e.vertexAttributeDescriptors=void 0,e.vertexBufferDescriptors=void 0,e.indexBufferFormat=void 0,t.vertexAttributeDescriptors),r=t.vertexBufferDescriptors,t=t.indexBufferFormat;return T(t===S.U16_R||t===S.U32_R||null===t),e.vertexAttributeDescriptors=n,e.vertexBufferDescriptors=r,e.indexBufferFormat=t,e}return Sm(t,i),t}(o),zm=function(b){function t(t){var e=t.id,n=t.device,r=t.inputLayout,i=t.vertexBuffers,o=t.indexBufferBinding,a=t.program,t=b.call(this,{id:e,device:n})||this,s=(t.type=gf.InputState,t.vao=void 0,t.indexBufferByteOffset=void 0,t.indexBufferType=void 0,t.indexBufferCompByteSize=void 0,t.inputLayout=void 0,t.vertexBuffers=void 0,t.device.gl),e=t.device.ensureResourceExists(A(s)?s.createVertexArray():n.OES_vertex_array_object.createVertexArrayOES());A(s)?s.bindVertexArray(e):n.OES_vertex_array_object.bindVertexArrayOES(e),n.currentBoundVAO=e;for(var l=0;l<r.vertexAttributeDescriptors.length;l++){var u,c,h,d=r.vertexAttributeDescriptors[l],f=d.format,p=d.divisor,p=void 0===p?1:p,g=d.byteStride,m=d.bufferByteOffset,v=d.bufferIndex,d=A(s)?d.location:null==(d=a.attributes[d.location])?void 0:d.location;M(d)||(Nm(f),u=(f=Pm(f)).size,c=f.type,f=f.normalized,null!==(h=i[v])&&(v=Hf(r.vertexBufferDescriptors[v]),T(!!(h.buffer.usage&wf.VERTEX)),s.bindBuffer(s.ARRAY_BUFFER,Lm(h.buffer)),h=h.byteOffset+m,s.vertexAttribPointer(d,u,c,f,g||v.byteStride,h),v.frequency===Af.PerInstance&&(A(s)?s.vertexAttribDivisor(d,p):n.ANGLE_instanced_arrays.vertexAttribDivisorANGLE(d,p)),s.enableVertexAttribArray(d)))}var y=null,E=null,_=null;return null!==o&&(T(!!(o.buffer.usage&wf.INDEX)),s.bindBuffer(s.ELEMENT_ARRAY_BUFFER,Lm(o.buffer)),y=function(t){switch(t){case S.U8_R:return w.UNSIGNED_BYTE;case S.U16_R:return w.UNSIGNED_SHORT;case S.U32_R:return w.UNSIGNED_INT;default:throw new Error("whoops")}}(Hf(r.indexBufferFormat)),E=zf(r.indexBufferFormat),_=o.byteOffset),A(s)?s.bindVertexArray(null):n.OES_vertex_array_object.bindVertexArrayOES(null),n.currentBoundVAO=null,t.vao=e,t.indexBufferByteOffset=_,t.indexBufferType=y,t.indexBufferCompByteSize=E,t.inputLayout=r,t.vertexBuffers=i,t}return Sm(t,b),t.prototype.destroy=function(){b.prototype.destroy.call(this),this.device.currentBoundVAO===this.vao&&(A(this.device.gl)?(this.device.gl.bindVertexArray(null),this.device.gl.deleteVertexArray(this.vao)):(this.device.OES_vertex_array_object.bindVertexArrayOES(null),this.device.OES_vertex_array_object.deleteVertexArrayOES(this.vao)),this.device.currentBoundVAO=null)},t}(o),Hm=function(l){function t(t){var e=t.id,n=t.device,r=t.descriptor,t=t.fake,e=l.call(this,{id:e,device:n})||this,n=(e.type=gf.Texture,e.gl_texture=void 0,e.gl_target=void 0,e.pixelFormat=void 0,e.width=void 0,e.height=void 0,e.depth=void 0,e.numLevels=void 0,e.immutable=void 0,e.pixelStore=void 0,e.mipmaps=void 0,e.formatKind=void 0,e.textureIndex=void 0,e.device.gl),i=e.clampNumLevels(r);if(e.immutable=!!r.immutable,e.pixelStore=r.pixelStore,e.pixelFormat=r.pixelFormat,e.formatKind=function(t){var e=255&t;if(e&h.Depth)return Of.Depth;if(e&h.Normalized)return Of.Float;if((e=jf(t))===u.F16||e===u.F32)return Of.Float;if(e===u.U8||e===u.U16||e===u.U32)return Of.Uint;if(e===u.S8||e===u.S16||e===u.S32)return Of.Sint;throw new Error("whoops")}(r.pixelFormat),e.width=r.width,e.height=r.height,e.depth=r.depth,e.mipmaps=1<=i,!t){var o=e.device.ensureResourceExists(n.createTexture()),t=e.device.translateTextureType(r.pixelFormat),a=e.device.translateTextureInternalFormat(r.pixelFormat);if(e.device.setActiveTexture(n.TEXTURE0),e.device.currentTextures[0]=null,e.preprocessImage(),r.dimension===Rf.n2D){var s=w.TEXTURE_2D;n.bindTexture(s,o),e.immutable&&(A(n)?n.texStorage2D(s,i,a,r.width,r.height):(a!==w.DEPTH_COMPONENT&&e.isNPOT(),n.texImage2D(s,0,a,r.width,r.height,0,a,t,null),e.mipmaps&&e.isNPOT()&&(e.mipmaps=!1,n.texParameteri(w.TEXTURE_2D,w.TEXTURE_MIN_FILTER,w.LINEAR),n.texParameteri(w.TEXTURE_2D,w.TEXTURE_WRAP_S,w.CLAMP_TO_EDGE),n.texParameteri(w.TEXTURE_2D,w.TEXTURE_WRAP_T,w.CLAMP_TO_EDGE)))),T(1===r.depth)}else if(r.dimension===Rf.n2DArray)s=w.TEXTURE_2D_ARRAY,n.bindTexture(s,o),A(n)&&n.texStorage3D(s,i,a,r.width,r.height,r.depth);else if(r.dimension===Rf.n3D)s=w.TEXTURE_3D,n.bindTexture(s,o),A(n)&&n.texStorage3D(s,i,a,r.width,r.height,r.depth);else{if(r.dimension!==Rf.Cube)throw new Error("whoops");s=w.TEXTURE_CUBE_MAP,n.bindTexture(s,o),A(n)&&n.texStorage2D(s,i,a,r.width,r.height),T(6===r.depth)}}return e.gl_texture=o,e.gl_target=s,e.numLevels=i,e}Sm(t,l);var e=t.prototype;return e.setImageData=function(t,e){var n,r,i=this.device.gl,o=Array.isArray(t),a=(this.device.setActiveTexture(i.TEXTURE0),this.device.currentTextures[0]=null,o?(n=this.width,r=this.height):(n=t.width,r=t.height,this.width=n,this.height=r),i.bindTexture(this.gl_target,this.gl_texture),this.device.translateTextureFormat(this.pixelFormat)),s=this.device.translateTextureType(this.pixelFormat);this.preprocessImage(),this.immutable?i.texSubImage2D(this.gl_target,0,0,0,n,r,a,s,o?t[0]:t):A(i)?i.texImage2D(this.gl_target,0,a,n,r,0,a,s,o?t[0]:t):o?i.texImage2D(this.gl_target,0,a,n,r,0,a,s,t[0]):i.texImage2D(this.gl_target,0,a,a,s,t),this.mipmaps&&this.generateMipmap()},e.destroy=function(){l.prototype.destroy.call(this),this.device.gl.deleteTexture(km(this))},e.clampNumLevels=function(t){if(t.dimension===Rf.n2DArray&&1<t.depth&&jf(t.pixelFormat)===u.BC1)for(var e=t.width,n=t.height,r=0;r<t.numLevels;r++){if(e<=2||n<=2)return r-1;e=Math.max(e/2|0,1),n=Math.max(n/2|0,1)}return t.numLevels},e.preprocessImage=function(){var t=this.device.gl;this.pixelStore&&(this.pixelStore.unpackFlipY&&t.pixelStorei(w.UNPACK_FLIP_Y_WEBGL,!0),this.pixelStore.packAlignment&&t.pixelStorei(w.PACK_ALIGNMENT,this.pixelStore.packAlignment),this.pixelStore.unpackAlignment)&&t.pixelStorei(w.UNPACK_ALIGNMENT,this.pixelStore.unpackAlignment)},e.generateMipmap=function(){var t=this.device.gl;return!A(t)&&this.isNPOT()||this.gl_texture&&this.gl_target&&(t.bindTexture(this.gl_target,this.gl_texture),t.generateMipmap(this.gl_target),t.texParameteri(w.TEXTURE_2D,w.TEXTURE_MIN_FILTER,w.NEAREST_MIPMAP_LINEAR),t.bindTexture(this.gl_target,null)),this},e.isNPOT=function(){return!(A(this.device.gl)||Zf(this.width)&&Zf(this.height))},t}(o),Xm=((Vs=Wm=Wm||{})[Vs.NeedsCompile=0]="NeedsCompile",Vs[Vs.Compiling=1]="Compiling",Vs[Vs.NeedsBind=2]="NeedsBind",Vs[Vs.ReadyToUse=3]="ReadyToUse",function(r){function t(t){var e=t.id,n=t.device,t=t.descriptor,e=r.call(this,{id:e,device:n})||this,n=(e.type=gf.Program,e.gl_program=void 0,e.gl_shader_vert=void 0,e.gl_shader_frag=void 0,e.compileState=void 0,e.descriptor=void 0,e.uniformSetters={},e.attributes=[],e.device.gl);return e.descriptor=t,e.gl_program=e.device.ensureResourceExists(n.createProgram()),e.gl_shader_vert=null,e.gl_shader_frag=null,e.compileState=Wm.NeedsCompile,e.tryCompileProgram(),e}Sm(t,r);var e=t.prototype;return e.destroy=function(){r.prototype.destroy.call(this),this.device.gl.deleteProgram(this.gl_program),this.device.gl.deleteShader(this.gl_shader_vert),this.device.gl.deleteShader(this.gl_shader_frag)},e.tryCompileProgram=function(){T(this.compileState===Wm.NeedsCompile);var t=this.descriptor,e=this.device.gl;null!==this.gl_shader_vert&&e.deleteShader(this.gl_shader_vert),null!==this.gl_shader_frag&&e.deleteShader(this.gl_shader_frag),t.preprocessedCompute?(this.gl_shader_vert=this.compileShader(Zp(this.device.queryVendorInfo(),"vert","\nlayout(location = 0) in vec2 a_Position;\n\nout vec2 v_TexCoord;\n\nvoid main() {\n v_TexCoord = 0.5 * (a_Position + 1.0);\n gl_Position = vec4(a_Position, 0., 1.);\n\n #ifdef VIEWPORT_ORIGIN_TL\n v_TexCoord.y = 1.0 - v_TexCoord.y;\n #endif\n}\n"),e.VERTEX_SHADER),this.gl_shader_frag=this.compileShader(t.preprocessedCompute,e.FRAGMENT_SHADER)):(this.gl_shader_vert=this.compileShader(t.preprocessedVert,e.VERTEX_SHADER),this.gl_shader_frag=this.compileShader(t.preprocessedFrag,e.FRAGMENT_SHADER)),e.attachShader(this.gl_program,this.gl_shader_vert),e.attachShader(this.gl_program,this.gl_shader_frag),e.linkProgram(this.gl_program),this.compileState=Wm.Compiling,A(e)||(this.readUniformLocationsFromLinkedProgram(),this.readAttributesFromLinkedProgram())},e.readAttributesFromLinkedProgram=function(){for(var i,t,o,a,s=this,l=this.device.gl,e=l.getProgramParameter(this.gl_program,l.ACTIVE_ATTRIBUTES),n=(n=this.descriptor.preprocessedVert,i={},n.replace(/^\s*#define\s*(\S*)\s*(\S*)\s*$/gm,function(t,e,n){var r=Number(n);return i[e]=isNaN(r)?n:r,""}),i),u=(t=this.descriptor.vert,o=n,a=[],t.replace(/^\s*layout\(location\s*=\s*(\S*)\)\s*in\s+\S+\s*(.*);$/gm,function(t,e,n){var r=Number(e);return a.push({location:isNaN(r)?o[e]:r,name:n}),""}),a),c=0;c<e;c++)!function(){var t=l.getActiveAttrib(s.gl_program,c),e=t.name,n=t.type,t=t.size,r=l.getAttribLocation(s.gl_program,e),i=null==(i=u.find(function(t){return t.name===e}))?void 0:i.location;0<=r&&!M(i)&&(s.attributes[i]={name:e,location:r,type:n,size:t})}()},e.readUniformLocationsFromLinkedProgram=function(){for(var t=this.device.gl,e=t.getProgramParameter(this.gl_program,t.ACTIVE_UNIFORMS),n=0;n<e;n++){var r=t.getActiveUniform(this.gl_program,n),i=function(t){if("]"!==t[t.length-1])return{name:t,length:1,isArray:!1};var e=t.match(Ip);if(!e||e.length<2)throw new Error("Failed to parse GLSL uniform name "+t);return{name:e[1],length:Number(e[2])||1,isArray:Boolean(e[2])}}(r.name).name,o=t.getUniformLocation(this.gl_program,i);if(this.uniformSetters[i]=Yp(t,o,r),r&&1<r.size)for(var a=0;a<r.size;a++)o=t.getUniformLocation(this.gl_program,i+"["+a+"]"),this.uniformSetters[i+"["+a+"]"]=Yp(t,o,r)}},e.compileShader=function(t,e){var n=this.device.gl,e=this.device.ensureResourceExists(n.createShader(e));return n.shaderSource(e,t),n.compileShader(e),e},e.setUniforms=function(t){void 0===t&&(t={});var e=this.device.gl;if(!A(e)){var n,r=!1;for(n in t){r||(e.useProgram(this.gl_program),r=!0);var i=t[n],o=this.uniformSetters[n];o&&o(o=(o=i)instanceof Hm?o.textureIndex:o)}}return this},t}(o)),Ym=function(o){function t(t){var e=t.id,n=t.device,t=t.descriptor,r=o.call(this,{id:e,device:n})||this,i=(r.type=gf.QueryPool,r.gl_query_type=void 0,r.gl_query=void 0,r.device.gl);return A(i)&&(e=t.elemCount,n=t.type,r.gl_query=ip(e,function(){return r.device.ensureResourceExists(i.createQuery())}),r.gl_query_type=function(t){if(t!==kf.OcclusionConservative)throw new Error("whoops");return w.ANY_SAMPLES_PASSED_CONSERVATIVE}(n)),r}Sm(t,o);var e=t.prototype;return e.queryResultOcclusion=function(t){var e=this.device.gl;return A(e)&&(t=this.gl_query[t],e.getQueryParameter(t,e.QUERY_RESULT_AVAILABLE))?!!e.getQueryParameter(t,e.QUERY_RESULT):null},e.destroy=function(){o.prototype.destroy.call(this);var t=this.device.gl;if(A(t))for(var e=0;e<this.gl_query.length;e++)t.deleteQuery(this.gl_query[e])},t}(o),Km=function(n){function t(t){var e=t.id,t=t.device,e=n.call(this,{id:e,device:t})||this;return e.type=gf.Readback,e.gl_pbo=null,e.gl_sync=null,e}Sm(t,n);var e=t.prototype;return e.clientWaitAsync=function(i,o,a){void 0===o&&(o=0),void 0===a&&(a=10);var s=this.device.gl;return new Promise(function(n,r){!function t(){var e=s.clientWaitSync(i,o,0);e==s.WAIT_FAILED?r():e==s.TIMEOUT_EXPIRED?setTimeout(t,Ue(a,0,s.MAX_CLIENT_WAIT_TIMEOUT_WEBGL)):n()}()})},e.getBufferSubDataAsync=function(){var a=bm(Em().mark(function t(e,n,r,i,o,a){var s;return Em().wrap(function(t){for(;;)switch(t.prev=t.next){case 0:if(void 0===o&&(o=0),void 0===a&&(a=i.byteLength||0),A(s=this.device.gl))return this.gl_sync=s.fenceSync(s.SYNC_GPU_COMMANDS_COMPLETE,0),s.flush(),t.next=8,this.clientWaitAsync(this.gl_sync,0,10);t.next=12;break;case 8:return s.bindBuffer(e,n),s.getBufferSubData(e,r,i,o,a),s.bindBuffer(e,null),t.abrupt("return",i);case 12:case"end":return t.stop()}},t,this)}));return function(t,e,n,r,i,o){return a.apply(this,arguments)}}(),e.readTexture=function(t,e,n,r,i,o,a,s){void 0===s&&(s=o.byteLength||0);var s=this.device.gl,l=this.device.translateTextureType(t.pixelFormat);return s.bindFramebuffer(w.FRAMEBUFFER,this.device.readbackFramebuffer),s.framebufferTexture2D(w.FRAMEBUFFER,w.COLOR_ATTACHMENT0,w.TEXTURE_2D,t.gl_texture,0),s.pixelStorei(s.PACK_ALIGNMENT,4),s.readPixels(e,n,r,i,s.RGBA,l,o),o},e.readBuffer=function(){var o=bm(Em().mark(function t(e,n,r,i,o){var a;return Em().wrap(function(t){for(;;)switch(t.prev=t.next){case 0:if(A(a=this.device.gl))return t.abrupt("return",this.getBufferSubDataAsync(a.ARRAY_BUFFER,Lm(e,n),n,r,i,o));t.next=3;break;case 3:return t.abrupt("return",Promise.reject());case 4:case"end":return t.stop()}},t,this)}));return function(t,e,n,r,i){return o.apply(this,arguments)}}(),e.destroy=function(){n.prototype.destroy.call(this),A(this.device.gl)&&(null!==this.gl_sync&&this.device.gl.deleteSync(this.gl_sync),null!==this.gl_pbo)&&this.device.gl.deleteBuffer(this.gl_pbo)},t}(o),qm=function(r){function t(t){var e=t.id,n=t.device,t=t.descriptor,e=r.call(this,{id:e,device:n})||this;return e.type=gf.RenderPipeline,e.bindingLayouts=void 0,e.program=void 0,e.drawMode=void 0,e.megaState=void 0,e.inputLayout=void 0,e.colorAttachmentFormats=void 0,e.depthStencilAttachmentFormat=void 0,e.sampleCount=void 0,e.bindingLayouts=e.createBindingLayouts(t.bindingLayouts),e.drawMode=function(t){switch(t){case Sf.Triangles:return w.TRIANGLES;case Sf.Points:return w.POINTS;case Sf.TriangleStrip:return w.TRIANGLE_STRIP;case Sf.Lines:return w.LINES;case Sf.LineStrip:return w.LINE_STRIP;default:throw new Error("Unknown primitive topology mode")}}(t.topology),e.program=t.program,e.inputLayout=t.inputLayout,e.megaState=t.megaStateDescriptor,e.colorAttachmentFormats=t.colorAttachmentFormats.slice(),e.depthStencilAttachmentFormat=t.depthStencilAttachmentFormat,e.sampleCount=t.sampleCount,e}return Sm(t,r),t.prototype.createBindingLayouts=function(t){for(var e=0,n=0,r=[],i=0;i<t.length;i++){var o=t[i],a=o.numUniformBuffers,s=o.numSamplers,l=o.samplerEntries,u=[];void 0!==l&&T(l.length===s);for(var c=0;c<s;c++){var h=void 0!==l?l[c]:dp,d=h.dimension,h=h.formatKind;u.push({gl_target:function(t){if(t===Rf.n2D)return w.TEXTURE_2D;if(t===Rf.n2DArray)return w.TEXTURE_2D_ARRAY;if(t===Rf.Cube)return w.TEXTURE_CUBE_MAP;if(t===Rf.n3D)return w.TEXTURE_3D;throw new Error("whoops")}(d),formatKind:h})}r.push({firstUniformBuffer:e,numUniformBuffers:a,firstSampler:n,numSamplers:s,samplerEntries:u}),e+=a,n+=s}return{numUniformBuffers:e,numSamplers:n,bindingLayoutTables:r}},t}(o),$m=function(s){function t(t){var e=t.id,n=t.device,t=t.descriptor,e=s.call(this,{id:e,device:n})||this,n=(e.type=gf.RenderTarget,e.gl_renderbuffer=null,e.texture=null,e.pixelFormat=void 0,e.width=void 0,e.height=void 0,e.sampleCount=void 0,e.device.gl),r=t.pixelFormat,i=t.width,o=t.height,a=t.texture,t=t.sampleCount;return a?e.texture=a:(e.gl_renderbuffer=e.device.ensureResourceExists(n.createRenderbuffer()),n.bindRenderbuffer(n.RENDERBUFFER,e.gl_renderbuffer),a=e.device.translateTextureInternalFormat(r),A(n)?n.renderbufferStorageMultisample(w.RENDERBUFFER,t,a,i,o):n.renderbufferStorage(w.RENDERBUFFER,a,i,o)),e.pixelFormat=r,e.width=i,e.height=o,e.sampleCount=t,e}return Sm(t,s),t.prototype.destroy=function(){s.prototype.destroy.call(this),null!==this.gl_renderbuffer&&this.device.gl.deleteRenderbuffer(this.gl_renderbuffer)},t}(o),Zm=function(r){function t(t){var e=t.id,n=t.device,t=t.descriptor,e=r.call(this,{id:e,device:n})||this;return e.type=gf.ComputePipeline,e.descriptor=void 0,e.descriptor=t,e}return Sm(t,r),t}(o),Qm=function(){function t(){this.liveObjects=new Set,this.creationStacks=new Map,this.deletionStacks=new Map}var e=t.prototype;return e.trackResourceCreated=function(t){this.creationStacks.set(t,(new Error).stack),this.liveObjects.add(t)},e.trackResourceDestroyed=function(t){this.deletionStacks.has(t)&&console.warn("Object double freed:",t,"\n\nCreation stack: ",this.creationStacks.get(t),"\n\nDeletion stack: ",this.deletionStacks.get(t),"\n\nThis stack: ",(new Error).stack),this.deletionStacks.set(t,(new Error).stack),this.liveObjects.delete(t)},e.checkForLeaks=function(){for(var t=Mm(this.liveObjects.values());!(e=t()).done;){var e=e.value;console.warn("Object leaked:",e,"Creation stack:",this.creationStacks.get(e))}},e.setResourceLeakCheck=function(t,e){e?this.liveObjects.add(t):this.liveObjects.delete(t)},t}(),Jm=function(o){function t(t){var e,n,r=t.id,i=t.device,t=t.descriptor,r=o.call(this,{id:r,device:i})||this,i=(r.type=gf.Sampler,r.gl_sampler=void 0,r.descriptor=void 0,r.device.gl);return A(i)?(e=r.device.ensureResourceExists(i.createSampler()),i.samplerParameteri(e,w.TEXTURE_WRAP_S,Om(t.wrapS)),i.samplerParameteri(e,w.TEXTURE_WRAP_T,Om(t.wrapT)),i.samplerParameteri(e,w.TEXTURE_WRAP_R,Om(null!=(n=t.wrapQ)?n:t.wrapS)),i.samplerParameteri(e,w.TEXTURE_MIN_FILTER,Im(t.minFilter,t.mipFilter)),i.samplerParameteri(e,w.TEXTURE_MAG_FILTER,Im(t.magFilter,xf.NoMip)),void 0!==t.minLOD&&i.samplerParameterf(e,w.TEXTURE_MIN_LOD,t.minLOD),void 0!==t.maxLOD&&i.samplerParameterf(e,w.TEXTURE_MAX_LOD,t.maxLOD),void 0!==t.compareMode&&(i.samplerParameteri(e,i.TEXTURE_COMPARE_MODE,i.COMPARE_REF_TO_TEXTURE),i.samplerParameteri(e,i.TEXTURE_COMPARE_FUNC,t.compareMode)),1<(n=null!=(n=t.maxAnisotropy)?n:1)&&null!==r.device.EXT_texture_filter_anisotropic&&(T(t.minFilter===bf.Bilinear&&t.magFilter===bf.Bilinear&&t.mipFilter===xf.Linear),i.samplerParameterf(e,r.device.EXT_texture_filter_anisotropic.TEXTURE_MAX_ANISOTROPY_EXT,n)),r.gl_sampler=e):r.descriptor=t,r}Sm(t,o);var e=t.prototype;return e.setTextureParameters=function(t,e,n){var r=this.device.gl,i=this.descriptor,n=(this.isNPOT(e,n)?r.texParameteri(w.TEXTURE_2D,w.TEXTURE_MIN_FILTER,w.LINEAR):r.texParameteri(t,w.TEXTURE_MIN_FILTER,Im(i.minFilter,i.mipFilter)),r.texParameteri(w.TEXTURE_2D,w.TEXTURE_WRAP_S,Om(i.wrapS)),r.texParameteri(w.TEXTURE_2D,w.TEXTURE_WRAP_T,Om(i.wrapT)),r.texParameteri(t,w.TEXTURE_MAG_FILTER,Im(i.magFilter,xf.NoMip)),null!=(e=i.maxAnisotropy)?e:1);1<n&&null!==this.device.EXT_texture_filter_anisotropic&&(T(i.minFilter===bf.Bilinear&&i.magFilter===bf.Bilinear&&i.mipFilter===xf.Linear),r.texParameteri(t,this.device.EXT_texture_filter_anisotropic.TEXTURE_MAX_ANISOTROPY_EXT,n))},e.destroy=function(){o.prototype.destroy.call(this),A(this.device.gl)&&this.device.gl.deleteSampler(Dm(this))},e.isNPOT=function(t,e){return!Zf(t)||!Zf(e)},t}(o),tv=function(){function t(){this.descriptor=void 0}var e=t.prototype;return e.dispatch=function(t,e,n){},e.finish=function(){},e.beginComputePass=function(t){},e.setPipeline=function(t){},e.setBindings=function(t,e){},e.setComputePassDescriptor=function(t){this.descriptor=t},t}(),ev=function(){function t(t,e){this.shaderDebug=!1,this.contextAttributes=void 0,this.OES_vertex_array_object=null,this.ANGLE_instanced_arrays=null,this.OES_texture_float=null,this.OES_draw_buffers_indexed=null,this.WEBGL_depth_texture=null,this.WEBGL_compressed_texture_s3tc=null,this.WEBGL_compressed_texture_s3tc_srgb=null,this.EXT_texture_compression_rgtc=null,this.EXT_texture_filter_anisotropic=null,this.KHR_parallel_shader_compile=null,this.EXT_texture_norm16=null,this.OES_texture_float_linear=null,this.OES_texture_half_float_linear=null,this.scTexture=null,this.scPlatformFramebuffer=null,this.currentActiveTexture=null,this.currentBoundVAO=null,this.currentProgram=null,this.resourceCreationTracker=null,this.resourceUniqueId=0,this.currentColorAttachments=[],this.currentColorResolveTos=[],this.currentDepthStencilAttachment=void 0,this.currentDepthStencilResolveTo=null,this.currentSampleCount=-1,this.currentPipeline=void 0,this.currentInputState=void 0,this.currentMegaState=up(cp),this.currentSamplers=[],this.currentTextures=[],this.currentUniformBuffers=[],this.currentUniformBufferByteOffsets=[],this.currentUniformBufferByteSizes=[],this.currentScissorEnabled=!1,this.currentStencilRef=null,this.currentRenderPassDescriptor=null,this.debugGroupStack=[],this.resolveColorAttachmentsChanged=!1,this.resolveColorReadFramebuffer=void 0,this.resolveColorDrawFramebuffer=void 0,this.resolveDepthStencilAttachmentsChanged=!1,this.resolveDepthStencilReadFramebuffer=void 0,this.resolveDepthStencilDrawFramebuffer=void 0,this.renderPassDrawFramebuffer=void 0,this.readbackFramebuffer=void 0,this.fallbackTexture2D=void 0,this.fallbackTexture2DDepth=void 0,this.fallbackTexture2DArray=void 0,this.fallbackTexture3D=void 0,this.fallbackTextureCube=void 0,this.platformString=void 0,this.glslVersion=void 0,this.explicitBindingLocations=!1,this.separateSamplerTextures=!1,this.viewportOrigin=If.LowerLeft,this.clipSpaceNearZ=Lf.NegativeOne,this.supportMRT=!1,this.inBlitRenderPass=!1,this.blitRenderPipeline=void 0,this.blitInputState=void 0,this.blitBindings=void 0,this.uniformBufferMaxPageByteSize=void 0,this.uniformBufferWordAlignment=void 0,this.uniformBufferMaxPageWordSize=void 0,this.supportedSampleCounts=[],this.maxVertexAttribs=void 0,this.occlusionQueriesRecommended=!1,this.gl=void 0,this.gl=t,this.contextAttributes=Hf(t.getContextAttributes()),A(t)?this.EXT_texture_norm16=t.getExtension("EXT_texture_norm16"):(this.OES_vertex_array_object=t.getExtension("OES_vertex_array_object"),this.ANGLE_instanced_arrays=t.getExtension("ANGLE_instanced_arrays"),this.OES_texture_float=t.getExtension("OES_texture_float"),this.WEBGL_depth_texture=t.getExtension("WEBGL_depth_texture"),t.getExtension("EXT_frag_depth"),t.getExtension("OES_element_index_uint"),t.getExtension("OES_standard_derivatives")),this.WEBGL_compressed_texture_s3tc=t.getExtension("WEBGL_compressed_texture_s3tc"),this.WEBGL_compressed_texture_s3tc_srgb=t.getExtension("WEBGL_compressed_texture_s3tc_srgb"),this.EXT_texture_compression_rgtc=t.getExtension("EXT_texture_compression_rgtc"),this.EXT_texture_filter_anisotropic=t.getExtension("EXT_texture_filter_anisotropic"),this.EXT_texture_norm16=t.getExtension("EXT_texture_norm16"),this.OES_texture_float_linear=t.getExtension("OES_texture_float_linear"),this.OES_texture_half_float_linear=t.getExtension("OES_texture_half_float_linear"),this.KHR_parallel_shader_compile=t.getExtension("KHR_parallel_shader_compile"),A(t)?(this.platformString="WebGL2",this.glslVersion="#version 300 es"):(this.platformString="WebGL1",this.glslVersion="#version 100"),this.scTexture=new Hm({id:this.getNextUniqueId(),device:this,descriptor:{width:0,height:0,depth:1,dimension:Rf.n2D,numLevels:1,usage:Nf.RenderTarget,pixelFormat:!1===this.contextAttributes.alpha?S.U8_RGB_RT:S.U8_RGBA_RT},fake:!0}),this.scTexture.formatKind=Of.Float,this.scTexture.gl_target=null,this.scTexture.gl_texture=null,this.resolveColorReadFramebuffer=this.ensureResourceExists(t.createFramebuffer()),this.resolveColorDrawFramebuffer=this.ensureResourceExists(t.createFramebuffer()),this.resolveDepthStencilReadFramebuffer=this.ensureResourceExists(t.createFramebuffer()),this.resolveDepthStencilDrawFramebuffer=this.ensureResourceExists(t.createFramebuffer()),this.renderPassDrawFramebuffer=this.ensureResourceExists(t.createFramebuffer()),this.readbackFramebuffer=this.ensureResourceExists(t.createFramebuffer()),this.fallbackTexture2D=this.createFallbackTexture(Rf.n2D,Of.Float),this.fallbackTexture2DDepth=this.createFallbackTexture(Rf.n2D,Of.Depth),A(t),this.currentMegaState.depthCompare=mf.Less,this.currentMegaState.depthWrite=!1,this.currentMegaState.attachmentsState[0].channelWriteMask=Cf.AllChannels,t.enable(t.DEPTH_TEST),t.enable(t.STENCIL_TEST),this.checkLimits(),e.shaderDebug&&(this.shaderDebug=!0),e.trackResources&&(this.resourceCreationTracker=new Qm)}var e=t.prototype;return e.createFallbackTexture=function(t,e){var n=t===Rf.Cube?6:1,r=e===Of.Depth?S.D32F:S.U8_RGBA_NORM,t=this.createTexture({dimension:t,pixelFormat:r,usage:Nf.Sampled,width:1,height:1,depth:n,numLevels:1,immutable:!0});return e===Of.Float&&t.setImageData([new Uint8Array(4*n)],0),km(t)},e.getNextUniqueId=function(){return++this.resourceUniqueId},e.checkLimits=function(){var t=this.gl;this.maxVertexAttribs=t.getParameter(w.MAX_VERTEX_ATTRIBS),A(t)?(this.uniformBufferMaxPageByteSize=Math.min(t.getParameter(w.MAX_UNIFORM_BLOCK_SIZE),65536),this.uniformBufferWordAlignment=t.getParameter(t.UNIFORM_BUFFER_OFFSET_ALIGNMENT)/4,t=t.getInternalformatParameter(t.RENDERBUFFER,t.DEPTH32F_STENCIL8,t.SAMPLES),this.supportedSampleCounts=t?[].concat(t):[],this.occlusionQueriesRecommended=!0):(this.uniformBufferWordAlignment=64,this.uniformBufferMaxPageByteSize=65536),this.uniformBufferMaxPageWordSize=this.uniformBufferMaxPageByteSize/4,this.supportedSampleCounts.includes(1)||this.supportedSampleCounts.push(1),this.supportedSampleCounts.sort(function(t,e){return t-e})},e.configureSwapChain=function(t,e,n){var r=this.scTexture;r.width=t,r.height=e,this.scPlatformFramebuffer=Jf(n)},e.getDevice=function(){return this},e.getCanvas=function(){return this.gl.canvas},e.getOnscreenTexture=function(){return this.scTexture},e.present=function(){},e.translateTextureInternalFormat=function(t){switch(t){case S.ALPHA:return w.ALPHA;case S.F16_R:return w.R16F;case S.F16_RG:return w.RG16F;case S.F16_RGB:return w.RGB16F;case S.F16_RGBA:return w.RGBA16F;case S.F32_R:return w.R32F;case S.F32_RG:return w.RG32F;case S.F32_RGB:return w.RGB32F;case S.F32_RGBA:return w.RGBA32F;case S.U8_R_NORM:return w.R8;case S.U8_RG_NORM:return w.RG8;case S.U8_RGB_NORM:case S.U8_RGB_RT:return w.RGB8;case S.U8_RGB_SRGB:return w.SRGB8;case S.U8_RGBA_NORM:case S.U8_RGBA_RT:return A(this.gl)?w.RGBA8:w.RGBA;case S.U8_RGBA_SRGB:case S.U8_RGBA_RT_SRGB:return w.SRGB8_ALPHA8;case S.U16_R:return w.R16UI;case S.U16_R_NORM:return this.EXT_texture_norm16.R16_EXT;case S.U16_RG_NORM:return this.EXT_texture_norm16.RG16_EXT;case S.U16_RGBA_NORM:return this.EXT_texture_norm16.RGBA16_EXT;case S.U32_R:return w.R32UI;case S.S8_RGBA_NORM:return w.RGBA8_SNORM;case S.S8_RG_NORM:return w.RG8_SNORM;case S.U16_RGBA_5551:return w.UNSIGNED_SHORT_5_5_5_1;case S.BC1:return this.WEBGL_compressed_texture_s3tc.COMPRESSED_RGBA_S3TC_DXT1_EXT;case S.BC1_SRGB:return this.WEBGL_compressed_texture_s3tc_srgb.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;case S.BC2:return this.WEBGL_compressed_texture_s3tc.COMPRESSED_RGBA_S3TC_DXT3_EXT;case S.BC2_SRGB:return this.WEBGL_compressed_texture_s3tc_srgb.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;case S.BC3:return this.WEBGL_compressed_texture_s3tc.COMPRESSED_RGBA_S3TC_DXT5_EXT;case S.BC3_SRGB:return this.WEBGL_compressed_texture_s3tc_srgb.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT;case S.BC4_UNORM:return this.EXT_texture_compression_rgtc.COMPRESSED_RED_RGTC1_EXT;case S.BC4_SNORM:return this.EXT_texture_compression_rgtc.COMPRESSED_SIGNED_RED_RGTC1_EXT;case S.BC5_UNORM:return this.EXT_texture_compression_rgtc.COMPRESSED_RED_GREEN_RGTC2_EXT;case S.BC5_SNORM:return this.EXT_texture_compression_rgtc.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT;case S.D32F_S8:return A(this.gl)?w.DEPTH32F_STENCIL8:w.DEPTH_STENCIL;case S.D24_S8:return A(this.gl)?w.DEPTH24_STENCIL8:w.DEPTH_STENCIL;case S.D32F:return A(this.gl)?w.DEPTH_COMPONENT32F:w.DEPTH_COMPONENT;case S.D24:return A(this.gl)?w.DEPTH_COMPONENT24:w.DEPTH_COMPONENT;default:throw new Error("whoops")}},e.translateTextureType=function(t){switch(jf(t)){case u.U8:return w.UNSIGNED_BYTE;case u.U16:return w.UNSIGNED_SHORT;case u.U32:return w.UNSIGNED_INT;case u.S8:return w.BYTE;case u.F16:return w.HALF_FLOAT;case u.F32:return w.FLOAT;case u.U16_PACKED_5551:return w.UNSIGNED_SHORT_5_5_5_1;case u.D32F:return A(this.gl)?w.FLOAT:w.UNSIGNED_INT;case u.D24:return A(this.gl)?w.UNSIGNED_INT_24_8:w.UNSIGNED_SHORT;case u.D24S8:return A(this.gl)?w.UNSIGNED_INT_24_8:w.UNSIGNED_INT_24_8_WEBGL;case u.D32FS8:return w.FLOAT_32_UNSIGNED_INT_24_8_REV;default:throw new Error("whoops")}},e.translateTextureFormat=function(t){if(function(t){switch(jf(t)){case u.BC1:case u.BC2:case u.BC3:case u.BC4_UNORM:case u.BC4_SNORM:case u.BC5_UNORM:case u.BC5_SNORM:return 1;default:return}}(t))return this.translateTextureInternalFormat(t);switch(t){case S.D24_S8:case S.D32F_S8:return w.DEPTH_STENCIL;case S.D24:case S.D32F:return w.DEPTH_COMPONENT}var e=Nm(t);switch(Vf(t)){case c.A:return w.ALPHA;case c.R:return e?w.RED_INTEGER:w.RED;case c.RG:return e?w.RG_INTEGER:w.RG;case c.RGB:return e?w.RGB_INTEGER:w.RGB;case c.RGBA:return w.RGBA}},e.setActiveTexture=function(t){this.currentActiveTexture!==t&&(this.gl.activeTexture(t),this.currentActiveTexture=t)},e.bindVAO=function(t){this.currentBoundVAO!==t&&(A(this.gl)?this.gl.bindVertexArray(t):this.OES_vertex_array_object.bindVertexArrayOES(t),this.currentBoundVAO=t)},e.programCompiled=function(t){T(t.compileState!==Wm.NeedsCompile),t.compileState===Wm.Compiling&&(t.compileState=Wm.NeedsBind,this.shaderDebug)&&this.checkProgramCompilationForErrors(t)},e.useProgram=function(t){this.currentProgram!==t&&(this.programCompiled(t),this.gl.useProgram(t.gl_program),this.currentProgram=t)},e.ensureResourceExists=function(t){var e;if(null===t)throw e=this.gl.getError(),new Error("Created resource is null; GL error encountered: "+e);return t},e.createBuffer=function(t){return new Vm({id:this.getNextUniqueId(),device:this,descriptor:t})},e.createTexture=function(t){return new Hm({id:this.getNextUniqueId(),device:this,descriptor:t})},e.createSampler=function(t){return new Jm({id:this.getNextUniqueId(),device:this,descriptor:t})},e.createRenderTarget=function(t){return new $m({id:this.getNextUniqueId(),device:this,descriptor:t})},e.createRenderTargetFromTexture=function(t){var e=t.pixelFormat,n=t.width,r=t.height;return T(1===t.numLevels),this.createRenderTarget({pixelFormat:e,width:n,height:r,sampleCount:1,texture:t})},e.createProgram=function(t){return t.ensurePreprocessed(this.queryVendorInfo()),this.createProgramSimple(t)},e.createProgramSimple=function(t){return new Xm({id:this.getNextUniqueId(),device:this,descriptor:t})},e.createBindings=function(t){return new Rm({id:this.getNextUniqueId(),device:this,descriptor:t})},e.createInputLayout=function(t){return new jm({id:this.getNextUniqueId(),device:this,descriptor:t})},e.createInputState=function(t,e,n,r){return new zm({id:this.getNextUniqueId(),device:this,inputLayout:t,vertexBuffers:e,indexBufferBinding:n,program:r})},e.createRenderPipeline=function(t){return new qm({id:this.getNextUniqueId(),device:this,descriptor:t})},e.createComputePass=function(t){return new tv},e.createComputePipeline=function(t){return new Zm({id:this.getNextUniqueId(),device:this,descriptor:t})},e.createReadback=function(){return new Km({id:this.getNextUniqueId(),device:this})},e.createQueryPool=function(t,e){return new Ym({id:this.getNextUniqueId(),device:this,descriptor:{type:t,elemCount:e}})},e.createRenderPass=function(t){T(null===this.currentRenderPassDescriptor);var e=(this.currentRenderPassDescriptor=t).colorAttachment,n=t.colorClearColor,r=t.colorResolveTo,i=t.depthStencilAttachment,o=t.depthClearValue,a=t.stencilClearValue,t=t.depthStencilResolveTo;this.setRenderPassParametersBegin(e.length);for(var s=0;s<e.length;s++)this.setRenderPassParametersColor(s,e[s],r[s]);this.setRenderPassParametersDepthStencil(i,t),this.validateCurrentAttachments();for(var l=0;l<e.length;l++){var u=n[l];"load"!==u&&this.setRenderPassParametersClearColor(l,u.r,u.g,u.b,u.a)}return this.setRenderPassParametersClearDepthStencil(o,a),this},e.submitPass=function(t){T(null!==this.currentRenderPassDescriptor),this.endPass(),this.currentRenderPassDescriptor=null},e.copySubTexture2D=function(t,e,n,r,i,o){var a=this.gl;T(1===r.numLevels),T(1===t.numLevels),A(a)&&(t===this.scTexture?a.bindFramebuffer(a.DRAW_FRAMEBUFFER,this.scPlatformFramebuffer):(a.bindFramebuffer(a.DRAW_FRAMEBUFFER,this.resolveColorDrawFramebuffer),this.bindFramebufferAttachment(a.DRAW_FRAMEBUFFER,a.COLOR_ATTACHMENT0,t)),a.bindFramebuffer(a.READ_FRAMEBUFFER,this.resolveColorReadFramebuffer),this.bindFramebufferAttachment(a.READ_FRAMEBUFFER,a.COLOR_ATTACHMENT0,r),a.blitFramebuffer(i,o,i+r.width,o+r.height,e,n,e+r.width,n+r.height,a.COLOR_BUFFER_BIT,a.LINEAR),a.bindFramebuffer(a.READ_FRAMEBUFFER,null),a.bindFramebuffer(a.DRAW_FRAMEBUFFER,null))},e.queryLimits=function(){return this},e.queryTextureFormatSupported=function(t,e,n){switch(t){case S.BC1_SRGB:case S.BC2_SRGB:case S.BC3_SRGB:return null!==this.WEBGL_compressed_texture_s3tc_srgb?Gm(e,n,4,4):!1;case S.BC1:case S.BC2:case S.BC3:return null!==this.WEBGL_compressed_texture_s3tc?Gm(e,n,4,4):!1;case S.BC4_UNORM:case S.BC4_SNORM:case S.BC5_UNORM:case S.BC5_SNORM:return null!==this.EXT_texture_compression_rgtc?Gm(e,n,4,4):!1;case S.U16_R_NORM:case S.U16_RG_NORM:case S.U16_RGBA_NORM:return null!==this.EXT_texture_norm16;case S.F32_R:case S.F32_RG:case S.F32_RGB:case S.F32_RGBA:return null!==this.OES_texture_float_linear;case S.F16_R:case S.F16_RG:case S.F16_RGB:case S.F16_RGBA:return null!==this.OES_texture_half_float_linear;default:return!0}},e.queryProgramReady=function(t){var e=this.gl;if(t.compileState===Wm.NeedsCompile)throw new Error("whoops");return t.compileState===Wm.Compiling?((e=null===this.KHR_parallel_shader_compile||e.getProgramParameter(t.gl_program,this.KHR_parallel_shader_compile.COMPLETION_STATUS_KHR))&&this.programCompiled(t),e):t.compileState===Wm.NeedsBind||t.compileState===Wm.ReadyToUse},e.queryPlatformAvailable=function(){return this.gl.isContextLost()},e.queryVendorInfo=function(){return this},e.queryRenderPass=function(t){return this.currentRenderPassDescriptor},e.queryRenderTarget=function(t){return t},e.setResourceName=function(t,e){var n;if(t.name=e,t.type===gf.Buffer)for(var r=t.gl_buffer_pages,i=0;i<r.length;i++)Bm(r[i],e+" Page "+i);else t.type===gf.Texture?Bm(km(t),e):t.type===gf.Sampler?Bm(Dm(t),e):t.type===gf.RenderTarget?null!==(n=t.gl_renderbuffer)&&Bm(n,e):t.type===gf.InputState&&Bm(t.vao,e)},e.setResourceLeakCheck=function(t,e){null!==this.resourceCreationTracker&&this.resourceCreationTracker.setResourceLeakCheck(t,e)},e.checkForLeaks=function(){null!==this.resourceCreationTracker&&this.resourceCreationTracker.checkForLeaks()},e.pushDebugGroup=function(t){this.debugGroupStack.push(t)},e.popDebugGroup=function(){this.debugGroupStack.pop()},e.programPatched=function(t,e){T(this.shaderDebug)},e.getBufferData=function(t,e,n){void 0===n&&(n=0);var r=this.gl;A(r)&&(r.bindBuffer(r.COPY_READ_BUFFER,Lm(t,4*n)),r.getBufferSubData(r.COPY_READ_BUFFER,4*n,e))},e.debugGroupStatisticsDrawCall=function(t){void 0===t&&(t=1);for(var e=this.debugGroupStack.length-1;0<=e;e--)this.debugGroupStack[e].drawCallCount+=t},e.debugGroupStatisticsBufferUpload=function(t){void 0===t&&(t=1);for(var e=this.debugGroupStack.length-1;0<=e;e--)this.debugGroupStack[e].bufferUploadCount+=t},e.debugGroupStatisticsTextureBind=function(t){void 0===t&&(t=1);for(var e=this.debugGroupStack.length-1;0<=e;e--)this.debugGroupStack[e].textureBindCount+=t},e.debugGroupStatisticsTriangles=function(t){for(var e=this.debugGroupStack.length-1;0<=e;e--)this.debugGroupStack[e].triangleCount+=t},e.reportShaderError=function(t,e){var n=this.gl,r=n.getShaderParameter(t,n.COMPILE_STATUS);return r||(console.error(op(e)),(e=n.getExtension("WEBGL_debug_shaders"))&&console.error(e.getTranslatedShaderSource(t)),console.error(n.getShaderInfoLog(t))),r},e.checkProgramCompilationForErrors=function(t){var e=this.gl,n=t.gl_program;e.getProgramParameter(n,e.LINK_STATUS)||(n=t.descriptor,this.reportShaderError(t.gl_shader_vert,n.preprocessedVert)&&this.reportShaderError(t.gl_shader_frag,n.preprocessedFrag)&&console.error(e.getProgramInfoLog(t.gl_program)))},e.bindFramebufferAttachment=function(t,e,n){var r=this.gl;null===n?r.framebufferRenderbuffer(t,e,r.RENDERBUFFER,null):n.type===gf.RenderTarget?null!==n.gl_renderbuffer?r.framebufferRenderbuffer(t,e,r.RENDERBUFFER,n.gl_renderbuffer):null!==n.texture&&r.framebufferTexture2D(t,e,w.TEXTURE_2D,km(n.texture),0):n.type===gf.Texture&&r.framebufferTexture2D(t,e,w.TEXTURE_2D,km(n),0)},e.bindFramebufferDepthStencilAttachment=function(t,e){var n=this.gl,r=null!==e?255&e.pixelFormat:h.Depth|h.Stencil,i=!!(r&h.Depth),r=!!(r&h.Stencil);i&&r?this.bindFramebufferAttachment(t,n.DEPTH_STENCIL_ATTACHMENT,e):i?(this.bindFramebufferAttachment(t,n.DEPTH_ATTACHMENT,e),this.bindFramebufferAttachment(t,n.STENCIL_ATTACHMENT,null)):r&&(this.bindFramebufferAttachment(t,n.STENCIL_ATTACHMENT,e),this.bindFramebufferAttachment(t,n.DEPTH_ATTACHMENT,null))},e.validateCurrentAttachments=function(){for(var t=-1,e=-1,n=-1,r=0;r<this.currentColorAttachments.length;r++){var i=this.currentColorAttachments[r];null!==i&&(-1===t?(t=i.sampleCount,e=i.width,n=i.height):(T(t===i.sampleCount),T(e===i.width),T(n===i.height)))}null!==this.currentDepthStencilAttachment&&(-1===t?(t=this.currentDepthStencilAttachment.sampleCount,e=this.currentDepthStencilAttachment.width,n=this.currentDepthStencilAttachment.height):(T(t===this.currentDepthStencilAttachment.sampleCount),T(e===this.currentDepthStencilAttachment.width),T(n===this.currentDepthStencilAttachment.height))),this.currentSampleCount=t},e.setRenderPassParametersBegin=function(t){var e=this.gl;if(A(e)?e.bindFramebuffer(w.DRAW_FRAMEBUFFER,this.renderPassDrawFramebuffer):this.inBlitRenderPass||e.bindFramebuffer(w.FRAMEBUFFER,this.renderPassDrawFramebuffer),!this.inBlitRenderPass)for(var n=t;n<this.currentColorAttachments.length;n++){var r=A(e)?w.DRAW_FRAMEBUFFER:w.FRAMEBUFFER,i=A(e)?w.COLOR_ATTACHMENT0:w.COLOR_ATTACHMENT0_WEBGL;e.framebufferRenderbuffer(r,i+n,w.RENDERBUFFER,null),e.framebufferTexture2D(r,i+n,w.TEXTURE_2D,null,0)}this.currentColorAttachments.length=t},e.setRenderPassParametersColor=function(t,e,n){var r=this.gl;this.currentColorAttachments[t]!==e&&(this.currentColorAttachments[t]=e,!A(r)&&0!==t||this.bindFramebufferAttachment(A(r)?w.DRAW_FRAMEBUFFER:w.FRAMEBUFFER,(A(r)?w.COLOR_ATTACHMENT0:w.COLOR_ATTACHMENT0_WEBGL)+t,e),this.resolveColorAttachmentsChanged=!0),this.currentColorResolveTos[t]!==n&&null!==(this.currentColorResolveTos[t]=n)&&(this.resolveColorAttachmentsChanged=!0)},e.setRenderPassParametersDepthStencil=function(t,e){var n=this.gl;this.currentDepthStencilAttachment!==t&&(this.currentDepthStencilAttachment=t,this.inBlitRenderPass||this.bindFramebufferDepthStencilAttachment(A(n)?w.DRAW_FRAMEBUFFER:w.FRAMEBUFFER,this.currentDepthStencilAttachment),this.resolveDepthStencilAttachmentsChanged=!0),this.currentDepthStencilResolveTo!==e&&null!==(this.currentDepthStencilResolveTo=e)&&(this.resolveDepthStencilAttachmentsChanged=!0)},e.setRenderPassParametersClearColor=function(t,e,n,r,i){var o,a=this.gl;null!==this.OES_draw_buffers_indexed?(o=this.currentMegaState.attachmentsState[t])&&o.channelWriteMask!==Cf.AllChannels&&(this.OES_draw_buffers_indexed.colorMaskiOES(t,!0,!0,!0,!0),o.channelWriteMask=Cf.AllChannels):(o=this.currentMegaState.attachmentsState[0])&&o.channelWriteMask!==Cf.AllChannels&&(a.colorMask(!0,!0,!0,!0),o.channelWriteMask=Cf.AllChannels),this.setScissorEnabled(!1),A(a)?a.clearBufferfv(a.COLOR,t,[e,n,r,i]):(a.clearColor(e,n,r,i),a.clear(a.COLOR_BUFFER_BIT))},e.setRenderPassParametersClearDepthStencil=function(t,e){var n=this.gl;"load"!==t&&(T(null!==this.currentDepthStencilAttachment),this.currentMegaState.depthWrite||(n.depthMask(!0),this.currentMegaState.depthWrite=!0),A(n)?n.clearBufferfv(n.DEPTH,0,[t]):(n.clearDepth(t),n.clear(n.DEPTH_BUFFER_BIT))),"load"!==e&&(T(null!==this.currentDepthStencilAttachment),this.currentMegaState.stencilWrite||(n.enable(n.STENCIL_TEST),n.stencilMask(255),this.currentMegaState.stencilWrite=!0),A(n)?n.clearBufferiv(n.STENCIL,0,[e]):(n.clearStencil(e),n.clear(n.STENCIL_BUFFER_BIT)))},e.setBindings=function(t,e,n){var r=this.gl,i=(T(t<this.currentPipeline.bindingLayouts.bindingLayoutTables.length),this.currentPipeline.bindingLayouts.bindingLayoutTables[t]),o=e.uniformBufferBindings,a=e.samplerBindings;T(o.length>=i.numUniformBuffers),T(a.length>=i.numSamplers),T(n.length>=o.length);for(var s=0;s<o.length;s++){var l,u,c,h,d,f=o[s];0!==f.wordCount&&(l=i.firstUniformBuffer+s,u=f.buffer,c=n[s],f=4*f.wordCount,u!==this.currentUniformBuffers[l]||c!==this.currentUniformBufferByteOffsets[l]||f!==this.currentUniformBufferByteSizes[l])&&(h=c%u.pageByteSize,d=u.gl_buffer_pages[c/u.pageByteSize|0],T(h+f<=u.pageByteSize),A(r)&&r.bindBufferRange(r.UNIFORM_BUFFER,l,d,h,f),this.currentUniformBuffers[l]=u,this.currentUniformBufferByteOffsets[l]=c,this.currentUniformBufferByteSizes[l]=f)}for(var p=0;p<i.numSamplers;p++){var g,m,v=a[p],y=i.firstSampler+p,E=i.samplerEntries[p],_=null!==v&&null!==v.sampler?Dm(v.sampler):null,b=null!==v&&null!==v.texture?km(v.texture):null;this.currentSamplers[y]!==_&&(A(r)&&r.bindSampler(y,_),this.currentSamplers[y]=_),this.currentTextures[y]!==b&&(this.setActiveTexture(r.TEXTURE0+y),null!==b?(v.texture.textureIndex=y,g=(_=Hf(v).texture).gl_target,m=_.width,_=_.height,r.bindTexture(g,b),A(r)||null!=(v=v.sampler)&&v.setTextureParameters(g,m,_),this.debugGroupStatisticsTextureBind(),T(E.gl_target===g)):r.bindTexture(E.gl_target,this.getFallbackTexture(E)),this.currentTextures[y]=b)}},e.setViewport=function(t,e,n,r){this.gl.viewport(t,e,n,r)},e.setScissor=function(t,e,n,r){var i=this.gl;this.setScissorEnabled(!0),i.scissor(t,e,n,r)},e.applyAttachmentStateIndexed=function(t,e,n){var r=this.gl,i=this.OES_draw_buffers_indexed,o=(e.channelWriteMask!==n.channelWriteMask&&(i.colorMaskiOES(t,!!(n.channelWriteMask&Cf.Red),!!(n.channelWriteMask&Cf.Green),!!(n.channelWriteMask&Cf.Blue),!!(n.channelWriteMask&Cf.Alpha)),e.channelWriteMask=n.channelWriteMask),e.rgbBlendState.blendMode!==n.rgbBlendState.blendMode||e.alphaBlendState.blendMode!==n.alphaBlendState.blendMode),a=e.rgbBlendState.blendSrcFactor!==n.rgbBlendState.blendSrcFactor||e.alphaBlendState.blendSrcFactor!==n.alphaBlendState.blendSrcFactor||e.rgbBlendState.blendDstFactor!==n.rgbBlendState.blendDstFactor||e.alphaBlendState.blendDstFactor!==n.alphaBlendState.blendDstFactor;(a||o)&&(Um(e.rgbBlendState)&&Um(e.alphaBlendState)?i.enableiOES(t,r.BLEND):Um(n.rgbBlendState)&&Um(n.alphaBlendState)&&i.disableiOES(t,r.BLEND)),o&&(i.blendEquationSeparateiOES(t,n.rgbBlendState.blendMode,n.alphaBlendState.blendMode),e.rgbBlendState.blendMode=n.rgbBlendState.blendMode,e.alphaBlendState.blendMode=n.alphaBlendState.blendMode),a&&(i.blendFuncSeparateiOES(t,n.rgbBlendState.blendSrcFactor,n.rgbBlendState.blendDstFactor,n.alphaBlendState.blendSrcFactor,n.alphaBlendState.blendDstFactor),e.rgbBlendState.blendSrcFactor=n.rgbBlendState.blendSrcFactor,e.alphaBlendState.blendSrcFactor=n.alphaBlendState.blendSrcFactor,e.rgbBlendState.blendDstFactor=n.rgbBlendState.blendDstFactor,e.alphaBlendState.blendDstFactor=n.alphaBlendState.blendDstFactor)},e.applyAttachmentState=function(t,e){var n=this.gl,r=(t.channelWriteMask!==e.channelWriteMask&&(n.colorMask(!!(e.channelWriteMask&Cf.Red),!!(e.channelWriteMask&Cf.Green),!!(e.channelWriteMask&Cf.Blue),!!(e.channelWriteMask&Cf.Alpha)),t.channelWriteMask=e.channelWriteMask),t.rgbBlendState.blendMode!==e.rgbBlendState.blendMode||t.alphaBlendState.blendMode!==e.alphaBlendState.blendMode),i=t.rgbBlendState.blendSrcFactor!==e.rgbBlendState.blendSrcFactor||t.alphaBlendState.blendSrcFactor!==e.alphaBlendState.blendSrcFactor||t.rgbBlendState.blendDstFactor!==e.rgbBlendState.blendDstFactor||t.alphaBlendState.blendDstFactor!==e.alphaBlendState.blendDstFactor;(i||r)&&(Um(t.rgbBlendState)&&Um(t.alphaBlendState)?n.enable(n.BLEND):Um(e.rgbBlendState)&&Um(e.alphaBlendState)&&n.disable(n.BLEND)),r&&(n.blendEquationSeparate(e.rgbBlendState.blendMode,e.alphaBlendState.blendMode),t.rgbBlendState.blendMode=e.rgbBlendState.blendMode,t.alphaBlendState.blendMode=e.alphaBlendState.blendMode),i&&(n.blendFuncSeparate(e.rgbBlendState.blendSrcFactor,e.rgbBlendState.blendDstFactor,e.alphaBlendState.blendSrcFactor,e.alphaBlendState.blendDstFactor),t.rgbBlendState.blendSrcFactor=e.rgbBlendState.blendSrcFactor,t.alphaBlendState.blendSrcFactor=e.alphaBlendState.blendSrcFactor,t.rgbBlendState.blendDstFactor=e.rgbBlendState.blendDstFactor,t.alphaBlendState.blendDstFactor=e.alphaBlendState.blendDstFactor)},e.setMegaState=function(t){var e=this.gl,n=this.currentMegaState;if(null!==this.OES_draw_buffers_indexed)for(var r=0;r<t.attachmentsState.length;r++)this.applyAttachmentStateIndexed(r,n.attachmentsState[0],t.attachmentsState[0]);else T(1===t.attachmentsState.length),this.applyAttachmentState(n.attachmentsState[0],t.attachmentsState[0]);Xf(n.blendConstant,t.blendConstant)||(e.blendColor(t.blendConstant.r,t.blendConstant.g,t.blendConstant.b,t.blendConstant.a),Yf(n.blendConstant,t.blendConstant)),n.depthCompare!==t.depthCompare&&(e.depthFunc(t.depthCompare),n.depthCompare=t.depthCompare),n.depthWrite!==t.depthWrite&&(e.depthMask(t.depthWrite),n.depthWrite=t.depthWrite),n.stencilWrite!==t.stencilWrite&&(e.stencilMask(t.stencilWrite?255:0),n.stencilWrite=t.stencilWrite),n.stencilPassOp!==t.stencilPassOp&&(e.stencilOp(e.KEEP,e.KEEP,t.stencilPassOp),n.stencilPassOp=t.stencilPassOp),n.stencilRef===t.stencilRef&&n.stencilCompare===t.stencilCompare||(n.stencilCompare=t.stencilCompare,this.setStencilRef(t.stencilRef)),n.cullMode!==t.cullMode&&(n.cullMode===vf.None?e.enable(e.CULL_FACE):t.cullMode===vf.None&&e.disable(e.CULL_FACE),t.cullMode===vf.Back?e.cullFace(e.BACK):t.cullMode===vf.Front?e.cullFace(e.FRONT):t.cullMode===vf.FrontAndBack&&e.cullFace(e.FRONT_AND_BACK),n.cullMode=t.cullMode),n.frontFace!==t.frontFace&&(e.frontFace(t.frontFace),n.frontFace=t.frontFace),n.polygonOffset!==t.polygonOffset&&(t.polygonOffset?(e.polygonOffset(1,1),e.enable(e.POLYGON_OFFSET_FILL)):e.disable(e.POLYGON_OFFSET_FILL),n.polygonOffset=t.polygonOffset)},e.validatePipelineFormats=function(t){for(var e=0;e<this.currentColorAttachments.length;e++){var n=this.currentColorAttachments[e];null!==n&&T(n.pixelFormat===t.colorAttachmentFormats[e])}null!==this.currentDepthStencilAttachment&&T(this.currentDepthStencilAttachment.pixelFormat===t.depthStencilAttachmentFormat),-1!==this.currentSampleCount&&T(this.currentSampleCount===t.sampleCount)},e.setPipeline=function(t){this.currentPipeline=t,this.validatePipelineFormats(this.currentPipeline),this.setMegaState(this.currentPipeline.megaState);t=this.currentPipeline.program;if(this.useProgram(t),t.compileState===Wm.NeedsBind){var e=this.gl,n=t.gl_program,r=t.descriptor,i=Fm(r.preprocessedVert,/uniform (\w+) {([^]*?)}/g);if(A(e))for(var o=0;o<i.length;o++){var a=i[o][1],a=e.getUniformBlockIndex(n,a);-1!==a&&4294967295!==a&&e.uniformBlockBinding(n,a,o)}for(var s=Fm(r.preprocessedVert,/^uniform .*sampler\S+ (\w+);\s* \/\/ BINDING=(\d+)$/gm),l=0;l<s.length;l++){var u=s[l],c=u[1],u=u[2],c=e.getUniformLocation(n,c);e.uniform1i(c,parseInt(u))}t.compileState=Wm.ReadyToUse}},e.setInputState=function(t){this.currentInputState=t,null!==this.currentInputState?(T(this.currentPipeline.inputLayout===this.currentInputState.inputLayout),this.bindVAO(this.currentInputState.vao)):(T(null===this.currentPipeline.inputLayout),this.bindVAO(null))},e.setStencilRef=function(t){this.currentStencilRef!==t&&(this.currentStencilRef=t,this.applyStencil())},e.draw=function(t,e){var n=this.gl,r=this.currentPipeline;n.drawArrays(r.drawMode,e,t),this.debugGroupStatisticsDrawCall(),this.debugGroupStatisticsTriangles(t/3)},e.drawIndexed=function(t,e){var n=this.gl,r=this.currentPipeline,i=this.currentInputState,e=Hf(i.indexBufferByteOffset)+e*Hf(i.indexBufferCompByteSize);n.drawElements(r.drawMode,t,Hf(i.indexBufferType),e),this.debugGroupStatisticsDrawCall(),this.debugGroupStatisticsTriangles(t/3)},e.drawIndexedInstanced=function(t,e,n){var r=this.gl,i=this.currentPipeline,o=this.currentInputState,e=Hf(o.indexBufferByteOffset)+e*Hf(o.indexBufferCompByteSize),i=[i.drawMode,t,Hf(o.indexBufferType),e,n];A(r)?r.drawElementsInstanced.apply(r,i):(o=this.ANGLE_instanced_arrays).drawElementsInstancedANGLE.apply(o,i),this.debugGroupStatisticsDrawCall(),this.debugGroupStatisticsTriangles(t/3*n)},e.beginOcclusionQuery=function(t){var e,n=this.gl;A(n)&&(e=this.currentRenderPassDescriptor.occlusionQueryPool,n.beginQuery(e.gl_query_type,e.gl_query[t]))},e.endOcclusionQuery=function(t){var e,n=this.gl;A(n)&&(e=this.currentRenderPassDescriptor.occlusionQueryPool,n.endQuery(e.gl_query_type))},e.beginDebugGroup=function(t){},e.endDebugGroup=function(){},e.pipelineQueryReady=function(t){return this.queryProgramReady(t.program)},e.pipelineForceReady=function(t){},e.endPass=function(){for(var t=this.gl,e=!1,n=0;n<this.currentColorAttachments.length;n++){var r,i,o=this.currentColorAttachments[n];null!==o&&(i=!1,null!==(r=this.currentColorResolveTos[n])&&(T(o.width===r.width&&o.height===r.height),T(o.pixelFormat===r.pixelFormat),this.setScissorEnabled(!1),A(t)&&t.bindFramebuffer(t.READ_FRAMEBUFFER,this.resolveColorReadFramebuffer),this.resolveColorAttachmentsChanged&&A(t)&&this.bindFramebufferAttachment(t.READ_FRAMEBUFFER,t.COLOR_ATTACHMENT0,o),i=!0,r===this.scTexture?t.bindFramebuffer(A(t)?w.DRAW_FRAMEBUFFER:w.FRAMEBUFFER,this.scPlatformFramebuffer):(t.bindFramebuffer(A(t)?w.DRAW_FRAMEBUFFER:w.FRAMEBUFFER,this.resolveColorDrawFramebuffer),this.resolveColorAttachmentsChanged&&t.framebufferTexture2D(A(t)?w.DRAW_FRAMEBUFFER:w.FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,r.gl_texture,0)),A(t)?(t.blitFramebuffer(0,0,o.width,o.height,0,0,r.width,r.height,t.COLOR_BUFFER_BIT,t.LINEAR),t.bindFramebuffer(t.DRAW_FRAMEBUFFER,null)):this.submitBlitRenderPass(o,r),e=!0),this.currentRenderPassDescriptor.colorStore[n]||(i||(t.bindFramebuffer(A(t)?w.READ_FRAMEBUFFER:w.FRAMEBUFFER,this.resolveColorReadFramebuffer),this.resolveColorAttachmentsChanged&&this.bindFramebufferAttachment(A(t)?w.READ_FRAMEBUFFER:w.FRAMEBUFFER,t.COLOR_ATTACHMENT0,o)),A(t)&&t.invalidateFramebuffer(t.READ_FRAMEBUFFER,[t.COLOR_ATTACHMENT0])),t.bindFramebuffer(A(t)?w.READ_FRAMEBUFFER:w.FRAMEBUFFER,null))}this.resolveColorAttachmentsChanged=!1;var a,s,l=this.currentDepthStencilAttachment;null!==l&&(s=!1,null!==(a=this.currentDepthStencilResolveTo)&&(T(l.width===a.width&&l.height===a.height),this.setScissorEnabled(!1),t.bindFramebuffer(A(t)?w.READ_FRAMEBUFFER:w.FRAMEBUFFER,this.resolveDepthStencilReadFramebuffer),t.bindFramebuffer(A(t)?w.DRAW_FRAMEBUFFER:w.FRAMEBUFFER,this.resolveDepthStencilDrawFramebuffer),this.resolveDepthStencilAttachmentsChanged&&(this.bindFramebufferDepthStencilAttachment(A(t)?w.READ_FRAMEBUFFER:w.FRAMEBUFFER,l),this.bindFramebufferDepthStencilAttachment(A(t)?w.DRAW_FRAMEBUFFER:w.FRAMEBUFFER,a)),s=!0,A(t)&&t.blitFramebuffer(0,0,l.width,l.height,0,0,a.width,a.height,t.DEPTH_BUFFER_BIT,t.NEAREST),t.bindFramebuffer(A(t)?w.DRAW_FRAMEBUFFER:w.FRAMEBUFFER,null),e=!0),this.currentRenderPassDescriptor.depthStencilStore||(s||(t.bindFramebuffer(A(t)?w.READ_FRAMEBUFFER:w.FRAMEBUFFER,this.resolveDepthStencilReadFramebuffer),this.resolveDepthStencilAttachmentsChanged&&this.bindFramebufferDepthStencilAttachment(A(t)?w.READ_FRAMEBUFFER:w.FRAMEBUFFER,l),s=!0),A(t)&&t.invalidateFramebuffer(t.READ_FRAMEBUFFER,[t.DEPTH_STENCIL_ATTACHMENT])),s&&t.bindFramebuffer(A(t)?w.READ_FRAMEBUFFER:w.FRAMEBUFFER,null),this.resolveDepthStencilAttachmentsChanged=!1),e||t.bindFramebuffer(A(t)?w.DRAW_FRAMEBUFFER:w.FRAMEBUFFER,null)},e.setScissorEnabled=function(t){var e;this.currentScissorEnabled!==t&&(e=this.gl,t?e.enable(e.SCISSOR_TEST):e.disable(e.SCISSOR_TEST),this.currentScissorEnabled=t)},e.applyStencil=function(){null!==this.currentStencilRef&&this.gl.stencilFunc(this.currentMegaState.stencilCompare,this.currentStencilRef,255)},e.getFallbackTexture=function(t){var e=t.gl_target,t=t.formatKind;if(e===w.TEXTURE_2D)return t===Of.Depth?this.fallbackTexture2DDepth:this.fallbackTexture2D;if(e===w.TEXTURE_2D_ARRAY)return this.fallbackTexture2DArray;if(e===w.TEXTURE_3D)return this.fallbackTexture3D;if(e===w.TEXTURE_CUBE_MAP)return this.fallbackTextureCube;throw new Error("whoops")},e.submitBlitRenderPass=function(t,e){this.blitRenderPipeline||(n=Xg(this,wf.VERTEX|wf.COPY_DST,new Float32Array([-4,-4,4,-4,0,4]).buffer),r=this.createInputLayout({vertexBufferDescriptors:[{byteStride:8,frequency:Af.PerVertex}],vertexAttributeDescriptors:[{format:S.F32_RG,bufferIndex:0,bufferByteOffset:0,location:0}],indexBufferFormat:null}),i=[{numSamplers:1,numUniformBuffers:0}],o=this.createProgram(xm({},Qp(this,new vm),{ensurePreprocessed:function(){},associate:function(){}})),this.blitInputState=this.createInputState(r,[{buffer:n,byteOffset:0}],null,o),this.blitRenderPipeline=this.createRenderPipeline({topology:Sf.Triangles,sampleCount:1,program:o,bindingLayouts:i,colorAttachmentFormats:[S.U8_RGBA_RT],depthStencilAttachmentFormat:null,inputLayout:r,megaStateDescriptor:this.currentMegaState}),this.blitBindings=this.createBindings({bindingLayout:i[0],samplerBindings:[{sampler:null,texture:t.texture,lateBinding:null}],uniformBufferBindings:[]}),o.setUniforms({u_Texture:t}));var n=this.currentRenderPassDescriptor,r=(this.currentRenderPassDescriptor=null,this.inBlitRenderPass=!0,this.createRenderPass({colorAttachment:[t],colorResolveTo:[e],colorClearColor:[$f],colorStore:[!0],depthStencilAttachment:null,depthStencilResolveTo:null,depthStencilStore:!0,depthClearValue:"load",stencilClearValue:"load",occlusionQueryPool:null})),i=this.getCanvas(),o=i.width,t=i.height;r.setPipeline(this.blitRenderPipeline),r.setBindings(0,this.blitBindings,[0]),r.setInputState(this.blitInputState),r.setViewport(0,0,o,t),this.gl.disable(this.gl.BLEND),r.draw(3,0),this.gl.enable(this.gl.BLEND),this.currentRenderPassDescriptor=n,this.inBlitRenderPass=!1},t}(),nv=function(){function t(t){this.pluginOptions=void 0,this.pluginOptions=t}return t.prototype.createSwapChain=function(){var e=bm(Em().mark(function t(e){var n,r,i;return Em().wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return n={antialias:!1,preserveDrawingBuffer:!1,stencil:!0},r=this.pluginOptions.targets,!(i=r.includes("webgl2")?e.getContext("webgl2",n)||e.getContext("experimental-webgl2",n):i)&&r.includes("webgl1")&&(i=e.getContext("webgl",n)||e.getContext("experimental-webgl",n)),t.abrupt("return",new ev(i,{shaderDebug:!0,trackResources:!0}));case 5:case"end":return t.stop()}},t,this)}));return function(t){return e.apply(this,arguments)}}(),t}(),rv=function(n){function t(t){var e=n.call(this)||this;return e.options=void 0,e.name="webgl-device",e.options=t,e}Sm(t,n);var e=t.prototype;return e.init=function(){this.context.deviceContribution=new nv(xm({},this.options))},e.destroy=function(){delete this.context.deviceContribution},t}(Ws);function iv(){iv=function(){return a};var a={},t=Object.prototype,l=t.hasOwnProperty,u=Object.defineProperty||function(t,e,n){t[e]=n.value},e="function"==typeof Symbol?Symbol:{},r=e.iterator||"@@iterator",n=e.asyncIterator||"@@asyncIterator",i=e.toStringTag||"@@toStringTag";function o(t,e,n){return Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{o({},"")}catch(t){o=function(t,e,n){return t[e]=n}}function s(t,e,n,r){var i,o,a,s,e=e&&e.prototype instanceof d?e:d,e=Object.create(e.prototype),r=new b(r||[]);return u(e,"_invoke",{value:(i=t,o=n,a=r,s="suspendedStart",function(t,e){if("executing"===s)throw new Error("Generator is already running");if("completed"===s){if("throw"===t)throw e;return S()}for(a.method=t,a.arg=e;;){var n=a.delegate;if(n){n=function t(e,n){var r=n.method,i=e.iterator[r];if(void 0===i)return n.delegate=null,"throw"===r&&e.iterator.return&&(n.method="return",n.arg=void 0,t(e,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),h;r=c(i,e.iterator,n.arg);if("throw"===r.type)return n.method="throw",n.arg=r.arg,n.delegate=null,h;i=r.arg;return i?i.done?(n[e.resultName]=i.value,n.next=e.nextLoc,"return"!==n.method&&(n.method="next",n.arg=void 0),n.delegate=null,h):i:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,h)}(n,a);if(n){if(n===h)continue;return n}}if("next"===a.method)a.sent=a._sent=a.arg;else if("throw"===a.method){if("suspendedStart"===s)throw s="completed",a.arg;a.dispatchException(a.arg)}else"return"===a.method&&a.abrupt("return",a.arg);s="executing";n=c(i,o,a);if("normal"===n.type){if(s=a.done?"completed":"suspendedYield",n.arg===h)continue;return{value:n.arg,done:a.done}}"throw"===n.type&&(s="completed",a.method="throw",a.arg=n.arg)}})}),e}function c(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(t){return{type:"throw",arg:t}}}a.wrap=s;var h={};function d(){}function f(){}function p(){}var e={},g=(o(e,r,function(){return this}),Object.getPrototypeOf),g=g&&g(g(x([]))),m=(g&&g!==t&&l.call(g,r)&&(e=g),p.prototype=d.prototype=Object.create(e));function v(t){["next","throw","return"].forEach(function(e){o(t,e,function(t){return this._invoke(e,t)})})}function y(a,s){var e;u(this,"_invoke",{value:function(n,r){function t(){return new s(function(t,e){!function e(t,n,r,i){var o,t=c(a[t],a,n);if("throw"!==t.type)return(n=(o=t.arg).value)&&"object"==typeof n&&l.call(n,"__await")?s.resolve(n.__await).then(function(t){e("next",t,r,i)},function(t){e("throw",t,r,i)}):s.resolve(n).then(function(t){o.value=t,r(o)},function(t){return e("throw",t,r,i)});i(t.arg)}(n,r,t,e)})}return e=e?e.then(t,t):t()}})}function E(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function _(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function b(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(E,this),this.reset(!0)}function x(e){if(e){var n,t=e[r];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length))return n=-1,(t=function t(){for(;++n<e.length;)if(l.call(e,n))return t.value=e[n],t.done=!1,t;return t.value=void 0,t.done=!0,t}).next=t}return{next:S}}function S(){return{value:void 0,done:!0}}return u(m,"constructor",{value:f.prototype=p,configurable:!0}),u(p,"constructor",{value:f,configurable:!0}),f.displayName=o(p,i,"GeneratorFunction"),a.isGeneratorFunction=function(t){t="function"==typeof t&&t.constructor;return!!t&&(t===f||"GeneratorFunction"===(t.displayName||t.name))},a.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,p):(t.__proto__=p,o(t,i,"GeneratorFunction")),t.prototype=Object.create(m),t},a.awrap=function(t){return{__await:t}},v(y.prototype),o(y.prototype,n,function(){return this}),a.AsyncIterator=y,a.async=function(t,e,n,r,i){void 0===i&&(i=Promise);var o=new y(s(t,e,n,r),i);return a.isGeneratorFunction(e)?o:o.next().then(function(t){return t.done?t.value:o.next()})},v(m),o(m,i,"Generator"),o(m,r,function(){return this}),o(m,"toString",function(){return"[object Generator]"}),a.keys=function(t){var e,n=Object(t),r=[];for(e in n)r.push(e);return r.reverse(),function t(){for(;r.length;){var e=r.pop();if(e in n)return t.value=e,t.done=!1,t}return t.done=!0,t}},a.values=x,b.prototype={constructor:b,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(_),!t)for(var e in this)"t"===e.charAt(0)&&l.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=void 0)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(n){if(this.done)throw n;var r=this;function t(t,e){return o.type="throw",o.arg=n,r.next=t,e&&(r.method="next",r.arg=void 0),!!e}for(var e=this.tryEntries.length-1;0<=e;--e){var i=this.tryEntries[e],o=i.completion;if("root"===i.tryLoc)return t("end");if(i.tryLoc<=this.prev){var a=l.call(i,"catchLoc"),s=l.call(i,"finallyLoc");if(a&&s){if(this.prev<i.catchLoc)return t(i.catchLoc,!0);if(this.prev<i.finallyLoc)return t(i.finallyLoc)}else if(a){if(this.prev<i.catchLoc)return t(i.catchLoc,!0)}else{if(!s)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return t(i.finallyLoc)}}}},abrupt:function(t,e){for(var n=this.tryEntries.length-1;0<=n;--n){var r=this.tryEntries[n];if(r.tryLoc<=this.prev&&l.call(r,"finallyLoc")&&this.prev<r.finallyLoc){var i=r;break}}var o=(i=i&&("break"===t||"continue"===t)&&i.tryLoc<=e&&e<=i.finallyLoc?null:i)?i.completion:{};return o.type=t,o.arg=e,i?(this.method="next",this.next=i.finallyLoc,h):this.complete(o)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),h},finish:function(t){for(var e=this.tryEntries.length-1;0<=e;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),_(n),h}},catch:function(t){for(var e=this.tryEntries.length-1;0<=e;--e){var n,r,i=this.tryEntries[e];if(i.tryLoc===t)return"throw"===(n=i.completion).type&&(r=n.arg,_(i)),r}throw new Error("illegal catch attempt")},delegateYield:function(t,e,n){return this.delegate={iterator:x(t),resultName:e,nextLoc:n},"next"===this.method&&(this.arg=void 0),h}},a}function ov(t,e,n,r,i,o,a){try{var s=t[o](a),l=s.value}catch(t){return void n(t)}s.done?e(l):Promise.resolve(l).then(r,i)}function av(s){return function(){var t=this,a=arguments;return new Promise(function(e,n){var r=s.apply(t,a);function i(t){ov(r,e,n,i,o,"next",t)}function o(t){ov(r,e,n,i,o,"throw",t)}i(void 0)})}}function sv(t,e){t.prototype=Object.create(e.prototype),lv(t.prototype.constructor=t,e)}function lv(t,e){return(lv=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t})(t,e)}var uv=function(){function t(t){this.$container=void 0,this.$canvas=void 0,this.dpr=void 0,this.canvasConfig=void 0,this.deviceRendererPlugin=void 0,this.canvasConfig=t.config,this.deviceRendererPlugin=t.deviceRendererPlugin}var e=t.prototype;return e.init=function(){var t=av(iv().mark(function t(){var e,n;return iv().wrap(function(t){for(;;)switch(t.prev=t.next){case 0:n=this.canvasConfig,e=n.container,(n=n.canvas)?(this.$canvas=n,e&&n.parentElement!==e&&e.appendChild(n),this.$container=n.parentElement,this.canvasConfig.container=this.$container):e&&(this.$container=Fe(e)?document.getElementById(e):e,this.$container)&&(n=document.createElement("canvas"),this.$container.appendChild(n),this.$container.style.position||(this.$container.style.position="relative"),this.$canvas=n),this.resize(this.canvasConfig.width,this.canvasConfig.height);case 3:case"end":return t.stop()}},t,this)}));return function(){return t.apply(this,arguments)}}(),e.getDomElement=function(){return this.$canvas},e.getContext=function(){return this.deviceRendererPlugin.getDevice().gl},e.getBoundingClientRect=function(){if(this.$canvas.getBoundingClientRect)return this.$canvas.getBoundingClientRect()},e.destroy=function(){this.$container&&this.$canvas&&this.$canvas.parentNode&&this.$container.removeChild(this.$canvas)},e.resize=function(t,e){var n=1<=(n=this.canvasConfig.devicePixelRatio||Ur&&window.devicePixelRatio||1)?Math.ceil(n):1;this.dpr=n,this.$canvas&&(n=this.getDPR(),this.$canvas.width=n*t,this.$canvas.height=n*e,jr(this.$canvas,t,e))},e.getDPR=function(){return this.dpr},e.applyCursorStyle=function(t){this.$container&&this.$container.style&&(this.$container.style.cursor=t)},e.toDataURL=function(){var e=av(iv().mark(function t(e){return iv().wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return void 0===e&&(e={}),t.abrupt("return",this.deviceRendererPlugin.toDataURL(e));case 2:case"end":return t.stop()}},t,this)}));return function(t){return e.apply(this,arguments)}}(),t}(),cv=function(n){function t(t){var e=n.call(this)||this;return e.rendererPlugin=void 0,e.name="webgl-context-register",e.rendererPlugin=t,e}sv(t,n);var e=t.prototype;return e.init=function(){this.context.ContextService=uv,this.context.deviceRendererPlugin=this.rendererPlugin},e.destroy=function(){delete this.context.ContextService},t}(Ws),hv=function(r){function t(t){var e=r.call(this,t)||this,n=new ym;return e.registerPlugin(new cv(n)),e.registerPlugin(new Th),e.registerPlugin(new rv(null!=t&&t.targets?{targets:t.targets}:{targets:["webgl2","webgl1"]})),e.registerPlugin(n),e.registerPlugin(new hh),e.registerPlugin(new vh),e}return sv(t,r),t}(Gs);function dv(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,function(t){t=function(t,e){if("object"!=typeof t||null===t)return t;var n=t[Symbol.toPrimitive];if(void 0===n)return("string"===e?String:Number)(t);n=n.call(t,e||"default");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}(t,"string");return"symbol"==typeof t?t:String(t)}(r.key),r)}}function fv(t,e,n){e&&dv(t.prototype,e),n&&dv(t,n),Object.defineProperty(t,"prototype",{writable:!1})}function pv(){return(pv=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n,r=arguments[e];for(n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t}).apply(this,arguments)}function gv(t,e){t.prototype=Object.create(e.prototype),mv(t.prototype.constructor=t,e)}function mv(t,e){return(mv=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t})(t,e)}function vv(t,e){if(null==t)return{};for(var n,r={},i=Object.keys(t),o=0;o<i.length;o++)n=i[o],0<=e.indexOf(n)||(r[n]=t[n]);return r}var yv,Ev,ks=function(n){function t(t,e){return(t=n.call(this,t,e=void 0===e?{}:e)||this).topology=void 0,t.flipYMatrix=dt(K(),x(1,-1,1)),t.topology=t.createTopology(),t}gv(t,n);var e=t.prototype;return e.applyMa4Position=function(t,e){for(var n=Vt(),r=0;r<e.byteLength/4;r+=3)n[0]=e[r],n[1]=e[r+1],n[2]=e[r+2],n[3]=1,jt(n,n,t),e[r]=n[0],e[r+1]=n[1],e[r+2]=n[2];this.updateVertexBuffer(Qg.POSITION,Jg.POSITION,0,new Uint8Array(e.buffer))},e.applyMa4Normal=function(t,e){var n=Vt(),r=$(K(),t);et(r,r),tt(r,r);for(var i=0;i<e.byteLength/4;i+=3)n[0]=e[i],n[1]=e[i+1],n[2]=e[i+2],n[3]=1,jt(n,n,r),e[i]=n[0],e[i+1]=n[1],e[i+2]=n[2];this.updateVertexBuffer(Qg.NORMAL,Jg.NORMAL,0,new Uint8Array(e.buffer))},e.rebuildPosition=function(){this.topology=this.createTopology();var t=Float32Array.from(this.topology.positions);this.applyMa4Position(this.flipYMatrix,t),this.dirty=!0},e.applyMat4=function(t){this.applyMa4Position(t,this.vertices[Qg.POSITION]),this.applyMa4Normal(t,this.vertices[Qg.NORMAL])},e.computeBoundingBox=function(){for(var t=this.topology.positions,e=-1/0,n=-1/0,r=-1/0,i=1/0,o=1/0,a=1/0,s=0;s<t.length;s+=3)var l=t[s],u=t[s+1],c=t[s+2],e=Math.max(e,l),n=Math.max(n,u),r=Math.max(r,c),i=Math.min(i,l),o=Math.min(o,u),a=Math.min(a,c);var h=new Ta;return h.setMinMax([i,o,a],[e,n,r]),h},e.build=function(){var t=this.topology,e=t.indices,n=t.positions,r=t.normals,t=t.uvs;this.setIndexBuffer(new Uint32Array(e)),this.vertexCount=e.length,this.setVertexBuffer({bufferIndex:Qg.POSITION,byteStride:12,frequency:Af.PerVertex,attributes:[{format:S.F32_RGB,bufferByteOffset:0,location:Jg.POSITION}],data:Float32Array.from(n)}),this.setVertexBuffer({bufferIndex:Qg.NORMAL,byteStride:12,frequency:Af.PerVertex,attributes:[{format:S.F32_RGB,bufferByteOffset:0,location:Jg.NORMAL}],data:Float32Array.from(r)}),this.setVertexBuffer({bufferIndex:Qg.UV,byteStride:8,frequency:Af.PerVertex,attributes:[{format:S.F32_RG,bufferByteOffset:0,location:Jg.UV}],data:Float32Array.from(t)}),this.applyMat4(this.flipYMatrix),this.dirty=!0},t}(Kg),E=function(n){function t(t,e){return n.call(this,t,pv({width:1,height:1,depth:1,widthSegments:1,heightSegments:1,depthSegments:1},e=void 0===e?{}:e))||this}return gv(t,n),t.prototype.createTopology=function(){function t(t,e,n){for(var r,i=0;i<=e;i++)for(r=0;r<=n;r++){var o=y(),a=y(),s=y(),l=y();Dt(o,u[c[t][0]],u[c[t][1]],i/e),Dt(a,u[c[t][0]],u[c[t][2]],r/n),Ut(s,a,u[c[t][0]]),Ct(l,o,s),a=i/e,o=r/n,d.push(l[0],l[1],l[2]),f.push(h[t][0],h[t][1],h[t][2]),p.push(a,1-o),a=.875*(a/=3)+4/64,o=.875*(o/=3)+4/64,a+=t%3/3,o+=Math.floor(t/3)/3,g.push(a,1-o),i<e&&r<n&&(m.push(v+n+1,v+1,v),m.push(v+n+1,v+n+2,v+1)),v++}}var e=this.props,n=e.widthSegments,r=e.heightSegments,i=e.depthSegments,o=e.height,a=e.width,e=e.depth,n=void 0===n?1:n,r=void 0===r?1:r,i=void 0===i?1:i,a=(void 0===a?1:a)/2,o=(void 0===o?1:o)/2,e=(void 0===e?1:e)/2,u=[x(-a,-o,e),x(a,-o,e),x(a,o,e),x(-a,o,e),x(a,-o,-e),x(-a,-o,-e),x(-a,o,-e),x(a,o,-e)],c=[[0,1,3],[4,5,7],[3,2,6],[1,0,4],[1,4,2],[5,0,6]],h=[[0,0,1],[0,0,-1],[0,1,0],[0,-1,0],[1,0,0],[-1,0,0]],a=1,o=2,e=3,s=4,l=5,d=[],f=[],p=[],g=[],m=[],v=0;return t(0,n,r),t(a,n,r),t(o,n,i),t(e,n,i),t(s,i,r),t(l,i,r),{indices:m,positions:d,normals:f,uvs:p,uv1s:g}},fv(t,[{key:"width",get:function(){return this.props.width},set:function(t){this.props.width!==t&&(this.props.width=t,this.rebuildPosition())}},{key:"height",get:function(){return this.props.height},set:function(t){this.props.height!==t&&(this.props.height=t,this.rebuildPosition())}},{key:"depth",get:function(){return this.props.depth},set:function(t){this.props.depth!==t&&(this.props.depth=t,this.rebuildPosition())}},{key:"widthSegments",get:function(){return this.props.widthSegments},set:function(t){this.props.widthSegments!==t&&(this.props.widthSegments=t,this.build())}},{key:"heightSegments",get:function(){return this.props.heightSegments},set:function(t){this.props.heightSegments!==t&&(this.props.heightSegments=t,this.build())}},{key:"depthSegments",get:function(){return this.props.depthSegments},set:function(t){this.props.depthSegments!==t&&(this.props.depthSegments=t,this.build())}}]),t}(ks),i=function(n){function t(t,e){return n.call(this,t,pv({radius:.5,latitudeBands:16,longitudeBands:16},e=void 0===e?{}:e))||this}return gv(t,n),t.prototype.createTopology=function(){for(var t,e,n,r,i,o,a,s,l,u,c,h=this.props,d=h.radius,f=void 0===d?.5:d,d=h.latitudeBands,p=void 0===d?16:d,d=h.longitudeBands,g=void 0===d?16:d,m=[],v=[],y=[],E=[],_=0;_<=p;_++)for(e=_*Math.PI/p,n=Math.sin(e),r=Math.cos(e),t=0;t<=g;t++)a=2*t*Math.PI/g-Math.PI/2,l=Math.sin(a),a=Math.cos(a),u=1-t/g,c=1-_/p,m.push((a=a*n)*f,(s=r)*f,(l=l*n)*f),v.push(a,s,l),y.push(u,1-c);for(_=0;_<p;++_)for(t=0;t<g;++t)E.push((i=_*(g+1)+t)+1,o=i+g+1,i),E.push(i+1,o+1,o);return{indices:E,positions:m,normals:v,uvs:y,uv1s:y}},fv(t,[{key:"radius",get:function(){return this.props.radius},set:function(t){this.props.radius!==t&&(this.props.radius=t,this.build())}},{key:"latitudeBands",get:function(){return this.props.latitudeBands},set:function(t){this.props.latitudeBands!==t&&(this.props.latitudeBands=t,this.build())}},{key:"longitudeBands",get:function(){return this.props.longitudeBands},set:function(t){this.props.longitudeBands!==t&&(this.props.longitudeBands=t,this.build())}}]),t}(ks),n=function(n){function t(t,e){return n.call(this,t,pv({width:1,depth:1,widthSegments:5,depthSegments:5},e=void 0===e?{}:e))||this}return gv(t,n),t.prototype.createTopology=function(){for(var t,e,n,r=[],i=[],o=[],a=[],s=this.props,l=s.widthSegments,u=s.depthSegments,c=s.width,s=s.depth,h=(void 0===c?1:c)/2,d=(void 0===s?1:s)/2,f=void 0===l?5:l,p=void 0===u?5:u,g=0,m=0;m<=f;m++)for(t=0;t<=p;t++)e=m/f,n=t/p,r.push(2*h*m/f-h,0,-(2*d*t/p-d)),i.push(0,1,0),o.push(e,1-n),m<f&&t<p&&(a.push(g+p+1,g+1,g),a.push(g+p+1,g+p+2,g+1)),g++;return{indices:a,positions:r,normals:i,uvs:o,uv1s:o}},fv(t,[{key:"width",get:function(){return this.props.width},set:function(t){this.props.width!==t&&(this.props.width=t,this.rebuildPosition())}},{key:"depth",get:function(){return this.props.depth},set:function(t){this.props.depth!==t&&(this.props.depth=t,this.rebuildPosition())}},{key:"widthSegments",get:function(){return this.props.widthSegments},set:function(t){this.props.widthSegments!==t&&(this.props.widthSegments=t,this.build())}},{key:"depthSegments",get:function(){return this.props.depthSegments},set:function(t){this.props.depthSegments!==t&&(this.props.depthSegments=t,this.build())}}]),t}(ks),_v=["style"],bv=function(n){function t(t){var t=void 0===t?{}:t,e=t.style,t=vv(t,_v),e=n.call(this,pv({style:pv({fill:"black"},e)},t))||this;return e.define="NUM_AMBIENT_LIGHTS",e.order=-1,e}return gv(t,n),t.prototype.uploadUBO=function(t,e){var n=this.parsedStyle.fill;To(n)&&(n=[Number(n.r)/255,Number(n.g)/255,Number(n.b)/255],t.push({name:"u_AmbientLightColor",value:n}))},t}(Ug),xv=["style"],Sv=function(n){function t(t){var t=void 0===t?{}:t,e=t.style,t=vv(t,xv),e=n.call(this,pv({style:pv({direction:x(0,-1,0)},e)},t))||this;return e.define="NUM_DIR_LIGHTS",e.order=10,e}gv(t,n);var e=t.prototype;return e.getUniformWordCount=function(){return 8},e.uploadUBO=function(t,e){var n=this.parsedStyle,r=n.fill,i=n.direction,n=n.intensity;To(r)&&(r=[Number(r.r)/255,Number(r.g)/255,Number(r.b)/255],t.push({name:"directionalLights["+e+"].direction",value:i}),t.push({name:"directionalLights["+e+"].intensity",value:n}),t.push({name:"directionalLights["+e+"].color",value:r}))},t}(Ug),wv=((mT=yv=yv||{}).MAP="u_Map",mT.PLACE_HOLDER="u_Placeholder",function(r){function t(t,e){var t=r.call(this,t,pv({vertexShader:"#define GLSLIFY 1\nlayout(std140) uniform ub_SceneParams {\n mat4 u_ProjectionMatrix;\n mat4 u_ViewMatrix;\n vec3 u_CameraPosition;\n float u_DevicePixelRatio;\n vec2 u_Viewport;\n float u_IsOrtho;\n float u_IsPicking;\n};\nlayout(std140) uniform ub_MaterialParams {\n #ifdef USE_WIREFRAME\n vec3 u_WireframeLineColor;\n float u_WireframeLineWidth;\n #endif\n\n #ifdef USE_FOG\n vec4 u_FogInfos;\n vec3 u_FogColor;\n #endif\n\n vec4 u_Placeholder;\n};\n\nlayout(location = MODEL_MATRIX0) in vec4 a_ModelMatrix0;\nlayout(location = MODEL_MATRIX1) in vec4 a_ModelMatrix1;\nlayout(location = MODEL_MATRIX2) in vec4 a_ModelMatrix2;\nlayout(location = MODEL_MATRIX3) in vec4 a_ModelMatrix3;\nlayout(location = COLOR) in vec4 a_Color;\nlayout(location = STROKE_COLOR) in vec4 a_StrokeColor;\nlayout(location = PACKED_STYLE1) in vec4 a_StylePacked1;\nlayout(location = PACKED_STYLE2) in vec4 a_StylePacked2;\nlayout(location = PICKING_COLOR) in vec4 a_PickingColor;\n\nout vec4 v_PickingResult;\nout vec4 v_Color;\nout vec4 v_StrokeColor;\nout vec4 v_StylePacked1;\nout vec4 v_StylePacked2;\n\n#define COLOR_SCALE 1. / 255.\nvoid setPickingColor(vec3 pickingColor) {\n v_PickingResult.rgb = pickingColor * COLOR_SCALE;\n}\nvec4 project(vec4 pos, mat4 pm, mat4 vm, mat4 mm) {\n return pm * vm * mm * pos;\n}\n\nlayout(location = POSITION) in vec3 a_Position;\n\n#ifdef USE_UV\n layout(location = UV) in vec2 a_Uv;\n out vec2 v_Uv;\n#endif\n\n#ifdef USE_WIREFRAME\n layout(location = BARYCENTRIC) in vec3 a_Barycentric;\n out vec3 v_Barycentric;\n#endif\n\nvoid main() {\n mat4 u_ModelMatrix = mat4(a_ModelMatrix0, a_ModelMatrix1, a_ModelMatrix2, a_ModelMatrix3);\nvec4 u_StrokeColor = a_StrokeColor;\nfloat u_Opacity = a_StylePacked1.x;\nfloat u_FillOpacity = a_StylePacked1.y;\nfloat u_StrokeOpacity = a_StylePacked1.z;\nfloat u_StrokeWidth = a_StylePacked1.w;\nfloat u_ZIndex = a_PickingColor.w;\nvec2 u_Anchor = a_StylePacked2.yz;\nfloat u_IncreasedLineWidthForHitTesting = a_StylePacked2.w;\n\nsetPickingColor(a_PickingColor.xyz);\n\nv_Color = a_Color;\nv_StrokeColor = a_StrokeColor;\nv_StylePacked1 = a_StylePacked1;\nv_StylePacked2 = a_StylePacked2;\n\n#ifdef CLIPSPACE_NEAR_ZERO\n gl_Position.z = gl_Position.z * 0.5 + 0.5;\n#endif\n\n gl_Position = project(vec4(a_Position, 1.0), u_ProjectionMatrix, u_ViewMatrix, u_ModelMatrix);\n\n #ifdef USE_UV\n v_Uv = a_Uv;\n #ifdef VIEWPORT_ORIGIN_TL\n v_Uv.y = 1.0 - v_Uv.y;\n #endif\n#endif\n\n #ifdef USE_WIREFRAME\n v_Barycentric = a_Barycentric;\n#endif\n\n}",fragmentShader:"#define GLSLIFY 1\n#define PI 3.141592653589793\n#define PI2 6.283185307179586\n#define PI_HALF 1.5707963267948966\n#define RECIPROCAL_PI 0.3183098861837907\n#define RECIPROCAL_PI2 0.15915494309189535\n#define EPSILON 1e-6\n\n#ifndef saturate\n #define saturate( a ) clamp( a, 0.0, 1.0 )\n#endif\n#define whiteComplement( a ) ( 1.0 - saturate( a ) )\n\nfloat pow2( const in float x ) { return x*x; }\nfloat pow3( const in float x ) { return x*x*x; }\nfloat pow4( const in float x ) { float x2 = x*x; return x2*x2; }\nfloat max3( const in vec3 v ) { return max( max( v.x, v.y ), v.z ); }\nfloat average( const in vec3 color ) { return dot( color, vec3( 0.3333 ) ); }\n\n// expects values in the range of [0,1]x[0,1], returns values in the [0,1] range.\n// do not collapse into a single function per: http://byteblacksmith.com/improvements-to-the-canonical-one-liner-glsl-rand-for-opengl-es-2-0/\nhighp float rand( const in vec2 uv ) {\n const highp float a = 12.9898, b = 78.233, c = 43758.5453;\n highp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI );\n\n return fract( sin( sn ) * c );\n}\n\nmat3 transposeMat3(mat3 inMatrix) {\n vec3 i0 = inMatrix[0];\n vec3 i1 = inMatrix[1];\n vec3 i2 = inMatrix[2];\n\n mat3 outMatrix = mat3(\n vec3(i0.x, i1.x, i2.x),\n vec3(i0.y, i1.y, i2.y),\n vec3(i0.z, i1.z, i2.z)\n );\n\n return outMatrix;\n}\n\n// https://github.com/glslify/glsl-inverse/blob/master/index.glsl\nmat3 inverseMat3(mat3 inMatrix) {\n float a00 = inMatrix[0][0], a01 = inMatrix[0][1], a02 = inMatrix[0][2];\n float a10 = inMatrix[1][0], a11 = inMatrix[1][1], a12 = inMatrix[1][2];\n float a20 = inMatrix[2][0], a21 = inMatrix[2][1], a22 = inMatrix[2][2];\n\n float b01 = a22 * a11 - a12 * a21;\n float b11 = -a22 * a10 + a12 * a20;\n float b21 = a21 * a10 - a11 * a20;\n\n float det = a00 * b01 + a01 * b11 + a02 * b21;\n\n return mat3(b01, (-a22 * a01 + a02 * a21), (a12 * a01 - a02 * a11),\n b11, (a22 * a00 - a02 * a20), (-a12 * a00 + a02 * a10),\n b21, (-a21 * a00 + a01 * a20), (a11 * a00 - a01 * a10)) / det;\n}\n\nstruct DirectionalLight {\n vec3 direction;\n float intensity;\n vec3 color;\n};\n\nstruct IncidentLight {\n vec3 color;\n vec3 direction;\n bool visible;\n};\n\nstruct ReflectedLight {\n vec3 directDiffuse;\n vec3 directSpecular;\n vec3 indirectDiffuse;\n vec3 indirectSpecular;\n};\n\nstruct GeometricContext {\n vec3 position;\n vec3 normal;\n vec3 viewDir;\n};\nlayout(std140) uniform ub_SceneParams {\n mat4 u_ProjectionMatrix;\n mat4 u_ViewMatrix;\n vec3 u_CameraPosition;\n float u_DevicePixelRatio;\n vec2 u_Viewport;\n float u_IsOrtho;\n float u_IsPicking;\n};\nlayout(std140) uniform ub_MaterialParams {\n #ifdef USE_WIREFRAME\n vec3 u_WireframeLineColor;\n float u_WireframeLineWidth;\n #endif\n\n #ifdef USE_FOG\n vec4 u_FogInfos;\n vec3 u_FogColor;\n #endif\n\n vec4 u_Placeholder;\n};\n\nin vec4 v_PickingResult;\nin vec4 v_Color;\nin vec4 v_StrokeColor;\nin vec4 v_StylePacked1;\nin vec4 v_StylePacked2;\n#ifdef USE_UV\n in vec2 v_Uv;\n#endif\n#ifdef USE_MAP\n uniform sampler2D u_Map;\n#endif\n#ifdef USE_WIREFRAME\n in vec3 v_Barycentric;\n\n float edgeFactor() {\n vec3 d = fwidth(v_Barycentric);\n vec3 a3 = smoothstep(vec3(0.0), d * u_WireframeLineWidth, v_Barycentric);\n return min(min(a3.x, a3.y), a3.z);\n }\n#endif\n\n#ifdef USE_FOG\n #define FOGMODE_NONE 0.\n #define FOGMODE_EXP 1.\n #define FOGMODE_EXP2 2.\n #define FOGMODE_LINEAR 3.\n\n // in float v_FogDepth;\n\n float dBlendModeFogFactor = 1.0;\n\n vec3 addFog(vec3 color) {\n float depth = gl_FragCoord.z / gl_FragCoord.w;\n // float depth = v_FogDepth;\n float fogFactor;\n float fogStart = u_FogInfos.y;\n float fogEnd = u_FogInfos.z;\n float fogDensity = u_FogInfos.w;\n\n if (u_FogInfos.x == FOGMODE_NONE) {\n fogFactor = 1.0;\n } else if (u_FogInfos.x == FOGMODE_EXP) {\n fogFactor = exp(-depth * fogDensity);\n } else if (u_FogInfos.x == FOGMODE_EXP2) {\n fogFactor = exp(-depth * depth * fogDensity * fogDensity);\n } else if (u_FogInfos.x == FOGMODE_LINEAR) {\n fogFactor = (fogEnd - depth) / (fogEnd - fogStart);\n }\n\n fogFactor = clamp(fogFactor, 0.0, 1.0);\n return mix(u_FogColor * dBlendModeFogFactor, color, fogFactor);\n }\n#endif\n\nout vec4 outputColor;\n\nvoid main() {\n vec4 u_Color = v_Color;\nvec4 u_StrokeColor = v_StrokeColor;\nfloat u_Opacity = v_StylePacked1.x;\nfloat u_FillOpacity = v_StylePacked1.y;\nfloat u_StrokeOpacity = v_StylePacked1.z;\nfloat u_StrokeWidth = v_StylePacked1.w;\nfloat u_Visible = v_StylePacked2.x;\nvec3 u_PickingColor = v_PickingResult.xyz;\n\nif (u_Visible < 0.5) {\n discard;\n}\n #ifdef USE_MAP\n #ifdef USE_PATTERN\n vec4 texelColor = texture(SAMPLER_2D(u_Map), v_Uv);\n u_Color = texelColor;\n #else\n vec4 texelColor = texture(SAMPLER_2D(u_Map), v_Uv);\n u_Color = texelColor;\n #endif\n#endif\n\n if (u_IsPicking > 0.5) {\n if (u_PickingColor.x == 0.0 && u_PickingColor.y == 0.0 && u_PickingColor.z == 0.0) {\n discard;\n }\n outputColor = vec4(u_PickingColor, 1.0);\n } else {\n outputColor = u_Color;\n outputColor.a = outputColor.a * u_Opacity;\n vec4 diffuseColor = outputColor;\n\n ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n reflectedLight.indirectDiffuse += vec3( 1.0 );\n reflectedLight.indirectDiffuse *= outputColor.rgb;\n\n vec3 outgoingLight = reflectedLight.indirectDiffuse;\n \n outputColor = vec4(outgoingLight, diffuseColor.a);\n\n #ifdef USE_WIREFRAME\n vec3 color = mix(outputColor.xyz, u_WireframeLineColor, (1.0 - edgeFactor()));\n outputColor.xyz = color;\n#endif\n #ifdef USE_FOG\n outputColor.rgb = addFog(outputColor.rgb);\n#endif\n }\n}",cullMode:vf.Back},e))||this,e=(t.defines=pv({},t.defines,{USE_UV:!0,USE_MAP:!1,USE_WIREFRAME:!1,USE_FOG:!1,USE_LIGHT:!1}),e||{}),n=e.map,e=e.wireframe;return n&&(t.map=n),t.wireframe=e,t.setUniforms(((n={})[yv.PLACE_HOLDER]=[0,0,0,0],n)),t}return gv(t,r),fv(t,[{key:"map",get:function(){return this.props.map},set:function(t){var e;this.props.map!==t&&(this.props.map=t,this.programDirty=!0),this.setUniforms(((e={})[yv.MAP]=t,e))}},{key:"aoMap",get:function(){return this.props.aoMap},set:function(t){this.props.aoMap=t}}]),t}(Ca)),Tv=((ya=Ev=Ev||{}).EMISSIVE="u_Emissive",ya.SHININESS="u_Shininess",ya.SPECULAR="u_Specular",ya.BUMP_SCALE="u_BumpScale",ya.SPECULAR_MAP="u_SpecularMap",ya.BUMP_MAP="u_BumpMap",function(l){function t(t,e){var n,t=l.call(this,t,pv({vertexShader:"#define GLSLIFY 1\n#define PI 3.141592653589793\n#define PI2 6.283185307179586\n#define PI_HALF 1.5707963267948966\n#define RECIPROCAL_PI 0.3183098861837907\n#define RECIPROCAL_PI2 0.15915494309189535\n#define EPSILON 1e-6\n\n#ifndef saturate\n #define saturate( a ) clamp( a, 0.0, 1.0 )\n#endif\n#define whiteComplement( a ) ( 1.0 - saturate( a ) )\n\nfloat pow2( const in float x ) { return x*x; }\nfloat pow3( const in float x ) { return x*x*x; }\nfloat pow4( const in float x ) { float x2 = x*x; return x2*x2; }\nfloat max3( const in vec3 v ) { return max( max( v.x, v.y ), v.z ); }\nfloat average( const in vec3 color ) { return dot( color, vec3( 0.3333 ) ); }\n\n// expects values in the range of [0,1]x[0,1], returns values in the [0,1] range.\n// do not collapse into a single function per: http://byteblacksmith.com/improvements-to-the-canonical-one-liner-glsl-rand-for-opengl-es-2-0/\nhighp float rand( const in vec2 uv ) {\n const highp float a = 12.9898, b = 78.233, c = 43758.5453;\n highp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI );\n\n return fract( sin( sn ) * c );\n}\n\nmat3 transposeMat3(mat3 inMatrix) {\n vec3 i0 = inMatrix[0];\n vec3 i1 = inMatrix[1];\n vec3 i2 = inMatrix[2];\n\n mat3 outMatrix = mat3(\n vec3(i0.x, i1.x, i2.x),\n vec3(i0.y, i1.y, i2.y),\n vec3(i0.z, i1.z, i2.z)\n );\n\n return outMatrix;\n}\n\n// https://github.com/glslify/glsl-inverse/blob/master/index.glsl\nmat3 inverseMat3(mat3 inMatrix) {\n float a00 = inMatrix[0][0], a01 = inMatrix[0][1], a02 = inMatrix[0][2];\n float a10 = inMatrix[1][0], a11 = inMatrix[1][1], a12 = inMatrix[1][2];\n float a20 = inMatrix[2][0], a21 = inMatrix[2][1], a22 = inMatrix[2][2];\n\n float b01 = a22 * a11 - a12 * a21;\n float b11 = -a22 * a10 + a12 * a20;\n float b21 = a21 * a10 - a11 * a20;\n\n float det = a00 * b01 + a01 * b11 + a02 * b21;\n\n return mat3(b01, (-a22 * a01 + a02 * a21), (a12 * a01 - a02 * a11),\n b11, (a22 * a00 - a02 * a20), (-a12 * a00 + a02 * a10),\n b21, (-a21 * a00 + a01 * a20), (a11 * a00 - a01 * a10)) / det;\n}\n\nstruct DirectionalLight {\n vec3 direction;\n float intensity;\n vec3 color;\n};\n\nstruct IncidentLight {\n vec3 color;\n vec3 direction;\n bool visible;\n};\n\nstruct ReflectedLight {\n vec3 directDiffuse;\n vec3 directSpecular;\n vec3 indirectDiffuse;\n vec3 indirectSpecular;\n};\n\nstruct GeometricContext {\n vec3 position;\n vec3 normal;\n vec3 viewDir;\n};\nlayout(std140) uniform ub_SceneParams {\n mat4 u_ProjectionMatrix;\n mat4 u_ViewMatrix;\n vec3 u_CameraPosition;\n float u_DevicePixelRatio;\n vec2 u_Viewport;\n float u_IsOrtho;\n float u_IsPicking;\n};\nlayout(std140) uniform ub_MaterialParams {\n #ifdef USE_WIREFRAME\n vec3 u_WireframeLineColor;\n float u_WireframeLineWidth;\n #endif\n\n #ifdef USE_FOG\n vec4 u_FogInfos;\n vec3 u_FogColor;\n #endif\n\n vec3 u_Emissive;\n float u_Shininess;\n vec3 u_Specular;\n\n #ifdef USE_LIGHT\n #ifdef USE_BUMPMAP\n float u_BumpScale;\n #endif\n\n #ifdef NUM_AMBIENT_LIGHTS\n vec3 u_AmbientLightColor;\n #endif\n\n #ifdef NUM_DIR_LIGHTS\n DirectionalLight directionalLights[ NUM_DIR_LIGHTS ];\n #endif\n #endif\n};\n#ifdef USE_LIGHT\n void getDirectionalLightInfo(\n const in DirectionalLight directionalLight, \n const in GeometricContext geometry,\n out IncidentLight light\n ) {\n light.color = directionalLight.color * directionalLight.intensity;\n light.direction = normalize(directionalLight.direction);\n light.visible = true;\n }\n#endif\n\nlayout(location = MODEL_MATRIX0) in vec4 a_ModelMatrix0;\nlayout(location = MODEL_MATRIX1) in vec4 a_ModelMatrix1;\nlayout(location = MODEL_MATRIX2) in vec4 a_ModelMatrix2;\nlayout(location = MODEL_MATRIX3) in vec4 a_ModelMatrix3;\nlayout(location = COLOR) in vec4 a_Color;\nlayout(location = STROKE_COLOR) in vec4 a_StrokeColor;\nlayout(location = PACKED_STYLE1) in vec4 a_StylePacked1;\nlayout(location = PACKED_STYLE2) in vec4 a_StylePacked2;\nlayout(location = PICKING_COLOR) in vec4 a_PickingColor;\n\nout vec4 v_PickingResult;\nout vec4 v_Color;\nout vec4 v_StrokeColor;\nout vec4 v_StylePacked1;\nout vec4 v_StylePacked2;\n\n#define COLOR_SCALE 1. / 255.\nvoid setPickingColor(vec3 pickingColor) {\n v_PickingResult.rgb = pickingColor * COLOR_SCALE;\n}\nvec4 project(vec4 pos, mat4 pm, mat4 vm, mat4 mm) {\n return pm * vm * mm * pos;\n}\n\nlayout(location = POSITION) in vec3 a_Position;\nlayout(location = NORMAL) in vec3 a_Normal;\n\n#ifdef USE_UV\n layout(location = UV) in vec2 a_Uv;\n out vec2 v_Uv;\n#endif\n\n#ifdef USE_WIREFRAME\n layout(location = BARYCENTRIC) in vec3 a_Barycentric;\n out vec3 v_Barycentric;\n#endif\n\nout vec3 v_ViewPosition;\nout vec3 v_Normal;\n\nvoid main() {\n mat4 u_ModelMatrix = mat4(a_ModelMatrix0, a_ModelMatrix1, a_ModelMatrix2, a_ModelMatrix3);\nvec4 u_StrokeColor = a_StrokeColor;\nfloat u_Opacity = a_StylePacked1.x;\nfloat u_FillOpacity = a_StylePacked1.y;\nfloat u_StrokeOpacity = a_StylePacked1.z;\nfloat u_StrokeWidth = a_StylePacked1.w;\nfloat u_ZIndex = a_PickingColor.w;\nvec2 u_Anchor = a_StylePacked2.yz;\nfloat u_IncreasedLineWidthForHitTesting = a_StylePacked2.w;\n\nsetPickingColor(a_PickingColor.xyz);\n\nv_Color = a_Color;\nv_StrokeColor = a_StrokeColor;\nv_StylePacked1 = a_StylePacked1;\nv_StylePacked2 = a_StylePacked2;\n\n#ifdef CLIPSPACE_NEAR_ZERO\n gl_Position.z = gl_Position.z * 0.5 + 0.5;\n#endif\n\n vec4 position = vec4(a_Position, 1.0);\n\n gl_Position = project(position, u_ProjectionMatrix, u_ViewMatrix, u_ModelMatrix);\n\n vec4 mvPosition = u_ViewMatrix * u_ModelMatrix * position;\n v_ViewPosition = - mvPosition.xyz;\n\n // v_ViewPosition = vec3(mvPosition) / mvPosition.w;\n\n mat3 normalWorld = mat3(transposeMat3(inverseMat3(mat3(u_ViewMatrix * u_ModelMatrix))));\n v_Normal = normalize(normalWorld * a_Normal);\n\n #ifdef USE_UV\n v_Uv = a_Uv;\n #ifdef VIEWPORT_ORIGIN_TL\n v_Uv.y = 1.0 - v_Uv.y;\n #endif\n#endif\n\n #ifdef USE_WIREFRAME\n v_Barycentric = a_Barycentric;\n#endif\n\n}",fragmentShader:"#define GLSLIFY 1\n#define PI 3.141592653589793\n#define PI2 6.283185307179586\n#define PI_HALF 1.5707963267948966\n#define RECIPROCAL_PI 0.3183098861837907\n#define RECIPROCAL_PI2 0.15915494309189535\n#define EPSILON 1e-6\n\n#ifndef saturate\n #define saturate( a ) clamp( a, 0.0, 1.0 )\n#endif\n#define whiteComplement( a ) ( 1.0 - saturate( a ) )\n\nfloat pow2( const in float x ) { return x*x; }\nfloat pow3( const in float x ) { return x*x*x; }\nfloat pow4( const in float x ) { float x2 = x*x; return x2*x2; }\nfloat max3( const in vec3 v ) { return max( max( v.x, v.y ), v.z ); }\nfloat average( const in vec3 color ) { return dot( color, vec3( 0.3333 ) ); }\n\n// expects values in the range of [0,1]x[0,1], returns values in the [0,1] range.\n// do not collapse into a single function per: http://byteblacksmith.com/improvements-to-the-canonical-one-liner-glsl-rand-for-opengl-es-2-0/\nhighp float rand( const in vec2 uv ) {\n const highp float a = 12.9898, b = 78.233, c = 43758.5453;\n highp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI );\n\n return fract( sin( sn ) * c );\n}\n\nmat3 transposeMat3(mat3 inMatrix) {\n vec3 i0 = inMatrix[0];\n vec3 i1 = inMatrix[1];\n vec3 i2 = inMatrix[2];\n\n mat3 outMatrix = mat3(\n vec3(i0.x, i1.x, i2.x),\n vec3(i0.y, i1.y, i2.y),\n vec3(i0.z, i1.z, i2.z)\n );\n\n return outMatrix;\n}\n\n// https://github.com/glslify/glsl-inverse/blob/master/index.glsl\nmat3 inverseMat3(mat3 inMatrix) {\n float a00 = inMatrix[0][0], a01 = inMatrix[0][1], a02 = inMatrix[0][2];\n float a10 = inMatrix[1][0], a11 = inMatrix[1][1], a12 = inMatrix[1][2];\n float a20 = inMatrix[2][0], a21 = inMatrix[2][1], a22 = inMatrix[2][2];\n\n float b01 = a22 * a11 - a12 * a21;\n float b11 = -a22 * a10 + a12 * a20;\n float b21 = a21 * a10 - a11 * a20;\n\n float det = a00 * b01 + a01 * b11 + a02 * b21;\n\n return mat3(b01, (-a22 * a01 + a02 * a21), (a12 * a01 - a02 * a11),\n b11, (a22 * a00 - a02 * a20), (-a12 * a00 + a02 * a10),\n b21, (-a21 * a00 + a01 * a20), (a11 * a00 - a01 * a10)) / det;\n}\n\nstruct DirectionalLight {\n vec3 direction;\n float intensity;\n vec3 color;\n};\n\nstruct IncidentLight {\n vec3 color;\n vec3 direction;\n bool visible;\n};\n\nstruct ReflectedLight {\n vec3 directDiffuse;\n vec3 directSpecular;\n vec3 indirectDiffuse;\n vec3 indirectSpecular;\n};\n\nstruct GeometricContext {\n vec3 position;\n vec3 normal;\n vec3 viewDir;\n};\nlayout(std140) uniform ub_SceneParams {\n mat4 u_ProjectionMatrix;\n mat4 u_ViewMatrix;\n vec3 u_CameraPosition;\n float u_DevicePixelRatio;\n vec2 u_Viewport;\n float u_IsOrtho;\n float u_IsPicking;\n};\nlayout(std140) uniform ub_MaterialParams {\n #ifdef USE_WIREFRAME\n vec3 u_WireframeLineColor;\n float u_WireframeLineWidth;\n #endif\n\n #ifdef USE_FOG\n vec4 u_FogInfos;\n vec3 u_FogColor;\n #endif\n\n vec3 u_Emissive;\n float u_Shininess;\n vec3 u_Specular;\n\n #ifdef USE_LIGHT\n #ifdef USE_BUMPMAP\n float u_BumpScale;\n #endif\n\n #ifdef NUM_AMBIENT_LIGHTS\n vec3 u_AmbientLightColor;\n #endif\n\n #ifdef NUM_DIR_LIGHTS\n DirectionalLight directionalLights[ NUM_DIR_LIGHTS ];\n #endif\n #endif\n};\n#ifdef USE_LIGHT\n void getDirectionalLightInfo(\n const in DirectionalLight directionalLight, \n const in GeometricContext geometry,\n out IncidentLight light\n ) {\n light.color = directionalLight.color * directionalLight.intensity;\n light.direction = normalize(directionalLight.direction);\n light.visible = true;\n }\n#endif\n\nin vec4 v_PickingResult;\nin vec4 v_Color;\nin vec4 v_StrokeColor;\nin vec4 v_StylePacked1;\nin vec4 v_StylePacked2;\n#ifdef USE_UV\n in vec2 v_Uv;\n#endif\n#ifdef USE_MAP\n uniform sampler2D u_Map;\n#endif\n#if defined(USE_BUMPMAP) && defined(USE_LIGHT)\n uniform sampler2D u_BumpMap;\n\n // Bump Mapping Unparametrized Surfaces on the GPU by Morten S. Mikkelsen\n // http://api.unrealengine.com/attachments/Engine/Rendering/LightingAndShadows/BumpMappingWithoutTangentSpace/mm_sfgrad_bump.pdf\n\n // Evaluate the derivative of the height w.r.t. screen-space using forward differencing (listing 2)\n\n vec2 dHdxy_fwd() {\n vec2 dSTdx = dFdx( v_Uv );\n vec2 dSTdy = dFdy( v_Uv );\n\n float Hll = u_BumpScale * texture(SAMPLER_2D(u_BumpMap), v_Uv ).x;\n float dBx = u_BumpScale * texture(SAMPLER_2D(u_BumpMap), v_Uv + dSTdx ).x - Hll;\n float dBy = u_BumpScale * texture(SAMPLER_2D(u_BumpMap), v_Uv + dSTdy ).x - Hll;\n\n return vec2( dBx, dBy );\n }\n\n vec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy, float faceDirection ) {\n\n // Workaround for Adreno 3XX dFd*( vec3 ) bug. See #9988\n\n vec3 vSigmaX = vec3( dFdx( surf_pos.x ), dFdx( surf_pos.y ), dFdx( surf_pos.z ) );\n vec3 vSigmaY = vec3( dFdy( surf_pos.x ), dFdy( surf_pos.y ), dFdy( surf_pos.z ) );\n vec3 vN = surf_norm;\t\t// normalized\n\n vec3 R1 = cross( vSigmaY, vN );\n vec3 R2 = cross( vN, vSigmaX );\n\n float fDet = dot( vSigmaX, R1 ) * faceDirection;\n\n vec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 );\n return normalize( abs( fDet ) * surf_norm - vGrad );\n }\n#endif\n#ifdef USE_SPECULARMAP\n uniform sampler2D u_SpecularMap;\n#endif\nvec3 BRDF_Lambert(const in vec3 diffuseColor) {\n return RECIPROCAL_PI * diffuseColor;\n}\n\nvec3 F_Schlick(\n const in vec3 f0,\n const in float f90,\n const in float dotVH\n) {\n // Original approximation by Christophe Schlick '94\n // float fresnel = pow( 1.0 - dotVH, 5.0 );\n\n // Optimized variant (presented by Epic at SIGGRAPH '13)\n // https://cdn2.unrealengine.com/Resources/files/2013SiggraphPresentationsNotes-26915738.pdf\n float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );\n return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );\n}\n\nfloat G_BlinnPhong_Implicit( /* const in float dotNL, const in float dotNV */ ) {\n // geometry term is (n dot l)(n dot v) / 4(n dot l)(n dot v)\n return 0.25;\n}\n\nfloat D_BlinnPhong(\n const in float shininess,\n const in float dotNH\n) {\n return RECIPROCAL_PI * ( shininess * 0.5 + 1.0 ) * pow( dotNH, shininess );\n}\n\nvec3 BRDF_BlinnPhong(\n const in vec3 lightDir,\n const in vec3 viewDir,\n const in vec3 normal,\n const in vec3 specularColor,\n const in float shininess\n) {\n vec3 halfDir = normalize( lightDir + viewDir );\n\n float dotNH = saturate( dot( normal, halfDir ) );\n float dotVH = saturate( dot( viewDir, halfDir ) );\n\n vec3 F = F_Schlick( specularColor, 1.0, dotVH );\n\n float G = G_BlinnPhong_Implicit( /* dotNL, dotNV */ );\n\n float D = D_BlinnPhong( shininess, dotNH );\n\n return F * ( G * D );\n}\n\n#ifdef USE_WIREFRAME\n in vec3 v_Barycentric;\n\n float edgeFactor() {\n vec3 d = fwidth(v_Barycentric);\n vec3 a3 = smoothstep(vec3(0.0), d * u_WireframeLineWidth, v_Barycentric);\n return min(min(a3.x, a3.y), a3.z);\n }\n#endif\n\n#ifdef USE_FOG\n #define FOGMODE_NONE 0.\n #define FOGMODE_EXP 1.\n #define FOGMODE_EXP2 2.\n #define FOGMODE_LINEAR 3.\n\n // in float v_FogDepth;\n\n float dBlendModeFogFactor = 1.0;\n\n vec3 addFog(vec3 color) {\n float depth = gl_FragCoord.z / gl_FragCoord.w;\n // float depth = v_FogDepth;\n float fogFactor;\n float fogStart = u_FogInfos.y;\n float fogEnd = u_FogInfos.z;\n float fogDensity = u_FogInfos.w;\n\n if (u_FogInfos.x == FOGMODE_NONE) {\n fogFactor = 1.0;\n } else if (u_FogInfos.x == FOGMODE_EXP) {\n fogFactor = exp(-depth * fogDensity);\n } else if (u_FogInfos.x == FOGMODE_EXP2) {\n fogFactor = exp(-depth * depth * fogDensity * fogDensity);\n } else if (u_FogInfos.x == FOGMODE_LINEAR) {\n fogFactor = (fogEnd - depth) / (fogEnd - fogStart);\n }\n\n fogFactor = clamp(fogFactor, 0.0, 1.0);\n return mix(u_FogColor * dBlendModeFogFactor, color, fogFactor);\n }\n#endif\n\nstruct BlinnPhongMaterial {\n vec3 diffuseColor;\n vec3 specularColor;\n float specularShininess;\n float specularStrength;\n};\n\nvoid RE_Direct_BlinnPhong(\n const in IncidentLight directLight,\n const in GeometricContext geometry,\n const in BlinnPhongMaterial material,\n inout ReflectedLight reflectedLight\n) {\n float dotNL = saturate(dot(geometry.normal, directLight.direction));\n vec3 irradiance = dotNL * directLight.color;\n\n reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n\n reflectedLight.directSpecular += irradiance * BRDF_BlinnPhong( directLight.direction, geometry.viewDir, geometry.normal, material.specularColor, material.specularShininess ) * material.specularStrength;\n}\n\nvoid RE_IndirectDiffuse_BlinnPhong(\n const in vec3 irradiance,\n const in GeometricContext geometry,\n const in BlinnPhongMaterial material,\n inout ReflectedLight reflectedLight\n) {\n reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\n\nvec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) {\n\tvec3 irradiance = ambientLightColor;\n\treturn irradiance;\n}\n\n#define RE_Direct RE_Direct_BlinnPhong\n#define RE_IndirectDiffuse RE_IndirectDiffuse_BlinnPhong\n\nin vec3 v_ViewPosition;\nin vec3 v_Normal;\n\nout vec4 outputColor;\n\nvoid main() {\n vec4 u_Color = v_Color;\nvec4 u_StrokeColor = v_StrokeColor;\nfloat u_Opacity = v_StylePacked1.x;\nfloat u_FillOpacity = v_StylePacked1.y;\nfloat u_StrokeOpacity = v_StylePacked1.z;\nfloat u_StrokeWidth = v_StylePacked1.w;\nfloat u_Visible = v_StylePacked2.x;\nvec3 u_PickingColor = v_PickingResult.xyz;\n\nif (u_Visible < 0.5) {\n discard;\n}\n\n // diffusemap\n #ifdef USE_MAP\n #ifdef USE_PATTERN\n vec4 texelColor = texture(SAMPLER_2D(u_Map), v_Uv);\n u_Color = texelColor;\n #else\n vec4 texelColor = texture(SAMPLER_2D(u_Map), v_Uv);\n u_Color = texelColor;\n #endif\n#endif\n // specularmap\n float specularStrength = 1.0;\n\n#ifdef USE_SPECULARMAP\n vec4 texelSpecular = texture(SAMPLER_2D(u_SpecularMap), v_Uv);\n specularStrength = texelSpecular.r;\n#endif\n // bumpmap & normalmap\n float faceDirection = gl_FrontFacing ? 1.0 : - 1.0;\nvec3 normal = normalize(v_Normal);\n#ifdef USE_DOUBLESIDE\n normal = normal * faceDirection;\n#endif\n\n// #ifdef USE_TANGENT\n// vec3 tangent = normalize( vTangent );\n// vec3 bitangent = normalize( vBitangent );\n\n// #ifdef DOUBLE_SIDED\n// tangent = tangent * faceDirection;\n// bitangent = bitangent * faceDirection;\n// #endif\n\n// #if defined( TANGENTSPACE_NORMALMAP ) || defined( USE_CLEARCOAT_NORMALMAP )\n\n// mat3 vTBN = mat3( tangent, bitangent, normal );\n\n// #endif\n// #endif\n #ifdef OBJECTSPACE_NORMALMAP\n // normal = texture2D( normalMap, vUv ).xyz * 2.0 - 1.0; // overrides both flatShading and attribute normals\n\n // #ifdef FLIP_SIDED\n // normal = - normal;\n // #endif\n\n // #ifdef DOUBLE_SIDED\n // normal = normal * faceDirection;\n // #endif\n\n // normal = normalize( normalMatrix * normal );\n#elif defined( TANGENTSPACE_NORMALMAP )\n // vec3 mapN = texture2D( normalMap, vUv ).xyz * 2.0 - 1.0;\n // mapN.xy *= normalScale;\n\n // #ifdef USE_TANGENT\n // normal = normalize( vTBN * mapN );\n // #else\n // normal = perturbNormal2Arb( - v_ViewPosition, normal, mapN, faceDirection );\n // #endif\n\n#elif defined(USE_BUMPMAP) && defined(USE_LIGHT)\n normal = perturbNormalArb( - v_ViewPosition, normal, dHdxy_fwd(), faceDirection );\n#endif\n\n if (u_IsPicking > 0.5) {\n if (u_PickingColor.x == 0.0 && u_PickingColor.y == 0.0 && u_PickingColor.z == 0.0) {\n discard;\n }\n outputColor = vec4(u_PickingColor, 1.0);\n } else {\n outputColor = u_Color;\n outputColor.a = outputColor.a * u_Opacity;\n\n vec4 diffuseColor = outputColor;\n ReflectedLight reflectedLight = ReflectedLight(vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ));\n vec3 totalEmissiveRadiance = u_Emissive;\n\n // calculate lighting accumulation\n BlinnPhongMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.specularColor = u_Specular;\nmaterial.specularShininess = u_Shininess;\nmaterial.specularStrength = specularStrength;\n GeometricContext geometry;\ngeometry.position = - v_ViewPosition;\ngeometry.normal = normal;\ngeometry.viewDir = u_IsOrtho == 1.0 ? vec3(0, 0, 1) : normalize(v_ViewPosition);\n\nIncidentLight directLight;\n#if defined( NUM_DIR_LIGHTS ) && ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct )\n DirectionalLight directionalLight;\n #if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0\n DirectionalLightShadow directionalLightShadow;\n #endif\n\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\n directionalLight = directionalLights[ i ];\n\n getDirectionalLightInfo( directionalLight, geometry, directLight );\n\n #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS )\n directionalLightShadow = directionalLightShadows[ i ];\n directLight.color *= all( bvec2( directLight.visible, receiveShadow ) ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n #endif\n\n RE_Direct( directLight, geometry, material, reflectedLight );\n }\n #pragma unroll_loop_end\n\n#endif\n\n#if defined( RE_IndirectDiffuse )\n vec3 iblIrradiance = vec3(0.0);\n vec3 ambient = vec3(0.0);\n #ifdef NUM_AMBIENT_LIGHTS\n ambient = u_AmbientLightColor;\n #endif\n vec3 irradiance = getAmbientLightIrradiance(ambient);\n\n // irradiance += getLightProbeIrradiance( lightProbe, geometry.normal );\n // #if ( NUM_HEMI_LIGHTS > 0 )\n // #pragma unroll_loop_start\n // for ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n // irradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry.normal );\n // }\n // #pragma unroll_loop_end\n // #endif\n#endif\n\n#if defined( RE_IndirectSpecular )\n vec3 radiance = vec3( 0.0 );\n vec3 clearcoatRadiance = vec3( 0.0 );\n#endif\n\n #if defined( RE_IndirectDiffuse )\n RE_IndirectDiffuse( irradiance, geometry, material, reflectedLight );\n#endif\n\n#if defined( RE_IndirectSpecular )\n RE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometry, material, reflectedLight );\n#endif\n\n vec3 outgoingLight = reflectedLight.directDiffuse +\n reflectedLight.indirectDiffuse + \n reflectedLight.directSpecular + \n reflectedLight.indirectSpecular + \n totalEmissiveRadiance;\n\n outputColor = vec4(outgoingLight, diffuseColor.a);\n\n #ifdef USE_WIREFRAME\n vec3 color = mix(outputColor.xyz, u_WireframeLineColor, (1.0 - edgeFactor()));\n outputColor.xyz = color;\n#endif\n #ifdef USE_FOG\n outputColor.rgb = addFog(outputColor.rgb);\n#endif\n }\n}",emissive:"black",shininess:30,specular:"#111111",bumpScale:1,doubleSide:!1},e))||this,e=function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t),r=e.specularMap,i=e.bumpMap,o=e.doubleSide,a=e.emissive,s=e.shininess,e=e.specular,a=Ao(a),e=Ao(e);return t.setUniforms(((n={u_Placeholder:null})[Ev.EMISSIVE]=[Number(a.r)/255,Number(a.g)/255,Number(a.b)/255],n[Ev.SHININESS]=s,n[Ev.SPECULAR]=[Number(e.r)/255,Number(e.g)/255,Number(e.b)/255],n)),r&&(t.specularMap=r),i&&(t.bumpMap=i),t.doubleSide=o,t.defines=pv({},t.defines),t}return gv(t,l),fv(t,[{key:"emissive",get:function(){return this.props.emissive},set:function(t){this.props.emissive=t;var e,t=Ao(t);this.setUniforms(((e={})[Ev.EMISSIVE]=[Number(t.r)/255,Number(t.g)/255,Number(t.b)/255],e))}},{key:"shininess",get:function(){return this.props.shininess},set:function(t){var e;this.props.shininess=t,this.setUniforms(((e={})[Ev.SHININESS]=t,e))}},{key:"specular",get:function(){return this.props.specular},set:function(t){this.props.specular=t;var e,t=Ao(t);this.setUniforms(((e={})[Ev.SPECULAR]=[Number(t.r)/255,Number(t.g)/255,Number(t.b)/255],e))}},{key:"specularMap",get:function(){return this.props.specularMap},set:function(t){var e;this.props.map!==t&&(this.props.specularMap=t,this.programDirty=!0),this.defines.USE_SPECULARMAP=!!t,this.setUniforms(((e={})[Ev.SPECULAR_MAP]=t,e))}},{key:"bumpMap",get:function(){return this.props.bumpMap},set:function(t){var e;this.props.map!==t&&(this.props.bumpMap=t,this.programDirty=!0),this.defines.USE_BUMPMAP=!!t,this.setUniforms(((e={})[Ev.BUMP_MAP]=t,e[Ev.BUMP_SCALE]=this.bumpScale,e))}},{key:"bumpScale",get:function(){return this.props.bumpScale},set:function(t){var e;this.props.bumpScale=t,this.setUniforms(((e={})[Ev.BUMP_SCALE]=t,e))}},{key:"doubleSide",get:function(){return this.props.doubleSide},set:function(t){this.props.doubleSide=t,this.defines.USE_DOUBLESIDE=t}}]),t}(wv)),Av=(0,function(i){function t(){for(var t,e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];return(t=i.call.apply(i,[this].concat(n))||this).name="3d",t}gv(t,i);var e=t.prototype;return e.init=function(){},e.destroy=function(){},t}(Ws));const Mv=(t,e,n,r,i,o=!0,a={})=>{let s;switch(t.toLowerCase()){case"svg":s=new kd;break;case"webgl-3d":case"webgl":(s=new hv).registerPlugin(new Av);break;default:s=new Ih}return"undefined"!=typeof document&&o?(t=document.createElement("canvas"),o=i||window.devicePixelRatio,t.width=o*n,t.height=o*r,t.style.width=n+"px",t.style.height=r+"px",t.style.position="fixed",t.style.outline="none",t.tabIndex=1,Object.assign(t.style,a),e.appendChild(t),new pl({canvas:t,devicePixelRatio:i,renderer:s})):new pl({container:e,width:n,height:r,devicePixelRatio:i,renderer:s})},Rv=["keyShape","labelShape","labelBackgroundShape","iconShape","haloShape","anchorShapes","badgeShapes"],Nv="otherShapes",Cv=[4,4,4,4];Ua={opacity:1,fillOpacity:1,shadowColor:void 0,shadowBlur:0,lineDash:void 0,zIndex:0},Sa=Object.assign(Object.assign({},Ua),{fontSize:12,fontFamily:"sans-serif",fontWeight:"normal",fontVariant:"normal",fontStyle:"normal",lineWidth:0});const Pv=(n,r)=>{if(null!=n&&n.length&&r.length)for(let e=0;e<n.length;e++)for(let t=0;t<r.length;t++)if(n[e]===r[t])return!0;return!1};function Ov(t=[],e=[]){const n={};return e.forEach(t=>{"object"==typeof t&&(n[JSON.stringify(t)]=!0),n[t]=!0}),t.filter(t=>!n[t])}function Iv(t,e){const n=new Set(t);return e.forEach(t=>{n.add(t)}),Array.from(n)}function Lv(t,e){const n=new Set(t),r=[];return e.forEach(t=>{n.has(t)&&r.push(t)}),r}const kv=t=>{var e,n;return t?(e=t.nodeName,n={opacity:0,strokeOpacity:0,lineWidth:1,offsetDistance:0},["line","polyline","path"].includes(e)?(t=t.getTotalLength(),Object.assign({lineDash:[0,t]},n)):"circle"===e?Object.assign({r:0},n):"ellipse"===e?Object.assign({rx:0,ry:0},n):"text"===e?{fontSize:0,opacity:0,strokeOpacity:0,offsetDistance:0}:Object.assign({width:0,height:0},n)):{}},Dv=[{opacity:0,transform:"scale(0)"},{opacity:1,transform:"scale(1)"}],Bv={buildIn:{duration:500,easing:"cubic-bezier(0.250, 0.460, 0.450, 0.940)",iterations:1,delay:1e3,fill:"both"},show:{duration:500,easing:"cubic-bezier(0.250, 0.460, 0.450, 0.940)",iterations:1,fill:"both"},update:{duration:500,easing:"cubic-bezier(0.250, 0.460, 0.450, 0.940)",iterations:1,fill:"both"},zoom:{duration:200,easing:"linear",iterations:1,delay:0,fill:"both"}},Fv=(e,n)=>{const r=[{},{}];return Object.keys(e).forEach(t=>{n[t]!==e[t]&&(r[0][t]=e[t],r[1][t]=n[t])}),r},Uv=(t,e,r)=>{const i={},o="stateUpdate"===e;return t[o?"update":e].forEach(t=>{var{order:e=0,states:n}=t;(!o||o&&Pv(n,r))&&(i[e]=i[e]||[],i[e].push(t))}),i},Gv=(h,d,t,f,p,e,g,n)=>{let m=-1/0,v=-1,y=n;const E="buildOut"===p||"hide"===p;n=t.map((t,e)=>{var n,{fields:r,shapeId:i}=t,t=I(t,["fields","shapeId","order","states"]);const o=Object.assign(Object.assign({},Bv[p]),t);t=o.duration;let a;if(i&&"group"!==i){const s=h[i];if(s&&"none"!==s.style.display){const l=f[i]||(null==(n=f.otherShapes)?void 0:n[i])||{};y?Object.keys(l).forEach(t=>{s.style[t]=l[t]}):a=Wv(s,r,l,kv(s),o)}}else{const u=[];let e=!1;null!=r&&r.forEach(t=>{"size"===t?u.push("transform"):"opacity"!==t?u.push(t):e=!0});const c=f.group||Dv[E?0:1];y?Object.keys(c).forEach(t=>{d.style[t]=c[t]}):(e&&Object.keys(h).forEach(t=>{var{opacity:e=1}=f[t]||(null==(e=f.otherShapes)?void 0:e[t])||{};a=Wv(h[t],["opacity"],{opacity:e},kv(h[t]),o)}),u.length&&(a=Wv(d,u,c,Dv[E?1:0],o)))}return m<t&&a&&(m=t,v=e),a&&(a.oncancel=()=>{y=!0,g()}),a});return-1<v&&(n[v].onfinish=e),n},Wv=(a,t,s,l,e)=>{if(a.isVisible()){let o;if(null!=t&&t.length?(o=[{},{}],t.forEach(t=>{if(o[0][t]=(a.attributes.hasOwnProperty(t)?a.style:l)[t],o[1][t]=(void 0===s[t]?o[0]:s)[t],"lineDash"===t&&o[1][t].includes("100%")){var e=a.getTotalLength(),n=o[1][t],r="100%",i=e;for(let t=0;t<n.length;t++)n[t]===r&&(n[t]=i)}})):o=Fv(a.attributes,s),JSON.stringify(o[0])!==JSON.stringify(o[1]))return a.animate(o,e)}},Vv=(t,i,o,a,s="buildIn",e=[],l=()=>{},u=()=>{})=>{if(null!=t&&t[s]){var n="update"===s&&null!=e&&e.length?"stateUpdate":s;const c=Uv(t,n,e);let r=0;const h=Object.keys(c);if(h.length){let e=[],n=!1;const d=()=>{var t;r>=h.length?u():((t=Gv(o,a,c[h[r]],i,s,d,()=>n=!0,n).filter(Boolean)).forEach(t=>{t.onframe=l}),0===r&&(e=t),r++)};return d(),e}}else u()},jv=(t,e,n,r,i)=>{e&&r[t]&&(null!=e&&e.isVisible()||(e.style.opacity=0,e.show()),{opacity:r=1}=e.attributes,1!==r)&&({opacity:t=1}=n,e.animate([{opacity:0},{opacity:t}],i))},zv=(t,e,n,r)=>{null!=e&&e.isVisible()&&(n[t]=!0,{opacity:n=1}=e.attributes,0!==n)&&(e.animate([{opacity:n},{opacity:0}],r).onfinish=()=>e.hide())},Hv=(t,e,n)=>e<=t&&t<=n,Xv={circle:ls,rect:Rs,ellipse:hs,polygon:ws,line:Es,polyline:As,text:Cs,image:vs,path:xs},Yv=["line","polyline","path"],Kv="data-item-local-bounds-dirty",qv=(t,e,n)=>{n=new Xv[t]({id:n,style:e});return Yv.includes(t)&&(n.style.increasedLineWidthForHitTesting=Math.max(n.style.lineWidth,6)),n},$v=(t,e,n)=>{if(null==t||!t[e])return[];let r=[];return t[e].forEach(({fields:t,shapeId:e})=>{e===n?r=r.concat(t):e&&"group"!==e||!t.includes("opacity")||r.push("opacity")}),r.includes(void 0)?[]:r},Zv=(t,e,n,r,i)=>{let o=r[e];var{animates:i,disableAnimate:a}=(null==i?void 0:i.data)||{};if(o)if(o.nodeName!==t)o.remove(),(o=qv(t,n,e)).setAttribute(Kv,!0);else{const s={},l=o.attributes,u=$v(i,"update",e);!a&&null!=i&&i.update&&u.length?Object.keys(n).forEach(t=>{l[t]!==n[t]&&(s[t]=n[t],u.includes(t)||(o.style[t]=n[t]))}):Object.keys(n).forEach(t=>{l[t]!==n[t]&&(s[t]=n[t],o.style[t]=n[t])}),uy(t,s)&&o.setAttribute(Kv,!0)}else{if(o=qv(t,n,e),!a&&i){t=$v(i,"buildIn",e);const c=kv(o);t.forEach(t=>{o.style[t]=c[t]})}o.setAttribute(Kv,!0)}return r[e]=o},Qv=(r,i,o,a=!0,s=()=>!0)=>{var t=Object.assign(Object.assign({},r),i);const l=Object.assign({},r);return Object.keys(t).forEach(t=>{var e=r[t],n=i[t];n&&!s(t)||(e&&n?(e!==(l[t]=n)&&e.remove(),"none"!==n.style.display&&o.appendChild(n)):!e&&n?"none"!==(l[t]=n).style.display&&o.appendChild(n):e&&!n&&a&&(delete l[t],e.remove()))}),l},Jv=(t,e=Cv)=>{if(Ou(t))switch(t.length){case 0:return e;case 1:return[t[0],t[0],t[0],t[0]];case 2:return t.concat(t);case 3:return t.concat([t[0]]);default:return t}return Fu(t)?[t,t,t,t]:e},ty=t=>{let n=t[0];return t.forEach((t,e)=>{0<e&&(n=ey(n,t))}),n},ey=(t,e)=>{if(!t)return Object.assign({},e);if(!e)return Object.assign({},t);const i=Wu(t);return Object.keys(e).forEach(n=>{const r=e[n];i[n]=i[n]||{},r&&Object.keys(r).forEach(t=>{var e=r[t];i[n][t]=e})}),i},ny=(e,n)=>{var t=t=>{var e=t.map(t=>t[0]),t=t.map(t=>t[1]);return{min:[Math.min.apply(null,e),Math.min.apply(null,t),0],max:[Math.max.apply(null,e),Math.max.apply(null,t),0]}},r=e=>{var t,n,r=[],i=e.length;for(let t=0;t<i-1;t++){var o=e[t],a=e[t+1];r.push({from:{x:o[0],y:o[1]},to:{x:a[0],y:a[1]}})}return 1<r.length&&(t=e[0],n=e[i-1],r.push({from:{x:n[0],y:n[1]},to:{x:t[0],y:t[1]}})),r};if(e.length<2||n.length<2)return!1;var i=t(e),t=t(n);if(!ry(i,t))return!1;let o=!1;if(n.forEach(t=>{if(iy(e,t[0],t[1]))return!(o=!0)}),o)return!0;if(e.forEach(t=>{if(iy(n,t[0],t[1]))return!(o=!0)}),o)return!0;const a=r(e);i=r(n);let s=!1;return i.forEach(t=>{if(ay(a,t))return!(s=!0)}),s},ry=(t,e)=>!(e.min[0]>t.max[0]||e.max[0]<t.min[0]||e.min[1]>t.max[1]||e.max[1]<t.min[1]),iy=(e,n,r)=>{let i=!1;var o=e.length;function a(t){return Math.abs(t)<1e-6?0:t<0?-1:1}if(o<=2)return!1;for(let t=0;t<o;t++){var s=e[t],l=e[(t+1)%o];if(oy(s,l,[n,r]))return!0;0<a(s[1]-r)!=0<a(l[1]-r)&&a(n-(r-s[1])*(s[0]-l[0])/(s[1]-l[1])-s[0])<0&&(i=!i)}return i},oy=(t,e,n)=>(n[0]-t[0])*(e[1]-t[1])==(e[0]-t[0])*(n[1]-t[1])&&Math.min(t[0],e[0])<=n[0]&&n[0]<=Math.max(t[0],e[0])&&Math.min(t[1],e[1])<=n[1]&&n[1]<=Math.max(t[1],e[1]),ay=(t,e)=>{let n=!1;return t.forEach(t=>{if(sy(t.from,t.to,e.from,e.to))return!(n=!0)}),n},sy=(t,e,n,r)=>{const i=n.x-t.x,o=n.y-t.y,a=e.x-t.x,s=e.y-t.y,l=r.x-n.x,u=r.y-n.y;var e=a*u-s*l,r=1/e;return 1e-4*(a*a+s*s)*(l*l+u*u)<e*e&&(n=(i*u-o*l)*r,e=(i*s-o*a)*r,Hv(n,0,1))&&Hv(e,0,1)?{x:t.x+n*a,y:t.y+n*s}:null},ly={circle:["r","lineWidth"],rect:["width","height","lineWidth"],image:["width","height","lineWidth"],ellipse:["rx","ry","lineWidth"],text:["fontSize","fontWeight","text","wordWrapWidth"],polygon:["points","lineWidth"],line:["x1","x2","y1","y2","lineWidth"],polyline:["points","lineWidth"],path:["points","lineWidth"],sphere:["radius"],cube:["width","height","depth"],plane:["width","depth"]},uy=(t,e)=>Pv(Object.keys(e),ly[t]),cy=(t,e,n)=>{var{r:e,rx:r,ry:i,width:o,height:a,depth:s=0,x1:l,x2:u,y1:c,y2:h,z1:d=0,z2:f=0}=e,p=Number(e),g=Number(r),m=Number(i);switch(t.nodeName){case"circle":return{min:[-p,-p,0],max:[p,p,0],center:[0,0,0]};case"sphere":return{min:[-p,-p,-p],max:[p,p,p],center:[0,0,0]};case"image":case"rect":case"cube":case"plane":return{min:[-o/2,-a/2,-s/2],max:[o/2,a/2,s/2],center:[0,0,0]};case"ellipse":return{min:[-g,-m,0],max:[g,m,0],center:[0,0,0]};case"line":return{min:[l,c,d],max:[u,h,f],center:[(l+u)/2,(c+h)/2,(d+f)/2]};case"text":case"polyline":case"path":case"polygon":return n||t.getLocalBounds()}};function hy(e,n,t,r){for(;e.length;){var i=e.shift();if(t(i))return!0;n.add(i.id),r(i.id).forEach(t=>{n.has(t.id)||(n.add(t.id),e.push(t))})}return!1}function dy(t,e,n,r){if(n(t))return!0;e.add(t.id);for(const i of r(t.id))if(!e.has(i.id)&&dy(i,e,n,r))return!0;return!1}class fy extends G{nodeMap=new Map;edgeMap=new Map;inEdgesMap=new Map;outEdgesMap=new Map;bothEdgesMap=new Map;treeIndices=new Map;changes=[];batchCount=0;onChanged=()=>{};constructor(t){super(),t&&(t.nodes&&this.addNodes(t.nodes),t.edges&&this.addEdges(t.edges),t.tree&&this.addTree(t.tree),t.onChanged)&&(this.onChanged=t.onChanged)}batch=t=>{this.batchCount+=1,t(),--this.batchCount,this.batchCount||this.commit()};commit(){var t=this.changes,t=(this.changes=[],{graph:this,changes:t});this.emit("changed",t),this.onChanged(t)}reduceChanges(t){let e=[];return t.forEach(r=>{switch(r.type){case"NodeRemoved":{let n=!1;e=e.filter(t=>{var e;return"NodeAdded"===t.type?((e=t.value.id===r.value.id)&&(n=!0),!e):"NodeDataUpdated"===t.type?t.id!==r.value.id:"TreeStructureChanged"!==t.type||t.nodeId!==r.value.id}),n||e.push(r);break}case"EdgeRemoved":{let n=!1;e=e.filter(t=>{var e;return"EdgeAdded"===t.type?((e=t.value.id===r.value.id)&&(n=!0),!e):"EdgeDataUpdated"!==t.type&&"EdgeUpdated"!==t.type||t.id!==r.value.id}),n||e.push(r);break}case"NodeDataUpdated":case"EdgeDataUpdated":case"EdgeUpdated":var t=e.find(t=>t.type===r.type&&t.id===r.id&&t.propertyName===r.propertyName);t?t.newValue=r.newValue:e.push(r);break;case"TreeStructureDetached":(e=e.filter(t=>"TreeStructureAttached"!==t.type&&"TreeStructureChanged"!==t.type||t.treeKey!==r.treeKey)).push(r);break;case"TreeStructureChanged":t=e.find(t=>"TreeStructureChanged"===t.type&&t.treeKey===r.treeKey&&t.nodeId===r.nodeId);t?t.newParentId=r.newParentId:e.push(r);break;default:e.push(r)}}),e}checkNodeExistence(t){this.getNode(t)}hasNode(t){return this.nodeMap.has(t)}areNeighbors(e,t){return this.getNeighbors(t).some(t=>t.id===e)}getNode(t){var e=this.nodeMap.get(t);if(e)return e;throw new Error("Node not found for id: "+t)}getRelatedEdges(t,e){var n;return this.checkNodeExistence(t),"in"===e?(n=this.inEdgesMap.get(t),Array.from(n)):"out"===e?(n=this.outEdgesMap.get(t),Array.from(n)):(e=this.bothEdgesMap.get(t),Array.from(e))}getDegree(t,e){return this.getRelatedEdges(t,e).length}getSuccessors(t){t=this.getRelatedEdges(t,"out").map(t=>this.getNode(t.target));return Array.from(new Set(t))}getPredecessors(t){t=this.getRelatedEdges(t,"in").map(t=>this.getNode(t.source));return Array.from(new Set(t))}getNeighbors(t){var e=this.getPredecessors(t),t=this.getSuccessors(t);return Array.from(new Set([...e,...t]))}doAddNode(e){if(this.hasNode(e.id))throw new Error("Node already exists: "+e.id);this.nodeMap.set(e.id,e),this.inEdgesMap.set(e.id,new Set),this.outEdgesMap.set(e.id,new Set),this.bothEdgesMap.set(e.id,new Set),this.treeIndices.forEach(t=>{t.childrenMap.set(e.id,new Set)}),this.changes.push({type:"NodeAdded",value:e})}addNodes(e){this.batch(()=>{for(const t of e)this.doAddNode(t)})}addNode(t){this.addNodes([t])}doRemoveNode(t){var e=this.getNode(t);this.bothEdgesMap.get(t)?.forEach(t=>this.doRemoveEdge(t.id)),this.nodeMap.delete(t),this.treeIndices.forEach(e=>{e.childrenMap.get(t)?.forEach(t=>{e.parentMap.delete(t.id)}),e.parentMap.delete(t),e.childrenMap.delete(t)}),this.changes.push({type:"NodeRemoved",value:e})}removeNodes(t){this.batch(()=>{t.forEach(t=>this.doRemoveNode(t))})}removeNode(t){this.removeNodes([t])}updateNodeDataProperty(n,r,i){const o=this.getNode(n);this.batch(()=>{var t=o.data[r],e=i;o.data[r]=e,this.changes.push({type:"NodeDataUpdated",id:n,propertyName:r,oldValue:t,newValue:e})})}mergeNodeData(n,t){this.batch(()=>{Object.entries(t).forEach(([t,e])=>{this.updateNodeDataProperty(n,t,e)})})}updateNodeData(...t){const r=t[0],i=this.getNode(r);if("string"==typeof t[1])this.updateNodeDataProperty(r,t[1],t[2]);else{let n;var e;"function"==typeof t[1]?(e=t[1],n=e(i.data)):"object"==typeof t[1]&&(n=t[1]),this.batch(()=>{var t=i.data,e=n;i.data=n,this.changes.push({type:"NodeDataUpdated",id:r,oldValue:t,newValue:e})})}}checkEdgeExistence(t){if(!this.hasEdge(t))throw new Error("Edge not found for id: "+t)}hasEdge(t){return this.edgeMap.has(t)}getEdge(t){return this.checkEdgeExistence(t),this.edgeMap.get(t)}getEdgeDetail(t){t=this.getEdge(t);return{edge:t,source:this.getNode(t.source),target:this.getNode(t.target)}}doAddEdge(t){if(this.hasEdge(t.id))throw new Error("Edge already exists: "+t.id);this.checkNodeExistence(t.source),this.checkNodeExistence(t.target),this.edgeMap.set(t.id,t);var e=this.inEdgesMap.get(t.target),n=this.outEdgesMap.get(t.source),r=this.bothEdgesMap.get(t.source),i=this.bothEdgesMap.get(t.target);e.add(t),n.add(t),r.add(t),i.add(t),this.changes.push({type:"EdgeAdded",value:t})}addEdges(e){this.batch(()=>{for(const t of e)this.doAddEdge(t)})}addEdge(t){this.addEdges([t])}doRemoveEdge(t){var e=this.getEdge(t),n=this.outEdgesMap.get(e.source),r=this.inEdgesMap.get(e.target),i=this.bothEdgesMap.get(e.source),o=this.bothEdgesMap.get(e.target);n.delete(e),r.delete(e),i.delete(e),o.delete(e),this.edgeMap.delete(t),this.changes.push({type:"EdgeRemoved",value:e})}removeEdges(t){this.batch(()=>{t.forEach(t=>this.doRemoveEdge(t))})}removeEdge(t){this.removeEdges([t])}updateEdgeSource(t,e){var n=this.getEdge(t);this.checkNodeExistence(e);const r=n.source,i=e;this.outEdgesMap.get(r).delete(n),this.bothEdgesMap.get(r).delete(n),this.outEdgesMap.get(i).add(n),this.bothEdgesMap.get(i).add(n),n.source=e,this.batch(()=>{this.changes.push({type:"EdgeUpdated",id:t,propertyName:"source",oldValue:r,newValue:i})})}updateEdgeTarget(t,e){var n=this.getEdge(t);this.checkNodeExistence(e);const r=n.target,i=e;this.inEdgesMap.get(r).delete(n),this.bothEdgesMap.get(r).delete(n),this.inEdgesMap.get(i).add(n),this.bothEdgesMap.get(i).add(n),n.target=e,this.batch(()=>{this.changes.push({type:"EdgeUpdated",id:t,propertyName:"target",oldValue:r,newValue:i})})}updateEdgeDataProperty(n,r,i){const o=this.getEdge(n);this.batch(()=>{var t=o.data[r],e=i;o.data[r]=e,this.changes.push({type:"EdgeDataUpdated",id:n,propertyName:r,oldValue:t,newValue:e})})}updateEdgeData(...t){const r=t[0],i=this.getEdge(r);if("string"==typeof t[1])this.updateEdgeDataProperty(r,t[1],t[2]);else{let n;var e;"function"==typeof t[1]?(e=t[1],n=e(i.data)):"object"==typeof t[1]&&(n=t[1]),this.batch(()=>{var t=i.data,e=n;i.data=n,this.changes.push({type:"EdgeDataUpdated",id:r,oldValue:t,newValue:e})})}}mergeEdgeData(n,t){this.batch(()=>{Object.entries(t).forEach(([t,e])=>{this.updateEdgeDataProperty(n,t,e)})})}checkTreeExistence(t){if(!this.hasTreeStructure(t))throw new Error("Tree structure not found for treeKey: "+t)}hasTreeStructure(t){return this.treeIndices.has(t)}attachTreeStructure(t){this.treeIndices.has(t)||(this.treeIndices.set(t,{parentMap:new Map,childrenMap:new Map}),this.batch(()=>{this.changes.push({type:"TreeStructureAttached",treeKey:t})}))}detachTreeStructure(t){this.checkTreeExistence(t),this.treeIndices.delete(t),this.batch(()=>{this.changes.push({type:"TreeStructureDetached",treeKey:t})})}addTree(r,i){this.batch(()=>{this.attachTreeStructure(i);for(var t=[],e=Array.isArray(r)?r:[r];e.length;){var n=e.shift();t.push(n),n.children&&e.push(...n.children)}this.addNodes(t),t.forEach(e=>{e.children?.forEach(t=>{this.setParent(t.id,e.id,i)})})})}getRoots(e){return this.checkTreeExistence(e),this.getAllNodes().filter(t=>!this.getParent(t.id,e))}getChildren(t,e){this.checkNodeExistence(t),this.checkTreeExistence(e);e=this.treeIndices.get(e).childrenMap.get(t);return Array.from(e||[])}getParent(t,e){return this.checkNodeExistence(t),this.checkTreeExistence(e),this.treeIndices.get(e).parentMap.get(t)||null}getAncestors(t,e){var n,r=[];let i=this.getNode(t);for(;n=this.getParent(i.id,e);)r.push(n),i=n;return r}setParent(t,e,n){this.checkTreeExistence(n);var r=this.treeIndices.get(n),i=this.getNode(t);const o=r.parentMap.get(t),a=this.getNode(e);r.parentMap.set(t,a),o&&r.childrenMap.get(o.id)?.delete(i);let s=r.childrenMap.get(a.id);s||(s=new Set,r.childrenMap.set(a.id,s)),s.add(i),this.batch(()=>{this.changes.push({type:"TreeStructureChanged",treeKey:n,nodeId:t,oldParentId:o?.id,newParentId:a.id})})}dfsTree(t,e,n){return dy(this.getNode(t),new Set,e,t=>this.getChildren(t,n))}bfsTree(t,e,n){return hy([this.getNode(t)],new Set,e,t=>this.getChildren(t,n))}getAllNodes(){return Array.from(this.nodeMap.values())}getAllEdges(){return Array.from(this.edgeMap.values())}bfs(t,e,n="out"){n={in:this.getPredecessors.bind(this),out:this.getSuccessors.bind(this),both:this.getNeighbors.bind(this)}[n];return hy([this.getNode(t)],new Set,e,n)}dfs(t,e,n="out"){n={in:this.getPredecessors.bind(this),out:this.getSuccessors.bind(this),both:this.getNeighbors.bind(this)}[n];return dy(this.getNode(t),new Set,e,n)}clone(){var t=this.getAllNodes().map(t=>({...t,data:{...t.data}})),e=this.getAllEdges().map(t=>({...t,data:{...t.data}}));const o=new fy({nodes:t,edges:e});return this.treeIndices.forEach(({parentMap:t,childrenMap:e},n)=>{const r=new Map,i=(t.forEach((t,e)=>{r.set(e,o.getNode(t.id))}),new Map);e.forEach((t,e)=>{i.set(e,new Set(Array.from(t).map(t=>o.getNode(t.id))))}),o.treeIndices.set(n,{parentMap:r,childrenMap:i})}),o}toJSON(){return JSON.stringify({nodes:this.getAllNodes(),edges:this.getAllEdges()})}}function py(t){for(var e=[],n=t.length,r=0;r<n;r+=1){e[r]=[];for(var i=0;i<n;i+=1)r===i?e[r][i]=0:0!==t[r][i]&&t[r][i]?e[r][i]=t[r][i]:e[r][i]=1/0}for(var o=0;o<n;o+=1)for(r=0;r<n;r+=1)for(i=0;i<n;i+=1)e[r][i]>e[r][o]+e[o][i]&&(e[r][i]=e[r][o]+e[o][i]);return e}function gy(t,n){var e=t.nodes,t=t.edges,r=[],i={};if(e)return e&&e.forEach(function(t,e){i[t.id]=e;r.push([])}),null!=t&&t.forEach(function(t){var e=t.source,t=t.target,e=i[e],t=i[t];void 0===e||void 0===t||(r[e][t]=1,n)||(r[t][e]=1)}),r;throw new Error("invalid nodes data!")}var my=Array.isArray,vy=function(t,e){return Math.sqrt((t.x-e.x)*(t.x-e.x)+(t.y-e.y)*(t.y-e.y))},yy=function(e){var n,r;return null===e?e:e instanceof Date?new Date(e.getTime()):e instanceof Array?(n=[],e.forEach(function(t){n.push(t)}),n.map(function(t){return yy(t)})):"object"==typeof e?(r={},Object.keys(e).forEach(function(t){r[t]=yy(e[t])}),r):e},Ey=function(t,e){t=yy(t);return t.data=t.data||{},e&&(B(t.data.x)||(t.data.x=Math.random()*e[0]),B(t.data.y)||(t.data.y=Math.random()*e[1])),t};function _y(t,e){var n=Ne(e)?e:B(e)?function(){return e}:function(){return t};return n}function by(e,n,r){return void 0===r&&(r=!0),n||0===n?Ne(n)?n:B(n)?function(){return n}:my(n)?function(){var t;return r?(t=Math.max.apply(Math,O([],D(n))),isNaN(t)?e:t):n}:Ie(n)?function(){var t;return r?(t=Math.max(n.width,n.height),isNaN(t)?e:t):[n.width,n.height]}:function(){return e}:function(t){t=(t.data||{}).size;return t?my(t)?t[0]>t[1]?t[0]:t[1]:Ie(t)?t.width>t.height?t.width:t.height:t:e}}function xy(e,t){var n=B(t)?function(){return t}:Ne(t)?t:function(){return 0},r=e?my(e)?function(t){return(e[0]>e[1]?e[0]:e[1])+n(t)}:function(t){return e+n(t)}:function(t){var e;return null!=(e=t.data)&&e.bboxSize?Math.max(t.data.bboxSize[0],t.data.bboxSize[1])+n(t):null!=(e=t.data)&&e.size?my(t.data.size)?Math.max(t.data.size[0],t.data.size[1])+n(t):(e=t.data.size,Ie(e)?(e.width>e.height?e.width:e.height)+n(t):e+n(t)):10+n(t)};return r}function Sy(t,e,n){var r=t.getAllNodes(),i=t.getAllEdges();return null!=r&&r.length?1===r.length?(e&&t.mergeNodeData(r[0].id,{x:n[0],y:n[1]}),{nodes:[k(k({},r[0]),{data:k(k({},r[0].data),{x:n[0],y:n[1]})})],edges:i}):void 0:{nodes:[],edges:i}}var wy={radius:null,startRadius:null,endRadius:null,startAngle:0,endAngle:2*Math.PI,clockwise:!0,divisions:1,ordering:null,angleRatio:1},t=(Ty.prototype.execute=function(e,n){return s(this,void 0,void 0,function(){return U(this,function(t){return[2,this.genericCircularLayout(!1,e,n)]})})},Ty.prototype.assign=function(e,n){return s(this,void 0,void 0,function(){return U(this,function(t){switch(t.label){case 0:return[4,this.genericCircularLayout(!0,e,n)];case 1:return t.sent(),[2]}})})},Ty.prototype.genericCircularLayout=function(O,I,L){return s(this,void 0,void 0,function(){var e,i,o,a,s,l,u,c,h,d,f,p,g,m,v,y,E,_,b,x,S,w,T,A,M,R,N,C,P;return U(this,function(t){if(e=k(k({},this.options),L),y=e.width,p=e.height,g=e.center,i=e.divisions,s=e.startAngle,o=void 0===s?0:s,s=e.endAngle,a=void 0===s?2*Math.PI:s,s=e.angleRatio,l=e.ordering,u=e.clockwise,c=e.nodeSpacing,h=e.nodeSize,d=I.getAllNodes(),f=I.getAllEdges(),y=D(My(y,p,g),3),p=y[0],g=y[1],m=y[2],!(v=null==d?void 0:d.length)||1===v)return[2,Sy(I,O,m)];var n,r;for(y=(a-o)/v,E=e.radius,_=e.startRadius,b=e.endRadius,c?(x=_y(10,c),S=by(10,h),w=-1/0,d.forEach(function(t){t=S(t);w<t&&(w=t)}),T=0,d.forEach(function(t,e){T+=0===e?w||10:(x(t)||0)+(w||10)}),E=T/(2*Math.PI)):E||_||b?!_&&b?_=b:_&&!b&&(b=_):E=Math.min(g,p)/2,A=y*s,M=[],M="topology"===l?Ay(I,d):"topology-directed"===l?Ay(I,d,!0):"degree"===l?(n=I,r=[],d.forEach(function(t,e){r.push(Ey(t))}),r.sort(function(t,e){return n.getDegree(t.id,"both")-n.getDegree(e.id,"both")}),r):d.map(function(t){return Ey(t)}),R=Math.ceil(v/i),N=0;N<v;++N)C=(C=(C=E)||null===_||null===b?C:_+N*(b-_)/(v-1))||10+100*N/(v-1),P=o+N%R*A+2*Math.PI/i*Math.floor(N/R),u||(P=a-N%R*A-2*Math.PI/i*Math.floor(N/R)),M[N].data.x=m[0]+Math.cos(P)*C,M[N].data.y=m[1]+Math.sin(P)*C;return O&&M.forEach(function(t){I.mergeNodeData(t.id,{x:t.data.x,y:t.data.y})}),[2,{nodes:M,edges:f}]})})},Ty);function Ty(t){this.options=t=void 0===t?{}:t,this.id="circular",this.options=k(k({},wy),t)}var Ay=function(s,l,u){void 0===u&&(u=!1);var c=[Ey(l[0])],h={},d=l.length,f=(h[l[0].id]=!0,0);return l.forEach(function(t,e){if(0!==e)if(e!==d-1&&s.getDegree(t.id,"both")===s.getDegree(l[e+1].id,"both")&&!s.areNeighbors(c[f].id,t.id)||h[t.id]){for(var n=u?s.getSuccessors(c[f].id):s.getNeighbors(c[f].id),r=!1,i=0;i<n.length;i++){var o=n[i];if(s.getDegree(o.id)===s.getDegree(t.id)&&!h[o.id]){c.push(Ey(o)),r=h[o.id]=!0;break}}for(var a=0;!r&&(h[l[a].id]||(c.push(Ey(l[a])),r=h[l[a].id]=!0),++a!==d););}else c.push(Ey(t)),h[t.id]=!0,f++}),c};var My=function(t,e,n){var r=t;return[r=t||"undefined"==typeof window?t:window.innerWidth,e=e||"undefined"==typeof window?e:window.innerHeight,n=n||[r/2,e/2]]};const Ry=Symbol("Comlink.proxy"),Ny=Symbol("Comlink.endpoint"),Cy=Symbol("Comlink.releaseProxy"),Py=Symbol("Comlink.finalizer"),Oy=Symbol("Comlink.thrown"),Iy=t=>"object"==typeof t&&null!==t||"function"==typeof t,Ly=new Map([["proxy",{canHandle:t=>Iy(t)&&t[Ry],serialize(t){var{port1:e,port2:n}=new MessageChannel;return function d(f,p=globalThis,e=["*"]){p.addEventListener("message",function r(t){if(t&&t.data)if(ky(e,t.origin)){const{id:i,type:o,path:n}=Object.assign({path:[]},t.data),a=(t.data.argumentList||[]).map(qy);let e;try{const s=n.slice(0,-1).reduce((t,e)=>t[e],f),l=n.reduce((t,e)=>t[e],f);switch(o){case"GET":e=l;break;case"SET":s[n.slice(-1)[0]]=qy(t.data.value),e=!0;break;case"APPLY":e=l.apply(s,a);break;case"CONSTRUCT":{const u=new l(...a);e=Yy(u)}break;case"ENDPOINT":{const{port1:c,port2:h}=new MessageChannel;d(f,h),e=Xy(c,[c])}break;case"RELEASE":e=void 0;break;default:return}}catch(t){e={value:t,[Oy]:0}}Promise.resolve(e).catch(t=>({value:t,[Oy]:0})).then(t=>{const[e,n]=Ky(t);p.postMessage(Object.assign(Object.assign({},e),{id:i}),n),"RELEASE"===o&&(p.removeEventListener("message",r),Dy(p),Py in f)&&"function"==typeof f[Py]&&f[Py]()}).catch(t=>{const[e,n]=Ky({value:new TypeError("Unserializable return value"),[Oy]:0});p.postMessage(Object.assign(Object.assign({},e),{id:i}),n)})}else console.warn(`Invalid origin '${t.origin}' for comlink proxy`)});p.start&&p.start()}(t,e),[n,[n]]},deserialize(t){return t.start(),By(t)}}],["throw",{canHandle:t=>Iy(t)&&Oy in t,serialize({value:t}){let e;return[e=t instanceof Error?{isError:!0,value:{message:t.message,name:t.name,stack:t.stack}}:{isError:!1,value:t},[]]},deserialize(t){if(t.isError)throw Object.assign(new Error(t.value.message),t.value);throw t.value}}]]);function ky(t,e){for(const n of t){if(e===n||"*"===n)return!0;if(n instanceof RegExp&&n.test(e))return!0}return!1}function Dy(t){"MessagePort"===t.constructor.name&&t.close()}function By(t,e){return function a(s,l=[],t=function(){}){let u=!1;const r=new Proxy(t,{get(t,e){if(Fy(u),e===Cy)return()=>{jy(r),Uy(s),u=!0};if("then"!==e)return a(s,[...l,e]);{if(0===l.length)return{then:()=>r};const n=$y(s,{type:"GET",path:l.map(t=>t.toString())}).then(qy);return n.then.bind(n)}},set(t,e,n){Fy(u);const[r,i]=Ky(n);return $y(s,{type:"SET",path:[...l,e].map(t=>t.toString()),value:r},i).then(qy)},apply(t,e,n){Fy(u);const r=l[l.length-1];if(r===Ny)return $y(s,{type:"ENDPOINT"}).then(qy);if("bind"===r)return a(s,l.slice(0,-1));const[i,o]=zy(n);return $y(s,{type:"APPLY",path:l.map(t=>t.toString()),argumentList:i},o).then(qy)},construct(t,e){Fy(u);const[n,r]=zy(e);return $y(s,{type:"CONSTRUCT",path:l.map(t=>t.toString()),argumentList:n},r).then(qy)}});Vy(r,s);return r}(t,[],e)}function Fy(t){if(t)throw new Error("Proxy has been released and is not useable")}function Uy(t){return $y(t,{type:"RELEASE"}).then(()=>{Dy(t)})}const Gy=new WeakMap,Wy="FinalizationRegistry"in globalThis&&new FinalizationRegistry(t=>{var e=(Gy.get(t)||0)-1;Gy.set(t,e),0==e&&Uy(t)});function Vy(t,e){var n=(Gy.get(e)||0)+1;Gy.set(e,n),Wy&&Wy.register(t,e,t)}function jy(t){Wy&&Wy.unregister(t)}function zy(t){var t=t.map(Ky);return[t.map(t=>t[0]),(t=t.map(t=>t[1]),Array.prototype.concat.apply([],t))]}const Hy=new WeakMap;function Xy(t,e){return Hy.set(t,e),t}function Yy(t){return Object.assign(t,{[Ry]:!0})}function Ky(t){for(var[e,n]of Ly){var r;if(n.canHandle(t))return[n,r]=n.serialize(t),[{type:"HANDLER",name:e,value:n},r]}return[{type:"RAW",value:t},Hy.get(t)||[]]}function qy(t){switch(t.type){case"HANDLER":return Ly.get(t.name).deserialize(t.value);case"RAW":return t.value}}function $y(i,t,e){return new Promise(n=>{const r=new Array(4).fill(0).map(()=>Math.floor(Math.random()*Number.MAX_SAFE_INTEGER).toString(16)).join("-");i.addEventListener("message",function t(e){e.data&&e.data.id&&e.data.id===r&&(i.removeEventListener("message",t),n(e.data))}),i.start&&i.start(),i.postMessage(Object.assign({id:r},t),e)})}P(Jy,Zy=G),Jy.prototype.spawnWorker=function(){this.worker&&this.worker.terminate(),this.worker=By(new Worker(new URL("./worker.js","undefined"==typeof document&&"undefined"==typeof location?new(require("url").URL)("file:"+__filename).href:"undefined"==typeof document?location.href:document.currentScript&&document.currentScript.src||new URL("g6.min.js",document.baseURI).href),{type:"module"})),this.running&&(this.running=!1,this.execute())},Jy.prototype.execute=function(){var r;return s(this,void 0,void 0,function(){var e,n;return U(this,function(t){switch(t.label){case 0:return this.running?[2,this]:(this.running=!0,(n=this.layout.options).onTick,n=I(n,["onTick"]),n={layout:{id:this.layout.id,options:n,iterations:null==(r=this.options)?void 0:r.iterations},nodes:this.graph.getAllNodes(),edges:this.graph.getAllEdges()},e=new Float32Array([0]),[4,this.worker.calculateLayout(n,[e])]);case 1:return n=D.apply(void 0,[t.sent(),1]),[2,n[0]]}})})},Jy.prototype.stop=function(){return this.running=!1,this.worker.stopLayout(),this},Jy.prototype.kill=function(){},Jy.prototype.isRunning=function(){return this.running};var Zy,Qy=Jy;function Jy(t,e,n){var r=Zy.call(this)||this;return r.graph=t,r.layout=e,r.options=n,r.spawnWorker(),r}var t1={nodeSize:30,nodeSpacing:10,preventOverlap:!1,sweep:void 0,equidistant:!1,startAngle:1.5*Math.PI,clockwise:!0,maxLevelDiff:void 0,sortBy:"degree"},e1=(n1.prototype.execute=function(e,n){return s(this,void 0,void 0,function(){return U(this,function(t){return[2,this.genericConcentricLayout(!1,e,n)]})})},n1.prototype.assign=function(e,n){return s(this,void 0,void 0,function(){return U(this,function(t){return this.genericConcentricLayout(!0,e,n),[2]})})},n1.prototype.genericConcentricLayout=function(N,C,P){return s(this,void 0,void 0,function(){var e,r,i,n,o,a,s,l,u,c,h,d,f,p,g,m,v,y,E,_,b,x,S,w,T,A,M,R;return U(this,function(t){if(x=k(k({},this.options),P),m=x.center,u=x.width,c=x.height,S=x.sortBy,e=x.maxLevelDiff,r=x.sweep,i=x.clockwise,n=x.equidistant,o=x.preventOverlap,b=x.startAngle,a=void 0===b?1.5*Math.PI:b,b=x.nodeSize,s=x.nodeSpacing,x=C.getAllNodes(),l=C.getAllEdges(),u=u||"undefined"==typeof window?u:window.innerWidth,c=c||"undefined"==typeof window?c:window.innerHeight,h=m||[u/2,c/2],null==x||!x.length||1===x.length)return[2,Sy(C,N,h)];if(d=[],p=0,f=my(b)?Math.max(b[0],b[1]):b,my(s)?p=Math.max(s[0],s[1]):B(s)&&(p=s),x.forEach(function(t){var e=Ey(t),n=(d.push(e),f),e=e.data;my(e.size)?n=Math.max(e.size[0],e.size[1]):B(e.size)?n=e.size:Ie(e.size)&&(n=Math.max(e.size.width,e.size.height)),f=Math.max(f,n),Ne(s)&&(p=Math.max(s(t),p))}),d.forEach(function(t,e){t.id,e}),Fe(g=S)&&void 0!==d[0].data[g]||(g="degree"),d.sort("degree"===g?function(t,e){return C.getDegree(e.id,"both")-C.getDegree(t.id,"both")}:function(t,e){return e.data[g]-t.data[g]}),m=d[0],v=(e||("degree"===g?C.getDegree(m.id,"both"):m.data[g]))/4,E=(y=[{nodes:[]}])[0],d.forEach(function(t){var e;0<E.nodes.length&&(e="degree"===g?Math.abs(C.getDegree(E.nodes[0].id,"both")-C.getDegree(t.id,"both")):Math.abs(E.nodes[0].data[g]-t.data[g]),v)&&v<=e&&(E={nodes:[]},y.push(E)),E.nodes.push(t)}),_=f+p,o||(b=0<y.length&&1<y[0].nodes.length,x=Math.min(u,c)/2-_,S=x/(y.length+(b?1:0)),_=Math.min(_,S)),w=0,y.forEach(function(t){var e,n=void 0===r?2*Math.PI-2*Math.PI/t.nodes.length:r;t.dTheta=n/Math.max(1,t.nodes.length-1),1<t.nodes.length&&o&&(n=Math.cos(t.dTheta)-Math.cos(0),e=Math.sin(t.dTheta)-Math.sin(0),n=Math.sqrt(_*_/(n*n+e*e)),w=Math.max(n,w)),t.r=w,w+=_}),n){for(M=A=T=0;M<y.length;M++)R=(y[M].r||0)-A,T=Math.max(T,R);A=0,y.forEach(function(t,e){0===e&&(A=t.r||0),t.r=A,A+=T})}return y.forEach(function(t){var n=t.dTheta||0,r=t.r||0;t.nodes.forEach(function(t,e){e=a+(i?1:-1)*n*e;t.data.x=h[0]+r*Math.cos(e),t.data.y=h[1]+r*Math.sin(e)})}),N&&d.forEach(function(t){return C.mergeNodeData(t.id,{x:t.data.x,y:t.data.y})}),[2,{nodes:d,edges:l}]})})},n1);function n1(t){this.options=t=void 0===t?{}:t,this.id="concentric",this.options=k(k({},t1),t)}function r1(t,e,n,r){if(!isNaN(e)&&!isNaN(n)){var i,o,a,s,l,u,c,h,d,f=t._root,p={data:r},g=t._x0,m=t._y0,v=t._x1,y=t._y1;if(f){for(;f.length;)if((u=e>=(o=(g+v)/2))?g=o:v=o,(c=n>=(a=(m+y)/2))?m=a:y=a,!(f=(i=f)[h=c<<1|u]))return i[h]=p,t;if(s=+t._x.call(null,f.data),l=+t._y.call(null,f.data),e===s&&n===l)p.next=f,i?i[h]=p:t._root=p;else{for(;i=i?i[h]=new Array(4):t._root=new Array(4),(u=e>=(o=(g+v)/2))?g=o:v=o,(c=n>=(a=(m+y)/2))?m=a:y=a,(h=c<<1|u)==(d=(a<=l)<<1|o<=s););i[d]=f,i[h]=p}}else t._root=p}return t}function i1(t,e,n,r,i){this.node=t,this.x0=e,this.y0=n,this.x1=r,this.y1=i}function o1(t){return t[0]}function a1(t){return t[1]}function s1(t,e,n){e=new l1(null==e?o1:e,null==n?a1:n,NaN,NaN,NaN,NaN);return null==t?e:e.addAll(t)}function l1(t,e,n,r,i,o){this._x=t,this._y=e,this._x0=n,this._y0=r,this._x1=i,this._y1=o,this._root=void 0}function u1(t){for(var e={data:t.data},n=e;t=t.next;)n=n.next={data:t.data};return e}e=s1.prototype=l1.prototype;function c1(t){return function(){return t}}function h1(t){return 1e-6*(t()-.5)}function d1(t){return t.x+t.vx}function f1(t){return t.y+t.vy}function p1(r){var o,a,d,f=1,p=1;function e(){for(var t,e,s,l,u,c,h,n=o.length,r=0;r<p;++r)for(e=s1(o,d1,f1).visitAfter(g),t=0;t<n;++t)s=o[t],c=a[s.index],h=c*c,l=s.x+s.vx,u=s.y+s.vy,e.visit(i);function i(t,e,n,r,i){var o=t.data,t=t.r,a=c+t;if(!o)return l+a<e||r<l-a||u+a<n||i<u-a;o.index>s.index&&(n=(e=l-o.x-o.vx)*e+(r=u-o.y-o.vy)*r)<a*a&&(0===e&&(n+=(e=h1(d))*e),0===r&&(n+=(r=h1(d))*r),n=(a-(n=Math.sqrt(n)))/n*f,s.vx+=(e*=n)*(a=(t*=t)/(h+t)),s.vy+=(r*=n)*a,o.vx-=e*(a=1-a),o.vy-=r*a)}}function g(t){if(t.data)return t.r=a[t.data.index];for(var e=t.r=0;e<4;++e)t[e]&&t[e].r>t.r&&(t.r=t[e].r)}function n(){if(o){var t,e,n=o.length;for(a=new Array(n),t=0;t<n;++t)e=o[t],a[e.index]=+r(e,t,o)}}return"function"!=typeof r&&(r=c1(null==r?1:+r)),e.initialize=function(t,e){o=t,d=e,n()},e.iterations=function(t){return arguments.length?(p=+t,e):p},e.strength=function(t){return arguments.length?(f=+t,e):f},e.radius=function(t){return arguments.length?(r="function"==typeof t?t:c1(+t),n(),e):r},e}function g1(t){return t.index}function m1(t,e){t=t.get(e);if(t)return t;throw new Error("node not found: "+e)}function v1(u){var c,h,o,a,d,f,s=g1,n=function(t){return 1/Math.min(a[t.source.index],a[t.target.index])},r=c1(30),p=1;function e(t){for(var e=0,n=u.length;e<p;++e)for(var r,i,o,a,s,l=0;l<n;++l)r=(i=u[l]).source,o=(i=i.target).x+i.vx-r.x-r.vx||h1(f),a=i.y+i.vy-r.y-r.vy||h1(f),o*=s=((s=Math.sqrt(o*o+a*a))-h[l])/s*t*c[l],a*=s,i.vx-=o*(s=d[l]),i.vy-=a*s,r.vx+=o*(s=1-s),r.vy+=a*s}function i(){if(o){var t,e=o.length,n=u.length,r=new Map(o.map((t,e)=>[s(t,e,o),t])),i=0;for(a=new Array(e);i<n;++i)(t=u[i]).index=i,"object"!=typeof t.source&&(t.source=m1(r,t.source)),"object"!=typeof t.target&&(t.target=m1(r,t.target)),a[t.source.index]=(a[t.source.index]||0)+1,a[t.target.index]=(a[t.target.index]||0)+1;for(i=0,d=new Array(n);i<n;++i)t=u[i],d[i]=a[t.source.index]/(a[t.source.index]+a[t.target.index]);c=new Array(n),l(),h=new Array(n),g()}}function l(){if(o)for(var t=0,e=u.length;t<e;++t)c[t]=+n(u[t],t,u)}function g(){if(o)for(var t=0,e=u.length;t<e;++t)h[t]=+r(u[t],t,u)}return null==u&&(u=[]),e.initialize=function(t,e){o=t,f=e,i()},e.links=function(t){return arguments.length?(u=t,i(),e):u},e.id=function(t){return arguments.length?(s=t,e):s},e.iterations=function(t){return arguments.length?(p=+t,e):p},e.strength=function(t){return arguments.length?(n="function"==typeof t?t:c1(+t),l(),e):n},e.distance=function(t){return arguments.length?(r="function"==typeof t?t:c1(+t),g(),e):r},e}e.copy=function(){var t,e,n=new l1(this._x,this._y,this._x0,this._y0,this._x1,this._y1),r=this._root;if(r)if(r.length)for(t=[{source:r,target:n._root=new Array(4)}];r=t.pop();)for(var i=0;i<4;++i)(e=r.source[i])&&(e.length?t.push({source:e,target:r.target[i]=new Array(4)}):r.target[i]=u1(e));else n._root=u1(r);return n},e.add=function(t){var e=+this._x.call(null,t),n=+this._y.call(null,t);return r1(this.cover(e,n),e,n,t)},e.addAll=function(t){for(var e,n,r=t.length,i=new Array(r),o=new Array(r),a=1/0,s=1/0,l=-1/0,u=-1/0,c=0;c<r;++c)isNaN(e=+this._x.call(null,n=t[c]))||isNaN(n=+this._y.call(null,n))||((i[c]=e)<a&&(a=e),l<e&&(l=e),(o[c]=n)<s&&(s=n),u<n&&(u=n));if(!(l<a||u<s))for(this.cover(a,s).cover(l,u),c=0;c<r;++c)r1(this,i[c],o[c],t[c]);return this},e.cover=function(t,e){if(!isNaN(t=+t)&&!isNaN(e=+e)){var n=this._x0,r=this._y0,i=this._x1,o=this._y1;if(isNaN(n))i=(n=Math.floor(t))+1,o=(r=Math.floor(e))+1;else{for(var a,s,l=i-n||1,u=this._root;t<n||i<=t||e<r||o<=e;)switch(s=(e<r)<<1|t<n,(a=new Array(4))[s]=u,u=a,l*=2,s){case 0:i=n+l,o=r+l;break;case 1:n=i-l,o=r+l;break;case 2:i=n+l,r=o-l;break;case 3:n=i-l,r=o-l}this._root&&this._root.length&&(this._root=u)}this._x0=n,this._y0=r,this._x1=i,this._y1=o}return this},e.data=function(){var e=[];return this.visit(function(t){if(!t.length)for(;e.push(t.data),t=t.next;);}),e},e.extent=function(t){return arguments.length?this.cover(+t[0][0],+t[0][1]).cover(+t[1][0],+t[1][1]):isNaN(this._x0)?void 0:[[this._x0,this._y0],[this._x1,this._y1]]},e.find=function(t,e,n){var r,i,o,a,s,l,u,c,h=this._x0,d=this._y0,f=this._x1,p=this._y1,g=[],m=this._root;for(m&&g.push(new i1(m,h,d,f,p)),null==n?n=1/0:(h=t-n,d=e-n,f=t+n,p=e+n,n*=n);r=g.pop();)!(m=r.node)||(s=r.x0)>f||(l=r.y0)>p||(a=r.x1)<h||(i=r.y1)<d||(m.length?(g.push(new i1(m[3],o=(s+a)/2,u=(l+i)/2,a,i),new i1(m[2],s,u,o,i),new i1(m[1],o,l,a,u),new i1(m[0],s,l,o,u)),(i=(u<=e)<<1|o<=t)&&(r=g[g.length-1],g[g.length-1]=g[g.length-1-i],g[g.length-1-i]=r)):(l=(a=t-+this._x.call(null,m.data))*a+(s=e-+this._y.call(null,m.data))*s)<n&&(h=t-(u=Math.sqrt(n=l)),d=e-u,f=t+u,p=e+u,c=m.data));return c},e.remove=function(t){if(!isNaN(o=+this._x.call(null,t))&&!isNaN(a=+this._y.call(null,t))){var e,n,r,i,o,a,s,l,u,c,h,d=this._root,f=this._x0,p=this._y0,g=this._x1,m=this._y1;if(d){if(d.length)for(;;){if((l=o>=(s=(f+g)/2))?f=s:g=s,(u=a>=(s=(p+m)/2))?p=s:m=s,!(d=(e=d)[c=u<<1|l]))return this;if(!d.length)break;(e[c+1&3]||e[c+2&3]||e[c+3&3])&&(n=e,h=c)}for(;d.data!==t;)if(!(d=(r=d).next))return this;(i=d.next)&&delete d.next,r?i?r.next=i:delete r.next:e?(i?e[c]=i:delete e[c],(d=e[0]||e[1]||e[2]||e[3])&&d===(e[3]||e[2]||e[1]||e[0])&&!d.length&&(n?n[h]=d:this._root=d)):this._root=i}}return this},e.removeAll=function(t){for(var e=0,n=t.length;e<n;++e)this.remove(t[e]);return this},e.root=function(){return this._root},e.size=function(){var e=0;return this.visit(function(t){if(!t.length)for(;++e,t=t.next;);}),e},e.visit=function(t){var e,n,r,i,o,a,s,l=[],u=this._root;for(u&&l.push(new i1(u,this._x0,this._y0,this._x1,this._y1));o=l.pop();)!t(u=o.node,n=o.x0,r=o.y0,i=o.x1,o=o.y1)&&u.length&&(a=(n+i)/2,s=(r+o)/2,(e=u[3])&&l.push(new i1(e,a,s,i,o)),(e=u[2])&&l.push(new i1(e,n,s,a,o)),(e=u[1])&&l.push(new i1(e,a,r,i,s)),e=u[0])&&l.push(new i1(e,n,r,a,s));return this},e.visitAfter=function(t){var e,n=[],r=[];for(this._root&&n.push(new i1(this._root,this._x0,this._y0,this._x1,this._y1));e=n.pop();){var i,o,a,s,l,u,c,h=e.node;h.length&&(o=e.x0,a=e.y0,u=(o+(s=e.x1))/2,c=(a+(l=e.y1))/2,(i=h[0])&&n.push(new i1(i,o,a,u,c)),(i=h[1])&&n.push(new i1(i,u,a,s,c)),(i=h[2])&&n.push(new i1(i,o,c,u,l)),i=h[3])&&n.push(new i1(i,u,c,s,l)),r.push(e)}for(;e=r.pop();)t(e.node,e.x0,e.y0,e.x1,e.y1);return this},e.x=function(t){return arguments.length?(this._x=t,this):this._x},e.y=function(t){return arguments.length?(this._y=t,this):this._y};var y1={value:()=>{}};function E1(){for(var t,e=0,n=arguments.length,r={};e<n;++e){if(!(t=arguments[e]+"")||t in r||/[\s.]/.test(t))throw new Error("illegal type: "+t);r[t]=[]}return new _1(r)}function _1(t){this._=t}function b1(t,e,n){for(var r=0,i=t.length;r<i;++r)if(t[r].name===e){t[r]=y1,t=t.slice(0,r).concat(t.slice(r+1));break}return null!=n&&t.push({name:e,value:n}),t}_1.prototype=E1.prototype={constructor:_1,on:function(t,e){var n,r,i=this._,o=(r=i,(t+"").trim().split(/^|\s+/).map(function(t){var e="",n=t.indexOf(".");if(0<=n&&(e=t.slice(n+1),t=t.slice(0,n)),t&&!r.hasOwnProperty(t))throw new Error("unknown type: "+t);return{type:t,name:e}})),a=-1,s=o.length;if(!(arguments.length<2)){if(null!=e&&"function"!=typeof e)throw new Error("invalid callback: "+e);for(;++a<s;)if(n=(t=o[a]).type)i[n]=b1(i[n],t.name,e);else if(null==e)for(n in i)i[n]=b1(i[n],t.name,null);return this}for(;++a<s;)if(n=(n=(t=o[a]).type)&&function(t,e){for(var n,r=0,i=t.length;r<i;++r)if((n=t[r]).name===e)return n.value}(i[n],t.name))return n},copy:function(){var t,e={},n=this._;for(t in n)e[t]=n[t].slice();return new _1(e)},call:function(t,e){if(0<(n=arguments.length-2))for(var n,r,i=new Array(n),o=0;o<n;++o)i[o]=arguments[o+2];if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(o=0,n=(r=this._[t]).length;o<n;++o)r[o].value.apply(e,i)},apply:function(t,e,n){if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(var r=this._[t],i=0,o=r.length;i<o;++i)r[i].value.apply(e,n)}};var x1,S1,w1=0,T1=0,A1=0,M1=1e3,R1=0,N1=0,C1=0,P1="object"==typeof performance&&performance.now?performance:Date,O1="object"==typeof window&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(t){setTimeout(t,17)};function I1(){return N1||(O1(L1),N1=P1.now()+C1)}function L1(){N1=0}function k1(){this._call=this._time=this._next=null}function D1(t,e,n){var r=new k1;return r.restart(t,e,n),r}function B1(){N1=(R1=P1.now())+C1,w1=T1=0;try{I1(),++w1;for(var t,e=x1;e;)0<=(t=N1-e._time)&&e._call.call(void 0,t),e=e._next;--w1}finally{for(var n,r,i=x1,o=1/(w1=0);i;)i=i._call?(o>i._time&&(o=i._time),(n=i)._next):(r=i._next,i._next=null,n?n._next=r:x1=r);S1=n,U1(o),N1=0}}function F1(){var t=P1.now(),e=t-R1;M1<e&&(C1-=e,R1=t)}function U1(t){w1||(T1=T1&&clearTimeout(T1),24<t-N1?(t<1/0&&(T1=setTimeout(B1,t-P1.now()-C1)),A1=A1&&clearInterval(A1)):(A1||(R1=P1.now(),A1=setInterval(F1,M1)),w1=1,O1(B1)))}k1.prototype=D1.prototype={constructor:k1,restart:function(t,e,n){if("function"!=typeof t)throw new TypeError("callback is not a function");n=(null==n?I1():+n)+(null==e?0:+e),this._next||S1===this||(S1?S1._next=this:x1=this,S1=this),this._call=t,this._time=n,U1()},stop:function(){this._call&&(this._call=null,this._time=1/0,U1())}};const G1=1664525,W1=1013904223,V1=4294967296;function j1(t){return t.x}function z1(t){return t.y}var H1=10,X1=Math.PI*(3-Math.sqrt(5));function Y1(l){var o,a=1,e=.001,s=1-Math.pow(e,1/300),u=0,c=.6,h=new Map,t=D1(i),n=E1("tick","end"),r=function(){let t=1;return()=>(t=(G1*t+W1)%V1)/V1}();function i(){d(),n.call("tick",o),a<e&&(t.stop(),n.call("end",o))}function d(t){var e,n,r=l.length;void 0===t&&(t=1);for(var i=0;i<t;++i)for(a+=(u-a)*s,h.forEach(function(t){t(a)}),e=0;e<r;++e)null==(n=l[e]).fx?n.x+=n.vx*=c:(n.x=n.fx,n.vx=0),null==n.fy?n.y+=n.vy*=c:(n.y=n.fy,n.vy=0);return o}function f(){for(var t,e,n,r=0,i=l.length;r<i;++r)(n=l[r]).index=r,null!=n.fx&&(n.x=n.fx),null!=n.fy&&(n.y=n.fy),(isNaN(n.x)||isNaN(n.y))&&(t=H1*Math.sqrt(.5+r),e=r*X1,n.x=t*Math.cos(e),n.y=t*Math.sin(e)),(isNaN(n.vx)||isNaN(n.vy))&&(n.vx=n.vy=0)}function p(t){return t.initialize&&t.initialize(l,r),t}return null==l&&(l=[]),f(),o={tick:d,restart:function(){return t.restart(i),o},stop:function(){return t.stop(),o},nodes:function(t){return arguments.length?(l=t,f(),h.forEach(p),o):l},alpha:function(t){return arguments.length?(a=+t,o):a},alphaMin:function(t){return arguments.length?(e=+t,o):e},alphaDecay:function(t){return arguments.length?(s=+t,o):+s},alphaTarget:function(t){return arguments.length?(u=+t,o):u},velocityDecay:function(t){return arguments.length?(c=1-t,o):1-c},randomSource:function(t){return arguments.length?(r=t,h.forEach(p),o):r},force:function(t,e){return 1<arguments.length?(null==e?h.delete(t):h.set(t,p(e)),o):h.get(t)},find:function(t,e,n){var r,i,o,a=0,s=l.length;for(null==n?n=1/0:n*=n,a=0;a<s;++a)(r=(r=t-(i=l[a]).x)*r+(r=e-i.y)*r)<n&&(o=i,n=r);return o},on:function(t,e){return 1<arguments.length?(n.on(t,e),o):n.on(t)}}}function K1(){var i,l,u,c,h,r=c1(-30),d=1,f=1/0,p=.81;function e(t){var e,n=i.length,r=s1(i,j1,z1).visitAfter(o);for(c=t,e=0;e<n;++e)l=i[e],r.visit(a)}function n(){if(i){var t,e,n=i.length;for(h=new Array(n),t=0;t<n;++t)e=i[t],h[e.index]=+r(e,t,i)}}function o(t){var e,n,r,i,o,a=0,s=0;if(t.length){for(r=i=o=0;o<4;++o)(e=t[o])&&(n=Math.abs(e.value))&&(a+=e.value,s+=n,r+=n*e.x,i+=n*e.y);t.x=r/s,t.y=i/s}else for((e=t).x=e.data.x,e.y=e.data.y;a+=h[e.data.index],e=e.next;);t.value=a}function a(t,e,n,r){if(!t.value)return!0;var i=t.x-l.x,o=t.y-l.y,a=r-e,s=i*i+o*o;if(a*a/p<s)return s<f&&(0===i&&(s+=(i=h1(u))*i),0===o&&(s+=(o=h1(u))*o),s<d&&(s=Math.sqrt(d*s)),l.vx+=i*t.value*c/s,l.vy+=o*t.value*c/s),!0;if(!(t.length||f<=s))for((t.data!==l||t.next)&&(0===i&&(s+=(i=h1(u))*i),0===o&&(s+=(o=h1(u))*o),s<d)&&(s=Math.sqrt(d*s));t.data!==l&&(a=h[t.data.index]*c/s,l.vx+=i*a,l.vy+=o*a),t=t.next;);}return e.initialize=function(t,e){i=t,u=e,n()},e.strength=function(t){return arguments.length?(r="function"==typeof t?t:c1(+t),n(),e):r},e.distanceMin=function(t){return arguments.length?(d=t*t,e):Math.sqrt(d)},e.distanceMax=function(t){return arguments.length?(f=t*t,e):Math.sqrt(f)},e.theta=function(t){return arguments.length?(p=t*t,e):Math.sqrt(p)},e}function q1(){function e(t){return function(){return t}}var o,s=function(t){return t.cluster},l=e(1),n=e(-1),r=e(100),i=e(.1),a=[0,0],u=[],c={},h=[],d=100,f=100,p={none:{x:0,y:0}},g=[],m="force",v=!0,y=.1;function E(t){if(!v)return E;o.tick(),b();for(var e=0,n=u.length,r=void 0,i=t*y;e<n;++e)(r=u[e]).vx+=(p[s(r)].x-r.x)*i,r.vy+=(p[s(r)].y-r.y)*i}function _(){if(u&&u.length){if(void 0===s(u[0]))throw Error("Couldnt find the grouping attribute for the nodes. Make sure to set it up with forceInBox.groupBy('clusterAttr') before calling .links()");var t=function(){var r=[],i=[],o={},a={},t=[];return a=function(t){var r={};return t.forEach(function(t){t=s(t);r[t]||(r[t]={count:0,sumforceNodeSize:0})}),t.forEach(function(t){var e=s(t),t=l(t),n=r[e];n.count=n.count+1,n.sumforceNodeSize=n.sumforceNodeSize+Math.PI*(t*t)*1.3,r[e]=n}),r}(u),t=function(t){var n={},r=[];return t.forEach(function(t){e=(t=t).source,t=t.target,e=s(c[e]),t=s(c[t]);var t=e<=t?e+"~"+t:t+"~"+e,e=0;void 0!==n[t]&&(e=n[t]),n[t]=e+=1}),Object.entries(n).forEach(function(t){var t=D(t,2),e=t[0],t=t[1],n=e.split("~")[0],e=e.split("~")[1];void 0!==n&&void 0!==e&&r.push({source:n,target:e,count:t})}),r}(h),Object.keys(a).forEach(function(t,e){var n=a[t];r.push({id:t,size:n.count,r:Math.sqrt(n.sumforceNodeSize/Math.PI)}),o[t]=e}),t.forEach(function(t){var e=t.source,n=t.target,e=o[e],n=o[n];void 0!==e&&void 0!==n&&i.push({source:e,target:n,count:t.count})}),{nodes:r,links:i}}();o=Y1(t.nodes).force("x",function(n){var i,o,a,r=c1(.1);function e(t){for(var e,n=0,r=i.length;n<r;++n)(e=i[n]).vx+=(a[n]-e.x)*o[n]*t}function s(){if(i){var t,e=i.length;for(o=new Array(e),a=new Array(e),t=0;t<e;++t)o[t]=isNaN(a[t]=+n(i[t],t,i))?0:+r(i[t],t,i)}}return"function"!=typeof n&&(n=c1(null==n?0:+n)),e.initialize=function(t){i=t,s()},e.strength=function(t){return arguments.length?(r="function"==typeof t?t:c1(+t),s(),e):r},e.x=function(t){return arguments.length?(n="function"==typeof t?t:c1(+t),s(),e):n},e}(d).strength(.1)).force("y",function(n){var i,o,a,r=c1(.1);function e(t){for(var e,n=0,r=i.length;n<r;++n)(e=i[n]).vy+=(a[n]-e.y)*o[n]*t}function s(){if(i){var t,e=i.length;for(o=new Array(e),a=new Array(e),t=0;t<e;++t)o[t]=isNaN(a[t]=+n(i[t],t,i))?0:+r(i[t],t,i)}}return"function"!=typeof n&&(n=c1(null==n?0:+n)),e.initialize=function(t){i=t,s()},e.strength=function(t){return arguments.length?(r="function"==typeof t?t:c1(+t),s(),e):r},e.y=function(t){return arguments.length?(n="function"==typeof t?t:c1(+t),s(),e):n},e}(f).strength(.1)).force("collide",p1(function(t){return t.r}).iterations(4)).force("charge",K1().strength(n)).force("links",v1(t.nodes.length?t.links:[]).distance(r).strength(i)),g=o.nodes(),b()}}function b(){return p={none:{x:0,y:0}},g.forEach(function(t){p[t.id]={x:t.x-a[0],y:t.y-a[1]}}),p}return E.initialize=function(t){u=t,_()},E.template=function(t){return arguments.length?(m=t,_(),E):m},E.groupBy=function(e){return arguments.length?(s="string"==typeof e?function(t){return t[e]}:e,E):s},E.enableGrouping=function(t){return arguments.length?(v=t,E):v},E.strength=function(t){return arguments.length?(y=t,E):y},E.centerX=function(t){return arguments.length?(d=t,E):d},E.centerY=function(t){return arguments.length?(f=t,E):f},E.nodes=function(t){return arguments.length?(c={},(t||[]).forEach(function(t){c[t.id]=t}),u=t||[],E):u},E.links=function(t){return arguments.length?(h=t||[],_(),E):h},E.nodeSize=E.forceNodeSize=function(t){return arguments.length?(l="function"==typeof t?t:e(+t),_(),E):l},E.forceCharge=function(t){return arguments.length?(n="function"==typeof t?t:e(+t),_(),E):n},E.forceLinkDistance=function(t){return arguments.length?(r="function"==typeof t?t:e(+t),_(),E):r},E.forceLinkStrength=function(t){return arguments.length?(i="function"==typeof t?t:e(+t),_(),E):i},E.offset=function(t){return arguments.length?(a=t,E):a},E.getFocis=b,E}var $1={center:[0,0],preventOverlap:!1,nodeSize:void 0,nodeSpacing:void 0,linkDistance:50,forceSimulation:null,alphaDecay:.028,alphaMin:.001,alpha:.3,collideStrength:1,clustering:!1,clusterNodeStrength:-1,clusterEdgeStrength:.1,clusterEdgeDistance:100,clusterFociStrength:.8,clusterNodeSize:10},Us=(Z1.prototype.execute=function(e,n){return s(this,void 0,void 0,function(){return U(this,function(t){return[2,this.genericForceLayout(!1,e,n)]})})},Z1.prototype.assign=function(e,n){return s(this,void 0,void 0,function(){return U(this,function(t){return this.genericForceLayout(!0,e,n),[2]})})},Z1.prototype.stop=function(){var t;null!=(t=this.forceSimulation)&&t.stop()},Z1.prototype.tick=function(t){var e=this,t=(this.forceSimulation.tick(t=void 0===t?1:t),{nodes:tE(this.lastLayoutNodes),edges:eE(this.lastLayoutEdges)});return this.lastAssign&&t.nodes.forEach(function(t){return e.lastGraph.mergeNodeData(t.id,{x:t.data.x,y:t.data.y})}),t},Z1.prototype.genericForceLayout=function(I,L,i){return s(this,void 0,void 0,function(){var e,h,d,f,p,g,m,v,y,E,_,b,x,S,w,n,T,r,A,M,R,N,C,P,O=this;return U(this,function(t){return e=k(k({},this.options),i),n=L.getAllNodes(),r=L.getAllEdges(),h=n.map(function(t){var e;return k(k({},Ey(t)),{x:null==(e=t.data)?void 0:e.x,y:null==(e=t.data)?void 0:e.y})}),d=r.map(function(t){return Ey(t)}),this.lastLayoutNodes=h,this.lastLayoutEdges=d,this.lastAssign=I,this.lastGraph=L,f=e.alphaMin,p=e.alphaDecay,g=e.alpha,m=e.nodeStrength,v=e.edgeStrength,y=e.linkDistance,E=e.clustering,_=e.clusterFociStrength,b=e.clusterEdgeDistance,x=e.clusterEdgeStrength,S=e.clusterNodeStrength,w=e.clusterNodeSize,n=e.collideStrength,T=void 0===n?1:n,r=e.center,A=void 0===r?[0,0]:r,M=e.preventOverlap,R=e.nodeSize,N=e.nodeSpacing,C=e.onTick,P=e.forceSimulation,[2,new Promise(function(e){if(P){E&&((r=q1()).nodes(h),r.links(d)),P.nodes(h),d&&(i=v1().id(function(t){return t.id}).links(d),v&&i.strength(v),y&&i.distance(y),P.force("link",i)),M&&O.overlapProcess(P,{nodeSize:R,nodeSpacing:N,collideStrength:T}),P.alpha(g).restart();var t=tE(h),n=eE(d);I&&t.forEach(function(t){return L.mergeNodeData(t.id,{x:t.data.x,y:t.data.y})}),e({nodes:t,edges:n})}else try{var r,i,o=K1();m&&o.strength(m),P=Y1().nodes(h),E&&((r=q1()).centerX(A[0]).centerY(A[1]).template("force").strength(_),d&&r.links(d),h&&r.nodes(h),r.forceLinkDistance(b).forceLinkStrength(x).forceCharge(S).forceNodeSize(w),P.force("group",r)),P.force("center",(s=A[0],l=A[1],c=1,null==s&&(s=0),null==l&&(l=0),a.initialize=function(t){u=t},a.x=function(t){return arguments.length?(s=+t,a):s},a.y=function(t){return arguments.length?(l=+t,a):l},a.strength=function(t){return arguments.length?(c=+t,a):c},a)).force("charge",o).alpha(g).alphaDecay(p).alphaMin(f),M&&O.overlapProcess(P,{nodeSize:R,nodeSpacing:N,collideStrength:T}),d&&(i=v1().id(function(t){return t.id}).links(d),v&&i.strength(v),y&&i.distance(y),P.force("link",i)),P.on("tick",function(){var t=tE(h);null!=C&&C({nodes:t,edges:eE(d)}),I&&t.forEach(function(t){return L.mergeNodeData(t.id,{x:t.data.x,y:t.data.y})})}).on("end",function(){var t=tE(h);I&&t.forEach(function(t){return L.mergeNodeData(t.id,{x:t.data.x,y:t.data.y})}),e({nodes:t,edges:eE(d)})})}catch(t){console.warn(t)}function a(){for(var t,e=u.length,n=0,r=0,i=0;i<e;++i)n+=(t=u[i]).x,r+=t.y;for(n=(n/e-s)*c,r=(r/e-l)*c,i=0;i<e;++i)(t=u[i]).x-=n,t.y-=r}var s,l,u,c;O.forceSimulation=P})]})})},Z1.prototype.overlapProcess=function(t,e){var n,r,i,o=e.nodeSize,a=e.nodeSpacing,e=e.collideStrength,s=B(a)?function(){return a}:Ne(a)?a:function(){return 0};r=o?Ne(o)?function(t){return o(t)+s(t)}:my(o)?(n=(o[0]>o[1]?o[0]:o[1])/2,function(t){return n+s(t)}):B(o)?(i=o/2,function(t){return i+s(t)}):function(){return 10}:function(t){return t.size?my(t.size)?(t.size[0]>t.size[1]?t.size[0]:t.size[1])/2+s(t):Ie(t.size)?(t.size.width>t.size.height?t.size.width:t.size.height)/2+s(t):t.size/2+s(t):10+s(t)},t.force("collisionForce",p1(r).strength(e))},Z1);function Z1(t){this.options=t=void 0===t?{}:t,this.id="d3force",this.options=k(k({},$1),t)}function Q1(t,e){if("next"!==t&&"prev"!==t)return e}function J1(t){t.prev.next=t.next,t.next.prev=t.prev,delete t.next,delete t.prev}var tE=function(t){return t.map(function(t){var e=t.x,n=t.y,t=I(t,["x","y"]);return k(k({},t),{data:k(k({},t.data),{x:e,y:n})})})},eE=function(t){return t.map(function(t){var e=t.source,n=t.target,t=I(t,["source","target"]);return k(k({},t),{source:e.id,target:n.id})})};function nE(){var t={};(t.prev=t).next=t.prev,this.shortcut=t}nE.prototype.dequeue=function(){var t=this.shortcut,e=t.prev;if(e&&e!==t)return J1(e),e},nE.prototype.enqueue=function(t){var e=this.shortcut;t.prev&&t.next&&J1(t),t.next=e.next,e.next.prev=t,(e.next=t).prev=e},nE.prototype.toString=function(){for(var t=[],e=this.shortcut,n=e.prev;n!==e;)t.push(JSON.stringify(n,Q1)),n=null==n?void 0:n.prev;return"["+t.join(", ")+"]"};P(oE,rE=nE);var rE,iE=oE;function oE(){return null!==rE&&rE.apply(this,arguments)||this}var aE=function(){return 1},sE=function(t,e){return t.getAllNodes().length<=1?[]:(e=cE(t,e||aE),null==(e=lE(e.graph,e.buckets,e.zeroIdx).map(function(e){return t.getRelatedEdges(e.v,"out").filter(function(t){return t.target===e.w})}))?void 0:e.flat())},lE=function(t,e,n){for(var r,i=[],o=e[e.length-1],a=e[0];t.getAllNodes().length;){for(;r=a.dequeue();)uE(t,e,n,r);for(;r=o.dequeue();)uE(t,e,n,r);if(t.getAllNodes().length)for(var s=e.length-2;0<s;--s)if(r=e[s].dequeue()){i=i.concat(uE(t,e,n,r,!0));break}}return i},uE=function(r,i,o,t,a){var e,s=[];return r.hasNode(t.v)&&(null!=(e=r.getRelatedEdges(t.v,"in"))&&e.forEach(function(t){var e=t.data.weight,n=r.getNode(t.source);a&&s.push({v:t.source,w:t.target,in:0,out:0}),void 0===n.data.out&&(n.data.out=0),n.data.out-=e,hE(i,o,k({v:n.id},n.data))}),null!=(e=r.getRelatedEdges(t.v,"out"))&&e.forEach(function(t){var e=t.data.weight,t=t.target,t=r.getNode(t);void 0===t.data.in&&(t.data.in=0),t.data.in-=e,hE(i,o,k({v:t.id},t.data))}),r.removeNode(t.v)),a?s:void 0},cE=function(t,r){for(var i=new fy,o=0,a=0,e=(t.getAllNodes().forEach(function(t){i.addNode({id:t.id,data:{v:t.id,in:0,out:0}})}),t.getAllEdges().forEach(function(e){var t=i.getRelatedEdges(e.source,"out").find(function(t){return t.target===e.target}),n=(null==r?void 0:r(e))||1;t?i.updateEdgeData(null==t?void 0:t.id,k(k({},t.data),{weight:t.data.weight+n})):i.addEdge({id:e.id,source:e.source,target:e.target,data:{weight:n}}),a=Math.max(a,i.getNode(e.source).data.out+=n),o=Math.max(o,i.getNode(e.target).data.in+=n)}),[]),n=a+o+3,s=0;s<n;s++)e.push(new iE);var l=o+1;return i.getAllNodes().forEach(function(t){hE(e,l,k({v:t.id},i.getNode(t.id).data))}),{buckets:e,zeroIdx:l,graph:i}},hE=function(t,e,n){(n.out?n.in?t[n.out-n.in+e]:t[t.length-1]:t[0]).enqueue(n)},dE=function(n,t){t="greedy"===t?sE(n,function(t){return t.data.weight||1}):fE(n);null!=t&&t.forEach(function(t){var e=t.data;n.removeEdge(t.id),e.forwardName=t.data.name,e.reversed=!0,n.addEdge({id:t.id,source:t.target,target:t.source,data:k({},e)})})},fE=function(e){function n(t){o[t]||(i[t]=o[t]=!0,e.getRelatedEdges(t,"out").forEach(function(t){i[t.target]?r.push(t):n(t.target)}),delete i[t])}var r=[],i={},o={};return e.getAllNodes().forEach(function(t){return n(t.id)}),r},pE=function(r){r.getAllEdges().forEach(function(t){var e,n=t.data;n.reversed&&(r.removeEdge(t.id),e=n.forwardName,delete n.reversed,delete n.forwardName,r.addEdge({id:t.id,source:t.target,target:t.source,data:k(k({},n),{forwardName:e})}))})},gE=function(t,e){return Number(t)-Number(e)},mE=function(t,e,n,r){for(var i;i=""+r+Math.random(),t.hasNode(i););return n.dummy=e,t.addNode({id:i,data:n}),i},vE=function(t){var n=new fy;return t.getAllNodes().forEach(function(t){n.addNode(k({},t))}),t.getAllEdges().forEach(function(e){var t=n.getRelatedEdges(e.source,"out").find(function(t){return t.target===e.target});t?n.updateEdgeData(null==t?void 0:t.id,k(k({},t.data),{weight:t.data.weight+e.data.weight||0,minlen:Math.max(t.data.minlen,e.data.minlen||1)})):n.addEdge({id:e.id,source:e.source,target:e.target,data:{weight:e.data.weight||0,minlen:e.data.minlen||1}})}),n},yE=function(e){var n=new fy;return e.getAllNodes().forEach(function(t){e.getChildren(t.id).length||n.addNode(k({},t))}),e.getAllEdges().forEach(function(t){n.addEdge(t)}),n},EE=function(t,r){return null==t?void 0:t.reduce(function(t,e,n){return t[e]=r[n],t},{})},_E=function(t,e){var n,r=Number(t.x),i=Number(t.y),o=Number(e.x)-r,e=Number(e.y)-i,a=Number(t.width)/2,t=Number(t.height)/2;return o||e?(t=Math.abs(e)*a>Math.abs(o)*t?(n=(t=e<0?-t:t)*o/e,t):(n=a=o<0?-a:a)*e/o,{x:r+n,y:i+t}):{x:0,y:0}},bE=function(n){for(var r=[],t=TE(n)+1,e=0;e<t;e++)r.push([]);n.getAllNodes().forEach(function(t){var e=t.data.rank;void 0!==e&&r[e]&&r[e].push(t.id)});for(e=0;e<t;e++)r[e]=r[e].sort(function(t,e){return gE(n.getNode(t).data.order,n.getNode(e).data.order)});return r},xE=function(t){var e=t.getAllNodes().filter(function(t){return void 0!==t.data.rank}).map(function(t){return t.data.rank}),n=Math.min.apply(Math,O([],D(e)));t.getAllNodes().forEach(function(t){t.data.hasOwnProperty("rank")&&n!==1/0&&(t.data.rank-=n)})},SE=function(e,t){void 0===t&&(t=0);for(var n=e.getAllNodes(),r=n.filter(function(t){return void 0!==t.data.rank}).map(function(t){return t.data.rank}),i=Math.min.apply(Math,O([],D(r))),o=[],a=(n.forEach(function(t){var e=(t.data.rank||0)-i;o[e]||(o[e]=[]),o[e].push(t.id)}),0),s=0;s<o.length;s++){var l=o[s];void 0===l?s%t!=0&&--a:a&&null!=l&&l.forEach(function(t){t=e.getNode(t);t&&(t.data.rank=t.data.rank||0,t.data.rank+=a)})}},wE=function(t,e,n,r){var i={width:0,height:0};return B(n)&&B(r)&&(i.rank=n,i.order=r),mE(t,"border",i,e)},TE=function(t){var e;return t.getAllNodes().forEach(function(t){t=t.data.rank;void 0!==t&&(void 0===e||e<t)&&(e=t)}),e=e||0},AE=function(t,e){var n={lhs:[],rhs:[]};return null!=t&&t.forEach(function(t){(e(t)?n.lhs:n.rhs).push(t)}),n},ME=function(t,r){return t.reduce(function(t,e){var n=r(t);return r(e)<n?e:t})},RE=function(e,t,n,r,i,o){r.includes(t.id)||(r.push(t.id),n||o.push(t.id),i(t.id).forEach(function(t){return RE(e,t,n,r,i,o)}),n&&o.push(t.id))},NE=function(e,t,n,r){function i(t){return r?e.getSuccessors(t):e.getNeighbors(t)}var t=Array.isArray(t)?t:[t],o=[],a=[];return t.forEach(function(t){if(!e.hasNode(t.id))throw new Error("Graph does not have node: "+t);RE(e,t,"post"===n,a,i,o)}),o},CE="edge",PE="edge-label",OE=function(e,n){e.getAllEdges().forEach(function(t){return IE(e,t,n)})},IE=function(t,e,n){var r,i,o,a=e.source,s=t.getNode(a).data.rank,l=e.target,u=t.getNode(l).data.rank,c=e.data.labelRank;if(u!==s+1){for(t.removeEdge(e.id),o=0,++s;s<u;++o,++s)e.data.points=[],r=mE(t,CE,i={originalEdge:e,width:0,height:0,rank:s},"_d"),s===c&&(i.width=e.data.width,i.height=e.data.height,i.dummy=PE,i.labelpos=e.data.labelpos),t.addEdge({id:"e"+Math.random(),source:a,target:r,data:{weight:e.data.weight}}),0===o&&n.push(r),a=r;t.addEdge({id:"e"+Math.random(),source:a,target:l,data:{weight:e.data.weight}})}},LE=function(o,t){t.forEach(function(t){for(var e,n=o.getNode(t),r=n.data.originalEdge,i=(r&&o.addEdge(r),t);n.data.dummy;)e=o.getSuccessors(i)[0],o.removeNode(i),r.data.points.push({x:n.data.x,y:n.data.y}),n.data.dummy===PE&&(r.data.x=n.data.x,r.data.y=n.data.y,r.data.width=n.data.width,r.data.height=n.data.height),i=e.id,n=o.getNode(i)})},kE=function(r){function i(t){var e,n=r.getNode(t);return n?o[t]?n.data.rank:(o[t]=!0,null!=(t=r.getRelatedEdges(t,"out"))&&t.forEach(function(t){t=i(t.target)-t.data.minlen;t&&(void 0===e||t<e)&&(e=t)}),e=e||0,n.data.rank=e):0}var o={};r.getAllNodes().filter(function(t){return 0===r.getRelatedEdges(t.id,"in").length}).forEach(function(t){return i(t.id)})},DE=function(i){function r(t){var e,n=i.getNode(t);return n?s[t]?n.data.rank:(s[t]=!0,null!=(t=i.getRelatedEdges(t,"out"))&&t.forEach(function(t){t=r(t.target)-t.data.minlen;t&&(void 0===e||t<e)&&(e=t)}),e=e||0,(void 0===a||e<a)&&(a=e),n.data.rank=e):0}function o(t,e){var n=i.getNode(t),r=isNaN(n.data.layer)?e:n.data.layer;(void 0===n.data.rank||n.data.rank<r)&&(n.data.rank=r),l[t]||(l[t]=!0,null!=(e=i.getRelatedEdges(t,"out"))&&e.forEach(function(t){o(t.target,r+t.data.minlen)}))}var a,s={},l=(i.getAllNodes().filter(function(t){return 0===i.getRelatedEdges(t.id,"in").length}).forEach(function(t){t&&r(t.id)}),void 0===a&&(a=0),{});i.getAllNodes().forEach(function(t){var e=t.data;e&&(isNaN(e.layer)?e.rank-=a:o(t.id,e.layer))})},BE=function(t,e){return t.getNode(e.target).data.rank-t.getNode(e.source).data.rank-e.data.minlen},FE=function(t){var e,n=new fy({tree:[]}),r=t.getAllNodes()[0],i=t.getAllNodes().length;for(n.addNode(r);UE(n,t)<i;)e=VE(n,t),e=n.hasNode(e.source)?BE(t,e):-BE(t,e),jE(n,t,e);return n},UE=function(r,i){function o(n){i.getRelatedEdges(n,"both").forEach(function(t){var e=t.source,e=n===e?t.target:e;r.hasNode(e)||BE(i,t)||(r.addNode({id:e,data:{}}),r.addEdge({id:t.id,source:n,target:e,data:{}}),o(e))})}return r.getAllNodes().forEach(function(t){return o(t.id)}),r.getAllNodes().length},GE=function(t){var e,n=new fy({tree:[]}),r=t.getAllNodes()[0],i=t.getAllNodes().length;for(n.addNode(r);WE(n,t)<i;)e=VE(n,t),e=n.hasNode(e.source)?BE(t,e):-BE(t,e),jE(n,t,e);return n},WE=function(r,i){function o(n){var t;null!=(t=i.getRelatedEdges(n,"both"))&&t.forEach(function(t){var e=t.source,e=n===e?t.target:e;r.hasNode(e)||void 0===i.getNode(e).data.layer&&BE(i,t)||(r.addNode({id:e,data:{}}),r.addEdge({id:t.id,source:n,target:e,data:{}}),o(e))})}return r.getAllNodes().forEach(function(t){return o(t.id)}),r.getAllNodes().length},VE=function(e,n){return ME(n.getAllEdges(),function(t){return e.hasNode(t.source)!==e.hasNode(t.target)?BE(n,t):1/0})},jE=function(t,e,n){t.getAllNodes().forEach(function(t){t=e.getNode(t.id);t.data.rank||(t.data.rank=0),t.data.rank+=n})},zE=function(t){var e,n,r=vE(t),i=(kE(r),FE(r));for(KE(i),HE(i,r);e=$E(i);)n=ZE(i,r,e),QE(i,r,e,n)},HE=function(e,n){var t=NE(e,e.getAllNodes(),"post",!1);(t=t.slice(0,(null==t?void 0:t.length)-1)).forEach(function(t){XE(e,n,t)})},XE=function(t,e,n){var r=t.getNode(n).data.parent;t.getRelatedEdges(n,"both").find(function(t){return t.target===r||t.source===r}).data.cutvalue=YE(t,e,n)},YE=function(r,t,i){var o=r.getNode(i).data.parent,a=!0,e=t.getRelatedEdges(i,"out").find(function(t){return t.target===o}),s=0;return e||(a=!1,e=t.getRelatedEdges(o,"out").find(function(t){return t.target===i})),s=e.data.weight,t.getRelatedEdges(i,"both").forEach(function(t){var e=t.source===i,n=e?t.target:t.source;n!==o&&(e=e===a,t=t.data.weight,s+=e?t:-t,t_(r,i,n))&&(t=r.getRelatedEdges(i,"both").find(function(t){return t.source===n||t.target===n}).data.cutvalue,s+=e?-t:t)}),s},KE=function(t,e){void 0===e&&(e=t.getAllNodes()[0].id),qE(t,{},1,e)},qE=function(e,n,t,r,i){var o,a=t,s=t,t=e.getNode(r);return n[r]=!0,null!=(o=e.getNeighbors(r))&&o.forEach(function(t){n[t.id]||(s=qE(e,n,s,t.id,r))}),t.data.low=a,t.data.lim=s++,i?t.data.parent=i:delete t.data.parent,s},$E=function(t){return t.getAllEdges().find(function(t){return t.data.cutvalue<0})},ZE=function(e,n,t){var r=t.source,i=t.target,t=(n.getRelatedEdges(r,"out").find(function(t){return t.target===i})||(r=t.target,i=t.source),e.getNode(r)),r=e.getNode(i),o=t,a=!1,t=(t.data.lim>r.data.lim&&(o=r,a=!0),n.getAllEdges().filter(function(t){return a===e_(e.getNode(t.source),o)&&a!==e_(e.getNode(t.target),o)}));return ME(t,function(t){return BE(n,t)})},QE=function(t,e,n,r){var i=t.getRelatedEdges(n.source,"both").find(function(t){return t.source===n.target||t.target===n.target});i&&t.removeEdge(i.id),t.addEdge({id:"e"+Math.random(),source:r.source,target:r.target,data:{}}),KE(t),HE(t,e),JE(t,e)},JE=function(i,o){var t=i.getAllNodes().find(function(t){return!t.data.parent});NE(i,t,"pre",!1).slice(1).forEach(function(e){var n=i.getNode(e).data.parent,t=o.getRelatedEdges(e,"out").find(function(t){return t.target===n}),r=!1;!t&&o.hasNode(n)&&(t=o.getRelatedEdges(n,"out").find(function(t){return t.target===e}),r=!0),o.getNode(e).data.rank=(o.hasNode(n)&&o.getNode(n).data.rank||0)+(r?null==t?void 0:t.data.minlen:-(null==t?void 0:t.data.minlen))})},t_=function(t,e,n){return t.getRelatedEdges(e,"both").find(function(t){return t.source===n||t.target===n})},e_=function(t,e){return e.data.low<=t.data.lim&&t.data.lim<=e.data.lim},n_=function(t,e){switch(e){case"network-simplex":o_(t);break;case"tight-tree":i_(t);break;case"longest-path":r_(t);break;default:i_(t)}},r_=kE,i_=function(t){DE(t),GE(t)},o_=function(t){zE(t)},a_=function(n){function r(t){var e=o;n.getChildren(t).forEach(function(t){return r(t.id)}),i[t]={low:e,lim:o++}}var i={},o=0;return n.getRoots().forEach(function(t){return r(t.id)}),i},s_=function(t,e,n,r){for(var i,o,a,s=[],l=[],u=Math.min(e[n].low,e[r].low),c=Math.max(e[n].lim,e[r].lim),h=n;h=null==(i=t.getParent(h))?void 0:i.id,s.push(h),h&&(e[h].low>u||c>e[h].lim););for(a=h,h=r;h&&h!==a;)l.push(h),h=null==(o=t.getParent(h))?void 0:o.id;return{lca:a,path:s.concat(l.reverse())}},l_=function(h,t){var d=a_(h);t.forEach(function(t){var e,n,r,i=t,o=h.getNode(i).data.originalEdge;if(o)for(var t=s_(h,d,o.source,o.target),a=t.path,s=t.lca,l=0,u=a[l],c=!0;i!==o.target;){if(r=h.getNode(i),c){for(;u!==s&&(null==(e=h.getNode(u))?void 0:e.data.maxRank)<r.data.rank;)u=a[++l];u===s&&(c=!1)}if(!c){for(;l<a.length-1&&(null==(n=h.getNode(a[l+1]))?void 0:n.data.minRank)<=r.data.rank;)l++;u=a[l]}h.hasNode(u)&&h.setParent(i,u),i=h.getSuccessors(i)[0].id}})},u_=function(e){var n=mE(e,"root",{},"_root"),r=h_(e),t=Math.max.apply(Math,O([],D(Object.values(r)))),i=(t=Math.abs(t)===1/0?1:t)-1,o=2*i+1,a=(e.getAllEdges().forEach(function(t){t.data.minlen*=o}),d_(e)+1);return e.getRoots().forEach(function(t){c_(e,n,o,a,i,r,t.id)}),{nestingRoot:n,nodeRankFactor:o}},c_=function(i,o,a,s,l,u,c){var h,d,t,e=i.getChildren(c);null!=e&&e.length?(h=wE(i,"_bt"),d=wE(i,"_bb"),t=i.getNode(c),i.setParent(h,c),t.data.borderTop=h,i.setParent(d,c),t.data.borderBottom=d,null!=e&&e.forEach(function(t){c_(i,o,a,s,l,u,t.id);var e=t.data.borderTop||t.id,n=t.data.borderBottom||t.id,t=t.data.borderTop?s:2*s,r=e!==n?1:l-u[c]+1;i.addEdge({id:"e"+Math.random(),source:h,target:e,data:{minlen:r,weight:t,nestingEdge:!0}}),i.addEdge({id:"e"+Math.random(),source:n,target:d,data:{minlen:r,weight:t,nestingEdge:!0}})}),i.getParent(c)||i.addEdge({id:"e"+Math.random(),source:o,target:h,data:{weight:0,minlen:l+u[c]}})):c!==o&&i.addEdge({id:"e"+Math.random(),source:o,target:c,data:{weight:0,minlen:a}})},h_=function(r){function i(t,e){var n=r.getChildren(t);null!=n&&n.forEach(function(t){return i(t.id,e+1)}),o[t]=e}var o={};return r.getRoots().forEach(function(t){return i(t.id,1)}),o},d_=function(t){var e=0;return t.getAllEdges().forEach(function(t){e+=t.data.weight}),e},f_=function(e,t){t&&e.removeNode(t),e.getAllEdges().forEach(function(t){t.data.nestingEdge&&e.removeEdge(t.id)})},p_=function(o){function a(t){var e=o.getChildren(t),n=o.getNode(t);if(null!=e&&e.length&&e.forEach(function(t){return a(t.id)}),n.data.hasOwnProperty("minRank")){n.data.borderLeft=[],n.data.borderRight=[];for(var r=n.data.minRank,i=n.data.maxRank+1;r<i;r+=1)g_(o,"borderLeft","_bl",t,n,r),g_(o,"borderRight","_br",t,n,r)}}o.getRoots().forEach(function(t){return a(t.id)})},g_=function(t,e,n,r,i,o){var a=i.data[e][o-1],n=mE(t,"border",{rank:o,borderType:e,width:0,height:0},n);i.data[e][o]=n,t.setParent(n,r),a&&t.addEdge({id:"e"+Math.random(),source:a,target:n,data:{weight:1}})},m_=function(t,e){e=e.toLowerCase();"lr"!==e&&"rl"!==e||y_(t)},v_=function(t,e){e=e.toLowerCase();"bt"!==e&&"rl"!==e||__(t),"lr"!==e&&"rl"!==e||(x_(t),y_(t))},y_=function(t){t.getAllNodes().forEach(function(t){E_(t)}),t.getAllEdges().forEach(function(t){E_(t)})},E_=function(t){var e=t.data.width;t.data.width=t.data.height,t.data.height=e},__=function(t){t.getAllNodes().forEach(function(t){b_(t.data)}),t.getAllEdges().forEach(function(t){var e;null!=(e=t.data.points)&&e.forEach(function(t){return b_(t)}),t.data.hasOwnProperty("y")&&b_(t.data)})},b_=function(t){null!=t&&t.y&&(t.y=-t.y)},x_=function(t){t.getAllNodes().forEach(function(t){S_(t.data)}),t.getAllEdges().forEach(function(t){var e;null!=(e=t.data.points)&&e.forEach(function(t){return S_(t)}),t.data.hasOwnProperty("x")&&S_(t.data)})},S_=function(t){var e=t.x;t.x=t.y,t.y=e},w_=function(n){for(var e={},t=n.getAllNodes(),r=t.map(function(t){return null!=(t=t.data.rank)?t:-1/0}),i=Math.max.apply(Math,O([],D(r))),o=[],a=0;a<i+1;a++)o.push([]);r=t.sort(function(t,e){return n.getNode(t.id).data.rank-n.getNode(e.id).data.rank}),t=r.filter(function(t){return void 0!==n.getNode(t.id).data.fixorder}).sort(function(t,e){return n.getNode(t.id).data.fixorder-n.getNode(e.id).data.fixorder});return null!=t&&t.forEach(function(t){isNaN(n.getNode(t.id).data.rank)||o[n.getNode(t.id).data.rank].push(t.id),e[t.id]=!0}),null!=r&&r.forEach(function(t){return n.dfsTree(t.id,function(t){if(e.hasOwnProperty(t.id))return!0;e[t.id]=!0,isNaN(t.data.rank)||o[t.data.rank].push(t.id)})}),o},T_=function(e,t,n){for(var r=EE(n,n.map(function(t,e){return e})),t=t.map(function(t){t=e.getRelatedEdges(t,"out").map(function(t){return{pos:r[t.target]||0,weight:t.data.weight}});return null==t?void 0:t.sort(function(t,e){return t.pos-e.pos})}).flat().filter(function(t){return void 0!==t}),i=1;i<n.length;)i<<=1;var o=2*i-1,a=(--i,Array(o).fill(0,0,o)),s=0;return null!=t&&t.forEach(function(t){if(t){for(var e=t.pos+i,n=(a[e]+=t.weight,0);0<e;)e%2&&(n+=a[e+1]),a[e=e-1>>1]+=t.weight;s+=t.weight*n}}),s},A_=function(t,e){for(var n=0,r=1;r<(null==e?void 0:e.length);r+=1)n+=T_(t,e[r-1],e[r]);return n},M_=function(o,e,n){var r=R_(o),a=new fy({tree:[{id:r,children:[],data:{}}]});return o.getAllNodes().forEach(function(i){var t=o.getParent(i.id);(i.data.rank===e||i.data.minRank<=e&&e<=i.data.maxRank)&&(a.hasNode(i.id)||a.addNode(k({},i)),null!=t&&t.id&&!a.hasNode(null==t?void 0:t.id)&&a.addNode(k({},t)),a.setParent(i.id,(null==t?void 0:t.id)||r),o.getRelatedEdges(i.id,n).forEach(function(t){var e=t.source===i.id?t.target:t.source,n=(a.hasNode(e)||a.addNode(k({},o.getNode(e))),a.getRelatedEdges(e,"out").find(function(t){return t.target===i.id})),r=void 0!==n?n.data.weight:0;n?a.updateEdgeData(n.id,k(k({},n.data),{weight:t.data.weight+r})):a.addEdge({id:t.id,source:e,target:i.id,data:{weight:t.data.weight+r}})}),i.data.hasOwnProperty("minRank"))&&a.updateNodeData(i.id,k(k({},i.data),{borderLeft:i.data.borderLeft[e],borderRight:i.data.borderRight[e]}))}),a},R_=function(t){for(var e;t.hasNode(e="_root"+Math.random()););return e},N_=function(i,o,t){var a,s={};null!=t&&t.forEach(function(t){for(var e,n,r=i.getParent(t);r;){if((e=i.getParent(r.id))?(n=s[e.id],s[e.id]=r.id):(n=a,a=r.id),n&&n!==r.id)return o.addNodes([{id:n,data:{}},{id:r.id,data:{}}]),void o.addEdge({id:"e"+n+"-"+r.id,source:n,target:r.id,data:{}});r=e}})},C_=function(r,t){return t.map(function(t){var n,e=r.getRelatedEdges(t,"in");return null!=e&&e.length?(n={sum:0,weight:0},null!=e&&e.forEach(function(t){var e=r.getNode(t.source);n.sum+=t.data.weight*e.data.order,n.weight+=t.data.weight}),{v:t,barycenter:n.sum/n.weight,weight:n.weight}):{v:t}})},P_=function(r){for(var t,e=[],n=function(){var n=r.pop();e.push(n),null!=(t=n.in.reverse())&&t.forEach(function(t){e=n;var e;t.merged||(void 0===t.barycenter||void 0===e.barycenter||t.barycenter>=e.barycenter)&&O_(e,t)}),null!=(t=n.out)&&t.forEach(function(t){e=n;var e;t.in.push(e),0==--t.indegree&&r.push(t)})};null!=r&&r.length;)n();var i=e.filter(function(t){return!t.merged}),o=["vs","i","barycenter","weight"];return i.map(function(e){var n={};return null!=o&&o.forEach(function(t){void 0!==e[t]&&(n[t]=e[t])}),n})},O_=function(t,e){var n,r=0,i=0;t.weight&&(r+=t.barycenter*t.weight,i+=t.weight),e.weight&&(r+=e.barycenter*e.weight,i+=e.weight),t.vs=null==(n=e.vs)?void 0:n.concat(t.vs),t.barycenter=r/i,t.weight=i,t.i=Math.min(e.i,t.i),e.merged=!0},I_=function(t,e){var r={},t=(null!=t&&t.forEach(function(t,e){r[t.v]={i:e,indegree:0,in:[],out:[],vs:[t.v]};e=r[t.v];void 0!==t.barycenter&&(e.barycenter=t.barycenter,e.weight=t.weight)}),null!=(t=e.getAllEdges())&&t.forEach(function(t){var e=r[t.source],n=r[t.target];void 0!==e&&void 0!==n&&(n.indegree++,e.out.push(r[t.target]))}),null==(t=(e=Object.values(r)).filter)?void 0:t.call(e,function(t){return!t.indegree}));return P_(t)},L_=function(t,e,n,r){var t=AE(t,function(t){var e=t.hasOwnProperty("fixorder")&&!isNaN(t.fixorder);return r?!e&&t.hasOwnProperty("barycenter"):e||t.hasOwnProperty("barycenter")}),i=t.lhs,o=t.rhs.sort(function(t,e){return-t.i- -e.i}),a=[],s=0,l=0,u=0,t=(null!=i&&i.sort(D_(!!e,!!n)),u=k_(a,o,u),null!=i&&i.forEach(function(t){var e;u+=null==(e=t.vs)?void 0:e.length,a.push(t.vs),s+=t.barycenter*t.weight,l+=t.weight,u=k_(a,o,u)}),{vs:a.flat()});return l&&(t.barycenter=s/l,t.weight=l),t},k_=function(t,e,n){for(var r,i=n;e.length&&(r=e[e.length-1]).i<=i;)e.pop(),null!=t&&t.push(r.vs),i++;return i},D_=function(n,r){return function(t,e){if(void 0!==t.fixorder&&void 0!==e.fixorder)return t.fixorder-e.fixorder;if(t.barycenter<e.barycenter)return-1;if(t.barycenter>e.barycenter)return 1;if(r&&void 0!==t.order&&void 0!==e.order){if(t.order<e.order)return-1;if(t.order>e.order)return 1}return n?e.i-t.i:t.i-e.i}},B_=function(n,t,r,i,e,o){var a=n.getChildren(t).map(function(t){return t.id}),t=n.getNode(t),s=t?t.data.borderLeft:void 0,l=t?t.data.borderRight:void 0,u={},t=(s&&(a=null==a?void 0:a.filter(function(t){return t!==s&&t!==l})),C_(n,a||[])),a=(null!=t&&t.forEach(function(t){var e;null!=(e=n.getChildren(t.v))&&e.length&&(e=B_(n,t.v,r,i,o),(u[t.v]=e).hasOwnProperty("barycenter"))&&U_(t,e)}),I_(t,r)),t=(F_(a,u),null!=(t=a.filter(function(t){return 0<t.vs.length}))&&t.forEach(function(t){var e=n.getNode(t.vs[0]);e&&(t.fixorder=e.data.fixorder,t.order=e.data.order)}),L_(a,i,e,o));return s&&(t.vs=[s,t.vs,l].flat(),null!=(a=n.getPredecessors(s)))&&a.length&&(a=n.getNode((null==(e=n.getPredecessors(s))?void 0:e[0].id)||""),e=n.getNode((null==(e=n.getPredecessors(l))?void 0:e[0].id)||""),t.hasOwnProperty("barycenter")||(t.barycenter=0,t.weight=0),t.barycenter=(t.barycenter*t.weight+a.data.order+e.data.order)/(t.weight+2),t.weight+=2),t},F_=function(t,n){null!=t&&t.forEach(function(t){var e=null==(e=t.vs)?void 0:e.map(function(t){return n[t]?n[t].vs:t});t.vs=e.flat()})},U_=function(t,e){void 0!==t.barycenter?(t.barycenter=(t.barycenter*t.weight+e.barycenter*e.weight)/(t.weight+e.weight),t.weight+=e.weight):(t.barycenter=e.barycenter,t.weight=e.weight)},G_=function(t,e){for(var n=TE(t),r=[],i=[],o=1;o<n+1;o++)r.push(o);for(o=n-1;-1<o;o--)i.push(o);for(var a,s=W_(t,r,"in"),l=W_(t,i,"out"),u=w_(t),c=(j_(t,u),Number.POSITIVE_INFINITY),o=0,h=0;h<4;++o,++h){V_(o%2?s:l,2<=o%4,!1,e);u=bE(t);(d=A_(t,u))<c&&(h=0,a=He(u),c=d)}u=w_(t),j_(t,u);for(var d,o=0,h=0;h<4;++o,++h)V_(o%2?s:l,2<=o%4,!0,e),u=bE(t),(d=A_(t,u))<c&&(h=0,a=He(u),c=d);j_(t,a)},W_=function(e,t,n){return t.map(function(t){return M_(e,t,n)})},V_=function(t,o,a,s){var l=new fy;null!=t&&t.forEach(function(t){for(var e=t.getRoots()[0].id,n=B_(t,e,l,o,a,s),r=0;r<(null==(i=n.vs)?void 0:i.length);r++){var i=t.getNode(n.vs[r]);i&&(i.data.order=r)}N_(t,l,n.vs)})},j_=function(n,t){null!=t&&t.forEach(function(t){null!=t&&t.forEach(function(t,e){n.getNode(t).data.order=e})})},z_=function(u,t){var c={};return null!=t&&t.length&&t.reduce(function(t,r){var o=0,a=0,s=t.length,l=null==r?void 0:r[(null==r?void 0:r.length)-1];return null!=r&&r.forEach(function(t,e){var n=X_(u,t),i=n?u.getNode(n.id).data.order:s;!n&&t!==l||(null!=(n=r.slice(a,e+1))&&n.forEach(function(r){var t;null!=(t=u.getPredecessors(r))&&t.forEach(function(t){var e=u.getNode(t.id),n=e.data.order;!(n<o||i<n)||e.data.dummy&&null!=(n=u.getNode(r))&&n.data.dummy||Y_(c,t.id,r)})}),a=e+1,o=i)}),r}),c},H_=function(u,t){var l={};function c(t,e){var n=JSON.stringify(t.slice(1));e.get(n)||(!function(t,e,n,r,i){for(var o,a,s=e;s<n;s++)a=t[s],null!=(o=u.getNode(a))&&o.data.dummy&&null!=(o=u.getPredecessors(a))&&o.forEach(function(t){var e=u.getNode(t.id);e.data.dummy&&(e.data.order<r||e.data.order>i)&&Y_(l,t.id,a)})}.apply(void 0,O([],D(t))),e.set(n,!0))}return null!=t&&t.length&&t.reduce(function(r,i){var o,a=-1,s=0,l=new Map;return null!=i&&i.forEach(function(t,e){var n;"border"===(null==(n=u.getNode(t))?void 0:n.data.dummy)&&(n=u.getPredecessors(t)||[]).length&&(o=u.getNode(n[0].id).data.order,c([i,s,e,a,o],l),s=e,a=o),c([i,s,i.length,o,r.length],l)}),i}),l},X_=function(e,t){var n;return null==(n=e.getNode(t))||!n.data.dummy||null==(n=e.getPredecessors(t))?void 0:n.find(function(t){return e.getNode(t.id).data.dummy})},Y_=function(t,e,n){var r,i=n,n=(n<e&&(r=e,e=n,i=r),t[e]);n||(t[e]=n={}),n[i]=!0},K_=function(t,e,n){var r=e;return n<e&&(r=n,0),!!t[r]},q_=function(t,e,s,l){var u={},c={},h={};return null!=e&&e.forEach(function(t){null!=t&&t.forEach(function(t,e){h[c[u[t]=t]=t]=e})}),null!=e&&e.forEach(function(t){var a=-1;null!=t&&t.forEach(function(t){var e=l(t).map(function(t){return t.id});if(e.length)for(var n=((e=e.sort(function(t,e){return h[t]-h[e]})).length-1)/2,r=Math.floor(n),i=Math.ceil(n);r<=i;++r){var o=e[r];c[t]===t&&a<h[o]&&!K_(s,t,o)&&(c[o]=t,c[t]=u[t]=u[o],a=h[o])}})}),{root:u,align:c}},$_=function(r,t,e,n,i,o,a){function s(t,e){for(var n=u.getAllNodes(),r=n.pop(),i={};r;)i[r.id]?t(r.id):(i[r.id]=!0,n.push(r),n=n.concat(e(r.id))),r=n.pop()}var l={},u=Z_(r,t,e,i,o,a),c=a?"borderLeft":"borderRight";return s(function(t){l[t]=(u.getRelatedEdges(t,"in")||[]).reduce(function(t,e){return Math.max(t,(l[e.source]||0)+e.data.weight)},0)},u.getPredecessors.bind(u)),s(function(t){var e=(u.getRelatedEdges(t,"out")||[]).reduce(function(t,e){return Math.min(t,(l[e.target]||0)-e.data.weight)},Number.POSITIVE_INFINITY),n=r.getNode(t);e!==Number.POSITIVE_INFINITY&&n.data.borderType!==c&&(l[t]=Math.max(l[t],e))},u.getSuccessors.bind(u)),null!=(t=Object.values(n))&&t.forEach(function(t){l[t]=l[e[t]]}),l},Z_=function(o,t,a,e,n,r){var s=new fy,l=tb(e,n,r);return null!=t&&t.forEach(function(t){var i;null!=t&&t.forEach(function(t){var e,n,r=a[t];s.hasNode(r)||s.addNode({id:r,data:{}}),i&&(e=a[i],(n=s.getRelatedEdges(e,"out").find(function(t){return t.target===r}))?s.updateEdgeData(n.id,k(k({},n.data),{weight:Math.max(l(o,t,i),n.data.weight||0)})):s.addEdge({id:"e"+Math.random(),source:e,target:r,data:{weight:Math.max(l(o,t,i),0)}})),i=t})}),s},Q_=function(o,t){return ME(Object.values(t),function(n){var t,r=Number.NEGATIVE_INFINITY,i=Number.POSITIVE_INFINITY;return null!=(t=Object.keys(n))&&t.forEach(function(t){var e=n[t],t=eb(o,t)/2;r=Math.max(e+t,r),i=Math.min(e-t,i)}),r-i})};var J_=function(n,r){var i={};return Object.keys(n.ul).forEach(function(e){var t;r?i[e]=n[r.toLowerCase()][e]:(t=Object.values(n).map(function(t){return t[e]}),i[e]=(t[0]+t[1])/2)}),i},tb=function(a,s,l){return function(t,e,n){var r=t.getNode(e),i=t.getNode(n),e=0,o=0;if(e+=r.data.width/2,r.data.hasOwnProperty("labelpos"))switch((r.data.labelpos||"").toLowerCase()){case"l":o=-r.data.width/2;break;case"r":o=r.data.width/2}if(o&&(e+=l?o:-o),o=0,e=(e=(e+=(r.data.dummy?s:a)/2)+(i.data.dummy?s:a)/2)+i.data.width/2,i.data.labelpos)switch((i.data.labelpos||"").toLowerCase()){case"l":o=i.data.width/2;break;case"r":o=-i.data.width/2}return o&&(e+=l?o:-o),o=0,e}},eb=function(t,e){return t.getNode(e).data.width||0},nb=function(r,t){var t=(t||{}).ranksep,i=void 0===t?0:t,t=bE(r),o=0;null!=t&&t.forEach(function(t){var e=t.map(function(t){return r.getNode(t).data.height}),n=Math.max.apply(Math,O(O([],D(e)),[0]));null!=t&&t.forEach(function(t){r.getNode(t).data.y=o+n/2}),o+=n+i})},rb=function(i,t){var a,s,l,u,t=t||{},e=t.align,n=t.nodesep,o=void 0===n?0:n,n=t.edgesep,c=void 0===n?0:n,h=bE(i),d=Object.assign(z_(i,h),H_(i,h)),f={},p=[],t=(["u","d"].forEach(function(r){p="u"===r?h:Object.values(h).reverse(),["l","r"].forEach(function(t){"r"===t&&(p=p.map(function(t){return Object.values(t).reverse()}));var e=("u"===r?i.getPredecessors:i.getSuccessors).bind(i),e=q_(i,p,d,e),n=$_(i,p,e.root,e.align,o,c,"r"===t);"r"===t&&Object.keys(n).forEach(function(t){return n[t]=-n[t]}),f[r+t]=n})}),Q_(i,f));return t&&(a=f,s=t,n=Object.values(s),l=Math.min.apply(Math,O([],D(n))),u=Math.max.apply(Math,O([],D(n))),["u","d"].forEach(function(o){["l","r"].forEach(function(t){var e,n,r=o+t,i=a[r];i!==s&&(e=Object.values(i),n="l"===t?l-Math.min.apply(Math,O([],D(e))):u-Math.max.apply(Math,O([],D(e))))&&(a[r]={},Object.keys(i).forEach(function(t){a[r][t]=i[t]+n}))})})),J_(f,e)},ib=function(t,e){var n=yE(t),r=(nb(n,e),rb(n,e));null!=(t=Object.keys(r))&&t.forEach(function(t){n.getNode(t).data.x=r[t]})},ob=function(n,t){for(var e=n.getAllNodes().filter(function(t){return!(null!=(t=n.getChildren(t.id))&&t.length)}).map(function(t){return t.data.rank}),r=Math.max.apply(Math,O([],D(e))),i=[],o=0;o<r+1;o++)i[o]=[];null!=t&&t.forEach(function(t){var e=n.getNode(t);!e||e.data.dummy||isNaN(e.data.rank)||(e.data.fixorder=i[e.data.rank].length,i[e.data.rank].push(t))})},ab=function(t,e){var n=e.acyclicer,r=e.ranker,i=e.rankdir,i=void 0===i?"tb":i,o=e.nodeOrder,a=e.keepNodeOrder,s=e.align,l=e.nodesep,l=void 0===l?50:l,u=e.edgesep,u=void 0===u?20:u,e=e.ranksep,e=void 0===e?50:e,n=(wb(t),dE(t,n),u_(t)),c=n.nestingRoot,n=n.nodeRankFactor,r=(n_(yE(t),r),mb(t),SE(t,n),f_(t,c),xE(t),vb(t),yb(t),[]),n=(OE(t,r),l_(t,r),p_(t),a&&ob(t,o),G_(t,a),Tb(t),m_(t,i),ib(t,{align:s,nodesep:l,edgesep:u,ranksep:e}),Ab(t),Sb(t),LE(t,r),bb(t),v_(t,i),Eb(t)),c=n.width,o=n.height;return _b(t),xb(t),pE(t),{width:c,height:o}},sb=function(n,r){n.getAllNodes().forEach(function(t){var e=n.getNode(t.id),t=r.getNode(t.id);void 0!==t?(e.data.fixorder=t.data._order,delete t.data._order):delete e.data.fixorder})},lb=function(r,i){r.getAllNodes().forEach(function(t){var e,n=r.getNode(t.id);n&&(e=i.getNode(t.id),n.data.x=e.data.x,n.data.y=e.data.y,n.data._order=e.data.order,n.data._rank=e.data.rank,null!=(t=i.getChildren(t.id)))&&t.length&&(n.data.width=e.data.width,n.data.height=e.data.height)}),r.getAllEdges().forEach(function(t){var e=r.getEdge(t.id),t=i.getEdge(t.id);e.data.points=t?t.data.points:[],t&&t.data.hasOwnProperty("x")&&(e.data.x=t.data.x,e.data.y=t.data.y)})},ub=["width","height","layer","fixorder"],cb={width:0,height:0},hb=["minlen","weight","width","height","labeloffset"],db={minlen:1,weight:1,width:0,height:0,labeloffset:10,labelpos:"r"},fb=["labelpos"],pb=function(r){var i=new fy({tree:[]});return r.getAllNodes().forEach(function(t){var e=Rb(r.getNode(t.id).data),e=k(k({},cb),e),e=Mb(e,ub),e=(i.hasNode(t.id)||i.addNode({id:t.id,data:k({},e)}),r.getParent(t.id));M(e)||(i.hasNode(e.id)||i.addNode(k({},e)),i.setParent(t.id,e.id))}),r.getAllEdges().forEach(function(t){var e=Rb(r.getEdge(t.id).data),n={};null!=fb&&fb.forEach(function(t){void 0!==e[t]&&(n[t]=e[t])}),i.addEdge({id:t.id,source:t.source,target:t.target,data:Object.assign({},db,Mb(e,hb),n)})}),i},gb=function(t,e){var n=e.ranksep,n=void 0===n?0:n,r=e.rankdir;return t.getAllNodes().forEach(function(t){isNaN(t.data.layer)||t.data.layer||(t.data.layer=0)}),t.getAllEdges().forEach(function(t){var e;t.data.minlen*=2,"c"!==(null==(e=t.data.labelpos)?void 0:e.toLowerCase())&&("TB"===r||"BT"===r?t.data.width+=t.data.labeloffset:t.data.height+=t.data.labeloffset)}),n/2},mb=function(n){n.getAllEdges().forEach(function(t){var e;t.data.width&&t.data.height&&(e=n.getNode(t.source),t={e:t,rank:(n.getNode(t.target).data.rank-e.data.rank)/2+e.data.rank},mE(n,"edge-proxy",t,"_ep"))})},vb=function(n){var r=0;return n.getAllNodes().forEach(function(t){var e;t.data.borderTop&&(t.data.minRank=null==(e=n.getNode(t.data.borderTop))?void 0:e.data.rank,t.data.maxRank=null==(e=n.getNode(t.data.borderBottom))?void 0:e.data.rank,r=Math.max(r,t.data.maxRank||-1/0))}),r},yb=function(e){e.getAllNodes().forEach(function(t){"edge-proxy"===t.data.dummy&&(e.getEdge(t.data.e.id).data.labelRank=t.data.rank,e.removeNode(t.id))})},Eb=function(t,e){function n(t){var e,n,r;t.data&&(e=t.data.x,n=t.data.y,r=t.data.width,t=t.data.height,isNaN(e)||isNaN(r)||(void 0===i&&(i=e-r/2),i=Math.min(i,e-r/2),a=Math.max(a,e+r/2)),isNaN(n)||isNaN(t)||(void 0===o&&(o=n-t/2),o=Math.min(o,n-t/2),s=Math.max(s,n+t/2)))}var i,o,a=0,s=0,e=e||{},r=e.marginx,r=void 0===r?0:r,e=e.marginy,e=void 0===e?0:e;return t.getAllNodes().forEach(function(t){n(t)}),t.getAllEdges().forEach(function(t){null!=t&&t.data.hasOwnProperty("x")&&n(t)}),i-=r,o-=e,t.getAllNodes().forEach(function(t){t.data.x-=i,t.data.y-=o}),t.getAllEdges().forEach(function(t){var e;null!=(e=t.data.points)&&e.forEach(function(t){t.x-=i,t.y-=o}),t.data.hasOwnProperty("x")&&(t.data.x-=i),t.data.hasOwnProperty("y")&&(t.data.y-=o)}),{width:a-i+r,height:s-o+e}},_b=function(o){o.getAllEdges().forEach(function(t){var e,n=o.getNode(t.source),r=o.getNode(t.target),i=t.data.points?(e=t.data.points[0],t.data.points[t.data.points.length-1]):(t.data.points=[],e={x:r.data.x,y:r.data.y},{x:n.data.x,y:n.data.y});t.data.points.unshift(_E(n.data,e)),t.data.points.push(_E(r.data,i))})},bb=function(t){t.getAllEdges().forEach(function(t){if(t.data.hasOwnProperty("x"))switch("l"!==t.data.labelpos&&"r"!==t.data.labelpos||(t.data.width-=t.data.labeloffset),t.data.labelpos){case"l":t.data.x-=t.data.width/2+t.data.labeloffset;break;case"r":t.data.x+=t.data.width/2+t.data.labeloffset}})},xb=function(t){t.getAllEdges().forEach(function(t){t.data.reversed&&null!=(t=t.data.points)&&t.reverse()})},Sb=function(o){o.getAllNodes().forEach(function(t){var e,n,r,i;null!=(e=o.getChildren(t.id))&&e.length&&(e=o.getNode(t.id),t=o.getNode(e.data.borderTop),n=o.getNode(e.data.borderBottom),r=o.getNode(e.data.borderLeft[(null==(r=e.data.borderLeft)?void 0:r.length)-1]),i=o.getNode(e.data.borderRight[(null==(i=e.data.borderRight)?void 0:i.length)-1]),e.data.width=Math.abs((null==i?void 0:i.data.x)-(null==r?void 0:r.data.x))||10,e.data.height=Math.abs((null==n?void 0:n.data.y)-(null==t?void 0:t.data.y))||10,e.data.x=((null==r?void 0:r.data.x)||0)+e.data.width/2,e.data.y=((null==t?void 0:t.data.y)||0)+e.data.height/2)}),o.getAllNodes().forEach(function(t){"border"===t.data.dummy&&o.removeNode(t.id)})},wb=function(n){n.getAllEdges().forEach(function(t){var e;t.source===t.target&&((e=n.getNode(t.source)).data.selfEdges||(e.data.selfEdges=[]),e.data.selfEdges.push(t),n.removeEdge(t.id))})},Tb=function(i){var t=bE(i);null!=t&&t.forEach(function(t){var r=0;null!=t&&t.forEach(function(t,e){var n=i.getNode(t);n.data.order=e+r,null!=(t=n.data.selfEdges)&&t.forEach(function(t){mE(i,"selfedge",{width:t.data.width,height:t.data.height,rank:n.data.rank,order:e+ ++r,e:t},"_se")}),delete n.data.selfEdges})})},Ab=function(a){a.getAllNodes().forEach(function(t){var e,n,r,i,o=a.getNode(t.id);"selfedge"===o.data.dummy&&(e=(i=a.getNode(o.data.e.source)).data.x+i.data.width/2,n=i.data.y,r=o.data.x-e,i=i.data.height/2,a.hasEdge(o.data.e.id)?a.updateEdgeData(o.data.e.id,o.data.e.data):a.addEdge({id:o.data.e.id,source:o.data.e.source,target:o.data.e.target,data:o.data.e.data}),a.removeNode(t.id),o.data.e.data.points=[{x:e+2*r/3,y:n-i},{x:e+5*r/6,y:n-i},{y:n,x:e+r},{x:e+5*r/6,y:n+i},{x:e+2*r/3,y:n+i}],o.data.e.data.x=o.data.x,o.data.e.data.y=o.data.y)})},Mb=function(e,t){var n={};return null!=t&&t.forEach(function(t){void 0!==e[t]&&(n[t]=+e[t])}),n},Rb=function(e){void 0===e&&(e={});var n={};return Object.keys(e).forEach(function(t){n[t.toLowerCase()]=e[t]}),n},Nb={rankdir:"TB",nodesep:50,ranksep:50,edgeLabelSpace:!0,controlPoints:!1,radial:!1,focusNode:null},pa=(Cb.prototype.execute=function(e,n){return s(this,void 0,void 0,function(){return U(this,function(t){return[2,this.genericDagreLayout(!1,e,n)]})})},Cb.prototype.assign=function(e,n){return s(this,void 0,void 0,function(){return U(this,function(t){switch(t.label){case 0:return[4,this.genericDagreLayout(!0,e,n)];case 1:return t.sent(),[2]}})})},Cb.prototype.genericDagreLayout=function(T,A,M){return s(this,void 0,void 0,function(){var e,n,r,i,o,a,s,l,u,c,h,d,f,p,g,m,v,y,E,_,b,x,S,w;return U(this,function(t){return l=k(k({},this.options),M),S=l.nodeSize,e=l.align,n=l.rankdir,n=void 0===n?"TB":n,f=l.ranksep,r=l.nodesep,E=l.ranksepFunc,w=l.nodesepFunc,i=l.edgeLabelSpace,o=l.nodeOrder,a=l.begin,s=l.controlPoints,l=l.radial,u=new fy({tree:[]}),f=_y(f||50,E),E=_y(r||50,w),c=E,h=f,"LR"!==n&&"RL"!==n||(c=f,h=E),d=xy(S,void 0),w=A.getAllNodes(),f=A.getAllEdges(),w.forEach(function(t){var e=d(t),n=h(t),r=e+2*c(t),e=e+2*n,n=t.data.layer;B(n)?u.addNode({id:t.id,data:{width:r,height:e,layer:n}}):u.addNode({id:t.id,data:{width:r,height:e}})}),f.forEach(function(t){u.addEdge({id:t.id,source:t.source,target:t.target,data:{weight:t.data.weight||1}})}),function(t,e){var n,r=e.edgeLabelSpace,i=e.keepNodeOrder,o=e.prevGraph,a=e.rankdir,s=e.ranksep,i=(!i&&o&&sb(t,o),pb(t));r&&(e.ranksep=gb(i,{rankdir:a,ranksep:s}));try{n=ab(i,e)}catch(t){if("Not possible to find intersection inside of the rectangle"===t.message)return console.error("The following error may be caused by improper layer setting, please make sure your manual layer setting does not violate the graph's structure:\n",t);throw t}lb(t,i)}(u,{prevGraph:null,edgeLabelSpace:i,keepNodeOrder:!!o,nodeOrder:o||[],acyclicer:"greedy",ranker:"network-simplex",rankdir:n,nodesep:r,align:e}),p=[0,0],a&&(m=g=1/0,u.getAllNodes().forEach(function(t){g>t.data.x&&(g=t.data.x),m>t.data.y&&(m=t.data.y)}),u.getAllEdges().forEach(function(t){null!=(t=t.data.points)&&t.forEach(function(t){g>t.x&&(g=t.x),m>t.y&&(m=t.y)})}),p[0]=a[0]-g,p[1]=a[1]-m),v="LR"===n||"RL"===n,l||(y=new Set,E="BT"===n||"RL"===n?function(t,e){return e-t}:function(t,e){return t-e},u.getAllNodes().forEach(function(t){t.data.x=t.data.x+p[0],t.data.y=t.data.y+p[1],y.add(v?t.data.x:t.data.y)}),_=Array.from(y).sort(E),b=v?function(t,e){return t.x!==e.x}:function(t,e){return t.y!==e.y},x=v?function(t,e,n){var r=Math.max(e.y,n.y),i=Math.min(e.y,n.y);return t.filter(function(t){return t.y<=r&&t.y>=i})}:function(t,e,n){var r=Math.max(e.x,n.x),i=Math.min(e.x,n.x);return t.filter(function(t){return t.x<=r&&t.x>=i})},u.getAllEdges().forEach(function(t,e){var n;i&&s&&"loop"!==t.data.type&&(t.data.controlPoints=Pb(null==(n=t.data.points)?void 0:n.map(function(t){var e=t.x,t=t.y;return{x:e+p[0],y:t+p[1]}}),u.getNode(t.source),u.getNode(t.target),_,v,b,x))})),S=[],S=u.getAllNodes().map(function(t){return Ey(t)}),w=u.getAllEdges(),T&&(S.forEach(function(t){A.mergeNodeData(t.id,{x:t.data.x,y:t.data.y})}),w.forEach(function(t){A.mergeEdgeData(t.id,{controlPoints:t.data.controlPoints})})),[2,{nodes:S,edges:w}]})})},Cb);function Cb(t){this.options=t=void 0===t?{}:t,this.id="dagre",this.options=k(k({},Nb),t)}var Pb=function(t,e,n,r,i,o,a){var s,l,u,c,h,d,f,t=(null==t?void 0:t.slice(1,t.length-1))||[];return e&&n&&(s=(l=e.data).x,l=l.y,u=(c=n.data).x,c=c.y,i&&(s=e.data.y,l=e.data.x,u=n.data.y,c=n.data.x),c!==l)&&s!==u&&(f=r.indexOf(l),(d=r[f+1])&&(h=t[0],d=i?{x:(l+d)/2,y:(null==h?void 0:h.y)||u}:{x:(null==h?void 0:h.x)||u,y:(l+d)/2},h&&!o(h,d)||t.unshift(d)),h=r.indexOf(c),1===(d=Math.abs(h-f))?(t=a(t,e.data,n.data)).length||t.push(i?{x:(l+c)/2,y:s}:{x:s,y:(l+c)/2}):1<d&&(f=r[h-1])&&(a=t[t.length-1],e=i?{x:(c+f)/2,y:(null==a?void 0:a.y)||u}:{x:(null==a?void 0:a.x)||s,y:(c+f)/2},a&&!o(a,e)||t.push(e))),t};function Ob(t,e,n,r,i){if(!(isNaN(e)||isNaN(n)||isNaN(r))){var o,a,s,l,u,c,h,d,f,p,g,m,v=t._root,y={data:i},E=t._x0,_=t._y0,b=t._z0,x=t._x1,S=t._y1,w=t._z1;if(v){for(;v.length;)if((d=e>=(a=(E+x)/2))?E=a:x=a,(f=n>=(s=(_+S)/2))?_=s:S=s,(p=r>=(l=(b+w)/2))?b=l:w=l,!(v=(o=v)[g=p<<2|f<<1|d]))return o[g]=y,t;if(u=+t._x.call(null,v.data),c=+t._y.call(null,v.data),h=+t._z.call(null,v.data),e===u&&n===c&&r===h)y.next=v,o?o[g]=y:t._root=y;else{for(;o=o?o[g]=new Array(8):t._root=new Array(8),(d=e>=(a=(E+x)/2))?E=a:x=a,(f=n>=(s=(_+S)/2))?_=s:S=s,(p=r>=(l=(b+w)/2))?b=l:w=l,(g=p<<2|f<<1|d)==(m=(l<=h)<<2|(s<=c)<<1|a<=u););o[m]=v,o[g]=y}}else t._root=y}return t}function Ib(t,e,n,r,i,o,a){this.node=t,this.x0=e,this.y0=n,this.z0=r,this.x1=i,this.y1=o,this.z1=a}function Lb(t){return t[0]}function kb(t){return t[1]}function Db(t){return t[2]}function Bb(t,e,n,r){e=new Fb(null==e?Lb:e,null==n?kb:n,null==r?Db:r,NaN,NaN,NaN,NaN,NaN,NaN);return null==t?e:e.addAll(t)}function Fb(t,e,n,r,i,o,a,s,l){this._x=t,this._y=e,this._z=n,this._x0=r,this._y0=i,this._z0=o,this._x1=a,this._y1=s,this._z1=l,this._root=void 0}function Ub(t){for(var e={data:t.data},n=e;t=t.next;)n=n.next={data:t.data};return e}var l=Bb.prototype=Fb.prototype,Gb=(l.copy=function(){var t,e,n=new Fb(this._x,this._y,this._z,this._x0,this._y0,this._z0,this._x1,this._y1,this._z1),r=this._root;if(r)if(r.length)for(t=[{source:r,target:n._root=new Array(8)}];r=t.pop();)for(var i=0;i<8;++i)(e=r.source[i])&&(e.length?t.push({source:e,target:r.target[i]=new Array(8)}):r.target[i]=Ub(e));else n._root=Ub(r);return n},l.add=function(t){var e=+this._x.call(null,t),n=+this._y.call(null,t),r=+this._z.call(null,t);return Ob(this.cover(e,n,r),e,n,r,t)},l.addAll=function(o){var a=(o=Array.isArray(o)?o:Array.from(o)).length,s=new Float64Array(a),l=new Float64Array(a),u=new Float64Array(a);let c=1/0,h=1/0,d=1/0,f=-1/0,p=-1/0,g=-1/0;for(let t=0,e,n,r,i;t<a;++t)isNaN(n=+this._x.call(null,e=o[t]))||isNaN(r=+this._y.call(null,e))||isNaN(i=+this._z.call(null,e))||(s[t]=n,l[t]=r,u[t]=i,n<c&&(c=n),n>f&&(f=n),r<h&&(h=r),r>p&&(p=r),i<d&&(d=i),i>g&&(g=i));if(!(c>f||h>p||d>g)){this.cover(c,h,d).cover(f,p,g);for(let t=0;t<a;++t)Ob(this,s[t],l[t],u[t],o[t])}return this},l.cover=function(t,e,n){if(!(isNaN(t=+t)||isNaN(e=+e)||isNaN(n=+n))){var r=this._x0,i=this._y0,o=this._z0,a=this._x1,s=this._y1,l=this._z1;if(isNaN(r))a=(r=Math.floor(t))+1,s=(i=Math.floor(e))+1,l=(o=Math.floor(n))+1;else{for(var u,c,h=a-r||1,d=this._root;t<r||a<=t||e<i||s<=e||n<o||l<=n;)switch(c=(n<o)<<2|(e<i)<<1|t<r,(u=new Array(8))[c]=d,d=u,h*=2,c){case 0:a=r+h,s=i+h,l=o+h;break;case 1:r=a-h,s=i+h,l=o+h;break;case 2:a=r+h,i=s-h,l=o+h;break;case 3:r=a-h,i=s-h,l=o+h;break;case 4:a=r+h,s=i+h,o=l-h;break;case 5:r=a-h,s=i+h,o=l-h;break;case 6:a=r+h,i=s-h,o=l-h;break;case 7:r=a-h,i=s-h,o=l-h}this._root&&this._root.length&&(this._root=d)}this._x0=r,this._y0=i,this._z0=o,this._x1=a,this._y1=s,this._z1=l}return this},l.data=function(){var e=[];return this.visit(function(t){if(!t.length)for(;e.push(t.data),t=t.next;);}),e},l.extent=function(t){return arguments.length?this.cover(+t[0][0],+t[0][1],+t[0][2]).cover(+t[1][0],+t[1][1],+t[1][2]):isNaN(this._x0)?void 0:[[this._x0,this._y0,this._z0],[this._x1,this._y1,this._z1]]},l.find=function(t,e,n,r){var i,o,a,s,l,u,c,h,d,f,p,g=this._x0,m=this._y0,v=this._z0,y=this._x1,E=this._y1,_=this._z1,b=[],x=this._root;for(x&&b.push(new Ib(x,g,m,v,y,E,_)),null==r?r=1/0:(g=t-r,m=e-r,v=n-r,y=t+r,E=e+r,_=n+r,r*=r);i=b.pop();)!(x=i.node)||(h=i.x0)>y||(d=i.y0)>E||(f=i.z0)>_||(c=i.x1)<g||(u=i.y1)<m||(o=i.z1)<v||(x.length?(b.push(new Ib(x[7],a=(h+c)/2,s=(d+u)/2,l=(f+o)/2,c,u,o),new Ib(x[6],h,s,l,a,u,o),new Ib(x[5],a,d,l,c,s,o),new Ib(x[4],h,d,l,a,s,o),new Ib(x[3],a,s,f,c,u,l),new Ib(x[2],h,s,f,a,u,l),new Ib(x[1],a,d,f,c,s,l),new Ib(x[0],h,d,f,a,s,l)),(o=(l<=n)<<2|(s<=e)<<1|a<=t)&&(i=b[b.length-1],b[b.length-1]=b[b.length-1-o],b[b.length-1-o]=i)):(d=(u=t-+this._x.call(null,x.data))*u+(c=e-+this._y.call(null,x.data))*c+(h=n-+this._z.call(null,x.data))*h)<r&&(g=t-(f=Math.sqrt(r=d)),m=e-f,v=n-f,y=t+f,E=e+f,_=n+f,p=x.data));return p},l.remove=function(t){if(!(isNaN(o=+this._x.call(null,t))||isNaN(a=+this._y.call(null,t))||isNaN(s=+this._z.call(null,t)))){var e,n,r,i,o,a,s,l,u,c,h,d,f,p=this._root,g=this._x0,m=this._y0,v=this._z0,y=this._x1,E=this._y1,_=this._z1;if(p){if(p.length)for(;;){if((u=o>=(l=(g+y)/2))?g=l:y=l,(c=a>=(l=(m+E)/2))?m=l:E=l,(h=s>=(l=(v+_)/2))?v=l:_=l,!(p=(e=p)[d=h<<2|c<<1|u]))return this;if(!p.length)break;(e[d+1&7]||e[d+2&7]||e[d+3&7]||e[d+4&7]||e[d+5&7]||e[d+6&7]||e[d+7&7])&&(n=e,f=d)}for(;p.data!==t;)if(!(p=(r=p).next))return this;(i=p.next)&&delete p.next,r?i?r.next=i:delete r.next:e?(i?e[d]=i:delete e[d],(p=e[0]||e[1]||e[2]||e[3]||e[4]||e[5]||e[6]||e[7])&&p===(e[7]||e[6]||e[5]||e[4]||e[3]||e[2]||e[1]||e[0])&&!p.length&&(n?n[f]=p:this._root=p)):this._root=i}}return this},l.removeAll=function(t){for(var e=0,n=t.length;e<n;++e)this.remove(t[e]);return this},l.root=function(){return this._root},l.size=function(){var e=0;return this.visit(function(t){if(!t.length)for(;++e,t=t.next;);}),e},l.visit=function(t){var e,n,r,i,o,a,s,l,u,c,h=[],d=this._root;for(d&&h.push(new Ib(d,this._x0,this._y0,this._z0,this._x1,this._y1,this._z1));s=h.pop();)!t(d=s.node,n=s.x0,r=s.y0,i=s.z0,o=s.x1,a=s.y1,s=s.z1)&&d.length&&(l=(n+o)/2,u=(r+a)/2,c=(i+s)/2,(e=d[7])&&h.push(new Ib(e,l,u,c,o,a,s)),(e=d[6])&&h.push(new Ib(e,n,u,c,l,a,s)),(e=d[5])&&h.push(new Ib(e,l,r,c,o,u,s)),(e=d[4])&&h.push(new Ib(e,n,r,c,l,u,s)),(e=d[3])&&h.push(new Ib(e,l,u,i,o,a,c)),(e=d[2])&&h.push(new Ib(e,n,u,i,l,a,c)),(e=d[1])&&h.push(new Ib(e,l,r,i,o,u,c)),e=d[0])&&h.push(new Ib(e,n,r,i,l,u,c));return this},l.visitAfter=function(t){var e,n=[],r=[];for(this._root&&n.push(new Ib(this._root,this._x0,this._y0,this._z0,this._x1,this._y1,this._z1));e=n.pop();){var i,o,a,s,l,u,c,h,d,f,p=e.node;p.length&&(o=e.x0,a=e.y0,s=e.z0,h=(o+(l=e.x1))/2,d=(a+(u=e.y1))/2,f=(s+(c=e.z1))/2,(i=p[0])&&n.push(new Ib(i,o,a,s,h,d,f)),(i=p[1])&&n.push(new Ib(i,h,a,s,l,d,f)),(i=p[2])&&n.push(new Ib(i,o,d,s,h,u,f)),(i=p[3])&&n.push(new Ib(i,h,d,s,l,u,f)),(i=p[4])&&n.push(new Ib(i,o,a,f,h,d,c)),(i=p[5])&&n.push(new Ib(i,h,a,f,l,d,c)),(i=p[6])&&n.push(new Ib(i,o,d,f,h,u,c)),i=p[7])&&n.push(new Ib(i,h,d,f,l,u,c)),r.push(e)}for(;e=r.pop();)t(e.node,e.x0,e.y0,e.z0,e.x1,e.y1,e.z1);return this},l.x=function(t){return arguments.length?(this._x=t,this):this._x},l.y=function(t){return arguments.length?(this._y=t,this):this._y},l.z=function(t){return arguments.length?(this._z=t,this):this._z},.81),Wb=.1;function Vb(t,e,n,r,i){var o=e/n,a=t.getAllNodes(),e=a.map(function(t,e){var t=t.data,n=t.nodeStrength;return{x:t.x,y:t.y,z:t.z,size:t.size,index:e,vx:0,vy:0,vz:0,weight:o*n}}),s=(2===i?s1(e,function(t){return t.x},function(t){return t.y}):Bb(e,function(t){return t.x},function(t){return t.y},function(t){return t.z})).visitAfter(jb);e.forEach(function(t){var o,a;o=t,a=i,s.visit(function(t,e,n,r,i){return zb(t,e,n,r,i,o,a)})}),e.map(function(t,e){var e=a[e],n=e.id,e=e.data.mass,e=void 0===e?1:e;r[n]={x:t.vx/e,y:t.vy/e,z:t.vz/e}})}function jb(t){var e=0,n=0,r=0,i=0,o=t.length;if(o){for(var a=0;a<o;a++)(s=t[a])&&s.weight&&(e+=s.weight,n+=s.x*s.weight,r+=s.y*s.weight,i+=s.z*s.weight);t.x=n/e,t.y=r/e,t.z=i/e,t.weight=e}else{var s=t;t.x=s.data.x,t.y=s.data.y,t.z=s.data.z,t.weight=s.data.weight}}var zb=function(t,e,n,r,i,o,a){var s,l=o.x-t.x||Wb,u=o.y-t.y||Wb,c=o.z-t.z||Wb,n=[n,r,i][a-1]-e,r=l*l+u*u+c*c,i=Math.sqrt(r)*r;return n*n*Gb<r?(s=t.weight/i,o.vx+=l*s,o.vy+=u*s,o.vz+=c*s,!0):!t.length&&void(t.data!==o&&(s=t.data.weight/i,o.vx+=l*s,o.vy+=u*s,o.vz+=c*s))};var Hb={dimensions:2,maxIteration:500,gravity:10,factor:1,edgeStrength:200,nodeStrength:1e3,coulombDisScale:.005,damping:.9,maxSpeed:500,minMovement:.4,interval:.02,linkDistance:200,clusterNodeStrength:20,preventOverlap:!0,distanceThresholdMode:"mean"},Ea=(Xb.prototype.execute=function(e,n){return s(this,void 0,void 0,function(){return U(this,function(t){return[2,this.genericForceLayout(!1,e,n)]})})},Xb.prototype.assign=function(e,n){return s(this,void 0,void 0,function(){return U(this,function(t){return this.genericForceLayout(!0,e,n),[2]})})},Xb.prototype.stop=function(){this.timeInterval&&"undefined"!=typeof window&&window.clearInterval(this.timeInterval),this.running=!1},Xb.prototype.tick=function(t){var e=this;if(void 0===t&&(t=this.options.maxIteration||1),this.lastResult)return this.lastResult;for(var n=0;(this.judgingDistance>this.lastOptions.minMovement||n<1)&&n<t;n++)this.runOneStep(this.lastCalcGraph,this.lastGraph,n,this.lastVelMap,this.lastOptions),this.updatePosition(this.lastGraph,this.lastCalcGraph,this.lastVelMap,this.lastOptions);var r={nodes:this.lastLayoutNodes,edges:this.lastLayoutEdges};return this.lastAssign&&r.nodes.forEach(function(t){return e.lastGraph.mergeNodeData(t.id,{x:t.data.x,y:t.data.y,z:3===e.options.dimensions?t.data.z:void 0})}),r},Xb.prototype.genericForceLayout=function(b,x,S){return s(this,void 0,void 0,function(){var e,n,r,i,o,a,s,l,u,c,h,d,f,p,g,m,v,y,E,_=this;return U(this,function(t){return f=k(k({},this.options),S),e=x.getAllNodes(),n=x.getAllEdges(),r=this.formatOptions(f,x),i=r.dimensions,o=r.width,a=r.height,s=r.nodeSize,l=r.getMass,u=r.nodeStrength,c=r.edgeStrength,h=r.linkDistance,d=e.map(function(t,e){return k(k({},t),{data:k(k({},t.data),{x:B(t.data.x)?t.data.x:Math.random()*o,y:B(t.data.y)?t.data.y:Math.random()*a,z:B(t.data.z)?t.data.z:Math.random()*Math.sqrt(o*a),size:s(t)||30,mass:l(t),nodeStrength:u(t)})})}),f=n.map(function(t){return k(k({},t),{data:k(k({},t.data),{edgeStrength:c(t),linkDistance:h(t,x.getNode(t.source),x.getNode(t.target))})})}),null!=e&&e.length?(p={},e.forEach(function(t,e){p[t.id]={x:0,y:0,z:0}}),g=new fy({nodes:d,edges:f}),this.formatCentripetal(r,g),m=r.maxIteration,v=r.minMovement,y=r.onTick,this.lastLayoutNodes=d,this.lastLayoutEdges=f,this.lastAssign=b,this.lastGraph=x,this.lastCalcGraph=g,this.lastOptions=r,this.lastVelMap=p,"undefined"==typeof window?[2]:(E=0,[2,new Promise(function(t){_.timeInterval=window.setInterval(function(){e&&_.running||t({nodes:Zb(x,d),edges:n}),_.runOneStep(g,x,E,p,r),_.updatePosition(x,g,p,r),b&&d.forEach(function(t){return x.mergeNodeData(t.id,{x:t.data.x,y:t.data.y,z:3===i?t.data.z:void 0})}),null!=y&&y({nodes:Zb(x,d),edges:n}),(m<=++E||_.judgingDistance<v)&&(window.clearInterval(_.timeInterval),t({nodes:Zb(x,d),edges:n}))},0),_.running=!0})])):(this.lastResult={nodes:[],edges:n},[2,{nodes:[],edges:n}])})})},Xb.prototype.formatOptions=function(n,r){var i,e=n,t=n.width,o=n.height,a=n.getMass;return e.width=t||"undefined"==typeof window?t:window.innerWidth,e.height=o||"undefined"==typeof window?o:window.innerHeight,n.center||(e.center=[e.width/2,e.height/2]),a||(e.getMass=function(t){var e=1,t=(B(null==t?void 0:t.data.mass)&&(e=null==t?void 0:t.data.mass),r.getDegree(t.id,"both"));return!t||t<5?e:5*t*e}),n.preventOverlap&&(i=_y(0,n.nodeSpacing),n.nodeSize?my(n.nodeSize)?e.nodeSize=function(t){var e=n.nodeSize;return Math.max(e[0],e[1])+i(t)}:e.nodeSize=function(t){return n.nodeSize+i(t)}:e.nodeSize=function(t){var e=((null==t?void 0:t.data)||{}).size;return e?my(e)?Math.max(e[0],e[1])+i(t):Ie(e)?Math.max(e.width,e.height)+i(t):e+i(t):10+i(t)}),e.linkDistance=n.linkDistance?_y(1,n.linkDistance):function(t){return 1+e.nodeSize(r.getNode(t.source))+e.nodeSize(r.getNode(t.target))},e.nodeStrength=_y(1,n.nodeStrength),e.edgeStrength=_y(1,n.edgeStrength),n},Xb.prototype.formatCentripetal=function(r,i){var o,n,e=r.dimensions,t=r.centripetalOptions,a=r.center,s=r.clusterNodeStrength,l=r.leafCluster,u=r.clustering,c=r.nodeClusterBy,h=i.getAllNodes(),t=t||{leaf:2,single:2,others:1,center:function(t){return{x:a[0],y:a[1],z:3===e?a[2]:void 0}}},d=("function"!=typeof s&&(r.clusterNodeStrength=function(t){return s}),[]),l=(l&&c&&(o=Yb(i,c),d=Array.from(new Set(null==h?void 0:h.map(function(t){return t.data[c]})))||[],r.centripetalOptions=Object.assign(t,{single:100,leaf:function(t){var e=o[t.id]||{},n=e.siblingLeaves,e=e.sameTypeLeaves;return(null==e?void 0:e.length)===(null==n?void 0:n.length)||1===(null==d?void 0:d.length)?1:r.clusterNodeStrength(t)},others:1,center:function(t){var e,n=i.getDegree(t.id,"both");return n?(1!==n||1===(t=void 0===(n=(o[t.id]||{}).sameTypeLeaves)?[]:n).length?e=void 0:1<t.length&&(e=$b(t)),{x:null==e?void 0:e.x,y:null==e?void 0:e.y,z:null==e?void 0:e.z}):{x:100,y:100,z:0}}})),u&&c&&(o=o||Yb(i,c),d=(d=d||Array.from(new Set(h.map(function(t){return t.data[c]})))).filter(function(t){return void 0!==t}),n={},d.forEach(function(e){var t=h.filter(function(t){return t.data[c]===e}).map(function(t){return i.getNode(t.id)});n[e]=$b(t)}),r.centripetalOptions=Object.assign(t,{single:function(t){return r.clusterNodeStrength(t)},leaf:function(t){return r.clusterNodeStrength(t)},others:function(t){return r.clusterNodeStrength(t)},center:function(t){t=n[t.data[c]];return{x:null==t?void 0:t.x,y:null==t?void 0:t.y,z:null==t?void 0:t.z}}})),r.centripetalOptions||{}),f=l.leaf,p=l.single,g=l.others;f&&"function"!=typeof f&&(r.centripetalOptions.leaf=function(){return f}),p&&"function"!=typeof p&&(r.centripetalOptions.single=function(){return p}),g&&"function"!=typeof g&&(r.centripetalOptions.others=function(){return g})},Xb.prototype.runOneStep=function(t,e,n,r,i){var o,a={},s=t.getAllNodes(),l=t.getAllEdges();null!=s&&s.length&&(o=i.monitor,this.calRepulsive(t,a,i),l&&this.calAttractive(t,a,i),this.calGravity(t,e,a,i),this.updateVelocity(t,a,r,i),o)&&o({energy:this.calTotalEnergy(a,s),nodes:e.getAllNodes(),edges:e.getAllEdges(),iterations:n})},Xb.prototype.calTotalEnergy=function(o,t){var a,s=this;return null!=t&&t.length?(a=0,t.forEach(function(t,e){var n=o[t.id].x,r=o[t.id].y,i=3===s.options.dimensions?o[t.id].z:0,t=t.data.mass;a+=(void 0===t?1:t)*(n*n+r*r+i*i)*.5}),a):0},Xb.prototype.calRepulsive=function(t,e,n){var r=n.dimensions,i=n.factor,n=n.coulombDisScale;Vb(t,i,n*n,e,r)},Xb.prototype.calAttractive=function(h,d,t){var f=t.dimensions;h.getAllEdges().forEach(function(t,e){var n,r,i,o,a,s=t.source,l=t.target,u=h.getNode(s),c=h.getNode(l);u&&c&&(n=c.data.x-u.data.x,i=c.data.y-u.data.y,o=3===f?c.data.z-u.data.z:0,n||i||(n=.01*Math.random(),i=.01*Math.random(),3===f&&(o=o||.01*Math.random())),r=Math.sqrt(n*n+i*i+o*o),a=(t=t.data||{}).linkDistance,t=t.edgeStrength,u=1/(u.data.mass||1),c=1/(c.data.mass||1),a=i/r*(i=((void 0===a?200:a)-r)*(void 0===t?200:t)),t=o/r*i,d[s].x-=(o=n/r*i)*u,d[s].y-=a*u,d[s].z-=t*u,d[l].x+=o*c,d[l].y+=a*c,d[l].z+=t*c)})},Xb.prototype.calGravity=function(m,v,y,t){var E=t.getCenter,e=m.getAllNodes(),_=v.getAllNodes(),b=v.getAllEdges(),x=t.width,S=t.height,w=t.center,T=t.gravity,A=t.centripetalOptions;e&&e.forEach(function(t){var e=t.id,t=t.data,n=t.mass,r=t.x,i=t.y,t=t.z,o=v.getNode(e),a=0,s=0,l=0,u=T,c=m.getDegree(e,"in"),h=m.getDegree(e,"out"),d=m.getDegree(e,"both"),f=null==E?void 0:E(o,d);if(f?(a=r-(f=D(f,3))[0],s=i-f[1],u=f[2]):(a=r-w[0],s=i-w[1],l=t-w[2]),u&&(y[e].x-=u*a/n,y[e].y-=u*s/n,y[e].z-=u*l/n),A){var f=A.leaf,a=A.single,s=A.others,u=A.center,l=(null==u?void 0:u(o,_,b,x,S))||{x:0,y:0,z:0,centerStrength:0},u=l.x,p=l.y,g=l.z,l=l.centerStrength;if(B(u)&&B(p))return r=(r-u)/n,u=(i-p)/n,i=(t-g)/n,l&&(y[e].x-=l*r,y[e].y-=l*u,y[e].z-=l*i),0===d?(p=a(o))?(y[e].x-=p*r,y[e].y-=p*u,void(y[e].z-=p*i)):void 0:0===c||0===h?(t=f(o,_,b))?(y[e].x-=t*r,y[e].y-=t*u,void(y[e].z-=t*i)):void 0:void((g=s(o))&&(y[e].x-=g*r,y[e].y-=g*u,y[e].z-=g*i))}})},Xb.prototype.updateVelocity=function(t,o,a,e){var s=e.damping,l=e.maxSpeed,u=e.interval,c=e.dimensions,e=t.getAllNodes();null!=e&&e.length&&e.forEach(function(t){var t=t.id,e=(a[t].x+o[t].x*u)*s||.01,n=(a[t].y+o[t].y*u)*s||.01,r=3===c?(a[t].z+o[t].z*u)*s||.01:0,i=Math.sqrt(e*e+n*n+r*r);l<i&&(e*=i=l/i,n*=i,r*=i),a[t]={x:e,y:n,z:r}})},Xb.prototype.updatePosition=function(a,s,l,t){var u,c=this,h=t.distanceThresholdMode,d=t.interval,f=t.dimensions,t=s.getAllNodes();null!=t&&t.length?(u=0,"max"===h?this.judgingDistance=-1/0:"min"===h&&(this.judgingDistance=1/0),t.forEach(function(t){var e=t.id,n=a.getNode(e);if(B(n.data.fx)&&B(n.data.fy))s.mergeNodeData(e,{x:n.data.fx,y:n.data.fy,z:3===f?n.data.fz:void 0});else{var n=l[e].x*d,r=l[e].y*d,i=3===f?l[e].z*d:0,o=(s.mergeNodeData(e,{x:t.data.x+n,y:t.data.y+r,z:t.data.z+i}),Math.sqrt(n*n+r*r+i*i));switch(h){case"max":c.judgingDistance<o&&(c.judgingDistance=o);break;case"min":c.judgingDistance>o&&(c.judgingDistance=o);break;default:u+=o}}}),h&&"mean"!==h||(this.judgingDistance=u/t.length)):this.judgingDistance=0},Xb);function Xb(t){this.options=t=void 0===t?{}:t,this.id="force",this.timeInterval=0,this.judgingDistance=0,this.running=!1,this.options=k(k({},Hb),t)}var Yb=function(n,r){var i,t=n.getAllNodes();return null!=t&&t.length?(i={},t.forEach(function(t,e){1===n.getDegree(t.id,"both")&&(i[t.id]=Kb(n,"leaf",t,r))}),i):{}},Kb=function(e,t,n,r){var i=e.getDegree(n.id,"in"),o=e.getDegree(n.id,"out"),a=n,s=[],i=(0===i?(a=e.getSuccessors(n.id)[0],s=e.getNeighbors(a.id)):0===o&&(a=e.getPredecessors(n.id)[0],s=e.getNeighbors(a.id)),s=s.filter(function(t){return 0===e.getDegree(t.id,"in")||0===e.getDegree(t.id,"out")}),qb(e,t,r,n,s));return{coreNode:a,siblingLeaves:s,sameTypeLeaves:i}},qb=function(e,t,n,r,i){var o=r.data[n]||"",r=(null==i?void 0:i.filter(function(t){return t.data[n]===o}))||[];return r="leaf"===t?r.filter(function(t){return 0===e.getDegree(t.id,"in")||0===e.getDegree(t.id,"out")}):r},$b=function(t){var n={x:0,y:0},t=(t.forEach(function(t){var t=t.data,e=t.x,t=t.y;n.x+=e||0,n.y+=t||0}),t.length||1);return{x:n.x/t,y:n.y/t}},Zb=function(n,t){return t.map(function(t){var e=t.id,t=t.data,e=n.getNode(e);return k(k({},e),{data:k(k({},e.data),{x:t.x,y:t.y,z:t.z})})})};function Qb(t){this.id=t.id||0,this.rx=t.rx,this.ry=t.ry,this.fx=0,this.fy=0,this.mass=t.mass,this.degree=t.degree,this.g=t.g||0}Qb.prototype.distanceTo=function(t){var e=this.rx-t.rx,t=this.ry-t.ry;return Math.hypot(e,t)},Qb.prototype.setPos=function(t,e){this.rx=t,this.ry=e},Qb.prototype.resetForce=function(){this.fx=0,this.fy=0},Qb.prototype.addForce=function(t){var e=t.rx-this.rx,n=t.ry-this.ry,r=Math.hypot(e,n),t=this.g*(this.degree+1)*(t.degree+1)/(r=r<1e-4?1e-4:r);this.fx+=t*e/r,this.fy+=t*n/r},Qb.prototype.in=function(t){return t.contains(this.rx,this.ry)},Qb.prototype.add=function(t){var e=this.mass+t.mass;return new Qb({rx:(this.rx*this.mass+t.rx*t.mass)/e,ry:(this.ry*this.mass+t.ry*t.mass)/e,mass:e,degree:this.degree+t.degree})};var Jb=Qb;function tx(t){this.xmid=t.xmid,this.ymid=t.ymid,this.length=t.length,this.massCenter=t.massCenter||[0,0],this.mass=t.mass||1}tx.prototype.getLength=function(){return this.length},tx.prototype.contains=function(t,e){var n=this.length/2;return t<=this.xmid+n&&t>=this.xmid-n&&e<=this.ymid+n&&e>=this.ymid-n},tx.prototype.NW=function(){return new tx({xmid:this.xmid-this.length/4,ymid:this.ymid+this.length/4,length:this.length/2})},tx.prototype.NE=function(){return new tx({xmid:this.xmid+this.length/4,ymid:this.ymid+this.length/4,length:this.length/2})},tx.prototype.SW=function(){return new tx({xmid:this.xmid-this.length/4,ymid:this.ymid-this.length/4,length:this.length/2})},tx.prototype.SE=function(){return new tx({xmid:this.xmid+this.length/4,ymid:this.ymid-this.length/4,length:this.length/2})};var ex=tx;function nx(t){this.body=null,this.quad=null,this.NW=null,this.NE=null,this.SW=null,this.SE=null,this.theta=.5,null!=t&&(this.quad=t)}nx.prototype.insert=function(t){null==this.body?this.body=t:this._isExternal()?(this.quad&&(this.NW=new nx(this.quad.NW()),this.NE=new nx(this.quad.NE()),this.SW=new nx(this.quad.SW()),this.SE=new nx(this.quad.SE())),this._putBody(this.body),this._putBody(t),this.body=this.body.add(t)):(this.body=this.body.add(t),this._putBody(t))},nx.prototype._putBody=function(t){this.quad&&(t.in(this.quad.NW())&&this.NW?this.NW.insert(t):t.in(this.quad.NE())&&this.NE?this.NE.insert(t):t.in(this.quad.SW())&&this.SW?this.SW.insert(t):t.in(this.quad.SE())&&this.SE&&this.SE.insert(t))},nx.prototype._isExternal=function(){return null==this.NW&&null==this.NE&&null==this.SW&&null==this.SE},nx.prototype.updateForce=function(t){null!=this.body&&t!==this.body&&(this._isExternal()||(this.quad?this.quad.getLength():0)/this.body.distanceTo(t)<this.theta?t.addForce(this.body):(this.NW&&this.NW.updateForce(t),this.NE&&this.NE.updateForce(t),this.SW&&this.SW.updateForce(t),this.SE&&this.SE.updateForce(t)))};var rx=nx,ix={center:[0,0],width:300,height:300,kr:5,kg:1,mode:"normal",preventOverlap:!1,dissuadeHubs:!1,maxIteration:0,ks:.1,ksmax:10,tao:.1},Fs=(ox.prototype.execute=function(e,n){return s(this,void 0,void 0,function(){return U(this,function(t){return[2,this.genericForceAtlas2Layout(!1,e,n)]})})},ox.prototype.assign=function(e,n){return s(this,void 0,void 0,function(){return U(this,function(t){return this.genericForceAtlas2Layout(!0,e,n),[2]})})},ox.prototype.genericForceAtlas2Layout=function(v,y,E){return s(this,void 0,void 0,function(){var e,n,r,i,o,a,s,l,u,c,h,d,f,p,g,m;return U(this,function(t){if(e=y.getAllEdges(),c=y.getAllNodes(),n=this.formatOptions(E,c.length),r=n.width,i=n.height,o=n.prune,a=n.maxIteration,m=n.nodeSize,s=n.center,null==c||!c.length||1===c.length)return[2,Sy(y,v,s)];if(s=c.map(function(t){return Ey(t,[r,i])}),l=e.filter(function(t){return t.source!==t.target}),u=new fy({nodes:s,edges:l}),c=this.getSizes(u,y,m),this.run(u,y,a,c,v,n),o){for(h=0;h<l.length;h+=1)f=l[h],d=f.source,f=f.target,g=u.getDegree(d),p=u.getDegree(d),g<=1?(g=u.getNode(f),u.mergeNodeData(d,{x:g.data.x,y:g.data.y})):p<=1&&(g=u.getNode(d),u.mergeNodeData(f,{x:g.data.x,y:g.data.y}));m=k(k({},n),{prune:!1,barnesHut:!1}),this.run(u,y,100,c,v,m)}return[2,{nodes:s,edges:e}]})})},ox.prototype.getSizes=function(t,e,n){for(var r=t.getAllNodes(),i={},o=0;o<r.length;o+=1){var a=r[o],s=a.id,a=a.data;i[s]=10,B(a.size)?i[s]=a.size:my(a.size)?(isNaN(a.size[0])||(i[s]=Math.max(a.size[0])),isNaN(a.size[1])||(i[s]=Math.max(a.size[1]))):Ie(a.size)?i[s]=Math.max(a.size.width,a.size.height):Ne(n)?(a=n(e.getNode(s)),my(a)?i[s]=Math.max.apply(Math,O([],D(a))):i[s]=a):my(n)?i[s]=Math.max.apply(Math,O([],D(n))):B(n)&&(i[s]=n)}return i},ox.prototype.formatOptions=function(t,e){void 0===t&&(t={});var t=k(k({},this.options),t),n=t.center,r=t.width,i=t.height,o=t.barnesHut,a=t.prune,s=t.maxIteration,l=t.kr,u=t.kg;return t.width=r||"undefined"==typeof window?r:window.innerWidth,t.height=i||"undefined"==typeof window?i:window.innerHeight,t.center=n||[t.width/2,t.height/2],void 0===o&&250<e&&(t.barnesHut=!0),void 0===a&&100<e&&(t.prune=!0),0!==s||a?0===s&&a&&(t.maxIteration=100,e<=200&&100<e?t.maxIteration=500:200<e&&(t.maxIteration=950)):(t.maxIteration=250,e<=200&&100<e?t.maxIteration=1e3:200<e&&(t.maxIteration=1200)),l||(t.kr=50,100<e&&e<=500?t.kr=20:500<e&&(t.kr=1)),u||(t.kg=20,100<e&&e<=500?t.kg=10:500<e&&(t.kg=1)),t},ox.prototype.run=function(t,e,n,r,i,o){for(var a=o.kr,s=o.barnesHut,l=o.onTick,u=t.getAllNodes(),c=0,h=n,d={},f={},p={},g=0;g<u.length;g+=1){var m=u[g],v=m.data,m=m.id;d[m]=[0,0],s&&(v={id:g,rx:v.x,ry:v.y,mass:1,g:a,degree:t.getDegree(m)},p[m]=new Jb(v))}for(;0<h;)c=this.oneStep(t,{iter:h,preventOverlapIters:50,krPrime:100,sg:c,forces:d,preForces:f,bodies:p,sizes:r},o),h--,null!=l&&l({nodes:u,edges:e.getAllEdges()});return t},ox.prototype.oneStep=function(t,e,n){for(var r=e.iter,i=e.preventOverlapIters,o=e.krPrime,a=e.sg,s=e.preForces,l=e.bodies,u=e.sizes,c=e.forces,e=n.preventOverlap,h=n.barnesHut,d=t.getAllNodes(),f=0;f<d.length;f+=1){var p=d[f].id;s[p]=O([],D(c[p])),c[p]=[0,0]}return c=this.getAttrForces(t,r,i,u,c,n),c=h&&(e&&i<r||!e)?this.getOptRepGraForces(t,c,l,n):this.getRepGraForces(t,r,i,c,o,u,n),this.updatePos(t,c,s,a,n)},ox.prototype.getAttrForces=function(t,e,n,r,i,o){for(var a=o.preventOverlap,s=o.dissuadeHubs,l=o.mode,u=o.prune,c=t.getAllEdges(),h=0;h<c.length;h+=1){var d,f,p=c[h],g=p.source,p=p.target,m=t.getNode(g),v=t.getNode(p),y=t.getDegree(g),E=t.getDegree(p);u&&(y<=1||E<=1)||(v=[v.data.x-m.data.x,v.data.y-m.data.y],m=(m=Math.hypot(v[0],v[1]))<1e-4?1e-4:m,v[0]=v[0]/m,v[1]=v[1]/m,f=d=m=a&&e<n?m-r[g]-r[p]:m,"linlog"===l&&(f=d=Math.log(1+m)),s&&(d=m/y,f=m/E),a&&e<n&&m<=0?f=d=0:a&&e<n&&0<m&&(f=d=m),i[g][0]+=d*v[0],i[p][0]-=f*v[0],i[g][1]+=d*v[1],i[p][1]-=f*v[1])}return i},ox.prototype.getOptRepGraForces=function(t,e,n,r){for(var i=r.kg,o=r.center,a=r.prune,s=t.getAllNodes(),l=s.length,u=9e10,c=-9e10,h=9e10,d=-9e10,f=0;f<l;f+=1){var p=s[f],g=p.id,m=p.data;a&&t.getDegree(g)<=1||(n[g].setPos(m.x,m.y),m.x>=c&&(c=m.x),m.x<=u&&(u=m.x),m.y>=d&&(d=m.y),m.y<=h&&(h=m.y))}for(var r=Math.max(c-u,d-h),v=new ex({xmid:(c+u)/2,ymid:(d+h)/2,length:r,massCenter:o,mass:l}),y=new rx(v),f=0;f<l;f+=1){g=s[f].id;a&&t.getDegree(g)<=1||n[g].in(v)&&y.insert(n[g])}for(f=0;f<l;f+=1){var E,_,b=s[f],g=b.id,m=b.data,b=t.getDegree(g);a&&b<=1||(n[g].resetForce(),y.updateForce(n[g]),e[g][0]-=n[g].fx,e[g][1]-=n[g].fy,E=[m.x-o[0],m.y-o[1]],_=Math.hypot(E[0],E[1]),E[0]=E[0]/(_=_<1e-4?1e-4:_),E[1]=E[1]/_,e[g][0]-=(_=i*(b+1))*E[0],e[g][1]-=_*E[1])}return e},ox.prototype.getRepGraForces=function(t,e,n,r,i,o,a){for(var s=a.preventOverlap,l=a.kr,u=a.kg,c=a.center,h=a.prune,d=t.getAllNodes(),f=d.length,p=0;p<f;p+=1){for(var g=d[p],m=t.getDegree(g.id),v=p+1;v<f;v+=1){var y,E,_,b=d[v],x=t.getDegree(b.id);h&&(m<=1||x<=1)||(y=[b.data.x-g.data.x,b.data.y-g.data.y],E=(E=Math.hypot(y[0],y[1]))<1e-4?1e-4:E,y[0]=y[0]/E,y[1]=y[1]/E,_=l*(m+1)*(x+1)/(E=s&&e<n?E-o[g.id]-o[b.id]:E),s&&e<n&&E<0?_=i*(m+1)*(x+1):s&&e<n&&0===E?_=0:s&&e<n&&0<E&&(_=l*(m+1)*(x+1)/E),r[g.id][0]-=_*y[0],r[b.id][0]+=_*y[0],r[g.id][1]-=_*y[1],r[b.id][1]+=_*y[1])}var S=[g.data.x-c[0],g.data.y-c[1]],w=Math.hypot(S[0],S[1]),w=(S[0]=S[0]/w,S[1]=S[1]/w,u*(m+1));r[g.id][0]-=w*S[0],r[g.id][1]-=w*S[1]}return r},ox.prototype.updatePos=function(t,e,n,r,i){for(var o=i.ks,a=i.tao,s=i.prune,l=i.ksmax,u=t.getAllNodes(),c=u.length,h=[],d=[],f=0,p=0,g=r,m=0;m<c;m+=1){var v,y,E=u[m].id,_=t.getDegree(E);s&&_<=1||(v=[e[E][0]-n[E][0],e[E][1]-n[E][1]],v=Math.hypot(v[0],v[1]),y=[e[E][0]+n[E][0],e[E][1]+n[E][1]],y=Math.hypot(y[0],y[1]),h[m]=v,d[m]=y/2,f+=(_+1)*h[m],p+=(_+1)*d[m])}i=g,g=a*p/f;0!==i&&(g=1.5*i<g?1.5*i:g);for(m=0;m<c;m+=1){var b,x,S=u[m],E=S.id,S=S.data,_=t.getDegree(E);s&&_<=1||B(S.fx)&&B(S.fy)||(x=o*g/(1+g*Math.sqrt(h[m])),b=(x=(b=l/(b=(b=Math.hypot(e[E][0],e[E][1]))<1e-4?1e-4:b))<x?b:x)*e[E][0],x=x*e[E][1],t.mergeNodeData(E,{x:S.x+b,y:S.y+x}))}return g},ox);function ox(t){this.options=t=void 0===t?{}:t,this.id="forceAtlas2",this.options=k(k({},ix),t)}var ax={maxIteration:1e3,gravity:10,speed:5,clustering:!1,clusterGravity:10,width:300,height:300,nodeClusterBy:"cluster"},_a=(sx.prototype.execute=function(e,n){return s(this,void 0,void 0,function(){return U(this,function(t){return[2,this.genericFruchtermanLayout(!1,e,n)]})})},sx.prototype.assign=function(e,n){return s(this,void 0,void 0,function(){return U(this,function(t){return this.genericFruchtermanLayout(!0,e,n),[2]})})},sx.prototype.stop=function(){this.timeInterval&&"undefined"!=typeof window&&window.clearInterval(this.timeInterval),this.running=!1},sx.prototype.tick=function(t){var e=this;if(void 0===t&&(t=this.options.maxIteration||1),this.lastResult)return this.lastResult;for(var n=0;n<t;n++)this.runOneStep(this.lastGraph,this.lastClusterMap,this.lastOptions);var r={nodes:this.lastLayoutNodes,edges:this.lastLayoutEdges};return this.lastAssign&&r.nodes.forEach(function(t){return e.lastGraph.mergeNodeData(t.id,{x:t.data.x,y:t.data.y,z:3===e.options.dimensions?t.data.z:void 0})}),r},sx.prototype.genericFruchtermanLayout=function(y,E,_){return s(this,void 0,void 0,function(){var e,n,r,i,o,a,s,l,u,c,h,d,f,p,g,m,v=this;return U(this,function(t){return this.running?[2]:(e=this.formatOptions(_),n=e.dimensions,r=e.width,i=e.height,o=e.center,a=e.clustering,s=e.nodeClusterBy,l=e.maxIteration,u=e.onTick,c=E.getAllNodes(),h=E.getAllEdges(),null!=c&&c.length?1===c.length?(y&&E.mergeNodeData(c[0].id,{x:o[0],y:o[1],z:3===n?o[2]:void 0}),d={nodes:[k(k({},c[0]),{data:k(k({},c[0].data),{x:o[0],y:o[1],z:3===n?o[2]:void 0})})],edges:h},[2,this.lastResult=d]):(f=c.map(function(t){return Ey(t,[r,i])}),p=new fy({nodes:f,edges:h}),g={},a&&f.forEach(function(t){t=t.data[s];g[t]||(g[t]={name:t,cx:0,cy:0,count:0})}),this.lastLayoutNodes=f,this.lastLayoutEdges=h,this.lastAssign=y,this.lastGraph=p,this.lastOptions=e,this.lastClusterMap=g,"undefined"==typeof window?[2]:(m=0,[2,new Promise(function(t){v.timeInterval=window.setInterval(function(){v.running?(v.runOneStep(p,g,e),y&&f.forEach(function(t){var e=t.id,t=t.data;return E.mergeNodeData(e,{x:t.x,y:t.y,z:3===n?t.z:void 0})}),null!=u&&u({nodes:f,edges:h}),l<=++m&&(window.clearInterval(v.timeInterval),t({nodes:f,edges:h}))):t({nodes:f,edges:h})},0),v.running=!0})])):(d={nodes:[],edges:h},[2,this.lastResult=d]))})})},sx.prototype.formatOptions=function(t){void 0===t&&(t={});var t=k(k({},this.options),t),e=t.clustering,n=t.nodeClusterBy,r=t.center,i=t.width,o=t.height;return t.width=i||"undefined"==typeof window?i:window.innerWidth,t.height=o||"undefined"==typeof window?o:window.innerHeight,t.center=r||[t.width/2,t.height/2],t.clustering=e&&!!n,t},sx.prototype.runOneStep=function(o,a,t){var s=t.dimensions,e=t.height,n=t.width,i=t.gravity,l=t.center,u=t.speed,r=t.clustering,c=t.nodeClusterBy,t=t.clusterGravity,e=e*n,h=Math.sqrt(e)/10,n=o.getAllNodes(),e=e/(n.length+1),d=Math.sqrt(e),f={};if(this.applyCalculate(o,f,d,e),r){for(var p in a)a[p].cx=0,a[p].cy=0,a[p].count=0;for(var p in n.forEach(function(t){var t=t.data,e=a[t[c]];B(t.x)&&(e.cx+=t.x),B(t.y)&&(e.cy+=t.y),e.count++}),a)a[p].cx/=a[p].count,a[p].cy/=a[p].count;var g=t||i;n.forEach(function(t,e){var n,r,i,o=t.id,t=t.data;B(t.x)&&B(t.y)&&(n=a[t[c]],r=Math.sqrt((t.x-n.cx)*(t.x-n.cx)+(t.y-n.cy)*(t.y-n.cy)),f[o].x-=(i=d*g)*(t.x-n.cx)/r,f[o].y-=i*(t.y-n.cy)/r)})}n.forEach(function(t,e){var n,r=t.id,t=t.data;B(t.x)&&B(t.y)&&(f[r].x-=(n=.01*d*i)*(t.x-l[0]),f[r].y-=n*(t.y-l[1]),3===s)&&(f[r].z-=n*(t.z-l[2]))}),n.forEach(function(t,e){var n,r,i=t.id,t=t.data;B(t.fx)&&B(t.fy)?(t.x=t.fx,t.y=t.fy,3===s&&(t.z=t.fz)):B(t.x)&&B(t.y)&&0<(n=Math.sqrt(f[i].x*f[i].x+f[i].y*f[i].y+(3===s?f[i].z*f[i].z:0)))&&(r=Math.min(u/800*h,n),o.mergeNodeData(i,{x:t.x+f[i].x/n*r,y:t.y+f[i].y/n*r,z:3===s?t.z+f[i].z/n*r:void 0}))})},sx.prototype.applyCalculate=function(t,e,n,r){this.calRepulsive(t,e,r),this.calAttractive(t,e,n)},sx.prototype.calRepulsive=function(t,l,u){var c=this,e=t.getAllNodes();e.forEach(function(t,o){var a=t.data,s=t.id;l[s]={x:0,y:0,z:0},e.forEach(function(t,e){var n,r,i=t.data,t=t.id;!(o<=e)&&B(a.x)&&B(i.x)&&B(a.y)&&B(i.y)&&(0===(r=(e=a.x-i.x)*e+(n=a.y-i.y)*n+(i=3===c.options.dimensions?a.z-i.z:0)*i)&&(r=1,i=n=e=.01),r=n*(n=u/r),i=i*n,l[s].x+=e=e*n,l[s].y+=r,l[t].x-=e,l[t].y-=r,3===c.options.dimensions)&&(l[s].z+=i,l[t].z-=i)})})},sx.prototype.calAttractive=function(a,s,l){var u=this;a.getAllEdges().forEach(function(t){var e,n,r,i,o=t.source,t=t.target;o&&t&&o!==t&&(e=a.getNode(o).data,i=a.getNode(t).data,B(i.x))&&B(e.x)&&B(i.y)&&B(e.y)&&(n=i.x-e.x,r=i.y-e.y,i=3===u.options.dimensions?i.z-e.z:0,r=r*(e=Math.sqrt(n*n+r*r+i*i)/l),i=i*e,s[o].x+=n=n*e,s[o].y+=r,s[t].x-=n,s[t].y-=r,3===u.options.dimensions)&&(s[o].z+=i,s[t].z-=i)})},sx);function sx(t){this.options=t=void 0===t?{}:t,this.id="fruchterman",this.timeInterval=0,this.running=!1,this.options=k(k({},ax),t)}var lx={begin:[0,0],preventOverlap:!0,preventOverlapPadding:10,condense:!1,rows:void 0,cols:void 0,position:void 0,sortBy:"degree",nodeSize:30,width:300,height:300},ba=(ux.prototype.execute=function(e,n){return s(this,void 0,void 0,function(){return U(this,function(t){return[2,this.genericGridLayout(!1,e,n)]})})},ux.prototype.assign=function(e,n){return s(this,void 0,void 0,function(){return U(this,function(t){return this.genericGridLayout(!0,e,n),[2]})})},ux.prototype.genericGridLayout=function(O,I,L){return s(this,void 0,void 0,function(){var e,n,r,i,o,a,s,l,u,c,h,d,f,p,g,m,v,y,E,_,b,x,S,w,T,A,M,R,N,C,P;return U(this,function(t){if(f=k(k({},this.options),L),n=f.begin,e=void 0===n?[0,0]:n,n=f.condense,r=f.preventOverlapPadding,i=f.preventOverlap,o=f.rows,a=f.cols,s=f.nodeSpacing,l=f.nodeSize,p=f.width,v=f.height,u=f.position,c=f.sortBy,f=I.getAllNodes(),h=I.getAllEdges(),!(P=null==f?void 0:f.length)||1===P)return[2,Sy(I,O,e)];if(d=f.map(function(t){return Ey(t)}),"degree"===(c="id"===c||Fe(c)&&void 0!==d[0].data[c]?c:"degree")?d.sort(function(t,e){return I.getDegree(e.id,"both")-I.getDegree(t.id,"both")}):"id"===c?d.sort(function(t,e){return B(e.id)&&B(t.id)?e.id-t.id:(""+t.id).localeCompare(""+e.id)}):d.sort(function(t,e){return e.data[c]-t.data[c]}),f=p||"undefined"==typeof window?p:window.innerWidth,p=v||"undefined"==typeof window?v:window.innerHeight,g=P,m={rows:o,cols:a},null!=o&&null!=a?(m.rows=o,m.cols=a):null!=o&&null==a?(m.rows=o,m.cols=Math.ceil(g/m.rows)):null==o&&null!=a?(m.cols=a,m.rows=Math.ceil(g/m.cols)):(v=Math.sqrt(g*p/f),m.rows=Math.round(v),m.cols=Math.round(f/p*v)),m.rows=Math.max(m.rows,1),m.cols=Math.max(m.cols,1),g<m.cols*m.rows)y=cx(m),E=hx(m),g<=(y-1)*E?cx(m,y-1):g<=(E-1)*y&&hx(m,E-1);else for(;m.cols*m.rows<g;)y=cx(m),E=hx(m),g<=(E+1)*y?hx(m,E+1):cx(m,y+1);for(_=n?0:f/m.cols,b=n?0:p/m.rows,(i||s)&&(x=_y(10,s),S=by(30,l,!1),d.forEach(function(t){t.data.x&&t.data.y||(t.data.x=0,t.data.y=0);var e,n=I.getNode(t.id),n=S(n)||30,n=my(n)?(e=n[0],n[1]):e=n,t=void 0!==x?x(t):r,n=n+t;_=Math.max(_,e+t),b=Math.max(b,n)})),w={},T={row:0,col:0},A={},M=0;M<d.length;M++){if(R=d[M],N=void 0,(N=u?u(I.getNode(R.id)):N)&&(void 0!==N.row||void 0!==N.col)){if(void 0===(C={row:N.row,col:N.col}).col)for(C.col=0;dx(w,C);)C.col++;else if(void 0===C.row)for(C.row=0;dx(w,C);)C.row++;A[R.id]=C,fx(w,C)}gx(R,e,_,b,A,m,T,w)}return P={nodes:d,edges:h},O&&d.forEach(function(t){I.mergeNodeData(t.id,{x:t.data.x,y:t.data.y})}),[2,P]})})},ux);function ux(t){this.options=t=void 0===t?{}:t,this.id="grid",this.options=k(k({},lx),t)}var _,cx=function(t,e){var n,r=t.rows||5,i=t.cols||5;return null==e?n=Math.min(r,i):Math.min(r,i)===t.rows?t.rows=e:t.cols=e,n},hx=function(t,e){var n,r=t.rows||5,i=t.cols||5;return null==e?n=Math.max(r,i):Math.max(r,i)===t.rows?t.rows=e:t.cols=e,n},dx=function(t,e){return t["c-"+e.row+"-"+e.col]||!1},fx=function(t,e){return t["c-"+e.row+"-"+e.col]=!0},px=function(t,e){t=t.cols||5;e.col++,e.col>=t&&(e.col=0,e.row++)},gx=function(t,e,n,r,i,o,a,s){var l,u,i=i[t.id];if(i)l=i.col*n+n/2+e[0],u=i.row*r+r/2+e[1];else{for(;dx(s,a);)px(o,a);l=a.col*n+n/2+e[0],u=a.row*r+r/2+e[1],fx(s,a),px(o,a)}t.data.x=l,t.data.y=u};const mx=Object.prototype.toString;function vx(t){t=mx.call(t);return t.endsWith("Array]")&&!t.includes("Big")}function yx(t,e){var n,e=1<arguments.length&&void 0!==e?e:{};if(!vx(t))throw new TypeError("input must be an array");if(0===t.length)throw new TypeError("input must not be empty");if(void 0!==e.output){if(!vx(e.output))throw new TypeError("output option must be an array if specified");n=e.output}else n=new Array(t.length);var r=function(t,e){if(e=1<arguments.length&&void 0!==e?e:{},!vx(t))throw new TypeError("input must be an array");if(0===t.length)throw new TypeError("input must not be empty");var n=void 0===(n=e.fromIndex)?0:n,e=e.toIndex,r=void 0===e?t.length:e;if(n<0||n>=t.length||!Number.isInteger(n))throw new Error("fromIndex must be a positive integer smaller than length");if(r<=n||r>t.length||!Number.isInteger(r))throw new Error("toIndex must be an integer greater than fromIndex and at most equal to length");for(var i=t[n],o=n+1;o<r;o++)t[o]<i&&(i=t[o]);return i}(t),i=function(t,e){if(e=1<arguments.length&&void 0!==e?e:{},!vx(t))throw new TypeError("input must be an array");if(0===t.length)throw new TypeError("input must not be empty");var n=void 0===(n=e.fromIndex)?0:n,e=e.toIndex,r=void 0===e?t.length:e;if(n<0||n>=t.length||!Number.isInteger(n))throw new Error("fromIndex must be a positive integer smaller than length");if(r<=n||r>t.length||!Number.isInteger(r))throw new Error("toIndex must be an integer greater than fromIndex and at most equal to length");for(var i=t[n],o=n+1;o<r;o++)t[o]>i&&(i=t[o]);return i}(t);if(r===i)throw new RangeError("minimum and maximum input values are equal. Cannot rescale a constant array");var o=e.min,a=void 0===o?e.autoMinMax?r:0:o,o=e.max,e=void 0===o?e.autoMinMax?i:1:o;if(e<=a)throw new RangeError("min option must be smaller than max option");for(var s=(e-a)/(i-r),l=0;l<t.length;l++)n[l]=(t[l]-r)*s+a}const Ex=" ".repeat(2),_x=" ".repeat(4);function bx(t,e={}){var{maxRows:e=15,maxColumns:n=10,maxNumSize:r=8,padMinus:i="auto"}=e;return`${t.constructor.name} {
|
|
1
|
+
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).G6V5={})}(this,function(N){"use strict";var C=function(t,e){return(C=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(t,e){t.__proto__=e}:function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])}))(t,e)};function P(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function n(){this.constructor=t}C(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}var k=function(){return(k=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var i in e=arguments[n])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t}).apply(this,arguments)};function I(t,e){var n={};for(i in t)Object.prototype.hasOwnProperty.call(t,i)&&e.indexOf(i)<0&&(n[i]=t[i]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols)for(var r=0,i=Object.getOwnPropertySymbols(t);r<i.length;r++)e.indexOf(i[r])<0&&Object.prototype.propertyIsEnumerable.call(t,i[r])&&(n[i[r]]=t[i[r]]);return n}function s(t,a,s,l){return new(s=s||Promise)(function(n,e){function r(t){try{o(l.next(t))}catch(t){e(t)}}function i(t){try{o(l.throw(t))}catch(t){e(t)}}function o(t){var e;t.done?n(t.value):((e=t.value)instanceof s?e:new s(function(t){t(e)})).then(r,i)}o((l=l.apply(t,a||[])).next())})}function U(r,i){var o,a,s,l={label:0,sent:function(){if(1&s[0])throw s[1];return s[1]},trys:[],ops:[]},u={next:t(0),throw:t(1),return:t(2)};return"function"==typeof Symbol&&(u[Symbol.iterator]=function(){return this}),u;function t(n){return function(t){var e=[n,t];if(o)throw new TypeError("Generator is already executing.");for(;l=u&&e[u=0]?0:l;)try{if(o=1,a&&(s=2&e[0]?a.return:e[0]?a.throw||((s=a.return)&&s.call(a),0):a.next)&&!(s=s.call(a,e[1])).done)return s;switch(a=0,(e=s?[2&e[0],s.value]:e)[0]){case 0:case 1:s=e;break;case 4:return l.label++,{value:e[1],done:!1};case 5:l.label++,a=e[1],e=[0];continue;case 7:e=l.ops.pop(),l.trys.pop();continue;default:if(!(s=0<(s=l.trys).length&&s[s.length-1])&&(6===e[0]||2===e[0])){l=0;continue}if(3===e[0]&&(!s||e[1]>s[0]&&e[1]<s[3]))l.label=e[1];else if(6===e[0]&&l.label<s[1])l.label=s[1],s=e;else{if(!(s&&l.label<s[2])){s[2]&&l.ops.pop(),l.trys.pop();continue}l.label=s[2],l.ops.push(e)}}e=i.call(r,l)}catch(t){e=[6,t],a=0}finally{o=s=0}if(5&e[0])throw e[1];return{value:e[0]?e[1]:void 0,done:!0}}}}function D(t,e){var n="function"==typeof Symbol&&t[Symbol.iterator];if(!n)return t;var r,i,o=n.call(t),a=[];try{for(;(void 0===e||0<e--)&&!(r=o.next()).done;)a.push(r.value)}catch(t){i={error:t}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(i)throw i.error}}return a}function O(t,e,n){if(n||2===arguments.length)for(var r,i=0,o=e.length;i<o;i++)!r&&i in e||((r=r||Array.prototype.slice.call(e,0,i))[i]=e[i]);return t.concat(r||Array.prototype.slice.call(e))}function L(t,e,n,r){if("a"===n&&!r)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof e?t===e&&r:e.has(t))return"m"===n?r:"a"===n?r.call(t):r?r.value:e.get(t);throw new TypeError("Cannot read private member from an object whose class did not declare it")}W.prototype.on=function(t,e,n){return this._events[t]||(this._events[t]=[]),this._events[t].push({callback:e,once:!!n}),this},W.prototype.once=function(t,e){return this.on(t,e,!0)},W.prototype.emit=function(o){for(var a=this,s=[],t=1;t<arguments.length;t++)s[t-1]=arguments[t];function e(t){for(var e,n,r=t.length,i=0;i<r;i++)t[i]&&(n=(e=t[i]).callback,e.once&&(t.splice(i,1),0===t.length&&delete a._events[o],r--,i--),n.apply(a,s))}var n=this._events[o]||[],r=this._events["*"]||[];e(n),e(r)},W.prototype.off=function(t,e){if(t)if(e){for(var n=this._events[t]||[],r=n.length,i=0;i<r;i++)n[i].callback===e&&(n.splice(i,1),r--,i--);0===n.length&&delete this._events[t]}else delete this._events[t];else this._events={};return this},W.prototype.getEvents=function(){return this._events};var G=W;function W(){this._events={}}var V="undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{};function j(t,e,n){return t(n={path:e,exports:{},require:function(t,e){throw null==e&&n.path,new Error("Dynamic requires are not currently supported by @rollup/plugin-commonjs")}},n.exports),n.exports}var z=j(function(t,e){function s(t,e,n,r,i){!function t(e,n,r,i,o){for(;r<i;){600<i-r&&(a=i-r+1,c=n-r+1,l=Math.log(a),s=.5*Math.exp(2*l/3),l=.5*Math.sqrt(l*s*(a-s)/a)*(c-a/2<0?-1:1),u=Math.max(r,Math.floor(n-c*s/a+l)),c=Math.min(i,Math.floor(n+(a-c)*s/a+l)),t(e,n,u,c,o));var a,s,l,u,c,h=e[n],d=r,f=i;for(p(e,r,n),0<o(e[i],h)&&p(e,r,i);d<f;){for(p(e,d,f),d++,f--;o(e[d],h)<0;)d++;for(;0<o(e[f],h);)f--}0===o(e[r],h)?p(e,r,f):p(e,++f,i),f<=n&&(r=f+1),n<=f&&(i=f-1)}}(t,e,n||0,r||t.length-1,i||o)}function p(t,e,n){var r=t[e];t[e]=t[n],t[n]=r}function o(t,e){return t<e?-1:e<t?1:0}function f(t,e){g(t,0,t.children.length,e,t)}function g(t,e,n,r,i){(i=i||y(null)).minX=1/0,i.minY=1/0,i.maxX=-1/0,i.maxY=-1/0;for(var o=e;o<n;o++){var a=t.children[o];d(i,t.leaf?r(a):a)}return i}function d(t,e){t.minX=Math.min(t.minX,e.minX),t.minY=Math.min(t.minY,e.minY),t.maxX=Math.max(t.maxX,e.maxX),t.maxY=Math.max(t.maxY,e.maxY)}function a(t,e){return t.minX-e.minX}function l(t,e){return t.minY-e.minY}function m(t){return(t.maxX-t.minX)*(t.maxY-t.minY)}function v(t){return t.maxX-t.minX+(t.maxY-t.minY)}function c(t,e){return t.minX<=e.minX&&t.minY<=e.minY&&e.maxX<=t.maxX&&e.maxY<=t.maxY}function u(t,e){return e.minX<=t.maxX&&e.minY<=t.maxY&&e.maxX>=t.minX&&e.maxY>=t.minY}function y(t){return{children:t,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function E(t,e,n,r,i){for(var o,a=[e,n];a.length;)(n=a.pop())-(e=a.pop())<=r||(s(t,o=e+Math.ceil((n-e)/r/2)*r,e,n,i),a.push(e,o,o,n))}t.exports=((t=function(t){void 0===t&&(t=9),this._maxEntries=Math.max(4,t),this._minEntries=Math.max(2,Math.ceil(.4*this._maxEntries)),this.clear()}).prototype.all=function(){return this._all(this.data,[])},t.prototype.search=function(t){var e=this.data,n=[];if(u(t,e))for(var r=this.toBBox,i=[];e;){for(var o=0;o<e.children.length;o++){var a=e.children[o],s=e.leaf?r(a):a;u(t,s)&&(e.leaf?n.push(a):c(t,s)?this._all(a,n):i.push(a))}e=i.pop()}return n},t.prototype.collides=function(t){var e=this.data;if(u(t,e))for(var n=[];e;){for(var r=0;r<e.children.length;r++){var i=e.children[r],o=e.leaf?this.toBBox(i):i;if(u(t,o)){if(e.leaf||c(t,o))return!0;n.push(i)}}e=n.pop()}return!1},t.prototype.load=function(t){if(t&&t.length)if(t.length<this._minEntries)for(var e=0;e<t.length;e++)this.insert(t[e]);else{var n,r=this._build(t.slice(),0,t.length-1,0);this.data.children.length?this.data.height===r.height?this._splitRoot(this.data,r):(this.data.height<r.height&&(n=this.data,this.data=r,r=n),this._insert(r,this.data.height-r.height-1,!0)):this.data=r}return this},t.prototype.insert=function(t){return t&&this._insert(t,this.data.height-1),this},t.prototype.clear=function(){return this.data=y([]),this},t.prototype.remove=function(t,e){if(t)for(var n,r,i,o=this.data,a=this.toBBox(t),s=[],l=[];o||s.length;){if(o||(o=s.pop(),r=s[s.length-1],n=l.pop(),i=!0),o.leaf){var u=function(t,e,n){if(!n)return e.indexOf(t);for(var r=0;r<e.length;r++)if(n(t,e[r]))return r;return-1}(t,o.children,e);if(-1!==u)return o.children.splice(u,1),s.push(o),this._condense(s),this}i||o.leaf||!c(o,a)?r?(n++,o=r.children[n],i=!1):o=null:(s.push(o),l.push(n),o=(r=o).children[n=0])}return this},t.prototype.toBBox=function(t){return t},t.prototype.compareMinX=function(t,e){return t.minX-e.minX},t.prototype.compareMinY=function(t,e){return t.minY-e.minY},t.prototype.toJSON=function(){return this.data},t.prototype.fromJSON=function(t){return this.data=t,this},t.prototype._all=function(t,e){for(var n=[];t;)t.leaf?e.push.apply(e,t.children):n.push.apply(n,t.children),t=n.pop();return e},t.prototype._build=function(t,e,n,r){var i,o=n-e+1,a=this._maxEntries;if(o<=a)f(i=y(t.slice(e,n+1)),this.toBBox);else{r||(r=Math.ceil(Math.log(o)/Math.log(a)),a=Math.ceil(o/Math.pow(a,r-1))),(i=y([])).leaf=!1,i.height=r;var s=Math.ceil(o/a),l=s*Math.ceil(Math.sqrt(a));E(t,e,n,l,this.compareMinX);for(var u=e;u<=n;u+=l){var c=Math.min(u+l-1,n);E(t,u,c,s,this.compareMinY);for(var h=u;h<=c;h+=s){var d=Math.min(h+s-1,c);i.children.push(this._build(t,h,d,r-1))}}f(i,this.toBBox)}return i},t.prototype._chooseSubtree=function(t,e,n,r){for(;;){if(r.push(e),e.leaf||r.length-1===n)break;for(var i=1/0,o=1/0,a=void 0,s=0;s<e.children.length;s++){var l=e.children[s],u=m(l),c=(h=t,c=l,(Math.max(c.maxX,h.maxX)-Math.min(c.minX,h.minX))*(Math.max(c.maxY,h.maxY)-Math.min(c.minY,h.minY))-u);c<o?(o=c,i=u<i?u:i,a=l):c===o&&u<i&&(i=u,a=l)}e=a||e.children[0]}var h,c;return e},t.prototype._insert=function(t,e,n){var n=n?t:this.toBBox(t),r=[],i=this._chooseSubtree(n,this.data,e,r);for(i.children.push(t),d(i,n);0<=e&&r[e].children.length>this._maxEntries;)this._split(r,e),e--;this._adjustParentBBoxes(n,r,e)},t.prototype._split=function(t,e){var n=t[e],r=n.children.length,i=this._minEntries,i=(this._chooseSplitAxis(n,i,r),this._chooseSplitIndex(n,i,r)),r=y(n.children.splice(i,n.children.length-i));r.height=n.height,r.leaf=n.leaf,f(n,this.toBBox),f(r,this.toBBox),e?t[e-1].children.push(r):this._splitRoot(n,r)},t.prototype._splitRoot=function(t,e){this.data=y([t,e]),this.data.height=t.height+1,this.data.leaf=!1,f(this.data,this.toBBox)},t.prototype._chooseSplitIndex=function(t,e,n){for(var r,i,o,a,s=1/0,l=1/0,u=e;u<=n-e;u++){var c=g(t,0,u,this.toBBox),h=g(t,u,n,this.toBBox),d=(i=c,d=h,f=a=o=void 0,o=Math.max(i.minX,d.minX),a=Math.max(i.minY,d.minY),f=Math.min(i.maxX,d.maxX),i=Math.min(i.maxY,d.maxY),Math.max(0,f-o)*Math.max(0,i-a)),f=m(c)+m(h);d<s?(s=d,r=u,l=f<l?f:l):d===s&&f<l&&(l=f,r=u)}return r||n-e},t.prototype._chooseSplitAxis=function(t,e,n){var r=t.leaf?this.compareMinX:a,i=t.leaf?this.compareMinY:l;this._allDistMargin(t,e,n,r)<this._allDistMargin(t,e,n,i)&&t.children.sort(r)},t.prototype._allDistMargin=function(t,e,n,r){t.children.sort(r);for(var i=this.toBBox,o=g(t,0,e,i),a=g(t,n-e,n,i),s=v(o)+v(a),l=e;l<n-e;l++){var u=t.children[l];d(o,t.leaf?i(u):u),s+=v(o)}for(var c=n-e-1;e<=c;c--){var h=t.children[c];d(a,t.leaf?i(h):h),s+=v(a)}return s},t.prototype._adjustParentBBoxes=function(t,e,n){for(var r=n;0<=r;r--)d(e[r],t)},t.prototype._condense=function(t){for(var e=t.length-1,n=void 0;0<=e;e--)0===t[e].children.length?0<e?(n=t[e-1].children).splice(n.indexOf(t[e]),1):this.clear():f(t[e],this.toBBox)},t)}),H=1e-6,X="undefined"!=typeof Float32Array?Float32Array:Array;function Y(){var t=new X(9);return X!=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 K(){var t=new X(16);return X!=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 q(t){var e=new X(16);return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[8]=t[8],e[9]=t[9],e[10]=t[10],e[11]=t[11],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15],e}function $(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[8]=e[8],t[9]=e[9],t[10]=e[10],t[11]=e[11],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15],t}function Z(t,e,n,r,i,o,a,s,l,u,c,h,d,f,p,g){var m=new X(16);return m[0]=t,m[1]=e,m[2]=n,m[3]=r,m[4]=i,m[5]=o,m[6]=a,m[7]=s,m[8]=l,m[9]=u,m[10]=c,m[11]=h,m[12]=d,m[13]=f,m[14]=p,m[15]=g,m}function Q(t,e,n,r,i,o,a,s,l,u,c,h,d,f,p,g,m){return t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=o,t[5]=a,t[6]=s,t[7]=l,t[8]=u,t[9]=c,t[10]=h,t[11]=d,t[12]=f,t[13]=p,t[14]=g,t[15]=m,t}function J(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 tt(t,e){var n,r,i,o,a,s;return t===e?(n=e[1],r=e[2],i=e[3],o=e[6],a=e[7],s=e[11],t[1]=e[4],t[2]=e[8],t[3]=e[12],t[4]=n,t[6]=e[9],t[7]=e[13],t[8]=r,t[9]=o,t[11]=e[14],t[12]=i,t[13]=a,t[14]=s):(t[0]=e[0],t[1]=e[4],t[2]=e[8],t[3]=e[12],t[4]=e[1],t[5]=e[5],t[6]=e[9],t[7]=e[13],t[8]=e[2],t[9]=e[6],t[10]=e[10],t[11]=e[14],t[12]=e[3],t[13]=e[7],t[14]=e[11],t[15]=e[15]),t}function et(t,e){var n=e[0],r=e[1],i=e[2],o=e[3],a=e[4],s=e[5],l=e[6],u=e[7],c=e[8],h=e[9],d=e[10],f=e[11],p=e[12],g=e[13],m=e[14],e=e[15],v=n*s-r*a,y=n*l-i*a,E=n*u-o*a,_=r*l-i*s,b=r*u-o*s,x=i*u-o*l,S=c*g-h*p,w=c*m-d*p,T=c*e-f*p,A=h*m-d*g,M=h*e-f*g,R=d*e-f*m,N=v*R-y*M+E*A+_*T-b*w+x*S;return N?(t[0]=(s*R-l*M+u*A)*(N=1/N),t[1]=(i*M-r*R-o*A)*N,t[2]=(g*x-m*b+e*_)*N,t[3]=(d*b-h*x-f*_)*N,t[4]=(l*T-a*R-u*w)*N,t[5]=(n*R-i*T+o*w)*N,t[6]=(m*E-p*x-e*y)*N,t[7]=(c*x-d*E+f*y)*N,t[8]=(a*M-s*T+u*S)*N,t[9]=(r*T-n*M-o*S)*N,t[10]=(p*b-g*E+e*v)*N,t[11]=(h*E-c*b-f*v)*N,t[12]=(s*w-a*A-l*S)*N,t[13]=(n*A-r*w+i*S)*N,t[14]=(g*y-p*_-m*v)*N,t[15]=(c*_-h*y+d*v)*N,t):null}function nt(t){var e=t[0],n=t[1],r=t[2],i=t[3],o=t[4],a=t[5],s=t[6],l=t[7],u=t[8],c=t[9],h=t[10],d=t[11],f=t[12],p=t[13],g=t[14],t=t[15];return(e*a-n*o)*(h*t-d*g)-(e*s-r*o)*(c*t-d*p)+(e*l-i*o)*(c*g-h*p)+(n*s-r*a)*(u*t-d*f)-(n*l-i*a)*(u*g-h*f)+(r*l-i*s)*(u*p-c*f)}function rt(t,e,n){var r=e[0],i=e[1],o=e[2],a=e[3],s=e[4],l=e[5],u=e[6],c=e[7],h=e[8],d=e[9],f=e[10],p=e[11],g=e[12],m=e[13],v=e[14],e=e[15],y=n[0],E=n[1],_=n[2],b=n[3];return t[0]=y*r+E*s+_*h+b*g,t[1]=y*i+E*l+_*d+b*m,t[2]=y*o+E*u+_*f+b*v,t[3]=y*a+E*c+_*p+b*e,y=n[4],E=n[5],_=n[6],b=n[7],t[4]=y*r+E*s+_*h+b*g,t[5]=y*i+E*l+_*d+b*m,t[6]=y*o+E*u+_*f+b*v,t[7]=y*a+E*c+_*p+b*e,y=n[8],E=n[9],_=n[10],b=n[11],t[8]=y*r+E*s+_*h+b*g,t[9]=y*i+E*l+_*d+b*m,t[10]=y*o+E*u+_*f+b*v,t[11]=y*a+E*c+_*p+b*e,y=n[12],E=n[13],_=n[14],b=n[15],t[12]=y*r+E*s+_*h+b*g,t[13]=y*i+E*l+_*d+b*m,t[14]=y*o+E*u+_*f+b*v,t[15]=y*a+E*c+_*p+b*e,t}function it(t,e,n){var r,i,o,a,s,l,u,c,h,d,f,p,g=n[0],m=n[1],n=n[2];return e===t?(t[12]=e[0]*g+e[4]*m+e[8]*n+e[12],t[13]=e[1]*g+e[5]*m+e[9]*n+e[13],t[14]=e[2]*g+e[6]*m+e[10]*n+e[14],t[15]=e[3]*g+e[7]*m+e[11]*n+e[15]):(r=e[0],i=e[1],o=e[2],a=e[3],s=e[4],l=e[5],u=e[6],c=e[7],h=e[8],d=e[9],f=e[10],p=e[11],t[0]=r,t[1]=i,t[2]=o,t[3]=a,t[4]=s,t[5]=l,t[6]=u,t[7]=c,t[8]=h,t[9]=d,t[10]=f,t[11]=p,t[12]=r*g+s*m+h*n+e[12],t[13]=i*g+l*m+d*n+e[13],t[14]=o*g+u*m+f*n+e[14],t[15]=a*g+c*m+p*n+e[15]),t}function ot(t,e,n){var r=n[0],i=n[1],n=n[2];return t[0]=e[0]*r,t[1]=e[1]*r,t[2]=e[2]*r,t[3]=e[3]*r,t[4]=e[4]*i,t[5]=e[5]*i,t[6]=e[6]*i,t[7]=e[7]*i,t[8]=e[8]*n,t[9]=e[9]*n,t[10]=e[10]*n,t[11]=e[11]*n,t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15],t}function at(t,e,n){var r=Math.sin(n),n=Math.cos(n),i=e[4],o=e[5],a=e[6],s=e[7],l=e[8],u=e[9],c=e[10],h=e[11];return e!==t&&(t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[4]=i*n+l*r,t[5]=o*n+u*r,t[6]=a*n+c*r,t[7]=s*n+h*r,t[8]=l*n-i*r,t[9]=u*n-o*r,t[10]=c*n-a*r,t[11]=h*n-s*r,t}function st(t,e,n){var r=Math.sin(n),n=Math.cos(n),i=e[0],o=e[1],a=e[2],s=e[3],l=e[8],u=e[9],c=e[10],h=e[11];return e!==t&&(t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[0]=i*n-l*r,t[1]=o*n-u*r,t[2]=a*n-c*r,t[3]=s*n-h*r,t[8]=i*r+l*n,t[9]=o*r+u*n,t[10]=a*r+c*n,t[11]=s*r+h*n,t}function ht(t,e){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]=e[0],t[13]=e[1],t[14]=e[2],t[15]=1,t}function dt(t,e){return t[0]=e[0],t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=e[1],t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=e[2],t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}function ft(t,e,n){var r=e[0],i=e[1],o=e[2],e=e[3],a=r+r,s=i+i,l=o+o,u=r*a,c=r*s,r=r*l,h=i*s,i=i*l,o=o*l,a=e*a,s=e*s,e=e*l;return t[0]=1-(h+o),t[1]=c+e,t[2]=r-s,t[3]=0,t[4]=c-e,t[5]=1-(u+o),t[6]=i+a,t[7]=0,t[8]=r+s,t[9]=i-a,t[10]=1-(u+h),t[11]=0,t[12]=n[0],t[13]=n[1],t[14]=n[2],t[15]=1,t}function pt(t,e){return t[0]=e[12],t[1]=e[13],t[2]=e[14],t}function gt(t,e){var n=e[0],r=e[1],i=e[2],o=e[4],a=e[5],s=e[6],l=e[8],u=e[9],e=e[10];return t[0]=Math.hypot(n,r,i),t[1]=Math.hypot(o,a,s),t[2]=Math.hypot(l,u,e),t}function mt(t,e){var n=new X(3),r=(gt(n,e),1/n[0]),i=1/n[1],n=1/n[2],o=e[0]*r,a=e[1]*i,s=e[2]*n,l=e[4]*r,u=e[5]*i,c=e[6]*n,r=e[8]*r,i=e[9]*i,e=e[10]*n,n=o+u+e,h=0;return 0<n?(h=2*Math.sqrt(1+n),t[3]=.25*h,t[0]=(c-i)/h,t[1]=(r-s)/h,t[2]=(a-l)/h):u<o&&e<o?(h=2*Math.sqrt(1+o-u-e),t[3]=(c-i)/h,t[0]=.25*h,t[1]=(a+l)/h,t[2]=(r+s)/h):e<u?(h=2*Math.sqrt(1+u-o-e),t[3]=(r-s)/h,t[0]=(a+l)/h,t[1]=.25*h,t[2]=(c+i)/h):(h=2*Math.sqrt(1+e-o-u),t[3]=(a-l)/h,t[0]=(r+s)/h,t[1]=(c+i)/h,t[2]=.25*h),t}function vt(t,e,n,r,i){var o=e[0],a=e[1],s=e[2],e=e[3],l=o+o,u=a+a,c=s+s,h=o*l,d=o*u,o=o*c,f=a*u,a=a*c,s=s*c,l=e*l,u=e*u,e=e*c,c=r[0],p=r[1],r=r[2],g=i[0],m=i[1],i=i[2],v=(1-(f+s))*c,y=(d+e)*c,c=(o-u)*c,d=(d-e)*p,e=(1-(h+s))*p,s=(a+l)*p,p=(o+u)*r,o=(a-l)*r,u=(1-(h+f))*r;return t[0]=v,t[1]=y,t[2]=c,t[3]=0,t[4]=d,t[5]=e,t[6]=s,t[7]=0,t[8]=p,t[9]=o,t[10]=u,t[11]=0,t[12]=n[0]+g-(v*g+d*m+p*i),t[13]=n[1]+m-(y*g+e*m+o*i),t[14]=n[2]+i-(c*g+s*m+u*i),t[15]=1,t}function yt(t,e){var n=e[0],r=e[1],i=e[2],e=e[3],o=n+n,a=r+r,s=i+i,n=n*o,l=r*o,r=r*a,u=i*o,c=i*a,i=i*s,o=e*o,a=e*a,e=e*s;return t[0]=1-r-i,t[1]=l+e,t[2]=u-a,t[3]=0,t[4]=l-e,t[5]=1-n-i,t[6]=c+o,t[7]=0,t[8]=u+a,t[9]=c-o,t[10]=1-n-r,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}function Et(t,e,n,r,i){e=1/Math.tan(e/2);return t[0]=e/n,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=e,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!=i&&i!==1/0?(t[10]=(i+r)*(n=1/(r-i)),t[14]=2*i*r*n):(t[10]=-1,t[14]=-2*r),t}function _t(t,e,n,r,i,o,a){var s=1/(e-n),l=1/(r-i),u=1/(o-a);return t[0]=-2*s,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=-2*l,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=2*u,t[11]=0,t[12]=(e+n)*s,t[13]=(i+r)*l,t[14]=(a+o)*u,t[15]=1,t}Math.hypot||(Math.hypot=function(){for(var t=0,e=arguments.length;e--;)t+=arguments[e]*arguments[e];return Math.sqrt(t)});var bt=_t;function xt(t,e,n,r){var i,o,a,s,l=e[0],u=e[1],e=e[2],c=r[0],h=r[1],r=r[2],d=n[0],f=n[1],n=n[2];return Math.abs(l-d)<H&&Math.abs(u-f)<H&&Math.abs(e-n)<H?J(t):(d=l-d,f=u-f,n=e-n,i=h*(n*=s=1/Math.hypot(d,f,n))-r*(f*=s),r=r*(d*=s)-c*n,c=c*f-h*d,(s=Math.hypot(i,r,c))?(i*=s=1/s,r*=s,c*=s):c=r=i=0,h=f*c-n*r,o=n*i-d*c,a=d*r-f*i,(s=Math.hypot(h,o,a))?(h*=s=1/s,o*=s,a*=s):a=o=h=0,t[0]=i,t[1]=h,t[2]=d,t[3]=0,t[4]=r,t[5]=o,t[6]=f,t[7]=0,t[8]=c,t[9]=a,t[10]=n,t[11]=0,t[12]=-(i*l+r*u+c*e),t[13]=-(h*l+o*u+a*e),t[14]=-(d*l+f*u+n*e),t[15]=1,t)}function St(t,e,n){return t[0]=e[0]-n[0],t[1]=e[1]-n[1],t[2]=e[2]-n[2],t[3]=e[3]-n[3],t[4]=e[4]-n[4],t[5]=e[5]-n[5],t[6]=e[6]-n[6],t[7]=e[7]-n[7],t[8]=e[8]-n[8],t[9]=e[9]-n[9],t[10]=e[10]-n[10],t[11]=e[11]-n[11],t[12]=e[12]-n[12],t[13]=e[13]-n[13],t[14]=e[14]-n[14],t[15]=e[15]-n[15],t}var wt=rt,Tt=Object.freeze({__proto__:null,create:K,clone:q,copy:$,fromValues:Z,set:Q,identity:J,transpose:tt,invert:et,adjoint:function(t,e){var n=e[0],r=e[1],i=e[2],o=e[3],a=e[4],s=e[5],l=e[6],u=e[7],c=e[8],h=e[9],d=e[10],f=e[11],p=e[12],g=e[13],m=e[14],e=e[15];return t[0]=s*(d*e-f*m)-h*(l*e-u*m)+g*(l*f-u*d),t[1]=-(r*(d*e-f*m)-h*(i*e-o*m)+g*(i*f-o*d)),t[2]=r*(l*e-u*m)-s*(i*e-o*m)+g*(i*u-o*l),t[3]=-(r*(l*f-u*d)-s*(i*f-o*d)+h*(i*u-o*l)),t[4]=-(a*(d*e-f*m)-c*(l*e-u*m)+p*(l*f-u*d)),t[5]=n*(d*e-f*m)-c*(i*e-o*m)+p*(i*f-o*d),t[6]=-(n*(l*e-u*m)-a*(i*e-o*m)+p*(i*u-o*l)),t[7]=n*(l*f-u*d)-a*(i*f-o*d)+c*(i*u-o*l),t[8]=a*(h*e-f*g)-c*(s*e-u*g)+p*(s*f-u*h),t[9]=-(n*(h*e-f*g)-c*(r*e-o*g)+p*(r*f-o*h)),t[10]=n*(s*e-u*g)-a*(r*e-o*g)+p*(r*u-o*s),t[11]=-(n*(s*f-u*h)-a*(r*f-o*h)+c*(r*u-o*s)),t[12]=-(a*(h*m-d*g)-c*(s*m-l*g)+p*(s*d-l*h)),t[13]=n*(h*m-d*g)-c*(r*m-i*g)+p*(r*d-i*h),t[14]=-(n*(s*m-l*g)-a*(r*m-i*g)+p*(r*l-i*s)),t[15]=n*(s*d-l*h)-a*(r*d-i*h)+c*(r*l-i*s),t},determinant:nt,multiply:rt,translate:it,scale:ot,rotate:function(t,e,n,r){var i,o,a,s,l,u,c,h,d,f,p,g,m,v,y,E,_,b,x,S,w=r[0],T=r[1],r=r[2],A=Math.hypot(w,T,r);return A<H?null:(w*=A=1/A,T*=A,r*=A,A=Math.sin(n),n=Math.cos(n),o=e[0],a=e[1],s=e[2],l=e[3],u=e[4],c=e[5],h=e[6],d=e[7],f=e[8],p=e[9],g=e[10],m=e[11],y=w*T*(i=1-n)-r*A,E=T*T*i+n,_=r*T*i+w*A,b=w*r*i+T*A,x=T*r*i-w*A,S=r*r*i+n,t[0]=o*(n=w*w*i+n)+u*(v=T*w*i+r*A)+f*(r=r*w*i-T*A),t[1]=a*n+c*v+p*r,t[2]=s*n+h*v+g*r,t[3]=l*n+d*v+m*r,t[4]=o*y+u*E+f*_,t[5]=a*y+c*E+p*_,t[6]=s*y+h*E+g*_,t[7]=l*y+d*E+m*_,t[8]=o*b+u*x+f*S,t[9]=a*b+c*x+p*S,t[10]=s*b+h*x+g*S,t[11]=l*b+d*x+m*S,e!==t&&(t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t)},rotateX:at,rotateY:st,rotateZ:function(t,e,n){var r=Math.sin(n),n=Math.cos(n),i=e[0],o=e[1],a=e[2],s=e[3],l=e[4],u=e[5],c=e[6],h=e[7];return e!==t&&(t[8]=e[8],t[9]=e[9],t[10]=e[10],t[11]=e[11],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[0]=i*n+l*r,t[1]=o*n+u*r,t[2]=a*n+c*r,t[3]=s*n+h*r,t[4]=l*n-i*r,t[5]=u*n-o*r,t[6]=c*n-a*r,t[7]=h*n-s*r,t},fromTranslation:ht,fromScaling:dt,fromRotation:function(t,e,n){var r,i=n[0],o=n[1],n=n[2],a=Math.hypot(i,o,n);return a<H?null:(i*=a=1/a,o*=a,n*=a,a=Math.sin(e),e=Math.cos(e),t[0]=i*i*(r=1-e)+e,t[1]=o*i*r+n*a,t[2]=n*i*r-o*a,t[3]=0,t[4]=i*o*r-n*a,t[5]=o*o*r+e,t[6]=n*o*r+i*a,t[7]=0,t[8]=i*n*r+o*a,t[9]=o*n*r-i*a,t[10]=n*n*r+e,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t)},fromXRotation:function(t,e){var n=Math.sin(e),e=Math.cos(e);return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=e,t[6]=n,t[7]=0,t[8]=0,t[9]=-n,t[10]=e,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t},fromYRotation:function(t,e){var n=Math.sin(e),e=Math.cos(e);return t[0]=e,t[1]=0,t[2]=-n,t[3]=0,t[4]=0,t[5]=1,t[6]=0,t[7]=0,t[8]=n,t[9]=0,t[10]=e,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t},fromZRotation:function(t,e){var n=Math.sin(e),e=Math.cos(e);return t[0]=e,t[1]=n,t[2]=0,t[3]=0,t[4]=-n,t[5]=e,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},fromRotationTranslation:ft,fromQuat2:function(t,e){var n=new X(3),r=-e[0],i=-e[1],o=-e[2],a=e[3],s=e[4],l=e[5],u=e[6],c=e[7],h=r*r+i*i+o*o+a*a;return 0<h?(n[0]=2*(s*a+c*r+l*o-u*i)/h,n[1]=2*(l*a+c*i+u*r-s*o)/h,n[2]=2*(u*a+c*o+s*i-l*r)/h):(n[0]=2*(s*a+c*r+l*o-u*i),n[1]=2*(l*a+c*i+u*r-s*o),n[2]=2*(u*a+c*o+s*i-l*r)),ft(t,e,n),t},getTranslation:pt,getScaling:gt,getRotation:mt,fromRotationTranslationScale:function(t,e,n,r){var i=e[0],o=e[1],a=e[2],e=e[3],s=i*(c=i+i),l=i*(h=o+o),i=i*(d=a+a),u=o*h,o=o*d,a=a*d,c=e*c,h=e*h,e=e*d,d=r[0],f=r[1],r=r[2];return t[0]=(1-(u+a))*d,t[1]=(l+e)*d,t[2]=(i-h)*d,t[3]=0,t[4]=(l-e)*f,t[5]=(1-(s+a))*f,t[6]=(o+c)*f,t[7]=0,t[8]=(i+h)*r,t[9]=(o-c)*r,t[10]=(1-(s+u))*r,t[11]=0,t[12]=n[0],t[13]=n[1],t[14]=n[2],t[15]=1,t},fromRotationTranslationScaleOrigin:vt,fromQuat:yt,frustum:function(t,e,n,r,i,o,a){var s=1/(n-e),l=1/(i-r),u=1/(o-a);return t[0]=2*o*s,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=2*o*l,t[6]=0,t[7]=0,t[8]=(n+e)*s,t[9]=(i+r)*l,t[10]=(a+o)*u,t[11]=-1,t[12]=0,t[13]=0,t[14]=a*o*2*u,t[15]=0,t},perspectiveNO:Et,perspective:Et,perspectiveZO:function(t,e,n,r,i){return e=1/Math.tan(e/2),t[0]=e/n,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=e,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!=i&&i!==1/0?(t[10]=i*(n=1/(r-i)),t[14]=i*r*n):(t[10]=-1,t[14]=-r),t},perspectiveFromFieldOfView:function(t,e,n,r){var i=Math.tan(e.upDegrees*Math.PI/180),o=Math.tan(e.downDegrees*Math.PI/180),a=Math.tan(e.leftDegrees*Math.PI/180),e=Math.tan(e.rightDegrees*Math.PI/180),s=2/(a+e),l=2/(i+o);return t[0]=s,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=l,t[6]=0,t[7]=0,t[8]=-(a-e)*s*.5,t[9]=(i-o)*l*.5,t[10]=r/(n-r),t[11]=-1,t[12]=0,t[13]=0,t[14]=r*n/(n-r),t[15]=0,t},orthoNO:_t,ortho:bt,orthoZO:function(t,e,n,r,i,o,a){var s=1/(e-n),l=1/(r-i),a=1/(o-a);return t[0]=-2*s,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=-2*l,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=a,t[11]=0,t[12]=(e+n)*s,t[13]=(i+r)*l,t[14]=o*a,t[15]=1,t},lookAt:xt,targetTo:function(t,e,n,r){var i=e[0],o=e[1],e=e[2],a=r[0],s=r[1],r=r[2],l=i-n[0],u=o-n[1],n=e-n[2],c=l*l+u*u+n*n,h=(0<c&&(l*=c=1/Math.sqrt(c),u*=c,n*=c),s*n-r*u);return 0<(c=h*h+(r=r*l-a*n)*r+(a=a*u-s*l)*a)&&(h*=c=1/Math.sqrt(c),r*=c,a*=c),t[0]=h,t[1]=r,t[2]=a,t[3]=0,t[4]=u*a-n*r,t[5]=n*h-l*a,t[6]=l*r-u*h,t[7]=0,t[8]=l,t[9]=u,t[10]=n,t[11]=0,t[12]=i,t[13]=o,t[14]=e,t[15]=1,t},str:function(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]+")"},frob:function(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])},add:function(t,e,n){return t[0]=e[0]+n[0],t[1]=e[1]+n[1],t[2]=e[2]+n[2],t[3]=e[3]+n[3],t[4]=e[4]+n[4],t[5]=e[5]+n[5],t[6]=e[6]+n[6],t[7]=e[7]+n[7],t[8]=e[8]+n[8],t[9]=e[9]+n[9],t[10]=e[10]+n[10],t[11]=e[11]+n[11],t[12]=e[12]+n[12],t[13]=e[13]+n[13],t[14]=e[14]+n[14],t[15]=e[15]+n[15],t},subtract:St,multiplyScalar:function(t,e,n){return t[0]=e[0]*n,t[1]=e[1]*n,t[2]=e[2]*n,t[3]=e[3]*n,t[4]=e[4]*n,t[5]=e[5]*n,t[6]=e[6]*n,t[7]=e[7]*n,t[8]=e[8]*n,t[9]=e[9]*n,t[10]=e[10]*n,t[11]=e[11]*n,t[12]=e[12]*n,t[13]=e[13]*n,t[14]=e[14]*n,t[15]=e[15]*n,t},multiplyScalarAndAdd:function(t,e,n,r){return t[0]=e[0]+n[0]*r,t[1]=e[1]+n[1]*r,t[2]=e[2]+n[2]*r,t[3]=e[3]+n[3]*r,t[4]=e[4]+n[4]*r,t[5]=e[5]+n[5]*r,t[6]=e[6]+n[6]*r,t[7]=e[7]+n[7]*r,t[8]=e[8]+n[8]*r,t[9]=e[9]+n[9]*r,t[10]=e[10]+n[10]*r,t[11]=e[11]+n[11]*r,t[12]=e[12]+n[12]*r,t[13]=e[13]+n[13]*r,t[14]=e[14]+n[14]*r,t[15]=e[15]+n[15]*r,t},exactEquals:function(t,e){return t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2]&&t[3]===e[3]&&t[4]===e[4]&&t[5]===e[5]&&t[6]===e[6]&&t[7]===e[7]&&t[8]===e[8]&&t[9]===e[9]&&t[10]===e[10]&&t[11]===e[11]&&t[12]===e[12]&&t[13]===e[13]&&t[14]===e[14]&&t[15]===e[15]},equals:function(t,e){var n=t[0],r=t[1],i=t[2],o=t[3],a=t[4],s=t[5],l=t[6],u=t[7],c=t[8],h=t[9],d=t[10],f=t[11],p=t[12],g=t[13],m=t[14],t=t[15],v=e[0],y=e[1],E=e[2],_=e[3],b=e[4],x=e[5],S=e[6],w=e[7],T=e[8],A=e[9],M=e[10],R=e[11],N=e[12],C=e[13],P=e[14],e=e[15];return Math.abs(n-v)<=H*Math.max(1,Math.abs(n),Math.abs(v))&&Math.abs(r-y)<=H*Math.max(1,Math.abs(r),Math.abs(y))&&Math.abs(i-E)<=H*Math.max(1,Math.abs(i),Math.abs(E))&&Math.abs(o-_)<=H*Math.max(1,Math.abs(o),Math.abs(_))&&Math.abs(a-b)<=H*Math.max(1,Math.abs(a),Math.abs(b))&&Math.abs(s-x)<=H*Math.max(1,Math.abs(s),Math.abs(x))&&Math.abs(l-S)<=H*Math.max(1,Math.abs(l),Math.abs(S))&&Math.abs(u-w)<=H*Math.max(1,Math.abs(u),Math.abs(w))&&Math.abs(c-T)<=H*Math.max(1,Math.abs(c),Math.abs(T))&&Math.abs(h-A)<=H*Math.max(1,Math.abs(h),Math.abs(A))&&Math.abs(d-M)<=H*Math.max(1,Math.abs(d),Math.abs(M))&&Math.abs(f-R)<=H*Math.max(1,Math.abs(f),Math.abs(R))&&Math.abs(p-N)<=H*Math.max(1,Math.abs(p),Math.abs(N))&&Math.abs(g-C)<=H*Math.max(1,Math.abs(g),Math.abs(C))&&Math.abs(m-P)<=H*Math.max(1,Math.abs(m),Math.abs(P))&&Math.abs(t-e)<=H*Math.max(1,Math.abs(t),Math.abs(e))},mul:wt,sub:St});function y(){var t=new X(3);return X!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0),t}function At(t){var e=new X(3);return e[0]=t[0],e[1]=t[1],e[2]=t[2],e}function Mt(t){var e=t[0],n=t[1],t=t[2];return Math.hypot(e,n,t)}function x(t,e,n){var r=new X(3);return r[0]=t,r[1]=e,r[2]=n,r}function Rt(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t}function Nt(t,e,n,r){return t[0]=e,t[1]=n,t[2]=r,t}function Ct(t,e,n){t[0]=e[0]+n[0],t[1]=e[1]+n[1],t[2]=e[2]+n[2]}function Pt(t,e,n){return t[0]=e[0]-n[0],t[1]=e[1]-n[1],t[2]=e[2]-n[2],t}function Ot(t,e,n){return t[0]=e[0]*n,t[1]=e[1]*n,t[2]=e[2]*n,t}function It(t,e){var n=e[0],r=e[1],i=e[2],n=n*n+r*r+i*i;0<n&&(n=1/Math.sqrt(n)),t[0]=e[0]*n,t[1]=e[1]*n,t[2]=e[2]*n}function Lt(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]}function kt(t,e,n){var r=e[0],i=e[1],e=e[2],o=n[0],a=n[1],n=n[2];t[0]=i*n-e*a,t[1]=e*o-r*n,t[2]=r*a-i*o}function Dt(t,e,n,r){var i=e[0],o=e[1],e=e[2];t[0]=i+r*(n[0]-i),t[1]=o+r*(n[1]-o),t[2]=e+r*(n[2]-e)}function Bt(t,e,n){var r=e[0],i=e[1],e=e[2],o=n[3]*r+n[7]*i+n[11]*e+n[15];return t[0]=(n[0]*r+n[4]*i+n[8]*e+n[12])/(o=o||1),t[1]=(n[1]*r+n[5]*i+n[9]*e+n[13])/o,t[2]=(n[2]*r+n[6]*i+n[10]*e+n[14])/o,t}function Ft(t,e){var n=t[0],r=t[1],t=t[2],i=e[0],o=e[1],e=e[2];return Math.abs(n-i)<=H*Math.max(1,Math.abs(n),Math.abs(i))&&Math.abs(r-o)<=H*Math.max(1,Math.abs(r),Math.abs(o))&&Math.abs(t-e)<=H*Math.max(1,Math.abs(t),Math.abs(e))}var Ut=Pt,Gt=function(t,e){var n=e[0]-t[0],r=e[1]-t[1],e=e[2]-t[2];return Math.hypot(n,r,e)},Wt=Mt;function Vt(){var t=new X(4);return X!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0,t[3]=0),t}function jt(t,e,n){var r=e[0],i=e[1],o=e[2],e=e[3];return t[0]=n[0]*r+n[4]*i+n[8]*o+n[12]*e,t[1]=n[1]*r+n[5]*i+n[9]*o+n[13]*e,t[2]=n[2]*r+n[6]*i+n[10]*o+n[14]*e,t[3]=n[3]*r+n[7]*i+n[11]*o+n[15]*e,t}function zt(){var t=new X(4);return X!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0),t[3]=1,t}function Ht(t,e,n){n*=.5;var r=Math.sin(n);return t[0]=r*e[0],t[1]=r*e[1],t[2]=r*e[2],t[3]=Math.cos(n),t}function Xt(t,e,n){var r=e[0],i=e[1],o=e[2],e=e[3],a=n[0],s=n[1],l=n[2],n=n[3];return t[0]=r*n+e*a+i*l-o*s,t[1]=i*n+e*s+o*a-r*l,t[2]=o*n+e*l+r*s-i*a,t[3]=e*n-r*a-i*s-o*l,t}function Yt(t,e){var n=e[0],r=e[1],i=e[2],e=e[3],o=n*n+r*r+i*i+e*e,o=o?1/o:0;return t[0]=-n*o,t[1]=-r*o,t[2]=-i*o,t[3]=e*o,t}function Kt(t,e,n,r){var i=.5*Math.PI/180,i=(e*=i,n*=i,r*=i,Math.sin(e)),e=Math.cos(e),o=Math.sin(n),n=Math.cos(n),a=Math.sin(r),r=Math.cos(r);t[0]=i*n*r-e*o*a,t[1]=e*o*r+i*n*a,t[2]=e*n*a-i*o*r,t[3]=e*n*r+i*o*a}y(),Vt();var qt=function(t,e,n,r){var i=new X(4);return i[0]=t,i[1]=e,i[2]=n,i[3]=r,i},$t=function(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t},Zt=Xt,Qt=function(t,e){var n=e[0],r=e[1],i=e[2],e=e[3],o=n*n+r*r+i*i+e*e;return 0<o&&(o=1/Math.sqrt(o)),t[0]=n*o,t[1]=r*o,t[2]=i*o,t[3]=e*o,t};function Jt(t,e){var n=e[0],r=e[1],n=n*n+r*r;0<n&&(n=1/Math.sqrt(n)),t[0]=e[0]*n,t[1]=e[1]*n}function te(t,e){return t[0]*e[0]+t[1]*e[1]}function ee(t,e){return t[0]===e[0]&&t[1]===e[1]}function ne(t){return t.map(function(t){return Array.isArray(t)?[].concat(t):t})}y(),x(1,0,0),x(0,1,0),zt(),zt(),Y(),t=new X(2),X!=Float32Array&&(t[0]=0,t[1]=0);var re={x1:0,y1:0,x2:0,y2:0,x:0,y:0,qx:null,qy:null};var ie={a:7,c:6,h:1,l:2,m:2,r:4,q:4,s:4,t:2,v:1,z:0};function oe(t){return Array.isArray(t)&&t.every(function(t){var e=t[0].toLowerCase();return ie[e]===t.length-1&&"achlmqstvz".includes(e)})}function ae(t){return oe(t)&&t.every(function(t){t=t[0];return t===t.toUpperCase()})}function se(t){return ae(t)&&t.every(function(t){t=t[0];return"ACLMQZ".includes(t)})}function le(t){for(var e=t.pathValue[t.segmentStart],n=e.toLowerCase(),r=t.data;r.length>=ie[n]&&("m"===n&&2<r.length?(t.segments.push([e].concat(r.splice(0,2))),n="l",e="m"===e?"l":"L"):t.segments.push([e].concat(r.splice(0,ie[n]))),ie[n]););}function ue(t){return 48<=t&&t<=57}function ce(t){for(var e,n=t.pathValue,r=t.max;t.index<r&&(10===(e=n.charCodeAt(t.index))||13===e||8232===e||8233===e||32===e||9===e||11===e||12===e||160===e||5760<=e&&[5760,6158,8192,8193,8194,8195,8196,8197,8198,8199,8200,8201,8202,8239,8287,12288,65279].includes(e));)t.index+=1}function he(t){var e,n,r,i,o,a=t.max,s=t.pathValue,l=t.index,u=s.charCodeAt(l),c=ie[s[l].toLowerCase()];if(t.segmentStart=l,function(t){switch(32|t){case 109:case 122:case 108:case 104:case 118:case 99:case 115:case 113:case 116:case 97:return 1;default:return}}(u)){if(t.index+=1,ce(t),t.data=[],c)for(;;){for(var h=c;0<h;--h){if(97!=(32|u)||3!==h&&4!==h?function(t){var e,n,r=t.max,i=t.pathValue,o=t.index,a=o,s=!1,l=!1,u=!1;if(r<=a)t.err="[path-util]: Invalid path value at index "+a+', "pathValue" is missing param';else if(ue(n=43!==(n=i.charCodeAt(a))&&45!==n?n:i.charCodeAt(a+=1))||46===n){if(46!==n){if(e=48===n,n=i.charCodeAt(a+=1),e&&a<r&&n&&ue(n))return t.err="[path-util]: Invalid path value at index "+o+', "'+i[o]+'" illegal number';for(;a<r&&ue(i.charCodeAt(a));)a+=1,s=!0;n=i.charCodeAt(a)}if(46===n){for(u=!0,a+=1;ue(i.charCodeAt(a));)a+=1,l=!0;n=i.charCodeAt(a)}if(101===n||69===n){if(u&&!s&&!l)return t.err="[path-util]: Invalid path value at index "+a+', "'+i[a]+'" invalid float exponent';if(43!==(n=i.charCodeAt(a+=1))&&45!==n||(a+=1),!(a<r&&ue(i.charCodeAt(a))))return t.err="[path-util]: Invalid path value at index "+a+', "'+i[a]+'" invalid integer exponent';for(;a<r&&ue(i.charCodeAt(a));)a+=1}t.index=a,t.param=+t.pathValue.slice(o,a)}else t.err="[path-util]: Invalid path value at index "+a+', "'+i[a]+'" is not a number'}(t):(o=i=r=void 0,r=(n=t).index,i=n.pathValue,48===(o=i.charCodeAt(r))?(n.param=0,n.index+=1):49===o?(n.param=1,n.index+=1):n.err='[path-util]: invalid Arc flag "'+i[r]+'", expecting 0 or 1 at index '+r),t.err.length)return;t.data.push(t.param),ce(t),t.index<a&&44===s.charCodeAt(t.index)&&(t.index+=1,ce(t))}if(t.index>=t.max)break;if(!(48<=(e=s.charCodeAt(t.index))&&e<=57||43===e||45===e||46===e))break}le(t)}else t.err='[path-util]: Invalid path value "'+s[l]+'" is not a path command'}var de=function(t){this.pathValue=t,this.segments=[],this.max=t.length,this.index=0,this.param=0,this.segmentStart=0,this.data=[],this.err=""};function fe(t){var a,s,l,u;return ae(t)?ne(t):(t=function(t){if(oe(t))return ne(t);var e=new de(t);for(ce(e);e.index<e.max&&!e.err.length;)he(e);return e.err||e.segments}(t),u=l=s=a=0,t.map(function(t){var e=t.slice(1).map(Number),t=t[0],n=t.toUpperCase();if("M"===t)return a=e[0],s=e[1],["M",l=a,u=s];if(t!==n)switch(n){case"A":i=[n,e[0],e[1],e[2],e[3],e[4],e[5]+a,e[6]+s];break;case"V":i=[n,e[0]+s];break;case"H":i=[n,e[0]+a];break;default:var r=e.map(function(t,e){return t+(e%2?s:a)}),i=[n].concat(r)}else i=[n].concat(e);var o=i.length;switch(n){case"Z":a=l,s=u;break;case"H":a=i[1];break;case"V":s=i[1];break;default:a=i[o-2],s=i[o-1],"M"===n&&(l=a,u=s)}return i}))}function pe(t){if(se(t))return ne(t);for(var e,n,r,i,o,a,s,l=fe(t),u=k({},re),c=0;c<l.length;c+=1){l[c]=(e=l[c],n=u,s=a=d=o=h=i=r=void 0,r=e[0],i=n.x1,h=n.y1,o=n.x2,d=n.y2,a=e.slice(1).map(Number),s=e,"TQ".includes(r)||(n.qx=null,n.qy=null),"H"===r?s=["L",e[1],h]:"V"===r?s=["L",i,e[1]]:"S"===r?(e=2*h-d,s=["C",n.x1=2*i-o,n.y1=e].concat(a)):"T"===r?(d=2*i-n.qx,o=2*h-n.qy,s=["Q",n.qx=d,n.qy=o].concat(a)):"Q"===r&&(e=a[0],i=a[1],n.qx=e,n.qy=i),s);var h=l[c],d=h.length;u.x1=+h[d-2],u.y1=+h[d-1],u.x2=+h[d-4]||u.x1,u.y2=+h[d-3]||u.y1}return l}function ge(t,e,n){return{x:t*Math.cos(n)-e*Math.sin(n),y:t*Math.sin(n)+e*Math.cos(n)}}function me(t,e,n,r,i,o,a,s,l,u){var c=120*Math.PI/180,h=Math.PI/180*(+i||0),d=[],f=(u?(E=u[0],_=u[1],v=u[2],y=u[3]):(t=(g=ge(t,e,-h)).x,e=g.y,1<(f=(p=(t-(s=(g=ge(s,l,-h)).x))/2)*p/(n*n)+(g=(e-(l=g.y))/2)*g/(r*r))&&(n*=f=Math.sqrt(f),r*=f),f=n*n,m=r*r,v=(o=(o===a?-1:1)*Math.sqrt(Math.abs((f*m-f*g*g-m*p*p)/(f*g*g+m*p*p))))*n*g/r+(t+s)/2,y=o*-r*p/n+(e+l)/2,E=Math.asin(((e-y)/r*Math.pow(10,9)>>0)/Math.pow(10,9)),_=Math.asin(((l-y)/r*Math.pow(10,9)>>0)/Math.pow(10,9)),E=t<v?Math.PI-E:E,_=s<v?Math.PI-_:_,E<0&&(E=2*Math.PI+E),_<0&&(_=2*Math.PI+_),a&&_<E&&(E-=2*Math.PI),!a&&E<_&&(_-=2*Math.PI)),_-E),p=(Math.abs(f)>c&&(m=_,g=s,o=l,_=E+c*(a&&E<_?1:-1),d=me(s=v+n*Math.cos(_),l=y+r*Math.sin(_),n,r,i,0,a,g,o,[_,m,v,y])),f=_-E,Math.cos(E)),c=Math.sin(E),i=Math.cos(_),a=Math.sin(_),g=Math.tan(f/4),o=4/3*n*g,m=4/3*r*g,v=[t,e],y=[t+o*c,e-m*p],E=[s+o*a,l-m*i],_=[s,l];if(y[0]=2*v[0]-y[0],y[1]=2*v[1]-y[1],u)return y.concat(E,_,d);for(var b=[],x=0,S=(d=y.concat(E,_,d)).length;x<S;x+=1)b[x]=x%2?ge(d[x-1],d[x],h).y:ge(d[x],d[x+1],h).x;return b}function ve(t,e,n){var r=t[0],t=t[1];return[r+(e[0]-r)*n,t+(e[1]-t)*n]}function ye(t,e){return Math.sqrt((t[0]-e[0])*(t[0]-e[0])+(t[1]-e[1])*(t[1]-e[1]))}function Ee(t,e,n,r,i){var o=ye([t,e],[n,r]),a={x:0,y:0};return{length:o,point:a="number"==typeof i?i<=0?{x:t,y:e}:o<=i?{x:n,y:r}:{x:(i=ve([t,e],[n,r],i/o))[0],y:i[1]}:a,min:{x:Math.min(t,n),y:Math.min(e,r)},max:{x:Math.max(t,n),y:Math.max(e,r)}}}function _e(t,e,n,r){var t=[t,e],e=[n,r],i=ve(t,e,.5),e=ve(e,i,.5),o=ve(i,e,.5),a=ve(e,o,.5),s=ve(o,a,.5),t=Ee(t[0],t[1],i[0],i[1],o[0]).point,i=Ee(s[0],s[1],a[0],a[1],e[0]).point;return[t.x,t.y,i.x,i.y,n,r]}function be(t,e){var n;if(void 0===e&&(e=!1),se(n=t)&&n.every(function(t){t=t[0];return"MC".includes(t)}))return n=ne(t),e?[n,[]]:n;for(var r,i=pe(t),o=k({},re),a=[],s="",l=i.length,u=[],c=0;c<l;c+=1){i[c]&&(s=i[c][0]),a[c]=s;var h=function(t,e){var n,r,i,o,a,s,l=t[0],u=t.slice(1).map(Number),c=u[0],h=u[1],d=e.x1,f=e.y1,p=e.x,g=e.y;switch("TQ".includes(l)||(e.qx=null,e.qy=null),l){case"M":return e.x=c,e.y=h,t;case"A":return s=[d,f].concat(u),["C"].concat(me(s[0],s[1],s[2],s[3],s[4],s[5],s[6],s[7],s[8],s[9]));case"Q":return e.qx=c,e.qy=h,s=[d,f].concat(u),["C"].concat((n=s[0],r=s[1],i=s[2],o=s[3],a=s[4],s=s[5],[1/3*n+2/3*i,1/3*r+2/3*o,1/3*a+2/3*i,1/3*s+2/3*o,a,s]));case"L":return["C"].concat(_e(d,f,c,h));case"Z":return d===p&&f===g?["C",d,f,p,g,p,g]:["C"].concat(_e(d,f,p,g))}return t}(i[c],o),d=(i[c]=h,m=g=p=f=d=void 0,i),f=a,p=c;if(7<d[p].length){d[p].shift();for(var g=d[p],m=p;g.length;)f[p]="A",d.splice(m+=1,0,["C"].concat(g.splice(0,6)));d.splice(p,1)}l=i.length,"Z"===s&&u.push(c),r=(h=i[c]).length,o.x1=+h[r-2],o.y1=+h[r-1],o.x2=+h[r-4]||o.x1,o.y2=+h[r-3]||o.y1}return e?[i,u]:i}function xe(t,e){var n=t.x,t=t.y,r=e.x,e=e.y,i=n*r+t*e,o=Math.sqrt((Math.pow(n,2)+Math.pow(t,2))*(Math.pow(r,2)+Math.pow(e,2)));return(n*e-t*r<0?-1:1)*Math.acos(i/o)}function Se(t,e,n,r,i,D,B,o,a,s,l){var u=l.bbox,F=void 0===u||u,u=l.length,U=void 0===u||u,u=l.sampleSize,c=void 0===u?30:u,h="number"==typeof s,d=t,f=e,p=0,g=[d,f,p],m=[d,f],v={x:0,y:0},y=[{x:d,y:f}];h&&s<=0&&(v={x:d,y:f});for(var E,_,b,x,S,w,T,A,M,R,N,C,P,O,I,L,k=0;k<=c;k+=1)E=t,_=e,b=n,x=r,S=i,w=D,T=B,A=o,M=a,R=k/c,C=L=I=O=P=C=N=void 0,C=Math.abs,P=Math.sin,O=Math.cos,I=Math.sqrt,L=Math.PI,b=C(b),C=C(x),x=L/180*((S%360+360)%360),d=(N=E===A&&_===M?{x:E,y:_}:0===b||0===C?Ee(E,_,A,M,R).point:(S=(E-A)/2,N=(_-M)/2,S={x:O(x)*S+P(x)*N,y:-P(x)*S+O(x)*N},1<(N=Math.pow(S.x,2)/Math.pow(b,2)+Math.pow(S.y,2)/Math.pow(C,2))&&(b*=I(N),C*=I(N)),N=(Math.pow(b,2)*Math.pow(C,2)-Math.pow(b,2)*Math.pow(S.y,2)-Math.pow(C,2)*Math.pow(S.x,2))/(Math.pow(b,2)*Math.pow(S.y,2)+Math.pow(C,2)*Math.pow(S.x,2)),w=(w!==T?1:-1)*I(N<0?0:N),I=b*S.y/C*w,N=-C*S.x/b*w,w=O(x)*I-P(x)*N+(E+A)/2,E=P(x)*I+O(x)*N+(_+M)/2,_=xe({x:1,y:0},A={x:(S.x-I)/b,y:(S.y-N)/C}),M=xe(A,{x:(-S.x-I)/b,y:(-S.y-N)/C}),!T&&0<M?M-=2*L:T&&M<0&&(M+=2*L),A=_+(M%=2*L)*R,I=b*O(A),S=C*P(A),{x:O(x)*I-P(x)*S+w,y:P(x)*I+O(x)*S+E})).x,f=N.y,F&&y.push({x:d,y:f}),U&&(p+=ye(m,[d,f])),m=[d,f],h&&s<=p&&s>g[2]&&(T=(p-s)/(p-g[2]),v={x:m[0]*(1-T)+g[0]*T,y:m[1]*(1-T)+g[1]*T}),g=[d,f,p];return{length:p,point:v=h&&p<=s?{x:o,y:a}:v,min:{x:Math.min.apply(null,y.map(function(t){return t.x})),y:Math.min.apply(null,y.map(function(t){return t.y}))},max:{x:Math.max.apply(null,y.map(function(t){return t.x})),y:Math.max.apply(null,y.map(function(t){return t.y}))}}}function we(t,e,n,r,i,o,a,s,l,u){var c=u.bbox,h=void 0===c||c,c=u.length,d=void 0===c||c,c=u.sampleSize,f=void 0===c?10:c,p="number"==typeof l,g=t,m=e,v=0,y=[g,m,v],E=[g,m],_={x:0,y:0},b=[{x:g,y:m}];p&&l<=0&&(_={x:g,y:m});for(var x,S,w,T,A,M,R,N,C,P,O=0;O<=f;O+=1)x=t,S=e,w=n,T=r,A=i,M=o,R=a,N=s,P=void 0,P=1-(C=O/f),g=(x={x:Math.pow(P,3)*x+3*Math.pow(P,2)*C*w+3*P*Math.pow(C,2)*A+Math.pow(C,3)*R,y:Math.pow(P,3)*S+3*Math.pow(P,2)*C*T+3*P*Math.pow(C,2)*M+Math.pow(C,3)*N}).x,m=x.y,h&&b.push({x:g,y:m}),d&&(v+=ye(E,[g,m])),E=[g,m],p&&l<=v&&l>y[2]&&(w=(v-l)/(v-y[2]),_={x:E[0]*(1-w)+y[0]*w,y:E[1]*(1-w)+y[1]*w}),y=[g,m,v];return{length:v,point:_=p&&v<=l?{x:a,y:s}:_,min:{x:Math.min.apply(null,b.map(function(t){return t.x})),y:Math.min.apply(null,b.map(function(t){return t.y}))},max:{x:Math.max.apply(null,b.map(function(t){return t.x})),y:Math.max.apply(null,b.map(function(t){return t.y}))}}}function Te(t,e,n,r,i,o,a,s){var l=s.bbox,u=void 0===l||l,l=s.length,c=void 0===l||l,l=s.sampleSize,h=void 0===l?10:l,d="number"==typeof a,f=t,p=e,g=0,m=[f,p,g],v=[f,p],y={x:0,y:0},E=[{x:f,y:p}];d&&a<=0&&(y={x:f,y:p});for(var _,b,x,S,w,T,A,M,R=0;R<=h;R+=1)_=t,b=e,x=n,S=r,w=i,T=o,M=void 0,M=1-(A=R/h),f=(_={x:Math.pow(M,2)*_+2*M*A*x+Math.pow(A,2)*w,y:Math.pow(M,2)*b+2*M*A*S+Math.pow(A,2)*T}).x,p=_.y,u&&E.push({x:f,y:p}),c&&(g+=ye(v,[f,p])),v=[f,p],d&&a<=g&&a>m[2]&&(x=(g-a)/(g-m[2]),y={x:v[0]*(1-x)+m[0]*x,y:v[1]*(1-x)+m[1]*x}),m=[f,p,g];return{length:g,point:y=d&&g<=a?{x:i,y:o}:y,min:{x:Math.min.apply(null,E.map(function(t){return t.x})),y:Math.min.apply(null,E.map(function(t){return t.y}))},max:{x:Math.max.apply(null,E.map(function(t){return t.x})),y:Math.max.apply(null,E.map(function(t){return t.y}))}}}function Ae(t,e,n){for(var r,i,o,a=pe(t),s="number"==typeof e,l=[],u=0,c=0,h=0,d=0,f=[],p=[],g=0,m={x:0,y:0},v=m,y=m,E=m,_=0,b=0,x=a.length;b<x;b+=1)l=(r="M"===(i=(o=a[b])[0]))?l:[u,c].concat(o.slice(1)),r?(v=m={x:h=o[1],y:d=o[2]},g=0,s&&e<.001&&(E=m)):"L"===i?(g=(r=Ee(l[0],l[1],l[2],l[3],(e||0)-_)).length,m=r.min,v=r.max,y=r.point):"A"===i?(g=(r=Se(l[0],l[1],l[2],l[3],l[4],l[5],l[6],l[7],l[8],(e||0)-_,n||{})).length,m=r.min,v=r.max,y=r.point):"C"===i?(g=(r=we(l[0],l[1],l[2],l[3],l[4],l[5],l[6],l[7],(e||0)-_,n||{})).length,m=r.min,v=r.max,y=r.point):"Q"===i?(g=(r=Te(l[0],l[1],l[2],l[3],l[4],l[5],(e||0)-_,n||{})).length,m=r.min,v=r.max,y=r.point):"Z"===i&&(g=(r=Ee((l=[u,c,h,d])[0],l[1],l[2],l[3],(e||0)-_)).length,m=r.min,v=r.max,y=r.point),s&&_<e&&e<=_+g&&(E=y),p.push(v),f.push(m),_+=g,u=(r="Z"!==i?o.slice(-2):[h,d])[0],c=r[1];return{length:_,point:E=s&&_<=e?{x:u,y:c}:E,min:{x:Math.min.apply(null,f.map(function(t){return t.x})),y:Math.min.apply(null,f.map(function(t){return t.y}))},max:{x:Math.max.apply(null,p.map(function(t){return t.x})),y:Math.max.apply(null,p.map(function(t){return t.y}))}}}function Me(t){return(u=l=s=0)<=be(t).map(function(t){var e,n,r,i,o,a;return"M"===t[0]?(s=t[1],l=t[2],0):(a=t.slice(1),e=a[0],n=a[1],r=a[2],i=a[3],o=a[4],a=a[5],u=3*((a-l)*(e+r)-(o-s)*(n+i)+n*(s-r)-e*(l-i)+a*(r+s/3)-o*(i+l/3))/20,n=t.slice(-2),s=n[0],l=n[1],u)}).reduce(function(t,e){return t+e},0);var s,l,u}function Re(t){return t.map(function(t,e,n){var r,i,o,a,n=e&&n[e-1].slice(-2).concat(t.slice(1)),s=e?we(n[0],n[1],n[2],n[3],n[4],n[5],n[6],n[7],n[8],{bbox:!1}).length:0,n=e?s?(void 0===r&&(r=.5),n=(e=n).slice(0,2),i=e.slice(2,4),o=e.slice(4,6),e=e.slice(6,8),n=ve(n,i,r),i=ve(i,o,r),o=ve(o,e,r),a=ve(n,i,r),i=ve(i,o,r),r=ve(a,i,r),[["C"].concat(n,a,r),["C"].concat(i,o,e)]):[t,t]:[t];return{s:t,ss:n,l:s}})}var Ne=function(t){return"function"==typeof t},M=function(t){return null==t},Ce={}.toString,Pe=function(t,e){return Ce.call(t)==="[object "+e+"]"},Oe=function(t){return Array.isArray?Array.isArray(t):Pe(t,"Array")},Ie=function(t){var e=typeof t;return null!==t&&"object"==e||"function"==e},Le=function(t){return"object"==typeof t&&null!==t},ke=function(t){if(!Le(t)||!Pe(t,"Object"))return!1;if(null===Object.getPrototypeOf(t))return!0;for(var e=t;null!==Object.getPrototypeOf(e);)e=Object.getPrototypeOf(e);return Object.getPrototypeOf(t)===e},De=function(t){if(Oe(t))return t.reduce(function(t,e){return Math.max(t,e)},t[0])},Be=function(t){if(Oe(t))return t.reduce(function(t,e){return Math.min(t,e)},t[0])},Fe=function(t){return Pe(t,"String")},Ue=function(t,e,n){return t<e?e:n<t?n:t},B=function(t){return Pe(t,"Number")},Ge=1e-5;var We=function(t,e){return(t%e+e)%e},Ve=function(t){return Pe(t,"Boolean")},je=function(t){return void 0===t},ze=function(t){if("object"!=typeof t||null===t)return t;if(Oe(t))for(var e=[],n=0,r=t.length;n<r;n++)"object"==typeof t[n]&&null!=t[n]?e[n]=ze(t[n]):e[n]=t[n];else for(var i in e={},t)"object"==typeof t[i]&&null!=t[i]?e[i]=ze(t[i]):e[i]=t[i];return e},He=ze;function Xe(){}function Ye(t,e,n){(t.prototype=e.prototype=n).constructor=t}function Ke(t,e){var n,r=Object.create(t.prototype);for(n in e)r[n]=e[n];return r}function qe(){}var t="\\s*([+-]?\\d+)\\s*",e="\\s*([+-]?\\d*\\.?\\d+(?:[eE][+-]?\\d+)?)\\s*",n="\\s*([+-]?\\d*\\.?\\d+(?:[eE][+-]?\\d+)?)%\\s*",$e=/^#([0-9a-f]{3,8})$/,Ze=new RegExp("^rgb\\("+[t,t,t]+"\\)$"),Qe=new RegExp("^rgb\\("+[n,n,n]+"\\)$"),Je=new RegExp("^rgba\\("+[t,t,t,e]+"\\)$"),tn=new RegExp("^rgba\\("+[n,n,n,e]+"\\)$"),en=new RegExp("^hsl\\("+[e,n,n]+"\\)$"),nn=new RegExp("^hsla\\("+[e,n,n,e]+"\\)$"),rn={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};function on(){return this.rgb().formatHex()}function an(){return this.rgb().formatRgb()}function sn(t){var e,n;return t=(t+"").trim().toLowerCase(),(e=$e.exec(t))?(n=e[1].length,e=parseInt(e[1],16),6===n?ln(e):3===n?new cn(e>>8&15|e>>4&240,e>>4&15|240&e,(15&e)<<4|15&e,1):8===n?un(e>>24&255,e>>16&255,e>>8&255,(255&e)/255):4===n?un(e>>12&15|e>>8&240,e>>8&15|e>>4&240,e>>4&15|240&e,((15&e)<<4|15&e)/255):null):(e=Ze.exec(t))?new cn(e[1],e[2],e[3],1):(e=Qe.exec(t))?new cn(255*e[1]/100,255*e[2]/100,255*e[3]/100,1):(e=Je.exec(t))?un(e[1],e[2],e[3],e[4]):(e=tn.exec(t))?un(255*e[1]/100,255*e[2]/100,255*e[3]/100,e[4]):(e=en.exec(t))?pn(e[1],e[2]/100,e[3]/100,1):(e=nn.exec(t))?pn(e[1],e[2]/100,e[3]/100,e[4]):rn.hasOwnProperty(t)?ln(rn[t]):"transparent"===t?new cn(NaN,NaN,NaN,0):null}function ln(t){return new cn(t>>16&255,t>>8&255,255&t,1)}function un(t,e,n,r){return new cn(t=r<=0?e=n=NaN:t,e,n,r)}function cn(t,e,n,r){this.r=+t,this.g=+e,this.b=+n,this.opacity=+r}function hn(){return"#"+fn(this.r)+fn(this.g)+fn(this.b)}function dn(){var t=this.opacity;return(1===(t=isNaN(t)?1:Math.max(0,Math.min(1,t)))?"rgb(":"rgba(")+Math.max(0,Math.min(255,Math.round(this.r)||0))+", "+Math.max(0,Math.min(255,Math.round(this.g)||0))+", "+Math.max(0,Math.min(255,Math.round(this.b)||0))+(1===t?")":", "+t+")")}function fn(t){return((t=Math.max(0,Math.min(255,Math.round(t)||0)))<16?"0":"")+t.toString(16)}function pn(t,e,n,r){return r<=0?t=e=n=NaN:n<=0||1<=n?t=e=NaN:e<=0&&(t=NaN),new mn(t,e,n,r)}function gn(t){var e,n,r,i,o,a,s,l;return t instanceof mn?new mn(t.h,t.s,t.l,t.opacity):(t=t instanceof qe?t:sn(t))?t instanceof mn?t:(e=(t=t.rgb()).r/255,n=t.g/255,r=t.b/255,i=Math.min(e,n,r),a=NaN,l=((o=Math.max(e,n,r))+i)/2,(s=o-i)?(a=e===o?(n-r)/s+6*(n<r):n===o?(r-e)/s+2:(e-n)/s+4,s/=l<.5?o+i:2-o-i,a*=60):s=0<l&&l<1?0:a,new mn(a,s,l,t.opacity)):new mn}function mn(t,e,n,r){this.h=+t,this.s=+e,this.l=+n,this.opacity=+r}function vn(t,e,n){return 255*(t<60?e+(n-e)*t/60:t<180?n:t<240?e+(n-e)*(240-t)/60:e)}function yn(t,e,n,r){t-=n,n=e-r;return Math.sqrt(t*t+n*n)}function En(t,e){return Math.abs(t-e)<.001}function _n(t,e){var n=Math.min.apply(Math,t),r=Math.min.apply(Math,e);return{x:n,y:r,width:Math.max.apply(Math,t)-n,height:Math.max.apply(Math,e)-r}}function bn(t){return(t+2*Math.PI)%(2*Math.PI)}Ye(qe,sn,{copy:function(t){return Object.assign(new this.constructor,this,t)},displayable:function(){return this.rgb().displayable()},hex:on,formatHex:on,formatHsl:function(){return gn(this).formatHsl()},formatRgb:an,toString:an}),Ye(cn,function(t,e,n,r){return 1===arguments.length?(i=(i=t)instanceof qe?i:sn(i))?new cn((i=i.rgb()).r,i.g,i.b,i.opacity):new cn:new cn(t,e,n,null==r?1:r);var i},Ke(qe,{brighter:function(t){return t=null==t?1/.7:Math.pow(1/.7,t),new cn(this.r*t,this.g*t,this.b*t,this.opacity)},darker:function(t){return t=null==t?.7:Math.pow(.7,t),new cn(this.r*t,this.g*t,this.b*t,this.opacity)},rgb:function(){return this},displayable:function(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:hn,formatHex:hn,formatRgb:dn,toString:dn})),Ye(mn,function(t,e,n,r){return 1===arguments.length?gn(t):new mn(t,e,n,null==r?1:r)},Ke(qe,{brighter:function(t){return t=null==t?1/.7:Math.pow(1/.7,t),new mn(this.h,this.s,this.l*t,this.opacity)},darker:function(t){return t=null==t?.7:Math.pow(.7,t),new mn(this.h,this.s,this.l*t,this.opacity)},rgb:function(){var t=this.h%360+360*(this.h<0),e=isNaN(t)||isNaN(this.s)?0:this.s,n=this.l,e=n+(n<.5?n:1-n)*e,n=2*n-e;return new cn(vn(240<=t?t-240:120+t,n,e),vn(t,n,e),vn(t<120?240+t:t-120,n,e),this.opacity)},displayable:function(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl:function(){var t=this.opacity;return(1===(t=isNaN(t)?1:Math.max(0,Math.min(1,t)))?"hsl(":"hsla(")+(this.h||0)+", "+100*(this.s||0)+"%, "+100*(this.l||0)+"%"+(1===t?")":", "+t+")")}}));var xn={box:function(t,e,n,r){return _n([t,n],[e,r])},length:yn,pointAt:function(t,e,n,r,i){return{x:(1-i)*t+i*n,y:(1-i)*e+i*r}},pointDistance:function(t,e,n,r,i,o){var a=(n-t)*(i-t)+(r-e)*(o-e);return a<0?yn(t,e,i,o):(n-t)*(n-t)+(r-e)*(r-e)<a?yn(n,r,i,o):this.pointToLine(t,e,n,r,i,o)},pointToLine:function(t,e,n,r,i,o){n=[n-t,r-e];return ee(n,[0,0])?Math.sqrt((i-t)*(i-t)+(o-e)*(o-e)):(Jt(r=[-n[1],n[0]],r),Math.abs(te([i-t,o-e],r)))},tangentAngle:function(t,e,n,r){return Math.atan2(r-e,n-t)}},Sn=1e-4;function wn(t,e,n,r,i,o){for(var a=-1,s=1/0,l=[n,r],u=20,c=1/(u=o&&200<o?o/10:u),h=c/10,d=0;d<=u;d++){var f=d*c,p=[i.apply(void 0,t.concat([f])),i.apply(void 0,e.concat([f]))],p=yn(l[0],l[1],p[0],p[1]);p<s&&(a=f,s=p)}if(0===a)return{x:t[0],y:e[0]};if(1===a)return{x:t[(n=t.length)-1],y:e[n-1]};for(var s=1/0,g=0;g<32&&!(h<Sn);g++){var m=a-h,v=a+h,y=[i.apply(void 0,t.concat([m])),i.apply(void 0,e.concat([m]))],y=yn(l[0],l[1],y[0],y[1]);0<=m&&y<s?(a=m,s=y):(m=[i.apply(void 0,t.concat([v])),i.apply(void 0,e.concat([v]))],y=yn(l[0],l[1],m[0],m[1]),v<=1&&y<s?(a=v,s=y):h*=.5)}return{x:i.apply(void 0,t.concat([a])),y:i.apply(void 0,e.concat([a]))}}function Tn(t,e,n,r){var i=1-r;return i*i*t+2*r*i*e+r*r*n}function An(t,e,n){n=t+n-2*e;return En(n,0)?[.5]:(t=(t-e)/n)<=1&&0<=t?[t]:[]}function Mn(t,e,n,r){return 2*(1-r)*(e-t)+2*r*(n-e)}function Rn(t,e,n,r,i,o,a){var s=Tn(t,n,i,a),l=Tn(e,r,o,a),u=xn.pointAt(t,e,n,r,a),n=xn.pointAt(n,r,i,o,a);return[[t,e,u.x,u.y,s,l],[s,l,n.x,n.y,i,o]]}function Nn(t,e,n,r,i,o,a){return 0===a?(yn(t,e,n,r)+yn(n,r,i,o)+yn(t,e,i,o))/2:(e=(t=Rn(t,e,n,r,i,o,.5))[0],n=t[1],e.push(a-1),n.push(a-1),Nn.apply(void 0,e)+Nn.apply(void 0,n))}var Cn={box:function(t,e,n,r,i,o){var a=An(t,n,i)[0],s=An(e,r,o)[0],l=[t,i],u=[e,o];return void 0!==a&&l.push(Tn(t,n,i,a)),void 0!==s&&u.push(Tn(e,r,o,s)),_n(l,u)},length:function(t,e,n,r,i,o){return Nn(t,e,n,r,i,o,3)},nearestPoint:function(t,e,n,r,i,o,a,s){return wn([t,n,i],[e,r,o],a,s,Tn)},pointDistance:function(t,e,n,r,i,o,a,s){t=this.nearestPoint(t,e,n,r,i,o,a,s);return yn(t.x,t.y,a,s)},interpolationAt:Tn,pointAt:function(t,e,n,r,i,o,a){return{x:Tn(t,n,i,a),y:Tn(e,r,o,a)}},divide:Rn,tangentAngle:function(t,e,n,r,i,o,a){t=Mn(t,n,i,a),n=Mn(e,r,o,a);return bn(Math.atan2(n,t))}};function Pn(t,e,n,r,i){var o=1-i;return o*o*o*t+3*e*i*o*o+3*n*i*i*o+r*i*i*i}function On(t,e,n,r,i){var o=1-i;return 3*(o*o*(e-t)+2*o*i*(n-e)+i*i*(r-n))}function In(t,e,n,r){var i,o,r=-3*t+9*e-9*n+3*r,n=6*t-12*e+6*n,e=3*e-3*t,t=[];return En(r,0)?En(n,0)||0<=(i=-e/n)&&i<=1&&t.push(i):En(e=n*n-4*r*e,0)?t.push(-n/(2*r)):0<e&&(o=(-n-(e=Math.sqrt(e)))/(2*r),0<=(i=(-n+e)/(2*r))&&i<=1&&t.push(i),0<=o)&&o<=1&&t.push(o),t}function Ln(t,e,n,r,i,o,a,s,l){var u=Pn(t,n,i,a,l),c=Pn(e,r,o,s,l),h=xn.pointAt(t,e,n,r,l),n=xn.pointAt(n,r,i,o,l),r=xn.pointAt(i,o,a,s,l),i=xn.pointAt(h.x,h.y,n.x,n.y,l),o=xn.pointAt(n.x,n.y,r.x,r.y,l);return[[t,e,h.x,h.y,i.x,i.y,u,c],[u,c,o.x,o.y,r.x,r.y,a,s]]}function kn(t,e,n,r,i,o,a,s,l){if(0===l){for(var u=[t,n,i,a],c=[e,r,o,s],h=0,d=u.length,f=0;f<d;f++)h+=yn(u[f],c[f],u[(f+1)%d],c[(f+1)%d]);return h/2}t=Ln(t,e,n,r,i,o,a,s,.5),e=[].concat(t[0],[l-1]),n=[].concat(t[1],[l-1]);return kn.apply(void 0,e)+kn.apply(void 0,n)}var Dn={extrema:In,box:function(t,e,n,r,i,o,a,s){for(var l=[t,a],u=[e,s],c=In(t,n,i,a),h=In(e,r,o,s),d=0;d<c.length;d++)l.push(Pn(t,n,i,a,c[d]));for(var f=0;f<h.length;f++)u.push(Pn(e,r,o,s,h[f]));return _n(l,u)},length:function(t,e,n,r,i,o,a,s){return kn(t,e,n,r,i,o,a,s,3)},nearestPoint:function(t,e,n,r,i,o,a,s,l,u,c){return wn([t,n,i,a],[e,r,o,s],l,u,Pn,c)},pointDistance:function(t,e,n,r,i,o,a,s,l,u,c){t=this.nearestPoint(t,e,n,r,i,o,a,s,l,u,c);return yn(t.x,t.y,l,u)},interpolationAt:Pn,pointAt:function(t,e,n,r,i,o,a,s,l){return{x:Pn(t,n,i,a,l),y:Pn(e,r,o,s,l)}},divide:Ln,tangentAngle:function(t,e,n,r,i,o,a,s,l){t=On(t,n,i,a,l),n=On(e,r,o,s,l);return bn(Math.atan2(n,t))}};function Bn(t,e){t=Math.abs(t);return 0<e?t:-1*t}var Fn=function(t,e,n,r,i,o){var a=n,s=r;if(0===a||0===s)return{x:t,y:e};for(var n=i-t,r=o-e,l=Math.abs(n),u=Math.abs(r),c=a*a,h=s*s,d=Math.PI/4,f=0,p=0,g=0;g<4;g++){var f=a*Math.cos(d),p=s*Math.sin(d),m=(c-h)*Math.pow(Math.cos(d),3)/a,v=(h-c)*Math.pow(Math.sin(d),3)/s,y=f-m,E=p-v,m=l-m,v=u-v,_=Math.hypot(E,y),b=Math.hypot(v,m);d+=_*Math.asin((y*v-E*m)/(_*b))/Math.sqrt(c+h-f*f-p*p),d=Math.min(Math.PI/2,Math.max(0,d))}return{x:t+Bn(f,n),y:e+Bn(p,r)}};function Un(t,e,n,r,i,o){return n*Math.cos(i)*Math.cos(o)-r*Math.sin(i)*Math.sin(o)+t}function Gn(t,e,n,r,i,o){return n*Math.sin(i)*Math.cos(o)+r*Math.cos(i)*Math.sin(o)+e}function Wn(t,e,n){return{x:t*Math.cos(n),y:e*Math.sin(n)}}function Vn(t,e,n){var r=Math.cos(n),n=Math.sin(n);return[t*r-e*n,t*n+e*r]}var jn={box:function(t,e,n,r,i,o,a){for(var s=Math.atan(-r/n*Math.tan(i)),l=1/0,u=-1/0,c=[o,a],h=2*-Math.PI;h<=2*Math.PI;h+=Math.PI){var d=s+h;o<a?o<d&&d<a&&c.push(d):a<d&&d<o&&c.push(d)}for(var f=0;f<c.length;f++){var p=Un(t,0,n,r,i,c[f]);p<l&&(l=p),u<p&&(u=p)}for(var g=Math.atan(r/(n*Math.tan(i))),m=1/0,v=-1/0,y=[o,a],E=2*-Math.PI;E<=2*Math.PI;E+=Math.PI){var _=g+E;o<a?o<_&&_<a&&y.push(_):a<_&&_<o&&y.push(_)}for(var b=0;b<y.length;b++){var x=Gn(0,e,n,r,i,y[b]);x<m&&(m=x),v<x&&(v=x)}return{x:l,y:m,width:u-l,height:v-m}},length:function(t,e,n,r,i,o,a){},nearestPoint:function(t,e,n,r,i,o,a,s,l){var s=Vn(s-t,l-e,-i),l=s[0],s=s[1],l=Fn(0,0,n,r,l,s),u=(s=l.x,u=l.y,(Math.atan2(u*n,s*r)+2*Math.PI)%(2*Math.PI)),s=(u<o?l=Wn(n,r,o):a<u&&(l=Wn(n,r,a)),Vn(l.x,l.y,i));return{x:s[0]+t,y:s[1]+e}},pointDistance:function(t,e,n,r,i,o,a,s,l){t=this.nearestPoint(t,e,n,r,i,o,a,s,l);return yn(t.x,t.y,s,l)},pointAt:function(t,e,n,r,i,o,a,s){a=(a-o)*s+o;return{x:Un(t,0,n,r,i,a),y:Gn(0,e,n,r,i,a)}},tangentAngle:function(t,e,n,r,i,o,a,s){var l,a=(a-o)*s+o,s=(s=r,o=i,l=a,-1*n*Math.cos(o)*Math.sin(l)-s*Math.sin(o)*Math.cos(l)),i=(o=r,l=i,r=a,-1*n*Math.sin(l)*Math.sin(r)+o*Math.cos(l)*Math.cos(r));return bn(Math.atan2(i,s))}};function zn(t){for(var e=0,n=[],r=0;r<t.length-1;r++){var i=t[r],o=t[r+1],a=yn(i[0],i[1],o[0],o[1]);n.push({from:i,to:o,length:a}),e+=a}return{segments:n,totalLength:e}}var p,Hn,Xn,Yn,Kn={box:function(t){for(var e=[],n=[],r=0;r<t.length;r++){var i=t[r];e.push(i[0]),n.push(i[1])}return _n(e,n)},length:function(t){var e=t;if(e.length<2)return 0;for(var n=0,r=0;r<e.length-1;r++){var i=e[r],o=e[r+1];n+=yn(i[0],i[1],o[0],o[1])}return n},pointAt:function(t,e){var n=e;if(1<n||n<0||t.length<2)return null;var e=zn(t),r=e.segments,i=e.totalLength;if(0===i)return{x:t[0][0],y:t[0][1]};for(var o=0,a=null,s=0;s<r.length;s++){var l=r[s],u=l.from,c=l.to,l=l.length/i;if(o<=n&&n<=o+l){a=xn.pointAt(u[0],u[1],c[0],c[1],(n-o)/l);break}o+=l}return a},pointDistance:function(t,e,n){for(var r=t,i=e,o=n,a=1/0,s=0;s<r.length-1;s++){var l=r[s],u=r[s+1],l=xn.pointDistance(l[0],l[1],u[0],u[1],i,o);l<a&&(a=l)}return a},tangentAngle:function(t,e){var n=e;if(1<n||n<0||t.length<2)return 0;for(var r=(t=zn(t)).segments,i=t.totalLength,o=0,a=0,s=0;s<r.length;s++){var l=r[s],u=l.from,c=l.to,l=l.length/i;if(o<=n&&n<=o+l){a=Math.atan2(c[1]-u[1],c[0]-u[0]);break}o+=l}return a}},qn=j(function(t){var r=Object.prototype.hasOwnProperty,f="~";function n(){}function o(t,e,n){this.fn=t,this.context=e,this.once=n||!1}function i(t,e,n,r,i){if("function"!=typeof n)throw new TypeError("The listener must be a function");n=new o(n,r||t,i),r=f?f+e:e;return t._events[r]?t._events[r].fn?t._events[r]=[t._events[r],n]:t._events[r].push(n):(t._events[r]=n,t._eventsCount++),t}function l(t,e){0==--t._eventsCount?t._events=new n:delete t._events[e]}function e(){this._events=new n,this._eventsCount=0}Object.create&&(n.prototype=Object.create(null),(new n).__proto__||(f=!1)),e.prototype.eventNames=function(){var t,e,n=[];if(0===this._eventsCount)return n;for(e in t=this._events)r.call(t,e)&&n.push(f?e.slice(1):e);return Object.getOwnPropertySymbols?n.concat(Object.getOwnPropertySymbols(t)):n},e.prototype.listeners=function(t){var t=f?f+t:t,e=this._events[t];if(!e)return[];if(e.fn)return[e.fn];for(var n=0,r=e.length,i=new Array(r);n<r;n++)i[n]=e[n].fn;return i},e.prototype.listenerCount=function(t){t=f?f+t:t,t=this._events[t];return t?t.fn?1:t.length:0},e.prototype.emit=function(t,e,n,r,i,o){var a=f?f+t:t;if(!this._events[a])return!1;var s,l=this._events[a],u=arguments.length;if(l.fn){switch(l.once&&this.removeListener(t,l.fn,void 0,!0),u){case 1:return l.fn.call(l.context),!0;case 2:return l.fn.call(l.context,e),!0;case 3:return l.fn.call(l.context,e,n),!0;case 4:return l.fn.call(l.context,e,n,r),!0;case 5:return l.fn.call(l.context,e,n,r,i),!0;case 6:return l.fn.call(l.context,e,n,r,i,o),!0}for(d=1,s=new Array(u-1);d<u;d++)s[d-1]=arguments[d];l.fn.apply(l.context,s)}else for(var c,h=l.length,d=0;d<h;d++)switch(l[d].once&&this.removeListener(t,l[d].fn,void 0,!0),u){case 1:l[d].fn.call(l[d].context);break;case 2:l[d].fn.call(l[d].context,e);break;case 3:l[d].fn.call(l[d].context,e,n);break;case 4:l[d].fn.call(l[d].context,e,n,r);break;default:if(!s)for(c=1,s=new Array(u-1);c<u;c++)s[c-1]=arguments[c];l[d].fn.apply(l[d].context,s)}return!0},e.prototype.on=function(t,e,n){return i(this,t,e,n,!1)},e.prototype.once=function(t,e,n){return i(this,t,e,n,!0)},e.prototype.removeListener=function(t,e,n,r){t=f?f+t:t;if(this._events[t])if(e){var i=this._events[t];if(i.fn)i.fn!==e||r&&!i.once||n&&i.context!==n||l(this,t);else{for(var o=0,a=[],s=i.length;o<s;o++)(i[o].fn!==e||r&&!i[o].once||n&&i[o].context!==n)&&a.push(i[o]);a.length?this._events[t]=1===a.length?a[0]:a:l(this,t)}}else l(this,t);return this},e.prototype.removeAllListeners=function(t){return t?(t=f?f+t:t,this._events[t]&&l(this,t)):(this._events=new n,this._eventsCount=0),this},e.prototype.off=e.prototype.removeListener,e.prototype.addListener=e.prototype.on,e.prefixed=f,t.exports=e.EventEmitter=e});function $n(){$n=function(){return a};var a={},t=Object.prototype,l=t.hasOwnProperty,u=Object.defineProperty||function(t,e,n){t[e]=n.value},e="function"==typeof Symbol?Symbol:{},r=e.iterator||"@@iterator",n=e.asyncIterator||"@@asyncIterator",i=e.toStringTag||"@@toStringTag";function o(t,e,n){return Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{o({},"")}catch(t){o=function(t,e,n){return t[e]=n}}function s(t,e,n,r){var i,o,a,s,e=e&&e.prototype instanceof d?e:d,e=Object.create(e.prototype),r=new b(r||[]);return u(e,"_invoke",{value:(i=t,o=n,a=r,s="suspendedStart",function(t,e){if("executing"===s)throw new Error("Generator is already running");if("completed"===s){if("throw"===t)throw e;return S()}for(a.method=t,a.arg=e;;){var n=a.delegate;if(n){n=function t(e,n){var r=n.method,i=e.iterator[r];if(void 0===i)return n.delegate=null,"throw"===r&&e.iterator.return&&(n.method="return",n.arg=void 0,t(e,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),h;r=c(i,e.iterator,n.arg);if("throw"===r.type)return n.method="throw",n.arg=r.arg,n.delegate=null,h;i=r.arg;return i?i.done?(n[e.resultName]=i.value,n.next=e.nextLoc,"return"!==n.method&&(n.method="next",n.arg=void 0),n.delegate=null,h):i:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,h)}(n,a);if(n){if(n===h)continue;return n}}if("next"===a.method)a.sent=a._sent=a.arg;else if("throw"===a.method){if("suspendedStart"===s)throw s="completed",a.arg;a.dispatchException(a.arg)}else"return"===a.method&&a.abrupt("return",a.arg);s="executing";n=c(i,o,a);if("normal"===n.type){if(s=a.done?"completed":"suspendedYield",n.arg===h)continue;return{value:n.arg,done:a.done}}"throw"===n.type&&(s="completed",a.method="throw",a.arg=n.arg)}})}),e}function c(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(t){return{type:"throw",arg:t}}}a.wrap=s;var h={};function d(){}function f(){}function p(){}var e={},g=(o(e,r,function(){return this}),Object.getPrototypeOf),g=g&&g(g(x([]))),m=(g&&g!==t&&l.call(g,r)&&(e=g),p.prototype=d.prototype=Object.create(e));function v(t){["next","throw","return"].forEach(function(e){o(t,e,function(t){return this._invoke(e,t)})})}function y(a,s){var e;u(this,"_invoke",{value:function(n,r){function t(){return new s(function(t,e){!function e(t,n,r,i){var o,t=c(a[t],a,n);if("throw"!==t.type)return(n=(o=t.arg).value)&&"object"==typeof n&&l.call(n,"__await")?s.resolve(n.__await).then(function(t){e("next",t,r,i)},function(t){e("throw",t,r,i)}):s.resolve(n).then(function(t){o.value=t,r(o)},function(t){return e("throw",t,r,i)});i(t.arg)}(n,r,t,e)})}return e=e?e.then(t,t):t()}})}function E(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function _(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function b(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(E,this),this.reset(!0)}function x(e){if(e){var n,t=e[r];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length))return n=-1,(t=function t(){for(;++n<e.length;)if(l.call(e,n))return t.value=e[n],t.done=!1,t;return t.value=void 0,t.done=!0,t}).next=t}return{next:S}}function S(){return{value:void 0,done:!0}}return u(m,"constructor",{value:f.prototype=p,configurable:!0}),u(p,"constructor",{value:f,configurable:!0}),f.displayName=o(p,i,"GeneratorFunction"),a.isGeneratorFunction=function(t){t="function"==typeof t&&t.constructor;return!!t&&(t===f||"GeneratorFunction"===(t.displayName||t.name))},a.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,p):(t.__proto__=p,o(t,i,"GeneratorFunction")),t.prototype=Object.create(m),t},a.awrap=function(t){return{__await:t}},v(y.prototype),o(y.prototype,n,function(){return this}),a.AsyncIterator=y,a.async=function(t,e,n,r,i){void 0===i&&(i=Promise);var o=new y(s(t,e,n,r),i);return a.isGeneratorFunction(e)?o:o.next().then(function(t){return t.done?t.value:o.next()})},v(m),o(m,i,"Generator"),o(m,r,function(){return this}),o(m,"toString",function(){return"[object Generator]"}),a.keys=function(t){var e,n=Object(t),r=[];for(e in n)r.push(e);return r.reverse(),function t(){for(;r.length;){var e=r.pop();if(e in n)return t.value=e,t.done=!1,t}return t.done=!0,t}},a.values=x,b.prototype={constructor:b,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(_),!t)for(var e in this)"t"===e.charAt(0)&&l.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=void 0)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(n){if(this.done)throw n;var r=this;function t(t,e){return o.type="throw",o.arg=n,r.next=t,e&&(r.method="next",r.arg=void 0),!!e}for(var e=this.tryEntries.length-1;0<=e;--e){var i=this.tryEntries[e],o=i.completion;if("root"===i.tryLoc)return t("end");if(i.tryLoc<=this.prev){var a=l.call(i,"catchLoc"),s=l.call(i,"finallyLoc");if(a&&s){if(this.prev<i.catchLoc)return t(i.catchLoc,!0);if(this.prev<i.finallyLoc)return t(i.finallyLoc)}else if(a){if(this.prev<i.catchLoc)return t(i.catchLoc,!0)}else{if(!s)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return t(i.finallyLoc)}}}},abrupt:function(t,e){for(var n=this.tryEntries.length-1;0<=n;--n){var r=this.tryEntries[n];if(r.tryLoc<=this.prev&&l.call(r,"finallyLoc")&&this.prev<r.finallyLoc){var i=r;break}}var o=(i=i&&("break"===t||"continue"===t)&&i.tryLoc<=e&&e<=i.finallyLoc?null:i)?i.completion:{};return o.type=t,o.arg=e,i?(this.method="next",this.next=i.finallyLoc,h):this.complete(o)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),h},finish:function(t){for(var e=this.tryEntries.length-1;0<=e;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),_(n),h}},catch:function(t){for(var e=this.tryEntries.length-1;0<=e;--e){var n,r,i=this.tryEntries[e];if(i.tryLoc===t)return"throw"===(n=i.completion).type&&(r=n.arg,_(i)),r}throw new Error("illegal catch attempt")},delegateYield:function(t,e,n){return this.delegate={iterator:x(t),resultName:e,nextLoc:n},"next"===this.method&&(this.arg=void 0),h}},a}function Zn(t,e,n,r,i,o,a){try{var s=t[o](a),l=s.value}catch(t){return void n(t)}s.done?e(l):Promise.resolve(l).then(r,i)}function Qn(s){return function(){var t=this,a=arguments;return new Promise(function(e,n){var r=s.apply(t,a);function i(t){Zn(r,e,n,i,o,"next",t)}function o(t){Zn(r,e,n,i,o,"throw",t)}i(void 0)})}}function Jn(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,function(t){t=function(t,e){if("object"!=typeof t||null===t)return t;var n=t[Symbol.toPrimitive];if(void 0===n)return("string"===e?String:Number)(t);n=n.call(t,e||"default");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}(t,"string");return"symbol"==typeof t?t:String(t)}(r.key),r)}}function tr(t,e,n){e&&Jn(t.prototype,e),n&&Jn(t,n),Object.defineProperty(t,"prototype",{writable:!1})}function d(){return(d=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n,r=arguments[e];for(n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t}).apply(this,arguments)}function er(t,e){t.prototype=Object.create(e.prototype),nr(t.prototype.constructor=t,e)}function nr(t,e){return(nr=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t})(t,e)}function rr(t,e){if(null==t)return{};for(var n,r={},i=Object.keys(t),o=0;o<i.length;o++)n=i[o],0<=e.indexOf(n)||(r[n]=t[n]);return r}function ir(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function or(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}function ar(t,e){var n,r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(r)return(r=r.call(t)).next.bind(r);if(Array.isArray(t)||(r=function(t,e){var n;if(t)return"string"==typeof t?or(t,e):"Map"===(n="Object"===(n=Object.prototype.toString.call(t).slice(8,-1))&&t.constructor?t.constructor.name:n)||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?or(t,e):void 0}(t))||e&&t&&"number"==typeof t.length)return r&&(t=r),n=0,function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}};throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}(t=b=b||{}).COORDINATE="<coordinate>",t.COLOR="<color>",t.PAINT="<paint>",t.NUMBER="<number>",t.ANGLE="<angle>",t.OPACITY_VALUE="<opacity-value>",t.SHADOW_BLUR="<shadow-blur>",t.LENGTH="<length>",t.PERCENTAGE="<percentage>",t.LENGTH_PERCENTAGE="<length> | <percentage>",t.LENGTH_PERCENTAGE_12="[<length> | <percentage>]{1,2}",t.LENGTH_PERCENTAGE_14="[<length> | <percentage>]{1,4}",t.LIST_OF_POINTS="<list-of-points>",t.PATH="<path>",t.FILTER="<filter>",t.Z_INDEX="<z-index>",t.OFFSET_DISTANCE="<offset-distance>",t.DEFINED_PATH="<defined-path>",t.MARKER="<marker>",t.TRANSFORM="<transform>",t.TRANSFORM_ORIGIN="<transform-origin>",t.TEXT="<text>",t.TEXT_TRANSFORM="<text-transform>",(n=p=p||{})[n.kUnknown=0]="kUnknown",n[n.kNumber=1]="kNumber",n[n.kPercentage=2]="kPercentage",n[n.kEms=3]="kEms",n[n.kPixels=4]="kPixels",n[n.kRems=5]="kRems",n[n.kDegrees=6]="kDegrees",n[n.kRadians=7]="kRadians",n[n.kGradians=8]="kGradians",n[n.kTurns=9]="kTurns",n[n.kMilliseconds=10]="kMilliseconds",n[n.kSeconds=11]="kSeconds",n[n.kInteger=12]="kInteger",(e=Hn=Hn||{})[e.kUNumber=0]="kUNumber",e[e.kUPercent=1]="kUPercent",e[e.kULength=2]="kULength",e[e.kUAngle=3]="kUAngle",e[e.kUTime=4]="kUTime",e[e.kUOther=5]="kUOther",(t=Xn=Xn||{})[t.kYes=0]="kYes",t[t.kNo=1]="kNo",(n=Yn=Yn||{})[n.kYes=0]="kYes",n[n.kNo=1]="kNo";function sr(t){var e=1;switch(t){case p.kPixels:case p.kDegrees:case p.kSeconds:break;case p.kMilliseconds:e=.001;break;case p.kRadians:e=180/Math.PI;break;case p.kGradians:e=.9;break;case p.kTurns:e=360}return e}var lr,ur,cr=[{name:"em",unit_type:p.kEms},{name:"px",unit_type:p.kPixels},{name:"deg",unit_type:p.kDegrees},{name:"rad",unit_type:p.kRadians},{name:"grad",unit_type:p.kGradians},{name:"ms",unit_type:p.kMilliseconds},{name:"s",unit_type:p.kSeconds},{name:"rem",unit_type:p.kRems},{name:"turn",unit_type:p.kTurns}],hr=((e=lr=lr||{})[e.kUnknownType=0]="kUnknownType",e[e.kUnparsedType=1]="kUnparsedType",e[e.kKeywordType=2]="kKeywordType",e[e.kUnitType=3]="kUnitType",e[e.kSumType=4]="kSumType",e[e.kProductType=5]="kProductType",e[e.kNegateType=6]="kNegateType",e[e.kInvertType=7]="kInvertType",e[e.kMinType=8]="kMinType",e[e.kMaxType=9]="kMaxType",e[e.kClampType=10]="kClampType",e[e.kTransformType=11]="kTransformType",e[e.kPositionType=12]="kPositionType",e[e.kURLImageType=13]="kURLImageType",e[e.kColorType=14]="kColorType",e[e.kUnsupportedColorType=15]="kUnsupportedColorType",function(e){return cr.find(function(t){return t.name===e}).unit_type}),dr=function(t){switch(t){case p.kNumber:case p.kInteger:return Hn.kUNumber;case p.kPercentage:return Hn.kUPercent;case p.kPixels:return Hn.kULength;case p.kMilliseconds:case p.kSeconds:return Hn.kUTime;case p.kDegrees:case p.kRadians:case p.kGradians:case p.kTurns:return Hn.kUAngle;default:return Hn.kUOther}},fr=function(t){switch(t){case Hn.kUNumber:return p.kNumber;case Hn.kULength:return p.kPixels;case Hn.kUPercent:return p.kPercentage;case Hn.kUTime:return p.kSeconds;case Hn.kUAngle:return p.kDegrees;default:return p.kUnknown}},pr=function(t){switch(t){case p.kNumber:case p.kInteger:return"";case p.kPercentage:return"%";case p.kEms:return"em";case p.kRems:return"rem";case p.kPixels:return"px";case p.kDegrees:return"deg";case p.kRadians:return"rad";case p.kGradians:return"grad";case p.kMilliseconds:return"ms";case p.kSeconds:return"s";case p.kTurns:return"turn"}return""},t=function(){function t(){}t.isAngle=function(t){return t===p.kDegrees||t===p.kRadians||t===p.kGradians||t===p.kTurns},t.isLength=function(t){return t>=p.kEms&&t<p.kDegrees},t.isRelativeUnit=function(t){return t===p.kPercentage||t===p.kEms||t===p.kRems},t.isTime=function(t){return t===p.kSeconds||t===p.kMilliseconds};var e=t.prototype;return e.toString=function(){return this.buildCSSText(Xn.kNo,Yn.kNo,"")},e.isNumericValue=function(){return this.getType()>=lr.kUnitType&&this.getType()<=lr.kClampType},t}(),n=function(n){function t(t){var e=n.call(this)||this;return e.colorSpace=void 0,e.colorSpace=t,e}er(t,n);var e=t.prototype;return e.getType=function(){return lr.kColorType},e.to=function(t){return this},t}(t),gr=((e=ur=ur||{})[e.Constant=0]="Constant",e[e.LinearGradient=1]="LinearGradient",e[e.RadialGradient=2]="RadialGradient",function(r){function t(t,e){var n=r.call(this)||this;return n.type=void 0,n.value=void 0,n.type=t,n.value=e,n}er(t,r);var e=t.prototype;return e.clone=function(){return new t(this.type,this.value)},e.buildCSSText=function(t,e,n){return n},e.getType=function(){return lr.kColorType},t}(t)),mr=function(n){function t(t){var e=n.call(this)||this;return e.value=void 0,e.value=t,e}er(t,n);var e=t.prototype;return e.clone=function(){return new t(this.value)},e.getType=function(){return lr.kKeywordType},e.buildCSSText=function(t,e,n){return n+this.value},t}(t);function vr(a,s){if("function"!=typeof a||null!=s&&"function"!=typeof s)throw new TypeError("Expected a function");function l(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];var r,i=s?s.apply(this,e):e[0],o=l.cache;return o.has(i)?o.get(i):(r=a.apply(this,e),l.cache=o.set(i,r)||o,r)}return l.cache=new(vr.Cache||Map),l}vr.Cache=Map;function yr(t){return t.split("").map(function(t,e){return t.toUpperCase()===t?(0!==e?"-":"")+t.toLowerCase():t}).join("")}var Er=vr(function(t){return(t=void 0===t?"":t).replace(/-([a-z])/g,function(t){return t[1].toUpperCase()})});function _r(t){return"function"==typeof t}function br(t,e){void 0===e&&(e="");var n="";if(Number.isFinite(t)){if(!Number.isNaN(t))throw new Error;n="NaN"}else n=0<t?"infinity":"-infinity";return n+e}function xr(t){return Pr[t]||(Pr[t]=new mr(t)),Pr[t]}var Sr={d:{alias:"path"},strokeDasharray:{alias:"lineDash"},strokeWidth:{alias:"lineWidth"},textAnchor:{alias:"textAlign"},src:{alias:"img"}},wr=vr(function(t){var t=Er(t),e=Sr[t];return(null==e?void 0:e.alias)||t}),Tr=function(t){return fr(dr(t))},Ar=function(i){function n(t,e){var n,r;return void 0===e&&(e=p.kNumber),(n=i.call(this)||this).unit=void 0,n.value=void 0,r="string"==typeof e?(r=e)?"number"===r?p.kNumber:"percent"===r||"%"===r?p.kPercentage:hr(r):p.kUnknown:e,n.unit=r,n.value=t,n}er(n,i);var t=n.prototype;return t.clone=function(){return new n(this.value,this.unit)},t.equals=function(t){return this.value===t.value&&this.unit===t.unit},t.getType=function(){return lr.kUnitType},t.convertTo=function(t){var e;return this.unit===t?new n(this.value,this.unit):(e=Tr(this.unit))!==Tr(t)||e===p.kUnknown?null:(e=sr(this.unit)/sr(t),new n(this.value*e,t))},t.buildCSSText=function(t,e,n){switch(this.unit){case p.kUnknown:break;case p.kInteger:i=Number(this.value).toFixed(0);break;case p.kNumber:case p.kPercentage:case p.kEms:case p.kRems:case p.kPixels:case p.kDegrees:case p.kRadians:case p.kGradians:case p.kMilliseconds:case p.kSeconds:case p.kTurns:var r,i,o=this.value,a=pr(this.unit);i=o<-999999||999999<o?(r=pr(this.unit),!Number.isFinite(o)||Number.isNaN(o)?br(o,r):o+(r||"")):""+o+a}return n+=i},n}(t),Mr=new Ar(0,"px"),Rr=(new Ar(1,"px"),new Ar(0,"deg")),Nr=function(a){function t(t,e,n,r,i){var o;return void 0===r&&(r=1),void 0===i&&(i=!1),(o=a.call(this,"rgb")||this).r=void 0,o.g=void 0,o.b=void 0,o.alpha=void 0,o.isNone=void 0,o.r=t,o.g=e,o.b=n,o.alpha=r,o.isNone=i,o}er(t,a);var e=t.prototype;return e.clone=function(){return new t(this.r,this.g,this.b,this.alpha)},e.buildCSSText=function(t,e,n){return n+("rgba("+this.r+","+this.g+","+this.b+","+this.alpha)+")"},t}(n),Cr=new mr("unset"),e=new mr("initial"),t=new mr("inherit"),Pr={"":Cr,unset:Cr,initial:e,inherit:t},Or=new Nr(0,0,0,0,!0),Ir=new Nr(0,0,0,0),Lr=vr(function(t,e,n,r){return new Nr(t,e,n,r)},function(t,e,n,r){return"rgba("+t+","+e+","+n+","+r+")"}),kr=function(t,e){return void 0===e&&(e=p.kNumber),new Ar(t,e)},Dr=new Ar(50,"%"),Br={},Fr=0;var Ur="undefined"!=typeof window&&void 0!==window.document;function Gr(t,e){var n=Number(t.parsedStyle.zIndex),r=Number(e.parsedStyle.zIndex);if(n===r){var i=t.parentNode;if(i)return(i=i.childNodes||[]).indexOf(t)-i.indexOf(e)}return n-r}function Wr(t){var e,n=t;do{if(null==(e=n.parsedStyle)?void 0:e.clipPath)return n}while(null!==(n=n.parentElement));return null}var Vr="px";function jr(t,e,n){Ur&&t.style&&(t.style.width=e+Vr,t.style.height=n+Vr)}function zr(t,e){if(Ur)return document.defaultView.getComputedStyle(t,null).getPropertyValue(e)}var Hr="Method not implemented.",Xr="Use document.documentElement instead.",Yr={touchstart:"pointerdown",touchend:"pointerup",touchendoutside:"pointerupoutside",touchmove:"pointermove",touchcancel:"pointercancel"};function Kr(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t}function qr(t,e,n){t[0]=e[0]-n[0],t[1]=e[1]-n[1],t[2]=e[2]-n[2]}function $r(t,e,n){return t[0]=e[0]+n[0],t[1]=e[1]+n[1],t[2]=e[2]+n[2],t}function Zr(t,e,n){t[0]=e[0]*n,t[1]=e[1]*n,t[2]=e[2]*n}function Qr(t){return void 0===t?0:360<t||t<-360?t%360:t}function Jr(t,e,n){return void 0===e&&(e=0),void 0===n&&(n=0),Array.isArray(t)&&3===t.length?At(t):B(t)?x(t,e,n):x(t[0],t[1]||e,t[2]||n)}function ti(t){return t*(Math.PI/180)}function ei(t){return t*(180/Math.PI)}function ni(t,e){return 16===e.length?(n=t,r=e,a=.5*Math.PI,s=(u=gt(y(),r))[0],l=u[1],u=u[2],(c=Math.asin(-r[2]/s))<a?-a<c?(i=Math.atan2(r[6]/l,r[10]/u),o=Math.atan2(r[1]/s,r[0]/s)):(o=0,i=-Math.atan2(r[4]/l,r[5]/l)):(o=0,i=Math.atan2(r[4]/l,r[5]/l)),n[0]=i,n[1]=c,n[2]=o,n):(a=t,s=(u=e)[0],r=u[1],l=u[2],u=u[3],.499995*(n=s*s+(i=r*r)+(c=l*l)+(o=u*u))<(t=s*u-r*l)?(a[0]=Math.PI/2,a[1]=2*Math.atan2(r,s),a[2]=0):t<-.499995*n?(a[0]=-Math.PI/2,a[1]=2*Math.atan2(r,s),a[2]=0):(a[0]=Math.asin(2*(s*l-u*r)),a[1]=Math.atan2(2*(s*u+r*l),1-2*(c+o)),a[2]=Math.atan2(2*(s*r+l*u),1-2*(i+c))),a);var n,r,i,o,a,s,l,u,c}function ri(t,e,n,r,i){var o,a,s,l,u=Math.cos(t),t=Math.sin(t);return o=r*u,a=i*t,r=-r*t,t=i*u,u=i=0,e=e,n=n,s=1,(l=new X(9))[0]=o,l[1]=a,l[2]=i,l[3]=r,l[4]=t,l[5]=u,l[6]=e,l[7]=n,l[8]=s,l}function ii(t){var e=t[0],n=t[1],r=t[3],i=t[4],o=Math.sqrt(e*e+n*n),a=Math.sqrt(r*r+i*i);e*i-n*r<0&&(e<i?o=-o:a=-a),o&&(e*=1/o,n*=1/o);r=ei(Math.atan2(n,e));return[t[6],t[7],o,a,r]}var oi=K(),ai=K(),si=Vt(),f=[y(),y(),y()],li=y();function ui(t,e,n,r,i,o){if(function(t,e){var n=e[15];if(0===n)return;for(var r=1/n,i=0;i<16;i++)t[i]=e[i]*r;return 1}(oi,t)&&($(ai,oi),ai[3]=0,ai[7]=0,ai[11]=0,ai[15]=1,!(Math.abs(nt(ai))<1e-8))){var t=oi[3],a=oi[7],s=oi[11],l=oi[12],u=oi[13],c=oi[14],h=oi[15];if(0!==t||0!==a||0!==s){if(si[0]=t,si[1]=a,si[2]=s,si[3]=h,!et(ai,ai))return;tt(ai,ai),jt(i,si,ai)}else i[0]=i[1]=i[2]=0,i[3]=1;if(e[0]=l,e[1]=u,e[2]=c,t=oi,(a=f)[0][0]=t[0],a[0][1]=t[1],a[0][2]=t[2],a[1][0]=t[4],a[1][1]=t[5],a[1][2]=t[6],a[2][0]=t[8],a[2][1]=t[9],a[2][2]=t[10],n[0]=Mt(f[0]),It(f[0],f[0]),r[0]=Lt(f[0],f[1]),ci(f[1],f[1],f[0],1,-r[0]),n[1]=Mt(f[1]),It(f[1],f[1]),r[0]/=n[1],r[1]=Lt(f[0],f[2]),ci(f[2],f[2],f[0],1,-r[1]),r[2]=Lt(f[1],f[2]),ci(f[2],f[2],f[1],1,-r[2]),n[2]=Mt(f[2]),It(f[2],f[2]),r[1]/=n[2],r[2]/=n[2],kt(li,f[1],f[2]),Lt(f[0],li)<0)for(var d=0;d<3;d++)n[d]*=-1,f[d][0]*=-1,f[d][1]*=-1,f[d][2]*=-1;o[0]=.5*Math.sqrt(Math.max(1+f[0][0]-f[1][1]-f[2][2],0)),o[1]=.5*Math.sqrt(Math.max(1-f[0][0]+f[1][1]-f[2][2],0)),o[2]=.5*Math.sqrt(Math.max(1-f[0][0]-f[1][1]+f[2][2],0)),o[3]=.5*Math.sqrt(Math.max(1+f[0][0]+f[1][1]+f[2][2],0)),f[2][1]>f[1][2]&&(o[0]=-o[0]),f[0][2]>f[2][0]&&(o[1]=-o[1]),f[1][0]>f[0][1]&&(o[2]=-o[2])}}function ci(t,e,n,r,i){t[0]=e[0]*r+n[0]*i,t[1]=e[1]*r+n[1]*i,t[2]=e[2]*r+n[2]*i}var hi=K();function di(t,l){var u,c;return t&&t.length&&(c=u=0,l?(u=l.parsedStyle.defX||0,c=l.parsedStyle.defY||0,l.resetLocalTransform(),l.setLocalPosition(u,c)):l=new as({}),t.forEach(function(t){var e,n,r,i,o,a,s=t.t,t=t.d;"scale"===s?(a=(null==t?void 0:t.map(function(t){return t.value}))||[1,1],l.scaleLocal(a[0],a[1],1)):"scalex"===s?(a=(null==t?void 0:t.map(function(t){return t.value}))||[1],l.scaleLocal(a[0],1,1)):"scaley"===s?(a=(null==t?void 0:t.map(function(t){return t.value}))||[1],l.scaleLocal(1,a[0],1)):"scalez"===s?(a=(null==t?void 0:t.map(function(t){return t.value}))||[1],l.scaleLocal(1,1,a[0])):"scale3d"===s?(a=(null==t?void 0:t.map(function(t){return t.value}))||[1,1,1],l.scaleLocal(a[0],a[1],a[2])):"translate"===s?l.translateLocal((a=t||[Mr,Mr])[0].value,a[1].value,0):"translatex"===s?l.translateLocal((t||[Mr])[0].value,0,0):"translatey"===s?l.translateLocal(0,(t||[Mr])[0].value,0):"translatez"===s?l.translateLocal(0,0,(t||[Mr])[0].value):"translate3d"===s?l.translateLocal((a=t||[Mr,Mr,Mr])[0].value,a[1].value,a[2].value):"rotate"===s?(a=t||[Rr],l.rotateLocal(0,0,Oo(a[0]))):"rotatex"===s?(a=t||[Rr],l.rotateLocal(Oo(a[0]),0,0)):"rotatey"===s?(a=t||[Rr],l.rotateLocal(0,Oo(a[0]),0)):"rotatez"===s?(a=t||[Rr],l.rotateLocal(0,0,Oo(a[0]))):"rotate3d"!==s&&("skew"===s?(a=(null==t?void 0:t.map(function(t){return t.value}))||[0,0],l.setLocalSkew(ti(a[0]),ti(a[1]))):"skewx"===s?(a=(null==t?void 0:t.map(function(t){return t.value}))||[0],l.setLocalSkew(ti(a[0]),l.getLocalSkew()[1])):"skewy"===s?(a=(null==t?void 0:t.map(function(t){return t.value}))||[0],l.setLocalSkew(l.getLocalSkew()[0],ti(a[0]))):"matrix"===s?(e=(a=t.map(function(t){return t.value}))[0],n=a[1],r=a[2],i=a[3],o=a[4],a=a[5],l.setLocalTransform(Q(hi,e,n,0,0,r,i,0,0,0,0,1,0,o+u,a+c,0,1))):"matrix3d"===s&&(Q.apply(Tt,[hi].concat(t.map(function(t){return t.value}))),hi[12]+=u,hi[13]+=c,l.setLocalTransform(hi)))})),l.getLocalTransform()}fi={linearGradient:/^(linear\-gradient)/i,repeatingLinearGradient:/^(repeating\-linear\-gradient)/i,radialGradient:/^(radial\-gradient)/i,repeatingRadialGradient:/^(repeating\-radial\-gradient)/i,conicGradient:/^(conic\-gradient)/i,sideOrCorner:/^to (left (top|bottom)|right (top|bottom)|top (left|right)|bottom (left|right)|left|right|top|bottom)/i,extentKeywords:/^(closest\-side|closest\-corner|farthest\-side|farthest\-corner|contain|cover)/,positionKeywords:/^(left|center|right|top|bottom)/i,pixelValue:/^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))px/,percentageValue:/^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))\%/,emValue:/^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))em/,angleValue:/^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))deg/,startCall:/^\(/,endCall:/^\)/,comma:/^,/,hexColor:/^\#([0-9a-fA-F]+)/,literalColor:/^([a-zA-Z]+)/,rgbColor:/^rgb/i,rgbaColor:/^rgba/i,number:/^(([0-9]*\.[0-9]+)|([0-9]+\.?))/},pi="";var fi,pi,lt,gi=function(t){return pi=t,vi()};function mi(t){throw new Error(pi+": "+t)}function vi(){var t=Mi(yi);return 0<pi.length&&mi("Invalid input not EOF"),t}function yi(){return Ei("linear-gradient",fi.linearGradient,bi)||Ei("repeating-linear-gradient",fi.repeatingLinearGradient,bi)||Ei("radial-gradient",fi.radialGradient,xi)||Ei("repeating-radial-gradient",fi.repeatingRadialGradient,xi)||Ei("conic-gradient",fi.conicGradient,xi)}function Ei(n,t,r){return _i(t,function(t){var e=r();return e&&!Li(fi.comma)&&mi("Missing comma before color stops"),{type:n,orientation:e,colorStops:Mi(Ri)}})}function _i(t,e){t=Li(t);if(t)return Li(fi.startCall)||mi("Missing ("),e=e(t),Li(fi.endCall)||mi("Missing )"),e}function bi(){return Ii("directional",fi.sideOrCorner,1)||Ii("angular",fi.angleValue,1)}function xi(){var t,e,n=Si();return n&&((t=[]).push(n),e=pi,Li(fi.comma))&&((n=Si())?t.push(n):pi=e),t}function Si(){var t,e=function(){var t=Ii("shape",/^(circle)/i,0);t&&(t.style=Oi()||wi());return t}()||function(){var t=Ii("shape",/^(ellipse)/i,0);t&&(t.style=Ci()||wi());return t}();return e?e.at=Ti():(t=wi())?(e=t,(t=Ti())&&(e.at=t)):(t=Ai())&&(e={type:"default-radial",at:t}),e}function wi(){return Ii("extent-keyword",fi.extentKeywords,1)}function Ti(){var t;if(Ii("position",/^at/,0))return(t=Ai())||mi("Missing positioning value"),t}function Ai(){var t={x:Ci(),y:Ci()};if(t.x||t.y)return{type:"position",value:t}}function Mi(t){var e=t(),n=[];if(e)for(n.push(e);Li(fi.comma);)(e=t())?n.push(e):mi("One extra comma");return n}function Ri(){var t=Ii("hex",fi.hexColor,1)||_i(fi.rgbaColor,function(){return{type:"rgba",value:Mi(Ni)}})||_i(fi.rgbColor,function(){return{type:"rgb",value:Mi(Ni)}})||Ii("literal",fi.literalColor,0);return t||mi("Expected color definition"),t.length=Ci(),t}function Ni(){return Li(fi.number)[1]}function Ci(){return Ii("%",fi.percentageValue,1)||Pi()||Oi()}function Pi(){return Ii("position-keyword",fi.positionKeywords,1)}function Oi(){return Ii("px",fi.pixelValue,1)||Ii("em",fi.emValue,1)}function Ii(t,e,n){e=Li(e);if(e)return{type:t,value:e[n]}}function Li(t){var e=/^[\n\r\t\s]+/.exec(pi),e=(e&&ki(e[0].length),t.exec(pi));return e&&ki(e[0].length),e}function ki(t){pi=pi.substring(t)}function Di(t,e,n){var n=ti(n.value),r=0+t/2,i=0+e/2,t=Math.abs(t*Math.cos(n))+Math.abs(e*Math.sin(n));return{x1:r-Math.cos(n)*t/2,y1:i-Math.sin(n)*t/2,x2:r+Math.cos(n)*t/2,y2:i+Math.sin(n)*t/2}}function Bi(t,e,n,r,i){var o=n.value,a=r.value,n=(n.unit===p.kPercentage&&(o=n.value/100*t),r.unit===p.kPercentage&&(a=r.value/100*e),Math.max(ye([0,0],[o,a]),ye([0,e],[o,a]),ye([t,e],[o,a]),ye([t,0],[o,a])));return i&&(i instanceof Ar?n=i.value:i instanceof mr&&("closest-side"===i.value?n=Math.min(o,t-o,a,e-a):"farthest-side"===i.value?n=Math.max(o,t-o,a,e-a):"closest-corner"===i.value&&(n=Math.min(ye([0,0],[o,a]),ye([0,e],[o,a]),ye([t,e],[o,a]),ye([t,0],[o,a]))))),{x:o,y:a,r:n}}function Fi(t){var e;return 0===t.parsedStyle.path.totalLength&&(t.parsedStyle.path.totalLength=Ae(t.parsedStyle.path.absolutePath,void 0,k(k({},e),{bbox:!1,length:!0})).length),t.parsedStyle.path.totalLength}function Ui(t,e){return t[0]===e[0]&&t[1]===e[1]}function Gi(t,e){var n,r=t.prePoint,i=t.currentPoint,t=t.nextPoint,o=Math.pow(i[0]-r[0],2)+Math.pow(i[1]-r[1],2),a=Math.pow(i[0]-t[0],2)+Math.pow(i[1]-t[1],2),r=Math.pow(r[0]-t[0],2)+Math.pow(r[1]-t[1],2),r=Math.acos((o+a-r)/(2*Math.sqrt(o)*Math.sqrt(a)));return!r||0===Math.sin(r)||(void(o=0)===n&&(n=Ge),Math.abs(r-o)<n)?{xExtra:0,yExtra:0}:(a=Math.abs(Math.atan2(t[1]-i[1],t[0]-i[0])),o=Math.abs(Math.atan2(t[0]-i[0],t[1]-i[1])),a=a>Math.PI/2?Math.PI-a:a,o=o>Math.PI/2?Math.PI-o:o,{xExtra:Math.cos(r/2-a)*(e/2*(1/Math.sin(r/2)))-e/2||0,yExtra:Math.cos(o-r/2)*(e/2*(1/Math.sin(r/2)))-e/2||0})}function Wi(t,e){return[e[0]+(e[0]-t[0]),e[1]+(e[1]-t[1])]}(n=lt=lt||{}).GROUP="g",n.CIRCLE="circle",n.ELLIPSE="ellipse",n.IMAGE="image",n.RECT="rect",n.LINE="line",n.POLYLINE="polyline",n.POLYGON="polygon",n.TEXT="text",n.PATH="path",n.HTML="html",n.MESH="mesh";var Vi=function(t,e){var n=t.x*e.x+t.y*e.y,r=Math.sqrt((Math.pow(t.x,2)+Math.pow(t.y,2))*(Math.pow(e.x,2)+Math.pow(e.y,2)));return(t.x*e.y-t.y*e.x<0?-1:1)*Math.acos(n/r)},ji=function(t,e,n,r,i,o,a,s){e=Math.abs(e),n=Math.abs(n);r=ti(r=We(r,360));if(t.x===a.x&&t.y===a.y)return{x:t.x,y:t.y,ellipticalArcAngle:0};if(0===e||0===n)return{x:0,y:0,ellipticalArcAngle:0};var l=(t.x-a.x)/2,u=(t.y-a.y)/2,l={x:Math.cos(r)*l+Math.sin(r)*u,y:-Math.sin(r)*l+Math.cos(r)*u},u=Math.pow(l.x,2)/Math.pow(e,2)+Math.pow(l.y,2)/Math.pow(n,2);1<u&&(e=Math.sqrt(u)*e,n=Math.sqrt(u)*n);var u=(u=(Math.pow(e,2)*Math.pow(n,2)-Math.pow(e,2)*Math.pow(l.y,2)-Math.pow(n,2)*Math.pow(l.x,2))/(Math.pow(e,2)*Math.pow(l.y,2)+Math.pow(n,2)*Math.pow(l.x,2)))<0?0:u,i=(i!==o?1:-1)*Math.sqrt(u),u=e*l.y/n*i,i=-n*l.x/e*i,t={x:Math.cos(r)*u-Math.sin(r)*i+(t.x+a.x)/2,y:Math.sin(r)*u+Math.cos(r)*i+(t.y+a.y)/2},a={x:(l.x-u)/e,y:(l.y-i)/n},c=Vi({x:1,y:0},a),a=Vi(a,{x:(-l.x-u)/e,y:(-l.y-i)/n}),u=(!o&&0<a?a-=2*Math.PI:o&&a<0&&(a+=2*Math.PI),c+(a%=2*Math.PI)*s),l=e*Math.cos(u),i=n*Math.sin(u);return{x:Math.cos(r)*l-Math.sin(r)*i+t.x,y:Math.sin(r)*l+Math.cos(r)*i+t.y,ellipticalArcStartAngle:c,ellipticalArcEndAngle:c+a,ellipticalArcAngle:u,ellipticalArcCenter:t,resultantRx:e,resultantRy:n}};function zi(t){for(var e=[],n=null,r=null,i=null,o=0,a=t.length,s=0;s<a;s++){var l=t[s],r=t[s+1],u=l[0],c={command:u,prePoint:n,params:l,startTangent:null,endTangent:null,currentPoint:null,nextPoint:null,arcParams:null,box:null,cubicParams:null};switch(u){case"M":i=[l[1],l[2]],o=s;break;case"A":var h=function(t,e){var n=e[1],r=e[2],i=We(ti(e[3]),2*Math.PI),o=e[4],a=e[5],s=t[0],l=t[1],u=e[6],e=e[7],c=Math.cos(i)*(s-u)/2+Math.sin(i)*(l-e)/2,h=-1*Math.sin(i)*(s-u)/2+Math.cos(i)*(l-e)/2,d=c*c/(n*n)+h*h/(r*r);1<d&&(n*=Math.sqrt(d),r*=Math.sqrt(d));d=n*n*(h*h)+r*r*(c*c),d=d?Math.sqrt((n*n*(r*r)-d)/d):1;o===a&&(d*=-1);isNaN(d)&&(d=0);var f=r?d*n*h/r:0,d=n?d*-r*c/n:0,s=(s+u)/2+Math.cos(i)*f-Math.sin(i)*d,l=(l+e)/2+Math.sin(i)*f+Math.cos(i)*d,p=[(c-f)/n,(h-d)/r],c=[(-1*c-f)/n,(-1*h-d)/r],f=Ki([1,0],p),h=Ki(p,c);Yi(p,c)<=-1&&(h=Math.PI);1<=Yi(p,c)&&(h=0);0===a&&0<h&&(h-=2*Math.PI);1===a&&h<0&&(h+=2*Math.PI);return{cx:s,cy:l,rx:Ui(t,[u,e])?0:n,ry:Ui(t,[u,e])?0:r,startAngle:f,endAngle:f+h,xRotation:i,arcFlag:o,sweepFlag:a}}(n,l);c.arcParams=h}"Z"===u?(n=i,r=t[o+1]):n=[l[(y=l.length)-2],l[y-1]],r&&"Z"===r[0]&&(r=t[o],e[o])&&(e[o].prePoint=n),c.currentPoint=n,e[o]&&Ui(n,e[o].currentPoint)&&(e[o].prePoint=c.prePoint);var d,f,p,g,m,v,y=r?[r[r.length-2],r[r.length-1]]:null,E=(c.nextPoint=y,c.prePoint);["L","H","V"].includes(u)?(c.startTangent=[E[0]-n[0],E[1]-n[1]],c.endTangent=[n[0]-E[0],n[1]-E[1]]):"Q"===u?(d=[l[1],l[2]],c.startTangent=[E[0]-d[0],E[1]-d[1]],c.endTangent=[n[0]-d[0],n[1]-d[1]]):"T"===u?(f=Wi((d=e[s-1]).currentPoint,E),"Q"===d.command?(c.command="Q",c.startTangent=[E[0]-f[0],E[1]-f[1]],c.endTangent=[n[0]-f[0],n[1]-f[1]]):(c.command="TL",c.startTangent=[E[0]-n[0],E[1]-n[1]],c.endTangent=[n[0]-E[0],n[1]-E[1]])):"C"===u?(f=[l[1],l[2]],p=[l[3],l[4]],c.startTangent=[E[0]-f[0],E[1]-f[1]],c.endTangent=[n[0]-p[0],n[1]-p[1]],0===c.startTangent[0]&&0===c.startTangent[1]&&(c.startTangent=[f[0]-p[0],f[1]-p[1]]),0===c.endTangent[0]&&0===c.endTangent[1]&&(c.endTangent=[p[0]-f[0],p[1]-f[1]])):"S"===u?(g=Wi((p=e[s-1]).currentPoint,E),m=[l[1],l[2]],"C"===p.command?(c.command="C",c.startTangent=[E[0]-g[0],E[1]-g[1]]):(c.command="SQ",c.startTangent=[E[0]-m[0],E[1]-m[1]]),c.endTangent=[n[0]-m[0],n[1]-m[1]]):"A"===u&&(E=(g=Hi(c,0)).x,m=g.y,v=(u=Hi(c,1,!1)).x,u=u.y,c.startTangent=[E,m],c.endTangent=[v,u]),e.push(c)}return e}function Hi(t,e,n){void 0===n&&(n=!0);var r=t.arcParams,i=r.rx,i=void 0===i?0:i,o=r.ry,o=void 0===o?0:o,a=r.xRotation,s=r.arcFlag,r=r.sweepFlag,l=ji({x:t.prePoint[0],y:t.prePoint[1]},i,o,a,!!s,!!r,{x:t.currentPoint[0],y:t.currentPoint[1]},e),i=ji({x:t.prePoint[0],y:t.prePoint[1]},i,o,a,!!s,!!r,{x:t.currentPoint[0],y:t.currentPoint[1]},n?e+.005:e-.005),o=i.x-l.x,a=i.y-l.y,s=Math.sqrt(o*o+a*a);return{x:-o/s,y:-a/s}}function Xi(t){return Math.sqrt(t[0]*t[0]+t[1]*t[1])}function Yi(t,e){return Xi(t)*Xi(e)?(t[0]*e[0]+t[1]*e[1])/(Xi(t)*Xi(e)):1}function Ki(t,e){return(t[0]*e[1]<t[1]*e[0]?-1:1)*Math.acos(Yi(t,e))}function qi(t,e,n,r){var i=(-1+Math.sqrt(2))/3*4,o=t*i,i=e*i,a=n-t,t=n+t,s=r-e,e=r+e;return[["M",a,r],["C",a,r-i,n-o,s,n,s],["C",n+o,s,t,r-i,t,r],["C",t,r+i,n+o,e,n,e],["C",n-o,e,a,r+i,a,r],["Z"]]}function $i(t,e){void 0===e&&(e=t.getLocalTransform());var n,r,i,o,a,s,l,u,c,h,d,f=[];switch(t.nodeName){case lt.LINE:var p=t.parsedStyle,f=[["M",p.x1,p.y1],["L",p.x2,p.y2]];break;case lt.CIRCLE:var p=t.parsedStyle,g=p.r;f=qi(g,g,p.cx,p.cy);break;case lt.ELLIPSE:var g=t.parsedStyle;f=qi(g.rx,g.ry,g.cx,g.cy);break;case lt.POLYLINE:case lt.POLYGON:p=t.parsedStyle.points;g=p.points,p=t.nodeName===lt.POLYGON,g=g.map(function(t,e){return[0===e?"M":"L",t[0],t[1]]}),p&&g.push(["Z"]),f=g;break;case lt.RECT:var m=t.parsedStyle,v=m.width,y=m.height,E=m.x,_=m.y,m=m.radius,b=m&&m.some(function(t){return 0!==t});n=v,r=y,E=E,_=_,f=(b=b&&m.map(function(t){return Ue(t,0,Math.min(Math.abs(v)/2,Math.abs(y)/2))}))?(s=(m=0<n?1:-1)+(a=0<r?1:-1)!=0?1:0,[["M",m*(i=b[0])+E,_],["L",n-m*(o=b[1])+E,_],o?["A",o,o,0,0,s,n+E,a*o+_]:null,["L",n+E,r-a*(o=b[2])+_],o?["A",o,o,0,0,s,n+E-m*o,r+_]:null,["L",E+m*(o=b[3]),r+_],o?["A",o,o,0,0,s,E,r+_-a*o]:null,["L",E,a*i+_],i?["A",i,i,0,0,s,m*i+E,_]:null,["Z"]].filter(function(t){return t})):[["M",E,_],["L",E+n,_],["L",E+n,_+r],["L",E,_+r],["Z"]];break;case lt.PATH:b=t.parsedStyle.path.absolutePath;f=[].concat(b)}if(f.length)return l=f,u=e,c=(e=(e=t).parsedStyle).defX,h=void 0===c?0:c,d=void 0===(c=e.defY)?0:c,l.reduce(function(t,e){var n,r,i,o="";return"M"===e[0]||"L"===e[0]?(n=x(e[1]-h,e[2]-d,0),u&&Bt(n,n,u),o=""+e[0]+n[0]+","+n[1]):"Z"===e[0]?o=e[0]:"C"===e[0]?(n=x(e[1]-h,e[2]-d,0),r=x(e[3]-h,e[4]-d,0),i=x(e[5]-h,e[6]-d,0),u&&(Bt(n,n,u),Bt(r,r,u),Bt(i,i,u)),o=""+e[0]+n[0]+","+n[1]+","+r[0]+","+r[1]+","+i[0]+","+i[1]):"A"===e[0]?(n=x(e[6]-h,e[7]-d,0),u&&Bt(n,n,u),o=""+e[0]+e[1]+","+e[2]+","+e[3]+","+e[4]+","+e[5]+","+n[0]+","+n[1]):"Q"===e[0]&&(r=x(e[1]-h,e[2]-d,0),i=x(e[3]-h,e[4]-d,0),u&&(Bt(r,r,u),Bt(i,i,u)),o=""+e[0]+e[1]+","+e[2]+","+e[3]+","+e[4]+"}"),t+o},"")}function Zi(t,e,n){var r=!1,i=!1,e=!!e&&!e.isNone,n=!!n&&!n.isNone;return"visiblepainted"===t||"painted"===t||"auto"===t?(r=e,i=n):"visiblefill"===t||"fill"===t?r=!0:"visiblestroke"===t||"stroke"===t?i=!0:"visible"!==t&&"all"!==t||(i=r=!0),[r,i]}var Qi=function(){function t(){this.callbacks=[]}var e=t.prototype;return e.tapPromise=function(t,e){this.callbacks.push(e)},e.promise=function(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];return Promise.all(this.callbacks.map(function(t){return t.apply(void 0,e)}))},t}(),Ji=function(){function t(){this.callbacks=[]}var e=t.prototype;return e.tapPromise=function(t,e){this.callbacks.push(e)},e.promise=function(){var t=Qn($n().mark(function t(){var e,n,r,i=arguments;return $n().wrap(function(t){for(;;)switch(t.prev=t.next){case 0:if(this.callbacks.length)return t.next=3,(r=this.callbacks)[0].apply(r,i);t.next=14;break;case 3:e=t.sent,n=0;case 5:if(n<this.callbacks.length-1)return r=this.callbacks[n],t.next=9,r(e);t.next=13;break;case 9:e=t.sent;case 10:n++,t.next=5;break;case 13:return t.abrupt("return",e);case 14:return t.abrupt("return",null);case 15:case"end":return t.stop()}},t,this)}));return function(){return t.apply(this,arguments)}}(),t}(),to=function(){function t(){this.callbacks=[]}var e=t.prototype;return e.tap=function(t,e){this.callbacks.push(e)},e.call=function(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];this.callbacks.forEach(function(t){t.apply(void 0,e)})},t}(),eo=function(){function t(){this.callbacks=[]}var e=t.prototype;return e.tap=function(t,e){this.callbacks.push(e)},e.call=function(){if(this.callbacks.length){for(var t,e=(t=this.callbacks)[0].apply(t,arguments),n=0;n<this.callbacks.length-1;n++)e=(0,this.callbacks[n])(e);return e}return null},t}(),no=["serif","sans-serif","monospace","cursive","fantasy","system-ui"],ro=/([\"\'])[^\'\"]+\1/;function io(t){return"string"!=typeof t?fo:""===t?so.requestAnimationFrame:so[t+"RequestAnimationFrame"]}var oo=1,ao=function(){return oo++},so="object"==typeof self&&self.self==self?self:"object"==typeof V&&V.global==V?V:{},lo=Date.now(),uo=function(){return so.performance&&"function"==typeof so.performance.now?so.performance.now():Date.now()-lo},co={},ho=Date.now(),fo=function(t){if("function"!=typeof t)throw new TypeError(t+" is not a function");var n=Date.now(),e=n-ho,e=16<e?0:16-e,r=ao();return co[r]=t,1<Object.keys(co).length||setTimeout(function(){ho=n;var e=co;co={},Object.keys(e).forEach(function(t){return e[t](uo())})},e),r},e=function(t){delete co[t]},t=function(t,e){for(var n=0;void 0!==t[n];){if(e(t[n]))return t[n];n+=1}}(["","webkit","moz","ms","o"],io),po=io(t),go="string"!=typeof(n=t)?e:""===n?so.cancelAnimationFrame:so[n+"CancelAnimationFrame"]||so[n+"CancelRequestAnimationFrame"],mo=(so.requestAnimationFrame=po,so.cancelAnimationFrame=go,/^l\s*\(\s*([\d.]+)\s*\)\s*(.*)/i),vo=/^r\s*\(\s*([\d.]+)\s*,\s*([\d.]+)\s*,\s*([\d.]+)\s*\)\s*(.*)/i,yo=/^p\s*\(\s*([axyn])\s*\)\s*(.*)/i,Eo=/[\d.]+:(#[^\s]+|[^\)]+\))/gi;var _o={left:180,top:-90,bottom:90,right:0,"left top":225,"top left":225,"left bottom":135,"bottom left":135,"right top":-45,"top right":-45,"right bottom":45,"bottom right":45},bo=vr(function(t){t="angular"===t.type?Number(t.value):_o[t.value]||0;return kr(t,"deg")}),xo=vr(function(t){var e,n=50,r=50,i="%",o="%";return"position"===(null==t?void 0:t.type)&&(e=(t=t.value).x,t=t.y,"position-keyword"===(null==e?void 0:e.type)&&("left"===e.value?n=0:"center"===e.value?n=50:"right"===e.value?n=100:"top"===e.value?r=0:"bottom"===e.value&&(r=100)),"position-keyword"===(null==t?void 0:t.type)&&("left"===t.value?n=0:"center"===t.value?r=50:"right"===t.value?n=100:"top"===t.value?r=0:"bottom"===t.value&&(r=100)),"px"!==(null==e?void 0:e.type)&&"%"!==(null==e?void 0:e.type)&&"em"!==(null==e?void 0:e.type)||(i=null==e?void 0:e.type,n=Number(e.value)),"px"!==(null==t?void 0:t.type)&&"%"!==(null==t?void 0:t.type)&&"em"!==(null==t?void 0:t.type)||(o=null==t?void 0:t.type,r=Number(t.value))),{cx:kr(n,i),cy:kr(r,o)}}),So=vr(function(t){if(-1<t.indexOf("linear")||-1<t.indexOf("radial"))return gi(t).map(function(t){for(var e=t.type,n=t.orientation,t=t.colorStops,r=t,i=r.length,o=(r[i-1].length=null!=(d=r[i-1].length)?d:{type:"%",value:"100"},1<i&&(r[0].length=null!=(d=r[0].length)?d:{type:"%",value:"0"}),0),a=Number(r[0].length.value),s=1;s<i;s++){var l,u=null==(l=r[s].length)?void 0:l.value;if(!M(u)&&!M(a)){for(var c=1;c<s-o;c++)r[o+c].length={type:"%",value:""+(a+(Number(u)-a)*c/(s-o))};o=s,a=Number(u)}}var h,d=t.map(function(t){return{offset:kr(Number(t.length.value),"%"),color:(e=(t=t).type,t=t.value,"hex"===e?"#"+t:"literal"===e?t:"rgb"===e?"rgb("+t.join(",")+")":"rgba("+t.join(",")+")")};var e});return"linear-gradient"===e?new gr(ur.LinearGradient,{angle:n?bo(n):Rr,steps:d}):"radial-gradient"===e&&"shape"===(n=n||[{type:"shape",value:"circle"}])[0].type&&"circle"===n[0].value?(e=(t=xo(n[0].at)).cx,t=t.cy,n[0].style&&(h=(n=n[0].style).type,n=n.value,h="extent-keyword"===h?xr(n):kr(n,h)),new gr(ur.RadialGradient,{cx:e,cy:t,size:h,steps:d})):void 0});var e=t[0];if("("===t[1]||"("===t[2])if("l"===e){var n=mo.exec(t);if(n)return r=(null==(r=n[2].match(Eo))?void 0:r.map(function(t){return t.split(":")}))||[],[new gr(ur.LinearGradient,{angle:kr(parseFloat(n[1]),"deg"),steps:r.map(function(t){var e=t[0],t=t[1];return{offset:kr(100*Number(e),"%"),color:t}})})]}else if("r"===e){n=function(t){var t=vo.exec(t);if(t)return t=(null==(t=t[4].match(Eo))?void 0:t.map(function(t){return t.split(":")}))||[],{cx:kr(50,"%"),cy:kr(50,"%"),steps:t.map(function(t){var e=t[0],t=t[1];return{offset:kr(100*Number(e),"%"),color:t}})};return null}(t);if(n&&!Fe(n))return[new gr(ur.RadialGradient,n)]}else if("p"===e){var r=t;if(r=yo.exec(r)){var i=r[1],r=r[2];switch(i){case"a":i="repeat";break;case"x":i="repeat-x";break;case"y":i="repeat-y";break;default:i="no-repeat"}return{image:r,repetition:i}}return null}});function wo(t){return t&&t.image}function To(t){return t&&!M(t.r)&&!M(t.g)&&!M(t.b)}var Ao=vr(function(t){var e;return wo(t)?d({repetition:"repeat"},t):"transparent"===(t=M(t)?"":t)?Ir:So(t="currentColor"===t?"black":t)||(e=[0,0,0,0],null!==(t=sn(t))&&(e[0]=t.r||0,e[1]=t.g||0,e[2]=t.b||0,e[3]=t.opacity),Lr.apply(void 0,e))});function Mo(t,e){if(To(t)&&To(e))return[[Number(t.r),Number(t.g),Number(t.b),Number(t.alpha)],[Number(e.r),Number(e.g),Number(e.b),Number(e.alpha)],function(t){var e=t.slice();if(e[3])for(var n=0;n<3;n++)e[n]=Math.round(Ue(e[n],0,255));return e[3]=Ue(e[3],0,1),"rgba("+e.join(",")+")"}]}function Ro(t,e){if(M(e))return kr(0,"px");if(e=(""+e).trim().toLowerCase(),isFinite(Number(e))){if(0<="px".search(t))return kr(Number(e),"px");if(0<="deg".search(t))return kr(Number(e),"deg")}var n=[],r=(e=e.replace(t,function(t){return n.push(t),"U"+t}),"U("+t.source+")");return n.map(function(t){return kr(Number(e.replace(new RegExp("U"+t,"g"),"").replace(new RegExp(r,"g"),"*0")),t)})[0]}var No=vr(function(t){return Ro(new RegExp("px","g"),t)}),Co=(vr(function(t){return Ro(new RegExp("%","g"),t)}),function(t){return B(t)||isFinite(Number(t))?kr(Number(t)||0,"px"):Ro(new RegExp("px|%|em|rem","g"),t)}),Po=vr(function(t){return Ro(new RegExp("deg|rad|grad|turn","g"),t)});function Oo(t){var e=0;return t.unit===p.kDegrees?e=t.value:t.unit===p.kRadians?e=ei(Number(t.value)):t.unit===p.kTurns&&(e=360*Number(t.value)),e}function Io(t,e){var n;return Array.isArray(t)?n=t.map(function(t){return Number(t)}):Fe(t)?n=t.split(" ").map(function(t){return Number(t)}):B(t)&&(n=[t]),2===e?1===n.length?[n[0],n[0]]:[n[0],n[1]]:1===n.length?[n[0],n[0],n[0],n[0]]:2===n.length?[n[0],n[1],n[0],n[1]]:3===n.length?[n[0],n[1],n[2],n[1]]:[n[0],n[1],n[2],n[3]]}function Lo(t){return Fe(t)?t.split(" ").map(function(t){return Co(t)}):t.map(function(t){return Co(t.toString())})}function ko(t,e,n){return 0===t.value?0:t.unit===p.kPixels?Number(t.value):t.unit===p.kPercentage&&n?(n=n.nodeName===lt.GROUP?n.getLocalBounds():n.geometry.contentBounds,t.value/100*n.halfExtents[e]*2):0}var Do=function(t){return Ro(/deg|rad|grad|turn|px|%/g,t)},Bo=["blur","brightness","drop-shadow","contrast","grayscale","sepia","saturate","hue-rotate","invert"];function Fo(t){if("none"!==(t=(t=void 0===t?"":t).toLowerCase().trim()))for(var e,n=/\s*([\w-]+)\(([^)]*)\)/g,r=[],i=0;e=n.exec(t);){if(e.index!==i)return[];if(i=e.index+e[0].length,-1<Bo.indexOf(e[1])&&r.push({name:e[1],params:e[2].split(" ").map(function(t){return Do(t)||Ao(t)})}),n.lastIndex===t.length)return r}return[]}function Uo(t){return t.toString()}var Go=vr(function(t){return"number"==typeof t?kr(t):/^\s*[-+]?(\d*\.)?\d+\s*$/.test(t)?kr(Number(t)):kr(0)});function Wo(t,e){return[t,e,Uo]}function Vo(n,r){return function(t,e){return[t,e,function(t){return Uo(Ue(t,n,r))}]}}function jo(t,e){if(t.length===e.length)return[t,e,function(t){return t}]}vr(function(t){return(Fe(t)?t.split(" "):t).map(Go)});var zo=function(e){if(""===e||Array.isArray(e)&&0===e.length)return{absolutePath:[],hasArc:!1,segments:[],polygons:[],polylines:[],curve:null,totalLength:0,rect:{x:0,y:0,width:0,height:0}};var n;try{n=pe(e)}catch(t){n=pe(""),console.error("[g]: Invalid SVG Path definition: "+e)}var e=function(t){for(var e=!1,n=t.length,r=0;r<n;r++){var i=t[r][0];if("C"===i||"A"===i||"Q"===i){e=!0;break}}return e}(n),t=function(t){for(var e=[],n=[],r=[],i=0;i<t.length;i++){var o=t[i],a=o[0];"M"===a?(r.length&&(n.push(r),r=[]),r.push([o[1],o[2]])):"Z"===a?r.length&&(e.push(r),r=[]):r.push([o[1],o[2]])}return 0<r.length&&n.push(r),{polygons:e,polylines:n}}(n),r=t.polygons,t=t.polylines,i=zi(n),o=function(t,e){for(var n=[],r=[],i=[],o=0;o<t.length;o++){var a=t[o],s=a.currentPoint,l=a.params,u=a.prePoint,c=void 0;switch(a.command){case"Q":c=Cn.box(u[0],u[1],l[1],l[2],l[3],l[4]);break;case"C":c=Dn.box(u[0],u[1],l[1],l[2],l[3],l[4],l[5],l[6]);break;case"A":var h=a.arcParams,c=jn.box(h.cx,h.cy,h.rx,h.ry,h.xRotation,h.startAngle,h.endAngle);break;default:n.push(s[0]),r.push(s[1])}c&&(a.box=c,n.push(c.x,c.x+c.width),r.push(c.y,c.y+c.height)),e&&("L"===a.command||"M"===a.command)&&a.prePoint&&a.nextPoint&&i.push(a)}var n=n.filter(function(t){return!Number.isNaN(t)&&t!==1/0&&t!==-1/0}),r=r.filter(function(t){return!Number.isNaN(t)&&t!==1/0&&t!==-1/0}),d=Be(n),f=Be(r),p=De(n),g=De(r);if(0!==i.length)for(var m=0;m<i.length;m++){var v=i[m],y=v.currentPoint;y[0]===d?d-=Gi(v,e).xExtra:y[0]===p&&(p+=Gi(v,e).xExtra),y[1]===f?f-=Gi(v,e).yExtra:y[1]===g&&(g+=Gi(v,e).yExtra)}return{x:d,y:f,width:p-d,height:g-f}}(i,0),a=o.x,s=o.y,l=o.width,o=o.height;return{absolutePath:n,hasArc:e,segments:i,polygons:r,polylines:t,totalLength:0,rect:{x:Number.isFinite(a)?a:0,y:Number.isFinite(s)?s:0,width:Number.isFinite(l)?l:0,height:Number.isFinite(o)?o:0}}},Ho=vr(zo);function Xo(t,e){t=(Fe(t)?Ho:zo)(t);return e&&(e.parsedStyle.defX=t.rect.x,e.parsedStyle.defY=t.rect.y),t}function Yo(t,e,n){var r,i,o,a,s,l,u,c,h,d=t.curve,f=e.curve,t=(d&&0!==d.length||(d=be(t.absolutePath,!1),t.curve=d),f&&0!==f.length||(f=be(e.absolutePath,!1),e.curve=f),[d,f]),d=Me((t=d.length!==f.length?function t(e,n,r){var i,e=Re(e),n=Re(n),o=e.length,a=n.length,s=e.filter(function(t){return t.l}).length,l=n.filter(function(t){return t.l}).length,s=e.filter(function(t){return t.l}).reduce(function(t,e){return t+e.l},0)/s||0,l=n.filter(function(t){return t.l}).reduce(function(t,e){return t+e.l},0)/l||0,u=r||Math.max(o,a),c=[s,l],h=[u-o,u-a],r=[e,n].map(function(t,n){return t.l===u?t.map(function(t){return t.s}):t.map(function(t,e){return i=e&&h[n]&&t.l>=c[n],h[n]-=i?1:0,i?t.ss:[t.s]}).flat()});return r[0].length===r[1].length?r:t(r[0],r[1],u)}(d,f):t)[0])!==Me(t[1])?(r=t[0],e=r.slice(1).map(function(t,e,n){return(e?n[e-1].slice(-2):r[0].slice(1)).concat(t.slice(1))}).map(function(n){return n.map(function(t,e){return n[n.length-e-2*(1-e%2)]})}).reverse(),[["M"].concat(e[0].slice(0,2))].concat(e.map(function(t){return["C"].concat(t.slice(2))}))):ne(t[0]);return[d,(i=t[1],o=d,u=i.length-1,c=[],h=0,s=(a=i).length,l=s-1,(f=a.map(function(t,r){return a.map(function(t,e){var n=r+e;return 0===e||a[n]&&"M"===a[n][0]?(e=a[n],["M"].concat(e.slice(-2))):(s<=n&&(n-=l),a[n])})})).forEach(function(t,n){i.slice(1).forEach(function(t,e){h+=ye(i[(n+e)%u].slice(-2),o[e%u].slice(-2))}),c[n]=h,h=0}),f[c.indexOf(Math.min.apply(null,c))]),function(t){return t}]}function Ko(t,e){var n,r,i=Fe(t)?t.split(" ").map(function(t){var t=t.split(","),e=t[0],t=t[1];return[Number(e),Number(t)]}):t,o=[],a=0,s=Kn.length(i),t=(i.forEach(function(t,e){i[e+1]&&((n=[0,0])[0]=a/s,r=xn.length(t[0],t[1],i[e+1][0],i[e+1][1]),a+=r,n[1]=a/s,o.push(n))}),Math.min.apply(Math,i.map(function(t){return t[0]}))),l=Math.min.apply(Math,i.map(function(t){return t[1]}));return e&&(e.parsedStyle.defX=t,e.parsedStyle.defY=l),{points:i,totalLength:s,segments:o}}function qo(t,e){return[t.points,e.points,function(t){return t}]}var $o=null;function Zo(t){return function(e){var n=0;return t.map(function(t){return t===$o?e[n++]:t})}}function Qo(t){return t}var Jo={matrix:["NNNNNN",[$o,$o,0,0,$o,$o,0,0,0,0,1,0,$o,$o,0,1],Qo],matrix3d:["NNNNNNNNNNNNNNNN",Qo],rotate:["A"],rotatex:["A"],rotatey:["A"],rotatez:["A"],rotate3d:["NNNA"],perspective:["L"],scale:["Nn",Zo([$o,$o,new Ar(1)]),Qo],scalex:["N",Zo([$o,new Ar(1),new Ar(1)]),Zo([$o,new Ar(1)])],scaley:["N",Zo([new Ar(1),$o,new Ar(1)]),Zo([new Ar(1),$o])],scalez:["N",Zo([new Ar(1),new Ar(1),$o])],scale3d:["NNN",Qo],skew:["Aa",null,Qo],skewx:["A",null,Zo([$o,Rr])],skewy:["A",null,Zo([Rr,$o])],translate:["Tt",Zo([$o,$o,Mr]),Qo],translatex:["T",Zo([$o,Mr,Mr]),Zo([$o,Mr])],translatey:["T",Zo([Mr,$o,Mr]),Zo([Mr,$o])],translatez:["L",Zo([Mr,Mr,$o])],translate3d:["TTL",Qo]};function ta(t){if("none"!==(t=(t||"none").toLowerCase().trim()))for(var e,n=/\s*(\w+)\(([^)]*)\)/g,r=[],i=0;e=n.exec(t);){if(e.index!==i)return[];var i=e.index+e[0].length,o=e[1],a=Jo[o];if(!a)return[];var s=e[2].split(","),l=a[0];if(l.length<s.length)return[];for(var u=[],c=0;c<l.length;c++){var h=s[c],d=l[c],f=void 0;if(void 0===(f=h?{A:function(t){return"0"===t.trim()?Rr:Po(t)},N:Go,T:Co,L:No}[d.toUpperCase()](h):{a:Rr,n:u[0],t:Mr}[d]))return[];u.push(f)}if(r.push({t:o,d:u}),n.lastIndex===t.length)return r}return[]}function ea(t){switch(t.t){case"rotatex":return i=ti(Oo(t.d[0])),[1,0,0,0,0,Math.cos(i),Math.sin(i),0,0,-Math.sin(i),Math.cos(i),0,0,0,0,1];case"rotatey":return i=ti(Oo(t.d[0])),[Math.cos(i),0,-Math.sin(i),0,0,1,0,0,Math.sin(i),0,Math.cos(i),0,0,0,0,1];case"rotate":case"rotatez":return i=ti(Oo(t.d[0])),[Math.cos(i),Math.sin(i),0,0,-Math.sin(i),Math.cos(i),0,0,0,0,1,0,0,0,0,1];case"rotate3d":var e=t.d[0].value,n=t.d[1].value,r=t.d[2].value,i=ti(Oo(t.d[3])),o=e*e+n*n+r*r,o=(0==o?(e=1,r=n=0):1!=o&&(e/=o=Math.sqrt(o),n/=o,r/=o),Math.sin(i/2)),a=o*Math.cos(i/2),o=o*o;return[1-2*(n*n+r*r)*o,2*(e*n*o+r*a),2*(e*r*o-n*a),0,2*(e*n*o-r*a),1-2*(e*e+r*r)*o,2*(n*r*o+e*a),0,2*(e*r*o+n*a),2*(n*r*o-e*a),1-2*(e*e+n*n)*o,0,0,0,0,1];case"scale":return[t.d[0].value,0,0,0,0,t.d[1].value,0,0,0,0,1,0,0,0,0,1];case"scalex":return[t.d[0].value,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1];case"scaley":return[1,0,0,0,0,t.d[0].value,0,0,0,0,1,0,0,0,0,1];case"scalez":return[1,0,0,0,0,1,0,0,0,0,t.d[0].value,0,0,0,0,1];case"scale3d":return[t.d[0].value,0,0,0,0,t.d[1].value,0,0,0,0,t.d[2].value,0,0,0,0,1];case"skew":a=ti(Oo(t.d[0])),o=ti(Oo(t.d[1]));return[1,Math.tan(o),0,0,Math.tan(a),1,0,0,0,0,1,0,0,0,0,1];case"skewx":return i=ti(Oo(t.d[0])),[1,0,0,0,Math.tan(i),1,0,0,0,0,1,0,0,0,0,1];case"skewy":return i=ti(Oo(t.d[0])),[1,Math.tan(i),0,0,0,1,0,0,0,0,1,0,0,0,0,1];case"translate":return[1,0,0,0,0,1,0,0,0,0,1,0,e=ko(t.d[0],0,null)||0,n=ko(t.d[1],0,null)||0,0,1];case"translatex":return[1,0,0,0,0,1,0,0,0,0,1,0,e=ko(t.d[0],0,null)||0,0,0,1];case"translatey":return[1,0,0,0,0,1,0,0,0,0,1,0,0,n=ko(t.d[0],0,null)||0,0,1];case"translatez":return[1,0,0,0,0,1,0,0,0,0,1,0,0,0,r=ko(t.d[0],0,null)||0,1];case"translate3d":return[1,0,0,0,0,1,0,0,0,0,1,0,e=ko(t.d[0],0,null)||0,n=ko(t.d[1],0,null)||0,r=ko(t.d[2],0,null)||0,1];case"perspective":o=ko(t.d[0],0,null)||0;return[1,0,0,0,0,1,0,0,0,0,1,o?-1/o:0,0,0,0,1];case"matrix":return[t.d[0].value,t.d[1].value,0,0,t.d[2].value,t.d[3].value,0,0,0,0,1,0,t.d[4].value,t.d[5].value,0,1];case"matrix3d":return t.d.map(function(t){return t.value})}}function na(t,e){return[t[0]*e[0]+t[4]*e[1]+t[8]*e[2]+t[12]*e[3],t[1]*e[0]+t[5]*e[1]+t[9]*e[2]+t[13]*e[3],t[2]*e[0]+t[6]*e[1]+t[10]*e[2]+t[14]*e[3],t[3]*e[0]+t[7]*e[1]+t[11]*e[2]+t[15]*e[3],t[0]*e[4]+t[4]*e[5]+t[8]*e[6]+t[12]*e[7],t[1]*e[4]+t[5]*e[5]+t[9]*e[6]+t[13]*e[7],t[2]*e[4]+t[6]*e[5]+t[10]*e[6]+t[14]*e[7],t[3]*e[4]+t[7]*e[5]+t[11]*e[6]+t[15]*e[7],t[0]*e[8]+t[4]*e[9]+t[8]*e[10]+t[12]*e[11],t[1]*e[8]+t[5]*e[9]+t[9]*e[10]+t[13]*e[11],t[2]*e[8]+t[6]*e[9]+t[10]*e[10]+t[14]*e[11],t[3]*e[8]+t[7]*e[9]+t[11]*e[10]+t[15]*e[11],t[0]*e[12]+t[4]*e[13]+t[8]*e[14]+t[12]*e[15],t[1]*e[12]+t[5]*e[13]+t[9]*e[14]+t[13]*e[15],t[2]*e[12]+t[6]*e[13]+t[10]*e[14]+t[14]*e[15],t[3]*e[12]+t[7]*e[13]+t[11]*e[14]+t[15]*e[15]]}function ra(t){var e=[0,0,0],n=[1,1,1],r=[0,0,0],i=[0,0,0,1],o=[0,0,0,1];return ui(0===(t=t).length?[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]:t.map(ea).reduce(na),e,n,r,i,o),[[e,n,r,o,i]]}var ia=function(t,e,n,r,i){for(var o=[[1,0,0,0],[0,1,0,0],[0,0,1,0],[0,0,0,1]],a=0;a<4;a++)o[a][3]=i[a];for(var s=0;s<3;s++)for(var l=0;l<3;l++)o[3][s]+=t[l]*o[l][s];var u=r[0],c=r[1],h=r[2],r=r[3],d=[[1,0,0,0],[0,1,0,0],[0,0,1,0],[0,0,0,1]],h=(d[0][0]=1-2*(c*c+h*h),d[0][1]=2*(u*c-h*r),d[0][2]=2*(u*h+c*r),d[1][0]=2*(u*c+h*r),d[1][1]=1-2*(u*u+h*h),d[1][2]=2*(c*h-u*r),d[2][0]=2*(u*h-c*r),d[2][1]=2*(c*h+u*r),d[2][2]=1-2*(u*u+c*c),o=oa(o,d),[[1,0,0,0],[0,1,0,0],[0,0,1,0],[0,0,0,1]]);n[2]&&(h[2][1]=n[2],o=oa(o,h)),n[1]&&(h[2][1]=0,h[2][0]=n[0],o=oa(o,h)),n[0]&&(h[2][0]=0,h[1][0]=n[0],o=oa(o,h));for(var f=0;f<3;f++)for(var p=0;p<3;p++)o[f][p]*=e[f];return 0==(r=o)[0][2]&&0==r[0][3]&&0==r[1][2]&&0==r[1][3]&&0==r[2][0]&&0==r[2][1]&&1==r[2][2]&&0==r[2][3]&&0==r[3][2]&&1==r[3][3]?[o[0][0],o[0][1],o[1][0],o[1][1],o[3][0],o[3][1]]:o[0].concat(o[1],o[2],o[3])};function oa(t,e){for(var n=[[0,0,0,0],[0,0,0,0],[0,0,0,0],[0,0,0,0]],r=0;r<4;r++)for(var i=0;i<4;i++)for(var o=0;o<4;o++)n[r][i]+=e[r][o]*t[o][i];return n}function aa(t){return t.toFixed(6).replace(".000000","")}function sa(e,n){var r,i;return e.decompositionPair!==n&&(e.decompositionPair=n,r=ra(e)),n.decompositionPair!==e&&(n.decompositionPair=e,i=ra(n)),null===r[0]||null===i[0]?[[!1],[!0],function(t){return(t?n:e)[0].d}]:(r[0].push(0),i[0].push(1),[r,i,function(t){var e=function(t,e,n){var r=function(t,e){for(var n=0,r=0;r<t.length;r++)n+=t[r]*e[r];return n}(t,e),i=(r=Ue(r,-1,1),[]);if(1===r)i=t;else for(var o=Math.acos(r),a=+Math.sin(n*o)/Math.sqrt(1-r*r),s=0;s<4;s++)i.push(t[s]*(Math.cos(n*o)-r*a)+e[s]*a);return i}(r[0][3],i[0][3],t[5]);return ia(t[0],t[1],t[2],e,t[4]).map(aa).join(",")}])}function la(t){return t.replace(/[xy]/,"")}function ua(t){return t.replace(/(x|y|z|3d)?$/,"3d")}var ca=function(t,e){return"perspective"===t&&"perspective"===e||("matrix"===t||"matrix3d"===t)&&("matrix"===e||"matrix3d"===e)};function ha(r,i,t){var e=!1;if(!r.length||!i.length){r.length||(e=!0,r=i,i=[]);for(var o=0;o<r.length;o++)!function(){var t=r[o],e=t.t,t=t.d,n="scale"===e.substring(0,5)?1:0;i.push({t:e,d:t.map(function(t){return"number"==typeof t?kr(n):kr(n,t.unit)})})}()}var n=[],a=[],s=[];if(r.length!==i.length)var l=sa(r,i),n=[l[0]],a=[l[1]],s=[["matrix",[l[2]]]];else for(var u=0;u<r.length;u++){var c=r[u].t,h=i[u].t,d=r[u].d,f=i[u].d,p=Jo[c],g=Jo[h],m=void 0;if(ca(c,h)){var v=sa([r[u]],[i[u]]);n.push(v[0]),a.push(v[1]),s.push(["matrix",[v[2]]])}else{if(c===h)m=c;else if(p[2]&&g[2]&&la(c)===la(h))m=la(c),d=p[2](d),f=g[2](f);else{if(!p[1]||!g[1]||ua(c)!==ua(h)){v=sa(r,i);n=[v[0]],a=[v[1]],s=[["matrix",[v[2]]]];break}m=ua(c),d=p[1](d),f=g[1](f)}for(var y=[],E=[],_=[],b=0;b<d.length;b++){var x=function(t,e,n,r,i){void 0===i&&(i=0);var o="",a=t.value||0,s=e.value||0,l=Tr(t.unit),u=t.convertTo(l),l=e.convertTo(l);return u&&l?(a=u.value,s=l.value,o=pr(t.unit)):(Ar.isLength(t.unit)||Ar.isLength(e.unit))&&(a=ko(t,i,n),s=ko(e,i,n),o="px"),[a,s,function(t){return(t=r?Math.max(t,0):t)+o}]}(d[b],f[b],t,!1,b);y[b]=x[0],E[b]=x[1],_.push(x[2])}n.push(y),a.push(E),s.push([m,_])}}return e&&(l=n,n=a,a=l),[n,a,function(t){return t.map(function(t,n){t=t.map(function(t,e){return s[n][1][e](t)}).join(",");return"matrix"===s[n][0]&&16===t.split(",").length&&(s[n][0]="matrix3d"),"matrix3d"===s[n][0]&&6===t.split(",").length&&(s[n][0]="matrix"),s[n][0]+"("+t+")"}).join(" ")}]}var da=vr(function(t){var e;return Fe(t)?"text-anchor"===t?[kr(0,"px"),kr(0,"px")]:(1===(e=t.split(" ")).length&&("top"===e[0]||"bottom"===e[0]?(e[1]=e[0],e[0]="center"):e[1]="center"),2!==e.length?null:[Co(fa(e[0])),Co(fa(e[1]))]):[kr(t[0]||0,"px"),kr(t[1]||0,"px")]});function fa(t){return"center"===t?"50%":"left"===t||"top"===t?"0":"right"===t||"bottom"===t?"100%":t}var t=function(){function t(){this.parser=Po,this.parserWithCSSDisabled=null,this.mixer=Wo}return t.prototype.calculator=function(t,e,n,r){return Oo(n)},t}(),e=function(){function t(){}return t.prototype.calculator=function(t,e,n,r){return n instanceof mr&&(n=null),ct.sceneGraphService.updateDisplayObjectDependency(t,e,n,r),"clipPath"===t&&r.forEach(function(t){0===t.childNodes.length&&ct.sceneGraphService.dirtifyToRoot(t)}),n},t}(),n=function(){function t(){this.parser=Ao,this.parserWithCSSDisabled=Ao,this.mixer=Mo}return t.prototype.calculator=function(t,e,n,r){return n instanceof mr?"none"===n.value?Or:Ir:n},t}(),pa=function(){function t(){this.parser=Fo}return t.prototype.calculator=function(t,e,n){return n instanceof mr?[]:n},t}();function ga(t){t=t.parsedStyle.fontSize;return M(t)?null:t}function ma(){this.parser=da}var va,ya=function(){function t(){this.parser=Co,this.parserWithCSSDisabled=null,this.mixer=Wo}return t.prototype.calculator=function(t,e,n,r,i){if(B(n))return n;if(!Ar.isRelativeUnit(n.unit))return n.value;if(n.unit===p.kPercentage)return 0;if(n.unit===p.kEms){if(r.parentNode){var o=ga(r.parentNode);if(o)return o*=n.value}return i.addUnresolveProperty(r,t),0}if(n.unit===p.kRems){if(null!=r&&null!=(o=r.ownerDocument)&&o.documentElement){o=ga(r.ownerDocument.documentElement);if(o)return o*=n.value}return i.addUnresolveProperty(r,t),0}},t}(),Ea=function(){function t(){this.mixer=jo}var e=t.prototype;return e.parser=function(t){t=Lo(B(t)?[t]:t),t=1===t.length?[t[0],t[0]]:[t[0],t[1]];return t},e.calculator=function(t,e,n){return n.map(function(t){return t.value})},t}(),_a=function(){function t(){this.mixer=jo}var e=t.prototype;return e.parser=function(t){t=Lo(B(t)?[t]:t),t=1===t.length?[t[0],t[0],t[0],t[0]]:2===t.length?[t[0],t[1],t[0],t[1]]:3===t.length?[t[0],t[1],t[2],t[1]]:[t[0],t[1],t[2],t[3]];return t},e.calculator=function(t,e,n){return n.map(function(t){return t.value})},t}(),ba=function(t){function e(){return t.apply(this,arguments)||this}return er(e,t),e.prototype.postProcessor=function(t,e){var n,r;switch(t.nodeName){case lt.CIRCLE:case lt.ELLIPSE:var i=t.parsedStyle,o=i.cx,a=i.cy,i=i.cz;M(o)||(l=o),M(a)||(u=a),M(i)||(c=i);break;case lt.LINE:var o=t.parsedStyle,a=o.x1,i=o.x2,s=o.y1,o=o.y2,l=Math.min(a,i),u=Math.min(s,o),c=0;break;case lt.RECT:case lt.IMAGE:case lt.GROUP:case lt.HTML:case lt.TEXT:case lt.MESH:M(t.parsedStyle.x)||(l=t.parsedStyle.x),M(t.parsedStyle.y)||(u=t.parsedStyle.y),M(t.parsedStyle.z)||(c=t.parsedStyle.z)}t.nodeName!==lt.PATH&&t.nodeName!==lt.POLYLINE&&t.nodeName!==lt.POLYGON&&(t.parsedStyle.defX=l||0,t.parsedStyle.defY=u||0),M(l)&&M(u)&&M(c)||-1!==e.indexOf("transform")||((e=t.parsedStyle.transform)&&e.length?di(e,t):(n=(e=t.getLocalPosition())[0],r=e[1],e=e[2],t.setLocalPosition(M(l)?n:l,M(u)?r:u,M(c)?e:c)))},e}(ya),xa=function(){function t(){}return t.prototype.calculator=function(t,e,n,r){n=null==(n=n=n instanceof mr?null:n)?void 0:n.cloneNode(!0);return n&&(n.style.isMarker=!0),n},t}(),Sa=function(){function t(){this.mixer=Wo,this.parser=Go,this.parserWithCSSDisabled=null}return t.prototype.calculator=function(t,e,n){return n.value},t}(),r=function(){function t(){this.parser=Go,this.parserWithCSSDisabled=null,this.mixer=Vo(0,1)}var e=t.prototype;return e.calculator=function(t,e,n){return n.value},e.postProcessor=function(t){var e,n=t.parsedStyle,r=n.offsetPath,n=n.offsetDistance;!r||(e=r.nodeName)!==lt.LINE&&e!==lt.PATH&&e!==lt.POLYLINE||(e=r.getPoint(n))&&(t.parsedStyle.defX=e.x,t.parsedStyle.defY=e.y,t.setLocalPosition(e.x,e.y))},t}(),wa=function(){function t(){this.parser=Go,this.parserWithCSSDisabled=null,this.mixer=Vo(0,1)}return t.prototype.calculator=function(t,e,n){return n.value},t}(),Ta=function(){function m(){this.center=[0,0,0],this.halfExtents=[0,0,0],this.min=[0,0,0],this.max=[0,0,0]}m.isEmpty=function(t){return!t||0===t.halfExtents[0]&&0===t.halfExtents[1]&&0===t.halfExtents[2]};var t=m.prototype;return t.update=function(t,e){Kr(this.center,t),Kr(this.halfExtents,e),qr(this.min,this.center,this.halfExtents),$r(this.max,this.center,this.halfExtents)},t.setMinMax=function(t,e){$r(this.center,e,t),Zr(this.center,this.center,.5),qr(this.halfExtents,e,t),Zr(this.halfExtents,this.halfExtents,.5),Kr(this.min,t),Kr(this.max,e)},t.getMin=function(){return this.min},t.getMax=function(){return this.max},t.add=function(t){var e,n,r,i,o,a,s,l,u,c,h,d,f,p,g;m.isEmpty(t)||(m.isEmpty(this)?this.setMinMax(t.getMin(),t.getMax()):(n=(e=this.center)[0],p=e[1],o=e[2],i=(r=this.halfExtents)[0],h=r[1],a=r[2],l=(d=t.center)[0],g=d[1],d=d[2],u=(t=t.halfExtents)[0],(f=g-(c=t[1]))<(s=p-h)&&(s=f),(f=p+h)<(p=g+c)&&(f=p),(g=d-(h=t[2]))<(c=o-a)&&(c=g),(p=o+a)<(t=d+h)&&(p=t),e[0]=.5*((o=(g=l-u)<(o=n-i)?g:o)+(a=(a=n+i)<(d=l+u)?d:a)),e[1]=.5*(s+f),e[2]=.5*(c+p),r[0]=.5*(a-o),r[1]=.5*(f-s),r[2]=.5*(p-c),this.min[0]=o,this.min[1]=s,this.min[2]=c,this.max[0]=a,this.max[1]=f,this.max[2]=p))},t.setFromTransformedAABB=function(t,e){var n=this.center,r=this.halfExtents,i=t.center,t=t.halfExtents,o=e[0],a=e[4],s=e[8],l=e[1],u=e[5],c=e[9],h=e[2],d=e[6],f=e[10],p=Math.abs(o),g=Math.abs(a),m=Math.abs(s),v=Math.abs(l),y=Math.abs(u),E=Math.abs(c),_=Math.abs(h),b=Math.abs(d),x=Math.abs(f);n[0]=e[12]+o*i[0]+a*i[1]+s*i[2],n[1]=e[13]+l*i[0]+u*i[1]+c*i[2],n[2]=e[14]+h*i[0]+d*i[1]+f*i[2],r[0]=p*t[0]+g*t[1]+m*t[2],r[1]=v*t[0]+y*t[1]+E*t[2],r[2]=_*t[0]+b*t[1]+x*t[2],qr(this.min,n,r),$r(this.max,n,r)},t.intersects=function(t){var e=this.getMax(),n=this.getMin(),r=t.getMax(),t=t.getMin();return n[0]<=r[0]&&e[0]>=t[0]&&n[1]<=r[1]&&e[1]>=t[1]&&n[2]<=r[2]&&e[2]>=t[2]},t.intersection=function(t){var e,n,r,i;return this.intersects(t)?(e=new m,i=[0,0,0],n=this.getMin(),r=t.getMin(),i[0]=Math.max(n[0],r[0]),i[1]=Math.max(n[1],r[1]),i[2]=Math.max(n[2],r[2]),n=i,r=[0,0,0],i=this.getMax(),t=t.getMax(),r[0]=Math.min(i[0],t[0]),r[1]=Math.min(i[1],t[1]),r[2]=Math.min(i[2],t[2]),e.setMinMax(n,r),e):null},t.getNegativeFarPoint=function(t){return 273===t.pnVertexFlag?Kr([0,0,0],this.min):272===t.pnVertexFlag?[this.min[0],this.min[1],this.max[2]]:257===t.pnVertexFlag?[this.min[0],this.max[1],this.min[2]]:256===t.pnVertexFlag?[this.min[0],this.max[1],this.max[2]]:17===t.pnVertexFlag?[this.max[0],this.min[1],this.min[2]]:16===t.pnVertexFlag?[this.max[0],this.min[1],this.max[2]]:1===t.pnVertexFlag?[this.max[0],this.max[1],this.min[2]]:[this.max[0],this.max[1],this.max[2]]},t.getPositiveFarPoint=function(t){return 273===t.pnVertexFlag?Kr([0,0,0],this.max):272===t.pnVertexFlag?[this.max[0],this.max[1],this.min[2]]:257===t.pnVertexFlag?[this.max[0],this.min[1],this.max[2]]:256===t.pnVertexFlag?[this.max[0],this.min[1],this.min[2]]:17===t.pnVertexFlag?[this.min[0],this.max[1],this.max[2]]:16===t.pnVertexFlag?[this.min[0],this.max[1],this.min[2]]:1===t.pnVertexFlag?[this.min[0],this.min[1],this.max[2]]:[this.min[0],this.min[1],this.min[2]]},m}(),Aa=function(){function t(t,e){this.distance=void 0,this.normal=void 0,this.pnVertexFlag=void 0,this.distance=t||0,this.normal=e||x(0,1,0),this.updatePNVertexFlag()}var e=t.prototype;return e.updatePNVertexFlag=function(){this.pnVertexFlag=(Number(0<=this.normal[0])<<8)+(Number(0<=this.normal[1])<<4)+Number(0<=this.normal[2])},e.distanceToPoint=function(t){return Lt(t,this.normal)-this.distance},e.normalize=function(){var t=1/Wt(this.normal);Ot(this.normal,this.normal,t),this.distance*=t},e.intersectsLine=function(t,e,n){var r=this.distanceToPoint(t),r=r/(r-this.distanceToPoint(e)),i=0<=r&&r<=1;return i&&n&&Dt(n,t,e,r),i},t}(),Ma=((Ca=va=va||{})[Ca.OUTSIDE=4294967295]="OUTSIDE",Ca[Ca.INSIDE=0]="INSIDE",Ca[Ca.INDETERMINATE=2147483647]="INDETERMINATE",function(){function t(t){if(this.planes=[],t)this.planes=t;else for(var e=0;e<6;e++)this.planes.push(new Aa)}return t.prototype.extractFromVPMatrix=function(t){var e=t[0],n=t[1],r=t[2],i=t[3],o=t[4],a=t[5],s=t[6],l=t[7],u=t[8],c=t[9],h=t[10],d=t[11],f=t[12],p=t[13],g=t[14],t=t[15];Nt(this.planes[0].normal,i-e,l-o,d-u),this.planes[0].distance=t-f,Nt(this.planes[1].normal,i+e,l+o,d+u),this.planes[1].distance=t+f,Nt(this.planes[2].normal,i+n,l+a,d+c),this.planes[2].distance=t+p,Nt(this.planes[3].normal,i-n,l-a,d-c),this.planes[3].distance=t-p,Nt(this.planes[4].normal,i-r,l-s,d-h),this.planes[4].distance=t-g,Nt(this.planes[5].normal,i+r,l+s,d+h),this.planes[5].distance=t+g,this.planes.forEach(function(t){t.normalize(),t.updatePNVertexFlag()})},t}()),Ra=function(){function t(t,e){void 0===t&&(t=0),void 0===e&&(e=0),this.x=0,this.y=0,this.x=t,this.y=e}var e=t.prototype;return e.clone=function(){return new t(this.x,this.y)},e.copyFrom=function(t){this.x=t.x,this.y=t.y},t}(),Na=function(){function t(t,e,n,r){this.x=void 0,this.y=void 0,this.width=void 0,this.height=void 0,this.left=void 0,this.right=void 0,this.top=void 0,this.bottom=void 0,this.x=t,this.y=e,this.width=n,this.height=r,this.left=t,this.right=t+n,this.top=e,this.bottom=e+r}return t.prototype.toJSON=function(){},t}(),Ca=function(){function t(){this.parser=Xo,this.parserWithCSSDisabled=Xo,this.mixer=Yo}var e=t.prototype;return e.calculator=function(t,e,n){return n instanceof mr&&"unset"===n.value?{absolutePath:[],hasArc:!1,segments:[],polygons:[],polylines:[],curve:null,totalLength:0,rect:new Na(0,0,0,0)}:n},e.postProcessor=function(t,e){var n;t.nodeName===lt.PATH&&-1===e.indexOf("transform")&&(n=(e=t.parsedStyle).defX,e=e.defY,t.setLocalPosition(void 0===n?0:n,void 0===e?0:e))},t}(),Pa=function(){function t(){this.parser=Ko,this.mixer=qo}return t.prototype.postProcessor=function(t,e){var n;t.nodeName!==lt.POLYGON&&t.nodeName!==lt.POLYLINE||-1!==e.indexOf("transform")||(n=(e=t.parsedStyle).defX,e=e.defY,t.setLocalPosition(n,e))},t}(),Oa=function(i){function t(){for(var t,e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];return(t=i.call.apply(i,[this].concat(n))||this).mixer=Vo(0,1/0),t}return er(t,i),t}(ya),Ia=function(){function t(){}var e=t.prototype;return e.calculator=function(t,e,n,r){return n instanceof mr?"unset"===n.value?"":n.value:""+n},e.postProcessor=function(t){t.nodeValue=""+t.parsedStyle.text||""},t}(),La=function(){function t(){}return t.prototype.calculator=function(t,e,n,r){var i,o=r.getAttribute("text");return o&&(i=o,"capitalize"===n.value?i=o.charAt(0).toUpperCase()+o.slice(1):"lowercase"===n.value?i=o.toLowerCase():"uppercase"===n.value&&(i=o.toUpperCase()),r.parsedStyle.text=i),n.value},t}(),ka=function(){function t(){this.parser=ta,this.parserWithCSSDisabled=ta,this.mixer=ha}var e=t.prototype;return e.calculator=function(t,e,n,r){return n instanceof mr?[]:n},e.postProcessor=function(t){di(t.parsedStyle.transform,t)},t}(),Da=function(){function t(){this.parser=Go}var e=t.prototype;return e.calculator=function(t,e,n,r){return n.value},e.postProcessor=function(t){var e;t.parentNode&&(e=(t=t.parentNode).renderable,t=t.sortable,e&&(e.dirty=!0),t)&&(t.dirty=!0)},t}(),Ba=function(){function t(){this.registry={},this.define(lt.CIRCLE,ls),this.define(lt.ELLIPSE,hs),this.define(lt.RECT,Rs),this.define(lt.IMAGE,vs),this.define(lt.LINE,Es),this.define(lt.GROUP,fs),this.define(lt.PATH,xs),this.define(lt.POLYGON,ws),this.define(lt.POLYLINE,As),this.define(lt.TEXT,Cs),this.define(lt.HTML,gs)}var e=t.prototype;return e.define=function(t,e){this.registry[t]=e},e.get=function(t){return this.registry[t]},t}();var Fa,v,Ua=function(){function e(t){this.type=void 0,this.eventPhase=e.prototype.NONE,this.target=void 0,this.bubbles=!0,this.cancelBubble=!0,this.cancelable=!1,this.currentTarget=void 0,this.defaultPrevented=!1,this.timeStamp=void 0,this.nativeEvent=void 0,this.originalEvent=void 0,this.propagationStopped=!1,this.propagationImmediatelyStopped=!1,this.manager=void 0,this.detail=void 0,this.layer=new Ra,this.page=new Ra,this.canvas=new Ra,this.viewport=new Ra,this.path=void 0,this.view=void 0,this.which=void 0,this.returnValue=void 0,this.srcElement=void 0,this.composed=!1,this.isTrusted=void 0,this.NONE=0,this.CAPTURING_PHASE=1,this.AT_TARGET=2,this.BUBBLING_PHASE=3,this.manager=t}var t=e.prototype;return t.composedPath=function(){return!this.manager||this.path&&this.path[0]===this.target||(this.path=this.target?this.manager.propagationPath(this.target):[]),this.path},t.preventDefault=function(){this.nativeEvent instanceof Event&&this.nativeEvent.cancelable&&this.nativeEvent.preventDefault(),this.defaultPrevented=!0},t.stopImmediatePropagation=function(){this.propagationImmediatelyStopped=!0},t.stopPropagation=function(){this.propagationStopped=!0},t.initEvent=function(){},t.initUIEvent=function(){},t.clone=function(){throw new Error(Hr)},tr(e,[{key:"name",get:function(){return this.type}},{key:"layerX",get:function(){return this.layer.x}},{key:"layerY",get:function(){return this.layer.y}},{key:"pageX",get:function(){return this.page.x}},{key:"pageY",get:function(){return this.page.y}},{key:"x",get:function(){return this.canvas.x}},{key:"y",get:function(){return this.canvas.y}},{key:"canvasX",get:function(){return this.canvas.x}},{key:"canvasY",get:function(){return this.canvas.y}},{key:"viewportX",get:function(){return this.viewport.x}},{key:"viewportY",get:function(){return this.viewport.y}},{key:"propagationPath",get:function(){return this.composedPath()}}]),e}(),Ga=function(r){function t(t,e){var n=r.call(this,null)||this;return n.type=t,n.detail=e,Object.assign(ir(n),e),n}return er(t,r),t}(Ua),i=function(){function t(){this.emitter=new qn}var e=t.prototype;return e.on=function(t,e,n){return this.addEventListener(t,e,n),this},e.addEventListener=function(t,e,n){var r,i,o,a=Ve(n)&&n||Ie(n)&&n.capture,n=Ie(n)&&n.once,s=_r(e)?void 0:e,l=!1,u="";return-1<t.indexOf(":")&&(i=(r=t.split(":"))[0],t=r[1],u=i,l=!0),t=a?t+"capture":t,e=_r(e)?e:e.handleEvent,l&&(o=e,e=function(){for(var t,e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];(null==(t=n[0].target)?void 0:t.name)===u&&o.apply(void 0,n)}),n?this.emitter.once(t,e,s):this.emitter.on(t,e,s),this},e.off=function(t,e,n){return t?this.removeEventListener(t,e,n):this.removeAllEventListeners(),this},e.removeAllEventListeners=function(){this.emitter.removeAllListeners()},e.removeEventListener=function(t,e,n){var r,n=Ve(n)&&n||Ie(n)&&n.capture,i=_r(e)?void 0:e;return e=_r(e)?e:null==(r=e)?void 0:r.handleEvent,this.emitter.off(t=n?t+"capture":t,e,i),this},e.emit=function(t,e){this.dispatchEvent(new Ga(t,e))},e.dispatchEvent=function(t,e){if(void 0===e&&(e=!1),!t.type)throw new Error("DisplayObject cannot propagate events outside of the Federated Events API");var n;if(n=this.document?this:this.defaultView||(null==(n=this.ownerDocument)?void 0:n.defaultView)){if(t.manager=n.getEventService()||null,!t.manager)return!1;t.defaultPrevented=!1,t.path=[],e||(t.target=this),null!=(n=t.manager)&&n.dispatchEvent(t,t.type,e)}return!t.defaultPrevented},t}(),Wa=function(i){function f(){for(var t,e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];return(t=i.call.apply(i,[this].concat(n))||this).shadow=!1,t.ownerDocument=null,t.isConnected=!1,t.baseURI="",t.childNodes=[],t.nodeType=0,t.nodeName="",t.nodeValue=null,t.parentNode=null,t}er(f,i),f.isNode=function(t){return!!t.childNodes};var t=f.prototype;return t.getRootNode=function(t){return void 0===t&&(t={}),this.parentNode?this.parentNode.getRootNode(t):t.composed&&this.host?this.host.getRootNode(t):this},t.hasChildNodes=function(){return 0<this.childNodes.length},t.isDefaultNamespace=function(t){throw new Error(Hr)},t.lookupNamespaceURI=function(t){throw new Error(Hr)},t.lookupPrefix=function(t){throw new Error(Hr)},t.normalize=function(){throw new Error(Hr)},t.isEqualNode=function(t){return this===t},t.isSameNode=function(t){return this.isEqualNode(t)},t.compareDocumentPosition=function(t){if(t===this)return 0;for(var e=[i=t],n=[o=this];null!=(r=i.parentNode)?r:o.parentNode;)var r,i=i.parentNode?(e.push(i.parentNode),i.parentNode):i,o=o.parentNode?(n.push(o.parentNode),o.parentNode):o;if(i!==o)return f.DOCUMENT_POSITION_DISCONNECTED|f.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC|f.DOCUMENT_POSITION_PRECEDING;var a=n.length<e.length?e:n,s=a===e?n:e;if(a[a.length-s.length]===s[0])return a===e?f.DOCUMENT_POSITION_CONTAINED_BY|f.DOCUMENT_POSITION_FOLLOWING:f.DOCUMENT_POSITION_CONTAINS|f.DOCUMENT_POSITION_PRECEDING;for(var l=a.length-s.length,u=s.length-1;0<=u;u--){var c,h=s[u],d=a[l+u];if(d!==h)return(c=h.parentNode.childNodes).indexOf(h)<c.indexOf(d)?s===e?f.DOCUMENT_POSITION_PRECEDING:f.DOCUMENT_POSITION_FOLLOWING:a===e?f.DOCUMENT_POSITION_PRECEDING:f.DOCUMENT_POSITION_FOLLOWING}return f.DOCUMENT_POSITION_FOLLOWING},t.contain=function(t){return this.contains(t)},t.contains=function(t){for(var e=t;e&&this!==e;)e=e.parentNode;return!!e},t.getAncestor=function(t){for(var e=this;0<t&&e;)e=e.parentNode,t--;return e},t.forEach=function(e,t){void 0===t&&(t=!1),e(this)||(t?this.childNodes.slice():this.childNodes).forEach(function(t){t.forEach(e)})},tr(f,[{key:"textContent",get:function(){var t="";this.nodeName===lt.TEXT&&(t+=this.style.text);for(var e=ar(this.childNodes);!(n=e()).done;){var n=n.value;n.nodeName===lt.TEXT?t+=n.nodeValue:t+=n.textContent}return t},set:function(t){var e=this;this.childNodes.slice().forEach(function(t){e.removeChild(t)}),this.nodeName===lt.TEXT&&(this.style.text=""+t)}},{key:"parent",get:function(){return this.parentNode}},{key:"parentElement",get:function(){return null}},{key:"nextSibling",get:function(){return null}},{key:"previousSibling",get:function(){return null}},{key:"firstChild",get:function(){return 0<this.childNodes.length?this.childNodes[0]:null}},{key:"lastChild",get:function(){return 0<this.childNodes.length?this.childNodes[this.childNodes.length-1]:null}}]),f}(i),Va=(Wa.DOCUMENT_POSITION_DISCONNECTED=1,Wa.DOCUMENT_POSITION_PRECEDING=2,Wa.DOCUMENT_POSITION_FOLLOWING=4,Wa.DOCUMENT_POSITION_CONTAINS=8,Wa.DOCUMENT_POSITION_CONTAINED_BY=16,Wa.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC=32,function(e){function t(){var t=e.call(this)||this;t.defaultView=null,t.documentElement=void 0,t.timeline=void 0,t.ownerDocument=null,t.nodeName="document";try{t.timeline=new ct.AnimationTimeline(ir(t))}catch(t){}var r={};return Ps.forEach(function(t){var e=t.n,n=t.inh,t=t.d;n&&t&&(r[e]=_r(t)?t(lt.GROUP):t)}),t.documentElement=new fs({id:"g-root",style:r}),t.documentElement.ownerDocument=ir(t),t.documentElement.parentNode=ir(t),t.childNodes=[t.documentElement],t}er(t,e);var n=t.prototype;return n.createElement=function(t,e){var n;return"svg"===t?this.documentElement:((n=this.defaultView.customElements.get(t))||(console.warn("Unsupported tagName: ",t),n="tspan"===t?Cs:fs),(t=new n(e)).ownerDocument=this,t)},n.createElementNS=function(t,e,n){return this.createElement(e,n)},n.cloneNode=function(t){throw new Error(Hr)},n.destroy=function(){try{this.documentElement.destroyChildren(),this.timeline.destroy()}catch(t){}},n.elementsFromBBox=function(t,e,n,r){var t=this.defaultView.context.rBushRoot.search({minX:t,minY:e,maxX:n,maxY:r}),i=[];return t.forEach(function(t){var t=t.displayObject,e=t.parsedStyle.pointerEvents,e=["auto","visiblepainted","visiblefill","visiblestroke","visible"].includes(e);e&&!t.isVisible()||t.isCulled()||!t.isInteractive()||i.push(t)}),i.sort(function(t,e){return e.sortable.renderOrder-t.sortable.renderOrder}),i},n.elementFromPointSync=function(t,e){var n=this.defaultView.canvas2Viewport({x:t,y:e}),r=n.x,n=n.y,i=this.defaultView.getConfig(),o=i.width,i=i.height;return r<0||n<0||o<r||i<n?null:(i=(o=this.defaultView.viewport2Client({x:r,y:n})).x,o=o.y,(t=this.defaultView.getRenderingService().hooks.pickSync.call({topmost:!0,position:{x:t,y:e,viewportX:r,viewportY:n,clientX:i,clientY:o},picked:[]}).picked)&&t[0]||this.documentElement)},n.elementFromPoint=function(){var n=Qn($n().mark(function t(e,n){var r,i,o,a,s,l;return $n().wrap(function(t){for(;;)switch(t.prev=t.next){case 0:if(i=this.defaultView.canvas2Viewport({x:e,y:n}),r=i.x,i=i.y,a=this.defaultView.getConfig(),o=a.width,a=a.height,r<0||i<0||o<r||a<i)return t.abrupt("return",null);t.next=4;break;case 4:return o=this.defaultView.viewport2Client({x:r,y:i}),a=o.x,s=o.y,t.next=7,this.defaultView.getRenderingService().hooks.pick.promise({topmost:!0,position:{x:e,y:n,viewportX:r,viewportY:i,clientX:a,clientY:s},picked:[]});case 7:return s=t.sent,l=s.picked,t.abrupt("return",l&&l[0]||this.documentElement);case 10:case"end":return t.stop()}},t,this)}));return function(t,e){return n.apply(this,arguments)}}(),n.elementsFromPointSync=function(t,e){var n=this.defaultView.canvas2Viewport({x:t,y:e}),r=n.x,n=n.y,i=this.defaultView.getConfig(),o=i.width,i=i.height;return r<0||n<0||o<r||i<n?[]:(i=(o=this.defaultView.viewport2Client({x:r,y:n})).x,o=o.y,(t=this.defaultView.getRenderingService().hooks.pickSync.call({topmost:!1,position:{x:t,y:e,viewportX:r,viewportY:n,clientX:i,clientY:o},picked:[]}).picked)[t.length-1]!==this.documentElement&&t.push(this.documentElement),t)},n.elementsFromPoint=function(){var n=Qn($n().mark(function t(e,n){var r,i,o,a,s,l;return $n().wrap(function(t){for(;;)switch(t.prev=t.next){case 0:if(i=this.defaultView.canvas2Viewport({x:e,y:n}),r=i.x,i=i.y,a=this.defaultView.getConfig(),o=a.width,a=a.height,r<0||i<0||o<r||a<i)return t.abrupt("return",[]);t.next=4;break;case 4:return o=this.defaultView.viewport2Client({x:r,y:i}),a=o.x,s=o.y,t.next=7,this.defaultView.getRenderingService().hooks.pick.promise({topmost:!1,position:{x:e,y:n,viewportX:r,viewportY:i,clientX:a,clientY:s},picked:[]});case 7:return s=t.sent,(l=s.picked)[l.length-1]!==this.documentElement&&l.push(this.documentElement),t.abrupt("return",l);case 11:case"end":return t.stop()}},t,this)}));return function(t,e){return n.apply(this,arguments)}}(),n.appendChild=function(t,e){throw new Error(Xr)},n.insertBefore=function(t,e){throw new Error(Xr)},n.removeChild=function(t,e){throw new Error(Xr)},n.replaceChild=function(t,e,n){throw new Error(Xr)},n.append=function(){throw new Error(Xr)},n.prepend=function(){throw new Error(Xr)},n.getElementById=function(t){return this.documentElement.getElementById(t)},n.getElementsByName=function(t){return this.documentElement.getElementsByName(t)},n.getElementsByTagName=function(t){return this.documentElement.getElementsByTagName(t)},n.getElementsByClassName=function(t){return this.documentElement.getElementsByClassName(t)},n.querySelector=function(t){return this.documentElement.querySelector(t)},n.querySelectorAll=function(t){return this.documentElement.querySelectorAll(t)},n.find=function(t){return this.documentElement.find(t)},n.findAll=function(t){return this.documentElement.findAll(t)},tr(t,[{key:"children",get:function(){return this.childNodes}},{key:"childElementCount",get:function(){return this.childNodes.length}},{key:"firstElementChild",get:function(){return this.firstChild}},{key:"lastElementChild",get:function(){return this.lastChild}}]),t}(Wa)),ja=(Fa=Fa||{},Fa[Fa.Standard=0]="Standard",(qa=v=v||{}).REPARENT="reparent",qa.DESTROY="destroy",qa.ATTR_MODIFIED="DOMAttrModified",qa.INSERTED="DOMNodeInserted",qa.REMOVED="removed",qa.MOUNTED="DOMNodeInsertedIntoDocument",qa.UNMOUNTED="DOMNodeRemovedFromDocument",qa.BOUNDS_CHANGED="bounds-changed",qa.RENDER_ORDER_CHANGED="render-order-changed",qa.CULLED="culled",function(u){function t(t,e,n,r,i,o,a,s){var l=u.call(this,null)||this;return l.relatedNode=void 0,l.prevValue=void 0,l.newValue=void 0,l.attrName=void 0,l.attrChange=void 0,l.prevParsedValue=void 0,l.newParsedValue=void 0,l.relatedNode=e,l.prevValue=n,l.newValue=r,l.attrName=i,l.attrChange=o,l.prevParsedValue=a,l.newParsedValue=s,l.type=t,l}return er(t,u),t}(Ua)),za=(ja.ADDITION=2,ja.MODIFICATION=1,ja.REMOVAL=3,0),Ha=new ja(v.INSERTED,null,"","","",0,"",""),Xa=new ja(v.REMOVED,null,"","","",0,"",""),Ya=new Ga(v.DESTROY),Ka=function(i){function t(){for(var t,e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];return(t=i.call.apply(i,[this].concat(n))||this).entity=za++,t.renderable={bounds:void 0,boundsDirty:!0,renderBounds:void 0,renderBoundsDirty:!0,dirtyRenderBounds:void 0,dirty:!1,proxyNodeName:void 0},t.cullable={strategy:Fa.Standard,visibilityPlaneMask:-1,visible:!0,enable:!0},t.transformable={dirtyFlag:!1,localDirtyFlag:!1,frozen:!1,localPosition:[0,0,0],localRotation:[0,0,0,1],localScale:[1,1,1],localTransform:[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],localSkew:[0,0],position:[0,0,0],rotation:[0,0,0,1],scaling:[1,1,1],worldTransform:[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],origin:[0,0,0]},t.sortable={dirty:!1,sorted:void 0,lastSortedIndex:void 0,renderOrder:0},t.geometry={contentBounds:void 0,renderBounds:void 0},t.rBushNode={aabb:void 0},t.id=void 0,t.name=void 0,t.namespaceURI="g",t.scrollLeft=0,t.scrollTop=0,t.clientTop=0,t.clientLeft=0,t.destroyed=!1,t.style={},t.computedStyle=ct.enableCSSParsing?{anchor:Cr,opacity:Cr,fillOpacity:Cr,strokeOpacity:Cr,fill:Cr,stroke:Cr,transform:Cr,transformOrigin:Cr,visibility:Cr,pointerEvents:Cr,lineWidth:Cr,lineCap:Cr,lineJoin:Cr,increasedLineWidthForHitTesting:Cr,fontSize:Cr,fontFamily:Cr,fontStyle:Cr,fontWeight:Cr,fontVariant:Cr,textAlign:Cr,textBaseline:Cr,textTransform:Cr,zIndex:Cr,filter:Cr,shadowType:Cr}:null,t.parsedStyle={},t.attributes={},t}er(t,i),t.isElement=function(t){return!!t.getAttribute};var e=t.prototype;return e.cloneNode=function(t){throw new Error(Hr)},e.appendChild=function(t,e){if(t.destroyed)throw new Error("Cannot append a destroyed element.");return ct.sceneGraphService.attach(t,this,e),null!=(e=this.ownerDocument)&&e.defaultView&&this.ownerDocument.defaultView.mountChildren(t),Ha.relatedNode=this,t.dispatchEvent(Ha),t},e.insertBefore=function(t,e){return e?(e=this.childNodes.indexOf(e),this.appendChild(t,e-1)):this.appendChild(t),t},e.replaceChild=function(t,e){var n=this.childNodes.indexOf(e);return this.removeChild(e),this.appendChild(t,n),e},e.removeChild=function(t){var e;return Xa.relatedNode=this,t.dispatchEvent(Xa),null!=(e=t.ownerDocument)&&e.defaultView&&t.ownerDocument.defaultView.unmountChildren(t),ct.sceneGraphService.detach(t),t},e.removeChildren=function(){for(var t=this.childNodes.length-1;0<=t;t--){var e=this.childNodes[t];this.removeChild(e)}},e.destroyChildren=function(){for(var t=this.childNodes.length-1;0<=t;t--){var e=this.childNodes[t];e.childNodes.length&&e.destroyChildren(),e.destroy()}},e.matches=function(t){return ct.sceneGraphService.matches(t,this)},e.getElementById=function(t){return ct.sceneGraphService.querySelector("#"+t,this)},e.getElementsByName=function(t){return ct.sceneGraphService.querySelectorAll('[name="'+t+'"]',this)},e.getElementsByClassName=function(t){return ct.sceneGraphService.querySelectorAll("."+t,this)},e.getElementsByTagName=function(t){return ct.sceneGraphService.querySelectorAll(t,this)},e.querySelector=function(t){return ct.sceneGraphService.querySelector(t,this)},e.querySelectorAll=function(t){return ct.sceneGraphService.querySelectorAll(t,this)},e.closest=function(t){var e=this;do{if(ct.sceneGraphService.matches(t,e))return e}while(null!==(e=e.parentElement));return null},e.find=function(e){var n=this,r=null;return this.forEach(function(t){return!(t===n||!e(t)||(r=t,0))}),r},e.findAll=function(e){var n=this,r=[];return this.forEach(function(t){t!==n&&e(t)&&r.push(t)}),r},e.after=function(){var r=this;if(this.parentNode){for(var i=this.parentNode.childNodes.indexOf(this),t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];e.forEach(function(t,e){var n;return null==(n=r.parentNode)?void 0:n.appendChild(t,i+e+1)})}},e.before=function(){if(this.parentNode){for(var t=this.parentNode.childNodes.indexOf(this),e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];var i=n[0],o=n.slice(1);this.parentNode.appendChild(i,t),i.after.apply(i,o)}},e.replaceWith=function(){this.after.apply(this,arguments),this.remove()},e.append=function(){for(var e=this,t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];n.forEach(function(t){return e.appendChild(t)})},e.prepend=function(){for(var n=this,t=arguments.length,e=new Array(t),r=0;r<t;r++)e[r]=arguments[r];e.forEach(function(t,e){return n.appendChild(t,e)})},e.replaceChildren=function(){for(;this.childNodes.length&&this.firstChild;)this.removeChild(this.firstChild);this.append.apply(this,arguments)},e.remove=function(){return this.parentNode?this.parentNode.removeChild(this):this},e.destroy=function(){this.dispatchEvent(Ya),this.remove(),this.emitter.removeAllListeners(),this.destroyed=!0},e.getGeometryBounds=function(){return ct.sceneGraphService.getGeometryBounds(this)},e.getRenderBounds=function(){return ct.sceneGraphService.getBounds(this,!0)},e.getBounds=function(){return ct.sceneGraphService.getBounds(this)},e.getLocalBounds=function(){return ct.sceneGraphService.getLocalBounds(this)},e.getBoundingClientRect=function(){return ct.sceneGraphService.getBoundingClientRect(this)},e.getClientRects=function(){return[this.getBoundingClientRect()]},e.computedStyleMap=function(){return new Map(Object.entries(this.computedStyle))},e.getAttributeNames=function(){return Object.keys(this.attributes)},e.getAttribute=function(t){var e;return"symbol"==typeof t?ct.enableCSSParsing?null:void 0:void 0===(e=this.attributes[t])&&(t=wr(t),e=this.attributes[t],ct.enableCSSParsing)&&M(e)?null:e},e.hasAttribute=function(t){return this.getAttributeNames().includes(t)},e.hasAttributes=function(){return!!this.getAttributeNames().length},e.removeAttribute=function(t){this.setAttribute(t,null),delete this.attributes[t]},e.setAttribute=function(t,e,n){this.attributes[t]=e},e.getAttributeNS=function(t,e){throw new Error(Hr)},e.getAttributeNode=function(t){throw new Error(Hr)},e.getAttributeNodeNS=function(t,e){throw new Error(Hr)},e.hasAttributeNS=function(t,e){throw new Error(Hr)},e.removeAttributeNS=function(t,e){throw new Error(Hr)},e.removeAttributeNode=function(t){throw new Error(Hr)},e.setAttributeNS=function(t,e,n){throw new Error(Hr)},e.setAttributeNode=function(t){throw new Error(Hr)},e.setAttributeNodeNS=function(t){throw new Error(Hr)},e.toggleAttribute=function(t,e){throw new Error(Hr)},tr(t,[{key:"className",get:function(){return this.getAttribute("class")||""},set:function(t){this.setAttribute("class",t)}},{key:"classList",get:function(){return this.className.split(" ").filter(function(t){return""!==t})}},{key:"tagName",get:function(){return this.nodeName}},{key:"children",get:function(){return this.childNodes}},{key:"childElementCount",get:function(){return this.childNodes.length}},{key:"firstElementChild",get:function(){return this.firstChild}},{key:"lastElementChild",get:function(){return this.lastChild}},{key:"parentElement",get:function(){return this.parentNode}},{key:"nextSibling",get:function(){var t;return this.parentNode&&(t=this.parentNode.childNodes.indexOf(this),this.parentNode.childNodes[t+1])||null}},{key:"previousSibling",get:function(){var t;return this.parentNode&&(t=this.parentNode.childNodes.indexOf(this),this.parentNode.childNodes[t-1])||null}}]),t}(Wa),qa=function(i){function t(){for(var t,e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];return(t=i.call.apply(i,[this].concat(n))||this).altKey=void 0,t.button=void 0,t.buttons=void 0,t.ctrlKey=void 0,t.metaKey=void 0,t.relatedTarget=void 0,t.shiftKey=void 0,t.client=new Ra,t.movement=new Ra,t.offset=new Ra,t.global=new Ra,t.screen=new Ra,t}er(t,i);var e=t.prototype;return e.getModifierState=function(t){return"getModifierState"in this.nativeEvent&&this.nativeEvent.getModifierState(t)},e.initMouseEvent=function(){throw new Error(Hr)},tr(t,[{key:"clientX",get:function(){return this.client.x}},{key:"clientY",get:function(){return this.client.y}},{key:"movementX",get:function(){return this.movement.x}},{key:"movementY",get:function(){return this.movement.y}},{key:"offsetX",get:function(){return this.offset.x}},{key:"offsetY",get:function(){return this.offset.y}},{key:"globalX",get:function(){return this.global.x}},{key:"globalY",get:function(){return this.global.y}},{key:"screenX",get:function(){return this.screen.x}},{key:"screenY",get:function(){return this.screen.y}}]),t}(Ua),$a=function(i){function t(){for(var t,e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];return(t=i.call.apply(i,[this].concat(n))||this).pointerId=void 0,t.width=0,t.height=0,t.isPrimary=!1,t.pointerType=void 0,t.pressure=void 0,t.tangentialPressure=void 0,t.tiltX=void 0,t.tiltY=void 0,t.twist=void 0,t}er(t,i);var e=t.prototype;return e.getCoalescedEvents=function(){return"pointermove"===this.type||"mousemove"===this.type||"touchmove"===this.type?[this]:[]},e.getPredictedEvents=function(){throw new Error("getPredictedEvents is not supported!")},e.clone=function(){return this.manager.clonePointerEvent(this)},t}(qa),Za=function(i){function t(){for(var t,e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];return(t=i.call.apply(i,[this].concat(n))||this).deltaMode=void 0,t.deltaX=void 0,t.deltaY=void 0,t.deltaZ=void 0,t.DOM_DELTA_LINE=0,t.DOM_DELTA_PAGE=1,t.DOM_DELTA_PIXEL=2,t}return er(t,i),t.prototype.clone=function(){return this.manager.cloneWheelEvent(this)},t}(qa);function ut(t){return null!=t&&t.nodeName}var Qa,Ja,ts,es=new ja(v.ATTR_MODIFIED,null,null,null,null,ja.MODIFICATION,null,null),ns={anchor:"",opacity:"",fillOpacity:"",strokeOpacity:"",fill:"",stroke:"",transform:"",transformOrigin:"",visibility:"",pointerEvents:"",lineWidth:"",lineCap:"",lineJoin:"",increasedLineWidthForHitTesting:"",fontSize:"",fontFamily:"",fontStyle:"",fontWeight:"",fontVariant:"",textAlign:"",textBaseline:"",textTransform:"",zIndex:"",filter:"",shadowType:""},rs={anchor:[0,0],fill:Or,stroke:Or,transform:[],zIndex:0,filter:[],shadowType:"outer",miterLimit:10},is=d({},rs,{opacity:1,fillOpacity:1,strokeOpacity:1,visibility:"visible",pointerEvents:"auto",lineWidth:1,lineCap:"butt",lineJoin:"miter",increasedLineWidthForHitTesting:0,fillRule:"nonzero"}),os=[].concat(["opacity","fillOpacity","strokeOpacity","transformOrigin","visibility","pointerEvents","lineWidth","lineCap","lineJoin","increasedLineWidthForHitTesting"],["fontSize","fontFamily","fontStyle","fontWeight","fontVariant","textAlign","textBaseline","textTransform"]),as=function(i){function t(t){var r=i.call(this)||this,t=(r.config=void 0,r.isCustomElement=!1,r.isMutationObserved=!1,r.activeAnimations=[],r.dataset=void 0,r.getClip=function(){return this.style.clipPath||null},r.config=t,r.config.interactive=null!=(t=r.config.capture)?t:r.config.interactive,r.id=r.config.id||"",r.name=r.config.name||"",(r.config.className||r.config.class)&&(r.className=r.config.className||r.config.class),r.nodeName=r.config.type||lt.GROUP,r.config.style=r.config.style||r.config.attrs||{},Object.assign(r.config.style,r.config.attrs),null!=r.config.visible&&(r.config.style.visibility=!1===r.config.visible?"hidden":"visible"),null!=r.config.interactive&&(r.config.style.pointerEvents=!1===r.config.interactive?"none":"auto"),Object.assign(r.parsedStyle,ct.enableCSSParsing?rs:is,r.config.initialParsedStyle),ct.enableCSSParsing&&Object.assign(r.attributes,ns),r.initAttributes(r.config.style),ct.globalThis.Proxy||function(){});return ct.enableDataset&&(r.dataset=new t({},{get:function(t,e){e="data-"+yr(e);return void 0!==t[e]?t[e]:r.getAttribute(e)},set:function(t,e,n){return r.setAttribute("data-"+yr(e),n),!0}})),ct.enableStyleSyntax&&(r.style=new t({setProperty:function(t,e){r.setAttribute(t,e)},getPropertyValue:function(t){return r.getAttribute(t)},removeProperty:function(t){r.removeAttribute(t)},item:function(){return""}},{get:function(t,e){return void 0!==t[e]?t[e]:r.getAttribute(e)},set:function(t,e,n){return r.setAttribute(e,n),!0}})),r}er(t,i);var e=t.prototype;return e.destroy=function(){i.prototype.destroy.call(this),this.getAnimations().forEach(function(t){t.cancel()})},e.cloneNode=function(e,t){var n,r=d({},this.attributes);for(n in r){var i=r[n];ut(i)&&"clipPath"!==n&&"offsetPath"!==n&&"textPath"!==n&&(r[n]=i.cloneNode(e)),t&&(r[n]=t(n,i))}var o=new this.constructor({id:this.id,name:this.name,className:this.name,interactive:this.interactive,style:r});return o.setLocalTransform(this.getLocalTransform()),e&&this.children.forEach(function(t){t.style.isMarker||(t=t.cloneNode(e),o.appendChild(t))}),o},e.initAttributes=function(t){void 0===t&&(t={});var e,n=this.renderable,r={forceUpdateGeometry:!0},i=(ct.enableCSSParsing&&(r.usedAttributes=os),{});for(e in t)i[wr(e)]=t[e];ct.styleValueRegistry.processProperties(this,i,r),n.dirty=!0},e.setAttribute=function(t,e,n){void 0===n&&(n=!1);t=wr(t);je(e)||!n&&e===this.attributes[t]||(this.internalSetAttribute(t,e),i.prototype.setAttribute.call(this,t,e))},e.internalSetAttribute=function(t,e,n){void 0===n&&(n={});var r=this.renderable,i=this.attributes[t],o=this.parsedStyle[t],a=(ct.styleValueRegistry.processProperties(this,((a={})[t]=e,a),n),r.dirty=!0,this.parsedStyle[t]);this.isConnected&&(es.relatedNode=this,es.prevValue=i,es.newValue=e,es.attrName=t,es.prevParsedValue=o,es.newParsedValue=a,this.isMutationObserved?this.dispatchEvent(es):(es.target=this).ownerDocument.defaultView.dispatchEvent(es,!0)),(this.isCustomElement&&this.isConnected||!this.isCustomElement)&&this.attributeChangedCallback&&this.attributeChangedCallback(t,i,e,o,a)},e.getBBox=function(){var t=this.getBounds(),e=t.getMin(),n=e[0],e=e[1],t=t.getMax(),r=t[0],t=t[1];return new Na(n,e,r-n,t-e)},e.setOrigin=function(t,e,n){return ct.sceneGraphService.setOrigin(this,Jr(t,e=void 0===e?0:e,n=void 0===n?0:n)),this},e.getOrigin=function(){return ct.sceneGraphService.getOrigin(this)},e.setPosition=function(t,e,n){return ct.sceneGraphService.setPosition(this,Jr(t,e=void 0===e?0:e,n=void 0===n?0:n)),this},e.setLocalPosition=function(t,e,n){return ct.sceneGraphService.setLocalPosition(this,Jr(t,e=void 0===e?0:e,n=void 0===n?0:n)),this},e.translate=function(t,e,n){return ct.sceneGraphService.translate(this,Jr(t,e=void 0===e?0:e,n=void 0===n?0:n)),this},e.translateLocal=function(t,e,n){return ct.sceneGraphService.translateLocal(this,Jr(t,e=void 0===e?0:e,n=void 0===n?0:n)),this},e.getPosition=function(){return ct.sceneGraphService.getPosition(this)},e.getLocalPosition=function(){return ct.sceneGraphService.getLocalPosition(this)},e.scale=function(t,e,n){return this.scaleLocal(t,e,n)},e.scaleLocal=function(t,e,n){return"number"==typeof t&&(t=Jr(t,e=e||t,n=n||t)),ct.sceneGraphService.scaleLocal(this,t),this},e.setLocalScale=function(t,e,n){return"number"==typeof t&&(t=Jr(t,e=e||t,n=n||t)),ct.sceneGraphService.setLocalScale(this,t),this},e.getLocalScale=function(){return ct.sceneGraphService.getLocalScale(this)},e.getScale=function(){return ct.sceneGraphService.getScale(this)},e.getEulerAngles=function(){return ei(ni(y(),ct.sceneGraphService.getWorldTransform(this))[2])},e.getLocalEulerAngles=function(){return ei(ni(y(),ct.sceneGraphService.getLocalRotation(this))[2])},e.setEulerAngles=function(t){return ct.sceneGraphService.setEulerAngles(this,0,0,t),this},e.setLocalEulerAngles=function(t){return ct.sceneGraphService.setLocalEulerAngles(this,0,0,t),this},e.rotateLocal=function(t,e,n){return M(e)&&M(n)?ct.sceneGraphService.rotateLocal(this,0,0,t):ct.sceneGraphService.rotateLocal(this,t,e,n),this},e.rotate=function(t,e,n){return M(e)&&M(n)?ct.sceneGraphService.rotate(this,0,0,t):ct.sceneGraphService.rotate(this,t,e,n),this},e.setRotation=function(t,e,n,r){return ct.sceneGraphService.setRotation(this,t,e,n,r),this},e.setLocalRotation=function(t,e,n,r){return ct.sceneGraphService.setLocalRotation(this,t,e,n,r),this},e.setLocalSkew=function(t,e){return ct.sceneGraphService.setLocalSkew(this,t,e),this},e.getRotation=function(){return ct.sceneGraphService.getRotation(this)},e.getLocalRotation=function(){return ct.sceneGraphService.getLocalRotation(this)},e.getLocalSkew=function(){return ct.sceneGraphService.getLocalSkew(this)},e.getLocalTransform=function(){return ct.sceneGraphService.getLocalTransform(this)},e.getWorldTransform=function(){return ct.sceneGraphService.getWorldTransform(this)},e.setLocalTransform=function(t){return ct.sceneGraphService.setLocalTransform(this,t),this},e.resetLocalTransform=function(){ct.sceneGraphService.resetLocalTransform(this)},e.getAnimations=function(){return this.activeAnimations},e.animate=function(t,e){var n=null==(n=this.ownerDocument)?void 0:n.timeline;return n?n.play(this,t,e):null},e.isVisible=function(){var t;return"visible"===(null==(t=this.parsedStyle)?void 0:t.visibility)},e.isInteractive=function(){var t;return"none"!==(null==(t=this.parsedStyle)?void 0:t.pointerEvents)},e.isCulled=function(){return!(!this.cullable||!this.cullable.enable||this.cullable.visible)},e.toFront=function(){return this.parentNode&&(this.style.zIndex=Math.max.apply(Math,this.parentNode.children.map(function(t){return Number(t.style.zIndex)}))+1),this},e.toBack=function(){return this.parentNode&&(this.style.zIndex=Math.min.apply(Math,this.parentNode.children.map(function(t){return Number(t.style.zIndex)}))-1),this},e.getConfig=function(){return this.config},e.attr=function(){for(var e=this,t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];var i=n[0],o=n[1];return i?Ie(i)?(Object.keys(i).forEach(function(t){e.setAttribute(t,i[t])}),this):2===n.length?(this.setAttribute(i,o),this):this.attributes[i]:this.attributes},e.getMatrix=function(t){var t=t||this.getWorldTransform(),e=pt(y(),t),n=e[0],e=e[1],r=gt(y(),t),i=r[0],r=r[1],t=mt(zt(),t),t=ni(y(),t),o=t[0],t=t[2];return ri(o||t,n,e,i,r)},e.getLocalMatrix=function(){return this.getMatrix(this.getLocalTransform())},e.setMatrix=function(t){var t=ii(t),e=t[0],n=t[1],r=t[2],i=t[3],t=t[4];this.setEulerAngles(t).setPosition(e,n).setLocalScale(r,i)},e.setLocalMatrix=function(t){var t=ii(t),e=t[0],n=t[1],r=t[2],i=t[3],t=t[4];this.setLocalEulerAngles(t).setLocalPosition(e,n).setLocalScale(r,i)},e.show=function(){ct.enableCSSParsing?this.style.visibility="visible":this.forEach(function(t){t.style.visibility="visible"})},e.hide=function(){ct.enableCSSParsing?this.style.visibility="hidden":this.forEach(function(t){t.style.visibility="hidden"})},e.getCount=function(){return this.childElementCount},e.getParent=function(){return this.parentElement},e.getChildren=function(){return this.children},e.getFirst=function(){return this.firstElementChild},e.getLast=function(){return this.lastElementChild},e.getChildByIndex=function(t){return this.children[t]||null},e.add=function(t,e){return this.appendChild(t,e)},e.setClip=function(t){this.style.clipPath=t},e.set=function(t,e){this.config[t]=e},e.get=function(t){return this.config[t]},e.moveTo=function(t,e,n){return this.setPosition(t,e=void 0===e?0:e,n=void 0===n?0:n),this},e.move=function(t,e,n){return this.setPosition(t,e=void 0===e?0:e,n=void 0===n?0:n),this},e.setZIndex=function(t){return this.style.zIndex=t,this},tr(t,[{key:"interactive",get:function(){return this.isInteractive()},set:function(t){this.style.pointerEvents=t?"auto":"none"}}]),t}(Ka),ss=["style"],ls=function(n){function t(t){var t=void 0===t?{}:t,e=t.style,t=rr(t,ss);return n.call(this,d({type:lt.CIRCLE,style:ct.enableCSSParsing?d({cx:"",cy:"",r:""},e):d({},e),initialParsedStyle:{anchor:[.5,.5],transformOrigin:ct.enableCSSParsing?null:[Dr,Dr]}},t))||this}return er(t,n),t}(as),us=["style"],qa=function(n){function t(t){var t=void 0===t?{}:t,e=t.style,t=rr(t,us),e=n.call(this,d({style:ct.enableCSSParsing?d({x:"",y:""},e):d({},e)},t))||this;return e.isCustomElement=!0,e}return er(t,n),t}(as),cs=["style"],hs=function(n){function t(t){var t=void 0===t?{}:t,e=t.style,t=rr(t,cs);return n.call(this,d({type:lt.ELLIPSE,style:ct.enableCSSParsing?d({cx:"",cy:"",rx:"",ry:""},e):d({},e),initialParsedStyle:{anchor:[.5,.5],transformOrigin:ct.enableCSSParsing?null:[Dr,Dr]}},t))||this}return er(t,n),t}(as),ds=["style"],fs=function(n){function t(t){var t=void 0===t?{}:t,e=t.style,t=rr(t,ds);return n.call(this,d({type:lt.GROUP,style:ct.enableCSSParsing?d({x:"",y:"",width:"",height:""},e):d({},e)},t))||this}return er(t,n),t}(as),ps=["style"],gs=function(n){function t(t){var t=void 0===t?{}:t,e=t.style,t=rr(t,ps),e=n.call(this,d({type:lt.HTML,style:ct.enableCSSParsing?d({x:"",y:"",width:"auto",height:"auto",innerHTML:""},e):d({},e)},t))||this;return e.cullable.enable=!1,e}er(t,n);var e=t.prototype;return e.getDomElement=function(){return this.parsedStyle.$el},e.getBoundingClientRect=function(){return this.parsedStyle.$el.getBoundingClientRect()},e.getClientRects=function(){return[this.getBoundingClientRect()]},e.getBounds=function(){var t,e,n=this.getBoundingClientRect(),r=null==(r=this.ownerDocument)||null==(r=r.defaultView)?void 0:r.getContextService().getBoundingClientRect();return r?(t=n.left-r.left,r=n.top-r.top,(e=new Ta).setMinMax([t,r,0],[t+n.width,r+n.height,0]),e):null},e.getLocalBounds=function(){if(this.parentNode){var t,e=et(K(),this.parentNode.getWorldTransform()),n=this.getBounds();if(!Ta.isEmpty(n))return(t=new Ta).setFromTransformedAABB(n,e),t}return this.getBounds()},t}(as),ms=["style"],vs=function(n){function t(t){var t=void 0===t?{}:t,e=t.style,t=rr(t,ms);return n.call(this,d({type:lt.IMAGE,style:ct.enableCSSParsing?d({x:"",y:"",img:"",width:"",height:""},e):d({},e)},t))||this}return er(t,n),t}(as),ys=["style"],Es=function(r){function t(t){var t=void 0===t?{}:t,e=t.style,t=rr(t,ys),e=r.call(this,d({type:lt.LINE,style:d({x1:0,y1:0,x2:0,y2:0,z1:0,z2:0,isBillboard:!1},e)},t))||this,t=(e.markerStartAngle=0,e.markerEndAngle=0,e.parsedStyle),n=t.markerStart,t=t.markerEnd;return n&&ut(n)&&(e.markerStartAngle=n.getLocalEulerAngles(),e.appendChild(n)),t&&ut(t)&&(e.markerEndAngle=t.getLocalEulerAngles(),e.appendChild(t)),e.transformMarker(!0),e.transformMarker(!1),e}er(t,r);var e=t.prototype;return e.attributeChangedCallback=function(t,e,n,r,i){"x1"===t||"y1"===t||"x2"===t||"y2"===t||"markerStartOffset"===t||"markerEndOffset"===t?(this.transformMarker(!0),this.transformMarker(!1)):"markerStart"===t?(r&&ut(r)&&(this.markerStartAngle=0,r.remove()),i&&ut(i)&&(this.markerStartAngle=i.getLocalEulerAngles(),this.appendChild(i),this.transformMarker(!0))):"markerEnd"===t&&(r&&ut(r)&&(this.markerEndAngle=0,r.remove()),i)&&ut(i)&&(this.markerEndAngle=i.getLocalEulerAngles(),this.appendChild(i),this.transformMarker(!1))},e.transformMarker=function(t){var e,n,r,i,o,a=this.parsedStyle,s=a.markerStart,l=a.markerEnd,u=a.markerStartOffset,c=a.markerEndOffset,h=a.x1,d=a.x2,f=a.y1,p=a.y2,g=a.defX,a=a.defY,s=t?s:l;s&&ut(s)&&(l=0,t=t?(r=h-g,i=f-a,e=d-h,n=p-f,o=u||0,this.markerStartAngle):(r=d-g,i=p-a,e=h-d,n=f-p,o=c||0,this.markerEndAngle),l=Math.atan2(n,e),s.setLocalEulerAngles(180*l/Math.PI+t),s.setLocalPosition(r+Math.cos(l)*o,i+Math.sin(l)*o))},e.getPoint=function(t,e){void 0===e&&(e=!1);var n=this.parsedStyle,r=n.x1,i=n.y1,o=n.x2,a=n.y2,s=n.defX,n=n.defY,r=xn.pointAt(r,i,o,a,t),i=r.x,o=r.y,a=Bt(y(),x(i-s,o-n,0),e?this.getWorldTransform():this.getLocalTransform());return new Ra(a[0],a[1])},e.getPointAtLength=function(t,e){return void 0===e&&(e=!1),this.getPoint(t/this.getTotalLength(),e)},e.getTotalLength=function(){var t=this.parsedStyle,e=t.x1,n=t.y1,r=t.x2,t=t.y2;return xn.length(e,n,r,t)},t}(as),_s=["style"],bs={absolutePath:[],hasArc:!1,segments:[],polygons:[],polylines:[],curve:null,totalLength:0,rect:new Na(0,0,0,0)},xs=function(i){function t(t){var t=void 0===t?{}:t,e=t.style,t=rr(t,_s),e=i.call(this,d({type:lt.PATH,style:ct.enableCSSParsing?d({path:"",miterLimit:""},e):d({},e),initialParsedStyle:ct.enableCSSParsing?null:{miterLimit:4,path:d({},bs)}},t))||this,t=(e.markerStartAngle=0,e.markerEndAngle=0,e.markerMidList=[],e.parsedStyle),n=t.markerStart,r=t.markerEnd,t=t.markerMid;return n&&ut(n)&&(e.markerStartAngle=n.getLocalEulerAngles(),e.appendChild(n)),t&&ut(t)&&e.placeMarkerMid(t),r&&ut(r)&&(e.markerEndAngle=r.getLocalEulerAngles(),e.appendChild(r)),e.transformMarker(!0),e.transformMarker(!1),e}er(t,i);var e=t.prototype;return e.attributeChangedCallback=function(t,e,n,r,i){"path"===t?(this.transformMarker(!0),this.transformMarker(!1),this.placeMarkerMid(this.parsedStyle.markerMid)):"markerStartOffset"===t||"markerEndOffset"===t?(this.transformMarker(!0),this.transformMarker(!1)):"markerStart"===t?(r&&ut(r)&&(this.markerStartAngle=0,r.remove()),i&&ut(i)&&(this.markerStartAngle=i.getLocalEulerAngles(),this.appendChild(i),this.transformMarker(!0))):"markerEnd"===t?(r&&ut(r)&&(this.markerEndAngle=0,r.remove()),i&&ut(i)&&(this.markerEndAngle=i.getLocalEulerAngles(),this.appendChild(i),this.transformMarker(!1))):"markerMid"===t&&this.placeMarkerMid(i)},e.transformMarker=function(t){var e,n,r,i,o,a=this.parsedStyle,s=a.markerStart,l=a.markerEnd,u=a.markerStartOffset,c=a.markerEndOffset,h=a.defX,a=a.defY,s=t?s:l;s&&ut(s)&&(l=0,h=t?(i=(t=this.getStartTangent())[0],e=(t=t[1])[0]-h,n=t[1]-a,r=i[0]-t[0],i=i[1]-t[1],o=u||0,this.markerStartAngle):(u=(t=this.getEndTangent())[0],e=(t=t[1])[0]-h,n=t[1]-a,r=u[0]-t[0],i=u[1]-t[1],o=c||0,this.markerEndAngle),l=Math.atan2(i,r),s.setLocalEulerAngles(180*l/Math.PI+h),s.setLocalPosition(e+Math.cos(l)*o,n+Math.sin(l)*o))},e.placeMarkerMid=function(t){var e=this.parsedStyle,n=e.path.segments,r=e.defX,i=e.defY;if(this.markerMidList.forEach(function(t){t.remove()}),t&&ut(t))for(var o=1;o<n.length-1;o++){var a=n[o].currentPoint,s=a[0],a=a[1],l=1===o?t:t.cloneNode(!0);this.markerMidList.push(l),this.appendChild(l),l.setLocalPosition(s-r,a-i)}},e.getTotalLength=function(){return Fi(this)},e.getPointAtLength=function(t,e){void 0===e&&(e=!1);var n=this.parsedStyle,r=n.defX,i=n.defY,n=Ae(n.path.absolutePath,t,k(k({},o),{bbox:!1,length:!0})).point,t=n.x,o=n.y,n=Bt(y(),x(t-r,o-i,0),e?this.getWorldTransform():this.getLocalTransform());return new Ra(n[0],n[1])},e.getPoint=function(t,e){return void 0===e&&(e=!1),this.getPointAtLength(t*Fi(this),e)},e.getStartTangent=function(){var t,e,n=this.parsedStyle.path.segments,r=[];return 1<n.length&&(t=n[0].currentPoint,e=n[1].currentPoint,r=[],(n=n[1].startTangent)?r.push([t[0]-n[0],t[1]-n[1]]):r.push([e[0],e[1]]),r.push([t[0],t[1]])),r},e.getEndTangent=function(){var t,e,n=this.parsedStyle.path.segments,r=n.length,i=[];return 1<r&&(t=n[r-2].currentPoint,e=n[r-1].currentPoint,i=[],(n=n[r-1].endTangent)?i.push([e[0]-n[0],e[1]-n[1]]):i.push([t[0],t[1]]),i.push([e[0],e[1]])),i},t}(as),Ss=["style"],ws=function(i){function t(t){var t=void 0===t?{}:t,e=t.style,t=rr(t,Ss),e=i.call(this,d({type:lt.POLYGON,style:ct.enableCSSParsing?d({points:"",miterLimit:"",isClosed:!0},e):d({},e),initialParsedStyle:ct.enableCSSParsing?null:{points:{points:[],totalLength:0,segments:[]},miterLimit:4,isClosed:!0}},t))||this,t=(e.markerStartAngle=0,e.markerEndAngle=0,e.markerMidList=[],e.parsedStyle),n=t.markerStart,r=t.markerEnd,t=t.markerMid;return n&&ut(n)&&(e.markerStartAngle=n.getLocalEulerAngles(),e.appendChild(n)),t&&ut(t)&&e.placeMarkerMid(t),r&&ut(r)&&(e.markerEndAngle=r.getLocalEulerAngles(),e.appendChild(r)),e.transformMarker(!0),e.transformMarker(!1),e}er(t,i);var e=t.prototype;return e.attributeChangedCallback=function(t,e,n,r,i){"points"===t?(this.transformMarker(!0),this.transformMarker(!1),this.placeMarkerMid(this.parsedStyle.markerMid)):"markerStartOffset"===t||"markerEndOffset"===t?(this.transformMarker(!0),this.transformMarker(!1)):"markerStart"===t?(r&&ut(r)&&(this.markerStartAngle=0,r.remove()),i&&ut(i)&&(this.markerStartAngle=i.getLocalEulerAngles(),this.appendChild(i),this.transformMarker(!0))):"markerEnd"===t?(r&&ut(r)&&(this.markerEndAngle=0,r.remove()),i&&ut(i)&&(this.markerEndAngle=i.getLocalEulerAngles(),this.appendChild(i),this.transformMarker(!1))):"markerMid"===t&&this.placeMarkerMid(i)},e.transformMarker=function(t){var e,n,r,i,o,a=this.parsedStyle,s=a.markerStart,l=a.markerEnd,u=a.markerStartOffset,c=a.markerEndOffset,h=a.points.points,d=a.defX,a=a.defY,s=t?s:l;s&&ut(s)&&(i=h[l=0][0]-d,o=h[0][1]-a,u=t?(e=h[1][0]-h[0][0],n=h[1][1]-h[0][1],r=u||0,this.markerStartAngle):(t=h.length,n=this.parsedStyle.isClosed?(e=h[t-1][0]-h[0][0],h[t-1][1]-h[0][1]):(i=h[t-1][0]-d,o=h[t-1][1]-a,e=h[t-2][0]-h[t-1][0],h[t-2][1]-h[t-1][1]),r=c||0,this.markerEndAngle),l=Math.atan2(n,e),s.setLocalEulerAngles(180*l/Math.PI+u),s.setLocalPosition(i+Math.cos(l)*r,o+Math.sin(l)*r))},e.placeMarkerMid=function(t){var e=this.parsedStyle,n=e.points.points,r=e.defX,i=e.defY;if(this.markerMidList.forEach(function(t){t.remove()}),this.markerMidList=[],t&&ut(t))for(var o=1;o<(this.parsedStyle.isClosed?n.length:n.length-1);o++){var a=n[o][0]-r,s=n[o][1]-i,l=1===o?t:t.cloneNode(!0);this.markerMidList.push(l),this.appendChild(l),l.setLocalPosition(a,s)}},t}(as),Ts=["style"],As=function(n){function t(t){var t=void 0===t?{}:t,e=t.style,t=rr(t,Ts);return n.call(this,d({type:lt.POLYLINE,style:ct.enableCSSParsing?d({points:"",miterLimit:"",isClosed:!1},e):d({},e),initialParsedStyle:ct.enableCSSParsing?null:{points:{points:[],totalLength:0,segments:[]},miterLimit:4,isClosed:!1}},t))||this}er(t,n);var e=t.prototype;return e.getTotalLength=function(){return this.parsedStyle.points.totalLength},e.getPointAtLength=function(t,e){return void 0===e&&(e=!1),this.getPoint(t/this.getTotalLength(),e)},e.getPoint=function(n,t){void 0===t&&(t=!1);var e=this.parsedStyle,r=e.defX,i=e.defY,e=e.points,o=e.points,e=e.segments,a=0,s=0,e=(e.forEach(function(t,e){n>=t[0]&&n<=t[1]&&(a=(n-t[0])/(t[1]-t[0]),s=e)}),xn.pointAt(o[s][0],o[s][1],o[s+1][0],o[s+1][1],a)),o=e.x,e=e.y,o=Bt(y(),x(o-r,e-i,0),t?this.getWorldTransform():this.getLocalTransform());return new Ra(o[0],o[1])},e.getStartTangent=function(){var t=this.parsedStyle.points.points,e=[];return e.push([t[1][0],t[1][1]]),e.push([t[0][0],t[0][1]]),e},e.getEndTangent=function(){var t=this.parsedStyle.points.points,e=t.length-1,n=[];return n.push([t[e-1][0],t[e-1][1]]),n.push([t[e][0],t[e][1]]),n},t}(ws),Ms=["style"],Rs=function(n){function t(t){var t=void 0===t?{}:t,e=t.style,t=rr(t,Ms);return n.call(this,d({type:lt.RECT,style:ct.enableCSSParsing?d({x:"",y:"",width:"",height:"",radius:""},e):d({},e)},t))||this}return er(t,n),t}(as),Ns=["style"],Cs=function(n){function t(t){var t=void 0===t?{}:t,e=t.style,t=rr(t,Ns);return n.call(this,d({type:lt.TEXT,style:ct.enableCSSParsing?d({x:"",y:"",text:"",fontSize:"",fontFamily:"",fontStyle:"",fontWeight:"",fontVariant:"",textAlign:"",textBaseline:"",textTransform:"",fill:"black",letterSpacing:"",lineHeight:"",miterLimit:"",wordWrap:!1,wordWrapWidth:0,leading:0,dx:"",dy:"",isBillboard:!1,sizeAttenuation:!0},e):d({fill:"black"},e),initialParsedStyle:ct.enableCSSParsing?{}:{x:0,y:0,fontSize:16,fontFamily:"sans-serif",fontStyle:"normal",fontWeight:"normal",fontVariant:"normal",lineHeight:0,letterSpacing:0,textBaseline:"alphabetic",textAlign:"start",wordWrap:!1,wordWrapWidth:0,leading:0,dx:0,dy:0,isBillboard:!1,sizeAttenuation:!0}},t))||this}er(t,n);var e=t.prototype;return e.getComputedTextLength=function(){var t;return(null==(t=this.parsedStyle.metrics)?void 0:t.maxLineWidth)||0},e.getLineBoundingRects=function(){var t;return(null==(t=this.parsedStyle.metrics)?void 0:t.lineMetrics)||[]},e.isOverflowing=function(){return!!this.parsedStyle.isOverflowing},t}(as),Ps=[{n:"display",k:["none"]},{n:"opacity",int:!0,inh:!0,d:"1",syntax:b.OPACITY_VALUE},{n:"fillOpacity",int:!0,inh:!0,d:"1",syntax:b.OPACITY_VALUE},{n:"strokeOpacity",int:!0,inh:!0,d:"1",syntax:b.OPACITY_VALUE},{n:"fill",int:!0,k:["none"],d:"none",syntax:b.PAINT},{n:"fillRule",k:["nonzero","evenodd"],d:"nonzero"},{n:"stroke",int:!0,k:["none"],d:"none",syntax:b.PAINT,l:!0},{n:"shadowType",k:["inner","outer","both"],d:"outer",l:!0},{n:"shadowColor",int:!0,syntax:b.COLOR},{n:"shadowOffsetX",int:!0,l:!0,d:"0",syntax:b.LENGTH_PERCENTAGE},{n:"shadowOffsetY",int:!0,l:!0,d:"0",syntax:b.LENGTH_PERCENTAGE},{n:"shadowBlur",int:!0,l:!0,d:"0",syntax:b.SHADOW_BLUR},{n:"lineWidth",int:!0,inh:!0,d:"1",l:!0,a:["strokeWidth"],syntax:b.LENGTH_PERCENTAGE},{n:"increasedLineWidthForHitTesting",inh:!0,d:"0",l:!0,syntax:b.LENGTH_PERCENTAGE},{n:"lineJoin",inh:!0,l:!0,a:["strokeLinejoin"],k:["miter","bevel","round"],d:"miter"},{n:"lineCap",inh:!0,l:!0,a:["strokeLinecap"],k:["butt","round","square"],d:"butt"},{n:"lineDash",int:!0,inh:!0,k:["none"],a:["strokeDasharray"],syntax:b.LENGTH_PERCENTAGE_12},{n:"lineDashOffset",int:!0,inh:!0,d:"0",a:["strokeDashoffset"],syntax:b.LENGTH_PERCENTAGE},{n:"offsetPath",syntax:b.DEFINED_PATH},{n:"offsetDistance",int:!0,syntax:b.OFFSET_DISTANCE},{n:"dx",int:!0,l:!0,d:"0",syntax:b.LENGTH_PERCENTAGE},{n:"dy",int:!0,l:!0,d:"0",syntax:b.LENGTH_PERCENTAGE},{n:"zIndex",ind:!0,int:!0,d:"0",k:["auto"],syntax:b.Z_INDEX},{n:"visibility",k:["visible","hidden"],ind:!0,inh:!0,int:!0,d:"visible"},{n:"pointerEvents",inh:!0,k:["none","auto","stroke","fill","painted","visible","visiblestroke","visiblefill","visiblepainted","all"],d:"auto"},{n:"filter",ind:!0,l:!0,k:["none"],d:"none",syntax:b.FILTER},{n:"clipPath",syntax:b.DEFINED_PATH},{n:"textPath",syntax:b.DEFINED_PATH},{n:"textPathSide",k:["left","right"],d:"left"},{n:"textPathStartOffset",l:!0,d:"0",syntax:b.LENGTH_PERCENTAGE},{n:"transform",p:100,int:!0,k:["none"],d:"none",syntax:b.TRANSFORM},{n:"transformOrigin",p:100,d:function(t){return t===lt.CIRCLE||t===lt.ELLIPSE?"center":t===lt.TEXT?"text-anchor":"left top"},l:!0,syntax:b.TRANSFORM_ORIGIN},{n:"anchor",p:99,d:function(t){return t===lt.CIRCLE||t===lt.ELLIPSE?"0.5 0.5":"0 0"},l:!0,syntax:b.LENGTH_PERCENTAGE_12},{n:"cx",int:!0,d:"0",syntax:b.COORDINATE},{n:"cy",int:!0,d:"0",syntax:b.COORDINATE},{n:"cz",int:!0,d:"0",syntax:b.COORDINATE},{n:"r",int:!0,l:!0,d:"0",syntax:b.LENGTH_PERCENTAGE},{n:"rx",int:!0,l:!0,d:"0",syntax:b.LENGTH_PERCENTAGE},{n:"ry",int:!0,l:!0,d:"0",syntax:b.LENGTH_PERCENTAGE},{n:"x",int:!0,d:"0",syntax:b.COORDINATE},{n:"y",int:!0,d:"0",syntax:b.COORDINATE},{n:"z",int:!0,d:"0",syntax:b.COORDINATE},{n:"width",int:!0,l:!0,k:["auto","fit-content","min-content","max-content"],d:"0",syntax:b.LENGTH_PERCENTAGE},{n:"height",int:!0,l:!0,k:["auto","fit-content","min-content","max-content"],d:"0",syntax:b.LENGTH_PERCENTAGE},{n:"radius",int:!0,l:!0,d:"0",syntax:b.LENGTH_PERCENTAGE_14},{n:"x1",int:!0,l:!0,syntax:b.COORDINATE},{n:"y1",int:!0,l:!0,syntax:b.COORDINATE},{n:"z1",int:!0,l:!0,syntax:b.COORDINATE},{n:"x2",int:!0,l:!0,syntax:b.COORDINATE},{n:"y2",int:!0,l:!0,syntax:b.COORDINATE},{n:"z2",int:!0,l:!0,syntax:b.COORDINATE},{n:"path",int:!0,l:!0,d:"",a:["d"],syntax:b.PATH,p:50},{n:"points",int:!0,l:!0,syntax:b.LIST_OF_POINTS,p:50},{n:"text",l:!0,d:"",syntax:b.TEXT,p:50},{n:"textTransform",l:!0,inh:!0,k:["capitalize","uppercase","lowercase","none"],d:"none",syntax:b.TEXT_TRANSFORM,p:51},{n:"font",l:!0},{n:"fontSize",int:!0,inh:!0,d:"16px",l:!0,syntax:b.LENGTH_PERCENTAGE},{n:"fontFamily",l:!0,inh:!0,d:"sans-serif"},{n:"fontStyle",l:!0,inh:!0,k:["normal","italic","oblique"],d:"normal"},{n:"fontWeight",l:!0,inh:!0,k:["normal","bold","bolder","lighter"],d:"normal"},{n:"fontVariant",l:!0,inh:!0,k:["normal","small-caps"],d:"normal"},{n:"lineHeight",l:!0,syntax:b.LENGTH,int:!0,d:"0"},{n:"letterSpacing",l:!0,syntax:b.LENGTH,int:!0,d:"0"},{n:"miterLimit",l:!0,syntax:b.NUMBER,d:function(t){return t===lt.PATH||t===lt.POLYGON||t===lt.POLYLINE?"4":"10"}},{n:"wordWrap",l:!0},{n:"wordWrapWidth",l:!0},{n:"maxLines",l:!0},{n:"textOverflow",l:!0,d:"clip"},{n:"leading",l:!0},{n:"textBaseline",l:!0,inh:!0,k:["top","hanging","middle","alphabetic","ideographic","bottom"],d:"alphabetic"},{n:"textAlign",l:!0,inh:!0,k:["start","center","middle","end","left","right"],d:"start"},{n:"markerStart",syntax:b.MARKER},{n:"markerEnd",syntax:b.MARKER},{n:"markerMid",syntax:b.MARKER},{n:"markerStartOffset",syntax:b.LENGTH,l:!0,int:!0,d:"0"},{n:"markerEndOffset",syntax:b.LENGTH,l:!0,int:!0,d:"0"}],Os=Ps.filter(function(t){return!!t.l}).map(function(t){return t.n}),Is={},Ls=new WeakMap,ks=function(){function t(){var e=this;Ps.forEach(function(t){e.registerMetadata(t)})}var e=t.prototype;return e.registerMetadata=function(e){[e.n].concat(e.a||[]).forEach(function(t){Is[t]=e})},e.unregisterMetadata=function(t){delete Is[t]},e.getPropertySyntax=function(t){return ct.CSSPropertySyntaxFactory[t]},e.processProperties=function(n,e,t){var r=this;if(void 0===t&&(t={skipUpdateAttribute:!1,skipParse:!1,forceUpdateGeometry:!1,usedAttributes:[]}),ct.enableCSSParsing){var i=t,o=i.skipUpdateAttribute,a=i.skipParse,s=i.forceUpdateGeometry,i=i.usedAttributes,l=s,u=Object.keys(e);u.forEach(function(t){o||(n.attributes[t]=e[t]),!l&&null!=(t=Is[t])&&t.l&&(l=!0)}),a||u.forEach(function(t){n.computedStyle[t]=r.parseProperty(t,n.attributes[t],n)}),(u=null!=i&&i.length?Array.from(new Set(u.concat(i))):u).forEach(function(t){t in n.computedStyle&&(n.parsedStyle[t]=r.computeProperty(t,n.computedStyle[t],n))}),l&&this.updateGeometry(n),u.forEach(function(t){t in n.parsedStyle&&r.postProcessProperty(t,n,u)}),ct.enableCSSParsing&&n.children.length&&u.forEach(function(e){e in n.parsedStyle&&r.isPropertyInheritable(e)&&n.children.forEach(function(t){t.internalSetAttribute(e,null,{skipUpdateAttribute:!0,skipParse:!0})})})}else{Object.assign(n.attributes,e);var s=Object.keys(e),a=n.parsedStyle.clipPath,i=n.parsedStyle.offsetPath,c=(n.parsedStyle=Object.assign(n.parsedStyle,e),!!t.forceUpdateGeometry);if(!c)for(var h=0;h<Os.length;h++)if(Os[h]in e){c=!0;break}e.fill&&(n.parsedStyle.fill=Ao(e.fill)),e.stroke&&(n.parsedStyle.stroke=Ao(e.stroke)),e.shadowColor&&(n.parsedStyle.shadowColor=Ao(e.shadowColor)),e.filter&&(n.parsedStyle.filter=Fo(e.filter)),M(e.radius)||(n.parsedStyle.radius=Io(e.radius,4)),M(e.lineDash)||(n.parsedStyle.lineDash=Io(e.lineDash,2)),e.points&&(n.parsedStyle.points=Ko(e.points,n)),""===e.path&&(n.parsedStyle.path=d({},bs)),e.path&&(n.parsedStyle.path=Xo(e.path,n)),e.textTransform&&ct.CSSPropertySyntaxFactory["<text-transform>"].calculator(null,null,{value:e.textTransform},n,null),e.clipPath&&ct.CSSPropertySyntaxFactory["<defined-path>"].calculator("clipPath",a,e.clipPath,n,this),e.offsetPath&&ct.CSSPropertySyntaxFactory["<defined-path>"].calculator("offsetPath",i,e.offsetPath,n,this),e.anchor&&(n.parsedStyle.anchor=Io(e.anchor,2)),e.transform&&(n.parsedStyle.transform=ta(e.transform)),e.transformOrigin&&(n.parsedStyle.transformOrigin=da(e.transformOrigin)),e.markerStart&&(n.parsedStyle.markerStart=ct.CSSPropertySyntaxFactory["<marker>"].calculator(null,e.markerStart,e.markerStart,null,null)),e.markerEnd&&(n.parsedStyle.markerEnd=ct.CSSPropertySyntaxFactory["<marker>"].calculator(null,e.markerEnd,e.markerEnd,null,null)),e.markerMid&&(n.parsedStyle.markerMid=ct.CSSPropertySyntaxFactory["<marker>"].calculator("",e.markerMid,e.markerMid,null,null)),(n.nodeName!==lt.CIRCLE&&n.nodeName!==lt.ELLIPSE||M(e.cx)&&M(e.cy))&&(n.nodeName!==lt.RECT&&n.nodeName!==lt.IMAGE&&n.nodeName!==lt.GROUP&&n.nodeName!==lt.HTML&&n.nodeName!==lt.TEXT&&n.nodeName!==lt.MESH||M(e.x)&&M(e.y)&&M(e.z))&&(n.nodeName!==lt.LINE||M(e.x1)&&M(e.y1)&&M(e.z1)&&M(e.x2)&&M(e.y2)&&M(e.z2))||ct.CSSPropertySyntaxFactory["<coordinate>"].postProcessor(n,s),M(e.zIndex)||ct.CSSPropertySyntaxFactory["<z-index>"].postProcessor(n,s),e.path&&ct.CSSPropertySyntaxFactory["<path>"].postProcessor(n,s),e.points&&ct.CSSPropertySyntaxFactory["<list-of-points>"].postProcessor(n,s),M(e.offsetDistance)||ct.CSSPropertySyntaxFactory["<offset-distance>"].postProcessor(n,s),e.transform&&ct.CSSPropertySyntaxFactory["<transform>"].postProcessor(n,s),c&&this.updateGeometry(n)}},e.parseProperty=function(t,e,n){var r,t=Is[t],i=e;return"unset"===(e=""!==e&&!M(e)?e:"unset")||"initial"===e||"inherit"===e?i=xr(e):t&&(r=t.k,t=(t=t.syntax)&&this.getPropertySyntax(t),r&&-1<r.indexOf(e)?i=xr(e):t&&t.parser&&(i=t.parser(e,n))),i},e.computeProperty=function(t,e,n){var r=Is[t],i="g-root"===n.id,o=e;if(r){var a=r.syntax,s=r.inh,r=r.d;if(e instanceof mr){var l=e.value;if("initial"===(l="unset"===l?s&&!i?"inherit":"initial":l))M(r)||(e=this.parseProperty(t,_r(r)?r(n.nodeName):r,n));else if("inherit"===l)return s=this.tryToResolveProperty(n,t,{inherited:!0}),M(s)?void this.addUnresolveProperty(n,t):s}i=a&&this.getPropertySyntax(a);o=i&&i.calculator?(r=n.parsedStyle[t],i.calculator(t,r,e,n,this)):e instanceof mr?e.value:e}return o},e.postProcessProperty=function(t,e,n){var t=Is[t];t&&t.syntax&&(t=t.syntax&&this.getPropertySyntax(t.syntax))&&t.postProcessor&&t.postProcessor(e,n)},e.addUnresolveProperty=function(t,e){var n=Ls.get(t);n||(Ls.set(t,[]),n=Ls.get(t)),-1===n.indexOf(e)&&n.push(e)},e.tryToResolveProperty=function(t,e,n){var n=(n=void 0===n?{}:n).inherited;if(n&&(t.parentElement&&function(t,e){t=Ls.get(t);return!t||0===t.length||t.includes(e)}(t.parentElement,e)))return"unset"===(n=t.parentElement.parsedStyle[e])||"initial"===n||"inherit"===n?void 0:n},e.recalc=function(e){var n,t=Ls.get(e);t&&t.length&&(n={},t.forEach(function(t){n[t]=e.attributes[t]}),this.processProperties(e,n),Ls.delete(e))},e.updateGeometry=function(t){var s,e,n,r,i,o,a,l,u,c,h,d,f,p,g,m=t.nodeName,v=ct.geometryUpdaterFactory[m];v&&((s=t.geometry).contentBounds||(s.contentBounds=new Ta),s.renderBounds||(s.renderBounds=new Ta),e=t.parsedStyle,n=(v=v.update(e,t)).width,r=v.height,h=void 0===(h=v.depth)?0:h,c=void 0===(c=v.offsetX)?0:c,p=void 0===(p=v.offsetY)?0:p,v=void 0===(v=v.offsetZ)?0:v,h=[Math.abs(n)/2,Math.abs(r)/2,h/2],l=e.stroke,u=e.lineWidth,g=e.increasedLineWidthForHitTesting,f=e.shadowType,d=e.shadowColor,i=void 0===(i=e.filter)?[]:i,o=e.transformOrigin,a=e.anchor,m===lt.TEXT?delete e.anchor:m===lt.MESH&&(e.anchor[2]=.5),c=[(1-2*(a&&a[0]||0))*n/2+c,(1-2*(a&&a[1]||0))*r/2+p,(1-2*(a&&a[2]||0))*h[2]+v],s.contentBounds.update(c,h),p=m===lt.POLYLINE||m===lt.POLYGON||m===lt.PATH?Math.SQRT2:.5,l&&!l.isNone&&(h[0]+=v=((u||0)+(g||0))*p,h[1]+=v),s.renderBounds.update(c,h),d&&f&&"inner"!==f&&(l=(m=s.renderBounds).min,u=m.max,g=e.shadowBlur||0,p=e.shadowOffsetX||0,v=e.shadowOffsetY||0,c=l[0]-g+p,h=u[0]+g+p,d=l[1]-g+v,f=u[1]+g+v,l[0]=Math.min(l[0],c),u[0]=Math.max(u[0],h),l[1]=Math.min(l[1],d),u[1]=Math.max(u[1],f),s.renderBounds.setMinMax(l,u)),i.forEach(function(t){var e,n,r,i,o,a=t.name,t=t.params;"blur"===a?(i=t[0].value,s.renderBounds.update(s.renderBounds.center,$r(s.renderBounds.halfExtents,s.renderBounds.halfExtents,[i,i,0]))):"drop-shadow"===a&&(i=t[0].value,a=t[1].value,t=t[2].value,e=(n=s.renderBounds).min,n=n.max,r=e[0]-t+i,i=n[0]+t+i,o=e[1]-t+a,t=n[1]+t+a,e[0]=Math.min(e[0],r),n[0]=Math.max(n[0],i),e[1]=Math.min(e[1],o),n[1]=Math.max(n[1],t),s.renderBounds.setMinMax(e,n))}),a=e.anchor,m=r<0,g=((p=n<0)?-1:1)*(o?ko(o[0],0,t):0),v=(m?-1:1)*(o?ko(o[1],1,t):0),g-=(p?-1:1)*(a&&a[0]||0)*s.contentBounds.halfExtents[0]*2,v-=(m?-1:1)*(a&&a[1]||0)*s.contentBounds.halfExtents[1]*2,t.setOrigin(g,v),ct.sceneGraphService.dirtifyToRoot(t))},e.isPropertyInheritable=function(t){t=Is[t];return!!t&&t.inh},t}();(Fs=Qa=Qa||{})[Fs.ORBITING=0]="ORBITING",Fs[Fs.EXPLORING=1]="EXPLORING",Fs[Fs.TRACKING=2]="TRACKING",(Fs=Ja=Ja||{})[Fs.DEFAULT=0]="DEFAULT",Fs[Fs.ROTATIONAL=1]="ROTATIONAL",Fs[Fs.TRANSLATIONAL=2]="TRANSLATIONAL",Fs[Fs.CINEMATIC=3]="CINEMATIC",(Fs=ts=ts||{})[Fs.ORTHOGRAPHIC=0]="ORTHOGRAPHIC",Fs[Fs.PERSPECTIVE=1]="PERSPECTIVE";var Ds,Bs="updated",Fs=function(){function t(){this.canvas=void 0,this.eventEmitter=new qn,this.matrix=K(),this.right=x(1,0,0),this.up=x(0,1,0),this.forward=x(0,0,1),this.position=x(0,0,1),this.focalPoint=x(0,0,0),this.distanceVector=x(0,0,-1),this.distance=1,this.azimuth=0,this.elevation=0,this.roll=0,this.relAzimuth=0,this.relElevation=0,this.relRoll=0,this.dollyingStep=0,this.maxDistance=1/0,this.minDistance=-1/0,this.zoom=1,this.rotateWorld=!1,this.fov=30,this.near=.1,this.far=1e3,this.aspect=1,this.left=void 0,this.rright=void 0,this.top=void 0,this.bottom=void 0,this.projectionMatrix=K(),this.projectionMatrixInverse=K(),this.jitteredProjectionMatrix=void 0,this.view=void 0,this.enableUpdate=!0,this.type=Qa.EXPLORING,this.trackingMode=Ja.DEFAULT,this.projectionMode=ts.PERSPECTIVE,this.frustum=new Ma,this.orthoMatrix=K()}var e=t.prototype;return e.isOrtho=function(){return this.projectionMode===ts.ORTHOGRAPHIC},e.getProjectionMode=function(){return this.projectionMode},e.getPerspective=function(){return this.jitteredProjectionMatrix||this.projectionMatrix},e.getPerspectiveInverse=function(){return this.projectionMatrixInverse},e.getFrustum=function(){return this.frustum},e.getPosition=function(){return this.position},e.getFocalPoint=function(){return this.focalPoint},e.getDollyingStep=function(){return this.dollyingStep},e.getNear=function(){return this.near},e.getFar=function(){return this.far},e.getZoom=function(){return this.zoom},e.getOrthoMatrix=function(){return this.orthoMatrix},e.getView=function(){return this.view},e.setEnableUpdate=function(t){this.enableUpdate=t},e.setType=function(t,e){return this.type=t,this.type===Qa.EXPLORING?this.setWorldRotation(!0):this.setWorldRotation(!1),this._getAngles(),this.type===Qa.TRACKING&&void 0!==e&&this.setTrackingMode(e),this},e.setProjectionMode=function(t){return this.projectionMode=t,this},e.setTrackingMode=function(t){if(this.type!==Qa.TRACKING)throw new Error("Impossible to set a tracking mode if the camera is not of tracking type");return this.trackingMode=t,this},e.setWorldRotation=function(t){return this.rotateWorld=t,this._getAngles(),this},e.getViewTransform=function(){return et(K(),this.matrix)},e.getWorldTransform=function(){return this.matrix},e.jitterProjectionMatrix=function(t,e){t=ht(K(),[t,e,0]);this.jitteredProjectionMatrix=rt(K(),t,this.projectionMatrix)},e.clearJitterProjectionMatrix=function(){this.jitteredProjectionMatrix=void 0},e.setMatrix=function(t){return this.matrix=t,this._update(),this},e.setFov=function(t){return this.setPerspective(this.near,this.far,t,this.aspect),this},e.setAspect=function(t){return this.setPerspective(this.near,this.far,this.fov,t),this},e.setNear=function(t){return this.projectionMode===ts.PERSPECTIVE?this.setPerspective(t,this.far,this.fov,this.aspect):this.setOrthographic(this.left,this.rright,this.top,this.bottom,t,this.far),this},e.setFar=function(t){return this.projectionMode===ts.PERSPECTIVE?this.setPerspective(this.near,t,this.fov,this.aspect):this.setOrthographic(this.left,this.rright,this.top,this.bottom,this.near,t),this},e.setViewOffset=function(t,e,n,r,i,o){return this.aspect=t/e,void 0===this.view&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=t,this.view.fullHeight=e,this.view.offsetX=n,this.view.offsetY=r,this.view.width=i,this.view.height=o,this.projectionMode===ts.PERSPECTIVE?this.setPerspective(this.near,this.far,this.fov,this.aspect):this.setOrthographic(this.left,this.rright,this.top,this.bottom,this.near,this.far),this},e.clearViewOffset=function(){return void 0!==this.view&&(this.view.enabled=!1),this.projectionMode===ts.PERSPECTIVE?this.setPerspective(this.near,this.far,this.fov,this.aspect):this.setOrthographic(this.left,this.rright,this.top,this.bottom,this.near,this.far),this},e.setZoom=function(t){return this.zoom=t,this.projectionMode===ts.ORTHOGRAPHIC?this.setOrthographic(this.left,this.rright,this.top,this.bottom,this.near,this.far):this.projectionMode===ts.PERSPECTIVE&&this.setPerspective(this.near,this.far,this.fov,this.aspect),this},e.setZoomByViewportPoint=function(t,e){var n=this.canvas.viewport2Canvas({x:e[0],y:e[1]}),r=n.x,n=n.y,i=this.roll,t=(this.rotate(0,0,-i),this.setPosition(r,n),this.setFocalPoint(r,n),this.setZoom(t),this.rotate(0,0,i),this.canvas.viewport2Canvas({x:e[0],y:e[1]})),i=x(t.x-r,t.y-n,0),e=Lt(i,this.right)/Mt(this.right),r=Lt(i,this.up)/Mt(this.up);return this.pan(-e,-r),this},e.setPerspective=function(t,e,n,r){this.projectionMode=ts.PERSPECTIVE,this.fov=n,this.near=t,this.far=e,this.aspect=r;var i,o,a,s,n=this.near*Math.tan(ti(.5*this.fov))/this.zoom,e=2*n,r=this.aspect*e,l=-.5*r;return null!=(i=this.view)&&i.enabled&&(i=this.view.fullWidth,o=this.view.fullHeight,l+=this.view.offsetX*r/i,n-=this.view.offsetY*e/o,r*=this.view.width/i,e*=this.view.height/o),i=this.projectionMatrix,l=(o=l)+r,n=(r=n)-e,e=this.far,a=2*t/(r-n),s=(l+o)/(l-o),r=(r+n)/(r-n),n=-(e+t)/(e-t),e=-2*e*t/(e-t),i[0]=2*t/(l-o),i[1]=0,i[2]=0,i[3]=0,i[4]=0,i[5]=a,i[6]=0,i[7]=0,i[8]=s,i[9]=r,i[10]=n,i[11]=-1,i[12]=0,i[13]=0,i[14]=e,i[15]=0,ot(this.projectionMatrix,this.projectionMatrix,x(1,-1,1)),et(this.projectionMatrixInverse,this.projectionMatrix),this.triggerUpdate(),this},e.setOrthographic=function(t,e,n,r,i,o){this.projectionMode=ts.ORTHOGRAPHIC,this.rright=e,this.left=t,this.top=n,this.bottom=r,this.near=i,this.far=o;var a,e=(this.rright-this.left)/(2*this.zoom),t=(this.top-this.bottom)/(2*this.zoom),n=(this.rright+this.left)/2,r=(this.top+this.bottom)/2,s=n-e,n=n+e,e=r+t,r=r-t;return null!=(t=this.view)&&t.enabled&&(t=(this.rright-this.left)/this.view.fullWidth/this.zoom,a=(this.top-this.bottom)/this.view.fullHeight/this.zoom,n=(s+=t*this.view.offsetX)+t*this.view.width,r=(e-=a*this.view.offsetY)-a*this.view.height),bt(this.projectionMatrix,s,n,r,e,i,o),ot(this.projectionMatrix,this.projectionMatrix,x(1,-1,1)),et(this.projectionMatrixInverse,this.projectionMatrix),this._getOrthoMatrix(),this.triggerUpdate(),this},e.setPosition=function(t,e,n){t=Jr(t,e=void 0===e?this.position[1]:e,n=void 0===n?this.position[2]:n);return this._setPosition(t),this.setFocalPoint(this.focalPoint),this.triggerUpdate(),this},e.setFocalPoint=function(t,e,n){void 0===e&&(e=this.focalPoint[1]),void 0===n&&(n=this.focalPoint[2]);var r,i=x(0,1,0);return this.focalPoint=Jr(t,e,n),this.trackingMode===Ja.CINEMATIC&&(t=(r=Pt(y(),this.focalPoint,this.position))[0],e=r[1],n=r[2],r=Mt(r),e=ei(Math.asin(e/r)),r=90+ei(Math.atan2(n,t)),st(n=K(),n,ti(r)),at(n,n,ti(e)),i=Bt(y(),[0,1,0],n)),et(this.matrix,xt(K(),this.position,this.focalPoint,i)),this._getAxes(),this._getDistance(),this._getAngles(),this.triggerUpdate(),this},e.getDistance=function(){return this.distance},e.getDistanceVector=function(){return this.distanceVector},e.setDistance=function(t){var e,n,r;return this.distance===t||t<0||(this.distance=t,this.distance<2e-4&&(this.distance=2e-4),this.dollyingStep=this.distance/100,e=y(),t=this.distance,n=this.forward,r=this.focalPoint,e[0]=t*n[0]+r[0],e[1]=t*n[1]+r[1],e[2]=t*n[2]+r[2],this._setPosition(e),this.triggerUpdate()),this},e.setMaxDistance=function(t){return this.maxDistance=t,this},e.setMinDistance=function(t){return this.minDistance=t,this},e.setAzimuth=function(t){return this.azimuth=Qr(t),this.computeMatrix(),this._getAxes(),this.type===Qa.ORBITING||this.type===Qa.EXPLORING?this._getPosition():this.type===Qa.TRACKING&&this._getFocalPoint(),this.triggerUpdate(),this},e.getAzimuth=function(){return this.azimuth},e.setElevation=function(t){return this.elevation=Qr(t),this.computeMatrix(),this._getAxes(),this.type===Qa.ORBITING||this.type===Qa.EXPLORING?this._getPosition():this.type===Qa.TRACKING&&this._getFocalPoint(),this.triggerUpdate(),this},e.getElevation=function(){return this.elevation},e.setRoll=function(t){return this.roll=Qr(t),this.computeMatrix(),this._getAxes(),this.type===Qa.ORBITING||this.type===Qa.EXPLORING?this._getPosition():this.type===Qa.TRACKING&&this._getFocalPoint(),this.triggerUpdate(),this},e.getRoll=function(){return this.roll},e._update=function(){this._getAxes(),this._getPosition(),this._getDistance(),this._getAngles(),this._getOrthoMatrix(),this.triggerUpdate()},e.computeMatrix=function(){var t=Ht(zt(),[0,0,1],ti(this.roll)),e=(J(this.matrix),Ht(zt(),[1,0,0],ti((this.rotateWorld&&this.type!==Qa.TRACKING||this.type===Qa.TRACKING?1:-1)*this.elevation))),n=Ht(zt(),[0,1,0],ti((this.rotateWorld&&this.type!==Qa.TRACKING||this.type===Qa.TRACKING?1:-1)*this.azimuth)),n=Xt(zt(),n,e),n=Xt(zt(),n,t),e=yt(K(),n);this.type===Qa.ORBITING||this.type===Qa.EXPLORING?(it(this.matrix,this.matrix,this.focalPoint),rt(this.matrix,this.matrix,e),it(this.matrix,this.matrix,[0,0,this.distance])):this.type===Qa.TRACKING&&(it(this.matrix,this.matrix,this.position),rt(this.matrix,this.matrix,e))},e._setPosition=function(t,e,n){this.position=Jr(t,e,n);t=this.matrix;t[12]=this.position[0],t[13]=this.position[1],t[14]=this.position[2],t[15]=1,this._getOrthoMatrix()},e._getAxes=function(){Rt(this.right,Jr(jt(Vt(),[1,0,0,0],this.matrix))),Rt(this.up,Jr(jt(Vt(),[0,1,0,0],this.matrix))),Rt(this.forward,Jr(jt(Vt(),[0,0,1,0],this.matrix))),It(this.right,this.right),It(this.up,this.up),It(this.forward,this.forward)},e._getAngles=function(){var t=this.distanceVector[0],e=this.distanceVector[1],n=this.distanceVector[2],r=Mt(this.distanceVector);0===r?(this.elevation=0,this.azimuth=0):this.type===Qa.TRACKING||this.rotateWorld?(this.elevation=ei(Math.asin(e/r)),this.azimuth=ei(Math.atan2(-t,-n))):(this.elevation=-ei(Math.asin(e/r)),this.azimuth=-ei(Math.atan2(-t,-n)))},e._getPosition=function(){Rt(this.position,Jr(jt(Vt(),[0,0,0,1],this.matrix))),this._getDistance()},e._getFocalPoint=function(){var t,e,n,r,i;t=this.distanceVector,e=[0,0,-this.distance],r=Y(),i=this.matrix,r[0]=i[0],r[1]=i[1],r[2]=i[2],r[3]=i[4],r[4]=i[5],r[5]=i[6],r[6]=i[8],r[7]=i[9],r[8]=i[10],i=r,r=e[0],n=e[1],e=e[2],t[0]=r*i[0]+n*i[3]+e*i[6],t[1]=r*i[1]+n*i[4]+e*i[7],t[2]=r*i[2]+n*i[5]+e*i[8],Ct(this.focalPoint,this.position,this.distanceVector),this._getDistance()},e._getDistance=function(){this.distanceVector=Pt(y(),this.focalPoint,this.position),this.distance=Mt(this.distanceVector),this.dollyingStep=this.distance/100},e._getOrthoMatrix=function(){var t,e;this.projectionMode===ts.ORTHOGRAPHIC&&(t=this.position,e=Ht(zt(),[0,0,1],-this.roll*Math.PI/180),vt(this.orthoMatrix,e,x((this.rright-this.left)/2-t[0],(this.top-this.bottom)/2-t[1],0),x(this.zoom,this.zoom,1),t))},e.triggerUpdate=function(){var t;this.enableUpdate&&(t=this.getViewTransform(),t=rt(K(),this.getPerspective(),t),this.getFrustum().extractFromVPMatrix(t),this.eventEmitter.emit(Bs))},e.rotate=function(t,e,n){throw new Error(Hr)},e.pan=function(t,e){throw new Error(Hr)},e.dolly=function(t){throw new Error(Hr)},e.createLandmark=function(t,e){throw new Error(Hr)},e.gotoLandmark=function(t,e){throw new Error(Hr)},e.cancelLandmarkAnimation=function(){throw new Error(Hr)},t}(),o=function(){function t(){}return t.prototype.update=function(t,e){t=t.r;return{width:2*t,height:2*t}},t}(),Us=function(){function t(){}return t.prototype.update=function(t,e){return{width:2*t.rx,height:2*t.ry}},t}(),a=function(){function t(){}return t.prototype.update=function(t){var e=t.x1,n=t.y1,r=t.x2,t=t.y2,i=Math.min(e,r),e=Math.max(e,r),r=Math.min(n,t);return{width:e-i,height:Math.max(n,t)-r}},t}(),Gs=function(){function t(){}return t.prototype.update=function(t){t=t.path.rect;return{width:t.width,height:t.height}},t}(),Ws=function(){function t(){}return t.prototype.update=function(t){var t=t.points.points,e=Math.min.apply(Math,t.map(function(t){return t[0]})),n=Math.max.apply(Math,t.map(function(t){return t[0]})),r=Math.min.apply(Math,t.map(function(t){return t[1]}));return{width:n-e,height:Math.max.apply(Math,t.map(function(t){return t[1]}))-r}},t}(),l=function(){function t(){}return t.prototype.update=function(t,e){var n=t.img,r=t.width,i=t.height,r=void 0===r?0:r,i=void 0===i?0:i;return n&&!Fe(n)&&(r||(r=n.width,t.width=r),i||(i=n.height,t.height=i)),{width:r,height:i}},t}(),Vs=function(){function t(t){this.globalRuntime=void 0,this.globalRuntime=t}var e=t.prototype;return e.isReadyToMeasure=function(t,e){var n=t.text,r=t.textAlign,i=t.textBaseline,o=t.fontSize,a=t.fontStyle,s=t.fontWeight,l=t.fontVariant,t=t.lineWidth;return n&&o&&a&&s&&l&&r&&i&&!M(t)},e.update=function(t,e){var n,r,i=t.text,o=t.textAlign,a=t.lineWidth,s=t.textBaseline,l=t.dx,u=t.dy,c=((null==e||null==(c=e.ownerDocument)||null==(c=c.defaultView)?void 0:c.getConfig())||{}).offscreenCanvas;return this.isReadyToMeasure(t,e)?(e=this.globalRuntime.textService.measureText(i,t,c),i=(t.metrics=e).width,c=e.height,n=e.lineHeight,e=e.fontProperties,i=[i/2,c/2,0],c=[0,1],r=0,"center"===o||"middle"===o?(r=a/2,c=[.5,1]):"right"!==o&&"end"!==o||(r=a,c=[1,1]),o=0,"middle"===s?o=i[1]:"top"===s||"hanging"===s?o=2*i[1]:"alphabetic"===s?o=ct.enableCSSParsing?n-e.ascent:0:"bottom"!==s&&"ideographic"!==s||(o=0),l&&(r+=l),u&&(o+=u),t.anchor=[c[0],c[1],0],{width:2*i[0],height:2*i[1],offsetX:r,offsetY:o}):(t.metrics={font:"",width:0,height:0,lines:[],lineWidths:[],lineHeight:0,maxLineWidth:0,fontProperties:{ascent:0,descent:0,fontSize:0},lineMetrics:[]},{width:0,height:0,x:0,y:0,offsetX:0,offsetY:0})},t}(),js=function(){function t(t,e){var u=this;this.globalRuntime=void 0,this.context=void 0,this.rootTarget=void 0,this.emitter=new qn,this.cursor="default",this.mappingTable={},this.mappingState={trackingData:{}},this.eventPool=new Map,this.pickHandler=void 0,this.tmpMatrix=K(),this.tmpVec3=y(),this.onPointerDown=function(t){var e,n=u.createPointerEvent(t);u.dispatchEvent(n,"pointerdown"),"touch"===n.pointerType?u.dispatchEvent(n,"touchstart"):"mouse"!==n.pointerType&&"pen"!==n.pointerType||(e=2===n.button,u.dispatchEvent(n,e?"rightdown":"mousedown")),u.trackingData(t.pointerId).pressTargetsByButton[t.button]=n.composedPath(),u.freeEvent(n)},this.onPointerUp=function(t){var e=performance.now(),n=u.createPointerEvent(t,void 0,void 0,u.context.config.alwaysTriggerPointerEventOnCanvas?u.rootTarget:void 0),r=(u.dispatchEvent(n,"pointerup"),"touch"===n.pointerType?u.dispatchEvent(n,"touchend"):"mouse"!==n.pointerType&&"pen"!==n.pointerType||(r=2===n.button,u.dispatchEvent(n,r?"rightup":"mouseup")),u.trackingData(t.pointerId)),i=u.findMountedTarget(r.pressTargetsByButton[t.button]),o=i;if(i&&!n.composedPath().includes(i)){for(var a,s=i;s&&!n.composedPath().includes(s);)n.currentTarget=s,u.notifyTarget(n,"pointerupoutside"),"touch"===n.pointerType?u.notifyTarget(n,"touchendoutside"):"mouse"!==n.pointerType&&"pen"!==n.pointerType||(a=2===n.button,u.notifyTarget(n,a?"rightupoutside":"mouseupoutside")),Wa.isNode(s)&&(s=s.parentNode);delete r.pressTargetsByButton[t.button],o=s}o&&((i=u.clonePointerEvent(n,"click")).target=o,i.path=[],r.clicksByButton[t.button]||(r.clicksByButton[t.button]={clickCount:0,target:i.target,timeStamp:e}),(o=r.clicksByButton[t.button]).target===i.target&&e-o.timeStamp<200?++o.clickCount:o.clickCount=1,o.target=i.target,o.timeStamp=e,i.detail=o.clickCount,null!=(r=n.detail)&&r.preventClick||(u.context.config.useNativeClickEvent||"mouse"!==i.pointerType&&"touch"!==i.pointerType||u.dispatchEvent(i,"click"),u.dispatchEvent(i,"pointertap")),u.freeEvent(i)),u.freeEvent(n)},this.onPointerMove=function(t){var e=u.createPointerEvent(t,void 0,void 0,u.context.config.alwaysTriggerPointerEventOnCanvas?u.rootTarget:void 0),n="mouse"===e.pointerType||"pen"===e.pointerType,r=u.trackingData(t.pointerId),i=u.findMountedTarget(r.overTargets);if(r.overTargets&&i!==e.target){var o="mousemove"===t.type?"mouseout":"pointerout",o=u.createPointerEvent(t,o,i||void 0);if(u.dispatchEvent(o,"pointerout"),n&&u.dispatchEvent(o,"mouseout"),!e.composedPath().includes(i)){var a=u.createPointerEvent(t,"pointerleave",i||void 0);for(a.eventPhase=a.AT_TARGET;a.target&&!e.composedPath().includes(a.target);)a.currentTarget=a.target,u.notifyTarget(a),n&&u.notifyTarget(a,"mouseleave"),Wa.isNode(a.target)&&(a.target=a.target.parentNode);u.freeEvent(a)}u.freeEvent(o)}if(i!==e.target){for(var o="mousemove"===t.type?"mouseover":"pointerover",t=u.clonePointerEvent(e,o),s=(u.dispatchEvent(t,"pointerover"),n&&u.dispatchEvent(t,"mouseover"),i&&Wa.isNode(i)&&i.parentNode);s&&s!==(Wa.isNode(u.rootTarget)&&u.rootTarget.parentNode)&&s!==e.target;)s=s.parentNode;if(!s||s===(Wa.isNode(u.rootTarget)&&u.rootTarget.parentNode)){var l=u.clonePointerEvent(e,"pointerenter");for(l.eventPhase=l.AT_TARGET;l.target&&l.target!==i&&l.target!==(Wa.isNode(u.rootTarget)&&u.rootTarget.parentNode);)l.currentTarget=l.target,u.notifyTarget(l),n&&u.notifyTarget(l,"mouseenter"),Wa.isNode(l.target)&&(l.target=l.target.parentNode);u.freeEvent(l)}u.freeEvent(t)}u.dispatchEvent(e,"pointermove"),"touch"===e.pointerType&&u.dispatchEvent(e,"touchmove"),n&&(u.dispatchEvent(e,"mousemove"),u.cursor=u.getCursor(e.target)),r.overTargets=e.composedPath(),u.freeEvent(e)},this.onPointerOut=function(t){var e=u.trackingData(t.pointerId);if(e.overTargets){var n="mouse"===t.pointerType||"pen"===t.pointerType,r=u.findMountedTarget(e.overTargets),i=u.createPointerEvent(t,"pointerout",r||void 0),o=(u.dispatchEvent(i),n&&u.dispatchEvent(i,"mouseout"),u.createPointerEvent(t,"pointerleave",r||void 0));for(o.eventPhase=o.AT_TARGET;o.target&&o.target!==(Wa.isNode(u.rootTarget)&&u.rootTarget.parentNode);)o.currentTarget=o.target,u.notifyTarget(o),n&&u.notifyTarget(o,"mouseleave"),Wa.isNode(o.target)&&(o.target=o.target.parentNode);e.overTargets=null,u.freeEvent(i),u.freeEvent(o)}u.cursor=null},this.onPointerOver=function(t){var e=u.trackingData(t.pointerId),t=u.createPointerEvent(t),n="mouse"===t.pointerType||"pen"===t.pointerType,r=(u.dispatchEvent(t,"pointerover"),n&&u.dispatchEvent(t,"mouseover"),"mouse"===t.pointerType&&(u.cursor=u.getCursor(t.target)),u.clonePointerEvent(t,"pointerenter"));for(r.eventPhase=r.AT_TARGET;r.target&&r.target!==(Wa.isNode(u.rootTarget)&&u.rootTarget.parentNode);)r.currentTarget=r.target,u.notifyTarget(r),n&&u.notifyTarget(r,"mouseenter"),Wa.isNode(r.target)&&(r.target=r.target.parentNode);e.overTargets=t.composedPath(),u.freeEvent(t),u.freeEvent(r)},this.onPointerUpOutside=function(t){var e=u.trackingData(t.pointerId),n=u.findMountedTarget(e.pressTargetsByButton[t.button]),r=u.createPointerEvent(t);if(n){for(var i=n;i;)r.currentTarget=i,u.notifyTarget(r,"pointerupoutside"),"touch"===r.pointerType||"mouse"!==r.pointerType&&"pen"!==r.pointerType||u.notifyTarget(r,2===r.button?"rightupoutside":"mouseupoutside"),Wa.isNode(i)&&(i=i.parentNode);delete e.pressTargetsByButton[t.button]}u.freeEvent(r)},this.onWheel=function(t){t=u.createWheelEvent(t);u.dispatchEvent(t),u.freeEvent(t)},this.onClick=function(t){u.context.config.useNativeClickEvent&&(t=u.createPointerEvent(t),u.dispatchEvent(t),u.freeEvent(t))},this.onPointerCancel=function(t){t=u.createPointerEvent(t,void 0,void 0,u.context.config.alwaysTriggerPointerEventOnCanvas?u.rootTarget:void 0);u.dispatchEvent(t),u.freeEvent(t)},this.globalRuntime=t,this.context=e}var e=t.prototype;return e.init=function(){this.rootTarget=this.context.renderingContext.root.parentNode,this.addEventMapping("pointerdown",this.onPointerDown),this.addEventMapping("pointerup",this.onPointerUp),this.addEventMapping("pointermove",this.onPointerMove),this.addEventMapping("pointerout",this.onPointerOut),this.addEventMapping("pointerleave",this.onPointerOut),this.addEventMapping("pointercancel",this.onPointerCancel),this.addEventMapping("pointerover",this.onPointerOver),this.addEventMapping("pointerupoutside",this.onPointerUpOutside),this.addEventMapping("wheel",this.onWheel),this.addEventMapping("click",this.onClick)},e.destroy=function(){this.emitter.removeAllListeners(),this.mappingTable={},this.mappingState={},this.eventPool.clear()},e.client2Viewport=function(t){var e=this.context.contextService.getBoundingClientRect();return new Ra(t.x-((null==e?void 0:e.left)||0),t.y-((null==e?void 0:e.top)||0))},e.viewport2Client=function(t){var e=this.context.contextService.getBoundingClientRect();return new Ra(t.x+((null==e?void 0:e.left)||0),t.y+((null==e?void 0:e.top)||0))},e.viewport2Canvas=function(t){var e=t.x,t=t.y,n=this.rootTarget.defaultView.getCamera(),r=this.context.config,i=r.width,r=r.height,o=n.getPerspectiveInverse(),n=n.getWorldTransform(),n=rt(this.tmpMatrix,n,o),o=Nt(this.tmpVec3,e/i*2-1,2*(1-t/r)-1,0);return Bt(o,o,n),new Ra(o[0],o[1])},e.canvas2Viewport=function(t){var e=this.rootTarget.defaultView.getCamera(),n=e.getPerspective(),e=e.getViewTransform(),n=rt(this.tmpMatrix,n,e),e=Nt(this.tmpVec3,t.x,t.y,0),t=(Bt(this.tmpVec3,this.tmpVec3,n),this.context.config),n=t.width,t=t.height;return new Ra((e[0]+1)/2*n,(1-(e[1]+1)/2)*t)},e.setPickHandler=function(t){this.pickHandler=t},e.addEventMapping=function(t,e){this.mappingTable[t]||(this.mappingTable[t]=[]),this.mappingTable[t].push({fn:e,priority:0}),this.mappingTable[t].sort(function(t,e){return t.priority-e.priority})},e.mapEvent=function(t){if(this.rootTarget){var e=this.mappingTable[t.type];if(e)for(var n=0,r=e.length;n<r;n++)e[n].fn(t);else console.warn("[EventService]: Event mapping not defined for "+t.type)}},e.dispatchEvent=function(t,e,n){n?(t.eventPhase=t.AT_TARGET,n=this.rootTarget.defaultView||null,t.currentTarget=n,this.notifyListeners(t,e)):(t.propagationStopped=!1,t.propagationImmediatelyStopped=!1,this.propagate(t,e)),this.emitter.emit(e||t.type,t)},e.propagate=function(t,e){if(t.target){var n=t.composedPath();t.eventPhase=t.CAPTURING_PHASE;for(var r=n.length-1;1<=r;r--)if(t.currentTarget=n[r],this.notifyTarget(t,e),t.propagationStopped||t.propagationImmediatelyStopped)return;if(t.eventPhase=t.AT_TARGET,t.currentTarget=t.target,this.notifyTarget(t,e),!t.propagationStopped&&!t.propagationImmediatelyStopped){var i=n.indexOf(t.currentTarget);t.eventPhase=t.BUBBLING_PHASE;for(var o=i+1;o<n.length;o++)if(t.currentTarget=n[o],this.notifyTarget(t,e),t.propagationStopped||t.propagationImmediatelyStopped)return}}},e.propagationPath=function(t){var e=[t],n=this.rootTarget.defaultView||null;if(n&&n===t)e.unshift(n.document);else{for(var r=0;r<2048&&t!==this.rootTarget;r++)Wa.isNode(t)&&t.parentNode&&(e.push(t.parentNode),t=t.parentNode);n&&e.push(n)}return e},e.hitTest=function(t){var e=t.viewportX,n=t.viewportY,r=this.context.config,i=r.width,r=r.height;return!(e<0||n<0||i<e||r<n)&&(this.pickHandler(t)||this.rootTarget)||null},e.isNativeEventFromCanvas=function(t){var e=this.context.contextService.getDomElement(),n=null==(n=t.nativeEvent)?void 0:n.target;if(n){if(n===e)return!0;if(e&&e.contains)return e.contains(n)}return!!t.nativeEvent.composedPath&&-1<t.nativeEvent.composedPath().indexOf(e)},e.getExistedHTML=function(t){if(t.nativeEvent.composedPath)for(var e=ar(t.nativeEvent.composedPath());!(n=e()).done;){var n=n.value,n=ct.nativeHTMLMap.get(n);if(n)return n}return null},e.pickTarget=function(t){return this.hitTest({clientX:t.clientX,clientY:t.clientY,viewportX:t.viewportX,viewportY:t.viewportY,x:t.canvasX,y:t.canvasY})},e.createPointerEvent=function(t,e,n,r){var i=this.allocateEvent($a),t=(this.copyPointerData(t,i),this.copyMouseData(t,i),this.copyData(t,i),i.nativeEvent=t.nativeEvent,i.originalEvent=t,this.getExistedHTML(i));return i.target=null!=n?n:t||this.isNativeEventFromCanvas(i)&&this.pickTarget(i)||r,"string"==typeof e&&(i.type=e),i},e.createWheelEvent=function(t){var e=this.allocateEvent(Za),t=(this.copyWheelData(t,e),this.copyMouseData(t,e),this.copyData(t,e),e.nativeEvent=t.nativeEvent,e.originalEvent=t,this.getExistedHTML(e));return e.target=t||this.isNativeEventFromCanvas(e)&&this.pickTarget(e),e},e.trackingData=function(t){return this.mappingState.trackingData[t]||(this.mappingState.trackingData[t]={pressTargetsByButton:{},clicksByButton:{},overTarget:null}),this.mappingState.trackingData[t]},e.cloneWheelEvent=function(t){var e=this.allocateEvent(Za);return e.nativeEvent=t.nativeEvent,e.originalEvent=t.originalEvent,this.copyWheelData(t,e),this.copyMouseData(t,e),this.copyData(t,e),e.target=t.target,e.path=t.composedPath().slice(),e.type=t.type,e},e.clonePointerEvent=function(t,e){var n=this.allocateEvent($a);return n.nativeEvent=t.nativeEvent,n.originalEvent=t.originalEvent,this.copyPointerData(t,n),this.copyMouseData(t,n),this.copyData(t,n),n.target=t.target,n.path=t.composedPath().slice(),n.type=null!=e?e:n.type,n},e.copyPointerData=function(t,e){e.pointerId=t.pointerId,e.width=t.width,e.height=t.height,e.isPrimary=t.isPrimary,e.pointerType=t.pointerType,e.pressure=t.pressure,e.tangentialPressure=t.tangentialPressure,e.tiltX=t.tiltX,e.tiltY=t.tiltY,e.twist=t.twist},e.copyMouseData=function(t,e){e.altKey=t.altKey,e.button=t.button,e.buttons=t.buttons,e.ctrlKey=t.ctrlKey,e.metaKey=t.metaKey,e.shiftKey=t.shiftKey,e.client.copyFrom(t.client),e.movement.copyFrom(t.movement),e.canvas.copyFrom(t.canvas),e.screen.copyFrom(t.screen),e.global.copyFrom(t.global),e.offset.copyFrom(t.offset)},e.copyWheelData=function(t,e){e.deltaMode=t.deltaMode,e.deltaX=t.deltaX,e.deltaY=t.deltaY,e.deltaZ=t.deltaZ},e.copyData=function(t,e){e.isTrusted=t.isTrusted,e.timeStamp=performance.now(),e.type=t.type,e.detail=t.detail,e.view=t.view,e.page.copyFrom(t.page),e.viewport.copyFrom(t.viewport)},e.allocateEvent=function(t){this.eventPool.has(t)||this.eventPool.set(t,[]);t=this.eventPool.get(t).pop()||new t(this);return t.eventPhase=t.NONE,t.currentTarget=null,t.path=[],t.target=null,t},e.freeEvent=function(t){if(t.manager!==this)throw new Error("It is illegal to free an event not managed by this EventBoundary!");var e=t.constructor;this.eventPool.has(e)||this.eventPool.set(e,[]),this.eventPool.get(e).push(t)},e.notifyTarget=function(t,e){e=null!=(n=e)?n:t.type;var n=t.eventPhase===t.CAPTURING_PHASE||t.eventPhase===t.AT_TARGET?e+"capture":e;this.notifyListeners(t,n),t.eventPhase===t.AT_TARGET&&this.notifyListeners(t,e)},e.notifyListeners=function(t,e){var n=t.currentTarget.emitter,r=n._events[e];if(r)if("fn"in r)r.once&&n.removeListener(e,r.fn,void 0,!0),r.fn.call(t.currentTarget||r.context,t);else for(var i=0;i<r.length&&!t.propagationImmediatelyStopped;i++)r[i].once&&n.removeListener(e,r[i].fn,void 0,!0),r[i].fn.call(t.currentTarget||r[i].context,t)},e.findMountedTarget=function(t){if(!t)return null;for(var e=t[t.length-1],n=t.length-2;0<=n;n--){var r=t[n];if(!(r===this.rootTarget||Wa.isNode(r)&&r.parentNode===e))break;e=t[n]}return e},e.getCursor=function(t){for(var e=t;e;){var n=Ka.isElement(e)&&e.getAttribute("cursor");if(n)return n;e=Wa.isNode(e)&&e.parentNode}},t}(),zs=function(){function t(){this.canvas=void 0,this.context=void 0}var e=t.prototype;return e.getOrCreateCanvas=function(t,e){if(!this.canvas){if(t)this.canvas=t,this.context=this.canvas.getContext("2d",e);else try{this.canvas=new window.OffscreenCanvas(0,0),this.context=this.canvas.getContext("2d",e),this.context&&this.context.measureText||(this.canvas=document.createElement("canvas"),this.context=this.canvas.getContext("2d"))}catch(t){this.canvas=document.createElement("canvas"),this.context=this.canvas.getContext("2d",e)}this.canvas.width=10,this.canvas.height=10}return this.canvas},e.getOrCreateContext=function(t,e){return this.context||this.getOrCreateCanvas(t,e),this.context},t}(),Hs=((Ys=Ds=Ds||{})[Ys.CAMERA_CHANGED=0]="CAMERA_CHANGED",Ys[Ys.DISPLAY_OBJECT_CHANGED=1]="DISPLAY_OBJECT_CHANGED",Ys[Ys.NONE=2]="NONE",function(){function t(t,e){this.globalRuntime=void 0,this.context=void 0,this.inited=!1,this.stats={total:0,rendered:0},this.zIndexCounter=0,this.renderOrderChangedEvent=new Ga(v.RENDER_ORDER_CHANGED),this.hooks={init:new Qi,dirtycheck:new eo,cull:new eo,beginFrame:new to,beforeRender:new to,render:new to,afterRender:new to,endFrame:new to,destroy:new to,pick:new Ji,pickSync:new eo,pointerDown:new to,pointerUp:new to,pointerMove:new to,pointerOut:new to,pointerOver:new to,pointerWheel:new to,pointerCancel:new to,click:new to},this.globalRuntime=t,this.context=e}var e=t.prototype;return e.init=function(){var t=Qn($n().mark(function t(){var e;return $n().wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return e=d({},this.globalRuntime,this.context),this.context.renderingPlugins.forEach(function(t){t.apply(e,ct)}),t.next=4,this.hooks.init.promise();case 4:this.inited=!0;case 5:case"end":return t.stop()}},t,this)}));return function(){return t.apply(this,arguments)}}(),e.getStats=function(){return this.stats},e.disableDirtyRectangleRendering=function(){return!this.context.config.renderer.getConfig().enableDirtyRectangleRendering||this.context.renderingContext.renderReasons.has(Ds.CAMERA_CHANGED)},e.render=function(t,e){var n=this,r=(this.stats.total=0,this.stats.rendered=0,this.zIndexCounter=0,this.context.renderingContext);this.globalRuntime.sceneGraphService.syncHierarchy(r.root),this.globalRuntime.sceneGraphService.triggerPendingEvents(),r.renderReasons.size&&this.inited&&(this.renderDisplayObject(r.root,t,r),this.hooks.beginFrame.call(),r.renderListCurrentFrame.forEach(function(t){n.hooks.beforeRender.call(t),n.hooks.render.call(t),n.hooks.afterRender.call(t)}),this.hooks.endFrame.call(),r.renderListCurrentFrame=[],r.renderReasons.clear(),e())},e.renderDisplayObject=function(t,e,n){var r=this,i=e.renderer.getConfig(),o=i.enableDirtyCheck,i=i.enableCulling,o=(this.globalRuntime.enableCSSParsing&&this.globalRuntime.styleValueRegistry.recalc(t),o?this.hooks.dirtycheck.call(t):t),o=(o&&(i=i?this.hooks.cull.call(o,this.context.camera):o)&&(this.stats.rendered++,n.renderListCurrentFrame.push(i)),t.renderable.dirty=!1,t.sortable.renderOrder=this.zIndexCounter++,this.stats.total++,t.sortable),i=!1;o.dirty&&(o.sorted=t.childNodes.slice().sort(Gr),o.dirty=!(i=!0)),(o.sorted||t.childNodes).forEach(function(t){r.renderDisplayObject(t,e,n)}),i&&t.forEach(function(t){r.renderOrderChangedEvent.target=t,r.renderOrderChangedEvent.detail={renderOrder:t.sortable.renderOrder},t.ownerDocument.defaultView.dispatchEvent(r.renderOrderChangedEvent,!0)})},e.destroy=function(){this.inited=!1,this.hooks.destroy.call(),this.globalRuntime.sceneGraphService.clearPendingEvents()},e.dirtify=function(){this.context.renderingContext.renderReasons.add(Ds.DISPLAY_OBJECT_CHANGED)},t}()),Xs=/\[\s*(.*)=(.*)\s*\]/,Ys=function(){function t(){}var e=t.prototype;return e.selectOne=function(e,n){var t,r,i,o=this;return e.startsWith(".")?n.find(function(t){return-1<((null==t?void 0:t.classList)||[]).indexOf(o.getIdOrClassname(e))}):e.startsWith("#")?n.find(function(t){return t.id===o.getIdOrClassname(e)}):e.startsWith("[")?(t=this.getAttribute(e),r=t.name,i=t.value,r?n.find(function(t){return n!==t&&("name"===r?t.name===i:o.attributeToString(t,r)===i)}):null):n.find(function(t){return n!==t&&t.nodeName===e})},e.selectAll=function(e,n){var t,r,i,o=this;return e.startsWith(".")?n.findAll(function(t){return n!==t&&-1<((null==t?void 0:t.classList)||[]).indexOf(o.getIdOrClassname(e))}):e.startsWith("#")?n.findAll(function(t){return n!==t&&t.id===o.getIdOrClassname(e)}):e.startsWith("[")?(t=this.getAttribute(e),r=t.name,i=t.value,r?n.findAll(function(t){return n!==t&&("name"===r?t.name===i:o.attributeToString(t,r)===i)}):[]):n.findAll(function(t){return n!==t&&t.nodeName===e})},e.is=function(t,e){var n,r;return t.startsWith(".")?e.className===this.getIdOrClassname(t):t.startsWith("#")?e.id===this.getIdOrClassname(t):t.startsWith("[")?(n=(r=this.getAttribute(t)).name,r=r.value,"name"===n?e.name===r:this.attributeToString(e,n)===r):e.nodeName===t},e.getIdOrClassname=function(t){return t.substring(1)},e.getAttribute=function(t){var t=t.match(Xs),e="",n="";return t&&2<t.length&&(e=t[1].replace(/"/g,""),n=t[2].replace(/"/g,"")),{name:e,value:n}},e.attributeToString=function(t,e){return t.getAttribute&&(t=t.getAttribute(e),!M(t))&&t.toString?t.toString():""},t}();function Ks(t){t=t.renderable;t&&(t.renderBoundsDirty=!0,t.boundsDirty=!0)}var qs,$s=new ja(v.REPARENT,null,"","","",0,"",""),Zs=function(){function t(t){var a,i,o,r,s,l,u,c,h,n,d,f,g=this;this.runtime=void 0,this.pendingEvents=[],this.boundsChangedEvent=new Ga(v.BOUNDS_CHANGED),this.rotate=(a=zt(),function(t,e,n,r){void 0===n&&(n=0),void 0===r&&(r=0),"number"==typeof e&&(e=x(e,n,r));var i,o,n=t.transformable;null!==t.parentNode&&t.parentNode.transformable?(Kt(r=zt(),e[0],e[1],e[2]),i=g.getRotation(t),o=g.getRotation(t.parentNode),$t(a,o),Yt(a,a),Xt(r,a,r),Xt(n.localRotation,r,i),Qt(n.localRotation,n.localRotation),g.dirtifyLocal(t,n)):g.rotateLocal(t,e)}),this.rotateLocal=(i=zt(),function(t,e,n,r){void 0===n&&(n=0),void 0===r&&(r=0),"number"==typeof e&&(e=x(e,n,r));n=t.transformable;Kt(i,e[0],e[1],e[2]),Zt(n.localRotation,n.localRotation,i),g.dirtifyLocal(t,n)}),this.setEulerAngles=(o=zt(),function(t,e,n,r){void 0===n&&(n=0),void 0===r&&(r=0),"number"==typeof e&&(e=x(e,n,r));n=t.transformable;null!==t.parentNode&&t.parentNode.transformable?(Kt(n.localRotation,e[0],e[1],e[2]),r=g.getRotation(t.parentNode),$t(o,Yt(zt(),r)),Zt(n.localRotation,n.localRotation,o),g.dirtifyLocal(t,n)):g.setLocalEulerAngles(t,e)}),this.translateLocal=function(t,e,n,r){void 0===n&&(n=0),void 0===r&&(r=0),"number"==typeof e&&(e=x(e,n,r));var i,o,a,s,l,u,c,h,d,f,p,n=t.transformable;Ft(e,y())||(i=r=e,o=n.localRotation,a=o[0],s=o[1],l=o[2],o=o[3],u=i[0],c=i[1],i=i[2],p=s*(f=a*c-s*u)-l*(d=l*u-a*i),l=l*(h=s*i-l*c)-a*f,a=a*d-s*h,d*=s=2*o,f*=s,l*=2,a*=2,r[0]=u+(h*=s)+(p*=2),r[1]=c+d+l,r[2]=i+f+a,Ct(n.localPosition,n.localPosition,e),g.dirtifyLocal(t,n))},this.setPosition=(r=K(),s=y(),function(t,e){var n=t.transformable;s[0]=e[0],s[1]=e[1],s[2]=e[2]||0,Ft(g.getPosition(t),s)||(Rt(n.position,s),null!==t.parentNode&&t.parentNode.transformable?(e=t.parentNode.transformable,$(r,e.worldTransform),et(r,r),Bt(n.localPosition,s,r)):Rt(n.localPosition,s),g.dirtifyLocal(t,n))}),this.setLocalPosition=(l=y(),function(t,e){var n=t.transformable;l[0]=e[0],l[1]=e[1],l[2]=e[2]||0,Ft(n.localPosition,l)||(Rt(n.localPosition,l),g.dirtifyLocal(t,n))}),this.translate=(u=y(),c=y(),h=y(),function(t,e,n,r){void 0===n&&(n=0),void 0===r&&(r=0),Ft(e="number"==typeof e?Nt(c,e,n,r):e,u)||(Ct(h,g.getPosition(t),e),g.setPosition(t,h))}),this.setRotation=function(){var a=zt();return function(t,e,n,r,i){var o=t.transformable;"number"==typeof e&&(e=qt(e,n,r,i)),null!==t.parentNode&&t.parentNode.transformable?(n=g.getRotation(t.parentNode),$t(a,n),Yt(a,a),Xt(o.localRotation,a,e),Qt(o.localRotation,o.localRotation),g.dirtifyLocal(t,o)):g.setLocalRotation(t,e)}},this.displayObjectDependencyMap=new WeakMap,this.calcLocalTransform=(n=K(),d=y(),f=qt(0,0,0,1),function(t){var e;0!==t.localSkew[0]||0!==t.localSkew[1]?(vt(t.localTransform,t.localRotation,t.localPosition,x(1,1,1),t.origin),0===t.localSkew[0]&&0===t.localSkew[1]||((e=J(n))[4]=Math.tan(t.localSkew[0]),e[1]=Math.tan(t.localSkew[1]),rt(t.localTransform,t.localTransform,e)),e=vt(n,f,d,t.localScale,t.origin),rt(t.localTransform,t.localTransform,e)):vt(t.localTransform,t.localRotation,t.localPosition,t.localScale,t.origin)}),this.runtime=t}var e=t.prototype;return e.matches=function(t,e){return this.runtime.sceneGraphSelector.is(t,e)},e.querySelector=function(t,e){return this.runtime.sceneGraphSelector.selectOne(t,e)},e.querySelectorAll=function(t,e){return this.runtime.sceneGraphSelector.selectAll(t,e)},e.attach=function(t,e,n){var r=!1,n=(t.parentNode&&(r=t.parentNode!==e,this.detach(t)),t.parentNode=e,M(n)?t.parentNode.childNodes.push(t):t.parentNode.childNodes.splice(n,0,t),e.sortable),e=((null!=n&&null!=(e=n.sorted)&&e.length||null!=(e=t.style)&&e.zIndex)&&(n.dirty=!0),t.transformable);e&&this.dirtifyWorld(t,e),e.frozen&&this.unfreezeParentToRoot(t),r&&t.dispatchEvent($s)},e.detach=function(t){var e,n,r;t.parentNode&&(e=t.transformable,(null!=(n=t.parentNode.sortable)&&null!=(r=n.sorted)&&r.length||null!=(r=t.style)&&r.zIndex)&&(n.dirty=!0),-1<(r=t.parentNode.childNodes.indexOf(t))&&t.parentNode.childNodes.splice(r,1),e&&this.dirtifyWorld(t,e),t.parentNode=null)},e.getOrigin=function(t){return t.transformable.origin},e.setOrigin=function(t,e,n,r){void 0===n&&(n=0),void 0===r&&(r=0);var i=t.transformable;(e="number"==typeof e?[e,n,r]:e)[0]===i.origin[0]&&e[1]===i.origin[1]&&e[2]===i.origin[2]||((n=i.origin)[0]=e[0],n[1]=e[1],n[2]=e[2]||0,this.dirtifyLocal(t,i))},e.setLocalEulerAngles=function(t,e,n,r){void 0===n&&(n=0),void 0===r&&(r=0),"number"==typeof e&&(e=x(e,n,r));n=t.transformable;Kt(n.localRotation,e[0],e[1],e[2]),this.dirtifyLocal(t,n)},e.scaleLocal=function(t,e){var n,r,i=t.transformable;n=i.localScale,r=i.localScale,e=x(e[0],e[1],e[2]||1),n[0]=r[0]*e[0],n[1]=r[1]*e[1],n[2]=r[2]*e[2],this.dirtifyLocal(t,i)},e.setLocalScale=function(t,e){var n=t.transformable,e=x(e[0],e[1],e[2]||n.localScale[2]);Ft(e,n.localScale)||(Rt(n.localScale,e),this.dirtifyLocal(t,n))},e.setLocalRotation=function(t,e,n,r,i){"number"==typeof e&&(e=qt(e,n,r,i));n=t.transformable;$t(n.localRotation,e),this.dirtifyLocal(t,n)},e.setLocalSkew=function(t,e,n){"number"==typeof e&&(i=e,n=n,(r=new X(2))[0]=i,r[1]=n,e=r);var r,i=t.transformable;n=i.localSkew,r=e,n[0]=r[0],n[1]=r[1],this.dirtifyLocal(t,i)},e.dirtifyLocal=function(t,e){e.localDirtyFlag||(e.localDirtyFlag=!0,e.dirtyFlag)||this.dirtifyWorld(t,e)},e.dirtifyWorld=function(t,e){e.dirtyFlag||this.unfreezeParentToRoot(t),this.dirtifyWorldInternal(t,e),this.dirtifyToRoot(t,!0)},e.triggerPendingEvents=function(){function r(t,e){t.isConnected&&!i.has(t.entity)&&(n.boundsChangedEvent.detail=e,(n.boundsChangedEvent.target=t).isMutationObserved?t.dispatchEvent(n.boundsChangedEvent):t.ownerDocument.defaultView.dispatchEvent(n.boundsChangedEvent,!0),i.add(t.entity))}var n=this,i=new Set;this.pendingEvents.forEach(function(t){var e=t[0],n=t[1];n.affectChildren?e.forEach(function(t){r(t,n)}):r(e,n)}),this.clearPendingEvents(),i.clear()},e.clearPendingEvents=function(){this.pendingEvents=[]},e.dirtifyToRoot=function(t,e){void 0===e&&(e=!1);var n=t;for(n.renderable&&(n.renderable.dirty=!0);n;)Ks(n),n=n.parentNode;e&&t.forEach(function(t){Ks(t)}),this.informDependentDisplayObjects(t),this.pendingEvents.push([t,{affectChildren:e}])},e.updateDisplayObjectDependency=function(t,e,n,r){var i;e&&e!==n&&(e=this.displayObjectDependencyMap.get(e))&&e[t]&&(i=e[t].indexOf(r),e[t].splice(i,1)),n&&((e=this.displayObjectDependencyMap.get(n))||(this.displayObjectDependencyMap.set(n,{}),e=this.displayObjectDependencyMap.get(n)),e[t]||(e[t]=[]),e[t].push(r))},e.informDependentDisplayObjects=function(t){var n=this,r=this.displayObjectDependencyMap.get(t);r&&Object.keys(r).forEach(function(e){r[e].forEach(function(t){n.dirtifyToRoot(t,!0),t.dispatchEvent(new ja(v.ATTR_MODIFIED,t,n,n,e,ja.MODIFICATION,n,n)),t.isCustomElement&&t.isConnected&&t.attributeChangedCallback&&t.attributeChangedCallback(e,n,n)})})},e.getPosition=function(t){var e=t.transformable;return pt(e.position,this.getWorldTransform(t,e))},e.getRotation=function(t){var e=t.transformable;return mt(e.rotation,this.getWorldTransform(t,e))},e.getScale=function(t){var e=t.transformable;return gt(e.scaling,this.getWorldTransform(t,e))},e.getWorldTransform=function(t,e){return((e=void 0===e?t.transformable:e).localDirtyFlag||e.dirtyFlag)&&(t.parentNode&&t.parentNode.transformable&&this.getWorldTransform(t.parentNode),this.sync(t,e)),e.worldTransform},e.getLocalPosition=function(t){return t.transformable.localPosition},e.getLocalRotation=function(t){return t.transformable.localRotation},e.getLocalScale=function(t){return t.transformable.localScale},e.getLocalSkew=function(t){return t.transformable.localSkew},e.getLocalTransform=function(t){t=t.transformable;return t.localDirtyFlag&&(this.calcLocalTransform(t),t.localDirtyFlag=!1),t.localTransform},e.setLocalTransform=function(t,e){var n=pt(y(),e),r=mt(zt(),e),e=gt(y(),e);this.setLocalScale(t,e),this.setLocalPosition(t,n),this.setLocalRotation(t,r)},e.resetLocalTransform=function(t){this.setLocalScale(t,[1,1,1]),this.setLocalPosition(t,[0,0,0]),this.setLocalEulerAngles(t,[0,0,0]),this.setLocalSkew(t,[0,0])},e.getTransformedGeometryBounds=function(t,e,n){e=this.getGeometryBounds(t,e=void 0===e?!1:e);return Ta.isEmpty(e)?null:((n=n||new Ta).setFromTransformedAABB(e,this.getWorldTransform(t)),n)},e.getGeometryBounds=function(t,e){t=t.geometry;return((e=void 0===e?!1:e)?t.renderBounds:t.contentBounds||null)||new Ta},e.getBounds=function(t,e){var n,r,i=this,o=(void 0===e&&(e=!1),t.renderable);return o.boundsDirty||e||!o.bounds?!o.renderBoundsDirty&&e&&o.renderBounds?o.renderBounds:(n=e?o.renderBounds:o.bounds,r=this.getTransformedGeometryBounds(t,e,n),t.childNodes.forEach(function(t){t=i.getBounds(t,e);t&&(r?r.add(t):(r=n||new Ta).update(t.center,t.halfExtents))}),e&&(t=Wr(t))&&(t=t.parsedStyle.clipPath.getBounds(e),r?t&&(r=t.intersection(r)):r=t),(r=r||new Ta)&&(e?o.renderBounds=r:o.bounds=r),e?o.renderBoundsDirty=!1:o.boundsDirty=!1,r):o.bounds},e.getLocalBounds=function(t){if(t.parentNode){var e,n=K(),r=(t.parentNode.transformable&&(n=et(K(),this.getWorldTransform(t.parentNode))),this.getBounds(t));if(!Ta.isEmpty(r))return(e=new Ta).setFromTransformedAABB(r,n),e}return this.getBounds(t)},e.getBoundingClientRect=function(t){var e,n,r,i=this.getGeometryBounds(t),i=(Ta.isEmpty(i)||(r=new Ta).setFromTransformedAABB(i,this.getWorldTransform(t)),null==(i=t.ownerDocument)||null==(t=i.defaultView)?void 0:t.getContextService().getBoundingClientRect());return r?(e=(t=r.getMin())[0],t=t[1],n=(r=r.getMax())[0],r=r[1],new Na(e+((null==i?void 0:i.left)||0),t+((null==i?void 0:i.top)||0),n-e,r-t)):new Na((null==i?void 0:i.left)||0,(null==i?void 0:i.top)||0,0,0)},e.dirtifyWorldInternal=function(t,e){var n=this;!e.dirtyFlag&&(e.dirtyFlag=!0,e.frozen=!1,t.childNodes.forEach(function(t){var e=t.transformable;e.dirtyFlag||n.dirtifyWorldInternal(t,e)}),e=t.renderable)&&(e.renderBoundsDirty=!0,e.boundsDirty=!0,e.dirty=!0)},e.syncHierarchy=function(t){var e=t.transformable;if(!e.frozen){e.frozen=!0,(e.localDirtyFlag||e.dirtyFlag)&&this.sync(t,e);for(var n=t.childNodes,r=0;r<n.length;r++)this.syncHierarchy(n[r])}},e.sync=function(t,e){var n;e.localDirtyFlag&&(this.calcLocalTransform(e),e.localDirtyFlag=!1),e.dirtyFlag&&(n=(t=t.parentNode)&&t.transformable,null!==t&&n?rt(e.worldTransform,n.worldTransform,e.localTransform):$(e.worldTransform,e.localTransform),e.dirtyFlag=!1)},e.unfreezeParentToRoot=function(t){for(var e=t.parentNode;e;){var n=e.transformable;n&&(n.frozen=!1),e=e.parentNode}},t}(),Qs={MetricsString:"|ÉqÅ",BaselineSymbol:"M",BaselineMultiplier:1.4,HeightMultiplier:2,Newlines:[10,13],BreakingSpaces:[9,32,8192,8193,8194,8195,8196,8197,8198,8200,8201,8202,8287,12288]},Js=/[a-zA-Z0-9\u00C0-\u00D6\u00D8-\u00f6\u00f8-\u00ff!"#$%&'()*+,-./:;]/,tl=new RegExp(/[!%),.:;?\]}¢°·'""†‡›℃∶、。〃〆〕〗〞﹚﹜!"%'),.:;?!]}~]/.source+"|"+/[!),.:;?\]}¢·–—'"•"、。〆〞〕〉》」︰︱︲︳﹐﹑﹒﹔﹕﹖﹘﹚﹜!),.:;?︶︸︺︼︾﹀﹂﹗]|}、]/.source+"|"+/[)\]}〕〉》」』】〙〗〟'"⦆»ヽヾーァィゥェォッャュョヮヵヶぁぃぅぇぉっゃゅょゎゕゖㇰㇱㇲㇳㇴㇵㇶㇷㇸㇹㇺㇻㇼㇽㇾㇿ々〻‐゠–〜?!‼⁇⁈⁉・、:;,。.]/.source+"|"+/[!%),.:;?\]}¢°'"†‡℃〆〈《「『〕!%),.:;?]}]/.source),el=new RegExp(/[$(£¥·'"〈《「『【〔〖〝﹙﹛$(.[{£¥]/.source+"|"+/[([{£¥'"‵〈《「『〔〝︴﹙﹛({︵︷︹︻︽︿﹁﹃﹏]/.source+"|"+/[([{〔〈《「『【〘〖〝'"⦅«—...‥〳〴〵]/.source+"|"+/[$([{£¥'"々〇〉》」〔$([{⦆¥₩#]/.source),nl=function(){function t(t){var n=this;this.runtime=void 0,this.fontMetricsCache={},this.shouldBreakByKinsokuShorui=function(t,e){return!n.isBreakingSpace(e)&&!(!t||!el.exec(e)&&!tl.exec(t))},this.trimByKinsokuShorui=function(t){var e,n=[].concat(t),r=n[n.length-2];return r?(e=r[r.length-1],n[n.length-2]=r.slice(0,-1),n[n.length-1]=e+n[n.length-1],n):t},this.runtime=t}var e=t.prototype;return e.measureFont=function(t,e){if(this.fontMetricsCache[t])return this.fontMetricsCache[t];for(var n={ascent:0,descent:0,fontSize:0},r=this.runtime.offscreenCanvas.getOrCreateCanvas(e),e=this.runtime.offscreenCanvas.getOrCreateContext(e),i=(e.font=t,Qs.MetricsString+Qs.BaselineSymbol),o=Math.ceil(e.measureText(i).width),a=Math.ceil(e.measureText(Qs.BaselineSymbol).width),s=Qs.HeightMultiplier*a,a=a*Qs.BaselineMultiplier|0,l=(r.width=o,r.height=s,e.fillStyle="#f00",e.fillRect(0,0,o,s),e.font=t,e.textBaseline="alphabetic",e.fillStyle="#000",e.fillText(i,0,a),e.getImageData(0,0,o||1,s||1).data),r=l.length,u=4*o,c=0,h=0,d=!1,c=0;c<a;++c){for(var f=0;f<u;f+=4)if(255!==l[h+f]){d=!0;break}if(d)break;h+=u}for(n.ascent=a-c,h=r-u,d=!1,c=s;a<c;--c){for(var p=0;p<u;p+=4)if(255!==l[h+p]){d=!0;break}if(d)break;h-=u}return n.descent=c-a,n.fontSize=n.ascent+n.descent,this.fontMetricsCache[t]=n},e.measureText=function(t,e,n){var r=e.fontSize,i=e.wordWrap,o=e.lineHeight,a=e.lineWidth,s=e.textBaseline,l=e.textAlign,u=e.letterSpacing,c=e.textPath,h=(e.textPathSide,e.textPathStartOffset,e.leading),h=void 0===h?0:h,d=function(t){for(var e=t.fontSize,n=t.fontFamily,r=t.fontStyle,i=t.fontVariant,t=t.fontWeight,e=B(e)&&e+"px"||"16px",o=n.split(","),a=o.length-1;0<=a;a--){var s=o[a].trim();!ro.test(s)&&no.indexOf(s)<0&&(s='"'+s+'"'),o[a]=s}return r+" "+i+" "+t+" "+e+" "+o.join(",")}(e),f=this.measureFont(d,n),p=(0===f.fontSize&&(f.fontSize=r,f.ascent=r),this.runtime.offscreenCanvas.getOrCreateContext(n));p.font=d,e.isOverflowing=!1;var g=(i?this.wordWrap(t,e,n):t).split(/(?:\r\n|\r|\n)/),m=new Array(g.length),v=0;if(!c){for(var y=0;y<g.length;y++){var E=p.measureText(g[y]).width+(g[y].length-1)*u;m[y]=E,v=Math.max(v,E)}var r=v+a,_=o||f.fontSize+a,i=Math.max(_,f.fontSize+a)+(g.length-1)*(_+h),b=0;return"middle"===s?b=-i/2:"bottom"===s||"alphabetic"===s||"ideographic"===s?b=-i:"top"!==s&&"hanging"!==s||(b=0),{font:d,width:r,height:i,lines:g,lineWidths:m,lineHeight:_+=h,maxLineWidth:v,fontProperties:f,lineMetrics:m.map(function(t,e){var n=0;return"center"===l||"middle"===l?n-=t/2:"right"!==l&&"end"!==l||(n-=t),new Na(n-a/2,b+e*_,t+a,_)})}}c.getTotalLength();for(var x=0;x<g.length;x++)p.measureText(g[x]).width,g[x].length},e.setGraphemeOnPath=function(){},e.wordWrap=function(t,e,n){for(var r=this,i=e.wordWrapWidth,i=void 0===i?0:i,o=e.letterSpacing,a=e.maxLines,s=void 0===a?1/0:a,a=e.textOverflow,l=this.runtime.offscreenCanvas.getOrCreateContext(n),u=i+o,c="",h=("ellipsis"===a?c="...":a&&"clip"!==a&&(c=a),[]),d=0,f=0,p={},g=function(t){return r.getFromCache(t,o,p,l)},m=Array.from(c).reduce(function(t,e){return t+g(e)},0),v=Array.from(t),y=0;y<v.length;y++){var E=v[y],_=t[y-1],b=t[y+1],x=g(E);if(this.isNewline(E)){if(s<=++d){e.isOverflowing=!0;break}f=0,h[d]=""}else{if(0<f&&u<f+x){if(s<=d+1){if(e.isOverflowing=!0,0<m&&m<=u){for(var S=h[d].length,w=0,T=S,A=0;A<S;A++){var M=g(h[d][A]);if(u<w+M+m){T=A;break}w+=M}h[d]=(h[d]||"").slice(0,T)+c}break}if(f=0,h[++d]="",this.isBreakingSpace(E))continue;this.canBreakInLastChar(E)||(h=this.trimToBreakable(h),f=this.sumTextWidthByCache(h[d]||"",p)),this.shouldBreakByKinsokuShorui(E,b)&&(h=this.trimByKinsokuShorui(h),f+=g(_||""))}f+=x,h[d]=(h[d]||"")+E}}return h.join("\n")},e.isBreakingSpace=function(t){return"string"==typeof t&&0<=Qs.BreakingSpaces.indexOf(t.charCodeAt(0))},e.isNewline=function(t){return"string"==typeof t&&0<=Qs.Newlines.indexOf(t.charCodeAt(0))},e.trimToBreakable=function(t){var e,t=[].concat(t),n=t[t.length-2],r=this.findBreakableIndex(n);return-1!==r&&n&&(e=n.slice(r,r+1),e=r+(this.isBreakingSpace(e)?0:1),t[t.length-1]+=n.slice(r+1,n.length),t[t.length-2]=n.slice(0,e)),t},e.canBreakInLastChar=function(t){return!t||!Js.test(t)},e.sumTextWidthByCache=function(t,n){return t.split("").reduce(function(t,e){if(n[e])return t+n[e];throw Error("cannot count the word without cache")},0)},e.findBreakableIndex=function(t){for(var e=t.length-1;0<=e;e--)if(!Js.test(t[e]))return e;return-1},e.getFromCache=function(t,e,n,r){var i=n[t];return"number"!=typeof i&&(e=t.length*e,i=r.measureText(t).width+e,n[t]=i),i},t}(),ct={},o=(l=new l,Ws=new Ws,(E={})[lt.CIRCLE]=new o,E[lt.ELLIPSE]=new Us,E[lt.RECT]=l,E[lt.IMAGE]=l,E[lt.GROUP]=l,E[lt.LINE]=new a,E[lt.TEXT]=new Vs(ct),E[lt.POLYLINE]=Ws,E[lt.POLYGON]=Ws,E[lt.PATH]=new Gs,E[lt.HTML]=null,E[lt.MESH]=null,E),Vs=(Us=new n,l=new ya,(a={})[b.PERCENTAGE]=null,a[b.NUMBER]=new Sa,a[b.ANGLE]=new t,a[b.DEFINED_PATH]=new e,a[b.PAINT]=Us,a[b.COLOR]=Us,a[b.FILTER]=new pa,a[b.LENGTH]=l,a[b.LENGTH_PERCENTAGE]=l,a[b.LENGTH_PERCENTAGE_12]=new Ea,a[b.LENGTH_PERCENTAGE_14]=new _a,a[b.COORDINATE]=new ba,a[b.OFFSET_DISTANCE]=new r,a[b.OPACITY_VALUE]=new wa,a[b.PATH]=new Ca,a[b.LIST_OF_POINTS]=new Pa,a[b.SHADOW_BLUR]=new Oa,a[b.TEXT]=new Ia,a[b.TEXT_TRANSFORM]=new La,a[b.TRANSFORM]=new ka,a[b.TRANSFORM_ORIGIN]=new ma,a[b.Z_INDEX]=new Da,a[b.MARKER]=new xa,a),Ws=(ct.CameraContribution=Fs,ct.AnimationTimeline=null,ct.EasingFunction=null,ct.offscreenCanvas=new zs,ct.nativeHTMLMap=new WeakMap,ct.sceneGraphSelector=new Ys,ct.sceneGraphService=new Zs(ct),ct.textService=new nl(ct),ct.geometryUpdaterFactory=o,ct.CSSPropertySyntaxFactory=Vs,ct.styleValueRegistry=new ks,ct.layoutRegistry=null,ct.globalThis=function(){if("undefined"!=typeof globalThis)return globalThis;if("undefined"!=typeof self)return self;if("undefined"!=typeof window)return window;if(void 0!==V)return V;throw new Error("Unable to locate global `this`")}(),ct.enableCSSParsing=!0,ct.enableDataset=!1,ct.enableStyleSyntax=!0,function(){function t(){this.context=void 0,this.plugins=[]}var e=t.prototype;return e.addRenderingPlugin=function(t){this.plugins.push(t),this.context.renderingPlugins.push(t)},e.removeAllRenderingPlugins=function(){var e=this;this.plugins.forEach(function(t){t=e.context.renderingPlugins.indexOf(t);0<=t&&e.context.renderingPlugins.splice(t,1)})},t}()),Gs=function(){function t(t){this.plugins=[],this.config=void 0,this.config=d({enableDirtyCheck:!0,enableCulling:!1,enableAutoRendering:!0,enableDirtyRectangleRendering:!0,enableDirtyRectangleRenderingDebug:!1},t)}var e=t.prototype;return e.registerPlugin=function(e){-1===this.plugins.findIndex(function(t){return t===e})&&this.plugins.push(e)},e.unregisterPlugin=function(e){var t=this.plugins.findIndex(function(t){return t===e});-1<t&&this.plugins.splice(t,1)},e.getPlugins=function(){return this.plugins},e.getPlugin=function(e){return this.plugins.find(function(t){return t.name===e})},e.getConfig=function(){return this.config},e.setConfig=function(t){Object.assign(this.config,t)},t}(),rl=function(){function o(t){this.strategies=void 0,this.strategies=t}return o.prototype.apply=function(t){var n=t.camera,e=t.renderingService,r=t.renderingContext,i=this.strategies;e.hooks.cull.tap(o.tag,function(e){var t;return e&&(t=e.cullable,0===i.length?t.visible=-1<r.unculledEntities.indexOf(e.entity):t.visible=i.every(function(t){return t.isVisible(n,e)}),!e.isCulled()&&e.isVisible()?e:(e.dispatchEvent(new Ga(v.CULLED)),null))}),e.hooks.afterRender.tap(o.tag,function(t){t.cullable.visibilityPlaneMask=-1})},o}(),il=(rl.tag="Culling",function(){function n(){}return n.prototype.apply=function(t){var e=t.renderingService;e.hooks.dirtycheck.tap(n.tag,function(t){return t&&(t.renderable.dirty||e.disableDirtyRectangleRendering()?t:null)})},n}()),ol=(il.tag="DirtyCheck",function(){function e(){var o=this;this.autoPreventDefault=!1,this.rootPointerEvent=new $a(null),this.rootWheelEvent=new Za(null),this.context=void 0,this.onPointerMove=function(t){var e,n=null==(e=o.context.renderingContext.root)||null==(e=e.ownerDocument)?void 0:e.defaultView;if(!n.supportsTouchEvents||"touch"!==t.pointerType){for(var r=ar(o.normalizeToPointerEvent(t,n));!(i=r()).done;){var i=i.value,i=o.bootstrapEvent(o.rootPointerEvent,i,n,t);o.context.eventService.mapEvent(i)}o.setCursor(o.context.eventService.cursor)}}}var t=e.prototype;return t.apply=function(t){var o=this,t=(this.context=t).renderingService,a=this.context.renderingContext.root.ownerDocument.defaultView;this.context.eventService.setPickHandler(function(t){return o.context.renderingService.hooks.pickSync.call({position:t,picked:[],topmost:!0}).picked[0]||null}),t.hooks.pointerWheel.tap(e.tag,function(t){t=o.normalizeWheelEvent(t);o.context.eventService.mapEvent(t)}),t.hooks.pointerDown.tap(e.tag,function(t){if(!a.supportsTouchEvents||"touch"!==t.pointerType){var e=o.normalizeToPointerEvent(t,a);!o.autoPreventDefault||!e[0].isNormalized||!t.cancelable&&"cancelable"in t||t.preventDefault();for(var n=ar(e);!(r=n()).done;){var r=r.value,r=o.bootstrapEvent(o.rootPointerEvent,r,a,t);o.context.eventService.mapEvent(r)}o.setCursor(o.context.eventService.cursor)}}),t.hooks.pointerUp.tap(e.tag,function(t){if(!a.supportsTouchEvents||"touch"!==t.pointerType){var e=o.context.contextService.getDomElement(),n="outside";try{n=e&&t.target&&t.target!==e&&e.contains&&!e.contains(t.target)?"outside":""}catch(t){}for(var r=ar(o.normalizeToPointerEvent(t,a));!(i=r()).done;){var i=i.value,i=o.bootstrapEvent(o.rootPointerEvent,i,a,t);i.type+=n,o.context.eventService.mapEvent(i)}o.setCursor(o.context.eventService.cursor)}}),t.hooks.pointerMove.tap(e.tag,this.onPointerMove),t.hooks.pointerOver.tap(e.tag,this.onPointerMove),t.hooks.pointerOut.tap(e.tag,this.onPointerMove),t.hooks.click.tap(e.tag,this.onPointerMove),t.hooks.pointerCancel.tap(e.tag,function(t){for(var e=ar(o.normalizeToPointerEvent(t,a));!(n=e()).done;){var n=n.value,n=o.bootstrapEvent(o.rootPointerEvent,n,a,t);o.context.eventService.mapEvent(n)}o.setCursor(o.context.eventService.cursor)})},t.getViewportXY=function(t){var e,n=t.offsetX,r=t.offsetY,i=t.clientX,t=t.clientY;return t=!this.context.config.supportsCSSTransform||M(n)||M(r)?(e=(i=this.context.eventService.client2Viewport(new Ra(i,t))).x,i.y):(e=n,r),{x:e,y:t}},t.bootstrapEvent=function(t,e,n,r){t.view=n,t.originalEvent=null,t.nativeEvent=r,t.pointerId=e.pointerId,t.width=e.width,t.height=e.height,t.isPrimary=e.isPrimary,t.pointerType=e.pointerType,t.pressure=e.pressure,t.tangentialPressure=e.tangentialPressure,t.tiltX=e.tiltX,t.tiltY=e.tiltY,t.twist=e.twist,this.transferMouseData(t,e);n=this.getViewportXY(e),e=n.x,n=n.y,t.viewport.x=e,t.viewport.y=n,e=this.context.eventService.viewport2Canvas(t.viewport),n=e.x,e=e.y;return t.canvas.x=n,t.canvas.y=e,t.global.copyFrom(t.canvas),t.offset.copyFrom(t.canvas),t.isTrusted=r.isTrusted,"pointerleave"===t.type&&(t.type="pointerout"),t.type.startsWith("mouse")&&(t.type=t.type.replace("mouse","pointer")),t.type.startsWith("touch")&&(t.type=Yr[t.type]||t.type),t},t.normalizeWheelEvent=function(t){var e=this.rootWheelEvent,n=(this.transferMouseData(e,t),e.deltaMode=t.deltaMode,e.deltaX=t.deltaX,e.deltaY=t.deltaY,e.deltaZ=t.deltaZ,this.getViewportXY(t)),r=n.x,n=n.y,r=(e.viewport.x=r,e.viewport.y=n,this.context.eventService.viewport2Canvas(e.viewport)),n=r.x,r=r.y;return e.canvas.x=n,e.canvas.y=r,e.global.copyFrom(e.canvas),e.offset.copyFrom(e.canvas),e.nativeEvent=t,e.type=t.type,e},t.transferMouseData=function(t,e){t.isTrusted=e.isTrusted,t.srcElement=e.srcElement,t.timeStamp=performance.now(),t.type=e.type,t.altKey=e.altKey,t.metaKey=e.metaKey,t.shiftKey=e.shiftKey,t.ctrlKey=e.ctrlKey,t.button=e.button,t.buttons=e.buttons,t.client.x=e.clientX,t.client.y=e.clientY,t.movement.x=e.movementX,t.movement.y=e.movementY,t.page.x=e.pageX,t.page.y=e.pageY,t.screen.x=e.screenX,t.screen.y=e.screenY,t.relatedTarget=null},t.setCursor=function(t){this.context.contextService.applyCursorStyle(t||this.context.config.cursor||"default")},t.normalizeToPointerEvent=function(t,e){var n=[];if(e.isTouchEvent(t))for(var r=0;r<t.changedTouches.length;r++){var i=t.changedTouches[r];je(i.button)&&(i.button=0),je(i.buttons)&&(i.buttons=1),je(i.isPrimary)&&(i.isPrimary=1===t.touches.length&&"touchstart"===t.type),je(i.width)&&(i.width=i.radiusX||1),je(i.height)&&(i.height=i.radiusY||1),je(i.tiltX)&&(i.tiltX=0),je(i.tiltY)&&(i.tiltY=0),je(i.pointerType)&&(i.pointerType="touch"),je(i.pointerId)&&(i.pointerId=i.identifier||0),je(i.pressure)&&(i.pressure=i.force||.5),je(i.twist)&&(i.twist=0),je(i.tangentialPressure)&&(i.tangentialPressure=0),i.isNormalized=!0,i.type=t.type,n.push(i)}else e.isMouseEvent(t)?(je((e=t).isPrimary)&&(e.isPrimary=!0),je(e.width)&&(e.width=1),je(e.height)&&(e.height=1),je(e.tiltX)&&(e.tiltX=0),je(e.tiltY)&&(e.tiltY=0),je(e.pointerType)&&(e.pointerType="mouse"),je(e.pointerId)&&(e.pointerId=1),je(e.pressure)&&(e.pressure=.5),je(e.twist)&&(e.twist=0),je(e.tangentialPressure)&&(e.tangentialPressure=0),e.isNormalized=!0,n.push(e)):n.push(t);return n},e}()),al=(ol.tag="Event",[lt.CIRCLE,lt.ELLIPSE,lt.IMAGE,lt.RECT,lt.LINE,lt.POLYLINE,lt.POLYGON,lt.TEXT,lt.PATH,lt.HTML]),sl=function(){function t(){}var e=t.prototype;return e.isVisible=function(t,e){var n,r,i=e.cullable;return!i.enable||(n=e.getRenderBounds(),!Ta.isEmpty(n)&&(t=t.getFrustum(),r=null==(r=e.parentNode)||null==(r=r.cullable)?void 0:r.visibilityPlaneMask,i.visibilityPlaneMask=this.computeVisibilityWithPlaneMask(e,n,r||va.INDETERMINATE,t.planes),i.visible=i.visibilityPlaneMask!==va.OUTSIDE,i.visible))},e.computeVisibilityWithPlaneMask=function(t,e,n,r){if(n===va.OUTSIDE||n===va.INSIDE)return n;for(var i=va.INSIDE,o=-1<al.indexOf(t.nodeName),a=0,s=r.length;a<s;++a){var l=1<<a;if(0!=(n&l)&&(!o||4!==a&&5!==a)){var u=r[a],c=u.normal,u=u.distance;if(Lt(c,e.getPositiveFarPoint(r[a]))+u<0)return va.OUTSIDE;Lt(c,e.getNegativeFarPoint(r[a]))+u<0&&(i|=l)}}return i},t}(),ll=function(){function u(){this.rBush=void 0,this.toSync=new Set}var t=u.prototype;return t.apply=function(t){function e(t){t.target.renderable.dirty=!0,a.dirtify()}function n(t){for(var e=t.detail.affectChildren,t=t.target,n=(e&&t.forEach(function(t){o.toSync.add(t)}),t);n;)n.renderable&&o.toSync.add(n),n=n.parentElement;a.dirtify()}function r(t){t=t.target,ct.enableCSSParsing&&ct.styleValueRegistry.recalc(t),ct.sceneGraphService.dirtifyToRoot(t),a.dirtify()}function i(t){var e=(t=t.target).rBushNode;e.aabb&&o.rBush.remove(e.aabb),o.toSync.delete(t),ct.sceneGraphService.dirtifyToRoot(t),a.dirtify()}var o=this,a=t.renderingService,s=t.renderingContext,t=t.rBushRoot,l=s.root.ownerDocument.defaultView;this.rBush=t;a.hooks.init.tapPromise(u.tag,Qn($n().mark(function t(){return $n().wrap(function(t){for(;;)switch(t.prev=t.next){case 0:l.addEventListener(v.MOUNTED,r),l.addEventListener(v.UNMOUNTED,i),l.addEventListener(v.ATTR_MODIFIED,e),l.addEventListener(v.BOUNDS_CHANGED,n);case 4:case"end":return t.stop()}},t)}))),a.hooks.destroy.tap(u.tag,function(){l.removeEventListener(v.MOUNTED,r),l.removeEventListener(v.UNMOUNTED,i),l.removeEventListener(v.ATTR_MODIFIED,e),l.removeEventListener(v.BOUNDS_CHANGED,n),o.toSync.clear()}),a.hooks.endFrame.tap(u.tag,function(){o.syncRTree()})},t.syncRTree=function(){var a=this,s=[];Array.from(this.toSync).filter(function(t){return t.isConnected}).forEach(function(t){var e,n,r,i=t.rBushNode,o=(i&&i.aabb&&a.rBush.remove(i.aabb),t.getRenderBounds());o&&(e=(n=o.getMin())[0],n=n[1],r=(o=o.getMax())[0],o=o[1],i.aabb||(i.aabb={}),i.aabb.displayObject=t,i.aabb.minX=e,i.aabb.minY=n,i.aabb.maxX=r,i.aabb.maxY=o),!i.aabb||isNaN(i.aabb.maxX)||isNaN(i.aabb.maxX)||isNaN(i.aabb.minX)||isNaN(i.aabb.minY)||s.push(i.aabb)}),this.rBush.load(s),s.length=0,this.toSync.clear()},u}(),ul=(ll.tag="Prepare",(E=qs=qs||{}).READY="ready",E.BEFORE_RENDER="beforerender",E.RERENDER="rerender",E.AFTER_RENDER="afterrender",E.BEFORE_DESTROY="beforedestroy",E.AFTER_DESTROY="afterdestroy",E.RESIZE="resize",E.DIRTY_RECTANGLE="dirtyrectangle",new Ga(v.MOUNTED)),cl=new Ga(v.UNMOUNTED),hl=new Ga(qs.BEFORE_RENDER),dl=new Ga(qs.RERENDER),fl=new Ga(qs.AFTER_RENDER),pl=function(w){function t(t){var e=w.call(this)||this,n=(e.document=void 0,e.customElements=void 0,e.requestAnimationFrame=void 0,e.cancelAnimationFrame=void 0,e.devicePixelRatio=void 0,e.supportsPointerEvents=void 0,e.supportsTouchEvents=void 0,e.isTouchEvent=void 0,e.isMouseEvent=void 0,e.Element=as,e.frameId=void 0,e.inited=!1,e.readyPromise=void 0,e.resolveReadyPromise=void 0,e.context={},e.document=new Va,e.document.defaultView=ir(e),e.customElements=new Ba,t.container),r=t.canvas,i=t.offscreenCanvas,o=t.width,a=t.height,s=t.devicePixelRatio,l=t.renderer,u=t.background,c=t.cursor,h=t.document,d=t.requestAnimationFrame,f=t.cancelAnimationFrame,p=t.createImage,g=t.supportsPointerEvents,m=t.supportsTouchEvents,v=t.supportsCSSTransform,y=t.useNativeClickEvent,E=t.alwaysTriggerPointerEventOnCanvas,_=t.isTouchEvent,t=t.isMouseEvent,b=(b=n,x=ir(e),b&&(b="string"==typeof b?b:b.id||Fr++,Br[b]&&Br[b].destroy(),Br[b]=x),o),x=a,S=s;return r&&(S=1<=(S=s||Ur&&window.devicePixelRatio||1)?Math.ceil(S):1,b=o||("auto"===(o=zr(s=r,"width"))?s.offsetWidth:parseFloat(o))||r.width/S,x=a||("auto"===(o=zr(s=r,"height"))?s.offsetHeight:parseFloat(o))||r.height/S),e.devicePixelRatio=S,e.requestAnimationFrame=null!=d?d:po.bind(ct.globalThis),e.cancelAnimationFrame=null!=f?f:go.bind(ct.globalThis),e.supportsTouchEvents=null!=m?m:"ontouchstart"in ct.globalThis,e.supportsPointerEvents=null!=g?g:!!ct.globalThis.PointerEvent,e.isTouchEvent=null!=_?_:function(t){return e.supportsTouchEvents&&t instanceof ct.globalThis.TouchEvent},e.isMouseEvent=null!=t?t:function(t){return!ct.globalThis.MouseEvent||t instanceof ct.globalThis.MouseEvent&&(!e.supportsPointerEvents||!(t instanceof ct.globalThis.PointerEvent))},e.initRenderingContext({container:n,canvas:r,width:b,height:x,renderer:l,offscreenCanvas:i,devicePixelRatio:S,cursor:c||"default",background:u||"transparent",createImage:p,document:h,supportsCSSTransform:v,useNativeClickEvent:y,alwaysTriggerPointerEventOnCanvas:E}),e.initDefaultCamera(b,x),Qn($n().mark(function t(){return $n().wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,e.initRenderer(l);case 2:e.dispatchEvent(new Ga(qs.READY)),e.readyPromise&&e.resolveReadyPromise();case 4:case"end":return t.stop()}},t)}))(),e}er(t,w);var e=t.prototype;return e.initRenderingContext=function(t){this.context.config=t,this.context.renderingContext={root:this.document.documentElement,renderListCurrentFrame:[],unculledEntities:[],renderReasons:new Set,force:!1,dirty:!1}},e.initDefaultCamera=function(t,e){var n=this,r=new ct.CameraContribution;r.setType(Qa.EXPLORING,Ja.DEFAULT).setPosition(t/2,e/2,500).setFocalPoint(t/2,e/2,0).setOrthographic(t/-2,t/2,e/2,e/-2,.1,1e3),r.canvas=this,r.eventEmitter.on(Bs,function(){n.context.renderingContext.renderReasons.add(Ds.CAMERA_CHANGED)}),this.context.camera=r},e.getConfig=function(){return this.context.config},e.getRoot=function(){return this.document.documentElement},e.getCamera=function(){return this.context.camera},e.getContextService=function(){return this.context.contextService},e.getEventService=function(){return this.context.eventService},e.getRenderingService=function(){return this.context.renderingService},e.getRenderingContext=function(){return this.context.renderingContext},e.getStats=function(){return this.getRenderingService().getStats()},e.destroy=function(t,e){void 0===t&&(t=!0),(e=void 0===e?!1:e)||this.dispatchEvent(new Ga(qs.BEFORE_DESTROY)),this.frameId&&(this.getConfig().cancelAnimationFrame||cancelAnimationFrame)(this.frameId);var n=this.getRoot();this.unmountChildren(n),t&&(this.document.destroy(),this.getEventService().destroy()),this.getRenderingService().destroy(),this.getContextService().destroy(),t&&this.context.rBushRoot&&(this.context.rBushRoot.clear(),this.context.rBushRoot=null,this.context.renderingContext.root=null),e||this.dispatchEvent(new Ga(qs.AFTER_DESTROY))},e.changeSize=function(t,e){this.resize(t,e)},e.resize=function(t,e){var n=this.context.config,n=(n.width=t,n.height=e,this.getContextService().resize(t,e),this.context.camera),r=n.getProjectionMode();n.setPosition(t/2,e/2,500).setFocalPoint(t/2,e/2,0),r===ts.ORTHOGRAPHIC?n.setOrthographic(t/-2,t/2,e/2,e/-2,n.getNear(),n.getFar()):n.setAspect(t/e),this.dispatchEvent(new Ga(qs.RESIZE,{width:t,height:e}))},e.appendChild=function(t,e){return this.document.documentElement.appendChild(t,e)},e.insertBefore=function(t,e){return this.document.documentElement.insertBefore(t,e)},e.removeChild=function(t){return this.document.documentElement.removeChild(t)},e.removeChildren=function(){this.document.documentElement.removeChildren()},e.destroyChildren=function(){this.document.documentElement.destroyChildren()},e.render=function(){var t=this;this.dispatchEvent(hl),this.getRenderingService().render(this.getConfig(),function(){t.dispatchEvent(dl)}),this.dispatchEvent(fl)},e.run=function(){var e=this;(function t(){e.render(),e.frameId=requestAnimationFrame(t)})()},e.initRenderer=function(){var e=Qn($n().mark(function t(e){return $n().wrap(function(t){for(;;)switch(t.prev=t.next){case 0:if(e){t.next=2;break}throw new Error("Renderer is required.");case 2:return this.inited=!1,this.readyPromise=void 0,this.context.rBushRoot=new z,this.context.renderingPlugins=[],this.context.renderingPlugins.push(new ol,new ll,new il,new rl([new sl])),this.loadRendererContainerModule(e),this.context.contextService=new this.context.ContextService(d({},ct,this.context)),this.context.renderingService=new Hs(ct,this.context),this.context.eventService=new js(ct,this.context),this.context.eventService.init(),t.next=14,this.context.contextService.init();case 14:return t.next=16,this.context.renderingService.init();case 16:this.inited=!0,this.getRoot().forEach(function(t){t=t.renderable;t&&(t.renderBoundsDirty=!0,t.boundsDirty=!0,t.dirty=!0)}),this.mountChildren(this.getRoot()),e.getConfig().enableAutoRendering&&this.run();case 20:case"end":return t.stop()}},t,this)}));return function(t){return e.apply(this,arguments)}}(),e.loadRendererContainerModule=function(t){var e=this;t.getPlugins().forEach(function(t){t.context=e.context,t.init(ct)})},e.setRenderer=function(){var e=Qn($n().mark(function t(e){var n,r;return $n().wrap(function(t){for(;;)switch(t.prev=t.next){case 0:if((n=this.getConfig()).renderer===e)return t.abrupt("return");t.next=3;break;case 3:return r=n.renderer,n.renderer=e,this.destroy(!1,!0),[].concat(null==r?void 0:r.getPlugins()).reverse().forEach(function(t){t.destroy(ct)}),t.next=9,this.initRenderer(e);case 9:case"end":return t.stop()}},t,this)}));return function(t){return e.apply(this,arguments)}}(),e.setCursor=function(t){this.getConfig().cursor=t,this.getContextService().applyCursorStyle(t)},e.unmountChildren=function(t){var e=this;t.childNodes.forEach(function(t){e.unmountChildren(t)}),this.inited&&(t.isMutationObserved?t.dispatchEvent(cl):(cl.target=t,this.dispatchEvent(cl,!0)),t!==this.document.documentElement&&(t.ownerDocument=null),t.isConnected=!1),t.isCustomElement&&t.disconnectedCallback&&t.disconnectedCallback()},e.mountChildren=function(t){var e=this;this.inited?t.isConnected||(t.ownerDocument=this.document,t.isConnected=!0,t.isMutationObserved?t.dispatchEvent(ul):(ul.target=t,this.dispatchEvent(ul,!0))):console.warn("[g]: You are trying to call `canvas.appendChild` before canvas' initialization finished. You can either await `canvas.ready` or listen to `CanvasEvent.READY` manually.","appended child: ",t.nodeName),t.childNodes.forEach(function(t){e.mountChildren(t)}),t.isCustomElement&&t.connectedCallback&&t.connectedCallback()},e.client2Viewport=function(t){return this.getEventService().client2Viewport(t)},e.viewport2Client=function(t){return this.getEventService().viewport2Client(t)},e.viewport2Canvas=function(t){return this.getEventService().viewport2Canvas(t)},e.canvas2Viewport=function(t){return this.getEventService().canvas2Viewport(t)},e.getPointByClient=function(t,e){return this.client2Viewport({x:t,y:e})},e.getClientByPoint=function(t,e){return this.viewport2Client({x:t,y:e})},tr(t,[{key:"ready",get:function(){var e=this;return this.readyPromise||(this.readyPromise=new Promise(function(t){e.resolveReadyPromise=function(){t(e)}}),this.inited&&this.resolveReadyPromise()),this.readyPromise}}]),t}(i);function gl(t,e){return(gl=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t})(t,e)}n=function(i){var t;function e(){for(var t,e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];return(t=i.call.apply(i,[this].concat(n))||this).landmarks=[],t.landmarkAnimationID=void 0,t}t=i,(n=e).prototype=Object.create(t.prototype),gl(n.prototype.constructor=n,t);var n=e.prototype;return n.rotate=function(t,e,n){if(this.relElevation=Qr(e),this.relAzimuth=Qr(t),this.relRoll=Qr(n),this.elevation+=this.relElevation,this.azimuth+=this.relAzimuth,this.roll+=this.relRoll,this.type===Qa.EXPLORING){e=Ht(zt(),[1,0,0],ti((this.rotateWorld?1:-1)*this.relElevation)),t=Ht(zt(),[0,1,0],ti((this.rotateWorld?1:-1)*this.relAzimuth)),n=Ht(zt(),[0,0,1],ti(this.relRoll)),t=Xt(zt(),t,e),t=Xt(zt(),t,n),e=yt(K(),t);it(this.matrix,this.matrix,[0,0,-this.distance]),rt(this.matrix,this.matrix,e),it(this.matrix,this.matrix,[0,0,this.distance])}else{if(90<Math.abs(this.elevation))return this;this.computeMatrix()}return this._getAxes(),this.type===Qa.ORBITING||this.type===Qa.EXPLORING?this._getPosition():this.type===Qa.TRACKING&&this._getFocalPoint(),this._update(),this},n.pan=function(t,e){t=Jr(t,e,0),e=At(this.position);return Ct(e,e,Ot(y(),this.right,t[0])),Ct(e,e,Ot(y(),this.up,t[1])),this._setPosition(e),this.triggerUpdate(),this},n.dolly=function(t){var e=this.forward,n=At(this.position),t=(this.dollyingStep,this.distance+t*this.dollyingStep),t=Math.max(Math.min(t,this.maxDistance),this.minDistance)-this.distance;return n[0]+=t*e[0],n[1]+=t*e[1],n[2]+=t*e[2],this._setPosition(n),this.type===Qa.ORBITING||this.type===Qa.EXPLORING?this._getDistance():this.type===Qa.TRACKING&&Ct(this.focalPoint,n,this.distanceVector),this.triggerUpdate(),this},n.cancelLandmarkAnimation=function(){void 0!==this.landmarkAnimationID&&this.canvas.cancelAnimationFrame(this.landmarkAnimationID)},n.createLandmark=function(t,e){var n,e=e=void 0===e?{}:e,r=e.position,r=void 0===r?this.position:r,i=e.focalPoint,i=void 0===i?this.focalPoint:i,o=e.roll,e=e.zoom,a=new ct.CameraContribution,r=(a.setType(this.type,void 0),a.setPosition(r[0],null!=(n=r[1])?n:this.position[1],null!=(n=r[2])?n:this.position[2]),a.setFocalPoint(i[0],null!=(r=i[1])?r:this.focalPoint[1],null!=(n=i[2])?n:this.focalPoint[2]),a.setRoll(null!=o?o:this.roll),a.setZoom(null!=e?e:this.zoom),{name:t,matrix:q(a.getWorldTransform()),right:At(a.right),up:At(a.up),forward:At(a.forward),position:At(a.getPosition()),focalPoint:At(a.getFocalPoint()),distanceVector:At(a.getDistanceVector()),distance:a.getDistance(),dollyingStep:a.getDollyingStep(),azimuth:a.getAzimuth(),elevation:a.getElevation(),roll:a.getRoll(),relAzimuth:a.relAzimuth,relElevation:a.relElevation,relRoll:a.relRoll,zoom:a.getZoom()});return this.landmarks.push(r),r},n.gotoLandmark=function(e,t){var n,s,r,i,l,u,c,h,d,f,p,g,m=this,o=(void 0===t&&(t={}),Fe(e)?this.landmarks.find(function(t){return t.name===e}):e);o&&(n=void 0===(n=(t=B(t)?{duration:t}:t).easing)?"linear":n,r=t.duration,s=void 0===r?100:r,r=void 0===(r=t.easingFunction)?void 0:r,t=t.onfinish,i=void 0===t?void 0:t,l=.01,0===s?(this.syncFromLandmark(o),i&&i()):(this.cancelLandmarkAnimation(),u=o.position,c=o.focalPoint,h=o.zoom,d=o.roll,f=r||ct.EasingFunction(n),g=function(){m.setFocalPoint(c),m.setPosition(u),m.setRoll(d),m.setZoom(h),m.computeMatrix(),m.triggerUpdate(),i&&i()},this.canvas.requestAnimationFrame(function t(e){var n,r,i,o,a,e=e-(p=void 0===p?e:p);s<e||(n=f(e/s),r=y(),i=y(),o=1,a=0,Dt(r,m.focalPoint,c,n),Dt(i,m.position,u,n),a=m.roll*(1-n)+d*n,o=m.zoom*(1-n)+h*n,m.setFocalPoint(r),m.setPosition(i),m.setRoll(a),m.setZoom(o),Gt(r,c)+Gt(i,u)<=l&&null==h&&null==d)?g():(m.computeMatrix(),m.triggerUpdate(),e<s&&(m.landmarkAnimationID=m.canvas.requestAnimationFrame(t)))})))},n.syncFromLandmark=function(t){this.matrix=$(this.matrix,t.matrix),this.right=Rt(this.right,t.right),this.up=Rt(this.up,t.up),this.forward=Rt(this.forward,t.forward),this.position=Rt(this.position,t.position),this.focalPoint=Rt(this.focalPoint,t.focalPoint),this.distanceVector=Rt(this.distanceVector,t.distanceVector),this.azimuth=t.azimuth,this.elevation=t.elevation,this.roll=t.roll,this.relAzimuth=t.relAzimuth,this.relElevation=t.relElevation,this.relRoll=t.relRoll,this.dollyingStep=t.dollyingStep,this.distance=t.distance,this.zoom=t.zoom},e}(Fs);function ml(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,function(t){t=function(t,e){if("object"!=typeof t||null===t)return t;var n=t[Symbol.toPrimitive];if(void 0===n)return("string"===e?String:Number)(t);n=n.call(t,e||"default");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}(t,"string");return"symbol"==typeof t?t:String(t)}(r.key),r)}}function vl(t,e,n){e&&ml(t.prototype,e),n&&ml(t,n),Object.defineProperty(t,"prototype",{writable:!1})}function yl(t,e){return(yl=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t})(t,e)}ct.CameraContribution=n;function El(t){return Math.pow(t,2)}function _l(t){return Math.pow(t,3)}function bl(t){return Math.pow(t,4)}function xl(t){return Math.pow(t,5)}function Sl(t){return Math.pow(t,6)}function wl(t){return 1-Math.cos(t*Math.PI/2)}function Tl(t){return 1-Math.sqrt(1-t*t)}function Al(t){return t*t*(3*t-2)}function Ml(t){for(var e,n=4;t<((e=Math.pow(2,--n))-1)/11;);return 1/Math.pow(4,3-n)-7.5625*Math.pow((3*e-2)/22-t,2)}function Rl(t,e){var n=(e=e=void 0===e?[]:e)[0],e=void 0===(e=e[1])?.5:e,n=Ue(Number(void 0===n?1:n),1,10),e=Ue(Number(e),.1,2);return 0===t||1===t?t:-n*Math.pow(2,10*(t-1))*Math.sin((t-1-e/(2*Math.PI)*Math.asin(1/n))*(2*Math.PI)/e)}function Nl(t,e,n){var r=(e=e=void 0===e?[]:e)[0],i=void 0===(i=e[1])?100:i,o=void 0===(o=e[2])?10:o,e=void 0===(e=e[3])?0:e,r=Ue(void 0===r?1:r,.1,1e3),i=Ue(i,.1,1e3),o=Ue(o,.1,1e3),e=Ue(e,.1,1e3),a=Math.sqrt(i/r),i=(o=o/(2*Math.sqrt(i*r)))<1?a*Math.sqrt(1-o*o):0,r=o<1?(o*a-e)/i:-e+a,e=n?n*t/1e3:t,e=o<1?Math.exp(-e*o*a)*(+Math.cos(i*e)+r*Math.sin(i*e)):(1+r*e)*Math.exp(-e*a);return 0===t||1===t?t:1-e}function Cl(t,e){var e=e=void 0===e?[]:e,n=void 0===(n=e[0])?10:n;return("start"==e[1]?Math.ceil:Math.floor)(Ue(t,0,1)*n)/n}function Pl(t,e){var n=(e=e=void 0===e?[]:e)[0],r=e[1],i=e[2],e=e[3];return Jl(n,r,i,e)(t)}function Ol(r){return function(t,e,n){return 1-r(1-t,e=void 0===e?[]:e,n)}}function Il(r){return function(t,e,n){return void 0===e&&(e=[]),t<.5?r(2*t,e,n)/2:1-r(-2*t+2,e,n)/2}}function Ll(r){return function(t,e,n){return void 0===e&&(e=[]),t<.5?(1-r(1-2*t,e,n))/2:(r(2*t-1,e,n)+1)/2}}function kl(t){return t}var Dl=function(i){var t,e;function n(t,e,n,r){t=i.call(this,t)||this;return t.currentTime=void 0,t.timelineTime=void 0,t.currentTime=n,t.timelineTime=r,t.target=e,t.type="finish",t.bubbles=!1,t.currentTarget=e,t.defaultPrevented=!1,t.eventPhase=t.AT_TARGET,t.timeStamp=Date.now(),t.currentTime=n,t.timelineTime=r,t}return e=i,(t=n).prototype=Object.create(e.prototype),yl(t.prototype.constructor=t,e),n}(Ua),Bl=0,Fl=function(){function t(t,e){this.effect=void 0,this.timeline=void 0,this.id=void 0,this.currentTimePending=!1,this._idle=!0,this._paused=!1,this._finishedFlag=!0,this.oldPlayState=void 0,this._holdTime=void 0,this.readyPromise=void 0,this.finishedPromise=void 0,this.resolveReadyPromise=void 0,this.rejectReadyPromise=void 0,this.resolveFinishedPromise=void 0,this.rejectFinishedPromise=void 0,this.onfinish=void 0,this.oncancel=void 0,this.onframe=void 0,this._currentTime=0,this._startTime=void 0,this._playbackRate=1,this._totalDuration=void 0,this._inEffect=void 0,this._inTimeline=!0,this.onremove=void 0,((this.effect=t).animation=this).timeline=e,this.id=""+Bl++,this._inEffect=!!this.effect.update(0),this._totalDuration=Number(null==(t=this.effect)?void 0:t.getComputedTiming().endTime),this._holdTime=0,this._paused=!1,this.oldPlayState="idle",this.updatePromises()}var e=t.prototype;return e.updatePromises=function(){var t=this.oldPlayState,e=this.pending?"pending":this.playState;return this.readyPromise&&e!==t&&("idle"===e?(this.rejectReadyPromise(),this.readyPromise=void 0):"pending"===t?this.resolveReadyPromise():"pending"===e&&(this.readyPromise=void 0)),this.finishedPromise&&e!==t&&("idle"===e?(this.rejectFinishedPromise(),this.finishedPromise=void 0):"finished"===e?this.resolveFinishedPromise():"finished"===t&&(this.finishedPromise=void 0)),this.oldPlayState=e,this.readyPromise||this.finishedPromise},e.play=function(){this.updatePromises(),this._paused=!1,(this._isFinished||this._idle)&&(this.rewind(),this._startTime=null),this._finishedFlag=!1,this._idle=!1,this.ensureAlive(),this.timeline.applyDirtiedAnimation(this),-1===this.timeline.animations.indexOf(this)&&this.timeline.animations.push(this),this.updatePromises()},e.pause=function(){this.updatePromises(),this.currentTime&&(this._holdTime=this.currentTime),this._isFinished||this._paused||this._idle?this._idle&&(this.rewind(),this._idle=!1):this.currentTimePending=!0,this._startTime=null,this._paused=!0,this.updatePromises()},e.finish=function(){this.updatePromises(),this._idle||(this.currentTime=0<this._playbackRate?this._totalDuration:0,this._startTime=this._totalDuration-this.currentTime,this.currentTimePending=!1,this.timeline.applyDirtiedAnimation(this),this.updatePromises())},e.cancel=function(){var t,e=this;this.updatePromises(),this._inEffect&&(this._inEffect=!1,this._idle=!0,this._paused=!1,this._finishedFlag=!0,this._currentTime=0,this._startTime=null,this.effect.update(null),this.timeline.applyDirtiedAnimation(this),this.updatePromises(),this.oncancel)&&(t=new Dl(null,this,this.currentTime,null),setTimeout(function(){e.oncancel(t)}))},e.reverse=function(){this.updatePromises();var t=this.currentTime;this.playbackRate*=-1,this.play(),null!==t&&(this.currentTime=t),this.updatePromises()},e.updatePlaybackRate=function(t){this.playbackRate=t},e.targetAnimations=function(){var t;return(null==(t=this.effect)?void 0:t.target).getAnimations()},e.markTarget=function(){var t=this.targetAnimations();-1===t.indexOf(this)&&t.push(this)},e.unmarkTarget=function(){var t=this.targetAnimations(),e=t.indexOf(this);-1!==e&&t.splice(e,1)},e.tick=function(t,e){this._idle||this._paused||(null===this._startTime?e&&(this.startTime=t-this._currentTime/this.playbackRate):this._isFinished||this.tickCurrentTime((t-this._startTime)*this.playbackRate)),e&&(this.currentTimePending=!1,this.fireEvents(t))},e.rewind=function(){if(0<=this.playbackRate)this.currentTime=0;else{if(!(this._totalDuration<1/0))throw new Error("Unable to rewind negative playback rate animation with infinite duration");this.currentTime=this._totalDuration}},e.persist=function(){throw new Error(Hr)},e.addEventListener=function(t,e,n){throw new Error(Hr)},e.removeEventListener=function(t,e,n){throw new Error(Hr)},e.dispatchEvent=function(t){throw new Error(Hr)},e.commitStyles=function(){throw new Error(Hr)},e.ensureAlive=function(){var t;this.playbackRate<0&&0===this.currentTime?this._inEffect=!(null==(t=this.effect)||!t.update(-1)):this._inEffect=!(null==(t=this.effect)||!t.update(this.currentTime)),this._inTimeline||!this._inEffect&&this._finishedFlag||(this._inTimeline=!0,this.timeline.animations.push(this))},e.tickCurrentTime=function(t,e){t!==this._currentTime&&(this._currentTime=t,this._isFinished&&!e&&(this._currentTime=0<this._playbackRate?this._totalDuration:0),this.ensureAlive())},e.fireEvents=function(t){var e,n=this;this._isFinished?this._finishedFlag||(this.onfinish&&(e=new Dl(null,this,this.currentTime,t),setTimeout(function(){n.onfinish&&n.onfinish(e)})),this._finishedFlag=!0):(this.onframe&&"running"===this.playState&&(t=new Dl(null,this,this.currentTime,t),this.onframe(t)),this._finishedFlag=!1)},vl(t,[{key:"pending",get:function(){return null===this._startTime&&!this._paused&&0!==this.playbackRate||this.currentTimePending}},{key:"playState",get:function(){return this._idle?"idle":this._isFinished?"finished":this._paused?"paused":"running"}},{key:"ready",get:function(){var n=this;return this.readyPromise||(-1===this.timeline.animationsWithPromises.indexOf(this)&&this.timeline.animationsWithPromises.push(this),this.readyPromise=new Promise(function(t,e){n.resolveReadyPromise=function(){t(n)},n.rejectReadyPromise=function(){e(new Error)}}),this.pending)||this.resolveReadyPromise(),this.readyPromise}},{key:"finished",get:function(){var n=this;return this.finishedPromise||(-1===this.timeline.animationsWithPromises.indexOf(this)&&this.timeline.animationsWithPromises.push(this),this.finishedPromise=new Promise(function(t,e){n.resolveFinishedPromise=function(){t(n)},n.rejectFinishedPromise=function(){e(new Error)}}),"finished"===this.playState&&this.resolveFinishedPromise()),this.finishedPromise}},{key:"currentTime",get:function(){return this.updatePromises(),this._idle||this.currentTimePending?null:this._currentTime},set:function(t){var e;t=Number(t),isNaN(t)||(this.timeline.restart(),this._paused||null===this._startTime||(this._startTime=Number(null==(e=this.timeline)?void 0:e.currentTime)-t/this.playbackRate),this.currentTimePending=!1,this._currentTime!==t&&(this._idle&&(this._idle=!1,this._paused=!0),this.tickCurrentTime(t,!0),this.timeline.applyDirtiedAnimation(this)))}},{key:"startTime",get:function(){return this._startTime},set:function(t){null!==t&&(this.updatePromises(),t=Number(t),isNaN(t)||this._paused||this._idle||(this._startTime=t,this.tickCurrentTime((Number(this.timeline.currentTime)-this._startTime)*this.playbackRate),this.timeline.applyDirtiedAnimation(this),this.updatePromises()))}},{key:"playbackRate",get:function(){return this._playbackRate},set:function(t){var e;t!==this._playbackRate&&(this.updatePromises(),e=this.currentTime,this._playbackRate=t,this.startTime=null,"paused"!==this.playState&&"idle"!==this.playState&&(this._finishedFlag=!1,this._idle=!1,this.ensureAlive(),this.timeline.applyDirtiedAnimation(this)),null!==e&&(this.currentTime=e),this.updatePromises())}},{key:"_isFinished",get:function(){return!this._idle&&(0<this._playbackRate&&Number(this._currentTime)>=this._totalDuration||this._playbackRate<0&&Number(this._currentTime)<=0)}},{key:"totalDuration",get:function(){return this._totalDuration}},{key:"_needsTick",get:function(){return this.pending||"running"===this.playState||!this._finishedFlag}}]),t}(),Ul=4,Gl=.001,Wl=1e-7,Vl=10,jl=11,zl=1/(jl-1),Hl="function"==typeof Float32Array,Xl=function(t,e){return 1-3*e+3*t},Yl=function(t,e){return 3*e-6*t},Kl=function(t){return 3*t},ql=function(t,e,n){return((Xl(e,n)*t+Yl(e,n))*t+Kl(e))*t},$l=function(t,e,n){return 3*Xl(e,n)*t*t+2*Yl(e,n)*t+Kl(e)},Zl=function(t,e,n,r,i){for(var o,a,s=0;0<(o=ql(a=e+(n-e)/2,r,i)-t)?n=a:e=a,Math.abs(o)>Wl&&++s<Vl;);return a},Ql=function(t,e,n,r){for(var i=0;i<Ul;++i){var o=$l(e,n,r);if(0===o)return e;e-=(ql(e,n,r)-t)/o}return e},Jl=function(a,e,s,n){if(!(0<=a&&a<=1&&0<=s&&s<=1))throw new Error("bezier x values must be in [0, 1] range");if(a===e&&s===n)return function(t){return t};for(var l=new(Hl?Float32Array:Array)(jl),t=0;t<jl;++t)l[t]=ql(t*zl,a,s);return function(t){return 0===t||1===t?t:ql(function(t){for(var e=0,n=1,r=jl-1;n!==r&&l[n]<=t;++n)e+=zl;var i=e+(t-l[--n])/(l[n+1]-l[n])*zl,o=$l(i,a,s);return Gl<=o?Ql(t,i,a,s):0===o?i:Zl(t,e,e+zl,a,s)}(t),e,n)}},tu=function(t){return"-"===(t=t.replace(/([A-Z])/g,function(t){return"-"+t.toLowerCase()})).charAt(0)?t.substring(1):t},ya=Jl(.42,0,1,1),eu={steps:Cl,"step-start":function(t){return Cl(t,[1,"start"])},"step-end":function(t){return Cl(t,[1,"end"])},linear:function(t){return t},"cubic-bezier":Pl,ease:function(t){return Pl(t,[.25,.1,.25,1])},in:ya,out:Ol(ya),"in-out":Il(ya),"out-in":Ll(ya),"in-quad":El,"out-quad":Ol(El),"in-out-quad":Il(El),"out-in-quad":Ll(El),"in-cubic":_l,"out-cubic":Ol(_l),"in-out-cubic":Il(_l),"out-in-cubic":Ll(_l),"in-quart":bl,"out-quart":Ol(bl),"in-out-quart":Il(bl),"out-in-quart":Ll(bl),"in-quint":xl,"out-quint":Ol(xl),"in-out-quint":Il(xl),"out-in-quint":Ll(xl),"in-expo":Sl,"out-expo":Ol(Sl),"in-out-expo":Il(Sl),"out-in-expo":Ll(Sl),"in-sine":wl,"out-sine":Ol(wl),"in-out-sine":Il(wl),"out-in-sine":Ll(wl),"in-circ":Tl,"out-circ":Ol(Tl),"in-out-circ":Il(Tl),"out-in-circ":Ll(Tl),"in-back":Al,"out-back":Ol(Al),"in-out-back":Il(Al),"out-in-back":Ll(Al),"in-bounce":Ml,"out-bounce":Ol(Ml),"in-out-bounce":Il(Ml),"out-in-bounce":Ll(Ml),"in-elastic":Rl,"out-elastic":Ol(Rl),"in-out-elastic":Il(Rl),"out-in-elastic":Ll(Rl),spring:Nl,"spring-in":Nl,"spring-out":Ol(Nl),"spring-in-out":Il(Nl),"spring-out-in":Ll(Nl)},nu=function(t){return tu(t).replace(/^ease-/,"").replace(/(\(|\s).+/,"").toLowerCase().trim()},ru=function(t){return eu[nu(t)]||eu.linear},iu=1,ou=.5,au=0;function su(n,r){return function(t){var e;return 1<=t?1:(t+=r*(e=1/n))-t%e}}var Sa="\\s*(-?\\d+\\.?\\d*|-?\\.\\d+)\\s*",lu=new RegExp("cubic-bezier\\("+Sa+","+Sa+","+Sa+","+Sa+"\\)"),uu=/steps\(\s*(\d+)\s*\)/,cu=/steps\(\s*(\d+)\s*,\s*(start|middle|end)\s*\)/;function hu(t){var e=lu.exec(t);return e?Jl.apply(void 0,e.slice(1).map(Number)):(e=uu.exec(t))?su(Number(e[1]),au):(e=cu.exec(t))?su(Number(e[1]),{start:iu,middle:ou,end:au}[e[2]]):ru(t)}function du(t){return Math.abs((0!==(e=t).duration&&0!==e.iterations?("auto"===e.duration?0:Number(e.duration))*(null!=(e=e.iterations)?e:1):0)/(t.playbackRate||1));var e}var fu=0,pu=1,gu=2,mu=3;function vu(t,e,n){u=t,i=n;var r,i,o,a,s,l=null===(l=e)?fu:(r=i.endTime,l<Math.min(i.delay,r)?pu:l>=Math.min(i.delay+u+i.endDelay,r)?gu:mu),u=function(t,e,n,r,i){switch(r){case pu:return"backwards"===e||"both"===e?0:null;case mu:return n-i;case gu:return"forwards"===e||"both"===e?t:null;case fu:return null}}(t,n.fill,e,l,n.delay);return null===u?null:(i="auto"===n.duration?0:n.duration,r=i,t=l,e=n.iterations,a=u,s=n.iterationStart,0===r?t!==pu&&(s+=e):s+=a/r,e=t=s,a=n.iterationStart,s=l,o=n.iterations,u=u,i=i,e=a=0!==(a=e===1/0?a%1:e%1)||s!==gu||0===o||0===u&&0!==i?a:1,s=n.iterations,o=e,u=t,i=l===gu&&s===1/0?1/0:1===o?Math.floor(u)-1:Math.floor(u),a=n.direction,t=i,l=e,o="normal"===(s="normal"!==(s=a)&&"reverse"!==a&&(t=t,"alternate-reverse"===a&&(t+=1),s="normal",t!==1/0)&&t%2!=0?"reverse":s)?l:1-l,n.currentIteration=i,n.progress=o,n.easingFunction(o))}function yu(t,e,n){var o=function(t,e){for(var n={},r=0;r<t.length;r++)for(var i in t[r]){var o;Eu(i)&&(o={offset:t[r].offset,computedOffset:t[r].computedOffset,easing:t[r].easing,easingFunction:hu(t[r].easing)||e.easingFunction,value:t[r][i]},n[i]=n[i]||[],n[i].push(o))}return n}(t,e),a=function(t,e){var n,r=[];for(n in t)for(var i=t[n],o=0;o<i.length-1;o++){var a=o,s=o+1,l=i[a].computedOffset,u=i[s].computedOffset,c=l,h=u;0===o&&(c=-1/0,0===u)&&(s=a),o===i.length-2&&(h=1/0,1===l)&&(a=s),r.push({applyFrom:c,applyTo:h,startOffset:i[a].computedOffset,endOffset:i[s].computedOffset,easingFunction:i[a].easingFunction,property:n,interpolation:function(t,e,n,r){var i=Is[t];if(i&&i.syntax&&i.int){i=ct.styleValueRegistry.getPropertySyntax(i.syntax);if(i){a=ct.enableCSSParsing?(o=ct.styleValueRegistry.parseProperty(t,e,r),a=ct.styleValueRegistry.parseProperty(t,n,r),o=ct.styleValueRegistry.computeProperty(t,o,r),ct.styleValueRegistry.computeProperty(t,a,r)):(t=i.parserWithCSSDisabled,o=t?t(e,r):e,t?t(n,r):n);var o,a,s,t=i.mixer(o,a,r);if(t)return s=_u.apply(void 0,t),function(t){return 0===t?e:1===t?n:s(t)}}}return _u(!1,!0,function(t){return t?n:e})}(n,i[a].value,i[s].value,e)})}return r.sort(function(t,e){return t.startOffset-e.startOffset}),r}(o,n);return function(r,i){if(null!==i)a.filter(function(t){return i>=t.applyFrom&&i<t.applyTo}).forEach(function(t){var e=i-t.startOffset,n=t.endOffset-t.startOffset,e=0==n?0:t.easingFunction(e/n);r.setAttribute(t.property,t.interpolation(e))});else for(var t in o)Eu(t)&&r.setAttribute(t,null)}}function Eu(t){return"offset"!==t&&"easing"!==t&&"composite"!==t&&"computedOffset"!==t}var _u=function(e,n,r){return function(t){t=function t(e,n,r){if("number"==typeof e&&"number"==typeof n)return e*(1-r)+n*r;if("boolean"==typeof e&&"boolean"==typeof n||"string"==typeof e&&"string"==typeof n)return r<.5?e:n;if(Array.isArray(e)&&Array.isArray(n)){for(var i=e.length,o=n.length,a=Math.max(i,o),s=[],l=0;l<a;l++)s.push(t(e[l<i?l:i-1],n[l<o?l:o-1],r));return s}throw new Error("Mismatched interpolation arguments "+e+":"+n)}(e,n,t);return!ct.enableCSSParsing&&B(t)?t:r(t)}};var bu=function(){function t(){this.delay=0,this.direction="normal",this.duration="auto",this._easing="linear",this.easingFunction=kl,this.endDelay=0,this.fill="auto",this.iterationStart=0,this.iterations=1,this.playbackRate=void 0,this.effect=void 0,this.composite=void 0,this.activeDuration=void 0,this.endTime=void 0,this.currentIteration=null,this.progress=null}return vl(t,[{key:"easing",get:function(){return this._easing},set:function(t){this.easingFunction=hu(t),this._easing=t}}]),t}();function xu(t,i){if(null===t)return[];for(var e=(t=Array.isArray(t)?t:function(t){var e,n=[];for(e in t)if(!(e in["easing","offset","composite"]))for(var r,i=t[e],o=(i=Array.isArray(i)?i:[i]).length,a=0;a<o;a++)n[a]||(r={},"offset"in t&&(r.offset=Number(t.offset)),"easing"in t&&(r.easing=t.easing),"composite"in t&&(r.composite=t.composite),n[a]=r),void 0!==i[a]&&null!==i[a]&&(n[a][e]=i[a]);return n.sort(function(t,e){return(t.computedOffset||0)-(e.computedOffset||0)}),n}(t)).map(function(t){var e,n={};for(e in null!=i&&i.composite&&(n.composite="auto"),t){var r=t[e];if("offset"===e){if(null!==r){if(r=Number(r),!isFinite(r))throw new Error("Keyframe offsets must be numbers.");if(r<0||1<r)throw new Error("Keyframe offsets must be between 0 and 1.");n.computedOffset=r}}else if("composite"===e&&-1===["replace","add","accumulate","auto"].indexOf(r))throw new Error(r+" compositing is not supported");n[e]=r}return void 0===n.offset&&(n.offset=null),void 0===n.easing&&(n.easing=(null==i?void 0:i.easing)||"linear"),void 0===n.composite&&(n.composite="auto"),n}),n=!0,r=-1/0,o=0;o<e.length;o++){var a=e[o].offset;if(M(a))n=!1;else{if(a<r)throw new TypeError("Keyframes are not loosely sorted by offset. Sort or specify offsets.");r=a}}if(e=e.filter(function(t){return 0<=Number(t.offset)&&Number(t.offset)<=1}),!n)for(var s=e.length,l=(e[s-1].computedOffset=Number(null!=(t=e[s-1].offset)?t:1),1<s&&(e[0].computedOffset=Number(null!=(t=e[0].offset)?t:0)),0),u=Number(e[0].computedOffset),c=1;c<s;c++){var h=e[c].computedOffset;if(!M(h)&&!M(u)){for(var d=1;d<c-l;d++)e[l+d].computedOffset=u+(Number(h)-u)*d/(c-l);l=c,u=Number(h)}}return e}var Su="backwards|forwards|both|none".split("|"),wu="reverse|alternate|alternate-reverse".split("|");function Tu(t,e){var n,r,i;return t=function(t){"number"==typeof t&&(t=isNaN(t)?{duration:"auto"}:{duration:t});return t}(null!=(r=t)?r:{duration:"auto"}),n=t,r=e,i=new bu,r&&(i.fill="both",i.duration="auto"),"number"!=typeof n||isNaN(n)?void 0!==n&&Object.keys(n).forEach(function(t){void 0===n[t]||null===n[t]||"auto"===n[t]||!("number"!=typeof i[t]&&"duration"!==t||"number"==typeof n[t]&&!isNaN(n[t]))||"fill"===t&&-1===Su.indexOf(n[t])||"direction"===t&&-1===wu.indexOf(n[t])||(i[t]=n[t])}):i.duration=n,i}var Au=function(){function t(t,e,n){var r=this,t=(this.composite="replace",this.iterationComposite="replace",this.target=void 0,this.animation=void 0,this.timing=void 0,this.computedTiming=void 0,this.normalizedKeyframes=void 0,this.timeFraction=void 0,this.interpolations=void 0,this.target=t,this.timing=Tu(n,!1),(this.timing.effect=this).timing.activeDuration=du(this.timing),this.timing.endTime=Math.max(0,this.timing.delay+this.timing.activeDuration+this.timing.endDelay),this.normalizedKeyframes=xu(e,this.timing),this.interpolations=yu(this.normalizedKeyframes,this.timing,this.target),ct.globalThis.Proxy);this.computedTiming=t?new t(this.timing,{get:function(t,e){return"duration"===e?"auto"===t.duration?0:t.duration:"fill"===e?"auto"===t.fill?"none":t.fill:"localTime"===e?r.animation&&r.animation.currentTime||null:"currentIteration"===e?r.animation&&"running"===r.animation.playState?t.currentIteration||0:null:"progress"===e?r.animation&&"running"===r.animation.playState?t.progress||0:null:t[e]},set:function(){return!0}}):this.timing}var e=t.prototype;return e.applyInterpolations=function(){this.interpolations(this.target,Number(this.timeFraction))},e.update=function(t){return null!==t&&(this.timeFraction=vu(this.timing.activeDuration,t,this.timing),null!==this.timeFraction)},e.getKeyframes=function(){return this.normalizedKeyframes},e.setKeyframes=function(t){this.normalizedKeyframes=xu(t)},e.getComputedTiming=function(){return this.computedTiming},e.getTiming=function(){return this.timing},e.updateTiming=function(e){var n=this;Object.keys(e||{}).forEach(function(t){n.timing[t]=e[t]})},t}();function Mu(t,e){return Number(t.id)-Number(e.id)}var t=function(){function t(t){var n=this;this.document=void 0,this.animations=[],this.ticking=!1,this.timelineTicking=!1,this.hasRestartedThisFrame=!1,this.animationsWithPromises=[],this.inTick=!1,this.pendingEffects=[],this.currentTime=null,this.rafId=0,this.rafCallbacks=[],this.frameId=void 0,this.webAnimationsNextTick=function(t){n.currentTime=t,n.discardAnimations(),0===n.animations.length?n.timelineTicking=!1:n.requestAnimationFrame(n.webAnimationsNextTick)},this.processRafCallbacks=function(e){var t=n.rafCallbacks;n.rafCallbacks=[],e<Number(n.currentTime)&&(e=Number(n.currentTime)),n.animations.sort(Mu),n.animations=n.tick(e,!0,n.animations)[0],t.forEach(function(t){t[1](e)}),n.applyPendingEffects()},this.document=t}var e=t.prototype;return e.getAnimations=function(){return this.discardAnimations(),this.animations.slice()},e.isTicking=function(){return this.inTick},e.play=function(t,e,n){t=new Au(t,e,n),e=new Fl(t,this);return this.animations.push(e),this.restartWebAnimationsNextTick(),e.updatePromises(),e.play(),e.updatePromises(),e},e.applyDirtiedAnimation=function(t){var e=this;this.inTick||(t.markTarget(),(t=t.targetAnimations()).sort(Mu),this.tick(Number(this.currentTime),!1,t.slice())[1].forEach(function(t){t=e.animations.indexOf(t);-1!==t&&e.animations.splice(t,1)}),this.applyPendingEffects())},e.restart=function(){return this.ticking||(this.ticking=!0,this.requestAnimationFrame(function(){}),this.hasRestartedThisFrame=!0),this.hasRestartedThisFrame},e.destroy=function(){this.document.defaultView.cancelAnimationFrame(this.frameId)},e.applyPendingEffects=function(){this.pendingEffects.forEach(function(t){null!=t&&t.applyInterpolations()}),this.pendingEffects=[]},e.updateAnimationsPromises=function(){this.animationsWithPromises=this.animationsWithPromises.filter(function(t){return t.updatePromises()})},e.discardAnimations=function(){this.updateAnimationsPromises(),this.animations=this.animations.filter(function(t){return"finished"!==t.playState&&"idle"!==t.playState})},e.restartWebAnimationsNextTick=function(){this.timelineTicking||(this.timelineTicking=!0,this.requestAnimationFrame(this.webAnimationsNextTick))},e.rAF=function(t){var e=this.rafId++;return 0===this.rafCallbacks.length&&(this.frameId=this.document.defaultView.requestAnimationFrame(this.processRafCallbacks)),this.rafCallbacks.push([e,t]),e},e.requestAnimationFrame=function(e){var n=this;return this.rAF(function(t){n.updateAnimationsPromises(),e(t),n.updateAnimationsPromises()})},e.tick=function(n,r,t){var i=this,o=(this.inTick=!0,this.hasRestartedThisFrame=!1,this.currentTime=n,this.ticking=!1,[]),a=[],s=[],l=[];return t.forEach(function(t){t.tick(n,r),t._inEffect?(a.push(t.effect),t.markTarget()):(o.push(t.effect),t.unmarkTarget()),t._needsTick&&(i.ticking=!0);var e=t._inEffect||t._needsTick;((t._inTimeline=e)?s:l).push(t)}),(t=this.pendingEffects).push.apply(t,o),(t=this.pendingEffects).push.apply(t,a),this.ticking&&this.requestAnimationFrame(function(){}),this.inTick=!1,[s,l]},t}(),Ru=(ct.EasingFunction=hu,ct.AnimationTimeline=t,{}.toString),Nu=function(t,e){return Ru.call(t)==="[object "+e+"]"},Cu=function(t){return Nu(t,"Function")},Pu=function(t){return null==t},Ou=function(t){return Array.isArray?Array.isArray(t):Nu(t,"Array")},Iu=function(t){var e=typeof t;return null!==t&&"object"==e||"function"==e};function Lu(t,e){if(t)if(Ou(t))for(var n=0,r=t.length;n<r&&!1!==e(t[n],n);n++);else if(Iu(t))for(var i in t)if(t.hasOwnProperty(i)&&!1===e(t[i],i))break}function ku(t){return Nu(t,"String")}var Du=function(t){return"object"==typeof t&&null!==t},Bu=function(t){if(!Du(t)||!Nu(t,"Object"))return!1;if(null===Object.getPrototypeOf(t))return!0;for(var e=t;null!==Object.getPrototypeOf(e);)e=Object.getPrototypeOf(e);return Object.getPrototypeOf(t)===e};var Fu=function(t){return Nu(t,"Number")},Uu=Object.values?function(t){return Object.values(t)}:function(n){var r=[];return Lu(n,function(t,e){Cu(n)&&"prototype"===e||r.push(t)}),r},Gu=function(t){return Pu(t)?"":t.toString()},Wu=function(t){if("object"!=typeof t||null===t)return t;if(Ou(t))for(var e=[],n=0,r=t.length;n<r;n++)"object"==typeof t[n]&&null!=t[n]?e[n]=Wu(t[n]):e[n]=t[n];else for(var i in e={},t)"object"==typeof t[i]&&null!=t[i]?e[i]=Wu(t[i]):e[i]=t[i];return e};function Vu(r,i,o){var a;return function(){var t=this,e=arguments,n=o&&!a;clearTimeout(a),a=setTimeout(function(){a=null,o||r.apply(t,e)},i),n&&r.apply(t,e)}}var ju=5;function zu(t){for(var e=[],n=1;n<arguments.length;n++)e[n-1]=arguments[n];for(var r=0;r<e.length;r+=1)!function t(e,n,r,i){for(var o in r=r||0,i=i||ju,n){var a;n.hasOwnProperty(o)&&(null!==(a=n[o])&&Bu(a)?(Bu(e[o])||(e[o]={}),r<i?t(e[o],a,r+1,i):e[o]=n[o]):Ou(a)?(e[o]=[],e[o]=e[o].concat(a)):void 0!==a&&(e[o]=a))}}(t,e[r]);return t}function Hu(n,r,i){function o(){c=!1===i.leading?0:Date.now(),a=null,u=n.apply(s,l),a||(s=l=null)}function t(){var t=Date.now(),e=(c||!1!==i.leading||(c=t),r-(t-c));return s=this,l=arguments,e<=0||r<e?(a&&(clearTimeout(a),a=null),c=t,u=n.apply(s,l),a||(s=l=null)):a||!1===i.trailing||(a=setTimeout(o,e)),u}var a,s,l,u,c=0;return i=i||{},t.cancel=function(){clearTimeout(a),c=0,a=s=l=null},t}var Xu;function Yu(t,e){return(Yu=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t})(t,e)}function Ku(t,e){e=e.r;t.arc(e,e,e,0,2*Math.PI,!1)}function qu(t,e){var n,r,i=e.rx,e=e.ry;t.ellipse?t.ellipse(i,e,i,e,0,0,2*Math.PI,!1):(n=e<i?i:e,r=e<i?1:i/e,e=e<i?e/i:1,t.save(),t.scale(r,e),t.arc(0,0,n,0,2*Math.PI))}function $u(t,e){var n,r,i=e.x1,o=e.y1,a=e.x2,s=e.y2,l=e.defX,l=void 0===l?0:l,u=e.defY,u=void 0===u?0:u,c=e.markerStart,h=e.markerEnd,d=e.markerStartOffset,e=e.markerEndOffset,f=0,p=0,g=0,m=0,v=0;c&&ut(c)&&d&&(n=a-i,r=s-o,v=Math.atan2(r,n),f=Math.cos(v)*(d||0),p=Math.sin(v)*(d||0)),h&&ut(h)&&e&&(n=i-a,r=o-s,v=Math.atan2(r,n),g=Math.cos(v)*(e||0),m=Math.sin(v)*(e||0)),t.moveTo(i-l+f,o-u+p),t.lineTo(a-l+g,s-u+m)}function Zu(t,e){var n,r,i=e.defX,o=void 0===i?0:i,i=e.defY,a=void 0===i?0:i,i=e.markerStart,s=e.markerEnd,l=e.markerStartOffset,u=e.markerEndOffset,e=e.path,c=e.absolutePath,h=e.segments,d=0,f=0,p=0,g=0,e=0;i&&ut(i)&&l&&(r=(i=i.parentNode.getStartTangent())[0],i=i[1],n=r[0]-i[0],r=r[1]-i[1],e=Math.atan2(r,n),d=Math.cos(e)*(l||0),f=Math.sin(e)*(l||0)),s&&ut(s)&&u&&(l=(i=s.parentNode.getEndTangent())[0],s=i[1],n=l[0]-s[0],r=l[1]-s[1],e=Math.atan2(r,n),p=Math.cos(e)*(u||0),g=Math.sin(e)*(u||0));for(var m=0;m<c.length;m++){var v=c[m],y=v[0],E=c[m+1],_=0===m&&(0!==d||0!==f),b=(m===c.length-1||E&&("M"===E[0]||"Z"===E[0]))&&0!==p&&0!==g;switch(y){case"M":_?(t.moveTo(v[1]-o+d,v[2]-a+f),t.lineTo(v[1]-o,v[2]-a)):t.moveTo(v[1]-o,v[2]-a);break;case"L":b?t.lineTo(v[1]-o+p,v[2]-a+g):t.lineTo(v[1]-o,v[2]-a);break;case"Q":t.quadraticCurveTo(v[1]-o,v[2]-a,v[3]-o,v[4]-a),b&&t.lineTo(v[3]-o+p,v[4]-a+g);break;case"C":t.bezierCurveTo(v[1]-o,v[2]-a,v[3]-o,v[4]-a,v[5]-o,v[6]-a),b&&t.lineTo(v[5]-o+p,v[6]-a+g);break;case"A":var x,S,w=h[m].arcParams,T=w.cx,A=w.cy,M=w.rx,R=w.ry,N=w.startAngle,C=w.endAngle,P=w.xRotation,w=w.sweepFlag;t.ellipse?t.ellipse(T-o,A-a,M,R,P,N,C,!!(1-w)):(x=R<M?M:R,S=R<M?1:M/R,R=R<M?R/M:1,t.translate(T-o,A-a),t.rotate(P),t.scale(S,R),t.arc(0,0,x,N,C,!!(1-w)),t.scale(1/S,1/R),t.rotate(-P),t.translate(-(T-o),-(A-a))),b&&t.lineTo(v[6]-o+p,v[7]-a+g);break;case"Z":t.closePath()}}}function Qu(t,e){var n,r,i=e.defX,o=void 0===i?0:i,i=e.defY,a=void 0===i?0:i,i=e.markerStart,s=e.markerEnd,l=e.markerStartOffset,u=e.markerEndOffset,c=e.points.points,h=c.length,e=c[0][0]-o,d=c[0][1]-a,f=c[h-1][0]-o,p=c[h-1][1]-a,g=0,m=0,v=0,y=0,E=0;i&&ut(i)&&l&&(n=c[1][0]-c[0][0],r=c[1][1]-c[0][1],E=Math.atan2(r,n),g=Math.cos(E)*(l||0),m=Math.sin(E)*(l||0)),s&&ut(s)&&u&&(n=c[h-1][0]-c[0][0],r=c[h-1][1]-c[0][1],E=Math.atan2(r,n),v=Math.cos(E)*(u||0),y=Math.sin(E)*(u||0)),t.moveTo(e+(g||v),d+(m||y));for(var _=1;_<h-1;_++){var b=c[_];t.lineTo(b[0]-o,b[1]-a)}t.lineTo(f,p)}function Ju(t,e){var n,r,i=e.defX,o=void 0===i?0:i,i=e.defY,a=void 0===i?0:i,i=e.markerStart,s=e.markerEnd,l=e.markerStartOffset,u=e.markerEndOffset,c=e.points.points,h=c.length,e=c[0][0]-o,d=c[0][1]-a,f=c[h-1][0]-o,p=c[h-1][1]-a,g=0,m=0,v=0,y=0,E=0;i&&ut(i)&&l&&(n=c[1][0]-c[0][0],r=c[1][1]-c[0][1],E=Math.atan2(r,n),g=Math.cos(E)*(l||0),m=Math.sin(E)*(l||0)),s&&ut(s)&&u&&(n=c[h-2][0]-c[h-1][0],r=c[h-2][1]-c[h-1][1],E=Math.atan2(r,n),v=Math.cos(E)*(u||0),y=Math.sin(E)*(u||0)),t.moveTo(e+g,d+m);for(var _=1;_<h-1;_++){var b=c[_];t.lineTo(b[0]-o,b[1]-a)}t.lineTo(f+v,p+y)}function tc(t,e){var n,r,i,o,a=e.radius,s=e.width,e=e.height,l=s,u=e;a&&a.some(function(t){return 0!==t})?(n=(s=0<s?1:-1)+(e=0<e?1:-1)==0,r=(a=a.map(function(t){return Ue(t,0,Math.min(Math.abs(l)/2,Math.abs(u)/2))}))[0],i=a[1],o=a[2],a=a[3],t.moveTo(s*r,0),t.lineTo(l-s*i,0),0!==i&&t.arc(l-s*i,e*i,i,-e*Math.PI/2,0<s?0:Math.PI,n),t.lineTo(l,u-e*o),0!==o&&t.arc(l-s*o,u-e*o,o,0<s?0:Math.PI,0<e?Math.PI/2:1.5*Math.PI,n),t.lineTo(s*a,u),0!==a&&t.arc(s*a,u-e*a,a,0<e?Math.PI/2:-Math.PI/2,0<s?Math.PI:0,n),t.lineTo(0,e*r),0!==r&&t.arc(s*r,e*r,r,0<s?Math.PI:0,0<e?1.5*Math.PI:Math.PI/2,n)):t.rect(0,0,l,u)}!function(o,a){var s;if(Cu(o))return(s=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var n,r=a?a.apply(this,t):t[0],i=s.cache;return i.has(r)?i.get(r):(n=o.apply(this,t),i.set(r,n),n)}).cache=new Map;throw new TypeError("Expected a function")}(function(t,e){var n=(e=void 0===e?{}:e).fontSize,r=e.fontFamily,i=e.fontWeight,o=e.fontStyle,e=e.fontVariant;return(Xu=Xu||document.createElement("canvas").getContext("2d")).font=[o,e,i,n+"px",r].join(" "),Xu.measureText(ku(t)?t:"").width},function(t,e){return function(){for(var t=0,e=0,n=arguments.length;e<n;e++)t+=arguments[e].length;for(var r=Array(t),i=0,e=0;e<n;e++)for(var o=arguments[e],a=0,s=o.length;a<s;a++,i++)r[i]=o[a];return r}([t],Uu(e=void 0===e?{}:e)).join("")});var ec=function(i){var t;function e(){for(var t,e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];return(t=i.call.apply(i,[this].concat(n))||this).name="canvas-path-generator",t}t=i,(n=e).prototype=Object.create(t.prototype),Yu(n.prototype.constructor=n,t);var n=e.prototype;return n.init=function(){(t={})[lt.CIRCLE]=Ku,t[lt.ELLIPSE]=qu,t[lt.RECT]=tc,t[lt.LINE]=$u,t[lt.POLYLINE]=Ju,t[lt.POLYGON]=Qu,t[lt.PATH]=Zu,t[lt.TEXT]=void 0,t[lt.GROUP]=void 0,t[lt.IMAGE]=void 0,t[lt.HTML]=void 0,t[lt.MESH]=void 0;var t;this.context.pathGeneratorFactory=t},n.destroy=function(){delete this.context.pathGeneratorFactory},e}(Ws);function nc(){nc=function(){return a};var a={},t=Object.prototype,l=t.hasOwnProperty,u=Object.defineProperty||function(t,e,n){t[e]=n.value},e="function"==typeof Symbol?Symbol:{},r=e.iterator||"@@iterator",n=e.asyncIterator||"@@asyncIterator",i=e.toStringTag||"@@toStringTag";function o(t,e,n){return Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{o({},"")}catch(t){o=function(t,e,n){return t[e]=n}}function s(t,e,n,r){var i,o,a,s,e=e&&e.prototype instanceof d?e:d,e=Object.create(e.prototype),r=new b(r||[]);return u(e,"_invoke",{value:(i=t,o=n,a=r,s="suspendedStart",function(t,e){if("executing"===s)throw new Error("Generator is already running");if("completed"===s){if("throw"===t)throw e;return S()}for(a.method=t,a.arg=e;;){var n=a.delegate;if(n){n=function t(e,n){var r=n.method,i=e.iterator[r];if(void 0===i)return n.delegate=null,"throw"===r&&e.iterator.return&&(n.method="return",n.arg=void 0,t(e,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),h;r=c(i,e.iterator,n.arg);if("throw"===r.type)return n.method="throw",n.arg=r.arg,n.delegate=null,h;i=r.arg;return i?i.done?(n[e.resultName]=i.value,n.next=e.nextLoc,"return"!==n.method&&(n.method="next",n.arg=void 0),n.delegate=null,h):i:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,h)}(n,a);if(n){if(n===h)continue;return n}}if("next"===a.method)a.sent=a._sent=a.arg;else if("throw"===a.method){if("suspendedStart"===s)throw s="completed",a.arg;a.dispatchException(a.arg)}else"return"===a.method&&a.abrupt("return",a.arg);s="executing";n=c(i,o,a);if("normal"===n.type){if(s=a.done?"completed":"suspendedYield",n.arg===h)continue;return{value:n.arg,done:a.done}}"throw"===n.type&&(s="completed",a.method="throw",a.arg=n.arg)}})}),e}function c(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(t){return{type:"throw",arg:t}}}a.wrap=s;var h={};function d(){}function f(){}function p(){}var e={},g=(o(e,r,function(){return this}),Object.getPrototypeOf),g=g&&g(g(x([]))),m=(g&&g!==t&&l.call(g,r)&&(e=g),p.prototype=d.prototype=Object.create(e));function v(t){["next","throw","return"].forEach(function(e){o(t,e,function(t){return this._invoke(e,t)})})}function y(a,s){var e;u(this,"_invoke",{value:function(n,r){function t(){return new s(function(t,e){!function e(t,n,r,i){var o,t=c(a[t],a,n);if("throw"!==t.type)return(n=(o=t.arg).value)&&"object"==typeof n&&l.call(n,"__await")?s.resolve(n.__await).then(function(t){e("next",t,r,i)},function(t){e("throw",t,r,i)}):s.resolve(n).then(function(t){o.value=t,r(o)},function(t){return e("throw",t,r,i)});i(t.arg)}(n,r,t,e)})}return e=e?e.then(t,t):t()}})}function E(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function _(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function b(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(E,this),this.reset(!0)}function x(e){if(e){var n,t=e[r];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length))return n=-1,(t=function t(){for(;++n<e.length;)if(l.call(e,n))return t.value=e[n],t.done=!1,t;return t.value=void 0,t.done=!0,t}).next=t}return{next:S}}function S(){return{value:void 0,done:!0}}return u(m,"constructor",{value:f.prototype=p,configurable:!0}),u(p,"constructor",{value:f,configurable:!0}),f.displayName=o(p,i,"GeneratorFunction"),a.isGeneratorFunction=function(t){t="function"==typeof t&&t.constructor;return!!t&&(t===f||"GeneratorFunction"===(t.displayName||t.name))},a.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,p):(t.__proto__=p,o(t,i,"GeneratorFunction")),t.prototype=Object.create(m),t},a.awrap=function(t){return{__await:t}},v(y.prototype),o(y.prototype,n,function(){return this}),a.AsyncIterator=y,a.async=function(t,e,n,r,i){void 0===i&&(i=Promise);var o=new y(s(t,e,n,r),i);return a.isGeneratorFunction(e)?o:o.next().then(function(t){return t.done?t.value:o.next()})},v(m),o(m,i,"Generator"),o(m,r,function(){return this}),o(m,"toString",function(){return"[object Generator]"}),a.keys=function(t){var e,n=Object(t),r=[];for(e in n)r.push(e);return r.reverse(),function t(){for(;r.length;){var e=r.pop();if(e in n)return t.value=e,t.done=!1,t}return t.done=!0,t}},a.values=x,b.prototype={constructor:b,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(_),!t)for(var e in this)"t"===e.charAt(0)&&l.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=void 0)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(n){if(this.done)throw n;var r=this;function t(t,e){return o.type="throw",o.arg=n,r.next=t,e&&(r.method="next",r.arg=void 0),!!e}for(var e=this.tryEntries.length-1;0<=e;--e){var i=this.tryEntries[e],o=i.completion;if("root"===i.tryLoc)return t("end");if(i.tryLoc<=this.prev){var a=l.call(i,"catchLoc"),s=l.call(i,"finallyLoc");if(a&&s){if(this.prev<i.catchLoc)return t(i.catchLoc,!0);if(this.prev<i.finallyLoc)return t(i.finallyLoc)}else if(a){if(this.prev<i.catchLoc)return t(i.catchLoc,!0)}else{if(!s)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return t(i.finallyLoc)}}}},abrupt:function(t,e){for(var n=this.tryEntries.length-1;0<=n;--n){var r=this.tryEntries[n];if(r.tryLoc<=this.prev&&l.call(r,"finallyLoc")&&this.prev<r.finallyLoc){var i=r;break}}var o=(i=i&&("break"===t||"continue"===t)&&i.tryLoc<=e&&e<=i.finallyLoc?null:i)?i.completion:{};return o.type=t,o.arg=e,i?(this.method="next",this.next=i.finallyLoc,h):this.complete(o)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),h},finish:function(t){for(var e=this.tryEntries.length-1;0<=e;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),_(n),h}},catch:function(t){for(var e=this.tryEntries.length-1;0<=e;--e){var n,r,i=this.tryEntries[e];if(i.tryLoc===t)return"throw"===(n=i.completion).type&&(r=n.arg,_(i)),r}throw new Error("illegal catch attempt")},delegateYield:function(t,e,n){return this.delegate={iterator:x(t),resultName:e,nextLoc:n},"next"===this.method&&(this.arg=void 0),h}},a}function rc(t,e,n,r,i,o,a){try{var s=t[o](a),l=s.value}catch(t){return void n(t)}s.done?e(l):Promise.resolve(l).then(r,i)}function ic(t,e){return(ic=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t})(t,e)}function oc(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}function ac(t,e){var n,r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(r)return(r=r.call(t)).next.bind(r);if(Array.isArray(t)||(r=function(t,e){var n;if(t)return"string"==typeof t?oc(t,e):"Map"===(n="Object"===(n=Object.prototype.toString.call(t).slice(8,-1))&&t.constructor?t.constructor.name:n)||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?oc(t,e):void 0}(t))||e&&t&&"number"==typeof t.length)return r&&(t=r),n=0,function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}};throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var sc=y(),lc=y(),uc=y(),cc=K(),hc=function(){function s(){var s=this;this.canvasConfig=void 0,this.pathGeneratorFactory=void 0,this.pointInPathPickerFactory=void 0,this.isHit=function(t,e,n,r,i){var o=s.pointInPathPickerFactory[t.nodeName];if(o){var n=et(cc,n),e=Bt(lc,Nt(uc,e[0],e[1],0),n),n=t.getGeometryBounds().halfExtents,a=t.parsedStyle.anchor;if(e[0]+=(a&&a[0]||0)*n[0]*2,e[1]+=(a&&a[1]||0)*n[1]*2,o(t,new Ra(e[0],e[1]),r,s.isPointInPath,i))return!0}return!1},this.isPointInPath=function(t,e,n){var t=t.offscreenCanvas.getOrCreateContext(s.canvasConfig.offscreenCanvas),r=s.pathGeneratorFactory[e.nodeName];return r&&(t.beginPath(),r(t,e.parsedStyle),t.closePath()),t.isPointInPath(n.x,n.y)}}var t=s.prototype;return t.apply=function(t,n){var r=this,e=t.config,i=t.renderingService,o=t.renderingContext,a=t.pathGeneratorFactory,t=t.pointInPathPickerFactory,l=(this.canvasConfig=e,this.pathGeneratorFactory=a,this.pointInPathPickerFactory=t,null==(e=o.root)?void 0:e.ownerDocument);i.hooks.pick.tapPromise(s.tag,function(){s=nc().mark(function t(e){return nc().wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",r.pick(l,e,n));case 1:case"end":return t.stop()}},t)});var s,e=function(){var t=this,a=arguments;return new Promise(function(e,n){var r=s.apply(t,a);function i(t){rc(r,e,n,i,o,"next",t)}function o(t){rc(r,e,n,i,o,"throw",t)}i(void 0)})};return function(t){return e.apply(this,arguments)}}()),i.hooks.pickSync.tap(s.tag,function(t){return r.pick(l,t,n)})},t.pick=function(t,e,n){for(var r=e.topmost,i=e.position,o=i.x,i=i.y,a=Nt(sc,o,i,0),s=[],l=ac(t.elementsFromBBox(a[0],a[1],a[0],a[1]));!(u=l()).done;){var u=u.value,c=u.getWorldTransform();if(this.isHit(u,a,c,!1,n)){c=Wr(u);if(c){c=c.parsedStyle.clipPath;if(this.isHit(c,a,c.getWorldTransform(),!0,n)){if(r)return e.picked=[u],e;s.push(u)}}else{if(r)return e.picked=[u],e;s.push(u)}}}return e.picked=s,e},s}();function dc(t,e,n,r){t-=n,n=e-r;return Math.sqrt(t*t+n*n)}function fc(t,e){return Math.abs(t-e)<.001}function pc(t,e){var n=Math.min.apply(Math,t),r=Math.min.apply(Math,e);return{x:n,y:r,width:Math.max.apply(Math,t)-n,height:Math.max.apply(Math,e)-r}}function gc(t){return(t+2*Math.PI)%(2*Math.PI)}hc.tag="CanvasPicker";var mc={box:function(t,e,n,r){return pc([t,n],[e,r])},length:dc,pointAt:function(t,e,n,r,i){return{x:(1-i)*t+i*n,y:(1-i)*e+i*r}},pointDistance:function(t,e,n,r,i,o){var a=(n-t)*(i-t)+(r-e)*(o-e);return a<0?dc(t,e,i,o):(n-t)*(n-t)+(r-e)*(r-e)<a?dc(n,r,i,o):this.pointToLine(t,e,n,r,i,o)},pointToLine:function(t,e,n,r,i,o){n=[n-t,r-e];return ee(n,[0,0])?Math.sqrt((i-t)*(i-t)+(o-e)*(o-e)):(Jt(r=[-n[1],n[0]],r),Math.abs(te([i-t,o-e],r)))},tangentAngle:function(t,e,n,r){return Math.atan2(r-e,n-t)}},vc=1e-4;function yc(t,e,n,r,i,o){for(var a=-1,s=1/0,l=[n,r],u=20,c=1/(u=o&&200<o?o/10:u),h=c/10,d=0;d<=u;d++){var f=d*c,p=[i.apply(void 0,t.concat([f])),i.apply(void 0,e.concat([f]))],p=dc(l[0],l[1],p[0],p[1]);p<s&&(a=f,s=p)}if(0===a)return{x:t[0],y:e[0]};if(1===a)return{x:t[(n=t.length)-1],y:e[n-1]};for(var s=1/0,g=0;g<32&&!(h<vc);g++){var m=a-h,v=a+h,y=[i.apply(void 0,t.concat([m])),i.apply(void 0,e.concat([m]))],y=dc(l[0],l[1],y[0],y[1]);0<=m&&y<s?(a=m,s=y):(m=[i.apply(void 0,t.concat([v])),i.apply(void 0,e.concat([v]))],y=dc(l[0],l[1],m[0],m[1]),v<=1&&y<s?(a=v,s=y):h*=.5)}return{x:i.apply(void 0,t.concat([a])),y:i.apply(void 0,e.concat([a]))}}function Ec(t,e,n,r){var i=1-r;return i*i*t+2*r*i*e+r*r*n}function _c(t,e,n){n=t+n-2*e;return fc(n,0)?[.5]:(t=(t-e)/n)<=1&&0<=t?[t]:[]}function bc(t,e,n,r){return 2*(1-r)*(e-t)+2*r*(n-e)}function xc(t,e,n,r,i,o,a){var s=Ec(t,n,i,a),l=Ec(e,r,o,a),u=mc.pointAt(t,e,n,r,a),n=mc.pointAt(n,r,i,o,a);return[[t,e,u.x,u.y,s,l],[s,l,n.x,n.y,i,o]]}function Sc(t,e,n,r,i,o,a){return 0===a?(dc(t,e,n,r)+dc(n,r,i,o)+dc(t,e,i,o))/2:(e=(t=xc(t,e,n,r,i,o,.5))[0],n=t[1],e.push(a-1),n.push(a-1),Sc.apply(void 0,e)+Sc.apply(void 0,n))}var wc={box:function(t,e,n,r,i,o){var a=_c(t,n,i)[0],s=_c(e,r,o)[0],l=[t,i],u=[e,o];return void 0!==a&&l.push(Ec(t,n,i,a)),void 0!==s&&u.push(Ec(e,r,o,s)),pc(l,u)},length:function(t,e,n,r,i,o){return Sc(t,e,n,r,i,o,3)},nearestPoint:function(t,e,n,r,i,o,a,s){return yc([t,n,i],[e,r,o],a,s,Ec)},pointDistance:function(t,e,n,r,i,o,a,s){t=this.nearestPoint(t,e,n,r,i,o,a,s);return dc(t.x,t.y,a,s)},interpolationAt:Ec,pointAt:function(t,e,n,r,i,o,a){return{x:Ec(t,n,i,a),y:Ec(e,r,o,a)}},divide:xc,tangentAngle:function(t,e,n,r,i,o,a){t=bc(t,n,i,a),n=bc(e,r,o,a);return gc(Math.atan2(n,t))}};function Tc(t,e,n,r,i){var o=1-i;return o*o*o*t+3*e*i*o*o+3*n*i*i*o+r*i*i*i}function Ac(t,e,n,r,i){var o=1-i;return 3*(o*o*(e-t)+2*o*i*(n-e)+i*i*(r-n))}function Mc(t,e,n,r){var i,o,r=-3*t+9*e-9*n+3*r,n=6*t-12*e+6*n,e=3*e-3*t,t=[];return fc(r,0)?fc(n,0)||0<=(i=-e/n)&&i<=1&&t.push(i):fc(e=n*n-4*r*e,0)?t.push(-n/(2*r)):0<e&&(o=(-n-(e=Math.sqrt(e)))/(2*r),0<=(i=(-n+e)/(2*r))&&i<=1&&t.push(i),0<=o)&&o<=1&&t.push(o),t}function Rc(t,e,n,r,i,o,a,s,l){var u=Tc(t,n,i,a,l),c=Tc(e,r,o,s,l),h=mc.pointAt(t,e,n,r,l),n=mc.pointAt(n,r,i,o,l),r=mc.pointAt(i,o,a,s,l),i=mc.pointAt(h.x,h.y,n.x,n.y,l),o=mc.pointAt(n.x,n.y,r.x,r.y,l);return[[t,e,h.x,h.y,i.x,i.y,u,c],[u,c,o.x,o.y,r.x,r.y,a,s]]}function Nc(t,e,n,r,i,o,a,s,l){if(0===l){for(var u=[t,n,i,a],c=[e,r,o,s],h=0,d=u.length,f=0;f<d;f++)h+=dc(u[f],c[f],u[(f+1)%d],c[(f+1)%d]);return h/2}t=Rc(t,e,n,r,i,o,a,s,.5),e=[].concat(t[0],[l-1]),n=[].concat(t[1],[l-1]);return Nc.apply(void 0,e)+Nc.apply(void 0,n)}var Cc={extrema:Mc,box:function(t,e,n,r,i,o,a,s){for(var l=[t,a],u=[e,s],c=Mc(t,n,i,a),h=Mc(e,r,o,s),d=0;d<c.length;d++)l.push(Tc(t,n,i,a,c[d]));for(var f=0;f<h.length;f++)u.push(Tc(e,r,o,s,h[f]));return pc(l,u)},length:function(t,e,n,r,i,o,a,s){return Nc(t,e,n,r,i,o,a,s,3)},nearestPoint:function(t,e,n,r,i,o,a,s,l,u,c){return yc([t,n,i,a],[e,r,o,s],l,u,Tc,c)},pointDistance:function(t,e,n,r,i,o,a,s,l,u,c){t=this.nearestPoint(t,e,n,r,i,o,a,s,l,u,c);return dc(t.x,t.y,l,u)},interpolationAt:Tc,pointAt:function(t,e,n,r,i,o,a,s,l){return{x:Tc(t,n,i,a,l),y:Tc(e,r,o,s,l)}},divide:Rc,tangentAngle:function(t,e,n,r,i,o,a,s,l){t=Ac(t,n,i,a,l),n=Ac(e,r,o,s,l);return gc(Math.atan2(n,t))}};function Pc(t,e,n,r){t-=n,n=e-r;return Math.sqrt(t*t+n*n)}function Oc(t,e,n,r,i,o){return t<=i&&i<=t+n&&e<=o&&o<=e+r}function Ic(t,e,n,r,i,o,a,s){var l=(Math.atan2(s-e,a-t)+2*Math.PI)%(2*Math.PI),t={x:t+n*Math.cos(l),y:e+n*Math.sin(l)};return Pc(t.x,t.y,a,s)<=o/2}function Lc(t,e,n,r,i,o,a){var s=Math.min(t,n),l=Math.max(t,n),u=Math.min(e,r),c=Math.max(e,r),h=i/2;return s-h<=o&&o<=l+h&&u-h<=a&&a<=c+h&&mc.pointToLine(t,e,n,r,o,a)<=i/2}function kc(t,e,n,r,i){var o=t.length;if(!(o<2)){for(var a=0;a<o-1;a++)if(Lc(t[a][0],t[a][1],t[a+1][0],t[a+1][1],e,n,r))return!0;if(i){var i=t[0],s=t[o-1];if(Lc(i[0],i[1],s[0],s[1],e,n,r))return!0}}return!1}var Dc=1e-6;function Bc(t){return Math.abs(t)<Dc?0:t<0?-1:1}function Fc(t,e,n){var r=!1,i=t.length;if(i<=2)return!1;for(var o,a,s,l=0;l<i;l++){var u=t[l],c=t[(l+1)%i];if(a=c,((s=[e,n])[0]-(o=u)[0])*(a[1]-o[1])==(a[0]-o[0])*(s[1]-o[1])&&Math.min(o[0],a[0])<=s[0]&&s[0]<=Math.max(o[0],a[0])&&Math.min(o[1],a[1])<=s[1]&&s[1]<=Math.max(o[1],a[1]))return!0;0<Bc(u[1]-n)!=0<Bc(c[1]-n)&&Bc(e-(n-u[1])*(u[0]-c[0])/(u[1]-c[1])-u[0])<0&&(r=!r)}return r}function Uc(t,e,n){for(var r=!1,i=0;i<t.length&&!(r=Fc(t[i],e,n));i++);return r}function Gc(t,e,n){var t=t.parsedStyle,r=t.r,i=t.fill,o=t.stroke,a=t.lineWidth,s=t.increasedLineWidthForHitTesting,t=t.pointerEvents,a=((a||0)+(s||0))/2,s=Pc(r,r,e.x,e.y),e=Zi(t,i,o),t=e[0],i=e[1];return t&&i||n?s<=r+a:t?s<=r:!!i&&r-a<=s&&s<=r+a}function Wc(t,e,n,r){return t/(n*n)+e/(r*r)}function Vc(t,e,n){var t=t.parsedStyle,r=t.rx,i=t.ry,o=t.fill,a=t.stroke,s=t.lineWidth,l=t.increasedLineWidthForHitTesting,t=t.pointerEvents,u=e.x,e=e.y,t=Zi(t,o,a),o=t[0],a=t[1],t=((s||0)+(l||0))/2,s=(u-r)*(u-r),l=(e-i)*(e-i);return o&&a||n?Wc(s,l,r+t,i+t)<=1:o?Wc(s,l,r,i)<=1:!!a&&1<=Wc(s,l,r-t,i-t)&&Wc(s,l,r+t,i+t)<=1}function jc(t,e,n){var t=t.parsedStyle,r=t.x1,i=t.y1,o=t.x2,a=t.y2,s=t.lineWidth,l=t.increasedLineWidthForHitTesting,u=t.defX,c=t.defY;return!(!Zi(t.pointerEvents,t.fill,t.stroke)[1]&&!n||!s)&&Lc(r,i,o,a,(s||0)+(l||0),e.x+(void 0===u?0:u),e.y+(void 0===c?0:c))}function zc(t,e,n,r,i){var o=t.parsedStyle,a=o.lineWidth,s=o.increasedLineWidthForHitTesting,l=o.stroke,u=o.fill,c=o.defX,c=void 0===c?0:c,h=o.defY,h=void 0===h?0:h,d=o.path,o=o.pointerEvents,f=d.segments,p=d.hasArc,g=d.polylines,d=d.polygons,o=Zi(o,(null==d?void 0:d.length)&&u,l),u=o[0],l=o[1],o=Fi(t),m=!1;return u||n?p?r(i,t,e):Uc(d,e.x+c,e.y+h)||Uc(g,e.x+c,e.y+h):l||n?function(t,e,n,r,i){for(var o=!1,a=e/2,s=0;s<t.length;s++){var l=t[s],u=l.currentPoint,c=l.params,h=l.prePoint,d=l.box;if(!d||Oc(d.x-a,d.y-a,d.width+e,d.height+e,n,r))switch(l.command){case"L":case"Z":if(o=Lc(h[0],h[1],u[0],u[1],e,n,r))return!0;break;case"Q":if(o=wc.pointDistance(h[0],h[1],c[1],c[2],c[3],c[4],n,r)<=e/2)return!0;break;case"C":if(o=Cc.pointDistance(h[0],h[1],c[1],c[2],c[3],c[4],c[5],c[6],n,r,i)<=e/2)return!0;break;case"A":l.cubicParams||(l.cubicParams=me(h[0],h[1],c[1],c[2],c[3],c[4],c[5],c[6],c[7],void 0));for(var f=l.cubicParams,p=h,g=0;g<f.length;g+=6){var m=Cc.pointDistance(p[0],p[1],f[g],f[g+1],f[g+2],f[g+3],f[g+4],f[g+5],n,r,i),p=[f[g+4],f[g+5]];if(o=m<=e/2)return!0}}}return o}(f,(a||0)+(s||0),e.x+c,e.y+h,o):m}function Hc(t,e,n){var t=t.parsedStyle,r=t.stroke,i=t.fill,o=t.lineWidth,a=t.increasedLineWidthForHitTesting,s=t.points,l=t.defX,l=void 0===l?0:l,u=t.defY,u=void 0===u?0:u,t=Zi(t.pointerEvents,i,r),i=t[0],r=!1;return r=(r=t[1]||n?kc(s.points,(o||0)+(a||0),e.x+l,e.y+u,!0):r)||!i&&!n?r:Fc(s.points,e.x+l,e.y+u)}function Xc(t,e,n){var t=t.parsedStyle,r=t.lineWidth,i=t.increasedLineWidthForHitTesting,o=t.points,a=t.defX,s=t.defY;return!(!Zi(t.pointerEvents,t.fill,t.stroke)[1]&&!n||!r)&&kc(o.points,(r||0)+(i||0),e.x+(void 0===a?0:a),e.y+(void 0===s?0:s),!1)}function Yc(t,e,n,r,i){var o,a,s,l,u,c,h,d,f,p=t.parsedStyle,g=p.radius,m=p.fill,v=p.stroke,y=p.lineWidth,E=p.increasedLineWidthForHitTesting,_=p.width,b=p.height,p=Zi(p.pointerEvents,m,v),m=p[0],v=p[1],p=(y||0)+(E||0);return g&&g.some(function(t){return 0!==t})?(y=!1,(v||n)&&(h=E=0,l=_,c=b,g=g.map(function(t){return Ue(t,0,Math.min(Math.abs(_)/2,Math.abs(b)/2))}),f=p,o=e.x,a=e.y,d=g[0],s=g[1],u=g[2],g=g[3],y=Lc(E+d,h,E+l-s,h,f,o,a)||Lc(E+l,h+s,E+l,h+c-u,f,o,a)||Lc(E+l-u,h+c,E+g,h+c,f,o,a)||Lc(E,h+c-g,E,h+d,f,o,a)||Ic(E+l-s,h+s,s,Math.PI,Math.PI,f,o,a)||Ic(E+l-u,h+c-u,u,0,Math.PI,f,o,a)||Ic(E+g,h+c-g,g,Math.PI,Math.PI,f,o,a)||Ic(E+d,h+d,d,Math.PI,Math.PI,f,o,a)),y||!m&&!n?y:r(i,t,e)):(s=p/2,m&&v||n?Oc(0-s,0-s,_+s,b+s,e.x,e.y):m?Oc(0,0,_,b,e.x,e.y):!!v&&(u=l=0,c=_,g=b,E=p,h=e.x,d=e.y,Oc(l-(f=E/2),u-f,c,E,h,d)||Oc(l+c-f,u-f,E,g,h,d)||Oc(l+f,u+g-f,c,E,h,d)||Oc(l-f,u+f,E,g,h,d)))}var Kc=function(i){var t;function e(){for(var t,e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];return(t=i.call.apply(i,[this].concat(n))||this).name="canvas-picker",t}t=i,(n=e).prototype=Object.create(t.prototype),ic(n.prototype.constructor=n,t);var n=e.prototype;return n.init=function(){function t(){return!0}(e={})[lt.CIRCLE]=Gc,e[lt.ELLIPSE]=Vc,e[lt.RECT]=Yc,e[lt.LINE]=jc,e[lt.POLYLINE]=Xc,e[lt.POLYGON]=Hc,e[lt.PATH]=zc,e[lt.TEXT]=t,e[lt.GROUP]=null,e[lt.IMAGE]=t,e[lt.HTML]=null,e[lt.MESH]=null;var e;this.context.pointInPathPickerFactory=e,this.addRenderingPlugin(new hc)},n.destroy=function(){delete this.context.pointInPathPickerFactory,this.removeAllRenderingPlugins()},e}(Ws);function qc(){qc=function(){return a};var a={},t=Object.prototype,l=t.hasOwnProperty,u=Object.defineProperty||function(t,e,n){t[e]=n.value},e="function"==typeof Symbol?Symbol:{},r=e.iterator||"@@iterator",n=e.asyncIterator||"@@asyncIterator",i=e.toStringTag||"@@toStringTag";function o(t,e,n){return Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{o({},"")}catch(t){o=function(t,e,n){return t[e]=n}}function s(t,e,n,r){var i,o,a,s,e=e&&e.prototype instanceof d?e:d,e=Object.create(e.prototype),r=new b(r||[]);return u(e,"_invoke",{value:(i=t,o=n,a=r,s="suspendedStart",function(t,e){if("executing"===s)throw new Error("Generator is already running");if("completed"===s){if("throw"===t)throw e;return S()}for(a.method=t,a.arg=e;;){var n=a.delegate;if(n){n=function t(e,n){var r=n.method,i=e.iterator[r];if(void 0===i)return n.delegate=null,"throw"===r&&e.iterator.return&&(n.method="return",n.arg=void 0,t(e,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),h;r=c(i,e.iterator,n.arg);if("throw"===r.type)return n.method="throw",n.arg=r.arg,n.delegate=null,h;i=r.arg;return i?i.done?(n[e.resultName]=i.value,n.next=e.nextLoc,"return"!==n.method&&(n.method="next",n.arg=void 0),n.delegate=null,h):i:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,h)}(n,a);if(n){if(n===h)continue;return n}}if("next"===a.method)a.sent=a._sent=a.arg;else if("throw"===a.method){if("suspendedStart"===s)throw s="completed",a.arg;a.dispatchException(a.arg)}else"return"===a.method&&a.abrupt("return",a.arg);s="executing";n=c(i,o,a);if("normal"===n.type){if(s=a.done?"completed":"suspendedYield",n.arg===h)continue;return{value:n.arg,done:a.done}}"throw"===n.type&&(s="completed",a.method="throw",a.arg=n.arg)}})}),e}function c(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(t){return{type:"throw",arg:t}}}a.wrap=s;var h={};function d(){}function f(){}function p(){}var e={},g=(o(e,r,function(){return this}),Object.getPrototypeOf),g=g&&g(g(x([]))),m=(g&&g!==t&&l.call(g,r)&&(e=g),p.prototype=d.prototype=Object.create(e));function v(t){["next","throw","return"].forEach(function(e){o(t,e,function(t){return this._invoke(e,t)})})}function y(a,s){var e;u(this,"_invoke",{value:function(n,r){function t(){return new s(function(t,e){!function e(t,n,r,i){var o,t=c(a[t],a,n);if("throw"!==t.type)return(n=(o=t.arg).value)&&"object"==typeof n&&l.call(n,"__await")?s.resolve(n.__await).then(function(t){e("next",t,r,i)},function(t){e("throw",t,r,i)}):s.resolve(n).then(function(t){o.value=t,r(o)},function(t){return e("throw",t,r,i)});i(t.arg)}(n,r,t,e)})}return e=e?e.then(t,t):t()}})}function E(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function _(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function b(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(E,this),this.reset(!0)}function x(e){if(e){var n,t=e[r];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length))return n=-1,(t=function t(){for(;++n<e.length;)if(l.call(e,n))return t.value=e[n],t.done=!1,t;return t.value=void 0,t.done=!0,t}).next=t}return{next:S}}function S(){return{value:void 0,done:!0}}return u(m,"constructor",{value:f.prototype=p,configurable:!0}),u(p,"constructor",{value:f,configurable:!0}),f.displayName=o(p,i,"GeneratorFunction"),a.isGeneratorFunction=function(t){t="function"==typeof t&&t.constructor;return!!t&&(t===f||"GeneratorFunction"===(t.displayName||t.name))},a.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,p):(t.__proto__=p,o(t,i,"GeneratorFunction")),t.prototype=Object.create(m),t},a.awrap=function(t){return{__await:t}},v(y.prototype),o(y.prototype,n,function(){return this}),a.AsyncIterator=y,a.async=function(t,e,n,r,i){void 0===i&&(i=Promise);var o=new y(s(t,e,n,r),i);return a.isGeneratorFunction(e)?o:o.next().then(function(t){return t.done?t.value:o.next()})},v(m),o(m,i,"Generator"),o(m,r,function(){return this}),o(m,"toString",function(){return"[object Generator]"}),a.keys=function(t){var e,n=Object(t),r=[];for(e in n)r.push(e);return r.reverse(),function t(){for(;r.length;){var e=r.pop();if(e in n)return t.value=e,t.done=!1,t}return t.done=!0,t}},a.values=x,b.prototype={constructor:b,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(_),!t)for(var e in this)"t"===e.charAt(0)&&l.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=void 0)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(n){if(this.done)throw n;var r=this;function t(t,e){return o.type="throw",o.arg=n,r.next=t,e&&(r.method="next",r.arg=void 0),!!e}for(var e=this.tryEntries.length-1;0<=e;--e){var i=this.tryEntries[e],o=i.completion;if("root"===i.tryLoc)return t("end");if(i.tryLoc<=this.prev){var a=l.call(i,"catchLoc"),s=l.call(i,"finallyLoc");if(a&&s){if(this.prev<i.catchLoc)return t(i.catchLoc,!0);if(this.prev<i.finallyLoc)return t(i.finallyLoc)}else if(a){if(this.prev<i.catchLoc)return t(i.catchLoc,!0)}else{if(!s)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return t(i.finallyLoc)}}}},abrupt:function(t,e){for(var n=this.tryEntries.length-1;0<=n;--n){var r=this.tryEntries[n];if(r.tryLoc<=this.prev&&l.call(r,"finallyLoc")&&this.prev<r.finallyLoc){var i=r;break}}var o=(i=i&&("break"===t||"continue"===t)&&i.tryLoc<=e&&e<=i.finallyLoc?null:i)?i.completion:{};return o.type=t,o.arg=e,i?(this.method="next",this.next=i.finallyLoc,h):this.complete(o)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),h},finish:function(t){for(var e=this.tryEntries.length-1;0<=e;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),_(n),h}},catch:function(t){for(var e=this.tryEntries.length-1;0<=e;--e){var n,r,i=this.tryEntries[e];if(i.tryLoc===t)return"throw"===(n=i.completion).type&&(r=n.arg,_(i)),r}throw new Error("illegal catch attempt")},delegateYield:function(t,e,n){return this.delegate={iterator:x(t),resultName:e,nextLoc:n},"next"===this.method&&(this.arg=void 0),h}},a}function $c(t,e,n,r,i,o,a){try{var s=t[o](a),l=s.value}catch(t){return void n(t)}s.done?e(l):Promise.resolve(l).then(r,i)}function Zc(s){return function(){var t=this,a=arguments;return new Promise(function(e,n){var r=s.apply(t,a);function i(t){$c(r,e,n,i,o,"next",t)}function o(t){$c(r,e,n,i,o,"throw",t)}i(void 0)})}}function Qc(){return(Qc=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n,r=arguments[e];for(n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t}).apply(this,arguments)}function Jc(t,e){return(Jc=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t})(t,e)}var th=function(){function r(t){this.canvasRendererPluginOptions=void 0,this.context=void 0,this.pathGeneratorFactory=void 0,this.rBush=void 0,this.removedRBushNodeAABBs=[],this.renderQueue=[],this.restoreStack=[],this.clearFullScreen=!1,this.vpMatrix=K(),this.dprMatrix=K(),this.tmpMat4=K(),this.vec3a=y(),this.vec3b=y(),this.vec3c=y(),this.vec3d=y(),this.canvasRendererPluginOptions=t}var t=r.prototype;return t.apply=function(t,u){function o(t){(t=t.target.rBushNode).aabb&&h.removedRBushNodeAABBs.push(t.aabb)}function a(t){(t=t.target.rBushNode).aabb&&h.removedRBushNodeAABBs.push(t.aabb)}function c(t,e){t.isVisible()&&!t.isCulled()&&(h.renderDisplayObject(t,e,h.context,h.restoreStack,u),h.saveDirtyAABB(t)),(t.sortable.sorted||t.childNodes).forEach(function(t){c(t,e)})}var h=this,d=(this.context=t).config,f=t.camera,l=t.renderingService,p=t.renderingContext,e=t.rBushRoot,n=t.pathGeneratorFactory,g=(this.rBush=e,this.pathGeneratorFactory=n,t.contextService),m=p.root.ownerDocument.defaultView;l.hooks.init.tapPromise(r.tag,Zc(qc().mark(function t(){var e,n,r,i;return qc().wrap(function(t){for(;;)switch(t.prev=t.next){case 0:m.addEventListener(v.UNMOUNTED,o),m.addEventListener(v.CULLED,a),e=g.getDPR(),n=d.width,r=d.height,i=g.getContext(),h.clearRect(i,0,0,n*e,r*e,d.background);case 6:case"end":return t.stop()}},t)}))),l.hooks.destroy.tap(r.tag,function(){m.removeEventListener(v.UNMOUNTED,o),m.removeEventListener(v.CULLED,a)}),l.hooks.beginFrame.tap(r.tag,function(){var t=g.getContext(),e=g.getDPR(),n=d.width,r=d.height,i=h.canvasRendererPluginOptions,o=i.dirtyObjectNumThreshold,i=i.dirtyObjectRatioThreshold,a=l.getStats(),s=a.total,a=a.rendered,s=a/s;h.clearFullScreen=l.disableDirtyRectangleRendering()||o<a&&i<s,t&&(t.resetTransform?t.resetTransform():t.setTransform(1,0,0,1,0,0),h.clearFullScreen)&&h.clearRect(t,0,0,n*e,r*e,d.background)});l.hooks.endFrame.tap(r.tag,function(){var e=g.getContext(),t=g.getDPR();if(dt(h.dprMatrix,[t,t,1]),rt(h.vpMatrix,h.dprMatrix,f.getOrthoMatrix()),h.clearFullScreen)c(p.root,e);else{t=h.safeMergeAABB.apply(h,[h.mergeDirtyAABBs(h.renderQueue)].concat(h.removedRBushNodeAABBs.map(function(t){var e=t.minX,n=t.minY,r=t.maxX,t=t.maxY,i=new Ta;return i.setMinMax([e,n,0],[r,t,0]),i})));if(h.removedRBushNodeAABBs=[],Ta.isEmpty(t))return void(h.renderQueue=[]);var n=h.convertAABB2Rect(t),r=n.x,i=n.y,o=n.width,n=n.height,a=Bt(h.vec3a,[r,i,0],h.vpMatrix),s=Bt(h.vec3b,[r+o,i,0],h.vpMatrix),l=Bt(h.vec3c,[r,i+n,0],h.vpMatrix),r=Bt(h.vec3d,[r+o,i+n,0],h.vpMatrix),o=Math.min(a[0],s[0],r[0],l[0]),i=Math.min(a[1],s[1],r[1],l[1]),n=Math.max(a[0],s[0],r[0],l[0]),a=Math.max(a[1],s[1],r[1],l[1]),s=Math.floor(o),r=Math.floor(i),l=Math.ceil(n-o),n=Math.ceil(a-i);e.save(),h.clearRect(e,s,r,l,n,d.background),e.beginPath(),e.rect(s,r,l,n),e.clip(),e.setTransform(h.vpMatrix[0],h.vpMatrix[1],h.vpMatrix[4],h.vpMatrix[5],h.vpMatrix[12],h.vpMatrix[13]),d.renderer.getConfig().enableDirtyRectangleRenderingDebug&&m.dispatchEvent(new Ga(qs.DIRTY_RECTANGLE,{dirtyRect:{x:s,y:r,width:l,height:n}})),h.searchDirtyObjects(t).sort(function(t,e){return t.sortable.renderOrder-e.sortable.renderOrder}).forEach(function(t){t&&t.isVisible()&&!t.isCulled()&&h.renderDisplayObject(t,e,h.context,h.restoreStack,u)}),e.restore(),h.renderQueue.forEach(function(t){h.saveDirtyAABB(t)}),h.renderQueue=[]}h.restoreStack.forEach(function(){e.restore()}),h.restoreStack=[]}),l.hooks.render.tap(r.tag,function(t){h.clearFullScreen||h.renderQueue.push(t)})},t.clearRect=function(t,e,n,r,i,o){t.clearRect(e,n,r,i),o&&(t.fillStyle=o,t.fillRect(e,n,r,i))},t.renderDisplayObject=function(t,e,n,r,i){var o,a=t.nodeName,s=r[r.length-1],s=(!s||t.compareDocumentPosition(s)&Node.DOCUMENT_POSITION_CONTAINS||(e.restore(),r.pop()),this.context.styleRendererFactory[a]),a=this.pathGeneratorFactory[a],l=t.parsedStyle.clipPath;l&&(this.applyWorldTransform(e,l),o=this.pathGeneratorFactory[l.nodeName])&&(e.save(),r.push(t),e.beginPath(),o(e,l.parsedStyle),e.closePath(),e.clip()),s&&(this.applyWorldTransform(e,t),e.save(),this.applyAttributesToContext(e,t)),a&&(e.beginPath(),a(e,t.parsedStyle),t.nodeName!==lt.LINE)&&t.nodeName!==lt.PATH&&t.nodeName!==lt.POLYLINE&&e.closePath(),s&&(s.render(e,t.parsedStyle,t,n,this,i),e.restore()),t.renderable.dirty=!1},t.convertAABB2Rect=function(t){var e=t.getMin(),t=t.getMax(),n=Math.floor(e[0]),e=Math.floor(e[1]);return{x:n,y:e,width:Math.ceil(t[0])-n,height:Math.ceil(t[1])-e}},t.mergeDirtyAABBs=function(t){var n=new Ta;return t.forEach(function(t){var e=t.getRenderBounds(),e=(n.add(e),t.renderable.dirtyRenderBounds);e&&n.add(e)}),n},t.searchDirtyObjects=function(t){var e=t.getMin(),n=e[0],e=e[1],t=t.getMax(),r=t[0],t=t[1];return this.rBush.search({minX:n,minY:e,maxX:r,maxY:t}).map(function(t){return t.displayObject})},t.saveDirtyAABB=function(t){var e=t.renderable,t=(e.dirtyRenderBounds||(e.dirtyRenderBounds=new Ta),t.getRenderBounds());t&&e.dirtyRenderBounds.update(t.center,t.halfExtents)},t.applyAttributesToContext=function(t,e){var n=e.parsedStyle,r=n.stroke,i=n.fill,o=n.opacity,a=n.lineDash,n=n.lineDashOffset;a&&t.setLineDash(a),M(n)||(t.lineDashOffset=n),M(o)||(t.globalAlpha*=o),M(r)||Array.isArray(r)||r.isNone||(t.strokeStyle=e.attributes.stroke),M(i)||Array.isArray(i)||i.isNone||(t.fillStyle=e.attributes.fill)},t.applyWorldTransform=function(t,e,n){var r=0,i=0,o=(e.parsedStyle||{}).anchor,a=o&&o[0]||0,o=o&&o[1]||0;0===a&&0===o||(r=-a*((a=e.geometry.contentBounds)&&2*a.halfExtents[0]||0),i=-o*(a&&2*a.halfExtents[1]||0)),n?($(this.tmpMat4,e.getLocalTransform()),this.vec3a[0]=r,this.vec3a[1]=i,this.vec3a[2]=0,it(this.tmpMat4,this.tmpMat4,this.vec3a),rt(this.tmpMat4,n,this.tmpMat4)):($(this.tmpMat4,e.getWorldTransform()),this.vec3a[0]=r,this.vec3a[1]=i,this.vec3a[2]=0,it(this.tmpMat4,this.tmpMat4,this.vec3a)),rt(this.tmpMat4,this.vpMatrix,this.tmpMat4),t.setTransform(this.tmpMat4[0],this.tmpMat4[1],this.tmpMat4[4],this.tmpMat4[5],this.tmpMat4[12],this.tmpMat4[13])},t.safeMergeAABB=function(){for(var e=new Ta,t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];return n.forEach(function(t){e.add(t)}),e},r}(),eh=(th.tag="CanvasRenderer",function(){function t(t){this.imagePool=void 0,this.imagePool=t}var e=t.prototype;return e.render=function(t,e,n,r,i,o){var a=e.fill,s=e.fillRule,l=e.opacity,u=e.fillOpacity,c=e.stroke,h=e.strokeOpacity,d=e.lineWidth,f=e.lineCap,p=e.lineJoin,g=e.shadowType,m=e.shadowColor,v=e.shadowBlur,y=e.filter,e=e.miterLimit,E=!M(a)&&!a.isNone,_=!M(c)&&!c.isNone&&0<d,b=0===a.alpha,y=!(!y||!y.length),m=!M(m)&&0<v,v=n.nodeName,g="inner"===g,v=_&&m&&(v===lt.PATH||v===lt.LINE||v===lt.POLYLINE||b||g);E&&(t.globalAlpha=l*u,v||nh(n,t,m),this.fill(t,n,a,s,r,i,o),v||this.clearShadowAndFilter(t,y,m)),_&&(t.globalAlpha=l*h,t.lineWidth=d,M(e)||(t.miterLimit=e),M(f)||(t.lineCap=f),M(p)||(t.lineJoin=p),v&&(g&&(t.globalCompositeOperation="source-atop"),nh(n,t,!0),g)&&(this.stroke(t,n,c,r,i,o),t.globalCompositeOperation="source-over",this.clearShadowAndFilter(t,y,!0)),this.stroke(t,n,c,r,i,o))},e.clearShadowAndFilter=function(t,e,n){n&&(t.shadowColor="transparent",t.shadowBlur=0),e&&(n=t.filter,!M(n))&&-1<n.indexOf("drop-shadow")&&(t.filter=n.replace(/drop-shadow\([^)]*\)/,"").trim()||"none")},e.fill=function(e,n,t,r,i,o,a){var s=this;Array.isArray(t)?t.forEach(function(t){e.fillStyle=s.getColor(t,n,e),r?e.fill(r):e.fill()}):(wo(t)&&(e.fillStyle=this.getPattern(t,n,e,i,o,a)),r?e.fill(r):e.fill())},e.stroke=function(e,n,t,r,i,o){var a=this;Array.isArray(t)?t.forEach(function(t){e.strokeStyle=a.getColor(t,n,e),e.stroke()}):(wo(t)&&(e.strokeStyle=this.getPattern(t,n,e,r,i,o)),e.stroke())},e.getPattern=function(t,e,n,r,i,o){var a,s,l,u,c,h,d;return"rect"===t.image.nodeName&&(a=(s=t.image.parsedStyle).width,s=s.height,l=r.contextService.getDPR(),u=r.config.offscreenCanvas,(c=o.offscreenCanvas.getOrCreateCanvas(u)).width=a*l,c.height=s*l,h=o.offscreenCanvas.getOrCreateContext(u),d=[],t.image.forEach(function(t){i.renderDisplayObject(t,h,r,d,o)}),d.forEach(function(){h.restore()})),this.imagePool.getOrCreatePatternSync(t,n,c,l,function(){e.renderable.dirty=!0,r.renderingService.dirtify()})},e.getColor=function(t,e,n){var r;return t.type!==ur.LinearGradient&&t.type!==ur.RadialGradient||(r=(e=e.getGeometryBounds())&&2*e.halfExtents[0]||1,e=e&&2*e.halfExtents[1]||1,r=this.imagePool.getOrCreateGradient(Qc({type:t.type},t.value,{width:r,height:e}),n)),r},t}());function nh(t,e,n){var r=t.parsedStyle,i=r.filter,o=r.shadowColor,a=r.shadowBlur,s=r.shadowOffsetX,r=r.shadowOffsetY;i&&i.length&&(e.filter=t.style.filter),n&&(e.shadowColor=o.toString(),e.shadowBlur=a||0,e.shadowOffsetX=s||0,e.shadowOffsetY=r||0)}var rh=function(){function t(t){this.imagePool=void 0,this.imagePool=t}return t.prototype.render=function(t,e,n){var r=e.width,i=e.height,o=e.img,a=e.shadowColor,e=e.shadowBlur,o=Fe(o)?this.imagePool.getImageSync(o):(r=r||o.width,i=i||o.height,o);if(o){nh(n,t,!M(a)&&0<e);try{t.drawImage(o,0,0,r,i)}catch(t){}}},t}(),ih=function(){function t(){}var e=t.prototype;return e.render=function(t,e,n){var r=e.lineWidth,i=e.textAlign,o=e.textBaseline,a=e.lineJoin,s=e.miterLimit,l=e.letterSpacing,u=e.stroke,c=e.fill,h=e.fillOpacity,d=e.strokeOpacity,f=e.opacity,p=e.metrics,g=e.dx,m=e.dy,v=e.shadowColor,e=e.shadowBlur,y=p.font,E=p.lines,_=p.height,b=p.lineHeight,x=p.lineMetrics,p=(t.font=y,t.lineWidth=r,t.textAlign="middle"===i?"center":i,o),S=(ct.enableCSSParsing||"alphabetic"!==p||(p="bottom"),t.lineJoin=a,M(s)||(t.miterLimit=s),0),w=("middle"===o?S=-_/2-b/2:"bottom"===o||"alphabetic"===o||"ideographic"===o?S=-_:"top"!==o&&"hanging"!==o||(S=-b),g||0),y=(S+=m||0,1===E.length&&("bottom"===p?(p="middle",S-=.5*_):"top"===p&&(p="middle",S+=.5*_)),t.textBaseline=p,!M(v)&&0<e);nh(n,t,y);for(var T=0;T<E.length;T++){var A=r/2+w;S+=b,M(u)||u.isNone||!r||this.drawLetterSpacing(t,E[T],x[T],i,A,S,l,h,d,f,!0),M(c)||this.drawLetterSpacing(t,E[T],x[T],i,A,S,l,h,d,f)}},e.drawLetterSpacing=function(t,e,n,r,i,o,a,s,l,u,c){if(void 0===c&&(c=!1),0===a)c?this.strokeText(t,e,i,o,l):this.fillText(t,e,i,o,s,u);else{for(var h=t.textAlign,d=(t.textAlign="left",i),f=("center"===r||"middle"===r?d=i-n.width/2:"right"!==r&&"end"!==r||(d=i-n.width),Array.from(e)),p=t.measureText(e).width,g=0;g<f.length;++g){var m=f[g];c?this.strokeText(t,m,d,o,l):this.fillText(t,m,d,o,s,u),d+=p-(m=t.measureText(e.substring(g+1)).width)+a,p=m}t.textAlign=h}},e.fillText=function(t,e,n,r,i,o){var a,s=!M(i)&&1!==i;s&&(a=t.globalAlpha,t.globalAlpha=i*o),t.fillText(e,n,r),s&&(t.globalAlpha=a)},e.strokeText=function(t,e,n,r,i){var o,a=!M(i)&&1!==i;a&&(o=t.globalAlpha,t.globalAlpha=i),t.strokeText(e,n,r),a&&(t.globalAlpha=o)},t}(),oh=function(n){var t;function e(t){var e;return void 0===t&&(t={}),(e=n.call(this)||this).options=void 0,e.name="canvas-renderer",e.options=t,e}t=n,(r=e).prototype=Object.create(t.prototype),Jc(r.prototype.constructor=r,t);var r=e.prototype;return r.init=function(){var t,e=Qc({dirtyObjectNumThreshold:500,dirtyObjectRatioThreshold:.8},this.options),n=this.context.imagePool,r=new eh(n),n=((t={})[lt.CIRCLE]=r,t[lt.ELLIPSE]=r,t[lt.RECT]=r,t[lt.IMAGE]=new rh(n),t[lt.TEXT]=new ih,t[lt.LINE]=r,t[lt.POLYLINE]=r,t[lt.POLYGON]=r,t[lt.PATH]=r,t[lt.GROUP]=void 0,t[lt.HTML]=void 0,t[lt.MESH]=void 0,t);this.context.defaultStyleRendererFactory=n,this.context.styleRendererFactory=n,this.addRenderingPlugin(new th(e))},r.destroy=function(){this.removeAllRenderingPlugins(),delete this.context.defaultStyleRendererFactory,delete this.context.styleRendererFactory},e}(Ws);function ah(){ah=function(){return a};var a={},t=Object.prototype,l=t.hasOwnProperty,u=Object.defineProperty||function(t,e,n){t[e]=n.value},e="function"==typeof Symbol?Symbol:{},r=e.iterator||"@@iterator",n=e.asyncIterator||"@@asyncIterator",i=e.toStringTag||"@@toStringTag";function o(t,e,n){return Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{o({},"")}catch(t){o=function(t,e,n){return t[e]=n}}function s(t,e,n,r){var i,o,a,s,e=e&&e.prototype instanceof d?e:d,e=Object.create(e.prototype),r=new b(r||[]);return u(e,"_invoke",{value:(i=t,o=n,a=r,s="suspendedStart",function(t,e){if("executing"===s)throw new Error("Generator is already running");if("completed"===s){if("throw"===t)throw e;return S()}for(a.method=t,a.arg=e;;){var n=a.delegate;if(n){n=function t(e,n){var r=n.method,i=e.iterator[r];if(void 0===i)return n.delegate=null,"throw"===r&&e.iterator.return&&(n.method="return",n.arg=void 0,t(e,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),h;r=c(i,e.iterator,n.arg);if("throw"===r.type)return n.method="throw",n.arg=r.arg,n.delegate=null,h;i=r.arg;return i?i.done?(n[e.resultName]=i.value,n.next=e.nextLoc,"return"!==n.method&&(n.method="next",n.arg=void 0),n.delegate=null,h):i:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,h)}(n,a);if(n){if(n===h)continue;return n}}if("next"===a.method)a.sent=a._sent=a.arg;else if("throw"===a.method){if("suspendedStart"===s)throw s="completed",a.arg;a.dispatchException(a.arg)}else"return"===a.method&&a.abrupt("return",a.arg);s="executing";n=c(i,o,a);if("normal"===n.type){if(s=a.done?"completed":"suspendedYield",n.arg===h)continue;return{value:n.arg,done:a.done}}"throw"===n.type&&(s="completed",a.method="throw",a.arg=n.arg)}})}),e}function c(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(t){return{type:"throw",arg:t}}}a.wrap=s;var h={};function d(){}function f(){}function p(){}var e={},g=(o(e,r,function(){return this}),Object.getPrototypeOf),g=g&&g(g(x([]))),m=(g&&g!==t&&l.call(g,r)&&(e=g),p.prototype=d.prototype=Object.create(e));function v(t){["next","throw","return"].forEach(function(e){o(t,e,function(t){return this._invoke(e,t)})})}function y(a,s){var e;u(this,"_invoke",{value:function(n,r){function t(){return new s(function(t,e){!function e(t,n,r,i){var o,t=c(a[t],a,n);if("throw"!==t.type)return(n=(o=t.arg).value)&&"object"==typeof n&&l.call(n,"__await")?s.resolve(n.__await).then(function(t){e("next",t,r,i)},function(t){e("throw",t,r,i)}):s.resolve(n).then(function(t){o.value=t,r(o)},function(t){return e("throw",t,r,i)});i(t.arg)}(n,r,t,e)})}return e=e?e.then(t,t):t()}})}function E(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function _(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function b(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(E,this),this.reset(!0)}function x(e){if(e){var n,t=e[r];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length))return n=-1,(t=function t(){for(;++n<e.length;)if(l.call(e,n))return t.value=e[n],t.done=!1,t;return t.value=void 0,t.done=!0,t}).next=t}return{next:S}}function S(){return{value:void 0,done:!0}}return u(m,"constructor",{value:f.prototype=p,configurable:!0}),u(p,"constructor",{value:f,configurable:!0}),f.displayName=o(p,i,"GeneratorFunction"),a.isGeneratorFunction=function(t){t="function"==typeof t&&t.constructor;return!!t&&(t===f||"GeneratorFunction"===(t.displayName||t.name))},a.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,p):(t.__proto__=p,o(t,i,"GeneratorFunction")),t.prototype=Object.create(m),t},a.awrap=function(t){return{__await:t}},v(y.prototype),o(y.prototype,n,function(){return this}),a.AsyncIterator=y,a.async=function(t,e,n,r,i){void 0===i&&(i=Promise);var o=new y(s(t,e,n,r),i);return a.isGeneratorFunction(e)?o:o.next().then(function(t){return t.done?t.value:o.next()})},v(m),o(m,i,"Generator"),o(m,r,function(){return this}),o(m,"toString",function(){return"[object Generator]"}),a.keys=function(t){var e,n=Object(t),r=[];for(e in n)r.push(e);return r.reverse(),function t(){for(;r.length;){var e=r.pop();if(e in n)return t.value=e,t.done=!1,t}return t.done=!0,t}},a.values=x,b.prototype={constructor:b,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(_),!t)for(var e in this)"t"===e.charAt(0)&&l.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=void 0)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(n){if(this.done)throw n;var r=this;function t(t,e){return o.type="throw",o.arg=n,r.next=t,e&&(r.method="next",r.arg=void 0),!!e}for(var e=this.tryEntries.length-1;0<=e;--e){var i=this.tryEntries[e],o=i.completion;if("root"===i.tryLoc)return t("end");if(i.tryLoc<=this.prev){var a=l.call(i,"catchLoc"),s=l.call(i,"finallyLoc");if(a&&s){if(this.prev<i.catchLoc)return t(i.catchLoc,!0);if(this.prev<i.finallyLoc)return t(i.finallyLoc)}else if(a){if(this.prev<i.catchLoc)return t(i.catchLoc,!0)}else{if(!s)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return t(i.finallyLoc)}}}},abrupt:function(t,e){for(var n=this.tryEntries.length-1;0<=n;--n){var r=this.tryEntries[n];if(r.tryLoc<=this.prev&&l.call(r,"finallyLoc")&&this.prev<r.finallyLoc){var i=r;break}}var o=(i=i&&("break"===t||"continue"===t)&&i.tryLoc<=e&&e<=i.finallyLoc?null:i)?i.completion:{};return o.type=t,o.arg=e,i?(this.method="next",this.next=i.finallyLoc,h):this.complete(o)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),h},finish:function(t){for(var e=this.tryEntries.length-1;0<=e;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),_(n),h}},catch:function(t){for(var e=this.tryEntries.length-1;0<=e;--e){var n,r,i=this.tryEntries[e];if(i.tryLoc===t)return"throw"===(n=i.completion).type&&(r=n.arg,_(i)),r}throw new Error("illegal catch attempt")},delegateYield:function(t,e,n){return this.delegate={iterator:x(t),resultName:e,nextLoc:n},"next"===this.method&&(this.arg=void 0),h}},a}function sh(t,e,n,r,i,o,a){try{var s=t[o](a),l=s.value}catch(t){return void n(t)}s.done?e(l):Promise.resolve(l).then(r,i)}function lh(s){return function(){var t=this,a=arguments;return new Promise(function(e,n){var r=s.apply(t,a);function i(t){sh(r,e,n,i,o,"next",t)}function o(t){sh(r,e,n,i,o,"throw",t)}i(void 0)})}}function uh(t,e){return(uh=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t})(t,e)}var ch=function(){function r(){this.context=void 0}return r.prototype.apply=function(t,i){function o(t){e.hooks.pointerWheel.call(t)}function a(t){e.hooks.click.call(t)}var s=this,e=t.renderingService,n=t.renderingContext,l=t.config,u=(this.context=t,n.root.ownerDocument.defaultView),c=function(t){e.hooks.pointerMove.call(t)},h=function(t){e.hooks.pointerUp.call(t)},d=function(t){e.hooks.pointerDown.call(t)},f=function(t){e.hooks.pointerOver.call(t)},p=function(t){e.hooks.pointerOut.call(t)},g=function(t){e.hooks.pointerCancel.call(t)};e.hooks.init.tapPromise(r.tag,lh(ah().mark(function t(){var r;return ah().wrap(function(t){for(;;)switch(t.prev=t.next){case 0:r=s.context.contextService.getDomElement(),i.globalThis.navigator.msPointerEnabled?(r.style.msContentZooming="none",r.style.msTouchAction="none"):u.supportsPointerEvents&&(r.style.touchAction="none"),u.supportsPointerEvents?(n=r,i.globalThis.document.addEventListener("pointermove",c,!0),n.addEventListener("pointerdown",d,!0),n.addEventListener("pointerleave",p,!0),n.addEventListener("pointerover",f,!0),i.globalThis.addEventListener("pointerup",h,!0),i.globalThis.addEventListener("pointercancel",g,!0)):(n=r,i.globalThis.document.addEventListener("mousemove",c,!0),n.addEventListener("mousedown",d,!0),n.addEventListener("mouseout",p,!0),n.addEventListener("mouseover",f,!0),i.globalThis.addEventListener("mouseup",h,!0)),u.supportsTouchEvents&&((e=r).addEventListener("touchstart",d,!0),e.addEventListener("touchend",h,!0),e.addEventListener("touchmove",c,!0),e.addEventListener("touchcancel",g,!0)),l.useNativeClickEvent&&r.addEventListener("click",a,!0),r.addEventListener("wheel",o,{passive:!0,capture:!0});case 6:case"end":return t.stop()}var e,n},t)}))),e.hooks.destroy.tap(r.tag,function(){var t,e,n=s.context.contextService.getDomElement();i.globalThis.navigator.msPointerEnabled?(n.style.msContentZooming="",n.style.msTouchAction=""):u.supportsPointerEvents&&(n.style.touchAction=""),u.supportsPointerEvents?(t=n,i.globalThis.document.removeEventListener("pointermove",c,!0),t.removeEventListener("pointerdown",d,!0),t.removeEventListener("pointerleave",p,!0),t.removeEventListener("pointerover",f,!0),i.globalThis.removeEventListener("pointerup",h,!0)):(t=n,i.globalThis.document.removeEventListener("mousemove",c,!0),t.removeEventListener("mousedown",d,!0),t.removeEventListener("mouseout",p,!0),t.removeEventListener("mouseover",f,!0),i.globalThis.removeEventListener("mouseup",h,!0)),u.supportsTouchEvents&&((e=n).removeEventListener("touchstart",d,!0),e.removeEventListener("touchend",h,!0),e.removeEventListener("touchmove",c,!0),e.removeEventListener("touchcancel",g,!0)),l.useNativeClickEvent&&n.removeEventListener("click",a,!0),n.removeEventListener("wheel",o,!0)})},r}(),hh=(ch.tag="DOMInteraction",function(i){var t;function e(){for(var t,e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];return(t=i.call.apply(i,[this].concat(n))||this).name="dom-interaction",t}t=i,(n=e).prototype=Object.create(t.prototype),uh(n.prototype.constructor=n,t);var n=e.prototype;return n.init=function(){this.addRenderingPlugin(new ch)},n.destroy=function(){this.removeAllRenderingPlugins()},e}(Ws));function dh(){dh=function(){return a};var a={},t=Object.prototype,l=t.hasOwnProperty,u=Object.defineProperty||function(t,e,n){t[e]=n.value},e="function"==typeof Symbol?Symbol:{},r=e.iterator||"@@iterator",n=e.asyncIterator||"@@asyncIterator",i=e.toStringTag||"@@toStringTag";function o(t,e,n){return Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{o({},"")}catch(t){o=function(t,e,n){return t[e]=n}}function s(t,e,n,r){var i,o,a,s,e=e&&e.prototype instanceof d?e:d,e=Object.create(e.prototype),r=new b(r||[]);return u(e,"_invoke",{value:(i=t,o=n,a=r,s="suspendedStart",function(t,e){if("executing"===s)throw new Error("Generator is already running");if("completed"===s){if("throw"===t)throw e;return S()}for(a.method=t,a.arg=e;;){var n=a.delegate;if(n){n=function t(e,n){var r=n.method,i=e.iterator[r];if(void 0===i)return n.delegate=null,"throw"===r&&e.iterator.return&&(n.method="return",n.arg=void 0,t(e,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),h;r=c(i,e.iterator,n.arg);if("throw"===r.type)return n.method="throw",n.arg=r.arg,n.delegate=null,h;i=r.arg;return i?i.done?(n[e.resultName]=i.value,n.next=e.nextLoc,"return"!==n.method&&(n.method="next",n.arg=void 0),n.delegate=null,h):i:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,h)}(n,a);if(n){if(n===h)continue;return n}}if("next"===a.method)a.sent=a._sent=a.arg;else if("throw"===a.method){if("suspendedStart"===s)throw s="completed",a.arg;a.dispatchException(a.arg)}else"return"===a.method&&a.abrupt("return",a.arg);s="executing";n=c(i,o,a);if("normal"===n.type){if(s=a.done?"completed":"suspendedYield",n.arg===h)continue;return{value:n.arg,done:a.done}}"throw"===n.type&&(s="completed",a.method="throw",a.arg=n.arg)}})}),e}function c(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(t){return{type:"throw",arg:t}}}a.wrap=s;var h={};function d(){}function f(){}function p(){}var e={},g=(o(e,r,function(){return this}),Object.getPrototypeOf),g=g&&g(g(x([]))),m=(g&&g!==t&&l.call(g,r)&&(e=g),p.prototype=d.prototype=Object.create(e));function v(t){["next","throw","return"].forEach(function(e){o(t,e,function(t){return this._invoke(e,t)})})}function y(a,s){var e;u(this,"_invoke",{value:function(n,r){function t(){return new s(function(t,e){!function e(t,n,r,i){var o,t=c(a[t],a,n);if("throw"!==t.type)return(n=(o=t.arg).value)&&"object"==typeof n&&l.call(n,"__await")?s.resolve(n.__await).then(function(t){e("next",t,r,i)},function(t){e("throw",t,r,i)}):s.resolve(n).then(function(t){o.value=t,r(o)},function(t){return e("throw",t,r,i)});i(t.arg)}(n,r,t,e)})}return e=e?e.then(t,t):t()}})}function E(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function _(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function b(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(E,this),this.reset(!0)}function x(e){if(e){var n,t=e[r];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length))return n=-1,(t=function t(){for(;++n<e.length;)if(l.call(e,n))return t.value=e[n],t.done=!1,t;return t.value=void 0,t.done=!0,t}).next=t}return{next:S}}function S(){return{value:void 0,done:!0}}return u(m,"constructor",{value:f.prototype=p,configurable:!0}),u(p,"constructor",{value:f,configurable:!0}),f.displayName=o(p,i,"GeneratorFunction"),a.isGeneratorFunction=function(t){t="function"==typeof t&&t.constructor;return!!t&&(t===f||"GeneratorFunction"===(t.displayName||t.name))},a.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,p):(t.__proto__=p,o(t,i,"GeneratorFunction")),t.prototype=Object.create(m),t},a.awrap=function(t){return{__await:t}},v(y.prototype),o(y.prototype,n,function(){return this}),a.AsyncIterator=y,a.async=function(t,e,n,r,i){void 0===i&&(i=Promise);var o=new y(s(t,e,n,r),i);return a.isGeneratorFunction(e)?o:o.next().then(function(t){return t.done?t.value:o.next()})},v(m),o(m,i,"Generator"),o(m,r,function(){return this}),o(m,"toString",function(){return"[object Generator]"}),a.keys=function(t){var e,n=Object(t),r=[];for(e in n)r.push(e);return r.reverse(),function t(){for(;r.length;){var e=r.pop();if(e in n)return t.value=e,t.done=!1,t}return t.done=!0,t}},a.values=x,b.prototype={constructor:b,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(_),!t)for(var e in this)"t"===e.charAt(0)&&l.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=void 0)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(n){if(this.done)throw n;var r=this;function t(t,e){return o.type="throw",o.arg=n,r.next=t,e&&(r.method="next",r.arg=void 0),!!e}for(var e=this.tryEntries.length-1;0<=e;--e){var i=this.tryEntries[e],o=i.completion;if("root"===i.tryLoc)return t("end");if(i.tryLoc<=this.prev){var a=l.call(i,"catchLoc"),s=l.call(i,"finallyLoc");if(a&&s){if(this.prev<i.catchLoc)return t(i.catchLoc,!0);if(this.prev<i.finallyLoc)return t(i.finallyLoc)}else if(a){if(this.prev<i.catchLoc)return t(i.catchLoc,!0)}else{if(!s)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return t(i.finallyLoc)}}}},abrupt:function(t,e){for(var n=this.tryEntries.length-1;0<=n;--n){var r=this.tryEntries[n];if(r.tryLoc<=this.prev&&l.call(r,"finallyLoc")&&this.prev<r.finallyLoc){var i=r;break}}var o=(i=i&&("break"===t||"continue"===t)&&i.tryLoc<=e&&e<=i.finallyLoc?null:i)?i.completion:{};return o.type=t,o.arg=e,i?(this.method="next",this.next=i.finallyLoc,h):this.complete(o)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),h},finish:function(t){for(var e=this.tryEntries.length-1;0<=e;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),_(n),h}},catch:function(t){for(var e=this.tryEntries.length-1;0<=e;--e){var n,r,i=this.tryEntries[e];if(i.tryLoc===t)return"throw"===(n=i.completion).type&&(r=n.arg,_(i)),r}throw new Error("illegal catch attempt")},delegateYield:function(t,e,n){return this.delegate={iterator:x(t),resultName:e,nextLoc:n},"next"===this.method&&(this.arg=void 0),h}},a}function fh(t,e,n,r,i,o,a){try{var s=t[o](a),l=s.value}catch(t){return void n(t)}s.done?e(l):Promise.resolve(l).then(r,i)}function ph(s){return function(){var t=this,a=arguments;return new Promise(function(e,n){var r=s.apply(t,a);function i(t){fh(r,e,n,i,o,"next",t)}function o(t){fh(r,e,n,i,o,"throw",t)}i(void 0)})}}function gh(t,e){return(gh=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t})(t,e)}var mh=function(){function d(){this.context=void 0,this.$camera=void 0}var t=d.prototype;return t.joinTransformMatrix=function(t){return"matrix("+[t[0],t[1],t[4],t[5],t[12],t[13]].join(",")+")"},t.apply=function(t){function i(t,e){e.style.transform=s.joinTransformMatrix(t.getWorldTransform())}function e(t){var e,n,r=t.target;r.nodeName===lt.HTML&&(s.$camera||(s.$camera=s.createCamera(l)),e=s.getOrCreateEl(r),s.$camera.appendChild(e),n=r.ownerDocument.documentElement.attributes,Object.keys(n).forEach(function(t){e.style[t]=n[t]}),Object.keys(r.attributes).forEach(function(t){s.updateAttribute(t,r)}),i(r,e),ct.nativeHTMLMap.set(e,r))}function n(t){(t=t.target).nodeName===lt.HTML&&s.$camera&&(t=s.getOrCreateEl(t))&&(t.remove(),ct.nativeHTMLMap.delete(t))}function r(t){var e=t.target;e.nodeName===lt.HTML&&(t=t.attrName,s.updateAttribute(t,e))}function o(t){var e;(t=t.target).nodeName===lt.HTML&&(e=s.getOrCreateEl(t),i(t,e))}function a(){var t,e;s.$camera&&(t=(e=s.context.config).width,e=e.height,s.$camera.style.width=(t||0)+"px",s.$camera.style.height=(e||0)+"px")}var s=this,l=t.camera,u=t.renderingContext,c=t.renderingService,h=(this.context=t,u.root.ownerDocument.defaultView);c.hooks.init.tapPromise(d.tag,ph(dh().mark(function t(){return dh().wrap(function(t){for(;;)switch(t.prev=t.next){case 0:h.addEventListener(qs.RESIZE,a),h.addEventListener(v.MOUNTED,e),h.addEventListener(v.UNMOUNTED,n),h.addEventListener(v.ATTR_MODIFIED,r),h.addEventListener(v.BOUNDS_CHANGED,o);case 5:case"end":return t.stop()}},t)}))),c.hooks.endFrame.tap(d.tag,function(){s.$camera&&u.renderReasons.has(Ds.CAMERA_CHANGED)&&(s.$camera.style.transform=s.joinTransformMatrix(l.getOrthoMatrix()))}),c.hooks.destroy.tap(d.tag,function(){s.$camera&&s.$camera.remove(),h.removeEventListener(qs.RESIZE,a),h.removeEventListener(v.MOUNTED,e),h.removeEventListener(v.UNMOUNTED,n),h.removeEventListener(v.ATTR_MODIFIED,r),h.removeEventListener(v.BOUNDS_CHANGED,o)})},t.getId=function(t){return t.id||"g-html-"+t.entity},t.createCamera=function(t){var e,n,r=this.context.config,i=r.document,o=r.width,r=r.height,a=this.context.contextService.getDomElement(),s=a.parentNode;return s?((n=s.querySelector("#"+(e="g-canvas-camera")))||((n=i=(i||document).createElement("div")).id=e,i.style.position="absolute",i.style.left=(a.offsetLeft||0)+"px",i.style.top=(a.offsetTop||0)+"px",i.style.transformOrigin="left top",i.style.transform=this.joinTransformMatrix(t.getOrthoMatrix()),i.style.overflow="hidden",i.style.pointerEvents="none",i.style.width=(o||0)+"px",i.style.height=(r||0)+"px",s.appendChild(i)),n):null},t.getOrCreateEl=function(t){var e=this.context.config.document,n=this.getId(t),r=this.$camera.querySelector("#"+n);return r||(r=(e||document).createElement("div"),(t.parsedStyle.$el=r).id=n,t.name&&r.setAttribute("name",t.name),t.className&&(r.className=t.className),r.style.position="absolute",r.style.left="0px",r.style.top="0px",r.style["will-change"]="transform",r.style.transform=this.joinTransformMatrix(t.getWorldTransform())),r},t.updateAttribute=function(t,e){var n=this.getOrCreateEl(e);switch(t){case"innerHTML":var r=e.parsedStyle.innerHTML;Fe(r)?n.innerHTML=r:(n.innerHTML="",n.appendChild(r));break;case"transformOrigin":var r=e.parsedStyle.transformOrigin;n.style["transform-origin"]=r[0].value+" "+r[1].value;break;case"width":ct.enableCSSParsing?(r=e.computedStyleMap().get("width"),n.style.width=r.toString()):(r=e.parsedStyle.width,n.style.width=B(r)?r+"px":r.toString());break;case"height":ct.enableCSSParsing?(r=e.computedStyleMap().get("height"),n.style.height=r.toString()):(r=e.parsedStyle.height,n.style.height=B(r)?r+"px":r.toString());break;case"zIndex":r=e.parsedStyle.zIndex;n.style["z-index"]=""+r;break;case"visibility":r=e.parsedStyle.visibility;n.style.visibility=r;break;case"pointerEvents":r=e.parsedStyle.pointerEvents;n.style.pointerEvents=r;break;case"opacity":r=e.parsedStyle.opacity;n.style.opacity=""+r;break;case"fill":var r=e.parsedStyle.fill,i="";To(r)?i=r.isNone?"transparent":e.getAttribute("fill"):Array.isArray(r)?i=e.getAttribute("fill"):wo(r),n.style.background=i;break;case"stroke":r=e.parsedStyle.stroke,i="";To(r)?i=r.isNone?"transparent":e.getAttribute("stroke"):Array.isArray(r)?i=e.getAttribute("stroke"):wo(r),n.style["border-color"]=i,n.style["border-style"]="solid";break;case"lineWidth":r=e.parsedStyle.lineWidth;n.style["border-width"]=(r||0)+"px";break;case"lineDash":n.style["border-style"]="dashed";break;case"filter":i=e.style.filter;n.style.filter=i}},d}(),vh=(mh.tag="HTMLRendering",function(i){var t;function e(){for(var t,e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];return(t=i.call.apply(i,[this].concat(n))||this).name="html-renderer",t}t=i,(n=e).prototype=Object.create(t.prototype),gh(n.prototype.constructor=n,t);var n=e.prototype;return n.init=function(){this.addRenderingPlugin(new mh)},n.destroy=function(){this.removeAllRenderingPlugins()},e}(Ws));function yh(){yh=function(){return a};var a={},t=Object.prototype,l=t.hasOwnProperty,u=Object.defineProperty||function(t,e,n){t[e]=n.value},e="function"==typeof Symbol?Symbol:{},r=e.iterator||"@@iterator",n=e.asyncIterator||"@@asyncIterator",i=e.toStringTag||"@@toStringTag";function o(t,e,n){return Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{o({},"")}catch(t){o=function(t,e,n){return t[e]=n}}function s(t,e,n,r){var i,o,a,s,e=e&&e.prototype instanceof d?e:d,e=Object.create(e.prototype),r=new b(r||[]);return u(e,"_invoke",{value:(i=t,o=n,a=r,s="suspendedStart",function(t,e){if("executing"===s)throw new Error("Generator is already running");if("completed"===s){if("throw"===t)throw e;return S()}for(a.method=t,a.arg=e;;){var n=a.delegate;if(n){n=function t(e,n){var r=n.method,i=e.iterator[r];if(void 0===i)return n.delegate=null,"throw"===r&&e.iterator.return&&(n.method="return",n.arg=void 0,t(e,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),h;r=c(i,e.iterator,n.arg);if("throw"===r.type)return n.method="throw",n.arg=r.arg,n.delegate=null,h;i=r.arg;return i?i.done?(n[e.resultName]=i.value,n.next=e.nextLoc,"return"!==n.method&&(n.method="next",n.arg=void 0),n.delegate=null,h):i:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,h)}(n,a);if(n){if(n===h)continue;return n}}if("next"===a.method)a.sent=a._sent=a.arg;else if("throw"===a.method){if("suspendedStart"===s)throw s="completed",a.arg;a.dispatchException(a.arg)}else"return"===a.method&&a.abrupt("return",a.arg);s="executing";n=c(i,o,a);if("normal"===n.type){if(s=a.done?"completed":"suspendedYield",n.arg===h)continue;return{value:n.arg,done:a.done}}"throw"===n.type&&(s="completed",a.method="throw",a.arg=n.arg)}})}),e}function c(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(t){return{type:"throw",arg:t}}}a.wrap=s;var h={};function d(){}function f(){}function p(){}var e={},g=(o(e,r,function(){return this}),Object.getPrototypeOf),g=g&&g(g(x([]))),m=(g&&g!==t&&l.call(g,r)&&(e=g),p.prototype=d.prototype=Object.create(e));function v(t){["next","throw","return"].forEach(function(e){o(t,e,function(t){return this._invoke(e,t)})})}function y(a,s){var e;u(this,"_invoke",{value:function(n,r){function t(){return new s(function(t,e){!function e(t,n,r,i){var o,t=c(a[t],a,n);if("throw"!==t.type)return(n=(o=t.arg).value)&&"object"==typeof n&&l.call(n,"__await")?s.resolve(n.__await).then(function(t){e("next",t,r,i)},function(t){e("throw",t,r,i)}):s.resolve(n).then(function(t){o.value=t,r(o)},function(t){return e("throw",t,r,i)});i(t.arg)}(n,r,t,e)})}return e=e?e.then(t,t):t()}})}function E(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function _(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function b(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(E,this),this.reset(!0)}function x(e){if(e){var n,t=e[r];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length))return n=-1,(t=function t(){for(;++n<e.length;)if(l.call(e,n))return t.value=e[n],t.done=!1,t;return t.value=void 0,t.done=!0,t}).next=t}return{next:S}}function S(){return{value:void 0,done:!0}}return u(m,"constructor",{value:f.prototype=p,configurable:!0}),u(p,"constructor",{value:f,configurable:!0}),f.displayName=o(p,i,"GeneratorFunction"),a.isGeneratorFunction=function(t){t="function"==typeof t&&t.constructor;return!!t&&(t===f||"GeneratorFunction"===(t.displayName||t.name))},a.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,p):(t.__proto__=p,o(t,i,"GeneratorFunction")),t.prototype=Object.create(m),t},a.awrap=function(t){return{__await:t}},v(y.prototype),o(y.prototype,n,function(){return this}),a.AsyncIterator=y,a.async=function(t,e,n,r,i){void 0===i&&(i=Promise);var o=new y(s(t,e,n,r),i);return a.isGeneratorFunction(e)?o:o.next().then(function(t){return t.done?t.value:o.next()})},v(m),o(m,i,"Generator"),o(m,r,function(){return this}),o(m,"toString",function(){return"[object Generator]"}),a.keys=function(t){var e,n=Object(t),r=[];for(e in n)r.push(e);return r.reverse(),function t(){for(;r.length;){var e=r.pop();if(e in n)return t.value=e,t.done=!1,t}return t.done=!0,t}},a.values=x,b.prototype={constructor:b,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(_),!t)for(var e in this)"t"===e.charAt(0)&&l.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=void 0)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(n){if(this.done)throw n;var r=this;function t(t,e){return o.type="throw",o.arg=n,r.next=t,e&&(r.method="next",r.arg=void 0),!!e}for(var e=this.tryEntries.length-1;0<=e;--e){var i=this.tryEntries[e],o=i.completion;if("root"===i.tryLoc)return t("end");if(i.tryLoc<=this.prev){var a=l.call(i,"catchLoc"),s=l.call(i,"finallyLoc");if(a&&s){if(this.prev<i.catchLoc)return t(i.catchLoc,!0);if(this.prev<i.finallyLoc)return t(i.finallyLoc)}else if(a){if(this.prev<i.catchLoc)return t(i.catchLoc,!0)}else{if(!s)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return t(i.finallyLoc)}}}},abrupt:function(t,e){for(var n=this.tryEntries.length-1;0<=n;--n){var r=this.tryEntries[n];if(r.tryLoc<=this.prev&&l.call(r,"finallyLoc")&&this.prev<r.finallyLoc){var i=r;break}}var o=(i=i&&("break"===t||"continue"===t)&&i.tryLoc<=e&&e<=i.finallyLoc?null:i)?i.completion:{};return o.type=t,o.arg=e,i?(this.method="next",this.next=i.finallyLoc,h):this.complete(o)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),h},finish:function(t){for(var e=this.tryEntries.length-1;0<=e;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),_(n),h}},catch:function(t){for(var e=this.tryEntries.length-1;0<=e;--e){var n,r,i=this.tryEntries[e];if(i.tryLoc===t)return"throw"===(n=i.completion).type&&(r=n.arg,_(i)),r}throw new Error("illegal catch attempt")},delegateYield:function(t,e,n){return this.delegate={iterator:x(t),resultName:e,nextLoc:n},"next"===this.method&&(this.arg=void 0),h}},a}function Eh(t,e,n,r,i,o,a){try{var s=t[o](a),l=s.value}catch(t){return void n(t)}s.done?e(l):Promise.resolve(l).then(r,i)}function _h(s){return function(){var t=this,a=arguments;return new Promise(function(e,n){var r=s.apply(t,a);function i(t){Eh(r,e,n,i,o,"next",t)}function o(t){Eh(r,e,n,i,o,"throw",t)}i(void 0)})}}function bh(t,e){return(bh=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t})(t,e)}var xh="undefined"!=typeof Float32Array?Float32Array:Array;Math.hypot||(Math.hypot=function(){for(var t=0,e=arguments.length;e--;)t+=arguments[e]*arguments[e];return Math.sqrt(t)});var Sh=function(){function t(t){this.canvasConfig=void 0,this.imageCache={},this.gradientCache={},this.patternCache={},this.canvasConfig=t}var e=t.prototype;return e.getImageSync=function(t,e){return this.imageCache[t]?e&&e():this.getOrCreateImage(t).then(function(){e&&e()}),this.imageCache[t]},e.getOrCreateImage=function(r){var i,o=this;return this.imageCache[r]?Promise.resolve(this.imageCache[r]):(i=this.canvasConfig.createImage,new Promise(function(t,e){var n;i?n=i(r):Ur&&(n=new window.Image),n&&(n.onload=function(){t(n)},n.onerror=function(t){e(t)},n.crossOrigin="Anonymous",n.src=r,o.imageCache[r]=n)}))},e.getOrCreatePatternSync=function(t,e,n,r,i){var o,a,s,l,u=this.generatePatternKey(t);return u&&this.patternCache[u]?this.patternCache[u]:(l=t.image,s=t.repetition,t=t.transform,o=!1,Fe(l)?a=this.getImageSync(l,i):n?(a=n,o=!0):a=l,(i=a&&e.createPattern(a,s))&&(e=t?di(ta(t)):(n=new xh(16),xh!=Float32Array&&(n[1]=0,n[2]=0,n[3]=0,n[4]=0,n[6]=0,n[7]=0,n[8]=0,n[9]=0,n[11]=0,n[12]=0,n[13]=0,n[14]=0),n[0]=1,n[5]=1,n[10]=1,n[15]=1,(l=n)[0]=1,l[1]=0,l[2]=0,l[3]=0,l[4]=0,l[5]=1,l[6]=0,l[7]=0,l[8]=0,l[9]=0,l[10]=1,l[11]=0,l[12]=0,l[13]=0,l[14]=0,l[15]=1,l),o&&(s=a=e,n=(t=[1/r,1/r,1])[0],l=t[1],t=t[2],a[0]=s[0]*n,a[1]=s[1]*n,a[2]=s[2]*n,a[3]=s[3]*n,a[4]=s[4]*l,a[5]=s[5]*l,a[6]=s[6]*l,a[7]=s[7]*l,a[8]=s[8]*t,a[9]=s[9]*t,a[10]=s[10]*t,a[11]=s[11]*t,a[12]=s[12],a[13]=s[13],a[14]=s[14],a[15]=s[15]),i.setTransform({a:e[0],b:e[1],c:e[4],d:e[5],e:e[12],f:e[13]})),u&&i&&(this.patternCache[u]=i),i)},e.getOrCreateGradient=function(t,e){var r,n,i,o,a=this.generateGradientKey(t),s=t.type,l=t.steps,u=t.width,c=t.height,h=t.angle,d=t.cx,f=t.cy,t=t.size;return this.gradientCache[a]||(r=null,s===ur.LinearGradient?(n=(h=Di(u,c,h)).x1,i=h.y1,o=h.x2,h=h.y2,r=e.createLinearGradient(n,i,o,h)):s===ur.RadialGradient&&(i=(n=Bi(u,c,d,f,t)).x,o=n.y,h=n.r,r=e.createRadialGradient(i,o,0,i,o,h)),r&&(l.forEach(function(t){var e,n=t.offset,t=t.color;n.unit===p.kPercentage&&null!=(e=r)&&e.addColorStop(n.value/100,t.toString())}),this.gradientCache[a]=r)),this.gradientCache[a]},e.generateGradientKey=function(t){var e=t.type,n=t.width,r=t.height,i=t.steps,o=t.angle,a=t.cx,s=t.cy,t=t.size;return"gradient-"+e+"-"+((null==o?void 0:o.toString())||0)+"-"+((null==a?void 0:a.toString())||0)+"-"+((null==s?void 0:s.toString())||0)+"-"+((null==t?void 0:t.toString())||0)+"-"+n+"-"+r+"-"+i.map(function(t){return""+t.offset+t.color}).join("-")},e.generatePatternKey=function(t){var e=t.image,t=t.repetition;return Fe(e)?"pattern-"+e+"-"+t:"rect"===e.nodeName?"pattern-"+e.entity+"-"+t:void 0},t}(),wh=function(){function s(){}return s.prototype.apply=function(t){function e(t){var e=t.target,t=e.nodeName,n=e.attributes;t===lt.IMAGE&&(t=n.img,Fe(t))&&o.getImageSync(t,function(){e.renderable.dirty=!0,r.dirtify()})}function n(t){var e=t.target,n=t.attrName,t=t.newValue;e.nodeName===lt.IMAGE&&"img"===n&&Fe(t)&&o.getOrCreateImage(t).then(function(){e.renderable.dirty=!0,r.dirtify()})}var r=t.renderingService,i=t.renderingContext,o=t.imagePool,a=i.root.ownerDocument.defaultView;r.hooks.init.tapPromise(s.tag,_h(yh().mark(function t(){return yh().wrap(function(t){for(;;)switch(t.prev=t.next){case 0:a.addEventListener(v.MOUNTED,e),a.addEventListener(v.ATTR_MODIFIED,n);case 2:case"end":return t.stop()}},t)}))),r.hooks.destroy.tap(s.tag,function(){a.removeEventListener(v.MOUNTED,e),a.removeEventListener(v.ATTR_MODIFIED,n)})},s}(),Th=(wh.tag="LoadImage",function(i){var t;function e(){for(var t,e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];return(t=i.call.apply(i,[this].concat(n))||this).name="image-loader",t}t=i,(n=e).prototype=Object.create(t.prototype),bh(n.prototype.constructor=n,t);var n=e.prototype;return n.init=function(){this.context.imagePool=new Sh(this.context.config),this.addRenderingPlugin(new wh)},n.destroy=function(){this.removeAllRenderingPlugins()},e}(Ws));function Ah(){Ah=function(){return a};var a={},t=Object.prototype,l=t.hasOwnProperty,u=Object.defineProperty||function(t,e,n){t[e]=n.value},e="function"==typeof Symbol?Symbol:{},r=e.iterator||"@@iterator",n=e.asyncIterator||"@@asyncIterator",i=e.toStringTag||"@@toStringTag";function o(t,e,n){return Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{o({},"")}catch(t){o=function(t,e,n){return t[e]=n}}function s(t,e,n,r){var i,o,a,s,e=e&&e.prototype instanceof d?e:d,e=Object.create(e.prototype),r=new b(r||[]);return u(e,"_invoke",{value:(i=t,o=n,a=r,s="suspendedStart",function(t,e){if("executing"===s)throw new Error("Generator is already running");if("completed"===s){if("throw"===t)throw e;return S()}for(a.method=t,a.arg=e;;){var n=a.delegate;if(n){n=function t(e,n){var r=n.method,i=e.iterator[r];if(void 0===i)return n.delegate=null,"throw"===r&&e.iterator.return&&(n.method="return",n.arg=void 0,t(e,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),h;r=c(i,e.iterator,n.arg);if("throw"===r.type)return n.method="throw",n.arg=r.arg,n.delegate=null,h;i=r.arg;return i?i.done?(n[e.resultName]=i.value,n.next=e.nextLoc,"return"!==n.method&&(n.method="next",n.arg=void 0),n.delegate=null,h):i:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,h)}(n,a);if(n){if(n===h)continue;return n}}if("next"===a.method)a.sent=a._sent=a.arg;else if("throw"===a.method){if("suspendedStart"===s)throw s="completed",a.arg;a.dispatchException(a.arg)}else"return"===a.method&&a.abrupt("return",a.arg);s="executing";n=c(i,o,a);if("normal"===n.type){if(s=a.done?"completed":"suspendedYield",n.arg===h)continue;return{value:n.arg,done:a.done}}"throw"===n.type&&(s="completed",a.method="throw",a.arg=n.arg)}})}),e}function c(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(t){return{type:"throw",arg:t}}}a.wrap=s;var h={};function d(){}function f(){}function p(){}var e={},g=(o(e,r,function(){return this}),Object.getPrototypeOf),g=g&&g(g(x([]))),m=(g&&g!==t&&l.call(g,r)&&(e=g),p.prototype=d.prototype=Object.create(e));function v(t){["next","throw","return"].forEach(function(e){o(t,e,function(t){return this._invoke(e,t)})})}function y(a,s){var e;u(this,"_invoke",{value:function(n,r){function t(){return new s(function(t,e){!function e(t,n,r,i){var o,t=c(a[t],a,n);if("throw"!==t.type)return(n=(o=t.arg).value)&&"object"==typeof n&&l.call(n,"__await")?s.resolve(n.__await).then(function(t){e("next",t,r,i)},function(t){e("throw",t,r,i)}):s.resolve(n).then(function(t){o.value=t,r(o)},function(t){return e("throw",t,r,i)});i(t.arg)}(n,r,t,e)})}return e=e?e.then(t,t):t()}})}function E(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function _(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function b(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(E,this),this.reset(!0)}function x(e){if(e){var n,t=e[r];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length))return n=-1,(t=function t(){for(;++n<e.length;)if(l.call(e,n))return t.value=e[n],t.done=!1,t;return t.value=void 0,t.done=!0,t}).next=t}return{next:S}}function S(){return{value:void 0,done:!0}}return u(m,"constructor",{value:f.prototype=p,configurable:!0}),u(p,"constructor",{value:f,configurable:!0}),f.displayName=o(p,i,"GeneratorFunction"),a.isGeneratorFunction=function(t){t="function"==typeof t&&t.constructor;return!!t&&(t===f||"GeneratorFunction"===(t.displayName||t.name))},a.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,p):(t.__proto__=p,o(t,i,"GeneratorFunction")),t.prototype=Object.create(m),t},a.awrap=function(t){return{__await:t}},v(y.prototype),o(y.prototype,n,function(){return this}),a.AsyncIterator=y,a.async=function(t,e,n,r,i){void 0===i&&(i=Promise);var o=new y(s(t,e,n,r),i);return a.isGeneratorFunction(e)?o:o.next().then(function(t){return t.done?t.value:o.next()})},v(m),o(m,i,"Generator"),o(m,r,function(){return this}),o(m,"toString",function(){return"[object Generator]"}),a.keys=function(t){var e,n=Object(t),r=[];for(e in n)r.push(e);return r.reverse(),function t(){for(;r.length;){var e=r.pop();if(e in n)return t.value=e,t.done=!1,t}return t.done=!0,t}},a.values=x,b.prototype={constructor:b,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(_),!t)for(var e in this)"t"===e.charAt(0)&&l.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=void 0)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(n){if(this.done)throw n;var r=this;function t(t,e){return o.type="throw",o.arg=n,r.next=t,e&&(r.method="next",r.arg=void 0),!!e}for(var e=this.tryEntries.length-1;0<=e;--e){var i=this.tryEntries[e],o=i.completion;if("root"===i.tryLoc)return t("end");if(i.tryLoc<=this.prev){var a=l.call(i,"catchLoc"),s=l.call(i,"finallyLoc");if(a&&s){if(this.prev<i.catchLoc)return t(i.catchLoc,!0);if(this.prev<i.finallyLoc)return t(i.finallyLoc)}else if(a){if(this.prev<i.catchLoc)return t(i.catchLoc,!0)}else{if(!s)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return t(i.finallyLoc)}}}},abrupt:function(t,e){for(var n=this.tryEntries.length-1;0<=n;--n){var r=this.tryEntries[n];if(r.tryLoc<=this.prev&&l.call(r,"finallyLoc")&&this.prev<r.finallyLoc){var i=r;break}}var o=(i=i&&("break"===t||"continue"===t)&&i.tryLoc<=e&&e<=i.finallyLoc?null:i)?i.completion:{};return o.type=t,o.arg=e,i?(this.method="next",this.next=i.finallyLoc,h):this.complete(o)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),h},finish:function(t){for(var e=this.tryEntries.length-1;0<=e;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),_(n),h}},catch:function(t){for(var e=this.tryEntries.length-1;0<=e;--e){var n,r,i=this.tryEntries[e];if(i.tryLoc===t)return"throw"===(n=i.completion).type&&(r=n.arg,_(i)),r}throw new Error("illegal catch attempt")},delegateYield:function(t,e,n){return this.delegate={iterator:x(t),resultName:e,nextLoc:n},"next"===this.method&&(this.arg=void 0),h}},a}function Mh(t,e,n,r,i,o,a){try{var s=t[o](a),l=s.value}catch(t){return void n(t)}s.done?e(l):Promise.resolve(l).then(r,i)}function Rh(s){return function(){var t=this,a=arguments;return new Promise(function(e,n){var r=s.apply(t,a);function i(t){Mh(r,e,n,i,o,"next",t)}function o(t){Mh(r,e,n,i,o,"throw",t)}i(void 0)})}}function Nh(t,e){t.prototype=Object.create(e.prototype),Ch(t.prototype.constructor=t,e)}function Ch(t,e){return(Ch=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t})(t,e)}var Ph=function(){function t(t){this.$container=void 0,this.$canvas=void 0,this.dpr=void 0,this.context=void 0,this.canvasConfig=void 0,this.renderingContext=void 0,this.renderingContext=t.renderingContext,this.canvasConfig=t.config}var e=t.prototype;return e.init=function(){var t=Rh(Ah().mark(function t(){var e,n;return Ah().wrap(function(t){for(;;)switch(t.prev=t.next){case 0:n=this.canvasConfig,e=n.container,(n=n.canvas)?(this.$canvas=n,e&&n.parentElement!==e&&e.appendChild(n),this.$container=n.parentElement,this.canvasConfig.container=this.$container):e&&(this.$container=Fe(e)?document.getElementById(e):e,this.$container)&&(n=document.createElement("canvas"),this.$container.appendChild(n),this.$container.style.position||(this.$container.style.position="relative"),this.$canvas=n),this.context=this.$canvas.getContext("2d"),this.resize(this.canvasConfig.width,this.canvasConfig.height);case 4:case"end":return t.stop()}},t,this)}));return function(){return t.apply(this,arguments)}}(),e.getContext=function(){return this.context},e.getDomElement=function(){return this.$canvas},e.getDPR=function(){return this.dpr},e.getBoundingClientRect=function(){if(this.$canvas.getBoundingClientRect)return this.$canvas.getBoundingClientRect()},e.destroy=function(){this.$container&&this.$canvas&&this.$canvas.parentNode&&this.$container.removeChild(this.$canvas)},e.resize=function(t,e){var n=1<=(n=this.canvasConfig.devicePixelRatio||Ur&&window.devicePixelRatio||1)?Math.ceil(n):1;this.dpr=n,this.$canvas&&(this.$canvas.width=this.dpr*t,this.$canvas.height=this.dpr*e,jr(this.$canvas,t,e)),this.renderingContext.renderReasons.add(Ds.CAMERA_CHANGED)},e.applyCursorStyle=function(t){this.$container&&this.$container.style&&(this.$container.style.cursor=t)},e.toDataURL=function(){var e=Rh(Ah().mark(function t(e){var n,r;return Ah().wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return n=(r=e=void 0===e?{}:e).type,r=r.encoderOptions,t.abrupt("return",this.context.canvas.toDataURL(n,r));case 3:case"end":return t.stop()}},t,this)}));return function(t){return e.apply(this,arguments)}}(),t}(),Oh=function(i){function t(){for(var t,e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];return(t=i.call.apply(i,[this].concat(n))||this).name="canvas-context-register",t}Nh(t,i);var e=t.prototype;return e.init=function(){this.context.ContextService=Ph},e.destroy=function(){delete this.context.ContextService},t}(Ws),Ih=function(e){function t(t){t=e.call(this,t)||this;return t.registerPlugin(new Oh),t.registerPlugin(new Th),t.registerPlugin(new ec),t.registerPlugin(new oh),t.registerPlugin(new hh),t.registerPlugin(new Kc),t.registerPlugin(new vh),t}return Nh(t,e),t}(Gs);function Lh(){Lh=function(){return a};var a={},t=Object.prototype,l=t.hasOwnProperty,u=Object.defineProperty||function(t,e,n){t[e]=n.value},e="function"==typeof Symbol?Symbol:{},r=e.iterator||"@@iterator",n=e.asyncIterator||"@@asyncIterator",i=e.toStringTag||"@@toStringTag";function o(t,e,n){return Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{o({},"")}catch(t){o=function(t,e,n){return t[e]=n}}function s(t,e,n,r){var i,o,a,s,e=e&&e.prototype instanceof d?e:d,e=Object.create(e.prototype),r=new b(r||[]);return u(e,"_invoke",{value:(i=t,o=n,a=r,s="suspendedStart",function(t,e){if("executing"===s)throw new Error("Generator is already running");if("completed"===s){if("throw"===t)throw e;return S()}for(a.method=t,a.arg=e;;){var n=a.delegate;if(n){n=function t(e,n){var r=n.method,i=e.iterator[r];if(void 0===i)return n.delegate=null,"throw"===r&&e.iterator.return&&(n.method="return",n.arg=void 0,t(e,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),h;r=c(i,e.iterator,n.arg);if("throw"===r.type)return n.method="throw",n.arg=r.arg,n.delegate=null,h;i=r.arg;return i?i.done?(n[e.resultName]=i.value,n.next=e.nextLoc,"return"!==n.method&&(n.method="next",n.arg=void 0),n.delegate=null,h):i:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,h)}(n,a);if(n){if(n===h)continue;return n}}if("next"===a.method)a.sent=a._sent=a.arg;else if("throw"===a.method){if("suspendedStart"===s)throw s="completed",a.arg;a.dispatchException(a.arg)}else"return"===a.method&&a.abrupt("return",a.arg);s="executing";n=c(i,o,a);if("normal"===n.type){if(s=a.done?"completed":"suspendedYield",n.arg===h)continue;return{value:n.arg,done:a.done}}"throw"===n.type&&(s="completed",a.method="throw",a.arg=n.arg)}})}),e}function c(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(t){return{type:"throw",arg:t}}}a.wrap=s;var h={};function d(){}function f(){}function p(){}var e={},g=(o(e,r,function(){return this}),Object.getPrototypeOf),g=g&&g(g(x([]))),m=(g&&g!==t&&l.call(g,r)&&(e=g),p.prototype=d.prototype=Object.create(e));function v(t){["next","throw","return"].forEach(function(e){o(t,e,function(t){return this._invoke(e,t)})})}function y(a,s){var e;u(this,"_invoke",{value:function(n,r){function t(){return new s(function(t,e){!function e(t,n,r,i){var o,t=c(a[t],a,n);if("throw"!==t.type)return(n=(o=t.arg).value)&&"object"==typeof n&&l.call(n,"__await")?s.resolve(n.__await).then(function(t){e("next",t,r,i)},function(t){e("throw",t,r,i)}):s.resolve(n).then(function(t){o.value=t,r(o)},function(t){return e("throw",t,r,i)});i(t.arg)}(n,r,t,e)})}return e=e?e.then(t,t):t()}})}function E(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function _(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function b(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(E,this),this.reset(!0)}function x(e){if(e){var n,t=e[r];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length))return n=-1,(t=function t(){for(;++n<e.length;)if(l.call(e,n))return t.value=e[n],t.done=!1,t;return t.value=void 0,t.done=!0,t}).next=t}return{next:S}}function S(){return{value:void 0,done:!0}}return u(m,"constructor",{value:f.prototype=p,configurable:!0}),u(p,"constructor",{value:f,configurable:!0}),f.displayName=o(p,i,"GeneratorFunction"),a.isGeneratorFunction=function(t){t="function"==typeof t&&t.constructor;return!!t&&(t===f||"GeneratorFunction"===(t.displayName||t.name))},a.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,p):(t.__proto__=p,o(t,i,"GeneratorFunction")),t.prototype=Object.create(m),t},a.awrap=function(t){return{__await:t}},v(y.prototype),o(y.prototype,n,function(){return this}),a.AsyncIterator=y,a.async=function(t,e,n,r,i){void 0===i&&(i=Promise);var o=new y(s(t,e,n,r),i);return a.isGeneratorFunction(e)?o:o.next().then(function(t){return t.done?t.value:o.next()})},v(m),o(m,i,"Generator"),o(m,r,function(){return this}),o(m,"toString",function(){return"[object Generator]"}),a.keys=function(t){var e,n=Object(t),r=[];for(e in n)r.push(e);return r.reverse(),function t(){for(;r.length;){var e=r.pop();if(e in n)return t.value=e,t.done=!1,t}return t.done=!0,t}},a.values=x,b.prototype={constructor:b,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(_),!t)for(var e in this)"t"===e.charAt(0)&&l.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=void 0)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(n){if(this.done)throw n;var r=this;function t(t,e){return o.type="throw",o.arg=n,r.next=t,e&&(r.method="next",r.arg=void 0),!!e}for(var e=this.tryEntries.length-1;0<=e;--e){var i=this.tryEntries[e],o=i.completion;if("root"===i.tryLoc)return t("end");if(i.tryLoc<=this.prev){var a=l.call(i,"catchLoc"),s=l.call(i,"finallyLoc");if(a&&s){if(this.prev<i.catchLoc)return t(i.catchLoc,!0);if(this.prev<i.finallyLoc)return t(i.finallyLoc)}else if(a){if(this.prev<i.catchLoc)return t(i.catchLoc,!0)}else{if(!s)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return t(i.finallyLoc)}}}},abrupt:function(t,e){for(var n=this.tryEntries.length-1;0<=n;--n){var r=this.tryEntries[n];if(r.tryLoc<=this.prev&&l.call(r,"finallyLoc")&&this.prev<r.finallyLoc){var i=r;break}}var o=(i=i&&("break"===t||"continue"===t)&&i.tryLoc<=e&&e<=i.finallyLoc?null:i)?i.completion:{};return o.type=t,o.arg=e,i?(this.method="next",this.next=i.finallyLoc,h):this.complete(o)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),h},finish:function(t){for(var e=this.tryEntries.length-1;0<=e;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),_(n),h}},catch:function(t){for(var e=this.tryEntries.length-1;0<=e;--e){var n,r,i=this.tryEntries[e];if(i.tryLoc===t)return"throw"===(n=i.completion).type&&(r=n.arg,_(i)),r}throw new Error("illegal catch attempt")},delegateYield:function(t,e,n){return this.delegate={iterator:x(t),resultName:e,nextLoc:n},"next"===this.method&&(this.arg=void 0),h}},a}function kh(t,e,n,r,i,o,a){try{var s=t[o](a),l=s.value}catch(t){return void n(t)}s.done?e(l):Promise.resolve(l).then(r,i)}function Dh(t,e){return(Dh=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t})(t,e)}function Bh(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}function Fh(t,e){var n,r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(r)return(r=r.call(t)).next.bind(r);if(Array.isArray(t)||(r=function(t,e){var n;if(t)return"string"==typeof t?Bh(t,e):"Map"===(n="Object"===(n=Object.prototype.toString.call(t).slice(8,-1))&&t.constructor?t.constructor.name:n)||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Bh(t,e):void 0}(t))||e&&t&&"number"==typeof t.length)return r&&(t=r),n=0,function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}};throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var Uh=function(){function a(){}var t=a.prototype;return t.apply=function(t,e){var n=this,r=t.config.document,i=t.renderingService,o=t.svgElementMap;i.hooks.pick.tapPromise(a.tag,function(){s=Lh().mark(function t(e){return Lh().wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",n.pick(o,r,e));case 1:case"end":return t.stop()}},t)});var s,e=function(){var t=this,a=arguments;return new Promise(function(e,n){var r=s.apply(t,a);function i(t){kh(r,e,n,i,o,"next",t)}function o(t){kh(r,e,n,i,o,"throw",t)}i(void 0)})};return function(t){return e.apply(this,arguments)}}()),i.hooks.pickSync.tap(a.tag,function(t){return n.pick(o,r,t)})},t.pick=function(t,e,n){var r=n.topmost,i=n.position,o=i.clientX,i=i.clientY;try{for(var a,s=[],l=Fh((e||document).elementsFromPoint(o,i));!(a=l()).done;){var u=a.value,c=t.get(u);if(c&&c.isInteractive()&&(s.push(c),r))return n.picked=s,n}n.picked=s}catch(t){n.picked=[]}return n},a}(),Gh=(Uh.tag="SVGPicker",function(i){var t;function e(){for(var t,e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];return(t=i.call.apply(i,[this].concat(n))||this).name="svg-picker",t}t=i,(n=e).prototype=Object.create(t.prototype),Dh(n.prototype.constructor=n,t);var n=e.prototype;return n.init=function(){this.addRenderingPlugin(new Uh)},n.destroy=function(){this.removeAllRenderingPlugins()},e}(Ws));function Wh(){Wh=function(){return a};var a={},t=Object.prototype,l=t.hasOwnProperty,u=Object.defineProperty||function(t,e,n){t[e]=n.value},e="function"==typeof Symbol?Symbol:{},r=e.iterator||"@@iterator",n=e.asyncIterator||"@@asyncIterator",i=e.toStringTag||"@@toStringTag";function o(t,e,n){return Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{o({},"")}catch(t){o=function(t,e,n){return t[e]=n}}function s(t,e,n,r){var i,o,a,s,e=e&&e.prototype instanceof d?e:d,e=Object.create(e.prototype),r=new b(r||[]);return u(e,"_invoke",{value:(i=t,o=n,a=r,s="suspendedStart",function(t,e){if("executing"===s)throw new Error("Generator is already running");if("completed"===s){if("throw"===t)throw e;return S()}for(a.method=t,a.arg=e;;){var n=a.delegate;if(n){n=function t(e,n){var r=n.method,i=e.iterator[r];if(void 0===i)return n.delegate=null,"throw"===r&&e.iterator.return&&(n.method="return",n.arg=void 0,t(e,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),h;r=c(i,e.iterator,n.arg);if("throw"===r.type)return n.method="throw",n.arg=r.arg,n.delegate=null,h;i=r.arg;return i?i.done?(n[e.resultName]=i.value,n.next=e.nextLoc,"return"!==n.method&&(n.method="next",n.arg=void 0),n.delegate=null,h):i:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,h)}(n,a);if(n){if(n===h)continue;return n}}if("next"===a.method)a.sent=a._sent=a.arg;else if("throw"===a.method){if("suspendedStart"===s)throw s="completed",a.arg;a.dispatchException(a.arg)}else"return"===a.method&&a.abrupt("return",a.arg);s="executing";n=c(i,o,a);if("normal"===n.type){if(s=a.done?"completed":"suspendedYield",n.arg===h)continue;return{value:n.arg,done:a.done}}"throw"===n.type&&(s="completed",a.method="throw",a.arg=n.arg)}})}),e}function c(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(t){return{type:"throw",arg:t}}}a.wrap=s;var h={};function d(){}function f(){}function p(){}var e={},g=(o(e,r,function(){return this}),Object.getPrototypeOf),g=g&&g(g(x([]))),m=(g&&g!==t&&l.call(g,r)&&(e=g),p.prototype=d.prototype=Object.create(e));function v(t){["next","throw","return"].forEach(function(e){o(t,e,function(t){return this._invoke(e,t)})})}function y(a,s){var e;u(this,"_invoke",{value:function(n,r){function t(){return new s(function(t,e){!function e(t,n,r,i){var o,t=c(a[t],a,n);if("throw"!==t.type)return(n=(o=t.arg).value)&&"object"==typeof n&&l.call(n,"__await")?s.resolve(n.__await).then(function(t){e("next",t,r,i)},function(t){e("throw",t,r,i)}):s.resolve(n).then(function(t){o.value=t,r(o)},function(t){return e("throw",t,r,i)});i(t.arg)}(n,r,t,e)})}return e=e?e.then(t,t):t()}})}function E(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function _(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function b(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(E,this),this.reset(!0)}function x(e){if(e){var n,t=e[r];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length))return n=-1,(t=function t(){for(;++n<e.length;)if(l.call(e,n))return t.value=e[n],t.done=!1,t;return t.value=void 0,t.done=!0,t}).next=t}return{next:S}}function S(){return{value:void 0,done:!0}}return u(m,"constructor",{value:f.prototype=p,configurable:!0}),u(p,"constructor",{value:f,configurable:!0}),f.displayName=o(p,i,"GeneratorFunction"),a.isGeneratorFunction=function(t){t="function"==typeof t&&t.constructor;return!!t&&(t===f||"GeneratorFunction"===(t.displayName||t.name))},a.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,p):(t.__proto__=p,o(t,i,"GeneratorFunction")),t.prototype=Object.create(m),t},a.awrap=function(t){return{__await:t}},v(y.prototype),o(y.prototype,n,function(){return this}),a.AsyncIterator=y,a.async=function(t,e,n,r,i){void 0===i&&(i=Promise);var o=new y(s(t,e,n,r),i);return a.isGeneratorFunction(e)?o:o.next().then(function(t){return t.done?t.value:o.next()})},v(m),o(m,i,"Generator"),o(m,r,function(){return this}),o(m,"toString",function(){return"[object Generator]"}),a.keys=function(t){var e,n=Object(t),r=[];for(e in n)r.push(e);return r.reverse(),function t(){for(;r.length;){var e=r.pop();if(e in n)return t.value=e,t.done=!1,t}return t.done=!0,t}},a.values=x,b.prototype={constructor:b,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(_),!t)for(var e in this)"t"===e.charAt(0)&&l.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=void 0)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(n){if(this.done)throw n;var r=this;function t(t,e){return o.type="throw",o.arg=n,r.next=t,e&&(r.method="next",r.arg=void 0),!!e}for(var e=this.tryEntries.length-1;0<=e;--e){var i=this.tryEntries[e],o=i.completion;if("root"===i.tryLoc)return t("end");if(i.tryLoc<=this.prev){var a=l.call(i,"catchLoc"),s=l.call(i,"finallyLoc");if(a&&s){if(this.prev<i.catchLoc)return t(i.catchLoc,!0);if(this.prev<i.finallyLoc)return t(i.finallyLoc)}else if(a){if(this.prev<i.catchLoc)return t(i.catchLoc,!0)}else{if(!s)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return t(i.finallyLoc)}}}},abrupt:function(t,e){for(var n=this.tryEntries.length-1;0<=n;--n){var r=this.tryEntries[n];if(r.tryLoc<=this.prev&&l.call(r,"finallyLoc")&&this.prev<r.finallyLoc){var i=r;break}}var o=(i=i&&("break"===t||"continue"===t)&&i.tryLoc<=e&&e<=i.finallyLoc?null:i)?i.completion:{};return o.type=t,o.arg=e,i?(this.method="next",this.next=i.finallyLoc,h):this.complete(o)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),h},finish:function(t){for(var e=this.tryEntries.length-1;0<=e;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),_(n),h}},catch:function(t){for(var e=this.tryEntries.length-1;0<=e;--e){var n,r,i=this.tryEntries[e];if(i.tryLoc===t)return"throw"===(n=i.completion).type&&(r=n.arg,_(i)),r}throw new Error("illegal catch attempt")},delegateYield:function(t,e,n){return this.delegate={iterator:x(t),resultName:e,nextLoc:n},"next"===this.method&&(this.arg=void 0),h}},a}function Vh(t,e,n,r,i,o,a){try{var s=t[o](a),l=s.value}catch(t){return void n(t)}s.done?e(l):Promise.resolve(l).then(r,i)}function jh(s){return function(){var t=this,a=arguments;return new Promise(function(e,n){var r=s.apply(t,a);function i(t){Vh(r,e,n,i,o,"next",t)}function o(t){Vh(r,e,n,i,o,"throw",t)}i(void 0)})}}function zh(){return(zh=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n,r=arguments[e];for(n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t}).apply(this,arguments)}function Hh(t,e){return(Hh=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t})(t,e)}function Xh(){this.$el=void 0,this.$groupEl=void 0,this.$hitTestingEl=void 0}function Yh(t,e){return(e||document).createElementNS("http://www.w3.org/2000/svg",t)}function Kh(t){return t.toFixed(6).replace(".000000","")}function qh(t){return t.replace(/[&|<|>|"|']/g,function(t){return"&"===t?"&":"<"===t?"<":">"===t?">":'"'===t?""":"'"})}Xh.tag="c-svg-element";var $h={opacity:"opacity",fillStyle:"fill",fill:"fill",fillRule:"fill-rule",fillOpacity:"fill-opacity",strokeStyle:"stroke",strokeOpacity:"stroke-opacity",stroke:"stroke",clipPath:"clip-path",textPath:"text-path",r:"r",rx:"rx",ry:"ry",width:"width",height:"height",lineCap:"stroke-linecap",lineJoin:"stroke-linejoin",lineWidth:"stroke-width",lineDash:"stroke-dasharray",lineDashOffset:"stroke-dashoffset",miterLimit:"stroke-miterlimit",font:"font",fontSize:"font-size",fontStyle:"font-style",fontVariant:"font-variant",fontWeight:"font-weight",fontFamily:"font-family",letterSpacing:"letter-spacing",startArrow:"marker-start",endArrow:"marker-end",class:"class",id:"id",preserveAspectRatio:"preserveAspectRatio",visibility:"visibility",anchor:"anchor",shadowColor:"flood-color",shadowBlur:"stdDeviation",shadowOffsetX:"dx",shadowOffsetY:"dy",filter:"filter",innerHTML:"innerHTML",textAlign:"text-anchor",pointerEvents:"pointer-events"},Zh={textAlign:{inherit:"inherit",left:"left",start:"left",center:"middle",right:"end",end:"end"}},Qh={textAlign:"inherit",lineCap:"butt",lineJoin:"miter",lineWidth:"1px",opacity:"1",fillOpacity:"1",fillRule:"nonzero",strokeOpacity:"1",strokeWidth:"0",strokeMiterLimit:"4",letterSpacing:"0",fontSize:"inherit",fontFamily:"inherit",pointerEvents:"auto"},Jh="g-svg",td="clip-path-",ed="text-path-",nd=function(){function d(t,e,n){this.pluginOptions=void 0,this.defElementManager=void 0,this.context=void 0,this.svgElementMap=new WeakMap,this.$camera=void 0,this.renderQueue=[],this.dirtyAttributes=new WeakMap,this.pendingReorderQueue=new Set,this.clipPathUseMap=new WeakMap,this.pluginOptions=t,this.defElementManager=e,this.context=n}var t=d.prototype;return t.apply=function(t){function i(t){var e,t=t.target;c.clipPathUseMap.get(t)&&(e=c.defElementManager.getDefElement().querySelector("#"+c.getId(t)))&&e.remove(),c.createSVGDom(r,t,c.$camera)}function o(t){t=t.target,c.defElementManager.clear(t.entity),c.clipPathUseMap.delete(t),c.removeSVGDom(t)}function a(t){var e=t.parentNode,t=null==(t=t.parentNode)||null==(t=t.elementSVG)?void 0:t.$groupEl,e=((null==e?void 0:e.children)||[]).slice();t&&c.reorderChildren(r,t,e)}function s(t){t=t.target,a(t)}function l(t){var e,n=t.target;n.elementSVG&&(t=t.attrName,(e=c.dirtyAttributes.get(n))||(c.dirtyAttributes.set(n,[]),e=c.dirtyAttributes.get(n)),e.push(t))}function u(t){var t=t.target,e=null==(e=t.elementSVG)?void 0:e.$el,n=(i=t.parsedStyle).fill,r=i.stroke,i=i.clipPath;n&&!To(n)&&c.defElementManager.createOrUpdateGradientAndPattern(t,e,n,"fill",c),r&&!To(r)&&c.defElementManager.createOrUpdateGradientAndPattern(t,e,r,"stroke",c),i&&(n=et(K(),t.getWorldTransform()),e=td+i.entity+"-"+t.entity,r=c.defElementManager.getDefElement().querySelector("#"+e))&&c.applyTransform(r,n)}var c=this,e=t.renderingService,n=t.renderingContext,h=(this.context=t,this.context.svgElementMap=this.svgElementMap,n.root.ownerDocument.defaultView),r=this.context.config.document;e.hooks.init.tapPromise(d.tag,jh(Wh().mark(function t(){var e,n,r;return Wh().wrap(function(t){for(;;)switch(t.prev=t.next){case 0:n=c.context.config,e=n.background,n=n.document,c.defElementManager.init(),r=c.context.contextService.getContext(),e&&(r.style.background=e),r.setAttribute("color-interpolation-filters","sRGB"),c.$camera=Yh("g",n),c.$camera.id=Jh+"-camera",c.applyTransform(c.$camera,c.context.camera.getOrthoMatrix()),r.appendChild(c.$camera),h.addEventListener(v.MOUNTED,i),h.addEventListener(v.UNMOUNTED,o),h.addEventListener(v.REPARENT,s),h.addEventListener(v.ATTR_MODIFIED,l),h.addEventListener(v.BOUNDS_CHANGED,u);case 14:case"end":return t.stop()}},t)}))),e.hooks.destroy.tap(d.tag,function(){h.removeEventListener(v.MOUNTED,i),h.removeEventListener(v.UNMOUNTED,o),h.removeEventListener(v.REPARENT,s),h.removeEventListener(v.ATTR_MODIFIED,l),h.removeEventListener(v.BOUNDS_CHANGED,u)}),e.hooks.render.tap(d.tag,function(t){c.renderQueue.push(t)}),e.hooks.beginFrame.tap(d.tag,function(){var n=c.context.config.document;c.pendingReorderQueue.size&&(c.pendingReorderQueue.forEach(function(t){var e=((null==t?void 0:t.children)||[]).slice(),t=null==t||null==(t=t.elementSVG)?void 0:t.$groupEl;t&&c.reorderChildren(n||r,t,e||[])}),c.pendingReorderQueue.clear())}),e.hooks.endFrame.tap(d.tag,function(){n.renderReasons.has(Ds.CAMERA_CHANGED)&&c.applyTransform(c.$camera,c.context.camera.getOrthoMatrix()),c.renderQueue.forEach(function(e){var n=null==(t=e.elementSVG)?void 0:t.$el,r=null==(t=e.elementSVG)?void 0:t.$groupEl,t=(n&&r&&(t=e.getLocalTransform(),c.applyTransform(r,t),(t=c.clipPathUseMap.get(e))&&t.length&&t.forEach(function(t){c.applyTransform(t,e.getWorldTransform())}),e.renderable.dirty=!1),c.dirtyAttributes.get(e));t&&(t.forEach(function(t){"zIndex"===t?a(e):"increasedLineWidthForHitTesting"===t&&c.createOrUpdateHitArea(e,n,r),c.updateAttribute(e,[t])}),c.dirtyAttributes.delete(e))}),c.renderQueue=[]})},t.getId=function(t){return Jh+"-"+t.entity},t.reorderChildren=function(t,e,n){var r;n.sort(function(t,e){return t.sortable.renderOrder-e.sortable.renderOrder}),n.length&&(r=(t||document).createDocumentFragment(),n.forEach(function(t){t.isConnected&&(t=t.elementSVG.$groupEl)&&r.appendChild(t)}),e.appendChild(r))},t.applyTransform=function(t,e){t.setAttribute("transform","matrix("+Kh(e[0])+","+Kh(e[1])+","+Kh(e[4])+","+Kh(e[5])+","+Kh(e[12])+","+Kh(e[13])+")")},t.applyAttributes=function(t){var e,n=t.elementSVG,r=null==n?void 0:n.$el,n=null==n?void 0:n.$groupEl;r&&n&&(n=t.nodeName,e=t.attributes,r.setAttribute("fill","none"),n===lt.IMAGE&&r.setAttribute("preserveAspectRatio","none"),this.updateAttribute(t,Object.keys(e)))},t.updateAttribute=function(s,t){var l=this,u=this.context.config.document,e=s.elementSVG,c=e.$el,h=e.$groupEl,d=e.$hitTestingEl,f=s.parsedStyle,p=s.computedStyle,g=s.nodeName;t.some(function(t){return l.context.SVGElementLifeCycleContribution.shouldUpdateElementAttribute(s,t)})&&c&&[c,d].forEach(function(t){t&&(l.context.SVGElementLifeCycleContribution.updateElementAttribute(s,t,l.svgElementMap),s.nodeName!==lt.TEXT)&&l.updateAnchorWithTransform(s)}),t.forEach(function(e){var n=$h[e],t=(ct.enableCSSParsing?p:f)[e],r=!M(t)&&t.toString(),i=(null==(o=Zh[e])?void 0:o[r])||r,o=f[e],a=n&&!(null==(a=Is[e])||!a.inh);n&&(g!==lt.GROUP&&!s.isCustomElement||ct.enableCSSParsing||!a&&"fill"!==n&&"stroke"!==n)&&(g===lt.HTML&&("lineWidth"===e?c.style["border-width"]=(o||0)+"px":"lineDash"===e&&(c.style["border-style"]="dashed")),"fill"===e?g===lt.HTML?c.style.background=o.toString():l.defElementManager.createOrUpdateGradientAndPattern(s,c,o,n,l):"stroke"===e?g===lt.HTML?(c.style["border-color"]=o.toString(),c.style["border-style"]="solid"):l.defElementManager.createOrUpdateGradientAndPattern(s,c,o,n,l):ct.enableCSSParsing&&a?"unset"!==r&&r!==Qh[e]?null!=h&&h.setAttribute(n,i):null!=h&&h.removeAttribute(n):"clipPath"===e?l.createOrUpdateClipOrTextPath(u,o,s):"textPath"===e?l.createOrUpdateClipOrTextPath(u,o,s,!0):"shadowType"===e||"shadowColor"===e||"shadowBlur"===e||"shadowOffsetX"===e||"shadowOffsetY"===e?l.defElementManager.createOrUpdateShadow(s,c,e):"filter"===e?l.defElementManager.createOrUpdateFilter(s,c,o):"innerHTML"===e?l.createOrUpdateInnerHTML(u,c,o):"anchor"===e?g!==lt.TEXT&&l.updateAnchorWithTransform(s):M(t)||[c,d].forEach(function(t){t&&n&&("unset"!==r&&r!==Qh[e]?t.setAttribute(n,i):t.removeAttribute(n))}))})},t.createSVGDom=function(t,e,n,r){void 0===r&&(r=!1),e.elementSVG=new Xh;var i,o=e.elementSVG,a=this.context.SVGElementLifeCycleContribution.createElement(e,this.svgElementMap);a&&(e.nodeName===lt.HTML&&(e.parsedStyle.$el=a),this.pluginOptions.outputSVGElementId&&(a.id=this.getId(e)),this.pluginOptions.outputSVGElementName&&e.name&&a.setAttribute("name",e.name),!a.hasAttribute("data-wrapgroup")&&"g"===a.nodeName||r?i=a:((i=Yh("g",t)).id=a.id+"-g",i.appendChild(a)),o.$el=a,o.$groupEl=i,this.applyAttributes(e),this.createOrUpdateHitArea(e,a,i),t=n||e.parentNode&&(null==(r=e.parentNode.elementSVG)?void 0:r.$groupEl))&&(t.appendChild(i),this.pendingReorderQueue.add(e.parentNode))},t.removeSVGDom=function(t){var e=null==(e=t.elementSVG)?void 0:e.$groupEl;e&&e.parentNode&&(e.parentNode.removeChild(e),this.context.SVGElementLifeCycleContribution.destroyElement(t,e))},t.createOrUpdateHitArea=function(t,e,n){var r=t.elementSVG,i=r.$hitTestingEl,o=t.parsedStyle.increasedLineWidthForHitTesting;o?(i||(i=e.cloneNode(),this.pluginOptions.outputSVGElementId&&(i.id=Jh+"-"+t.nodeName+"-hittesting-"+t.entity),["filter"].forEach(function(t){i.removeAttribute(t)}),e="none"!==e.getAttribute("fill"),i.setAttribute("fill",e?"transparent":"none"),i.setAttribute("stroke","transparent"),n.appendChild(i),r.$hitTestingEl=i),i.setAttribute("stroke-width",""+(o+t.parsedStyle.lineWidth))):i&&(n.removeChild(i),r.$hitTestingEl=null)},t.createOrUpdateInnerHTML=function(t,e,n){t=(t||document).createElement("div");"string"==typeof n?t.innerHTML=n:t.appendChild(n),e.innerHTML="",e.appendChild(t)},t.createOrUpdateClipOrTextPath=function(t,e,n,r){var i,o,a,s=n.elementSVG.$groupEl,l=(r=void 0===r?!1:r)?"g":"clipPath",u=r?"text-path":"clip-path";e?(i=(r?ed:td)+e.entity+"-"+n.entity,(o=this.defElementManager.getDefElement()).querySelector("#"+i)||(r?(this.createSVGDom(t,e,null,!0),a=e.elementSVG.$el):(e.isConnected||o.querySelector("#"+this.getId(e))||this.createSVGDom(t,e,o,!0),a=Yh(l,t),(l=Yh("use",t)).setAttribute("href","#"+e.elementSVG.$el.id),a.appendChild(l),(t=this.clipPathUseMap.get(e))||(this.clipPathUseMap.set(e,[]),t=this.clipPathUseMap.get(e)),t.push(l),this.applyTransform(l,e.getWorldTransform()),t=et(K(),n.getWorldTransform()),this.applyTransform(a,t)),a.id=i,o.appendChild(a)),this.applyAttributes(e),r||s.setAttribute(u,"url(#"+i+")")):r||s.removeAttribute(u)},t.updateAnchorWithTransform=function(r){var t=r.getGeometryBounds(),i=t&&2*t.halfExtents[0]||0,o=t&&2*t.halfExtents[1]||0,a=(r.parsedStyle||{}).anchor;[null==(t=r.elementSVG)?void 0:t.$el,null==(t=r.elementSVG)?void 0:t.$hitTestingEl].forEach(function(t){var e,n;t&&(e=-a[0]*i,n=-a[1]*o,0==e&&0==n||t.setAttribute("transform","translate("+e+","+n+")"),r.nodeName!==lt.CIRCLE&&r.nodeName!==lt.ELLIPSE||(t.setAttribute("cx",""+i/2),t.setAttribute("cy",""+o/2)))})},d}(),rd=(nd.tag="SVGRenderer",{top:"hanging",middle:"central",bottom:"text-after-edge",alphabetic:"alphabetic",ideographic:"ideographic",hanging:"hanging"});(e={})[lt.RECT]="path",e[lt.CIRCLE]="circle",e[lt.ELLIPSE]="ellipse",e[lt.IMAGE]="image",e[lt.GROUP]="g",e[lt.LINE]="line",e[lt.POLYLINE]="polyline",e[lt.POLYGON]="polygon",e[lt.TEXT]="text",e[lt.PATH]="path",e[lt.HTML]="foreignObject";var id=e,od=((Us={})[lt.CIRCLE]=["r"],Us[lt.ELLIPSE]=["rx","ry"],Us[lt.RECT]=["width","height","radius"],Us[lt.IMAGE]=["img","width","height"],Us[lt.LINE]=["x1","y1","x2","y2","markerStart","markerEnd","markerStartOffset","markerEndOffset"],Us[lt.POLYLINE]=["points","markerStart","markerEnd","markerMid","markerStartOffset","markerEndOffset"],Us[lt.POLYGON]=["points","markerStart","markerEnd","markerMid","markerStartOffset","markerEndOffset"],Us[lt.PATH]=["path","markerStart","markerEnd","markerMid","markerStartOffset","markerEndOffset"],Us[lt.TEXT]=["text","font","fontSize","fontFamily","fontStyle","fontWeight","fontVariant","lineHeight","letterSpacing","wordWrap","wordWrapWidth","maxLines","leading","textBaseline","textAlign","textTransform","textOverflow","textPath","textPathSide","textPathStartOffset","textDecorationLine","textDecorationColor","textDecorationStyle","dx","dy"],Us),ad=function(){function t(t){this.context=void 0,this.context=t}var e=t.prototype;return e.createElement=function(t,e){var n=this.context.config.document,n=Yh(id[t.nodeName]||"g",n||document);return e.set(n,t),n},e.destroyElement=function(t,e){},e.shouldUpdateElementAttribute=function(t,e){t=t.nodeName;return-1<(od[t]||[]).indexOf(e)},e.updateElementAttribute=function(D){var B,F,U,t,G,W,e,r,V,j,z,n,i,H,a,s,X,Y,l,u,o,K,c,q,$,Z,Q,h,d,J,tt,f,p,g,et,nt,m,v,y,rt,E,_,b,x,S,w,T,A,M,R,N,C,P,O,I,it,L,k,ot=D.elementSVG.$el,at=D.nodeName,st=D.parsedStyle;switch(at){case lt.IMAGE:P=ot,L=void 0===(L=(O=st).img)?"":L,k=O.width,O=O.height,P.setAttribute("x","0"),P.setAttribute("y","0"),Fe(L)?P.setAttribute("href",L):L instanceof Image?(k||P.setAttribute("width",""+L.width),O||P.setAttribute("height",""+L.height),P.setAttribute("href",L.src)):L instanceof HTMLElement&&Fe(L.nodeName)&&"CANVAS"===L.nodeName.toUpperCase()?P.setAttribute("href",L.toDataURL()):L instanceof ImageData&&((I=document.createElement("canvas")).setAttribute("width",""+L.width),I.setAttribute("height",""+L.height),it=I.getContext("2d"))&&(it.putImageData(L,0,0),k||P.setAttribute("width",""+L.width),O||P.setAttribute("height",""+L.height),P.setAttribute("href",I.toDataURL()));break;case lt.RECT:it=ot,O=(k=st).radius,N=k.width,C=k.height,isFinite(N)&&isFinite(C)&&(k="",k=O&&O.some(function(t){return 0!==t})?(L=(O=O.map(function(t){return Ue(t,0,Math.min(Math.abs(N)/2,Math.abs(C)/2))}))[0],P=O[1],I=O[2],O=O[3],[["M "+(A=0<N?1:-1)*L+",0"],["l "+(N-A*(L+P))+",0"],["a "+P+","+P+",0,0,"+(R=A+(M=0<C?1:-1)!=0?1:0)+","+A*P+","+M*P],["l 0,"+(C-M*(P+I))],["a "+I+","+I+",0,0,"+R+","+-A*I+","+M*I],["l "+(A*(I+O)-N)+",0"],["a "+O+","+O+",0,0,"+R+","+-A*O+","+-M*O],["l 0,"+(M*(O+L)-C)],["a "+L+","+L+",0,0,"+R+","+A*L+","+-M*L],["z"]].join(" ")):"M 0,0 l "+N+",0 l 0,"+C+" l"+-N+" 0 z",it.setAttribute("d",k));break;case lt.LINE:R=ot,M=(A=st).x1,et=A.y1,nt=A.x2,m=A.y2,v=void 0===(v=A.defX)?0:v,y=void 0===(y=A.defY)?0:y,rt=A.markerStart,E=A.markerEnd,_=A.markerStartOffset,A=A.markerEndOffset,T=w=S=x=b=0,rt&&ut(rt)&&_&&(p=nt-M,g=m-et,T=Math.atan2(g,p),b=Math.cos(T)*(_||0),x=Math.sin(T)*(_||0)),E&&ut(E)&&A&&(p=M-nt,g=et-m,T=Math.atan2(g,p),S=Math.cos(T)*(A||0),w=Math.sin(T)*(A||0)),R.setAttribute("x1",""+(M-v+b)),R.setAttribute("y1",""+(et-y+x)),R.setAttribute("x2",""+(nt-v+S)),R.setAttribute("y2",""+(m-y+w));break;case lt.POLYGON:case lt.POLYLINE:rt=ot,E=(_=st).points.points,J=void 0===(g=_.defX)?0:g,tt=void 0===(g=_.defY)?0:g,g=_.markerStart,p=_.markerStartOffset,T=_.markerEnd,_=_.markerEndOffset,f=E.length,E&&2<=f&&(b=Q=Z=$=q=0,g&&ut(g)&&p&&(h=E[1][0]-E[0][0],d=E[1][1]-E[0][1],b=Math.atan2(d,h),q=Math.cos(b)*(p||0),$=Math.sin(b)*(p||0)),T&&ut(T)&&_&&(h=E[f-2][0]-E[f-1][0],d=E[f-2][1]-E[f-1][1],b=Math.atan2(d,h),Z=Math.cos(b)*(_||0),Q=Math.sin(b)*(_||0)),rt.setAttribute("points",E.map(function(t,e){var n=0,r=0;return 0===e?(n=q,r=$):e===f-1&&(n=Z,r=Q),t[0]-J+n+","+(t[1]-tt+r)}).join(" ")));break;case lt.PATH:et=ot,nt=(x=st).path,v=void 0===(v=x.defX)?0:v,S=void 0===(S=x.defY)?0:S,m=x.markerStart,y=x.markerEnd,w=x.markerStartOffset,x=x.markerEndOffset,c=K=o=h=d=0,m&&ut(m)&&w&&(i=(m=m.parentNode.getStartTangent())[0],m=m[1],n=i[0]-m[0],i=i[1]-m[1],c=Math.atan2(i,n),d=Math.cos(c)*(w||0),h=Math.sin(c)*(w||0)),y&&ut(y)&&x&&(w=(m=y.parentNode.getEndTangent())[0],y=m[1],n=w[0]-y[0],i=w[1]-y[1],c=Math.atan2(i,n),o=Math.cos(c)*(x||0),K=Math.sin(c)*(x||0)),et.setAttribute("d",(H=nt.absolutePath,a=v,s=S,void 0===(X=d)&&(X=0),void 0===(Y=h)&&(Y=0),void 0===(l=o)&&(l=0),void 0===(u=K)&&(u=0),~(m=H.map(function(t,e){var n=t[0],r=H[e+1],i=0===e&&(0!==X||0!==Y),o=(e===H.length-1||r&&("M"===r[0]||"Z"===r[0]))&&0!==l&&0!==u;switch(n){case"M":return i?"M "+(t[1]-a+X)+","+(t[2]-s+Y)+" L "+(t[1]-a)+","+(t[2]-s):"M "+(t[1]-a)+","+(t[2]-s);case"L":return"L "+(t[1]-a+(o?l:0))+","+(t[2]-s+(o?u:0));case"Q":return"Q "+(t[1]-a)+" "+(t[2]-s)+","+(t[3]-a)+" "+(t[4]-s)+(o?" L "+(t[3]-a+l)+","+(t[4]-s+u):"");case"C":return"C "+(t[1]-a)+" "+(t[2]-s)+","+(t[3]-a)+" "+(t[4]-s)+","+(t[5]-a)+" "+(t[6]-s)+(o?" L "+(t[5]-a+l)+","+(t[6]-s+u):"");case"A":return"A "+t[1]+" "+t[2]+" "+t[3]+" "+t[4]+" "+t[5]+" "+(t[6]-a)+" "+(t[7]-s)+(o?" L "+(t[6]-a+l)+","+(t[7]-s+u):"");case"Z":return"Z"}}).join(" ")).indexOf("NaN")?"":m));break;case lt.TEXT:i=ot,B=(n=st).lineWidth,c=n.dx,o=n.dy,K=n.textPath,F=void 0===(F=n.textPathSide)?"left":F,U=void 0===(U=n.textPathStartOffset)?0:U,t=void 0===(t=n.textDecorationLine)?"":t,G=void 0===(G=n.textDecorationColor)?"":G,W=void 0===(W=n.textDecorationStyle)?"":W,e=n.metrics,r=n.textBaseline,ct.enableCSSParsing||"alphabetic"!==r||(r="bottom"),i.setAttribute("dominant-baseline",rd[r]),i.setAttribute("paint-order","stroke"),n=e.lines,V=e.lineHeight,j=e.height,z=n.length,e="",0===c&&0===o||(e+="transform:translate("+c+"px, "+o+"px);"),t&&"none"!==t&&(e+="text-decoration:"+t+" "+W+" "+G+";"),e&&i.setAttribute("style",e),1===z?(c=qh(n[0]),i.setAttribute("dx",""+B/2),"bottom"!==r&&"top"!==r||(i.setAttribute("dominant-baseline","middle"),i.setAttribute("dy","bottom"===r?"-0.5em":"0.5em")),K?(i.innerHTML="",(o=Yh("textPath",i.ownerDocument)).setAttribute("href","#"+(ed+K.entity)),"left"!==F&&o.setAttribute("side",F),0!==U&&o.setAttribute("startOffset",""+U),o.innerHTML=c,i.appendChild(o)):i.innerHTML=c):i.innerHTML=n.map(function(t,e){var n=0;return 0===e?"middle"===r?n=V/2-j/2:"top"===r||"hanging"===r?n=0:"bottom"!==r&&"alphabetic"!==r&&"ideographic"!==r||(n=-V*(z-1)):n=V,'<tspan x="0" dx="'+B/2+'" dy="'+n+'">'+qh(t)+"</tspan>"}).join("")}},t}(),sd="g-filter-";function ld(g,m,t,e,n){var r,v=sd+t.entity,t=m.querySelectorAll("[name="+v+"]");t.length&&t.forEach(function(t){m.removeChild(t)}),0===n.length?null!=e&&e.removeAttribute("filter"):(r=n.map(function(t,e){var n,r,i,o,a,s,l,u,c,h,d,f=t.name,t=t.params,p=Yh("filter",g);return p.setAttribute("filterUnits","userSpaceOnUse"),"blur"===f?(a=p,n=t,(s=Yh("feGaussianBlur",s=g)).setAttribute("in","SourceGraphic"),s.setAttribute("stdDeviation",""+n[0].value),a.appendChild(s)):"brightness"===f?(n=ud((n=t)[0]),cd(g,p,{type:"linear",slope:n,intercept:0})):"drop-shadow"===f?(a=g,s=p,u=(l=t)[0].value,c=l[1].value,h=l[2].value,l=l[3].formatted,(d=Yh("feGaussianBlur",a)).setAttribute("in","SourceAlpha"),d.setAttribute("stdDeviation",""+h),s.appendChild(d),(h=Yh("feOffset",a)).setAttribute("dx",""+u),h.setAttribute("dy",""+c),h.setAttribute("result","offsetblur"),s.appendChild(h),(d=Yh("feFlood",a)).setAttribute("flood-color",l),s.appendChild(d),(u=Yh("feComposite",a)).setAttribute("in2","offsetblur"),u.setAttribute("operator","in"),s.appendChild(u),c=Yh("feMerge",a),s.appendChild(c),h=Yh("feMergeNode",a),(l=Yh("feMergeNode",a)).setAttribute("in","SourceGraphic"),c.appendChild(h),c.appendChild(l)):"contrast"===f?(d=ud((d=t)[0]),cd(g,p,{type:"linear",slope:d,intercept:-.5*d+.5})):"grayscale"===f?(u=ud((u=t)[0]),hd(g,p,[.2126+.7874*(1-u),.7152-.7152*(1-u),.0722-.0722*(1-u),0,0,.2126-.2126*(1-u),.7152+.2848*(1-u),.0722-.0722*(1-u),0,0,.2126-.2126*(1-u),.7152-.7152*(1-u),.0722+.9278*(1-u),0,0,0,0,0,1,0])):"sepia"===f?(h=ud((h=t)[0]),hd(g,p,[.393+.607*(1-h),.769-.769*(1-h),.189-.189*(1-h),0,0,.349-.349*(1-h),.686+.314*(1-h),.168-.168*(1-h),0,0,.272-.272*(1-h),.534-.534*(1-h),.131+.869*(1-h),0,0,0,0,0,1,0])):"saturate"===f?(c=g,l=p,i=ud((i=t)[0]),(c=Yh("feColorMatrix",c)).setAttribute("type","saturate"),c.setAttribute("values",""+i),l.appendChild(c)):"hue-rotate"===f?(i=p,o=t,(r=Yh("feColorMatrix",r=g)).setAttribute("type","hueRotate"),r.setAttribute("values",""+o[0].value),i.appendChild(r)):"invert"===f&&(o=ud((o=t)[0]),cd(g,p,{type:"table",tableValues:o+" "+(1-o)})),p.id=v+"-"+e,p.setAttribute("name",v),m.appendChild(p),p.id}),setTimeout(function(){null!=e&&e.setAttribute("filter",r.map(function(t){return"url(#"+t+")"}).join(" "))}))}function ud(t){return t.unit===p.kPercentage?t.value/100:t.value}function cd(t,e,n){var r=n.type,i=n.slope,o=n.intercept,a=n.tableValues,s=Yh("feComponentTransfer",t);[Yh("feFuncR",t),Yh("feFuncG",t),Yh("feFuncB",t)].forEach(function(t){t.setAttribute("type",r),"table"===r?t.setAttribute("tableValues",""+a):(t.setAttribute("slope",""+i),t.setAttribute("intercept",""+o)),s.appendChild(t)}),e.appendChild(s)}function hd(t,e,n){t=Yh("feColorMatrix",t);t.setAttribute("type","matrix"),t.setAttribute("values",n.join(" ")),e.appendChild(t)}var dd="g-pattern-",fd={},pd=0;function gd(t,e,n,r,i,o,a,s){if(i){var l,u,c,h,d,f,p;if(!To(i))return wo(i)?(a=function(n,e,r,i,t,o){var a,s=md(i);{var l,u,c;e.querySelector("#"+s)||(l=i.image,c="",Fe(l)?c=l:Ur&&(l instanceof HTMLImageElement?c=l.src:l instanceof HTMLCanvasElement&&(c=l.toDataURL())),c&&((u=Yh("image",n)).setAttribute("href",c),t?a=t(c):Ur&&(a=new window.Image),c.match(/^data:/i)||(a.crossOrigin="Anonymous",u.setAttribute("crossorigin","anonymous")),a.src=c,t=function(){var t=vd(n,e,r,i,s,a.width,a.height);e.appendChild(t),t.appendChild(u),u.setAttribute("x","0"),u.setAttribute("y","0"),u.setAttribute("width",""+a.width),u.setAttribute("height",""+a.height)},a.complete?t():a.onload=t),"rect"===l.nodeName&&(c=l.parsedStyle,t=c.width,c=c.height,t=vd(n,e,l,i,s,t,c),l.forEach(function(t){o.createSVGDom(n,t,null);var e=t.elementSVG,t=t.getLocalTransform();o.applyTransform(e.$groupEl,t)}),c=l.elementSVG,t.appendChild(c.$groupEl)))}return s}(t,e,n,i,a,s),r.style[o]="url(#"+a+")",a):1===i.length?(s=yd(t,n,e,0,i[0]),null!=r&&r.setAttribute(o,"url(#"+s+")"),s):(l=t,c=e,h=r,a=i,d=sd+(u=n).entity+"-gradient",(f=c.querySelector("#"+d))||((f=Yh("filter",l)).setAttribute("filterUnits","userSpaceOnUse"),f.setAttribute("x","0%"),f.setAttribute("y","0%"),f.setAttribute("width","100%"),f.setAttribute("height","100%"),f.id=d,c.appendChild(f)),p=0,a.forEach(function(t,e){var t=yd(l,u,c,0,t),n=t+"_rect",r=Yh("rect",l),t=(r.setAttribute("x","0"),r.setAttribute("y","0"),r.setAttribute("width","100%"),r.setAttribute("height","100%"),r.setAttribute("fill","url(#"+t+")"),r.id=n,c.appendChild(r),Yh("feImage",l));t.setAttribute("href","#"+n),t.setAttribute("result",d+"-"+e),f.appendChild(t),0<e&&((r=Yh("feBlend",l)).setAttribute("in",1===e?d+"-"+(e-1):d+"-blended-"+(p-1)),r.setAttribute("in2",d+"-"+e),r.setAttribute("result",d+"-blended-"+p++),r.setAttribute("mode","multiply"),f.appendChild(r))}),(a=Yh("feComposite",l)).setAttribute("in",d+"-blended-"+p),a.setAttribute("in2","SourceGraphic"),a.setAttribute("operator","in"),f.appendChild(a),s=d,null!=r&&r.setAttribute("filter","url(#"+s+")"),null!=r&&r.setAttribute("fill","black"),s);"currentColor"===n.style[o]?null!=r&&r.setAttribute(o,"currentColor"):null!=r&&r.setAttribute(o,i.isNone?"none":i.toString())}return""}function md(t,e){void 0===e&&(e={});var n,r,i,o,a,s,l,u="";return(l=t).type&&l.value?(l=t.type,n=t.value,l!==ur.LinearGradient&&l!==ur.RadialGradient||(n=(l=zh({},n,e)).type,e=l.width,r=l.height,i=l.steps,o=l.angle,a=l.cx,s=l.cy,l=l.size,u="gradient-"+n+"-"+((null==o?void 0:o.toString())||0)+"-"+((null==a?void 0:a.toString())||0)+"-"+((null==s?void 0:s.toString())||0)+"-"+((null==l?void 0:l.toString())||0)+"-"+e+"-"+r+"-"+i.map(function(t){return""+t.offset+t.color}).join("-"))):wo(t)&&(u=Fe(t.image)?"pattern-"+t.image+"-"+t.repetition:"rect"===t.image.nodeName?"pattern-rect-"+t.image.entity:"pattern-"+pd),u&&!fd[u]&&(fd[u]=dd+(""+pd++)),fd[u]}function vd(t,e,n,r,i,o,a){var s=r.repetition,r=r.transform,t=Yh("pattern",t);r&&t.setAttribute("patternTransform",ta(r).map(function(t){var e,n=t.t,t=t.d;return"translate"===n?"translate("+t[0].value+" "+t[1].value+")":"translatex"===n?"translate("+t[0].value+" 0)":"translatey"===n?"translate(0 "+t[0].value+")":"rotate"===n?"rotate("+t[0].value+")":"scale"===n?"scale("+(e=(null==t?void 0:t.map(function(t){return t.value}))||[1,1])[0]+", "+e[1]+")":"scalex"===n?"scale("+((null==t?void 0:t.map(function(t){return t.value}))||[1])[0]+", 1)":"scaley"===n?"scale(1, "+((null==t?void 0:t.map(function(t){return t.value}))||[1])[0]+")":"skew"===n?"skewX("+(e=(null==t?void 0:t.map(function(t){return t.value}))||[0,0])[0]+") skewY("+e[1]+")":"skewx"===n?"skewX("+((null==t?void 0:t.map(function(t){return t.value}))||[0])[0]+")":"skewy"===n?"skewY("+((null==t?void 0:t.map(function(t){return t.value}))||[0])[0]+")":"matrix"===n?"matrix("+(e=t.map(function(t){return t.value}))[0]+" "+e[1]+" "+e[2]+" "+e[3]+" "+e[4]+" "+e[5]+")":void 0}).join(" ")),t.setAttribute("patternUnits","userSpaceOnUse"),t.id=i,e.appendChild(t),t.setAttribute("x","0"),t.setAttribute("y","0");r=n.getGeometryBounds().halfExtents,i=o,e=a;return"repeat-x"===s?e=2*r[1]:"repeat-y"===s?i=2*r[0]:"no-repeat"===s&&(i=2*r[0],e=2*r[1]),t.setAttribute("width",""+i),t.setAttribute("height",""+e),t}function yd(t,e,n,r,i){var o,a,s,e=e.getGeometryBounds(),l=e&&2*e.halfExtents[0]||0,e=e&&2*e.halfExtents[1]||0,u=md(i,{width:l,height:e}),c=n.querySelector("#"+u);return c||((c=Yh(i.type===ur.LinearGradient?"linearGradient":"radialGradient",t)).setAttribute("gradientUnits","userSpaceOnUse"),o="",i.value.steps.sort(function(t,e){return t.offset.value-e.offset.value}).forEach(function(t){var e=t.offset,t=t.color;o+='<stop offset="'+e.value/100+'" stop-color="'+t+'"></stop>'}),c.innerHTML=o,c.id=u,n.appendChild(c)),i.type===ur.LinearGradient?(n=(t=Di(l,e,i.value.angle)).x1,a=t.y1,s=t.x2,t=t.y2,c.setAttribute("x1",""+n),c.setAttribute("y1",""+a),c.setAttribute("x2",""+s),c.setAttribute("y2",""+t)):(s=(a=Bi(l,e,(n=i.value).cx,n.cy,n.size)).x,t=a.y,l=a.r,c.setAttribute("cx",""+s),c.setAttribute("cy",""+t),c.setAttribute("r",""+l)),u}var Ed="g-filter-dropshadow-";var _d=/url\("?#(.*)\)/,bd=function(){function t(t){this.context=void 0,this.$def=void 0,this.gradientCache={},this.context=t}var e=t.prototype;return e.getDefElement=function(){return this.$def},e.init=function(){var t=this.context.config.document,e=this.context.contextService.getContext();this.$def=Yh("defs",t),e.appendChild(this.$def)},e.clear=function(e){var n=this;Object.keys(this.gradientCache).forEach(function(t){n.clearUnusedDefElement(n.gradientCache,t,e)})},e.clearUnusedDefElement=function(t,e,n){t[e]&&1===t[e].size&&t[e].has(n)&&(t=this.$def.querySelector("#"+e))&&this.$def.removeChild(t)},e.createOrUpdateGradientAndPattern=function(t,e,n,r,i){var o,a=this.context.config,s=a.document,a=a.createImage;e&&((o=(wo(n)?e.style[r]:e.getAttribute(r)||"").match(_d))&&1<o.length&&this.clearUnusedDefElement(this.gradientCache,o[1].replace('"',""),t.entity),o=gd(s||document,this.$def,t,e,n,r,a,i))&&(this.gradientCache[o]||(this.gradientCache[o]=new Set),this.gradientCache[o].add(t.entity))},e.createOrUpdateShadow=function(t,e,n){var r,i,o,a,s,l,u,c,h,d,f=this.context.config.document;f=f||document,r=this.$def,e=e,n=n,a=(c=(t=t).parsedStyle).shadowType,s=c.shadowBlur,l=c.shadowColor,u=c.shadowOffsetX,c=c.shadowOffsetY,h=!M(l)&&0<s,t=Ed+t.entity,!(d=r.querySelector("#"+t))||d.getAttribute("data-type")===a&&h||(d.remove(),d=null),h?(null!=e&&e.setAttribute("filter","url(#"+t+")"),d?"inner"===a?(h=d.children[1],i=d.children[2],o=d.children[3],"shadowColor"===n?o.setAttribute("flood-color",l.toString()):"shadowBlur"===n?h.setAttribute("stdDeviation",""+(s||0)/4):"shadowOffsetX"===n?i.setAttribute("dx",""+(u||0)/2):"shadowOffsetY"===n&&i.setAttribute("dy",""+(c||0)/2)):"outer"===a&&(o=d.children[0],"shadowColor"===n?o.setAttribute("flood-color",l.toString()):"shadowBlur"===n?o.setAttribute("stdDeviation",""+(s||0)/4):"shadowOffsetX"===n?o.setAttribute("dx",""+(u||0)/2):"shadowOffsetY"===n&&o.setAttribute("dy",""+(c||0)/2)):((d=Yh("filter",f)).setAttribute("data-type",a),"outer"===a?((h=Yh("feDropShadow",f)).setAttribute("dx",""+(u||0)/2),h.setAttribute("dy",""+(c||0)/2),h.setAttribute("stdDeviation",""+(s||0)/4),h.setAttribute("flood-color",l.toString()),d.appendChild(h)):"inner"===a&&((i=Yh("feComponentTransfer",f)).setAttribute("in","SourceAlpha"),(n=Yh("feFuncA",f)).setAttribute("type","table"),n.setAttribute("tableValues","1 0"),i.appendChild(n),d.appendChild(i),(o=Yh("feGaussianBlur",f)).setAttribute("stdDeviation",""+(s||0)/4),d.appendChild(o),(h=Yh("feOffset",f)).setAttribute("dx",""+(u||0)/2),h.setAttribute("dy",""+(c||0)/2),h.setAttribute("result","offsetblur"),d.appendChild(h),(a=Yh("feFlood",f)).setAttribute("flood-color",l.toString()),a.setAttribute("result","color"),d.appendChild(a),(n=Yh("feComposite",f)).setAttribute("in2","offsetblur"),n.setAttribute("operator","in"),d.appendChild(n),(i=Yh("feComposite",f)).setAttribute("in2","SourceAlpha"),i.setAttribute("operator","in"),d.appendChild(i),s=Yh("feMerge",f),d.appendChild(s),(o=Yh("feMergeNode",f)).setAttribute("in","SourceGraphic"),u=Yh("feMergeNode",f),s.appendChild(o),s.appendChild(u)),d.id=t,d.setAttribute("filterUnits","userSpaceOnUse"),r.appendChild(d))):null!=e&&e.removeAttribute("filter")},e.createOrUpdateFilter=function(t,e,n){ld(this.context.config.document||document,this.$def,t,e,n)},t}(),xd=function(n){var t;function e(t){var e;return void 0===t&&(t={}),(e=n.call(this)||this).options=void 0,e.name="svg-renderer",e.options=t,e}t=n,(r=e).prototype=Object.create(t.prototype),Hh(r.prototype.constructor=r,t);var r=e.prototype;return r.init=function(){var t=this.options,e=t.outputSVGElementId,t=t.outputSVGElementName,n=new bd(this.context),r=new ad(this.context),r=(this.context.defaultElementLifeCycleContribution=r,this.context.SVGElementLifeCycleContribution=r,{outputSVGElementId:!!M(e)||!!e,outputSVGElementName:!!M(t)||!!t});this.addRenderingPlugin(new nd(r,n,this.context))},r.destroy=function(){this.removeAllRenderingPlugins(),delete this.context.defaultElementLifeCycleContribution,delete this.context.SVGElementLifeCycleContribution},e}(Ws);function Sd(){Sd=function(){return a};var a={},t=Object.prototype,l=t.hasOwnProperty,u=Object.defineProperty||function(t,e,n){t[e]=n.value},e="function"==typeof Symbol?Symbol:{},r=e.iterator||"@@iterator",n=e.asyncIterator||"@@asyncIterator",i=e.toStringTag||"@@toStringTag";function o(t,e,n){return Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{o({},"")}catch(t){o=function(t,e,n){return t[e]=n}}function s(t,e,n,r){var i,o,a,s,e=e&&e.prototype instanceof d?e:d,e=Object.create(e.prototype),r=new b(r||[]);return u(e,"_invoke",{value:(i=t,o=n,a=r,s="suspendedStart",function(t,e){if("executing"===s)throw new Error("Generator is already running");if("completed"===s){if("throw"===t)throw e;return S()}for(a.method=t,a.arg=e;;){var n=a.delegate;if(n){n=function t(e,n){var r=n.method,i=e.iterator[r];if(void 0===i)return n.delegate=null,"throw"===r&&e.iterator.return&&(n.method="return",n.arg=void 0,t(e,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),h;r=c(i,e.iterator,n.arg);if("throw"===r.type)return n.method="throw",n.arg=r.arg,n.delegate=null,h;i=r.arg;return i?i.done?(n[e.resultName]=i.value,n.next=e.nextLoc,"return"!==n.method&&(n.method="next",n.arg=void 0),n.delegate=null,h):i:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,h)}(n,a);if(n){if(n===h)continue;return n}}if("next"===a.method)a.sent=a._sent=a.arg;else if("throw"===a.method){if("suspendedStart"===s)throw s="completed",a.arg;a.dispatchException(a.arg)}else"return"===a.method&&a.abrupt("return",a.arg);s="executing";n=c(i,o,a);if("normal"===n.type){if(s=a.done?"completed":"suspendedYield",n.arg===h)continue;return{value:n.arg,done:a.done}}"throw"===n.type&&(s="completed",a.method="throw",a.arg=n.arg)}})}),e}function c(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(t){return{type:"throw",arg:t}}}a.wrap=s;var h={};function d(){}function f(){}function p(){}var e={},g=(o(e,r,function(){return this}),Object.getPrototypeOf),g=g&&g(g(x([]))),m=(g&&g!==t&&l.call(g,r)&&(e=g),p.prototype=d.prototype=Object.create(e));function v(t){["next","throw","return"].forEach(function(e){o(t,e,function(t){return this._invoke(e,t)})})}function y(a,s){var e;u(this,"_invoke",{value:function(n,r){function t(){return new s(function(t,e){!function e(t,n,r,i){var o,t=c(a[t],a,n);if("throw"!==t.type)return(n=(o=t.arg).value)&&"object"==typeof n&&l.call(n,"__await")?s.resolve(n.__await).then(function(t){e("next",t,r,i)},function(t){e("throw",t,r,i)}):s.resolve(n).then(function(t){o.value=t,r(o)},function(t){return e("throw",t,r,i)});i(t.arg)}(n,r,t,e)})}return e=e?e.then(t,t):t()}})}function E(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function _(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function b(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(E,this),this.reset(!0)}function x(e){if(e){var n,t=e[r];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length))return n=-1,(t=function t(){for(;++n<e.length;)if(l.call(e,n))return t.value=e[n],t.done=!1,t;return t.value=void 0,t.done=!0,t}).next=t}return{next:S}}function S(){return{value:void 0,done:!0}}return u(m,"constructor",{value:f.prototype=p,configurable:!0}),u(p,"constructor",{value:f,configurable:!0}),f.displayName=o(p,i,"GeneratorFunction"),a.isGeneratorFunction=function(t){t="function"==typeof t&&t.constructor;return!!t&&(t===f||"GeneratorFunction"===(t.displayName||t.name))},a.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,p):(t.__proto__=p,o(t,i,"GeneratorFunction")),t.prototype=Object.create(m),t},a.awrap=function(t){return{__await:t}},v(y.prototype),o(y.prototype,n,function(){return this}),a.AsyncIterator=y,a.async=function(t,e,n,r,i){void 0===i&&(i=Promise);var o=new y(s(t,e,n,r),i);return a.isGeneratorFunction(e)?o:o.next().then(function(t){return t.done?t.value:o.next()})},v(m),o(m,i,"Generator"),o(m,r,function(){return this}),o(m,"toString",function(){return"[object Generator]"}),a.keys=function(t){var e,n=Object(t),r=[];for(e in n)r.push(e);return r.reverse(),function t(){for(;r.length;){var e=r.pop();if(e in n)return t.value=e,t.done=!1,t}return t.done=!0,t}},a.values=x,b.prototype={constructor:b,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(_),!t)for(var e in this)"t"===e.charAt(0)&&l.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=void 0)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(n){if(this.done)throw n;var r=this;function t(t,e){return o.type="throw",o.arg=n,r.next=t,e&&(r.method="next",r.arg=void 0),!!e}for(var e=this.tryEntries.length-1;0<=e;--e){var i=this.tryEntries[e],o=i.completion;if("root"===i.tryLoc)return t("end");if(i.tryLoc<=this.prev){var a=l.call(i,"catchLoc"),s=l.call(i,"finallyLoc");if(a&&s){if(this.prev<i.catchLoc)return t(i.catchLoc,!0);if(this.prev<i.finallyLoc)return t(i.finallyLoc)}else if(a){if(this.prev<i.catchLoc)return t(i.catchLoc,!0)}else{if(!s)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return t(i.finallyLoc)}}}},abrupt:function(t,e){for(var n=this.tryEntries.length-1;0<=n;--n){var r=this.tryEntries[n];if(r.tryLoc<=this.prev&&l.call(r,"finallyLoc")&&this.prev<r.finallyLoc){var i=r;break}}var o=(i=i&&("break"===t||"continue"===t)&&i.tryLoc<=e&&e<=i.finallyLoc?null:i)?i.completion:{};return o.type=t,o.arg=e,i?(this.method="next",this.next=i.finallyLoc,h):this.complete(o)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),h},finish:function(t){for(var e=this.tryEntries.length-1;0<=e;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),_(n),h}},catch:function(t){for(var e=this.tryEntries.length-1;0<=e;--e){var n,r,i=this.tryEntries[e];if(i.tryLoc===t)return"throw"===(n=i.completion).type&&(r=n.arg,_(i)),r}throw new Error("illegal catch attempt")},delegateYield:function(t,e,n){return this.delegate={iterator:x(t),resultName:e,nextLoc:n},"next"===this.method&&(this.arg=void 0),h}},a}function wd(t,e,n,r,i,o,a){try{var s=t[o](a),l=s.value}catch(t){return void n(t)}s.done?e(l):Promise.resolve(l).then(r,i)}function Td(s){return function(){var t=this,a=arguments;return new Promise(function(e,n){var r=s.apply(t,a);function i(t){wd(r,e,n,i,o,"next",t)}function o(t){wd(r,e,n,i,o,"throw",t)}i(void 0)})}}function Ad(t,e){t.prototype=Object.create(e.prototype),Md(t.prototype.constructor=t,e)}function Md(t,e){return(Md=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t})(t,e)}function Rd(t,e){if(null==t)return{};for(var n,r={},i=Object.keys(t),o=0;o<i.length;o++)n=i[o],0<=e.indexOf(n)||(r[n]=t[n]);return r}var Nd=["offset","composite","computedOffset","easing"],Cd=["offset","composite","computedOffset","easing","transformOrigin"],Pd=["offset","composite","computedOffset","easing","transformOrigin"],Od=["offset","composite","computedOffset","easing","transformOrigin"],Id=function(){function t(t){this.context=void 0,this.$container=void 0,this.$namespace=void 0,this.dpr=void 0,this.canvasConfig=void 0,this.context=t,this.canvasConfig=t.config}var e=t.prototype;return e.init=function(){var t=Td(Sd().mark(function t(){var e,n,r;return Sd().wrap(function(t){for(;;)switch(t.prev=t.next){case 0:e=this.canvasConfig,n=e.container,r=e.document,e=e.devicePixelRatio,this.$container=Fe(n)?(r||document).getElementById(n):n,this.$container&&(this.$container.style.position||(this.$container.style.position="relative"),(n=Yh("svg",r)).setAttribute("width",""+this.canvasConfig.width),n.setAttribute("height",""+this.canvasConfig.height),this.$container.appendChild(n),this.$namespace=n),r=1<=(r=e||Ur&&window.devicePixelRatio||1)?Math.ceil(r):1,this.dpr=r;case 6:case"end":return t.stop()}},t,this)}));return function(){return t.apply(this,arguments)}}(),e.getDomElement=function(){return this.$namespace},e.getContext=function(){return this.$namespace},e.getDPR=function(){return this.dpr},e.getBoundingClientRect=function(){var t;return null==(t=this.$namespace)?void 0:t.getBoundingClientRect()},e.destroy=function(){this.$container&&this.$namespace&&this.$namespace.parentNode&&this.$container.removeChild(this.$namespace)},e.resize=function(t,e){this.$namespace&&(this.$namespace.setAttribute("width",""+t),this.$namespace.setAttribute("height",""+e))},e.applyCursorStyle=function(t){this.$container&&(this.$container.style.cursor=t)},e.generateCSSText=function(t,e,n,r,i){void 0===i&&(i={});var o=r.duration,a=r.easing,s=r.delay,l=r.direction,u=r.iterations,r=r.fill;return"@keyframes "+t+"{"+n.map(function(t){t.offset,t.composite;var e=t.computedOffset,n=(t.easing,Rd(t,Nd));return 100*e+"%{"+Object.keys(n).map(function(t){return t+":"+(i[t]||"")+n[t]+";"}).join("")+"}"}).join("")+"}"+e+" {animation: "+t+" "+o+"ms "+a+" "+s+"ms "+(u===1/0?"infinite":u)+" "+l+" "+r+";}"},e.toDataURL=function(){var e=Td(Sd().mark(function t(e){var n,s,c,l,r,h=this;return Sd().wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return n=this.$namespace.cloneNode(!0),s=this.canvasConfig.document,c=0,l=null,this.context.renderingContext.root.forEach(function(t){var r,i,o,a,u,e=t.getAnimations();e.length&&(l||(l=(s||document).createElement("style"),n.appendChild(l)),r=t.elementSVG,i="#"+r.$el.id,o="#"+r.$groupEl.id,u=a="",e.forEach(function(t){var s,l,e,n=t.effect.getKeyframes();n.length&&(s=[],l=[],(e=n[0]).offset,e.composite,e.computedOffset,e.easing,e.transformOrigin,e=Rd(e,Cd),Object.keys(e).forEach(function(t){var e;"transform"===t&&l.push(t),!(null==(e=Is[t])||!e.inh)?l.push(t):"transform"!==t&&s.push(t)}),l.length&&(e=n.map(function(e){var t=e.offset,n=e.composite,r=e.computedOffset,i=e.easing,o=(e.transformOrigin,Rd(e,Pd)),a={offset:t,composite:n,computedOffset:r,easing:i};return Object.keys(o).forEach(function(t){l.includes(t)&&(a[t]=e[t])}),a}),u+=h.generateCSSText("a"+c++,o,e,t.effect.getComputedTiming(),{transform:r.$groupEl.getAttribute("transform")})),s.length)&&(e=n.map(function(e){var t=e.offset,n=e.composite,r=e.computedOffset,i=e.easing,o=(e.transformOrigin,Rd(e,Od)),a={offset:t,composite:n,computedOffset:r,easing:i};return Object.keys(o).forEach(function(t){s.includes(t)&&(a[t]=e[t])}),a}),a+=h.generateCSSText("a"+c++,i,e,t.effect.getComputedTiming()))}),l.textContent+=a+u)}),r=document.implementation.createDocumentType("svg","-//W3C//DTD SVG 1.1//EN","http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"),(r=document.implementation.createDocument("http://www.w3.org/2000/svg","svg",r)).replaceChild(n,r.documentElement),t.abrupt("return","data:image/svg+xml;charset=utf8,"+encodeURIComponent((new XMLSerializer).serializeToString(r)));case 10:case"end":return t.stop()}},t,this)}));return function(t){return e.apply(this,arguments)}}(),t}(),Ld=function(i){function t(){for(var t,e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];return(t=i.call.apply(i,[this].concat(n))||this).name="svg-context-register",t}Ad(t,i);var e=t.prototype;return e.init=function(){this.context.ContextService=Id},e.destroy=function(){delete this.context.ContextService},t}(Ws),kd=function(n){function t(t){var e;return(e=n.call(this,t=void 0===t?{}:t)||this).registerPlugin(new Ld),e.registerPlugin(new xd({outputSVGElementId:t.outputSVGElementId})),e.registerPlugin(new hh),e.registerPlugin(new Gh),e}return Ad(t,n),t}(Gs),Dd=(j(function(e){e=function(a){var l,t=Object.prototype,u=t.hasOwnProperty,c=Object.defineProperty||function(t,e,n){t[e]=n.value},e="function"==typeof Symbol?Symbol:{},r=e.iterator||"@@iterator",n=e.asyncIterator||"@@asyncIterator",i=e.toStringTag||"@@toStringTag";function o(t,e,n){return Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{o({},"")}catch(t){o=function(t,e,n){return t[e]=n}}function s(t,e,n,r){var i,o,a,s,e=e&&e.prototype instanceof v?e:v,e=Object.create(e.prototype),r=new A(r||[]);return c(e,"_invoke",{value:(i=t,o=n,a=r,s=d,function(t,e){if(s===p)throw new Error("Generator is already running");if(s===g){if("throw"===t)throw e;return R()}for(a.method=t,a.arg=e;;){var n=a.delegate;if(n){n=function t(e,n){var r=n.method;var i=e.iterator[r];if(i===l)return n.delegate=null,"throw"===r&&e.iterator.return&&(n.method="return",n.arg=l,t(e,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),m;r=h(i,e.iterator,n.arg);if("throw"===r.type)return n.method="throw",n.arg=r.arg,n.delegate=null,m;i=r.arg;if(!i)return n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,m;{if(!i.done)return i;n[e.resultName]=i.value,n.next=e.nextLoc,"return"!==n.method&&(n.method="next",n.arg=l)}n.delegate=null;return m}(n,a);if(n){if(n===m)continue;return n}}if("next"===a.method)a.sent=a._sent=a.arg;else if("throw"===a.method){if(s===d)throw s=g,a.arg;a.dispatchException(a.arg)}else"return"===a.method&&a.abrupt("return",a.arg);s=p;n=h(i,o,a);if("normal"===n.type){if(s=a.done?g:f,n.arg!==m)return{value:n.arg,done:a.done}}else"throw"===n.type&&(s=g,a.method="throw",a.arg=n.arg)}})}),e}function h(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(t){return{type:"throw",arg:t}}}a.wrap=s;var d="suspendedStart",f="suspendedYield",p="executing",g="completed",m={};function v(){}function y(){}function E(){}var e={},_=(o(e,r,function(){return this}),Object.getPrototypeOf),_=_&&_(_(M([]))),b=(_&&_!==t&&u.call(_,r)&&(e=_),E.prototype=v.prototype=Object.create(e));function x(t){["next","throw","return"].forEach(function(e){o(t,e,function(t){return this._invoke(e,t)})})}function S(a,s){var e;c(this,"_invoke",{value:function(n,r){function t(){return new s(function(t,e){!function e(t,n,r,i){var o,t=h(a[t],a,n);if("throw"!==t.type)return(n=(o=t.arg).value)&&"object"==typeof n&&u.call(n,"__await")?s.resolve(n.__await).then(function(t){e("next",t,r,i)},function(t){e("throw",t,r,i)}):s.resolve(n).then(function(t){o.value=t,r(o)},function(t){return e("throw",t,r,i)});i(t.arg)}(n,r,t,e)})}return e=e?e.then(t,t):t()}})}function w(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function T(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function A(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(w,this),this.reset(!0)}function M(e){if(e){var n,t=e[r];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length))return n=-1,(t=function t(){for(;++n<e.length;)if(u.call(e,n))return t.value=e[n],t.done=!1,t;return t.value=l,t.done=!0,t}).next=t}return{next:R}}function R(){return{value:l,done:!0}}return c(b,"constructor",{value:y.prototype=E,configurable:!0}),c(E,"constructor",{value:y,configurable:!0}),y.displayName=o(E,i,"GeneratorFunction"),a.isGeneratorFunction=function(t){t="function"==typeof t&&t.constructor;return!!t&&(t===y||"GeneratorFunction"===(t.displayName||t.name))},a.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,E):(t.__proto__=E,o(t,i,"GeneratorFunction")),t.prototype=Object.create(b),t},a.awrap=function(t){return{__await:t}},x(S.prototype),o(S.prototype,n,function(){return this}),a.AsyncIterator=S,a.async=function(t,e,n,r,i){void 0===i&&(i=Promise);var o=new S(s(t,e,n,r),i);return a.isGeneratorFunction(e)?o:o.next().then(function(t){return t.done?t.value:o.next()})},x(b),o(b,i,"Generator"),o(b,r,function(){return this}),o(b,"toString",function(){return"[object Generator]"}),a.keys=function(t){var e,n=Object(t),r=[];for(e in n)r.push(e);return r.reverse(),function t(){for(;r.length;){var e=r.pop();if(e in n)return t.value=e,t.done=!1,t}return t.done=!0,t}},a.values=M,A.prototype={constructor:A,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=l,this.done=!1,this.delegate=null,this.method="next",this.arg=l,this.tryEntries.forEach(T),!t)for(var e in this)"t"===e.charAt(0)&&u.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=l)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(n){if(this.done)throw n;var r=this;function t(t,e){return o.type="throw",o.arg=n,r.next=t,e&&(r.method="next",r.arg=l),!!e}for(var e=this.tryEntries.length-1;0<=e;--e){var i=this.tryEntries[e],o=i.completion;if("root"===i.tryLoc)return t("end");if(i.tryLoc<=this.prev){var a=u.call(i,"catchLoc"),s=u.call(i,"finallyLoc");if(a&&s){if(this.prev<i.catchLoc)return t(i.catchLoc,!0);if(this.prev<i.finallyLoc)return t(i.finallyLoc)}else if(a){if(this.prev<i.catchLoc)return t(i.catchLoc,!0)}else{if(!s)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return t(i.finallyLoc)}}}},abrupt:function(t,e){for(var n=this.tryEntries.length-1;0<=n;--n){var r=this.tryEntries[n];if(r.tryLoc<=this.prev&&u.call(r,"finallyLoc")&&this.prev<r.finallyLoc){var i=r;break}}var o=(i=i&&("break"===t||"continue"===t)&&i.tryLoc<=e&&e<=i.finallyLoc?null:i)?i.completion:{};return o.type=t,o.arg=e,i?(this.method="next",this.next=i.finallyLoc,m):this.complete(o)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),m},finish:function(t){for(var e=this.tryEntries.length-1;0<=e;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),T(n),m}},catch:function(t){for(var e=this.tryEntries.length-1;0<=e;--e){var n,r,i=this.tryEntries[e];if(i.tryLoc===t)return"throw"===(n=i.completion).type&&(r=n.arg,T(i)),r}throw new Error("illegal catch attempt")},delegateYield:function(t,e,n){return this.delegate={iterator:M(t),resultName:e,nextLoc:n},"next"===this.method&&(this.arg=l),m}},a}(e.exports);try{regeneratorRuntime=e}catch(t){"object"==typeof globalThis?globalThis.regeneratorRuntime=e:Function("r","regeneratorRuntime = r")(e)}}),Bd),pa=Bd;function Bd(t,e,n){n=n||2;var r,i,o,a,s,l=e&&e.length,u=l?e[0]*n:t.length,c=Fd(t,0,u,n,!0),h=[];if(c&&c.next!==c.prev){if(l&&(c=function(t,e,n,r){var i,o,a,s,l=[];for(i=0,o=e.length;i<o;i++)s=e[i]*r,a=i<o-1?e[i+1]*r:t.length,(s=Fd(t,s,a,r,!1))===s.next&&(s.steiner=!0),l.push(function(t){var e=t,n=t;for(;(e.x<n.x||e.x===n.x&&e.y<n.y)&&(n=e),e=e.next,e!==t;);return n}(s));for(l.sort(Wd),i=0;i<l.length;i++)n=function(t,e){var n=function(t,e){var n,r=e,i=t.x,o=t.y,a=-1/0;do{if(o<=r.y&&o>=r.next.y&&r.next.y!==r.y){var s=r.x+(o-r.y)*(r.next.x-r.x)/(r.next.y-r.y);if(s<=i&&a<s&&(a=s,n=r.x<r.next.x?r:r.next,s===i))return n}}while(r=r.next,r!==e);if(!n)return null;var l,u=n,c=n.x,h=n.y,d=1/0;r=n;for(;i>=r.x&&r.x>=c&&i!==r.x&&jd(o<h?i:a,o,c,h,o<h?a:i,o,r.x,r.y)&&(l=Math.abs(o-r.y)/(i-r.x),qd(r,t))&&(l<d||l===d&&(r.x>n.x||r.x===n.x&&function(t,e){return zd(t.prev,t,e.prev)<0&&zd(e.next,t,t.next)<0}(n,r)))&&(n=r,d=l),r=r.next,r!==u;);return n}(t,e);return n?(Ud(t=$d(n,t),t.next),Ud(n,n.next)):e}(l[i],n);return n}(t,e,c,n)),t.length>80*n){for(var d=r=t[0],f=i=t[1],p=n;p<u;p+=n)(o=t[p])<d&&(d=o),(a=t[p+1])<f&&(f=a),r<o&&(r=o),i<a&&(i=a);s=0!==(s=Math.max(r-d,i-f))?32767/s:0}Gd(c,h,n,d,f,s,0)}return h}function Fd(t,e,n,r,i){var o,a;if(i===0<tf(t,e,n,r))for(o=e;o<n;o+=r)a=Zd(o,t[o],t[o+1],a);else for(o=n-r;e<=o;o-=r)a=Zd(o,t[o],t[o+1],a);return a&&Hd(a,a.next)&&(Qd(a),a=a.next),a}function Ud(t,e){if(!t)return t;e=e||t;var n,r=t;do{if(n=!1,r.steiner||!Hd(r,r.next)&&0!==zd(r.prev,r,r.next))r=r.next;else{if(Qd(r),(r=e=r.prev)===r.next)break;n=!0}}while(n||r!==e);return e}function Gd(t,e,n,r,i,o,a){if(t){if(!a&&o){for(var s=t,l=r,u=i,c=o,h=s;0===h.z&&(h.z=Vd(h.x,h.y,l,u,c)),h.prevZ=h.prev,h.nextZ=h.next,(h=h.next)!==s;);h.prevZ.nextZ=null,h.prevZ=null;var d,f,p,g,m,v,y,E,_=h,b=1;do{for(f=_,m=_=null,v=0;f;){for(v++,p=f,d=y=0;d<b&&(y++,p=p.nextZ);d++);for(E=b;0<y||0<E&&p;)0!==y&&(0===E||!p||f.z<=p.z)?(f=(g=f).nextZ,y--):(p=(g=p).nextZ,E--),m?m.nextZ=g:_=g,g.prevZ=m,m=g;f=p}}while(m.nextZ=null,b*=2,1<v)}for(var x,S,w=t;t.prev!==t.next;)if(x=t.prev,S=t.next,o?function(t,e,n,r){var i=t.prev,o=t,a=t.next;if(0<=zd(i,o,a))return;var s=i.x,l=o.x,u=a.x,c=i.y,h=o.y,d=a.y,f=s<l?s<u?s:u:l<u?l:u,p=c<h?c<d?c:d:h<d?h:d,g=l<s?u<s?s:u:u<l?l:u,m=h<c?d<c?c:d:d<h?h:d,v=Vd(f,p,e,n,r),y=Vd(g,m,e,n,r),E=t.prevZ,_=t.nextZ;for(;E&&E.z>=v&&_&&_.z<=y;){if(E.x>=f&&E.x<=g&&E.y>=p&&E.y<=m&&E!==i&&E!==a&&jd(s,c,l,h,u,d,E.x,E.y)&&0<=zd(E.prev,E,E.next))return;if(E=E.prevZ,_.x>=f&&_.x<=g&&_.y>=p&&_.y<=m&&_!==i&&_!==a&&jd(s,c,l,h,u,d,_.x,_.y)&&0<=zd(_.prev,_,_.next))return;_=_.nextZ}for(;E&&E.z>=v;){if(E.x>=f&&E.x<=g&&E.y>=p&&E.y<=m&&E!==i&&E!==a&&jd(s,c,l,h,u,d,E.x,E.y)&&0<=zd(E.prev,E,E.next))return;E=E.prevZ}for(;_&&_.z<=y;){if(_.x>=f&&_.x<=g&&_.y>=p&&_.y<=m&&_!==i&&_!==a&&jd(s,c,l,h,u,d,_.x,_.y)&&0<=zd(_.prev,_,_.next))return;_=_.nextZ}return 1}(t,r,i,o):function(t){var e=t.prev,n=t,t=t.next;if(0<=zd(e,n,t))return;var r=e.x,i=n.x,o=t.x,a=e.y,s=n.y,l=t.y,u=r<i?r<o?r:o:i<o?i:o,c=a<s?a<l?a:l:s<l?s:l,h=i<r?o<r?r:o:o<i?i:o,d=s<a?l<a?a:l:l<s?s:l,f=t.next;for(;f!==e;){if(f.x>=u&&f.x<=h&&f.y>=c&&f.y<=d&&jd(r,a,i,s,o,l,f.x,f.y)&&0<=zd(f.prev,f,f.next))return;f=f.next}return 1}(t))e.push(x.i/n|0),e.push(t.i/n|0),e.push(S.i/n|0),Qd(t),t=S.next,w=S.next;else if((t=S)===w){a?1===a?Gd(t=function(t,e,n){var r=t;do{var i=r.prev,o=r.next.next}while(!Hd(i,o)&&Xd(i,r,r.next,o)&&qd(i,o)&&qd(o,i)&&(e.push(i.i/n|0),e.push(r.i/n|0),e.push(o.i/n|0),Qd(r),Qd(r.next),r=t=o),r=r.next,r!==t);return Ud(r)}(Ud(t),e,n),e,n,r,i,o,2):2===a&&function(t,e,n,r,i,o){var a=t;do{for(var s,l=a.next.next;l!==a.prev;){if(a.i!==l.i&&function(t,e){return t.next.i!==e.i&&t.prev.i!==e.i&&!function(t,e){var n=t;do{if(n.i!==t.i&&n.next.i!==t.i&&n.i!==e.i&&n.next.i!==e.i&&Xd(n,n.next,t,e))return 1}while(n=n.next,n!==t);return}(t,e)&&(qd(t,e)&&qd(e,t)&&function(t,e){var n=t,r=!1,i=(t.x+e.x)/2,o=(t.y+e.y)/2;for(;n.y>o!=n.next.y>o&&n.next.y!==n.y&&i<(n.next.x-n.x)*(o-n.y)/(n.next.y-n.y)+n.x&&(r=!r),n=n.next,n!==t;);return r}(t,e)&&(zd(t.prev,t,e.prev)||zd(t,e.prev,e))||Hd(t,e)&&0<zd(t.prev,t,t.next)&&0<zd(e.prev,e,e.next))}(a,l))return s=$d(a,l),a=Ud(a,a.next),s=Ud(s,s.next),Gd(a,e,n,r,i,o,0),Gd(s,e,n,r,i,o,0);l=l.next}}while(a=a.next,a!==t)}(t,e,n,r,i,o):Gd(Ud(t),e,n,r,i,o,1);break}}}function Wd(t,e){return t.x-e.x}function Vd(t,e,n,r,i){return(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=(t-n)*i|0)|t<<8))|t<<4))|t<<2))|t<<1))|(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=(e-r)*i|0)|e<<8))|e<<4))|e<<2))|e<<1))<<1}function jd(t,e,n,r,i,o,a,s){return(t-a)*(o-s)<=(i-a)*(e-s)&&(n-a)*(e-s)<=(t-a)*(r-s)&&(i-a)*(r-s)<=(n-a)*(o-s)}function zd(t,e,n){return(e.y-t.y)*(n.x-e.x)-(e.x-t.x)*(n.y-e.y)}function Hd(t,e){return t.x===e.x&&t.y===e.y}function Xd(t,e,n,r){var i=Kd(zd(t,e,n)),o=Kd(zd(t,e,r)),a=Kd(zd(n,r,t)),s=Kd(zd(n,r,e));return i!==o&&a!==s||0===i&&Yd(t,n,e)||0===o&&Yd(t,r,e)||0===a&&Yd(n,t,r)||!(0!==s||!Yd(n,e,r))}function Yd(t,e,n){return e.x<=Math.max(t.x,n.x)&&e.x>=Math.min(t.x,n.x)&&e.y<=Math.max(t.y,n.y)&&e.y>=Math.min(t.y,n.y)}function Kd(t){return 0<t?1:t<0?-1:0}function qd(t,e){return zd(t.prev,t,t.next)<0?0<=zd(t,e,t.next)&&0<=zd(t,t.prev,e):zd(t,e,t.prev)<0||zd(t,t.next,e)<0}function $d(t,e){var n=new Jd(t.i,t.x,t.y),r=new Jd(e.i,e.x,e.y),i=t.next,o=e.prev;return(t.next=e).prev=t,(n.next=i).prev=n,(r.next=n).prev=r,(o.next=r).prev=o,r}function Zd(t,e,n,r){t=new Jd(t,e,n);return r?(t.next=r.next,(t.prev=r).next.prev=t,r.next=t):(t.prev=t).next=t,t}function Qd(t){t.next.prev=t.prev,t.prev.next=t.next,t.prevZ&&(t.prevZ.nextZ=t.nextZ),t.nextZ&&(t.nextZ.prevZ=t.prevZ)}function Jd(t,e,n){this.i=t,this.x=e,this.y=n,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}function tf(t,e,n,r){for(var i=0,o=e,a=n-r;o<n;o+=r)i+=(t[a]-t[o])*(t[o+1]+t[a+1]),a=o;return i}function ef(){ef=function(){return a};var a={},t=Object.prototype,l=t.hasOwnProperty,u=Object.defineProperty||function(t,e,n){t[e]=n.value},e="function"==typeof Symbol?Symbol:{},r=e.iterator||"@@iterator",n=e.asyncIterator||"@@asyncIterator",i=e.toStringTag||"@@toStringTag";function o(t,e,n){return Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{o({},"")}catch(t){o=function(t,e,n){return t[e]=n}}function s(t,e,n,r){var i,o,a,s,e=e&&e.prototype instanceof d?e:d,e=Object.create(e.prototype),r=new b(r||[]);return u(e,"_invoke",{value:(i=t,o=n,a=r,s="suspendedStart",function(t,e){if("executing"===s)throw new Error("Generator is already running");if("completed"===s){if("throw"===t)throw e;return S()}for(a.method=t,a.arg=e;;){var n=a.delegate;if(n){n=function t(e,n){var r=n.method,i=e.iterator[r];if(void 0===i)return n.delegate=null,"throw"===r&&e.iterator.return&&(n.method="return",n.arg=void 0,t(e,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),h;r=c(i,e.iterator,n.arg);if("throw"===r.type)return n.method="throw",n.arg=r.arg,n.delegate=null,h;i=r.arg;return i?i.done?(n[e.resultName]=i.value,n.next=e.nextLoc,"return"!==n.method&&(n.method="next",n.arg=void 0),n.delegate=null,h):i:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,h)}(n,a);if(n){if(n===h)continue;return n}}if("next"===a.method)a.sent=a._sent=a.arg;else if("throw"===a.method){if("suspendedStart"===s)throw s="completed",a.arg;a.dispatchException(a.arg)}else"return"===a.method&&a.abrupt("return",a.arg);s="executing";n=c(i,o,a);if("normal"===n.type){if(s=a.done?"completed":"suspendedYield",n.arg===h)continue;return{value:n.arg,done:a.done}}"throw"===n.type&&(s="completed",a.method="throw",a.arg=n.arg)}})}),e}function c(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(t){return{type:"throw",arg:t}}}a.wrap=s;var h={};function d(){}function f(){}function p(){}var e={},g=(o(e,r,function(){return this}),Object.getPrototypeOf),g=g&&g(g(x([]))),m=(g&&g!==t&&l.call(g,r)&&(e=g),p.prototype=d.prototype=Object.create(e));function v(t){["next","throw","return"].forEach(function(e){o(t,e,function(t){return this._invoke(e,t)})})}function y(a,s){var e;u(this,"_invoke",{value:function(n,r){function t(){return new s(function(t,e){!function e(t,n,r,i){var o,t=c(a[t],a,n);if("throw"!==t.type)return(n=(o=t.arg).value)&&"object"==typeof n&&l.call(n,"__await")?s.resolve(n.__await).then(function(t){e("next",t,r,i)},function(t){e("throw",t,r,i)}):s.resolve(n).then(function(t){o.value=t,r(o)},function(t){return e("throw",t,r,i)});i(t.arg)}(n,r,t,e)})}return e=e?e.then(t,t):t()}})}function E(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function _(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function b(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(E,this),this.reset(!0)}function x(e){if(e){var n,t=e[r];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length))return n=-1,(t=function t(){for(;++n<e.length;)if(l.call(e,n))return t.value=e[n],t.done=!1,t;return t.value=void 0,t.done=!0,t}).next=t}return{next:S}}function S(){return{value:void 0,done:!0}}return u(m,"constructor",{value:f.prototype=p,configurable:!0}),u(p,"constructor",{value:f,configurable:!0}),f.displayName=o(p,i,"GeneratorFunction"),a.isGeneratorFunction=function(t){t="function"==typeof t&&t.constructor;return!!t&&(t===f||"GeneratorFunction"===(t.displayName||t.name))},a.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,p):(t.__proto__=p,o(t,i,"GeneratorFunction")),t.prototype=Object.create(m),t},a.awrap=function(t){return{__await:t}},v(y.prototype),o(y.prototype,n,function(){return this}),a.AsyncIterator=y,a.async=function(t,e,n,r,i){void 0===i&&(i=Promise);var o=new y(s(t,e,n,r),i);return a.isGeneratorFunction(e)?o:o.next().then(function(t){return t.done?t.value:o.next()})},v(m),o(m,i,"Generator"),o(m,r,function(){return this}),o(m,"toString",function(){return"[object Generator]"}),a.keys=function(t){var e,n=Object(t),r=[];for(e in n)r.push(e);return r.reverse(),function t(){for(;r.length;){var e=r.pop();if(e in n)return t.value=e,t.done=!1,t}return t.done=!0,t}},a.values=x,b.prototype={constructor:b,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(_),!t)for(var e in this)"t"===e.charAt(0)&&l.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=void 0)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(n){if(this.done)throw n;var r=this;function t(t,e){return o.type="throw",o.arg=n,r.next=t,e&&(r.method="next",r.arg=void 0),!!e}for(var e=this.tryEntries.length-1;0<=e;--e){var i=this.tryEntries[e],o=i.completion;if("root"===i.tryLoc)return t("end");if(i.tryLoc<=this.prev){var a=l.call(i,"catchLoc"),s=l.call(i,"finallyLoc");if(a&&s){if(this.prev<i.catchLoc)return t(i.catchLoc,!0);if(this.prev<i.finallyLoc)return t(i.finallyLoc)}else if(a){if(this.prev<i.catchLoc)return t(i.catchLoc,!0)}else{if(!s)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return t(i.finallyLoc)}}}},abrupt:function(t,e){for(var n=this.tryEntries.length-1;0<=n;--n){var r=this.tryEntries[n];if(r.tryLoc<=this.prev&&l.call(r,"finallyLoc")&&this.prev<r.finallyLoc){var i=r;break}}var o=(i=i&&("break"===t||"continue"===t)&&i.tryLoc<=e&&e<=i.finallyLoc?null:i)?i.completion:{};return o.type=t,o.arg=e,i?(this.method="next",this.next=i.finallyLoc,h):this.complete(o)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),h},finish:function(t){for(var e=this.tryEntries.length-1;0<=e;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),_(n),h}},catch:function(t){for(var e=this.tryEntries.length-1;0<=e;--e){var n,r,i=this.tryEntries[e];if(i.tryLoc===t)return"throw"===(n=i.completion).type&&(r=n.arg,_(i)),r}throw new Error("illegal catch attempt")},delegateYield:function(t,e,n){return this.delegate={iterator:x(t),resultName:e,nextLoc:n},"next"===this.method&&(this.arg=void 0),h}},a}function nf(t,e,n,r,i,o,a){try{var s=t[o](a),l=s.value}catch(t){return void n(t)}s.done?e(l):Promise.resolve(l).then(r,i)}function rf(s){return function(){var t=this,a=arguments;return new Promise(function(e,n){var r=s.apply(t,a);function i(t){nf(r,e,n,i,o,"next",t)}function o(t){nf(r,e,n,i,o,"throw",t)}i(void 0)})}}function of(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,function(t){t=function(t,e){if("object"!=typeof t||null===t)return t;var n=t[Symbol.toPrimitive];if(void 0===n)return("string"===e?String:Number)(t);n=n.call(t,e||"default");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}(t,"string");return"symbol"==typeof t?t:String(t)}(r.key),r)}}function af(t,e,n){e&&of(t.prototype,e),n&&of(t,n),Object.defineProperty(t,"prototype",{writable:!1})}function sf(){return(sf=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n,r=arguments[e];for(n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t}).apply(this,arguments)}function lf(t,e){t.prototype=Object.create(e.prototype),uf(t.prototype.constructor=t,e)}function uf(t,e){return(uf=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t})(t,e)}function cf(t,e){if(null==t)return{};for(var n,r={},i=Object.keys(t),o=0;o<i.length;o++)n=i[o],0<=e.indexOf(n)||(r[n]=t[n]);return r}function hf(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function df(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}function ff(t,e){var n,r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(r)return(r=r.call(t)).next.bind(r);if(Array.isArray(t)||(r=function(t,e){var n;if(t)return"string"==typeof t?df(t,e):"Map"===(n="Object"===(n=Object.prototype.toString.call(t).slice(8,-1))&&t.constructor?t.constructor.name:n)||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?df(t,e):void 0}(t))||e&&t&&"number"==typeof t.length)return r&&(t=r),n=0,function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}};throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}Bd.deviation=function(t,e,n,r){var i=e&&e.length,o=i?e[0]*n:t.length,a=Math.abs(tf(t,0,o,n));if(i)for(var s=0,l=e.length;s<l;s++){var u=e[s]*n,c=s<l-1?e[s+1]*n:t.length;a-=Math.abs(tf(t,u,c,n))}for(var h=0,s=0;s<r.length;s+=3){var d=r[s]*n,f=r[s+1]*n,p=r[s+2]*n;h+=Math.abs((t[d]-t[p])*(t[1+f]-t[1+d])-(t[d]-t[f])*(t[1+p]-t[1+d]))}return 0===a&&0===h?0:Math.abs((h-a)/a)},Bd.flatten=function(t){for(var e=t[0][0].length,n={vertices:[],holes:[],dimensions:e},r=0,i=0;i<t.length;i++){for(var o=0;o<t[i].length;o++)for(var a=0;a<e;a++)n.vertices.push(t[i][o][a]);0<i&&(r+=t[i-1].length,n.holes.push(r))}return n},Dd.default=pa;function pf(){this.pickingId=void 0,this.encodedPickingColor=void 0,this.meshes=[]}pf.tag="c-renderable-3d";var gf,mf,vf,yf,Ef,_f,bf,xf,Sf,wf,Tf,Af,Mf,Rf,Nf,Cf,Pf,Of,If,Lf,kf,u,c,h,S,w,Df=function(){function t(){this.lights=[],this.fog=void 0}var e=t.prototype;return e.addLight=function(t){this.lights.push(t),this.sortLights()},e.removeLight=function(t){t=this.lights.indexOf(t);this.lights.splice(t,1),this.sortLights()},e.addFog=function(t){this.fog=t},e.removeFog=function(t){this.fog=null},e.getFog=function(){return this.fog},e.getAllLights=function(){return this.lights},e.getDefines=function(){var e={USE_LIGHT:!!this.lights.length};return this.lights.forEach(function(t){e[t.define]||(e[t.define]=0),e[t.define]++}),e},e.sortLights=function(){this.lights.sort(function(t,e){return t.order-e.order})},t}(),Bf=["style"],Ff=function(n){function t(t){var e=t.style,t=cf(t,Bf),e=n.call(this,sf({type:lt.MESH,style:sf({x:"",y:"",z:"",lineWidth:0,anchor:[.5,.5,.5]},e)},t))||this;return e.cullable.enable=!1,e.style.geometry.meshes.push(hf(e)),e.style.material.meshes.push(hf(e)),e}return lf(t,n),t.prototype.destroy=function(){n.prototype.destroy.call(this);var t=this.style.geometry.meshes,e=t.indexOf(this);t.splice(e,1),e=(t=this.style.material.meshes).indexOf(this),t.splice(e,1)},t}(as),Uf=function(){function t(){}return t.prototype.update=function(t){var t=t.geometry.computeBoundingBox(),e=t.getMax(),t=t.getMin();return{width:e[0]-t[0],height:e[1]-t[1],depth:e[2]-t[2]}},t}(),Gf=function(){function t(){this.counter=0,this.id2DisplayObjectMap={}}var e=t.prototype;return e.getId=function(t){var e=this.counter++;return this.id2DisplayObjectMap[e]=t,e},e.getById=function(t){return this.id2DisplayObjectMap[t]},e.reset=function(){this.counter=0,this.id2DisplayObjectMap={}},e.decodePickingColor=function(t){return t[0]+256*t[1]+65536*t[2]-1},e.encodePickingColor=function(t){return[t+1&255,t+1>>8&255,t+1>>8>>8&255]},t}();function Wf(t,e,n,r){return{dimension:Rf.n2D,pixelFormat:t,width:e,height:n,depth:1,numLevels:r,usage:Nf.Sampled}}function g(t,e,n){return t<<16|e<<8|n}function Vf(t){return t>>>8&255}function jf(t){return t>>>16&255}function zf(t){switch(jf(t)){case u.F32:case u.U32:case u.S32:return 4;case u.U16:case u.S16:case u.F16:return 2;case u.U8:case u.S8:return 1;default:throw new Error("whoops")}}function T(t,e){if(void 0===e&&(e=""),!t)throw console.error((new Error).stack),new Error("Assert fail: "+e)}function Hf(t){if(null!=t)return t;throw new Error("Missing object")}function Xf(t,e){return t.r===e.r&&t.g===e.g&&t.b===e.b&&t.a===e.a}function Yf(t,e){t.r=e.r,t.g=e.g,t.b=e.b,t.a=e.a}function Kf(t){return{r:t.r,g:t.g,b:t.b,a:t.a}}function qf(t,e,n,r){return{r:t,g:e,b:n,a:r=void 0===r?1:r}}(l=gf=gf||{})[l.Buffer=0]="Buffer",l[l.Texture=1]="Texture",l[l.RenderTarget=2]="RenderTarget",l[l.Sampler=3]="Sampler",l[l.Program=4]="Program",l[l.Bindings=5]="Bindings",l[l.InputLayout=6]="InputLayout",l[l.InputState=7]="InputState",l[l.RenderPipeline=8]="RenderPipeline",l[l.ComputePipeline=9]="ComputePipeline",l[l.Readback=10]="Readback",l[l.QueryPool=11]="QueryPool",(Ea=mf=mf||{})[Ea.Never=512]="Never",Ea[Ea.Less=513]="Less",Ea[Ea.Equal=514]="Equal",Ea[Ea.LessEqual=515]="LessEqual",Ea[Ea.Greater=516]="Greater",Ea[Ea.NotEqual=517]="NotEqual",Ea[Ea.GreaterEqual=518]="GreaterEqual",Ea[Ea.Always=519]="Always",(_a=mT=mT||{})[_a.CCW=2305]="CCW",_a[_a.CW=2304]="CW",(ba=vf=vf||{})[ba.None=0]="None",ba[ba.Front=1]="Front",ba[ba.Back=2]="Back",ba[ba.FrontAndBack=3]="FrontAndBack",(r=yf=yf||{})[r.Zero=0]="Zero",r[r.One=1]="One",r[r.Src=768]="Src",r[r.OneMinusSrc=769]="OneMinusSrc",r[r.Dst=774]="Dst",r[r.OneMinusDst=775]="OneMinusDst",r[r.SrcAlpha=770]="SrcAlpha",r[r.OneMinusSrcAlpha=771]="OneMinusSrcAlpha",r[r.DstAlpha=772]="DstAlpha",r[r.OneMinusDstAlpha=773]="OneMinusDstAlpha",(wa=Ef=Ef||{})[wa.Add=32774]="Add",wa[wa.Subtract=32778]="Subtract",wa[wa.ReverseSubtract=32779]="ReverseSubtract",(Ca=_f=_f||{})[Ca.Clamp=0]="Clamp",Ca[Ca.Repeat=1]="Repeat",Ca[Ca.Mirror=2]="Mirror",(Pa=bf=bf||{})[Pa.Point=0]="Point",Pa[Pa.Bilinear=1]="Bilinear",(Oa=xf=xf||{})[Oa.NoMip=0]="NoMip",Oa[Oa.Nearest=1]="Nearest",Oa[Oa.Linear=2]="Linear",(Ia=Sf=Sf||{})[Ia.Points=0]="Points",Ia[Ia.Triangles=1]="Triangles",Ia[Ia.TriangleStrip=2]="TriangleStrip",Ia[Ia.Lines=3]="Lines",Ia[Ia.LineStrip=4]="LineStrip",(La=wf=wf||{})[La.MAP_READ=1]="MAP_READ",La[La.MAP_WRITE=2]="MAP_WRITE",La[La.COPY_SRC=4]="COPY_SRC",La[La.COPY_DST=8]="COPY_DST",La[La.INDEX=16]="INDEX",La[La.VERTEX=32]="VERTEX",La[La.UNIFORM=64]="UNIFORM",La[La.STORAGE=128]="STORAGE",La[La.INDIRECT=256]="INDIRECT",La[La.QUERY_RESOLVE=512]="QUERY_RESOLVE",(ka=Tf=Tf||{})[ka.Static=1]="Static",ka[ka.Dynamic=2]="Dynamic",(Da=Af=Af||{})[Da.PerVertex=1]="PerVertex",Da[Da.PerInstance=2]="PerInstance",(Mf=Mf||{}).LOADED="loaded",(b=Rf=Rf||{})[b.n2D=0]="n2D",b[b.n2DArray=1]="n2DArray",b[b.n3D=2]="n3D",b[b.Cube=3]="Cube",(xa=Nf=Nf||{})[xa.Sampled=1]="Sampled",xa[xa.RenderTarget=2]="RenderTarget",(a=Cf=Cf||{})[a.None=0]="None",a[a.Red=1]="Red",a[a.Green=2]="Green",a[a.Blue=4]="Blue",a[a.Alpha=8]="Alpha",a[a.RGB=7]="RGB",a[a.AllChannels=15]="AllChannels",(zs=Pf=Pf||{})[zs.Keep=7680]="Keep",zs[zs.Zero=0]="Zero",zs[zs.Replace=7681]="Replace",zs[zs.Invert=5386]="Invert",zs[zs.IncrementClamp=7682]="IncrementClamp",zs[zs.DecrementClamp=7683]="DecrementClamp",zs[zs.IncrementWrap=34055]="IncrementWrap",zs[zs.DecrementWrap=34056]="DecrementWrap",(Ys=Of=Of||{})[Ys.Float=0]="Float",Ys[Ys.Uint=1]="Uint",Ys[Ys.Sint=2]="Sint",Ys[Ys.Depth=3]="Depth",(Zs=If=If||{})[Zs.LowerLeft=0]="LowerLeft",Zs[Zs.UpperLeft=1]="UpperLeft",(nl=Lf=Lf||{})[nl.NegativeOne=0]="NegativeOne",nl[nl.Zero=1]="Zero",kf=kf||{},kf[kf.OcclusionConservative=0]="OcclusionConservative",(o=u=u||{})[o.U8=1]="U8",o[o.U16=2]="U16",o[o.U32=3]="U32",o[o.S8=4]="S8",o[o.S16=5]="S16",o[o.S32=6]="S32",o[o.F16=7]="F16",o[o.F32=8]="F32",o[o.BC1=65]="BC1",o[o.BC2=66]="BC2",o[o.BC3=67]="BC3",o[o.BC4_UNORM=68]="BC4_UNORM",o[o.BC4_SNORM=69]="BC4_SNORM",o[o.BC5_UNORM=70]="BC5_UNORM",o[o.BC5_SNORM=71]="BC5_SNORM",o[o.U16_PACKED_5551=97]="U16_PACKED_5551",o[o.D24=129]="D24",o[o.D32F=130]="D32F",o[o.D24S8=131]="D24S8",o[o.D32FS8=132]="D32FS8",(Vs=c=c||{})[Vs.R=1]="R",Vs[Vs.RG=2]="RG",Vs[Vs.RGB=3]="RGB",Vs[Vs.RGBA=4]="RGBA",Vs[Vs.A=5]="A",(ks=h=h||{})[ks.None=0]="None",ks[ks.Normalized=1]="Normalized",ks[ks.sRGB=2]="sRGB",ks[ks.Depth=4]="Depth",ks[ks.Stencil=8]="Stencil",ks[ks.RenderTarget=16]="RenderTarget",(E=S=S||{})[E.ALPHA=g(u.U8,c.A,h.None)]="ALPHA",E[E.F16_R=g(u.F16,c.R,h.None)]="F16_R",E[E.F16_RG=g(u.F16,c.RG,h.None)]="F16_RG",E[E.F16_RGB=g(u.F16,c.RGB,h.None)]="F16_RGB",E[E.F16_RGBA=g(u.F16,c.RGBA,h.None)]="F16_RGBA",E[E.F32_R=g(u.F32,c.R,h.None)]="F32_R",E[E.F32_RG=g(u.F32,c.RG,h.None)]="F32_RG",E[E.F32_RGB=g(u.F32,c.RGB,h.None)]="F32_RGB",E[E.F32_RGBA=g(u.F32,c.RGBA,h.None)]="F32_RGBA",E[E.U8_R=g(u.U8,c.R,h.None)]="U8_R",E[E.U8_R_NORM=g(u.U8,c.R,h.Normalized)]="U8_R_NORM",E[E.U8_RG=g(u.U8,c.RG,h.None)]="U8_RG",E[E.U8_RG_NORM=g(u.U8,c.RG,h.Normalized)]="U8_RG_NORM",E[E.U8_RGB=g(u.U8,c.RGB,h.None)]="U8_RGB",E[E.U8_RGB_NORM=g(u.U8,c.RGB,h.Normalized)]="U8_RGB_NORM",E[E.U8_RGB_SRGB=g(u.U8,c.RGB,h.sRGB|h.Normalized)]="U8_RGB_SRGB",E[E.U8_RGBA=g(u.U8,c.RGBA,h.None)]="U8_RGBA",E[E.U8_RGBA_NORM=g(u.U8,c.RGBA,h.Normalized)]="U8_RGBA_NORM",E[E.U8_RGBA_SRGB=g(u.U8,c.RGBA,h.sRGB|h.Normalized)]="U8_RGBA_SRGB",E[E.U16_R=g(u.U16,c.R,h.None)]="U16_R",E[E.U16_R_NORM=g(u.U16,c.R,h.Normalized)]="U16_R_NORM",E[E.U16_RG_NORM=g(u.U16,c.RG,h.Normalized)]="U16_RG_NORM",E[E.U16_RGBA_NORM=g(u.U16,c.RGBA,h.Normalized)]="U16_RGBA_NORM",E[E.U16_RGB=g(u.U16,c.RGB,h.None)]="U16_RGB",E[E.U32_R=g(u.U32,c.R,h.None)]="U32_R",E[E.U32_RG=g(u.U32,c.RG,h.None)]="U32_RG",E[E.S8_R=g(u.S8,c.R,h.None)]="S8_R",E[E.S8_R_NORM=g(u.S8,c.R,h.Normalized)]="S8_R_NORM",E[E.S8_RG_NORM=g(u.S8,c.RG,h.Normalized)]="S8_RG_NORM",E[E.S8_RGB_NORM=g(u.S8,c.RGB,h.Normalized)]="S8_RGB_NORM",E[E.S8_RGBA_NORM=g(u.S8,c.RGBA,h.Normalized)]="S8_RGBA_NORM",E[E.S16_R=g(u.S16,c.R,h.None)]="S16_R",E[E.S16_RG=g(u.S16,c.RG,h.None)]="S16_RG",E[E.S16_RG_NORM=g(u.S16,c.RG,h.Normalized)]="S16_RG_NORM",E[E.S16_RGB_NORM=g(u.S16,c.RGB,h.Normalized)]="S16_RGB_NORM",E[E.S16_RGBA=g(u.S16,c.RGBA,h.None)]="S16_RGBA",E[E.S16_RGBA_NORM=g(u.S16,c.RGBA,h.Normalized)]="S16_RGBA_NORM",E[E.S32_R=g(u.S32,c.R,h.None)]="S32_R",E[E.U16_RGBA_5551=g(u.U16_PACKED_5551,c.RGBA,h.Normalized)]="U16_RGBA_5551",E[E.BC1=g(u.BC1,c.RGBA,h.Normalized)]="BC1",E[E.BC1_SRGB=g(u.BC1,c.RGBA,h.Normalized|h.sRGB)]="BC1_SRGB",E[E.BC2=g(u.BC2,c.RGBA,h.Normalized)]="BC2",E[E.BC2_SRGB=g(u.BC2,c.RGBA,h.Normalized|h.sRGB)]="BC2_SRGB",E[E.BC3=g(u.BC3,c.RGBA,h.Normalized)]="BC3",E[E.BC3_SRGB=g(u.BC3,c.RGBA,h.Normalized|h.sRGB)]="BC3_SRGB",E[E.BC4_UNORM=g(u.BC4_UNORM,c.R,h.Normalized)]="BC4_UNORM",E[E.BC4_SNORM=g(u.BC4_SNORM,c.R,h.Normalized)]="BC4_SNORM",E[E.BC5_UNORM=g(u.BC5_UNORM,c.RG,h.Normalized)]="BC5_UNORM",E[E.BC5_SNORM=g(u.BC5_SNORM,c.RG,h.Normalized)]="BC5_SNORM",E[E.D24=g(u.D24,c.R,h.Depth)]="D24",E[E.D24_S8=g(u.D24S8,c.RG,h.Depth|h.Stencil)]="D24_S8",E[E.D32F=g(u.D32F,c.R,h.Depth)]="D32F",E[E.D32F_S8=g(u.D32FS8,c.RG,h.Depth|h.Stencil)]="D32F_S8",E[E.U8_RGB_RT=g(u.U8,c.RGB,h.RenderTarget|h.Normalized)]="U8_RGB_RT",E[E.U8_RGBA_RT=g(u.U8,c.RGBA,h.RenderTarget|h.Normalized)]="U8_RGBA_RT",E[E.U8_RGBA_RT_SRGB=g(u.U8,c.RGBA,h.RenderTarget|h.Normalized|h.sRGB)]="U8_RGBA_RT_SRGB",(i=w=w||{})[i.DEPTH_BUFFER_BIT=256]="DEPTH_BUFFER_BIT",i[i.STENCIL_BUFFER_BIT=1024]="STENCIL_BUFFER_BIT",i[i.COLOR_BUFFER_BIT=16384]="COLOR_BUFFER_BIT",i[i.POINTS=0]="POINTS",i[i.LINES=1]="LINES",i[i.LINE_LOOP=2]="LINE_LOOP",i[i.LINE_STRIP=3]="LINE_STRIP",i[i.TRIANGLES=4]="TRIANGLES",i[i.TRIANGLE_STRIP=5]="TRIANGLE_STRIP",i[i.TRIANGLE_FAN=6]="TRIANGLE_FAN",i[i.ZERO=0]="ZERO",i[i.ONE=1]="ONE",i[i.SRC_COLOR=768]="SRC_COLOR",i[i.ONE_MINUS_SRC_COLOR=769]="ONE_MINUS_SRC_COLOR",i[i.SRC_ALPHA=770]="SRC_ALPHA",i[i.ONE_MINUS_SRC_ALPHA=771]="ONE_MINUS_SRC_ALPHA",i[i.DST_ALPHA=772]="DST_ALPHA",i[i.ONE_MINUS_DST_ALPHA=773]="ONE_MINUS_DST_ALPHA",i[i.DST_COLOR=774]="DST_COLOR",i[i.ONE_MINUS_DST_COLOR=775]="ONE_MINUS_DST_COLOR",i[i.SRC_ALPHA_SATURATE=776]="SRC_ALPHA_SATURATE",i[i.CONSTANT_COLOR=32769]="CONSTANT_COLOR",i[i.ONE_MINUS_CONSTANT_COLOR=32770]="ONE_MINUS_CONSTANT_COLOR",i[i.CONSTANT_ALPHA=32771]="CONSTANT_ALPHA",i[i.ONE_MINUS_CONSTANT_ALPHA=32772]="ONE_MINUS_CONSTANT_ALPHA",i[i.FUNC_ADD=32774]="FUNC_ADD",i[i.FUNC_SUBTRACT=32778]="FUNC_SUBTRACT",i[i.FUNC_REVERSE_SUBTRACT=32779]="FUNC_REVERSE_SUBTRACT",i[i.BLEND_EQUATION=32777]="BLEND_EQUATION",i[i.BLEND_EQUATION_RGB=32777]="BLEND_EQUATION_RGB",i[i.BLEND_EQUATION_ALPHA=34877]="BLEND_EQUATION_ALPHA",i[i.BLEND_DST_RGB=32968]="BLEND_DST_RGB",i[i.BLEND_SRC_RGB=32969]="BLEND_SRC_RGB",i[i.BLEND_DST_ALPHA=32970]="BLEND_DST_ALPHA",i[i.BLEND_SRC_ALPHA=32971]="BLEND_SRC_ALPHA",i[i.BLEND_COLOR=32773]="BLEND_COLOR",i[i.ARRAY_BUFFER_BINDING=34964]="ARRAY_BUFFER_BINDING",i[i.ELEMENT_ARRAY_BUFFER_BINDING=34965]="ELEMENT_ARRAY_BUFFER_BINDING",i[i.LINE_WIDTH=2849]="LINE_WIDTH",i[i.ALIASED_POINT_SIZE_RANGE=33901]="ALIASED_POINT_SIZE_RANGE",i[i.ALIASED_LINE_WIDTH_RANGE=33902]="ALIASED_LINE_WIDTH_RANGE",i[i.CULL_FACE_MODE=2885]="CULL_FACE_MODE",i[i.FRONT_FACE=2886]="FRONT_FACE",i[i.DEPTH_RANGE=2928]="DEPTH_RANGE",i[i.DEPTH_WRITEMASK=2930]="DEPTH_WRITEMASK",i[i.DEPTH_CLEAR_VALUE=2931]="DEPTH_CLEAR_VALUE",i[i.DEPTH_FUNC=2932]="DEPTH_FUNC",i[i.STENCIL_CLEAR_VALUE=2961]="STENCIL_CLEAR_VALUE",i[i.STENCIL_FUNC=2962]="STENCIL_FUNC",i[i.STENCIL_FAIL=2964]="STENCIL_FAIL",i[i.STENCIL_PASS_DEPTH_FAIL=2965]="STENCIL_PASS_DEPTH_FAIL",i[i.STENCIL_PASS_DEPTH_PASS=2966]="STENCIL_PASS_DEPTH_PASS",i[i.STENCIL_REF=2967]="STENCIL_REF",i[i.STENCIL_VALUE_MASK=2963]="STENCIL_VALUE_MASK",i[i.STENCIL_WRITEMASK=2968]="STENCIL_WRITEMASK",i[i.STENCIL_BACK_FUNC=34816]="STENCIL_BACK_FUNC",i[i.STENCIL_BACK_FAIL=34817]="STENCIL_BACK_FAIL",i[i.STENCIL_BACK_PASS_DEPTH_FAIL=34818]="STENCIL_BACK_PASS_DEPTH_FAIL",i[i.STENCIL_BACK_PASS_DEPTH_PASS=34819]="STENCIL_BACK_PASS_DEPTH_PASS",i[i.STENCIL_BACK_REF=36003]="STENCIL_BACK_REF",i[i.STENCIL_BACK_VALUE_MASK=36004]="STENCIL_BACK_VALUE_MASK",i[i.STENCIL_BACK_WRITEMASK=36005]="STENCIL_BACK_WRITEMASK",i[i.VIEWPORT=2978]="VIEWPORT",i[i.SCISSOR_BOX=3088]="SCISSOR_BOX",i[i.COLOR_CLEAR_VALUE=3106]="COLOR_CLEAR_VALUE",i[i.COLOR_WRITEMASK=3107]="COLOR_WRITEMASK",i[i.UNPACK_ALIGNMENT=3317]="UNPACK_ALIGNMENT",i[i.PACK_ALIGNMENT=3333]="PACK_ALIGNMENT",i[i.MAX_TEXTURE_SIZE=3379]="MAX_TEXTURE_SIZE",i[i.MAX_VIEWPORT_DIMS=3386]="MAX_VIEWPORT_DIMS",i[i.SUBPIXEL_BITS=3408]="SUBPIXEL_BITS",i[i.RED_BITS=3410]="RED_BITS",i[i.GREEN_BITS=3411]="GREEN_BITS",i[i.BLUE_BITS=3412]="BLUE_BITS",i[i.ALPHA_BITS=3413]="ALPHA_BITS",i[i.DEPTH_BITS=3414]="DEPTH_BITS",i[i.STENCIL_BITS=3415]="STENCIL_BITS",i[i.POLYGON_OFFSET_UNITS=10752]="POLYGON_OFFSET_UNITS",i[i.POLYGON_OFFSET_FACTOR=32824]="POLYGON_OFFSET_FACTOR",i[i.TEXTURE_BINDING_2D=32873]="TEXTURE_BINDING_2D",i[i.SAMPLE_BUFFERS=32936]="SAMPLE_BUFFERS",i[i.SAMPLES=32937]="SAMPLES",i[i.SAMPLE_COVERAGE_VALUE=32938]="SAMPLE_COVERAGE_VALUE",i[i.SAMPLE_COVERAGE_INVERT=32939]="SAMPLE_COVERAGE_INVERT",i[i.COMPRESSED_TEXTURE_FORMATS=34467]="COMPRESSED_TEXTURE_FORMATS",i[i.VENDOR=7936]="VENDOR",i[i.RENDERER=7937]="RENDERER",i[i.VERSION=7938]="VERSION",i[i.IMPLEMENTATION_COLOR_READ_TYPE=35738]="IMPLEMENTATION_COLOR_READ_TYPE",i[i.IMPLEMENTATION_COLOR_READ_FORMAT=35739]="IMPLEMENTATION_COLOR_READ_FORMAT",i[i.BROWSER_DEFAULT_WEBGL=37444]="BROWSER_DEFAULT_WEBGL",i[i.STATIC_DRAW=35044]="STATIC_DRAW",i[i.STREAM_DRAW=35040]="STREAM_DRAW",i[i.DYNAMIC_DRAW=35048]="DYNAMIC_DRAW",i[i.ARRAY_BUFFER=34962]="ARRAY_BUFFER",i[i.ELEMENT_ARRAY_BUFFER=34963]="ELEMENT_ARRAY_BUFFER",i[i.BUFFER_SIZE=34660]="BUFFER_SIZE",i[i.BUFFER_USAGE=34661]="BUFFER_USAGE",i[i.CURRENT_VERTEX_ATTRIB=34342]="CURRENT_VERTEX_ATTRIB",i[i.VERTEX_ATTRIB_ARRAY_ENABLED=34338]="VERTEX_ATTRIB_ARRAY_ENABLED",i[i.VERTEX_ATTRIB_ARRAY_SIZE=34339]="VERTEX_ATTRIB_ARRAY_SIZE",i[i.VERTEX_ATTRIB_ARRAY_STRIDE=34340]="VERTEX_ATTRIB_ARRAY_STRIDE",i[i.VERTEX_ATTRIB_ARRAY_TYPE=34341]="VERTEX_ATTRIB_ARRAY_TYPE",i[i.VERTEX_ATTRIB_ARRAY_NORMALIZED=34922]="VERTEX_ATTRIB_ARRAY_NORMALIZED",i[i.VERTEX_ATTRIB_ARRAY_POINTER=34373]="VERTEX_ATTRIB_ARRAY_POINTER",i[i.VERTEX_ATTRIB_ARRAY_BUFFER_BINDING=34975]="VERTEX_ATTRIB_ARRAY_BUFFER_BINDING",i[i.CULL_FACE=2884]="CULL_FACE",i[i.FRONT=1028]="FRONT",i[i.BACK=1029]="BACK",i[i.FRONT_AND_BACK=1032]="FRONT_AND_BACK",i[i.BLEND=3042]="BLEND",i[i.DEPTH_TEST=2929]="DEPTH_TEST",i[i.DITHER=3024]="DITHER",i[i.POLYGON_OFFSET_FILL=32823]="POLYGON_OFFSET_FILL",i[i.SAMPLE_ALPHA_TO_COVERAGE=32926]="SAMPLE_ALPHA_TO_COVERAGE",i[i.SAMPLE_COVERAGE=32928]="SAMPLE_COVERAGE",i[i.SCISSOR_TEST=3089]="SCISSOR_TEST",i[i.STENCIL_TEST=2960]="STENCIL_TEST",i[i.NO_ERROR=0]="NO_ERROR",i[i.INVALID_ENUM=1280]="INVALID_ENUM",i[i.INVALID_VALUE=1281]="INVALID_VALUE",i[i.INVALID_OPERATION=1282]="INVALID_OPERATION",i[i.OUT_OF_MEMORY=1285]="OUT_OF_MEMORY",i[i.CONTEXT_LOST_WEBGL=37442]="CONTEXT_LOST_WEBGL",i[i.CW=2304]="CW",i[i.CCW=2305]="CCW",i[i.DONT_CARE=4352]="DONT_CARE",i[i.FASTEST=4353]="FASTEST",i[i.NICEST=4354]="NICEST",i[i.GENERATE_MIPMAP_HINT=33170]="GENERATE_MIPMAP_HINT",i[i.BYTE=5120]="BYTE",i[i.UNSIGNED_BYTE=5121]="UNSIGNED_BYTE",i[i.SHORT=5122]="SHORT",i[i.UNSIGNED_SHORT=5123]="UNSIGNED_SHORT",i[i.INT=5124]="INT",i[i.UNSIGNED_INT=5125]="UNSIGNED_INT",i[i.FLOAT=5126]="FLOAT",i[i.DOUBLE=5130]="DOUBLE",i[i.DEPTH_COMPONENT=6402]="DEPTH_COMPONENT",i[i.ALPHA=6406]="ALPHA",i[i.RGB=6407]="RGB",i[i.RGBA=6408]="RGBA",i[i.LUMINANCE=6409]="LUMINANCE",i[i.LUMINANCE_ALPHA=6410]="LUMINANCE_ALPHA",i[i.UNSIGNED_SHORT_4_4_4_4=32819]="UNSIGNED_SHORT_4_4_4_4",i[i.UNSIGNED_SHORT_5_5_5_1=32820]="UNSIGNED_SHORT_5_5_5_1",i[i.UNSIGNED_SHORT_5_6_5=33635]="UNSIGNED_SHORT_5_6_5",i[i.FRAGMENT_SHADER=35632]="FRAGMENT_SHADER",i[i.VERTEX_SHADER=35633]="VERTEX_SHADER",i[i.COMPILE_STATUS=35713]="COMPILE_STATUS",i[i.DELETE_STATUS=35712]="DELETE_STATUS",i[i.LINK_STATUS=35714]="LINK_STATUS",i[i.VALIDATE_STATUS=35715]="VALIDATE_STATUS",i[i.ATTACHED_SHADERS=35717]="ATTACHED_SHADERS",i[i.ACTIVE_ATTRIBUTES=35721]="ACTIVE_ATTRIBUTES",i[i.ACTIVE_UNIFORMS=35718]="ACTIVE_UNIFORMS",i[i.MAX_VERTEX_ATTRIBS=34921]="MAX_VERTEX_ATTRIBS",i[i.MAX_VERTEX_UNIFORM_VECTORS=36347]="MAX_VERTEX_UNIFORM_VECTORS",i[i.MAX_VARYING_VECTORS=36348]="MAX_VARYING_VECTORS",i[i.MAX_COMBINED_TEXTURE_IMAGE_UNITS=35661]="MAX_COMBINED_TEXTURE_IMAGE_UNITS",i[i.MAX_VERTEX_TEXTURE_IMAGE_UNITS=35660]="MAX_VERTEX_TEXTURE_IMAGE_UNITS",i[i.MAX_TEXTURE_IMAGE_UNITS=34930]="MAX_TEXTURE_IMAGE_UNITS",i[i.MAX_FRAGMENT_UNIFORM_VECTORS=36349]="MAX_FRAGMENT_UNIFORM_VECTORS",i[i.SHADER_TYPE=35663]="SHADER_TYPE",i[i.SHADING_LANGUAGE_VERSION=35724]="SHADING_LANGUAGE_VERSION",i[i.CURRENT_PROGRAM=35725]="CURRENT_PROGRAM",i[i.NEVER=512]="NEVER",i[i.ALWAYS=519]="ALWAYS",i[i.LESS=513]="LESS",i[i.EQUAL=514]="EQUAL",i[i.LEQUAL=515]="LEQUAL",i[i.GREATER=516]="GREATER",i[i.GEQUAL=518]="GEQUAL",i[i.NOTEQUAL=517]="NOTEQUAL",i[i.KEEP=7680]="KEEP",i[i.REPLACE=7681]="REPLACE",i[i.INCR=7682]="INCR",i[i.DECR=7683]="DECR",i[i.INVERT=5386]="INVERT",i[i.INCR_WRAP=34055]="INCR_WRAP",i[i.DECR_WRAP=34056]="DECR_WRAP",i[i.NEAREST=9728]="NEAREST",i[i.LINEAR=9729]="LINEAR",i[i.NEAREST_MIPMAP_NEAREST=9984]="NEAREST_MIPMAP_NEAREST",i[i.LINEAR_MIPMAP_NEAREST=9985]="LINEAR_MIPMAP_NEAREST",i[i.NEAREST_MIPMAP_LINEAR=9986]="NEAREST_MIPMAP_LINEAR",i[i.LINEAR_MIPMAP_LINEAR=9987]="LINEAR_MIPMAP_LINEAR",i[i.TEXTURE_MAG_FILTER=10240]="TEXTURE_MAG_FILTER",i[i.TEXTURE_MIN_FILTER=10241]="TEXTURE_MIN_FILTER",i[i.TEXTURE_WRAP_S=10242]="TEXTURE_WRAP_S",i[i.TEXTURE_WRAP_T=10243]="TEXTURE_WRAP_T",i[i.TEXTURE_2D=3553]="TEXTURE_2D",i[i.TEXTURE=5890]="TEXTURE",i[i.TEXTURE_CUBE_MAP=34067]="TEXTURE_CUBE_MAP",i[i.TEXTURE_BINDING_CUBE_MAP=34068]="TEXTURE_BINDING_CUBE_MAP",i[i.TEXTURE_CUBE_MAP_POSITIVE_X=34069]="TEXTURE_CUBE_MAP_POSITIVE_X",i[i.TEXTURE_CUBE_MAP_NEGATIVE_X=34070]="TEXTURE_CUBE_MAP_NEGATIVE_X",i[i.TEXTURE_CUBE_MAP_POSITIVE_Y=34071]="TEXTURE_CUBE_MAP_POSITIVE_Y",i[i.TEXTURE_CUBE_MAP_NEGATIVE_Y=34072]="TEXTURE_CUBE_MAP_NEGATIVE_Y",i[i.TEXTURE_CUBE_MAP_POSITIVE_Z=34073]="TEXTURE_CUBE_MAP_POSITIVE_Z",i[i.TEXTURE_CUBE_MAP_NEGATIVE_Z=34074]="TEXTURE_CUBE_MAP_NEGATIVE_Z",i[i.MAX_CUBE_MAP_TEXTURE_SIZE=34076]="MAX_CUBE_MAP_TEXTURE_SIZE",i[i.TEXTURE0=33984]="TEXTURE0",i[i.ACTIVE_TEXTURE=34016]="ACTIVE_TEXTURE",i[i.REPEAT=10497]="REPEAT",i[i.CLAMP_TO_EDGE=33071]="CLAMP_TO_EDGE",i[i.MIRRORED_REPEAT=33648]="MIRRORED_REPEAT",i[i.TEXTURE_WIDTH=4096]="TEXTURE_WIDTH",i[i.TEXTURE_HEIGHT=4097]="TEXTURE_HEIGHT",i[i.FLOAT_VEC2=35664]="FLOAT_VEC2",i[i.FLOAT_VEC3=35665]="FLOAT_VEC3",i[i.FLOAT_VEC4=35666]="FLOAT_VEC4",i[i.INT_VEC2=35667]="INT_VEC2",i[i.INT_VEC3=35668]="INT_VEC3",i[i.INT_VEC4=35669]="INT_VEC4",i[i.BOOL=35670]="BOOL",i[i.BOOL_VEC2=35671]="BOOL_VEC2",i[i.BOOL_VEC3=35672]="BOOL_VEC3",i[i.BOOL_VEC4=35673]="BOOL_VEC4",i[i.FLOAT_MAT2=35674]="FLOAT_MAT2",i[i.FLOAT_MAT3=35675]="FLOAT_MAT3",i[i.FLOAT_MAT4=35676]="FLOAT_MAT4",i[i.SAMPLER_2D=35678]="SAMPLER_2D",i[i.SAMPLER_CUBE=35680]="SAMPLER_CUBE",i[i.LOW_FLOAT=36336]="LOW_FLOAT",i[i.MEDIUM_FLOAT=36337]="MEDIUM_FLOAT",i[i.HIGH_FLOAT=36338]="HIGH_FLOAT",i[i.LOW_INT=36339]="LOW_INT",i[i.MEDIUM_INT=36340]="MEDIUM_INT",i[i.HIGH_INT=36341]="HIGH_INT",i[i.FRAMEBUFFER=36160]="FRAMEBUFFER",i[i.RENDERBUFFER=36161]="RENDERBUFFER",i[i.RGBA4=32854]="RGBA4",i[i.RGB5_A1=32855]="RGB5_A1",i[i.RGB565=36194]="RGB565",i[i.DEPTH_COMPONENT16=33189]="DEPTH_COMPONENT16",i[i.STENCIL_INDEX=6401]="STENCIL_INDEX",i[i.STENCIL_INDEX8=36168]="STENCIL_INDEX8",i[i.DEPTH_STENCIL=34041]="DEPTH_STENCIL",i[i.RENDERBUFFER_WIDTH=36162]="RENDERBUFFER_WIDTH",i[i.RENDERBUFFER_HEIGHT=36163]="RENDERBUFFER_HEIGHT",i[i.RENDERBUFFER_INTERNAL_FORMAT=36164]="RENDERBUFFER_INTERNAL_FORMAT",i[i.RENDERBUFFER_RED_SIZE=36176]="RENDERBUFFER_RED_SIZE",i[i.RENDERBUFFER_GREEN_SIZE=36177]="RENDERBUFFER_GREEN_SIZE",i[i.RENDERBUFFER_BLUE_SIZE=36178]="RENDERBUFFER_BLUE_SIZE",i[i.RENDERBUFFER_ALPHA_SIZE=36179]="RENDERBUFFER_ALPHA_SIZE",i[i.RENDERBUFFER_DEPTH_SIZE=36180]="RENDERBUFFER_DEPTH_SIZE",i[i.RENDERBUFFER_STENCIL_SIZE=36181]="RENDERBUFFER_STENCIL_SIZE",i[i.FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE=36048]="FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE",i[i.FRAMEBUFFER_ATTACHMENT_OBJECT_NAME=36049]="FRAMEBUFFER_ATTACHMENT_OBJECT_NAME",i[i.FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL=36050]="FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL",i[i.FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE=36051]="FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE",i[i.COLOR_ATTACHMENT0=36064]="COLOR_ATTACHMENT0",i[i.DEPTH_ATTACHMENT=36096]="DEPTH_ATTACHMENT",i[i.STENCIL_ATTACHMENT=36128]="STENCIL_ATTACHMENT",i[i.DEPTH_STENCIL_ATTACHMENT=33306]="DEPTH_STENCIL_ATTACHMENT",i[i.NONE=0]="NONE",i[i.FRAMEBUFFER_COMPLETE=36053]="FRAMEBUFFER_COMPLETE",i[i.FRAMEBUFFER_INCOMPLETE_ATTACHMENT=36054]="FRAMEBUFFER_INCOMPLETE_ATTACHMENT",i[i.FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT=36055]="FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT",i[i.FRAMEBUFFER_INCOMPLETE_DIMENSIONS=36057]="FRAMEBUFFER_INCOMPLETE_DIMENSIONS",i[i.FRAMEBUFFER_UNSUPPORTED=36061]="FRAMEBUFFER_UNSUPPORTED",i[i.FRAMEBUFFER_BINDING=36006]="FRAMEBUFFER_BINDING",i[i.RENDERBUFFER_BINDING=36007]="RENDERBUFFER_BINDING",i[i.READ_FRAMEBUFFER=36008]="READ_FRAMEBUFFER",i[i.DRAW_FRAMEBUFFER=36009]="DRAW_FRAMEBUFFER",i[i.MAX_RENDERBUFFER_SIZE=34024]="MAX_RENDERBUFFER_SIZE",i[i.INVALID_FRAMEBUFFER_OPERATION=1286]="INVALID_FRAMEBUFFER_OPERATION",i[i.UNPACK_FLIP_Y_WEBGL=37440]="UNPACK_FLIP_Y_WEBGL",i[i.UNPACK_PREMULTIPLY_ALPHA_WEBGL=37441]="UNPACK_PREMULTIPLY_ALPHA_WEBGL",i[i.UNPACK_COLORSPACE_CONVERSION_WEBGL=37443]="UNPACK_COLORSPACE_CONVERSION_WEBGL",i[i.READ_BUFFER=3074]="READ_BUFFER",i[i.UNPACK_ROW_LENGTH=3314]="UNPACK_ROW_LENGTH",i[i.UNPACK_SKIP_ROWS=3315]="UNPACK_SKIP_ROWS",i[i.UNPACK_SKIP_PIXELS=3316]="UNPACK_SKIP_PIXELS",i[i.PACK_ROW_LENGTH=3330]="PACK_ROW_LENGTH",i[i.PACK_SKIP_ROWS=3331]="PACK_SKIP_ROWS",i[i.PACK_SKIP_PIXELS=3332]="PACK_SKIP_PIXELS",i[i.TEXTURE_BINDING_3D=32874]="TEXTURE_BINDING_3D",i[i.UNPACK_SKIP_IMAGES=32877]="UNPACK_SKIP_IMAGES",i[i.UNPACK_IMAGE_HEIGHT=32878]="UNPACK_IMAGE_HEIGHT",i[i.MAX_3D_TEXTURE_SIZE=32883]="MAX_3D_TEXTURE_SIZE",i[i.MAX_ELEMENTS_VERTICES=33e3]="MAX_ELEMENTS_VERTICES",i[i.MAX_ELEMENTS_INDICES=33001]="MAX_ELEMENTS_INDICES",i[i.MAX_TEXTURE_LOD_BIAS=34045]="MAX_TEXTURE_LOD_BIAS",i[i.MAX_FRAGMENT_UNIFORM_COMPONENTS=35657]="MAX_FRAGMENT_UNIFORM_COMPONENTS",i[i.MAX_VERTEX_UNIFORM_COMPONENTS=35658]="MAX_VERTEX_UNIFORM_COMPONENTS",i[i.MAX_ARRAY_TEXTURE_LAYERS=35071]="MAX_ARRAY_TEXTURE_LAYERS",i[i.MIN_PROGRAM_TEXEL_OFFSET=35076]="MIN_PROGRAM_TEXEL_OFFSET",i[i.MAX_PROGRAM_TEXEL_OFFSET=35077]="MAX_PROGRAM_TEXEL_OFFSET",i[i.MAX_VARYING_COMPONENTS=35659]="MAX_VARYING_COMPONENTS",i[i.FRAGMENT_SHADER_DERIVATIVE_HINT=35723]="FRAGMENT_SHADER_DERIVATIVE_HINT",i[i.RASTERIZER_DISCARD=35977]="RASTERIZER_DISCARD",i[i.VERTEX_ARRAY_BINDING=34229]="VERTEX_ARRAY_BINDING",i[i.MAX_VERTEX_OUTPUT_COMPONENTS=37154]="MAX_VERTEX_OUTPUT_COMPONENTS",i[i.MAX_FRAGMENT_INPUT_COMPONENTS=37157]="MAX_FRAGMENT_INPUT_COMPONENTS",i[i.MAX_SERVER_WAIT_TIMEOUT=37137]="MAX_SERVER_WAIT_TIMEOUT",i[i.MAX_ELEMENT_INDEX=36203]="MAX_ELEMENT_INDEX",i[i.RED=6403]="RED",i[i.RGB8=32849]="RGB8",i[i.RGBA8=32856]="RGBA8",i[i.RGB10_A2=32857]="RGB10_A2",i[i.TEXTURE_3D=32879]="TEXTURE_3D",i[i.TEXTURE_WRAP_R=32882]="TEXTURE_WRAP_R",i[i.TEXTURE_MIN_LOD=33082]="TEXTURE_MIN_LOD",i[i.TEXTURE_MAX_LOD=33083]="TEXTURE_MAX_LOD",i[i.TEXTURE_BASE_LEVEL=33084]="TEXTURE_BASE_LEVEL",i[i.TEXTURE_MAX_LEVEL=33085]="TEXTURE_MAX_LEVEL",i[i.TEXTURE_COMPARE_MODE=34892]="TEXTURE_COMPARE_MODE",i[i.TEXTURE_COMPARE_FUNC=34893]="TEXTURE_COMPARE_FUNC",i[i.SRGB=35904]="SRGB",i[i.SRGB8=35905]="SRGB8",i[i.SRGB8_ALPHA8=35907]="SRGB8_ALPHA8",i[i.COMPARE_REF_TO_TEXTURE=34894]="COMPARE_REF_TO_TEXTURE",i[i.RGBA32F=34836]="RGBA32F",i[i.RGB32F=34837]="RGB32F",i[i.RGBA16F=34842]="RGBA16F",i[i.RGB16F=34843]="RGB16F",i[i.TEXTURE_2D_ARRAY=35866]="TEXTURE_2D_ARRAY",i[i.TEXTURE_BINDING_2D_ARRAY=35869]="TEXTURE_BINDING_2D_ARRAY",i[i.R11F_G11F_B10F=35898]="R11F_G11F_B10F",i[i.RGB9_E5=35901]="RGB9_E5",i[i.RGBA32UI=36208]="RGBA32UI",i[i.RGB32UI=36209]="RGB32UI",i[i.RGBA16UI=36214]="RGBA16UI",i[i.RGB16UI=36215]="RGB16UI",i[i.RGBA8UI=36220]="RGBA8UI",i[i.RGB8UI=36221]="RGB8UI",i[i.RGBA32I=36226]="RGBA32I",i[i.RGB32I=36227]="RGB32I",i[i.RGBA16I=36232]="RGBA16I",i[i.RGB16I=36233]="RGB16I",i[i.RGBA8I=36238]="RGBA8I",i[i.RGB8I=36239]="RGB8I",i[i.RED_INTEGER=36244]="RED_INTEGER",i[i.RGB_INTEGER=36248]="RGB_INTEGER",i[i.RGBA_INTEGER=36249]="RGBA_INTEGER",i[i.R8=33321]="R8",i[i.RG8=33323]="RG8",i[i.R16F=33325]="R16F",i[i.R32F=33326]="R32F",i[i.RG16F=33327]="RG16F",i[i.RG32F=33328]="RG32F",i[i.R8I=33329]="R8I",i[i.R8UI=33330]="R8UI",i[i.R16I=33331]="R16I",i[i.R16UI=33332]="R16UI",i[i.R32I=33333]="R32I",i[i.R32UI=33334]="R32UI",i[i.RG8I=33335]="RG8I",i[i.RG8UI=33336]="RG8UI",i[i.RG16I=33337]="RG16I",i[i.RG16UI=33338]="RG16UI",i[i.RG32I=33339]="RG32I",i[i.RG32UI=33340]="RG32UI",i[i.R8_SNORM=36756]="R8_SNORM",i[i.RG8_SNORM=36757]="RG8_SNORM",i[i.RGB8_SNORM=36758]="RGB8_SNORM",i[i.RGBA8_SNORM=36759]="RGBA8_SNORM",i[i.RGB10_A2UI=36975]="RGB10_A2UI",i[i.TEXTURE_IMMUTABLE_FORMAT=37167]="TEXTURE_IMMUTABLE_FORMAT",i[i.TEXTURE_IMMUTABLE_LEVELS=33503]="TEXTURE_IMMUTABLE_LEVELS",i[i.UNSIGNED_INT_2_10_10_10_REV=33640]="UNSIGNED_INT_2_10_10_10_REV",i[i.UNSIGNED_INT_10F_11F_11F_REV=35899]="UNSIGNED_INT_10F_11F_11F_REV",i[i.UNSIGNED_INT_5_9_9_9_REV=35902]="UNSIGNED_INT_5_9_9_9_REV",i[i.FLOAT_32_UNSIGNED_INT_24_8_REV=36269]="FLOAT_32_UNSIGNED_INT_24_8_REV",i[i.UNSIGNED_INT_24_8=34042]="UNSIGNED_INT_24_8",i[i.HALF_FLOAT=5131]="HALF_FLOAT",i[i.RG=33319]="RG",i[i.RG_INTEGER=33320]="RG_INTEGER",i[i.INT_2_10_10_10_REV=36255]="INT_2_10_10_10_REV",i[i.CURRENT_QUERY=34917]="CURRENT_QUERY",i[i.QUERY_RESULT=34918]="QUERY_RESULT",i[i.QUERY_RESULT_AVAILABLE=34919]="QUERY_RESULT_AVAILABLE",i[i.ANY_SAMPLES_PASSED=35887]="ANY_SAMPLES_PASSED",i[i.ANY_SAMPLES_PASSED_CONSERVATIVE=36202]="ANY_SAMPLES_PASSED_CONSERVATIVE",i[i.MAX_DRAW_BUFFERS=34852]="MAX_DRAW_BUFFERS",i[i.DRAW_BUFFER0=34853]="DRAW_BUFFER0",i[i.DRAW_BUFFER1=34854]="DRAW_BUFFER1",i[i.DRAW_BUFFER2=34855]="DRAW_BUFFER2",i[i.DRAW_BUFFER3=34856]="DRAW_BUFFER3",i[i.DRAW_BUFFER4=34857]="DRAW_BUFFER4",i[i.DRAW_BUFFER5=34858]="DRAW_BUFFER5",i[i.DRAW_BUFFER6=34859]="DRAW_BUFFER6",i[i.DRAW_BUFFER7=34860]="DRAW_BUFFER7",i[i.DRAW_BUFFER8=34861]="DRAW_BUFFER8",i[i.DRAW_BUFFER9=34862]="DRAW_BUFFER9",i[i.DRAW_BUFFER10=34863]="DRAW_BUFFER10",i[i.DRAW_BUFFER11=34864]="DRAW_BUFFER11",i[i.DRAW_BUFFER12=34865]="DRAW_BUFFER12",i[i.DRAW_BUFFER13=34866]="DRAW_BUFFER13",i[i.DRAW_BUFFER14=34867]="DRAW_BUFFER14",i[i.DRAW_BUFFER15=34868]="DRAW_BUFFER15",i[i.MAX_COLOR_ATTACHMENTS=36063]="MAX_COLOR_ATTACHMENTS",i[i.COLOR_ATTACHMENT1=36065]="COLOR_ATTACHMENT1",i[i.COLOR_ATTACHMENT2=36066]="COLOR_ATTACHMENT2",i[i.COLOR_ATTACHMENT3=36067]="COLOR_ATTACHMENT3",i[i.COLOR_ATTACHMENT4=36068]="COLOR_ATTACHMENT4",i[i.COLOR_ATTACHMENT5=36069]="COLOR_ATTACHMENT5",i[i.COLOR_ATTACHMENT6=36070]="COLOR_ATTACHMENT6",i[i.COLOR_ATTACHMENT7=36071]="COLOR_ATTACHMENT7",i[i.COLOR_ATTACHMENT8=36072]="COLOR_ATTACHMENT8",i[i.COLOR_ATTACHMENT9=36073]="COLOR_ATTACHMENT9",i[i.COLOR_ATTACHMENT10=36074]="COLOR_ATTACHMENT10",i[i.COLOR_ATTACHMENT11=36075]="COLOR_ATTACHMENT11",i[i.COLOR_ATTACHMENT12=36076]="COLOR_ATTACHMENT12",i[i.COLOR_ATTACHMENT13=36077]="COLOR_ATTACHMENT13",i[i.COLOR_ATTACHMENT14=36078]="COLOR_ATTACHMENT14",i[i.COLOR_ATTACHMENT15=36079]="COLOR_ATTACHMENT15",i[i.SAMPLER_3D=35679]="SAMPLER_3D",i[i.SAMPLER_2D_SHADOW=35682]="SAMPLER_2D_SHADOW",i[i.SAMPLER_2D_ARRAY=36289]="SAMPLER_2D_ARRAY",i[i.SAMPLER_2D_ARRAY_SHADOW=36292]="SAMPLER_2D_ARRAY_SHADOW",i[i.SAMPLER_CUBE_SHADOW=36293]="SAMPLER_CUBE_SHADOW",i[i.INT_SAMPLER_2D=36298]="INT_SAMPLER_2D",i[i.INT_SAMPLER_3D=36299]="INT_SAMPLER_3D",i[i.INT_SAMPLER_CUBE=36300]="INT_SAMPLER_CUBE",i[i.INT_SAMPLER_2D_ARRAY=36303]="INT_SAMPLER_2D_ARRAY",i[i.UNSIGNED_INT_SAMPLER_2D=36306]="UNSIGNED_INT_SAMPLER_2D",i[i.UNSIGNED_INT_SAMPLER_3D=36307]="UNSIGNED_INT_SAMPLER_3D",i[i.UNSIGNED_INT_SAMPLER_CUBE=36308]="UNSIGNED_INT_SAMPLER_CUBE",i[i.UNSIGNED_INT_SAMPLER_2D_ARRAY=36311]="UNSIGNED_INT_SAMPLER_2D_ARRAY",i[i.MAX_SAMPLES=36183]="MAX_SAMPLES",i[i.SAMPLER_BINDING=35097]="SAMPLER_BINDING",i[i.PIXEL_PACK_BUFFER=35051]="PIXEL_PACK_BUFFER",i[i.PIXEL_UNPACK_BUFFER=35052]="PIXEL_UNPACK_BUFFER",i[i.PIXEL_PACK_BUFFER_BINDING=35053]="PIXEL_PACK_BUFFER_BINDING",i[i.PIXEL_UNPACK_BUFFER_BINDING=35055]="PIXEL_UNPACK_BUFFER_BINDING",i[i.COPY_READ_BUFFER=36662]="COPY_READ_BUFFER",i[i.COPY_WRITE_BUFFER=36663]="COPY_WRITE_BUFFER",i[i.COPY_READ_BUFFER_BINDING=36662]="COPY_READ_BUFFER_BINDING",i[i.COPY_WRITE_BUFFER_BINDING=36663]="COPY_WRITE_BUFFER_BINDING",i[i.FLOAT_MAT2x3=35685]="FLOAT_MAT2x3",i[i.FLOAT_MAT2x4=35686]="FLOAT_MAT2x4",i[i.FLOAT_MAT3x2=35687]="FLOAT_MAT3x2",i[i.FLOAT_MAT3x4=35688]="FLOAT_MAT3x4",i[i.FLOAT_MAT4x2=35689]="FLOAT_MAT4x2",i[i.FLOAT_MAT4x3=35690]="FLOAT_MAT4x3",i[i.UNSIGNED_INT_VEC2=36294]="UNSIGNED_INT_VEC2",i[i.UNSIGNED_INT_VEC3=36295]="UNSIGNED_INT_VEC3",i[i.UNSIGNED_INT_VEC4=36296]="UNSIGNED_INT_VEC4",i[i.UNSIGNED_NORMALIZED=35863]="UNSIGNED_NORMALIZED",i[i.SIGNED_NORMALIZED=36764]="SIGNED_NORMALIZED",i[i.VERTEX_ATTRIB_ARRAY_INTEGER=35069]="VERTEX_ATTRIB_ARRAY_INTEGER",i[i.VERTEX_ATTRIB_ARRAY_DIVISOR=35070]="VERTEX_ATTRIB_ARRAY_DIVISOR",i[i.TRANSFORM_FEEDBACK_BUFFER_MODE=35967]="TRANSFORM_FEEDBACK_BUFFER_MODE",i[i.MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS=35968]="MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS",i[i.TRANSFORM_FEEDBACK_VARYINGS=35971]="TRANSFORM_FEEDBACK_VARYINGS",i[i.TRANSFORM_FEEDBACK_BUFFER_START=35972]="TRANSFORM_FEEDBACK_BUFFER_START",i[i.TRANSFORM_FEEDBACK_BUFFER_SIZE=35973]="TRANSFORM_FEEDBACK_BUFFER_SIZE",i[i.TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN=35976]="TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN",i[i.MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS=35978]="MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS",i[i.MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS=35979]="MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS",i[i.INTERLEAVED_ATTRIBS=35980]="INTERLEAVED_ATTRIBS",i[i.SEPARATE_ATTRIBS=35981]="SEPARATE_ATTRIBS",i[i.TRANSFORM_FEEDBACK_BUFFER=35982]="TRANSFORM_FEEDBACK_BUFFER",i[i.TRANSFORM_FEEDBACK_BUFFER_BINDING=35983]="TRANSFORM_FEEDBACK_BUFFER_BINDING",i[i.TRANSFORM_FEEDBACK=36386]="TRANSFORM_FEEDBACK",i[i.TRANSFORM_FEEDBACK_PAUSED=36387]="TRANSFORM_FEEDBACK_PAUSED",i[i.TRANSFORM_FEEDBACK_ACTIVE=36388]="TRANSFORM_FEEDBACK_ACTIVE",i[i.TRANSFORM_FEEDBACK_BINDING=36389]="TRANSFORM_FEEDBACK_BINDING",i[i.FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING=33296]="FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING",i[i.FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE=33297]="FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE",i[i.FRAMEBUFFER_ATTACHMENT_RED_SIZE=33298]="FRAMEBUFFER_ATTACHMENT_RED_SIZE",i[i.FRAMEBUFFER_ATTACHMENT_GREEN_SIZE=33299]="FRAMEBUFFER_ATTACHMENT_GREEN_SIZE",i[i.FRAMEBUFFER_ATTACHMENT_BLUE_SIZE=33300]="FRAMEBUFFER_ATTACHMENT_BLUE_SIZE",i[i.FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE=33301]="FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE",i[i.FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE=33302]="FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE",i[i.FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE=33303]="FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE",i[i.FRAMEBUFFER_DEFAULT=33304]="FRAMEBUFFER_DEFAULT",i[i.DEPTH24_STENCIL8=35056]="DEPTH24_STENCIL8",i[i.DRAW_FRAMEBUFFER_BINDING=36006]="DRAW_FRAMEBUFFER_BINDING",i[i.READ_FRAMEBUFFER_BINDING=36010]="READ_FRAMEBUFFER_BINDING",i[i.RENDERBUFFER_SAMPLES=36011]="RENDERBUFFER_SAMPLES",i[i.FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER=36052]="FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER",i[i.FRAMEBUFFER_INCOMPLETE_MULTISAMPLE=36182]="FRAMEBUFFER_INCOMPLETE_MULTISAMPLE",i[i.UNIFORM_BUFFER=35345]="UNIFORM_BUFFER",i[i.UNIFORM_BUFFER_BINDING=35368]="UNIFORM_BUFFER_BINDING",i[i.UNIFORM_BUFFER_START=35369]="UNIFORM_BUFFER_START",i[i.UNIFORM_BUFFER_SIZE=35370]="UNIFORM_BUFFER_SIZE",i[i.MAX_VERTEX_UNIFORM_BLOCKS=35371]="MAX_VERTEX_UNIFORM_BLOCKS",i[i.MAX_FRAGMENT_UNIFORM_BLOCKS=35373]="MAX_FRAGMENT_UNIFORM_BLOCKS",i[i.MAX_COMBINED_UNIFORM_BLOCKS=35374]="MAX_COMBINED_UNIFORM_BLOCKS",i[i.MAX_UNIFORM_BUFFER_BINDINGS=35375]="MAX_UNIFORM_BUFFER_BINDINGS",i[i.MAX_UNIFORM_BLOCK_SIZE=35376]="MAX_UNIFORM_BLOCK_SIZE",i[i.MAX_COMBINED_VERTEX_UNIFORM_COMPONENTS=35377]="MAX_COMBINED_VERTEX_UNIFORM_COMPONENTS",i[i.MAX_COMBINED_FRAGMENT_UNIFORM_COMPONENTS=35379]="MAX_COMBINED_FRAGMENT_UNIFORM_COMPONENTS",i[i.UNIFORM_BUFFER_OFFSET_ALIGNMENT=35380]="UNIFORM_BUFFER_OFFSET_ALIGNMENT",i[i.ACTIVE_UNIFORM_BLOCKS=35382]="ACTIVE_UNIFORM_BLOCKS",i[i.UNIFORM_TYPE=35383]="UNIFORM_TYPE",i[i.UNIFORM_SIZE=35384]="UNIFORM_SIZE",i[i.UNIFORM_BLOCK_INDEX=35386]="UNIFORM_BLOCK_INDEX",i[i.UNIFORM_OFFSET=35387]="UNIFORM_OFFSET",i[i.UNIFORM_ARRAY_STRIDE=35388]="UNIFORM_ARRAY_STRIDE",i[i.UNIFORM_MATRIX_STRIDE=35389]="UNIFORM_MATRIX_STRIDE",i[i.UNIFORM_IS_ROW_MAJOR=35390]="UNIFORM_IS_ROW_MAJOR",i[i.UNIFORM_BLOCK_BINDING=35391]="UNIFORM_BLOCK_BINDING",i[i.UNIFORM_BLOCK_DATA_SIZE=35392]="UNIFORM_BLOCK_DATA_SIZE",i[i.UNIFORM_BLOCK_ACTIVE_UNIFORMS=35394]="UNIFORM_BLOCK_ACTIVE_UNIFORMS",i[i.UNIFORM_BLOCK_ACTIVE_UNIFORM_INDICES=35395]="UNIFORM_BLOCK_ACTIVE_UNIFORM_INDICES",i[i.UNIFORM_BLOCK_REFERENCED_BY_VERTEX_SHADER=35396]="UNIFORM_BLOCK_REFERENCED_BY_VERTEX_SHADER",i[i.UNIFORM_BLOCK_REFERENCED_BY_FRAGMENT_SHADER=35398]="UNIFORM_BLOCK_REFERENCED_BY_FRAGMENT_SHADER",i[i.OBJECT_TYPE=37138]="OBJECT_TYPE",i[i.SYNC_CONDITION=37139]="SYNC_CONDITION",i[i.SYNC_STATUS=37140]="SYNC_STATUS",i[i.SYNC_FLAGS=37141]="SYNC_FLAGS",i[i.SYNC_FENCE=37142]="SYNC_FENCE",i[i.SYNC_GPU_COMMANDS_COMPLETE=37143]="SYNC_GPU_COMMANDS_COMPLETE",i[i.UNSIGNALED=37144]="UNSIGNALED",i[i.SIGNALED=37145]="SIGNALED",i[i.ALREADY_SIGNALED=37146]="ALREADY_SIGNALED",i[i.TIMEOUT_EXPIRED=37147]="TIMEOUT_EXPIRED",i[i.CONDITION_SATISFIED=37148]="CONDITION_SATISFIED",i[i.WAIT_FAILED=37149]="WAIT_FAILED",i[i.SYNC_FLUSH_COMMANDS_BIT=1]="SYNC_FLUSH_COMMANDS_BIT",i[i.COLOR=6144]="COLOR",i[i.DEPTH=6145]="DEPTH",i[i.STENCIL=6146]="STENCIL",i[i.MIN=32775]="MIN",i[i.MAX=32776]="MAX",i[i.DEPTH_COMPONENT24=33190]="DEPTH_COMPONENT24",i[i.STREAM_READ=35041]="STREAM_READ",i[i.STREAM_COPY=35042]="STREAM_COPY",i[i.STATIC_READ=35045]="STATIC_READ",i[i.STATIC_COPY=35046]="STATIC_COPY",i[i.DYNAMIC_READ=35049]="DYNAMIC_READ",i[i.DYNAMIC_COPY=35050]="DYNAMIC_COPY",i[i.DEPTH_COMPONENT32F=36012]="DEPTH_COMPONENT32F",i[i.DEPTH32F_STENCIL8=36013]="DEPTH32F_STENCIL8",i[i.INVALID_INDEX=4294967295]="INVALID_INDEX",i[i.TIMEOUT_IGNORED=-1]="TIMEOUT_IGNORED",i[i.MAX_CLIENT_WAIT_TIMEOUT_WEBGL=37447]="MAX_CLIENT_WAIT_TIMEOUT_WEBGL",i[i.VERTEX_ATTRIB_ARRAY_DIVISOR_ANGLE=35070]="VERTEX_ATTRIB_ARRAY_DIVISOR_ANGLE",i[i.UNMASKED_VENDOR_WEBGL=37445]="UNMASKED_VENDOR_WEBGL",i[i.UNMASKED_RENDERER_WEBGL=37446]="UNMASKED_RENDERER_WEBGL",i[i.MAX_TEXTURE_MAX_ANISOTROPY_EXT=34047]="MAX_TEXTURE_MAX_ANISOTROPY_EXT",i[i.TEXTURE_MAX_ANISOTROPY_EXT=34046]="TEXTURE_MAX_ANISOTROPY_EXT",i[i.COMPRESSED_RGB_S3TC_DXT1_EXT=33776]="COMPRESSED_RGB_S3TC_DXT1_EXT",i[i.COMPRESSED_RGBA_S3TC_DXT1_EXT=33777]="COMPRESSED_RGBA_S3TC_DXT1_EXT",i[i.COMPRESSED_RGBA_S3TC_DXT3_EXT=33778]="COMPRESSED_RGBA_S3TC_DXT3_EXT",i[i.COMPRESSED_RGBA_S3TC_DXT5_EXT=33779]="COMPRESSED_RGBA_S3TC_DXT5_EXT",i[i.COMPRESSED_R11_EAC=37488]="COMPRESSED_R11_EAC",i[i.COMPRESSED_SIGNED_R11_EAC=37489]="COMPRESSED_SIGNED_R11_EAC",i[i.COMPRESSED_RG11_EAC=37490]="COMPRESSED_RG11_EAC",i[i.COMPRESSED_SIGNED_RG11_EAC=37491]="COMPRESSED_SIGNED_RG11_EAC",i[i.COMPRESSED_RGB8_ETC2=37492]="COMPRESSED_RGB8_ETC2",i[i.COMPRESSED_RGBA8_ETC2_EAC=37493]="COMPRESSED_RGBA8_ETC2_EAC",i[i.COMPRESSED_SRGB8_ETC2=37494]="COMPRESSED_SRGB8_ETC2",i[i.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC=37495]="COMPRESSED_SRGB8_ALPHA8_ETC2_EAC",i[i.COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2=37496]="COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2",i[i.COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2=37497]="COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2",i[i.COMPRESSED_RGB_PVRTC_4BPPV1_IMG=35840]="COMPRESSED_RGB_PVRTC_4BPPV1_IMG",i[i.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG=35842]="COMPRESSED_RGBA_PVRTC_4BPPV1_IMG",i[i.COMPRESSED_RGB_PVRTC_2BPPV1_IMG=35841]="COMPRESSED_RGB_PVRTC_2BPPV1_IMG",i[i.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG=35843]="COMPRESSED_RGBA_PVRTC_2BPPV1_IMG",i[i.COMPRESSED_RGB_ETC1_WEBGL=36196]="COMPRESSED_RGB_ETC1_WEBGL",i[i.COMPRESSED_RGB_ATC_WEBGL=35986]="COMPRESSED_RGB_ATC_WEBGL",i[i.COMPRESSED_RGBA_ATC_EXPLICIT_ALPHA_WEBGL=35986]="COMPRESSED_RGBA_ATC_EXPLICIT_ALPHA_WEBGL",i[i.COMPRESSED_RGBA_ATC_INTERPOLATED_ALPHA_WEBGL=34798]="COMPRESSED_RGBA_ATC_INTERPOLATED_ALPHA_WEBGL",i[i.UNSIGNED_INT_24_8_WEBGL=34042]="UNSIGNED_INT_24_8_WEBGL",i[i.HALF_FLOAT_OES=36193]="HALF_FLOAT_OES",i[i.RGBA32F_EXT=34836]="RGBA32F_EXT",i[i.RGB32F_EXT=34837]="RGB32F_EXT",i[i.FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE_EXT=33297]="FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE_EXT",i[i.UNSIGNED_NORMALIZED_EXT=35863]="UNSIGNED_NORMALIZED_EXT",i[i.MIN_EXT=32775]="MIN_EXT",i[i.MAX_EXT=32776]="MAX_EXT",i[i.SRGB_EXT=35904]="SRGB_EXT",i[i.SRGB_ALPHA_EXT=35906]="SRGB_ALPHA_EXT",i[i.SRGB8_ALPHA8_EXT=35907]="SRGB8_ALPHA8_EXT",i[i.FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING_EXT=33296]="FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING_EXT",i[i.FRAGMENT_SHADER_DERIVATIVE_HINT_OES=35723]="FRAGMENT_SHADER_DERIVATIVE_HINT_OES",i[i.COLOR_ATTACHMENT0_WEBGL=36064]="COLOR_ATTACHMENT0_WEBGL",i[i.COLOR_ATTACHMENT1_WEBGL=36065]="COLOR_ATTACHMENT1_WEBGL",i[i.COLOR_ATTACHMENT2_WEBGL=36066]="COLOR_ATTACHMENT2_WEBGL",i[i.COLOR_ATTACHMENT3_WEBGL=36067]="COLOR_ATTACHMENT3_WEBGL",i[i.COLOR_ATTACHMENT4_WEBGL=36068]="COLOR_ATTACHMENT4_WEBGL",i[i.COLOR_ATTACHMENT5_WEBGL=36069]="COLOR_ATTACHMENT5_WEBGL",i[i.COLOR_ATTACHMENT6_WEBGL=36070]="COLOR_ATTACHMENT6_WEBGL",i[i.COLOR_ATTACHMENT7_WEBGL=36071]="COLOR_ATTACHMENT7_WEBGL",i[i.COLOR_ATTACHMENT8_WEBGL=36072]="COLOR_ATTACHMENT8_WEBGL",i[i.COLOR_ATTACHMENT9_WEBGL=36073]="COLOR_ATTACHMENT9_WEBGL",i[i.COLOR_ATTACHMENT10_WEBGL=36074]="COLOR_ATTACHMENT10_WEBGL",i[i.COLOR_ATTACHMENT11_WEBGL=36075]="COLOR_ATTACHMENT11_WEBGL",i[i.COLOR_ATTACHMENT12_WEBGL=36076]="COLOR_ATTACHMENT12_WEBGL",i[i.COLOR_ATTACHMENT13_WEBGL=36077]="COLOR_ATTACHMENT13_WEBGL",i[i.COLOR_ATTACHMENT14_WEBGL=36078]="COLOR_ATTACHMENT14_WEBGL",i[i.COLOR_ATTACHMENT15_WEBGL=36079]="COLOR_ATTACHMENT15_WEBGL",i[i.DRAW_BUFFER0_WEBGL=34853]="DRAW_BUFFER0_WEBGL",i[i.DRAW_BUFFER1_WEBGL=34854]="DRAW_BUFFER1_WEBGL",i[i.DRAW_BUFFER2_WEBGL=34855]="DRAW_BUFFER2_WEBGL",i[i.DRAW_BUFFER3_WEBGL=34856]="DRAW_BUFFER3_WEBGL",i[i.DRAW_BUFFER4_WEBGL=34857]="DRAW_BUFFER4_WEBGL",i[i.DRAW_BUFFER5_WEBGL=34858]="DRAW_BUFFER5_WEBGL",i[i.DRAW_BUFFER6_WEBGL=34859]="DRAW_BUFFER6_WEBGL",i[i.DRAW_BUFFER7_WEBGL=34860]="DRAW_BUFFER7_WEBGL",i[i.DRAW_BUFFER8_WEBGL=34861]="DRAW_BUFFER8_WEBGL",i[i.DRAW_BUFFER9_WEBGL=34862]="DRAW_BUFFER9_WEBGL",i[i.DRAW_BUFFER10_WEBGL=34863]="DRAW_BUFFER10_WEBGL",i[i.DRAW_BUFFER11_WEBGL=34864]="DRAW_BUFFER11_WEBGL",i[i.DRAW_BUFFER12_WEBGL=34865]="DRAW_BUFFER12_WEBGL",i[i.DRAW_BUFFER13_WEBGL=34866]="DRAW_BUFFER13_WEBGL",i[i.DRAW_BUFFER14_WEBGL=34867]="DRAW_BUFFER14_WEBGL",i[i.DRAW_BUFFER15_WEBGL=34868]="DRAW_BUFFER15_WEBGL",i[i.MAX_COLOR_ATTACHMENTS_WEBGL=36063]="MAX_COLOR_ATTACHMENTS_WEBGL",i[i.MAX_DRAW_BUFFERS_WEBGL=34852]="MAX_DRAW_BUFFERS_WEBGL",i[i.VERTEX_ARRAY_BINDING_OES=34229]="VERTEX_ARRAY_BINDING_OES",i[i.QUERY_COUNTER_BITS_EXT=34916]="QUERY_COUNTER_BITS_EXT",i[i.CURRENT_QUERY_EXT=34917]="CURRENT_QUERY_EXT",i[i.QUERY_RESULT_EXT=34918]="QUERY_RESULT_EXT",i[i.QUERY_RESULT_AVAILABLE_EXT=34919]="QUERY_RESULT_AVAILABLE_EXT",i[i.TIME_ELAPSED_EXT=35007]="TIME_ELAPSED_EXT",i[i.TIMESTAMP_EXT=36392]="TIMESTAMP_EXT",i[i.GPU_DISJOINT_EXT=36795]="GPU_DISJOINT_EXT";var $f=qf(0,0,0,0),Fs=(qf(0,0,0,1),qf(1,1,1,0),qf(1,1,1,1));function Zf(t){return t&&0==(t&t-1)}function Qf(t,e){return null!=t?t:e}function Jf(t){return void 0===t?null:t}function tp(t,e,n){t.length=e,t.fill(n)}function ep(t,e){return((t+e-1)/e|0)*e}function np(t,e,n){n=function(t,e,n){for(var r=0,i=t.length;r<i;){var o=r+(i-r>>>1);n(e,t[o])<0?i=o:r=o+1}return r}(t,e,n);t.splice(n,0,e)}function rp(t,e,n){return n?t|=e:t&=~e,t}function ip(t,e){for(var n=new Array(t),r=0;r<t;r++)n[r]=e();return n}function op(t,n){return void 0===n&&(n=1),t.split("\n").map(function(t,e){return function(t,e,n){void 0===n&&(n="0");for(;t.length<e;)t=""+n+t;return t}(""+(n+e),4," ")+" "+t}).join("\n")}function ap(t,e){t.blendDstFactor=e.blendDstFactor,t.blendSrcFactor=e.blendSrcFactor,t.blendMode=e.blendMode}function sp(t,e){t.length!==e.length&&(t.length=e.length);for(var n,r,i=0;i<e.length;i++)t[i]=(n=t[i],r=e[i],ap((n=void 0===n?{rgbBlendState:{},alphaBlendState:{},channelWriteMask:0}:n).rgbBlendState,r.rgbBlendState),ap(n.alphaBlendState,r.alphaBlendState),n.channelWriteMask=r.channelWriteMask,n)}function lp(t,e){void 0!==e.attachmentsState&&sp(t.attachmentsState,e.attachmentsState),void 0!==e.blendConstant&&Yf(t.blendConstant,e.blendConstant),t.depthCompare=Qf(e.depthCompare,t.depthCompare),t.depthWrite=Qf(e.depthWrite,t.depthWrite),t.stencilCompare=Qf(e.stencilCompare,t.stencilCompare),t.stencilWrite=Qf(e.stencilWrite,t.stencilWrite),t.stencilPassOp=Qf(e.stencilPassOp,t.stencilPassOp),t.stencilRef=Qf(e.stencilRef,t.stencilRef),t.cullMode=Qf(e.cullMode,t.cullMode),t.frontFace=Qf(e.frontFace,t.frontFace),t.polygonOffset=Qf(e.polygonOffset,t.polygonOffset)}function up(t){var e=Object.assign({},t);return e.attachmentsState=[],sp(e.attachmentsState,t.attachmentsState),e.blendConstant=Kf(e.blendConstant),e}var n={blendMode:Ef.Add,blendSrcFactor:yf.One,blendDstFactor:yf.Zero},cp={attachmentsState:[{channelWriteMask:Cf.RGB,rgbBlendState:n,alphaBlendState:n}],blendConstant:Kf($f),depthWrite:!0,depthCompare:mf.LessEqual,stencilCompare:mf.Always,stencilWrite:!1,stencilPassOp:Pf.Keep,stencilRef:0,cullMode:vf.None,frontFace:mT.CCW,polygonOffset:!1};function hp(t,e){var n;return void 0===t.attachmentsState&&(t.attachmentsState=[],sp(t.attachmentsState,cp.attachmentsState)),n=t.attachmentsState[0],void 0!==(e=e).channelWriteMask&&(n.channelWriteMask=e.channelWriteMask),void 0!==e.rgbBlendMode&&(n.rgbBlendState.blendMode=e.rgbBlendMode),void 0!==e.alphaBlendMode&&(n.alphaBlendState.blendMode=e.alphaBlendMode),void 0!==e.rgbBlendSrcFactor&&(n.rgbBlendState.blendSrcFactor=e.rgbBlendSrcFactor),void 0!==e.alphaBlendSrcFactor&&(n.alphaBlendState.blendSrcFactor=e.alphaBlendSrcFactor),void 0!==e.rgbBlendDstFactor&&(n.rgbBlendState.blendDstFactor=e.rgbBlendDstFactor),void 0!==e.alphaBlendDstFactor&&(n.alphaBlendState.blendDstFactor=e.alphaBlendDstFactor),t}void 0===(Ua={depthCompare:mf.Always,depthWrite:!1})&&(Ua=null),ya=up(ya=void 0===(ya=cp)?cp:ya),null!==Ua&&lp(ya,Ua);var dp={formatKind:Of.Float,dimension:Rf.n2D};function fp(t,e,n){if(t.length===e.length){for(var r=0;r<t.length;r++)if(!n(t[r],e[r]))return;return 1}}function pp(t,e){for(var n=Array(t.length),r=0;r<t.length;r++)n[r]=e(t[r]);return n}function gp(t,e){return t.buffer===e.buffer&&t.wordCount===e.wordCount}function mp(t,e){return null===t?null===e:null!==e&&t.sampler===e.sampler&&t.texture===e.texture}function vp(t,e){return t.samplerBindings.length===e.samplerBindings.length&&!!fp(t.samplerBindings,e.samplerBindings,mp)&&!!fp(t.uniformBufferBindings,e.uniformBufferBindings,gp)&&!!_p(t.bindingLayout,e.bindingLayout)}function yp(t,e){return t.blendMode==e.blendMode&&t.blendSrcFactor===e.blendSrcFactor&&t.blendDstFactor===e.blendDstFactor}function Ep(t,e){return!!yp(t.rgbBlendState,e.rgbBlendState)&&!!yp(t.alphaBlendState,e.alphaBlendState)&&t.channelWriteMask===e.channelWriteMask}function _p(t,e){return t.numSamplers===e.numSamplers&&t.numUniformBuffers===e.numUniformBuffers}function bp(t,e){return t===e}function xp(t,e){var n,r;return t.topology===e.topology&&t.inputLayout===e.inputLayout&&t.sampleCount===e.sampleCount&&(n=t.megaStateDescriptor,r=e.megaStateDescriptor,!!(fp(n.attachmentsState,r.attachmentsState,Ep)&&Xf(n.blendConstant,r.blendConstant)&&n.depthCompare===r.depthCompare&&n.depthWrite===r.depthWrite&&n.stencilCompare===r.stencilCompare&&n.stencilWrite===r.stencilWrite&&n.stencilPassOp===r.stencilPassOp&&n.stencilRef===r.stencilRef&&n.cullMode===r.cullMode&&n.frontFace===r.frontFace&&n.polygonOffset===r.polygonOffset&&(n=t.program,r=e.program,n.id===r.id)&&fp(t.bindingLayouts,e.bindingLayouts,_p)&&fp(t.colorAttachmentFormats,e.colorAttachmentFormats,bp)&&t.depthStencilAttachmentFormat===e.depthStencilAttachmentFormat))}function Sp(t,e){return t.bufferIndex===e.bufferIndex&&t.bufferByteOffset===e.bufferByteOffset&&t.location===e.location&&t.format===e.format}function wp(t,e){return M(t)?M(e):!M(e)&&t.byteStride===e.byteStride&&t.frequency===e.frequency}function Tp(t,e){return t.indexBufferFormat===e.indexBufferFormat&&!!fp(t.vertexBufferDescriptors,e.vertexBufferDescriptors,wp)&&!!fp(t.vertexAttributeDescriptors,e.vertexAttributeDescriptors,Sp)}function Ap(t,e){return t.wrapS===e.wrapS&&t.wrapT===e.wrapT&&t.minFilter===e.minFilter&&t.magFilter===e.magFilter&&t.mipFilter===e.mipFilter&&t.minLOD===e.minLOD&&t.maxLOD===e.maxLOD&&t.maxAnisotropy===e.maxAnisotropy&&t.compareMode===e.compareMode}function Mp(t){return{sampler:t.sampler,texture:t.texture,lateBinding:t.lateBinding}}function Rp(t){return{buffer:t.buffer,wordCount:t.wordCount}}function Np(t){return{dimension:t.dimension,formatKind:t.formatKind}}function Cp(t){return{numSamplers:t.numSamplers,numUniformBuffers:t.numUniformBuffers,samplerEntries:void 0!==t.samplerEntries?pp(t.samplerEntries,Np):void 0}}function Pp(t){return{location:t.location,format:t.format,bufferIndex:t.bufferIndex,bufferByteOffset:t.bufferByteOffset,byteStride:t.byteStride,divisor:t.divisor}}function Op(t){return M(t)?t:{byteStride:t.byteStride,frequency:t.frequency}}(Sa=e1=e1||{})[Sa.LITTLE_ENDIAN=0]="LITTLE_ENDIAN",Sa[Sa.BIG_ENDIAN=1]="BIG_ENDIAN";var t=new Uint16Array([65279]),Ip=(255==new DataView(t.buffer).getUint8(0)?e1.LITTLE_ENDIAN:e1.BIG_ENDIAN,/([^[]*)(\[[0-9]+\])?/);function Lp(){var i=null;return function(t,e,n){var r=i!==n;return r&&(t.uniform1i(e,n),i=n),r}}function kp(s,l,u,c){var h=null,d=null;return function(t,e,n){var r=l(n,u),i=r.length,o=!1;if(null===h)h=new Float32Array(i),d=i,o=!0;else{T(d===i,"Uniform length cannot change.");for(var a=0;a<i;++a)if(r[a]!==h[a]){o=!0;break}}return o&&(c(t,s,e,r),h.set(r)),o}}function Dp(t,e,n,r){t[e](n,r)}function Bp(t,e,n,r){t[e](n,!1,r)}var Fp={},Up={},Gp={},Wp=[0];function Vp(t,e,n,r){1===e&&"boolean"==typeof t&&(t=t?1:0),Number.isFinite(t)&&(Wp[0]=t,t=Wp);var i=t.length;if(t instanceof n)return t;var o=r[i];o||(o=new n(i),r[i]=o);for(var a=0;a<i;a++)o[a]=t[a];return o}function jp(t,e){return Vp(t,e,Float32Array,Fp)}function zp(t,e){return Vp(t,e,Int32Array,Up)}function Hp(t,e){return Vp(t,e,Uint32Array,Gp)}(e={})[w.FLOAT]=kp.bind(null,"uniform1fv",jp,1,Dp),e[w.FLOAT_VEC2]=kp.bind(null,"uniform2fv",jp,2,Dp),e[w.FLOAT_VEC3]=kp.bind(null,"uniform3fv",jp,3,Dp),e[w.FLOAT_VEC4]=kp.bind(null,"uniform4fv",jp,4,Dp),e[w.INT]=kp.bind(null,"uniform1iv",zp,1,Dp),e[w.INT_VEC2]=kp.bind(null,"uniform2iv",zp,2,Dp),e[w.INT_VEC3]=kp.bind(null,"uniform3iv",zp,3,Dp),e[w.INT_VEC4]=kp.bind(null,"uniform4iv",zp,4,Dp),e[w.BOOL]=kp.bind(null,"uniform1iv",zp,1,Dp),e[w.BOOL_VEC2]=kp.bind(null,"uniform2iv",zp,2,Dp),e[w.BOOL_VEC3]=kp.bind(null,"uniform3iv",zp,3,Dp),e[w.BOOL_VEC4]=kp.bind(null,"uniform4iv",zp,4,Dp),e[w.FLOAT_MAT2]=kp.bind(null,"uniformMatrix2fv",jp,4,Bp),e[w.FLOAT_MAT3]=kp.bind(null,"uniformMatrix3fv",jp,9,Bp),e[w.FLOAT_MAT4]=kp.bind(null,"uniformMatrix4fv",jp,16,Bp),e[w.SAMPLER_2D]=Lp,e[w.SAMPLER_CUBE]=Lp,e[w.UNSIGNED_INT]=kp.bind(null,"uniform1uiv",Hp,1,Dp),e[w.UNSIGNED_INT_VEC2]=kp.bind(null,"uniform2uiv",Hp,2,Dp),e[w.UNSIGNED_INT_VEC3]=kp.bind(null,"uniform3uiv",Hp,3,Dp),e[w.UNSIGNED_INT_VEC4]=kp.bind(null,"uniform4uiv",Hp,4,Dp),e[w.FLOAT_MAT2x3]=kp.bind(null,"uniformMatrix2x3fv",jp,6,Bp),e[w.FLOAT_MAT2x4]=kp.bind(null,"uniformMatrix2x4fv",jp,8,Bp),e[w.FLOAT_MAT3x2]=kp.bind(null,"uniformMatrix3x2fv",jp,6,Bp),e[w.FLOAT_MAT3x4]=kp.bind(null,"uniformMatrix3x4fv",jp,12,Bp),e[w.FLOAT_MAT4x2]=kp.bind(null,"uniformMatrix4x2fv",jp,8,Bp),e[w.FLOAT_MAT4x3]=kp.bind(null,"uniformMatrix4x3fv",jp,12,Bp),e[w.SAMPLER_2D]=Lp,e[w.SAMPLER_CUBE]=Lp,e[w.SAMPLER_3D]=Lp,e[w.SAMPLER_2D_SHADOW]=Lp,e[w.SAMPLER_2D_ARRAY]=Lp,e[w.SAMPLER_2D_ARRAY_SHADOW]=Lp,e[w.SAMPLER_CUBE_SHADOW]=Lp,e[w.INT_SAMPLER_2D]=Lp,e[w.INT_SAMPLER_3D]=Lp,e[w.INT_SAMPLER_CUBE]=Lp,e[w.INT_SAMPLER_2D_ARRAY]=Lp,e[w.UNSIGNED_INT_SAMPLER_2D]=Lp,e[w.UNSIGNED_INT_SAMPLER_3D]=Lp,e[w.UNSIGNED_INT_SAMPLER_CUBE]=Lp,e[w.UNSIGNED_INT_SAMPLER_2D_ARRAY]=Lp;var Xp=e;function Yp(t,e,n){var r=Xp[n.type];if(r)return r().bind(null,t,e);throw new Error("Unknown GLSL uniform type "+n.type)}var Kp=[[/\btexture(2D|2DProj|Cube)Lod\(/g,"texture$1LodEXT("],[/\btexture\(/g,"texture2D("],[/\btextureLod\(/g,"texture2DLodEXT("]];function qp(t,e){return"#define "+t+" "+e}function $p(t){var o=[],a=[];return t.replace(/\s*struct\s*(.*)\s*{((?:\s*.*\s*)*?)};/g,function(t,e,n){var r=[];return n.trim().split("\n").forEach(function(t){var t=t.trim().split(/\s+/),e=t[0],t=t[1];r.push({type:e.trim(),name:t.replace(";","").trim()})}),a.push({type:e.trim(),uniforms:r}),""}),t.replace(/\s*uniform\s*.*\s*{((?:\s*.*\s*)*?)};/g,function(t,e){return e.trim().split("\n").forEach(function(t){var t=t.trim().split(" "),e=t[0]||"",t=-1<(n=t[1]||"").indexOf("["),n=n.replace(";","").replace("[","").trim();if(!e.startsWith("#")){if(e){var r=a.find(function(t){return e===t.type});if(r)if(t)for(var i=0;i<5;i++)!function(e){r.uniforms.forEach(function(t){o.push(n+"["+e+"]."+t.name)})}(i);else r.uniforms.forEach(function(t){o.push(n+"."+t.name)})}n&&o.push(n)}}),""}),o}function Zp(t,n,e,r){void 0===r&&(r=null);var i,o,a,s,l="#version 100"===t.glslVersion,e=e.split("\n").map(function(t){return t.replace(/[/][/].*$/,"")}).filter(function(t){return!(!t||/^\s+$/.test(t))}),u="",c=(null!==r&&(u=Object.keys(r).map(function(t){return qp(t,r[t])}).join("\n")),e.find(function(t){return t.startsWith("precision")})||"precision mediump float;"),e=e.filter(function(t){return!t.startsWith("precision")}).join("\n"),h="",d=(t.viewportOrigin===If.UpperLeft&&(h+="#define VIEWPORT_ORIGIN_TL 1\n"),t.clipSpaceNearZ===Lf.Zero&&(h+="#define CLIPSPACE_NEAR_ZERO 1\n"),t.explicitBindingLocations&&(a=o=i=0,e=e.replace(/^(layout\((.*)\))?\s*uniform(.+{)$/gm,function(t,e,n,r){return"layout("+(n?n+", ":"")+"set = "+i+", binding = "+o+++") uniform "+r}),i++,o=0,T(t.separateSamplerTextures),e=(e=e.replace(/uniform sampler2D (.*);/g,function(t,e){return"frag"===n?"\nlayout(set = "+i+", binding = "+o+++") uniform texture2D T_"+e+";\nlayout(set = "+i+", binding = "+o+++") uniform sampler S_"+e+";\n":""})).replace("frag"===n?/^\b(varying|in)\b/gm:/^\b(varying|out)\b/gm,function(t,e){return"layout(location = "+a+++") "+e}),h+="#define gl_VertexID gl_VertexIndex\n"),e=t.separateSamplerTextures?(e=(e=(e=e.replace(/\bPD_SAMPLER_2D\((.*?)\)/g,function(t,e){return"texture2D T_P_"+e+", sampler S_P_"+e})).replace(/\bPU_SAMPLER_2D\((.*?)\)/g,function(t,e){return"SAMPLER_2D(P_"+e+")"})).replace(/\bPP_SAMPLER_2D\((.*?)\)/g,function(t,e){return"T_"+e+", S_"+e})).replace(/\bSAMPLER_2D\((.*?)\)/g,function(t,e){return"sampler2D(T_"+e+", S_"+e+")"}):(e=(e=(e=e.replace(/\bPD_SAMPLER_2D\((.*?)\)/g,function(t,e){return"sampler2D P_"+e})).replace(/\bPU_SAMPLER_2D\((.*?)\)/g,function(t,e){return"SAMPLER_2D(P_"+e+")"})).replace(/\bPP_SAMPLER_2D\((.*?)\)/g,function(t,e){return e})).replace(/\bSAMPLER_2D\((.*?)\)/g,function(t,e){return e}),((l?"":t.glslVersion)+"\n\n"+(l&&"frag"===n?"#extension GL_OES_standard_derivatives : enable":"")+"\n"+c+"\n"+h+"\n"+u+"\n"+e+"\n").trim());if(t.explicitBindingLocations&&"frag"===n&&(d=d.replace(/^\b(out)\b/gm,function(t,e){return"layout(location = 0) "+e})),l){"frag"===n&&(d=d.replace(/^\s*in\s+(\S+)\s*(.*);$/gm,function(t,e,n){return"varying "+e+" "+n+";\n"})),d=(d="vert"===n?(d=d.replace(/^\s*out\s+(\S+)\s*(.*);$/gm,function(t,e,n){return"varying "+e+" "+n+";\n"})).replace(/^\s*layout\(location\s*=\s*\S*\)\s*in\s+(\S+)\s*(.*);$/gm,function(t,e,n){return"attribute "+e+" "+n+";\n"}):d).replace(/\s*uniform\s*.*\s*{((?:\s*.*\s*)*?)};/g,function(t,e){return e.trim().replace(/^.*$/gm,function(t){var e=t.trim();return e.startsWith("#")?e:t?"uniform "+e:""})}),"frag"===n&&(c=(d=d.replace(/^\s*out\s+(\S+)\s*(.*);$/gm,function(t,e,n){return e+" "+(s=n)+";\n"})).lastIndexOf("}"),d=d.substring(0,c)+"\n gl_FragColor = vec4("+s+");\n"+d.substring(c)),d=d.replace(/^\s*layout\((.*)\)/gm,"");for(var f=ff(Kp);!(p=f()).done;){var p=p.value,g=p[0],p=p[1];d=d.replace(g,p)}}return d}function Qp(t,e){var n=void 0!==e.defines?e.defines:null,r=(void 0!==e.features&&e.features,void 0!==e.both?e.both+e.vert:e.vert),e=void 0!==e.both?e.both+e.frag:e.frag;return t=t.queryVendorInfo(),{vert:r,frag:e=e,preprocessedVert:Zp(t,"vert",r,r=void 0===(r=n)?null:r),preprocessedFrag:Zp(t,"frag",e,r)}}var Jp=function(){function t(){this.name="(unnamed)",this.preprocessedVert="",this.preprocessedFrag="",this.both="",this.vert="",this.frag="",this.defines={},this.features={MRT:!0}}var e=t.prototype;return e.definesChanged=function(){this.preprocessedVert="",this.preprocessedFrag=""},e.setDefineString=function(t,e){if(null!==e){if(this.defines[t]===e)return!1;this.defines[t]=e}else{if(M(this.defines[t]))return!1;delete this.defines[t]}return this.definesChanged(),!0},e.setDefineBool=function(t,e){return this.setDefineString(t,e?"1":null)},e.getDefineString=function(t){return Jf(this.defines[t])},e.getDefineBool=function(t){t=this.getDefineString(t);return null!==t&&T("1"===t),null!==t},e.ensurePreprocessed=function(t){""===this.preprocessedVert&&(this.preprocessedVert=Zp(t,"vert",this.both+this.vert,this.defines,this.features),this.preprocessedFrag=Zp(t,"frag",this.both+this.frag,this.defines,this.features))},t}(),tg=function(){function t(t){this.device=void 0,this.uniformBufferWordAlignment=void 0,this.uniformBufferMaxPageWordSize=void 0,this.currentBufferWordSize=-1,this.currentWordOffset=0,this.buffer=null,this.shadowBufferF32=null,this.shadowBufferU8=null;t=(this.device=t).queryLimits();this.uniformBufferWordAlignment=t.uniformBufferWordAlignment,this.uniformBufferMaxPageWordSize=t.uniformBufferMaxPageWordSize}var e=t.prototype;return e.isSupportedUBO=function(){return"WebGL1"!==this.device.queryVendorInfo().platformString},e.findPageIndex=function(t){return t/this.uniformBufferMaxPageWordSize|0},e.allocateChunk=function(t){T((t=ep(t,this.uniformBufferWordAlignment))<this.uniformBufferMaxPageWordSize);var e=this.currentWordOffset;return this.findPageIndex(e)!==this.findPageIndex(e+t-1)&&(e=ep(e,this.uniformBufferMaxPageWordSize)),this.currentWordOffset=e+t,this.ensureShadowBuffer(e,t),e},e.ensureShadowBuffer=function(t,e){if(null===this.shadowBufferU8||null===this.shadowBufferF32){var n=ep(this.currentWordOffset,this.uniformBufferMaxPageWordSize);this.shadowBufferU8=new Uint8Array(4*n),this.shadowBufferF32=new Float32Array(this.shadowBufferU8.buffer)}else if(t+e>=this.shadowBufferF32.length){T(t<this.currentWordOffset&&t+e<=this.currentWordOffset);n=ep(Math.max(this.currentWordOffset,2*this.shadowBufferF32.length),this.uniformBufferMaxPageWordSize),t=new Uint8Array(4*n);if(t.set(this.shadowBufferU8,0),this.shadowBufferU8=t,this.shadowBufferF32=new Float32Array(this.shadowBufferU8.buffer),!(this.currentWordOffset<=n))throw new Error("Assert fail: this.currentWordOffset ["+this.currentWordOffset+"] <= newWordCount ["+n+"]")}},e.mapBufferF32=function(){return Hf(this.shadowBufferF32)},e.prepareToRender=function(){if(null!==this.shadowBufferF32){var t=Hf(this.shadowBufferF32),t=(t.length!==this.currentBufferWordSize&&(this.currentBufferWordSize=t.length,null!==this.buffer&&this.buffer.destroy(),this.buffer=this.device.createBuffer({viewOrSize:this.currentBufferWordSize,usage:wf.UNIFORM|wf.COPY_DST,hint:Tf.Dynamic})),ep(this.currentWordOffset,this.uniformBufferMaxPageWordSize));if(!(t<=this.currentBufferWordSize))throw new Error("Assert fail: wordCount ["+t+"] ("+this.currentWordOffset+" aligned "+this.uniformBufferMaxPageWordSize+") <= this.currentBufferWordSize ["+this.currentBufferWordSize+"]");this.isSupportedUBO()&&Hf(this.buffer).setSubData(0,this.shadowBufferU8,0,4*t),this.currentWordOffset=0}},e.destroy=function(){null!==this.buffer&&this.buffer.destroy(),this.shadowBufferF32=null,this.shadowBufferU8=null},t}();function eg(t,e){return(t=(t=(t+=e)+(t<<10))+(t>>>6))>>>0}function ng(t){return(t=(t=(t+=t<<3)^t>>>11)+(t<<15))>>>0}function rg(t){return 0}function ig(){this.keys=[],this.values=[]}var og=function(){function t(t,e){this.keyEqualFunc=void 0,this.keyHashFunc=void 0,this.buckets=new Map,this.keyEqualFunc=t,this.keyHashFunc=e}var e=t.prototype;return e.findBucketIndex=function(t,e){for(var n=0;n<t.keys.length;n++)if(this.keyEqualFunc(e,t.keys[n]))return n;return-1},e.findBucket=function(t){t=this.keyHashFunc(t);return this.buckets.get(t)},e.get=function(t){var e=this.findBucket(t);return void 0===e||(t=this.findBucketIndex(e,t))<0?null:e.values[t]},e.add=function(t,e){var n=this.keyHashFunc(t),n=(void 0===this.buckets.get(n)&&this.buckets.set(n,new ig),this.buckets.get(n));n.keys.push(t),n.values.push(e)},e.delete=function(t){var e=this.findBucket(t);void 0!==e&&-1!==(t=this.findBucketIndex(e,t))&&(e.keys.splice(t,1),e.values.splice(t,1))},e.clear=function(){this.buckets.clear()},e.size=function(){for(var t,e=0,n=ff(this.buckets.values());!(t=n()).done;)e+=t.value.values.length;return e},e.values=ef().mark(function t(){var e,n,r;return ef().wrap(function(t){for(;;)switch(t.prev=t.next){case 0:e=ff(this.buckets.values());case 1:if((n=e()).done){t.next=12;break}n=n.value,r=n.values.length-1;case 4:if(0<=r)return t.next=7,n.values[r];t.next=10;break;case 7:r--,t.next=4;break;case 10:t.next=1;break;case 12:case"end":return t.stop()}},t,this)}),t}();function ag(t,e){return T(""!==t.preprocessedVert&&""!==e.preprocessedVert),T(""!==t.preprocessedFrag&&""!==e.preprocessedFrag),t.preprocessedVert===e.preprocessedVert&&t.preprocessedFrag===e.preprocessedFrag}function sg(t,e){return t=eg(t,e.blendMode),t=eg(t,e.blendSrcFactor),t=eg(t,e.blendDstFactor)}function lg(t,e){for(var n,r,i,o,a=0;a<e.attachmentsState.length;a++)n=t,r=e.attachmentsState[a],n=sg(n,r.rgbBlendState),t=n=eg(n=sg(n,r.alphaBlendState),r.channelWriteMask);return i=t,o=e.blendConstant,t=i=eg(i,o.r<<24|o.g<<16|o.b<<8|o.a),t=eg(t,e.depthCompare),t=eg(t,e.depthWrite?1:0),t=eg(t,e.stencilCompare),t=eg(t,e.stencilPassOp),t=eg(t,e.stencilWrite?1:0),t=eg(t,e.cullMode),t=eg(t,e.frontFace?1:0),t=eg(t,e.polygonOffset?1:0)}function ug(t){var e=eg(e=0,t.program.id);null!==t.inputLayout&&(e=eg(e,t.inputLayout.id));for(var n,r,i=0;i<t.bindingLayouts.length;i++)n=e,r=t.bindingLayouts[i],n=eg(n,r.numUniformBuffers),e=n=eg(n,r.numSamplers);e=lg(e,t.megaStateDescriptor);for(var o=0;o<t.colorAttachmentFormats.length;o++)e=eg(e,t.colorAttachmentFormats[o]||0);return ng(e=eg(e,t.depthStencilAttachmentFormat||0))}function cg(t){for(var e=0,n=0;n<t.samplerBindings.length;n++){var r=t.samplerBindings[n];null!==r&&null!==r.texture&&(e=eg(e,r.texture.id))}for(var i=0;i<t.uniformBufferBindings.length;i++){var o=t.uniformBufferBindings[i];null!==o&&null!==o.buffer&&(e=eg(e,o.buffer.id),e=eg(e,o.wordCount))}return ng(e)}function hg(){this.renderTargetDescriptions=[],this.resolveTextureRenderTargetIDs=[],this.passes=[],this.renderTargetDebugNames=[]}var dg,fg,pg,gg=function(){function t(t){this.device=void 0,this.bindingsCache=new og(vp,cg),this.renderPipelinesCache=new og(xp,ug),this.inputLayoutsCache=new og(Tp,rg),this.programCache=new og(ag,rg),this.samplerCache=new og(Ap,rg),this.device=t}var e=t.prototype;return e.createBindings=function(t){var e=this.bindingsCache.get(t);return null===e&&(t={bindingLayout:(t=t).bindingLayout,samplerBindings:pp(t.samplerBindings,Mp),uniformBufferBindings:pp(t.uniformBufferBindings,Rp),pipeline:t.pipeline},e=this.device.createBindings(t),this.bindingsCache.add(t,e)),e},e.createRenderPipeline=function(t){var e,n,r,i,o=this.renderPipelinesCache.get(t);return null===o&&(e=pp((t=t).bindingLayouts,Cp),n=t.inputLayout,r=t.program,i=t.topology,e={bindingLayouts:e,inputLayout:n,megaStateDescriptor:up(t.megaStateDescriptor),program:r,topology:i,colorAttachmentFormats:t.colorAttachmentFormats.slice(),depthStencilAttachmentFormat:t.depthStencilAttachmentFormat,sampleCount:t.sampleCount},o=this.device.createRenderPipeline(e),this.renderPipelinesCache.add(e,o)),o},e.createInputLayout=function(t){var e=this.inputLayoutsCache.get(t);return null===e&&(t={vertexAttributeDescriptors:pp((t=t).vertexAttributeDescriptors,Pp),vertexBufferDescriptors:pp(t.vertexBufferDescriptors,Op),indexBufferFormat:t.indexBufferFormat},e=this.device.createInputLayout(t),this.inputLayoutsCache.add(t,e)),e},e.createProgramSimple=function(t){var e=this.programCache.get(t);return null===e&&(t={preprocessedVert:t.preprocessedVert,preprocessedFrag:t.preprocessedFrag,vert:t.vert,frag:t.frag},e=this.device.createProgramSimple(t),this.programCache.add(t,e)),e},e.createProgram=function(t){return t.ensurePreprocessed(this.device.queryVendorInfo()),this.createProgramSimple(t)},e.createSampler=function(t){var e=this.samplerCache.get(t);return null===e&&(e=this.device.createSampler(t),this.samplerCache.add(t,e)),e},e.destroy=function(){for(var t,e=ff(this.bindingsCache.values());!(t=e()).done;)t.value.destroy();for(var n,r=ff(this.renderPipelinesCache.values());!(n=r()).done;)n.value.destroy();for(var i,o=ff(this.inputLayoutsCache.values());!(i=o()).done;)i.value.destroy();for(var a,s=ff(this.programCache.values());!(a=s()).done;)a.value.destroy();for(var l,u=ff(this.samplerCache.values());!(l=u()).done;)l.value.destroy();this.bindingsCache.clear(),this.renderPipelinesCache.clear(),this.inputLayoutsCache.clear(),this.programCache.clear(),this.samplerCache.clear()},t}(),mg=((Us=dg=dg||{})[Us.Color0=0]="Color0",Us[Us.Color1=1]="Color1",Us[Us.Color2=2]="Color2",Us[Us.Color3=3]="Color3",Us[Us.ColorMax=3]="ColorMax",Us[Us.DepthStencil=4]="DepthStencil",{x:0,y:0,w:1,h:1}),vg=function(){function t(){this.renderTargetIDs=[],this.resolveTextureOutputIDs=[],this.resolveTextureOutputExternalTextures=[],this.resolveTextureInputIDs=[],this.renderTargetExtraRefs=[],this.viewport=mg,this.resolveTextureInputTextures=[],this.renderTargets=[],this.descriptor={colorAttachment:[],colorResolveTo:[],colorStore:[],depthStencilAttachment:null,depthStencilResolveTo:null,depthStencilStore:!0,colorClearColor:["load"],depthClearValue:"load",stencilClearValue:"load",occlusionQueryPool:null},this.viewportX=0,this.viewportY=0,this.viewportW=0,this.viewportH=0,this.execFunc=null,this.postFunc=null,this.debugName=void 0,this.debugThumbnails=[]}var e=t.prototype;return e.setDebugName=function(t){this.debugName=t},e.pushDebugThumbnail=function(t){this.debugThumbnails[t]=!0},e.setViewport=function(t){this.viewport=t},e.attachRenderTargetID=function(t,e){T(void 0===this.renderTargetIDs[t]),this.renderTargetIDs[t]=e},e.attachResolveTexture=function(t){this.resolveTextureInputIDs.push(t)},e.attachOcclusionQueryPool=function(t){this.descriptor.occlusionQueryPool=t},e.resolveToExternalTexture=function(t,e){this.resolveTextureOutputExternalTextures[t]=e},e.exec=function(t){T(null===this.execFunc),this.execFunc=t},e.post=function(t){T(null===this.postFunc),this.postFunc=t},e.addExtraRef=function(t){this.renderTargetExtraRefs[t]=!0},t}(),yg=function(){function t(t,e){this.debugName=void 0,this.dimension=Rf.n2D,this.depth=1,this.numLevels=1,this.pixelFormat=void 0,this.width=0,this.height=0,this.sampleCount=0,this.usage=Nf.RenderTarget,this.immutable=!0,this.needsClear=!0,this.texture=null,this.attachment=void 0,this.age=0,this.pixelFormat=e.pixelFormat,this.width=e.width,this.height=e.height,this.sampleCount=e.sampleCount,T(1<=this.sampleCount),1<this.sampleCount?this.attachment=t.createRenderTarget(this):(this.texture=t.createTexture(this),this.attachment=t.createRenderTargetFromTexture(this.texture))}var e=t.prototype;return e.setDebugName=function(t,e){this.debugName=e,null!==this.texture&&t.setResourceName(this.texture,this.debugName),t.setResourceName(this.attachment,this.debugName)},e.matchesDescription=function(t){return this.pixelFormat===t.pixelFormat&&this.width===t.width&&this.height===t.height&&this.sampleCount===t.sampleCount},e.reset=function(t){T(this.matchesDescription(t)),this.age=0},e.destroy=function(){null!==this.texture&&this.texture.destroy(),this.attachment.destroy()},t}(),Eg=function(){function t(t,e){this.dimension=Rf.n2D,this.depth=1,this.numLevels=1,this.usage=Nf.RenderTarget,this.pixelFormat=void 0,this.width=0,this.height=0,this.texture=void 0,this.age=0,this.immutable=!0,this.pixelFormat=e.pixelFormat,this.width=e.width,this.height=e.height,this.texture=t.createTexture(this)}var e=t.prototype;return e.matchesDescription=function(t){return this.pixelFormat===t.pixelFormat&&this.width===t.width&&this.height===t.height},e.reset=function(t){T(this.matchesDescription(t)),this.age=0},e.destroy=function(){this.texture.destroy()},t}(),_g=function(){function t(t){this.device=void 0,this.currentPass=null,this.renderTargetDeadPool=[],this.singleSampledTextureDeadPool=[],this.currentGraph=null,this.renderTargetOutputCount=[],this.renderTargetResolveCount=[],this.resolveTextureUseCount=[],this.renderTargetAliveForID=[],this.singleSampledTextureForResolveTextureID=[],this.device=t}var e=t.prototype;return e.acquireRenderTargetForDescription=function(t){for(var e=0;e<this.renderTargetDeadPool.length;e++){var n=this.renderTargetDeadPool[e];if(n.matchesDescription(t))return n.reset(t),this.renderTargetDeadPool.splice(e--,1),n}return new yg(this.device,t)},e.acquireSingleSampledTextureForDescription=function(t){for(var e=0;e<this.singleSampledTextureDeadPool.length;e++){var n=this.singleSampledTextureDeadPool[e];if(n.matchesDescription(t))return n.reset(t),this.singleSampledTextureDeadPool.splice(e--,1),n}return new Eg(this.device,t)},e.beginGraphBuilder=function(){T(null===this.currentGraph),this.currentGraph=new hg},e.pushPass=function(t){var e=new vg;t(e),this.currentGraph.passes.push(e)},e.createRenderTargetID=function(t,e){return this.currentGraph.renderTargetDebugNames.push(e),this.currentGraph.renderTargetDescriptions.push(t)-1},e.createResolveTextureID=function(t){return this.currentGraph.resolveTextureRenderTargetIDs.push(t)-1},e.findMostRecentPassThatAttachedRenderTarget=function(t){for(var e=this.currentGraph.passes.length-1;0<=e;e--){var n=this.currentGraph.passes[e];if(n.renderTargetIDs.includes(t))return n}return null},e.resolveRenderTargetPassAttachmentSlot=function(t,e){var n;return void 0===t.resolveTextureOutputIDs[e]&&(n=t.renderTargetIDs[e],n=this.createResolveTextureID(n),t.resolveTextureOutputIDs[e]=n),t.resolveTextureOutputIDs[e]},e.findPassForResolveRenderTarget=function(t){var e=Hf(this.findMostRecentPassThatAttachedRenderTarget(t)),t=e.renderTargetIDs.indexOf(t);return T(void 0===e.resolveTextureOutputExternalTextures[t]),e},e.resolveRenderTarget=function(t){var e=this.findPassForResolveRenderTarget(t),t=e.renderTargetIDs.indexOf(t);return this.resolveRenderTargetPassAttachmentSlot(e,t)},e.resolveRenderTargetToExternalTexture=function(t,e){var n=this.findPassForResolveRenderTarget(t),t=n.renderTargetIDs.indexOf(t);T(void 0===n.resolveTextureOutputIDs[t]),n.resolveTextureOutputExternalTextures[t]=e},e.getRenderTargetDescription=function(t){return Hf(this.currentGraph.renderTargetDescriptions[t])},e.scheduleAddUseCount=function(t,e){for(var n=0;n<e.renderTargetIDs.length;n++){var r=e.renderTargetIDs[n];void 0!==r&&(this.renderTargetOutputCount[r]++,e.renderTargetExtraRefs[n])&&this.renderTargetOutputCount[r]++}for(var i=0;i<e.resolveTextureInputIDs.length;i++){var o=e.resolveTextureInputIDs[i];void 0!==o&&(this.resolveTextureUseCount[o]++,o=t.resolveTextureRenderTargetIDs[o],this.renderTargetResolveCount[o]++)}},e.acquireRenderTargetForID=function(t,e){var n;return void 0===e?null:(T(0<this.renderTargetOutputCount[e]),this.renderTargetAliveForID[e]||(n=t.renderTargetDescriptions[e],(n=this.acquireRenderTargetForDescription(n)).setDebugName(this.device,t.renderTargetDebugNames[e]),this.renderTargetAliveForID[e]=n),this.renderTargetAliveForID[e])},e.releaseRenderTargetForID=function(t,e){var n;return void 0===t?null:(n=Hf(this.renderTargetAliveForID[t]),e?(T(0<this.renderTargetOutputCount[t]),this.renderTargetOutputCount[t]--):(T(0<this.renderTargetResolveCount[t]),this.renderTargetResolveCount[t]--),0===this.renderTargetOutputCount[t]&&0===this.renderTargetResolveCount[t]&&(n.needsClear=!0,delete this.renderTargetAliveForID[t],this.renderTargetDeadPool.push(n)),n)},e.acquireResolveTextureInputTextureForID=function(t,e){var n,t=t.resolveTextureRenderTargetIDs[e],t=(T(0<this.resolveTextureUseCount[e]),this.resolveTextureUseCount[e]--,Hf(this.releaseRenderTargetForID(t,!1)));return void 0!==this.singleSampledTextureForResolveTextureID[e]?(n=this.singleSampledTextureForResolveTextureID[e],0===this.resolveTextureUseCount[e]&&this.singleSampledTextureDeadPool.push(n),n.texture):Hf(t.texture)},e.determineResolveParam=function(t,e,n){var r=e.renderTargetIDs[n],i=e.resolveTextureOutputIDs[n],e=e.resolveTextureOutputExternalTextures[n],n=void 0!==i,o=void 0!==e,a=(T(!(n&&o)),null),s=!1;return 1<this.renderTargetOutputCount[r]&&(s=!0),n?(T(t.resolveTextureRenderTargetIDs[i]===r),T(0<this.resolveTextureUseCount[i]),T(0<this.renderTargetOutputCount[r]),null!==(n=Hf(this.renderTargetAliveForID[r])).texture&&1===this.renderTargetOutputCount[r]?s=!(a=null):(this.singleSampledTextureForResolveTextureID[i]||(t=Hf(t.renderTargetDescriptions[r]),this.singleSampledTextureForResolveTextureID[i]=this.acquireSingleSampledTextureForDescription(t),this.device.setResourceName(this.singleSampledTextureForResolveTextureID[i].texture,n.debugName+" (Resolve "+i+")")),a=this.singleSampledTextureForResolveTextureID[i].texture)):a=o?e:null,{resolveTo:a,store:s}},e.schedulePass=function(t,e){for(var n=e.renderTargetIDs[dg.DepthStencil],r=dg.Color0;r<=dg.ColorMax;r++){var i=e.renderTargetIDs[r],o=this.acquireRenderTargetForID(t,i),a=(e.renderTargets[r]=o,e.descriptor.colorAttachment[r]=null!==o?o.attachment:null,this.determineResolveParam(t,e,r)),s=a.resolveTo,a=a.store;e.descriptor.colorResolveTo[r]=s,e.descriptor.colorStore[r]=a,e.descriptor.colorClearColor[r]=null!==o&&o.needsClear?t.renderTargetDescriptions[i].colorClearColor:"load"}for(var l=this.acquireRenderTargetForID(t,n),u=(e.renderTargets[dg.DepthStencil]=l,e.descriptor.depthStencilAttachment=null!==l?l.attachment:null,this.determineResolveParam(t,e,dg.DepthStencil)),c=u.resolveTo,u=u.store,h=(e.descriptor.depthStencilResolveTo=c,e.descriptor.depthStencilStore=u,e.descriptor.depthClearValue=null!==l&&l.needsClear?t.renderTargetDescriptions[n].depthClearValue:"load",e.descriptor.stencilClearValue=null!==l&&l.needsClear?t.renderTargetDescriptions[n].stencilClearValue:"load",0),d=0,f=0,p=0;p<e.renderTargets.length;p++){var g=e.renderTargets[p];g&&(0===h&&(h=g.width,d=g.height,f=g.sampleCount),T(g.width===h),T(g.height===d),T(g.sampleCount===f),g.needsClear=!1)}0<h&&0<d&&(c=h*e.viewport.x,u=d*e.viewport.y,l=h*e.viewport.w,n=d*e.viewport.h,e.viewportX=c,e.viewportY=u,e.viewportW=l,e.viewportH=n);for(var m=0;m<e.resolveTextureInputIDs.length;m++){var v=e.resolveTextureInputIDs[m];e.resolveTextureInputTextures[m]=this.acquireResolveTextureInputTextureForID(t,v)}for(var y=0;y<e.renderTargetIDs.length;y++)this.releaseRenderTargetForID(e.renderTargetIDs[y],!0);for(var E=0;E<e.renderTargetExtraRefs.length;E++)e.renderTargetExtraRefs[E]&&this.releaseRenderTargetForID(e.renderTargetIDs[E],!0)},e.scheduleGraph=function(t){T(0===this.renderTargetOutputCount.length),T(0===this.renderTargetResolveCount.length),T(0===this.resolveTextureUseCount.length);for(var e=0;e<this.renderTargetDeadPool.length;e++)this.renderTargetDeadPool[e].age++;for(var n=0;n<this.singleSampledTextureDeadPool.length;n++)this.singleSampledTextureDeadPool[n].age++;tp(this.renderTargetOutputCount,t.renderTargetDescriptions.length,0),tp(this.renderTargetResolveCount,t.renderTargetDescriptions.length,0),tp(this.resolveTextureUseCount,t.resolveTextureRenderTargetIDs.length,0);for(var r=0;r<t.passes.length;r++)this.scheduleAddUseCount(t,t.passes[r]);for(var i=0;i<t.passes.length;i++)this.schedulePass(t,t.passes[i]);for(var o=0;o<this.renderTargetOutputCount.length;o++)T(0===this.renderTargetOutputCount[o]);for(var a=0;a<this.renderTargetResolveCount.length;a++)T(0===this.renderTargetResolveCount[a]);for(var s=0;s<this.resolveTextureUseCount.length;s++)T(0===this.resolveTextureUseCount[s]);for(var l=0;l<this.renderTargetAliveForID.length;l++)T(void 0===this.renderTargetAliveForID[l]);for(var u=0;u<this.renderTargetDeadPool.length;u++)1<=this.renderTargetDeadPool[u].age&&(this.renderTargetDeadPool[u].destroy(),this.renderTargetDeadPool.splice(u--,1));for(var c=0;c<this.singleSampledTextureDeadPool.length;c++)1<=this.singleSampledTextureDeadPool[c].age&&(this.singleSampledTextureDeadPool[c].destroy(),this.singleSampledTextureDeadPool.splice(c--,1));this.renderTargetResolveCount.length=0,this.renderTargetOutputCount.length=0,this.resolveTextureUseCount.length=0},e.execPass=function(t){T(null===this.currentPass),this.currentPass=t;var e=this.device.createRenderPass(t.descriptor);e.beginDebugGroup(t.debugName),e.setViewport(t.viewportX,t.viewportY,t.viewportW,t.viewportH),null!==t.execFunc&&t.execFunc(e,this),e.endDebugGroup(),this.device.submitPass(e),null!==t.postFunc&&t.postFunc(this),this.currentPass=null},e.execGraph=function(t){var e=this;this.scheduleGraph(t),t.passes.forEach(function(t){e.execPass(t)}),this.singleSampledTextureForResolveTextureID.length=0},e.execute=function(){var t=Hf(this.currentGraph);this.execGraph(t),this.currentGraph=null},e.getDebug=function(){return this},e.getPasses=function(){return this.currentGraph.passes},e.getPassDebugThumbnails=function(t){return t.debugThumbnails},e.getPassRenderTargetID=function(t,e){return t.renderTargetIDs[e]},e.getRenderTargetIDDebugName=function(t){return this.currentGraph.renderTargetDebugNames[t]},e.getResolveTextureForID=function(t){var e=this.currentPass,t=e.resolveTextureInputIDs.indexOf(t);return T(0<=t),Hf(e.resolveTextureInputTextures[t])},e.getRenderTargetAttachment=function(t){t=this.currentPass.renderTargets[t];return t?t.attachment:null},e.getRenderTargetTexture=function(t){t=this.currentPass.renderTargets[t];return t?t.texture:null},e.newGraphBuilder=function(){return this.beginGraphBuilder(),this},e.destroy=function(){for(var t=0;t<this.renderTargetAliveForID.length;t++)T(void 0===this.renderTargetAliveForID[t]);for(var e=0;e<this.singleSampledTextureForResolveTextureID.length;e++)T(void 0===this.singleSampledTextureForResolveTextureID[e]);for(var n=0;n<this.renderTargetDeadPool.length;n++)this.renderTargetDeadPool[n].destroy();for(var r=0;r<this.singleSampledTextureDeadPool.length;r++)this.singleSampledTextureDeadPool[r].destroy()},t}();(pa=fg=fg||{})[pa.BACKGROUND=0]="BACKGROUND",pa[pa.ALPHA_TEST=16]="ALPHA_TEST",pa[pa.OPAQUE=32]="OPAQUE",pa[pa.TRANSLUCENT=128]="TRANSLUCENT",Z(1,0,0,0,0,1,0,0,0,0,2,0,0,0,-1,1),Z(1,0,0,0,0,1,0,0,0,0,.5,0,0,0,.5,1),(l=pg=pg||{})[l.Indexed=1]="Indexed",l[l.AllowSkippingIfPipelineNotReady=2]="AllowSkippingIfPipelineNotReady",l[l.Template=4]="Template",l[l.Draw=8]="Draw",l[l.InheritedFlags=3]="InheritedFlags";var bg,xg=function(){function t(){this.sortKey=0,this.debug=null,this.renderPipelineDescriptor=void 0,this.uniformBuffer=void 0,this.uniforms=[],this.bindingDescriptors=ip(1,function(){return{bindingLayout:null,samplerBindings:[],uniformBufferBindings:[]}}),this.dynamicUniformBufferByteOffsets=ip(4,function(){return 0}),this.flags=0,this.inputState=null,this.drawStart=0,this.drawCount=0,this.drawInstanceCount=0,this.renderPipelineDescriptor={bindingLayouts:[],inputLayout:null,megaStateDescriptor:up(cp),program:null,topology:Sf.Triangles,colorAttachmentFormats:[],depthStencilAttachmentFormat:null,sampleCount:1},this.reset()}var e=t.prototype;return e.reset=function(){this.sortKey=0,this.flags=pg.AllowSkippingIfPipelineNotReady,this.inputState=null,this.renderPipelineDescriptor.inputLayout=null},e.setFromTemplate=function(t){lp(this.renderPipelineDescriptor.megaStateDescriptor,t.renderPipelineDescriptor.megaStateDescriptor),this.renderPipelineDescriptor.program=t.renderPipelineDescriptor.program,this.renderPipelineDescriptor.inputLayout=t.renderPipelineDescriptor.inputLayout,this.renderPipelineDescriptor.topology=t.renderPipelineDescriptor.topology,this.renderPipelineDescriptor.colorAttachmentFormats.length=Math.max(this.renderPipelineDescriptor.colorAttachmentFormats.length,t.renderPipelineDescriptor.colorAttachmentFormats.length);for(var e=0;e<t.renderPipelineDescriptor.colorAttachmentFormats.length;e++)this.renderPipelineDescriptor.colorAttachmentFormats[e]=t.renderPipelineDescriptor.colorAttachmentFormats[e];this.renderPipelineDescriptor.depthStencilAttachmentFormat=t.renderPipelineDescriptor.depthStencilAttachmentFormat,this.renderPipelineDescriptor.sampleCount=t.renderPipelineDescriptor.sampleCount,this.inputState=t.inputState,this.uniformBuffer=t.uniformBuffer,this.uniforms=[].concat(t.uniforms),this.drawCount=t.drawCount,this.drawStart=t.drawStart,this.drawInstanceCount=t.drawInstanceCount,this.flags=this.flags&~pg.InheritedFlags|t.flags&pg.InheritedFlags,this.sortKey=t.sortKey;var n=this.bindingDescriptors[0],r=t.bindingDescriptors[0];null!==r.bindingLayout&&this.setBindingLayout(r.bindingLayout);for(var i=0;i<Math.min(n.uniformBufferBindings.length,r.uniformBufferBindings.length);i++)n.uniformBufferBindings[i].wordCount=t.bindingDescriptors[0].uniformBufferBindings[i].wordCount;this.setSamplerBindingsFromTextureMappings(r.samplerBindings);for(var o=0;o<t.dynamicUniformBufferByteOffsets.length;o++)this.dynamicUniformBufferByteOffsets[o]=t.dynamicUniformBufferByteOffsets[o]},e.setProgram=function(t){this.renderPipelineDescriptor.program=t},e.setMegaStateFlags=function(t){return lp(this.renderPipelineDescriptor.megaStateDescriptor,t),this.renderPipelineDescriptor.megaStateDescriptor},e.getMegaStateFlags=function(){return this.renderPipelineDescriptor.megaStateDescriptor},e.setInputLayoutAndState=function(t,e){this.inputState=e,this.renderPipelineDescriptor.inputLayout=t},e.setBindingLayout=function(t){T(t.numUniformBuffers<this.dynamicUniformBufferByteOffsets.length),this.renderPipelineDescriptor.bindingLayouts[0]=t,this.bindingDescriptors[0].bindingLayout=t;for(var e=this.bindingDescriptors[0].uniformBufferBindings.length;e<t.numUniformBuffers;e++)this.bindingDescriptors[0].uniformBufferBindings.push({buffer:null,wordCount:0});for(var n=this.bindingDescriptors[0].samplerBindings.length;n<t.numSamplers;n++)this.bindingDescriptors[0].samplerBindings.push({sampler:null,texture:null,lateBinding:null})},e.setBindingLayouts=function(t){T(t.length<=this.bindingDescriptors.length),T(1===t.length),this.setBindingLayout(t[0])},e.drawIndexes=function(t,e){void 0===e&&(e=0),this.flags=rp(this.flags,pg.Indexed,!0),this.drawCount=t,this.drawStart=e,this.drawInstanceCount=1},e.drawIndexesInstanced=function(t,e,n){void 0===n&&(n=0),this.flags=rp(this.flags,pg.Indexed,!0),this.drawCount=t,this.drawStart=n,this.drawInstanceCount=e},e.drawPrimitives=function(t,e){void 0===e&&(e=0),this.flags=rp(this.flags,pg.Indexed,!1),this.drawCount=t,this.drawStart=e,this.drawInstanceCount=1},e.setUniforms=function(t,e){if(0!==e.length){this.uniforms[t]=e;var i=0,o=[],n=(e.forEach(function(t){t=t.value;if(B(t)||Array.isArray(t)||t instanceof Float32Array){var t=B(t)?[t]:t,e=4<t.length?4:t.length,n=4-i%4;if(4!=n&&!(e<=n)){i+=n;for(var r=0;r<n;r++)o.push(0)}i+=t.length,o.push.apply(o,t)}}),4-o.length%4);if(4!=n)for(var r=0;r<n;r++)o.push(0);for(var a,s,l,u,c,h,d=this.allocateUniformBuffer(t,o.length),f=this.mapUniformBufferF32(t),p=0;p<o.length;p+=4)d+=(s=d,l=o[p],void 0===(u=o[p+1])&&(u=0),void 0===(c=o[p+2])&&(c=0),void 0===(h=o[p+3])&&(h=0),(a=f)[s+0]=l,a[s+1]=u,a[s+2]=c,a[s+3]=h,4)}},e.setUniformBuffer=function(t){this.uniformBuffer=t},e.allocateUniformBuffer=function(t,e){return T(this.bindingDescriptors[0].bindingLayout.numUniformBuffers<this.dynamicUniformBufferByteOffsets.length),this.dynamicUniformBufferByteOffsets[t]=this.uniformBuffer.allocateChunk(e)<<2,this.bindingDescriptors[0].uniformBufferBindings[t].wordCount=e,this.getUniformBufferOffset(t)},e.getUniformBufferOffset=function(t){return this.dynamicUniformBufferByteOffsets[t]>>>2},e.setUniformBufferOffset=function(t,e,n){this.dynamicUniformBufferByteOffsets[t]=e<<2,this.bindingDescriptors[0].uniformBufferBindings[t].wordCount=n},e.mapUniformBufferF32=function(t){return this.uniformBuffer.mapBufferF32()},e.getUniformBuffer=function(){return this.uniformBuffer},e.setSamplerBindingsFromTextureMappings=function(t){t=t.filter(function(t){return t});for(var e=0;e<this.bindingDescriptors[0].samplerBindings.length;e++){var n=this.bindingDescriptors[0].samplerBindings[e],r=t[e];null==r?(n.texture=null,n.sampler=null,n.lateBinding=null):(n.texture=r.texture,n.sampler=r.sampler,n.lateBinding=r.lateBinding)}},e.hasLateSamplerBinding=function(t){for(var e=0;e<this.bindingDescriptors[0].samplerBindings.length;e++)if(this.bindingDescriptors[0].samplerBindings[e].lateBinding===t)return!0;return!1},e.resolveLateSamplerBinding=function(t,e){for(var n=0;n<this.bindingDescriptors[0].samplerBindings.length;n++){var r=this.bindingDescriptors[0].samplerBindings[n];r.lateBinding===t&&(null===e?(r.texture=null,r.sampler=null):(T(null===e.lateBinding),r.texture=e.texture,null!==e.sampler&&(r.sampler=e.sampler)),r.lateBinding=null)}},e.setAllowSkippingIfPipelineNotReady=function(t){this.flags=rp(this.flags,pg.AllowSkippingIfPipelineNotReady,t)},e.setAttachmentFormatsFromRenderPass=function(t,e){for(var n=t.queryRenderPass(e),r=-1,i=0;i<n.colorAttachment.length;i++){var o=null!==n.colorAttachment[i]?t.queryRenderTarget(n.colorAttachment[i]):null;this.renderPipelineDescriptor.colorAttachmentFormats[i]=null!==o?o.pixelFormat:null,null!==o&&(-1===r?r=o.sampleCount:T(r===o.sampleCount))}e=null!==n.depthStencilAttachment?t.queryRenderTarget(n.depthStencilAttachment):null;this.renderPipelineDescriptor.depthStencilAttachmentFormat=null!==e?e.pixelFormat:null,null!==e&&(-1===r?r=e.sampleCount:T(r==e.sampleCount)),T(0<r),this.renderPipelineDescriptor.sampleCount=r},e.drawOnPass=function(t,e){var r=this,n=t.device,i=(this.setAttachmentFormatsFromRenderPass(n,e),t.createRenderPipeline(this.renderPipelineDescriptor));if(!n.pipelineQueryReady(i)){if(this.flags&pg.AllowSkippingIfPipelineNotReady)return!1;n.pipelineForceReady(i)}e.setPipeline(i),e.setInputState(this.inputState);for(var o=0;o<this.bindingDescriptors[0].uniformBufferBindings.length;o++)this.bindingDescriptors[0].uniformBufferBindings[o].buffer=Hf(this.uniformBuffer.buffer);this.renderPipelineDescriptor.program.gl_program&&this.uniforms.forEach(function(t){var n={};t.forEach(function(t){var e=t.name,t=t.value;n[e]=t}),r.renderPipelineDescriptor.program.setUniforms(n)});n=t.createBindings(sf({},this.bindingDescriptors[0],{pipeline:i}));return e.setBindings(0,n,this.dynamicUniformBufferByteOffsets),1<this.drawInstanceCount?(T(!!(this.flags&pg.Indexed)),e.drawIndexedInstanced(this.drawCount,this.drawStart,this.drawInstanceCount)):this.flags&pg.Indexed?e.drawIndexed(this.drawCount,this.drawStart):e.draw(this.drawCount,this.drawStart),!0},t}();function Sg(t,e){return t.sortKey-e.sortKey}(Ea=bg=bg||{})[Ea.Forwards=0]="Forwards",Ea[Ea.Backwards=1]="Backwards";var wg=function(){function t(t,e){void 0===t&&(t=Sg),void 0===e&&(e=bg.Forwards),this.renderInsts=[],this.compareFunction=void 0,this.executionOrder=void 0,this.usePostSort=!1,this.compareFunction=t,this.executionOrder=e}var e=t.prototype;return e.checkUsePostSort=function(){this.usePostSort=null!==this.compareFunction&&500<=this.renderInsts.length},e.insertSorted=function(t){null===this.compareFunction||this.usePostSort?this.renderInsts.push(t):np(this.renderInsts,t,this.compareFunction),this.checkUsePostSort()},e.submitRenderInst=function(t){t.flags|=pg.Draw,this.insertSorted(t)},e.hasLateSamplerBinding=function(t){for(var e=0;e<this.renderInsts.length;e++)if(this.renderInsts[e].hasLateSamplerBinding(t))return!0;return!1},e.resolveLateSamplerBinding=function(t,e){for(var n=0;n<this.renderInsts.length;n++)this.renderInsts[n].resolveLateSamplerBinding(t,e)},e.ensureSorted=function(){this.usePostSort&&(0!==this.renderInsts.length&&this.renderInsts.sort(this.compareFunction),this.usePostSort=!1)},e.drawOnPassRendererNoReset=function(t,e){this.ensureSorted();var n=0;if(this.executionOrder===bg.Forwards)for(var r=0;r<this.renderInsts.length;r++)this.renderInsts[r].drawOnPass(t,e)&&n++;else for(var i=this.renderInsts.length-1;0<=i;i--)this.renderInsts[i].drawOnPass(t,e)&&n++;return n},e.reset=function(){this.renderInsts.length=0},e.drawOnPassRenderer=function(t,e){this.drawOnPassRendererNoReset(t,e),this.reset()},t}(),Tg=function(){function t(){this.pool=[],this.allocCount=0}var e=t.prototype;return e.allocRenderInstIndex=function(){return this.allocCount++,this.allocCount>this.pool.length&&this.pool.push(new xg),this.allocCount-1},e.popRenderInst=function(){this.allocCount--},e.reset=function(){for(var t=0;t<this.pool.length;t++)this.pool[t].reset();this.allocCount=0},e.destroy=function(){this.pool.length=0,this.allocCount=0},t}(),Ag=function(){function t(t){this.renderCache=void 0,this.instPool=new Tg,this.templatePool=new Tg,this.simpleRenderInstList=new wg,this.currentRenderInstList=this.simpleRenderInstList,this.renderCache=t}var e=t.prototype;return e.newRenderInst=function(){var t=this.templatePool.allocCount-1,e=this.instPool.allocRenderInstIndex(),e=this.instPool.pool[e];return e.debug=null,0<=t&&e.setFromTemplate(this.templatePool.pool[t]),e},e.submitRenderInst=function(t,e){(e=void 0===e?this.currentRenderInstList:e).submitRenderInst(t)},e.setCurrentRenderInstList=function(t){T(null===this.simpleRenderInstList),this.currentRenderInstList=t},e.pushTemplateRenderInst=function(){var t=this.templatePool.allocCount-1,e=this.templatePool.allocRenderInstIndex(),e=this.templatePool.pool[e];return 0<=t&&e.setFromTemplate(this.templatePool.pool[t]),e.flags|=pg.Template,e},e.popTemplateRenderInst=function(){this.templatePool.popRenderInst()},e.getTemplateRenderInst=function(){var t=this.templatePool.allocCount-1;return this.templatePool.pool[t]},e.resetRenderInsts=function(){this.instPool.reset(),null!==this.simpleRenderInstList&&this.simpleRenderInstList.reset(),T(0===this.templatePool.allocCount)},e.destroy=function(){this.instPool.destroy(),this.renderCache.destroy()},e.disableSimpleMode=function(){this.simpleRenderInstList=null},e.drawOnPassRenderer=function(t){Hf(this.simpleRenderInstList).drawOnPassRenderer(this.renderCache,t)},e.drawOnPassRendererNoReset=function(t){Hf(this.simpleRenderInstList).drawOnPassRendererNoReset(this.renderCache,t)},t}(),Mg=function(){function t(){this.renderCache=void 0,this.renderGraph=void 0,this.renderInstManager=void 0,this.uniformBuffer=void 0,this.device=void 0}var e=t.prototype;return e.getDevice=function(){return this.device},e.setDevice=function(t){this.device=t,this.renderCache=new gg(t),this.renderGraph=new _g(this.device),this.renderInstManager=new Ag(this.renderCache),this.uniformBuffer=new tg(this.device)},e.pushTemplateRenderInst=function(){var t=this.renderInstManager.pushTemplateRenderInst();return t.setUniformBuffer(this.uniformBuffer),t},e.prepareToRender=function(){this.uniformBuffer.prepareToRender()},e.destroy=function(){this.uniformBuffer&&this.uniformBuffer.destroy(),this.renderInstManager&&this.renderInstManager.destroy(),this.renderCache.destroy(),this.renderGraph.destroy()},e.getCache=function(){return this.renderCache},t}(),Rg=function(){function t(t){this.pixelFormat=void 0,this.width=0,this.height=0,this.sampleCount=0,this.colorClearColor="load",this.depthClearValue="load",this.stencilClearValue="load",this.pixelFormat=t}var e=t.prototype;return e.setDimensions=function(t,e,n){this.width=t,this.height=e,this.sampleCount=n},e.copyDimensions=function(t){this.width=t.width,this.height=t.height,this.sampleCount=t.sampleCount},t}();function Ng(t){return{colorClearColor:t,depthClearValue:1,stencilClearValue:0}}Ng(qf(.88,.88,.88,1));var Cg,Pg=Ng(Fs);function Og(t,e){var n=e.antialiasingMode===Cg.MSAAx4?4:1;t.setDimensions(e.backbufferWidth,e.backbufferHeight,n)}function Ig(t,e,n){t=function(t){if(t===dg.Color0)return S.U8_RGBA_RT;if(t===dg.DepthStencil)return S.D24_S8;throw new Error("whoops")}(t),t=new Rg(t);return Og(t,e),null!==n&&(t.colorClearColor=n.colorClearColor,t.depthClearValue=n.depthClearValue,t.stencilClearValue=n.stencilClearValue),t}(_a=Cg=Cg||{})[_a.None=0]="None",_a[_a.FXAA=1]="FXAA",_a[_a.MSAAx4=2]="MSAAx4";var Lg,kg,Dg,Bg=function(){function t(){this.name=void 0,this.texture=null,this.sampler=null,this.lateBinding=null,this.width=0,this.height=0,this.lodBias=0}var e=t.prototype;return e.reset=function(){this.texture=null,this.sampler=null,this.lateBinding=null,this.width=0,this.height=0,this.lodBias=0},e.copy=function(t){this.texture=t.texture,this.sampler=t.sampler,this.lateBinding=t.lateBinding,this.width=t.width,this.height=t.height,this.lodBias=t.lodBias},t}(),Fg=["style"],Ug=function(n){function r(t){var t=void 0===t?{}:t,e=t.style,t=cf(t,Fg);return n.call(this,sf({type:r.tag,style:sf({intensity:Math.PI},e)},t))||this}return lf(r,n),r}(as),Gg=(Ug.tag="light",["style"]),Wg=((ba=Lg=Lg||{})[ba.NONE=0]="NONE",ba[ba.EXP=1]="EXP",ba[ba.EXP2=2]="EXP2",ba[ba.LINEAR=3]="LINEAR",function(n){function r(t){var t=void 0===t?{}:t,e=t.style,t=cf(t,Gg);return n.call(this,sf({type:r.tag,style:sf({type:Lg.NONE,fill:"black",start:1,end:1e3,density:0},e)},t))||this}return lf(r,n),r}(as)),Vg=(Wg.tag="fog",(r=kg=kg||{}).PROJECTION_MATRIX="u_ProjectionMatrix",r.VIEW_MATRIX="u_ViewMatrix",r.CAMERA_POSITION="u_CameraPosition",r.DEVICE_PIXEL_RATIO="u_DevicePixelRatio",r.VIEWPORT="u_Viewport",r.IS_ORTHO="u_IsOrtho",r.IS_PICKING="u_IsPicking",function(){function e(t,e,n,r){this.renderHelper=void 0,this.lightPool=void 0,this.texturePool=void 0,this.batchManager=void 0,this.context=void 0,this.device=void 0,this.swapChain=void 0,this.renderLists={world:new wg,picking:new wg},this.builder=void 0,this.enableCapture=void 0,this.captureOptions=void 0,this.capturePromise=void 0,this.resolveCapturePromise=void 0,this.renderHelper=t,this.lightPool=e,this.texturePool=n,this.batchManager=r}var t=e.prototype;return t.getDevice=function(){return this.device},t.getSwapChain=function(){return this.swapChain},t.getRenderLists=function(){return this.renderLists},t.apply=function(i){function o(t){var e;(t=t.target).nodeName===Ug.tag?c.lightPool.addLight(t):t.nodeName===Wg.tag?c.lightPool.addFog(t):(e=new pf,t.renderable3D=e,c.batchManager.add(t))}function a(t){(t=t.target).nodeName===Ug.tag?c.lightPool.removeLight(t):t.nodeName===Wg.tag?c.lightPool.removeFog(t):(c.batchManager.remove(t),delete t.renderable3D)}function s(t){var e=t.target,n=t.attrName,t=t.newValue;c.batchManager.updateAttribute(e,n,t)}function l(t){t=t.target,c.batchManager.updateAttribute(t,"modelMatrix",null)}function u(t){var e=t.target,t=t.detail.renderOrder;c.batchManager.changeRenderOrder(e,t)}var c=this,t=(this.context=i).renderingService,h=i.renderingContext.root.ownerDocument.defaultView;t.hooks.init.tapPromise(e.tag,rf(ef().mark(function t(){var e,n,r;return ef().wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return h.addEventListener(v.MOUNTED,o),h.addEventListener(v.UNMOUNTED,a),h.addEventListener(v.ATTR_MODIFIED,s),h.addEventListener(v.BOUNDS_CHANGED,l),h.addEventListener(v.RENDER_ORDER_CHANGED,u),c.context.config.renderer.getConfig().enableDirtyRectangleRendering=!1,e=c.context.contextService.getDomElement(),r=c.context.config,n=r.width,r=r.height,c.context.contextService.resize(n,r),t.next=11,c.context.deviceContribution.createSwapChain(e);case 11:c.swapChain=t.sent,c.device=c.swapChain.getDevice(),c.renderHelper.setDevice(c.device),c.renderHelper.renderInstManager.disableSimpleMode(),c.swapChain.configureSwapChain(e.width,e.height),h.addEventListener(qs.RESIZE,function(){c.swapChain.configureSwapChain(e.width,e.height)}),c.batchManager.attach(sf({device:c.device},i));case 18:case"end":return t.stop()}},t)}))),t.hooks.destroy.tap(e.tag,function(){c.renderHelper.destroy(),h.removeEventListener(v.MOUNTED,o),h.removeEventListener(v.UNMOUNTED,a),h.removeEventListener(v.ATTR_MODIFIED,s),h.removeEventListener(v.BOUNDS_CHANGED,l),h.removeEventListener(v.RENDER_ORDER_CHANGED,u)}),t.hooks.beginFrame.tap(e.tag,function(){var t=c.swapChain.getCanvas(),e=c.renderHelper.renderInstManager,n=(c.builder=c.renderHelper.renderGraph.newGraphBuilder(),Ao(c.context.config.background)),n=c.context.config.background?qf(Number(n.r)/255*Number(n.alpha),Number(n.g)/255*Number(n.alpha),Number(n.b)/255*Number(n.alpha),Number(n.alpha)):$f,t={backbufferWidth:t.width,backbufferHeight:t.height,antialiasingMode:Cg.None},n=Ig(dg.Color0,t,Ng(n)),t=Ig(dg.DepthStencil,t,Pg),r=c.builder.createRenderTargetID(n,"Main Color"),i=c.builder.createRenderTargetID(t,"Main Depth");c.builder.pushPass(function(t){t.setDebugName("Main Render Pass"),t.attachRenderTargetID(dg.Color0,r),t.attachRenderTargetID(dg.DepthStencil,i),t.exec(function(t){c.renderLists.world.drawOnPassRenderer(e.renderCache,t)})}),c.builder.resolveRenderTargetToExternalTexture(r,c.swapChain.getOnscreenTexture())}),t.hooks.endFrame.tap(e.tag,function(){var t=c.renderHelper.renderInstManager,e=c.renderHelper.pushTemplateRenderInst(),n=(e.setBindingLayouts([{numUniformBuffers:2,numSamplers:0}]),e.setMegaStateFlags(hp({depthWrite:!0,blendConstant:$f},{rgbBlendMode:Ef.Add,alphaBlendMode:Ef.Add,rgbBlendSrcFactor:yf.SrcAlpha,alphaBlendSrcFactor:yf.One,rgbBlendDstFactor:yf.OneMinusSrcAlpha,alphaBlendDstFactor:yf.OneMinusSrcAlpha})),c.context.config),r=n.width,n=n.height,i=c.context.camera;e.setUniforms(0,[{name:kg.PROJECTION_MATRIX,value:i.getPerspective()},{name:kg.VIEW_MATRIX,value:i.getViewTransform()},{name:kg.CAMERA_POSITION,value:i.getPosition()},{name:kg.DEVICE_PIXEL_RATIO,value:c.context.contextService.getDPR()},{name:kg.VIEWPORT,value:[r,n]},{name:kg.IS_ORTHO,value:i.isOrtho()?1:0},{name:kg.IS_PICKING,value:0}]),c.batchManager.render(c.renderLists.world),t.popTemplateRenderInst(),c.renderHelper.prepareToRender(),c.renderHelper.renderGraph.execute(),t.resetRenderInsts(),c.swapChain.present(),c.enableCapture&&c.resolveCapturePromise&&(r=(e=c.captureOptions).type,n=e.encoderOptions,i=c.context.contextService.getDomElement().toDataURL(r,n),c.resolveCapturePromise(i),c.enableCapture=!1,c.captureOptions=void 0,c.resolveCapturePromise=void 0)})},t.loadTexture=function(t,e,n){return this.texturePool.getOrCreateTexture(this.device,t,e,function(t){n&&n(t)})},t.toDataURL=function(){var e=rf(ef().mark(function t(e){var n=this;return ef().wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return this.enableCapture=!0,this.captureOptions=e,this.capturePromise=new Promise(function(e){n.resolveCapturePromise=function(t){e(t)}}),t.abrupt("return",this.capturePromise);case 4:case"end":return t.stop()}},t,this)}));return function(t){return e.apply(this,arguments)}}(),e}()),jg=(Vg.tag="RenderGraph",function(){function o(t,e,n,r){this.renderHelper=void 0,this.renderGraphPlugin=void 0,this.pickingIdGenerator=void 0,this.batchManager=void 0,this.context=void 0,this.renderHelper=t,this.renderGraphPlugin=e,this.pickingIdGenerator=n,this.batchManager=r}var t=o.prototype;return t.apply=function(t){function e(t){var e=(t=t.target).renderable3D;e&&(t=n.pickingIdGenerator.getId(t),e.pickingId=t,e.encodedPickingColor=n.pickingIdGenerator.encodePickingColor(t))}var n=this,r=(this.context=t).renderingService,i=t.renderingContext.root.ownerDocument.defaultView;r.hooks.init.tapPromise(o.tag,rf(ef().mark(function t(){return ef().wrap(function(t){for(;;)switch(t.prev=t.next){case 0:i.addEventListener(v.MOUNTED,e);case 1:case"end":return t.stop()}},t)}))),r.hooks.destroy.tap(o.tag,function(){i.removeEventListener(v.MOUNTED,e)}),r.hooks.pickSync.tap(o.tag,function(t){return n.pick(t)}),r.hooks.pick.tapPromise(o.tag,function(){var e=rf(ef().mark(function t(e){return ef().wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",n.pick(e));case 1:case"end":return t.stop()}},t)}));return function(t){return e.apply(this,arguments)}}())},t.pick=function(t){var e=t.topmost,n=t.position,r=n.viewportX,n=n.viewportY,i=this.context.contextService.getDPR(),o=this.context.config.width*i,a=this.context.config.height*i,r=r*i,n=n*i;return o<r||r<0||a<n||n<0?t.picked=[]:(i=this.pickByRectangleInDepth(new Na(Ue(Math.round(r),0,o-1),Ue(Math.round(n),0,a-1),1,1),e?1:100),t.picked=i),t},t.pickByRectangleInDepth=function(t,e){void 0===e&&(e=100);for(var n=null,r=1,i=[];(n=this.pickByRectangle(t,n))&&(r++,i.push(n),n)&&r<=e;);return 1<e&&this.restorePickingColor(i),i},t.restorePickingColor=function(t){var e=this;t.forEach(function(t){e.batchManager.updateAttribute(t,"pointerEvents",!0,!0)})},t.pickByRectangle=function(t,e){var r,i=this,o=this.renderGraphPlugin.getDevice(),n=this.renderGraphPlugin.getRenderLists(),a=this.renderHelper.renderInstManager,s=this.renderHelper.renderGraph.newGraphBuilder(),l=this.context.camera,u=t.x,c=t.y,h=t.width,d=t.height,t={backbufferWidth:h,backbufferHeight:d,antialiasingMode:Cg.None},f=Ig(dg.Color0,t,Ng($f)),p=s.createRenderTargetID(f,"Picking Color"),f=Ig(dg.DepthStencil,t,Pg),g=s.createRenderTargetID(f,"Picking Depth"),m=sf({},l.getView()),t=(this.renderHelper.renderGraph.renderTargetDeadPool.forEach(function(t){t.age=-1}),s.pushPass(function(t){t.setDebugName("Picking Pass"),t.attachRenderTargetID(dg.Color0,p),t.attachRenderTargetID(dg.DepthStencil,g),t.exec(function(t){n.picking.drawOnPassRenderer(a.renderCache,t)}),t.post(function(t){var t=t.getRenderTargetTexture(dg.Color0),e=o.createReadback(),t=(m&&m.enabled?l.setViewOffset(m.fullWidth,m.fullHeight,m.offsetX,m.offsetY,m.width,m.height):l.clearViewOffset(),l.setEnableUpdate(!0),e.readTexture(t,0,0,h,d,new Uint8Array(h*d*4))),n=-1;-1<(n=!t||0===t[0]&&0===t[1]&&0===t[2]?n:i.pickingIdGenerator.decodePickingColor(t))&&(t=i.pickingIdGenerator.getById(n))&&t.isVisible()&&t.isInteractive()&&(r=t),e.destroy()})}),this.renderHelper.pushTemplateRenderInst()),f=(t.setBindingLayouts([{numUniformBuffers:2,numSamplers:0}]),t.setMegaStateFlags(hp({depthWrite:!0},{rgbBlendMode:Ef.Add,rgbBlendSrcFactor:yf.One,rgbBlendDstFactor:yf.Zero,alphaBlendMode:Ef.Add,alphaBlendSrcFactor:yf.One,alphaBlendDstFactor:yf.Zero})),this.context.config),s=f.width,f=f.height,v=this.context.contextService.getDPR();return l.setEnableUpdate(!1),l.setViewOffset(s*v,f*v,u,c,h,d),t.setUniforms(0,[{name:kg.PROJECTION_MATRIX,value:l.getPerspective()},{name:kg.VIEW_MATRIX,value:l.getViewTransform()},{name:kg.CAMERA_POSITION,value:l.getPosition()},{name:kg.DEVICE_PIXEL_RATIO,value:this.context.contextService.getDPR()},{name:kg.VIEWPORT,value:[s,f]},{name:kg.IS_ORTHO,value:l.isOrtho()?1:0},{name:kg.IS_PICKING,value:1}]),e&&this.batchManager.updateAttribute(e,"pointerEvents",!1,!0),this.batchManager.render(n.picking,!0),a.popTemplateRenderInst(),this.renderHelper.prepareToRender(),this.renderHelper.renderGraph.execute(),a.resetRenderInsts(),r},o}()),zg=(jg.tag="WebGLPicker",.005),Hg=1,wa=function(){function t(){this.id=Hg++,this.meshes=[],this.clipPathMeshCreated=!1}var e=t.prototype;return e.shouldSubmitRenderInst=function(t,e){return!0},e.beforeUploadUBO=function(t,e,n){},e.beforeInitMesh=function(t){},e.afterInitMesh=function(t){},t}();function Xg(t,e,n){var r,t=t.createBuffer({viewOrSize:(t=n.byteLength,r=4,(t+(r-=1)&~r)/4),usage:e,hint:Tf.Static});return t.setSubData(0,new Uint8Array(n)),t}(Dg=Dg||{}).CHANGED="changed";var Yg,Kg=function(r){function t(t,e){var n;return void 0===e&&(e={}),(n=r.call(this)||this).device=void 0,n.props=void 0,n.drawMode=Sf.Triangles,n.vertexBuffers=[],n.vertices=[],n.indexBuffer=void 0,n.indices=void 0,n.inputLayoutDescriptor={vertexBufferDescriptors:[],vertexAttributeDescriptors:[],indexBufferFormat:S.U32_R},n.vertexCount=0,n.instancedCount=0,n.indexStart=0,n.primitiveStart=0,n.dirty=!0,n.meshes=[],n.device=t,n.props=e,n}lf(t,r);var e=t.prototype;return e.validate=function(t){return!0},e.build=function(t){},e.computeBoundingBox=function(){return new Ta},e.setIndexBuffer=function(t){return this.indexBuffer&&this.indexBuffer.destroy(),this.indexBuffer=Xg(this.device,wf.INDEX|wf.COPY_DST,new Uint32Array(ArrayBuffer.isView(t)?t.buffer:t).buffer),this.indices=t,this},e.setVertexBuffer=function(t){var a=this,s=t.bufferIndex,e=t.byteStride,n=t.frequency,r=t.attributes,t=t.data,e=(this.inputLayoutDescriptor.vertexBufferDescriptors[s]={byteStride:e,frequency:n},this.vertices[s]=t,r.forEach(function(t){var e=t.format,n=t.bufferByteOffset,r=t.location,i=t.divisor,t=t.byteStride,o=a.inputLayoutDescriptor.vertexAttributeDescriptors.find(function(t){return t.bufferIndex===s&&t.location===r});o?(o.format=e,o.bufferByteOffset=n,o.byteStride=t,o.divisor=i):a.inputLayoutDescriptor.vertexAttributeDescriptors.push({format:e,bufferIndex:s,bufferByteOffset:n,location:r,byteStride:t,divisor:i})}),this.vertexBuffers[s]&&this.vertexBuffers[s].destroy(),Xg(this.device,wf.VERTEX|wf.COPY_DST,t.buffer));return this.vertexBuffers[s]=e,this},e.getVertexBuffer=function(t){return this.vertexBuffers[t]},e.updateVertexBuffer=function(t,e,n,r){var i=this.inputLayoutDescriptor.vertexBufferDescriptors[t].byteStride,o=this.inputLayoutDescriptor.vertexAttributeDescriptors.find(function(t){return t.location===e});o&&this.getVertexBuffer(t).setSubData(o.bufferByteOffset+n*i,r),this.emit(Dg.CHANGED)},e.updateIndices=function(t,e){return void 0===e&&(e=0),this.indexBuffer&&this.indexBuffer.setSubData(e,ArrayBuffer.isView(t)?t:new Uint32Array(t)),this},e.destroy=function(){this.vertexBuffers.forEach(function(t){t&&t.destroy()}),this.indexBuffer&&this.indexBuffer.destroy(),this.inputLayoutDescriptor.vertexAttributeDescriptors=[],this.inputLayoutDescriptor.vertexBufferDescriptors=[],this.indexBuffer=void 0,this.vertexBuffers=[],this.indices=void 0,this.vertices=[],this.vertexCount=0,this.instancedCount=0},t}(qn);(Yg=Yg||{}).CHANGED="changed";var Ca=function(d){function t(t,e){var n=d.call(this)||this,r=(n.device=void 0,n.props={},n.meshes=[],n.defines={},n.uniforms={},n.uniformNames=void 0,n.uboBuffer=[],n.textures={},n.samplers=[],n.programDirty=!0,n.textureDirty=!0,n.geometryDirty=!0,up(cp)),i=r.cullMode,o=r.depthCompare,a=r.depthWrite,s=r.stencilCompare,l=r.stencilWrite,u=r.stencilPassOp,c=r.frontFace,h=r.polygonOffset,r=r.attachmentsState;return n.device=t,n.props=sf({cullMode:i,depthTest:!0,depthCompare:o,depthWrite:a,stencilCompare:s,stencilWrite:l,stencilPassOp:u,frontFace:c,polygonOffset:h,attachmentsState:r,dithering:!1,wireframe:!1,wireframeColor:"black",wireframeLineWidth:1,vertexShader:"",fragmentShader:""},e),n.compile(),n}lf(t,d);var e=t.prototype;return e.compile=function(){var n=this;this.props.fragmentShader.replace(/^\s*uniform\s*sampler2D\s*(.*)\s*;$/gm,function(t,e){return n.samplers.push(e),""}),this.uniformNames=$p(this.props.fragmentShader)},e.setUniforms=function(r){var i=this,o=!1;Object.keys(r).forEach(function(t){var e=r[t],n=i.textures[t];n&&n!==e&&(i.textureDirty=!0),(n=e)&&n.type?(i.textures[t]=e,i.textureDirty=!0,e.on(Mf.LOADED,function(){i.dispatchMutationEvent()})):(i.uniforms[t]=e,o=!0),M(r[t])&&(delete i.textures[t],delete i.uniforms[t])}),o&&this.dispatchMutationEvent()},e.dispatchMutationEvent=function(){this.emit(Yg.CHANGED)},af(t,[{key:"cullMode",get:function(){return this.props.cullMode},set:function(t){this.props.cullMode=t}},{key:"frontFace",get:function(){return this.props.frontFace},set:function(t){this.props.frontFace=t}},{key:"blendConstant",get:function(){return this.props.blendConstant},set:function(t){this.props.blendConstant=t}},{key:"blendEquation",get:function(){return this.props.blendEquation},set:function(t){this.props.blendEquation=t}},{key:"blendEquationAlpha",get:function(){return this.props.blendEquationAlpha},set:function(t){this.props.blendEquationAlpha=t}},{key:"blendSrc",get:function(){return this.props.blendSrc},set:function(t){this.props.blendSrc=t}},{key:"blendDst",get:function(){return this.props.blendDst},set:function(t){this.props.blendDst=t}},{key:"blendSrcAlpha",get:function(){return this.props.blendSrcAlpha},set:function(t){this.props.blendSrcAlpha=t}},{key:"blendDstAlpha",get:function(){return this.props.blendDstAlpha},set:function(t){this.props.blendDstAlpha=t}},{key:"depthCompare",get:function(){return this.props.depthCompare},set:function(t){this.props.depthCompare=t}},{key:"depthTest",get:function(){return this.props.depthTest},set:function(t){this.props.depthTest=t}},{key:"depthWrite",get:function(){return this.props.depthWrite},set:function(t){this.props.depthWrite=t}},{key:"stencilCompare",get:function(){return this.props.stencilCompare},set:function(t){this.props.stencilCompare=t}},{key:"stencilWrite",get:function(){return this.props.stencilWrite},set:function(t){this.props.stencilWrite=t}},{key:"stencilPassOp",get:function(){return this.props.stencilPassOp},set:function(t){this.props.stencilPassOp=t}},{key:"stencilRef",get:function(){return this.props.stencilRef},set:function(t){this.props.stencilRef=t}},{key:"polygonOffset",get:function(){return this.props.polygonOffset},set:function(t){this.props.polygonOffset=t}},{key:"dithering",get:function(){return this.props.dithering},set:function(t){this.props.dithering=t}},{key:"wireframe",get:function(){return this.props.wireframe},set:function(t){this.props.wireframe!==t&&(this.geometryDirty=!0,this.programDirty=!0,this.props.wireframe=t,this.dispatchMutationEvent()),this.defines.USE_WIREFRAME=!!t}},{key:"wireframeColor",get:function(){return this.props.wireframeColor},set:function(t){this.props.wireframeColor=t}},{key:"wireframeLineWidth",get:function(){return this.props.wireframeLineWidth},set:function(t){this.props.wireframeLineWidth=t}},{key:"vertexShader",get:function(){return this.props.vertexShader},set:function(t){this.props.vertexShader!==t&&(this.programDirty=!0,this.props.vertexShader=t,this.compile())}},{key:"fragmentShader",get:function(){return this.props.fragmentShader},set:function(t){this.props.fragmentShader!==t&&(this.programDirty=!0,this.props.fragmentShader=t,this.compile())}}]),t}(qn),qg=function(n){function t(t,e){t=n.call(this,t,sf({},e))||this;return t.defines=sf({},t.defines,{USE_UV:!1,USE_MAP:!1,USE_WIREFRAME:!1,USE_FOG:!1,USE_LIGHT:!1}),t}return lf(t,n),t}(Ca);function $g(e){var n={};return Object.keys(e).forEach(function(t){"number"==typeof e[t]&&(n[t]=e[t])}),n}function Zg(t){return Object.fromEntries(Object.entries(t).filter(function(t){return t[0],void 0!==t[1]}))}var Qg,Jg,t0,e0,n0,r0,i0=1,o0="FillTextureMapping",Ia=((Pa=Qg=Qg||{})[Pa.MODEL_MATRIX=0]="MODEL_MATRIX",Pa[Pa.FILL_STROKE=1]="FILL_STROKE",Pa[Pa.PACKED_STYLE=2]="PACKED_STYLE",Pa[Pa.PICKING_COLOR=3]="PICKING_COLOR",Pa[Pa.POSITION=4]="POSITION",Pa[Pa.NORMAL=5]="NORMAL",Pa[Pa.UV=6]="UV",Pa[Pa.BARYCENTRIC=7]="BARYCENTRIC",Pa[Pa.MAX=8]="MAX",(Oa=Jg=Jg||{})[Oa.MODEL_MATRIX0=0]="MODEL_MATRIX0",Oa[Oa.MODEL_MATRIX1=1]="MODEL_MATRIX1",Oa[Oa.MODEL_MATRIX2=2]="MODEL_MATRIX2",Oa[Oa.MODEL_MATRIX3=3]="MODEL_MATRIX3",Oa[Oa.COLOR=4]="COLOR",Oa[Oa.STROKE_COLOR=5]="STROKE_COLOR",Oa[Oa.PACKED_STYLE1=6]="PACKED_STYLE1",Oa[Oa.PACKED_STYLE2=7]="PACKED_STYLE2",Oa[Oa.PICKING_COLOR=8]="PICKING_COLOR",Oa[Oa.POSITION=9]="POSITION",Oa[Oa.NORMAL=10]="NORMAL",Oa[Oa.UV=11]="UV",Oa[Oa.BARYCENTRIC=12]="BARYCENTRIC",Oa[Oa.MAX=13]="MAX",function(){function t(t,e,n){this.renderHelper=void 0,this.texturePool=void 0,this.lightPool=void 0,this.id=i0++,this.renderer=void 0,this.index=-1,this.context=void 0,this.objects=[],this.material=void 0,this.geometry=void 0,this.clipPath=void 0,this.clipPathTarget=void 0,this.inputState=void 0,this.program=new Jp,this.programDescriptorSimpleWithOrig=void 0,this.geometryDirty=!0,this.materialDirty=!0,this.inputStateDirty=!0,this.textureMappings=[],this.samplerEntries=void 0,this.lightReceived=!1,this.inited=!1,this.renderHelper=t,this.texturePool=e,this.lightPool=n}var e=t.prototype;return e.init=function(t){this.inited||(this.renderer.beforeInitMesh(this),this.context=t,this.material=new qg(this.context.device),this.material.defines=sf({},$g(Jg),this.material.defines),this.geometry=new Kg(this.context.device),this.geometry.meshes=this.objects,this.material.meshes=this.objects,this.observeGeometryChanged(),this.observeMaterialChanged(),this.inited=!0,this.renderer.afterInitMesh(this))},e.observeGeometryChanged=function(){var t=this;this.geometry.on(Dg.CHANGED,function(){t.geometry.meshes.forEach(function(t){t.renderable.dirty=!0}),t.context.renderingService.dirtify()})},e.observeMaterialChanged=function(){var t=this;this.material.on(Yg.CHANGED,function(){t.material.meshes.forEach(function(t){t.renderable.dirty=!0}),t.context.renderingService.dirtify()})},e.shouldMergeColor=function(t,e,n){var r=t.parsedStyle[n],i=e.parsedStyle[n];return!(!To(r)||!To(i))||!(!wo(r)||!wo(i)||r.image!==i.image)||!(!Array.isArray(r)||!Array.isArray(i)||t.style[n]!==e.style[n])},e.shouldMerge=function(t,e){return!this.instance||!(this.instance.nodeName!==t.nodeName&&this.instance.nodeName!==t.renderable.proxyNodeName&&this.instance.renderable.proxyNodeName!==t.nodeName&&this.instance.renderable.proxyNodeName!==t.renderable.proxyNodeName||t.parsedStyle.clipPath||!this.shouldMergeColor(this.instance,t,"fill")||!this.shouldMergeColor(this.instance,t,"stroke"))},e.createGeometry=function(t){var h=this,d=K(),f=K(),p=[],g=[],m=[],v=[];t.forEach(function(t){var e=t.parsedStyle,n=e.fill,r=e.stroke,i=e.opacity,o=e.fillOpacity,a=e.strokeOpacity,s=e.lineWidth,l=e.anchor,u=e.visibility,e=e.increasedLineWidthForHitTesting,c=[0,0,0,0],n=(To(n)&&(c=[Number(n.r)/255,Number(n.g)/255,Number(n.b)/255,Number(n.alpha)]),[0,0,0,0]),r=(To(r)&&(n=[Number(r.r)/255,Number(r.g)/255,Number(r.b)/255,Number(r.alpha)]),h.clipPathTarget?($(d,t.getLocalTransform()),c=[1,1,1,1],wt(d,h.clipPathTarget.getWorldTransform(),d)):$(d,t.getWorldTransform()),wt(f,h.context.camera.getViewTransform(),d),t.isInteractive()&&(null==(r=t.renderable3D)?void 0:r.encodedPickingColor)||[0,0,0]);p.push.apply(p,d),g.push.apply(g,c.concat(n)),m.push(i,o,a,s,"visible"===u?1:0,l[0],l[1],e||0),v.push.apply(v,r.concat([t.sortable.renderOrder*zg]))}),this.geometry.instancedCount=t.length,this.geometry.setVertexBuffer({bufferIndex:Qg.MODEL_MATRIX,byteStride:64,frequency:Af.PerInstance,attributes:[{format:S.F32_RGBA,bufferByteOffset:0,location:Jg.MODEL_MATRIX0,divisor:1},{format:S.F32_RGBA,bufferByteOffset:16,location:Jg.MODEL_MATRIX1,divisor:1},{format:S.F32_RGBA,bufferByteOffset:32,location:Jg.MODEL_MATRIX2,divisor:1},{format:S.F32_RGBA,bufferByteOffset:48,location:Jg.MODEL_MATRIX3,divisor:1}],data:new Float32Array(p)}),this.geometry.setVertexBuffer({bufferIndex:Qg.FILL_STROKE,byteStride:32,frequency:Af.PerInstance,attributes:[{format:S.F32_RGBA,bufferByteOffset:0,location:Jg.COLOR,divisor:1},{format:S.F32_RGBA,bufferByteOffset:16,location:Jg.STROKE_COLOR,divisor:1}],data:new Float32Array(g)}),this.geometry.setVertexBuffer({bufferIndex:Qg.PACKED_STYLE,byteStride:32,frequency:Af.PerInstance,attributes:[{format:S.F32_RGBA,bufferByteOffset:0,location:Jg.PACKED_STYLE1,divisor:1},{format:S.F32_RGBA,bufferByteOffset:16,location:Jg.PACKED_STYLE2,divisor:1}],data:new Float32Array(m)}),this.geometry.setVertexBuffer({bufferIndex:Qg.PICKING_COLOR,byteStride:16,frequency:Af.PerInstance,attributes:[{format:S.F32_RGBA,bufferByteOffset:0,location:Jg.PICKING_COLOR,divisor:1}],data:new Float32Array(v)})},e.destroy=function(){this.geometry&&this.geometry.destroy(),this.inputState&&this.inputState.destroy()},e.applyRenderInst=function(t,e){var n=this,r=this.lightPool.getAllLights(),i=!!this.lightPool.getFog(),r=!!r.length,o=(this.clipPathTarget||this.clipPath?this.clipPathTarget?(this.material.stencilWrite=!0,this.material.depthWrite=!1,this.material.stencilCompare=mf.Always,this.material.stencilPassOp=Pf.Replace):(this.material.stencilWrite=!1,this.material.depthWrite=!0,this.material.stencilCompare=mf.Equal,this.material.stencilPassOp=Pf.Keep):this.material.stencilWrite=!1,(this.materialDirty||this.material.programDirty)&&this.createMaterial(e),sf({},this.material.defines));this.material.defines.USE_FOG=i,this.material.defines.USE_LIGHT=r,this.material.defines=sf({},this.material.defines,this.lightPool.getDefines()),this.material.textureDirty&&(this.textureMappings=[],(i=this.createFillGradientTextureMapping(e))&&this.textureMappings.push(i),Object.keys(this.material.textures).sort(function(t,e){return n.material.samplers.indexOf(t)-n.material.samplers.indexOf(e)}).forEach(function(t){var e=new Bg;e.name=t,e.texture=n.material.textures[t],n.context.device.setResourceName(e.texture,"Material Texture "+t),e.sampler=n.renderHelper.getCache().createSampler({wrapS:_f.Clamp,wrapT:_f.Clamp,minFilter:bf.Point,magFilter:bf.Bilinear,mipFilter:xf.Linear,minLOD:0,maxLOD:0}),n.textureMappings.push(e)}),this.textureMappings.length?(this.material.defines.USE_UV=!0,this.material.defines.USE_MAP=!0):(this.material.defines.USE_UV=!1,this.material.defines.USE_MAP=!1),this.material.textureDirty=!1),a=o,s=this.material.defines,r=Object.keys(a),i=Object.keys(s);r.length===i.length&&r.every(function(t){return a[t]===s[t]})&&!this.material.programDirty&&!this.materialDirty||(this.material.defines=sf({},this.material.defines,$g(Jg)),Object.keys(this.material.defines).forEach(function(t){var e=n.material.defines[t];"number"==typeof e?n.program.setDefineString(t,""+e):n.program.setDefineBool(t,e)}),this.program.vert=this.material.vertexShader,this.program.frag=this.material.fragmentShader,this.programDescriptorSimpleWithOrig=Qp(this.context.device,this.program),this.material.programDirty=!1,this.materialDirty=!1),this.material.geometryDirty&&(this.geometryDirty=!0,this.inputStateDirty=!0,this.material.geometryDirty=!1),(this.geometryDirty||this.geometry.dirty)&&(this.geometry&&this.geometry.destroy(),this.createGeometry(e),this.material.wireframe&&this.generateWireframe(this.geometry),this.geometryDirty=!1,this.geometry.dirty=!1,this.inputStateDirty=!0);var a,s,o=this.renderHelper.getCache().createInputLayout(this.geometry.inputLayoutDescriptor),i=this.renderHelper.getCache().createProgramSimple(this.programDescriptorSimpleWithOrig),r=!!this.geometry.indexBuffer;this.inputStateDirty&&(this.inputState&&this.inputState.destroy(),this.inputState=this.context.device.createInputState(o,this.geometry.vertexBuffers.map(function(t){return{buffer:t,byteOffset:0}}),r?{buffer:this.geometry.indexBuffer,byteOffset:0}:null,i),this.inputStateDirty=!1),t.renderPipelineDescriptor.topology=this.geometry.drawMode,t.setProgram(i),t.setInputLayoutAndState(o,this.inputState),this.renderer.beforeUploadUBO(t,this,this.index),this.uploadUBO(t),r?t.drawIndexesInstanced(this.geometry.vertexCount,this.geometry.instancedCount,this.geometry.indexStart):t.drawPrimitives(this.geometry.vertexCount,this.geometry.primitiveStart),t.sortKey=(i=fg.OPAQUE,(16777215&(o=o=e[0].sortable.renderOrder,!!((r=0)>>>31&1)?r:(4278190335&r|(65535&o)<<8)>>>0)|(255&i)<<24)>>>0)},e.updateBatchedAttribute=function(t,e,n,r){var i,o,a,s,l,u;"fill"===n||"stroke"===n?(i=[],t.forEach(function(t){var t=t.parsedStyle,e=t.fill,t=t.stroke,n=[0,0,0,0],e=(To(e)&&(n=[Number(e.r)/255,Number(e.g)/255,Number(e.b)/255,Number(e.alpha)]),[0,0,0,0]);To(t)&&(e=[Number(t.r)/255,Number(t.g)/255,Number(t.b)/255,Number(t.alpha)]),i.push.apply(i,n.concat(e))}),this.geometry.updateVertexBuffer(Qg.FILL_STROKE,Jg.COLOR,e,new Uint8Array(new Float32Array(i).buffer)),a=this.instance.parsedStyle.fill,o=this.textureMappings.findIndex(function(t){return t.name===o0}),To(a)?0<=o&&(this.textureMappings.splice(o,-1),this.material.textureDirty=!0):(a=this.createFillGradientTextureMapping([this.instance]),0<=o&&this.textureMappings.splice(o,1,a),this.material.textureDirty=!0)):-1<["opacity","fillOpacity","strokeOpacity","lineWidth","visibility","anchor","increasedLineWidthForHitTesting"].indexOf(n)?(s=[],t.forEach(function(t){var t=t.parsedStyle,e=t.opacity,n=t.fillOpacity,r=t.strokeOpacity,i=t.lineWidth,o=t.visibility,a=t.anchor,t=t.increasedLineWidthForHitTesting;s.push(e,n,r,i,"visible"===o?1:0,a[0],a[1],t||0)}),this.geometry.updateVertexBuffer(Qg.PACKED_STYLE,Jg.PACKED_STYLE1,e,new Uint8Array(new Float32Array(s).buffer))):"modelMatrix"===n?(l=[],t.forEach(function(t){t=$(K(),t.getWorldTransform());l.push.apply(l,t)}),this.geometry.updateVertexBuffer(Qg.MODEL_MATRIX,Jg.MODEL_MATRIX0,e,new Uint8Array(new Float32Array(l).buffer))):"pointerEvents"===n&&(u=[],t.forEach(function(t){var e=r&&t.isInteractive()&&(null==(e=t.renderable3D)?void 0:e.encodedPickingColor)||[0,0,0];u.push.apply(u,e.concat([t.sortable.renderOrder*zg]))}),this.geometry.updateVertexBuffer(Qg.PICKING_COLOR,Jg.PICKING_COLOR,e,new Uint8Array(new Float32Array(u).buffer)))},e.updateAttribute=function(t,e,n,r){"clipPath"===n&&this.clipPath&&(this.geometryDirty=!0)},e.changeRenderOrder=function(t,e){var n=this.objects.indexOf(t),t=t.isInteractive()&&(null==(t=t.renderable3D)?void 0:t.encodedPickingColor)||[0,0,0];this.geometry.updateVertexBuffer(Qg.PICKING_COLOR,Jg.PICKING_COLOR,n,new Uint8Array(new Float32Array([].concat(t,[e*zg])).buffer))},e.generateWireframe=function(l){for(var t=l.indices,e=l.indices.length,n=l.vertices.map(function(t){return t.slice()}),r=Qg.PICKING_COLOR;r<l.vertexBuffers.length;r++){var i=l.inputLayoutDescriptor.vertexBufferDescriptors[r].byteStride;l.vertices[r]=new Float32Array(i/4*e)}for(var o=0,a=new Uint32Array(e),s=0;s<e;s++){for(var u=t[s],c=1;c<l.vertices.length;c++)for(var h=l.inputLayoutDescriptor.vertexBufferDescriptors[c].byteStride/4,d=0;d<h;d++)l.vertices[c][o*h+d]=n[c][u*h+d];a[s]=o,o++}for(var f=Qg.PICKING_COLOR+1;f<l.vertexBuffers.length;f++)!function(e){var t,n,r,i,o=l.inputLayoutDescriptor.vertexBufferDescriptors[e],a=o.frequency,o=o.byteStride,s=l.inputLayoutDescriptor.vertexAttributeDescriptors.find(function(t){return t.bufferIndex===e});s&&(t=s.location,n=s.bufferIndex,r=s.bufferByteOffset,i=s.format,s=s.divisor,l.setVertexBuffer({bufferIndex:n,byteStride:o,frequency:a,attributes:[{format:i,bufferByteOffset:r,location:t,divisor:s}],data:l.vertices[e]}))}(f);for(var p=new Float32Array(3*e),g=0;g<e;)for(var m=0;m<3;m++)p[3*a[g++]+m]=1;l.setVertexBuffer({bufferIndex:Qg.BARYCENTRIC,byteStride:12,frequency:Af.PerVertex,attributes:[{format:S.F32_RGB,bufferByteOffset:0,location:Number(Jg.BARYCENTRIC)}],data:p}),l.setIndexBuffer(a)},e.beforeUploadUBO=function(t,e,n){},e.uploadUBO=function(t){var e,n=this,r=this.material,i=this.lightPool.getAllLights(),o=this.lightPool.getFog(),a=!!o,s=this.lightReceived&&!!i.length,l=r.defines.USE_WIREFRAME,u=[],l=(l&&(l=Ao(r.wireframeColor),u.push({name:"u_WireframeLineColor",value:[Number(l.r)/255,Number(l.g)/255,Number(l.b)/255]}),u.push({name:"u_WireframeLineWidth",value:r.wireframeLineWidth})),a&&this.uploadFog(u,o),this.uploadMaterial(u,r),s&&(e={},i.forEach(function(t){e[t.define]||(e[t.define]=-1),e[t.define]++,t.uploadUBO(u,e[t.define])})),u.sort(function(t,e){return n.material.uniformNames.indexOf(t.name)-n.material.uniformNames.indexOf(e.name)}),t.setUniforms(1,u),r.depthCompare),a=r.depthWrite,o=r.stencilCompare,s=r.stencilWrite,i=r.stencilPassOp,c=r.stencilRef,h=r.cullMode,d=r.frontFace,f=r.polygonOffset,p=r.blendConstant,g=r.blendEquation,m=r.blendEquationAlpha,v=r.blendSrc,y=r.blendDst,E=r.blendSrcAlpha,r=r.blendDstAlpha,p=Zg({blendConstant:p,depthCompare:l,depthWrite:a,stencilCompare:o,stencilWrite:s,stencilPassOp:i,stencilRef:c,cullMode:h,frontFace:d,polygonOffset:f}),l=t.getMegaStateFlags().attachmentsState[0];t.setMegaStateFlags(sf({attachmentsState:[{channelWriteMask:this.material.stencilWrite?Cf.None:Cf.AllChannels,rgbBlendState:sf({},l.rgbBlendState,Zg({blendMode:g,blendSrcFactor:v,blendDstFactor:y})),alphaBlendState:sf({},l.alphaBlendState,Zg({blendMode:m,blendSrcFactor:E,blendDstFactor:r}))}]},p)),t.setBindingLayouts([{numUniformBuffers:1,numSamplers:this.textureMappings.length,samplerEntries:this.samplerEntries}]),t.setSamplerBindingsFromTextureMappings(this.textureMappings)},e.uploadFog=function(t,e){var e=e.parsedStyle,n=e.type,r=e.fill,i=e.start,o=e.end,e=e.density;To(r)&&(r=[Number(r.r)/255,Number(r.g)/255,Number(r.b)/255,Number(r.alpha)],t.push({name:"u_FogInfos",value:[n,i,o,e]}),t.push({name:"u_FogColor",value:r}))},e.uploadMaterial=function(t,e){var n=Object.keys(e.uniforms).map(function(t){return{name:t,value:e.uniforms[t]}});t.push.apply(t,n)},e.createFillGradientTextureMapping=function(t){var e=this,n=t[0],r=n.nodeName===lt.LINE?n.parsedStyle.stroke:n.parsedStyle.fill;if(r&&(wo(r)||Array.isArray(r))){Array.isArray(r)?(this.program.setDefineBool("USE_PATTERN",!1),this.texturePool.getOrCreateGradient({gradients:r,width:128,height:128,instance:n})):wo(r)&&(this.program.setDefineBool("USE_PATTERN",!0),this.texturePool.getOrCreatePattern(r,n,function(){t.forEach(function(t){t.renderable.dirty=!0}),e.material.textureDirty=!0}));var r=this.texturePool.getOrCreateCanvas(),n=this.texturePool.getOrCreateTexture(this.context.device,r,Wf(S.U8_RGBA_NORM,1,1,1));if(n)return(r=new Bg).name=o0,r.texture=n,r.texture.on("loaded",function(){t.forEach(function(t){t.renderable.dirty=!0}),e.material.textureDirty=!0}),this.context.device.setResourceName(r.texture,"Fill Texture"+this.id),r.sampler=this.renderHelper.getCache().createSampler({wrapS:_f.Repeat,wrapT:_f.Repeat,minFilter:bf.Point,magFilter:bf.Bilinear,mipFilter:xf.Linear,minLOD:0,maxLOD:0}),r}return null},af(t,[{key:"instance",get:function(){return this.objects[0]}}]),t}()),a0=(t0=t0||{},t0[t0.PACKED_STYLE=5]="PACKED_STYLE",(La=e0=e0||{})[La.PACKED_STYLE3=13]="PACKED_STYLE3",La[La.SIZE=14]="SIZE",[lt.CIRCLE,lt.ELLIPSE,lt.RECT]),s0=function(u){function t(){return u.apply(this,arguments)||this}lf(t,u);var e=t.prototype;return e.shouldMerge=function(t,e){return!!u.prototype.shouldMerge.call(this,t,e)&&!this.needDrawStrokeSeparately(t.parsedStyle)&&!this.needDrawStrokeSeparately(this.instance.parsedStyle)&&(e=this.instance.parsedStyle.fill,t=t.parsedStyle.fill,e.isNone===t.isNone)},e.createMaterial=function(t){this.material.vertexShader="#define GLSLIFY 1\nlayout(std140) uniform ub_SceneParams {\n mat4 u_ProjectionMatrix;\n mat4 u_ViewMatrix;\n vec3 u_CameraPosition;\n float u_DevicePixelRatio;\n vec2 u_Viewport;\n float u_IsOrtho;\n float u_IsPicking;\n};\n\nlayout(location = MODEL_MATRIX0) in vec4 a_ModelMatrix0;\nlayout(location = MODEL_MATRIX1) in vec4 a_ModelMatrix1;\nlayout(location = MODEL_MATRIX2) in vec4 a_ModelMatrix2;\nlayout(location = MODEL_MATRIX3) in vec4 a_ModelMatrix3;\nlayout(location = COLOR) in vec4 a_Color;\nlayout(location = STROKE_COLOR) in vec4 a_StrokeColor;\nlayout(location = PACKED_STYLE1) in vec4 a_StylePacked1;\nlayout(location = PACKED_STYLE2) in vec4 a_StylePacked2;\nlayout(location = PICKING_COLOR) in vec4 a_PickingColor;\n\nout vec4 v_PickingResult;\nout vec4 v_Color;\nout vec4 v_StrokeColor;\nout vec4 v_StylePacked1;\nout vec4 v_StylePacked2;\n\n#define COLOR_SCALE 1. / 255.\nvoid setPickingColor(vec3 pickingColor) {\n v_PickingResult.rgb = pickingColor * COLOR_SCALE;\n}\nvec4 project(vec4 pos, mat4 pm, mat4 vm, mat4 mm) {\n return pm * vm * mm * pos;\n}\n\nlayout(location = POSITION) in vec2 a_Extrude;\nlayout(location = PACKED_STYLE3) in vec4 a_StylePacked3;\nlayout(location = SIZE) in vec2 a_Size;\n#ifdef USE_UV\n layout(location = UV) in vec2 a_Uv;\n out vec2 v_Uv;\n#endif\n\nout vec4 v_Data;\nout vec2 v_Radius;\nout vec4 v_StylePacked3;\n\nvoid main() {\n mat4 u_ModelMatrix = mat4(a_ModelMatrix0, a_ModelMatrix1, a_ModelMatrix2, a_ModelMatrix3);\nvec4 u_StrokeColor = a_StrokeColor;\nfloat u_Opacity = a_StylePacked1.x;\nfloat u_FillOpacity = a_StylePacked1.y;\nfloat u_StrokeOpacity = a_StylePacked1.z;\nfloat u_StrokeWidth = a_StylePacked1.w;\nfloat u_ZIndex = a_PickingColor.w;\nvec2 u_Anchor = a_StylePacked2.yz;\nfloat u_IncreasedLineWidthForHitTesting = a_StylePacked2.w;\n\nsetPickingColor(a_PickingColor.xyz);\n\nv_Color = a_Color;\nv_StrokeColor = a_StrokeColor;\nv_StylePacked1 = a_StylePacked1;\nv_StylePacked2 = a_StylePacked2;\n\n#ifdef CLIPSPACE_NEAR_ZERO\n gl_Position.z = gl_Position.z * 0.5 + 0.5;\n#endif\n #ifdef USE_UV\n v_Uv = a_Uv;\n #ifdef VIEWPORT_ORIGIN_TL\n v_Uv.y = 1.0 - v_Uv.y;\n #endif\n#endif\n\n float strokeWidth;\n if (u_IsPicking > 0.5) {\n strokeWidth = u_IncreasedLineWidthForHitTesting + u_StrokeWidth;\n } else {\n strokeWidth = u_StrokeWidth;\n }\n\n float antialiasblur = 1.0 / (a_Size.x + strokeWidth);\n\n bool omitStroke = a_StylePacked3.z == 1.0;\n vec2 radius = a_Size + vec2(omitStroke ? 0.0 : strokeWidth / 2.0);\n vec2 offset = (a_Extrude + vec2(1.0) - 2.0 * u_Anchor.xy) * radius;\n\n bool isBillboard = a_StylePacked3.w > 0.5;\n if (isBillboard) {\n vec4 mvPosition = u_ViewMatrix * u_ModelMatrix * vec4( 0.0, 0.0, u_ZIndex, 1.0 );\nvec2 scale;\nscale.x = length( vec3( u_ModelMatrix[ 0 ].x, u_ModelMatrix[ 0 ].y, u_ModelMatrix[ 0 ].z ) );\nscale.y = length( vec3( u_ModelMatrix[ 1 ].x, u_ModelMatrix[ 1 ].y, u_ModelMatrix[ 1 ].z ) );\n\n// if (sizeAttenuation < 0.5) {\n// bool isPerspective = isPerspectiveMatrix( u_ProjectionMatrix );\n// if ( isPerspective ) scale *= - mvPosition.z;\n// }\n\nvec2 alignedPosition = offset * scale;\n\nfloat rotation = 0.0;\nvec2 rotatedPosition;\nrotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y;\nrotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y;\n\nmvPosition.xy += rotatedPosition;\n\ngl_Position = u_ProjectionMatrix * mvPosition;\n } else {\n gl_Position = project(vec4(offset, u_ZIndex, 1.0), u_ProjectionMatrix, u_ViewMatrix, u_ModelMatrix);\n }\n \n v_Radius = radius;\n v_Data = vec4(a_Extrude, antialiasblur, a_StylePacked3.x);\n v_StylePacked3 = a_StylePacked3;\n}",this.material.fragmentShader="#define GLSLIFY 1\nlayout(std140) uniform ub_SceneParams {\n mat4 u_ProjectionMatrix;\n mat4 u_ViewMatrix;\n vec3 u_CameraPosition;\n float u_DevicePixelRatio;\n vec2 u_Viewport;\n float u_IsOrtho;\n float u_IsPicking;\n};\n\nin vec4 v_PickingResult;\nin vec4 v_Color;\nin vec4 v_StrokeColor;\nin vec4 v_StylePacked1;\nin vec4 v_StylePacked2;\n#ifdef USE_UV\n in vec2 v_Uv;\n#endif\n#ifdef USE_MAP\n uniform sampler2D u_Map;\n#endif\n\nin vec4 v_Data;\nin vec2 v_Radius;\nin vec4 v_StylePacked3;\n\nout vec4 outputColor;\n\n/**\n * 2D signed distance field functions\n * @see http://www.iquilezles.org/www/articles/distfunctions2d/distfunctions2d.htm\n */\n\nfloat sdCircle(vec2 p, float r) {\n return length(p) - r;\n}\n\n// @see http://www.iquilezles.org/www/articles/ellipsoids/ellipsoids.htm\nfloat sdEllipsoidApproximated(vec2 p, vec2 r) {\n float k0 = length(p / r);\n float k1 = length(p / (r * r));\n return k0 * (k0 - 1.0) / k1;\n}\n\n// @see https://www.shadertoy.com/view/4llXD7\nfloat sdRoundedBox(vec2 p, vec2 b, vec2 r) {\n vec2 q = abs(p) - b + r;\n return min(max(q.x, q.y), 0.0) + length(max(q, 0.0)) - r.x;\n}\n\nvoid main() {\n int shape = int(floor(v_Data.w + 0.5));\n float epsilon = 0.000001;\n\n vec4 u_Color = v_Color;\nvec4 u_StrokeColor = v_StrokeColor;\nfloat u_Opacity = v_StylePacked1.x;\nfloat u_FillOpacity = v_StylePacked1.y;\nfloat u_StrokeOpacity = v_StylePacked1.z;\nfloat u_StrokeWidth = v_StylePacked1.w;\nfloat u_Visible = v_StylePacked2.x;\nvec3 u_PickingColor = v_PickingResult.xyz;\n\nif (u_Visible < 0.5) {\n discard;\n}\n #ifdef USE_MAP\n #ifdef USE_PATTERN\n vec4 texelColor = texture(SAMPLER_2D(u_Map), v_Uv);\n u_Color = texelColor;\n #else\n vec4 texelColor = texture(SAMPLER_2D(u_Map), v_Uv);\n u_Color = texelColor;\n #endif\n#endif\n\n bool omitStroke = v_StylePacked3.z == 1.0;\n\n float antialiasblur = v_Data.z;\n float antialiased_blur = -max(0.0, antialiasblur);\n vec2 r = (v_Radius - (omitStroke ? 0.0 : u_StrokeWidth)) / v_Radius;\n\n float outer_df;\n float inner_df;\n // 'circle', 'ellipse', 'rect'\n if (shape == 0) {\n outer_df = sdCircle(v_Data.xy, 1.0);\n inner_df = sdCircle(v_Data.xy, r.x);\n } else if (shape == 1) {\n outer_df = sdEllipsoidApproximated(v_Data.xy, vec2(1.0));\n inner_df = sdEllipsoidApproximated(v_Data.xy, r);\n } else if (shape == 2) {\n outer_df = sdRoundedBox(v_Data.xy, vec2(1.0), vec2(0.0));\n inner_df = sdRoundedBox(v_Data.xy, r, vec2(0.0));\n }\n\n float opacity_t = smoothstep(0.0, antialiased_blur, outer_df);\n\n float color_t = u_StrokeWidth < 0.01 ? 0.0 : smoothstep(\n antialiased_blur,\n 0.0,\n inner_df\n );\n\n vec4 diffuseColor;\n vec4 strokeColor;\n if (u_IsPicking > 0.5) {\n diffuseColor = vec4(u_PickingColor, 1.0);\n strokeColor = vec4(u_PickingColor, 1.0);\n } else {\n diffuseColor = u_Color;\n strokeColor = (u_StrokeColor == vec4(0) || omitStroke) ? vec4(0.0) : u_StrokeColor;\n }\n\n outputColor = mix(vec4(diffuseColor.rgb, diffuseColor.a * u_FillOpacity), strokeColor * u_StrokeOpacity, color_t);\n outputColor.a = outputColor.a * u_Opacity * opacity_t;\n\n if (outputColor.a < epsilon)\n discard;\n\n if (u_IsPicking > 0.5) {\n if (u_PickingColor.x == 0.0 && u_PickingColor.y == 0.0 && u_PickingColor.z == 0.0) {\n discard;\n }\n }\n}",this.material.defines=sf({},this.material.defines,$g(e0))},e.createGeometry=function(t){var o=this,a=(u.prototype.createGeometry.call(this,t),[]),s=[],l=[];t.forEach(function(t,e){var n=t,e=4*e,r=n.parsedStyle.radius,i=o.shouldOmitStroke(n.parsedStyle),t=o.getSize(t.parsedStyle,n.nodeName);s.push.apply(s,t.concat([a0.indexOf(n.nodeName),r||0,i?1:0,n.parsedStyle.isBillboard?1:0])),a.push(-1,-1,0,0,1,-1,1,0,1,1,1,1,-1,1,0,1),l.push(0+e,2+e,1+e,0+e,3+e,2+e)}),this.geometry.setIndexBuffer(new Uint32Array(l)),this.geometry.vertexCount=6,this.geometry.setVertexBuffer({bufferIndex:Qg.POSITION,byteStride:16,frequency:Af.PerVertex,attributes:[{format:S.F32_RG,bufferByteOffset:0,location:Jg.POSITION},{format:S.F32_RG,bufferByteOffset:8,location:Jg.UV}],data:new Float32Array(a)}),this.geometry.setVertexBuffer({bufferIndex:t0.PACKED_STYLE,byteStride:24,frequency:Af.PerInstance,attributes:[{format:S.F32_RG,bufferByteOffset:0,location:e0.SIZE,divisor:1},{format:S.F32_RGBA,bufferByteOffset:8,location:e0.PACKED_STYLE3,divisor:1}],data:new Float32Array(s)})},e.updateAttribute=function(t,e,n,r){var i,o=this;u.prototype.updateAttribute.call(this,t,e,n,r),this.updateBatchedAttribute(t,e,n,r),"r"!==n&&"rx"!==n&&"ry"!==n&&"width"!==n&&"height"!==n&&"lineWidth"!==n&&"stroke"!==n&&"lineDash"!==n&&"strokeOpacity"!==n||(i=[],t.forEach(function(t){var e=t,n=o.shouldOmitStroke(e.parsedStyle),r=o.getSize(t.parsedStyle,t.nodeName),r=[r[0],r[1]];i.push.apply(i,r.concat([a0.indexOf(t.nodeName),t.parsedStyle.radius||0,n?1:0,e.parsedStyle.isBillboard?1:0]))}),this.geometry.updateVertexBuffer(t0.PACKED_STYLE,e0.SIZE,e,new Uint8Array(new Float32Array(i).buffer)))},e.getSize=function(t,e){var n,r=[0,0];return e===lt.CIRCLE?r=[n=t.r,n]:e===lt.ELLIPSE?r=[t.rx,t.ry]:e===lt.RECT&&(r=[t.width/2,t.height/2]),r},e.shouldOmitStroke=function(t){var e=t.lineDash,n=t.stroke,t=t.strokeOpacity,n=n&&!n.isNone,e=e&&e.length&&e.every(function(t){return 0!==t});return!n||e||t<1},e.needDrawStrokeSeparately=function(t){var e=t.stroke,n=t.lineDash,r=t.lineWidth,t=t.strokeOpacity,e=e&&!e.isNone,n=n&&n.length&&n.every(function(t){return 0!==t});return e&&0<r&&(n||t<1)},t}(Ia),l0=[0,-.5,0,0,0,1,-.5,1,1,0,1,.5,1,1,1,0,.5,0,0,1],u0=((ka=n0=n0||{})[ka.POINT=5]="POINT",ka[ka.CAP=6]="CAP",ka[ka.DASH=7]="DASH",(Da=r0=r0||{})[Da.POSITION=9]="POSITION",Da[Da.UV=11]="UV",Da[Da.POINTA=10]="POINTA",Da[Da.POINTB=12]="POINTB",Da[Da.CAP=13]="CAP",Da[Da.DASH=14]="DASH",{butt:1,round:2,square:3}),c0=function(a){function t(){return a.apply(this,arguments)||this}lf(t,a);var e=t.prototype;return e.shouldMerge=function(t,e){return!!a.prototype.shouldMerge.call(this,t,e)},e.createMaterial=function(t){this.material.vertexShader="#define GLSLIFY 1\nlayout(std140) uniform ub_SceneParams {\n mat4 u_ProjectionMatrix;\n mat4 u_ViewMatrix;\n vec3 u_CameraPosition;\n float u_DevicePixelRatio;\n vec2 u_Viewport;\n float u_IsOrtho;\n float u_IsPicking;\n};\n\nlayout(location = MODEL_MATRIX0) in vec4 a_ModelMatrix0;\nlayout(location = MODEL_MATRIX1) in vec4 a_ModelMatrix1;\nlayout(location = MODEL_MATRIX2) in vec4 a_ModelMatrix2;\nlayout(location = MODEL_MATRIX3) in vec4 a_ModelMatrix3;\nlayout(location = COLOR) in vec4 a_Color;\nlayout(location = STROKE_COLOR) in vec4 a_StrokeColor;\nlayout(location = PACKED_STYLE1) in vec4 a_StylePacked1;\nlayout(location = PACKED_STYLE2) in vec4 a_StylePacked2;\nlayout(location = PICKING_COLOR) in vec4 a_PickingColor;\n\nout vec4 v_PickingResult;\nout vec4 v_Color;\nout vec4 v_StrokeColor;\nout vec4 v_StylePacked1;\nout vec4 v_StylePacked2;\n\n#define COLOR_SCALE 1. / 255.\nvoid setPickingColor(vec3 pickingColor) {\n v_PickingResult.rgb = pickingColor * COLOR_SCALE;\n}\nvec4 project(vec4 pos, mat4 pm, mat4 vm, mat4 mm) {\n return pm * vm * mm * pos;\n}\n\nlayout(location = POSITION) in vec3 a_Position;\nlayout(location = POINTA) in vec3 a_PointA;\nlayout(location = POINTB) in vec3 a_PointB;\nlayout(location = CAP) in float a_Cap;\n#ifdef USE_UV\n layout(location = UV) in vec2 a_Uv;\n out vec2 v_Uv;\n#endif\nlayout(location = DASH) in vec4 a_Dash;\n\nout vec4 v_Dash;\nout vec2 v_Distance;\n\nbool isPerspectiveMatrix(mat4 m) {\n return m[ 2 ][ 3 ] == - 1.0;\n}\n\nvoid main() {\n mat4 u_ModelMatrix = mat4(a_ModelMatrix0, a_ModelMatrix1, a_ModelMatrix2, a_ModelMatrix3);\nvec4 u_StrokeColor = a_StrokeColor;\nfloat u_Opacity = a_StylePacked1.x;\nfloat u_FillOpacity = a_StylePacked1.y;\nfloat u_StrokeOpacity = a_StylePacked1.z;\nfloat u_StrokeWidth = a_StylePacked1.w;\nfloat u_ZIndex = a_PickingColor.w;\nvec2 u_Anchor = a_StylePacked2.yz;\nfloat u_IncreasedLineWidthForHitTesting = a_StylePacked2.w;\n\nsetPickingColor(a_PickingColor.xyz);\n\nv_Color = a_Color;\nv_StrokeColor = a_StrokeColor;\nv_StylePacked1 = a_StylePacked1;\nv_StylePacked2 = a_StylePacked2;\n\n#ifdef CLIPSPACE_NEAR_ZERO\n gl_Position.z = gl_Position.z * 0.5 + 0.5;\n#endif\n #ifdef USE_UV\n v_Uv = a_Uv;\n #ifdef VIEWPORT_ORIGIN_TL\n v_Uv.y = 1.0 - v_Uv.y;\n #endif\n#endif\n\n float strokeWidth;\n if (u_IsPicking > 0.5) {\n strokeWidth = u_IncreasedLineWidthForHitTesting + u_StrokeWidth;\n } else {\n strokeWidth = u_StrokeWidth;\n }\n\n float isBillboard = a_Dash.w;\n bool isPerspective = isPerspectiveMatrix(u_ProjectionMatrix);\n\n if (isBillboard > 0.5 && isPerspective) {\n // clip space\n vec4 clip0 = project(vec4(a_PointA, 1.0), u_ProjectionMatrix, u_ViewMatrix, u_ModelMatrix);\n vec4 clip1 = project(vec4(a_PointB, 1.0), u_ProjectionMatrix, u_ViewMatrix, u_ModelMatrix);\n // screen space\n vec2 screen0 = u_Viewport * (0.5 * clip0.xy / clip0.w + 0.5);\n vec2 screen1 = u_Viewport * (0.5 * clip1.xy / clip1.w + 0.5);\n vec2 xBasis = normalize(screen1 - screen0);\n vec2 yBasis = vec2(-xBasis.y, xBasis.x);\n vec2 pt0 = screen0 + strokeWidth * (a_Position.x * xBasis + a_Position.y * yBasis);\n vec2 pt1 = screen1 + strokeWidth * (a_Position.x * xBasis + a_Position.y * yBasis);\n vec2 pt = mix(pt0, pt1, a_Position.z);\n vec4 clip = mix(clip0, clip1, a_Position.z);\n gl_Position = vec4(clip.w * (2.0 * pt / u_Viewport - 1.0), clip.z, clip.w);\n } else {\n vec2 xBasis = a_PointB.xy - a_PointA.xy;\n vec2 yBasis = normalize(vec2(-xBasis.y, xBasis.x));\n\n vec2 point = a_PointA.xy + xBasis * a_Position.x + yBasis * strokeWidth * a_Position.y;\n point = point - u_Anchor.xy * abs(xBasis);\n\n // round & square\n if (a_Cap > 1.0) {\n point += sign(a_Position.x - 0.5) * normalize(xBasis) * vec2(strokeWidth / 2.0);\n }\n gl_Position = project(vec4(point, u_ZIndex, 1.0), u_ProjectionMatrix, u_ViewMatrix, u_ModelMatrix);\n }\n\n float antialiasblur = 1.0 / strokeWidth;\n v_Distance = vec2(a_Position.y * 2.0, antialiasblur);\n v_Dash = vec4(a_Position.x, a_Dash.xyz);\n}",this.material.fragmentShader="#define GLSLIFY 1\nlayout(std140) uniform ub_SceneParams {\n mat4 u_ProjectionMatrix;\n mat4 u_ViewMatrix;\n vec3 u_CameraPosition;\n float u_DevicePixelRatio;\n vec2 u_Viewport;\n float u_IsOrtho;\n float u_IsPicking;\n};\n\nin vec4 v_PickingResult;\nin vec4 v_Color;\nin vec4 v_StrokeColor;\nin vec4 v_StylePacked1;\nin vec4 v_StylePacked2;\n#ifdef USE_UV\n in vec2 v_Uv;\n#endif\n#ifdef USE_MAP\n uniform sampler2D u_Map;\n#endif\n\nin vec4 v_Dash;\nin vec2 v_Distance;\n\nout vec4 outputColor;\n\nvoid main() {\n vec4 u_Color = v_Color;\nvec4 u_StrokeColor = v_StrokeColor;\nfloat u_Opacity = v_StylePacked1.x;\nfloat u_FillOpacity = v_StylePacked1.y;\nfloat u_StrokeOpacity = v_StylePacked1.z;\nfloat u_StrokeWidth = v_StylePacked1.w;\nfloat u_Visible = v_StylePacked2.x;\nvec3 u_PickingColor = v_PickingResult.xyz;\n\nif (u_Visible < 0.5) {\n discard;\n}\n #ifdef USE_MAP\n #ifdef USE_PATTERN\n vec4 texelColor = texture(SAMPLER_2D(u_Map), v_Uv);\n u_Color = texelColor;\n #else\n vec4 texelColor = texture(SAMPLER_2D(u_Map), v_Uv);\n u_Color = texelColor;\n #endif\n#endif\n\n if (u_IsPicking > 0.5) {\n if (u_PickingColor.x == 0.0 && u_PickingColor.y == 0.0 && u_PickingColor.z == 0.0) {\n discard;\n }\n outputColor = vec4(u_PickingColor, 1.0);\n } else {\n outputColor = u_StrokeColor;\n #ifdef USE_MAP\n outputColor = u_Color;\n #endif\n\n float blur = smoothstep(0.0, v_Distance.y, 1.0 - abs(v_Distance.x));\n float u_dash_offset = v_Dash.y;\n float u_dash_array = v_Dash.z;\n float u_dash_ratio = v_Dash.w;\n\n outputColor.a = outputColor.a\n * blur\n * u_Opacity * u_StrokeOpacity\n * ceil(mod(v_Dash.x + u_dash_offset, u_dash_array) - (u_dash_array * u_dash_ratio));\n }\n}",this.material.defines=sf({},this.material.defines,$g(r0))},e.createGeometry=function(t){var v=this,y=(a.prototype.createGeometry.call(this,t),[]),E=[],_=[],b=[],x=0;t.forEach(function(t){t.nodeName===lt.LINE?(p=t.parsedStyle,g=t.getTotalLength()):t.nodeName===lt.POLYLINE?(c=(u=t.parsedStyle).points.points,e=u.defX,n=u.defY,r=u.lineCap,i=u.lineDash,o=u.lineDashOffset,a=u.markerStart,s=u.markerEnd,l=u.markerStartOffset,u=u.markerEndOffset,p={x1:c[0][0],y1:c[0][1],x2:c[c.length-1][0],y2:c[c.length-1][1],z1:0,z2:0,defX:e,defY:n,lineCap:r,lineDash:i,lineDashOffset:o,isBillboard:!0,markerStart:a,markerEnd:s,markerStartOffset:l,markerEndOffset:u},g=t.getTotalLength()):t.nodeName===lt.PATH&&(e=(c=t.parsedStyle).path.absolutePath,n=c.defX,r=c.defY,i=c.lineCap,o=c.lineDash,a=c.lineDashOffset,s=c.markerStart,l=c.markerEnd,u=c.markerStartOffset,c=c.markerEndOffset,p={x1:e[0][1],y1:e[0][2],x2:e[1][1],y2:e[1][2],z1:0,z2:0,defX:n,defY:r,lineCap:i,lineDash:o,lineDashOffset:a,isBillboard:!1,markerStart:s,markerEnd:l,markerStartOffset:u,markerEndOffset:c},g=t.getTotalLength());var e=p,n=e.x1,r=e.y1,i=e.x2,o=e.y2,a=e.z1,s=e.z2,l=e.defX,u=e.defY,c=e.lineCap,t=e.isBillboard,e=v.calcOffset(p),h=e.startOffsetX,d=e.startOffsetY,f=e.endOffsetX,e=e.endOffsetY,p=v.calcDash(p,g),g=p.dashOffset,m=p.dashSegmentPercent,p=p.dashRatioInEachSegment;E.push(u0[c]),_.push(g,m,p,t?1:0),y.push(n-l+h,r-u+d,a,i-l+f,o-u+e,s),b.push(0+x,2+x,1+x,0+x,3+x,2+x),x+=4}),this.geometry.setIndexBuffer(new Uint32Array(b)),this.geometry.vertexCount=6,this.geometry.setVertexBuffer({bufferIndex:Qg.POSITION,byteStride:20,frequency:Af.PerInstance,attributes:[{format:S.F32_RGB,bufferByteOffset:0,location:r0.POSITION,divisor:0},{format:S.F32_RG,bufferByteOffset:12,location:r0.UV,divisor:0}],data:new Float32Array(l0)}),this.geometry.setVertexBuffer({bufferIndex:n0.POINT,byteStride:24,frequency:Af.PerInstance,attributes:[{format:S.F32_RGB,bufferByteOffset:0,location:r0.POINTA,divisor:1},{format:S.F32_RGB,bufferByteOffset:12,location:r0.POINTB,divisor:1}],data:new Float32Array(y)}),this.geometry.setVertexBuffer({bufferIndex:n0.CAP,byteStride:4,frequency:Af.PerInstance,attributes:[{format:S.F32_R,bufferByteOffset:0,location:r0.CAP,divisor:1}],data:new Float32Array(E)}),this.geometry.setVertexBuffer({bufferIndex:n0.DASH,byteStride:16,frequency:Af.PerInstance,attributes:[{format:S.F32_RGBA,bufferByteOffset:0,location:r0.DASH,divisor:1}],data:new Float32Array(_)})},e.updateAttribute=function(t,e,n,r){var d,i,o,f=this;a.prototype.updateAttribute.call(this,t,e,n,r),this.updateBatchedAttribute(t,e,n,r),"x1"===n||"y1"===n||"x2"===n||"y2"===n||"z1"===n||"z2"===n||"markerStartOffset"===n||"markerEndOffset"===n||"markerStart"===n||"markerEnd"===n||"points"===n||"path"===n?(d=[],t.forEach(function(t){t.nodeName===lt.LINE?u=t.parsedStyle:t.nodeName===lt.POLYLINE&&t.renderable.proxyNodeName===lt.LINE?(e=(l=t.parsedStyle).points.points,n=l.defX,r=l.defY,i=l.lineCap,o=l.markerStart,a=l.markerEnd,s=l.markerStartOffset,l=l.markerEndOffset,u={x1:e[0][0],y1:e[0][1],x2:e[e.length-1][0],y2:e[e.length-1][1],z1:0,z2:0,defX:n,defY:r,lineCap:i,isBillboard:!0,markerStart:o,markerEnd:a,markerStartOffset:s,markerEndOffset:l}):t.nodeName===lt.PATH&&t.renderable.proxyNodeName===lt.LINE&&(n=(e=t.parsedStyle).path.absolutePath,r=e.defX,i=e.defY,o=e.lineCap,a=e.markerStart,s=e.markerEnd,l=e.markerStartOffset,t=e.markerEndOffset,u={x1:n[0][1],y1:n[0][2],x2:n[1][1],y2:n[1][2],z1:0,z2:0,defX:r,defY:i,lineCap:o,isBillboard:!0,markerStart:a,markerEnd:s,markerStartOffset:l,markerEndOffset:t});var e=u,n=e.x1,r=e.y1,i=e.x2,o=e.y2,a=e.z1,s=e.z2,l=e.defX,t=e.defY,e=f.calcOffset(u),u=e.startOffsetX,c=e.startOffsetY,h=e.endOffsetX,e=e.endOffsetY;d.push(n-l+u,r-t+c,a,i-l+h,o-t+e,s)}),this.geometry.updateVertexBuffer(n0.POINT,r0.POINTA,e,new Uint8Array(new Float32Array(d).buffer))):"lineDashOffset"===n||"lineDash"===n||"isBillboard"===n?(i=[],t.forEach(function(t){var e=t.getTotalLength(),e=f.calcDash(t.parsedStyle,e),n=e.dashOffset,r=e.dashSegmentPercent,e=e.dashRatioInEachSegment;i.push(n,r,e,t.parsedStyle.isBillboard?1:0)}),this.geometry.updateVertexBuffer(n0.DASH,r0.DASH,e,new Uint8Array(new Float32Array(i).buffer))):"lineCap"===n&&(o=[],t.forEach(function(t){t=t.parsedStyle.lineCap;o.push(u0[t])}),this.geometry.updateVertexBuffer(n0.CAP,r0.CAP,e,new Uint8Array(new Float32Array(o).buffer)))},e.calcOffset=function(t){var e,n,r=t.x1,i=t.y1,o=t.x2,a=t.y2,s=t.markerStart,l=t.markerEnd,u=t.markerStartOffset,t=t.markerEndOffset,c=0,h=0,d=0,f=0,p=0;return s&&ut(s)&&u&&(e=o-r,n=a-i,p=Math.atan2(n,e),c=Math.cos(p)*(u||0),h=Math.sin(p)*(u||0)),l&&ut(l)&&t&&(e=r-o,n=i-a,p=Math.atan2(n,e),d=Math.cos(p)*(t||0),f=Math.sin(p)*(t||0)),{startOffsetX:c,startOffsetY:h,endOffsetX:d,endOffsetY:f}},e.calcDash=function(t,e){var n=t.lineDash,t=t.lineDashOffset,r=0,i=1,o=0;return n&&n.length&&(r=(t||0)/e,o=0===(t=n.reduce(function(t,e){return t+e},0))?(i=1,0):(i=t/e,n[1]/t)),{dashOffset:r,dashSegmentPercent:i,dashRatioInEachSegment:o}},t}(Ia);function h0(t,e,n,r){t-=n,n=e-r;return Math.sqrt(t*t+n*n)}function d0(t,e){return Math.abs(t-e)<.001}function f0(t,e){var n=Math.min.apply(Math,t),r=Math.min.apply(Math,e);return{x:n,y:r,width:Math.max.apply(Math,t)-n,height:Math.max.apply(Math,e)-r}}function p0(t){return(t+2*Math.PI)%(2*Math.PI)}var g0={box:function(t,e,n,r){return f0([t,n],[e,r])},length:h0,pointAt:function(t,e,n,r,i){return{x:(1-i)*t+i*n,y:(1-i)*e+i*r}},pointDistance:function(t,e,n,r,i,o){var a=(n-t)*(i-t)+(r-e)*(o-e);return a<0?h0(t,e,i,o):(n-t)*(n-t)+(r-e)*(r-e)<a?h0(n,r,i,o):this.pointToLine(t,e,n,r,i,o)},pointToLine:function(t,e,n,r,i,o){n=[n-t,r-e];return ee(n,[0,0])?Math.sqrt((i-t)*(i-t)+(o-e)*(o-e)):(Jt(r=[-n[1],n[0]],r),Math.abs(te([i-t,o-e],r)))},tangentAngle:function(t,e,n,r){return Math.atan2(r-e,n-t)}},m0=1e-4;function v0(t,e,n,r,i,o){for(var a=-1,s=1/0,l=[n,r],u=20,c=1/(u=o&&200<o?o/10:u),h=c/10,d=0;d<=u;d++){var f=d*c,p=[i.apply(void 0,t.concat([f])),i.apply(void 0,e.concat([f]))],p=h0(l[0],l[1],p[0],p[1]);p<s&&(a=f,s=p)}if(0===a)return{x:t[0],y:e[0]};if(1===a)return{x:t[(n=t.length)-1],y:e[n-1]};for(var s=1/0,g=0;g<32&&!(h<m0);g++){var m=a-h,v=a+h,y=[i.apply(void 0,t.concat([m])),i.apply(void 0,e.concat([m]))],y=h0(l[0],l[1],y[0],y[1]);0<=m&&y<s?(a=m,s=y):(m=[i.apply(void 0,t.concat([v])),i.apply(void 0,e.concat([v]))],y=h0(l[0],l[1],m[0],m[1]),v<=1&&y<s?(a=v,s=y):h*=.5)}return{x:i.apply(void 0,t.concat([a])),y:i.apply(void 0,e.concat([a]))}}function y0(t,e,n,r){var i=1-r;return i*i*t+2*r*i*e+r*r*n}function E0(t,e,n){n=t+n-2*e;return d0(n,0)?[.5]:(t=(t-e)/n)<=1&&0<=t?[t]:[]}function _0(t,e,n,r){return 2*(1-r)*(e-t)+2*r*(n-e)}function b0(t,e,n,r,i,o,a){var s=y0(t,n,i,a),l=y0(e,r,o,a),u=g0.pointAt(t,e,n,r,a),n=g0.pointAt(n,r,i,o,a);return[[t,e,u.x,u.y,s,l],[s,l,n.x,n.y,i,o]]}function x0(t,e,n,r,i,o,a){return 0===a?(h0(t,e,n,r)+h0(n,r,i,o)+h0(t,e,i,o))/2:(e=(t=b0(t,e,n,r,i,o,.5))[0],n=t[1],e.push(a-1),n.push(a-1),x0.apply(void 0,e)+x0.apply(void 0,n))}var S0={box:function(t,e,n,r,i,o){var a=E0(t,n,i)[0],s=E0(e,r,o)[0],l=[t,i],u=[e,o];return void 0!==a&&l.push(y0(t,n,i,a)),void 0!==s&&u.push(y0(e,r,o,s)),f0(l,u)},length:function(t,e,n,r,i,o){return x0(t,e,n,r,i,o,3)},nearestPoint:function(t,e,n,r,i,o,a,s){return v0([t,n,i],[e,r,o],a,s,y0)},pointDistance:function(t,e,n,r,i,o,a,s){t=this.nearestPoint(t,e,n,r,i,o,a,s);return h0(t.x,t.y,a,s)},interpolationAt:y0,pointAt:function(t,e,n,r,i,o,a){return{x:y0(t,n,i,a),y:y0(e,r,o,a)}},divide:b0,tangentAngle:function(t,e,n,r,i,o,a){t=_0(t,n,i,a),n=_0(e,r,o,a);return p0(Math.atan2(n,t))}};function w0(t,e,n,r,i){var o=1-i;return o*o*o*t+3*e*i*o*o+3*n*i*i*o+r*i*i*i}function T0(t,e,n,r,i){var o=1-i;return 3*(o*o*(e-t)+2*o*i*(n-e)+i*i*(r-n))}function A0(t,e,n,r){var i,o,r=-3*t+9*e-9*n+3*r,n=6*t-12*e+6*n,e=3*e-3*t,t=[];return d0(r,0)?d0(n,0)||0<=(i=-e/n)&&i<=1&&t.push(i):d0(e=n*n-4*r*e,0)?t.push(-n/(2*r)):0<e&&(o=(-n-(e=Math.sqrt(e)))/(2*r),0<=(i=(-n+e)/(2*r))&&i<=1&&t.push(i),0<=o)&&o<=1&&t.push(o),t}function M0(t,e,n,r,i,o,a,s,l){var u=w0(t,n,i,a,l),c=w0(e,r,o,s,l),h=g0.pointAt(t,e,n,r,l),n=g0.pointAt(n,r,i,o,l),r=g0.pointAt(i,o,a,s,l),i=g0.pointAt(h.x,h.y,n.x,n.y,l),o=g0.pointAt(n.x,n.y,r.x,r.y,l);return[[t,e,h.x,h.y,i.x,i.y,u,c],[u,c,o.x,o.y,r.x,r.y,a,s]]}function R0(t,e,n,r,i,o,a,s,l){if(0===l){for(var u=[t,n,i,a],c=[e,r,o,s],h=0,d=u.length,f=0;f<d;f++)h+=h0(u[f],c[f],u[(f+1)%d],c[(f+1)%d]);return h/2}t=M0(t,e,n,r,i,o,a,s,.5),e=[].concat(t[0],[l-1]),n=[].concat(t[1],[l-1]);return R0.apply(void 0,e)+R0.apply(void 0,n)}var N0={extrema:A0,box:function(t,e,n,r,i,o,a,s){for(var l=[t,a],u=[e,s],c=A0(t,n,i,a),h=A0(e,r,o,s),d=0;d<c.length;d++)l.push(w0(t,n,i,a,c[d]));for(var f=0;f<h.length;f++)u.push(w0(e,r,o,s,h[f]));return f0(l,u)},length:function(t,e,n,r,i,o,a,s){return R0(t,e,n,r,i,o,a,s,3)},nearestPoint:function(t,e,n,r,i,o,a,s,l,u,c){return v0([t,n,i,a],[e,r,o,s],l,u,w0,c)},pointDistance:function(t,e,n,r,i,o,a,s,l,u,c){t=this.nearestPoint(t,e,n,r,i,o,a,s,l,u,c);return h0(t.x,t.y,l,u)},interpolationAt:w0,pointAt:function(t,e,n,r,i,o,a,s,l){return{x:w0(t,n,i,a,l),y:w0(e,r,o,s,l)}},divide:M0,tangentAngle:function(t,e,n,r,i,o,a,s,l){t=T0(t,n,i,a,l),n=T0(e,r,o,s,l);return p0(Math.atan2(n,t))}},C0=10,P0=8,O0=100;function I0(t,e,n,r,i,o,a){var s,l,u,c,h,d=a[a.length-2],f=a[a.length-1],p=(a.length-=2,N0.length(d,f,t,e,n,r,i,o)),g=Ue(p/C0,P0,O0);a.push(d,f);for(var m,v=1;v<=g;++v)a.push((u=(l=(s=1-(m=v/g))*s)*s)*d+3*l*m*t+3*s*(c=m*m)*n+(h=c*m)*i,u*f+3*l*m*e+3*s*c*r+h*o)}var L0,k0=1e20,D0=function(){function t(t){this.buffer=void 0,this.radius=void 0,this.cutoff=void 0,this.size=void 0,this.f=void 0,this.z=void 0,this.v=void 0,this.gridOuter=void 0,this.gridInner=void 0,this.ctx=void 0;var e=t.fontSize,e=void 0===e?24:e,n=t.buffer,n=void 0===n?3:n,r=t.radius,r=void 0===r?8:r,i=t.cutoff,i=void 0===i?.25:i,o=t.fontFamily,o=void 0===o?"sans-serif":o,a=t.fontWeight,a=void 0===a?"normal":a,s=t.fontStyle,s=void 0===s?"normal":s,t=t.canvas,i=(this.buffer=n,this.cutoff=i,this.radius=r,this.size=e+4*n),r=ct.offscreenCanvas.getOrCreateCanvas(t),n=(r.width=i,r.height=i,ct.offscreenCanvas.getOrCreateContext(t));(this.ctx=n).font=s+" "+a+" "+e+"px "+o,n.textBaseline="alphabetic",n.textAlign="left",n.fillStyle="black",this.gridOuter=new Float64Array(i*i),this.gridInner=new Float64Array(i*i),this.f=new Float64Array(i),this.z=new Float64Array(i+1),this.v=new Uint16Array(i)}return t.prototype.draw=function(t){var e=this.ctx.measureText(t),n=e.width,r=e.actualBoundingBoxAscent,i=e.actualBoundingBoxDescent,o=e.actualBoundingBoxLeft,e=e.actualBoundingBoxRight,r=Math.ceil(r),a=Math.max(0,Math.min(this.size-this.buffer,Math.ceil(e-o))),s=Math.min(this.size-this.buffer,r+Math.ceil(i)),l=a+2*this.buffer,e=s+2*this.buffer,u=Math.max(l*e,0),c=new Uint8ClampedArray(u),o={data:c,width:l,height:e,glyphWidth:a,glyphHeight:s,glyphTop:r,glyphLeft:0,glyphAdvance:n};if(0!==a&&0!==s){var i=this.ctx,h=this.buffer,d=this.gridInner,f=this.gridOuter,p=(i.clearRect(h,h,a,s),i.fillText(t,h,h+r),i.getImageData(h,h,a,s));f.fill(k0,0,u),d.fill(0,0,u);for(var g=0;g<s;g++)for(var m=0;m<a;m++){var v,y=p.data[4*(g*a+m)+3]/255;0!=y&&(v=(g+h)*l+m+h,1==y?(f[v]=0,d[v]=k0):(f[v]=0<(y=.5-y)?y*y:0,d[v]=y<0?y*y:0))}B0(f,0,0,l,e,l,this.f,this.v,this.z),B0(d,h,h,a,s,l,this.f,this.v,this.z);for(var E=0;E<u;E++){var _=Math.sqrt(f[E])-Math.sqrt(d[E]);c[E]=Math.round(255-255*(_/this.radius+this.cutoff))}}return o},t}();function B0(t,e,n,r,i,o,a,s,l){for(var u=e;u<e+r;u++)F0(t,n*o+u,o,i,a,s,l);for(var c=n;c<n+i;c++)F0(t,c*o+e,1,r,a,s,l)}function F0(t,e,n,r,i,o,a){a[o[0]=0]=-k0,a[1]=k0,i[0]=t[e];for(var s=1,l=0,u=0;s<r;s++){i[s]=t[e+s*n];var c=s*s;do{var h=o[l],u=(i[s]-i[h]+c-h*h)/(s-h)/2}while(u<=a[l]&&-1<--l);o[++l]=s,a[l]=u,a[l+1]=k0}for(var d=0,f=0;d<r;d++){for(;a[f+1]<d;)f++;var p=o[f],g=d-p;t[e+d*n]=i[p]+g*g}}(b=L0=L0||{})[b.NONE=0]="NONE",b[b.FILL=1]="FILL",b[b.JOINT_BEVEL=4]="JOINT_BEVEL",b[b.JOINT_MITER=8]="JOINT_MITER",b[b.JOINT_ROUND=12]="JOINT_ROUND",b[b.JOINT_CAP_BUTT=16]="JOINT_CAP_BUTT",b[b.JOINT_CAP_SQUARE=18]="JOINT_CAP_SQUARE",b[b.JOINT_CAP_ROUND=20]="JOINT_CAP_ROUND",b[b.FILL_EXPAND=24]="FILL_EXPAND",b[b.CAP_BUTT=32]="CAP_BUTT",b[b.CAP_SQUARE=64]="CAP_SQUARE",b[b.CAP_ROUND=96]="CAP_ROUND",b[b.CAP_BUTT2=128]="CAP_BUTT2";var U0,G0,m,W0=2,V0=3,j0=((xa=U0=U0||{})[xa.PACKED=0]="PACKED",xa[xa.VERTEX_NUM=1]="VERTEX_NUM",xa[xa.TRAVEL=2]="TRAVEL",(a=G0=G0||{})[a.PREV=0]="PREV",a[a.POINT1=1]="POINT1",a[a.POINT2=2]="POINT2",a[a.NEXT=3]="NEXT",a[a.VERTEX_JOINT=4]="VERTEX_JOINT",a[a.VERTEX_NUM=5]="VERTEX_NUM",a[a.TRAVEL=6]="TRAVEL",(zs=m=m||{}).MODEL_MATRIX="u_ModelMatrix",zs.FILL_COLOR="u_FillColor",zs.STROKE_COLOR="u_StrokeColor",zs.STROKE_WIDTH="u_StrokeWidth",zs.INCREASED_LINE_WIDTH_FOR_HIT_TESTING="u_IncreasedLineWidthForHitTesting",zs.OPACITY="u_Opacity",zs.FILL_OPACITY="u_FillOpacity",zs.STROKE_OPACITY="u_StrokeOpacity",zs.EXPAND="u_Expand",zs.MITER_LIMIT="u_MiterLimit",zs.SCALE_MODE="u_ScaleMode",zs.ALIGNMENT="u_Alignment",zs.PICKING_COLOR="u_PickingColor",zs.DASH="u_Dash",zs.GAP="u_Gap",zs.DASH_OFFSET="u_DashOffset",zs.VISIBLE="u_Visible",zs.Z_INDEX="u_ZIndex",function(n){function t(){return n.apply(this,arguments)||this}lf(t,n);var e=t.prototype;return e.shouldMerge=function(t,e){return!1},e.updateAttribute=function(t,e,d,f){var p=this;n.prototype.updateAttribute.call(this,t,e,d,f),t.forEach(function(t){var e,n=t.parsedStyle,r=n.stroke,i=n.opacity,o=n.fillOpacity,a=n.strokeOpacity,s=n.lineWidth,l=n.increasedLineWidthForHitTesting,u=n.anchor,c=n.lineDash,h=n.lineDashOffset,n=n.visibility;"lineJoin"===d||"lineCap"===d||"markerStart"===d||"markerEnd"===d||"markerStartOffset"===d||"markerEndOffset"===d||t.nodeName===lt.CIRCLE&&"r"===d||t.nodeName===lt.ELLIPSE&&("rx"===d||"ry"===d)||t.nodeName===lt.RECT&&("width"===d||"height"===d||"radius"===d)||t.nodeName===lt.LINE&&("x1"===d||"y1"===d||"x2"===d||"y2"===d)||t.nodeName===lt.POLYLINE&&"points"===d||t.nodeName===lt.POLYGON&&"points"===d||t.nodeName===lt.PATH&&"path"===d?(p.material.geometryDirty=!0,p.material.programDirty=!0):"stroke"===d?(e=[0,0,0,0],To(r)&&(e=[Number(r.r)/255,Number(r.g)/255,Number(r.b)/255,Number(r.alpha)]),p.material.setUniforms(((r={})[m.STROKE_COLOR]=e,r))):"opacity"===d?p.material.setUniforms(((e={})[m.OPACITY]=i,e)):"fillOpacity"===d?p.material.setUniforms(((r={})[m.FILL_OPACITY]=o,r)):"strokeOpacity"===d?p.material.setUniforms(((i={})[m.STROKE_OPACITY]=a,i)):"lineWidth"===d?p.material.setUniforms(((e={})[m.STROKE_WIDTH]=s,e)):"increasedLineWidthForHitTesting"===d?p.material.setUniforms(((o={})[m.INCREASED_LINE_WIDTH_FOR_HIT_TESTING]=l||0,o)):"anchor"===d||"modelMatrix"===d?(a=r=0,(i=t.getGeometryBounds())&&(r=-(s=i.halfExtents)[0]*u[0]*2,a=-s[1]*u[1]*2),e=K(),wt(e,t.getWorldTransform(),ht(e,x(r,a,0))),p.material.setUniforms(((l={})[m.MODEL_MATRIX]=e,l))):"visibility"===d?p.material.setUniforms(((o={})[m.VISIBLE]="visible"===n?1:0,o)):"lineDash"===d?p.material.setUniforms(((i={})[m.DASH]=c[0]||0,i[m.GAP]=c[1]||0,i)):"lineDashOffset"===d?p.material.setUniforms(((s={})[m.DASH_OFFSET]=h||0,s)):"pointerEvents"===d&&(r=f&&t.isInteractive()&&(null==(u=t.renderable3D)?void 0:u.encodedPickingColor)||[0,0,0],p.material.setUniforms(((a={})[m.PICKING_COLOR]=r,a)))})},e.changeRenderOrder=function(t,e){var n;this.material&&this.material.setUniforms(((n={})[m.Z_INDEX]=e*zg,n))},e.createMaterial=function(t){this.material.vertexShader="#define GLSLIFY 1\nlayout(std140) uniform ub_SceneParams {\n mat4 u_ProjectionMatrix;\n mat4 u_ViewMatrix;\n vec3 u_CameraPosition;\n float u_DevicePixelRatio;\n vec2 u_Viewport;\n float u_IsOrtho;\n float u_IsPicking;\n};\nlayout(std140) uniform ub_ObjectParams {\n mat4 u_ModelMatrix;\n vec4 u_FillColor;\n vec4 u_StrokeColor;\n float u_StrokeWidth;\n float u_Opacity;\n float u_FillOpacity;\n float u_StrokeOpacity;\n float u_Expand;\n float u_MiterLimit;\n float u_ScaleMode;\n float u_Alignment;\n vec3 u_PickingColor;\n float u_Dash;\n float u_Gap;\n float u_DashOffset;\n float u_Visible;\n float u_ZIndex;\n float u_IncreasedLineWidthForHitTesting;\n};\n\nlayout(location = PREV) in vec2 a_Prev;\nlayout(location = POINT1) in vec2 a_Point1;\nlayout(location = POINT2) in vec2 a_Point2;\nlayout(location = NEXT) in vec2 a_Next;\nlayout(location = VERTEX_JOINT) in float a_VertexJoint;\nlayout(location = VERTEX_NUM) in float a_VertexNum;\nlayout(location = TRAVEL) in float a_Travel;\n\nconst float FILL = 1.0;\nconst float BEVEL = 4.0;\nconst float MITER = 8.0;\nconst float ROUND = 12.0;\nconst float JOINT_CAP_BUTT = 16.0;\nconst float JOINT_CAP_SQUARE = 18.0;\nconst float JOINT_CAP_ROUND = 20.0;\nconst float FILL_EXPAND = 24.0;\nconst float CAP_BUTT = 1.0;\nconst float CAP_SQUARE = 2.0;\nconst float CAP_ROUND = 3.0;\nconst float CAP_BUTT2 = 4.0;\n\nout vec4 v_Distance;\nout vec4 v_Arc;\nout float v_Type;\nout float v_Travel;\n\nvec2 doBisect(\n vec2 norm, float len, vec2 norm2, float len2, float dy, float inner\n) {\n vec2 bisect = (norm + norm2) / 2.0;\n bisect /= dot(norm, bisect);\n vec2 shift = dy * bisect;\n if (inner > 0.5) {\n if (len < len2) {\n if (abs(dy * (bisect.x * norm.y - bisect.y * norm.x)) > len) {\n return dy * norm;\n }\n } else {\n if (abs(dy * (bisect.x * norm2.y - bisect.y * norm2.x)) > len2) {\n return dy * norm;\n }\n }\n }\n return dy * bisect;\n}\n\nvoid main() {\n vec2 pointA = (u_ModelMatrix * vec4(a_Point1, 0., 1.0)).xy;\n vec2 pointB = (u_ModelMatrix * vec4(a_Point2, 0., 1.0)).xy;\n\n vec2 xBasis = pointB - pointA;\n float len = length(xBasis);\n vec2 forward = xBasis / len;\n vec2 norm = vec2(forward.y, -forward.x);\n\n float type = a_VertexJoint;\n\n float lineWidth;\n if (u_IsPicking > 0.5) {\n lineWidth = u_IncreasedLineWidthForHitTesting + u_StrokeWidth;\n } else {\n lineWidth = u_StrokeWidth;\n }\n\n if (u_ScaleMode > 2.5) {\n lineWidth *= length(u_ModelMatrix * vec4(1.0, 0.0, 0.0, 0.0));\n } else if (u_ScaleMode > 1.5) {\n lineWidth *= length(u_ModelMatrix * vec4(0.0, 1.0, 0.0, 0.0));\n } else if (u_ScaleMode > 0.5) {\n vec2 avgDiag = (u_ModelMatrix * vec4(1.0, 1.0, 0.0, 0.0)).xy;\n lineWidth *= sqrt(dot(avgDiag, avgDiag) * 0.5);\n }\n float capType = floor(type / 32.0);\n type -= capType * 32.0;\n v_Arc = vec4(0.0);\n lineWidth *= 0.5;\n float lineAlignment = 2.0 * u_Alignment - 1.0;\n\n vec2 pos;\n\n if (capType == CAP_ROUND) {\n if (a_VertexNum < 3.5) {\n gl_Position = vec4(0.0, 0.0, 0.0, 1.0);\n return;\n }\n type = JOINT_CAP_ROUND;\n capType = 0.0;\n }\n\n if (type >= BEVEL) {\n float dy = lineWidth + u_Expand;\n float inner = 0.0;\n if (a_VertexNum >= 1.5) {\n dy = -dy;\n inner = 1.0;\n }\n\n vec2 base, next, xBasis2, bisect;\n float flag = 0.0;\n float sign2 = 1.0;\n if (a_VertexNum < 0.5 || a_VertexNum > 2.5 && a_VertexNum < 3.5) {\n next = (u_ModelMatrix * vec4(a_Prev, 0.0, 1.0)).xy;\n base = pointA;\n flag = type - floor(type / 2.0) * 2.0;\n sign2 = -1.0;\n\n } else {\n next = (u_ModelMatrix * vec4(a_Next, 0.0, 1.0)).xy;\n base = pointB;\n if (type >= MITER && type < MITER + 3.5) {\n flag = step(MITER + 1.5, type);\n // check miter limit here?\n }\n }\n xBasis2 = next - base;\n float len2 = length(xBasis2);\n vec2 norm2 = vec2(xBasis2.y, -xBasis2.x) / len2;\n float D = norm.x * norm2.y - norm.y * norm2.x;\n if (D < 0.0) {\n inner = 1.0 - inner;\n }\n norm2 *= sign2;\n\n if (abs(lineAlignment) > 0.01) {\n float shift = lineWidth * lineAlignment;\n pointA += norm * shift;\n pointB += norm * shift;\n if (abs(D) < 0.01) {\n base += norm * shift;\n } else {\n base += doBisect(norm, len, norm2, len2, shift, 0.0);\n }\n }\n\n float collinear = step(0.0, dot(norm, norm2));\n v_Type = 0.0;\n float dy2 = -1000.0;\n float dy3 = -1000.0;\n if (abs(D) < 0.01 && collinear < 0.5) {\n if (type >= ROUND && type < ROUND + 1.5) {\n type = JOINT_CAP_ROUND;\n }\n //TODO: BUTT here too\n }\n\n if (a_VertexNum < 3.5) {\n if (abs(D) < 0.01) {\n pos = dy * norm;\n } else {\n if (flag < 0.5 && inner < 0.5) {\n pos = dy * norm;\n } else {\n pos = doBisect(norm, len, norm2, len2, dy, inner);\n }\n }\n if (capType >= CAP_BUTT && capType < CAP_ROUND) {\n float extra = step(CAP_SQUARE, capType) * lineWidth;\n vec2 back = -forward;\n if (a_VertexNum < 0.5 || a_VertexNum > 2.5) {\n pos += back * (u_Expand + extra);\n dy2 = u_Expand;\n } else {\n dy2 = dot(pos + base - pointA, back) - extra;\n }\n }\n if (type >= JOINT_CAP_BUTT && type < JOINT_CAP_SQUARE + 0.5) {\n float extra = step(JOINT_CAP_SQUARE, type) * lineWidth;\n if (a_VertexNum < 0.5 || a_VertexNum > 2.5) {\n dy3 = dot(pos + base - pointB, forward) - extra;\n } else {\n pos += forward * (u_Expand + extra);\n dy3 = u_Expand;\n if (capType >= CAP_BUTT) {\n dy2 -= u_Expand + extra;\n }\n }\n }\n } else if (type >= JOINT_CAP_ROUND && type < JOINT_CAP_ROUND + 1.5) {\n if (inner > 0.5) {\n dy = -dy;\n inner = 0.0;\n }\n vec2 d2 = abs(dy) * forward;\n if (a_VertexNum < 4.5) {\n dy = -dy;\n pos = dy * norm;\n } else if (a_VertexNum < 5.5) {\n pos = dy * norm;\n } else if (a_VertexNum < 6.5) {\n pos = dy * norm + d2;\n v_Arc.x = abs(dy);\n } else {\n dy = -dy;\n pos = dy * norm + d2;\n v_Arc.x = abs(dy);\n }\n dy2 = 0.0;\n v_Arc.y = dy;\n v_Arc.z = 0.0;\n v_Arc.w = lineWidth;\n v_Type = 3.0;\n } else if (abs(D) < 0.01) {\n pos = dy * norm;\n } else {\n if (type >= ROUND && type < ROUND + 1.5) {\n if (inner > 0.5) {\n dy = -dy;\n inner = 0.0;\n }\n if (a_VertexNum < 4.5) {\n pos = doBisect(norm, len, norm2, len2, -dy, 1.0);\n } else if (a_VertexNum < 5.5) {\n pos = dy * norm;\n } else if (a_VertexNum > 7.5) {\n pos = dy * norm2;\n } else {\n pos = doBisect(norm, len, norm2, len2, dy, 0.0);\n float d2 = abs(dy);\n if (length(pos) > abs(dy) * 1.5) {\n if (a_VertexNum < 6.5) {\n pos.x = dy * norm.x - d2 * norm.y;\n pos.y = dy * norm.y + d2 * norm.x;\n } else {\n pos.x = dy * norm2.x + d2 * norm2.y;\n pos.y = dy * norm2.y - d2 * norm2.x;\n }\n }\n }\n vec2 norm3 = normalize(norm + norm2);\n float sign = step(0.0, dy) * 2.0 - 1.0;\n v_Arc.x = sign * dot(pos, norm3);\n v_Arc.y = pos.x * norm3.y - pos.y * norm3.x;\n v_Arc.z = dot(norm, norm3) * lineWidth;\n v_Arc.w = lineWidth;\n dy = -sign * dot(pos, norm);\n dy2 = -sign * dot(pos, norm2);\n dy3 = v_Arc.z - v_Arc.x;\n v_Type = 3.0;\n } else {\n float hit = 0.0;\n if (type >= BEVEL && type < BEVEL + 1.5) {\n if (dot(norm, norm2) > 0.0) {\n type = MITER;\n }\n }\n if (type >= MITER && type < MITER + 3.5) {\n if (inner > 0.5) {\n dy = -dy;\n inner = 0.0;\n }\n float sign = step(0.0, dy) * 2.0 - 1.0;\n pos = doBisect(norm, len, norm2, len2, dy, 0.0);\n if (length(pos) > abs(dy) * u_MiterLimit) {\n type = BEVEL;\n } else {\n if (a_VertexNum < 4.5) {\n dy = -dy;\n pos = doBisect(norm, len, norm2, len2, dy, 1.0);\n } else if (a_VertexNum < 5.5) {\n pos = dy * norm;\n } else if (a_VertexNum > 6.5) {\n pos = dy * norm2;\n }\n v_Type = 1.0;\n dy = -sign * dot(pos, norm);\n dy2 = -sign * dot(pos, norm2);\n hit = 1.0;\n }\n }\n if (type >= BEVEL && type < BEVEL + 1.5) {\n if (inner > 0.5) {\n dy = -dy;\n inner = 0.0;\n }\n float d2 = abs(dy);\n vec2 pos3 = vec2(dy * norm.x - d2 * norm.y, dy * norm.y + d2 * norm.x);\n vec2 pos4 = vec2(dy * norm2.x + d2 * norm2.y, dy * norm2.y - d2 * norm2.x);\n if (a_VertexNum < 4.5) {\n pos = doBisect(norm, len, norm2, len2, -dy, 1.0);\n } else if (a_VertexNum < 5.5) {\n pos = dy * norm;\n } else if (a_VertexNum > 7.5) {\n pos = dy * norm2;\n } else {\n if (a_VertexNum < 6.5) {\n pos = pos3;\n } else {\n pos = pos4;\n }\n }\n vec2 norm3 = normalize(norm + norm2);\n float sign = step(0.0, dy) * 2.0 - 1.0;\n dy = -sign * dot(pos, norm);\n dy2 = -sign * dot(pos, norm2);\n dy3 = (-sign * dot(pos, norm3)) + lineWidth;\n v_Type = 4.0;\n hit = 1.0;\n }\n if (hit < 0.5) {\n gl_Position = vec4(0.0, 0.0, 0.0, 1.0);\n return;\n }\n }\n }\n pos += base;\n v_Distance = vec4(dy, dy2, dy3, lineWidth) * u_DevicePixelRatio;\n v_Arc = v_Arc * u_DevicePixelRatio;\n v_Travel = a_Travel + dot(pos - pointA, vec2(-norm.y, norm.x));\n }\n\n gl_Position = u_ProjectionMatrix * u_ViewMatrix * vec4(pos, u_ZIndex, 1.0);\n}",this.material.fragmentShader="#define GLSLIFY 1\nlayout(std140) uniform ub_SceneParams {\n mat4 u_ProjectionMatrix;\n mat4 u_ViewMatrix;\n vec3 u_CameraPosition;\n float u_DevicePixelRatio;\n vec2 u_Viewport;\n float u_IsOrtho;\n float u_IsPicking;\n};\nlayout(std140) uniform ub_ObjectParams {\n mat4 u_ModelMatrix;\n vec4 u_FillColor;\n vec4 u_StrokeColor;\n float u_StrokeWidth;\n float u_Opacity;\n float u_FillOpacity;\n float u_StrokeOpacity;\n float u_Expand;\n float u_MiterLimit;\n float u_ScaleMode;\n float u_Alignment;\n vec3 u_PickingColor;\n float u_Dash;\n float u_Gap;\n float u_DashOffset;\n float u_Visible;\n float u_ZIndex;\n float u_IncreasedLineWidthForHitTesting;\n};\n\nin vec4 v_Distance;\nin vec4 v_Arc;\nin float v_Type;\nin float v_Travel;\n\nout vec4 outputColor;\n\n#define COLOR_SCALE 1. / 255.\n\nvoid main(){\n if (u_Visible < 0.5) {\n discard;\n }\n\n float alpha = 1.0;\n float lineWidth = v_Distance.w;\n if (v_Type < 0.5) {\n float left = max(v_Distance.x - 0.5, -v_Distance.w);\n float right = min(v_Distance.x + 0.5, v_Distance.w);\n float near = v_Distance.y - 0.5;\n float far = min(v_Distance.y + 0.5, 0.0);\n float top = v_Distance.z - 0.5;\n float bottom = min(v_Distance.z + 0.5, 0.0);\n alpha = max(right - left, 0.0) * max(bottom - top, 0.0) * max(far - near, 0.0);\n } else if (v_Type < 1.5) {\n float a1 = clamp(v_Distance.x + 0.5 - lineWidth, 0.0, 1.0);\n float a2 = clamp(v_Distance.x + 0.5 + lineWidth, 0.0, 1.0);\n float b1 = clamp(v_Distance.y + 0.5 - lineWidth, 0.0, 1.0);\n float b2 = clamp(v_Distance.y + 0.5 + lineWidth, 0.0, 1.0);\n alpha = a2 * b2 - a1 * b1;\n } else if (v_Type < 2.5) {\n alpha *= max(min(v_Distance.x + 0.5, 1.0), 0.0);\n alpha *= max(min(v_Distance.y + 0.5, 1.0), 0.0);\n alpha *= max(min(v_Distance.z + 0.5, 1.0), 0.0);\n } else if (v_Type < 3.5) {\n float a1 = clamp(v_Distance.x + 0.5 - lineWidth, 0.0, 1.0);\n float a2 = clamp(v_Distance.x + 0.5 + lineWidth, 0.0, 1.0);\n float b1 = clamp(v_Distance.y + 0.5 - lineWidth, 0.0, 1.0);\n float b2 = clamp(v_Distance.y + 0.5 + lineWidth, 0.0, 1.0);\n float alpha_miter = a2 * b2 - a1 * b1;\n float alpha_plane = max(min(v_Distance.z + 0.5, 1.0), 0.0);\n float d = length(v_Arc.xy);\n float circle_hor = max(min(v_Arc.w, d + 0.5) - max(-v_Arc.w, d - 0.5), 0.0);\n float circle_vert = min(v_Arc.w * 2.0, 1.0);\n float alpha_circle = circle_hor * circle_vert;\n alpha = min(alpha_miter, max(alpha_circle, alpha_plane));\n } else {\n float a1 = clamp(v_Distance.x + 0.5 - lineWidth, 0.0, 1.0);\n float a2 = clamp(v_Distance.x + 0.5 + lineWidth, 0.0, 1.0);\n float b1 = clamp(v_Distance.y + 0.5 - lineWidth, 0.0, 1.0);\n float b2 = clamp(v_Distance.y + 0.5 + lineWidth, 0.0, 1.0);\n alpha = a2 * b2 - a1 * b1;\n alpha *= max(min(v_Distance.z + 0.5, 1.0), 0.0);\n }\n\n if (u_Dash + u_Gap > 1.0) {\n float scalingFactor = sqrt(u_ModelMatrix[0][0] * u_ModelMatrix[0][0] + u_ModelMatrix[0][1] * u_ModelMatrix[0][1] + u_ModelMatrix[0][2] * u_ModelMatrix[0][2]);\n float travel = mod(v_Travel + u_Gap * scalingFactor * 0.5 + u_DashOffset, u_Dash * scalingFactor + u_Gap * scalingFactor) - (u_Gap * scalingFactor * 0.5);\n float left = max(travel - 0.5, -0.5);\n float right = min(travel + 0.5, u_Gap * scalingFactor + 0.5);\n alpha *= max(0.0, right - left);\n }\n\n if (u_IsPicking > 0.5) {\n vec3 pickingColor = COLOR_SCALE * u_PickingColor;\n if (pickingColor.x == 0.0 && pickingColor.y == 0.0 && pickingColor.z == 0.0) {\n discard;\n }\n outputColor = vec4(pickingColor, 1.0);\n } else {\n outputColor = u_StrokeColor;\n outputColor.a *= alpha * u_Opacity * u_StrokeOpacity;\n }\n}",this.material.defines=sf({},this.material.defines,$g(G0));var t=t[0],e=t.parsedStyle,n=e.fill,r=e.stroke,i=e.opacity,o=e.fillOpacity,a=e.strokeOpacity,s=e.lineWidth,l=e.increasedLineWidthForHitTesting,u=e.anchor,c=e.lineDash,h=e.lineDashOffset,e=e.visibility,d=[0,0,0,0],n=(To(n)&&(d=[Number(n.r)/255,Number(n.g)/255,Number(n.b)/255,Number(n.alpha)]),[0,0,0,0]),r=(To(r)&&(n=[Number(r.r)/255,Number(r.g)/255,Number(r.b)/255,Number(r.alpha)]),t.isInteractive()&&(null==(r=t.renderable3D)?void 0:r.encodedPickingColor)||[0,0,0]),f=0,p=0,g=t.getGeometryBounds(),g=(g&&(f=-(g=g.halfExtents)[0]*u[0]*2,p=-g[1]*u[1]*2),K());wt(g,t.getWorldTransform(),ht(g,x(f,p,0))),this.material.setUniforms(((u={})[m.MODEL_MATRIX]=g,u[m.FILL_COLOR]=d,u[m.STROKE_COLOR]=n,u[m.STROKE_WIDTH]=s,u[m.INCREASED_LINE_WIDTH_FOR_HIT_TESTING]=l||0,u[m.OPACITY]=i,u[m.FILL_OPACITY]=o,u[m.STROKE_OPACITY]=a,u[m.EXPAND]=1,u[m.MITER_LIMIT]=5,u[m.SCALE_MODE]=1,u[m.ALIGNMENT]=.5,u[m.PICKING_COLOR]=r,u[m.DASH]=c&&c[0]||0,u[m.GAP]=c&&c[1]||0,u[m.DASH_OFFSET]=h||0,u[m.VISIBLE]="visible"===e?1:0,u[m.Z_INDEX]=t.sortable.renderOrder*zg,u)),this.material.cullMode=vf.None},e.createGeometry=function(t){var t=z0(t[0]),e=t.pointsBuffer,n=t.travelBuffer,t=t.instancedCount;this.geometry.setVertexBuffer({bufferIndex:U0.PACKED,byteStride:48,frequency:Af.PerInstance,attributes:[{format:S.F32_RG,bufferByteOffset:0,byteStride:12,location:G0.PREV,divisor:1},{format:S.F32_RG,bufferByteOffset:12,byteStride:12,location:G0.POINT1,divisor:1},{format:S.F32_R,bufferByteOffset:20,byteStride:12,location:G0.VERTEX_JOINT,divisor:1},{format:S.F32_RG,bufferByteOffset:24,byteStride:12,location:G0.POINT2,divisor:1},{format:S.F32_RG,bufferByteOffset:36,byteStride:12,location:G0.NEXT,divisor:1}],data:new Float32Array(e)}),this.geometry.setVertexBuffer({bufferIndex:U0.VERTEX_NUM,byteStride:4,frequency:Af.PerInstance,attributes:[{format:S.F32_R,bufferByteOffset:0,byteStride:4,location:G0.VERTEX_NUM,divisor:0}],data:new Float32Array([0,1,2,3,4,5,6,7,8])}),this.geometry.setVertexBuffer({bufferIndex:U0.TRAVEL,byteStride:4,frequency:Af.PerInstance,attributes:[{format:S.F32_R,bufferByteOffset:0,byteStride:4,location:G0.TRAVEL,divisor:1}],data:new Float32Array(n)}),this.geometry.vertexCount=15,this.geometry.instancedCount=t,this.geometry.setIndexBuffer(new Uint32Array([0,2,1,0,3,2,4,6,5,4,7,6,4,7,8]))},t}(Ia));function z0(y,t){void 0===t&&(t=!1);var e=y.parsedStyle,n=e.lineCap,e=e.lineJoin,r=y.parsedStyle,E=r.defX,_=r.defY,r=y.parsedStyle,i=r.markerStart,o=r.markerEnd,a=r.markerStartOffset,r=r.markerEndOffset,b=[],s=[];if(y.nodeName===lt.POLYLINE||y.nodeName===lt.POLYGON){var l=y.parsedStyle.points.points,u=l.length,c=0,h=0,d=0,f=0,p=0;if(i&&ut(i)&&a&&(N=l[1][0]-l[0][0],x=l[1][1]-l[0][1],p=Math.atan2(x,N),c=Math.cos(p)*(a||0),h=Math.sin(p)*(a||0)),o&&ut(o)&&r&&(N=l[u-2][0]-l[u-1][0],x=l[u-2][1]-l[u-1][1],p=Math.atan2(x,N),d=Math.cos(p)*(r||0),f=Math.sin(p)*(r||0)),b[0]=l.reduce(function(t,e,n){var r=0,i=0;return 0===n?(r=c,i=h):n===u-1&&(r=d,i=f),t.push(e[0]-E+r,e[1]-_+i),t},[]),y.nodeName===lt.POLYGON){if(t)return s=Dd(b[0],[],2),{pointsBuffer:b[0],travelBuffer:[],triangles:s,instancedCount:Math.round(b[0].length/W0)};b[0].push(b[0][0],b[0][1]),(x=b[0]).push.apply(x,H0(b[0][0],b[0][1],b[0][2],b[0][3]))}}else if(y.nodeName===lt.PATH||y.nodeName===lt.CIRCLE||y.nodeName===lt.ELLIPSE||y.nodeName===lt.RECT){y.nodeName!==lt.PATH?(E=(g=Xo($i(y,J(K())),y)).rect.x,_=g.rect.y,y.nodeName===lt.RECT&&(p=(N=y.parsedStyle).width,l=N.height,p<0&&(E+=g.rect.width),l<0)&&(_+=g.rect.height)):g=y.parsedStyle.path;var g,m,v,x=g,S=x.absolutePath,w=x.segments,T=0,A=0,M=0,R=0,N=0,C=(i&&ut(i)&&a&&(l=(p=i.parentNode.getStartTangent())[0],g=p[1],m=l[0]-g[0],v=l[1]-g[1],N=Math.atan2(v,m),T=Math.cos(N)*(a||0),A=Math.sin(N)*(a||0)),o&&ut(o)&&r&&(i=(x=o.parentNode.getEndTangent())[0],p=x[1],m=i[0]-p[0],v=i[1]-p[1],N=Math.atan2(v,m),M=Math.cos(N)*(r||0),R=Math.sin(N)*(r||0)),-1),P=-1;if(S.forEach(function(t,e){var n=t[0],t=t.slice(1),r=S[e+1],i=0===e&&(0!==T||0!==A),r=(e===S.length-1||r&&("M"===r[0]||"Z"===r[0]))&&0!==M&&0!==R;if("M"===n)b[++P]=[],C=b[P].length,i?b[P].push(t[0]-E+T,t[1]-_+A,t[0]-E,t[1]-_):b[P].push(t[0]-E,t[1]-_);else if("L"===n)r?b[P].push(t[0]-E+M,t[1]-_+R):b[P].push(t[0]-E,t[1]-_);else if("Q"===n){for(var o=t[0]-E,a=t[1]-_,s=t[2]-E,l=t[3]-_,u=b[P],c=u[u.length-2],h=u[u.length-1],i=S0.length(c,h,o,a,s,l),d=Ue(i/C0,P0,O0),f=1;f<=d;++f){var p,g=f/d;u.push((p=c+(o-c)*g)+(o+(s-o)*g-p)*g,(p=h+(a-h)*g)+(a+(l-a)*g-p)*g)}r&&b[P].push(t[2]-E+M,t[3]-_+R)}else if("A"===n){for(var i=w[e].prePoint,m=me(i[0],i[1],t[0],t[1],t[2],t[3],t[4],t[5],t[6],void 0),v=0;v<m.length;v+=6)I0(m[v]-E,m[v+1]-_,m[v+2]-E,m[v+3]-_,m[v+4]-E,m[v+5]-_,b[P]);r&&b[P].push(t[5]-E+M,t[6]-_+R)}else"C"===n?(I0(t[0]-E,t[1]-_,t[2]-E,t[3]-_,t[4]-E,t[5]-_,b[P]),r&&b[P].push(t[4]-E+M,t[5]-_+R)):"Z"!==n||y.nodeName!==lt.PATH&&y.nodeName!==lt.RECT||((1e-4<Math.abs(b[P][b[P].length-2]-b[P][C])||1e-4<Math.abs(b[P][b[P].length-1]-b[P][C+1]))&&b[P].push(b[P][C],b[P][C+1]),(e=b[P]).push.apply(e,H0(b[P][C],b[P][C+1],b[P][C+2],b[P][C+3])))}),t)return{pointsBuffer:l=b.reduce(function(t,e){return t.push.apply(t,e),t},[]),travelBuffer:[],triangles:s=Dd(l,[],2),instancedCount:Math.round(l.length/W0)}}var O=function(t){var e;switch(t){case"bevel":e=L0.JOINT_BEVEL;break;case"round":e=L0.JOINT_ROUND;break;default:e=L0.JOINT_MITER}return e}(e),I=function(t){var e;switch(t){case"square":e=L0.CAP_SQUARE;break;case"round":e=L0.CAP_ROUND;break;default:e=L0.CAP_BUTT}return e}(n),L=I;return I===L0.CAP_ROUND&&(L=L0.JOINT_CAP_ROUND),I===L0.CAP_BUTT&&(L=L0.JOINT_CAP_BUTT),I===L0.CAP_SQUARE&&(L=L0.JOINT_CAP_SQUARE),b.map(function(t){for(var e=(Math.round(0/W0)+2)*V0,n=0,r=[],i=[],o=0;o<t.length;o+=W0)1<o&&(n+=Math.sqrt(Math.pow(t[o]-t[o-2],2)+Math.pow(t[o+1]-t[o+1-2],2))),i.push(n),r[e++]=t[o],r[e++]=t[o+1],r[e]=O,0==o&&I!==L0.CAP_ROUND&&(r[e]+=I),o+2*W0>=t.length?r[e]+=L-O:o+W0>=t.length&&(r[e]=0),e++;r[e++]=t[t.length-4],r[e++]=t[t.length-3],r[e++]=0,r[0]=t[0],r[1]=t[1],r[2]=0,r[3]=t[2],r[4]=t[3],r[5]=I===L0.CAP_ROUND?I:0;var a=Math.round(t.length/W0);return{pointsBuffer:r,travelBuffer:i,triangles:s,instancedCount:a}}).reduce(function(t,e){var n;return(n=t.pointsBuffer).push.apply(n,e.pointsBuffer),(n=t.travelBuffer).push.apply(n,e.travelBuffer),t.instancedCount+=e.instancedCount,t},{pointsBuffer:[],travelBuffer:[],triangles:s,instancedCount:0})}function H0(t,e,n,r){n=[(n=void 0===n?t:n)-t,(r=void 0===r?e:r)-e];return[t+.01*n[0],e+.01*n[1]]}var X0=function(n){function t(){return n.apply(this,arguments)||this}lf(t,n);var e=t.prototype;return e.shouldMerge=function(t,e){return!1},e.createGeometry=function(t){var t=t[0],e=z0(t,!0),n=e.triangles,e=e.pointsBuffer;this.geometry.setVertexBuffer({bufferIndex:Qg.POSITION,byteStride:8,frequency:Af.PerVertex,attributes:[{format:S.F32_RG,bufferByteOffset:0,location:Jg.POSITION}],data:new Float32Array(e)});var r=t.getGeometryBounds().halfExtents,t=e.map(function(t,e){return t/r[e%2]/2});this.geometry.setVertexBuffer({bufferIndex:Qg.UV,byteStride:8,frequency:Af.PerVertex,attributes:[{format:S.F32_RG,bufferByteOffset:0,location:Jg.UV}],data:new Float32Array(t)}),this.geometry.vertexCount=n.length,this.geometry.setIndexBuffer(new Uint32Array(n))},e.createMaterial=function(t){this.material.vertexShader="#define GLSLIFY 1\nlayout(std140) uniform ub_SceneParams {\n mat4 u_ProjectionMatrix;\n mat4 u_ViewMatrix;\n vec3 u_CameraPosition;\n float u_DevicePixelRatio;\n vec2 u_Viewport;\n float u_IsOrtho;\n float u_IsPicking;\n};\nlayout(std140) uniform ub_ObjectParams {\n mat4 u_ModelMatrix;\n vec4 u_FillColor;\n vec3 u_PickingColor;\n float u_Opacity;\n float u_FillOpacity;\n float u_Visible;\n float u_ZIndex;\n};\n\nlayout(location = POSITION) in vec2 a_Position;\n#ifdef USE_UV\n layout(location = UV) in vec2 a_Uv;\n out vec2 v_Uv;\n#endif\n\nvoid main() {\n #ifdef USE_UV\n v_Uv = a_Uv;\n #ifdef VIEWPORT_ORIGIN_TL\n v_Uv.y = 1.0 - v_Uv.y;\n #endif\n#endif\n\n gl_Position = u_ProjectionMatrix * u_ViewMatrix * u_ModelMatrix * vec4(a_Position, u_ZIndex, 1.0);\n}",this.material.fragmentShader="#define GLSLIFY 1\nlayout(std140) uniform ub_SceneParams {\n mat4 u_ProjectionMatrix;\n mat4 u_ViewMatrix;\n vec3 u_CameraPosition;\n float u_DevicePixelRatio;\n vec2 u_Viewport;\n float u_IsOrtho;\n float u_IsPicking;\n};\nlayout(std140) uniform ub_ObjectParams {\n mat4 u_ModelMatrix;\n vec4 u_FillColor;\n vec3 u_PickingColor;\n float u_Opacity;\n float u_FillOpacity;\n float u_Visible;\n float u_ZIndex;\n};\n#ifdef USE_UV\n in vec2 v_Uv;\n#endif\n#ifdef USE_MAP\n uniform sampler2D u_Map;\n#endif\n\nout vec4 outputColor;\n\n#define COLOR_SCALE 1. / 255.\n\nvoid main(){\n if (u_Visible < 0.5) {\n discard;\n }\n\n if (u_IsPicking > 0.5) {\n vec3 pickingColor = COLOR_SCALE * u_PickingColor;\n if (pickingColor.x == 0.0 && pickingColor.y == 0.0 && pickingColor.z == 0.0) {\n discard;\n }\n outputColor = vec4(pickingColor, 1.0);\n } else {\n\n vec4 u_Color = u_FillColor;\n\n #ifdef USE_MAP\n #ifdef USE_PATTERN\n vec4 texelColor = texture(SAMPLER_2D(u_Map), v_Uv);\n u_Color = texelColor;\n #else\n vec4 texelColor = texture(SAMPLER_2D(u_Map), v_Uv);\n u_Color = texelColor;\n #endif\n#endif\n\n outputColor = u_Color;\n outputColor.a = outputColor.a * u_Opacity * u_FillOpacity;\n }\n}";var t=t[0],e=t.parsedStyle,n=e.fill,r=e.opacity,i=e.fillOpacity,o=e.anchor,e=e.visibility,a=[0,0,0,0],n=(To(n)&&(a=[Number(n.r)/255,Number(n.g)/255,Number(n.b)/255,Number(n.alpha)]),t.isInteractive()&&(null==(n=t.renderable3D)?void 0:n.encodedPickingColor)||[0,0,0]),s=0,l=0,u=t.getGeometryBounds(),u=(u&&(s=-(u=u.halfExtents)[0]*o[0]*2,l=-u[1]*o[1]*2),K());wt(u,t.getWorldTransform(),ht(u,x(s,l,0))),this.material.setUniforms(((o={})[m.MODEL_MATRIX]=u,o[m.FILL_COLOR]=a,o[m.PICKING_COLOR]=n,o[m.OPACITY]=r,o[m.FILL_OPACITY]=i,o[m.VISIBLE]="visible"===e?1:0,o[m.Z_INDEX]=t.sortable.renderOrder*zg,o))},e.updateAttribute=function(t,e,s,l){var u=this;n.prototype.updateAttribute.call(this,t,e,s,l),t.forEach(function(t){var e,n=t.parsedStyle,r=n.fill,i=n.opacity,o=n.fillOpacity,a=n.anchor,n=n.visibility;"lineJoin"===s||"lineCap"===s||"markerStart"===s||"markerEnd"===s||"markerStartOffset"===s||"markerEndOffset"===s||t.nodeName===lt.RECT&&("width"===s||"height"===s||"radius"===s)||t.nodeName===lt.LINE&&("x1"===s||"y1"===s||"x2"===s||"y2"===s)||t.nodeName===lt.POLYLINE&&"points"===s||t.nodeName===lt.POLYGON&&"points"===s||t.nodeName===lt.PATH&&"path"===s?(u.material.geometryDirty=!0,u.material.programDirty=!0):"fill"===s?To(r)?(r=[Number(r.r)/255,Number(r.g)/255,Number(r.b)/255,Number(r.alpha)],u.material.setUniforms(((e={})[m.FILL_COLOR]=r,e))):(r=u.textureMappings.findIndex(function(t){return t.name===o0}),e=u.createFillGradientTextureMapping([u.instance]),0<=r&&u.textureMappings.splice(r,1,e),u.material.textureDirty=!0):"opacity"===s?u.material.setUniforms(((r={})[m.OPACITY]=i,r)):"fillOpacity"===s?u.material.setUniforms(((e={})[m.FILL_OPACITY]=o,e)):"anchor"===s||"modelMatrix"===s?(r=i=0,(o=t.getGeometryBounds())&&(i=-(e=o.halfExtents)[0]*a[0]*2,r=-e[1]*a[1]*2),o=K(),wt(o,t.getWorldTransform(),ht(o,x(i,r,0))),u.material.setUniforms(((e={})[m.MODEL_MATRIX]=o,e))):"visibility"===s?u.material.setUniforms(((a={})[m.VISIBLE]="visible"===n?1:0,a)):"pointerEvents"===s&&(r=l&&t.isInteractive()&&(null==(i=t.renderable3D)?void 0:i.encodedPickingColor)||[0,0,0],u.material.setUniforms(((o={})[m.PICKING_COLOR]=r,o)))})},e.changeRenderOrder=function(t,e){var n;this.material&&this.material.setUniforms(((n={})[m.Z_INDEX]=e*zg,n))},t}(Ia),Y0=function(l){function t(){return l.apply(this,arguments)||this}lf(t,l);var e=t.prototype;return e.shouldMerge=function(t,e){return!!l.prototype.shouldMerge.call(this,t,e)&&this.instance.parsedStyle.img===t.parsedStyle.img},e.createMaterial=function(t){t=t[0].parsedStyle.img,this.material.defines=sf({},this.material.defines),this.material.vertexShader="#define GLSLIFY 1\nlayout(std140) uniform ub_SceneParams {\n mat4 u_ProjectionMatrix;\n mat4 u_ViewMatrix;\n vec3 u_CameraPosition;\n float u_DevicePixelRatio;\n vec2 u_Viewport;\n float u_IsOrtho;\n float u_IsPicking;\n};\nlayout(location = MODEL_MATRIX0) in vec4 a_ModelMatrix0;\nlayout(location = MODEL_MATRIX1) in vec4 a_ModelMatrix1;\nlayout(location = MODEL_MATRIX2) in vec4 a_ModelMatrix2;\nlayout(location = MODEL_MATRIX3) in vec4 a_ModelMatrix3;\nlayout(location = COLOR) in vec4 a_Color;\nlayout(location = STROKE_COLOR) in vec4 a_StrokeColor;\nlayout(location = PACKED_STYLE1) in vec4 a_StylePacked1;\nlayout(location = PACKED_STYLE2) in vec4 a_StylePacked2;\nlayout(location = PICKING_COLOR) in vec4 a_PickingColor;\n\nout vec4 v_PickingResult;\nout vec4 v_Color;\nout vec4 v_StrokeColor;\nout vec4 v_StylePacked1;\nout vec4 v_StylePacked2;\n\n#define COLOR_SCALE 1. / 255.\nvoid setPickingColor(vec3 pickingColor) {\n v_PickingResult.rgb = pickingColor * COLOR_SCALE;\n}\nvec4 project(vec4 pos, mat4 pm, mat4 vm, mat4 mm) {\n return pm * vm * mm * pos;\n}\n\nlayout(location = POSITION) in vec4 a_Size;\n\n#ifdef USE_UV\n layout(location = UV) in vec2 a_Uv;\n out vec2 v_Uv;\n#endif\n\nbool isPerspectiveMatrix(mat4 m) {\n\treturn m[ 2 ][ 3 ] == - 1.0;\n}\n\nvoid main() {\n mat4 u_ModelMatrix = mat4(a_ModelMatrix0, a_ModelMatrix1, a_ModelMatrix2, a_ModelMatrix3);\nvec4 u_StrokeColor = a_StrokeColor;\nfloat u_Opacity = a_StylePacked1.x;\nfloat u_FillOpacity = a_StylePacked1.y;\nfloat u_StrokeOpacity = a_StylePacked1.z;\nfloat u_StrokeWidth = a_StylePacked1.w;\nfloat u_ZIndex = a_PickingColor.w;\nvec2 u_Anchor = a_StylePacked2.yz;\nfloat u_IncreasedLineWidthForHitTesting = a_StylePacked2.w;\n\nsetPickingColor(a_PickingColor.xyz);\n\nv_Color = a_Color;\nv_StrokeColor = a_StrokeColor;\nv_StylePacked1 = a_StylePacked1;\nv_StylePacked2 = a_StylePacked2;\n\n#ifdef CLIPSPACE_NEAR_ZERO\n gl_Position.z = gl_Position.z * 0.5 + 0.5;\n#endif\n\n vec2 offset = (a_Uv - u_Anchor.xy) * a_Size.xy;\n\n bool isPerspective = isPerspectiveMatrix(u_ProjectionMatrix);\n\n bool isBillboard = a_Size.w > 0.5;\n if (isBillboard) {\n vec4 mvPosition = u_ViewMatrix * u_ModelMatrix * vec4( 0.0, 0.0, u_ZIndex, 1.0 );\nvec2 scale;\nscale.x = length( vec3( u_ModelMatrix[ 0 ].x, u_ModelMatrix[ 0 ].y, u_ModelMatrix[ 0 ].z ) );\nscale.y = length( vec3( u_ModelMatrix[ 1 ].x, u_ModelMatrix[ 1 ].y, u_ModelMatrix[ 1 ].z ) );\n\n// if (sizeAttenuation < 0.5) {\n// bool isPerspective = isPerspectiveMatrix( u_ProjectionMatrix );\n// if ( isPerspective ) scale *= - mvPosition.z;\n// }\n\nvec2 alignedPosition = offset * scale;\n\nfloat rotation = 0.0;\nvec2 rotatedPosition;\nrotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y;\nrotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y;\n\nmvPosition.xy += rotatedPosition;\n\ngl_Position = u_ProjectionMatrix * mvPosition;\n } else {\n gl_Position = project(vec4(offset, u_ZIndex, 1.0), u_ProjectionMatrix, u_ViewMatrix, u_ModelMatrix);\n }\n\n #ifdef USE_UV\n v_Uv = a_Uv;\n #ifdef VIEWPORT_ORIGIN_TL\n v_Uv.y = 1.0 - v_Uv.y;\n #endif\n#endif\n\n}",this.material.fragmentShader="#define GLSLIFY 1\nlayout(std140) uniform ub_SceneParams {\n mat4 u_ProjectionMatrix;\n mat4 u_ViewMatrix;\n vec3 u_CameraPosition;\n float u_DevicePixelRatio;\n vec2 u_Viewport;\n float u_IsOrtho;\n float u_IsPicking;\n};\n\nin vec4 v_PickingResult;\nin vec4 v_Color;\nin vec4 v_StrokeColor;\nin vec4 v_StylePacked1;\nin vec4 v_StylePacked2;\n#ifdef USE_UV\n in vec2 v_Uv;\n#endif\n#ifdef USE_MAP\n uniform sampler2D u_Map;\n#endif\n\nout vec4 outputColor;\n\nvoid main() {\n vec4 u_Color = v_Color;\nvec4 u_StrokeColor = v_StrokeColor;\nfloat u_Opacity = v_StylePacked1.x;\nfloat u_FillOpacity = v_StylePacked1.y;\nfloat u_StrokeOpacity = v_StylePacked1.z;\nfloat u_StrokeWidth = v_StylePacked1.w;\nfloat u_Visible = v_StylePacked2.x;\nvec3 u_PickingColor = v_PickingResult.xyz;\n\nif (u_Visible < 0.5) {\n discard;\n}\n #ifdef USE_MAP\n #ifdef USE_PATTERN\n vec4 texelColor = texture(SAMPLER_2D(u_Map), v_Uv);\n u_Color = texelColor;\n #else\n vec4 texelColor = texture(SAMPLER_2D(u_Map), v_Uv);\n u_Color = texelColor;\n #endif\n#endif\n\n if (u_IsPicking > 0.5) {\n if (u_PickingColor.x == 0.0 && u_PickingColor.y == 0.0 && u_PickingColor.z == 0.0) {\n discard;\n }\n outputColor = vec4(u_PickingColor, 1.0);\n } else {\n outputColor = u_Color;\n outputColor.a = outputColor.a * u_Opacity;\n }\n}",t=this.texturePool.getOrCreateTexture(this.context.device,t);this.material.setUniforms({u_Map:t})},e.createGeometry=function(t){l.prototype.createGeometry.call(this,t);var o=[],a=[],s=[];t.forEach(function(t,e){var e=4*e,t=t.parsedStyle,n=t.width,r=t.height,i=t.z,t=t.isBillboard;o.push(n,r,i,t?1:0),a.push(0,0,1,0,1,1,0,1),s.push(0+e,2+e,1+e,0+e,3+e,2+e)}),this.geometry.setIndexBuffer(new Uint32Array(s)),this.geometry.vertexCount=6,this.geometry.setVertexBuffer({bufferIndex:Qg.POSITION,byteStride:16,frequency:Af.PerInstance,attributes:[{format:S.F32_RGBA,bufferByteOffset:0,location:Jg.POSITION}],data:new Float32Array(o)}),this.geometry.setVertexBuffer({bufferIndex:Qg.UV,byteStride:8,frequency:Af.PerVertex,attributes:[{format:S.F32_RG,bufferByteOffset:0,location:Jg.UV}],data:new Float32Array(a)})},e.updateAttribute=function(t,e,n,r){var i;l.prototype.updateAttribute.call(this,t,e,n,r),this.updateBatchedAttribute(t,e,n,r),"width"===n||"height"===n||"z"===n||"isBillboard"===n?(i=[],t.forEach(function(t){var t=t.parsedStyle,e=t.width,n=t.height,r=t.z,t=t.isBillboard;i.push(e,n,r,t?1:0)}),this.geometry.updateVertexBuffer(Qg.POSITION,Jg.POSITION,e,new Uint8Array(new Float32Array(i).buffer))):"img"===n&&(t=this.texturePool.getOrCreateTexture(this.context.device,r),this.material.setUniforms({u_Map:t}))},t}(Ia);function K0(t,e,n,r){var i=e.width,e=e.height;if(r){if(r.length!==i*e*n)throw new RangeError("mismatched image size")}else r=new Uint8Array(i*e*n);return t.width=i,t.height=e,t.data=r,t}function q0(t,e,n,r,i,o){if(0!==i.width&&0!==i.height){if(i.width>t.width||i.height>t.height||n.x>t.width-i.width||n.y>t.height-i.height)throw new RangeError("out of range source coordinates for image copy");if(i.width>e.width||i.height>e.height||r.x>e.width-i.width||r.y>e.height-i.height)throw new RangeError("out of range destination coordinates for image copy");for(var a=t.data,s=e.data,l=0;l<i.height;l++)for(var u=((n.y+l)*t.width+n.x)*o,c=((r.y+l)*e.width+r.x)*o,h=0;h<i.width*o;h++)s[c+h]=a[u+h]}}var $0=function(){function t(t,e){this.width=void 0,this.height=void 0,this.data=void 0,K0(this,t,1,e)}var e=t.prototype;return e.resize=function(t){var e,n,r,i;e=this,n=1,i=(t=t).width,t=t.height,i===e.width&&t===e.height||(q0(e,r=K0({},{width:i,height:t},n),{x:0,y:0},{x:0,y:0},{width:Math.min(e.width,i),height:Math.min(e.height,t)},n),e.width=i,e.height=t,e.data=r.data)},e.clone=function(){return new t({width:this.width,height:this.height},new Uint8Array(this.data))},t.copy=function(t,e,n,r,i){q0(t,e,n,r,i,1)},t}();function Z0(t){this.image=void 0,this.positions=void 0;var e,n={},r=[];for(e in t){var i,o=t[e],a=n[e]={};for(i in o){var s,l=o[+i];l&&0!==l.bitmap.width&&0!==l.bitmap.height&&(s={x:0,y:0,w:l.bitmap.width+2*Q0,h:l.bitmap.height+2*Q0},r.push(s),a[i]={rect:s,metrics:l.metrics})}}var u,c=(h=function(t){for(var e=0,n=0,r=ff(t);!(i=r()).done;){var i=i.value;e+=i.w*i.h,n=Math.max(n,i.w)}t.sort(function(t,e){return e.h-t.h});for(var o,a=[{x:0,y:0,w:Math.max(Math.ceil(Math.sqrt(e/.95)),n),h:1/0}],s=0,l=0,u=ff(t);!(o=u()).done;)for(var c=o.value,h=a.length-1;0<=h;h--){var d,f=a[h];if(!(c.w>f.w||c.h>f.h)){c.x=f.x,c.y=f.y,l=Math.max(l,c.y+c.h),s=Math.max(s,c.x+c.w),c.w===f.w&&c.h===f.h?(d=a.pop(),h<a.length&&(a[h]=d)):c.h===f.h?(f.x+=c.w,f.w-=c.w):(c.w!==f.w&&a.push({x:f.x+c.w,y:f.y,w:f.w-c.w,h:c.h}),f.y+=c.h,f.h-=c.h);break}}return{w:s,h:l,fill:e/(s*l)||0}}(r)).w,h=h.h,d=new $0({width:c||1,height:h||1});for(u in t){var f,p=t[u];for(f in p){var g,m=p[+f];m&&0!==m.bitmap.width&&0!==m.bitmap.height&&(g=n[u][f].rect,$0.copy(m.bitmap,d,{x:0,y:0},{x:g.x+Q0,y:g.y+Q0},m.bitmap))}}this.image=d,this.positions=n}var Q0=1,J0=3,tm=J0;var em,nm,rm,im=function(){function t(){this.sdfGeneratorCache={},this.textMetricsCache={},this.glyphAtlas=void 0,this.glyphMap={},this.glyphAtlasTexture=void 0}var e=t.prototype;return e.getMap=function(){return this.glyphMap},e.getAtlas=function(){return this.glyphAtlas},e.getAtlasTexture=function(){return this.glyphAtlasTexture},e.layout=function(t,i,o,e,a,n,r){var s=this,l=[],u=n,c=r,h="right"===e||"end"===e?1:"left"===e||"start"===e?0:.5;return t.forEach(function(t){for(var e=l.length,n=(Array.from(t).forEach(function(t){var e=s.glyphMap[i],t=t.charCodeAt(0),e=e&&e[t];e&&(l.push({glyph:t,x:u,y:c,scale:1,fontStack:i}),u+=e.metrics.advance+a)}),u-a),r=e;r<l.length;r++)l[r].x=l[r].x-h*n;u=0,c+=o}),l},e.generateAtlas=function(e,n,r,i,o,t,a){var s,l,u=this,c=(void 0===n&&(n=""),void 0===o&&(o=""),[]),h=(this.glyphMap[n]||(c=function(){for(var t=[],e=32;e<128;e++)t.push(String.fromCharCode(e));return t}()),Object.keys(this.glyphMap[n]||{}));Array.from(new Set(t.split(""))).forEach(function(t){-1===h.indexOf(t.charCodeAt(0).toString())&&c.push(t)}),c.length&&(t=c.map(function(t){return u.generateSDF(e,n,r,i,o,t)}).reduce(function(t,e){return t[e.id]=e,t},{}),this.glyphMap[n]=sf({},this.glyphMap[n],t),this.glyphAtlas=new Z0(this.glyphMap),s=(t=this.glyphAtlas.image).width,l=t.height,t=t.data,this.glyphAtlasTexture&&this.glyphAtlasTexture.destroy(),this.glyphAtlasTexture=a.createTexture(sf({},Wf(S.ALPHA,s,l,1),{pixelStore:{unpackFlipY:!1,unpackAlignment:1},immutable:!1})),this.glyphAtlasTexture.setImageData([t],0))},e.generateSDF=function(t,e,n,r,i,o){void 0===e&&(e="");var a=o.charCodeAt(0),s=(s=this.sdfGeneratorCache[e])||(this.sdfGeneratorCache[e]=new D0({canvas:t,fontSize:24,fontFamily:n,fontWeight:r,fontStyle:i,buffer:tm,radius:8,cutoff:.25})),t=(this.textMetricsCache[e]||(this.textMetricsCache[e]={}),this.textMetricsCache[e][o]||(this.textMetricsCache[e][o]=s.ctx.measureText(o).width),s.draw(o)),n=t.data,r=t.width,i=t.height,e=t.glyphWidth,s=t.glyphHeight,o=t.glyphLeft,l=t.glyphTop,t=t.glyphAdvance;return{id:a,bitmap:new $0({width:r,height:i},n),metrics:{width:e,height:s,left:o,top:l-24+J0,advance:t}}},t}();(Ys=em=em||{})[Ys.INSTANCED=5]="INSTANCED",Ys[Ys.TEX=6]="TEX",(Zs=nm=nm||{})[Zs.TEX=13]="TEX",Zs[Zs.OFFSET=14]="OFFSET",(nl=rm=rm||{}).SDF_MAP="u_SDFMap",nl.SDF_MAP_SIZE="u_SDFMapSize",nl.FONT_SIZE="u_FontSize",nl.GAMMA_SCALE="u_GammaScale",nl.STROKE_BLUR="u_StrokeBlur",nl.HAS_STROKE="u_HasStroke";var om=function(i){function t(){for(var t,e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];return(t=i.call.apply(i,[this].concat(n))||this).glyphManager=new im,t}lf(t,i);var e=t.prototype;return e.shouldMerge=function(e,t){var n;return!!i.prototype.shouldMerge.call(this,e,t)&&this.index===t&&(n=this.instance).parsedStyle.metrics.font===e.parsedStyle.metrics.font&&!["fontSize","fontFamily","fontWeight","textBaseline","letterSpacing"].some(function(t){return n.parsedStyle[t]!==e.parsedStyle[t]})},e.createGeometry=function(t){var l=this,e=this.instance.parsedStyle,u=e.textBaseline,n=e.fontSize,c=e.letterSpacing,h=24/n,d=[],f=[],p=[],g=0;t.forEach(function(t){var e=t.parsedStyle,n=e.metrics,r=e.dx,e=e.dy,i=n.font,o=n.lines,a=n.height,n=n.lineHeight,r=r||0,e=e||0,s=0,a=("middle"===u?s=-a/2:"bottom"===u?s=-a:"top"===u||"hanging"===u?s=0:"alphabetic"===u?s=.25*n-a:"ideographic"===u&&(s=-a),l.glyphManager.getAtlas()),t=l.buildTextBuffers({object:t,lines:o,fontStack:i,lineHeight:h*n,offsetX:h*r,offsetY:h*(s+e),letterSpacing:h*c,glyphAtlas:a,indicesOffset:g}),o=t.indicesOffset,i=t.indexBuffer,n=t.charUVOffsetBuffer,r=t.charPackedBuffer;g=o,p.push.apply(p,r),f.push.apply(f,n),d.push.apply(d,i)}),this.geometry.vertexCount=d.length,this.geometry.setIndexBuffer(new Uint32Array(d)),this.geometry.setVertexBuffer({bufferIndex:em.INSTANCED,byteStride:144,frequency:Af.PerVertex,attributes:[{format:S.F32_RGBA,bufferByteOffset:0,location:Jg.MODEL_MATRIX0},{format:S.F32_RGBA,bufferByteOffset:16,location:Jg.MODEL_MATRIX1},{format:S.F32_RGBA,bufferByteOffset:32,location:Jg.MODEL_MATRIX2},{format:S.F32_RGBA,bufferByteOffset:48,location:Jg.MODEL_MATRIX3},{format:S.F32_RGBA,bufferByteOffset:64,location:Jg.COLOR},{format:S.F32_RGBA,bufferByteOffset:80,location:Jg.STROKE_COLOR},{format:S.F32_RGBA,bufferByteOffset:96,location:Jg.PACKED_STYLE1},{format:S.F32_RGBA,bufferByteOffset:112,location:Jg.PACKED_STYLE2},{format:S.F32_RGBA,bufferByteOffset:128,location:Jg.PICKING_COLOR}],data:new Float32Array(p)}),this.geometry.setVertexBuffer({bufferIndex:em.TEX,byteStride:16,frequency:Af.PerVertex,attributes:[{format:S.F32_RG,bufferByteOffset:0,location:nm.TEX},{format:S.F32_RG,bufferByteOffset:8,location:nm.OFFSET}],data:new Float32Array(f)})},e.createMaterial=function(t){this.material.vertexShader="#define GLSLIFY 1\nlayout(std140) uniform ub_SceneParams {\n mat4 u_ProjectionMatrix;\n mat4 u_ViewMatrix;\n vec3 u_CameraPosition;\n float u_DevicePixelRatio;\n vec2 u_Viewport;\n float u_IsOrtho;\n float u_IsPicking;\n};\nlayout(location = MODEL_MATRIX0) in vec4 a_ModelMatrix0;\nlayout(location = MODEL_MATRIX1) in vec4 a_ModelMatrix1;\nlayout(location = MODEL_MATRIX2) in vec4 a_ModelMatrix2;\nlayout(location = MODEL_MATRIX3) in vec4 a_ModelMatrix3;\nlayout(location = COLOR) in vec4 a_Color;\nlayout(location = STROKE_COLOR) in vec4 a_StrokeColor;\nlayout(location = PACKED_STYLE1) in vec4 a_StylePacked1;\nlayout(location = PACKED_STYLE2) in vec4 a_StylePacked2;\nlayout(location = PICKING_COLOR) in vec4 a_PickingColor;\n\nout vec4 v_PickingResult;\nout vec4 v_Color;\nout vec4 v_StrokeColor;\nout vec4 v_StylePacked1;\nout vec4 v_StylePacked2;\n\n#define COLOR_SCALE 1. / 255.\nvoid setPickingColor(vec3 pickingColor) {\n v_PickingResult.rgb = pickingColor * COLOR_SCALE;\n}\n\nlayout(std140) uniform ub_ObjectParams {\n vec2 u_SDFMapSize;\n float u_FontSize;\n float u_GammaScale;\n float u_StrokeBlur;\n float u_HasStroke;\n};\nvec4 project(vec4 pos, mat4 pm, mat4 vm, mat4 mm) {\n return pm * vm * mm * pos;\n}\n\nlayout(location = TEX) in vec2 a_Tex;\nlayout(location = OFFSET) in vec2 a_Offset;\n\nout vec2 v_Uv;\nout float v_GammaScale;\n\nbool isPerspectiveMatrix(mat4 m) {\n return m[ 2 ][ 3 ] == - 1.0;\n}\n\nvoid main() {\n mat4 u_ModelMatrix = mat4(a_ModelMatrix0, a_ModelMatrix1, a_ModelMatrix2, a_ModelMatrix3);\nvec4 u_StrokeColor = a_StrokeColor;\nfloat u_Opacity = a_StylePacked1.x;\nfloat u_FillOpacity = a_StylePacked1.y;\nfloat u_StrokeOpacity = a_StylePacked1.z;\nfloat u_StrokeWidth = a_StylePacked1.w;\nfloat u_ZIndex = a_PickingColor.w;\nvec2 u_Anchor = a_StylePacked2.yz;\nfloat u_IncreasedLineWidthForHitTesting = a_StylePacked2.w;\n\nsetPickingColor(a_PickingColor.xyz);\n\nv_Color = a_Color;\nv_StrokeColor = a_StrokeColor;\nv_StylePacked1 = a_StylePacked1;\nv_StylePacked2 = a_StylePacked2;\n\n#ifdef CLIPSPACE_NEAR_ZERO\n gl_Position.z = gl_Position.z * 0.5 + 0.5;\n#endif\n\n v_Uv = a_Tex / u_SDFMapSize;\n float fontScale = u_FontSize / 24.;\n\n bool isBillboard = a_StylePacked2.y > 0.5;\n float sizeAttenuation = a_StylePacked2.z;\n vec2 offset = a_Offset * fontScale;\n\n if (isBillboard) {\n vec4 mvPosition = u_ViewMatrix * u_ModelMatrix * vec4( 0.0, 0.0, u_ZIndex, 1.0 );\nvec2 scale;\nscale.x = length( vec3( u_ModelMatrix[ 0 ].x, u_ModelMatrix[ 0 ].y, u_ModelMatrix[ 0 ].z ) );\nscale.y = length( vec3( u_ModelMatrix[ 1 ].x, u_ModelMatrix[ 1 ].y, u_ModelMatrix[ 1 ].z ) );\n\n// if (sizeAttenuation < 0.5) {\n// bool isPerspective = isPerspectiveMatrix( u_ProjectionMatrix );\n// if ( isPerspective ) scale *= - mvPosition.z;\n// }\n\nvec2 alignedPosition = offset * scale;\n\nfloat rotation = 0.0;\nvec2 rotatedPosition;\nrotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y;\nrotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y;\n\nmvPosition.xy += rotatedPosition;\n\ngl_Position = u_ProjectionMatrix * mvPosition;\n v_GammaScale = 1.0;\n } else {\n gl_Position = project(vec4(a_Offset * fontScale, u_ZIndex, 1.0), u_ProjectionMatrix, u_ViewMatrix, u_ModelMatrix);\n v_GammaScale = gl_Position.w;\n }\n}",this.material.fragmentShader="#define GLSLIFY 1\nlayout(std140) uniform ub_SceneParams {\n mat4 u_ProjectionMatrix;\n mat4 u_ViewMatrix;\n vec3 u_CameraPosition;\n float u_DevicePixelRatio;\n vec2 u_Viewport;\n float u_IsOrtho;\n float u_IsPicking;\n};\nin vec4 v_PickingResult;\nin vec4 v_Color;\nin vec4 v_StrokeColor;\nin vec4 v_StylePacked1;\nin vec4 v_StylePacked2;\nlayout(std140) uniform ub_ObjectParams {\n vec2 u_SDFMapSize;\n float u_FontSize;\n float u_GammaScale;\n float u_StrokeBlur;\n float u_HasStroke;\n};\n#ifdef USE_UV\n in vec2 v_Uv;\n#endif\n\nuniform sampler2D u_SDFMap;\n\n#define SDF_PX 8.0\n\nin float v_GammaScale;\n\nout vec4 outputColor;\n\nvoid main() {\n vec4 u_Color = v_Color;\nvec4 u_StrokeColor = v_StrokeColor;\nfloat u_Opacity = v_StylePacked1.x;\nfloat u_FillOpacity = v_StylePacked1.y;\nfloat u_StrokeOpacity = v_StylePacked1.z;\nfloat u_StrokeWidth = v_StylePacked1.w;\nfloat u_Visible = v_StylePacked2.x;\nvec3 u_PickingColor = v_PickingResult.xyz;\n\nif (u_Visible < 0.5) {\n discard;\n}\n\n float dist = texture(SAMPLER_2D(u_SDFMap), v_Uv).a;\n\n float EDGE_GAMMA = 0.105 / u_DevicePixelRatio;\n float fontScale = u_FontSize / 24.0;\n highp float gamma = EDGE_GAMMA / (fontScale * u_GammaScale);\n lowp vec4 color = u_Color;\n lowp float buff = (256.0 - 64.0) / 256.0;\n float opacity = u_FillOpacity;\n if (u_HasStroke > 0.5 && u_StrokeWidth > 0.0) {\n color = u_StrokeColor;\n gamma = (u_StrokeBlur * 1.19 / SDF_PX + EDGE_GAMMA) / (fontScale * u_GammaScale);\n buff = (6.0 - u_StrokeWidth / fontScale / 2.0) / SDF_PX;\n opacity = u_StrokeOpacity;\n }\n\n highp float gamma_scaled = gamma * v_GammaScale;\n highp float alpha = smoothstep(buff - gamma_scaled, buff + gamma_scaled, dist);\n\n opacity *= alpha * u_Opacity;\n\n if (u_IsPicking > 0.5) {\n if (u_PickingColor.x == 0.0 && u_PickingColor.y == 0.0 && u_PickingColor.z == 0.0) {\n discard;\n }\n outputColor = vec4(u_PickingColor, 1.0);\n } else {\n\n if (opacity < 0.001) {\n discard;\n }\n\n outputColor = color;\n outputColor.a *= opacity;\n }\n}",this.material.cullMode=vf.Back,this.material.defines=sf({},this.material.defines,$g(nm));var e=this.instance.parsedStyle,n=e.fontSize,r=e.fontFamily,r=void 0===r?"":r,i=e.fontWeight,i=void 0===i?"":i,o=e.fontStyle,e=e.metrics.font,t=t.map(function(t){return t.parsedStyle.text}).join(""),e=(this.glyphManager.generateAtlas(this.texturePool.context.config.offscreenCanvas,e,r,i.toString(),o,t,this.context.device),this.glyphManager.getAtlasTexture()),r=this.glyphManager.getAtlas(),i=(this.context.device.setResourceName(e,"TextSDF Texture"),r.image),o=i.width,t=i.height;this.material.setUniforms(((r={})[rm.SDF_MAP]=e,r[rm.SDF_MAP_SIZE]=[o,t],r[rm.FONT_SIZE]=n,r[rm.GAMMA_SCALE]=1,r[rm.STROKE_BLUR]=.2,r[rm.HAS_STROKE]=this.index,r))},e.changeRenderOrder=function(t,e){this.material&&(this.material.programDirty=!0,this.material.geometryDirty=!0)},e.updateAttribute=function(t,e,n,r){"text"===n||"fontFamily"===n||"fontSize"===n||"fontWeight"===n||"fontStyle"===n||"fontVariant"===n||"textBaseline"===n||"letterSpacing"===n||"wordWrapWidth"===n||"lineHeight"===n||"wordWrap"===n||"textAlign"===n||"modelMatrix"===n||"visibility"===n||"dx"===n||"dy"===n?(this.material.programDirty=!0,this.material.geometryDirty=!0,this.material.textureDirty=!0):"fill"!==n&&"fillOpacity"!==n&&"stroke"!==n&&"strokeOpacity"!==n&&"opacity"!==n&&"lineWidth"!==n&&"visibility"!==n&&"pointerEvents"!==n||(this.material.geometryDirty=!0)},e.buildTextBuffers=function(t){var n=t.object,e=t.lines,r=t.fontStack,i=t.lineHeight,o=t.letterSpacing,a=t.offsetX,s=t.offsetY,l=t.glyphAtlas,t=t.indicesOffset,u=n.parsedStyle,c=u.textAlign,h=u.fill,d=u.stroke,f=u.opacity,p=u.fillOpacity,g=u.strokeOpacity,m=u.lineWidth,v=u.visibility,y=u.isBillboard,E=u.sizeAttenuation,_=[0,0,0,0],b=(To(h)&&(_=[Number(h.r)/255,Number(h.g)/255,Number(h.b)/255,Number(h.alpha)]),[0,0,0,0]),x=(To(d)&&(b=[Number(d.r)/255,Number(d.g)/255,Number(d.b)/255,Number(d.alpha)]),n.isInteractive()&&(null==(u=n.renderable3D)?void 0:u.encodedPickingColor)||[0,0,0]),S=$(K(),n.getWorldTransform()),w=[],T=[],A=[],M=t;return function(t,e){for(var n=[],r=0;r<t.length;r++){var i,o,a,s,l=t[r],u=e[l.fontStack],u=u&&u[l.glyph];u&&(i=u.rect)&&(o=u.metrics.advance*l.scale/2,s=[l.x+o,l.y],o=(u.metrics.left-(a=J0+1))*l.scale-o+s[0],u=(-u.metrics.top-a)*l.scale+s[1],a=o+i.w*l.scale,s=u+i.h*l.scale,n.push({tl:{x:o,y:u},tr:{x:a,y:u},bl:{x:o,y:s},br:{x:a,y:s},tex:i,glyphOffset:[0,0]}))}return n}(this.glyphManager.layout(e,r,i,c,o,a,s),l.positions).forEach(function(t){var e=[],e=(e.push.apply(e,S),[].concat(e,_,b,[f,p,g,m,"visible"===v?1:0,y?1:0,E?1:0,0],x,[n.sortable.renderOrder*zg]));w.push.apply(w,e.concat(e,e,e)),T.push(t.tex.x,t.tex.y,t.tl.x,t.tl.y),T.push(t.tex.x+t.tex.w,t.tex.y,t.tr.x,t.tr.y),T.push(t.tex.x+t.tex.w,t.tex.y+t.tex.h,t.br.x,t.br.y),T.push(t.tex.x,t.tex.y+t.tex.h,t.bl.x,t.bl.y),A.push(0+M,2+M,1+M),A.push(2+M,0+M,3+M),M+=4}),{indexBuffer:A,charUVOffsetBuffer:T,charPackedBuffer:w,indicesOffset:M}},t}(Ia),am=function(i){function t(){for(var t,e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];return(t=i.call.apply(i,[this].concat(n))||this).lightReceived=!0,t}lf(t,i);var e=t.prototype;return e.shouldMerge=function(t,e){return!!i.prototype.shouldMerge.call(this,t,e)&&(this.instance.nodeName!==lt.MESH||this.instance.parsedStyle.material===t.parsedStyle.material&&this.instance.parsedStyle.geometry===t.parsedStyle.geometry)},e.updateAttribute=function(t,e,n,r){i.prototype.updateAttribute.call(this,t,e,n,r),this.updateBatchedAttribute(t,e,n,r)},e.createMaterial=function(t){var e=this.instance.parsedStyle.material;this.material=e,this.observeMaterialChanged()},e.createGeometry=function(t){var e=this.instance.parsedStyle.geometry;this.geometry=e,i.prototype.createGeometry.call(this,t),this.geometry.build(t),this.observeGeometryChanged()},t}(Ia),sm=function(i){function t(){for(var t,e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];return(t=i.call.apply(i,[this].concat(n))||this).meshes=[s0,j0],t}lf(t,i);var e=t.prototype;return e.shouldSubmitRenderInst=function(t,e){if(0===e&&t.parsedStyle.fill.isNone)return!1;return 1!==e||this.needDrawStrokeSeparately(t)},e.needDrawStrokeSeparately=function(t){var t=t.parsedStyle,e=t.fill,n=t.stroke,r=t.lineDash,i=t.lineWidth,t=t.strokeOpacity,e=e&&!e.isNone,n=n&&!n.isNone,r=r&&r.length&&r.every(function(t){return 0!==t});return!e||n&&0<i&&(t<1||r)},t}(wa),lm=function(i){function t(){for(var t,e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];return(t=i.call.apply(i,[this].concat(n))||this).meshes=[X0,j0,c0],t}lf(t,i);var e=t.prototype;return e.shouldSubmitRenderInst=function(t,e){var n=t.parsedStyle,r=n.fill,i=n.stroke,o=n.opacity,a=n.strokeOpacity,s=n.lineDash,n=n.lineWidth,l=t.nodeName,i=i&&!i.isNone,s=s&&s.length&&s.every(function(t){return 0!==t}),u=this.isLine(t);if(t.renderable.proxyNodeName=u?lt.LINE:null,0===e&&(t.nodeName===lt.POLYLINE||r.isNone))return!1;if(1===e){if(u||0===a||0===o||0===n||!i)return!1;if(l===lt.CIRCLE||l===lt.ELLIPSE)return s}return 2!==e||u},e.isLine=function(t){if(t.nodeName===lt.PATH){var e=t.parsedStyle.path.absolutePath;if(2===e.length&&"M"===e[0][0]&&"L"===e[1][0])return!0}else if(t.nodeName===lt.POLYLINE){for(var n=t.parsedStyle.points.points,r=(n[1][0]-n[1][1])/(n[0][0]-n[0][1]),i=1;i<n.length-1;i++)if((n[i+1][0]-n[i+1][1])/(n[i][0]-n[i][1])!=r)return!1;return!0}return!1},t}(wa),um=function(i){function t(){for(var t,e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];return(t=i.call.apply(i,[this].concat(n))||this).meshes=[Y0],t}return lf(t,i),t.prototype.shouldSubmitRenderInst=function(t,e){return!0},t}(wa),cm=function(i){function t(){for(var t,e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];return(t=i.call.apply(i,[this].concat(n))||this).meshes=[om,om],t}lf(t,i);var e=t.prototype;return e.shouldSubmitRenderInst=function(t,e){var t=t.parsedStyle,n=t.stroke,t=t.lineWidth;return!!(n&&!n.isNone&&t||0!==e)},e.beforeUploadUBO=function(t,e,n){var r;e.material.setUniforms(((r={})[rm.HAS_STROKE]=1-e.index,r))},t}(wa),hm=function(i){function t(){for(var t,e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];return(t=i.call.apply(i,[this].concat(n))||this).meshes=[c0],t}return lf(t,i),t.prototype.shouldSubmitRenderInst=function(t,e){return!0},t}(wa),dm=function(i){function t(){for(var t,e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];return(t=i.call.apply(i,[this].concat(n))||this).meshes=[am],t}return lf(t,i),t}(wa),fm=function(i){function t(){for(var t,e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];return(t=i.call.apply(i,[this].concat(n))||this).meshes=[s0,j0],t}lf(t,i);var e=t.prototype;return e.shouldSubmitRenderInst=function(t,e){if(0===e&&t.parsedStyle.fill.isNone)return!1;return 1!==e||this.needDrawStrokeSeparately(t)},e.needDrawStrokeSeparately=function(t){var t=t.parsedStyle,e=t.fill,n=t.stroke,r=t.lineDash,i=t.lineWidth,t=t.strokeOpacity,e=e&&!e.isNone,n=n&&!n.isNone,r=r&&r.length&&r.every(function(t){return 0!==t});return!e||n&&0<i&&(t<1||r)},t}(wa),pm=1,gm=function(){function t(t,e,n,r){this.renderHelper=void 0,this.rendererFactory=void 0,this.texturePool=void 0,this.lightPool=void 0,this.context=void 0,this.meshes=[],this.pendingUpdatePatches={},this.stencilRefCache={},this.renderHelper=t,this.rendererFactory=e,this.texturePool=n,this.lightPool=r}var e=t.prototype;return e.render=function(r,i){var o=this;(i=void 0===i?!1:i)||this.updatePendingPatches(),this.meshes.forEach(function(t){t.init(o.context);var e=t.objects,n=(t.clipPathTarget&&(e=[t.clipPath]),o.renderHelper.renderInstManager.newRenderInst());n.setAllowSkippingIfPipelineNotReady(!1),t.applyRenderInst(n,e),o.renderHelper.renderInstManager.submitRenderInst(n,r),i||t.objects.forEach(function(t){t.renderable.dirty=!1})})},e.attach=function(t){this.context=t},e.add=function(r){var i,o=this,a=r.renderable3D;a&&!a.meshes.length&&(i=this.rendererFactory[r.nodeName])&&i.meshes.forEach(function(e,n){var t;a.meshes[n]=void 0,i.shouldSubmitRenderInst(r,n)&&((t=o.meshes.find(function(t){return e===t.constructor&&t.index===n&&t.shouldMerge(r,n)}))||((t=new e(o.renderHelper,o.texturePool,o.lightPool)).renderer=i,t.index=n,o.meshes.push(t)),t)&&(t.objects.push(r),(a.meshes[n]=t).geometryDirty=!0)})},e.remove=function(n){var r=this,t=n.renderable3D;t&&(t.meshes.forEach(function(t){var e;t&&(-1<(e=t.objects.indexOf(n))&&(t.objects.splice(e,1),t.geometryDirty=!0),0===t.objects.length)&&r.meshes.splice(r.meshes.indexOf(t),1)}),t.meshes=[])},e.updateAttribute=function(o,a,s,l){var u=this,c=(void 0===l&&(l=!1),o.renderable3D),h=this.rendererFactory[o.nodeName];h&&h.meshes.forEach(function(e,n){var t,r=h.shouldSubmitRenderInst(o,n),i=c.meshes.find(function(t){return t&&t.index===n&&t.constructor===e});r!==!!i&&(i&&(i.objects.splice(i.objects.indexOf(o),1),i.geometryDirty=!0,0===i.objects.length&&u.meshes.splice(u.meshes.indexOf(i),1),c.meshes[c.meshes.indexOf(i)]=void 0),r)&&((i=u.meshes.find(function(t){return e===t.constructor&&t.index===n&&t.shouldMerge(o,n)}))||((i=new e(u.renderHelper,u.texturePool,u.lightPool)).renderer=h,i.index=n,i.init(u.context),u.meshes.push(i)),i)&&(i.objects.push(o),c.meshes[n]=i),r&&i&&i.inited&&!i.geometryDirty&&(r=i.objects.indexOf(o),l?(o.parsedStyle[a]=s,i.updateAttribute([o],r,a,s)):(t=i.id+a,u.pendingUpdatePatches[t]||(u.pendingUpdatePatches[t]={instance:i,objectIndices:[],name:a,value:s}),-1===u.pendingUpdatePatches[t].objectIndices.indexOf(r)&&u.pendingUpdatePatches[t].objectIndices.push(r)))})},e.changeRenderOrder=function(e,n){var t=e.renderable3D;t&&t.meshes.length&&t.meshes.forEach(function(t){t&&t.inited&&!t.geometryDirty&&t.renderer.shouldSubmitRenderInst(e,t.index)&&t.inited&&t.changeRenderOrder(e,n)})},e.getStencilRef=function(t){return this.stencilRefCache[t.entity]||(this.stencilRefCache[t.entity]=pm++),this.stencilRefCache[t.entity]},e.updatePendingPatches=function(){var a=this;Object.keys(this.pendingUpdatePatches).forEach(function(t){var t=a.pendingUpdatePatches[t],e=t.instance,n=t.objectIndices,r=t.name,i=t.value,o=(n.sort(function(t,e){return t-e}),[]);n.forEach(function(t){var e=o[o.length-1];e&&t===e[e.length-1]+1?e.push(t):o.push([t])}),o.forEach(function(t){e.updateAttribute(e.objects.slice(t[0],t[0]+t.length),t[0],r,i)})}),this.pendingUpdatePatches={}},t}(),mm=function(){function t(t){this.context=void 0,this.textureCache={},this.context=t}var e=t.prototype;return e.getOrCreateTexture=function(t,e,n,r){var i,o,a=this,s="string"==typeof e?e:e.src||"";return s&&this.textureCache[s]?(o=this.textureCache[s]).emit(Mf.LOADED):(o=t.createTexture(sf({pixelFormat:S.U8_RGBA_NORM,width:1,height:1,depth:1,numLevels:1,dimension:Rf.n2D,usage:Nf.Sampled,pixelStore:{unpackFlipY:!1},immutable:!1},n)),s&&(this.textureCache[s]=o),Fe(e)?((t=this.context.config.createImage)?i=t(e):Ur&&(i=new window.Image),i&&(i.onload=function(){a.textureCache[s].setImageData(i),a.textureCache[s].emit(Mf.LOADED),a.context.renderingService.dirtify(),r&&r(a.textureCache[s])},i.onerror=function(){},i.crossOrigin="Anonymous",i.src=e)):(o.setImageData(e),o.emit(Mf.LOADED),this.context.renderingService.dirtify())),o},e.getOrCreateCanvas=function(){return ct.offscreenCanvas.getOrCreateCanvas(this.context.config.offscreenCanvas)},e.getOrCreateGradient=function(t){var e=t.instance,t=t.gradients,e=e.getGeometryBounds().halfExtents,n=2*e[0]||1,r=2*e[1]||1,e=this.context.config.offscreenCanvas,i=ct.offscreenCanvas.getOrCreateCanvas(e),o=ct.offscreenCanvas.getOrCreateContext(e),a=(i.width=n,i.height=r,this.context.imagePool);t.forEach(function(t){t=a.getOrCreateGradient(sf({type:t.type},t.value,{width:n,height:r}),o);o.fillStyle=t,o.fillRect(0,0,n,r)})},e.getOrCreatePattern=function(t,e,n){var r=t.image,i=t.repetition,t=t.transform,e=e.getGeometryBounds().halfExtents,o=2*e[0]||1,e=2*e[1]||1,a=this.context.config.offscreenCanvas,s=ct.offscreenCanvas.getOrCreateCanvas(a),a=ct.offscreenCanvas.getOrCreateContext(a),n=(s.width=o,s.height=e,(s=Fe(r)?this.context.imagePool.getImageSync(r,n):r)&&a.createPattern(s,i));t&&(r=di(ta(t)),n.setTransform({a:r[0],b:r[1],c:r[4],d:r[5],e:r[12],f:r[13]})),a.fillStyle=n,a.fillRect(0,0,o,e)},e.destroy=function(){for(var t in this.textureCache)this.textureCache[t].destroy();this.textureCache={}},t}(),vm=function(i){function t(){for(var t,e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];return(t=i.call.apply(i,[this].concat(n))||this).vert="#define GLSLIFY 1\nlayout(location = 0) in vec2 a_Position;\n\nout vec2 v_TexCoord;\n\nvoid main() {\n v_TexCoord = 0.5 * (a_Position + 1.0);\n gl_Position = vec4(a_Position, 0., 1.);\n\n #ifdef VIEWPORT_ORIGIN_TL\n v_TexCoord.y = 1.0 - v_TexCoord.y;\n #endif\n}",t.frag="#define GLSLIFY 1\nuniform sampler2D u_Texture;\nin vec2 v_TexCoord;\n\nout vec4 outputColor;\n\nvoid main() {\n outputColor = texture(SAMPLER_2D(u_Texture), v_TexCoord);\n}",t.features={},t}return lf(t,i),t}(Jp),ym=(ip(1,function(){return new Bg}),function(i){function t(){for(var t,e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];return(t=i.call.apply(i,[this].concat(n))||this).name="device-renderer",t}lf(t,i);var e=t.prototype;return e.init=function(t){t.geometryUpdaterFactory[lt.MESH]=new Uf;var e,t=new Mg,n=new Df,r=new mm(this.context),i=new Gf,o=new sm,a=new lm;(e={})[lt.CIRCLE]=o,e[lt.ELLIPSE]=o,e[lt.POLYLINE]=a,e[lt.PATH]=a,e[lt.POLYGON]=a,e[lt.RECT]=new fm,e[lt.IMAGE]=new um,e[lt.LINE]=new hm,e[lt.TEXT]=new cm,e[lt.MESH]=new dm,e[lt.GROUP]=void 0,e[lt.HTML]=void 0;o=new gm(t,e,r,n),a=new Vg(t,n,r,o);this.addRenderingPlugin(a),this.addRenderingPlugin(new jg(t,a,i,o))},e.destroy=function(t){delete t.geometryUpdaterFactory[lt.MESH]},e.getRenderGraphPlugin=function(){return this.plugins[0]},e.getDevice=function(){return this.getRenderGraphPlugin().getDevice()},e.loadTexture=function(t,e,n){return this.getRenderGraphPlugin().loadTexture(t,e,n)},e.toDataURL=function(t){return this.getRenderGraphPlugin().toDataURL(t)},t}(Ws));function Em(){Em=function(){return a};var a={},t=Object.prototype,l=t.hasOwnProperty,u=Object.defineProperty||function(t,e,n){t[e]=n.value},e="function"==typeof Symbol?Symbol:{},r=e.iterator||"@@iterator",n=e.asyncIterator||"@@asyncIterator",i=e.toStringTag||"@@toStringTag";function o(t,e,n){return Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{o({},"")}catch(t){o=function(t,e,n){return t[e]=n}}function s(t,e,n,r){var i,o,a,s,e=e&&e.prototype instanceof d?e:d,e=Object.create(e.prototype),r=new b(r||[]);return u(e,"_invoke",{value:(i=t,o=n,a=r,s="suspendedStart",function(t,e){if("executing"===s)throw new Error("Generator is already running");if("completed"===s){if("throw"===t)throw e;return S()}for(a.method=t,a.arg=e;;){var n=a.delegate;if(n){n=function t(e,n){var r=n.method,i=e.iterator[r];if(void 0===i)return n.delegate=null,"throw"===r&&e.iterator.return&&(n.method="return",n.arg=void 0,t(e,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),h;r=c(i,e.iterator,n.arg);if("throw"===r.type)return n.method="throw",n.arg=r.arg,n.delegate=null,h;i=r.arg;return i?i.done?(n[e.resultName]=i.value,n.next=e.nextLoc,"return"!==n.method&&(n.method="next",n.arg=void 0),n.delegate=null,h):i:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,h)}(n,a);if(n){if(n===h)continue;return n}}if("next"===a.method)a.sent=a._sent=a.arg;else if("throw"===a.method){if("suspendedStart"===s)throw s="completed",a.arg;a.dispatchException(a.arg)}else"return"===a.method&&a.abrupt("return",a.arg);s="executing";n=c(i,o,a);if("normal"===n.type){if(s=a.done?"completed":"suspendedYield",n.arg===h)continue;return{value:n.arg,done:a.done}}"throw"===n.type&&(s="completed",a.method="throw",a.arg=n.arg)}})}),e}function c(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(t){return{type:"throw",arg:t}}}a.wrap=s;var h={};function d(){}function f(){}function p(){}var e={},g=(o(e,r,function(){return this}),Object.getPrototypeOf),g=g&&g(g(x([]))),m=(g&&g!==t&&l.call(g,r)&&(e=g),p.prototype=d.prototype=Object.create(e));function v(t){["next","throw","return"].forEach(function(e){o(t,e,function(t){return this._invoke(e,t)})})}function y(a,s){var e;u(this,"_invoke",{value:function(n,r){function t(){return new s(function(t,e){!function e(t,n,r,i){var o,t=c(a[t],a,n);if("throw"!==t.type)return(n=(o=t.arg).value)&&"object"==typeof n&&l.call(n,"__await")?s.resolve(n.__await).then(function(t){e("next",t,r,i)},function(t){e("throw",t,r,i)}):s.resolve(n).then(function(t){o.value=t,r(o)},function(t){return e("throw",t,r,i)});i(t.arg)}(n,r,t,e)})}return e=e?e.then(t,t):t()}})}function E(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function _(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function b(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(E,this),this.reset(!0)}function x(e){if(e){var n,t=e[r];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length))return n=-1,(t=function t(){for(;++n<e.length;)if(l.call(e,n))return t.value=e[n],t.done=!1,t;return t.value=void 0,t.done=!0,t}).next=t}return{next:S}}function S(){return{value:void 0,done:!0}}return u(m,"constructor",{value:f.prototype=p,configurable:!0}),u(p,"constructor",{value:f,configurable:!0}),f.displayName=o(p,i,"GeneratorFunction"),a.isGeneratorFunction=function(t){t="function"==typeof t&&t.constructor;return!!t&&(t===f||"GeneratorFunction"===(t.displayName||t.name))},a.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,p):(t.__proto__=p,o(t,i,"GeneratorFunction")),t.prototype=Object.create(m),t},a.awrap=function(t){return{__await:t}},v(y.prototype),o(y.prototype,n,function(){return this}),a.AsyncIterator=y,a.async=function(t,e,n,r,i){void 0===i&&(i=Promise);var o=new y(s(t,e,n,r),i);return a.isGeneratorFunction(e)?o:o.next().then(function(t){return t.done?t.value:o.next()})},v(m),o(m,i,"Generator"),o(m,r,function(){return this}),o(m,"toString",function(){return"[object Generator]"}),a.keys=function(t){var e,n=Object(t),r=[];for(e in n)r.push(e);return r.reverse(),function t(){for(;r.length;){var e=r.pop();if(e in n)return t.value=e,t.done=!1,t}return t.done=!0,t}},a.values=x,b.prototype={constructor:b,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(_),!t)for(var e in this)"t"===e.charAt(0)&&l.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=void 0)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(n){if(this.done)throw n;var r=this;function t(t,e){return o.type="throw",o.arg=n,r.next=t,e&&(r.method="next",r.arg=void 0),!!e}for(var e=this.tryEntries.length-1;0<=e;--e){var i=this.tryEntries[e],o=i.completion;if("root"===i.tryLoc)return t("end");if(i.tryLoc<=this.prev){var a=l.call(i,"catchLoc"),s=l.call(i,"finallyLoc");if(a&&s){if(this.prev<i.catchLoc)return t(i.catchLoc,!0);if(this.prev<i.finallyLoc)return t(i.finallyLoc)}else if(a){if(this.prev<i.catchLoc)return t(i.catchLoc,!0)}else{if(!s)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return t(i.finallyLoc)}}}},abrupt:function(t,e){for(var n=this.tryEntries.length-1;0<=n;--n){var r=this.tryEntries[n];if(r.tryLoc<=this.prev&&l.call(r,"finallyLoc")&&this.prev<r.finallyLoc){var i=r;break}}var o=(i=i&&("break"===t||"continue"===t)&&i.tryLoc<=e&&e<=i.finallyLoc?null:i)?i.completion:{};return o.type=t,o.arg=e,i?(this.method="next",this.next=i.finallyLoc,h):this.complete(o)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),h},finish:function(t){for(var e=this.tryEntries.length-1;0<=e;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),_(n),h}},catch:function(t){for(var e=this.tryEntries.length-1;0<=e;--e){var n,r,i=this.tryEntries[e];if(i.tryLoc===t)return"throw"===(n=i.completion).type&&(r=n.arg,_(i)),r}throw new Error("illegal catch attempt")},delegateYield:function(t,e,n){return this.delegate={iterator:x(t),resultName:e,nextLoc:n},"next"===this.method&&(this.arg=void 0),h}},a}function _m(t,e,n,r,i,o,a){try{var s=t[o](a),l=s.value}catch(t){return void n(t)}s.done?e(l):Promise.resolve(l).then(r,i)}function bm(s){return function(){var t=this,a=arguments;return new Promise(function(e,n){var r=s.apply(t,a);function i(t){_m(r,e,n,i,o,"next",t)}function o(t){_m(r,e,n,i,o,"throw",t)}i(void 0)})}}function xm(){return(xm=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n,r=arguments[e];for(n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t}).apply(this,arguments)}function Sm(t,e){t.prototype=Object.create(e.prototype),wm(t.prototype.constructor=t,e)}function wm(t,e){return(wm=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t})(t,e)}function Tm(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function Am(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}function Mm(t,e){var n,r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(r)return(r=r.call(t)).next.bind(r);if(Array.isArray(t)||(r=function(t,e){var n;if(t)return"string"==typeof t?Am(t,e):"Map"===(n="Object"===(n=Object.prototype.toString.call(t).slice(8,-1))&&t.constructor?t.constructor.name:n)||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Am(t,e):void 0}(t))||e&&t&&"number"==typeof t.length)return r&&(t=r),n=0,function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}};throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o=function(r){function t(t){var e=t.id,t=t.device,n=r.call(this)||this;return n.id=void 0,n.name=void 0,n.device=void 0,n.id=e,n.device=t,null!==n.device.resourceCreationTracker&&n.device.resourceCreationTracker.trackResourceCreated(Tm(n)),n}return Sm(t,r),t.prototype.destroy=function(){null!==this.device.resourceCreationTracker&&this.device.resourceCreationTracker.trackResourceDestroyed(this)},t}(qn),Rm=function(a){function t(t){var e=t.id,n=t.device,t=t.descriptor,e=a.call(this,{id:e,device:n})||this,r=(e.type=gf.Bindings,e.uniformBufferBindings=void 0,e.samplerBindings=void 0,t.bindingLayout),i=t.uniformBufferBindings,n=t.samplerBindings;T(i.length>=r.numUniformBuffers),T(n.length>=r.numSamplers);for(var o=0;o<r.numUniformBuffers;o++)T(0<i[o].wordCount);return e.uniformBufferBindings=t.uniformBufferBindings,e.samplerBindings=t.samplerBindings,e}return Sm(t,a),t}(o);function A(t){return"undefined"!=typeof WebGL2RenderingContext&&t instanceof WebGL2RenderingContext||Boolean(t&&2===t._version)}function Nm(t){return!(255&t&h.Normalized||(t=jf(t))!==u.S8&&t!==u.S16&&t!==u.S32&&t!==u.U8&&t!==u.U16&&t!==u.U32)}function Cm(t){return t&wf.INDEX?w.ELEMENT_ARRAY_BUFFER:t&wf.VERTEX?w.ARRAY_BUFFER:t&wf.UNIFORM?w.UNIFORM_BUFFER:void 0}function Pm(t){var e=jf(t),n=Vf(t),t=255&t,e=function(t){switch(t){case u.U8:return w.UNSIGNED_BYTE;case u.U16:return w.UNSIGNED_SHORT;case u.U32:return w.UNSIGNED_INT;case u.S8:return w.BYTE;case u.S16:return w.SHORT;case u.S32:return w.INT;case u.F16:return w.HALF_FLOAT;case u.F32:return w.FLOAT;default:throw new Error("whoops")}}(e);return{size:function(t){switch(t){case c.R:return 1;case c.RG:return 2;case c.RGB:return 3;case c.RGBA:return 4;default:return 1}}(n),type:e,normalized:!!(t&h.Normalized)}}function Om(t){switch(t){case _f.Clamp:return w.CLAMP_TO_EDGE;case _f.Repeat:return w.REPEAT;case _f.Mirror:return w.MIRRORED_REPEAT;default:throw new Error("whoops")}}function Im(t,e){if(e===xf.Linear&&t===bf.Bilinear)return w.LINEAR_MIPMAP_LINEAR;if(e===xf.Linear&&t===bf.Point)return w.NEAREST_MIPMAP_LINEAR;if(e===xf.Nearest&&t===bf.Bilinear)return w.LINEAR_MIPMAP_NEAREST;if(e===xf.Nearest&&t===bf.Point)return w.NEAREST_MIPMAP_NEAREST;if(e===xf.NoMip&&t===bf.Bilinear)return w.LINEAR;if(e===xf.NoMip&&t===bf.Point)return w.NEAREST;throw new Error("Unknown texture filter mode")}function Lm(t,e){return t.gl_buffer_pages[(e=void 0===e?0:e)/t.pageByteSize|0]}function km(t){return t.gl_texture}function Dm(t){return t.gl_sampler}function Bm(t,e){t.name=e,t.__SPECTOR_Metadata={name:e}}function Fm(t,e){for(var n=[];;){var r=e.exec(t);if(!r)break;n.push(r)}return n}function Um(t){return t.blendMode==Ef.Add&&t.blendSrcFactor==yf.One&&t.blendDstFactor===yf.Zero}function Gm(t,e,n,r){return t%n==0&&e%r==0}var Wm,Vm=function(c){function t(t){var e=t.id,n=t.device,t=t.descriptor,r=c.call(this,{id:e,device:n})||this,e=(r.type=gf.Buffer,r.gl_buffer_pages=void 0,r.gl_target=void 0,r.usage=void 0,r.byteSize=void 0,r.pageByteSize=void 0,t.viewOrSize),i=t.usage,o=t.hint,a=n.uniformBufferMaxPageByteSize,t=n.gl;if(i&wf.STORAGE)return Tm(r)||Tm(r);var s,l=i&wf.UNIFORM,e=(l||(A(t)?t.bindVertexArray(null):n.OES_vertex_array_object.bindVertexArrayOES(null)),B(e)?4*e:4*e.byteLength);if(r.gl_buffer_pages=[],l){T(e%a==0);for(var u=e;0<u;)r.gl_buffer_pages.push(r.createBufferPage(Math.min(u,a),i,o)),u-=a;s=a}else r.gl_buffer_pages.push(r.createBufferPage(e,i,o)),s=e;return r.pageByteSize=s,r.byteSize=e,r.usage=i,r.gl_target=Cm(i),l||(A(t)?t.bindVertexArray(r.device.currentBoundVAO):n.OES_vertex_array_object.bindVertexArrayOES(r.device.currentBoundVAO)),r}Sm(t,c);var e=t.prototype;return e.setSubData=function(t,e,n,r){void 0===n&&(n=0),void 0===r&&(r=e.byteLength-n);var i=this.device.gl,o=this.gl_target,a=this.byteSize,s=this.pageByteSize;if(!(t+r<=a))throw new Error("Assert fail: (dstByteOffset ["+t+"] + byteSize ["+r+"]) <= dstByteSize ["+a+"], gl_target "+o);for(var l=t+r,u=t,c=t%s;u<l;){var h=A(i)?i.COPY_WRITE_BUFFER:this.gl_target;i.bindBuffer(h,Lm(this,u)),A(i)?i.bufferSubData(h,c,e,n,Math.min(l-u,s)):i.bufferSubData(h,c,e),u+=s,c=0,n+=s,this.device.debugGroupStatisticsBufferUpload()}},e.destroy=function(){c.prototype.destroy.call(this);for(var t=0;t<this.gl_buffer_pages.length;t++)this.gl_buffer_pages[t].ubo||this.device.gl.deleteBuffer(this.gl_buffer_pages[t])},e.createBufferPage=function(t,e,n){var r=this.device.gl,i=e&wf.UNIFORM;return!A(r)&&i?{ubo:!0}:(i=this.device.ensureResourceExists(r.createBuffer()),e=Cm(e),n=function(t){switch(t){case Tf.Static:return w.STATIC_DRAW;case Tf.Dynamic:return w.DYNAMIC_DRAW}}(n),r.bindBuffer(e,i),r.bufferData(e,t,n),i)},t}(o),jm=function(i){function t(t){var e=t.id,n=t.device,t=t.descriptor,e=i.call(this,{id:e,device:n})||this,n=(e.type=gf.InputLayout,e.vertexAttributeDescriptors=void 0,e.vertexBufferDescriptors=void 0,e.indexBufferFormat=void 0,t.vertexAttributeDescriptors),r=t.vertexBufferDescriptors,t=t.indexBufferFormat;return T(t===S.U16_R||t===S.U32_R||null===t),e.vertexAttributeDescriptors=n,e.vertexBufferDescriptors=r,e.indexBufferFormat=t,e}return Sm(t,i),t}(o),zm=function(b){function t(t){var e=t.id,n=t.device,r=t.inputLayout,i=t.vertexBuffers,o=t.indexBufferBinding,a=t.program,t=b.call(this,{id:e,device:n})||this,s=(t.type=gf.InputState,t.vao=void 0,t.indexBufferByteOffset=void 0,t.indexBufferType=void 0,t.indexBufferCompByteSize=void 0,t.inputLayout=void 0,t.vertexBuffers=void 0,t.device.gl),e=t.device.ensureResourceExists(A(s)?s.createVertexArray():n.OES_vertex_array_object.createVertexArrayOES());A(s)?s.bindVertexArray(e):n.OES_vertex_array_object.bindVertexArrayOES(e),n.currentBoundVAO=e;for(var l=0;l<r.vertexAttributeDescriptors.length;l++){var u,c,h,d=r.vertexAttributeDescriptors[l],f=d.format,p=d.divisor,p=void 0===p?1:p,g=d.byteStride,m=d.bufferByteOffset,v=d.bufferIndex,d=A(s)?d.location:null==(d=a.attributes[d.location])?void 0:d.location;M(d)||(Nm(f),u=(f=Pm(f)).size,c=f.type,f=f.normalized,null!==(h=i[v])&&(v=Hf(r.vertexBufferDescriptors[v]),T(!!(h.buffer.usage&wf.VERTEX)),s.bindBuffer(s.ARRAY_BUFFER,Lm(h.buffer)),h=h.byteOffset+m,s.vertexAttribPointer(d,u,c,f,g||v.byteStride,h),v.frequency===Af.PerInstance&&(A(s)?s.vertexAttribDivisor(d,p):n.ANGLE_instanced_arrays.vertexAttribDivisorANGLE(d,p)),s.enableVertexAttribArray(d)))}var y=null,E=null,_=null;return null!==o&&(T(!!(o.buffer.usage&wf.INDEX)),s.bindBuffer(s.ELEMENT_ARRAY_BUFFER,Lm(o.buffer)),y=function(t){switch(t){case S.U8_R:return w.UNSIGNED_BYTE;case S.U16_R:return w.UNSIGNED_SHORT;case S.U32_R:return w.UNSIGNED_INT;default:throw new Error("whoops")}}(Hf(r.indexBufferFormat)),E=zf(r.indexBufferFormat),_=o.byteOffset),A(s)?s.bindVertexArray(null):n.OES_vertex_array_object.bindVertexArrayOES(null),n.currentBoundVAO=null,t.vao=e,t.indexBufferByteOffset=_,t.indexBufferType=y,t.indexBufferCompByteSize=E,t.inputLayout=r,t.vertexBuffers=i,t}return Sm(t,b),t.prototype.destroy=function(){b.prototype.destroy.call(this),this.device.currentBoundVAO===this.vao&&(A(this.device.gl)?(this.device.gl.bindVertexArray(null),this.device.gl.deleteVertexArray(this.vao)):(this.device.OES_vertex_array_object.bindVertexArrayOES(null),this.device.OES_vertex_array_object.deleteVertexArrayOES(this.vao)),this.device.currentBoundVAO=null)},t}(o),Hm=function(l){function t(t){var e=t.id,n=t.device,r=t.descriptor,t=t.fake,e=l.call(this,{id:e,device:n})||this,n=(e.type=gf.Texture,e.gl_texture=void 0,e.gl_target=void 0,e.pixelFormat=void 0,e.width=void 0,e.height=void 0,e.depth=void 0,e.numLevels=void 0,e.immutable=void 0,e.pixelStore=void 0,e.mipmaps=void 0,e.formatKind=void 0,e.textureIndex=void 0,e.device.gl),i=e.clampNumLevels(r);if(e.immutable=!!r.immutable,e.pixelStore=r.pixelStore,e.pixelFormat=r.pixelFormat,e.formatKind=function(t){var e=255&t;if(e&h.Depth)return Of.Depth;if(e&h.Normalized)return Of.Float;if((e=jf(t))===u.F16||e===u.F32)return Of.Float;if(e===u.U8||e===u.U16||e===u.U32)return Of.Uint;if(e===u.S8||e===u.S16||e===u.S32)return Of.Sint;throw new Error("whoops")}(r.pixelFormat),e.width=r.width,e.height=r.height,e.depth=r.depth,e.mipmaps=1<=i,!t){var o=e.device.ensureResourceExists(n.createTexture()),t=e.device.translateTextureType(r.pixelFormat),a=e.device.translateTextureInternalFormat(r.pixelFormat);if(e.device.setActiveTexture(n.TEXTURE0),e.device.currentTextures[0]=null,e.preprocessImage(),r.dimension===Rf.n2D){var s=w.TEXTURE_2D;n.bindTexture(s,o),e.immutable&&(A(n)?n.texStorage2D(s,i,a,r.width,r.height):(a!==w.DEPTH_COMPONENT&&e.isNPOT(),n.texImage2D(s,0,a,r.width,r.height,0,a,t,null),e.mipmaps&&e.isNPOT()&&(e.mipmaps=!1,n.texParameteri(w.TEXTURE_2D,w.TEXTURE_MIN_FILTER,w.LINEAR),n.texParameteri(w.TEXTURE_2D,w.TEXTURE_WRAP_S,w.CLAMP_TO_EDGE),n.texParameteri(w.TEXTURE_2D,w.TEXTURE_WRAP_T,w.CLAMP_TO_EDGE)))),T(1===r.depth)}else if(r.dimension===Rf.n2DArray)s=w.TEXTURE_2D_ARRAY,n.bindTexture(s,o),A(n)&&n.texStorage3D(s,i,a,r.width,r.height,r.depth);else if(r.dimension===Rf.n3D)s=w.TEXTURE_3D,n.bindTexture(s,o),A(n)&&n.texStorage3D(s,i,a,r.width,r.height,r.depth);else{if(r.dimension!==Rf.Cube)throw new Error("whoops");s=w.TEXTURE_CUBE_MAP,n.bindTexture(s,o),A(n)&&n.texStorage2D(s,i,a,r.width,r.height),T(6===r.depth)}}return e.gl_texture=o,e.gl_target=s,e.numLevels=i,e}Sm(t,l);var e=t.prototype;return e.setImageData=function(t,e){var n,r,i=this.device.gl,o=Array.isArray(t),a=(this.device.setActiveTexture(i.TEXTURE0),this.device.currentTextures[0]=null,o?(n=this.width,r=this.height):(n=t.width,r=t.height,this.width=n,this.height=r),i.bindTexture(this.gl_target,this.gl_texture),this.device.translateTextureFormat(this.pixelFormat)),s=this.device.translateTextureType(this.pixelFormat);this.preprocessImage(),this.immutable?i.texSubImage2D(this.gl_target,0,0,0,n,r,a,s,o?t[0]:t):A(i)?i.texImage2D(this.gl_target,0,a,n,r,0,a,s,o?t[0]:t):o?i.texImage2D(this.gl_target,0,a,n,r,0,a,s,t[0]):i.texImage2D(this.gl_target,0,a,a,s,t),this.mipmaps&&this.generateMipmap()},e.destroy=function(){l.prototype.destroy.call(this),this.device.gl.deleteTexture(km(this))},e.clampNumLevels=function(t){if(t.dimension===Rf.n2DArray&&1<t.depth&&jf(t.pixelFormat)===u.BC1)for(var e=t.width,n=t.height,r=0;r<t.numLevels;r++){if(e<=2||n<=2)return r-1;e=Math.max(e/2|0,1),n=Math.max(n/2|0,1)}return t.numLevels},e.preprocessImage=function(){var t=this.device.gl;this.pixelStore&&(this.pixelStore.unpackFlipY&&t.pixelStorei(w.UNPACK_FLIP_Y_WEBGL,!0),this.pixelStore.packAlignment&&t.pixelStorei(w.PACK_ALIGNMENT,this.pixelStore.packAlignment),this.pixelStore.unpackAlignment)&&t.pixelStorei(w.UNPACK_ALIGNMENT,this.pixelStore.unpackAlignment)},e.generateMipmap=function(){var t=this.device.gl;return!A(t)&&this.isNPOT()||this.gl_texture&&this.gl_target&&(t.bindTexture(this.gl_target,this.gl_texture),t.generateMipmap(this.gl_target),t.texParameteri(w.TEXTURE_2D,w.TEXTURE_MIN_FILTER,w.NEAREST_MIPMAP_LINEAR),t.bindTexture(this.gl_target,null)),this},e.isNPOT=function(){return!(A(this.device.gl)||Zf(this.width)&&Zf(this.height))},t}(o),Xm=((Vs=Wm=Wm||{})[Vs.NeedsCompile=0]="NeedsCompile",Vs[Vs.Compiling=1]="Compiling",Vs[Vs.NeedsBind=2]="NeedsBind",Vs[Vs.ReadyToUse=3]="ReadyToUse",function(r){function t(t){var e=t.id,n=t.device,t=t.descriptor,e=r.call(this,{id:e,device:n})||this,n=(e.type=gf.Program,e.gl_program=void 0,e.gl_shader_vert=void 0,e.gl_shader_frag=void 0,e.compileState=void 0,e.descriptor=void 0,e.uniformSetters={},e.attributes=[],e.device.gl);return e.descriptor=t,e.gl_program=e.device.ensureResourceExists(n.createProgram()),e.gl_shader_vert=null,e.gl_shader_frag=null,e.compileState=Wm.NeedsCompile,e.tryCompileProgram(),e}Sm(t,r);var e=t.prototype;return e.destroy=function(){r.prototype.destroy.call(this),this.device.gl.deleteProgram(this.gl_program),this.device.gl.deleteShader(this.gl_shader_vert),this.device.gl.deleteShader(this.gl_shader_frag)},e.tryCompileProgram=function(){T(this.compileState===Wm.NeedsCompile);var t=this.descriptor,e=this.device.gl;null!==this.gl_shader_vert&&e.deleteShader(this.gl_shader_vert),null!==this.gl_shader_frag&&e.deleteShader(this.gl_shader_frag),t.preprocessedCompute?(this.gl_shader_vert=this.compileShader(Zp(this.device.queryVendorInfo(),"vert","\nlayout(location = 0) in vec2 a_Position;\n\nout vec2 v_TexCoord;\n\nvoid main() {\n v_TexCoord = 0.5 * (a_Position + 1.0);\n gl_Position = vec4(a_Position, 0., 1.);\n\n #ifdef VIEWPORT_ORIGIN_TL\n v_TexCoord.y = 1.0 - v_TexCoord.y;\n #endif\n}\n"),e.VERTEX_SHADER),this.gl_shader_frag=this.compileShader(t.preprocessedCompute,e.FRAGMENT_SHADER)):(this.gl_shader_vert=this.compileShader(t.preprocessedVert,e.VERTEX_SHADER),this.gl_shader_frag=this.compileShader(t.preprocessedFrag,e.FRAGMENT_SHADER)),e.attachShader(this.gl_program,this.gl_shader_vert),e.attachShader(this.gl_program,this.gl_shader_frag),e.linkProgram(this.gl_program),this.compileState=Wm.Compiling,A(e)||(this.readUniformLocationsFromLinkedProgram(),this.readAttributesFromLinkedProgram())},e.readAttributesFromLinkedProgram=function(){for(var i,t,o,a,s=this,l=this.device.gl,e=l.getProgramParameter(this.gl_program,l.ACTIVE_ATTRIBUTES),n=(n=this.descriptor.preprocessedVert,i={},n.replace(/^\s*#define\s*(\S*)\s*(\S*)\s*$/gm,function(t,e,n){var r=Number(n);return i[e]=isNaN(r)?n:r,""}),i),u=(t=this.descriptor.vert,o=n,a=[],t.replace(/^\s*layout\(location\s*=\s*(\S*)\)\s*in\s+\S+\s*(.*);$/gm,function(t,e,n){var r=Number(e);return a.push({location:isNaN(r)?o[e]:r,name:n}),""}),a),c=0;c<e;c++)!function(){var t=l.getActiveAttrib(s.gl_program,c),e=t.name,n=t.type,t=t.size,r=l.getAttribLocation(s.gl_program,e),i=null==(i=u.find(function(t){return t.name===e}))?void 0:i.location;0<=r&&!M(i)&&(s.attributes[i]={name:e,location:r,type:n,size:t})}()},e.readUniformLocationsFromLinkedProgram=function(){for(var t=this.device.gl,e=t.getProgramParameter(this.gl_program,t.ACTIVE_UNIFORMS),n=0;n<e;n++){var r=t.getActiveUniform(this.gl_program,n),i=function(t){if("]"!==t[t.length-1])return{name:t,length:1,isArray:!1};var e=t.match(Ip);if(!e||e.length<2)throw new Error("Failed to parse GLSL uniform name "+t);return{name:e[1],length:Number(e[2])||1,isArray:Boolean(e[2])}}(r.name).name,o=t.getUniformLocation(this.gl_program,i);if(this.uniformSetters[i]=Yp(t,o,r),r&&1<r.size)for(var a=0;a<r.size;a++)o=t.getUniformLocation(this.gl_program,i+"["+a+"]"),this.uniformSetters[i+"["+a+"]"]=Yp(t,o,r)}},e.compileShader=function(t,e){var n=this.device.gl,e=this.device.ensureResourceExists(n.createShader(e));return n.shaderSource(e,t),n.compileShader(e),e},e.setUniforms=function(t){void 0===t&&(t={});var e=this.device.gl;if(!A(e)){var n,r=!1;for(n in t){r||(e.useProgram(this.gl_program),r=!0);var i=t[n],o=this.uniformSetters[n];o&&o(o=(o=i)instanceof Hm?o.textureIndex:o)}}return this},t}(o)),Ym=function(o){function t(t){var e=t.id,n=t.device,t=t.descriptor,r=o.call(this,{id:e,device:n})||this,i=(r.type=gf.QueryPool,r.gl_query_type=void 0,r.gl_query=void 0,r.device.gl);return A(i)&&(e=t.elemCount,n=t.type,r.gl_query=ip(e,function(){return r.device.ensureResourceExists(i.createQuery())}),r.gl_query_type=function(t){if(t!==kf.OcclusionConservative)throw new Error("whoops");return w.ANY_SAMPLES_PASSED_CONSERVATIVE}(n)),r}Sm(t,o);var e=t.prototype;return e.queryResultOcclusion=function(t){var e=this.device.gl;return A(e)&&(t=this.gl_query[t],e.getQueryParameter(t,e.QUERY_RESULT_AVAILABLE))?!!e.getQueryParameter(t,e.QUERY_RESULT):null},e.destroy=function(){o.prototype.destroy.call(this);var t=this.device.gl;if(A(t))for(var e=0;e<this.gl_query.length;e++)t.deleteQuery(this.gl_query[e])},t}(o),Km=function(n){function t(t){var e=t.id,t=t.device,e=n.call(this,{id:e,device:t})||this;return e.type=gf.Readback,e.gl_pbo=null,e.gl_sync=null,e}Sm(t,n);var e=t.prototype;return e.clientWaitAsync=function(i,o,a){void 0===o&&(o=0),void 0===a&&(a=10);var s=this.device.gl;return new Promise(function(n,r){!function t(){var e=s.clientWaitSync(i,o,0);e==s.WAIT_FAILED?r():e==s.TIMEOUT_EXPIRED?setTimeout(t,Ue(a,0,s.MAX_CLIENT_WAIT_TIMEOUT_WEBGL)):n()}()})},e.getBufferSubDataAsync=function(){var a=bm(Em().mark(function t(e,n,r,i,o,a){var s;return Em().wrap(function(t){for(;;)switch(t.prev=t.next){case 0:if(void 0===o&&(o=0),void 0===a&&(a=i.byteLength||0),A(s=this.device.gl))return this.gl_sync=s.fenceSync(s.SYNC_GPU_COMMANDS_COMPLETE,0),s.flush(),t.next=8,this.clientWaitAsync(this.gl_sync,0,10);t.next=12;break;case 8:return s.bindBuffer(e,n),s.getBufferSubData(e,r,i,o,a),s.bindBuffer(e,null),t.abrupt("return",i);case 12:case"end":return t.stop()}},t,this)}));return function(t,e,n,r,i,o){return a.apply(this,arguments)}}(),e.readTexture=function(t,e,n,r,i,o,a,s){void 0===s&&(s=o.byteLength||0);var s=this.device.gl,l=this.device.translateTextureType(t.pixelFormat);return s.bindFramebuffer(w.FRAMEBUFFER,this.device.readbackFramebuffer),s.framebufferTexture2D(w.FRAMEBUFFER,w.COLOR_ATTACHMENT0,w.TEXTURE_2D,t.gl_texture,0),s.pixelStorei(s.PACK_ALIGNMENT,4),s.readPixels(e,n,r,i,s.RGBA,l,o),o},e.readBuffer=function(){var o=bm(Em().mark(function t(e,n,r,i,o){var a;return Em().wrap(function(t){for(;;)switch(t.prev=t.next){case 0:if(A(a=this.device.gl))return t.abrupt("return",this.getBufferSubDataAsync(a.ARRAY_BUFFER,Lm(e,n),n,r,i,o));t.next=3;break;case 3:return t.abrupt("return",Promise.reject());case 4:case"end":return t.stop()}},t,this)}));return function(t,e,n,r,i){return o.apply(this,arguments)}}(),e.destroy=function(){n.prototype.destroy.call(this),A(this.device.gl)&&(null!==this.gl_sync&&this.device.gl.deleteSync(this.gl_sync),null!==this.gl_pbo)&&this.device.gl.deleteBuffer(this.gl_pbo)},t}(o),qm=function(r){function t(t){var e=t.id,n=t.device,t=t.descriptor,e=r.call(this,{id:e,device:n})||this;return e.type=gf.RenderPipeline,e.bindingLayouts=void 0,e.program=void 0,e.drawMode=void 0,e.megaState=void 0,e.inputLayout=void 0,e.colorAttachmentFormats=void 0,e.depthStencilAttachmentFormat=void 0,e.sampleCount=void 0,e.bindingLayouts=e.createBindingLayouts(t.bindingLayouts),e.drawMode=function(t){switch(t){case Sf.Triangles:return w.TRIANGLES;case Sf.Points:return w.POINTS;case Sf.TriangleStrip:return w.TRIANGLE_STRIP;case Sf.Lines:return w.LINES;case Sf.LineStrip:return w.LINE_STRIP;default:throw new Error("Unknown primitive topology mode")}}(t.topology),e.program=t.program,e.inputLayout=t.inputLayout,e.megaState=t.megaStateDescriptor,e.colorAttachmentFormats=t.colorAttachmentFormats.slice(),e.depthStencilAttachmentFormat=t.depthStencilAttachmentFormat,e.sampleCount=t.sampleCount,e}return Sm(t,r),t.prototype.createBindingLayouts=function(t){for(var e=0,n=0,r=[],i=0;i<t.length;i++){var o=t[i],a=o.numUniformBuffers,s=o.numSamplers,l=o.samplerEntries,u=[];void 0!==l&&T(l.length===s);for(var c=0;c<s;c++){var h=void 0!==l?l[c]:dp,d=h.dimension,h=h.formatKind;u.push({gl_target:function(t){if(t===Rf.n2D)return w.TEXTURE_2D;if(t===Rf.n2DArray)return w.TEXTURE_2D_ARRAY;if(t===Rf.Cube)return w.TEXTURE_CUBE_MAP;if(t===Rf.n3D)return w.TEXTURE_3D;throw new Error("whoops")}(d),formatKind:h})}r.push({firstUniformBuffer:e,numUniformBuffers:a,firstSampler:n,numSamplers:s,samplerEntries:u}),e+=a,n+=s}return{numUniformBuffers:e,numSamplers:n,bindingLayoutTables:r}},t}(o),$m=function(s){function t(t){var e=t.id,n=t.device,t=t.descriptor,e=s.call(this,{id:e,device:n})||this,n=(e.type=gf.RenderTarget,e.gl_renderbuffer=null,e.texture=null,e.pixelFormat=void 0,e.width=void 0,e.height=void 0,e.sampleCount=void 0,e.device.gl),r=t.pixelFormat,i=t.width,o=t.height,a=t.texture,t=t.sampleCount;return a?e.texture=a:(e.gl_renderbuffer=e.device.ensureResourceExists(n.createRenderbuffer()),n.bindRenderbuffer(n.RENDERBUFFER,e.gl_renderbuffer),a=e.device.translateTextureInternalFormat(r),A(n)?n.renderbufferStorageMultisample(w.RENDERBUFFER,t,a,i,o):n.renderbufferStorage(w.RENDERBUFFER,a,i,o)),e.pixelFormat=r,e.width=i,e.height=o,e.sampleCount=t,e}return Sm(t,s),t.prototype.destroy=function(){s.prototype.destroy.call(this),null!==this.gl_renderbuffer&&this.device.gl.deleteRenderbuffer(this.gl_renderbuffer)},t}(o),Zm=function(r){function t(t){var e=t.id,n=t.device,t=t.descriptor,e=r.call(this,{id:e,device:n})||this;return e.type=gf.ComputePipeline,e.descriptor=void 0,e.descriptor=t,e}return Sm(t,r),t}(o),Qm=function(){function t(){this.liveObjects=new Set,this.creationStacks=new Map,this.deletionStacks=new Map}var e=t.prototype;return e.trackResourceCreated=function(t){this.creationStacks.set(t,(new Error).stack),this.liveObjects.add(t)},e.trackResourceDestroyed=function(t){this.deletionStacks.has(t)&&console.warn("Object double freed:",t,"\n\nCreation stack: ",this.creationStacks.get(t),"\n\nDeletion stack: ",this.deletionStacks.get(t),"\n\nThis stack: ",(new Error).stack),this.deletionStacks.set(t,(new Error).stack),this.liveObjects.delete(t)},e.checkForLeaks=function(){for(var t=Mm(this.liveObjects.values());!(e=t()).done;){var e=e.value;console.warn("Object leaked:",e,"Creation stack:",this.creationStacks.get(e))}},e.setResourceLeakCheck=function(t,e){e?this.liveObjects.add(t):this.liveObjects.delete(t)},t}(),Jm=function(o){function t(t){var e,n,r=t.id,i=t.device,t=t.descriptor,r=o.call(this,{id:r,device:i})||this,i=(r.type=gf.Sampler,r.gl_sampler=void 0,r.descriptor=void 0,r.device.gl);return A(i)?(e=r.device.ensureResourceExists(i.createSampler()),i.samplerParameteri(e,w.TEXTURE_WRAP_S,Om(t.wrapS)),i.samplerParameteri(e,w.TEXTURE_WRAP_T,Om(t.wrapT)),i.samplerParameteri(e,w.TEXTURE_WRAP_R,Om(null!=(n=t.wrapQ)?n:t.wrapS)),i.samplerParameteri(e,w.TEXTURE_MIN_FILTER,Im(t.minFilter,t.mipFilter)),i.samplerParameteri(e,w.TEXTURE_MAG_FILTER,Im(t.magFilter,xf.NoMip)),void 0!==t.minLOD&&i.samplerParameterf(e,w.TEXTURE_MIN_LOD,t.minLOD),void 0!==t.maxLOD&&i.samplerParameterf(e,w.TEXTURE_MAX_LOD,t.maxLOD),void 0!==t.compareMode&&(i.samplerParameteri(e,i.TEXTURE_COMPARE_MODE,i.COMPARE_REF_TO_TEXTURE),i.samplerParameteri(e,i.TEXTURE_COMPARE_FUNC,t.compareMode)),1<(n=null!=(n=t.maxAnisotropy)?n:1)&&null!==r.device.EXT_texture_filter_anisotropic&&(T(t.minFilter===bf.Bilinear&&t.magFilter===bf.Bilinear&&t.mipFilter===xf.Linear),i.samplerParameterf(e,r.device.EXT_texture_filter_anisotropic.TEXTURE_MAX_ANISOTROPY_EXT,n)),r.gl_sampler=e):r.descriptor=t,r}Sm(t,o);var e=t.prototype;return e.setTextureParameters=function(t,e,n){var r=this.device.gl,i=this.descriptor,n=(this.isNPOT(e,n)?r.texParameteri(w.TEXTURE_2D,w.TEXTURE_MIN_FILTER,w.LINEAR):r.texParameteri(t,w.TEXTURE_MIN_FILTER,Im(i.minFilter,i.mipFilter)),r.texParameteri(w.TEXTURE_2D,w.TEXTURE_WRAP_S,Om(i.wrapS)),r.texParameteri(w.TEXTURE_2D,w.TEXTURE_WRAP_T,Om(i.wrapT)),r.texParameteri(t,w.TEXTURE_MAG_FILTER,Im(i.magFilter,xf.NoMip)),null!=(e=i.maxAnisotropy)?e:1);1<n&&null!==this.device.EXT_texture_filter_anisotropic&&(T(i.minFilter===bf.Bilinear&&i.magFilter===bf.Bilinear&&i.mipFilter===xf.Linear),r.texParameteri(t,this.device.EXT_texture_filter_anisotropic.TEXTURE_MAX_ANISOTROPY_EXT,n))},e.destroy=function(){o.prototype.destroy.call(this),A(this.device.gl)&&this.device.gl.deleteSampler(Dm(this))},e.isNPOT=function(t,e){return!Zf(t)||!Zf(e)},t}(o),tv=function(){function t(){this.descriptor=void 0}var e=t.prototype;return e.dispatch=function(t,e,n){},e.finish=function(){},e.beginComputePass=function(t){},e.setPipeline=function(t){},e.setBindings=function(t,e){},e.setComputePassDescriptor=function(t){this.descriptor=t},t}(),ev=function(){function t(t,e){this.shaderDebug=!1,this.contextAttributes=void 0,this.OES_vertex_array_object=null,this.ANGLE_instanced_arrays=null,this.OES_texture_float=null,this.OES_draw_buffers_indexed=null,this.WEBGL_depth_texture=null,this.WEBGL_compressed_texture_s3tc=null,this.WEBGL_compressed_texture_s3tc_srgb=null,this.EXT_texture_compression_rgtc=null,this.EXT_texture_filter_anisotropic=null,this.KHR_parallel_shader_compile=null,this.EXT_texture_norm16=null,this.OES_texture_float_linear=null,this.OES_texture_half_float_linear=null,this.scTexture=null,this.scPlatformFramebuffer=null,this.currentActiveTexture=null,this.currentBoundVAO=null,this.currentProgram=null,this.resourceCreationTracker=null,this.resourceUniqueId=0,this.currentColorAttachments=[],this.currentColorResolveTos=[],this.currentDepthStencilAttachment=void 0,this.currentDepthStencilResolveTo=null,this.currentSampleCount=-1,this.currentPipeline=void 0,this.currentInputState=void 0,this.currentMegaState=up(cp),this.currentSamplers=[],this.currentTextures=[],this.currentUniformBuffers=[],this.currentUniformBufferByteOffsets=[],this.currentUniformBufferByteSizes=[],this.currentScissorEnabled=!1,this.currentStencilRef=null,this.currentRenderPassDescriptor=null,this.debugGroupStack=[],this.resolveColorAttachmentsChanged=!1,this.resolveColorReadFramebuffer=void 0,this.resolveColorDrawFramebuffer=void 0,this.resolveDepthStencilAttachmentsChanged=!1,this.resolveDepthStencilReadFramebuffer=void 0,this.resolveDepthStencilDrawFramebuffer=void 0,this.renderPassDrawFramebuffer=void 0,this.readbackFramebuffer=void 0,this.fallbackTexture2D=void 0,this.fallbackTexture2DDepth=void 0,this.fallbackTexture2DArray=void 0,this.fallbackTexture3D=void 0,this.fallbackTextureCube=void 0,this.platformString=void 0,this.glslVersion=void 0,this.explicitBindingLocations=!1,this.separateSamplerTextures=!1,this.viewportOrigin=If.LowerLeft,this.clipSpaceNearZ=Lf.NegativeOne,this.supportMRT=!1,this.inBlitRenderPass=!1,this.blitRenderPipeline=void 0,this.blitInputState=void 0,this.blitBindings=void 0,this.uniformBufferMaxPageByteSize=void 0,this.uniformBufferWordAlignment=void 0,this.uniformBufferMaxPageWordSize=void 0,this.supportedSampleCounts=[],this.maxVertexAttribs=void 0,this.occlusionQueriesRecommended=!1,this.gl=void 0,this.gl=t,this.contextAttributes=Hf(t.getContextAttributes()),A(t)?this.EXT_texture_norm16=t.getExtension("EXT_texture_norm16"):(this.OES_vertex_array_object=t.getExtension("OES_vertex_array_object"),this.ANGLE_instanced_arrays=t.getExtension("ANGLE_instanced_arrays"),this.OES_texture_float=t.getExtension("OES_texture_float"),this.WEBGL_depth_texture=t.getExtension("WEBGL_depth_texture"),t.getExtension("EXT_frag_depth"),t.getExtension("OES_element_index_uint"),t.getExtension("OES_standard_derivatives")),this.WEBGL_compressed_texture_s3tc=t.getExtension("WEBGL_compressed_texture_s3tc"),this.WEBGL_compressed_texture_s3tc_srgb=t.getExtension("WEBGL_compressed_texture_s3tc_srgb"),this.EXT_texture_compression_rgtc=t.getExtension("EXT_texture_compression_rgtc"),this.EXT_texture_filter_anisotropic=t.getExtension("EXT_texture_filter_anisotropic"),this.EXT_texture_norm16=t.getExtension("EXT_texture_norm16"),this.OES_texture_float_linear=t.getExtension("OES_texture_float_linear"),this.OES_texture_half_float_linear=t.getExtension("OES_texture_half_float_linear"),this.KHR_parallel_shader_compile=t.getExtension("KHR_parallel_shader_compile"),A(t)?(this.platformString="WebGL2",this.glslVersion="#version 300 es"):(this.platformString="WebGL1",this.glslVersion="#version 100"),this.scTexture=new Hm({id:this.getNextUniqueId(),device:this,descriptor:{width:0,height:0,depth:1,dimension:Rf.n2D,numLevels:1,usage:Nf.RenderTarget,pixelFormat:!1===this.contextAttributes.alpha?S.U8_RGB_RT:S.U8_RGBA_RT},fake:!0}),this.scTexture.formatKind=Of.Float,this.scTexture.gl_target=null,this.scTexture.gl_texture=null,this.resolveColorReadFramebuffer=this.ensureResourceExists(t.createFramebuffer()),this.resolveColorDrawFramebuffer=this.ensureResourceExists(t.createFramebuffer()),this.resolveDepthStencilReadFramebuffer=this.ensureResourceExists(t.createFramebuffer()),this.resolveDepthStencilDrawFramebuffer=this.ensureResourceExists(t.createFramebuffer()),this.renderPassDrawFramebuffer=this.ensureResourceExists(t.createFramebuffer()),this.readbackFramebuffer=this.ensureResourceExists(t.createFramebuffer()),this.fallbackTexture2D=this.createFallbackTexture(Rf.n2D,Of.Float),this.fallbackTexture2DDepth=this.createFallbackTexture(Rf.n2D,Of.Depth),A(t),this.currentMegaState.depthCompare=mf.Less,this.currentMegaState.depthWrite=!1,this.currentMegaState.attachmentsState[0].channelWriteMask=Cf.AllChannels,t.enable(t.DEPTH_TEST),t.enable(t.STENCIL_TEST),this.checkLimits(),e.shaderDebug&&(this.shaderDebug=!0),e.trackResources&&(this.resourceCreationTracker=new Qm)}var e=t.prototype;return e.createFallbackTexture=function(t,e){var n=t===Rf.Cube?6:1,r=e===Of.Depth?S.D32F:S.U8_RGBA_NORM,t=this.createTexture({dimension:t,pixelFormat:r,usage:Nf.Sampled,width:1,height:1,depth:n,numLevels:1,immutable:!0});return e===Of.Float&&t.setImageData([new Uint8Array(4*n)],0),km(t)},e.getNextUniqueId=function(){return++this.resourceUniqueId},e.checkLimits=function(){var t=this.gl;this.maxVertexAttribs=t.getParameter(w.MAX_VERTEX_ATTRIBS),A(t)?(this.uniformBufferMaxPageByteSize=Math.min(t.getParameter(w.MAX_UNIFORM_BLOCK_SIZE),65536),this.uniformBufferWordAlignment=t.getParameter(t.UNIFORM_BUFFER_OFFSET_ALIGNMENT)/4,t=t.getInternalformatParameter(t.RENDERBUFFER,t.DEPTH32F_STENCIL8,t.SAMPLES),this.supportedSampleCounts=t?[].concat(t):[],this.occlusionQueriesRecommended=!0):(this.uniformBufferWordAlignment=64,this.uniformBufferMaxPageByteSize=65536),this.uniformBufferMaxPageWordSize=this.uniformBufferMaxPageByteSize/4,this.supportedSampleCounts.includes(1)||this.supportedSampleCounts.push(1),this.supportedSampleCounts.sort(function(t,e){return t-e})},e.configureSwapChain=function(t,e,n){var r=this.scTexture;r.width=t,r.height=e,this.scPlatformFramebuffer=Jf(n)},e.getDevice=function(){return this},e.getCanvas=function(){return this.gl.canvas},e.getOnscreenTexture=function(){return this.scTexture},e.present=function(){},e.translateTextureInternalFormat=function(t){switch(t){case S.ALPHA:return w.ALPHA;case S.F16_R:return w.R16F;case S.F16_RG:return w.RG16F;case S.F16_RGB:return w.RGB16F;case S.F16_RGBA:return w.RGBA16F;case S.F32_R:return w.R32F;case S.F32_RG:return w.RG32F;case S.F32_RGB:return w.RGB32F;case S.F32_RGBA:return w.RGBA32F;case S.U8_R_NORM:return w.R8;case S.U8_RG_NORM:return w.RG8;case S.U8_RGB_NORM:case S.U8_RGB_RT:return w.RGB8;case S.U8_RGB_SRGB:return w.SRGB8;case S.U8_RGBA_NORM:case S.U8_RGBA_RT:return A(this.gl)?w.RGBA8:w.RGBA;case S.U8_RGBA_SRGB:case S.U8_RGBA_RT_SRGB:return w.SRGB8_ALPHA8;case S.U16_R:return w.R16UI;case S.U16_R_NORM:return this.EXT_texture_norm16.R16_EXT;case S.U16_RG_NORM:return this.EXT_texture_norm16.RG16_EXT;case S.U16_RGBA_NORM:return this.EXT_texture_norm16.RGBA16_EXT;case S.U32_R:return w.R32UI;case S.S8_RGBA_NORM:return w.RGBA8_SNORM;case S.S8_RG_NORM:return w.RG8_SNORM;case S.U16_RGBA_5551:return w.UNSIGNED_SHORT_5_5_5_1;case S.BC1:return this.WEBGL_compressed_texture_s3tc.COMPRESSED_RGBA_S3TC_DXT1_EXT;case S.BC1_SRGB:return this.WEBGL_compressed_texture_s3tc_srgb.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;case S.BC2:return this.WEBGL_compressed_texture_s3tc.COMPRESSED_RGBA_S3TC_DXT3_EXT;case S.BC2_SRGB:return this.WEBGL_compressed_texture_s3tc_srgb.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;case S.BC3:return this.WEBGL_compressed_texture_s3tc.COMPRESSED_RGBA_S3TC_DXT5_EXT;case S.BC3_SRGB:return this.WEBGL_compressed_texture_s3tc_srgb.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT;case S.BC4_UNORM:return this.EXT_texture_compression_rgtc.COMPRESSED_RED_RGTC1_EXT;case S.BC4_SNORM:return this.EXT_texture_compression_rgtc.COMPRESSED_SIGNED_RED_RGTC1_EXT;case S.BC5_UNORM:return this.EXT_texture_compression_rgtc.COMPRESSED_RED_GREEN_RGTC2_EXT;case S.BC5_SNORM:return this.EXT_texture_compression_rgtc.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT;case S.D32F_S8:return A(this.gl)?w.DEPTH32F_STENCIL8:w.DEPTH_STENCIL;case S.D24_S8:return A(this.gl)?w.DEPTH24_STENCIL8:w.DEPTH_STENCIL;case S.D32F:return A(this.gl)?w.DEPTH_COMPONENT32F:w.DEPTH_COMPONENT;case S.D24:return A(this.gl)?w.DEPTH_COMPONENT24:w.DEPTH_COMPONENT;default:throw new Error("whoops")}},e.translateTextureType=function(t){switch(jf(t)){case u.U8:return w.UNSIGNED_BYTE;case u.U16:return w.UNSIGNED_SHORT;case u.U32:return w.UNSIGNED_INT;case u.S8:return w.BYTE;case u.F16:return w.HALF_FLOAT;case u.F32:return w.FLOAT;case u.U16_PACKED_5551:return w.UNSIGNED_SHORT_5_5_5_1;case u.D32F:return A(this.gl)?w.FLOAT:w.UNSIGNED_INT;case u.D24:return A(this.gl)?w.UNSIGNED_INT_24_8:w.UNSIGNED_SHORT;case u.D24S8:return A(this.gl)?w.UNSIGNED_INT_24_8:w.UNSIGNED_INT_24_8_WEBGL;case u.D32FS8:return w.FLOAT_32_UNSIGNED_INT_24_8_REV;default:throw new Error("whoops")}},e.translateTextureFormat=function(t){if(function(t){switch(jf(t)){case u.BC1:case u.BC2:case u.BC3:case u.BC4_UNORM:case u.BC4_SNORM:case u.BC5_UNORM:case u.BC5_SNORM:return 1;default:return}}(t))return this.translateTextureInternalFormat(t);switch(t){case S.D24_S8:case S.D32F_S8:return w.DEPTH_STENCIL;case S.D24:case S.D32F:return w.DEPTH_COMPONENT}var e=Nm(t);switch(Vf(t)){case c.A:return w.ALPHA;case c.R:return e?w.RED_INTEGER:w.RED;case c.RG:return e?w.RG_INTEGER:w.RG;case c.RGB:return e?w.RGB_INTEGER:w.RGB;case c.RGBA:return w.RGBA}},e.setActiveTexture=function(t){this.currentActiveTexture!==t&&(this.gl.activeTexture(t),this.currentActiveTexture=t)},e.bindVAO=function(t){this.currentBoundVAO!==t&&(A(this.gl)?this.gl.bindVertexArray(t):this.OES_vertex_array_object.bindVertexArrayOES(t),this.currentBoundVAO=t)},e.programCompiled=function(t){T(t.compileState!==Wm.NeedsCompile),t.compileState===Wm.Compiling&&(t.compileState=Wm.NeedsBind,this.shaderDebug)&&this.checkProgramCompilationForErrors(t)},e.useProgram=function(t){this.currentProgram!==t&&(this.programCompiled(t),this.gl.useProgram(t.gl_program),this.currentProgram=t)},e.ensureResourceExists=function(t){var e;if(null===t)throw e=this.gl.getError(),new Error("Created resource is null; GL error encountered: "+e);return t},e.createBuffer=function(t){return new Vm({id:this.getNextUniqueId(),device:this,descriptor:t})},e.createTexture=function(t){return new Hm({id:this.getNextUniqueId(),device:this,descriptor:t})},e.createSampler=function(t){return new Jm({id:this.getNextUniqueId(),device:this,descriptor:t})},e.createRenderTarget=function(t){return new $m({id:this.getNextUniqueId(),device:this,descriptor:t})},e.createRenderTargetFromTexture=function(t){var e=t.pixelFormat,n=t.width,r=t.height;return T(1===t.numLevels),this.createRenderTarget({pixelFormat:e,width:n,height:r,sampleCount:1,texture:t})},e.createProgram=function(t){return t.ensurePreprocessed(this.queryVendorInfo()),this.createProgramSimple(t)},e.createProgramSimple=function(t){return new Xm({id:this.getNextUniqueId(),device:this,descriptor:t})},e.createBindings=function(t){return new Rm({id:this.getNextUniqueId(),device:this,descriptor:t})},e.createInputLayout=function(t){return new jm({id:this.getNextUniqueId(),device:this,descriptor:t})},e.createInputState=function(t,e,n,r){return new zm({id:this.getNextUniqueId(),device:this,inputLayout:t,vertexBuffers:e,indexBufferBinding:n,program:r})},e.createRenderPipeline=function(t){return new qm({id:this.getNextUniqueId(),device:this,descriptor:t})},e.createComputePass=function(t){return new tv},e.createComputePipeline=function(t){return new Zm({id:this.getNextUniqueId(),device:this,descriptor:t})},e.createReadback=function(){return new Km({id:this.getNextUniqueId(),device:this})},e.createQueryPool=function(t,e){return new Ym({id:this.getNextUniqueId(),device:this,descriptor:{type:t,elemCount:e}})},e.createRenderPass=function(t){T(null===this.currentRenderPassDescriptor);var e=(this.currentRenderPassDescriptor=t).colorAttachment,n=t.colorClearColor,r=t.colorResolveTo,i=t.depthStencilAttachment,o=t.depthClearValue,a=t.stencilClearValue,t=t.depthStencilResolveTo;this.setRenderPassParametersBegin(e.length);for(var s=0;s<e.length;s++)this.setRenderPassParametersColor(s,e[s],r[s]);this.setRenderPassParametersDepthStencil(i,t),this.validateCurrentAttachments();for(var l=0;l<e.length;l++){var u=n[l];"load"!==u&&this.setRenderPassParametersClearColor(l,u.r,u.g,u.b,u.a)}return this.setRenderPassParametersClearDepthStencil(o,a),this},e.submitPass=function(t){T(null!==this.currentRenderPassDescriptor),this.endPass(),this.currentRenderPassDescriptor=null},e.copySubTexture2D=function(t,e,n,r,i,o){var a=this.gl;T(1===r.numLevels),T(1===t.numLevels),A(a)&&(t===this.scTexture?a.bindFramebuffer(a.DRAW_FRAMEBUFFER,this.scPlatformFramebuffer):(a.bindFramebuffer(a.DRAW_FRAMEBUFFER,this.resolveColorDrawFramebuffer),this.bindFramebufferAttachment(a.DRAW_FRAMEBUFFER,a.COLOR_ATTACHMENT0,t)),a.bindFramebuffer(a.READ_FRAMEBUFFER,this.resolveColorReadFramebuffer),this.bindFramebufferAttachment(a.READ_FRAMEBUFFER,a.COLOR_ATTACHMENT0,r),a.blitFramebuffer(i,o,i+r.width,o+r.height,e,n,e+r.width,n+r.height,a.COLOR_BUFFER_BIT,a.LINEAR),a.bindFramebuffer(a.READ_FRAMEBUFFER,null),a.bindFramebuffer(a.DRAW_FRAMEBUFFER,null))},e.queryLimits=function(){return this},e.queryTextureFormatSupported=function(t,e,n){switch(t){case S.BC1_SRGB:case S.BC2_SRGB:case S.BC3_SRGB:return null!==this.WEBGL_compressed_texture_s3tc_srgb?Gm(e,n,4,4):!1;case S.BC1:case S.BC2:case S.BC3:return null!==this.WEBGL_compressed_texture_s3tc?Gm(e,n,4,4):!1;case S.BC4_UNORM:case S.BC4_SNORM:case S.BC5_UNORM:case S.BC5_SNORM:return null!==this.EXT_texture_compression_rgtc?Gm(e,n,4,4):!1;case S.U16_R_NORM:case S.U16_RG_NORM:case S.U16_RGBA_NORM:return null!==this.EXT_texture_norm16;case S.F32_R:case S.F32_RG:case S.F32_RGB:case S.F32_RGBA:return null!==this.OES_texture_float_linear;case S.F16_R:case S.F16_RG:case S.F16_RGB:case S.F16_RGBA:return null!==this.OES_texture_half_float_linear;default:return!0}},e.queryProgramReady=function(t){var e=this.gl;if(t.compileState===Wm.NeedsCompile)throw new Error("whoops");return t.compileState===Wm.Compiling?((e=null===this.KHR_parallel_shader_compile||e.getProgramParameter(t.gl_program,this.KHR_parallel_shader_compile.COMPLETION_STATUS_KHR))&&this.programCompiled(t),e):t.compileState===Wm.NeedsBind||t.compileState===Wm.ReadyToUse},e.queryPlatformAvailable=function(){return this.gl.isContextLost()},e.queryVendorInfo=function(){return this},e.queryRenderPass=function(t){return this.currentRenderPassDescriptor},e.queryRenderTarget=function(t){return t},e.setResourceName=function(t,e){var n;if(t.name=e,t.type===gf.Buffer)for(var r=t.gl_buffer_pages,i=0;i<r.length;i++)Bm(r[i],e+" Page "+i);else t.type===gf.Texture?Bm(km(t),e):t.type===gf.Sampler?Bm(Dm(t),e):t.type===gf.RenderTarget?null!==(n=t.gl_renderbuffer)&&Bm(n,e):t.type===gf.InputState&&Bm(t.vao,e)},e.setResourceLeakCheck=function(t,e){null!==this.resourceCreationTracker&&this.resourceCreationTracker.setResourceLeakCheck(t,e)},e.checkForLeaks=function(){null!==this.resourceCreationTracker&&this.resourceCreationTracker.checkForLeaks()},e.pushDebugGroup=function(t){this.debugGroupStack.push(t)},e.popDebugGroup=function(){this.debugGroupStack.pop()},e.programPatched=function(t,e){T(this.shaderDebug)},e.getBufferData=function(t,e,n){void 0===n&&(n=0);var r=this.gl;A(r)&&(r.bindBuffer(r.COPY_READ_BUFFER,Lm(t,4*n)),r.getBufferSubData(r.COPY_READ_BUFFER,4*n,e))},e.debugGroupStatisticsDrawCall=function(t){void 0===t&&(t=1);for(var e=this.debugGroupStack.length-1;0<=e;e--)this.debugGroupStack[e].drawCallCount+=t},e.debugGroupStatisticsBufferUpload=function(t){void 0===t&&(t=1);for(var e=this.debugGroupStack.length-1;0<=e;e--)this.debugGroupStack[e].bufferUploadCount+=t},e.debugGroupStatisticsTextureBind=function(t){void 0===t&&(t=1);for(var e=this.debugGroupStack.length-1;0<=e;e--)this.debugGroupStack[e].textureBindCount+=t},e.debugGroupStatisticsTriangles=function(t){for(var e=this.debugGroupStack.length-1;0<=e;e--)this.debugGroupStack[e].triangleCount+=t},e.reportShaderError=function(t,e){var n=this.gl,r=n.getShaderParameter(t,n.COMPILE_STATUS);return r||(console.error(op(e)),(e=n.getExtension("WEBGL_debug_shaders"))&&console.error(e.getTranslatedShaderSource(t)),console.error(n.getShaderInfoLog(t))),r},e.checkProgramCompilationForErrors=function(t){var e=this.gl,n=t.gl_program;e.getProgramParameter(n,e.LINK_STATUS)||(n=t.descriptor,this.reportShaderError(t.gl_shader_vert,n.preprocessedVert)&&this.reportShaderError(t.gl_shader_frag,n.preprocessedFrag)&&console.error(e.getProgramInfoLog(t.gl_program)))},e.bindFramebufferAttachment=function(t,e,n){var r=this.gl;null===n?r.framebufferRenderbuffer(t,e,r.RENDERBUFFER,null):n.type===gf.RenderTarget?null!==n.gl_renderbuffer?r.framebufferRenderbuffer(t,e,r.RENDERBUFFER,n.gl_renderbuffer):null!==n.texture&&r.framebufferTexture2D(t,e,w.TEXTURE_2D,km(n.texture),0):n.type===gf.Texture&&r.framebufferTexture2D(t,e,w.TEXTURE_2D,km(n),0)},e.bindFramebufferDepthStencilAttachment=function(t,e){var n=this.gl,r=null!==e?255&e.pixelFormat:h.Depth|h.Stencil,i=!!(r&h.Depth),r=!!(r&h.Stencil);i&&r?this.bindFramebufferAttachment(t,n.DEPTH_STENCIL_ATTACHMENT,e):i?(this.bindFramebufferAttachment(t,n.DEPTH_ATTACHMENT,e),this.bindFramebufferAttachment(t,n.STENCIL_ATTACHMENT,null)):r&&(this.bindFramebufferAttachment(t,n.STENCIL_ATTACHMENT,e),this.bindFramebufferAttachment(t,n.DEPTH_ATTACHMENT,null))},e.validateCurrentAttachments=function(){for(var t=-1,e=-1,n=-1,r=0;r<this.currentColorAttachments.length;r++){var i=this.currentColorAttachments[r];null!==i&&(-1===t?(t=i.sampleCount,e=i.width,n=i.height):(T(t===i.sampleCount),T(e===i.width),T(n===i.height)))}null!==this.currentDepthStencilAttachment&&(-1===t?(t=this.currentDepthStencilAttachment.sampleCount,e=this.currentDepthStencilAttachment.width,n=this.currentDepthStencilAttachment.height):(T(t===this.currentDepthStencilAttachment.sampleCount),T(e===this.currentDepthStencilAttachment.width),T(n===this.currentDepthStencilAttachment.height))),this.currentSampleCount=t},e.setRenderPassParametersBegin=function(t){var e=this.gl;if(A(e)?e.bindFramebuffer(w.DRAW_FRAMEBUFFER,this.renderPassDrawFramebuffer):this.inBlitRenderPass||e.bindFramebuffer(w.FRAMEBUFFER,this.renderPassDrawFramebuffer),!this.inBlitRenderPass)for(var n=t;n<this.currentColorAttachments.length;n++){var r=A(e)?w.DRAW_FRAMEBUFFER:w.FRAMEBUFFER,i=A(e)?w.COLOR_ATTACHMENT0:w.COLOR_ATTACHMENT0_WEBGL;e.framebufferRenderbuffer(r,i+n,w.RENDERBUFFER,null),e.framebufferTexture2D(r,i+n,w.TEXTURE_2D,null,0)}this.currentColorAttachments.length=t},e.setRenderPassParametersColor=function(t,e,n){var r=this.gl;this.currentColorAttachments[t]!==e&&(this.currentColorAttachments[t]=e,!A(r)&&0!==t||this.bindFramebufferAttachment(A(r)?w.DRAW_FRAMEBUFFER:w.FRAMEBUFFER,(A(r)?w.COLOR_ATTACHMENT0:w.COLOR_ATTACHMENT0_WEBGL)+t,e),this.resolveColorAttachmentsChanged=!0),this.currentColorResolveTos[t]!==n&&null!==(this.currentColorResolveTos[t]=n)&&(this.resolveColorAttachmentsChanged=!0)},e.setRenderPassParametersDepthStencil=function(t,e){var n=this.gl;this.currentDepthStencilAttachment!==t&&(this.currentDepthStencilAttachment=t,this.inBlitRenderPass||this.bindFramebufferDepthStencilAttachment(A(n)?w.DRAW_FRAMEBUFFER:w.FRAMEBUFFER,this.currentDepthStencilAttachment),this.resolveDepthStencilAttachmentsChanged=!0),this.currentDepthStencilResolveTo!==e&&null!==(this.currentDepthStencilResolveTo=e)&&(this.resolveDepthStencilAttachmentsChanged=!0)},e.setRenderPassParametersClearColor=function(t,e,n,r,i){var o,a=this.gl;null!==this.OES_draw_buffers_indexed?(o=this.currentMegaState.attachmentsState[t])&&o.channelWriteMask!==Cf.AllChannels&&(this.OES_draw_buffers_indexed.colorMaskiOES(t,!0,!0,!0,!0),o.channelWriteMask=Cf.AllChannels):(o=this.currentMegaState.attachmentsState[0])&&o.channelWriteMask!==Cf.AllChannels&&(a.colorMask(!0,!0,!0,!0),o.channelWriteMask=Cf.AllChannels),this.setScissorEnabled(!1),A(a)?a.clearBufferfv(a.COLOR,t,[e,n,r,i]):(a.clearColor(e,n,r,i),a.clear(a.COLOR_BUFFER_BIT))},e.setRenderPassParametersClearDepthStencil=function(t,e){var n=this.gl;"load"!==t&&(T(null!==this.currentDepthStencilAttachment),this.currentMegaState.depthWrite||(n.depthMask(!0),this.currentMegaState.depthWrite=!0),A(n)?n.clearBufferfv(n.DEPTH,0,[t]):(n.clearDepth(t),n.clear(n.DEPTH_BUFFER_BIT))),"load"!==e&&(T(null!==this.currentDepthStencilAttachment),this.currentMegaState.stencilWrite||(n.enable(n.STENCIL_TEST),n.stencilMask(255),this.currentMegaState.stencilWrite=!0),A(n)?n.clearBufferiv(n.STENCIL,0,[e]):(n.clearStencil(e),n.clear(n.STENCIL_BUFFER_BIT)))},e.setBindings=function(t,e,n){var r=this.gl,i=(T(t<this.currentPipeline.bindingLayouts.bindingLayoutTables.length),this.currentPipeline.bindingLayouts.bindingLayoutTables[t]),o=e.uniformBufferBindings,a=e.samplerBindings;T(o.length>=i.numUniformBuffers),T(a.length>=i.numSamplers),T(n.length>=o.length);for(var s=0;s<o.length;s++){var l,u,c,h,d,f=o[s];0!==f.wordCount&&(l=i.firstUniformBuffer+s,u=f.buffer,c=n[s],f=4*f.wordCount,u!==this.currentUniformBuffers[l]||c!==this.currentUniformBufferByteOffsets[l]||f!==this.currentUniformBufferByteSizes[l])&&(h=c%u.pageByteSize,d=u.gl_buffer_pages[c/u.pageByteSize|0],T(h+f<=u.pageByteSize),A(r)&&r.bindBufferRange(r.UNIFORM_BUFFER,l,d,h,f),this.currentUniformBuffers[l]=u,this.currentUniformBufferByteOffsets[l]=c,this.currentUniformBufferByteSizes[l]=f)}for(var p=0;p<i.numSamplers;p++){var g,m,v=a[p],y=i.firstSampler+p,E=i.samplerEntries[p],_=null!==v&&null!==v.sampler?Dm(v.sampler):null,b=null!==v&&null!==v.texture?km(v.texture):null;this.currentSamplers[y]!==_&&(A(r)&&r.bindSampler(y,_),this.currentSamplers[y]=_),this.currentTextures[y]!==b&&(this.setActiveTexture(r.TEXTURE0+y),null!==b?(v.texture.textureIndex=y,g=(_=Hf(v).texture).gl_target,m=_.width,_=_.height,r.bindTexture(g,b),A(r)||null!=(v=v.sampler)&&v.setTextureParameters(g,m,_),this.debugGroupStatisticsTextureBind(),T(E.gl_target===g)):r.bindTexture(E.gl_target,this.getFallbackTexture(E)),this.currentTextures[y]=b)}},e.setViewport=function(t,e,n,r){this.gl.viewport(t,e,n,r)},e.setScissor=function(t,e,n,r){var i=this.gl;this.setScissorEnabled(!0),i.scissor(t,e,n,r)},e.applyAttachmentStateIndexed=function(t,e,n){var r=this.gl,i=this.OES_draw_buffers_indexed,o=(e.channelWriteMask!==n.channelWriteMask&&(i.colorMaskiOES(t,!!(n.channelWriteMask&Cf.Red),!!(n.channelWriteMask&Cf.Green),!!(n.channelWriteMask&Cf.Blue),!!(n.channelWriteMask&Cf.Alpha)),e.channelWriteMask=n.channelWriteMask),e.rgbBlendState.blendMode!==n.rgbBlendState.blendMode||e.alphaBlendState.blendMode!==n.alphaBlendState.blendMode),a=e.rgbBlendState.blendSrcFactor!==n.rgbBlendState.blendSrcFactor||e.alphaBlendState.blendSrcFactor!==n.alphaBlendState.blendSrcFactor||e.rgbBlendState.blendDstFactor!==n.rgbBlendState.blendDstFactor||e.alphaBlendState.blendDstFactor!==n.alphaBlendState.blendDstFactor;(a||o)&&(Um(e.rgbBlendState)&&Um(e.alphaBlendState)?i.enableiOES(t,r.BLEND):Um(n.rgbBlendState)&&Um(n.alphaBlendState)&&i.disableiOES(t,r.BLEND)),o&&(i.blendEquationSeparateiOES(t,n.rgbBlendState.blendMode,n.alphaBlendState.blendMode),e.rgbBlendState.blendMode=n.rgbBlendState.blendMode,e.alphaBlendState.blendMode=n.alphaBlendState.blendMode),a&&(i.blendFuncSeparateiOES(t,n.rgbBlendState.blendSrcFactor,n.rgbBlendState.blendDstFactor,n.alphaBlendState.blendSrcFactor,n.alphaBlendState.blendDstFactor),e.rgbBlendState.blendSrcFactor=n.rgbBlendState.blendSrcFactor,e.alphaBlendState.blendSrcFactor=n.alphaBlendState.blendSrcFactor,e.rgbBlendState.blendDstFactor=n.rgbBlendState.blendDstFactor,e.alphaBlendState.blendDstFactor=n.alphaBlendState.blendDstFactor)},e.applyAttachmentState=function(t,e){var n=this.gl,r=(t.channelWriteMask!==e.channelWriteMask&&(n.colorMask(!!(e.channelWriteMask&Cf.Red),!!(e.channelWriteMask&Cf.Green),!!(e.channelWriteMask&Cf.Blue),!!(e.channelWriteMask&Cf.Alpha)),t.channelWriteMask=e.channelWriteMask),t.rgbBlendState.blendMode!==e.rgbBlendState.blendMode||t.alphaBlendState.blendMode!==e.alphaBlendState.blendMode),i=t.rgbBlendState.blendSrcFactor!==e.rgbBlendState.blendSrcFactor||t.alphaBlendState.blendSrcFactor!==e.alphaBlendState.blendSrcFactor||t.rgbBlendState.blendDstFactor!==e.rgbBlendState.blendDstFactor||t.alphaBlendState.blendDstFactor!==e.alphaBlendState.blendDstFactor;(i||r)&&(Um(t.rgbBlendState)&&Um(t.alphaBlendState)?n.enable(n.BLEND):Um(e.rgbBlendState)&&Um(e.alphaBlendState)&&n.disable(n.BLEND)),r&&(n.blendEquationSeparate(e.rgbBlendState.blendMode,e.alphaBlendState.blendMode),t.rgbBlendState.blendMode=e.rgbBlendState.blendMode,t.alphaBlendState.blendMode=e.alphaBlendState.blendMode),i&&(n.blendFuncSeparate(e.rgbBlendState.blendSrcFactor,e.rgbBlendState.blendDstFactor,e.alphaBlendState.blendSrcFactor,e.alphaBlendState.blendDstFactor),t.rgbBlendState.blendSrcFactor=e.rgbBlendState.blendSrcFactor,t.alphaBlendState.blendSrcFactor=e.alphaBlendState.blendSrcFactor,t.rgbBlendState.blendDstFactor=e.rgbBlendState.blendDstFactor,t.alphaBlendState.blendDstFactor=e.alphaBlendState.blendDstFactor)},e.setMegaState=function(t){var e=this.gl,n=this.currentMegaState;if(null!==this.OES_draw_buffers_indexed)for(var r=0;r<t.attachmentsState.length;r++)this.applyAttachmentStateIndexed(r,n.attachmentsState[0],t.attachmentsState[0]);else T(1===t.attachmentsState.length),this.applyAttachmentState(n.attachmentsState[0],t.attachmentsState[0]);Xf(n.blendConstant,t.blendConstant)||(e.blendColor(t.blendConstant.r,t.blendConstant.g,t.blendConstant.b,t.blendConstant.a),Yf(n.blendConstant,t.blendConstant)),n.depthCompare!==t.depthCompare&&(e.depthFunc(t.depthCompare),n.depthCompare=t.depthCompare),n.depthWrite!==t.depthWrite&&(e.depthMask(t.depthWrite),n.depthWrite=t.depthWrite),n.stencilWrite!==t.stencilWrite&&(e.stencilMask(t.stencilWrite?255:0),n.stencilWrite=t.stencilWrite),n.stencilPassOp!==t.stencilPassOp&&(e.stencilOp(e.KEEP,e.KEEP,t.stencilPassOp),n.stencilPassOp=t.stencilPassOp),n.stencilRef===t.stencilRef&&n.stencilCompare===t.stencilCompare||(n.stencilCompare=t.stencilCompare,this.setStencilRef(t.stencilRef)),n.cullMode!==t.cullMode&&(n.cullMode===vf.None?e.enable(e.CULL_FACE):t.cullMode===vf.None&&e.disable(e.CULL_FACE),t.cullMode===vf.Back?e.cullFace(e.BACK):t.cullMode===vf.Front?e.cullFace(e.FRONT):t.cullMode===vf.FrontAndBack&&e.cullFace(e.FRONT_AND_BACK),n.cullMode=t.cullMode),n.frontFace!==t.frontFace&&(e.frontFace(t.frontFace),n.frontFace=t.frontFace),n.polygonOffset!==t.polygonOffset&&(t.polygonOffset?(e.polygonOffset(1,1),e.enable(e.POLYGON_OFFSET_FILL)):e.disable(e.POLYGON_OFFSET_FILL),n.polygonOffset=t.polygonOffset)},e.validatePipelineFormats=function(t){for(var e=0;e<this.currentColorAttachments.length;e++){var n=this.currentColorAttachments[e];null!==n&&T(n.pixelFormat===t.colorAttachmentFormats[e])}null!==this.currentDepthStencilAttachment&&T(this.currentDepthStencilAttachment.pixelFormat===t.depthStencilAttachmentFormat),-1!==this.currentSampleCount&&T(this.currentSampleCount===t.sampleCount)},e.setPipeline=function(t){this.currentPipeline=t,this.validatePipelineFormats(this.currentPipeline),this.setMegaState(this.currentPipeline.megaState);t=this.currentPipeline.program;if(this.useProgram(t),t.compileState===Wm.NeedsBind){var e=this.gl,n=t.gl_program,r=t.descriptor,i=Fm(r.preprocessedVert,/uniform (\w+) {([^]*?)}/g);if(A(e))for(var o=0;o<i.length;o++){var a=i[o][1],a=e.getUniformBlockIndex(n,a);-1!==a&&4294967295!==a&&e.uniformBlockBinding(n,a,o)}for(var s=Fm(r.preprocessedVert,/^uniform .*sampler\S+ (\w+);\s* \/\/ BINDING=(\d+)$/gm),l=0;l<s.length;l++){var u=s[l],c=u[1],u=u[2],c=e.getUniformLocation(n,c);e.uniform1i(c,parseInt(u))}t.compileState=Wm.ReadyToUse}},e.setInputState=function(t){this.currentInputState=t,null!==this.currentInputState?(T(this.currentPipeline.inputLayout===this.currentInputState.inputLayout),this.bindVAO(this.currentInputState.vao)):(T(null===this.currentPipeline.inputLayout),this.bindVAO(null))},e.setStencilRef=function(t){this.currentStencilRef!==t&&(this.currentStencilRef=t,this.applyStencil())},e.draw=function(t,e){var n=this.gl,r=this.currentPipeline;n.drawArrays(r.drawMode,e,t),this.debugGroupStatisticsDrawCall(),this.debugGroupStatisticsTriangles(t/3)},e.drawIndexed=function(t,e){var n=this.gl,r=this.currentPipeline,i=this.currentInputState,e=Hf(i.indexBufferByteOffset)+e*Hf(i.indexBufferCompByteSize);n.drawElements(r.drawMode,t,Hf(i.indexBufferType),e),this.debugGroupStatisticsDrawCall(),this.debugGroupStatisticsTriangles(t/3)},e.drawIndexedInstanced=function(t,e,n){var r=this.gl,i=this.currentPipeline,o=this.currentInputState,e=Hf(o.indexBufferByteOffset)+e*Hf(o.indexBufferCompByteSize),i=[i.drawMode,t,Hf(o.indexBufferType),e,n];A(r)?r.drawElementsInstanced.apply(r,i):(o=this.ANGLE_instanced_arrays).drawElementsInstancedANGLE.apply(o,i),this.debugGroupStatisticsDrawCall(),this.debugGroupStatisticsTriangles(t/3*n)},e.beginOcclusionQuery=function(t){var e,n=this.gl;A(n)&&(e=this.currentRenderPassDescriptor.occlusionQueryPool,n.beginQuery(e.gl_query_type,e.gl_query[t]))},e.endOcclusionQuery=function(t){var e,n=this.gl;A(n)&&(e=this.currentRenderPassDescriptor.occlusionQueryPool,n.endQuery(e.gl_query_type))},e.beginDebugGroup=function(t){},e.endDebugGroup=function(){},e.pipelineQueryReady=function(t){return this.queryProgramReady(t.program)},e.pipelineForceReady=function(t){},e.endPass=function(){for(var t=this.gl,e=!1,n=0;n<this.currentColorAttachments.length;n++){var r,i,o=this.currentColorAttachments[n];null!==o&&(i=!1,null!==(r=this.currentColorResolveTos[n])&&(T(o.width===r.width&&o.height===r.height),T(o.pixelFormat===r.pixelFormat),this.setScissorEnabled(!1),A(t)&&t.bindFramebuffer(t.READ_FRAMEBUFFER,this.resolveColorReadFramebuffer),this.resolveColorAttachmentsChanged&&A(t)&&this.bindFramebufferAttachment(t.READ_FRAMEBUFFER,t.COLOR_ATTACHMENT0,o),i=!0,r===this.scTexture?t.bindFramebuffer(A(t)?w.DRAW_FRAMEBUFFER:w.FRAMEBUFFER,this.scPlatformFramebuffer):(t.bindFramebuffer(A(t)?w.DRAW_FRAMEBUFFER:w.FRAMEBUFFER,this.resolveColorDrawFramebuffer),this.resolveColorAttachmentsChanged&&t.framebufferTexture2D(A(t)?w.DRAW_FRAMEBUFFER:w.FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,r.gl_texture,0)),A(t)?(t.blitFramebuffer(0,0,o.width,o.height,0,0,r.width,r.height,t.COLOR_BUFFER_BIT,t.LINEAR),t.bindFramebuffer(t.DRAW_FRAMEBUFFER,null)):this.submitBlitRenderPass(o,r),e=!0),this.currentRenderPassDescriptor.colorStore[n]||(i||(t.bindFramebuffer(A(t)?w.READ_FRAMEBUFFER:w.FRAMEBUFFER,this.resolveColorReadFramebuffer),this.resolveColorAttachmentsChanged&&this.bindFramebufferAttachment(A(t)?w.READ_FRAMEBUFFER:w.FRAMEBUFFER,t.COLOR_ATTACHMENT0,o)),A(t)&&t.invalidateFramebuffer(t.READ_FRAMEBUFFER,[t.COLOR_ATTACHMENT0])),t.bindFramebuffer(A(t)?w.READ_FRAMEBUFFER:w.FRAMEBUFFER,null))}this.resolveColorAttachmentsChanged=!1;var a,s,l=this.currentDepthStencilAttachment;null!==l&&(s=!1,null!==(a=this.currentDepthStencilResolveTo)&&(T(l.width===a.width&&l.height===a.height),this.setScissorEnabled(!1),t.bindFramebuffer(A(t)?w.READ_FRAMEBUFFER:w.FRAMEBUFFER,this.resolveDepthStencilReadFramebuffer),t.bindFramebuffer(A(t)?w.DRAW_FRAMEBUFFER:w.FRAMEBUFFER,this.resolveDepthStencilDrawFramebuffer),this.resolveDepthStencilAttachmentsChanged&&(this.bindFramebufferDepthStencilAttachment(A(t)?w.READ_FRAMEBUFFER:w.FRAMEBUFFER,l),this.bindFramebufferDepthStencilAttachment(A(t)?w.DRAW_FRAMEBUFFER:w.FRAMEBUFFER,a)),s=!0,A(t)&&t.blitFramebuffer(0,0,l.width,l.height,0,0,a.width,a.height,t.DEPTH_BUFFER_BIT,t.NEAREST),t.bindFramebuffer(A(t)?w.DRAW_FRAMEBUFFER:w.FRAMEBUFFER,null),e=!0),this.currentRenderPassDescriptor.depthStencilStore||(s||(t.bindFramebuffer(A(t)?w.READ_FRAMEBUFFER:w.FRAMEBUFFER,this.resolveDepthStencilReadFramebuffer),this.resolveDepthStencilAttachmentsChanged&&this.bindFramebufferDepthStencilAttachment(A(t)?w.READ_FRAMEBUFFER:w.FRAMEBUFFER,l),s=!0),A(t)&&t.invalidateFramebuffer(t.READ_FRAMEBUFFER,[t.DEPTH_STENCIL_ATTACHMENT])),s&&t.bindFramebuffer(A(t)?w.READ_FRAMEBUFFER:w.FRAMEBUFFER,null),this.resolveDepthStencilAttachmentsChanged=!1),e||t.bindFramebuffer(A(t)?w.DRAW_FRAMEBUFFER:w.FRAMEBUFFER,null)},e.setScissorEnabled=function(t){var e;this.currentScissorEnabled!==t&&(e=this.gl,t?e.enable(e.SCISSOR_TEST):e.disable(e.SCISSOR_TEST),this.currentScissorEnabled=t)},e.applyStencil=function(){null!==this.currentStencilRef&&this.gl.stencilFunc(this.currentMegaState.stencilCompare,this.currentStencilRef,255)},e.getFallbackTexture=function(t){var e=t.gl_target,t=t.formatKind;if(e===w.TEXTURE_2D)return t===Of.Depth?this.fallbackTexture2DDepth:this.fallbackTexture2D;if(e===w.TEXTURE_2D_ARRAY)return this.fallbackTexture2DArray;if(e===w.TEXTURE_3D)return this.fallbackTexture3D;if(e===w.TEXTURE_CUBE_MAP)return this.fallbackTextureCube;throw new Error("whoops")},e.submitBlitRenderPass=function(t,e){this.blitRenderPipeline||(n=Xg(this,wf.VERTEX|wf.COPY_DST,new Float32Array([-4,-4,4,-4,0,4]).buffer),r=this.createInputLayout({vertexBufferDescriptors:[{byteStride:8,frequency:Af.PerVertex}],vertexAttributeDescriptors:[{format:S.F32_RG,bufferIndex:0,bufferByteOffset:0,location:0}],indexBufferFormat:null}),i=[{numSamplers:1,numUniformBuffers:0}],o=this.createProgram(xm({},Qp(this,new vm),{ensurePreprocessed:function(){},associate:function(){}})),this.blitInputState=this.createInputState(r,[{buffer:n,byteOffset:0}],null,o),this.blitRenderPipeline=this.createRenderPipeline({topology:Sf.Triangles,sampleCount:1,program:o,bindingLayouts:i,colorAttachmentFormats:[S.U8_RGBA_RT],depthStencilAttachmentFormat:null,inputLayout:r,megaStateDescriptor:this.currentMegaState}),this.blitBindings=this.createBindings({bindingLayout:i[0],samplerBindings:[{sampler:null,texture:t.texture,lateBinding:null}],uniformBufferBindings:[]}),o.setUniforms({u_Texture:t}));var n=this.currentRenderPassDescriptor,r=(this.currentRenderPassDescriptor=null,this.inBlitRenderPass=!0,this.createRenderPass({colorAttachment:[t],colorResolveTo:[e],colorClearColor:[$f],colorStore:[!0],depthStencilAttachment:null,depthStencilResolveTo:null,depthStencilStore:!0,depthClearValue:"load",stencilClearValue:"load",occlusionQueryPool:null})),i=this.getCanvas(),o=i.width,t=i.height;r.setPipeline(this.blitRenderPipeline),r.setBindings(0,this.blitBindings,[0]),r.setInputState(this.blitInputState),r.setViewport(0,0,o,t),this.gl.disable(this.gl.BLEND),r.draw(3,0),this.gl.enable(this.gl.BLEND),this.currentRenderPassDescriptor=n,this.inBlitRenderPass=!1},t}(),nv=function(){function t(t){this.pluginOptions=void 0,this.pluginOptions=t}return t.prototype.createSwapChain=function(){var e=bm(Em().mark(function t(e){var n,r,i;return Em().wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return n={antialias:!1,preserveDrawingBuffer:!1,stencil:!0},r=this.pluginOptions.targets,!(i=r.includes("webgl2")?e.getContext("webgl2",n)||e.getContext("experimental-webgl2",n):i)&&r.includes("webgl1")&&(i=e.getContext("webgl",n)||e.getContext("experimental-webgl",n)),t.abrupt("return",new ev(i,{shaderDebug:!0,trackResources:!0}));case 5:case"end":return t.stop()}},t,this)}));return function(t){return e.apply(this,arguments)}}(),t}(),rv=function(n){function t(t){var e=n.call(this)||this;return e.options=void 0,e.name="webgl-device",e.options=t,e}Sm(t,n);var e=t.prototype;return e.init=function(){this.context.deviceContribution=new nv(xm({},this.options))},e.destroy=function(){delete this.context.deviceContribution},t}(Ws);function iv(){iv=function(){return a};var a={},t=Object.prototype,l=t.hasOwnProperty,u=Object.defineProperty||function(t,e,n){t[e]=n.value},e="function"==typeof Symbol?Symbol:{},r=e.iterator||"@@iterator",n=e.asyncIterator||"@@asyncIterator",i=e.toStringTag||"@@toStringTag";function o(t,e,n){return Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{o({},"")}catch(t){o=function(t,e,n){return t[e]=n}}function s(t,e,n,r){var i,o,a,s,e=e&&e.prototype instanceof d?e:d,e=Object.create(e.prototype),r=new b(r||[]);return u(e,"_invoke",{value:(i=t,o=n,a=r,s="suspendedStart",function(t,e){if("executing"===s)throw new Error("Generator is already running");if("completed"===s){if("throw"===t)throw e;return S()}for(a.method=t,a.arg=e;;){var n=a.delegate;if(n){n=function t(e,n){var r=n.method,i=e.iterator[r];if(void 0===i)return n.delegate=null,"throw"===r&&e.iterator.return&&(n.method="return",n.arg=void 0,t(e,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),h;r=c(i,e.iterator,n.arg);if("throw"===r.type)return n.method="throw",n.arg=r.arg,n.delegate=null,h;i=r.arg;return i?i.done?(n[e.resultName]=i.value,n.next=e.nextLoc,"return"!==n.method&&(n.method="next",n.arg=void 0),n.delegate=null,h):i:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,h)}(n,a);if(n){if(n===h)continue;return n}}if("next"===a.method)a.sent=a._sent=a.arg;else if("throw"===a.method){if("suspendedStart"===s)throw s="completed",a.arg;a.dispatchException(a.arg)}else"return"===a.method&&a.abrupt("return",a.arg);s="executing";n=c(i,o,a);if("normal"===n.type){if(s=a.done?"completed":"suspendedYield",n.arg===h)continue;return{value:n.arg,done:a.done}}"throw"===n.type&&(s="completed",a.method="throw",a.arg=n.arg)}})}),e}function c(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(t){return{type:"throw",arg:t}}}a.wrap=s;var h={};function d(){}function f(){}function p(){}var e={},g=(o(e,r,function(){return this}),Object.getPrototypeOf),g=g&&g(g(x([]))),m=(g&&g!==t&&l.call(g,r)&&(e=g),p.prototype=d.prototype=Object.create(e));function v(t){["next","throw","return"].forEach(function(e){o(t,e,function(t){return this._invoke(e,t)})})}function y(a,s){var e;u(this,"_invoke",{value:function(n,r){function t(){return new s(function(t,e){!function e(t,n,r,i){var o,t=c(a[t],a,n);if("throw"!==t.type)return(n=(o=t.arg).value)&&"object"==typeof n&&l.call(n,"__await")?s.resolve(n.__await).then(function(t){e("next",t,r,i)},function(t){e("throw",t,r,i)}):s.resolve(n).then(function(t){o.value=t,r(o)},function(t){return e("throw",t,r,i)});i(t.arg)}(n,r,t,e)})}return e=e?e.then(t,t):t()}})}function E(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function _(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function b(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(E,this),this.reset(!0)}function x(e){if(e){var n,t=e[r];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length))return n=-1,(t=function t(){for(;++n<e.length;)if(l.call(e,n))return t.value=e[n],t.done=!1,t;return t.value=void 0,t.done=!0,t}).next=t}return{next:S}}function S(){return{value:void 0,done:!0}}return u(m,"constructor",{value:f.prototype=p,configurable:!0}),u(p,"constructor",{value:f,configurable:!0}),f.displayName=o(p,i,"GeneratorFunction"),a.isGeneratorFunction=function(t){t="function"==typeof t&&t.constructor;return!!t&&(t===f||"GeneratorFunction"===(t.displayName||t.name))},a.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,p):(t.__proto__=p,o(t,i,"GeneratorFunction")),t.prototype=Object.create(m),t},a.awrap=function(t){return{__await:t}},v(y.prototype),o(y.prototype,n,function(){return this}),a.AsyncIterator=y,a.async=function(t,e,n,r,i){void 0===i&&(i=Promise);var o=new y(s(t,e,n,r),i);return a.isGeneratorFunction(e)?o:o.next().then(function(t){return t.done?t.value:o.next()})},v(m),o(m,i,"Generator"),o(m,r,function(){return this}),o(m,"toString",function(){return"[object Generator]"}),a.keys=function(t){var e,n=Object(t),r=[];for(e in n)r.push(e);return r.reverse(),function t(){for(;r.length;){var e=r.pop();if(e in n)return t.value=e,t.done=!1,t}return t.done=!0,t}},a.values=x,b.prototype={constructor:b,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(_),!t)for(var e in this)"t"===e.charAt(0)&&l.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=void 0)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(n){if(this.done)throw n;var r=this;function t(t,e){return o.type="throw",o.arg=n,r.next=t,e&&(r.method="next",r.arg=void 0),!!e}for(var e=this.tryEntries.length-1;0<=e;--e){var i=this.tryEntries[e],o=i.completion;if("root"===i.tryLoc)return t("end");if(i.tryLoc<=this.prev){var a=l.call(i,"catchLoc"),s=l.call(i,"finallyLoc");if(a&&s){if(this.prev<i.catchLoc)return t(i.catchLoc,!0);if(this.prev<i.finallyLoc)return t(i.finallyLoc)}else if(a){if(this.prev<i.catchLoc)return t(i.catchLoc,!0)}else{if(!s)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return t(i.finallyLoc)}}}},abrupt:function(t,e){for(var n=this.tryEntries.length-1;0<=n;--n){var r=this.tryEntries[n];if(r.tryLoc<=this.prev&&l.call(r,"finallyLoc")&&this.prev<r.finallyLoc){var i=r;break}}var o=(i=i&&("break"===t||"continue"===t)&&i.tryLoc<=e&&e<=i.finallyLoc?null:i)?i.completion:{};return o.type=t,o.arg=e,i?(this.method="next",this.next=i.finallyLoc,h):this.complete(o)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),h},finish:function(t){for(var e=this.tryEntries.length-1;0<=e;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),_(n),h}},catch:function(t){for(var e=this.tryEntries.length-1;0<=e;--e){var n,r,i=this.tryEntries[e];if(i.tryLoc===t)return"throw"===(n=i.completion).type&&(r=n.arg,_(i)),r}throw new Error("illegal catch attempt")},delegateYield:function(t,e,n){return this.delegate={iterator:x(t),resultName:e,nextLoc:n},"next"===this.method&&(this.arg=void 0),h}},a}function ov(t,e,n,r,i,o,a){try{var s=t[o](a),l=s.value}catch(t){return void n(t)}s.done?e(l):Promise.resolve(l).then(r,i)}function av(s){return function(){var t=this,a=arguments;return new Promise(function(e,n){var r=s.apply(t,a);function i(t){ov(r,e,n,i,o,"next",t)}function o(t){ov(r,e,n,i,o,"throw",t)}i(void 0)})}}function sv(t,e){t.prototype=Object.create(e.prototype),lv(t.prototype.constructor=t,e)}function lv(t,e){return(lv=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t})(t,e)}var uv=function(){function t(t){this.$container=void 0,this.$canvas=void 0,this.dpr=void 0,this.canvasConfig=void 0,this.deviceRendererPlugin=void 0,this.canvasConfig=t.config,this.deviceRendererPlugin=t.deviceRendererPlugin}var e=t.prototype;return e.init=function(){var t=av(iv().mark(function t(){var e,n;return iv().wrap(function(t){for(;;)switch(t.prev=t.next){case 0:n=this.canvasConfig,e=n.container,(n=n.canvas)?(this.$canvas=n,e&&n.parentElement!==e&&e.appendChild(n),this.$container=n.parentElement,this.canvasConfig.container=this.$container):e&&(this.$container=Fe(e)?document.getElementById(e):e,this.$container)&&(n=document.createElement("canvas"),this.$container.appendChild(n),this.$container.style.position||(this.$container.style.position="relative"),this.$canvas=n),this.resize(this.canvasConfig.width,this.canvasConfig.height);case 3:case"end":return t.stop()}},t,this)}));return function(){return t.apply(this,arguments)}}(),e.getDomElement=function(){return this.$canvas},e.getContext=function(){return this.deviceRendererPlugin.getDevice().gl},e.getBoundingClientRect=function(){if(this.$canvas.getBoundingClientRect)return this.$canvas.getBoundingClientRect()},e.destroy=function(){this.$container&&this.$canvas&&this.$canvas.parentNode&&this.$container.removeChild(this.$canvas)},e.resize=function(t,e){var n=1<=(n=this.canvasConfig.devicePixelRatio||Ur&&window.devicePixelRatio||1)?Math.ceil(n):1;this.dpr=n,this.$canvas&&(n=this.getDPR(),this.$canvas.width=n*t,this.$canvas.height=n*e,jr(this.$canvas,t,e))},e.getDPR=function(){return this.dpr},e.applyCursorStyle=function(t){this.$container&&this.$container.style&&(this.$container.style.cursor=t)},e.toDataURL=function(){var e=av(iv().mark(function t(e){return iv().wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return void 0===e&&(e={}),t.abrupt("return",this.deviceRendererPlugin.toDataURL(e));case 2:case"end":return t.stop()}},t,this)}));return function(t){return e.apply(this,arguments)}}(),t}(),cv=function(n){function t(t){var e=n.call(this)||this;return e.rendererPlugin=void 0,e.name="webgl-context-register",e.rendererPlugin=t,e}sv(t,n);var e=t.prototype;return e.init=function(){this.context.ContextService=uv,this.context.deviceRendererPlugin=this.rendererPlugin},e.destroy=function(){delete this.context.ContextService},t}(Ws),hv=function(r){function t(t){var e=r.call(this,t)||this,n=new ym;return e.registerPlugin(new cv(n)),e.registerPlugin(new Th),e.registerPlugin(new rv(null!=t&&t.targets?{targets:t.targets}:{targets:["webgl2","webgl1"]})),e.registerPlugin(n),e.registerPlugin(new hh),e.registerPlugin(new vh),e}return sv(t,r),t}(Gs);function dv(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,function(t){t=function(t,e){if("object"!=typeof t||null===t)return t;var n=t[Symbol.toPrimitive];if(void 0===n)return("string"===e?String:Number)(t);n=n.call(t,e||"default");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}(t,"string");return"symbol"==typeof t?t:String(t)}(r.key),r)}}function fv(t,e,n){e&&dv(t.prototype,e),n&&dv(t,n),Object.defineProperty(t,"prototype",{writable:!1})}function pv(){return(pv=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n,r=arguments[e];for(n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t}).apply(this,arguments)}function gv(t,e){t.prototype=Object.create(e.prototype),mv(t.prototype.constructor=t,e)}function mv(t,e){return(mv=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t})(t,e)}function vv(t,e){if(null==t)return{};for(var n,r={},i=Object.keys(t),o=0;o<i.length;o++)n=i[o],0<=e.indexOf(n)||(r[n]=t[n]);return r}var yv,Ev,ks=function(n){function t(t,e){return(t=n.call(this,t,e=void 0===e?{}:e)||this).topology=void 0,t.flipYMatrix=dt(K(),x(1,-1,1)),t.topology=t.createTopology(),t}gv(t,n);var e=t.prototype;return e.applyMa4Position=function(t,e){for(var n=Vt(),r=0;r<e.byteLength/4;r+=3)n[0]=e[r],n[1]=e[r+1],n[2]=e[r+2],n[3]=1,jt(n,n,t),e[r]=n[0],e[r+1]=n[1],e[r+2]=n[2];this.updateVertexBuffer(Qg.POSITION,Jg.POSITION,0,new Uint8Array(e.buffer))},e.applyMa4Normal=function(t,e){var n=Vt(),r=$(K(),t);et(r,r),tt(r,r);for(var i=0;i<e.byteLength/4;i+=3)n[0]=e[i],n[1]=e[i+1],n[2]=e[i+2],n[3]=1,jt(n,n,r),e[i]=n[0],e[i+1]=n[1],e[i+2]=n[2];this.updateVertexBuffer(Qg.NORMAL,Jg.NORMAL,0,new Uint8Array(e.buffer))},e.rebuildPosition=function(){this.topology=this.createTopology();var t=Float32Array.from(this.topology.positions);this.applyMa4Position(this.flipYMatrix,t),this.dirty=!0},e.applyMat4=function(t){this.applyMa4Position(t,this.vertices[Qg.POSITION]),this.applyMa4Normal(t,this.vertices[Qg.NORMAL])},e.computeBoundingBox=function(){for(var t=this.topology.positions,e=-1/0,n=-1/0,r=-1/0,i=1/0,o=1/0,a=1/0,s=0;s<t.length;s+=3)var l=t[s],u=t[s+1],c=t[s+2],e=Math.max(e,l),n=Math.max(n,u),r=Math.max(r,c),i=Math.min(i,l),o=Math.min(o,u),a=Math.min(a,c);var h=new Ta;return h.setMinMax([i,o,a],[e,n,r]),h},e.build=function(){var t=this.topology,e=t.indices,n=t.positions,r=t.normals,t=t.uvs;this.setIndexBuffer(new Uint32Array(e)),this.vertexCount=e.length,this.setVertexBuffer({bufferIndex:Qg.POSITION,byteStride:12,frequency:Af.PerVertex,attributes:[{format:S.F32_RGB,bufferByteOffset:0,location:Jg.POSITION}],data:Float32Array.from(n)}),this.setVertexBuffer({bufferIndex:Qg.NORMAL,byteStride:12,frequency:Af.PerVertex,attributes:[{format:S.F32_RGB,bufferByteOffset:0,location:Jg.NORMAL}],data:Float32Array.from(r)}),this.setVertexBuffer({bufferIndex:Qg.UV,byteStride:8,frequency:Af.PerVertex,attributes:[{format:S.F32_RG,bufferByteOffset:0,location:Jg.UV}],data:Float32Array.from(t)}),this.applyMat4(this.flipYMatrix),this.dirty=!0},t}(Kg),E=function(n){function t(t,e){return n.call(this,t,pv({width:1,height:1,depth:1,widthSegments:1,heightSegments:1,depthSegments:1},e=void 0===e?{}:e))||this}return gv(t,n),t.prototype.createTopology=function(){function t(t,e,n){for(var r,i=0;i<=e;i++)for(r=0;r<=n;r++){var o=y(),a=y(),s=y(),l=y();Dt(o,u[c[t][0]],u[c[t][1]],i/e),Dt(a,u[c[t][0]],u[c[t][2]],r/n),Ut(s,a,u[c[t][0]]),Ct(l,o,s),a=i/e,o=r/n,d.push(l[0],l[1],l[2]),f.push(h[t][0],h[t][1],h[t][2]),p.push(a,1-o),a=.875*(a/=3)+4/64,o=.875*(o/=3)+4/64,a+=t%3/3,o+=Math.floor(t/3)/3,g.push(a,1-o),i<e&&r<n&&(m.push(v+n+1,v+1,v),m.push(v+n+1,v+n+2,v+1)),v++}}var e=this.props,n=e.widthSegments,r=e.heightSegments,i=e.depthSegments,o=e.height,a=e.width,e=e.depth,n=void 0===n?1:n,r=void 0===r?1:r,i=void 0===i?1:i,a=(void 0===a?1:a)/2,o=(void 0===o?1:o)/2,e=(void 0===e?1:e)/2,u=[x(-a,-o,e),x(a,-o,e),x(a,o,e),x(-a,o,e),x(a,-o,-e),x(-a,-o,-e),x(-a,o,-e),x(a,o,-e)],c=[[0,1,3],[4,5,7],[3,2,6],[1,0,4],[1,4,2],[5,0,6]],h=[[0,0,1],[0,0,-1],[0,1,0],[0,-1,0],[1,0,0],[-1,0,0]],a=1,o=2,e=3,s=4,l=5,d=[],f=[],p=[],g=[],m=[],v=0;return t(0,n,r),t(a,n,r),t(o,n,i),t(e,n,i),t(s,i,r),t(l,i,r),{indices:m,positions:d,normals:f,uvs:p,uv1s:g}},fv(t,[{key:"width",get:function(){return this.props.width},set:function(t){this.props.width!==t&&(this.props.width=t,this.rebuildPosition())}},{key:"height",get:function(){return this.props.height},set:function(t){this.props.height!==t&&(this.props.height=t,this.rebuildPosition())}},{key:"depth",get:function(){return this.props.depth},set:function(t){this.props.depth!==t&&(this.props.depth=t,this.rebuildPosition())}},{key:"widthSegments",get:function(){return this.props.widthSegments},set:function(t){this.props.widthSegments!==t&&(this.props.widthSegments=t,this.build())}},{key:"heightSegments",get:function(){return this.props.heightSegments},set:function(t){this.props.heightSegments!==t&&(this.props.heightSegments=t,this.build())}},{key:"depthSegments",get:function(){return this.props.depthSegments},set:function(t){this.props.depthSegments!==t&&(this.props.depthSegments=t,this.build())}}]),t}(ks),i=function(n){function t(t,e){return n.call(this,t,pv({radius:.5,latitudeBands:16,longitudeBands:16},e=void 0===e?{}:e))||this}return gv(t,n),t.prototype.createTopology=function(){for(var t,e,n,r,i,o,a,s,l,u,c,h=this.props,d=h.radius,f=void 0===d?.5:d,d=h.latitudeBands,p=void 0===d?16:d,d=h.longitudeBands,g=void 0===d?16:d,m=[],v=[],y=[],E=[],_=0;_<=p;_++)for(e=_*Math.PI/p,n=Math.sin(e),r=Math.cos(e),t=0;t<=g;t++)a=2*t*Math.PI/g-Math.PI/2,l=Math.sin(a),a=Math.cos(a),u=1-t/g,c=1-_/p,m.push((a=a*n)*f,(s=r)*f,(l=l*n)*f),v.push(a,s,l),y.push(u,1-c);for(_=0;_<p;++_)for(t=0;t<g;++t)E.push((i=_*(g+1)+t)+1,o=i+g+1,i),E.push(i+1,o+1,o);return{indices:E,positions:m,normals:v,uvs:y,uv1s:y}},fv(t,[{key:"radius",get:function(){return this.props.radius},set:function(t){this.props.radius!==t&&(this.props.radius=t,this.build())}},{key:"latitudeBands",get:function(){return this.props.latitudeBands},set:function(t){this.props.latitudeBands!==t&&(this.props.latitudeBands=t,this.build())}},{key:"longitudeBands",get:function(){return this.props.longitudeBands},set:function(t){this.props.longitudeBands!==t&&(this.props.longitudeBands=t,this.build())}}]),t}(ks),n=function(n){function t(t,e){return n.call(this,t,pv({width:1,depth:1,widthSegments:5,depthSegments:5},e=void 0===e?{}:e))||this}return gv(t,n),t.prototype.createTopology=function(){for(var t,e,n,r=[],i=[],o=[],a=[],s=this.props,l=s.widthSegments,u=s.depthSegments,c=s.width,s=s.depth,h=(void 0===c?1:c)/2,d=(void 0===s?1:s)/2,f=void 0===l?5:l,p=void 0===u?5:u,g=0,m=0;m<=f;m++)for(t=0;t<=p;t++)e=m/f,n=t/p,r.push(2*h*m/f-h,0,-(2*d*t/p-d)),i.push(0,1,0),o.push(e,1-n),m<f&&t<p&&(a.push(g+p+1,g+1,g),a.push(g+p+1,g+p+2,g+1)),g++;return{indices:a,positions:r,normals:i,uvs:o,uv1s:o}},fv(t,[{key:"width",get:function(){return this.props.width},set:function(t){this.props.width!==t&&(this.props.width=t,this.rebuildPosition())}},{key:"depth",get:function(){return this.props.depth},set:function(t){this.props.depth!==t&&(this.props.depth=t,this.rebuildPosition())}},{key:"widthSegments",get:function(){return this.props.widthSegments},set:function(t){this.props.widthSegments!==t&&(this.props.widthSegments=t,this.build())}},{key:"depthSegments",get:function(){return this.props.depthSegments},set:function(t){this.props.depthSegments!==t&&(this.props.depthSegments=t,this.build())}}]),t}(ks),_v=["style"],bv=function(n){function t(t){var t=void 0===t?{}:t,e=t.style,t=vv(t,_v),e=n.call(this,pv({style:pv({fill:"black"},e)},t))||this;return e.define="NUM_AMBIENT_LIGHTS",e.order=-1,e}return gv(t,n),t.prototype.uploadUBO=function(t,e){var n=this.parsedStyle.fill;To(n)&&(n=[Number(n.r)/255,Number(n.g)/255,Number(n.b)/255],t.push({name:"u_AmbientLightColor",value:n}))},t}(Ug),xv=["style"],Sv=function(n){function t(t){var t=void 0===t?{}:t,e=t.style,t=vv(t,xv),e=n.call(this,pv({style:pv({direction:x(0,-1,0)},e)},t))||this;return e.define="NUM_DIR_LIGHTS",e.order=10,e}gv(t,n);var e=t.prototype;return e.getUniformWordCount=function(){return 8},e.uploadUBO=function(t,e){var n=this.parsedStyle,r=n.fill,i=n.direction,n=n.intensity;To(r)&&(r=[Number(r.r)/255,Number(r.g)/255,Number(r.b)/255],t.push({name:"directionalLights["+e+"].direction",value:i}),t.push({name:"directionalLights["+e+"].intensity",value:n}),t.push({name:"directionalLights["+e+"].color",value:r}))},t}(Ug),wv=((mT=yv=yv||{}).MAP="u_Map",mT.PLACE_HOLDER="u_Placeholder",function(r){function t(t,e){var t=r.call(this,t,pv({vertexShader:"#define GLSLIFY 1\nlayout(std140) uniform ub_SceneParams {\n mat4 u_ProjectionMatrix;\n mat4 u_ViewMatrix;\n vec3 u_CameraPosition;\n float u_DevicePixelRatio;\n vec2 u_Viewport;\n float u_IsOrtho;\n float u_IsPicking;\n};\nlayout(std140) uniform ub_MaterialParams {\n #ifdef USE_WIREFRAME\n vec3 u_WireframeLineColor;\n float u_WireframeLineWidth;\n #endif\n\n #ifdef USE_FOG\n vec4 u_FogInfos;\n vec3 u_FogColor;\n #endif\n\n vec4 u_Placeholder;\n};\n\nlayout(location = MODEL_MATRIX0) in vec4 a_ModelMatrix0;\nlayout(location = MODEL_MATRIX1) in vec4 a_ModelMatrix1;\nlayout(location = MODEL_MATRIX2) in vec4 a_ModelMatrix2;\nlayout(location = MODEL_MATRIX3) in vec4 a_ModelMatrix3;\nlayout(location = COLOR) in vec4 a_Color;\nlayout(location = STROKE_COLOR) in vec4 a_StrokeColor;\nlayout(location = PACKED_STYLE1) in vec4 a_StylePacked1;\nlayout(location = PACKED_STYLE2) in vec4 a_StylePacked2;\nlayout(location = PICKING_COLOR) in vec4 a_PickingColor;\n\nout vec4 v_PickingResult;\nout vec4 v_Color;\nout vec4 v_StrokeColor;\nout vec4 v_StylePacked1;\nout vec4 v_StylePacked2;\n\n#define COLOR_SCALE 1. / 255.\nvoid setPickingColor(vec3 pickingColor) {\n v_PickingResult.rgb = pickingColor * COLOR_SCALE;\n}\nvec4 project(vec4 pos, mat4 pm, mat4 vm, mat4 mm) {\n return pm * vm * mm * pos;\n}\n\nlayout(location = POSITION) in vec3 a_Position;\n\n#ifdef USE_UV\n layout(location = UV) in vec2 a_Uv;\n out vec2 v_Uv;\n#endif\n\n#ifdef USE_WIREFRAME\n layout(location = BARYCENTRIC) in vec3 a_Barycentric;\n out vec3 v_Barycentric;\n#endif\n\nvoid main() {\n mat4 u_ModelMatrix = mat4(a_ModelMatrix0, a_ModelMatrix1, a_ModelMatrix2, a_ModelMatrix3);\nvec4 u_StrokeColor = a_StrokeColor;\nfloat u_Opacity = a_StylePacked1.x;\nfloat u_FillOpacity = a_StylePacked1.y;\nfloat u_StrokeOpacity = a_StylePacked1.z;\nfloat u_StrokeWidth = a_StylePacked1.w;\nfloat u_ZIndex = a_PickingColor.w;\nvec2 u_Anchor = a_StylePacked2.yz;\nfloat u_IncreasedLineWidthForHitTesting = a_StylePacked2.w;\n\nsetPickingColor(a_PickingColor.xyz);\n\nv_Color = a_Color;\nv_StrokeColor = a_StrokeColor;\nv_StylePacked1 = a_StylePacked1;\nv_StylePacked2 = a_StylePacked2;\n\n#ifdef CLIPSPACE_NEAR_ZERO\n gl_Position.z = gl_Position.z * 0.5 + 0.5;\n#endif\n\n gl_Position = project(vec4(a_Position, 1.0), u_ProjectionMatrix, u_ViewMatrix, u_ModelMatrix);\n\n #ifdef USE_UV\n v_Uv = a_Uv;\n #ifdef VIEWPORT_ORIGIN_TL\n v_Uv.y = 1.0 - v_Uv.y;\n #endif\n#endif\n\n #ifdef USE_WIREFRAME\n v_Barycentric = a_Barycentric;\n#endif\n\n}",fragmentShader:"#define GLSLIFY 1\n#define PI 3.141592653589793\n#define PI2 6.283185307179586\n#define PI_HALF 1.5707963267948966\n#define RECIPROCAL_PI 0.3183098861837907\n#define RECIPROCAL_PI2 0.15915494309189535\n#define EPSILON 1e-6\n\n#ifndef saturate\n #define saturate( a ) clamp( a, 0.0, 1.0 )\n#endif\n#define whiteComplement( a ) ( 1.0 - saturate( a ) )\n\nfloat pow2( const in float x ) { return x*x; }\nfloat pow3( const in float x ) { return x*x*x; }\nfloat pow4( const in float x ) { float x2 = x*x; return x2*x2; }\nfloat max3( const in vec3 v ) { return max( max( v.x, v.y ), v.z ); }\nfloat average( const in vec3 color ) { return dot( color, vec3( 0.3333 ) ); }\n\n// expects values in the range of [0,1]x[0,1], returns values in the [0,1] range.\n// do not collapse into a single function per: http://byteblacksmith.com/improvements-to-the-canonical-one-liner-glsl-rand-for-opengl-es-2-0/\nhighp float rand( const in vec2 uv ) {\n const highp float a = 12.9898, b = 78.233, c = 43758.5453;\n highp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI );\n\n return fract( sin( sn ) * c );\n}\n\nmat3 transposeMat3(mat3 inMatrix) {\n vec3 i0 = inMatrix[0];\n vec3 i1 = inMatrix[1];\n vec3 i2 = inMatrix[2];\n\n mat3 outMatrix = mat3(\n vec3(i0.x, i1.x, i2.x),\n vec3(i0.y, i1.y, i2.y),\n vec3(i0.z, i1.z, i2.z)\n );\n\n return outMatrix;\n}\n\n// https://github.com/glslify/glsl-inverse/blob/master/index.glsl\nmat3 inverseMat3(mat3 inMatrix) {\n float a00 = inMatrix[0][0], a01 = inMatrix[0][1], a02 = inMatrix[0][2];\n float a10 = inMatrix[1][0], a11 = inMatrix[1][1], a12 = inMatrix[1][2];\n float a20 = inMatrix[2][0], a21 = inMatrix[2][1], a22 = inMatrix[2][2];\n\n float b01 = a22 * a11 - a12 * a21;\n float b11 = -a22 * a10 + a12 * a20;\n float b21 = a21 * a10 - a11 * a20;\n\n float det = a00 * b01 + a01 * b11 + a02 * b21;\n\n return mat3(b01, (-a22 * a01 + a02 * a21), (a12 * a01 - a02 * a11),\n b11, (a22 * a00 - a02 * a20), (-a12 * a00 + a02 * a10),\n b21, (-a21 * a00 + a01 * a20), (a11 * a00 - a01 * a10)) / det;\n}\n\nstruct DirectionalLight {\n vec3 direction;\n float intensity;\n vec3 color;\n};\n\nstruct IncidentLight {\n vec3 color;\n vec3 direction;\n bool visible;\n};\n\nstruct ReflectedLight {\n vec3 directDiffuse;\n vec3 directSpecular;\n vec3 indirectDiffuse;\n vec3 indirectSpecular;\n};\n\nstruct GeometricContext {\n vec3 position;\n vec3 normal;\n vec3 viewDir;\n};\nlayout(std140) uniform ub_SceneParams {\n mat4 u_ProjectionMatrix;\n mat4 u_ViewMatrix;\n vec3 u_CameraPosition;\n float u_DevicePixelRatio;\n vec2 u_Viewport;\n float u_IsOrtho;\n float u_IsPicking;\n};\nlayout(std140) uniform ub_MaterialParams {\n #ifdef USE_WIREFRAME\n vec3 u_WireframeLineColor;\n float u_WireframeLineWidth;\n #endif\n\n #ifdef USE_FOG\n vec4 u_FogInfos;\n vec3 u_FogColor;\n #endif\n\n vec4 u_Placeholder;\n};\n\nin vec4 v_PickingResult;\nin vec4 v_Color;\nin vec4 v_StrokeColor;\nin vec4 v_StylePacked1;\nin vec4 v_StylePacked2;\n#ifdef USE_UV\n in vec2 v_Uv;\n#endif\n#ifdef USE_MAP\n uniform sampler2D u_Map;\n#endif\n#ifdef USE_WIREFRAME\n in vec3 v_Barycentric;\n\n float edgeFactor() {\n vec3 d = fwidth(v_Barycentric);\n vec3 a3 = smoothstep(vec3(0.0), d * u_WireframeLineWidth, v_Barycentric);\n return min(min(a3.x, a3.y), a3.z);\n }\n#endif\n\n#ifdef USE_FOG\n #define FOGMODE_NONE 0.\n #define FOGMODE_EXP 1.\n #define FOGMODE_EXP2 2.\n #define FOGMODE_LINEAR 3.\n\n // in float v_FogDepth;\n\n float dBlendModeFogFactor = 1.0;\n\n vec3 addFog(vec3 color) {\n float depth = gl_FragCoord.z / gl_FragCoord.w;\n // float depth = v_FogDepth;\n float fogFactor;\n float fogStart = u_FogInfos.y;\n float fogEnd = u_FogInfos.z;\n float fogDensity = u_FogInfos.w;\n\n if (u_FogInfos.x == FOGMODE_NONE) {\n fogFactor = 1.0;\n } else if (u_FogInfos.x == FOGMODE_EXP) {\n fogFactor = exp(-depth * fogDensity);\n } else if (u_FogInfos.x == FOGMODE_EXP2) {\n fogFactor = exp(-depth * depth * fogDensity * fogDensity);\n } else if (u_FogInfos.x == FOGMODE_LINEAR) {\n fogFactor = (fogEnd - depth) / (fogEnd - fogStart);\n }\n\n fogFactor = clamp(fogFactor, 0.0, 1.0);\n return mix(u_FogColor * dBlendModeFogFactor, color, fogFactor);\n }\n#endif\n\nout vec4 outputColor;\n\nvoid main() {\n vec4 u_Color = v_Color;\nvec4 u_StrokeColor = v_StrokeColor;\nfloat u_Opacity = v_StylePacked1.x;\nfloat u_FillOpacity = v_StylePacked1.y;\nfloat u_StrokeOpacity = v_StylePacked1.z;\nfloat u_StrokeWidth = v_StylePacked1.w;\nfloat u_Visible = v_StylePacked2.x;\nvec3 u_PickingColor = v_PickingResult.xyz;\n\nif (u_Visible < 0.5) {\n discard;\n}\n #ifdef USE_MAP\n #ifdef USE_PATTERN\n vec4 texelColor = texture(SAMPLER_2D(u_Map), v_Uv);\n u_Color = texelColor;\n #else\n vec4 texelColor = texture(SAMPLER_2D(u_Map), v_Uv);\n u_Color = texelColor;\n #endif\n#endif\n\n if (u_IsPicking > 0.5) {\n if (u_PickingColor.x == 0.0 && u_PickingColor.y == 0.0 && u_PickingColor.z == 0.0) {\n discard;\n }\n outputColor = vec4(u_PickingColor, 1.0);\n } else {\n outputColor = u_Color;\n outputColor.a = outputColor.a * u_Opacity;\n vec4 diffuseColor = outputColor;\n\n ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n reflectedLight.indirectDiffuse += vec3( 1.0 );\n reflectedLight.indirectDiffuse *= outputColor.rgb;\n\n vec3 outgoingLight = reflectedLight.indirectDiffuse;\n \n outputColor = vec4(outgoingLight, diffuseColor.a);\n\n #ifdef USE_WIREFRAME\n vec3 color = mix(outputColor.xyz, u_WireframeLineColor, (1.0 - edgeFactor()));\n outputColor.xyz = color;\n#endif\n #ifdef USE_FOG\n outputColor.rgb = addFog(outputColor.rgb);\n#endif\n }\n}",cullMode:vf.Back},e))||this,e=(t.defines=pv({},t.defines,{USE_UV:!0,USE_MAP:!1,USE_WIREFRAME:!1,USE_FOG:!1,USE_LIGHT:!1}),e||{}),n=e.map,e=e.wireframe;return n&&(t.map=n),t.wireframe=e,t.setUniforms(((n={})[yv.PLACE_HOLDER]=[0,0,0,0],n)),t}return gv(t,r),fv(t,[{key:"map",get:function(){return this.props.map},set:function(t){var e;this.props.map!==t&&(this.props.map=t,this.programDirty=!0),this.setUniforms(((e={})[yv.MAP]=t,e))}},{key:"aoMap",get:function(){return this.props.aoMap},set:function(t){this.props.aoMap=t}}]),t}(Ca)),Tv=((ya=Ev=Ev||{}).EMISSIVE="u_Emissive",ya.SHININESS="u_Shininess",ya.SPECULAR="u_Specular",ya.BUMP_SCALE="u_BumpScale",ya.SPECULAR_MAP="u_SpecularMap",ya.BUMP_MAP="u_BumpMap",function(l){function t(t,e){var n,t=l.call(this,t,pv({vertexShader:"#define GLSLIFY 1\n#define PI 3.141592653589793\n#define PI2 6.283185307179586\n#define PI_HALF 1.5707963267948966\n#define RECIPROCAL_PI 0.3183098861837907\n#define RECIPROCAL_PI2 0.15915494309189535\n#define EPSILON 1e-6\n\n#ifndef saturate\n #define saturate( a ) clamp( a, 0.0, 1.0 )\n#endif\n#define whiteComplement( a ) ( 1.0 - saturate( a ) )\n\nfloat pow2( const in float x ) { return x*x; }\nfloat pow3( const in float x ) { return x*x*x; }\nfloat pow4( const in float x ) { float x2 = x*x; return x2*x2; }\nfloat max3( const in vec3 v ) { return max( max( v.x, v.y ), v.z ); }\nfloat average( const in vec3 color ) { return dot( color, vec3( 0.3333 ) ); }\n\n// expects values in the range of [0,1]x[0,1], returns values in the [0,1] range.\n// do not collapse into a single function per: http://byteblacksmith.com/improvements-to-the-canonical-one-liner-glsl-rand-for-opengl-es-2-0/\nhighp float rand( const in vec2 uv ) {\n const highp float a = 12.9898, b = 78.233, c = 43758.5453;\n highp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI );\n\n return fract( sin( sn ) * c );\n}\n\nmat3 transposeMat3(mat3 inMatrix) {\n vec3 i0 = inMatrix[0];\n vec3 i1 = inMatrix[1];\n vec3 i2 = inMatrix[2];\n\n mat3 outMatrix = mat3(\n vec3(i0.x, i1.x, i2.x),\n vec3(i0.y, i1.y, i2.y),\n vec3(i0.z, i1.z, i2.z)\n );\n\n return outMatrix;\n}\n\n// https://github.com/glslify/glsl-inverse/blob/master/index.glsl\nmat3 inverseMat3(mat3 inMatrix) {\n float a00 = inMatrix[0][0], a01 = inMatrix[0][1], a02 = inMatrix[0][2];\n float a10 = inMatrix[1][0], a11 = inMatrix[1][1], a12 = inMatrix[1][2];\n float a20 = inMatrix[2][0], a21 = inMatrix[2][1], a22 = inMatrix[2][2];\n\n float b01 = a22 * a11 - a12 * a21;\n float b11 = -a22 * a10 + a12 * a20;\n float b21 = a21 * a10 - a11 * a20;\n\n float det = a00 * b01 + a01 * b11 + a02 * b21;\n\n return mat3(b01, (-a22 * a01 + a02 * a21), (a12 * a01 - a02 * a11),\n b11, (a22 * a00 - a02 * a20), (-a12 * a00 + a02 * a10),\n b21, (-a21 * a00 + a01 * a20), (a11 * a00 - a01 * a10)) / det;\n}\n\nstruct DirectionalLight {\n vec3 direction;\n float intensity;\n vec3 color;\n};\n\nstruct IncidentLight {\n vec3 color;\n vec3 direction;\n bool visible;\n};\n\nstruct ReflectedLight {\n vec3 directDiffuse;\n vec3 directSpecular;\n vec3 indirectDiffuse;\n vec3 indirectSpecular;\n};\n\nstruct GeometricContext {\n vec3 position;\n vec3 normal;\n vec3 viewDir;\n};\nlayout(std140) uniform ub_SceneParams {\n mat4 u_ProjectionMatrix;\n mat4 u_ViewMatrix;\n vec3 u_CameraPosition;\n float u_DevicePixelRatio;\n vec2 u_Viewport;\n float u_IsOrtho;\n float u_IsPicking;\n};\nlayout(std140) uniform ub_MaterialParams {\n #ifdef USE_WIREFRAME\n vec3 u_WireframeLineColor;\n float u_WireframeLineWidth;\n #endif\n\n #ifdef USE_FOG\n vec4 u_FogInfos;\n vec3 u_FogColor;\n #endif\n\n vec3 u_Emissive;\n float u_Shininess;\n vec3 u_Specular;\n\n #ifdef USE_LIGHT\n #ifdef USE_BUMPMAP\n float u_BumpScale;\n #endif\n\n #ifdef NUM_AMBIENT_LIGHTS\n vec3 u_AmbientLightColor;\n #endif\n\n #ifdef NUM_DIR_LIGHTS\n DirectionalLight directionalLights[ NUM_DIR_LIGHTS ];\n #endif\n #endif\n};\n#ifdef USE_LIGHT\n void getDirectionalLightInfo(\n const in DirectionalLight directionalLight, \n const in GeometricContext geometry,\n out IncidentLight light\n ) {\n light.color = directionalLight.color * directionalLight.intensity;\n light.direction = normalize(directionalLight.direction);\n light.visible = true;\n }\n#endif\n\nlayout(location = MODEL_MATRIX0) in vec4 a_ModelMatrix0;\nlayout(location = MODEL_MATRIX1) in vec4 a_ModelMatrix1;\nlayout(location = MODEL_MATRIX2) in vec4 a_ModelMatrix2;\nlayout(location = MODEL_MATRIX3) in vec4 a_ModelMatrix3;\nlayout(location = COLOR) in vec4 a_Color;\nlayout(location = STROKE_COLOR) in vec4 a_StrokeColor;\nlayout(location = PACKED_STYLE1) in vec4 a_StylePacked1;\nlayout(location = PACKED_STYLE2) in vec4 a_StylePacked2;\nlayout(location = PICKING_COLOR) in vec4 a_PickingColor;\n\nout vec4 v_PickingResult;\nout vec4 v_Color;\nout vec4 v_StrokeColor;\nout vec4 v_StylePacked1;\nout vec4 v_StylePacked2;\n\n#define COLOR_SCALE 1. / 255.\nvoid setPickingColor(vec3 pickingColor) {\n v_PickingResult.rgb = pickingColor * COLOR_SCALE;\n}\nvec4 project(vec4 pos, mat4 pm, mat4 vm, mat4 mm) {\n return pm * vm * mm * pos;\n}\n\nlayout(location = POSITION) in vec3 a_Position;\nlayout(location = NORMAL) in vec3 a_Normal;\n\n#ifdef USE_UV\n layout(location = UV) in vec2 a_Uv;\n out vec2 v_Uv;\n#endif\n\n#ifdef USE_WIREFRAME\n layout(location = BARYCENTRIC) in vec3 a_Barycentric;\n out vec3 v_Barycentric;\n#endif\n\nout vec3 v_ViewPosition;\nout vec3 v_Normal;\n\nvoid main() {\n mat4 u_ModelMatrix = mat4(a_ModelMatrix0, a_ModelMatrix1, a_ModelMatrix2, a_ModelMatrix3);\nvec4 u_StrokeColor = a_StrokeColor;\nfloat u_Opacity = a_StylePacked1.x;\nfloat u_FillOpacity = a_StylePacked1.y;\nfloat u_StrokeOpacity = a_StylePacked1.z;\nfloat u_StrokeWidth = a_StylePacked1.w;\nfloat u_ZIndex = a_PickingColor.w;\nvec2 u_Anchor = a_StylePacked2.yz;\nfloat u_IncreasedLineWidthForHitTesting = a_StylePacked2.w;\n\nsetPickingColor(a_PickingColor.xyz);\n\nv_Color = a_Color;\nv_StrokeColor = a_StrokeColor;\nv_StylePacked1 = a_StylePacked1;\nv_StylePacked2 = a_StylePacked2;\n\n#ifdef CLIPSPACE_NEAR_ZERO\n gl_Position.z = gl_Position.z * 0.5 + 0.5;\n#endif\n\n vec4 position = vec4(a_Position, 1.0);\n\n gl_Position = project(position, u_ProjectionMatrix, u_ViewMatrix, u_ModelMatrix);\n\n vec4 mvPosition = u_ViewMatrix * u_ModelMatrix * position;\n v_ViewPosition = - mvPosition.xyz;\n\n // v_ViewPosition = vec3(mvPosition) / mvPosition.w;\n\n mat3 normalWorld = mat3(transposeMat3(inverseMat3(mat3(u_ViewMatrix * u_ModelMatrix))));\n v_Normal = normalize(normalWorld * a_Normal);\n\n #ifdef USE_UV\n v_Uv = a_Uv;\n #ifdef VIEWPORT_ORIGIN_TL\n v_Uv.y = 1.0 - v_Uv.y;\n #endif\n#endif\n\n #ifdef USE_WIREFRAME\n v_Barycentric = a_Barycentric;\n#endif\n\n}",fragmentShader:"#define GLSLIFY 1\n#define PI 3.141592653589793\n#define PI2 6.283185307179586\n#define PI_HALF 1.5707963267948966\n#define RECIPROCAL_PI 0.3183098861837907\n#define RECIPROCAL_PI2 0.15915494309189535\n#define EPSILON 1e-6\n\n#ifndef saturate\n #define saturate( a ) clamp( a, 0.0, 1.0 )\n#endif\n#define whiteComplement( a ) ( 1.0 - saturate( a ) )\n\nfloat pow2( const in float x ) { return x*x; }\nfloat pow3( const in float x ) { return x*x*x; }\nfloat pow4( const in float x ) { float x2 = x*x; return x2*x2; }\nfloat max3( const in vec3 v ) { return max( max( v.x, v.y ), v.z ); }\nfloat average( const in vec3 color ) { return dot( color, vec3( 0.3333 ) ); }\n\n// expects values in the range of [0,1]x[0,1], returns values in the [0,1] range.\n// do not collapse into a single function per: http://byteblacksmith.com/improvements-to-the-canonical-one-liner-glsl-rand-for-opengl-es-2-0/\nhighp float rand( const in vec2 uv ) {\n const highp float a = 12.9898, b = 78.233, c = 43758.5453;\n highp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI );\n\n return fract( sin( sn ) * c );\n}\n\nmat3 transposeMat3(mat3 inMatrix) {\n vec3 i0 = inMatrix[0];\n vec3 i1 = inMatrix[1];\n vec3 i2 = inMatrix[2];\n\n mat3 outMatrix = mat3(\n vec3(i0.x, i1.x, i2.x),\n vec3(i0.y, i1.y, i2.y),\n vec3(i0.z, i1.z, i2.z)\n );\n\n return outMatrix;\n}\n\n// https://github.com/glslify/glsl-inverse/blob/master/index.glsl\nmat3 inverseMat3(mat3 inMatrix) {\n float a00 = inMatrix[0][0], a01 = inMatrix[0][1], a02 = inMatrix[0][2];\n float a10 = inMatrix[1][0], a11 = inMatrix[1][1], a12 = inMatrix[1][2];\n float a20 = inMatrix[2][0], a21 = inMatrix[2][1], a22 = inMatrix[2][2];\n\n float b01 = a22 * a11 - a12 * a21;\n float b11 = -a22 * a10 + a12 * a20;\n float b21 = a21 * a10 - a11 * a20;\n\n float det = a00 * b01 + a01 * b11 + a02 * b21;\n\n return mat3(b01, (-a22 * a01 + a02 * a21), (a12 * a01 - a02 * a11),\n b11, (a22 * a00 - a02 * a20), (-a12 * a00 + a02 * a10),\n b21, (-a21 * a00 + a01 * a20), (a11 * a00 - a01 * a10)) / det;\n}\n\nstruct DirectionalLight {\n vec3 direction;\n float intensity;\n vec3 color;\n};\n\nstruct IncidentLight {\n vec3 color;\n vec3 direction;\n bool visible;\n};\n\nstruct ReflectedLight {\n vec3 directDiffuse;\n vec3 directSpecular;\n vec3 indirectDiffuse;\n vec3 indirectSpecular;\n};\n\nstruct GeometricContext {\n vec3 position;\n vec3 normal;\n vec3 viewDir;\n};\nlayout(std140) uniform ub_SceneParams {\n mat4 u_ProjectionMatrix;\n mat4 u_ViewMatrix;\n vec3 u_CameraPosition;\n float u_DevicePixelRatio;\n vec2 u_Viewport;\n float u_IsOrtho;\n float u_IsPicking;\n};\nlayout(std140) uniform ub_MaterialParams {\n #ifdef USE_WIREFRAME\n vec3 u_WireframeLineColor;\n float u_WireframeLineWidth;\n #endif\n\n #ifdef USE_FOG\n vec4 u_FogInfos;\n vec3 u_FogColor;\n #endif\n\n vec3 u_Emissive;\n float u_Shininess;\n vec3 u_Specular;\n\n #ifdef USE_LIGHT\n #ifdef USE_BUMPMAP\n float u_BumpScale;\n #endif\n\n #ifdef NUM_AMBIENT_LIGHTS\n vec3 u_AmbientLightColor;\n #endif\n\n #ifdef NUM_DIR_LIGHTS\n DirectionalLight directionalLights[ NUM_DIR_LIGHTS ];\n #endif\n #endif\n};\n#ifdef USE_LIGHT\n void getDirectionalLightInfo(\n const in DirectionalLight directionalLight, \n const in GeometricContext geometry,\n out IncidentLight light\n ) {\n light.color = directionalLight.color * directionalLight.intensity;\n light.direction = normalize(directionalLight.direction);\n light.visible = true;\n }\n#endif\n\nin vec4 v_PickingResult;\nin vec4 v_Color;\nin vec4 v_StrokeColor;\nin vec4 v_StylePacked1;\nin vec4 v_StylePacked2;\n#ifdef USE_UV\n in vec2 v_Uv;\n#endif\n#ifdef USE_MAP\n uniform sampler2D u_Map;\n#endif\n#if defined(USE_BUMPMAP) && defined(USE_LIGHT)\n uniform sampler2D u_BumpMap;\n\n // Bump Mapping Unparametrized Surfaces on the GPU by Morten S. Mikkelsen\n // http://api.unrealengine.com/attachments/Engine/Rendering/LightingAndShadows/BumpMappingWithoutTangentSpace/mm_sfgrad_bump.pdf\n\n // Evaluate the derivative of the height w.r.t. screen-space using forward differencing (listing 2)\n\n vec2 dHdxy_fwd() {\n vec2 dSTdx = dFdx( v_Uv );\n vec2 dSTdy = dFdy( v_Uv );\n\n float Hll = u_BumpScale * texture(SAMPLER_2D(u_BumpMap), v_Uv ).x;\n float dBx = u_BumpScale * texture(SAMPLER_2D(u_BumpMap), v_Uv + dSTdx ).x - Hll;\n float dBy = u_BumpScale * texture(SAMPLER_2D(u_BumpMap), v_Uv + dSTdy ).x - Hll;\n\n return vec2( dBx, dBy );\n }\n\n vec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy, float faceDirection ) {\n\n // Workaround for Adreno 3XX dFd*( vec3 ) bug. See #9988\n\n vec3 vSigmaX = vec3( dFdx( surf_pos.x ), dFdx( surf_pos.y ), dFdx( surf_pos.z ) );\n vec3 vSigmaY = vec3( dFdy( surf_pos.x ), dFdy( surf_pos.y ), dFdy( surf_pos.z ) );\n vec3 vN = surf_norm;\t\t// normalized\n\n vec3 R1 = cross( vSigmaY, vN );\n vec3 R2 = cross( vN, vSigmaX );\n\n float fDet = dot( vSigmaX, R1 ) * faceDirection;\n\n vec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 );\n return normalize( abs( fDet ) * surf_norm - vGrad );\n }\n#endif\n#ifdef USE_SPECULARMAP\n uniform sampler2D u_SpecularMap;\n#endif\nvec3 BRDF_Lambert(const in vec3 diffuseColor) {\n return RECIPROCAL_PI * diffuseColor;\n}\n\nvec3 F_Schlick(\n const in vec3 f0,\n const in float f90,\n const in float dotVH\n) {\n // Original approximation by Christophe Schlick '94\n // float fresnel = pow( 1.0 - dotVH, 5.0 );\n\n // Optimized variant (presented by Epic at SIGGRAPH '13)\n // https://cdn2.unrealengine.com/Resources/files/2013SiggraphPresentationsNotes-26915738.pdf\n float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );\n return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );\n}\n\nfloat G_BlinnPhong_Implicit( /* const in float dotNL, const in float dotNV */ ) {\n // geometry term is (n dot l)(n dot v) / 4(n dot l)(n dot v)\n return 0.25;\n}\n\nfloat D_BlinnPhong(\n const in float shininess,\n const in float dotNH\n) {\n return RECIPROCAL_PI * ( shininess * 0.5 + 1.0 ) * pow( dotNH, shininess );\n}\n\nvec3 BRDF_BlinnPhong(\n const in vec3 lightDir,\n const in vec3 viewDir,\n const in vec3 normal,\n const in vec3 specularColor,\n const in float shininess\n) {\n vec3 halfDir = normalize( lightDir + viewDir );\n\n float dotNH = saturate( dot( normal, halfDir ) );\n float dotVH = saturate( dot( viewDir, halfDir ) );\n\n vec3 F = F_Schlick( specularColor, 1.0, dotVH );\n\n float G = G_BlinnPhong_Implicit( /* dotNL, dotNV */ );\n\n float D = D_BlinnPhong( shininess, dotNH );\n\n return F * ( G * D );\n}\n\n#ifdef USE_WIREFRAME\n in vec3 v_Barycentric;\n\n float edgeFactor() {\n vec3 d = fwidth(v_Barycentric);\n vec3 a3 = smoothstep(vec3(0.0), d * u_WireframeLineWidth, v_Barycentric);\n return min(min(a3.x, a3.y), a3.z);\n }\n#endif\n\n#ifdef USE_FOG\n #define FOGMODE_NONE 0.\n #define FOGMODE_EXP 1.\n #define FOGMODE_EXP2 2.\n #define FOGMODE_LINEAR 3.\n\n // in float v_FogDepth;\n\n float dBlendModeFogFactor = 1.0;\n\n vec3 addFog(vec3 color) {\n float depth = gl_FragCoord.z / gl_FragCoord.w;\n // float depth = v_FogDepth;\n float fogFactor;\n float fogStart = u_FogInfos.y;\n float fogEnd = u_FogInfos.z;\n float fogDensity = u_FogInfos.w;\n\n if (u_FogInfos.x == FOGMODE_NONE) {\n fogFactor = 1.0;\n } else if (u_FogInfos.x == FOGMODE_EXP) {\n fogFactor = exp(-depth * fogDensity);\n } else if (u_FogInfos.x == FOGMODE_EXP2) {\n fogFactor = exp(-depth * depth * fogDensity * fogDensity);\n } else if (u_FogInfos.x == FOGMODE_LINEAR) {\n fogFactor = (fogEnd - depth) / (fogEnd - fogStart);\n }\n\n fogFactor = clamp(fogFactor, 0.0, 1.0);\n return mix(u_FogColor * dBlendModeFogFactor, color, fogFactor);\n }\n#endif\n\nstruct BlinnPhongMaterial {\n vec3 diffuseColor;\n vec3 specularColor;\n float specularShininess;\n float specularStrength;\n};\n\nvoid RE_Direct_BlinnPhong(\n const in IncidentLight directLight,\n const in GeometricContext geometry,\n const in BlinnPhongMaterial material,\n inout ReflectedLight reflectedLight\n) {\n float dotNL = saturate(dot(geometry.normal, directLight.direction));\n vec3 irradiance = dotNL * directLight.color;\n\n reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n\n reflectedLight.directSpecular += irradiance * BRDF_BlinnPhong( directLight.direction, geometry.viewDir, geometry.normal, material.specularColor, material.specularShininess ) * material.specularStrength;\n}\n\nvoid RE_IndirectDiffuse_BlinnPhong(\n const in vec3 irradiance,\n const in GeometricContext geometry,\n const in BlinnPhongMaterial material,\n inout ReflectedLight reflectedLight\n) {\n reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\n\nvec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) {\n\tvec3 irradiance = ambientLightColor;\n\treturn irradiance;\n}\n\n#define RE_Direct RE_Direct_BlinnPhong\n#define RE_IndirectDiffuse RE_IndirectDiffuse_BlinnPhong\n\nin vec3 v_ViewPosition;\nin vec3 v_Normal;\n\nout vec4 outputColor;\n\nvoid main() {\n vec4 u_Color = v_Color;\nvec4 u_StrokeColor = v_StrokeColor;\nfloat u_Opacity = v_StylePacked1.x;\nfloat u_FillOpacity = v_StylePacked1.y;\nfloat u_StrokeOpacity = v_StylePacked1.z;\nfloat u_StrokeWidth = v_StylePacked1.w;\nfloat u_Visible = v_StylePacked2.x;\nvec3 u_PickingColor = v_PickingResult.xyz;\n\nif (u_Visible < 0.5) {\n discard;\n}\n\n // diffusemap\n #ifdef USE_MAP\n #ifdef USE_PATTERN\n vec4 texelColor = texture(SAMPLER_2D(u_Map), v_Uv);\n u_Color = texelColor;\n #else\n vec4 texelColor = texture(SAMPLER_2D(u_Map), v_Uv);\n u_Color = texelColor;\n #endif\n#endif\n // specularmap\n float specularStrength = 1.0;\n\n#ifdef USE_SPECULARMAP\n vec4 texelSpecular = texture(SAMPLER_2D(u_SpecularMap), v_Uv);\n specularStrength = texelSpecular.r;\n#endif\n // bumpmap & normalmap\n float faceDirection = gl_FrontFacing ? 1.0 : - 1.0;\nvec3 normal = normalize(v_Normal);\n#ifdef USE_DOUBLESIDE\n normal = normal * faceDirection;\n#endif\n\n// #ifdef USE_TANGENT\n// vec3 tangent = normalize( vTangent );\n// vec3 bitangent = normalize( vBitangent );\n\n// #ifdef DOUBLE_SIDED\n// tangent = tangent * faceDirection;\n// bitangent = bitangent * faceDirection;\n// #endif\n\n// #if defined( TANGENTSPACE_NORMALMAP ) || defined( USE_CLEARCOAT_NORMALMAP )\n\n// mat3 vTBN = mat3( tangent, bitangent, normal );\n\n// #endif\n// #endif\n #ifdef OBJECTSPACE_NORMALMAP\n // normal = texture2D( normalMap, vUv ).xyz * 2.0 - 1.0; // overrides both flatShading and attribute normals\n\n // #ifdef FLIP_SIDED\n // normal = - normal;\n // #endif\n\n // #ifdef DOUBLE_SIDED\n // normal = normal * faceDirection;\n // #endif\n\n // normal = normalize( normalMatrix * normal );\n#elif defined( TANGENTSPACE_NORMALMAP )\n // vec3 mapN = texture2D( normalMap, vUv ).xyz * 2.0 - 1.0;\n // mapN.xy *= normalScale;\n\n // #ifdef USE_TANGENT\n // normal = normalize( vTBN * mapN );\n // #else\n // normal = perturbNormal2Arb( - v_ViewPosition, normal, mapN, faceDirection );\n // #endif\n\n#elif defined(USE_BUMPMAP) && defined(USE_LIGHT)\n normal = perturbNormalArb( - v_ViewPosition, normal, dHdxy_fwd(), faceDirection );\n#endif\n\n if (u_IsPicking > 0.5) {\n if (u_PickingColor.x == 0.0 && u_PickingColor.y == 0.0 && u_PickingColor.z == 0.0) {\n discard;\n }\n outputColor = vec4(u_PickingColor, 1.0);\n } else {\n outputColor = u_Color;\n outputColor.a = outputColor.a * u_Opacity;\n\n vec4 diffuseColor = outputColor;\n ReflectedLight reflectedLight = ReflectedLight(vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ));\n vec3 totalEmissiveRadiance = u_Emissive;\n\n // calculate lighting accumulation\n BlinnPhongMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.specularColor = u_Specular;\nmaterial.specularShininess = u_Shininess;\nmaterial.specularStrength = specularStrength;\n GeometricContext geometry;\ngeometry.position = - v_ViewPosition;\ngeometry.normal = normal;\ngeometry.viewDir = u_IsOrtho == 1.0 ? vec3(0, 0, 1) : normalize(v_ViewPosition);\n\nIncidentLight directLight;\n#if defined( NUM_DIR_LIGHTS ) && ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct )\n DirectionalLight directionalLight;\n #if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0\n DirectionalLightShadow directionalLightShadow;\n #endif\n\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\n directionalLight = directionalLights[ i ];\n\n getDirectionalLightInfo( directionalLight, geometry, directLight );\n\n #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS )\n directionalLightShadow = directionalLightShadows[ i ];\n directLight.color *= all( bvec2( directLight.visible, receiveShadow ) ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n #endif\n\n RE_Direct( directLight, geometry, material, reflectedLight );\n }\n #pragma unroll_loop_end\n\n#endif\n\n#if defined( RE_IndirectDiffuse )\n vec3 iblIrradiance = vec3(0.0);\n vec3 ambient = vec3(0.0);\n #ifdef NUM_AMBIENT_LIGHTS\n ambient = u_AmbientLightColor;\n #endif\n vec3 irradiance = getAmbientLightIrradiance(ambient);\n\n // irradiance += getLightProbeIrradiance( lightProbe, geometry.normal );\n // #if ( NUM_HEMI_LIGHTS > 0 )\n // #pragma unroll_loop_start\n // for ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n // irradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry.normal );\n // }\n // #pragma unroll_loop_end\n // #endif\n#endif\n\n#if defined( RE_IndirectSpecular )\n vec3 radiance = vec3( 0.0 );\n vec3 clearcoatRadiance = vec3( 0.0 );\n#endif\n\n #if defined( RE_IndirectDiffuse )\n RE_IndirectDiffuse( irradiance, geometry, material, reflectedLight );\n#endif\n\n#if defined( RE_IndirectSpecular )\n RE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometry, material, reflectedLight );\n#endif\n\n vec3 outgoingLight = reflectedLight.directDiffuse +\n reflectedLight.indirectDiffuse + \n reflectedLight.directSpecular + \n reflectedLight.indirectSpecular + \n totalEmissiveRadiance;\n\n outputColor = vec4(outgoingLight, diffuseColor.a);\n\n #ifdef USE_WIREFRAME\n vec3 color = mix(outputColor.xyz, u_WireframeLineColor, (1.0 - edgeFactor()));\n outputColor.xyz = color;\n#endif\n #ifdef USE_FOG\n outputColor.rgb = addFog(outputColor.rgb);\n#endif\n }\n}",emissive:"black",shininess:30,specular:"#111111",bumpScale:1,doubleSide:!1},e))||this,e=function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t),r=e.specularMap,i=e.bumpMap,o=e.doubleSide,a=e.emissive,s=e.shininess,e=e.specular,a=Ao(a),e=Ao(e);return t.setUniforms(((n={u_Placeholder:null})[Ev.EMISSIVE]=[Number(a.r)/255,Number(a.g)/255,Number(a.b)/255],n[Ev.SHININESS]=s,n[Ev.SPECULAR]=[Number(e.r)/255,Number(e.g)/255,Number(e.b)/255],n)),r&&(t.specularMap=r),i&&(t.bumpMap=i),t.doubleSide=o,t.defines=pv({},t.defines),t}return gv(t,l),fv(t,[{key:"emissive",get:function(){return this.props.emissive},set:function(t){this.props.emissive=t;var e,t=Ao(t);this.setUniforms(((e={})[Ev.EMISSIVE]=[Number(t.r)/255,Number(t.g)/255,Number(t.b)/255],e))}},{key:"shininess",get:function(){return this.props.shininess},set:function(t){var e;this.props.shininess=t,this.setUniforms(((e={})[Ev.SHININESS]=t,e))}},{key:"specular",get:function(){return this.props.specular},set:function(t){this.props.specular=t;var e,t=Ao(t);this.setUniforms(((e={})[Ev.SPECULAR]=[Number(t.r)/255,Number(t.g)/255,Number(t.b)/255],e))}},{key:"specularMap",get:function(){return this.props.specularMap},set:function(t){var e;this.props.map!==t&&(this.props.specularMap=t,this.programDirty=!0),this.defines.USE_SPECULARMAP=!!t,this.setUniforms(((e={})[Ev.SPECULAR_MAP]=t,e))}},{key:"bumpMap",get:function(){return this.props.bumpMap},set:function(t){var e;this.props.map!==t&&(this.props.bumpMap=t,this.programDirty=!0),this.defines.USE_BUMPMAP=!!t,this.setUniforms(((e={})[Ev.BUMP_MAP]=t,e[Ev.BUMP_SCALE]=this.bumpScale,e))}},{key:"bumpScale",get:function(){return this.props.bumpScale},set:function(t){var e;this.props.bumpScale=t,this.setUniforms(((e={})[Ev.BUMP_SCALE]=t,e))}},{key:"doubleSide",get:function(){return this.props.doubleSide},set:function(t){this.props.doubleSide=t,this.defines.USE_DOUBLESIDE=t}}]),t}(wv)),Av=(0,function(i){function t(){for(var t,e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];return(t=i.call.apply(i,[this].concat(n))||this).name="3d",t}gv(t,i);var e=t.prototype;return e.init=function(){},e.destroy=function(){},t}(Ws));const Mv=(t,e,n,r,i,o=!0,a={})=>{let s;switch(t.toLowerCase()){case"svg":s=new kd;break;case"webgl-3d":case"webgl":(s=new hv).registerPlugin(new Av);break;default:s=new Ih}return"undefined"!=typeof document&&o?(t=document.createElement("canvas"),o=i||window.devicePixelRatio,t.width=o*n,t.height=o*r,t.style.width=n+"px",t.style.height=r+"px",t.style.position="fixed",t.style.outline="none",t.tabIndex=1,Object.assign(t.style,a),e.appendChild(t),new pl({canvas:t,devicePixelRatio:i,renderer:s})):new pl({container:e,width:n,height:r,devicePixelRatio:i,renderer:s})},Rv=["keyShape","labelShape","labelBackgroundShape","iconShape","haloShape","anchorShapes","badgeShapes"],Nv="otherShapes",Cv=[4,4,4,4];Ua={opacity:1,fillOpacity:1,shadowColor:void 0,shadowBlur:0,lineDash:void 0,zIndex:0},Sa=Object.assign(Object.assign({},Ua),{fontSize:12,fontFamily:"sans-serif",fontWeight:"normal",fontVariant:"normal",fontStyle:"normal",lineWidth:0});const Pv=(n,r)=>{if(null!=n&&n.length&&r.length)for(let e=0;e<n.length;e++)for(let t=0;t<r.length;t++)if(n[e]===r[t])return!0;return!1};function Ov(t=[],e=[]){const n={};return e.forEach(t=>{"object"==typeof t&&(n[JSON.stringify(t)]=!0),n[t]=!0}),t.filter(t=>!n[t])}function Iv(t,e){const n=new Set(t);return e.forEach(t=>{n.add(t)}),Array.from(n)}function Lv(t,e){const n=new Set(t),r=[];return e.forEach(t=>{n.has(t)&&r.push(t)}),r}const kv=t=>{var e,n;return t?(e=t.nodeName,n={opacity:0,strokeOpacity:0,lineWidth:1,offsetDistance:0},["line","polyline","path"].includes(e)?(t=t.getTotalLength(),Object.assign({lineDash:[0,t]},n)):"circle"===e?Object.assign({r:0},n):"ellipse"===e?Object.assign({rx:0,ry:0},n):"text"===e?{fontSize:0,opacity:0,strokeOpacity:0,offsetDistance:0}:Object.assign({width:0,height:0},n)):{}},Dv=[{opacity:0,transform:"scale(0)"},{opacity:1,transform:"scale(1)"}],Bv={buildIn:{duration:500,easing:"cubic-bezier(0.250, 0.460, 0.450, 0.940)",iterations:1,delay:1e3,fill:"both"},show:{duration:500,easing:"cubic-bezier(0.250, 0.460, 0.450, 0.940)",iterations:1,fill:"both"},update:{duration:500,easing:"cubic-bezier(0.250, 0.460, 0.450, 0.940)",iterations:1,fill:"both"},zoom:{duration:200,easing:"linear",iterations:1,delay:0,fill:"both"}},Fv=(e,n)=>{const r=[{},{}];return Object.keys(e).forEach(t=>{n[t]!==e[t]&&(r[0][t]=e[t],r[1][t]=n[t])}),r},Uv=(t,e,r)=>{const i={},o="stateUpdate"===e;return t[o?"update":e].forEach(t=>{var{order:e=0,states:n}=t;(!o||o&&Pv(n,r))&&(i[e]=i[e]||[],i[e].push(t))}),i},Gv=(h,d,t,f,p,e,g,n)=>{let m=-1/0,v=-1,y=n;const E="buildOut"===p||"hide"===p;n=t.map((t,e)=>{var n,{fields:r,shapeId:i}=t,t=I(t,["fields","shapeId","order","states"]);const o=Object.assign(Object.assign({},Bv[p]),t);t=o.duration;let a;if(i&&"group"!==i){const s=h[i];if(s&&"none"!==s.style.display){const l=f[i]||(null==(n=f.otherShapes)?void 0:n[i])||{};y?Object.keys(l).forEach(t=>{s.style[t]=l[t]}):a=Wv(s,r,l,kv(s),o)}}else{const u=[];let e=!1;null!=r&&r.forEach(t=>{"size"===t?u.push("transform"):"opacity"!==t?u.push(t):e=!0});const c=f.group||Dv[E?0:1];y?Object.keys(c).forEach(t=>{d.style[t]=c[t]}):(e&&Object.keys(h).forEach(t=>{var{opacity:e=1}=f[t]||(null==(e=f.otherShapes)?void 0:e[t])||{};a=Wv(h[t],["opacity"],{opacity:e},kv(h[t]),o)}),u.length&&(a=Wv(d,u,c,Dv[E?1:0],o)))}return m<t&&a&&(m=t,v=e),a&&(a.oncancel=()=>{y=!0,g()}),a});return-1<v&&(n[v].onfinish=e),n},Wv=(a,t,s,l,e)=>{if(a.isVisible()){let o;if(null!=t&&t.length?(o=[{},{}],t.forEach(t=>{if(o[0][t]=(a.attributes.hasOwnProperty(t)?a.style:l)[t],o[1][t]=(void 0===s[t]?o[0]:s)[t],"lineDash"===t&&o[1][t].includes("100%")){var e=a.getTotalLength(),n=o[1][t],r="100%",i=e;for(let t=0;t<n.length;t++)n[t]===r&&(n[t]=i)}})):o=Fv(a.attributes,s),JSON.stringify(o[0])!==JSON.stringify(o[1]))return a.animate(o,e)}},Vv=(t,i,o,a,s="buildIn",e=[],l=()=>{},u=()=>{})=>{if(null!=t&&t[s]){var n="update"===s&&null!=e&&e.length?"stateUpdate":s;const c=Uv(t,n,e);let r=0;const h=Object.keys(c);if(h.length){let e=[],n=!1;const d=()=>{var t;r>=h.length?u():((t=Gv(o,a,c[h[r]],i,s,d,()=>n=!0,n).filter(Boolean)).forEach(t=>{t.onframe=l}),0===r&&(e=t),r++)};return d(),e}}else u()},jv=(t,e,n,r,i)=>{e&&r[t]&&(null!=e&&e.isVisible()||(e.style.opacity=0,e.show()),{opacity:r=1}=e.attributes,1!==r)&&({opacity:t=1}=n,e.animate([{opacity:0},{opacity:t}],i))},zv=(t,e,n,r)=>{null!=e&&e.isVisible()&&(n[t]=!0,{opacity:n=1}=e.attributes,0!==n)&&(e.animate([{opacity:n},{opacity:0}],r).onfinish=()=>e.hide())},Hv=(t,e,n)=>e<=t&&t<=n,Xv={circle:ls,rect:Rs,ellipse:hs,polygon:ws,line:Es,polyline:As,text:Cs,image:vs,path:xs},Yv=["line","polyline","path"],Kv="data-item-local-bounds-dirty",qv=(t,e,n)=>{n=new Xv[t]({id:n,style:e});return Yv.includes(t)&&(n.style.increasedLineWidthForHitTesting=Math.max(n.style.lineWidth,6)),n},$v=(t,e,n)=>{if(null==t||!t[e])return[];let r=[];return t[e].forEach(({fields:t,shapeId:e})=>{e===n?r=r.concat(t):e&&"group"!==e||!t.includes("opacity")||r.push("opacity")}),r.includes(void 0)?[]:r},Zv=(t,e,n,r,i)=>{let o=r[e];var{animates:i,disableAnimate:a}=(null==i?void 0:i.data)||{};if(o)if(o.nodeName!==t)o.remove(),(o=qv(t,n,e)).setAttribute(Kv,!0);else{const s={},l=o.attributes,u=$v(i,"update",e);!a&&null!=i&&i.update&&u.length?Object.keys(n).forEach(t=>{l[t]!==n[t]&&(s[t]=n[t],u.includes(t)||(o.style[t]=n[t]))}):Object.keys(n).forEach(t=>{l[t]!==n[t]&&(s[t]=n[t],o.style[t]=n[t])}),uy(t,s)&&o.setAttribute(Kv,!0)}else{if(o=qv(t,n,e),!a&&i){t=$v(i,"buildIn",e);const c=kv(o);t.forEach(t=>{o.style[t]=c[t]})}o.setAttribute(Kv,!0)}return r[e]=o},Qv=(r,i,o,a=!0,s=()=>!0)=>{var t=Object.assign(Object.assign({},r),i);const l=Object.assign({},r);return Object.keys(t).forEach(t=>{var e=r[t],n=i[t];n&&!s(t)||(e&&n?(e!==(l[t]=n)&&e.remove(),"none"!==n.style.display&&o.appendChild(n)):!e&&n?"none"!==(l[t]=n).style.display&&o.appendChild(n):e&&!n&&a&&(delete l[t],e.remove()))}),l},Jv=(t,e=Cv)=>{if(Ou(t))switch(t.length){case 0:return e;case 1:return[t[0],t[0],t[0],t[0]];case 2:return t.concat(t);case 3:return t.concat([t[0]]);default:return t}return Fu(t)?[t,t,t,t]:e},ty=t=>{let n=t[0];return t.forEach((t,e)=>{0<e&&(n=ey(n,t))}),n},ey=(t,e)=>{if(!t)return Object.assign({},e);if(!e)return Object.assign({},t);const i=Wu(t);return Object.keys(e).forEach(n=>{const r=e[n];i[n]=i[n]||{},r&&Object.keys(r).forEach(t=>{var e=r[t];i[n][t]=e})}),i},ny=(e,n)=>{var t=t=>{var e=t.map(t=>t[0]),t=t.map(t=>t[1]);return{min:[Math.min.apply(null,e),Math.min.apply(null,t),0],max:[Math.max.apply(null,e),Math.max.apply(null,t),0]}},r=e=>{var t,n,r=[],i=e.length;for(let t=0;t<i-1;t++){var o=e[t],a=e[t+1];r.push({from:{x:o[0],y:o[1]},to:{x:a[0],y:a[1]}})}return 1<r.length&&(t=e[0],n=e[i-1],r.push({from:{x:n[0],y:n[1]},to:{x:t[0],y:t[1]}})),r};if(e.length<2||n.length<2)return!1;var i=t(e),t=t(n);if(!ry(i,t))return!1;let o=!1;if(n.forEach(t=>{if(iy(e,t[0],t[1]))return!(o=!0)}),o)return!0;if(e.forEach(t=>{if(iy(n,t[0],t[1]))return!(o=!0)}),o)return!0;const a=r(e);i=r(n);let s=!1;return i.forEach(t=>{if(ay(a,t))return!(s=!0)}),s},ry=(t,e)=>!(e.min[0]>t.max[0]||e.max[0]<t.min[0]||e.min[1]>t.max[1]||e.max[1]<t.min[1]),iy=(e,n,r)=>{let i=!1;var o=e.length;function a(t){return Math.abs(t)<1e-6?0:t<0?-1:1}if(o<=2)return!1;for(let t=0;t<o;t++){var s=e[t],l=e[(t+1)%o];if(oy(s,l,[n,r]))return!0;0<a(s[1]-r)!=0<a(l[1]-r)&&a(n-(r-s[1])*(s[0]-l[0])/(s[1]-l[1])-s[0])<0&&(i=!i)}return i},oy=(t,e,n)=>(n[0]-t[0])*(e[1]-t[1])==(e[0]-t[0])*(n[1]-t[1])&&Math.min(t[0],e[0])<=n[0]&&n[0]<=Math.max(t[0],e[0])&&Math.min(t[1],e[1])<=n[1]&&n[1]<=Math.max(t[1],e[1]),ay=(t,e)=>{let n=!1;return t.forEach(t=>{if(sy(t.from,t.to,e.from,e.to))return!(n=!0)}),n},sy=(t,e,n,r)=>{const i=n.x-t.x,o=n.y-t.y,a=e.x-t.x,s=e.y-t.y,l=r.x-n.x,u=r.y-n.y;var e=a*u-s*l,r=1/e;return 1e-4*(a*a+s*s)*(l*l+u*u)<e*e&&(n=(i*u-o*l)*r,e=(i*s-o*a)*r,Hv(n,0,1))&&Hv(e,0,1)?{x:t.x+n*a,y:t.y+n*s}:null},ly={circle:["r","lineWidth"],rect:["width","height","lineWidth"],image:["width","height","lineWidth"],ellipse:["rx","ry","lineWidth"],text:["fontSize","fontWeight","text","wordWrapWidth"],polygon:["points","lineWidth"],line:["x1","x2","y1","y2","lineWidth"],polyline:["points","lineWidth"],path:["points","lineWidth"],sphere:["radius"],cube:["width","height","depth"],plane:["width","depth"]},uy=(t,e)=>Pv(Object.keys(e),ly[t]),cy=(t,e,n)=>{var{r:e,rx:r,ry:i,width:o,height:a,depth:s=0,x1:l,x2:u,y1:c,y2:h,z1:d=0,z2:f=0}=e,p=Number(e),g=Number(r),m=Number(i);switch(t.nodeName){case"circle":return{min:[-p,-p,0],max:[p,p,0],center:[0,0,0]};case"sphere":return{min:[-p,-p,-p],max:[p,p,p],center:[0,0,0]};case"image":case"rect":case"cube":case"plane":return{min:[-o/2,-a/2,-s/2],max:[o/2,a/2,s/2],center:[0,0,0]};case"ellipse":return{min:[-g,-m,0],max:[g,m,0],center:[0,0,0]};case"line":return{min:[l,c,d],max:[u,h,f],center:[(l+u)/2,(c+h)/2,(d+f)/2]};case"text":case"polyline":case"path":case"polygon":return n||t.getLocalBounds()}};function hy(e,n,t,r){for(;e.length;){var i=e.shift();if(t(i))return!0;n.add(i.id),r(i.id).forEach(t=>{n.has(t.id)||(n.add(t.id),e.push(t))})}return!1}function dy(t,e,n,r){if(n(t))return!0;e.add(t.id);for(const i of r(t.id))if(!e.has(i.id)&&dy(i,e,n,r))return!0;return!1}class fy extends G{nodeMap=new Map;edgeMap=new Map;inEdgesMap=new Map;outEdgesMap=new Map;bothEdgesMap=new Map;treeIndices=new Map;changes=[];batchCount=0;onChanged=()=>{};constructor(t){super(),t&&(t.nodes&&this.addNodes(t.nodes),t.edges&&this.addEdges(t.edges),t.tree&&this.addTree(t.tree),t.onChanged)&&(this.onChanged=t.onChanged)}batch=t=>{this.batchCount+=1,t(),--this.batchCount,this.batchCount||this.commit()};commit(){var t=this.changes,t=(this.changes=[],{graph:this,changes:t});this.emit("changed",t),this.onChanged(t)}reduceChanges(t){let e=[];return t.forEach(r=>{switch(r.type){case"NodeRemoved":{let n=!1;e=e.filter(t=>{var e;return"NodeAdded"===t.type?((e=t.value.id===r.value.id)&&(n=!0),!e):"NodeDataUpdated"===t.type?t.id!==r.value.id:"TreeStructureChanged"!==t.type||t.nodeId!==r.value.id}),n||e.push(r);break}case"EdgeRemoved":{let n=!1;e=e.filter(t=>{var e;return"EdgeAdded"===t.type?((e=t.value.id===r.value.id)&&(n=!0),!e):"EdgeDataUpdated"!==t.type&&"EdgeUpdated"!==t.type||t.id!==r.value.id}),n||e.push(r);break}case"NodeDataUpdated":case"EdgeDataUpdated":case"EdgeUpdated":var t=e.find(t=>t.type===r.type&&t.id===r.id&&t.propertyName===r.propertyName);t?t.newValue=r.newValue:e.push(r);break;case"TreeStructureDetached":(e=e.filter(t=>"TreeStructureAttached"!==t.type&&"TreeStructureChanged"!==t.type||t.treeKey!==r.treeKey)).push(r);break;case"TreeStructureChanged":t=e.find(t=>"TreeStructureChanged"===t.type&&t.treeKey===r.treeKey&&t.nodeId===r.nodeId);t?t.newParentId=r.newParentId:e.push(r);break;default:e.push(r)}}),e}checkNodeExistence(t){this.getNode(t)}hasNode(t){return this.nodeMap.has(t)}areNeighbors(e,t){return this.getNeighbors(t).some(t=>t.id===e)}getNode(t){var e=this.nodeMap.get(t);if(e)return e;throw new Error("Node not found for id: "+t)}getRelatedEdges(t,e){var n;return this.checkNodeExistence(t),"in"===e?(n=this.inEdgesMap.get(t),Array.from(n)):"out"===e?(n=this.outEdgesMap.get(t),Array.from(n)):(e=this.bothEdgesMap.get(t),Array.from(e))}getDegree(t,e){return this.getRelatedEdges(t,e).length}getSuccessors(t){t=this.getRelatedEdges(t,"out").map(t=>this.getNode(t.target));return Array.from(new Set(t))}getPredecessors(t){t=this.getRelatedEdges(t,"in").map(t=>this.getNode(t.source));return Array.from(new Set(t))}getNeighbors(t){var e=this.getPredecessors(t),t=this.getSuccessors(t);return Array.from(new Set([...e,...t]))}doAddNode(e){if(this.hasNode(e.id))throw new Error("Node already exists: "+e.id);this.nodeMap.set(e.id,e),this.inEdgesMap.set(e.id,new Set),this.outEdgesMap.set(e.id,new Set),this.bothEdgesMap.set(e.id,new Set),this.treeIndices.forEach(t=>{t.childrenMap.set(e.id,new Set)}),this.changes.push({type:"NodeAdded",value:e})}addNodes(e){this.batch(()=>{for(const t of e)this.doAddNode(t)})}addNode(t){this.addNodes([t])}doRemoveNode(t){var e=this.getNode(t);this.bothEdgesMap.get(t)?.forEach(t=>this.doRemoveEdge(t.id)),this.nodeMap.delete(t),this.treeIndices.forEach(e=>{e.childrenMap.get(t)?.forEach(t=>{e.parentMap.delete(t.id)}),e.parentMap.delete(t),e.childrenMap.delete(t)}),this.changes.push({type:"NodeRemoved",value:e})}removeNodes(t){this.batch(()=>{t.forEach(t=>this.doRemoveNode(t))})}removeNode(t){this.removeNodes([t])}updateNodeDataProperty(n,r,i){const o=this.getNode(n);this.batch(()=>{var t=o.data[r],e=i;o.data[r]=e,this.changes.push({type:"NodeDataUpdated",id:n,propertyName:r,oldValue:t,newValue:e})})}mergeNodeData(n,t){this.batch(()=>{Object.entries(t).forEach(([t,e])=>{this.updateNodeDataProperty(n,t,e)})})}updateNodeData(...t){const r=t[0],i=this.getNode(r);if("string"==typeof t[1])this.updateNodeDataProperty(r,t[1],t[2]);else{let n;var e;"function"==typeof t[1]?(e=t[1],n=e(i.data)):"object"==typeof t[1]&&(n=t[1]),this.batch(()=>{var t=i.data,e=n;i.data=n,this.changes.push({type:"NodeDataUpdated",id:r,oldValue:t,newValue:e})})}}checkEdgeExistence(t){if(!this.hasEdge(t))throw new Error("Edge not found for id: "+t)}hasEdge(t){return this.edgeMap.has(t)}getEdge(t){return this.checkEdgeExistence(t),this.edgeMap.get(t)}getEdgeDetail(t){t=this.getEdge(t);return{edge:t,source:this.getNode(t.source),target:this.getNode(t.target)}}doAddEdge(t){if(this.hasEdge(t.id))throw new Error("Edge already exists: "+t.id);this.checkNodeExistence(t.source),this.checkNodeExistence(t.target),this.edgeMap.set(t.id,t);var e=this.inEdgesMap.get(t.target),n=this.outEdgesMap.get(t.source),r=this.bothEdgesMap.get(t.source),i=this.bothEdgesMap.get(t.target);e.add(t),n.add(t),r.add(t),i.add(t),this.changes.push({type:"EdgeAdded",value:t})}addEdges(e){this.batch(()=>{for(const t of e)this.doAddEdge(t)})}addEdge(t){this.addEdges([t])}doRemoveEdge(t){var e=this.getEdge(t),n=this.outEdgesMap.get(e.source),r=this.inEdgesMap.get(e.target),i=this.bothEdgesMap.get(e.source),o=this.bothEdgesMap.get(e.target);n.delete(e),r.delete(e),i.delete(e),o.delete(e),this.edgeMap.delete(t),this.changes.push({type:"EdgeRemoved",value:e})}removeEdges(t){this.batch(()=>{t.forEach(t=>this.doRemoveEdge(t))})}removeEdge(t){this.removeEdges([t])}updateEdgeSource(t,e){var n=this.getEdge(t);this.checkNodeExistence(e);const r=n.source,i=e;this.outEdgesMap.get(r).delete(n),this.bothEdgesMap.get(r).delete(n),this.outEdgesMap.get(i).add(n),this.bothEdgesMap.get(i).add(n),n.source=e,this.batch(()=>{this.changes.push({type:"EdgeUpdated",id:t,propertyName:"source",oldValue:r,newValue:i})})}updateEdgeTarget(t,e){var n=this.getEdge(t);this.checkNodeExistence(e);const r=n.target,i=e;this.inEdgesMap.get(r).delete(n),this.bothEdgesMap.get(r).delete(n),this.inEdgesMap.get(i).add(n),this.bothEdgesMap.get(i).add(n),n.target=e,this.batch(()=>{this.changes.push({type:"EdgeUpdated",id:t,propertyName:"target",oldValue:r,newValue:i})})}updateEdgeDataProperty(n,r,i){const o=this.getEdge(n);this.batch(()=>{var t=o.data[r],e=i;o.data[r]=e,this.changes.push({type:"EdgeDataUpdated",id:n,propertyName:r,oldValue:t,newValue:e})})}updateEdgeData(...t){const r=t[0],i=this.getEdge(r);if("string"==typeof t[1])this.updateEdgeDataProperty(r,t[1],t[2]);else{let n;var e;"function"==typeof t[1]?(e=t[1],n=e(i.data)):"object"==typeof t[1]&&(n=t[1]),this.batch(()=>{var t=i.data,e=n;i.data=n,this.changes.push({type:"EdgeDataUpdated",id:r,oldValue:t,newValue:e})})}}mergeEdgeData(n,t){this.batch(()=>{Object.entries(t).forEach(([t,e])=>{this.updateEdgeDataProperty(n,t,e)})})}checkTreeExistence(t){if(!this.hasTreeStructure(t))throw new Error("Tree structure not found for treeKey: "+t)}hasTreeStructure(t){return this.treeIndices.has(t)}attachTreeStructure(t){this.treeIndices.has(t)||(this.treeIndices.set(t,{parentMap:new Map,childrenMap:new Map}),this.batch(()=>{this.changes.push({type:"TreeStructureAttached",treeKey:t})}))}detachTreeStructure(t){this.checkTreeExistence(t),this.treeIndices.delete(t),this.batch(()=>{this.changes.push({type:"TreeStructureDetached",treeKey:t})})}addTree(r,i){this.batch(()=>{this.attachTreeStructure(i);for(var t=[],e=Array.isArray(r)?r:[r];e.length;){var n=e.shift();t.push(n),n.children&&e.push(...n.children)}this.addNodes(t),t.forEach(e=>{e.children?.forEach(t=>{this.setParent(t.id,e.id,i)})})})}getRoots(e){return this.checkTreeExistence(e),this.getAllNodes().filter(t=>!this.getParent(t.id,e))}getChildren(t,e){this.checkNodeExistence(t),this.checkTreeExistence(e);e=this.treeIndices.get(e).childrenMap.get(t);return Array.from(e||[])}getParent(t,e){return this.checkNodeExistence(t),this.checkTreeExistence(e),this.treeIndices.get(e).parentMap.get(t)||null}getAncestors(t,e){var n,r=[];let i=this.getNode(t);for(;n=this.getParent(i.id,e);)r.push(n),i=n;return r}setParent(t,e,n){this.checkTreeExistence(n);var r=this.treeIndices.get(n),i=this.getNode(t);const o=r.parentMap.get(t),a=this.getNode(e);r.parentMap.set(t,a),o&&r.childrenMap.get(o.id)?.delete(i);let s=r.childrenMap.get(a.id);s||(s=new Set,r.childrenMap.set(a.id,s)),s.add(i),this.batch(()=>{this.changes.push({type:"TreeStructureChanged",treeKey:n,nodeId:t,oldParentId:o?.id,newParentId:a.id})})}dfsTree(t,e,n){return dy(this.getNode(t),new Set,e,t=>this.getChildren(t,n))}bfsTree(t,e,n){return hy([this.getNode(t)],new Set,e,t=>this.getChildren(t,n))}getAllNodes(){return Array.from(this.nodeMap.values())}getAllEdges(){return Array.from(this.edgeMap.values())}bfs(t,e,n="out"){n={in:this.getPredecessors.bind(this),out:this.getSuccessors.bind(this),both:this.getNeighbors.bind(this)}[n];return hy([this.getNode(t)],new Set,e,n)}dfs(t,e,n="out"){n={in:this.getPredecessors.bind(this),out:this.getSuccessors.bind(this),both:this.getNeighbors.bind(this)}[n];return dy(this.getNode(t),new Set,e,n)}clone(){var t=this.getAllNodes().map(t=>({...t,data:{...t.data}})),e=this.getAllEdges().map(t=>({...t,data:{...t.data}}));const o=new fy({nodes:t,edges:e});return this.treeIndices.forEach(({parentMap:t,childrenMap:e},n)=>{const r=new Map,i=(t.forEach((t,e)=>{r.set(e,o.getNode(t.id))}),new Map);e.forEach((t,e)=>{i.set(e,new Set(Array.from(t).map(t=>o.getNode(t.id))))}),o.treeIndices.set(n,{parentMap:r,childrenMap:i})}),o}toJSON(){return JSON.stringify({nodes:this.getAllNodes(),edges:this.getAllEdges()})}}function py(t){for(var e=[],n=t.length,r=0;r<n;r+=1){e[r]=[];for(var i=0;i<n;i+=1)r===i?e[r][i]=0:0!==t[r][i]&&t[r][i]?e[r][i]=t[r][i]:e[r][i]=1/0}for(var o=0;o<n;o+=1)for(r=0;r<n;r+=1)for(i=0;i<n;i+=1)e[r][i]>e[r][o]+e[o][i]&&(e[r][i]=e[r][o]+e[o][i]);return e}function gy(t,n){var e=t.nodes,t=t.edges,r=[],i={};if(e)return e&&e.forEach(function(t,e){i[t.id]=e;r.push([])}),null!=t&&t.forEach(function(t){var e=t.source,t=t.target,e=i[e],t=i[t];void 0===e||void 0===t||(r[e][t]=1,n)||(r[t][e]=1)}),r;throw new Error("invalid nodes data!")}var my=Array.isArray,vy=function(t,e){return Math.sqrt((t.x-e.x)*(t.x-e.x)+(t.y-e.y)*(t.y-e.y))},yy=function(e){var n,r;return null===e?e:e instanceof Date?new Date(e.getTime()):e instanceof Array?(n=[],e.forEach(function(t){n.push(t)}),n.map(function(t){return yy(t)})):"object"==typeof e?(r={},Object.keys(e).forEach(function(t){r[t]=yy(e[t])}),r):e},Ey=function(t,e){t=yy(t);return t.data=t.data||{},e&&(B(t.data.x)||(t.data.x=Math.random()*e[0]),B(t.data.y)||(t.data.y=Math.random()*e[1])),t};function _y(t,e){var n=Ne(e)?e:B(e)?function(){return e}:function(){return t};return n}function by(e,n,r){return void 0===r&&(r=!0),n||0===n?Ne(n)?n:B(n)?function(){return n}:my(n)?function(){var t;return r?(t=Math.max.apply(Math,O([],D(n))),isNaN(t)?e:t):n}:Ie(n)?function(){var t;return r?(t=Math.max(n.width,n.height),isNaN(t)?e:t):[n.width,n.height]}:function(){return e}:function(t){t=(t.data||{}).size;return t?my(t)?t[0]>t[1]?t[0]:t[1]:Ie(t)?t.width>t.height?t.width:t.height:t:e}}function xy(e,t){var n=B(t)?function(){return t}:Ne(t)?t:function(){return 0},r=e?my(e)?function(t){return(e[0]>e[1]?e[0]:e[1])+n(t)}:function(t){return e+n(t)}:function(t){var e;return null!=(e=t.data)&&e.bboxSize?Math.max(t.data.bboxSize[0],t.data.bboxSize[1])+n(t):null!=(e=t.data)&&e.size?my(t.data.size)?Math.max(t.data.size[0],t.data.size[1])+n(t):(e=t.data.size,Ie(e)?(e.width>e.height?e.width:e.height)+n(t):e+n(t)):10+n(t)};return r}function Sy(t,e,n){var r=t.getAllNodes(),i=t.getAllEdges();return null!=r&&r.length?1===r.length?(e&&t.mergeNodeData(r[0].id,{x:n[0],y:n[1]}),{nodes:[k(k({},r[0]),{data:k(k({},r[0].data),{x:n[0],y:n[1]})})],edges:i}):void 0:{nodes:[],edges:i}}var wy={radius:null,startRadius:null,endRadius:null,startAngle:0,endAngle:2*Math.PI,clockwise:!0,divisions:1,ordering:null,angleRatio:1},t=(Ty.prototype.execute=function(e,n){return s(this,void 0,void 0,function(){return U(this,function(t){return[2,this.genericCircularLayout(!1,e,n)]})})},Ty.prototype.assign=function(e,n){return s(this,void 0,void 0,function(){return U(this,function(t){switch(t.label){case 0:return[4,this.genericCircularLayout(!0,e,n)];case 1:return t.sent(),[2]}})})},Ty.prototype.genericCircularLayout=function(O,I,L){return s(this,void 0,void 0,function(){var e,i,o,a,s,l,u,c,h,d,f,p,g,m,v,y,E,_,b,x,S,w,T,A,M,R,N,C,P;return U(this,function(t){if(e=k(k({},this.options),L),y=e.width,p=e.height,g=e.center,i=e.divisions,s=e.startAngle,o=void 0===s?0:s,s=e.endAngle,a=void 0===s?2*Math.PI:s,s=e.angleRatio,l=e.ordering,u=e.clockwise,c=e.nodeSpacing,h=e.nodeSize,d=I.getAllNodes(),f=I.getAllEdges(),y=D(My(y,p,g),3),p=y[0],g=y[1],m=y[2],!(v=null==d?void 0:d.length)||1===v)return[2,Sy(I,O,m)];var n,r;for(y=(a-o)/v,E=e.radius,_=e.startRadius,b=e.endRadius,c?(x=_y(10,c),S=by(10,h),w=-1/0,d.forEach(function(t){t=S(t);w<t&&(w=t)}),T=0,d.forEach(function(t,e){T+=0===e?w||10:(x(t)||0)+(w||10)}),E=T/(2*Math.PI)):E||_||b?!_&&b?_=b:_&&!b&&(b=_):E=Math.min(g,p)/2,A=y*s,M=[],M="topology"===l?Ay(I,d):"topology-directed"===l?Ay(I,d,!0):"degree"===l?(n=I,r=[],d.forEach(function(t,e){r.push(Ey(t))}),r.sort(function(t,e){return n.getDegree(t.id,"both")-n.getDegree(e.id,"both")}),r):d.map(function(t){return Ey(t)}),R=Math.ceil(v/i),N=0;N<v;++N)C=(C=(C=E)||null===_||null===b?C:_+N*(b-_)/(v-1))||10+100*N/(v-1),P=o+N%R*A+2*Math.PI/i*Math.floor(N/R),u||(P=a-N%R*A-2*Math.PI/i*Math.floor(N/R)),M[N].data.x=m[0]+Math.cos(P)*C,M[N].data.y=m[1]+Math.sin(P)*C;return O&&M.forEach(function(t){I.mergeNodeData(t.id,{x:t.data.x,y:t.data.y})}),[2,{nodes:M,edges:f}]})})},Ty);function Ty(t){this.options=t=void 0===t?{}:t,this.id="circular",this.options=k(k({},wy),t)}var Ay=function(s,l,u){void 0===u&&(u=!1);var c=[Ey(l[0])],h={},d=l.length,f=(h[l[0].id]=!0,0);return l.forEach(function(t,e){if(0!==e)if(e!==d-1&&s.getDegree(t.id,"both")===s.getDegree(l[e+1].id,"both")&&!s.areNeighbors(c[f].id,t.id)||h[t.id]){for(var n=u?s.getSuccessors(c[f].id):s.getNeighbors(c[f].id),r=!1,i=0;i<n.length;i++){var o=n[i];if(s.getDegree(o.id)===s.getDegree(t.id)&&!h[o.id]){c.push(Ey(o)),r=h[o.id]=!0;break}}for(var a=0;!r&&(h[l[a].id]||(c.push(Ey(l[a])),r=h[l[a].id]=!0),++a!==d););}else c.push(Ey(t)),h[t.id]=!0,f++}),c};var My=function(t,e,n){var r=t;return[r=t||"undefined"==typeof window?t:window.innerWidth,e=e||"undefined"==typeof window?e:window.innerHeight,n=n||[r/2,e/2]]};const Ry=Symbol("Comlink.proxy"),Ny=Symbol("Comlink.endpoint"),Cy=Symbol("Comlink.releaseProxy"),Py=Symbol("Comlink.finalizer"),Oy=Symbol("Comlink.thrown"),Iy=t=>"object"==typeof t&&null!==t||"function"==typeof t,Ly=new Map([["proxy",{canHandle:t=>Iy(t)&&t[Ry],serialize(t){var{port1:e,port2:n}=new MessageChannel;return function d(f,p=globalThis,e=["*"]){p.addEventListener("message",function r(t){if(t&&t.data)if(ky(e,t.origin)){const{id:i,type:o,path:n}=Object.assign({path:[]},t.data),a=(t.data.argumentList||[]).map(qy);let e;try{const s=n.slice(0,-1).reduce((t,e)=>t[e],f),l=n.reduce((t,e)=>t[e],f);switch(o){case"GET":e=l;break;case"SET":s[n.slice(-1)[0]]=qy(t.data.value),e=!0;break;case"APPLY":e=l.apply(s,a);break;case"CONSTRUCT":{const u=new l(...a);e=Yy(u)}break;case"ENDPOINT":{const{port1:c,port2:h}=new MessageChannel;d(f,h),e=Xy(c,[c])}break;case"RELEASE":e=void 0;break;default:return}}catch(t){e={value:t,[Oy]:0}}Promise.resolve(e).catch(t=>({value:t,[Oy]:0})).then(t=>{const[e,n]=Ky(t);p.postMessage(Object.assign(Object.assign({},e),{id:i}),n),"RELEASE"===o&&(p.removeEventListener("message",r),Dy(p),Py in f)&&"function"==typeof f[Py]&&f[Py]()}).catch(t=>{const[e,n]=Ky({value:new TypeError("Unserializable return value"),[Oy]:0});p.postMessage(Object.assign(Object.assign({},e),{id:i}),n)})}else console.warn(`Invalid origin '${t.origin}' for comlink proxy`)});p.start&&p.start()}(t,e),[n,[n]]},deserialize(t){return t.start(),By(t)}}],["throw",{canHandle:t=>Iy(t)&&Oy in t,serialize({value:t}){let e;return[e=t instanceof Error?{isError:!0,value:{message:t.message,name:t.name,stack:t.stack}}:{isError:!1,value:t},[]]},deserialize(t){if(t.isError)throw Object.assign(new Error(t.value.message),t.value);throw t.value}}]]);function ky(t,e){for(const n of t){if(e===n||"*"===n)return!0;if(n instanceof RegExp&&n.test(e))return!0}return!1}function Dy(t){"MessagePort"===t.constructor.name&&t.close()}function By(t,e){return function a(s,l=[],t=function(){}){let u=!1;const r=new Proxy(t,{get(t,e){if(Fy(u),e===Cy)return()=>{jy(r),Uy(s),u=!0};if("then"!==e)return a(s,[...l,e]);{if(0===l.length)return{then:()=>r};const n=$y(s,{type:"GET",path:l.map(t=>t.toString())}).then(qy);return n.then.bind(n)}},set(t,e,n){Fy(u);const[r,i]=Ky(n);return $y(s,{type:"SET",path:[...l,e].map(t=>t.toString()),value:r},i).then(qy)},apply(t,e,n){Fy(u);const r=l[l.length-1];if(r===Ny)return $y(s,{type:"ENDPOINT"}).then(qy);if("bind"===r)return a(s,l.slice(0,-1));const[i,o]=zy(n);return $y(s,{type:"APPLY",path:l.map(t=>t.toString()),argumentList:i},o).then(qy)},construct(t,e){Fy(u);const[n,r]=zy(e);return $y(s,{type:"CONSTRUCT",path:l.map(t=>t.toString()),argumentList:n},r).then(qy)}});Vy(r,s);return r}(t,[],e)}function Fy(t){if(t)throw new Error("Proxy has been released and is not useable")}function Uy(t){return $y(t,{type:"RELEASE"}).then(()=>{Dy(t)})}const Gy=new WeakMap,Wy="FinalizationRegistry"in globalThis&&new FinalizationRegistry(t=>{var e=(Gy.get(t)||0)-1;Gy.set(t,e),0==e&&Uy(t)});function Vy(t,e){var n=(Gy.get(e)||0)+1;Gy.set(e,n),Wy&&Wy.register(t,e,t)}function jy(t){Wy&&Wy.unregister(t)}function zy(t){var t=t.map(Ky);return[t.map(t=>t[0]),(t=t.map(t=>t[1]),Array.prototype.concat.apply([],t))]}const Hy=new WeakMap;function Xy(t,e){return Hy.set(t,e),t}function Yy(t){return Object.assign(t,{[Ry]:!0})}function Ky(t){for(var[e,n]of Ly){var r;if(n.canHandle(t))return[n,r]=n.serialize(t),[{type:"HANDLER",name:e,value:n},r]}return[{type:"RAW",value:t},Hy.get(t)||[]]}function qy(t){switch(t.type){case"HANDLER":return Ly.get(t.name).deserialize(t.value);case"RAW":return t.value}}function $y(i,t,e){return new Promise(n=>{const r=new Array(4).fill(0).map(()=>Math.floor(Math.random()*Number.MAX_SAFE_INTEGER).toString(16)).join("-");i.addEventListener("message",function t(e){e.data&&e.data.id&&e.data.id===r&&(i.removeEventListener("message",t),n(e.data))}),i.start&&i.start(),i.postMessage(Object.assign({id:r},t),e)})}P(Jy,Zy=G),Jy.prototype.spawnWorker=function(){this.worker&&this.worker.terminate(),this.worker=By(new Worker(new URL("./worker.js","undefined"==typeof document&&"undefined"==typeof location?new(require("url").URL)("file:"+__filename).href:"undefined"==typeof document?location.href:document.currentScript&&document.currentScript.src||new URL("g6.min.js",document.baseURI).href),{type:"module"})),this.running&&(this.running=!1,this.execute())},Jy.prototype.execute=function(){var r;return s(this,void 0,void 0,function(){var e,n;return U(this,function(t){switch(t.label){case 0:return this.running?[2,this]:(this.running=!0,(n=this.layout.options).onTick,n=I(n,["onTick"]),n={layout:{id:this.layout.id,options:n,iterations:null==(r=this.options)?void 0:r.iterations},nodes:this.graph.getAllNodes(),edges:this.graph.getAllEdges()},e=new Float32Array([0]),[4,this.worker.calculateLayout(n,[e])]);case 1:return n=D.apply(void 0,[t.sent(),1]),[2,n[0]]}})})},Jy.prototype.stop=function(){return this.running=!1,this.worker.stopLayout(),this},Jy.prototype.kill=function(){},Jy.prototype.isRunning=function(){return this.running};var Zy,Qy=Jy;function Jy(t,e,n){var r=Zy.call(this)||this;return r.graph=t,r.layout=e,r.options=n,r.spawnWorker(),r}var t1={nodeSize:30,nodeSpacing:10,preventOverlap:!1,sweep:void 0,equidistant:!1,startAngle:1.5*Math.PI,clockwise:!0,maxLevelDiff:void 0,sortBy:"degree"},e1=(n1.prototype.execute=function(e,n){return s(this,void 0,void 0,function(){return U(this,function(t){return[2,this.genericConcentricLayout(!1,e,n)]})})},n1.prototype.assign=function(e,n){return s(this,void 0,void 0,function(){return U(this,function(t){return this.genericConcentricLayout(!0,e,n),[2]})})},n1.prototype.genericConcentricLayout=function(N,C,P){return s(this,void 0,void 0,function(){var e,r,i,n,o,a,s,l,u,c,h,d,f,p,g,m,v,y,E,_,b,x,S,w,T,A,M,R;return U(this,function(t){if(x=k(k({},this.options),P),m=x.center,u=x.width,c=x.height,S=x.sortBy,e=x.maxLevelDiff,r=x.sweep,i=x.clockwise,n=x.equidistant,o=x.preventOverlap,b=x.startAngle,a=void 0===b?1.5*Math.PI:b,b=x.nodeSize,s=x.nodeSpacing,x=C.getAllNodes(),l=C.getAllEdges(),u=u||"undefined"==typeof window?u:window.innerWidth,c=c||"undefined"==typeof window?c:window.innerHeight,h=m||[u/2,c/2],null==x||!x.length||1===x.length)return[2,Sy(C,N,h)];if(d=[],p=0,f=my(b)?Math.max(b[0],b[1]):b,my(s)?p=Math.max(s[0],s[1]):B(s)&&(p=s),x.forEach(function(t){var e=Ey(t),n=(d.push(e),f),e=e.data;my(e.size)?n=Math.max(e.size[0],e.size[1]):B(e.size)?n=e.size:Ie(e.size)&&(n=Math.max(e.size.width,e.size.height)),f=Math.max(f,n),Ne(s)&&(p=Math.max(s(t),p))}),d.forEach(function(t,e){t.id,e}),Fe(g=S)&&void 0!==d[0].data[g]||(g="degree"),d.sort("degree"===g?function(t,e){return C.getDegree(e.id,"both")-C.getDegree(t.id,"both")}:function(t,e){return e.data[g]-t.data[g]}),m=d[0],v=(e||("degree"===g?C.getDegree(m.id,"both"):m.data[g]))/4,E=(y=[{nodes:[]}])[0],d.forEach(function(t){var e;0<E.nodes.length&&(e="degree"===g?Math.abs(C.getDegree(E.nodes[0].id,"both")-C.getDegree(t.id,"both")):Math.abs(E.nodes[0].data[g]-t.data[g]),v)&&v<=e&&(E={nodes:[]},y.push(E)),E.nodes.push(t)}),_=f+p,o||(b=0<y.length&&1<y[0].nodes.length,x=Math.min(u,c)/2-_,S=x/(y.length+(b?1:0)),_=Math.min(_,S)),w=0,y.forEach(function(t){var e,n=void 0===r?2*Math.PI-2*Math.PI/t.nodes.length:r;t.dTheta=n/Math.max(1,t.nodes.length-1),1<t.nodes.length&&o&&(n=Math.cos(t.dTheta)-Math.cos(0),e=Math.sin(t.dTheta)-Math.sin(0),n=Math.sqrt(_*_/(n*n+e*e)),w=Math.max(n,w)),t.r=w,w+=_}),n){for(M=A=T=0;M<y.length;M++)R=(y[M].r||0)-A,T=Math.max(T,R);A=0,y.forEach(function(t,e){0===e&&(A=t.r||0),t.r=A,A+=T})}return y.forEach(function(t){var n=t.dTheta||0,r=t.r||0;t.nodes.forEach(function(t,e){e=a+(i?1:-1)*n*e;t.data.x=h[0]+r*Math.cos(e),t.data.y=h[1]+r*Math.sin(e)})}),N&&d.forEach(function(t){return C.mergeNodeData(t.id,{x:t.data.x,y:t.data.y})}),[2,{nodes:d,edges:l}]})})},n1);function n1(t){this.options=t=void 0===t?{}:t,this.id="concentric",this.options=k(k({},t1),t)}function r1(t,e,n,r){if(!isNaN(e)&&!isNaN(n)){var i,o,a,s,l,u,c,h,d,f=t._root,p={data:r},g=t._x0,m=t._y0,v=t._x1,y=t._y1;if(f){for(;f.length;)if((u=e>=(o=(g+v)/2))?g=o:v=o,(c=n>=(a=(m+y)/2))?m=a:y=a,!(f=(i=f)[h=c<<1|u]))return i[h]=p,t;if(s=+t._x.call(null,f.data),l=+t._y.call(null,f.data),e===s&&n===l)p.next=f,i?i[h]=p:t._root=p;else{for(;i=i?i[h]=new Array(4):t._root=new Array(4),(u=e>=(o=(g+v)/2))?g=o:v=o,(c=n>=(a=(m+y)/2))?m=a:y=a,(h=c<<1|u)==(d=(a<=l)<<1|o<=s););i[d]=f,i[h]=p}}else t._root=p}return t}function i1(t,e,n,r,i){this.node=t,this.x0=e,this.y0=n,this.x1=r,this.y1=i}function o1(t){return t[0]}function a1(t){return t[1]}function s1(t,e,n){e=new l1(null==e?o1:e,null==n?a1:n,NaN,NaN,NaN,NaN);return null==t?e:e.addAll(t)}function l1(t,e,n,r,i,o){this._x=t,this._y=e,this._x0=n,this._y0=r,this._x1=i,this._y1=o,this._root=void 0}function u1(t){for(var e={data:t.data},n=e;t=t.next;)n=n.next={data:t.data};return e}e=s1.prototype=l1.prototype;function c1(t){return function(){return t}}function h1(t){return 1e-6*(t()-.5)}function d1(t){return t.x+t.vx}function f1(t){return t.y+t.vy}function p1(r){var o,a,d,f=1,p=1;function e(){for(var t,e,s,l,u,c,h,n=o.length,r=0;r<p;++r)for(e=s1(o,d1,f1).visitAfter(g),t=0;t<n;++t)s=o[t],c=a[s.index],h=c*c,l=s.x+s.vx,u=s.y+s.vy,e.visit(i);function i(t,e,n,r,i){var o=t.data,t=t.r,a=c+t;if(!o)return l+a<e||r<l-a||u+a<n||i<u-a;o.index>s.index&&(n=(e=l-o.x-o.vx)*e+(r=u-o.y-o.vy)*r)<a*a&&(0===e&&(n+=(e=h1(d))*e),0===r&&(n+=(r=h1(d))*r),n=(a-(n=Math.sqrt(n)))/n*f,s.vx+=(e*=n)*(a=(t*=t)/(h+t)),s.vy+=(r*=n)*a,o.vx-=e*(a=1-a),o.vy-=r*a)}}function g(t){if(t.data)return t.r=a[t.data.index];for(var e=t.r=0;e<4;++e)t[e]&&t[e].r>t.r&&(t.r=t[e].r)}function n(){if(o){var t,e,n=o.length;for(a=new Array(n),t=0;t<n;++t)e=o[t],a[e.index]=+r(e,t,o)}}return"function"!=typeof r&&(r=c1(null==r?1:+r)),e.initialize=function(t,e){o=t,d=e,n()},e.iterations=function(t){return arguments.length?(p=+t,e):p},e.strength=function(t){return arguments.length?(f=+t,e):f},e.radius=function(t){return arguments.length?(r="function"==typeof t?t:c1(+t),n(),e):r},e}function g1(t){return t.index}function m1(t,e){t=t.get(e);if(t)return t;throw new Error("node not found: "+e)}function v1(u){var c,h,o,a,d,f,s=g1,n=function(t){return 1/Math.min(a[t.source.index],a[t.target.index])},r=c1(30),p=1;function e(t){for(var e=0,n=u.length;e<p;++e)for(var r,i,o,a,s,l=0;l<n;++l)r=(i=u[l]).source,o=(i=i.target).x+i.vx-r.x-r.vx||h1(f),a=i.y+i.vy-r.y-r.vy||h1(f),o*=s=((s=Math.sqrt(o*o+a*a))-h[l])/s*t*c[l],a*=s,i.vx-=o*(s=d[l]),i.vy-=a*s,r.vx+=o*(s=1-s),r.vy+=a*s}function i(){if(o){var t,e=o.length,n=u.length,r=new Map(o.map((t,e)=>[s(t,e,o),t])),i=0;for(a=new Array(e);i<n;++i)(t=u[i]).index=i,"object"!=typeof t.source&&(t.source=m1(r,t.source)),"object"!=typeof t.target&&(t.target=m1(r,t.target)),a[t.source.index]=(a[t.source.index]||0)+1,a[t.target.index]=(a[t.target.index]||0)+1;for(i=0,d=new Array(n);i<n;++i)t=u[i],d[i]=a[t.source.index]/(a[t.source.index]+a[t.target.index]);c=new Array(n),l(),h=new Array(n),g()}}function l(){if(o)for(var t=0,e=u.length;t<e;++t)c[t]=+n(u[t],t,u)}function g(){if(o)for(var t=0,e=u.length;t<e;++t)h[t]=+r(u[t],t,u)}return null==u&&(u=[]),e.initialize=function(t,e){o=t,f=e,i()},e.links=function(t){return arguments.length?(u=t,i(),e):u},e.id=function(t){return arguments.length?(s=t,e):s},e.iterations=function(t){return arguments.length?(p=+t,e):p},e.strength=function(t){return arguments.length?(n="function"==typeof t?t:c1(+t),l(),e):n},e.distance=function(t){return arguments.length?(r="function"==typeof t?t:c1(+t),g(),e):r},e}e.copy=function(){var t,e,n=new l1(this._x,this._y,this._x0,this._y0,this._x1,this._y1),r=this._root;if(r)if(r.length)for(t=[{source:r,target:n._root=new Array(4)}];r=t.pop();)for(var i=0;i<4;++i)(e=r.source[i])&&(e.length?t.push({source:e,target:r.target[i]=new Array(4)}):r.target[i]=u1(e));else n._root=u1(r);return n},e.add=function(t){var e=+this._x.call(null,t),n=+this._y.call(null,t);return r1(this.cover(e,n),e,n,t)},e.addAll=function(t){for(var e,n,r=t.length,i=new Array(r),o=new Array(r),a=1/0,s=1/0,l=-1/0,u=-1/0,c=0;c<r;++c)isNaN(e=+this._x.call(null,n=t[c]))||isNaN(n=+this._y.call(null,n))||((i[c]=e)<a&&(a=e),l<e&&(l=e),(o[c]=n)<s&&(s=n),u<n&&(u=n));if(!(l<a||u<s))for(this.cover(a,s).cover(l,u),c=0;c<r;++c)r1(this,i[c],o[c],t[c]);return this},e.cover=function(t,e){if(!isNaN(t=+t)&&!isNaN(e=+e)){var n=this._x0,r=this._y0,i=this._x1,o=this._y1;if(isNaN(n))i=(n=Math.floor(t))+1,o=(r=Math.floor(e))+1;else{for(var a,s,l=i-n||1,u=this._root;t<n||i<=t||e<r||o<=e;)switch(s=(e<r)<<1|t<n,(a=new Array(4))[s]=u,u=a,l*=2,s){case 0:i=n+l,o=r+l;break;case 1:n=i-l,o=r+l;break;case 2:i=n+l,r=o-l;break;case 3:n=i-l,r=o-l}this._root&&this._root.length&&(this._root=u)}this._x0=n,this._y0=r,this._x1=i,this._y1=o}return this},e.data=function(){var e=[];return this.visit(function(t){if(!t.length)for(;e.push(t.data),t=t.next;);}),e},e.extent=function(t){return arguments.length?this.cover(+t[0][0],+t[0][1]).cover(+t[1][0],+t[1][1]):isNaN(this._x0)?void 0:[[this._x0,this._y0],[this._x1,this._y1]]},e.find=function(t,e,n){var r,i,o,a,s,l,u,c,h=this._x0,d=this._y0,f=this._x1,p=this._y1,g=[],m=this._root;for(m&&g.push(new i1(m,h,d,f,p)),null==n?n=1/0:(h=t-n,d=e-n,f=t+n,p=e+n,n*=n);r=g.pop();)!(m=r.node)||(s=r.x0)>f||(l=r.y0)>p||(a=r.x1)<h||(i=r.y1)<d||(m.length?(g.push(new i1(m[3],o=(s+a)/2,u=(l+i)/2,a,i),new i1(m[2],s,u,o,i),new i1(m[1],o,l,a,u),new i1(m[0],s,l,o,u)),(i=(u<=e)<<1|o<=t)&&(r=g[g.length-1],g[g.length-1]=g[g.length-1-i],g[g.length-1-i]=r)):(l=(a=t-+this._x.call(null,m.data))*a+(s=e-+this._y.call(null,m.data))*s)<n&&(h=t-(u=Math.sqrt(n=l)),d=e-u,f=t+u,p=e+u,c=m.data));return c},e.remove=function(t){if(!isNaN(o=+this._x.call(null,t))&&!isNaN(a=+this._y.call(null,t))){var e,n,r,i,o,a,s,l,u,c,h,d=this._root,f=this._x0,p=this._y0,g=this._x1,m=this._y1;if(d){if(d.length)for(;;){if((l=o>=(s=(f+g)/2))?f=s:g=s,(u=a>=(s=(p+m)/2))?p=s:m=s,!(d=(e=d)[c=u<<1|l]))return this;if(!d.length)break;(e[c+1&3]||e[c+2&3]||e[c+3&3])&&(n=e,h=c)}for(;d.data!==t;)if(!(d=(r=d).next))return this;(i=d.next)&&delete d.next,r?i?r.next=i:delete r.next:e?(i?e[c]=i:delete e[c],(d=e[0]||e[1]||e[2]||e[3])&&d===(e[3]||e[2]||e[1]||e[0])&&!d.length&&(n?n[h]=d:this._root=d)):this._root=i}}return this},e.removeAll=function(t){for(var e=0,n=t.length;e<n;++e)this.remove(t[e]);return this},e.root=function(){return this._root},e.size=function(){var e=0;return this.visit(function(t){if(!t.length)for(;++e,t=t.next;);}),e},e.visit=function(t){var e,n,r,i,o,a,s,l=[],u=this._root;for(u&&l.push(new i1(u,this._x0,this._y0,this._x1,this._y1));o=l.pop();)!t(u=o.node,n=o.x0,r=o.y0,i=o.x1,o=o.y1)&&u.length&&(a=(n+i)/2,s=(r+o)/2,(e=u[3])&&l.push(new i1(e,a,s,i,o)),(e=u[2])&&l.push(new i1(e,n,s,a,o)),(e=u[1])&&l.push(new i1(e,a,r,i,s)),e=u[0])&&l.push(new i1(e,n,r,a,s));return this},e.visitAfter=function(t){var e,n=[],r=[];for(this._root&&n.push(new i1(this._root,this._x0,this._y0,this._x1,this._y1));e=n.pop();){var i,o,a,s,l,u,c,h=e.node;h.length&&(o=e.x0,a=e.y0,u=(o+(s=e.x1))/2,c=(a+(l=e.y1))/2,(i=h[0])&&n.push(new i1(i,o,a,u,c)),(i=h[1])&&n.push(new i1(i,u,a,s,c)),(i=h[2])&&n.push(new i1(i,o,c,u,l)),i=h[3])&&n.push(new i1(i,u,c,s,l)),r.push(e)}for(;e=r.pop();)t(e.node,e.x0,e.y0,e.x1,e.y1);return this},e.x=function(t){return arguments.length?(this._x=t,this):this._x},e.y=function(t){return arguments.length?(this._y=t,this):this._y};var y1={value:()=>{}};function E1(){for(var t,e=0,n=arguments.length,r={};e<n;++e){if(!(t=arguments[e]+"")||t in r||/[\s.]/.test(t))throw new Error("illegal type: "+t);r[t]=[]}return new _1(r)}function _1(t){this._=t}function b1(t,e,n){for(var r=0,i=t.length;r<i;++r)if(t[r].name===e){t[r]=y1,t=t.slice(0,r).concat(t.slice(r+1));break}return null!=n&&t.push({name:e,value:n}),t}_1.prototype=E1.prototype={constructor:_1,on:function(t,e){var n,r,i=this._,o=(r=i,(t+"").trim().split(/^|\s+/).map(function(t){var e="",n=t.indexOf(".");if(0<=n&&(e=t.slice(n+1),t=t.slice(0,n)),t&&!r.hasOwnProperty(t))throw new Error("unknown type: "+t);return{type:t,name:e}})),a=-1,s=o.length;if(!(arguments.length<2)){if(null!=e&&"function"!=typeof e)throw new Error("invalid callback: "+e);for(;++a<s;)if(n=(t=o[a]).type)i[n]=b1(i[n],t.name,e);else if(null==e)for(n in i)i[n]=b1(i[n],t.name,null);return this}for(;++a<s;)if(n=(n=(t=o[a]).type)&&function(t,e){for(var n,r=0,i=t.length;r<i;++r)if((n=t[r]).name===e)return n.value}(i[n],t.name))return n},copy:function(){var t,e={},n=this._;for(t in n)e[t]=n[t].slice();return new _1(e)},call:function(t,e){if(0<(n=arguments.length-2))for(var n,r,i=new Array(n),o=0;o<n;++o)i[o]=arguments[o+2];if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(o=0,n=(r=this._[t]).length;o<n;++o)r[o].value.apply(e,i)},apply:function(t,e,n){if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(var r=this._[t],i=0,o=r.length;i<o;++i)r[i].value.apply(e,n)}};var x1,S1,w1=0,T1=0,A1=0,M1=1e3,R1=0,N1=0,C1=0,P1="object"==typeof performance&&performance.now?performance:Date,O1="object"==typeof window&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(t){setTimeout(t,17)};function I1(){return N1||(O1(L1),N1=P1.now()+C1)}function L1(){N1=0}function k1(){this._call=this._time=this._next=null}function D1(t,e,n){var r=new k1;return r.restart(t,e,n),r}function B1(){N1=(R1=P1.now())+C1,w1=T1=0;try{I1(),++w1;for(var t,e=x1;e;)0<=(t=N1-e._time)&&e._call.call(void 0,t),e=e._next;--w1}finally{for(var n,r,i=x1,o=1/(w1=0);i;)i=i._call?(o>i._time&&(o=i._time),(n=i)._next):(r=i._next,i._next=null,n?n._next=r:x1=r);S1=n,U1(o),N1=0}}function F1(){var t=P1.now(),e=t-R1;M1<e&&(C1-=e,R1=t)}function U1(t){w1||(T1=T1&&clearTimeout(T1),24<t-N1?(t<1/0&&(T1=setTimeout(B1,t-P1.now()-C1)),A1=A1&&clearInterval(A1)):(A1||(R1=P1.now(),A1=setInterval(F1,M1)),w1=1,O1(B1)))}k1.prototype=D1.prototype={constructor:k1,restart:function(t,e,n){if("function"!=typeof t)throw new TypeError("callback is not a function");n=(null==n?I1():+n)+(null==e?0:+e),this._next||S1===this||(S1?S1._next=this:x1=this,S1=this),this._call=t,this._time=n,U1()},stop:function(){this._call&&(this._call=null,this._time=1/0,U1())}};const G1=1664525,W1=1013904223,V1=4294967296;function j1(t){return t.x}function z1(t){return t.y}var H1=10,X1=Math.PI*(3-Math.sqrt(5));function Y1(l){var o,a=1,e=.001,s=1-Math.pow(e,1/300),u=0,c=.6,h=new Map,t=D1(i),n=E1("tick","end"),r=function(){let t=1;return()=>(t=(G1*t+W1)%V1)/V1}();function i(){d(),n.call("tick",o),a<e&&(t.stop(),n.call("end",o))}function d(t){var e,n,r=l.length;void 0===t&&(t=1);for(var i=0;i<t;++i)for(a+=(u-a)*s,h.forEach(function(t){t(a)}),e=0;e<r;++e)null==(n=l[e]).fx?n.x+=n.vx*=c:(n.x=n.fx,n.vx=0),null==n.fy?n.y+=n.vy*=c:(n.y=n.fy,n.vy=0);return o}function f(){for(var t,e,n,r=0,i=l.length;r<i;++r)(n=l[r]).index=r,null!=n.fx&&(n.x=n.fx),null!=n.fy&&(n.y=n.fy),(isNaN(n.x)||isNaN(n.y))&&(t=H1*Math.sqrt(.5+r),e=r*X1,n.x=t*Math.cos(e),n.y=t*Math.sin(e)),(isNaN(n.vx)||isNaN(n.vy))&&(n.vx=n.vy=0)}function p(t){return t.initialize&&t.initialize(l,r),t}return null==l&&(l=[]),f(),o={tick:d,restart:function(){return t.restart(i),o},stop:function(){return t.stop(),o},nodes:function(t){return arguments.length?(l=t,f(),h.forEach(p),o):l},alpha:function(t){return arguments.length?(a=+t,o):a},alphaMin:function(t){return arguments.length?(e=+t,o):e},alphaDecay:function(t){return arguments.length?(s=+t,o):+s},alphaTarget:function(t){return arguments.length?(u=+t,o):u},velocityDecay:function(t){return arguments.length?(c=1-t,o):1-c},randomSource:function(t){return arguments.length?(r=t,h.forEach(p),o):r},force:function(t,e){return 1<arguments.length?(null==e?h.delete(t):h.set(t,p(e)),o):h.get(t)},find:function(t,e,n){var r,i,o,a=0,s=l.length;for(null==n?n=1/0:n*=n,a=0;a<s;++a)(r=(r=t-(i=l[a]).x)*r+(r=e-i.y)*r)<n&&(o=i,n=r);return o},on:function(t,e){return 1<arguments.length?(n.on(t,e),o):n.on(t)}}}function K1(){var i,l,u,c,h,r=c1(-30),d=1,f=1/0,p=.81;function e(t){var e,n=i.length,r=s1(i,j1,z1).visitAfter(o);for(c=t,e=0;e<n;++e)l=i[e],r.visit(a)}function n(){if(i){var t,e,n=i.length;for(h=new Array(n),t=0;t<n;++t)e=i[t],h[e.index]=+r(e,t,i)}}function o(t){var e,n,r,i,o,a=0,s=0;if(t.length){for(r=i=o=0;o<4;++o)(e=t[o])&&(n=Math.abs(e.value))&&(a+=e.value,s+=n,r+=n*e.x,i+=n*e.y);t.x=r/s,t.y=i/s}else for((e=t).x=e.data.x,e.y=e.data.y;a+=h[e.data.index],e=e.next;);t.value=a}function a(t,e,n,r){if(!t.value)return!0;var i=t.x-l.x,o=t.y-l.y,a=r-e,s=i*i+o*o;if(a*a/p<s)return s<f&&(0===i&&(s+=(i=h1(u))*i),0===o&&(s+=(o=h1(u))*o),s<d&&(s=Math.sqrt(d*s)),l.vx+=i*t.value*c/s,l.vy+=o*t.value*c/s),!0;if(!(t.length||f<=s))for((t.data!==l||t.next)&&(0===i&&(s+=(i=h1(u))*i),0===o&&(s+=(o=h1(u))*o),s<d)&&(s=Math.sqrt(d*s));t.data!==l&&(a=h[t.data.index]*c/s,l.vx+=i*a,l.vy+=o*a),t=t.next;);}return e.initialize=function(t,e){i=t,u=e,n()},e.strength=function(t){return arguments.length?(r="function"==typeof t?t:c1(+t),n(),e):r},e.distanceMin=function(t){return arguments.length?(d=t*t,e):Math.sqrt(d)},e.distanceMax=function(t){return arguments.length?(f=t*t,e):Math.sqrt(f)},e.theta=function(t){return arguments.length?(p=t*t,e):Math.sqrt(p)},e}function q1(){function e(t){return function(){return t}}var o,s=function(t){return t.cluster},l=e(1),n=e(-1),r=e(100),i=e(.1),a=[0,0],u=[],c={},h=[],d=100,f=100,p={none:{x:0,y:0}},g=[],m="force",v=!0,y=.1;function E(t){if(!v)return E;o.tick(),b();for(var e=0,n=u.length,r=void 0,i=t*y;e<n;++e)(r=u[e]).vx+=(p[s(r)].x-r.x)*i,r.vy+=(p[s(r)].y-r.y)*i}function _(){if(u&&u.length){if(void 0===s(u[0]))throw Error("Couldnt find the grouping attribute for the nodes. Make sure to set it up with forceInBox.groupBy('clusterAttr') before calling .links()");var t=function(){var r=[],i=[],o={},a={},t=[];return a=function(t){var r={};return t.forEach(function(t){t=s(t);r[t]||(r[t]={count:0,sumforceNodeSize:0})}),t.forEach(function(t){var e=s(t),t=l(t),n=r[e];n.count=n.count+1,n.sumforceNodeSize=n.sumforceNodeSize+Math.PI*(t*t)*1.3,r[e]=n}),r}(u),t=function(t){var n={},r=[];return t.forEach(function(t){e=(t=t).source,t=t.target,e=s(c[e]),t=s(c[t]);var t=e<=t?e+"~"+t:t+"~"+e,e=0;void 0!==n[t]&&(e=n[t]),n[t]=e+=1}),Object.entries(n).forEach(function(t){var t=D(t,2),e=t[0],t=t[1],n=e.split("~")[0],e=e.split("~")[1];void 0!==n&&void 0!==e&&r.push({source:n,target:e,count:t})}),r}(h),Object.keys(a).forEach(function(t,e){var n=a[t];r.push({id:t,size:n.count,r:Math.sqrt(n.sumforceNodeSize/Math.PI)}),o[t]=e}),t.forEach(function(t){var e=t.source,n=t.target,e=o[e],n=o[n];void 0!==e&&void 0!==n&&i.push({source:e,target:n,count:t.count})}),{nodes:r,links:i}}();o=Y1(t.nodes).force("x",function(n){var i,o,a,r=c1(.1);function e(t){for(var e,n=0,r=i.length;n<r;++n)(e=i[n]).vx+=(a[n]-e.x)*o[n]*t}function s(){if(i){var t,e=i.length;for(o=new Array(e),a=new Array(e),t=0;t<e;++t)o[t]=isNaN(a[t]=+n(i[t],t,i))?0:+r(i[t],t,i)}}return"function"!=typeof n&&(n=c1(null==n?0:+n)),e.initialize=function(t){i=t,s()},e.strength=function(t){return arguments.length?(r="function"==typeof t?t:c1(+t),s(),e):r},e.x=function(t){return arguments.length?(n="function"==typeof t?t:c1(+t),s(),e):n},e}(d).strength(.1)).force("y",function(n){var i,o,a,r=c1(.1);function e(t){for(var e,n=0,r=i.length;n<r;++n)(e=i[n]).vy+=(a[n]-e.y)*o[n]*t}function s(){if(i){var t,e=i.length;for(o=new Array(e),a=new Array(e),t=0;t<e;++t)o[t]=isNaN(a[t]=+n(i[t],t,i))?0:+r(i[t],t,i)}}return"function"!=typeof n&&(n=c1(null==n?0:+n)),e.initialize=function(t){i=t,s()},e.strength=function(t){return arguments.length?(r="function"==typeof t?t:c1(+t),s(),e):r},e.y=function(t){return arguments.length?(n="function"==typeof t?t:c1(+t),s(),e):n},e}(f).strength(.1)).force("collide",p1(function(t){return t.r}).iterations(4)).force("charge",K1().strength(n)).force("links",v1(t.nodes.length?t.links:[]).distance(r).strength(i)),g=o.nodes(),b()}}function b(){return p={none:{x:0,y:0}},g.forEach(function(t){p[t.id]={x:t.x-a[0],y:t.y-a[1]}}),p}return E.initialize=function(t){u=t,_()},E.template=function(t){return arguments.length?(m=t,_(),E):m},E.groupBy=function(e){return arguments.length?(s="string"==typeof e?function(t){return t[e]}:e,E):s},E.enableGrouping=function(t){return arguments.length?(v=t,E):v},E.strength=function(t){return arguments.length?(y=t,E):y},E.centerX=function(t){return arguments.length?(d=t,E):d},E.centerY=function(t){return arguments.length?(f=t,E):f},E.nodes=function(t){return arguments.length?(c={},(t||[]).forEach(function(t){c[t.id]=t}),u=t||[],E):u},E.links=function(t){return arguments.length?(h=t||[],_(),E):h},E.nodeSize=E.forceNodeSize=function(t){return arguments.length?(l="function"==typeof t?t:e(+t),_(),E):l},E.forceCharge=function(t){return arguments.length?(n="function"==typeof t?t:e(+t),_(),E):n},E.forceLinkDistance=function(t){return arguments.length?(r="function"==typeof t?t:e(+t),_(),E):r},E.forceLinkStrength=function(t){return arguments.length?(i="function"==typeof t?t:e(+t),_(),E):i},E.offset=function(t){return arguments.length?(a=t,E):a},E.getFocis=b,E}var $1={center:[0,0],preventOverlap:!1,nodeSize:void 0,nodeSpacing:void 0,linkDistance:50,forceSimulation:null,alphaDecay:.028,alphaMin:.001,alpha:.3,collideStrength:1,clustering:!1,clusterNodeStrength:-1,clusterEdgeStrength:.1,clusterEdgeDistance:100,clusterFociStrength:.8,clusterNodeSize:10},Us=(Z1.prototype.execute=function(e,n){return s(this,void 0,void 0,function(){return U(this,function(t){return[2,this.genericForceLayout(!1,e,n)]})})},Z1.prototype.assign=function(e,n){return s(this,void 0,void 0,function(){return U(this,function(t){return this.genericForceLayout(!0,e,n),[2]})})},Z1.prototype.stop=function(){var t;null!=(t=this.forceSimulation)&&t.stop()},Z1.prototype.tick=function(t){var e=this,t=(this.forceSimulation.tick(t=void 0===t?1:t),{nodes:tE(this.lastLayoutNodes),edges:eE(this.lastLayoutEdges)});return this.lastAssign&&t.nodes.forEach(function(t){return e.lastGraph.mergeNodeData(t.id,{x:t.data.x,y:t.data.y})}),t},Z1.prototype.genericForceLayout=function(I,L,i){return s(this,void 0,void 0,function(){var e,h,d,f,p,g,m,v,y,E,_,b,x,S,w,n,T,r,A,M,R,N,C,P,O=this;return U(this,function(t){return e=k(k({},this.options),i),n=L.getAllNodes(),r=L.getAllEdges(),h=n.map(function(t){var e;return k(k({},Ey(t)),{x:null==(e=t.data)?void 0:e.x,y:null==(e=t.data)?void 0:e.y})}),d=r.map(function(t){return Ey(t)}),this.lastLayoutNodes=h,this.lastLayoutEdges=d,this.lastAssign=I,this.lastGraph=L,f=e.alphaMin,p=e.alphaDecay,g=e.alpha,m=e.nodeStrength,v=e.edgeStrength,y=e.linkDistance,E=e.clustering,_=e.clusterFociStrength,b=e.clusterEdgeDistance,x=e.clusterEdgeStrength,S=e.clusterNodeStrength,w=e.clusterNodeSize,n=e.collideStrength,T=void 0===n?1:n,r=e.center,A=void 0===r?[0,0]:r,M=e.preventOverlap,R=e.nodeSize,N=e.nodeSpacing,C=e.onTick,P=e.forceSimulation,[2,new Promise(function(e){if(P){E&&((r=q1()).nodes(h),r.links(d)),P.nodes(h),d&&(i=v1().id(function(t){return t.id}).links(d),v&&i.strength(v),y&&i.distance(y),P.force("link",i)),M&&O.overlapProcess(P,{nodeSize:R,nodeSpacing:N,collideStrength:T}),P.alpha(g).restart();var t=tE(h),n=eE(d);I&&t.forEach(function(t){return L.mergeNodeData(t.id,{x:t.data.x,y:t.data.y})}),e({nodes:t,edges:n})}else try{var r,i,o=K1();m&&o.strength(m),P=Y1().nodes(h),E&&((r=q1()).centerX(A[0]).centerY(A[1]).template("force").strength(_),d&&r.links(d),h&&r.nodes(h),r.forceLinkDistance(b).forceLinkStrength(x).forceCharge(S).forceNodeSize(w),P.force("group",r)),P.force("center",(s=A[0],l=A[1],c=1,null==s&&(s=0),null==l&&(l=0),a.initialize=function(t){u=t},a.x=function(t){return arguments.length?(s=+t,a):s},a.y=function(t){return arguments.length?(l=+t,a):l},a.strength=function(t){return arguments.length?(c=+t,a):c},a)).force("charge",o).alpha(g).alphaDecay(p).alphaMin(f),M&&O.overlapProcess(P,{nodeSize:R,nodeSpacing:N,collideStrength:T}),d&&(i=v1().id(function(t){return t.id}).links(d),v&&i.strength(v),y&&i.distance(y),P.force("link",i)),P.on("tick",function(){var t=tE(h);null!=C&&C({nodes:t,edges:eE(d)}),I&&t.forEach(function(t){return L.mergeNodeData(t.id,{x:t.data.x,y:t.data.y})})}).on("end",function(){var t=tE(h);I&&t.forEach(function(t){return L.mergeNodeData(t.id,{x:t.data.x,y:t.data.y})}),e({nodes:t,edges:eE(d)})})}catch(t){console.warn(t)}function a(){for(var t,e=u.length,n=0,r=0,i=0;i<e;++i)n+=(t=u[i]).x,r+=t.y;for(n=(n/e-s)*c,r=(r/e-l)*c,i=0;i<e;++i)(t=u[i]).x-=n,t.y-=r}var s,l,u,c;O.forceSimulation=P})]})})},Z1.prototype.overlapProcess=function(t,e){var n,r,i,o=e.nodeSize,a=e.nodeSpacing,e=e.collideStrength,s=B(a)?function(){return a}:Ne(a)?a:function(){return 0};r=o?Ne(o)?function(t){return o(t)+s(t)}:my(o)?(n=(o[0]>o[1]?o[0]:o[1])/2,function(t){return n+s(t)}):B(o)?(i=o/2,function(t){return i+s(t)}):function(){return 10}:function(t){return t.size?my(t.size)?(t.size[0]>t.size[1]?t.size[0]:t.size[1])/2+s(t):Ie(t.size)?(t.size.width>t.size.height?t.size.width:t.size.height)/2+s(t):t.size/2+s(t):10+s(t)},t.force("collisionForce",p1(r).strength(e))},Z1);function Z1(t){this.options=t=void 0===t?{}:t,this.id="d3force",this.options=k(k({},$1),t)}function Q1(t,e){if("next"!==t&&"prev"!==t)return e}function J1(t){t.prev.next=t.next,t.next.prev=t.prev,delete t.next,delete t.prev}var tE=function(t){return t.map(function(t){var e=t.x,n=t.y,t=I(t,["x","y"]);return k(k({},t),{data:k(k({},t.data),{x:e,y:n})})})},eE=function(t){return t.map(function(t){var e=t.source,n=t.target,t=I(t,["source","target"]);return k(k({},t),{source:e.id,target:n.id})})};function nE(){var t={};(t.prev=t).next=t.prev,this.shortcut=t}nE.prototype.dequeue=function(){var t=this.shortcut,e=t.prev;if(e&&e!==t)return J1(e),e},nE.prototype.enqueue=function(t){var e=this.shortcut;t.prev&&t.next&&J1(t),t.next=e.next,e.next.prev=t,(e.next=t).prev=e},nE.prototype.toString=function(){for(var t=[],e=this.shortcut,n=e.prev;n!==e;)t.push(JSON.stringify(n,Q1)),n=null==n?void 0:n.prev;return"["+t.join(", ")+"]"};P(oE,rE=nE);var rE,iE=oE;function oE(){return null!==rE&&rE.apply(this,arguments)||this}var aE=function(){return 1},sE=function(t,e){return t.getAllNodes().length<=1?[]:(e=cE(t,e||aE),null==(e=lE(e.graph,e.buckets,e.zeroIdx).map(function(e){return t.getRelatedEdges(e.v,"out").filter(function(t){return t.target===e.w})}))?void 0:e.flat())},lE=function(t,e,n){for(var r,i=[],o=e[e.length-1],a=e[0];t.getAllNodes().length;){for(;r=a.dequeue();)uE(t,e,n,r);for(;r=o.dequeue();)uE(t,e,n,r);if(t.getAllNodes().length)for(var s=e.length-2;0<s;--s)if(r=e[s].dequeue()){i=i.concat(uE(t,e,n,r,!0));break}}return i},uE=function(r,i,o,t,a){var e,s=[];return r.hasNode(t.v)&&(null!=(e=r.getRelatedEdges(t.v,"in"))&&e.forEach(function(t){var e=t.data.weight,n=r.getNode(t.source);a&&s.push({v:t.source,w:t.target,in:0,out:0}),void 0===n.data.out&&(n.data.out=0),n.data.out-=e,hE(i,o,k({v:n.id},n.data))}),null!=(e=r.getRelatedEdges(t.v,"out"))&&e.forEach(function(t){var e=t.data.weight,t=t.target,t=r.getNode(t);void 0===t.data.in&&(t.data.in=0),t.data.in-=e,hE(i,o,k({v:t.id},t.data))}),r.removeNode(t.v)),a?s:void 0},cE=function(t,r){for(var i=new fy,o=0,a=0,e=(t.getAllNodes().forEach(function(t){i.addNode({id:t.id,data:{v:t.id,in:0,out:0}})}),t.getAllEdges().forEach(function(e){var t=i.getRelatedEdges(e.source,"out").find(function(t){return t.target===e.target}),n=(null==r?void 0:r(e))||1;t?i.updateEdgeData(null==t?void 0:t.id,k(k({},t.data),{weight:t.data.weight+n})):i.addEdge({id:e.id,source:e.source,target:e.target,data:{weight:n}}),a=Math.max(a,i.getNode(e.source).data.out+=n),o=Math.max(o,i.getNode(e.target).data.in+=n)}),[]),n=a+o+3,s=0;s<n;s++)e.push(new iE);var l=o+1;return i.getAllNodes().forEach(function(t){hE(e,l,k({v:t.id},i.getNode(t.id).data))}),{buckets:e,zeroIdx:l,graph:i}},hE=function(t,e,n){(n.out?n.in?t[n.out-n.in+e]:t[t.length-1]:t[0]).enqueue(n)},dE=function(n,t){t="greedy"===t?sE(n,function(t){return t.data.weight||1}):fE(n);null!=t&&t.forEach(function(t){var e=t.data;n.removeEdge(t.id),e.forwardName=t.data.name,e.reversed=!0,n.addEdge({id:t.id,source:t.target,target:t.source,data:k({},e)})})},fE=function(e){function n(t){o[t]||(i[t]=o[t]=!0,e.getRelatedEdges(t,"out").forEach(function(t){i[t.target]?r.push(t):n(t.target)}),delete i[t])}var r=[],i={},o={};return e.getAllNodes().forEach(function(t){return n(t.id)}),r},pE=function(r){r.getAllEdges().forEach(function(t){var e,n=t.data;n.reversed&&(r.removeEdge(t.id),e=n.forwardName,delete n.reversed,delete n.forwardName,r.addEdge({id:t.id,source:t.target,target:t.source,data:k(k({},n),{forwardName:e})}))})},gE=function(t,e){return Number(t)-Number(e)},mE=function(t,e,n,r){for(var i;i=""+r+Math.random(),t.hasNode(i););return n.dummy=e,t.addNode({id:i,data:n}),i},vE=function(t){var n=new fy;return t.getAllNodes().forEach(function(t){n.addNode(k({},t))}),t.getAllEdges().forEach(function(e){var t=n.getRelatedEdges(e.source,"out").find(function(t){return t.target===e.target});t?n.updateEdgeData(null==t?void 0:t.id,k(k({},t.data),{weight:t.data.weight+e.data.weight||0,minlen:Math.max(t.data.minlen,e.data.minlen||1)})):n.addEdge({id:e.id,source:e.source,target:e.target,data:{weight:e.data.weight||0,minlen:e.data.minlen||1}})}),n},yE=function(e){var n=new fy;return e.getAllNodes().forEach(function(t){e.getChildren(t.id).length||n.addNode(k({},t))}),e.getAllEdges().forEach(function(t){n.addEdge(t)}),n},EE=function(t,r){return null==t?void 0:t.reduce(function(t,e,n){return t[e]=r[n],t},{})},_E=function(t,e){var n,r=Number(t.x),i=Number(t.y),o=Number(e.x)-r,e=Number(e.y)-i,a=Number(t.width)/2,t=Number(t.height)/2;return o||e?(t=Math.abs(e)*a>Math.abs(o)*t?(n=(t=e<0?-t:t)*o/e,t):(n=a=o<0?-a:a)*e/o,{x:r+n,y:i+t}):{x:0,y:0}},bE=function(n){for(var r=[],t=TE(n)+1,e=0;e<t;e++)r.push([]);n.getAllNodes().forEach(function(t){var e=t.data.rank;void 0!==e&&r[e]&&r[e].push(t.id)});for(e=0;e<t;e++)r[e]=r[e].sort(function(t,e){return gE(n.getNode(t).data.order,n.getNode(e).data.order)});return r},xE=function(t){var e=t.getAllNodes().filter(function(t){return void 0!==t.data.rank}).map(function(t){return t.data.rank}),n=Math.min.apply(Math,O([],D(e)));t.getAllNodes().forEach(function(t){t.data.hasOwnProperty("rank")&&n!==1/0&&(t.data.rank-=n)})},SE=function(e,t){void 0===t&&(t=0);for(var n=e.getAllNodes(),r=n.filter(function(t){return void 0!==t.data.rank}).map(function(t){return t.data.rank}),i=Math.min.apply(Math,O([],D(r))),o=[],a=(n.forEach(function(t){var e=(t.data.rank||0)-i;o[e]||(o[e]=[]),o[e].push(t.id)}),0),s=0;s<o.length;s++){var l=o[s];void 0===l?s%t!=0&&--a:a&&null!=l&&l.forEach(function(t){t=e.getNode(t);t&&(t.data.rank=t.data.rank||0,t.data.rank+=a)})}},wE=function(t,e,n,r){var i={width:0,height:0};return B(n)&&B(r)&&(i.rank=n,i.order=r),mE(t,"border",i,e)},TE=function(t){var e;return t.getAllNodes().forEach(function(t){t=t.data.rank;void 0!==t&&(void 0===e||e<t)&&(e=t)}),e=e||0},AE=function(t,e){var n={lhs:[],rhs:[]};return null!=t&&t.forEach(function(t){(e(t)?n.lhs:n.rhs).push(t)}),n},ME=function(t,r){return t.reduce(function(t,e){var n=r(t);return r(e)<n?e:t})},RE=function(e,t,n,r,i,o){r.includes(t.id)||(r.push(t.id),n||o.push(t.id),i(t.id).forEach(function(t){return RE(e,t,n,r,i,o)}),n&&o.push(t.id))},NE=function(e,t,n,r){function i(t){return r?e.getSuccessors(t):e.getNeighbors(t)}var t=Array.isArray(t)?t:[t],o=[],a=[];return t.forEach(function(t){if(!e.hasNode(t.id))throw new Error("Graph does not have node: "+t);RE(e,t,"post"===n,a,i,o)}),o},CE="edge",PE="edge-label",OE=function(e,n){e.getAllEdges().forEach(function(t){return IE(e,t,n)})},IE=function(t,e,n){var r,i,o,a=e.source,s=t.getNode(a).data.rank,l=e.target,u=t.getNode(l).data.rank,c=e.data.labelRank;if(u!==s+1){for(t.removeEdge(e.id),o=0,++s;s<u;++o,++s)e.data.points=[],r=mE(t,CE,i={originalEdge:e,width:0,height:0,rank:s},"_d"),s===c&&(i.width=e.data.width,i.height=e.data.height,i.dummy=PE,i.labelpos=e.data.labelpos),t.addEdge({id:"e"+Math.random(),source:a,target:r,data:{weight:e.data.weight}}),0===o&&n.push(r),a=r;t.addEdge({id:"e"+Math.random(),source:a,target:l,data:{weight:e.data.weight}})}},LE=function(o,t){t.forEach(function(t){for(var e,n=o.getNode(t),r=n.data.originalEdge,i=(r&&o.addEdge(r),t);n.data.dummy;)e=o.getSuccessors(i)[0],o.removeNode(i),r.data.points.push({x:n.data.x,y:n.data.y}),n.data.dummy===PE&&(r.data.x=n.data.x,r.data.y=n.data.y,r.data.width=n.data.width,r.data.height=n.data.height),i=e.id,n=o.getNode(i)})},kE=function(r){function i(t){var e,n=r.getNode(t);return n?o[t]?n.data.rank:(o[t]=!0,null!=(t=r.getRelatedEdges(t,"out"))&&t.forEach(function(t){t=i(t.target)-t.data.minlen;t&&(void 0===e||t<e)&&(e=t)}),e=e||0,n.data.rank=e):0}var o={};r.getAllNodes().filter(function(t){return 0===r.getRelatedEdges(t.id,"in").length}).forEach(function(t){return i(t.id)})},DE=function(i){function r(t){var e,n=i.getNode(t);return n?s[t]?n.data.rank:(s[t]=!0,null!=(t=i.getRelatedEdges(t,"out"))&&t.forEach(function(t){t=r(t.target)-t.data.minlen;t&&(void 0===e||t<e)&&(e=t)}),e=e||0,(void 0===a||e<a)&&(a=e),n.data.rank=e):0}function o(t,e){var n=i.getNode(t),r=isNaN(n.data.layer)?e:n.data.layer;(void 0===n.data.rank||n.data.rank<r)&&(n.data.rank=r),l[t]||(l[t]=!0,null!=(e=i.getRelatedEdges(t,"out"))&&e.forEach(function(t){o(t.target,r+t.data.minlen)}))}var a,s={},l=(i.getAllNodes().filter(function(t){return 0===i.getRelatedEdges(t.id,"in").length}).forEach(function(t){t&&r(t.id)}),void 0===a&&(a=0),{});i.getAllNodes().forEach(function(t){var e=t.data;e&&(isNaN(e.layer)?e.rank-=a:o(t.id,e.layer))})},BE=function(t,e){return t.getNode(e.target).data.rank-t.getNode(e.source).data.rank-e.data.minlen},FE=function(t){var e,n=new fy({tree:[]}),r=t.getAllNodes()[0],i=t.getAllNodes().length;for(n.addNode(r);UE(n,t)<i;)e=VE(n,t),e=n.hasNode(e.source)?BE(t,e):-BE(t,e),jE(n,t,e);return n},UE=function(r,i){function o(n){i.getRelatedEdges(n,"both").forEach(function(t){var e=t.source,e=n===e?t.target:e;r.hasNode(e)||BE(i,t)||(r.addNode({id:e,data:{}}),r.addEdge({id:t.id,source:n,target:e,data:{}}),o(e))})}return r.getAllNodes().forEach(function(t){return o(t.id)}),r.getAllNodes().length},GE=function(t){var e,n=new fy({tree:[]}),r=t.getAllNodes()[0],i=t.getAllNodes().length;for(n.addNode(r);WE(n,t)<i;)e=VE(n,t),e=n.hasNode(e.source)?BE(t,e):-BE(t,e),jE(n,t,e);return n},WE=function(r,i){function o(n){var t;null!=(t=i.getRelatedEdges(n,"both"))&&t.forEach(function(t){var e=t.source,e=n===e?t.target:e;r.hasNode(e)||void 0===i.getNode(e).data.layer&&BE(i,t)||(r.addNode({id:e,data:{}}),r.addEdge({id:t.id,source:n,target:e,data:{}}),o(e))})}return r.getAllNodes().forEach(function(t){return o(t.id)}),r.getAllNodes().length},VE=function(e,n){return ME(n.getAllEdges(),function(t){return e.hasNode(t.source)!==e.hasNode(t.target)?BE(n,t):1/0})},jE=function(t,e,n){t.getAllNodes().forEach(function(t){t=e.getNode(t.id);t.data.rank||(t.data.rank=0),t.data.rank+=n})},zE=function(t){var e,n,r=vE(t),i=(kE(r),FE(r));for(KE(i),HE(i,r);e=$E(i);)n=ZE(i,r,e),QE(i,r,e,n)},HE=function(e,n){var t=NE(e,e.getAllNodes(),"post",!1);(t=t.slice(0,(null==t?void 0:t.length)-1)).forEach(function(t){XE(e,n,t)})},XE=function(t,e,n){var r=t.getNode(n).data.parent;t.getRelatedEdges(n,"both").find(function(t){return t.target===r||t.source===r}).data.cutvalue=YE(t,e,n)},YE=function(r,t,i){var o=r.getNode(i).data.parent,a=!0,e=t.getRelatedEdges(i,"out").find(function(t){return t.target===o}),s=0;return e||(a=!1,e=t.getRelatedEdges(o,"out").find(function(t){return t.target===i})),s=e.data.weight,t.getRelatedEdges(i,"both").forEach(function(t){var e=t.source===i,n=e?t.target:t.source;n!==o&&(e=e===a,t=t.data.weight,s+=e?t:-t,t_(r,i,n))&&(t=r.getRelatedEdges(i,"both").find(function(t){return t.source===n||t.target===n}).data.cutvalue,s+=e?-t:t)}),s},KE=function(t,e){void 0===e&&(e=t.getAllNodes()[0].id),qE(t,{},1,e)},qE=function(e,n,t,r,i){var o,a=t,s=t,t=e.getNode(r);return n[r]=!0,null!=(o=e.getNeighbors(r))&&o.forEach(function(t){n[t.id]||(s=qE(e,n,s,t.id,r))}),t.data.low=a,t.data.lim=s++,i?t.data.parent=i:delete t.data.parent,s},$E=function(t){return t.getAllEdges().find(function(t){return t.data.cutvalue<0})},ZE=function(e,n,t){var r=t.source,i=t.target,t=(n.getRelatedEdges(r,"out").find(function(t){return t.target===i})||(r=t.target,i=t.source),e.getNode(r)),r=e.getNode(i),o=t,a=!1,t=(t.data.lim>r.data.lim&&(o=r,a=!0),n.getAllEdges().filter(function(t){return a===e_(e.getNode(t.source),o)&&a!==e_(e.getNode(t.target),o)}));return ME(t,function(t){return BE(n,t)})},QE=function(t,e,n,r){var i=t.getRelatedEdges(n.source,"both").find(function(t){return t.source===n.target||t.target===n.target});i&&t.removeEdge(i.id),t.addEdge({id:"e"+Math.random(),source:r.source,target:r.target,data:{}}),KE(t),HE(t,e),JE(t,e)},JE=function(i,o){var t=i.getAllNodes().find(function(t){return!t.data.parent});NE(i,t,"pre",!1).slice(1).forEach(function(e){var n=i.getNode(e).data.parent,t=o.getRelatedEdges(e,"out").find(function(t){return t.target===n}),r=!1;!t&&o.hasNode(n)&&(t=o.getRelatedEdges(n,"out").find(function(t){return t.target===e}),r=!0),o.getNode(e).data.rank=(o.hasNode(n)&&o.getNode(n).data.rank||0)+(r?null==t?void 0:t.data.minlen:-(null==t?void 0:t.data.minlen))})},t_=function(t,e,n){return t.getRelatedEdges(e,"both").find(function(t){return t.source===n||t.target===n})},e_=function(t,e){return e.data.low<=t.data.lim&&t.data.lim<=e.data.lim},n_=function(t,e){switch(e){case"network-simplex":o_(t);break;case"tight-tree":i_(t);break;case"longest-path":r_(t);break;default:i_(t)}},r_=kE,i_=function(t){DE(t),GE(t)},o_=function(t){zE(t)},a_=function(n){function r(t){var e=o;n.getChildren(t).forEach(function(t){return r(t.id)}),i[t]={low:e,lim:o++}}var i={},o=0;return n.getRoots().forEach(function(t){return r(t.id)}),i},s_=function(t,e,n,r){for(var i,o,a,s=[],l=[],u=Math.min(e[n].low,e[r].low),c=Math.max(e[n].lim,e[r].lim),h=n;h=null==(i=t.getParent(h))?void 0:i.id,s.push(h),h&&(e[h].low>u||c>e[h].lim););for(a=h,h=r;h&&h!==a;)l.push(h),h=null==(o=t.getParent(h))?void 0:o.id;return{lca:a,path:s.concat(l.reverse())}},l_=function(h,t){var d=a_(h);t.forEach(function(t){var e,n,r,i=t,o=h.getNode(i).data.originalEdge;if(o)for(var t=s_(h,d,o.source,o.target),a=t.path,s=t.lca,l=0,u=a[l],c=!0;i!==o.target;){if(r=h.getNode(i),c){for(;u!==s&&(null==(e=h.getNode(u))?void 0:e.data.maxRank)<r.data.rank;)u=a[++l];u===s&&(c=!1)}if(!c){for(;l<a.length-1&&(null==(n=h.getNode(a[l+1]))?void 0:n.data.minRank)<=r.data.rank;)l++;u=a[l]}h.hasNode(u)&&h.setParent(i,u),i=h.getSuccessors(i)[0].id}})},u_=function(e){var n=mE(e,"root",{},"_root"),r=h_(e),t=Math.max.apply(Math,O([],D(Object.values(r)))),i=(t=Math.abs(t)===1/0?1:t)-1,o=2*i+1,a=(e.getAllEdges().forEach(function(t){t.data.minlen*=o}),d_(e)+1);return e.getRoots().forEach(function(t){c_(e,n,o,a,i,r,t.id)}),{nestingRoot:n,nodeRankFactor:o}},c_=function(i,o,a,s,l,u,c){var h,d,t,e=i.getChildren(c);null!=e&&e.length?(h=wE(i,"_bt"),d=wE(i,"_bb"),t=i.getNode(c),i.setParent(h,c),t.data.borderTop=h,i.setParent(d,c),t.data.borderBottom=d,null!=e&&e.forEach(function(t){c_(i,o,a,s,l,u,t.id);var e=t.data.borderTop||t.id,n=t.data.borderBottom||t.id,t=t.data.borderTop?s:2*s,r=e!==n?1:l-u[c]+1;i.addEdge({id:"e"+Math.random(),source:h,target:e,data:{minlen:r,weight:t,nestingEdge:!0}}),i.addEdge({id:"e"+Math.random(),source:n,target:d,data:{minlen:r,weight:t,nestingEdge:!0}})}),i.getParent(c)||i.addEdge({id:"e"+Math.random(),source:o,target:h,data:{weight:0,minlen:l+u[c]}})):c!==o&&i.addEdge({id:"e"+Math.random(),source:o,target:c,data:{weight:0,minlen:a}})},h_=function(r){function i(t,e){var n=r.getChildren(t);null!=n&&n.forEach(function(t){return i(t.id,e+1)}),o[t]=e}var o={};return r.getRoots().forEach(function(t){return i(t.id,1)}),o},d_=function(t){var e=0;return t.getAllEdges().forEach(function(t){e+=t.data.weight}),e},f_=function(e,t){t&&e.removeNode(t),e.getAllEdges().forEach(function(t){t.data.nestingEdge&&e.removeEdge(t.id)})},p_=function(o){function a(t){var e=o.getChildren(t),n=o.getNode(t);if(null!=e&&e.length&&e.forEach(function(t){return a(t.id)}),n.data.hasOwnProperty("minRank")){n.data.borderLeft=[],n.data.borderRight=[];for(var r=n.data.minRank,i=n.data.maxRank+1;r<i;r+=1)g_(o,"borderLeft","_bl",t,n,r),g_(o,"borderRight","_br",t,n,r)}}o.getRoots().forEach(function(t){return a(t.id)})},g_=function(t,e,n,r,i,o){var a=i.data[e][o-1],n=mE(t,"border",{rank:o,borderType:e,width:0,height:0},n);i.data[e][o]=n,t.setParent(n,r),a&&t.addEdge({id:"e"+Math.random(),source:a,target:n,data:{weight:1}})},m_=function(t,e){e=e.toLowerCase();"lr"!==e&&"rl"!==e||y_(t)},v_=function(t,e){e=e.toLowerCase();"bt"!==e&&"rl"!==e||__(t),"lr"!==e&&"rl"!==e||(x_(t),y_(t))},y_=function(t){t.getAllNodes().forEach(function(t){E_(t)}),t.getAllEdges().forEach(function(t){E_(t)})},E_=function(t){var e=t.data.width;t.data.width=t.data.height,t.data.height=e},__=function(t){t.getAllNodes().forEach(function(t){b_(t.data)}),t.getAllEdges().forEach(function(t){var e;null!=(e=t.data.points)&&e.forEach(function(t){return b_(t)}),t.data.hasOwnProperty("y")&&b_(t.data)})},b_=function(t){null!=t&&t.y&&(t.y=-t.y)},x_=function(t){t.getAllNodes().forEach(function(t){S_(t.data)}),t.getAllEdges().forEach(function(t){var e;null!=(e=t.data.points)&&e.forEach(function(t){return S_(t)}),t.data.hasOwnProperty("x")&&S_(t.data)})},S_=function(t){var e=t.x;t.x=t.y,t.y=e},w_=function(n){for(var e={},t=n.getAllNodes(),r=t.map(function(t){return null!=(t=t.data.rank)?t:-1/0}),i=Math.max.apply(Math,O([],D(r))),o=[],a=0;a<i+1;a++)o.push([]);r=t.sort(function(t,e){return n.getNode(t.id).data.rank-n.getNode(e.id).data.rank}),t=r.filter(function(t){return void 0!==n.getNode(t.id).data.fixorder}).sort(function(t,e){return n.getNode(t.id).data.fixorder-n.getNode(e.id).data.fixorder});return null!=t&&t.forEach(function(t){isNaN(n.getNode(t.id).data.rank)||o[n.getNode(t.id).data.rank].push(t.id),e[t.id]=!0}),null!=r&&r.forEach(function(t){return n.dfsTree(t.id,function(t){if(e.hasOwnProperty(t.id))return!0;e[t.id]=!0,isNaN(t.data.rank)||o[t.data.rank].push(t.id)})}),o},T_=function(e,t,n){for(var r=EE(n,n.map(function(t,e){return e})),t=t.map(function(t){t=e.getRelatedEdges(t,"out").map(function(t){return{pos:r[t.target]||0,weight:t.data.weight}});return null==t?void 0:t.sort(function(t,e){return t.pos-e.pos})}).flat().filter(function(t){return void 0!==t}),i=1;i<n.length;)i<<=1;var o=2*i-1,a=(--i,Array(o).fill(0,0,o)),s=0;return null!=t&&t.forEach(function(t){if(t){for(var e=t.pos+i,n=(a[e]+=t.weight,0);0<e;)e%2&&(n+=a[e+1]),a[e=e-1>>1]+=t.weight;s+=t.weight*n}}),s},A_=function(t,e){for(var n=0,r=1;r<(null==e?void 0:e.length);r+=1)n+=T_(t,e[r-1],e[r]);return n},M_=function(o,e,n){var r=R_(o),a=new fy({tree:[{id:r,children:[],data:{}}]});return o.getAllNodes().forEach(function(i){var t=o.getParent(i.id);(i.data.rank===e||i.data.minRank<=e&&e<=i.data.maxRank)&&(a.hasNode(i.id)||a.addNode(k({},i)),null!=t&&t.id&&!a.hasNode(null==t?void 0:t.id)&&a.addNode(k({},t)),a.setParent(i.id,(null==t?void 0:t.id)||r),o.getRelatedEdges(i.id,n).forEach(function(t){var e=t.source===i.id?t.target:t.source,n=(a.hasNode(e)||a.addNode(k({},o.getNode(e))),a.getRelatedEdges(e,"out").find(function(t){return t.target===i.id})),r=void 0!==n?n.data.weight:0;n?a.updateEdgeData(n.id,k(k({},n.data),{weight:t.data.weight+r})):a.addEdge({id:t.id,source:e,target:i.id,data:{weight:t.data.weight+r}})}),i.data.hasOwnProperty("minRank"))&&a.updateNodeData(i.id,k(k({},i.data),{borderLeft:i.data.borderLeft[e],borderRight:i.data.borderRight[e]}))}),a},R_=function(t){for(var e;t.hasNode(e="_root"+Math.random()););return e},N_=function(i,o,t){var a,s={};null!=t&&t.forEach(function(t){for(var e,n,r=i.getParent(t);r;){if((e=i.getParent(r.id))?(n=s[e.id],s[e.id]=r.id):(n=a,a=r.id),n&&n!==r.id)return o.addNodes([{id:n,data:{}},{id:r.id,data:{}}]),void o.addEdge({id:"e"+n+"-"+r.id,source:n,target:r.id,data:{}});r=e}})},C_=function(r,t){return t.map(function(t){var n,e=r.getRelatedEdges(t,"in");return null!=e&&e.length?(n={sum:0,weight:0},null!=e&&e.forEach(function(t){var e=r.getNode(t.source);n.sum+=t.data.weight*e.data.order,n.weight+=t.data.weight}),{v:t,barycenter:n.sum/n.weight,weight:n.weight}):{v:t}})},P_=function(r){for(var t,e=[],n=function(){var n=r.pop();e.push(n),null!=(t=n.in.reverse())&&t.forEach(function(t){e=n;var e;t.merged||(void 0===t.barycenter||void 0===e.barycenter||t.barycenter>=e.barycenter)&&O_(e,t)}),null!=(t=n.out)&&t.forEach(function(t){e=n;var e;t.in.push(e),0==--t.indegree&&r.push(t)})};null!=r&&r.length;)n();var i=e.filter(function(t){return!t.merged}),o=["vs","i","barycenter","weight"];return i.map(function(e){var n={};return null!=o&&o.forEach(function(t){void 0!==e[t]&&(n[t]=e[t])}),n})},O_=function(t,e){var n,r=0,i=0;t.weight&&(r+=t.barycenter*t.weight,i+=t.weight),e.weight&&(r+=e.barycenter*e.weight,i+=e.weight),t.vs=null==(n=e.vs)?void 0:n.concat(t.vs),t.barycenter=r/i,t.weight=i,t.i=Math.min(e.i,t.i),e.merged=!0},I_=function(t,e){var r={},t=(null!=t&&t.forEach(function(t,e){r[t.v]={i:e,indegree:0,in:[],out:[],vs:[t.v]};e=r[t.v];void 0!==t.barycenter&&(e.barycenter=t.barycenter,e.weight=t.weight)}),null!=(t=e.getAllEdges())&&t.forEach(function(t){var e=r[t.source],n=r[t.target];void 0!==e&&void 0!==n&&(n.indegree++,e.out.push(r[t.target]))}),null==(t=(e=Object.values(r)).filter)?void 0:t.call(e,function(t){return!t.indegree}));return P_(t)},L_=function(t,e,n,r){var t=AE(t,function(t){var e=t.hasOwnProperty("fixorder")&&!isNaN(t.fixorder);return r?!e&&t.hasOwnProperty("barycenter"):e||t.hasOwnProperty("barycenter")}),i=t.lhs,o=t.rhs.sort(function(t,e){return-t.i- -e.i}),a=[],s=0,l=0,u=0,t=(null!=i&&i.sort(D_(!!e,!!n)),u=k_(a,o,u),null!=i&&i.forEach(function(t){var e;u+=null==(e=t.vs)?void 0:e.length,a.push(t.vs),s+=t.barycenter*t.weight,l+=t.weight,u=k_(a,o,u)}),{vs:a.flat()});return l&&(t.barycenter=s/l,t.weight=l),t},k_=function(t,e,n){for(var r,i=n;e.length&&(r=e[e.length-1]).i<=i;)e.pop(),null!=t&&t.push(r.vs),i++;return i},D_=function(n,r){return function(t,e){if(void 0!==t.fixorder&&void 0!==e.fixorder)return t.fixorder-e.fixorder;if(t.barycenter<e.barycenter)return-1;if(t.barycenter>e.barycenter)return 1;if(r&&void 0!==t.order&&void 0!==e.order){if(t.order<e.order)return-1;if(t.order>e.order)return 1}return n?e.i-t.i:t.i-e.i}},B_=function(n,t,r,i,e,o){var a=n.getChildren(t).map(function(t){return t.id}),t=n.getNode(t),s=t?t.data.borderLeft:void 0,l=t?t.data.borderRight:void 0,u={},t=(s&&(a=null==a?void 0:a.filter(function(t){return t!==s&&t!==l})),C_(n,a||[])),a=(null!=t&&t.forEach(function(t){var e;null!=(e=n.getChildren(t.v))&&e.length&&(e=B_(n,t.v,r,i,o),(u[t.v]=e).hasOwnProperty("barycenter"))&&U_(t,e)}),I_(t,r)),t=(F_(a,u),null!=(t=a.filter(function(t){return 0<t.vs.length}))&&t.forEach(function(t){var e=n.getNode(t.vs[0]);e&&(t.fixorder=e.data.fixorder,t.order=e.data.order)}),L_(a,i,e,o));return s&&(t.vs=[s,t.vs,l].flat(),null!=(a=n.getPredecessors(s)))&&a.length&&(a=n.getNode((null==(e=n.getPredecessors(s))?void 0:e[0].id)||""),e=n.getNode((null==(e=n.getPredecessors(l))?void 0:e[0].id)||""),t.hasOwnProperty("barycenter")||(t.barycenter=0,t.weight=0),t.barycenter=(t.barycenter*t.weight+a.data.order+e.data.order)/(t.weight+2),t.weight+=2),t},F_=function(t,n){null!=t&&t.forEach(function(t){var e=null==(e=t.vs)?void 0:e.map(function(t){return n[t]?n[t].vs:t});t.vs=e.flat()})},U_=function(t,e){void 0!==t.barycenter?(t.barycenter=(t.barycenter*t.weight+e.barycenter*e.weight)/(t.weight+e.weight),t.weight+=e.weight):(t.barycenter=e.barycenter,t.weight=e.weight)},G_=function(t,e){for(var n=TE(t),r=[],i=[],o=1;o<n+1;o++)r.push(o);for(o=n-1;-1<o;o--)i.push(o);for(var a,s=W_(t,r,"in"),l=W_(t,i,"out"),u=w_(t),c=(j_(t,u),Number.POSITIVE_INFINITY),o=0,h=0;h<4;++o,++h){V_(o%2?s:l,2<=o%4,!1,e);u=bE(t);(d=A_(t,u))<c&&(h=0,a=He(u),c=d)}u=w_(t),j_(t,u);for(var d,o=0,h=0;h<4;++o,++h)V_(o%2?s:l,2<=o%4,!0,e),u=bE(t),(d=A_(t,u))<c&&(h=0,a=He(u),c=d);j_(t,a)},W_=function(e,t,n){return t.map(function(t){return M_(e,t,n)})},V_=function(t,o,a,s){var l=new fy;null!=t&&t.forEach(function(t){for(var e=t.getRoots()[0].id,n=B_(t,e,l,o,a,s),r=0;r<(null==(i=n.vs)?void 0:i.length);r++){var i=t.getNode(n.vs[r]);i&&(i.data.order=r)}N_(t,l,n.vs)})},j_=function(n,t){null!=t&&t.forEach(function(t){null!=t&&t.forEach(function(t,e){n.getNode(t).data.order=e})})},z_=function(u,t){var c={};return null!=t&&t.length&&t.reduce(function(t,r){var o=0,a=0,s=t.length,l=null==r?void 0:r[(null==r?void 0:r.length)-1];return null!=r&&r.forEach(function(t,e){var n=X_(u,t),i=n?u.getNode(n.id).data.order:s;!n&&t!==l||(null!=(n=r.slice(a,e+1))&&n.forEach(function(r){var t;null!=(t=u.getPredecessors(r))&&t.forEach(function(t){var e=u.getNode(t.id),n=e.data.order;!(n<o||i<n)||e.data.dummy&&null!=(n=u.getNode(r))&&n.data.dummy||Y_(c,t.id,r)})}),a=e+1,o=i)}),r}),c},H_=function(u,t){var l={};function c(t,e){var n=JSON.stringify(t.slice(1));e.get(n)||(!function(t,e,n,r,i){for(var o,a,s=e;s<n;s++)a=t[s],null!=(o=u.getNode(a))&&o.data.dummy&&null!=(o=u.getPredecessors(a))&&o.forEach(function(t){var e=u.getNode(t.id);e.data.dummy&&(e.data.order<r||e.data.order>i)&&Y_(l,t.id,a)})}.apply(void 0,O([],D(t))),e.set(n,!0))}return null!=t&&t.length&&t.reduce(function(r,i){var o,a=-1,s=0,l=new Map;return null!=i&&i.forEach(function(t,e){var n;"border"===(null==(n=u.getNode(t))?void 0:n.data.dummy)&&(n=u.getPredecessors(t)||[]).length&&(o=u.getNode(n[0].id).data.order,c([i,s,e,a,o],l),s=e,a=o),c([i,s,i.length,o,r.length],l)}),i}),l},X_=function(e,t){var n;return null==(n=e.getNode(t))||!n.data.dummy||null==(n=e.getPredecessors(t))?void 0:n.find(function(t){return e.getNode(t.id).data.dummy})},Y_=function(t,e,n){var r,i=n,n=(n<e&&(r=e,e=n,i=r),t[e]);n||(t[e]=n={}),n[i]=!0},K_=function(t,e,n){var r=e;return n<e&&(r=n,0),!!t[r]},q_=function(t,e,s,l){var u={},c={},h={};return null!=e&&e.forEach(function(t){null!=t&&t.forEach(function(t,e){h[c[u[t]=t]=t]=e})}),null!=e&&e.forEach(function(t){var a=-1;null!=t&&t.forEach(function(t){var e=l(t).map(function(t){return t.id});if(e.length)for(var n=((e=e.sort(function(t,e){return h[t]-h[e]})).length-1)/2,r=Math.floor(n),i=Math.ceil(n);r<=i;++r){var o=e[r];c[t]===t&&a<h[o]&&!K_(s,t,o)&&(c[o]=t,c[t]=u[t]=u[o],a=h[o])}})}),{root:u,align:c}},$_=function(r,t,e,n,i,o,a){function s(t,e){for(var n=u.getAllNodes(),r=n.pop(),i={};r;)i[r.id]?t(r.id):(i[r.id]=!0,n.push(r),n=n.concat(e(r.id))),r=n.pop()}var l={},u=Z_(r,t,e,i,o,a),c=a?"borderLeft":"borderRight";return s(function(t){l[t]=(u.getRelatedEdges(t,"in")||[]).reduce(function(t,e){return Math.max(t,(l[e.source]||0)+e.data.weight)},0)},u.getPredecessors.bind(u)),s(function(t){var e=(u.getRelatedEdges(t,"out")||[]).reduce(function(t,e){return Math.min(t,(l[e.target]||0)-e.data.weight)},Number.POSITIVE_INFINITY),n=r.getNode(t);e!==Number.POSITIVE_INFINITY&&n.data.borderType!==c&&(l[t]=Math.max(l[t],e))},u.getSuccessors.bind(u)),null!=(t=Object.values(n))&&t.forEach(function(t){l[t]=l[e[t]]}),l},Z_=function(o,t,a,e,n,r){var s=new fy,l=tb(e,n,r);return null!=t&&t.forEach(function(t){var i;null!=t&&t.forEach(function(t){var e,n,r=a[t];s.hasNode(r)||s.addNode({id:r,data:{}}),i&&(e=a[i],(n=s.getRelatedEdges(e,"out").find(function(t){return t.target===r}))?s.updateEdgeData(n.id,k(k({},n.data),{weight:Math.max(l(o,t,i),n.data.weight||0)})):s.addEdge({id:"e"+Math.random(),source:e,target:r,data:{weight:Math.max(l(o,t,i),0)}})),i=t})}),s},Q_=function(o,t){return ME(Object.values(t),function(n){var t,r=Number.NEGATIVE_INFINITY,i=Number.POSITIVE_INFINITY;return null!=(t=Object.keys(n))&&t.forEach(function(t){var e=n[t],t=eb(o,t)/2;r=Math.max(e+t,r),i=Math.min(e-t,i)}),r-i})};var J_=function(n,r){var i={};return Object.keys(n.ul).forEach(function(e){var t;r?i[e]=n[r.toLowerCase()][e]:(t=Object.values(n).map(function(t){return t[e]}),i[e]=(t[0]+t[1])/2)}),i},tb=function(a,s,l){return function(t,e,n){var r=t.getNode(e),i=t.getNode(n),e=0,o=0;if(e+=r.data.width/2,r.data.hasOwnProperty("labelpos"))switch((r.data.labelpos||"").toLowerCase()){case"l":o=-r.data.width/2;break;case"r":o=r.data.width/2}if(o&&(e+=l?o:-o),o=0,e=(e=(e+=(r.data.dummy?s:a)/2)+(i.data.dummy?s:a)/2)+i.data.width/2,i.data.labelpos)switch((i.data.labelpos||"").toLowerCase()){case"l":o=i.data.width/2;break;case"r":o=-i.data.width/2}return o&&(e+=l?o:-o),o=0,e}},eb=function(t,e){return t.getNode(e).data.width||0},nb=function(r,t){var t=(t||{}).ranksep,i=void 0===t?0:t,t=bE(r),o=0;null!=t&&t.forEach(function(t){var e=t.map(function(t){return r.getNode(t).data.height}),n=Math.max.apply(Math,O(O([],D(e)),[0]));null!=t&&t.forEach(function(t){r.getNode(t).data.y=o+n/2}),o+=n+i})},rb=function(i,t){var a,s,l,u,t=t||{},e=t.align,n=t.nodesep,o=void 0===n?0:n,n=t.edgesep,c=void 0===n?0:n,h=bE(i),d=Object.assign(z_(i,h),H_(i,h)),f={},p=[],t=(["u","d"].forEach(function(r){p="u"===r?h:Object.values(h).reverse(),["l","r"].forEach(function(t){"r"===t&&(p=p.map(function(t){return Object.values(t).reverse()}));var e=("u"===r?i.getPredecessors:i.getSuccessors).bind(i),e=q_(i,p,d,e),n=$_(i,p,e.root,e.align,o,c,"r"===t);"r"===t&&Object.keys(n).forEach(function(t){return n[t]=-n[t]}),f[r+t]=n})}),Q_(i,f));return t&&(a=f,s=t,n=Object.values(s),l=Math.min.apply(Math,O([],D(n))),u=Math.max.apply(Math,O([],D(n))),["u","d"].forEach(function(o){["l","r"].forEach(function(t){var e,n,r=o+t,i=a[r];i!==s&&(e=Object.values(i),n="l"===t?l-Math.min.apply(Math,O([],D(e))):u-Math.max.apply(Math,O([],D(e))))&&(a[r]={},Object.keys(i).forEach(function(t){a[r][t]=i[t]+n}))})})),J_(f,e)},ib=function(t,e){var n=yE(t),r=(nb(n,e),rb(n,e));null!=(t=Object.keys(r))&&t.forEach(function(t){n.getNode(t).data.x=r[t]})},ob=function(n,t){for(var e=n.getAllNodes().filter(function(t){return!(null!=(t=n.getChildren(t.id))&&t.length)}).map(function(t){return t.data.rank}),r=Math.max.apply(Math,O([],D(e))),i=[],o=0;o<r+1;o++)i[o]=[];null!=t&&t.forEach(function(t){var e=n.getNode(t);!e||e.data.dummy||isNaN(e.data.rank)||(e.data.fixorder=i[e.data.rank].length,i[e.data.rank].push(t))})},ab=function(t,e){var n=e.acyclicer,r=e.ranker,i=e.rankdir,i=void 0===i?"tb":i,o=e.nodeOrder,a=e.keepNodeOrder,s=e.align,l=e.nodesep,l=void 0===l?50:l,u=e.edgesep,u=void 0===u?20:u,e=e.ranksep,e=void 0===e?50:e,n=(wb(t),dE(t,n),u_(t)),c=n.nestingRoot,n=n.nodeRankFactor,r=(n_(yE(t),r),mb(t),SE(t,n),f_(t,c),xE(t),vb(t),yb(t),[]),n=(OE(t,r),l_(t,r),p_(t),a&&ob(t,o),G_(t,a),Tb(t),m_(t,i),ib(t,{align:s,nodesep:l,edgesep:u,ranksep:e}),Ab(t),Sb(t),LE(t,r),bb(t),v_(t,i),Eb(t)),c=n.width,o=n.height;return _b(t),xb(t),pE(t),{width:c,height:o}},sb=function(n,r){n.getAllNodes().forEach(function(t){var e=n.getNode(t.id),t=r.getNode(t.id);void 0!==t?(e.data.fixorder=t.data._order,delete t.data._order):delete e.data.fixorder})},lb=function(r,i){r.getAllNodes().forEach(function(t){var e,n=r.getNode(t.id);n&&(e=i.getNode(t.id),n.data.x=e.data.x,n.data.y=e.data.y,n.data._order=e.data.order,n.data._rank=e.data.rank,null!=(t=i.getChildren(t.id)))&&t.length&&(n.data.width=e.data.width,n.data.height=e.data.height)}),r.getAllEdges().forEach(function(t){var e=r.getEdge(t.id),t=i.getEdge(t.id);e.data.points=t?t.data.points:[],t&&t.data.hasOwnProperty("x")&&(e.data.x=t.data.x,e.data.y=t.data.y)})},ub=["width","height","layer","fixorder"],cb={width:0,height:0},hb=["minlen","weight","width","height","labeloffset"],db={minlen:1,weight:1,width:0,height:0,labeloffset:10,labelpos:"r"},fb=["labelpos"],pb=function(r){var i=new fy({tree:[]});return r.getAllNodes().forEach(function(t){var e=Rb(r.getNode(t.id).data),e=k(k({},cb),e),e=Mb(e,ub),e=(i.hasNode(t.id)||i.addNode({id:t.id,data:k({},e)}),r.getParent(t.id));M(e)||(i.hasNode(e.id)||i.addNode(k({},e)),i.setParent(t.id,e.id))}),r.getAllEdges().forEach(function(t){var e=Rb(r.getEdge(t.id).data),n={};null!=fb&&fb.forEach(function(t){void 0!==e[t]&&(n[t]=e[t])}),i.addEdge({id:t.id,source:t.source,target:t.target,data:Object.assign({},db,Mb(e,hb),n)})}),i},gb=function(t,e){var n=e.ranksep,n=void 0===n?0:n,r=e.rankdir;return t.getAllNodes().forEach(function(t){isNaN(t.data.layer)||t.data.layer||(t.data.layer=0)}),t.getAllEdges().forEach(function(t){var e;t.data.minlen*=2,"c"!==(null==(e=t.data.labelpos)?void 0:e.toLowerCase())&&("TB"===r||"BT"===r?t.data.width+=t.data.labeloffset:t.data.height+=t.data.labeloffset)}),n/2},mb=function(n){n.getAllEdges().forEach(function(t){var e;t.data.width&&t.data.height&&(e=n.getNode(t.source),t={e:t,rank:(n.getNode(t.target).data.rank-e.data.rank)/2+e.data.rank},mE(n,"edge-proxy",t,"_ep"))})},vb=function(n){var r=0;return n.getAllNodes().forEach(function(t){var e;t.data.borderTop&&(t.data.minRank=null==(e=n.getNode(t.data.borderTop))?void 0:e.data.rank,t.data.maxRank=null==(e=n.getNode(t.data.borderBottom))?void 0:e.data.rank,r=Math.max(r,t.data.maxRank||-1/0))}),r},yb=function(e){e.getAllNodes().forEach(function(t){"edge-proxy"===t.data.dummy&&(e.getEdge(t.data.e.id).data.labelRank=t.data.rank,e.removeNode(t.id))})},Eb=function(t,e){function n(t){var e,n,r;t.data&&(e=t.data.x,n=t.data.y,r=t.data.width,t=t.data.height,isNaN(e)||isNaN(r)||(void 0===i&&(i=e-r/2),i=Math.min(i,e-r/2),a=Math.max(a,e+r/2)),isNaN(n)||isNaN(t)||(void 0===o&&(o=n-t/2),o=Math.min(o,n-t/2),s=Math.max(s,n+t/2)))}var i,o,a=0,s=0,e=e||{},r=e.marginx,r=void 0===r?0:r,e=e.marginy,e=void 0===e?0:e;return t.getAllNodes().forEach(function(t){n(t)}),t.getAllEdges().forEach(function(t){null!=t&&t.data.hasOwnProperty("x")&&n(t)}),i-=r,o-=e,t.getAllNodes().forEach(function(t){t.data.x-=i,t.data.y-=o}),t.getAllEdges().forEach(function(t){var e;null!=(e=t.data.points)&&e.forEach(function(t){t.x-=i,t.y-=o}),t.data.hasOwnProperty("x")&&(t.data.x-=i),t.data.hasOwnProperty("y")&&(t.data.y-=o)}),{width:a-i+r,height:s-o+e}},_b=function(o){o.getAllEdges().forEach(function(t){var e,n=o.getNode(t.source),r=o.getNode(t.target),i=t.data.points?(e=t.data.points[0],t.data.points[t.data.points.length-1]):(t.data.points=[],e={x:r.data.x,y:r.data.y},{x:n.data.x,y:n.data.y});t.data.points.unshift(_E(n.data,e)),t.data.points.push(_E(r.data,i))})},bb=function(t){t.getAllEdges().forEach(function(t){if(t.data.hasOwnProperty("x"))switch("l"!==t.data.labelpos&&"r"!==t.data.labelpos||(t.data.width-=t.data.labeloffset),t.data.labelpos){case"l":t.data.x-=t.data.width/2+t.data.labeloffset;break;case"r":t.data.x+=t.data.width/2+t.data.labeloffset}})},xb=function(t){t.getAllEdges().forEach(function(t){t.data.reversed&&null!=(t=t.data.points)&&t.reverse()})},Sb=function(o){o.getAllNodes().forEach(function(t){var e,n,r,i;null!=(e=o.getChildren(t.id))&&e.length&&(e=o.getNode(t.id),t=o.getNode(e.data.borderTop),n=o.getNode(e.data.borderBottom),r=o.getNode(e.data.borderLeft[(null==(r=e.data.borderLeft)?void 0:r.length)-1]),i=o.getNode(e.data.borderRight[(null==(i=e.data.borderRight)?void 0:i.length)-1]),e.data.width=Math.abs((null==i?void 0:i.data.x)-(null==r?void 0:r.data.x))||10,e.data.height=Math.abs((null==n?void 0:n.data.y)-(null==t?void 0:t.data.y))||10,e.data.x=((null==r?void 0:r.data.x)||0)+e.data.width/2,e.data.y=((null==t?void 0:t.data.y)||0)+e.data.height/2)}),o.getAllNodes().forEach(function(t){"border"===t.data.dummy&&o.removeNode(t.id)})},wb=function(n){n.getAllEdges().forEach(function(t){var e;t.source===t.target&&((e=n.getNode(t.source)).data.selfEdges||(e.data.selfEdges=[]),e.data.selfEdges.push(t),n.removeEdge(t.id))})},Tb=function(i){var t=bE(i);null!=t&&t.forEach(function(t){var r=0;null!=t&&t.forEach(function(t,e){var n=i.getNode(t);n.data.order=e+r,null!=(t=n.data.selfEdges)&&t.forEach(function(t){mE(i,"selfedge",{width:t.data.width,height:t.data.height,rank:n.data.rank,order:e+ ++r,e:t},"_se")}),delete n.data.selfEdges})})},Ab=function(a){a.getAllNodes().forEach(function(t){var e,n,r,i,o=a.getNode(t.id);"selfedge"===o.data.dummy&&(e=(i=a.getNode(o.data.e.source)).data.x+i.data.width/2,n=i.data.y,r=o.data.x-e,i=i.data.height/2,a.hasEdge(o.data.e.id)?a.updateEdgeData(o.data.e.id,o.data.e.data):a.addEdge({id:o.data.e.id,source:o.data.e.source,target:o.data.e.target,data:o.data.e.data}),a.removeNode(t.id),o.data.e.data.points=[{x:e+2*r/3,y:n-i},{x:e+5*r/6,y:n-i},{y:n,x:e+r},{x:e+5*r/6,y:n+i},{x:e+2*r/3,y:n+i}],o.data.e.data.x=o.data.x,o.data.e.data.y=o.data.y)})},Mb=function(e,t){var n={};return null!=t&&t.forEach(function(t){void 0!==e[t]&&(n[t]=+e[t])}),n},Rb=function(e){void 0===e&&(e={});var n={};return Object.keys(e).forEach(function(t){n[t.toLowerCase()]=e[t]}),n},Nb={rankdir:"TB",nodesep:50,ranksep:50,edgeLabelSpace:!0,controlPoints:!1,radial:!1,focusNode:null},pa=(Cb.prototype.execute=function(e,n){return s(this,void 0,void 0,function(){return U(this,function(t){return[2,this.genericDagreLayout(!1,e,n)]})})},Cb.prototype.assign=function(e,n){return s(this,void 0,void 0,function(){return U(this,function(t){switch(t.label){case 0:return[4,this.genericDagreLayout(!0,e,n)];case 1:return t.sent(),[2]}})})},Cb.prototype.genericDagreLayout=function(T,A,M){return s(this,void 0,void 0,function(){var e,n,r,i,o,a,s,l,u,c,h,d,f,p,g,m,v,y,E,_,b,x,S,w;return U(this,function(t){return l=k(k({},this.options),M),S=l.nodeSize,e=l.align,n=l.rankdir,n=void 0===n?"TB":n,f=l.ranksep,r=l.nodesep,E=l.ranksepFunc,w=l.nodesepFunc,i=l.edgeLabelSpace,o=l.nodeOrder,a=l.begin,s=l.controlPoints,l=l.radial,u=new fy({tree:[]}),f=_y(f||50,E),E=_y(r||50,w),c=E,h=f,"LR"!==n&&"RL"!==n||(c=f,h=E),d=xy(S,void 0),w=A.getAllNodes(),f=A.getAllEdges(),w.forEach(function(t){var e=d(t),n=h(t),r=e+2*c(t),e=e+2*n,n=t.data.layer;B(n)?u.addNode({id:t.id,data:{width:r,height:e,layer:n}}):u.addNode({id:t.id,data:{width:r,height:e}})}),f.forEach(function(t){u.addEdge({id:t.id,source:t.source,target:t.target,data:{weight:t.data.weight||1}})}),function(t,e){var n,r=e.edgeLabelSpace,i=e.keepNodeOrder,o=e.prevGraph,a=e.rankdir,s=e.ranksep,i=(!i&&o&&sb(t,o),pb(t));r&&(e.ranksep=gb(i,{rankdir:a,ranksep:s}));try{n=ab(i,e)}catch(t){if("Not possible to find intersection inside of the rectangle"===t.message)return console.error("The following error may be caused by improper layer setting, please make sure your manual layer setting does not violate the graph's structure:\n",t);throw t}lb(t,i)}(u,{prevGraph:null,edgeLabelSpace:i,keepNodeOrder:!!o,nodeOrder:o||[],acyclicer:"greedy",ranker:"network-simplex",rankdir:n,nodesep:r,align:e}),p=[0,0],a&&(m=g=1/0,u.getAllNodes().forEach(function(t){g>t.data.x&&(g=t.data.x),m>t.data.y&&(m=t.data.y)}),u.getAllEdges().forEach(function(t){null!=(t=t.data.points)&&t.forEach(function(t){g>t.x&&(g=t.x),m>t.y&&(m=t.y)})}),p[0]=a[0]-g,p[1]=a[1]-m),v="LR"===n||"RL"===n,l||(y=new Set,E="BT"===n||"RL"===n?function(t,e){return e-t}:function(t,e){return t-e},u.getAllNodes().forEach(function(t){t.data.x=t.data.x+p[0],t.data.y=t.data.y+p[1],y.add(v?t.data.x:t.data.y)}),_=Array.from(y).sort(E),b=v?function(t,e){return t.x!==e.x}:function(t,e){return t.y!==e.y},x=v?function(t,e,n){var r=Math.max(e.y,n.y),i=Math.min(e.y,n.y);return t.filter(function(t){return t.y<=r&&t.y>=i})}:function(t,e,n){var r=Math.max(e.x,n.x),i=Math.min(e.x,n.x);return t.filter(function(t){return t.x<=r&&t.x>=i})},u.getAllEdges().forEach(function(t,e){var n;i&&s&&"loop"!==t.data.type&&(t.data.controlPoints=Pb(null==(n=t.data.points)?void 0:n.map(function(t){var e=t.x,t=t.y;return{x:e+p[0],y:t+p[1]}}),u.getNode(t.source),u.getNode(t.target),_,v,b,x))})),S=[],S=u.getAllNodes().map(function(t){return Ey(t)}),w=u.getAllEdges(),T&&(S.forEach(function(t){A.mergeNodeData(t.id,{x:t.data.x,y:t.data.y})}),w.forEach(function(t){A.mergeEdgeData(t.id,{controlPoints:t.data.controlPoints})})),[2,{nodes:S,edges:w}]})})},Cb);function Cb(t){this.options=t=void 0===t?{}:t,this.id="dagre",this.options=k(k({},Nb),t)}var Pb=function(t,e,n,r,i,o,a){var s,l,u,c,h,d,f,t=(null==t?void 0:t.slice(1,t.length-1))||[];return e&&n&&(s=(l=e.data).x,l=l.y,u=(c=n.data).x,c=c.y,i&&(s=e.data.y,l=e.data.x,u=n.data.y,c=n.data.x),c!==l)&&s!==u&&(f=r.indexOf(l),(d=r[f+1])&&(h=t[0],d=i?{x:(l+d)/2,y:(null==h?void 0:h.y)||u}:{x:(null==h?void 0:h.x)||u,y:(l+d)/2},h&&!o(h,d)||t.unshift(d)),h=r.indexOf(c),1===(d=Math.abs(h-f))?(t=a(t,e.data,n.data)).length||t.push(i?{x:(l+c)/2,y:s}:{x:s,y:(l+c)/2}):1<d&&(f=r[h-1])&&(a=t[t.length-1],e=i?{x:(c+f)/2,y:(null==a?void 0:a.y)||u}:{x:(null==a?void 0:a.x)||s,y:(c+f)/2},a&&!o(a,e)||t.push(e))),t};function Ob(t,e,n,r,i){if(!(isNaN(e)||isNaN(n)||isNaN(r))){var o,a,s,l,u,c,h,d,f,p,g,m,v=t._root,y={data:i},E=t._x0,_=t._y0,b=t._z0,x=t._x1,S=t._y1,w=t._z1;if(v){for(;v.length;)if((d=e>=(a=(E+x)/2))?E=a:x=a,(f=n>=(s=(_+S)/2))?_=s:S=s,(p=r>=(l=(b+w)/2))?b=l:w=l,!(v=(o=v)[g=p<<2|f<<1|d]))return o[g]=y,t;if(u=+t._x.call(null,v.data),c=+t._y.call(null,v.data),h=+t._z.call(null,v.data),e===u&&n===c&&r===h)y.next=v,o?o[g]=y:t._root=y;else{for(;o=o?o[g]=new Array(8):t._root=new Array(8),(d=e>=(a=(E+x)/2))?E=a:x=a,(f=n>=(s=(_+S)/2))?_=s:S=s,(p=r>=(l=(b+w)/2))?b=l:w=l,(g=p<<2|f<<1|d)==(m=(l<=h)<<2|(s<=c)<<1|a<=u););o[m]=v,o[g]=y}}else t._root=y}return t}function Ib(t,e,n,r,i,o,a){this.node=t,this.x0=e,this.y0=n,this.z0=r,this.x1=i,this.y1=o,this.z1=a}function Lb(t){return t[0]}function kb(t){return t[1]}function Db(t){return t[2]}function Bb(t,e,n,r){e=new Fb(null==e?Lb:e,null==n?kb:n,null==r?Db:r,NaN,NaN,NaN,NaN,NaN,NaN);return null==t?e:e.addAll(t)}function Fb(t,e,n,r,i,o,a,s,l){this._x=t,this._y=e,this._z=n,this._x0=r,this._y0=i,this._z0=o,this._x1=a,this._y1=s,this._z1=l,this._root=void 0}function Ub(t){for(var e={data:t.data},n=e;t=t.next;)n=n.next={data:t.data};return e}var l=Bb.prototype=Fb.prototype,Gb=(l.copy=function(){var t,e,n=new Fb(this._x,this._y,this._z,this._x0,this._y0,this._z0,this._x1,this._y1,this._z1),r=this._root;if(r)if(r.length)for(t=[{source:r,target:n._root=new Array(8)}];r=t.pop();)for(var i=0;i<8;++i)(e=r.source[i])&&(e.length?t.push({source:e,target:r.target[i]=new Array(8)}):r.target[i]=Ub(e));else n._root=Ub(r);return n},l.add=function(t){var e=+this._x.call(null,t),n=+this._y.call(null,t),r=+this._z.call(null,t);return Ob(this.cover(e,n,r),e,n,r,t)},l.addAll=function(o){var a=(o=Array.isArray(o)?o:Array.from(o)).length,s=new Float64Array(a),l=new Float64Array(a),u=new Float64Array(a);let c=1/0,h=1/0,d=1/0,f=-1/0,p=-1/0,g=-1/0;for(let t=0,e,n,r,i;t<a;++t)isNaN(n=+this._x.call(null,e=o[t]))||isNaN(r=+this._y.call(null,e))||isNaN(i=+this._z.call(null,e))||(s[t]=n,l[t]=r,u[t]=i,n<c&&(c=n),n>f&&(f=n),r<h&&(h=r),r>p&&(p=r),i<d&&(d=i),i>g&&(g=i));if(!(c>f||h>p||d>g)){this.cover(c,h,d).cover(f,p,g);for(let t=0;t<a;++t)Ob(this,s[t],l[t],u[t],o[t])}return this},l.cover=function(t,e,n){if(!(isNaN(t=+t)||isNaN(e=+e)||isNaN(n=+n))){var r=this._x0,i=this._y0,o=this._z0,a=this._x1,s=this._y1,l=this._z1;if(isNaN(r))a=(r=Math.floor(t))+1,s=(i=Math.floor(e))+1,l=(o=Math.floor(n))+1;else{for(var u,c,h=a-r||1,d=this._root;t<r||a<=t||e<i||s<=e||n<o||l<=n;)switch(c=(n<o)<<2|(e<i)<<1|t<r,(u=new Array(8))[c]=d,d=u,h*=2,c){case 0:a=r+h,s=i+h,l=o+h;break;case 1:r=a-h,s=i+h,l=o+h;break;case 2:a=r+h,i=s-h,l=o+h;break;case 3:r=a-h,i=s-h,l=o+h;break;case 4:a=r+h,s=i+h,o=l-h;break;case 5:r=a-h,s=i+h,o=l-h;break;case 6:a=r+h,i=s-h,o=l-h;break;case 7:r=a-h,i=s-h,o=l-h}this._root&&this._root.length&&(this._root=d)}this._x0=r,this._y0=i,this._z0=o,this._x1=a,this._y1=s,this._z1=l}return this},l.data=function(){var e=[];return this.visit(function(t){if(!t.length)for(;e.push(t.data),t=t.next;);}),e},l.extent=function(t){return arguments.length?this.cover(+t[0][0],+t[0][1],+t[0][2]).cover(+t[1][0],+t[1][1],+t[1][2]):isNaN(this._x0)?void 0:[[this._x0,this._y0,this._z0],[this._x1,this._y1,this._z1]]},l.find=function(t,e,n,r){var i,o,a,s,l,u,c,h,d,f,p,g=this._x0,m=this._y0,v=this._z0,y=this._x1,E=this._y1,_=this._z1,b=[],x=this._root;for(x&&b.push(new Ib(x,g,m,v,y,E,_)),null==r?r=1/0:(g=t-r,m=e-r,v=n-r,y=t+r,E=e+r,_=n+r,r*=r);i=b.pop();)!(x=i.node)||(h=i.x0)>y||(d=i.y0)>E||(f=i.z0)>_||(c=i.x1)<g||(u=i.y1)<m||(o=i.z1)<v||(x.length?(b.push(new Ib(x[7],a=(h+c)/2,s=(d+u)/2,l=(f+o)/2,c,u,o),new Ib(x[6],h,s,l,a,u,o),new Ib(x[5],a,d,l,c,s,o),new Ib(x[4],h,d,l,a,s,o),new Ib(x[3],a,s,f,c,u,l),new Ib(x[2],h,s,f,a,u,l),new Ib(x[1],a,d,f,c,s,l),new Ib(x[0],h,d,f,a,s,l)),(o=(l<=n)<<2|(s<=e)<<1|a<=t)&&(i=b[b.length-1],b[b.length-1]=b[b.length-1-o],b[b.length-1-o]=i)):(d=(u=t-+this._x.call(null,x.data))*u+(c=e-+this._y.call(null,x.data))*c+(h=n-+this._z.call(null,x.data))*h)<r&&(g=t-(f=Math.sqrt(r=d)),m=e-f,v=n-f,y=t+f,E=e+f,_=n+f,p=x.data));return p},l.remove=function(t){if(!(isNaN(o=+this._x.call(null,t))||isNaN(a=+this._y.call(null,t))||isNaN(s=+this._z.call(null,t)))){var e,n,r,i,o,a,s,l,u,c,h,d,f,p=this._root,g=this._x0,m=this._y0,v=this._z0,y=this._x1,E=this._y1,_=this._z1;if(p){if(p.length)for(;;){if((u=o>=(l=(g+y)/2))?g=l:y=l,(c=a>=(l=(m+E)/2))?m=l:E=l,(h=s>=(l=(v+_)/2))?v=l:_=l,!(p=(e=p)[d=h<<2|c<<1|u]))return this;if(!p.length)break;(e[d+1&7]||e[d+2&7]||e[d+3&7]||e[d+4&7]||e[d+5&7]||e[d+6&7]||e[d+7&7])&&(n=e,f=d)}for(;p.data!==t;)if(!(p=(r=p).next))return this;(i=p.next)&&delete p.next,r?i?r.next=i:delete r.next:e?(i?e[d]=i:delete e[d],(p=e[0]||e[1]||e[2]||e[3]||e[4]||e[5]||e[6]||e[7])&&p===(e[7]||e[6]||e[5]||e[4]||e[3]||e[2]||e[1]||e[0])&&!p.length&&(n?n[f]=p:this._root=p)):this._root=i}}return this},l.removeAll=function(t){for(var e=0,n=t.length;e<n;++e)this.remove(t[e]);return this},l.root=function(){return this._root},l.size=function(){var e=0;return this.visit(function(t){if(!t.length)for(;++e,t=t.next;);}),e},l.visit=function(t){var e,n,r,i,o,a,s,l,u,c,h=[],d=this._root;for(d&&h.push(new Ib(d,this._x0,this._y0,this._z0,this._x1,this._y1,this._z1));s=h.pop();)!t(d=s.node,n=s.x0,r=s.y0,i=s.z0,o=s.x1,a=s.y1,s=s.z1)&&d.length&&(l=(n+o)/2,u=(r+a)/2,c=(i+s)/2,(e=d[7])&&h.push(new Ib(e,l,u,c,o,a,s)),(e=d[6])&&h.push(new Ib(e,n,u,c,l,a,s)),(e=d[5])&&h.push(new Ib(e,l,r,c,o,u,s)),(e=d[4])&&h.push(new Ib(e,n,r,c,l,u,s)),(e=d[3])&&h.push(new Ib(e,l,u,i,o,a,c)),(e=d[2])&&h.push(new Ib(e,n,u,i,l,a,c)),(e=d[1])&&h.push(new Ib(e,l,r,i,o,u,c)),e=d[0])&&h.push(new Ib(e,n,r,i,l,u,c));return this},l.visitAfter=function(t){var e,n=[],r=[];for(this._root&&n.push(new Ib(this._root,this._x0,this._y0,this._z0,this._x1,this._y1,this._z1));e=n.pop();){var i,o,a,s,l,u,c,h,d,f,p=e.node;p.length&&(o=e.x0,a=e.y0,s=e.z0,h=(o+(l=e.x1))/2,d=(a+(u=e.y1))/2,f=(s+(c=e.z1))/2,(i=p[0])&&n.push(new Ib(i,o,a,s,h,d,f)),(i=p[1])&&n.push(new Ib(i,h,a,s,l,d,f)),(i=p[2])&&n.push(new Ib(i,o,d,s,h,u,f)),(i=p[3])&&n.push(new Ib(i,h,d,s,l,u,f)),(i=p[4])&&n.push(new Ib(i,o,a,f,h,d,c)),(i=p[5])&&n.push(new Ib(i,h,a,f,l,d,c)),(i=p[6])&&n.push(new Ib(i,o,d,f,h,u,c)),i=p[7])&&n.push(new Ib(i,h,d,f,l,u,c)),r.push(e)}for(;e=r.pop();)t(e.node,e.x0,e.y0,e.z0,e.x1,e.y1,e.z1);return this},l.x=function(t){return arguments.length?(this._x=t,this):this._x},l.y=function(t){return arguments.length?(this._y=t,this):this._y},l.z=function(t){return arguments.length?(this._z=t,this):this._z},.81),Wb=.1;function Vb(t,e,n,r,i){var o=e/n,a=t.getAllNodes(),e=a.map(function(t,e){var t=t.data,n=t.nodeStrength;return{x:t.x,y:t.y,z:t.z,size:t.size,index:e,vx:0,vy:0,vz:0,weight:o*n}}),s=(2===i?s1(e,function(t){return t.x},function(t){return t.y}):Bb(e,function(t){return t.x},function(t){return t.y},function(t){return t.z})).visitAfter(jb);e.forEach(function(t){var o,a;o=t,a=i,s.visit(function(t,e,n,r,i){return zb(t,e,n,r,i,o,a)})}),e.map(function(t,e){var e=a[e],n=e.id,e=e.data.mass,e=void 0===e?1:e;r[n]={x:t.vx/e,y:t.vy/e,z:t.vz/e}})}function jb(t){var e=0,n=0,r=0,i=0,o=t.length;if(o){for(var a=0;a<o;a++)(s=t[a])&&s.weight&&(e+=s.weight,n+=s.x*s.weight,r+=s.y*s.weight,i+=s.z*s.weight);t.x=n/e,t.y=r/e,t.z=i/e,t.weight=e}else{var s=t;t.x=s.data.x,t.y=s.data.y,t.z=s.data.z,t.weight=s.data.weight}}var zb=function(t,e,n,r,i,o,a){var s,l=o.x-t.x||Wb,u=o.y-t.y||Wb,c=o.z-t.z||Wb,n=[n,r,i][a-1]-e,r=l*l+u*u+c*c,i=Math.sqrt(r)*r;return n*n*Gb<r?(s=t.weight/i,o.vx+=l*s,o.vy+=u*s,o.vz+=c*s,!0):!t.length&&void(t.data!==o&&(s=t.data.weight/i,o.vx+=l*s,o.vy+=u*s,o.vz+=c*s))};var Hb={dimensions:2,maxIteration:500,gravity:10,factor:1,edgeStrength:200,nodeStrength:1e3,coulombDisScale:.005,damping:.9,maxSpeed:500,minMovement:.4,interval:.02,linkDistance:200,clusterNodeStrength:20,preventOverlap:!0,distanceThresholdMode:"mean"},Ea=(Xb.prototype.execute=function(e,n){return s(this,void 0,void 0,function(){return U(this,function(t){return[2,this.genericForceLayout(!1,e,n)]})})},Xb.prototype.assign=function(e,n){return s(this,void 0,void 0,function(){return U(this,function(t){return this.genericForceLayout(!0,e,n),[2]})})},Xb.prototype.stop=function(){this.timeInterval&&"undefined"!=typeof window&&window.clearInterval(this.timeInterval),this.running=!1},Xb.prototype.tick=function(t){var e=this;if(void 0===t&&(t=this.options.maxIteration||1),this.lastResult)return this.lastResult;for(var n=0;(this.judgingDistance>this.lastOptions.minMovement||n<1)&&n<t;n++)this.runOneStep(this.lastCalcGraph,this.lastGraph,n,this.lastVelMap,this.lastOptions),this.updatePosition(this.lastGraph,this.lastCalcGraph,this.lastVelMap,this.lastOptions);var r={nodes:this.lastLayoutNodes,edges:this.lastLayoutEdges};return this.lastAssign&&r.nodes.forEach(function(t){return e.lastGraph.mergeNodeData(t.id,{x:t.data.x,y:t.data.y,z:3===e.options.dimensions?t.data.z:void 0})}),r},Xb.prototype.genericForceLayout=function(b,x,S){return s(this,void 0,void 0,function(){var e,n,r,i,o,a,s,l,u,c,h,d,f,p,g,m,v,y,E,_=this;return U(this,function(t){return f=k(k({},this.options),S),e=x.getAllNodes(),n=x.getAllEdges(),r=this.formatOptions(f,x),i=r.dimensions,o=r.width,a=r.height,s=r.nodeSize,l=r.getMass,u=r.nodeStrength,c=r.edgeStrength,h=r.linkDistance,d=e.map(function(t,e){return k(k({},t),{data:k(k({},t.data),{x:B(t.data.x)?t.data.x:Math.random()*o,y:B(t.data.y)?t.data.y:Math.random()*a,z:B(t.data.z)?t.data.z:Math.random()*Math.sqrt(o*a),size:s(t)||30,mass:l(t),nodeStrength:u(t)})})}),f=n.map(function(t){return k(k({},t),{data:k(k({},t.data),{edgeStrength:c(t),linkDistance:h(t,x.getNode(t.source),x.getNode(t.target))})})}),null!=e&&e.length?(p={},e.forEach(function(t,e){p[t.id]={x:0,y:0,z:0}}),g=new fy({nodes:d,edges:f}),this.formatCentripetal(r,g),m=r.maxIteration,v=r.minMovement,y=r.onTick,this.lastLayoutNodes=d,this.lastLayoutEdges=f,this.lastAssign=b,this.lastGraph=x,this.lastCalcGraph=g,this.lastOptions=r,this.lastVelMap=p,"undefined"==typeof window?[2]:(E=0,[2,new Promise(function(t){_.timeInterval=window.setInterval(function(){e&&_.running||t({nodes:Zb(x,d),edges:n}),_.runOneStep(g,x,E,p,r),_.updatePosition(x,g,p,r),b&&d.forEach(function(t){return x.mergeNodeData(t.id,{x:t.data.x,y:t.data.y,z:3===i?t.data.z:void 0})}),null!=y&&y({nodes:Zb(x,d),edges:n}),(m<=++E||_.judgingDistance<v)&&(window.clearInterval(_.timeInterval),t({nodes:Zb(x,d),edges:n}))},0),_.running=!0})])):(this.lastResult={nodes:[],edges:n},[2,{nodes:[],edges:n}])})})},Xb.prototype.formatOptions=function(n,r){var i,e=n,t=n.width,o=n.height,a=n.getMass;return e.width=t||"undefined"==typeof window?t:window.innerWidth,e.height=o||"undefined"==typeof window?o:window.innerHeight,n.center||(e.center=[e.width/2,e.height/2]),a||(e.getMass=function(t){var e=1,t=(B(null==t?void 0:t.data.mass)&&(e=null==t?void 0:t.data.mass),r.getDegree(t.id,"both"));return!t||t<5?e:5*t*e}),n.preventOverlap&&(i=_y(0,n.nodeSpacing),n.nodeSize?my(n.nodeSize)?e.nodeSize=function(t){var e=n.nodeSize;return Math.max(e[0],e[1])+i(t)}:e.nodeSize=function(t){return n.nodeSize+i(t)}:e.nodeSize=function(t){var e=((null==t?void 0:t.data)||{}).size;return e?my(e)?Math.max(e[0],e[1])+i(t):Ie(e)?Math.max(e.width,e.height)+i(t):e+i(t):10+i(t)}),e.linkDistance=n.linkDistance?_y(1,n.linkDistance):function(t){return 1+e.nodeSize(r.getNode(t.source))+e.nodeSize(r.getNode(t.target))},e.nodeStrength=_y(1,n.nodeStrength),e.edgeStrength=_y(1,n.edgeStrength),n},Xb.prototype.formatCentripetal=function(r,i){var o,n,e=r.dimensions,t=r.centripetalOptions,a=r.center,s=r.clusterNodeStrength,l=r.leafCluster,u=r.clustering,c=r.nodeClusterBy,h=i.getAllNodes(),t=t||{leaf:2,single:2,others:1,center:function(t){return{x:a[0],y:a[1],z:3===e?a[2]:void 0}}},d=("function"!=typeof s&&(r.clusterNodeStrength=function(t){return s}),[]),l=(l&&c&&(o=Yb(i,c),d=Array.from(new Set(null==h?void 0:h.map(function(t){return t.data[c]})))||[],r.centripetalOptions=Object.assign(t,{single:100,leaf:function(t){var e=o[t.id]||{},n=e.siblingLeaves,e=e.sameTypeLeaves;return(null==e?void 0:e.length)===(null==n?void 0:n.length)||1===(null==d?void 0:d.length)?1:r.clusterNodeStrength(t)},others:1,center:function(t){var e,n=i.getDegree(t.id,"both");return n?(1!==n||1===(t=void 0===(n=(o[t.id]||{}).sameTypeLeaves)?[]:n).length?e=void 0:1<t.length&&(e=$b(t)),{x:null==e?void 0:e.x,y:null==e?void 0:e.y,z:null==e?void 0:e.z}):{x:100,y:100,z:0}}})),u&&c&&(o=o||Yb(i,c),d=(d=d||Array.from(new Set(h.map(function(t){return t.data[c]})))).filter(function(t){return void 0!==t}),n={},d.forEach(function(e){var t=h.filter(function(t){return t.data[c]===e}).map(function(t){return i.getNode(t.id)});n[e]=$b(t)}),r.centripetalOptions=Object.assign(t,{single:function(t){return r.clusterNodeStrength(t)},leaf:function(t){return r.clusterNodeStrength(t)},others:function(t){return r.clusterNodeStrength(t)},center:function(t){t=n[t.data[c]];return{x:null==t?void 0:t.x,y:null==t?void 0:t.y,z:null==t?void 0:t.z}}})),r.centripetalOptions||{}),f=l.leaf,p=l.single,g=l.others;f&&"function"!=typeof f&&(r.centripetalOptions.leaf=function(){return f}),p&&"function"!=typeof p&&(r.centripetalOptions.single=function(){return p}),g&&"function"!=typeof g&&(r.centripetalOptions.others=function(){return g})},Xb.prototype.runOneStep=function(t,e,n,r,i){var o,a={},s=t.getAllNodes(),l=t.getAllEdges();null!=s&&s.length&&(o=i.monitor,this.calRepulsive(t,a,i),l&&this.calAttractive(t,a,i),this.calGravity(t,e,a,i),this.updateVelocity(t,a,r,i),o)&&o({energy:this.calTotalEnergy(a,s),nodes:e.getAllNodes(),edges:e.getAllEdges(),iterations:n})},Xb.prototype.calTotalEnergy=function(o,t){var a,s=this;return null!=t&&t.length?(a=0,t.forEach(function(t,e){var n=o[t.id].x,r=o[t.id].y,i=3===s.options.dimensions?o[t.id].z:0,t=t.data.mass;a+=(void 0===t?1:t)*(n*n+r*r+i*i)*.5}),a):0},Xb.prototype.calRepulsive=function(t,e,n){var r=n.dimensions,i=n.factor,n=n.coulombDisScale;Vb(t,i,n*n,e,r)},Xb.prototype.calAttractive=function(h,d,t){var f=t.dimensions;h.getAllEdges().forEach(function(t,e){var n,r,i,o,a,s=t.source,l=t.target,u=h.getNode(s),c=h.getNode(l);u&&c&&(n=c.data.x-u.data.x,i=c.data.y-u.data.y,o=3===f?c.data.z-u.data.z:0,n||i||(n=.01*Math.random(),i=.01*Math.random(),3===f&&(o=o||.01*Math.random())),r=Math.sqrt(n*n+i*i+o*o),a=(t=t.data||{}).linkDistance,t=t.edgeStrength,u=1/(u.data.mass||1),c=1/(c.data.mass||1),a=i/r*(i=((void 0===a?200:a)-r)*(void 0===t?200:t)),t=o/r*i,d[s].x-=(o=n/r*i)*u,d[s].y-=a*u,d[s].z-=t*u,d[l].x+=o*c,d[l].y+=a*c,d[l].z+=t*c)})},Xb.prototype.calGravity=function(m,v,y,t){var E=t.getCenter,e=m.getAllNodes(),_=v.getAllNodes(),b=v.getAllEdges(),x=t.width,S=t.height,w=t.center,T=t.gravity,A=t.centripetalOptions;e&&e.forEach(function(t){var e=t.id,t=t.data,n=t.mass,r=t.x,i=t.y,t=t.z,o=v.getNode(e),a=0,s=0,l=0,u=T,c=m.getDegree(e,"in"),h=m.getDegree(e,"out"),d=m.getDegree(e,"both"),f=null==E?void 0:E(o,d);if(f?(a=r-(f=D(f,3))[0],s=i-f[1],u=f[2]):(a=r-w[0],s=i-w[1],l=t-w[2]),u&&(y[e].x-=u*a/n,y[e].y-=u*s/n,y[e].z-=u*l/n),A){var f=A.leaf,a=A.single,s=A.others,u=A.center,l=(null==u?void 0:u(o,_,b,x,S))||{x:0,y:0,z:0,centerStrength:0},u=l.x,p=l.y,g=l.z,l=l.centerStrength;if(B(u)&&B(p))return r=(r-u)/n,u=(i-p)/n,i=(t-g)/n,l&&(y[e].x-=l*r,y[e].y-=l*u,y[e].z-=l*i),0===d?(p=a(o))?(y[e].x-=p*r,y[e].y-=p*u,void(y[e].z-=p*i)):void 0:0===c||0===h?(t=f(o,_,b))?(y[e].x-=t*r,y[e].y-=t*u,void(y[e].z-=t*i)):void 0:void((g=s(o))&&(y[e].x-=g*r,y[e].y-=g*u,y[e].z-=g*i))}})},Xb.prototype.updateVelocity=function(t,o,a,e){var s=e.damping,l=e.maxSpeed,u=e.interval,c=e.dimensions,e=t.getAllNodes();null!=e&&e.length&&e.forEach(function(t){var t=t.id,e=(a[t].x+o[t].x*u)*s||.01,n=(a[t].y+o[t].y*u)*s||.01,r=3===c?(a[t].z+o[t].z*u)*s||.01:0,i=Math.sqrt(e*e+n*n+r*r);l<i&&(e*=i=l/i,n*=i,r*=i),a[t]={x:e,y:n,z:r}})},Xb.prototype.updatePosition=function(a,s,l,t){var u,c=this,h=t.distanceThresholdMode,d=t.interval,f=t.dimensions,t=s.getAllNodes();null!=t&&t.length?(u=0,"max"===h?this.judgingDistance=-1/0:"min"===h&&(this.judgingDistance=1/0),t.forEach(function(t){var e=t.id,n=a.getNode(e);if(B(n.data.fx)&&B(n.data.fy))s.mergeNodeData(e,{x:n.data.fx,y:n.data.fy,z:3===f?n.data.fz:void 0});else{var n=l[e].x*d,r=l[e].y*d,i=3===f?l[e].z*d:0,o=(s.mergeNodeData(e,{x:t.data.x+n,y:t.data.y+r,z:t.data.z+i}),Math.sqrt(n*n+r*r+i*i));switch(h){case"max":c.judgingDistance<o&&(c.judgingDistance=o);break;case"min":c.judgingDistance>o&&(c.judgingDistance=o);break;default:u+=o}}}),h&&"mean"!==h||(this.judgingDistance=u/t.length)):this.judgingDistance=0},Xb);function Xb(t){this.options=t=void 0===t?{}:t,this.id="force",this.timeInterval=0,this.judgingDistance=0,this.running=!1,this.options=k(k({},Hb),t)}var Yb=function(n,r){var i,t=n.getAllNodes();return null!=t&&t.length?(i={},t.forEach(function(t,e){1===n.getDegree(t.id,"both")&&(i[t.id]=Kb(n,"leaf",t,r))}),i):{}},Kb=function(e,t,n,r){var i=e.getDegree(n.id,"in"),o=e.getDegree(n.id,"out"),a=n,s=[],i=(0===i?(a=e.getSuccessors(n.id)[0],s=e.getNeighbors(a.id)):0===o&&(a=e.getPredecessors(n.id)[0],s=e.getNeighbors(a.id)),s=s.filter(function(t){return 0===e.getDegree(t.id,"in")||0===e.getDegree(t.id,"out")}),qb(e,t,r,n,s));return{coreNode:a,siblingLeaves:s,sameTypeLeaves:i}},qb=function(e,t,n,r,i){var o=r.data[n]||"",r=(null==i?void 0:i.filter(function(t){return t.data[n]===o}))||[];return r="leaf"===t?r.filter(function(t){return 0===e.getDegree(t.id,"in")||0===e.getDegree(t.id,"out")}):r},$b=function(t){var n={x:0,y:0},t=(t.forEach(function(t){var t=t.data,e=t.x,t=t.y;n.x+=e||0,n.y+=t||0}),t.length||1);return{x:n.x/t,y:n.y/t}},Zb=function(n,t){return t.map(function(t){var e=t.id,t=t.data,e=n.getNode(e);return k(k({},e),{data:k(k({},e.data),{x:t.x,y:t.y,z:t.z})})})};function Qb(t){this.id=t.id||0,this.rx=t.rx,this.ry=t.ry,this.fx=0,this.fy=0,this.mass=t.mass,this.degree=t.degree,this.g=t.g||0}Qb.prototype.distanceTo=function(t){var e=this.rx-t.rx,t=this.ry-t.ry;return Math.hypot(e,t)},Qb.prototype.setPos=function(t,e){this.rx=t,this.ry=e},Qb.prototype.resetForce=function(){this.fx=0,this.fy=0},Qb.prototype.addForce=function(t){var e=t.rx-this.rx,n=t.ry-this.ry,r=Math.hypot(e,n),t=this.g*(this.degree+1)*(t.degree+1)/(r=r<1e-4?1e-4:r);this.fx+=t*e/r,this.fy+=t*n/r},Qb.prototype.in=function(t){return t.contains(this.rx,this.ry)},Qb.prototype.add=function(t){var e=this.mass+t.mass;return new Qb({rx:(this.rx*this.mass+t.rx*t.mass)/e,ry:(this.ry*this.mass+t.ry*t.mass)/e,mass:e,degree:this.degree+t.degree})};var Jb=Qb;function tx(t){this.xmid=t.xmid,this.ymid=t.ymid,this.length=t.length,this.massCenter=t.massCenter||[0,0],this.mass=t.mass||1}tx.prototype.getLength=function(){return this.length},tx.prototype.contains=function(t,e){var n=this.length/2;return t<=this.xmid+n&&t>=this.xmid-n&&e<=this.ymid+n&&e>=this.ymid-n},tx.prototype.NW=function(){return new tx({xmid:this.xmid-this.length/4,ymid:this.ymid+this.length/4,length:this.length/2})},tx.prototype.NE=function(){return new tx({xmid:this.xmid+this.length/4,ymid:this.ymid+this.length/4,length:this.length/2})},tx.prototype.SW=function(){return new tx({xmid:this.xmid-this.length/4,ymid:this.ymid-this.length/4,length:this.length/2})},tx.prototype.SE=function(){return new tx({xmid:this.xmid+this.length/4,ymid:this.ymid-this.length/4,length:this.length/2})};var ex=tx;function nx(t){this.body=null,this.quad=null,this.NW=null,this.NE=null,this.SW=null,this.SE=null,this.theta=.5,null!=t&&(this.quad=t)}nx.prototype.insert=function(t){null==this.body?this.body=t:this._isExternal()?(this.quad&&(this.NW=new nx(this.quad.NW()),this.NE=new nx(this.quad.NE()),this.SW=new nx(this.quad.SW()),this.SE=new nx(this.quad.SE())),this._putBody(this.body),this._putBody(t),this.body=this.body.add(t)):(this.body=this.body.add(t),this._putBody(t))},nx.prototype._putBody=function(t){this.quad&&(t.in(this.quad.NW())&&this.NW?this.NW.insert(t):t.in(this.quad.NE())&&this.NE?this.NE.insert(t):t.in(this.quad.SW())&&this.SW?this.SW.insert(t):t.in(this.quad.SE())&&this.SE&&this.SE.insert(t))},nx.prototype._isExternal=function(){return null==this.NW&&null==this.NE&&null==this.SW&&null==this.SE},nx.prototype.updateForce=function(t){null!=this.body&&t!==this.body&&(this._isExternal()||(this.quad?this.quad.getLength():0)/this.body.distanceTo(t)<this.theta?t.addForce(this.body):(this.NW&&this.NW.updateForce(t),this.NE&&this.NE.updateForce(t),this.SW&&this.SW.updateForce(t),this.SE&&this.SE.updateForce(t)))};var rx=nx,ix={center:[0,0],width:300,height:300,kr:5,kg:1,mode:"normal",preventOverlap:!1,dissuadeHubs:!1,maxIteration:0,ks:.1,ksmax:10,tao:.1},Fs=(ox.prototype.execute=function(e,n){return s(this,void 0,void 0,function(){return U(this,function(t){return[2,this.genericForceAtlas2Layout(!1,e,n)]})})},ox.prototype.assign=function(e,n){return s(this,void 0,void 0,function(){return U(this,function(t){return this.genericForceAtlas2Layout(!0,e,n),[2]})})},ox.prototype.genericForceAtlas2Layout=function(v,y,E){return s(this,void 0,void 0,function(){var e,n,r,i,o,a,s,l,u,c,h,d,f,p,g,m;return U(this,function(t){if(e=y.getAllEdges(),c=y.getAllNodes(),n=this.formatOptions(E,c.length),r=n.width,i=n.height,o=n.prune,a=n.maxIteration,m=n.nodeSize,s=n.center,null==c||!c.length||1===c.length)return[2,Sy(y,v,s)];if(s=c.map(function(t){return Ey(t,[r,i])}),l=e.filter(function(t){return t.source!==t.target}),u=new fy({nodes:s,edges:l}),c=this.getSizes(u,y,m),this.run(u,y,a,c,v,n),o){for(h=0;h<l.length;h+=1)f=l[h],d=f.source,f=f.target,g=u.getDegree(d),p=u.getDegree(d),g<=1?(g=u.getNode(f),u.mergeNodeData(d,{x:g.data.x,y:g.data.y})):p<=1&&(g=u.getNode(d),u.mergeNodeData(f,{x:g.data.x,y:g.data.y}));m=k(k({},n),{prune:!1,barnesHut:!1}),this.run(u,y,100,c,v,m)}return[2,{nodes:s,edges:e}]})})},ox.prototype.getSizes=function(t,e,n){for(var r=t.getAllNodes(),i={},o=0;o<r.length;o+=1){var a=r[o],s=a.id,a=a.data;i[s]=10,B(a.size)?i[s]=a.size:my(a.size)?(isNaN(a.size[0])||(i[s]=Math.max(a.size[0])),isNaN(a.size[1])||(i[s]=Math.max(a.size[1]))):Ie(a.size)?i[s]=Math.max(a.size.width,a.size.height):Ne(n)?(a=n(e.getNode(s)),my(a)?i[s]=Math.max.apply(Math,O([],D(a))):i[s]=a):my(n)?i[s]=Math.max.apply(Math,O([],D(n))):B(n)&&(i[s]=n)}return i},ox.prototype.formatOptions=function(t,e){void 0===t&&(t={});var t=k(k({},this.options),t),n=t.center,r=t.width,i=t.height,o=t.barnesHut,a=t.prune,s=t.maxIteration,l=t.kr,u=t.kg;return t.width=r||"undefined"==typeof window?r:window.innerWidth,t.height=i||"undefined"==typeof window?i:window.innerHeight,t.center=n||[t.width/2,t.height/2],void 0===o&&250<e&&(t.barnesHut=!0),void 0===a&&100<e&&(t.prune=!0),0!==s||a?0===s&&a&&(t.maxIteration=100,e<=200&&100<e?t.maxIteration=500:200<e&&(t.maxIteration=950)):(t.maxIteration=250,e<=200&&100<e?t.maxIteration=1e3:200<e&&(t.maxIteration=1200)),l||(t.kr=50,100<e&&e<=500?t.kr=20:500<e&&(t.kr=1)),u||(t.kg=20,100<e&&e<=500?t.kg=10:500<e&&(t.kg=1)),t},ox.prototype.run=function(t,e,n,r,i,o){for(var a=o.kr,s=o.barnesHut,l=o.onTick,u=t.getAllNodes(),c=0,h=n,d={},f={},p={},g=0;g<u.length;g+=1){var m=u[g],v=m.data,m=m.id;d[m]=[0,0],s&&(v={id:g,rx:v.x,ry:v.y,mass:1,g:a,degree:t.getDegree(m)},p[m]=new Jb(v))}for(;0<h;)c=this.oneStep(t,{iter:h,preventOverlapIters:50,krPrime:100,sg:c,forces:d,preForces:f,bodies:p,sizes:r},o),h--,null!=l&&l({nodes:u,edges:e.getAllEdges()});return t},ox.prototype.oneStep=function(t,e,n){for(var r=e.iter,i=e.preventOverlapIters,o=e.krPrime,a=e.sg,s=e.preForces,l=e.bodies,u=e.sizes,c=e.forces,e=n.preventOverlap,h=n.barnesHut,d=t.getAllNodes(),f=0;f<d.length;f+=1){var p=d[f].id;s[p]=O([],D(c[p])),c[p]=[0,0]}return c=this.getAttrForces(t,r,i,u,c,n),c=h&&(e&&i<r||!e)?this.getOptRepGraForces(t,c,l,n):this.getRepGraForces(t,r,i,c,o,u,n),this.updatePos(t,c,s,a,n)},ox.prototype.getAttrForces=function(t,e,n,r,i,o){for(var a=o.preventOverlap,s=o.dissuadeHubs,l=o.mode,u=o.prune,c=t.getAllEdges(),h=0;h<c.length;h+=1){var d,f,p=c[h],g=p.source,p=p.target,m=t.getNode(g),v=t.getNode(p),y=t.getDegree(g),E=t.getDegree(p);u&&(y<=1||E<=1)||(v=[v.data.x-m.data.x,v.data.y-m.data.y],m=(m=Math.hypot(v[0],v[1]))<1e-4?1e-4:m,v[0]=v[0]/m,v[1]=v[1]/m,f=d=m=a&&e<n?m-r[g]-r[p]:m,"linlog"===l&&(f=d=Math.log(1+m)),s&&(d=m/y,f=m/E),a&&e<n&&m<=0?f=d=0:a&&e<n&&0<m&&(f=d=m),i[g][0]+=d*v[0],i[p][0]-=f*v[0],i[g][1]+=d*v[1],i[p][1]-=f*v[1])}return i},ox.prototype.getOptRepGraForces=function(t,e,n,r){for(var i=r.kg,o=r.center,a=r.prune,s=t.getAllNodes(),l=s.length,u=9e10,c=-9e10,h=9e10,d=-9e10,f=0;f<l;f+=1){var p=s[f],g=p.id,m=p.data;a&&t.getDegree(g)<=1||(n[g].setPos(m.x,m.y),m.x>=c&&(c=m.x),m.x<=u&&(u=m.x),m.y>=d&&(d=m.y),m.y<=h&&(h=m.y))}for(var r=Math.max(c-u,d-h),v=new ex({xmid:(c+u)/2,ymid:(d+h)/2,length:r,massCenter:o,mass:l}),y=new rx(v),f=0;f<l;f+=1){g=s[f].id;a&&t.getDegree(g)<=1||n[g].in(v)&&y.insert(n[g])}for(f=0;f<l;f+=1){var E,_,b=s[f],g=b.id,m=b.data,b=t.getDegree(g);a&&b<=1||(n[g].resetForce(),y.updateForce(n[g]),e[g][0]-=n[g].fx,e[g][1]-=n[g].fy,E=[m.x-o[0],m.y-o[1]],_=Math.hypot(E[0],E[1]),E[0]=E[0]/(_=_<1e-4?1e-4:_),E[1]=E[1]/_,e[g][0]-=(_=i*(b+1))*E[0],e[g][1]-=_*E[1])}return e},ox.prototype.getRepGraForces=function(t,e,n,r,i,o,a){for(var s=a.preventOverlap,l=a.kr,u=a.kg,c=a.center,h=a.prune,d=t.getAllNodes(),f=d.length,p=0;p<f;p+=1){for(var g=d[p],m=t.getDegree(g.id),v=p+1;v<f;v+=1){var y,E,_,b=d[v],x=t.getDegree(b.id);h&&(m<=1||x<=1)||(y=[b.data.x-g.data.x,b.data.y-g.data.y],E=(E=Math.hypot(y[0],y[1]))<1e-4?1e-4:E,y[0]=y[0]/E,y[1]=y[1]/E,_=l*(m+1)*(x+1)/(E=s&&e<n?E-o[g.id]-o[b.id]:E),s&&e<n&&E<0?_=i*(m+1)*(x+1):s&&e<n&&0===E?_=0:s&&e<n&&0<E&&(_=l*(m+1)*(x+1)/E),r[g.id][0]-=_*y[0],r[b.id][0]+=_*y[0],r[g.id][1]-=_*y[1],r[b.id][1]+=_*y[1])}var S=[g.data.x-c[0],g.data.y-c[1]],w=Math.hypot(S[0],S[1]),w=(S[0]=S[0]/w,S[1]=S[1]/w,u*(m+1));r[g.id][0]-=w*S[0],r[g.id][1]-=w*S[1]}return r},ox.prototype.updatePos=function(t,e,n,r,i){for(var o=i.ks,a=i.tao,s=i.prune,l=i.ksmax,u=t.getAllNodes(),c=u.length,h=[],d=[],f=0,p=0,g=r,m=0;m<c;m+=1){var v,y,E=u[m].id,_=t.getDegree(E);s&&_<=1||(v=[e[E][0]-n[E][0],e[E][1]-n[E][1]],v=Math.hypot(v[0],v[1]),y=[e[E][0]+n[E][0],e[E][1]+n[E][1]],y=Math.hypot(y[0],y[1]),h[m]=v,d[m]=y/2,f+=(_+1)*h[m],p+=(_+1)*d[m])}i=g,g=a*p/f;0!==i&&(g=1.5*i<g?1.5*i:g);for(m=0;m<c;m+=1){var b,x,S=u[m],E=S.id,S=S.data,_=t.getDegree(E);s&&_<=1||B(S.fx)&&B(S.fy)||(x=o*g/(1+g*Math.sqrt(h[m])),b=(x=(b=l/(b=(b=Math.hypot(e[E][0],e[E][1]))<1e-4?1e-4:b))<x?b:x)*e[E][0],x=x*e[E][1],t.mergeNodeData(E,{x:S.x+b,y:S.y+x}))}return g},ox);function ox(t){this.options=t=void 0===t?{}:t,this.id="forceAtlas2",this.options=k(k({},ix),t)}var ax={maxIteration:1e3,gravity:10,speed:5,clustering:!1,clusterGravity:10,width:300,height:300,nodeClusterBy:"cluster"},_a=(sx.prototype.execute=function(e,n){return s(this,void 0,void 0,function(){return U(this,function(t){return[2,this.genericFruchtermanLayout(!1,e,n)]})})},sx.prototype.assign=function(e,n){return s(this,void 0,void 0,function(){return U(this,function(t){return this.genericFruchtermanLayout(!0,e,n),[2]})})},sx.prototype.stop=function(){this.timeInterval&&"undefined"!=typeof window&&window.clearInterval(this.timeInterval),this.running=!1},sx.prototype.tick=function(t){var e=this;if(void 0===t&&(t=this.options.maxIteration||1),this.lastResult)return this.lastResult;for(var n=0;n<t;n++)this.runOneStep(this.lastGraph,this.lastClusterMap,this.lastOptions);var r={nodes:this.lastLayoutNodes,edges:this.lastLayoutEdges};return this.lastAssign&&r.nodes.forEach(function(t){return e.lastGraph.mergeNodeData(t.id,{x:t.data.x,y:t.data.y,z:3===e.options.dimensions?t.data.z:void 0})}),r},sx.prototype.genericFruchtermanLayout=function(y,E,_){return s(this,void 0,void 0,function(){var e,n,r,i,o,a,s,l,u,c,h,d,f,p,g,m,v=this;return U(this,function(t){return this.running?[2]:(e=this.formatOptions(_),n=e.dimensions,r=e.width,i=e.height,o=e.center,a=e.clustering,s=e.nodeClusterBy,l=e.maxIteration,u=e.onTick,c=E.getAllNodes(),h=E.getAllEdges(),null!=c&&c.length?1===c.length?(y&&E.mergeNodeData(c[0].id,{x:o[0],y:o[1],z:3===n?o[2]:void 0}),d={nodes:[k(k({},c[0]),{data:k(k({},c[0].data),{x:o[0],y:o[1],z:3===n?o[2]:void 0})})],edges:h},[2,this.lastResult=d]):(f=c.map(function(t){return Ey(t,[r,i])}),p=new fy({nodes:f,edges:h}),g={},a&&f.forEach(function(t){t=t.data[s];g[t]||(g[t]={name:t,cx:0,cy:0,count:0})}),this.lastLayoutNodes=f,this.lastLayoutEdges=h,this.lastAssign=y,this.lastGraph=p,this.lastOptions=e,this.lastClusterMap=g,"undefined"==typeof window?[2]:(m=0,[2,new Promise(function(t){v.timeInterval=window.setInterval(function(){v.running?(v.runOneStep(p,g,e),y&&f.forEach(function(t){var e=t.id,t=t.data;return E.mergeNodeData(e,{x:t.x,y:t.y,z:3===n?t.z:void 0})}),null!=u&&u({nodes:f,edges:h}),l<=++m&&(window.clearInterval(v.timeInterval),t({nodes:f,edges:h}))):t({nodes:f,edges:h})},0),v.running=!0})])):(d={nodes:[],edges:h},[2,this.lastResult=d]))})})},sx.prototype.formatOptions=function(t){void 0===t&&(t={});var t=k(k({},this.options),t),e=t.clustering,n=t.nodeClusterBy,r=t.center,i=t.width,o=t.height;return t.width=i||"undefined"==typeof window?i:window.innerWidth,t.height=o||"undefined"==typeof window?o:window.innerHeight,t.center=r||[t.width/2,t.height/2],t.clustering=e&&!!n,t},sx.prototype.runOneStep=function(o,a,t){var s=t.dimensions,e=t.height,n=t.width,i=t.gravity,l=t.center,u=t.speed,r=t.clustering,c=t.nodeClusterBy,t=t.clusterGravity,e=e*n,h=Math.sqrt(e)/10,n=o.getAllNodes(),e=e/(n.length+1),d=Math.sqrt(e),f={};if(this.applyCalculate(o,f,d,e),r){for(var p in a)a[p].cx=0,a[p].cy=0,a[p].count=0;for(var p in n.forEach(function(t){var t=t.data,e=a[t[c]];B(t.x)&&(e.cx+=t.x),B(t.y)&&(e.cy+=t.y),e.count++}),a)a[p].cx/=a[p].count,a[p].cy/=a[p].count;var g=t||i;n.forEach(function(t,e){var n,r,i,o=t.id,t=t.data;B(t.x)&&B(t.y)&&(n=a[t[c]],r=Math.sqrt((t.x-n.cx)*(t.x-n.cx)+(t.y-n.cy)*(t.y-n.cy)),f[o].x-=(i=d*g)*(t.x-n.cx)/r,f[o].y-=i*(t.y-n.cy)/r)})}n.forEach(function(t,e){var n,r=t.id,t=t.data;B(t.x)&&B(t.y)&&(f[r].x-=(n=.01*d*i)*(t.x-l[0]),f[r].y-=n*(t.y-l[1]),3===s)&&(f[r].z-=n*(t.z-l[2]))}),n.forEach(function(t,e){var n,r,i=t.id,t=t.data;B(t.fx)&&B(t.fy)?(t.x=t.fx,t.y=t.fy,3===s&&(t.z=t.fz)):B(t.x)&&B(t.y)&&0<(n=Math.sqrt(f[i].x*f[i].x+f[i].y*f[i].y+(3===s?f[i].z*f[i].z:0)))&&(r=Math.min(u/800*h,n),o.mergeNodeData(i,{x:t.x+f[i].x/n*r,y:t.y+f[i].y/n*r,z:3===s?t.z+f[i].z/n*r:void 0}))})},sx.prototype.applyCalculate=function(t,e,n,r){this.calRepulsive(t,e,r),this.calAttractive(t,e,n)},sx.prototype.calRepulsive=function(t,l,u){var c=this,e=t.getAllNodes();e.forEach(function(t,o){var a=t.data,s=t.id;l[s]={x:0,y:0,z:0},e.forEach(function(t,e){var n,r,i=t.data,t=t.id;!(o<=e)&&B(a.x)&&B(i.x)&&B(a.y)&&B(i.y)&&(0===(r=(e=a.x-i.x)*e+(n=a.y-i.y)*n+(i=3===c.options.dimensions?a.z-i.z:0)*i)&&(r=1,i=n=e=.01),r=n*(n=u/r),i=i*n,l[s].x+=e=e*n,l[s].y+=r,l[t].x-=e,l[t].y-=r,3===c.options.dimensions)&&(l[s].z+=i,l[t].z-=i)})})},sx.prototype.calAttractive=function(a,s,l){var u=this;a.getAllEdges().forEach(function(t){var e,n,r,i,o=t.source,t=t.target;o&&t&&o!==t&&(e=a.getNode(o).data,i=a.getNode(t).data,B(i.x))&&B(e.x)&&B(i.y)&&B(e.y)&&(n=i.x-e.x,r=i.y-e.y,i=3===u.options.dimensions?i.z-e.z:0,r=r*(e=Math.sqrt(n*n+r*r+i*i)/l),i=i*e,s[o].x+=n=n*e,s[o].y+=r,s[t].x-=n,s[t].y-=r,3===u.options.dimensions)&&(s[o].z+=i,s[t].z-=i)})},sx);function sx(t){this.options=t=void 0===t?{}:t,this.id="fruchterman",this.timeInterval=0,this.running=!1,this.options=k(k({},ax),t)}var lx={begin:[0,0],preventOverlap:!0,preventOverlapPadding:10,condense:!1,rows:void 0,cols:void 0,position:void 0,sortBy:"degree",nodeSize:30,width:300,height:300},ba=(ux.prototype.execute=function(e,n){return s(this,void 0,void 0,function(){return U(this,function(t){return[2,this.genericGridLayout(!1,e,n)]})})},ux.prototype.assign=function(e,n){return s(this,void 0,void 0,function(){return U(this,function(t){return this.genericGridLayout(!0,e,n),[2]})})},ux.prototype.genericGridLayout=function(O,I,L){return s(this,void 0,void 0,function(){var e,n,r,i,o,a,s,l,u,c,h,d,f,p,g,m,v,y,E,_,b,x,S,w,T,A,M,R,N,C,P;return U(this,function(t){if(f=k(k({},this.options),L),n=f.begin,e=void 0===n?[0,0]:n,n=f.condense,r=f.preventOverlapPadding,i=f.preventOverlap,o=f.rows,a=f.cols,s=f.nodeSpacing,l=f.nodeSize,p=f.width,v=f.height,u=f.position,c=f.sortBy,f=I.getAllNodes(),h=I.getAllEdges(),!(P=null==f?void 0:f.length)||1===P)return[2,Sy(I,O,e)];if(d=f.map(function(t){return Ey(t)}),"degree"===(c="id"===c||Fe(c)&&void 0!==d[0].data[c]?c:"degree")?d.sort(function(t,e){return I.getDegree(e.id,"both")-I.getDegree(t.id,"both")}):"id"===c?d.sort(function(t,e){return B(e.id)&&B(t.id)?e.id-t.id:(""+t.id).localeCompare(""+e.id)}):d.sort(function(t,e){return e.data[c]-t.data[c]}),f=p||"undefined"==typeof window?p:window.innerWidth,p=v||"undefined"==typeof window?v:window.innerHeight,g=P,m={rows:o,cols:a},null!=o&&null!=a?(m.rows=o,m.cols=a):null!=o&&null==a?(m.rows=o,m.cols=Math.ceil(g/m.rows)):null==o&&null!=a?(m.cols=a,m.rows=Math.ceil(g/m.cols)):(v=Math.sqrt(g*p/f),m.rows=Math.round(v),m.cols=Math.round(f/p*v)),m.rows=Math.max(m.rows,1),m.cols=Math.max(m.cols,1),g<m.cols*m.rows)y=cx(m),E=hx(m),g<=(y-1)*E?cx(m,y-1):g<=(E-1)*y&&hx(m,E-1);else for(;m.cols*m.rows<g;)y=cx(m),E=hx(m),g<=(E+1)*y?hx(m,E+1):cx(m,y+1);for(_=n?0:f/m.cols,b=n?0:p/m.rows,(i||s)&&(x=_y(10,s),S=by(30,l,!1),d.forEach(function(t){t.data.x&&t.data.y||(t.data.x=0,t.data.y=0);var e,n=I.getNode(t.id),n=S(n)||30,n=my(n)?(e=n[0],n[1]):e=n,t=void 0!==x?x(t):r,n=n+t;_=Math.max(_,e+t),b=Math.max(b,n)})),w={},T={row:0,col:0},A={},M=0;M<d.length;M++){if(R=d[M],N=void 0,(N=u?u(I.getNode(R.id)):N)&&(void 0!==N.row||void 0!==N.col)){if(void 0===(C={row:N.row,col:N.col}).col)for(C.col=0;dx(w,C);)C.col++;else if(void 0===C.row)for(C.row=0;dx(w,C);)C.row++;A[R.id]=C,fx(w,C)}gx(R,e,_,b,A,m,T,w)}return P={nodes:d,edges:h},O&&d.forEach(function(t){I.mergeNodeData(t.id,{x:t.data.x,y:t.data.y})}),[2,P]})})},ux);function ux(t){this.options=t=void 0===t?{}:t,this.id="grid",this.options=k(k({},lx),t)}var _,cx=function(t,e){var n,r=t.rows||5,i=t.cols||5;return null==e?n=Math.min(r,i):Math.min(r,i)===t.rows?t.rows=e:t.cols=e,n},hx=function(t,e){var n,r=t.rows||5,i=t.cols||5;return null==e?n=Math.max(r,i):Math.max(r,i)===t.rows?t.rows=e:t.cols=e,n},dx=function(t,e){return t["c-"+e.row+"-"+e.col]||!1},fx=function(t,e){return t["c-"+e.row+"-"+e.col]=!0},px=function(t,e){t=t.cols||5;e.col++,e.col>=t&&(e.col=0,e.row++)},gx=function(t,e,n,r,i,o,a,s){var l,u,i=i[t.id];if(i)l=i.col*n+n/2+e[0],u=i.row*r+r/2+e[1];else{for(;dx(s,a);)px(o,a);l=a.col*n+n/2+e[0],u=a.row*r+r/2+e[1],fx(s,a),px(o,a)}t.data.x=l,t.data.y=u};const mx=Object.prototype.toString;function vx(t){t=mx.call(t);return t.endsWith("Array]")&&!t.includes("Big")}function yx(t,e){var n,e=1<arguments.length&&void 0!==e?e:{};if(!vx(t))throw new TypeError("input must be an array");if(0===t.length)throw new TypeError("input must not be empty");if(void 0!==e.output){if(!vx(e.output))throw new TypeError("output option must be an array if specified");n=e.output}else n=new Array(t.length);var r=function(t,e){if(e=1<arguments.length&&void 0!==e?e:{},!vx(t))throw new TypeError("input must be an array");if(0===t.length)throw new TypeError("input must not be empty");var n=void 0===(n=e.fromIndex)?0:n,e=e.toIndex,r=void 0===e?t.length:e;if(n<0||n>=t.length||!Number.isInteger(n))throw new Error("fromIndex must be a positive integer smaller than length");if(r<=n||r>t.length||!Number.isInteger(r))throw new Error("toIndex must be an integer greater than fromIndex and at most equal to length");for(var i=t[n],o=n+1;o<r;o++)t[o]<i&&(i=t[o]);return i}(t),i=function(t,e){if(e=1<arguments.length&&void 0!==e?e:{},!vx(t))throw new TypeError("input must be an array");if(0===t.length)throw new TypeError("input must not be empty");var n=void 0===(n=e.fromIndex)?0:n,e=e.toIndex,r=void 0===e?t.length:e;if(n<0||n>=t.length||!Number.isInteger(n))throw new Error("fromIndex must be a positive integer smaller than length");if(r<=n||r>t.length||!Number.isInteger(r))throw new Error("toIndex must be an integer greater than fromIndex and at most equal to length");for(var i=t[n],o=n+1;o<r;o++)t[o]>i&&(i=t[o]);return i}(t);if(r===i)throw new RangeError("minimum and maximum input values are equal. Cannot rescale a constant array");var o=e.min,a=void 0===o?e.autoMinMax?r:0:o,o=e.max,e=void 0===o?e.autoMinMax?i:1:o;if(e<=a)throw new RangeError("min option must be smaller than max option");for(var s=(e-a)/(i-r),l=0;l<t.length;l++)n[l]=(t[l]-r)*s+a}const Ex=" ".repeat(2),_x=" ".repeat(4);function bx(t,e={}){var{maxRows:e=15,maxColumns:n=10,maxNumSize:r=8,padMinus:i="auto"}=e;return`${t.constructor.name} {
|
|
2
2
|
${Ex}[
|
|
3
3
|
${_x}${function(n,t,e,r,i){var{rows:o,columns:a}=n,s=Math.min(o,t),l=Math.min(a,e),u=[];if("auto"===i){i=!1;t:for(let e=0;e<s;e++)for(let t=0;t<l;t++)if(n.get(e,t)<0){i=!0;break t}}for(let e=0;e<s;e++){var c=[];for(let t=0;t<l;t++)c.push(function(t,e,n){return(0<=t&&n?" "+xx(t,e-1):xx(t,e)).padEnd(e)}(n.get(e,t),r,i));u.push(""+c.join(" "))}l!==a&&(u[u.length-1]+=` ... ${a-e} more columns`);s!==o&&u.push(`... ${o-t} more rows`);return u.join(`
|
|
4
4
|
`+_x)}(t,e,n,r,i)}
|